AcpiHelp: Add display of ACPI/PNP device IDs.

New -i option displays the IDs that are defined in the ACPI spec.
This commit is contained in:
Robert Moore 2012-02-03 13:06:18 -08:00
parent 5765628fd3
commit 5539cc3644
3 changed files with 84 additions and 1 deletions

View File

@ -140,6 +140,7 @@
#define AH_DECODE_PREDEFINED_NAME 3
#define AH_DECODE_AML 4
#define AH_DECODE_AML_OPCODE 5
#define AH_DISPLAY_DEVICE_IDS 6
#define AH_MAX_ASL_LINE_LENGTH 70
#define AH_MAX_AML_LINE_LENGTH 100
@ -182,6 +183,13 @@ typedef struct ah_predefined_name
} AH_PREDEFINED_NAME;
typedef struct ah_device_id
{
char *Name;
char *Description;
} AH_DEVICE_ID;
extern const AH_AML_OPCODE AmlOpcodeInfo[];
extern const AH_ASL_OPERATOR AslOperatorInfo[];
@ -213,4 +221,8 @@ void
AhFindAslKeywords (
char *Name);
void
AhDisplayDeviceIds (
void);
#endif /* __ACPIHELP_H */

View File

@ -864,3 +864,64 @@ AhPrintOneField (
printf ("%s", This);
}
}
/*******************************************************************************
*
* FUNCTION: AhDisplayDeviceIds
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Display all PNP* and ACPI* device IDs defined in the ACPI spec.
*
******************************************************************************/
static const AH_DEVICE_ID AhDeviceIds[] =
{
{"PNP0A05", "Generic Container Device"},
{"PNP0A06", "Generic Container Device"},
{"PNP0C08", "ACPI core hardware"},
{"PNP0C09", "Embedded Controller Device"},
{"PNP0C0A", "Control Method Battery"},
{"PNP0C0B", "Fan"},
{"PNP0C0C", "Power Button Device"},
{"PNP0C0D", "Lid Device"},
{"PNP0C0E", "Sleep Button Device"},
{"PNP0C0F", "PCI Interrupt Link Device"},
{"PNP0C80", "Memory Device"},
{"ACPI0001", "SMBus 1.0 Host Controller"},
{"ACPI0002", "Smart Battery Subsystem"},
{"ACPI0003", "Power Source Device"},
{"ACPI0004", "Module Device"},
{"ACPI0005", "SMBus 2.0 Host Controller"},
{"ACPI0006", "GPE Block Device"},
{"ACPI0007", "Processor Device"},
{"ACPI0008", "Ambient Light Sensor Device"},
{"ACPI0009", "I/O xAPIC Device"},
{"ACPI000A", "I/O APIC Device"},
{"ACPI000B", "I/O SAPIC Device"},
{"ACPI000C", "Processor Aggregator Device"},
{"ACPI000D", "Power Meter Device"},
{"ACPI000E", "Time/Alarm Device"},
{"ACPI000F", "User Presence Detection Device"},
{NULL, NULL}
};
void
AhDisplayDeviceIds (
void)
{
const AH_DEVICE_ID *DeviceId = AhDeviceIds;
printf ("ACPI and PNP Device IDs defined in the ACPI specification:\n\n");
while (DeviceId->Name)
{
printf ("%8s %s\n", DeviceId->Name, DeviceId->Description);
DeviceId++;
}
}

View File

@ -137,6 +137,8 @@ AhDisplayUsage (
{
ACPI_USAGE_HEADER ("acpihelp <options> [NamePrefix | HexValue]");
ACPI_OPTION ("-h", "Display help");
ACPI_OPTION ("-i", "Display known ACPI Device IDs (_HID)");
ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)");
ACPI_OPTION ("-m [NamePrefix]", "Find/Display AML opcode name(s)");
ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode");
@ -178,8 +180,12 @@ main (
/* Command line options */
while ((j = AcpiGetopt (argc, argv, "hkmops")) != EOF) switch (j)
while ((j = AcpiGetopt (argc, argv, "hikmops")) != EOF) switch (j)
{
case 'i':
DecodeType = AH_DISPLAY_DEVICE_IDS;
break;
case 'k':
DecodeType = AH_DECODE_ASL_KEYWORD;
break;
@ -232,6 +238,10 @@ main (
AhFindAslKeywords (Name);
break;
case AH_DISPLAY_DEVICE_IDS:
AhDisplayDeviceIds ();
break;
default:
if (!Name)
{