diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2012-10-19 18:47:57 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2012-10-19 18:47:57 +0000 | 
| commit | 31aa864e8c068201d58aad3a8f82ddb51df11015 (patch) | |
| tree | 5e268c18ae0fa3ec73e13e2af60a3be57d8393ec /source/compiler | |
| parent | ebef5c959a0ea58fa05c4a5a80bb93104780bf87 (diff) | |
Notes
Diffstat (limited to 'source/compiler')
41 files changed, 344 insertions, 298 deletions
| diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 98869f569a90..c7dbaa1a1400 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslcodegen - AML code generation @@ -89,7 +88,7 @@ CgWriteNode (   *   * RETURN:      None   * - * DESCRIPTION: Generate AML code.  Currently generates the listing file + * DESCRIPTION: Generate AML code. Currently generates the listing file   *              simultaneously.   *   ******************************************************************************/ @@ -446,7 +445,7 @@ CgWriteTableHeader (      /* Compiler ID */ -    strncpy (TableHeader.AslCompilerId, ASL_CREATOR_ID, 4); +    ACPI_MOVE_NAME (TableHeader.AslCompilerId, ASL_CREATOR_ID);      /* Compiler version */ @@ -589,5 +588,3 @@ CgWriteNode (          break;      }  } - - diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 3ac3c24d67f3..f0fd3293d55a 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslcompile - top level compile module @@ -480,7 +479,7 @@ CmDoCompile (          {              UtEndEvent (Event);              CmCleanupAndExit (); -            return 0; +            return (0);          }      }      UtEndEvent (Event); @@ -548,7 +547,7 @@ CmDoCompile (      if (ACPI_FAILURE (Status))      {          AePrintErrorLog (ASL_FILE_STDERR); -        return -1; +        return (-1);      }      /* Interpret and generate all compile-time constants */ @@ -589,7 +588,7 @@ CmDoCompile (              UtDisplaySummary (ASL_FILE_STDOUT);          }          UtEndEvent (FullCompile); -        return 0; +        return (0);      }      /* @@ -621,7 +620,7 @@ CmDoCompile (      UtEndEvent (AslGbl_NamespaceEvent);      /* -     * Semantic analysis.  This can happen only after the +     * Semantic analysis. This can happen only after the       * namespace has been loaded and cross-referenced.       *       * part one - check control methods @@ -682,7 +681,7 @@ CmDoCompile (      UtEndEvent (FullCompile);      CmCleanupAndExit (); -    return 0; +    return (0);  ErrorExit:      UtEndEvent (FullCompile); @@ -905,5 +904,3 @@ CmCleanupAndExit (          FlDeleteFile (ASL_FILE_SOURCE_OUTPUT);      }  } - - diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index c68fcb45cc2b..98dc27d2216e 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslcompiler.h - common include file for iASL @@ -1128,4 +1127,3 @@ DtCreateTemplates (      char                    *Signature);  #endif /*  __ASLCOMPILER_H */ - diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y index 92ae9409cfff..d1f47da3a3a5 100644 --- a/source/compiler/aslcompiler.y +++ b/source/compiler/aslcompiler.y @@ -3509,7 +3509,7 @@ OptionalXferSize  int  AslCompilerwrap(void)  { -  return 1; +  return (1);  }  /*! [End] no source code translation !*/ diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index a83a021bfec9..0ee3c690a70f 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asldefine.h - Common defines for the iASL compiler @@ -174,4 +173,3 @@      RsCreateResourceField (Op, Name, ByteOffset, 0, 64);  #endif /* ASLDEFINE.H */ - diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index c125dfcfdce0..74c220d1214f 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslerror - Error handling and statistics @@ -95,7 +94,7 @@ AeClearErrorLog (   *   * RETURN:      None   * - * DESCRIPTION: Add a new error node to the error log.  The error log is + * DESCRIPTION: Add a new error node to the error log. The error log is   *              ordered by the "logical" line number (cumulative line number   *              including all include files.)   * @@ -783,5 +782,5 @@ AslCompilererror (          Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename,          ACPI_CAST_PTR (char, CompilerMessage)); -    return 0; +    return (0);  } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 7aa426c590d0..3a3de3819e0e 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslfiles - file I/O suppoert @@ -63,7 +62,6 @@ FlParseInputPathname (  #endif -  /*******************************************************************************   *   * FUNCTION:    AslAbort @@ -72,7 +70,7 @@ FlParseInputPathname (   *   * RETURN:      None   * - * DESCRIPTION: Dump the error log and abort the compiler.  Used for serious + * DESCRIPTION: Dump the error log and abort the compiler. Used for serious   *              I/O errors   *   ******************************************************************************/ @@ -199,7 +197,7 @@ FlGetFileSize (   *              Buffer              - Where to place the data   *              Length              - Amount to read   * - * RETURN:      Status.  AE_ERROR indicates EOF. + * RETURN:      Status. AE_ERROR indicates EOF.   *   * DESCRIPTION: Read data from an open file.   *              NOTE: Aborts compiler on any error. @@ -347,7 +345,7 @@ FlSeekFile (   *   * RETURN:      None   * - * DESCRIPTION: Close an open file.  Aborts compiler on error + * DESCRIPTION: Close an open file. Aborts compiler on error   *   ******************************************************************************/ @@ -806,7 +804,7 @@ FlOpenInputFile (   *   * RETURN:      Status   * - * DESCRIPTION: Create the output filename (*.AML) and open the file.  The file + * DESCRIPTION: Create the output filename (*.AML) and open the file. The file   *              is created in the same directory as the parent input file.   *   ******************************************************************************/ @@ -1147,5 +1145,3 @@ FlParseInputPathname (      return (AE_OK);  }  #endif - - diff --git a/source/compiler/aslfold.c b/source/compiler/aslfold.c index 425a328a9e88..e8e6b31c53aa 100644 --- a/source/compiler/aslfold.c +++ b/source/compiler/aslfold.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslfold - Constant folding @@ -334,7 +333,7 @@ OpcAmlConstantWalk (      WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);      if (!WalkState)      { -        return AE_NO_MEMORY; +        return (AE_NO_MEMORY);      }      WalkState->NextOp = NULL; diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 0451fecd7101..987ed1c2a2cf 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -1,5 +1,3 @@ - -  /******************************************************************************   *   * Module Name: aslglobal.h - Global variable definitions @@ -49,7 +47,7 @@  /* - * Global variables.  Defined in aslmain.c only, externed in all other files + * Global variables. Defined in aslmain.c only, externed in all other files   */  #undef ASL_EXTERN @@ -254,4 +252,3 @@ ASL_EXTERN char                     StringBuffer2[ASL_MSG_BUFFER_SIZE];  #endif /* __ASLGLOBAL_H */ - diff --git a/source/compiler/asllength.c b/source/compiler/asllength.c index ed88de9847fd..2207f362918b 100644 --- a/source/compiler/asllength.c +++ b/source/compiler/asllength.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asllength - Tree walk to determine package and opcode lengths @@ -80,7 +79,7 @@ LnAdjustLengthToRoot (   * RETURN:      Status   *   * DESCRIPTION: Walk callback to initialize (and re-initialize) the node - *              subtree length(s) to zero.  The Subtree lengths are bubbled + *              subtree length(s) to zero. The Subtree lengths are bubbled   *              up to the root node in order to get a total AML length.   *   ******************************************************************************/ @@ -112,7 +111,7 @@ LnInitLengthsWalk (   *                 them all into the parent subtree length.   *   * Note:  The SubtreeLength represents the total AML length of all child nodes - *        in all subtrees under a given node.  Therefore, once this walk is + *        in all subtrees under a given node. Therefore, once this walk is   *        complete, the Root Node subtree length is the AML length of the entire   *        tree (and thus, the entire ACPI table)   * @@ -426,7 +425,7 @@ CgGenerateAmlLengths (   * RETURN:      None.   *   * DESCRIPTION: Change the Subtree length of the given node, and bubble the - *              change all the way up to the root node.  This allows for + *              change all the way up to the root node. This allows for   *              last second changes to a package length (for example, if the   *              package length encoding gets shorter or longer.)   * @@ -454,5 +453,3 @@ LnAdjustLengthToRoot (      Gbl_TableLength -= LengthDelta;  }  #endif - - diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c index c865df6d0f1d..339cc01ac4c6 100644 --- a/source/compiler/asllisting.c +++ b/source/compiler/asllisting.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asllisting - Listing file generation @@ -340,7 +339,7 @@ LsAmlListingWalk (   *   * RETURN:      None   * - * DESCRIPTION: Generate a listing file.  This can be one of the several types + * DESCRIPTION: Generate a listing file. This can be one of the several types   *              of "listings" supported.   *   ******************************************************************************/ @@ -421,7 +420,7 @@ LsDoListings (   *   * RETURN:      None   * - * DESCRIPTION: Push a listing node on the listing/include file stack.  This + * DESCRIPTION: Push a listing node on the listing/include file stack. This   *              stack enables tracking of include files (infinitely nested)   *              and resumption of the listing of the parent file when the   *              include file is finished. @@ -479,7 +478,7 @@ LsPopNode (      {          AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,              "Could not pop empty listing stack"); -        return Gbl_ListingNode; +        return (Gbl_ListingNode);      }      Gbl_ListingNode = Lnode->Next; @@ -501,8 +500,8 @@ LsPopNode (   * RETURN:      None   *   * DESCRIPTION: Check if there is an exception for this line, and if there is, - *              put it in the listing immediately.  Handles multiple errors - *              per line.  Gbl_NextError points to the next error in the + *              put it in the listing immediately. Handles multiple errors + *              per line. Gbl_NextError points to the next error in the   *              sorted (by line #) list of compile errors/warnings.   *   ******************************************************************************/ @@ -545,7 +544,7 @@ LsCheckException (   * RETURN:      None   *   * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code - *              buffer.  Usually called at the termination of a single line + *              buffer. Usually called at the termination of a single line   *              of source code or when the buffer is full.   *   ******************************************************************************/ @@ -653,7 +652,7 @@ LsFlushListingBuffer (   * RETURN:      None   *   * DESCRIPTION: Write the contents of the AML buffer to the listing file via - *              the listing buffer.  The listing buffer is flushed every 16 + *              the listing buffer. The listing buffer is flushed every 16   *              AML bytes.   *   ******************************************************************************/ @@ -807,7 +806,7 @@ LsWriteOneSourceLine (   *   * RETURN:      None   * - * DESCRIPTION: Cleanup routine for the listing file.  Flush the hex AML + * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML   *              listing buffer, and flush out any remaining lines in the   *              source input file.   * @@ -868,7 +867,7 @@ LsFinishSourceListing (   * RETURN:      None   *   * DESCRIPTION: Read then write source lines to the listing file until we have - *              reached the specified logical (cumulative) line number.  This + *              reached the specified logical (cumulative) line number. This   *              automatically echos out comment blocks and other non-AML   *              generating text until we get to the actual AML-generating line   *              of ASL code specified by the logical line number. @@ -937,7 +936,7 @@ LsWriteSourceLines (   *   * RETURN:      None.   * - * DESCRIPTION: Write "a node" to the listing file.  This means to + * DESCRIPTION: Write "a node" to the listing file. This means to   *              1) Write out all of the source text associated with the node   *              2) Write out all of the AML bytes associated with the node   *              3) Write any compiler exceptions associated with the node @@ -1289,7 +1288,7 @@ LsDoHexOutput (   *   * RETURN:      None.   * - * DESCRIPTION: Create the hex output file.  This is the same data as the AML + * DESCRIPTION: Create the hex output file. This is the same data as the AML   *              output file, but formatted into hex/ascii bytes suitable for   *              inclusion into a C source file.   * @@ -1377,7 +1376,7 @@ LsDoHexOutputC (   *   * RETURN:      None.   * - * DESCRIPTION: Create the hex output file.  This is the same data as the AML + * DESCRIPTION: Create the hex output file. This is the same data as the AML   *              output file, but formatted into hex/ascii bytes suitable for   *              inclusion into a C source file.   * @@ -1465,7 +1464,7 @@ LsDoHexOutputAsl (   *   * RETURN:      None.   * - * DESCRIPTION: Create the hex output file.  This is the same data as the AML + * DESCRIPTION: Create the hex output file. This is the same data as the AML   *              output file, but formatted into hex/ascii bytes suitable for   *              inclusion into a ASM source file.   * @@ -1538,5 +1537,3 @@ LsDoHexOutputAsm (      FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");  } - - diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index c3a0d644f4b1..743607103b78 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -113,7 +113,7 @@ LdLoadNamespace (      WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);      if (!WalkState)      { -        return AE_NO_MEMORY; +        return (AE_NO_MEMORY);      }      /* Walk the entire parse tree, first pass */ @@ -129,7 +129,7 @@ LdLoadNamespace (      /* Dump the namespace if debug is enabled */      AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX); -    return AE_OK; +    return (AE_OK);  } @@ -894,5 +894,3 @@ LdCommonNamespaceEnd (      return (AE_OK);  } - - diff --git a/source/compiler/asllookup.c b/source/compiler/asllookup.c index 6df64366b3bf..8bd93559bc51 100644 --- a/source/compiler/asllookup.c +++ b/source/compiler/asllookup.c @@ -423,7 +423,7 @@ LsDoOnePathname (   * RETURN:      Status   *   * DESCRIPTION: Walk the namespace an display information about each node - *              in the tree.  Information is written to the optional + *              in the tree. Information is written to the optional   *              namespace output file.   *   ******************************************************************************/ @@ -691,8 +691,8 @@ LkFindUnreferencedObjects (   * RETURN:      Status   *   * DESCRIPTION: Perform a cross reference check of the parse tree against the - *              namespace.  Every named referenced within the parse tree - *              should be get resolved with a namespace lookup.  If not, the + *              namespace. Every named referenced within the parse tree + *              should be get resolved with a namespace lookup. If not, the   *              original reference in the ASL code is invalid -- i.e., refers   *              to a non-existent object.   * @@ -718,14 +718,14 @@ LkCrossReferenceNamespace (      WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);      if (!WalkState)      { -        return AE_NO_MEMORY; +        return (AE_NO_MEMORY);      }      /* Walk the entire parse tree */      TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin,                          LkNamespaceLocateEnd, WalkState); -    return AE_OK; +    return (AE_OK);  } @@ -759,7 +759,7 @@ LkCheckFieldRange (      /* -     * Check each field unit against the region size.  The entire +     * Check each field unit against the region size. The entire       * field unit (start offset plus length) must fit within the       * region.       */ @@ -775,7 +775,7 @@ LkCheckFieldRange (      /*       * Now check that the field plus AccessWidth doesn't go beyond -     * the end-of-region.  Assumes AccessBitWidth is a power of 2 +     * the end-of-region. Assumes AccessBitWidth is a power of 2       */      FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); @@ -795,13 +795,13 @@ LkCheckFieldRange (   *   * RETURN:      Status   * - * DESCRIPTION: Descending callback used during cross-reference.  For named + * DESCRIPTION: Descending callback used during cross-reference. For named   *              object references, attempt to locate the name in the   *              namespace.   *   * NOTE: ASL references to named fields within resource descriptors are - *       resolved to integer values here.  Therefore, this step is an - *       important part of the code generation.  We don't know that the + *       resolved to integer values here. Therefore, this step is an + *       important part of the code generation. We don't know that the   *       name refers to a resource descriptor until now.   *   ******************************************************************************/ @@ -835,7 +835,7 @@ LkNamespaceLocateBegin (      /*       * If this node is the actual declaration of a name       * [such as the XXXX name in "Method (XXXX)"], -     * we are not interested in it here.  We only care about names that are +     * we are not interested in it here. We only care about names that are       * references to other objects within the namespace and the parent objects       * of name declarations       */ @@ -921,7 +921,7 @@ LkNamespaceLocateBegin (          "Type=%s\n", AcpiUtGetTypeName (ObjectType)));      /* -     * Lookup the name in the namespace.  Name must exist at this point, or it +     * Lookup the name in the namespace. Name must exist at this point, or it       * is an invalid reference.       *       * The namespace is also used as a lookup table for references to resource @@ -1226,9 +1226,9 @@ LkNamespaceLocateBegin (               (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))      {          /* -         * Offset checking for fields.  If the parent operation region has a +         * Offset checking for fields. If the parent operation region has a           * constant length (known at compile time), we can check fields -         * defined in that region against the region length.  This will catch +         * defined in that region against the region length. This will catch           * fields and field units that cannot possibly fit within the region.           *           * Note: Index fields do not directly reference an operation region, @@ -1238,7 +1238,7 @@ LkNamespaceLocateBegin (          {              /*               * This is the first child of the field node, which is -             * the name of the region.  Get the parse node for the +             * the name of the region. Get the parse node for the               * region -- which contains the length of the region.               */              OwningOp = Node->Op; @@ -1315,7 +1315,7 @@ LkNamespaceLocateBegin (          else          {              /* -             * This is one element of the field list.  Check to make sure +             * This is one element of the field list. Check to make sure               * that it does not go beyond the end of the parent operation region.               *               * In the code below: @@ -1348,7 +1348,7 @@ LkNamespaceLocateBegin (   *   * RETURN:      Status   * - * DESCRIPTION: Ascending callback used during cross reference.  We only + * DESCRIPTION: Ascending callback used during cross reference. We only   *              need to worry about scope management here.   *   ******************************************************************************/ @@ -1397,5 +1397,3 @@ LkNamespaceLocateEnd (      return (AE_OK);  } - - diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 75262c76ac11..09eb9fcf702e 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslmain - compiler main and utilities @@ -124,6 +123,7 @@ Options (      printf ("\nGlobal:\n");      ACPI_OPTION ("-@ <file>",       "Specify command file");      ACPI_OPTION ("-I <dir>",        "Specify additional include directory"); +    ACPI_OPTION ("-T <sig>|ALL|*",  "Create table template file for ACPI <Sig>");      ACPI_OPTION ("-v",              "Display compiler version");      printf ("\nPreprocessor:\n"); @@ -142,10 +142,10 @@ Options (      ACPI_OPTION ("-w1 -w2 -w3",     "Set warning reporting level");      ACPI_OPTION ("-we",             "Report warnings as errors"); -    printf ("\nAML Output Files:\n"); -    ACPI_OPTION ("-sa -sc",         "Create AML in assembler or C source file (*.asm or *.c)"); +    printf ("\nAML and Data Output Files:\n"); +    ACPI_OPTION ("-sa -sc",         "Create assembler or C source file (*.asm or *.c)");      ACPI_OPTION ("-ia -ic",         "Create assembler or C include file (*.inc or *.h)"); -    ACPI_OPTION ("-ta -tc -ts",     "Create AML in assembler, C, or ASL hex table (*.hex)"); +    ACPI_OPTION ("-ta -tc -ts",     "Create assembler, C, or ASL hex table (*.hex)");      printf ("\nAML Code Generation:\n");      ACPI_OPTION ("-oa",             "Disable all optimizations (compatibility mode)"); @@ -162,7 +162,6 @@ Options (      printf ("\nACPI Data Tables:\n");      ACPI_OPTION ("-G",              "Compile custom table containing generic operators"); -    ACPI_OPTION ("-T <sig>|ALL|*",  "Create table template file(s) for <Sig>");      ACPI_OPTION ("-vt",             "Create verbose templates (full disassembly)");      printf ("\nAML Disassembler:\n"); @@ -174,6 +173,7 @@ Options (      ACPI_OPTION ("-e  [f1,f2]",     "Include ACPI table(s) for external symbol resolution");      ACPI_OPTION ("-2",              "Emit ACPI 2.0 compatible ASL code");      ACPI_OPTION ("-g",              "Get ACPI tables and write to files (*.dat)"); +    ACPI_OPTION ("-vt",             "Dump binary table data in hex format within output file");      printf ("\nHelp:\n");      ACPI_OPTION ("-h",              "This message"); @@ -211,7 +211,7 @@ FilenameHelp (      printf ("\nAML output filename generation:\n");      printf ("  Output filenames are generated by appending an extension to a common\n"); -    printf ("  filename prefix.  The filename prefix is obtained via one of the\n"); +    printf ("  filename prefix. The filename prefix is obtained via one of the\n");      printf ("  following methods (in priority order):\n");      printf ("    1) The -p option specifies the prefix\n");      printf ("    2) The prefix of the AMLFileName in the ASL Definition Block\n"); @@ -389,7 +389,7 @@ AslDoResponseFile (      {          printf ("Could not open command file %s, %s\n",              Filename, strerror (errno)); -        return -1; +        return (-1);      }      /* Must save the current GetOpt globals */ @@ -1070,5 +1070,3 @@ main (      return (0);  } - - diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 240175dc867c..b9798a7e4943 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslmap - parser to AML opcode mapping table @@ -100,7 +99,7 @@ AslMapNamedOpcodeToDataType (   *   * DATA STRUCTURE:  AslKeywordMapping   * - * DESCRIPTION:     Maps the ParseOpcode to the actual AML opcode.  The parse + * DESCRIPTION:     Maps the ParseOpcode to the actual AML opcode. The parse   *                  opcodes are generated from Bison, and this table must   *                  track any additions to them.   * @@ -451,5 +450,3 @@ const ASL_MAPPING_ENTRY     AslKeywordMapping [] =  /*! [End] no source code translation !*/  }; - - diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index f2d86d0b0fbb..07758efd0184 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslmessages.h - Compiler error/warning messages diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 9f3e15d6be81..bd16cb5eb528 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslopcode - AML opcode generation @@ -188,10 +187,10 @@ OpcGetIntegerWidth (   *   * PARAMETERS:  Op        - A parse tree node   * - * RETURN:      Integer width, in bytes.  Also sets the node AML opcode to the + * RETURN:      Integer width, in bytes. Also sets the node AML opcode to the   *              optimal integer AML prefix opcode.   * - * DESCRIPTION: Determine the optimal AML encoding of an integer.  All leading + * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading   *              zeros can be truncated to squeeze the integer into the   *              minimal number of AML bytes.   * @@ -211,7 +210,7 @@ OpcSetOptimalIntegerSize (          Op->Asl.Parent->Asl.Parent &&         (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))      { -        return 0; +        return (0);      }  #endif @@ -231,14 +230,14 @@ OpcSetOptimalIntegerSize (              Op->Asl.AmlOpcode = AML_ZERO_OP;              AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,                  Op, "Zero"); -            return 1; +            return (1);          case 1:              Op->Asl.AmlOpcode = AML_ONE_OP;              AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,                  Op, "One"); -            return 1; +            return (1);          case ACPI_UINT32_MAX: @@ -249,7 +248,7 @@ OpcSetOptimalIntegerSize (                  Op->Asl.AmlOpcode = AML_ONES_OP;                  AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,                      Op, "Ones"); -                return 1; +                return (1);              }              break; @@ -262,7 +261,7 @@ OpcSetOptimalIntegerSize (                  Op->Asl.AmlOpcode = AML_ONES_OP;                  AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,                      Op, "Ones"); -                return 1; +                return (1);              }              break; @@ -276,17 +275,17 @@ OpcSetOptimalIntegerSize (      if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX)      {          Op->Asl.AmlOpcode = AML_BYTE_OP; -        return 1; +        return (1);      }      if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX)      {          Op->Asl.AmlOpcode = AML_WORD_OP; -        return 2; +        return (2);      }      if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX)      {          Op->Asl.AmlOpcode = AML_DWORD_OP; -        return 4; +        return (4);      }      else      { @@ -299,12 +298,12 @@ OpcSetOptimalIntegerSize (              {                  /* Truncate the integer to 32-bit */                  Op->Asl.AmlOpcode = AML_DWORD_OP; -                return 4; +                return (4);              }          }          Op->Asl.AmlOpcode = AML_QWORD_OP; -        return 8; +        return (8);      }  } @@ -459,7 +458,7 @@ OpcDoConnection (   * RETURN:      None   *   * DESCRIPTION: Implement the UNICODE ASL "macro".  Convert the input string - *              to a unicode buffer.  There is no Unicode AML opcode. + *              to a unicode buffer. There is no Unicode AML opcode.   *   * Note:  The Unicode string is 16 bits per character, no leading signature,   *        with a 16-bit terminating NULL. @@ -535,19 +534,19 @@ OpcDoUnicode (   *   * RETURN:      None   * - * DESCRIPTION: Convert a string EISA ID to numeric representation.  See the - *              Pnp BIOS Specification for details.  Here is an excerpt: + * DESCRIPTION: Convert a string EISA ID to numeric representation. See the + *              Pnp BIOS Specification for details. Here is an excerpt:   *   *              A seven character ASCII representation of the product - *              identifier compressed into a 32-bit identifier.  The seven + *              identifier compressed into a 32-bit identifier. The seven   *              character ID consists of a three character manufacturer code,   *              a three character hexadecimal product identifier, and a one - *              character hexadecimal revision number.  The manufacturer code + *              character hexadecimal revision number. The manufacturer code   *              is a 3 uppercase character code that is compressed into 3 5-bit   *              values as follows:   *                  1) Find hex ASCII value for each letter   *                  2) Subtract 40h from each ASCII value - *                  3) Retain 5 least signficant bits for each letter by + *                  3) Retain 5 least significant bits for each letter by   *                     discarding upper 3 bits because they are always 0.   *                  4) Compressed code = concatenate 0 and the 3 5-bit values   * @@ -726,7 +725,7 @@ OpcDoUuId (   * RETURN:      None   *   * DESCRIPTION: Generate the AML opcode associated with the node and its - *              parse (lex/flex) keyword opcode.  Essentially implements + *              parse (lex/flex) keyword opcode. Essentially implements   *              a mapping between the parse opcodes and the actual AML opcodes.   *   ******************************************************************************/ @@ -810,5 +809,3 @@ OpcGenerateAmlOpcode (      return;  } - - diff --git a/source/compiler/asloperands.c b/source/compiler/asloperands.c index 6d4433d873ea..d4d93c8845de 100644 --- a/source/compiler/asloperands.c +++ b/source/compiler/asloperands.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asloperands - AML operand processing @@ -263,7 +262,7 @@ OpnDoFieldCommon (      UpdateRule = (UINT8) Next->Asl.Value.Integer;      /* -     * Generate the flags byte.  The various fields are already +     * Generate the flags byte. The various fields are already       * in the right bit position via translation from the       * keywords by the parser.       */ @@ -326,7 +325,7 @@ OpnDoFieldCommon (              {                  /*                   * Offset is redundant; we don't need to output an -                 * offset opcode.  Just set these nodes to default +                 * offset opcode. Just set these nodes to default                   */                  Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;                  PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; @@ -502,7 +501,7 @@ OpnDoBankField (   *   * RETURN:      None   * - * DESCRIPTION: Tries to get the length of the region.  Can only do this at + * DESCRIPTION: Tries to get the length of the region. Can only do this at   *              compile time if the length is a constant.   *   ******************************************************************************/ @@ -549,7 +548,7 @@ OpnDoRegion (   *   * RETURN:      None   * - * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword.  We + * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We   *              build a single raw byte buffer from the initialization nodes,   *              each parse node contains a buffer byte.   * @@ -615,7 +614,7 @@ OpnDoBuffer (      case PARSEOP_STRING_LITERAL:          /* -         * Only one initializer, the string.  Buffer must be big enough to hold +         * Only one initializer, the string. Buffer must be big enough to hold           * the string plus the null termination byte           */          BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; @@ -682,7 +681,7 @@ OpnDoBuffer (   *   * RETURN:      None   * - * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword.  NOTE: + * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE:   *              can only be called after constants have been folded, to ensure   *              that the PackageLength operand has been fully reduced.   * @@ -898,7 +897,7 @@ OpnDoDefinitionBlock (      /* -     * These nodes get stuffed into the table header.  They are special +     * These nodes get stuffed into the table header. They are special       * cased when the table is written to the output file.       *       * Mark all of these nodes as non-usable so they won't get output @@ -998,7 +997,7 @@ OpnDoDefinitionBlock (   * PARAMETERS:  Op              - Get an argument for this op   *              Argn            - Nth argument to get   * - * RETURN:      The argument (as an Op object).  NULL if argument does not exist + * RETURN:      The argument (as an Op object). NULL if argument does not exist   *   * DESCRIPTION: Get the specified op's argument (peer)   * @@ -1111,7 +1110,7 @@ OpnAttachNameToNode (   *   * RETURN:      None   * - * DESCRIPTION: Prepare nodes to be output as AML data and operands.  The more + * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more   *              complex AML opcodes require processing of the child nodes   *              (arguments/operands).   * @@ -1184,5 +1183,3 @@ OpnGenerateAmlOperands (      OpnAttachNameToNode (Op);  } - - diff --git a/source/compiler/aslopt.c b/source/compiler/aslopt.c index b31c5870b60d..fedc5ff0dc1d 100644 --- a/source/compiler/aslopt.c +++ b/source/compiler/aslopt.c @@ -127,9 +127,9 @@ OptSearchToRoot (      /* -     * Check if search-to-root can be utilized.  Use the last NameSeg of +     * Check if search-to-root can be utilized. Use the last NameSeg of       * the NamePath and 1) See if can be found and 2) If found, make -     * sure that it is the same node that we want.  If there is another +     * sure that it is the same node that we want. If there is another       * name in the search path before the one we want, the nodes will       * not match, and we cannot use this optimization.       */ @@ -149,7 +149,7 @@ OptSearchToRoot (      /*       * We found the name, but we must check to make sure that the node -     * matches.  Otherwise, there is another identical name in the search +     * matches. Otherwise, there is another identical name in the search       * path that precludes the use of this optimization.       */      if (Node != TargetNode) @@ -233,7 +233,7 @@ OptBuildShortestPath (      /*       * Determine the maximum number of NameSegs that the Target and Current paths -     * can possibly have in common.  (To optimize, we have to have at least 1) +     * can possibly have in common. (To optimize, we have to have at least 1)       *       * Note: The external NamePath string lengths are always a multiple of 5       * (ACPI_NAME_SIZE + separator) @@ -254,12 +254,11 @@ OptBuildShortestPath (      {          /* Compare two single NameSegs */ -        if (ACPI_STRNCMP ( -            &((char *) TargetPath->Pointer)[(NumCommonSegments * -                                             ACPI_PATH_SEGMENT_LENGTH) + 1], -            &((char *) CurrentPath->Pointer)[(NumCommonSegments * -                                              ACPI_PATH_SEGMENT_LENGTH) + 1], -            ACPI_NAME_SIZE)) +        if (!ACPI_COMPARE_NAME ( +            &((char *) TargetPath->Pointer)[ +                (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1], +            &((char *) CurrentPath->Pointer)[ +                (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1]))          {              /* Mismatch */ @@ -371,7 +370,7 @@ OptBuildShortestPath (      /*       * Check to make sure that the optimization finds the node we are -     * looking for.  This is simply a sanity check on the new +     * looking for. This is simply a sanity check on the new       * path that has been created.       */      Status = AcpiNsLookup (&ScopeInfo,  NewPath, @@ -453,7 +452,7 @@ OptOptimizeNameDeclaration (      {          /*           * The current scope is the root, and the namepath has a root prefix -         * that is therefore extraneous.  Remove it. +         * that is therefore extraneous. Remove it.           */          *NewPath = &AmlNameString[1]; @@ -470,7 +469,7 @@ OptOptimizeNameDeclaration (          /*           * Check to make sure that the optimization finds the node we are -         * looking for.  This is simply a sanity check on the new +         * looking for. This is simply a sanity check on the new           * path that has been created.           *           * We know that we are at the root, so NULL is used for the scope. @@ -533,7 +532,7 @@ OptOptimizeNameDeclaration (   *              AmlNameString       - Unoptimized namepath   *              TargetNode          - Node to which AmlNameString refers   * - * RETURN:      None.  If path is optimized, the Op is updated with new path + * RETURN:      None. If path is optimized, the Op is updated with new path   *   * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length.   *              Must take into account both the current location in the @@ -608,7 +607,7 @@ OptOptimizeNamePath (      /*       * We need to obtain the node that represents the current scope -- where -     * we are right now in the namespace.  We will compare this path +     * we are right now in the namespace. We will compare this path       * against the Namepath, looking for commonality.       */      CurrentNode = AcpiGbl_RootNode; @@ -741,7 +740,7 @@ OptOptimizeNamePath (      /*       * Success from above indicates that the NamePath was successfully -     * optimized.  We need to update the parse op with the new name +     * optimized. We need to update the parse op with the new name       */      if (ACPI_SUCCESS (Status))      { @@ -803,4 +802,3 @@ OptOptimizeNamePath (      ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n"));      return_VOID;  } - diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index 8dbbb2652f85..9337e88309b7 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslresource - Resource template/descriptor utilities @@ -398,7 +397,7 @@ RsGetStringDataLength (          InitializerOp = ASL_GET_PEER_NODE (InitializerOp);      } -    return 0; +    return (0);  } @@ -449,7 +448,7 @@ RsAllocateResourceNode (   * RETURN:      None, sets fields within the input node   *   * DESCRIPTION: Utility function to generate a named bit field within a - *              resource descriptor.  Mark a node as 1) a field in a resource + *              resource descriptor. Mark a node as 1) a field in a resource   *              descriptor, and 2) set the value to be a BIT offset   *   ******************************************************************************/ @@ -484,8 +483,8 @@ RsCreateResourceField (   * RETURN:      Sets bits within the *Flags output byte.   *   * DESCRIPTION: Set a bit in a cumulative flags word from an initialization - *              node.  Will use a default value if the node is DEFAULT, meaning - *              that no value was specified in the ASL.  Used to merge multiple + *              node. Will use a default value if the node is DEFAULT, meaning + *              that no value was specified in the ASL. Used to merge multiple   *              keywords into a single flags byte.   *   ******************************************************************************/ @@ -929,7 +928,7 @@ RsLinkDescriptorChain (      if (!Rnode)      { -        return 0; +        return (0);      }      /* Point the previous node to the new node */ @@ -949,7 +948,7 @@ RsLinkDescriptorChain (      /* Previous node becomes the last node in the chain */      *PreviousRnode = LastRnode; -    return CurrentByteOffset; +    return (CurrentByteOffset);  } @@ -959,7 +958,7 @@ RsLinkDescriptorChain (   *   * PARAMETERS:  Op        - Parent of a resource template list   * - * RETURN:      None.  Sets input node to point to a list of AML code + * RETURN:      None. Sets input node to point to a list of AML code   *   * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer,   *              in preparation for output to the AML output file. @@ -1016,7 +1015,7 @@ RsDoResourceTemplate (          /*           * Update current byte offset to indicate the number of bytes from the -         * start of the buffer.  Buffer can include multiple descriptors, we +         * start of the buffer. Buffer can include multiple descriptors, we           * must keep track of the offset of not only each descriptor, but each           * element (field) within each descriptor as well.           */ diff --git a/source/compiler/aslrestype1.c b/source/compiler/aslrestype1.c index d7ec6c4becca..737464547d10 100644 --- a/source/compiler/aslrestype1.c +++ b/source/compiler/aslrestype1.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype1 - Miscellaneous small resource descriptors @@ -498,7 +497,7 @@ RsDoStartDependentDescriptor (              /*               * Update current byte offset to indicate the number of bytes from the -             * start of the buffer.  Buffer can include multiple descriptors, we +             * start of the buffer. Buffer can include multiple descriptors, we               * must keep track of the offset of not only each descriptor, but each               * element (field) within each descriptor as well.               */ @@ -563,7 +562,7 @@ RsDoStartDependentNoPriDescriptor (          /*           * Update current byte offset to indicate the number of bytes from the -         * start of the buffer.  Buffer can include multiple descriptors, we +         * start of the buffer. Buffer can include multiple descriptors, we           * must keep track of the offset of not only each descriptor, but each           * element (field) within each descriptor as well.           */ @@ -650,4 +649,3 @@ RsDoVendorSmallDescriptor (      Descriptor->VendorSmall.DescriptorType |= (UINT8) i;      return (Rnode);  } - diff --git a/source/compiler/aslrestype1i.c b/source/compiler/aslrestype1i.c index 1178fd003ddb..d24287917227 100644 --- a/source/compiler/aslrestype1i.c +++ b/source/compiler/aslrestype1i.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype1i - Small I/O-related resource descriptors diff --git a/source/compiler/aslrestype2d.c b/source/compiler/aslrestype2d.c index 8887e39028cf..f0c575537e78 100644 --- a/source/compiler/aslrestype2d.c +++ b/source/compiler/aslrestype2d.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype2d - Large DWord address resource descriptors diff --git a/source/compiler/aslrestype2e.c b/source/compiler/aslrestype2e.c index 5da52914e0c2..f1321fb8ee8a 100644 --- a/source/compiler/aslrestype2e.c +++ b/source/compiler/aslrestype2e.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype2e - Large Extended address resource descriptors diff --git a/source/compiler/aslrestype2q.c b/source/compiler/aslrestype2q.c index 473f259d216a..4d92fe828b57 100644 --- a/source/compiler/aslrestype2q.c +++ b/source/compiler/aslrestype2q.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype2q - Large QWord address resource descriptors diff --git a/source/compiler/aslrestype2w.c b/source/compiler/aslrestype2w.c index 154de2f07fb4..01d241e7532d 100644 --- a/source/compiler/aslrestype2w.c +++ b/source/compiler/aslrestype2w.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslrestype2w - Large Word address resource descriptors diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 1f51c7115a5a..4d556f274622 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslstartup - Compiler startup routines, called from main @@ -231,8 +230,12 @@ AslDetectSourceFileType (      if (ACPI_FAILURE (Status))      {          printf ("Non-ascii input file - %s\n", Info->Filename); -        Type = ASL_INPUT_TYPE_BINARY; -        goto Cleanup; + +        if (!Gbl_IgnoreErrors) +        { +            Type = ASL_INPUT_TYPE_BINARY; +            goto Cleanup; +        }      }      /* diff --git a/source/compiler/aslstubs.c b/source/compiler/aslstubs.c index cf6e410699b4..918c97a59bcf 100644 --- a/source/compiler/aslstubs.c +++ b/source/compiler/aslstubs.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslstubs - Stubs used to link to Aml interpreter @@ -62,7 +61,7 @@ ACPI_PHYSICAL_ADDRESS  AeLocalGetRootPointer (      void)  { -    return 0; +    return (0);  }  void diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index eef9411222cd..daab4028ea64 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslsupport.l - Flex/lex scanner C support routines. @@ -167,8 +166,8 @@ ResetAndExit:   * RETURN:      0 if a node was popped, -1 otherwise   *   * DESCRIPTION: Pop the top of the input file stack and point the parser to - *              the saved parse buffer contained in the fnode.  Also, set the - *              global line counters to the saved values.  This function is + *              the saved parse buffer contained in the fnode. Also, set the + *              global line counters to the saved values. This function is   *              called when an include file reaches EOF.   *   ******************************************************************************/ @@ -223,7 +222,7 @@ AslPopInputFileStack (   * RETURN:      None   *   * DESCRIPTION: Push the InputFile onto the file stack, and point the parser - *              to this file.  Called when an include file is successfully + *              to this file. Called when an include file is successfully   *              opened.   *   ******************************************************************************/ @@ -325,7 +324,7 @@ AslInsertLineBuffer (      Gbl_InputByteCount++; -    /* Handle tabs.  Convert to spaces */ +    /* Handle tabs. Convert to spaces */      if (SourceChar == '\t')      { @@ -580,7 +579,7 @@ DoCharacter:              {              case '\\':                  /* -                 * Special handling for backslash-escape sequence.  We will +                 * Special handling for backslash-escape sequence. We will                   * toss the backslash and translate the escape char(s).                   */                  State = ASL_ESCAPE_SEQUENCE; @@ -669,7 +668,7 @@ DoCharacter:                  (i > 2))              {                  /* -                 * Reached end of the constant.  Convert the assembled ASCII +                 * Reached end of the constant. Convert the assembled ASCII                   * string and resume processing of the next character                   */                  ConvertBuffer[i] = 0; @@ -714,7 +713,7 @@ DoCharacter:                  (i > 1))              {                  /* -                 * Reached end of the constant.  Convert the assembled ASCII +                 * Reached end of the constant. Convert the assembled ASCII                   * string and resume processing of the next character                   */                  ConvertBuffer[i] = 0; diff --git a/source/compiler/asltransform.c b/source/compiler/asltransform.c index 4a5900f37cd0..64ebc06bf9ba 100644 --- a/source/compiler/asltransform.c +++ b/source/compiler/asltransform.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asltransform - Parse tree transforms @@ -100,7 +99,7 @@ TrDoSwitch (   *   * RETURN:      A pointer to name (allocated here).   * - * DESCRIPTION: Generate an ACPI name of the form _T_x.  These names are + * DESCRIPTION: Generate an ACPI name of the form _T_x. These names are   *              reserved for use by the ASL compiler. (_T_0 through _T_Z)   *   ******************************************************************************/ @@ -281,7 +280,7 @@ TrAmlTransformWalk (   *   * RETURN:      None   * - * DESCRIPTION: Prepare nodes to be output as AML data and operands.  The more + * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more   *              complex AML opcodes require processing of the child nodes   *              (arguments/operands).   * @@ -332,7 +331,7 @@ TrTransformSubtree (   * RETURN:      None   *   * DESCRIPTION: Find the end of the definition block and set a global to this - *              node.  It is used by the compiler to insert compiler-generated + *              node. It is used by the compiler to insert compiler-generated   *              names at the root level of the namespace.   *   ******************************************************************************/ @@ -376,7 +375,7 @@ TrDoDefinitionBlock (   * RETURN:      None   *   * - * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs.  There is + * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is   *              no actual AML opcode for SWITCH -- it must be simulated.   *   ******************************************************************************/ @@ -574,7 +573,7 @@ TrDoSwitch (              else              {                  /* -                 * The IF is a child of previous IF/ELSE.  It +                 * The IF is a child of previous IF/ELSE. It                   * is therefore without peer.                   */                  CurrentParentNode->Asl.Child = Conditional; @@ -737,7 +736,7 @@ TrDoSwitch (      /*       * Transform the Switch() into a While(One)-Break node.       * And create a Store() node which will be used to save the -     * Switch() value.  The store is of the form: Store (Value, _T_x) +     * Switch() value. The store is of the form: Store (Value, _T_x)       * where _T_x is the temp variable.       */      TrAmlInitNode (StartNode, PARSEOP_WHILE); @@ -778,5 +777,3 @@ TrDoSwitch (      BreakOp->Asl.Parent = StartNode;      TrAmlInsertPeer (Conditional, BreakOp);  } - - diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 12223b64498b..e5fa600be448 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asltree - parse tree management @@ -121,7 +120,7 @@ TrAllocateNode (      Op->Asl.Column            = Gbl_CurrentColumn;      UtSetParseOpName (Op); -    return Op; +    return (Op);  } @@ -171,7 +170,7 @@ TrUpdateNode (      if (!Op)      { -        return NULL; +        return (NULL);      }      DbgPrint (ASL_PARSE_OUTPUT, @@ -234,7 +233,7 @@ TrUpdateNode (          break;      } -    return Op; +    return (Op);  } @@ -336,7 +335,7 @@ TrSetNodeFlags (      if (!Op)      { -        return NULL; +        return (NULL);      }      Op->Asl.CompileFlags |= Flags; @@ -370,7 +369,7 @@ TrSetNodeAmlLength (      if (!Op)      { -        return NULL; +        return (NULL);      }      Op->Asl.AmlLength = Length; @@ -434,7 +433,7 @@ TrCreateLeafNode (          "\nCreateLeafNode  Ln/Col %u/%u NewNode %p  Op %s\n\n",          Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode)); -    return Op; +    return (Op);  } @@ -580,7 +579,7 @@ TrCreateValuedLeafNode (      }      DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); -    return Op; +    return (Op);  } @@ -702,7 +701,7 @@ TrCreateNode (      va_end(ap);      DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); -    return Op; +    return (Op);  } @@ -776,7 +775,7 @@ TrLinkChildren (          {              AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,                  "Child node list invalid"); -            return Op; +            return (Op);          }          DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); @@ -825,7 +824,7 @@ TrLinkChildren (      va_end(ap);      DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); -    return Op; +    return (Op);  } @@ -859,19 +858,19 @@ TrLinkPeerNode (      if ((!Op1) && (!Op2))      {          DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n"); -        return Op1; +        return (Op1);      }      /* If one of the nodes is null, just return the non-null node */      if (!Op2)      { -        return Op1; +        return (Op1);      }      if (!Op1)      { -        return Op2; +        return (Op2);      }      if (Op1 == Op2) @@ -881,7 +880,7 @@ TrLinkPeerNode (              Op1);          AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1,              "Linking node to itself"); -        return Op1; +        return (Op1);      }      Op1->Asl.Parent = Op2->Asl.Parent; @@ -898,7 +897,7 @@ TrLinkPeerNode (      }      Next->Asl.Next = Op2; -    return Op1; +    return (Op1);  } @@ -994,7 +993,7 @@ TrLinkChildNode (      if (!Op1 || !Op2)      { -        return Op1; +        return (Op1);      }      Op1->Asl.Child = Op2; @@ -1008,7 +1007,7 @@ TrLinkChildNode (          Next = Next->Asl.Next;      } -    return Op1; +    return (Op1);  } @@ -1236,5 +1235,3 @@ TrWalkParseTree (      return (AE_OK);  } - - diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index b9f4fbe304c0..0e3b16a31903 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: asltypes.h - compiler data types and struct definitions diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 43bf8238630f..ac749c44716b 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -1,4 +1,3 @@ -  /******************************************************************************   *   * Module Name: aslutils -- compiler utilities @@ -54,7 +53,6 @@          ACPI_MODULE_NAME    ("aslutils") -  /* Local prototypes */  static void @@ -569,7 +567,7 @@ UtCheckIntegerRange (      if (!Op)      { -        return NULL; +        return (NULL);      }      if ((Op->Asl.Value.Integer < LowValue) || @@ -833,12 +831,12 @@ UtAttachNameseg (              Name++;          } -        /* Remaing string should be one single nameseg */ +        /* Remaining string should be one single nameseg */          UtPadNameWithUnderscores (Name, PaddedNameSeg);      } -    strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4); +    ACPI_MOVE_NAME (Op->Asl.NameSeg, PaddedNameSeg);  } diff --git a/source/compiler/aslwalks.c b/source/compiler/aslwalks.c index d98806caa38a..dce037e7706e 100644 --- a/source/compiler/aslwalks.c +++ b/source/compiler/aslwalks.c @@ -566,7 +566,7 @@ AnMethodAnalysisWalkEnd (          /*           * If there is a peer node after the return statement, then this           * node is unreachable code -- i.e., it won't be executed because of -         * the preceeding Return() statement. +         * the preceding Return() statement.           */          if (Op->Asl.Next)          { diff --git a/source/compiler/dtcompile.c b/source/compiler/dtcompile.c index 8536400bb941..e67f3e68f84f 100644 --- a/source/compiler/dtcompile.c +++ b/source/compiler/dtcompile.c @@ -109,7 +109,7 @@ DtDoCompile (      if (Gbl_PreprocessOnly)      { -        return AE_OK; +        return (AE_OK);      }      /* diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index aa9cd7b3d417..9d1bcb2f3284 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -577,7 +577,7 @@ DtGetNextLine (                  break;              default:    /* Not a comment */ -                i++;    /* Save the preceeding slash */ +                i++;    /* Save the preceding slash */                  if (i >= Gbl_LineBufferSize)                  {                      UtExpandLineBuffers (); @@ -1008,7 +1008,7 @@ DtWriteTableToListing (      AcpiOsPrintf ("\n%s: Length %d (0x%X)\n\n",          ACPI_RAW_TABLE_DATA_HEADER, Gbl_TableLength, Gbl_TableLength); -    AcpiUtDumpBuffer2 (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY); +    AcpiUtDumpBuffer (Buffer, Gbl_TableLength, DB_BYTE_DISPLAY, 0);      AcpiOsRedirectOutput (stdout);  } diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c index d6baa5350192..2e8ac0abd0a0 100644 --- a/source/compiler/dttable.c +++ b/source/compiler/dttable.c @@ -872,7 +872,7 @@ DtCompileHest (          }      } -    return AE_OK; +    return (AE_OK);  } @@ -1184,8 +1184,8 @@ DtCompileMpst (      ACPI_MPST_POWER_NODE    *MpstPowerNode;      ACPI_MPST_DATA_HDR      *MpstDataHeader;      UINT16                  SubtableCount; -    UINT8                   PowerStateCount; -    UINT8                   ComponentCount; +    UINT32                  PowerStateCount; +    UINT32                  ComponentCount;      /* Main table */ diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 4d4370452f59..1a817cd886c1 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -539,20 +539,29 @@ const unsigned char TemplateMchi[] =  const unsigned char TemplateMpst[] =  { -    0x4D,0x50,0x53,0x54,0x6E,0x00,0x00,0x00,  /* 00000000    "MPSTn..." */ -    0x01,0x98,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    "..INTEL " */ +    0x4D,0x50,0x53,0x54,0xB6,0x00,0x00,0x00,  /* 00000000    "MPST...." */ +    0x01,0x77,0x49,0x4E,0x54,0x45,0x4C,0x20,  /* 00000008    ".wINTEL " */      0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45,  /* 00000010    "TEMPLATE" */      0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */ -    0x04,0x08,0x11,0x20,0x00,0x00,0x00,0x00,  /* 00000020    "... ...." */ -    0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */ +    0x13,0x09,0x12,0x20,0x00,0x00,0x00,0x00,  /* 00000020    "... ...." */ +    0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000028    "........" */      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000030    "........" */      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000038    "........" */ -    0x00,0x00,0x02,0x03,0x00,0x00,0x00,0x00,  /* 00000040    "........" */ -    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000048    "........" */ -    0x01,0x00,0x41,0x00,0x00,0x00,0x00,0x00,  /* 00000050    "..A....." */ +    0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00,  /* 00000040    "........" */ +    0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000048    "........" */ +    0x00,0x00,0x01,0x00,0x02,0x00,0x00,0x00,  /* 00000050    "........" */      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000058    "........" */      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000060    "........" */ -    0x00,0x00,0x00,0x00,0x00,0x00             /* 00000068    "......"   */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,  /* 00000068    "........" */ +    0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,  /* 00000070    "........" */ +    0x00,0x00,0x02,0x00,0x00,0x00,0x01,0x00,  /* 00000078    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000080    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000088    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000090    "........" */ +    0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,  /* 00000098    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000A0    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000A8    "........" */ +    0x00,0x00,0x00,0x00,0x00,0x00             /* 000000B0    "......"   */  };  const unsigned char TemplateMsct[] = diff --git a/source/compiler/new_table.txt b/source/compiler/new_table.txt new file mode 100644 index 000000000000..1e48d385b6e8 --- /dev/null +++ b/source/compiler/new_table.txt @@ -0,0 +1,88 @@ +How to add a new ACPI table to ACPICA and the iASL compiler. +------------------------------------------------------------ + +There are four main tasks that are needed to provide support for a +new ACPI table: +    1) Create a full definition of the table and any subtables +       in the ACPICA headers. +    2) Add disassembler support for the new table +    3) Add iASL table compiler support for the new table +    4) Create a default template for the new table for iASL -T +       option. + +Notes for each of these tasks provided below. + + +1) Header Support +----------------- + +New tables should be added to the appropriate header: +    actbl2.h: Used for new tables that are not defined in the ACPI spec. +    actbl3.h: Used for new tables that are defined in the ACPI spec. + +Use ACPI_TABLE_HEADER for the common ACPI table header. +Subtables should be defined separately from the main table. +Don't add placeholder fields for subtables and other multiple data items. +    (Don't use xxxxx[1] for a field that can have multiple items.) +    The disassembler and data table compiler depends on this. +For tables not defined in the ACPI spec, add a comment to indicate where +    the table came from. +Use other table definitions for additional guidance. + + +2) iASL Disassembler Support +---------------------------- + +Add definition of the table (and subtables) in common/dmtbinfo.c +Add table access macro(s) of the form ACPI_xxxx_OFFSET +Add ACPI_DMT_TERMINATOR at the end of every table/subtable definition + +Add externals for the table/subtable definitions in acdisasm.h +Add an entry for the new table in the AcpiDmTableData in common/dmtable.c + +If there are no subtables, add the AcpiDmTableInfoXXXX name to the +    AcpiDmTableData and it will automatically be disassembled. + +If there are subtables, a dump routine must be written: +Add an AcpiDmDumpXXXX function to dmtbdump.c -- note, code for another +    similar table can often be ported for the new table. +Add an external for this function to acdisasm.h +Add this function to the AcpiDmTableData entry for the new ACPI table + +Debug/Test: Either find an existing example of the new ACPI table, or +    create one using the "generic ACPI table support" included in the +    iASL data table compiler. Use the -G option to force a +    generic compile. It is often best to create the table from scratch, +    since this clearly exposes the dependencies (lengths, offsets, etc.) +    that the Table Compiler support will need to generate. + + +3) iASL Table Compiler Support +------------------------------ + +Simple tables do not require a compile routine. The definition of the +    table in common/dmtbinfo.c (created in step 2 above) will suffice. + +Complex tables with subtables will require a compile routine with a name +    of the form DtCompileXXXX. +Add a DtCompileXXXX function to the dttable.c module. +Add an external for this function in dtcompiler.h +Add this function to the AcpiDmTableData entry for the new ACPI table +    in common/dmtable.c + + +4) Template Support (-T iASL option) +------------------------------------ + +Create an example of the new ACPI table. This example should create +    multiple subtables (if supported), and multiple instances of any +    variable length data. + +Compile the example file with the -sc option. This will create a C +    array that contains the table contents. + +Add this array to the dttemplate.h file. Name the array TemplateXXXX. +Add this array name to the AcpiDmTableData entry for the new ACPI table + +Debug/Test: Create the template file. Compile the file. Disassemble the file. +    Compile the disassembly file. diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index b0e1e14626ec..9ec851a90d99 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -413,8 +413,8 @@ PrPushInputFileStack (   * RETURN:      0 if a node was popped, -1 otherwise   *   * DESCRIPTION: Pop the top of the input file stack and point the parser to - *              the saved parse buffer contained in the fnode.  Also, set the - *              global line counters to the saved values.  This function is + *              the saved parse buffer contained in the fnode. Also, set the + *              global line counters to the saved values. This function is   *              called when an include file reaches EOF.   *   ******************************************************************************/ diff --git a/source/compiler/readme.txt b/source/compiler/readme.txt index 882993b6bc9e..d891cd16a329 100644 --- a/source/compiler/readme.txt +++ b/source/compiler/readme.txt @@ -1,33 +1,96 @@ +/* + * Miscellaneous instructions for building and using the iASL compiler. + */ -Instructions for integrating iASL compiler into MS VC++ environment. +1) Generating iASL from source +------------------------------ -1a) Integration as a custom tool -------------------------------- +Generation of the ASL compiler from source code requires these items: + +    1) The ACPICA source code tree. +    2) An ANSI C compiler. +    3) The Flex (or Lex) lexical analyzer generator. +    4) The Bison (or Yacc) parser generator. + +There are three major ACPICA source code components that are required to +generate the compiler (Basically, the entire ACPICA source tree should +be installed): + +    1) The ASL compiler source. +    2) The ACPICA Core Subsystem source. In particular, the Namespace +        Manager component is used to create an internal ACPI namespace +        and symbol table, and the AML Interpreter is used to evaluate +        constant expressions. +    3) The "common" source directory that is used for all ACPI components. + +On Linux/Unix systems, the following commands will build the compiler: + +    cd acpica (or cd acpica/generate/unix) +    make clean +    make iasl + +On Windows, the Visual Studio 2008 project file appears in this directory: + +    generate/msvc9/AcpiComponents.sln + + + +1a) Notes for Windows GNU Flex and GNU Bison +-------------------------------------------- + +The Windows versions of GNU Flex/Bison must be installed, and they must +be installed in a directory that contains no embedded spaces in the +pathname. They cannot be installed in the default "c:\Program Files" +directory. This is a bug in Bison. The default Windows project file for +iASL assumes that these tools are installed at this location: + +    c:\GnuWin32 + +Once the tools are installed, ensure that this path is added to the +default system $PATH environment variable: + +    c:\GnuWin32\bin + +At this point, you will need to reboot Windows to make system aware of +the updated $PATH. + +iASL has been generated with these versions of Flex/Bison for Windows: + +    Flex for Windows:  V2.5.4 +    Bison for Windows: V2.4.1 + +Flex is available at:  http://gnuwin32.sourceforge.net/packages/flex.htm +Bison is available at: http://gnuwin32.sourceforge.net/packages/bison.htm + + + +2) Integration as a custom tool for Visual Studio +-------------------------------------------------  This procedure adds the iASL compiler as a custom tool that can be used -to compile ASL source files.  The output is sent to the VC output  +to compile ASL source files. The output is sent to the VC output   window.  a) Select Tools->Customize.  b) Select the "Tools" tab. -c) Scroll down to the bottom of the "Menu Contents" window.  There you -   will see an empty rectangle.  Click in the rectangle to enter a  +c) Scroll down to the bottom of the "Menu Contents" window. There you +   will see an empty rectangle. Click in the rectangle to enter a      name for this tool. -d) Type "iASL Compiler" in the box and hit enter.  You can now edit +d) Type "iASL Compiler" in the box and hit enter. You can now edit     the other fields for this new custom tool.  e) Enter the following into the fields:     Command:             C:\Acpi\iasl.exe -   Arguments:           -e "$(FilePath)" +   Arguments:           -vi "$(FilePath)"     Initial Directory    "$(FileDir)"     Use Output Window    <Check this option>     "Command" must be the path to wherever you copied the compiler. -   "-e" instructs the compiler to produce messages appropriate for VC. +   "-vi" instructs the compiler to produce messages appropriate for VC.     Quotes around FilePath and FileDir enable spaces in filenames.  f) Select "Close". @@ -35,12 +98,13 @@ f) Select "Close".  These steps will add the compiler to the tools menu as a custom tool.  By enabling "Use Output Window", you can click on error messages in  the output window and the source file and source line will be -automatically displayed by VC.  Also, you can use F4 to step through +automatically displayed by VC. Also, you can use F4 to step through  the messages and the corresponding source line(s). -1b) Integration into a project build ------------------------------------- + +3) Integrating iASL into a Visual Studio ASL project build +----------------------------------------------------------  This procedure creates a project that compiles ASL files to AML. @@ -50,63 +114,7 @@ b) For all ASL files in the project, specify a custom build (under  Project/Settings/CustomBuild with the following settings (or similar):  Commands: -c:\acpi\libraries\iasl.exe -vs -vi "$(InputPath)" +    c:\acpi\libraries\iasl.exe -vs -vi "$(InputPath)"  Output: -$(InputDir)\$(InputPath).aml - - - -2) Compiler Generation From Source -------------------------------- - -Generation of the ASL compiler from source code requires these items: - - -2a) Required Tools --------------- - -1) The Flex (or Lex) lexical analyzer generator. -2) The Bison (or Yacc) parser generator. -3) An ANSI C compiler. - - -Windows GNU Flex and GNU Bison Notes: - -GNU Flex/Bison must be installed in a directory that has no embedded -spaces in the name. They cannot be installed in the default -c:\"Program Files" directory. This is a bug in Bison. The default -Windows project file for iASL assumes that these tools are -installed at c:\GnuWin32. - -When installed, ensure that c:\GnuWin32\bin is added to the default -system $PATH environment variable. - -iASL has been generated with these versions on Windows: - -    Flex for Windows:  V2.5.4 -    Bison for Windows: V2.4.1 - - -Flex is available at:  http://gnuwin32.sourceforge.net/packages/flex.htm -Bison is available at: http://gnuwin32.sourceforge.net/packages/bison.htm - - -2b) Required Source Code --------------------- - -There are three major source code components that are required to  -generate the compiler: - -1) The ASL compiler source. -2) The ACPICA Core Subsystem source.  In particular, the Namespace Manager -     component is used to create an internal ACPI namespace and symbol table, -     and the AML Interpreter is used to evaluate constant expressions. -3) The Common source for all ACPI components. - - - - - - - +    $(InputDir)\$(InputPath).aml | 
