diff options
author | David Box <david.e.box@linux.intel.com> | 2017-02-24 13:18:15 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-24 13:18:15 -0800 |
commit | 62473c346df145aa695a971d15352136d25a88a2 (patch) | |
tree | c9b0d5b60a2a9e4bbd7bbec8b6aa71e8d65fdd72 | |
parent | 0c0d43e8a2752badb864f988fc6be7b2a7e52fa2 (diff) | |
parent | c46f496df41e53a368f877f88b70bdfc9bd6fdbe (diff) | |
download | acpica-62473c346df145aa695a971d15352136d25a88a2.tar.gz |
Merge pull request #212 from debox1/fix-acpica-bug-1358
Disassembler: Do not unconditionally remove temporary names
-rw-r--r-- | source/components/disassembler/dmopcode.c | 37 | ||||
-rw-r--r-- | source/include/aclocal.h | 7 |
2 files changed, 30 insertions, 14 deletions
diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 26d60efb9..56f078e74 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -142,7 +142,8 @@ AcpiDmPromoteSubtree ( static BOOLEAN AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op); + ACPI_PARSE_OBJECT *Op, + char *Temp); static BOOLEAN AcpiDmIsCaseBlock ( @@ -1049,7 +1050,7 @@ AcpiDmDisassembleOneOp ( case AML_WHILE_OP: - if (AcpiDmIsSwitchBlock(Op)) + if (Op->Common.DisasmOpcode == ACPI_DASM_SWITCH) { AcpiOsPrintf ("%s", "Switch"); break; @@ -1325,11 +1326,13 @@ AcpiDmPromoteSubtree ( * * PARAMETERS: Op - Object to be examined * - * RETURN: TRUE if object is a temporary (_T_x) name + * RETURN: TRUE if object is a temporary (_T_x) name for a matching While + * loop that can be converted to a Switch. * - * DESCRIPTION: Determine if an object is a temporary name and ignore it. - * Temporary names are only used for Switch statements. This - * function depends on this restriced usage. + * DESCRIPTION: _T_X objects are only used for Switch statements. If a temporary + * name exists, search the siblings for a matching While (One) loop + * that can be converted to a Switch. Return TRUE if a match was + * found, FALSE otherwise. * ******************************************************************************/ @@ -1337,6 +1340,7 @@ BOOLEAN AcpiDmIsTempName ( ACPI_PARSE_OBJECT *Op) { + ACPI_PARSE_OBJECT *CurrentOp; char *Temp; if (Op->Common.AmlOpcode != AML_NAME_OP) @@ -1352,11 +1356,21 @@ AcpiDmIsTempName ( return (FALSE); } - /* Ignore Op */ + CurrentOp = Op->Common.Next; + while (CurrentOp) + { + if (CurrentOp->Common.AmlOpcode == AML_WHILE_OP && + AcpiDmIsSwitchBlock(CurrentOp, Temp)) + { + Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + CurrentOp->Common.DisasmOpcode = ACPI_DASM_SWITCH; - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (TRUE); + } + CurrentOp = CurrentOp->Common.Next; + } - return (TRUE); + return (FALSE); } /******************************************************************************* @@ -1392,7 +1406,8 @@ AcpiDmIsTempName ( static BOOLEAN AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op) + ACPI_PARSE_OBJECT *Op, + char *Temp) { ACPI_PARSE_OBJECT *OneOp; ACPI_PARSE_OBJECT *StoreOp; @@ -1425,7 +1440,7 @@ AcpiDmIsSwitchBlock ( return (FALSE); } - if (strncmp((char *)(NamePathOp->Common.Aml), "_T_", 3)) + if (strncmp((char *)(NamePathOp->Common.Aml), Temp, 4)) { return (FALSE); } diff --git a/source/include/aclocal.h b/source/include/aclocal.h index ce7322c87..b7e4d9a43 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -1009,9 +1009,10 @@ typedef union acpi_parse_value #define ACPI_DASM_LNOT_SUFFIX 0x09 /* End of a LNotEqual (etc.) pair of opcodes */ #define ACPI_DASM_HID_STRING 0x0A /* String is a _HID or _CID */ #define ACPI_DASM_IGNORE_SINGLE 0x0B /* Ignore the opcode but not it's children */ -#define ACPI_DASM_SWITCH_PREDICATE 0x0C /* Object is a predicate for a Switch or Case block */ -#define ACPI_DASM_CASE 0x0D /* If/Else is a Case in a Switch/Case block */ -#define ACPI_DASM_DEFAULT 0x0E /* Else is a Default in a Switch/Case block */ +#define ACPI_DASM_SWITCH 0x0C /* While is a Switch */ +#define ACPI_DASM_SWITCH_PREDICATE 0x0D /* Object is a predicate for a Switch or Case block */ +#define ACPI_DASM_CASE 0x0E /* If/Else is a Case in a Switch/Case block */ +#define ACPI_DASM_DEFAULT 0x0F /* Else is a Default in a Switch/Case block */ /* * Generic operation (for example: If, While, Store) |