diff options
Diffstat (limited to 'source/tools/acpihelp')
-rw-r--r-- | source/tools/acpihelp/acpihelp.h | 14 | ||||
-rw-r--r-- | source/tools/acpihelp/ahamlops.c | 2 | ||||
-rw-r--r-- | source/tools/acpihelp/ahdecode.c | 140 | ||||
-rw-r--r-- | source/tools/acpihelp/ahmain.c | 41 |
4 files changed, 126 insertions, 71 deletions
diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index fba275466ee44..da15e4ef89f8a 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -70,6 +70,7 @@ #define AH_DECODE_AML_OPCODE 5 #define AH_DISPLAY_DEVICE_IDS 6 #define AH_DECODE_EXCEPTION 7 +#define AH_DECODE_ASL_AML 8 #define AH_MAX_ASL_LINE_LENGTH 70 #define AH_MAX_AML_LINE_LENGTH 100 @@ -104,13 +105,6 @@ typedef struct ah_asl_keyword } AH_ASL_KEYWORD; -typedef struct ah_device_id -{ - char *Name; - char *Description; - -} AH_DEVICE_ID; - extern const AH_AML_OPCODE AmlOpcodeInfo[]; extern const AH_ASL_OPERATOR AslOperatorInfo[]; @@ -138,6 +132,10 @@ AhFindPredefinedNames ( char *Name); void +AhFindAslAndAmlOperators ( + char *Name); + +UINT32 AhFindAslOperators ( char *Name); @@ -147,6 +145,6 @@ AhFindAslKeywords ( void AhDisplayDeviceIds ( - void); + char *Name); #endif /* __ACPIHELP_H */ diff --git a/source/tools/acpihelp/ahamlops.c b/source/tools/acpihelp/ahamlops.c index faa4c196fd8ce..9ac13513dace7 100644 --- a/source/tools/acpihelp/ahamlops.c +++ b/source/tools/acpihelp/ahamlops.c @@ -141,7 +141,7 @@ const AH_AML_OPCODE AmlOpcodeInfo[] = "DefFatal := FatalOp FatalType FatalCode FatalArg"}, {0x5B33, 0x5B33, "0x5B33", "TimerOp", "TermObject", NULL, NULL, "DefTimer := TimerOp"}, - {0x5B80, 0x5B80, "0x5B80", "OpRegionOp", "TermObject", "NameString ByteData TermArg TermArg", NULL, + {0x5B80, 0x5B80, "0x5B80", "OperationRegionOp", "TermObject", "NameString ByteData TermArg TermArg", NULL, "DefOpRegion := OpRegionOp NameString RegionSpace RegionOffset RegionLen"}, {0x5B81, 0x5B81, "0x5B81", "FieldOp", "TermObject", "NameString ByteData", "FieldList", "DefField := FieldOp PkgLength NameString FieldFlags FieldList"}, diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 556dc6c98bf7f..60e38081253b6 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -48,41 +48,6 @@ #include "acpredef.h" -/* Device IDs defined in the ACPI specification */ - -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} -}; - #define AH_DISPLAY_EXCEPTION(Status, Name) \ printf ("%.4X: %s\n", Status, Name) @@ -589,7 +554,7 @@ AhDisplayAslKeyword ( /******************************************************************************* * - * FUNCTION: AhFindAslOperators (entry point for ASL operator search) + * FUNCTION: AhFindAslAndAmlOperators * * PARAMETERS: Name - Name or prefix for an ASL operator. * NULL means "find all" @@ -597,16 +562,46 @@ AhDisplayAslKeyword ( * RETURN: None * * DESCRIPTION: Find all ASL operators that match the input Name or name - * prefix. + * prefix. Also displays the AML information if only one entry + * matches. * ******************************************************************************/ void +AhFindAslAndAmlOperators ( + char *Name) +{ + UINT32 MatchCount; + + + MatchCount = AhFindAslOperators (Name); + if (MatchCount == 1) + { + AhFindAmlOpcode (Name); + } +} + + +/******************************************************************************* + * + * FUNCTION: AhFindAslOperators (entry point for ASL operator search) + * + * PARAMETERS: Name - Name or prefix for an ASL operator. + * NULL means "find all" + * + * RETURN: Number of operators that matched the name prefix. + * + * DESCRIPTION: Find all ASL operators that match the input Name or name + * prefix. + * + ******************************************************************************/ + +UINT32 AhFindAslOperators ( char *Name) { const AH_ASL_OPERATOR *Operator; - BOOLEAN Found = FALSE; + BOOLEAN MatchCount = 0; AhStrupr (Name); @@ -618,7 +613,7 @@ AhFindAslOperators ( if (!Name) { AhDisplayAslOperator (Operator); - Found = TRUE; + MatchCount++; continue; } @@ -630,14 +625,16 @@ AhFindAslOperators ( if (strstr (Gbl_Buffer, Name) == Gbl_Buffer) { AhDisplayAslOperator (Operator); - Found = TRUE; + MatchCount++; } } - if (!Found) + if (!MatchCount) { printf ("%s, no matching ASL operators\n", Name); } + + return (MatchCount); } @@ -805,26 +802,71 @@ AhPrintOneField ( * * FUNCTION: AhDisplayDeviceIds * - * PARAMETERS: None + * PARAMETERS: Name - Device Hardware ID string. + * NULL means "find all" * * RETURN: None * - * DESCRIPTION: Display all PNP* and ACPI* device IDs defined in the ACPI spec. + * DESCRIPTION: Display PNP* and ACPI* device IDs. * ******************************************************************************/ void AhDisplayDeviceIds ( - void) + char *Name) { - const AH_DEVICE_ID *DeviceId = AhDeviceIds; + const AH_DEVICE_ID *Info; + UINT32 Length; + BOOLEAN Matched; + UINT32 i; + BOOLEAN Found = FALSE; + + + /* Null input name indicates "display all" */ + + if (!Name) + { + printf ("ACPI and PNP Device/Hardware IDs:\n\n"); + for (Info = AslDeviceIds; Info->Name; Info++) + { + printf ("%8s %s\n", Info->Name, Info->Description); + } + + return; + } + Length = strlen (Name); + if (Length > 8) + { + printf ("%.8s: Hardware ID must be 8 characters maximum\n", Name); + return; + } - printf ("ACPI and PNP Device IDs defined in the ACPI specification:\n\n"); - while (DeviceId->Name) + /* Find/display all names that match the input name prefix */ + + AhStrupr (Name); + for (Info = AslDeviceIds; Info->Name; Info++) + { + Matched = TRUE; + for (i = 0; i < Length; i++) + { + if (Info->Name[i] != Name[i]) + { + Matched = FALSE; + break; + } + } + + if (Matched) + { + Found = TRUE; + printf ("%8s %s\n", Info->Name, Info->Description); + } + } + + if (!Found) { - printf ("%8s %s\n", DeviceId->Name, DeviceId->Description); - DeviceId++; + printf ("%s, Hardware ID not found\n", Name); } } diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c index 1a8de1e4bade6..a340598028386 100644 --- a/source/tools/acpihelp/ahmain.c +++ b/source/tools/acpihelp/ahmain.c @@ -51,7 +51,7 @@ AhDisplayUsage ( void); #define AH_UTILITY_NAME "ACPI Help Utility" -#define AH_SUPPORTED_OPTIONS "ehikmopsv" +#define AH_SUPPORTED_OPTIONS "aehikmopsv" /****************************************************************************** @@ -67,24 +67,29 @@ AhDisplayUsage ( void) { - ACPI_USAGE_HEADER ("acpihelp <options> [NamePrefix | HexValue]"); + ACPI_USAGE_HEADER ("acpihelp <options> [Name/Prefix | HexValue]"); ACPI_OPTION ("-h", "Display help"); ACPI_OPTION ("-v", "Display version information"); - printf ("\nACPI Names and Symbols:\n"); - ACPI_OPTION ("-k [NamePrefix]", "Find/Display ASL non-operator keyword(s)"); - ACPI_OPTION ("-m [NamePrefix]", "Find/Display AML opcode name(s)"); - ACPI_OPTION ("-p [NamePrefix]", "Find/Display ASL predefined method name(s)"); - ACPI_OPTION ("-s [NamePrefix]", "Find/Display ASL operator name(s)"); + printf ("\nAML (ACPI Machine Language) Names and Encodings:\n"); + ACPI_OPTION ("-a [Name/Prefix]", "Find/Display both ASL operator and AML opcode name(s)"); + ACPI_OPTION ("-m [Name/Prefix]", "Find/Display AML opcode name(s)"); + + printf ("\nASL (ACPI Source Language) Names and Symbols:\n"); + ACPI_OPTION ("-k [Name/Prefix]", "Find/Display ASL non-operator keyword(s)"); + ACPI_OPTION ("-p [Name/Prefix]", "Find/Display ASL predefined method name(s)"); + ACPI_OPTION ("-s [Name/Prefix]", "Find/Display ASL operator name(s)"); + + printf ("\nOther ACPI Names:\n"); + ACPI_OPTION ("-i [Name/Prefix]", "Find/Display ACPI/PNP Hardware ID(s)"); printf ("\nACPI Values:\n"); ACPI_OPTION ("-e [HexValue]", "Decode ACPICA exception code"); - ACPI_OPTION ("-i", "Display known ACPI Device IDs (_HID)"); ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode"); - printf ("\nNamePrefix/HexValue not specified means \"Display All\"\n"); - printf ("\nDefault search with NamePrefix and no options:\n"); - printf (" Find ASL operator names - if NamePrefix does not start with underscore\n"); + printf ("\nName/Prefix or HexValue not specified means \"Display All\"\n"); + printf ("\nDefault search with valid Name/Prefix and no options:\n"); + printf (" Find ASL/AML operator names - if NamePrefix does not start with underscore\n"); printf (" Find ASL predefined method names - if NamePrefix starts with underscore\n"); } @@ -121,6 +126,11 @@ main ( while ((j = AcpiGetopt (argc, argv, AH_SUPPORTED_OPTIONS)) != EOF) switch (j) { + case 'a': + + DecodeType = AH_DECODE_ASL_AML; + break; + case 'e': DecodeType = AH_DECODE_EXCEPTION; @@ -173,6 +183,11 @@ main ( switch (DecodeType) { + case AH_DECODE_ASL_AML: + + AhFindAslAndAmlOperators (Name); + break; + case AH_DECODE_AML: AhFindAmlOpcode (Name); @@ -200,7 +215,7 @@ main ( case AH_DISPLAY_DEVICE_IDS: - AhDisplayDeviceIds (); + AhDisplayDeviceIds (Name); break; case AH_DECODE_EXCEPTION: @@ -222,7 +237,7 @@ main ( } else { - AhFindAslOperators (Name); + AhFindAslAndAmlOperators (Name); } break; } |