FreeBSD/sys/contrib/dev/acpica/compiler/aslmapoutput.c
/*******************************************************************************
 *
 * FUNCTION:    MpEmitGpioInfo
 *
 * PARAMETERS:  None
 *
 * RETURN:      None
 *
 * DESCRIPTION: Emit the info about all GPIO devices found during the
 *              compile or disassembly.
 *
 ******************************************************************************/


None

Emit the info about all GPIO devices found during the
compile or disassembly.
None Emit the info about all GPIO devices found during the compile or disassembly .
static void
MpEmitGpioInfo (
    void)
{
    ACPI_GPIO_INFO          *Info;
    char                    *Type;
    char                    *PrevDeviceName = NULL;
    const char              *Direction;
    const char              *Polarity;
    char                    *ParentPathname;
    const char              *Description;
    char                    *HidString;
    const AH_DEVICE_ID      *HidInfo;
    Info = Gbl_GpioList;
    while (Info)
    {
        HidString = MpGetHidViaNamestring (Info->DeviceName);
        if (!PrevDeviceName ||
            strcmp (PrevDeviceName, Info->DeviceName))
        {
            FlPrintFile (ASL_FILE_MAP_OUTPUT,
                "\n\nGPIO Controller:  %-8s  %-28s",
                HidString, Info->DeviceName);
            HidInfo = AcpiAhMatchHardwareId (HidString);
            if (HidInfo)
            {
                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
                    HidInfo->Description);
            }
            FlPrintFile (ASL_FILE_MAP_OUTPUT,
                "\n\nPin   Type     Direction    Polarity"
                "    Dest _HID  Destination\n");
        }
        PrevDeviceName = Info->DeviceName;
        switch (Info->Type)
        {
        case AML_RESOURCE_GPIO_TYPE_INT:
            Type = "GpioInt";
            Direction = "-Interrupt-";
            Polarity = PolarityDecode[Info->Polarity];
            break;
        case AML_RESOURCE_GPIO_TYPE_IO:
            Type = "GpioIo ";
            Direction = DirectionDecode[Info->Direction];
            Polarity = "          ";
            break;
        default:
            continue;
        }
        FlPrintFile (ASL_FILE_MAP_OUTPUT, "%4.4X  %s  %s  %s  ",
            Info->PinNumber, Type, Direction, Polarity);
        ParentPathname = NULL;
        HidString = MpGetConnectionInfo (Info->Op, Info->PinIndex,
            &Info->TargetNode, &ParentPathname);
        if (HidString)
        {
            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
                HidString, ParentPathname);
            MpXrefDevices (Info);
        }
        else
        {
            HidString = MpGetParentDeviceHid (Info->Op, &Info->TargetNode,
                &ParentPathname);
            FlPrintFile (ASL_FILE_MAP_OUTPUT, "%8s   %-28s",
                HidString, ParentPathname);
            HidInfo = AcpiAhMatchHardwareId (HidString);
            if (HidInfo)
            {
                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s",
                    HidInfo->Description);
            }
            else if ((Description = MpGetDdnValue (ParentPathname)))
            {
                FlPrintFile (ASL_FILE_MAP_OUTPUT, "  // %s (_DDN)",
                    Description);
            }
        }
        FlPrintFile (ASL_FILE_MAP_OUTPUT, "\n");
        ACPI_FREE (ParentPathname);
        Info = Info->Next;
    }
}
static void MpEmitGpioInfo ( void ) { ACPI_GPIO_INFO * Info ; char * Type ; char * PrevDeviceName = NULL ; const char * Direction ; const char * Polarity ; char * ParentPathname ; const char * Description ; char * HidString ; const AH_DEVICE_ID * HidInfo ; Info = Gbl_GpioList ; while ( Info ) { HidString = MpGetHidViaNamestring ( Info -> DeviceName ) ; if ( ! PrevDeviceName || strcmp ( PrevDeviceName , Info -> DeviceName ) ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " \n \n " , HidString , Info -> DeviceName ) ; HidInfo = AcpiAhMatchHardwareId ( HidString ) ; if ( HidInfo ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , HidInfo -> Description ) ; } FlPrintFile ( ASL_FILE_MAP_OUTPUT , " \n \n " " \n " ) ; } PrevDeviceName = Info -> DeviceName ; switch ( Info -> Type ) { case AML_RESOURCE_GPIO_TYPE_INT : Type = " " ; Direction = " " ; Polarity = PolarityDecode [ Info -> Polarity ] ; break ; case AML_RESOURCE_GPIO_TYPE_IO : Type = " " ; Direction = DirectionDecode [ Info -> Direction ] ; Polarity = " " ; break ; default : continue ; } FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , Info -> PinNumber , Type , Direction , Polarity ) ; ParentPathname = NULL ; HidString = MpGetConnectionInfo ( Info -> Op , Info -> PinIndex , & Info -> TargetNode , & ParentPathname ) ; if ( HidString ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , HidString , ParentPathname ) ; MpXrefDevices ( Info ) ; } else { HidString = MpGetParentDeviceHid ( Info -> Op , & Info -> TargetNode , & ParentPathname ) ; FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , HidString , ParentPathname ) ; HidInfo = AcpiAhMatchHardwareId ( HidString ) ; if ( HidInfo ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , HidInfo -> Description ) ; } else if ( ( Description = MpGetDdnValue ( ParentPathname ) ) ) { FlPrintFile ( ASL_FILE_MAP_OUTPUT , " " , Description ) ; } } FlPrintFile ( ASL_FILE_MAP_OUTPUT , " \n " ) ; ACPI_FREE ( ParentPathname ) ; Info = Info -> Next ; } }
FUNCTION:    MpEmitGpioInfo
 PARAMETERS:  None
FUNCTION : MpEmitGpioInfo PARAMETERS : None
/* Walk the GPIO descriptor list */ /* Print header info for the controller itself */ /* Setup various strings based upon the type (GpioInt or GpioIo) */ /* Emit the GPIO info */ /*
             * This is a Connection() field
             * Attempt to find all references to the field.
             */ /*
             * For Devices, attempt to get the _HID description string.
             * Failing that (many _HIDs are not recognized), attempt to
             * get the _DDN description string.
             */ /* Get the _HID description or _DDN string */