diff options
175 files changed, 3696 insertions, 398 deletions
diff --git a/changes.txt b/changes.txt index 1c2b1edbae9c..025e85c4eb99 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,183 @@  ---------------------------------------- +07 November 2014. Summary of changes for version 20141107: + +This release is available at https://acpica.org/downloads + +This release introduces and implements language extensions to ASL that  +provide support for symbolic ("C-style") operators and expressions. These  +language extensions are known collectively as ASL+. + + +1) iASL Compiler/Disassembler and Tools: + +Disassembler: Fixed a problem with disassembly of the UartSerialBus  +macro. Changed "StopBitsNone" to the correct "StopBitsZero". David E.  +Box. + +Disassembler: Fixed the Unicode macro support to add escape sequences.  +All non-printable ASCII values are emitted as escape sequences, as well  +as the standard escapes for quote and backslash. Ensures that the  +disassembled macro can be correctly recompiled. + +iASL: Added Printf/Fprintf macros for formatted output. These macros are  +translated to existing AML Concatenate and Store operations. Printf  +writes to the ASL Debug object. Fprintf allows the specification of an  +ASL name as the target. Only a single format specifier is required, %o,  +since the AML interpreter dynamically converts objects to the required  +type. David E. Box. + +    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate +                 (Concatenate (Concatenate (Concatenate ("", Arg0), +                 ": Unexpected value for "), Arg1), ", "), Arg2), +                 " at line "), Arg3), Debug) + +    (new)    Printf ("%o: Unexpected value for %o, %o at line %o", +                 Arg0, Arg1, Arg2, Arg3) + +    (old)    Store (Concatenate (Concatenate (Concatenate (Concatenate +                 ("", Arg1), ": "), Arg0), " Successful"), STR1) + +    (new)    Fprintf (STR1, "%o: %o Successful", Arg1, Arg0) + +iASL: Added debug options (-bp, -bt) to dynamically prune levels of the  +ASL parse tree before the AML code is generated. This allows blocks of  +ASL code to be removed in order to help locate and identify problem  +devices and/or code. David E. Box. + +AcpiExec: Added support (-fi) for an optional namespace object  +initialization file. This file specifies initial values for namespace  +objects as necessary for debugging and testing different ASL code paths  +that may be taken as a result of BIOS options. + + +2) Overview of symbolic operator support for ASL (ASL+) +------------------------------------------------------- + +As an extension to the ASL language, iASL implements support for symbolic  +(C-style) operators for math and logical expressions. This can greatly  +simplify ASL code as well as improve both readability and  +maintainability. These language extensions can exist concurrently with  +all legacy ASL code and expressions. + +The symbolic extensions are 100% compatible with existing AML  +interpreters, since no new AML opcodes are created. To implement the  +extensions, the iASL compiler transforms the symbolic expressions into  +the legacy ASL/AML equivalents at compile time. + +Full symbolic expressions are supported, along with the standard C  +precedence and associativity rules. + +Full disassembler support for the symbolic expressions is provided, and  +creates an automatic migration path for existing ASL code to ASL+ code  +via the disassembly process. By default, the disassembler now emits ASL+  +code with symbolic expressions. An option (-dl) is provided to force the  +disassembler to emit legacy ASL code if desired. + +Below is the complete list of the currently supported symbolic operators  +with examples. See the iASL User Guide for additional information. + + +ASL+ Syntax      Legacy ASL Equivalent +-----------      --------------------- + +    // Math operators + +Z = X + Y        Add (X, Y, Z) +Z = X - Y        Subtract (X, Y, Z) +Z = X * Y        Multiply (X, Y, Z) +Z = X / Y        Divide (X, Y, , Z) +Z = X % Y        Mod (X, Y, Z) +Z = X << Y       ShiftLeft (X, Y, Z) +Z = X >> Y       ShiftRight (X, Y, Z) +Z = X & Y        And (X, Y, Z) +Z = X | Y        Or (X, Y, Z) +Z = X ^ Y        Xor (X, Y, Z) +Z = ~X           Not (X, Z) +X++              Increment (X) +X--              Decrement (X) + +    // Logical operators + +(X == Y)         LEqual (X, Y) +(X != Y)         LNotEqual (X, Y) +(X < Y)          LLess (X, Y) +(X > Y)          LGreater (X, Y) +(X <= Y)         LLessEqual (X, Y) +(X >= Y)         LGreaterEqual (X, Y) +(X && Y)         LAnd (X, Y) +(X || Y)         LOr (X, Y) +(!X)             LNot (X) + +    // Assignment and compound assignment operations + +X = Y           Store (Y, X) +X += Y          Add (X, Y, X) +X -= Y          Subtract (X, Y, X) +X *= Y          Multiply (X, Y, X) +X /= Y          Divide (X, Y, , X) +X %= Y          Mod (X, Y, X) +X <<= Y         ShiftLeft (X, Y, X) +X >>= Y         ShiftRight (X, Y, X) +X &= Y          And (X, Y, X) +X |= Y          Or (X, Y, X) +X ^= Y          Xor (X, Y, X) + + +3) ASL+ Examples: +----------------- + +Legacy ASL: +        If (LOr (LOr (LEqual (And (R510, 0x03FB), 0x02E0), LEqual ( +            And (R520, 0x03FB), 0x02E0)), LOr (LEqual (And (R530,  +0x03FB),  +            0x02E0), LEqual (And (R540, 0x03FB), 0x02E0)))) +        { +            And (MEMB, 0xFFFFFFF0, SRMB) +            Store (MEMB, Local2) +            Store (PDBM, Local1) +            And (PDBM, 0xFFFFFFFFFFFFFFF9, PDBM) +            Store (SRMB, MEMB) +            Or (PDBM, 0x02, PDBM) +        } + +ASL+ version: +        If (((R510 & 0x03FB) == 0x02E0) || +            ((R520 & 0x03FB) == 0x02E0) || +            ((R530 & 0x03FB) == 0x02E0) ||  +            ((R540 & 0x03FB) == 0x02E0)) +        { +            SRMB = (MEMB & 0xFFFFFFF0) +            Local2 = MEMB +            Local1 = PDBM +            PDBM &= 0xFFFFFFFFFFFFFFF9 +            MEMB = SRMB +            PDBM |= 0x02 +        } + +Legacy ASL: +        Store (0x1234, Local1) +        Multiply (Add (Add (Local1, TEST), 0x20), Local2, Local3) +        Multiply (Local2, Add (Add (Local1, TEST), 0x20), Local3) +        Add (Local1, Add (TEST, Multiply (0x20, Local2)), Local3) +        Store (Index (PKG1, 0x03), Local6) +        Store (Add (Local3, Local2), Debug) +        Add (Local1, 0x0F, Local2) +        Add (Local1, Multiply (Local2, Local3), Local2) +        Multiply (Add (Add (Local1, TEST), 0x20), ToBCD (Local1), Local3) + +ASL+ version: +        Local1 = 0x1234 +        Local3 = (((Local1 + TEST) + 0x20) * Local2) +        Local3 = (Local2 * ((Local1 + TEST) + 0x20)) +        Local3 = (Local1 + (TEST + (0x20 * Local2))) +        Local6 = Index (PKG1, 0x03) +        Debug = (Local3 + Local2) +        Local2 = (Local1 + 0x0F) +        Local2 = (Local1 + (Local2 * Local3)) +        Local3 = (((Local1 + TEST) + 0x20) * ToBCD (Local1)) + + +----------------------------------------  26 September 2014. Summary of changes for version 20140926:  1) ACPICA kernel-resident subsystem: diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 1054d2976083..02e868d065cb 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -42,6 +42,7 @@ OBJECTS = \  	$(OBJDIR)/acgetline.o\  	$(OBJDIR)/aeexec.o\  	$(OBJDIR)/aehandlers.o\ +	$(OBJDIR)/aeinitfile.o\  	$(OBJDIR)/aemain.o\  	$(OBJDIR)/aeregion.o\  	$(OBJDIR)/aetables.o\ @@ -62,6 +63,7 @@ OBJECTS = \  	$(OBJDIR)/dbutils.o\  	$(OBJDIR)/dbxface.o\  	$(OBJDIR)/dmbuffer.o\ +	$(OBJDIR)/dmcstyle.o\  	$(OBJDIR)/dmdeferred.o\  	$(OBJDIR)/dmnames.o\  	$(OBJDIR)/dmobject.o\ diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 59d5f524126a..d9a4db0856a7 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -79,6 +79,8 @@ OBJECTS = \  	$(OBJDIR)/asloptions.o\  	$(OBJDIR)/aslpredef.o\  	$(OBJDIR)/aslprepkg.o\ +	$(OBJDIR)/aslprintf.o\ +	$(OBJDIR)/aslprune.o\  	$(OBJDIR)/aslresource.o\  	$(OBJDIR)/aslrestype1.o\  	$(OBJDIR)/aslrestype1i.o\ @@ -97,16 +99,9 @@ OBJECTS = \  	$(OBJDIR)/aslwalks.o\  	$(OBJDIR)/aslxref.o\  	$(OBJDIR)/cmfsize.o\ -	$(OBJDIR)/dtcompile.o\ -	$(OBJDIR)/dtexpress.o\ -	$(OBJDIR)/dtfield.o\ -	$(OBJDIR)/dtio.o\ -	$(OBJDIR)/dtsubtable.o\ -	$(OBJDIR)/dttable.o\ -	$(OBJDIR)/dttemplate.o\ -	$(OBJDIR)/dtutils.o\  	$(OBJDIR)/dbfileio.o\  	$(OBJDIR)/dmbuffer.o\ +	$(OBJDIR)/dmcstyle.o\  	$(OBJDIR)/dmdeferred.o\  	$(OBJDIR)/dmextern.o\  	$(OBJDIR)/dmnames.o\ @@ -133,6 +128,14 @@ OBJECTS = \  	$(OBJDIR)/dswload2.o\  	$(OBJDIR)/dswscope.o\  	$(OBJDIR)/dswstate.o\ +	$(OBJDIR)/dtcompile.o\ +	$(OBJDIR)/dtexpress.o\ +	$(OBJDIR)/dtfield.o\ +	$(OBJDIR)/dtio.o\ +	$(OBJDIR)/dtsubtable.o\ +	$(OBJDIR)/dttable.o\ +	$(OBJDIR)/dttemplate.o\ +	$(OBJDIR)/dtutils.o\  	$(OBJDIR)/exconvrt.o\  	$(OBJDIR)/excreate.o\  	$(OBJDIR)/exdump.o\ diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 3a742b1a7d38..f585fe5c3b09 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -544,12 +544,26 @@ AdDisassemblerHeader (  {      time_t                  Timer; +      time (&Timer);      /* Header and input table info */      AcpiOsPrintf ("/*\n"); -    AcpiOsPrintf (ACPI_COMMON_HEADER ("AML Disassembler", " * ")); +    AcpiOsPrintf (ACPI_COMMON_HEADER (AML_DISASSEMBLER_NAME, " * ")); + +    if (AcpiGbl_CstyleDisassembly) +    { +        AcpiOsPrintf ( +            " * Disassembling to symbolic ASL+ operators\n" +            " *\n"); +    } +    else +    { +        AcpiOsPrintf ( +            " * Disassembling to non-symbolic legacy ASL operators\n" +            " *\n"); +    }      AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer));      AcpiOsPrintf (" *\n"); diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 025a416705eb..288678a65f6d 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -374,6 +374,12 @@ AnGetBtype (      UINT32                  ThisNodeBtype = 0; +    if (!Op) +    { +        AcpiOsPrintf ("Null Op in AnGetBtype\n"); +        return (ACPI_UINT32_MAX); +    } +      if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG)     ||          (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)  ||          (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 8cef7555b134..a6a866e02ed0 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -107,6 +107,12 @@ CgGenerateAmlOutput (      TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,          CgAmlWriteWalk, NULL, NULL); + +    DbgPrint (ASL_TREE_OUTPUT, +        "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr" +        "    Parent   Child    Next     Flags    AcTyp    Final Col L\n", +        76, " "); +      CgCloseTable ();  } @@ -138,7 +144,8 @@ CgAmlWriteWalk (          DbgPrint (ASL_TREE_OUTPUT,              "Final parse tree used for AML output:\n");          DbgPrint (ASL_TREE_OUTPUT, -            "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr    Child    Parent   Flags    AcTyp    Final Col L\n", +            "%*s Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr" +            "    Parent   Child    Next     Flags    AcTyp    Final Col L\n",              76, " ");      } @@ -161,7 +168,8 @@ CgAmlWriteWalk (      }      DbgPrint (ASL_TREE_OUTPUT, -    "%08X %04X %04X %01X     %04X  %04X %04X   %04X    %08X %08X %08X %08X %08X %04X  %02d  %02d\n", +    "%08X %04X %04X %01X     %04X  %04X %04X   %04X    " +    "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d\n",              /* 1  */ (UINT32) Op->Asl.Value.Integer,              /* 2  */ Op->Asl.ParseOpcode,              /* 3  */ Op->Asl.AmlOpcode, @@ -171,13 +179,14 @@ CgAmlWriteWalk (              /* 7  */ Op->Asl.AmlSubtreeLength,              /* 8  */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,              /* 9  */ Op, -            /* 10 */ Op->Asl.Child, -            /* 11 */ Op->Asl.Parent, -            /* 12 */ Op->Asl.CompileFlags, -            /* 13 */ Op->Asl.AcpiBtype, -            /* 14 */ Op->Asl.FinalAmlLength, -            /* 15 */ Op->Asl.Column, -            /* 16 */ Op->Asl.LineNumber); +            /* 10 */ Op->Asl.Parent, +            /* 11 */ Op->Asl.Child, +            /* 12 */ Op->Asl.Next, +            /* 13 */ Op->Asl.CompileFlags, +            /* 14 */ Op->Asl.AcpiBtype, +            /* 15 */ Op->Asl.FinalAmlLength, +            /* 16 */ Op->Asl.Column, +            /* 17 */ Op->Asl.LineNumber);      /* Generate the AML for this node */ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 62d7d8704329..432ec8b7f9e0 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -147,6 +147,13 @@ CmDoCompile (      Event = UtBeginEvent ("Flush source input");      CmFlushSourceCode (); +    /* Prune the parse tree if requested (debug purposes only) */ + +    if (Gbl_PruneParseTree) +    { +        AslPruneParseTree (Gbl_PruneDepth, Gbl_PruneType); +    } +      /* Optional parse tree dump, compiler debug output only */      LsDumpParseTree (); diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index fdf19c1840d7..72d4699c9b95 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -543,6 +543,27 @@ OptOptimizeNamePath (  /* + * aslprintf - Printf/Fprintf macros + */ +void +OpcDoPrintf ( +    ACPI_PARSE_OBJECT       *Op); + +void +OpcDoFprintf ( +    ACPI_PARSE_OBJECT       *Op); + + +/* + * aslprune - parse tree pruner + */ +void +AslPruneParseTree ( +    UINT32                  PruneDepth, +    UINT32                  Type); + + +/*   * aslcodegen - code generation   */  void @@ -684,6 +705,16 @@ TrCreateLeafNode (      UINT32                  ParseOpcode);  ACPI_PARSE_OBJECT * +TrCreateAssignmentNode ( +    ACPI_PARSE_OBJECT       *Target, +    ACPI_PARSE_OBJECT       *Source); + +ACPI_PARSE_OBJECT * +TrCreateTargetOperand ( +    ACPI_PARSE_OBJECT       *OriginalOp, +    ACPI_PARSE_OBJECT       *ParentOp); + +ACPI_PARSE_OBJECT *  TrCreateValuedLeafNode (      UINT32                  ParseOpcode,      UINT64                  Value); diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 523241a5a557..c26408fc363c 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -117,7 +117,49 @@ NamePathTail                [.]{NameSeg}                                else {yyterminate ();} }  ";"                         { count (0); return(';'); } - +    /* ASL Extension: Standard C operators */ + +"~"                         { count (3); return (PARSEOP_EXP_NOT); } +"!"                         { count (3); return (PARSEOP_EXP_LOGICAL_NOT); } +"*"                         { count (3); return (PARSEOP_EXP_MULTIPLY); } +"/"                         { count (3); return (PARSEOP_EXP_DIVIDE); } +"%"                         { count (3); return (PARSEOP_EXP_MODULO); } +"+"                         { count (3); return (PARSEOP_EXP_ADD); } +"-"                         { count (3); return (PARSEOP_EXP_SUBTRACT); } +">>"                        { count (3); return (PARSEOP_EXP_SHIFT_RIGHT); } +"<<"                        { count (3); return (PARSEOP_EXP_SHIFT_LEFT); } +"<"                         { count (3); return (PARSEOP_EXP_LESS); } +">"                         { count (3); return (PARSEOP_EXP_GREATER); } +"&"                         { count (3); return (PARSEOP_EXP_AND); } +"<="                        { count (3); return (PARSEOP_EXP_LESS_EQUAL); } +">="                        { count (3); return (PARSEOP_EXP_GREATER_EQUAL); } +"=="                        { count (3); return (PARSEOP_EXP_EQUAL); } +"!="                        { count (3); return (PARSEOP_EXP_NOT_EQUAL); } +"|"                         { count (3); return (PARSEOP_EXP_OR); } +"&&"                        { count (3); return (PARSEOP_EXP_LOGICAL_AND); } +"||"                        { count (3); return (PARSEOP_EXP_LOGICAL_OR); } +"++"                        { count (3); return (PARSEOP_EXP_INCREMENT); } +"--"                        { count (3); return (PARSEOP_EXP_DECREMENT); } +"^ "                        { count (3); return (PARSEOP_EXP_XOR); } + +    /* ASL Extension: Standard C assignment operators */ + +"="                         { count (3); return (PARSEOP_EXP_EQUALS); } +"+="                        { count (3); return (PARSEOP_EXP_ADD_EQ); } +"-="                        { count (3); return (PARSEOP_EXP_SUB_EQ); } +"*="                        { count (3); return (PARSEOP_EXP_MUL_EQ); } +"/="                        { count (3); return (PARSEOP_EXP_DIV_EQ); } +"%="                        { count (3); return (PARSEOP_EXP_MOD_EQ); } +"<<="                       { count (3); return (PARSEOP_EXP_SHL_EQ); } +">>="                       { count (3); return (PARSEOP_EXP_SHR_EQ); } +"&="                        { count (3); return (PARSEOP_EXP_AND_EQ); } +"^="                        { count (3); return (PARSEOP_EXP_XOR_EQ); } +"|="                        { count (3); return (PARSEOP_EXP_OR_EQ); } + + +    /* +     * Begin standard ASL grammar +     */  0[xX]{HexDigitChar}+ |  {DigitChar}+                { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext);                                  count (1); return (PARSEOP_INTEGER); } @@ -592,6 +634,44 @@ NamePathTail                [.]{NameSeg}  "Transfer8_16"              { count (0); return (PARSEOP_XFERTYPE_8_16); }  "Transfer16"                { count (0); return (PARSEOP_XFERTYPE_16); } +    /* ToPld macro */ + +"ToPLD"                     { count (0); return (PARSEOP_TOPLD); } + +"PLD_Revision"              { count (0); return (PARSEOP_PLD_REVISION); } +"PLD_IgnoreColor"           { count (0); return (PARSEOP_PLD_IGNORECOLOR); } +"PLD_Red"                   { count (0); return (PARSEOP_PLD_RED); } +"PLD_Green"                 { count (0); return (PARSEOP_PLD_GREEN); } +"PLD_Blue"                  { count (0); return (PARSEOP_PLD_BLUE); } +"PLD_Width"                 { count (0); return (PARSEOP_PLD_WIDTH); } +"PLD_Height"                { count (0); return (PARSEOP_PLD_HEIGHT); } +"PLD_UserVisible"           { count (0); return (PARSEOP_PLD_USERVISIBLE); } +"PLD_Dock"                  { count (0); return (PARSEOP_PLD_DOCK); } +"PLD_Lid"                   { count (0); return (PARSEOP_PLD_LID); } +"PLD_Panel"                 { count (0); return (PARSEOP_PLD_PANEL); } +"PLD_VerticalPosition"      { count (0); return (PARSEOP_PLD_VERTICALPOSITION); } +"PLD_HorizontalPosition"    { count (0); return (PARSEOP_PLD_HORIZONTALPOSITION); } +"PLD_Shape"                 { count (0); return (PARSEOP_PLD_SHAPE); } +"PLD_GroupOrientation"      { count (0); return (PARSEOP_PLD_GROUPORIENTATION); } +"PLD_GroupToken"            { count (0); return (PARSEOP_PLD_GROUPTOKEN); } +"PLD_GroupPosition"         { count (0); return (PARSEOP_PLD_GROUPPOSITION); } +"PLD_Bay"                   { count (0); return (PARSEOP_PLD_BAY); } +"PLD_Ejectable"             { count (0); return (PARSEOP_PLD_EJECTABLE); } +"PLD_EjectRequired"         { count (0); return (PARSEOP_PLD_EJECTREQUIRED); } +"PLD_CabinetNumber"         { count (0); return (PARSEOP_PLD_CABINETNUMBER); } +"PLD_CardCageNumber"        { count (0); return (PARSEOP_PLD_CARDCAGENUMBER); } +"PLD_Reference"             { count (0); return (PARSEOP_PLD_REFERENCE); } +"PLD_Rotation"              { count (0); return (PARSEOP_PLD_ROTATION); } +"PLD_Order"                 { count (0); return (PARSEOP_PLD_ORDER); } +"PLD_Reserved"              { count (0); return (PARSEOP_PLD_RESERVED); } +"PLD_VerticalOffset"        { count (0); return (PARSEOP_PLD_VERTICALOFFSET); } +"PLD_HorizontalOffset"      { count (0); return (PARSEOP_PLD_HORIZONTALOFFSET); } + + +    /* printf debug macros */ +"printf"                    { count (0); return (PARSEOP_PRINTF); } +"fprintf"                   { count (0); return (PARSEOP_FPRINTF); } +      /* Predefined compiler names */  "__DATE__"                  { count (0); return (PARSEOP___DATE__); } @@ -628,10 +708,6 @@ NamePathTail                [.]{NameSeg}                                  DbgPrint (ASL_PARSE_OUTPUT, "NameString: %s\n", s);                                  return (PARSEOP_NAMESTRING); } -"*" | -"/"                         { count (1); -                                AslCompilererror ("Parse error, expecting ASL keyword or name");} -  .                           { count (1);                                  sprintf (MsgBuffer,                                      "Invalid character (0x%2.2X), expecting ASL keyword or name", diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 94002816ebcc..2c1319670cdf 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -49,8 +49,8 @@   * Compiler versions and names   */  #define ASL_REVISION                ACPI_CA_VERSION -#define ASL_COMPILER_NAME           "ASL Optimizing Compiler" -#define AML_DISASSEMBLER_NAME       "AML Disassembler" +#define ASL_COMPILER_NAME           "ASL+ Optimizing Compiler" +#define AML_DISASSEMBLER_NAME       "AML/ASL+ Disassembler"  #define ASL_INVOCATION_NAME         "iasl"  #define ASL_CREATOR_ID              "INTL" diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 8106824fd8ef..a3cbb2068302 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -173,6 +173,7 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); +ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PruneParseTree, FALSE);  #define HEX_OUTPUT_NONE             0 @@ -251,6 +252,8 @@ ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0)  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0);  ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG");  ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); +ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_PruneDepth, 0); +ASL_EXTERN UINT16                   ASL_INIT_GLOBAL (Gbl_PruneType, 0);  /* Static structures */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 1207f43a3d82..075781ad8f0d 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __ASLLOAD_C__ -  #include "aslcompiler.h"  #include "amlcode.h"  #include "acdispat.h" diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 1ef7b1cafc8f..9738fb51186f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -187,13 +187,17 @@ Usage (      ACPI_OPTION ("-db",             "Do not translate Buffers to Resource Templates");      ACPI_OPTION ("-dc <f1 f2 ...>", "Disassemble AML and immediately compile it");      ACPI_OPTION ("",                "  (Obtain DSDT from current system if no input file)"); +    ACPI_OPTION ("-dl",             "Emit legacy ASL code only (no C-style operators)");      ACPI_OPTION ("-e  <f1 f2 ...>", "Include ACPI table(s) for external symbol resolution");      ACPI_OPTION ("-fe <file>",      "Specify external symbol declaration file");      ACPI_OPTION ("-in",             "Ignore NoOp opcodes");      ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");      printf ("\nDebug Options:\n"); -    ACPI_OPTION ("-bf -bt",         "Create debug file (full or parse tree only) (*.txt)"); +    ACPI_OPTION ("-bf",             "Create debug file (full output) (*.txt)"); +    ACPI_OPTION ("-bs",             "Create debug file (parse tree only) (*.txt)"); +    ACPI_OPTION ("-bp <depth>",     "Prune ASL parse tree"); +    ACPI_OPTION ("-bt <type>",      "Object type to be pruned from the parse tree");      ACPI_OPTION ("-f",              "Ignore errors, force creation of AML output file(s)");      ACPI_OPTION ("-m <size>",       "Set internal line buffer size (in Kbytes)");      ACPI_OPTION ("-n",              "Parse only, no output generation"); diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 84fb24255c12..3e9f6131efab 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -446,7 +446,38 @@ const ASL_MAPPING_ENTRY     AslKeywordMapping [] =  /* XFERTYPE_16 */               OP_TABLE_ENTRY (AML_BYTE_OP,                2,                              0,                  0),  /* XOR */                       OP_TABLE_ENTRY (AML_BIT_XOR_OP,             0,                              0,                  ACPI_BTYPE_INTEGER),  /* ZERO */                      OP_TABLE_ENTRY (AML_ZERO_OP,                0,                              0,                  ACPI_BTYPE_INTEGER), - +/* TOPLD */                     OP_TABLE_ENTRY (AML_DWORD_OP,               0,                              NODE_AML_PACKAGE,   ACPI_BTYPE_INTEGER), +/* XFERSIZE_128 */              OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* REVISION */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* IGNORECOLOR */               OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* RED */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* GREEN */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* BLUE */                      OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* WIDTH */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* HEIGHT */                    OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* USERVISIBLE */               OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* DOCK */                      OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* LID */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* PANEL */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* VERTICALPOSITION */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* HORIZONTALPOSITION */        OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* SHAPE */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* GROUPORIENTATION */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* GROUPTOKEN */                OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* GROUPPOSITION */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* BAY */                       OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* EJECTABLE */                 OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* EJECTREQUIRED */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* CABINETNUMBER */             OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* CARDCAGENUMBER */            OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* REFERENCE */                 OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* ROTATION */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* ORDER */                     OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* RESERVED */                  OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* VERTICALOFFSET */            OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* HORIZONTALOFFSET */          OP_TABLE_ENTRY (AML_BYTE_OP,                0,                              0,                  0), +/* PRINTF */                    OP_TABLE_ENTRY (AML_STORE_OP,               0,                              0,                  ACPI_BTYPE_DATA_REFERENCE), +/* FPRINTF */                   OP_TABLE_ENTRY (AML_STORE_OP,               0,                              0,                  ACPI_BTYPE_DATA_REFERENCE),  /*! [End] no source code translation !*/  }; diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 8030c950fa05..c14ff15b82af 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -68,9 +68,62 @@ OpcDoEisaId (      ACPI_PARSE_OBJECT       *Op);  static void +OpcDoPld ( +    ACPI_PARSE_OBJECT       *Op); + +static void  OpcDoUuId (      ACPI_PARSE_OBJECT       *Op); +static UINT8 * +OpcEncodePldBuffer ( +    ACPI_PLD_INFO           *PldInfo); + + +/* ToPld strings */ + +static char *AslPldPanelList[] = +{ +    "TOP", +    "BOTTOM", +    "LEFT", +    "RIGHT", +    "FRONT", +    "BACK", +    "UNKNOWN", +    NULL +}; + +static char *AslPldVerticalPositionList[] = +{ +    "UPPER", +    "CENTER", +    "LOWER", +    NULL +}; + +static char *AslPldHorizontalPositionList[] = +{ +    "LEFT", +    "CENTER", +    "RIGHT", +    NULL +}; + +static char *AslPldShapeList[] = +{ +    "ROUND", +    "OVAL", +    "SQUARE", +    "VERTICALRECTANGLE", +    "HORIZONTALRECTANGLE", +    "VERTICALTRAPEZOID", +    "HORIZONTALTRAPEZOID", +    "UNKNOWN", +    "CHAMFERED", +    NULL +}; +  /*******************************************************************************   * @@ -653,9 +706,698 @@ OpcDoEisaId (  /*******************************************************************************   * + * FUNCTION:    OpcEncodePldBuffer + * + * PARAMETERS:  PldInfo             - _PLD buffer struct (Using local struct) + * + * RETURN:      Encode _PLD buffer suitable for return value from _PLD + * + * DESCRIPTION: Bit-packs a _PLD buffer struct. + * + ******************************************************************************/ + +static UINT8 * +OpcEncodePldBuffer ( +    ACPI_PLD_INFO           *PldInfo) +{ +    UINT32                  *Buffer; +    UINT32                  Dword; + + +    Buffer = ACPI_ALLOCATE_ZEROED (ACPI_PLD_BUFFER_SIZE); +    if (!Buffer) +    { +        return (NULL); +    } + +    /* First 32 bits */ + +    Dword = 0; +    ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision); +    ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor); +    ACPI_PLD_SET_RED            (&Dword, PldInfo->Red); +    ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green); +    ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue); +    ACPI_MOVE_32_TO_32          (&Buffer[0], &Dword); + +    /* Second 32 bits */ + +    Dword = 0; +    ACPI_PLD_SET_WIDTH          (&Dword, PldInfo->Width); +    ACPI_PLD_SET_HEIGHT         (&Dword, PldInfo->Height); +    ACPI_MOVE_32_TO_32          (&Buffer[1], &Dword); + +    /* Third 32 bits */ + +    Dword = 0; +    ACPI_PLD_SET_USER_VISIBLE   (&Dword, PldInfo->UserVisible); +    ACPI_PLD_SET_DOCK           (&Dword, PldInfo->Dock); +    ACPI_PLD_SET_LID            (&Dword, PldInfo->Lid); +    ACPI_PLD_SET_PANEL          (&Dword, PldInfo->Panel); +    ACPI_PLD_SET_VERTICAL       (&Dword, PldInfo->VerticalPosition); +    ACPI_PLD_SET_HORIZONTAL     (&Dword, PldInfo->HorizontalPosition); +    ACPI_PLD_SET_SHAPE          (&Dword, PldInfo->Shape); +    ACPI_PLD_SET_ORIENTATION    (&Dword, PldInfo->GroupOrientation); +    ACPI_PLD_SET_TOKEN          (&Dword, PldInfo->GroupToken); +    ACPI_PLD_SET_POSITION       (&Dword, PldInfo->GroupPosition); +    ACPI_PLD_SET_BAY            (&Dword, PldInfo->Bay); +    ACPI_MOVE_32_TO_32          (&Buffer[2], &Dword); + +    /* Fourth 32 bits */ + +    Dword = 0; +    ACPI_PLD_SET_EJECTABLE      (&Dword, PldInfo->Ejectable); +    ACPI_PLD_SET_OSPM_EJECT     (&Dword, PldInfo->OspmEjectRequired); +    ACPI_PLD_SET_CABINET        (&Dword, PldInfo->CabinetNumber); +    ACPI_PLD_SET_CARD_CAGE      (&Dword, PldInfo->CardCageNumber); +    ACPI_PLD_SET_REFERENCE      (&Dword, PldInfo->Reference); +    ACPI_PLD_SET_ROTATION       (&Dword, PldInfo->Rotation); +    ACPI_PLD_SET_ORDER          (&Dword, PldInfo->Order); +    ACPI_MOVE_32_TO_32          (&Buffer[3], &Dword); + +    if (PldInfo->Revision >= 2) +    { +        /* Fifth 32 bits */ + +        Dword = 0; +        ACPI_PLD_SET_VERT_OFFSET    (&Dword, PldInfo->VerticalOffset); +        ACPI_PLD_SET_HORIZ_OFFSET   (&Dword, PldInfo->HorizontalOffset); +        ACPI_MOVE_32_TO_32          (&Buffer[4], &Dword); +    } + +    return (ACPI_CAST_PTR (UINT8, Buffer)); +} + + +/******************************************************************************* + * + * FUNCTION:    OpcStrupr (strupr) + * + * PARAMETERS:  SrcString           - The source string to convert + * + * RETURN:      None + * + * DESCRIPTION: Convert string to uppercase + * + * NOTE: This is not a POSIX function, so it appears here, not in utclib.c + * + ******************************************************************************/ + +static void +OpcStrupr ( +    char                    *SrcString) +{ +    char                    *String; + + +    if (!SrcString) +    { +        return; +    } + +    /* Walk entire string, uppercasing the letters */ + +    for (String = SrcString; *String; String++) +    { +        *String = (char) toupper ((int) *String); +    } + +    return; +} + + +/******************************************************************************* + * + * FUNCTION:    OpcFindName + * + * PARAMETERS:  List                - Array of char strings to be searched + *              Name                - Char string to string for + *              Index               - Index value to set if found + * + * RETURN:      TRUE if any names matched, FALSE otherwise + * + * DESCRIPTION: Match PLD name to value in lookup table. Sets Value to + *              equivalent parameter value. + * + ******************************************************************************/ + +static BOOLEAN +OpcFindName ( +    char                    **List, +    char                    *Name, +    UINT64                  *Index) +{ +    char                     *Str; +    UINT32                   i; + + +    OpcStrupr (Name); + +    for (i = 0, Str = List[0]; Str; i++, Str = List[i]) +    { +        if (!(ACPI_STRNCMP (Str, Name, ACPI_STRLEN (Name)))) +        { +            *Index = i; +            return (TRUE); +        } +    } + +    return (FALSE); +} + + +/******************************************************************************* + * + * FUNCTION:    OpcDoPld + * + * PARAMETERS:  Op                  - Parse node + * + * RETURN:      None + * + * DESCRIPTION: Convert ToPLD macro to 20-byte buffer + * + ******************************************************************************/ + +static void +OpcDoPld ( +    ACPI_PARSE_OBJECT       *Op) +{ +    UINT8                   *Buffer; +    ACPI_PARSE_OBJECT       *Node; +    ACPI_PLD_INFO           PldInfo; +    ACPI_PARSE_OBJECT       *NewOp; + + +    if (!Op) +    { +        AslError(ASL_ERROR, ASL_MSG_NOT_EXIST, Op, NULL); +        return; +    } + +    if (Op->Asl.ParseOpcode != PARSEOP_TOPLD) +    { +        AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Op, NULL); +        return; +    } + +    Buffer = UtLocalCalloc (ACPI_PLD_BUFFER_SIZE); +    if (!Buffer) +    { +        AslError(ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, Op, NULL); +        return; +    } + +    ACPI_MEMSET (&PldInfo, 0, sizeof (ACPI_PLD_INFO)); + +    Node = Op->Asl.Child; +    while (Node) +    { +        switch (Node->Asl.ParseOpcode) +        { +        case PARSEOP_PLD_REVISION: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 127) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            PldInfo.Revision = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_IGNORECOLOR: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 1) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            PldInfo.IgnoreColor = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_RED: +        case PARSEOP_PLD_GREEN: +        case PARSEOP_PLD_BLUE: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 255) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_RED) +            { +                PldInfo.Red = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_GREEN) +            { +                PldInfo.Green = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_BLUE */ +            { +                PldInfo.Blue = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            break; + +        case PARSEOP_PLD_WIDTH: +        case PARSEOP_PLD_HEIGHT: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 65535) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_WIDTH) +            { +                PldInfo.Width = (UINT16) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_HEIGHT */ +            { +                PldInfo.Height = (UINT16) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        case PARSEOP_PLD_USERVISIBLE: +        case PARSEOP_PLD_DOCK: +        case PARSEOP_PLD_LID: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 1) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_USERVISIBLE) +            { +                PldInfo.UserVisible = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_DOCK) +            { +                PldInfo.Dock = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else +            { +                PldInfo.Lid = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        case PARSEOP_PLD_PANEL: + +            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) +            { +                if (Node->Asl.Child->Asl.Value.Integer > 6) +                { +                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                    break; +                } +            } +            else /* PARSEOP_STRING */ +            { +                if (!OpcFindName(AslPldPanelList, +                    Node->Asl.Child->Asl.Value.String, +                    &Node->Asl.Child->Asl.Value.Integer)) +                { +                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); +                    break; +                } +            } + +            PldInfo.Panel = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_VERTICALPOSITION: + +            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) +            { +                if (Node->Asl.Child->Asl.Value.Integer > 2) +                { +                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                    break; +                } +            } +            else /* PARSEOP_STRING */ +            { +                if (!OpcFindName(AslPldVerticalPositionList, +                    Node->Asl.Child->Asl.Value.String, +                    &Node->Asl.Child->Asl.Value.Integer)) +                { +                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); +                    break; +                } +            } + +            PldInfo.VerticalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_HORIZONTALPOSITION: + +            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) +            { +                if (Node->Asl.Child->Asl.Value.Integer > 2) +                { +                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                    break; +                } +            } +            else /* PARSEOP_STRING */ +            { +                if (!OpcFindName(AslPldHorizontalPositionList, +                    Node->Asl.Child->Asl.Value.String, +                    &Node->Asl.Child->Asl.Value.Integer)) +                { +                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); +                    break; +                } +            } + +            PldInfo.HorizontalPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_SHAPE: + +            if (Node->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) +            { +                if (Node->Asl.Child->Asl.Value.Integer > 8) +                { +                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                    break; +                } +            } +            else /* PARSEOP_STRING */ +            { +                if (!OpcFindName(AslPldShapeList, +                    Node->Asl.Child->Asl.Value.String, +                    &Node->Asl.Child->Asl.Value.Integer)) +                { +                    AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Node, NULL); +                    break; +                } +            } + +            PldInfo.Shape = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_GROUPORIENTATION: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 1) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            PldInfo.GroupOrientation = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_GROUPTOKEN: +        case PARSEOP_PLD_GROUPPOSITION: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 255) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_GROUPTOKEN) +            { +                PldInfo.GroupToken = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_GROUPPOSITION */ +            { +                PldInfo.GroupPosition = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        case PARSEOP_PLD_BAY: +        case PARSEOP_PLD_EJECTABLE: +        case PARSEOP_PLD_EJECTREQUIRED: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 1) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_BAY) +            { +                PldInfo.Bay = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else if (Node->Asl.ParseOpcode == PARSEOP_PLD_EJECTABLE) +            { +                PldInfo.Ejectable = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_EJECTREQUIRED */ +            { +                PldInfo.OspmEjectRequired = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        case PARSEOP_PLD_CABINETNUMBER: +        case PARSEOP_PLD_CARDCAGENUMBER: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 255) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_CABINETNUMBER) +            { +                PldInfo.CabinetNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_CARDCAGENUMBER */ +            { +                PldInfo.CardCageNumber = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        case PARSEOP_PLD_REFERENCE: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 1) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            PldInfo.Reference = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_ROTATION: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 7) +            { +                switch (Node->Asl.Child->Asl.Value.Integer) +                { +                case 45: + +                    Node->Asl.Child->Asl.Value.Integer = 1; +                    break; + +                case 90: + +                    Node->Asl.Child->Asl.Value.Integer = 2; +                    break; + +                case 135: + +                    Node->Asl.Child->Asl.Value.Integer = 3; +                    break; + +                case 180: + +                    Node->Asl.Child->Asl.Value.Integer = 4; +                    break; + +                case 225: + +                    Node->Asl.Child->Asl.Value.Integer = 5; +                    break; + +                case 270: + +                    Node->Asl.Child->Asl.Value.Integer = 6; +                    break; + +                case 315: + +                    Node->Asl.Child->Asl.Value.Integer = 7; +                    break; + +                default: + +                    AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                    break; +                } +            } + +            PldInfo.Rotation = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_ORDER: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 31) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            PldInfo.Order = (UINT8) Node->Asl.Child->Asl.Value.Integer; +            break; + +        case PARSEOP_PLD_VERTICALOFFSET: +        case PARSEOP_PLD_HORIZONTALOFFSET: + +            if (Node->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +                break; +            } + +            if (Node->Asl.Child->Asl.Value.Integer > 65535) +            { +                AslError(ASL_ERROR, ASL_MSG_RANGE, Node, NULL); +                break; +            } + +            if (Node->Asl.ParseOpcode == PARSEOP_PLD_VERTICALOFFSET) +            { +                PldInfo.VerticalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; +            } +            else /* PARSEOP_PLD_HORIZONTALOFFSET */ +            { +                PldInfo.HorizontalOffset = (UINT16) Node->Asl.Child->Asl.Value.Integer; +            } + +            break; + +        default: + +            AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, Node, NULL); +            break; +        } + +        Node = Node->Asl.Next; +    } + +    Buffer = OpcEncodePldBuffer(&PldInfo); + +    /* Change Op to a Buffer */ + +    Op->Asl.ParseOpcode = PARSEOP_BUFFER; +    Op->Common.AmlOpcode = AML_BUFFER_OP; + +    /* Disable further optimization */ + +    Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; +    UtSetParseOpName (Op); + +    /* Child node is the buffer length */ + +    NewOp = TrAllocateNode (PARSEOP_INTEGER); + +    NewOp->Asl.AmlOpcode     = AML_BYTE_OP; +    NewOp->Asl.Value.Integer = 20; +    NewOp->Asl.Parent        = Op; + +    Op->Asl.Child = NewOp; +    Op = NewOp; + +    /* Peer to the child is the raw buffer data */ + +    NewOp = TrAllocateNode (PARSEOP_RAW_DATA); +    NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER; +    NewOp->Asl.AmlLength     = 20; +    NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer); +    NewOp->Asl.Parent        = Op->Asl.Parent; + +    Op->Asl.Next = NewOp; +} + + +/******************************************************************************* + *   * FUNCTION:    OpcDoUuId   * - * PARAMETERS:  Op        - Parse node + * PARAMETERS:  Op                  - Parse node   *   * RETURN:      None   * @@ -673,7 +1415,7 @@ OpcDoUuId (      ACPI_PARSE_OBJECT       *NewOp; -    InString = (char *) Op->Asl.Value.String; +    InString = ACPI_CAST_PTR (char, Op->Asl.Value.String);      Buffer = UtLocalCalloc (16);      Status = AuValidateUuid (InString); @@ -712,7 +1454,7 @@ OpcDoUuId (      NewOp = TrAllocateNode (PARSEOP_RAW_DATA);      NewOp->Asl.AmlOpcode     = AML_RAW_DATA_BUFFER;      NewOp->Asl.AmlLength     = 16; -    NewOp->Asl.Value.String  = (char *) Buffer; +    NewOp->Asl.Value.String  = ACPI_CAST_PTR (char, Buffer);      NewOp->Asl.Parent        = Op->Asl.Parent;      Op->Asl.Next = NewOp; @@ -723,7 +1465,7 @@ OpcDoUuId (   *   * FUNCTION:    OpcGenerateAmlOpcode   * - * PARAMETERS:  Op        - Parse node + * PARAMETERS:  Op                  - Parse node   *   * RETURN:      None   * @@ -737,7 +1479,6 @@ void  OpcGenerateAmlOpcode (      ACPI_PARSE_OBJECT       *Op)  { -      UINT16                  Index; @@ -783,6 +1524,21 @@ OpcGenerateAmlOpcode (          OpcDoEisaId (Op);          break; +    case PARSEOP_PRINTF: + +        OpcDoPrintf (Op); +        break; + +    case PARSEOP_FPRINTF: + +        OpcDoFprintf (Op); +        break; + +    case PARSEOP_TOPLD: + +        OpcDoPld (Op); +        break; +      case PARSEOP_TOUUID:          OpcDoUuId (Op); diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 63abcf4667a4..f5a1d865e47a 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -184,7 +184,7 @@ AslDoOptions (          }          break; -    case 'b':   /* Debug output options */ +    case 'b':   /* Debug options */          switch (AcpiGbl_Optarg[0])          { @@ -193,10 +193,37 @@ AslDoOptions (              AslCompilerdebug = 1; /* same as yydebug */              DtParserdebug = 1;              PrParserdebug = 1; +            Gbl_DebugFlag = TRUE; +            break; + +        case 'p':   /* Prune ASL parse tree */ + +            /* Get the required argument */ + +            if (AcpiGetoptArgument (argc, argv)) +            { +                return (-1); +            } + +            Gbl_PruneParseTree = TRUE; +            Gbl_PruneDepth = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); +            break; + +        case 's': + +            Gbl_DebugFlag = TRUE;              break;          case 't': +            /* Get the required argument */ + +            if (AcpiGetoptArgument (argc, argv)) +            { +                return (-1); +            } + +            Gbl_PruneType = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0);              break;          default: @@ -205,9 +232,6 @@ AslDoOptions (              return (-1);          } -        /* Produce debug output file */ - -        Gbl_DebugFlag = TRUE;          break;      case 'c': @@ -250,6 +274,12 @@ AslDoOptions (              break; +        case 'l':   /* Use legacy ASL code (not ASL+) for disassembly */ + +            Gbl_DoCompile = FALSE; +            AcpiGbl_CstyleDisassembly = FALSE; +            break; +          default:              printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); @@ -530,7 +560,6 @@ AslDoOptions (          Gbl_OutputFilenamePrefix = AcpiGbl_Optarg;          UtConvertBackslashes (Gbl_OutputFilenamePrefix); -          Gbl_UseDefaultAmlFilename = FALSE;          break; diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index 5d21ce66a3c0..827d4388c268 100644 --- a/source/compiler/aslparser.y +++ b/source/compiler/aslparser.y @@ -99,7 +99,7 @@ AslLocalAllocate (   * These shift/reduce conflicts are expected. There should be zero   * reduce/reduce conflicts.   */ -%expect 86 +%expect 89  /*! [Begin] no source code translation */ diff --git a/source/compiler/aslprintf.c b/source/compiler/aslprintf.c new file mode 100644 index 000000000000..d85abe2792c3 --- /dev/null +++ b/source/compiler/aslprintf.c @@ -0,0 +1,380 @@ +/****************************************************************************** + * + * Module Name: aslprintf - ASL Printf/Fprintf macro support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "amlcode.h" + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("aslprintf") + + +/* Local prototypes */ + +static void +OpcCreateConcatenateNode ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *Node); + +static void +OpcParsePrintf ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *DestOp); + + +/******************************************************************************* + * + * FUNCTION:    OpcDoPrintf + * + * PARAMETERS:  Op                  - printf parse node + * + * RETURN:      None + * + * DESCRIPTION: Convert printf macro to a Store(..., Debug) AML operation. + * + ******************************************************************************/ + +void +OpcDoPrintf ( +    ACPI_PARSE_OBJECT       *Op) +{ +    ACPI_PARSE_OBJECT       *DestOp; + + +    /* Store destination is the Debug op */ + +    DestOp = TrAllocateNode (PARSEOP_DEBUG); +    DestOp->Asl.AmlOpcode = AML_DEBUG_OP; +    DestOp->Asl.Parent = Op; +    DestOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + +    OpcParsePrintf (Op, DestOp); +} + + +/******************************************************************************* + * + * FUNCTION:    OpcDoFprintf + * + * PARAMETERS:  Op                  - fprintf parse node + * + * RETURN:      None + * + * DESCRIPTION: Convert fprintf macro to a Store AML operation. + * + ******************************************************************************/ + +void +OpcDoFprintf ( +    ACPI_PARSE_OBJECT       *Op) +{ +    ACPI_PARSE_OBJECT       *DestOp; + + +    /* Store destination is the first argument of fprintf */ + +    DestOp = Op->Asl.Child; +    Op->Asl.Child = DestOp->Asl.Next; +    DestOp->Asl.Next = NULL; + +    OpcParsePrintf (Op, DestOp); +} + + +/******************************************************************************* + * + * FUNCTION:    OpcParsePrintf + * + * PARAMETERS:  Op                  - Printf parse node + *              DestOp              - Destination of Store operation + * + * RETURN:      None + * + * DESCRIPTION: Convert printf macro to a Store AML operation. The printf + *              macro parse tree is layed out as follows: + * + *              Op        - printf parse op + *              Op->Child - Format string + *              Op->Next  - Format string arguments + * + ******************************************************************************/ + +static void +OpcParsePrintf ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *DestOp) +{ +    char                    *Format; +    char                    *StartPosition = NULL; +    ACPI_PARSE_OBJECT       *ArgNode; +    ACPI_PARSE_OBJECT       *NextNode; +    UINT32                  StringLength = 0; +    char                    *NewString; +    BOOLEAN                 StringToProcess = FALSE; +    ACPI_PARSE_OBJECT       *NewOp; + + +    /* Get format string */ + +    Format = ACPI_CAST_PTR (char, Op->Asl.Child->Asl.Value.String); +    ArgNode = Op->Asl.Child->Asl.Next; + +    /* +     * Detach argument list so that we can use a NULL check to distinguish +     * the first concatenation operation we need to make +     */ +    Op->Asl.Child = NULL; + +    for (; *Format; ++Format) +    { +        if (*Format != '%') +        { +            if (!StringToProcess) +            { +                /* Mark the beginning of a string */ + +                StartPosition = Format; +                StringToProcess = TRUE; +            } + +            ++StringLength; +            continue; +        } + +        /* Save string, if any, to new string object and concat it */ + +        if (StringToProcess) +        { +            NewString = UtStringCacheCalloc (StringLength + 1); +            ACPI_STRNCPY (NewString, StartPosition, StringLength); + +            NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); +            NewOp->Asl.Value.String = NewString; +            NewOp->Asl.AmlOpcode = AML_STRING_OP; +            NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; +            NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + +            OpcCreateConcatenateNode(Op, NewOp); + +            StringLength = 0; +            StringToProcess = FALSE; +        } + +        ++Format; + +        /* +         * We have a format parameter and will need an argument to go +         * with it +         */ +        if (!ArgNode || +            ArgNode->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) +        { +            AslError(ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, NULL); +            return; +        } + +        /* +         * We do not support sub-specifiers of printf (flags, width, +         * precision, length). For specifiers we only support %x/%X for +         * hex or %s for strings. Also, %o for generic "acpi object". +         */ +        switch (*Format) +        { +        case 's': + +            if (ArgNode->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) +            { +                AslError(ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgNode, +                    "String required"); +                return; +            } + +            NextNode = ArgNode->Asl.Next; +            ArgNode->Asl.Next = NULL; +            OpcCreateConcatenateNode(Op, ArgNode); +            ArgNode = NextNode; +            continue; + +        case 'X': +        case 'x': +        case 'o': + +            NextNode = ArgNode->Asl.Next; +            ArgNode->Asl.Next = NULL; + +            /* +             * Append an empty string if the first argument is +             * not a string. This will implicitly conver the 2nd +             * concat source to a string per the ACPI specification. +             */ +            if (!Op->Asl.Child) +            { +                NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); +                NewOp->Asl.Value.String = ""; +                NewOp->Asl.AmlOpcode = AML_STRING_OP; +                NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; +                NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + +                OpcCreateConcatenateNode(Op, NewOp); +            } + +            OpcCreateConcatenateNode(Op, ArgNode); +            ArgNode = NextNode; +            break; + +        default: + +            AslError(ASL_ERROR, ASL_MSG_INVALID_OPERAND, Op, +                "Unrecognized format specifier"); +            continue; +        } +    } + +    /* Process any remaining string */ + +    if (StringToProcess) +    { +        NewString = UtStringCacheCalloc (StringLength + 1); +        ACPI_STRNCPY (NewString, StartPosition, StringLength); + +        NewOp = TrAllocateNode (PARSEOP_STRING_LITERAL); +        NewOp->Asl.Value.String = NewString; +        NewOp->Asl.AcpiBtype = ACPI_BTYPE_STRING; +        NewOp->Asl.AmlOpcode = AML_STRING_OP; +        NewOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + +        OpcCreateConcatenateNode(Op, NewOp); +    } + +    /* +     * If we get here and there's no child node then Format +     * was an empty string. Just make a no op. +     */ +    if (!Op->Asl.Child) +    { +        Op->Asl.ParseOpcode = PARSEOP_NOOP; +        AslError(ASL_WARNING, ASL_MSG_NULL_STRING, Op, +            "Converted to NOOP"); +        return; +    } + +     /* Check for erroneous extra arguments */ + +    if (ArgNode && +        ArgNode->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) +    { +        AslError(ASL_WARNING, ASL_MSG_ARG_COUNT_HI, ArgNode, +            "Extra arguments ignored"); +    } + +    /* Change Op to a Store */ + +    Op->Asl.ParseOpcode = PARSEOP_STORE; +    Op->Common.AmlOpcode = AML_STORE_OP; +    Op->Asl.CompileFlags  = 0; + +    /* Disable further optimization */ + +    Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; +    UtSetParseOpName (Op); + +    /* Set Store destination */ + +    Op->Asl.Child->Asl.Next = DestOp; +} + + +/******************************************************************************* + * + * FUNCTION:    OpcCreateConcatenateNode + * + * PARAMETERS:  Op                  - Parse node + *              Node                - Parse node to be concatenated + * + * RETURN:      None + * + * DESCRIPTION: Make Node the child of Op. If child node already exists, then + *              concat child with Node and makes concat node the child of Op. + * + ******************************************************************************/ + +static void +OpcCreateConcatenateNode ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *Node) +{ +    ACPI_PARSE_OBJECT       *NewConcatOp; + + +    if (!Op->Asl.Child) +    { +        Op->Asl.Child = Node; +        Node->Asl.Parent = Op; +        return; +    } + +    NewConcatOp = TrAllocateNode (PARSEOP_CONCATENATE); +    NewConcatOp->Asl.AmlOpcode = AML_CONCAT_OP; +    NewConcatOp->Asl.AcpiBtype = 0x7; +    NewConcatOp->Asl.LogicalLineNumber = Op->Asl.LogicalLineNumber; + +    /* First arg is child of Op*/ + +    NewConcatOp->Asl.Child = Op->Asl.Child; +    Op->Asl.Child->Asl.Parent = NewConcatOp; + +    /* Second arg is Node */ + +    NewConcatOp->Asl.Child->Asl.Next = Node; +    Node->Asl.Parent = NewConcatOp; + +    /* Third arg is Zero (not used) */ + +    NewConcatOp->Asl.Child->Asl.Next->Asl.Next = +        TrAllocateNode (PARSEOP_ZERO); +    NewConcatOp->Asl.Child->Asl.Next->Asl.Next->Asl.Parent = +        NewConcatOp; + +    Op->Asl.Child = NewConcatOp; +    NewConcatOp->Asl.Parent = Op; +} diff --git a/source/compiler/aslprune.c b/source/compiler/aslprune.c new file mode 100644 index 000000000000..b80ee159624e --- /dev/null +++ b/source/compiler/aslprune.c @@ -0,0 +1,239 @@ +/****************************************************************************** + * + * Module Name: aslprune - Parse tree prune utility + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aslcompiler.h" +#include "aslcompiler.y.h" +#include "acapps.h" + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("aslprune") + + +/* Local prototypes */ + +static ACPI_STATUS +PrTreePruneWalk ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +static void +PrPrintObjectAtLevel ( +    UINT32                  Level, +    const char              *ObjectName); + + +typedef struct acpi_prune_info +{ +    UINT32                  PruneLevel; +    UINT16                  ParseOpcode; +    UINT16                  Count; + +} ACPI_PRUNE_INFO; + + +/******************************************************************************* + * + * FUNCTION:    AslPruneParseTree + * + * PARAMETERS:  PruneDepth              - Number of levels to prune + *              Type                    - Prune type (Device, Method, etc.) + * + * RETURN:      None + * + * DESCRIPTION: Prune off one or more levels of the ASL parse tree + * + ******************************************************************************/ + +void +AslPruneParseTree ( +    UINT32                  PruneDepth, +    UINT32                  Type) +{ +    ACPI_PRUNE_INFO         PruneObj; + + +    PruneObj.PruneLevel = PruneDepth; +    PruneObj.Count = 0; + +    switch (Type) +    { +    case 0: +        PruneObj.ParseOpcode = (UINT16) PARSEOP_DEVICE; +        break; + +    case 1: +        PruneObj.ParseOpcode = (UINT16) PARSEOP_METHOD; +        break; + +    case 2: +        PruneObj.ParseOpcode = (UINT16) PARSEOP_IF; +        break; + +    default: +        AcpiOsPrintf ("Unsupported type: %u\n", Type); +        return; +    } + +    AcpiOsPrintf ("Pruning parse tree, from depth %u\n", +        PruneDepth); + +    AcpiOsPrintf ("\nRemoving Objects:\n"); + +    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +        PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj)); + +    AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count); +} + + +/******************************************************************************* + * + * FUNCTION:    PrPrintObjectAtLevel + * + * PARAMETERS:  Level                   - Current nesting level + *              ObjectName              - ACPI name for the object + * + * RETURN:      None + * + * DESCRIPTION: Print object name with indent + * + ******************************************************************************/ + +static void +PrPrintObjectAtLevel ( +    UINT32                  Level, +    const char              *ObjectName) +{ +    UINT32                  i; + + +    for (i = 0; i < Level; i++) +    { +        AcpiOsPrintf ("  "); +    } + +    AcpiOsPrintf ("[%s] at Level [%u]\n", ObjectName, Level); +} + + +/******************************************************************************* + * + * FUNCTION:    PrTreePruneWalk + * + * PARAMETERS:  Parse tree walk callback + * + * RETURN:      Status + * + * DESCRIPTION: Prune off one or more levels of the ASL parse tree + * + * Current objects that can be pruned are: Devices, Methods, and If/Else + * blocks. + * + ******************************************************************************/ + +static ACPI_STATUS +PrTreePruneWalk ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ACPI_PRUNE_INFO         *PruneObj = (ACPI_PRUNE_INFO *) Context; + + +    /* We only care about objects below the Prune Level threshold */ + +    if (Level <= PruneObj->PruneLevel) +    { +        return (AE_OK); +    } + +    if ((Op->Asl.ParseOpcode != PruneObj->ParseOpcode) && +       !(Op->Asl.ParseOpcode == PARSEOP_ELSE && +             PruneObj->ParseOpcode == PARSEOP_IF)) +    { +        return (AE_OK); +    } + +    switch (Op->Asl.ParseOpcode) +    { +    case PARSEOP_METHOD: + +        AcpiOsPrintf ("Method"); +        PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name); +        Op->Asl.Child->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next->Asl.Next = NULL; +        PruneObj->Count++; +        break; + +    case PARSEOP_DEVICE: + +        AcpiOsPrintf ("Device"); +        PrPrintObjectAtLevel (Level, Op->Asl.Child->Asl.Value.Name); +        Op->Asl.Child->Asl.Next = NULL; +        PruneObj->Count++; +        break; + +    case PARSEOP_IF: +    case PARSEOP_ELSE: + +        if (Op->Asl.ParseOpcode == PARSEOP_ELSE) +        { +            PrPrintObjectAtLevel(Level, "Else"); +            Op->Asl.Child = NULL; +        } +        else +        { +            PrPrintObjectAtLevel(Level, "If"); +            Op->Asl.Child->Asl.Next = NULL; +        } + +        PruneObj->Count++; +        break; + +    default: + +        break; +    } + +    return (AE_OK); +} diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index 2bc48db11f6a..7c47eb3e307a 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -92,6 +92,149 @@ DefinitionBlockTerm              '{' TermList '}'        {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}      ; +    /* +     * ASL Extensions: C-style math/logical operators and expressions. +     * The implementation transforms these operators into the standard +     * AML opcodes and syntax. +     * +     * Supported operators and precedence rules (high-to-low) +     * +     * NOTE: The operator precedence and associativity rules are +     * implemented by the tokens in asltokens.y +     * +     * (left-to-right): +     *  1)      ( ) expr++ expr-- +     * +     * (right-to-left): +     *  2)      ! ~ +     * +     * (left-to-right): +     *  3)      *   /   % +     *  4)      +   - +     *  5)      >>  << +     *  6)      <   >   <=  >= +     *  7)      ==  != +     *  8)      & +     *  9)      ^ +     *  10)     | +     *  11)     && +     *  12)     || +     * +     * (right-to-left): +     *  13)     = += -= *= /= %= <<= >>= &= ^= |= +     */ +Expression + +    /* Unary operators */ + +    : PARSEOP_EXP_LOGICAL_NOT           {$<n>$ = TrCreateLeafNode (PARSEOP_LNOT);} +        TermArg                         {$$ = TrLinkChildren ($<n>2,1,$3);} +    | PARSEOP_EXP_NOT                   {$<n>$ = TrCreateLeafNode (PARSEOP_NOT);} +        TermArg                         {$$ = TrLinkChildren ($<n>2,2,$3,TrCreateLeafNode (PARSEOP_ZERO));} + +    | SuperName PARSEOP_EXP_INCREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_INCREMENT);} +                                        {$$ = TrLinkChildren ($<n>3,1,$1);} +    | SuperName PARSEOP_EXP_DECREMENT   {$<n>$ = TrCreateLeafNode (PARSEOP_DECREMENT);} +                                        {$$ = TrLinkChildren ($<n>3,1,$1);} + +    /* Binary operators: math and logical */ + +    | TermArg PARSEOP_EXP_ADD           {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_DIVIDE        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), +                                            TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_MODULO        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_MULTIPLY      {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_SHIFT_LEFT    {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_SHIFT_RIGHT   {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_SUBTRACT      {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + +    | TermArg PARSEOP_EXP_AND           {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_OR            {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} +    | TermArg PARSEOP_EXP_XOR           {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4,TrCreateLeafNode (PARSEOP_ZERO));} + +    | TermArg PARSEOP_EXP_GREATER       {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATER);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} +    | TermArg PARSEOP_EXP_GREATER_EQUAL {$<n>$ = TrCreateLeafNode (PARSEOP_LGREATEREQUAL);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} +    | TermArg PARSEOP_EXP_LESS          {$<n>$ = TrCreateLeafNode (PARSEOP_LLESS);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} +    | TermArg PARSEOP_EXP_LESS_EQUAL    {$<n>$ = TrCreateLeafNode (PARSEOP_LLESSEQUAL);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + +    | TermArg PARSEOP_EXP_EQUAL         {$<n>$ = TrCreateLeafNode (PARSEOP_LEQUAL);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} +    | TermArg PARSEOP_EXP_NOT_EQUAL     {$<n>$ = TrCreateLeafNode (PARSEOP_LNOTEQUAL);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + +    | TermArg PARSEOP_EXP_LOGICAL_AND   {$<n>$ = TrCreateLeafNode (PARSEOP_LAND);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} +    | TermArg PARSEOP_EXP_LOGICAL_OR    {$<n>$ = TrCreateLeafNode (PARSEOP_LOR);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,2,$1,$4);} + +      /* Parentheses */ + +    | '(' TermArg ')'                   { $$ = $2;} +    ; + +EqualsTerm + +    /* All assignment-type operations */ + +    : SuperName PARSEOP_EXP_EQUALS +        TermArg                         {$$ = TrCreateAssignmentNode ($1, $3);} + +    | TermArg PARSEOP_EXP_ADD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_ADD);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_DIV_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_DIVIDE);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,4,$1,$4,TrCreateLeafNode (PARSEOP_ZERO), +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_MOD_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MOD);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_MUL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_MULTIPLY);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_SHL_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTLEFT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_SHR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SHIFTRIGHT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_SUB_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_SUBTRACT);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_AND_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_AND);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_OR_EQ         {$<n>$ = TrCreateLeafNode (PARSEOP_OR);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} + +    | TermArg PARSEOP_EXP_XOR_EQ        {$<n>$ = TrCreateLeafNode (PARSEOP_XOR);} +        TermArg                         {$$ = TrLinkChildren ($<n>3,3,$1,$4, +                                            TrSetNodeFlags (TrCreateTargetOperand ($1, NULL), NODE_IS_TARGET));} +    ; + +  /* ACPI 3.0 -- allow semicolons between terms */  TermList @@ -104,6 +247,7 @@ TermList  Term      : Object                        {} +    | Expression                    {}      | Type1Opcode                   {}      | Type2Opcode                   {}      | Type2IntegerOpcode            {} @@ -211,7 +355,8 @@ Removed from TermArg due to reduce/reduce conflicts  */  TermArg -    : Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} +    : Expression                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} +    | Type2Opcode                   {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}      | DataObject                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}      | NameString                    {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}      | ArgTerm                       {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} @@ -305,6 +450,7 @@ Type2Opcode      | RefOfTerm                     {}      | SizeOfTerm                    {}      | StoreTerm                     {} +    | EqualsTerm                    {}      | TimerTerm                     {}      | WaitTerm                      {}      | UserTerm                      {} @@ -362,6 +508,8 @@ Type2BufferOpcode                   /* "Type5" Opcodes */  Type2BufferOrStringOpcode      : ConcatTerm                    {} +    | PrintfTerm                    {} +    | FprintfTerm                   {}      | MidTerm                       {}      ; @@ -387,6 +535,7 @@ Type4Opcode  Type5Opcode      : ResourceTemplateTerm          {}      | UnicodeTerm                   {} +    | ToPLDTerm                     {}      | ToUUIDTerm                    {}      ; @@ -1370,6 +1519,86 @@ ToIntegerTerm          error ')'                   {$$ = AslDoError(); yyclearin;}      ; +PldKeyword +    : PARSEOP_PLD_REVISION          {$$ = TrCreateLeafNode (PARSEOP_PLD_REVISION);} +    | PARSEOP_PLD_IGNORECOLOR       {$$ = TrCreateLeafNode (PARSEOP_PLD_IGNORECOLOR);} +    | PARSEOP_PLD_RED               {$$ = TrCreateLeafNode (PARSEOP_PLD_RED);} +    | PARSEOP_PLD_GREEN             {$$ = TrCreateLeafNode (PARSEOP_PLD_GREEN);} +    | PARSEOP_PLD_BLUE              {$$ = TrCreateLeafNode (PARSEOP_PLD_BLUE);} +    | PARSEOP_PLD_WIDTH             {$$ = TrCreateLeafNode (PARSEOP_PLD_WIDTH);} +    | PARSEOP_PLD_HEIGHT            {$$ = TrCreateLeafNode (PARSEOP_PLD_HEIGHT);} +    | PARSEOP_PLD_USERVISIBLE       {$$ = TrCreateLeafNode (PARSEOP_PLD_USERVISIBLE);} +    | PARSEOP_PLD_DOCK              {$$ = TrCreateLeafNode (PARSEOP_PLD_DOCK);} +    | PARSEOP_PLD_LID               {$$ = TrCreateLeafNode (PARSEOP_PLD_LID);} +    | PARSEOP_PLD_PANEL             {$$ = TrCreateLeafNode (PARSEOP_PLD_PANEL);} +    | PARSEOP_PLD_VERTICALPOSITION  {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALPOSITION);} +    | PARSEOP_PLD_HORIZONTALPOSITION {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALPOSITION);} +    | PARSEOP_PLD_SHAPE             {$$ = TrCreateLeafNode (PARSEOP_PLD_SHAPE);} +    | PARSEOP_PLD_GROUPORIENTATION  {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPORIENTATION);} +    | PARSEOP_PLD_GROUPTOKEN        {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPTOKEN);} +    | PARSEOP_PLD_GROUPPOSITION     {$$ = TrCreateLeafNode (PARSEOP_PLD_GROUPPOSITION);} +    | PARSEOP_PLD_BAY               {$$ = TrCreateLeafNode (PARSEOP_PLD_BAY);} +    | PARSEOP_PLD_EJECTABLE         {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTABLE);} +    | PARSEOP_PLD_EJECTREQUIRED     {$$ = TrCreateLeafNode (PARSEOP_PLD_EJECTREQUIRED);} +    | PARSEOP_PLD_CABINETNUMBER     {$$ = TrCreateLeafNode (PARSEOP_PLD_CABINETNUMBER);} +    | PARSEOP_PLD_CARDCAGENUMBER    {$$ = TrCreateLeafNode (PARSEOP_PLD_CARDCAGENUMBER);} +    | PARSEOP_PLD_REFERENCE         {$$ = TrCreateLeafNode (PARSEOP_PLD_REFERENCE);} +    | PARSEOP_PLD_ROTATION          {$$ = TrCreateLeafNode (PARSEOP_PLD_ROTATION);} +    | PARSEOP_PLD_ORDER             {$$ = TrCreateLeafNode (PARSEOP_PLD_ORDER);} +    | PARSEOP_PLD_RESERVED          {$$ = TrCreateLeafNode (PARSEOP_PLD_RESERVED);} +    | PARSEOP_PLD_VERTICALOFFSET    {$$ = TrCreateLeafNode (PARSEOP_PLD_VERTICALOFFSET);} +    | PARSEOP_PLD_HORIZONTALOFFSET  {$$ = TrCreateLeafNode (PARSEOP_PLD_HORIZONTALOFFSET);} +    ; + +PldKeywordList +    :                               {$$ = NULL;} +    | PldKeyword +        PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkChildren ($1,1,$3);} +    | PldKeyword +        PARSEOP_EXP_EQUALS String   {$$ = TrLinkChildren ($1,1,$3);} +    | PldKeywordList ','            /* Allows a trailing comma at list end */ +    | PldKeywordList ',' +        PldKeyword +        PARSEOP_EXP_EQUALS Integer  {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} +    | PldKeywordList ',' +        PldKeyword +        PARSEOP_EXP_EQUALS String   {$$ = TrLinkPeerNode ($1,TrLinkChildren ($3,1,$5));} +    ; + +ToPLDTerm +    : PARSEOP_TOPLD '('             {$<n>$ = TrCreateLeafNode (PARSEOP_TOPLD);} +        PldKeywordList +        ')'                         {$$ = TrLinkChildren ($<n>3,1,$4);} +    | PARSEOP_TOPLD '(' +        error ')'                   {$$ = AslDoError(); yyclearin;} +    ; + +PrintfArgList +    :                               {$$ = NULL;} +    | TermArg                       {$$ = $1;} +    | PrintfArgList ',' +       TermArg                      {$$ = TrLinkPeerNode ($1, $3);} +    ; + +PrintfTerm +    : PARSEOP_PRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_PRINTF);} +        StringData +        PrintfArgList +        ')'                         {$$ = TrLinkChildren ($<n>3,2,$4,$5);} +    | PARSEOP_PRINTF '(' +        error ')'                   {$$ = AslDoError(); yyclearin;} +    ; + +FprintfTerm +    : PARSEOP_FPRINTF '('            {$<n>$ = TrCreateLeafNode (PARSEOP_FPRINTF);} +        TermArg ',' +        StringData +        PrintfArgList +        ')'                         {$$ = TrLinkChildren ($<n>3,3,$4,$6,$7);} +    | PARSEOP_FPRINTF '(' +        error ')'                   {$$ = AslDoError(); yyclearin;} +    ; +  ToStringTerm      : PARSEOP_TOSTRING '('          {$<n>$ = TrCreateLeafNode (PARSEOP_TOSTRING);}          TermArg diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index c296fea30bec..0473f5d22ab0 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -376,6 +376,88 @@ NoEcho('  %token <i> PARSEOP_XOR  %token <i> PARSEOP_ZERO +/* ToPld macro */ + +%token <i> PARSEOP_TOPLD +%token <i> PARSEOP_PLD_REVISION +%token <i> PARSEOP_PLD_IGNORECOLOR +%token <i> PARSEOP_PLD_RED +%token <i> PARSEOP_PLD_GREEN +%token <i> PARSEOP_PLD_BLUE +%token <i> PARSEOP_PLD_WIDTH +%token <i> PARSEOP_PLD_HEIGHT +%token <i> PARSEOP_PLD_USERVISIBLE +%token <i> PARSEOP_PLD_DOCK +%token <i> PARSEOP_PLD_LID +%token <i> PARSEOP_PLD_PANEL +%token <i> PARSEOP_PLD_VERTICALPOSITION +%token <i> PARSEOP_PLD_HORIZONTALPOSITION +%token <i> PARSEOP_PLD_SHAPE +%token <i> PARSEOP_PLD_GROUPORIENTATION +%token <i> PARSEOP_PLD_GROUPTOKEN +%token <i> PARSEOP_PLD_GROUPPOSITION +%token <i> PARSEOP_PLD_BAY +%token <i> PARSEOP_PLD_EJECTABLE +%token <i> PARSEOP_PLD_EJECTREQUIRED +%token <i> PARSEOP_PLD_CABINETNUMBER +%token <i> PARSEOP_PLD_CARDCAGENUMBER +%token <i> PARSEOP_PLD_REFERENCE +%token <i> PARSEOP_PLD_ROTATION +%token <i> PARSEOP_PLD_ORDER +%token <i> PARSEOP_PLD_RESERVED +%token <i> PARSEOP_PLD_VERTICALOFFSET +%token <i> PARSEOP_PLD_HORIZONTALOFFSET + +/* + * C-style expression parser. These must appear after all of the + * standard ASL operators and keywords. + * + * Note: The order of these tokens implements the precedence rules + * (low precedence to high). See aslrules.y for an exhaustive list. + */ +%right <i> PARSEOP_EXP_EQUALS +           PARSEOP_EXP_ADD_EQ +           PARSEOP_EXP_SUB_EQ +           PARSEOP_EXP_MUL_EQ +           PARSEOP_EXP_DIV_EQ +           PARSEOP_EXP_MOD_EQ +           PARSEOP_EXP_SHL_EQ +           PARSEOP_EXP_SHR_EQ +           PARSEOP_EXP_AND_EQ +           PARSEOP_EXP_XOR_EQ +           PARSEOP_EXP_OR_EQ + +%left <i>  PARSEOP_EXP_LOGICAL_OR +%left <i>  PARSEOP_EXP_LOGICAL_AND +%left <i>  PARSEOP_EXP_OR +%left <i>  PARSEOP_EXP_XOR +%left <i>  PARSEOP_EXP_AND +%left <i>  PARSEOP_EXP_EQUAL +           PARSEOP_EXP_NOT_EQUAL +%left <i>  PARSEOP_EXP_GREATER +           PARSEOP_EXP_LESS +           PARSEOP_EXP_GREATER_EQUAL +           PARSEOP_EXP_LESS_EQUAL +%left <i>  PARSEOP_EXP_SHIFT_RIGHT +           PARSEOP_EXP_SHIFT_LEFT +%left <i>  PARSEOP_EXP_ADD +           PARSEOP_EXP_SUBTRACT +%left <i>  PARSEOP_EXP_MULTIPLY +           PARSEOP_EXP_DIVIDE +           PARSEOP_EXP_MODULO + +%right <i> PARSEOP_EXP_NOT +           PARSEOP_EXP_LOGICAL_NOT + +%left <i>  PARSEOP_EXP_INCREMENT +           PARSEOP_EXP_DECREMENT + +%token <i> PARSEOP_PRINTF +%token <i> PARSEOP_FPRINTF +/* Specific parentheses tokens are not used at this time */ +           /* PARSEOP_EXP_PAREN_OPEN */ +           /* PARSEOP_EXP_PAREN_CLOSE */ +  /*   * Special functions. These should probably stay at the end of this   * table. diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 38644e841252..4219ffe7c8a2 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -448,6 +448,124 @@ TrSetEndLineNumber (  /*******************************************************************************   * + * FUNCTION:    TrCreateAssignmentNode + * + * PARAMETERS:  Target              - Assignment target + *              Source              - Assignment source + * + * RETURN:      Pointer to the new node. Aborts on allocation failure + * + * DESCRIPTION: Implements the C-style '=' operator. It changes the parse + *              tree if possible to utilize the last argument of the math + *              operators which is a target operand -- thus saving invocation + *              of and additional Store() operator. An optimization. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrCreateAssignmentNode ( +    ACPI_PARSE_OBJECT       *Target, +    ACPI_PARSE_OBJECT       *Source) +{ +    ACPI_PARSE_OBJECT       *TargetOp; +    ACPI_PARSE_OBJECT       *SourceOp1; +    ACPI_PARSE_OBJECT       *SourceOp2; +    ACPI_PARSE_OBJECT       *Operator; + + +    DbgPrint (ASL_PARSE_OUTPUT, +        "\nTrCreateAssignmentNode  Line [%u to %u] Source %s Target %s\n", +        Source->Asl.LineNumber, Source->Asl.EndLine, +        UtGetOpName (Source->Asl.ParseOpcode), +        UtGetOpName (Target->Asl.ParseOpcode)); + +    TrSetNodeFlags (Target, NODE_IS_TARGET); + +    switch (Source->Asl.ParseOpcode) +    { +    /* +     * Only these operators can be optimized because they have +     * a target operand +     */ +    case PARSEOP_ADD: +    case PARSEOP_AND: +    case PARSEOP_DIVIDE: +    case PARSEOP_MOD: +    case PARSEOP_MULTIPLY: +    case PARSEOP_NOT: +    case PARSEOP_OR: +    case PARSEOP_SHIFTLEFT: +    case PARSEOP_SHIFTRIGHT: +    case PARSEOP_SUBTRACT: +    case PARSEOP_XOR: + +        break; + +    /* Otherwise, just create a normal Store operator */ + +    default: + +        goto CannotOptimize; +    } + +    /* +     * Transform the parse tree such that the target is moved to the +     * last operand of the operator +     */ +    SourceOp1 = Source->Asl.Child; +    SourceOp2 = SourceOp1->Asl.Next; + +    /* NOT only has one operand, but has a target */ + +    if (Source->Asl.ParseOpcode == PARSEOP_NOT) +    { +        SourceOp2 = SourceOp1; +    } + +    /* DIVIDE has an extra target operand (remainder) */ + +    if (Source->Asl.ParseOpcode == PARSEOP_DIVIDE) +    { +        SourceOp2 = SourceOp2->Asl.Next; +    } + +    TargetOp = SourceOp2->Asl.Next; + +    /* +     * Can't perform this optimization if there already is a target +     * for the operator (ZERO is a "no target" placeholder). +     */ +    if (TargetOp->Asl.ParseOpcode != PARSEOP_ZERO) +    { +        goto CannotOptimize; +    } + +    /* Link in the target as the final operand */ + +    SourceOp2->Asl.Next = Target; +    Target->Asl.Parent = Source; + +    return (Source); + + +CannotOptimize: + +    Operator = TrAllocateNode (PARSEOP_STORE); +    TrLinkChildren (Operator, 2, Source, Target); + +    /* Set the appropriate line numbers for the new node */ + +    Operator->Asl.LineNumber        = Target->Asl.LineNumber; +    Operator->Asl.LogicalLineNumber = Target->Asl.LogicalLineNumber; +    Operator->Asl.LogicalByteOffset = Target->Asl.LogicalByteOffset; +    Operator->Asl.Column            = Target->Asl.Column; + +    return (Operator); +} + + +/******************************************************************************* + *   * FUNCTION:    TrCreateLeafNode   *   * PARAMETERS:  ParseOpcode         - New opcode to be assigned to the node @@ -563,6 +681,81 @@ TrCreateConstantLeafNode (  /*******************************************************************************   * + * FUNCTION:    TrCreateTargetOperand + * + * PARAMETERS:  OriginalOp          - Op to be copied + * + * RETURN:      Pointer to the new node. Aborts on allocation failure + * + * DESCRIPTION: Copy an existing node (and subtree). Used in ASL+ (C-style) + *              expressions where the target is the same as one of the + *              operands. A new node and subtree must be created from the + *              original so that the parse tree can be linked properly. + * + * NOTE:        This code is specific to target operands that are the last + *              operand in an ASL/AML operator. Meaning that the top-level + *              parse Op in a possible subtree has a NULL Next pointer. + *              This simplifies the recursion. + * + *              Subtree example: + *                  DeRefOf (Local1) += 32 + * + *              This gets converted to: + *                  Add (DeRefOf (Local1), 32, DeRefOf (Local1)) + * + *              Each DeRefOf has a single child, Local1. Even more complex + *              subtrees can be created via the Index and DeRefOf operators. + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +TrCreateTargetOperand ( +    ACPI_PARSE_OBJECT       *OriginalOp, +    ACPI_PARSE_OBJECT       *ParentOp) +{ +    ACPI_PARSE_OBJECT       *Op; + + +    if (!OriginalOp) +    { +        return (NULL); +    } + +    Op = TrGetNextNode (); + +    /* Copy the pertinent values (omit link pointer fields) */ + +    Op->Asl.Value               = OriginalOp->Asl.Value; +    Op->Asl.Filename            = OriginalOp->Asl.Filename; +    Op->Asl.LineNumber          = OriginalOp->Asl.LineNumber; +    Op->Asl.LogicalLineNumber   = OriginalOp->Asl.LogicalLineNumber; +    Op->Asl.LogicalByteOffset   = OriginalOp->Asl.LogicalByteOffset; +    Op->Asl.Column              = OriginalOp->Asl.Column; +    Op->Asl.Flags               = OriginalOp->Asl.Flags; +    Op->Asl.CompileFlags        = OriginalOp->Asl.CompileFlags; +    Op->Asl.AmlOpcode           = OriginalOp->Asl.AmlOpcode; +    Op->Asl.ParseOpcode         = OriginalOp->Asl.ParseOpcode; +    Op->Asl.Parent              = ParentOp; +    UtSetParseOpName (Op); + +    /* Copy a possible subtree below this node */ + +    if (OriginalOp->Asl.Child) +    { +        Op->Asl.Child = TrCreateTargetOperand (OriginalOp->Asl.Child, Op); +    } + +    if (OriginalOp->Asl.Next) /* Null for top-level node */ +    { +        Op->Asl.Next = TrCreateTargetOperand (OriginalOp->Asl.Next, ParentOp); +    } + +    return (Op); +} + + +/******************************************************************************* + *   * FUNCTION:    TrCreateValuedLeafNode   *   * PARAMETERS:  ParseOpcode         - New opcode to be assigned to the node diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index b9914531b4e3..ece54132e1d2 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -285,8 +285,14 @@ NoEcho('  %type <n> ResourceMacroList  %type <n> ResourceMacroTerm  %type <n> ResourceTemplateTerm +%type <n> PldKeyword +%type <n> PldKeywordList +%type <n> ToPLDTerm  %type <n> ToUUIDTerm  %type <n> UnicodeTerm +%type <n> PrintfArgList +%type <n> PrintfTerm +%type <n> FprintfTerm  /* Resource Descriptors */ @@ -379,3 +385,9 @@ NoEcho('  %type <n> OptionalWordConst  %type <n> OptionalWordConstExpr  %type <n> OptionalXferSize + +/* + * C-style expression parser + */ +%type <n> Expression +%type <n> EqualsTerm diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index da4e9e31e9e0..bbf64070c4d3 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -294,6 +294,13 @@ AnOperandTypecheckWalkEnd (          {              RequiredBtypes = AnMapArgTypeToBtype (ArgType); +            if (!ArgOp) +            { +                AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, +                    "Null ArgOp in argument loop"); +                AslAbort (); +            } +              ThisNodeBtype = AnGetBtype (ArgOp);              if (ThisNodeBtype == ACPI_UINT32_MAX)              { diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index f26cfdd08401..2f4792170474 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -832,6 +832,8 @@ XfNamespaceLocateBegin (          if ((Op->Asl.Parent) &&             ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF)      ||              (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF)    || +            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_PACKAGE)    || +            (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)||              (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))          {              return_ACPI_STATUS (AE_OK); diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index e7dfabff1514..3168d4c72e5c 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTCOMPILE_C__  #define _DECLARE_DT_GLOBALS  #include "aslcompiler.h" diff --git a/source/compiler/dtexpress.c b/source/compiler/dtexpress.c index 1c0658758674..c431ed36fd19 100644 --- a/source/compiler/dtexpress.c +++ b/source/compiler/dtexpress.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTEXPRESS_C__ -  #include "aslcompiler.h"  #include "dtcompiler.h"  #include "dtparser.y.h" diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 98c87798c543..bcbdab47891d 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTFIELD_C__ -  #include "aslcompiler.h"  #include "dtcompiler.h" diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index f8e35fdd8a3b..e90695ab37df 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTIO_C__ -  #include "aslcompiler.h"  #include "dtcompiler.h"  #include "acapps.h" diff --git a/source/compiler/dtsubtable.c b/source/compiler/dtsubtable.c index d4394e38c366..c29d69d970a1 100644 --- a/source/compiler/dtsubtable.c +++ b/source/compiler/dtsubtable.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTSUBTABLE_C__ -  #include "aslcompiler.h"  #include "dtcompiler.h" diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index a0dee31e6896..bbe43d27bbc0 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTTABLE_C__ -  /* Compile all complex data tables */  #include "aslcompiler.h" diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 6927c56697f4..a41b6b61b2d0 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DTUTILS_C__ -  #include "aslcompiler.h"  #include "dtcompiler.h"  #include "actables.h" diff --git a/source/components/debugger/dbconvert.c b/source/components/debugger/dbconvert.c index ad8b13967cce..cf7502d11b2d 100644 --- a/source/components/debugger/dbconvert.c +++ b/source/components/debugger/dbconvert.c @@ -361,7 +361,9 @@ AcpiDbEncodePldBuffer (      Dword = 0;      ACPI_PLD_SET_REVISION       (&Dword, PldInfo->Revision);      ACPI_PLD_SET_IGNORE_COLOR   (&Dword, PldInfo->IgnoreColor); -    ACPI_PLD_SET_COLOR          (&Dword, PldInfo->Color); +    ACPI_PLD_SET_RED            (&Dword, PldInfo->Red); +    ACPI_PLD_SET_GREEN          (&Dword, PldInfo->Green); +    ACPI_PLD_SET_BLUE           (&Dword, PldInfo->Blue);      ACPI_MOVE_32_TO_32 (&Buffer[0], &Dword);      /* Second 32 bits */ @@ -480,45 +482,47 @@ AcpiDbDumpPldBuffer (      /* First 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Revision", PldInfo->Revision); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "IgnoreColor", PldInfo->IgnoreColor); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Color", PldInfo->Color); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Revision", PldInfo->Revision); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_IgnoreColor", PldInfo->IgnoreColor); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Red", PldInfo->Red); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Green", PldInfo->Green); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Blue", PldInfo->Blue);      /* Second 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Width", PldInfo->Width); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Height", PldInfo->Height); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Width", PldInfo->Width); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Height", PldInfo->Height);      /* Third 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "UserVisible", PldInfo->UserVisible); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Dock", PldInfo->Dock); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Lid", PldInfo->Lid); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Panel", PldInfo->Panel); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalPosition", PldInfo->VerticalPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalPosition", PldInfo->HorizontalPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Shape", PldInfo->Shape); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupOrientation", PldInfo->GroupOrientation); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupToken", PldInfo->GroupToken); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "GroupPosition", PldInfo->GroupPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Bay", PldInfo->Bay); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_UserVisible", PldInfo->UserVisible); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Dock", PldInfo->Dock); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Lid", PldInfo->Lid); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Panel", PldInfo->Panel); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalPosition", PldInfo->VerticalPosition); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalPosition", PldInfo->HorizontalPosition); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Shape", PldInfo->Shape); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupOrientation", PldInfo->GroupOrientation); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupToken", PldInfo->GroupToken); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_GroupPosition", PldInfo->GroupPosition); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Bay", PldInfo->Bay);      /* Fourth 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Ejectable", PldInfo->Ejectable); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "OspmEjectRequired", PldInfo->OspmEjectRequired); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "CabinetNumber", PldInfo->CabinetNumber); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "CardCageNumber", PldInfo->CardCageNumber); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Reference", PldInfo->Reference); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Rotation", PldInfo->Rotation); -    AcpiOsPrintf (ACPI_PLD_OUTPUT, "Order", PldInfo->Order); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Ejectable", PldInfo->Ejectable); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_EjectRequired", PldInfo->OspmEjectRequired); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CabinetNumber", PldInfo->CabinetNumber); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_CardCageNumber", PldInfo->CardCageNumber); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Reference", PldInfo->Reference); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Rotation", PldInfo->Rotation); +    AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_Order", PldInfo->Order);      /* Fifth 32-bit dword */      if (BufferDesc->Buffer.Length > 16)      { -        AcpiOsPrintf (ACPI_PLD_OUTPUT, "VerticalOffset", PldInfo->VerticalOffset); -        AcpiOsPrintf (ACPI_PLD_OUTPUT, "HorizontalOffset", PldInfo->HorizontalOffset); +        AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_VerticalOffset", PldInfo->VerticalOffset); +        AcpiOsPrintf (ACPI_PLD_OUTPUT, "PLD_HorizontalOffset", PldInfo->HorizontalOffset);      }      ACPI_FREE (PldInfo); diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 973e269e0944..afb0842e796d 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -79,6 +79,51 @@ AcpiDmPldBuffer (  #define ACPI_BUFFER_BYTES_PER_LINE      8 +/* Strings for ToPld */ + +static char *DmPanelList[] = +{ +    "TOP", +    "BOTTOM", +    "LEFT", +    "RIGHT", +    "FRONT", +    "BACK", +    "UNKNOWN", +    NULL +}; + +static char *DmVerticalPositionList[] = +{ +    "UPPER", +    "CENTER", +    "LOWER", +    NULL +}; + +static char *DmHorizontalPositionList[] = +{ +    "LEFT", +    "CENTER", +    "RIGHT", +    NULL +}; + +static char *DmShapeList[] = +{ +    "ROUND", +    "OVAL", +    "SQUARE", +    "VERTICALRECTANGLE", +    "HORIZONTALRECTANGLE", +    "VERTICALTRAPEZOID", +    "HORIZONTALTRAPEZOID", +    "UNKNOWN", +    "CHAMFERED", +    NULL +}; + +  /*******************************************************************************   *   * FUNCTION:    AcpiDmDisasmByteList @@ -232,8 +277,9 @@ AcpiDmByteList (          break;      case ACPI_DASM_PLD_METHOD: - +#if 0          AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount); +#endif          AcpiDmPldBuffer (Info->Level, ByteData, ByteCount);          break; @@ -434,11 +480,12 @@ AcpiDmIsUnicodeBuffer (          return (FALSE);      } -    /* For each word, 1st byte must be ascii, 2nd byte must be zero */ +    /* For each word, 1st byte must be ascii (1-0x7F), 2nd byte must be zero */      for (i = 0; i < (ByteCount - 2); i += 2)      { -        if ((!ACPI_IS_PRINT (ByteData[i])) || +        if ((ByteData[i] == 0) || +            (ByteData[i] > 0x7F) ||              (ByteData[(ACPI_SIZE) i + 1] != 0))          {              return (FALSE); @@ -534,9 +581,14 @@ AcpiDmIsPldBuffer (      ACPI_PARSE_OBJECT       *Op)  {      ACPI_NAMESPACE_NODE     *Node; +    ACPI_PARSE_OBJECT       *SizeOp;      ACPI_PARSE_OBJECT       *ParentOp; +    /* Buffer size is the buffer argument */ + +    SizeOp = Op->Common.Value.Arg; +      ParentOp = Op->Common.Parent;      if (!ParentOp)      { @@ -551,6 +603,9 @@ AcpiDmIsPldBuffer (          if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))          { +            /* Ignore the Size argument in the disassembly of this buffer op */ + +            SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;              return (TRUE);          } @@ -573,6 +628,9 @@ AcpiDmIsPldBuffer (              if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))              { +                /* Ignore the Size argument in the disassembly of this buffer op */ + +                SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;                  return (TRUE);              }          } @@ -584,6 +642,51 @@ AcpiDmIsPldBuffer (  /*******************************************************************************   * + * FUNCTION:    AcpiDmFindNameByIndex + * + * PARAMETERS:  Index               - Index of array to check + *              List                - Array to reference + * + * RETURN:      String from List or empty string + * + * DESCRIPTION: Finds and returns the char string located at the given index + *              position in List. + * + ******************************************************************************/ + +static char * +AcpiDmFindNameByIndex ( +    UINT64                  Index, +    char                    **List) +{ +    char                     *Str; +    UINT32                   i; + + +    /* Bounds check */ + +    Str = List[0]; +    i = 0; + +    while(Str) +    { +        i++; +        Str = List[i]; +    } + +    if (Index >= i) +    { +        /* TBD: Add error msg */ + +        return (""); +    } + +    return (List[Index]); +} + + +/******************************************************************************* + *   * FUNCTION:    AcpiDmPldBuffer   *   * PARAMETERS:  Level               - Current source code indentation level @@ -596,9 +699,12 @@ AcpiDmIsPldBuffer (   *   ******************************************************************************/ -#define ACPI_PLD_OUTPUT08     "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " " -#define ACPI_PLD_OUTPUT16   "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " " -#define ACPI_PLD_OUTPUT24   "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT08   "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT08P  "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT16   "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT16P  "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUT24   "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " " +#define ACPI_PLD_OUTPUTSTR  "%*.s%-18s = \"%s\",\n", ACPI_MUL_4 (Level), " "  static void  AcpiDmPldBuffer ( @@ -625,47 +731,63 @@ AcpiDmPldBuffer (          return;      } +    AcpiOsPrintf ("\n"); +      /* First 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Revision", PldInfo->Revision); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "IgnoreColor", PldInfo->IgnoreColor); -    AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Revision", PldInfo->Revision); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_IgnoreColor", PldInfo->IgnoreColor); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Red", PldInfo->Red); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Green", PldInfo->Green); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Blue", PldInfo->Blue);      /* Second 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width); -    AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height); +    AcpiOsPrintf (ACPI_PLD_OUTPUT16,  "PLD_Width", PldInfo->Width); +    AcpiOsPrintf (ACPI_PLD_OUTPUT16,  "PLD_Height", PldInfo->Height);      /* Third 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "UserVisible", PldInfo->UserVisible); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Dock", PldInfo->Dock); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Lid", PldInfo->Lid); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Panel", PldInfo->Panel); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "VerticalPosition", PldInfo->VerticalPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "HorizontalPosition", PldInfo->HorizontalPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Shape", PldInfo->Shape); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupOrientation", PldInfo->GroupOrientation); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupToken", PldInfo->GroupToken); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "GroupPosition", PldInfo->GroupPosition); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Bay", PldInfo->Bay); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_UserVisible", PldInfo->UserVisible); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Dock", PldInfo->Dock); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Lid", PldInfo->Lid); +    AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel", +        AcpiDmFindNameByIndex(PldInfo->Panel, DmPanelList)); +    AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition", +        AcpiDmFindNameByIndex(PldInfo->VerticalPosition, DmVerticalPositionList)); +    AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition", +        AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, DmHorizontalPositionList)); +    AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape", +        AcpiDmFindNameByIndex(PldInfo->Shape, DmShapeList)); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_GroupOrientation", PldInfo->GroupOrientation); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_GroupToken", PldInfo->GroupToken); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_GroupPosition", PldInfo->GroupPosition); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Bay", PldInfo->Bay);      /* Fourth 32-bit dword */ -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Ejectable", PldInfo->Ejectable); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "OspmEjectRequired", PldInfo->OspmEjectRequired); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "CabinetNumber", PldInfo->CabinetNumber); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "CardCageNumber", PldInfo->CardCageNumber); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Reference", PldInfo->Reference); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Rotation", PldInfo->Rotation); -    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "Order", PldInfo->Order); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Ejectable", PldInfo->Ejectable); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_EjectRequired", PldInfo->OspmEjectRequired); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_CabinetNumber", PldInfo->CabinetNumber); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_CardCageNumber", PldInfo->CardCageNumber); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Reference", PldInfo->Reference); +    AcpiOsPrintf (ACPI_PLD_OUTPUT08,  "PLD_Rotation", PldInfo->Rotation); + +    if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE) +    { +        AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order); +    } +    else +    { +        AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order); +    }      /* Fifth 32-bit dword */      if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE)      { -        AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset); -        AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset); +        AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset); +        AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset);      }      ACPI_FREE (PldInfo); @@ -692,6 +814,7 @@ AcpiDmUnicode (      UINT16                  *WordData;      UINT32                  WordCount;      UINT32                  i; +    int                     OutputValue;      /* Extract the buffer info as a WORD buffer */ @@ -704,7 +827,23 @@ AcpiDmUnicode (      AcpiOsPrintf ("\"");      for (i = 0; i < (WordCount - 1); i++)      { -        AcpiOsPrintf ("%c", (int) WordData[i]); +        OutputValue = (int) WordData[i]; + +        /* Handle values that must be escaped */ + +        if ((OutputValue == '\"') || +            (OutputValue == '\\')) +        { +            AcpiOsPrintf ("\\%c", OutputValue); +        } +        else if (!ACPI_IS_PRINT (OutputValue)) +        { +            AcpiOsPrintf ("\\x%2.2X", OutputValue); +        } +        else +        { +            AcpiOsPrintf ("%c", OutputValue); +        }      }      AcpiOsPrintf ("\")"); diff --git a/source/components/disassembler/dmcstyle.c b/source/components/disassembler/dmcstyle.c new file mode 100644 index 000000000000..4db1b96cef73 --- /dev/null +++ b/source/components/disassembler/dmcstyle.c @@ -0,0 +1,773 @@ +/******************************************************************************* + * + * Module Name: dmcstyle - Support for C-style operator disassembly + * + ******************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdisasm.h" +#include "acdebug.h" + +#ifdef ACPI_DISASSEMBLER + +#define _COMPONENT          ACPI_CA_DEBUGGER +        ACPI_MODULE_NAME    ("dmcstyle") + + +/* Local prototypes */ + +static char * +AcpiDmGetCompoundSymbol ( +   UINT16                   AslOpcode); + +static void +AcpiDmPromoteTarget ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *Target); + +static BOOLEAN +AcpiDmIsValidTarget ( +    ACPI_PARSE_OBJECT       *Op); + +static BOOLEAN +AcpiDmIsTargetAnOperand ( +    ACPI_PARSE_OBJECT       *Target, +    ACPI_PARSE_OBJECT       *Operand, +    BOOLEAN                 TopLevel); + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmCheckForSymbolicOpcode + * + * PARAMETERS:  Op                  - Current parse object + *              Walk                - Current parse tree walk info + * + * RETURN:      TRUE if opcode can be converted to symbolic, FALSE otherwise + * + * DESCRIPTION: This is the main code that implements disassembly of AML code + *              to C-style operators. Called during descending phase of the + *              parse tree walk. + * + ******************************************************************************/ + +BOOLEAN +AcpiDmCheckForSymbolicOpcode ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_OP_WALK_INFO       *Info) +{ +    char                    *OperatorSymbol = NULL; +    ACPI_PARSE_OBJECT       *Child1; +    ACPI_PARSE_OBJECT       *Child2; +    ACPI_PARSE_OBJECT       *Target; + + +    /* Exit immediately if ASL+ not enabled */ + +    if (!AcpiGbl_CstyleDisassembly) +    { +        return (FALSE); +    } + +    /* Get the first operand */ + +    Child1 = AcpiPsGetArg (Op, 0); +    if (!Child1) +    { +        return (FALSE); +    } + +    /* Get the second operand */ + +    Child2 = Child1->Common.Next; + +    /* Setup the operator string for this opcode */ + +    switch (Op->Common.AmlOpcode) +    { +    case AML_ADD_OP: +        OperatorSymbol = " + "; +        break; + +    case AML_SUBTRACT_OP: +        OperatorSymbol = " - "; +        break; + +    case AML_MULTIPLY_OP: +        OperatorSymbol = " * "; +        break; + +    case AML_DIVIDE_OP: +        OperatorSymbol = " / "; +        break; + +    case AML_MOD_OP: +        OperatorSymbol = " % "; +        break; + +    case AML_SHIFT_LEFT_OP: +        OperatorSymbol = " << "; +        break; + +    case AML_SHIFT_RIGHT_OP: +        OperatorSymbol = " >> "; +        break; + +    case AML_BIT_AND_OP: +        OperatorSymbol = " & "; +        break; + +    case AML_BIT_OR_OP: +        OperatorSymbol = " | "; +        break; + +    case AML_BIT_XOR_OP: +        OperatorSymbol = " ^ "; +        break; + +    /* Logical operators, no target */ + +    case AML_LAND_OP: +        OperatorSymbol = " && "; +        break; + +    case AML_LEQUAL_OP: +        OperatorSymbol = " == "; +        break; + +    case AML_LGREATER_OP: +        OperatorSymbol = " > "; +        break; + +    case AML_LLESS_OP: +        OperatorSymbol = " < "; +        break; + +    case AML_LOR_OP: +        OperatorSymbol = " || "; +        break; + +    case AML_LNOT_OP: +        /* +         * Check for the LNOT sub-opcodes. These correspond to +         * LNotEqual, LLessEqual, and LGreaterEqual. There are +         * no actual AML opcodes for these operators. +         */ +        switch (Child1->Common.AmlOpcode) +        { +        case AML_LEQUAL_OP: +            OperatorSymbol = " != "; +            break; + +        case AML_LGREATER_OP: +            OperatorSymbol = " <= "; +            break; + +        case AML_LLESS_OP: +            OperatorSymbol = " >= "; +            break; + +        default: + +            /* Unary LNOT case, emit "!" immediately */ + +            AcpiOsPrintf ("!"); +            return (TRUE); +        } + +        Child1->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX; +        Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX; + +        /* Save symbol string in the next child (not peer) */ + +        Child2 = AcpiPsGetArg (Child1, 0); +        if (!Child2) +        { +            return (FALSE); +        } + +        Child2->Common.OperatorSymbol = OperatorSymbol; +        return (TRUE); + +#ifdef INDEX_SUPPORT +    case AML_INDEX_OP: +        Child1->Common.OperatorSymbol = " ["; +        Child2->Common.OperatorSymbol = "]"; +        break; +#endif + +    /* Unary operators */ + +    case AML_DECREMENT_OP: +        OperatorSymbol = "--"; +        break; + +    case AML_INCREMENT_OP: +        OperatorSymbol = "++"; +        break; + +    case AML_BIT_NOT_OP: +    case AML_STORE_OP: +        OperatorSymbol = NULL; +        break; + +    default: +        return (FALSE); +    } + +    if (Child1->Common.DisasmOpcode == ACPI_DASM_LNOT_SUFFIX) +    { +        return (TRUE); +    } + +    /* +     * This is the key to how the disassembly of the C-style operators +     * works. We save the operator symbol in the first child, thus +     * deferring symbol output until after the first operand has been +     * emitted. +     */ +    if (!Child1->Common.OperatorSymbol) +    { +        Child1->Common.OperatorSymbol = OperatorSymbol; +    } + +    /* +     * Check for a valid target as the 3rd (or sometimes 2nd) operand +     * +     * Compound assignment operator support: +     * Attempt to optimize constructs of the form: +     *      Add (Local1, 0xFF, Local1) +     * to: +     *      Local1 += 0xFF +     * +     * Only the math operators and Store() have a target. +     * Logicals have no target. +     */ +    switch (Op->Common.AmlOpcode) +    { +    case AML_ADD_OP: +    case AML_SUBTRACT_OP: +    case AML_MULTIPLY_OP: +    case AML_DIVIDE_OP: +    case AML_MOD_OP: +    case AML_SHIFT_LEFT_OP: +    case AML_SHIFT_RIGHT_OP: +    case AML_BIT_AND_OP: +    case AML_BIT_OR_OP: +    case AML_BIT_XOR_OP: + +        /* Target is 3rd operand */ + +        Target = Child2->Common.Next; +        if (Op->Common.AmlOpcode == AML_DIVIDE_OP) +        { +            /* +             * Divide has an extra target operand (Remainder). +             * If this extra target is specified, it cannot be converted +             * to a C-style operator +             */ +            if (AcpiDmIsValidTarget (Target)) +            { +                Child1->Common.OperatorSymbol = NULL; +                return (FALSE); +            } + +            Target->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; +            Target = Target->Common.Next; +        } + +        /* Parser should ensure there is at least a placeholder target */ + +        if (!Target) +        { +            return (FALSE); +        } + +        if (!AcpiDmIsValidTarget (Target)) +        { +            /* Not a valid target (placeholder only, from parser) */ +            break; +        } + +        /* +         * Promote the target up to the first child in the parse +         * tree. This is done because the target will be output +         * first, in the form: +         *     <Target> = Operands... +         */ +        AcpiDmPromoteTarget (Op, Target); + +        /* +         * Check for possible conversion to a "Compound Assignment". +         * +         * Determine if either operand is the same as the target +         * and display compound assignment operator and other operand. +         */ +        if ((AcpiDmIsTargetAnOperand (Target, Child1, TRUE)) || +            (AcpiDmIsTargetAnOperand (Target, Child2, TRUE))) +        { +            Target->Common.OperatorSymbol = +                AcpiDmGetCompoundSymbol (Op->Common.AmlOpcode); + +            /* Convert operator to compound assignment */ + +            Op->Common.DisasmFlags |= ACPI_PARSEOP_COMPOUND; +            Child1->Common.OperatorSymbol = NULL; +            return (TRUE); +        } + +        /* +         * If we are within a C-style expression, emit an extra open +         * paren. Implemented by examining the parent op. +         */ +        switch (Op->Common.Parent->Common.AmlOpcode) +        { +        case AML_ADD_OP: +        case AML_SUBTRACT_OP: +        case AML_MULTIPLY_OP: +        case AML_DIVIDE_OP: +        case AML_MOD_OP: +        case AML_SHIFT_LEFT_OP: +        case AML_SHIFT_RIGHT_OP: +        case AML_BIT_AND_OP: +        case AML_BIT_OR_OP: +        case AML_BIT_XOR_OP: +        case AML_LAND_OP: +        case AML_LEQUAL_OP: +        case AML_LGREATER_OP: +        case AML_LLESS_OP: +        case AML_LOR_OP: + +            Op->Common.DisasmFlags |= ACPI_PARSEOP_ASSIGNMENT; +            AcpiOsPrintf ("("); +            break; + +        default: +            break; +        } + +        /* Normal output for ASL/AML operators with a target operand */ + +        Target->Common.OperatorSymbol = " = ("; +        return (TRUE); + +    /* Binary operators, no parens */ + +    case AML_DECREMENT_OP: +    case AML_INCREMENT_OP: +        return (TRUE); + +#ifdef INDEX_SUPPORT +    case AML_INDEX_OP: + +        /* Target is optional, 3rd operand */ + +        Target = Child2->Common.Next; +        if (AcpiDmIsValidTarget (Target)) +        { +            AcpiDmPromoteTarget (Op, Target); + +            if (!Target->Common.OperatorSymbol) +            { +                Target->Common.OperatorSymbol = " = "; +            } +        } +        return (TRUE); +#endif + +    case AML_STORE_OP: +        /* +         * Target is the 2nd operand. +         * We know the target is valid, it is not optional. +         * In the parse tree, simply swap the target with the +         * source so that the target is processed first. +         */ +        Target = Child1->Common.Next; +        AcpiDmPromoteTarget (Op, Target); + +        if (!Target->Common.OperatorSymbol) +        { +            Target->Common.OperatorSymbol = " = "; +        } +        return (TRUE); + +    case AML_BIT_NOT_OP: + +        /* Target is optional, 2nd operand */ + +        Target = Child1->Common.Next; +        if (!Target) +        { +            return (FALSE); +        } + +        if (AcpiDmIsValidTarget (Target)) +        { +            /* Valid target, not a placeholder */ + +            AcpiDmPromoteTarget (Op, Target); +            Target->Common.OperatorSymbol = " = ~"; +        } +        else +        { +            /* No target. Emit this prefix operator immediately */ + +            AcpiOsPrintf ("~"); +        } +        return (TRUE); + +    default: +        break; +    } + +    /* All other operators, emit an open paren */ + +    AcpiOsPrintf ("("); +    return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmCloseOperator + * + * PARAMETERS:  Op                  - Current parse object + * + * RETURN:      None + * + * DESCRIPTION: Closes an operator by adding a closing parentheses if and + *              when necessary. Called during ascending phase of the + *              parse tree walk. + * + ******************************************************************************/ + +void +AcpiDmCloseOperator ( +    ACPI_PARSE_OBJECT       *Op) +{ + +    /* Always emit paren if ASL+ disassembly disabled */ + +    if (!AcpiGbl_CstyleDisassembly) +    { +        AcpiOsPrintf (")"); +        return; +    } + +    /* Check if we need to add an additional closing paren */ + +    switch (Op->Common.AmlOpcode) +    { +    case AML_ADD_OP: +    case AML_SUBTRACT_OP: +    case AML_MULTIPLY_OP: +    case AML_DIVIDE_OP: +    case AML_MOD_OP: +    case AML_SHIFT_LEFT_OP: +    case AML_SHIFT_RIGHT_OP: +    case AML_BIT_AND_OP: +    case AML_BIT_OR_OP: +    case AML_BIT_XOR_OP: +    case AML_LAND_OP: +    case AML_LEQUAL_OP: +    case AML_LGREATER_OP: +    case AML_LLESS_OP: +    case AML_LOR_OP: + +        /* Emit paren only if this is not a compound assignment */ + +        if (Op->Common.DisasmFlags & ACPI_PARSEOP_COMPOUND) +        { +            return; +        } + +        /* Emit extra close paren for assignment within an expression */ + +        if (Op->Common.DisasmFlags & ACPI_PARSEOP_ASSIGNMENT) +        { +            AcpiOsPrintf (")"); +        } +        break; + + +    /* No need for parens for these */ + +#ifdef INDEX_SUPPORT +    case AML_INDEX_OP: +#endif +    case AML_DECREMENT_OP: +    case AML_INCREMENT_OP: +    case AML_LNOT_OP: +    case AML_BIT_NOT_OP: +    case AML_STORE_OP: +        return; + +    default: + +        /* Always emit paren for non-ASL+ operators */ +        break; +    } + +    AcpiOsPrintf (")"); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmGetCompoundSymbol + * + * PARAMETERS:  AslOpcode + * + * RETURN:      String containing the compound assignment symbol + * + * DESCRIPTION: Detect opcodes that can be converted to compound assignment, + *              return the appropriate operator string. + * + ******************************************************************************/ + +static char * +AcpiDmGetCompoundSymbol ( +   UINT16                   AmlOpcode) +{ +    char                    *Symbol; + + +    switch (AmlOpcode) +    { +    case AML_ADD_OP: +        Symbol = " += "; +        break; + +    case AML_SUBTRACT_OP: +        Symbol = " -= "; +        break; + +    case AML_MULTIPLY_OP: +        Symbol = " *= "; +        break; + +    case AML_DIVIDE_OP: +        Symbol = " /= "; +        break; + +    case AML_MOD_OP: +        Symbol = " %= "; +        break; + +    case AML_SHIFT_LEFT_OP: +        Symbol = " <<= "; +        break; + +    case AML_SHIFT_RIGHT_OP: +        Symbol = " >>= "; +        break; + +    case AML_BIT_AND_OP: +        Symbol = " &= "; +        break; + +    case AML_BIT_OR_OP: +        Symbol = " |= "; +        break; + +    case AML_BIT_XOR_OP: +        Symbol = " ^= "; +        break; + +    default: + +        /* No operator string for all other opcodes */ +        return (NULL); +    } + +    return (Symbol); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmPromoteTarget + * + * PARAMETERS:  Op                  - Operator parse object + *              Target              - Target associate with the Op + * + * RETURN:      None + * + * DESCRIPTION: Transform the parse tree by moving the target up to the first + *              child of the Op. + * + ******************************************************************************/ + +static void +AcpiDmPromoteTarget ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_PARSE_OBJECT       *Target) +{ +    ACPI_PARSE_OBJECT       *Child; + + +    /* Link target directly to the Op as first child */ + +    Child = Op->Common.Value.Arg; +    Op->Common.Value.Arg = Target; +    Target->Common.Next = Child; + +    /* Find the last peer, it is linked to the target. Unlink it. */ + +    while (Child->Common.Next != Target) +    { +        Child = Child->Common.Next; +    } + +    Child->Common.Next = NULL; +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmIsValidTarget + * + * PARAMETERS:  Target              - Target Op from the parse tree + * + * RETURN:      TRUE if the Target is real. FALSE if it is just a placeholder + *              Op that was inserted by the parser. + * + * DESCRIPTION: Determine if a Target Op is a placeholder Op or a real Target. + *              In other words, determine if the optional target is used or + *              not. + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsValidTarget ( +    ACPI_PARSE_OBJECT       *Target) +{ + +    if ((Target->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && +        (Target->Common.Value.Arg == NULL)) +    { +        return (FALSE); +    } + +    return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION:    AcpiDmIsTargetAnOperand + * + * PARAMETERS:  Target              - Target associated with the expression + *              Operand             - An operand associated with expression + * + * RETURN:      TRUE if expression can be converted to a compound assignment. + *              FALSE otherwise. + * + * DESCRIPTION: Determine if the Target duplicates the operand, in order to + *              detect if the expression can be converted to a compound + *              assigment. (+=, *=, etc.) + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsTargetAnOperand ( +    ACPI_PARSE_OBJECT       *Target, +    ACPI_PARSE_OBJECT       *Operand, +    BOOLEAN                 TopLevel) +{ +    const ACPI_OPCODE_INFO  *OpInfo; +    BOOLEAN                 Same; + + +    /* +     * Opcodes must match. Note: ignoring the difference between nameseg +     * and namepath for now. May be needed later. +     */ +    if (Target->Common.AmlOpcode != Operand->Common.AmlOpcode) +    { +        return (FALSE); +    } + +    /* Nodes should match, even if they are NULL */ + +    if (Target->Common.Node != Operand->Common.Node) +    { +        return (FALSE); +    } + +    /* Determine if a child exists */ + +    OpInfo = AcpiPsGetOpcodeInfo (Operand->Common.AmlOpcode); +    if (OpInfo->Flags & AML_HAS_ARGS) +    { +        Same = AcpiDmIsTargetAnOperand (Target->Common.Value.Arg, +            Operand->Common.Value.Arg, FALSE); +        if (!Same) +        { +            return (FALSE); +        } +    } + +    /* Check the next peer, as long as we are not at the top level */ + +    if ((!TopLevel) && +         Target->Common.Next) +    { +        Same = AcpiDmIsTargetAnOperand (Target->Common.Next, +            Operand->Common.Next, FALSE); +        if (!Same) +        { +            return (FALSE); +        } +    } + +    /* Supress the duplicate operand at the top-level */ + +    if (TopLevel) +    { +        Operand->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; +    } +    return (TRUE); +} + +#endif diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index e3d9e6918e4c..e356e389927e 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -54,6 +54,7 @@  #define _COMPONENT          ACPI_CA_DEBUGGER          ACPI_MODULE_NAME    ("dmopcode") +  /* Local prototypes */  static void @@ -567,7 +568,6 @@ AcpiDmRegionFlags (      ACPI_PARSE_OBJECT       *Op)  { -      /* The next Op contains the SpaceId */      Op = AcpiPsGetDepthNext (NULL, Op); @@ -637,7 +637,6 @@ AcpiDmMatchKeyword (      ACPI_PARSE_OBJECT       *Op)  { -      if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)      {          AcpiOsPrintf ("/* Unknown Match Keyword encoding */"); @@ -694,27 +693,27 @@ AcpiDmDisassembleOneOp (      case ACPI_DASM_LNOT_SUFFIX: -        switch (Op->Common.AmlOpcode) +        if (!AcpiGbl_CstyleDisassembly)          { -        case AML_LEQUAL_OP: - -            AcpiOsPrintf ("LNotEqual"); -            break; - -        case AML_LGREATER_OP: - -            AcpiOsPrintf ("LLessEqual"); -            break; - -        case AML_LLESS_OP: +            switch (Op->Common.AmlOpcode) +            { +            case AML_LEQUAL_OP: +                AcpiOsPrintf ("LNotEqual"); +                break; -            AcpiOsPrintf ("LGreaterEqual"); -            break; +            case AML_LGREATER_OP: +                AcpiOsPrintf ("LLessEqual"); +                break; -        default: +            case AML_LLESS_OP: +                AcpiOsPrintf ("LGreaterEqual"); +                break; -            break; +            default: +                break; +            }          } +          Op->Common.DisasmOpcode = 0;          Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;          return; @@ -723,7 +722,6 @@ AcpiDmDisassembleOneOp (          break;      } -      OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);      /* The op and arguments */ @@ -845,7 +843,7 @@ AcpiDmDisassembleOneOp (          else if (AcpiDmIsPldBuffer (Op))          {              Op->Common.DisasmOpcode = ACPI_DASM_PLD_METHOD; -            AcpiOsPrintf ("Buffer"); +            AcpiOsPrintf ("ToPLD (");          }          else          { diff --git a/source/components/disassembler/dmutils.c b/source/components/disassembler/dmutils.c index 700cfecc3092..c075b6904100 100644 --- a/source/components/disassembler/dmutils.c +++ b/source/components/disassembler/dmutils.c @@ -256,6 +256,13 @@ AcpiDmCommaIfListMember (      if (AcpiDmListType (Op->Common.Parent) & BLOCK_COMMA_LIST)      { +        /* Exit if Target has been marked IGNORE */ + +        if (Op->Common.Next->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) +        { +            return (FALSE); +        } +          /* Check for a NULL target operand */          if ((Op->Common.Next->Common.AmlOpcode == AML_INT_NAMEPATH_OP) && @@ -279,7 +286,13 @@ AcpiDmCommaIfListMember (              return (FALSE);          } -        AcpiOsPrintf (", "); +        /* Emit comma only if this is not a C-style operator */ + +        if (!Op->Common.OperatorSymbol) +        { +            AcpiOsPrintf (", "); +        } +          return (TRUE);      } diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 92f27e506224..823ce1856b12 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -285,7 +285,8 @@ AcpiDmBlockType (      case AML_BUFFER_OP:          if ((Op->Common.DisasmOpcode == ACPI_DASM_UNICODE) || -            (Op->Common.DisasmOpcode == ACPI_DASM_UUID)) +            (Op->Common.DisasmOpcode == ACPI_DASM_UUID) || +            (Op->Common.DisasmOpcode == ACPI_DASM_PLD_METHOD))          {              return (BLOCK_NONE);          } @@ -301,6 +302,17 @@ AcpiDmBlockType (          return (BLOCK_PAREN); +    case AML_INT_METHODCALL_OP: + +        if (Op->Common.Parent && +            ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) || +             (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))) +        { +            /* This is a reference to a method, not an invocation */ + +            return (BLOCK_NONE); +        } +      default:          OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); @@ -477,13 +489,20 @@ AcpiDmDescendingOp (       * keep track of the current column.       */      Info->Count++; -    if (Info->Count /* +Info->LastLevel */ > 10) +    if (Info->Count /* +Info->LastLevel */ > 12)      {          Info->Count = 0;          AcpiOsPrintf ("\n");          AcpiDmIndent (Info->LastLevel + 1);      } +    /* If ASL+ is enabled, check for a C-style operator */ + +    if (AcpiDmCheckForSymbolicOpcode (Op, Info)) +    { +        return (AE_OK); +    } +      /* Print the opcode name */      AcpiDmDisassembleOneOp (NULL, Info, Op); @@ -563,7 +582,6 @@ AcpiDmDescendingOp (                  AcpiDmPredefinedDescription (Op);                  break; -              case AML_NAME_OP:                  /* Check for _HID and related EISAID() */ @@ -572,13 +590,11 @@ AcpiDmDescendingOp (                  AcpiOsPrintf (", ");                  break; -              case AML_REGION_OP:                  AcpiDmRegionFlags (Op);                  break; -              case AML_POWER_RES_OP:                  /* Mark the next two Ops as part of the parameter list */ @@ -591,7 +607,6 @@ AcpiDmDescendingOp (                  NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;                  return (AE_OK); -              case AML_PROCESSOR_OP:                  /* Mark the next three Ops as part of the parameter list */ @@ -607,20 +622,17 @@ AcpiDmDescendingOp (                  NextOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMLIST;                  return (AE_OK); -              case AML_MUTEX_OP:              case AML_DATA_REGION_OP:                  AcpiOsPrintf (", ");                  return (AE_OK); -              case AML_EVENT_OP:              case AML_ALIAS_OP:                  return (AE_OK); -              case AML_SCOPE_OP:              case AML_DEVICE_OP:              case AML_THERMAL_ZONE_OP: @@ -628,7 +640,6 @@ AcpiDmDescendingOp (                  AcpiOsPrintf (")");                  break; -              default:                  AcpiOsPrintf ("*** Unhandled named opcode %X\n", @@ -825,9 +836,9 @@ AcpiDmAscendingOp (      {      case BLOCK_PAREN: -        /* Completed an op that has arguments, add closing paren */ +        /* Completed an op that has arguments, add closing paren if needed */ -        AcpiOsPrintf (")"); +        AcpiDmCloseOperator (Op);          if (Op->Common.AmlOpcode == AML_NAME_OP)          { @@ -999,8 +1010,21 @@ AcpiDmAscendingOp (      {          Info->Level++;      } + +    /* +     * For ASL+, check for and emit a C-style symbol. If valid, the +     * symbol string has been deferred until after the first operand +     */ +    if (AcpiGbl_CstyleDisassembly) +    { +        if (Op->Asl.OperatorSymbol) +        { +            AcpiOsPrintf ("%s", Op->Asl.OperatorSymbol); +            Op->Asl.OperatorSymbol = NULL; +        } +    } +      return (AE_OK);  } -  #endif  /* ACPI_DISASSEMBLER */ diff --git a/source/components/dispatcher/dsargs.c b/source/components/dispatcher/dsargs.c index 4c9875e78d90..8595402faa0a 100644 --- a/source/components/dispatcher/dsargs.c +++ b/source/components/dispatcher/dsargs.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSARGS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dscontrol.c b/source/components/dispatcher/dscontrol.c index 0b48c46f1236..2d943ba313dc 100644 --- a/source/components/dispatcher/dscontrol.c +++ b/source/components/dispatcher/dscontrol.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSCONTROL_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index a0671166e5c5..93796e625844 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSFIELD_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/dispatcher/dsinit.c b/source/components/dispatcher/dsinit.c index 3e7977d72c27..9546b0977673 100644 --- a/source/components/dispatcher/dsinit.c +++ b/source/components/dispatcher/dsinit.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSINIT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index 8d1845b61aef..6ae1b316ffe7 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSMETHOD_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/dispatcher/dsmthdat.c b/source/components/dispatcher/dsmthdat.c index e1c45ced99f7..d8021cfee350 100644 --- a/source/components/dispatcher/dsmthdat.c +++ b/source/components/dispatcher/dsmthdat.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSMTHDAT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/dispatcher/dsobject.c b/source/components/dispatcher/dsobject.c index 56cd22ea8987..b74b068b3750 100644 --- a/source/components/dispatcher/dsobject.c +++ b/source/components/dispatcher/dsobject.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSOBJECT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index 0f53283dacbc..b66617253cd5 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSOPCODE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 11803663e80c..d1d2545b1abc 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSUTILS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 5d8276fa9011..5ce55a8b97df 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSWEXEC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index 0cafecd65c69..0495624f4164 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSWLOAD_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index a3490f0a9e99..a25166182955 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSWLOAD2_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/dispatcher/dswscope.c b/source/components/dispatcher/dswscope.c index 87156918e333..b6defded2a39 100644 --- a/source/components/dispatcher/dswscope.c +++ b/source/components/dispatcher/dswscope.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSWSCOPE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/dispatcher/dswstate.c b/source/components/dispatcher/dswstate.c index 389a7d068996..7c53f61d515d 100644 --- a/source/components/dispatcher/dswstate.c +++ b/source/components/dispatcher/dswstate.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __DSWSTATE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/events/evhandler.c b/source/components/events/evhandler.c index 0fd1cba30de3..b5138e9f29d5 100644 --- a/source/components/events/evhandler.c +++ b/source/components/events/evhandler.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVHANDLER_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acevents.h" diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 2acafab9aba0..14ac452b0108 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVREGION_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acevents.h" diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c index cd0ca2eea5f0..78c8868b35f8 100644 --- a/source/components/events/evrgnini.c +++ b/source/components/events/evrgnini.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVRGNINI_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acevents.h" diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index 327fd9b605f6..4e25f615b5cf 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVXFACE_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index 3a3cf842077f..e007541dbc89 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVXFEVNT_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index 79e888ff8053..56f54f347418 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVXFGPE_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/events/evxfregn.c b/source/components/events/evxfregn.c index 6b38b7ef8e5f..3a44b3fe55d0 100644 --- a/source/components/events/evxfregn.c +++ b/source/components/events/evxfregn.c @@ -42,7 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EVXFREGN_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index b5adb96700e1..19230a2bc994 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXCONFIG_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exconvrt.c b/source/components/executer/exconvrt.c index 9803cb6a0528..355d726286a7 100644 --- a/source/components/executer/exconvrt.c +++ b/source/components/executer/exconvrt.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXCONVRT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/excreate.c b/source/components/executer/excreate.c index 43168ba46c72..cb8d50de9dd5 100644 --- a/source/components/executer/excreate.c +++ b/source/components/executer/excreate.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXCREATE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index 5b13d19dca4f..c3ee4b1e523c 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXDEBUG_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index 6e7de67bf880..48591531c418 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXDUMP_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exfield.c b/source/components/executer/exfield.c index 65520b651ca4..64cfc71d618f 100644 --- a/source/components/executer/exfield.c +++ b/source/components/executer/exfield.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXFIELD_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/executer/exfldio.c b/source/components/executer/exfldio.c index e35559fffa5e..2387e17cf5b6 100644 --- a/source/components/executer/exfldio.c +++ b/source/components/executer/exfldio.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXFLDIO_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exmisc.c b/source/components/executer/exmisc.c index bca0594e53da..bdca576176bf 100644 --- a/source/components/executer/exmisc.c +++ b/source/components/executer/exmisc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXMISC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exmutex.c b/source/components/executer/exmutex.c index c3eb25f36013..b0bca555b790 100644 --- a/source/components/executer/exmutex.c +++ b/source/components/executer/exmutex.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXMUTEX_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exnames.c b/source/components/executer/exnames.c index 70c0a6d94f43..0b6db43893d7 100644 --- a/source/components/executer/exnames.c +++ b/source/components/executer/exnames.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXNAMES_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c index 3c38740e6924..3b6e94c0766c 100644 --- a/source/components/executer/exoparg1.c +++ b/source/components/executer/exoparg1.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXOPARG1_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/executer/exoparg2.c b/source/components/executer/exoparg2.c index f3e976ce536f..eea4d8ec55d6 100644 --- a/source/components/executer/exoparg2.c +++ b/source/components/executer/exoparg2.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXOPARG2_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/executer/exoparg3.c b/source/components/executer/exoparg3.c index 0168d721f5d3..5a6045ea0f19 100644 --- a/source/components/executer/exoparg3.c +++ b/source/components/executer/exoparg3.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXOPARG3_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exoparg6.c b/source/components/executer/exoparg6.c index 148db36fb7f7..f560e73ae3cc 100644 --- a/source/components/executer/exoparg6.c +++ b/source/components/executer/exoparg6.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXOPARG6_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exprep.c b/source/components/executer/exprep.c index 89dcd041cf9c..a157208f7570 100644 --- a/source/components/executer/exprep.c +++ b/source/components/executer/exprep.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXPREP_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exregion.c b/source/components/executer/exregion.c index 7532630a232a..fe9df6ed8c68 100644 --- a/source/components/executer/exregion.c +++ b/source/components/executer/exregion.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXREGION_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exresnte.c b/source/components/executer/exresnte.c index 82f5dc3f8a21..0589dd65198c 100644 --- a/source/components/executer/exresnte.c +++ b/source/components/executer/exresnte.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXRESNTE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/executer/exresolv.c b/source/components/executer/exresolv.c index 0ce9da81d288..287b6f68c1fa 100644 --- a/source/components/executer/exresolv.c +++ b/source/components/executer/exresolv.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXRESOLV_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/executer/exresop.c b/source/components/executer/exresop.c index 01057c08b398..801292163fe0 100644 --- a/source/components/executer/exresop.c +++ b/source/components/executer/exresop.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXRESOP_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c index 27b49d1126ac..4c6554927b0c 100644 --- a/source/components/executer/exstore.c +++ b/source/components/executer/exstore.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXSTORE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdispat.h" diff --git a/source/components/executer/exstoren.c b/source/components/executer/exstoren.c index df8f5fded2b9..bc7a3c9c79b9 100644 --- a/source/components/executer/exstoren.c +++ b/source/components/executer/exstoren.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXSTOREN_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exstorob.c b/source/components/executer/exstorob.c index 30304e37e9fb..036d0c096418 100644 --- a/source/components/executer/exstorob.c +++ b/source/components/executer/exstorob.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXSTOROB_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exsystem.c b/source/components/executer/exsystem.c index 09a470ecedb8..5e7ec092a74f 100644 --- a/source/components/executer/exsystem.c +++ b/source/components/executer/exsystem.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXSYSTEM_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/executer/exutils.c b/source/components/executer/exutils.c index dcc889d221b8..0c00884ae931 100644 --- a/source/components/executer/exutils.c +++ b/source/components/executer/exutils.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXUTILS_C__ -  /*   * DEFINE_AML_GLOBALS is tested in amlcode.h   * to determine whether certain global names should be "defined" or only diff --git a/source/components/hardware/hwacpi.c b/source/components/hardware/hwacpi.c index feedc15c095d..7e0a5042aba6 100644 --- a/source/components/hardware/hwacpi.c +++ b/source/components/hardware/hwacpi.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __HWACPI_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/hardware/hwpci.c b/source/components/hardware/hwpci.c index 86017ed4d47a..34720c17e73a 100644 --- a/source/components/hardware/hwpci.c +++ b/source/components/hardware/hwpci.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __HWPCI_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c index 94c508a84ce1..b22775f75fb4 100644 --- a/source/components/hardware/hwregs.c +++ b/source/components/hardware/hwregs.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __HWREGS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acevents.h" diff --git a/source/components/hardware/hwvalid.c b/source/components/hardware/hwvalid.c index c644076ad208..f630654fba79 100644 --- a/source/components/hardware/hwvalid.c +++ b/source/components/hardware/hwvalid.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __HWVALID_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 6c04c7a90324..bc030878daa1 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSACCESS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index d465a37e5b8b..5391753c734f 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSALLOC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsconvert.c b/source/components/namespace/nsconvert.c index 4c8b12db1dd3..5403f66f9125 100644 --- a/source/components/namespace/nsconvert.c +++ b/source/components/namespace/nsconvert.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSCONVERT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c index 2801adccfbac..e664c2d8fe33 100644 --- a/source/components/namespace/nsdump.c +++ b/source/components/namespace/nsdump.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSDUMP_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c index fe4bdad43795..f7d6408ac534 100644 --- a/source/components/namespace/nsdumpdv.c +++ b/source/components/namespace/nsdumpdv.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSDUMPDV_C__ -  #include "acpi.h" diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c index 8324dba2a86b..06550ac8b6e5 100644 --- a/source/components/namespace/nseval.c +++ b/source/components/namespace/nseval.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSEVAL_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/namespace/nsinit.c b/source/components/namespace/nsinit.c index 53155977f39f..150bcc0f3290 100644 --- a/source/components/namespace/nsinit.c +++ b/source/components/namespace/nsinit.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSXFINIT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c index e769c2013ebf..a590c94bacf4 100644 --- a/source/components/namespace/nsload.c +++ b/source/components/namespace/nsload.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSLOAD_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index e22f961c1984..e7e68b021ba4 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSNAMES_C__ -  #include "acpi.h"  #include "accommon.h"  #include "amlcode.h" diff --git a/source/components/namespace/nsobject.c b/source/components/namespace/nsobject.c index 5247ca61b41b..74628b9cc847 100644 --- a/source/components/namespace/nsobject.c +++ b/source/components/namespace/nsobject.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSOBJECT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c index c5c7e0233dbf..9c2845dda681 100644 --- a/source/components/namespace/nsparse.c +++ b/source/components/namespace/nsparse.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSPARSE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsrepair.c b/source/components/namespace/nsrepair.c index 3b659a91c7a2..59e170497e9d 100644 --- a/source/components/namespace/nsrepair.c +++ b/source/components/namespace/nsrepair.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSREPAIR_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index cb6ce06c690e..7dd9649a7df8 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSREPAIR2_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nssearch.c b/source/components/namespace/nssearch.c index e8ac74bad2e0..711fda38c6d0 100644 --- a/source/components/namespace/nssearch.c +++ b/source/components/namespace/nssearch.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSSEARCH_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 54d1a18967f9..a5aff616ee54 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -42,8 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSUTILS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nswalk.c b/source/components/namespace/nswalk.c index 147e4ce816c7..1db8355cf141 100644 --- a/source/components/namespace/nswalk.c +++ b/source/components/namespace/nswalk.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSWALK_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 2b2663cabb56..907af2894afe 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -42,7 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSXFEVAL_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c index 48e2fa8fd4e9..9d06fe6d5541 100644 --- a/source/components/namespace/nsxfname.c +++ b/source/components/namespace/nsxfname.c @@ -42,7 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSXFNAME_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c index 69b656e12620..aa7a60417fbb 100644 --- a/source/components/namespace/nsxfobj.c +++ b/source/components/namespace/nsxfobj.c @@ -42,7 +42,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __NSXFOBJ_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c index c1bc15a6818e..17e99fa85492 100644 --- a/source/components/parser/psargs.c +++ b/source/components/parser/psargs.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __PSARGS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/parser/pstree.c b/source/components/parser/pstree.c index 746d5759f53b..f53a0a0ad567 100644 --- a/source/components/parser/pstree.c +++ b/source/components/parser/pstree.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __PSTREE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/parser/psxface.c b/source/components/parser/psxface.c index 2068a86a172a..6e0502d858fc 100644 --- a/source/components/parser/psxface.c +++ b/source/components/parser/psxface.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __PSXFACE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acparser.h" diff --git a/source/components/resources/rsaddr.c b/source/components/resources/rsaddr.c index 690196240aee..f80a4adf29db 100644 --- a/source/components/resources/rsaddr.c +++ b/source/components/resources/rsaddr.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSADDR_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 0e9862dcf330..9bcd46f27f1b 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSCALC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index bac2f88f57f4..dd40ea33e8af 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSCREATE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index b83d05849afc..9a5d41c8f27f 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSDUMP_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index 906544ad86b8..405a89b97acd 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSDUMPINFO_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsinfo.c b/source/components/resources/rsinfo.c index 25fab81b014f..b0c4a78e08e4 100644 --- a/source/components/resources/rsinfo.c +++ b/source/components/resources/rsinfo.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSINFO_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsio.c b/source/components/resources/rsio.c index 9a6a75e1315f..a350635d11b0 100644 --- a/source/components/resources/rsio.c +++ b/source/components/resources/rsio.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSIO_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsirq.c b/source/components/resources/rsirq.c index 33da524238b9..481a65344310 100644 --- a/source/components/resources/rsirq.c +++ b/source/components/resources/rsirq.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSIRQ_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rslist.c b/source/components/resources/rslist.c index 639f7ee9736f..2e24a6d47f3d 100644 --- a/source/components/resources/rslist.c +++ b/source/components/resources/rslist.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSLIST_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsmemory.c b/source/components/resources/rsmemory.c index 6f0b92bf0031..d1b3512206cb 100644 --- a/source/components/resources/rsmemory.c +++ b/source/components/resources/rsmemory.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSMEMORY_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index af653035acb4..d9bd73b4f57f 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSMISC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsserial.c b/source/components/resources/rsserial.c index 965c4b481fc8..08c9a07ffb9e 100644 --- a/source/components/resources/rsserial.c +++ b/source/components/resources/rsserial.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSIRQ_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index b010ea031f0c..e99fca0bee23 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSUTILS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c index 1e15f8dd848b..e3d70e2eee46 100644 --- a/source/components/resources/rsxface.c +++ b/source/components/resources/rsxface.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __RSXFACE_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c index e0c5f3ae4bb1..7ee5b00a14ad 100644 --- a/source/components/tables/tbdata.c +++ b/source/components/tables/tbdata.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBDATA_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 22c09d22bd9a..474dd4bb3f45 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBFADT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/tables/tbfind.c b/source/components/tables/tbfind.c index bbd8523e4059..12f3b265ddcc 100644 --- a/source/components/tables/tbfind.c +++ b/source/components/tables/tbfind.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBFIND_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c index 791979ccd945..10a79c3c356a 100644 --- a/source/components/tables/tbinstal.c +++ b/source/components/tables/tbinstal.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBINSTAL_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c index 431747672dcd..be5dcabf9c0c 100644 --- a/source/components/tables/tbprint.c +++ b/source/components/tables/tbprint.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBPRINT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 56fd46dfca3c..628b2b72b2c3 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBUTILS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c index 26ee44bd9ed4..870b4bbe7aa8 100644 --- a/source/components/tables/tbxface.c +++ b/source/components/tables/tbxface.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBXFACE_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c index f28aa091bfc0..bd8bafa75d0c 100644 --- a/source/components/tables/tbxfload.c +++ b/source/components/tables/tbxfload.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBXFLOAD_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/tables/tbxfroot.c b/source/components/tables/tbxfroot.c index 04500aae02fa..9b915700b2fa 100644 --- a/source/components/tables/tbxfroot.c +++ b/source/components/tables/tbxfroot.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __TBXFROOT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "actables.h" diff --git a/source/components/utilities/utaddress.c b/source/components/utilities/utaddress.c index 8de363efa136..05b011c70e57 100644 --- a/source/components/utilities/utaddress.c +++ b/source/components/utilities/utaddress.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTADDRESS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c index c6c29e996667..0a58bca7bdb4 100644 --- a/source/components/utilities/utalloc.c +++ b/source/components/utilities/utalloc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTALLOC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acdebug.h" diff --git a/source/components/utilities/utbuffer.c b/source/components/utilities/utbuffer.c index a946aabbe866..95f005a4541a 100644 --- a/source/components/utilities/utbuffer.c +++ b/source/components/utilities/utbuffer.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTBUFFER_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utcache.c b/source/components/utilities/utcache.c index 51b8bde0b45c..182868fb82c8 100644 --- a/source/components/utilities/utcache.c +++ b/source/components/utilities/utcache.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTCACHE_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utclib.c b/source/components/utilities/utclib.c index 7fbcaee9351f..9d47d3a70702 100644 --- a/source/components/utilities/utclib.c +++ b/source/components/utilities/utclib.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __CMCLIB_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c index 6ab870924a29..eae39ebfdd7f 100644 --- a/source/components/utilities/utcopy.c +++ b/source/components/utilities/utcopy.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTCOPY_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index 973d4ec66cb1..948dacc4a4dd 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTDEBUG_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index 1666a36b254f..d6964803e211 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTDECODE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 9e4c79b95ac3..bd30caccd5a3 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTDELETE_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/utilities/uterror.c b/source/components/utilities/uterror.c index e08552049d14..3f123505356f 100644 --- a/source/components/utilities/uterror.c +++ b/source/components/utilities/uterror.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTERROR_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/uteval.c b/source/components/utilities/uteval.c index afa0a267cf07..affbdd686e85 100644 --- a/source/components/utilities/uteval.c +++ b/source/components/utilities/uteval.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTEVAL_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utexcep.c b/source/components/utilities/utexcep.c index 550719cfe145..5092512a1031 100644 --- a/source/components/utilities/utexcep.c +++ b/source/components/utilities/utexcep.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTEXCEP_C__  #define EXPORT_ACPI_INTERFACES  #define ACPI_DEFINE_EXCEPTION_TABLE diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c index 3504348d4ee2..f55c15816d1d 100644 --- a/source/components/utilities/utglobal.c +++ b/source/components/utilities/utglobal.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTGLOBAL_C__  #define EXPORT_ACPI_INTERFACES  #define DEFINE_ACPI_GLOBALS diff --git a/source/components/utilities/uthex.c b/source/components/utilities/uthex.c index e71cacdbc96c..d2e147d75b41 100644 --- a/source/components/utilities/uthex.c +++ b/source/components/utilities/uthex.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTHEX_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utids.c b/source/components/utilities/utids.c index 70a27d0ad2a7..b39d676691d3 100644 --- a/source/components/utilities/utids.c +++ b/source/components/utilities/utids.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTIDS_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acinterp.h" diff --git a/source/components/utilities/utinit.c b/source/components/utilities/utinit.c index 8e11c516751a..14336d447f9a 100644 --- a/source/components/utilities/utinit.c +++ b/source/components/utilities/utinit.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTINIT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utlock.c b/source/components/utilities/utlock.c index 7ac315fe3e61..0c652627ad86 100644 --- a/source/components/utilities/utlock.c +++ b/source/components/utilities/utlock.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTLOCK_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utmath.c b/source/components/utilities/utmath.c index 51393353b173..af20e53dc57e 100644 --- a/source/components/utilities/utmath.c +++ b/source/components/utilities/utmath.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTMATH_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index de2673c6c7d3..998c0419898e 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTMISC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utmutex.c b/source/components/utilities/utmutex.c index 8fc977a63f50..586391cdce03 100644 --- a/source/components/utilities/utmutex.c +++ b/source/components/utilities/utmutex.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTMUTEX_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utobject.c b/source/components/utilities/utobject.c index 263ba59caf89..84e0546b41a4 100644 --- a/source/components/utilities/utobject.c +++ b/source/components/utilities/utobject.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTOBJECT_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c index 286fe67a6e31..93ebc73257d3 100644 --- a/source/components/utilities/utosi.c +++ b/source/components/utilities/utosi.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTOSI_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index 91943501241d..c4681d27c314 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTOWNERID_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/utpredef.c b/source/components/utilities/utpredef.c index d8442f6898ca..fd7d2fe11871 100644 --- a/source/components/utilities/utpredef.c +++ b/source/components/utilities/utpredef.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTPREDEF_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acpredef.h" diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index af077aec8215..f6fc8b90cd92 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTRESRC_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acresrc.h" @@ -300,7 +298,7 @@ const char                      *AcpiGbl_BpbDecode[] =  const char                      *AcpiGbl_SbDecode[] =  { -    "StopBitsNone", +    "StopBitsZero",      "StopBitsOne",      "StopBitsOnePlusHalf",      "StopBitsTwo" diff --git a/source/components/utilities/utstate.c b/source/components/utilities/utstate.c index 12de2731932f..bb178016f5e8 100644 --- a/source/components/utilities/utstate.c +++ b/source/components/utilities/utstate.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTSTATE_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c index 2fa7710725dc..225cf8635368 100644 --- a/source/components/utilities/utstring.c +++ b/source/components/utilities/utstring.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTSTRING_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c index ac9675846ea2..80ecc3234aec 100644 --- a/source/components/utilities/uttrack.c +++ b/source/components/utilities/uttrack.c @@ -52,8 +52,6 @@   * occurs in the body of AcpiUtFree.   */ -#define __UTTRACK_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utuuid.c b/source/components/utilities/utuuid.c index ebf03231e4f8..f97fc8ec088c 100644 --- a/source/components/utilities/utuuid.c +++ b/source/components/utilities/utuuid.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTUUID_C__ -  #include "acpi.h"  #include "accommon.h" diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index dedeab39b418..671622b5bca5 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTXFACE_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" @@ -621,7 +620,9 @@ AcpiDecodePldBuffer (      ACPI_MOVE_32_TO_32 (&Dword, &Buffer[0]);      PldInfo->Revision =             ACPI_PLD_GET_REVISION (&Dword);      PldInfo->IgnoreColor =          ACPI_PLD_GET_IGNORE_COLOR (&Dword); -    PldInfo->Color =                ACPI_PLD_GET_COLOR (&Dword); +    PldInfo->Red =                  ACPI_PLD_GET_RED (&Dword); +    PldInfo->Green =                ACPI_PLD_GET_GREEN (&Dword); +    PldInfo->Blue =                 ACPI_PLD_GET_BLUE (&Dword);      /* Second 32-bit DWord */ diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c index 48dd79c2c58c..db6535fa5fcd 100644 --- a/source/components/utilities/utxferror.c +++ b/source/components/utilities/utxferror.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTXFERROR_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index 0f1a6c3a9a87..2dc5d2062ae4 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTXFINIT_C__  #define EXPORT_ACPI_INTERFACES  #include "acpi.h" @@ -54,6 +53,11 @@  #define _COMPONENT          ACPI_UTILITIES          ACPI_MODULE_NAME    ("utxfinit") +/* For AcpiExec only */ +void +AeDoObjectOverrides ( +    void); +  /*******************************************************************************   * @@ -309,6 +313,14 @@ AcpiInitializeObjects (          }      } +#ifdef ACPI_EXEC_APP +    /* +     * This call implements the "initialization file" option for AcpiExec. +     * This is the precise point that we want to perform the overrides. +     */ +    AeDoObjectOverrides (); +#endif +      /*       * Execute any module-level code that was detected during the table load       * phase. Although illegal since ACPI 2.0, there are many machines that diff --git a/source/components/utilities/utxfmutex.c b/source/components/utilities/utxfmutex.c index 06245dce1bab..ac371d465787 100644 --- a/source/components/utilities/utxfmutex.c +++ b/source/components/utilities/utxfmutex.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __UTXFMUTEX_C__ -  #include "acpi.h"  #include "accommon.h"  #include "acnamesp.h" diff --git a/source/include/acbuffer.h b/source/include/acbuffer.h index a36a980aa954..1adb4b125e7c 100644 --- a/source/include/acbuffer.h +++ b/source/include/acbuffer.h @@ -119,7 +119,9 @@ typedef struct acpi_pld_info  {      UINT8               Revision;      UINT8               IgnoreColor; -    UINT32              Color; +    UINT8               Red; +    UINT8               Green; +    UINT8               Blue;      UINT16              Width;      UINT16              Height;      UINT8               UserVisible; @@ -165,8 +167,14 @@ typedef struct acpi_pld_info  #define ACPI_PLD_GET_IGNORE_COLOR(dword)        ACPI_GET_BITS (dword, 7, ACPI_1BIT_MASK)  #define ACPI_PLD_SET_IGNORE_COLOR(dword,value)  ACPI_SET_BITS (dword, 7, ACPI_1BIT_MASK, value)     /* Offset 7, Len 1 */ -#define ACPI_PLD_GET_COLOR(dword)               ACPI_GET_BITS (dword, 8, ACPI_24BIT_MASK) -#define ACPI_PLD_SET_COLOR(dword,value)         ACPI_SET_BITS (dword, 8, ACPI_24BIT_MASK, value)    /* Offset 8, Len 24 */ +#define ACPI_PLD_GET_RED(dword)                 ACPI_GET_BITS (dword, 8, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_RED(dword,value)           ACPI_SET_BITS (dword, 8, ACPI_8BIT_MASK, value)    /* Offset 8, Len 8 */ + +#define ACPI_PLD_GET_GREEN(dword)               ACPI_GET_BITS (dword, 16, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_GREEN(dword,value)         ACPI_SET_BITS (dword, 16, ACPI_8BIT_MASK, value)    /* Offset 16, Len 8 */ + +#define ACPI_PLD_GET_BLUE(dword)                ACPI_GET_BITS (dword, 24, ACPI_8BIT_MASK) +#define ACPI_PLD_SET_BLUE(dword,value)          ACPI_SET_BITS (dword, 24, ACPI_8BIT_MASK, value)    /* Offset 24, Len 8 */  /* Second 32-bit dword, bits 33:63 */ diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index e3f1eb917361..f4fa051e431a 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -979,11 +979,23 @@ AcpiDmCheckResourceReference (  /* + * dmcstyle + */ +BOOLEAN +AcpiDmCheckForSymbolicOpcode ( +    ACPI_PARSE_OBJECT       *Op, +    ACPI_OP_WALK_INFO       *Info); + +void +AcpiDmCloseOperator ( +    ACPI_PARSE_OBJECT       *Op); + + +/*   * acdisasm   */  void  AdDisassemblerHeader (      char                    *Filename); -  #endif  /* __ACDISASM_H__ */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index a83f8c34b0eb..d14d7bab1eb2 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -309,6 +309,7 @@ ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_O  ACPI_INIT_GLOBAL (UINT8,                AcpiGbl_NoResourceDisassembly, FALSE);  ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_IgnoreNoopOperator, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN,              AcpiGbl_CstyleDisassembly, TRUE);  ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_disasm);  ACPI_GLOBAL (BOOLEAN,                   AcpiGbl_DbOpt_verbose); diff --git a/source/include/aclocal.h b/source/include/aclocal.h index d911985ed160..e5285ec0c1e8 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -869,6 +869,7 @@ typedef union acpi_parse_value      ACPI_DISASM_ONLY_MEMBERS (\      UINT8                           DisasmFlags;    /* Used during AML disassembly */\      UINT8                           DisasmOpcode;   /* Subtype used for disassembly */\ +    char                            *OperatorSymbol;/* Used for C-style operator name strings */\      char                            AmlOpName[16])  /* Op name (debug only) */ @@ -991,6 +992,8 @@ typedef struct acpi_parse_state  #define ACPI_PARSEOP_EMPTY_TERMLIST     0x04  #define ACPI_PARSEOP_PREDEF_CHECKED     0x08  #define ACPI_PARSEOP_SPECIAL            0x10 +#define ACPI_PARSEOP_COMPOUND           0x20 +#define ACPI_PARSEOP_ASSIGNMENT         0x40  /***************************************************************************** diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 1fe8e6585f99..73a05f9623e1 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -46,7 +46,7 @@  /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION                 0x20140926 +#define ACPI_CA_VERSION                 0x20141107  #include "acconfig.h"  #include "actypes.h" diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index a14ae6406817..1025b4c809a3 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -70,6 +70,7 @@ extern UINT8                AcpiGbl_UseHwReducedFadt;  extern BOOLEAN              AcpiGbl_DisplayRegionAccess;  extern BOOLEAN              AcpiGbl_DoInterfaceTests;  extern BOOLEAN              AcpiGbl_LoadTestTables; +extern FILE                 *AcpiGbl_NamespaceInitFile;  extern ACPI_CONNECTION_INFO AeMyContext;  /* Check for unexpected exceptions */ @@ -213,4 +214,14 @@ AeOverrideRegionHandlers (      void); +/* aeinitfile */ + +int +AeOpenInitializationFile ( +    char                    *Filename); + +void +AeDoObjectOverrides ( +    void); +  #endif /* _AECOMMON */ diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c new file mode 100644 index 000000000000..de36020d7119 --- /dev/null +++ b/source/tools/acpiexec/aeinitfile.c @@ -0,0 +1,226 @@ +/****************************************************************************** + * + * Module Name: aeinitfile - Support for optional initialization file + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2014, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions, and the following disclaimer, + *    without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + *    substantially similar to the "NO WARRANTY" disclaimer below + *    ("Disclaimer") and any redistribution must be conditioned upon + *    including a substantially similar Disclaimer requirement for further + *    binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + *    of any contributors may be used to endorse or promote products derived + *    from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "aecommon.h" +#include "acdispat.h" + +#define _COMPONENT          ACPI_TOOLS +        ACPI_MODULE_NAME    ("aeinitfile") + + +/* Local prototypes */ + +static void +AeDoOneOverride ( +    char                    *Pathname, +    char                    *ValueString, +    ACPI_OPERAND_OBJECT     *ObjDesc, +    ACPI_WALK_STATE         *WalkState); + + +#define AE_FILE_BUFFER_SIZE  512 + +static char                 NameBuffer[AE_FILE_BUFFER_SIZE]; +static char                 ValueBuffer[AE_FILE_BUFFER_SIZE]; +static FILE                 *InitFile; + + +/****************************************************************************** + * + * FUNCTION:    AeOpenInitializationFile + * + * PARAMETERS:  Filename            - Path to the init file + * + * RETURN:      Status + * + * DESCRIPTION: Open the initialization file for the -fi option + * + *****************************************************************************/ + +int +AeOpenInitializationFile ( +    char                    *Filename) +{ + +    InitFile = fopen (Filename, "r"); +    if (!InitFile) +    { +        perror ("Could not open initialization file"); +        return (-1); +    } + +    AcpiOsPrintf ("Opened initialization file [%s]\n", Filename); +    return (0); +} + + +/****************************************************************************** + * + * FUNCTION:    AeDoObjectOverrides + * + * PARAMETERS:  None + * + * RETURN:      None + * + * DESCRIPTION: Read the initialization file and perform all overrides + * + * NOTE:        The format of the file is multiple lines, each of format: + *                  <ACPI-pathname> <Integer Value> + * + *****************************************************************************/ + +void +AeDoObjectOverrides ( +    void) +{ +    ACPI_OPERAND_OBJECT     *ObjDesc; +    ACPI_WALK_STATE         *WalkState; +    int                     i; + + +    if (!InitFile) +    { +        return; +    } + +    /* Create needed objects to be reused for each init entry */ + +    ObjDesc = AcpiUtCreateIntegerObject (0); +    WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); + +    NameBuffer[0] = '\\'; + +     /* Read the entire file line-by-line */ + +    while (fscanf (InitFile, "%s %s\n", +        ACPI_CAST_PTR (char, &NameBuffer[1]), +        ACPI_CAST_PTR (char, &ValueBuffer)) == 2) +    { +        /* Add a root prefix if not present in the string */ + +        i = 0; +        if (NameBuffer[1] == '\\') +        { +            i = 1; +        } + +        AeDoOneOverride (&NameBuffer[i], ValueBuffer, ObjDesc, WalkState); +    } + +    /* Cleanup */ + +    fclose (InitFile); +    AcpiDsDeleteWalkState (WalkState); +    AcpiUtRemoveReference (ObjDesc); +} + + +/****************************************************************************** + * + * FUNCTION:    AeDoOneOverride + * + * PARAMETERS:  Pathname            - AML namepath + *              ValueString         - New integer value to be stored + *              ObjDesc             - Descriptor with integer override value + *              WalkState           - Used for the Store operation + * + * RETURN:      None + * + * DESCRIPTION: Perform an overrided for a single namespace object + * + *****************************************************************************/ + +static void +AeDoOneOverride ( +    char                    *Pathname, +    char                    *ValueString, +    ACPI_OPERAND_OBJECT     *ObjDesc, +    ACPI_WALK_STATE         *WalkState) +{ +    ACPI_HANDLE             Handle; +    ACPI_STATUS             Status; +    UINT64                  Value; + + +    AcpiOsPrintf ("Value Override: %s, ", Pathname); + +    /* +     * Get the namespace node associated with the override +     * pathname from the init file. +     */ +    Status = AcpiGetHandle (NULL, Pathname, &Handle); +    if (ACPI_FAILURE (Status)) +    { +        AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); +        return; +    } + +    /* Extract the 64-bit integer */ + +    Status = AcpiUtStrtoul64 (ValueString, 0, &Value); +    if (ACPI_FAILURE (Status)) +    { +        AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); +        return; +    } + +    ObjDesc->Integer.Value = Value; + +    /* +     * At the point this function is called, the namespace is fully +     * built and initialized. We can simply store the new object to +     * the target node. +     */ +    AcpiExEnterInterpreter (); +    Status = AcpiExStore (ObjDesc, Handle, WalkState); +    AcpiExExitInterpreter (); + +    if (ACPI_FAILURE (Status)) +    { +        AcpiOsPrintf ("%s\n", AcpiFormatException (Status)); +        return; +    } + +    AcpiOsPrintf ("New value: 0x%8.8X%8.8X\n", +        ACPI_FORMAT_UINT64 (Value)); +} diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 5381b4e0722a..476539e48aa0 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -95,7 +95,7 @@ static char                 BatchBuffer[AE_BUFFER_SIZE];    /* Batch command buf  static AE_TABLE_DESC        *AeTableListHead = NULL;  #define ACPIEXEC_NAME               "AML Execution/Debug Utility" -#define AE_SUPPORTED_OPTIONS        "?b:d:e:f:ghm^orv^:x:" +#define AE_SUPPORTED_OPTIONS        "?b:d:e:f^ghm^orv^:x:"  /* Stubs for the disassembler */ @@ -158,12 +158,16 @@ usage (      ACPI_OPTION ("-et",                 "Enable debug semaphore timeout");      printf ("\n"); -    ACPI_OPTION ("-f <Value>",          "Operation Region initialization fill value"); +    ACPI_OPTION ("-fv <Value>",         "Operation Region initialization fill value"); +    ACPI_OPTION ("-fi <file>",          "Specify namespace initialization file");      ACPI_OPTION ("-r",                  "Use hardware-reduced FADT V5");      ACPI_OPTION ("-v",                  "Display version information");      ACPI_OPTION ("-vi",                 "Verbose initialization output");      ACPI_OPTION ("-vr",                 "Verbose region handler output");      ACPI_OPTION ("-x <DebugLevel>",     "Debug output level"); + +    printf ("\n  From within the interactive mode, use '?' or \"help\" to see\n" +        "  a list of available AML Debugger commands\n");  } @@ -285,7 +289,36 @@ AeDoOptions (      case 'f': -        AcpiGbl_RegionFillValue = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); +        switch (AcpiGbl_Optarg[0]) +        { +        case 'v':   /* -fv: region fill value */ + +            if (AcpiGetoptArgument (argc, argv)) +            { +                return (-1); +            } + +            AcpiGbl_RegionFillValue = (UINT8) strtoul (AcpiGbl_Optarg, NULL, 0); +            break; + +        case 'i':   /* -fi: specify initialization file */ + +            if (AcpiGetoptArgument (argc, argv)) +            { +                return (-1); +            } + +            if (AeOpenInitializationFile (AcpiGbl_Optarg)) +            { +                return (-1); +            } +            break; + +        default: + +            printf ("Unknown option: -f%s\n", AcpiGbl_Optarg); +            return (-1); +        }          break;      case 'g': @@ -436,6 +469,7 @@ main (      }      AcpiGbl_DbOpt_tables = TRUE; +    AcpiGbl_CstyleDisassembly = FALSE; /* Not supported for AcpiExec */      TableCount = 0;      /* Get each of the ACPI table files on the command line */ @@ -579,7 +613,6 @@ EnterDebugger:  ErrorExit: -      (void) AcpiOsTerminate ();      return (-1);  } diff --git a/source/tools/examples/examples.c b/source/tools/examples/examples.c index 762118a13338..3a6048d0a99d 100644 --- a/source/tools/examples/examples.c +++ b/source/tools/examples/examples.c @@ -41,7 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXAMPLES_C__  #include "examples.h"  #define _COMPONENT          ACPI_EXAMPLE diff --git a/source/tools/examples/extables.c b/source/tools/examples/extables.c index aa5fc1fea8ee..18c1a8534e1c 100644 --- a/source/tools/examples/extables.c +++ b/source/tools/examples/extables.c @@ -41,8 +41,6 @@   * POSSIBILITY OF SUCH DAMAGES.   */ -#define __EXTABLES_C__ -  #include "examples.h"  #include "actables.h"  | 
