diff options
Diffstat (limited to 'source/compiler')
34 files changed, 2057 insertions, 516 deletions
| diff --git a/source/compiler/aslanalyze.c b/source/compiler/aslanalyze.c index 45ca35c25e85..668f6605fd5b 100644 --- a/source/compiler/aslanalyze.c +++ b/source/compiler/aslanalyze.c @@ -308,6 +308,12 @@ AnCheckMethodReturnValue (      Node = ArgOp->Asl.Node; +    if (!Node) +    { +        /* No error message, this can happen and is OK */ + +        return; +    }      /* Examine the parent op of this method */ diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 7ac4ca70e563..c956516f8ba2 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -408,12 +408,25 @@ AnGetBtype (          Node = Op->Asl.Node;          if (!Node)          { +            /* These are not expected to have a node at this time */ + +            if ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEWORDFIELD) || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEDWORDFIELD) || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEQWORDFIELD) || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBYTEFIELD) || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEBITFIELD) || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CREATEFIELD)    || +                (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF)) +            { +                return (ACPI_UINT32_MAX - 1); +            } +              DbgPrint (ASL_DEBUG_OUTPUT,                  "No attached Nsnode: [%s] at line %u name [%s], " -                "ignoring typecheck\n", +                "ignoring typecheck. Parent [%s]\n",                  Op->Asl.ParseOpName, Op->Asl.LineNumber, -                Op->Asl.ExternalName); -            return (ACPI_UINT32_MAX); +                Op->Asl.ExternalName, Op->Asl.Parent->Asl.ParseOpName); +            return (ACPI_UINT32_MAX - 1);          }          ThisNodeBtype = AnMapEtypeToBtype (Node->Type); diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 08fcc3748d45..5e25d0d24441 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -97,22 +97,16 @@ CgGenerateAmlOutput (      void)  { -    DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); -      /* Generate the AML output file */      FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0);      Gbl_SourceLine = 0;      Gbl_NextError = Gbl_ErrorLog; -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    TrWalkParseTree (Gbl_ParseTreeRoot, 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#  EL#  LL#  ELL#\n", -        76, " "); - +    DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);      CgCloseTable ();  } @@ -136,40 +130,43 @@ CgAmlWriteWalk (      void                    *Context)  { -    /* -     * Print header at level 0. Alignment assumes 32-bit pointers -     */ -    if (!Level) +    /* Generate the AML for this node */ + +    CgWriteNode (Op); + +    if (!Gbl_DebugFlag)      { -        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" -            "    Parent   Child    Next     Flags    AcTyp    Final Col L#  EL#  LL#  ELL#\n", -            76, " "); +        return (AE_OK);      } -    /* Debug output */ - -    DbgPrint (ASL_TREE_OUTPUT, -        "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); -    UtPrintFormattedName (Op->Asl.ParseOpcode, Level); +    /* Print header at level 0. Alignment assumes 32-bit pointers */ -    if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG    || -        Op->Asl.ParseOpcode == PARSEOP_NAMESTRING || -        Op->Asl.ParseOpcode == PARSEOP_METHODCALL) +    if (!Level)      {          DbgPrint (ASL_TREE_OUTPUT, -            "%10.32s      ", Op->Asl.ExternalName); +            "\nFinal parse tree used for AML output:\n"); +        DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER2);      } -    else + +    /* Dump ParseOp name and possible value */ + +    switch (Op->Asl.ParseOpcode)      { -        DbgPrint (ASL_TREE_OUTPUT, "                "); +    case PARSEOP_NAMESEG: +    case PARSEOP_NAMESTRING: +    case PARSEOP_METHODCALL: +    case PARSEOP_STRING_LITERAL: + +        UtDumpStringOp (Op, Level); +        break; + +    default: + +        UtDumpBasicOp (Op, Level); +        break;      } -    DbgPrint (ASL_TREE_OUTPUT, -        "%08X %04X %04X %01X     %04X  %04X %04X   %04X    " -        "%08X %08X %08X %08X %08X %08X %04X  %02d  %02d   %02d   %02d   %02d\n", +    DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG2,          /* 1  */ (UINT32) Op->Asl.Value.Integer,          /* 2  */ Op->Asl.ParseOpcode,          /* 3  */ Op->Asl.AmlOpcode, @@ -191,9 +188,6 @@ CgAmlWriteWalk (          /* 19 */ Op->Asl.LogicalLineNumber,          /* 20 */ Op->Asl.EndLogicalLine); -    /* Generate the AML for this node */ - -    CgWriteNode (Op);      return (AE_OK);  } @@ -558,7 +552,7 @@ CgCloseTable (      /* Process all definition blocks */ -    Op = RootNode->Asl.Child; +    Op = Gbl_ParseTreeRoot->Asl.Child;      while (Op)      {          CgUpdateHeader (Op); @@ -590,7 +584,6 @@ CgWriteNode (      /* TBD: this may not be the best place for this check */      if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)  || -        (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)     ||          (Op->Asl.ParseOpcode == PARSEOP_INCLUDE)      ||          (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END))      { diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 4b8f15ed572b..54c863e7638b 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -138,7 +138,7 @@ CmDoCompile (      /* Did the parse tree get successfully constructed? */ -    if (!RootNode) +    if (!Gbl_ParseTreeRoot)      {          /*           * If there are no errors, then we have some sort of @@ -166,22 +166,22 @@ CmDoCompile (      LsDumpParseTree (); -    OpcGetIntegerWidth (RootNode->Asl.Child); +    OpcGetIntegerWidth (Gbl_ParseTreeRoot->Asl.Child);      UtEndEvent (Event);      /* Pre-process parse tree for any operator transforms */      Event = UtBeginEvent ("Parse tree transforms");      DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, -        TrAmlTransformWalk, NULL, NULL); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +        TrAmlTransformWalkBegin, TrAmlTransformWalkEnd, NULL);      UtEndEvent (Event);      /* Generate AML opcodes corresponding to the parse tokens */      Event = UtBeginEvent ("Generate AML opcodes"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating AML opcodes\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          OpcAmlOpcodeWalk, NULL);      UtEndEvent (Event); @@ -203,11 +203,11 @@ CmDoCompile (      Event = UtBeginEvent ("Constant folding via AML interpreter");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nInterpreting compile-time constant expressions\n\n"); +        "Interpreting compile-time constant expressions\n\n");      if (Gbl_FoldConstants)      { -        TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +        TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,              OpcAmlConstantWalk, NULL, NULL);      }      else @@ -220,16 +220,16 @@ CmDoCompile (      Event = UtBeginEvent ("Updating AML opcodes after constant folding");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nUpdating AML opcodes after constant folding\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +        "Updating AML opcodes after constant folding\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,          NULL, OpcAmlOpcodeUpdateWalk, NULL);      UtEndEvent (Event);      /* Calculate all AML package lengths */      Event = UtBeginEvent ("Generate AML package lengths"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnPackageLengthWalk, NULL);      UtEndEvent (Event); @@ -255,7 +255,8 @@ CmDoCompile (      /* Namespace loading */      Event = UtBeginEvent ("Create ACPI Namespace"); -    Status = LdLoadNamespace (RootNode); +    DbgPrint (ASL_DEBUG_OUTPUT, "Creating ACPI Namespace\n\n"); +    Status = LdLoadNamespace (Gbl_ParseTreeRoot);      UtEndEvent (Event);      if (ACPI_FAILURE (Status))      { @@ -266,6 +267,7 @@ CmDoCompile (      AslGbl_NamespaceEvent = UtBeginEvent (          "Cross reference parse tree and Namespace"); +    DbgPrint (ASL_DEBUG_OUTPUT, "Cross referencing namespace\n\n");      Status = XfCrossReferenceNamespace ();      if (ACPI_FAILURE (Status))      { @@ -277,6 +279,14 @@ CmDoCompile (      LkFindUnreferencedObjects ();      UtEndEvent (AslGbl_NamespaceEvent); +    /* Resolve External Declarations */ + +    Event = UtBeginEvent ("Resolve all Externals"); +    DbgPrint (ASL_DEBUG_OUTPUT, "\nResolve Externals\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +        ExAmlExternalWalkBegin, ExAmlExternalWalkEnd, NULL); +    UtEndEvent (Event); +      /*       * Semantic analysis. This can happen only after the       * namespace has been loaded and cross-referenced. @@ -286,17 +296,30 @@ CmDoCompile (      Event = UtBeginEvent ("Analyze control method return types");      AnalysisWalkInfo.MethodStack = NULL; -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method analysis\n\n"); + +    if (Gbl_CrossReferenceOutput) +    { +        OtPrintHeaders ("Part 1: Object Reference Map " +            "(Object references from within each control method)"); +    } + +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE,          MtMethodAnalysisWalkBegin,          MtMethodAnalysisWalkEnd, &AnalysisWalkInfo);      UtEndEvent (Event); +    /* Generate the object cross-reference file if requested */ + +    Event = UtBeginEvent ("Generate cross-reference file"); +    OtCreateXrefFile (); +    UtEndEvent (Event); +      /* Semantic error checking part two - typing of method returns */      Event = UtBeginEvent ("Determine object types returned by methods"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - Method typing\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,          NULL, AnMethodTypingWalkEnd, NULL);      UtEndEvent (Event); @@ -304,10 +327,10 @@ CmDoCompile (      Event = UtBeginEvent ("Analyze AML operand types");      DbgPrint (ASL_DEBUG_OUTPUT, -        "\nSemantic analysis - Operand type checking\n\n"); +        "Semantic analysis - Operand type checking\n\n");      if (Gbl_DoTypechecking)      { -        TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, +        TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD,              NULL, AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);      }      UtEndEvent (Event); @@ -315,8 +338,8 @@ CmDoCompile (      /* Semantic error checking part four - other miscellaneous checks */      Event = UtBeginEvent ("Miscellaneous analysis"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    DbgPrint (ASL_DEBUG_OUTPUT, "Semantic analysis - miscellaneous\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,          AnOtherSemanticAnalysisWalkBegin,          NULL, &AnalysisWalkInfo);      UtEndEvent (Event); @@ -324,16 +347,17 @@ CmDoCompile (      /* Calculate all AML package lengths */      Event = UtBeginEvent ("Finish AML package length generation"); -    DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    DbgPrint (ASL_DEBUG_OUTPUT, "Generating Package lengths\n\n"); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnInitLengthsWalk, NULL); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_UPWARD, NULL,          LnPackageLengthWalk, NULL);      UtEndEvent (Event);      /* Code generation - emit the AML */      Event = UtBeginEvent ("Generate AML code and write output files"); +    DbgPrint (ASL_DEBUG_OUTPUT, "Writing AML byte code\n\n");      CgGenerateAmlOutput ();      UtEndEvent (Event); @@ -816,7 +840,7 @@ CmDeleteCaches (      Gbl_ParseOpCount = 0;      Gbl_ParseOpCacheNext = NULL;      Gbl_ParseOpCacheLast = NULL; -    RootNode = NULL; +    Gbl_ParseTreeRoot = NULL;      /* Generic string cache */ diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 721abe46f504..d92b9b1fee44 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -652,7 +652,13 @@ ApCheckPackage (   * asltransform - parse tree transformations   */  ACPI_STATUS -TrAmlTransformWalk ( +TrAmlTransformWalkBegin ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +ACPI_STATUS +TrAmlTransformWalkEnd (      ACPI_PARSE_OBJECT       *Op,      UINT32                  Level,      void                    *Context); @@ -669,6 +675,25 @@ TrWalkParseTree (      ASL_WALK_CALLBACK       AscendingCallback,      void                    *Context); +/* + * aslexternal - External opcode support + */ +ACPI_STATUS +ExAmlExternalWalkBegin ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +ACPI_STATUS +ExAmlExternalWalkEnd ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +void +ExDoExternal ( +    ACPI_PARSE_OBJECT       *Op); +  /* Values for "Visitation" parameter above */  #define ASL_WALK_VISIT_DOWNWARD     0x01 @@ -909,6 +934,24 @@ XfCrossReferenceNamespace (  /* + * aslxrefout + */ +void +OtPrintHeaders ( +    char                    *Message); + +void +OtCreateXrefFile ( +    void); + +void +OtXrefWalkPart1 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    ASL_METHOD_INFO         *MethodInfo); + + +/*   * aslutils - common compiler utilites   */  void @@ -923,11 +966,31 @@ DbgPrint (  #define ASL_PARSE_OUTPUT    1  #define ASL_TREE_OUTPUT     2 +UINT8 +UtIsBigEndianMachine ( +    void); +  BOOLEAN  UtQueryForOverwrite (      char                    *Pathname);  void +UtDumpStringOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level); + +void +UtDumpIntegerOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    UINT32                  IntegerLength); + +void +UtDumpBasicOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level); + +void  UtDisplaySupportedTables (      void); @@ -948,11 +1011,6 @@ UtLocalCalloc (      UINT32                  Size);  void -UtPrintFormattedName ( -    UINT16                  ParseOpcode, -    UINT32                  Level); - -void  UtDisplaySummary (      UINT32                  FileId); @@ -1006,12 +1064,6 @@ UINT64  UtDoConstant (      char                    *String); -ACPI_STATUS -stroul64 ( -    char                    *String, -    UINT32                  Base, -    UINT64                  *RetInteger); -  /*   * asluuid - UUID support diff --git a/source/compiler/asldebug.c b/source/compiler/asldebug.c new file mode 100644 index 000000000000..6ba60668b193 --- /dev/null +++ b/source/compiler/asldebug.c @@ -0,0 +1,253 @@ +/****************************************************************************** + * + * Module Name: asldebug -- Debug output support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, 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" + + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("asldebug") + + +/* Local prototypes */ + +static void +UtDumpParseOpName ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    UINT32                  DataLength); + + +/******************************************************************************* + * + * FUNCTION:    UtDumpIntegerOp + * + * PARAMETERS:  Op                  - Current parse op + *              Level               - Current output indentation level + *              IntegerLength       - Output length of the integer (2/4/8/16) + * + * RETURN:      None + * + * DESCRIPTION: Emit formatted debug output for "integer" ops. + *              Note: IntegerLength must be one of 2,4,8,16. + * + ******************************************************************************/ + +void +UtDumpIntegerOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    UINT32                  IntegerLength) +{ + +    /* Emit the ParseOp name, leaving room for the integer */ + +    UtDumpParseOpName (Op, Level, IntegerLength); + +    /* Emit the integer based upon length */ + +    switch (IntegerLength) +    { +    case 2: /* Byte */ +    case 4: /* Word */ +    case 8: /* Dword */ + +        DbgPrint (ASL_TREE_OUTPUT, +            "%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer); +        break; + +    case 16: /* Qword and Integer */ + +        DbgPrint (ASL_TREE_OUTPUT, +            "%8.8X%8.8X", ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); +        break; + +    default: +        break; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    UtDumpStringOp + * + * PARAMETERS:  Op                  - Current parse op + *              Level               - Current output indentation level + * + * RETURN:      None + * + * DESCRIPTION: Emit formatted debug output for String/Pathname ops. + * + ******************************************************************************/ + +void +UtDumpStringOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level) +{ +    char                    *String; + + +    String = Op->Asl.Value.String; + +    if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) +    { +        /* +         * For the "path" ops NAMEPATH, NAMESEG, METHODCALL -- if the +         * ExternalName is valid, it takes precedence. In these cases the +         * Value.String is the raw "internal" name from the AML code, which +         * we don't want to use, because it contains non-ascii characters. +         */ +        if (Op->Asl.ExternalName) +        { +            String = Op->Asl.ExternalName; +        } +    } + +    if (!String) +    { +        DbgPrint (ASL_TREE_OUTPUT, +            " ERROR: Could not find a valid String/Path pointer\n"); +        return; +    } + +    /* Emit the ParseOp name, leaving room for the string */ + +    UtDumpParseOpName (Op, Level, strlen (String)); +    DbgPrint (ASL_TREE_OUTPUT, "%s", String); +} + + +/******************************************************************************* + * + * FUNCTION:    UtDumpBasicOp + * + * PARAMETERS:  Op                  - Current parse op + *              Level               - Current output indentation level + * + * RETURN:      None + * + * DESCRIPTION: Generic formatted debug output for "basic" ops that have no + *              associated strings or integer values. + * + ******************************************************************************/ + +void +UtDumpBasicOp ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level) +{ + +    /* Just print out the ParseOp name, there is no extra data */ + +    UtDumpParseOpName (Op, Level, 0); +} + + +/******************************************************************************* + * + * FUNCTION:    UtDumpParseOpName + * + * PARAMETERS:  Op                  - Current parse op + *              Level               - Current output indentation level + *              DataLength          - Length of data to appear after the name + * + * RETURN:      None + * + * DESCRIPTION: Indent and emit the ascii ParseOp name for the op + * + ******************************************************************************/ + +static void +UtDumpParseOpName ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    UINT32                  DataLength) +{ +    char                    *ParseOpName; +    UINT32                  IndentLength; +    UINT32                  NameLength; +    UINT32                  LineLength; +    UINT32                  PaddingLength; + + +    /* Emit the LineNumber/IndentLevel prefix on each output line */ + +    DbgPrint (ASL_TREE_OUTPUT, +        "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); + +    ParseOpName = UtGetOpName (Op->Asl.ParseOpcode); + +    /* Calculate various lengths for output alignment */ + +    IndentLength = Level * DEBUG_SPACES_PER_INDENT; +    NameLength = strlen (ParseOpName); +    LineLength = IndentLength + 1 + NameLength + 1 + DataLength; +    PaddingLength = (DEBUG_MAX_LINE_LENGTH + 1) - LineLength; + +    /* Parse tree indentation is based upon the nesting/indent level */ + +    if (Level) +    { +        DbgPrint (ASL_TREE_OUTPUT, "%*s", IndentLength, " "); +    } + +    /* Emit the actual name here */ + +    DbgPrint (ASL_TREE_OUTPUT, " %s", ParseOpName); + +    /* Emit extra padding blanks for alignment of later data items */ + +    if (LineLength > DEBUG_MAX_LINE_LENGTH) +    { +        /* Split a long line immediately after the ParseOpName string */ + +        DbgPrint (ASL_TREE_OUTPUT, "\n%*s", +            (DEBUG_FULL_LINE_LENGTH - DataLength), " "); +    } +    else +    { +        DbgPrint (ASL_TREE_OUTPUT, "%*s", PaddingLength, " "); +    } +} diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index b42bae2ef936..f615cb219536 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -54,7 +54,7 @@  #define ASL_CREATOR_ID              "INTL"  #define ASL_DEFINE                  "__IASL__" -#define ASL_COMPLIANCE              "Supports ACPI Specification Revision 6.0" +#define ASL_COMPLIANCE              "Supports ACPI Specification Revision 6.1"  /* Configuration constants */ @@ -118,8 +118,7 @@  #define ASL_ABORT                   TRUE  #define ASL_NO_ABORT                FALSE  #define ASL_EOF                     ACPI_UINT32_MAX -#define ASL_WITHIN_COMMENT          (ACPI_UINT32_MAX -1) -#define ASL_BLANK_LINE              (ACPI_UINT32_MAX -1) +#define ASL_IGNORE_LINE            (ACPI_UINT32_MAX -1)  /* Listings */ @@ -156,4 +155,34 @@  #define RsCreateQwordField(Op, Name, ByteOffset) \      RsCreateResourceField (Op, Name, ByteOffset, 0, 64); + +/* + * Macros for debug output + */ + +#define DEBUG_MAX_LINE_LENGTH       61 +#define DEBUG_SPACES_PER_INDENT     3 +#define DEBUG_FULL_LINE_LENGTH      71 + +#define ASL_PARSE_TREE_FULL_LINE    "\n%71.71s" + +/* Header/Trailer for original parse tree directly from the parser */ + +#define ASL_PARSE_TREE_HEADER1 \ +    "%*s Value P_Op Flags     Line#  End# LogL# EndL#\n", 65, " " + +#define ASL_PARSE_TREE_DEBUG1 \ +    " %4.4X %8.8X %5d %5d %5d %5d" + +/* Header/Trailer for processed parse tree used for AML generation */ + +#define ASL_PARSE_TREE_HEADER2 \ +    "%*s NameString Value    P_Op A_Op OpLen PByts Len  SubLen PSubLen OpPtr"\ +    "    Parent   Child    Next     Flags    AcTyp    Final Col"\ +    " Line#  End# LogL# EndL#\n", 60, " " + +#define ASL_PARSE_TREE_DEBUG2 \ +    " %08X %04X %04X %01X     %04X  %04X %05X  %05X   "\ +    "%08X %08X %08X %08X %08X %08X %04X  %02d  %5d %5d %5d %5d\n" +  #endif /* ASLDEFINE.H */ diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c new file mode 100644 index 000000000000..5335048adaa3 --- /dev/null +++ b/source/compiler/aslexternal.c @@ -0,0 +1,491 @@ +/****************************************************************************** + * + * Module Name: aslexternal - ASL External opcode compiler support + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, 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 "acparser.h" +#include "amlcode.h" +#include "acnamesp.h" + + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("aslexternal") + + +/* Local prototypes */ + +static void +ExInsertArgCount ( +    ACPI_PARSE_OBJECT       *Op); + +static void +ExMoveExternals ( +    ACPI_PARSE_OBJECT       *DefinitionBlockOp); + + +/******************************************************************************* + * + * FUNCTION:    ExDoExternal + * + * PARAMETERS:  Op                  - Current Parse node + * + * RETURN:      None + * + * DESCRIPTION: Add an External() definition to the global list. This list + *              is used to generate External opcodes. + * + ******************************************************************************/ + +void +ExDoExternal ( +    ACPI_PARSE_OBJECT       *Op) +{ +    ACPI_PARSE_OBJECT       *ListOp; +    ACPI_PARSE_OBJECT       *Prev; +    ACPI_PARSE_OBJECT       *Next; +    ACPI_PARSE_OBJECT       *ArgCountOp; + + +    ArgCountOp = Op->Asl.Child->Asl.Next->Asl.Next; +    ArgCountOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; +    ArgCountOp->Asl.ParseOpcode = PARSEOP_BYTECONST; +    ArgCountOp->Asl.Value.Integer = 0; +    UtSetParseOpName (ArgCountOp); + +    /* Create new list node of arbitrary type */ + +    ListOp = TrAllocateNode (PARSEOP_DEFAULT_ARG); + +    /* Store External node as child */ + +    ListOp->Asl.Child = Op; +    ListOp->Asl.Next = NULL; + +    if (Gbl_ExternalsListHead) +    { +        /* Link new External to end of list */ + +        Prev = Gbl_ExternalsListHead; +        Next = Prev; +        while (Next) +        { +            Prev = Next; +            Next = Next->Asl.Next; +        } + +        Prev->Asl.Next = ListOp; +    } +    else +    { +        Gbl_ExternalsListHead = ListOp; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    ExInsertArgCount + * + * PARAMETERS:  Op              - Op for a method invocation + * + * RETURN:      None + * + * DESCRIPTION: Obtain the number of arguments for a control method -- from + *              the actual invocation. + * + ******************************************************************************/ + +static void +ExInsertArgCount ( +    ACPI_PARSE_OBJECT       *Op) +{ +    ACPI_PARSE_OBJECT       *Next; +    ACPI_PARSE_OBJECT       *NameOp; +    ACPI_PARSE_OBJECT       *Child; +    ACPI_PARSE_OBJECT       *ArgCountOp; +    char *                  ExternalName; +    char *                  CallName; +    UINT16                  ArgCount = 0; + + +    CallName = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); + +    Next = Gbl_ExternalsListHead; +    while (Next) +    { +        ArgCount = 0; + +        /* Skip if External node already handled */ + +        if (Next->Asl.Child->Asl.CompileFlags & NODE_VISITED) +        { +            Next = Next->Asl.Next; +            continue; +        } + +        NameOp = Next->Asl.Child->Asl.Child; +        ExternalName = AcpiNsGetNormalizedPathname (NameOp->Asl.Node, TRUE); + +        if (!strcmp (CallName, ExternalName)) +        { +            Next->Asl.Child->Asl.CompileFlags |= NODE_VISITED; + +            /* +             * Since we will reposition Externals to the Root, set Namepath +             * to the fully qualified name and recalculate the aml length +             */ +            if (ACPI_FAILURE (UtInternalizeName ( +                ExternalName, &NameOp->Asl.Value.String))) +            { +                AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, +                    NULL, "- Could not Internalize External"); + +                break; +            } + +            NameOp->Asl.AmlLength = strlen (NameOp->Asl.Value.String); + +            /* Get argument count */ + +            Child = Op->Asl.Child; +            while (Child) +            { +                ArgCount++; +                Child = Child->Asl.Next; +            } + +            /* Setup ArgCount operand */ + +            ArgCountOp = Next->Asl.Child->Asl.Child->Asl.Next->Asl.Next; +            ArgCountOp->Asl.Value.Integer = ArgCount; +            break; +        } + +        Next = Next->Asl.Next; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    ExAmlExternalWalkBegin + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      None + * + * DESCRIPTION: Parse tree walk to create external opcode list for methods. + * + ******************************************************************************/ + +ACPI_STATUS +ExAmlExternalWalkBegin ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ + +    /* External list head saved in the definition block op */ + +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) +    { +        Gbl_ExternalsListHead = Op->Asl.Value.Arg; +    } + +    if (!Gbl_ExternalsListHead) +    { +        return (AE_OK); +    } + +    if (Op->Asl.ParseOpcode != PARSEOP_METHODCALL) +    { +        return (AE_OK); +    } + +    /* +     * The NameOp child under an ExternalOp gets turned into PARSE_METHODCALL +     * by XfNamespaceLocateBegin(). Ignore these. +     */ +    if (Op->Asl.Parent && +        Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_EXTERNAL) +    { +        return (AE_OK); +    } + +    ExInsertArgCount (Op); +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    ExAmlExternalWalkEnd + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      None + * + * DESCRIPTION: Parse tree walk to create external opcode list for methods. + *              Here, we just want to catch the case where a definition block + *              has been completed. Then we move all of the externals into + *              a single block in the parse tree and thus the AML code. + * + ******************************************************************************/ + +ACPI_STATUS +ExAmlExternalWalkEnd ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ + +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) +    { +        /* +         * Process any existing external list. (Support for +         * multiple definition blocks in a single file/compile) +         */ +        ExMoveExternals (Op); +        Gbl_ExternalsListHead = NULL; +    } + +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    ExMoveExternals + * + * PARAMETERS:  DefinitionBlockOp       - Op for current definition block + * + * RETURN:      None + * + * DESCRIPTION: Move all externals present in the source file into a single + *              block of AML code, surrounded by an "If (0)" to prevent + *              AML interpreters from attempting to execute the External + *              opcodes. + * + ******************************************************************************/ + +static void +ExMoveExternals ( +    ACPI_PARSE_OBJECT       *DefinitionBlockOp) +{ +    ACPI_PARSE_OBJECT       *ParentOp; +    ACPI_PARSE_OBJECT       *ExternalOp; +    ACPI_PARSE_OBJECT       *PredicateOp; +    ACPI_PARSE_OBJECT       *NextOp; +    ACPI_PARSE_OBJECT       *Prev; +    ACPI_PARSE_OBJECT       *Next; +    ACPI_OBJECT_TYPE        ObjType; +    UINT32                  i; + + +    if (!Gbl_ExternalsListHead) +    { +        return; +    } + +    /* Remove the External nodes from the tree */ + +    NextOp = Gbl_ExternalsListHead; +    while (NextOp) +    { +        /* +         * The External is stored in child pointer of each node in the +         * list +         */ +        ExternalOp = NextOp->Asl.Child; + +        /* Set line numbers (for listings, etc.) */ + +        ExternalOp->Asl.LineNumber = 0; +        ExternalOp->Asl.LogicalLineNumber = 0; + +        Next = ExternalOp->Asl.Child; +        Next->Asl.LineNumber = 0; +        Next->Asl.LogicalLineNumber = 0; + +        Next = Next->Asl.Next; +        Next->Asl.LineNumber = 0; +        Next->Asl.LogicalLineNumber = 0; + +        Next = Next->Asl.Next; +        Next->Asl.LineNumber = 0; +        Next->Asl.LogicalLineNumber = 0; + +        Next = Next->Asl.Next; +        Next->Asl.LineNumber = 0; +        Next->Asl.LogicalLineNumber = 0; + +        ParentOp = ExternalOp->Asl.Parent; +        Prev = Next = ParentOp->Asl.Child; + +        /* Now find the External node's position in parse tree */ + +        while (Next != ExternalOp) +        { +            Prev = Next; +            Next = Next->Asl.Next; +        } + +        /* Remove the External from the parse tree */ + +        if (Prev == ExternalOp) +        { +            /* External was the first child node */ + +            ParentOp->Asl.Child = ExternalOp->Asl.Next; +        } + +        Prev->Asl.Next = ExternalOp->Asl.Next; +        ExternalOp->Asl.Next = NULL; +        ExternalOp->Asl.Parent = Gbl_ExternalsListHead; + +        /* Point the External to the next in the list */ + +        if (NextOp->Asl.Next) +        { +            ExternalOp->Asl.Next = NextOp->Asl.Next->Asl.Child; +        } + +        NextOp = NextOp->Asl.Next; +    } + +    /* +     * Loop again to remove MethodObj Externals for which +     * a MethodCall was not found (dead external reference) +     */ +    Prev = Gbl_ExternalsListHead->Asl.Child; +    Next = Prev; +    while (Next) +    { +        ObjType = (ACPI_OBJECT_TYPE) +            Next->Asl.Child->Asl.Next->Asl.Value.Integer; + +        if (ObjType == ACPI_TYPE_METHOD && +            !(Next->Asl.CompileFlags & NODE_VISITED)) +        { +            if (Next == Prev) +            { +                Gbl_ExternalsListHead->Asl.Child = Next->Asl.Next; +                Next->Asl.Next = NULL; +                Prev = Gbl_ExternalsListHead->Asl.Child; +                Next = Prev; +                continue; +            } +            else +            { +                Prev->Asl.Next = Next->Asl.Next; +                Next->Asl.Next = NULL; +                Next = Prev->Asl.Next; +                continue; +            } +        } + +        Prev = Next; +        Next = Next->Asl.Next; +    } + +    /* If list is now empty, don't bother to make If (0) block */ + +    if (!Gbl_ExternalsListHead->Asl.Child) +    { +        return; +    } + +    /* Convert Gbl_ExternalsListHead parent to If(). */ + +    Gbl_ExternalsListHead->Asl.ParseOpcode = PARSEOP_IF; +    Gbl_ExternalsListHead->Asl.AmlOpcode = AML_IF_OP; +    Gbl_ExternalsListHead->Asl.CompileFlags = NODE_AML_PACKAGE; +    UtSetParseOpName (Gbl_ExternalsListHead); + +    /* Create a Zero op for the If predicate */ + +    PredicateOp = TrAllocateNode (PARSEOP_ZERO); +    PredicateOp->Asl.AmlOpcode = AML_ZERO_OP; + +    PredicateOp->Asl.Parent = Gbl_ExternalsListHead; +    PredicateOp->Asl.Child = NULL; +    PredicateOp->Asl.Next = Gbl_ExternalsListHead->Asl.Child; +    Gbl_ExternalsListHead->Asl.Child = PredicateOp; + +    /* Set line numbers (for listings, etc.) */ + +    Gbl_ExternalsListHead->Asl.LineNumber = 0; +    Gbl_ExternalsListHead->Asl.LogicalLineNumber = 0; + +    PredicateOp->Asl.LineNumber = 0; +    PredicateOp->Asl.LogicalLineNumber = 0; + +    /* Insert block back in the list */ + +    Prev = DefinitionBlockOp->Asl.Child; +    Next = Prev; + +    /* Find last default arg */ + +    for (i = 0; i < 6; i++) +    { +        Prev = Next; +        Next = Prev->Asl.Next; +    } + +    if (Next) +    { +        /* Definition Block is not empty */ + +        Gbl_ExternalsListHead->Asl.Next = Next; +    } +    else +    { +        /* Definition Block is empty. */ + +        Gbl_ExternalsListHead->Asl.Next = NULL; +    } + +    Prev->Asl.Next = Gbl_ExternalsListHead; +    Gbl_ExternalsListHead->Asl.Parent = Prev->Asl.Parent; +} diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 0d1c794e7842..52939f433d30 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -633,6 +633,24 @@ FlOpenMiscOutputFiles (          AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);      } +    /* Create/Open a cross-reference output file if asked */ + +    if (Gbl_CrossReferenceOutput) +    { +        Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_XREF); +        if (!Filename) +        { +            AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, +                0, 0, 0, 0, NULL, NULL); +            return (AE_ERROR); +        } + +        FlOpenFile (ASL_FILE_XREF_OUTPUT, Filename, "w+t"); + +        AslCompilerSignon (ASL_FILE_XREF_OUTPUT); +        AslCompilerFileHeader (ASL_FILE_XREF_OUTPUT); +    } +      /* Create/Open a listing output file if asked */      if (Gbl_ListingFlag) diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 1fb793524d39..0e534f3137b0 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -83,7 +83,8 @@ ASL_FILE_INFO                       Gbl_Files [ASL_NUM_FILES] =      {NULL, NULL, "ASM Include:  ", "Assembly Header Output"},      {NULL, NULL, "C Include:    ", "C Header Output"},      {NULL, NULL, "Offset Table: ", "C Offset Table Output"}, -    {NULL, NULL, "Device Map:   ", "Device Map Output"} +    {NULL, NULL, "Device Map:   ", "Device Map Output"}, +    {NULL, NULL, "Cross Ref:    ", "Cross-reference Output"}  };  #else @@ -149,6 +150,7 @@ ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_PreprocessorOutputFlag, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_KeepPreprocessorTempFile, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); +ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_CrossReferenceOutput, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE);  ASL_EXTERN BOOLEAN                  ASL_INIT_GLOBAL (Gbl_C_OffsetTableFlag, FALSE); @@ -240,14 +242,16 @@ ASL_EXTERN ACPI_SERIAL_INFO         ASL_INIT_GLOBAL (*Gbl_SerialList, NULL);  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0);  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*RootNode, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_ParseTreeRoot, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT        ASL_INIT_GLOBAL (*Gbl_ExternalsListHead, NULL);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_TableLength, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_SourceLine, 0);  ASL_EXTERN ASL_LISTING_NODE         ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT        *Gbl_FirstLevelInsertionNode;  ASL_EXTERN UINT8                    ASL_INIT_GLOBAL (Gbl_FileType, 0);  ASL_EXTERN char                     ASL_INIT_GLOBAL (*Gbl_Signature, NULL); +ASL_EXTERN ACPI_PARSE_OBJECT        *Gbl_FirstLevelInsertionNode; +  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0);  ASL_EXTERN UINT32                   ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); @@ -268,7 +272,7 @@ ASL_EXTERN ACPI_TABLE_HEADER        TableHeader;  /* Event timing */ -#define ASL_NUM_EVENTS              20 +#define ASL_NUM_EVENTS              24  ASL_EXTERN ASL_EVENT_INFO           AslGbl_Events[ASL_NUM_EVENTS];  ASL_EXTERN UINT8                    AslGbl_NextEvent;  ASL_EXTERN UINT8                    AslGbl_NamespaceEvent; diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index 0cea63cd6d4f..44c85aa5af5d 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -399,7 +399,6 @@ CgGenerateAmlLengths (          break;      case PARSEOP_DEFAULT_ARG: -    case PARSEOP_EXTERNAL:      case PARSEOP_INCLUDE:      case PARSEOP_INCLUDE_END: diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index 4923b7374db5..692d199e359a 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -163,16 +163,16 @@ LsGenerateListing (          LsDoOffsetTableHeader (FileId); -        TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlOffsetWalk, -            NULL, (void *) ACPI_TO_POINTER (FileId)); +        TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +            LsAmlOffsetWalk, NULL, (void *) ACPI_TO_POINTER (FileId));          LsDoOffsetTableFooter (FileId);          return;      }      /* Process all parse nodes */ -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, -        NULL, (void *) ACPI_TO_POINTER (FileId)); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +        LsAmlListingWalk, NULL, (void *) ACPI_TO_POINTER (FileId));      /* Final processing */ @@ -258,8 +258,12 @@ LsDumpParseTree (      }      DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1); + +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,          LsTreeWriteWalk, NULL, NULL); + +    DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_HEADER1);  } @@ -270,43 +274,69 @@ LsTreeWriteWalk (      void                    *Context)  { -    /* Debug output */ +    /* Dump ParseOp name and possible value */ -    DbgPrint (ASL_TREE_OUTPUT, -        "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level); +    switch (Op->Asl.ParseOpcode) +    { +        case PARSEOP_NAMESEG: +        case PARSEOP_NAMESTRING: +        case PARSEOP_METHODCALL: +        case PARSEOP_STRING_LITERAL: -    UtPrintFormattedName (Op->Asl.ParseOpcode, Level); +        UtDumpStringOp (Op, Level); +        break; + +    case PARSEOP_BYTECONST: + +        UtDumpIntegerOp (Op, Level, 2); +        break; + +    case PARSEOP_WORDCONST: +    case PARSEOP_PACKAGE_LENGTH: + +        UtDumpIntegerOp (Op, Level, 4); +        break; + +    case PARSEOP_DWORDCONST: +    case PARSEOP_EISAID: + +        UtDumpIntegerOp (Op, Level, 8); +        break; + +    case PARSEOP_QWORDCONST: +    case PARSEOP_INTEGER: +    case PARSEOP_ONE: +    case PARSEOP_ZERO: +    case PARSEOP_ONES: + +        UtDumpIntegerOp (Op, Level, 16); +        break; + +    case PARSEOP_INCLUDE: -    if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) -    { -        DbgPrint (ASL_TREE_OUTPUT, -            "%10.4s      ", Op->Asl.Value.Name); -    } -    else if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || -        (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) -    { -        DbgPrint (ASL_TREE_OUTPUT, -            "%10.32s      ", Op->Asl.Value.String); -    } -    else if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) -    {          DbgPrint (ASL_TREE_OUTPUT,              "Open: %s\n", Op->Asl.Value.String);          return (AE_OK); -    } -    else if (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END) -    { + +    case PARSEOP_INCLUDE_END: +          DbgPrint (ASL_TREE_OUTPUT,              "Close: %s\n", Op->Asl.Filename);          return (AE_OK); + +    default: + +        UtDumpBasicOp (Op, Level); +        break;      } -    else -    { -        DbgPrint (ASL_TREE_OUTPUT, "                "); -    } -    DbgPrint (ASL_TREE_OUTPUT, "    (%.4X) Flags %8.8X", -        Op->Asl.ParseOpcode, Op->Asl.CompileFlags); +    /* Dump the remaining data */ + +    DbgPrint (ASL_TREE_OUTPUT, ASL_PARSE_TREE_DEBUG1, +        Op->Asl.ParseOpcode, Op->Asl.CompileFlags, +        Op->Asl.LineNumber, Op->Asl.EndLine, +        Op->Asl.LogicalLineNumber, Op->Asl.EndLogicalLine); +      TrPrintNodeCompileFlags (Op->Asl.CompileFlags);      DbgPrint (ASL_TREE_OUTPUT, "\n");      return (AE_OK); @@ -399,6 +429,9 @@ LsWriteNodeToListing (      {      case PARSEOP_DEFINITION_BLOCK: +        /* Always start a definition block at AML offset zero */ + +        Gbl_CurrentAmlOffset = 0;          LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);          /* Use the table Signature and TableId to build a unique name */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index f36bee8f3606..955fd7f454a4 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -104,8 +104,6 @@ LdLoadNamespace (      ACPI_WALK_STATE         *WalkState; -    DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n"); -      /* Create a new walk state */      WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index cc7764a7f604..064e790a5905 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -73,36 +73,6 @@ static void  AslInitialize (      void); -UINT8 -AcpiIsBigEndianMachine ( -    void); - - -/******************************************************************************* - * - * FUNCTION:    AcpiIsBigEndianMachine - * - * PARAMETERS:  None - * - * RETURN:      TRUE if machine is big endian - *              FALSE if machine is little endian - * - * DESCRIPTION: Detect whether machine is little endian or big endian. - * - ******************************************************************************/ - -UINT8 -AcpiIsBigEndianMachine ( -    void) -{ -    union { -        UINT32              Integer; -        UINT8               Bytes[4]; -    } Overlay = {0xFF000000}; - -    return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ -} -  /*******************************************************************************   * @@ -177,6 +147,7 @@ Usage (      ACPI_OPTION ("-lm",             "Create hardware summary map file (*.map)");      ACPI_OPTION ("-ln",             "Create namespace file (*.nsp)");      ACPI_OPTION ("-ls",             "Create combined source file (expanded includes) (*.src)"); +    ACPI_OPTION ("-lx",             "Create cross-reference file (*.xrf)");      printf ("\nData Table Compiler:\n");      ACPI_OPTION ("-G",              "Compile custom table that contains generic operators"); @@ -303,6 +274,12 @@ AslInitialize (      AcpiGbl_DmOpt_Verbose = FALSE; +    /* Default integer width is 64 bits */ + +    AcpiGbl_IntegerBitWidth = 64; +    AcpiGbl_IntegerNybbleWidth = 16; +    AcpiGbl_IntegerByteWidth = 8; +      for (i = 0; i < ASL_NUM_FILES; i++)      {          Gbl_Files[i].Handle = NULL; @@ -346,7 +323,7 @@ main (       * be little-endian, and support for big-endian machines needs to       * be implemented.       */ -    if (AcpiIsBigEndianMachine ()) +    if (UtIsBigEndianMachine ())      {          fprintf (stderr,              "iASL is not currently supported on big-endian machines.\n"); diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index dec63209db8e..013f7c9aff88 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -314,22 +314,22 @@ const ASL_MAPPING_ENTRY     AslKeywordMapping [] =  /* NOT */                       OP_TABLE_ENTRY (AML_BIT_NOT_OP,             0,                              0,                  ACPI_BTYPE_INTEGER),  /* NOTIFY */                    OP_TABLE_ENTRY (AML_NOTIFY_OP,              0,                              0,                  0),  /* OBJECTTYPE */                OP_TABLE_ENTRY (AML_OBJECT_TYPE_OP,         0,                              0,                  ACPI_BTYPE_INTEGER), -/* OBJECTTYPE_BFF */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_BUFFER_FIELD,         0,                  0), -/* OBJECTTYPE_BUF */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_BUFFER,               0,                  0), -/* OBJECTTYPE_DDB */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_DDB_HANDLE,           0,                  0), -/* OBJECTTYPE_DEV */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_DEVICE,               0,                  0), -/* OBJECTTYPE_EVT */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_EVENT,                0,                  0), -/* OBJECTTYPE_FLD */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_FIELD_UNIT,           0,                  0), -/* OBJECTTYPE_INT */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_INTEGER,              0,                  0), -/* OBJECTTYPE_MTH */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_METHOD,               0,                  0), -/* OBJECTTYPE_MTX */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_MUTEX,                0,                  0), -/* OBJECTTYPE_OPR */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_REGION,               0,                  0), -/* OBJECTTYPE_PKG */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_PACKAGE,              0,                  0), -/* OBJECTTYPE_POW */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_POWER,                0,                  0), -/* OBJECTTYPE_PRO */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_PROCESSOR,            0,                  0), -/* OBJECTTYPE_STR */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_STRING,               0,                  0), -/* OBJECTTYPE_THZ */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_THERMAL,              0,                  0), -/* OBJECTTYPE_UNK */            OP_TABLE_ENTRY (AML_BYTE_OP,                ACPI_TYPE_ANY,                  0,                  0), +/* OBJECTTYPE_BFF */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_BUFFER_FIELD,         0,                  0), +/* OBJECTTYPE_BUF */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_BUFFER,               0,                  0), +/* OBJECTTYPE_DDB */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_DDB_HANDLE,           0,                  0), +/* OBJECTTYPE_DEV */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_DEVICE,               0,                  0), +/* OBJECTTYPE_EVT */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_EVENT,                0,                  0), +/* OBJECTTYPE_FLD */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_FIELD_UNIT,           0,                  0), +/* OBJECTTYPE_INT */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_INTEGER,              0,                  0), +/* OBJECTTYPE_MTH */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_METHOD,               0,                  0), +/* OBJECTTYPE_MTX */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_MUTEX,                0,                  0), +/* OBJECTTYPE_OPR */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_REGION,               0,                  0), +/* OBJECTTYPE_PKG */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_PACKAGE,              0,                  0), +/* OBJECTTYPE_POW */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_POWER,                0,                  0), +/* OBJECTTYPE_PRO */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_PROCESSOR,            0,                  0), +/* OBJECTTYPE_STR */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_STRING,               0,                  0), +/* OBJECTTYPE_THZ */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_THERMAL,              0,                  0), +/* OBJECTTYPE_UNK */            OP_TABLE_ENTRY (AML_RAW_DATA_BYTE,          ACPI_TYPE_ANY,                  0,                  0),  /* OFFSET */                    OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP,   0,                              0,                  0),  /* ONE */                       OP_TABLE_ENTRY (AML_ONE_OP,                 0,                              0,                  ACPI_BTYPE_INTEGER),  /* ONES */                      OP_TABLE_ENTRY (AML_ONES_OP,                0,                              0,                  ACPI_BTYPE_INTEGER), diff --git a/source/compiler/aslmapoutput.c b/source/compiler/aslmapoutput.c index c17b69c0b9a1..a5b19e775e08 100644 --- a/source/compiler/aslmapoutput.c +++ b/source/compiler/aslmapoutput.c @@ -533,7 +533,7 @@ MpXrefDevices (      /* Walk the entire parse tree */ -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,          MpNamespaceXrefBegin, NULL, Info);      if (!Info->References) diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c index a5c02b1cfc87..2c74ff0ff6d6 100644 --- a/source/compiler/aslmethod.c +++ b/source/compiler/aslmethod.c @@ -53,7 +53,7 @@  /* Local prototypes */ -void +static void  MtCheckNamedObjectInMethod (      ACPI_PARSE_OBJECT       *Op,      ASL_METHOD_INFO         *MethodInfo); @@ -93,6 +93,13 @@ MtMethodAnalysisWalkBegin (      UINT8                   ActualArgs = 0; +    /* Build cross-reference output file if requested */ + +    if (Gbl_CrossReferenceOutput) +    { +        OtXrefWalkPart1 (Op, Level, MethodInfo); +    } +      switch (Op->Asl.ParseOpcode)      {      case PARSEOP_METHOD: @@ -493,7 +500,7 @@ MtMethodAnalysisWalkBegin (   *   ******************************************************************************/ -void +static void  MtCheckNamedObjectInMethod (      ACPI_PARSE_OBJECT       *Op,      ASL_METHOD_INFO         *MethodInfo) diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index fcc61135fc4b..d1e4277a725b 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -1513,12 +1513,6 @@ OpcGenerateAmlOpcode (          Gbl_HasIncludeFiles = TRUE;          break; -    case PARSEOP_EXTERNAL: - -        Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -        Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -        break; -      case PARSEOP_TIMER:          if (AcpiGbl_IntegerBitWidth == 32) diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 2d33514f6397..3f84114282d0 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -1049,15 +1049,12 @@ OpnAttachNameToNode (      ACPI_PARSE_OBJECT       *Child = NULL; -    if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) -    { -        Child = UtGetArg (Op, 0); -    } -    else switch (Op->Asl.AmlOpcode) +    switch (Op->Asl.AmlOpcode)      {      case AML_DATA_REGION_OP:      case AML_DEVICE_OP:      case AML_EVENT_OP: +    case AML_EXTERNAL_OP:      case AML_METHOD_OP:      case AML_MUTEX_OP:      case AML_REGION_OP: @@ -1188,9 +1185,6 @@ OpnGenerateAmlOperands (      case PARSEOP_NAMESTRING:      case PARSEOP_METHODCALL:      case PARSEOP_STRING_LITERAL: - -        break; -      default:          break; diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index ca392b68c622..61d2cbf0c4f3 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -490,6 +490,13 @@ AslDoOptions (              Gbl_SourceOutputFlag = TRUE;              break; +        case 'x': + +            /* Produce cross-reference file */ + +            Gbl_CrossReferenceOutput = TRUE; +            break; +          default:              printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); diff --git a/source/compiler/aslprune.c b/source/compiler/aslprune.c index f15c17a9197e..11b3ad97eedd 100644 --- a/source/compiler/aslprune.c +++ b/source/compiler/aslprune.c @@ -122,7 +122,7 @@ AslPruneParseTree (      AcpiOsPrintf ("\nRemoving Objects:\n"); -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD,          PrTreePruneWalk, NULL, ACPI_CAST_PTR (void, &PruneObj));      AcpiOsPrintf ("\n%u Total Objects Removed\n", PruneObj.Count); diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index dcf0d7b23be9..ecdab19d37c6 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -338,13 +338,6 @@ RsDoGpioIntDescriptor (      Descriptor->Gpio.ResSourceOffset = (UINT16)          ACPI_PTR_DIFF (ResourceSource, Descriptor); -    DbgPrint (ASL_DEBUG_OUTPUT, -        "%16s - Actual: %.2X, Base: %.2X, ResLen: " -        "%.2X, VendLen: %.2X, IntLen: %.2X\n", -        "GpioInt", Descriptor->Gpio.ResourceLength, -        (UINT16) sizeof (AML_RESOURCE_GPIO), -        ResSourceLength, VendorLength, InterruptLength); -      /* Process all child initialization nodes */      for (i = 0; InitializerOp; i++) @@ -554,13 +547,6 @@ RsDoGpioIoDescriptor (      Descriptor->Gpio.ResSourceOffset = (UINT16)          ACPI_PTR_DIFF (ResourceSource, Descriptor); -    DbgPrint (ASL_DEBUG_OUTPUT, -        "%16s - Actual: %.2X, Base: %.2X, ResLen: " -        "%.2X, VendLen: %.2X, IntLen: %.2X\n", -        "GpioIo", Descriptor->Gpio.ResourceLength, -        (UINT16) sizeof (AML_RESOURCE_GPIO), -        ResSourceLength, VendorLength, InterruptLength); -      /* Process all child initialization nodes */      for (i = 0; InitializerOp; i++) @@ -753,13 +739,6 @@ RsDoI2cSerialBusDescriptor (      VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_I2C_SERIALBUS));      ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); -    DbgPrint (ASL_DEBUG_OUTPUT, -        "%16s - Actual: %.2X, Base: %.2X, ResLen: " -        "%.2X, VendLen: %.2X, TypLen: %.2X\n", -        "I2cSerialBus", Descriptor->I2cSerialBus.ResourceLength, -        (UINT16) sizeof (AML_RESOURCE_I2C_SERIALBUS), ResSourceLength, -        VendorLength, Descriptor->I2cSerialBus.TypeDataLength); -      /* Process all child initialization nodes */      for (i = 0; InitializerOp; i++) @@ -904,13 +883,6 @@ RsDoSpiSerialBusDescriptor (          sizeof (AML_RESOURCE_SPI_SERIALBUS));      ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); -    DbgPrint (ASL_DEBUG_OUTPUT, -        "%16s - Actual: %.2X, Base: %.2X, ResLen: " -        "%.2X, VendLen: %.2X, TypLen: %.2X\n", -        "SpiSerialBus", Descriptor->SpiSerialBus.ResourceLength, -        (UINT16) sizeof (AML_RESOURCE_SPI_SERIALBUS), ResSourceLength, -        VendorLength, Descriptor->SpiSerialBus.TypeDataLength); -      /* Process all child initialization nodes */      for (i = 0; InitializerOp; i++) @@ -1082,13 +1054,6 @@ RsDoUartSerialBusDescriptor (      VendorData = ACPI_ADD_PTR (UINT8, Descriptor, sizeof (AML_RESOURCE_UART_SERIALBUS));      ResourceSource = ACPI_ADD_PTR (char, VendorData, VendorLength); -    DbgPrint (ASL_DEBUG_OUTPUT, -        "%16s - Actual: %.2X, Base: %.2X, ResLen: " -        "%.2X, VendLen: %.2X, TypLen: %.2X\n", -        "UartSerialBus", Descriptor->UartSerialBus.ResourceLength, -        (UINT16) sizeof (AML_RESOURCE_UART_SERIALBUS), ResSourceLength, -        VendorLength, Descriptor->UartSerialBus.TypeDataLength); -      /* Process all child initialization nodes */      for (i = 0; InitializerOp; i++) diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index dcf3c22d87c9..33aef64bd429 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -469,7 +469,6 @@ ObjectTypeName      | RefOfTerm                     {}      | DerefOfTerm                   {}      | IndexTerm                     {} -  /*    | MethodInvocationTerm          {} */  /* Caused reduce/reduce with Type6Opcode->MethodInvocationTerm */      ; diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index e57df5e69e0b..47c472030918 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -120,6 +120,13 @@ AcpiDsStoreObjectToLocal (  }  ACPI_STATUS +AcpiEvInstallRegionHandlers ( +    void) +{ +    return (AE_OK); +} + +ACPI_STATUS  AcpiEvQueueNotifyRequest (      ACPI_NAMESPACE_NODE     *Node,      UINT32                  NotifyValue) diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 607b1bbbb863..8de5ba18c30c 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -249,7 +249,7 @@ TrAmlInsertPeer (  /*******************************************************************************   * - * FUNCTION:    TrAmlTransformWalk + * FUNCTION:    TrAmlTransformWalkBegin   *   * PARAMETERS:  ASL_WALK_CALLBACK   * @@ -261,7 +261,7 @@ TrAmlInsertPeer (   ******************************************************************************/  ACPI_STATUS -TrAmlTransformWalk ( +TrAmlTransformWalkBegin (      ACPI_PARSE_OBJECT       *Op,      UINT32                  Level,      void                    *Context) @@ -274,6 +274,38 @@ TrAmlTransformWalk (  /*******************************************************************************   * + * FUNCTION:    TrAmlTransformWalkEnd + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      None + * + * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML + *              operands. + * + ******************************************************************************/ + +ACPI_STATUS +TrAmlTransformWalkEnd ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ + +    /* Save possible Externals list in the DefintionBlock Op */ + +    if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) +    { +        Op->Asl.Value.Arg = Gbl_ExternalsListHead; +        Gbl_ExternalsListHead = NULL; +    } + +    return (AE_OK); +} + + +/******************************************************************************* + *   * FUNCTION:    TrTransformSubtree   *   * PARAMETERS:  Op        - The parent parse node @@ -316,6 +348,11 @@ TrTransformSubtree (          Gbl_TempCount = 0;          break; +    case PARSEOP_EXTERNAL: + +        ExDoExternal (Op); +        break; +      default:          /* Nothing to do here for other opcodes */ @@ -347,6 +384,10 @@ TrDoDefinitionBlock (      UINT32                  i; +    /* Reset external list when starting a definition block */ + +    Gbl_ExternalsListHead = NULL; +      Next = Op->Asl.Child;      for (i = 0; i < 5; i++)      { diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index c6eb57b9a0ab..97a56ec5d6e2 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -982,7 +982,7 @@ TrCreateNode (      {      case PARSEOP_ASL_CODE: -        RootNode = Op; +        Gbl_ParseTreeRoot = Op;          Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;          DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->");          break; @@ -1111,7 +1111,7 @@ TrLinkChildren (      {      case PARSEOP_ASL_CODE: -        RootNode = Op; +        Gbl_ParseTreeRoot = Op;          Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;          DbgPrint (ASL_PARSE_OUTPUT, "ASLCODE (Tree Completed)->");          break; @@ -1417,7 +1417,7 @@ TrWalkParseTree (      ACPI_STATUS             Status; -    if (!RootNode) +    if (!Gbl_ParseTreeRoot)      {          return (AE_OK);      } diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index a3a714b8ef38..411faede483f 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -81,6 +81,7 @@  typedef struct asl_method_info  {      ACPI_PARSE_OBJECT       *Op; +    ACPI_PARSE_OBJECT       *CurrentOp;      struct asl_method_info  *Next;      UINT32                  ValidArgTypes[ACPI_METHOD_NUM_ARGS];      UINT32                  ValidReturnTypes; @@ -171,12 +172,13 @@ typedef enum      ASL_FILE_ASM_INCLUDE_OUTPUT,/* .inc */      ASL_FILE_C_INCLUDE_OUTPUT,  /* .h   */      ASL_FILE_C_OFFSET_OUTPUT,   /* .offset.h */ -    ASL_FILE_MAP_OUTPUT         /* .map */ +    ASL_FILE_MAP_OUTPUT,        /* .map */ +    ASL_FILE_XREF_OUTPUT        /* .xrf */  } ASL_FILE_TYPES; -#define ASL_MAX_FILE_TYPE       16 +#define ASL_MAX_FILE_TYPE       17  #define ASL_NUM_FILES           (ASL_MAX_FILE_TYPE + 1)  /* Name suffixes used to create filenames for output files */ @@ -196,6 +198,7 @@ typedef enum  #define FILE_SUFFIX_C_INCLUDE       "h"  #define FILE_SUFFIX_C_OFFSET        "offset.h"  #define FILE_SUFFIX_MAP             "map" +#define FILE_SUFFIX_XREF            "xrf"  /* Cache block structure for ParseOps and Strings */ @@ -316,4 +319,21 @@ typedef struct asl_method_local  #define ASL_ARG_INITIALIZED     (1<<3)  #define ASL_ARG_REFERENCED      (1<<4) +/* Info used to track method counts for cross reference output file */ + +typedef struct asl_xref_info +{ +    UINT32                  ThisMethodInvocations; +    UINT32                  TotalPredefinedMethods; +    UINT32                  TotalUserMethods; +    UINT32                  TotalUnreferenceUserMethods; +    UINT32                  ThisObjectReferences; +    UINT32                  TotalObjects; +    UINT32                  TotalUnreferencedObjects; +    ACPI_PARSE_OBJECT       *MethodOp; +    ACPI_PARSE_OBJECT       *CurrentMethodOp; + +} ASL_XREF_INFO; + +  #endif  /* __ASLTYPES_H */ diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 82862afcf7c9..288fe1f9f27b 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -67,6 +67,33 @@ UtAttachNameseg (      char                    *Name); +/******************************************************************************* + * + * FUNCTION:    UtIsBigEndianMachine + * + * PARAMETERS:  None + * + * RETURN:      TRUE if machine is big endian + *              FALSE if machine is little endian + * + * DESCRIPTION: Detect whether machine is little endian or big endian. + * + ******************************************************************************/ + +UINT8 +UtIsBigEndianMachine ( +    void) +{ +    union { +        UINT32              Integer; +        UINT8               Bytes[4]; +    } Overlay =                 {0xFF000000}; + + +    return (Overlay.Bytes[0]); /* Returns 0xFF (TRUE) for big endian */ +} + +  /******************************************************************************   *   * FUNCTION:    UtQueryForOverwrite @@ -269,63 +296,6 @@ UtEndEvent (  /*******************************************************************************   * - * FUNCTION:    UtConvertByteToHex - * - * PARAMETERS:  RawByte             - Binary data - *              Buffer              - Pointer to where the hex bytes will be - *                                    stored - * - * RETURN:      Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - *              with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToHex ( -    UINT8                   RawByte, -    UINT8                   *Buffer) -{ - -    Buffer[0] = '0'; -    Buffer[1] = 'x'; - -    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); -    Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); -} - - -/******************************************************************************* - * - * FUNCTION:    UtConvertByteToAsmHex - * - * PARAMETERS:  RawByte             - Binary data - *              Buffer              - Pointer to where the hex bytes will be - *                                    stored - * - * RETURN:      Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - *              with '0', and a trailing 'h' is added. - * - ******************************************************************************/ - -void -UtConvertByteToAsmHex ( -    UINT8                   RawByte, -    UINT8                   *Buffer) -{ - -    Buffer[0] = '0'; -    Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); -    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); -    Buffer[3] = 'h'; -} - - -/******************************************************************************* - *   * FUNCTION:    DbgPrint   *   * PARAMETERS:  Type                - Type of output @@ -368,43 +338,6 @@ DbgPrint (  /*******************************************************************************   * - * FUNCTION:    UtPrintFormattedName - * - * PARAMETERS:  ParseOpcode         - Parser keyword ID - *              Level               - Indentation level - * - * RETURN:      None - * - * DESCRIPTION: Print the ascii name of the parse opcode. - * - ******************************************************************************/ - -#define TEXT_OFFSET 10 - -void -UtPrintFormattedName ( -    UINT16                  ParseOpcode, -    UINT32                  Level) -{ - -    if (Level) -    { -        DbgPrint (ASL_TREE_OUTPUT, -            "%*s", (3 * Level), " "); -    } -    DbgPrint (ASL_TREE_OUTPUT, -        " %-20.20s", UtGetOpName (ParseOpcode)); - -    if (Level < TEXT_OFFSET) -    { -        DbgPrint (ASL_TREE_OUTPUT, -            "%*s", (TEXT_OFFSET - Level) * 3, " "); -    } -} - - -/******************************************************************************* - *   * FUNCTION:    UtSetParseOpName   *   * PARAMETERS:  Op                  - Parse op to be named. @@ -973,7 +906,7 @@ UtDoConstant (      char                    ErrBuf[64]; -    Status = stroul64 (String, 0, &Converted); +    Status = AcpiUtStrtoul64 (String, 0, &Converted);      if (ACPI_FAILURE (Status))      {          sprintf (ErrBuf, "%s %s\n", "Conversion error:", @@ -985,198 +918,62 @@ UtDoConstant (  } -/* TBD: use version in ACPICA main code base? */ +#ifdef _OBSOLETE_FUNCTIONS +/* Removed 01/2016 */  /*******************************************************************************   * - * FUNCTION:    stroul64 + * FUNCTION:    UtConvertByteToHex   * - * PARAMETERS:  String              - Null terminated string - *              Terminater          - Where a pointer to the terminating byte - *                                    is returned - *              Base                - Radix of the string + * PARAMETERS:  RawByte             - Binary data + *              Buffer              - Pointer to where the hex bytes will be + *                                    stored   * - * RETURN:      Converted value + * RETURN:      Ascii hex byte is stored in Buffer.   * - * DESCRIPTION: Convert a string into an unsigned value. + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + *              with "0x"   *   ******************************************************************************/ -ACPI_STATUS -stroul64 ( -    char                    *String, -    UINT32                  Base, -    UINT64                  *RetInteger) +void +UtConvertByteToHex ( +    UINT8                   RawByte, +    UINT8                   *Buffer)  { -    UINT32                  Index; -    UINT32                  Sign; -    UINT64                  ReturnValue = 0; -    ACPI_STATUS             Status = AE_OK; - - -    *RetInteger = 0; - -    switch (Base) -    { -    case 0: -    case 8: -    case 10: -    case 16: - -        break; - -    default: -        /* -         * The specified Base parameter is not in the domain of -         * this function: -         */ -        return (AE_BAD_PARAMETER); -    } - -    /* Skip over any white space in the buffer: */ - -    while (isspace ((int) *String) || *String == '\t') -    { -        ++String; -    } - -    /* -     * The buffer may contain an optional plus or minus sign. -     * If it does, then skip over it but remember what is was: -     */ -    if (*String == '-') -    { -        Sign = ACPI_SIGN_NEGATIVE; -        ++String; -    } -    else if (*String == '+') -    { -        ++String; -        Sign = ACPI_SIGN_POSITIVE; -    } -    else -    { -        Sign = ACPI_SIGN_POSITIVE; -    } - -    /* -     * If the input parameter Base is zero, then we need to -     * determine if it is octal, decimal, or hexadecimal: -     */ -    if (Base == 0) -    { -        if (*String == '0') -        { -            if (tolower ((int) *(++String)) == 'x') -            { -                Base = 16; -                ++String; -            } -            else -            { -                Base = 8; -            } -        } -        else -        { -            Base = 10; -        } -    } - -    /* -     * For octal and hexadecimal bases, skip over the leading -     * 0 or 0x, if they are present. -     */ -    if (Base == 8 && *String == '0') -    { -        String++; -    } - -    if (Base == 16 && -        *String == '0' && -        tolower ((int) *(++String)) == 'x') -    { -        String++; -    } - -    /* Main loop: convert the string to an unsigned long */ - -    while (*String) -    { -        if (isdigit ((int) *String)) -        { -            Index = ((UINT8) *String) - '0'; -        } -        else -        { -            Index = (UINT8) toupper ((int) *String); -            if (isupper ((int) Index)) -            { -                Index = Index - 'A' + 10; -            } -            else -            { -                goto ErrorExit; -            } -        } - -        if (Index >= Base) -        { -            goto ErrorExit; -        } - -        /* Check to see if value is out of range: */ - -        if (ReturnValue > ((ACPI_UINT64_MAX - (UINT64) Index) / -            (UINT64) Base)) -        { -            goto ErrorExit; -        } -        else -        { -            ReturnValue *= Base; -            ReturnValue += Index; -        } - -        ++String; -    } - - -    /* If a minus sign was present, then "the conversion is negated": */ - -    if (Sign == ACPI_SIGN_NEGATIVE) -    { -        ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; -    } - -    *RetInteger = ReturnValue; -    return (Status); - - -ErrorExit: -    switch (Base) -    { -    case 8: -        Status = AE_BAD_OCTAL_CONSTANT; -        break; - -    case 10: - -        Status = AE_BAD_DECIMAL_CONSTANT; -        break; - -    case 16: +    Buffer[0] = '0'; +    Buffer[1] = 'x'; -        Status = AE_BAD_HEX_CONSTANT; -        break; +    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); +    Buffer[3] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); +} -    default: -        /* Base validated above */ +/******************************************************************************* + * + * FUNCTION:    UtConvertByteToAsmHex + * + * PARAMETERS:  RawByte             - Binary data + *              Buffer              - Pointer to where the hex bytes will be + *                                    stored + * + * RETURN:      Ascii hex byte is stored in Buffer. + * + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + *              with '0', and a trailing 'h' is added. + * + ******************************************************************************/ -        break; -    } +void +UtConvertByteToAsmHex ( +    UINT8                   RawByte, +    UINT8                   *Buffer) +{ -    return (Status); +    Buffer[0] = '0'; +    Buffer[1] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 4); +    Buffer[2] = (UINT8) AcpiUtHexToAsciiChar (RawByte, 0); +    Buffer[3] = 'h';  } +#endif /* OBSOLETE_FUNCTIONS */ diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index aa4f6eab3d9f..a4e5a8cdd767 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -859,10 +859,21 @@ AnAnalyzeStoreOperator (      case PARSEOP_DEREFOF:      case PARSEOP_REFOF:      case PARSEOP_INDEX: -    case PARSEOP_METHODCALL:          return; +    case PARSEOP_METHODCALL: +        /* +         * A target is not allowed to be a method call. +         * It is not supported by the ACPICA interpreter, nor is it +         * supported by the MS ASL compiler or the MS interpreter. +         * Although legal syntax up until ACPI 6.1, support for this +         * will be removed for ACPI 6.2 (02/2016) +         */ +        AslError (ASL_ERROR, ASL_MSG_SYNTAX, +            TargetOperandOp, "Illegal method invocation as a target operand"); +        return; +      default:          break;      } diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index 74038d9afa9f..a2cb6b332401 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -133,8 +133,6 @@ XfCrossReferenceNamespace (      ACPI_WALK_STATE         *WalkState; -    DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); -      /*       * Create a new walk state for use when looking up names       * within the namespace (Passed as context to the callbacks) @@ -147,8 +145,8 @@ XfCrossReferenceNamespace (      /* Walk the entire parse tree */ -    TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, XfNamespaceLocateBegin, -        XfNamespaceLocateEnd, WalkState); +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_TWICE, +        XfNamespaceLocateBegin, XfNamespaceLocateEnd, WalkState);      ACPI_FREE (WalkState);      return (AE_OK); @@ -880,7 +878,8 @@ XfNamespaceLocateBegin (              NextOp = NextOp->Asl.Next;          } -        if (Node->Value != ASL_EXTERNAL_METHOD) +        if (Node->Value != ASL_EXTERNAL_METHOD && +            Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_EXTERNAL)          {              /*               * Check the parsed arguments with the number expected by the diff --git a/source/compiler/aslxrefout.c b/source/compiler/aslxrefout.c new file mode 100644 index 000000000000..554f51fde0c5 --- /dev/null +++ b/source/compiler/aslxrefout.c @@ -0,0 +1,810 @@ +/****************************************************************************** + * + * Module Name: aslxrefout.c - support for optional cross-reference file + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2016, 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 "acnamesp.h" +#include "acparser.h" +#include "amlcode.h" + +#define _COMPONENT          ACPI_COMPILER +        ACPI_MODULE_NAME    ("aslxrefout") + + +/* Local prototypes */ + +static ACPI_STATUS +OtXrefWalkPart2 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +static ACPI_STATUS +OtXrefWalkPart3 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +static ACPI_STATUS +OtXrefAnalysisWalkPart1 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + + +static ACPI_STATUS +OtXrefAnalysisWalkPart2 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + +static ACPI_STATUS +OtXrefAnalysisWalkPart3 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context); + + +/******************************************************************************* + * + * FUNCTION:    OtPrintHeaders + * + * PARAMETERS:  Message             - Main header message + * + * RETURN:      None + * + * DESCRIPTION: Emits the main header message along with field descriptions + * + ******************************************************************************/ + +void +OtPrintHeaders ( +    char                    *Message) +{ +    UINT32                  Length; + + +    Length = strlen (Message); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\n%s\n", Message); +    while (Length) +    { +        FlPrintFile (ASL_FILE_XREF_OUTPUT, "-"); +        Length--; +    } + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nLineno   %-40s Description\n", +        "Full Pathname"); +} + + +/******************************************************************************* + * + * FUNCTION:    OtCreateXrefFile + * + * PARAMETERS:  None + * + * RETURN:      None + * + * DESCRIPTION  Main entry point for parts 2 and 3 of the cross-reference + *              file. + * + ******************************************************************************/ + +void +OtCreateXrefFile ( +    void) +{ +    ASL_XREF_INFO           XrefInfo; + + +    /* Build cross-reference output file if requested */ + +    if (!Gbl_CrossReferenceOutput) +    { +        return; +    } + +    memset (&XrefInfo, 0, sizeof (ASL_XREF_INFO)); + +    /* Cross-reference output file, part 2 (Method invocations) */ + +    OtPrintHeaders ("Part 2: Method Reference Map " +        "(Invocations of each user-defined control method)"); + +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +        OtXrefWalkPart2, NULL, &XrefInfo); + +    /* Cross-reference output file, part 3 (All other object refs) */ + +    OtPrintHeaders ("Part 3: Full Object Reference Map " +        "(Methods that reference each object in namespace"); + +    TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +        OtXrefWalkPart3, NULL, &XrefInfo); + +    /* Cross-reference summary */ + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n\nObject Summary\n"); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "\nTotal methods:                   %u\n", +        XrefInfo.TotalPredefinedMethods + XrefInfo.TotalUserMethods); +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "Total predefined methods:        %u\n", +        XrefInfo.TotalPredefinedMethods); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "\nTotal user methods:              %u\n", +        XrefInfo.TotalUserMethods); +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "Total unreferenced user methods  %u\n", +        XrefInfo.TotalUnreferenceUserMethods); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "\nTotal defined objects:           %u\n", +        XrefInfo.TotalObjects); +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "Total unreferenced objects:      %u\n", +        XrefInfo.TotalUnreferencedObjects); +} + + +/* + * Part 1 of the cross reference file. This part emits the namespace objects + * that are referenced by each control method in the namespace. + * + * Part 2 and 3 are below part 1. + */ + +/******************************************************************************* + * + * FUNCTION:    OtXrefWalkPart1 + * + * PARAMETERS:  Op                      - Current parse Op + *              Level                   - Current tree nesting level + *              MethodInfo              - Info block for the current method + * + * + * RETURN:      None + * + * DESCRIPTION: Entry point for the creation of the method call reference map. + *              For each control method in the namespace, all other methods + *              that invoke the method are listed. Predefined names/methods + *              that start with an underscore are ignored, because these are + *              essentially external/public interfaces. + + * DESCRIPTION: Entry point for the creation of the object reference map. + *              For each control method in the namespace, all objects that + *              are referenced by the method are listed. + * + *              Called during a normal namespace walk, once per namespace + *              object. (MtMethodAnalysisWalkBegin) + * + ******************************************************************************/ + +void +OtXrefWalkPart1 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    ASL_METHOD_INFO         *MethodInfo) +{ +    ACPI_NAMESPACE_NODE     *Node; +    ACPI_PARSE_OBJECT       *NextOp; +    ACPI_PARSE_OBJECT       *FieldOp; +    char                    *ParentPath; +    UINT32                  Length; +    ACPI_STATUS             Status; + + +    switch (Op->Asl.ParseOpcode) +    { +    case PARSEOP_NAMESEG: +    case PARSEOP_NAMESTRING: +    case PARSEOP_METHODCALL: + +        if (!MethodInfo || +            (MethodInfo->Op->Asl.Child == Op) || +            !Op->Asl.Node) +        { +            break; +        } + +        MethodInfo->CurrentOp = Op; +        Node = Op->Asl.Node; +        ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + +        /* Find all objects referenced by this method */ + +        Status = TrWalkParseTree (MethodInfo->Op, ASL_WALK_VISIT_DOWNWARD, +            OtXrefAnalysisWalkPart1, NULL, MethodInfo); + +        if (Status == AE_CTRL_TERMINATE) +        { +            FlPrintFile (ASL_FILE_XREF_OUTPUT, "            %-40s %s", +                ParentPath, AcpiUtGetTypeName (Node->Type)); + +            switch (Node->Type) +            { +                /* Handle externals */ + +            case ACPI_TYPE_ANY: +            case ACPI_TYPE_FIELD_UNIT: + +                FlPrintFile (ASL_FILE_XREF_OUTPUT, " <External Object>"); +                break; + +            case ACPI_TYPE_INTEGER: + +                FlPrintFile (ASL_FILE_XREF_OUTPUT, " %8.8X%8.8X", +                    ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer)); +                break; + +            case ACPI_TYPE_METHOD: + +                FlPrintFile (ASL_FILE_XREF_OUTPUT, " Invocation (%u args)", +                    Node->ArgCount); +                break; + +            case ACPI_TYPE_BUFFER_FIELD: + +                NextOp = Node->Op;              /* Create Buffer Field Op */ +                switch (NextOp->Asl.ParseOpcode) +                { +                case PARSEOP_CREATEBITFIELD: +                    Length = 1; +                    break; + +                case PARSEOP_CREATEBYTEFIELD: +                    Length = 8; +                    break; + +                case PARSEOP_CREATEWORDFIELD: +                    Length = 16; +                    break; + +                case PARSEOP_CREATEDWORDFIELD: +                    Length = 32; +                    break; + +                case PARSEOP_CREATEQWORDFIELD: +                    Length = 64; +                    break; + +                default: +                    Length = 0; +                    break; +                } + +                NextOp = NextOp->Asl.Child;     /* Buffer name */ + +                if (!NextOp->Asl.ExternalName) +                { +                    FlPrintFile (ASL_FILE_XREF_OUTPUT, " in Arg/Local"); +                } +                else +                { +                    ACPI_FREE (ParentPath); +                    ParentPath = AcpiNsGetNormalizedPathname ( +                        NextOp->Asl.Node, TRUE); + +                    FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Buffer %s", +                        Length, ParentPath); +                } +                break; + +            case ACPI_TYPE_LOCAL_REGION_FIELD: + +                NextOp = Node->Op; +                FieldOp = NextOp->Asl.Parent; +                NextOp = FieldOp->Asl.Child; + +                ACPI_FREE (ParentPath); +                ParentPath = AcpiNsGetNormalizedPathname ( +                    NextOp->Asl.Node, TRUE); + +                FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%.2u bit) in Region %s", +                    (UINT32) Node->Op->Asl.Child->Asl.Value.Integer, +                    ParentPath); + +                if (FieldOp->Asl.ParseOpcode == PARSEOP_FIELD) +                { +                    Node = NextOp->Asl.Node;        /* Region node */ +                    NextOp = Node->Op;              /* PARSEOP_REGION */ +                    NextOp = NextOp->Asl.Child;     /* Region name */ +                    NextOp = NextOp->Asl.Next; + +                    /* Get region space/addr/len? */ + +                    FlPrintFile (ASL_FILE_XREF_OUTPUT, " (%s)", +                        AcpiUtGetRegionName ((UINT8) +                        NextOp->Asl.Value.Integer)); +                } +                break; + +            default: +                break; +            } + +            FlPrintFile (ASL_FILE_XREF_OUTPUT, "\n"); +            ACPI_FREE (ParentPath); +        } +        break; + +    case PARSEOP_METHOD: + +        ParentPath = AcpiNsGetNormalizedPathname (Op->Asl.Node, TRUE); + +        FlPrintFile (ASL_FILE_XREF_OUTPUT, +            "\n[%5u]  %-40s %s Declaration (%u args)\n", +            Op->Asl.LogicalLineNumber, ParentPath, +            AcpiUtGetTypeName (Op->Asl.Node->Type), Op->Asl.Node->ArgCount); + +        ACPI_FREE (ParentPath); +        break; + +    default: +        break; +    } +} + + +/******************************************************************************* + * + * FUNCTION:    OtXrefAnalysisWalkPart1 + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      Status + * + * DESCRIPTION: Secondary walk for cross-reference part 1. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart1 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ASL_METHOD_INFO         *MethodInfo = (ASL_METHOD_INFO *) Context; +    ACPI_PARSE_OBJECT       *Next; + + +    /* Only interested in name string Ops -- ignore all others */ + +    if ((Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && +        (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && +        (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) +    { +        return (AE_OK); +    } + +    /* No node means a locally declared object -- ignore */ + +    if (!Op->Asl.Node) +    { +        return (AE_OK); +    } + +    /* When we encounter the source Op, we are done */ + +    Next = MethodInfo->CurrentOp; +    if (Next == Op) +    { +        return (AE_CTRL_TERMINATE); +    } + +    /* If we have a name match, this Op is a duplicate */ + +    if ((Next->Asl.ParseOpcode == PARSEOP_NAMESEG)      || +        (Next->Asl.ParseOpcode == PARSEOP_NAMESTRING)   || +        (Next->Asl.ParseOpcode == PARSEOP_METHODCALL)) +    { +        if (!strcmp (Op->Asl.ExternalName, Next->Asl.ExternalName)) +        { +            return (AE_ALREADY_EXISTS); +        } +    } + +    return (AE_OK); +} + + +/* + * Part 2 of the cross reference file. This part emits the names of each + * non-predefined method in the namespace (user methods), along with the + * names of each control method that references that method. + */ + +/******************************************************************************* + * + * FUNCTION:    OtXrefWalkPart2 + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      Status + * + * DESCRIPTION: For each control method in the namespace, we will re-walk the + *              namespace to find each and every invocation of that control + *              method. Brute force, but does not matter, even for large + *              namespaces. Ignore predefined names (start with underscore). + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefWalkPart2 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ASL_XREF_INFO           *XrefInfo = (ASL_XREF_INFO *) Context; +    ACPI_NAMESPACE_NODE     *Node; +    char                    *ParentPath; + + +    /* Looking for Method Declaration Ops only */ + +    if (!Op->Asl.Node || +        (Op->Asl.ParseOpcode != PARSEOP_METHOD)) +    { +        return (AE_OK); +    } + +    /* Ignore predefined names */ + +    if (Op->Asl.Node->Name.Ascii[0] == '_') +    { +        XrefInfo->TotalPredefinedMethods++; +        return (AE_OK); +    } + +    Node = Op->Asl.Node; +    ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "\n[%5u]  %-40s %s Declaration (%u args)\n", +        Op->Asl.LogicalLineNumber, ParentPath, +        AcpiUtGetTypeName (Node->Type), Node->ArgCount); + +    XrefInfo->TotalUserMethods++; +    XrefInfo->ThisMethodInvocations = 0; +    XrefInfo->MethodOp = Op; + +    (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +        OtXrefAnalysisWalkPart2, NULL, XrefInfo); + +    if (!XrefInfo->ThisMethodInvocations) +    { +        FlPrintFile (ASL_FILE_XREF_OUTPUT, +            "            Zero invocations of this method in this module\n"); +        XrefInfo->TotalUnreferenceUserMethods++; +    } +    else +    { +        FlPrintFile (ASL_FILE_XREF_OUTPUT, +            "            %u invocations of method %s in this module\n", +            XrefInfo->ThisMethodInvocations, ParentPath); +    } + +    ACPI_FREE (ParentPath); +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    OtXrefAnalysisWalkPart2 + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      Status + * + * DESCRIPTION: For every Op that is a method invocation, emit a reference + *              line if the Op is invoking the target method. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart2 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ASL_XREF_INFO           *XrefInfo = (ASL_XREF_INFO *) Context; +    ACPI_PARSE_OBJECT       *CallerOp; +    char                    *CallerFullPathname; + + +    /* Looking for MethodCall Ops only */ + +    if (!Op->Asl.Node || +        (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) +    { +        return (AE_OK); +    } + +    /* If not a match to the target method, we are done */ + +    if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node) +    { +        return (AE_CTRL_DEPTH); +    } + +    /* Find parent method to get method caller namepath */ + +    CallerOp = Op->Asl.Parent; +    while (CallerOp && +        (CallerOp->Asl.ParseOpcode != PARSEOP_METHOD)) +    { +        CallerOp = CallerOp->Asl.Parent; +    } + +    /* There is no parent method for External() statements */ + +    if (!CallerOp) +    { +        return (AE_OK); +    } + +    CallerFullPathname = AcpiNsGetNormalizedPathname ( +        CallerOp->Asl.Node, TRUE); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "[%5u]     %-40s Invocation path: %s\n", +        Op->Asl.LogicalLineNumber, CallerFullPathname, +        Op->Asl.ExternalName); + +    ACPI_FREE (CallerFullPathname); +    XrefInfo->ThisMethodInvocations++; +    return (AE_OK); +} + + +/* + * Part 3 of the cross reference file. This part emits the names of each + * non-predefined method in the namespace (user methods), along with the + * names of each control method that references that method. + */ + +/******************************************************************************* + * + * FUNCTION:    OtXrefWalkPart3 + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      Status + * + * DESCRIPTION: Cross-reference part 3. references to objects other than + *              control methods. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefWalkPart3 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ASL_XREF_INFO           *XrefInfo = (ASL_XREF_INFO *) Context; +    ACPI_NAMESPACE_NODE     *Node; +    char                    *ParentPath; +    const ACPI_OPCODE_INFO  *OpInfo; + + +    /* Ignore method declarations */ + +    if (!Op->Asl.Node || +        (Op->Asl.ParseOpcode == PARSEOP_METHOD)) +    { +        return (AE_OK); +    } + +    OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); +    if (!(OpInfo->Class & AML_CLASS_NAMED_OBJECT)) +    { +        return (AE_OK); +    } + +    /* Only care about named object creation opcodes */ + +    if ((Op->Asl.ParseOpcode != PARSEOP_NAME) && +        (Op->Asl.ParseOpcode != PARSEOP_DEVICE) && +        (Op->Asl.ParseOpcode != PARSEOP_MUTEX) && +        (Op->Asl.ParseOpcode != PARSEOP_OPERATIONREGION) && +        (Op->Asl.ParseOpcode != PARSEOP_FIELD) && +        (Op->Asl.ParseOpcode != PARSEOP_EVENT)) +    { +        return (AE_OK); +    } + +    /* Ignore predefined names */ + +    if (Op->Asl.Node->Name.Ascii[0] == '_') +    { +        return (AE_OK); +    } + +    Node = Op->Asl.Node; +    ParentPath = AcpiNsGetNormalizedPathname (Node, TRUE); + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "\n[%5u]  %-40s %s Declaration\n", +        Op->Asl.LogicalLineNumber, ParentPath, +        AcpiUtGetTypeName (Node->Type)); + +    XrefInfo->MethodOp = Op; +    XrefInfo->ThisObjectReferences = 0; +    XrefInfo->TotalObjects = 0; + +    (void) TrWalkParseTree (Gbl_ParseTreeRoot, ASL_WALK_VISIT_DOWNWARD, +        OtXrefAnalysisWalkPart3, NULL, XrefInfo); + +    if (!XrefInfo->ThisObjectReferences) +    { +        FlPrintFile (ASL_FILE_XREF_OUTPUT, +            "            Zero references to this object in this module\n"); +        XrefInfo->TotalUnreferencedObjects++; +    } +    else +    { +        FlPrintFile (ASL_FILE_XREF_OUTPUT, +            "            %u references to this object in this module\n", +            XrefInfo->ThisObjectReferences, ParentPath); +    } + +    return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION:    OtXrefAnalysisWalkPart3 + * + * PARAMETERS:  ASL_WALK_CALLBACK + * + * RETURN:      Status + * + * DESCRIPTION: Secondary walk for cross-reference part 3. + * + ******************************************************************************/ + +static ACPI_STATUS +OtXrefAnalysisWalkPart3 ( +    ACPI_PARSE_OBJECT       *Op, +    UINT32                  Level, +    void                    *Context) +{ +    ASL_XREF_INFO           *XrefInfo = (ASL_XREF_INFO *) Context; +    char                    *CallerFullPathname; +    ACPI_PARSE_OBJECT       *CallerOp; +    const char              *Operator; + + +    if (!Op->Asl.Node) +    { +        return (AE_OK); +    } + +    XrefInfo->TotalObjects++; + +    /* Ignore Op that actually defined the object */ + +    if (Op == XrefInfo->MethodOp) +    { +        return (AE_OK); +    } + +    /* Only interested in Ops that reference the target node */ + +    if (Op->Asl.Node != XrefInfo->MethodOp->Asl.Node) +    { +        return (AE_OK); +    } + +    /* Find parent "open scope" object to get method caller namepath */ + +    CallerOp = Op->Asl.Parent; +    while (CallerOp && +        (CallerOp->Asl.ParseOpcode != PARSEOP_NAME) && +        (CallerOp->Asl.ParseOpcode != PARSEOP_METHOD) && +        (CallerOp->Asl.ParseOpcode != PARSEOP_DEVICE) && +        (CallerOp->Asl.ParseOpcode != PARSEOP_POWERRESOURCE) && +        (CallerOp->Asl.ParseOpcode != PARSEOP_PROCESSOR) && +        (CallerOp->Asl.ParseOpcode != PARSEOP_THERMALZONE)) +    { +        CallerOp = CallerOp->Asl.Parent; +    } + +    /* There are some special cases for the oddball operators */ + +    if (CallerOp) +    { +        CallerFullPathname = AcpiNsGetNormalizedPathname ( +            CallerOp->Asl.Node, TRUE); +    } +    else +    { +        CallerFullPathname = "<root>"; +    } + +    if (CallerOp == XrefInfo->CurrentMethodOp) +    { +        return (AE_OK); +    } + +    if (Op->Asl.ParseOpcode == PARSEOP_SCOPE) +    { +        Operator = "Scope"; + +    } +    else if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_ALIAS) +    { +        Operator = "Alias"; +    } +    else if (!CallerOp) +    { +        Operator = "ModLevel"; +    } +    else +    { +        Operator = AcpiUtGetTypeName (CallerOp->Asl.Node->Type); +    } + +    FlPrintFile (ASL_FILE_XREF_OUTPUT, +        "[%5u]     %-40s %-8s via path: %s, Operator: %s\n", +        Op->Asl.LogicalLineNumber, +        CallerFullPathname, +        Operator, +        Op->Asl.ExternalName, +        Op->Asl.Parent->Asl.ParseOpName); + +    if (!CallerOp) +    { +        CallerOp = ACPI_TO_POINTER (0xFFFFFFFF); +    } + +    XrefInfo->CurrentMethodOp = CallerOp; +    XrefInfo->ThisObjectReferences++; +    return (AE_OK); +} diff --git a/source/compiler/dtparser.y b/source/compiler/dtparser.y index c4578e14ee01..fbd424afedf2 100644 --- a/source/compiler/dtparser.y +++ b/source/compiler/dtparser.y @@ -169,15 +169,15 @@ Expression        /* Default base for a non-prefixed integer is 16 */ -    | EXPOP_NUMBER                                  { stroul64 (DtParsertext, 16, &$$);} +    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (DtParsertext, 16, &$$);}        /* Standard hex number (0x1234) */ -    | EXPOP_HEX_NUMBER                              { stroul64 (DtParsertext, 16, &$$);} +    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (DtParsertext, 16, &$$);} -      /* TBD: Decimal number with prefix (0d1234) - Not supported by stroul64 at this time */ +      /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */ -    | EXPOP_DECIMAL_NUMBER                          { stroul64 (DtParsertext, 10, &$$);} +    | EXPOP_DECIMAL_NUMBER                          { AcpiUtStrtoul64 (DtParsertext, 10, &$$);}      ;  %% diff --git a/source/compiler/prparser.y b/source/compiler/prparser.y index 0819769202fa..ba2dc55f630c 100644 --- a/source/compiler/prparser.y +++ b/source/compiler/prparser.y @@ -182,11 +182,11 @@ Expression        /* Default base for a non-prefixed integer is 10 */ -    | EXPOP_NUMBER                                  { stroul64 (PrParsertext, 10, &$$);} +    | EXPOP_NUMBER                                  { AcpiUtStrtoul64 (PrParsertext, 10, &$$);}        /* Standard hex number (0x1234) */ -    | EXPOP_HEX_NUMBER                              { stroul64 (PrParsertext, 16, &$$);} +    | EXPOP_HEX_NUMBER                              { AcpiUtStrtoul64 (PrParsertext, 16, &$$);}      ;  %% diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index e96fba5c375e..8a4f24199eba 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -334,8 +334,7 @@ PrPreprocessInputFile (          Gbl_CurrentLineNumber++;          Gbl_LogicalLineNumber++; -        if ((Status == ASL_WITHIN_COMMENT) || -            (Status == ASL_BLANK_LINE)) +        if (Status == ASL_IGNORE_LINE)          {              goto WriteEntireLine;          } @@ -870,7 +869,8 @@ SyntaxError:   *   * RETURN:      Status of the GetLine operation:   *              AE_OK               - Normal line, OK status - *              ASL_WITHIN_COMMENT  - Line is part of a multi-line comment + *              ASL_IGNORE_LINE     - Line is blank or part of a multi-line + *                                      comment   *              ASL_EOF             - End-of-file reached   *   * DESCRIPTION: Get the next text line from the input file. Does not strip @@ -986,7 +986,7 @@ PrGetNextLine (              if (AcpiGbl_LineScanState == PR_MULTI_LINE_COMMENT)              { -                return (ASL_WITHIN_COMMENT); +                return (ASL_IGNORE_LINE);              }              /* End of single-line comment */ @@ -1001,7 +1001,7 @@ PrGetNextLine (              if (i == 1)              { -                return (ASL_BLANK_LINE); +                return (ASL_IGNORE_LINE);              }              return (AE_OK); | 
