FreeBSD/sys/contrib/dev/acpica/components/debugger/dbtest.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDbTestOneObject
 *
 * PARAMETERS:  ACPI_WALK_CALLBACK
 *
 * RETURN:      Status
 *
 * DESCRIPTION: Test one namespace object. Supported types are Integer,
 *              String, Buffer, BufferField, and FieldUnit. All other object
 *              types are simply ignored.
 *
 *              Note: Support for Packages is not implemented.
 *
 ******************************************************************************/


Status

Test one namespace object. Supported types are Integer,
String, Buffer, BufferField, and FieldUnit. All other object
types are simply ignored.

Support for Packages is not implemented.
Status Test one namespace object . Supported types are Integer String Buffer BufferField and FieldUnit . All other object types are simply ignored . Support for Packages is not implemented .
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;
    switch (Node->Type)
    {
    case ACPI_TYPE_INTEGER:
        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)
        {
            BitLength = ObjDesc->CommonField.BitLength;
            ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES (BitLength);
            if (BitLength > AcpiGbl_IntegerBitWidth)
            {
                LocalType = ACPI_TYPE_BUFFER;
            }
        }
        break;
    default:
        return (AE_OK);
    }
    AcpiOsPrintf ("%14s: %4.4s",
        AcpiUtGetTypeName (Node->Type), Node->Name.Ascii);
    if (!ObjDesc)
    {
        AcpiOsPrintf (" Ignoring, no attached object\n");
        return (AE_OK);
    }
    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;
    }
    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);
}
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 ; switch ( Node -> Type ) { case ACPI_TYPE_INTEGER : 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 ) { BitLength = ObjDesc -> CommonField . BitLength ; ByteLength = ACPI_ROUND_BITS_UP_TO_BYTES ( BitLength ) ; if ( BitLength > AcpiGbl_IntegerBitWidth ) { LocalType = ACPI_TYPE_BUFFER ; } } break ; default : return ( AE_OK ) ; } AcpiOsPrintf ( " " , AcpiUtGetTypeName ( Node -> Type ) , Node -> Name . Ascii ) ; if ( ! ObjDesc ) { AcpiOsPrintf ( " \n " ) ; return ( AE_OK ) ; } 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 ( " \n " , AcpiUtGetRegionName ( RegionObj -> Region . SpaceId ) , RegionObj -> Region . Node -> Name . Ascii ) ; return ( AE_OK ) ; } break ; default : break ; } 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 ( " " , LocalType ) ; break ; } switch ( Node -> Type ) { case ACPI_TYPE_LOCAL_REGION_FIELD : RegionObj = ObjDesc -> Field . RegionObj ; AcpiOsPrintf ( " " , AcpiUtGetRegionName ( RegionObj -> Region . SpaceId ) ) ; break ; default : break ; } AcpiOsPrintf ( " \n " ) ; return ( Status ) ; }
FUNCTION:    AcpiDbTestOneObject
 PARAMETERS:  ACPI_WALK_CALLBACK
FUNCTION : AcpiDbTestOneObject PARAMETERS : ACPI_WALK_CALLBACK
/*
     * For the supported types, get the actual bit length or
     * byte length. Map the type to one of Integer/String/Buffer.
     */ /* Integer width is either 32 or 64 */ /*
             * 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).
             */ /* Ignore all other types */ /* Emit the common prefix: Type:Name */ /*
     * Check for unsupported region types. Note: AcpiExec simulates
     * access to SystemMemory, SystemIO, PCI_Config, and EC.
     */ /* At this point, we have resolved the object to one of the major types */