From fa948a817cf9dae39dc632f9bf48a8af37244a0e Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Sat, 19 May 2012 05:44:32 +0000 Subject: [PATCH] Import ACPICA 20120518. --- changes.txt | 72 +++++++++++-- generate/release/build.sh | 2 +- source/common/adfile.c | 19 ++-- source/common/adwalk.c | 30 ++++-- source/common/dmextern.c | 30 ++++-- source/compiler/aslcompile.c | 47 ++++---- source/compiler/aslcompiler.h | 9 +- source/compiler/aslcompiler.l | 1 + source/compiler/aslcompiler.y | 2 + source/compiler/aslerror.c | 23 +++- source/compiler/aslfiles.c | 108 ++++++++++++++++++- source/compiler/aslmain.c | 13 ++- source/compiler/aslmap.c | 1 + source/compiler/aslmessages.h | 11 +- source/compiler/aslstartup.c | 2 +- source/compiler/dtio.c | 18 +++- source/compiler/prscan.c | 2 +- source/compiler/prutils.c | 15 +-- source/components/debugger/dbfileio.c | 13 +++ source/components/dispatcher/dsfield.c | 84 +++++++++++++++ source/components/events/evxface.c | 10 +- source/components/tables/tbfadt.c | 33 ++++-- source/components/utilities/utmisc.c | 35 ++++++ source/include/acobject.h | 8 +- source/include/acpiosxf.h | 2 +- source/include/acpixf.h | 2 +- source/include/actypes.h | 3 +- source/include/acutils.h | 4 + source/os_specific/service_layers/osunixxf.c | 21 ++++ source/os_specific/service_layers/oswinxf.c | 21 ++++ source/tools/acpiexec/aemain.c | 17 +-- 31 files changed, 556 insertions(+), 102 deletions(-) diff --git a/changes.txt b/changes.txt index e55e28628d39..d31e91405caa 100644 --- a/changes.txt +++ b/changes.txt @@ -1,8 +1,70 @@ +---------------------------------------- +18 May 2012. Summary of changes for version 20120518: + + +1) ACPICA Core Subsystem: + +Added a new OSL interface, AcpiOsWaitEventsComplete. This interface is defined +to block until asynchronous events such as notifies and GPEs have completed. +Within ACPICA, it is only called before a notify or GPE handler is +removed/uninstalled. It also may be useful for the host OS within related +drivers such as the Embedded Controller driver. See the ACPICA reference for +additional information. ACPICA BZ 868. + +ACPI Tables: Added a new error message for a possible overflow failure during +the conversion of FADT 32-bit legacy register addresses to internal common 64- +bit GAS structure representation. The GAS has a one-byte "bit length" field, +thus limiting the register length to 255 bits. ACPICA BZ 953. + +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. + + Previous Release: + Non-Debug Version: 92.9K Code, 25.0K Data, 117.9K Total + Debug Version: 172.6K Code, 73.4K Data, 246.0K Total + Current Release: + Non-Debug Version: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL: Added the ACPI 5.0 "PCC" keyword for use in the Register() ASL macro. +This keyword was added late in the ACPI 5.0 release cycle and was not +implemented until now. + +Disassembler: Added support for Operation Region externals. Adds missing +support for operation regions that are defined in another table, and +referenced locally via a Field or BankField ASL operator. Now generates the +correct External statement. + +Disassembler: Several additional fixes for the External() statement generation +related to some ASL operators. Also, order the External() statements +alphabetically in the disassembler output. Fixes the External() generation for +the Create* field, Alias, and Scope operators: + 1) Create* buffer field operators - fix type mismatch warning on disassembly + 2) Alias - implement missing External support + 3) Scope - fix to make sure all necessary externals are emitted. + +iASL: Improved pathname support. For include files, merge the prefix pathname +with the file pathname and eliminate unnecessary components. Convert +backslashes in all pathnames to forward slashes, for readability. Include file +pathname changes affect both #include and Include() type operators. + +iASL/DTC/Preprocessor: Gracefully handle early EOF. Handle an EOF at the end +of a valid line by inserting a newline and then returning the EOF during the +next call to GetNextLine. Prevents the line from being ignored due to EOF +condition. + +iASL: Implemented some changes to enhance the IDE support (-vi option.) Error +and Warning messages are now correctly recognized for both the source code +browser and the global error and warning counts. + ---------------------------------------- 20 April 2012. Summary of changes for version 20120420: -This release is available at www.acpica.org/downloads. -The ACPI 5.0 specification is available at www.acpi.info. 1) ACPICA Core Subsystem: @@ -68,8 +130,6 @@ several extraneous "unrecognized operator" messages. ---------------------------------------- 20 March 2012. Summary of changes for version 20120320: -This release is available at www.acpica.org/downloads. -The ACPI 5.0 specification is available at www.acpi.info. 1) ACPICA Core Subsystem: @@ -160,8 +220,6 @@ Versions supported: ---------------------------------------- 15 February 2012. Summary of changes for version 20120215: -This release is available at www.acpica.org/downloads. -The ACPI 5.0 specification is available at www.acpi.info. 1) ACPICA Core Subsystem: @@ -252,8 +310,6 @@ specification. ---------------------------------------- 11 January 2012. Summary of changes for version 20120111: -This release is available at www.acpica.org/downloads. -The ACPI 5.0 specification is available at www.acpi.info. 1) ACPICA Core Subsystem: diff --git a/generate/release/build.sh b/generate/release/build.sh index 9c46e66b4caf..e405a307b708 100755 --- a/generate/release/build.sh +++ b/generate/release/build.sh @@ -37,7 +37,7 @@ # Configuration -ZIP_UTILITY="c:/windows/pkzip25.exe" +ZIP_UTILITY="/cygdrive/c/windows/pkzip25.exe" ACPISRC="libraries/acpisrc.exe" DOS2UNIX="dos2unix" UNIX2DOS="unix2dos" diff --git a/source/common/adfile.c b/source/common/adfile.c index d971e6895bfd..2caf59954a54 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -298,20 +298,24 @@ FlSplitInputPathname ( return (AE_NO_MEMORY); } - Substring = strrchr (DirectoryPath, '\\'); + /* Convert backslashes to slashes in the entire path */ + + UtConvertBackslashes (DirectoryPath); + + /* Backup to last slash or colon */ + + Substring = strrchr (DirectoryPath, '/'); if (!Substring) { - Substring = strrchr (DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, ':'); - } + Substring = strrchr (DirectoryPath, ':'); } + /* Extract the simple filename */ + if (!Substring) { + Filename = FlStrdup (DirectoryPath); DirectoryPath[0] = 0; - Filename = FlStrdup (InputPath); } else { @@ -326,7 +330,6 @@ FlSplitInputPathname ( *OutDirectoryPath = DirectoryPath; *OutFilename = Filename; - return (AE_OK); } diff --git a/source/common/adwalk.c b/source/common/adwalk.c index efda35a8be23..5336b61ef979 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -521,6 +521,7 @@ AcpiDmFindOrphanDescending ( if ((OpInfo->Class != AML_CLASS_EXECUTE) && (OpInfo->Class != AML_CLASS_CREATE) && + (OpInfo->ObjectType != ACPI_TYPE_LOCAL_ALIAS) && (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) && !Op->Common.Node) { @@ -743,13 +744,23 @@ AcpiDmXrefDescendingOp ( if (OpInfo->Flags & AML_NAMED) { - if ((Op->Common.AmlOpcode == AML_ALIAS_OP) || - (Op->Common.AmlOpcode == AML_SCOPE_OP)) + /* + * Only these two operators (Alias, Scope) refer to an existing + * name, it is the first argument + */ + if (Op->Common.AmlOpcode == AML_ALIAS_OP) + { + ObjectType = ACPI_TYPE_ANY; + + NextOp = Op->Common.Value.Arg; + NextOp = NextOp->Common.Value.Arg; + if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) + { + Path = NextOp->Common.Value.String; + } + } + else if (Op->Common.AmlOpcode == AML_SCOPE_OP) { - /* - * Only these two operators refer to an existing name, - * first argument - */ Path = (char *) Op->Named.Path; } } @@ -757,6 +768,8 @@ AcpiDmXrefDescendingOp ( { /* Referenced Buffer Name is the first child */ + ObjectType = ACPI_TYPE_BUFFER; /* Change from TYPE_BUFFER_FIELD */ + NextOp = Op->Common.Value.Arg; if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) { @@ -783,6 +796,11 @@ AcpiDmXrefDescendingOp ( Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, WalkState, &Node); + if (ACPI_SUCCESS (Status) && (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + Status = AE_NOT_FOUND; + } + if (ACPI_FAILURE (Status)) { if (Status == AE_NOT_FOUND) diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 37c34fc5dab1..d509c8ae9256 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -454,12 +454,12 @@ AcpiDmAddToExternalList ( NewExternal->InternalPath = Path; - /* Link the new descriptor into the global list, ordered by string length */ + /* Link the new descriptor into the global list, alphabetically ordered */ NextExternal = AcpiGbl_ExternalList; while (NextExternal) { - if (NewExternal->Length <= NextExternal->Length) + if (AcpiUtStricmp (NewExternal->Path, NextExternal->Path) < 0) { if (PrevExternal) { @@ -508,7 +508,7 @@ AcpiDmAddExternalsToNamespace ( { ACPI_STATUS Status; ACPI_NAMESPACE_NODE *Node; - ACPI_OPERAND_OBJECT *MethodDesc; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; @@ -527,13 +527,29 @@ AcpiDmAddExternalsToNamespace ( "while adding external to namespace [%s]", External->Path)); } - else if (External->Type == ACPI_TYPE_METHOD) + + else switch (External->Type) { + case ACPI_TYPE_METHOD: + /* For methods, we need to save the argument count */ - MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - MethodDesc->Method.ParamCount = (UINT8) External->Value; - Node->Object = MethodDesc; + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + ObjDesc->Method.ParamCount = (UINT8) External->Value; + Node->Object = ObjDesc; + break; + + case ACPI_TYPE_REGION: + + /* Regions require a region sub-object */ + + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); + ObjDesc->Region.Node = Node; + Node->Object = ObjDesc; + break; + + default: + break; } External = External->Next; diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 8fcca0a7cb66..2a87a0162e4f 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -59,12 +59,12 @@ CmFlushSourceCode ( static void FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, + FILE *Handle, ASL_FILE_STATUS *Status); static void FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, + FILE *Handle, ASL_FILE_STATUS *Status); @@ -253,7 +253,8 @@ CmFlushSourceCode ( * * FUNCTION: FlConsume* * - * PARAMETERS: FileInfo - Points to an open input file + * PARAMETERS: Handle - Open input file + * Status - File current status struct * * RETURN: Number of lines consumed * @@ -263,14 +264,14 @@ CmFlushSourceCode ( static void FlConsumeAnsiComment ( - ASL_FILE_INFO *FileInfo, + FILE *Handle, ASL_FILE_STATUS *Status) { UINT8 Byte; BOOLEAN ClosingComment = FALSE; - while (fread (&Byte, 1, 1, FileInfo->Handle)) + while (fread (&Byte, 1, 1, Handle)) { /* Scan until comment close is found */ @@ -307,13 +308,13 @@ FlConsumeAnsiComment ( static void FlConsumeNewComment ( - ASL_FILE_INFO *FileInfo, + FILE *Handle, ASL_FILE_STATUS *Status) { UINT8 Byte; - while (fread (&Byte, 1, 1, FileInfo->Handle)) + while (fread (&Byte, 1, 1, Handle)) { Status->Offset++; @@ -332,7 +333,9 @@ FlConsumeNewComment ( * * FUNCTION: FlCheckForAscii * - * PARAMETERS: FileInfo - Points to an open input file + * PARAMETERS: Handle - Open input file + * Filename - Input filename + * DisplayErrors - TRUE if error messages desired * * RETURN: Status * @@ -347,7 +350,9 @@ FlConsumeNewComment ( ACPI_STATUS FlCheckForAscii ( - ASL_FILE_INFO *FileInfo) + FILE *Handle, + char *Filename, + BOOLEAN DisplayErrors) { UINT8 Byte; ACPI_SIZE BadBytes = 0; @@ -360,7 +365,7 @@ FlCheckForAscii ( /* Read the entire file */ - while (fread (&Byte, 1, 1, FileInfo->Handle)) + while (fread (&Byte, 1, 1, Handle)) { /* Ignore comment fields (allow non-ascii within) */ @@ -370,12 +375,12 @@ FlCheckForAscii ( if (Byte == '*') { - FlConsumeAnsiComment (FileInfo, &Status); + FlConsumeAnsiComment (Handle, &Status); } if (Byte == '/') { - FlConsumeNewComment (FileInfo, &Status); + FlConsumeNewComment (Handle, &Status); } /* Reset */ @@ -391,7 +396,7 @@ FlCheckForAscii ( if (!ACPI_IS_ASCII (Byte)) { - if (BadBytes < 10) + if ((BadBytes < 10) && (DisplayErrors)) { AcpiOsPrintf ( "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n", @@ -413,20 +418,24 @@ FlCheckForAscii ( /* Seek back to the beginning of the source file */ - fseek (FileInfo->Handle, 0, SEEK_SET); + fseek (Handle, 0, SEEK_SET); /* Were there any non-ASCII characters in the file? */ if (BadBytes) { - AcpiOsPrintf ( - "%u non-ASCII characters found in input source text, could be a binary file\n", - BadBytes); - AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename); + if (DisplayErrors) + { + AcpiOsPrintf ( + "%u non-ASCII characters found in input source text, could be a binary file\n", + BadBytes); + AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, Filename); + } + return (AE_BAD_CHARACTER); } - /* File is OK */ + /* File is OK (100% ASCII) */ return (AE_OK); } diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 7eef917cd11e..937530dfeb89 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -166,7 +166,9 @@ CmCleanupAndExit ( ACPI_STATUS FlCheckForAscii ( - ASL_FILE_INFO *FileInfo); + FILE *Handle, + char *Filename, + BOOLEAN DisplayErrors); /* @@ -608,6 +610,11 @@ void FlAddIncludeDirectory ( char *Dir); +char * +FlMergePathnames ( + char *PrefixDir, + char *FilePathname); + void FlOpenIncludeFile ( ACPI_PARSE_OBJECT *Op); diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index b9c3020dd3a0..872063192982 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -523,6 +523,7 @@ NamePathTail [.]{NameSeg} "IPMI" { count (0); return (PARSEOP_REGIONSPACE_IPMI); } "GeneralPurposeIo" { count (0); return (PARSEOP_REGIONSPACE_GPIO); } /* ACPI 5.0 */ "GenericSerialBus" { count (0); return (PARSEOP_REGIONSPACE_GSBUS); } /* ACPI 5.0 */ +"PCC" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* ACPI 5.0 */ "FFixedHW" { count (0); return (PARSEOP_REGIONSPACE_FFIXEDHW); } /* ResourceTypeKeyword: Resource Usage - Resource Descriptors */ diff --git a/source/compiler/aslcompiler.y b/source/compiler/aslcompiler.y index 146747777e1f..7df36a841e95 100644 --- a/source/compiler/aslcompiler.y +++ b/source/compiler/aslcompiler.y @@ -363,6 +363,7 @@ void * AslLocalAllocate (unsigned int Size); %token PARSEOP_REGIONSPACE_IO %token PARSEOP_REGIONSPACE_IPMI %token PARSEOP_REGIONSPACE_MEM +%token PARSEOP_REGIONSPACE_PCC %token PARSEOP_REGIONSPACE_PCI %token PARSEOP_REGIONSPACE_PCIBAR %token PARSEOP_REGIONSPACE_SMBUS @@ -2359,6 +2360,7 @@ RegionSpaceKeyword | PARSEOP_REGIONSPACE_IPMI {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_IPMI);} | PARSEOP_REGIONSPACE_GPIO {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GPIO);} | PARSEOP_REGIONSPACE_GSBUS {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_GSBUS);} + | PARSEOP_REGIONSPACE_PCC {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_PCC);} | PARSEOP_REGIONSPACE_FFIXEDHW {$$ = TrCreateLeafNode (PARSEOP_REGIONSPACE_FFIXEDHW);} ; diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 3b384f20674d..cd0875d1ab3d 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -315,12 +315,16 @@ AePrintException ( } else { + /* + * Less verbose version of the error message, enabled via the + * -vi switch. The format is compatible with MS Visual Studio. + */ fprintf (OutputFile, "%s", Enode->Filename); if (Enode->LineNumber) { - fprintf (OutputFile, "(%u) i:%6u : ", - Enode->LineNumber, Enode->LineNumber); + fprintf (OutputFile, "(%u) : ", + Enode->LineNumber); } } } @@ -335,9 +339,18 @@ AePrintException ( { /* Decode the message ID */ - fprintf (OutputFile, "%s %4.4d - ", - AslErrorLevel[Enode->Level], - Enode->MessageId + ((Enode->Level+1) * 1000)); + if (Gbl_VerboseErrors) + { + fprintf (OutputFile, "%s %4.4d - ", + AslErrorLevel[Enode->Level], + Enode->MessageId + ((Enode->Level+1) * 1000)); + } + else /* IDE case */ + { + fprintf (OutputFile, "%s %4.4d:", + AslErrorLevelIde[Enode->Level], + Enode->MessageId + ((Enode->Level+1) * 1000)); + } MainMessage = AslMessages[Enode->MessageId]; ExtraMessage = Enode->Message; diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 8f02be32cff8..64f391f4f0a8 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -490,6 +490,107 @@ FlAddIncludeDirectory ( } +/******************************************************************************* + * + * FUNCTION: FlMergePathnames + * + * PARAMETERS: PrefixDir - Prefix directory pathname. Can be NULL or + * a zero length string. + * FilePathname - The include filename from the source ASL. + * + * RETURN: Merged pathname string + * + * DESCRIPTION: Merge two pathnames that (probably) have common elements, to + * arrive at a minimal length string. Merge can occur if the + * FilePathname is relative to the PrefixDir. + * + ******************************************************************************/ + +char * +FlMergePathnames ( + char *PrefixDir, + char *FilePathname) +{ + char *CommonPath; + char *Pathname; + char *LastElement; + + + DbgPrint (ASL_PARSE_OUTPUT, "Include: Prefix path - \"%s\"\n" + "Include: FilePathname - \"%s\"\n", + PrefixDir, FilePathname); + + /* + * If there is no prefix directory or if the file pathname is absolute, + * just return the original file pathname + */ + if (!PrefixDir || (!*PrefixDir) || + (*FilePathname == '/') || + (FilePathname[1] == ':')) + { + Pathname = ACPI_ALLOCATE (strlen (FilePathname) + 1); + strcpy (Pathname, FilePathname); + goto ConvertBackslashes; + } + + /* Need a local copy of the prefix directory path */ + + CommonPath = ACPI_ALLOCATE (strlen (PrefixDir) + 1); + strcpy (CommonPath, PrefixDir); + + /* + * Walk forward through the file path, and simultaneously backward + * through the prefix directory path until there are no more + * relative references at the start of the file path. + */ + while (*FilePathname && (!strncmp (FilePathname, "../", 3))) + { + /* Remove last element of the prefix directory path */ + + LastElement = strrchr (CommonPath, '/'); + if (!LastElement) + { + goto ConcatenatePaths; + } + + *LastElement = 0; /* Terminate CommonPath string */ + FilePathname += 3; /* Point to next path element */ + } + + /* + * Remove the last element of the prefix directory path (it is the same as + * the first element of the file pathname), and build the final merged + * pathname. + */ + LastElement = strrchr (CommonPath, '/'); + if (LastElement) + { + *LastElement = 0; + } + + /* Build the final merged pathname */ + +ConcatenatePaths: + Pathname = ACPI_ALLOCATE_ZEROED (strlen (CommonPath) + strlen (FilePathname) + 2); + if (LastElement && *CommonPath) + { + strcpy (Pathname, CommonPath); + strcat (Pathname, "/"); + } + strcat (Pathname, FilePathname); + ACPI_FREE (CommonPath); + + /* Convert all backslashes to normal slashes */ + +ConvertBackslashes: + UtConvertBackslashes (Pathname); + + DbgPrint (ASL_PARSE_OUTPUT, "Include: Merged Pathname - \"%s\"\n", + Pathname); + return (Pathname); +} + + /******************************************************************************* * * FUNCTION: FlOpenIncludeWithPrefix @@ -515,12 +616,9 @@ FlOpenIncludeWithPrefix ( /* Build the full pathname to the file */ - Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); + Pathname = FlMergePathnames (PrefixDir, Filename); - strcpy (Pathname, PrefixDir); - strcat (Pathname, Filename); - - DbgPrint (ASL_PARSE_OUTPUT, "\nAttempt to open include file: path %s\n\n", + DbgPrint (ASL_PARSE_OUTPUT, "Include: Opening file - \"%s\"\n\n", Pathname); /* Attempt to open the file, push if successful */ diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index 7fb2b3ad02d0..ae288b374d17 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -765,9 +765,18 @@ AslDoOptions ( break; case 'i': - /* Less verbose error messages */ - + /* + * Support for integrated development environment(s). + * + * 1) No compiler signon + * 2) Send stderr messages to stdout + * 3) Less verbose error messages (single line only for each) + * 4) Error/warning messages are formatted appropriately to + * be recognized by MS Visual Studio + */ Gbl_VerboseErrors = FALSE; + Gbl_DoSignon = FALSE; + Gbl_Files[ASL_FILE_STDERR].Handle = stdout; break; case 'o': diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 04fc53866bd4..240175dc867c 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -367,6 +367,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_IO, 0, 0), /* REGIONSPACE_IPMI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_IPMI, 0, 0), /* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SYSTEM_MEMORY, 0, 0), +/* REGIONSPACE_PCC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PLATFORM_COMM, 0, 0), /* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_CONFIG, 0, 0), /* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_PCI_BAR_TARGET, 0, 0), /* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, ACPI_ADR_SPACE_SMBUS, 0, 0), diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 45d50da19172..595e5f4c96db 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -402,7 +402,7 @@ char *AslMessages [] = { }; -char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { +const char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { "Warning ", "Warning ", "Warning ", @@ -411,6 +411,15 @@ char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { "Optimize" }; +const char *AslErrorLevelIde [ASL_NUM_REPORT_LEVELS] = { + "warning ", + "warning ", + "warning ", + "error ", + "remark ", + "optimize" +}; + #define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ #endif /* ASL_EXCEPTIONS */ diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index 13b7af4bfe37..a302164d452b 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -227,7 +227,7 @@ AslDetectSourceFileType ( /* Check for 100% ASCII source file (comments are ignored) */ - Status = FlCheckForAscii (Info); + Status = FlCheckForAscii (Info->Handle, Info->Filename, TRUE); if (ACPI_FAILURE (Status)) { printf ("Non-ascii input file - %s\n", Info->Filename); diff --git a/source/compiler/dtio.c b/source/compiler/dtio.c index 6357bfbacdda..2b4e433d0e2d 100644 --- a/source/compiler/dtio.c +++ b/source/compiler/dtio.c @@ -427,7 +427,6 @@ DtGetNextLine ( { case DT_START_QUOTED_STRING: case DT_SLASH_ASTERISK_COMMENT: - case DT_SLASH_SLASH_COMMENT: AcpiOsPrintf ("**** EOF within comment/string %u\n", State); break; @@ -436,7 +435,22 @@ DtGetNextLine ( break; } - return (ASL_EOF); + /* Standalone EOF is OK */ + + if (i == 0) + { + return (ASL_EOF); + } + + /* + * Received an EOF in the middle of a line. Terminate the + * line with a newline. The next call to this function will + * return a standalone EOF. Thus, the upper parsing software + * never has to deal with an EOF within a valid line (or + * the last line does not get tossed on the floor.) + */ + c = '\n'; + State = DT_NORMAL_TEXT; } switch (State) diff --git a/source/compiler/prscan.c b/source/compiler/prscan.c index 3013951b06dd..61c5ecc42f76 100644 --- a/source/compiler/prscan.c +++ b/source/compiler/prscan.c @@ -654,7 +654,7 @@ PrDoDirective ( } DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID - "Start #include file %s\n", Gbl_CurrentLineNumber, + "Start #include file \"%s\"\n", Gbl_CurrentLineNumber, Token, Gbl_CurrentLineNumber); PrOpenIncludeFile (Token); diff --git a/source/compiler/prutils.c b/source/compiler/prutils.c index a7c65bf54e38..b0e1e14626ec 100644 --- a/source/compiler/prutils.c +++ b/source/compiler/prutils.c @@ -246,13 +246,11 @@ PrOpenIncludeFile ( ASL_INCLUDE_DIR *NextDir; - /* - * start the actual include file on the next line - */ + /* Start the actual include file on the next line */ + Gbl_CurrentLineOffset++; /* Attempt to open the include file */ - /* If the file specifies an absolute path, just open it */ if ((Filename[0] == '/') || @@ -330,13 +328,10 @@ PrOpenIncludeWithPrefix ( /* Build the full pathname to the file */ - Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); + Pathname = FlMergePathnames (PrefixDir, Filename); - strcpy (Pathname, PrefixDir); - strcat (Pathname, Filename); - - DbgPrint (ASL_PARSE_OUTPUT, "\n" PR_PREFIX_ID - "Opening include file: path %s\n", + DbgPrint (ASL_PARSE_OUTPUT, PR_PREFIX_ID + "Include: Opening file - \"%s\"\n", Gbl_CurrentLineNumber, Pathname); /* Attempt to open the file, push if successful */ diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c index ef9b7fef5379..9845ff47e68f 100644 --- a/source/components/debugger/dbfileio.c +++ b/source/components/debugger/dbfileio.c @@ -51,6 +51,10 @@ #include "actables.h" #endif +#ifdef ACPI_ASL_COMPILER +#include "aslcompiler.h" +#endif + #if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER) #define _COMPONENT ACPI_CA_DEBUGGER @@ -309,6 +313,15 @@ AcpiDbReadTable ( AcpiOsPrintf ( "TableHeader length [0x%X] greater than the input file size [0x%X]\n", TableHeader.Length, FileSize); + +#ifdef ACPI_ASL_COMPILER + Status = FlCheckForAscii (fp, NULL, FALSE); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("File appears to be ASCII only, must be binary\n", + TableHeader.Length, FileSize); + } +#endif return (AE_BAD_HEADER); } diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 1c3c523720cf..8a364c8a90bc 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -57,6 +57,18 @@ /* Local prototypes */ +#ifdef ACPI_ASL_COMPILER +#include "acdisasm.h" + +static ACPI_STATUS +AcpiDsCreateExternalRegion ( + ACPI_STATUS LookupStatus, + ACPI_PARSE_OBJECT *Op, + char *Path, + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE **Node); +#endif + static ACPI_STATUS AcpiDsGetFieldNames ( ACPI_CREATE_FIELD_INFO *Info, @@ -64,6 +76,69 @@ AcpiDsGetFieldNames ( ACPI_PARSE_OBJECT *Arg); +#ifdef ACPI_ASL_COMPILER +/******************************************************************************* + * + * FUNCTION: AcpiDsCreateExternalRegion (iASL Disassembler only) + * + * PARAMETERS: LookupStatus - Status from NsLookup operation + * Op - Op containing the Field definition and args + * Path - Pathname of the region + * ` WalkState - Current method state + * Node - Where the new region node is returned + * + * RETURN: Status + * + * DESCRIPTION: Add region to the external list if NOT_FOUND. Create a new + * region node/object. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDsCreateExternalRegion ( + ACPI_STATUS LookupStatus, + ACPI_PARSE_OBJECT *Op, + char *Path, + ACPI_WALK_STATE *WalkState, + ACPI_NAMESPACE_NODE **Node) +{ + ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; + + + if (LookupStatus != AE_NOT_FOUND) + { + return (LookupStatus); + } + + /* + * Table disassembly: + * OperationRegion not found. Generate an External for it, and + * insert the name into the namespace. + */ + AcpiDmAddToExternalList (Op, Path, ACPI_TYPE_REGION, 0); + Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_REGION, + ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, Node); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Must create and install a region object for the new node */ + + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); + if (!ObjDesc) + { + return (AE_NO_MEMORY); + } + + ObjDesc->Region.Node = *Node; + Status = AcpiNsAttachObject (*Node, ObjDesc, ACPI_TYPE_REGION); + return (Status); +} +#endif + + /******************************************************************************* * * FUNCTION: AcpiDsCreateBufferField @@ -438,11 +513,16 @@ AcpiDsCreateField ( /* First arg is the name of the parent OpRegion (must already exist) */ Arg = Op->Common.Value.Arg; + if (!RegionNode) { Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); +#ifdef ACPI_ASL_COMPILER + Status = AcpiDsCreateExternalRegion (Status, Arg, + Arg->Common.Value.Name, WalkState, &RegionNode); +#endif if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); @@ -628,6 +708,10 @@ AcpiDsCreateBankField ( Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Common.Value.Name, ACPI_TYPE_REGION, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode); +#ifdef ACPI_ASL_COMPILER + Status = AcpiDsCreateExternalRegion (Status, Arg, + Arg->Common.Value.Name, WalkState, &RegionNode); +#endif if (ACPI_FAILURE (Status)) { ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c index 1b709a5787eb..334e2418ba19 100644 --- a/source/components/events/evxface.c +++ b/source/components/events/evxface.c @@ -280,11 +280,9 @@ AcpiRemoveNotifyHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } -#ifdef _UNDER_DEVELOPMENT - /* Make sure all deferred tasks are completed */ + /* Make sure all deferred notify tasks are completed */ - AcpiOsWaitEventsComplete (NULL); -#endif + AcpiOsWaitEventsComplete (); Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); if (ACPI_FAILURE (Status)) @@ -802,6 +800,10 @@ AcpiRemoveGpeHandler ( return_ACPI_STATUS (AE_BAD_PARAMETER); } + /* Make sure all deferred GPE tasks are completed */ + + AcpiOsWaitEventsComplete (); + Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); if (ACPI_FAILURE (Status)) { diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index e8773204478c..46925114ebe4 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -52,12 +52,13 @@ /* Local prototypes */ -static ACPI_INLINE void +static void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, UINT8 ByteWidth, - UINT64 Address); + UINT64 Address, + char *RegisterName); static void AcpiTbConvertFadt ( @@ -202,13 +203,30 @@ static ACPI_FADT_PM_INFO FadtPmInfoTable[] = * ******************************************************************************/ -static ACPI_INLINE void +static void AcpiTbInitGenericAddress ( ACPI_GENERIC_ADDRESS *GenericAddress, UINT8 SpaceId, UINT8 ByteWidth, - UINT64 Address) + UINT64 Address, + char *RegisterName) { + UINT8 BitWidth; + + + /* Bit width field in the GAS is only one byte long, 255 max */ + + BitWidth = (UINT8) (ByteWidth * 8); + + if (ByteWidth > 31) /* (31*8)=248 */ + { + ACPI_ERROR ((AE_INFO, + "%s - 32-bit FADT register is too long (%u bytes, %u bits) " + "to convert to GAS struct - 255 bits max, truncating", + RegisterName, ByteWidth, (ByteWidth * 8))); + + BitWidth = 255; + } /* * The 64-bit Address field is non-aligned in the byte packed @@ -219,7 +237,7 @@ AcpiTbInitGenericAddress ( /* All other fields are byte-wide */ GenericAddress->SpaceId = SpaceId; - GenericAddress->BitWidth = (UINT8) ACPI_MUL_8 (ByteWidth); + GenericAddress->BitWidth = BitWidth; GenericAddress->BitOffset = 0; GenericAddress->AccessWidth = 0; /* Access width ANY */ } @@ -484,7 +502,7 @@ AcpiTbConvertFadt ( */ AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO, *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), - (UINT64) Address32); + (UINT64) Address32, FadtInfoTable[i].Name); } } } @@ -700,7 +718,8 @@ AcpiTbSetupFadtRegisters ( AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target, Source64->SpaceId, Pm1RegisterByteWidth, Source64->Address + - (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth)); + (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth), + "PmRegisters"); } } } diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 062c768e72a0..7ce00df64281 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -53,6 +53,41 @@ ACPI_MODULE_NAME ("utmisc") +/******************************************************************************* + * + * FUNCTION: UtConvertBackslashes + * + * PARAMETERS: Pathname - File pathname string to be converted + * + * RETURN: Modifies the input Pathname + * + * DESCRIPTION: Convert all backslashes (0x5C) to forward slashes (0x2F) within + * the entire input file pathname string. + * + ******************************************************************************/ + +void +UtConvertBackslashes ( + char *Pathname) +{ + + if (!Pathname) + { + return; + } + + while (*Pathname) + { + if (*Pathname == '\\') + { + *Pathname = '/'; + } + + Pathname++; + } +} + + /******************************************************************************* * * FUNCTION: AcpiUtValidateException diff --git a/source/include/acobject.h b/source/include/acobject.h index f2f8a1cfb112..e0f4a5259863 100644 --- a/source/include/acobject.h +++ b/source/include/acobject.h @@ -94,7 +94,7 @@ #define AOPOBJ_AML_CONSTANT 0x01 /* Integer is an AML constant */ #define AOPOBJ_STATIC_POINTER 0x02 /* Data is part of an ACPI table, don't delete */ -#define AOPOBJ_DATA_VALID 0x04 /* Object is intialized and data is valid */ +#define AOPOBJ_DATA_VALID 0x04 /* Object is initialized and data is valid */ #define AOPOBJ_OBJECT_INITIALIZED 0x08 /* Region is initialized, _REG was run */ #define AOPOBJ_SETUP_COMPLETE 0x10 /* Region setup is complete */ #define AOPOBJ_INVALID 0x20 /* Host OS won't allow a Region address */ @@ -124,7 +124,7 @@ typedef struct acpi_object_integer /* * Note: The String and Buffer object must be identical through the Pointer - * and length elements. There is code that depends on this. + * and Length elements. There is code that depends on this. * * Fields common to both Strings and Buffers */ @@ -389,7 +389,7 @@ typedef struct acpi_object_notify_handler ACPI_OBJECT_COMMON_HEADER ACPI_NAMESPACE_NODE *Node; /* Parent device */ UINT32 HandlerType; /* Type: Device/System/Both */ - ACPI_NOTIFY_HANDLER Handler; /* Handler addess */ + ACPI_NOTIFY_HANDLER Handler; /* Handler address */ void *Context; union acpi_operand_object *Next[2]; /* Device and System handler lists */ @@ -405,7 +405,7 @@ typedef struct acpi_object_addr_handler ACPI_NAMESPACE_NODE *Node; /* Parent device */ void *Context; ACPI_ADR_SPACE_SETUP Setup; - union acpi_operand_object *RegionList; /* regions using this handler */ + union acpi_operand_object *RegionList; /* Regions using this handler */ union acpi_operand_object *Next; } ACPI_OBJECT_ADDR_HANDLER; diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index b79d0e6ade4e..fc9c8f0d7a54 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -275,7 +275,7 @@ AcpiOsExecute ( void AcpiOsWaitEventsComplete ( - void *Context); + void); void AcpiOsSleep ( diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 7478c789409c..70a00d7d9a20 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -48,7 +48,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20120420 +#define ACPI_CA_VERSION 0x20120518 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actypes.h b/source/include/actypes.h index 4a5188544e77..53ebc91b0863 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -731,8 +731,9 @@ typedef UINT8 ACPI_ADR_SPACE_TYPE; #define ACPI_ADR_SPACE_IPMI (ACPI_ADR_SPACE_TYPE) 7 #define ACPI_ADR_SPACE_GPIO (ACPI_ADR_SPACE_TYPE) 8 #define ACPI_ADR_SPACE_GSBUS (ACPI_ADR_SPACE_TYPE) 9 +#define ACPI_ADR_SPACE_PLATFORM_COMM (ACPI_ADR_SPACE_TYPE) 10 -#define ACPI_NUM_PREDEFINED_REGIONS 10 +#define ACPI_NUM_PREDEFINED_REGIONS 11 /* * Special Address Spaces diff --git a/source/include/acutils.h b/source/include/acutils.h index e9c9b95dda1d..be568766af69 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -703,6 +703,10 @@ AcpiUtShortDivide ( /* * utmisc */ +void +UtConvertBackslashes ( + char *Pathname); + const char * AcpiUtValidateException ( ACPI_STATUS Status); diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index a0899d208d2a..4f9d1d0724d5 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -1241,3 +1241,24 @@ AcpiOsExecute ( } #endif /* ACPI_SINGLE_THREADED */ + + +/****************************************************************************** + * + * FUNCTION: AcpiOsWaitEventsComplete + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Wait for all asynchronous events to complete. This + * implementation does nothing. + * + *****************************************************************************/ + +void +AcpiOsWaitEventsComplete ( + void) +{ + return; +} diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 008dcb30c536..91a37e03c26c 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -1479,3 +1479,24 @@ AcpiOsExecute ( #endif /* ACPI_SINGLE_THREADED */ + +/****************************************************************************** + * + * FUNCTION: AcpiOsWaitEventsComplete + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Wait for all asynchronous events to complete. This + * implementation does nothing. + * + *****************************************************************************/ + +void +AcpiOsWaitEventsComplete ( + void) +{ + return; +} + diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index a5d519c1e178..d0e980b5a1fb 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -239,16 +239,20 @@ FlSplitInputPathname ( return (AE_NO_MEMORY); } - Substring = strrchr (DirectoryPath, '\\'); + /* Convert backslashes to slashes in the entire path */ + + UtConvertBackslashes (DirectoryPath); + + /* Backup to last slash or colon */ + + Substring = strrchr (DirectoryPath, '/'); if (!Substring) { - Substring = strrchr (DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, ':'); - } + Substring = strrchr (DirectoryPath, ':'); } + /* Extract the simple filename */ + if (!Substring) { DirectoryPath[0] = 0; @@ -267,7 +271,6 @@ FlSplitInputPathname ( *OutDirectoryPath = DirectoryPath; *OutFilename = Filename; - return (AE_OK); }