FreeBSD/sys/contrib/dev/acpica/compiler/aslbtypes.c
/*******************************************************************************
 *
 * FUNCTION:    AnMapEtypeToBtype
 *
 * PARAMETERS:  Etype               - Encoded ACPI Type
 *
 * RETURN:      Btype corresponding to the Etype
 *
 * DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
 *              operand conversion rules. In other words, returns the type(s)
 *              this Etype is implicitly converted to during interpretation.
 *
 ******************************************************************************/
AnMapEtypeToBtype
PARAMETERS:  Etype               - Encoded ACPI Type

Btype corresponding to the Etype

Convert an encoded ACPI type to a bitfield type applying the
operand conversion rules. In other words, returns the type(s)
this Etype is implicitly converted to during interpretation.
AnMapEtypeToBtype PARAMETERS : Etype - Encoded ACPI Type Btype corresponding to the Etype Convert an encoded ACPI type to a bitfield type applying the operand conversion rules . In other words returns the type ( s ) this Etype is implicitly converted to during interpretation .
static UINT32
AnMapEtypeToBtype (
    UINT32                  Etype)
{
    if (Etype == ACPI_TYPE_ANY)
    {
        return (ACPI_BTYPE_OBJECTS_AND_REFS);
    }
    if (Etype <= ACPI_TYPE_EXTERNAL_MAX)
    {
        switch (Etype)
        {
        case ACPI_TYPE_INTEGER:
            return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE);
        case ACPI_TYPE_STRING:
        case ACPI_TYPE_BUFFER:
            return (ACPI_BTYPE_COMPUTE_DATA);
        case ACPI_TYPE_PACKAGE:
            return (ACPI_BTYPE_PACKAGE);
        case ACPI_TYPE_FIELD_UNIT:
            return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
        case ACPI_TYPE_BUFFER_FIELD:
            return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD);
        case ACPI_TYPE_DDB_HANDLE:
            return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE);
        case ACPI_TYPE_DEBUG_OBJECT:
            return (0);
        default:
            return (1 << (Etype - 1));
        }
    }
    switch (Etype)
    {
    case ACPI_TYPE_LOCAL_REGION_FIELD:
    case ACPI_TYPE_LOCAL_BANK_FIELD:
    case ACPI_TYPE_LOCAL_INDEX_FIELD:
        return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT);
    case ACPI_TYPE_LOCAL_ALIAS:
        return (ACPI_BTYPE_INTEGER);
    case ACPI_TYPE_LOCAL_RESOURCE:
    case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
        return (ACPI_BTYPE_REFERENCE_OBJECT);
    default:
        printf ("Unhandled encoded type: %X\n", Etype);
        return (0);
    }
}
static UINT32 AnMapEtypeToBtype ( UINT32 Etype ) { if ( Etype == ACPI_TYPE_ANY ) { return ( ACPI_BTYPE_OBJECTS_AND_REFS ) ; } if ( Etype <= ACPI_TYPE_EXTERNAL_MAX ) { switch ( Etype ) { case ACPI_TYPE_INTEGER : return ( ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE ) ; case ACPI_TYPE_STRING : case ACPI_TYPE_BUFFER : return ( ACPI_BTYPE_COMPUTE_DATA ) ; case ACPI_TYPE_PACKAGE : return ( ACPI_BTYPE_PACKAGE ) ; case ACPI_TYPE_FIELD_UNIT : return ( ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT ) ; case ACPI_TYPE_BUFFER_FIELD : return ( ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD ) ; case ACPI_TYPE_DDB_HANDLE : return ( ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE ) ; case ACPI_TYPE_DEBUG_OBJECT : return ( 0 ) ; default : return ( 1 << ( Etype - 1 ) ) ; } } switch ( Etype ) { case ACPI_TYPE_LOCAL_REGION_FIELD : case ACPI_TYPE_LOCAL_BANK_FIELD : case ACPI_TYPE_LOCAL_INDEX_FIELD : return ( ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT ) ; case ACPI_TYPE_LOCAL_ALIAS : return ( ACPI_BTYPE_INTEGER ) ; case ACPI_TYPE_LOCAL_RESOURCE : case ACPI_TYPE_LOCAL_RESOURCE_FIELD : return ( ACPI_BTYPE_REFERENCE_OBJECT ) ; default : printf ( " \n " , Etype ) ; return ( 0 ) ; } }
FUNCTION:    AnMapEtypeToBtype
 PARAMETERS:  Etype               - Encoded ACPI Type
FUNCTION : AnMapEtypeToBtype PARAMETERS : Etype - Encoded ACPI Type
/* Try the standard ACPI data types */ /*
         * This switch statement implements the allowed operand conversion
         * rules as per the "ASL Data Types" section of the ACPI
         * specification.
         */ /* Cannot be used as a source operand */ /* Try the internal data types */ /* Named fields can be either Integer/Buffer/String */