From a117a0a6c82c5a5030040bd2b75704a1366741d6 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Thu, 26 Mar 2020 21:13:14 +0000 Subject: [PATCH] Import ACPICA 20200326. --- changes.txt | 95 +++++ source/common/ahtable.c | 2 +- source/common/dmtable.c | 3 +- source/common/dmtbdump2.c | 25 +- source/common/dmtbinfo2.c | 16 +- source/common/dmtbinfo3.c | 2 +- source/compiler/aslcompile.c | 1 + source/compiler/aslcompiler.h | 8 +- source/compiler/aslcompiler.l | 20 +- source/compiler/asldefine.h | 1 + source/compiler/aslerror.c | 125 +++++- source/compiler/aslglobal.h | 1 + source/compiler/aslload.c | 88 ++++- source/compiler/asloptions.c | 2 +- source/compiler/asltypes.h | 31 +- source/compiler/dtcompiler.h | 1 - source/compiler/dtcompilerparser.l | 1 - source/compiler/dtcompilerparser.y | 1 - source/compiler/dtparser.l | 2 +- source/compiler/dttable1.c | 10 +- source/compiler/dtutils.c | 3 +- source/compiler/prparser.l | 2 +- source/components/debugger/dbinput.c | 19 +- source/components/debugger/dbxface.c | 1 + source/components/dispatcher/dswexec.c | 32 +- source/components/dispatcher/dswload.c | 2 - source/components/dispatcher/dswload2.c | 37 ++ source/components/hardware/hwsleep.c | 4 +- source/components/namespace/nsnames.c | 8 +- source/components/utilities/utdecode.c | 2 +- source/components/utilities/utdelete.c | 9 +- source/components/utilities/utprint.c | 8 +- source/include/acdisasm.h | 1 + source/include/acnamesp.h | 4 + source/include/acpixf.h | 2 +- source/include/actbinfo.h | 3 +- source/include/actbl2.h | 24 +- source/include/actbl3.h | 6 +- source/include/acuuid.h | 2 +- source/os_specific/service_layers/oswintbl.c | 378 +++++++++---------- source/tools/acpibin/abcompare.c | 14 +- source/tools/acpiexec/aecommon.h | 20 +- source/tools/acpiexec/aeinitfile.c | 254 ++++++++----- source/tools/acpiexec/aemain.c | 22 +- source/tools/acpisrc/astable.c | 9 +- source/tools/acpixtract/acpixtract.h | 4 +- 46 files changed, 911 insertions(+), 394 deletions(-) diff --git a/changes.txt b/changes.txt index b0edf21a8c2f..27a2ee349ff3 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,98 @@ +---------------------------------------- +26 March 2020. Summary of changes for version 20200326: + + +1) ACPICA kernel-resident subsystem: + +Performed a code clean-up to prevent build errors on early versions of +GCC-10. + +Added the NHLT table signature. iASL data table compiler/disassembler +support for this table is coming soon. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +AcpiExec: Fixed several problems with the namespace initialization file +(-fi option). Includes fixes to prevent AE_ALREADY_EXISTS +errors, several seg faults, and enhancements to line parsing within the +init file. In addition, each object found in the init file and it's new +value is displayed, as well as any such entries that do not have a +corresponding name in the namespace. For reference, the syntax for the +various supported data types are presented below: + PCHG 0x777788889999BBBB // Integer + \DEV1.STR1 "XYZ" // String + BUF1 (88 99 AA) // Buffer + PKG1 [0x1111 0x2222] // Package + \BF1 0x7980 // BufferField + RCRV 0x0123456789ABCDEF // Field Unit + +iASL: Added a custom iASL macro __EXPECT__(iASL-Error-Code). This macro +can be used anywhere in a given ASL file to configure iASL to expect an +iASL compiler error code on the line where this macro was placed. If the +error code does not exist, an error is generated. This is intended to be +used for ACPICA's ASL test suite, but can be used by ASL developers as +well. + +iASL: table compiler: Implemented IVRS IVHD type 11h parsing. The AMD +IVRS table parsing supported only IVHD type 10h structures. Parsing an +IVHD type 11h caused the iasl to report unknown subtable type. Add +necessary structure definition for IVHD type 11h and apply correct +parsing method based on subtable type. Micha? ?ygowski. + +iASL: table compiler: Fixed IVRS table IVHD type 10h reserved field name +According to AMD IOMMU Specification Revision 3.05 the reserved field +should be IOMMU Feature Reporting. Change the name of the field to the +correct one. Micha? ?ygowski. + +acpiexec: removed redeclaration of AcpiGbl_DbOpt_NoRegionSupport. Patch +based on suggestions by David Seifert and Benjamin Berg. + +iASL: table compiler: removed an unused variable (DtCompilerParserResult) +causing linking errors. Patch based on suggestions by David Seifert and +Benjamin Berg. + +iASL: table compiler: make LexBuffer static to avoid linking errors in +newer compilers. Patch based on suggestions by David Seifert and Benjamin +Berg. + +iASL: fixed type matching between External and Named objects. External +object types can only be expressed with ACPI object type values that are +defined in the ACPI spec. However, iASL uses ACPI object type values that +are local to ACPICA in addition to the values defined in the ACPI spec. +This change implements type matching to map some object type values +specific to ACPICA to ones that are defined in the ACPI spec. + +iASL: Dropped the type mismatch compiler error that can arise from +External declarations to a warning. This warning can occur when there is +a type difference between the external declaration and the actual object +declaration (when compiling multiple files/modules simultaneously). + +iASL: removed an incorrect error message regarding externals. This change +removes an incorrect error that is emitted when a duplicate external +declaration does not contain a type that opens a scope. This is incorrect +because the duplicate external with conflicting types are already caught +by iASL and it doesn't make any sense to enforce what this conflicting +type should be. + +AcpiXtract: fix AX_IS_TABLE_BLOCK_HEADER macro. This macro needs to be +surrounded by parens. Otherwise, a logical statement that applies a +logical not operator to this macro could result in a computation that +applies the operator to the left side of the logical and but not the +right. Reported-by: John Levon + +Fixed a problem with the local version of sprint(): On 32-bit, the +provided sprintf() is non-functional: with a size of ACPI_UINT32_MAX, +String + Size will wrap, meaning End < Start, and +AcpiUtBoundStringOutput() will never output anything as a result. The +symptom seen of this was acpixtract failing to output anything -- with a +custom build that included utprint.c. Signed-off-by: John Levon + + +iASL: Changed the "PlatformCommChannel" ASL keyword to "PCC", as per the +ACPI specification. + + ---------------------------------------- 14 February 2020. Summary of changes for version 20200214: diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 25fd525e02a2..32d5dedb96f1 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -258,7 +258,7 @@ const AH_TABLE AcpiGbl_SupportedTables[] = {ACPI_SIG_WDDT, "Watchdog Description Table"}, {ACPI_SIG_WDRT, "Watchdog Resource Table"}, {ACPI_SIG_WPBT, "Windows Platform Binary Table"}, - {ACPI_SIG_WSMT, "Windows SMM Security Migrations Table"}, + {ACPI_SIG_WSMT, "Windows SMM Security Mitigations Table"}, {ACPI_SIG_XENV, "Xen Environment table"}, {ACPI_SIG_XSDT, "Extended System Description Table"}, {NULL, NULL} diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 02220d261ce7..5896b2f257af 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -1676,7 +1676,8 @@ AcpiDmDumpTable ( Temp8 = *Target; switch (Temp8) { - case ACPI_IVRS_TYPE_HARDWARE: + case ACPI_IVRS_TYPE_HARDWARE1: + case ACPI_IVRS_TYPE_HARDWARE2: Name = AcpiDmIvrsSubnames[0]; break; diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index 95eea6d993ae..688a2cf94f48 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -475,11 +475,16 @@ AcpiDmDumpIvrs ( switch (Subtable->Type) { - case ACPI_IVRS_TYPE_HARDWARE: + case ACPI_IVRS_TYPE_HARDWARE1: InfoTable = AcpiDmTableInfoIvrs0; break; + case ACPI_IVRS_TYPE_HARDWARE2: + + InfoTable = AcpiDmTableInfoIvrs01; + break; + case ACPI_IVRS_TYPE_MEMORY1: case ACPI_IVRS_TYPE_MEMORY2: case ACPI_IVRS_TYPE_MEMORY3: @@ -514,11 +519,21 @@ AcpiDmDumpIvrs ( /* The hardware subtable can contain multiple device entries */ - if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE) + if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1 || + Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) { - EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); - DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, - sizeof (ACPI_IVRS_HARDWARE)); + if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE1) + { + EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE1); + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, + sizeof (ACPI_IVRS_HARDWARE1)); + } + else if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE2) + { + EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE2); + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, + sizeof (ACPI_IVRS_HARDWARE2)); + } while (EntryOffset < (Offset + Subtable->Length)) { diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c index 79802830c64c..c000a921ca68 100644 --- a/source/common/dmtbinfo2.c +++ b/source/common/dmtbinfo2.c @@ -403,7 +403,21 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info", 0}, - {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (FeatureReporting), "Feature Reporting", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs01[] = +{ + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (CapabilityOffset), "Capability Offset", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, + {ACPI_DMT_UINT16, ACPI_IVRS01_OFFSET (Info), "Virtualization Info", 0}, + {ACPI_DMT_UINT32, ACPI_IVRS01_OFFSET (Attributes), "Attributes", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (EfrRegisterImage), "EFR Image", 0}, + {ACPI_DMT_UINT64, ACPI_IVRS01_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/common/dmtbinfo3.c b/source/common/dmtbinfo3.c index 07a26c2b3cbe..f4092c240171 100644 --- a/source/common/dmtbinfo3.c +++ b/source/common/dmtbinfo3.c @@ -691,7 +691,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] = /******************************************************************************* * - * WSMT - Windows SMM Security Migrations Table + * WSMT - Windows SMM Security Mitigations Table * ******************************************************************************/ diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 9481b6bb2d60..787a54444475 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -283,6 +283,7 @@ CmDoCompile ( LsDumpParseTree (); + UtEndEvent (Event); UtEndEvent (FullCompile); return (AE_OK); diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 9bebc3801d79..82d777d843b9 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -488,7 +488,7 @@ AslCheckExpectedExceptions ( void); ACPI_STATUS -AslExpectException ( +AslLogExpectedException ( char *MessageIdString); ACPI_STATUS @@ -501,9 +501,15 @@ AslDisableException ( BOOLEAN AslIsExceptionIgnored ( + char *Filename, + UINT32 LineNumber, UINT8 Level, UINT16 MessageId); +void +AslLogExpectedExceptionByLine ( + char *MessageIdString); + void AslCoreSubsystemError ( ACPI_PARSE_OBJECT *Op, diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index 797f989915cf..4c3fbde3ae93 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -156,7 +156,6 @@ #include #include -YYSTYPE AslCompilerlval; /* * Generation: Use the following command line: @@ -195,6 +194,7 @@ count (int type); LeadNameChar [A-Za-z_] DigitChar [0-9] +ErrorCode [(][ ]*[1-9][0-9][0-9][0-9][ ]*[)] OctalChar [0-7] HexDigitChar [A-Fa-f0-9] RootChar [\\] @@ -692,7 +692,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 */ -"PlatformCommChannel" { count (0); return (PARSEOP_REGIONSPACE_PCC); } /* 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 */ @@ -810,6 +810,22 @@ NamePathTail [.]{NameSeg} "__LINE__" { count (0); return (PARSEOP___LINE__); } "__PATH__" { count (0); return (PARSEOP___PATH__); } "__METHOD__" { count (0); return (PARSEOP___METHOD__); } +"__EXPECT__"{ErrorCode} { char *s; + int index = 0; + count (0); + while (!isdigit (AslCompilertext[index])) + { + index++; + } + + /* + * The eror code is contained inside the + * {ErrorCode} pattern. Extract it and log it + * as the expected error code. + */ + s = UtLocalCacheCalloc (ASL_ERROR_CODE_LENGTH + 1); + memcpy (s, AslCompilertext + index, ASL_ERROR_CODE_LENGTH); + AslLogExpectedExceptionByLine (s); } {NameSeg} { char *s; count (0); diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 12a4cdd560ff..2627a58a06cf 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -227,6 +227,7 @@ #define ASL_NO_ABORT FALSE #define ASL_EOF ACPI_UINT32_MAX #define ASL_IGNORE_LINE (ACPI_UINT32_MAX -1) +#define ASL_ERROR_CODE_LENGTH 4 /* Listings */ diff --git a/source/compiler/aslerror.c b/source/compiler/aslerror.c index 1931fffcf123..8fae779d639e 100644 --- a/source/compiler/aslerror.c +++ b/source/compiler/aslerror.c @@ -162,6 +162,8 @@ AeAddToErrorLog ( static BOOLEAN AslIsExceptionExpected ( + char *Filename, + UINT32 LineNumber, UINT8 Level, UINT16 MessageId); @@ -170,7 +172,8 @@ AslIsExceptionDisabled ( UINT8 Level, UINT16 MessageId); -static void AslInitEnode ( +static void +AslInitEnode ( ASL_ERROR_MSG **Enode, UINT8 Level, UINT16 MessageId, @@ -956,7 +959,7 @@ AslCommonError ( { /* Check if user wants to ignore this exception */ - if (AslIsExceptionIgnored (Level, MessageId)) + if (AslIsExceptionIgnored (Filename, LogicalLineNumber, Level, MessageId)) { return; } @@ -1087,6 +1090,8 @@ GetModifiedLevel ( BOOLEAN AslIsExceptionIgnored ( + char *Filename, + UINT32 LineNumber, UINT8 Level, UINT16 MessageId) { @@ -1096,7 +1101,8 @@ AslIsExceptionIgnored ( /* Note: this allows exception to be disabled and expected */ ExceptionIgnored = AslIsExceptionDisabled (Level, MessageId); - ExceptionIgnored |= AslIsExceptionExpected (Level, MessageId); + ExceptionIgnored |= + AslIsExceptionExpected (Filename, LineNumber, Level, MessageId); return (AslGbl_AllExceptionsDisabled || ExceptionIgnored); } @@ -1104,7 +1110,7 @@ AslIsExceptionIgnored ( /******************************************************************************* * - * FUNCTION: AslCheckExpectException + * FUNCTION: AslCheckExpectedException * * PARAMETERS: none * @@ -1120,6 +1126,8 @@ AslCheckExpectedExceptions ( void) { UINT8 i; + ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList; + ASL_LOCATION_NODE *LocationNode; for (i = 0; i < AslGbl_ExpectedMessagesIndex; ++i) @@ -1130,12 +1138,32 @@ AslCheckExpectedExceptions ( AslGbl_ExpectedMessages[i].MessageIdStr); } } + + while (Current) + { + LocationNode = Current->LocationList; + + while (LocationNode) + { + if (!LocationNode->MessageReceived) + { + AslCommonError (ASL_ERROR, ASL_MSG_EXCEPTION_NOT_RECEIVED, + LocationNode->LineNumber, LocationNode->LineNumber, + LocationNode->LogicalByteOffset, LocationNode->Column, + LocationNode->Filename, Current->MessageIdStr); + } + + LocationNode = LocationNode->Next; + } + + Current = Current->Next; + } } /******************************************************************************* * - * FUNCTION: AslExpectException + * FUNCTION: AslLogExpectedException * * PARAMETERS: MessageIdString - ID of excepted exception during compile * @@ -1148,7 +1176,7 @@ AslCheckExpectedExceptions ( ******************************************************************************/ ACPI_STATUS -AslExpectException ( +AslLogExpectedException ( char *MessageIdString) { UINT32 MessageId; @@ -1182,6 +1210,61 @@ AslExpectException ( } +/******************************************************************************* + * + * FUNCTION: AslLogExpectedExceptionByLine + * + * PARAMETERS: MessageIdString - ID of excepted exception during compile + * + * RETURN: Status + * + * DESCRIPTION: Enter a message ID into the global expected messages table + * based on file and line number. If these messages are not raised + * during the compilation, throw an error. + * + ******************************************************************************/ + +void +AslLogExpectedExceptionByLine ( + char *MessageIdString) +{ + ASL_LOCATION_NODE *NewErrorLocationNode; + ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList; + UINT32 MessageId; + + + NewErrorLocationNode = UtLocalCalloc (sizeof (ASL_LOCATION_NODE)); + + NewErrorLocationNode->LineNumber = AslGbl_CurrentLineNumber; + NewErrorLocationNode->Filename = AslGbl_Files[ASL_FILE_INPUT].Filename; + NewErrorLocationNode->LogicalByteOffset = AslGbl_CurrentLineOffset; + NewErrorLocationNode->Column = AslGbl_CurrentColumn; + + MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); + + /* search the existing list for a matching message ID */ + + while (Current && Current->MessageId != MessageId ) + { + Current = Current->Next; + } + if (!Current) + { + /* ID was not found, create a new node for this message ID */ + + Current = UtLocalCalloc (sizeof (ASL_EXPECTED_MSG_NODE)); + + Current->Next = AslGbl_ExpectedErrorCodeList; + Current->MessageIdStr = MessageIdString; + Current->MessageId = MessageId; + AslGbl_ExpectedErrorCodeList = Current; + } + + NewErrorLocationNode->Next = Current->LocationList; + Current->LocationList = NewErrorLocationNode; +} + + /******************************************************************************* * * FUNCTION: AslDisableException @@ -1272,6 +1355,7 @@ AslElevateException ( return (AE_OK); } + /******************************************************************************* * * FUNCTION: AslIsExceptionDisabled @@ -1288,9 +1372,13 @@ AslElevateException ( static BOOLEAN AslIsExceptionExpected ( + char *Filename, + UINT32 LineNumber, UINT8 Level, UINT16 MessageId) { + ASL_EXPECTED_MSG_NODE *Current = AslGbl_ExpectedErrorCodeList; + ASL_LOCATION_NODE *CurrentErrorLocation; UINT32 EncodedMessageId; UINT32 i; @@ -1308,6 +1396,28 @@ AslIsExceptionExpected ( } } + while (Current && Current->MessageId != EncodedMessageId) + { + Current = Current->Next; + } + if (!Current) + { + return (FALSE); + } + + CurrentErrorLocation = Current->LocationList; + + while (CurrentErrorLocation) + { + if (!strcmp (CurrentErrorLocation->Filename, Filename) && + CurrentErrorLocation->LineNumber == LineNumber) + { + return (CurrentErrorLocation->MessageReceived = TRUE); + } + + CurrentErrorLocation = CurrentErrorLocation->Next; + } + return (FALSE); } @@ -1410,7 +1520,8 @@ AslDualParseOpError ( /* Check if user wants to ignore this exception */ - if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp) + if (!MainOp || AslIsExceptionIgnored (MainOp->Asl.Filename, + MainOp->Asl.LogicalLineNumber, Level, MainMsgId)) { return; } diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index 1a66dea91952..231ed87677bd 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -420,6 +420,7 @@ ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableSignature, "NO ASL_EXTERN char ASL_INIT_GLOBAL (*AslGbl_TableId, "NO_ID"); ASL_EXTERN ASL_FILE_INFO ASL_INIT_GLOBAL (*AslGbl_Files, NULL); ASL_EXTERN ASL_GLOBAL_FILE_NODE ASL_INIT_GLOBAL (*AslGbl_FilesList, NULL); +ASL_EXTERN ASL_EXPECTED_MSG_NODE ASL_INIT_GLOBAL (*AslGbl_ExpectedErrorCodeList, NULL); /* Specific to the -q option */ diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index 0d26c641d92e..bd2fc97745ca 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -1018,6 +1018,74 @@ FinishNode: } +/******************************************************************************* + * + * FUNCTION: LdAnalyzeExternals + * + * PARAMETERS: Type1 + * Type2 + * + * RETURN: BOOLEAN + * + * DESCRIPTION: Match Type1 and Type2 with the assumption that one might be + * using external types and another might be using local types. + * This should be used to compare the types found in external + * declarations with types found in other external declarations or + * named object declaration. This should not be used to match two + * object type declarations. + * + ******************************************************************************/ + +static BOOLEAN +LdTypesMatchExternType ( + ACPI_OBJECT_TYPE Type1, + ACPI_OBJECT_TYPE Type2) +{ + BOOLEAN Type1IsLocal = Type1 > ACPI_TYPE_EXTERNAL_MAX; + BOOLEAN Type2IsLocal = Type2 > ACPI_TYPE_EXTERNAL_MAX; + ACPI_OBJECT_TYPE ExternalType; + ACPI_OBJECT_TYPE LocalType; + + + /* + * The inputs could represent types that are local to ACPICA or types that + * are known externally. Some local types, such as the OperationRegion + * field units, are defined with more granularity than ACPICA local types. + * + * Therefore, map the local types to the external types before matching. + */ + if (Type1IsLocal && !Type2IsLocal) + { + LocalType = Type1; + ExternalType = Type2; + } + else if (!Type1IsLocal && Type2IsLocal) + { + LocalType = Type2; + ExternalType = Type1; + } + else + { + return (Type1 == Type2); + } + + switch (LocalType) + { + case ACPI_TYPE_LOCAL_REGION_FIELD: + case ACPI_TYPE_LOCAL_BANK_FIELD: + case ACPI_TYPE_LOCAL_INDEX_FIELD: + + LocalType = ACPI_TYPE_FIELD_UNIT; + break; + + default: + break; + } + + return (LocalType == ExternalType); +} + + /******************************************************************************* * * FUNCTION: LdAnalyzeExternals @@ -1072,12 +1140,12 @@ LdAnalyzeExternals ( if ((ActualOpType != ACPI_TYPE_ANY) && (ActualExternalOpType != ACPI_TYPE_ANY) && - (ActualExternalOpType != ActualOpType)) + !LdTypesMatchExternType (ActualExternalOpType, ActualOpType)) { if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL && Node->Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) { - AslDualParseOpError (ASL_ERROR, + AslDualParseOpError (ASL_WARNING, ASL_MSG_DUPLICATE_EXTERN_MISMATCH, Op, NULL, ASL_MSG_DUPLICATE_EXTERN_FOUND_HERE, Node->Op, NULL); } @@ -1094,7 +1162,7 @@ LdAnalyzeExternals ( ExternalOp = Node->Op; ActualOp = Op; } - AslDualParseOpError (ASL_ERROR, + AslDualParseOpError (ASL_WARNING, ASL_MSG_DECLARATION_TYPE_MISMATCH, ExternalOp, NULL, ASL_MSG_TYPE_MISMATCH_FOUND_HERE, ActualOp, NULL); } @@ -1139,18 +1207,8 @@ LdAnalyzeExternals ( { /* Allow update of externals of unknown type. */ - if (AcpiNsOpensScope (ExternalOpType)) - { - Node->Type = (UINT8) ExternalOpType; - Status = AE_OK; - } - else - { - sprintf (AslGbl_MsgBuffer, "%s [%s]", Op->Asl.ExternalName, - AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, AslGbl_MsgBuffer); - Status = AE_ERROR; - } + Node->Type = (UINT8) ExternalOpType; + Status = AE_OK; } return (Status); diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index e3b3f8e744c2..4bf9465ba5b7 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -948,7 +948,7 @@ AslDoOptions ( return (-1); } - Status = AslExpectException (AcpiGbl_Optarg); + Status = AslLogExpectedException (AcpiGbl_Optarg); if (ACPI_FAILURE (Status)) { return (-1); diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h index cd54dbc05f78..33c547e4e5e8 100644 --- a/source/compiler/asltypes.h +++ b/source/compiler/asltypes.h @@ -381,12 +381,37 @@ typedef struct asl_error_msg typedef struct asl_expected_message { - UINT32 MessageId; - char *MessageIdStr; - BOOLEAN MessageReceived; + UINT32 MessageId; + char *MessageIdStr; + BOOLEAN MessageReceived; } ASL_EXPECTED_MESSAGE; +/* + * An entry in the line-based expected messages list + * + * TBD: might be possible to merge this with ASL_EXPECTED_MESSAGE + */ +typedef struct asl_expected_msg_node +{ + struct asl_expected_msg_node *Next; + UINT32 MessageId; + char *MessageIdStr; + struct asl_location_node *LocationList; + +} ASL_EXPECTED_MSG_NODE; + +typedef struct asl_location_node +{ + struct asl_location_node *Next; + char *Filename; + UINT32 LineNumber; + UINT32 Column; + UINT32 LogicalByteOffset; + BOOLEAN MessageReceived; + +} ASL_LOCATION_NODE; + /* An entry in the listing file stack (for include files) */ diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 9d9008a851c5..18de92ff648c 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -461,7 +461,6 @@ DtCreateTableUnit ( /* dtparser - lex/yacc files */ -UINT64 DtCompilerParserResult; /* Expression return value */ int DtCompilerParserparse ( void); diff --git a/source/compiler/dtcompilerparser.l b/source/compiler/dtcompilerparser.l index 28dcf6af84bf..ecc07c4847ed 100644 --- a/source/compiler/dtcompilerparser.l +++ b/source/compiler/dtcompilerparser.l @@ -153,7 +153,6 @@ #include "aslcompiler.h" #include "dtcompilerparser.y.h" -YYSTYPE DtCompilerlval; #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("dtcompilerscanner") diff --git a/source/compiler/dtcompilerparser.y b/source/compiler/dtcompilerparser.y index 43eba4e9c8f6..e97e2a90e1d7 100644 --- a/source/compiler/dtcompilerparser.y +++ b/source/compiler/dtcompilerparser.y @@ -170,7 +170,6 @@ extern char *DtCompilerParsertext; extern DT_FIELD *AslGbl_CurrentField; extern int DtLabelByteOffset; -extern UINT64 DtCompilerParserResult; /* Expression return value */ extern UINT64 DtCompilerParserlineno; /* Current line number */ extern UINT32 DtTokenFirstLine; diff --git a/source/compiler/dtparser.l b/source/compiler/dtparser.l index ff7df507fa4e..631921df8d2c 100644 --- a/source/compiler/dtparser.l +++ b/source/compiler/dtparser.l @@ -208,7 +208,7 @@ NewLine [\n] /* * Local support functions */ -YY_BUFFER_STATE LexBuffer; +static YY_BUFFER_STATE LexBuffer; /****************************************************************************** * diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index c7256b77a35b..33df4dc2c982 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -1967,11 +1967,16 @@ DtCompileIvrs ( switch (IvrsHeader->Type) { - case ACPI_IVRS_TYPE_HARDWARE: + case ACPI_IVRS_TYPE_HARDWARE1: InfoTable = AcpiDmTableInfoIvrs0; break; + case ACPI_IVRS_TYPE_HARDWARE2: + + InfoTable = AcpiDmTableInfoIvrs01; + break; + case ACPI_IVRS_TYPE_MEMORY1: case ACPI_IVRS_TYPE_MEMORY2: case ACPI_IVRS_TYPE_MEMORY3: @@ -1994,7 +1999,8 @@ DtCompileIvrs ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE) + if (IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE1 || + IvrsHeader->Type == ACPI_IVRS_TYPE_HARDWARE2) { while (*PFieldList && !strcmp ((*PFieldList)->Name, "Entry Type")) diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 067d0ece2c1b..bb07894e2813 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -189,7 +189,8 @@ DtError ( /* Check if user wants to ignore this exception */ - if (AslIsExceptionIgnored (Level, MessageId)) + if (AslIsExceptionIgnored (AslGbl_Files[ASL_FILE_INPUT].Filename, + FieldObject->Line, Level, MessageId)) { return; } diff --git a/source/compiler/prparser.l b/source/compiler/prparser.l index 65595fa81f4e..8752d3fcf59a 100644 --- a/source/compiler/prparser.l +++ b/source/compiler/prparser.l @@ -224,7 +224,7 @@ Identifier [a-zA-Z][0-9a-zA-Z]* /* * Local support functions */ -YY_BUFFER_STATE LexBuffer; +static YY_BUFFER_STATE LexBuffer; /****************************************************************************** diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c index 0bfe994745b4..378e3db1a165 100644 --- a/source/components/debugger/dbinput.c +++ b/source/components/debugger/dbinput.c @@ -637,19 +637,16 @@ AcpiDbGetNextToken ( return (NULL); } - /* Remove any spaces at the beginning */ + /* Remove any spaces at the beginning, ignore blank lines */ - if (*String == ' ') + while (*String && isspace (*String)) { - while (*String && (*String == ' ')) - { - String++; - } + String++; + } - if (!(*String)) - { - return (NULL); - } + if (!(*String)) + { + return (NULL); } switch (*String) @@ -754,7 +751,7 @@ AcpiDbGetNextToken ( /* Find end of token */ - while (*String && (*String != ' ')) + while (*String && !isspace (*String)) { String++; } diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index e7d354d8d966..f84db8c9e9a9 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -594,6 +594,7 @@ AcpiInitializeDebugger ( AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT; AcpiGbl_DbOpt_NoIniMethods = FALSE; + AcpiGbl_DbOpt_NoRegionSupport = FALSE; AcpiGbl_DbBuffer = AcpiOsAllocate (ACPI_DEBUG_BUFFER_SIZE); if (!AcpiGbl_DbBuffer) diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index f2925ecff00d..3fa7b95bba8e 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -158,7 +158,9 @@ #include "acinterp.h" #include "acnamesp.h" #include "acdebug.h" - +#ifdef ACPI_EXEC_APP +#include "aecommon.h" +#endif #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dswexec") @@ -504,7 +506,10 @@ AcpiDsExecEndOp ( UINT32 OpClass; ACPI_PARSE_OBJECT *NextOp; ACPI_PARSE_OBJECT *FirstArg; - +#ifdef ACPI_EXEC_APP + char *Namepath; + ACPI_OPERAND_OBJECT *ObjDesc; +#endif ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState); @@ -717,6 +722,29 @@ AcpiDsExecEndOp ( } Status = AcpiDsEvalBufferFieldOperands (WalkState, Op); + if (ACPI_FAILURE (Status)) + { + break; + } + +#ifdef ACPI_EXEC_APP + /* + * AcpiExec support for namespace initialization file (initialize + * BufferFields in this code.) + */ + Namepath = AcpiNsGetExternalPathname (Op->Common.Node); + Status = AeLookupInitFileEntry (Namepath, &ObjDesc); + if (ACPI_SUCCESS (Status)) + { + Status = AcpiExWriteDataToField (ObjDesc, Op->Common.Node->Object, NULL); + if ACPI_FAILURE (Status) + { + ACPI_EXCEPTION ((AE_INFO, Status, "While writing to buffer field")); + } + } + ACPI_FREE (Namepath); + Status = AE_OK; +#endif break; diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index d37bd5d4cc7f..62a4fdca417b 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -156,7 +156,6 @@ #include "acdispat.h" #include "acinterp.h" #include "acnamesp.h" - #ifdef ACPI_ASL_COMPILER #include "acdisasm.h" #endif @@ -555,7 +554,6 @@ AcpiDsLoad1EndOp ( ACPI_PARSE_OBJECT *Op; ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status = AE_OK; - #ifdef ACPI_ASL_COMPILER UINT8 ParamCount; #endif diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index ff2135ce62c4..0ab715cd139b 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -157,6 +157,9 @@ #include "acinterp.h" #include "acnamesp.h" #include "acevents.h" +#ifdef ACPI_EXEC_APP +#include "aecommon.h" +#endif #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dswload2") @@ -531,6 +534,10 @@ AcpiDsLoad2EndOp ( ACPI_NAMESPACE_NODE *NewNode; UINT32 i; UINT8 RegionSpace; +#ifdef ACPI_EXEC_APP + ACPI_OPERAND_OBJECT *ObjDesc; + char *Namepath; +#endif ACPI_FUNCTION_TRACE (DsLoad2EndOp); @@ -627,6 +634,11 @@ AcpiDsLoad2EndOp ( * be evaluated later during the execution phase */ Status = AcpiDsCreateBufferField (Op, WalkState); + if ACPI_FAILURE (Status) + { + ACPI_EXCEPTION ((AE_INFO, Status, "CreateBufferField failure")); + goto Cleanup; + } break; case AML_TYPE_NAMED_FIELD: @@ -766,6 +778,31 @@ AcpiDsLoad2EndOp ( case AML_NAME_OP: Status = AcpiDsCreateNode (WalkState, Node, Op); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + +#ifdef ACPI_EXEC_APP + /* + * AcpiExec support for namespace initialization file (initialize + * Name opcodes in this code.) + */ + Namepath = AcpiNsGetExternalPathname (Node); + Status = AeLookupInitFileEntry (Namepath, &ObjDesc); + if (ACPI_SUCCESS (Status)) + { + /* Detach any existing object, attach new object */ + + if (Node->Object) + { + AcpiNsDetachObject (Node); + } + AcpiNsAttachObject (Node, ObjDesc, ObjDesc->Common.Type); + } + ACPI_FREE (Namepath); + Status = AE_OK; +#endif break; case AML_METHOD_OP: diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c index 016f62be3aa0..d503f1cf923b 100644 --- a/source/components/hardware/hwsleep.c +++ b/source/components/hardware/hwsleep.c @@ -466,11 +466,11 @@ AcpiHwLegacyWake ( /* Enable sleep button */ - (void) AcpiWriteBitRegister ( + (void) AcpiWriteBitRegister ( AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].EnableRegisterId, ACPI_ENABLE_EVENT); - (void) AcpiWriteBitRegister ( + (void) AcpiWriteBitRegister ( AcpiGbl_FixedEventInfo[ACPI_EVENT_SLEEP_BUTTON].StatusRegisterId, ACPI_CLEAR_STATUS); diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index a9509195c89a..a27a87f02b07 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -158,12 +158,6 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsnames") -/* Local Prototypes */ - -static void -AcpiNsNormalizePathname ( - char *OriginalPath); - /******************************************************************************* * @@ -616,7 +610,7 @@ Cleanup: * ******************************************************************************/ -static void +void AcpiNsNormalizePathname ( char *OriginalPath) { diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index aec3296904a3..01b1823e2d50 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -224,7 +224,7 @@ const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] = "IPMI", /* 0x07 */ "GeneralPurposeIo", /* 0x08 */ "GenericSerialBus", /* 0x09 */ - "PlatformCommChannel"/* 0x0A */ + "PCC" /* 0x0A */ }; diff --git a/source/components/utilities/utdelete.c b/source/components/utilities/utdelete.c index 2f60917bdf99..502ff4132116 100644 --- a/source/components/utilities/utdelete.c +++ b/source/components/utilities/utdelete.c @@ -626,13 +626,13 @@ AcpiUtUpdateRefCount ( * * FUNCTION: AcpiUtUpdateObjectReference * - * PARAMETERS: Object - Increment ref count for this object - * and all sub-objects + * PARAMETERS: Object - Increment or decrement the ref count for + * this object and all sub-objects * Action - Either REF_INCREMENT or REF_DECREMENT * * RETURN: Status * - * DESCRIPTION: Increment the object reference count + * DESCRIPTION: Increment or decrement the object reference count * * Object references are incremented when: * 1) An object is attached to a Node (namespace object) @@ -671,7 +671,7 @@ AcpiUtUpdateObjectReference ( } /* - * All sub-objects must have their reference count incremented + * All sub-objects must have their reference count updated * also. Different object types have different subobjects. */ switch (Object->Common.Type) @@ -740,6 +740,7 @@ AcpiUtUpdateObjectReference ( break; } } + NextObject = NULL; break; diff --git a/source/components/utilities/utprint.c b/source/components/utilities/utprint.c index f97a04d80da7..187fd58a556c 100644 --- a/source/components/utilities/utprint.c +++ b/source/components/utilities/utprint.c @@ -560,7 +560,13 @@ vsnprintf ( Pos = String; - End = String + Size; + + + if (Size != ACPI_UINT32_MAX) { + End = String + Size; + } else { + End = ACPI_CAST_PTR(char, ACPI_UINT32_MAX); + } for (; *Format; ++Format) { diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 960af4b03dd2..d0ffe3900592 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -457,6 +457,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortMap[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIortPad[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs01[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[]; diff --git a/source/include/acnamesp.h b/source/include/acnamesp.h index 3dd605a0fdac..48b365936422 100644 --- a/source/include/acnamesp.h +++ b/source/include/acnamesp.h @@ -487,6 +487,10 @@ AcpiNsBuildNormalizedPath ( UINT32 PathSize, BOOLEAN NoTrailing); +void +AcpiNsNormalizePathname ( + char *OriginalPath); + char * AcpiNsGetNormalizedPathname ( ACPI_NAMESPACE_NODE *Node, diff --git a/source/include/acpixf.h b/source/include/acpixf.h index a39d180e9494..eeb63cd5c80c 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20200214 +#define ACPI_CA_VERSION 0x20200326 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h index 74da8baca272..59c38a29e16a 100644 --- a/source/include/actbinfo.h +++ b/source/include/actbinfo.h @@ -264,7 +264,8 @@ #define ACPI_IORTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NODE,f) #define ACPI_IORTM_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ID_MAPPING,f) #define ACPI_IVRSH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HEADER,f) -#define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) +#define ACPI_IVRS0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE1,f) +#define ACPI_IVRS01_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_HARDWARE2,f) #define ACPI_IVRS1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) #define ACPI_IVRSD_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) #define ACPI_IVRS8A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) diff --git a/source/include/actbl2.h b/source/include/actbl2.h index fe17576b5ac6..2f1dd2990a15 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -187,6 +187,7 @@ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SDEI "SDEI" /* Software Delegated Exception Interface Table */ #define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ +#define ACPI_SIG_NHLT "NHLT" /* Non-HDAudio Link Table */ /* @@ -457,7 +458,8 @@ typedef struct acpi_ivrs_header enum AcpiIvrsType { - ACPI_IVRS_TYPE_HARDWARE = 0x10, + ACPI_IVRS_TYPE_HARDWARE1 = 0x10, + ACPI_IVRS_TYPE_HARDWARE2 = 0x11, ACPI_IVRS_TYPE_MEMORY1 = 0x20, ACPI_IVRS_TYPE_MEMORY2 = 0x21, ACPI_IVRS_TYPE_MEMORY3 = 0x22 @@ -485,16 +487,30 @@ enum AcpiIvrsType /* 0x10: I/O Virtualization Hardware Definition Block (IVHD) */ -typedef struct acpi_ivrs_hardware +typedef struct acpi_ivrs_hardware_10 { ACPI_IVRS_HEADER Header; UINT16 CapabilityOffset; /* Offset for IOMMU control fields */ UINT64 BaseAddress; /* IOMMU control registers */ UINT16 PciSegmentGroup; UINT16 Info; /* MSI number and unit ID */ - UINT32 Reserved; + UINT32 FeatureReporting; -} ACPI_IVRS_HARDWARE; +} ACPI_IVRS_HARDWARE1; + +/* 0x11: I/O Virtualization Hardware Definition Block (IVHD) */ + +typedef struct acpi_ivrs_hardware_11 +{ + ACPI_IVRS_HEADER Header; + UINT16 CapabilityOffset; /* Offset for IOMMU control fields */ + UINT64 BaseAddress; /* IOMMU control registers */ + UINT16 PciSegmentGroup; + UINT16 Info; /* MSI number and unit ID */ + UINT32 Attributes; + UINT64 EfrRegisterImage; + UINT64 Reserved; +} ACPI_IVRS_HARDWARE2; /* Masks for Info field above */ diff --git a/source/include/actbl3.h b/source/include/actbl3.h index cfae7c42dbd0..74d4648a84d2 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -183,7 +183,7 @@ #define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ #define ACPI_SIG_WPBT "WPBT" /* Windows Platform Binary Table */ -#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Migrations Table */ +#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Mitigations Table */ #define ACPI_SIG_XENV "XENV" /* Xen Environment table */ #define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */ @@ -904,10 +904,10 @@ typedef struct acpi_table_wpbt /******************************************************************************* * - * WSMT - Windows SMM Security Migrations Table + * WSMT - Windows SMM Security Mitigations Table * Version 1 * - * Conforms to "Windows SMM Security Migrations Table", + * Conforms to "Windows SMM Security Mitigations Table", * Version 1.0, April 18, 2016 * ******************************************************************************/ diff --git a/source/include/acuuid.h b/source/include/acuuid.h index bcbf6b1d9f01..b856219c605a 100644 --- a/source/include/acuuid.h +++ b/source/include/acuuid.h @@ -200,4 +200,4 @@ #define UUID_DEVICE_PROPERTIES "daffd814-6eba-4d8c-8a91-bc9bbf4aa301" -#endif /* __AUUID_H__ */ +#endif /* __ACUUID_H__ */ diff --git a/source/os_specific/service_layers/oswintbl.c b/source/os_specific/service_layers/oswintbl.c index 5a32c122c704..fcbe48a800bf 100644 --- a/source/os_specific/service_layers/oswintbl.c +++ b/source/os_specific/service_layers/oswintbl.c @@ -419,184 +419,184 @@ OslTableInitialize ( static ACPI_STATUS WindowsGetTableFromRegistry ( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address) + char *Signature, + UINT32 Instance, + ACPI_TABLE_HEADER **Table, + ACPI_PHYSICAL_ADDRESS *Address) { - HKEY Handle = NULL; - LONG WinStatus; - ULONG Type; - ULONG NameSize; - ULONG DataSize; - HKEY SubKey; - ULONG i; - ACPI_TABLE_HEADER *ReturnTable; - ACPI_STATUS Status = AE_OK; + HKEY Handle = NULL; + LONG WinStatus; + ULONG Type; + ULONG NameSize; + ULONG DataSize; + HKEY SubKey; + ULONG i; + ACPI_TABLE_HEADER *ReturnTable; + ACPI_STATUS Status = AE_OK; - /* Get a handle to the table key */ + /* Get a handle to the table key */ - while (1) - { - strcpy(KeyBuffer, "HARDWARE\\ACPI\\"); - if (AcpiUtSafeStrcat(KeyBuffer, sizeof(KeyBuffer), Signature)) - { - return (AE_BUFFER_OVERFLOW); - } + while (1) + { + strcpy(KeyBuffer, "HARDWARE\\ACPI\\"); + if (AcpiUtSafeStrcat(KeyBuffer, sizeof(KeyBuffer), Signature)) + { + return (AE_BUFFER_OVERFLOW); + } - /* - * Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT, - * SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same - * OEM ID, Table ID and Revision, then the 29th entry will overwrite the - * first entry... Let's hope that we do not have that many entries. - */ - if (Instance > 0 && ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT)) - { - if (Instance < 10) - { - KeyBuffer[strlen(KeyBuffer) - 1] = '0' + (char)Instance; - } - else if (Instance < 29) - { - KeyBuffer[strlen(KeyBuffer) - 1] = 'A' + (char)(Instance - 10); - } - else - { - return (AE_LIMIT); - } - } + /* + * Windows stores SSDT at SSDT, SSD1, ..., SSD9, SSDA, ..., SSDS, SSDT, + * SSDU, ..., SSDY. If the first (0th) and the 29th tables have the same + * OEM ID, Table ID and Revision, then the 29th entry will overwrite the + * first entry... Let's hope that we do not have that many entries. + */ + if (Instance > 0 && ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT)) + { + if (Instance < 10) + { + KeyBuffer[strlen(KeyBuffer) - 1] = '0' + (char)Instance; + } + else if (Instance < 29) + { + KeyBuffer[strlen(KeyBuffer) - 1] = 'A' + (char)(Instance - 10); + } + else + { + return (AE_LIMIT); + } + } - WinStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyBuffer, - 0L, KEY_READ, &Handle); + WinStatus = RegOpenKeyEx(HKEY_LOCAL_MACHINE, KeyBuffer, + 0L, KEY_READ, &Handle); - if (WinStatus != ERROR_SUCCESS) - { - /* - * Somewhere along the way, MS changed the registry entry for - * the FADT from - * HARDWARE/ACPI/FACP to - * HARDWARE/ACPI/FADT. - * - * This code allows for both. - */ - if (ACPI_COMPARE_NAMESEG(Signature, "FACP")) - { - Signature = "FADT"; - } - else if (ACPI_COMPARE_NAMESEG(Signature, "XSDT")) - { - Signature = "RSDT"; - } - else if (ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT)) - { - /* + if (WinStatus != ERROR_SUCCESS) + { + /* + * Somewhere along the way, MS changed the registry entry for + * the FADT from + * HARDWARE/ACPI/FACP to + * HARDWARE/ACPI/FADT. + * + * This code allows for both. + */ + if (ACPI_COMPARE_NAMESEG(Signature, "FACP")) + { + Signature = "FADT"; + } + else if (ACPI_COMPARE_NAMESEG(Signature, "XSDT")) + { + Signature = "RSDT"; + } + else if (ACPI_COMPARE_NAMESEG(Signature, ACPI_SIG_SSDT)) + { + /* * SSDT may not be present on older Windows versions, but it is - * also possible that the index is not found. + * also possible that the index is not found. */ - return (AE_NOT_FOUND); - } - else - { - fprintf(stderr, - "Could not find %s in registry at %s: %s (WinStatus=0x%X)\n", - Signature, KeyBuffer, WindowsFormatException(WinStatus), WinStatus); - return (AE_NOT_FOUND); - } - } - else - { - break; - } - } + return (AE_NOT_FOUND); + } + else + { + fprintf(stderr, + "Could not find %s in registry at %s: %s (WinStatus=0x%X)\n", + Signature, KeyBuffer, WindowsFormatException(WinStatus), WinStatus); + return (AE_NOT_FOUND); + } + } + else + { + break; + } + } - /* Actual data for the table is down a couple levels */ + /* Actual data for the table is down a couple levels */ - for (i = 0; ;) - { - WinStatus = RegEnumKey(Handle, i, KeyBuffer, sizeof(KeyBuffer)); - i++; - if (WinStatus == ERROR_NO_MORE_ITEMS) - { - break; - } + for (i = 0; ;) + { + WinStatus = RegEnumKey(Handle, i, KeyBuffer, sizeof(KeyBuffer)); + i++; + if (WinStatus == ERROR_NO_MORE_ITEMS) + { + break; + } - WinStatus = RegOpenKey(Handle, KeyBuffer, &SubKey); - if (WinStatus != ERROR_SUCCESS) - { - fprintf(stderr, "Could not open %s entry: %s\n", - Signature, WindowsFormatException(WinStatus)); - Status = AE_ERROR; - goto Cleanup; - } + WinStatus = RegOpenKey(Handle, KeyBuffer, &SubKey); + if (WinStatus != ERROR_SUCCESS) + { + fprintf(stderr, "Could not open %s entry: %s\n", + Signature, WindowsFormatException(WinStatus)); + Status = AE_ERROR; + goto Cleanup; + } - RegCloseKey(Handle); - Handle = SubKey; - i = 0; - } + RegCloseKey(Handle); + Handle = SubKey; + i = 0; + } - /* Find the (binary) table entry */ + /* Find the (binary) table entry */ - for (i = 0; ; i++) - { - NameSize = sizeof(KeyBuffer); - WinStatus = RegEnumValue(Handle, i, KeyBuffer, &NameSize, NULL, - &Type, NULL, 0); - if (WinStatus != ERROR_SUCCESS) - { - fprintf(stderr, "Could not get %s registry entry: %s\n", - Signature, WindowsFormatException(WinStatus)); - Status = AE_ERROR; - goto Cleanup; - } + for (i = 0; ; i++) + { + NameSize = sizeof(KeyBuffer); + WinStatus = RegEnumValue(Handle, i, KeyBuffer, &NameSize, NULL, + &Type, NULL, 0); + if (WinStatus != ERROR_SUCCESS) + { + fprintf(stderr, "Could not get %s registry entry: %s\n", + Signature, WindowsFormatException(WinStatus)); + Status = AE_ERROR; + goto Cleanup; + } - if (Type == REG_BINARY) - { - break; - } - } + if (Type == REG_BINARY) + { + break; + } + } - /* Get the size of the table */ + /* Get the size of the table */ - WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL, - NULL, &DataSize); - if (WinStatus != ERROR_SUCCESS) - { - fprintf(stderr, "Could not read the %s table size: %s\n", - Signature, WindowsFormatException(WinStatus)); - Status = AE_ERROR; - goto Cleanup; - } + WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL, + NULL, &DataSize); + if (WinStatus != ERROR_SUCCESS) + { + fprintf(stderr, "Could not read the %s table size: %s\n", + Signature, WindowsFormatException(WinStatus)); + Status = AE_ERROR; + goto Cleanup; + } - /* Allocate a new buffer for the table */ + /* Allocate a new buffer for the table */ - ReturnTable = malloc(DataSize); - if (!ReturnTable) - { - Status = AE_NO_MEMORY; - goto Cleanup; - } + ReturnTable = malloc(DataSize); + if (!ReturnTable) + { + Status = AE_NO_MEMORY; + goto Cleanup; + } - /* Get the actual table from the registry */ + /* Get the actual table from the registry */ - WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL, - (UCHAR *)ReturnTable, &DataSize); + WinStatus = RegQueryValueEx(Handle, KeyBuffer, NULL, NULL, + (UCHAR *)ReturnTable, &DataSize); - if (WinStatus != ERROR_SUCCESS) - { - fprintf(stderr, "Could not read %s data: %s\n", - Signature, WindowsFormatException(WinStatus)); - free(ReturnTable); - Status = AE_ERROR; - goto Cleanup; - } + if (WinStatus != ERROR_SUCCESS) + { + fprintf(stderr, "Could not read %s data: %s\n", + Signature, WindowsFormatException(WinStatus)); + free(ReturnTable); + Status = AE_ERROR; + goto Cleanup; + } - *Table = ReturnTable; - *Address = 0; + *Table = ReturnTable; + *Address = 0; Cleanup: - RegCloseKey(Handle); - return (Status); + RegCloseKey(Handle); + return (Status); } @@ -626,59 +626,59 @@ Cleanup: ACPI_STATUS AcpiOsGetTableByName( - char *Signature, - UINT32 Instance, - ACPI_TABLE_HEADER **Table, - ACPI_PHYSICAL_ADDRESS *Address) + char *Signature, + UINT32 Instance, + ACPI_TABLE_HEADER **Table, + ACPI_PHYSICAL_ADDRESS *Address) { - LONG Result; - ACPI_STATUS Status = AE_OK; - UINT32 DataSize; - ACPI_TABLE_HEADER *ReturnTable; - UINT32 UIntSignature = 0; + LONG Result; + ACPI_STATUS Status = AE_OK; + UINT32 DataSize; + ACPI_TABLE_HEADER *ReturnTable; + UINT32 UIntSignature = 0; /* Multiple instances are only supported for SSDT tables. */ - if (Instance > 0 && !ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) - { - return (AE_LIMIT); - } + if (Instance > 0 && !ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) + { + return (AE_LIMIT); + } - if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) - { - Status = WindowsGetTableFromRegistry ("SSDT", Instance, Table, Address); - return (Status); - } + if (ACPI_COMPARE_NAMESEG (Signature, ACPI_SIG_SSDT)) + { + Status = WindowsGetTableFromRegistry ("SSDT", Instance, Table, Address); + return (Status); + } /* GetSystemFirmwareTable requires the table signature to be UINT32 */ UIntSignature = *ACPI_CAST_PTR (UINT32, Signature); - DataSize = GetSystemFirmwareTable('ACPI', UIntSignature, NULL, 0); - if (!DataSize) - { - fprintf(stderr, "The table signature %s does not exist.", Signature); - return (AE_ERROR); - } + DataSize = GetSystemFirmwareTable('ACPI', UIntSignature, NULL, 0); + if (!DataSize) + { + fprintf(stderr, "The table signature %s does not exist.", Signature); + return (AE_ERROR); + } - ReturnTable = malloc(DataSize); - if (!ReturnTable) - { - return (AE_NO_MEMORY); - } + ReturnTable = malloc(DataSize); + if (!ReturnTable) + { + return (AE_NO_MEMORY); + } - Result = GetSystemFirmwareTable('ACPI', UIntSignature, ReturnTable, DataSize); - if (Result > (LONG) DataSize) - { + Result = GetSystemFirmwareTable('ACPI', UIntSignature, ReturnTable, DataSize); + if (Result > (LONG) DataSize) + { /* Clean up */ - fprintf (stderr, "Could not read %s data\n", Signature); - free (ReturnTable); - return (AE_ERROR); - } + fprintf (stderr, "Could not read %s data\n", Signature); + free (ReturnTable); + return (AE_ERROR); + } *Table = ReturnTable; - return (Status); + return (Status); } diff --git a/source/tools/acpibin/abcompare.c b/source/tools/acpibin/abcompare.c index 7cef3624ff51..a314172d194f 100644 --- a/source/tools/acpibin/abcompare.c +++ b/source/tools/acpibin/abcompare.c @@ -619,7 +619,7 @@ AbGetFile ( { FILE *File; UINT32 Size; - char *Buffer = NULL; + char *DataBuffer = NULL; size_t Actual; @@ -643,8 +643,8 @@ AbGetFile ( /* Allocate a buffer for the entire file */ - Buffer = calloc (Size, 1); - if (!Buffer) + DataBuffer = calloc (Size, 1); + if (!DataBuffer) { printf ("Could not allocate buffer of size %u\n", Size); goto ErrorExit; @@ -652,12 +652,12 @@ AbGetFile ( /* Read the entire file */ - Actual = fread (Buffer, 1, Size, File); + Actual = fread (DataBuffer, 1, Size, File); if (Actual != Size) { printf ("Could not read the input file %s\n", Filename); - free (Buffer); - Buffer = NULL; + free (DataBuffer); + DataBuffer = NULL; goto ErrorExit; } @@ -665,7 +665,7 @@ AbGetFile ( ErrorExit: fclose (File); - return (Buffer); + return (DataBuffer); } diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index d9ade0b6016c..9dbb3fac1647 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -195,7 +195,9 @@ typedef struct ae_debug_regions typedef struct init_file_entry { char *Name; + char *Value; ACPI_OPERAND_OBJECT *ObjDesc; + BOOLEAN IsUsed; } INIT_FILE_ENTRY; @@ -346,19 +348,23 @@ int AeOpenInitializationFile ( char *Filename); -void +ACPI_STATUS AeProcessInitFile ( void); -ACPI_STATUS -AeSetupConfiguration ( - void *RegionAddr); - ACPI_STATUS AeLookupInitFileEntry ( char *Pathname, ACPI_OPERAND_OBJECT **ObjDesc); +void +AeDisplayUnusedInitFileItems ( + void); + +void +AeDeleteInitFileList ( + void); + /* aeexec */ void @@ -376,6 +382,10 @@ AeGetDevices ( void *Context, void **ReturnValue); +ACPI_STATUS +AeSetupConfiguration ( + void *RegionAddr); + ACPI_STATUS ExecuteOSI ( char *OsiString, diff --git a/source/tools/acpiexec/aeinitfile.c b/source/tools/acpiexec/aeinitfile.c index 0813c8739db4..ce758ed1b9fb 100644 --- a/source/tools/acpiexec/aeinitfile.c +++ b/source/tools/acpiexec/aeinitfile.c @@ -151,24 +151,17 @@ #include "aecommon.h" #include "acdispat.h" +#include "acnamesp.h" + #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aeinitfile") -/* Local prototypes */ - -static void -AeEnterInitFileEntry ( - INIT_FILE_ENTRY InitEntry, - ACPI_WALK_STATE *WalkState); - - #define AE_FILE_BUFFER_SIZE 512 static char LineBuffer[AE_FILE_BUFFER_SIZE]; static char NameBuffer[AE_FILE_BUFFER_SIZE]; -static char ValueBuffer[AE_FILE_BUFFER_SIZE]; static FILE *InitFile; @@ -211,23 +204,23 @@ AeOpenInitializationFile ( * RETURN: None * * DESCRIPTION: Read the initialization file and perform all namespace - * initializations. AcpiGbl_InitEntries will be used for region - * field initialization. + * initializations. AcpiGbl_InitEntries will be used for all + * object initialization. * * NOTE: The format of the file is multiple lines, each of format: - * + * * *****************************************************************************/ -void -AeProcessInitFile( +ACPI_STATUS +AeProcessInitFile ( void) { ACPI_WALK_STATE *WalkState; UINT64 idx; - ACPI_STATUS Status; + ACPI_STATUS Status = AE_OK; char *Token; - char *ObjectBuffer; + char *ValueBuffer; char *TempNameBuffer; ACPI_OBJECT_TYPE Type; ACPI_OBJECT TempObject; @@ -235,13 +228,14 @@ AeProcessInitFile( if (!InitFile) { - return; + return (AE_OK); } /* Create needed objects to be reused for each init entry */ WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL); NameBuffer[0] = '\\'; + NameBuffer[1] = 0; while (fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile) != NULL) { @@ -249,12 +243,20 @@ AeProcessInitFile( } rewind (InitFile); + /* + * Allocate and populate the Gbl_InitEntries array + */ AcpiGbl_InitEntries = - AcpiOsAllocate (sizeof (INIT_FILE_ENTRY) * AcpiGbl_InitFileLineCount); + AcpiOsAllocateZeroed (sizeof (INIT_FILE_ENTRY) * AcpiGbl_InitFileLineCount); for (idx = 0; fgets (LineBuffer, AE_FILE_BUFFER_SIZE, InitFile); ++idx) { - TempNameBuffer = AcpiDbGetNextToken (LineBuffer, &Token, &Type); + if (!TempNameBuffer) + { + AcpiGbl_InitEntries[idx].Name = NULL; + continue; + } + if (LineBuffer[0] == '\\') { strcpy (NameBuffer, TempNameBuffer); @@ -266,48 +268,67 @@ AeProcessInitFile( strcpy (NameBuffer + 1, TempNameBuffer); } + AcpiNsNormalizePathname (NameBuffer); AcpiGbl_InitEntries[idx].Name = AcpiOsAllocateZeroed (strnlen (NameBuffer, AE_FILE_BUFFER_SIZE) + 1); - strcpy (AcpiGbl_InitEntries[idx].Name, NameBuffer); - ObjectBuffer = AcpiDbGetNextToken (Token, &Token, &Type); + ValueBuffer = AcpiDbGetNextToken (Token, &Token, &Type); + if (!ValueBuffer) + { + AcpiGbl_InitEntries[idx].Value = NULL; + continue; + } + + AcpiGbl_InitEntries[idx].Value = + AcpiOsAllocateZeroed (strnlen (ValueBuffer, AE_FILE_BUFFER_SIZE) + 1); + strcpy (AcpiGbl_InitEntries[idx].Value, ValueBuffer); if (Type == ACPI_TYPE_FIELD_UNIT) { - Status = AcpiDbConvertToObject (ACPI_TYPE_BUFFER, ObjectBuffer, + Status = AcpiDbConvertToObject (ACPI_TYPE_BUFFER, ValueBuffer, &TempObject); } else { - Status = AcpiDbConvertToObject (Type, ObjectBuffer, &TempObject); + Status = AcpiDbConvertToObject (Type, ValueBuffer, &TempObject); + } + + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s[%s]: %s\n", NameBuffer, AcpiUtGetTypeName (Type), + AcpiFormatException (Status)); + goto CleanupAndExit; } Status = AcpiUtCopyEobjectToIobject (&TempObject, &AcpiGbl_InitEntries[idx].ObjDesc); - if (Type == ACPI_TYPE_BUFFER || Type == ACPI_TYPE_FIELD_UNIT) - { - ACPI_FREE (TempObject.Buffer.Pointer); - } + /* Cleanup the external object created by DbConvertToObject above */ - if (ACPI_FAILURE (Status)) + if (ACPI_SUCCESS (Status)) { - AcpiOsPrintf ("%s %s\n", ValueBuffer, + if (Type == ACPI_TYPE_BUFFER || Type == ACPI_TYPE_FIELD_UNIT) + { + ACPI_FREE (TempObject.Buffer.Pointer); + } + else if (Type == ACPI_TYPE_PACKAGE) + { + AcpiDbDeleteObjects (1, &TempObject); + } + } + else + { + AcpiOsPrintf ("%s[%s]: %s\n", NameBuffer, AcpiUtGetTypeName (Type), AcpiFormatException (Status)); goto CleanupAndExit; } /* - * Special case for field units. Field units are dependent on the - * parent region. This parent region has yet to be created so defer the - * initialization until the dispatcher. For all other types, initialize - * the namespace node with the value found in the init file. + * Initialize the namespace node with the value found in the init file. */ - if (Type != ACPI_TYPE_FIELD_UNIT) - { - AeEnterInitFileEntry (AcpiGbl_InitEntries[idx], WalkState); - } + AcpiOsPrintf ("Namespace object init from file: %16s, Value \"%s\", Type %s\n", + AcpiGbl_InitEntries[idx].Name, AcpiGbl_InitEntries[idx].Value, AcpiUtGetTypeName (Type)); } /* Cleanup */ @@ -315,62 +336,7 @@ AeProcessInitFile( CleanupAndExit: fclose (InitFile); AcpiDsDeleteWalkState (WalkState); -} - - -/****************************************************************************** - * - * FUNCTION: AeInitFileEntry - * - * PARAMETERS: InitEntry - Entry of the init file - * WalkState - Used for the Store operation - * - * RETURN: None - * - * DESCRIPTION: Perform initialization of a single namespace object - * - * Note: namespace of objects are limited to integers and region - * fields units of 8 bytes at this time. - * - *****************************************************************************/ - -static void -AeEnterInitFileEntry ( - INIT_FILE_ENTRY InitEntry, - ACPI_WALK_STATE *WalkState) -{ - char *Pathname = InitEntry.Name; - ACPI_OPERAND_OBJECT *ObjDesc = InitEntry.ObjDesc; - ACPI_NAMESPACE_NODE *NewNode; - ACPI_STATUS Status; - - - Status = AcpiNsLookup (NULL, Pathname, ObjDesc->Common.Type, - ACPI_IMODE_LOAD_PASS2, ACPI_NS_ERROR_IF_FOUND | ACPI_NS_NO_UPSEARCH | - ACPI_NS_EARLY_INIT, NULL, &NewNode); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While creating name from namespace initialization file: %s", - Pathname)); - return; - } - - /* Store pointer to value descriptor in the Node */ - - Status = AcpiNsAttachObject (NewNode, ObjDesc, - ObjDesc->Common.Type); - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "While attaching object to node from namespace initialization file: %s", - Pathname)); - return; - } - - /* Remove local reference to the object */ - - AcpiUtRemoveReference (ObjDesc); + return (Status); } @@ -379,9 +345,9 @@ AeEnterInitFileEntry ( * FUNCTION: AeLookupInitFileEntry * * PARAMETERS: Pathname - AML namepath in external format - * ValueString - value of the namepath if it exitst + * ObjDesc - Where the object is returned if it exists * - * RETURN: None + * RETURN: Status. AE_OK if a match was found * * DESCRIPTION: Search the init file for a particular name and its value. * @@ -394,18 +360,106 @@ AeLookupInitFileEntry ( { UINT32 i; + ACPI_FUNCTION_TRACE (AeLookupInitFileEntry); + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Lookup: %s\n", Pathname)); + if (!AcpiGbl_InitEntries) { - return AE_NOT_FOUND; + return (AE_NOT_FOUND); + } + + AcpiNsNormalizePathname (Pathname); + + for (i = 0; i < AcpiGbl_InitFileLineCount; ++i) + { + if (AcpiGbl_InitEntries[i].Name && + !strcmp (AcpiGbl_InitEntries[i].Name, Pathname)) + { + *ObjDesc = AcpiGbl_InitEntries[i].ObjDesc; + AcpiGbl_InitEntries[i].IsUsed = TRUE; + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Found match: %s, %p\n", Pathname, *ObjDesc)); + return_ACPI_STATUS (AE_OK); + } + } + + ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "No match found: %s\n", Pathname)); + return_ACPI_STATUS (AE_NOT_FOUND); +} + + +/****************************************************************************** + * + * FUNCTION: AeDisplayUnusedInitFileItems + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display all init file items that have not been referenced + * (i.e., items that have not been found in the namespace). + * + *****************************************************************************/ + +void +AeDisplayUnusedInitFileItems ( + void) +{ + UINT32 i; + + + if (!AcpiGbl_InitEntries) + { + return; } for (i = 0; i < AcpiGbl_InitFileLineCount; ++i) { - if (!strcmp(AcpiGbl_InitEntries[i].Name, Pathname)) + if (AcpiGbl_InitEntries[i].Name && + !AcpiGbl_InitEntries[i].IsUsed) { - *ObjDesc = AcpiGbl_InitEntries[i].ObjDesc; - return AE_OK; + AcpiOsPrintf ("Init file entry not found in namespace " + "(or is a non-data type): %s\n", + AcpiGbl_InitEntries[i].Name); } } - return AE_NOT_FOUND; +} + + +/****************************************************************************** + * + * FUNCTION: AeDeleteInitFileList + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Delete the global namespace initialization file data + * + *****************************************************************************/ + +void +AeDeleteInitFileList ( + void) +{ + UINT32 i; + + + if (!AcpiGbl_InitEntries) + { + return; + } + + for (i = 0; i < AcpiGbl_InitFileLineCount; ++i) + { + + if ((AcpiGbl_InitEntries[i].ObjDesc) && (AcpiGbl_InitEntries[i].Value)) + { + /* Remove one reference on the object (and all subobjects) */ + + AcpiUtRemoveReference (AcpiGbl_InitEntries[i].ObjDesc); + } + } + + AcpiOsFree (AcpiGbl_InitEntries); } diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index 78ef6aa10571..502684a473fc 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -192,7 +192,6 @@ BOOLEAN AcpiGbl_VerboseHandlers = FALSE; UINT8 AcpiGbl_RegionFillValue = 0; BOOLEAN AcpiGbl_IgnoreErrors = FALSE; BOOLEAN AcpiGbl_AbortLoopOnTimeout = FALSE; -BOOLEAN AcpiGbl_DbOpt_NoRegionSupport = FALSE; UINT8 AcpiGbl_UseHwReducedFadt = FALSE; BOOLEAN AcpiGbl_DoInterfaceTests = FALSE; BOOLEAN AcpiGbl_LoadTestTables = FALSE; @@ -675,8 +674,6 @@ main ( signal (SIGSEGV, AeSignalHandler); } - AeProcessInitFile(); - /* The remaining arguments are filenames for ACPI tables */ if (!argv[AcpiGbl_Optind]) @@ -734,7 +731,21 @@ main ( goto EnterDebugger; } + /* Read the entire namespace initialization file if requested */ + + Status = AeProcessInitFile(); + if (ACPI_FAILURE (Status)) + { + ExitCode = -1; + goto ErrorExit; + } + Status = AeLoadTables (); + if (ACPI_FAILURE (Status)) + { + ExitCode = -1; + goto ErrorExit; + } /* * Exit namespace initialization for the "load namespace only" option. @@ -795,6 +806,7 @@ main ( goto EnterDebugger; } + AeDisplayUnusedInitFileItems (); AeMiscellaneousTests (); @@ -841,7 +853,9 @@ NormalExit: ErrorExit: AeLateTest (); - AcpiOsFree (AcpiGbl_InitEntries); + + AeDeleteInitFileList (); + (void) AcpiTerminate (); AcDeleteTableList (ListHead); return (ExitCode); diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index d467bc057e44..f8fdd239a15e 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -611,15 +611,22 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"AE_DEBUG_REGIONS", SRC_TYPE_STRUCT}, {"AE_REGION", SRC_TYPE_STRUCT}, {"ASL_ANALYSIS_WALK_INFO", SRC_TYPE_STRUCT}, + {"ASL_CACHE_INFO", SRC_TYPE_STRUCT}, {"ASL_COMMENT_STATE", SRC_TYPE_STRUCT}, {"ASL_COMMENT_TYPES", SRC_TYPE_SIMPLE}, {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, - {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, {"ASL_EVENT_INFO", SRC_TYPE_STRUCT}, + {"ASL_EXPECTED_MESSAGE", SRC_TYPE_STRUCT}, + {"ASL_EXPECTED_MSG_NODE", SRC_TYPE_STRUCT}, + {"ASL_FILE_DESC", SRC_TYPE_STRUCT}, {"ASL_FILE_INFO", SRC_TYPE_STRUCT}, + {"ASL_FILE_NODE", SRC_TYPE_STRUCT}, {"ASL_FILE_STATUS", SRC_TYPE_STRUCT}, + {"ASL_FILE_TYPES", SRC_TYPE_STRUCT}, + {"ASL_GLOBAL_FILE_NODE", SRC_TYPE_STRUCT}, {"ASL_INCLUDE_DIR", SRC_TYPE_STRUCT}, {"ASL_LISTING_NODE", SRC_TYPE_STRUCT}, + {"ASL_LOCATION_NODE", SRC_TYPE_STRUCT}, {"ASL_MAPPING_ENTRY", SRC_TYPE_STRUCT}, {"ASL_METHOD_INFO", SRC_TYPE_STRUCT}, {"ASL_METHOD_LOCAL", SRC_TYPE_STRUCT}, diff --git a/source/tools/acpixtract/acpixtract.h b/source/tools/acpixtract/acpixtract.h index ad341946b51c..12b54f9de255 100644 --- a/source/tools/acpixtract/acpixtract.h +++ b/source/tools/acpixtract/acpixtract.h @@ -194,8 +194,8 @@ #define AX_LINE_BUFFER_SIZE 256 #define AX_MIN_BLOCK_HEADER_LENGTH 6 /* strlen ("DSDT @") */ #define AX_HEX_DATA_LENGTH 49 /* (3 * 16) + 1 for the colon delimiter */ -#define AX_IS_TABLE_BLOCK_HEADER (strlen (Gbl_LineBuffer) < AX_HEX_DATA_LENGTH) && \ - (strstr (Gbl_LineBuffer, " @ ")) +#define AX_IS_TABLE_BLOCK_HEADER (strlen (Gbl_LineBuffer) < AX_HEX_DATA_LENGTH && \ + strstr (Gbl_LineBuffer, " @ ")) typedef struct AxTableInfo