From 291c27508808bb5c9ab780eb971fe958491f1468 Mon Sep 17 00:00:00 2001 From: jkim Date: Sat, 19 May 2012 05:44:32 +0000 Subject: 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 e55e286..d31e914 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 9c46e66..e405a30 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 d971e68..2caf599 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 efda35a..5336b61 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 37c34fc..d509c8a 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 8fcca0a..2a87a01 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 7eef917..937530d 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 b9c3020..8720631 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 1467477..7df36a8 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 3b384f2..cd0875d 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 8f02be3..64f391f 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -492,6 +492,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 * * PARAMETERS: PrefixDir - Prefix directory pathname. Can be a zero @@ -515,12 +616,9 @@ FlOpenIncludeWithPrefix ( /* Build the full pathname to the file */ - Pathname = ACPI_ALLOCATE (strlen (PrefixDir) + strlen (Filename) + 1); - - strcpy (Pathname, PrefixDir); - strcat (Pathname, Filename); + Pathname = FlMergePathnames (PrefixDir, 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 7fb2b3a..ae288b3 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 04fc5386..240175d 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 45d50da..595e5f4 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 13b7af4..a302164 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 6357bfb..2b4e433 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 3013951..61c5ecc 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 a7c65bf..b0e1e14 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 ef9b7fe..9845ff4 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 1c3c523..8a364c8 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 1b709a5..334e241 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 e877320..4692511 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 062c768..7ce00df 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -55,6 +55,41 @@ /******************************************************************************* * + * 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 * * PARAMETERS: Status - The ACPI_STATUS code to be formatted diff --git a/source/include/acobject.h b/source/include/acobject.h index f2f8a1c..e0f4a52 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 b79d0e6..fc9c8f0 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 7478c78..70a00d7 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 4a51885..53ebc91 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 e9c9b95..be56876 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 a0899d2..4f9d1d0 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 008dcb3..91a37e0 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 a5d519c..d0e980b 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); } -- cgit v1.1 From 2276af3c12160e6d7e3e06b506bf4ae5c9e8c420 Mon Sep 17 00:00:00 2001 From: jkim Date: Wed, 20 Jun 2012 17:51:04 +0000 Subject: Import ACPICA 20120620. --- changes.txt | 64 ++++++ generate/unix/iasl/Makefile | 1 + source/common/ahpredef.c | 323 +++++++++++++++++++++++++++++ source/common/dmextern.c | 6 +- source/common/dmrestag.c | 21 +- source/compiler/Makefile | 1 + source/compiler/aslcompile.c | 74 ++++--- source/compiler/aslerror.c | 2 +- source/compiler/aslfiles.c | 18 +- source/compiler/asllookup.c | 2 +- source/compiler/aslmain.c | 44 ++-- source/compiler/aslsupport.l | 36 +++- source/compiler/aslutils.c | 90 ++++----- source/compiler/dttemplate.c | 2 +- source/components/debugger/dbdisply.c | 11 +- source/components/debugger/dbexec.c | 6 +- source/components/debugger/dbutils.c | 4 +- source/components/disassembler/dmopcode.c | 213 ++++++++++++++++++++ source/components/disassembler/dmwalk.c | 55 ++++- source/components/dispatcher/dsfield.c | 4 +- source/components/dispatcher/dsopcode.c | 14 +- source/components/events/evgpe.c | 15 +- source/components/events/evgpeutil.c | 19 ++ source/components/events/evxfgpe.c | 70 +++++-- source/components/executer/exconfig.c | 2 +- source/components/utilities/utmisc.c | 4 +- source/include/acdebug.h | 2 +- source/include/acdisasm.h | 8 + source/include/acglobal.h | 10 + source/include/aclocal.h | 32 ++- source/include/acpixf.h | 2 +- source/include/acpredef.h | 6 +- source/include/acutils.h | 2 +- source/include/platform/acwin64.h | 1 + source/tools/acpiexec/aeexec.c | 5 +- source/tools/acpihelp/acpihelp.h | 9 - source/tools/acpihelp/ahpredef.c | 312 ---------------------------- source/tools/acpisrc/acpisrc.h | 3 +- source/tools/acpisrc/ascase.c | 324 ++++++++++++++++++------------ source/tools/acpisrc/asfile.c | 2 +- source/tools/acpisrc/asmain.c | 16 +- source/tools/acpisrc/astable.c | 1 + 42 files changed, 1196 insertions(+), 640 deletions(-) create mode 100644 source/common/ahpredef.c delete mode 100644 source/tools/acpihelp/ahpredef.c diff --git a/changes.txt b/changes.txt index d31e914..2123937 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,68 @@ ---------------------------------------- +20 June 2012. Summary of changes for version 20120620: + +This release is available at https://www.acpica.org/downloads +The ACPI 5.0 specification is available at www.acpi.info + +1) ACPICA Kernel-resident Subsystem: + +Implemented support to expand the "implicit notify" feature to allow multiple +devices to be notified by a single GPE. This feature automatically generates a +runtime device notification in the absence of a BIOS-provided GPE control +method (_Lxx/_Exx) or a host-installed handler for the GPE. Implicit notify is +provided by ACPICA for Windows compatibility, and is a workaround for BIOS AML +code errors. See the description of the AcpiSetupGpeForWake interface in the +APCICA reference. Bob Moore, Rafael Wysocki. ACPICA BZ 918. + +Changed some comments and internal function names to simplify and ensure +correctness of the Linux code translation. No functional changes. + +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: 93.0K Code, 25.1K Data, 118.1K Total + Debug Version: 172.7K Code, 73.6K Data, 246.3K Total + Current Release: + Non-Debug Version: 93.1K Code, 25.1K Data, 118.2K Total + Debug Version: 172.9K Code, 73.6K Data, 246.5K Total + + +2) iASL Compiler/Disassembler and Tools: + +Disassembler: Added support to emit short, commented descriptions for the ACPI +predefined names in order to improve the readability of the disassembled +output. ACPICA BZ 959. Changes include: + 1) Emit descriptions for all standard predefined names (_INI, _STA, _PRW, +etc.) + 2) Emit generic descriptions for the special names (_Exx, _Qxx, etc.) + 3) Emit descriptions for the resource descriptor names (_MIN, _LEN, etc.) + +AcpiSrc: Fixed several long-standing Linux code translation issues. Argument +descriptions in function headers are now translated properly to lower case and +underscores. ACPICA BZ 961. Also fixes translation problems such as these: +(old -> new) + i_aSL -> iASL + 00-7_f -> 00-7F + 16_k -> 16K + local_fADT -> local_FADT + execute_oSI -> execute_OSI + +iASL: Fixed a problem where null bytes were inadvertently emitted into some +listing files. + +iASL: Added the existing debug options to the standard help screen. There are +no longer two different help screens. ACPICA BZ 957. + +AcpiHelp: Fixed some typos in the various predefined name descriptions. Also +expand some of the descriptions where appropriate. + +iASL: Fixed the -ot option (display compile times/statistics). Was not working +properly for standard output; only worked for the debug file case. + +---------------------------------------- 18 May 2012. Summary of changes for version 20120518: diff --git a/generate/unix/iasl/Makefile b/generate/unix/iasl/Makefile index 8d9dff7..53ba001 100644 --- a/generate/unix/iasl/Makefile +++ b/generate/unix/iasl/Makefile @@ -45,6 +45,7 @@ OBJECTS = \ $(OBJDIR)/adfile.o \ $(OBJDIR)/adisasm.o \ $(OBJDIR)/adwalk.o \ + $(OBJDIR)/ahpredef.o \ $(OBJDIR)/aslanalyze.o \ $(OBJDIR)/aslbtypes.o \ $(OBJDIR)/aslcodegen.o \ diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c new file mode 100644 index 0000000..b3f1496 --- /dev/null +++ b/source/common/ahpredef.c @@ -0,0 +1,323 @@ +/****************************************************************************** + * + * Module Name: ahpredef - Table of all known ACPI predefined names + * + *****************************************************************************/ + +/* + * Copyright (C) 2000 - 2012, Intel Corp. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGES. + */ + +#include "acpi.h" +#include "accommon.h" + +/* + * iASL only needs a partial table (short descriptions only). + * AcpiHelp needs the full table. + */ +#ifdef ACPI_ASL_COMPILER +#define AH_PREDEF(Name, ShortDesc, LongDesc) {Name, ShortDesc} +#else +#define AH_PREDEF(Name, ShortDesc, LongDesc) {Name, ShortDesc, LongDesc} +#endif + +/* + * Predefined ACPI names, with short description and return value. + * This table was extracted directly from the ACPI specification. + */ +const AH_PREDEFINED_NAME AslPredefinedInfo[] = +{ + AH_PREDEF ("_ACx", "Active Cooling", "Returns the active cooling policy threshold values"), + AH_PREDEF ("_ADR", "Address", "Returns the address of a device on its parent bus"), + AH_PREDEF ("_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"), + AH_PREDEF ("_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"), + AH_PREDEF ("_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"), + AH_PREDEF ("_ALN", "Alignment", "Base alignment, Resource Descriptor field"), + AH_PREDEF ("_ALP", "Ambient Light Polling", "Returns the ambient light sensor polling frequency"), + AH_PREDEF ("_ALR", "Ambient Light Response", "Returns the ambient light brightness to display brightness mappings"), + AH_PREDEF ("_ALT", "Ambient Light Temperature", "Returns the ambient light color temperature"), + AH_PREDEF ("_ALx", "Active List", "Returns a list of active cooling device objects"), + AH_PREDEF ("_ART", "Active Cooling Relationship Table", "Returns thermal relationship information between platform devices and fan devices"), + AH_PREDEF ("_ASI", "Address Space Id", "Resource Descriptor field"), + AH_PREDEF ("_ASZ", "Access Size", "Resource Descriptor field"), + AH_PREDEF ("_ATT", "Type-Specific Attribute", "Resource Descriptor field"), + AH_PREDEF ("_BAS", "Base Address", "Range base address, Resource Descriptor field"), + AH_PREDEF ("_BBN", "BIOS Bus Number", "Returns the PCI bus number returned by the BIOS"), + AH_PREDEF ("_BCL", "Brightness Control Levels", "Returns a list of supported brightness control levels"), + AH_PREDEF ("_BCM", "Brightness Control Method", "Sets the brightness level of the display device"), + AH_PREDEF ("_BCT", "Battery Charge Time", "Returns time remaining to complete charging battery"), + AH_PREDEF ("_BDN", "BIOS Dock Name", "Returns the Dock ID returned by the BIOS"), + AH_PREDEF ("_BFS", "Back From Sleep", "Inform AML of a wake event"), + AH_PREDEF ("_BIF", "Battery Information", "Returns a Control Method Battery information block"), + AH_PREDEF ("_BIX", "Battery Information Extended", "Returns a Control Method Battery extended information block"), + AH_PREDEF ("_BLT", "Battery Level Threshold", "Set battery level threshold preferences"), + AH_PREDEF ("_BM_", "Bus Master", "Resource Descriptor field"), + AH_PREDEF ("_BMA", "Battery Measurement Averaging Interval", "Sets battery measurement averaging interval"), + AH_PREDEF ("_BMC", "Battery Maintenance Control", "Sets battery maintenance and control features"), + AH_PREDEF ("_BMD", "Battery Maintenance Data", "Returns battery maintenance, control, and state data"), + AH_PREDEF ("_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"), + AH_PREDEF ("_BQC", "Brightness Query Current", "Returns the current display brightness level"), + AH_PREDEF ("_BST", "Battery Status", "Returns a Control Method Battery status block"), + AH_PREDEF ("_BTM", "Battery Time", "Returns the battery runtime"), + AH_PREDEF ("_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"), + AH_PREDEF ("_CBA", "Configuration Base Address", "Sets the base address for a PCI Express host bridge"), + AH_PREDEF ("_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"), + AH_PREDEF ("_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"), + AH_PREDEF ("_CLS", "Class Code", "Returns PCI class code and subclass"), + AH_PREDEF ("_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"), + AH_PREDEF ("_CRS", "Current Resource Settings", "Returns the current resource settings for a device"), + AH_PREDEF ("_CRT", "Critical Temperature", "Returns the shutdown critical temperature"), + AH_PREDEF ("_CSD", "C-State Dependencies", "Returns a list of C-state dependencies"), + AH_PREDEF ("_CST", "C-States", "Returns a list of supported C-states"), + AH_PREDEF ("_CWS", "Clear Wake Alarm Status", "Clear the status of wake alarms"), + AH_PREDEF ("_DBT", "Debounce Timeout", "Timeout value, Resource Descriptor field"), + AH_PREDEF ("_DCK", "Dock Present", "Sets docking isolation. Presence indicates device is a docking station"), + AH_PREDEF ("_DCS", "Display Current Status", "Returns status of the display output device"), + AH_PREDEF ("_DDC", "Display Data Current", "Returns the EDID for the display output device"), + AH_PREDEF ("_DDN", "DOS Device Name", "Returns a device logical name"), + AH_PREDEF ("_DEC", "Decode", "Device decoding type, Resource Descriptor field"), + AH_PREDEF ("_DEP", "Dependencies", "Returns a list of operation region dependencies"), + AH_PREDEF ("_DGS", "Display Graphics State", "Return the current state of the output device"), + AH_PREDEF ("_DIS", "Disable Device", "Disables a device"), + AH_PREDEF ("_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"), + AH_PREDEF ("_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"), + AH_PREDEF ("_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"), + AH_PREDEF ("_DOS", "Disable Output Switching", "Sets the display output switching mode"), + AH_PREDEF ("_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"), + AH_PREDEF ("_DRS", "Drive Strength", "Drive Strength setting for GPIO connection, Resource Descriptor field"), + AH_PREDEF ("_DSM", "Device-Specific Method", "Executes device-specific functions"), + AH_PREDEF ("_DSS", "Device Set State", "Sets the display device state"), + AH_PREDEF ("_DSW", "Device Sleep Wake", "Sets the sleep and wake transition states for a device"), + AH_PREDEF ("_DTI", "Device Temperature Indication", "Conveys native device temperature to the platform"), + AH_PREDEF ("_Exx", "Edge-Triggered GPE", "Method executed as a result of a general-purpose event"), + AH_PREDEF ("_EC_", "Embedded Controller", "returns EC offset and query information"), + AH_PREDEF ("_EDL", "Eject Device List", "Returns a list of devices that are dependent on a device (docking)"), + AH_PREDEF ("_EJD", "Ejection Dependent Device", "Returns the name of dependent (parent) device (docking)"), + AH_PREDEF ("_EJx", "Eject Device", "Begin or cancel a device ejection request (docking)"), + AH_PREDEF ("_END", "Endianness", "Endian orientation, Resource Descriptor field"), + AH_PREDEF ("_EVT", "Event", "Event method for GPIO events"), + AH_PREDEF ("_FDE", "Floppy Disk Enumerate", "Returns floppy disk configuration information"), + AH_PREDEF ("_FDI", "Floppy Drive Information", "Returns a floppy drive information block"), + AH_PREDEF ("_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"), + AH_PREDEF ("_FIF", "Fan Information", "Returns fan device information"), + AH_PREDEF ("_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"), + AH_PREDEF ("_FLC", "Flow Control", "Flow control, Resource Descriptor field"), + AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"), + AH_PREDEF ("_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"), + AH_PREDEF ("_FST", "Fan Status", "Returns current status information for a fan device"), + AH_PREDEF ("_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"), + AH_PREDEF ("_GCP", "Get Capabilities", "Get device time capabilities"), + AH_PREDEF ("_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"), + AH_PREDEF ("_GL_", "Global Lock", "OS-defined Global Lock mutex object"), + AH_PREDEF ("_GLK", "Get Global Lock Requirement", "Returns a device's Global Lock requirement for device access"), + AH_PREDEF ("_GPD", "Get Post Data", "Returns the value of the VGA device that will be posted at boot"), + AH_PREDEF ("_GPE", "General Purpose Events", "Predefined scope (\\_GPE) or SCI number for EC"), + AH_PREDEF ("_GRA", "Granularity", "Address space granularity, Resource Descriptor field"), + AH_PREDEF ("_GRT", "Get Real Time", "Returns current time-of-day from a time/alarm device"), + AH_PREDEF ("_GSB", "Global System Interrupt Base", "Returns the GSB for a I/O APIC device"), + AH_PREDEF ("_GTF", "Get Task File", "Returns a list of ATA commands to restore a drive to default state"), + AH_PREDEF ("_GTM", "Get Timing Mode", "Returns a list of IDE controller timing information"), + AH_PREDEF ("_GTS", "Going To Sleep", "Inform AML of pending sleep"), + AH_PREDEF ("_GWS", "Get Wake Status", "Return status of wake alarms"), + AH_PREDEF ("_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"), + AH_PREDEF ("_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"), + AH_PREDEF ("_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"), + AH_PREDEF ("_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"), + AH_PREDEF ("_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"), + AH_PREDEF ("_HRV", "Hardware Revision", "Returns a hardware revision value"), + AH_PREDEF ("_IFT", "IPMI Interface Type", "See the Intelligent Platform Management Interface Specification"), + AH_PREDEF ("_INI", "Initialize", "Performs device specific initialization"), + AH_PREDEF ("_INT", "Interrupts", "Interrupt mask bits, Resource Descriptor field"), + AH_PREDEF ("_IOR", "I/O Restriction", "Restriction type, Resource Descriptor field"), + AH_PREDEF ("_IRC", "Inrush Current", "Presence indicates that a device has a significant inrush current draw"), + AH_PREDEF ("_Lxx", "Level-Triggered GPE", "Control method executed as a result of a general-purpose event"), + AH_PREDEF ("_LCK", "Lock Device", "Locks or unlocks a device (docking)"), + AH_PREDEF ("_LEN", "Length", "Range length, Resource Descriptor field"), + AH_PREDEF ("_LID", "Lid Status", "Returns the open/closed status of the lid on a mobile system"), + AH_PREDEF ("_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"), + AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), + AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), + AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), + AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), + AH_PREDEF ("_MBM", "Memory Bandwidth Monitoring Data", "Returns bandwidth monitoring data for a memory device"), + AH_PREDEF ("_MEM", "Memory Attributes", "Resource Descriptor field"), + AH_PREDEF ("_MIF", "Minimum Address Fixed", "Resource Descriptor field"), + AH_PREDEF ("_MIN", "Minimum Base Address", "Resource Descriptor field"), + AH_PREDEF ("_MLS", "Multiple Language String", "Returns a device description in multiple languages"), + AH_PREDEF ("_MOD", "Mode", "Interrupt mode, Resource Descriptor field"), + AH_PREDEF ("_MSG", "Message", "Sets the system message waiting status indicator"), + AH_PREDEF ("_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"), + AH_PREDEF ("_MTP", "Memory Type", "Resource Descriptor field"), + AH_PREDEF ("_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"), + AH_PREDEF ("_OFF", "Power Off", "Sets a power resource to the off state"), + AH_PREDEF ("_ON_", "Power On", "Sets a power resource to the on state"), + AH_PREDEF ("_OS_", "Operating System", "Returns a string that identifies the operating system"), + AH_PREDEF ("_OSC", "Operating System Capabilities", "Inform AML of host features and capabilities"), + AH_PREDEF ("_OSI", "Operating System Interfaces", "Returns supported interfaces, behaviors, and features"), + AH_PREDEF ("_OST", "OSPM Status Indication", "Inform AML of event processing status"), + AH_PREDEF ("_PAI", "Power Averaging Interval", "Sets the averaging interval for a power meter"), + AH_PREDEF ("_PAR", "Parity", "Parity bits, Resource Descriptor field"), + AH_PREDEF ("_PCL", "Power Consumer List", "Returns a list of devices powered by a power source"), + AH_PREDEF ("_PCT", "Performance Control", "Returns processor performance control and status registers"), + AH_PREDEF ("_PDC", "Processor Driver Capabilities", "Inform AML of processor driver capabilities"), + AH_PREDEF ("_PDL", "P-state Depth Limit", "Returns the lowest available performance P-state"), + AH_PREDEF ("_PHA", "Clock Phase", "Clock phase, Resource Descriptor field"), + AH_PREDEF ("_PIC", "Interrupt Model", "Inform AML of the interrupt model in use"), + AH_PREDEF ("_PIF", "Power Source Information", "Returns a Power Source information block"), + AH_PREDEF ("_PIN", "Pin List", "Pin list, Resource Descriptor field"), + AH_PREDEF ("_PLD", "Physical Device Location", "Returns a device's physical location information"), + AH_PREDEF ("_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"), + AH_PREDEF ("_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"), + AH_PREDEF ("_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"), + AH_PREDEF ("_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"), + AH_PREDEF ("_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"), + AH_PREDEF ("_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"), + AH_PREDEF ("_PPI", "Pin Configuration", "Resource Descriptor field"), + AH_PREDEF ("_PR", "Processor", "Predefined scope for processor objects"), + AH_PREDEF ("_PR0", "Power Resources for D0", "Returns a list of dependent power resources to enter state D0 (fully on)"), + AH_PREDEF ("_PR1", "Power Resources for D1", "Returns a list of dependent power resources to enter state D1"), + AH_PREDEF ("_PR2", "Power Resources for D2", "Returns a list of dependent power resources to enter state D2"), + AH_PREDEF ("_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"), + AH_PREDEF ("_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"), + AH_PREDEF ("_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"), + AH_PREDEF ("_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"), + AH_PREDEF ("_PRT", "PCI Routing Table", "Returns a list of PCI interrupt mappings"), + AH_PREDEF ("_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"), + AH_PREDEF ("_PS0", "Power State 0", "Sets a device's power state to D0 (device fully on)"), + AH_PREDEF ("_PS1", "Power State 1", "Sets a device's power state to D1"), + AH_PREDEF ("_PS2", "Power State 2", "Sets a device's power state to D2"), + AH_PREDEF ("_PS3", "Power State 3", "Sets a device's power state to D3 (device off)"), + AH_PREDEF ("_PSC", "Power State Current", "Returns a device's current power state"), + AH_PREDEF ("_PSD", "Power State Dependencies", "Returns processor P-State dependencies"), + AH_PREDEF ("_PSE", "Power State for Enumeration", "Put a bus into enumeration power mode"), + AH_PREDEF ("_PSL", "Passive List", "Returns a list of passive cooling device objects"), + AH_PREDEF ("_PSR", "Power Source", "Returns the power source device currently in use"), + AH_PREDEF ("_PSS", "Performance Supported States", "Returns a list of supported processor performance states"), + AH_PREDEF ("_PSV", "Passive Temperature", "Returns the passive trip point temperature"), + AH_PREDEF ("_PSW", "Power State Wake", "Sets a device's wake function"), + AH_PREDEF ("_PTC", "Processor Throttling Control", "Returns throttling control and status registers"), + AH_PREDEF ("_PTP", "Power Trip Points", "Sets trip points for the Power Meter device"), + AH_PREDEF ("_PTS", "Prepare To Sleep", "Inform the platform of an impending sleep transition"), + AH_PREDEF ("_PUR", "Processor Utilization Request", "Returns the number of processors that the platform would like to idle"), + AH_PREDEF ("_PXM", "Device Proximity", "Returns a device's proximity domain identifier"), + AH_PREDEF ("_Qxx", "EC Query", "Embedded Controller query and SMBus Alarm control method"), + AH_PREDEF ("_RBO", "Register Bit Offset", "Resource Descriptor field"), + AH_PREDEF ("_RBW", "Register Bit Width", "Resource Descriptor field"), + AH_PREDEF ("_REG", "Region Availability", "Inform AML code of an operation region availability change"), + AH_PREDEF ("_REV", "Supported ACPI Revision", "Returns the revision of the ACPI specification that is implemented"), + AH_PREDEF ("_RMV", "Removal Status", "Returns a device's removal ability status (docking)"), + AH_PREDEF ("_RNG", "Range", "Memory range type, Resource Descriptor field"), + AH_PREDEF ("_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"), + AH_PREDEF ("_RT_", "Resource Type", "Resource Descriptor field"), + AH_PREDEF ("_RTV", "Relative Temperature Values", "Returns temperature value information"), + AH_PREDEF ("_RW_", "Read-Write Status", "Resource Descriptor field"), + AH_PREDEF ("_RXL", "Receive Buffer Size", "Serial channel buffer, Resource Descriptor field"), + AH_PREDEF ("_S0_", "S0 System State", "Returns values to enter the system into the S0 state"), + AH_PREDEF ("_S1_", "S1 System State", "Returns values to enter the system into the S1 state"), + AH_PREDEF ("_S2_", "S2 System State", "Returns values to enter the system into the S2 state"), + AH_PREDEF ("_S3_", "S3 System State", "Returns values to enter the system into the S3 state"), + AH_PREDEF ("_S4_", "S4 System State", "Returns values to enter the system into the S4 state"), + AH_PREDEF ("_S5_", "S5 System State", "Returns values to enter the system into the S5 state"), + AH_PREDEF ("_S1D", "S1 Device State", "Returns the highest D-state supported by a device when in the S1 state"), + AH_PREDEF ("_S2D", "S2 Device State", "Returns the highest D-state supported by a device when in the S2 state"), + AH_PREDEF ("_S3D", "S3 Device State", "Returns the highest D-state supported by a device when in the S3 state"), + AH_PREDEF ("_S4D", "S4 Device State", "Returns the highest D-state supported by a device when in the S4 state"), + AH_PREDEF ("_S0W", "S0 Device Wake State", "Returns the lowest D-state that the device can wake itself from S0"), + AH_PREDEF ("_S1W", "S1 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S1"), + AH_PREDEF ("_S2W", "S2 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S2"), + AH_PREDEF ("_S3W", "S3 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S3"), + AH_PREDEF ("_S4W", "S4 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S4"), + AH_PREDEF ("_SB_", "System Bus", "Predefined scope for device and bus objects"), + AH_PREDEF ("_SBS", "Smart Battery Subsystem", "Returns the subsystem configuration"), + AH_PREDEF ("_SCP", "Set Cooling Policy", "Sets the cooling policy (active or passive)"), + AH_PREDEF ("_SDD", "Set Device Data", "Sets data for a SATA device"), + AH_PREDEF ("_SEG", "PCI Segment", "Returns a device's PCI Segment Group number"), + AH_PREDEF ("_SHL", "Set Hardware Limit", "Sets the hardware limit enforced by the Power Meter"), + AH_PREDEF ("_SHR", "Sharable", "Interrupt share status, Resource Descriptor field"), + AH_PREDEF ("_SI_", "System Indicators", "Predefined scope"), + AH_PREDEF ("_SIZ", "Size", "DMA transfer size, Resource Descriptor field"), + AH_PREDEF ("_SLI", "System Locality Information", "Returns a list of NUMA system localities"), + AH_PREDEF ("_SLV", "Slave Mode", "Mode setting, Resource Descriptor field"), + AH_PREDEF ("_SPD", "Set Post Device", "Sets which video device will be posted at boot"), + AH_PREDEF ("_SPE", "Speed", "Connection speed, Resource Descriptor field"), + AH_PREDEF ("_SRS", "Set Resource Settings", "Sets a device's resource allocation"), + AH_PREDEF ("_SRT", "Set Real Time", "Sets the current time for a time/alarm device"), + AH_PREDEF ("_SRV", "IPMI Spec Revision", "See the Intelligent Platform Management Interface Specification"), + AH_PREDEF ("_SST", "System Status", "Sets the system status indicator"), + AH_PREDEF ("_STA", "Status", "Returns the current status of a Device or Power Resource"), + AH_PREDEF ("_STB", "Stop Bits", "Serial channel stop bits, Resource Descriptor field"), + AH_PREDEF ("_STM", "Set Timing Mode", "Sets an IDE controller transfer timings"), + AH_PREDEF ("_STP", "Set Expired Timer Wake Policy", "Sets expired timer policies of the wake alarm device"), + AH_PREDEF ("_STR", "Description String", "Returns a device's description string"), + AH_PREDEF ("_STV", "Set Timer Value", "Set timer values of the wake alarm device"), + AH_PREDEF ("_SUB", "Subsystem ID", "Returns the subsystem ID for a device"), + AH_PREDEF ("_SUN", "Slot User Number", "Returns the slot unique ID number"), + AH_PREDEF ("_SWS", "System Wake Source", "Returns the source event that caused the system to wake"), + AH_PREDEF ("_T_x", "Emitted by ASL Compiler", "Reserved for use by ASL compilers"), + AH_PREDEF ("_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"), + AH_PREDEF ("_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"), + AH_PREDEF ("_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"), + AH_PREDEF ("_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"), + AH_PREDEF ("_TIV", "Timer Values", "Returns remaining time of the wake alarm device"), + AH_PREDEF ("_TMP", "Temperature", "Returns a thermal zone's current temperature"), + AH_PREDEF ("_TPC", "Throttling Present Capabilities", "Returns the current number of supported throttling states"), + AH_PREDEF ("_TPT", "Trip Point Temperature", "Inform AML that a device's embedded temperature sensor has crossed a temperature trip point"), + AH_PREDEF ("_TRA", "Translation", "Address translation offset, Resource Descriptor field"), + AH_PREDEF ("_TRS", "Translation Sparse", "Sparse/dense flag, Resource Descriptor field"), + AH_PREDEF ("_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"), + AH_PREDEF ("_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"), + AH_PREDEF ("_TSF", "Type-Specific Flags", "Resource Descriptor field"), + AH_PREDEF ("_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"), + AH_PREDEF ("_TSS", "Throttling Supported States", "Returns supported throttling state information"), + AH_PREDEF ("_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"), + AH_PREDEF ("_TTP", "Translation Type", "Translation/static flag, Resource Descriptor field"), + AH_PREDEF ("_TTS", "Transition To State", "Inform AML of an S-state transition"), + AH_PREDEF ("_TXL", "Transmit Buffer Size", "Serial Channel buffer, Resource Descriptor field"), + AH_PREDEF ("_TYP", "Type", "DMA channel type (speed), Resource Descriptor field"), + AH_PREDEF ("_TZ_", "Thermal Zone", "Predefined scope: ACPI 1.0"), + AH_PREDEF ("_TZD", "Thermal Zone Devices", "Returns a list of device names associated with a Thermal Zone"), + AH_PREDEF ("_TZM", "Thermal Zone Member", "Returns a reference to the thermal zone of which a device is a member"), + AH_PREDEF ("_TZP", "Thermal Zone Polling", "Returns a Thermal zone's polling frequency"), + AH_PREDEF ("_UID", "Unique ID", "Return a device's unique persistent ID"), + AH_PREDEF ("_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"), + AH_PREDEF ("_UPD", "User Presence Detect", "Returns user detection information"), + AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"), + AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"), + AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"), + AH_PREDEF ("_WAK", "Wake", "Inform AML that the system has just awakened"), + AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), + AH_PREDEF (NULL, NULL, NULL) +}; diff --git a/source/common/dmextern.c b/source/common/dmextern.c index d509c8a..1952900 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -221,8 +221,10 @@ AcpiDmNormalizeParentPrefix ( */ ACPI_STRCAT (Fullpath, ParentPath); - /* Add dot separator (don't need dot if parent fullpath is a single "\") */ - + /* + * Add dot separator + * (don't need dot if parent fullpath is a single backslash) + */ if (ParentPath[1]) { ACPI_STRCAT (Fullpath, "."); diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index 13b3bbc..58a43e6 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -73,6 +73,7 @@ AcpiDmGetResourceTag ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *Op, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex); @@ -443,7 +444,6 @@ AcpiDmCheckResourceReference ( ACPI_NAMESPACE_NODE *BufferNode; ACPI_NAMESPACE_NODE *ResourceNode; const ACPI_OPCODE_INFO *OpInfo; - char *Pathname; UINT32 BitIndex; @@ -519,14 +519,7 @@ AcpiDmCheckResourceReference ( /* Translate the Index to a resource tag pathname */ - Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex); - if (Pathname) - { - /* Complete the conversion of the Index to a symbol */ - - IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP; - IndexOp->Common.Value.String = Pathname; - } + AcpiGetTagPathname (IndexOp, BufferNode, ResourceNode, BitIndex); } @@ -597,6 +590,7 @@ AcpiDmGetResourceNode ( static char * AcpiGetTagPathname ( + ACPI_PARSE_OBJECT *IndexOp, ACPI_NAMESPACE_NODE *BufferNode, ACPI_NAMESPACE_NODE *ResourceNode, UINT32 BitIndex) @@ -689,6 +683,15 @@ AcpiGetTagPathname ( AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); + + /* Update the Op with the symbol */ + + AcpiPsInitOp (IndexOp, AML_INT_NAMEPATH_OP); + IndexOp->Common.Value.String = InternalPath; + + /* We will need the tag later. Cheat by putting it in the Node field */ + + IndexOp->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Tag); return (InternalPath); } diff --git a/source/compiler/Makefile b/source/compiler/Makefile index 379f388..9f704d2 100644 --- a/source/compiler/Makefile +++ b/source/compiler/Makefile @@ -77,6 +77,7 @@ OBJECTS = \ adfile.o \ adisasm.o \ adwalk.o \ + ahpredef.o \ aslanalyze.o \ aslbtypes.o \ aslcodegen.o \ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 2a87a01..a6ffe1e 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -67,6 +67,10 @@ FlConsumeNewComment ( FILE *Handle, ASL_FILE_STATUS *Status); +static void +CmDumpAllEvents ( + void); + /******************************************************************************* * @@ -717,45 +721,65 @@ CmDoOutputFiles ( /******************************************************************************* * - * FUNCTION: CmDumpEvent + * FUNCTION: CmDumpAllEvents * - * PARAMETERS: Event - A compiler event struct + * PARAMETERS: None * * RETURN: None. * - * DESCRIPTION: Dump a compiler event struct + * DESCRIPTION: Dump all compiler events * ******************************************************************************/ static void -CmDumpEvent ( - ASL_EVENT_INFO *Event) +CmDumpAllEvents ( + void) { + ASL_EVENT_INFO *Event; UINT32 Delta; UINT32 USec; UINT32 MSec; + UINT32 i; + - if (!Event->Valid) + Event = AslGbl_Events; + + DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); + if (Gbl_CompileTimesFlag) { - return; + printf ("\nElapsed time for major events\n\n"); } - /* Delta will be in 100-nanosecond units */ + for (i = 0; i < AslGbl_NextEvent; i++) + { + if (Event->Valid) + { + /* Delta will be in 100-nanosecond units */ - Delta = (UINT32) (Event->EndTime - Event->StartTime); + Delta = (UINT32) (Event->EndTime - Event->StartTime); - USec = Delta / 10; - MSec = Delta / 10000; + USec = Delta / 10; + MSec = Delta / 10000; - /* Round milliseconds up */ + /* Round milliseconds up */ - if ((USec - (MSec * 1000)) >= 500) - { - MSec++; - } + if ((USec - (MSec * 1000)) >= 500) + { + MSec++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + + if (Gbl_CompileTimesFlag) + { + printf ("%8u usec %8u msec - %s\n", + USec, MSec, Event->EventName); + } + } - DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n", - USec, MSec, Event->EventName); + Event++; + } } @@ -786,20 +810,12 @@ CmCleanupAndExit ( AePrintErrorLog (ASL_FILE_STDOUT); } - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } + /* Emit compile times if enabled */ + + CmDumpAllEvents (); if (Gbl_CompileTimesFlag) { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < AslGbl_NextEvent; i++) - { - CmDumpEvent (&AslGbl_Events[i]); - } - printf ("\nMiscellaneous compile statistics\n\n"); printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index cd0875d..e00f5e4 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -341,7 +341,7 @@ AePrintException ( if (Gbl_VerboseErrors) { - fprintf (OutputFile, "%s %4.4d - ", + fprintf (OutputFile, "%s %4.4d -", AslErrorLevel[Enode->Level], Enode->MessageId + ((Enode->Level+1) * 1000)); } diff --git a/source/compiler/aslfiles.c b/source/compiler/aslfiles.c index 64f391f..bc5b52d 100644 --- a/source/compiler/aslfiles.c +++ b/source/compiler/aslfiles.c @@ -754,7 +754,7 @@ FlOpenInputFile ( /* Open the input ASL file, text mode */ - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); + FlOpenFile (ASL_FILE_INPUT, InputFilename, "rt"); AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; return (AE_OK); @@ -838,7 +838,7 @@ FlOpenMiscOutputFiles ( /* Open the hex file, text mode */ - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_HEX_OUTPUT); AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); @@ -889,7 +889,7 @@ FlOpenMiscOutputFiles ( /* Open the listing file, text mode */ - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); @@ -907,7 +907,7 @@ FlOpenMiscOutputFiles ( return (AE_ERROR); } - FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+b"); + FlOpenFile (ASL_FILE_PREPROCESSOR, Filename, "w+t"); } /* All done for data table compiler */ @@ -952,7 +952,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly code source file, text mode */ - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); @@ -972,7 +972,7 @@ FlOpenMiscOutputFiles ( /* Open the C code source file, text mode */ - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); @@ -993,7 +993,7 @@ FlOpenMiscOutputFiles ( /* Open the assembly include file, text mode */ - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); @@ -1013,7 +1013,7 @@ FlOpenMiscOutputFiles ( /* Open the C include file, text mode */ - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+t"); FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); @@ -1034,7 +1034,7 @@ FlOpenMiscOutputFiles ( /* Open the namespace file, text mode */ - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); + FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+t"); AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); diff --git a/source/compiler/asllookup.c b/source/compiler/asllookup.c index 655f983..6df6436 100644 --- a/source/compiler/asllookup.c +++ b/source/compiler/asllookup.c @@ -1098,7 +1098,7 @@ LkNamespaceLocateBegin ( if (Message) { - sprintf (MsgBuffer, "Tag: %u bit%s, Field: %u bit%s", + sprintf (MsgBuffer, "Size mismatch, Tag: %u bit%s, Field: %u bit%s", TagBitLength, (TagBitLength > 1) ? "s" : "", FieldBitLength, (FieldBitLength > 1) ? "s" : ""); diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index ae288b3..0e3e34d 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -63,7 +63,7 @@ Options ( void); static void -HelpMessage ( +FilenameHelp ( void); static void @@ -170,27 +170,36 @@ Options ( ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); printf ("\nHelp:\n"); - ACPI_OPTION ("-h", "Additional help and compiler debug options"); + ACPI_OPTION ("-h", "This message"); ACPI_OPTION ("-hc", "Display operators allowed in constant expressions"); + ACPI_OPTION ("-hf", "Display help for output filename generation"); ACPI_OPTION ("-hr", "Display ACPI reserved method names"); ACPI_OPTION ("-ht", "Display currently supported ACPI table names"); + + printf ("\nDebug Options:\n"); + ACPI_OPTION ("-bf -bt", "Create debug file (full or parse tree only) (*.txt)"); + ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); + ACPI_OPTION ("-n", "Parse only, no output generation"); + ACPI_OPTION ("-ot", "Display compile times and statistics"); + ACPI_OPTION ("-x ", "Set debug level for trace output"); + ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } /******************************************************************************* * - * FUNCTION: HelpMessage + * FUNCTION: FilenameHelp * * PARAMETERS: None * * RETURN: None * - * DESCRIPTION: Display help message + * DESCRIPTION: Display help message for output filename generation * ******************************************************************************/ static void -HelpMessage ( +FilenameHelp ( void) { @@ -202,17 +211,6 @@ HelpMessage ( printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); printf (" 3) The prefix of the input filename\n"); printf ("\n"); - - Options (); - - printf ("\nCompiler/Disassembler Debug Options:\n"); - ACPI_OPTION ("-bb -bp -bt", "Create compiler debug/trace file (*.txt)"); - ACPI_OPTION ("", "Types: Parse/Tree/Both"); - ACPI_OPTION ("-f", "Ignore errors, force creation of AML output file(s)"); - ACPI_OPTION ("-n", "Parse only, no output generation"); - ACPI_OPTION ("-ot", "Display compile times"); - ACPI_OPTION ("-x ", "Set debug level for trace output"); - ACPI_OPTION ("-z", "Do not insert new compiler ID for DataTables"); } @@ -430,13 +428,7 @@ AslDoOptions ( case 'b': /* Debug output options */ switch (AcpiGbl_Optarg[0]) { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - DtParserdebug = 1; - PrParserdebug = 1; - break; - - case 'p': + case 'f': AslCompilerdebug = 1; /* same as yydebug */ DtParserdebug = 1; PrParserdebug = 1; @@ -530,13 +522,17 @@ AslDoOptions ( switch (AcpiGbl_Optarg[0]) { case '^': - HelpMessage (); + Usage (); exit (0); case 'c': UtDisplayConstantOpcodes (); exit (0); + case 'f': + FilenameHelp (); + exit (0); + case 'r': /* reserved names */ diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 65dd19b..2f73900 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -92,19 +92,23 @@ static void AslDoLineDirective ( void) { - char c; + UINT8 c; char *Token; UINT32 LineNumber; char *Filename; + UINT32 i; /* Eat the entire line that contains the #line directive */ - while ((c = (char) input()) != '\n' && c != EOF) + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + + while ((c = (UINT8) input()) != '\n' && c != EOF) { - AslInsertLineBuffer (c); + *Gbl_LineBufPtr = c; + Gbl_LineBufPtr++; } - AslInsertLineBuffer (0); + *Gbl_LineBufPtr = 0; /* First argument is the actual line number */ @@ -114,10 +118,23 @@ AslDoLineDirective ( goto ResetAndExit; } - /* Convert line number. Subtract one to handle _this_ line */ + /* First argument is the line number */ LineNumber = (UINT32) UtDoConstant (Token); - FlSetLineNumber (LineNumber - 1); + + /* Emit the appropriate number of newlines */ + + Gbl_CurrentColumn = 0; + if (LineNumber > Gbl_CurrentLineNumber) + { + for (i = 0; i < (LineNumber - Gbl_CurrentLineNumber); i++) + { + FlWriteFile (ASL_FILE_SOURCE_OUTPUT, "\n", 1); + Gbl_CurrentColumn++; + } + } + + FlSetLineNumber (LineNumber); /* Second argument is the optional filename (in double quotes) */ @@ -132,7 +149,12 @@ AslDoLineDirective ( /* Third argument is not supported at this time */ ResetAndExit: - AslResetCurrentLineBuffer (); + + /* Reset globals for a new line */ + + Gbl_CurrentLineOffset += Gbl_CurrentColumn; + Gbl_CurrentColumn = 0; + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; } diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index de8ad24..9cc109b 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -139,7 +139,7 @@ UtDisplaySupportedTables ( /******************************************************************************* * - * FUNCTION: AcpiPsDisplayConstantOpcodes + * FUNCTION: UtDisplayConstantOpcodes * * PARAMETERS: None * @@ -172,11 +172,11 @@ UtDisplayConstantOpcodes ( * * FUNCTION: UtLocalCalloc * - * PARAMETERS: Size - Bytes to be allocated + * PARAMETERS: Size - Bytes to be allocated * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. + * RETURN: Pointer to the allocated memory. Guaranteed to be valid. * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an + * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an * allocation failure, on the assumption that nothing more can be * accomplished. * @@ -211,9 +211,9 @@ UtLocalCalloc ( * * FUNCTION: UtBeginEvent * - * PARAMETERS: Name - Ascii name of this event + * PARAMETERS: Name - Ascii name of this event * - * RETURN: Event - Event number (integer index) + * RETURN: Event number (integer index) * * DESCRIPTION: Saves the current time with this event * @@ -244,7 +244,7 @@ UtBeginEvent ( * * FUNCTION: UtEndEvent * - * PARAMETERS: Event - Event number (integer index) + * PARAMETERS: Event - Event number (integer index) * * RETURN: None * @@ -254,7 +254,7 @@ UtBeginEvent ( void UtEndEvent ( - UINT8 Event) + UINT8 Event) { if (Event >= ASL_NUM_EVENTS) @@ -272,7 +272,7 @@ UtEndEvent ( * * FUNCTION: UtHexCharToValue * - * PARAMETERS: HexChar - Hex character in Ascii + * PARAMETERS: HexChar - Hex character in Ascii * * RETURN: The binary value of the hex character * @@ -303,12 +303,13 @@ UtHexCharToValue ( * * FUNCTION: UtConvertByteToHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -331,12 +332,13 @@ UtConvertByteToHex ( * * FUNCTION: UtConvertByteToAsmHex * - * PARAMETERS: RawByte - Binary data - * Buffer - Pointer to where the hex bytes will be stored + * PARAMETERS: RawByte - Binary data + * Buffer - Pointer to where the hex bytes will be + * stored * * RETURN: Ascii hex byte is stored in Buffer. * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed + * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed * with "0x" * ******************************************************************************/ @@ -358,13 +360,13 @@ UtConvertByteToAsmHex ( * * FUNCTION: DbgPrint * - * PARAMETERS: Type - Type of output - * Fmt - Printf format string - * ... - variable printf list + * PARAMETERS: Type - Type of output + * Fmt - Printf format string + * ... - variable printf list * * RETURN: None * - * DESCRIPTION: Conditional print statement. Prints to stderr only if the + * DESCRIPTION: Conditional print statement. Prints to stderr only if the * debug flag is set. * ******************************************************************************/ @@ -438,7 +440,7 @@ UtPrintFormattedName ( * * FUNCTION: UtSetParseOpName * - * PARAMETERS: Op + * PARAMETERS: Op - Parse op to be named. * * RETURN: None * @@ -460,7 +462,7 @@ UtSetParseOpName ( * * FUNCTION: UtDisplaySummary * - * PARAMETERS: FileID - ID of outpout file + * PARAMETERS: FileID - ID of outpout file * * RETURN: None * @@ -571,11 +573,11 @@ UtDisplaySummary ( /******************************************************************************* * - * FUNCTION: UtDisplaySummary + * FUNCTION: UtCheckIntegerRange * - * PARAMETERS: Op - Integer parse node - * LowValue - Smallest allowed value - * HighValue - Largest allowed value + * PARAMETERS: Op - Integer parse node + * LowValue - Smallest allowed value + * HighValue - Largest allowed value * * RETURN: Op if OK, otherwise NULL * @@ -626,11 +628,11 @@ UtCheckIntegerRange ( * * FUNCTION: UtGetStringBuffer * - * PARAMETERS: Length - Size of buffer requested + * PARAMETERS: Length - Size of buffer requested * - * RETURN: Pointer to the buffer. Aborts on allocation failure + * RETURN: Pointer to the buffer. Aborts on allocation failure * - * DESCRIPTION: Allocate a string buffer. Bypass the local + * DESCRIPTION: Allocate a string buffer. Bypass the local * dynamic memory manager for performance reasons (This has a * major impact on the speed of the compiler.) * @@ -661,8 +663,8 @@ UtGetStringBuffer ( * * FUNCTION: UtInternalizeName * - * PARAMETERS: ExternalName - Name to convert - * ConvertedName - Where the converted name is returned + * PARAMETERS: ExternalName - Name to convert + * ConvertedName - Where the converted name is returned * * RETURN: Status * @@ -714,8 +716,8 @@ UtInternalizeName ( * * FUNCTION: UtPadNameWithUnderscores * - * PARAMETERS: NameSeg - Input nameseg - * PaddedNameSeg - Output padded nameseg + * PARAMETERS: NameSeg - Input nameseg + * PaddedNameSeg - Output padded nameseg * * RETURN: Padded nameseg. * @@ -752,8 +754,8 @@ UtPadNameWithUnderscores ( * * FUNCTION: UtAttachNameseg * - * PARAMETERS: Op - Parent parse node - * Name - Full ExternalName + * PARAMETERS: Op - Parent parse node + * Name - Full ExternalName * * RETURN: None; Sets the NameSeg field in parent node * @@ -809,12 +811,12 @@ UtAttachNameseg ( * * FUNCTION: UtAttachNamepathToOwner * - * PARAMETERS: Op - Parent parse node - * NameOp - Node that contains the name + * PARAMETERS: Op - Parent parse node + * NameOp - Node that contains the name * * RETURN: Sets the ExternalName and Namepath in the parent node * - * DESCRIPTION: Store the name in two forms in the parent node: The original + * DESCRIPTION: Store the name in two forms in the parent node: The original * (external) name, and the internalized name that is used within * the ACPI namespace manager. * @@ -854,11 +856,11 @@ UtAttachNamepathToOwner ( * * FUNCTION: UtDoConstant * - * PARAMETERS: String - Hex, Octal, or Decimal string + * PARAMETERS: String - Hex, Octal, or Decimal string * * RETURN: Converted Integer * - * DESCRIPTION: Convert a string to an integer. With error checking. + * DESCRIPTION: Convert a string to an integer, with error checking. * ******************************************************************************/ @@ -889,10 +891,10 @@ UtDoConstant ( * * FUNCTION: UtStrtoul64 * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is - * returned - * Base - Radix of the string + * PARAMETERS: String - Null terminated string + * Terminater - Where a pointer to the terminating byte + * is returned + * Base - Radix of the string * * RETURN: Converted value * @@ -1072,5 +1074,3 @@ ErrorExit: return (Status); } - - diff --git a/source/compiler/dttemplate.c b/source/compiler/dttemplate.c index 27b032f..60844f0 100644 --- a/source/compiler/dttemplate.c +++ b/source/compiler/dttemplate.c @@ -226,7 +226,7 @@ DtCreateAllTemplates ( } /* - * Create the "special ACPI tables: + * Create the special ACPI tables: * 1) DSDT/SSDT are AML tables, not data tables * 2) FACS and RSDP have non-standard headers */ diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c index 7facc8d..b58cb1c 100644 --- a/source/components/debugger/dbdisply.c +++ b/source/components/debugger/dbdisply.c @@ -792,10 +792,12 @@ AcpiDbDisplayGpes ( ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; char *GpeType; + ACPI_GPE_NOTIFY_INFO *Notify; UINT32 GpeIndex; UINT32 Block = 0; UINT32 i; UINT32 j; + UINT32 Count; char Buffer[80]; ACPI_BUFFER RetBuf; ACPI_STATUS Status; @@ -916,7 +918,14 @@ AcpiDbDisplayGpes ( AcpiOsPrintf ("Handler"); break; case ACPI_GPE_DISPATCH_NOTIFY: - AcpiOsPrintf ("Notify"); + Count = 0; + Notify = GpeEventInfo->Dispatch.NotifyList; + while (Notify) + { + Count++; + Notify = Notify->Next; + } + AcpiOsPrintf ("Implicit Notify on %u devices", Count); break; default: AcpiOsPrintf ("UNKNOWN: %X", diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 7818c9d..4b59f22 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -872,8 +872,8 @@ AcpiDbMethodThread ( if (Info->InitArgs) { - AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); - AcpiDbUInt32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr); + AcpiDbUint32ToHexString (Info->NumCreated, Info->IndexOfThreadStr); + AcpiDbUint32ToHexString ((UINT32) AcpiOsGetThreadId (), Info->IdOfThreadStr); } if (Info->Threads && (Info->NumCreated < Info->NumThreads)) @@ -1063,7 +1063,7 @@ AcpiDbCreateExecutionThreads ( AcpiGbl_DbMethodInfo.ArgTypes[1] = ACPI_TYPE_INTEGER; AcpiGbl_DbMethodInfo.ArgTypes[2] = ACPI_TYPE_INTEGER; - AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); + AcpiDbUint32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr); AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); diff --git a/source/components/debugger/dbutils.c b/source/components/debugger/dbutils.c index cf29b22..7ce9090 100644 --- a/source/components/debugger/dbutils.c +++ b/source/components/debugger/dbutils.c @@ -360,7 +360,7 @@ AcpiDbLocalNsLookup ( /******************************************************************************* * - * FUNCTION: AcpiDbUInt32ToHexString + * FUNCTION: AcpiDbUint32ToHexString * * PARAMETERS: Value - The value to be converted to string * Buffer - Buffer for result (not less than 11 bytes) @@ -375,7 +375,7 @@ AcpiDbLocalNsLookup ( ******************************************************************************/ void -AcpiDbUInt32ToHexString ( +AcpiDbUint32ToHexString ( UINT32 Value, char *Buffer) { diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index 6d2c3e1..b52bdb2 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -46,6 +46,7 @@ #include "acparser.h" #include "amlcode.h" #include "acdisasm.h" +#include "acnamesp.h" #ifdef ACPI_DISASSEMBLER @@ -61,6 +62,218 @@ AcpiDmMatchKeyword ( /******************************************************************************* * + * FUNCTION: AcpiDmPredefinedDescription + * + * PARAMETERS: Op - Name() parse object + * + * RETURN: None + * + * DESCRIPTION: Emit a description comment for a predefined ACPI name. + * Used for iASL compiler only. + * + ******************************************************************************/ + +void +AcpiDmPredefinedDescription ( + ACPI_PARSE_OBJECT *Op) +{ +#ifdef ACPI_ASL_COMPILER + const AH_PREDEFINED_NAME *Info; + char *NameString; + int LastCharIsDigit; + int LastCharsAreHex; + + + if (!Op) + { + return; + } + + /* Ensure that the comment field is emitted only once */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) + { + return; + } + Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; + + /* Predefined name must start with an underscore */ + + NameString = ACPI_CAST_PTR (char, &Op->Named.Name); + if (NameString[0] != '_') + { + return; + } + + /* + * Check for the special ACPI names: + * _ACd, _ALd, _EJd, _Exx, _Lxx, _Qxx, _Wxx, _T_a + * (where d=decimal_digit, x=hex_digit, a=anything) + * + * Convert these to the generic name for table lookup. + * Note: NameString is guaranteed to be upper case here. + */ + LastCharIsDigit = + (ACPI_IS_DIGIT (NameString[3])); /* d */ + LastCharsAreHex = + (ACPI_IS_XDIGIT (NameString[2]) && /* xx */ + ACPI_IS_XDIGIT (NameString[3])); + + switch (NameString[1]) + { + case 'A': + if ((NameString[2] == 'C') && (LastCharIsDigit)) + { + NameString = "_ACx"; + } + else if ((NameString[2] == 'L') && (LastCharIsDigit)) + { + NameString = "_ALx"; + } + break; + + case 'E': + if ((NameString[2] == 'J') && (LastCharIsDigit)) + { + NameString = "_EJx"; + } + else if (LastCharsAreHex) + { + NameString = "_Exx"; + } + break; + + case 'L': + if (LastCharsAreHex) + { + NameString = "_Lxx"; + } + break; + + case 'Q': + if (LastCharsAreHex) + { + NameString = "_Qxx"; + } + break; + + case 'T': + if (NameString[2] == '_') + { + NameString = "_T_x"; + } + break; + + case 'W': + if (LastCharsAreHex) + { + NameString = "_Wxx"; + } + break; + + default: + break; + } + + /* Match the name in the info table */ + + for (Info = AslPredefinedInfo; Info->Name; Info++) + { + if (ACPI_COMPARE_NAME (NameString, Info->Name)) + { + AcpiOsPrintf (" // %4.4s: %s", + NameString, ACPI_CAST_PTR (char, Info->Description)); + return; + } + } + +#endif + return; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmFieldPredefinedDescription + * + * PARAMETERS: Op - Parse object + * + * RETURN: None + * + * DESCRIPTION: Emit a description comment for a resource descriptor tag + * (which is a predefined ACPI name.) Used for iASL compiler only. + * + ******************************************************************************/ + +void +AcpiDmFieldPredefinedDescription ( + ACPI_PARSE_OBJECT *Op) +{ +#ifdef ACPI_ASL_COMPILER + ACPI_PARSE_OBJECT *IndexOp; + char *Tag; + const ACPI_OPCODE_INFO *OpInfo; + const AH_PREDEFINED_NAME *Info; + + + if (!Op) + { + return; + } + + /* Ensure that the comment field is emitted only once */ + + if (Op->Common.DisasmFlags & ACPI_PARSEOP_PREDEF_CHECKED) + { + return; + } + Op->Common.DisasmFlags |= ACPI_PARSEOP_PREDEF_CHECKED; + + /* + * Op must be one of the Create* operators: CreateField, CreateBitField, + * CreateByteField, CreateWordField, CreateDwordField, CreateQwordField + */ + OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); + if (!(OpInfo->Flags & AML_CREATE)) + { + return; + } + + /* Second argument is the Index argument */ + + IndexOp = Op->Common.Value.Arg; + IndexOp = IndexOp->Common.Next; + + /* Index argument must be a namepath */ + + if (IndexOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP) + { + return; + } + + /* Major cheat: We previously put the Tag ptr in the Node field */ + + Tag = ACPI_CAST_PTR (char, IndexOp->Common.Node); + + /* Match the name in the info table */ + + for (Info = AslPredefinedInfo; Info->Name; Info++) + { + if (ACPI_COMPARE_NAME (Tag, Info->Name)) + { + AcpiOsPrintf (" // %4.4s: %s", Tag, + ACPI_CAST_PTR (char, Info->Description)); + return; + } + } + +#endif + return; +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmMethodFlags * * PARAMETERS: Op - Method Object to be examined diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index dd3ee00..6a6b95e 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -453,7 +453,7 @@ AcpiDmDescendingOp ( * keep track of the current column. */ Info->Count++; - if (Info->Count /*+Info->LastLevel*/ > 10) + if (Info->Count /* +Info->LastLevel */ > 10) { Info->Count = 0; AcpiOsPrintf ("\n"); @@ -533,6 +533,10 @@ AcpiDmDescendingOp ( AcpiDmMethodFlags (Op); AcpiOsPrintf (")"); + + /* Emit description comment for Method() with a predefined ACPI name */ + + AcpiDmPredefinedDescription (Op); break; @@ -603,7 +607,8 @@ AcpiDmDescendingOp ( default: - AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode); + AcpiOsPrintf ("*** Unhandled named opcode %X\n", + Op->Common.AmlOpcode); break; } } @@ -644,7 +649,8 @@ AcpiDmDescendingOp ( NextOp = NextOp->Common.Next; Info->Flags = ACPI_PARSEOP_PARAMLIST; - AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info); + AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, + AcpiDmAscendingOp, Info); Info->Flags = 0; Info->Level = Level; @@ -686,12 +692,18 @@ AcpiDmDescendingOp ( if (Op->Common.DisasmOpcode == ACPI_DASM_RESOURCE) { /* - * We have a resource list. Don't need to output - * the buffer size Op. Open up a new block + * We have a resource list. Don't need to output + * the buffer size Op. Open up a new block */ NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; NextOp = NextOp->Common.Next; - AcpiOsPrintf (")\n"); + AcpiOsPrintf (")"); + + /* Emit description comment for Name() with a predefined ACPI name */ + + AcpiDmPredefinedDescription (Op->Asl.Parent); + + AcpiOsPrintf ("\n"); AcpiDmIndent (Info->Level); AcpiOsPrintf ("{\n"); return (AE_OK); @@ -719,7 +731,7 @@ AcpiDmDescendingOp ( case AML_PACKAGE_OP: - /* The next op is the size or predicate parameter */ + /* The next op is the size parameter */ NextOp = AcpiPsGetDepthNext (NULL, Op); if (NextOp) @@ -772,6 +784,7 @@ AcpiDmAscendingOp ( void *Context) { ACPI_OP_WALK_INFO *Info = Context; + ACPI_PARSE_OBJECT *ParentOp; if (Op->Common.DisasmFlags & ACPI_PARSEOP_IGNORE) @@ -797,6 +810,19 @@ AcpiDmAscendingOp ( AcpiOsPrintf (")"); + if (Op->Common.AmlOpcode == AML_NAME_OP) + { + /* Emit description comment for Name() with a predefined ACPI name */ + + AcpiDmPredefinedDescription (Op); + } + else + { + /* For Create* operators, attempt to emit resource tag description */ + + AcpiDmFieldPredefinedDescription (Op); + } + /* Could be a nested operator, check if comma required */ if (!AcpiDmCommaIfListMember (Op)) @@ -911,7 +937,20 @@ AcpiDmAscendingOp ( */ if (Op->Common.Next) { - AcpiOsPrintf (")\n"); + AcpiOsPrintf (")"); + + /* Emit description comment for Name() with a predefined ACPI name */ + + ParentOp = Op->Common.Parent; + if (ParentOp) + { + ParentOp = ParentOp->Common.Parent; + if (ParentOp && ParentOp->Asl.AmlOpcode == AML_NAME_OP) + { + AcpiDmPredefinedDescription (ParentOp); + } + } + AcpiOsPrintf ("\n"); AcpiDmIndent (Level - 1); AcpiOsPrintf ("{\n"); } diff --git a/source/components/dispatcher/dsfield.c b/source/components/dispatcher/dsfield.c index 8a364c8..e3e05b9 100644 --- a/source/components/dispatcher/dsfield.c +++ b/source/components/dispatcher/dsfield.c @@ -152,8 +152,8 @@ AcpiDsCreateExternalRegion ( * CreateBitFieldOp, * CreateByteFieldOp, * CreateWordFieldOp, - * CreateDWordFieldOp, - * CreateQWordFieldOp, + * CreateDwordFieldOp, + * CreateQwordFieldOp, * CreateFieldOp (all of which define a field in a buffer) * ******************************************************************************/ diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index 7569236..6fd58d8 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -523,18 +523,18 @@ AcpiDsEvalTableRegionOperands ( /* - * This is where we evaluate the SignatureString and OemIDString - * and OemTableIDString of the DataTableRegion declaration + * This is where we evaluate the Signature string, OemId string, + * and OemTableId string of the Data Table Region declaration */ Node = Op->Common.Node; - /* NextOp points to SignatureString op */ + /* NextOp points to Signature string op */ NextOp = Op->Common.Value.Arg; /* - * Evaluate/create the SignatureString and OemIDString - * and OemTableIDString operands + * Evaluate/create the Signature string, OemId string, + * and OemTableId string operands */ Status = AcpiDsCreateOperands (WalkState, NextOp); if (ACPI_FAILURE (Status)) @@ -543,8 +543,8 @@ AcpiDsEvalTableRegionOperands ( } /* - * Resolve the SignatureString and OemIDString - * and OemTableIDString operands + * Resolve the Signature string, OemId string, + * and OemTableId string operands */ Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState); diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c index a3781a5..623795a 100644 --- a/source/components/events/evgpe.c +++ b/source/components/events/evgpe.c @@ -518,6 +518,7 @@ AcpiEvAsynchExecuteGpeMethod ( ACPI_STATUS Status; ACPI_GPE_EVENT_INFO *LocalGpeEventInfo; ACPI_EVALUATE_INFO *Info; + ACPI_GPE_NOTIFY_INFO *Notify; ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod); @@ -573,10 +574,18 @@ AcpiEvAsynchExecuteGpeMethod ( * completes. The notify handlers are NOT invoked synchronously * from this thread -- because handlers may in turn run other * control methods. + * + * June 2012: Expand implicit notify mechanism to support + * notifies on multiple device objects. */ - Status = AcpiEvQueueNotifyRequest ( - LocalGpeEventInfo->Dispatch.DeviceNode, - ACPI_NOTIFY_DEVICE_WAKE); + Notify = LocalGpeEventInfo->Dispatch.NotifyList; + while (ACPI_SUCCESS (Status) && Notify) + { + Status = AcpiEvQueueNotifyRequest (Notify->DeviceNode, + ACPI_NOTIFY_DEVICE_WAKE); + + Notify = Notify->Next; + } break; case ACPI_GPE_DISPATCH_METHOD: diff --git a/source/components/events/evgpeutil.c b/source/components/events/evgpeutil.c index 70580cd..0005735 100644 --- a/source/components/events/evgpeutil.c +++ b/source/components/events/evgpeutil.c @@ -391,6 +391,8 @@ AcpiEvDeleteGpeHandlers ( void *Context) { ACPI_GPE_EVENT_INFO *GpeEventInfo; + ACPI_GPE_NOTIFY_INFO *Notify; + ACPI_GPE_NOTIFY_INFO *Next; UINT32 i; UINT32 j; @@ -412,10 +414,27 @@ AcpiEvDeleteGpeHandlers ( if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER) { + /* Delete an installed handler block */ + ACPI_FREE (GpeEventInfo->Dispatch.Handler); GpeEventInfo->Dispatch.Handler = NULL; GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; } + else if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NOTIFY) + { + /* Delete the implicit notification device list */ + + Notify = GpeEventInfo->Dispatch.NotifyList; + while (Notify) + { + Next = Notify->Next; + ACPI_FREE (Notify); + Notify = Next; + } + GpeEventInfo->Dispatch.NotifyList = NULL; + GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK; + } } } diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c index c0dd88c..daea888 100644 --- a/source/components/events/evxfgpe.c +++ b/source/components/events/evxfgpe.c @@ -295,9 +295,10 @@ AcpiSetupGpeForWake ( ACPI_HANDLE GpeDevice, UINT32 GpeNumber) { - ACPI_STATUS Status = AE_BAD_PARAMETER; + ACPI_STATUS Status; ACPI_GPE_EVENT_INFO *GpeEventInfo; ACPI_NAMESPACE_NODE *DeviceNode; + ACPI_GPE_NOTIFY_INFO *Notify; ACPI_CPU_FLAGS Flags; @@ -338,26 +339,69 @@ AcpiSetupGpeForWake ( /* Ensure that we have a valid GPE number */ GpeEventInfo = AcpiEvGetGpeEventInfo (GpeDevice, GpeNumber); - if (GpeEventInfo) + if (!GpeEventInfo) + { + Status = AE_BAD_PARAMETER; + goto UnlockAndExit; + } + + /* + * If there is no method or handler for this GPE, then the + * WakeDevice will be notified whenever this GPE fires. This is + * known as an "implicit notify". Note: The GPE is assumed to be + * level-triggered (for windows compatibility). + */ + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NONE) { /* - * If there is no method or handler for this GPE, then the - * WakeDevice will be notified whenever this GPE fires (aka - * "implicit notify") Note: The GPE is assumed to be - * level-triggered (for windows compatibility). + * This is the first device for implicit notify on this GPE. + * Just set the flags here, and enter the NOTIFY block below. */ - if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == - ACPI_GPE_DISPATCH_NONE) + GpeEventInfo->Flags = + (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED); + } + + /* + * If we already have an implicit notify on this GPE, add + * this device to the notify list. + */ + if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == + ACPI_GPE_DISPATCH_NOTIFY) + { + /* Ensure that the device is not already in the list */ + + Notify = GpeEventInfo->Dispatch.NotifyList; + while (Notify) { - GpeEventInfo->Flags = - (ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED); - GpeEventInfo->Dispatch.DeviceNode = DeviceNode; + if (Notify->DeviceNode == DeviceNode) + { + Status = AE_ALREADY_EXISTS; + goto UnlockAndExit; + } + Notify = Notify->Next; } - GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; - Status = AE_OK; + /* Add this device to the notify list for this GPE */ + + Notify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO)); + if (!Notify) + { + Status = AE_NO_MEMORY; + goto UnlockAndExit; + } + + Notify->DeviceNode = DeviceNode; + Notify->Next = GpeEventInfo->Dispatch.NotifyList; + GpeEventInfo->Dispatch.NotifyList = Notify; } + /* Mark the GPE as a possible wake event */ + + GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE; + Status = AE_OK; + +UnlockAndExit: AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return_ACPI_STATUS (Status); } diff --git a/source/components/executer/exconfig.c b/source/components/executer/exconfig.c index 9e05497..581bc57 100644 --- a/source/components/executer/exconfig.c +++ b/source/components/executer/exconfig.c @@ -179,7 +179,7 @@ AcpiExLoadTableOp ( ACPI_FUNCTION_TRACE (ExLoadTableOp); - /* Validate lengths for the SignatureString, OEMIDString, OEMTableID */ + /* Validate lengths for the Signature, OemId, and OemTableId strings */ if ((Operand[0]->String.Length > ACPI_NAME_SIZE) || (Operand[1]->String.Length > ACPI_OEM_ID_SIZE) || diff --git a/source/components/utilities/utmisc.c b/source/components/utilities/utmisc.c index 7ce00df..72662b9 100644 --- a/source/components/utilities/utmisc.c +++ b/source/components/utilities/utmisc.c @@ -53,6 +53,7 @@ ACPI_MODULE_NAME ("utmisc") +#if defined ACPI_ASL_COMPILER || defined ACPI_EXEC_APP /******************************************************************************* * * FUNCTION: UtConvertBackslashes @@ -86,6 +87,7 @@ UtConvertBackslashes ( Pathname++; } } +#endif /******************************************************************************* @@ -1330,5 +1332,3 @@ AcpiUtWalkPackageTree ( return_ACPI_STATUS (AE_AML_INTERNAL); } - - diff --git a/source/include/acdebug.h b/source/include/acdebug.h index bcc505c..f89cf37 100644 --- a/source/include/acdebug.h +++ b/source/include/acdebug.h @@ -405,7 +405,7 @@ AcpiDbLocalNsLookup ( char *Name); void -AcpiDbUInt32ToHexString ( +AcpiDbUint32ToHexString ( UINT32 Value, char *Buffer); diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 9ec1271..e5c5c11 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -519,6 +519,14 @@ AcpiDmMethodFlags ( ACPI_PARSE_OBJECT *Op); void +AcpiDmPredefinedDescription ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmFieldPredefinedDescription ( + ACPI_PARSE_OBJECT *Op); + +void AcpiDmFieldFlags ( ACPI_PARSE_OBJECT *Op); diff --git a/source/include/acglobal.h b/source/include/acglobal.h index 79e53d0..5535c1d 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -479,4 +479,14 @@ ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; #endif /* ACPI_DEBUGGER */ + +/***************************************************************************** + * + * Info/help support + * + ****************************************************************************/ + +extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; + + #endif /* __ACGLOBAL_H__ */ diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 68ea95b..0f79fa2 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -462,6 +462,15 @@ typedef struct acpi_gpe_handler_info } ACPI_GPE_HANDLER_INFO; +/* Notify info for implicit notify, multiple device objects */ + +typedef struct acpi_gpe_notify_info +{ + ACPI_NAMESPACE_NODE *DeviceNode; /* Device to be notified */ + struct acpi_gpe_notify_info *Next; + +} ACPI_GPE_NOTIFY_INFO; + /* * GPE dispatch info. At any time, the GPE can have at most one type * of dispatch - Method, Handler, or Implicit Notify. @@ -469,8 +478,8 @@ typedef struct acpi_gpe_handler_info typedef union acpi_gpe_dispatch_info { ACPI_NAMESPACE_NODE *MethodNode; /* Method node for this GPE level */ - struct acpi_gpe_handler_info *Handler; /* Installed GPE handler */ - ACPI_NAMESPACE_NODE *DeviceNode; /* Parent _PRW device for implicit notify */ + ACPI_GPE_HANDLER_INFO *Handler; /* Installed GPE handler */ + ACPI_GPE_NOTIFY_INFO *NotifyList; /* List of _PRW devices for implicit notifies */ } ACPI_GPE_DISPATCH_INFO; @@ -480,7 +489,7 @@ typedef union acpi_gpe_dispatch_info */ typedef struct acpi_gpe_event_info { - union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */ + union acpi_gpe_dispatch_info Dispatch; /* Either Method, Handler, or NotifyList */ struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */ UINT8 Flags; /* Misc info about this GPE */ UINT8 GpeNumber; /* This GPE */ @@ -960,6 +969,7 @@ typedef struct acpi_parse_state #define ACPI_PARSEOP_IGNORE 0x01 #define ACPI_PARSEOP_PARAMLIST 0x02 #define ACPI_PARSEOP_EMPTY_TERMLIST 0x04 +#define ACPI_PARSEOP_PREDEF_CHECKED 0x08 #define ACPI_PARSEOP_SPECIAL 0x10 @@ -1311,4 +1321,20 @@ typedef struct acpi_debug_mem_block #define ACPI_NUM_MEM_LISTS 2 +/***************************************************************************** + * + * Info/help support + * + ****************************************************************************/ + +typedef struct ah_predefined_name +{ + char *Name; + char *Description; +#ifndef ACPI_ASL_COMPILER + char *Action; +#endif + +} AH_PREDEFINED_NAME; + #endif /* __ACLOCAL_H__ */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 70a00d7..9ec5f97 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 0x20120518 +#define ACPI_CA_VERSION 0x20120620 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acpredef.h b/source/include/acpredef.h index c17a6d9..c5b115e 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -512,14 +512,14 @@ static const ACPI_PREDEFINED_INFO PredefinedNames[] = {{"_TMP", 0, ACPI_RTYPE_INTEGER}}, {{"_TPC", 0, ACPI_RTYPE_INTEGER}}, {{"_TPT", 1, 0}}, - {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2Ref/6Int */ + {{"_TRT", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 2 Ref/6 Int */ {{{ACPI_PTYPE2, ACPI_RTYPE_REFERENCE, 2, ACPI_RTYPE_INTEGER}, 6, 0}}, - {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int with count */ + {{"_TSD", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int with count */ {{{ACPI_PTYPE2_COUNT,ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, {{"_TSP", 0, ACPI_RTYPE_INTEGER}}, - {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5Int */ + {{"_TSS", 0, ACPI_RTYPE_PACKAGE}}, /* Variable-length (Pkgs) each 5 Int */ {{{ACPI_PTYPE2, ACPI_RTYPE_INTEGER, 5,0}, 0,0}}, {{"_TST", 0, ACPI_RTYPE_INTEGER}}, diff --git a/source/include/acutils.h b/source/include/acutils.h index be56876..d720fcc 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -429,7 +429,7 @@ AcpiUtDumpBuffer ( UINT8 *Buffer, UINT32 Count, UINT32 Display, - UINT32 componentId); + UINT32 ComponentId); void AcpiUtDumpBuffer2 ( diff --git a/source/include/platform/acwin64.h b/source/include/platform/acwin64.h index 022baf0..94966c3 100644 --- a/source/include/platform/acwin64.h +++ b/source/include/platform/acwin64.h @@ -79,5 +79,6 @@ #endif +/*! [End] no source code translation !*/ #endif /* __ACWIN_H__ */ diff --git a/source/tools/acpiexec/aeexec.c b/source/tools/acpiexec/aeexec.c index 407519f..d991b9c 100644 --- a/source/tools/acpiexec/aeexec.c +++ b/source/tools/acpiexec/aeexec.c @@ -658,11 +658,14 @@ AeMiscellaneousTests ( AE_CHECK_OK (AcpiSetupGpeForWake, Status); Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE); - AE_CHECK_OK (AcpiGpeWakeup, Status); + AE_CHECK_OK (AcpiSetGpeWakeMask, Status); Status = AcpiSetupGpeForWake (Handle, NULL, 6); AE_CHECK_OK (AcpiSetupGpeForWake, Status); + Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6); + AE_CHECK_OK (AcpiSetupGpeForWake, Status); + Status = AcpiSetupGpeForWake (Handle, NULL, 9); AE_CHECK_OK (AcpiSetupGpeForWake, Status); diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 427353a..d1ac41d 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -103,14 +103,6 @@ typedef struct ah_asl_keyword } AH_ASL_KEYWORD; -typedef struct ah_predefined_name -{ - char *Name; - char *Description; - char *Action; - -} AH_PREDEFINED_NAME; - typedef struct ah_device_id { char *Name; @@ -122,7 +114,6 @@ typedef struct ah_device_id extern const AH_AML_OPCODE AmlOpcodeInfo[]; extern const AH_ASL_OPERATOR AslOperatorInfo[]; extern const AH_ASL_KEYWORD AslKeywordInfo[]; -extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; extern BOOLEAN AhDisplayAll; void diff --git a/source/tools/acpihelp/ahpredef.c b/source/tools/acpihelp/ahpredef.c deleted file mode 100644 index 2baf711..0000000 --- a/source/tools/acpihelp/ahpredef.c +++ /dev/null @@ -1,312 +0,0 @@ -/****************************************************************************** - * - * Module Name: ahpredef - Table of all known ACPI predefined names - * - *****************************************************************************/ - -/* - * Copyright (C) 2000 - 2012, Intel Corp. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification. - * 2. Redistributions in binary form must reproduce at minimum a disclaimer - * substantially similar to the "NO WARRANTY" disclaimer below - * ("Disclaimer") and any redistribution must be conditioned upon - * including a substantially similar Disclaimer requirement for further - * binary redistribution. - * 3. Neither the names of the above-listed copyright holders nor the names - * of any contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * Alternatively, this software may be distributed under the terms of the - * GNU General Public License ("GPL") version 2 as published by the Free - * Software Foundation. - * - * NO WARRANTY - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGES. - */ - -#include "acpihelp.h" - -/* - * Predefined ACPI names, with short description and return value. - * This table was extracted directly from the ACPI specification. - */ -const AH_PREDEFINED_NAME AslPredefinedInfo[] = -{ - {"_ACx", "Active Cooling", "Returns the active cooling policy threshold values"}, - {"_ADR", "Address", "Returns the address of a device on its parent bus"}, - {"_AEI", "ACPI Event Interrupts", "Returns a list of GPIO events to be used as ACPI events"}, - {"_ALC", "Ambient Light Chromaticity", "Returns the ambient light color chromaticity"}, - {"_ALI", "Ambient Light Illuminance", "Returns the ambient light brightness"}, - {"_ALN", "Alignment", "Base alignment, Resource Descriptor field"}, - {"_ALP", "Ambient Light Polling", "Returns the ambient light sensor polling frequency"}, - {"_ALR", "Ambient Light Response", "Returns the ambient light brightness to display brightness mappings"}, - {"_ALT", "Ambient Light Temperature", "Returns the ambient light color temperature"}, - {"_ALx", "Active List", "Returns a list of active cooling device objects"}, - {"_ART", "Active cooling Relationship Table", "Returns thermal relationship information between platform devices and fan devices"}, - {"_ASI", "Address Space Id", "Resource Descriptor field"}, - {"_ASZ", "Access Size", "Resource Descriptor field"}, - {"_ATT", "Type-Specific Attribute", "Resource Descriptor field"}, - {"_BAS", "Base Address", "Range base address, Resource Descriptor field"}, - {"_BBN", "Bios Bus Number", "Returns the PCI bus number returned by the BIOS"}, - {"_BCL", "Brightness Control Levels", "Returns a list of supported brightness control levels"}, - {"_BCM", "Brightness Control Method", "Sets the brightness level of the display device"}, - {"_BCT", "Battery Charge Time", "Returns time remaining to complete charging battery"}, - {"_BDN", "Bios Dock Name", "Returns the Dock ID returned by the BIOS"}, - {"_BFS", "Back From Sleep", "Inform AML of a wake event"}, - {"_BIF", "Battery Information", "Returns a Control Method Battery information block"}, - {"_BIX", "Battery Information Extended", "Returns a Control Method Battery extended information block"}, - {"_BLT", "Battery Level Threshold", "Set battery level threshold preferences"}, - {"_BM_", "Bus Master", "Resource Descriptor field"}, - {"_BMA", "Battery Measurement Averaging Interval", "Sets battery measurement averaging interval"}, - {"_BMC", "Battery Maintenance Control", "Sets battery maintenance and control features"}, - {"_BMD", "Battery Maintenance Data", "Returns battery maintenance, control, and state data"}, - {"_BMS", "Battery Measurement Sampling Time", "Sets the battery measurement sampling time"}, - {"_BQC", "Brightness Query Current", "Returns the current display brightness level"}, - {"_BST", "Battery Status", "Returns a Control Method Battery status block"}, - {"_BTM", "Battery Time", "Returns the battery runtime"}, - {"_BTP", "Battery Trip Point", "Sets a Control Method Battery trip point"}, - {"_CBA", "Configuration Base Address", "Sets the CBA for a PCI Express host bridge"}, - {"_CDM", "Clock Domain", "Returns a logical processor's clock domain identifier"}, - {"_CID", "Compatible ID", "Returns a device's Plug and Play Compatible ID list"}, - {"_CLS", "Class Code", "Returns PCI class code and subclass"}, - {"_CPC", "Continuous Performance Control", "Returns a list of performance control interfaces"}, - {"_CRS", "Current Resource Settings", "Returns the current resource settings for a device"}, - {"_CRT", "Critical Temperature", "Returns the shutdown critical temperature"}, - {"_CSD", "C State Dependencies", "Returns a list of C-state dependencies"}, - {"_CST", "C States", "Returns a list of supported C-states"}, - {"_CWS", "Clear Wake Alarm Status", "Clear the status of wake alarms"}, - {"_DBT", "Debounce Timeout", "Timeout value, Resource Descriptor field"}, - {"_DCK", "Dock", "Sets docking isolation. Presence indicates device is a docking station"}, - {"_DCS", "Display Current Status", "Returns status of the display output device"}, - {"_DDC", "Display Data Current", "Returns the EDID for the display output device"}, - {"_DDN", "Dos Device Name", "Returns a device logical name"}, - {"_DEC", "Decode", "Device decoding type, Resource Descriptor field"}, - {"_DEP", "Dependencies", "Returns a list of operation region dependencies"}, - {"_DGS", "Display Graphics State", "Return the current state of the output device"}, - {"_DIS", "Disable", "Disables a device"}, - {"_DLM", "Device Lock Mutex", "Defines mutex for OS/AML sharing"}, - {"_DMA", "Direct Memory Access", "Returns a device's current resources for DMA transactions"}, - {"_DOD", "Display Output Devices", "Enumerate all devices attached to the display adapter"}, - {"_DOS", "Disable Output Switching", "Sets the display output switching mode"}, - {"_DPL", "Device Selection Polarity", "Polarity of Device Selection signal, Resource Descriptor field"}, - {"_DRS", "Drive Strength", "Drive Strength setting for GPIO connection, Resource Descriptor field"}, - {"_DSM", "Device Specific Method", "Executes device-specific functions"}, - {"_DSS", "Device Set State", "Sets the display device state"}, - {"_DSW", "Device Sleep Wake", "Sets the sleep and wake transition states for a device"}, - {"_DTI", "Device Temperature Indication", "Conveys native device temperature to the platform"}, - {"_Exx", "Edge GPE", "Method executed as a result of a general-purpose event"}, - {"_EC_", "Embedded Controller", "returns EC offset and query information"}, - {"_EDL", "Eject Device List", "Returns a list of devices that are dependent on a device (docking)"}, - {"_EJD", "Ejection Dependent Device", "Returns the name of dependent (parent) device (docking)"}, - {"_EJx", "Eject", "Begin or cancel a device ejection request (docking)"}, - {"_END", "Endian-ness", "Endian orientation, Resource Descriptor field"}, - {"_EVT", "Event", "Event method for GPIO events"}, - {"_FDE", "Floppy Disk Enumerate", "Returns floppy disk configuration information"}, - {"_FDI", "Floppy Drive Information", "Returns a floppy drive information block"}, - {"_FDM", "Floppy Drive Mode", "Sets a floppy drive speed"}, - {"_FIF", "Fan Information", "Returns fan device information"}, - {"_FIX", "Fixed Register Resource Provider", "Returns a list of devices that implement FADT register blocks"}, - {"_FLC", "Flow Control", "Flow control, Resource Descriptor field"}, - {"_FPS", "Fan Performance States", "Returns a list of supported fan performance states"}, - {"_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"}, - {"_FST", "Fan Status", "Returns current status information for a fan device"}, - {"_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"}, - {"_GCP", "Get Capability", "Get device time capabilities"}, - {"_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"}, - {"_GL_", "Global Lock", "OS-defined Global Lock mutex object"}, - {"_GLK", "Global Lock", "Returns a device's Global Lock requirement for device access"}, - {"_GPD", "Get Post Data", "Returns the value of the VGA device that will be posted at boot"}, - {"_GPE", "General Purpose Events", "(1) predefined Scope (\\_GPE.)"}, - {"_GRA", "Granularity", "Address space granularity, Resource Descriptor field"}, - {"_GSB", "Global System Interrupt Base", "Returns the GSB for a I/O APIC device"}, - {"_GRT", "Get Real Time", "Returns current time-of-day"}, - {"_GTF", "Get Task File", "Returns a list of ATA commands to restore a drive to default state"}, - {"_GTM", "Get Timing Mode", "Returns a list of IDE controller timing information"}, - {"_GTS", "Going To Sleep", "Inform AML of pending sleep"}, - {"_GWS", "Get Wake Status", "Return status of wake alarms"}, - {"_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"}, - {"_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"}, - {"_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"}, - {"_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"}, - {"_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"}, - {"_HRV", "Hardware Revision", "Returns a hardware revision value"}, - {"_IFT", "IPMI Interface Type", "See the Intelligent Platform Management Interface Specification"}, - {"_INI", "Initialize", "Performs device specific initialization"}, - {"_INT", "Interrupts", "Interrupt mask bits, Resource Descriptor field"}, - {"_IOR", "I/O Restriction", "Restriction type, Resource Descriptor field"}, - {"_IRC", "Inrush Current", "Presence indicates that a device has a significant inrush current draw"}, - {"_Lxx", "Level GPE", "Control method executed as a result of a general-purpose event"}, - {"_LCK", "Lock", "Locks or unlocks a device (docking)"}, - {"_LEN", "Length", "Range length, Resource Descriptor field"}, - {"_LID", "Lid", "Returns the open/closed status of the lid on a mobile system"}, - {"_LIN", "Lines In Use", "Handshake lines, Resource Descriptor field"}, - {"_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"}, - {"_MAF", "Maximum Address Fixed", "Resource Descriptor field"}, - {"_MAT", "Multiple Apic Table Entry", "Returns a list of MADT APIC structure entries"}, - {"_MAX", "Maximum Base Address", "Resource Descriptor field"}, - {"_MBM", "Memory Bandwidth Monitoring Data", "Returns bandwidth monitoring data for a memory device"}, - {"_MEM", "Memory Attributes", "Resource Descriptor field"}, - {"_MIF", "Minimum Address Fixed", "Resource Descriptor field"}, - {"_MIN", "Minimum Base Address", "Resource Descriptor field"}, - {"_MLS", "Multiple Language String", "Returns a device description in multiple languages"}, - {"_MOD", "Mode", "Interrupt mode, Resource Descriptor field"}, - {"_MSG", "Message", "Sets the system message waiting status indicator"}, - {"_MSM", "Memory Set Monitoring", "Sets bandwidth monitoring parameters for a memory device"}, - {"_MTP", "Memory Type", "Resource Descriptor field"}, - {"_NTT", "Notification Temperature Threshold", "Returns a threshold for device temperature change that requires platform notification"}, - {"_OFF", "Off", "Sets a power resource to the off state"}, - {"_ON_", "On", "Sets a power resource to the on state"}, - {"_OS_", "Operating System", "Returns a string that identifies the operating system"}, - {"_OSC", "Operating System Capabilities", "Inform AML of host features and capabilities"}, - {"_OSI", "Operating System Interfaces", "Returns supported interfaces, behaviors, and features"}, - {"_OST", "Ospm Status Indication", "Inform AML of event processing status"}, - {"_PAI", "Power Averaging Interval", "Sets the averaging interval for a power meter"}, - {"_PAR", "Parity", "Parity bits, Resource Descriptor field"}, - {"_PCL", "Power Consumer List", "Returns a list of devices powered by a power source"}, - {"_PCT", "Performance Control", "Returns processor performance control and status registers"}, - {"_PDC", "Processor Driver Capabilities", "Inform AML of processor driver capabilities"}, - {"_PDL", "P-state Depth Limit", "Returns the lowest available performance P-state"}, - {"_PHA", "Phase", "Clock phase, Resource Descriptor field"}, - {"_PIC", "PIC", "Inform AML of the interrupt model in use"}, - {"_PIF", "Power Source Information", "Returns a Power Source information block"}, - {"_PIN", "Pins", "Pin list, Resource Descriptor field"}, - {"_PLD", "Physical Device Location", "Returns a device's physical location information"}, - {"_PMC", "Power Meter Capabilities", "Returns a list of Power Meter capabilities info"}, - {"_PMD", "Power Metered Devices", "Returns a list of devices that are measured by the power meter device"}, - {"_PMM", "Power Meter Measurement", "Returns the current value of the Power Meter"}, - {"_POL", "Polarity", "Interrupt polarity, Resource Descriptor field"}, - {"_PPC", "Performance Present Capabilites", "Returns a list of the performance states currently supported by the platform"}, - {"_PPE", "Polling for Platform Error", "Returns the polling interval to retrieve Corrected Platform Error information"}, - {"_PPI", "Pin Configuration", "Resource Descriptor field"}, - {"_PR", "Processor", "Predefined scope for processor objects"}, - {"_PR0", "Power Resources for D0", "Returns a list of dependent power resources to enter state D0 (fully on)"}, - {"_PR1", "Power Resources for D1", "Returns a list of dependent power resources to enter state D1"}, - {"_PR2", "Power Resources for D2", "Returns a list of dependent power resources to enter state D2"}, - {"_PR3", "Power Resources for D3hot", "Returns a list of dependent power resources to enter state D3hot"}, - {"_PRE", "Power Resources for Enumeration", "Returns a list of dependent power resources to enumerate devices on a bus"}, - {"_PRL", "Power Source Redundancy List", "Returns a list of power source devices in the same redundancy grouping"}, - {"_PRS", "Possible Resource Settings", "Returns a list of a device's possible resource settings"}, - {"_PRT", "Pci Routing Table", "Returns a list of PCI interrupt mappings"}, - {"_PRW", "Power Resources for Wake", "Returns a list of dependent power resources for waking"}, - {"_PS0", "Power State 0", "Sets a device's power state to D0 (device fully on)"}, - {"_PS1", "Power State 1", "Sets a device's power state to D1"}, - {"_PS2", "Power State 2", "Sets a device's power state to D2"}, - {"_PS3", "Power State 3", "Sets a device's power state to D3 (device off)"}, - {"_PSC", "Power State Current", "Returns a device's current power state"}, - {"_PSD", "Processor State Dependencies", "Returns processor P-State dependencies"}, - {"_PSE", "Power State for Enumeration", "Put a bus into enumeration power mode"}, - {"_PSL", "Passive List", "Returns a list of passive cooling device objects"}, - {"_PSR", "Power Source", "Returns the power source device currently in use"}, - {"_PSS", "Performance Supported States", "Returns a list of supported processor performance states"}, - {"_PSV", "Passive", "Returns the passive trip point temperature"}, - {"_PSW", "Power State Wake", "Sets a device's wake function"}, - {"_PTC", "Processor Throttling Control", "Returns throttling control and status registers"}, - {"_PTP", "Power Trip Points", "Sets trip points for the Power Meter device"}, - {"_PTS", "Prepare To Sleep", "Inform the platform of an impending sleep transition"}, - {"_PUR", "Processor Utilization Request", "Returns the number of processors that the platform would like to idle"}, - {"_PXM", "Proximity", "Returns a device's proximity domain identifier"}, - {"_Qxx", "Query", "Embedded Controller query and SMBus Alarm control method"}, - {"_RBO", "Register Bit Offset", "Resource Descriptor field"}, - {"_RBW", "Register Bit Width", "Resource Descriptor field"}, - {"_REG", "Region", "Inform AML code of an operation region availability change"}, - {"_REV", "Revision", "Returns the revision of the ACPI specification that is implemented"}, - {"_RMV", "Remove", "Returns a device's removal ability status (docking)"}, - {"_RNG", "Range", "Memory range type, Resource Descriptor field"}, - {"_ROM", "Read-Only Memory", "Returns a copy of the ROM data for a display device"}, - {"_RT_", "Resource Type", "Resource Descriptor field"}, - {"_RTV", "Relative Temperature Values", "Returns temperature value information"}, - {"_RW_", "Read-Write Status", "Resource Descriptor field"}, - {"_RXL", "Receive Buffer Size", "Serial channel buffer, Resource Descriptor field"}, - {"_S0_", "S0 System State", "Returns values to enter the system into the S0 state"}, - {"_S1_", "S1 System State", "Returns values to enter the system into the S1 state"}, - {"_S2_", "S2 System State", "Returns values to enter the system into the S2 state"}, - {"_S3_", "S3 System State", "Returns values to enter the system into the S3 state"}, - {"_S4_", "S4 System State", "Returns values to enter the system into the S4 state"}, - {"_S5_", "S5 System State", "Returns values to enter the system into the S5 state"}, - {"_S1D", "S1 Device State", "Returns the highest D-state supported by a device when in the S1 state"}, - {"_S2D", "S2 Device State", "Returns the highest D-state supported by a device when in the S2 state"}, - {"_S3D", "S3 Device State", "Returns the highest D-state supported by a device when in the S3 state"}, - {"_S4D", "S4 Device State", "Returns the highest D-state supported by a device when in the S4 state"}, - {"_S0W", "S0 Device Wake State", "Returns the lowest D-state that the device can wake itself from S0"}, - {"_S1W", "S1 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S1"}, - {"_S2W", "S2 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S2"}, - {"_S3W", "S3 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S3"}, - {"_S4W", "S4 Device Wake State", "Returns the lowest D-state for this device that can wake the system from S4"}, - {"_SB_", "System Bus", "Scope for device and bus objects"}, - {"_SBS", "Smart Battery Subsystem", "Returns the subsystem configuration"}, - {"_SCP", "Set Cooling Policy", "Sets the cooling policy (active or passive)"}, - {"_SDD", "Set Device Data", "Sets data for a SATA device"}, - {"_SEG", "Segment", "Returns a device's PCI Segment Group number"}, - {"_SHL", "Set Hardware Limit", "Sets the hardware limit enforced by the Power Meter"}, - {"_SHR", "Sharable", "Interrupt share status, Resource Descriptor field"}, - {"_SI_", "System Indicators", "Predefined scope"}, - {"_SIZ", "Size", "DMA transfer size, Resource Descriptor field"}, - {"_SLI", "System Locality Information", "Returns a list of NUMA system localities"}, - {"_SLV", "Slave Mode", "Mode setting, Resource Descriptor field"}, - {"_SPD", "Set Post Device", "Sets which video device will be posted at boot"}, - {"_SPE", "Speed", "Connection speed, Resource Descriptor field"}, - {"_SRS", "Set Resource Settings", "Sets a device's resource allocation"}, - {"_SRT", "Set Real Time", "Interrupt triggering, Resource Descriptor field"}, - {"_SRV", "IPMI Spec Revision", "See the Intelligent Platform Management Interface Specification"}, - {"_SST", "System Status", "Sets the system status indicator"}, - {"_STA", "Status", " (1) returns the current status of a device"}, - {"_STB", "Stop Bits", "Serial channel stop bits, Resource Descriptor field"}, - {"_STM", "Set Timing Mode", "Sets an IDE controller transfer timings"}, - {"_STP", "Set Expired Timer Wake Policy", "Sets expired timer policies of the wake alarm device"}, - {"_STR", "String", "Returns a device's description string"}, - {"_STV", "Set Timer Value", "Set timer values of the wake alarm device"}, - {"_SUB", "Subsystem ID", "Returns the subsystem ID for a device"}, - {"_SUN", "Slot User Number", "Returns the slot unique ID number"}, - {"_SWS", "System Wake Source", "Returns the source event that caused the system to wake"}, - {"_T_x", "Temporary", "Reserved for use by ASL compilers"}, - {"_TC1", "Thermal Constant 1", "Returns TC1 for the passive cooling formula"}, - {"_TC2", "Thermal Constant 2", "Returns TC2 for the passive cooling formula"}, - {"_TDL", "T-State Depth Limit", "Returns the _TSS entry number of the lowest power throttling state"}, - {"_TIP", "Expired Timer Wake Policy", "Returns timer policies of the wake alarm device"}, - {"_TIV", "Timer Values", "Returns remaining time of the wake alarm device"}, - {"_TMP", "Temperature", "Returns a thermal zone's current temperature"}, - {"_TPC", "Throttling Present Capabilities", "Returns the current number of supported throttling states"}, - {"_TPT", "Trip Point Temperature", "Inform AML that a device's embedded temperature sensor has crossed a temperature trip point"}, - {"_TRA", "Translation", "Address translation offset, Resource Descriptor field"}, - {"_TRS", "Translation Sparse", "Sparse/dense flag, Resource Descriptor field"}, - {"_TRT", "Thermal Relationship Table", "Returns thermal relationships between platform devices"}, - {"_TSD", "Throttling State Dependencies", "Returns a list of T-state dependencies"}, - {"_TSF", "Type-Specific Flags", "Resource Descriptor field"}, - {"_TSP", "Thermal Sampling Period", "Returns the thermal sampling period for passive cooling"}, - {"_TSS", "Throttling Supported States", "Returns supported throttling state information"}, - {"_TST", "Temperature Sensor Threshold", "Returns the minimum separation for a device's temperature trip points"}, - {"_TTP", "Translation Type", "Translation/static flag, Resource Descriptor field"}, - {"_TTS", "Transition To State", "Inform AML of an S-state transition"}, - {"_TXL", "Transmit Buffer Size", "Serial Channel buffer, Resource Descriptor field"}, - {"_TYP", "Type", "DMA channel type (speed), Resource Descriptor field"}, - {"_TZ_", "Thermal Zone", "Predefined scope: ACPI 1.0"}, - {"_TZD", "Thermal Zone Devices", "Returns a list of device names associated with a Thermal Zone"}, - {"_TZM", "Thermal Zone Member", "Returns a reference to the thermal zone of which a device is a member"}, - {"_TZP", "Thermal Zone Polling", "Returns a Thermal zone's polling frequency"}, - {"_UID", "Unique ID", "Return a device's unique persistent ID"}, - {"_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"}, - {"_UPD", "User Presence Detect", "Returns user detection information"}, - {"_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"}, - {"_VEN", "Vendor Data", "Resource Descriptor field"}, - {"_VPO", "Video Post Options", "Returns the implemented video post options"}, - {"_WAK", "Wake", "Inform AML that the system has just awakened"}, - {"_Wxx", "Wake Event", "Method executed as a result of a wake event"}, - {NULL, NULL, NULL} -}; diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h index 3c0e5dc..bc3f497 100644 --- a/source/tools/acpisrc/acpisrc.h +++ b/source/tools/acpisrc/acpisrc.h @@ -263,7 +263,8 @@ AsTrimLines ( void AsMixedCaseToUnderscores ( - char *Buffer); + char *Buffer, + char *Filename); void AsCountTabs ( diff --git a/source/tools/acpisrc/ascase.c b/source/tools/acpisrc/ascase.c index 232ebe8..7e115b7 100644 --- a/source/tools/acpisrc/ascase.c +++ b/source/tools/acpisrc/ascase.c @@ -161,75 +161,87 @@ AsLowerCaseString ( void AsMixedCaseToUnderscores ( - char *Buffer) + char *Buffer, + char *Filename) { UINT32 Length; char *SubBuffer = Buffer; char *TokenEnd; char *TokenStart = NULL; char *SubString; - BOOLEAN HasLowerCase = FALSE; - - + UINT32 LineNumber = 1; + UINT32 Count; + + + /* + * Examine the entire buffer (contains the entire file) + * We are only interested in these tokens: + * Escape sequences - ignore entire sequence + * Single-quoted constants - ignore + * Quoted strings - ignore entire string + * Translation escape - starts with /,*,! + * Decimal and hex numeric constants - ignore entire token + * Entire uppercase token - ignore, it is a macro or define + * Starts with underscore, then a lowercase or digit: convert + */ while (*SubBuffer) { - /* Ignore whitespace */ + if (*SubBuffer == '\n') + { + LineNumber++; + SubBuffer++; + continue; + } - if (*SubBuffer == ' ') + /* Ignore standard escape sequences (\n, \r, etc.) Not Hex or Octal escapes */ + + if (*SubBuffer == '\\') { - while (*SubBuffer == ' ') - { - SubBuffer++; - } - TokenStart = NULL; - HasLowerCase = FALSE; + SubBuffer += 2; continue; } - /* Ignore commas */ + /* Ignore single-quoted characters */ - if ((*SubBuffer == ',') || - (*SubBuffer == '>') || - (*SubBuffer == ')')) + if (*SubBuffer == '\'') { - SubBuffer++; - TokenStart = NULL; - HasLowerCase = FALSE; + SubBuffer += 3; continue; } - /* Check for quoted string -- ignore */ + /* Ignore standard double-quoted strings */ if (*SubBuffer == '"') { SubBuffer++; + Count = 0; while (*SubBuffer != '"') { - if (!*SubBuffer) + Count++; + if ((!*SubBuffer) || + (Count > 8192)) { + printf ("Found an unterminated quoted string!, line %u: %s\n", + LineNumber, Filename); return; } - /* Handle embedded escape sequences */ + /* Handle escape sequences */ if (*SubBuffer == '\\') { SubBuffer++; } + SubBuffer++; } SubBuffer++; continue; } - if (islower ((int) *SubBuffer)) - { - HasLowerCase = TRUE; - } - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing + * Check for translation escape string. It means to ignore + * blocks of code during this code conversion. */ if ((SubBuffer[0] == '/') && (SubBuffer[1] == '*') && @@ -238,161 +250,209 @@ AsMixedCaseToUnderscores ( SubBuffer = strstr (SubBuffer, "!*/"); if (!SubBuffer) { + printf ("Found an unterminated translation escape!, line %u: %s\n", + LineNumber, Filename); return; } continue; } - /* Ignore hex constants */ + /* Ignore anything that starts with a number (0-9) */ - if (SubBuffer[0] == '0') + if (isdigit ((int) *SubBuffer)) { - if ((SubBuffer[1] == 'x') || - (SubBuffer[1] == 'X')) + /* Ignore hex constants */ + + if ((SubBuffer[0] == '0') && + ((SubBuffer[1] == 'x') || (SubBuffer[1] == 'X'))) { SubBuffer += 2; - while (isxdigit ((int) *SubBuffer)) - { - SubBuffer++; - } - continue; } - } - -/* OBSOLETE CODE, all quoted strings now completely ignored. */ -#if 0 - /* Ignore format specification fields */ - if (SubBuffer[0] == '%') - { - SubBuffer++; + /* Skip over all digits, both decimal and hex */ - while ((isalnum (*SubBuffer)) || (*SubBuffer == '.')) + while (isxdigit ((int) *SubBuffer)) { SubBuffer++; } - - continue; - } -#endif - - /* Ignore standard escape sequences (\n, \r, etc.) Not Hex or Octal escapes */ - - if (SubBuffer[0] == '\\') - { - SubBuffer += 2; + TokenStart = NULL; continue; } /* - * Ignore identifiers that already contain embedded underscores - * These are typically C macros or defines (all upper case) - * Note: there are some cases where identifiers have underscores - * AcpiGbl_* for example. HasLowerCase flag handles these. + * Check for fully upper case identifiers. These are usually macros + * or defines. Allow decimal digits and embedded underscores. */ - if ((*SubBuffer == '_') && (!HasLowerCase) && (TokenStart)) + if (isupper ((int) *SubBuffer)) { - /* Check the rest of the identifier for any lower case letters */ - - SubString = SubBuffer; - while ((isalnum ((int) *SubString)) || (*SubString == '_')) + SubString = SubBuffer + 1; + while ((isupper ((int) *SubString)) || + (isdigit ((int) *SubString)) || + (*SubString == '_')) { - if (islower ((int) *SubString)) - { - HasLowerCase = TRUE; - } SubString++; } - /* If no lower case letters, we can safely ignore the entire token */ - - if (!HasLowerCase) + /* + * For the next character, anything other than a lower case + * means that the identifier has terminated, and contains + * exclusively Uppers/Digits/Underscores. Ignore the entire + * identifier. + */ + if (!islower ((int) *SubString)) { - SubBuffer = SubString; + SubBuffer = SubString + 1; continue; } } - /* A capital letter may indicate the start of a token; save it */ - - if (isupper ((int) SubBuffer[0])) - { - TokenStart = SubBuffer; - } - /* - * Convert each pair of letters that matches the form: - * - * - * to - * + * These forms may indicate an identifier that can be converted: + * (Ax) + * (An) */ - else if ((islower ((int) SubBuffer[0]) || isdigit ((int) SubBuffer[0])) && - (isupper ((int) SubBuffer[1]))) + if (isupper ((int) SubBuffer[0]) && + ((islower ((int) SubBuffer[1])) || isdigit ((int) SubBuffer[1]))) { - if (isdigit ((int) SubBuffer[0])) + TokenStart = SubBuffer; + SubBuffer++; + + while (1) { - /* Ignore */ - /* Ignore */ + /* Walk over the lower case letters and decimal digits */ - if (isupper ((int) *(SubBuffer-1)) || - *(SubBuffer-1) == '_') + while (islower ((int) *SubBuffer) || + isdigit ((int) *SubBuffer)) { SubBuffer++; - continue; } - } - /* - * Matched the pattern. - * Find the end of this identifier (token) - */ - TokenEnd = SubBuffer; - while ((isalnum ((int) *TokenEnd)) || (*TokenEnd == '_')) - { - TokenEnd++; - } + /* Check for end of line or end of token */ - /* Force the UpperCase letter (#2) to lower case */ + if (*SubBuffer == '\n') + { + LineNumber++; + break; + } - Gbl_MadeChanges = TRUE; - SubBuffer[1] = (char) tolower ((int) SubBuffer[1]); + if (*SubBuffer == ' ') + { + /* Check for form "Axx - " in a parameter header description */ - SubString = TokenEnd; - Length = 0; + while (*SubBuffer == ' ') + { + SubBuffer++; + } + + SubBuffer--; + if ((SubBuffer[1] == '-') && + (SubBuffer[2] == ' ')) + { + if (TokenStart) + { + *TokenStart = (char) tolower ((int) *TokenStart); + } + } + break; + } - while (*SubString != '\n') - { /* - * If we have at least two trailing spaces, we can get rid of - * one to make up for the newly inserted underscore. This will - * help preserve the alignment of the text + * Ignore these combinations: + * + * + * */ - if ((SubString[0] == ' ') && - (SubString[1] == ' ')) + if (isdigit ((int) *SubBuffer)) + { + if (isalnum ((int) *(SubBuffer-1)) || + *(SubBuffer-1) == '_') + { + break; + } + } + + /* Ignore token if next character is not uppercase or digit */ + + if (!isupper ((int) *SubBuffer) && + !isdigit ((int) *SubBuffer)) { - Length = SubString - SubBuffer - 2; break; } - SubString++; - } + /* + * Form (AxxB): + * Convert leading character of the token to lower case + */ + if (TokenStart) + { + *TokenStart = (char) tolower ((int) *TokenStart); + TokenStart = NULL; + } - if (!Length) - { - Length = strlen (&SubBuffer[1]); - } + /* Find the end of this identifier (token) */ - memmove (&SubBuffer[2], &SubBuffer[1], Length + 1); - SubBuffer[1] = '_'; - SubBuffer +=2; + TokenEnd = SubBuffer - 1; + while ((isalnum ((int) *TokenEnd)) || + (*TokenEnd == '_')) + { + TokenEnd++; + } - /* Lower case the leading character of the token */ + SubString = TokenEnd; + Length = 0; - if (TokenStart) - { - *TokenStart = (char) tolower ((int) *TokenStart); - TokenStart = NULL; + while (*SubString != '\n') + { + /* + * If we have at least two trailing spaces, we can get rid of + * one to make up for the newly inserted underscore. This will + * help preserve the alignment of the text + */ + if ((SubString[0] == ' ') && + (SubString[1] == ' ')) + { + Length = SubString - SubBuffer - 1; + break; + } + + SubString++; + } + + if (!Length) + { + Length = strlen (&SubBuffer[0]); + } + + /* + * Within this identifier, convert this pair of letters that + * matches the form: + * + * + * to + * + */ + Gbl_MadeChanges = TRUE; + + /* Insert the underscore */ + + memmove (&SubBuffer[1], &SubBuffer[0], Length + 1); + SubBuffer[0] = '_'; + + /* + * If we have , leave them as-is + * Enables transforms like: + * LocalFADT -> local_FADT + */ + if (isupper ((int) SubBuffer[2])) + { + SubBuffer += 1; + break; + } + + /* Lower case the original upper case letter */ + + SubBuffer[1] = (char) tolower ((int) SubBuffer[1]); + SubBuffer += 2; } } @@ -570,5 +630,3 @@ AsUppercaseTokens ( } } } - - diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c index ce26adc..4e79cf3 100644 --- a/source/tools/acpisrc/asfile.c +++ b/source/tools/acpisrc/asfile.c @@ -443,7 +443,7 @@ AsConvertFile ( case CVT_MIXED_CASE_TO_UNDERSCORES: - AsMixedCaseToUnderscores (FileBuffer); + AsMixedCaseToUnderscores (FileBuffer, Filename); break; diff --git a/source/tools/acpisrc/asmain.c b/source/tools/acpisrc/asmain.c index baf4e2f..b1f3402 100644 --- a/source/tools/acpisrc/asmain.c +++ b/source/tools/acpisrc/asmain.c @@ -245,10 +245,18 @@ AsDisplayStats ( printf ("%8u Lines of non-comment whitespace\n", Gbl_WhiteLines); printf ("%8u Lines of comments\n", Gbl_CommentLines); printf ("%8u Long lines found\n", Gbl_LongLines); - printf ("%8.1f Ratio of code to whitespace\n", - ((float) Gbl_SourceLines / (float) Gbl_WhiteLines)); - printf ("%8.1f Ratio of code to comments\n", - ((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); + + if (Gbl_WhiteLines > 0) + { + printf ("%8.1f Ratio of code to whitespace\n", + ((float) Gbl_SourceLines / (float) Gbl_WhiteLines)); + } + + if ((Gbl_CommentLines + Gbl_NonAnsiComments) > 0) + { + printf ("%8.1f Ratio of code to comments\n", + ((float) Gbl_SourceLines / (float) (Gbl_CommentLines + Gbl_NonAnsiComments))); + } if (!Gbl_TotalLines) { diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 1f93e33..400f562 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -237,6 +237,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_GPE_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_GPE_HANDLER_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_INDEX_INFO", SRC_TYPE_STRUCT}, + {"ACPI_GPE_NOTIFY_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_REGISTER_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_WALK_INFO", SRC_TYPE_STRUCT}, {"ACPI_GPE_XRUPT_INFO", SRC_TYPE_STRUCT}, -- cgit v1.1 From f23a349d9fb9c359359e5f64b63ea4e15d776c76 Mon Sep 17 00:00:00 2001 From: jkim Date: Thu, 21 Jun 2012 18:22:50 +0000 Subject: Fix "comparison is always true due to limited range of data type" warning from GCC in the base system. Note this patch was submitted upstream and it will appear in the next ACPICA release. Discussed with: Moore, Robert (robert dot moore at intel dot com) --- source/compiler/aslsupport.l | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 2f73900..f63519c 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -92,7 +92,7 @@ static void AslDoLineDirective ( void) { - UINT8 c; + int c; char *Token; UINT32 LineNumber; char *Filename; @@ -103,7 +103,7 @@ AslDoLineDirective ( Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - while ((c = (UINT8) input()) != '\n' && c != EOF) + while ((c = input()) != '\n' && c != EOF) { *Gbl_LineBufPtr = c; Gbl_LineBufPtr++; @@ -430,8 +430,8 @@ static char AslDoComment ( void) { - char c; - char c1 = 0; + int c; + int c1 = 0; AslInsertLineBuffer ('/'); @@ -441,7 +441,7 @@ loop: /* Eat chars until end-of-comment */ - while ((c = (char) input()) != '*' && c != EOF) + while ((c = input()) != '*' && c != EOF) { AslInsertLineBuffer (c); c1 = c; @@ -468,7 +468,7 @@ loop: AslInsertLineBuffer (c); - if ((c1 = (char) input()) != '/' && c1 != EOF) + if ((c1 = input()) != '/' && c1 != EOF) { unput(c1); goto loop; @@ -511,13 +511,13 @@ static char AslDoCommentType2 ( void) { - char c; + int c; AslInsertLineBuffer ('/'); AslInsertLineBuffer ('/'); - while ((c = (char) input()) != '\n' && c != EOF) + while ((c = input()) != '\n' && c != EOF) { AslInsertLineBuffer (c); } @@ -553,7 +553,7 @@ AslDoStringLiteral ( char *StringBuffer = MsgBuffer; char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE; char *CleanString; - char StringChar; + int StringChar; UINT32 State = ASL_NORMAL_CHAR; UINT32 i = 0; UINT8 Digit; @@ -566,7 +566,7 @@ AslDoStringLiteral ( * source line buffer. */ AslInsertLineBuffer ('\"'); - while ((StringChar = (char) input()) != EOF) + while ((StringChar = input()) != EOF) { AslInsertLineBuffer (StringChar); -- cgit v1.1