FreeBSD/sys/contrib/dev/acpica/common/dmrestag.c
/*******************************************************************************
 *
 * FUNCTION:    AcpiDmGetResourceTag
 *
 * PARAMETERS:  BitIndex            - Index into the resource descriptor
 *              Resource            - Pointer to the raw resource data
 *              ResourceIndex       - Index correspoinding to the resource type
 *
 * RETURN:      Pointer to the resource tag (ACPI_NAME). NULL if no match.
 *
 * DESCRIPTION: Convert a BitIndex into a symbolic resource tag.
 *
 * Note: ResourceIndex should be previously validated and guaranteed to ve
 *       valid.
 *
 ******************************************************************************/
AcpiDmGetResourceTag
PARAMETERS:  BitIndex            - Index into the resource descriptor
Resource            - Pointer to the raw resource data
ResourceIndex       - Index correspoinding to the resource type

Pointer to the resource tag (ACPI_NAME). NULL if no match.

Convert a BitIndex into a symbolic resource tag.

ResourceIndex should be previously validated and guaranteed to ve
valid.
AcpiDmGetResourceTag PARAMETERS : BitIndex - Index into the resource descriptor Resource - Pointer to the raw resource data ResourceIndex - Index correspoinding to the resource type Pointer to the resource tag ( ACPI_NAME ) . NULL if no match . Convert a BitIndex into a symbolic resource tag . ResourceIndex should be previously validated and guaranteed to ve valid .
static char *
AcpiDmGetResourceTag (
    UINT32                  BitIndex,
    AML_RESOURCE            *Resource,
    UINT8                   ResourceIndex)
{
    const ACPI_RESOURCE_TAG *TagList;
    char                    *Tag = NULL;
    TagList = AcpiGbl_ResourceTags[ResourceIndex];
    switch (Resource->DescriptorType)
    {
    case ACPI_RESOURCE_NAME_ADDRESS16:
    case ACPI_RESOURCE_NAME_ADDRESS32:
    case ACPI_RESOURCE_NAME_ADDRESS64:
    case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
        if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE)
        {
            Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags);
        }
        else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE)
        {
            Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags);
        }
        if (Tag)
        {
            return (Tag);
        }
        break;
    case ACPI_RESOURCE_NAME_GPIO:
        if (Resource->Gpio.ConnectionType > AML_RESOURCE_MAX_GPIOTYPE)
        {
            return (NULL);
        }
        TagList = AcpiGbl_GpioResourceTags[Resource->Gpio.ConnectionType];
        break;
    case ACPI_RESOURCE_NAME_SERIAL_BUS:
        if ((Resource->CommonSerialBus.Type == 0) ||
            (Resource->CommonSerialBus.Type > AML_RESOURCE_MAX_SERIALBUSTYPE))
        {
            return (NULL);
        }
        TagList = AcpiGbl_SerialResourceTags[Resource->CommonSerialBus.Type];
        break;
    default:
        break;
    }
    if (TagList)
    {
        Tag = AcpiDmSearchTagList (BitIndex, TagList);
    }
    return (Tag);
}
static char * AcpiDmGetResourceTag ( UINT32 BitIndex , AML_RESOURCE * Resource , UINT8 ResourceIndex ) { const ACPI_RESOURCE_TAG * TagList ; char * Tag = NULL ; TagList = AcpiGbl_ResourceTags [ ResourceIndex ] ; switch ( Resource -> DescriptorType ) { case ACPI_RESOURCE_NAME_ADDRESS16 : case ACPI_RESOURCE_NAME_ADDRESS32 : case ACPI_RESOURCE_NAME_ADDRESS64 : case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 : if ( Resource -> Address . ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE ) { Tag = AcpiDmSearchTagList ( BitIndex , AcpiDmMemoryFlagTags ) ; } else if ( Resource -> Address . ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE ) { Tag = AcpiDmSearchTagList ( BitIndex , AcpiDmIoFlagTags ) ; } if ( Tag ) { return ( Tag ) ; } break ; case ACPI_RESOURCE_NAME_GPIO : if ( Resource -> Gpio . ConnectionType > AML_RESOURCE_MAX_GPIOTYPE ) { return ( NULL ) ; } TagList = AcpiGbl_GpioResourceTags [ Resource -> Gpio . ConnectionType ] ; break ; case ACPI_RESOURCE_NAME_SERIAL_BUS : if ( ( Resource -> CommonSerialBus . Type == 0 ) || ( Resource -> CommonSerialBus . Type > AML_RESOURCE_MAX_SERIALBUSTYPE ) ) { return ( NULL ) ; } TagList = AcpiGbl_SerialResourceTags [ Resource -> CommonSerialBus . Type ] ; break ; default : break ; } if ( TagList ) { Tag = AcpiDmSearchTagList ( BitIndex , TagList ) ; } return ( Tag ) ; }
FUNCTION:    AcpiDmGetResourceTag
 PARAMETERS:  BitIndex            - Index into the resource descriptor
              Resource            - Pointer to the raw resource data
              ResourceIndex       - Index correspoinding to the resource type
FUNCTION : AcpiDmGetResourceTag PARAMETERS : BitIndex - Index into the resource descriptor Resource - Pointer to the raw resource data ResourceIndex - Index correspoinding to the resource type
/* Get the tag list for this resource descriptor type */ /*
     * Handle descriptors that have multiple subtypes
     */ /*
         * Subtype differentiation is the flags.
         * Kindof brute force, but just blindly search for an index match
         */ /* If we found a match, all done. Else, drop to normal search below */ /* GPIO connection has 2 subtypes: Interrupt and I/O */ /* SerialBus has 3 subtypes: I2C, SPI, and UART */ /* Search for a match against the BitIndex */