From 960614968e0da10b32875a57ea1e30cc9c85b5e0 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Fri, 13 Nov 2020 21:41:15 +0000 Subject: [PATCH] Import ACPICA 20201113. --- changes.txt | 97 ++++++++++++++++++++++++- generate/lint/std32.lnt | 2 +- generate/lint/std64.lnt | 2 +- generate/unix/acpihelp/Makefile | 4 +- source/common/ahuuids.c | 5 ++ source/compiler/aslbtypes.c | 2 +- source/compiler/aslcodegen.c | 2 +- source/compiler/aslmap.c | 2 +- source/compiler/aslmessages.c | 85 +++++++++++++++++++++- source/compiler/aslmessages.h | 7 +- source/compiler/aslnamesp.c | 35 +++++++-- source/compiler/aslopcodes.c | 6 ++ source/compiler/aslprimaries.y | 10 +-- source/compiler/aslrules.y | 4 + source/compiler/asltypes.y | 1 + source/components/events/evregion.c | 59 +++++++-------- source/components/namespace/nspredef.c | 9 ++- source/components/namespace/nsprepkg.c | 38 +++++----- source/components/namespace/nsrepair2.c | 39 ++++------ source/include/accommon.h | 2 +- source/include/acpixf.h | 2 +- source/include/acuuid.h | 5 ++ source/tools/acpihelp/acpihelp.h | 7 +- source/tools/acpihelp/ahdecode.c | 1 + source/tools/acpihelp/ahmain.c | 13 +++- 25 files changed, 335 insertions(+), 104 deletions(-) diff --git a/changes.txt b/changes.txt index 3c60c27d366b..e7cc572a0cc3 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,94 @@ ---------------------------------------- +13 November 2020. Summary of changes for version 20201113: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Interpreter: fixed a memory leak by using use existing buffer in _HID +repair. There was a memory leak that occurred when a _CID object is +defined as a package containing string objects. When _CID is checked for +any possible repairs, it calls a helper function to repair _HID (because +_CID basically contains multiple _HID entries). The _HID repair function +assumes that string objects are standalone objects that are not contained +inside of any packages. The _HID repair function replaced the string +object with a brand new object and attempted to delete the old object by +decrementing the reference count of the old object. Strings inside of +packages have a reference count of 2 so the _HID repair function leaves +this object in a dangling state and causes a memory leak. Instead of +allocating a brand new object and removing the old object, use the +existing object when repairing the _HID object. + +Added function trace macros to improve namespace debugging. The namespace +repair mechanism does not have function tracing macros. Add several trace +macros to improve debuggability. + +Handle "orphan" _REG methods for GPIO OpRegions. Before this change +AcpiEvExecuteRegMethods() had special handling to handle "orphan" (no +matching OpRegion declared) _REG methods for EC nodes. On Intel Cherry +Trail devices there are 2 possible ACPI OpRegions for accessing GPIOs. +The standard GeneralPurposeIo OpRegion and the Cherry Trail - specific +UserDefined 0x9X OpRegions. Having 2 different types of OpRegions leads +to potential issues with checks for OpRegion availability, or in other +words checks if _REG has been called for the OpRegion which the ACPI code +wants to use. Except for the "orphan" EC handling, ACPICA core does not +call _REG on an ACPI node which does not define an OpRegion matching the +type being registered; and the reference design DSDT, from which most +Cherry Trail DSDTs are derived, does not define GeneralPurposeIo, nor +UserDefined(0x93) OpRegions for the GPO2 (UID 3) device, because no pins +were assigned ACPI controlled functions in the reference design. Together +this leads to the perfect storm, at least on the Cherry Trail based +Medion Akayo E1239T. This design does use a GPO2 pin from its ACPI code +and has added the Cherry Trail specific UserDefined(0x93) opregion to its +GPO2 ACPI node to access this pin. But it uses a "has _REG been called" +availability check for the standard GeneralPurposeIo OpRegion. This +clearly is a bug in the DSDT, but this does work under Windows. This +issue leads to the intel vbtn driver reporting the device always being in +tablet-mode at boot, even if it is in laptop mode. Which in turn causes +userspace to ignore touchpad events. So in other words, this issue causes +the touchpad to not work at boot. This change fixes this by extending the +"orphan" _REG method handling to also apply to GPIO address-space +handlers. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: Added more info to namespace dump file (-ln option). In a separate +section of the dump file (after the main namespace dump), emit the full +pathname for each namespace node, its type, and the ASL filename and line +number where it is declared. + +AcpiHelp: Added an option to display/decode iASL exceptions. Option is: - +x [Hex Value] where "Hex Value" is the iASL exception code. If Hex Value +is omitted, all iASL exceptions are displayed. + +iASL: Use StringLiteral instead of StringData for some ASL macros. The +use of the stringData rule allows for some "string" oriented opcodes +(Such as ToString, ToHexString, etc.) None of which make sense with the +macros in question. This change modifies the StringData part of the rule +for these macros to a simple string literal - thus disallowing the use +of ToString, ToHexString, etc. +The following ASL operators (macros) are affected: +EisaId +Fprintf +Printf +ToUuid +Unicode +Note: The MS compiler requires the use of string literals for these +operators also. + +iASL: Added a remark for an unknown UUID: ASL_MSG_UUID_NOT_FOUND. Search +the list of "known" UUIDs for the input to the ToUUID macro. + +Added 5 new UUIDs to the known UUID table. All related to NVDIMM and the +NFIT table. + + +---------------------------------------- + 25 September 2020. Summary of changes for version 20200925: This release is available at https://acpica.org/downloads @@ -41,7 +129,7 @@ names: _SBT _SBW -AML Disassembler: Added a new command, "All ". This command will evaluate all objects in the current namespace whose NameString contains the input NameSeg as the last element of the NameString. Useful for debugging. @@ -55,6 +143,11 @@ with lengths that exceed the initializer list. iASL: added more detail to external resolution error message when compiling multiple definition blocks. +iASL: added a remark for an attempt to create a nameseg or namestring +containing lower-case letters. This should prevent declaring multiple +namesegs or namestrings in an attempt to refer to different objects (with +different cases), but actually refer to the same object(s). + iASL: improve alias analysis by saving object type. If the alias is a method type, the parameter count is also recorded. @@ -3702,7 +3795,7 @@ iASL compiler, all ACPICA utilities, and the test suites. Events: Introduce ACPI_GPE_DISPATCH_RAW_HANDLER to fix GPE storm issues. A raw gpe handling mechanism was created to allow better handling of GPE storms that aren't easily managed by the normal handler. The raw handler -allows disabling/renabling of the the GPE so that interrupt storms can be +allows disabling/renabling of the GPE so that interrupt storms can be avoided in cases where events cannot be timely serviced. In this scenario, handlers should use the AcpiSetGpe() API to disable/enable the GPE. This API will leave the reference counts undisturbed, thereby diff --git a/generate/lint/std32.lnt b/generate/lint/std32.lnt index 37e5c36be104..22e4e6042a58 100644 --- a/generate/lint/std32.lnt +++ b/generate/lint/std32.lnt @@ -6,7 +6,7 @@ -d_MSC_VER=1 +fll // enable long long +rw(__asm) // enable in-line assembly --esym( 950, __asm) +-esym( 950, __asm) // Used to track stack use -si4 -sp4 diff --git a/generate/lint/std64.lnt b/generate/lint/std64.lnt index 032c457e57e0..1bf16a4b2e14 100644 --- a/generate/lint/std64.lnt +++ b/generate/lint/std64.lnt @@ -14,4 +14,4 @@ -si4 -sl4 -sp8 -sll8 co.lnt -options.lnt +options.lnt diff --git a/generate/unix/acpihelp/Makefile b/generate/unix/acpihelp/Makefile index 7f04770d357e..193a69b69bf2 100644 --- a/generate/unix/acpihelp/Makefile +++ b/generate/unix/acpihelp/Makefile @@ -22,7 +22,8 @@ vpath %.c \ $(ACPIHELP)\ $(ACPICA_COMMON)\ $(ACPICA_UTILITIES)\ - $(ACPICA_OSL) + $(ACPICA_OSL)\ + $(ASL_COMPILER) HEADERS = \ $(wildcard $(ACPIHELP)/*.h) @@ -40,6 +41,7 @@ OBJECTS = \ $(OBJDIR)/ahmain.o\ $(OBJDIR)/ahtable.o\ $(OBJDIR)/ahuuids.o\ + $(OBJDIR)/aslmessages.o\ $(OBJDIR)/getopt.o\ $(OBJDIR)/osunixxf.o\ $(OBJDIR)/utdebug.o\ diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index 3c14b10e86d0..326ea3b355ac 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -181,6 +181,7 @@ const AH_UUID Gbl_AcpiUuids[] = {"Physical Presence Interface", UUID_PHYSICAL_PRESENCE}, {"[Non-volatile DIMM and NFIT table]", NULL}, + {"NVDIMM Device", UUID_NFIT_DIMM}, {"Volatile Memory Region", UUID_VOLATILE_MEMORY}, {"Persistent Memory Region", UUID_PERSISTENT_MEMORY}, {"NVDIMM Control Region", UUID_CONTROL_REGION}, @@ -189,6 +190,10 @@ const AH_UUID Gbl_AcpiUuids[] = {"Volatile Virtual CD", UUID_VOLATILE_VIRTUAL_CD}, {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + {"Microsoft NVDIMM Command set",UUID_NFIT_DIMM_N_MSFT}, + {"HP NDIMM HPE1", UUID_NFIT_DIMM_N_HPE1}, + {"HP NDIMM HPE2", UUID_NFIT_DIMM_N_HPE2}, + {"Virtual NVDIMM", UUID_NFIT_DIMM_N_HYPERV}, {"[Processor Properties]", NULL}, {"Cache Properties", UUID_CACHE_PROPERTIES}, diff --git a/source/compiler/aslbtypes.c b/source/compiler/aslbtypes.c index 796b61acc0c0..4e579c7eaf73 100644 --- a/source/compiler/aslbtypes.c +++ b/source/compiler/aslbtypes.c @@ -672,7 +672,7 @@ AnMapObjTypeToBtype ( * * PARAMETERS: Btype - Bitfield of ACPI types * - * RETURN: The Etype corresponding the the Btype + * RETURN: The Etype corresponding the Btype * * DESCRIPTION: Convert a bitfield type to an encoded type * diff --git a/source/compiler/aslcodegen.c b/source/compiler/aslcodegen.c index 61e067357954..ba0384e8452b 100644 --- a/source/compiler/aslcodegen.c +++ b/source/compiler/aslcodegen.c @@ -700,7 +700,7 @@ CgUpdateHeader ( Checksum = (UINT8) (0 - Sum); - /* Re-write the the checksum byte */ + /* Re-write the checksum byte */ FlSeekFile (ASL_FILE_AML_OUTPUT, Op->Asl.FinalAmlOffset + ACPI_OFFSET (ACPI_TABLE_HEADER, Checksum)); diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index 2c03cd0805a4..9a3ea588ba91 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -538,7 +538,7 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), /* UART_SERIALBUS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* UART_SERIALBUSV2 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, 0), +/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, OP_AML_PACKAGE, ACPI_BTYPE_BUFFER), /* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), /* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), /* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c index 320ad2aefa9b..d883bc581d77 100644 --- a/source/compiler/aslmessages.c +++ b/source/compiler/aslmessages.c @@ -384,6 +384,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_EXTERNAL_FOUND_HERE */ "External declaration below ", /* ASL_MSG_LOWER_CASE_NAMESEG */ "At least one lower case letter found in NameSeg, ASL is case insensitive - converting to upper case", /* ASL_MSG_LOWER_CASE_NAMEPATH */ "At least one lower case letter found in NamePath, ASL is case insensitive - converting to upper case", +/* ASL_MSG_UUID_NOT_FOUND */ "Unknown UUID string" }; /* Table compiler */ @@ -457,7 +458,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslCompilerMsgs)) { - return ("[Unknown ASL Compiler exception ID]"); + return ("[Unknown iASL Compiler exception ID]"); } } @@ -470,7 +471,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslTableCompilerMsgs)) { - return ("[Unknown Table Compiler exception ID]"); + return ("[Unknown iASL Table Compiler exception ID]"); } } @@ -483,7 +484,7 @@ AeDecodeMessageId ( if (Index >= ACPI_ARRAY_LENGTH (AslPreprocessorMsgs)) { - return ("[Unknown Preprocessor exception ID]"); + return ("[Unknown iASL Preprocessor exception ID]"); } } @@ -491,7 +492,7 @@ AeDecodeMessageId ( else { - return ("[Unknown exception/component ID]"); + return ("[Unknown iASL exception ID]"); } return (MessageTable[Index]); @@ -559,3 +560,79 @@ AeBuildFullExceptionCode ( */ return (((Level + 1) * 1000) + MessageId); } + + +#ifdef ACPI_HELP_APP +/******************************************************************************* + * + * FUNCTION: AhDecodeAslException + * + * PARAMETERS: HexString - iASL status string from command line, in + * hex. If null, display all exceptions. + * + * RETURN: None + * + * DESCRIPTION: Decode and display an iASL exception code. Note1: a + * NULL string for HexString displays all known iASL exceptions. Note2: + * implements the -x option for AcpiHelp. + * + ******************************************************************************/ + +#define AH_DISPLAY_ASL_EXCEPTION_TEXT(Status, Exception) \ + printf ("%.4X: %s\n", Status, Exception) + +#define AH_DISPLAY_EXCEPTION(Status, Name) \ + printf ("%.4X: %s\n", Status, Name) + + +void +AhDecodeAslException ( + char *HexString) +{ + UINT32 i; + UINT32 MessageId; + const char *OneException; + UINT32 Index = 1; + + + /* + * A null input string means to decode and display all known + * exception codes. + */ + if (!HexString) + { + printf ("All defined iASL exception codes:\n\n"); + printf ("Main iASL exceptions:\n\n"); + AH_DISPLAY_EXCEPTION (0, + "AE_OK (No error occurred)"); + + /* Display codes in each block of exception types */ + + for (i = 1; Index < ACPI_ARRAY_LENGTH (AslCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslCompilerMsgs[i]); + } + + printf ("\niASL Table Compiler exceptions:\n\n"); + Index = ASL_MSG_TABLE_COMPILER; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslTableCompilerMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslTableCompilerMsgs[i]); + } + + printf ("\niASL Preprocessor exceptions:\n\n"); + Index = ASL_MSG_PREPROCESSOR; + for (i = 0; i < ACPI_ARRAY_LENGTH (AslPreprocessorMsgs); i++, Index++) + { + AH_DISPLAY_ASL_EXCEPTION_TEXT (Index, AslPreprocessorMsgs[i]); + } + return; + } + + /* HexString is valid - convert it to a MessageId and decode it */ + + MessageId = strtol (HexString, NULL, 16); + OneException = AeDecodeMessageId ((UINT16) MessageId); + AH_DISPLAY_ASL_EXCEPTION_TEXT (MessageId, OneException); +} +#endif diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h index 8a2b5c6c7da7..2313d212a4ef 100644 --- a/source/compiler/aslmessages.h +++ b/source/compiler/aslmessages.h @@ -152,7 +152,6 @@ #ifndef __ASLMESSAGES_H #define __ASLMESSAGES_H - /* These values must match error type string tables in aslmessages.c */ typedef enum @@ -167,9 +166,12 @@ typedef enum } ASL_MESSAGE_TYPES; - #define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings for types above */ +void +AhDecodeAslException ( + char *HexString); + /* * Exception code blocks, 0 - 999 * Available for new exception blocks: 600 - 999 @@ -386,6 +388,7 @@ typedef enum ASL_MSG_EXTERNAL_FOUND_HERE, ASL_MSG_LOWER_CASE_NAMESEG, ASL_MSG_LOWER_CASE_NAMEPATH, + ASL_MSG_UUID_NOT_FOUND, /* These messages are used by the Data Table compiler only */ diff --git a/source/compiler/aslnamesp.c b/source/compiler/aslnamesp.c index f74b5ffb4533..0a099a0b9b1e 100644 --- a/source/compiler/aslnamesp.c +++ b/source/compiler/aslnamesp.c @@ -226,8 +226,8 @@ NsDisplayNamespace ( /* File header */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n" + "Count Depth Name - Type\n\n"); /* Walk entire namespace from the root */ @@ -239,14 +239,21 @@ NsDisplayNamespace ( return (Status); } - /* Print the full pathname for each namespace node */ + /* Print the full pathname for each namespace node in the common namespace */ - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\nNamespace pathnames\n\n"); + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, + "\nNamespace pathnames and where declared:\n" + "\n\n"); Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOnePathname, NULL, NULL, NULL); + /* + * We just dumped the entire common namespace, we don't want to do it + * again for other input files. + */ + AslGbl_NsOutputFlag = FALSE; return (Status); } @@ -512,7 +519,7 @@ NsDoOneNamespaceObject ( * * RETURN: Status * - * DESCRIPTION: Print the full pathname for a namespace node. + * DESCRIPTION: Print the full pathname and addtional info for a namespace node. * ******************************************************************************/ @@ -528,6 +535,13 @@ NsDoOnePathname ( ACPI_BUFFER TargetPath; + /* Ignore predefined namespace nodes and External declarations */ + + if (!Node->Op || (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + return (AE_OK); + } + TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; Status = AcpiNsHandleToPathname (Node, &TargetPath, FALSE); if (ACPI_FAILURE (Status)) @@ -535,8 +549,15 @@ NsDoOnePathname ( return (Status); } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%s\n", - ACPI_CAST_PTR (char, TargetPath.Pointer)); + /* + * Print the full pathname (and other information) + * for each namespace node in the common namespace + */ + FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%-41s %-12s %s, %u\n", + ACPI_CAST_PTR (char, TargetPath.Pointer), + AcpiUtGetTypeName (Node->Type), + Node->Op->Asl.Filename, Node->Op->Asl.LogicalLineNumber); + ACPI_FREE (TargetPath.Pointer); return (AE_OK); } diff --git a/source/compiler/aslopcodes.c b/source/compiler/aslopcodes.c index 14eb63ddcdb2..b2a0236503d7 100644 --- a/source/compiler/aslopcodes.c +++ b/source/compiler/aslopcodes.c @@ -798,7 +798,13 @@ OpcDoUuId ( } else { + /* Convert UUID string to a buffer, check for a known UUID */ + AcpiUtConvertStringToUuid (InString, Buffer); + if (!AcpiAhMatchUuid (Buffer)) + { + AslError (ASL_REMARK, ASL_MSG_UUID_NOT_FOUND, Op, NULL); + } } /* Change Op to a Buffer */ diff --git a/source/compiler/aslprimaries.y b/source/compiler/aslprimaries.y index 1fb9e501dddd..68fdbe840de9 100644 --- a/source/compiler/aslprimaries.y +++ b/source/compiler/aslprimaries.y @@ -500,7 +500,7 @@ DivideTerm EISAIDTerm : PARSEOP_EISAID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_EISAID, $3);} | PARSEOP_EISAID PARSEOP_OPEN_PAREN @@ -635,7 +635,7 @@ FprintfTerm : PARSEOP_FPRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_FPRINTF);} TermArg ',' - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,3,$4,$6,$7);} | PARSEOP_FPRINTF @@ -1091,7 +1091,7 @@ PowerResTerm PrintfTerm : PARSEOP_PRINTF PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_PRINTF);} - StringData + StringLiteral PrintfArgList PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,$4,$5);} | PARSEOP_PRINTF @@ -1412,7 +1412,7 @@ ToStringTerm ToUUIDTerm : PARSEOP_TOUUID PARSEOP_OPEN_PAREN - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrSetOpIntegerValue (PARSEOP_TOUUID, $3);} | PARSEOP_TOUUID PARSEOP_OPEN_PAREN @@ -1422,7 +1422,7 @@ ToUUIDTerm UnicodeTerm : PARSEOP_UNICODE PARSEOP_OPEN_PAREN {$$ = TrCreateLeafOp (PARSEOP_UNICODE);} - StringData + StringLiteral PARSEOP_CLOSE_PAREN {$$ = TrLinkOpChildren ($3,2,0,$4);} | PARSEOP_UNICODE PARSEOP_OPEN_PAREN diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index f998527b3a36..e7e678d2058e 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -523,6 +523,10 @@ StringData | String {} ; +StringLiteral + : String {} + ; + ByteConst : Integer {$$ = TrSetOpIntegerValue (PARSEOP_BYTECONST, $1);} ; diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index 85d3af9acf8d..5c07c5df8e35 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -178,6 +178,7 @@ NoEcho(' %type RequiredTarget %type SimpleName %type StringData +%type StringLiteral %type Target %type Term %type TermArg diff --git a/source/components/events/evregion.c b/source/components/events/evregion.c index 233e77d4e17b..a62d1c2671b9 100644 --- a/source/components/events/evregion.c +++ b/source/components/events/evregion.c @@ -164,8 +164,10 @@ extern UINT8 AcpiGbl_DefaultAddressSpaces[]; /* Local prototypes */ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode); +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId); + static ACPI_STATUS AcpiEvRegRun ( @@ -869,11 +871,13 @@ AcpiEvExecuteRegMethods ( (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvRegRun, NULL, &Info, NULL); - /* Special case for EC: handle "orphan" _REG methods with no region */ - - if (SpaceId == ACPI_ADR_SPACE_EC) + /* + * Special case for EC and GPIO: handle "orphan" _REG methods with + * no region. + */ + if (SpaceId == ACPI_ADR_SPACE_EC || SpaceId == ACPI_ADR_SPACE_GPIO) { - AcpiEvOrphanEcRegMethod (Node); + AcpiEvExecuteOrphanRegMethod (Node, SpaceId); } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_NAMES, @@ -954,32 +958,29 @@ AcpiEvRegRun ( /******************************************************************************* * - * FUNCTION: AcpiEvOrphanEcRegMethod + * FUNCTION: AcpiEvExecuteOrphanRegMethod * - * PARAMETERS: EcDeviceNode - Namespace node for an EC device + * PARAMETERS: DeviceNode - Namespace node for an ACPI device + * SpaceId - The address space ID * * RETURN: None * - * DESCRIPTION: Execute an "orphan" _REG method that appears under the EC + * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI * device. This is a _REG method that has no corresponding region - * within the EC device scope. The orphan _REG method appears to - * have been enabled by the description of the ECDT in the ACPI - * specification: "The availability of the region space can be - * detected by providing a _REG method object underneath the - * Embedded Controller device." - * - * To quickly access the EC device, we use the EcDeviceNode used - * during EC handler installation. Otherwise, we would need to - * perform a time consuming namespace walk, executing _HID - * methods to find the EC device. + * within the device's scope. ACPI tables depending on these + * "orphan" _REG methods have been seen for both EC and GPIO + * Operation Regions. Presumably the Windows ACPI implementation + * always calls the _REG method independent of the presence of + * an actual Operation Region with the correct address space ID. * * MUTEX: Assumes the namespace is locked * ******************************************************************************/ static void -AcpiEvOrphanEcRegMethod ( - ACPI_NAMESPACE_NODE *EcDeviceNode) +AcpiEvExecuteOrphanRegMethod ( + ACPI_NAMESPACE_NODE *DeviceNode, + ACPI_ADR_SPACE_TYPE SpaceId) { ACPI_HANDLE RegMethod; ACPI_NAMESPACE_NODE *NextNode; @@ -988,10 +989,10 @@ AcpiEvOrphanEcRegMethod ( ACPI_OBJECT Objects[2]; - ACPI_FUNCTION_TRACE (EvOrphanEcRegMethod); + ACPI_FUNCTION_TRACE (EvExecuteOrphanRegMethod); - if (!EcDeviceNode) + if (!DeviceNode) { return_VOID; } @@ -1002,7 +1003,7 @@ AcpiEvOrphanEcRegMethod ( /* Get a handle to a _REG method immediately under the EC device */ - Status = AcpiGetHandle (EcDeviceNode, METHOD_NAME__REG, &RegMethod); + Status = AcpiGetHandle (DeviceNode, METHOD_NAME__REG, &RegMethod); if (ACPI_FAILURE (Status)) { goto Exit; /* There is no _REG method present */ @@ -1015,25 +1016,25 @@ AcpiEvOrphanEcRegMethod ( * with other space IDs to be present; but the code below will then * execute the _REG method with the EmbeddedControl SpaceID argument. */ - NextNode = AcpiNsGetNextNode (EcDeviceNode, NULL); + NextNode = AcpiNsGetNextNode (DeviceNode, NULL); while (NextNode) { if ((NextNode->Type == ACPI_TYPE_REGION) && (NextNode->Object) && - (NextNode->Object->Region.SpaceId == ACPI_ADR_SPACE_EC)) + (NextNode->Object->Region.SpaceId == SpaceId)) { goto Exit; /* Do not execute the _REG */ } - NextNode = AcpiNsGetNextNode (EcDeviceNode, NextNode); + NextNode = AcpiNsGetNextNode (DeviceNode, NextNode); } - /* Evaluate the _REG(EmbeddedControl,Connect) method */ + /* Evaluate the _REG(SpaceId,Connect) method */ Args.Count = 2; Args.Pointer = Objects; Objects[0].Type = ACPI_TYPE_INTEGER; - Objects[0].Integer.Value = ACPI_ADR_SPACE_EC; + Objects[0].Integer.Value = SpaceId; Objects[1].Type = ACPI_TYPE_INTEGER; Objects[1].Integer.Value = ACPI_REG_CONNECT; diff --git a/source/components/namespace/nspredef.c b/source/components/namespace/nspredef.c index 70aac113c745..7f7965f2bfa7 100644 --- a/source/components/namespace/nspredef.c +++ b/source/components/namespace/nspredef.c @@ -223,13 +223,14 @@ AcpiNsCheckReturnValue ( ACPI_STATUS Status; const ACPI_PREDEFINED_INFO *Predefined; + ACPI_FUNCTION_TRACE (NsCheckReturnValue); /* If not a predefined name, we cannot validate the return object */ Predefined = Info->Predefined; if (!Predefined) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -239,7 +240,7 @@ AcpiNsCheckReturnValue ( if ((ReturnStatus != AE_OK) && (ReturnStatus != AE_CTRL_RETURN_VALUE)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -259,7 +260,7 @@ AcpiNsCheckReturnValue ( (!Predefined->Info.ExpectedBtypes) || (Predefined->Info.ExpectedBtypes == ACPI_RTYPE_ALL)) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -325,7 +326,7 @@ AcpiNsCheckReturnValue ( Node->Flags |= ANOBJ_EVALUATED; } - return (Status); + return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsprepkg.c b/source/components/namespace/nsprepkg.c index d33b76d65116..689d2c167b5d 100644 --- a/source/components/namespace/nsprepkg.c +++ b/source/components/namespace/nsprepkg.c @@ -214,7 +214,7 @@ AcpiNsCheckPackage ( UINT32 i; - ACPI_FUNCTION_NAME (NsCheckPackage); + ACPI_FUNCTION_TRACE (NsCheckPackage); /* The package info for this name is in the next table entry */ @@ -245,13 +245,13 @@ AcpiNsCheckPackage ( { if (Package->RetInfo.Type == ACPI_PTYPE1_VAR) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Return Package has no elements (empty)")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } /* @@ -305,7 +305,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -338,7 +338,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.ObjectType[i], i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } else @@ -349,7 +349,7 @@ AcpiNsCheckPackage ( Package->RetInfo3.TailObjectType, i); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } } @@ -365,7 +365,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements++; @@ -384,7 +384,7 @@ AcpiNsCheckPackage ( Info, Elements, ACPI_RTYPE_INTEGER, 0); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* @@ -428,7 +428,7 @@ AcpiNsCheckPackage ( Info, ReturnObject, ReturnObjectPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Update locals to point to the new package (of 1 element) */ @@ -466,7 +466,7 @@ AcpiNsCheckPackage ( Package->RetInfo.ObjectType1, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } /* Validate length of the UUID buffer */ @@ -475,14 +475,14 @@ AcpiNsCheckPackage ( { ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, "Invalid length for UUID Buffer")); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } Status = AcpiNsCheckObjectType(Info, Elements + 1, Package->RetInfo.ObjectType2, 0); if (ACPI_FAILURE(Status)) { - return (Status); + return_ACPI_STATUS (Status); } Elements += 2; @@ -498,10 +498,10 @@ AcpiNsCheckPackage ( "Invalid internal return type in table entry: %X", Package->RetInfo.Type)); - return (AE_AML_INTERNAL); + return_ACPI_STATUS (AE_AML_INTERNAL); } - return (Status); + return_ACPI_STATUS (Status); PackageTooSmall: @@ -512,7 +512,7 @@ AcpiNsCheckPackage ( "Return Package is too small - found %u elements, expected %u", Count, ExpectedCount)); - return (AE_AML_OPERAND_VALUE); + return_ACPI_STATUS (AE_AML_OPERAND_VALUE); } @@ -865,6 +865,8 @@ AcpiNsCheckPackageElements ( UINT32 i; + ACPI_FUNCTION_TRACE (NsCheckPackageElements); + /* * Up to two groups of package elements are supported by the data * structure. All elements in each group must be of the same type. @@ -876,7 +878,7 @@ AcpiNsCheckPackageElements ( Type1, i + StartIndex); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; @@ -888,11 +890,11 @@ AcpiNsCheckPackageElements ( Type2, (i + Count1 + StartIndex)); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } ThisElement++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/source/components/namespace/nsrepair2.c b/source/components/namespace/nsrepair2.c index f62aca29a5ac..57c229a8c5ee 100644 --- a/source/components/namespace/nsrepair2.c +++ b/source/components/namespace/nsrepair2.c @@ -321,16 +321,18 @@ AcpiNsComplexRepairs ( ACPI_STATUS Status; + ACPI_FUNCTION_TRACE (NsComplexRepairs); + /* Check if this name is in the list of repairable names */ Predefined = AcpiNsMatchComplexRepair (Node); if (!Predefined) { - return (ValidateStatus); + return_ACPI_STATUS (ValidateStatus); } Status = Predefined->RepairFunction (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } @@ -526,20 +528,21 @@ AcpiNsRepair_CID ( UINT16 OriginalRefCount; UINT32 i; + ACPI_FUNCTION_TRACE (NsRepair_CID); /* Check for _CID as a simple string */ if (ReturnObject->Common.Type == ACPI_TYPE_STRING) { Status = AcpiNsRepair_HID (Info, ReturnObjectPtr); - return (Status); + return_ACPI_STATUS (Status); } /* Exit if not a Package */ if (ReturnObject->Common.Type != ACPI_TYPE_PACKAGE) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Examine each element of the _CID package */ @@ -553,7 +556,7 @@ AcpiNsRepair_CID ( Status = AcpiNsRepair_HID (Info, ElementPtr); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } if (OriginalElement != *ElementPtr) @@ -567,7 +570,7 @@ AcpiNsRepair_CID ( ElementPtr++; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -687,9 +690,8 @@ AcpiNsRepair_HID ( ACPI_OPERAND_OBJECT **ReturnObjectPtr) { ACPI_OPERAND_OBJECT *ReturnObject = *ReturnObjectPtr; - ACPI_OPERAND_OBJECT *NewString; - char *Source; char *Dest; + char *Source; ACPI_FUNCTION_NAME (NsRepair_HID); @@ -699,7 +701,7 @@ AcpiNsRepair_HID ( if (ReturnObject->Common.Type != ACPI_TYPE_STRING) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } if (ReturnObject->String.Length == 0) @@ -711,15 +713,7 @@ AcpiNsRepair_HID ( /* Return AE_OK anyway, let driver handle it */ Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - return (AE_OK); - } - - /* It is simplest to always create a new string object */ - - NewString = AcpiUtCreateStringObject (ReturnObject->String.Length); - if (!NewString) - { - return (AE_NO_MEMORY); + return_ACPI_STATUS (AE_OK); } /* @@ -732,7 +726,7 @@ AcpiNsRepair_HID ( if (*Source == '*') { Source++; - NewString->String.Length--; + ReturnObject->String.Length--; ACPI_DEBUG_PRINT ((ACPI_DB_REPAIR, "%s: Removed invalid leading asterisk\n", Info->FullPathname)); @@ -746,14 +740,13 @@ AcpiNsRepair_HID ( * "NNNN####" where N is an uppercase letter or decimal digit, and * # is a hex digit. */ - for (Dest = NewString->String.Pointer; *Source; Dest++, Source++) + for (Dest = ReturnObject->String.Pointer; *Source; Dest++, Source++) { *Dest = (char) toupper ((int) *Source); } + ReturnObject->String.Pointer[ReturnObject->String.Length] = 0; - AcpiUtRemoveReference (ReturnObject); - *ReturnObjectPtr = NewString; - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/source/include/accommon.h b/source/include/accommon.h index 809c50547c86..8aa37717732d 100644 --- a/source/include/accommon.h +++ b/source/include/accommon.h @@ -155,7 +155,7 @@ /* * Common set of includes for all ACPICA source files. * We put them here because we don't want to duplicate them - * in the the source code again and again. + * in the source code again and again. * * Note: The order of these include files is important. */ diff --git a/source/include/acpixf.h b/source/include/acpixf.h index a16b683099b3..df45d2dc3ca8 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 0x20200925 +#define ACPI_CA_VERSION 0x20201113 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acuuid.h b/source/include/acuuid.h index 468244a6b373..f11b35365e5a 100644 --- a/source/include/acuuid.h +++ b/source/include/acuuid.h @@ -181,6 +181,7 @@ /* NVDIMM - NFIT table */ +#define UUID_NFIT_DIMM "4309ac30-0d11-11e4-9191-0800200c9a66" #define UUID_VOLATILE_MEMORY "7305944f-fdda-44e3-b16c-3f22d252e5d0" #define UUID_PERSISTENT_MEMORY "66f0d379-b4f3-4074-ac43-0d3318b78cdb" #define UUID_CONTROL_REGION "92f701f6-13b4-405d-910b-299367e8234c" @@ -189,6 +190,10 @@ #define UUID_VOLATILE_VIRTUAL_CD "3d5abd30-4175-87ce-6d64-d2ade523c4bb" #define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" #define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" +#define UUID_NFIT_DIMM_N_MSFT "1ee68b36-d4bd-4a1a-9a16-4f8e53d46e05" +#define UUID_NFIT_DIMM_N_HPE1 "9002c334-acf3-4c0e-9642-a235f0d53bc6" +#define UUID_NFIT_DIMM_N_HPE2 "5008664b-b758-41a0-a03c-27c2f2d04f7e" +#define UUID_NFIT_DIMM_N_HYPERV "5746c5f2-a9a2-4264-ad0e-e4ddc9e09e80" /* Processor Properties (ACPI 6.2) */ diff --git a/source/tools/acpihelp/acpihelp.h b/source/tools/acpihelp/acpihelp.h index 637f274720ab..1ce8b0bf372e 100644 --- a/source/tools/acpihelp/acpihelp.h +++ b/source/tools/acpihelp/acpihelp.h @@ -225,7 +225,8 @@ typedef enum AH_DISPLAY_DEVICE_IDS, AH_DISPLAY_UUIDS, AH_DISPLAY_TABLES, - AH_DISPLAY_DIRECTIVES + AH_DISPLAY_DIRECTIVES, + AH_DECODE_ASL_EXCEPTION } AH_OPTION_TYPES; @@ -296,6 +297,10 @@ void AhDecodeException ( char *Name); +void +AhDecodeAslException ( + char *Name); + void AhFindPredefinedNames ( char *Name); diff --git a/source/tools/acpihelp/ahdecode.c b/source/tools/acpihelp/ahdecode.c index 7a1497c4a8d6..b72db2a800d2 100644 --- a/source/tools/acpihelp/ahdecode.c +++ b/source/tools/acpihelp/ahdecode.c @@ -155,6 +155,7 @@ #include "acpihelp.h" #include "acpredef.h" +BOOLEAN AslGbl_VerboseErrors = TRUE; /* Local prototypes */ diff --git a/source/tools/acpihelp/ahmain.c b/source/tools/acpihelp/ahmain.c index 0d69385682b8..86fcc8d38a7c 100644 --- a/source/tools/acpihelp/ahmain.c +++ b/source/tools/acpihelp/ahmain.c @@ -160,7 +160,7 @@ AhDisplayUsage ( void); #define AH_UTILITY_NAME "ACPI Help Utility" -#define AH_SUPPORTED_OPTIONS "adeghikmopstuv^" +#define AH_SUPPORTED_OPTIONS "adeghikmopstuvx^" #if defined ACPI_OPTION @@ -197,6 +197,7 @@ AhDisplayUsage ( ACPI_USAGE_TEXT ("\nACPI Values:\n"); ACPI_OPTION ("-e [HexValue]", "Decode ACPICA exception code"); ACPI_OPTION ("-o [HexValue]", "Decode hex AML opcode"); + ACPI_OPTION ("-x [HexValue]", "Decode iASL exception code"); ACPI_USAGE_TEXT ("\nASL Names and Symbols (ACPI Source Language):\n"); ACPI_OPTION ("-k [Name/Prefix | *]", "Display ASL non-operator keyword(s)"); @@ -309,6 +310,11 @@ main ( DecodeType = AH_DISPLAY_UUIDS; break; + case 'x': + + DecodeType = AH_DECODE_ASL_EXCEPTION; + break; + case 'v': /* -v: (Version): signon already emitted, just exit */ switch (AcpiGbl_Optarg[0]) @@ -402,6 +408,11 @@ main ( AhDisplayDirectives (); break; + case AH_DECODE_ASL_EXCEPTION: + + AhDecodeAslException (Name); + break; + default: if (!Name)