From c457a42be4fca72c51fdca569271b62213d01a37 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Wed, 31 May 2017 22:40:24 +0000 Subject: Import ACPICA 20170531. --- source/common/acfileio.c | 2 - source/common/adfile.c | 10 - source/common/adisasm.c | 8 +- source/common/adwalk.c | 105 +-- source/common/ahids.c | 1 + source/common/ahpredef.c | 6 + source/common/ahtable.c | 3 + source/common/ahuuids.c | 4 + source/common/dmextern.c | 520 ++++++++++++--- source/common/dmrestag.c | 36 +- source/common/dmswitch.c | 679 ++++++++++++++++++++ source/common/dmtable.c | 79 +++ source/common/dmtbdump.c | 350 ++++++++++ source/common/dmtbinfo.c | 325 +++++++++- source/compiler/aslascii.c | 5 +- source/compiler/aslcompile.c | 2 +- source/compiler/aslcompiler.h | 20 + source/compiler/aslcompiler.l | 5 + source/compiler/asldefine.h | 4 +- source/compiler/aslexternal.c | 11 +- source/compiler/aslglobal.h | 1 - source/compiler/aslhelp.c | 13 +- source/compiler/aslhelpers.y | 9 + source/compiler/aslload.c | 90 ++- source/compiler/aslmain.c | 41 +- source/compiler/aslmap.c | 5 + source/compiler/asloffset.c | 1 - source/compiler/asloptions.c | 5 +- source/compiler/aslparser.y | 2 +- source/compiler/aslresource.c | 25 + source/compiler/aslresources.y | 94 +++ source/compiler/aslrestype2s.c | 917 ++++++++++++++++++++++++++- source/compiler/aslrules.y | 16 +- source/compiler/aslstartup.c | 11 +- source/compiler/aslsupport.l | 15 +- source/compiler/asltokens.y | 5 + source/compiler/asltree.c | 19 +- source/compiler/asltypes.y | 6 + source/compiler/aslutils.c | 6 +- source/compiler/aslxref.c | 9 +- source/compiler/cvcompiler.c | 53 +- source/compiler/cvdisasm.c | 16 +- source/compiler/cvparser.c | 7 +- source/compiler/dtcompiler.h | 11 + source/compiler/dtfield.c | 30 + source/compiler/dttable1.c | 228 +++++++ source/compiler/dttable2.c | 134 ++++ source/compiler/dttemplate.h | 175 ++++- source/compiler/dtutils.c | 12 + source/components/debugger/dbexec.c | 12 + source/components/debugger/dbobject.c | 6 +- source/components/debugger/dbxface.c | 2 +- source/components/disassembler/dmbuffer.c | 4 +- source/components/disassembler/dmdeferred.c | 6 +- source/components/disassembler/dmopcode.c | 424 +------------ source/components/disassembler/dmresrc.c | 17 +- source/components/disassembler/dmresrcl2.c | 466 ++++++++++++++ source/components/disassembler/dmwalk.c | 25 +- source/components/dispatcher/dsargs.c | 5 +- source/components/dispatcher/dsdebug.c | 1 + source/components/dispatcher/dsmethod.c | 14 +- source/components/dispatcher/dsopcode.c | 7 +- source/components/dispatcher/dspkginit.c | 638 +++++++++++++++++++ source/components/dispatcher/dsutils.c | 6 - source/components/dispatcher/dswexec.c | 3 +- source/components/dispatcher/dswload.c | 38 +- source/components/dispatcher/dswload2.c | 18 + source/components/events/evxfevnt.c | 21 + source/components/executer/exdebug.c | 4 +- source/components/executer/exdump.c | 27 +- source/components/executer/exoparg1.c | 26 +- source/components/executer/exresolv.c | 24 +- source/components/namespace/nsaccess.c | 27 + source/components/namespace/nsnames.c | 4 - source/components/namespace/nsutils.c | 2 +- source/components/namespace/nsxfeval.c | 41 +- source/components/parser/psobject.c | 15 + source/components/parser/psopcode.c | 2 +- source/components/parser/psparse.c | 14 +- source/components/resources/rscalc.c | 112 ++++ source/components/resources/rsdump.c | 47 ++ source/components/resources/rsdumpinfo.c | 68 ++ source/components/resources/rsinfo.c | 28 +- source/components/resources/rsmisc.c | 5 +- source/components/resources/rsserial.c | 347 ++++++++++ source/components/tables/tbfadt.c | 4 +- source/components/tables/tbutils.c | 6 +- source/components/utilities/utdecode.c | 5 +- source/components/utilities/utownerid.c | 12 +- source/components/utilities/utresdecode.c | 461 ++++++++++++++ source/components/utilities/utresrc.c | 314 +-------- source/components/utilities/utxfmutex.c | 4 + source/include/acapps.h | 2 +- source/include/acdisasm.h | 105 ++- source/include/acglobal.h | 3 + source/include/aclocal.h | 17 +- source/include/acopcode.h | 2 +- source/include/acpixf.h | 2 +- source/include/acpredef.h | 14 + source/include/acresrc.h | 14 +- source/include/acrestyp.h | 103 ++- source/include/actbl1.h | 292 ++++++++- source/include/actbl2.h | 67 +- source/include/actbl3.h | 91 ++- source/include/actypes.h | 67 +- source/include/acutils.h | 1 + source/include/acuuid.h | 5 + source/include/amlcode.h | 61 +- source/include/amlresrc.h | 118 ++++ source/include/platform/acgcc.h | 10 + source/include/platform/acintel.h | 2 + source/os_specific/service_layers/osunixxf.c | 12 +- source/tools/acpidump/apmain.c | 3 +- source/tools/acpiexec/aecommon.h | 12 +- source/tools/acpiexec/aeexception.c | 441 +++++++++++++ source/tools/acpiexec/aehandlers.c | 214 ++----- source/tools/acpiexec/aemain.c | 4 +- source/tools/acpisrc/asremove.c | 92 ++- source/tools/acpisrc/astable.c | 25 +- 119 files changed, 7819 insertions(+), 1403 deletions(-) create mode 100644 source/common/dmswitch.c create mode 100755 source/components/dispatcher/dspkginit.c create mode 100644 source/components/utilities/utresdecode.c create mode 100644 source/tools/acpiexec/aeexception.c (limited to 'source') diff --git a/source/common/acfileio.c b/source/common/acfileio.c index ecd9f604cf4d..a334d541e78a 100644 --- a/source/common/acfileio.c +++ b/source/common/acfileio.c @@ -531,8 +531,6 @@ AcValidateTableHeader ( if (!AcpiUtValidNameseg (TableHeader.Signature)) { - fprintf (stderr, "Invalid table signature: 0x%8.8X\n", - *ACPI_CAST_PTR (UINT32, TableHeader.Signature)); return (AE_BAD_SIGNATURE); } diff --git a/source/common/adfile.c b/source/common/adfile.c index 5fff07d3a13c..ac96156db245 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -316,11 +316,6 @@ FlGenerateFilename ( */ NewFilename = UtStringCacheCalloc ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); - if (!NewFilename) - { - return (NULL); - } - strcpy (NewFilename, InputFilename); /* Try to find the last dot in the filename */ @@ -364,11 +359,6 @@ FlStrdup ( NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1); - if (!NewString) - { - return (NULL); - } - strcpy (NewString, String); return (NewString); } diff --git a/source/common/adisasm.c b/source/common/adisasm.c index 699cc8a81857..703691523fe2 100644 --- a/source/common/adisasm.c +++ b/source/common/adisasm.c @@ -537,7 +537,7 @@ AdDisassembleOneTable ( * the entire tree with the new information (namely, the * number of arguments per method) */ - if (AcpiDmGetExternalMethodCount ()) + if (AcpiDmGetUnresolvedExternalMethodCount ()) { Status = AdReparseOneTable (Table, File, OwnerId); if (ACPI_FAILURE (Status)) @@ -553,7 +553,7 @@ AdDisassembleOneTable ( * 1) Convert fixed-offset references to resource descriptors * to symbolic references (Note: modifies namespace) */ - AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); + AcpiDmConvertParseObjects (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode); /* Optional displays */ @@ -616,7 +616,7 @@ AdReparseOneTable ( fprintf (stderr, "\nFound %u external control methods, " "reparsing with new information\n", - AcpiDmGetExternalMethodCount ()); + AcpiDmGetUnresolvedExternalMethodCount ()); /* Reparse, rebuild namespace */ @@ -642,7 +642,7 @@ AdReparseOneTable ( /* New namespace, add the external definitions first */ - AcpiDmAddExternalsToNamespace (); + AcpiDmAddExternalListToNamespace (); /* For -ca option: clear the list of comment addresses. */ diff --git a/source/common/adwalk.c b/source/common/adwalk.c index e1205e3bfa5e..887835cb0507 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -208,11 +208,16 @@ AcpiDmInspectPossibleArgs ( ACPI_PARSE_OBJECT *Op); static ACPI_STATUS -AcpiDmResourceDescendingOp ( +AcpiDmCommonDescendingOp ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context); +static ACPI_STATUS +AcpiDmProcessResourceDescriptors ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context); /******************************************************************************* * @@ -395,21 +400,21 @@ AcpiDmCrossReferenceNamespace ( /******************************************************************************* * - * FUNCTION: AcpiDmConvertResourceIndexes + * FUNCTION: AcpiDmConvertParseObjects * * PARAMETERS: ParseTreeRoot - Root of the parse tree * NamespaceRoot - Root of the internal namespace * * RETURN: None * - * DESCRIPTION: Convert fixed-offset references to resource descriptors to - * symbolic references. Should only be called after namespace has - * been cross referenced. + * DESCRIPTION: Begin parse tree walk to perform conversions needed for + * disassembly. These include resource descriptors and switch/case + * operations. * ******************************************************************************/ void -AcpiDmConvertResourceIndexes ( +AcpiDmConvertParseObjects ( ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot) { @@ -443,9 +448,14 @@ AcpiDmConvertResourceIndexes ( Info.Level = 0; Info.WalkState = WalkState; - AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp, + AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmCommonDescendingOp, AcpiDmCommonAscendingOp, &Info); ACPI_FREE (WalkState); + + if (AcpiGbl_TempListHead) { + AcpiDmClearTempList(); + } + return; } @@ -737,7 +747,6 @@ AcpiDmLoadDescendingOp ( WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); /* Only interested in operators that create new names */ @@ -754,7 +763,7 @@ AcpiDmLoadDescendingOp ( { /* For all named operators, get the new name */ - Path = (char *) Op->Named.Path; + Path = Op->Named.Path; if (!Path && Op->Common.AmlOpcode == AML_INT_NAMEDFIELD_OP) { @@ -875,7 +884,6 @@ AcpiDmXrefDescendingOp ( WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); if ((!(OpInfo->Flags & AML_NAMED)) && @@ -885,25 +893,6 @@ AcpiDmXrefDescendingOp ( { goto Exit; } - else if (Op->Common.Parent && - Op->Common.Parent->Common.AmlOpcode == AML_EXTERNAL_OP) - { - /* External() NamePath */ - - Path = Op->Common.Value.String; - ObjectType = (ACPI_OBJECT_TYPE) Op->Common.Next->Common.Value.Integer; - if (ObjectType == ACPI_TYPE_METHOD) - { - ParamCount = (UINT32) - Op->Common.Next->Common.Next->Common.Value.Integer; - } - - Flags |= ACPI_EXT_RESOLVED_REFERENCE | ACPI_EXT_ORIGIN_FROM_OPCODE; - AcpiDmAddOpToExternalList (Op, Path, - (UINT8) ObjectType, ParamCount, Flags); - - goto Exit; - } /* Get the NamePath from the appropriate place */ @@ -924,9 +913,10 @@ AcpiDmXrefDescendingOp ( Path = NextOp->Common.Value.String; } } - else if (Op->Common.AmlOpcode == AML_SCOPE_OP) + else if (Op->Common.AmlOpcode == AML_SCOPE_OP || + Op->Common.AmlOpcode == AML_EXTERNAL_OP) { - Path = (char *) Op->Named.Path; + Path = Op->Named.Path; } } else if (OpInfo->Flags & AML_CREATE) @@ -1060,21 +1050,59 @@ Exit: return (AE_OK); } +/******************************************************************************* + * + * FUNCTION: AcpiDmCommonDescendingOp + * + * PARAMETERS: ASL_WALK_CALLBACK + * + * RETURN: ACPI_STATUS + * + * DESCRIPTION: Perform parse tree preprocessing before main disassembly walk. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmCommonDescendingOp ( + ACPI_PARSE_OBJECT *Op, + UINT32 Level, + void *Context) +{ + ACPI_STATUS Status; + + /* Resource descriptor conversion */ + + Status = AcpiDmProcessResourceDescriptors (Op, Level, Context); + + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Switch/Case conversion */ + + Status = AcpiDmProcessSwitch (Op); + + return (AE_OK); +} + /******************************************************************************* * - * FUNCTION: AcpiDmResourceDescendingOp + * FUNCTION: AcpiDmProcessResourceDescriptors * * PARAMETERS: ASL_WALK_CALLBACK * - * RETURN: None + * RETURN: ACPI_STATUS * - * DESCRIPTION: Process one parse op during symbolic resource index conversion. + * DESCRIPTION: Convert fixed-offset references to resource descriptors to + * symbolic references. Should only be called after namespace has + * been cross referenced. * ******************************************************************************/ static ACPI_STATUS -AcpiDmResourceDescendingOp ( +AcpiDmProcessResourceDescriptors ( ACPI_PARSE_OBJECT *Op, UINT32 Level, void *Context) @@ -1085,7 +1113,6 @@ AcpiDmResourceDescendingOp ( ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status; - WalkState = Info->WalkState; OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); @@ -1111,10 +1138,10 @@ AcpiDmResourceDescendingOp ( * If so, convert the reference into a symbolic reference. */ AcpiDmCheckResourceReference (Op, WalkState); + return (AE_OK); } - /******************************************************************************* * * FUNCTION: AcpiDmCommonAscendingOp @@ -1135,14 +1162,11 @@ AcpiDmCommonAscendingOp ( void *Context) { ACPI_OP_WALK_INFO *Info = Context; - const ACPI_OPCODE_INFO *OpInfo; ACPI_OBJECT_TYPE ObjectType; /* Close scope if necessary */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - ObjectType = OpInfo->ObjectType; ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); if (AcpiNsOpensScope (ObjectType)) @@ -1153,7 +1177,6 @@ AcpiDmCommonAscendingOp ( return (AE_OK); } - /******************************************************************************* * * FUNCTION: AcpiDmInspectPossibleArgs diff --git a/source/common/ahids.c b/source/common/ahids.c index 3f3bae3021cd..701d9f40b661 100644 --- a/source/common/ahids.c +++ b/source/common/ahids.c @@ -187,6 +187,7 @@ const AH_DEVICE_ID AslDeviceIds[] = {"ACPI0011", "Generic Buttons Device"}, {"ACPI0012", "NVDIMM Root Device"}, {"ACPI0013", "Generic Event Device"}, + {"ACPI0014", "Wireless Power Calibration Device"}, {"ADMA0F28", "Intel Audio DMA"}, {"AMCR0F28", "Intel Audio Machine Driver"}, {"ATK4001", "Asus Radio Control Button"}, diff --git a/source/common/ahpredef.c b/source/common/ahpredef.c index 41e19f687b8a..edcfa2f04301 100644 --- a/source/common/ahpredef.c +++ b/source/common/ahpredef.c @@ -254,6 +254,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_FPS", "Fan Performance States", "Returns a list of supported fan performance states"), AH_PREDEF ("_FSL", "Fan Set Level", "Control method that sets the fan device's speed level (performance state)"), AH_PREDEF ("_FST", "Fan Status", "Returns current status information for a fan device"), + AH_PREDEF ("_FUN", "Function Number", "Resource descriptor field"), AH_PREDEF ("_GAI", "Get Averaging Interval", "Returns the power meter averaging interval"), AH_PREDEF ("_GCP", "Get Capabilities", "Get device time capabilities"), AH_PREDEF ("_GHL", "Get Hardware Limit", "Returns the hardware limit enforced by the power meter"), @@ -270,6 +271,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_GWS", "Get Wake Status", "Return status of wake alarms"), AH_PREDEF ("_HE_", "High-Edge", "Interrupt triggering, Resource Descriptor field"), AH_PREDEF ("_HID", "Hardware ID", "Returns a device's Plug and Play Hardware ID"), + AH_PREDEF ("_HMA", "Heterogeneous Memory Attributes", "Returns a list of HMAT structures."), AH_PREDEF ("_HOT", "Hot Temperature", "Returns the critical temperature for sleep (entry to S4)"), AH_PREDEF ("_HPP", "Hot Plug Parameters", "Returns a list of hot-plug information for a PCI device"), AH_PREDEF ("_HPX", "Hot Plug Parameter Extensions", "Returns a list of hot-plug information for a PCI device. Supersedes _HPP"), @@ -287,6 +289,9 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_LL_", "Low Level", "Interrupt polarity, Resource Descriptor field"), AH_PREDEF ("_LPD", "Low Power Dependencies", "Returns a list of dependencies for low power idle entry"), AH_PREDEF ("_LPI", "Low Power Idle States", "Returns a list of supported low power idle states"), + AH_PREDEF ("_LSI", "Label Storage Information", "Returns information about the Label Storage Area associated with the NVDIMM object."), + AH_PREDEF ("_LSR", "Label Storage Read", "Returns label data from the Label Storage Area of the NVDIMM object."), + AH_PREDEF ("_LSW", "Label Storage Write", "Writes label data in to the Label Storage Area of the NVDIMM object."), AH_PREDEF ("_MAF", "Maximum Address Fixed", "Resource Descriptor field"), AH_PREDEF ("_MAT", "Multiple APIC Table Entry", "Returns a list of MADT APIC structure entries"), AH_PREDEF ("_MAX", "Maximum Base Address", "Resource Descriptor field"), @@ -439,6 +444,7 @@ const AH_PREDEFINED_NAME AslPredefinedInfo[] = AH_PREDEF ("_UPC", "USB Port Capabilities", "Returns a list of USB port capabilities"), AH_PREDEF ("_UPD", "User Presence Detect", "Returns user detection information"), AH_PREDEF ("_UPP", "User Presence Polling", "Returns the recommended user presence polling interval"), + AH_PREDEF ("_VAL", "Pin Configuration Value", "Resource Descriptor field"), AH_PREDEF ("_VEN", "Vendor Data", "Resource Descriptor field"), AH_PREDEF ("_VPO", "Video Post Options", "Returns the implemented video post options"), AH_PREDEF ("_Wxx", "Wake Event", "Method executed as a result of a wake event"), diff --git a/source/common/ahtable.c b/source/common/ahtable.c index 42a7944f5f95..38c1ea20e72c 100644 --- a/source/common/ahtable.c +++ b/source/common/ahtable.c @@ -218,6 +218,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_FPDT, "Firmware Performance Data Table"}, {ACPI_SIG_GTDT, "Generic Timer Description Table"}, {ACPI_SIG_HEST, "Hardware Error Source Table"}, + {ACPI_SIG_HMAT, "Heterogeneous Memory Attributes Table"}, {ACPI_SIG_HPET, "High Precision Event Timer table"}, {ACPI_SIG_IORT, "IO Remapping Table"}, {ACPI_SIG_IVRS, "I/O Virtualization Reporting Structure"}, @@ -232,6 +233,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, + {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, {ACPI_RSDP_NAME,"Root System Description Pointer"}, {ACPI_SIG_RSDT, "Root System Description Table"}, @@ -253,6 +255,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {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_XENV, "Xen Environment table"}, {ACPI_SIG_XSDT, "Extended System Description Table"}, {NULL, NULL} diff --git a/source/common/ahuuids.c b/source/common/ahuuids.c index f2b6244305b0..6e018a302c21 100644 --- a/source/common/ahuuids.c +++ b/source/common/ahuuids.c @@ -186,6 +186,10 @@ const AH_UUID Gbl_AcpiUuids[] = {"Persistent Virtual Disk", UUID_PERSISTENT_VIRTUAL_DISK}, {"Persistent Virtual CD", UUID_PERSISTENT_VIRTUAL_CD}, + {"[Processor Properties]", NULL}, + {"Cache Properties", UUID_CACHE_PROPERTIES}, + {"Physical Package Property", UUID_PHYSICAL_PROPERTY}, + {"[Miscellaneous]", NULL}, {"Platform-wide Capabilities", UUID_PLATFORM_CAPABILITIES}, {"Dynamic Enumeration", UUID_DYNAMIC_ENUMERATION}, diff --git a/source/common/dmextern.c b/source/common/dmextern.c index 818d2adc2052..6ae3c3793a86 100644 --- a/source/common/dmextern.c +++ b/source/common/dmextern.c @@ -199,6 +199,9 @@ static const char *AcpiGbl_DmTypeNames[] = #define METHOD_SEPARATORS " \t,()\n" +static const char *ExternalConflictMessage = + " // Conflicts with a later declaration"; + /* Local prototypes */ @@ -211,6 +214,16 @@ AcpiDmNormalizeParentPrefix ( ACPI_PARSE_OBJECT *Op, char *Path); +static ACPI_STATUS +AcpiDmGetExternalAndInternalPath ( + ACPI_NAMESPACE_NODE *Node, + char **ExternalPath, + char **InternalPath); + +static ACPI_STATUS +AcpiDmRemoveRootPrefix ( + char **Path); + static void AcpiDmAddPathToExternalList ( char *Path, @@ -226,6 +239,21 @@ AcpiDmCreateNewExternal ( UINT32 Value, UINT16 Flags); +static void +AcpiDmCheckForExternalConflict ( + char *Path); + +static ACPI_STATUS +AcpiDmResolveExternal ( + char *Path, + UINT8 Type, + ACPI_NAMESPACE_NODE **Node); + + +static void +AcpiDmConflictingDeclaration ( + char *Path); + /******************************************************************************* * @@ -582,7 +610,7 @@ AcpiDmGetExternalsFromFile ( { /* Add the external(s) to the namespace */ - AcpiDmAddExternalsToNamespace (); + AcpiDmAddExternalListToNamespace (); AcpiOsPrintf ("%s: Imported %u external method definitions\n", Gbl_ExternalRefFilename, ImportCount); @@ -696,6 +724,86 @@ AcpiDmAddOpToExternalList ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmGetExternalAndInternalPath + * + * PARAMETERS: Node - Namespace node for object to be added + * ExternalPath - Will contain the external path of the node + * InternalPath - Will contain the internal path of the node + * + * RETURN: None + * + * DESCRIPTION: Get the External and Internal path from the given node. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmGetExternalAndInternalPath ( + ACPI_NAMESPACE_NODE *Node, + char **ExternalPath, + char **InternalPath) +{ + ACPI_STATUS Status; + + + if (!Node) + { + return (AE_BAD_PARAMETER); + } + + /* Get the full external and internal pathnames to the node */ + + *ExternalPath = AcpiNsGetExternalPathname (Node); + if (!*ExternalPath) + { + return (AE_BAD_PATHNAME); + } + + Status = AcpiNsInternalizeName (*ExternalPath, InternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (*ExternalPath); + return (Status); + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmRemoveRootPrefix + * + * PARAMETERS: Path - Remove Root prefix from this Path + * + * RETURN: None + * + * DESCRIPTION: Remove the root prefix character '\' from Path. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmRemoveRootPrefix ( + char **Path) +{ + char *InputPath = *Path; + + + if ((*InputPath == AML_ROOT_PREFIX) && (InputPath[1])) + { + if (!memmove(InputPath, InputPath+1, strlen(InputPath))) + { + return (AE_ERROR); + } + + *Path = InputPath; + } + + return (AE_OK); +} + + /******************************************************************************* * * FUNCTION: AcpiDmAddNodeToExternalList @@ -727,46 +835,27 @@ AcpiDmAddNodeToExternalList ( { char *ExternalPath; char *InternalPath; - char *Temp; ACPI_STATUS Status; ACPI_FUNCTION_TRACE (DmAddNodeToExternalList); - - if (!Node) - { - return_VOID; - } - /* Get the full external and internal pathnames to the node */ - ExternalPath = AcpiNsGetExternalPathname (Node); - if (!ExternalPath) - { - return_VOID; - } - - Status = AcpiNsInternalizeName (ExternalPath, &InternalPath); + Status = AcpiDmGetExternalAndInternalPath (Node, &ExternalPath, &InternalPath); if (ACPI_FAILURE (Status)) { - ACPI_FREE (ExternalPath); return_VOID; } /* Remove the root backslash */ - if ((*ExternalPath == AML_ROOT_PREFIX) && (ExternalPath[1])) + Status = AcpiDmRemoveRootPrefix (&ExternalPath); + if (ACPI_FAILURE (Status)) { - Temp = ACPI_ALLOCATE_ZEROED (strlen (ExternalPath) + 1); - if (!Temp) - { - return_VOID; - } - - strcpy (Temp, &ExternalPath[1]); ACPI_FREE (ExternalPath); - ExternalPath = Temp; + ACPI_FREE (InternalPath); + return_VOID; } /* Create the new External() declaration node */ @@ -1013,68 +1102,171 @@ AcpiDmCreateNewExternal ( /******************************************************************************* * - * FUNCTION: AcpiDmAddExternalsToNamespace + * FUNCTION: AcpiDmResolveExternal * - * PARAMETERS: None + * PARAMETERS: Path - Path of the external + * Type - Type of the external + * Node - Input node for AcpiNsLookup + * + * RETURN: Status + * + * DESCRIPTION: Resolve the external within the namespace by AcpiNsLookup. + * If the returned node is an external and has the same type + * we assume that it was either an existing external or a + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDmResolveExternal ( + char *Path, + UINT8 Type, + ACPI_NAMESPACE_NODE **Node) +{ + ACPI_STATUS Status; + + + Status = AcpiNsLookup (NULL, Path, Type, + ACPI_IMODE_LOAD_PASS1, + ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, + NULL, Node); + + if (!Node) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "while adding external to namespace [%s]", Path)); + } + + /* Note the asl code "external(a) external(a)" is acceptable ASL */ + + else if ((*Node)->Type == Type && + (*Node)->Flags & ANOBJ_IS_EXTERNAL) + { + return (AE_OK); + } + else + { + ACPI_EXCEPTION ((AE_INFO, AE_ERROR, + "[%s] has conflicting declarations", Path)); + } + + return (AE_ERROR); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmCreateSubobjectForExternal + * + * PARAMETERS: Type - Type of the external + * Node - Namespace node from AcpiNsLookup + * ParamCount - Value to be used for Method * * RETURN: None * - * DESCRIPTION: Add all externals to the namespace. Allows externals to be + * DESCRIPTION: Add one external to the namespace. Allows external to be * "resolved". * ******************************************************************************/ void -AcpiDmAddExternalsToNamespace ( - void) +AcpiDmCreateSubobjectForExternal ( + UINT8 Type, + ACPI_NAMESPACE_NODE **Node, + UINT32 ParamCount) { - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; - while (External) + switch (Type) { - /* Add the external name (object) into the namespace */ + case ACPI_TYPE_METHOD: - Status = AcpiNsLookup (NULL, External->InternalPath, External->Type, - ACPI_IMODE_LOAD_PASS1, - ACPI_NS_ERROR_IF_FOUND | ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); + /* For methods, we need to save the argument count */ - if (ACPI_FAILURE (Status)) - { - ACPI_EXCEPTION ((AE_INFO, Status, - "while adding external to namespace [%s]", - External->Path)); - } + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); + ObjDesc->Method.ParamCount = (UINT8) ParamCount; + (*Node)->Object = ObjDesc; + break; - else switch (External->Type) - { - case ACPI_TYPE_METHOD: + case ACPI_TYPE_REGION: - /* For methods, we need to save the argument count */ + /* Regions require a region sub-object */ - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD); - ObjDesc->Method.ParamCount = (UINT8) External->Value; - Node->Object = ObjDesc; - break; + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); + ObjDesc->Region.Node = *Node; + (*Node)->Object = ObjDesc; + break; - case ACPI_TYPE_REGION: + default: - /* Regions require a region sub-object */ + break; + } +} - ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_REGION); - ObjDesc->Region.Node = Node; - Node->Object = ObjDesc; - break; - default: +/******************************************************************************* + * + * FUNCTION: AcpiDmAddOneExternalToNamespace + * + * PARAMETERS: Path - External parse object + * Type - Type of parse object + * ParamCount - External method parameter count + * + * RETURN: None + * + * DESCRIPTION: Add one external to the namespace by resolvign the external + * (by performing a namespace lookup) and annotating the resulting + * namespace node with the approperiate information if the type + * is ACPI_TYPE_REGION or ACPI_TYPE_METHOD. + * + ******************************************************************************/ + +void +AcpiDmAddOneExternalToNamespace ( + char *Path, + UINT8 Type, + UINT32 ParamCount) +{ + ACPI_STATUS Status; + ACPI_NAMESPACE_NODE *Node; - break; - } + Status = AcpiDmResolveExternal (Path, Type, &Node); + + if (ACPI_FAILURE (Status)) + { + return; + } + + AcpiDmCreateSubobjectForExternal (Type, &Node, ParamCount); + +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmAddExternalListToNamespace + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Add all externals within AcpiGbl_ExternalList to the namespace. + * Allows externals to be "resolved". + * + ******************************************************************************/ + +void +AcpiDmAddExternalListToNamespace ( + void) +{ + ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; + + + while (External) + { + AcpiDmAddOneExternalToNamespace (External->InternalPath, + External->Type, External->Value); External = External->Next; } } @@ -1082,23 +1274,28 @@ AcpiDmAddExternalsToNamespace ( /******************************************************************************* * - * FUNCTION: AcpiDmGetExternalMethodCount + * FUNCTION: AcpiDmGetUnresolvedExternalMethodCount * * PARAMETERS: None * - * RETURN: The number of control method externals in the external list + * RETURN: The number of unresolved control method externals in the + * external list * - * DESCRIPTION: Return the number of method externals that have been generated. - * If any control method externals have been found, we must - * re-parse the entire definition block with the new information - * (number of arguments for the methods.) This is limitation of - * AML, we don't know the number of arguments from the control - * method invocation itself. + * DESCRIPTION: Return the number of unresolved external methods that have been + * generated. If any unresolved control method externals have been + * found, we must re-parse the entire definition block with the new + * information (number of arguments for the methods.) + * This is limitation of AML, we don't know the number of arguments + * from the control method invocation itself. + * + * Note: resolved external control methods are external control + * methods encoded with the AML_EXTERNAL_OP bytecode within the + * AML being disassembled. * ******************************************************************************/ UINT32 -AcpiDmGetExternalMethodCount ( +AcpiDmGetUnresolvedExternalMethodCount ( void) { ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList; @@ -1107,7 +1304,8 @@ AcpiDmGetExternalMethodCount ( while (External) { - if (External->Type == ACPI_TYPE_METHOD) + if (External->Type == ACPI_TYPE_METHOD && + !(External->Flags & ACPI_EXT_ORIGIN_FROM_OPCODE)) { Count++; } @@ -1251,6 +1449,11 @@ AcpiDmEmitExternals ( } } + if (AcpiGbl_ExternalList->Flags &= ACPI_EXT_CONFLICTING_DECLARATION) + { + AcpiOsPrintf ("%s", ExternalConflictMessage); + AcpiDmConflictingDeclaration (AcpiGbl_ExternalList->Path); + } AcpiOsPrintf ("\n"); } @@ -1271,6 +1474,106 @@ AcpiDmEmitExternals ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmMarkExternalConflict + * + * PARAMETERS: Path - Namepath to search + * + * RETURN: ExternalList + * + * DESCRIPTION: Search the AcpiGbl_ExternalList for a matching path + * + ******************************************************************************/ + +void +AcpiDmMarkExternalConflict ( + ACPI_NAMESPACE_NODE *Node) +{ + ACPI_EXTERNAL_LIST *ExternalList = AcpiGbl_ExternalList; + char *ExternalPath; + char *InternalPath; + char *Temp; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (DmMarkExternalConflict); + + + if (Node->Flags & ANOBJ_IS_EXTERNAL) + { + return_VOID; + } + + /* Get the full external and internal pathnames to the node */ + + Status = AcpiDmGetExternalAndInternalPath (Node, + &ExternalPath, &InternalPath); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + + /* Remove the root backslash */ + + Status = AcpiDmRemoveRootPrefix (&InternalPath); + if (ACPI_FAILURE (Status)) + { + ACPI_FREE (InternalPath); + ACPI_FREE (ExternalPath); + return_VOID; + } + + while (ExternalList) + { + Temp = ExternalList->InternalPath; + if ((*ExternalList->InternalPath == AML_ROOT_PREFIX) && + (ExternalList->InternalPath[1])) + { + Temp++; + } + + if (!strcmp (ExternalList->InternalPath, InternalPath)) + { + ExternalList->Flags |= ACPI_EXT_CONFLICTING_DECLARATION; + } + ExternalList = ExternalList->Next; + } + + ACPI_FREE (InternalPath); + ACPI_FREE (ExternalPath); + + return_VOID; +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmConflictingDeclaration + * + * PARAMETERS: Path - Path with conflicting declaration + * + * RETURN: None + * + * DESCRIPTION: Emit a warning when printing conflicting ASL external + * declarations. + * + ******************************************************************************/ + +static void +AcpiDmConflictingDeclaration ( + char *Path) +{ + fprintf (stderr, + " Warning - Emitting ASL code \"External (%s)\"\n" + " This is a conflicting declaration with some " + "other declaration within the ASL code.\n" + " This external declaration may need to be " + "deleted in order to recompile the dsl file.\n\n", + Path); +} + + /******************************************************************************* * * FUNCTION: AcpiDmEmitExternal @@ -1280,7 +1583,8 @@ AcpiDmEmitExternals ( * RETURN: None * * DESCRIPTION: Emit an External() ASL statement for the current External - * parse object + * parse object. Note: External Ops are named types so the + * namepath is contained within NameOp->Name.Path. * ******************************************************************************/ @@ -1290,12 +1594,74 @@ AcpiDmEmitExternal ( ACPI_PARSE_OBJECT *TypeOp) { AcpiOsPrintf ("External ("); - AcpiDmNamestring (NameOp->Common.Value.Name); - AcpiOsPrintf ("%s)\n", + AcpiDmNamestring (NameOp->Named.Path); + AcpiOsPrintf ("%s)", AcpiDmGetObjectTypeName ((ACPI_OBJECT_TYPE) TypeOp->Common.Value.Integer)); + AcpiDmCheckForExternalConflict (NameOp->Named.Path); + AcpiOsPrintf ("\n"); } +/******************************************************************************* + * + * FUNCTION: AcpiDmCheckForExternalConflict + * + * PARAMETERS: Path - Path to check + * + * RETURN: None + * + * DESCRIPTION: Search the External List to see if the input Path has a + * conflicting declaration. + * + ******************************************************************************/ + +static void +AcpiDmCheckForExternalConflict ( + char *Path) +{ + ACPI_EXTERNAL_LIST *ExternalList = AcpiGbl_ExternalList; + char *ListItemPath; + char *InputPath; + + + if (!Path) + { + return; + } + + /* Move past the root prefix '\' */ + + InputPath = Path; + if ((*InputPath == AML_ROOT_PREFIX) && InputPath[1]) + { + InputPath++; + } + + while (ExternalList) + { + ListItemPath = ExternalList->Path; + if (ListItemPath) + { + /* Move past the root prefix '\' */ + + if ((*ListItemPath == AML_ROOT_PREFIX) && + ListItemPath[1]) + { + ListItemPath++; + } + + if (!strcmp (ListItemPath, InputPath) && + (ExternalList->Flags & ACPI_EXT_CONFLICTING_DECLARATION)) + { + AcpiOsPrintf ("%s", ExternalConflictMessage); + AcpiDmConflictingDeclaration (Path); + + return; + } + } + ExternalList = ExternalList->Next; + } +} /******************************************************************************* * * FUNCTION: AcpiDmUnresolvedWarning @@ -1311,7 +1677,7 @@ AcpiDmEmitExternal ( * ******************************************************************************/ -#if 0 +/* Summary of the external control method problem: When the -e option is used with disassembly, the various SSDTs are simply @@ -1380,7 +1746,7 @@ disassembler, otherwise it does not know how to handle the method invocations. In other words, if ABCD and EFGH are actually external control methods appearing in an SSDT, the disassembler does not know what to do unless the owning SSDT has been loaded via the -e option. -#endif +*/ static char ExternalWarningPart1[600]; static char ExternalWarningPart2[400]; diff --git a/source/common/dmrestag.c b/source/common/dmrestag.c index 7753388a5b3e..5ba0f6b4feb5 100644 --- a/source/common/dmrestag.c +++ b/source/common/dmrestag.c @@ -424,6 +424,34 @@ static const ACPI_RESOURCE_TAG AcpiDmUartSerialBusTags[] = {0, NULL} }; +/* Subtype tables for PinFunction descriptor */ + +static const ACPI_RESOURCE_TAG AcpiDmPinFunctionTags[] = +{ + {( 4 * 8), ACPI_RESTAG_INTERRUPTSHARE}, + {( 6 * 8), ACPI_RESTAG_PINCONFIG}, + {( 7 * 8), ACPI_RESTAG_FUNCTION}, + {0, NULL} +}; + +/* Subtype tables for PinConfig descriptor */ + +static const ACPI_RESOURCE_TAG AcpiDmPinConfigTags[] = +{ + {( 4 * 8), ACPI_RESTAG_INTERRUPTSHARE}, + {( 6 * 8), ACPI_RESTAG_PINCONFIG_TYPE}, + {( 7 * 8), ACPI_RESTAG_PINCONFIG_VALUE}, + {0, NULL} +}; + +/* Subtype tables for PinGroupFunction descriptor */ + +static const ACPI_RESOURCE_TAG AcpiDmPinGroupFunctionTags[] = +{ + {( 6 * 8), ACPI_RESTAG_FUNCTION}, + {0, NULL} +}; + /* Subtype tables for Address descriptor type-specific flags */ static const ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] = @@ -488,8 +516,12 @@ static const ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags[] = AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ AcpiDmExtendedAddressTags, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ NULL, /* 0x0C, ACPI_RESOURCE_NAME_GPIO - Use Subtype table below */ - NULL, /* 0x0D, Reserved */ - NULL /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use Subtype table below */ + AcpiDmPinFunctionTags, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ + NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use Subtype table below */ + AcpiDmPinConfigTags, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ + NULL, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ + AcpiDmPinGroupFunctionTags, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ + AcpiDmPinConfigTags, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG - Same as PinConfig */ }; /* GPIO Subtypes */ diff --git a/source/common/dmswitch.c b/source/common/dmswitch.c new file mode 100644 index 000000000000..1641cbf9adea --- /dev/null +++ b/source/common/dmswitch.c @@ -0,0 +1,679 @@ +/****************************************************************************** + * + * Module Name: adwalk - Disassembler routines for switch statements + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acparser.h" +#include "amlcode.h" +#include "acdisasm.h" +#include "acdispat.h" +#include "acnamesp.h" +#include "acapps.h" + + +#define _COMPONENT ACPI_CA_DISASSEMBLER + ACPI_MODULE_NAME ("dmswitch") + +static BOOLEAN +AcpiDmIsSwitchBlock ( + ACPI_PARSE_OBJECT *Op, + char **Temp); + +static BOOLEAN +AcpiDmIsCaseBlock ( + ACPI_PARSE_OBJECT *Op); + + +/******************************************************************************* + * + * FUNCTION: AcpiDmProcessSwitch + * + * PARAMETERS: Op - Object to be examined + * + * RETURN: ACPI_STATUS + * + * DESCRIPTION: Walk function to create a list of all temporary (_T_) objects. + * If a While loop is found that can be converted to a Switch, do + * the conversion, remove the temporary name from the list, and + * mark the parse op with an IGNORE flag. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDmProcessSwitch ( + ACPI_PARSE_OBJECT *Op) +{ + char *Temp = NULL; + ACPI_PARSE_OBJECT_LIST *NewTemp; + ACPI_PARSE_OBJECT_LIST *Current; + ACPI_PARSE_OBJECT_LIST *Previous; + BOOLEAN FoundTemp = FALSE; + + + switch (Op->Common.AmlOpcode) + { + case AML_NAME_OP: + + Temp = (char *) (&Op->Named.Name); + + if (!strncmp(Temp, "_T_", 3)) + { + /* Allocate and init a new Temp List node */ + + NewTemp = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PARSE_OBJECT_LIST)); + if (!NewTemp) + { + return (AE_NO_MEMORY); + } + + if (AcpiGbl_TempListHead) + { + Current = AcpiGbl_TempListHead; + AcpiGbl_TempListHead = NewTemp; + AcpiGbl_TempListHead->Op = Op; + AcpiGbl_TempListHead->Next = Current; + } + else + { + AcpiGbl_TempListHead = NewTemp; + AcpiGbl_TempListHead->Op = Op; + AcpiGbl_TempListHead->Next = NULL; + } + } + break; + + case AML_WHILE_OP: + + if (!AcpiDmIsSwitchBlock (Op, &Temp)) + { + break; + } + + /* Found a Switch */ + + Op->Common.DisasmOpcode = ACPI_DASM_SWITCH; + + Previous = Current = AcpiGbl_TempListHead; + while (Current) + { + /* Note, if we get here Temp is not NULL */ + + if (!strncmp(Temp, (char *) (&Current->Op->Named.Name), 4)) + { + /* Match found. Ignore disassembly */ + + Current->Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + + /* Remove from list */ + + if (Current == AcpiGbl_TempListHead) + { + AcpiGbl_TempListHead = Current->Next; + } + else + { + Previous->Next = Current->Next; + } + + Current->Op = NULL; + Current->Next = NULL; + ACPI_FREE (Current); + FoundTemp = TRUE; + break; + } + + Previous = Current; + Current = Current->Next; + } + + if (!FoundTemp) + { + fprintf (stderr, + "Warning: Declaration for temp name %.4s not found\n", Temp); + } + break; + + default: + break; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmClearTempList + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Removes any remaining temporary objects from global list and + * frees + * + ******************************************************************************/ + +void +AcpiDmClearTempList ( + void) +{ + ACPI_PARSE_OBJECT_LIST *Current; + + + while (AcpiGbl_TempListHead) + { + Current = AcpiGbl_TempListHead; + AcpiGbl_TempListHead = AcpiGbl_TempListHead->Next; + Current->Op = NULL; + Current->Next = NULL; + ACPI_FREE (Current); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsSwitchBlock + * + * PARAMETERS: Op - While Object + * + * RETURN: TRUE if While block can be converted to a Switch/Case block + * + * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies + * parse tree to allow for Switch/Case disassembly during walk. + * + * EXAMPLE: Example of parse tree to be converted + * + * While + * One + * Store + * ByteConst + * -NamePath- + * If + * LEqual + * -NamePath- + * Zero + * Return + * One + * Else + * Return + * WordConst + * Break + * + ******************************************************************************/ + +BOOLEAN +AcpiDmIsSwitchBlock ( + ACPI_PARSE_OBJECT *Op, + char **Temp) +{ + ACPI_PARSE_OBJECT *OneOp; + ACPI_PARSE_OBJECT *StoreOp; + ACPI_PARSE_OBJECT *NamePathOp; + ACPI_PARSE_OBJECT *PredicateOp; + ACPI_PARSE_OBJECT *CurrentOp; + ACPI_PARSE_OBJECT *TempOp; + + + /* Check for One Op Predicate */ + + OneOp = AcpiPsGetArg (Op, 0); + if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP)) + { + return (FALSE); + } + + /* Check for Store Op */ + + StoreOp = OneOp->Common.Next; + if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP)) + { + return (FALSE); + } + + /* Check for Name Op with _T_ string */ + + NamePathOp = AcpiPsGetArg (StoreOp, 1); + if (!NamePathOp || + (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) + { + return (FALSE); + } + + if (strncmp ((char *) (NamePathOp->Common.Value.Name), "_T_", 3)) + { + return (FALSE); + } + + *Temp = (char *) (NamePathOp->Common.Value.Name); + + /* This is a Switch/Case control block */ + + /* Ignore the One Op Predicate */ + + OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + + /* Ignore the Store Op, but not the children */ + + StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; + + /* + * First arg of Store Op is the Switch condition. + * Mark it as a Switch predicate and as a parameter list for paren + * closing and correct indentation. + */ + PredicateOp = AcpiPsGetArg (StoreOp, 0); + PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + + /* Ignore the Name Op */ + + NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; + + /* Remaining opcodes are the Case statements (If/ElseIf's) */ + + CurrentOp = StoreOp->Common.Next; + while (AcpiDmIsCaseBlock (CurrentOp)) + { + /* Block is a Case structure */ + + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + /* ElseIf */ + + CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + } + + /* If */ + + CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; + + /* + * Mark the parse tree for Case disassembly. There are two + * types of Case statements. The first type of statement begins with + * an LEqual. The second starts with an LNot and uses a Match statement + * on a Package of constants. + */ + TempOp = AcpiPsGetArg (CurrentOp, 0); + switch (TempOp->Common.AmlOpcode) + { + case (AML_LOGICAL_EQUAL_OP): + + /* Ignore just the LEqual Op */ + + TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; + + /* Ignore the NamePath Op */ + + TempOp = AcpiPsGetArg (TempOp, 0); + TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; + + /* + * Second arg of LEqual will be the Case predicate. + * Mark it as a predicate and also as a parameter list for paren + * closing and correct indentation. + */ + PredicateOp = TempOp->Common.Next; + PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + break; + + case (AML_LOGICAL_NOT_OP): + + /* + * The Package will be the predicate of the Case statement. + * It's under: + * LNOT + * LEQUAL + * MATCH + * PACKAGE + */ + + /* Get the LEqual Op from LNot */ + + TempOp = AcpiPsGetArg (TempOp, 0); + + /* Get the Match Op from LEqual */ + + TempOp = AcpiPsGetArg (TempOp, 0); + + /* Get the Package Op from Match */ + + PredicateOp = AcpiPsGetArg (TempOp, 0); + + /* Mark as parameter list for paren closing */ + + PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; + + /* + * The Package list would be too deeply indented if we + * chose to simply ignore the all the parent opcodes, so + * we rearrange the parse tree instead. + */ + + /* + * Save the second arg of the If/Else Op which is the + * block code of code for this Case statement. + */ + TempOp = AcpiPsGetArg (CurrentOp, 1); + + /* + * Move the Package Op to the child (predicate) of the + * Case statement. + */ + CurrentOp->Common.Value.Arg = PredicateOp; + PredicateOp->Common.Parent = CurrentOp; + + /* Add the block code */ + + PredicateOp->Common.Next = TempOp; + break; + + default: + + /* Should never get here */ + break; + } + + /* Advance to next Case block */ + + CurrentOp = CurrentOp->Common.Next; + } + + /* If CurrentOp is now an Else, then this is a Default block */ + + if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT; + } + + /* + * From the first If advance to the Break op. It's possible to + * have an Else (Default) op here when there is only one Case + * statement, so check for it. + */ + CurrentOp = StoreOp->Common.Next->Common.Next; + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp = CurrentOp->Common.Next; + } + + /* Ignore the Break Op */ + + CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; + return (TRUE); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmIsCaseBlock + * + * PARAMETERS: Op - Object to test + * + * RETURN: TRUE if Object is beginning of a Case block. + * + * DESCRIPTION: Determines if an Object is the beginning of a Case block for a + * Switch/Case statement. Parse tree must be one of the following + * forms: + * + * Else (Optional) + * If + * LEqual + * -NamePath- _T_x + * + * Else (Optional) + * If + * LNot + * LEqual + * Match + * Package + * ByteConst + * -NamePath- _T_x + * + ******************************************************************************/ + +static BOOLEAN +AcpiDmIsCaseBlock ( + ACPI_PARSE_OBJECT *Op) +{ + ACPI_PARSE_OBJECT *CurrentOp; + + + if (!Op) + { + return (FALSE); + } + + /* Look for an If or ElseIf */ + + CurrentOp = Op; + if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) + { + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp) + { + return (FALSE); + } + } + + if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP) + { + return (FALSE); + } + + /* Child must be LEqual or LNot */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp) + { + return (FALSE); + } + + switch (CurrentOp->Common.AmlOpcode) + { + case (AML_LOGICAL_EQUAL_OP): + + /* Next child must be NamePath with string _T_ */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || !CurrentOp->Common.Value.Name || + strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) + { + return (FALSE); + } + break; + + case (AML_LOGICAL_NOT_OP): + + /* Child of LNot must be LEqual op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LOGICAL_EQUAL_OP)) + { + return (FALSE); + } + + /* Child of LNot must be Match op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP)) + { + return (FALSE); + } + + /* First child of Match must be Package op */ + + CurrentOp = AcpiPsGetArg (CurrentOp, 0); + if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP)) + { + return (FALSE); + } + + /* Third child of Match must be NamePath with string _T_ */ + + CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2); + if (!CurrentOp || !CurrentOp->Common.Value.Name || + strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) + { + return (FALSE); + } + break; + + default: + + return (FALSE); + } + + return (TRUE); +} diff --git a/source/common/dmtable.c b/source/common/dmtable.c index 4befd14d9455..b85bb0c3aa75 100644 --- a/source/common/dmtable.c +++ b/source/common/dmtable.c @@ -298,6 +298,7 @@ static const char *AcpiDmHestSubnames[] = "PCI Express/PCI-X Bridge AER", "Generic Hardware Error Source", "Generic Hardware Error Source V2", + "IA-32 Deferred Machine Check", "Unknown Subtable Type" /* Reserved */ }; @@ -314,9 +315,18 @@ static const char *AcpiDmHestNotifySubnames[] = "SEA", /* ACPI 6.1 */ "SEI", /* ACPI 6.1 */ "GSIV", /* ACPI 6.1 */ + "Software Delegated Exception", /* ACPI 6.2 */ "Unknown Notify Type" /* Reserved */ }; +static const char *AcpiDmHmatSubnames[] = +{ + "Memory Subystem Address Range", + "System Locality Latency and Bandwidth Information", + "Memory Side Cache Information", + "Unknown Structure Type" /* Reserved */ +}; + static const char *AcpiDmMadtSubnames[] = { "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ @@ -355,6 +365,8 @@ static const char *AcpiDmPcctSubnames[] = "Generic Communications Subspace", /* ACPI_PCCT_TYPE_GENERIC_SUBSPACE */ "HW-Reduced Comm Subspace", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE */ "HW-Reduced Comm Subspace Type2", /* ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 */ + "Extended PCC Master Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE */ + "Extended PCC Slave Subspace", /* ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE */ "Unknown Subtable Type" /* Reserved */ }; @@ -366,12 +378,21 @@ static const char *AcpiDmPmttSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmPpttSubnames[] = +{ + "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */ + "Cache Type", /* ACPI_PPTT_TYPE_CACHE */ + "ID", /* ACPI_PMTT_TYPE_ID */ + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmSratSubnames[] = { "Processor Local APIC/SAPIC Affinity", "Memory Affinity", "Processor Local x2APIC Affinity", "GICC Affinity", + "GIC ITS Affinity", /* Acpi 6.2 */ "Unknown Subtable Type" /* Reserved */ }; @@ -452,6 +473,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_FPDT, NULL, AcpiDmDumpFpdt, DtCompileFpdt, TemplateFpdt}, {ACPI_SIG_GTDT, NULL, AcpiDmDumpGtdt, DtCompileGtdt, TemplateGtdt}, {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest}, + {ACPI_SIG_HMAT, NULL, AcpiDmDumpHmat, DtCompileHmat, TemplateHmat}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet}, {ACPI_SIG_IORT, NULL, AcpiDmDumpIort, DtCompileIort, TemplateIort}, {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs}, @@ -466,6 +488,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, + {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt}, {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, @@ -485,6 +508,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt}, {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt}, {ACPI_SIG_WPBT, NULL, AcpiDmDumpWpbt, DtCompileWpbt, TemplateWpbt}, + {ACPI_SIG_WSMT, AcpiDmTableInfoWsmt, NULL, NULL, TemplateWsmt}, {ACPI_SIG_XENV, AcpiDmTableInfoXenv, NULL, NULL, TemplateXenv}, {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt}, {NULL, NULL, NULL, NULL, NULL} @@ -891,6 +915,7 @@ AcpiDmDumpTable ( case ACPI_DMT_MADT: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: + case ACPI_DMT_PPTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -907,6 +932,7 @@ AcpiDmDumpTable ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_HMAT: case ACPI_DMT_NFIT: ByteLength = 2; @@ -1088,6 +1114,31 @@ AcpiDmDumpTable ( AcpiOsPrintf ("%1.1X\n", (*Target >> 4) & 0x03); break; + case ACPI_DMT_FLAGS4_0: + + AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target) & 0x0F); + break; + + case ACPI_DMT_FLAGS4_4: + + AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 4) & 0x0F); + break; + + case ACPI_DMT_FLAGS4_8: + + AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 8) & 0x0F); + break; + + case ACPI_DMT_FLAGS4_12: + + AcpiOsPrintf ("%1.1X\n", (*(UINT32 *)Target >> 12) & 0x0F); + break; + + case ACPI_DMT_FLAGS16_16: + + AcpiOsPrintf ("%4.4X\n", (*(UINT32 *)Target >> 16) & 0xFFFF); + break; + /* Integer Data Types */ case ACPI_DMT_UINT8: @@ -1409,6 +1460,20 @@ AcpiDmDumpTable ( AcpiDmHestNotifySubnames[Temp8]); break; + case ACPI_DMT_HMAT: + + /* HMAT subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_HMAT_TYPE_RESERVED) + { + Temp16 = ACPI_HMAT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT16_FORMAT, *Target, + AcpiDmHmatSubnames[Temp16]); + break; + case ACPI_DMT_IORTMEM: AcpiOsPrintf (STRING_FORMAT, @@ -1480,6 +1545,20 @@ AcpiDmDumpTable ( AcpiDmPmttSubnames[Temp8]); break; + case ACPI_DMT_PPTT: + + /* PPTT subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_PPTT_TYPE_RESERVED) + { + Temp8 = ACPI_PPTT_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmPpttSubnames[Temp8]); + break; + case ACPI_DMT_UNICODE: if (ByteLength == 0) diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c index e9339a8ba020..9441ca494ffc 100644 --- a/source/common/dmtbdump.c +++ b/source/common/dmtbdump.c @@ -1730,6 +1730,14 @@ AcpiDmDumpHest ( SubTableLength = sizeof (ACPI_HEST_GENERIC_V2); break; + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: + + InfoTable = AcpiDmTableInfoHest11; + SubTableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK); + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK, + SubTable))->NumHardwareBanks; + break; + default: /* Cannot continue on unknown type - no length */ @@ -1782,6 +1790,203 @@ AcpiDmDumpHest ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpHmat + * + * PARAMETERS: Table - A HMAT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a HMAT. + * + ******************************************************************************/ + +void +AcpiDmDumpHmat ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_HMAT_STRUCTURE *HmatStruct; + ACPI_HMAT_LOCALITY *HmatLocality; + ACPI_HMAT_CACHE *HmatCache; + UINT32 Offset; + UINT32 SubTableOffset; + UINT32 Length; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 i, j; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoHmat); + if (ACPI_FAILURE (Status)) + { + return; + } + Offset = sizeof (ACPI_TABLE_HMAT); + + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + SubTableOffset = 0; + + /* Dump HMAT structure header */ + + HmatStruct = ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, Table, Offset); + if (HmatStruct->Length < sizeof (ACPI_HMAT_STRUCTURE)) + { + AcpiOsPrintf ("Invalid HMAT structure length\n"); + return; + } + Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct, + HmatStruct->Length, AcpiDmTableInfoHmatHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_ADDRESS_RANGE: + + InfoTable = AcpiDmTableInfoHmat0; + Length = sizeof (ACPI_HMAT_ADDRESS_RANGE); + break; + + case ACPI_HMAT_TYPE_LOCALITY: + + InfoTable = AcpiDmTableInfoHmat1; + Length = sizeof (ACPI_HMAT_LOCALITY); + break; + + case ACPI_HMAT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoHmat2; + Length = sizeof (ACPI_HMAT_CACHE); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown HMAT structure type 0x%X\n", + HmatStruct->Type); + + /* Attempt to continue */ + + goto NextSubTable; + } + + /* Dump HMAT structure body */ + + if (HmatStruct->Length < Length) + { + AcpiOsPrintf ("Invalid HMAT structure length\n"); + return; + } + Status = AcpiDmDumpTable (Table->Length, Offset, HmatStruct, + HmatStruct->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Dump HMAT structure additionals */ + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_LOCALITY: + + HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct); + SubTableOffset = sizeof (ACPI_HMAT_LOCALITY); + + /* Dump initiator proximity domains */ + + if ((UINT32)(HmatStruct->Length - SubTableOffset) < + (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4)) + { + AcpiOsPrintf ("Invalid initiator proximity domain number\n"); + return; + } + for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + 4, AcpiDmTableInfoHmat1a); + SubTableOffset += 4; + } + + /* Dump target proximity domains */ + + if ((UINT32)(HmatStruct->Length - SubTableOffset) < + (UINT32)(HmatLocality->NumberOfTargetPDs * 4)) + { + AcpiOsPrintf ("Invalid target proximity domain number\n"); + return; + } + for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + 4, AcpiDmTableInfoHmat1b); + SubTableOffset += 4; + } + + /* Dump latency/bandwidth entris */ + + if ((UINT32)(HmatStruct->Length - SubTableOffset) < + (UINT32)(HmatLocality->NumberOfInitiatorPDs * + HmatLocality->NumberOfTargetPDs * 2)) + { + AcpiOsPrintf ("Invalid latency/bandwidth entry number\n"); + return; + } + for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++) + { + for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + 2, AcpiDmTableInfoHmat1c); + SubTableOffset += 2; + } + } + break; + + case ACPI_HMAT_TYPE_CACHE: + + HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct); + SubTableOffset = sizeof (ACPI_HMAT_CACHE); + + /* Dump SMBIOS handles */ + + if ((UINT32)(HmatStruct->Length - SubTableOffset) < + (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2)) + { + AcpiOsPrintf ("Invalid SMBIOS handle number\n"); + return; + } + for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + 2, AcpiDmTableInfoHmat2a); + SubTableOffset += 2; + } + break; + + default: + + break; + } + +NextSubTable: + /* Point to next HMAT structure subtable */ + + Offset += (HmatStruct->Length); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpIort @@ -3010,6 +3215,16 @@ AcpiDmDumpPcct ( InfoTable = AcpiDmTableInfoPcct2; break; + case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct3; + break; + + case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct4; + break; + default: AcpiOsPrintf ( @@ -3240,6 +3455,136 @@ AcpiDmDumpPmtt ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpPptt + * + * PARAMETERS: Table - A PMTT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a PPTT. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpPptt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_SUBTABLE_HEADER *SubTable; + ACPI_PPTT_PROCESSOR *PpttProcessor; + UINT8 Length; + UINT8 SubTableOffset; + UINT32 Offset = sizeof (ACPI_TABLE_FPDT); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 i; + + + /* There is no main table (other than the standard ACPI header) */ + + /* Subtables */ + + Offset = sizeof (ACPI_TABLE_HEADER); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + + /* Common subtable header */ + + SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); + if (SubTable->Length < sizeof (ACPI_SUBTABLE_HEADER)) + { + AcpiOsPrintf ("Invalid subtable length\n"); + return; + } + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoPpttHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (SubTable->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + InfoTable = AcpiDmTableInfoPptt0; + Length = sizeof (ACPI_PPTT_PROCESSOR); + break; + + case ACPI_PPTT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoPptt1; + Length = sizeof (ACPI_PPTT_CACHE); + break; + + case ACPI_PPTT_TYPE_ID: + + InfoTable = AcpiDmTableInfoPptt2; + Length = sizeof (ACPI_PPTT_ID); + break; + + default: + + AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n", + SubTable->Type); + + /* Attempt to continue */ + + goto NextSubTable; + } + + if (SubTable->Length < Length) + { + AcpiOsPrintf ("Invalid subtable length\n"); + return; + } + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + SubTableOffset = Length; + + switch (SubTable->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, SubTable); + + /* Dump SMBIOS handles */ + + if ((UINT8)(SubTable->Length - SubTableOffset) < + (UINT8)(PpttProcessor->NumberOfPrivResources * 4)) + { + AcpiOsPrintf ("Invalid private resource number\n"); + return; + } + for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++) + { + Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, + ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTableOffset), + 4, AcpiDmTableInfoPptt0a); + SubTableOffset += 4; + } + break; + + default: + + break; + } + +NextSubTable: + /* Point to next subtable */ + + Offset += SubTable->Length; + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpS3pt @@ -3498,6 +3843,11 @@ AcpiDmDumpSrat ( InfoTable = AcpiDmTableInfoSrat3; break; + case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat4; + break; + default: AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", SubTable->Type); diff --git a/source/common/dmtbinfo.c b/source/common/dmtbinfo.c index 4d27267804cb..692763fd43a0 100644 --- a/source/common/dmtbinfo.c +++ b/source/common/dmtbinfo.c @@ -204,6 +204,7 @@ #define ACPI_GTDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_GTDT,f) #define ACPI_HEST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HPET,f) +#define ACPI_HMAT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_HMAT,f) #define ACPI_IORT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IORT,f) #define ACPI_IVRS_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MADT,f) @@ -230,6 +231,7 @@ #define ACPI_WDDT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDDT,f) #define ACPI_WDRT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WDRT,f) #define ACPI_WPBT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WPBT,f) +#define ACPI_WSMT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_WSMT,f) #define ACPI_XENV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_XENV,f) /* Subtables */ @@ -273,8 +275,13 @@ #define ACPI_HEST8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HEST10_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_GENERIC_V2,f) +#define ACPI_HEST11_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_DEFERRED_CHECK,f) #define ACPI_HESTN_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) #define ACPI_HESTB_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) +#define ACPI_HMAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_ADDRESS_RANGE,f) +#define ACPI_HMAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_LOCALITY,f) +#define ACPI_HMAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_CACHE,f) +#define ACPI_HMATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_HMAT_STRUCTURE,f) #define ACPI_IORT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ITS_GROUP,f) #define ACPI_IORT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_NAMED_COMPONENT,f) #define ACPI_IORT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_IORT_ROOT_COMPLEX,f) @@ -329,11 +336,17 @@ #define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f) #define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f) #define ACPI_PCCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f) +#define ACPI_PCCT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f) +#define ACPI_PCCT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f) #define ACPI_PMTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_SOCKET,f) #define ACPI_PMTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_CONTROLLER,f) #define ACPI_PMTT1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_DOMAIN,f) #define ACPI_PMTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_PHYSICAL_COMPONENT,f) #define ACPI_PMTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PMTT_HEADER,f) +#define ACPI_PPTTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) +#define ACPI_PPTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_PROCESSOR,f) +#define ACPI_PPTT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_CACHE,f) +#define ACPI_PPTT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PPTT_ID,f) #define ACPI_S3PTH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_FPDT_HEADER,f) #define ACPI_S3PT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_RESUME,f) #define ACPI_S3PT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_S3PT_SUSPEND,f) @@ -343,6 +356,7 @@ #define ACPI_SRAT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) #define ACPI_SRAT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) #define ACPI_SRAT3_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GICC_AFFINITY,f) +#define ACPI_SRAT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_GIC_ITS_AFFINITY,f) #define ACPI_TCPA_CLIENT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_CLIENT,f) #define ACPI_TCPA_SERVER_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_TCPA_SERVER,f) #define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f) @@ -355,11 +369,14 @@ /* Flags */ +#define ACPI_BGRT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_BGRT,f,o) #define ACPI_DRTM_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_DRTM,f,o) #define ACPI_DRTM1a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_DRTM_RESOURCE,f,o) #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) +#define ACPI_PPTT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PPTT_PROCESSOR,f,o) +#define ACPI_PPTT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PPTT_CACHE,f,o) #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) #define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) @@ -367,6 +384,9 @@ #define ACPI_GTDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_GTDT,f,o) #define ACPI_GTDT0a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_TIMER_ENTRY,f,o) #define ACPI_GTDT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_GTDT_WATCHDOG,f,o) +#define ACPI_HMAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_ADDRESS_RANGE,f,o) +#define ACPI_HMAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_LOCALITY,f,o) +#define ACPI_HMAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HMAT_CACHE,f,o) #define ACPI_IORT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU,f,o) #define ACPI_IORT3a_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_GSI,f,o) #define ACPI_IORT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_IORT_SMMU_V3,f,o) @@ -392,13 +412,17 @@ #define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o) #define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o) #define ACPI_PCCT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f,o) +#define ACPI_PCCT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_MASTER,f,o) +#define ACPI_PCCT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_EXT_PCC_SLAVE,f,o) #define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) #define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) +#define ACPI_WSMT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WSMT,f,o) #define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) #define ACPI_ERST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) #define ACPI_HEST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f,o) #define ACPI_HEST1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_CORRECTED,f,o) #define ACPI_HEST6_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_AER_ROOT,f,o) +#define ACPI_HEST11_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_DEFERRED_CHECK,f,o) /* * Required terminator for all tables below @@ -780,7 +804,10 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = ACPI_DMTABLE_INFO AcpiDmTableInfoBgrt[] = { {ACPI_DMT_UINT16, ACPI_BGRT_OFFSET (Version), "Version", 0}, - {ACPI_DMT_UINT8, ACPI_BGRT_OFFSET (Status), "Status", 0}, + {ACPI_DMT_UINT8, ACPI_BGRT_OFFSET (Status), "Status (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_BGRT_FLAG_OFFSET (Status, 0), "Displayed", 0}, + {ACPI_DMT_FLAGS1, ACPI_BGRT_FLAG_OFFSET (Status, 0), "Orientation Offset", 0}, + {ACPI_DMT_UINT8, ACPI_BGRT_OFFSET (ImageType), "Image Type", 0}, {ACPI_DMT_UINT64, ACPI_BGRT_OFFSET (ImageAddress), "Image Address", 0}, {ACPI_DMT_UINT32, ACPI_BGRT_OFFSET (ImageOffsetX), "Image OffsetX", 0}, @@ -1349,6 +1376,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved", 0}, \ {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags (decoded below)", DT_FLAG}, \ {ACPI_DMT_FLAG0, ACPI_HEST6_FLAG_OFFSET (Aer.Flags,0), "Firmware First", 0}, \ + {ACPI_DMT_FLAG0, ACPI_HEST6_FLAG_OFFSET (Aer.Flags,0), "Global", 0}, \ {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record", 0}, \ @@ -1373,6 +1401,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_HEST0_FLAG_OFFSET (Flags,0), "Firmware First", 0}, + {ACPI_DMT_FLAG2, ACPI_HEST0_FLAG_OFFSET (Flags,0), "GHES Assist", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, @@ -1392,6 +1421,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_HEST1_FLAG_OFFSET (Flags,0), "Firmware First", 0}, + {ACPI_DMT_FLAG2, ACPI_HEST1_FLAG_OFFSET (Flags,0), "GHES Assist", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, @@ -1482,6 +1512,27 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[] = ACPI_DMT_TERMINATOR }; +/* 11: IA32 Deferred Machine Check */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHest11[] = +{ + ACPI_DM_HEST_HEADER, + {ACPI_DMT_UINT16, ACPI_HEST11_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT8, ACPI_HEST11_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_HEST11_FLAG_OFFSET (Flags,0), "Firmware First", 0}, + {ACPI_DMT_FLAG2, ACPI_HEST11_FLAG_OFFSET (Flags,0), "GHES Assist", 0}, + + {ACPI_DMT_UINT8, ACPI_HEST11_OFFSET (Enabled), "Enabled", 0}, + {ACPI_DMT_UINT32, ACPI_HEST11_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, + {ACPI_DMT_UINT32, ACPI_HEST11_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, + {ACPI_DMT_HESTNTFY, ACPI_HEST11_OFFSET (Notify), "Notify", 0}, + {ACPI_DMT_UINT8, ACPI_HEST11_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, + {ACPI_DMT_UINT24, ACPI_HEST11_OFFSET (Reserved2[0]), "Reserved2", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Notification Structure */ + ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = { {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0}, @@ -1535,6 +1586,105 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = }; +/******************************************************************************* + * + * HMAT - Heterogeneous Memory Attributes Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat[] = +{ + {ACPI_DMT_UINT32, ACPI_HMAT_OFFSET (Reserved), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Common HMAT structure header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmatHdr[] = +{ + {ACPI_DMT_HMAT, ACPI_HMATH_OFFSET (Type), "Structure Type", 0}, + {ACPI_DMT_UINT16, ACPI_HMATH_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_HMATH_OFFSET (Length), "Length", 0}, + ACPI_DMT_TERMINATOR +}; + +/* HMAT subtables */ + +/* 0x00: Memory Subsystem Address Range */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat0[] = +{ + {ACPI_DMT_UINT16, ACPI_HMAT0_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_HMAT0_FLAG_OFFSET (Flags,0), "Processor Proximity Domain Valid", 0}, + {ACPI_DMT_FLAG1, ACPI_HMAT0_FLAG_OFFSET (Flags,0), "Memory Proximity Domain Valid", 0}, + {ACPI_DMT_FLAG2, ACPI_HMAT0_FLAG_OFFSET (Flags,0), "Reservation Hint", 0}, + {ACPI_DMT_UINT16, ACPI_HMAT0_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT0_OFFSET (ProcessorPD), "Processor Proximity Domain", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT0_OFFSET (MemoryPD), "Memory Proximity Domain", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT0_OFFSET (Reserved2), "Reserved2", 0}, + {ACPI_DMT_UINT64, ACPI_HMAT0_OFFSET (PhysicalAddressBase), "Physical Address Range Base", 0}, + {ACPI_DMT_UINT64, ACPI_HMAT0_OFFSET (PhysicalAddressLength), "Physical Address Range Size", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0x01: System Locality Latency and Bandwidth Information */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1[] = +{ + {ACPI_DMT_UINT8, ACPI_HMAT1_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAGS4_0, ACPI_HMAT1_FLAG_OFFSET (Flags,0), "Memory Hierarchy", 0}, + {ACPI_DMT_UINT8, ACPI_HMAT1_OFFSET (DataType), "Data Type", 0}, + {ACPI_DMT_UINT16, ACPI_HMAT1_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT1_OFFSET (NumberOfInitiatorPDs), "Initiator Proximity Domains #", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT1_OFFSET (NumberOfTargetPDs), "Target Proximity Domains #", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT1_OFFSET (Reserved2), "Reserved2", 0}, + {ACPI_DMT_UINT64, ACPI_HMAT1_OFFSET (EntryBaseUnit), "Entry Base Unit", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1a[] = +{ + {ACPI_DMT_UINT32, 0, "Initiator Proximity Domain List", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1b[] = +{ + {ACPI_DMT_UINT32, 0, "Target Proximity Domain List", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1c[] = +{ + {ACPI_DMT_UINT16, 0, "Entry", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 0x02: Memory Side Cache Information */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2[] = +{ + {ACPI_DMT_UINT32, ACPI_HMAT2_OFFSET (MemoryPD), "Memory Proximity Domain", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT2_OFFSET (Reserved1), "Reserved1", 0}, + {ACPI_DMT_UINT64, ACPI_HMAT2_OFFSET (CacheSize), "Memory Side Cache Size", 0}, + {ACPI_DMT_UINT32, ACPI_HMAT2_OFFSET (CacheAttributes), "Cache Attributes (decoded below)", 0}, + {ACPI_DMT_FLAGS4_0, ACPI_HMAT2_FLAG_OFFSET (CacheAttributes,0), "Total Cache Levels", 0}, + {ACPI_DMT_FLAGS4_4, ACPI_HMAT2_FLAG_OFFSET (CacheAttributes,0), "Cache Level", 0}, + {ACPI_DMT_FLAGS4_8, ACPI_HMAT2_FLAG_OFFSET (CacheAttributes,0), "Cache Associativity", 0}, + {ACPI_DMT_FLAGS4_12, ACPI_HMAT2_FLAG_OFFSET (CacheAttributes,0), "Write Policy", 0}, + {ACPI_DMT_FLAGS16_16, ACPI_HMAT2_FLAG_OFFSET (CacheAttributes,0), "Cache Line Size", 0}, + {ACPI_DMT_UINT16, ACPI_HMAT2_OFFSET (Reserved2), "Reserved2", 0}, + {ACPI_DMT_UINT16, ACPI_HMAT2_OFFSET (NumberOfSMBIOSHandles), "SMBIOS Handle #", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2a[] = +{ + {ACPI_DMT_UINT16, 0, "SMBIOS Handle", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * IORT - IO Remapping Table @@ -2406,7 +2556,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoPcct[] = { {ACPI_DMT_UINT32, ACPI_PCCT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, - {ACPI_DMT_FLAG0, ACPI_PCCT_FLAG_OFFSET (Flags,0), "Doorbell", 0}, + {ACPI_DMT_FLAG0, ACPI_PCCT_FLAG_OFFSET (Flags,0), "Platform", 0}, {ACPI_DMT_UINT64, ACPI_PCCT_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; @@ -2440,7 +2590,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[] = ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[] = { - {ACPI_DMT_UINT32, ACPI_PCCT1_OFFSET (DoorbellInterrupt), "Doorbell Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT1_OFFSET (PlatformInterrupt), "Platform Interrupt", 0}, {ACPI_DMT_UINT8, ACPI_PCCT1_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_PCCT1_FLAG_OFFSET (Flags,0), "Polarity", 0}, {ACPI_DMT_FLAG1, ACPI_PCCT1_FLAG_OFFSET (Flags,0), "Mode", 0}, @@ -2460,7 +2610,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[] = ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[] = { - {ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (DoorbellInterrupt), "Doorbell Interrupt", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (PlatformInterrupt), "Platform Interrupt", 0}, {ACPI_DMT_UINT8, ACPI_PCCT2_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_PCCT2_FLAG_OFFSET (Flags,0), "Polarity", 0}, {ACPI_DMT_FLAG1, ACPI_PCCT2_FLAG_OFFSET (Flags,0), "Mode", 0}, @@ -2473,12 +2623,73 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[] = {ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (Latency), "Command Latency", 0}, {ACPI_DMT_UINT32, ACPI_PCCT2_OFFSET (MaxAccessRate), "Maximum Access Rate", 0}, {ACPI_DMT_UINT16, ACPI_PCCT2_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0}, - {ACPI_DMT_GAS, ACPI_PCCT2_OFFSET (DoorbellAckRegister), "Doorbell ACK Register", 0}, + {ACPI_DMT_GAS, ACPI_PCCT2_OFFSET (PlatformAckRegister), "Platform ACK Register", 0}, {ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (AckPreserveMask), "ACK Preserve Mask", 0}, {ACPI_DMT_UINT64, ACPI_PCCT2_OFFSET (AckWriteMask), "ACK Write Mask", 0}, ACPI_DMT_TERMINATOR }; +/* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPcct3[] = +{ + {ACPI_DMT_UINT32, ACPI_PCCT3_OFFSET (PlatformInterrupt), "Platform Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT3_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PCCT3_FLAG_OFFSET (Flags,0), "Polarity", 0}, + {ACPI_DMT_FLAG1, ACPI_PCCT3_FLAG_OFFSET (Flags,0), "Mode", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT3_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT3_OFFSET (Length), "Address Length", 0}, + {ACPI_DMT_GAS, ACPI_PCCT3_OFFSET (DoorbellRegister), "Doorbell Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (PreserveMask), "Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (WriteMask), "Write Mask", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT3_OFFSET (Latency), "Command Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT3_OFFSET (MaxAccessRate), "Maximum Access Rate", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT3_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0}, + {ACPI_DMT_GAS, ACPI_PCCT3_OFFSET (PlatformAckRegister), "Platform ACK Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (AckPreserveMask), "ACK Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (AckSetMask), "ACK Set Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_PCCT3_OFFSET (CmdCompleteRegister), "Command Complete Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (CmdCompleteMask), "Command Complete Check Mask", 0}, + {ACPI_DMT_GAS, ACPI_PCCT3_OFFSET (CmdUpdateRegister), "Command Update Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (CmdUpdatePreserveMask), "Command Update Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (CmdUpdateSetMask), "Command Update Set Mask", 0}, + {ACPI_DMT_GAS, ACPI_PCCT3_OFFSET (ErrorStatusRegister), "Error Status Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT3_OFFSET (ErrorStatusMask), "Error Status Mask", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[] = +{ + {ACPI_DMT_UINT32, ACPI_PCCT4_OFFSET (PlatformInterrupt), "Platform Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT4_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PCCT4_FLAG_OFFSET (Flags,0), "Polarity", 0}, + {ACPI_DMT_FLAG1, ACPI_PCCT4_FLAG_OFFSET (Flags,0), "Mode", 0}, + {ACPI_DMT_UINT8, ACPI_PCCT4_OFFSET (Reserved1), "Reserved", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (BaseAddress), "Base Address", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT4_OFFSET (Length), "Address Length", 0}, + {ACPI_DMT_GAS, ACPI_PCCT4_OFFSET (DoorbellRegister), "Doorbell Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (PreserveMask), "Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (WriteMask), "Write Mask", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT4_OFFSET (Latency), "Command Latency", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT4_OFFSET (MaxAccessRate), "Maximum Access Rate", 0}, + {ACPI_DMT_UINT32, ACPI_PCCT4_OFFSET (MinTurnaroundTime), "Minimum Turnaround Time", 0}, + {ACPI_DMT_GAS, ACPI_PCCT4_OFFSET (PlatformAckRegister), "Platform ACK Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (AckPreserveMask), "ACK Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (AckSetMask), "ACK Set Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_GAS, ACPI_PCCT4_OFFSET (CmdCompleteRegister), "Command Complete Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (CmdCompleteMask), "Command Complete Check Mask", 0}, + {ACPI_DMT_GAS, ACPI_PCCT4_OFFSET (CmdUpdateRegister), "Command Update Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (CmdUpdatePreserveMask), "Command Update Preserve Mask", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (CmdUpdateSetMask), "Command Update Set Mask", 0}, + {ACPI_DMT_GAS, ACPI_PCCT4_OFFSET (ErrorStatusRegister), "Error Status Register", 0}, + {ACPI_DMT_UINT64, ACPI_PCCT4_OFFSET (ErrorStatusMask), "Error Status Mask", 0}, + ACPI_DMT_TERMINATOR +}; /******************************************************************************* * @@ -2553,6 +2764,82 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = }; +/******************************************************************************* + * + * PPTT - Processor Properties Topology Table (ACPI 6.2) + * + ******************************************************************************/ + +/* Main table consists of only the standard ACPI header - subtables follow */ + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[] = +{ + {ACPI_DMT_PPTT, ACPI_PPTTH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_PPTTH_OFFSET (Length), "Length", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 0: Processor hierarchy node */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[] = +{ + {ACPI_DMT_UINT16, ACPI_PPTT0_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_FLAG0, ACPI_PPTT0_FLAG_OFFSET (Flags,0), "Physical package", 0}, + {ACPI_DMT_FLAG1, ACPI_PPTT0_FLAG_OFFSET (Flags,0), "ACPI Processor ID valid", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Parent), "Parent", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (AcpiProcessorId), "ACPI Processor ID", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (NumberOfPrivResources), "Private Resource Number", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[] = +{ + {ACPI_DMT_UINT32, 0, "Private Resource", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 1: Cache type */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[] = +{ + {ACPI_DMT_UINT16, ACPI_PPTT1_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_FLAG0, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Size valid", 0}, + {ACPI_DMT_FLAG1, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Number of Sets valid", 0}, + {ACPI_DMT_FLAG2, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Associativity valid", 0}, + {ACPI_DMT_FLAG3, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Allocation Type valid", 0}, + {ACPI_DMT_FLAG4, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Cache Type valid", 0}, + {ACPI_DMT_FLAG5, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Write Policy valid", 0}, + {ACPI_DMT_FLAG5, ACPI_PPTT1_FLAG_OFFSET (Flags,0), "Line Size valid", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (NextLevelOfCache), "Next Level of Cache", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Size), "Size", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (NumberOfSets), "Number of Sets", 0}, + {ACPI_DMT_UINT8, ACPI_PPTT1_OFFSET (Associativity), "Associativity", 0}, + {ACPI_DMT_UINT8, ACPI_PPTT1_OFFSET (Attributes), "Attributes", 0}, + {ACPI_DMT_FLAGS0, ACPI_PPTT1_OFFSET (Attributes), "Allocation Type", 0}, + {ACPI_DMT_FLAGS2, ACPI_PPTT1_OFFSET (Attributes), "Cache Type", 0}, + {ACPI_DMT_FLAG4, ACPI_PPTT1_OFFSET (Attributes), "Write Policy", 0}, + {ACPI_DMT_UINT16, ACPI_PPTT1_OFFSET (LineSize), "Line Size", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 2: ID */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[] = +{ + {ACPI_DMT_UINT16, ACPI_PPTT2_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT2_OFFSET (VendorId), "VENDOR_ID", 0}, + {ACPI_DMT_UINT64, ACPI_PPTT2_OFFSET (Level1Id), "LEVEL_1_ID", 0}, + {ACPI_DMT_UINT64, ACPI_PPTT2_OFFSET (Level2Id), "LEVEL_2_ID", 0}, + {ACPI_DMT_UINT16, ACPI_PPTT2_OFFSET (MajorRev), "MAJOR_REV", 0}, + {ACPI_DMT_UINT16, ACPI_PPTT2_OFFSET (MinorRev), "MINOR_REV", 0}, + {ACPI_DMT_UINT16, ACPI_PPTT2_OFFSET (SpinRev), "SPIN_REV", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * * RASF - RAS Feature table @@ -2779,7 +3066,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = ACPI_DMT_TERMINATOR }; -/* : GICC Affinity (ACPI 5.1) */ +/* 3: GICC Affinity (ACPI 5.1) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[] = { @@ -2791,6 +3078,16 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[] = ACPI_DMT_TERMINATOR }; +/* 4: GCC ITS Affinity (ACPI 6.2) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSrat4[] = +{ + {ACPI_DMT_UINT32, ACPI_SRAT4_OFFSET (ProximityDomain), "Proximity Domain", 0}, + {ACPI_DMT_UINT16, ACPI_SRAT4_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_SRAT4_OFFSET (ItsId), "ITS ID", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -3056,6 +3353,22 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[] = }; +/******************************************************************************* + * + * WSMT - Windows SMM Security Migrations Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoWsmt[] = +{ + {ACPI_DMT_UINT32, ACPI_WSMT_OFFSET (ProtectionFlags), "Protection Flags", 0}, + {ACPI_DMT_FLAG0, ACPI_WSMT_FLAG_OFFSET (ProtectionFlags,0), "FIXED_COMM_BUFFERS", 0}, + {ACPI_DMT_FLAG1, ACPI_WSMT_FLAG_OFFSET (ProtectionFlags,0), "COMM_BUFFER_NESTED_PTR_PROTECTION", 0}, + {ACPI_DMT_FLAG2, ACPI_WSMT_FLAG_OFFSET (ProtectionFlags,0), "SYSTEM_RESOURCE_PROTECTION", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * XENV - Xen Environment table (ACPI 6.0) diff --git a/source/compiler/aslascii.c b/source/compiler/aslascii.c index afaee56ffe65..18bcd28fe177 100644 --- a/source/compiler/aslascii.c +++ b/source/compiler/aslascii.c @@ -194,7 +194,7 @@ FlIsFileAsciiSource ( BOOLEAN DisplayErrors) { UINT8 Byte; - ACPI_SIZE BadBytes = 0; + UINT32 BadBytes = 0; BOOLEAN OpeningComment = FALSE; ASL_FILE_STATUS Status; FILE *Handle; @@ -285,6 +285,9 @@ FlIsFileAsciiSource ( if (BadBytes) { + fprintf (stderr, + "File appears to be binary: found %u non-ASCII characters, disassembling\n", + BadBytes); if (DisplayErrors) { AcpiOsPrintf ( diff --git a/source/compiler/aslcompile.c b/source/compiler/aslcompile.c index 9c2a244ab517..181fc364c745 100644 --- a/source/compiler/aslcompile.c +++ b/source/compiler/aslcompile.c @@ -568,7 +568,7 @@ AslCompilerSignon ( /* Running compiler or disassembler? */ - if (Gbl_DisasmFlag) + if (AcpiGbl_DisasmFlag) { UtilityName = AML_DISASSEMBLER_NAME; } diff --git a/source/compiler/aslcompiler.h b/source/compiler/aslcompiler.h index 4c6ba020f5ec..07a7d512e4d6 100644 --- a/source/compiler/aslcompiler.h +++ b/source/compiler/aslcompiler.h @@ -1398,6 +1398,26 @@ ASL_RESOURCE_NODE * RsDoUartSerialBusDescriptor ( ASL_RESOURCE_INFO *Info); +ASL_RESOURCE_NODE * +RsDoPinFunctionDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinConfigDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupFunctionDescriptor ( + ASL_RESOURCE_INFO *Info); + +ASL_RESOURCE_NODE * +RsDoPinGroupConfigDescriptor ( + ASL_RESOURCE_INFO *Info); + /* * aslrestype2d - DWord address descriptors */ diff --git a/source/compiler/aslcompiler.l b/source/compiler/aslcompiler.l index a9d595ab5558..4b36058b6ea7 100644 --- a/source/compiler/aslcompiler.l +++ b/source/compiler/aslcompiler.l @@ -455,6 +455,11 @@ NamePathTail [.]{NameSeg} "Memory24" { count (1); return (PARSEOP_MEMORY24); } "Memory32" { count (1); return (PARSEOP_MEMORY32); } "Memory32Fixed" { count (1); return (PARSEOP_MEMORY32FIXED); } +"PinConfig" { count (1); return (PARSEOP_PINCONFIG); } +"PinFunction" { count (1); return (PARSEOP_PINFUNCTION); } +"PinGroup" { count (1); return (PARSEOP_PINGROUP); } +"PinGroupConfig" { count (1); return (PARSEOP_PINGROUPCONFIG); } +"PinGroupFunction" { count (1); return (PARSEOP_PINGROUPFUNCTION); } "QWordIO" { count (1); return (PARSEOP_QWORDIO); } "QWordMemory" { count (1); return (PARSEOP_QWORDMEMORY); } "QWordSpace" { count (1); return (PARSEOP_QWORDSPACE); } diff --git a/source/compiler/asldefine.h b/source/compiler/asldefine.h index 3333562bf3f3..2b6d73d67788 100644 --- a/source/compiler/asldefine.h +++ b/source/compiler/asldefine.h @@ -161,8 +161,8 @@ #define ASL_INVOCATION_NAME "iasl" #define ASL_CREATOR_ID "INTL" #define ASL_DEFINE "__IASL__" - -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.1" +#define ASL_PREFIX "iASL: " +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2" /* Configuration constants */ diff --git a/source/compiler/aslexternal.c b/source/compiler/aslexternal.c index 20fcc9ecd4ce..67a95e562c84 100644 --- a/source/compiler/aslexternal.c +++ b/source/compiler/aslexternal.c @@ -435,6 +435,7 @@ ExMoveExternals ( ACPI_PARSE_OBJECT *Next; char *ExternalName; ACPI_OBJECT_TYPE ObjType; + ACPI_STATUS Status; UINT32 i; @@ -473,8 +474,16 @@ ExMoveExternals ( { Next->Asl.ParseOpcode = PARSEOP_NAMESTRING; } + Next->Asl.ExternalName = ExternalName; - UtInternalizeName (ExternalName, &Next->Asl.Value.String); + Status = UtInternalizeName (ExternalName, &Next->Asl.Value.String); + if (ACPI_FAILURE (Status)) + { + AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, + Next, "Could not internalize namestring"); + return; + } + Next->Asl.AmlLength = strlen (Next->Asl.Value.String); Next = Next->Asl.Next; diff --git a/source/compiler/aslglobal.h b/source/compiler/aslglobal.h index a4955527244a..16b798c11e2c 100644 --- a/source/compiler/aslglobal.h +++ b/source/compiler/aslglobal.h @@ -275,7 +275,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); diff --git a/source/compiler/aslhelp.c b/source/compiler/aslhelp.c index 2244e264db96..2b0dc7632e83 100644 --- a/source/compiler/aslhelp.c +++ b/source/compiler/aslhelp.c @@ -180,7 +180,6 @@ Usage ( ACPI_OPTION ("-@ ", "Specify command file"); ACPI_OPTION ("-I ", "Specify additional include directory"); ACPI_OPTION ("-p ", "Specify path/filename prefix for all output files"); - ACPI_OPTION ("-ca ", "convert a given ASL file to ASL+ (retains comments)"); ACPI_OPTION ("-v", "Display compiler version"); ACPI_OPTION ("-vd", "Display compiler build date and time"); ACPI_OPTION ("-vo", "Enable optimization comments"); @@ -209,7 +208,7 @@ Usage ( ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); - printf ("\nAML Code Generation (*.aml):\n"); + printf ("\nAML Bytecode Generation (*.aml):\n"); ACPI_OPTION ("-oa", "Disable all optimizations (compatibility mode)"); ACPI_OPTION ("-of", "Disable constant folding"); ACPI_OPTION ("-oi", "Disable integer optimization to Zero/One/Ones"); @@ -226,20 +225,24 @@ Usage ( ACPI_OPTION ("-ls", "Create combined source file (expanded includes) (*.src)"); ACPI_OPTION ("-lx", "Create cross-reference file (*.xrf)"); - printf ("\nFirmware Support - C Output:\n"); + printf ("\nFirmware Support - C Text Output:\n"); ACPI_OPTION ("-tc", "Create hex AML table in C (*.hex)"); ACPI_OPTION ("-sc", "Create named hex AML arrays in C (*.c)"); ACPI_OPTION ("-ic", "Create include file in C for -sc symbols (*.h)"); ACPI_OPTION ("-so", "Create namespace AML offset table in C (*.offset.h)"); - printf ("\nFirmware Support - Assembler Output:\n"); + printf ("\nFirmware Support - Assembler Text Output:\n"); ACPI_OPTION ("-ta", "Create hex AML table in assembler (*.hex)"); ACPI_OPTION ("-sa", "Create named hex AML arrays in assembler (*.asm)"); ACPI_OPTION ("-ia", "Create include file in assembler for -sa symbols (*.inc)"); - printf ("\nFirmware Support - ASL Output:\n"); + printf ("\nFirmware Support - ASL Text Output:\n"); ACPI_OPTION ("-ts", "Create hex AML table in ASL (Buffer object) (*.hex)"); + printf ("\nLegacy-ASL to ASL+ Converter:\n"); + ACPI_OPTION ("-ca ", "Convert legacy-ASL source file to new ASL+ file"); + ACPI_OPTION ("", " (Original comments are passed through to ASL+ file)"); + printf ("\nData Table Compiler:\n"); ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); ACPI_OPTION ("-T |ALL", "Create ACPI table template/example files"); diff --git a/source/compiler/aslhelpers.y b/source/compiler/aslhelpers.y index f99650605697..f200bf2b0e78 100644 --- a/source/compiler/aslhelpers.y +++ b/source/compiler/aslhelpers.y @@ -330,6 +330,15 @@ OptionalResourceType | ',' ResourceTypeKeyword {$$ = $2;} ; +/* Same as above except default is producer */ +OptionalProducerResourceType + : {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' {$$ = TrCreateLeafNode ( + PARSEOP_RESOURCETYPE_PRODUCER);} + | ',' ResourceTypeKeyword {$$ = $2;} + ; + OptionalSlaveMode : ',' {$$ = NULL;} | ',' SlaveModeKeyword {$$ = $2;} diff --git a/source/compiler/aslload.c b/source/compiler/aslload.c index dfe4ca4dbb49..bd564b33682e 100644 --- a/source/compiler/aslload.c +++ b/source/compiler/aslload.c @@ -315,13 +315,20 @@ LdLoadFieldElements ( Child->Asl.Value.String); return (Status); } - - /* - * The name already exists in this scope - * But continue processing the elements - */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, - Child->Asl.Value.String); + else if (Status == AE_ALREADY_EXISTS && + (Node->Flags & ANOBJ_IS_EXTERNAL)) + { + Node->Type = (UINT8) ACPI_TYPE_LOCAL_REGION_FIELD; + } + else + { + /* + * The name already exists in this scope + * But continue processing the elements + */ + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, + Child->Asl.Value.String); + } } else { @@ -458,12 +465,30 @@ LdNamespace1Begin ( ACPI_PARSE_OBJECT *Arg; UINT32 i; BOOLEAN ForceNewScope = FALSE; + ACPI_OWNER_ID OwnerId = 0; ACPI_FUNCTION_NAME (LdNamespace1Begin); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", Op, Op->Asl.ParseOpName)); + if (Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) + { + /* + * Allocate an OwnerId for this block. This helps identify the owners + * of each namespace node. This is used in determining whether if + * certain external declarations cause redefinition errors. + */ + Status = AcpiUtAllocateOwnerId (&OwnerId); + WalkState->OwnerId = OwnerId; + if (ACPI_FAILURE (Status)) + { + AslCoreSubsystemError (Op, Status, + "Failure to allocate owner ID to this definition block.", FALSE); + return_ACPI_STATUS (Status); + } + } + /* * We are only interested in opcodes that have an associated name * (or multiple names) @@ -778,7 +803,9 @@ LdNamespace1Begin ( { /* * Allow one create on an object or segment that was - * previously declared External + * previously declared External only if WalkState->OwnerId and + * Node->OwnerId are found in different tables (meaning that + * they have differnt OwnerIds). */ Node->Flags &= ~ANOBJ_IS_EXTERNAL; Node->Type = (UINT8) ObjectType; @@ -795,6 +822,12 @@ LdNamespace1Begin ( } Status = AE_OK; + + if (Node->OwnerId == WalkState->OwnerId) + { + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName); + } } else if (!(Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) @@ -802,15 +835,52 @@ LdNamespace1Begin ( /* * Allow externals in same scope as the definition of the * actual object. Similar to C. Allows multiple definition - * blocks that refer to each other in the same file. + * blocks that refer to each other in the same file. However, + * do not allow name declaration and an external declaration + * within the same table. This is considered a re-declaration. */ Status = AE_OK; + + if (Node->OwnerId == WalkState->OwnerId) + { + AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName); + } } else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) && (ObjectType == ACPI_TYPE_ANY)) { - /* Allow update of externals of unknown type. */ + /* + * Allow update of externals of unknown type. + * In the case that multiple definition blocks are being + * parsed, updating the OwnerId allows enables subsequent calls + * of this method to understand which table the most recent + * external declaration was seen. Without this OwnerId update, + * code like the following is allowed to compile: + * + * DefinitionBlock("externtest.aml", "DSDT", 0x02, "Intel", "Many", 0x00000001) + * { + * External(ERRS,methodobj) + * Method (MAIN) + * { + * Name(NUM2, 0) + * ERRS(1,2,3) + * } + * } + * + * DefinitionBlock("externtest.aml", "SSDT", 0x02, "Intel", "Many", 0x00000001) + * { + * if (0) + * { + * External(ERRS,methodobj) + * } + * Method (ERRS,3) + * {} + * + * } + */ + Node->OwnerId = WalkState->OwnerId; if (AcpiNsOpensScope (ActualObjectType)) { diff --git a/source/compiler/aslmain.c b/source/compiler/aslmain.c index a282b0c4926b..10251fb2a80f 100644 --- a/source/compiler/aslmain.c +++ b/source/compiler/aslmain.c @@ -207,6 +207,9 @@ main ( int ReturnStatus = 0; + signal (SIGINT, AslSignalHandler); + signal (SIGSEGV, AslSignalHandler); + /* * Big-endian machines are not currently supported. ACPI tables must * be little-endian, and support for big-endian machines needs to @@ -224,7 +227,6 @@ main ( /* Initialize preprocessor and compiler before command line processing */ - signal (SIGINT, AslSignalHandler); AcpiGbl_ExternalFileList = NULL; AcpiDbgLevel = 0; PrInitializePreprocessor (); @@ -254,6 +256,7 @@ main ( } } + /* Process each pathname/filename in the list, with possible wildcards */ while (argv[Index2]) @@ -301,8 +304,10 @@ CleanupAndExit: * * RETURN: None * - * DESCRIPTION: Control-C handler. Delete any intermediate files and any - * output files that may be left in an indeterminate state. + * DESCRIPTION: Signal interrupt handler. Delete any intermediate files and + * any output files that may be left in an indeterminate state. + * Currently handles SIGINT (control-c) and SIGSEGV (segmentation + * fault). * *****************************************************************************/ @@ -314,11 +319,34 @@ AslSignalHandler ( signal (Sig, SIG_IGN); - printf ("Aborting\n\n"); + fflush (stdout); + fflush (stderr); + + switch (Sig) + { + case SIGINT: + + printf ("\n" ASL_PREFIX "\n"); + break; - /* Close all open files */ + case SIGSEGV: - Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; /* the .pre file is same as source file */ + /* Even on a seg fault, we will try to delete any partial files */ + + printf (ASL_PREFIX "Segmentation Fault\n"); + break; + + default: + + printf (ASL_PREFIX "Unknown interrupt signal (%u), ignoring\n", Sig); + return; + } + + /* + * Close all open files + * Note: the .pre file is the same as the input source file + */ + Gbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) { @@ -332,6 +360,7 @@ AslSignalHandler ( FlDeleteFile (i); } + printf (ASL_PREFIX "Terminating\n"); exit (0); } diff --git a/source/compiler/aslmap.c b/source/compiler/aslmap.c index f3c04797a484..aed87661d091 100644 --- a/source/compiler/aslmap.c +++ b/source/compiler/aslmap.c @@ -451,6 +451,11 @@ const ASL_MAPPING_ENTRY AslKeywordMapping [] = /* PARITYTYPE_NONE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* PARITYTYPE_ODD */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), /* PARITYTYPE_SPACE */ OP_TABLE_ENTRY (AML_BYTE_OP, 4, 0, 0), +/* PINCONFIG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINFUNCTION */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUP */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUPCONFIG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), +/* PINGROUPFUNCTION */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), /* PIN_NOPULL */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), /* PIN_PULLDEFAULT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), /* PIN_PULLDOWN */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), diff --git a/source/compiler/asloffset.c b/source/compiler/asloffset.c index e3fdf1c91656..0964d4feaa81 100644 --- a/source/compiler/asloffset.c +++ b/source/compiler/asloffset.c @@ -250,7 +250,6 @@ LsAmlOffsetWalk ( } Length = Op->Asl.FinalAmlLength; - NamepathOffset = Gbl_CurrentAmlOffset + Length; /* Get to the NameSeg/NamePath Op (and length of the name) */ diff --git a/source/compiler/asloptions.c b/source/compiler/asloptions.c index 65fc4bfa378f..2dcd49402e04 100644 --- a/source/compiler/asloptions.c +++ b/source/compiler/asloptions.c @@ -229,7 +229,7 @@ AslCommandLine ( /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && - !Gbl_DisasmFlag) + !AcpiGbl_DisasmFlag) { printf ("Missing input filename\n"); BadCommandLine = TRUE; @@ -469,7 +469,7 @@ AslDoOptions ( return (-1); } - Gbl_DisasmFlag = TRUE; + AcpiGbl_DisasmFlag = TRUE; break; case 'D': /* Define a symbol */ @@ -541,6 +541,7 @@ AslDoOptions ( { case '^': + printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); Usage (); exit (0); diff --git a/source/compiler/aslparser.y b/source/compiler/aslparser.y index 72043ae04547..6426cebefa78 100644 --- a/source/compiler/aslparser.y +++ b/source/compiler/aslparser.y @@ -208,7 +208,7 @@ AslLocalAllocate ( * These shift/reduce conflicts are expected. There should be zero * reduce/reduce conflicts. */ -%expect 102 +%expect 118 /*! [Begin] no source code translation */ diff --git a/source/compiler/aslresource.c b/source/compiler/aslresource.c index f12795a51ea2..42931452da7a 100644 --- a/source/compiler/aslresource.c +++ b/source/compiler/aslresource.c @@ -990,6 +990,31 @@ RsDoOneResourceDescriptor ( Rnode = RsDoUartSerialBusDescriptor (Info); break; + case PARSEOP_PINCONFIG: + + Rnode = RsDoPinConfigDescriptor (Info); + break; + + case PARSEOP_PINFUNCTION: + + Rnode = RsDoPinFunctionDescriptor (Info); + break; + + case PARSEOP_PINGROUP: + + Rnode = RsDoPinGroupDescriptor (Info); + break; + + case PARSEOP_PINGROUPFUNCTION: + + Rnode = RsDoPinGroupFunctionDescriptor (Info); + break; + + case PARSEOP_PINGROUPCONFIG: + + Rnode = RsDoPinGroupConfigDescriptor (Info); + break; + case PARSEOP_DEFAULT_ARG: /* Just ignore any of these, they are used as fillers/placeholders */ diff --git a/source/compiler/aslresources.y b/source/compiler/aslresources.y index d14fdd457f8f..fc70940c7e9c 100644 --- a/source/compiler/aslresources.y +++ b/source/compiler/aslresources.y @@ -211,6 +211,11 @@ ResourceMacroTerm | Memory24Term {} | Memory32FixedTerm {} | Memory32Term {} + | PinConfigTerm {} + | PinFunctionTerm {} + | PinGroupTerm {} + | PinGroupConfigTerm {} + | PinGroupFunctionTerm {} | QWordIOTerm {} | QWordMemoryTerm {} | QWordSpaceTerm {} @@ -605,6 +610,95 @@ Memory32Term error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} ; +PinConfigTerm + : PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_PINCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinFunctionTerm + : PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_PINFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' PinConfigByte /* 06: PinConfig */ + ',' WordConstExpr /* 08: FunctionNumber */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($3,9, + $4,$6,$8,$10,$11,$12,$13,$14,$17);} + | PARSEOP_PINFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupTerm + : PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_PINGROUP);} + StringData /* 04: ResourceLabel */ + OptionalProducerResourceType /* 05: ResourceType */ + OptionalNameString /* 06: DescriptorName */ + OptionalBuffer_Last /* 07: VendorData */ + PARSEOP_CLOSE_PAREN '{' + DWordList '}' {$$ = TrLinkChildren ($3,5,$4,$5,$6,$7,$10);} + | PARSEOP_PINGROUP + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupConfigTerm + : PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_PINGROUPCONFIG);} + OptionalShareType_First /* 04: SharedType */ + ',' ByteConstExpr /* 06: PinConfigType */ + ',' DWordConstExpr /* 08: PinConfigValue */ + ',' StringData /* 10: ResourceSource */ + OptionalByteConstExpr /* 11: ResourceSourceIndex */ + ',' StringData /* 13: ResourceSourceLabel */ + OptionalResourceType /* 14: ResourceType */ + OptionalNameString /* 15: DescriptorName */ + OptionalBuffer_Last /* 16: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkChildren ($3,9, + $4,$6,$8,$10,$11,$13,$14,$15,$16);} + | PARSEOP_PINGROUPCONFIG + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + +PinGroupFunctionTerm + : PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_PINGROUPFUNCTION);} + OptionalShareType_First /* 04: SharedType */ + ',' WordConstExpr /* 06: FunctionNumber */ + ',' StringData /* 08: ResourceSource */ + OptionalByteConstExpr /* 09: ResourceSourceIndex */ + ',' StringData /* 11: ResourceSourceLabel */ + OptionalResourceType /* 12: ResourceType */ + OptionalNameString /* 13: DescriptorName */ + OptionalBuffer_Last /* 14: VendorData */ + PARSEOP_CLOSE_PAREN {$$ = TrLinkChildren ($3,8, + $4,$6,$8,$9,$11,$12,$13,$14);} + | PARSEOP_PINGROUPFUNCTION + PARSEOP_OPEN_PAREN + error PARSEOP_CLOSE_PAREN {$$ = AslDoError(); yyclearin;} + ; + QWordIOTerm : PARSEOP_QWORDIO PARSEOP_OPEN_PAREN {$$ = TrCreateLeafNode (PARSEOP_QWORDIO);} diff --git a/source/compiler/aslrestype2s.c b/source/compiler/aslrestype2s.c index ccaac7c97cc0..243d1a3fef04 100644 --- a/source/compiler/aslrestype2s.c +++ b/source/compiler/aslrestype2s.c @@ -163,7 +163,8 @@ RsGetBufferDataLength ( static UINT16 RsGetInterruptDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex); static BOOLEAN RsGetVendorData ( @@ -171,6 +172,11 @@ RsGetVendorData ( UINT8 *VendorData, ACPI_SIZE DescriptorOffset); +static UINT16 +RsGetStringDataLengthAt ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex); + /* * This module contains descriptors for serial buses and GPIO: * @@ -179,6 +185,11 @@ RsGetVendorData ( * I2cSerialBus * SpiSerialBus * UartSerialBus + * PinFunction + * PinConfig + * PinGroup + * PinGroupFunction + * PinGroupConfig */ @@ -238,6 +249,7 @@ RsGetBufferDataLength ( * * PARAMETERS: InitializerOp - Current parse op, start of the resource * descriptor + * StartIndex - Start index of interrupt/pin list * * RETURN: Length of the interrupt data list * @@ -248,7 +260,8 @@ RsGetBufferDataLength ( static UINT16 RsGetInterruptDataLength ( - ACPI_PARSE_OBJECT *InitializerOp) + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex) { UINT16 InterruptLength; UINT32 i; @@ -261,9 +274,9 @@ RsGetInterruptDataLength ( { InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - /* Interrupt list starts at offset 10 (Gpio descriptors) */ + /* Interrupt list starts at offset StartIndex (Gpio descriptors) */ - if (i >= 10) + if (i >= StartIndex) { InterruptLength += 2; } @@ -371,6 +384,43 @@ RsGetVendorData ( } +/******************************************************************************* + * + * FUNCTION: RsGetStringDataLengthAt + * + * PARAMETERS: InitializerOp - Start of a subtree of init nodes + * StartIndex - Starting index of the string node + * + * RETURN: Valid string length if a string node is found at given + * StartIndex or 0 otherwise. + * + * DESCRIPTION: In a list of peer nodes, find the first one at given index + * that contains a string and return length. + * + ******************************************************************************/ + +static UINT16 +RsGetStringDataLengthAt ( + ACPI_PARSE_OBJECT *InitializerOp, + UINT32 StartIndex) +{ + UINT32 i; + + for (i = 0; InitializerOp; i++) + { + if (i == StartIndex && + InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) + { + return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1)); + } + + InitializerOp = ASL_GET_PEER_NODE (InitializerOp); + } + + return (0); +} + + /******************************************************************************* * * FUNCTION: RsDoGpioIntDescriptor @@ -414,7 +464,7 @@ RsDoGpioIntDescriptor ( */ ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); - InterruptLength = RsGetInterruptDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + ResSourceLength + VendorLength + InterruptLength; @@ -623,7 +673,7 @@ RsDoGpioIoDescriptor ( */ ResSourceLength = RsGetStringDataLength (InitializerOp); VendorLength = RsGetBufferDataLength (InitializerOp); - InterruptLength = RsGetInterruptDataLength (InitializerOp); + InterruptLength = RsGetInterruptDataLength (InitializerOp, 10); PinList = InterruptList; DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO) + @@ -1336,3 +1386,858 @@ RsDoUartSerialBusDescriptor ( MpSaveSerialInfo (Info->MappingOp, Descriptor, ResourceSource); return (Rnode); } + + +/******************************************************************************* + * + * FUNCTION: RsDoPinFunctionDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinFunction" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinFunctionDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 8); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION) + + ResSourceLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinFunction.ResourceLength = DescriptorSize; + Descriptor->PinFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_FUNCTION; + Descriptor->PinFunction.RevisionId = AML_RESOURCE_PIN_FUNCTION_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_FUNCTION)); + ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinFunction.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (PinList, Descriptor); + + Descriptor->PinFunction.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinFunction.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.Flags), 0); + break; + + case 1: /* Pin Config [BYTE] (_PPI) */ + + Descriptor->PinFunction.PinConfig = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.PinConfig)); + break; + + case 2: /* Function Number [WORD] (_FUN) */ + + Descriptor->PinFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinFunction.FunctionNumber)); + break; + + case 3: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + } + break; + + case 4: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->PinFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 5: /* Resource Usage (consumer/producer) */ + + /* Assumed to be consumer */ + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinFunction.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinFunction.VendorOffset))) + { + Descriptor->PinFunction.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 8: First pin number in list */ + + if (i == 8) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinFunction.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinConfigDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinConfig" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinConfigDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + UINT16 ResSourceLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + ResSourceLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 8); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG) + + ResSourceLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinConfig.ResourceLength = DescriptorSize; + Descriptor->PinConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_CONFIG; + Descriptor->PinConfig.RevisionId = AML_RESOURCE_PIN_CONFIG_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_CONFIG)); + ResourceSource = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSource, ResSourceLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinConfig.PinTableOffset = (UINT16) + ACPI_PTR_DIFF (PinList, Descriptor); + + Descriptor->PinConfig.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + BOOLEAN isValid; + + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.Flags), 0); + break; + + case 1: /* Pin Config Type [BYTE] (_TYP) */ + + isValid = InitializerOp->Asl.Value.Integer <= 0x0d; + if (!isValid) + { + isValid = InitializerOp->Asl.Value.Integer >= 0x80 && + InitializerOp->Asl.Value.Integer <= 0xff; + } + if (!isValid) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL); + } + + Descriptor->PinConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigType)); + + break; + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + + Descriptor->PinConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinConfig.PinConfigValue)); + break; + + case 3: /* ResSource [Optional Field - STRING] */ + + if (ResSourceLength) + { + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + } + break; + + case 4: /* Resource Index */ + + if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) + { + Descriptor->PinConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + } + break; + + case 5: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinConfig.Flags, InitializerOp, 1, 1); + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinConfig.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinConfig.VendorOffset))) + { + Descriptor->PinConfig.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 8: First pin number in list */ + + if (i == 8) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinConfig.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroup" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + UINT8 *VendorData = NULL; + UINT16 *PinList = NULL; + char *Label = NULL; + UINT16 LabelLength; + UINT16 VendorLength; + UINT16 PinListLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 PinCount = 0; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Label + * 2) Vendor Data buffer + * 3) PIN (interrupt) list + */ + LabelLength = RsGetStringDataLength (InitializerOp); + VendorLength = RsGetBufferDataLength (InitializerOp); + PinListLength = RsGetInterruptDataLength (InitializerOp, 4); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP) + + LabelLength + VendorLength + PinListLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroup.ResourceLength = DescriptorSize; + Descriptor->PinGroup.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP; + Descriptor->PinGroup.RevisionId = AML_RESOURCE_PIN_GROUP_REVISION; + + /* Build pointers to optional areas */ + + PinList = ACPI_ADD_PTR (UINT16, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP)); + Label = ACPI_ADD_PTR (char, PinList, PinListLength); + VendorData = ACPI_ADD_PTR (UINT8, Label, LabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroup.PinTableOffset = (UINT16) ACPI_PTR_DIFF (PinList, Descriptor); + Descriptor->PinGroup.LabelOffset = (UINT16) ACPI_PTR_DIFF (Label, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Resource Label */ + + if (LabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + strcpy (Label, InitializerOp->Asl.Value.String); + + break; + + case 1: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroup.Flags, InitializerOp, 0, 0); + + break; + + case 2: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 3: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroup.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroup.VendorOffset))) + { + Descriptor->PinGroup.VendorLength = VendorLength; + } + break; + + default: + /* + * PINs come through here, repeatedly. Each PIN must be a WORD. + * NOTE: there is no "length" field for this, so from ACPI spec: + * The number of pins in the table can be calculated from: + * PinCount = (Resource Source Name Offset - Pin Table Offset) / 2 + * (implies resource source must immediately follow the pin list.) + * Name: _PIN + */ + *PinList = (UINT16) InitializerOp->Asl.Value.Integer; + PinList++; + PinCount++; + + /* Case 3: First pin number in list */ + + if (i == 4) + { + if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + /* Must be at least one interrupt */ + + AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST_MIN, + InitializerOp, NULL); + } + + /* Check now for duplicates in list */ + + RsCheckListForDuplicates (InitializerOp); + + /* Create a named field at the start of the list */ + + RsCreateWordField (InitializerOp, ACPI_RESTAG_PIN, + CurrentByteOffset + Descriptor->PinGroup.PinTableOffset); + } + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupFunctionDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroupFunction" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupFunctionDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + char *ResourceSourceLabel = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 ResSourceLabelLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Resource Source Label string + * 3) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 2); + ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 4); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION) + + ResSourceLength + ResSourceLabelLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroupFunction.ResourceLength = DescriptorSize; + Descriptor->PinGroupFunction.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION; + Descriptor->PinGroupFunction.RevisionId = AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION; + + /* Build pointers to optional areas */ + + ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION)); + ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroupFunction.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + Descriptor->PinGroupFunction.ResSourceLabelOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.Flags), 0); + break; + + case 1: /* Function Number [WORD] */ + + Descriptor->PinGroupFunction.FunctionNumber = (UINT16) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_FUNCTION, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupFunction.FunctionNumber)); + break; + + case 2: /* ResourceSource [STRING] */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + break; + + case 3: /* Resource Index */ + + Descriptor->PinGroupFunction.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + break; + + case 4: /* ResourceSourceLabel [STRING] */ + + if (ResSourceLabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + + strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String); + break; + + case 5: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroupFunction.Flags, InitializerOp, 1, 1); + + break; + + case 6: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 7: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroupFunction.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroupFunction.VendorOffset))) + { + Descriptor->PinGroupFunction.VendorLength = VendorLength; + } + break; + + default: + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} + + +/******************************************************************************* + * + * FUNCTION: RsDoPinGroupConfigDescriptor + * + * PARAMETERS: Info - Parse Op and resource template offset + * + * RETURN: Completed resource node + * + * DESCRIPTION: Construct a long "PinGroupConfig" descriptor + * + ******************************************************************************/ + +ASL_RESOURCE_NODE * +RsDoPinGroupConfigDescriptor ( + ASL_RESOURCE_INFO *Info) +{ + AML_RESOURCE *Descriptor; + ACPI_PARSE_OBJECT *InitializerOp; + ASL_RESOURCE_NODE *Rnode; + char *ResourceSource = NULL; + char *ResourceSourceLabel = NULL; + UINT8 *VendorData = NULL; + UINT16 ResSourceLength; + UINT16 ResSourceLabelLength; + UINT16 VendorLength; + UINT16 DescriptorSize; + UINT32 CurrentByteOffset; + UINT32 i; + + InitializerOp = Info->DescriptorTypeOp->Asl.Child; + CurrentByteOffset = Info->CurrentByteOffset; + + /* + * Calculate lengths for fields that have variable length: + * 1) Resource Source string + * 2) Resource Source Label string + * 3) Vendor Data buffer + */ + ResSourceLength = RsGetStringDataLengthAt (InitializerOp, 3); + ResSourceLabelLength = RsGetStringDataLengthAt (InitializerOp, 5); + VendorLength = RsGetBufferDataLength (InitializerOp); + + DescriptorSize = ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG) + + ResSourceLength + ResSourceLabelLength + VendorLength; + + /* Allocate the local resource node and initialize */ + + Rnode = RsAllocateResourceNode (DescriptorSize + + sizeof (AML_RESOURCE_LARGE_HEADER)); + + Descriptor = Rnode->Buffer; + Descriptor->PinGroupConfig.ResourceLength = DescriptorSize; + Descriptor->PinGroupConfig.DescriptorType = ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG; + Descriptor->PinGroupConfig.RevisionId = AML_RESOURCE_PIN_GROUP_CONFIG_REVISION; + + /* Build pointers to optional areas */ + + ResourceSource = ACPI_ADD_PTR (char, Descriptor, sizeof (AML_RESOURCE_PIN_GROUP_CONFIG)); + ResourceSourceLabel = ACPI_ADD_PTR (char, ResourceSource, ResSourceLength); + VendorData = ACPI_ADD_PTR (UINT8, ResourceSourceLabel, ResSourceLabelLength); + + /* Setup offsets within the descriptor */ + + Descriptor->PinGroupConfig.ResSourceOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSource, Descriptor); + Descriptor->PinGroupConfig.ResSourceLabelOffset = (UINT16) + ACPI_PTR_DIFF (ResourceSourceLabel, Descriptor); + + /* Process all child initialization nodes */ + + for (i = 0; InitializerOp; i++) + { + BOOLEAN isValid; + + switch (i) + { + case 0: /* Share Type [Flags] (_SHR) */ + + RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 0, 0); + RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.Flags), 0); + break; + + case 1: /* Pin Config Type [BYTE] (_TYP) */ + + isValid = InitializerOp->Asl.Value.Integer <= 0x0d; + if (!isValid) + { + isValid = InitializerOp->Asl.Value.Integer >= 0x80 && + InitializerOp->Asl.Value.Integer <= 0xff; + } + if (!isValid) + { + AslError (ASL_ERROR, ASL_MSG_RANGE, InitializerOp, NULL); + } + + Descriptor->PinGroupConfig.PinConfigType = (UINT8) InitializerOp->Asl.Value.Integer; + RsCreateByteField (InitializerOp, ACPI_RESTAG_PINCONFIG_TYPE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigType)); + + break; + + case 2: /* Pin Config Value [DWORD] (_VAL) */ + + Descriptor->PinGroupConfig.PinConfigValue = (UINT32) InitializerOp->Asl.Value.Integer; + RsCreateDwordField (InitializerOp, ACPI_RESTAG_PINCONFIG_VALUE, + CurrentByteOffset + ASL_RESDESC_OFFSET (PinGroupConfig.PinConfigValue)); + break; + + case 3: /* ResourceSource [STRING] */ + + /* Copy string to the descriptor */ + + strcpy (ResourceSource, InitializerOp->Asl.Value.String); + break; + + case 4: /* Resource Index */ + + Descriptor->PinGroupConfig.ResSourceIndex = (UINT8) InitializerOp->Asl.Value.Integer; + break; + + case 5: /* ResourceSourceLabel [STRING] */ + + if (ResSourceLabelLength < 2) + { + AslError(ASL_WARNING, ASL_MSG_NULL_STRING, InitializerOp, NULL); + } + + strcpy (ResourceSourceLabel, InitializerOp->Asl.Value.String); + break; + + case 6: /* Resource Usage (consumer/producer) */ + + RsSetFlagBits16 (&Descriptor->PinGroupConfig.Flags, InitializerOp, 1, 1); + + break; + + case 7: /* Resource Tag (Descriptor Name) */ + + UtAttachNamepathToOwner (Info->DescriptorTypeOp, InitializerOp); + break; + + case 8: /* Vendor Data (Optional - Buffer of BYTEs) (_VEN) */ + /* + * Always set the VendorOffset even if there is no Vendor Data. + * This field is required in order to calculate the length + * of the ResourceSource at runtime. + */ + Descriptor->PinGroupConfig.VendorOffset = (UINT16) + ACPI_PTR_DIFF (VendorData, Descriptor); + + if (RsGetVendorData (InitializerOp, VendorData, + (CurrentByteOffset + Descriptor->PinGroupConfig.VendorOffset))) + { + Descriptor->PinGroupConfig.VendorLength = VendorLength; + } + break; + + default: + break; + } + + InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); + } + + return (Rnode); +} diff --git a/source/compiler/aslrules.y b/source/compiler/aslrules.y index ae4d37147b9e..d09852c7d166 100644 --- a/source/compiler/aslrules.y +++ b/source/compiler/aslrules.y @@ -269,11 +269,9 @@ TermArg : SimpleName {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} | DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);} -/* | PARSEOP_OPEN_PAREN TermArg - PARSEOP_CLOSE_PAREN {} -*/ + PARSEOP_CLOSE_PAREN {$$ = TrSetNodeFlags ($2, NODE_IS_TERM_ARG);} ; /* @@ -395,7 +393,7 @@ Object : CompilerDirective {} | NamedObject {} | NameSpaceModifier {} -// | StructureTerm {} +/* | StructureTerm {} */ ; PackageList @@ -644,7 +642,7 @@ NamedObject NameSpaceModifier : AliasTerm {} | NameTerm {} -// | NameTermAslPlus {} +/* | NameTermAslPlus {} */ | ScopeTerm {} ; @@ -751,8 +749,8 @@ Type2IntegerOpcode /* "Type3" opcodes */ | FromBCDTerm {} | IncTerm {} | IndexTerm {} -// | StructureIndexTerm {} -// | StructurePointerTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ | LAndTerm {} | LEqualTerm {} | LGreaterTerm {} @@ -827,8 +825,8 @@ Type6Opcode | DerefOfTerm {} | IndexTerm {} | IndexExpTerm {} -// | StructureIndexTerm {} -// | StructurePointerTerm {} +/* | StructureIndexTerm {} */ +/* | StructurePointerTerm {} */ | MethodInvocationTerm {} ; diff --git a/source/compiler/aslstartup.c b/source/compiler/aslstartup.c index bef4c7695afd..2f037bf87287 100644 --- a/source/compiler/aslstartup.c +++ b/source/compiler/aslstartup.c @@ -316,6 +316,11 @@ AslDetectSourceFileType ( Type = ASL_INPUT_TYPE_BINARY_ACPI_TABLE; goto Cleanup; } + else + { + fprintf (stderr, + "Binary file does not contain a valid ACPI table\n"); + } Type = ASL_INPUT_TYPE_BINARY; @@ -456,7 +461,7 @@ AslDoOneFile ( /* * AML Disassembly (Optional) */ - if (Gbl_DisasmFlag) + if (AcpiGbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) @@ -581,7 +586,7 @@ AslDoOneFile ( CvDbgPrint ("OUTPUTFILENAME: %s\n", Gbl_OutputFilenamePrefix); Gbl_Files[ASL_FILE_INPUT].Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; - + AcpiGbl_DisasmFlag = TRUE; fprintf (stderr, "\n"); AslDoDisassembly (); @@ -601,7 +606,7 @@ AslDoOneFile ( FlCloseFile (ASL_FILE_INPUT); Gbl_DoCompile = FALSE; - Gbl_DisasmFlag = TRUE; + AcpiGbl_DisasmFlag = TRUE; Status = AslDoDisassembly (); return (Status); diff --git a/source/compiler/aslsupport.l b/source/compiler/aslsupport.l index 130540674d68..42cee752a952 100644 --- a/source/compiler/aslsupport.l +++ b/source/compiler/aslsupport.l @@ -697,15 +697,19 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); - AslInsertLineBuffer ('*'); if (Gbl_CaptureComments && CurrentState.CaptureComments) { + AslInsertLineBuffer ('*'); *StringBuffer = '/'; ++StringBuffer; *StringBuffer = '*'; ++StringBuffer; } + else + { + AslInsertLineBuffer ('/'); + } while (((c = input ()) != '\n') && (c != EOF)) { @@ -1006,15 +1010,6 @@ CompletedString: *StringBuffer = 0; CleanString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); - if (!CleanString) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_CurrentLineOffset, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - return (FALSE); - } - strcpy (CleanString, MsgBuffer); AslCompilerlval.s = CleanString; return (TRUE); diff --git a/source/compiler/asltokens.y b/source/compiler/asltokens.y index ba0803f8d1b4..e6e9006d0475 100644 --- a/source/compiler/asltokens.y +++ b/source/compiler/asltokens.y @@ -389,6 +389,11 @@ NoEcho(' %token PARSEOP_PARITYTYPE_NONE %token PARSEOP_PARITYTYPE_ODD %token PARSEOP_PARITYTYPE_SPACE +%token PARSEOP_PINCONFIG +%token PARSEOP_PINFUNCTION +%token PARSEOP_PINGROUP +%token PARSEOP_PINGROUPCONFIG +%token PARSEOP_PINGROUPFUNCTION %token PARSEOP_PIN_NOPULL %token PARSEOP_PIN_PULLDEFAULT %token PARSEOP_PIN_PULLDOWN diff --git a/source/compiler/asltree.c b/source/compiler/asltree.c index 0f31296e8193..b80a42263fc9 100644 --- a/source/compiler/asltree.c +++ b/source/compiler/asltree.c @@ -295,17 +295,14 @@ TrAllocateNode ( } Gbl_CommentState.Latest_Parse_Node = Op; - if (Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName) - { - CvDbgPrint ("trallocatenode=Set latest parse node to this node.\n"); - CvDbgPrint (" Op->Asl.ParseOpName = %s\n", - Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName); - CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode); + CvDbgPrint ("trallocatenode=Set latest parse node to this node.\n"); + CvDbgPrint (" Op->Asl.ParseOpName = %s\n", + Gbl_CommentState.Latest_Parse_Node->Asl.ParseOpName); + CvDbgPrint (" Op->Asl.ParseOpcode = 0x%x\n", ParseOpcode); - if (Op->Asl.FileChanged) - { - CvDbgPrint(" file has been changed!\n"); - } + if (Op->Asl.FileChanged) + { + CvDbgPrint(" file has been changed!\n"); } /* @@ -1660,7 +1657,7 @@ TrLinkChildNode ( * turn on capture comments as it signifies that we are done parsing * a method call. */ - if (Gbl_CaptureComments) + if (Gbl_CaptureComments && Op1) { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { diff --git a/source/compiler/asltypes.y b/source/compiler/asltypes.y index 7f0680efe380..6886a0dc40d2 100644 --- a/source/compiler/asltypes.y +++ b/source/compiler/asltypes.y @@ -432,6 +432,11 @@ NoEcho(' %type Memory32Term %type NameSeg %type NameString +%type PinConfigTerm +%type PinFunctionTerm +%type PinGroupTerm +%type PinGroupConfigTerm +%type PinGroupFunctionTerm %type QWordIOTerm %type QWordMemoryTerm %type QWordSpaceTerm @@ -487,6 +492,7 @@ NoEcho(' %type OptionalReference %type OptionalResourceType %type OptionalResourceType_First +%type OptionalProducerResourceType %type OptionalReturnArg %type OptionalSerializeRuleKeyword %type OptionalShareType diff --git a/source/compiler/aslutils.c b/source/compiler/aslutils.c index 202cf38df019..fd91baeb20e5 100644 --- a/source/compiler/aslutils.c +++ b/source/compiler/aslutils.c @@ -635,7 +635,7 @@ UtCheckIntegerRange ( * * PARAMETERS: Length - Size of buffer requested * - * RETURN: Pointer to the buffer. Aborts on allocation failure + * RETURN: Pointer to the buffer. Aborts compiler on allocation failure * * DESCRIPTION: Allocate a string buffer. Bypass the local * dynamic memory manager for performance reasons (This has a @@ -833,10 +833,6 @@ UtInternalizeName ( /* We need a segment to store the internal name */ Info.InternalName = UtStringCacheCalloc (Info.Length); - if (!Info.InternalName) - { - return (AE_NO_MEMORY); - } /* Build the name */ diff --git a/source/compiler/aslxref.c b/source/compiler/aslxref.c index ec1ce21bb3ae..62933ec1be70 100644 --- a/source/compiler/aslxref.c +++ b/source/compiler/aslxref.c @@ -621,7 +621,8 @@ XfNamespaceLocateBegin ( (!(OpInfo->Flags & AML_CREATE)) && (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && - (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode != PARSEOP_METHODCALL) && + (Op->Asl.ParseOpcode != PARSEOP_EXTERNAL)) { return_ACPI_STATUS (AE_OK); } @@ -644,7 +645,8 @@ XfNamespaceLocateBegin ( Flags = ACPI_NS_SEARCH_PARENT; if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { /* * These are name references, do not push the scope stack @@ -1183,7 +1185,8 @@ XfNamespaceLocateEnd ( if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) + (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) || + (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL)) { return_ACPI_STATUS (AE_OK); } diff --git a/source/compiler/cvcompiler.c b/source/compiler/cvcompiler.c index e8366ce5523e..fab9fb946d7d 100644 --- a/source/compiler/cvcompiler.c +++ b/source/compiler/cvcompiler.c @@ -191,6 +191,7 @@ CvProcessComment ( *StringBuffer = (char) c1; ++StringBuffer; *StringBuffer = 0; + CvDbgPrint ("Multi-line comment\n"); CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); strcpy (CommentString, MsgBuffer); @@ -198,17 +199,15 @@ CvProcessComment ( CvDbgPrint ("CommentString: %s\n", CommentString); /* - * Determine whether if this comment spans multiple lines. - * If so, break apart the comment by line so that it can be - * properly indented. + * Determine whether if this comment spans multiple lines. If so, + * break apart the comment by storing each line in a different node + * within the comment list. This allows the disassembler to + * properly indent a multi-line comment. */ - if (strchr (CommentString, '\n') != NULL) + LineToken = strtok (CommentString, "\n"); + + if (LineToken) { - /* - * Get the first token. The for loop pads subsequent lines - * for comments similar to the style of this comment. - */ - LineToken = strtok (CommentString, "\n"); FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1); strcpy (FinalLineToken, LineToken); @@ -263,7 +262,10 @@ CvProcessComment ( * if this is not a regular comment, pad with extra spaces that appeared * in the original source input to retain the original spacing. */ - FinalCommentString = UtStringCacheCalloc (strlen (CommentString) + CurrentState.SpacesBefore + 1); + FinalCommentString = + UtStringCacheCalloc (strlen (CommentString) + + CurrentState.SpacesBefore + 1); + for (i=0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) && (i < CurrentState.SpacesBefore); ++i) { @@ -333,7 +335,9 @@ CvProcessCommentType2 ( * [ (spaces) (comment) ( * /) ('\0') ] * */ - FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + strlen (CommentString) + 3 + 1); + FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + + strlen (CommentString) + 3 + 1); + for (i=0; (CurrentState.CommentType!=1) && (iAsl.Filename, FILE_SUFFIX_DISASSEMBLY); - CvDbgPrint ("Writing file comment, \"%s\" for %s\n", - NewFilename, Op->Asl.ParseOpName); + if (NewFilename) + { + CvDbgPrint ("Writing file comment, \"%s\" for %s\n", + NewFilename, Op->Asl.ParseOpName); + } + CgWriteOneAmlComment(Op, NewFilename, FILENAME_COMMENT); if (Op->Asl.ParentFilename && @@ -688,17 +702,16 @@ CgWriteAmlComment( * ******************************************************************************/ -ACPI_COMMENT_NODE* +ACPI_COMMENT_NODE * CvCommentNodeCalloc ( void) { ACPI_COMMENT_NODE *NewCommentNode; - NewCommentNode = - (ACPI_COMMENT_NODE*) UtLocalCalloc (sizeof(ACPI_COMMENT_NODE)); + NewCommentNode = UtLocalCalloc (sizeof (ACPI_COMMENT_NODE)); NewCommentNode->Next = NULL; - return NewCommentNode; + return (NewCommentNode); } @@ -907,10 +920,12 @@ CvAppendInlineComment ( { return ToAdd; } - if (ToAdd) + if (!ToAdd) { - Size = strlen (ToAdd); + return InlineComment; } + + Size = strlen (ToAdd); Size += strlen (InlineComment); Str = UtStringCacheCalloc (Size+1); strcpy (Str, InlineComment); diff --git a/source/compiler/cvdisasm.c b/source/compiler/cvdisasm.c index e75ee0ab115d..6e9b73f0a367 100644 --- a/source/compiler/cvdisasm.c +++ b/source/compiler/cvdisasm.c @@ -314,6 +314,7 @@ CvPrintOneCommentType ( if (*CommentToPrint) { + CommentExists = TRUE; AcpiOsPrintf ("%s", *CommentToPrint); *CommentToPrint = NULL; } @@ -495,6 +496,7 @@ CvSwitchFiles( { char *Filename = Op->Common.CvFilename; ACPI_FILE_NODE *FNode; + ACPI_FILE_NODE *Current; CvDbgPrint ("Switching from %s to %s\n", AcpiGbl_CurrentFilename, Filename); FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); @@ -509,23 +511,23 @@ CvSwitchFiles( AslCommonError (ASL_ERROR, ASL_MSG_OPEN, 0, 0, 0, 0, NULL, MsgBuffer); AslAbort (); } + Current = FNode; /* * If the previous file is a descendent of the current file, * make sure that Include statements from the current file * to the previous have been emitted. */ - while (FNode && - FNode->Parent && - AcpiUtStricmp (FNode->Filename, AcpiGbl_CurrentFilename)) + while (Current && + Current->Parent && + AcpiUtStricmp (Current->Filename, AcpiGbl_CurrentFilename)) { - CvPrintInclude (FNode, Level); - FNode = FNode->Parent; + CvPrintInclude (Current, Level); + Current = Current->Parent; } - /* Redirect output to the Op->Common.CvFilename */ + /* Redirect output to Op->Common.CvFilename */ - FNode = CvFilenameExists (Filename, AcpiGbl_FileTreeRoot); AcpiOsRedirectOutput (FNode->File); AcpiGbl_CurrentFilename = FNode->Filename; } diff --git a/source/compiler/cvparser.c b/source/compiler/cvparser.c index cdb165dc1daf..060e8aedec9c 100644 --- a/source/compiler/cvparser.c +++ b/source/compiler/cvparser.c @@ -215,7 +215,7 @@ CvIsFilename ( for(i = 0; iFilename, Filename)) diff --git a/source/compiler/dtcompiler.h b/source/compiler/dtcompiler.h index 9a6f08ee542a..61b40b4a93ef 100644 --- a/source/compiler/dtcompiler.h +++ b/source/compiler/dtcompiler.h @@ -577,6 +577,10 @@ ACPI_STATUS DtCompileHest ( void **PFieldList); +ACPI_STATUS +DtCompileHmat ( + void **PFieldList); + ACPI_STATUS DtCompileIort ( void **PFieldList); @@ -617,6 +621,10 @@ ACPI_STATUS DtCompilePmtt ( void **PFieldList); +ACPI_STATUS +DtCompilePptt ( + void **PFieldList); + ACPI_STATUS DtCompilePcct ( void **PFieldList); @@ -698,6 +706,7 @@ extern const unsigned char TemplateFadt[]; extern const unsigned char TemplateFpdt[]; extern const unsigned char TemplateGtdt[]; extern const unsigned char TemplateHest[]; +extern const unsigned char TemplateHmat[]; extern const unsigned char TemplateHpet[]; extern const unsigned char TemplateIort[]; extern const unsigned char TemplateIvrs[]; @@ -712,6 +721,7 @@ extern const unsigned char TemplateMtmr[]; extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; extern const unsigned char TemplatePmtt[]; +extern const unsigned char TemplatePptt[]; extern const unsigned char TemplateRasf[]; extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; @@ -731,6 +741,7 @@ extern const unsigned char TemplateWdat[]; extern const unsigned char TemplateWddt[]; extern const unsigned char TemplateWdrt[]; extern const unsigned char TemplateWpbt[]; +extern const unsigned char TemplateWsmt[]; extern const unsigned char TemplateXenv[]; extern const unsigned char TemplateXsdt[]; diff --git a/source/compiler/dtfield.c b/source/compiler/dtfield.c index 33afa3bf764a..13e8b6388019 100644 --- a/source/compiler/dtfield.c +++ b/source/compiler/dtfield.c @@ -679,6 +679,36 @@ DtCompileFlag ( BitLength = 2; break; + case ACPI_DMT_FLAGS4_0: + + BitPosition = 0; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_4: + + BitPosition = 4; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_8: + + BitPosition = 8; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS4_12: + + BitPosition = 12; + BitLength = 4; + break; + + case ACPI_DMT_FLAGS16_16: + + BitPosition = 16; + BitLength = 16; + break; + default: DtFatal (ASL_MSG_COMPILER_INTERNAL, Field, "Invalid flag opcode"); diff --git a/source/compiler/dttable1.c b/source/compiler/dttable1.c index c25f4b0e09af..bdf0419cf940 100644 --- a/source/compiler/dttable1.c +++ b/source/compiler/dttable1.c @@ -1249,6 +1249,16 @@ DtCompileHest ( InfoTable = AcpiDmTableInfoHest9; break; + case ACPI_HEST_TYPE_GENERIC_ERROR_V2: + + InfoTable = AcpiDmTableInfoHest10; + break; + + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: + + InfoTable = AcpiDmTableInfoHest11; + break; + default: /* Cannot continue on unknown type */ @@ -1283,6 +1293,12 @@ DtCompileHest ( Subtable->Buffer))->NumHardwareBanks; break; + case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: + + BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK, + Subtable->Buffer))->NumHardwareBanks; + break; + default: break; @@ -1306,6 +1322,218 @@ DtCompileHest ( } +/****************************************************************************** + * + * FUNCTION: DtCompileHmat + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile HMAT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileHmat ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + DT_FIELD *EntryStart; + ACPI_HMAT_STRUCTURE *HmatStruct; + ACPI_HMAT_LOCALITY *HmatLocality; + ACPI_HMAT_CACHE *HmatCache; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 IntPDNumber; + UINT32 TgtPDNumber; + UINT64 EntryNumber; + UINT16 SMBIOSHandleNumber; + + + ParentTable = DtPeekSubtable (); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmat, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + while (*PFieldList) + { + /* Compile HMAT structure header */ + + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoHmatHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + + HmatStruct = ACPI_CAST_PTR (ACPI_HMAT_STRUCTURE, Subtable->Buffer); + HmatStruct->Length = Subtable->Length; + + /* Compile HMAT structure body */ + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_ADDRESS_RANGE: + + InfoTable = AcpiDmTableInfoHmat0; + break; + + case ACPI_HMAT_TYPE_LOCALITY: + + InfoTable = AcpiDmTableInfoHmat1; + break; + + case ACPI_HMAT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoHmat2; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "HMAT"); + return (AE_ERROR); + } + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + + /* Compile HMAT structure additionals */ + + switch (HmatStruct->Type) + { + case ACPI_HMAT_TYPE_LOCALITY: + + HmatLocality = ACPI_SUB_PTR (ACPI_HMAT_LOCALITY, + Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE)); + + /* Compile initiator proximity domain list */ + + IntPDNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + IntPDNumber++; + } + HmatLocality->NumberOfInitiatorPDs = IntPDNumber; + + /* Compile target proximity domain list */ + + TgtPDNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1b, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + TgtPDNumber++; + } + HmatLocality->NumberOfTargetPDs = TgtPDNumber; + + /* Save start of the entries for reporting errors */ + + EntryStart = *PFieldList; + + /* Compile latency/bandwidth entries */ + + EntryNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat1c, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + EntryNumber++; + } + + /* Validate number of entries */ + + if (EntryNumber != + ((UINT64)IntPDNumber * (UINT64)TgtPDNumber)) + { + DtFatal (ASL_MSG_INVALID_EXPRESSION, EntryStart, "HMAT"); + return (AE_ERROR); + } + break; + + case ACPI_HMAT_TYPE_CACHE: + + /* Compile SMBIOS handles */ + + HmatCache = ACPI_SUB_PTR (ACPI_HMAT_CACHE, + Subtable->Buffer, sizeof (ACPI_HMAT_STRUCTURE)); + SMBIOSHandleNumber = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoHmat2a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + DtInsertSubtable (ParentTable, Subtable); + HmatStruct->Length += Subtable->Length; + SMBIOSHandleNumber++; + } + HmatCache->NumberOfSMBIOSHandles = SMBIOSHandleNumber; + break; + + default: + + break; + } + } + + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: DtCompileIort diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index e1d0e8bf0f36..356a7d0d19f2 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -871,6 +871,16 @@ DtCompilePcct ( InfoTable = AcpiDmTableInfoPcct2; break; + case ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct3; + break; + + case ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE: + + InfoTable = AcpiDmTableInfoPcct4; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PCCT"); @@ -1035,6 +1045,125 @@ DtCompilePmtt ( } +/****************************************************************************** + * + * FUNCTION: DtCompilePptt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PPTT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePptt ( + void **List) +{ + ACPI_STATUS Status; + ACPI_SUBTABLE_HEADER *PpttHeader; + ACPI_PPTT_PROCESSOR *PpttProcessor = NULL; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + + + ParentTable = DtPeekSubtable (); + while (*PFieldList) + { + SubtableStart = *PFieldList; + + /* Compile PPTT subtable header */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPpttHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + PpttHeader = ACPI_CAST_PTR (ACPI_SUBTABLE_HEADER, Subtable->Buffer); + PpttHeader->Length = (UINT8)(Subtable->Length); + + switch (PpttHeader->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + InfoTable = AcpiDmTableInfoPptt0; + break; + + case ACPI_PPTT_TYPE_CACHE: + + InfoTable = AcpiDmTableInfoPptt1; + break; + + case ACPI_PPTT_TYPE_ID: + + InfoTable = AcpiDmTableInfoPptt2; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "PPTT"); + return (AE_ERROR); + } + + /* Compile PPTT subtable body */ + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + DtInsertSubtable (ParentTable, Subtable); + PpttHeader->Length += (UINT8)(Subtable->Length); + + /* Compile PPTT subtable additionals */ + + switch (PpttHeader->Type) + { + case ACPI_PPTT_TYPE_PROCESSOR: + + PpttProcessor = ACPI_SUB_PTR (ACPI_PPTT_PROCESSOR, + Subtable->Buffer, sizeof (ACPI_SUBTABLE_HEADER)); + if (PpttProcessor) + { + /* Compile initiator proximity domain list */ + + PpttProcessor->NumberOfPrivResources = 0; + while (*PFieldList) + { + Status = DtCompileTable (PFieldList, + AcpiDmTableInfoPptt0a, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + if (!Subtable) + { + break; + } + + DtInsertSubtable (ParentTable, Subtable); + PpttHeader->Length += (UINT8)(Subtable->Length); + PpttProcessor->NumberOfPrivResources++; + } + } + break; + + default: + + break; + } + } + + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: DtCompileRsdt @@ -1324,6 +1453,11 @@ DtCompileSrat ( InfoTable = AcpiDmTableInfoSrat3; break; + case ACPI_SRAT_TYPE_GIC_ITS_AFFINITY: + + InfoTable = AcpiDmTableInfoSrat4; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SRAT"); diff --git a/source/compiler/dttemplate.h b/source/compiler/dttemplate.h index 701e70f4f236..bb4dded4e634 100644 --- a/source/compiler/dttemplate.h +++ b/source/compiler/dttemplate.h @@ -577,11 +577,11 @@ const unsigned char TemplateGtdt[] = const unsigned char TemplateHest[] = { - 0x48,0x45,0x53,0x54,0xD4,0x01,0x00,0x00, /* 00000000 "HEST...." */ - 0x01,0x20,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ". INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x48,0x45,0x53,0x54,0x7C,0x02,0x00,0x00, /* 00000000 "HEST|..." */ + 0x01,0x97,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x04,0x00,0x00,0x00, /* 00000020 "(.. ...." */ + 0x03,0x03,0x17,0x20,0x04,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, /* 00000028 "........" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -596,7 +596,7 @@ const unsigned char TemplateHest[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000088 "........" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000090 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ + 0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */ 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 000000B0 "........" */ @@ -635,7 +635,52 @@ const unsigned char TemplateHest[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001B8 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C0 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001C8 "........" */ - 0x00,0x10,0x00,0x00 /* 000001D0 "...." */ + 0x00,0x10,0x00,0x00,0x0A,0x00,0x03,0x00, /* 000001D0 "........" */ + 0x00,0x00,0x00,0x01,0x01,0x00,0x00,0x00, /* 000001D8 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00, /* 000001E0 "........" */ + 0x00,0x40,0x00,0x04,0x00,0x00,0x00,0x00, /* 000001E8 ".@......" */ + 0x00,0x00,0x00,0x00,0x04,0x1C,0x00,0x00, /* 000001F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001F8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000208 "........" */ + 0x00,0x10,0x00,0x00,0x00,0x40,0x00,0x04, /* 00000210 ".....@.." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000218 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000220 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000228 "........" */ + 0x0B,0x00,0x01,0x00,0x00,0x00,0x00,0x01, /* 00000230 "........" */ + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000238 "........" */ + 0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000240 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000248 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000250 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000258 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000260 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000268 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000270 "........" */ + 0x00,0x00,0x00,0x00 /* 00000278 "...." */ +}; + +const unsigned char TemplateHmat[] = +{ + 0x48,0x4D,0x41,0x54,0x9C,0x00,0x00,0x00, /* 00000000 "HMAT...." */ + 0x00,0x54,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".TINTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x28,0x00,0x00,0x00, /* 00000028 "....(..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x01,0x00,0x00,0x00,0x2A,0x00,0x00,0x00, /* 00000050 "....*..." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000058 "........" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000070 "........" */ + 0x00,0x00,0x02,0x00,0x00,0x00,0x22,0x00, /* 00000078 "......"." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x01,0x00,0x00,0x00 /* 00000098 "...." */ }; const unsigned char TemplateHpet[] = @@ -958,39 +1003,80 @@ const unsigned char TemplateMtmr[] = const unsigned char TemplatePcct[] = { - 0x50,0x43,0x43,0x54,0x06,0x01,0x00,0x00, /* 00000000 "PCCT...." */ - 0x01,0xE3,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x18,0x03,0x16,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x50,0x43,0x43,0x54,0x4e,0x02,0x00,0x00, /* 00000000 "PCCTN..." */ + 0x01,0x47,0x49,0x4e,0x54,0x45,0x4c,0x20, /* 00000008 ".GINTEL " */ + 0x54,0x65,0x6d,0x70,0x6c,0x61,0x74,0x65, /* 00000010 "Template" */ + 0x01,0x00,0x00,0x00,0x49,0x4e,0x54,0x4c, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ - 0x00,0x3E,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ".>......" */ + 0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 ".>......" */ 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, /* 00000038 "........" */ 0x22,0x22,0x22,0x22,0x22,0x22,0x22,0x22, /* 00000040 """""""""" */ 0x01,0x32,0x00,0x03,0x33,0x33,0x33,0x33, /* 00000048 ".2..3333" */ 0x33,0x33,0x33,0x33,0x44,0x44,0x44,0x44, /* 00000050 "3333DDDD" */ 0x44,0x44,0x44,0x44,0x55,0x55,0x55,0x55, /* 00000058 "DDDDUUUU" */ 0x55,0x55,0x55,0x55,0x66,0x66,0x66,0x66, /* 00000060 "UUUUffff" */ - 0x77,0x77,0x77,0x77,0x88,0x88,0x01,0x3E, /* 00000068 "wwww...>" */ + 0x77,0x77,0x77,0x77,0x88,0x88,0x01,0x3e, /* 00000068 "wwww...>" */ 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000070 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 00000080 ".......2" */ 0x00,0x03,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000088 "..DDDDDD" */ 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000090 "DDDDDDDD" */ 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55, /* 00000098 "DDUUUUUU" */ - 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000000A0 "UUffffww" */ - 0x77,0x77,0x88,0x88,0x02,0x5A,0x01,0x00, /* 000000A8 "ww...Z.." */ - 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x32,0x00,0x03, /* 000000C0 ".....2.." */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000C8 "DDDDDDDD" */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000D0 "DDDDDDDD" */ - 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* 000000D8 "UUUUUUUU" */ - 0x66,0x66,0x66,0x66,0x77,0x77,0x77,0x77, /* 000000E0 "ffffwwww" */ - 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 000000E8 "...2..33" */ - 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 000000F0 "333333DD" */ - 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 000000F8 "DDDDDDUU" */ - 0x55,0x55,0x55,0x55,0x55,0x55 /* 00000100 "UUUUUU" */ + 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000000a0 "UUffffww" */ + 0x77,0x77,0x88,0x88,0x02,0x5a,0x01,0x00, /* 000000a8 "ww...Z.." */ + 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 000000b0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000b8 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x32,0x00,0x03, /* 000000c0 ".....2.." */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000c8 "DDDDDDDD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x44,0x44, /* 000000d0 "DDDDDDDD" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55, /* 000000d8 "UUUUUUUU" */ + 0x66,0x66,0x66,0x66,0x77,0x77,0x77,0x77, /* 000000e0 "ffffwwww" */ + 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 000000e8 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 000000f0 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 000000f8 "DDDDDDUU" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x03,0xa4, /* 00000100 "UUUUUU.." */ + 0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000108 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x00,0x00,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000118 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 00000120 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x55,0x55, /* 00000128 "DDDDDDUU" */ + 0x55,0x55,0x55,0x55,0x55,0x55,0x66,0x66, /* 00000130 "UUUUUUff" */ + 0x66,0x66,0x77,0x77,0x77,0x77,0x88,0x88, /* 00000138 "ffwwww.." */ + 0x88,0x88,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000140 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x99,0x99, /* 00000148 "333333.." */ + 0x99,0x99,0x99,0x99,0x99,0x99,0x00,0x00, /* 00000150 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 00000160 ".......2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000168 "..333333" */ + 0x33,0x33,0x22,0x22,0x22,0x22,0x22,0x22, /* 00000170 "33""""""" */ + 0x22,0x22,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000178 """.2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000180 "33333333" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x44,0x44, /* 00000188 "333333DD" */ + 0x44,0x44,0x44,0x44,0x44,0x44,0x01,0x32, /* 00000190 "DDDDDD.2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000198 "..333333" */ + 0x33,0x33,0x55,0x55,0x55,0x55,0x55,0x55, /* 000001a0 "33UUUUUU" */ + 0x55,0x55,0x04,0xa4,0x01,0x00,0x00,0x00, /* 000001a8 "UU......" */ + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001b0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x32, /* 000001b8 ".......2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 000001c0 "..333333" */ + 0x33,0x33,0x44,0x44,0x44,0x44,0x44,0x44, /* 000001c8 "33DDDDDD" */ + 0x44,0x44,0x55,0x55,0x55,0x55,0x55,0x55, /* 000001d0 "DDUUUUUU" */ + 0x55,0x55,0x66,0x66,0x66,0x66,0x77,0x77, /* 000001d8 "UUffffww" */ + 0x77,0x77,0x88,0x88,0x88,0x88,0x01,0x32, /* 000001e0 "ww.....2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 000001e8 "..333333" */ + 0x33,0x33,0x99,0x99,0x99,0x99,0x99,0x99, /* 000001f0 "33......" */ + 0x99,0x99,0x00,0x00,0x00,0x00,0x00,0x00, /* 000001f8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000200 "........" */ + 0x00,0x00,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000208 "...2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x22,0x22, /* 00000210 "333333""" */ + 0x22,0x22,0x22,0x22,0x22,0x22,0x01,0x32, /* 00000218 """"""".2" */ + 0x00,0x03,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000220 "..333333" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33, /* 00000228 "33333333" */ + 0x33,0x33,0x44,0x44,0x44,0x44,0x44,0x44, /* 00000230 "33DDDDDD" */ + 0x44,0x44,0x01,0x32,0x00,0x03,0x33,0x33, /* 00000238 "DD.2..33" */ + 0x33,0x33,0x33,0x33,0x33,0x33,0x55,0x55, /* 00000240 "333333UU" */ + 0x55,0x55,0x55,0x55,0x55,0x55 /* 00000248 "UUUUUU| */ }; const unsigned char TemplatePmtt[] = @@ -1020,6 +1106,25 @@ const unsigned char TemplatePmtt[] = 0x00,0x00,0x00,0x00 /* 000000B0 "...." */ }; +const unsigned char TemplatePptt[] = +{ + 0x50,0x50,0x54,0x54,0x72,0x00,0x00,0x00, /* 00000000 "PPTTr..." */ + 0x01,0x86,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x03,0x03,0x17,0x20,0x00,0x18,0x00,0x00, /* 00000020 "... ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ + 0x00,0x00,0x00,0x00,0x01,0x18,0x00,0x00, /* 00000038 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000048 "........" */ + 0x00,0x00,0x00,0x00,0x02,0x1E,0x00,0x00, /* 00000050 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000068 "........" */ + 0x00,0x00 /* 00000070 ".." */ +}; + const unsigned char TemplateRasf[] = { 0x52,0x41,0x53,0x46,0x30,0x00,0x00,0x00, /* 00000000 "RASF0..." */ @@ -1213,11 +1318,11 @@ const unsigned char TemplateSpmi[] = const unsigned char TemplateSrat[] = { - 0x53,0x52,0x41,0x54,0x92,0x00,0x00,0x00, /* 00000000 "SRAT...." */ - 0x03,0x50,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".PINTEL " */ + 0x53,0x52,0x41,0x54,0x9E,0x00,0x00,0x00, /* 00000000 "SRAT...." */ + 0x03,0x55,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".UINTEL " */ 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x24,0x07,0x14,0x20,0x01,0x00,0x00,0x00, /* 00000020 "$.. ...." */ + 0x03,0x03,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ @@ -1231,7 +1336,8 @@ const unsigned char TemplateSrat[] = 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ 0x03,0x12,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ - 0x00,0x00 /* 00000090 ".." */ + 0x00,0x00,0x04,0x0C,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x00,0x00,0x01,0x00,0x00,0x00 /* 00000098 "......" */ }; const unsigned char TemplateStao[] = @@ -1379,6 +1485,15 @@ const unsigned char TemplateWpbt[] = 0x72,0x00,0x74,0x00,0x68,0x00,0x00,0x00 /* 00000090 "r.t.h..." */ }; +const unsigned char TemplateWsmt[] = +{ + 0x57,0x53,0x4D,0x54,0x28,0x00,0x00,0x00, /* 00000000 "WSMT(..." */ + 0x00,0x08,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x19,0x01,0x17,0x20,0x05,0x00,0x00,0x00 /* 00000020 "... ...." */ +}; + const unsigned char TemplateXenv[] = { 0x58,0x45,0x4E,0x56,0x39,0x00,0x00,0x00, /* 00000000 "XENV9..." */ diff --git a/source/compiler/dtutils.c b/source/compiler/dtutils.c index 7fbc7d569295..8807217510b8 100644 --- a/source/compiler/dtutils.c +++ b/source/compiler/dtutils.c @@ -371,6 +371,11 @@ DtGetFieldType ( case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: case ACPI_DMT_FLAGS4: + case ACPI_DMT_FLAGS4_0: + case ACPI_DMT_FLAGS4_4: + case ACPI_DMT_FLAGS4_8: + case ACPI_DMT_FLAGS4_12: + case ACPI_DMT_FLAGS16_16: Type = DT_FIELD_TYPE_FLAG; break; @@ -512,6 +517,11 @@ DtGetFieldLength ( case ACPI_DMT_FLAGS1: case ACPI_DMT_FLAGS2: case ACPI_DMT_FLAGS4: + case ACPI_DMT_FLAGS4_0: + case ACPI_DMT_FLAGS4_4: + case ACPI_DMT_FLAGS4_8: + case ACPI_DMT_FLAGS4_12: + case ACPI_DMT_FLAGS16_16: case ACPI_DMT_LABEL: case ACPI_DMT_EXTRA_TEXT: @@ -527,6 +537,7 @@ DtGetFieldLength ( case ACPI_DMT_MADT: case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: + case ACPI_DMT_PPTT: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -543,6 +554,7 @@ DtGetFieldLength ( case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: case ACPI_DMT_HEST: + case ACPI_DMT_HMAT: case ACPI_DMT_NFIT: case ACPI_DMT_PCI_PATH: diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c index 83af8896598a..0a00be81e0ba 100644 --- a/source/components/debugger/dbexec.c +++ b/source/components/debugger/dbexec.c @@ -314,6 +314,18 @@ AcpiDbExecuteMethod ( if (ACPI_FAILURE (Status)) { + if ((Status == AE_ABORT_METHOD) || AcpiGbl_AbortMethod) + { + /* Clear the abort and fall back to the debugger prompt */ + + ACPI_EXCEPTION ((AE_INFO, Status, + "Aborting top-level method")); + + AcpiGbl_AbortMethod = FALSE; + Status = AE_OK; + goto Cleanup; + } + ACPI_EXCEPTION ((AE_INFO, Status, "while executing %s from debugger", Info->Pathname)); diff --git a/source/components/debugger/dbobject.c b/source/components/debugger/dbobject.c index 81f6b6e86e08..66906ef84196 100644 --- a/source/components/debugger/dbobject.c +++ b/source/components/debugger/dbobject.c @@ -588,7 +588,7 @@ AcpiDbDecodeLocals ( if (DisplayLocals) { - AcpiOsPrintf ("\nInitialized Local Variables for method [%4.4s]:\n", + AcpiOsPrintf ("\nInitialized Local Variables for Method [%4.4s]:\n", AcpiUtGetNodeName (Node)); for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++) @@ -604,7 +604,7 @@ AcpiDbDecodeLocals ( else { AcpiOsPrintf ( - "No Local Variables are initialized for method [%4.4s]\n", + "No Local Variables are initialized for Method [%4.4s]\n", AcpiUtGetNodeName (Node)); } } @@ -667,7 +667,7 @@ AcpiDbDecodeArguments ( AcpiOsPrintf ( "Initialized Arguments for Method [%4.4s]: " "(%X arguments defined for method invocation)\n", - AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount); + AcpiUtGetNodeName (Node), Node->Object->Method.ParamCount); for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++) { diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c index 02c4e5dbb9d2..bfa7d7c7882d 100644 --- a/source/components/debugger/dbxface.c +++ b/source/components/debugger/dbxface.c @@ -379,7 +379,7 @@ AcpiDbSingleStep ( if ((AcpiGbl_DbOutputToFile) || (AcpiDbgLevel & ACPI_LV_PARSE)) { - AcpiOsPrintf ("\n[AmlDebug] Next AML Opcode to execute:\n"); + AcpiOsPrintf ("\nAML Debug: Next AML Opcode to execute:\n"); } /* diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c index 75cc09632134..27ea16b46e95 100644 --- a/source/components/disassembler/dmbuffer.c +++ b/source/components/disassembler/dmbuffer.c @@ -261,7 +261,7 @@ AcpiDmDisasmByteList ( /* Dump the ASCII equivalents within a comment */ - AcpiOsPrintf (" /* "); + AcpiOsPrintf (" // "); for (j = 0; j < ACPI_BUFFER_BYTES_PER_LINE; j++) { CurrentIndex = i + j; @@ -283,7 +283,7 @@ AcpiDmDisasmByteList ( /* Finished with this line */ - AcpiOsPrintf (" */\n"); + AcpiOsPrintf ("\n"); } } diff --git a/source/components/disassembler/dmdeferred.c b/source/components/disassembler/dmdeferred.c index 8123e2524a77..0368b0a6c8ed 100644 --- a/source/components/disassembler/dmdeferred.c +++ b/source/components/disassembler/dmdeferred.c @@ -190,7 +190,7 @@ AcpiDmParseDeferredOps ( ACPI_STATUS Status; - ACPI_FUNCTION_ENTRY (); + ACPI_FUNCTION_TRACE (DmParseDeferredOps); /* Traverse the entire parse tree */ @@ -217,7 +217,7 @@ AcpiDmParseDeferredOps ( Op, Op->Named.Data, Op->Named.Length); if (ACPI_FAILURE (Status)) { - return (Status); + return_ACPI_STATUS (Status); } break; @@ -245,7 +245,7 @@ AcpiDmParseDeferredOps ( Op = AcpiPsGetDepthNext (Root, Op); } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/source/components/disassembler/dmopcode.c b/source/components/disassembler/dmopcode.c index af1f96447c48..8d9b532a795e 100644 --- a/source/components/disassembler/dmopcode.c +++ b/source/components/disassembler/dmopcode.c @@ -177,15 +177,6 @@ static void AcpiDmPromoteSubtree ( ACPI_PARSE_OBJECT *StartOp); -static BOOLEAN -AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op, - char *Temp); - -static BOOLEAN -AcpiDmIsCaseBlock ( - ACPI_PARSE_OBJECT *Op); - /******************************************************************************* * * FUNCTION: AcpiDmDisplayTargetPathname @@ -1127,9 +1118,7 @@ AcpiDmDisassembleOneOp ( if (AcpiGbl_DmEmitExternalOpcodes) { - AcpiDmEmitExternal (AcpiPsGetArg(Op, 0), - AcpiPsGetArg(Op, 1)); - break; + AcpiDmEmitExternal (Op, AcpiPsGetArg(Op, 0)); } break; @@ -1367,414 +1356,3 @@ AcpiDmPromoteSubtree ( Op = Op->Common.Next; } } - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsTempName - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: TRUE if object is a temporary (_T_x) name for a matching While - * loop that can be converted to a Switch. - * - * DESCRIPTION: _T_X objects are only used for Switch statements. If a temporary - * name exists, search the siblings for a matching While (One) loop - * that can be converted to a Switch. Return TRUE if a match was - * found, FALSE otherwise. - * - ******************************************************************************/ - -BOOLEAN -AcpiDmIsTempName ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *CurrentOp; - char *Temp; - - if (Op->Common.AmlOpcode != AML_NAME_OP) - { - return (FALSE); - } - - Temp = (char *)(Op->Common.Aml); - ++Temp; - - if (strncmp(Temp, "_T_", 3)) - { - return (FALSE); - } - - CurrentOp = Op->Common.Next; - while (CurrentOp) - { - if (CurrentOp->Common.AmlOpcode == AML_WHILE_OP && - AcpiDmIsSwitchBlock(CurrentOp, Temp)) - { - Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - CurrentOp->Common.DisasmOpcode = ACPI_DASM_SWITCH; - - return (TRUE); - } - CurrentOp = CurrentOp->Common.Next; - } - - return (FALSE); -} - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsSwitchBlock - * - * PARAMETERS: Op - While Object - * - * RETURN: TRUE if While block can be converted to a Switch/Case block - * - * DESCRIPTION: Determines if While block is a Switch/Case statement. Modifies - * parse tree to allow for Switch/Case disassembly during walk. - * - * EXAMPLE: Example of parse tree to be converted - * - * While - * One - * Store - * ByteConst - * -NamePath- - * If - * LEqual - * -NamePath- - * Zero - * Return - * One - * Else - * Return - * WordConst - * Break - * - ******************************************************************************/ - -static BOOLEAN -AcpiDmIsSwitchBlock ( - ACPI_PARSE_OBJECT *Op, - char *Temp) -{ - ACPI_PARSE_OBJECT *OneOp; - ACPI_PARSE_OBJECT *StoreOp; - ACPI_PARSE_OBJECT *NamePathOp; - ACPI_PARSE_OBJECT *PredicateOp; - ACPI_PARSE_OBJECT *CurrentOp; - ACPI_PARSE_OBJECT *TempOp; - - /* Check for One Op Predicate */ - - OneOp = AcpiPsGetArg (Op, 0); - if (!OneOp || (OneOp->Common.AmlOpcode != AML_ONE_OP)) - { - return (FALSE); - } - - /* Check for Store Op */ - - StoreOp = OneOp->Common.Next; - if (!StoreOp || (StoreOp->Common.AmlOpcode != AML_STORE_OP)) - { - return (FALSE); - } - - /* Check for Name Op with _T_ string */ - - NamePathOp = AcpiPsGetArg (StoreOp, 1); - if (!NamePathOp || (NamePathOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)) - { - return (FALSE); - } - - if (strncmp((char *)(NamePathOp->Common.Aml), Temp, 4)) - { - return (FALSE); - } - - /* This is a Switch/Case control block */ - - /* Ignore the One Op Predicate */ - - OneOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - /* Ignore the Store Op, but not the children */ - - StoreOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; - - /* - * First arg of Store Op is the Switch condition. - * Mark it as a Switch predicate and as a parameter list for paren - * closing and correct indentation. - */ - PredicateOp = AcpiPsGetArg (StoreOp, 0); - PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - /* Ignore the Name Op */ - - NamePathOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; - - /* Remaining opcodes are the Case statements (If/ElseIf's) */ - - CurrentOp = StoreOp->Common.Next; - while (AcpiDmIsCaseBlock (CurrentOp)) - { - /* Block is a Case structure */ - - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - /* ElseIf */ - - CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - } - - /* If */ - - CurrentOp->Common.DisasmOpcode = ACPI_DASM_CASE; - - /* - * Mark the parse tree for Case disassembly. There are two - * types of Case statements. The first type of statement begins with - * an LEqual. The second starts with an LNot and uses a Match statement - * on a Package of constants. - */ - TempOp = AcpiPsGetArg (CurrentOp, 0); - switch (TempOp->Common.AmlOpcode) - { - case (AML_LOGICAL_EQUAL_OP): - - /* Ignore just the LEqual Op */ - - TempOp->Common.DisasmOpcode = ACPI_DASM_IGNORE_SINGLE; - - /* Ignore the NamePath Op */ - - TempOp = AcpiPsGetArg (TempOp, 0); - TempOp->Common.DisasmFlags = ACPI_PARSEOP_IGNORE; - - /* - * Second arg of LEqual will be the Case predicate. - * Mark it as a predicate and also as a parameter list for paren - * closing and correct indentation. - */ - PredicateOp = TempOp->Common.Next; - PredicateOp->Common.DisasmOpcode = ACPI_DASM_SWITCH_PREDICATE; - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - break; - - case (AML_LOGICAL_NOT_OP): - - /* - * The Package will be the predicate of the Case statement. - * It's under: - * LNOT - * LEQUAL - * MATCH - * PACKAGE - */ - - /* Get the LEqual Op from LNot */ - - TempOp = AcpiPsGetArg (TempOp, 0); - - /* Get the Match Op from LEqual */ - - TempOp = AcpiPsGetArg (TempOp, 0); - - /* Get the Package Op from Match */ - - PredicateOp = AcpiPsGetArg (TempOp, 0); - - /* Mark as parameter list for paren closing */ - - PredicateOp->Common.DisasmFlags |= ACPI_PARSEOP_PARAMETER_LIST; - - /* - * The Package list would be too deeply indented if we - * chose to simply ignore the all the parent opcodes, so - * we rearrange the parse tree instead. - */ - - /* - * Save the second arg of the If/Else Op which is the - * block code of code for this Case statement. - */ - TempOp = AcpiPsGetArg (CurrentOp, 1); - - /* - * Move the Package Op to the child (predicate) of the - * Case statement. - */ - CurrentOp->Common.Value.Arg = PredicateOp; - PredicateOp->Common.Parent = CurrentOp; - - /* Add the block code */ - - PredicateOp->Common.Next = TempOp; - - break; - - default: - - /* Should never get here */ - - break; - } - - /* Advance to next Case block */ - - CurrentOp = CurrentOp->Common.Next; - } - - /* If CurrentOp is now an Else, then this is a Default block */ - - if (CurrentOp && CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp->Common.DisasmOpcode = ACPI_DASM_DEFAULT; - } - - /* - * From the first If advance to the Break op. It's possible to - * have an Else (Default) op here when there is only one Case - * statement, so check for it. - */ - CurrentOp = StoreOp->Common.Next->Common.Next; - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp = CurrentOp->Common.Next; - } - - /* Ignore the Break Op */ - - CurrentOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE; - - return (TRUE); -} - -/******************************************************************************* - * - * FUNCTION: AcpiDmIsCaseBlock - * - * PARAMETERS: Op - Object to test - * - * RETURN: TRUE if Object is beginning of a Case block. - * - * DESCRIPTION: Determines if an Object is the beginning of a Case block for a - * Switch/Case statement. Parse tree must be one of the following - * forms: - * - * Else (Optional) - * If - * LEqual - * -NamePath- _T_x - * - * Else (Optional) - * If - * LNot - * LEqual - * Match - * Package - * ByteConst - * -NamePath- _T_x - * - ******************************************************************************/ - -static BOOLEAN -AcpiDmIsCaseBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *CurrentOp; - - if (!Op) - { - return (FALSE); - } - - /* Look for an If or ElseIf */ - - CurrentOp = Op; - if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) - { - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp) - { - return (FALSE); - } - } - - if (!CurrentOp || CurrentOp->Common.AmlOpcode != AML_IF_OP) - { - return (FALSE); - } - - /* Child must be LEqual or LNot */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp) - { - return (FALSE); - } - - switch (CurrentOp->Common.AmlOpcode) - { - case (AML_LOGICAL_EQUAL_OP): - - /* Next child must be NamePath with string _T_ */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || !CurrentOp->Common.Value.Name || - strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) - { - return (FALSE); - } - - break; - - case (AML_LOGICAL_NOT_OP): - - /* Child of LNot must be LEqual op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_LOGICAL_EQUAL_OP)) - { - return (FALSE); - } - - /* Child of LNot must be Match op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_MATCH_OP)) - { - return (FALSE); - } - - /* First child of Match must be Package op */ - - CurrentOp = AcpiPsGetArg (CurrentOp, 0); - if (!CurrentOp || (CurrentOp->Common.AmlOpcode != AML_PACKAGE_OP)) - { - return (FALSE); - } - - /* Third child of Match must be NamePath with string _T_ */ - - CurrentOp = AcpiPsGetArg (CurrentOp->Common.Parent, 2); - if (!CurrentOp || !CurrentOp->Common.Value.Name || - strncmp(CurrentOp->Common.Value.Name, "_T_", 3)) - { - return (FALSE); - } - - break; - - default: - - return (FALSE); - } - - return (TRUE); -} diff --git a/source/components/disassembler/dmresrc.c b/source/components/disassembler/dmresrc.c index bd8aa2dc62d3..3c24855f9771 100644 --- a/source/components/disassembler/dmresrc.c +++ b/source/components/disassembler/dmresrc.c @@ -197,8 +197,12 @@ static ACPI_RESOURCE_HANDLER AcpiGbl_DmResourceDispatch [] = AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */ AcpiDmExtendedDescriptor, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */ AcpiDmGpioDescriptor, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ - NULL, /* 0x0D, Reserved */ - AcpiDmSerialBusDescriptor /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */ + AcpiDmPinFunctionDescriptor, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ + AcpiDmSerialBusDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS */ + AcpiDmPinConfigDescriptor, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ + AcpiDmPinGroupDescriptor, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ + AcpiDmPinGroupFunctionDescriptor, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ + AcpiDmPinGroupConfigDescriptor, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ }; @@ -540,6 +544,15 @@ AcpiDmIsResourceTemplate ( * intialization byte list. Because the resource macros will create * a buffer of the exact required length (buffer length will be equal * to the actual length). + * + * NOTE (April 2017): Resource templates with this issue have been + * seen in the field. We still don't want to attempt to disassemble + * a buffer like this to a resource template because this output + * would not match the original input buffer (it would be shorter + * than the original when the disassembled code is recompiled). + * Basically, a buffer like this appears to be hand crafted in the + * first place, so just emitting a buffer object instead of a + * resource template more closely resembles the original ASL code. */ if (DeclaredBufferLength != BufferLength) { diff --git a/source/components/disassembler/dmresrcl2.c b/source/components/disassembler/dmresrcl2.c index 0c2c3360c214..68737545c34c 100644 --- a/source/components/disassembler/dmresrcl2.c +++ b/source/components/disassembler/dmresrcl2.c @@ -515,6 +515,112 @@ AcpiDmGpioDescriptor ( } } +/******************************************************************************* + * + * FUNCTION: AcpiDmPinFunctionDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinFunction descriptor + * + ******************************************************************************/ + +void +AcpiDmPinFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT16 *PinList; + UINT8 *VendorData; + char *DeviceName = NULL; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinFunction (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinFunction.Flags)]); + + if (Resource->PinFunction.PinConfig <= 3) + { + AcpiOsPrintf ("%s, ", + AcpiGbl_PpcDecode[Resource->PinFunction.PinConfig]); + } + else + { + AcpiOsPrintf ("0x%2.2X, ", Resource->PinFunction.PinConfig); + } + + /* FunctionNumber */ + + AcpiOsPrintf ("0x%4.4X, ", Resource->PinFunction.FunctionNumber); + + if (Resource->PinFunction.ResSourceOffset) + { + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinFunction.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + } + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X,\n", Resource->PinFunction.ResSourceIndex); + + AcpiDmIndent (Level + 1); + + /* Always ResourceConsumer */ + AcpiOsPrintf ("%s, ", AcpiGbl_ConsumeDecode [ACPI_CONSUMER]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinFunction.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinFunction.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinFunction.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = ((UINT32) (Resource->PinFunction.ResSourceOffset - + Resource->PinFunction.PinTableOffset)) / + sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinFunction.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + /******************************************************************************* * @@ -848,3 +954,363 @@ AcpiDmSerialBusDescriptor ( SerialBusResourceDispatch [Resource->CommonSerialBus.Type] ( Info, Resource, Length, Level); } + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinConfig + * + * PARAMETERS: PinConfigType - Pin configuration type + * PinConfigValue - Pin configuration value + * + * RETURN: None + * + * DESCRIPTION: Pretty prints PinConfig type and value. + * + ******************************************************************************/ + +static void +AcpiDmPinConfig( + UINT8 PinConfigType, + UINT32 PinConfigValue) +{ + if (PinConfigType <= 13) + { + AcpiOsPrintf ("0x%2.2X /* %s */, ", PinConfigType, + AcpiGbl_PtypDecode[PinConfigType]); + } + else + { + AcpiOsPrintf ("0x%2.2X, /* Vendor Defined */ ", PinConfigType); + } + + /* PinConfigValue */ + + AcpiOsPrintf ("0x%4.4X,\n", PinConfigValue); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinConfigDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinConfig descriptor + * + ******************************************************************************/ + +void +AcpiDmPinConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT16 *PinList; + UINT8 *VendorData; + char *DeviceName = NULL; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinConfig (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinConfig.Flags)]); + + AcpiDmPinConfig (Resource->PinConfig.PinConfigType, + Resource->PinConfig.PinConfigValue); + + AcpiDmIndent (Level + 1); + + if (Resource->PinConfig.ResSourceOffset) + { + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinConfig.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + } + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X, ", Resource->PinConfig.ResSourceIndex); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinConfig.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinConfig.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinConfig.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinConfig.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = ((UINT32) (Resource->PinConfig.ResSourceOffset - + Resource->PinConfig.PinTableOffset)) / + sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinConfig.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroup descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + char *Label; + UINT16 *PinList; + UINT8 *VendorData; + UINT32 PinCount; + UINT32 i; + + AcpiDmIndent (Level); + /* Always producer */ + AcpiOsPrintf ("PinGroup ("); + + Label = ACPI_ADD_PTR (char, + Resource, Resource->PinGroup.LabelOffset), + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroup.Flags)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroup.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroup.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroup.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); + + AcpiDmIndent (Level + 1); + + /* Dump the interrupt list */ + + AcpiOsPrintf ("{ // Pin list\n"); + + PinCount = (Resource->PinGroup.LabelOffset - + Resource->PinGroup.PinTableOffset) / sizeof (UINT16); + + PinList = (UINT16 *) ACPI_ADD_PTR (char, Resource, + Resource->PinGroup.PinTableOffset); + + for (i = 0; i < PinCount; i++) + { + AcpiDmIndent (Level + 2); + AcpiOsPrintf ("0x%4.4X%s\n", PinList[i], + ((i + 1) < PinCount) ? "," : ""); + } + + AcpiDmIndent (Level + 1); + AcpiOsPrintf ("}\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupFunctionDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroupFunction descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT8 *VendorData; + char *DeviceName = NULL; + char *Label = NULL; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinGroupFunction (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupFunction.Flags)]); + + /* FunctionNumber */ + + AcpiOsPrintf ("0x%4.4X, ", Resource->PinGroupFunction.FunctionNumber); + + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinGroupFunction.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X,\n", Resource->PinGroupFunction.ResSourceIndex); + + AcpiDmIndent (Level + 1); + + Label = ACPI_ADD_PTR (char, Resource, + Resource->PinGroupFunction.ResSourceLabelOffset); + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupFunction.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroupFunction.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroupFunction.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroupFunction.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); +} + +/******************************************************************************* + * + * FUNCTION: AcpiDmPinGroupConfigDescriptor + * + * PARAMETERS: Info - Extra resource info + * Resource - Pointer to the resource descriptor + * Length - Length of the descriptor in bytes + * Level - Current source code indentation level + * + * RETURN: None + * + * DESCRIPTION: Decode a PinGroupConfig descriptor + * + ******************************************************************************/ + +void +AcpiDmPinGroupConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level) +{ + UINT8 *VendorData; + char *DeviceName = NULL; + char *Label = NULL; + + AcpiDmIndent (Level); + AcpiOsPrintf ("PinGroupConfig (%s, ", + AcpiGbl_ShrDecode [ACPI_GET_1BIT_FLAG (Resource->PinGroupConfig.Flags)]); + + AcpiDmPinConfig(Resource->PinGroupConfig.PinConfigType, + Resource->PinGroupConfig.PinConfigValue); + + AcpiDmIndent (Level + 1); + + DeviceName = ACPI_ADD_PTR (char, + Resource, Resource->PinGroupConfig.ResSourceOffset), + AcpiUtPrintString (DeviceName, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + AcpiOsPrintf ("0x%2.2X, ", Resource->PinGroupConfig.ResSourceIndex); + + Label = ACPI_ADD_PTR (char, Resource, + Resource->PinGroupConfig.ResSourceLabelOffset); + AcpiUtPrintString (Label, ACPI_UINT16_MAX); + + AcpiOsPrintf (", "); + + AcpiOsPrintf ("%s, ", + AcpiGbl_ConsumeDecode [ACPI_EXTRACT_1BIT_FLAG (Resource->PinGroupConfig.Flags, 1)]); + + /* Insert a descriptor name */ + + AcpiDmDescriptorName (); + + AcpiOsPrintf (","); + + /* Dump the vendor data */ + + if (Resource->PinGroupConfig.VendorLength) + { + AcpiOsPrintf ("\n"); + AcpiDmIndent (Level + 1); + VendorData = ACPI_ADD_PTR (UINT8, Resource, + Resource->PinGroupConfig.VendorOffset); + + AcpiDmDumpRawDataBuffer (VendorData, + Resource->PinGroupConfig.VendorLength, Level); + } + + AcpiOsPrintf (")\n"); +} diff --git a/source/components/disassembler/dmwalk.c b/source/components/disassembler/dmwalk.c index 77d24a18e99c..750e639898aa 100644 --- a/source/components/disassembler/dmwalk.c +++ b/source/components/disassembler/dmwalk.c @@ -161,8 +161,6 @@ ACPI_MODULE_NAME ("dmwalk") -#define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: " - /* Stub for non-compiler code */ #ifndef ACPI_ASL_COMPILER @@ -584,13 +582,6 @@ AcpiDmDescendingOp ( return (AE_CTRL_DEPTH); } - if (AcpiDmIsTempName(Op)) - { - /* Ignore compiler generated temporary names */ - - return (AE_CTRL_DEPTH); - } - if (Op->Common.DisasmOpcode == ACPI_DASM_IGNORE_SINGLE) { /* Ignore this op, but not it's children */ @@ -642,10 +633,16 @@ AcpiDmDescendingOp ( Info->WalkState->ParserState.AmlStart); if (AcpiGbl_DmOpt_Verbose) { - AcpiOsPrintf (DB_FULL_OP_INFO, - (Info->WalkState->MethodNode ? - Info->WalkState->MethodNode->Name.Ascii : " "), - AmlOffset, (UINT32) Op->Common.AmlOpcode); + if (AcpiGbl_CmSingleStep) + { + AcpiOsPrintf ("%5.5X/%4.4X: ", + AmlOffset, (UINT32) Op->Common.AmlOpcode); + } + else + { + AcpiOsPrintf ("AML Offset %5.5X, Opcode %4.4X: ", + AmlOffset, (UINT32) Op->Common.AmlOpcode); + } } } @@ -782,7 +779,7 @@ AcpiDmDescendingOp ( Name = AcpiPsGetName (Op); if (Op->Named.Path) { - AcpiDmNamestring ((char *) Op->Named.Path); + AcpiDmNamestring (Op->Named.Path); } else { diff --git a/source/components/dispatcher/dsargs.c b/source/components/dispatcher/dsargs.c index 6a79c7cb09b2..504005b30aca 100644 --- a/source/components/dispatcher/dsargs.c +++ b/source/components/dispatcher/dsargs.c @@ -197,7 +197,7 @@ AcpiDsExecuteArguments ( ACPI_WALK_STATE *WalkState; - ACPI_FUNCTION_TRACE (DsExecuteArguments); + ACPI_FUNCTION_TRACE_PTR (DsExecuteArguments, AmlStart); /* Allocate a new parser op to be the root of the parsed tree */ @@ -474,7 +474,8 @@ AcpiDsGetPackageArguments ( return_ACPI_STATUS (AE_AML_INTERNAL); } - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Arg Init\n")); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Package Argument Init, AML Ptr: %p\n", + ObjDesc->Package.AmlStart)); /* Execute the AML code for the TermArg arguments */ diff --git a/source/components/dispatcher/dsdebug.c b/source/components/dispatcher/dsdebug.c index ceb6b8a51b70..4a0696a3632b 100644 --- a/source/components/dispatcher/dsdebug.c +++ b/source/components/dispatcher/dsdebug.c @@ -320,6 +320,7 @@ AcpiDsDumpMethodStack ( Op->Common.Next = NULL; #ifdef ACPI_DISASSEMBLER + AcpiOsPrintf ("Failed at "); AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX); #endif Op->Common.Next = Next; diff --git a/source/components/dispatcher/dsmethod.c b/source/components/dispatcher/dsmethod.c index d3588f5aaf16..79dff2c766cb 100644 --- a/source/components/dispatcher/dsmethod.c +++ b/source/components/dispatcher/dsmethod.c @@ -333,6 +333,7 @@ AcpiDsMethodError ( ACPI_WALK_STATE *WalkState) { UINT32 AmlOffset; + ACPI_NAME Name = 0; ACPI_FUNCTION_ENTRY (); @@ -361,9 +362,16 @@ AcpiDsMethodError ( AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, WalkState->ParserState.AmlStart); - Status = AcpiGbl_ExceptionHandler (Status, - WalkState->MethodNode ? - WalkState->MethodNode->Name.Integer : 0, + if (WalkState->MethodNode) + { + Name = WalkState->MethodNode->Name.Integer; + } + else if (WalkState->DeferredNode) + { + Name = WalkState->DeferredNode->Name.Integer; + } + + Status = AcpiGbl_ExceptionHandler (Status, Name, WalkState->Opcode, AmlOffset, NULL); AcpiExEnterInterpreter (); } diff --git a/source/components/dispatcher/dsopcode.c b/source/components/dispatcher/dsopcode.c index 6a4f5bf25551..3ceec94b17e2 100644 --- a/source/components/dispatcher/dsopcode.c +++ b/source/components/dispatcher/dsopcode.c @@ -353,10 +353,9 @@ AcpiDsInitBufferField ( (8 * (UINT32) BufferDesc->Buffer.Length)) { ACPI_ERROR ((AE_INFO, - "Field [%4.4s] at %u exceeds Buffer [%4.4s] size %u (bits)", - AcpiUtGetNodeName (ResultDesc), - BitOffset + BitCount, - AcpiUtGetNodeName (BufferDesc->Buffer.Node), + "Field [%4.4s] at bit offset/length %u/%u " + "exceeds size of target Buffer (%u bits)", + AcpiUtGetNodeName (ResultDesc), BitOffset, BitCount, 8 * (UINT32) BufferDesc->Buffer.Length)); Status = AE_AML_BUFFER_LIMIT; goto Cleanup; diff --git a/source/components/dispatcher/dspkginit.c b/source/components/dispatcher/dspkginit.c new file mode 100755 index 000000000000..efbc0f3a8043 --- /dev/null +++ b/source/components/dispatcher/dspkginit.c @@ -0,0 +1,638 @@ +/****************************************************************************** + * + * Module Name: dspkginit - Completion of deferred package initialization + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acnamesp.h" +#include "amlcode.h" +#include "acdispat.h" +#include "acinterp.h" + + +#define _COMPONENT ACPI_NAMESPACE + ACPI_MODULE_NAME ("dspkginit") + + +/* Local prototypes */ + +static void +AcpiDsResolvePackageElement ( + ACPI_OPERAND_OBJECT **Element); + + +/******************************************************************************* + * + * FUNCTION: AcpiDsBuildInternalPackageObj + * + * PARAMETERS: WalkState - Current walk state + * Op - Parser object to be translated + * ElementCount - Number of elements in the package - this is + * the NumElements argument to Package() + * ObjDescPtr - Where the ACPI internal object is returned + * + * RETURN: Status + * + * DESCRIPTION: Translate a parser Op package object to the equivalent + * namespace object + * + * NOTE: The number of elements in the package will be always be the NumElements + * count, regardless of the number of elements in the package list. If + * NumElements is smaller, only that many package list elements are used. + * if NumElements is larger, the Package object is padded out with + * objects of type Uninitialized (as per ACPI spec.) + * + * Even though the ASL compilers do not allow NumElements to be smaller + * than the Package list length (for the fixed length package opcode), some + * BIOS code modifies the AML on the fly to adjust the NumElements, and + * this code compensates for that. This also provides compatibility with + * other AML interpreters. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsBuildInternalPackageObj ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT *Op, + UINT32 ElementCount, + ACPI_OPERAND_OBJECT **ObjDescPtr) +{ + ACPI_PARSE_OBJECT *Arg; + ACPI_PARSE_OBJECT *Parent; + ACPI_OPERAND_OBJECT *ObjDesc = NULL; + ACPI_STATUS Status = AE_OK; + UINT16 Index; + UINT16 ReferenceCount; + UINT32 i; + + + ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj); + + + /* Find the parent of a possibly nested package */ + + Parent = Op->Common.Parent; + while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) || + (Parent->Common.AmlOpcode == AML_VARIABLE_PACKAGE_OP)) + { + Parent = Parent->Common.Parent; + } + + /* + * If we are evaluating a Named package object of the form: + * Name (xxxx, Package) + * the package object already exists, otherwise it must be created. + */ + ObjDesc = *ObjDescPtr; + if (!ObjDesc) + { + ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE); + *ObjDescPtr = ObjDesc; + if (!ObjDesc) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + +printf ("****DS: BuildPkg - Create package object %p\n", ObjDesc); + + ObjDesc->Package.Node = Parent->Common.Node; + } + +// +printf ("****DS: BuildPkg, from DsEvalDataObjectOperands - Valid: %X, Pass %u, %p\n", + ObjDesc->Package.Flags & AOPOBJ_DATA_VALID, + WalkState->PassNumber, ObjDesc); + +// just in case +if (ObjDesc->Package.Flags & AOPOBJ_DATA_VALID) +{ + return_ACPI_STATUS (AE_OK); +} + + /* + * Allocate the element array (array of pointers to the individual + * objects) based on the NumElements parameter. Add an extra pointer slot + * so that the list is always null terminated. + */ + ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED ( + ((ACPI_SIZE) ElementCount + 1) * sizeof (void *)); + + if (!ObjDesc->Package.Elements) + { + AcpiUtDeleteObjectDesc (ObjDesc); + return_ACPI_STATUS (AE_NO_MEMORY); + } + + ObjDesc->Package.Count = ElementCount; + + /* + * Initialize the elements of the package, up to the NumElements count. + * Package is automatically padded with uninitialized (NULL) elements + * if NumElements is greater than the package list length. Likewise, + * Package is truncated if NumElements is less than the list length. + */ + Arg = Op->Common.Value.Arg; + Arg = Arg->Common.Next; + + if (Arg) + { + printf ("****DS: Mark package evaluated\n"); + ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; + } + + for (i = 0; Arg && (i < ElementCount); i++) + { +printf ("****DS: Eval package element\n"); + + if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) + { +// Maybe this is just temp code: +/* +if (!Arg->Common.Node) +{ + printf ("****DS: No attached NS node\n"); + return_ACPI_STATUS (AE_AML_INTERNAL); +} +else */ if (Arg->Common.Node->Type == ACPI_TYPE_METHOD) + { + + /* + * A method reference "looks" to the parser to be a method + * invocation, so we special case it here + */ + Arg->Common.AmlOpcode = AML_INT_NAMEPATH_OP; + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); + } + else + { + /* This package element is already built, just get it */ + + ObjDesc->Package.Elements[i] = + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node); + } + } + else + { + Status = AcpiDsBuildInternalObject ( + WalkState, Arg, &ObjDesc->Package.Elements[i]); + if (Status == AE_NOT_FOUND) + { +// remove or fix + ACPI_ERROR ((AE_INFO, "%-48s", "****DS namepath not found")); + } + + /* + * Initialize this package element. This function handles the + * resolution of named references within the package. + */ + AcpiDsInitPackageElement (0, ObjDesc->Package.Elements[i], + NULL, &ObjDesc->Package.Elements[i]); + } + + if (*ObjDescPtr) + { + /* Existing package, get existing reference count */ + + ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount; + if (ReferenceCount > 1) + { + /* Make new element ref count match original ref count */ + + for (Index = 0; Index < (ReferenceCount - 1); Index++) + { + AcpiUtAddReference ((ObjDesc->Package.Elements[i])); + } + } + } + + Arg = Arg->Common.Next; + } + + /* Check for match between NumElements and actual length of PackageList */ + + if (Arg) + { + //ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID; + + + /* + * NumElements was exhausted, but there are remaining elements in the + * PackageList. Truncate the package to NumElements. + * + * Note: technically, this is an error, from ACPI spec: "It is an error + * for NumElements to be less than the number of elements in the + * PackageList". However, we just print a message and + * no exception is returned. This provides Windows compatibility. Some + * BIOSs will alter the NumElements on the fly, creating this type + * of ill-formed package object. + */ + while (Arg) + { + /* + * We must delete any package elements that were created earlier + * and are not going to be used because of the package truncation. + */ + if (Arg->Common.Node) + { + AcpiUtRemoveReference ( + ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node)); + Arg->Common.Node = NULL; + } + + /* Find out how many elements there really are */ + + i++; + Arg = Arg->Common.Next; + } + + ACPI_INFO (( + "Actual Package length (%u) is larger than " + "NumElements field (%u), truncated", + i, ElementCount)); + } + else if (i < ElementCount) + { + /* + * Arg list (elements) was exhausted, but we did not reach + * NumElements count. + * + * Note: this is not an error, the package is padded out + * with NULLs. + */ + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Package List length (%u) smaller than NumElements " + "count (%u), padded with null elements\n", + i, ElementCount)); + } + + Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsInitPackageElement + * + * PARAMETERS: ACPI_PKG_CALLBACK + * + * RETURN: Status + * + * DESCRIPTION: Resolve a named reference element within a package object + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsInitPackageElement ( + UINT8 ObjectType, + ACPI_OPERAND_OBJECT *SourceObject, + ACPI_GENERIC_STATE *State, + void *Context) +{ + ACPI_OPERAND_OBJECT **ElementPtr; + + + if (!SourceObject) + { + return (AE_OK); + } + + /* + * The following code is a bit of a hack to workaround a (current) + * limitation of the ACPI_PKG_CALLBACK interface. We need a pointer + * to the location within the element array because a new object + * may be created and stored there. + */ + if (Context) + { + /* A direct call was made to this function */ + + ElementPtr = (ACPI_OPERAND_OBJECT **) Context; + } + else + { + /* Call came from AcpiUtWalkPackageTree */ + + ElementPtr = State->Pkg.ThisTargetObj; + } + + /* We are only interested in reference objects/elements */ + + if (SourceObject->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) + { + /* Resolve the (named) reference to a namespace node */ + + AcpiDsResolvePackageElement (ElementPtr); + } + else if (SourceObject->Common.Type == ACPI_TYPE_PACKAGE) + { + SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; + } + + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsResolvePackageElement + * + * PARAMETERS: ElementPtr - Pointer to a reference object + * + * RETURN: Status + * + * DESCRIPTION: Resolve a package element that is a reference to a named + * object. + * + ******************************************************************************/ + +static void +AcpiDsResolvePackageElement ( + ACPI_OPERAND_OBJECT **ElementPtr) +{ + ACPI_STATUS Status; + ACPI_GENERIC_STATE ScopeInfo; + ACPI_OPERAND_OBJECT *Element = *ElementPtr; + ACPI_NAMESPACE_NODE *ResolvedNode; + ACPI_OBJECT_TYPE Type; + + + ACPI_FUNCTION_TRACE (DsResolvePackageElement); + + + /* Check if reference element is already resolved */ + + if (Element->Reference.Resolved) + { + return_VOID; + } + + /* Element must be a reference object of correct type */ + + ScopeInfo.Scope.Node = Element->Reference.Node; /* Prefix node */ + + Status = AcpiNsLookup (&ScopeInfo, + (char *) Element->Reference.Aml, /* Pointer to AML path */ + ACPI_TYPE_ANY, ACPI_IMODE_LOAD_PASS2, + ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, + NULL, &ResolvedNode); + + if (ACPI_FAILURE (Status)) + { + ACPI_EXCEPTION ((AE_INFO, Status, + "Could not resolve package element")); + return_VOID; + } + + else if (ResolvedNode->Type == ACPI_TYPE_ANY) + { + /* Named reference not resolved, return a NULL package element */ + + ACPI_ERROR ((AE_INFO, + "Could not resolve package element [%4.4s] in [%4.4s]", + ResolvedNode->Name.Ascii, ScopeInfo.Scope.Node->Name.Ascii)); + *ElementPtr = NULL; + return_VOID; + } + + else if (ResolvedNode->Flags & ANOBJ_TEMPORARY) + { + /* + * A temporary node found here indicates that the reference is + * to a node that was created within this method. We are not + * going to allow it (especially if the package is returned + * from the method) -- the temporary node will be deleted out + * from under the method. (05/2017). + */ + ACPI_ERROR ((AE_INFO, + "Package element is a temporary name [%4.4s], " + "returning NULL element", + ResolvedNode->Name.Ascii)); + *ElementPtr = NULL; + return_VOID; + } + + /* Update the reference object */ + + Element->Reference.Resolved = TRUE; + Element->Reference.Node = ResolvedNode; + Type = Element->Reference.Node->Type; + + /* + * Attempt to resolve the node to a value before we insert it into + * the package. If this is a reference to a common data type, + * resolve it immediately. According to the ACPI spec, package + * elements can only be "data objects" or method references. + * Attempt to resolve to an Integer, Buffer, String or Package. + * If cannot, return the named reference (for things like Devices, + * Methods, etc.) Buffer Fields and Fields will resolve to simple + * objects (int/buf/str/pkg). + * + * NOTE: References to things like Devices, Methods, Mutexes, etc. + * will remain as named references. This behavior is not described + * in the ACPI spec, but it appears to be an oversight. + */ + Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); + if (ACPI_FAILURE (Status)) + { + return_VOID; + } + +#if 0 + /* + * Special handling for Alias objects. We need to setup the type + * and the Op->Common.Node to point to the Alias target. Note, + * Alias has at most one level of indirection internally. + */ + Type = Op->Common.Node->Type; + if (Type == ACPI_TYPE_LOCAL_ALIAS) + { + Type = ObjDesc->Common.Type; + Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, + Op->Common.Node->Object); + } +#endif + + switch (Type) + { + /* + * These object types are a result of named references, so we will + * leave them as reference objects. In other words, these types + * have no intrinsic "value". + */ + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* TBD: This may not be necesssary */ + + AcpiUtAddReference (ResolvedNode->Object); + break; + + case ACPI_TYPE_MUTEX: + case ACPI_TYPE_METHOD: + case ACPI_TYPE_POWER: + case ACPI_TYPE_PROCESSOR: + case ACPI_TYPE_EVENT: + case ACPI_TYPE_REGION: + + break; + + default: + /* + * For all other types - the node was resolved to an actual + * operand object with a value, return the object + */ + *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; + break; + } + + return_VOID; +} diff --git a/source/components/dispatcher/dsutils.c b/source/components/dispatcher/dsutils.c index 77dff895f54d..4688e16ec8f0 100644 --- a/source/components/dispatcher/dsutils.c +++ b/source/components/dispatcher/dsutils.c @@ -791,12 +791,6 @@ AcpiDsCreateOperand ( if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK)) { - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "Argument previously created, already stacked\n")); - - AcpiDbDisplayArgumentObject ( - WalkState->Operands [WalkState->NumOperands - 1], WalkState); - /* * Use value that was already previously returned * by the evaluation of this argument diff --git a/source/components/dispatcher/dswexec.c b/source/components/dispatcher/dswexec.c index 4df147138def..dfdfeaa03660 100644 --- a/source/components/dispatcher/dswexec.c +++ b/source/components/dispatcher/dswexec.c @@ -723,7 +723,8 @@ AcpiDsExecEndOp ( case AML_TYPE_CREATE_OBJECT: ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, - "Executing CreateObject (Buffer/Package) Op=%p\n", Op)); + "Executing CreateObject (Buffer/Package) Op=%p AMLPtr=%p\n", + Op, Op->Named.Data)); switch (Op->Common.Parent->Common.AmlOpcode) { diff --git a/source/components/dispatcher/dswload.c b/source/components/dispatcher/dswload.c index f3f99ea1b914..8793c0ed1cf5 100644 --- a/source/components/dispatcher/dswload.c +++ b/source/components/dispatcher/dswload.c @@ -518,7 +518,7 @@ AcpiDsLoad1BeginOp ( /* Initialize the op */ #if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)) - Op->Named.Path = ACPI_CAST_PTR (UINT8, Path); + Op->Named.Path = Path; #endif if (Node) @@ -558,6 +558,10 @@ AcpiDsLoad1EndOp ( ACPI_OBJECT_TYPE ObjectType; ACPI_STATUS Status = AE_OK; +#ifdef ACPI_ASL_COMPILER + UINT8 ParamCount; +#endif + ACPI_FUNCTION_TRACE (DsLoad1EndOp); @@ -642,6 +646,37 @@ AcpiDsLoad1EndOp ( } } +#ifdef ACPI_ASL_COMPILER + /* + * For external opcode, get the object type from the argument and + * get the parameter count from the argument's next. + */ + if (AcpiGbl_DisasmFlag && + Op->Common.Node && + Op->Common.AmlOpcode == AML_EXTERNAL_OP) + { + /* + * Note, if this external is not a method + * Op->Common.Value.Arg->Common.Next->Common.Value.Integer == 0 + * Therefore, ParamCount will be 0. + */ + ParamCount = (UINT8) Op->Common.Value.Arg->Common.Next->Common.Value.Integer; + ObjectType = (UINT8) Op->Common.Value.Arg->Common.Value.Integer; + Op->Common.Node->Flags |= ANOBJ_IS_EXTERNAL; + Op->Common.Node->Type = (UINT8) ObjectType; + + AcpiDmCreateSubobjectForExternal ((UINT8)ObjectType, + &Op->Common.Node, ParamCount); + + /* + * Add the external to the external list because we may be + * emitting code based off of the items within the external list. + */ + AcpiDmAddOpToExternalList (Op, Op->Named.Path, (UINT8)ObjectType, ParamCount, + ACPI_EXT_ORIGIN_FROM_OPCODE | ACPI_EXT_RESOLVED_REFERENCE); + } +#endif + /* * If we are executing a method, do not create any namespace objects * during the load phase, only during execution. @@ -689,6 +724,7 @@ AcpiDsLoad1EndOp ( /* Pop the scope stack (only if loading a table) */ if (!WalkState->MethodNode && + Op->Common.AmlOpcode != AML_EXTERNAL_OP && AcpiNsOpensScope (ObjectType)) { ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n", diff --git a/source/components/dispatcher/dswload2.c b/source/components/dispatcher/dswload2.c index 46870830f44b..184f6aa367d2 100644 --- a/source/components/dispatcher/dswload2.c +++ b/source/components/dispatcher/dswload2.c @@ -428,6 +428,24 @@ AcpiDsLoad2BeginOp ( } } +#ifdef ACPI_ASL_COMPILER + + /* + * Do not open a scope for AML_EXTERNAL_OP + * AcpiNsLookup can open a new scope based on the object type + * of this op. AML_EXTERNAL_OP is a declaration rather than a + * definition. In the case that this external is a method object, + * AcpiNsLookup will open a new scope. However, an AML_EXTERNAL_OP + * associated with the ACPI_TYPE_METHOD is a declaration, rather than + * a definition. Flags is set to avoid opening a scope for any + * AML_EXTERNAL_OP. + */ + if (WalkState->Opcode == AML_EXTERNAL_OP) + { + Flags |= ACPI_NS_DONT_OPEN_SCOPE; + } +#endif + /* Add new entry or lookup existing entry */ Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType, diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c index f781f3e0ee7b..0466273685be 100644 --- a/source/components/events/evxfevnt.c +++ b/source/components/events/evxfevnt.c @@ -306,6 +306,13 @@ AcpiEnableEvent ( ACPI_FUNCTION_TRACE (AcpiEnableEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) @@ -372,6 +379,13 @@ AcpiDisableEvent ( ACPI_FUNCTION_TRACE (AcpiDisableEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) @@ -433,6 +447,13 @@ AcpiClearEvent ( ACPI_FUNCTION_TRACE (AcpiClearEvent); + /* If Hardware Reduced flag is set, there are no fixed events */ + + if (AcpiGbl_ReducedHardware) + { + return_ACPI_STATUS (AE_OK); + } + /* Decode the Fixed Event */ if (Event > ACPI_EVENT_MAX) diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c index cdc678719c7a..155f2c0d48dd 100644 --- a/source/components/executer/exdebug.c +++ b/source/components/executer/exdebug.c @@ -237,11 +237,11 @@ AcpiExDoDebugObject ( Timer = ((UINT32) AcpiOsGetTimer () / 10); Timer &= 0x03FFFFFF; - AcpiOsPrintf ("[ACPI Debug T=0x%8.8X] %*s", Timer, Level, " "); + AcpiOsPrintf ("ACPI Debug: T=0x%8.8X %*s", Timer, Level, " "); } else { - AcpiOsPrintf ("[ACPI Debug] %*s", Level, " "); + AcpiOsPrintf ("ACPI Debug: %*s", Level, " "); } } diff --git a/source/components/executer/exdump.c b/source/components/executer/exdump.c index 82b34038e326..2b23881f16cd 100644 --- a/source/components/executer/exdump.c +++ b/source/components/executer/exdump.c @@ -775,12 +775,13 @@ AcpiExDumpOperand ( if (Depth > 0) { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p ", - Depth, " ", Depth, ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%*s[%u] %p Refs=%u ", + Depth, " ", Depth, ObjDesc, ObjDesc->Common.ReferenceCount)); } else { - ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc)); + ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Refs=%u ", + ObjDesc, ObjDesc->Common.ReferenceCount)); } /* Decode object type */ @@ -818,8 +819,10 @@ AcpiExDumpOperand ( case ACPI_REFCLASS_NAME: - AcpiOsPrintf ("- [%4.4s]\n", - ObjDesc->Reference.Node->Name.Ascii); + AcpiUtRepairName (ObjDesc->Reference.Node->Name.Ascii); + AcpiOsPrintf ("- [%4.4s] (Node %p)\n", + ObjDesc->Reference.Node->Name.Ascii, + ObjDesc->Reference.Node); break; case ACPI_REFCLASS_ARG: @@ -1158,12 +1161,15 @@ AcpiExDumpReferenceObj ( &RetBuf, TRUE); if (ACPI_FAILURE (Status)) { - AcpiOsPrintf (" Could not convert name to pathname\n"); + AcpiOsPrintf (" Could not convert name to pathname: %s\n", + AcpiFormatException (Status)); } else { - AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer); - ACPI_FREE (RetBuf.Pointer); + AcpiOsPrintf ("%s: %s\n", + AcpiUtGetTypeName (ObjDesc->Reference.Node->Type), + (char *) RetBuf.Pointer); + ACPI_FREE (RetBuf.Pointer); } } else if (ObjDesc->Reference.Object) @@ -1281,9 +1287,8 @@ AcpiExDumpPackageObj ( case ACPI_TYPE_LOCAL_REFERENCE: - AcpiOsPrintf ("[Object Reference] Type [%s] %2.2X", - AcpiUtGetReferenceName (ObjDesc), - ObjDesc->Reference.Class); + AcpiOsPrintf ("[Object Reference] Class [%s]", + AcpiUtGetReferenceName (ObjDesc)); AcpiExDumpReferenceObj (ObjDesc); break; diff --git a/source/components/executer/exoparg1.c b/source/components/executer/exoparg1.c index a0efb25ece22..5d59276be8c1 100644 --- a/source/components/executer/exoparg1.c +++ b/source/components/executer/exoparg1.c @@ -959,7 +959,7 @@ AcpiExOpcode_1A_0T_1R ( if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED) { TempDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); + (ACPI_NAMESPACE_NODE *) Operand[0]); if (TempDesc && ((TempDesc->Common.Type == ACPI_TYPE_STRING) || (TempDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE))) @@ -1072,11 +1072,27 @@ AcpiExOpcode_1A_0T_1R ( * This is a DerefOf (ObjectReference) * Get the actual object from the Node (This is the dereference). * This case may only happen when a LocalX or ArgX is - * dereferenced above. + * dereferenced above, or for references to device and + * thermal objects. */ - ReturnDesc = AcpiNsGetAttachedObject ( - (ACPI_NAMESPACE_NODE *) Operand[0]); - AcpiUtAddReference (ReturnDesc); + switch (((ACPI_NAMESPACE_NODE *) Operand[0])->Type) + { + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* These types have no node subobject, return the NS node */ + + ReturnDesc = Operand[0]; + break; + + default: + /* For most types, get the object attached to the node */ + + ReturnDesc = AcpiNsGetAttachedObject ( + (ACPI_NAMESPACE_NODE *) Operand[0]); + AcpiUtAddReference (ReturnDesc); + break; + } } else { diff --git a/source/components/executer/exresolv.c b/source/components/executer/exresolv.c index d0c8c8a8daf4..64771922d919 100644 --- a/source/components/executer/exresolv.c +++ b/source/components/executer/exresolv.c @@ -493,12 +493,26 @@ AcpiExResolveMultiple ( (ACPI_NAMESPACE_NODE *) ObjDesc); } - if (!ObjDesc) + switch (Type) { - ACPI_ERROR ((AE_INFO, - "[%4.4s] Node is unresolved or uninitialized", - AcpiUtGetNodeName (Node))); - return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); + case ACPI_TYPE_DEVICE: + case ACPI_TYPE_THERMAL: + + /* These types have no attached subobject */ + break; + + default: + + /* All other types require a subobject */ + + if (!ObjDesc) + { + ACPI_ERROR ((AE_INFO, + "[%4.4s] Node is unresolved or uninitialized", + AcpiUtGetNodeName (Node))); + return_ACPI_STATUS (AE_AML_UNINITIALIZED_NODE); + } + break; } break; diff --git a/source/components/namespace/nsaccess.c b/source/components/namespace/nsaccess.c index 401015753219..1404eabf67ad 100644 --- a/source/components/namespace/nsaccess.c +++ b/source/components/namespace/nsaccess.c @@ -155,6 +155,9 @@ #include "acnamesp.h" #include "acdispat.h" +#ifdef ACPI_ASL_COMPILER + #include "acdisasm.h" +#endif #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsaccess") @@ -710,6 +713,30 @@ AcpiNsLookup ( CurrentNode)); } +#ifdef ACPI_ASL_COMPILER + /* + * If this ACPI name already exists within the namespace as an + * external declaration, then mark the external as a conflicting + * declaration and proceed to process the current node as if it did + * not exist in the namespace. If this node is not processed as + * normal, then it could cause improper namespace resolution + * by failing to open a new scope. + */ + if (AcpiGbl_DisasmFlag && + (Status == AE_ALREADY_EXISTS) && + ((ThisNode->Flags & ANOBJ_IS_EXTERNAL) || + (WalkState && WalkState->Opcode == AML_EXTERNAL_OP))) + { + ThisNode->Flags &= ~ANOBJ_IS_EXTERNAL; + ThisNode->Type = (UINT8)ThisSearchType; + if (WalkState->Opcode != AML_EXTERNAL_OP) + { + AcpiDmMarkExternalConflict (ThisNode); + } + break; + } +#endif + *ReturnNode = ThisNode; return_ACPI_STATUS (Status); } diff --git a/source/components/namespace/nsnames.c b/source/components/namespace/nsnames.c index 1dc536101e0b..f68fbc1ed547 100644 --- a/source/components/namespace/nsnames.c +++ b/source/components/namespace/nsnames.c @@ -324,10 +324,6 @@ AcpiNsHandleToPathname ( (void) AcpiNsBuildNormalizedPath (Node, Buffer->Pointer, RequiredSize, NoTrailing); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n", (char *) Buffer->Pointer, (UINT32) RequiredSize)); diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index 3ab7a0ebdcbf..2b6f6fb8e435 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -206,7 +206,7 @@ AcpiNsPrintNodePathname ( AcpiOsPrintf ("%s ", Message); } - AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node); + AcpiOsPrintf ("%s", (char *) Buffer.Pointer); ACPI_FREE (Buffer.Pointer); } } diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c index 4dd8ff1d2fe4..ab3ad5988549 100644 --- a/source/components/namespace/nsxfeval.c +++ b/source/components/namespace/nsxfeval.c @@ -199,6 +199,8 @@ AcpiEvaluateObjectTyped ( { ACPI_STATUS Status; BOOLEAN FreeBufferOnError = FALSE; + ACPI_HANDLE TargetHandle; + char *FullPathname; ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped); @@ -216,41 +218,56 @@ AcpiEvaluateObjectTyped ( FreeBufferOnError = TRUE; } + Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + FullPathname = AcpiNsGetExternalPathname (TargetHandle); + if (!FullPathname) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + /* Evaluate the object */ - Status = AcpiEvaluateObject (Handle, Pathname, - ExternalParams, ReturnBuffer); + Status = AcpiEvaluateObject (TargetHandle, NULL, ExternalParams, + ReturnBuffer); if (ACPI_FAILURE (Status)) { - return_ACPI_STATUS (Status); + goto Exit; } - /* Type ANY means "don't care" */ + /* Type ANY means "don't care about return value type" */ if (ReturnType == ACPI_TYPE_ANY) { - return_ACPI_STATUS (AE_OK); + goto Exit; } if (ReturnBuffer->Length == 0) { /* Error because caller specifically asked for a return value */ - ACPI_ERROR ((AE_INFO, "No return value")); - return_ACPI_STATUS (AE_NULL_OBJECT); + ACPI_ERROR ((AE_INFO, "%s did not return any object", + FullPathname)); + Status = AE_NULL_OBJECT; + goto Exit; } /* Examine the object type returned from EvaluateObject */ if (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type == ReturnType) { - return_ACPI_STATUS (AE_OK); + goto Exit; } /* Return object type does not match requested type */ ACPI_ERROR ((AE_INFO, - "Incorrect return type [%s] requested [%s]", + "Incorrect return type from %s - received [%s], requested [%s]", + FullPathname, AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type), AcpiUtGetTypeName (ReturnType))); @@ -268,7 +285,11 @@ AcpiEvaluateObjectTyped ( } ReturnBuffer->Length = 0; - return_ACPI_STATUS (AE_TYPE); + Status = AE_TYPE; + +Exit: + ACPI_FREE (FullPathname); + return_ACPI_STATUS (Status); } ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped) diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c index 8d2448bd8d41..5d59492a7ba8 100644 --- a/source/components/parser/psobject.c +++ b/source/components/parser/psobject.c @@ -237,12 +237,23 @@ AcpiPsGetAmlOpcode ( WalkState->Opcode, (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); + ACPI_ERROR ((AE_INFO, + "Aborting disassembly, AML byte code is corrupt")); + /* Dump the context surrounding the invalid opcode */ AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), 48, DB_BYTE_DISPLAY, (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); AcpiOsPrintf (" */\n"); + + /* + * Just abort the disassembly, cannot continue because the + * parser is essentially lost. The disassembler can then + * randomly fail because an ill-constructed parse tree + * can result. + */ + return_ACPI_STATUS (AE_AML_BAD_OPCODE); #endif } @@ -458,6 +469,10 @@ AcpiPsCreateOp ( { return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); } + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } /* Create Op structure and append to parent's argument list */ diff --git a/source/components/parser/psopcode.c b/source/components/parser/psopcode.c index 2ad29f19535f..97a32544998d 100644 --- a/source/components/parser/psopcode.c +++ b/source/components/parser/psopcode.c @@ -445,7 +445,7 @@ const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] = /* ACPI 6.0 opcodes */ -/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE,/* ? */ AML_TYPE_EXEC_3A_0T_0R, AML_FLAGS_EXEC_3A_0T_0R), +/* 81 */ ACPI_OP ("External", ARGP_EXTERNAL_OP, ARGI_EXTERNAL_OP, ACPI_TYPE_ANY, AML_CLASS_NAMED_OBJECT, AML_TYPE_NAMED_SIMPLE, AML_HAS_ARGS | AML_NSOBJECT | AML_NSOPCODE | AML_NSNODE | AML_NAMED), /* 82 */ ACPI_OP ("Comment", ARGP_COMMENT_OP, ARGI_COMMENT_OP, ACPI_TYPE_STRING, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT) /*! [End] no source code translation !*/ diff --git a/source/components/parser/psparse.c b/source/components/parser/psparse.c index 1a3a5345ccc5..854f054711f5 100644 --- a/source/components/parser/psparse.c +++ b/source/components/parser/psparse.c @@ -164,6 +164,7 @@ #include "acdispat.h" #include "amlcode.h" #include "acinterp.h" +#include "acnamesp.h" #define _COMPONENT ACPI_PARSER ACPI_MODULE_NAME ("psparse") @@ -664,8 +665,17 @@ AcpiPsParseAml ( /* Either the method parse or actual execution failed */ AcpiExExitInterpreter (); - ACPI_ERROR_METHOD ("Method parse/execution failed", - WalkState->MethodNode, NULL, Status); + if (Status == AE_ABORT_METHOD) + { + AcpiNsPrintNodePathname ( + WalkState->MethodNode, "Method aborted:"); + AcpiOsPrintf ("\n"); + } + else + { + ACPI_ERROR_METHOD ("Method parse/execution failed", + WalkState->MethodNode, NULL, Status); + } AcpiExEnterInterpreter (); /* Check for possible multi-thread reentrancy problem */ diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index 2c3d09eb6d00..492dde477961 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -471,6 +471,15 @@ AcpiRsGetAmlLength ( break; + case ACPI_RESOURCE_TYPE_PIN_FUNCTION: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinFunction.PinTableLength * 2) + + Resource->Data.PinFunction.ResourceSource.StringLength + + Resource->Data.PinFunction.VendorLength); + + break; + case ACPI_RESOURCE_TYPE_SERIAL_BUS: @@ -483,6 +492,42 @@ AcpiRsGetAmlLength ( break; + case ACPI_RESOURCE_TYPE_PIN_CONFIG: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinConfig.PinTableLength * 2) + + Resource->Data.PinConfig.ResourceSource.StringLength + + Resource->Data.PinConfig.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + (Resource->Data.PinGroup.PinTableLength * 2) + + Resource->Data.PinGroup.ResourceLabel.StringLength + + Resource->Data.PinGroup.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.PinGroupFunction.ResourceSource.StringLength + + Resource->Data.PinGroupFunction.ResourceSourceLabel.StringLength + + Resource->Data.PinGroupFunction.VendorLength); + + break; + + case ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG: + + TotalSize = (ACPI_RS_LENGTH) (TotalSize + + Resource->Data.PinGroupConfig.ResourceSource.StringLength + + Resource->Data.PinGroupConfig.ResourceSourceLabel.StringLength + + Resource->Data.PinGroupConfig.VendorLength); + + break; + default: break; @@ -668,6 +713,26 @@ AcpiRsGetListLength ( } break; + case ACPI_RESOURCE_NAME_PIN_FUNCTION: + + /* Vendor data is optional */ + + if (AmlResource->PinFunction.VendorLength) + { + ExtraStructBytes += + AmlResource->PinFunction.VendorOffset - + AmlResource->PinFunction.PinTableOffset + + AmlResource->PinFunction.VendorLength; + } + else + { + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->PinFunction.PinTableOffset; + } + break; + case ACPI_RESOURCE_NAME_SERIAL_BUS: MinimumAmlResourceLength = AcpiGbl_ResourceAmlSerialBusSizes[ @@ -677,6 +742,53 @@ AcpiRsGetListLength ( MinimumAmlResourceLength; break; + case ACPI_RESOURCE_NAME_PIN_CONFIG: + + /* Vendor data is optional */ + + if (AmlResource->PinConfig.VendorLength) + { + ExtraStructBytes += + AmlResource->PinConfig.VendorOffset - + AmlResource->PinConfig.PinTableOffset + + AmlResource->PinConfig.VendorLength; + } + else + { + ExtraStructBytes += + AmlResource->LargeHeader.ResourceLength + + sizeof (AML_RESOURCE_LARGE_HEADER) - + AmlResource->PinConfig.PinTableOffset; + } + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP: + + ExtraStructBytes += + AmlResource->PinGroup.VendorOffset - + AmlResource->PinGroup.PinTableOffset + + AmlResource->PinGroup.VendorLength; + + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION: + + ExtraStructBytes += + AmlResource->PinGroupFunction.VendorOffset - + AmlResource->PinGroupFunction.ResSourceOffset + + AmlResource->PinGroupFunction.VendorLength; + + break; + + case ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG: + + ExtraStructBytes += + AmlResource->PinGroupConfig.VendorOffset - + AmlResource->PinGroupConfig.ResSourceOffset + + AmlResource->PinGroupConfig.VendorLength; + + break; + default: break; diff --git a/source/components/resources/rsdump.c b/source/components/resources/rsdump.c index 9a980781239d..7cafdcf970fb 100644 --- a/source/components/resources/rsdump.c +++ b/source/components/resources/rsdump.c @@ -215,6 +215,11 @@ static void AcpiRsDumpResourceSource ( ACPI_RESOURCE_SOURCE *ResourceSource); +static void +AcpiRsDumpResourceLabel ( + char *Title, + ACPI_RESOURCE_LABEL *ResourceLabel); + static void AcpiRsDumpAddressCommon ( ACPI_RESOURCE_DATA *Resource); @@ -531,6 +536,22 @@ AcpiRsDumpDescriptor ( ACPI_RESOURCE_SOURCE, Target)); break; + case ACPI_RSD_LABEL: + /* + * ResourceLabel + */ + AcpiRsDumpResourceLabel ("Resource Label", ACPI_CAST_PTR ( + ACPI_RESOURCE_LABEL, Target)); + break; + + case ACPI_RSD_SOURCE_LABEL: + /* + * ResourceSourceLabel + */ + AcpiRsDumpResourceLabel ("Resource Source Label", ACPI_CAST_PTR ( + ACPI_RESOURCE_LABEL, Target)); + break; + default: AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", @@ -578,6 +599,32 @@ AcpiRsDumpResourceSource ( } +/******************************************************************************* + * + * FUNCTION: AcpiRsDumpResourceLabel + * + * PARAMETERS: Title - Title of the dumped resource field + * ResourceLabel - Pointer to a Resource Label struct + * + * RETURN: None + * + * DESCRIPTION: Common routine for dumping the ResourceLabel + * + ******************************************************************************/ + +static void +AcpiRsDumpResourceLabel ( + char *Title, + ACPI_RESOURCE_LABEL *ResourceLabel) +{ + ACPI_FUNCTION_ENTRY (); + + AcpiRsOutString (Title, + ResourceLabel->StringPtr ? + ResourceLabel->StringPtr : "[Not Specified]"); +} + + /******************************************************************************* * * FUNCTION: AcpiRsDumpAddressCommon diff --git a/source/components/resources/rsdumpinfo.c b/source/components/resources/rsdumpinfo.c index ba0f37ddcff9..cd9ae4d3500d 100644 --- a/source/components/resources/rsdumpinfo.c +++ b/source/components/resources/rsdumpinfo.c @@ -360,6 +360,74 @@ ACPI_RSDUMP_INFO AcpiRsDumpGpio[16] = {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (Gpio.VendorData), "VendorData", NULL}, }; +ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[10] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinFunction), "PinFunction", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinFunction.PinConfig), "PinConfig", AcpiGbl_PpcDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinFunction.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.FunctionNumber), "FunctionNumber", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinFunction.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinFunction.PinTable), "PinTable", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinFunction.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinFunction.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[11] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinConfig), "PinConfig", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinConfig.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinConfig.PinConfigType), "PinConfigType", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinConfig.PinConfigValue), "PinConfigValue", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinConfig.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinConfig.PinTable), "PinTable", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinConfig.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinConfig.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[8] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroup), "PinGroup", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroup.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroup.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.PinTableLength), "PinTableLength", NULL}, + {ACPI_RSD_WORDLIST, ACPI_RSD_OFFSET (PinGroup.PinTable), "PinTable", NULL}, + {ACPI_RSD_LABEL, ACPI_RSD_OFFSET (PinGroup.ResourceLabel), "ResourceLabel", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroup.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroup.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[9] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupFunction), "PinGroupFunction", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupFunction.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupFunction.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.FunctionNumber), "FunctionNumber", NULL}, + {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSourceLabel), "ResourceSourceLabel", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupFunction.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupFunction.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupFunction.VendorData), "VendorData", NULL}, +}; + +ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[10] = +{ + {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPinGroupConfig), "PinGroupConfig", NULL}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.RevisionId), "RevisionId", NULL}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.ProducerConsumer), "ProducerConsumer", AcpiGbl_ConsumeDecode}, + {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (PinGroupConfig.Sharable), "Sharing", AcpiGbl_ShrDecode}, + {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigType), "PinConfigType", NULL}, + {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (PinGroupConfig.PinConfigValue), "PinConfigValue", NULL}, + {ACPI_RSD_SOURCE_LABEL, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSourceLabel), "ResourceSourceLabel", NULL}, + {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (PinGroupConfig.ResourceSource), "ResourceSource", NULL}, + {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (PinGroupConfig.VendorLength), "VendorLength", NULL}, + {ACPI_RSD_SHORTLISTX,ACPI_RSD_OFFSET (PinGroupConfig.VendorData), "VendorData", NULL}, +}; + ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[4] = { {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedDma), "FixedDma", NULL}, diff --git a/source/components/resources/rsinfo.c b/source/components/resources/rsinfo.c index 499aff655ef2..581891297a52 100644 --- a/source/components/resources/rsinfo.c +++ b/source/components/resources/rsinfo.c @@ -192,6 +192,11 @@ ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[] = AcpiRsConvertGpio, /* 0x11, ACPI_RESOURCE_TYPE_GPIO */ AcpiRsConvertFixedDma, /* 0x12, ACPI_RESOURCE_TYPE_FIXED_DMA */ NULL, /* 0x13, ACPI_RESOURCE_TYPE_SERIAL_BUS - Use subtype table below */ + AcpiRsConvertPinFunction, /* 0x14, ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + AcpiRsConvertPinConfig, /* 0x15, ACPI_RESOURCE_TYPE_PIN_CONFIG */ + AcpiRsConvertPinGroup, /* 0x16, ACPI_RESOURCE_TYPE_PIN_GROUP */ + AcpiRsConvertPinGroupFunction, /* 0x17, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + AcpiRsConvertPinGroupConfig, /* 0x18, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; /* Dispatch tables for AML-to-resource (Get Resource) conversion functions */ @@ -232,8 +237,12 @@ ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[] = AcpiRsConvertAddress64, /* 0x0A, ACPI_RESOURCE_NAME_ADDRESS64 */ AcpiRsConvertExtAddress64, /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 */ AcpiRsConvertGpio, /* 0x0C, ACPI_RESOURCE_NAME_GPIO */ - NULL, /* 0x0D, Reserved */ + AcpiRsConvertPinFunction, /* 0x0D, ACPI_RESOURCE_NAME_PIN_FUNCTION */ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SERIAL_BUS - Use subtype table below */ + AcpiRsConvertPinConfig, /* 0x0F, ACPI_RESOURCE_NAME_PIN_CONFIG */ + AcpiRsConvertPinGroup, /* 0x10, ACPI_RESOURCE_NAME_PIN_GROUP */ + AcpiRsConvertPinGroupFunction, /* 0x11, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION */ + AcpiRsConvertPinGroupConfig, /* 0x12, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG */ }; /* Subtype table for SerialBus -- I2C, SPI, and UART */ @@ -273,6 +282,11 @@ ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[] = AcpiRsDumpGpio, /* ACPI_RESOURCE_TYPE_GPIO */ AcpiRsDumpFixedDma, /* ACPI_RESOURCE_TYPE_FIXED_DMA */ NULL, /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ + AcpiRsDumpPinFunction, /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + AcpiRsDumpPinConfig, /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ + AcpiRsDumpPinGroup, /* ACPI_RESOURCE_TYPE_PIN_GROUP */ + AcpiRsDumpPinGroupFunction, /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + AcpiRsDumpPinGroupConfig, /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; ACPI_RSDUMP_INFO *AcpiGbl_DumpSerialBusDispatch[] = @@ -312,6 +326,11 @@ const UINT8 AcpiGbl_AmlResourceSizes[] = sizeof (AML_RESOURCE_GPIO), /* ACPI_RESOURCE_TYPE_GPIO */ sizeof (AML_RESOURCE_FIXED_DMA), /* ACPI_RESOURCE_TYPE_FIXED_DMA */ sizeof (AML_RESOURCE_COMMON_SERIALBUS), /* ACPI_RESOURCE_TYPE_SERIAL_BUS */ + sizeof (AML_RESOURCE_PIN_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_FUNCTION */ + sizeof (AML_RESOURCE_PIN_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_CONFIG */ + sizeof (AML_RESOURCE_PIN_GROUP), /* ACPI_RESOURCE_TYPE_PIN_GROUP */ + sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), /* ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION */ + sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), /* ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG */ }; @@ -351,7 +370,12 @@ const UINT8 AcpiGbl_ResourceStructSizes[] = ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64), ACPI_RS_SIZE (ACPI_RESOURCE_GPIO), - ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS) + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), + ACPI_RS_SIZE (ACPI_RESOURCE_COMMON_SERIALBUS), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), }; const UINT8 AcpiGbl_AmlResourceSerialBusSizes[] = diff --git a/source/components/resources/rsmisc.c b/source/components/resources/rsmisc.c index 6a5dfd78c110..16db6fae794a 100644 --- a/source/components/resources/rsmisc.c +++ b/source/components/resources/rsmisc.c @@ -705,10 +705,7 @@ AcpiRsConvertResourceToAml ( /* Set vendor offset only if there is vendor data */ - if (Resource->Data.Gpio.VendorLength) - { - ACPI_SET16 (Target, AmlLength); - } + ACPI_SET16 (Target, AmlLength); AcpiRsSetResourceLength (AmlLength, Aml); break; diff --git a/source/components/resources/rsserial.c b/source/components/resources/rsserial.c index 30ddf522bce7..5395382d31c1 100644 --- a/source/components/resources/rsserial.c +++ b/source/components/resources/rsserial.c @@ -254,6 +254,78 @@ ACPI_RSCONVERT_INFO AcpiRsConvertGpio[18] = 0}, }; +/******************************************************************************* + * + * AcpiRsConvertPinfunction + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[13] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_FUNCTION, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_FUNCTION), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinFunction)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_FUNCTION, + sizeof (AML_RESOURCE_PIN_FUNCTION), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.RevisionId), + AML_OFFSET (PinFunction.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinFunction.Sharable), + AML_OFFSET (PinFunction.Flags), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.PinConfig), + AML_OFFSET (PinFunction.PinConfig), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinFunction.FunctionNumber), + AML_OFFSET (PinFunction.FunctionNumber), + 2}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTableLength), + AML_OFFSET (PinFunction.PinTableOffset), + AML_OFFSET (PinFunction.ResSourceOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinFunction.PinTable), + AML_OFFSET (PinFunction.PinTableOffset), + 0}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.Index), + AML_OFFSET (PinFunction.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringLength), + AML_OFFSET (PinFunction.ResSourceOffset), + AML_OFFSET (PinFunction.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.ResourceSource.StringPtr), + AML_OFFSET (PinFunction.ResSourceOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinFunction.VendorLength), + AML_OFFSET (PinFunction.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinFunction.VendorData), + AML_OFFSET (PinFunction.VendorOffset), + 0}, +}; + /******************************************************************************* * @@ -545,3 +617,278 @@ ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[23] = AML_OFFSET (UartSerialBus.DefaultBaudRate), 1}, }; + + +/******************************************************************************* + * + * AcpiRsConvertPinConfig + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[14] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_CONFIG, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_CONFIG), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinConfig)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_CONFIG, + sizeof (AML_RESOURCE_PIN_CONFIG), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.RevisionId), + AML_OFFSET (PinConfig.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.Sharable), + AML_OFFSET (PinConfig.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinConfig.ProducerConsumer), + AML_OFFSET (PinConfig.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.PinConfigType), + AML_OFFSET (PinConfig.PinConfigType), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinConfig.PinConfigValue), + AML_OFFSET (PinConfig.PinConfigValue), + 1}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTableLength), + AML_OFFSET (PinConfig.PinTableOffset), + AML_OFFSET (PinConfig.ResSourceOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinConfig.PinTable), + AML_OFFSET (PinConfig.PinTableOffset), + 0}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.Index), + AML_OFFSET (PinConfig.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringLength), + AML_OFFSET (PinConfig.ResSourceOffset), + AML_OFFSET (PinConfig.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.ResourceSource.StringPtr), + AML_OFFSET (PinConfig.ResSourceOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinConfig.VendorLength), + AML_OFFSET (PinConfig.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinConfig.VendorData), + AML_OFFSET (PinConfig.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroup + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[10] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroup)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP, + sizeof (AML_RESOURCE_PIN_GROUP), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroup.RevisionId), + AML_OFFSET (PinGroup.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroup.ProducerConsumer), + AML_OFFSET (PinGroup.Flags), + 0}, + + /* Pin Table */ + + /* + * It is OK to use GPIO operations here because none of them refer GPIO + * structures directly but instead use offsets given here. + */ + + {ACPI_RSC_COUNT_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTableLength), + AML_OFFSET (PinGroup.PinTableOffset), + AML_OFFSET (PinGroup.LabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_PIN, ACPI_RS_OFFSET (Data.PinGroup.PinTable), + AML_OFFSET (PinGroup.PinTableOffset), + 0}, + + /* Resource Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringLength), + AML_OFFSET (PinGroup.LabelOffset), + AML_OFFSET (PinGroup.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.ResourceLabel.StringPtr), + AML_OFFSET (PinGroup.LabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroup.VendorLength), + AML_OFFSET (PinGroup.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroup.VendorData), + AML_OFFSET (PinGroup.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroupFunction + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[13] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupFunction)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION, + sizeof (AML_RESOURCE_PIN_GROUP_FUNCTION), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.RevisionId), + AML_OFFSET (PinGroupFunction.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.Sharable), + AML_OFFSET (PinGroupFunction.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupFunction.ProducerConsumer), + AML_OFFSET (PinGroupFunction.Flags), + 1}, + + {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.PinGroupFunction.FunctionNumber), + AML_OFFSET (PinGroupFunction.FunctionNumber), + 1}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.Index), + AML_OFFSET (PinGroupFunction.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringLength), + AML_OFFSET (PinGroupFunction.ResSourceOffset), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSource.StringPtr), + AML_OFFSET (PinGroupFunction.ResSourceOffset), + 0}, + + /* Resource Source Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringLength), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), + AML_OFFSET (PinGroupFunction.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.ResourceSourceLabel.StringPtr), + AML_OFFSET (PinGroupFunction.ResSourceLabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorLength), + AML_OFFSET (PinGroupFunction.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupFunction.VendorData), + AML_OFFSET (PinGroupFunction.VendorOffset), + 0}, +}; + +/******************************************************************************* + * + * AcpiRsConvertPinGroupConfig + * + ******************************************************************************/ + +ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[14] = +{ + {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG, + ACPI_RS_SIZE (ACPI_RESOURCE_PIN_GROUP_CONFIG), + ACPI_RSC_TABLE_SIZE (AcpiRsConvertPinGroupConfig)}, + + {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG, + sizeof (AML_RESOURCE_PIN_GROUP_CONFIG), + 0}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.RevisionId), + AML_OFFSET (PinGroupConfig.RevisionId), + 1}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.Sharable), + AML_OFFSET (PinGroupConfig.Flags), + 0}, + + {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.PinGroupConfig.ProducerConsumer), + AML_OFFSET (PinGroupConfig.Flags), + 1}, + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigType), + AML_OFFSET (PinGroupConfig.PinConfigType), + 1}, + + {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.PinGroupConfig.PinConfigValue), + AML_OFFSET (PinGroupConfig.PinConfigValue), + 1}, + + /* Resource Source */ + + {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.Index), + AML_OFFSET (PinGroupConfig.ResSourceIndex), + 1}, + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringLength), + AML_OFFSET (PinGroupConfig.ResSourceOffset), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSource.StringPtr), + AML_OFFSET (PinGroupConfig.ResSourceOffset), + 0}, + + /* Resource Source Label */ + + {ACPI_RSC_COUNT_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringLength), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), + AML_OFFSET (PinGroupConfig.VendorOffset)}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.ResourceSourceLabel.StringPtr), + AML_OFFSET (PinGroupConfig.ResSourceLabelOffset), + 0}, + + /* Vendor Data */ + + {ACPI_RSC_COUNT_GPIO_VEN, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorLength), + AML_OFFSET (PinGroupConfig.VendorLength), + 1}, + + {ACPI_RSC_MOVE_GPIO_RES, ACPI_RS_OFFSET (Data.PinGroupConfig.VendorData), + AML_OFFSET (PinGroupConfig.VendorOffset), + 0}, +}; diff --git a/source/components/tables/tbfadt.c b/source/components/tables/tbfadt.c index 42d40a4af4d9..3e4e52299817 100644 --- a/source/components/tables/tbfadt.c +++ b/source/components/tables/tbfadt.c @@ -597,8 +597,8 @@ AcpiTbCreateLocalFadt ( * The 64-bit X fields are optional extensions to the original 32-bit FADT * V1.0 fields. Even if they are present in the FADT, they are optional and * are unused if the BIOS sets them to zero. Therefore, we must copy/expand - * 32-bit V1.0 fields to the 64-bit X fields if the the 64-bit X field is - * originally zero. + * 32-bit V1.0 fields to the 64-bit X fields if the 64-bit X field is originally + * zero. * * For ACPI 1.0 FADTs (that contain no 64-bit addresses), all 32-bit address * fields are expanded to the corresponding 64-bit X fields in the internal diff --git a/source/components/tables/tbutils.c b/source/components/tables/tbutils.c index 046add5f02e7..c7e0ee75372e 100644 --- a/source/components/tables/tbutils.c +++ b/source/components/tables/tbutils.c @@ -257,9 +257,9 @@ AcpiTbCheckDsdtHeader ( * * FUNCTION: AcpiTbCopyDsdt * - * PARAMETERS: TableDesc - Installed table to copy + * PARAMETERS: TableIndex - Index of installed table to copy * - * RETURN: None + * RETURN: The copied DSDT * * DESCRIPTION: Implements a subsystem option to copy the DSDT to local memory. * Some very bad BIOSs are known to either corrupt the DSDT or @@ -368,7 +368,7 @@ AcpiTbGetRootTableEntry ( * * FUNCTION: AcpiTbParseRootTable * - * PARAMETERS: Rsdp - Pointer to the RSDP + * PARAMETERS: RsdpAddress - Pointer to the RSDP * * RETURN: Status * diff --git a/source/components/utilities/utdecode.c b/source/components/utilities/utdecode.c index a0abe49cff98..7cb171bccecf 100644 --- a/source/components/utilities/utdecode.c +++ b/source/components/utilities/utdecode.c @@ -629,8 +629,9 @@ static const char *AcpiGbl_GenericNotify[ACPI_GENERIC_NOTIFY_MAX + 1] /* 09 */ "Device PLD Check", /* 0A */ "Reserved", /* 0B */ "System Locality Update", - /* 0C */ "Shutdown Request", /* Reserved in ACPI 6.0 */ - /* 0D */ "System Resource Affinity Update" + /* 0C */ "Reserved (was previously Shutdown Request)", /* Reserved in ACPI 6.0 */ + /* 0D */ "System Resource Affinity Update", + /* 0E */ "Heterogeneous Memory Attributes Update" /* ACPI 6.2 */ }; static const char *AcpiGbl_DeviceNotify[5] = diff --git a/source/components/utilities/utownerid.c b/source/components/utilities/utownerid.c index fba1d7adb084..a54513f65ae0 100644 --- a/source/components/utilities/utownerid.c +++ b/source/components/utilities/utownerid.c @@ -225,14 +225,20 @@ AcpiUtAllocateOwnerId ( break; } - if (!(AcpiGbl_OwnerIdMask[j] & (1 << k))) + /* + * Note: the UINT32 cast ensures that 1 is stored as a unsigned + * integer. Omitting the cast may result in 1 being stored as an + * int. Some compilers or runtime error detection may flag this as + * an error. + */ + if (!(AcpiGbl_OwnerIdMask[j] & ((UINT32) 1 << k))) { /* * Found a free ID. The actual ID is the bit index plus one, * making zero an invalid Owner ID. Save this as the last ID * allocated and update the global ID mask. */ - AcpiGbl_OwnerIdMask[j] |= (1 << k); + AcpiGbl_OwnerIdMask[j] |= ((UINT32) 1 << k); AcpiGbl_LastOwnerIdIndex = (UINT8) j; AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1); @@ -328,7 +334,7 @@ AcpiUtReleaseOwnerId ( /* Decode ID to index/offset pair */ Index = ACPI_DIV_32 (OwnerId); - Bit = 1 << ACPI_MOD_32 (OwnerId); + Bit = (UINT32) 1 << ACPI_MOD_32 (OwnerId); /* Free the owner ID only if it is valid */ diff --git a/source/components/utilities/utresdecode.c b/source/components/utilities/utresdecode.c new file mode 100644 index 000000000000..10d848742c48 --- /dev/null +++ b/source/components/utilities/utresdecode.c @@ -0,0 +1,461 @@ +/******************************************************************************* + * + * Module Name: utresdecode - Resource descriptor keyword strings + * + ******************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "acpi.h" +#include "accommon.h" +#include "acresrc.h" + + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utresdecode") + + +#if defined (ACPI_DEBUG_OUTPUT) || \ + defined (ACPI_DISASSEMBLER) || \ + defined (ACPI_DEBUGGER) + +/* + * Strings used to decode resource descriptors. + * Used by both the disassembler and the debugger resource dump routines + */ +const char *AcpiGbl_BmDecode[] = +{ + "NotBusMaster", + "BusMaster" +}; + +const char *AcpiGbl_ConfigDecode[] = +{ + "0 - Good Configuration", + "1 - Acceptable Configuration", + "2 - Suboptimal Configuration", + "3 - ***Invalid Configuration***", +}; + +const char *AcpiGbl_ConsumeDecode[] = +{ + "ResourceProducer", + "ResourceConsumer" +}; + +const char *AcpiGbl_DecDecode[] = +{ + "PosDecode", + "SubDecode" +}; + +const char *AcpiGbl_HeDecode[] = +{ + "Level", + "Edge" +}; + +const char *AcpiGbl_IoDecode[] = +{ + "Decode10", + "Decode16" +}; + +const char *AcpiGbl_LlDecode[] = +{ + "ActiveHigh", + "ActiveLow", + "ActiveBoth", + "Reserved" +}; + +const char *AcpiGbl_MaxDecode[] = +{ + "MaxNotFixed", + "MaxFixed" +}; + +const char *AcpiGbl_MemDecode[] = +{ + "NonCacheable", + "Cacheable", + "WriteCombining", + "Prefetchable" +}; + +const char *AcpiGbl_MinDecode[] = +{ + "MinNotFixed", + "MinFixed" +}; + +const char *AcpiGbl_MtpDecode[] = +{ + "AddressRangeMemory", + "AddressRangeReserved", + "AddressRangeACPI", + "AddressRangeNVS" +}; + +const char *AcpiGbl_RngDecode[] = +{ + "InvalidRanges", + "NonISAOnlyRanges", + "ISAOnlyRanges", + "EntireRange" +}; + +const char *AcpiGbl_RwDecode[] = +{ + "ReadOnly", + "ReadWrite" +}; + +const char *AcpiGbl_ShrDecode[] = +{ + "Exclusive", + "Shared", + "ExclusiveAndWake", /* ACPI 5.0 */ + "SharedAndWake" /* ACPI 5.0 */ +}; + +const char *AcpiGbl_SizDecode[] = +{ + "Transfer8", + "Transfer8_16", + "Transfer16", + "InvalidSize" +}; + +const char *AcpiGbl_TrsDecode[] = +{ + "DenseTranslation", + "SparseTranslation" +}; + +const char *AcpiGbl_TtpDecode[] = +{ + "TypeStatic", + "TypeTranslation" +}; + +const char *AcpiGbl_TypDecode[] = +{ + "Compatibility", + "TypeA", + "TypeB", + "TypeF" +}; + +const char *AcpiGbl_PpcDecode[] = +{ + "PullDefault", + "PullUp", + "PullDown", + "PullNone" +}; + +const char *AcpiGbl_IorDecode[] = +{ + "IoRestrictionNone", + "IoRestrictionInputOnly", + "IoRestrictionOutputOnly", + "IoRestrictionNoneAndPreserve" +}; + +const char *AcpiGbl_DtsDecode[] = +{ + "Width8bit", + "Width16bit", + "Width32bit", + "Width64bit", + "Width128bit", + "Width256bit", +}; + +/* GPIO connection type */ + +const char *AcpiGbl_CtDecode[] = +{ + "Interrupt", + "I/O" +}; + +/* Serial bus type */ + +const char *AcpiGbl_SbtDecode[] = +{ + "/* UNKNOWN serial bus type */", + "I2C", + "SPI", + "UART" +}; + +/* I2C serial bus access mode */ + +const char *AcpiGbl_AmDecode[] = +{ + "AddressingMode7Bit", + "AddressingMode10Bit" +}; + +/* I2C serial bus slave mode */ + +const char *AcpiGbl_SmDecode[] = +{ + "ControllerInitiated", + "DeviceInitiated" +}; + +/* SPI serial bus wire mode */ + +const char *AcpiGbl_WmDecode[] = +{ + "FourWireMode", + "ThreeWireMode" +}; + +/* SPI serial clock phase */ + +const char *AcpiGbl_CphDecode[] = +{ + "ClockPhaseFirst", + "ClockPhaseSecond" +}; + +/* SPI serial bus clock polarity */ + +const char *AcpiGbl_CpoDecode[] = +{ + "ClockPolarityLow", + "ClockPolarityHigh" +}; + +/* SPI serial bus device polarity */ + +const char *AcpiGbl_DpDecode[] = +{ + "PolarityLow", + "PolarityHigh" +}; + +/* UART serial bus endian */ + +const char *AcpiGbl_EdDecode[] = +{ + "LittleEndian", + "BigEndian" +}; + +/* UART serial bus bits per byte */ + +const char *AcpiGbl_BpbDecode[] = +{ + "DataBitsFive", + "DataBitsSix", + "DataBitsSeven", + "DataBitsEight", + "DataBitsNine", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */", + "/* UNKNOWN Bits per byte */" +}; + +/* UART serial bus stop bits */ + +const char *AcpiGbl_SbDecode[] = +{ + "StopBitsZero", + "StopBitsOne", + "StopBitsOnePlusHalf", + "StopBitsTwo" +}; + +/* UART serial bus flow control */ + +const char *AcpiGbl_FcDecode[] = +{ + "FlowControlNone", + "FlowControlHardware", + "FlowControlXON", + "/* UNKNOWN flow control keyword */" +}; + +/* UART serial bus parity type */ + +const char *AcpiGbl_PtDecode[] = +{ + "ParityTypeNone", + "ParityTypeEven", + "ParityTypeOdd", + "ParityTypeMark", + "ParityTypeSpace", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */", + "/* UNKNOWN parity keyword */" +}; + +/* PinConfig type */ + +const char *AcpiGbl_PtypDecode[] = +{ + "Default", + "Bias Pull-up", + "Bias Pull-down", + "Bias Default", + "Bias Disable", + "Bias High Impedance", + "Bias Bus Hold", + "Drive Open Drain", + "Drive Open Source", + "Drive Push Pull", + "Drive Strength", + "Slew Rate", + "Input Debounce", + "Input Schmitt Trigger", +}; + +#endif diff --git a/source/components/utilities/utresrc.c b/source/components/utilities/utresrc.c index 978711a557ab..8131cde2f834 100644 --- a/source/components/utilities/utresrc.c +++ b/source/components/utilities/utresrc.c @@ -158,287 +158,6 @@ ACPI_MODULE_NAME ("utresrc") -#if defined(ACPI_DEBUG_OUTPUT) || defined (ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER) - -/* - * Strings used to decode resource descriptors. - * Used by both the disassembler and the debugger resource dump routines - */ -const char *AcpiGbl_BmDecode[] = -{ - "NotBusMaster", - "BusMaster" -}; - -const char *AcpiGbl_ConfigDecode[] = -{ - "0 - Good Configuration", - "1 - Acceptable Configuration", - "2 - Suboptimal Configuration", - "3 - ***Invalid Configuration***", -}; - -const char *AcpiGbl_ConsumeDecode[] = -{ - "ResourceProducer", - "ResourceConsumer" -}; - -const char *AcpiGbl_DecDecode[] = -{ - "PosDecode", - "SubDecode" -}; - -const char *AcpiGbl_HeDecode[] = -{ - "Level", - "Edge" -}; - -const char *AcpiGbl_IoDecode[] = -{ - "Decode10", - "Decode16" -}; - -const char *AcpiGbl_LlDecode[] = -{ - "ActiveHigh", - "ActiveLow", - "ActiveBoth", - "Reserved" -}; - -const char *AcpiGbl_MaxDecode[] = -{ - "MaxNotFixed", - "MaxFixed" -}; - -const char *AcpiGbl_MemDecode[] = -{ - "NonCacheable", - "Cacheable", - "WriteCombining", - "Prefetchable" -}; - -const char *AcpiGbl_MinDecode[] = -{ - "MinNotFixed", - "MinFixed" -}; - -const char *AcpiGbl_MtpDecode[] = -{ - "AddressRangeMemory", - "AddressRangeReserved", - "AddressRangeACPI", - "AddressRangeNVS" -}; - -const char *AcpiGbl_RngDecode[] = -{ - "InvalidRanges", - "NonISAOnlyRanges", - "ISAOnlyRanges", - "EntireRange" -}; - -const char *AcpiGbl_RwDecode[] = -{ - "ReadOnly", - "ReadWrite" -}; - -const char *AcpiGbl_ShrDecode[] = -{ - "Exclusive", - "Shared", - "ExclusiveAndWake", /* ACPI 5.0 */ - "SharedAndWake" /* ACPI 5.0 */ -}; - -const char *AcpiGbl_SizDecode[] = -{ - "Transfer8", - "Transfer8_16", - "Transfer16", - "InvalidSize" -}; - -const char *AcpiGbl_TrsDecode[] = -{ - "DenseTranslation", - "SparseTranslation" -}; - -const char *AcpiGbl_TtpDecode[] = -{ - "TypeStatic", - "TypeTranslation" -}; - -const char *AcpiGbl_TypDecode[] = -{ - "Compatibility", - "TypeA", - "TypeB", - "TypeF" -}; - -const char *AcpiGbl_PpcDecode[] = -{ - "PullDefault", - "PullUp", - "PullDown", - "PullNone" -}; - -const char *AcpiGbl_IorDecode[] = -{ - "IoRestrictionNone", - "IoRestrictionInputOnly", - "IoRestrictionOutputOnly", - "IoRestrictionNoneAndPreserve" -}; - -const char *AcpiGbl_DtsDecode[] = -{ - "Width8bit", - "Width16bit", - "Width32bit", - "Width64bit", - "Width128bit", - "Width256bit", -}; - -/* GPIO connection type */ - -const char *AcpiGbl_CtDecode[] = -{ - "Interrupt", - "I/O" -}; - -/* Serial bus type */ - -const char *AcpiGbl_SbtDecode[] = -{ - "/* UNKNOWN serial bus type */", - "I2C", - "SPI", - "UART" -}; - -/* I2C serial bus access mode */ - -const char *AcpiGbl_AmDecode[] = -{ - "AddressingMode7Bit", - "AddressingMode10Bit" -}; - -/* I2C serial bus slave mode */ - -const char *AcpiGbl_SmDecode[] = -{ - "ControllerInitiated", - "DeviceInitiated" -}; - -/* SPI serial bus wire mode */ - -const char *AcpiGbl_WmDecode[] = -{ - "FourWireMode", - "ThreeWireMode" -}; - -/* SPI serial clock phase */ - -const char *AcpiGbl_CphDecode[] = -{ - "ClockPhaseFirst", - "ClockPhaseSecond" -}; - -/* SPI serial bus clock polarity */ - -const char *AcpiGbl_CpoDecode[] = -{ - "ClockPolarityLow", - "ClockPolarityHigh" -}; - -/* SPI serial bus device polarity */ - -const char *AcpiGbl_DpDecode[] = -{ - "PolarityLow", - "PolarityHigh" -}; - -/* UART serial bus endian */ - -const char *AcpiGbl_EdDecode[] = -{ - "LittleEndian", - "BigEndian" -}; - -/* UART serial bus bits per byte */ - -const char *AcpiGbl_BpbDecode[] = -{ - "DataBitsFive", - "DataBitsSix", - "DataBitsSeven", - "DataBitsEight", - "DataBitsNine", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */", - "/* UNKNOWN Bits per byte */" -}; - -/* UART serial bus stop bits */ - -const char *AcpiGbl_SbDecode[] = -{ - "StopBitsZero", - "StopBitsOne", - "StopBitsOnePlusHalf", - "StopBitsTwo" -}; - -/* UART serial bus flow control */ - -const char *AcpiGbl_FcDecode[] = -{ - "FlowControlNone", - "FlowControlHardware", - "FlowControlXON", - "/* UNKNOWN flow control keyword */" -}; - -/* UART serial bus parity type */ - -const char *AcpiGbl_PtDecode[] = -{ - "ParityTypeNone", - "ParityTypeEven", - "ParityTypeOdd", - "ParityTypeMark", - "ParityTypeSpace", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */", - "/* UNKNOWN parity keyword */" -}; - -#endif - - /* * Base sizes of the raw AML resource descriptors, indexed by resource type. * Zero indicates a reserved (and therefore invalid) resource type. @@ -479,8 +198,12 @@ const UINT8 AcpiGbl_ResourceAmlSizes[] = ACPI_AML_SIZE_LARGE (AML_RESOURCE_ADDRESS64), ACPI_AML_SIZE_LARGE (AML_RESOURCE_EXTENDED_ADDRESS64), ACPI_AML_SIZE_LARGE (AML_RESOURCE_GPIO), - 0, + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_FUNCTION), ACPI_AML_SIZE_LARGE (AML_RESOURCE_COMMON_SERIALBUS), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_CONFIG), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_FUNCTION), + ACPI_AML_SIZE_LARGE (AML_RESOURCE_PIN_GROUP_CONFIG), }; const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[] = @@ -534,8 +257,12 @@ static const UINT8 AcpiGbl_ResourceTypes[] = ACPI_VARIABLE_LENGTH, /* 0A Qword* address */ ACPI_FIXED_LENGTH, /* 0B Extended* address */ ACPI_VARIABLE_LENGTH, /* 0C Gpio* */ - 0, - ACPI_VARIABLE_LENGTH /* 0E *SerialBus */ + ACPI_VARIABLE_LENGTH, /* 0D PinFunction */ + ACPI_VARIABLE_LENGTH, /* 0E *SerialBus */ + ACPI_VARIABLE_LENGTH, /* 0F PinConfig */ + ACPI_VARIABLE_LENGTH, /* 10 PinGroup */ + ACPI_VARIABLE_LENGTH, /* 11 PinGroupFunction */ + ACPI_VARIABLE_LENGTH, /* 12 PinGroupConfig */ }; @@ -580,7 +307,7 @@ AcpiUtWalkAmlResources ( * The absolute minimum resource template is one EndTag descriptor. * However, we will treat a lone EndTag as just a simple buffer. */ - if (AmlLength < sizeof (AML_RESOURCE_END_TAG)) + if (AmlLength <= sizeof (AML_RESOURCE_END_TAG)) { return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); } @@ -613,8 +340,8 @@ AcpiUtWalkAmlResources ( if (UserFunction) { - Status = UserFunction (Aml, Length, Offset, - ResourceIndex, Context); + Status = UserFunction ( + Aml, Length, Offset, ResourceIndex, Context); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); @@ -651,15 +378,10 @@ AcpiUtWalkAmlResources ( *Context = Aml; } - /* Check if buffer is defined to be longer than the resource length */ - - if (AmlLength > (Offset + Length)) - { - return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG); - } - - /* Normal exit */ - + /* + * Normal exit. Note: We allow the buffer to be larger than + * the resource template, as long as the END_TAG exists. + */ return_ACPI_STATUS (AE_OK); } diff --git a/source/components/utilities/utxfmutex.c b/source/components/utilities/utxfmutex.c index 7a46452a885b..2f93b108214c 100644 --- a/source/components/utilities/utxfmutex.c +++ b/source/components/utilities/utxfmutex.c @@ -277,6 +277,8 @@ AcpiAcquireMutex ( return (Status); } +ACPI_EXPORT_SYMBOL (AcpiAcquireMutex) + /******************************************************************************* * @@ -317,3 +319,5 @@ AcpiReleaseMutex ( AcpiOsReleaseMutex (MutexObj->Mutex.OsMutex); return (AE_OK); } + +ACPI_EXPORT_SYMBOL (AcpiReleaseMutex) diff --git a/source/include/acapps.h b/source/include/acapps.h index 6ceb0f237e66..6ef98550601c 100644 --- a/source/include/acapps.h +++ b/source/include/acapps.h @@ -294,7 +294,7 @@ AcpiDmFinishNamespaceLoad ( ACPI_OWNER_ID OwnerId); void -AcpiDmConvertResourceIndexes ( +AcpiDmConvertParseObjects ( ACPI_PARSE_OBJECT *ParseTreeRoot, ACPI_NAMESPACE_NODE *NamespaceRoot); diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 01b0829d37c7..5beec2d4fb48 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -207,6 +207,11 @@ typedef enum ACPI_DMT_FLAGS1, ACPI_DMT_FLAGS2, ACPI_DMT_FLAGS4, + ACPI_DMT_FLAGS4_0, + ACPI_DMT_FLAGS4_4, + ACPI_DMT_FLAGS4_8, + ACPI_DMT_FLAGS4_12, + ACPI_DMT_FLAGS16_16, ACPI_DMT_UINT8, ACPI_DMT_UINT16, ACPI_DMT_UINT24, @@ -257,6 +262,7 @@ typedef enum ACPI_DMT_HEST, ACPI_DMT_HESTNTFY, ACPI_DMT_HESTNTYP, + ACPI_DMT_HMAT, ACPI_DMT_IORTMEM, ACPI_DMT_IVRS, ACPI_DMT_LPIT, @@ -264,6 +270,7 @@ typedef enum ACPI_DMT_NFIT, ACPI_DMT_PCCT, ACPI_DMT_PMTT, + ACPI_DMT_PPTT, ACPI_DMT_SLIC, ACPI_DMT_SRAT, @@ -412,12 +419,22 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest10[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHest11[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpitHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoLpit1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1b[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat1c[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmat2a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoHmatHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoIort0a[]; @@ -495,6 +512,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcctHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[]; @@ -513,6 +537,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat3[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoStao[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoStaoStr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[]; @@ -529,6 +554,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoWpbt0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoWsmt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoXenv[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2]; @@ -640,6 +666,10 @@ void AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpHmat ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpIort ( ACPI_TABLE_HEADER *Table); @@ -684,6 +714,10 @@ void AcpiDmDumpPmtt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpPptt ( + ACPI_TABLE_HEADER *Table); + UINT32 AcpiDmDumpRsdp ( ACPI_TABLE_HEADER *Table); @@ -759,10 +793,6 @@ AcpiDmDisassembleOneOp ( ACPI_OP_WALK_INFO *Info, ACPI_PARSE_OBJECT *Op); -BOOLEAN -AcpiDmIsTempName ( - ACPI_PARSE_OBJECT *Op); - UINT32 AcpiDmListType ( ACPI_PARSE_OBJECT *Op); @@ -887,6 +917,12 @@ AcpiDmAddOpToExternalList ( UINT32 Value, UINT16 Flags); +void +AcpiDmCreateSubobjectForExternal ( + UINT8 Type, + ACPI_NAMESPACE_NODE **Node, + UINT32 Value); + void AcpiDmAddNodeToExternalList ( ACPI_NAMESPACE_NODE *Node, @@ -895,11 +931,17 @@ AcpiDmAddNodeToExternalList ( UINT16 Flags); void -AcpiDmAddExternalsToNamespace ( +AcpiDmAddExternalListToNamespace ( void); +void +AcpiDmAddOneExternalToNamespace ( + char *Path, + UINT8 Type, + UINT32 Value); + UINT32 -AcpiDmGetExternalMethodCount ( +AcpiDmGetUnresolvedExternalMethodCount ( void); void @@ -923,6 +965,11 @@ void AcpiDmGetExternalsFromFile ( void); +void +AcpiDmMarkExternalConflict ( + ACPI_NAMESPACE_NODE *Node); + + /* * dmresrc */ @@ -1047,6 +1094,41 @@ AcpiDmGpioDescriptor ( UINT32 Length, UINT32 Level); +void +AcpiDmPinFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmPinConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmPinGroupDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmPinGroupFunctionDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + +void +AcpiDmPinGroupConfigDescriptor ( + ACPI_OP_WALK_INFO *Info, + AML_RESOURCE *Resource, + UINT32 Length, + UINT32 Level); + void AcpiDmSerialBusDescriptor ( ACPI_OP_WALK_INFO *Info, @@ -1168,6 +1250,17 @@ AcpiDmCloseOperator ( ACPI_PARSE_OBJECT *Op); +/* + * dmtables + */ +ACPI_STATUS +AcpiDmProcessSwitch ( + ACPI_PARSE_OBJECT *Op); + +void +AcpiDmClearTempList( + void); + /* * dmtables */ diff --git a/source/include/acglobal.h b/source/include/acglobal.h index edb696a9ba68..686dcd819eb3 100644 --- a/source/include/acglobal.h +++ b/source/include/acglobal.h @@ -427,6 +427,7 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ForceAmlDisassembly, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Verbose, TRUE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DmEmitExternalOpcodes, FALSE); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DoDisassemblerOptimizations, TRUE); +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT_LIST, *AcpiGbl_TempListHead, NULL); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); @@ -480,6 +481,8 @@ ACPI_GLOBAL (const char, *AcpiGbl_PldVerticalPositionList[]); ACPI_GLOBAL (const char, *AcpiGbl_PldHorizontalPositionList[]); ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DisasmFlag, FALSE); + #endif /* diff --git a/source/include/aclocal.h b/source/include/aclocal.h index 92eb49a6a1b1..1d94a59198fe 100644 --- a/source/include/aclocal.h +++ b/source/include/aclocal.h @@ -1136,7 +1136,7 @@ typedef struct acpi_parse_obj_common typedef struct acpi_parse_obj_named { ACPI_PARSE_COMMON - UINT8 *Path; + char *Path; UINT8 *Data; /* AML body or bytelist data */ UINT32 Length; /* AML length */ UINT32 Name; /* 4-byte name or zero if no name */ @@ -1444,8 +1444,13 @@ typedef struct acpi_port_info #define ACPI_RESOURCE_NAME_ADDRESS64 0x8A #define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B #define ACPI_RESOURCE_NAME_GPIO 0x8C +#define ACPI_RESOURCE_NAME_PIN_FUNCTION 0x8D #define ACPI_RESOURCE_NAME_SERIAL_BUS 0x8E -#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8E +#define ACPI_RESOURCE_NAME_PIN_CONFIG 0x8F +#define ACPI_RESOURCE_NAME_PIN_GROUP 0x90 +#define ACPI_RESOURCE_NAME_PIN_GROUP_FUNCTION 0x91 +#define ACPI_RESOURCE_NAME_PIN_GROUP_CONFIG 0x92 +#define ACPI_RESOURCE_NAME_LARGE_MAX 0x92 /***************************************************************************** @@ -1482,6 +1487,7 @@ typedef struct acpi_external_list #define ACPI_EXT_INTERNAL_PATH_ALLOCATED 0x04 /* Deallocate internal path on completion */ #define ACPI_EXT_EXTERNAL_EMITTED 0x08 /* External() statement has been emitted */ #define ACPI_EXT_ORIGIN_FROM_OPCODE 0x10 /* External came from a External() opcode */ +#define ACPI_EXT_CONFLICTING_DECLARATION 0x20 /* External has a conflicting declaration within AML */ typedef struct acpi_external_file @@ -1492,6 +1498,13 @@ typedef struct acpi_external_file } ACPI_EXTERNAL_FILE; +typedef struct acpi_parse_object_list +{ + ACPI_PARSE_OBJECT *Op; + struct acpi_parse_object_list *Next; + +} ACPI_PARSE_OBJECT_LIST; + /***************************************************************************** * * Debugger diff --git a/source/include/acopcode.h b/source/include/acopcode.h index b0cc4b1ec764..3ce2772b0456 100644 --- a/source/include/acopcode.h +++ b/source/include/acopcode.h @@ -221,7 +221,7 @@ #define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA) #define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST) #define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME) -#define ARGP_EXTERNAL_OP ARGP_LIST3 (ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_BYTEDATA) +#define ARGP_EXTERNAL_OP ARGP_LIST3 (ARGP_NAME, ARGP_BYTEDATA, ARGP_BYTEDATA) #define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG) #define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST) #define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET) diff --git a/source/include/acpixf.h b/source/include/acpixf.h index 55a0bded6848..934e668369b0 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 0x20170303 +#define ACPI_CA_VERSION 0x20170531 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acpredef.h b/source/include/acpredef.h index 5adc110d8c9c..95a18a47e796 100644 --- a/source/include/acpredef.h +++ b/source/include/acpredef.h @@ -682,6 +682,9 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = {{"_HID", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING)}}, + {{"_HMA", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, + {{"_HOT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, @@ -726,6 +729,17 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = PACKAGE_INFO (ACPI_PTYPE2_VAR_VAR, ACPI_RTYPE_INTEGER, 3, ACPI_RTYPE_INTEGER | ACPI_RTYPE_BUFFER | ACPI_RTYPE_STRING, 10,0), + {{"_LSI", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 3,0,0,0), + + {{"_LSR", METHOD_2ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER), + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, + PACKAGE_INFO (ACPI_PTYPE1_FIXED, ACPI_RTYPE_INTEGER, 1, ACPI_RTYPE_BUFFER, 1,0), + + {{"_LSW", METHOD_3ARGS (ACPI_TYPE_INTEGER, ACPI_TYPE_INTEGER, ACPI_TYPE_BUFFER), + METHOD_RETURNS (ACPI_RTYPE_INTEGER)}}, + {{"_MAT", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, diff --git a/source/include/acresrc.h b/source/include/acresrc.h index e6458e5464ba..ca5aad026054 100644 --- a/source/include/acresrc.h +++ b/source/include/acresrc.h @@ -264,7 +264,9 @@ typedef enum ACPI_RSD_UINT16, ACPI_RSD_UINT32, ACPI_RSD_UINT64, - ACPI_RSD_WORDLIST + ACPI_RSD_WORDLIST, + ACPI_RSD_LABEL, + ACPI_RSD_SOURCE_LABEL, } ACPI_RSDUMP_OPCODES; @@ -496,6 +498,11 @@ extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedDma[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertI2cSerialBus[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertSpiSerialBus[]; extern ACPI_RSCONVERT_INFO AcpiRsConvertUartSerialBus[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertPinFunction[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertPinConfig[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroup[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupFunction[]; +extern ACPI_RSCONVERT_INFO AcpiRsConvertPinGroupConfig[]; /* These resources require separate get/set tables */ @@ -540,12 +547,17 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[]; extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[]; extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[]; extern ACPI_RSDUMP_INFO AcpiRsDumpGpio[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpPinFunction[]; extern ACPI_RSDUMP_INFO AcpiRsDumpFixedDma[]; extern ACPI_RSDUMP_INFO AcpiRsDumpCommonSerialBus[]; extern ACPI_RSDUMP_INFO AcpiRsDumpI2cSerialBus[]; extern ACPI_RSDUMP_INFO AcpiRsDumpSpiSerialBus[]; extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[]; extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpPinConfig[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroup[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupFunction[]; +extern ACPI_RSDUMP_INFO AcpiRsDumpPinGroupConfig[]; #endif #endif /* __ACRESRC_H__ */ diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h index 7df5a63f61d1..0057722c1e6d 100644 --- a/source/include/acrestyp.h +++ b/source/include/acrestyp.h @@ -435,6 +435,13 @@ typedef union acpi_resource_attribute } ACPI_RESOURCE_ATTRIBUTE; +typedef struct acpi_resource_label +{ + UINT16 StringLength; + char *StringPtr; + +} ACPI_RESOURCE_LABEL; + typedef struct acpi_resource_source { UINT8 Index; @@ -725,6 +732,90 @@ typedef struct acpi_resource_uart_serialbus #define ACPI_UART_CLEAR_TO_SEND (1<<6) #define ACPI_UART_REQUEST_TO_SEND (1<<7) +typedef struct acpi_resource_pin_function +{ + UINT8 RevisionId; + UINT8 PinConfig; + UINT8 Sharable; /* For values, see Interrupt Attributes above */ + UINT16 FunctionNumber; + UINT16 PinTableLength; + UINT16 VendorLength; + ACPI_RESOURCE_SOURCE ResourceSource; + UINT16 *PinTable; + UINT8 *VendorData; + +} ACPI_RESOURCE_PIN_FUNCTION; + +typedef struct acpi_resource_pin_config +{ + UINT8 RevisionId; + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ + UINT8 Sharable; /* For values, see Interrupt Attributes above */ + UINT8 PinConfigType; + UINT32 PinConfigValue; + UINT16 PinTableLength; + UINT16 VendorLength; + ACPI_RESOURCE_SOURCE ResourceSource; + UINT16 *PinTable; + UINT8 *VendorData; + +} ACPI_RESOURCE_PIN_CONFIG; + +/* Values for PinConfigType field above */ + +#define ACPI_PIN_CONFIG_DEFAULT 0 +#define ACPI_PIN_CONFIG_BIAS_PULL_UP 1 +#define ACPI_PIN_CONFIG_BIAS_PULL_DOWN 2 +#define ACPI_PIN_CONFIG_BIAS_DEFAULT 3 +#define ACPI_PIN_CONFIG_BIAS_DISABLE 4 +#define ACPI_PIN_CONFIG_BIAS_HIGH_IMPEDANCE 5 +#define ACPI_PIN_CONFIG_BIAS_BUS_HOLD 6 +#define ACPI_PIN_CONFIG_DRIVE_OPEN_DRAIN 7 +#define ACPI_PIN_CONFIG_DRIVE_OPEN_SOURCE 8 +#define ACPI_PIN_CONFIG_DRIVE_PUSH_PULL 9 +#define ACPI_PIN_CONFIG_DRIVE_STRENGTH 10 +#define ACPI_PIN_CONFIG_SLEW_RATE 11 +#define ACPI_PIN_CONFIG_INPUT_DEBOUNCE 12 +#define ACPI_PIN_CONFIG_INPUT_SCHMITT_TRIGGER 13 + +typedef struct acpi_resource_pin_group +{ + UINT8 RevisionId; + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ + UINT16 PinTableLength; + UINT16 VendorLength; + UINT16 *PinTable; + ACPI_RESOURCE_LABEL ResourceLabel; + UINT8 *VendorData; + +} ACPI_RESOURCE_PIN_GROUP; + +typedef struct acpi_resource_pin_group_function +{ + UINT8 RevisionId; + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ + UINT8 Sharable; /* For values, see Interrupt Attributes above */ + UINT16 FunctionNumber; + UINT16 VendorLength; + ACPI_RESOURCE_SOURCE ResourceSource; + ACPI_RESOURCE_LABEL ResourceSourceLabel; + UINT8 *VendorData; + +} ACPI_RESOURCE_PIN_GROUP_FUNCTION; + +typedef struct acpi_resource_pin_group_config +{ + UINT8 RevisionId; + UINT8 ProducerConsumer; /* For values, see Producer/Consumer above */ + UINT8 Sharable; /* For values, see Interrupt Attributes above */ + UINT8 PinConfigType; /* For values, see PinConfigType above */ + UINT32 PinConfigValue; + UINT16 VendorLength; + ACPI_RESOURCE_SOURCE ResourceSource; + ACPI_RESOURCE_LABEL ResourceSourceLabel; + UINT8 *VendorData; + +} ACPI_RESOURCE_PIN_GROUP_CONFIG; /* ACPI_RESOURCE_TYPEs */ @@ -748,7 +839,12 @@ typedef struct acpi_resource_uart_serialbus #define ACPI_RESOURCE_TYPE_GPIO 17 /* ACPI 5.0 */ #define ACPI_RESOURCE_TYPE_FIXED_DMA 18 /* ACPI 5.0 */ #define ACPI_RESOURCE_TYPE_SERIAL_BUS 19 /* ACPI 5.0 */ -#define ACPI_RESOURCE_TYPE_MAX 19 +#define ACPI_RESOURCE_TYPE_PIN_FUNCTION 20 /* ACPI 6.2 */ +#define ACPI_RESOURCE_TYPE_PIN_CONFIG 21 /* ACPI 6.2 */ +#define ACPI_RESOURCE_TYPE_PIN_GROUP 22 /* ACPI 6.2 */ +#define ACPI_RESOURCE_TYPE_PIN_GROUP_FUNCTION 23 /* ACPI 6.2 */ +#define ACPI_RESOURCE_TYPE_PIN_GROUP_CONFIG 24 /* ACPI 6.2 */ +#define ACPI_RESOURCE_TYPE_MAX 24 /* Master union for resource descriptors */ @@ -777,6 +873,11 @@ typedef union acpi_resource_data ACPI_RESOURCE_SPI_SERIALBUS SpiSerialBus; ACPI_RESOURCE_UART_SERIALBUS UartSerialBus; ACPI_RESOURCE_COMMON_SERIALBUS CommonSerialBus; + ACPI_RESOURCE_PIN_FUNCTION PinFunction; + ACPI_RESOURCE_PIN_CONFIG PinConfig; + ACPI_RESOURCE_PIN_GROUP PinGroup; + ACPI_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction; + ACPI_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig; /* Common fields */ diff --git a/source/include/actbl1.h b/source/include/actbl1.h index b7119fa6f244..da6b561a0a1a 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -175,9 +175,11 @@ #define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */ #define ACPI_SIG_EINJ "EINJ" /* Error Injection table */ #define ACPI_SIG_ERST "ERST" /* Error Record Serialization Table */ +#define ACPI_SIG_HMAT "HMAT" /* Heterogeneous Memory Attributes Table */ #define ACPI_SIG_HEST "HEST" /* Hardware Error Source Table */ #define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */ #define ACPI_SIG_MSCT "MSCT" /* Maximum System Characteristics Table */ +#define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ @@ -600,7 +602,8 @@ enum AcpiHestTypes ACPI_HEST_TYPE_AER_BRIDGE = 8, ACPI_HEST_TYPE_GENERIC_ERROR = 9, ACPI_HEST_TYPE_GENERIC_ERROR_V2 = 10, - ACPI_HEST_TYPE_RESERVED = 11 /* 11 and greater are reserved */ + ACPI_HEST_TYPE_IA32_DEFERRED_CHECK = 11, + ACPI_HEST_TYPE_RESERVED = 12 /* 12 and greater are reserved */ }; @@ -652,6 +655,7 @@ typedef struct acpi_hest_aer_common #define ACPI_HEST_FIRMWARE_FIRST (1) #define ACPI_HEST_GLOBAL (1<<1) +#define ACPI_HEST_GHES_ASSIST (1<<2) /* * Macros to access the bus/segment numbers in Bus field above: @@ -682,18 +686,19 @@ typedef struct acpi_hest_notify enum AcpiHestNotifyTypes { - ACPI_HEST_NOTIFY_POLLED = 0, - ACPI_HEST_NOTIFY_EXTERNAL = 1, - ACPI_HEST_NOTIFY_LOCAL = 2, - ACPI_HEST_NOTIFY_SCI = 3, - ACPI_HEST_NOTIFY_NMI = 4, - ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ - ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ - ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */ - ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */ - ACPI_HEST_NOTIFY_RESERVED = 11 /* 11 and greater are reserved */ + ACPI_HEST_NOTIFY_POLLED = 0, + ACPI_HEST_NOTIFY_EXTERNAL = 1, + ACPI_HEST_NOTIFY_LOCAL = 2, + ACPI_HEST_NOTIFY_SCI = 3, + ACPI_HEST_NOTIFY_NMI = 4, + ACPI_HEST_NOTIFY_CMCI = 5, /* ACPI 5.0 */ + ACPI_HEST_NOTIFY_MCE = 6, /* ACPI 5.0 */ + ACPI_HEST_NOTIFY_GPIO = 7, /* ACPI 6.0 */ + ACPI_HEST_NOTIFY_SEA = 8, /* ACPI 6.1 */ + ACPI_HEST_NOTIFY_SEI = 9, /* ACPI 6.1 */ + ACPI_HEST_NOTIFY_GSIV = 10, /* ACPI 6.1 */ + ACPI_HEST_NOTIFY_SOFTWARE_DELEGATED = 11, /* ACPI 6.2 */ + ACPI_HEST_NOTIFY_RESERVED = 12 /* 12 and greater are reserved */ }; /* Values for ConfigWriteEnable bitfield above */ @@ -716,7 +721,7 @@ typedef struct acpi_hest_ia_machine_check { ACPI_HEST_HEADER Header; UINT16 Reserved1; - UINT8 Flags; + UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ UINT8 Enabled; UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; @@ -734,7 +739,7 @@ typedef struct acpi_hest_ia_corrected { ACPI_HEST_HEADER Header; UINT16 Reserved1; - UINT8 Flags; + UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ UINT8 Enabled; UINT32 RecordsToPreallocate; UINT32 MaxSectionsPerRecord; @@ -899,6 +904,155 @@ typedef struct acpi_hest_generic_data_v300 #define ACPI_HEST_GEN_VALID_TIMESTAMP (1<<2) +/* 11: IA32 Deferred Machine Check Exception (ACPI 6.2) */ + +typedef struct acpi_hest_ia_deferred_check +{ + ACPI_HEST_HEADER Header; + UINT16 Reserved1; + UINT8 Flags; /* See flags ACPI_HEST_GLOBAL, etc. above */ + UINT8 Enabled; + UINT32 RecordsToPreallocate; + UINT32 MaxSectionsPerRecord; + ACPI_HEST_NOTIFY Notify; + UINT8 NumHardwareBanks; + UINT8 Reserved2[3]; + +} ACPI_HEST_IA_DEFERRED_CHECK; + + +/******************************************************************************* + * + * HMAT - Heterogeneous Memory Attributes Table (ACPI 6.2) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_hmat +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 Reserved; + +} ACPI_TABLE_HMAT; + + +/* Values for HMAT structure types */ + +enum AcpiHmatType +{ + ACPI_HMAT_TYPE_ADDRESS_RANGE = 0, /* Memory subystem address range */ + ACPI_HMAT_TYPE_LOCALITY = 1, /* System locality latency and bandwidth information */ + ACPI_HMAT_TYPE_CACHE = 2, /* Memory side cache information */ + ACPI_HMAT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ +}; + +typedef struct acpi_hmat_structure +{ + UINT16 Type; + UINT16 Reserved; + UINT32 Length; + +} ACPI_HMAT_STRUCTURE; + + +/* + * HMAT Structures, correspond to Type in ACPI_HMAT_STRUCTURE + */ + +/* 0: Memory subystem address range */ + +typedef struct acpi_hmat_address_range +{ + ACPI_HMAT_STRUCTURE Header; + UINT16 Flags; + UINT16 Reserved1; + UINT32 ProcessorPD; /* Processor proximity domain */ + UINT32 MemoryPD; /* Memory proximity domain */ + UINT32 Reserved2; + UINT64 PhysicalAddressBase; /* Physical address range base */ + UINT64 PhysicalAddressLength; /* Physical address range length */ + +} ACPI_HMAT_ADDRESS_RANGE; + +/* Masks for Flags field above */ + +#define ACPI_HMAT_PROCESSOR_PD_VALID (1) /* 1: ProcessorPD field is valid */ +#define ACPI_HMAT_MEMORY_PD_VALID (1<<1) /* 1: MemoryPD field is valid */ +#define ACPI_HMAT_RESERVATION_HINT (1<<2) /* 1: Reservation hint */ + + +/* 1: System locality latency and bandwidth information */ + +typedef struct acpi_hmat_locality +{ + ACPI_HMAT_STRUCTURE Header; + UINT8 Flags; + UINT8 DataType; + UINT16 Reserved1; + UINT32 NumberOfInitiatorPDs; + UINT32 NumberOfTargetPDs; + UINT32 Reserved2; + UINT64 EntryBaseUnit; + +} ACPI_HMAT_LOCALITY; + +/* Masks for Flags field above */ + +#define ACPI_HMAT_MEMORY_HIERARCHY (0x0F) + +/* Values for Memory Hierarchy flag */ + +#define ACPI_HMAT_MEMORY 0 +#define ACPI_HMAT_LAST_LEVEL_CACHE 1 +#define ACPI_HMAT_1ST_LEVEL_CACHE 2 +#define ACPI_HMAT_2ND_LEVEL_CACHE 3 +#define ACPI_HMAT_3RD_LEVEL_CACHE 4 + +/* Values for DataType field above */ + +#define ACPI_HMAT_ACCESS_LATENCY 0 +#define ACPI_HMAT_READ_LATENCY 1 +#define ACPI_HMAT_WRITE_LATENCY 2 +#define ACPI_HMAT_ACCESS_BANDWIDTH 3 +#define ACPI_HMAT_READ_BANDWIDTH 4 +#define ACPI_HMAT_WRITE_BANDWIDTH 5 + + +/* 2: Memory side cache information */ + +typedef struct acpi_hmat_cache +{ + ACPI_HMAT_STRUCTURE Header; + UINT32 MemoryPD; + UINT32 Reserved1; + UINT64 CacheSize; + UINT32 CacheAttributes; + UINT16 Reserved2; + UINT16 NumberOfSMBIOSHandles; + +} ACPI_HMAT_CACHE; + +/* Masks for CacheAttributes field above */ + +#define ACPI_HMAT_TOTAL_CACHE_LEVEL (0x0000000F) +#define ACPI_HMAT_CACHE_LEVEL (0x000000F0) +#define ACPI_HMAT_CACHE_ASSOCIATIVITY (0x00000F00) +#define ACPI_HMAT_WRITE_POLICY (0x0000F000) +#define ACPI_HMAT_CACHE_LINE_SIZE (0xFFFF0000) + +/* Values for cache associativity flag */ + +#define ACPI_HMAT_CA_NONE (0) +#define ACPI_HMAT_CA_DIRECT_MAPPED (1) +#define ACPI_HMAT_CA_COMPLEX_CACHE_INDEXING (2) + +/* Values for write policy flag */ + +#define ACPI_HMAT_CP_NONE (0) +#define ACPI_HMAT_CP_WB (1) +#define ACPI_HMAT_CP_WT (2) + + /******************************************************************************* * * MADT - Multiple APIC Description Table @@ -920,8 +1074,8 @@ typedef struct acpi_table_madt /* Values for PCATCompat flag */ -#define ACPI_MADT_DUAL_PIC 0 -#define ACPI_MADT_MULTIPLE_APIC 1 +#define ACPI_MADT_DUAL_PIC 1 +#define ACPI_MADT_MULTIPLE_APIC 0 /* Values for MADT subtable type in ACPI_SUBTABLE_HEADER */ @@ -1446,6 +1600,95 @@ typedef struct acpi_nfit_flush_address } ACPI_NFIT_FLUSH_ADDRESS; +/******************************************************************************* + * + * PPTT - Processor Properties Topology Table (ACPI 6.2) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_pptt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_PPTT; + +/* Values for Type field above */ + +enum AcpiPpttType +{ + ACPI_PPTT_TYPE_PROCESSOR = 0, + ACPI_PPTT_TYPE_CACHE = 1, + ACPI_PPTT_TYPE_ID = 2, + ACPI_PPTT_TYPE_RESERVED = 3 +}; + + +/* 0: Processor Hierarchy Node Structure */ + +typedef struct acpi_pptt_processor { + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; + UINT32 Flags; + UINT32 Parent; + UINT32 AcpiProcessorId; + UINT32 NumberOfPrivResources; + +} ACPI_PPTT_PROCESSOR; + +/* Flags */ + +#define ACPI_PPTT_PHYSICAL_PACKAGE (1) /* Physical package */ +#define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (2) /* ACPI Processor ID valid */ + + +/* 1: Cache Type Structure */ + +typedef struct acpi_pptt_cache { + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; + UINT32 Flags; + UINT32 NextLevelOfCache; + UINT32 Size; + UINT32 NumberOfSets; + UINT8 Associativity; + UINT8 Attributes; + UINT16 LineSize; + +} ACPI_PPTT_CACHE; + +/* Flags */ + +#define ACPI_PPTT_SIZE_PROPERTY_VALID (1) /* Physical property valid */ +#define ACPI_PPTT_NUMBER_OF_SETS_VALID (1<<1) /* Number of sets valid */ +#define ACPI_PPTT_ASSOCIATIVITY_VALID (1<<2) /* Associativity valid */ +#define ACPI_PPTT_ALLOCATION_TYPE_VALID (1<<3) /* Allocation type valid */ +#define ACPI_PPTT_CACHE_TYPE_VALID (1<<4) /* Cache type valid */ +#define ACPI_PPTT_WRITE_POLICY_VALID (1<<5) /* Write policy valid */ +#define ACPI_PPTT_LINE_SIZE_VALID (1<<6) /* Line size valid */ + +/* Masks for Attributes */ + +#define ACPI_PPTT_MASK_ALLOCATION_TYPE (0x03) /* Allocation type */ +#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ +#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ + + +/* 2: ID Structure */ + +typedef struct acpi_pptt_id { + ACPI_SUBTABLE_HEADER Header; + UINT16 Reserved; + UINT32 VendorId; + UINT64 Level1Id; + UINT64 Level2Id; + UINT16 MajorRev; + UINT16 MinorRev; + UINT16 SpinRev; + +} ACPI_PPTT_ID; + + /******************************************************************************* * * SBST - Smart Battery Specification Table @@ -1502,7 +1745,8 @@ enum AcpiSratType ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1, ACPI_SRAT_TYPE_X2APIC_CPU_AFFINITY = 2, ACPI_SRAT_TYPE_GICC_AFFINITY = 3, - ACPI_SRAT_TYPE_RESERVED = 4 /* 4 and greater are reserved */ + ACPI_SRAT_TYPE_GIC_ITS_AFFINITY = 4, /* ACPI 6.2 */ + ACPI_SRAT_TYPE_RESERVED = 5 /* 5 and greater are reserved */ }; /* @@ -1586,6 +1830,18 @@ typedef struct acpi_srat_gicc_affinity #define ACPI_SRAT_GICC_ENABLED (1) /* 00: Use affinity structure */ +/* 4: GCC ITS Affinity (ACPI 6.2) */ + +typedef struct acpi_srat_gic_its_affinity +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 ProximityDomain; + UINT16 Reserved; + UINT32 ItsId; + +} ACPI_SRAT_GIC_ITS_AFFINITY; + + /* Reset to default packing */ #pragma pack() diff --git a/source/include/actbl2.h b/source/include/actbl2.h index 4655b1b4c13e..80495d8fa9c0 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -197,6 +197,7 @@ #define ACPI_SIG_WDAT "WDAT" /* Watchdog Action Table */ #define ACPI_SIG_WDDT "WDDT" /* Watchdog Timer Description Table */ #define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */ +#define ACPI_SIG_WSMT "WSMT" /* Windows SMM Security Migrations Table */ #define ACPI_SIG_XXXX "XXXX" /* Intermediate AML header for ASL/ASL+ converter */ #ifdef ACPI_UNDEFINED_TABLES @@ -1521,7 +1522,8 @@ enum AcpiSpmiInterfaceTypes * Version 2 * * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", - * December 19, 2014 + * Version 1.2, Revision 8 + * February 27, 2017 * * NOTE: There are two versions of the table with the same signature -- * the client version and the server version. The common PlatformClass @@ -1592,7 +1594,8 @@ typedef struct acpi_table_tcpa_server * Version 4 * * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", - * December 19, 2014 + * Version 1.2, Revision 8 + * February 27, 2017 * ******************************************************************************/ @@ -1615,6 +1618,42 @@ typedef struct acpi_table_tpm2 #define ACPI_TPM2_MEMORY_MAPPED 6 #define ACPI_TPM2_COMMAND_BUFFER 7 #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 +#define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ + + +/* Trailer appears after any StartMethod subtables */ + +typedef struct acpi_tpm2_trailer +{ + UINT32 MinimumLogLength; /* Minimum length for the event log area */ + UINT64 LogAddress; /* Address of the event log area */ + +} ACPI_TPM2_TRAILER; + + +/* + * Subtables (StartMethod-specific) + */ + +/* 11: Start Method for ARM SMC (V1.2 Rev 8) */ + +typedef struct acpi_tpm2_arm_smc +{ + UINT32 GlobalInterrupt; + UINT8 InterruptFlags; + UINT8 OperationFlags; + UINT16 Reserved; + UINT32 FunctionId; + +} ACPI_TPM2_ARM_SMC; + +/* Values for InterruptFlags above */ + +#define ACPI_TPM2_INTERRUPT_SUPPORT (1) + +/* Values for OperationFlags above */ + +#define ACPI_TPM2_IDLE_SUPPORT (1) /******************************************************************************* @@ -1834,6 +1873,30 @@ typedef struct acpi_table_wdrt } ACPI_TABLE_WDRT; +/******************************************************************************* + * + * WSMT - Windows SMM Security Migrations Table + * Version 1 + * + * Conforms to "Windows SMM Security Migrations Table", + * Version 1.0, April 18, 2016 + * + ******************************************************************************/ + +typedef struct acpi_table_wsmt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT32 ProtectionFlags; + +} ACPI_TABLE_WSMT; + +/* Flags for ProtectionFlags field above */ + +#define ACPI_WSMT_FIXED_COMM_BUFFERS (1) +#define ACPI_WSMT_COMM_BUFFER_NESTED_PTR_PROTECTION (2) +#define ACPI_WSMT_SYSTEM_RESOURCE_PROTECTION (4) + + /* Reset to default packing */ #pragma pack() diff --git a/source/include/actbl3.h b/source/include/actbl3.h index cb9910d71d98..80b6ae1c0aa5 100644 --- a/source/include/actbl3.h +++ b/source/include/actbl3.h @@ -229,6 +229,11 @@ typedef struct acpi_table_bgrt } ACPI_TABLE_BGRT; +/* Flags for Status field above */ + +#define ACPI_BGRT_DISPLAYED (1) +#define ACPI_BGRT_ORIENTATION_OFFSET (3 << 1) + /******************************************************************************* * @@ -651,7 +656,7 @@ typedef struct acpi_mpst_shared /******************************************************************************* * * PCCT - Platform Communications Channel Table (ACPI 5.0) - * Version 1 + * Version 2 (ACPI 6.2) * ******************************************************************************/ @@ -674,7 +679,9 @@ enum AcpiPcctType ACPI_PCCT_TYPE_GENERIC_SUBSPACE = 0, ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE = 1, ACPI_PCCT_TYPE_HW_REDUCED_SUBSPACE_TYPE2 = 2, /* ACPI 6.1 */ - ACPI_PCCT_TYPE_RESERVED = 3 /* 3 and greater are reserved */ + ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE = 3, /* ACPI 6.2 */ + ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE = 4, /* ACPI 6.2 */ + ACPI_PCCT_TYPE_RESERVED = 5 /* 5 and greater are reserved */ }; /* @@ -704,7 +711,7 @@ typedef struct acpi_pcct_subspace typedef struct acpi_pcct_hw_reduced { ACPI_SUBTABLE_HEADER Header; - UINT32 DoorbellInterrupt; + UINT32 PlatformInterrupt; UINT8 Flags; UINT8 Reserved; UINT64 BaseAddress; @@ -724,7 +731,7 @@ typedef struct acpi_pcct_hw_reduced typedef struct acpi_pcct_hw_reduced_type2 { ACPI_SUBTABLE_HEADER Header; - UINT32 DoorbellInterrupt; + UINT32 PlatformInterrupt; UINT8 Flags; UINT8 Reserved; UINT64 BaseAddress; @@ -735,13 +742,75 @@ typedef struct acpi_pcct_hw_reduced_type2 UINT32 Latency; UINT32 MaxAccessRate; UINT16 MinTurnaroundTime; - ACPI_GENERIC_ADDRESS DoorbellAckRegister; + ACPI_GENERIC_ADDRESS PlatformAckRegister; UINT64 AckPreserveMask; UINT64 AckWriteMask; } ACPI_PCCT_HW_REDUCED_TYPE2; +/* 3: Extended PCC Master Subspace Type 3 (ACPI 6.2) */ + +typedef struct acpi_pcct_ext_pcc_master +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 PlatformInterrupt; + UINT8 Flags; + UINT8 Reserved1; + UINT64 BaseAddress; + UINT32 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT32 MinTurnaroundTime; + ACPI_GENERIC_ADDRESS PlatformAckRegister; + UINT64 AckPreserveMask; + UINT64 AckSetMask; + UINT64 Reserved2; + ACPI_GENERIC_ADDRESS CmdCompleteRegister; + UINT64 CmdCompleteMask; + ACPI_GENERIC_ADDRESS CmdUpdateRegister; + UINT64 CmdUpdatePreserveMask; + UINT64 CmdUpdateSetMask; + ACPI_GENERIC_ADDRESS ErrorStatusRegister; + UINT64 ErrorStatusMask; + +} ACPI_PCCT_EXT_PCC_MASTER; + + +/* 4: Extended PCC Slave Subspace Type 4 (ACPI 6.2) */ + +typedef struct acpi_pcct_ext_pcc_slave +{ + ACPI_SUBTABLE_HEADER Header; + UINT32 PlatformInterrupt; + UINT8 Flags; + UINT8 Reserved1; + UINT64 BaseAddress; + UINT32 Length; + ACPI_GENERIC_ADDRESS DoorbellRegister; + UINT64 PreserveMask; + UINT64 WriteMask; + UINT32 Latency; + UINT32 MaxAccessRate; + UINT32 MinTurnaroundTime; + ACPI_GENERIC_ADDRESS PlatformAckRegister; + UINT64 AckPreserveMask; + UINT64 AckSetMask; + UINT64 Reserved2; + ACPI_GENERIC_ADDRESS CmdCompleteRegister; + UINT64 CmdCompleteMask; + ACPI_GENERIC_ADDRESS CmdUpdateRegister; + UINT64 CmdUpdatePreserveMask; + UINT64 CmdUpdateSetMask; + ACPI_GENERIC_ADDRESS ErrorStatusRegister; + UINT64 ErrorStatusMask; + +} ACPI_PCCT_EXT_PCC_SLAVE; + + /* Values for doorbell flags above */ #define ACPI_PCCT_INTERRUPT_POLARITY (1) @@ -763,6 +832,18 @@ typedef struct acpi_pcct_shared_memory } ACPI_PCCT_SHARED_MEMORY; +/* Extended PCC Subspace Shared Memory Region (ACPI 6.2) */ + +typedef struct acpi_pcct_ext_pcc_shared_memory +{ + UINT32 Signature; + UINT32 Flags; + UINT32 Length; + UINT32 Command; + +} ACPI_PCCT_EXT_PCC_SHARED_MEMORY; + + /******************************************************************************* * * PMTT - Platform Memory Topology Table (ACPI 5.0) diff --git a/source/include/actypes.h b/source/include/actypes.h index 787ceeea824d..843adec7f6b5 100644 --- a/source/include/actypes.h +++ b/source/include/actypes.h @@ -155,9 +155,9 @@ /* acpisrc:StructDefs -- for acpisrc conversion */ /* - * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header - * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of - * 12/2006. + * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent + * header and must be either 32 or 64. 16-bit ACPICA is no longer + * supported, as of 12/2006. */ #ifndef ACPI_MACHINE_WIDTH #error ACPI_MACHINE_WIDTH not defined @@ -196,9 +196,9 @@ * INT64 64-bit (8 byte) signed value * * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the - * compiler-dependent header(s) and were introduced because there is no common - * 64-bit integer type across the various compilation models, as shown in - * the table below. + * compiler-dependent header(s) and were introduced because there is no + * common 64-bit integer type across the various compilation models, as + * shown in the table below. * * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit * char 8 8 8 8 8 8 @@ -215,10 +215,10 @@ * 2) These types represent the native word size of the target mode of the * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are * usually used for memory allocation, efficient loop counters, and array - * indexes. The types are similar to the size_t type in the C library and are - * required because there is no C type that consistently represents the native - * data width. ACPI_SIZE is needed because there is no guarantee that a - * kernel-level C library is present. + * indexes. The types are similar to the size_t type in the C library and + * are required because there is no C type that consistently represents the + * native data width. ACPI_SIZE is needed because there is no guarantee + * that a kernel-level C library is present. * * ACPI_SIZE 16/32/64-bit unsigned value * ACPI_NATIVE_INT 16/32/64-bit signed value @@ -279,9 +279,10 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS; /* * In the case of the Itanium Processor Family (IPF), the hardware does not - * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag - * to indicate that special precautions must be taken to avoid alignment faults. - * (IA64 or ia64 is currently used by existing compilers to indicate IPF.) + * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED + * flag to indicate that special precautions must be taken to avoid alignment + * faults. (IA64 or ia64 is currently used by existing compilers to indicate + * IPF.) * * Note: EM64T and other X86-64 processors support misaligned transfers, * so there is no need to define this flag. @@ -422,8 +423,8 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS; #endif /* - * Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (for example, _AcpiModuleName). This allows us + * Some compilers complain about unused variables. Sometimes we don't want + * to use all the variables (for example, _AcpiModuleName). This allows us * to tell the compiler in a per-variable manner that a variable * is unused */ @@ -432,8 +433,9 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS; #endif /* - * All ACPICA external functions that are available to the rest of the kernel - * are tagged with thes macros which can be defined as appropriate for the host. + * All ACPICA external functions that are available to the rest of the + * kernel are tagged with these macros which can be defined as appropriate + * for the host. * * Notes: * ACPI_EXPORT_SYMBOL_INIT is used for initialization and termination @@ -498,7 +500,8 @@ typedef UINT64 ACPI_PHYSICAL_ADDRESS; /****************************************************************************** * - * ACPI Specification constants (Do not change unless the specification changes) + * ACPI Specification constants (Do not change unless the specification + * changes) * *****************************************************************************/ @@ -604,10 +607,10 @@ typedef UINT8 ACPI_OWNER_ID; #define ACPI_DO_NOT_WAIT 0 /* - * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are 32 bits. - * In ACPI version 2 (2000) and later, integers are 64 bits. Note that this - * pertains to the ACPI integer type only, not to other integers used in the - * implementation of the ACPICA subsystem. + * Obsolete: Acpi integer width. In ACPI version 1 (1996), integers are + * 32 bits. In ACPI version 2 (2000) and later, integers are max 64 bits. + * Note that this pertains to the ACPI integer type only, not to other + * integers used in the implementation of the ACPICA subsystem. * * 01/2010: This type is obsolete and has been removed from the entire ACPICA * code base. It remains here for compatibility with device drivers that use @@ -749,8 +752,9 @@ typedef UINT64 ACPI_INTEGER; #define ACPI_NOTIFY_LOCALITY_UPDATE (UINT8) 0x0B #define ACPI_NOTIFY_SHUTDOWN_REQUEST (UINT8) 0x0C #define ACPI_NOTIFY_AFFINITY_UPDATE (UINT8) 0x0D +#define ACPI_NOTIFY_MEMORY_UPDATE (UINT8) 0x0E -#define ACPI_GENERIC_NOTIFY_MAX 0x0D +#define ACPI_GENERIC_NOTIFY_MAX 0x0E #define ACPI_SPECIFIC_NOTIFY_MAX 0x84 /* @@ -787,10 +791,11 @@ typedef UINT32 ACPI_OBJECT_TYPE; /* * These are object types that do not map directly to the ACPI - * ObjectType() operator. They are used for various internal purposes only. - * If new predefined ACPI_TYPEs are added (via the ACPI specification), these - * internal types must move upwards. (There is code that depends on these - * values being contiguous with the external types above.) + * ObjectType() operator. They are used for various internal purposes + * only. If new predefined ACPI_TYPEs are added (via the ACPI + * specification), these internal types must move upwards. (There + * is code that depends on these values being contiguous with the + * external types above.) */ #define ACPI_TYPE_LOCAL_REGION_FIELD 0x11 #define ACPI_TYPE_LOCAL_BANK_FIELD 0x12 @@ -891,7 +896,7 @@ typedef UINT32 ACPI_EVENT_STATUS; * | | | | +-- Type of dispatch:to method, handler, notify, or none * | | | +----- Interrupt type: edge or level triggered * | | +------- Is a Wake GPE - * | +--------- Is GPE masked by the software GPE masking machanism + * | +--------- Is GPE masked by the software GPE masking mechanism * +------------ */ #define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00 @@ -1037,8 +1042,8 @@ typedef struct acpi_sleep_functions */ /* - * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package element - * or an unresolved named reference. + * Note: Type == ACPI_TYPE_ANY (0) is used to indicate a NULL package + * element or an unresolved named reference. */ typedef union acpi_object { @@ -1361,7 +1366,7 @@ typedef struct acpi_pnp_device_id_list /* * Structure returned from AcpiGetObjectInfo. - * Optimized for both 32- and 64-bit builds + * Optimized for both 32-bit and 64-bit builds. */ typedef struct acpi_device_info { diff --git a/source/include/acutils.h b/source/include/acutils.h index 30ce8257bb92..46588a408115 100644 --- a/source/include/acutils.h +++ b/source/include/acutils.h @@ -194,6 +194,7 @@ extern const char *AcpiGbl_BpbDecode[]; extern const char *AcpiGbl_SbDecode[]; extern const char *AcpiGbl_FcDecode[]; extern const char *AcpiGbl_PtDecode[]; +extern const char *AcpiGbl_PtypDecode[]; #endif /* diff --git a/source/include/acuuid.h b/source/include/acuuid.h index 407fcb6765df..ff0f01263100 100644 --- a/source/include/acuuid.h +++ b/source/include/acuuid.h @@ -186,6 +186,11 @@ #define UUID_PERSISTENT_VIRTUAL_DISK "5cea02c9-4d07-69d3-269f-4496fbe096f9" #define UUID_PERSISTENT_VIRTUAL_CD "08018188-42cd-bb48-100f-5387d53ded3d" +/* Processor Properties (ACPI 6.2) */ + +#define UUID_CACHE_PROPERTIES "6DC63E77-257E-4E78-A973-A21F2796898D" +#define UUID_PHYSICAL_PROPERTY "DDE4D59A-AA42-4349-B407-EA40F57D9FB7" + /* Miscellaneous */ #define UUID_PLATFORM_CAPABILITIES "0811b06e-4a27-44f9-8d60-3cbbc22e7b48" diff --git a/source/include/amlcode.h b/source/include/amlcode.h index 4576c7d9d924..9236eedbb03f 100644 --- a/source/include/amlcode.h +++ b/source/include/amlcode.h @@ -427,6 +427,11 @@ * #A is the number of required arguments * #T is the number of target operands * #R indicates whether there is a return value + * + * These types are used for the top-level dispatch of the AML + * opcode. They group similar operators that can share common + * front-end code before dispatch to the final code that implements + * the operator. */ /* @@ -468,42 +473,42 @@ * The opcode Type is used in a dispatch table, do not change * or add anything new without updating the table. */ -#define AML_TYPE_EXEC_0A_0T_1R 0x00 -#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* Monadic1 */ -#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* Monadic2 */ -#define AML_TYPE_EXEC_1A_1T_0R 0x03 -#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* Monadic2R */ -#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* Dyadic1 */ -#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* Dyadic2 */ -#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* Dyadic2R */ -#define AML_TYPE_EXEC_2A_2T_1R 0x08 -#define AML_TYPE_EXEC_3A_0T_0R 0x09 -#define AML_TYPE_EXEC_3A_1T_1R 0x0A -#define AML_TYPE_EXEC_6A_0T_1R 0x0B +#define AML_TYPE_EXEC_0A_0T_1R 0x00 /* 0 Args, 0 Target, 1 RetVal */ +#define AML_TYPE_EXEC_1A_0T_0R 0x01 /* 1 Args, 0 Target, 0 RetVal */ +#define AML_TYPE_EXEC_1A_0T_1R 0x02 /* 1 Args, 0 Target, 1 RetVal */ +#define AML_TYPE_EXEC_1A_1T_0R 0x03 /* 1 Args, 1 Target, 0 RetVal */ +#define AML_TYPE_EXEC_1A_1T_1R 0x04 /* 1 Args, 1 Target, 1 RetVal */ +#define AML_TYPE_EXEC_2A_0T_0R 0x05 /* 2 Args, 0 Target, 0 RetVal */ +#define AML_TYPE_EXEC_2A_0T_1R 0x06 /* 2 Args, 0 Target, 1 RetVal */ +#define AML_TYPE_EXEC_2A_1T_1R 0x07 /* 2 Args, 1 Target, 1 RetVal */ +#define AML_TYPE_EXEC_2A_2T_1R 0x08 /* 2 Args, 2 Target, 1 RetVal */ +#define AML_TYPE_EXEC_3A_0T_0R 0x09 /* 3 Args, 0 Target, 0 RetVal */ +#define AML_TYPE_EXEC_3A_1T_1R 0x0A /* 3 Args, 1 Target, 1 RetVal */ +#define AML_TYPE_EXEC_6A_0T_1R 0x0B /* 6 Args, 0 Target, 1 RetVal */ /* End of types used in dispatch table */ -#define AML_TYPE_LITERAL 0x0B -#define AML_TYPE_CONSTANT 0x0C -#define AML_TYPE_METHOD_ARGUMENT 0x0D -#define AML_TYPE_LOCAL_VARIABLE 0x0E -#define AML_TYPE_DATA_TERM 0x0F +#define AML_TYPE_LITERAL 0x0C +#define AML_TYPE_CONSTANT 0x0D +#define AML_TYPE_METHOD_ARGUMENT 0x0E +#define AML_TYPE_LOCAL_VARIABLE 0x0F +#define AML_TYPE_DATA_TERM 0x10 /* Generic for an op that returns a value */ -#define AML_TYPE_METHOD_CALL 0x10 +#define AML_TYPE_METHOD_CALL 0x11 /* Miscellaneous types */ -#define AML_TYPE_CREATE_FIELD 0x11 -#define AML_TYPE_CREATE_OBJECT 0x12 -#define AML_TYPE_CONTROL 0x13 -#define AML_TYPE_NAMED_NO_OBJ 0x14 -#define AML_TYPE_NAMED_FIELD 0x15 -#define AML_TYPE_NAMED_SIMPLE 0x16 -#define AML_TYPE_NAMED_COMPLEX 0x17 -#define AML_TYPE_RETURN 0x18 -#define AML_TYPE_UNDEFINED 0x19 -#define AML_TYPE_BOGUS 0x1A +#define AML_TYPE_CREATE_FIELD 0x12 +#define AML_TYPE_CREATE_OBJECT 0x13 +#define AML_TYPE_CONTROL 0x14 +#define AML_TYPE_NAMED_NO_OBJ 0x15 +#define AML_TYPE_NAMED_FIELD 0x16 +#define AML_TYPE_NAMED_SIMPLE 0x17 +#define AML_TYPE_NAMED_COMPLEX 0x18 +#define AML_TYPE_RETURN 0x19 +#define AML_TYPE_UNDEFINED 0x1A +#define AML_TYPE_BOGUS 0x1B /* AML Package Length encodings */ diff --git a/source/include/amlresrc.h b/source/include/amlresrc.h index aee0a05268d2..5f0bcc4bf5bb 100644 --- a/source/include/amlresrc.h +++ b/source/include/amlresrc.h @@ -174,6 +174,7 @@ #define ACPI_RESTAG_DRIVESTRENGTH "_DRS" #define ACPI_RESTAG_ENDIANNESS "_END" #define ACPI_RESTAG_FLOWCONTROL "_FLC" +#define ACPI_RESTAG_FUNCTION "_FUN" #define ACPI_RESTAG_GRANULARITY "_GRA" #define ACPI_RESTAG_INTERRUPT "_INT" #define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ @@ -193,6 +194,8 @@ #define ACPI_RESTAG_PHASE "_PHA" #define ACPI_RESTAG_PIN "_PIN" #define ACPI_RESTAG_PINCONFIG "_PPI" +#define ACPI_RESTAG_PINCONFIG_TYPE "_TYP" +#define ACPI_RESTAG_PINCONFIG_VALUE "_VAL" #define ACPI_RESTAG_POLARITY "_POL" #define ACPI_RESTAG_REGISTERBITOFFSET "_RBO" #define ACPI_RESTAG_REGISTERBITWIDTH "_RBW" @@ -636,6 +639,116 @@ typedef struct aml_resource_uart_serialbus #define AML_RESOURCE_UART_TYPE_REVISION 1 /* ACPI 5.0 */ #define AML_RESOURCE_UART_MIN_DATA_LEN 10 +typedef struct aml_resource_pin_function +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT16 Flags; + UINT8 PinConfig; + UINT16 FunctionNumber; + UINT16 PinTableOffset; + UINT8 ResSourceIndex; + UINT16 ResSourceOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) PIN list (Words) + * 2) Resource Source String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_PIN_FUNCTION; + +#define AML_RESOURCE_PIN_FUNCTION_REVISION 1 /* ACPI 6.2 */ + +typedef struct aml_resource_pin_config +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT16 Flags; + UINT8 PinConfigType; + UINT32 PinConfigValue; + UINT16 PinTableOffset; + UINT8 ResSourceIndex; + UINT16 ResSourceOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) PIN list (Words) + * 2) Resource Source String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_PIN_CONFIG; + +#define AML_RESOURCE_PIN_CONFIG_REVISION 1 /* ACPI 6.2 */ + +typedef struct aml_resource_pin_group +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT16 Flags; + UINT16 PinTableOffset; + UINT16 LabelOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) PIN list (Words) + * 2) Resource Label String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_PIN_GROUP; + +#define AML_RESOURCE_PIN_GROUP_REVISION 1 /* ACPI 6.2 */ + +typedef struct aml_resource_pin_group_function +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT16 Flags; + UINT16 FunctionNumber; + UINT8 ResSourceIndex; + UINT16 ResSourceOffset; + UINT16 ResSourceLabelOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) Resource Source String + * 2) Resource Source Label String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_PIN_GROUP_FUNCTION; + +#define AML_RESOURCE_PIN_GROUP_FUNCTION_REVISION 1 /* ACPI 6.2 */ + +typedef struct aml_resource_pin_group_config +{ + AML_RESOURCE_LARGE_HEADER_COMMON + UINT8 RevisionId; + UINT16 Flags; + UINT8 PinConfigType; + UINT32 PinConfigValue; + UINT8 ResSourceIndex; + UINT16 ResSourceOffset; + UINT16 ResSourceLabelOffset; + UINT16 VendorOffset; + UINT16 VendorLength; + /* + * Optional fields follow immediately: + * 1) Resource Source String + * 2) Resource Source Label String + * 3) Vendor Data bytes + */ + +} AML_RESOURCE_PIN_GROUP_CONFIG; + +#define AML_RESOURCE_PIN_GROUP_CONFIG_REVISION 1 /* ACPI 6.2 */ /* restore default alignment */ @@ -680,6 +793,11 @@ typedef union aml_resource AML_RESOURCE_SPI_SERIALBUS SpiSerialBus; AML_RESOURCE_UART_SERIALBUS UartSerialBus; AML_RESOURCE_COMMON_SERIALBUS CommonSerialBus; + AML_RESOURCE_PIN_FUNCTION PinFunction; + AML_RESOURCE_PIN_CONFIG PinConfig; + AML_RESOURCE_PIN_GROUP PinGroup; + AML_RESOURCE_PIN_GROUP_FUNCTION PinGroupFunction; + AML_RESOURCE_PIN_GROUP_CONFIG PinGroupConfig; /* Utility overlays */ diff --git a/source/include/platform/acgcc.h b/source/include/platform/acgcc.h index d831cbf7c80f..da719a7da97e 100644 --- a/source/include/platform/acgcc.h +++ b/source/include/platform/acgcc.h @@ -156,7 +156,17 @@ * Use compiler specific is a good practice for even when * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined. */ +#ifndef va_arg +#ifdef ACPI_USE_BUILTIN_STDARG +typedef __builtin_va_list va_list; +#define va_start(v, l) __builtin_va_start(v, l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v, l) __builtin_va_arg(v, l) +#define va_copy(d, s) __builtin_va_copy(d, s) +#else #include +#endif +#endif #define ACPI_INLINE __inline__ diff --git a/source/include/platform/acintel.h b/source/include/platform/acintel.h index e86d28a0590d..95cde1ff72c4 100644 --- a/source/include/platform/acintel.h +++ b/source/include/platform/acintel.h @@ -156,7 +156,9 @@ * Use compiler specific is a good practice for even when * -nostdinc is specified (i.e., ACPI_USE_STANDARD_HEADERS undefined. */ +#ifndef va_arg #include +#endif /* Configuration specific to Intel 64-bit C compiler */ diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index 53427ffb71e3..73e45e8777db 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -984,9 +984,9 @@ AcpiOsWaitSemaphore ( { ACPI_STATUS Status = AE_OK; sem_t *Sem = (sem_t *) Handle; + int RetVal; #ifndef ACPI_USE_ALTERNATE_TIMEOUT struct timespec Time; - int RetVal; #endif @@ -1016,12 +1016,17 @@ AcpiOsWaitSemaphore ( case ACPI_WAIT_FOREVER: - if (sem_wait (Sem)) + while (((RetVal = sem_wait (Sem)) == -1) && (errno == EINTR)) + { + continue; /* Restart if interrupted */ + } + if (RetVal != 0) { Status = (AE_TIME); } break; + /* Wait with MsecTimeout */ default: @@ -1075,7 +1080,8 @@ AcpiOsWaitSemaphore ( while (((RetVal = sem_timedwait (Sem, &Time)) == -1) && (errno == EINTR)) { - continue; + continue; /* Restart if interrupted */ + } if (RetVal != 0) diff --git a/source/tools/acpidump/apmain.c b/source/tools/acpidump/apmain.c index 3711b532304f..60ee23dcde17 100644 --- a/source/tools/acpidump/apmain.c +++ b/source/tools/acpidump/apmain.c @@ -231,8 +231,7 @@ ApDisplayUsage ( ACPI_OPTION ("-c ", "Turning on/off customized table dumping"); ACPI_OPTION ("-f ", "Get table via a binary file"); ACPI_OPTION ("-n ", "Get table via a name/signature"); - ACPI_OPTION ("-x", "Do not use but dump XSDT"); - ACPI_OPTION ("-x -x", "Do not use or dump XSDT"); + ACPI_OPTION ("-x", "Use RSDT instead of XSDT"); ACPI_USAGE_TEXT ( "\n" diff --git a/source/tools/acpiexec/aecommon.h b/source/tools/acpiexec/aecommon.h index c773e96fa05e..b4864610a69d 100644 --- a/source/tools/acpiexec/aecommon.h +++ b/source/tools/acpiexec/aecommon.h @@ -204,10 +204,20 @@ extern ACPI_CONNECTION_INFO AeMyContext; #define OSD_PRINT(lvl,fp) TEST_OUTPUT_LEVEL(lvl) {\ AcpiOsPrintf PARAM_LIST(fp);} +#define AE_PREFIX "ACPI Exec: " + void ACPI_SYSTEM_XFACE -AeCtrlCHandler ( +AeSignalHandler ( int Sig); +ACPI_STATUS +AeExceptionHandler ( + ACPI_STATUS AmlStatus, + ACPI_NAME Name, + UINT16 Opcode, + UINT32 AmlOffset, + void *Context); + ACPI_STATUS AeBuildLocalTables ( ACPI_NEW_TABLE_DESC *TableList); diff --git a/source/tools/acpiexec/aeexception.c b/source/tools/acpiexec/aeexception.c new file mode 100644 index 000000000000..a5a3293ad304 --- /dev/null +++ b/source/tools/acpiexec/aeexception.c @@ -0,0 +1,441 @@ +/****************************************************************************** + * + * Module Name: aeexception - Exception and signal handlers + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. + * All rights reserved. + * + * 2. License + * + * 2.1. This is your license from Intel Corp. under its intellectual property + * rights. You may have additional license terms from the party that provided + * you this software, covering your right to use that party's intellectual + * property rights. + * + * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a + * copy of the source code appearing in this file ("Covered Code") an + * irrevocable, perpetual, worldwide license under Intel's copyrights in the + * base code distributed originally by Intel ("Original Intel Code") to copy, + * make derivatives, distribute, use and display any portion of the Covered + * Code in any form, with the right to sublicense such rights; and + * + * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent + * license (with the right to sublicense), under only those claims of Intel + * patents that are infringed by the Original Intel Code, to make, use, sell, + * offer to sell, and import the Covered Code and derivative works thereof + * solely to the minimum extent necessary to exercise the above copyright + * license, and in no event shall the patent license extend to any additions + * to or modifications of the Original Intel Code. No other license or right + * is granted directly or by implication, estoppel or otherwise; + * + * The above copyright and patent license is granted only if the following + * conditions are met: + * + * 3. Conditions + * + * 3.1. Redistribution of Source with Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification with rights to further distribute source must include + * the above Copyright Notice, the above License, this list of Conditions, + * and the following Disclaimer and Export Compliance provision. In addition, + * Licensee must cause all Covered Code to which Licensee contributes to + * contain a file documenting the changes Licensee made to create that Covered + * Code and the date of any change. Licensee must include in that file the + * documentation of any changes made by any predecessor Licensee. Licensee + * must include a prominent statement that the modification is derived, + * directly or indirectly, from Original Intel Code. + * + * 3.2. Redistribution of Source with no Rights to Further Distribute Source. + * Redistribution of source code of any substantial portion of the Covered + * Code or modification without rights to further distribute source must + * include the following Disclaimer and Export Compliance provision in the + * documentation and/or other materials provided with distribution. In + * addition, Licensee may not authorize further sublicense of source of any + * portion of the Covered Code, and must include terms to the effect that the + * license from Licensee to its licensee is limited to the intellectual + * property embodied in the software Licensee provides to its licensee, and + * not to intellectual property embodied in modifications its licensee may + * make. + * + * 3.3. Redistribution of Executable. Redistribution in executable form of any + * substantial portion of the Covered Code or modification must reproduce the + * above Copyright Notice, and the following Disclaimer and Export Compliance + * provision in the documentation and/or other materials provided with the + * distribution. + * + * 3.4. Intel retains all right, title, and interest in and to the Original + * Intel Code. + * + * 3.5. Neither the name Intel nor any other trademark owned or controlled by + * Intel shall be used in advertising or otherwise to promote the sale, use or + * other dealings in products derived from or relating to the Covered Code + * without prior written authorization from Intel. + * + * 4. Disclaimer and Export Compliance + * + * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED + * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE + * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, + * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY + * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY + * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A + * PARTICULAR PURPOSE. + * + * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES + * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR + * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, + * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY + * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL + * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS + * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY + * LIMITED REMEDY. + * + * 4.3. Licensee shall not export, either directly or indirectly, any of this + * software or system incorporating such software without first obtaining any + * required license or other approval from the U. S. Department of Commerce or + * any other agency or department of the United States Government. In the + * event Licensee exports any such software from the United States or + * re-exports any such software from a foreign destination, Licensee shall + * ensure that the distribution and export/re-export of the software is in + * compliance with all laws, regulations, orders, or other restrictions of the + * U.S. Export Administration Regulations. Licensee agrees that neither it nor + * any of its subsidiaries will export/re-export any technical data, process, + * software, or service, directly or indirectly, to any country for which the + * United States government or any agency thereof requires an export license, + * other governmental approval, or letter of assurance, without first obtaining + * such license, approval or letter. + * + ***************************************************************************** + * + * Alternatively, you may choose to be licensed under the terms of the + * following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions, and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * substantially similar to the "NO WARRANTY" disclaimer below + * ("Disclaimer") and any redistribution must be conditioned upon + * including a substantially similar Disclaimer requirement for further + * binary redistribution. + * 3. Neither the names of the above-listed copyright holders nor the names + * of any contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Alternatively, you may choose to be licensed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + * + *****************************************************************************/ + +#include "aecommon.h" + +#define _COMPONENT ACPI_TOOLS + ACPI_MODULE_NAME ("aeexception") + + +/* Local prototypes */ + +static void +AeDisplayMethodCallStack ( + void); + + +/****************************************************************************** + * + * FUNCTION: AeExceptionHandler + * + * PARAMETERS: Standard exception handler parameters + * + * RETURN: Status + * + * DESCRIPTION: System exception handler for AcpiExec utility. Called from + * the core ACPICA code after any exception during method + * execution. + * + *****************************************************************************/ + +ACPI_STATUS +AeExceptionHandler ( + ACPI_STATUS AmlStatus, + ACPI_NAME Name, + UINT16 Opcode, + UINT32 AmlOffset, + void *Context) +{ + ACPI_STATUS NewAmlStatus = AmlStatus; + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + ACPI_OBJECT_LIST ArgList; + ACPI_OBJECT Arg[3]; + const char *Exception; + ACPI_HANDLE ErrHandle; + + + Exception = AcpiFormatException (AmlStatus); + AcpiOsPrintf (AE_PREFIX + "Exception %s during execution\n", Exception); + if (Name) + { + AcpiOsPrintf (AE_PREFIX + "Evaluating Method or Node: [%4.4s]", + (char *) &Name); + } + + AcpiOsPrintf ("\n" AE_PREFIX + "AML Opcode [%s], Method Offset ~%5.5X\n", + AcpiPsGetOpcodeName (Opcode), AmlOffset); + + /* Invoke the _ERR method if present */ + + Status = AcpiGetHandle (NULL, "\\_ERR", &ErrHandle); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + /* Setup parameter object */ + + ArgList.Count = 3; + ArgList.Pointer = Arg; + + Arg[0].Type = ACPI_TYPE_INTEGER; + Arg[0].Integer.Value = AmlStatus; + + Arg[1].Type = ACPI_TYPE_STRING; + Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception); + Arg[1].String.Length = strlen (Exception); + + Arg[2].Type = ACPI_TYPE_INTEGER; + Arg[2].Integer.Value = AcpiOsGetThreadId(); + + /* Setup return buffer */ + + ReturnObj.Pointer = NULL; + ReturnObj.Length = ACPI_ALLOCATE_BUFFER; + + Status = AcpiEvaluateObject (ErrHandle, NULL, &ArgList, &ReturnObj); + if (ACPI_SUCCESS (Status)) + { + if (ReturnObj.Pointer) + { + /* Override original status */ + + NewAmlStatus = (ACPI_STATUS) + ((ACPI_OBJECT *) ReturnObj.Pointer)->Integer.Value; + + /* Free a buffer created via ACPI_ALLOCATE_BUFFER */ + + AcpiOsFree (ReturnObj.Pointer); + } + } + else if (Status != AE_NOT_FOUND) + { + AcpiOsPrintf (AE_PREFIX + "Could not execute _ERR method, %s\n", + AcpiFormatException (Status)); + } + +Cleanup: + + /* Global overrides */ + + if (AcpiGbl_IgnoreErrors) + { + NewAmlStatus = AE_OK; + } + else if (AmlStatus == AE_AML_INTERNAL) + { + NewAmlStatus = AE_AML_INTERNAL; + AcpiOsPrintf (AE_PREFIX + "Cannot override status %s\n\n", + AcpiFormatException (NewAmlStatus)); + } + else if (NewAmlStatus != AmlStatus) + { + AcpiOsPrintf (AE_PREFIX + "Exception override, new status %s\n\n", + AcpiFormatException (NewAmlStatus)); + } + + return (NewAmlStatus); +} + + +/****************************************************************************** + * + * FUNCTION: AeSignalHandler + * + * PARAMETERS: Sig + * + * RETURN: none + * + * DESCRIPTION: Master signal handler. Currently handles SIGINT (ctrl-c), + * and SIGSEGV (Segment violation). + * + *****************************************************************************/ + +void ACPI_SYSTEM_XFACE +AeSignalHandler ( + int Sig) +{ + + fflush(stdout); + AcpiOsPrintf ("\n" AE_PREFIX); + + switch (Sig) + { + case SIGINT: + signal(Sig, SIG_IGN); + AcpiOsPrintf ("\n"); + + /* Abort the application if there are no methods executing */ + + if (!AcpiGbl_MethodExecuting) + { + break; + } + + /* + * Abort the method(s). This will also dump the method call + * stack so there is no need to do it here. The application + * will then drop back into the debugger interface. + */ + AcpiGbl_AbortMethod = TRUE; + AcpiOsPrintf (AE_PREFIX "Control Method Call Stack:\n"); + signal (SIGINT, AeSignalHandler); + return; + + case SIGSEGV: + AcpiOsPrintf ("Segmentation Fault\n"); + AeDisplayMethodCallStack (); + break; + + default: + AcpiOsPrintf ("Unknown Signal, %X\n", Sig); + break; + } + + /* Terminate application -- cleanup then exit */ + + AcpiOsPrintf (AE_PREFIX "Terminating\n"); + (void) AcpiOsTerminate (); + exit (0); +} + + +/****************************************************************************** + * + * FUNCTION: AeDisplayMethodCallStack + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Display current method call stack, if possible. + * + * NOTE: Currently only called from a SIGSEGV, so AcpiExec is about + * to terminate. + * + *****************************************************************************/ + +static void +AeDisplayMethodCallStack ( + void) +{ + ACPI_WALK_STATE *WalkState; + ACPI_THREAD_STATE *ThreadList = AcpiGbl_CurrentWalkList; + char *FullPathname = NULL; + + + if (!AcpiGbl_MethodExecuting) + { + AcpiOsPrintf (AE_PREFIX "No method is executing\n"); + return; + } + + /* + * Try to find the currently executing control method(s) + * + * Note: The following code may fault if the data structures are + * in an indeterminate state when the interrupt occurs. However, + * in practice, this works quite well and can provide very + * valuable information. + * + * 1) Walk the global thread list + */ + while (ThreadList && + (ThreadList->DescriptorType == ACPI_DESC_TYPE_STATE_THREAD)) + { + /* 2) Walk the walk state list for this thread */ + + WalkState = ThreadList->WalkStateList; + while (WalkState && + (WalkState->DescriptorType == ACPI_DESC_TYPE_WALK)) + { + /* An executing control method */ + + if (WalkState->MethodNode) + { + FullPathname = AcpiNsGetExternalPathname ( + WalkState->MethodNode); + + AcpiOsPrintf (AE_PREFIX + "Executing Method: %s\n", FullPathname); + } + + /* Execution of a deferred opcode/node */ + + if (WalkState->DeferredNode) + { + FullPathname = AcpiNsGetExternalPathname ( + WalkState->DeferredNode); + + AcpiOsPrintf (AE_PREFIX + "Evaluating deferred node: %s\n", FullPathname); + } + + /* Get the currently executing AML opcode */ + + if ((WalkState->Opcode != AML_INT_METHODCALL_OP) && + FullPathname) + { + AcpiOsPrintf (AE_PREFIX + "Current AML Opcode in %s: [%s]-0x%4.4X at %p\n", + FullPathname, AcpiPsGetOpcodeName (WalkState->Opcode), + WalkState->Opcode, WalkState->Aml); + } + + if (FullPathname) + { + ACPI_FREE (FullPathname); + FullPathname = NULL; + } + + WalkState = WalkState->Next; + } + + ThreadList = ThreadList->Next; + } +} diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index 5f32b6af93fc..b28541955a19 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -181,14 +181,6 @@ AeDeviceNotifyHandler ( UINT32 Value, void *Context); -static ACPI_STATUS -AeExceptionHandler ( - ACPI_STATUS AmlStatus, - ACPI_NAME Name, - UINT16 Opcode, - UINT32 AmlOffset, - void *Context); - static ACPI_STATUS AeTableHandler ( UINT32 Event, @@ -230,48 +222,9 @@ static char *TableEvents[] = #endif /* !ACPI_REDUCED_HARDWARE */ -static UINT32 SigintCount = 0; static AE_DEBUG_REGIONS AeRegions; -/****************************************************************************** - * - * FUNCTION: AeCtrlCHandler - * - * PARAMETERS: Sig - * - * RETURN: none - * - * DESCRIPTION: Control-C handler. Abort running control method if any. - * - *****************************************************************************/ - -void ACPI_SYSTEM_XFACE -AeCtrlCHandler ( - int Sig) -{ - - signal (SIGINT, SIG_IGN); - SigintCount++; - - AcpiOsPrintf ("Caught a ctrl-c (#%u)\n\n", SigintCount); - - if (AcpiGbl_MethodExecuting) - { - AcpiGbl_AbortMethod = TRUE; - signal (SIGINT, AeCtrlCHandler); - - if (SigintCount < 10) - { - return; - } - } - - (void) AcpiOsTerminate (); - exit (0); -} - - /****************************************************************************** * * FUNCTION: AeNotifyHandler(s) @@ -325,28 +278,34 @@ AeCommonNotifyHandler ( #if 0 case 0: - printf ("[AcpiExec] Method Error 0x%X: Results not equal\n", Value); + printf (AE_PREFIX + "Method Error 0x%X: Results not equal\n", Value); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Method Error: Results not equal\n"); + AcpiOsPrintf (AE_PREFIX + "Method Error: Results not equal\n"); } break; case 1: - printf ("[AcpiExec] Method Error: Incorrect numeric result\n"); + printf (AE_PREFIX + "Method Error: Incorrect numeric result\n"); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Method Error: Incorrect numeric result\n"); + AcpiOsPrintf (AE_PREFIX + "Method Error: Incorrect numeric result\n"); } break; case 2: - printf ("[AcpiExec] Method Error: An operand was overwritten\n"); + printf (AE_PREFIX + "Method Error: An operand was overwritten\n"); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Method Error: An operand was overwritten\n"); + AcpiOsPrintf (AE_PREFIX + "Method Error: An operand was overwritten\n"); } break; @@ -354,12 +313,14 @@ AeCommonNotifyHandler ( default: - printf ("[AcpiExec] Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", + printf (AE_PREFIX + "Handler %u: Received a %s Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", HandlerId, Type, AcpiUtGetNodeName (Device), Device, Value, AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Handler %u: Received a %s notify, Value 0x%2.2X\n", + AcpiOsPrintf (AE_PREFIX + "Handler %u: Received a %s notify, Value 0x%2.2X\n", HandlerId, Type, Value); } @@ -390,12 +351,14 @@ AeSystemNotifyHandler ( void *Context) { - printf ("[AcpiExec] Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", + printf (AE_PREFIX + "Global: Received a System Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", AcpiUtGetNodeName (Device), Device, Value, AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Global: Received a System Notify, Value 0x%2.2X\n", Value); + AcpiOsPrintf (AE_PREFIX + "Global: Received a System Notify, Value 0x%2.2X\n", Value); } (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); @@ -423,120 +386,20 @@ AeDeviceNotifyHandler ( void *Context) { - printf ("[AcpiExec] Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", + printf (AE_PREFIX + "Global: Received a Device Notify on [%4.4s] %p Value 0x%2.2X (%s)\n", AcpiUtGetNodeName (Device), Device, Value, AcpiUtGetNotifyName (Value, ACPI_TYPE_ANY)); if (AcpiGbl_DebugFile) { - AcpiOsPrintf ("[AcpiExec] Global: Received a Device Notify, Value 0x%2.2X\n", Value); + AcpiOsPrintf (AE_PREFIX + "Global: Received a Device Notify, Value 0x%2.2X\n", Value); } (void) AcpiEvaluateObject (Device, "_NOT", NULL, NULL); } -/****************************************************************************** - * - * FUNCTION: AeExceptionHandler - * - * PARAMETERS: Standard exception handler parameters - * - * RETURN: Status - * - * DESCRIPTION: System exception handler for AcpiExec utility. - * - *****************************************************************************/ - -static ACPI_STATUS -AeExceptionHandler ( - ACPI_STATUS AmlStatus, - ACPI_NAME Name, - UINT16 Opcode, - UINT32 AmlOffset, - void *Context) -{ - ACPI_STATUS NewAmlStatus = AmlStatus; - ACPI_STATUS Status; - ACPI_BUFFER ReturnObj; - ACPI_OBJECT_LIST ArgList; - ACPI_OBJECT Arg[3]; - const char *Exception; - - - Exception = AcpiFormatException (AmlStatus); - AcpiOsPrintf ("[AcpiExec] Exception %s during execution ", Exception); - if (Name) - { - AcpiOsPrintf ("of method [%4.4s]", (char *) &Name); - } - else - { - AcpiOsPrintf ("at module level (table load)"); - } - - AcpiOsPrintf (" Opcode [%s] @%X\n", AcpiPsGetOpcodeName (Opcode), AmlOffset); - - /* - * Invoke the _ERR method if present - * - * Setup parameter object - */ - ArgList.Count = 3; - ArgList.Pointer = Arg; - - Arg[0].Type = ACPI_TYPE_INTEGER; - Arg[0].Integer.Value = AmlStatus; - - Arg[1].Type = ACPI_TYPE_STRING; - Arg[1].String.Pointer = ACPI_CAST_PTR (char, Exception); - Arg[1].String.Length = strlen (Exception); - - Arg[2].Type = ACPI_TYPE_INTEGER; - Arg[2].Integer.Value = AcpiOsGetThreadId(); - - /* Setup return buffer */ - - ReturnObj.Pointer = NULL; - ReturnObj.Length = ACPI_ALLOCATE_BUFFER; - - Status = AcpiEvaluateObject (NULL, "\\_ERR", &ArgList, &ReturnObj); - if (ACPI_SUCCESS (Status)) - { - if (ReturnObj.Pointer) - { - /* Override original status */ - - NewAmlStatus = (ACPI_STATUS) - ((ACPI_OBJECT *) ReturnObj.Pointer)->Integer.Value; - - /* Free a buffer created via ACPI_ALLOCATE_BUFFER */ - - AcpiOsFree (ReturnObj.Pointer); - } - } - else if (Status != AE_NOT_FOUND) - { - AcpiOsPrintf ("[AcpiExec] Could not execute _ERR method, %s\n", - AcpiFormatException (Status)); - } - - /* Global override */ - - if (AcpiGbl_IgnoreErrors) - { - NewAmlStatus = AE_OK; - } - - if (NewAmlStatus != AmlStatus) - { - AcpiOsPrintf ("[AcpiExec] Exception override, new status %s\n\n", - AcpiFormatException (NewAmlStatus)); - } - - return (NewAmlStatus); -} - - /****************************************************************************** * * FUNCTION: AeTableHandler @@ -571,8 +434,9 @@ AeTableHandler ( Status = AcpiUpdateAllGpes (); ACPI_CHECK_OK (AcpiUpdateAllGpes, Status); - printf ("[AcpiExec] Table Event %s, [%4.4s] %p\n", - TableEvents[Event], ((ACPI_TABLE_HEADER *) Table)->Signature, Table); + printf (AE_PREFIX "Table Event %s, [%4.4s] %p\n", + TableEvents[Event], + ((ACPI_TABLE_HEADER *) Table)->Signature, Table); #endif /* !ACPI_REDUCED_HARDWARE */ return (AE_OK); @@ -596,7 +460,8 @@ AeGpeHandler ( ACPI_NAMESPACE_NODE *DeviceNode = (ACPI_NAMESPACE_NODE *) GpeDevice; - AcpiOsPrintf ("[AcpiExec] GPE Handler received GPE %02X (GPE block %4.4s)\n", + AcpiOsPrintf (AE_PREFIX + "GPE Handler received GPE %02X (GPE block %4.4s)\n", GpeNumber, GpeDevice ? DeviceNode->Name.Ascii : "FADT"); return (ACPI_REENABLE_GPE); @@ -639,8 +504,8 @@ AeGlobalEventHandler ( break; } - AcpiOsPrintf ( - "[AcpiExec] Global Event Handler received: Type %s Number %.2X Dev %p\n", + AcpiOsPrintf (AE_PREFIX + "Global Event Handler received: Type %s Number %.2X Dev %p\n", TypeName, EventNumber, Device); } @@ -662,7 +527,8 @@ AeAttachedDataHandler ( ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); - AcpiOsPrintf ("Received an attached data deletion (1) on %4.4s\n", + AcpiOsPrintf (AE_PREFIX + "Received an attached data deletion (1) on %4.4s\n", Node->Name.Ascii); } @@ -684,7 +550,8 @@ AeAttachedDataHandler2 ( ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); - AcpiOsPrintf ("Received an attached data deletion (2) on %4.4s\n", + AcpiOsPrintf (AE_PREFIX + "Received an attached data deletion (2) on %4.4s\n", Node->Name.Ascii); } @@ -734,7 +601,8 @@ AeSciHandler ( void *Context) { - AcpiOsPrintf ("[AcpiExec] Received an SCI at handler\n"); + AcpiOsPrintf (AE_PREFIX + "Received an SCI at handler\n"); return (0); } @@ -926,16 +794,16 @@ AeInstallEarlyHandlers ( /* Install global notify handlers */ - Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_SYSTEM_NOTIFY, - AeSystemNotifyHandler, NULL); + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, + ACPI_SYSTEM_NOTIFY, AeSystemNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a global system notify handler, %s\n", AcpiFormatException (Status)); } - Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, ACPI_DEVICE_NOTIFY, - AeDeviceNotifyHandler, NULL); + Status = AcpiInstallNotifyHandler (ACPI_ROOT_OBJECT, + ACPI_DEVICE_NOTIFY, AeDeviceNotifyHandler, NULL); if (ACPI_FAILURE (Status)) { printf ("Could not install a global notify handler, %s\n", diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c index def7b1b9efc0..2601d3369b89 100644 --- a/source/tools/acpiexec/aemain.c +++ b/source/tools/acpiexec/aemain.c @@ -575,7 +575,9 @@ main ( ACPI_DEBUG_INITIALIZE (); /* For debug version only */ - signal (SIGINT, AeCtrlCHandler); + + signal (SIGINT, AeSignalHandler); + signal (SIGSEGV, AeSignalHandler); /* Init debug globals */ diff --git a/source/tools/acpisrc/asremove.c b/source/tools/acpisrc/asremove.c index 0ee4b3a10417..a728d9067711 100644 --- a/source/tools/acpisrc/asremove.c +++ b/source/tools/acpisrc/asremove.c @@ -550,6 +550,7 @@ AsReduceTypedefs ( { char *SubString; char *SubBuffer; + char *SubSubString; int NestLevel; @@ -562,56 +563,89 @@ AsReduceTypedefs ( if (SubString) { - /* Remove the typedef itself */ + SubSubString = SubString + strlen (Keyword); - SubBuffer = SubString + strlen ("typedef") + 1; - SubBuffer = AsRemoveData (SubString, SubBuffer); + /* skip spaces */ - /* Find the opening brace of the struct or union */ + while (strchr(" \t\r\n", *SubSubString)) + { + SubSubString++; + } - while (*SubString != '{') + /* skip type name */ + + while (!strchr(" \t\r\n", *SubSubString)) { - SubString++; + SubSubString++; } - SubString++; - /* Find the closing brace. Handles nested braces */ + /* skip spaces */ - NestLevel = 1; - while (*SubString) + while (strchr(" \t\r\n", *SubSubString)) + { + SubSubString++; + } + + if (*SubSubString == '{') { - if (*SubString == '{') + /* Remove the typedef itself */ + + SubBuffer = SubString + strlen ("typedef") + 1; + SubBuffer = AsRemoveData (SubString, SubBuffer); + + /* Find the opening brace of the struct or union */ + + while (*SubString != '{') { - NestLevel++; + SubString++; } - else if (*SubString == '}') + SubString++; + + /* Find the closing brace. Handles nested braces */ + + NestLevel = 1; + while (*SubString) { - NestLevel--; + if (*SubString == '{') + { + NestLevel++; + } + else if (*SubString == '}') + { + NestLevel--; + } + + SubString++; + + if (NestLevel == 0) + { + break; + } } - SubString++; + /* Remove an extra line feed if present */ - if (NestLevel == 0) + if (!strncmp (SubString - 3, "\n\n", 2)) { - break; + *(SubString -2) = '}'; + SubString--; } - } - - /* Remove an extra line feed if present */ - if (!strncmp (SubString - 3, "\n\n", 2)) - { - *(SubString -2) = '}'; - SubString--; - } + /* Find the end of the typedef name */ - /* Find the end of the typedef name */ + SubBuffer = AsSkipUntilChar (SubString, ';'); - SubBuffer = AsSkipUntilChar (SubString, ';'); + /* And remove the typedef name */ - /* And remove the typedef name */ + SubBuffer = AsRemoveData (SubString, SubBuffer); + } + else + { + /* Skip the entire definition */ - SubBuffer = AsRemoveData (SubString, SubBuffer); + SubString = strchr (SubString, ';') + 1; + SubBuffer = SubString; + } } } } diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 521d910eac92..fe07e44cb47f 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -294,6 +294,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_BUS_ATTRIBUTE", SRC_TYPE_STRUCT}, {"ACPI_CACHE_T", SRC_TYPE_SIMPLE}, {"ACPI_CMTABLE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_COMMENT_ADDR_NODE", SRC_TYPE_STRUCT}, + {"ACPI_COMMENT_NODE", SRC_TYPE_STRUCT}, {"ACPI_COMMON_FACS", SRC_TYPE_STRUCT}, {"ACPI_COMMON_STATE", SRC_TYPE_STRUCT}, {"ACPI_COMMON_DESCRIPTOR", SRC_TYPE_STRUCT}, @@ -317,6 +319,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_DMTABLE_DATA", SRC_TYPE_STRUCT}, {"ACPI_DMTABLE_INFO", SRC_TYPE_STRUCT}, {"ACPI_DMTABLE_HANDLER", SRC_TYPE_SIMPLE}, + {"ACPI_EFI_FILE", SRC_TYPE_SIMPLE}, {"ACPI_EVALUATE_INFO", SRC_TYPE_STRUCT}, {"ACPI_EVENT_HANDLER", SRC_TYPE_SIMPLE}, {"ACPI_EVENT_STATUS", SRC_TYPE_SIMPLE}, @@ -331,6 +334,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_FADT_INFO", SRC_TYPE_STRUCT}, {"ACPI_FADT_PM_INFO", SRC_TYPE_STRUCT}, {"ACPI_FIELD_INFO", SRC_TYPE_STRUCT}, + {"ACPI_FILE_NODE", SRC_TYPE_STRUCT}, {"ACPI_FIND_CONTEXT", SRC_TYPE_STRUCT}, {"ACPI_FIXED_EVENT_HANDLER", SRC_TYPE_STRUCT}, {"ACPI_FIXED_EVENT_INFO", SRC_TYPE_STRUCT}, @@ -594,6 +598,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"AE_DEBUG_REGIONS", SRC_TYPE_STRUCT}, {"AE_REGION", SRC_TYPE_STRUCT}, {"ASL_ANALYSIS_WALK_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}, @@ -633,6 +639,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_FPDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_GTDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_HEST", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_HMAT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_HPET", SRC_TYPE_STRUCT}, {"ACPI_TABLE_IBFT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_IORT", SRC_TYPE_STRUCT}, @@ -645,6 +652,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_MSDM", SRC_TYPE_STRUCT}, {"ACPI_TABLE_NFIT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_PCCT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_PPTT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDP", SRC_TYPE_STRUCT}, {"ACPI_TABLE_RSDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_MCHI", SRC_TYPE_STRUCT}, @@ -664,6 +672,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_TABLE_WDDT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_WDRT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_WPBT", SRC_TYPE_STRUCT}, + {"ACPI_TABLE_WSMT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_XENV", SRC_TYPE_STRUCT}, {"ACPI_TABLE_XSDT", SRC_TYPE_STRUCT}, @@ -719,6 +728,10 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_HEST_GENERIC_STATUS", SRC_TYPE_STRUCT}, {"ACPI_HEST_GENERIC_DATA", SRC_TYPE_STRUCT}, {"ACPI_HEST_GENERIC_DATA_V300", SRC_TYPE_STRUCT}, + {"ACPI_HEST_IA_DEFERRED_CHECK", SRC_TYPE_STRUCT}, + {"ACPI_HMAT_ADDRESS_RANGE", SRC_TYPE_STRUCT}, + {"ACPI_HMAT_LOCALITY", SRC_TYPE_STRUCT}, + {"ACPI_HMAT_CACHE", SRC_TYPE_STRUCT}, {"ACPI_IBFT_HEADER", SRC_TYPE_STRUCT}, {"ACPI_IBFT_CONTROL", SRC_TYPE_STRUCT}, {"ACPI_IBFT_INITIATOR", SRC_TYPE_STRUCT}, @@ -774,22 +787,30 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_NFIT_CONTROL_REGION", SRC_TYPE_STRUCT}, {"ACPI_NFIT_DATA_REGION", SRC_TYPE_STRUCT}, {"ACPI_NFIT_FLUSH_ADDRESS", SRC_TYPE_STRUCT}, + {"ACPI_PCCT_EXT_PCC_SHARED_MEMORY", SRC_TYPE_STRUCT}, {"ACPI_PCCT_HW_REDUCED", SRC_TYPE_STRUCT}, {"ACPI_PCCT_HW_REDUCED_TYPE2", SRC_TYPE_STRUCT}, + {"ACPI_PCCT_EXT_PCC_MASTER", SRC_TYPE_STRUCT}, + {"ACPI_PCCT_EXT_PCC_SLAVE", SRC_TYPE_STRUCT}, {"ACPI_PCCT_SHARED_MEMORY", SRC_TYPE_STRUCT}, {"ACPI_PCCT_SUBSPACE", SRC_TYPE_STRUCT}, + {"ACPI_PPTT_PROCESSOR", SRC_TYPE_STRUCT}, + {"ACPI_PPTT_CACHE", SRC_TYPE_STRUCT}, + {"ACPI_PPTT_ID", SRC_TYPE_STRUCT}, {"ACPI_RSDP_COMMON", SRC_TYPE_STRUCT}, {"ACPI_RSDP_EXTENSION", SRC_TYPE_STRUCT}, {"ACPI_S3PT_RESUME", SRC_TYPE_STRUCT}, {"ACPI_S3PT_SUSPEND", SRC_TYPE_STRUCT}, {"ACPI_SRAT_CPU_AFFINITY", SRC_TYPE_STRUCT}, {"ACPI_SRAT_HEADER", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_GIC_ITS_AFFINITY", SRC_TYPE_STRUCT}, + {"ACPI_SRAT_GICC_AFFINITY", SRC_TYPE_STRUCT}, {"ACPI_SRAT_MEM_AFFINITY", SRC_TYPE_STRUCT}, {"ACPI_SRAT_X2APIC_CPU_AFFINITY", SRC_TYPE_STRUCT}, - {"ACPI_SRAT_GICC_AFFINITY", SRC_TYPE_STRUCT}, {"ACPI_TABLE_TCPA_CLIENT", SRC_TYPE_STRUCT}, {"ACPI_TABLE_TCPA_SERVER", SRC_TYPE_STRUCT}, - {"ACPI_TPM2_CONTROL", SRC_TYPE_STRUCT}, + {"ACPI_TPM2_TRAILER", SRC_TYPE_STRUCT}, + {"ACPI_TPM2_ARM_SMC", SRC_TYPE_STRUCT}, {"ACPI_WDAT_ENTRY", SRC_TYPE_STRUCT}, /* Data Table compiler */ -- cgit v1.2.3