From owner-svn-src-all@freebsd.org Fri Dec 18 18:35:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 400C6A4B9C8; Fri, 18 Dec 2015 18:35:49 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02F2F1DD0; Fri, 18 Dec 2015 18:35:48 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBIIZmcd082169; Fri, 18 Dec 2015 18:35:48 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBIIZkE3082149; Fri, 18 Dec 2015 18:35:46 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201512181835.tBIIZkE3082149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Fri, 18 Dec 2015 18:35:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r292447 - in vendor-sys/acpica/dist: . source/common source/compiler source/components/debugger source/components/disassembler source/components/dispatcher source/components/events sour... X-SVN-Group: vendor-sys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Dec 2015 18:35:49 -0000 Author: jkim Date: Fri Dec 18 18:35:46 2015 New Revision: 292447 URL: https://svnweb.freebsd.org/changeset/base/292447 Log: Import ACPICA 20151218. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/common/acfileio.c vendor-sys/acpica/dist/source/common/adisasm.c vendor-sys/acpica/dist/source/common/getopt.c vendor-sys/acpica/dist/source/compiler/aslascii.c vendor-sys/acpica/dist/source/compiler/aslcompiler.h vendor-sys/acpica/dist/source/compiler/asldefine.h vendor-sys/acpica/dist/source/compiler/aslfiles.c vendor-sys/acpica/dist/source/compiler/aslglobal.h vendor-sys/acpica/dist/source/compiler/asllisting.c vendor-sys/acpica/dist/source/compiler/aslmain.c vendor-sys/acpica/dist/source/compiler/aslmap.c vendor-sys/acpica/dist/source/compiler/aslopcodes.c vendor-sys/acpica/dist/source/compiler/asloptions.c vendor-sys/acpica/dist/source/compiler/aslrules.y vendor-sys/acpica/dist/source/compiler/aslstartup.c vendor-sys/acpica/dist/source/compiler/aslsupport.l vendor-sys/acpica/dist/source/compiler/asltree.c vendor-sys/acpica/dist/source/compiler/aslutils.c vendor-sys/acpica/dist/source/compiler/aslwalks.c vendor-sys/acpica/dist/source/compiler/dttemplate.c vendor-sys/acpica/dist/source/compiler/dttemplate.h vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/debugger/dbinput.c vendor-sys/acpica/dist/source/components/disassembler/dmopcode.c vendor-sys/acpica/dist/source/components/disassembler/dmwalk.c vendor-sys/acpica/dist/source/components/dispatcher/dsinit.c vendor-sys/acpica/dist/source/components/events/evhandler.c vendor-sys/acpica/dist/source/components/events/evregion.c vendor-sys/acpica/dist/source/components/events/evrgnini.c vendor-sys/acpica/dist/source/components/events/evxfregn.c vendor-sys/acpica/dist/source/components/executer/excreate.c vendor-sys/acpica/dist/source/components/executer/exdebug.c vendor-sys/acpica/dist/source/components/executer/exdump.c vendor-sys/acpica/dist/source/components/executer/exmisc.c vendor-sys/acpica/dist/source/components/executer/exoparg1.c vendor-sys/acpica/dist/source/components/namespace/nsconvert.c vendor-sys/acpica/dist/source/components/namespace/nseval.c vendor-sys/acpica/dist/source/components/namespace/nsload.c vendor-sys/acpica/dist/source/components/namespace/nsrepair.c vendor-sys/acpica/dist/source/components/parser/psargs.c vendor-sys/acpica/dist/source/components/parser/psloop.c vendor-sys/acpica/dist/source/components/parser/psopcode.c vendor-sys/acpica/dist/source/components/tables/tbutils.c vendor-sys/acpica/dist/source/components/utilities/utinit.c vendor-sys/acpica/dist/source/components/utilities/utstring.c vendor-sys/acpica/dist/source/components/utilities/utxfinit.c vendor-sys/acpica/dist/source/include/acapps.h vendor-sys/acpica/dist/source/include/acevents.h vendor-sys/acpica/dist/source/include/acexcep.h vendor-sys/acpica/dist/source/include/acglobal.h vendor-sys/acpica/dist/source/include/aclocal.h vendor-sys/acpica/dist/source/include/acnamesp.h vendor-sys/acpica/dist/source/include/acobject.h vendor-sys/acpica/dist/source/include/acopcode.h vendor-sys/acpica/dist/source/include/acparser.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/amlcode.h vendor-sys/acpica/dist/source/tools/acpibin/abmain.c vendor-sys/acpica/dist/source/tools/acpiexec/aecommon.h vendor-sys/acpica/dist/source/tools/acpiexec/aehandlers.c vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpiexec/aeregion.c vendor-sys/acpica/dist/source/tools/acpiexec/aetables.c vendor-sys/acpica/dist/source/tools/acpinames/anmain.c vendor-sys/acpica/dist/source/tools/examples/examples.c vendor-sys/acpica/dist/tests/misc/grammar.asl Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/changes.txt Fri Dec 18 18:35:46 2015 (r292447) @@ -1,4 +1,161 @@ ---------------------------------------- +18 December 2015. Summary of changes for version 20151218: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Implemented per-AML-table execution of "module-level code" as individual +ACPI tables are loaded into the namespace during ACPICA initialization. +In other words, any module-level code within an AML table is executed +immediately after the table is loaded, instead of batched and executed +after all of the tables have been loaded. This provides compatibility +with other ACPI implementations. ACPICA BZ 1219. Bob Moore, Lv Zheng, +David Box. + +To fully support the feature above, the default operation region handlers +for the SystemMemory, SystemIO, and PCI_Config address spaces are now +installed before any ACPI tables are loaded. This enables module-level +code to access these address spaces during the table load and module- +level code execution phase. ACPICA BZ 1220. Bob Moore, Lv Zheng, David +Box. + +Implemented several changes to the internal _REG support in conjunction +with the changes above. Also, changes to the AcpiExec/AcpiNames/Examples +utilities for the changes above. Although these tools were changed, host +operating systems that simply use the default handlers for SystemMemory, +SystemIO, and PCI_Config spaces should not require any update. Lv Zheng. + +For example, in the code below, DEV1 is conditionally added to the +namespace by the DSDT via module-level code that accesses an operation +region. The SSDT references DEV1 via the Scope operator. DEV1 must be +created immediately after the DSDT is loaded in order for the SSDT to +successfully reference DEV1. Previously, this code would cause an +AE_NOT_EXIST exception during the load of the SSDT. Now, this code is +fully supported by ACPICA. + + DefinitionBlock ("", "DSDT", 2, "Intel", "DSDT1", 1) + { + OperationRegion (OPR1, SystemMemory, 0x400, 32) + Field (OPR1, AnyAcc, NoLock, Preserve) + { + FLD1, 1 + } + If (FLD1) + { + Device (\DEV1) + { + } + } + } + DefinitionBlock ("", "SSDT", 2, "Intel", "SSDT1", 1) + { + External (\DEV1, DeviceObj) + Scope (\DEV1) + { + } + } + +Fixed an AML interpreter problem where control method invocations were +not handled correctly when the invocation was itself a SuperName argument +to another ASL operator. In these cases, the method was not invoked. +ACPICA BZ 1002. Affects the following ASL operators that have a SuperName +argument: + Store + Acquire, Wait + CondRefOf, RefOf + Decrement, Increment + Load, Unload + Notify + Signal, Release, Reset + SizeOf + +Implemented automatic String-to-ObjectReference conversion support for +packages returned by predefined names (such as _DEP). A common BIOS error +is to add double quotes around an ObjectReference namepath, which turns +the reference into an unexpected string object. This support detects the +problem and corrects it before the package is returned to the caller that +invoked the method. Lv Zheng. + +Implemented extensions to the Concatenate operator. Concatenate now +accepts any type of object, it is not restricted to simply +Integer/String/Buffer. For objects other than these 3 basic data types, +the argument is treated as a string containing the name of the object +type. This expands the utility of Concatenate and the Printf/Fprintf +macros. ACPICA BZ 1222. + +Cleaned up the output of the ASL Debug object. The timer() value is now +optional and no longer emitted by default. Also, the basic data types of +Integer/String/Buffer are simply emitted as their values, without a data +type string -- since the data type is obvious from the output. ACPICA BZ +1221. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 102.6K Code, 28.4K Data, 131.0K Total + Debug Version: 200.3K Code, 81.9K Data, 282.3K Total + Previous Release: + Non-Debug Version: 102.0K Code, 28.3K Data, 130.3K Total + Debug Version: 199.6K Code, 81.8K Data, 281.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Fixed some issues with the ASL Include() operator. This operator +was incorrectly defined in the iASL parser rules, causing a new scope to +be opened for the code within the include file. This could lead to +several issues, including allowing ASL code that is technically illegal +and not supported by AML interpreters. Note, this does not affect the +related #include preprocessor operator. ACPICA BZ 1212. + +iASL/Disassembler: Implemented support for the ASL ElseIf operator. This +operator is essentially an ASL macro since there is no AML opcode +associated with it. The code emitted by the iASL compiler for ElseIf is +an Else opcode followed immediately by an If opcode. The disassembler +will now emit an ElseIf if it finds an Else immediately followed by an +If. This simplifies the decoded ASL, especially for deeply nested +If..Else and large Switch constructs. Thus, the disassembled code more +closely follows the original source ASL. ACPICA BZ 1211. Example: + + Old disassembly: + Else + { + If (Arg0 == 0x02) + { + Local0 = 0x05 + } + } + + New disassembly: + ElseIf (Arg0 == 0x02) + { + Local0 = 0x05 + } + +AcpiExec: Added support for the new module level code behavior and the +early region installation. This required a small change to the +initialization, since AcpiExec must install its own operation region +handlers. + +AcpiExec: Added support to make the debug object timer optional. Default +is timer disabled. This cleans up the debug object output -- the timer +data is rarely used. + +AcpiExec: Multiple ACPI tables are now loaded in the order that they +appear on the command line. This can be important when there are +interdependencies/references between the tables. + +iASL/Templates. Add support to generate template files with multiple +SSDTs within a single output file. Also added ommand line support to +specify the number of SSDTs (in addition to a single DSDT). ACPICA BZ +1223, 1225. + +---------------------------------------- 24 November 2015. Summary of changes for version 20151124: This release is available at https://acpica.org/downloads Modified: vendor-sys/acpica/dist/source/common/acfileio.c ============================================================================== --- vendor-sys/acpica/dist/source/common/acfileio.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/common/acfileio.c Fri Dec 18 18:35:46 2015 (r292447) @@ -55,20 +55,20 @@ /* Local prototypes */ static ACPI_STATUS -AcpiAcGetOneTableFromFile ( +AcGetOneTableFromFile ( char *Filename, FILE *File, UINT8 GetOnlyAmlTables, ACPI_TABLE_HEADER **Table); static ACPI_STATUS -AcpiAcCheckTextModeCorruption ( +AcCheckTextModeCorruption ( ACPI_TABLE_HEADER *Table); /******************************************************************************* * - * FUNCTION: AcpiAcGetAllTablesFromFile + * FUNCTION: AcGetAllTablesFromFile * * PARAMETERS: Filename - Table filename * GetOnlyAmlTables - TRUE if the tables must be AML tables @@ -81,7 +81,7 @@ AcpiAcCheckTextModeCorruption ( ******************************************************************************/ ACPI_STATUS -AcpiAcGetAllTablesFromFile ( +AcGetAllTablesFromFile ( char *Filename, UINT8 GetOnlyAmlTables, ACPI_NEW_TABLE_DESC **ReturnListHead) @@ -115,19 +115,36 @@ AcpiAcGetAllTablesFromFile ( return (AE_ERROR); } - if (FileSize < 4) + fprintf (stderr, + "Input file %s, Length 0x%X (%u) bytes\n", + Filename, FileSize, FileSize); + + /* We must have at least one ACPI table header */ + + if (FileSize < sizeof (ACPI_TABLE_HEADER)) { return (AE_BAD_HEADER); } + /* Check for an non-binary file */ + + if (!AcIsFileBinary (File)) + { + fprintf (stderr, + " %s: File does not appear to contain a valid AML table\n", + Filename); + return (AE_TYPE); + } + /* Read all tables within the file */ while (ACPI_SUCCESS (Status)) { /* Get one entire ACPI table */ - Status = AcpiAcGetOneTableFromFile ( + Status = AcGetOneTableFromFile ( Filename, File, GetOnlyAmlTables, &Table); + if (Status == AE_CTRL_TERMINATE) { Status = AE_OK; @@ -135,13 +152,20 @@ AcpiAcGetAllTablesFromFile ( } else if (Status == AE_TYPE) { - continue; + return (AE_OK); } else if (ACPI_FAILURE (Status)) { return (Status); } + /* Print table header for iASL/disassembler only */ + +#ifdef ACPI_ASL_COMPILER + + AcpiTbPrintTableHeader (0, Table); +#endif + /* Allocate and link a table descriptor */ TableDesc = AcpiOsAllocate (sizeof (ACPI_NEW_TABLE_DESC)); @@ -186,7 +210,7 @@ AcpiAcGetAllTablesFromFile ( /******************************************************************************* * - * FUNCTION: AcpiAcGetOneTableFromFile + * FUNCTION: AcGetOneTableFromFile * * PARAMETERS: Filename - File where table is located * File - Open FILE pointer to Filename @@ -204,7 +228,7 @@ AcpiAcGetAllTablesFromFile ( ******************************************************************************/ static ACPI_STATUS -AcpiAcGetOneTableFromFile ( +AcGetOneTableFromFile ( char *Filename, FILE *File, UINT8 GetOnlyAmlTables, @@ -214,21 +238,28 @@ AcpiAcGetOneTableFromFile ( ACPI_TABLE_HEADER TableHeader; ACPI_TABLE_HEADER *Table; INT32 Count; - long Position; + long TableOffset; *ReturnTable = NULL; + /* Get the table header to examine signature and length */ - /* Get just the table header to get signature and length */ - - Position = ftell (File); + TableOffset = ftell (File); Count = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File); if (Count != sizeof (ACPI_TABLE_HEADER)) { return (AE_CTRL_TERMINATE); } + /* Validate the table signature/header (limited ASCII chars) */ + + Status = AcValidateTableHeader (File, TableOffset); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (GetOnlyAmlTables) { /* Table must be an AML table (DSDT/SSDT) or FADT */ @@ -237,7 +268,7 @@ AcpiAcGetOneTableFromFile ( !AcpiUtIsAmlTable (&TableHeader)) { fprintf (stderr, - " %s: [%4.4s] is not an AML table - ignoring\n", + " %s: Table [%4.4s] is not an AML table - ignoring\n", Filename, TableHeader.Signature); return (AE_TYPE); @@ -252,9 +283,9 @@ AcpiAcGetOneTableFromFile ( return (AE_NO_MEMORY); } - /* Now read the entire table */ + /* Read the entire ACPI table, including header */ - fseek (File, Position, SEEK_SET); + fseek (File, TableOffset, SEEK_SET); Count = fread (Table, 1, TableHeader.Length, File); if (Count != (INT32) TableHeader.Length) @@ -268,18 +299,13 @@ AcpiAcGetOneTableFromFile ( Status = AcpiTbVerifyChecksum (Table, TableHeader.Length); if (ACPI_FAILURE (Status)) { - Status = AcpiAcCheckTextModeCorruption (Table); + Status = AcCheckTextModeCorruption (Table); if (ACPI_FAILURE (Status)) { goto ErrorExit; } } - fprintf (stderr, - "Loading ACPI table [%4.4s] from file %12s - Length 0x%06X (%u)\n", - TableHeader.Signature, Filename, - TableHeader.Length, TableHeader.Length); - *ReturnTable = Table; return (AE_OK); @@ -292,7 +318,159 @@ ErrorExit: /******************************************************************************* * - * FUNCTION: AcpiAcCheckTextModeCorruption + * FUNCTION: AcIsFileBinary + * + * PARAMETERS: File - Open input file + * + * RETURN: TRUE if file appears to be binary + * + * DESCRIPTION: Scan a file for any non-ASCII bytes. + * + * Note: Maintains current file position. + * + ******************************************************************************/ + +BOOLEAN +AcIsFileBinary ( + FILE *File) +{ + UINT8 Byte; + BOOLEAN IsBinary = FALSE; + long FileOffset; + + + /* Scan entire file for any non-ASCII bytes */ + + FileOffset = ftell (File); + while (fread (&Byte, 1, 1, File) == 1) + { + if (!isprint (Byte) && !isspace (Byte)) + { + IsBinary = TRUE; + goto Exit; + } + } + +Exit: + fseek (File, FileOffset, SEEK_SET); + return (IsBinary); +} + + +/******************************************************************************* + * + * FUNCTION: AcValidateTableHeader + * + * PARAMETERS: File - Open input file + * + * RETURN: Status + * + * DESCRIPTION: Determine if a file seems to contain one or more binary ACPI + * tables, via the + * following checks on what would be the table header: + * 1) File must be at least as long as an ACPI_TABLE_HEADER + * 2) There must be enough room in the file to hold entire table + * 3) Signature, OemId, OemTableId, AslCompilerId must be ASCII + * + * Note: There can be multiple definition blocks per file, so we cannot + * expect/compare the file size to be equal to the table length. 12/2015. + * + * Note: Maintains current file position. + * + ******************************************************************************/ + +ACPI_STATUS +AcValidateTableHeader ( + FILE *File, + long TableOffset) +{ + ACPI_TABLE_HEADER TableHeader; + size_t Actual; + long OriginalOffset; + UINT32 FileSize; + UINT32 i; + + + ACPI_FUNCTION_TRACE ("AcValidateTableHeader"); + + + /* Read a potential table header */ + + OriginalOffset = ftell (File); + fseek (File, TableOffset, SEEK_SET); + + Actual = fread (&TableHeader, 1, sizeof (ACPI_TABLE_HEADER), File); + fseek (File, OriginalOffset, SEEK_SET); + + if (Actual < sizeof (ACPI_TABLE_HEADER)) + { + return (AE_ERROR); + } + + /* Validate the signature (limited ASCII chars) */ + + if (!AcpiIsValidSignature (TableHeader.Signature)) + { + fprintf (stderr, "Invalid table signature: 0x%8.8X\n", + *ACPI_CAST_PTR (UINT32, TableHeader.Signature)); + return (AE_BAD_SIGNATURE); + } + + /* Validate table length against bytes remaining in the file */ + + FileSize = CmGetFileSize (File); + if (TableHeader.Length > (UINT32) (FileSize - TableOffset)) + { + fprintf (stderr, "Table [%4.4s] is too long for file - " + "needs: 0x%.2X, remaining in file: 0x%.2X\n", + TableHeader.Signature, TableHeader.Length, + (UINT32) (FileSize - TableOffset)); + return (AE_BAD_HEADER); + } + + /* + * These fields must be ASCII: OemId, OemTableId, AslCompilerId. + * We allow a NULL terminator in OemId and OemTableId. + */ + for (i = 0; i < ACPI_NAME_SIZE; i++) + { + if (!ACPI_IS_ASCII ((UINT8) TableHeader.AslCompilerId[i])) + { + goto BadCharacters; + } + } + + for (i = 0; (i < ACPI_OEM_ID_SIZE) && (TableHeader.OemId[i]); i++) + { + if (!ACPI_IS_ASCII ((UINT8) TableHeader.OemId[i])) + { + goto BadCharacters; + } + } + + for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (TableHeader.OemTableId[i]); i++) + { + if (!ACPI_IS_ASCII ((UINT8) TableHeader.OemTableId[i])) + { + goto BadCharacters; + } + } + + return (AE_OK); + + +BadCharacters: + + ACPI_WARNING ((AE_INFO, + "Table header for [%4.4s] has invalid ASCII character(s)", + TableHeader.Signature)); + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcCheckTextModeCorruption * * PARAMETERS: Table - Table buffer starting with table header * @@ -305,7 +483,7 @@ ErrorExit: ******************************************************************************/ static ACPI_STATUS -AcpiAcCheckTextModeCorruption ( +AcCheckTextModeCorruption ( ACPI_TABLE_HEADER *Table) { UINT32 i; Modified: vendor-sys/acpica/dist/source/common/adisasm.c ============================================================================== --- vendor-sys/acpica/dist/source/common/adisasm.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/common/adisasm.c Fri Dec 18 18:35:46 2015 (r292447) @@ -192,10 +192,12 @@ AdAmlDisassemble ( { /* Get the list of all AML tables in the file */ - Status = AcpiAcGetAllTablesFromFile (Filename, + Status = AcGetAllTablesFromFile (Filename, ACPI_GET_ALL_TABLES, &ListHead); if (ACPI_FAILURE (Status)) { + AcpiOsPrintf ("Could not get ACPI tables from %s, %s\n", + Filename, AcpiFormatException (Status)); return (Status); } @@ -281,13 +283,12 @@ AdAmlDisassemble ( Cleanup: -// check! -#if 0 - if (Table && !AcpiGbl_ForceAmlDisassembly && !AcpiUtIsAmlTable (Table)) + if (Table && + !AcpiGbl_ForceAmlDisassembly && + !AcpiUtIsAmlTable (Table)) { ACPI_FREE (Table); } -#endif if (File) { @@ -592,7 +593,7 @@ AdDoExternalFileList ( AcpiOsPrintf ("External object resolution file %16s\n", ExternalFilename); - Status = AcpiAcGetAllTablesFromFile ( + Status = AcGetAllTablesFromFile ( ExternalFilename, ACPI_GET_ONLY_AML_TABLES, &ExternalListHead); if (ACPI_FAILURE (Status)) { Modified: vendor-sys/acpica/dist/source/common/getopt.c ============================================================================== --- vendor-sys/acpica/dist/source/common/getopt.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/common/getopt.c Fri Dec 18 18:35:46 2015 (r292447) @@ -47,6 +47,7 @@ * Option strings: * "f" - Option has no arguments * "f:" - Option requires an argument + * "f+" - Option has an optional argument * "f^" - Option has optional single-char sub-options * "f|" - Option has required single-char sub-options */ Modified: vendor-sys/acpica/dist/source/compiler/aslascii.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslascii.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslascii.c Fri Dec 18 18:35:46 2015 (r292447) @@ -42,6 +42,7 @@ */ #include "aslcompiler.h" +#include #include #define _COMPONENT ACPI_COMPILER @@ -63,90 +64,7 @@ FlConsumeNewComment ( /******************************************************************************* * - * FUNCTION: FlCheckForAcpiTable - * - * PARAMETERS: Handle - Open input file - * - * RETURN: Status - * - * DESCRIPTION: Determine if a file seems to be a binary ACPI table, via the - * following checks on what would be the table header: - * 0) File must be at least as long as an ACPI_TABLE_HEADER - * 1) The header length field must match the file size - * 2) Signature, OemId, OemTableId, AslCompilerId must be ASCII - * - ******************************************************************************/ - -ACPI_STATUS -FlCheckForAcpiTable ( - FILE *Handle) -{ - ACPI_TABLE_HEADER Table; - UINT32 FileSize; - size_t Actual; - UINT32 i; - - - /* Read a potential table header */ - - Actual = fread (&Table, 1, sizeof (ACPI_TABLE_HEADER), Handle); - fseek (Handle, 0, SEEK_SET); - - if (Actual < sizeof (ACPI_TABLE_HEADER)) - { - return (AE_ERROR); - } - - /* Header length field must match the file size */ - - FileSize = CmGetFileSize (Handle); - if (Table.Length != FileSize) - { - return (AE_ERROR); - } - - /* - * These fields must be ASCII: - * Signature, OemId, OemTableId, AslCompilerId. - * We allow a NULL terminator in OemId and OemTableId. - */ - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (!ACPI_IS_ASCII ((UINT8) Table.Signature[i])) - { - return (AE_ERROR); - } - - if (!ACPI_IS_ASCII ((UINT8) Table.AslCompilerId[i])) - { - return (AE_ERROR); - } - } - - for (i = 0; (i < ACPI_OEM_ID_SIZE) && (Table.OemId[i]); i++) - { - if (!ACPI_IS_ASCII ((UINT8) Table.OemId[i])) - { - return (AE_ERROR); - } - } - - for (i = 0; (i < ACPI_OEM_TABLE_ID_SIZE) && (Table.OemTableId[i]); i++) - { - if (!ACPI_IS_ASCII ((UINT8) Table.OemTableId[i])) - { - return (AE_ERROR); - } - } - - printf ("Binary file appears to be a valid ACPI table, disassembling\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlCheckForAscii + * FUNCTION: FlIsFileAsciiSource * * PARAMETERS: Filename - Full input filename * DisplayErrors - TRUE if error messages desired @@ -163,7 +81,7 @@ FlCheckForAcpiTable ( ******************************************************************************/ ACPI_STATUS -FlCheckForAscii ( +FlIsFileAsciiSource ( char *Filename, BOOLEAN DisplayErrors) { Modified: vendor-sys/acpica/dist/source/compiler/aslcompiler.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslcompiler.h Fri Dec 18 18:35:46 2015 (r292447) @@ -167,11 +167,7 @@ CmDeleteCaches ( * aslascii - ascii support */ ACPI_STATUS -FlCheckForAcpiTable ( - FILE *Handle); - -ACPI_STATUS -FlCheckForAscii ( +FlIsFileAsciiSource ( char *Filename, BOOLEAN DisplayErrors); @@ -741,6 +737,10 @@ TrSetEndLineNumber ( ACPI_PARSE_OBJECT *Op); void +TrSetCurrentFilename ( + ACPI_PARSE_OBJECT *Op); + +void TrWalkTree ( void); @@ -923,6 +923,10 @@ DbgPrint ( #define ASL_PARSE_OUTPUT 1 #define ASL_TREE_OUTPUT 2 +BOOLEAN +UtQueryForOverwrite ( + char *Pathname); + void UtDisplaySupportedTables ( void); @@ -1281,6 +1285,6 @@ DtDoCompile( ACPI_STATUS DtCreateTemplates ( - char *Signature); + char **argv); #endif /* __ASLCOMPILER_H */ Modified: vendor-sys/acpica/dist/source/compiler/asldefine.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asldefine.h Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/asldefine.h Fri Dec 18 18:35:46 2015 (r292447) @@ -106,10 +106,10 @@ /* Types for input files */ -#define ASL_INPUT_TYPE_BINARY 0 -#define ASL_INPUT_TYPE_ACPI_TABLE 1 -#define ASL_INPUT_TYPE_ASCII_ASL 2 -#define ASL_INPUT_TYPE_ASCII_DATA 3 +#define ASL_INPUT_TYPE_BINARY 0 +#define ASL_INPUT_TYPE_BINARY_ACPI_TABLE 1 +#define ASL_INPUT_TYPE_ASCII_ASL 2 +#define ASL_INPUT_TYPE_ASCII_DATA 3 /* Misc */ Modified: vendor-sys/acpica/dist/source/compiler/aslfiles.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslfiles.c Fri Dec 18 18:35:46 2015 (r292447) @@ -336,6 +336,7 @@ FlOpenIncludeWithPrefix ( */ Gbl_CurrentLineNumber--; OriginalLineNumber = Gbl_CurrentLineNumber; + while (DtGetNextLine (IncludeFile, DT_ALLOW_MULTILINE_QUOTES) != ASL_EOF) { if (Gbl_CurrentLineBuffer[0] == '#') @@ -344,6 +345,7 @@ FlOpenIncludeWithPrefix ( Op, "use #include instead"); } } + Gbl_CurrentLineNumber = OriginalLineNumber; /* Must seek back to the start of the file */ @@ -570,7 +572,7 @@ FlOpenMiscOutputFiles ( /* All done for disassembler */ - if (Gbl_FileType == ASL_INPUT_TYPE_ACPI_TABLE) + if (Gbl_FileType == ASL_INPUT_TYPE_BINARY_ACPI_TABLE) { return (AE_OK); } Modified: vendor-sys/acpica/dist/source/compiler/aslglobal.h ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslglobal.h Fri Dec 18 18:35:46 2015 (r292447) @@ -197,6 +197,7 @@ ASL_EXTERN char ASL_ ASL_EXTERN ASL_INCLUDE_DIR ASL_INIT_GLOBAL (*Gbl_IncludeDirList, NULL); ASL_EXTERN char *Gbl_CurrentInputFilename; ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalRefFilename, NULL); +ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_PreviousIncludeFilename, NULL); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); @@ -246,7 +247,6 @@ ASL_EXTERN ASL_LISTING_NODE ASL_ 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 char *Gbl_TemplateSignature; ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); Modified: vendor-sys/acpica/dist/source/compiler/asllisting.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asllisting.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/asllisting.c Fri Dec 18 18:35:46 2015 (r292447) @@ -277,6 +277,34 @@ LsTreeWriteWalk ( UtPrintFormattedName (Op->Asl.ParseOpcode, Level); + 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) + { + DbgPrint (ASL_TREE_OUTPUT, + "Close: %s\n", Op->Asl.Filename); + return (AE_OK); + } + else + { + DbgPrint (ASL_TREE_OUTPUT, " "); + } + DbgPrint (ASL_TREE_OUTPUT, " (%.4X) Flags %8.8X", Op->Asl.ParseOpcode, Op->Asl.CompileFlags); TrPrintNodeCompileFlags (Op->Asl.CompileFlags); @@ -428,7 +456,7 @@ LsWriteNodeToListing ( /* Create a new listing node and push it */ - LsPushNode (Op->Asl.Child->Asl.Value.String); + LsPushNode (Op->Asl.Value.String); return; Modified: vendor-sys/acpica/dist/source/compiler/aslmain.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmain.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslmain.c Fri Dec 18 18:35:46 2015 (r292447) @@ -127,7 +127,8 @@ Usage ( printf ("\nGeneral:\n"); ACPI_OPTION ("-@ ", "Specify command file"); ACPI_OPTION ("-I ", "Specify additional include directory"); - ACPI_OPTION ("-T |ALL|*", "Create table template file for ACPI "); + ACPI_OPTION ("-T |ALL", "Create ACPI table template/example files"); + ACPI_OPTION ("-T ", "Emit DSDT and SSDTs to same file"); ACPI_OPTION ("-p ", "Specify path/filename prefix for all output files"); ACPI_OPTION ("-v", "Display compiler version"); ACPI_OPTION ("-vo", "Enable optimization comments"); Modified: vendor-sys/acpica/dist/source/compiler/aslmap.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslmap.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslmap.c Fri Dec 18 18:35:46 2015 (r292447) @@ -313,7 +313,7 @@ const ASL_MAPPING_ENTRY AslKeywordMa /* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER), /* 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_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER), +/* 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), Modified: vendor-sys/acpica/dist/source/compiler/aslopcodes.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslopcodes.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslopcodes.c Fri Dec 18 18:35:46 2015 (r292447) @@ -1510,7 +1510,6 @@ OpcGenerateAmlOpcode ( case PARSEOP_INCLUDE: - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; Gbl_HasIncludeFiles = TRUE; break; Modified: vendor-sys/acpica/dist/source/compiler/asloptions.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/asloptions.c Fri Dec 18 18:35:46 2015 (r292447) @@ -107,7 +107,7 @@ AslCommandLine ( if (Gbl_DoTemplates) { - Status = DtCreateTemplates (Gbl_TemplateSignature); + Status = DtCreateTemplates (argv); if (ACPI_FAILURE (Status)) { exit (-1); @@ -662,7 +662,6 @@ AslDoOptions ( case 'T': /* Create a ACPI table template file */ Gbl_DoTemplates = TRUE; - Gbl_TemplateSignature = AcpiGbl_Optarg; break; case 'v': /* Version and verbosity settings */ Modified: vendor-sys/acpica/dist/source/compiler/aslrules.y ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslrules.y Fri Dec 18 18:35:46 2015 (r292447) @@ -427,6 +427,7 @@ String CompilerDirective : IncludeTerm {} + | IncludeEndTerm {} | ExternalTerm {} ; @@ -1033,14 +1034,13 @@ IfTerm ; IncludeTerm - : PARSEOP_INCLUDE '(' {$$ = TrCreateLeafNode (PARSEOP_INCLUDE);} - String ')' {TrLinkChildren ($3,1,$4);FlOpenIncludeFile ($4);} - TermList - IncludeEndTerm {$$ = TrLinkPeerNodes (3,$3,$7,$8);} + : PARSEOP_INCLUDE '(' + String ')' {$$ = TrUpdateNode (PARSEOP_INCLUDE, $3); + FlOpenIncludeFile ($3);} ; IncludeEndTerm - : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END);} + : PARSEOP_INCLUDE_END {$$ = TrCreateLeafNode (PARSEOP_INCLUDE_END); TrSetCurrentFilename ($$);} ; IncTerm Modified: vendor-sys/acpica/dist/source/compiler/aslstartup.c ============================================================================== --- vendor-sys/acpica/dist/source/compiler/aslstartup.c Fri Dec 18 18:08:53 2015 (r292446) +++ vendor-sys/acpica/dist/source/compiler/aslstartup.c Fri Dec 18 18:35:46 2015 (r292447) @@ -144,62 +144,63 @@ AslDetectSourceFileType ( ASL_FILE_INFO *Info) { char *FileChar; - UINT8 Type; + UINT8 Type = ASL_INPUT_TYPE_ASCII_DATA; /* default */ ACPI_STATUS Status; - /* Check for a valid binary ACPI table */ + /* Check for 100% ASCII source file (comments are ignored) */ - Status = FlCheckForAcpiTable (Info->Handle); + Status = FlIsFileAsciiSource (Info->Filename, FALSE); if (ACPI_SUCCESS (Status)) { - Type = ASL_INPUT_TYPE_ACPI_TABLE; - goto Cleanup; - } + /* + * File contains ASCII source code. Determine if this is an ASL + * file or an ACPI data table file. + */ + while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) + { + /* Uppercase the buffer for caseless compare */ - /* Check for 100% ASCII source file (comments are ignored) */ + FileChar = Gbl_CurrentLineBuffer; + while (*FileChar) + { + *FileChar = (char) toupper ((int) *FileChar); + FileChar++; + } - Status = FlCheckForAscii (Info->Filename, TRUE); - if (ACPI_FAILURE (Status)) - { - printf ("Invalid characters in input file - %s\n", Info->Filename); + /* Presence of "DefinitionBlock" indicates actual ASL code */ - if (!Gbl_IgnoreErrors) - { - Type = ASL_INPUT_TYPE_BINARY; - goto Cleanup; + if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK")) + { + /* Appears to be an ASL file */ + + Type = ASL_INPUT_TYPE_ASCII_ASL; + goto Cleanup; + } } - } - /* - * File is ASCII. Determine if this is an ASL file or an ACPI data - * table file. - */ - while (fgets (Gbl_CurrentLineBuffer, Gbl_LineBufferSize, Info->Handle)) - { - /* Uppercase the buffer for caseless compare */ + /* Appears to be an ASCII data table source file */ - FileChar = Gbl_CurrentLineBuffer; - while (*FileChar) - { - *FileChar = (char) toupper ((int) *FileChar); - FileChar++; - } + Type = ASL_INPUT_TYPE_ASCII_DATA; + goto Cleanup; + } - /* Presence of "DefinitionBlock" indicates actual ASL code */ + /* We have some sort of binary table, check for valid ACPI table */ - if (strstr (Gbl_CurrentLineBuffer, "DEFINITIONBLOCK")) - { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***