ASL_RESOURCE_NODE *
RsDoOneResourceDescriptor (
    ACPI_PARSE_OBJECT       *DescriptorTypeOp,
    UINT32                  CurrentByteOffset,
    UINT8                   *State)
{
    ASL_RESOURCE_NODE       *Rnode = NULL;


    /* Construct the resource */

    switch (DescriptorTypeOp->Asl.ParseOpcode)
    {
    case PARSEOP_DMA:
        Rnode = RsDoDmaDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_DWORDIO:
        Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_DWORDMEMORY:
        Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_DWORDSPACE:
        Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_ENDDEPENDENTFN:
        switch (*State)
        {
        case ACPI_RSTATE_NORMAL:
            AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT,
                DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_START_DEPENDENT:
            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_DEPENDENT_LIST:
        default:
            break;
        }

        *State = ACPI_RSTATE_NORMAL;
        Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_ENDTAG:
        Rnode = RsDoEndTagDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_EXTENDEDIO:
        Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_EXTENDEDMEMORY:
        Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_EXTENDEDSPACE:
        Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_FIXEDIO:
        Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_INTERRUPT:
        Rnode = RsDoInterruptDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_IO:
        Rnode = RsDoIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_IRQ:
        Rnode = RsDoIrqDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_IRQNOFLAGS:
        Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_MEMORY24:
        Rnode = RsDoMemory24Descriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_MEMORY32:
        Rnode = RsDoMemory32Descriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_MEMORY32FIXED:
        Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_QWORDIO:
        Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_QWORDMEMORY:
        Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_QWORDSPACE:
        Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_REGISTER:
        Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_STARTDEPENDENTFN:
        switch (*State)
        {
        case ACPI_RSTATE_START_DEPENDENT:
            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_NORMAL:
        case ACPI_RSTATE_DEPENDENT_LIST:
        default:
            break;
        }

        *State = ACPI_RSTATE_START_DEPENDENT;
        Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        *State = ACPI_RSTATE_DEPENDENT_LIST;
        break;

    case PARSEOP_STARTDEPENDENTFN_NOPRI:
        switch (*State)
        {
        case ACPI_RSTATE_START_DEPENDENT:
            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_NORMAL:
        case ACPI_RSTATE_DEPENDENT_LIST:
        default:
            break;
        }

        *State = ACPI_RSTATE_START_DEPENDENT;
        Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        *State = ACPI_RSTATE_DEPENDENT_LIST;
        break;

    case PARSEOP_VENDORLONG:
        Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_VENDORSHORT:
        Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_WORDBUSNUMBER:
        Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_WORDIO:
        Rnode = RsDoWordIoDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_WORDSPACE:
        Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp,
                    CurrentByteOffset);
        break;

    case PARSEOP_DEFAULT_ARG:
        /* Just ignore any of these, they are used as fillers/placeholders */
        break;

    default:
        printf ("Unknown resource descriptor type [%s]\n",
                    DescriptorTypeOp->Asl.ParseOpName);
        break;
    }

    /*
     * Mark original node as unused, but head of a resource descriptor.
     * This allows the resource to be installed in the namespace so that
     * references to the descriptor can be resolved.
     */
    DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
    DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset;

    if (Rnode)
    {
        DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
    }

    return (Rnode);
}
Exemplo n.º 2
0
ASL_RESOURCE_NODE *
RsDoOneResourceDescriptor (
    ASL_RESOURCE_INFO       *Info,
    UINT8                   *State)
{
    ASL_RESOURCE_NODE       *Rnode = NULL;


    /* Construct the resource */

    switch (Info->DescriptorTypeOp->Asl.ParseOpcode)
    {
    case PARSEOP_DMA:

        Rnode = RsDoDmaDescriptor (Info);
        break;

    case PARSEOP_FIXEDDMA:

        Rnode = RsDoFixedDmaDescriptor (Info);
        break;

    case PARSEOP_DWORDIO:

        Rnode = RsDoDwordIoDescriptor (Info);
        break;

    case PARSEOP_DWORDMEMORY:

        Rnode = RsDoDwordMemoryDescriptor (Info);
        break;

    case PARSEOP_DWORDSPACE:

        Rnode = RsDoDwordSpaceDescriptor (Info);
        break;

    case PARSEOP_ENDDEPENDENTFN:

        switch (*State)
        {
        case ACPI_RSTATE_NORMAL:

            AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT,
                Info->DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_START_DEPENDENT:

            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                Info->DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_DEPENDENT_LIST:
        default:

            break;
        }

        *State = ACPI_RSTATE_NORMAL;
        Rnode = RsDoEndDependentDescriptor (Info);
        break;

    case PARSEOP_ENDTAG:

        Rnode = RsDoEndTagDescriptor (Info);
        break;

    case PARSEOP_EXTENDEDIO:

        Rnode = RsDoExtendedIoDescriptor (Info);
        break;

    case PARSEOP_EXTENDEDMEMORY:

        Rnode = RsDoExtendedMemoryDescriptor (Info);
        break;

    case PARSEOP_EXTENDEDSPACE:

        Rnode = RsDoExtendedSpaceDescriptor (Info);
        break;

    case PARSEOP_FIXEDIO:

        Rnode = RsDoFixedIoDescriptor (Info);
        break;

    case PARSEOP_INTERRUPT:

        Rnode = RsDoInterruptDescriptor (Info);
        break;

    case PARSEOP_IO:

        Rnode = RsDoIoDescriptor (Info);
        break;

    case PARSEOP_IRQ:

        Rnode = RsDoIrqDescriptor (Info);
        break;

    case PARSEOP_IRQNOFLAGS:

        Rnode = RsDoIrqNoFlagsDescriptor (Info);
        break;

    case PARSEOP_MEMORY24:

        Rnode = RsDoMemory24Descriptor (Info);
        break;

    case PARSEOP_MEMORY32:

        Rnode = RsDoMemory32Descriptor (Info);
        break;

    case PARSEOP_MEMORY32FIXED:

        Rnode = RsDoMemory32FixedDescriptor (Info);
        break;

    case PARSEOP_QWORDIO:

        Rnode = RsDoQwordIoDescriptor (Info);
        break;

    case PARSEOP_QWORDMEMORY:

        Rnode = RsDoQwordMemoryDescriptor (Info);
        break;

    case PARSEOP_QWORDSPACE:

        Rnode = RsDoQwordSpaceDescriptor (Info);
        break;

    case PARSEOP_REGISTER:

        Rnode = RsDoGeneralRegisterDescriptor (Info);
        break;

    case PARSEOP_STARTDEPENDENTFN:

        switch (*State)
        {
        case ACPI_RSTATE_START_DEPENDENT:

            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                Info->DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_NORMAL:
        case ACPI_RSTATE_DEPENDENT_LIST:
        default:

            break;
        }

        *State = ACPI_RSTATE_START_DEPENDENT;
        Rnode = RsDoStartDependentDescriptor (Info);
        *State = ACPI_RSTATE_DEPENDENT_LIST;
        break;

    case PARSEOP_STARTDEPENDENTFN_NOPRI:

        switch (*State)
        {
        case ACPI_RSTATE_START_DEPENDENT:

            AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
                Info->DescriptorTypeOp, NULL);
            break;

        case ACPI_RSTATE_NORMAL:
        case ACPI_RSTATE_DEPENDENT_LIST:
        default:

            break;
        }

        *State = ACPI_RSTATE_START_DEPENDENT;
        Rnode = RsDoStartDependentNoPriDescriptor (Info);
        *State = ACPI_RSTATE_DEPENDENT_LIST;
        break;

    case PARSEOP_VENDORLONG:

        Rnode = RsDoVendorLargeDescriptor (Info);
        break;

    case PARSEOP_VENDORSHORT:

        Rnode = RsDoVendorSmallDescriptor (Info);
        break;

    case PARSEOP_WORDBUSNUMBER:

        Rnode = RsDoWordBusNumberDescriptor (Info);
        break;

    case PARSEOP_WORDIO:

        Rnode = RsDoWordIoDescriptor (Info);
        break;

    case PARSEOP_WORDSPACE:

        Rnode = RsDoWordSpaceDescriptor (Info);
        break;

    case PARSEOP_GPIO_INT:

        Rnode = RsDoGpioIntDescriptor (Info);
        break;

    case PARSEOP_GPIO_IO:

        Rnode = RsDoGpioIoDescriptor (Info);
        break;

    case PARSEOP_I2C_SERIALBUS:
    case PARSEOP_I2C_SERIALBUS_V2:

        Rnode = RsDoI2cSerialBusDescriptor (Info);
        break;

    case PARSEOP_SPI_SERIALBUS:
    case PARSEOP_SPI_SERIALBUS_V2:

        Rnode = RsDoSpiSerialBusDescriptor (Info);
        break;

    case PARSEOP_UART_SERIALBUS:
    case PARSEOP_UART_SERIALBUS_V2:

        Rnode = RsDoUartSerialBusDescriptor (Info);
        break;

    case PARSEOP_PINCONFIG:

        Rnode = RsDoPinConfigDescriptor (Info);
        break;

    case PARSEOP_PINFUNCTION:

        Rnode = RsDoPinFunctionDescriptor (Info);
        break;

    case PARSEOP_PINGROUP:

        Rnode = RsDoPinGroupDescriptor (Info);
        break;

    case PARSEOP_PINGROUPFUNCTION:

        Rnode = RsDoPinGroupFunctionDescriptor (Info);
        break;

    case PARSEOP_PINGROUPCONFIG:

        Rnode = RsDoPinGroupConfigDescriptor (Info);
        break;

    case PARSEOP_DEFAULT_ARG:

        /* Just ignore any of these, they are used as fillers/placeholders */
        break;

    default:

        printf ("Unknown resource descriptor type [%s]\n",
            Info->DescriptorTypeOp->Asl.ParseOpName);
        break;
    }

    /*
     * Mark original node as unused, but head of a resource descriptor.
     * This allows the resource to be installed in the namespace so that
     * references to the descriptor can be resolved.
     */
    Info->DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
    Info->DescriptorTypeOp->Asl.CompileFlags = OP_IS_RESOURCE_DESC;
    Info->DescriptorTypeOp->Asl.Value.Integer = Info->CurrentByteOffset;

    if (Rnode)
    {
        Info->DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
        Info->DescriptorTypeOp->Asl.Extra =
            ((AML_RESOURCE *) Rnode->Buffer)->DescriptorType;
    }

    return (Rnode);
}