Exemplo n.º 1
0
static ACPI_STATUS
AcpiDbTestOneObject (
    ACPI_HANDLE             ObjHandle,
    UINT32                  NestingLevel,
    void                    *Context,
    void                    **ReturnValue)
{
    ACPI_NAMESPACE_NODE     *Node;
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OPERAND_OBJECT     *RegionObj;
    ACPI_OBJECT_TYPE        LocalType;
    UINT32                  BitLength = 0;
    UINT32                  ByteLength = 0;
    ACPI_STATUS             Status = AE_OK;


    Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
    ObjDesc = Node->Object;

    /*
     * For the supported types, get the actual bit length or
     * byte length. Map the type to one of Integer/String/Buffer.
     */
    switch (Node->Type)
    {
    case ACPI_TYPE_INTEGER:

        /* Integer width is either 32 or 64 */

        LocalType = ACPI_TYPE_INTEGER;
        BitLength = AcpiGbl_IntegerBitWidth;
        break;

    case ACPI_TYPE_STRING:

        LocalType = ACPI_TYPE_STRING;
        ByteLength = ObjDesc->String.Length;
        break;

    case ACPI_TYPE_BUFFER:

        LocalType = ACPI_TYPE_BUFFER;
        ByteLength = ObjDesc->Buffer.Length;
        BitLength = ByteLength * 8;
        break;

    case ACPI_TYPE_FIELD_UNIT:
    case ACPI_TYPE_BUFFER_FIELD:
    case ACPI_TYPE_LOCAL_REGION_FIELD:
    case ACPI_TYPE_LOCAL_INDEX_FIELD:
    case ACPI_TYPE_LOCAL_BANK_FIELD:

        LocalType = ACPI_TYPE_INTEGER;
        if (ObjDesc)
        {
            /*
             * Returned object will be a Buffer if the field length
             * is larger than the size of an Integer (32 or 64 bits
             * depending on the DSDT version).
             */
            BitLength = ObjDesc->CommonField.BitLength;
            ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
            if (BitLength > AcpiGbl_IntegerBitWidth)
            {
                LocalType = ACPI_TYPE_BUFFER;
            }
        }
        break;

    default:

        /* Ignore all other types */

        return (AE_OK);
    }

    /* Emit the common prefix: Type:Name */

    AcpiOsPrintf ("%14s: %4.4s",
        AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);
    if (!ObjDesc)
    {
        AcpiOsPrintf (" Ignoring, no attached object\n");
        return (AE_OK);
    }

    /*
     * Check for unsupported region types. Note: AcpiExec simulates
     * access to SystemMemory, SystemIO, PCI_Config, and EC.
     */
    switch (Node->Type)
    {
    case ACPI_TYPE_LOCAL_REGION_FIELD:

        RegionObj = ObjDesc->Field.RegionObj;
        switch (RegionObj->Region.SpaceId)
        {
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
        case ACPI_ADR_SPACE_SYSTEM_IO:
        case ACPI_ADR_SPACE_PCI_CONFIG:
        case ACPI_ADR_SPACE_EC:

            break;

        default:

            AcpiOsPrintf ("      %s space is not supported [%4.4s]\n",
                AcpiUtGetRegionName (RegionObj->Region.SpaceId),
                RegionObj->Region.Node->Name.Ascii);
            return (AE_OK);
        }
        break;

    default:
        break;
    }

    /* At this point, we have resolved the object to one of the major types */

    switch (LocalType)
    {
    case ACPI_TYPE_INTEGER:

        Status = AcpiDbTestIntegerType (Node, BitLength);
        break;

    case ACPI_TYPE_STRING:

        Status = AcpiDbTestStringType (Node, ByteLength);
        break;

    case ACPI_TYPE_BUFFER:

        Status = AcpiDbTestBufferType (Node, BitLength);
        break;

    default:

        AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)",
            LocalType);
        break;
    }

    switch (Node->Type)
    {
    case ACPI_TYPE_LOCAL_REGION_FIELD:

        RegionObj = ObjDesc->Field.RegionObj;
        AcpiOsPrintf (" (%s)",
            AcpiUtGetRegionName (RegionObj->Region.SpaceId));
        break;

    default:
        break;
    }

    AcpiOsPrintf ("\n");
    return (Status);
}
Exemplo n.º 2
0
static ACPI_STATUS
AcpiDbTestOneObject (
    ACPI_HANDLE             ObjHandle,
    UINT32                  NestingLevel,
    void                    *Context,
    void                    **ReturnValue)
{
    ACPI_NAMESPACE_NODE     *Node;
    ACPI_OPERAND_OBJECT     *ObjDesc;
    ACPI_OBJECT_TYPE        LocalType;
    UINT32                  BitLength = 0;
    UINT32                  ByteLength = 0;
    ACPI_STATUS             Status = AE_OK;


    Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
    ObjDesc = Node->Object;

    /*
     * For the supported types, get the actual bit length or
     * byte length. Map the type to one of Integer/String/Buffer.
     */
    switch (Node->Type)
    {
    case ACPI_TYPE_INTEGER:

        /* Integer width is either 32 or 64 */

        LocalType = ACPI_TYPE_INTEGER;
        BitLength = AcpiGbl_IntegerBitWidth;
        break;

    case ACPI_TYPE_STRING:

        LocalType = ACPI_TYPE_STRING;
        ByteLength = ObjDesc->String.Length;
        break;

    case ACPI_TYPE_BUFFER:

        LocalType = ACPI_TYPE_BUFFER;
        ByteLength = ObjDesc->Buffer.Length;
        BitLength = ByteLength * 8;
        break;

    case ACPI_TYPE_PACKAGE:

        LocalType = ACPI_TYPE_PACKAGE;
        break;

    case ACPI_TYPE_FIELD_UNIT:
    case ACPI_TYPE_LOCAL_REGION_FIELD:
    case ACPI_TYPE_LOCAL_INDEX_FIELD:
    case ACPI_TYPE_LOCAL_BANK_FIELD:

        LocalType = ACPI_TYPE_FIELD_UNIT;
        break;

    case ACPI_TYPE_BUFFER_FIELD:
        /*
         * The returned object will be a Buffer if the field length
         * is larger than the size of an Integer (32 or 64 bits
         * depending on the DSDT version).
         */
        LocalType = ACPI_TYPE_INTEGER;
        if (ObjDesc)
        {
            BitLength = ObjDesc->CommonField.BitLength;
            ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
            if (BitLength > AcpiGbl_IntegerBitWidth)
            {
                LocalType = ACPI_TYPE_BUFFER;
            }
        }
        break;

default:

        /* Ignore all non-data types - Methods, Devices, Scopes, etc. */

        return (AE_OK);
    }

    /* Emit the common prefix: Type:Name */

    AcpiOsPrintf ("%14s: %4.4s",
        AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);

    if (!ObjDesc)
    {
        AcpiOsPrintf (" No attached sub-object, ignoring\n");
        return (AE_OK);
    }

    /* At this point, we have resolved the object to one of the major types */

    switch (LocalType)
    {
    case ACPI_TYPE_INTEGER:

        Status = AcpiDbTestIntegerType (Node, BitLength);
        break;

    case ACPI_TYPE_STRING:

        Status = AcpiDbTestStringType (Node, ByteLength);
        break;

    case ACPI_TYPE_BUFFER:

        Status = AcpiDbTestBufferType (Node, BitLength);
        break;

    case ACPI_TYPE_PACKAGE:

        Status = AcpiDbTestPackageType (Node);
        break;

    case ACPI_TYPE_FIELD_UNIT:

        Status = AcpiDbTestFieldUnitType (ObjDesc);
        break;

    default:

        AcpiOsPrintf (" Ignoring, type not implemented (%2.2X)",
            LocalType);
        break;
    }

    /* Exit on error, but don't abort the namespace walk */

    if (ACPI_FAILURE (Status))
    {
        Status = AE_OK;
    }

    AcpiOsPrintf ("\n");
    return (Status);
}