From 6388e94bec6e9ada65af7efeeb9b932cece6d282 Mon Sep 17 00:00:00 2001 From: Robert Moore Date: Wed, 30 May 2012 09:24:42 -0700 Subject: [PATCH] Disassembler: Emit generic names for special ACPI names (_Exx, etc.) Also simplify the code a bit. --- source/components/disassembler/dmopcode.c | 71 +++++++++++------------ 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index ecdeccade..820478a1c 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -151,7 +151,8 @@ AcpiDmPredefinedDescription ( #ifdef ACPI_ASL_COMPILER const AH_PREDEFINED_NAME *Info; char *NameString; - const char *Description = NULL; + int LastCharIsDigit; + int LastCharsAreHex; if (!Op) @@ -167,88 +168,86 @@ AcpiDmPredefinedDescription ( return; } - /* Match the name in the info table */ - - for (Info = AslPredefinedInfo; Info->Name; Info++) - { - if (ACPI_COMPARE_NAME (NameString, Info->Name)) - { - Description = Info->Description; - goto Exit; - } - } - /* - * Name was not matched above. Check for special names: + * Check for the special ACPI names: * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a * (where d=decimal_digit, x=hex_digit, a=anything) * + * Convert these to the generic name for table lookup. * Note: NameString is guaranteed to be upper case here. */ + LastCharIsDigit = + (ACPI_IS_DIGIT (NameString[3])); /* d */ + LastCharsAreHex = + (ACPI_IS_XDIGIT (NameString[2]) && /* xx */ + ACPI_IS_XDIGIT (NameString[3])); + switch (NameString[1]) { case 'A': - if ((NameString[2] == 'C') && (ACPI_IS_DIGIT (NameString[3]))) + if ((NameString[2] == 'C') && (LastCharIsDigit)) { - Description = "Active Cooling"; + NameString = "_ACx"; } - else if ((NameString[2] == 'L') && (ACPI_IS_DIGIT (NameString[3]))) + else if ((NameString[2] == 'L') && (LastCharIsDigit)) { - Description = "Active List"; + NameString = "_ALx"; } break; case 'E': - if ((NameString[2] == 'J') && (ACPI_IS_DIGIT (NameString[3]))) + if ((NameString[2] == 'J') && (LastCharIsDigit)) { - Description = "Eject"; + NameString = "_EJx"; } - else if ((ACPI_IS_XDIGIT (NameString[2])) && - (ACPI_IS_XDIGIT (NameString[3]))) + else if (LastCharsAreHex) { - Description = "Edge-triggered GPE"; + NameString = "_Exx"; } break; case 'L': - if ((ACPI_IS_XDIGIT (NameString[2])) && - (ACPI_IS_XDIGIT (NameString[3]))) + if (LastCharsAreHex) { - Description = "Level-triggered GPE"; + NameString = "_Lxx"; } break; case 'Q': - if ((ACPI_IS_XDIGIT (NameString[2])) && - (ACPI_IS_XDIGIT (NameString[3]))) + if (LastCharsAreHex) { - Description = "Embedded Controller Query"; + NameString = "_Qxx"; } break; case 'T': if (NameString[2] == '_') { - Description = "Compiler Emitted"; + NameString = "_T_x"; } break; case 'W': - if ((ACPI_IS_XDIGIT (NameString[2])) && - (ACPI_IS_XDIGIT (NameString[3]))) + if (LastCharsAreHex) { - Description = "Wake Event"; + NameString = "_Wxx"; } break; default: - return; + break; } -Exit: - if (Description) + /* Match the name in the info table */ + + for (Info = AslPredefinedInfo; Info->Name; Info++) { - AcpiOsPrintf (" // %4.4s: %s", NameString, (char *) Description); + if (ACPI_COMPARE_NAME (NameString, Info->Name)) + { + AcpiOsPrintf (" // %4.4s: %s", + NameString, (char *) Info->Description); + return; + } } #else