From 7e248a6a42be630466c332f690b7379e34abfbf1 Mon Sep 17 00:00:00 2001 From: jkim Date: Thu, 4 Jan 2018 19:43:42 +0000 Subject: [PATCH] MFC: r323076, r324502, r325670, r326866 Merge ACPICA 20171214. --- sys/conf/files | 1 + sys/contrib/dev/acpica/changes.txt | 242 ++++ sys/contrib/dev/acpica/common/adfile.c | 4 +- sys/contrib/dev/acpica/common/adisasm.c | 4 +- sys/contrib/dev/acpica/common/ahtable.c | 2 + sys/contrib/dev/acpica/common/dmswitch.c | 4 + sys/contrib/dev/acpica/common/dmtable.c | 71 +- sys/contrib/dev/acpica/common/dmtables.c | 4 +- sys/contrib/dev/acpica/common/dmtbdump.c | 1028 +++++++++++------ sys/contrib/dev/acpica/common/dmtbinfo.c | 177 ++- sys/contrib/dev/acpica/compiler/aslallocate.c | 303 +++++ sys/contrib/dev/acpica/compiler/aslcache.c | 481 ++++++++ sys/contrib/dev/acpica/compiler/aslcodegen.c | 19 +- sys/contrib/dev/acpica/compiler/aslcompile.c | 68 +- sys/contrib/dev/acpica/compiler/aslcompiler.h | 76 +- sys/contrib/dev/acpica/compiler/aslcompiler.l | 8 +- sys/contrib/dev/acpica/compiler/asldebug.c | 89 +- sys/contrib/dev/acpica/compiler/asldefine.h | 2 +- sys/contrib/dev/acpica/compiler/aslerror.c | 810 ++++++++----- sys/contrib/dev/acpica/compiler/aslfiles.c | 9 +- sys/contrib/dev/acpica/compiler/aslhelp.c | 3 +- sys/contrib/dev/acpica/compiler/aslload.c | 30 +- sys/contrib/dev/acpica/compiler/aslmain.c | 8 +- sys/contrib/dev/acpica/compiler/aslmapenter.c | 4 +- sys/contrib/dev/acpica/compiler/aslmaputils.c | 4 +- sys/contrib/dev/acpica/compiler/aslmessages.c | 7 +- sys/contrib/dev/acpica/compiler/aslmessages.h | 3 + sys/contrib/dev/acpica/compiler/aslmethod.c | 43 +- sys/contrib/dev/acpica/compiler/asloperands.c | 4 +- sys/contrib/dev/acpica/compiler/aslopt.c | 2 +- sys/contrib/dev/acpica/compiler/asloptions.c | 22 +- sys/contrib/dev/acpica/compiler/aslparseop.c | 61 +- sys/contrib/dev/acpica/compiler/aslprintf.c | 4 +- sys/contrib/dev/acpica/compiler/aslresource.c | 8 + sys/contrib/dev/acpica/compiler/aslrules.y | 3 +- sys/contrib/dev/acpica/compiler/aslstartup.c | 8 +- sys/contrib/dev/acpica/compiler/aslsupport.l | 22 +- sys/contrib/dev/acpica/compiler/asltree.c | 41 +- sys/contrib/dev/acpica/compiler/asltypes.h | 9 +- sys/contrib/dev/acpica/compiler/aslutils.c | 240 +--- sys/contrib/dev/acpica/compiler/cvcompiler.c | 26 +- sys/contrib/dev/acpica/compiler/cvdisasm.c | 4 +- sys/contrib/dev/acpica/compiler/cvparser.c | 8 +- sys/contrib/dev/acpica/compiler/dtcompile.c | 20 +- sys/contrib/dev/acpica/compiler/dtcompiler.h | 37 +- sys/contrib/dev/acpica/compiler/dtexpress.c | 1 - sys/contrib/dev/acpica/compiler/dtfield.c | 9 +- sys/contrib/dev/acpica/compiler/dtio.c | 5 +- sys/contrib/dev/acpica/compiler/dtparser.y | 18 +- sys/contrib/dev/acpica/compiler/dtsubtable.c | 3 +- sys/contrib/dev/acpica/compiler/dttable.c | 1 - sys/contrib/dev/acpica/compiler/dttable1.c | 11 +- sys/contrib/dev/acpica/compiler/dttable2.c | 384 +++++- sys/contrib/dev/acpica/compiler/dttemplate.c | 3 +- sys/contrib/dev/acpica/compiler/dttemplate.h | 115 +- sys/contrib/dev/acpica/compiler/dtutils.c | 185 +-- sys/contrib/dev/acpica/compiler/prexpress.c | 2 - sys/contrib/dev/acpica/compiler/prmacros.c | 2 - sys/contrib/dev/acpica/compiler/prparser.y | 5 +- sys/contrib/dev/acpica/compiler/prscan.c | 3 +- sys/contrib/dev/acpica/compiler/prutils.c | 4 +- .../acpica/components/debugger/dbconvert.c | 4 +- .../dev/acpica/components/debugger/dbexec.c | 124 +- .../dev/acpica/components/debugger/dbfileio.c | 2 +- .../dev/acpica/components/debugger/dbinput.c | 205 ++-- .../acpica/components/disassembler/dmresrc.c | 14 + .../acpica/components/disassembler/dmwalk.c | 6 +- .../acpica/components/dispatcher/dscontrol.c | 17 +- .../acpica/components/dispatcher/dsfield.c | 27 +- .../acpica/components/dispatcher/dsobject.c | 3 +- .../acpica/components/dispatcher/dspkginit.c | 22 +- .../acpica/components/dispatcher/dsutils.c | 3 +- .../acpica/components/dispatcher/dswexec.c | 2 +- .../acpica/components/dispatcher/dswload.c | 4 +- .../acpica/components/dispatcher/dswload2.c | 12 +- .../dev/acpica/components/events/evgpe.c | 6 +- .../dev/acpica/components/events/evregion.c | 11 + .../dev/acpica/components/executer/exconcat.c | 2 +- .../dev/acpica/components/executer/exconvrt.c | 26 +- .../dev/acpica/components/executer/exdump.c | 6 +- .../dev/acpica/components/executer/exmisc.c | 2 +- .../dev/acpica/components/executer/exresop.c | 2 +- .../dev/acpica/components/hardware/hwgpe.c | 4 +- .../dev/acpica/components/hardware/hwregs.c | 74 +- .../dev/acpica/components/hardware/hwtimer.c | 37 +- .../dev/acpica/components/hardware/hwvalid.c | 17 +- .../dev/acpica/components/hardware/hwxface.c | 130 +-- .../acpica/components/namespace/nsaccess.c | 14 +- .../acpica/components/namespace/nsconvert.c | 6 +- .../dev/acpica/components/namespace/nsnames.c | 172 +++ .../acpica/components/namespace/nssearch.c | 1 + .../acpica/components/namespace/nsxfeval.c | 18 +- .../dev/acpica/components/parser/psargs.c | 2 +- .../dev/acpica/components/parser/psobject.c | 9 +- .../dev/acpica/components/parser/psutils.c | 10 +- .../dev/acpica/components/tables/tbxface.c | 9 +- .../dev/acpica/components/utilities/utdebug.c | 19 +- .../acpica/components/utilities/utdecode.c | 11 +- .../dev/acpica/components/utilities/uterror.c | 78 +- .../dev/acpica/components/utilities/utinit.c | 1 - .../dev/acpica/components/utilities/utmath.c | 4 +- .../dev/acpica/components/utilities/utmutex.c | 7 +- .../acpica/components/utilities/utnonansi.c | 13 + .../dev/acpica/components/utilities/utosi.c | 2 + .../acpica/components/utilities/utstrsuppt.c | 621 ++++++++++ .../acpica/components/utilities/utstrtoul64.c | 472 ++++---- .../dev/acpica/components/utilities/uttrack.c | 5 +- .../acpica/components/utilities/utxferror.c | 8 +- sys/contrib/dev/acpica/include/acapps.h | 3 + sys/contrib/dev/acpica/include/acconfig.h | 4 +- sys/contrib/dev/acpica/include/acdebug.h | 6 + sys/contrib/dev/acpica/include/acdisasm.h | 28 +- sys/contrib/dev/acpica/include/acexcep.h | 18 +- sys/contrib/dev/acpica/include/acglobal.h | 121 +- sys/contrib/dev/acpica/include/achware.h | 4 +- sys/contrib/dev/acpica/include/acinterp.h | 5 +- sys/contrib/dev/acpica/include/aclocal.h | 15 +- sys/contrib/dev/acpica/include/acmacros.h | 2 +- sys/contrib/dev/acpica/include/acnamesp.h | 5 + sys/contrib/dev/acpica/include/acpixf.h | 6 +- sys/contrib/dev/acpica/include/actbl1.h | 209 +++- sys/contrib/dev/acpica/include/actbl2.h | 16 +- sys/contrib/dev/acpica/include/actypes.h | 4 + sys/contrib/dev/acpica/include/acutils.h | 78 +- .../os_specific/service_layers/osgendbg.c | 5 +- sys/dev/acpica/acpi_cpu.c | 8 +- usr.sbin/acpi/acpidb/Makefile | 5 +- usr.sbin/acpi/iasl/Makefile | 45 +- 128 files changed, 5398 insertions(+), 2207 deletions(-) create mode 100644 sys/contrib/dev/acpica/compiler/aslallocate.c create mode 100644 sys/contrib/dev/acpica/compiler/aslcache.c create mode 100644 sys/contrib/dev/acpica/components/utilities/utstrsuppt.c diff --git a/sys/conf/files b/sys/conf/files index 15475726530..26797b2243f 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -515,6 +515,7 @@ contrib/dev/acpica/components/utilities/utresdecode.c optional acpi acpi_debug contrib/dev/acpica/components/utilities/utresrc.c optional acpi contrib/dev/acpica/components/utilities/utstate.c optional acpi contrib/dev/acpica/components/utilities/utstring.c optional acpi +contrib/dev/acpica/components/utilities/utstrsuppt.c optional acpi contrib/dev/acpica/components/utilities/utstrtoul64.c optional acpi contrib/dev/acpica/components/utilities/utuuid.c optional acpi acpi_debug contrib/dev/acpica/components/utilities/utxface.c optional acpi diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index d0fe928c1ac..2a72a514401 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,245 @@ +---------------------------------------- +14 December 2017. Summary of changes for version 20171214: + + +1) ACPICA kernel-resident subsystem: + +Fixed a regression in the external (public) AcpiEvaluateObjectTyped +interface where the optional "pathname" argument had inadvertently become +a required argument returning an error if omitted (NULL pointer +argument). + +Fixed two possible memory leaks related to the recently developed "late +resolution" of reference objects within ASL Package Object definitions. + +Added two recently defined _OSI strings: "Windows 2016" and "Windows +2017". Mario Limonciello. + +Implemented and deployed a safer version of the C library function +strncpy: AcpiUtSafeStrncpy. The intent is to at least prevent the +creation of unterminated strings as a possible result of a standard +strncpy. + +Cleaned up and restructured the global variable file (acglobal.h). There +are many changes, but no functional changes. + + +2) iASL Compiler/Disassembler and Tools: + +iASL Table Compiler: Fixed a problem with the DBG2 ACPI table where the +optional OemData field at the end of the table was incorrectly required +for proper compilation. It is now correctly an optional field. + +ASLTS: The entire suite was converted from standard ASL to the ASL+ +language, using the ASL-to-ASL+ converter which is integrated into the +iASL compiler. A binary compare of all output files has verified the +correctness of the conversion. + +iASL: Fixed the source code build for platforms where "char" is unsigned. +This affected the iASL lexer only. Jung-uk Kim. + +---------------------------------------- +10 November 2017. Summary of changes for version 20171110: + + +1) ACPICA kernel-resident subsystem: + +This release implements full support for ACPI 6.2A: + NFIT - Added a new subtable, "Platform Capabilities Structure" +No other changes to ACPICA were required, since ACPI 6.2A is primarily an +errata release of the specification. + +Other ACPI table changes: + IORT: Added the SMMUv3 Device ID mapping index. Hanjun Guo + PPTT: Added cache attribute flag definitions to actbl1.h. Jeremy +Linton + +Utilities: Modified the string/integer conversion functions to use +internal 64-bit divide support instead of a native divide. On 32-bit +platforms, a 64-bit divide typically requires a library function which +may not be present in the build (kernel or otherwise). + +Implemented a targeted error message for timeouts returned from the +Embedded Controller device driver. This is seen frequently enough to +special-case an AE_TIME returned from an EC operation region access: + "Timeout from EC hardware or EC device driver" + +Changed the "ACPI Exception" message prefix to "ACPI Error" so that all +runtime error messages have the identical prefix. + + +2) iASL Compiler/Disassembler and Tools: + +AcpiXtract: Fixed a problem with table header detection within the +acpidump file. Processing a table could be ended early if a 0x40 (@) +appears in the original binary table, resulting in the @ symbol appearing +in the decoded ASCII field at the end of the acpidump text line. The +symbol caused acpixtract to incorrectly think it had reached the end of +the current table and the beginning of a new table. + +AcpiXtract: Added an option (-f) to ignore some errors during table +extraction. This initial implementation ignores non-ASCII and non- +printable characters found in the acpidump text file. + +TestSuite(ASLTS)/AcpiExec: Fixed and restored the memory usage statistics +for ASLTS. This feature is used to track memory allocations from +different memory caches within the ACPICA code. At the end of an ASLTS +run, these memory statistics are recorded and stored in a log file. + +Debugger (user-space version): Implemented a simple "Background" command. +Creates a new thread to execute a control method in the background, while +control returns to the debugger prompt to allow additional commands. + Syntax: Background [Arguments] + +---------------------------------------- +29 September 2017. Summary of changes for version 20170929: + + +1) ACPICA kernel-resident subsystem: + +Redesigned and implemented an improved ASL While() loop timeout +mechanism. This mechanism is used to prevent infinite loops in the kernel +AML interpreter caused by either non-responsive hardware or incorrect AML +code. The new implementation uses AcpiOsGetTimer instead of a simple +maximum loop count, and is thus more accurate and constant across +different machines. The default timeout is currently 30 seconds, but this +may be adjusted later. + +Renamed the ACPI_AML_INFINITE_LOOP exception to AE_AML_LOOP_TIMEOUT to +better reflect the new implementation of the loop timeout mechanism. + +Updated the AcpiGetTimerDuration interface to cleanup the 64-bit support +and to fix an off-by-one error. Jung-uk Kim. + +Fixed an EFI build problem by updating the makefiles to for a new file +that was added, utstrsuppt.c + + +2) iASL Compiler/Disassembler and Tools: + +Implemented full support for the PDTT, SDEV, and TPM2 ACPI tables. This +includes support in the table disassembler, compiler, and template +generator. + +iASL: Added an exception for an illegal type of recursive method +invocation. If a method creates named objects, the first recursive call +will fail at runtime. This change adds an error detection at compile time +to catch the problem up front. Note: Marking such a method as +"serialized" will not help with this problem, because the same thread can +acquire the method mutex more than once. Example compiler and runtime +output: + + Method (MTH1) + { + Name (INT1, 1) + MTH1 () + } + + dsdt.asl 22: MTH1 () + Error 6152 - ^ Illegal recursive call to method + that creates named objects (MTH1) + +Previous runtime exception: + ACPI Error: [INT1] Namespace lookup failure, + AE_ALREADY_EXISTS (20170831/dswload2-465) + +iASL: Updated support for External() opcodes to improve namespace +management and error detection. These changes are related to issues seen +with multiple-segment namespace pathnames within External declarations, +such as below: + + External(\_SB.PCI0.GFX0, DeviceObj) + External(\_SB.PCI0.GFX0.ALSI) + +iASL: Implemented support for multi-line error/warning messages. This +enables more detailed and helpful error messages as below, from the +initial deployment for the duplicate names error: + + DSDT.iiii 1692: Device(PEG2) { + Error 6074 - ^ Name already exists in scope +(PEG2) + + Original name creation/declaration below: + DSDT.iiii 93: External(\_SB.PCI0.PEG2, DeviceObj) + +AcpiXtract: Added additional flexibility to support differing input hex +dump formats. Specifically, hex dumps that contain partial disassembly +and/or comments within the ACPI table data definition. There exist some +dump utilities seen in the field that create this type of hex dump (such +as Simics). For example: + + DSDT @ 0xdfffd0c0 (10999 bytes) + Signature DSDT + Length 10999 + Revision 1 + Checksum 0xf3 (Ok) + OEM_ID BXPC + OEM_table_id BXDSDT + OEM_revision 1 + Creator_id 1280593481 + Creator_revision 537399345 + 0000: 44 53 44 54 f7 2a 00 00 01 f3 42 58 50 43 00 00 + ... + 2af0: 5f 4c 30 46 00 a4 01 + +Test suite: Miscellaneous changes/fixes: + More cleanup and simplification of makefiles + Continue compilation of test cases after a compile failure + Do not perform binary compare unless both files actually exist + +iASL: Performed some code/module restructuring. Moved all memory +allocation functions to new modules. Two new files, aslallocate.c and +aslcache.c + +---------------------------------------- +31 August 2017. Summary of changes for version 20170831: + + +1) ACPICA kernel-resident subsystem: + +Implemented internal support for full 64-bit addresses that appear in all +Generic Address Structure (GAS) structures. Previously, only the lower 32 +bits were used. Affects the use of GAS structures in the FADT and other +tables, as well as the GAS structures passed to the AcpiRead and +AcpiWrite public external interfaces that are used by drivers. Lv Zheng. + +Added header support for the PDTT ACPI table (Processor Debug Trigger +Table). Full support in the iASL Data Table Compiler and disassembler is +forthcoming. + + +2) iASL Compiler/Disassembler and Tools: + +iASL/Disassembler: Fixed a problem with the PPTT ACPI table (Processor +Properties Topology Table) where a flag bit was specified in the wrong +bit position ("Line Size Valid", bit 6). + +iASL: Implemented support for Octal integer constants as defined by the +ASL language grammar, per the ACPI specification. Any integer constant +that starts with a zero is an octal constant. For example, + Store (037777, Local0) /* Octal constant */ + Store (0x3FFF, Local0) /* Hex equivalent */ + Store (16383, Local0) /* Decimal equivalent */ + +iASL: Improved overflow detection for 64-bit string conversions during +compilation of integer constants. "Overflow" in this case means a string +that represents an integer that is too large to fit into a 64-bit value. +Any 64-bit constants within a 32-bit DSDT or SSDT are still truncated to +the low-order 32 bits with a warning, as previously implemented. Several +new exceptions are defined that indicate a 64-bit overflow, as well as +the base (radix) that was used during the attempted conversion. Examples: + Local0 = 0xAAAABBBBCCCCDDDDEEEEFFFF // AE_HEX_OVERFLOW + Local0 = 01111222233334444555566667777 // AE_OCTAL_OVERFLOW + Local0 = 11112222333344445555666677778888 // AE_DECIMAL_OVERFLOW + +iASL: Added a warning for the case where a ResourceTemplate is declared +with no ResourceDescriptor entries (coded as "ResourceTemplate(){}"). In +this case, the resulting template is created with a single END_TAG +descriptor, which is essentially useless. + +iASL: Expanded the -vw option (ignore specific warnings/remarks) to +include compilation error codes as well. + ---------------------------------------- 28 July 2017. Summary of changes for version 20170728: diff --git a/sys/contrib/dev/acpica/common/adfile.c b/sys/contrib/dev/acpica/common/adfile.c index 115a1854e81..a3abdce55d6 100644 --- a/sys/contrib/dev/acpica/common/adfile.c +++ b/sys/contrib/dev/acpica/common/adfile.c @@ -314,7 +314,7 @@ FlGenerateFilename ( * Copy the original filename to a new buffer. Leave room for the worst * case where we append the suffix, an added dot and the null terminator. */ - NewFilename = UtStringCacheCalloc ((ACPI_SIZE) + NewFilename = UtLocalCacheCalloc ((ACPI_SIZE) strlen (InputFilename) + strlen (Suffix) + 2); strcpy (NewFilename, InputFilename); @@ -358,7 +358,7 @@ FlStrdup ( char *NewString; - NewString = UtStringCacheCalloc ((ACPI_SIZE) strlen (String) + 1); + NewString = UtLocalCacheCalloc ((ACPI_SIZE) strlen (String) + 1); strcpy (NewString, String); return (NewString); } diff --git a/sys/contrib/dev/acpica/common/adisasm.c b/sys/contrib/dev/acpica/common/adisasm.c index 4ee6b99d0b9..3ea3d023db8 100644 --- a/sys/contrib/dev/acpica/common/adisasm.c +++ b/sys/contrib/dev/acpica/common/adisasm.c @@ -457,9 +457,9 @@ AdDisassembleOneTable ( * (.xxx) file produced from the converter in case if * it fails to get deleted. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy (Table->Signature, AcpiGbl_TableSig, 4); + strncpy (Table->Signature, AcpiGbl_TableSig, ACPI_NAME_SIZE); } #endif diff --git a/sys/contrib/dev/acpica/common/ahtable.c b/sys/contrib/dev/acpica/common/ahtable.c index c288edff7b4..247ff29335a 100644 --- a/sys/contrib/dev/acpica/common/ahtable.c +++ b/sys/contrib/dev/acpica/common/ahtable.c @@ -232,6 +232,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_MTMR, "MID Timer Table"}, {ACPI_SIG_NFIT, "NVDIMM Firmware Interface Table"}, {ACPI_SIG_PCCT, "Platform Communications Channel Table"}, + {ACPI_SIG_PDTT, "Platform Debug Trigger Table"}, {ACPI_SIG_PMTT, "Platform Memory Topology Table"}, {ACPI_SIG_PPTT, "Processor Properties Topology Table"}, {ACPI_SIG_RASF, "RAS Features Table"}, @@ -240,6 +241,7 @@ const AH_TABLE Gbl_AcpiSupportedTables[] = {ACPI_SIG_S3PT, "S3 Performance Table"}, {ACPI_SIG_SBST, "Smart Battery Specification Table"}, {ACPI_SIG_SDEI, "Software Delegated Exception Interface Table"}, + {ACPI_SIG_SDEV, "Secure Devices table"}, {ACPI_SIG_SLIC, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, "System Locality Information Table"}, {ACPI_SIG_SPCR, "Serial Port Console Redirection table"}, diff --git a/sys/contrib/dev/acpica/common/dmswitch.c b/sys/contrib/dev/acpica/common/dmswitch.c index a0bf68f9977..0cf913ab486 100644 --- a/sys/contrib/dev/acpica/common/dmswitch.c +++ b/sys/contrib/dev/acpica/common/dmswitch.c @@ -543,6 +543,10 @@ AcpiDmIsSwitchBlock ( * statement, so check for it. */ CurrentOp = StoreOp->Common.Next->Common.Next; + if (!CurrentOp) + { + return (FALSE); + } if (CurrentOp->Common.AmlOpcode == AML_ELSE_OP) { CurrentOp = CurrentOp->Common.Next; diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c index 4356d42ab70..cf5d6010740 100644 --- a/sys/contrib/dev/acpica/common/dmtable.c +++ b/sys/contrib/dev/acpica/common/dmtable.c @@ -154,7 +154,6 @@ #include #include #include -#include /* This module used for application-level code only */ @@ -290,9 +289,9 @@ static const char *AcpiDmHestSubnames[] = "IA-32 Machine Check Exception", "IA-32 Corrected Machine Check", "IA-32 Non-Maskable Interrupt", - "Unknown SubTable Type", /* 3 - Reserved */ - "Unknown SubTable Type", /* 4 - Reserved */ - "Unknown SubTable Type", /* 5 - Reserved */ + "Unknown Subtable Type", /* 3 - Reserved */ + "Unknown Subtable Type", /* 4 - Reserved */ + "Unknown Subtable Type", /* 5 - Reserved */ "PCI Express Root Port AER", "PCI Express AER (AER Endpoint)", "PCI Express/PCI-X Bridge AER", @@ -357,6 +356,7 @@ static const char *AcpiDmNfitSubnames[] = "NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */ "NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */ "Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */ + "Platform Capabilities", /* ACPI_NFIT_TYPE_CAPABILITIES */ "Unknown Subtable Type" /* Reserved */ }; @@ -374,7 +374,7 @@ static const char *AcpiDmPmttSubnames[] = { "Socket", /* ACPI_PMTT_TYPE_SOCKET */ "Memory Controller", /* ACPI_PMTT_TYPE_CONTROLLER */ - "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ + "Physical Component (DIMM)", /* ACPI_PMTT_TYPE_DIMM */ "Unknown Subtable Type" /* Reserved */ }; @@ -382,7 +382,14 @@ static const char *AcpiDmPpttSubnames[] = { "Processor Hierarchy Node", /* ACPI_PPTT_TYPE_PROCESSOR */ "Cache Type", /* ACPI_PPTT_TYPE_CACHE */ - "ID", /* ACPI_PMTT_TYPE_ID */ + "ID", /* ACPI_PPTT_TYPE_ID */ + "Unknown Subtable Type" /* Reserved */ +}; + +static const char *AcpiDmSdevSubnames[] = +{ + "Namespace Device", /* ACPI_SDEV_TYPE_NAMESPACE_DEVICE */ + "PCIe Endpoint Device", /* ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE */ "Unknown Subtable Type" /* Reserved */ }; @@ -396,6 +403,23 @@ static const char *AcpiDmSratSubnames[] = "Unknown Subtable Type" /* Reserved */ }; +static const char *AcpiDmTpm2Subnames[] = +{ + "Illegal Start Method value", + "Reserved", + "ACPI Start Method", + "Reserved", + "Reserved", + "Reserved", + "Memory Mapped I/O", + "Command Response Buffer", + "Command Response Buffer with ACPI Start Method", + "Reserved", + "Reserved", + "Command Response Buffer with ARM SMC", + "Unknown Subtable Type" /* Reserved */ +}; + static const char *AcpiDmIvrsSubnames[] = { "Hardware Definition Block", @@ -487,6 +511,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_MTMR, NULL, AcpiDmDumpMtmr, DtCompileMtmr, TemplateMtmr}, {ACPI_SIG_NFIT, AcpiDmTableInfoNfit, AcpiDmDumpNfit, DtCompileNfit, TemplateNfit}, {ACPI_SIG_PCCT, AcpiDmTableInfoPcct, AcpiDmDumpPcct, DtCompilePcct, TemplatePcct}, + {ACPI_SIG_PDTT, AcpiDmTableInfoPdtt, AcpiDmDumpPdtt, DtCompilePdtt, TemplatePdtt}, {ACPI_SIG_PMTT, NULL, AcpiDmDumpPmtt, DtCompilePmtt, TemplatePmtt}, {ACPI_SIG_PPTT, NULL, AcpiDmDumpPptt, DtCompilePptt, TemplatePptt}, {ACPI_SIG_RASF, AcpiDmTableInfoRasf, NULL, NULL, TemplateRasf}, @@ -494,6 +519,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_S3PT, NULL, NULL, NULL, TemplateS3pt}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst}, {ACPI_SIG_SDEI, AcpiDmTableInfoSdei, NULL, NULL, TemplateSdei}, + {ACPI_SIG_SDEV, AcpiDmTableInfoSdev, AcpiDmDumpSdev, DtCompileSdev, TemplateSdev}, {ACPI_SIG_SLIC, NULL, AcpiDmDumpSlic, DtCompileSlic, TemplateSlic}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr}, @@ -501,7 +527,7 @@ const ACPI_DMTABLE_DATA AcpiDmTableData[] = {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat}, {ACPI_SIG_STAO, NULL, AcpiDmDumpStao, DtCompileStao, TemplateStao}, {ACPI_SIG_TCPA, NULL, AcpiDmDumpTcpa, DtCompileTcpa, TemplateTcpa}, - {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, NULL, NULL, TemplateTpm2}, + {ACPI_SIG_TPM2, AcpiDmTableInfoTpm2, AcpiDmDumpTpm2, DtCompileTpm2, TemplateTpm2}, {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, DtCompileUefi, TemplateUefi}, {ACPI_SIG_VRTC, AcpiDmTableInfoVrtc, AcpiDmDumpVrtc, DtCompileVrtc, TemplateVrtc}, {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet}, @@ -917,6 +943,7 @@ AcpiDmDumpTable ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -948,6 +975,7 @@ AcpiDmDumpTable ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: + case ACPI_DMT_TPM2: ByteLength = 4; break; @@ -1583,6 +1611,20 @@ AcpiDmDumpTable ( CurrentOffset, NULL); break; + case ACPI_DMT_SDEV: + + /* SDEV subtable types */ + + Temp8 = *Target; + if (Temp8 > ACPI_SDEV_TYPE_RESERVED) + { + Temp8 = ACPI_SDEV_TYPE_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmSdevSubnames[Temp8]); + break; + case ACPI_DMT_SRAT: /* SRAT subtable types */ @@ -1597,6 +1639,21 @@ AcpiDmDumpTable ( AcpiDmSratSubnames[Temp8]); break; + case ACPI_DMT_TPM2: + + /* TPM2 Start Method types */ + + Temp8 = *Target; + if (Temp8 > ACPI_TPM2_RESERVED) + { + Temp8 = ACPI_TPM2_RESERVED; + } + + AcpiOsPrintf (UINT8_FORMAT, *Target, + AcpiDmTpm2Subnames[Temp8]); + break; + + case ACPI_DMT_FADTPM: /* FADT Preferred PM Profile names */ diff --git a/sys/contrib/dev/acpica/common/dmtables.c b/sys/contrib/dev/acpica/common/dmtables.c index f1e72ca69d5..2fe26b33032 100644 --- a/sys/contrib/dev/acpica/common/dmtables.c +++ b/sys/contrib/dev/acpica/common/dmtables.c @@ -314,7 +314,7 @@ AdCreateTableHeader ( /* * Print comments that come before this definition block. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_PRINT_ONE_COMMENT(AcpiGbl_ParseOpRoot,AML_COMMENT_STANDARD, NULL, 0); } @@ -517,7 +517,7 @@ AdParseTable ( } #ifdef ACPI_ASL_COMPILER - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_ParseOpRoot->Common.CvFilename = AcpiGbl_FileTreeRoot->Filename; } diff --git a/sys/contrib/dev/acpica/common/dmtbdump.c b/sys/contrib/dev/acpica/common/dmtbdump.c index 5510e36d196..297455dd5f3 100644 --- a/sys/contrib/dev/acpica/common/dmtbdump.c +++ b/sys/contrib/dev/acpica/common/dmtbdump.c @@ -623,7 +623,7 @@ AcpiDmDumpAsf ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); - ACPI_ASF_INFO *SubTable; + ACPI_ASF_INFO *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_DMTABLE_INFO *DataInfoTable = NULL; UINT8 *DataTable = NULL; @@ -636,13 +636,13 @@ AcpiDmDumpAsf ( /* No main table, only subtables */ - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Header.Length, AcpiDmTableInfoAsfHdr); if (ACPI_FAILURE (Status)) { return; @@ -650,7 +650,7 @@ AcpiDmDumpAsf ( /* The actual type is the lower 7 bits of Type */ - Type = (UINT8) (SubTable->Header.Type & 0x7F); + Type = (UINT8) (Subtable->Header.Type & 0x7F); switch (Type) { @@ -663,9 +663,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf1; DataInfoTable = AcpiDmTableInfoAsf1a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->Alerts; - DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, SubTable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ALERT)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->Alerts; + DataLength = ACPI_CAST_PTR (ACPI_ASF_ALERT, Subtable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_ALERT); break; @@ -673,9 +673,9 @@ AcpiDmDumpAsf ( InfoTable = AcpiDmTableInfoAsf2; DataInfoTable = AcpiDmTableInfoAsf2a; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE)); - DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->Controls; - DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, SubTable)->DataLength; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_REMOTE)); + DataCount = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->Controls; + DataLength = ACPI_CAST_PTR (ACPI_ASF_REMOTE, Subtable)->DataLength; DataOffset = Offset + sizeof (ACPI_ASF_REMOTE); break; @@ -687,20 +687,20 @@ AcpiDmDumpAsf ( case ACPI_ASF_TYPE_ADDRESS: InfoTable = AcpiDmTableInfoAsf4; - DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS)); - DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, SubTable)->Devices; + DataTable = ACPI_ADD_PTR (UINT8, Subtable, sizeof (ACPI_ASF_ADDRESS)); + DataLength = ACPI_CAST_PTR (ACPI_ASF_ADDRESS, Subtable)->Devices; DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS); break; default: AcpiOsPrintf ("\n**** Unknown ASF subtable type 0x%X\n", - SubTable->Header.Type); + Subtable->Header.Type); return; } - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Header.Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -762,15 +762,15 @@ AcpiDmDumpAsf ( /* Point to next subtable */ - if (!SubTable->Header.Length) + if (!Subtable->Header.Length) { AcpiOsPrintf ("Invalid zero subtable header length\n"); return; } - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, - SubTable->Header.Length); + Offset += Subtable->Header.Length; + Subtable = ACPI_ADD_PTR (ACPI_ASF_INFO, Subtable, + Subtable->Header.Length); } } @@ -793,7 +793,7 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CPEP_POLLING *SubTable; + ACPI_CPEP_POLLING *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -808,12 +808,12 @@ AcpiDmDumpCpep ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Header.Length, AcpiDmTableInfoCpep0); if (ACPI_FAILURE (Status)) { return; @@ -821,9 +821,9 @@ AcpiDmDumpCpep ( /* Point to next subtable */ - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, - SubTable->Header.Length); + Offset += Subtable->Header.Length; + Subtable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Subtable, + Subtable->Header.Length); } } @@ -846,9 +846,9 @@ AcpiDmDumpCsrt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_CSRT_GROUP *SubTable; + ACPI_CSRT_GROUP *Subtable; ACPI_CSRT_SHARED_INFO *SharedInfoTable; - ACPI_CSRT_DESCRIPTOR *SubSubTable; + ACPI_CSRT_DESCRIPTOR *SubSubtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CSRT); UINT32 SubOffset; @@ -860,14 +860,14 @@ AcpiDmDumpCsrt ( /* Subtables (Resource Groups) */ - SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Table, Offset); while (Offset < Table->Length) { /* Resource group subtable */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoCsrt0); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoCsrt0); if (ACPI_FAILURE (Status)) { return; @@ -887,19 +887,19 @@ AcpiDmDumpCsrt ( return; } - SubOffset += SubTable->SharedInfoLength; + SubOffset += Subtable->SharedInfoLength; /* Sub-Subtables (Resource Descriptors) */ - SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, Table, Offset + SubOffset); - while ((SubOffset < SubTable->Length) && + while ((SubOffset < Subtable->Length) && ((Offset + SubOffset) < Table->Length)) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubTable, - SubSubTable->Length, AcpiDmTableInfoCsrt2); + Status = AcpiDmDumpTable (Length, Offset + SubOffset, SubSubtable, + SubSubtable->Length, AcpiDmTableInfoCsrt2); if (ACPI_FAILURE (Status)) { return; @@ -909,7 +909,7 @@ AcpiDmDumpCsrt ( /* Resource-specific info buffer */ - InfoLength = SubSubTable->Length - SubSubOffset; + InfoLength = SubSubtable->Length - SubSubOffset; if (InfoLength) { Status = AcpiDmDumpTable (Length, @@ -924,16 +924,16 @@ AcpiDmDumpCsrt ( /* Point to next sub-subtable */ - SubOffset += SubSubTable->Length; - SubSubTable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubTable, - SubSubTable->Length); + SubOffset += SubSubtable->Length; + SubSubtable = ACPI_ADD_PTR (ACPI_CSRT_DESCRIPTOR, SubSubtable, + SubSubtable->Length); } /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_CSRT_GROUP, Subtable, + Subtable->Length); } } @@ -956,7 +956,7 @@ AcpiDmDumpDbg2 ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DBG2_DEVICE *SubTable; + ACPI_DBG2_DEVICE *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DBG2); UINT32 i; @@ -975,12 +975,12 @@ AcpiDmDumpDbg2 ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDbg2Device); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoDbg2Device); if (ACPI_FAILURE (Status)) { return; @@ -988,15 +988,15 @@ AcpiDmDumpDbg2 ( /* Dump the BaseAddress array */ - for (i = 0; i < SubTable->RegisterCount; i++) + for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = SubTable->BaseAddressOffset + + ArrayOffset = Subtable->BaseAddressOffset + (sizeof (ACPI_GENERIC_ADDRESS) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Addr); + Subtable->Length, AcpiDmTableInfoDbg2Addr); if (ACPI_FAILURE (Status)) { return; @@ -1005,15 +1005,15 @@ AcpiDmDumpDbg2 ( /* Dump the AddressSize array */ - for (i = 0; i < SubTable->RegisterCount; i++) + for (i = 0; i < Subtable->RegisterCount; i++) { - ArrayOffset = SubTable->AddressSizeOffset + + ArrayOffset = Subtable->AddressSizeOffset + (sizeof (UINT32) * i); AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Size); + Subtable->Length, AcpiDmTableInfoDbg2Size); if (ACPI_FAILURE (Status)) { return; @@ -1023,12 +1023,12 @@ AcpiDmDumpDbg2 ( /* Dump the Namestring (required) */ AcpiOsPrintf ("\n"); - ArrayOffset = SubTable->NamepathOffset; + ArrayOffset = Subtable->NamepathOffset; AbsoluteOffset = Offset + ArrayOffset; - Array = (UINT8 *) SubTable + ArrayOffset; + Array = (UINT8 *) Subtable + ArrayOffset; Status = AcpiDmDumpTable (Length, AbsoluteOffset, Array, - SubTable->Length, AcpiDmTableInfoDbg2Name); + Subtable->Length, AcpiDmTableInfoDbg2Name); if (ACPI_FAILURE (Status)) { return; @@ -1036,10 +1036,10 @@ AcpiDmDumpDbg2 ( /* Dump the OemData (optional) */ - if (SubTable->OemDataOffset) + if (Subtable->OemDataOffset) { - Status = AcpiDmDumpTable (Length, Offset + SubTable->OemDataOffset, - Table, SubTable->OemDataLength, + Status = AcpiDmDumpTable (Length, Offset + Subtable->OemDataOffset, + Table, Subtable->OemDataLength, AcpiDmTableInfoDbg2OemData); if (ACPI_FAILURE (Status)) { @@ -1049,9 +1049,9 @@ AcpiDmDumpDbg2 ( /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_DBG2_DEVICE, Subtable, + Subtable->Length); } } @@ -1074,7 +1074,7 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_DMAR_HEADER *SubTable; + ACPI_DMAR_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); ACPI_DMTABLE_INFO *InfoTable; @@ -1094,14 +1094,14 @@ AcpiDmDumpDmar ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoDmarHdr); if (ACPI_FAILURE (Status)) { return; @@ -1109,7 +1109,7 @@ AcpiDmDumpDmar ( AcpiOsPrintf ("\n"); - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_DMAR_TYPE_HARDWARE_UNIT: @@ -1144,12 +1144,12 @@ AcpiDmDumpDmar ( default: AcpiOsPrintf ("\n**** Unknown DMAR subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1158,16 +1158,16 @@ AcpiDmDumpDmar ( /* * Dump the optional device scope entries */ - if ((SubTable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || - (SubTable->Type == ACPI_DMAR_TYPE_NAMESPACE)) + if ((Subtable->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) || + (Subtable->Type == ACPI_DMAR_TYPE_NAMESPACE)) { /* These types do not support device scopes */ goto NextSubtable; } - ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset); - while (ScopeOffset < SubTable->Length) + ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, Subtable, ScopeOffset); + while (ScopeOffset < Subtable->Length) { AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, @@ -1208,9 +1208,9 @@ AcpiDmDumpDmar ( NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Subtable, + Subtable->Length); } } @@ -1343,7 +1343,7 @@ AcpiDmDumpEinj ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; + ACPI_WHEA_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_EINJ); @@ -1358,11 +1358,11 @@ AcpiDmDumpEinj ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, + Status = AcpiDmDumpTable (Length, Offset, Subtable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoEinj0); if (ACPI_FAILURE (Status)) { @@ -1372,7 +1372,7 @@ AcpiDmDumpEinj ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1396,7 +1396,7 @@ AcpiDmDumpErst ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_WHEA_HEADER *SubTable; + ACPI_WHEA_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_ERST); @@ -1411,11 +1411,11 @@ AcpiDmDumpErst ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, + Status = AcpiDmDumpTable (Length, Offset, Subtable, sizeof (ACPI_WHEA_HEADER), AcpiDmTableInfoErst0); if (ACPI_FAILURE (Status)) { @@ -1425,7 +1425,7 @@ AcpiDmDumpErst ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_WHEA_HEADER); - SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Subtable, sizeof (ACPI_WHEA_HEADER)); } } @@ -1449,7 +1449,7 @@ AcpiDmDumpFpdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_FPDT_HEADER *SubTable; + ACPI_FPDT_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_FPDT); ACPI_DMTABLE_INFO *InfoTable; @@ -1459,20 +1459,20 @@ AcpiDmDumpFpdt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoFpdtHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoFpdtHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_FPDT_TYPE_BOOT: @@ -1487,31 +1487,31 @@ AcpiDmDumpFpdt ( default: AcpiOsPrintf ("\n**** Unknown FPDT subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, + Subtable->Length); } } @@ -1534,11 +1534,11 @@ AcpiDmDumpGtdt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_GTDT_HEADER *SubTable; + ACPI_GTDT_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_GTDT); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; + UINT32 SubtableLength; UINT32 GtCount; ACPI_GTDT_TIMER_ENTRY *GtxTable; @@ -1553,34 +1553,34 @@ AcpiDmDumpGtdt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoGtdtHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoGtdtHdr); if (ACPI_FAILURE (Status)) { return; } GtCount = 0; - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_GTDT_TYPE_TIMER_BLOCK: - SubTableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); + SubtableLength = sizeof (ACPI_GTDT_TIMER_BLOCK); GtCount = (ACPI_CAST_PTR (ACPI_GTDT_TIMER_BLOCK, - SubTable))->TimerCount; + Subtable))->TimerCount; InfoTable = AcpiDmTableInfoGtdt0; break; case ACPI_GTDT_TYPE_WATCHDOG: - SubTableLength = sizeof (ACPI_GTDT_WATCHDOG); + SubtableLength = sizeof (ACPI_GTDT_WATCHDOG); InfoTable = AcpiDmTableInfoGtdt1; break; @@ -1590,12 +1590,12 @@ AcpiDmDumpGtdt ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown GTDT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1603,15 +1603,15 @@ AcpiDmDumpGtdt ( /* Point to end of current subtable (each subtable above is of fixed length) */ - Offset += SubTableLength; + Offset += SubtableLength; /* If there are any Gt Timer Blocks from above, dump them now */ if (GtCount) { GtxTable = ACPI_ADD_PTR ( - ACPI_GTDT_TIMER_ENTRY, SubTable, SubTableLength); - SubTableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); + ACPI_GTDT_TIMER_ENTRY, Subtable, SubtableLength); + SubtableLength += GtCount * sizeof (ACPI_GTDT_TIMER_ENTRY); while (GtCount) { @@ -1630,7 +1630,7 @@ AcpiDmDumpGtdt ( /* Point to next subtable */ - SubTable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, SubTable, SubTableLength); + Subtable = ACPI_ADD_PTR (ACPI_GTDT_HEADER, Subtable, SubtableLength); } } @@ -1653,11 +1653,11 @@ AcpiDmDumpHest ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_HEST_HEADER *SubTable; + ACPI_HEST_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_HEST); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; + UINT32 SubtableLength; UINT32 BankCount; ACPI_HEST_IA_ERROR_BANK *BankTable; @@ -1672,70 +1672,70 @@ AcpiDmDumpHest ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); while (Offset < Table->Length) { BankCount = 0; - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_HEST_TYPE_IA32_CHECK: InfoTable = AcpiDmTableInfoHest0; - SubTableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); + SubtableLength = sizeof (ACPI_HEST_IA_MACHINE_CHECK); BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_MACHINE_CHECK, - SubTable))->NumHardwareBanks; + Subtable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK: InfoTable = AcpiDmTableInfoHest1; - SubTableLength = sizeof (ACPI_HEST_IA_CORRECTED); + SubtableLength = sizeof (ACPI_HEST_IA_CORRECTED); BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_CORRECTED, - SubTable))->NumHardwareBanks; + Subtable))->NumHardwareBanks; break; case ACPI_HEST_TYPE_IA32_NMI: InfoTable = AcpiDmTableInfoHest2; - SubTableLength = sizeof (ACPI_HEST_IA_NMI); + SubtableLength = sizeof (ACPI_HEST_IA_NMI); break; case ACPI_HEST_TYPE_AER_ROOT_PORT: InfoTable = AcpiDmTableInfoHest6; - SubTableLength = sizeof (ACPI_HEST_AER_ROOT); + SubtableLength = sizeof (ACPI_HEST_AER_ROOT); break; case ACPI_HEST_TYPE_AER_ENDPOINT: InfoTable = AcpiDmTableInfoHest7; - SubTableLength = sizeof (ACPI_HEST_AER); + SubtableLength = sizeof (ACPI_HEST_AER); break; case ACPI_HEST_TYPE_AER_BRIDGE: InfoTable = AcpiDmTableInfoHest8; - SubTableLength = sizeof (ACPI_HEST_AER_BRIDGE); + SubtableLength = sizeof (ACPI_HEST_AER_BRIDGE); break; case ACPI_HEST_TYPE_GENERIC_ERROR: InfoTable = AcpiDmTableInfoHest9; - SubTableLength = sizeof (ACPI_HEST_GENERIC); + SubtableLength = sizeof (ACPI_HEST_GENERIC); break; case ACPI_HEST_TYPE_GENERIC_ERROR_V2: InfoTable = AcpiDmTableInfoHest10; - SubTableLength = sizeof (ACPI_HEST_GENERIC_V2); + SubtableLength = sizeof (ACPI_HEST_GENERIC_V2); break; case ACPI_HEST_TYPE_IA32_DEFERRED_CHECK: InfoTable = AcpiDmTableInfoHest11; - SubTableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK); + SubtableLength = sizeof (ACPI_HEST_IA_DEFERRED_CHECK); BankCount = (ACPI_CAST_PTR (ACPI_HEST_IA_DEFERRED_CHECK, - SubTable))->NumHardwareBanks; + Subtable))->NumHardwareBanks; break; default: @@ -1743,13 +1743,13 @@ AcpiDmDumpHest ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown HEST subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); return; } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTableLength, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + SubtableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -1757,15 +1757,15 @@ AcpiDmDumpHest ( /* Point to end of current subtable (each subtable above is of fixed length) */ - Offset += SubTableLength; + Offset += SubtableLength; /* If there are any (fixed-length) Error Banks from above, dump them now */ if (BankCount) { - BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, SubTable, - SubTableLength); - SubTableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); + BankTable = ACPI_ADD_PTR (ACPI_HEST_IA_ERROR_BANK, Subtable, + SubtableLength); + SubtableLength += BankCount * sizeof (ACPI_HEST_IA_ERROR_BANK); while (BankCount) { @@ -1785,7 +1785,7 @@ AcpiDmDumpHest ( /* Point to next subtable */ - SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); + Subtable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Subtable, SubtableLength); } } @@ -1811,7 +1811,7 @@ AcpiDmDumpHmat ( ACPI_HMAT_LOCALITY *HmatLocality; ACPI_HMAT_CACHE *HmatCache; UINT32 Offset; - UINT32 SubTableOffset; + UINT32 SubtableOffset; UINT32 Length; ACPI_DMTABLE_INFO *InfoTable; UINT32 i, j; @@ -1829,7 +1829,7 @@ AcpiDmDumpHmat ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - SubTableOffset = 0; + SubtableOffset = 0; /* Dump HMAT structure header */ @@ -1873,7 +1873,7 @@ AcpiDmDumpHmat ( /* Attempt to continue */ - goto NextSubTable; + goto NextSubtable; } /* Dump HMAT structure body */ @@ -1897,11 +1897,11 @@ AcpiDmDumpHmat ( case ACPI_HMAT_TYPE_LOCALITY: HmatLocality = ACPI_CAST_PTR (ACPI_HMAT_LOCALITY, HmatStruct); - SubTableOffset = sizeof (ACPI_HMAT_LOCALITY); + SubtableOffset = sizeof (ACPI_HMAT_LOCALITY); /* Dump initiator proximity domains */ - if ((UINT32)(HmatStruct->Length - SubTableOffset) < + if ((UINT32)(HmatStruct->Length - SubtableOffset) < (UINT32)(HmatLocality->NumberOfInitiatorPDs * 4)) { AcpiOsPrintf ("Invalid initiator proximity domain number\n"); @@ -1909,15 +1909,15 @@ AcpiDmDumpHmat ( } for (i = 0; i < HmatLocality->NumberOfInitiatorPDs; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, - ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); - SubTableOffset += 4; + SubtableOffset += 4; } /* Dump target proximity domains */ - if ((UINT32)(HmatStruct->Length - SubTableOffset) < + if ((UINT32)(HmatStruct->Length - SubtableOffset) < (UINT32)(HmatLocality->NumberOfTargetPDs * 4)) { AcpiOsPrintf ("Invalid target proximity domain number\n"); @@ -1925,15 +1925,15 @@ AcpiDmDumpHmat ( } for (i = 0; i < HmatLocality->NumberOfTargetPDs; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, - ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); - SubTableOffset += 4; + SubtableOffset += 4; } /* Dump latency/bandwidth entris */ - if ((UINT32)(HmatStruct->Length - SubTableOffset) < + if ((UINT32)(HmatStruct->Length - SubtableOffset) < (UINT32)(HmatLocality->NumberOfInitiatorPDs * HmatLocality->NumberOfTargetPDs * 2)) { @@ -1944,10 +1944,10 @@ AcpiDmDumpHmat ( { for (j = 0; j < HmatLocality->NumberOfTargetPDs; j++) { - Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, - ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); - SubTableOffset += 2; + SubtableOffset += 2; } } break; @@ -1955,11 +1955,11 @@ AcpiDmDumpHmat ( case ACPI_HMAT_TYPE_CACHE: HmatCache = ACPI_CAST_PTR (ACPI_HMAT_CACHE, HmatStruct); - SubTableOffset = sizeof (ACPI_HMAT_CACHE); + SubtableOffset = sizeof (ACPI_HMAT_CACHE); /* Dump SMBIOS handles */ - if ((UINT32)(HmatStruct->Length - SubTableOffset) < + if ((UINT32)(HmatStruct->Length - SubtableOffset) < (UINT32)(HmatCache->NumberOfSMBIOSHandles * 2)) { AcpiOsPrintf ("Invalid SMBIOS handle number\n"); @@ -1967,10 +1967,10 @@ AcpiDmDumpHmat ( } for (i = 0; i < HmatCache->NumberOfSMBIOSHandles; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, - ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubTableOffset), + Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, + ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); - SubTableOffset += 2; + SubtableOffset += 2; } break; @@ -1979,7 +1979,7 @@ AcpiDmDumpHmat ( break; } -NextSubTable: +NextSubtable: /* Point to next HMAT structure subtable */ Offset += (HmatStruct->Length); @@ -2104,7 +2104,7 @@ AcpiDmDumpIort ( AcpiOsPrintf ("Invalid zero length IORT node\n"); return; } - goto NextSubTable; + goto NextSubtable; } /* Dump the node subtable header */ @@ -2227,7 +2227,7 @@ AcpiDmDumpIort ( NodeOffset += Length; } -NextSubTable: +NextSubtable: /* Point to next node subtable */ Offset += IortNode->Length; @@ -2260,7 +2260,7 @@ AcpiDmDumpIvrs ( UINT32 EntryLength; UINT32 EntryType; ACPI_IVRS_DE_HEADER *DeviceEntry; - ACPI_IVRS_HEADER *SubTable; + ACPI_IVRS_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; @@ -2274,20 +2274,20 @@ AcpiDmDumpIvrs ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoIvrsHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoIvrsHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_IVRS_TYPE_HARDWARE: @@ -2304,23 +2304,23 @@ AcpiDmDumpIvrs ( default: AcpiOsPrintf ("\n**** Unknown IVRS subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } /* Dump the subtable */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2328,13 +2328,13 @@ AcpiDmDumpIvrs ( /* The hardware subtable can contain multiple device entries */ - if (SubTable->Type == ACPI_IVRS_TYPE_HARDWARE) + if (Subtable->Type == ACPI_IVRS_TYPE_HARDWARE) { EntryOffset = Offset + sizeof (ACPI_IVRS_HARDWARE); - DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, SubTable, + DeviceEntry = ACPI_ADD_PTR (ACPI_IVRS_DE_HEADER, Subtable, sizeof (ACPI_IVRS_HARDWARE)); - while (EntryOffset < (Offset + SubTable->Length)) + while (EntryOffset < (Offset + Subtable->Length)) { AcpiOsPrintf ("\n"); /* @@ -2409,11 +2409,11 @@ AcpiDmDumpIvrs ( } } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, SubTable, SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_IVRS_HEADER, Subtable, Subtable->Length); } } @@ -2438,33 +2438,33 @@ AcpiDmDumpLpit ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_LPIT_HEADER *SubTable; + ACPI_LPIT_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_LPIT); ACPI_DMTABLE_INFO *InfoTable; - UINT32 SubTableLength; + UINT32 SubtableLength; /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ - Status = AcpiDmDumpTable (Length, Offset, SubTable, + Status = AcpiDmDumpTable (Length, Offset, Subtable, sizeof (ACPI_LPIT_HEADER), AcpiDmTableInfoLpitHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_LPIT_TYPE_NATIVE_CSTATE: InfoTable = AcpiDmTableInfoLpit0; - SubTableLength = sizeof (ACPI_LPIT_NATIVE); + SubtableLength = sizeof (ACPI_LPIT_NATIVE); break; default: @@ -2472,12 +2472,12 @@ AcpiDmDumpLpit ( /* Cannot continue on unknown type - no length */ AcpiOsPrintf ("\n**** Unknown LPIT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); return; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTableLength, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + SubtableLength, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -2487,8 +2487,8 @@ AcpiDmDumpLpit ( /* Point to next subtable */ - Offset += SubTableLength; - SubTable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, SubTable, SubTableLength); + Offset += SubtableLength; + Subtable = ACPI_ADD_PTR (ACPI_LPIT_HEADER, Subtable, SubtableLength); } } @@ -2511,7 +2511,7 @@ AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_SUBTABLE_HEADER *SubTable; + ACPI_SUBTABLE_HEADER *Subtable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_MADT); ACPI_DMTABLE_INFO *InfoTable; @@ -2527,20 +2527,20 @@ AcpiDmDumpMadt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoMadtHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoMadtHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_MADT_TYPE_LOCAL_APIC: @@ -2625,32 +2625,32 @@ AcpiDmDumpMadt ( default: AcpiOsPrintf ("\n**** Unknown MADT subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, + Subtable->Length); } } @@ -2673,7 +2673,7 @@ AcpiDmDumpMcfg ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MCFG); - ACPI_MCFG_ALLOCATION *SubTable; + ACPI_MCFG_ALLOCATION *Subtable; /* Main table */ @@ -2686,7 +2686,7 @@ AcpiDmDumpMcfg ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset); while (Offset < Table->Length) { if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) @@ -2697,7 +2697,7 @@ AcpiDmDumpMcfg ( } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, sizeof (ACPI_MCFG_ALLOCATION), AcpiDmTableInfoMcfg0); if (ACPI_FAILURE (Status)) { @@ -2707,7 +2707,7 @@ AcpiDmDumpMcfg ( /* Point to next subtable (each subtable is of fixed length) */ Offset += sizeof (ACPI_MCFG_ALLOCATION); - SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Subtable, sizeof (ACPI_MCFG_ALLOCATION)); } } @@ -2731,11 +2731,11 @@ AcpiDmDumpMpst ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MPST); - ACPI_MPST_POWER_NODE *SubTable0; - ACPI_MPST_POWER_STATE *SubTable0A; - ACPI_MPST_COMPONENT *SubTable0B; - ACPI_MPST_DATA_HDR *SubTable1; - ACPI_MPST_POWER_DATA *SubTable2; + ACPI_MPST_POWER_NODE *Subtable0; + ACPI_MPST_POWER_STATE *Subtable0A; + ACPI_MPST_COMPONENT *Subtable0B; + ACPI_MPST_DATA_HDR *Subtable1; + ACPI_MPST_POWER_DATA *Subtable2; UINT16 SubtableCount; UINT32 PowerStateCount; UINT32 ComponentCount; @@ -2752,12 +2752,12 @@ AcpiDmDumpMpst ( /* Subtable: Memory Power Node(s) */ SubtableCount = (ACPI_CAST_PTR (ACPI_TABLE_MPST, Table))->PowerNodeCount; - SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); + Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Table, Offset); while ((Offset < Table->Length) && SubtableCount) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0, sizeof (ACPI_MPST_POWER_NODE), AcpiDmTableInfoMpst0); if (ACPI_FAILURE (Status)) { @@ -2766,33 +2766,33 @@ AcpiDmDumpMpst ( /* Extract the sub-subtable counts */ - PowerStateCount = SubTable0->NumPowerStates; - ComponentCount = SubTable0->NumPhysicalComponents; + PowerStateCount = Subtable0->NumPowerStates; + ComponentCount = Subtable0->NumPhysicalComponents; Offset += sizeof (ACPI_MPST_POWER_NODE); /* Sub-subtables - Memory Power State Structure(s) */ - SubTable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, SubTable0, + Subtable0A = ACPI_ADD_PTR (ACPI_MPST_POWER_STATE, Subtable0, sizeof (ACPI_MPST_POWER_NODE)); while (PowerStateCount) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0A, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0A, sizeof (ACPI_MPST_POWER_STATE), AcpiDmTableInfoMpst0A); if (ACPI_FAILURE (Status)) { return; } - SubTable0A++; + Subtable0A++; PowerStateCount--; Offset += sizeof (ACPI_MPST_POWER_STATE); } /* Sub-subtables - Physical Component ID Structure(s) */ - SubTable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, SubTable0A); + Subtable0B = ACPI_CAST_PTR (ACPI_MPST_COMPONENT, Subtable0A); if (ComponentCount) { @@ -2801,14 +2801,14 @@ AcpiDmDumpMpst ( while (ComponentCount) { - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable0B, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable0B, sizeof (ACPI_MPST_COMPONENT), AcpiDmTableInfoMpst0B); if (ACPI_FAILURE (Status)) { return; } - SubTable0B++; + Subtable0B++; ComponentCount--; Offset += sizeof (ACPI_MPST_COMPONENT); } @@ -2816,42 +2816,42 @@ AcpiDmDumpMpst ( /* Point to next Memory Power Node subtable */ SubtableCount--; - SubTable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, SubTable0, + Subtable0 = ACPI_ADD_PTR (ACPI_MPST_POWER_NODE, Subtable0, sizeof (ACPI_MPST_POWER_NODE) + - (sizeof (ACPI_MPST_POWER_STATE) * SubTable0->NumPowerStates) + - (sizeof (ACPI_MPST_COMPONENT) * SubTable0->NumPhysicalComponents)); + (sizeof (ACPI_MPST_POWER_STATE) * Subtable0->NumPowerStates) + + (sizeof (ACPI_MPST_COMPONENT) * Subtable0->NumPhysicalComponents)); } /* Subtable: Count of Memory Power State Characteristic structures */ AcpiOsPrintf ("\n"); - SubTable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, SubTable0); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable1, + Subtable1 = ACPI_CAST_PTR (ACPI_MPST_DATA_HDR, Subtable0); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable1, sizeof (ACPI_MPST_DATA_HDR), AcpiDmTableInfoMpst1); if (ACPI_FAILURE (Status)) { return; } - SubtableCount = SubTable1->CharacteristicsCount; + SubtableCount = Subtable1->CharacteristicsCount; Offset += sizeof (ACPI_MPST_DATA_HDR); /* Subtable: Memory Power State Characteristics structure(s) */ - SubTable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, SubTable1, + Subtable2 = ACPI_ADD_PTR (ACPI_MPST_POWER_DATA, Subtable1, sizeof (ACPI_MPST_DATA_HDR)); while ((Offset < Table->Length) && SubtableCount) { AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable2, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable2, sizeof (ACPI_MPST_POWER_DATA), AcpiDmTableInfoMpst2); if (ACPI_FAILURE (Status)) { return; } - SubTable2++; + Subtable2++; SubtableCount--; Offset += sizeof (ACPI_MPST_POWER_DATA); } @@ -2876,7 +2876,7 @@ AcpiDmDumpMsct ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MSCT); - ACPI_MSCT_PROXIMITY *SubTable; + ACPI_MSCT_PROXIMITY *Subtable; /* Main table */ @@ -2889,13 +2889,13 @@ AcpiDmDumpMsct ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, sizeof (ACPI_MSCT_PROXIMITY), AcpiDmTableInfoMsct0); if (ACPI_FAILURE (Status)) { @@ -2905,7 +2905,7 @@ AcpiDmDumpMsct ( /* Point to next subtable */ Offset += sizeof (ACPI_MSCT_PROXIMITY); - SubTable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_MSCT_PROXIMITY, Subtable, sizeof (ACPI_MSCT_PROXIMITY)); } } @@ -2929,7 +2929,7 @@ AcpiDmDumpMtmr ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_MTMR); - ACPI_MTMR_ENTRY *SubTable; + ACPI_MTMR_ENTRY *Subtable; /* Main table */ @@ -2942,13 +2942,13 @@ AcpiDmDumpMtmr ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, sizeof (ACPI_MTMR_ENTRY), AcpiDmTableInfoMtmr0); if (ACPI_FAILURE (Status)) { @@ -2958,7 +2958,7 @@ AcpiDmDumpMtmr ( /* Point to next subtable */ Offset += sizeof (ACPI_MTMR_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_MTMR_ENTRY, Subtable, sizeof (ACPI_MTMR_ENTRY)); } } @@ -2984,7 +2984,7 @@ AcpiDmDumpNfit ( UINT32 Offset = sizeof (ACPI_TABLE_NFIT); UINT32 FieldOffset = 0; UINT32 Length; - ACPI_NFIT_HEADER *SubTable; + ACPI_NFIT_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_NFIT_INTERLEAVE *Interleave = NULL; ACPI_NFIT_SMBIOS *SmbiosInfo = NULL; @@ -3002,20 +3002,20 @@ AcpiDmDumpNfit ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Table, Offset); while (Offset < Table->Length) { /* NFIT subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoNfitHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoNfitHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_NFIT_TYPE_SYSTEM_ADDRESS: @@ -3032,13 +3032,13 @@ AcpiDmDumpNfit ( /* Has a variable number of 32-bit values at the end */ InfoTable = AcpiDmTableInfoNfit2; - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, SubTable); + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); break; case ACPI_NFIT_TYPE_SMBIOS: - SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, SubTable); + SmbiosInfo = ACPI_CAST_PTR (ACPI_NFIT_SMBIOS, Subtable); InfoTable = AcpiDmTableInfoNfit3; break; @@ -3057,27 +3057,32 @@ AcpiDmDumpNfit ( /* Has a variable number of 64-bit addresses at the end */ InfoTable = AcpiDmTableInfoNfit6; - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, SubTable); + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); break; + case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */ + + InfoTable = AcpiDmTableInfoNfit7; + break; + default: AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; @@ -3085,7 +3090,7 @@ AcpiDmDumpNfit ( /* Per-subtable variable-length fields */ - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_NFIT_TYPE_INTERLEAVE: @@ -3105,7 +3110,7 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_SMBIOS: - Length = SubTable->Length - + Length = Subtable->Length - sizeof (ACPI_NFIT_SMBIOS) + sizeof (UINT8); if (Length) @@ -3142,11 +3147,11 @@ AcpiDmDumpNfit ( break; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, SubTable, SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_NFIT_HEADER, Subtable, Subtable->Length); } } @@ -3169,7 +3174,7 @@ AcpiDmDumpPcct ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_PCCT_SUBSPACE *SubTable; + ACPI_PCCT_SUBSPACE *Subtable; ACPI_DMTABLE_INFO *InfoTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_PCCT); @@ -3185,20 +3190,20 @@ AcpiDmDumpPcct ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, AcpiDmTableInfoPcctHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Header.Length, AcpiDmTableInfoPcctHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Header.Type) + switch (Subtable->Header.Type) { case ACPI_PCCT_TYPE_GENERIC_SUBSPACE: @@ -3229,13 +3234,67 @@ AcpiDmDumpPcct ( AcpiOsPrintf ( "\n**** Unexpected or unknown PCCT subtable type 0x%X\n\n", - SubTable->Header.Type); + Subtable->Header.Type); return; } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next subtable */ + + Offset += Subtable->Header.Length; + Subtable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, Subtable, + Subtable->Header.Length); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpPdtt + * + * PARAMETERS: Table - A PDTT table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a Pdtt. This is a variable-length + * table that contains an open-ended number of IDs + * at the end of the table. + * + ******************************************************************************/ + +void +AcpiDmDumpPdtt ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_PDTT_CHANNEL *Subtable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_PDTT); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoPdtt); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtables. Currently there is only one type, but can be multiples */ + + Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + sizeof (ACPI_PDTT_CHANNEL), AcpiDmTableInfoPdtt0); if (ACPI_FAILURE (Status)) { return; @@ -3243,9 +3302,9 @@ AcpiDmDumpPcct ( /* Point to next subtable */ - Offset += SubTable->Header.Length; - SubTable = ACPI_ADD_PTR (ACPI_PCCT_SUBSPACE, SubTable, - SubTable->Header.Length); + Offset += sizeof (ACPI_PDTT_CHANNEL); + Subtable = ACPI_ADD_PTR (ACPI_PDTT_CHANNEL, Subtable, + sizeof (ACPI_PDTT_CHANNEL)); } } @@ -3268,9 +3327,9 @@ AcpiDmDumpPmtt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_PMTT_HEADER *SubTable; - ACPI_PMTT_HEADER *MemSubTable; - ACPI_PMTT_HEADER *DimmSubTable; + ACPI_PMTT_HEADER *Subtable; + ACPI_PMTT_HEADER *MemSubtable; + ACPI_PMTT_HEADER *DimmSubtable; ACPI_PMTT_DOMAIN *DomainArray; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_PMTT); @@ -3290,14 +3349,14 @@ AcpiDmDumpPmtt ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoPmttHdr); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -3305,18 +3364,18 @@ AcpiDmDumpPmtt ( /* Only Socket subtables are expected at this level */ - if (SubTable->Type != ACPI_PMTT_TYPE_SOCKET) + if (Subtable->Type != ACPI_PMTT_TYPE_SOCKET) { AcpiOsPrintf ( "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); return; } /* Dump the fixed-length portion of the subtable */ - Status = AcpiDmDumpTable (Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoPmtt0); + Status = AcpiDmDumpTable (Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoPmtt0); if (ACPI_FAILURE (Status)) { return; @@ -3325,18 +3384,18 @@ AcpiDmDumpPmtt ( /* Walk the memory controller subtables */ MemOffset = sizeof (ACPI_PMTT_SOCKET); - MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, SubTable, + MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, Subtable, sizeof (ACPI_PMTT_SOCKET)); while (((Offset + MemOffset) < Table->Length) && - (MemOffset < SubTable->Length)) + (MemOffset < Subtable->Length)) { /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubTable, - MemSubTable->Length, AcpiDmTableInfoPmttHdr); + Offset + MemOffset, MemSubtable, + MemSubtable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -3344,19 +3403,19 @@ AcpiDmDumpPmtt ( /* Only memory controller subtables are expected at this level */ - if (MemSubTable->Type != ACPI_PMTT_TYPE_CONTROLLER) + if (MemSubtable->Type != ACPI_PMTT_TYPE_CONTROLLER) { AcpiOsPrintf ( "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", - MemSubTable->Type); + MemSubtable->Type); return; } /* Dump the fixed-length portion of the controller subtable */ Status = AcpiDmDumpTable (Length, - Offset + MemOffset, MemSubTable, - MemSubTable->Length, AcpiDmTableInfoPmtt1); + Offset + MemOffset, MemSubtable, + MemSubtable->Length, AcpiDmTableInfoPmtt1); if (ACPI_FAILURE (Status)) { return; @@ -3364,13 +3423,13 @@ AcpiDmDumpPmtt ( /* Walk the variable count of proximity domains */ - DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubTable)->DomainCount; + DomainCount = ((ACPI_PMTT_CONTROLLER *) MemSubtable)->DomainCount; DomainOffset = sizeof (ACPI_PMTT_CONTROLLER); - DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubTable, + DomainArray = ACPI_ADD_PTR (ACPI_PMTT_DOMAIN, MemSubtable, sizeof (ACPI_PMTT_CONTROLLER)); while (((Offset + MemOffset + DomainOffset) < Table->Length) && - ((MemOffset + DomainOffset) < SubTable->Length) && + ((MemOffset + DomainOffset) < Subtable->Length) && DomainCount) { Status = AcpiDmDumpTable (Length, @@ -3395,18 +3454,18 @@ AcpiDmDumpPmtt ( /* Walk the physical component (DIMM) subtables */ DimmOffset = DomainOffset; - DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubTable, + DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, MemSubtable, DomainOffset); while (((Offset + MemOffset + DimmOffset) < Table->Length) && - (DimmOffset < MemSubTable->Length)) + (DimmOffset < MemSubtable->Length)) { /* Common subtable header */ AcpiOsPrintf ("\n"); Status = AcpiDmDumpTable (Length, - Offset + MemOffset + DimmOffset, DimmSubTable, - DimmSubTable->Length, AcpiDmTableInfoPmttHdr); + Offset + MemOffset + DimmOffset, DimmSubtable, + DimmSubtable->Length, AcpiDmTableInfoPmttHdr); if (ACPI_FAILURE (Status)) { return; @@ -3414,19 +3473,19 @@ AcpiDmDumpPmtt ( /* Only DIMM subtables are expected at this level */ - if (DimmSubTable->Type != ACPI_PMTT_TYPE_DIMM) + if (DimmSubtable->Type != ACPI_PMTT_TYPE_DIMM) { AcpiOsPrintf ( "\n**** Unexpected or unknown PMTT subtable type 0x%X\n\n", - DimmSubTable->Type); + DimmSubtable->Type); return; } /* Dump the fixed-length DIMM subtable */ Status = AcpiDmDumpTable (Length, - Offset + MemOffset + DimmOffset, DimmSubTable, - DimmSubTable->Length, AcpiDmTableInfoPmtt2); + Offset + MemOffset + DimmOffset, DimmSubtable, + DimmSubtable->Length, AcpiDmTableInfoPmtt2); if (ACPI_FAILURE (Status)) { return; @@ -3434,23 +3493,23 @@ AcpiDmDumpPmtt ( /* Point to next DIMM subtable */ - DimmOffset += DimmSubTable->Length; - DimmSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, - DimmSubTable, DimmSubTable->Length); + DimmOffset += DimmSubtable->Length; + DimmSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + DimmSubtable, DimmSubtable->Length); } /* Point to next Controller subtable */ - MemOffset += MemSubTable->Length; - MemSubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, - MemSubTable, MemSubTable->Length); + MemOffset += MemSubtable->Length; + MemSubtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + MemSubtable, MemSubtable->Length); } /* Point to next Socket subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, - SubTable, SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_PMTT_HEADER, + Subtable, Subtable->Length); } } @@ -3473,10 +3532,10 @@ AcpiDmDumpPptt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_SUBTABLE_HEADER *SubTable; + ACPI_SUBTABLE_HEADER *Subtable; ACPI_PPTT_PROCESSOR *PpttProcessor; UINT8 Length; - UINT8 SubTableOffset; + UINT8 SubtableOffset; UINT32 Offset = sizeof (ACPI_TABLE_FPDT); ACPI_DMTABLE_INFO *InfoTable; UINT32 i; @@ -3493,20 +3552,20 @@ AcpiDmDumpPptt ( /* Common subtable header */ - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); - if (SubTable->Length < sizeof (ACPI_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); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoPpttHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_PPTT_TYPE_PROCESSOR: @@ -3529,35 +3588,35 @@ AcpiDmDumpPptt ( default: AcpiOsPrintf ("\n**** Unknown PPTT subtable type 0x%X\n\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - goto NextSubTable; + goto NextSubtable; } - if (SubTable->Length < Length) + if (Subtable->Length < Length) { AcpiOsPrintf ("Invalid subtable length\n"); return; } - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } - SubTableOffset = Length; + SubtableOffset = Length; - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_PPTT_TYPE_PROCESSOR: - PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, SubTable); + PpttProcessor = ACPI_CAST_PTR (ACPI_PPTT_PROCESSOR, Subtable); /* Dump SMBIOS handles */ - if ((UINT8)(SubTable->Length - SubTableOffset) < + if ((UINT8)(Subtable->Length - SubtableOffset) < (UINT8)(PpttProcessor->NumberOfPrivResources * 4)) { AcpiOsPrintf ("Invalid private resource number\n"); @@ -3565,10 +3624,10 @@ AcpiDmDumpPptt ( } for (i = 0; i < PpttProcessor->NumberOfPrivResources; i++) { - Status = AcpiDmDumpTable (Table->Length, Offset + SubTableOffset, - ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTableOffset), + Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, + ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); - SubTableOffset += 4; + SubtableOffset += 4; } break; @@ -3577,10 +3636,10 @@ AcpiDmDumpPptt ( break; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; + Offset += Subtable->Length; } } @@ -3603,7 +3662,7 @@ AcpiDmDumpS3pt ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_S3PT); - ACPI_FPDT_HEADER *SubTable; + ACPI_FPDT_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; ACPI_TABLE_S3PT *S3ptTable = ACPI_CAST_PTR (ACPI_TABLE_S3PT, Tables); @@ -3616,20 +3675,20 @@ AcpiDmDumpS3pt ( return 0; } - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, S3ptTable, Offset); while (Offset < S3ptTable->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoS3ptHdr); + Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoS3ptHdr); if (ACPI_FAILURE (Status)) { return 0; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_S3PT_TYPE_RESUME: @@ -3644,37 +3703,204 @@ AcpiDmDumpS3pt ( default: AcpiOsPrintf ("\n**** Unknown S3PT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return 0; } - goto NextSubTable; + goto NextSubtable; } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (S3ptTable->Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (S3ptTable->Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return 0; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, SubTable, SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_FPDT_HEADER, Subtable, Subtable->Length); } return (S3ptTable->Length); } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpSdev + * + * PARAMETERS: Table - A SDEV table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a SDEV. This is a variable-length + * table that contains variable strings and vendor data. + * + ******************************************************************************/ + +void +AcpiDmDumpSdev ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_SDEV_HEADER *Subtable; + ACPI_SDEV_PCIE *Pcie; + ACPI_SDEV_NAMESPACE *Namesp; + ACPI_DMTABLE_INFO *InfoTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_SDEV); + UINT16 PathOffset; + UINT16 PathLength; + UINT16 VendorDataOffset; + UINT16 VendorDataLength; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoSdev); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Subtables */ + + Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* Common subtable header */ + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoSdevHdr); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (Subtable->Type) + { + case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: + + InfoTable = AcpiDmTableInfoSdev0; + break; + + case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: + + InfoTable = AcpiDmTableInfoSdev1; + break; + + default: + goto NextSubtable; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (Subtable->Type) + { + case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: + + /* Dump the PCIe device ID(s) */ + + Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable); + PathOffset = Namesp->DeviceIdOffset; + PathLength = Namesp->DeviceIdLength; + + if (PathLength) + { + Status = AcpiDmDumpTable (Table->Length, 0, + ACPI_ADD_PTR (UINT8, Namesp, PathOffset), + PathLength, AcpiDmTableInfoSdev0a); + if (ACPI_FAILURE (Status)) + { + return; + } + } + + /* Dump the vendor-specific data */ + + VendorDataLength = + Namesp->VendorDataLength; + VendorDataOffset = + Namesp->DeviceIdOffset + Namesp->DeviceIdLength; + + if (VendorDataLength) + { + Status = AcpiDmDumpTable (Table->Length, 0, + ACPI_ADD_PTR (UINT8, Namesp, VendorDataOffset), + VendorDataLength, AcpiDmTableInfoSdev1b); + if (ACPI_FAILURE (Status)) + { + return; + } + } + break; + + case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: + + /* PCI path substructures */ + + Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable); + PathOffset = Pcie->PathOffset; + PathLength = Pcie->PathLength; + + while (PathLength) + { + Status = AcpiDmDumpTable (Table->Length, + PathOffset + Offset, + ACPI_ADD_PTR (UINT8, Pcie, PathOffset), + sizeof (ACPI_SDEV_PCIE_PATH), AcpiDmTableInfoSdev1a); + if (ACPI_FAILURE (Status)) + { + return; + } + + PathOffset += sizeof (ACPI_SDEV_PCIE_PATH); + PathLength -= sizeof (ACPI_SDEV_PCIE_PATH); + } + + /* VendorData */ + + VendorDataLength = Pcie->VendorDataLength; + VendorDataOffset = Pcie->PathOffset + Pcie->PathLength; + + if (VendorDataLength) + { + Status = AcpiDmDumpTable (Table->Length, 0, + ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), + VendorDataLength, AcpiDmTableInfoSdev1b); + } + break; + + default: + goto NextSubtable; + } + +NextSubtable: + /* Point to next subtable */ + + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_SDEV_HEADER, Subtable, + Subtable->Length); + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpSlic @@ -3794,7 +4020,7 @@ AcpiDmDumpSrat ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_SRAT); - ACPI_SUBTABLE_HEADER *SubTable; + ACPI_SUBTABLE_HEADER *Subtable; ACPI_DMTABLE_INFO *InfoTable; @@ -3808,20 +4034,20 @@ AcpiDmDumpSrat ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, AcpiDmTableInfoSratHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, AcpiDmTableInfoSratHdr); if (ACPI_FAILURE (Status)) { return; } - switch (SubTable->Type) + switch (Subtable->Type) { case ACPI_SRAT_TYPE_CPU_AFFINITY: @@ -3850,32 +4076,32 @@ AcpiDmDumpSrat ( default: AcpiOsPrintf ("\n**** Unknown SRAT subtable type 0x%X\n", - SubTable->Type); + Subtable->Type); /* Attempt to continue */ - if (!SubTable->Length) + if (!Subtable->Length) { AcpiOsPrintf ("Invalid zero length subtable\n"); return; } - goto NextSubTable; + goto NextSubtable; } AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, - SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Subtable->Length, InfoTable); if (ACPI_FAILURE (Status)) { return; } -NextSubTable: +NextSubtable: /* Point to next subtable */ - Offset += SubTable->Length; - SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, - SubTable->Length); + Offset += Subtable->Length; + Subtable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, + Subtable->Length); } } @@ -3954,7 +4180,7 @@ AcpiDmDumpTcpa ( UINT32 Offset = sizeof (ACPI_TABLE_TCPA_HDR); ACPI_TABLE_TCPA_HDR *CommonHeader = ACPI_CAST_PTR ( ACPI_TABLE_TCPA_HDR, Table); - ACPI_TABLE_TCPA_HDR *SubTable = ACPI_ADD_PTR ( + ACPI_TABLE_TCPA_HDR *Subtable = ACPI_ADD_PTR ( ACPI_TABLE_TCPA_HDR, Table, Offset); ACPI_STATUS Status; @@ -3976,13 +4202,13 @@ AcpiDmDumpTcpa ( { case ACPI_TCPA_CLIENT_TABLE: - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTcpaClient); break; case ACPI_TCPA_SERVER_TABLE: - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTcpaServer); break; @@ -4001,6 +4227,64 @@ AcpiDmDumpTcpa ( } +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpTpm2 + * + * PARAMETERS: Table - A TPM2 table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a TPM2. + * + ******************************************************************************/ + +void +AcpiDmDumpTpm2 ( + ACPI_TABLE_HEADER *Table) +{ + UINT32 Offset = sizeof (ACPI_TABLE_TPM2); + ACPI_TABLE_TPM2 *CommonHeader = ACPI_CAST_PTR (ACPI_TABLE_TPM2, Table); + ACPI_TPM2_TRAILER *Subtable = ACPI_ADD_PTR (ACPI_TPM2_TRAILER, Table, Offset); + ACPI_TPM2_ARM_SMC *ArmSubtable; + ACPI_STATUS Status; + + + /* Main table */ + + Status = AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoTpm2); + if (ACPI_FAILURE (Status)) + { + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + Table->Length - Offset, AcpiDmTableInfoTpm2a); + if (ACPI_FAILURE (Status)) + { + return; + } + + switch (CommonHeader->StartMethod) + { + case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC: + + ArmSubtable = ACPI_ADD_PTR (ACPI_TPM2_ARM_SMC, Subtable, + sizeof (ACPI_TPM2_TRAILER)); + Offset += sizeof (ACPI_TPM2_TRAILER); + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, + Table->Length - Offset, AcpiDmTableInfoTpm211); + break; + + default: + break; + } +} + + /******************************************************************************* * * FUNCTION: AcpiDmDumpVrtc @@ -4019,7 +4303,7 @@ AcpiDmDumpVrtc ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_VRTC); - ACPI_VRTC_ENTRY *SubTable; + ACPI_VRTC_ENTRY *Subtable; /* Main table */ @@ -4032,13 +4316,13 @@ AcpiDmDumpVrtc ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, sizeof (ACPI_VRTC_ENTRY), AcpiDmTableInfoVrtc0); if (ACPI_FAILURE (Status)) { @@ -4048,7 +4332,7 @@ AcpiDmDumpVrtc ( /* Point to next subtable */ Offset += sizeof (ACPI_VRTC_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_VRTC_ENTRY, Subtable, sizeof (ACPI_VRTC_ENTRY)); } } @@ -4072,7 +4356,7 @@ AcpiDmDumpWdat ( { ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_WDAT); - ACPI_WDAT_ENTRY *SubTable; + ACPI_WDAT_ENTRY *Subtable; /* Main table */ @@ -4085,13 +4369,13 @@ AcpiDmDumpWdat ( /* Subtables */ - SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); + Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Table, Offset); while (Offset < Table->Length) { /* Common subtable header */ AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, sizeof (ACPI_WDAT_ENTRY), AcpiDmTableInfoWdat0); if (ACPI_FAILURE (Status)) { @@ -4101,7 +4385,7 @@ AcpiDmDumpWdat ( /* Point to next subtable */ Offset += sizeof (ACPI_WDAT_ENTRY); - SubTable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, SubTable, + Subtable = ACPI_ADD_PTR (ACPI_WDAT_ENTRY, Subtable, sizeof (ACPI_WDAT_ENTRY)); } } @@ -4125,7 +4409,7 @@ AcpiDmDumpWpbt ( ACPI_TABLE_HEADER *Table) { ACPI_STATUS Status; - ACPI_TABLE_WPBT *SubTable; + ACPI_TABLE_WPBT *Subtable; UINT32 Length = Table->Length; UINT16 ArgumentsLength; @@ -4140,8 +4424,8 @@ AcpiDmDumpWpbt ( /* Extract the arguments buffer length from the main table */ - SubTable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table); - ArgumentsLength = SubTable->ArgumentsLength; + Subtable = ACPI_CAST_PTR (ACPI_TABLE_WPBT, Table); + ArgumentsLength = Subtable->ArgumentsLength; /* Dump the arguments buffer */ diff --git a/sys/contrib/dev/acpica/common/dmtbinfo.c b/sys/contrib/dev/acpica/common/dmtbinfo.c index c487fcf9c8b..2702e61905b 100644 --- a/sys/contrib/dev/acpica/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/common/dmtbinfo.c @@ -214,11 +214,13 @@ #define ACPI_MSCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_MSCT,f) #define ACPI_NFIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_NFIT,f) #define ACPI_PCCT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PCCT,f) +#define ACPI_PDTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PDTT,f) #define ACPI_PMTT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_PMTT,f) #define ACPI_RASF_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_RASF,f) #define ACPI_S3PT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_S3PT,f) #define ACPI_SBST_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SDEI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEI,f) +#define ACPI_SDEV_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SDEV,f) #define ACPI_SLIT_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SPMI,f) @@ -334,11 +336,13 @@ #define ACPI_NFIT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CONTROL_REGION,f) #define ACPI_NFIT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_DATA_REGION,f) #define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f) +#define ACPI_NFIT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CAPABILITIES,f) #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_PDTT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PDTT_CHANNEL,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) @@ -351,6 +355,10 @@ #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) +#define ACPI_SDEVH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_HEADER,f) +#define ACPI_SDEV0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_NAMESPACE,f) +#define ACPI_SDEV1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE,f) +#define ACPI_SDEV1A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SDEV_PCIE_PATH,f) #define ACPI_SLIC_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TABLE_SLIC,f) #define ACPI_SRATH_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) @@ -360,6 +368,8 @@ #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_TPM2A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_TRAILER,f) +#define ACPI_TPM211_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_TPM2_ARM_SMC,f) #define ACPI_VRTC0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_VRTC_ENTRY,f) #define ACPI_WDAT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) @@ -410,12 +420,15 @@ #define ACPI_NFIT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f,o) #define ACPI_NFIT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_MEMORY_MAP,f,o) #define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o) +#define ACPI_NFIT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CAPABILITIES,f,o) #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_PDTT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PDTT_CHANNEL,f,o) #define ACPI_PMTTH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PMTT_HEADER,f,o) +#define ACPI_SDEVH_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SDEV_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) @@ -896,7 +909,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt1[] = ACPI_DMT_TERMINATOR }; - /* Resource Descriptor subtable */ ACPI_DMTABLE_INFO AcpiDmTableInfoCsrt2[] = @@ -1260,6 +1272,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoFpdt1[] = {ACPI_DMT_UINT64, ACPI_FPDT0_OFFSET (ExitServicesExit), "Exit Services Exit", 0}, #endif + /******************************************************************************* * * GTDT - Generic Timer Description Table @@ -1850,9 +1863,11 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] = {ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Pxm), "Proximity Domain", 0}, {ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Reserved1), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_IORT4_OFFSET (Reserved2), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (IdMappingIndex), "Device ID Mapping Index", 0}, ACPI_DMT_TERMINATOR }; + /******************************************************************************* * * IVRS - I/O Virtualization Reporting Structure @@ -2219,6 +2234,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt15[] = ACPI_DMT_TERMINATOR }; + /******************************************************************************* * * MCFG - PCI Memory Mapped Configuration table and Subtable @@ -2551,6 +2567,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[] = ACPI_DMT_TERMINATOR }; +ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[] = +{ + {ACPI_DMT_UINT8, ACPI_NFIT7_OFFSET (HighestCapability), "Highest Capability", 0}, + {ACPI_DMT_UINT24, ACPI_NFIT7_OFFSET (Reserved[0]), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Capabilities), "Capabilities (decoded below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Cache Flush to NVDIMM", 0}, + {ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to MVDIMM", 0}, + {ACPI_DMT_FLAG2, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Mirroring", 0}, + {ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Reserved2), "Reserved", 0}, + ACPI_DMT_TERMINATOR +}; + /******************************************************************************* * @@ -2696,6 +2724,31 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[] = ACPI_DMT_TERMINATOR }; + +/******************************************************************************* + * + * PDTT - Platform Debug Trigger Table (ACPI 6.2) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[] = +{ + {ACPI_DMT_UINT8, ACPI_PDTT_OFFSET (TriggerCount), "Trigger Count", 0}, + {ACPI_DMT_UINT24, ACPI_PDTT_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_PDTT_OFFSET (ArrayOffset), "Array Offset", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[] = +{ + {ACPI_DMT_UINT8, ACPI_PDTT0_OFFSET (SubchannelId), "Subchannel Id", 0}, + {ACPI_DMT_UINT8, ACPI_PDTT0_OFFSET (Flags), "Flags (Decoded Below)", DT_FLAG}, + {ACPI_DMT_FLAG0, ACPI_PDTT0_FLAG_OFFSET (Flags,0), "Runtime Trigger", 0}, + {ACPI_DMT_FLAG1, ACPI_PDTT0_FLAG_OFFSET (Flags,0), "Wait for Completion", 0}, + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * PMTT - Platform Memory Topology Table @@ -2768,16 +2821,6 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt2[] = ACPI_DMT_TERMINATOR }; -/******************************************************************************* - * - * SDEI - Software Delegated Execption Interface Descriptor Table - * - ******************************************************************************/ - -ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] = -{ - ACPI_DMT_TERMINATOR -}; /******************************************************************************* * @@ -2801,7 +2844,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPpttHdr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[] = { {ACPI_DMT_UINT16, ACPI_PPTT0_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT0_OFFSET (Flags), "Flags (decoded below)", 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}, @@ -2821,14 +2864,14 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[] = { {ACPI_DMT_UINT16, ACPI_PPTT1_OFFSET (Reserved), "Reserved", 0}, - {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Flags), "Flags", 0}, + {ACPI_DMT_UINT32, ACPI_PPTT1_OFFSET (Flags), "Flags (decoded below)", 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_FLAG6, 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}, @@ -2855,6 +2898,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoPptt2[] = ACPI_DMT_TERMINATOR }; + /******************************************************************************* * * RASF - RAS Feature table @@ -2867,6 +2911,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoRasf[] = ACPI_DMT_TERMINATOR }; + /******************************************************************************* * * S3PT - S3 Performance Table @@ -2925,6 +2970,86 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = }; +/******************************************************************************* + * + * SDEI - Software Delegated Execption Interface Descriptor Table + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[] = +{ + ACPI_DMT_TERMINATOR +}; + + +/******************************************************************************* + * + * SDEV - Secure Devices Table (ACPI 6.2) + * + ******************************************************************************/ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev[] = +{ + ACPI_DMT_TERMINATOR +}; + +/* Common Subtable header (one per Subtable) */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdevHdr[] = +{ + {ACPI_DMT_SDEV, ACPI_SDEVH_OFFSET (Type), "Subtable Type", 0}, + {ACPI_DMT_UINT8, ACPI_SDEVH_OFFSET (Flags), "Flags (decoded below)", 0}, + {ACPI_DMT_FLAG0, ACPI_SDEVH_FLAG_OFFSET (Flags,0), "Allow handoff to unsecure OS", 0}, + {ACPI_DMT_UINT16, ACPI_SDEVH_OFFSET (Length), "Length", 0}, + ACPI_DMT_TERMINATOR +}; + +/* SDEV Subtables */ + +/* 0: Namespace Device Based Secure Device Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0[] = +{ + {ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (DeviceIdOffset), "Device ID Offset", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (DeviceIdLength), "Device ID Length", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (VendorDataOffset), "Vendor Data Offset", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV0_OFFSET (VendorDataLength), "Vendor Data Length", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0a[] = +{ + {ACPI_DMT_STRING, 0, "Namepath", 0}, + ACPI_DMT_TERMINATOR +}; + +/* 1: PCIe Endpoint Device Based Device Structure */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1[] = +{ + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (Segment), "Segment", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (StartBus), "Start Bus", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (PathOffset), "Path Offset", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (PathLength), "Path Length", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (VendorDataOffset), "Vendor Data Offset", 0}, + {ACPI_DMT_UINT16, ACPI_SDEV1_OFFSET (VendorDataLength), "Vendor Data Length", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1a[] = +{ + {ACPI_DMT_UINT8, ACPI_SDEV1A_OFFSET (Device), "Device", 0}, + {ACPI_DMT_UINT8, ACPI_SDEV1A_OFFSET (Function), "Function", 0}, + ACPI_DMT_TERMINATOR +}; + +ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1b[] = +{ + {ACPI_DMT_RAW_BUFFER, 0, "Vendor Data", 0}, /*, DT_OPTIONAL}, */ + ACPI_DMT_TERMINATOR +}; + + /******************************************************************************* * * SLIC - Software Licensing Description Table. This table contains the standard @@ -3186,7 +3311,29 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[] = {ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (PlatformClass), "Platform Class", 0}, {ACPI_DMT_UINT16, ACPI_TPM2_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_TPM2_OFFSET (ControlAddress), "Control Address", 0}, - {ACPI_DMT_UINT32, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0}, + {ACPI_DMT_TPM2, ACPI_TPM2_OFFSET (StartMethod), "Start Method", 0}, + ACPI_DMT_TERMINATOR +}; + +/* Optional trailer. LogLength and LogAddress are additionally optional */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2a[] = +{ + {ACPI_DMT_BUF12, ACPI_TPM2A_OFFSET (MethodParameters), "Method Parameters", DT_OPTIONAL}, + {ACPI_DMT_UINT32, ACPI_TPM2A_OFFSET (MinimumLogLength), "Minimum Log Length", DT_OPTIONAL}, + {ACPI_DMT_UINT64, ACPI_TPM2A_OFFSET (LogAddress), "Log Address", DT_OPTIONAL}, + ACPI_DMT_TERMINATOR +}; + +/* 11: Start Method for ARM SMC */ + +ACPI_DMTABLE_INFO AcpiDmTableInfoTpm211[] = +{ + {ACPI_DMT_UINT32, ACPI_TPM211_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, + {ACPI_DMT_UINT8, ACPI_TPM211_OFFSET (InterruptFlags), "Interrupt Flags", 0}, + {ACPI_DMT_UINT8, ACPI_TPM211_OFFSET (OperationFlags), "Operation Flags", 0}, + {ACPI_DMT_UINT16, ACPI_TPM211_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT32, ACPI_TPM211_OFFSET (FunctionId), "Function ID", 0}, ACPI_DMT_TERMINATOR }; diff --git a/sys/contrib/dev/acpica/compiler/aslallocate.c b/sys/contrib/dev/acpica/compiler/aslallocate.c new file mode 100644 index 00000000000..e83a01f422a --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslallocate.c @@ -0,0 +1,303 @@ +/****************************************************************************** + * + * Module Name: aslallocate -- Local memory allocation + * + *****************************************************************************/ + +/****************************************************************************** + * + * 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 + +/* + * Local heap allocation wrappers. See aslcache.c for allocation from local + * cache alloctions + */ + + +/******************************************************************************* + * + * FUNCTION: UtLocalCalloc + * + * PARAMETERS: Size - Bytes to be allocated + * + * RETURN: Pointer to the allocated memory. If this function returns + * (the compiler is not aborted), the pointer is guaranteed to + * be valid. + * + * DESCRIPTION: Allocate zero-initialized memory. The point of this function + * is to abort the compile on an allocation failure, on the + * assumption that nothing more can be accomplished. + * + * NOTE: For allocation from the local caches, see aslcache.c + * + ******************************************************************************/ + +void * +UtLocalCalloc ( + UINT32 Size) +{ + void *Allocated; + + + Allocated = ACPI_ALLOCATE_ZEROED (Size); + if (!Allocated) + { + AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, + Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, + Gbl_InputByteCount, Gbl_CurrentColumn, + Gbl_Files[ASL_FILE_INPUT].Filename, NULL); + + CmCleanupAndExit (); + exit (1); + } + + TotalAllocations++; + TotalAllocated += Size; + return (Allocated); +} + + +/****************************************************************************** + * + * FUNCTION: UtExpandLineBuffers + * + * PARAMETERS: None. Updates global line buffer pointers. + * + * RETURN: None. Reallocates the global line buffers + * + * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates + * all global line buffers and updates Gbl_LineBufferSize. NOTE: + * Also used for the initial allocation of the buffers, when + * all of the buffer pointers are NULL. Initial allocations are + * of size ASL_DEFAULT_LINE_BUFFER_SIZE + * + *****************************************************************************/ + +void +UtExpandLineBuffers ( + void) +{ + UINT32 NewSize; + + + /* Attempt to double the size of all line buffers */ + + NewSize = Gbl_LineBufferSize * 2; + if (Gbl_CurrentLineBuffer) + { + DbgPrint (ASL_DEBUG_OUTPUT, + "Increasing line buffer size from %u to %u\n", + Gbl_LineBufferSize, NewSize); + } + + UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize); + UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize); + + Gbl_LineBufPtr = Gbl_CurrentLineBuffer; + Gbl_LineBufferSize = NewSize; +} + + +/****************************************************************************** + * + * FUNCTION: UtReallocLineBuffers + * + * PARAMETERS: Buffer - Buffer to realloc + * OldSize - Old size of Buffer + * NewSize - New size of Buffer + * + * RETURN: none + * + * DESCRIPTION: Reallocate and initialize Buffer + * + *****************************************************************************/ + +void +UtReallocLineBuffers ( + char **Buffer, + UINT32 OldSize, + UINT32 NewSize) +{ + + *Buffer = realloc (*Buffer, NewSize); + if (*Buffer) + { + memset (*Buffer + OldSize, 0, NewSize - OldSize); + return; + } + + printf ("Could not increase line buffer size from %u to %u\n", + OldSize, NewSize); + + AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, NULL, NULL); + AslAbort (); +} + + +/****************************************************************************** + * + * FUNCTION: UtFreeLineBuffers + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Free all line buffers + * + *****************************************************************************/ + +void +UtFreeLineBuffers ( + void) +{ + + free (Gbl_CurrentLineBuffer); + free (Gbl_MainTokenBuffer); + free (Gbl_MacroTokenBuffer); + free (Gbl_ExpressionTokenBuffer); +} diff --git a/sys/contrib/dev/acpica/compiler/aslcache.c b/sys/contrib/dev/acpica/compiler/aslcache.c new file mode 100644 index 00000000000..1e54a2fa8d7 --- /dev/null +++ b/sys/contrib/dev/acpica/compiler/aslcache.c @@ -0,0 +1,481 @@ +/****************************************************************************** + * + * Module Name: aslcache -- Local cache support for iASL + * + *****************************************************************************/ + +/****************************************************************************** + * + * 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 + +/* + * Local caches. The caches are fully deleted after the compilation/disassembly + * of each individual input file. Thus, individual allocations from the cache + * memory do not need to be freed or even released back into the cache. + * + * See aslallocate.c for standard heap allocations. + */ + + +/******************************************************************************* + * + * FUNCTION: UtLocalCacheCalloc + * + * PARAMETERS: Length - Size of buffer requested + * + * 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 + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +char * +UtLocalCacheCalloc ( + UINT32 Length) +{ + char *Buffer; + ASL_CACHE_INFO *Cache; + UINT32 CacheSize = ASL_STRING_CACHE_SIZE; + + + if (Length > CacheSize) + { + CacheSize = Length; + + if (Gbl_StringCacheList) + { + Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); + + /* Link new cache buffer just following head of list */ + + Cache->Next = Gbl_StringCacheList->Next; + Gbl_StringCacheList->Next = Cache; + + /* Leave cache management pointers alone as they pertain to head */ + + Gbl_StringCount++; + Gbl_StringSize += Length; + + return (Cache->Buffer); + } + } + + if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_StringCacheList; + Gbl_StringCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_StringCacheNext = Cache->Buffer; + Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize; + } + + Gbl_StringCount++; + Gbl_StringSize += Length; + + Buffer = Gbl_StringCacheNext; + Gbl_StringCacheNext += Length; + return (Buffer); +} + + +/******************************************************************************* + * + * FUNCTION: UtParseOpCacheCalloc + * + * PARAMETERS: None + * + * RETURN: New parse op. Aborts on allocation failure + * + * DESCRIPTION: Allocate a new parse op for the parse tree. Bypass the local + * dynamic memory manager for performance reasons (This has a + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +ACPI_PARSE_OBJECT * +UtParseOpCacheCalloc ( + void) +{ + ASL_CACHE_INFO *Cache; + + + if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + + (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE)); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_ParseOpCacheList; + Gbl_ParseOpCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer); + Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE; + } + + Gbl_ParseOpCount++; + return (Gbl_ParseOpCacheNext++); +} + + +/******************************************************************************* + * + * FUNCTION: UtSubtableCacheCalloc - Data Table compiler + * + * PARAMETERS: None + * + * RETURN: Pointer to the buffer. Aborts on allocation failure + * + * DESCRIPTION: Allocate a subtable object buffer. Bypass the local + * dynamic memory manager for performance reasons (This has a + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +DT_SUBTABLE * +UtSubtableCacheCalloc ( + void) +{ + ASL_CACHE_INFO *Cache; + + + if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + + (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE)); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_SubtableCacheList; + Gbl_SubtableCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer); + Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE; + } + + Gbl_SubtableCount++; + return (Gbl_SubtableCacheNext++); +} + + +/******************************************************************************* + * + * FUNCTION: UtFieldCacheCalloc - Data Table compiler + * + * PARAMETERS: None + * + * RETURN: Pointer to the buffer. Aborts on allocation failure + * + * DESCRIPTION: Allocate a field object buffer. Bypass the local + * dynamic memory manager for performance reasons (This has a + * major impact on the speed of the compiler.) + * + ******************************************************************************/ + +DT_FIELD * +UtFieldCacheCalloc ( + void) +{ + ASL_CACHE_INFO *Cache; + + + if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast) + { + /* Allocate a new buffer */ + + Cache = UtLocalCalloc (sizeof (Cache->Next) + + (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE)); + + /* Link new cache buffer to head of list */ + + Cache->Next = Gbl_FieldCacheList; + Gbl_FieldCacheList = Cache; + + /* Setup cache management pointers */ + + Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer); + Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE; + } + + Gbl_FieldCount++; + return (Gbl_FieldCacheNext++); +} + + +/******************************************************************************* + * + * FUNCTION: UtDeleteLocalCaches + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Delete all local cache buffer blocks + * + ******************************************************************************/ + +void +UtDeleteLocalCaches ( + void) +{ + UINT32 BufferCount; + ASL_CACHE_INFO *Next; + + + /* + * Generic cache, arbitrary size allocations + */ + BufferCount = 0; + while (Gbl_StringCacheList) + { + Next = Gbl_StringCacheList->Next; + ACPI_FREE (Gbl_StringCacheList); + Gbl_StringCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n", + Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount); + + /* Reset cache globals */ + + Gbl_StringSize = 0; + Gbl_StringCount = 0; + Gbl_StringCacheNext = NULL; + Gbl_StringCacheLast = NULL; + + + /* + * Parse Op cache + */ + BufferCount = 0; + while (Gbl_ParseOpCacheList) + { + Next = Gbl_ParseOpCacheList->Next; + ACPI_FREE (Gbl_ParseOpCacheList); + Gbl_ParseOpCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", + Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, + (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); + + /* Reset cache globals */ + + Gbl_ParseOpCount = 0; + Gbl_ParseOpCacheNext = NULL; + Gbl_ParseOpCacheLast = NULL; + Gbl_ParseTreeRoot = NULL; + + + /* + * Table Compiler - Field cache + */ + BufferCount = 0; + while (Gbl_FieldCacheList) + { + Next = Gbl_FieldCacheList->Next; + ACPI_FREE (Gbl_FieldCacheList); + Gbl_FieldCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", + Gbl_FieldCount, ASL_FIELD_CACHE_SIZE, + (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); + + /* Reset cache globals */ + + Gbl_FieldCount = 0; + Gbl_FieldCacheNext = NULL; + Gbl_FieldCacheLast = NULL; + + + /* + * Table Compiler - Subtable cache + */ + BufferCount = 0; + while (Gbl_SubtableCacheList) + { + Next = Gbl_SubtableCacheList->Next; + ACPI_FREE (Gbl_SubtableCacheList); + Gbl_SubtableCacheList = Next; + BufferCount++; + } + + DbgPrint (ASL_DEBUG_OUTPUT, + "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", + Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, + (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); + + /* Reset cache globals */ + + Gbl_SubtableCount = 0; + Gbl_SubtableCacheNext = NULL; + Gbl_SubtableCacheLast = NULL; +} diff --git a/sys/contrib/dev/acpica/compiler/aslcodegen.c b/sys/contrib/dev/acpica/compiler/aslcodegen.c index d875f5eeb40..13def091648 100644 --- a/sys/contrib/dev/acpica/compiler/aslcodegen.c +++ b/sys/contrib/dev/acpica/compiler/aslcodegen.c @@ -370,7 +370,7 @@ CgWriteAmlOpcode ( * Before printing the bytecode, generate comment byte codes * associated with this node. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -550,13 +550,13 @@ CgWriteTableHeader ( * "XXXX" table signature prevents this AML file from running on the AML * interpreter. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { - strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, 4); + strncpy(AcpiGbl_TableSig, Child->Asl.Value.String, ACPI_NAME_SIZE); Child->Asl.Value.String = ACPI_SIG_XXXX; } - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); + strncpy (TableHeader.Signature, Child->Asl.Value.String, ACPI_NAME_SIZE); /* Revision */ @@ -573,12 +573,12 @@ CgWriteTableHeader ( /* OEMID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); + strncpy (TableHeader.OemId, Child->Asl.Value.String, ACPI_OEM_ID_SIZE); /* OEM TableID */ Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); + strncpy (TableHeader.OemTableId, Child->Asl.Value.String, ACPI_OEM_TABLE_ID_SIZE); /* OEM Revision */ @@ -600,7 +600,7 @@ CgWriteTableHeader ( /* Calculate the comment lengths for this definition block parseOp */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvDbgPrint ("Calculating comment lengths for %s in write header\n", Op->Asl.ParseOpName); @@ -756,7 +756,8 @@ CgWriteNode ( /* Write all comments here. */ - if (Gbl_CaptureComments) + + if (AcpiGbl_CaptureComments) { CgWriteAmlComment(Op); } @@ -822,7 +823,7 @@ CgWriteNode ( case PARSEOP_DEFINITION_BLOCK: CgWriteTableHeader (Op); - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CgWriteAmlDefBlockComment (Op); } diff --git a/sys/contrib/dev/acpica/compiler/aslcompile.c b/sys/contrib/dev/acpica/compiler/aslcompile.c index 5bd460def46..2f2a1b2c438 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompile.c +++ b/sys/contrib/dev/acpica/compiler/aslcompile.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #include #include @@ -470,7 +469,7 @@ CmDoCompile ( * node during compilation. We take the very last comment and save it in a * global for it to be used by the disassembler. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { AcpiGbl_LastListHead = Gbl_ParseTreeRoot->Asl.CommentList; Gbl_ParseTreeRoot->Asl.CommentList = NULL; @@ -932,70 +931,7 @@ CmCleanupAndExit ( if (!Gbl_DoAslConversion) { - CmDeleteCaches (); + UtDeleteLocalCaches (); } } - - -/******************************************************************************* - * - * FUNCTION: CmDeleteCaches - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all local cache buffer blocks - * - ******************************************************************************/ - -void -CmDeleteCaches ( - void) -{ - UINT32 BufferCount; - ASL_CACHE_INFO *Next; - - - /* Parse Op cache */ - - BufferCount = 0; - while (Gbl_ParseOpCacheList) - { - Next = Gbl_ParseOpCacheList->Next; - ACPI_FREE (Gbl_ParseOpCacheList); - Gbl_ParseOpCacheList = Next; - BufferCount++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, - "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", - Gbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, - (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); - - Gbl_ParseOpCount = 0; - Gbl_ParseOpCacheNext = NULL; - Gbl_ParseOpCacheLast = NULL; - Gbl_ParseTreeRoot = NULL; - - /* Generic string cache */ - - BufferCount = 0; - while (Gbl_StringCacheList) - { - Next = Gbl_StringCacheList->Next; - ACPI_FREE (Gbl_StringCacheList); - Gbl_StringCacheList = Next; - BufferCount++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, - "%u Strings (%u bytes), Buffer size: %u bytes, %u Buffers\n", - Gbl_StringCount, Gbl_StringSize, ASL_STRING_CACHE_SIZE, BufferCount); - - Gbl_StringSize = 0; - Gbl_StringCount = 0; - Gbl_StringCacheNext = NULL; - Gbl_StringCacheLast = NULL; -} diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.h b/sys/contrib/dev/acpica/compiler/aslcompiler.h index 05069ecba7a..96bfc979c9f 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.h @@ -181,6 +181,7 @@ #include #include #include +#include /******************************************************************************* @@ -265,8 +266,50 @@ void CmCleanupAndExit ( void); + +/* + * aslallocate - memory allocation + */ +void * +UtLocalCalloc ( + UINT32 Size); + +void +UtExpandLineBuffers ( + void); + +void +UtReallocLineBuffers ( + char **Buffer, + UINT32 OldSize, + UINT32 NewSize); + +void +UtFreeLineBuffers ( + void); + + +/* + * aslcache - local cache support + */ +char * +UtLocalCacheCalloc ( + UINT32 Length); + +ACPI_PARSE_OBJECT * +UtParseOpCacheCalloc ( + void); + +DT_SUBTABLE * +UtSubtableCacheCalloc ( + void); + +DT_FIELD * +UtFieldCacheCalloc ( + void); + void -CmDeleteCaches ( +UtDeleteLocalCaches ( void); @@ -406,6 +449,16 @@ void AslAbort ( void); +void +AslDualParseOpError ( + UINT8 Level, + UINT16 MainMessageId, + ACPI_PARSE_OBJECT *MainOp, + char *MainMessage, + UINT16 SecondMessageId, + ACPI_PARSE_OBJECT *SecondOp, + char *SecondaryMessage); + void AslError ( UINT8 Level, @@ -890,6 +943,11 @@ void TrSetOpCurrentFilename ( ACPI_PARSE_OBJECT *Op); +void +TrSetOpIntegerWidth ( + ACPI_PARSE_OBJECT *TableSignature, + ACPI_PARSE_OBJECT *Revision); + ACPI_PARSE_OBJECT * TrLinkOpChildren ( ACPI_PARSE_OBJECT *Op, @@ -1145,10 +1203,6 @@ void UtEndEvent ( UINT8 Event); -void * -UtLocalCalloc ( - UINT32 Size); - void UtDisplaySummary ( UINT32 FileId); @@ -1171,18 +1225,6 @@ void UtSetParseOpName ( ACPI_PARSE_OBJECT *Op); -char * -UtStringCacheCalloc ( - UINT32 Length); - -void -UtExpandLineBuffers ( - void); - -void -UtFreeLineBuffers ( - void); - ACPI_STATUS UtInternalizeName ( char *ExternalName, diff --git a/sys/contrib/dev/acpica/compiler/aslcompiler.l b/sys/contrib/dev/acpica/compiler/aslcompiler.l index d65968e1aa2..38fe15a2c92 100644 --- a/sys/contrib/dev/acpica/compiler/aslcompiler.l +++ b/sys/contrib/dev/acpica/compiler/aslcompiler.l @@ -195,6 +195,7 @@ count (int type); LeadNameChar [A-Za-z_] DigitChar [0-9] +OctalChar [0-7] HexDigitChar [A-Fa-f0-9] RootChar [\\] Nothing [] @@ -278,8 +279,7 @@ NamePathTail [.]{NameSeg} /* * Begin standard ASL grammar */ -0[xX]{HexDigitChar}+ | -{DigitChar}+ { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); +[0-9][a-zA-Z0-9]* { AslCompilerlval.i = UtDoConstant ((char *) AslCompilertext); count (1); return (PARSEOP_INTEGER); } "Include" { count (1); return (PARSEOP_INCLUDE); } @@ -813,7 +813,7 @@ NamePathTail [.]{NameSeg} {NameSeg} { char *s; count (0); - s=UtStringCacheCalloc (ACPI_NAME_SIZE + 1); + s=UtLocalCacheCalloc (ACPI_NAME_SIZE + 1); if (strcmp (AslCompilertext, "\\")) { strcpy (s, "____"); @@ -826,7 +826,7 @@ NamePathTail [.]{NameSeg} {NameString} { char *s; count (0); - s=UtStringCacheCalloc (strlen (AslCompilertext)+1); + s=UtLocalCacheCalloc (strlen (AslCompilertext)+1); AcpiUtStrupr (AslCompilertext); strcpy (s, AslCompilertext); AslCompilerlval.s = s; diff --git a/sys/contrib/dev/acpica/compiler/asldebug.c b/sys/contrib/dev/acpica/compiler/asldebug.c index 3824a4534c0..42a0736fa3b 100644 --- a/sys/contrib/dev/acpica/compiler/asldebug.c +++ b/sys/contrib/dev/acpica/compiler/asldebug.c @@ -165,6 +165,10 @@ UtDumpParseOpName ( UINT32 Level, UINT32 DataLength); +static char * +UtCreateEscapeSequences ( + char *InString); + /******************************************************************************* * @@ -188,7 +192,7 @@ CvDbgPrint ( va_list Args; - if (!Gbl_CaptureComments || !AcpiGbl_DebugAslConversion) + if (!AcpiGbl_CaptureComments || !AcpiGbl_DebugAslConversion) { return; } @@ -272,7 +276,6 @@ UtDumpStringOp ( String = Op->Asl.Value.String; - if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) { /* @@ -294,6 +297,8 @@ UtDumpStringOp ( return; } + String = UtCreateEscapeSequences (String); + /* Emit the ParseOp name, leaving room for the string */ UtDumpParseOpName (Op, Level, strlen (String)); @@ -301,6 +306,86 @@ UtDumpStringOp ( } +/******************************************************************************* + * + * FUNCTION: UtCreateEscapeSequences + * + * PARAMETERS: InString - ASCII string to be expanded + * + * RETURN: Expanded string + * + * DESCRIPTION: Expand all non-printable ASCII bytes (0-0x1F) to escape + * sequences. For example, hex 14 becomes \x14 + * + * NOTE: Since this function is used for debug output only, it does + * not attempt to translate into the "known" escape sequences + * such as \a, \f, \t, etc. + * + ******************************************************************************/ + +static char * +UtCreateEscapeSequences ( + char *InString) +{ + char *String = InString; + char *OutString; + char *OutStringPtr; + UINT32 InStringLength = 0; + UINT32 EscapeCount = 0; + + + /* + * Determine up front how many escapes are within the string. + * Obtain the input string length while doing so. + */ + while (*String) + { + if ((*String <= 0x1F) || (*String >= 0x7F)) + { + EscapeCount++; + } + + InStringLength++; + String++; + } + + if (!EscapeCount) + { + return (InString); /* No escapes, nothing to do */ + } + + /* New string buffer, 3 extra chars per escape (4 total) */ + + OutString = UtLocalCacheCalloc (InStringLength + (EscapeCount * 3)); + OutStringPtr = OutString; + + /* Convert non-ascii or non-printable chars to escape sequences */ + + while (*InString) + { + if ((*InString <= 0x1F) || (*InString >= 0x7F)) + { + /* Insert a \x hex escape sequence */ + + OutStringPtr[0] = '\\'; + OutStringPtr[1] = 'x'; + OutStringPtr[2] = AcpiUtHexToAsciiChar (*InString, 4); + OutStringPtr[3] = AcpiUtHexToAsciiChar (*InString, 0); + OutStringPtr += 4; + } + else /* Normal ASCII character */ + { + *OutStringPtr = *InString; + OutStringPtr++; + } + + InString++; + } + + return (OutString); +} + + /******************************************************************************* * * FUNCTION: UtDumpBasicOp diff --git a/sys/contrib/dev/acpica/compiler/asldefine.h b/sys/contrib/dev/acpica/compiler/asldefine.h index a7d1a289d52..bcdc8c2407c 100644 --- a/sys/contrib/dev/acpica/compiler/asldefine.h +++ b/sys/contrib/dev/acpica/compiler/asldefine.h @@ -162,7 +162,7 @@ #define ASL_CREATOR_ID "INTL" #define ASL_DEFINE "__IASL__" #define ASL_PREFIX "iASL: " -#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2" +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2A" /* Configuration constants */ diff --git a/sys/contrib/dev/acpica/compiler/aslerror.c b/sys/contrib/dev/acpica/compiler/aslerror.c index 43696d93949..f8c6c98d860 100644 --- a/sys/contrib/dev/acpica/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/compiler/aslerror.c @@ -170,6 +170,37 @@ AslIsExceptionDisabled ( UINT8 Level, UINT16 MessageId); +static void AslInitEnode ( + ASL_ERROR_MSG **Enode, + UINT8 Level, + UINT16 MessageId, + UINT32 LineNumber, + UINT32 LogicalLineNumber, + UINT32 LogicalByteOffset, + UINT32 Column, + char *Filename, + char *Message, + char *SourceLine, + ASL_ERROR_MSG *SubError); + +static void +AslLogNewError ( + UINT8 Level, + UINT16 MessageId, + UINT32 LineNumber, + UINT32 LogicalLineNumber, + UINT32 LogicalByteOffset, + UINT32 Column, + char *Filename, + char *Message, + char *SourceLine, + ASL_ERROR_MSG *SubError); + +static void +AePrintSubError ( + FILE *OutputFile, + ASL_ERROR_MSG *Enode); + /******************************************************************************* * @@ -220,6 +251,7 @@ AeClearErrorLog ( ASL_ERROR_MSG *Enode = Gbl_ErrorLog; ASL_ERROR_MSG *Next; + /* Walk the error node list */ while (Enode) @@ -270,8 +302,7 @@ AeAddToErrorLog ( Prev = NULL; Next = Gbl_ErrorLog; - while ((Next) && - (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) + while ((Next) && (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) { Prev = Next; Next = Next->Next; @@ -294,94 +325,143 @@ AeAddToErrorLog ( /******************************************************************************* * - * FUNCTION: AePrintException + * FUNCTION: AeDecodeErrorMessageId * - * PARAMETERS: FileId - ID of output file + * PARAMETERS: OutputFile - Output file * Enode - Error node to print - * Header - Additional text before each message + * PrematureEOF - True = PrematureEOF has been reached + * Total - Total legth of line * * RETURN: None * - * DESCRIPTION: Print the contents of an error node. - * - * NOTE: We don't use the FlxxxFile I/O functions here because on error - * they abort the compiler and call this function! Since we - * are reporting errors here, we ignore most output errors and - * just try to get out as much as we can. + * DESCRIPTION: Print the source line of an error. * ******************************************************************************/ -void -AePrintException ( - UINT32 FileId, +static void +AeDecodeErrorMessageId ( + FILE *OutputFile, ASL_ERROR_MSG *Enode, - char *Header) + BOOLEAN PrematureEOF, + UINT32 Total) { - UINT8 SourceByte; - int Actual; - size_t RActual; UINT32 MsgLength; const char *MainMessage; char *ExtraMessage; UINT32 SourceColumn; UINT32 ErrorColumn; - FILE *OutputFile; - FILE *SourceFile = NULL; - long FileSize; - BOOLEAN PrematureEOF = FALSE; - UINT32 Total = 0; - if (Gbl_NoErrors) + fprintf (OutputFile, "%s %4.4d -", + AeDecodeExceptionLevel (Enode->Level), + AeBuildFullExceptionCode (Enode->Level, Enode->MessageId)); + + MainMessage = AeDecodeMessageId (Enode->MessageId); + ExtraMessage = Enode->Message; + + /* If a NULL line number, just print the decoded message */ + + if (!Enode->LineNumber) { + fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage); return; } - /* - * Only listing files have a header, and remarks/optimizations - * are always output - */ - if (!Header) + MsgLength = strlen (MainMessage); + if (MsgLength == 0) { - /* Ignore remarks if requested */ + /* Use the secondary/extra message as main message */ - switch (Enode->Level) + MainMessage = Enode->Message; + if (!MainMessage) { - case ASL_WARNING: - case ASL_WARNING2: - case ASL_WARNING3: + MainMessage = ""; + } - if (!Gbl_DisplayWarnings) - { - return; - } - break; + MsgLength = strlen (MainMessage); + ExtraMessage = NULL; + } - case ASL_REMARK: + if (Gbl_VerboseErrors && !PrematureEOF) + { + if (Total >= 256) + { + fprintf (OutputFile, " %s", + MainMessage); + } + else + { + SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; + ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - if (!Gbl_DisplayRemarks) + if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) { - return; + fprintf (OutputFile, "%*s%s", + (int) ((SourceColumn - 1) - ErrorColumn), + MainMessage, " ^ "); } - break; - - case ASL_OPTIMIZATION: - - if (!Gbl_DisplayOptimizations) + else { - return; + fprintf (OutputFile, "%*s %s", + (int) ((SourceColumn - ErrorColumn) + 1), "^", + MainMessage); } - break; + } + } + else + { + fprintf (OutputFile, " %s", MainMessage); + } - default: + /* Print the extra info message if present */ - break; - } + if (ExtraMessage) + { + fprintf (OutputFile, " (%s)", ExtraMessage); } - /* Get the various required file handles */ + if (PrematureEOF) + { + fprintf (OutputFile, " and premature End-Of-File"); + } + + fprintf (OutputFile, "\n"); + if (Gbl_VerboseErrors && !Enode->SubError) + { + fprintf (OutputFile, "\n"); + } +} + + +/******************************************************************************* + * + * FUNCTION: AePrintErrorSourceLine + * + * PARAMETERS: OutputFile - Output file + * Enode - Error node to print + * PrematureEOF - True = PrematureEOF has been reached + * Total - amount of characters printed so far + * + * + * RETURN: Status + * + * DESCRIPTION: Print the source line of an error. + * + ******************************************************************************/ + +static ACPI_STATUS +AePrintErrorSourceLine ( + FILE *OutputFile, + ASL_ERROR_MSG *Enode, + BOOLEAN *PrematureEOF, + UINT32 *Total) +{ + UINT8 SourceByte; + int Actual; + size_t RActual; + FILE *SourceFile = NULL; + long FileSize; - OutputFile = Gbl_Files[FileId].Handle; if (!Enode->SourceLine) { @@ -404,211 +484,270 @@ AePrintException ( if ((long) Enode->LogicalByteOffset >= FileSize) { - PrematureEOF = TRUE; + *PrematureEOF = TRUE; } } - } - - if (Header) - { - fprintf (OutputFile, "%s", Header); + else + { + fprintf (OutputFile, + "[*** iASL: Source File Does not exist ***]\n"); + return AE_IO_ERROR; + } } /* Print filename and line number if present and valid */ - if (Enode->Filename) + if (Gbl_VerboseErrors) { - if (Gbl_VerboseErrors) + fprintf (OutputFile, "%-8s", Enode->Filename); + + if (Enode->SourceLine && Enode->LineNumber) { - fprintf (OutputFile, "%-8s", Enode->Filename); + fprintf (OutputFile, " %6u: %s", + Enode->LineNumber, Enode->SourceLine); + } + else if (Enode->LineNumber) + { + fprintf (OutputFile, " %6u: ", Enode->LineNumber); - if (Enode->LineNumber) + /* + * If not at EOF, get the corresponding source code line + * and display it. Don't attempt this if we have a + * premature EOF condition. + */ + if (*PrematureEOF) { - if (Enode->SourceLine) - { - fprintf (OutputFile, " %6u: %s", - Enode->LineNumber, Enode->SourceLine); - } - else + fprintf (OutputFile, "\n"); + return AE_OK; + } + /* + * Seek to the offset in the combined source file, + * read the source line, and write it to the output. + */ + Actual = fseek (SourceFile, + (long) Enode->LogicalByteOffset, (int) SEEK_SET); + if (Actual) + { + fprintf (OutputFile, + "[*** iASL: Seek error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + + fprintf (OutputFile, "\n"); + return AE_OK; + } + RActual = fread (&SourceByte, 1, 1, SourceFile); + if (RActual != 1) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); + return AE_IO_ERROR; + } + /* Read/write the source line, up to the maximum line length */ + + while (RActual && SourceByte && (SourceByte != '\n')) + { + if (*Total < 256) { - fprintf (OutputFile, " %6u: ", Enode->LineNumber); - - /* - * If not at EOF, get the corresponding source code line - * and display it. Don't attempt this if we have a - * premature EOF condition. - */ - if (!PrematureEOF) + /* After the max line length, we will just read the line, no write */ + + if (fwrite (&SourceByte, 1, 1, OutputFile) != 1) { - /* - * Seek to the offset in the combined source file, - * read the source line, and write it to the output. - */ - Actual = fseek (SourceFile, - (long) Enode->LogicalByteOffset, (int) SEEK_SET); - if (Actual) - { - fprintf (OutputFile, - "[*** iASL: Seek error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (RActual != 1) - { - fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - else - { - /* Read/write the source line, up to the maximum line length */ - - while (RActual && SourceByte && (SourceByte != '\n')) - { - if (Total < 256) - { - /* After the max line length, we will just read the line, no write */ - - if (fwrite (&SourceByte, 1, 1, OutputFile) != 1) - { - printf ("[*** iASL: Write error on output file ***]\n"); - return; - } - } - else if (Total == 256) - { - fprintf (OutputFile, - "\n[*** iASL: Very long input line, message below refers to column %u ***]", - Enode->Column); - } - - RActual = fread (&SourceByte, 1, 1, SourceFile); - if (RActual != 1) - { - fprintf (OutputFile, - "[*** iASL: Read error on source code temp file %s ***]", - Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - return; - } - Total++; - } - } - } + printf ("[*** iASL: Write error on output file ***]\n"); + return AE_IO_ERROR; } + } + else if (*Total == 256) + { + fprintf (OutputFile, + "\n[*** iASL: Very long input line, message below refers to column %u ***]", + Enode->Column); + } + + RActual = fread (&SourceByte, 1, 1, SourceFile); + if (RActual != 1) + { + fprintf (OutputFile, + "[*** iASL: Read error on source code temp file %s ***]", + Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - fprintf (OutputFile, "\n"); + return AE_IO_ERROR; } + *Total += 1; } - } - else - { - /* - * Less verbose version of the error message, enabled via the - * -vi switch. The format is compatible with MS Visual Studio. - */ - fprintf (OutputFile, "%s", Enode->Filename); - if (Enode->LineNumber) - { - fprintf (OutputFile, "(%u) : ", - Enode->LineNumber); - } + fprintf (OutputFile, "\n"); } } - - /* If a NULL message ID, just print the raw message */ - - if (Enode->MessageId == 0) + else { - fprintf (OutputFile, "%s\n", Enode->Message); - return; + /* + * Less verbose version of the error message, enabled via the + * -vi switch. The format is compatible with MS Visual Studio. + */ + fprintf (OutputFile, "%s", Enode->Filename); + + if (Enode->LineNumber) + { + fprintf (OutputFile, "(%u) : ", + Enode->LineNumber); + } } - /* Decode the message ID */ + return AE_OK; +} - fprintf (OutputFile, "%s %4.4d -", - AeDecodeExceptionLevel (Enode->Level), - AeBuildFullExceptionCode (Enode->Level, Enode->MessageId)); +/******************************************************************************* + * + * FUNCTION: AePrintException + * + * PARAMETERS: FileId - ID of output file + * Enode - Error node to print + * Header - Additional text before each message + * + * RETURN: None + * + * DESCRIPTION: Print the contents of an error node. + * + * NOTE: We don't use the FlxxxFile I/O functions here because on error + * they abort the compiler and call this function! Since we + * are reporting errors here, we ignore most output errors and + * just try to get out as much as we can. + * + ******************************************************************************/ - MainMessage = AeDecodeMessageId (Enode->MessageId); - ExtraMessage = Enode->Message; +void +AePrintException ( + UINT32 FileId, + ASL_ERROR_MSG *Enode, + char *Header) +{ + FILE *OutputFile; + BOOLEAN PrematureEOF = FALSE; + UINT32 Total = 0; + ACPI_STATUS Status; + ASL_ERROR_MSG *Child = Enode->SubError; - /* If a NULL line number, just print the decoded message */ - if (!Enode->LineNumber) + if (Gbl_NoErrors) { - fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage); return; } - MsgLength = strlen (MainMessage); - if (MsgLength == 0) - { - /* Use the secondary/extra message as main message */ - - MainMessage = Enode->Message; - if (!MainMessage) - { - MainMessage = ""; - } - - MsgLength = strlen (MainMessage); - ExtraMessage = NULL; - } - - if (Gbl_VerboseErrors && !PrematureEOF) + /* + * Only listing files have a header, and remarks/optimizations + * are always output + */ + if (!Header) { - if (Total >= 256) - { - fprintf (OutputFile, " %s", - MainMessage); - } - else + /* Ignore remarks if requested */ + + switch (Enode->Level) { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; + case ASL_WARNING: + case ASL_WARNING2: + case ASL_WARNING3: - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) + if (!Gbl_DisplayWarnings) { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); + return; } - else + break; + + case ASL_REMARK: + + if (!Gbl_DisplayRemarks) { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); + return; + } + break; + + case ASL_OPTIMIZATION: + + if (!Gbl_DisplayOptimizations) + { + return; } + break; + + default: + + break; } } - else + + /* Get the various required file handles */ + + OutputFile = Gbl_Files[FileId].Handle; + + if (Header) { - fprintf (OutputFile, " %s", MainMessage); + fprintf (OutputFile, "%s", Header); } - /* Print the extra info message if present */ + if (!Enode->Filename) + { + AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total); + return; + } - if (ExtraMessage) + Status = AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total); + if (ACPI_FAILURE (Status)) { - fprintf (OutputFile, " (%s)", ExtraMessage); + return; } - if (PrematureEOF) + /* If a NULL message ID, just print the raw message */ + + if (Enode->MessageId == 0) { - fprintf (OutputFile, " and premature End-Of-File"); + fprintf (OutputFile, "%s\n", Enode->Message); + return; } - fprintf (OutputFile, "\n"); - if (Gbl_VerboseErrors) + AeDecodeErrorMessageId (OutputFile, Enode, PrematureEOF, Total); + + while (Child) { fprintf (OutputFile, "\n"); + AePrintSubError (OutputFile, Child); + Child = Child->SubError; } } +/******************************************************************************* + * + * FUNCTION: AePrintSubError + * + * PARAMETERS: OutputFile - Output file + * Enode - Error node to print + * + * RETURN: None + * + * DESCRIPTION: Print the contents of an error nodes. This function is tailored + * to print error nodes that are SubErrors within ASL_ERROR_MSG + * + ******************************************************************************/ + +static void +AePrintSubError ( + FILE *OutputFile, + ASL_ERROR_MSG *Enode) +{ + UINT32 Total = 0; + BOOLEAN PrematureEOF = FALSE; + const char *MainMessage; + + + MainMessage = AeDecodeMessageId (Enode->MessageId); + + fprintf (OutputFile, " %s%s", MainMessage, "\n "); + (void) AePrintErrorSourceLine (OutputFile, Enode, &PrematureEOF, &Total); + fprintf (OutputFile, "\n"); +} + + /******************************************************************************* * * FUNCTION: AePrintErrorLog @@ -640,54 +779,72 @@ AePrintErrorLog ( /******************************************************************************* * - * FUNCTION: AslCommonError2 + * FUNCTION: AslInitEnode * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * PARAMETERS: InputEnode - Input Error node to initialize + * Level - Seriousness (Warning/error, etc.) * MessageId - Index into global message buffer - * LineNumber - Actual file line number + * CurrentLineNumber - Actual file line number + * LogicalLineNumber - Cumulative line number + * LogicalByteOffset - Byte offset in source file * Column - Column in current line - * SourceLine - Actual source code line * Filename - source filename * ExtraMessage - additional error message + * SourceLine - Line of error source code + * SubError - SubError of this InputEnode * * RETURN: None * - * DESCRIPTION: Create a new error node and add it to the error log + * DESCRIPTION: Initialize an Error node * ******************************************************************************/ -void -AslCommonError2 ( +static void AslInitEnode ( + ASL_ERROR_MSG **InputEnode, UINT8 Level, UINT16 MessageId, UINT32 LineNumber, + UINT32 LogicalLineNumber, + UINT32 LogicalByteOffset, UINT32 Column, - char *SourceLine, char *Filename, - char *ExtraMessage) + char *ExtraMessage, + char *SourceLine, + ASL_ERROR_MSG *SubError) { - char *MessageBuffer = NULL; - char *LineBuffer; ASL_ERROR_MSG *Enode; - Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); + *InputEnode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); + Enode = *InputEnode; + Enode->Level = Level; + Enode->MessageId = MessageId; + Enode->LineNumber = LineNumber; + Enode->LogicalLineNumber = LogicalLineNumber; + Enode->LogicalByteOffset = LogicalByteOffset; + Enode->Column = Column; + Enode->SubError = SubError; + Enode->Message = NULL; + Enode->SourceLine = NULL; + Enode->Filename = NULL; if (ExtraMessage) { /* Allocate a buffer for the message and a new error node */ - MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1); + Enode->Message = UtLocalCacheCalloc (strlen (ExtraMessage) + 1); /* Keep a copy of the extra message */ - strcpy (MessageBuffer, ExtraMessage); + strcpy (Enode->Message, ExtraMessage); } - LineBuffer = UtLocalCalloc (strlen (SourceLine) + 1); - strcpy (LineBuffer, SourceLine); + if (SourceLine) + { + Enode->SourceLine = UtLocalCalloc (strlen (SourceLine) + 1); + strcpy (Enode->SourceLine, SourceLine); + } - /* Initialize the error node */ if (Filename) { @@ -698,28 +855,39 @@ AslCommonError2 ( Enode->FilenameLength = 6; } } +} - Enode->MessageId = MessageId; - Enode->Level = Level; - Enode->LineNumber = LineNumber; - Enode->LogicalLineNumber = LineNumber; - Enode->LogicalByteOffset = 0; - Enode->Column = Column; - Enode->Message = MessageBuffer; - Enode->SourceLine = LineBuffer; - - /* Add the new node to the error node list */ - - AeAddToErrorLog (Enode); - - if (Gbl_DebugFlag) - { - /* stderr is a file, send error to it immediately */ - AePrintException (ASL_FILE_STDERR, Enode, NULL); - } +/******************************************************************************* + * + * FUNCTION: AslCommonError2 + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * LineNumber - Actual file line number + * Column - Column in current line + * SourceLine - Actual source code line + * Filename - source filename + * ExtraMessage - additional error message + * + * RETURN: None + * + * DESCRIPTION: Create a new error node and add it to the error log + * + ******************************************************************************/ - Gbl_ExceptionCount[Level]++; +void +AslCommonError2 ( + UINT8 Level, + UINT16 MessageId, + UINT32 LineNumber, + UINT32 Column, + char *SourceLine, + char *Filename, + char *ExtraMessage) +{ + AslLogNewError (Level, MessageId, LineNumber, LineNumber, 0, Column, + Filename, ExtraMessage, SourceLine, NULL); } @@ -753,43 +921,51 @@ AslCommonError ( char *Filename, char *ExtraMessage) { - char *MessageBuffer = NULL; - ASL_ERROR_MSG *Enode; - - - Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); - - if (ExtraMessage) - { - /* Allocate a buffer for the message and a new error node */ - - MessageBuffer = UtStringCacheCalloc (strlen (ExtraMessage) + 1); - - /* Keep a copy of the extra message */ + AslLogNewError (Level, MessageId, CurrentLineNumber, LogicalLineNumber, + LogicalByteOffset, Column, Filename, ExtraMessage, + NULL, NULL); +} - strcpy (MessageBuffer, ExtraMessage); - } - /* Initialize the error node */ +/******************************************************************************* + * + * FUNCTION: AslLogNewError + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer + * CurrentLineNumber - Actual file line number + * LogicalLineNumber - Cumulative line number + * LogicalByteOffset - Byte offset in source file + * Column - Column in current line + * Filename - source filename + * Message - additional error message + * SourceLine - Actual line of source code + * SubError - Sub-error associated with this error + * + * RETURN: None + * + * DESCRIPTION: Create a new error node and add it to the error log + * + ******************************************************************************/ +static void +AslLogNewError ( + UINT8 Level, + UINT16 MessageId, + UINT32 LineNumber, + UINT32 LogicalLineNumber, + UINT32 LogicalByteOffset, + UINT32 Column, + char *Filename, + char *Message, + char *SourceLine, + ASL_ERROR_MSG *SubError) +{ + ASL_ERROR_MSG *Enode = NULL; - if (Filename) - { - Enode->Filename = Filename; - Enode->FilenameLength = strlen (Filename); - if (Enode->FilenameLength < 6) - { - Enode->FilenameLength = 6; - } - } - Enode->MessageId = MessageId; - Enode->Level = Level; - Enode->LineNumber = CurrentLineNumber; - Enode->LogicalLineNumber = LogicalLineNumber; - Enode->LogicalByteOffset = LogicalByteOffset; - Enode->Column = Column; - Enode->Message = MessageBuffer; - Enode->SourceLine = NULL; + AslInitEnode (&Enode, Level, MessageId, LineNumber, LogicalLineNumber, + LogicalByteOffset, Column, Filename, Message, SourceLine, + SubError); /* Add the new node to the error node list */ @@ -820,8 +996,8 @@ AslCommonError ( * * FUNCTION: AslIsExceptionIgnored * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer * * RETURN: BOOLEAN * @@ -835,7 +1011,7 @@ AslIsExceptionIgnored ( UINT8 Level, UINT16 MessageId) { - BOOLEAN ExceptionIgnored; + BOOLEAN ExceptionIgnored; /* Note: this allows exception to be disabled and expected */ @@ -864,7 +1040,8 @@ void AslCheckExpectedExceptions ( void) { - UINT8 i; + UINT8 i; + for (i = 0; i < Gbl_ExpectedMessagesIndex; ++i) { @@ -949,9 +1126,9 @@ AslDisableException ( MessageId = (UINT32) strtoul (MessageIdString, NULL, 0); - if ((MessageId < 2000) || (MessageId > 5999)) + if ((MessageId < 2000) || (MessageId > 6999)) { - printf ("\"%s\" is not a valid warning/remark ID\n", + printf ("\"%s\" is not a valid warning/remark/error ID\n", MessageIdString); return (AE_BAD_PARAMETER); } @@ -975,8 +1152,8 @@ AslDisableException ( * * FUNCTION: AslIsExceptionDisabled * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MessageId - Index into global message buffer * * RETURN: TRUE if exception/message should be ignored * @@ -994,9 +1171,8 @@ AslIsExceptionExpected ( UINT32 i; - /* - * Mark this exception as received - */ + /* Mark this exception as received */ + EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); for (i = 0; i < Gbl_ExpectedMessagesIndex; i++) { @@ -1050,8 +1226,9 @@ AslIsExceptionDisabled ( case ASL_WARNING: case ASL_REMARK: + case ASL_ERROR: /* - * Ignore this warning/remark if it has been disabled by + * Ignore this error/warning/remark if it has been disabled by * the user (-vw option) */ EncodedMessageId = AeBuildFullExceptionCode (Level, MessageId); @@ -1074,6 +1251,61 @@ AslIsExceptionDisabled ( } +/******************************************************************************* + * + * FUNCTION: AslDualParseOpError + * + * PARAMETERS: Level - Seriousness (Warning/error, etc.) + * MainMsgId - Index into global message buffer + * MainOp - Parse node where error happened + * MainMsg - Message pertaining to the MainOp + * SubMsgId - Index into global message buffer + * SubOp - Additional parse node for better message + * SubMsg - Message pertainint to SubOp + * + * + * RETURN: None + * + * DESCRIPTION: Main error reporting routine for the ASL compiler for error + * messages that point to multiple parse objects. + * + ******************************************************************************/ + +void +AslDualParseOpError ( + UINT8 Level, + UINT16 MainMsgId, + ACPI_PARSE_OBJECT *MainOp, + char *MainMsg, + UINT16 SubMsgId, + ACPI_PARSE_OBJECT *SubOp, + char *SubMsg) +{ + ASL_ERROR_MSG *SubEnode = NULL; + + + /* Check if user wants to ignore this exception */ + + if (AslIsExceptionIgnored (Level, MainMsgId) || !MainOp) + { + return; + } + + if (SubOp) + { + AslInitEnode (&SubEnode, Level, SubMsgId, SubOp->Asl.LineNumber, + SubOp->Asl.LogicalLineNumber, SubOp->Asl.LogicalByteOffset, + SubOp->Asl.Column, SubOp->Asl.Filename, SubMsg, + NULL, NULL); + } + + AslLogNewError (Level, MainMsgId, MainOp->Asl.LineNumber, + MainOp->Asl.LogicalLineNumber, MainOp->Asl.LogicalByteOffset, + MainOp->Asl.Column, MainOp->Asl.Filename, MainMsg, + NULL, SubEnode); +} + + /******************************************************************************* * * FUNCTION: AslError @@ -1097,14 +1329,6 @@ AslError ( ACPI_PARSE_OBJECT *Op, char *ExtraMessage) { - - /* Check if user wants to ignore this exception */ - - if (AslIsExceptionIgnored (Level, MessageId)) - { - return; - } - if (Op) { AslCommonError (Level, MessageId, Op->Asl.LineNumber, diff --git a/sys/contrib/dev/acpica/compiler/aslfiles.c b/sys/contrib/dev/acpica/compiler/aslfiles.c index 1ebfb9f48ff..5cb42742965 100644 --- a/sys/contrib/dev/acpica/compiler/aslfiles.c +++ b/sys/contrib/dev/acpica/compiler/aslfiles.c @@ -151,7 +151,6 @@ #include #include -#include #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslfiles") @@ -326,14 +325,14 @@ FlMergePathnames ( (*FilePathname == '/') || (FilePathname[1] == ':')) { - Pathname = UtStringCacheCalloc (strlen (FilePathname) + 1); + Pathname = UtLocalCacheCalloc (strlen (FilePathname) + 1); strcpy (Pathname, FilePathname); goto ConvertBackslashes; } /* Need a local copy of the prefix directory path */ - CommonPath = UtStringCacheCalloc (strlen (PrefixDir) + 1); + CommonPath = UtLocalCacheCalloc (strlen (PrefixDir) + 1); strcpy (CommonPath, PrefixDir); /* @@ -369,7 +368,7 @@ FlMergePathnames ( /* Build the final merged pathname */ ConcatenatePaths: - Pathname = UtStringCacheCalloc ( + Pathname = UtLocalCacheCalloc ( strlen (CommonPath) + strlen (FilePathname) + 2); if (LastElement && *CommonPath) { @@ -619,7 +618,7 @@ FlOpenAmlOutputFile ( if (!Filename) { /* Create the output AML filename */ - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); } diff --git a/sys/contrib/dev/acpica/compiler/aslhelp.c b/sys/contrib/dev/acpica/compiler/aslhelp.c index 38e23450022..ed3a33298fa 100644 --- a/sys/contrib/dev/acpica/compiler/aslhelp.c +++ b/sys/contrib/dev/acpica/compiler/aslhelp.c @@ -173,6 +173,7 @@ void Usage ( void) { + printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); printf ("%s\n\n", ASL_COMPLIANCE); ACPI_USAGE_HEADER ("iasl [Options] [Files]"); @@ -203,7 +204,7 @@ Usage ( ACPI_OPTION ("-ve", "Report only errors (ignore warnings and remarks)"); ACPI_OPTION ("-vi", "Less verbose errors and warnings for use with IDEs"); ACPI_OPTION ("-vr", "Disable remarks"); - ACPI_OPTION ("-vw ", "Disable specific warning or remark"); + ACPI_OPTION ("-vw ", "Ignore specific error, warning or remark"); ACPI_OPTION ("-vx ", "Expect a specific warning, remark, or error"); ACPI_OPTION ("-w <1|2|3>", "Set warning reporting level"); ACPI_OPTION ("-we", "Report warnings as errors"); diff --git a/sys/contrib/dev/acpica/compiler/aslload.c b/sys/contrib/dev/acpica/compiler/aslload.c index 7480f232afb..19864533267 100644 --- a/sys/contrib/dev/acpica/compiler/aslload.c +++ b/sys/contrib/dev/acpica/compiler/aslload.c @@ -327,8 +327,9 @@ LdLoadFieldElements ( * The name already exists in this scope * But continue processing the elements */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, - Child->Asl.Value.String); + AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, + Child->Asl.Value.String, ASL_MSG_FOUND_HERE, Node->Op, + Node->Op->Asl.ExternalName); } } else @@ -388,8 +389,10 @@ LdLoadResourceElements ( { /* Actual node causing the error was saved in ParentMethod */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, - (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath); + AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, + (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, + Op->Asl.Namepath, ASL_MSG_FOUND_HERE, Node->Op, + Node->Op->Asl.ExternalName); return (AE_OK); } return (Status); @@ -805,8 +808,8 @@ LdNamespace1Begin ( /* * Allow one create on an object or segment that was * previously declared External only if WalkState->OwnerId and - * Node->OwnerId are found in different tables (meaning that - * they have differnt OwnerIds). + * Node->OwnerId are different (meaning that the current WalkState + * and the Node are in different tables). */ Node->Flags &= ~ANOBJ_IS_EXTERNAL; Node->Type = (UINT8) ObjectType; @@ -827,8 +830,9 @@ LdNamespace1Begin ( if (Node->OwnerId == WalkState->OwnerId && !(Node->Flags & IMPLICIT_EXTERNAL)) { - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, - Op->Asl.ExternalName); + AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op, + Node->Op->Asl.ExternalName); } if (Node->Flags & IMPLICIT_EXTERNAL) { @@ -849,8 +853,9 @@ LdNamespace1Begin ( if (Node->OwnerId == WalkState->OwnerId) { - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, - Op->Asl.ExternalName); + AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op, + Node->Op->Asl.ExternalName); } } else if ((Node->Flags & ANOBJ_IS_EXTERNAL) && @@ -905,8 +910,9 @@ LdNamespace1Begin ( { /* Valid error, object already exists */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, - Op->Asl.ExternalName); + AslDualParseOpError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, + Op->Asl.ExternalName, ASL_MSG_FOUND_HERE, Node->Op, + Node->Op->Asl.ExternalName); return_ACPI_STATUS (AE_OK); } } diff --git a/sys/contrib/dev/acpica/compiler/aslmain.c b/sys/contrib/dev/acpica/compiler/aslmain.c index 9c73aee267a..3b939f5fff1 100644 --- a/sys/contrib/dev/acpica/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/compiler/aslmain.c @@ -386,11 +386,11 @@ AslInitialize ( AcpiGbl_DmOpt_Verbose = FALSE; - /* Default integer width is 64 bits */ + /* Default integer width is 32 bits */ - AcpiGbl_IntegerBitWidth = 64; - AcpiGbl_IntegerNybbleWidth = 16; - AcpiGbl_IntegerByteWidth = 8; + AcpiGbl_IntegerBitWidth = 32; + AcpiGbl_IntegerNybbleWidth = 8; + AcpiGbl_IntegerByteWidth = 4; for (i = 0; i < ASL_NUM_FILES; i++) { diff --git a/sys/contrib/dev/acpica/compiler/aslmapenter.c b/sys/contrib/dev/acpica/compiler/aslmapenter.c index 6e391097eab..8476654e40a 100644 --- a/sys/contrib/dev/acpica/compiler/aslmapenter.c +++ b/sys/contrib/dev/acpica/compiler/aslmapenter.c @@ -332,7 +332,7 @@ MpCreateGpioInfo ( * sorted by both source device name and then the pin number. There is * one block per pin. */ - Buffer = UtStringCacheCalloc (sizeof (ACPI_GPIO_INFO)); + Buffer = UtLocalCacheCalloc (sizeof (ACPI_GPIO_INFO)); Info = ACPI_CAST_PTR (ACPI_GPIO_INFO, Buffer); NextGpio = Gbl_GpioList; @@ -409,7 +409,7 @@ MpCreateSerialInfo ( * Allocate a new info block and insert it into the global Serial list * sorted by both source device name and then the address. */ - Buffer = UtStringCacheCalloc (sizeof (ACPI_SERIAL_INFO)); + Buffer = UtLocalCacheCalloc (sizeof (ACPI_SERIAL_INFO)); Info = ACPI_CAST_PTR (ACPI_SERIAL_INFO, Buffer); NextSerial = Gbl_SerialList; diff --git a/sys/contrib/dev/acpica/compiler/aslmaputils.c b/sys/contrib/dev/acpica/compiler/aslmaputils.c index c17f090cea6..37333041203 100644 --- a/sys/contrib/dev/acpica/compiler/aslmaputils.c +++ b/sys/contrib/dev/acpica/compiler/aslmaputils.c @@ -212,7 +212,7 @@ MpGetHidFromParseTree ( /* Convert EISAID to a string */ - HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE); + HidString = UtLocalCacheCalloc (ACPI_EISAID_STRING_SIZE); AcpiExEisaIdToString (HidString, Arg->Asl.Value.Integer); return (HidString); @@ -277,7 +277,7 @@ MpGetHidValue ( /* Convert EISAID to a string */ - HidString = UtStringCacheCalloc (ACPI_EISAID_STRING_SIZE); + HidString = UtLocalCacheCalloc (ACPI_EISAID_STRING_SIZE); AcpiExEisaIdToString (HidString, HidNode->Object->Integer.Value); return (HidString); diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.c b/sys/contrib/dev/acpica/compiler/aslmessages.c index d3d28c804b3..1ced6547951 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.c +++ b/sys/contrib/dev/acpica/compiler/aslmessages.c @@ -238,7 +238,7 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_HID_SUFFIX */ "_HID suffix must be all hex digits", /* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", /* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating (DSDT or SSDT version < 2)", +/* ASL_MSG_INTEGER_LENGTH */ "Truncating 64-bit constant found in 32-bit table", /* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", /* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", /* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", @@ -349,7 +349,10 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_ARG_NOT_USED */ "Method Argument is never used", /* ASL_MSG_CONSTANT_REQUIRED */ "Non-reducible expression", /* ASL_MSG_CROSS_TABLE_SCOPE */ "Illegal open scope on external object from within DSDT", -/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:" +/* ASL_MSG_EXCEPTION_NOT_RECEIVED */ "Expected remark, warning, or error did not occur. Message ID:", +/* ASL_MSG_NULL_RESOURCE_TEMPLATE */ "Empty Resource Template (END_TAG only)", +/* ASL_MSG_FOUND_HERE */ "Original name creation/declaration below: ", +/* ASL_MSG_ILLEGAL_RECURSION */ "Illegal recursive call to method that creates named objects" }; /* Table compiler */ diff --git a/sys/contrib/dev/acpica/compiler/aslmessages.h b/sys/contrib/dev/acpica/compiler/aslmessages.h index 68216e5c075..a80184016ce 100644 --- a/sys/contrib/dev/acpica/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/compiler/aslmessages.h @@ -352,6 +352,9 @@ typedef enum ASL_MSG_CONSTANT_REQUIRED, ASL_MSG_CROSS_TABLE_SCOPE, ASL_MSG_EXCEPTION_NOT_RECEIVED, + ASL_MSG_NULL_RESOURCE_TEMPLATE, + ASL_MSG_FOUND_HERE, + ASL_MSG_ILLEGAL_RECURSION, /* These messages are used by the Data Table compiler only */ diff --git a/sys/contrib/dev/acpica/compiler/aslmethod.c b/sys/contrib/dev/acpica/compiler/aslmethod.c index a4b1c6f97f7..ca48bc82133 100644 --- a/sys/contrib/dev/acpica/compiler/aslmethod.c +++ b/sys/contrib/dev/acpica/compiler/aslmethod.c @@ -347,10 +347,31 @@ MtMethodAnalysisWalkBegin ( case PARSEOP_METHODCALL: + /* Check for a recursive method call */ + if (MethodInfo && (Op->Asl.Node == MethodInfo->Op->Asl.Node)) { - AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName); + if (MethodInfo->CreatesNamedObjects) + { + /* + * This is an error, as it will fail at runtime on all ACPI + * implementations. Any named object declarations will be + * executed twice, causing failure the second time. Note, + * this is independent of whether the method is declared + * Serialized, because the same thread is attempting to + * reenter the method, and this will always succeed. + */ + AslDualParseOpError (ASL_ERROR, ASL_MSG_ILLEGAL_RECURSION, Op, + Op->Asl.Value.String, ASL_MSG_FOUND_HERE, MethodInfo->Op, + MethodInfo->Op->Asl.ExternalName); + } + else + { + /* Method does not create objects, issue a remark */ + + AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName); + } } break; @@ -622,20 +643,28 @@ MtCheckNamedObjectInMethod ( return; } - /* Determine if we are creating a named object */ + /* Determine if we are creating a named object within a method */ + + if (!MethodInfo) + { + return; + } OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); if (OpInfo->Class == AML_CLASS_NAMED_OBJECT) { /* - * If we have a named object created within a non-serialized method, - * emit a remark that the method should be serialized. + * 1) Mark the method as a method that creates named objects. + * + * 2) If the method is non-serialized, emit a remark that the method + * should be serialized. * * Reason: If a thread blocks within the method for any reason, and - * another thread enters the method, the method will fail because an - * attempt will be made to create the same object twice. + * another thread enters the method, the method will fail because + * an attempt will be made to create the same object twice. */ - if (MethodInfo && !MethodInfo->ShouldBeSerialized) + MethodInfo->CreatesNamedObjects = TRUE; + if (!MethodInfo->ShouldBeSerialized) { AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op, "due to creation of named objects within"); diff --git a/sys/contrib/dev/acpica/compiler/asloperands.c b/sys/contrib/dev/acpica/compiler/asloperands.c index 0a5f1443911..c6e001fe49b 100644 --- a/sys/contrib/dev/acpica/compiler/asloperands.c +++ b/sys/contrib/dev/acpica/compiler/asloperands.c @@ -1037,7 +1037,7 @@ OpnDoDefinitionBlock ( * We will use the AML filename that is embedded in the source file * for the output filename. */ - Filename = UtStringCacheCalloc (strlen (Gbl_DirectoryPath) + + Filename = UtLocalCacheCalloc (strlen (Gbl_DirectoryPath) + strlen ((char *) Child->Asl.Value.Buffer) + 1); /* Prepend the current directory path */ @@ -1094,7 +1094,7 @@ OpnDoDefinitionBlock ( if (Child->Asl.Value.String) { Length = strlen (Child->Asl.Value.String); - Gbl_TableId = UtStringCacheCalloc (Length + 1); + Gbl_TableId = UtLocalCacheCalloc (Length + 1); strcpy (Gbl_TableId, Child->Asl.Value.String); /* diff --git a/sys/contrib/dev/acpica/compiler/aslopt.c b/sys/contrib/dev/acpica/compiler/aslopt.c index 0019a07cbf4..6aaa386a59d 100644 --- a/sys/contrib/dev/acpica/compiler/aslopt.c +++ b/sys/contrib/dev/acpica/compiler/aslopt.c @@ -275,7 +275,7 @@ OptSearchToRoot ( /* We must allocate a new string for the name (TargetPath gets deleted) */ - *NewPath = UtStringCacheCalloc (ACPI_NAME_SIZE + 1); + *NewPath = UtLocalCacheCalloc (ACPI_NAME_SIZE + 1); strcpy (*NewPath, Path); if (strncmp (*NewPath, "_T_", 3)) diff --git a/sys/contrib/dev/acpica/compiler/asloptions.c b/sys/contrib/dev/acpica/compiler/asloptions.c index a22949bb631..d792b735333 100644 --- a/sys/contrib/dev/acpica/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/compiler/asloptions.c @@ -204,7 +204,6 @@ AslCommandLine ( if (argc < 2) { - printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); Usage (); exit (1); } @@ -324,7 +323,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DebugAslConversion = TRUE; AcpiGbl_DmEmitExternalOpcodes = TRUE; @@ -392,7 +391,7 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; + AcpiGbl_CaptureComments = TRUE; AcpiGbl_DoDisassemblerOptimizations = FALSE; AcpiGbl_DmEmitExternalOpcodes = TRUE; Gbl_DoExternalsInPlace = TRUE; @@ -417,25 +416,11 @@ AslDoOptions ( { case '^': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; break; case 'a': - /* Get the required argument */ - - if (AcpiGetoptArgument (argc, argv)) - { - return (-1); - } - Gbl_DoCompile = FALSE; Gbl_DisassembleAll = TRUE; break; @@ -538,7 +523,6 @@ AslDoOptions ( { case '^': - printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); Usage (); exit (0); @@ -798,8 +782,8 @@ AslDoOptions ( Gbl_IntegerOptimizationFlag = FALSE; Gbl_ReferenceOptimizationFlag = FALSE; Gbl_OptimizeTrivialParseNodes = FALSE; - Gbl_CaptureComments = TRUE; Gbl_DoExternalsInPlace = TRUE; + AcpiGbl_CaptureComments = TRUE; return (0); case 'r': /* Override revision found in table header */ diff --git a/sys/contrib/dev/acpica/compiler/aslparseop.c b/sys/contrib/dev/acpica/compiler/aslparseop.c index f23091bb62f..f121401a92a 100644 --- a/sys/contrib/dev/acpica/compiler/aslparseop.c +++ b/sys/contrib/dev/acpica/compiler/aslparseop.c @@ -158,13 +158,6 @@ ACPI_MODULE_NAME ("aslparseop") -/* Local prototypes */ - -static ACPI_PARSE_OBJECT * -TrGetOpFromCache ( - void); - - /******************************************************************************* * * FUNCTION: TrCreateOp @@ -276,7 +269,7 @@ TrCreateOp ( * FirstChild place it in the parent. This also means that * legitimate comments for the child gets put to the parent. */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && ((ParseOpcode == PARSEOP_CONNECTION) || (ParseOpcode == PARSEOP_EXTERNAL) || (ParseOpcode == PARSEOP_OFFSET) || @@ -315,7 +308,7 @@ TrCreateOp ( /* Get the comment from last child in the resource template call */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (Op->Asl.ParseOpcode == PARSEOP_RESOURCETEMPLATE)) { CvDbgPrint ("Transferred current comment list to this op.\n"); @@ -490,7 +483,7 @@ TrCreateTargetOp ( return (NULL); } - Op = TrGetOpFromCache (); + Op = UtParseOpCacheCalloc (); /* Copy the pertinent values (omit link pointer fields) */ @@ -788,7 +781,7 @@ TrAllocateOp ( ACPI_PARSE_OBJECT *LatestOp; - Op = TrGetOpFromCache (); + Op = UtParseOpCacheCalloc (); Op->Asl.ParseOpcode = (UINT16) ParseOpcode; Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename; @@ -801,7 +794,7 @@ TrAllocateOp ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { LatestOp = Gbl_CommentState.LatestParseOp; Op->Asl.InlineComment = NULL; @@ -875,50 +868,6 @@ TrAllocateOp ( } -/******************************************************************************* - * - * FUNCTION: TrGetOpFromCache - * - * PARAMETERS: None - * - * RETURN: New parse op. Aborts on allocation failure - * - * DESCRIPTION: Allocate a new parse op for the parse tree. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -static ACPI_PARSE_OBJECT * -TrGetOpFromCache ( - void) -{ - ASL_CACHE_INFO *Cache; - - - if (Gbl_ParseOpCacheNext >= Gbl_ParseOpCacheLast) - { - /* Allocate a new buffer */ - - Cache = UtLocalCalloc (sizeof (Cache->Next) + - (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE)); - - /* Link new cache buffer to head of list */ - - Cache->Next = Gbl_ParseOpCacheList; - Gbl_ParseOpCacheList = Cache; - - /* Setup cache management pointers */ - - Gbl_ParseOpCacheNext = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Cache->Buffer); - Gbl_ParseOpCacheLast = Gbl_ParseOpCacheNext + ASL_PARSEOP_CACHE_SIZE; - } - - Gbl_ParseOpCount++; - return (Gbl_ParseOpCacheNext++); -} - - /******************************************************************************* * * FUNCTION: TrPrintOpFlags diff --git a/sys/contrib/dev/acpica/compiler/aslprintf.c b/sys/contrib/dev/acpica/compiler/aslprintf.c index a626f24a232..00e218d05df 100644 --- a/sys/contrib/dev/acpica/compiler/aslprintf.c +++ b/sys/contrib/dev/acpica/compiler/aslprintf.c @@ -293,7 +293,7 @@ OpcParsePrintf ( if (StringToProcess) { - NewString = UtStringCacheCalloc (StringLength + 1); + NewString = UtLocalCacheCalloc (StringLength + 1); strncpy (NewString, StartPosition, StringLength); NewOp = TrAllocateOp (PARSEOP_STRING_LITERAL); @@ -382,7 +382,7 @@ OpcParsePrintf ( if (StringToProcess) { - NewString = UtStringCacheCalloc (StringLength + 1); + NewString = UtLocalCacheCalloc (StringLength + 1); strncpy (NewString, StartPosition, StringLength); NewOp = TrAllocateOp (PARSEOP_STRING_LITERAL); diff --git a/sys/contrib/dev/acpica/compiler/aslresource.c b/sys/contrib/dev/acpica/compiler/aslresource.c index 7b8b7e6e81b..32a7652fe05 100644 --- a/sys/contrib/dev/acpica/compiler/aslresource.c +++ b/sys/contrib/dev/acpica/compiler/aslresource.c @@ -1148,6 +1148,14 @@ RsDoResourceTemplate ( DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); + /* DEFAULT_ARG indicates null template - ResourceTemplate(){} */ + + if (DescriptorTypeOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) + { + AslError (ASL_WARNING, ASL_MSG_NULL_RESOURCE_TEMPLATE, + DescriptorTypeOp, DescriptorTypeOp->Asl.Value.String); + } + /* * Process all resource descriptors in the list * Note: It is assumed that the EndTag node has been automatically diff --git a/sys/contrib/dev/acpica/compiler/aslrules.y b/sys/contrib/dev/acpica/compiler/aslrules.y index f26ea874b3a..3b8e4839892 100644 --- a/sys/contrib/dev/acpica/compiler/aslrules.y +++ b/sys/contrib/dev/acpica/compiler/aslrules.y @@ -199,7 +199,8 @@ DefinitionBlockTerm String ',' String ',' DWordConst - PARSEOP_CLOSE_PAREN {TrSetOpEndLineNumber ($3); COMMENT_CAPTURE_ON;} + PARSEOP_CLOSE_PAREN {TrSetOpIntegerWidth ($6,$8); + TrSetOpEndLineNumber ($3); COMMENT_CAPTURE_ON;} '{' TermList '}' {$$ = TrLinkOpChildren ($3,7, $4,$6,$8,$10,$12,$14,$18);} ; diff --git a/sys/contrib/dev/acpica/compiler/aslstartup.c b/sys/contrib/dev/acpica/compiler/aslstartup.c index 8ce0375d296..6a283f00d15 100644 --- a/sys/contrib/dev/acpica/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/compiler/aslstartup.c @@ -233,11 +233,11 @@ AslInitializeGlobals ( Gbl_Files[i].Filename = NULL; } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.SpacesBefore = 0; Gbl_CommentState.CommentType = 1; - Gbl_CommentState.LatestParseOp = NULL; + Gbl_CommentState.LatestParseOp = NULL; Gbl_CommentState.ParsingParenBraceNode = NULL; Gbl_CommentState.CaptureComments = TRUE; } @@ -410,7 +410,7 @@ AslDoDisassembly ( Gbl_Files[ASL_FILE_INPUT].Filename = NULL; - CmDeleteCaches (); + UtDeleteLocalCaches (); return (AE_OK); } @@ -453,7 +453,7 @@ AslDoOneFile ( /* Take a copy of the input filename, convert any backslashes */ Gbl_Files[ASL_FILE_INPUT].Filename = - UtStringCacheCalloc (strlen (Filename) + 1); + UtLocalCacheCalloc (strlen (Filename) + 1); strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); UtConvertBackslashes (Gbl_Files[ASL_FILE_INPUT].Filename); diff --git a/sys/contrib/dev/acpica/compiler/aslsupport.l b/sys/contrib/dev/acpica/compiler/aslsupport.l index 42cee752a95..db243e4a87c 100644 --- a/sys/contrib/dev/acpica/compiler/aslsupport.l +++ b/sys/contrib/dev/acpica/compiler/aslsupport.l @@ -382,7 +382,7 @@ AslPushInputFileStack ( /* Reset the global line count and filename */ Gbl_Files[ASL_FILE_INPUT].Filename = - UtStringCacheCalloc (strlen (Filename) + 1); + UtLocalCacheCalloc (strlen (Filename) + 1); strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); @@ -496,7 +496,7 @@ AslInsertLineBuffer ( AslResetCurrentLineBuffer (); } - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { CvProcessCommentState (SourceChar); } @@ -525,7 +525,7 @@ static void count ( int Type) { - int i; + char *p; switch (Type) @@ -547,9 +547,9 @@ count ( break; } - for (i = 0; (yytext[i] != 0) && (yytext[i] != EOF); i++) + for (p = yytext; *p != '\0'; p++) { - AslInsertLineBuffer (yytext[i]); + AslInsertLineBuffer (*p); *Gbl_LineBufPtr = 0; } } @@ -580,7 +580,7 @@ AslDoComment ( AslInsertLineBuffer ('/'); AslInsertLineBuffer ('*'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = '/'; ++StringBuffer; @@ -595,7 +595,7 @@ loop: while (((c = input ()) != '*') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -623,7 +623,7 @@ loop: /* Comment is closed only if the NEXT character is a slash */ AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -698,7 +698,7 @@ AslDoCommentType2 ( AslInsertLineBuffer ('/'); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { AslInsertLineBuffer ('*'); *StringBuffer = '/'; @@ -714,7 +714,7 @@ AslDoCommentType2 ( while (((c = input ()) != '\n') && (c != EOF)) { AslInsertLineBuffer (c); - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = c; ++StringBuffer; @@ -1009,7 +1009,7 @@ CompletedString: */ *StringBuffer = 0; - CleanString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); + CleanString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); strcpy (CleanString, MsgBuffer); AslCompilerlval.s = CleanString; return (TRUE); diff --git a/sys/contrib/dev/acpica/compiler/asltree.c b/sys/contrib/dev/acpica/compiler/asltree.c index b510d59b1a7..6dc91fb7643 100644 --- a/sys/contrib/dev/acpica/compiler/asltree.c +++ b/sys/contrib/dev/acpica/compiler/asltree.c @@ -253,7 +253,7 @@ TrSetOpIntegerValue ( /* Converter: if this is a method invocation, turn off capture comments */ - if (Gbl_CaptureComments && + if (AcpiGbl_CaptureComments && (ParseOpcode == PARSEOP_METHODCALL)) { Gbl_CommentState.CaptureComments = FALSE; @@ -376,6 +376,39 @@ TrSetOpCurrentFilename ( } +/******************************************************************************* + * + * FUNCTION: TrSetOpIntegerWidth + * + * PARAMETERS: Op - An existing parse op + * + * RETURN: None + * + * DESCRIPTION: + * + ******************************************************************************/ + +void +TrSetOpIntegerWidth ( + ACPI_PARSE_OBJECT *TableSignatureOp, + ACPI_PARSE_OBJECT *RevisionOp) +{ + + /* TBD: Check table sig? (DSDT vs. SSDT) */ + + /* Handle command-line version override */ + + if (Gbl_RevisionOverride) + { + AcpiUtSetIntegerWidth (Gbl_RevisionOverride); + } + else + { + AcpiUtSetIntegerWidth ((UINT8) RevisionOp->Asl.Value.Integer); + } +} + + /******************************************************************************* * * FUNCTION: TrSetOpEndLineNumber @@ -476,7 +509,7 @@ TrLinkOpChildren ( /* The following is for capturing comments */ - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { /* * If there are "regular comments" detected at this point, @@ -557,7 +590,7 @@ TrLinkOpChildren ( va_end(ap); DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - if(Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { Gbl_CommentState.LatestParseOp = Op; CvDbgPrint ("TrLinkOpChildren=====Set latest parse op to this op.\n"); @@ -735,7 +768,7 @@ TrLinkChildOp ( * turn on capture comments as it signifies that we are done parsing * a method call. */ - if (Gbl_CaptureComments && Op1) + if (AcpiGbl_CaptureComments && Op1) { if (Op1->Asl.ParseOpcode == PARSEOP_METHODCALL) { diff --git a/sys/contrib/dev/acpica/compiler/asltypes.h b/sys/contrib/dev/acpica/compiler/asltypes.h index e4250871fd1..f72226d5e0c 100644 --- a/sys/contrib/dev/acpica/compiler/asltypes.h +++ b/sys/contrib/dev/acpica/compiler/asltypes.h @@ -202,6 +202,7 @@ typedef struct asl_method_info UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS]; UINT8 HasBeenTyped; UINT8 ShouldBeSerialized; + UINT8 CreatesNamedObjects; } ASL_METHOD_INFO; @@ -337,8 +338,11 @@ typedef struct asl_include_dir } ASL_INCLUDE_DIR; -/* An entry in the exception list, one for each error/warning */ - +/* + * An entry in the exception list, one for each error/warning + * Note: SubError nodes would be treated with the same messageId and Level + * as the parent error node. + */ typedef struct asl_error_msg { UINT32 LineNumber; @@ -347,6 +351,7 @@ typedef struct asl_error_msg UINT32 Column; char *Message; struct asl_error_msg *Next; + struct asl_error_msg *SubError; char *Filename; char *SourceLine; UINT32 FilenameLength; diff --git a/sys/contrib/dev/acpica/compiler/aslutils.c b/sys/contrib/dev/acpica/compiler/aslutils.c index e4d8eef5e6e..a439db7476a 100644 --- a/sys/contrib/dev/acpica/compiler/aslutils.c +++ b/sys/contrib/dev/acpica/compiler/aslutils.c @@ -174,12 +174,6 @@ UtAttachNameseg ( ACPI_PARSE_OBJECT *Op, char *Name); -static void -UtReallocLineBuffers ( - char **Buffer, - UINT32 OldSize, - UINT32 NewSize); - /******************************************************************************* * @@ -309,45 +303,6 @@ UtDisplayConstantOpcodes ( } -/******************************************************************************* - * - * FUNCTION: UtLocalCalloc - * - * PARAMETERS: Size - Bytes to be allocated - * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. - * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an - * allocation failure, on the assumption that nothing more can be - * accomplished. - * - ******************************************************************************/ - -void * -UtLocalCalloc ( - UINT32 Size) -{ - void *Allocated; - - - Allocated = ACPI_ALLOCATE_ZEROED (Size); - if (!Allocated) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - - CmCleanupAndExit (); - exit (1); - } - - TotalAllocations++; - TotalAllocated += Size; - return (Allocated); -} - - /******************************************************************************* * * FUNCTION: UtBeginEvent @@ -467,7 +422,7 @@ UtSetParseOpName ( ACPI_PARSE_OBJECT *Op) { - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), + AcpiUtSafeStrncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), ACPI_MAX_PARSEOP_NAME); } @@ -635,180 +590,6 @@ UtCheckIntegerRange ( } -/******************************************************************************* - * - * FUNCTION: UtStringCacheCalloc - * - * PARAMETERS: Length - Size of buffer requested - * - * 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 - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -char * -UtStringCacheCalloc ( - UINT32 Length) -{ - char *Buffer; - ASL_CACHE_INFO *Cache; - UINT32 CacheSize = ASL_STRING_CACHE_SIZE; - - - if (Length > CacheSize) - { - CacheSize = Length; - - if (Gbl_StringCacheList) - { - Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); - - /* Link new cache buffer just following head of list */ - - Cache->Next = Gbl_StringCacheList->Next; - Gbl_StringCacheList->Next = Cache; - - /* Leave cache management pointers alone as they pertain to head */ - - Gbl_StringCount++; - Gbl_StringSize += Length; - - return (Cache->Buffer); - } - } - - if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) - { - /* Allocate a new buffer */ - - Cache = UtLocalCalloc (sizeof (Cache->Next) + CacheSize); - - /* Link new cache buffer to head of list */ - - Cache->Next = Gbl_StringCacheList; - Gbl_StringCacheList = Cache; - - /* Setup cache management pointers */ - - Gbl_StringCacheNext = Cache->Buffer; - Gbl_StringCacheLast = Gbl_StringCacheNext + CacheSize; - } - - Gbl_StringCount++; - Gbl_StringSize += Length; - - Buffer = Gbl_StringCacheNext; - Gbl_StringCacheNext += Length; - return (Buffer); -} - - -/****************************************************************************** - * - * FUNCTION: UtExpandLineBuffers - * - * PARAMETERS: None. Updates global line buffer pointers. - * - * RETURN: None. Reallocates the global line buffers - * - * DESCRIPTION: Called if the current line buffer becomes filled. Reallocates - * all global line buffers and updates Gbl_LineBufferSize. NOTE: - * Also used for the initial allocation of the buffers, when - * all of the buffer pointers are NULL. Initial allocations are - * of size ASL_DEFAULT_LINE_BUFFER_SIZE - * - *****************************************************************************/ - -void -UtExpandLineBuffers ( - void) -{ - UINT32 NewSize; - - - /* Attempt to double the size of all line buffers */ - - NewSize = Gbl_LineBufferSize * 2; - if (Gbl_CurrentLineBuffer) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "Increasing line buffer size from %u to %u\n", - Gbl_LineBufferSize, NewSize); - } - - UtReallocLineBuffers (&Gbl_CurrentLineBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_MainTokenBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_MacroTokenBuffer, Gbl_LineBufferSize, NewSize); - UtReallocLineBuffers (&Gbl_ExpressionTokenBuffer, Gbl_LineBufferSize, NewSize); - - Gbl_LineBufPtr = Gbl_CurrentLineBuffer; - Gbl_LineBufferSize = NewSize; -} - - -/****************************************************************************** - * - * FUNCTION: UtReallocLineBuffers - * - * PARAMETERS: Buffer - Buffer to realloc - * OldSize - Old size of Buffer - * NewSize - New size of Buffer - * - * RETURN: none - * - * DESCRIPTION: Reallocate and initialize Buffer - * - *****************************************************************************/ - -static void -UtReallocLineBuffers ( - char **Buffer, - UINT32 OldSize, - UINT32 NewSize) -{ - - *Buffer = realloc (*Buffer, NewSize); - if (*Buffer) - { - memset (*Buffer + OldSize, 0, NewSize - OldSize); - return; - } - - printf ("Could not increase line buffer size from %u to %u\n", - OldSize, NewSize); - - AslError (ASL_ERROR, ASL_MSG_BUFFER_ALLOCATION, NULL, NULL); - AslAbort (); -} - - -/****************************************************************************** - * - * FUNCTION: UtFreeLineBuffers - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Free all line buffers - * - *****************************************************************************/ - -void -UtFreeLineBuffers ( - void) -{ - - free (Gbl_CurrentLineBuffer); - free (Gbl_MainTokenBuffer); - free (Gbl_MacroTokenBuffer); - free (Gbl_ExpressionTokenBuffer); -} - - /******************************************************************************* * * FUNCTION: UtInternalizeName @@ -843,7 +624,7 @@ UtInternalizeName ( /* We need a segment to store the internal name */ - Info.InternalName = UtStringCacheCalloc (Info.Length); + Info.InternalName = UtLocalCacheCalloc (Info.Length); /* Build the name */ @@ -1004,11 +785,11 @@ UtAttachNamepathToOwner ( * * FUNCTION: UtDoConstant * - * PARAMETERS: String - Hexadecimal or decimal string + * PARAMETERS: String - Hex/Decimal/Octal * * RETURN: Converted Integer * - * DESCRIPTION: Convert a string to an integer, with error checking. + * DESCRIPTION: Convert a string to an integer, with overflow/error checking. * ******************************************************************************/ @@ -1017,17 +798,20 @@ UtDoConstant ( char *String) { ACPI_STATUS Status; - UINT64 Converted; + UINT64 ConvertedInteger; char ErrBuf[64]; - Status = AcpiUtStrtoul64 (String, ACPI_STRTOUL_64BIT, &Converted); + Status = AcpiUtStrtoul64 (String, &ConvertedInteger); if (ACPI_FAILURE (Status)) { - sprintf (ErrBuf, "%s %s\n", "Conversion error:", + sprintf (ErrBuf, "While creating 64-bit constant: %s\n", AcpiFormatException (Status)); - AslCompilererror (ErrBuf); + + AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, + Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, + Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, ErrBuf); } - return (Converted); + return (ConvertedInteger); } diff --git a/sys/contrib/dev/acpica/compiler/cvcompiler.c b/sys/contrib/dev/acpica/compiler/cvcompiler.c index 57eef4b682b..534560a2577 100644 --- a/sys/contrib/dev/acpica/compiler/cvcompiler.c +++ b/sys/contrib/dev/acpica/compiler/cvcompiler.c @@ -186,14 +186,14 @@ CvProcessComment ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = (char) c1; ++StringBuffer; *StringBuffer = 0; CvDbgPrint ("Multi-line comment\n"); - CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); + CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); strcpy (CommentString, MsgBuffer); CvDbgPrint ("CommentString: %s\n", CommentString); @@ -208,7 +208,7 @@ CvProcessComment ( if (LineToken) { - FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1); + FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1); strcpy (FinalLineToken, LineToken); /* Get rid of any carriage returns */ @@ -238,7 +238,7 @@ CvProcessComment ( } } - FinalLineToken = UtStringCacheCalloc (strlen (LineToken) + 1); + FinalLineToken = UtLocalCacheCalloc (strlen (LineToken) + 1); strcat (FinalLineToken, LineToken); /* Get rid of any carriage returns */ @@ -268,7 +268,7 @@ CvProcessComment ( * spacing. */ FinalCommentString = - UtStringCacheCalloc (strlen (CommentString) + + UtLocalCacheCalloc (strlen (CommentString) + CurrentState.SpacesBefore + 1); for (i = 0; (CurrentState.CommentType != ASL_COMMENT_STANDARD) && @@ -309,11 +309,11 @@ CvProcessCommentType2 ( char *FinalCommentString; - if (Gbl_CaptureComments && CurrentState.CaptureComments) + if (AcpiGbl_CaptureComments && CurrentState.CaptureComments) { *StringBuffer = 0; /* null terminate */ CvDbgPrint ("Single-line comment\n"); - CommentString = UtStringCacheCalloc (strlen (MsgBuffer) + 1); + CommentString = UtLocalCacheCalloc (strlen (MsgBuffer) + 1); strcpy (CommentString, MsgBuffer); /* If this comment lies on the same line as the latest parse op, @@ -342,7 +342,7 @@ CvProcessCommentType2 ( * [ (spaces) (comment) ( * /) ('\0') ] * */ - FinalCommentString = UtStringCacheCalloc (CurrentState.SpacesBefore + + FinalCommentString = UtLocalCacheCalloc (CurrentState.SpacesBefore + strlen (CommentString) + 3 + 1); for (i = 0; (CurrentState.CommentType != 1) && @@ -395,7 +395,7 @@ CvCalculateCommentLengths( ACPI_COMMENT_NODE *Current = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return (0); } @@ -497,7 +497,7 @@ CgWriteAmlDefBlockComment( char *DirectoryPosition; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || (Op->Asl.ParseOpcode != PARSEOP_DEFINITION_BLOCK)) { return; @@ -507,7 +507,7 @@ CgWriteAmlDefBlockComment( /* First, print the file name comment after changing .asl to .dsl */ - NewFilename = UtStringCacheCalloc (strlen (Op->Asl.Filename)); + NewFilename = UtLocalCacheCalloc (strlen (Op->Asl.Filename)); strcpy (NewFilename, Op->Asl.Filename); DirectoryPosition = strrchr (NewFilename, '/'); Position = strrchr (NewFilename, '.'); @@ -615,7 +615,7 @@ CgWriteAmlComment( if ((Op->Asl.ParseOpcode == PARSEOP_DEFINITION_BLOCK) || - !Gbl_CaptureComments) + !AcpiGbl_CaptureComments) { return; } @@ -944,7 +944,7 @@ CvAppendInlineComment ( Size = strlen (ToAdd); Size += strlen (InlineComment); - Str = UtStringCacheCalloc (Size + 1); + Str = UtLocalCacheCalloc (Size + 1); strcpy (Str, InlineComment); strcat (Str, ToAdd); diff --git a/sys/contrib/dev/acpica/compiler/cvdisasm.c b/sys/contrib/dev/acpica/compiler/cvdisasm.c index 25deb730708..93ad510be37 100644 --- a/sys/contrib/dev/acpica/compiler/cvdisasm.c +++ b/sys/contrib/dev/acpica/compiler/cvdisasm.c @@ -352,7 +352,7 @@ CvCloseBraceWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf ("}"); return; @@ -385,7 +385,7 @@ CvCloseParenWriteComment( UINT32 Level) { - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { AcpiOsPrintf (")"); return; diff --git a/sys/contrib/dev/acpica/compiler/cvparser.c b/sys/contrib/dev/acpica/compiler/cvparser.c index eb89c463895..0e4dca3eeef 100644 --- a/sys/contrib/dev/acpica/compiler/cvparser.c +++ b/sys/contrib/dev/acpica/compiler/cvparser.c @@ -254,7 +254,7 @@ CvInitFileTree ( char *ChildFilename = NULL; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } @@ -714,13 +714,13 @@ CvCaptureCommentsOnly ( UINT8 *Aml = ParserState->Aml; UINT16 Opcode = (UINT16) ACPI_GET8 (Aml); UINT32 Length = 0; - UINT8 CommentOption = (UINT16) ACPI_GET8 (Aml+1); + UINT8 CommentOption; BOOLEAN StdDefBlockFlag = FALSE; ACPI_COMMENT_NODE *CommentNode; ACPI_FILE_NODE *FileNode; - if (!Gbl_CaptureComments || + if (!AcpiGbl_CaptureComments || Opcode != AML_COMMENT_OP) { return; @@ -973,7 +973,7 @@ CvCaptureComments ( const ACPI_OPCODE_INFO *OpInfo; - if (!Gbl_CaptureComments) + if (!AcpiGbl_CaptureComments) { return; } diff --git a/sys/contrib/dev/acpica/compiler/dtcompile.c b/sys/contrib/dev/acpica/compiler/dtcompile.c index 43bc081d1fe..bd4afd04584 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompile.c +++ b/sys/contrib/dev/acpica/compiler/dtcompile.c @@ -152,7 +152,6 @@ #define _DECLARE_DT_GLOBALS #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtcompile") @@ -281,7 +280,6 @@ DtDoCompile ( CleanupAndExit: AcpiUtDeleteCaches (); - DtDeleteCaches (); CmCleanupAndExit (); return (Status); } @@ -319,6 +317,8 @@ DtInitialize ( return (Status); } + AcpiUtSetIntegerWidth (2); /* Set width to 64 bits */ + Gbl_FieldList = NULL; Gbl_RootTable = NULL; Gbl_SubtableStack = NULL; @@ -410,7 +410,7 @@ DtCompileDataTable ( return (AE_ERROR); } - Gbl_Signature = UtStringCacheCalloc (strlen (Signature) + 1); + Gbl_Signature = UtLocalCacheCalloc (strlen (Signature) + 1); strcpy (Gbl_Signature, Signature); /* @@ -559,10 +559,18 @@ DtCompileTable ( ACPI_STATUS Status = AE_OK; - if (!Field || !*Field) + if (!Field) { return (AE_BAD_PARAMETER); } + if (!*Field) + { + /* + * The field list is empty, this means that we are out of fields to + * parse. In other words, we are at the end of the table. + */ + return (AE_END_OF_TABLE); + } /* Ignore optional subtable if name does not match */ @@ -583,7 +591,7 @@ DtCompileTable ( if (Length > 0) { - String = UtStringCacheCalloc (Length); + String = UtLocalCacheCalloc (Length); Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); } @@ -826,7 +834,7 @@ DtCompilePadding ( if (Length > 0) { - String = UtStringCacheCalloc (Length); + String = UtLocalCacheCalloc (Length); Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); } diff --git a/sys/contrib/dev/acpica/compiler/dtcompiler.h b/sys/contrib/dev/acpica/compiler/dtcompiler.h index c2a067e5d38..244784da83a 100644 --- a/sys/contrib/dev/acpica/compiler/dtcompiler.h +++ b/sys/contrib/dev/acpica/compiler/dtcompiler.h @@ -154,7 +154,6 @@ #ifndef _DTCOMPILER #define _DTCOMPILER -#include #include @@ -481,6 +480,10 @@ DtFatal ( DT_FIELD *FieldObject, char *ExtraMessage); +UINT64 +DtDoConstant ( + char *String); + char* DtGetFieldValue ( DT_FIELD *Field); @@ -506,18 +509,6 @@ void DtSetTableLength( void); -DT_SUBTABLE * -UtSubtableCacheCalloc ( - void); - -DT_FIELD * -UtFieldCacheCalloc ( - void); - -void -DtDeleteCaches ( - void); - /* dttable - individual table compilation */ @@ -618,15 +609,19 @@ DtCompileNfit ( void **PFieldList); ACPI_STATUS -DtCompilePmtt ( +DtCompilePcct ( void **PFieldList); ACPI_STATUS -DtCompilePptt ( +DtCompilePdtt ( void **PFieldList); ACPI_STATUS -DtCompilePcct ( +DtCompilePmtt ( + void **PFieldList); + +ACPI_STATUS +DtCompilePptt ( void **PFieldList); ACPI_STATUS @@ -637,6 +632,10 @@ ACPI_STATUS DtCompileS3pt ( DT_FIELD **PFieldList); +ACPI_STATUS +DtCompileSdev ( + void **PFieldList); + ACPI_STATUS DtCompileSlic ( void **PFieldList); @@ -657,6 +656,10 @@ ACPI_STATUS DtCompileTcpa ( void **PFieldList); +ACPI_STATUS +DtCompileTpm2 ( + void **PFieldList); + ACPI_STATUS DtCompileUefi ( void **PFieldList); @@ -720,6 +723,7 @@ extern const unsigned char TemplateMsdm[]; extern const unsigned char TemplateMtmr[]; extern const unsigned char TemplateNfit[]; extern const unsigned char TemplatePcct[]; +extern const unsigned char TemplatePdtt[]; extern const unsigned char TemplatePmtt[]; extern const unsigned char TemplatePptt[]; extern const unsigned char TemplateRasf[]; @@ -727,6 +731,7 @@ extern const unsigned char TemplateRsdt[]; extern const unsigned char TemplateS3pt[]; extern const unsigned char TemplateSbst[]; extern const unsigned char TemplateSdei[]; +extern const unsigned char TemplateSdev[]; extern const unsigned char TemplateSlic[]; extern const unsigned char TemplateSlit[]; extern const unsigned char TemplateSpcr[]; diff --git a/sys/contrib/dev/acpica/compiler/dtexpress.c b/sys/contrib/dev/acpica/compiler/dtexpress.c index b5ba58b85b6..68211c03def 100644 --- a/sys/contrib/dev/acpica/compiler/dtexpress.c +++ b/sys/contrib/dev/acpica/compiler/dtexpress.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #include "dtparser.y.h" #define _COMPONENT DT_COMPILER diff --git a/sys/contrib/dev/acpica/compiler/dtfield.c b/sys/contrib/dev/acpica/compiler/dtfield.c index 47641cbc771..96c3ea9b5bf 100644 --- a/sys/contrib/dev/acpica/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/compiler/dtfield.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtfield") @@ -628,15 +627,9 @@ DtCompileFlag ( UINT64 Value = 0; UINT32 BitLength = 1; UINT8 BitPosition = 0; - ACPI_STATUS Status; - Status = AcpiUtStrtoul64 (Field->Value, - (ACPI_STRTOUL_64BIT | ACPI_STRTOUL_BASE16), &Value); - if (ACPI_FAILURE (Status)) - { - DtError (ASL_ERROR, ASL_MSG_INVALID_HEX_INTEGER, Field, NULL); - } + Value = AcpiUtImplicitStrtoul64 (Field->Value); switch (Info->Opcode) { diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c index 90015acc70b..3b081a02dd1 100644 --- a/sys/contrib/dev/acpica/compiler/dtio.c +++ b/sys/contrib/dev/acpica/compiler/dtio.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #include #define _COMPONENT DT_COMPILER @@ -239,7 +238,7 @@ DtTrim ( if (!strcmp (String, " ")) { - ReturnString = UtStringCacheCalloc (1); + ReturnString = UtLocalCacheCalloc (1); return (ReturnString); } @@ -287,7 +286,7 @@ DtTrim ( /* Create the trimmed return string */ Length = ACPI_PTR_DIFF (End, Start) + 1; - ReturnString = UtStringCacheCalloc (Length + 1); + ReturnString = UtLocalCacheCalloc (Length + 1); if (strlen (Start)) { strncpy (ReturnString, Start, Length); diff --git a/sys/contrib/dev/acpica/compiler/dtparser.y b/sys/contrib/dev/acpica/compiler/dtparser.y index 84138635e12..38bc9692252 100644 --- a/sys/contrib/dev/acpica/compiler/dtparser.y +++ b/sys/contrib/dev/acpica/compiler/dtparser.y @@ -151,7 +151,6 @@ *****************************************************************************/ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtparser") @@ -275,17 +274,24 @@ Expression | EXPOP_LABEL { $$ = DtResolveLabel (DtParsertext);} - /* Default base for a non-prefixed integer is 16 */ + /* + * All constants for the data table compiler are in hex, whether a (optional) 0x + * prefix is present or not. For example, these two input strings are equivalent: + * 1234 + * 0x1234 + */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + /* Non-prefixed hex number */ + + | EXPOP_NUMBER { $$ = DtDoConstant (DtParsertext);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (DtParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + | EXPOP_HEX_NUMBER { $$ = DtDoConstant (DtParsertext);} - /* TBD: Decimal number with prefix (0d1234) - Not supported by strtoul64 at this time */ + /* Possible TBD: Decimal number with prefix (0d1234) - Not supported this time */ - | EXPOP_DECIMAL_NUMBER { AcpiUtStrtoul64 (DtParsertext, ACPI_STRTOUL_64BIT, &$$);} + | EXPOP_DECIMAL_NUMBER { $$ = DtDoConstant (DtParsertext);} ; %% diff --git a/sys/contrib/dev/acpica/compiler/dtsubtable.c b/sys/contrib/dev/acpica/compiler/dtsubtable.c index d75fa927a07..a258a61eb5c 100644 --- a/sys/contrib/dev/acpica/compiler/dtsubtable.c +++ b/sys/contrib/dev/acpica/compiler/dtsubtable.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dtsubtable") @@ -186,7 +185,7 @@ DtCreateSubtable ( /* Create a new buffer for the subtable data */ - String = UtStringCacheCalloc (Length); + String = UtLocalCacheCalloc (Length); Subtable->Buffer = ACPI_CAST_PTR (UINT8, String); memcpy (Subtable->Buffer, Buffer, Length); diff --git a/sys/contrib/dev/acpica/compiler/dttable.c b/sys/contrib/dev/acpica/compiler/dttable.c index 0d1df7fe612..7c3e9db9e06 100644 --- a/sys/contrib/dev/acpica/compiler/dttable.c +++ b/sys/contrib/dev/acpica/compiler/dttable.c @@ -152,7 +152,6 @@ /* Compile routines for the basic ACPI tables */ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dttable") diff --git a/sys/contrib/dev/acpica/compiler/dttable1.c b/sys/contrib/dev/acpica/compiler/dttable1.c index 81a61b3accf..4f31e61239a 100644 --- a/sys/contrib/dev/acpica/compiler/dttable1.c +++ b/sys/contrib/dev/acpica/compiler/dttable1.c @@ -152,7 +152,6 @@ /* Compile all complex data tables, signatures starting with A-I */ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dttable1") @@ -597,7 +596,13 @@ DtCompileDbg2 ( Status = DtCompileTable (PFieldList, AcpiDmTableInfoDbg2OemData, &Subtable, TRUE); - if (ACPI_FAILURE (Status)) + if (Status == AE_END_OF_TABLE) + { + /* optional field was not found and we're at the end of the file */ + + goto subtableDone; + } + else if (ACPI_FAILURE (Status)) { return (Status); } @@ -616,7 +621,7 @@ DtCompileDbg2 ( DtInsertSubtable (ParentTable, Subtable); } - +subtableDone: SubtableCount--; DtPopSubtable (); /* Get next Device Information subtable */ } diff --git a/sys/contrib/dev/acpica/compiler/dttable2.c b/sys/contrib/dev/acpica/compiler/dttable2.c index 4460394de9b..73f543ef4af 100644 --- a/sys/contrib/dev/acpica/compiler/dttable2.c +++ b/sys/contrib/dev/acpica/compiler/dttable2.c @@ -152,7 +152,6 @@ /* Compile all complex data tables, signatures starting with L-Z */ #include -#include #define _COMPONENT DT_COMPILER ACPI_MODULE_NAME ("dttable2") @@ -698,6 +697,11 @@ DtCompileNfit ( InfoTable = AcpiDmTableInfoNfit6; break; + case ACPI_NFIT_TYPE_CAPABILITIES: + + InfoTable = AcpiDmTableInfoNfit7; + break; + default: DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT"); @@ -741,7 +745,6 @@ DtCompileNfit ( } Interleave->LineCount = Count; - DtPopSubtable (); break; case ACPI_NFIT_TYPE_SMBIOS: @@ -787,7 +790,6 @@ DtCompileNfit ( } Hint->HintCount = (UINT16) Count; - DtPopSubtable (); break; default: @@ -902,6 +904,66 @@ DtCompilePcct ( } +/****************************************************************************** + * + * FUNCTION: DtCompilePdtt + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile PDTT. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompilePdtt ( + void **List) +{ + ACPI_STATUS Status; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + ACPI_TABLE_PDTT *PdttHeader; + UINT32 Count = 0; + + + /* Main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + PdttHeader = ACPI_CAST_PTR (ACPI_TABLE_PDTT, ParentTable->Buffer); + PdttHeader->ArrayOffset = sizeof (ACPI_TABLE_PDTT); + + /* There is only one type of subtable at this time, no need to decode */ + + while (*PFieldList) + { + /* List of subchannel IDs, each 2 bytes */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoPdtt0, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + DtInsertSubtable (ParentTable, Subtable); + Count++; + } + + PdttHeader->TriggerCount = (UINT8) Count; + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: DtCompilePmtt @@ -1283,6 +1345,219 @@ DtCompileS3pt ( } +/****************************************************************************** + * + * FUNCTION: DtCompileSdev + * + * PARAMETERS: List - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile SDEV. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileSdev ( + void **List) +{ + ACPI_STATUS Status; + ACPI_SDEV_HEADER *SdevHeader; + DT_SUBTABLE *Subtable; + DT_SUBTABLE *ParentTable; + ACPI_DMTABLE_INFO *InfoTable; + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_FIELD *SubtableStart; + ACPI_SDEV_PCIE *Pcie = NULL; + ACPI_SDEV_NAMESPACE *Namesp = NULL; + UINT32 EntryCount; + + + /* Subtables */ + + while (*PFieldList) + { + /* Compile common SDEV subtable header */ + + SubtableStart = *PFieldList; + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdevHdr, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + DtPushSubtable (Subtable); + + SdevHeader = ACPI_CAST_PTR (ACPI_SDEV_HEADER, Subtable->Buffer); + SdevHeader->Length = (UINT8)(sizeof (ACPI_SDEV_HEADER)); + + switch (SdevHeader->Type) + { + case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: + + InfoTable = AcpiDmTableInfoSdev0; + Namesp = ACPI_CAST_PTR (ACPI_SDEV_NAMESPACE, Subtable->Buffer); + break; + + case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: + + InfoTable = AcpiDmTableInfoSdev1; + Pcie = ACPI_CAST_PTR (ACPI_SDEV_PCIE, Subtable->Buffer); + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV"); + return (AE_ERROR); + } + + /* Compile SDEV subtable body */ + + Status = DtCompileTable (PFieldList, InfoTable, &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + /* Optional data fields are appended to the main subtable body */ + + switch (SdevHeader->Type) + { + case ACPI_SDEV_TYPE_NAMESPACE_DEVICE: + + /* Append DeviceId namespace string */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev0a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Namesp->DeviceIdOffset = sizeof (ACPI_SDEV_NAMESPACE); + Namesp->DeviceIdLength = (UINT16) Subtable->Length; + + /* Append Vendor data */ + + Namesp->VendorDataLength = 0; + Namesp->VendorDataOffset = 0; + + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (Subtable) + { + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Namesp->VendorDataOffset = + Namesp->DeviceIdOffset + Namesp->DeviceIdLength; + Namesp->VendorDataLength = + (UINT16) Subtable->Length; + } + } + + /* Final size of entire namespace structure */ + + SdevHeader->Length = (UINT16) (sizeof (ACPI_SDEV_NAMESPACE) + + Subtable->Length + Namesp->DeviceIdLength); + break; + + case ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE: + + /* Append the PCIe path info first */ + + EntryCount = 0; + while (*PFieldList && !strcmp ((*PFieldList)->Name, "Device")) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1a, + &Subtable, FALSE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (!Subtable) + { + DtPopSubtable (); + break; + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + EntryCount++; + } + + /* Path offset will point immediately after the main subtable */ + + Pcie->PathOffset = sizeof (ACPI_SDEV_PCIE); + Pcie->PathLength = (UINT16) + (EntryCount * sizeof (ACPI_SDEV_PCIE_PATH)); + + /* Append the Vendor Data last */ + + Pcie->VendorDataLength = 0; + Pcie->VendorDataOffset = 0; + + if (*PFieldList) + { + Status = DtCompileTable (PFieldList, AcpiDmTableInfoSdev1b, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + if (Subtable) + { + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Pcie->VendorDataOffset = + Pcie->PathOffset + Pcie->PathLength; + Pcie->VendorDataLength = (UINT16) + Subtable->Length; + } + } + + SdevHeader->Length = + sizeof (ACPI_SDEV_PCIE) + + Pcie->PathLength + Pcie->VendorDataLength; + break; + + default: + + DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "SDEV"); + return (AE_ERROR); + } + + DtPopSubtable (); + } + + return (AE_OK); +} + + /****************************************************************************** * * FUNCTION: DtCompileSlic @@ -1601,6 +1876,109 @@ DtCompileTcpa ( } +/****************************************************************************** + * + * FUNCTION: DtCompileTpm2 + * + * PARAMETERS: PFieldList - Current field list pointer + * + * RETURN: Status + * + * DESCRIPTION: Compile TPM2. + * + *****************************************************************************/ + +ACPI_STATUS +DtCompileTpm2 ( + void **List) +{ + DT_FIELD **PFieldList = (DT_FIELD **) List; + DT_SUBTABLE *Subtable; + ACPI_TABLE_TPM2 *Tpm2Header; + DT_SUBTABLE *ParentTable; + ACPI_STATUS Status = AE_OK; + + + /* Compile the main table */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Tpm2Header = ACPI_CAST_PTR (ACPI_TABLE_TPM2, ParentTable->Buffer); + + /* Method parameters */ + /* Optional: Log area minimum length */ + /* Optional: Log area start address */ + /* TBD: Optional fields above not fully implemented (not optional at this time) */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm2a, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + + /* Subtable type depends on the StartMethod */ + + switch (Tpm2Header->StartMethod) + { + case ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC: + + /* Subtable specific to to ARM_SMC */ + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoTpm211, + &Subtable, TRUE); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + break; + + case ACPI_TPM2_START_METHOD: + case ACPI_TPM2_MEMORY_MAPPED: + case ACPI_TPM2_COMMAND_BUFFER: + case ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD: + break; + + case ACPI_TPM2_RESERVED1: + case ACPI_TPM2_RESERVED3: + case ACPI_TPM2_RESERVED4: + case ACPI_TPM2_RESERVED5: + case ACPI_TPM2_RESERVED9: + case ACPI_TPM2_RESERVED10: + + AcpiOsPrintf ("\n**** Reserved TPM2 Start Method type 0x%X\n", + Tpm2Header->StartMethod); + Status = AE_ERROR; + break; + + case ACPI_TPM2_NOT_ALLOWED: + default: + + AcpiOsPrintf ("\n**** Unknown TPM2 Start Method type 0x%X\n", + Tpm2Header->StartMethod); + Status = AE_ERROR; + break; + } + + return (Status); +} + + /****************************************************************************** * * FUNCTION: DtGetGenericTableInfo diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.c b/sys/contrib/dev/acpica/compiler/dttemplate.c index 7ece577c208..309386c5493 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.c +++ b/sys/contrib/dev/acpica/compiler/dttemplate.c @@ -151,7 +151,6 @@ #include #include -#include #include /* Contains the hex ACPI table templates */ #define _COMPONENT DT_COMPILER @@ -315,7 +314,7 @@ DtCreateTemplates ( /* Shutdown ACPICA subsystem */ (void) AcpiTerminate (); - CmDeleteCaches (); + UtDeleteLocalCaches (); return (Status); } diff --git a/sys/contrib/dev/acpica/compiler/dttemplate.h b/sys/contrib/dev/acpica/compiler/dttemplate.h index 8d27359d9ad..4c77afc16fd 100644 --- a/sys/contrib/dev/acpica/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/compiler/dttemplate.h @@ -696,53 +696,56 @@ const unsigned char TemplateHpet[] = const unsigned char TemplateIort[] = { - 0x49,0x4F,0x52,0x54,0x74,0x01,0x00,0x00, /* 00000000 "IORTt..." */ - 0x00,0xD2,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x49,0x4F,0x52,0x54,0x90,0x01,0x00,0x00, /* 00000000 "IORT...." */ + 0x00,0x5F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "._INTEL " */ + 0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x19,0x01,0x17,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x31,0x08,0x17,0x20,0x05,0x00,0x00,0x00, /* 00000020 "1.. ...." */ 0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */ 0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */ - 0x00,0x00,0x00,0x00,0x01,0x44,0x00,0x00, /* 00000048 ".....D.." */ + 0x00,0x00,0x00,0x00,0x01,0x58,0x00,0x00, /* 00000048 ".....X.." */ 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000050 "........" */ - 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "0......." */ + 0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "D......." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */ 0x00,0x5C,0x5F,0x53,0x42,0x2E,0x50,0x43, /* 00000068 ".\_SB.PC" */ 0x49,0x30,0x2E,0x44,0x45,0x56,0x30,0x00, /* 00000070 "I0.DEV0." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */ - 0x02,0x34,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ".4......" */ - 0x01,0x00,0x00,0x00,0x20,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,0x00,0x00,0x00,0x00, /* 000000B0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */ + 0x00,0x00,0x00,0x00,0x02,0x34,0x00,0x00, /* 000000A0 ".....4.." */ + 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000A8 "........" */ + 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 " ......." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */ - 0x00,0x00,0x00,0x00,0x03,0x60,0x00,0x00, /* 000000C0 ".....`.." */ - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000C8 "........" */ - 0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "L......." */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */ - 0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00, /* 000000E8 "....<..." */ - 0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F0 "....L..." */ - 0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F8 "....L..." */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */ + 0x03,0x60,0x00,0x01,0x00,0x00,0x00,0x00, /* 000000D8 ".`......" */ + 0x01,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000E0 "....L..." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */ + 0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "<......." */ + 0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "L......." */ + 0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "L......." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */ - 0x00,0x00,0x00,0x00,0x04,0x50,0x00,0x00, /* 00000120 ".....P.." */ - 0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000128 "........" */ - 0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "<......." */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */ - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */ + 0x04,0x58,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000138 ".X......" */ + 0x01,0x00,0x00,0x00,0x44,0x00,0x00,0x00, /* 00000140 "....D..." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000168 "........" */ - 0x00,0x00,0x00,0x00 /* 00000170 "...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000170 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000188 "........" */ }; const unsigned char TemplateIvrs[] = @@ -939,11 +942,11 @@ const unsigned char TemplateMsct[] = const unsigned char TemplateNfit[] = { - 0x4E,0x46,0x49,0x54,0x70,0x01,0x00,0x00, /* 00000000 "NFITp..." */ - 0x01,0x53,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".SINTEL " */ + 0x4E,0x46,0x49,0x54,0x80,0x01,0x00,0x00, /* 00000000 "NFIT...." */ + 0x01,0x07,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" */ - 0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ + 0x29,0x09,0x17,0x20,0x00,0x00,0x00,0x00, /* 00000020 ").. ...." */ 0x00,0x00,0x38,0x00,0x01,0x00,0x00,0x00, /* 00000028 "..8....." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */ 0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000038 "0....].G" */ @@ -984,7 +987,9 @@ const unsigned char TemplateNfit[] = 0x06,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000150 ".. ....." */ 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */ 0x00,0x00,0x00,0x18,0x04,0x00,0x00,0x00, /* 00000160 "........" */ - 0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00 /* 00000168 "........" */ + 0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00, /* 00000168 "........" */ + 0x07,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000170 "........" */ + 0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000178 "........" */ }; const unsigned char TemplateMtmr[] = @@ -1079,6 +1084,17 @@ const unsigned char TemplatePcct[] = 0x55,0x55,0x55,0x55,0x55,0x55 /* 00000248 "UUUUUU| */ }; +const unsigned char TemplatePdtt[] = +{ + 0x50,0x44,0x54,0x54,0x34,0x00,0x00,0x00, /* 00000000 "PDTT4..." */ + 0x01,0xCB,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" */ + 0x31,0x08,0x17,0x20,0x04,0x00,0x00,0x00, /* 00000020 "1.. ...." */ + 0x2C,0x00,0x00,0x00,0xAA,0x03,0xBB,0x02, /* 00000028 ",......." */ + 0xCC,0x01,0xDD,0x00 /* 00000030 "...." */ +}; + const unsigned char TemplatePmtt[] = { 0x50,0x4D,0x54,0x54,0xB4,0x00,0x00,0x00, /* 00000000 "PMTT...." */ @@ -1187,6 +1203,25 @@ const unsigned char TemplateSdei[] = 0x30,0x09,0x16,0x20 /* 00000028 "0.. " */ }; +const unsigned char TemplateSdev[] = +{ + 0x53,0x44,0x45,0x56,0x72,0x00,0x00,0x00, /* 00000000 "SDEVr..." */ + 0x01,0x2F,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" */ + 0x31,0x08,0x17,0x20,0x00,0x01,0x2A,0x00, /* 00000020 "1.. ..*." */ + 0x0C,0x00,0x16,0x00,0x22,0x00,0x08,0x00, /* 00000028 "...."..." */ + 0x5C,0x5C,0x5F,0x53,0x42,0x5F,0x2E,0x50, /* 00000030 "\\_SB_.P" */ + 0x43,0x49,0x30,0x2E,0x55,0x53,0x42,0x31, /* 00000038 "CI0.USB1" */ + 0x2E,0x53,0x55,0x42,0x31,0x00,0x00,0x11, /* 00000040 ".SUB1..." */ + 0x22,0x33,0x44,0x55,0x66,0x77,0x01,0x01, /* 00000048 ""3DUfw.." */ + 0x24,0x00,0x10,0x00,0x20,0x00,0x10,0x00, /* 00000050 "$... ..." */ + 0x04,0x00,0x14,0x00,0x10,0x00,0x11,0x22, /* 00000058 "......."" */ + 0x33,0x44,0xEE,0xDD,0xCC,0xBB,0xAA,0x55, /* 00000060 "3D.....U" */ + 0x66,0x77,0x88,0x99,0xAA,0xBB,0xCC,0xDD, /* 00000068 "fw......" */ + 0xEE,0xFF /* 00000070 ".." */ +}; + const unsigned char TemplateSlic[] = { 0x53,0x4C,0x49,0x43,0x76,0x01,0x00,0x00, /* 00000000 "SLICv..." */ @@ -1388,13 +1423,17 @@ const unsigned char TemplateTcpa[] = const unsigned char TemplateTpm2[] = { - 0x54,0x50,0x4D,0x32,0x34,0x00,0x00,0x00, /* 00000000 "TPM24..." */ - 0x03,0x42,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".BINTEL " */ - 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ + 0x54,0x50,0x4D,0x32,0x58,0x00,0x00,0x00, /* 00000000 "TPM2X..." */ + 0x03,0xAB,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" */ - 0x14,0x11,0x12,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */ - 0x77,0x66,0x55,0x44,0x33,0x22,0x11,0x00, /* 00000028 "wfUD3".." */ - 0x01,0x00,0x00,0x00 /* 00000030 "...." */ + 0x31,0x08,0x17,0x20,0x01,0x00,0x00,0x00, /* 00000020 "1.. ...." */ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ + 0x0B,0x00,0x00,0x00,0x01,0x02,0x03,0x04, /* 00000030 "........" */ + 0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C, /* 00000038 "........" */ + 0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000040 "........" */ + 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x00, /* 00000048 "........" */ + 0x01,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF /* 00000050 "........" */ }; const unsigned char TemplateUefi[] = diff --git a/sys/contrib/dev/acpica/compiler/dtutils.c b/sys/contrib/dev/acpica/compiler/dtutils.c index 031dc2e2f62..54832f7b24b 100644 --- a/sys/contrib/dev/acpica/compiler/dtutils.c +++ b/sys/contrib/dev/acpica/compiler/dtutils.c @@ -150,7 +150,6 @@ *****************************************************************************/ #include -#include #include #define _COMPONENT DT_COMPILER @@ -303,6 +302,38 @@ DtFatal ( } +/******************************************************************************* + * + * FUNCTION: DtDoConstant + * + * PARAMETERS: String - Only hex constants are supported, + * regardless of whether the 0x prefix + * is used + * + * RETURN: Converted Integer + * + * DESCRIPTION: Convert a string to an integer, with overflow/error checking. + * + ******************************************************************************/ + +UINT64 +DtDoConstant ( + char *String) +{ + UINT64 ConvertedInteger; + + + /* + * TBD: The ImplicitStrtoul64 function does not report overflow + * conditions. The input string is simply truncated. If it is + * desired to report overflow to the table compiler, this should + * somehow be added here. Note: integers that are prefixed with 0x + * or not are both hex integers. + */ + ConvertedInteger = AcpiUtImplicitStrtoul64 (String); + return (ConvertedInteger); +} + /****************************************************************************** * * FUNCTION: DtGetFieldValue @@ -538,6 +569,7 @@ DtGetFieldLength ( case ACPI_DMT_PCCT: case ACPI_DMT_PMTT: case ACPI_DMT_PPTT: + case ACPI_DMT_SDEV: case ACPI_DMT_SRAT: case ACPI_DMT_ASF: case ACPI_DMT_HESTNTYP: @@ -570,6 +602,7 @@ DtGetFieldLength ( case ACPI_DMT_NAME4: case ACPI_DMT_SIG: case ACPI_DMT_LPIT: + case ACPI_DMT_TPM2: ByteLength = 4; break; @@ -888,153 +921,3 @@ DtWalkTableTree ( } } } - - -/******************************************************************************* - * - * FUNCTION: UtSubtableCacheCalloc - * - * PARAMETERS: None - * - * RETURN: Pointer to the buffer. Aborts on allocation failure - * - * DESCRIPTION: Allocate a subtable object buffer. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -DT_SUBTABLE * -UtSubtableCacheCalloc ( - void) -{ - ASL_CACHE_INFO *Cache; - - - if (Gbl_SubtableCacheNext >= Gbl_SubtableCacheLast) - { - /* Allocate a new buffer */ - - Cache = UtLocalCalloc (sizeof (Cache->Next) + - (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE)); - - /* Link new cache buffer to head of list */ - - Cache->Next = Gbl_SubtableCacheList; - Gbl_SubtableCacheList = Cache; - - /* Setup cache management pointers */ - - Gbl_SubtableCacheNext = ACPI_CAST_PTR (DT_SUBTABLE, Cache->Buffer); - Gbl_SubtableCacheLast = Gbl_SubtableCacheNext + ASL_SUBTABLE_CACHE_SIZE; - } - - Gbl_SubtableCount++; - return (Gbl_SubtableCacheNext++); -} - - -/******************************************************************************* - * - * FUNCTION: UtFieldCacheCalloc - * - * PARAMETERS: None - * - * RETURN: Pointer to the buffer. Aborts on allocation failure - * - * DESCRIPTION: Allocate a field object buffer. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -DT_FIELD * -UtFieldCacheCalloc ( - void) -{ - ASL_CACHE_INFO *Cache; - - - if (Gbl_FieldCacheNext >= Gbl_FieldCacheLast) - { - /* Allocate a new buffer */ - - Cache = UtLocalCalloc (sizeof (Cache->Next) + - (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE)); - - /* Link new cache buffer to head of list */ - - Cache->Next = Gbl_FieldCacheList; - Gbl_FieldCacheList = Cache; - - /* Setup cache management pointers */ - - Gbl_FieldCacheNext = ACPI_CAST_PTR (DT_FIELD, Cache->Buffer); - Gbl_FieldCacheLast = Gbl_FieldCacheNext + ASL_FIELD_CACHE_SIZE; - } - - Gbl_FieldCount++; - return (Gbl_FieldCacheNext++); -} - - -/******************************************************************************* - * - * FUNCTION: DtDeleteCaches - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Delete all local cache buffer blocks - * - ******************************************************************************/ - -void -DtDeleteCaches ( - void) -{ - UINT32 BufferCount; - ASL_CACHE_INFO *Next; - - - /* Field cache */ - - BufferCount = 0; - while (Gbl_FieldCacheList) - { - Next = Gbl_FieldCacheList->Next; - ACPI_FREE (Gbl_FieldCacheList); - Gbl_FieldCacheList = Next; - BufferCount++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, - "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", - Gbl_FieldCount, ASL_FIELD_CACHE_SIZE, - (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); - - Gbl_FieldCount = 0; - Gbl_FieldCacheNext = NULL; - Gbl_FieldCacheLast = NULL; - - /* Subtable cache */ - - BufferCount = 0; - while (Gbl_SubtableCacheList) - { - Next = Gbl_SubtableCacheList->Next; - ACPI_FREE (Gbl_SubtableCacheList); - Gbl_SubtableCacheList = Next; - BufferCount++; - } - - DbgPrint (ASL_DEBUG_OUTPUT, - "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", - Gbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, - (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); - - Gbl_SubtableCount = 0; - Gbl_SubtableCacheNext = NULL; - Gbl_SubtableCacheLast = NULL; -} diff --git a/sys/contrib/dev/acpica/compiler/prexpress.c b/sys/contrib/dev/acpica/compiler/prexpress.c index 892e73dcfc9..df2fc46cdea 100644 --- a/sys/contrib/dev/acpica/compiler/prexpress.c +++ b/sys/contrib/dev/acpica/compiler/prexpress.c @@ -150,8 +150,6 @@ *****************************************************************************/ #include -#include - #define _COMPONENT ASL_PREPROCESSOR ACPI_MODULE_NAME ("prexpress") diff --git a/sys/contrib/dev/acpica/compiler/prmacros.c b/sys/contrib/dev/acpica/compiler/prmacros.c index 82b221a7e37..e1aaa3bceca 100644 --- a/sys/contrib/dev/acpica/compiler/prmacros.c +++ b/sys/contrib/dev/acpica/compiler/prmacros.c @@ -150,8 +150,6 @@ *****************************************************************************/ #include -#include - #define _COMPONENT ASL_PREPROCESSOR ACPI_MODULE_NAME ("prmacros") diff --git a/sys/contrib/dev/acpica/compiler/prparser.y b/sys/contrib/dev/acpica/compiler/prparser.y index a6f789bb0ab..ec9c0c58d80 100644 --- a/sys/contrib/dev/acpica/compiler/prparser.y +++ b/sys/contrib/dev/acpica/compiler/prparser.y @@ -151,7 +151,6 @@ *****************************************************************************/ #include -#include #define _COMPONENT ASL_PREPROCESSOR ACPI_MODULE_NAME ("prparser") @@ -290,11 +289,11 @@ Expression /* Default base for a non-prefixed integer is 10 */ - | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, ACPI_STRTOUL_64BIT, &$$);} + | EXPOP_NUMBER { AcpiUtStrtoul64 (PrParsertext, &$$);} /* Standard hex number (0x1234) */ - | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, (ACPI_STRTOUL_BASE16 | ACPI_STRTOUL_64BIT), &$$);} + | EXPOP_HEX_NUMBER { AcpiUtStrtoul64 (PrParsertext, &$$);} ; %% diff --git a/sys/contrib/dev/acpica/compiler/prscan.c b/sys/contrib/dev/acpica/compiler/prscan.c index 02df4277057..d4ee768a611 100644 --- a/sys/contrib/dev/acpica/compiler/prscan.c +++ b/sys/contrib/dev/acpica/compiler/prscan.c @@ -152,7 +152,6 @@ #define _DECLARE_PR_GLOBALS #include -#include /* * TBDs: @@ -1197,7 +1196,7 @@ PrPushDirective ( Info->Next = Gbl_DirectiveStack; Info->Directive = Directive; Info->IgnoringThisCodeBlock = Gbl_IgnoringThisCodeBlock; - strncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); + AcpiUtSafeStrncpy (Info->Argument, Argument, MAX_ARGUMENT_LENGTH); DbgPrint (ASL_DEBUG_OUTPUT, "Pr(%.4u) - [%u %s] %*s Pushed [#%s %s]: IgnoreFlag = %s\n", diff --git a/sys/contrib/dev/acpica/compiler/prutils.c b/sys/contrib/dev/acpica/compiler/prutils.c index 45da8146222..3d7e5fe7fc8 100644 --- a/sys/contrib/dev/acpica/compiler/prutils.c +++ b/sys/contrib/dev/acpica/compiler/prutils.c @@ -150,8 +150,6 @@ *****************************************************************************/ #include -#include - #define _COMPONENT ASL_PREPROCESSOR ACPI_MODULE_NAME ("prutils") @@ -514,7 +512,7 @@ PrPushInputFileStack ( /* Reset the global line count and filename */ Gbl_Files[ASL_FILE_INPUT].Filename = - UtStringCacheCalloc (strlen (Filename) + 1); + UtLocalCacheCalloc (strlen (Filename) + 1); strcpy (Gbl_Files[ASL_FILE_INPUT].Filename, Filename); Gbl_Files[ASL_FILE_INPUT].Handle = InputFile; diff --git a/sys/contrib/dev/acpica/components/debugger/dbconvert.c b/sys/contrib/dev/acpica/components/debugger/dbconvert.c index 4206e5cbab4..9551f4f4bdd 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbconvert.c +++ b/sys/contrib/dev/acpica/components/debugger/dbconvert.c @@ -429,9 +429,7 @@ AcpiDbConvertToObject ( default: Object->Type = ACPI_TYPE_INTEGER; - Status = AcpiUtStrtoul64 (String, - (AcpiGbl_IntegerByteWidth | ACPI_STRTOUL_BASE16), - &Object->Integer.Value); + Status = AcpiUtStrtoul64 (String, &Object->Integer.Value); break; } diff --git a/sys/contrib/dev/acpica/components/debugger/dbexec.c b/sys/contrib/dev/acpica/components/debugger/dbexec.c index 2ca3a12c8c9..d6abb9a0026 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbexec.c +++ b/sys/contrib/dev/acpica/components/debugger/dbexec.c @@ -187,6 +187,10 @@ AcpiDbExecutionWalk ( void *Context, void **ReturnValue); +static void ACPI_SYSTEM_XFACE +AcpiDbSingleExecutionThread ( + void *Context); + /******************************************************************************* * @@ -366,7 +370,7 @@ AcpiDbExecuteSetup ( ACPI_FUNCTION_NAME (DbExecuteSetup); - /* Catenate the current scope to the supplied name */ + /* Concatenate the current scope to the supplied name */ Info->Pathname[0] = 0; if ((Info->Name[0] != '\\') && @@ -789,6 +793,124 @@ AcpiDbMethodThread ( } +/******************************************************************************* + * + * FUNCTION: AcpiDbSingleExecutionThread + * + * PARAMETERS: Context - Method info struct + * + * RETURN: None + * + * DESCRIPTION: Create one thread and execute a method + * + ******************************************************************************/ + +static void ACPI_SYSTEM_XFACE +AcpiDbSingleExecutionThread ( + void *Context) +{ + ACPI_DB_METHOD_INFO *Info = Context; + ACPI_STATUS Status; + ACPI_BUFFER ReturnObj; + + + AcpiOsPrintf ("\n"); + + Status = AcpiDbExecuteMethod (Info, &ReturnObj); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s During evaluation of %s\n", + AcpiFormatException (Status), Info->Pathname); + return; + } + + /* Display a return object, if any */ + + if (ReturnObj.Length) + { + AcpiOsPrintf ("Evaluation of %s returned object %p, " + "external buffer length %X\n", + AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer, + (UINT32) ReturnObj.Length); + + AcpiDbDumpExternalObject (ReturnObj.Pointer, 1); + } + + AcpiOsPrintf ("\nBackground thread completed\n%c ", + ACPI_DEBUGGER_COMMAND_PROMPT); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDbCreateExecutionThread + * + * PARAMETERS: MethodNameArg - Control method to execute + * Arguments - Array of arguments to the method + * Types - Corresponding array of object types + * + * RETURN: None + * + * DESCRIPTION: Create a single thread to evaluate a namespace object. Handles + * arguments passed on command line for control methods. + * + ******************************************************************************/ + +void +AcpiDbCreateExecutionThread ( + char *MethodNameArg, + char **Arguments, + ACPI_OBJECT_TYPE *Types) +{ + ACPI_STATUS Status; + UINT32 i; + + + memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO)); + AcpiGbl_DbMethodInfo.Name = MethodNameArg; + AcpiGbl_DbMethodInfo.InitArgs = 1; + AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments; + AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes; + + /* Setup method arguments, up to 7 (0-6) */ + + for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *Arguments; i++) + { + AcpiGbl_DbMethodInfo.Arguments[i] = *Arguments; + Arguments++; + + AcpiGbl_DbMethodInfo.ArgTypes[i] = *Types; + Types++; + } + + Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Get the NS node, determines existence also */ + + Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname, + &AcpiGbl_DbMethodInfo.Method); + if (ACPI_FAILURE (Status)) + { + AcpiOsPrintf ("%s Could not get handle for %s\n", + AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname); + return; + } + + Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD, + AcpiDbSingleExecutionThread, &AcpiGbl_DbMethodInfo); + if (ACPI_FAILURE (Status)) + { + return; + } + + AcpiOsPrintf ("\nBackground thread started\n"); +} + + /******************************************************************************* * * FUNCTION: AcpiDbCreateExecutionThreads diff --git a/sys/contrib/dev/acpica/components/debugger/dbfileio.c b/sys/contrib/dev/acpica/components/debugger/dbfileio.c index a451272ef04..ac551158909 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbfileio.c +++ b/sys/contrib/dev/acpica/components/debugger/dbfileio.c @@ -218,7 +218,7 @@ AcpiDbOpenDebugFile ( } AcpiOsPrintf ("Debug output file %s opened\n", Name); - strncpy (AcpiGbl_DbDebugFilename, Name, + AcpiUtSafeStrncpy (AcpiGbl_DbDebugFilename, Name, sizeof (AcpiGbl_DbDebugFilename)); AcpiGbl_DbOutputToFile = TRUE; } diff --git a/sys/contrib/dev/acpica/components/debugger/dbinput.c b/sys/contrib/dev/acpica/components/debugger/dbinput.c index 140395d9541..222f7cebf0b 100644 --- a/sys/contrib/dev/acpica/components/debugger/dbinput.c +++ b/sys/contrib/dev/acpica/components/debugger/dbinput.c @@ -258,6 +258,7 @@ enum AcpiExDebuggerCommands CMD_UNLOAD, CMD_TERMINATE, + CMD_BACKGROUND, CMD_THREADS, CMD_TEST, @@ -336,6 +337,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = {"UNLOAD", 1}, {"TERMINATE", 0}, + {"BACKGROUND", 1}, {"THREADS", 3}, {"TEST", 1}, @@ -346,102 +348,113 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] = /* * Help for all debugger commands. First argument is the number of lines * of help to output for the command. + * + * Note: Some commands are not supported by the kernel-level version of + * the debugger. */ static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] = { - {0, "\nGeneral-Purpose Commands:", "\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {2, " Dump
|", "\n"}, - {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, - {1, " Handlers", "Info about global handlers\n"}, - {1, " Help [Command]", "This help screen or individual command\n"}, - {1, " History", "Display command history buffer\n"}, - {1, " Level ] [console]", "Get/Set debug level for file or console\n"}, - {1, " Locks", "Current status of internal mutexes\n"}, - {1, " Osi [Install|Remove ]", "Display or modify global _OSI list\n"}, - {1, " Quit or Exit", "Exit this command\n"}, - {8, " Stats ", "Display namespace and memory statistics\n"}, - {1, " Allocations", "Display list of current memory allocations\n"}, - {1, " Memory", "Dump internal memory lists\n"}, - {1, " Misc", "Namespace search and mutex stats\n"}, - {1, " Objects", "Summary of namespace objects\n"}, - {1, " Sizes", "Sizes for each of the internal objects\n"}, - {1, " Stack", "Display CPU stack usage\n"}, - {1, " Tables", "Info about current ACPI table(s)\n"}, - {1, " Tables", "Display info about loaded ACPI tables\n"}, - {1, " ! ", "Execute command from history buffer\n"}, - {1, " !!", "Execute last command again\n"}, - - {0, "\nNamespace Access Commands:", "\n"}, - {1, " Businfo", "Display system bus info\n"}, - {1, " Disassemble ", "Disassemble a control method\n"}, - {1, " Find (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, - {1, " Integrity", "Validate namespace integrity\n"}, - {1, " Methods", "Display list of loaded control methods\n"}, - {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, - {1, " Notify ", "Send a notification on Object\n"}, - {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, - {1, " Owner [Depth]", "Display loaded namespace by object owner\n"}, - {1, " Paths", "Display full pathnames of namespace objects\n"}, - {1, " Predefined", "Check all predefined names\n"}, - {1, " Prefix []", "Set or Get current execution prefix\n"}, - {1, " References ", "Find all references to object at addr\n"}, - {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, - {1, " Set N ", "Set value for named integer\n"}, - {1, " Template ", "Format/dump a Buffer/ResourceTemplate\n"}, - {1, " Type ", "Display object type\n"}, - - {0, "\nControl Method Execution Commands:","\n"}, - {1, " Arguments (or Args)", "Display method arguments\n"}, - {1, " Breakpoint ", "Set an AML execution breakpoint\n"}, - {1, " Call", "Run to next control method invocation\n"}, - {1, " Debug [Arguments]", "Single Step a control method\n"}, - {6, " Evaluate", "Synonym for Execute\n"}, - {5, " Execute [Arguments]", "Execute control method\n"}, - {1, " Hex Integer", "Integer method argument\n"}, - {1, " \"Ascii String\"", "String method argument\n"}, - {1, " (Hex Byte List)", "Buffer method argument\n"}, - {1, " [Package Element List]", "Package method argument\n"}, - {5, " Execute predefined", "Execute all predefined (public) methods\n"}, - {1, " Go", "Allow method to run to completion\n"}, - {1, " Information", "Display info about the current method\n"}, - {1, " Into", "Step into (not over) a method call\n"}, - {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, - {1, " Locals", "Display method local variables\n"}, - {1, " Results", "Display method result stack\n"}, - {1, " Set <#> ", "Set method data (Arguments/Locals)\n"}, - {1, " Stop", "Terminate control method\n"}, - {5, " Trace [] [Once]", "Trace control method execution\n"}, - {1, " Enable", "Enable all messages\n"}, - {1, " Disable", "Disable tracing\n"}, - {1, " Method", "Enable method execution messages\n"}, - {1, " Opcode", "Enable opcode execution messages\n"}, - {1, " Tree", "Display control method calling tree\n"}, - {1, " ", "Single step next AML opcode (over calls)\n"}, + {0, "\nNamespace Access:", "\n"}, + {1, " Businfo", "Display system bus info\n"}, + {1, " Disassemble ", "Disassemble a control method\n"}, + {1, " Find (? is wildcard)", "Find ACPI name(s) with wildcards\n"}, + {1, " Integrity", "Validate namespace integrity\n"}, + {1, " Methods", "Display list of loaded control methods\n"}, + {1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"}, + {1, " Notify ", "Send a notification on Object\n"}, + {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, + {1, " Owner [Depth]", "Display loaded namespace by object owner\n"}, + {1, " Paths", "Display full pathnames of namespace objects\n"}, + {1, " Predefined", "Check all predefined names\n"}, + {1, " Prefix []", "Set or Get current execution prefix\n"}, + {1, " References ", "Find all references to object at addr\n"}, + {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, + {1, " Set N ", "Set value for named integer\n"}, + {1, " Template ", "Format/dump a Buffer/ResourceTemplate\n"}, + {1, " Type ", "Display object type\n"}, + + {0, "\nControl Method Execution:", "\n"}, + {1, " Evaluate [Arguments]", "Evaluate object or control method\n"}, + {1, " Execute [Arguments]", "Synonym for Evaluate\n"}, +#ifdef ACPI_APPLICATION + {1, " Background [Arguments]", "Evaluate object/method in a separate thread\n"}, + {1, " Thread ", "Spawn threads to execute method(s)\n"}, +#endif + {1, " Debug [Arguments]", "Single-Step a control method\n"}, + {7, " [Arguments] formats:", "Control method argument formats\n"}, + {1, " Hex Integer", "Integer\n"}, + {1, " \"Ascii String\"", "String\n"}, + {1, " (Hex Byte List)", "Buffer\n"}, + {1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"}, + {1, " [Package Element List]", "Package\n"}, + {1, " [0x01 0x1234 \"string\"]", "Package example (3 elements)\n"}, + + {0, "\nMiscellaneous:", "\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {2, " Dump
|", "\n"}, + {0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"}, + {1, " Handlers", "Info about global handlers\n"}, + {1, " Help [Command]", "This help screen or individual command\n"}, + {1, " History", "Display command history buffer\n"}, + {1, " Level ] [console]", "Get/Set debug level for file or console\n"}, + {1, " Locks", "Current status of internal mutexes\n"}, + {1, " Osi [Install|Remove ]", "Display or modify global _OSI list\n"}, + {1, " Quit or Exit", "Exit this command\n"}, + {8, " Stats ", "Display namespace and memory statistics\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {1, " Memory", "Dump internal memory lists\n"}, + {1, " Misc", "Namespace search and mutex stats\n"}, + {1, " Objects", "Summary of namespace objects\n"}, + {1, " Sizes", "Sizes for each of the internal objects\n"}, + {1, " Stack", "Display CPU stack usage\n"}, + {1, " Tables", "Info about current ACPI table(s)\n"}, + {1, " Tables", "Display info about loaded ACPI tables\n"}, +#ifdef ACPI_APPLICATION + {1, " Terminate", "Delete namespace and all internal objects\n"}, +#endif + {1, " ! ", "Execute command from history buffer\n"}, + {1, " !!", "Execute last command again\n"}, + + {0, "\nMethod and Namespace Debugging:", "\n"}, + {5, " Trace [] [Once]", "Trace control method execution\n"}, + {1, " Enable", "Enable all messages\n"}, + {1, " Disable", "Disable tracing\n"}, + {1, " Method", "Enable method execution messages\n"}, + {1, " Opcode", "Enable opcode execution messages\n"}, + {3, " Test ", "Invoke a debug test\n"}, + {1, " Objects", "Read/write/compare all namespace data objects\n"}, + {1, " Predefined", "Validate all ACPI predefined names (_STA, etc.)\n"}, + {1, " Execute predefined", "Execute all predefined (public) methods\n"}, + + {0, "\nControl Method Single-Step Execution:","\n"}, + {1, " Arguments (or Args)", "Display method arguments\n"}, + {1, " Breakpoint ", "Set an AML execution breakpoint\n"}, + {1, " Call", "Run to next control method invocation\n"}, + {1, " Go", "Allow method to run to completion\n"}, + {1, " Information", "Display info about the current method\n"}, + {1, " Into", "Step into (not over) a method call\n"}, + {1, " List [# of Aml Opcodes]", "Display method ASL statements\n"}, + {1, " Locals", "Display method local variables\n"}, + {1, " Results", "Display method result stack\n"}, + {1, " Set <#> ", "Set method data (Arguments/Locals)\n"}, + {1, " Stop", "Terminate control method\n"}, + {1, " Tree", "Display control method calling tree\n"}, + {1, " ", "Single step next AML opcode (over calls)\n"}, #ifdef ACPI_APPLICATION - {0, "\nHardware Simulation Commands:", "\n"}, - {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, - {1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"}, - {1, " Gpe [GpeBlockDevice]", "Simulate a GPE\n"}, - {1, " Gpes", "Display info on all GPE devices\n"}, - {1, " Sci", "Generate an SCI\n"}, - {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, - - {0, "\nFile I/O Commands:", "\n"}, - {1, " Close", "Close debug output file\n"}, - {1, " Load ", "Load ACPI table from a file\n"}, - {1, " Open ", "Open a file for debug output\n"}, - {1, " Unload ", "Unload an ACPI table via namespace object\n"}, - - {0, "\nUser Space Commands:", "\n"}, - {1, " Terminate", "Delete namespace and all internal objects\n"}, - {1, " Thread ", "Spawn threads to execute method(s)\n"}, - - {0, "\nDebug Test Commands:", "\n"}, - {3, " Test ", "Invoke a debug test\n"}, - {1, " Objects", "Read/write/compare all namespace data objects\n"}, - {1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"}, + {0, "\nFile Operations:", "\n"}, + {1, " Close", "Close debug output file\n"}, + {1, " Load ", "Load ACPI table from a file\n"}, + {1, " Open ", "Open a file for debug output\n"}, + {1, " Unload ", "Unload an ACPI table via namespace object\n"}, + + {0, "\nHardware Simulation:", "\n"}, + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, + {1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Gpe [GpeBlockDevice]", "Simulate a GPE\n"}, + {1, " Gpes", "Display info on all GPE devices\n"}, + {1, " Sci", "Generate an SCI\n"}, + {1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"}, #endif {0, NULL, NULL} }; @@ -571,11 +584,15 @@ AcpiDbDisplayHelp ( { /* No argument to help, display help for all commands */ + AcpiOsPrintf ("\nSummary of AML Debugger Commands\n\n"); + while (Next->Invocation) { AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description); Next++; } + AcpiOsPrintf ("\n"); + } else { @@ -1258,6 +1275,12 @@ AcpiDbCommandDispatch ( /* AcpiInitialize (NULL); */ break; + case CMD_BACKGROUND: + + AcpiDbCreateExecutionThread (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], + &AcpiGbl_DbArgTypes[2]); + break; + case CMD_THREADS: AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], diff --git a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c index 260c23ffa36..461560957f4 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmresrc.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmresrc.c @@ -539,6 +539,20 @@ AcpiDmIsResourceTemplate ( Aml = NextOp->Named.Data; BufferLength = NextOp->Common.Value.Size; + /* + * Any buffer smaller than one byte cannot possibly be a resource + * template. Two bytes could possibly be a "NULL" resource template + * with a lone end tag descriptor (as generated via + * "ResourceTemplate(){}"), but this would be an extremely unusual + * case, as the template would be essentially useless. The disassembler + * therefore does not recognize any two-byte buffer as a resource + * template. + */ + if (BufferLength <= 2) + { + return (AE_TYPE); + } + /* * Not a template if declared buffer length != actual length of the * intialization byte list. Because the resource macros will create diff --git a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c index dceb6bfcc94..f60a8a4b845 100644 --- a/sys/contrib/dev/acpica/components/disassembler/dmwalk.c +++ b/sys/contrib/dev/acpica/components/disassembler/dmwalk.c @@ -527,7 +527,7 @@ AcpiDmDescendingOp ( /* Determine which file this parse node is contained in. */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1046,7 +1046,7 @@ AcpiDmAscendingOp ( /* Point the Op's filename pointer to the proper file */ - if (Gbl_CaptureComments) + if (AcpiGbl_CaptureComments) { ASL_CV_LABEL_FILENODE (Op); @@ -1074,7 +1074,7 @@ AcpiDmAscendingOp ( /* Print any comments that are at the end of the file here */ - if (Gbl_CaptureComments && AcpiGbl_LastListHead) + if (AcpiGbl_CaptureComments && AcpiGbl_LastListHead) { AcpiOsPrintf ("\n"); ASL_CV_PRINT_ONE_COMMENT_LIST (AcpiGbl_LastListHead, 0); diff --git a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c index b23a2738953..b719a67dd95 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c @@ -234,7 +234,8 @@ AcpiDsExecBeginControlOp ( WalkState->ParserState.PkgEnd; ControlState->Control.Opcode = Op->Common.AmlOpcode; - + ControlState->Control.LoopTimeout = AcpiOsGetTimer () + + (UINT64) (AcpiGbl_MaxLoopIterations * ACPI_100NSEC_PER_SEC); /* Push the control state on this walk's control stack */ @@ -327,15 +328,15 @@ AcpiDsExecEndControlOp ( /* Predicate was true, the body of the loop was just executed */ /* - * This loop counter mechanism allows the interpreter to escape - * possibly infinite loops. This can occur in poorly written AML - * when the hardware does not respond within a while loop and the - * loop does not implement a timeout. + * This infinite loop detection mechanism allows the interpreter + * to escape possibly infinite loops. This can occur in poorly + * written AML when the hardware does not respond within a while + * loop and the loop does not implement a timeout. */ - ControlState->Control.LoopCount++; - if (ControlState->Control.LoopCount > AcpiGbl_MaxLoopIterations) + if (ACPI_TIME_AFTER (AcpiOsGetTimer (), + ControlState->Control.LoopTimeout)) { - Status = AE_AML_INFINITE_LOOP; + Status = AE_AML_LOOP_TIMEOUT; break; } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c index a5268633039..566a39613a0 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsfield.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsfield.c @@ -340,7 +340,8 @@ AcpiDsCreateBufferField ( ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } } @@ -524,7 +525,8 @@ AcpiDsGetFieldNames ( WalkState, &Info->ConnectionNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Child->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -540,7 +542,8 @@ AcpiDsGetFieldNames ( WalkState, &Info->FieldNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + (char *) &Arg->Named.Name, Status); return_ACPI_STATUS (Status); } else @@ -639,7 +642,8 @@ AcpiDsCreateField ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -769,7 +773,8 @@ AcpiDsInitFieldObjects ( Flags, WalkState, &Node); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + (char *) &Arg->Named.Name, Status); if (Status != AE_ALREADY_EXISTS) { return_ACPI_STATUS (Status); @@ -834,7 +839,8 @@ AcpiDsCreateBankField ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.Name, Status); return_ACPI_STATUS (Status); } } @@ -847,7 +853,8 @@ AcpiDsCreateBankField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } @@ -920,7 +927,8 @@ AcpiDsCreateIndexField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } @@ -932,7 +940,8 @@ AcpiDsCreateIndexField ( ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c b/sys/contrib/dev/acpica/components/dispatcher/dsobject.c index 55061de66d0..0e8dc7262cf 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsobject.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsobject.c @@ -223,7 +223,8 @@ AcpiDsBuildInternalObject ( ACPI_NAMESPACE_NODE, &(Op->Common.Node))); if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Op->Common.Value.String, Status); return_ACPI_STATUS (Status); } } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c b/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c index b7d45a60d21..6b427324429 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dspkginit.c @@ -419,9 +419,12 @@ AcpiDsInitPackageElement ( ACPI_OPERAND_OBJECT **ElementPtr; + ACPI_FUNCTION_TRACE (DsInitPackageElement); + + if (!SourceObject) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* @@ -456,7 +459,7 @@ AcpiDsInitPackageElement ( SourceObject->Package.Flags |= AOPOBJ_DATA_VALID; } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } @@ -481,6 +484,7 @@ AcpiDsResolvePackageElement ( ACPI_GENERIC_STATE ScopeInfo; ACPI_OPERAND_OBJECT *Element = *ElementPtr; ACPI_NAMESPACE_NODE *ResolvedNode; + ACPI_NAMESPACE_NODE *OriginalNode; char *ExternalPath = NULL; ACPI_OBJECT_TYPE Type; @@ -576,6 +580,7 @@ AcpiDsResolvePackageElement ( * will remain as named references. This behavior is not described * in the ACPI spec, but it appears to be an oversight. */ + OriginalNode = ResolvedNode; Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL); if (ACPI_FAILURE (Status)) { @@ -607,26 +612,27 @@ AcpiDsResolvePackageElement ( */ case ACPI_TYPE_DEVICE: case ACPI_TYPE_THERMAL: - - /* TBD: This may not be necesssary */ - - AcpiUtAddReference (ResolvedNode->Object); + case ACPI_TYPE_METHOD: 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: + /* AcpiExResolveNodeToValue gave these an extra reference */ + + AcpiUtRemoveReference (OriginalNode->Object); break; default: /* * For all other types - the node was resolved to an actual - * operand object with a value, return the object + * operand object with a value, return the object. Remove + * a reference on the existing object. */ + AcpiUtRemoveReference (Element); *ElementPtr = (ACPI_OPERAND_OBJECT *) ResolvedNode; break; } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c index 41583abbf34..abd55de0c6c 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dsutils.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dsutils.c @@ -732,7 +732,8 @@ AcpiDsCreateOperand ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (NameString, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + NameString, Status); } } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c index 9cdf756bc0a..5b165e0afd9 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswexec.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswexec.c @@ -253,7 +253,7 @@ AcpiDsGetPredicateValue ( * object. Implicitly convert the argument if necessary. */ Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, - ACPI_STRTOUL_BASE16); + ACPI_IMPLICIT_CONVERSION); if (ACPI_FAILURE (Status)) { goto Cleanup; diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload.c b/sys/contrib/dev/acpica/components/dispatcher/dswload.c index 2ac3d6d0250..60a4e301822 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload.c @@ -325,7 +325,7 @@ AcpiDsLoad1BeginOp ( #endif if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); return_ACPI_STATUS (Status); } @@ -495,7 +495,7 @@ AcpiDsLoad1BeginOp ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); return_ACPI_STATUS (Status); } } diff --git a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c index f0bcdba41cc..cd691da7488 100644 --- a/sys/contrib/dev/acpica/components/dispatcher/dswload2.c +++ b/sys/contrib/dev/acpica/components/dispatcher/dswload2.c @@ -304,10 +304,12 @@ AcpiDsLoad2BeginOp ( } else { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); } #else - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); #endif return_ACPI_STATUS (Status); } @@ -462,7 +464,8 @@ AcpiDsLoad2BeginOp ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (BufferPtr, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + BufferPtr, Status); return_ACPI_STATUS (Status); } @@ -844,7 +847,8 @@ AcpiDsLoad2EndOp ( } else { - ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + Arg->Common.Value.String, Status); } break; diff --git a/sys/contrib/dev/acpica/components/events/evgpe.c b/sys/contrib/dev/acpica/components/events/evgpe.c index f491e4b53ae..4bbe9ad5e51 100644 --- a/sys/contrib/dev/acpica/components/events/evgpe.c +++ b/sys/contrib/dev/acpica/components/events/evgpe.c @@ -551,8 +551,8 @@ AcpiEvGpeDetect ( ACPI_GPE_HANDLER_INFO *GpeHandlerInfo; UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; UINT8 EnabledStatusByte; - UINT32 StatusReg; - UINT32 EnableReg; + UINT64 StatusReg; + UINT64 EnableReg; ACPI_CPU_FLAGS Flags; UINT32 i; UINT32 j; @@ -629,7 +629,7 @@ AcpiEvGpeDetect ( "RunEnable=%02X, WakeEnable=%02X\n", GpeRegisterInfo->BaseGpeNumber, GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), - StatusReg, EnableReg, + (UINT32) StatusReg, (UINT32) EnableReg, GpeRegisterInfo->EnableForRun, GpeRegisterInfo->EnableForWake)); diff --git a/sys/contrib/dev/acpica/components/events/evregion.c b/sys/contrib/dev/acpica/components/events/evregion.c index ac2adc64c25..7cdd634217d 100644 --- a/sys/contrib/dev/acpica/components/events/evregion.c +++ b/sys/contrib/dev/acpica/components/events/evregion.c @@ -423,6 +423,17 @@ AcpiEvAddressSpaceDispatch ( { ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]", AcpiUtGetRegionName (RegionObj->Region.SpaceId))); + + /* + * Special case for an EC timeout. These are seen so frequently + * that an additional error message is helpful + */ + if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) && + (Status == AE_TIME)) + { + ACPI_ERROR ((AE_INFO, + "Timeout from EC hardware or EC device driver")); + } } if (!(HandlerDesc->AddressSpace.HandlerFlags & diff --git a/sys/contrib/dev/acpica/components/executer/exconcat.c b/sys/contrib/dev/acpica/components/executer/exconcat.c index 1242af19ea6..829a9872197 100644 --- a/sys/contrib/dev/acpica/components/executer/exconcat.c +++ b/sys/contrib/dev/acpica/components/executer/exconcat.c @@ -274,7 +274,7 @@ AcpiExDoConcatenate ( case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (LocalOperand1, &TempOperand1, - ACPI_STRTOUL_BASE16); + ACPI_IMPLICIT_CONVERSION); break; case ACPI_TYPE_BUFFER: diff --git a/sys/contrib/dev/acpica/components/executer/exconvrt.c b/sys/contrib/dev/acpica/components/executer/exconvrt.c index a56be00412e..d084e117ef5 100644 --- a/sys/contrib/dev/acpica/components/executer/exconvrt.c +++ b/sys/contrib/dev/acpica/components/executer/exconvrt.c @@ -172,10 +172,10 @@ AcpiExConvertToAscii ( * * FUNCTION: AcpiExConvertToInteger * - * PARAMETERS: ObjDesc - Object to be converted. Must be an - * Integer, Buffer, or String - * ResultDesc - Where the new Integer object is returned - * Flags - Used for string conversion + * PARAMETERS: ObjDesc - Object to be converted. Must be an + * Integer, Buffer, or String + * ResultDesc - Where the new Integer object is returned + * ImplicitConversion - Used for string conversion * * RETURN: Status * @@ -187,14 +187,13 @@ ACPI_STATUS AcpiExConvertToInteger ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 Flags) + UINT32 ImplicitConversion) { ACPI_OPERAND_OBJECT *ReturnDesc; UINT8 *Pointer; UINT64 Result; UINT32 i; UINT32 Count; - ACPI_STATUS Status; ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc); @@ -244,12 +243,17 @@ AcpiExConvertToInteger ( * hexadecimal as per the ACPI specification. The only exception (as * of ACPI 3.0) is that the ToInteger() operator allows both decimal * and hexadecimal strings (hex prefixed with "0x"). + * + * Explicit conversion is used only by ToInteger. + * All other string-to-integer conversions are implicit conversions. */ - Status = AcpiUtStrtoul64 (ACPI_CAST_PTR (char, Pointer), - (AcpiGbl_IntegerByteWidth | Flags), &Result); - if (ACPI_FAILURE (Status)) + if (ImplicitConversion) + { + Result = AcpiUtImplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer)); + } + else { - return_ACPI_STATUS (Status); + Result = AcpiUtExplicitStrtoul64 (ACPI_CAST_PTR (char, Pointer)); } break; @@ -792,7 +796,7 @@ AcpiExConvertToTargetType ( * a Buffer or a String to an Integer if necessary. */ Status = AcpiExConvertToInteger (SourceDesc, ResultDesc, - ACPI_STRTOUL_BASE16); + ACPI_IMPLICIT_CONVERSION); break; case ACPI_TYPE_STRING: diff --git a/sys/contrib/dev/acpica/components/executer/exdump.c b/sys/contrib/dev/acpica/components/executer/exdump.c index 3c67608a748..5d600e11a63 100644 --- a/sys/contrib/dev/acpica/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/components/executer/exdump.c @@ -747,7 +747,7 @@ AcpiExDumpOperand ( UINT32 Index; - ACPI_FUNCTION_NAME (ExDumpOperand) + ACPI_FUNCTION_NAME (ExDumpOperand); /* Check if debug output enabled */ @@ -1042,7 +1042,7 @@ AcpiExDumpOperands ( const char *OpcodeName, UINT32 NumOperands) { - ACPI_FUNCTION_NAME (ExDumpOperands); + ACPI_FUNCTION_TRACE (ExDumpOperands); if (!OpcodeName) @@ -1070,7 +1070,7 @@ AcpiExDumpOperands ( ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "**** End operand dump for [%s]\n", OpcodeName)); - return; + return_VOID; } diff --git a/sys/contrib/dev/acpica/components/executer/exmisc.c b/sys/contrib/dev/acpica/components/executer/exmisc.c index 6385fc773e6..f4683ae3308 100644 --- a/sys/contrib/dev/acpica/components/executer/exmisc.c +++ b/sys/contrib/dev/acpica/components/executer/exmisc.c @@ -472,7 +472,7 @@ AcpiExDoLogicalOp ( case ACPI_TYPE_INTEGER: Status = AcpiExConvertToInteger (Operand1, &LocalOperand1, - ACPI_STRTOUL_BASE16); + ACPI_IMPLICIT_CONVERSION); break; case ACPI_TYPE_STRING: diff --git a/sys/contrib/dev/acpica/components/executer/exresop.c b/sys/contrib/dev/acpica/components/executer/exresop.c index c1a991d6f34..cb820c7638a 100644 --- a/sys/contrib/dev/acpica/components/executer/exresop.c +++ b/sys/contrib/dev/acpica/components/executer/exresop.c @@ -541,7 +541,7 @@ AcpiExResolveOperands ( * Known as "Implicit Source Operand Conversion" */ Status = AcpiExConvertToInteger (ObjDesc, StackPtr, - ACPI_STRTOUL_BASE16); + ACPI_IMPLICIT_CONVERSION); if (ACPI_FAILURE (Status)) { if (Status == AE_TYPE) diff --git a/sys/contrib/dev/acpica/components/hardware/hwgpe.c b/sys/contrib/dev/acpica/components/hardware/hwgpe.c index 002f3366162..680a4a9b8cc 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwgpe.c +++ b/sys/contrib/dev/acpica/components/hardware/hwgpe.c @@ -217,7 +217,7 @@ AcpiHwLowSetGpe ( { ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_STATUS Status = AE_OK; - UINT32 EnableMask; + UINT64 EnableMask; UINT32 RegisterBit; @@ -342,7 +342,7 @@ AcpiHwGetGpeStatus ( ACPI_GPE_EVENT_INFO *GpeEventInfo, ACPI_EVENT_STATUS *EventStatus) { - UINT32 InByte; + UINT64 InByte; UINT32 RegisterBit; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_EVENT_STATUS LocalEventStatus = 0; diff --git a/sys/contrib/dev/acpica/components/hardware/hwregs.c b/sys/contrib/dev/acpica/components/hardware/hwregs.c index af4381cf768..854bb8f37be 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwregs.c +++ b/sys/contrib/dev/acpica/components/hardware/hwregs.c @@ -355,9 +355,8 @@ AcpiHwValidateRegister ( * * RETURN: Status * - * DESCRIPTION: Read from either memory or IO space. This is a 32-bit max - * version of AcpiRead, used internally since the overhead of - * 64-bit values is not needed. + * DESCRIPTION: Read from either memory or IO space. This is a 64-bit max + * version of AcpiRead. * * LIMITATIONS: * SpaceID must be SystemMemory or SystemIO. @@ -366,7 +365,7 @@ AcpiHwValidateRegister ( ACPI_STATUS AcpiHwRead ( - UINT32 *Value, + UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg) { UINT64 Address; @@ -384,18 +383,18 @@ AcpiHwRead ( /* Validate contents of the GAS register */ - Status = AcpiHwValidateRegister (Reg, 32, &Address); + Status = AcpiHwValidateRegister (Reg, 64, &Address); if (ACPI_FAILURE (Status)) { return (Status); } /* - * Initialize entire 32-bit return value to zero, convert AccessWidth + * Initialize entire 64-bit return value to zero, convert AccessWidth * into number of bits based */ *Value = 0; - AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32); + AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 64); BitWidth = Reg->BitOffset + Reg->BitWidth; BitOffset = Reg->BitOffset; @@ -408,7 +407,7 @@ AcpiHwRead ( { if (BitOffset >= AccessWidth) { - Value32 = 0; + Value64 = 0; BitOffset -= AccessWidth; } else @@ -418,31 +417,31 @@ AcpiHwRead ( Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &Value64, AccessWidth); - Value32 = (UINT32) Value64; } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), &Value32, AccessWidth); + Value64 = (UINT64) Value32; } } /* * Use offset style bit writes because "Index * AccessWidth" is - * ensured to be less than 32-bits by AcpiHwValidateRegister(). + * ensured to be less than 64-bits by AcpiHwValidateRegister(). */ ACPI_SET_BITS (Value, Index * AccessWidth, - ACPI_MASK_BITS_ABOVE_32 (AccessWidth), Value32); + ACPI_MASK_BITS_ABOVE_64 (AccessWidth), Value64); BitWidth -= BitWidth > AccessWidth ? AccessWidth : BitWidth; Index++; } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n", - *Value, AccessWidth, ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); + "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (*Value), AccessWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); } @@ -457,15 +456,14 @@ AcpiHwRead ( * * RETURN: Status * - * DESCRIPTION: Write to either memory or IO space. This is a 32-bit max - * version of AcpiWrite, used internally since the overhead of - * 64-bit values is not needed. + * DESCRIPTION: Write to either memory or IO space. This is a 64-bit max + * version of AcpiWrite. * ******************************************************************************/ ACPI_STATUS AcpiHwWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg) { UINT64 Address; @@ -473,7 +471,6 @@ AcpiHwWrite ( UINT32 BitWidth; UINT8 BitOffset; UINT64 Value64; - UINT32 Value32; UINT8 Index; ACPI_STATUS Status; @@ -483,7 +480,7 @@ AcpiHwWrite ( /* Validate contents of the GAS register */ - Status = AcpiHwValidateRegister (Reg, 32, &Address); + Status = AcpiHwValidateRegister (Reg, 64, &Address); if (ACPI_FAILURE (Status)) { return (Status); @@ -491,7 +488,7 @@ AcpiHwWrite ( /* Convert AccessWidth into number of bits based */ - AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 32); + AccessWidth = AcpiHwGetAccessBitWidth (Address, Reg, 64); BitWidth = Reg->BitOffset + Reg->BitWidth; BitOffset = Reg->BitOffset; @@ -504,10 +501,10 @@ AcpiHwWrite ( { /* * Use offset style bit reads because "Index * AccessWidth" is - * ensured to be less than 32-bits by AcpiHwValidateRegister(). + * ensured to be less than 64-bits by AcpiHwValidateRegister(). */ - Value32 = ACPI_GET_BITS (&Value, Index * AccessWidth, - ACPI_MASK_BITS_ABOVE_32 (AccessWidth)); + Value64 = ACPI_GET_BITS (&Value, Index * AccessWidth, + ACPI_MASK_BITS_ABOVE_64 (AccessWidth)); if (BitOffset >= AccessWidth) { @@ -517,7 +514,6 @@ AcpiHwWrite ( { if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { - Value64 = (UINT64) Value32; Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), Value64, AccessWidth); @@ -526,7 +522,7 @@ AcpiHwWrite ( { Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address + Index * ACPI_DIV_8 (AccessWidth), - Value32, AccessWidth); + (UINT32) Value64, AccessWidth); } } @@ -539,9 +535,9 @@ AcpiHwWrite ( } ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n", - Value, AccessWidth, ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); + "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", + ACPI_FORMAT_UINT64 (Value), AccessWidth, + ACPI_FORMAT_UINT64 (Address), AcpiUtGetRegionName (Reg->SpaceId))); return (Status); } @@ -688,6 +684,7 @@ AcpiHwRegisterRead ( UINT32 *ReturnValue) { UINT32 Value = 0; + UINT64 Value64; ACPI_STATUS Status; @@ -726,12 +723,14 @@ AcpiHwRegisterRead ( case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */ - Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPm2ControlBlock); + Value = (UINT32) Value64; break; case ACPI_REGISTER_PM_TIMER: /* 32-bit access */ - Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (&Value64, &AcpiGbl_FADT.XPmTimerBlock); + Value = (UINT32) Value64; break; case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */ @@ -749,7 +748,7 @@ AcpiHwRegisterRead ( if (ACPI_SUCCESS (Status)) { - *ReturnValue = Value; + *ReturnValue = (UINT32) Value; } return_ACPI_STATUS (Status); @@ -789,6 +788,7 @@ AcpiHwRegisterWrite ( { ACPI_STATUS Status; UINT32 ReadValue; + UINT64 ReadValue64; ACPI_FUNCTION_TRACE (HwRegisterWrite); @@ -850,11 +850,12 @@ AcpiHwRegisterWrite ( * For control registers, all reserved bits must be preserved, * as per the ACPI spec. */ - Status = AcpiHwRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock); + Status = AcpiHwRead (&ReadValue64, &AcpiGbl_FADT.XPm2ControlBlock); if (ACPI_FAILURE (Status)) { goto Exit; } + ReadValue = (UINT32) ReadValue64; /* Insert the bits to be preserved */ @@ -910,26 +911,29 @@ AcpiHwReadMultiple ( { UINT32 ValueA = 0; UINT32 ValueB = 0; + UINT64 Value64; ACPI_STATUS Status; /* The first register is always required */ - Status = AcpiHwRead (&ValueA, RegisterA); + Status = AcpiHwRead (&Value64, RegisterA); if (ACPI_FAILURE (Status)) { return (Status); } + ValueA = (UINT32) Value64; /* Second register is optional */ if (RegisterB->Address) { - Status = AcpiHwRead (&ValueB, RegisterB); + Status = AcpiHwRead (&Value64, RegisterB); if (ACPI_FAILURE (Status)) { return (Status); } + ValueB = (UINT32) Value64; } /* diff --git a/sys/contrib/dev/acpica/components/hardware/hwtimer.c b/sys/contrib/dev/acpica/components/hardware/hwtimer.c index a27c830a950..22a4a974987 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwtimer.c +++ b/sys/contrib/dev/acpica/components/hardware/hwtimer.c @@ -215,6 +215,7 @@ AcpiGetTimer ( UINT32 *Ticks) { ACPI_STATUS Status; + UINT64 TimerValue; ACPI_FUNCTION_TRACE (AcpiGetTimer); @@ -232,7 +233,14 @@ AcpiGetTimer ( return_ACPI_STATUS (AE_SUPPORT); } - Status = AcpiHwRead (Ticks, &AcpiGbl_FADT.XPmTimerBlock); + Status = AcpiHwRead (&TimerValue, &AcpiGbl_FADT.XPmTimerBlock); + if (ACPI_SUCCESS (Status)) + { + /* ACPI PM Timer is defined to be 32 bits (PM_TMR_LEN) */ + + *Ticks = (UINT32) TimerValue; + } + return_ACPI_STATUS (Status); } @@ -275,7 +283,7 @@ AcpiGetTimerDuration ( UINT32 *TimeElapsed) { ACPI_STATUS Status; - UINT32 DeltaTicks; + UINT64 DeltaTicks; UINT64 Quotient; @@ -294,34 +302,33 @@ AcpiGetTimerDuration ( return_ACPI_STATUS (AE_SUPPORT); } + if (StartTicks == EndTicks) + { + *TimeElapsed = 0; + return_ACPI_STATUS (AE_OK); + } + /* * Compute Tick Delta: * Handle (max one) timer rollovers on 24-bit versus 32-bit timers. */ - if (StartTicks < EndTicks) - { - DeltaTicks = EndTicks - StartTicks; - } - else if (StartTicks > EndTicks) + DeltaTicks = EndTicks; + if (StartTicks > EndTicks) { if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0) { /* 24-bit Timer */ - DeltaTicks = (((0x00FFFFFF - StartTicks) + EndTicks) & 0x00FFFFFF); + DeltaTicks |= (UINT64) 1 << 24; } else { /* 32-bit Timer */ - DeltaTicks = (0xFFFFFFFF - StartTicks) + EndTicks; + DeltaTicks |= (UINT64) 1 << 32; } } - else /* StartTicks == EndTicks */ - { - *TimeElapsed = 0; - return_ACPI_STATUS (AE_OK); - } + DeltaTicks -= StartTicks; /* * Compute Duration (Requires a 64-bit multiply and divide): @@ -329,7 +336,7 @@ AcpiGetTimerDuration ( * TimeElapsed (microseconds) = * (DeltaTicks * ACPI_USEC_PER_SEC) / ACPI_PM_TIMER_FREQUENCY; */ - Status = AcpiUtShortDivide (((UINT64) DeltaTicks) * ACPI_USEC_PER_SEC, + Status = AcpiUtShortDivide (DeltaTicks * ACPI_USEC_PER_SEC, ACPI_PM_TIMER_FREQUENCY, &Quotient, NULL); *TimeElapsed = (UINT32) Quotient; diff --git a/sys/contrib/dev/acpica/components/hardware/hwvalid.c b/sys/contrib/dev/acpica/components/hardware/hwvalid.c index 4975a58a580..61cd0e3fa5c 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwvalid.c +++ b/sys/contrib/dev/acpica/components/hardware/hwvalid.c @@ -245,7 +245,7 @@ AcpiHwValidateIoRequest ( const ACPI_PORT_INFO *PortInfo; - ACPI_FUNCTION_NAME (HwValidateIoRequest); + ACPI_FUNCTION_TRACE (HwValidateIoRequest); /* Supported widths are 8/16/32 */ @@ -256,14 +256,15 @@ AcpiHwValidateIoRequest ( { ACPI_ERROR ((AE_INFO, "Bad BitWidth parameter: %8.8X", BitWidth)); - return (AE_BAD_PARAMETER); + return_ACPI_STATUS (AE_BAD_PARAMETER); } PortInfo = AcpiProtectedPorts; ByteWidth = ACPI_DIV_8 (BitWidth); LastAddress = Address + ByteWidth - 1; - ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", + ACPI_DEBUG_PRINT ((ACPI_DB_IO, + "Address %8.8X%8.8X LastAddress %8.8X%8.8X Length %X", ACPI_FORMAT_UINT64 (Address), ACPI_FORMAT_UINT64 (LastAddress), ByteWidth)); @@ -274,14 +275,14 @@ AcpiHwValidateIoRequest ( ACPI_ERROR ((AE_INFO, "Illegal I/O port address/length above 64K: %8.8X%8.8X/0x%X", ACPI_FORMAT_UINT64 (Address), ByteWidth)); - return (AE_LIMIT); + return_ACPI_STATUS (AE_LIMIT); } /* Exit if requested address is not within the protected port table */ if (Address > AcpiProtectedPorts[ACPI_PORT_INFO_ENTRIES - 1].End) { - return (AE_OK); + return_ACPI_STATUS (AE_OK); } /* Check request against the list of protected I/O ports */ @@ -303,8 +304,8 @@ AcpiHwValidateIoRequest ( if (AcpiGbl_OsiData >= PortInfo->OsiDependency) { - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)", + ACPI_DEBUG_PRINT ((ACPI_DB_VALUES, + "Denied AML access to port 0x%8.8X%8.8X/%X (%s 0x%.4X-0x%.4X)\n", ACPI_FORMAT_UINT64 (Address), ByteWidth, PortInfo->Name, PortInfo->Start, PortInfo->End)); @@ -320,7 +321,7 @@ AcpiHwValidateIoRequest ( } } - return (AE_OK); + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/components/hardware/hwxface.c b/sys/contrib/dev/acpica/components/hardware/hwxface.c index b049114c75c..78c2af5138e 100644 --- a/sys/contrib/dev/acpica/components/hardware/hwxface.c +++ b/sys/contrib/dev/acpica/components/hardware/hwxface.c @@ -247,84 +247,14 @@ AcpiRead ( UINT64 *ReturnValue, ACPI_GENERIC_ADDRESS *Reg) { - UINT32 ValueLo; - UINT32 ValueHi; - UINT32 Width; - UINT64 Address; ACPI_STATUS Status; ACPI_FUNCTION_NAME (AcpiRead); - if (!ReturnValue) - { - return (AE_BAD_PARAMETER); - } - - /* Validate contents of the GAS register. Allow 64-bit transfers */ - - Status = AcpiHwValidateRegister (Reg, 64, &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Two address spaces supported: Memory or I/O. PCI_Config is - * not supported here because the GAS structure is insufficient - */ - if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) - { - Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - Address, ReturnValue, Reg->BitWidth); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ - { - ValueLo = 0; - ValueHi = 0; - - Width = Reg->BitWidth; - if (Width == 64) - { - Width = 32; /* Break into two 32-bit transfers */ - } - - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - Address, &ValueLo, Width); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (Reg->BitWidth == 64) - { - /* Read the top 32 bits */ - - Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) - (Address + 4), &ValueHi, 32); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - - /* Set the return value only if status is AE_OK */ - - *ReturnValue = (ValueLo | ((UINT64) ValueHi << 32)); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Read: %8.8X%8.8X width %2d from %8.8X%8.8X (%s)\n", - ACPI_FORMAT_UINT64 (*ReturnValue), Reg->BitWidth, - ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); - - return (AE_OK); + Status = AcpiHwRead (ReturnValue, Reg); + return (Status); } ACPI_EXPORT_SYMBOL (AcpiRead) @@ -348,67 +278,13 @@ AcpiWrite ( UINT64 Value, ACPI_GENERIC_ADDRESS *Reg) { - UINT32 Width; - UINT64 Address; ACPI_STATUS Status; ACPI_FUNCTION_NAME (AcpiWrite); - /* Validate contents of the GAS register. Allow 64-bit transfers */ - - Status = AcpiHwValidateRegister (Reg, 64, &Address); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Two address spaces supported: Memory or IO. PCI_Config is - * not supported here because the GAS structure is insufficient - */ - if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) - { - Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - Address, Value, Reg->BitWidth); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ - { - Width = Reg->BitWidth; - if (Width == 64) - { - Width = 32; /* Break into two 32-bit transfers */ - } - - Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - Address, ACPI_LODWORD (Value), Width); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - if (Reg->BitWidth == 64) - { - Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) - (Address + 4), ACPI_HIDWORD (Value), 32); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - } - - ACPI_DEBUG_PRINT ((ACPI_DB_IO, - "Wrote: %8.8X%8.8X width %2d to %8.8X%8.8X (%s)\n", - ACPI_FORMAT_UINT64 (Value), Reg->BitWidth, - ACPI_FORMAT_UINT64 (Address), - AcpiUtGetRegionName (Reg->SpaceId))); - + Status = AcpiHwWrite (Value, Reg); return (Status); } diff --git a/sys/contrib/dev/acpica/components/namespace/nsaccess.c b/sys/contrib/dev/acpica/components/namespace/nsaccess.c index 1d979cea8a7..28c32489de2 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsaccess.c +++ b/sys/contrib/dev/acpica/components/namespace/nsaccess.c @@ -775,19 +775,19 @@ AcpiNsLookup ( ThisNode = (ACPI_NAMESPACE_NODE *) ThisNode->Object; } } -#ifdef ACPI_ASL_COMPILER - if (!AcpiGbl_DisasmFlag && - (ThisNode->Flags & ANOBJ_IS_EXTERNAL)) - { - ThisNode->Flags |= IMPLICIT_EXTERNAL; - } -#endif } /* Special handling for the last segment (NumSegments == 0) */ else { +#ifdef ACPI_ASL_COMPILER + if (!AcpiGbl_DisasmFlag && (ThisNode->Flags & ANOBJ_IS_EXTERNAL)) + { + ThisNode->Flags &= ~IMPLICIT_EXTERNAL; + } +#endif + /* * Sanity typecheck of the target object: * diff --git a/sys/contrib/dev/acpica/components/namespace/nsconvert.c b/sys/contrib/dev/acpica/components/namespace/nsconvert.c index 4ba8b5d9a3a..1f8b8740104 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsconvert.c +++ b/sys/contrib/dev/acpica/components/namespace/nsconvert.c @@ -191,8 +191,7 @@ AcpiNsConvertToInteger ( /* String-to-Integer conversion */ - Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, - AcpiGbl_IntegerByteWidth, &Value); + Status = AcpiUtStrtoul64 (OriginalObject->String.Pointer, &Value); if (ACPI_FAILURE (Status)) { return (Status); @@ -645,7 +644,8 @@ AcpiNsConvertToReference ( { /* Check if we are resolving a named reference within a package */ - ACPI_ERROR_NAMESPACE (OriginalObject->String.Pointer, Status); + ACPI_ERROR_NAMESPACE (&ScopeInfo, + OriginalObject->String.Pointer, Status); goto ErrorExit; } diff --git a/sys/contrib/dev/acpica/components/namespace/nsnames.c b/sys/contrib/dev/acpica/components/namespace/nsnames.c index f122729b9be..389c83d28e7 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsnames.c +++ b/sys/contrib/dev/acpica/components/namespace/nsnames.c @@ -158,6 +158,12 @@ #define _COMPONENT ACPI_NAMESPACE ACPI_MODULE_NAME ("nsnames") +/* Local Prototypes */ + +static void +AcpiNsNormalizePathname ( + char *OriginalPath); + /******************************************************************************* * @@ -507,3 +513,169 @@ AcpiNsGetNormalizedPathname ( return_PTR (NameBuffer); } + + +/******************************************************************************* + * + * FUNCTION: AcpiNsBuildPrefixedPathname + * + * PARAMETERS: PrefixScope - Scope/Path that prefixes the internal path + * InternalPath - Name or path of the namespace node + * + * RETURN: None + * + * DESCRIPTION: Construct a fully qualified pathname from a concatenation of: + * 1) Path associated with the PrefixScope namespace node + * 2) External path representation of the Internal path + * + ******************************************************************************/ + +char * +AcpiNsBuildPrefixedPathname ( + ACPI_GENERIC_STATE *PrefixScope, + const char *InternalPath) +{ + ACPI_STATUS Status; + char *FullPath = NULL; + char *ExternalPath = NULL; + char *PrefixPath = NULL; + UINT32 PrefixPathLength = 0; + + + /* If there is a prefix, get the pathname to it */ + + if (PrefixScope && PrefixScope->Scope.Node) + { + PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE); + if (PrefixPath) + { + PrefixPathLength = strlen (PrefixPath); + } + } + + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath, + NULL, &ExternalPath); + if (ACPI_FAILURE (Status)) + { + goto Cleanup; + } + + /* Merge the prefix path and the path. 2 is for one dot and trailing null */ + + FullPath = ACPI_ALLOCATE_ZEROED ( + PrefixPathLength + strlen (ExternalPath) + 2); + if (!FullPath) + { + goto Cleanup; + } + + /* Don't merge if the External path is already fully qualified */ + + if (PrefixPath && + (*ExternalPath != '\\') && + (*ExternalPath != '^')) + { + strcat (FullPath, PrefixPath); + if (PrefixPath[1]) + { + strcat (FullPath, "."); + } + } + + AcpiNsNormalizePathname (ExternalPath); + strcat (FullPath, ExternalPath); + +Cleanup: + if (PrefixPath) + { + ACPI_FREE (PrefixPath); + } + if (ExternalPath) + { + ACPI_FREE (ExternalPath); + } + + return (FullPath); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiNsNormalizePathname + * + * PARAMETERS: OriginalPath - Path to be normalized, in External format + * + * RETURN: The original path is processed in-place + * + * DESCRIPTION: Remove trailing underscores from each element of a path. + * + * For example: \A___.B___.C___ becomes \A.B.C + * + ******************************************************************************/ + +static void +AcpiNsNormalizePathname ( + char *OriginalPath) +{ + char *InputPath = OriginalPath; + char *NewPathBuffer; + char *NewPath; + UINT32 i; + + + /* Allocate a temp buffer in which to construct the new path */ + + NewPathBuffer = ACPI_ALLOCATE_ZEROED (strlen (InputPath) + 1); + NewPath = NewPathBuffer; + if (!NewPathBuffer) + { + return; + } + + /* Special characters may appear at the beginning of the path */ + + if (*InputPath == '\\') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + + while (*InputPath == '^') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + + /* Remainder of the path */ + + while (*InputPath) + { + /* Do one nameseg at a time */ + + for (i = 0; (i < ACPI_NAME_SIZE) && *InputPath; i++) + { + if ((i == 0) || (*InputPath != '_')) /* First char is allowed to be underscore */ + { + *NewPath = *InputPath; + NewPath++; + } + + InputPath++; + } + + /* Dot means that there are more namesegs to come */ + + if (*InputPath == '.') + { + *NewPath = *InputPath; + NewPath++; + InputPath++; + } + } + + *NewPath = 0; + strcpy (OriginalPath, NewPathBuffer); + ACPI_FREE (NewPathBuffer); +} diff --git a/sys/contrib/dev/acpica/components/namespace/nssearch.c b/sys/contrib/dev/acpica/components/namespace/nssearch.c index 0c6eaf98ccc..8d14d5259c0 100644 --- a/sys/contrib/dev/acpica/components/namespace/nssearch.c +++ b/sys/contrib/dev/acpica/components/namespace/nssearch.c @@ -545,6 +545,7 @@ AcpiNsSearchAndEnter ( (WalkState && WalkState->Opcode == AML_SCOPE_OP)) { NewNode->Flags |= ANOBJ_IS_EXTERNAL; + NewNode->Flags |= IMPLICIT_EXTERNAL; } #endif diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index b8590f26e68..b3572456e24 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -174,11 +174,11 @@ AcpiNsResolveReferences ( * * PARAMETERS: Handle - Object handle (optional) * Pathname - Object pathname (optional) - * ExternalParams - List of parameters to pass to method, + * ExternalParams - List of parameters to pass to a method, * terminated by NULL. May be NULL * if no parameters are being passed. - * ReturnBuffer - Where to put method's return value (if - * any). If NULL, no value is returned. + * ReturnBuffer - Where to put the object return value (if + * any). Required. * ReturnType - Expected type of return object * * RETURN: Status @@ -218,10 +218,16 @@ AcpiEvaluateObjectTyped ( FreeBufferOnError = TRUE; } - Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); - if (ACPI_FAILURE (Status)) + /* Get a handle here, in order to build an error message if needed */ + + TargetHandle = Handle; + if (Pathname) { - return_ACPI_STATUS (Status); + Status = AcpiGetHandle (Handle, Pathname, &TargetHandle); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } } FullPathname = AcpiNsGetExternalPathname (TargetHandle); diff --git a/sys/contrib/dev/acpica/components/parser/psargs.c b/sys/contrib/dev/acpica/components/parser/psargs.c index 32dd906748a..7bf286c0206 100644 --- a/sys/contrib/dev/acpica/components/parser/psargs.c +++ b/sys/contrib/dev/acpica/components/parser/psargs.c @@ -500,7 +500,7 @@ AcpiPsGetNextNamepath ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (Path, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status); if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) diff --git a/sys/contrib/dev/acpica/components/parser/psobject.c b/sys/contrib/dev/acpica/components/parser/psobject.c index 73091e32acc..0260632a5ee 100644 --- a/sys/contrib/dev/acpica/components/parser/psobject.c +++ b/sys/contrib/dev/acpica/components/parser/psobject.c @@ -500,15 +500,10 @@ AcpiPsCreateOp ( * external declaration opcode. Setting WalkState->Aml to * WalkState->ParserState.Aml + 2 moves increments the * WalkState->Aml past the object type and the paramcount of the - * external opcode. For the error message, only print the AML - * offset. We could attempt to print the name but this may cause - * a segmentation fault when printing the namepath because the - * AML may be incorrect. + * external opcode. */ - AcpiOsPrintf ( - "// Invalid external declaration at AML offset 0x%x.\n", - WalkState->Aml - WalkState->ParserState.AmlStart); WalkState->Aml = WalkState->ParserState.Aml + 2; + WalkState->ParserState.Aml = WalkState->Aml; return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); } #endif diff --git a/sys/contrib/dev/acpica/components/parser/psutils.c b/sys/contrib/dev/acpica/components/parser/psutils.c index c67a7aec966..9f34531628d 100644 --- a/sys/contrib/dev/acpica/components/parser/psutils.c +++ b/sys/contrib/dev/acpica/components/parser/psutils.c @@ -213,7 +213,7 @@ AcpiPsInitOp ( Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER; Op->Common.AmlOpcode = Opcode; - ACPI_DISASM_ONLY_MEMBERS (strncpy (Op->Common.AmlOpName, + ACPI_DISASM_ONLY_MEMBERS (AcpiUtSafeStrncpy (Op->Common.AmlOpName, (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName))); } @@ -292,11 +292,11 @@ AcpiPsAllocOp ( { AcpiGbl_CurrentScope = Op; } - } - if (Gbl_CaptureComments) - { - ASL_CV_TRANSFER_COMMENTS (Op); + if (AcpiGbl_CaptureComments) + { + ASL_CV_TRANSFER_COMMENTS (Op); + } } return (Op); diff --git a/sys/contrib/dev/acpica/components/tables/tbxface.c b/sys/contrib/dev/acpica/components/tables/tbxface.c index 09e99eb2a0a..da550e870fb 100644 --- a/sys/contrib/dev/acpica/components/tables/tbxface.c +++ b/sys/contrib/dev/acpica/components/tables/tbxface.c @@ -300,10 +300,13 @@ AcpiReallocateRootTable ( /* - * Only reallocate the root table if the host provided a static buffer - * for the table array in the call to AcpiInitializeTables. + * If there are tables unverified, it is required to reallocate the + * root table list to clean up invalid table entries. Otherwise only + * reallocate the root table list if the host provided a static buffer + * for the table array in the call to AcpiInitializeTables(). */ - if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) + if ((AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) && + AcpiGbl_EnableTableValidation) { return_ACPI_STATUS (AE_SUPPORT); } diff --git a/sys/contrib/dev/acpica/components/utilities/utdebug.c b/sys/contrib/dev/acpica/components/utilities/utdebug.c index 70644d7ecfc..aa15767aad4 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdebug.c +++ b/sys/contrib/dev/acpica/components/utilities/utdebug.c @@ -290,7 +290,9 @@ AcpiDebugPrint ( { ACPI_THREAD_ID ThreadId; va_list args; - +#ifdef ACPI_APPLICATION + int FillCount; +#endif /* Check if debug output enabled */ @@ -334,10 +336,21 @@ AcpiDebugPrint ( AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } - AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); -#endif + FillCount = 48 - AcpiGbl_NestingLevel - + strlen (AcpiUtTrimFunctionName (FunctionName)); + if (FillCount < 0) + { + FillCount = 0; + } + AcpiOsPrintf ("[%02ld] %*s", + AcpiGbl_NestingLevel, AcpiGbl_NestingLevel + 1, " "); + AcpiOsPrintf ("%s%*s: ", + AcpiUtTrimFunctionName (FunctionName), FillCount, " "); + +#else AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); +#endif va_start (args, Format); AcpiOsVprintf (Format, args); diff --git a/sys/contrib/dev/acpica/components/utilities/utdecode.c b/sys/contrib/dev/acpica/components/utilities/utdecode.c index 726853de123..d77c71f6f50 100644 --- a/sys/contrib/dev/acpica/components/utilities/utdecode.c +++ b/sys/contrib/dev/acpica/components/utilities/utdecode.c @@ -558,11 +558,6 @@ AcpiUtGetReferenceName ( } -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) -/* - * Strings and procedures used for debug only - */ - /******************************************************************************* * * FUNCTION: AcpiUtGetMutexName @@ -601,6 +596,12 @@ AcpiUtGetMutexName ( } +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + +/* + * Strings and procedures used for debug only + */ + /******************************************************************************* * * FUNCTION: AcpiUtGetNotifyName diff --git a/sys/contrib/dev/acpica/components/utilities/uterror.c b/sys/contrib/dev/acpica/components/utilities/uterror.c index d386637d0ca..3b72808f67e 100644 --- a/sys/contrib/dev/acpica/components/utilities/uterror.c +++ b/sys/contrib/dev/acpica/components/utilities/uterror.c @@ -311,6 +311,82 @@ AcpiUtPredefinedBiosError ( } +/******************************************************************************* + * + * FUNCTION: AcpiUtPrefixedNamespaceError + * + * PARAMETERS: ModuleName - Caller's module name (for error output) + * LineNumber - Caller's line number (for error output) + * PrefixScope - Scope/Path that prefixes the internal path + * InternalPath - Name or path of the namespace node + * LookupStatus - Exception code from NS lookup + * + * RETURN: None + * + * DESCRIPTION: Print error message with the full pathname constructed this way: + * + * PrefixScopeNodeFullPath.ExternalizedInternalPath + * + * NOTE: 10/2017: Treat the major NsLookup errors as firmware errors + * + ******************************************************************************/ + +void +AcpiUtPrefixedNamespaceError ( + const char *ModuleName, + UINT32 LineNumber, + ACPI_GENERIC_STATE *PrefixScope, + const char *InternalPath, + ACPI_STATUS LookupStatus) +{ + char *FullPath; + const char *Message; + + + /* + * Main cases: + * 1) Object creation, object must not already exist + * 2) Object lookup, object must exist + */ + switch (LookupStatus) + { + case AE_ALREADY_EXISTS: + + AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); + Message = "Failure creating"; + break; + + case AE_NOT_FOUND: + + AcpiOsPrintf (ACPI_MSG_BIOS_ERROR); + Message = "Failure looking up"; + break; + + default: + + AcpiOsPrintf (ACPI_MSG_ERROR); + Message = "Failure looking up"; + break; + } + + /* Concatenate the prefix path and the internal path */ + + FullPath = AcpiNsBuildPrefixedPathname (PrefixScope, InternalPath); + + AcpiOsPrintf ("%s [%s], %s", Message, + FullPath ? FullPath : "Could not get pathname", + AcpiFormatException (LookupStatus)); + + if (FullPath) + { + ACPI_FREE (FullPath); + } + + ACPI_MSG_SUFFIX; +} + + +#ifdef __OBSOLETE_FUNCTION /******************************************************************************* * * FUNCTION: AcpiUtNamespaceError @@ -378,7 +454,7 @@ AcpiUtNamespaceError ( ACPI_MSG_SUFFIX; ACPI_MSG_REDIRECT_END; } - +#endif /******************************************************************************* * diff --git a/sys/contrib/dev/acpica/components/utilities/utinit.c b/sys/contrib/dev/acpica/components/utilities/utinit.c index f4bd8502e03..357ccd212d1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utinit.c +++ b/sys/contrib/dev/acpica/components/utilities/utinit.c @@ -334,7 +334,6 @@ AcpiUtInitGlobals ( AcpiGbl_NextOwnerIdOffset = 0; AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; AcpiGbl_OsiMutex = NULL; - AcpiGbl_MaxLoopIterations = ACPI_MAX_LOOP_COUNT; /* Hardware oriented */ diff --git a/sys/contrib/dev/acpica/components/utilities/utmath.c b/sys/contrib/dev/acpica/components/utilities/utmath.c index da5efbccddd..f9cd2b18e67 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmath.c +++ b/sys/contrib/dev/acpica/components/utilities/utmath.c @@ -260,7 +260,7 @@ AcpiUtShortShiftLeft ( if ((Count & 63) >= 32) { OperandOvl.Part.Hi = OperandOvl.Part.Lo; - OperandOvl.Part.Lo ^= OperandOvl.Part.Lo; + OperandOvl.Part.Lo = 0; Count = (Count & 63) - 32; } ACPI_SHIFT_LEFT_64_BY_32 (OperandOvl.Part.Hi, @@ -305,7 +305,7 @@ AcpiUtShortShiftRight ( if ((Count & 63) >= 32) { OperandOvl.Part.Lo = OperandOvl.Part.Hi; - OperandOvl.Part.Hi ^= OperandOvl.Part.Hi; + OperandOvl.Part.Hi = 0; Count = (Count & 63) - 32; } ACPI_SHIFT_RIGHT_64_BY_32 (OperandOvl.Part.Hi, diff --git a/sys/contrib/dev/acpica/components/utilities/utmutex.c b/sys/contrib/dev/acpica/components/utilities/utmutex.c index 26160e59b2d..40c0118e533 100644 --- a/sys/contrib/dev/acpica/components/utilities/utmutex.c +++ b/sys/contrib/dev/acpica/components/utilities/utmutex.c @@ -432,8 +432,8 @@ AcpiUtAcquireMutex ( else { ACPI_EXCEPTION ((AE_INFO, Status, - "Thread %u could not acquire Mutex [0x%X]", - (UINT32) ThisThreadId, MutexId)); + "Thread %u could not acquire Mutex [%s] (0x%X)", + (UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId), MutexId)); } return (Status); @@ -473,7 +473,8 @@ AcpiUtReleaseMutex ( if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED) { ACPI_ERROR ((AE_INFO, - "Mutex [0x%X] is not acquired, cannot release", MutexId)); + "Mutex [%s] (0x%X) is not acquired, cannot release", + AcpiUtGetMutexName (MutexId), MutexId)); return (AE_NOT_ACQUIRED); } diff --git a/sys/contrib/dev/acpica/components/utilities/utnonansi.c b/sys/contrib/dev/acpica/components/utilities/utnonansi.c index d3fae920626..dc7159f4cca 100644 --- a/sys/contrib/dev/acpica/components/utilities/utnonansi.c +++ b/sys/contrib/dev/acpica/components/utilities/utnonansi.c @@ -344,4 +344,17 @@ AcpiUtSafeStrncat ( strncat (Dest, Source, MaxTransferLength); return (FALSE); } + +void +AcpiUtSafeStrncpy ( + char *Dest, + char *Source, + ACPI_SIZE DestSize) +{ + /* Always terminate destination string */ + + strncpy (Dest, Source, DestSize); + Dest[DestSize - 1] = 0; +} + #endif diff --git a/sys/contrib/dev/acpica/components/utilities/utosi.c b/sys/contrib/dev/acpica/components/utilities/utosi.c index 2fd1f452a17..e19e211307a 100644 --- a/sys/contrib/dev/acpica/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/components/utilities/utosi.c @@ -214,6 +214,8 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2012", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8 and Server 2012 - Added 08/2012 */ {"Windows 2013", NULL, 0, ACPI_OSI_WIN_8}, /* Windows 8.1 and Server 2012 R2 - Added 01/2014 */ {"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */ + {"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */ + {"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */ /* Feature Group Strings */ diff --git a/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c b/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c new file mode 100644 index 00000000000..00d4cd69013 --- /dev/null +++ b/sys/contrib/dev/acpica/components/utilities/utstrsuppt.c @@ -0,0 +1,621 @@ +/******************************************************************************* + * + * Module Name: utstrsuppt - Support functions for string-to-integer conversion + * + ******************************************************************************/ + +/****************************************************************************** + * + * 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 +#include + +#define _COMPONENT ACPI_UTILITIES + ACPI_MODULE_NAME ("utstrsuppt") + + +/* Local prototypes */ + +static ACPI_STATUS +AcpiUtInsertDigit ( + UINT64 *AccumulatedValue, + UINT32 Base, + int AsciiDigit); + +static ACPI_STATUS +AcpiUtStrtoulMultiply64 ( + UINT64 Multiplicand, + UINT32 Base, + UINT64 *OutProduct); + +static ACPI_STATUS +AcpiUtStrtoulAdd64 ( + UINT64 Addend1, + UINT32 Digit, + UINT64 *OutSum); + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertOctalString + * + * PARAMETERS: String - Null terminated input string + * ReturnValuePtr - Where the converted value is returned + * + * RETURN: Status and 64-bit converted integer + * + * DESCRIPTION: Performs a base 8 conversion of the input string to an + * integer value, either 32 or 64 bits. + * + * NOTE: Maximum 64-bit unsigned octal value is 01777777777777777777777 + * Maximum 32-bit unsigned octal value is 037777777777 + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtConvertOctalString ( + char *String, + UINT64 *ReturnValuePtr) +{ + UINT64 AccumulatedValue = 0; + ACPI_STATUS Status = AE_OK; + + + /* Convert each ASCII byte in the input string */ + + while (*String) + { + /* Character must be ASCII 0-7, otherwise terminate with no error */ + + if (!(ACPI_IS_OCTAL_DIGIT (*String))) + { + break; + } + + /* Convert and insert this octal digit into the accumulator */ + + Status = AcpiUtInsertDigit (&AccumulatedValue, 8, *String); + if (ACPI_FAILURE (Status)) + { + Status = AE_OCTAL_OVERFLOW; + break; + } + + String++; + } + + /* Always return the value that has been accumulated */ + + *ReturnValuePtr = AccumulatedValue; + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertDecimalString + * + * PARAMETERS: String - Null terminated input string + * ReturnValuePtr - Where the converted value is returned + * + * RETURN: Status and 64-bit converted integer + * + * DESCRIPTION: Performs a base 10 conversion of the input string to an + * integer value, either 32 or 64 bits. + * + * NOTE: Maximum 64-bit unsigned decimal value is 18446744073709551615 + * Maximum 32-bit unsigned decimal value is 4294967295 + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtConvertDecimalString ( + char *String, + UINT64 *ReturnValuePtr) +{ + UINT64 AccumulatedValue = 0; + ACPI_STATUS Status = AE_OK; + + + /* Convert each ASCII byte in the input string */ + + while (*String) + { + /* Character must be ASCII 0-9, otherwise terminate with no error */ + + if (!isdigit (*String)) + { + break; + } + + /* Convert and insert this decimal digit into the accumulator */ + + Status = AcpiUtInsertDigit (&AccumulatedValue, 10, *String); + if (ACPI_FAILURE (Status)) + { + Status = AE_DECIMAL_OVERFLOW; + break; + } + + String++; + } + + /* Always return the value that has been accumulated */ + + *ReturnValuePtr = AccumulatedValue; + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtConvertHexString + * + * PARAMETERS: String - Null terminated input string + * ReturnValuePtr - Where the converted value is returned + * + * RETURN: Status and 64-bit converted integer + * + * DESCRIPTION: Performs a base 16 conversion of the input string to an + * integer value, either 32 or 64 bits. + * + * NOTE: Maximum 64-bit unsigned hex value is 0xFFFFFFFFFFFFFFFF + * Maximum 32-bit unsigned hex value is 0xFFFFFFFF + * + ******************************************************************************/ + +ACPI_STATUS +AcpiUtConvertHexString ( + char *String, + UINT64 *ReturnValuePtr) +{ + UINT64 AccumulatedValue = 0; + ACPI_STATUS Status = AE_OK; + + + /* Convert each ASCII byte in the input string */ + + while (*String) + { + /* Must be ASCII A-F, a-f, or 0-9, otherwise terminate with no error */ + + if (!isxdigit (*String)) + { + break; + } + + /* Convert and insert this hex digit into the accumulator */ + + Status = AcpiUtInsertDigit (&AccumulatedValue, 16, *String); + if (ACPI_FAILURE (Status)) + { + Status = AE_HEX_OVERFLOW; + break; + } + + String++; + } + + /* Always return the value that has been accumulated */ + + *ReturnValuePtr = AccumulatedValue; + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtRemoveLeadingZeros + * + * PARAMETERS: String - Pointer to input ASCII string + * + * RETURN: Next character after any leading zeros. This character may be + * used by the caller to detect end-of-string. + * + * DESCRIPTION: Remove any leading zeros in the input string. Return the + * next character after the final ASCII zero to enable the caller + * to check for the end of the string (NULL terminator). + * + ******************************************************************************/ + +char +AcpiUtRemoveLeadingZeros ( + char **String) +{ + + while (**String == ACPI_ASCII_ZERO) + { + *String += 1; + } + + return (**String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtRemoveWhitespace + * + * PARAMETERS: String - Pointer to input ASCII string + * + * RETURN: Next character after any whitespace. This character may be + * used by the caller to detect end-of-string. + * + * DESCRIPTION: Remove any leading whitespace in the input string. Return the + * next character after the final ASCII zero to enable the caller + * to check for the end of the string (NULL terminator). + * + ******************************************************************************/ + +char +AcpiUtRemoveWhitespace ( + char **String) +{ + + while (isspace ((UINT8) **String)) + { + *String += 1; + } + + return (**String); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtDetectHexPrefix + * + * PARAMETERS: String - Pointer to input ASCII string + * + * RETURN: TRUE if a "0x" prefix was found at the start of the string + * + * DESCRIPTION: Detect and remove a hex "0x" prefix + * + ******************************************************************************/ + +BOOLEAN +AcpiUtDetectHexPrefix ( + char **String) +{ + + if ((**String == ACPI_ASCII_ZERO) && + (tolower ((int) *(*String + 1)) == 'x')) + { + *String += 2; /* Go past the leading 0x */ + return (TRUE); + } + + return (FALSE); /* Not a hex string */ +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtDetectOctalPrefix + * + * PARAMETERS: String - Pointer to input ASCII string + * + * RETURN: True if an octal "0" prefix was found at the start of the + * string + * + * DESCRIPTION: Detect and remove an octal prefix (zero) + * + ******************************************************************************/ + +BOOLEAN +AcpiUtDetectOctalPrefix ( + char **String) +{ + + if (**String == ACPI_ASCII_ZERO) + { + *String += 1; /* Go past the leading 0 */ + return (TRUE); + } + + return (FALSE); /* Not an octal string */ +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtInsertDigit + * + * PARAMETERS: AccumulatedValue - Current value of the integer value + * accumulator. The new value is + * returned here. + * Base - Radix, either 8/10/16 + * AsciiDigit - ASCII single digit to be inserted + * + * RETURN: Status and result of the convert/insert operation. The only + * possible returned exception code is numeric overflow of + * either the multiply or add conversion operations. + * + * DESCRIPTION: Generic conversion and insertion function for all bases: + * + * 1) Multiply the current accumulated/converted value by the + * base in order to make room for the new character. + * + * 2) Convert the new character to binary and add it to the + * current accumulated value. + * + * Note: The only possible exception indicates an integer + * overflow (AE_NUMERIC_OVERFLOW) + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtInsertDigit ( + UINT64 *AccumulatedValue, + UINT32 Base, + int AsciiDigit) +{ + ACPI_STATUS Status; + UINT64 Product; + + + /* Make room in the accumulated value for the incoming digit */ + + Status = AcpiUtStrtoulMultiply64 (*AccumulatedValue, Base, &Product); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + /* Add in the new digit, and store the sum to the accumulated value */ + + Status = AcpiUtStrtoulAdd64 (Product, AcpiUtAsciiCharToHex (AsciiDigit), + AccumulatedValue); + + return (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoulMultiply64 + * + * PARAMETERS: Multiplicand - Current accumulated converted integer + * Base - Base/Radix + * OutProduct - Where the product is returned + * + * RETURN: Status and 64-bit product + * + * DESCRIPTION: Multiply two 64-bit values, with checking for 64-bit overflow as + * well as 32-bit overflow if necessary (if the current global + * integer width is 32). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtStrtoulMultiply64 ( + UINT64 Multiplicand, + UINT32 Base, + UINT64 *OutProduct) +{ + UINT64 Product; + UINT64 Quotient; + + + /* Exit if either operand is zero */ + + *OutProduct = 0; + if (!Multiplicand || !Base) + { + return (AE_OK); + } + + /* + * Check for 64-bit overflow before the actual multiplication. + * + * Notes: 64-bit division is often not supported on 32-bit platforms + * (it requires a library function), Therefore ACPICA has a local + * 64-bit divide function. Also, Multiplier is currently only used + * as the radix (8/10/16), to the 64/32 divide will always work. + */ + AcpiUtShortDivide (ACPI_UINT64_MAX, Base, &Quotient, NULL); + if (Multiplicand > Quotient) + { + return (AE_NUMERIC_OVERFLOW); + } + + Product = Multiplicand * Base; + + /* Check for 32-bit overflow if necessary */ + + if ((AcpiGbl_IntegerBitWidth == 32) && (Product > ACPI_UINT32_MAX)) + { + return (AE_NUMERIC_OVERFLOW); + } + + *OutProduct = Product; + return (AE_OK); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiUtStrtoulAdd64 + * + * PARAMETERS: Addend1 - Current accumulated converted integer + * Digit - New hex value/char + * OutSum - Where sum is returned (Accumulator) + * + * RETURN: Status and 64-bit sum + * + * DESCRIPTION: Add two 64-bit values, with checking for 64-bit overflow as + * well as 32-bit overflow if necessary (if the current global + * integer width is 32). + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiUtStrtoulAdd64 ( + UINT64 Addend1, + UINT32 Digit, + UINT64 *OutSum) +{ + UINT64 Sum; + + + /* Check for 64-bit overflow before the actual addition */ + + if ((Addend1 > 0) && (Digit > (ACPI_UINT64_MAX - Addend1))) + { + return (AE_NUMERIC_OVERFLOW); + } + + Sum = Addend1 + Digit; + + /* Check for 32-bit overflow if necessary */ + + if ((AcpiGbl_IntegerBitWidth == 32) && (Sum > ACPI_UINT32_MAX)) + { + return (AE_NUMERIC_OVERFLOW); + } + + *OutSum = Sum; + return (AE_OK); +} diff --git a/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c b/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c index faee601db19..1e7f43028a1 100644 --- a/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c +++ b/sys/contrib/dev/acpica/components/utilities/utstrtoul64.c @@ -1,6 +1,7 @@ /******************************************************************************* * - * Module Name: utstrtoul64 - string to 64-bit integer support + * Module Name: utstrtoul64 - String-to-integer conversion support for both + * 64-bit and 32-bit integers * ******************************************************************************/ @@ -152,84 +153,47 @@ #include #include - -/******************************************************************************* - * - * The functions in this module satisfy the need for 64-bit string-to-integer - * conversions on both 32-bit and 64-bit platforms. - * - ******************************************************************************/ - #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utstrtoul64") -/* Local prototypes */ - -static UINT64 -AcpiUtStrtoulBase10 ( - char *String, - UINT32 Flags); - -static UINT64 -AcpiUtStrtoulBase16 ( - char *String, - UINT32 Flags); - /******************************************************************************* * - * String conversion rules as written in the ACPI specification. The error - * conditions and behavior are different depending on the type of conversion. - * - * - * Implicit data type conversion: string-to-integer - * -------------------------------------------------- - * - * Base is always 16. This is the ACPI_STRTOUL_BASE16 case. - * - * Example: - * Add ("BA98", Arg0, Local0) - * - * The integer is initialized to the value zero. - * The ASCII string is interpreted as a hexadecimal constant. - * - * 1) A "0x" prefix is not allowed. However, ACPICA allows this for - * compatibility with previous ACPICA. (NO ERROR) - * - * 2) Terminates when the size of an integer is reached (32 or 64 bits). - * (NO ERROR) - * - * 3) The first non-hex character terminates the conversion without error. - * (NO ERROR) - * - * 4) Conversion of a null (zero-length) string to an integer is not - * allowed. However, ACPICA allows this for compatibility with previous - * ACPICA. This conversion returns the value 0. (NO ERROR) + * This module contains the top-level string to 64/32-bit unsigned integer + * conversion functions: * + * 1) A standard strtoul() function that supports 64-bit integers, base + * 8/10/16, with integer overflow support. This is used mainly by the + * iASL compiler, which implements tighter constraints on integer + * constants than the runtime (interpreter) integer-to-string conversions. + * 2) Runtime "Explicit conversion" as defined in the ACPI specification. + * 3) Runtime "Implicit conversion" as defined in the ACPI specification. * - * Explicit data type conversion: ToInteger() with string operand - * --------------------------------------------------------------- + * Current users of this module: * - * Base is either 10 (default) or 16 (with 0x prefix) - * - * Examples: - * ToInteger ("1000") - * ToInteger ("0xABCD") - * - * 1) Can be (must be) either a decimal or hexadecimal numeric string. - * A hex value must be prefixed by "0x" or it is interpreted as a decimal. + * iASL - Preprocessor (constants and math expressions) + * iASL - Main parser, conversion of constants to integers + * iASL - Data Table Compiler parser (constants and math expressions) + * Interpreter - Implicit and explicit conversions, GPE method names + * Interpreter - Repair code for return values from predefined names + * Debugger - Command line input string conversion + * AcpiDump - ACPI table physical addresses + * AcpiExec - Support for namespace overrides * - * 2) The value must not exceed the maximum of an integer value. ACPI spec - * states the behavior is "unpredictable", so ACPICA matches the behavior - * of the implicit conversion case.(NO ERROR) + * Notes concerning users of these interfaces: * - * 3) Behavior on the first non-hex character is not specified by the ACPI - * spec, so ACPICA matches the behavior of the implicit conversion case - * and terminates. (NO ERROR) + * AcpiGbl_IntegerByteWidth is used to set the 32/64 bit limit for explicit + * and implicit conversions. This global must be set to the proper width. + * For the core ACPICA code, the width depends on the DSDT version. For the + * AcpiUtStrtoul64 interface, all conversions are 64 bits. This interface is + * used primarily for iASL, where the default width is 64 bits for all parsers, + * but error checking is performed later to flag cases where a 64-bit constant + * is wrongly defined in a 32-bit DSDT/SSDT. * - * 4) A null (zero-length) string is illegal. - * However, ACPICA allows this for compatibility with previous ACPICA. - * This conversion returns the value 0. (NO ERROR) + * In ACPI, the only place where octal numbers are supported is within + * the ASL language itself. This is implemented via the main AcpiUtStrtoul64 + * interface. According the ACPI specification, there is no ACPI runtime + * support (explicit/implicit) for octal string conversions. * ******************************************************************************/ @@ -238,261 +202,301 @@ AcpiUtStrtoulBase16 ( * * FUNCTION: AcpiUtStrtoul64 * - * PARAMETERS: String - Null terminated input string - * Flags - Conversion info, see below + * PARAMETERS: String - Null terminated input string, + * must be a valid pointer * ReturnValue - Where the converted integer is - * returned - * - * RETURN: Status and Converted value + * returned. Must be a valid pointer * - * DESCRIPTION: Convert a string into an unsigned value. Performs either a - * 32-bit or 64-bit conversion, depending on the input integer - * size in Flags (often the current mode of the interpreter). + * RETURN: Status and converted integer. Returns an exception on a + * 64-bit numeric overflow * - * Values for Flags: - * ACPI_STRTOUL_32BIT - Max integer value is 32 bits - * ACPI_STRTOUL_64BIT - Max integer value is 64 bits - * ACPI_STRTOUL_BASE16 - Input string is hexadecimal. Default - * is 10/16 based on string prefix (0x). + * DESCRIPTION: Convert a string into an unsigned integer. Always performs a + * full 64-bit conversion, regardless of the current global + * integer width. Supports Decimal, Hex, and Octal strings. * - * NOTES: - * Negative numbers are not supported, as they are not supported by ACPI. + * Current users of this function: * - * Supports only base 16 or base 10 strings/values. Does not - * support Octal strings, as these are not supported by ACPI. - * - * Current users of this support: - * - * Interpreter - Implicit and explicit conversions, GPE method names - * Debugger - Command line input string conversion - * iASL - Main parser, conversion of constants to integers - * iASL - Data Table Compiler parser (constant math expressions) - * iASL - Preprocessor (constant math expressions) - * AcpiDump - Input table addresses - * AcpiExec - Testing of the AcpiUtStrtoul64 function - * - * Note concerning callers: - * AcpiGbl_IntegerByteWidth can be used to set the 32/64 limit. If used, - * this global should be set to the proper width. For the core ACPICA code, - * this width depends on the DSDT version. For iASL, the default byte - * width is always 8 for the parser, but error checking is performed later - * to flag cases where a 64-bit constant is defined in a 32-bit DSDT/SSDT. + * iASL - Preprocessor (constants and math expressions) + * iASL - Main ASL parser, conversion of ASL constants to integers + * iASL - Data Table Compiler parser (constants and math expressions) + * Interpreter - Repair code for return values from predefined names + * AcpiDump - ACPI table physical addresses + * AcpiExec - Support for namespace overrides * ******************************************************************************/ ACPI_STATUS AcpiUtStrtoul64 ( char *String, - UINT32 Flags, UINT64 *ReturnValue) { ACPI_STATUS Status = AE_OK; - UINT32 Base; + UINT8 OriginalBitWidth; + UINT32 Base = 10; /* Default is decimal */ ACPI_FUNCTION_TRACE_STR (UtStrtoul64, String); - /* Parameter validation */ - - if (!String || !ReturnValue) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - *ReturnValue = 0; - /* Check for zero-length string, returns 0 */ + /* A NULL return string returns a value of zero */ if (*String == 0) { return_ACPI_STATUS (AE_OK); } - /* Skip over any white space at start of string */ - - while (isspace ((int) *String)) - { - String++; - } - - /* End of string? return 0 */ - - if (*String == 0) + if (!AcpiUtRemoveWhitespace (&String)) { return_ACPI_STATUS (AE_OK); } /* - * 1) The "0x" prefix indicates base 16. Per the ACPI specification, - * the "0x" prefix is only allowed for implicit (non-strict) conversions. - * However, we always allow it for compatibility with older ACPICA. + * 1) Check for a hex constant. A "0x" prefix indicates base 16. */ - if ((*String == ACPI_ASCII_ZERO) && - (tolower ((int) *(String + 1)) == 'x')) + if (AcpiUtDetectHexPrefix (&String)) { - String += 2; /* Go past the 0x */ - if (*String == 0) - { - return_ACPI_STATUS (AE_OK); /* Return value 0 */ - } - Base = 16; } - /* 2) Force to base 16 (implicit conversion case) */ - - else if (Flags & ACPI_STRTOUL_BASE16) + /* + * 2) Check for an octal constant, defined to be a leading zero + * followed by sequence of octal digits (0-7) + */ + else if (AcpiUtDetectOctalPrefix (&String)) { - Base = 16; + Base = 8; } - /* 3) Default fallback is to Base 10 */ - - else + if (!AcpiUtRemoveLeadingZeros (&String)) { - Base = 10; + return_ACPI_STATUS (AE_OK); /* Return value 0 */ } - /* Skip all leading zeros */ + /* + * Force a full 64-bit conversion. The caller (usually iASL) must + * check for a 32-bit overflow later as necessary (If current mode + * is 32-bit, meaning a 32-bit DSDT). + */ + OriginalBitWidth = AcpiGbl_IntegerBitWidth; + AcpiGbl_IntegerBitWidth = 64; - while (*String == ACPI_ASCII_ZERO) + /* + * Perform the base 8, 10, or 16 conversion. A 64-bit numeric overflow + * will return an exception (to allow iASL to flag the statement). + */ + switch (Base) { - String++; - if (*String == 0) - { - return_ACPI_STATUS (AE_OK); /* Return value 0 */ - } + case 8: + Status = AcpiUtConvertOctalString (String, ReturnValue); + break; + + case 10: + Status = AcpiUtConvertDecimalString (String, ReturnValue); + break; + + case 16: + default: + Status = AcpiUtConvertHexString (String, ReturnValue); + break; } - /* Perform the base 16 or 10 conversion */ - - if (Base == 16) - { - *ReturnValue = AcpiUtStrtoulBase16 (String, Flags); - } - else - { - *ReturnValue = AcpiUtStrtoulBase10 (String, Flags); - } + /* Only possible exception from above is a 64-bit overflow */ + AcpiGbl_IntegerBitWidth = OriginalBitWidth; return_ACPI_STATUS (Status); } /******************************************************************************* * - * FUNCTION: AcpiUtStrtoulBase10 + * FUNCTION: AcpiUtImplicitStrtoul64 + * + * PARAMETERS: String - Null terminated input string, + * must be a valid pointer + * + * RETURN: Converted integer + * + * DESCRIPTION: Perform a 64-bit conversion with restrictions placed upon + * an "implicit conversion" by the ACPI specification. Used by + * many ASL operators that require an integer operand, and support + * an automatic (implicit) conversion from a string operand + * to the final integer operand. The major restriction is that + * only hex strings are supported. + * + * ----------------------------------------------------------------------------- + * + * Base is always 16, either with or without the 0x prefix. Decimal and + * Octal strings are not supported, as per the ACPI specification. + * + * Examples (both are hex values): + * Add ("BA98", Arg0, Local0) + * Subtract ("0x12345678", Arg1, Local1) + * + * Conversion rules as extracted from the ACPI specification: + * + * The converted integer is initialized to the value zero. + * The ASCII string is always interpreted as a hexadecimal constant. + * + * 1) According to the ACPI specification, a "0x" prefix is not allowed. + * However, ACPICA allows this as an ACPI extension on general + * principle. (NO ERROR) + * + * 2) The conversion terminates when the size of an integer is reached + * (32 or 64 bits). There are no numeric overflow conditions. (NO ERROR) + * + * 3) The first non-hex character terminates the conversion and returns + * the current accumulated value of the converted integer (NO ERROR). * - * PARAMETERS: String - Null terminated input string - * Flags - Conversion info + * 4) Conversion of a null (zero-length) string to an integer is + * technically not allowed. However, ACPICA allows this as an ACPI + * extension. The conversion returns the value 0. (NO ERROR) * - * RETURN: 64-bit converted integer + * NOTE: There are no error conditions returned by this function. At + * the minimum, a value of zero is returned. * - * DESCRIPTION: Performs a base 10 conversion of the input string to an - * integer value, either 32 or 64 bits. - * Note: String must be valid and non-null. + * Current users of this function: + * + * Interpreter - All runtime implicit conversions, as per ACPI specification + * iASL - Data Table Compiler parser (constants and math expressions) * ******************************************************************************/ -static UINT64 -AcpiUtStrtoulBase10 ( - char *String, - UINT32 Flags) +UINT64 +AcpiUtImplicitStrtoul64 ( + char *String) { - int AsciiDigit; - UINT64 NextValue; - UINT64 ReturnValue = 0; + UINT64 ConvertedInteger = 0; - /* Main loop: convert each ASCII byte in the input string */ - - while (*String) - { - AsciiDigit = *String; - if (!isdigit (AsciiDigit)) - { - /* Not ASCII 0-9, terminate */ + ACPI_FUNCTION_TRACE_STR (UtImplicitStrtoul64, String); - goto Exit; - } - /* Convert and insert (add) the decimal digit */ - - AcpiUtShortMultiply (ReturnValue, 10, &NextValue); - NextValue += (AsciiDigit - ACPI_ASCII_ZERO); - - /* Check for overflow (32 or 64 bit) - return current converted value */ + if (!AcpiUtRemoveWhitespace (&String)) + { + return_VALUE (0); + } - if (((Flags & ACPI_STRTOUL_32BIT) && (NextValue > ACPI_UINT32_MAX)) || - (NextValue < ReturnValue)) /* 64-bit overflow case */ - { - goto Exit; - } + /* + * Per the ACPI specification, only hexadecimal is supported for + * implicit conversions, and the "0x" prefix is "not allowed". + * However, allow a "0x" prefix as an ACPI extension. + */ + AcpiUtDetectHexPrefix (&String); - ReturnValue = NextValue; - String++; + if (!AcpiUtRemoveLeadingZeros (&String)) + { + return_VALUE (0); } -Exit: - return (ReturnValue); + /* + * Ignore overflow as per the ACPI specification. This is implemented by + * ignoring the return status from the conversion function called below. + * On overflow, the input string is simply truncated. + */ + AcpiUtConvertHexString (String, &ConvertedInteger); + return_VALUE (ConvertedInteger); } /******************************************************************************* * - * FUNCTION: AcpiUtStrtoulBase16 + * FUNCTION: AcpiUtExplicitStrtoul64 + * + * PARAMETERS: String - Null terminated input string, + * must be a valid pointer * - * PARAMETERS: String - Null terminated input string - * Flags - conversion info + * RETURN: Converted integer * - * RETURN: 64-bit converted integer + * DESCRIPTION: Perform a 64-bit conversion with the restrictions placed upon + * an "explicit conversion" by the ACPI specification. The + * main restriction is that only hex and decimal are supported. * - * DESCRIPTION: Performs a base 16 conversion of the input string to an - * integer value, either 32 or 64 bits. - * Note: String must be valid and non-null. + * ----------------------------------------------------------------------------- + * + * Base is either 10 (default) or 16 (with 0x prefix). Octal (base 8) strings + * are not supported, as per the ACPI specification. + * + * Examples: + * ToInteger ("1000") Decimal + * ToInteger ("0xABCD") Hex + * + * Conversion rules as extracted from the ACPI specification: + * + * 1) The input string is either a decimal or hexadecimal numeric string. + * A hex value must be prefixed by "0x" or it is interpreted as decimal. + * + * 2) The value must not exceed the maximum of an integer value + * (32 or 64 bits). The ACPI specification states the behavior is + * "unpredictable", so ACPICA matches the behavior of the implicit + * conversion case. There are no numeric overflow conditions. (NO ERROR) + * + * 3) Behavior on the first non-hex character is not defined by the ACPI + * specification (for the ToInteger operator), so ACPICA matches the + * behavior of the implicit conversion case. It terminates the + * conversion and returns the current accumulated value of the converted + * integer. (NO ERROR) + * + * 4) Conversion of a null (zero-length) string to an integer is + * technically not allowed. However, ACPICA allows this as an ACPI + * extension. The conversion returns the value 0. (NO ERROR) + * + * NOTE: There are no error conditions returned by this function. At the + * minimum, a value of zero is returned. + * + * Current users of this function: + * + * Interpreter - Runtime ASL ToInteger operator, as per the ACPI specification * ******************************************************************************/ -static UINT64 -AcpiUtStrtoulBase16 ( - char *String, - UINT32 Flags) +UINT64 +AcpiUtExplicitStrtoul64 ( + char *String) { - int AsciiDigit; - UINT32 ValidDigits = 1; - UINT64 ReturnValue = 0; - + UINT64 ConvertedInteger = 0; + UINT32 Base = 10; /* Default is decimal */ - /* Main loop: convert each ASCII byte in the input string */ - while (*String) - { - /* Check for overflow (32 or 64 bit) - return current converted value */ + ACPI_FUNCTION_TRACE_STR (UtExplicitStrtoul64, String); - if ((ValidDigits > 16) || - ((ValidDigits > 8) && (Flags & ACPI_STRTOUL_32BIT))) - { - goto Exit; - } - AsciiDigit = *String; - if (!isxdigit (AsciiDigit)) - { - /* Not Hex ASCII A-F, a-f, or 0-9, terminate */ - - goto Exit; - } + if (!AcpiUtRemoveWhitespace (&String)) + { + return_VALUE (0); + } - /* Convert and insert the hex digit */ + /* + * Only Hex and Decimal are supported, as per the ACPI specification. + * A "0x" prefix indicates hex; otherwise decimal is assumed. + */ + if (AcpiUtDetectHexPrefix (&String)) + { + Base = 16; + } - AcpiUtShortShiftLeft (ReturnValue, 4, &ReturnValue); - ReturnValue |= AcpiUtAsciiCharToHex (AsciiDigit); + if (!AcpiUtRemoveLeadingZeros (&String)) + { + return_VALUE (0); + } - String++; - ValidDigits++; + /* + * Ignore overflow as per the ACPI specification. This is implemented by + * ignoring the return status from the conversion functions called below. + * On overflow, the input string is simply truncated. + */ + switch (Base) + { + case 10: + default: + AcpiUtConvertDecimalString (String, &ConvertedInteger); + break; + + case 16: + AcpiUtConvertHexString (String, &ConvertedInteger); + break; } -Exit: - return (ReturnValue); + return_VALUE (ConvertedInteger); } diff --git a/sys/contrib/dev/acpica/components/utilities/uttrack.c b/sys/contrib/dev/acpica/components/utilities/uttrack.c index 41538b5ea82..ece731203dc 100644 --- a/sys/contrib/dev/acpica/components/utilities/uttrack.c +++ b/sys/contrib/dev/acpica/components/utilities/uttrack.c @@ -557,8 +557,7 @@ AcpiUtTrackAllocation ( Allocation->Component = Component; Allocation->Line = Line; - strncpy (Allocation->Module, Module, ACPI_MAX_MODULE_NAME); - Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0; + AcpiUtSafeStrncpy (Allocation->Module, (char *) Module, ACPI_MAX_MODULE_NAME); if (!Element) { @@ -891,7 +890,7 @@ AcpiUtDumpAllocations ( } else { - ACPI_ERROR ((AE_INFO, "%u(0x%X) Outstanding allocations", + ACPI_ERROR ((AE_INFO, "%u (0x%X) Outstanding cache allocations", NumOutstanding, NumOutstanding)); } diff --git a/sys/contrib/dev/acpica/components/utilities/utxferror.c b/sys/contrib/dev/acpica/components/utilities/utxferror.c index 9c1799ca102..75eea317c7b 100644 --- a/sys/contrib/dev/acpica/components/utilities/utxferror.c +++ b/sys/contrib/dev/acpica/components/utilities/utxferror.c @@ -214,8 +214,8 @@ ACPI_EXPORT_SYMBOL (AcpiError) * * RETURN: None * - * DESCRIPTION: Print "ACPI Exception" message with module/line/version info - * and decoded ACPI_STATUS. + * DESCRIPTION: Print an "ACPI Error" message with module/line/version + * info as well as decoded ACPI_STATUS. * ******************************************************************************/ @@ -236,12 +236,12 @@ AcpiException ( if (ACPI_SUCCESS (Status)) { - AcpiOsPrintf (ACPI_MSG_EXCEPTION); + AcpiOsPrintf (ACPI_MSG_ERROR); } else { - AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ", + AcpiOsPrintf (ACPI_MSG_ERROR "%s, ", AcpiFormatException (Status)); } diff --git a/sys/contrib/dev/acpica/include/acapps.h b/sys/contrib/dev/acpica/include/acapps.h index 4ca3e80fb31..faae2fb6917 100644 --- a/sys/contrib/dev/acpica/include/acapps.h +++ b/sys/contrib/dev/acpica/include/acapps.h @@ -188,6 +188,9 @@ Prefix, ACPICA_COPYRIGHT, \ Prefix +#define ACPI_COMMON_BUILD_TIME \ + "Build date/time: %s %s\n", __DATE__, __TIME__ + /* Macros for usage messages */ #define ACPI_USAGE_HEADER(Usage) \ diff --git a/sys/contrib/dev/acpica/include/acconfig.h b/sys/contrib/dev/acpica/include/acconfig.h index 6fc043639e3..7cff0636516 100644 --- a/sys/contrib/dev/acpica/include/acconfig.h +++ b/sys/contrib/dev/acpica/include/acconfig.h @@ -255,9 +255,9 @@ #define ACPI_ADDRESS_RANGE_MAX 2 -/* Maximum number of While() loops before abort */ +/* Maximum time (default 30s) of While() loops before abort */ -#define ACPI_MAX_LOOP_COUNT 0x000FFFFF +#define ACPI_MAX_LOOP_TIMEOUT 30 /****************************************************************************** diff --git a/sys/contrib/dev/acpica/include/acdebug.h b/sys/contrib/dev/acpica/include/acdebug.h index ae176c219e0..0a278415a5e 100644 --- a/sys/contrib/dev/acpica/include/acdebug.h +++ b/sys/contrib/dev/acpica/include/acdebug.h @@ -451,6 +451,12 @@ AcpiDbExecute ( ACPI_OBJECT_TYPE *Types, UINT32 Flags); +void +AcpiDbCreateExecutionThread ( + char *MethodNameArg, + char **Arguments, + ACPI_OBJECT_TYPE *Types); + void AcpiDbCreateExecutionThreads ( char *NumThreadsArg, diff --git a/sys/contrib/dev/acpica/include/acdisasm.h b/sys/contrib/dev/acpica/include/acdisasm.h index 5d7140f59ca..5f2030eb38c 100644 --- a/sys/contrib/dev/acpica/include/acdisasm.h +++ b/sys/contrib/dev/acpica/include/acdisasm.h @@ -272,8 +272,10 @@ typedef enum ACPI_DMT_PMTT, ACPI_DMT_PPTT, ACPI_DMT_SDEI, + ACPI_DMT_SDEV, ACPI_DMT_SLIC, ACPI_DMT_SRAT, + ACPI_DMT_TPM2, /* Special opcodes */ @@ -502,6 +504,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt1[]; @@ -515,6 +519,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct2[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct3[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPcct4[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt0a[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPptt1[]; @@ -529,6 +534,13 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt0[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoS3pt1[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdei[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdevHdr[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev0a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoSdev1b[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlic[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[]; @@ -546,6 +558,8 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaHdr[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaClient[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpaServer[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm2a[]; +extern ACPI_DMTABLE_INFO AcpiDmTableInfoTpm211[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoVrtc0[]; @@ -586,7 +600,7 @@ AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, void *Table, - UINT32 SubTableLength, + UINT32 SubtableLength, ACPI_DMTABLE_INFO *Info); void @@ -712,6 +726,10 @@ void AcpiDmDumpPcct ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpPdtt ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpPmtt ( ACPI_TABLE_HEADER *Table); @@ -732,6 +750,10 @@ UINT32 AcpiDmDumpS3pt ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpSdev ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpSlic ( ACPI_TABLE_HEADER *Table); @@ -752,6 +774,10 @@ void AcpiDmDumpTcpa ( ACPI_TABLE_HEADER *Table); +void +AcpiDmDumpTpm2 ( + ACPI_TABLE_HEADER *Table); + void AcpiDmDumpVrtc ( ACPI_TABLE_HEADER *Table); diff --git a/sys/contrib/dev/acpica/include/acexcep.h b/sys/contrib/dev/acpica/include/acexcep.h index 1405e41161f..16d3698b625 100644 --- a/sys/contrib/dev/acpica/include/acexcep.h +++ b/sys/contrib/dev/acpica/include/acexcep.h @@ -237,8 +237,13 @@ typedef struct acpi_exception_info #define AE_NOT_CONFIGURED EXCEP_ENV (0x001C) #define AE_ACCESS EXCEP_ENV (0x001D) #define AE_IO_ERROR EXCEP_ENV (0x001E) +#define AE_NUMERIC_OVERFLOW EXCEP_ENV (0x001F) +#define AE_HEX_OVERFLOW EXCEP_ENV (0x0020) +#define AE_DECIMAL_OVERFLOW EXCEP_ENV (0x0021) +#define AE_OCTAL_OVERFLOW EXCEP_ENV (0x0022) +#define AE_END_OF_TABLE EXCEP_ENV (0x0023) -#define AE_CODE_ENV_MAX 0x001E +#define AE_CODE_ENV_MAX 0x0023 /* @@ -305,7 +310,7 @@ typedef struct acpi_exception_info #define AE_AML_CIRCULAR_REFERENCE EXCEP_AML (0x001E) #define AE_AML_BAD_RESOURCE_LENGTH EXCEP_AML (0x001F) #define AE_AML_ILLEGAL_ADDRESS EXCEP_AML (0x0020) -#define AE_AML_INFINITE_LOOP EXCEP_AML (0x0021) +#define AE_AML_LOOP_TIMEOUT EXCEP_AML (0x0021) #define AE_AML_UNINITIALIZED_NODE EXCEP_AML (0x0022) #define AE_AML_TARGET_TYPE EXCEP_AML (0x0023) @@ -371,7 +376,12 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Env[] = EXCEP_TXT ("AE_OWNER_ID_LIMIT", "There are no more Owner IDs available for ACPI tables or control methods"), EXCEP_TXT ("AE_NOT_CONFIGURED", "The interface is not part of the current subsystem configuration"), EXCEP_TXT ("AE_ACCESS", "Permission denied for the requested operation"), - EXCEP_TXT ("AE_IO_ERROR", "An I/O error occurred") + EXCEP_TXT ("AE_IO_ERROR", "An I/O error occurred"), + EXCEP_TXT ("AE_NUMERIC_OVERFLOW", "Overflow during string-to-integer conversion"), + EXCEP_TXT ("AE_HEX_OVERFLOW", "Overflow during ASCII hex-to-binary conversion"), + EXCEP_TXT ("AE_DECIMAL_OVERFLOW", "Overflow during ASCII decimal-to-binary conversion"), + EXCEP_TXT ("AE_OCTAL_OVERFLOW", "Overflow during ASCII octal-to-binary conversion"), + EXCEP_TXT ("AE_END_OF_TABLE", "Reached the end of table") }; static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Pgm[] = @@ -433,7 +443,7 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Aml[] = EXCEP_TXT ("AE_AML_CIRCULAR_REFERENCE", "Two references refer to each other"), EXCEP_TXT ("AE_AML_BAD_RESOURCE_LENGTH", "The length of a Resource Descriptor in the AML is incorrect"), EXCEP_TXT ("AE_AML_ILLEGAL_ADDRESS", "A memory, I/O, or PCI configuration address is invalid"), - EXCEP_TXT ("AE_AML_INFINITE_LOOP", "An apparent infinite AML While loop, method was aborted"), + EXCEP_TXT ("AE_AML_LOOP_TIMEOUT", "An AML While loop exceeded the maximum execution time"), EXCEP_TXT ("AE_AML_UNINITIALIZED_NODE", "A namespace node is uninitialized or unresolved"), EXCEP_TXT ("AE_AML_TARGET_TYPE", "A target operand of an incorrect type was encountered") }; diff --git a/sys/contrib/dev/acpica/include/acglobal.h b/sys/contrib/dev/acpica/include/acglobal.h index 686dcd819eb..d29586988a4 100644 --- a/sys/contrib/dev/acpica/include/acglobal.h +++ b/sys/contrib/dev/acpica/include/acglobal.h @@ -155,7 +155,7 @@ /***************************************************************************** * - * Globals related to the ACPI tables + * Globals related to the incoming ACPI tables * ****************************************************************************/ @@ -197,7 +197,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); /***************************************************************************** * - * Mutual exclusion within ACPICA subsystem + * Mutual exclusion within the ACPICA subsystem * ****************************************************************************/ @@ -278,7 +278,7 @@ ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_NamespaceInitialized, FALSE); -/* Misc */ +/* Miscellaneous */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); @@ -301,11 +301,9 @@ extern const char AcpiGbl_LowerHexDigits[]; extern const char AcpiGbl_UpperHexDigits[]; extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; - -#ifdef ACPI_DBG_TRACK_ALLOCATIONS - /* Lists for tracking memory allocations (debug only) */ +#ifdef ACPI_DBG_TRACK_ALLOCATIONS ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList); ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats); @@ -315,7 +313,7 @@ ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking); /***************************************************************************** * - * Namespace globals + * ACPI Namespace * ****************************************************************************/ @@ -330,7 +328,6 @@ ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_RootNode); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_FadtGpeDevice); ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_ModuleCodeList); - extern const UINT8 AcpiGbl_NsProperties [ACPI_NUM_NS_TYPES]; extern const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames [NUM_PREDEFINED_NAMES]; @@ -347,15 +344,20 @@ ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); /***************************************************************************** * - * Interpreter globals + * Interpreter/Parser globals * ****************************************************************************/ -ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); - /* Control method single step flag */ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); +ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); +ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL); + +/* ASL/ASL+ converter */ + +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_CaptureComments, FALSE); +ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); /***************************************************************************** @@ -365,7 +367,6 @@ ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); ****************************************************************************/ extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; - ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA); ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); @@ -377,18 +378,16 @@ ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); ****************************************************************************/ #if (!ACPI_REDUCED_HARDWARE) - ACPI_GLOBAL (UINT8, AcpiGbl_AllGpesInitialized); ACPI_GLOBAL (ACPI_GPE_XRUPT_INFO *, AcpiGbl_GpeXruptListHead); ACPI_GLOBAL (ACPI_GPE_BLOCK_INFO *, AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]); ACPI_GLOBAL (ACPI_GBL_EVENT_HANDLER, AcpiGbl_GlobalEventHandler); ACPI_GLOBAL (void *, AcpiGbl_GlobalEventHandlerContext); ACPI_GLOBAL (ACPI_FIXED_EVENT_HANDLER, AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]); - extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; - #endif /* !ACPI_REDUCED_HARDWARE */ + /***************************************************************************** * * Debug support @@ -402,7 +401,7 @@ ACPI_GLOBAL (UINT32, AcpiGpeCount); ACPI_GLOBAL (UINT32, AcpiSciCount); ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]); -/* Support for dynamic control method tracing mechanism */ +/* Dynamic control method tracing mechanism */ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); @@ -410,12 +409,13 @@ ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); /***************************************************************************** * - * Debugger and Disassembler globals + * Debugger and Disassembler * ****************************************************************************/ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DbOutputFlags, ACPI_DB_CONSOLE_OUTPUT); + #ifdef ACPI_DISASSEMBLER /* Do not disassemble buffers to resource descriptors */ @@ -427,7 +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_INIT_GLOBAL (ACPI_PARSE_OBJECT_LIST, *AcpiGbl_TempListHead, NULL); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Disasm); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DmOpt_Listing); @@ -438,7 +438,6 @@ ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); #endif #ifdef ACPI_DEBUGGER - ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); ACPI_INIT_GLOBAL (ACPI_THREAD_ID, AcpiGbl_DbThreadId, ACPI_INVALID_THREAD_ID); @@ -452,7 +451,6 @@ ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateLoop); ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbThreadsTerminated); - ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); @@ -462,81 +460,66 @@ ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_ ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]); ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]); -/* - * Statistic globals - */ +/* Statistics globals */ + ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TOTAL_TYPES]); ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TOTAL_TYPES]); ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); - #endif /* ACPI_DEBUGGER */ #if defined (ACPI_DISASSEMBLER) || defined (ACPI_ASL_COMPILER) - -ACPI_GLOBAL (const char, *AcpiGbl_PldPanelList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldVerticalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldHorizontalPositionList[]); -ACPI_GLOBAL (const char, *AcpiGbl_PldShapeList[]); - +ACPI_GLOBAL (const char, *AcpiGbl_PldPanelList[]); +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 -/* - * Meant for the -ca option. - */ -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentInlineComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentEndNodeComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentOpenBraceComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentCloseBraceComment, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_RootFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentParentFilename, NULL); -ACPI_INIT_GLOBAL (char*, AcpiGbl_CurrentIncludeFilename, NULL); +/***************************************************************************** + * + * ACPICA application-specific globals + * + ****************************************************************************/ + +/* ASL-to-ASL+ conversion utility (implemented within the iASL compiler) */ -ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_LastListHead, NULL); +#ifdef ACPI_ASL_COMPILER +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentInlineComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentEndNodeComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentOpenBraceComment, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentCloseBraceComment, NULL); + +ACPI_INIT_GLOBAL (char *, AcpiGbl_RootFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentParentFilename, NULL); +ACPI_INIT_GLOBAL (char *, AcpiGbl_CurrentIncludeFilename, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_DefBlkCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_RegCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_IncCommentListTail, NULL); - ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListHead, NULL); ACPI_INIT_GLOBAL (ACPI_COMMENT_NODE, *AcpiGbl_EndBlkCommentListTail, NULL); -ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL); - -ACPI_INIT_GLOBAL (ACPI_PARSE_OBJECT, *AcpiGbl_CurrentScope, NULL); - +ACPI_INIT_GLOBAL (ACPI_COMMENT_ADDR_NODE, *AcpiGbl_CommentAddrListHead, NULL); ACPI_INIT_GLOBAL (ACPI_FILE_NODE, *AcpiGbl_FileTreeRoot, NULL); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_RegCommentCache); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_CommentAddrCache); ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_FileCache); -ACPI_INIT_GLOBAL (BOOLEAN, Gbl_CaptureComments, FALSE); - -ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE); -ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL); - -ACPI_GLOBAL (char, AcpiGbl_TableSig[4]); - -/***************************************************************************** - * - * Application globals - * - ****************************************************************************/ +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugAslConversion, FALSE); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_ConvDebugFile, NULL); +ACPI_GLOBAL (char, AcpiGbl_TableSig[4]); +#endif #ifdef ACPI_APPLICATION - ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_OutputFile, NULL); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); @@ -545,18 +528,6 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DebugTimeout, FALSE); ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_PrintLock); /* For print buffer */ ACPI_GLOBAL (char, AcpiGbl_PrintBuffer[1024]); - #endif /* ACPI_APPLICATION */ - -/***************************************************************************** - * - * Info/help support - * - ****************************************************************************/ - -extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; -extern const AH_DEVICE_ID AslDeviceIds[]; - - #endif /* __ACGLOBAL_H__ */ diff --git a/sys/contrib/dev/acpica/include/achware.h b/sys/contrib/dev/acpica/include/achware.h index f33be8c4aad..c3bf8f1523f 100644 --- a/sys/contrib/dev/acpica/include/achware.h +++ b/sys/contrib/dev/acpica/include/achware.h @@ -185,12 +185,12 @@ AcpiHwValidateRegister ( ACPI_STATUS AcpiHwRead ( - UINT32 *Value, + UINT64 *Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_STATUS AcpiHwWrite ( - UINT32 Value, + UINT64 Value, ACPI_GENERIC_ADDRESS *Reg); ACPI_BIT_REGISTER_INFO * diff --git a/sys/contrib/dev/acpica/include/acinterp.h b/sys/contrib/dev/acpica/include/acinterp.h index dd98f01cb9a..d68058cced5 100644 --- a/sys/contrib/dev/acpica/include/acinterp.h +++ b/sys/contrib/dev/acpica/include/acinterp.h @@ -214,7 +214,7 @@ ACPI_STATUS AcpiExConvertToInteger ( ACPI_OPERAND_OBJECT *ObjDesc, ACPI_OPERAND_OBJECT **ResultDesc, - UINT32 Flags); + UINT32 ImplicitConversion); ACPI_STATUS AcpiExConvertToBuffer ( @@ -683,9 +683,6 @@ AcpiExStoreObjectToNode ( ACPI_WALK_STATE *WalkState, UINT8 ImplicitConversion); -#define ACPI_IMPLICIT_CONVERSION TRUE -#define ACPI_NO_IMPLICIT_CONVERSION FALSE - /* * exstoren - resolve/store object diff --git a/sys/contrib/dev/acpica/include/aclocal.h b/sys/contrib/dev/acpica/include/aclocal.h index 00be20ede3e..5ad319024ad 100644 --- a/sys/contrib/dev/acpica/include/aclocal.h +++ b/sys/contrib/dev/acpica/include/aclocal.h @@ -834,7 +834,7 @@ typedef struct acpi_control_state union acpi_parse_object *PredicateOp; UINT8 *AmlPredicateStart; /* Start of if/while predicate */ UINT8 *PackageEnd; /* End of if/while block */ - UINT32 LoopCount; /* While() loop counter */ + UINT64 LoopTimeout; /* While() loop timeout */ } ACPI_CONTROL_STATE; @@ -1532,16 +1532,17 @@ typedef struct acpi_db_method_info ACPI_OBJECT_TYPE *Types; /* - * Arguments to be passed to method for the command - * Threads - - * the Number of threads, ID of current thread and - * Index of current thread inside all them created. + * Arguments to be passed to method for the commands Threads and + * Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6). + * + * For the Threads command, the Number of threads, ID of current + * thread and Index of current thread inside all them created. */ char InitArgs; #ifdef ACPI_DEBUGGER - ACPI_OBJECT_TYPE ArgTypes[4]; + ACPI_OBJECT_TYPE ArgTypes[ACPI_METHOD_NUM_ARGS]; #endif - char *Arguments[4]; + char *Arguments[ACPI_METHOD_NUM_ARGS]; char NumThreadsStr[11]; char IdOfThreadStr[11]; char IndexOfThreadStr[11]; diff --git a/sys/contrib/dev/acpica/include/acmacros.h b/sys/contrib/dev/acpica/include/acmacros.h index 9d7ed06d5dd..feb45937e14 100644 --- a/sys/contrib/dev/acpica/include/acmacros.h +++ b/sys/contrib/dev/acpica/include/acmacros.h @@ -567,7 +567,7 @@ * the plist contains a set of parens to allow variable-length lists. * These macros are used for both the debug and non-debug versions of the code. */ -#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e); +#define ACPI_ERROR_NAMESPACE(s, p, e) AcpiUtPrefixedNamespaceError (AE_INFO, s, p, e); #define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e); #define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist #define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist diff --git a/sys/contrib/dev/acpica/include/acnamesp.h b/sys/contrib/dev/acpica/include/acnamesp.h index 990309ebfb2..43402719a7d 100644 --- a/sys/contrib/dev/acpica/include/acnamesp.h +++ b/sys/contrib/dev/acpica/include/acnamesp.h @@ -488,6 +488,11 @@ AcpiNsGetNormalizedPathname ( ACPI_NAMESPACE_NODE *Node, BOOLEAN NoTrailing); +char * +AcpiNsBuildPrefixedPathname ( + ACPI_GENERIC_STATE *PrefixScope, + const char *InternalPath); + char * AcpiNsNameOfCurrentScope ( ACPI_WALK_STATE *WalkState); diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index fc486d5df21..482662f3362 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -154,7 +154,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20170728 +#define ACPI_CA_VERSION 0x20171214 #include #include @@ -370,11 +370,11 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE); /* - * Maximum number of While() loop iterations before forced method abort. + * Maximum timeout for While() loop iterations before forced method abort. * This mechanism is intended to prevent infinite loops during interpreter * execution within a host kernel. */ -ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_COUNT); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_TIMEOUT); /* * This mechanism is used to trace a specified AML method. The method is diff --git a/sys/contrib/dev/acpica/include/actbl1.h b/sys/contrib/dev/acpica/include/actbl1.h index da6b561a0a1..6d0f5c85b7b 100644 --- a/sys/contrib/dev/acpica/include/actbl1.h +++ b/sys/contrib/dev/acpica/include/actbl1.h @@ -179,8 +179,10 @@ #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_PDTT "PDTT" /* Platform Debug Trigger Table */ #define ACPI_SIG_PPTT "PPTT" /* Processor Properties Topology Table */ #define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */ +#define ACPI_SIG_SDEV "SDEV" /* Secure Devices table */ #define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */ #define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */ #define ACPI_SIG_NFIT "NFIT" /* NVDIMM Firmware Interface Table */ @@ -1447,7 +1449,8 @@ enum AcpiNfitType ACPI_NFIT_TYPE_CONTROL_REGION = 4, ACPI_NFIT_TYPE_DATA_REGION = 5, ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6, - ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */ + ACPI_NFIT_TYPE_CAPABILITIES = 7, + ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */ }; /* @@ -1461,7 +1464,7 @@ typedef struct acpi_nfit_system_address ACPI_NFIT_HEADER Header; UINT16 RangeIndex; UINT16 Flags; - UINT32 Reserved; /* Reseved, must be zero */ + UINT32 Reserved; /* Reserved, must be zero */ UINT32 ProximityDomain; UINT8 RangeGuid[16]; UINT64 Address; @@ -1600,6 +1603,110 @@ typedef struct acpi_nfit_flush_address } ACPI_NFIT_FLUSH_ADDRESS; +/* 7: Platform Capabilities Structure */ + +typedef struct acpi_nfit_capabilities +{ + ACPI_NFIT_HEADER Header; + UINT8 HighestCapability; + UINT8 Reserved[3]; /* Reserved, must be zero */ + UINT32 Capabilities; + UINT32 Reserved2; + +} ACPI_NFIT_CAPABILITIES; + +/* Capabilities Flags */ + +#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */ +#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */ +#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */ + + +/* + * NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM + */ +typedef struct nfit_device_handle +{ + UINT32 Handle; + +} NFIT_DEVICE_HANDLE; + +/* Device handle construction and extraction macros */ + +#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F +#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0 +#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00 +#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000 +#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000 + +#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0 +#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4 +#define ACPI_NFIT_MEMORY_ID_OFFSET 8 +#define ACPI_NFIT_SOCKET_ID_OFFSET 12 +#define ACPI_NFIT_NODE_ID_OFFSET 16 + +/* Macro to construct a NFIT/NVDIMM device handle */ + +#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \ + ((dimm) | \ + ((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \ + ((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \ + ((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \ + ((node) << ACPI_NFIT_NODE_ID_OFFSET)) + +/* Macros to extract individual fields from a NFIT/NVDIMM device handle */ + +#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \ + ((handle) & ACPI_NFIT_DIMM_NUMBER_MASK) + +#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \ + (((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET) + +#define ACPI_NFIT_GET_MEMORY_ID(handle) \ + (((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET) + +#define ACPI_NFIT_GET_SOCKET_ID(handle) \ + (((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET) + +#define ACPI_NFIT_GET_NODE_ID(handle) \ + (((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET) + + +/******************************************************************************* + * + * PDTT - Platform Debug Trigger Table (ACPI 6.2) + * Version 0 + * + ******************************************************************************/ + +typedef struct acpi_table_pdtt +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + UINT8 TriggerCount; + UINT8 Reserved[3]; + UINT32 ArrayOffset; + +} ACPI_TABLE_PDTT; + + +/* + * PDTT Communication Channel Identifier Structure. + * The number of these structures is defined by TriggerCount above, + * starting at ArrayOffset. + */ +typedef struct acpi_pdtt_channel +{ + UINT8 SubchannelId; + UINT8 Flags; + +} ACPI_PDTT_CHANNEL; + +/* Flags for above */ + +#define ACPI_PDTT_RUNTIME_TRIGGER (1) +#define ACPI_PDTT_WAIT_COMPLETION (1<<1) + + /******************************************************************************* * * PPTT - Processor Properties Topology Table (ACPI 6.2) @@ -1626,7 +1733,8 @@ enum AcpiPpttType /* 0: Processor Hierarchy Node Structure */ -typedef struct acpi_pptt_processor { +typedef struct acpi_pptt_processor +{ ACPI_SUBTABLE_HEADER Header; UINT16 Reserved; UINT32 Flags; @@ -1644,7 +1752,8 @@ typedef struct acpi_pptt_processor { /* 1: Cache Type Structure */ -typedef struct acpi_pptt_cache { +typedef struct acpi_pptt_cache +{ ACPI_SUBTABLE_HEADER Header; UINT16 Reserved; UINT32 Flags; @@ -1673,10 +1782,24 @@ typedef struct acpi_pptt_cache { #define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */ #define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */ +/* Attributes describing cache */ +#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */ +#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */ +#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */ +#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */ + +#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */ +#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */ +#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */ +#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */ + +#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */ +#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */ /* 2: ID Structure */ -typedef struct acpi_pptt_id { +typedef struct acpi_pptt_id +{ ACPI_SUBTABLE_HEADER Header; UINT16 Reserved; UINT32 VendorId; @@ -1706,6 +1829,82 @@ typedef struct acpi_table_sbst } ACPI_TABLE_SBST; +/******************************************************************************* + * + * SDEV - Secure Devices Table (ACPI 6.2) + * Version 1 + * + ******************************************************************************/ + +typedef struct acpi_table_sdev +{ + ACPI_TABLE_HEADER Header; /* Common ACPI table header */ + +} ACPI_TABLE_SDEV; + + +typedef struct acpi_sdev_header +{ + UINT8 Type; + UINT8 Flags; + UINT16 Length; + +} ACPI_SDEV_HEADER; + + +/* Values for subtable type above */ + +enum AcpiSdevType +{ + ACPI_SDEV_TYPE_NAMESPACE_DEVICE = 0, + ACPI_SDEV_TYPE_PCIE_ENDPOINT_DEVICE = 1, + ACPI_SDEV_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + +/* Values for flags above */ + +#define ACPI_SDEV_HANDOFF_TO_UNSECURE_OS (1) + +/* + * SDEV subtables + */ + +/* 0: Namespace Device Based Secure Device Structure */ + +typedef struct acpi_sdev_namespace +{ + ACPI_SDEV_HEADER Header; + UINT16 DeviceIdOffset; + UINT16 DeviceIdLength; + UINT16 VendorDataOffset; + UINT16 VendorDataLength; + +} ACPI_SDEV_NAMESPACE; + +/* 1: PCIe Endpoint Device Based Device Structure */ + +typedef struct acpi_sdev_pcie +{ + ACPI_SDEV_HEADER Header; + UINT16 Segment; + UINT16 StartBus; + UINT16 PathOffset; + UINT16 PathLength; + UINT16 VendorDataOffset; + UINT16 VendorDataLength; + +} ACPI_SDEV_PCIE; + +/* 1a: PCIe Endpoint path entry */ + +typedef struct acpi_sdev_pcie_path +{ + UINT8 Device; + UINT8 Function; + +} ACPI_SDEV_PCIE_PATH; + + /******************************************************************************* * * SLIT - System Locality Distance Information Table diff --git a/sys/contrib/dev/acpica/include/actbl2.h b/sys/contrib/dev/acpica/include/actbl2.h index 18cfdd46575..cdf7ac06d72 100644 --- a/sys/contrib/dev/acpica/include/actbl2.h +++ b/sys/contrib/dev/acpica/include/actbl2.h @@ -1030,6 +1030,7 @@ typedef struct acpi_iort_smmu_gsi UINT32 NSgIrptFlags; UINT32 NSgCfgIrpt; UINT32 NSgCfgIrptFlags; + } ACPI_IORT_SMMU_GSI; @@ -1047,6 +1048,7 @@ typedef struct acpi_iort_smmu_v3 UINT8 Pxm; UINT8 Reserved1; UINT16 Reserved2; + UINT32 IdMappingIndex; } ACPI_IORT_SMMU_V3; @@ -1549,6 +1551,8 @@ enum AcpiSpmiInterfaceTypes * TCPA - Trusted Computing Platform Alliance table * Version 2 * + * TCG Hardware Interface Table for TPM 1.2 Clients and Servers + * * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", * Version 1.2, Revision 8 * February 27, 2017 @@ -1621,6 +1625,8 @@ typedef struct acpi_table_tcpa_server * TPM2 - Trusted Platform Module (TPM) 2.0 Hardware Interface Table * Version 4 * + * TCG Hardware Interface Table for TPM 2.0 Clients and Servers + * * Conforms to "TCG ACPI Specification, Family 1.2 and 2.0", * Version 1.2, Revision 8 * February 27, 2017 @@ -1642,17 +1648,25 @@ typedef struct acpi_table_tpm2 /* Values for StartMethod above */ #define ACPI_TPM2_NOT_ALLOWED 0 +#define ACPI_TPM2_RESERVED1 1 #define ACPI_TPM2_START_METHOD 2 +#define ACPI_TPM2_RESERVED3 3 +#define ACPI_TPM2_RESERVED4 4 +#define ACPI_TPM2_RESERVED5 5 #define ACPI_TPM2_MEMORY_MAPPED 6 #define ACPI_TPM2_COMMAND_BUFFER 7 #define ACPI_TPM2_COMMAND_BUFFER_WITH_START_METHOD 8 +#define ACPI_TPM2_RESERVED9 9 +#define ACPI_TPM2_RESERVED10 10 #define ACPI_TPM2_COMMAND_BUFFER_WITH_ARM_SMC 11 /* V1.2 Rev 8 */ +#define ACPI_TPM2_RESERVED 12 -/* Trailer appears after any StartMethod subtables */ +/* Optional trailer appears after any StartMethod subtables */ typedef struct acpi_tpm2_trailer { + UINT8 MethodParameters[12]; UINT32 MinimumLogLength; /* Minimum length for the event log area */ UINT64 LogAddress; /* Address of the event log area */ diff --git a/sys/contrib/dev/acpica/include/actypes.h b/sys/contrib/dev/acpica/include/actypes.h index 1839f936e4e..2d71de51ede 100644 --- a/sys/contrib/dev/acpica/include/actypes.h +++ b/sys/contrib/dev/acpica/include/actypes.h @@ -586,6 +586,8 @@ typedef void * ACPI_HANDLE; /* Actually a ptr to a N #define ACPI_NSEC_PER_MSEC 1000000L #define ACPI_NSEC_PER_SEC 1000000000L +#define ACPI_TIME_AFTER(a, b) ((INT64)((b) - (a)) < 0) + /* Owner IDs are used to track namespace nodes for selective deletion */ @@ -1507,6 +1509,8 @@ typedef enum #define ACPI_OSI_WIN_7 0x0B #define ACPI_OSI_WIN_8 0x0C #define ACPI_OSI_WIN_10 0x0D +#define ACPI_OSI_WIN_10_RS1 0x0E +#define ACPI_OSI_WIN_10_RS2 0x0F /* Definitions of getopt */ diff --git a/sys/contrib/dev/acpica/include/acutils.h b/sys/contrib/dev/acpica/include/acutils.h index f6cfe089548..f28e039a727 100644 --- a/sys/contrib/dev/acpica/include/acutils.h +++ b/sys/contrib/dev/acpica/include/acutils.h @@ -227,9 +227,6 @@ extern const char *AcpiGbl_PtypDecode[]; #ifndef ACPI_MSG_ERROR #define ACPI_MSG_ERROR "ACPI Error: " #endif -#ifndef ACPI_MSG_EXCEPTION -#define ACPI_MSG_EXCEPTION "ACPI Exception: " -#endif #ifndef ACPI_MSG_WARNING #define ACPI_MSG_WARNING "ACPI Warning: " #endif @@ -238,10 +235,10 @@ extern const char *AcpiGbl_PtypDecode[]; #endif #ifndef ACPI_MSG_BIOS_ERROR -#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): " +#define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): " #endif #ifndef ACPI_MSG_BIOS_WARNING -#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): " +#define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): " #endif /* @@ -250,6 +247,10 @@ extern const char *AcpiGbl_PtypDecode[]; #define ACPI_MSG_SUFFIX \ AcpiOsPrintf (" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, ModuleName, LineNumber) +/* Flags to indicate implicit or explicit string-to-integer conversion */ + +#define ACPI_IMPLICIT_CONVERSION TRUE +#define ACPI_NO_IMPLICIT_CONVERSION FALSE /* Types for Resource descriptor entries */ @@ -330,19 +331,57 @@ AcpiUtStricmp ( char *String1, char *String2); + +/* + * utstrsuppt - string-to-integer conversion support functions + */ ACPI_STATUS -AcpiUtStrtoul64 ( +AcpiUtConvertOctalString ( char *String, - UINT32 Flags, - UINT64 *RetInteger); + UINT64 *ReturnValue); + +ACPI_STATUS +AcpiUtConvertDecimalString ( + char *String, + UINT64 *ReturnValuePtr); + +ACPI_STATUS +AcpiUtConvertHexString ( + char *String, + UINT64 *ReturnValuePtr); + +char +AcpiUtRemoveWhitespace ( + char **String); + +char +AcpiUtRemoveLeadingZeros ( + char **String); + +BOOLEAN +AcpiUtDetectHexPrefix ( + char **String); + +BOOLEAN +AcpiUtDetectOctalPrefix ( + char **String); + /* - * Values for Flags above - * Note: LIMIT values correspond to AcpiGbl_IntegerByteWidth values (4/8) + * utstrtoul64 - string-to-integer conversion functions */ -#define ACPI_STRTOUL_32BIT 0x04 /* 4 bytes */ -#define ACPI_STRTOUL_64BIT 0x08 /* 8 bytes */ -#define ACPI_STRTOUL_BASE16 0x10 /* Default: Base10/16 */ +ACPI_STATUS +AcpiUtStrtoul64 ( + char *String, + UINT64 *RetInteger); + +UINT64 +AcpiUtExplicitStrtoul64 ( + char *String); + +UINT64 +AcpiUtImplicitStrtoul64 ( + char *String); /* @@ -352,12 +391,12 @@ ACPI_STATUS AcpiUtInitGlobals ( void); -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) - const char * AcpiUtGetMutexName ( UINT32 MutexId); +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) + const char * AcpiUtGetNotifyName ( UINT32 NotifyValue, @@ -1020,6 +1059,12 @@ AcpiUtSafeStrcpy ( ACPI_SIZE DestSize, char *Source); +void +AcpiUtSafeStrncpy ( + char *Dest, + char *Source, + ACPI_SIZE DestSize); + BOOLEAN AcpiUtSafeStrcat ( char *Dest, @@ -1173,9 +1218,10 @@ AcpiUtPredefinedBiosError ( ...); void -AcpiUtNamespaceError ( +AcpiUtPrefixedNamespaceError ( const char *ModuleName, UINT32 LineNumber, + ACPI_GENERIC_STATE *PrefixScope, const char *InternalName, ACPI_STATUS LookupStatus); diff --git a/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c b/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c index 7413c15ee33..56d4681f12d 100644 --- a/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c +++ b/sys/contrib/dev/acpica/os_specific/service_layers/osgendbg.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: osgendbg - Generic debugger command singalling + * Module Name: osgendbg - Generic debugger command signalling * *****************************************************************************/ @@ -169,6 +169,7 @@ static ACPI_MUTEX AcpiGbl_DbCommandReady; static ACPI_MUTEX AcpiGbl_DbCommandComplete; static BOOLEAN AcpiGbl_DbCommandSignalsInitialized = FALSE; + /****************************************************************************** * * FUNCTION: AcpiDbRunRemoteDebugger @@ -213,7 +214,7 @@ AcpiDbRunRemoteDebugger ( Ptr++; } - strncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE); + AcpiUtSafeStrncpy (AcpiGbl_DbLineBuf, Cmd, ACPI_DB_LINE_BUFFER_SIZE); Ptr++; Cmd = Ptr; } diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index abcc5820868..dd425cb21d8 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1174,7 +1174,7 @@ acpi_cpu_idle(sbintime_t sbt) * is the only reliable time source. */ if (cx_next->type == ACPI_STATE_C3) { - AcpiHwRead(&start_time, &AcpiGbl_FADT.XPmTimerBlock); + AcpiGetTimer(&start_time); cputicks = 0; } else { start_time = 0; @@ -1191,10 +1191,10 @@ acpi_cpu_idle(sbintime_t sbt) * the processor has stopped. Doing it again provides enough * margin that we are certain to have a correct value. */ - AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); + AcpiGetTimer(&end_time); if (cx_next->type == ACPI_STATE_C3) { - AcpiHwRead(&end_time, &AcpiGbl_FADT.XPmTimerBlock); - end_time = acpi_TimerDelta(end_time, start_time); + AcpiGetTimer(&end_time); + AcpiGetTimerDuration(start_time, end_time, &end_time); } else end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); diff --git a/usr.sbin/acpi/acpidb/Makefile b/usr.sbin/acpi/acpidb/Makefile index 2f24d80eea9..a425d4014f5 100644 --- a/usr.sbin/acpi/acpidb/Makefile +++ b/usr.sbin/acpi/acpidb/Makefile @@ -66,8 +66,9 @@ SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \ uteval.c utexcep.c utglobal.c uthex.c utids.c utinit.c \ utlock.c utmath.c utmisc.c utmutex.c utnonansi.c \ utobject.c utosi.c utownerid.c utpredef.c utresdecode.c \ - utresrc.c utstate.c utstring.c utstrtoul64.c uttrack.c \ - utuuid.c utxface.c utxferror.c utxfinit.c + utresrc.c utstate.c utstring.c utstrsuppt.c \ + utstrtoul64.c uttrack.c utuuid.c utxface.c utxferror.c \ + utxfinit.c # os_specific/service_layers SRCS+= osgendbg.c osunixxf.c diff --git a/usr.sbin/acpi/iasl/Makefile b/usr.sbin/acpi/iasl/Makefile index 77a13ec0546..8171d5ae73a 100644 --- a/usr.sbin/acpi/iasl/Makefile +++ b/usr.sbin/acpi/iasl/Makefile @@ -9,27 +9,27 @@ SRCS= acfileio.c adfile.c adisasm.c adwalk.c ahids.c \ dmtbinfo.c getopt.c # compiler -SRCS+= aslanalyze.c aslascii.c aslbtypes.c aslcodegen.c \ - aslcompile.c aslcompiler.y.h aslcompilerlex.c \ - aslcompilerparse.c asldebug.c aslerror.c aslexternal.c \ - aslfileio.c aslfiles.c aslfold.c aslhelp.c aslhex.c \ - asllength.c asllisting.c asllistsup.c aslload.c \ - asllookup.c aslmain.c aslmap.c aslmapenter.c \ - aslmapoutput.c aslmaputils.c aslmessages.c aslmethod.c \ - aslnamesp.c asloffset.c aslopcodes.c asloperands.c \ - aslopt.c asloptions.c aslparseop.c aslpld.c aslpredef.c \ - aslprepkg.c aslprintf.c aslprune.c aslresource.c \ - aslrestype1.c aslrestype1i.c aslrestype2.c \ - aslrestype2d.c aslrestype2e.c aslrestype2q.c \ - aslrestype2s.c aslrestype2w.c aslstartup.c aslstubs.c \ - asltransform.c asltree.c aslutils.c asluuid.c \ - aslwalks.c aslxref.c aslxrefout.c cvcompiler.c \ - cvdisasm.c cvparser.c dtcompile.c dtexpress.c dtfield.c \ - dtio.c dtparser.y.h dtparserlex.c dtparserparse.c \ - dtsubtable.c dttable.c dttable1.c dttable2.c \ - dttemplate.c dtutils.c prexpress.c prmacros.c \ - prparser.y.h prparserlex.c prparserparse.c prscan.c \ - prutils.c +SRCS+= aslallocate.c aslanalyze.c aslascii.c aslbtypes.c \ + aslcache.c aslcodegen.c aslcompile.c aslcompiler.y.h \ + aslcompilerlex.c aslcompilerparse.c asldebug.c \ + aslerror.c aslexternal.c aslfileio.c aslfiles.c \ + aslfold.c aslhelp.c aslhex.c asllength.c asllisting.c \ + asllistsup.c aslload.c asllookup.c aslmain.c aslmap.c \ + aslmapenter.c aslmapoutput.c aslmaputils.c \ + aslmessages.c aslmethod.c aslnamesp.c asloffset.c \ + aslopcodes.c asloperands.c aslopt.c asloptions.c \ + aslparseop.c aslpld.c aslpredef.c aslprepkg.c \ + aslprintf.c aslprune.c aslresource.c aslrestype1.c \ + aslrestype1i.c aslrestype2.c aslrestype2d.c \ + aslrestype2e.c aslrestype2q.c aslrestype2s.c \ + aslrestype2w.c aslstartup.c aslstubs.c asltransform.c \ + asltree.c aslutils.c asluuid.c aslwalks.c aslxref.c \ + aslxrefout.c cvcompiler.c cvdisasm.c cvparser.c \ + dtcompile.c dtexpress.c dtfield.c dtio.c dtparser.y.h \ + dtparserlex.c dtparserparse.c dtsubtable.c dttable.c \ + dttable1.c dttable2.c dttemplate.c dtutils.c \ + prexpress.c prmacros.c prparser.y.h prparserlex.c \ + prparserparse.c prscan.c prutils.c # components/debugger SRCS+= dbfileio.c @@ -68,7 +68,8 @@ SRCS+= utaddress.c utalloc.c utascii.c utbuffer.c utcache.c \ utexcep.c utglobal.c uthex.c utinit.c utlock.c utmath.c \ utmisc.c utmutex.c utnonansi.c utobject.c utownerid.c \ utpredef.c utresdecode.c utresrc.c utstate.c utstring.c \ - utstrtoul64.c utuuid.c utxface.c utxferror.c + utstrsuppt.c utstrtoul64.c utuuid.c utxface.c \ + utxferror.c # os_specific/service_layers SRCS+= osunixxf.c -- 2.45.0