Date: Sat, 19 Oct 2019 14:56:44 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353764 - in head: sys/contrib/dev/acpica sys/contrib/dev/acpica/common sys/contrib/dev/acpica/compiler sys/contrib/dev/acpica/components/debugger sys/contrib/dev/acpica/components/disa... Message-ID: <201910191456.x9JEuikq035737@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Sat Oct 19 14:56:44 2019 New Revision: 353764 URL: https://svnweb.freebsd.org/changeset/base/353764 Log: Merge ACPICA 20191018. Added: head/sys/contrib/dev/acpica/compiler/dtcompilerparser.l - copied, changed from r351127, vendor-sys/acpica/dist/source/compiler/dtcompilerparser.l head/sys/contrib/dev/acpica/compiler/dtcompilerparser.y - copied, changed from r351127, vendor-sys/acpica/dist/source/compiler/dtcompilerparser.y Modified: head/sys/contrib/dev/acpica/acpica_prep.sh head/sys/contrib/dev/acpica/changes.txt head/sys/contrib/dev/acpica/common/acgetline.c head/sys/contrib/dev/acpica/common/adisasm.c head/sys/contrib/dev/acpica/common/adwalk.c head/sys/contrib/dev/acpica/common/dmrestag.c head/sys/contrib/dev/acpica/common/dmtables.c head/sys/contrib/dev/acpica/common/dmtbdump1.c head/sys/contrib/dev/acpica/common/dmtbdump2.c head/sys/contrib/dev/acpica/common/dmtbdump3.c head/sys/contrib/dev/acpica/compiler/aslanalyze.c head/sys/contrib/dev/acpica/compiler/aslbtypes.c head/sys/contrib/dev/acpica/compiler/aslcache.c head/sys/contrib/dev/acpica/compiler/aslcodegen.c head/sys/contrib/dev/acpica/compiler/aslcompile.c head/sys/contrib/dev/acpica/compiler/aslcompiler.h head/sys/contrib/dev/acpica/compiler/asldebug.c head/sys/contrib/dev/acpica/compiler/asldefine.h head/sys/contrib/dev/acpica/compiler/aslglobal.h head/sys/contrib/dev/acpica/compiler/aslhelp.c head/sys/contrib/dev/acpica/compiler/aslkeywords.y head/sys/contrib/dev/acpica/compiler/asllength.c head/sys/contrib/dev/acpica/compiler/asllistsup.c head/sys/contrib/dev/acpica/compiler/aslload.c head/sys/contrib/dev/acpica/compiler/aslmain.c head/sys/contrib/dev/acpica/compiler/aslmessages.c head/sys/contrib/dev/acpica/compiler/aslmessages.h head/sys/contrib/dev/acpica/compiler/aslmethod.c head/sys/contrib/dev/acpica/compiler/aslnamesp.c head/sys/contrib/dev/acpica/compiler/asloptions.c head/sys/contrib/dev/acpica/compiler/aslparseop.c head/sys/contrib/dev/acpica/compiler/aslprepkg.c head/sys/contrib/dev/acpica/compiler/aslresource.c head/sys/contrib/dev/acpica/compiler/aslrestype2.c head/sys/contrib/dev/acpica/compiler/aslrestype2s.c head/sys/contrib/dev/acpica/compiler/aslstartup.c head/sys/contrib/dev/acpica/compiler/asltransform.c head/sys/contrib/dev/acpica/compiler/asltypes.h head/sys/contrib/dev/acpica/compiler/aslutils.c head/sys/contrib/dev/acpica/compiler/aslxrefout.c head/sys/contrib/dev/acpica/compiler/cvdisasm.c head/sys/contrib/dev/acpica/compiler/cvparser.c head/sys/contrib/dev/acpica/compiler/dtcompile.c head/sys/contrib/dev/acpica/compiler/dtcompiler.h head/sys/contrib/dev/acpica/compiler/dtfield.c head/sys/contrib/dev/acpica/compiler/dtio.c head/sys/contrib/dev/acpica/compiler/dtparser.l head/sys/contrib/dev/acpica/compiler/dttable2.c head/sys/contrib/dev/acpica/compiler/dttemplate.c head/sys/contrib/dev/acpica/compiler/prmacros.c head/sys/contrib/dev/acpica/compiler/prscan.c head/sys/contrib/dev/acpica/components/debugger/dbconvert.c head/sys/contrib/dev/acpica/components/debugger/dbdisply.c head/sys/contrib/dev/acpica/components/debugger/dbfileio.c head/sys/contrib/dev/acpica/components/debugger/dbhistry.c head/sys/contrib/dev/acpica/components/debugger/dbinput.c head/sys/contrib/dev/acpica/components/debugger/dbmethod.c head/sys/contrib/dev/acpica/components/debugger/dbnames.c head/sys/contrib/dev/acpica/components/debugger/dbobject.c head/sys/contrib/dev/acpica/components/debugger/dbstats.c head/sys/contrib/dev/acpica/components/disassembler/dmdeferred.c head/sys/contrib/dev/acpica/components/disassembler/dmresrc.c head/sys/contrib/dev/acpica/components/disassembler/dmwalk.c head/sys/contrib/dev/acpica/components/dispatcher/dscontrol.c head/sys/contrib/dev/acpica/components/dispatcher/dsfield.c head/sys/contrib/dev/acpica/components/events/evgpe.c head/sys/contrib/dev/acpica/components/events/evgpeblk.c head/sys/contrib/dev/acpica/components/events/evgpeinit.c head/sys/contrib/dev/acpica/components/events/evmisc.c head/sys/contrib/dev/acpica/components/events/evregion.c head/sys/contrib/dev/acpica/components/events/evrgnini.c head/sys/contrib/dev/acpica/components/events/evxfgpe.c head/sys/contrib/dev/acpica/components/executer/exdump.c head/sys/contrib/dev/acpica/components/hardware/hwxfsleep.c head/sys/contrib/dev/acpica/components/namespace/nsaccess.c head/sys/contrib/dev/acpica/components/namespace/nsalloc.c head/sys/contrib/dev/acpica/components/namespace/nsconvert.c head/sys/contrib/dev/acpica/components/namespace/nsdump.c head/sys/contrib/dev/acpica/components/namespace/nsrepair2.c head/sys/contrib/dev/acpica/components/namespace/nsxfname.c head/sys/contrib/dev/acpica/components/parser/psobject.c head/sys/contrib/dev/acpica/components/resources/rscreate.c head/sys/contrib/dev/acpica/components/tables/tbdata.c head/sys/contrib/dev/acpica/components/tables/tbxfload.c head/sys/contrib/dev/acpica/components/utilities/utbuffer.c head/sys/contrib/dev/acpica/components/utilities/utdebug.c head/sys/contrib/dev/acpica/components/utilities/uterror.c head/sys/contrib/dev/acpica/components/utilities/utosi.c head/sys/contrib/dev/acpica/components/utilities/utownerid.c head/sys/contrib/dev/acpica/components/utilities/uttrack.c head/sys/contrib/dev/acpica/include/acconfig.h head/sys/contrib/dev/acpica/include/acdebug.h head/sys/contrib/dev/acpica/include/aclocal.h head/sys/contrib/dev/acpica/include/acobject.h head/sys/contrib/dev/acpica/include/acpiosxf.h head/sys/contrib/dev/acpica/include/acpixf.h head/sys/contrib/dev/acpica/include/acstruct.h head/sys/contrib/dev/acpica/include/actypes.h head/sys/contrib/dev/acpica/include/acutils.h head/usr.sbin/acpi/iasl/Makefile Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/acpica_prep.sh ============================================================================== --- head/sys/contrib/dev/acpica/acpica_prep.sh Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/acpica_prep.sh Sat Oct 19 14:56:44 2019 (r353764) @@ -18,12 +18,13 @@ fulldirs="common compiler components include os_specif # files to remove stripdirs="generate libraries parsers preprocessor tests tools" -stripfiles="Makefile README accygwin.h acdragonfly.h acdragonflyex.h \ - acefi.h acefiex.h achaiku.h acintel.h aclinux.h aclinuxex.h \ - acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h acqnx.h \ - acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c osefitbl.c \ - osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c osunixmap.c \ - oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c utprint.c" +stripfiles="Makefile README aslcompiler.y accygwin.h acdragonfly.h \ + acdragonflyex.h acefi.h acefiex.h achaiku.h acintel.h aclinux.h \ + aclinuxex.h acmacosx.h acmsvc.h acmsvcex.h acnetbsd.h acos2.h \ + acqnx.h acwin.h acwin64.h acwinex.h new_table.txt osbsdtbl.c \ + osefitbl.c osefixf.c osfreebsdtbl.c oslinuxtbl.c osunixdir.c \ + osunixmap.c oswindir.c oswintbl.c oswinxf.c readme.txt utclib.c \ + utprint.c" # include files to canonify src_headers="acapps.h acbuffer.h acclib.h accommon.h acconfig.h \ Modified: head/sys/contrib/dev/acpica/changes.txt ============================================================================== --- head/sys/contrib/dev/acpica/changes.txt Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/changes.txt Sat Oct 19 14:56:44 2019 (r353764) @@ -1,4 +1,117 @@ ---------------------------------------- +18 October 2019. Summary of changes for version 20191018: + + +1) ACPICA kernel-resident subsystem: + +Debugger: added a new command: ?Fields [address space ID]?. This command +dumps the contents of all field units that are defined within the +namespace with a particular address space ID. + +Modified the external interface AcpiLoadTable() to return a table index. +This table index can be used for unloading a table for debugging. + ACPI_STATUS + AcpiLoadTable ( + ACPI_TABLE_HEADER *Table, + UINT32 *TableIndex)) + +Implemented a new external interface: AcpiUnloadTable() This new function +takes a table index as an argument and unloads the table. Useful for +debugging only. + ACPI_STATUS + AcpiUnloadTable ( + UINT32 TableIndex)) + +Ported the AcpiNames utility to use the new table initialization +sequence. The utility was broken before this change. Also, it was +required to include most of the AML interpreter into the utility in order +to process table initialization (module-level code execution.) + +Update for results from running Clang V8.0.1. This fixes all "dead +assignment" warnings. There are still several "Dereference of NULL +pointer" warnings, but these have been found to be false positive +warnings. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: numerous table compiler changes to ensure that the usage of +yacc/bison syntax is POSIX-compliant. + +iASL/disassembler: several simple bug fixes in the data table +disassembler. + +Acpiexec: expanded the initialization file (the -fi option) to initialize +strings, buffers, packages, and field units. + + +---------------------------------------- +16 August 2019. Summary of changes for version 20190816: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Modified the OwnerId mechanism to allow for more Owner Ids. The previous +limit was 256 Ids, now it is 4096 Ids. This prevents OWNER_ID_LIMIT +exceptions on machines with a large number of initialization threads, +many CPU cores and nested initialization control methods. + +Introduced acpi_dispatch_gpe() as a wrapper around AcpiEvDetectGpe() for +checking if the given GPE (as represented by a GPE device handle and a +GPE number) is currently active and dispatching it (if that's the case) +outside of interrupt context. + +Table load: exit the interpreter before initializing objects within the +new table This prevents re-acquiring the interpreter lock when loading +tables + +Added the "Windows 2019" string to the _OSI support (version 1903). Jung- +uk Kim + +Macros: removed pointer math on a null pointer. Causes warnings on some +compilers and/or tools. Changed ACPI_TO_POINTER to use ACPI_CAST_PTR +instead of using arithmetic. + +Fully deployed the ACPI_PRINTF_LIKE macro. This macro was not being used +across all "printf-like" internal functions. Also, cleanup all calls to +such functions (both in 32-bit mode and 64-bit mode) now that they are +analyzed by the gcc compiler via ACPI_PRINTF_LIKE. + + +2) iASL Compiler/Disassembler and ACPICA tools: + +iASL: implemented a new data table compiler flex/bison front-end. This +change is internal and is not intended to result in changes to the +compiled code. This new compiler front-end can be invoked using the -tp +option for now, until the old mechanism is removed. + +ASLTS: Implemented a new data table compiler test suite. This test suite +generates all table templates and compile/disassemble/re-compile/binary- +compare each file. + +iASL: return -1 if AML files were not generated due to compiler errors + +iASL: added a warning on use of the now-legacy ASL Processor () keyword. + +iASL: added an error on _UID object declaration that returns a String +within a Processor () declaration. A _UID for a processor must be an +Integer. + +iASL: added a null terminator to name strings that consist only of +multiple parent prefixes (^) + +iASL: added support to compile both ASL and data table files in a single +command. + +Updated the tool generation project files that were recently migrated to +MSVC 2017 to eliminate all new warnings. The new project files appear in +the directory \acpica\generate\msvc2017. This change effectively +deprecates the older project files in \acpica\generate\msvc9. + + +---------------------------------------- 03 July 2019. Summary of changes for version 20190703: Modified: head/sys/contrib/dev/acpica/common/acgetline.c ============================================================================== --- head/sys/contrib/dev/acpica/common/acgetline.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/acgetline.c Sat Oct 19 14:56:44 2019 (r353764) @@ -532,7 +532,7 @@ AcpiOsGetLine ( * Ignore the various keys like insert/delete/home/end, etc. * But we must eat the final character of the ESC sequence. */ - InputChar = getchar (); + (void) getchar (); continue; default: Modified: head/sys/contrib/dev/acpica/common/adisasm.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adisasm.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/adisasm.c Sat Oct 19 14:56:44 2019 (r353764) @@ -746,7 +746,6 @@ AdDoExternalFileList ( { ExternalFileList = ExternalFileList->Next; GlobalStatus = AE_TYPE; - Status = AE_OK; continue; } Modified: head/sys/contrib/dev/acpica/common/adwalk.c ============================================================================== --- head/sys/contrib/dev/acpica/common/adwalk.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/adwalk.c Sat Oct 19 14:56:44 2019 (r353764) @@ -480,6 +480,7 @@ AcpiDmDumpDescending ( { ACPI_OP_WALK_INFO *Info = Context; char *Path; + ACPI_STATUS Status; if (!Op) @@ -522,10 +523,18 @@ AcpiDmDumpDescending ( if (Op->Common.Value.String) { - AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, + Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String, NULL, &Path); - AcpiOsPrintf ("%s %p", Path, Op->Common.Node); - ACPI_FREE (Path); + if (ACPI_SUCCESS (Status)) + { + AcpiOsPrintf ("%s %p", Path, Op->Common.Node); + ACPI_FREE (Path); + } + else + { + AcpiOsPrintf ("Could not externalize pathname for node [%4.4s]", + Op->Common.Node->Name.Ascii); + } } else { @@ -592,7 +601,9 @@ AcpiDmFindOrphanDescending ( return (AE_OK); } +#ifdef ACPI_UNDER_DEVELOPMENT OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); +#endif switch (Op->Common.AmlOpcode) { @@ -830,9 +841,9 @@ AcpiDmLoadDescendingOp ( * 2) Not the root node * 3) Not a node created by Scope */ - - if (!PreDefined && Node != AcpiGbl_RootNode && - Op->Common.AmlOpcode != AML_SCOPE_OP) + if (!PreDefined && + (Node != AcpiGbl_RootNode) && + (Op->Common.AmlOpcode != AML_SCOPE_OP)) { Node->OwnerId = WalkState->OwnerId; } @@ -1091,7 +1102,7 @@ AcpiDmCommonDescendingOp ( /* Switch/Case conversion */ Status = AcpiDmProcessSwitch (Op); - return (AE_OK); + return (Status); } Modified: head/sys/contrib/dev/acpica/common/dmrestag.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmrestag.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmrestag.c Sat Oct 19 14:56:44 2019 (r353764) @@ -833,8 +833,12 @@ AcpiGetTagPathname ( /* Internalize the namepath to AML format */ - AcpiNsInternalizeName (Pathname, &InternalPath); + Status = AcpiNsInternalizeName (Pathname, &InternalPath); ACPI_FREE (Pathname); + if (ACPI_FAILURE (Status)) + { + return (NULL); + } /* Update the Op with the symbol */ Modified: head/sys/contrib/dev/acpica/common/dmtables.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtables.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtables.c Sat Oct 19 14:56:44 2019 (r353764) @@ -327,7 +327,7 @@ AdCreateTableHeader ( * makes it easier to rename the disassembled ASL file if needed. */ AcpiOsPrintf ( - "DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n", + "DefinitionBlock (\"\", \"%4.4s\", %u, \"%.6s\", \"%.8s\", 0x%8.8X)\n", Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); } @@ -443,8 +443,8 @@ AdGetLocalTables ( /* Get the DSDT via table override */ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) + Status = AcpiOsTableOverride (&TableHeader, &NewTable); + if (ACPI_FAILURE (Status) || !NewTable) { fprintf (stderr, "Could not obtain DSDT\n"); return (AE_NO_ACPI_TABLES); @@ -601,7 +601,7 @@ AdParseTable ( fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - Status = AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); + (void) AcpiDmParseDeferredOps (AcpiGbl_ParseOpRoot); fprintf (stderr, "\n"); /* Process Resource Templates */ Modified: head/sys/contrib/dev/acpica/common/dmtbdump1.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump1.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump1.c Sat Oct 19 14:56:44 2019 (r353764) @@ -474,7 +474,6 @@ AcpiDmDumpCsrt ( { return; } - SubSubOffset += InfoLength; } /* Point to next sub-subtable */ @@ -1401,7 +1400,6 @@ AcpiDmDumpHmat ( while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - SubtableOffset = 0; /* Dump HMAT structure header */ @@ -1484,6 +1482,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1500,6 +1503,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 4, AcpiDmTableInfoHmat1b); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } @@ -1519,6 +1527,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat1c); + if (ACPI_FAILURE(Status)) + { + return; + } + SubtableOffset += 2; } } @@ -1542,6 +1555,11 @@ AcpiDmDumpHmat ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_HMAT_STRUCTURE, HmatStruct, SubtableOffset), 2, AcpiDmTableInfoHmat2a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 2; } break; Modified: head/sys/contrib/dev/acpica/common/dmtbdump2.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump2.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump2.c Sat Oct 19 14:56:44 2019 (r353764) @@ -187,6 +187,7 @@ AcpiDmDumpIort ( ACPI_DMTABLE_INFO *InfoTable; char *String; UINT32 i; + UINT32 MappingByteLength; /* Main table */ @@ -314,6 +315,11 @@ AcpiDmDumpIort ( Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, NodeOffset), 4, AcpiDmTableInfoIort0a); + if (ACPI_FAILURE (Status)) + { + return; + } + NodeOffset += 4; } } @@ -325,8 +331,10 @@ AcpiDmDumpIort ( if (IortNode->Length > NodeOffset) { + MappingByteLength = + IortNode->MappingCount * sizeof (ACPI_IORT_ID_MAPPING); Status = AcpiDmDumpTable (Table->Length, Offset + NodeOffset, - Table, IortNode->Length - NodeOffset, + Table, IortNode->Length - NodeOffset - MappingByteLength, AcpiDmTableInfoIort1a); if (ACPI_FAILURE (Status)) { @@ -410,7 +418,6 @@ NextSubtable: /* Point to next node subtable */ Offset += IortNode->Length; - IortNode = ACPI_ADD_PTR (ACPI_IORT_NODE, IortNode, IortNode->Length); } } @@ -871,7 +878,7 @@ AcpiDmDumpMcfg ( if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length) { AcpiOsPrintf ("Warning: there are %u invalid trailing bytes\n", - sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); + (UINT32) sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length)); return; } @@ -1211,7 +1218,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 32-bit values at the end */ InfoTable = AcpiDmTableInfoNfit2; - Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); FieldOffset = sizeof (ACPI_NFIT_INTERLEAVE); break; @@ -1236,7 +1242,6 @@ AcpiDmDumpNfit ( /* Has a variable number of 64-bit addresses at the end */ InfoTable = AcpiDmTableInfoNfit6; - Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64); break; @@ -1273,6 +1278,7 @@ AcpiDmDumpNfit ( { case ACPI_NFIT_TYPE_INTERLEAVE: + Interleave = ACPI_CAST_PTR (ACPI_NFIT_INTERLEAVE, Subtable); for (i = 0; i < Interleave->LineCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1308,6 +1314,7 @@ AcpiDmDumpNfit ( case ACPI_NFIT_TYPE_FLUSH_ADDRESS: + Hint = ACPI_CAST_PTR (ACPI_NFIT_FLUSH_ADDRESS, Subtable); for (i = 0; i < Hint->HintCount; i++) { Status = AcpiDmDumpTable (Table->Length, Offset + FieldOffset, @@ -1806,6 +1813,11 @@ AcpiDmDumpPptt ( Status = AcpiDmDumpTable (Table->Length, Offset + SubtableOffset, ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Subtable, SubtableOffset), 4, AcpiDmTableInfoPptt0a); + if (ACPI_FAILURE (Status)) + { + return; + } + SubtableOffset += 4; } break; @@ -2063,6 +2075,10 @@ AcpiDmDumpSdev ( Status = AcpiDmDumpTable (Table->Length, 0, ACPI_ADD_PTR (UINT8, Pcie, VendorDataOffset), VendorDataLength, AcpiDmTableInfoSdev1b); + if (ACPI_FAILURE (Status)) + { + return; + } } break; Modified: head/sys/contrib/dev/acpica/common/dmtbdump3.c ============================================================================== --- head/sys/contrib/dev/acpica/common/dmtbdump3.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/common/dmtbdump3.c Sat Oct 19 14:56:44 2019 (r353764) @@ -410,7 +410,7 @@ AcpiDmDumpStao ( Namepath = ACPI_ADD_PTR (char, Table, Offset); StringLength = strlen (Namepath) + 1; - AcpiDmLineHeader (Offset, StringLength, "Namestring"); + AcpiDmLineHeader (Offset, StringLength, "Namepath"); AcpiOsPrintf ("\"%s\"\n", Namepath); /* Point to next namepath */ @@ -526,7 +526,7 @@ AcpiDmDumpTpm2Rev3 ( { case ACPI_TPM23_ACPI_START_METHOD: - Status = AcpiDmDumpTable (Table->Length, Offset, Subtable, + (void) AcpiDmDumpTable (Table->Length, Offset, Subtable, Table->Length - Offset, AcpiDmTableInfoTpm23a); break; @@ -591,7 +591,7 @@ AcpiDmDumpTpm2 ( Offset += sizeof (ACPI_TPM2_TRAILER); AcpiOsPrintf ("\n"); - Status = AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, + (void) AcpiDmDumpTable (Table->Length, Offset, ArmSubtable, Table->Length - Offset, AcpiDmTableInfoTpm211); break; Modified: head/sys/contrib/dev/acpica/compiler/aslanalyze.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslanalyze.c Sat Oct 19 14:56:44 2019 (r353764) @@ -569,7 +569,7 @@ ApCheckForGpeNameConflict ( /* Need a null-terminated string version of NameSeg */ - ACPI_MOVE_32_TO_32 (Name, &Op->Asl.NameSeg); + ACPI_MOVE_32_TO_32 (Name, Op->Asl.NameSeg); Name[ACPI_NAMESEG_SIZE] = 0; /* Modified: head/sys/contrib/dev/acpica/compiler/aslbtypes.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslbtypes.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslbtypes.c Sat Oct 19 14:56:44 2019 (r353764) @@ -474,7 +474,6 @@ AnFormatBtype ( strcat (Buffer, "|"); } - First = FALSE; strcat (Buffer, "Resource"); } } Modified: head/sys/contrib/dev/acpica/compiler/aslcache.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcache.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcache.c Sat Oct 19 14:56:44 2019 (r353764) @@ -421,7 +421,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u ParseOps, Buffer size: %u ops (%u bytes), %u Buffers\n", AslGbl_ParseOpCount, ASL_PARSEOP_CACHE_SIZE, - (sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (ACPI_PARSE_OBJECT) * ASL_PARSEOP_CACHE_SIZE), BufferCount); /* Reset cache globals */ @@ -445,7 +445,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u Fields, Buffer size: %u fields (%u bytes), %u Buffers\n", AslGbl_FieldCount, ASL_FIELD_CACHE_SIZE, - (sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (DT_FIELD) * ASL_FIELD_CACHE_SIZE), BufferCount); /* Reset cache globals */ @@ -468,7 +468,7 @@ UtDeleteLocalCaches ( DbgPrint (ASL_DEBUG_OUTPUT, "%u Subtables, Buffer size: %u subtables (%u bytes), %u Buffers\n", AslGbl_SubtableCount, ASL_SUBTABLE_CACHE_SIZE, - (sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); + ((UINT32) sizeof (DT_SUBTABLE) * ASL_SUBTABLE_CACHE_SIZE), BufferCount); /* Reset cache globals */ Modified: head/sys/contrib/dev/acpica/compiler/aslcodegen.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcodegen.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcodegen.c Sat Oct 19 14:56:44 2019 (r353764) @@ -618,8 +618,8 @@ CgWriteTableHeader ( Op->Asl.AmlSubtreeLength += strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3; - CvDbgPrint (" Length: %lu\n", - strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3); + CvDbgPrint (" Length: %u\n", + (UINT32) strlen (AslGbl_ParseTreeRoot->Asl.Filename) + 3); if (Op->Asl.CommentList) { Modified: head/sys/contrib/dev/acpica/compiler/aslcompile.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcompile.c Sat Oct 19 14:56:44 2019 (r353764) @@ -853,10 +853,11 @@ CmDumpAllEvents ( * ******************************************************************************/ -void +int CmCleanupAndExit ( void) { + int Status = 0; BOOLEAN DeleteAmlFile = FALSE; ASL_GLOBAL_FILE_NODE *CurrentFileNode = AslGbl_FilesList; @@ -915,20 +916,38 @@ CmCleanupAndExit ( UtDisplaySummary (ASL_FILE_STDOUT); /* - * We will delete the AML file if there are errors and the - * force AML output option has not been used. + * Delete the AML file if there are errors and the force AML output option + * (-f) has not been used. + * + * Return -1 as a status of the compiler if no AML files are generated. If + * the AML file is generated in the presence of errors, return 0. In the + * latter case, the errors were ignored by the user so the compilation is + * considered successful. */ - if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly || ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && + if (AslGbl_ParserErrorDetected || AslGbl_PreprocessOnly || + ((AslGbl_ExceptionCount[ASL_ERROR] > 0) && (!AslGbl_IgnoreErrors) && AslGbl_Files[ASL_FILE_AML_OUTPUT].Handle)) { DeleteAmlFile = TRUE; + Status = -1; } /* Close all open files */ while (CurrentFileNode) { + /* + * Set the program return status based on file errors. If there are any + * errors and during compilation, the command is not considered + * successful. + */ + if (Status != -1 && !AslGbl_IgnoreErrors && + CurrentFileNode->ParserErrorDetected) + { + Status = -1; + } + switch (FlSwitchFileSet (CurrentFileNode->Files[ASL_FILE_INPUT].Filename)) { case SWITCH_TO_SAME_FILE: @@ -952,6 +971,8 @@ CmCleanupAndExit ( { UtDeleteLocalCaches (); } + + return (Status); } Modified: head/sys/contrib/dev/acpica/compiler/aslcompiler.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslcompiler.h Sat Oct 19 14:56:44 2019 (r353764) @@ -266,7 +266,7 @@ void CmDoOutputFiles ( void); -void +int CmCleanupAndExit ( void); @@ -1052,6 +1052,7 @@ void FlCloseFile ( UINT32 FileId); +ACPI_PRINTF_LIKE (2) void FlPrintFile ( UINT32 FileId, @@ -1195,6 +1196,7 @@ OtXrefWalkPart1 ( /* * aslutils - common compiler utilities */ +ACPI_PRINTF_LIKE(2) void DbgPrint ( UINT32 Type, @@ -1288,6 +1290,10 @@ UtInternalizeName ( char *ExternalName, char **ConvertedName); +BOOLEAN +UtNameContainsAllPrefix ( + ACPI_PARSE_OBJECT *Op); + void UtAttachNamepathToOwner ( ACPI_PARSE_OBJECT *Op, @@ -1303,7 +1309,16 @@ UINT64 UtDoConstant ( char *String); +char * +AcpiUtStrdup ( + char *String); +char * +AcpiUtStrcat ( + char *String1, + char *String2); + + /* * asluuid - UUID support */ @@ -1604,6 +1619,7 @@ DtCreateTemplates ( /* * ASL/ASL+ converter debug */ +ACPI_PRINTF_LIKE (1) void CvDbgPrint ( char *Fmt, Modified: head/sys/contrib/dev/acpica/compiler/asldebug.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldebug.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asldebug.c Sat Oct 19 14:56:44 2019 (r353764) @@ -239,7 +239,7 @@ UtDumpIntegerOp ( case 8: /* Dword */ DbgPrint (ASL_TREE_OUTPUT, - "%*.*X", IntegerLength, IntegerLength, Op->Asl.Value.Integer); + "%*.*X", IntegerLength, IntegerLength, (UINT32) Op->Asl.Value.Integer); break; case 16: /* Qword and Integer */ Modified: head/sys/contrib/dev/acpica/compiler/asldefine.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asldefine.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asldefine.h Sat Oct 19 14:56:44 2019 (r353764) @@ -290,7 +290,7 @@ #define ASL_PARSE_TREE_DEBUG2 \ " %08X %04X %04X %01X %04X %04X %05X %05X "\ - "%08X %08X %08X %08X %08X %08X %04X %02d %5d %5d %5d %5d" + "%8p %8p %8p %8p %08X %08X %04X %02d %5d %5d %5d %5d" /* * Macros for ASL/ASL+ converter Modified: head/sys/contrib/dev/acpica/compiler/aslglobal.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslglobal.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslglobal.h Sat Oct 19 14:56:44 2019 (r353764) @@ -244,7 +244,6 @@ extern const char *AslGbl_SpecialNam #endif - /* * Parser and other externals */ @@ -254,6 +253,7 @@ extern int DtParserdebug; extern int PrParserdebug; extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; extern char *AslCompilertext; +extern char *DtCompilerParsertext; /* * Older versions of Bison won't emit this external in the generated header. Modified: head/sys/contrib/dev/acpica/compiler/aslhelp.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslhelp.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslhelp.c Sat Oct 19 14:56:44 2019 (r353764) @@ -246,6 +246,7 @@ Usage ( ACPI_OPTION ("", " (Original comments are passed through to ASL+ file)"); printf ("\nData Table Compiler:\n"); + ACPI_OPTION ("-tp", "Compile tables with flex/bison prototype"); ACPI_OPTION ("-G", "Compile custom table that contains generic operators"); ACPI_OPTION ("-T <sig list>|ALL", "Create ACPI table template/example files"); ACPI_OPTION ("-T <count>", "Emit DSDT and <count> SSDTs to same file"); Modified: head/sys/contrib/dev/acpica/compiler/aslkeywords.y ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslkeywords.y Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslkeywords.y Sat Oct 19 14:56:44 2019 (r353764) @@ -202,7 +202,7 @@ AddressKeyword ; AddressSpaceKeyword - : ByteConst {$$ = UtCheckIntegerRange ($1, 0x0A, 0xFF);} + : ByteConst {$$ = UtCheckIntegerRange ($1, ACPI_NUM_PREDEFINED_REGIONS, 0xFF);} | RegionSpaceKeyword {} ; Modified: head/sys/contrib/dev/acpica/compiler/asllength.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllength.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asllength.c Sat Oct 19 14:56:44 2019 (r353764) @@ -479,12 +479,13 @@ CgGenerateAmlLengths ( Op->Asl.AmlLength = strlen (Buffer); /* - * Check for single backslash reference to root, - * make it a null terminated string in the AML + * Check for single backslash reference to root or reference to a name + * consisting of only prefix (^) characters. Make it a null terminated + * string in the AML. */ - if (Op->Asl.AmlLength == 1) + if (Op->Asl.AmlLength == 1 || UtNameContainsAllPrefix(Op)) { - Op->Asl.AmlLength = 2; + Op->Asl.AmlLength++; } break; Modified: head/sys/contrib/dev/acpica/compiler/asllistsup.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/asllistsup.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/asllistsup.c Sat Oct 19 14:56:44 2019 (r353764) @@ -241,7 +241,7 @@ LsDumpAsciiInComment ( { /* Insert a space to break the sequence */ - FlPrintFile (FileId, ".", BufChar); + FlPrintFile (FileId, " "); } FlPrintFile (FileId, "%c", BufChar); Modified: head/sys/contrib/dev/acpica/compiler/aslload.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslload.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslload.c Sat Oct 19 14:56:44 2019 (r353764) @@ -275,7 +275,6 @@ LdLoadFieldElements ( ACPI_STATUS Status; - SourceRegion = UtGetArg (Op, 0); if (SourceRegion) { @@ -527,13 +526,12 @@ LdNamespace1Begin ( case AML_INT_CONNECTION_OP: - if (Op->Asl.Child->Asl.AmlOpcode != AML_INT_NAMEPATH_OP) { break; } - Arg = Op->Asl.Child; + Arg = Op->Asl.Child; Status = AcpiNsLookup (WalkState->ScopeInfo, Arg->Asl.ExternalName, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &Node); @@ -542,15 +540,6 @@ LdNamespace1Begin ( break; } - if (Node->Type == ACPI_TYPE_BUFFER) - { - Arg->Asl.Node = Node; - - Arg = Node->Op->Asl.Child; /* Get namepath */ - Arg = Arg->Asl.Next; /* Get actual buffer */ - Arg = Arg->Asl.Child; /* Buffer length */ - Arg = Arg->Asl.Next; /* RAW_DATA buffer */ - } break; default: @@ -577,7 +566,6 @@ LdNamespace1Begin ( * These opcodes are guaranteed to have a parent. * Examine the parent opcode. */ - Status = AE_OK; ParentOp = Op->Asl.Parent; OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Asl.AmlOpcode); @@ -1031,7 +1019,8 @@ FinishNode: * DESCRIPTION: Check if certain named objects are declared in the incorrect * scope. Special named objects are listed in * AslGbl_SpecialNamedObjects and can only be declared at the root - * scope. + * scope. _UID inside of a processor declaration must not be a + * string. * ******************************************************************************/ @@ -1051,6 +1040,13 @@ LdCheckSpecialNames ( AslError (ASL_ERROR, ASL_MSG_INVALID_SPECIAL_NAME, Op, Op->Asl.ExternalName); return; } + } + + if (ACPI_COMPARE_NAMESEG (Node->Name.Ascii, "_UID") && + Node->Parent->Type == ACPI_TYPE_PROCESSOR && + Node->Type == ACPI_TYPE_STRING) + { + AslError (ASL_ERROR, ASL_MSG_INVALID_PROCESSOR_UID , Op, "found a string"); } } Modified: head/sys/contrib/dev/acpica/compiler/aslmain.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmain.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmain.c Sat Oct 19 14:56:44 2019 (r353764) @@ -282,7 +282,6 @@ main ( if (ACPI_FAILURE (Status)) { ReturnStatus = -1; - goto CleanupAndExit; } Index2++; @@ -290,9 +289,10 @@ main ( /* * At this point, compilation of a data table or disassembly is complete. + * However, if there is a parse tree, perform compiler analysis and + * generate AML. */ - if (AslGbl_PreprocessOnly || AcpiGbl_DisasmFlag || - AslGbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) + if (AslGbl_PreprocessOnly || AcpiGbl_DisasmFlag || !AslGbl_ParseTreeRoot) { goto CleanupAndExit; } @@ -338,7 +338,6 @@ main ( } - CleanupAndExit: UtFreeLineBuffers (); @@ -350,7 +349,7 @@ CleanupAndExit: if (!AcpiGbl_DisasmFlag) { - CmCleanupAndExit (); + ReturnStatus = CmCleanupAndExit (); } @@ -400,18 +399,21 @@ AslSignalHandler ( * Close all open files * Note: the .pre file is the same as the input source file */ - AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; - - for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) + if (AslGbl_Files) { - FlCloseFile (i); - } + AslGbl_Files[ASL_FILE_PREPROCESSOR].Handle = NULL; - /* Delete any output files */ + for (i = ASL_FILE_INPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlCloseFile (i); + } - for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) - { - FlDeleteFile (i); + /* Delete any output files */ + + for (i = ASL_FILE_AML_OUTPUT; i < ASL_MAX_FILE_TYPE; i++) + { + FlDeleteFile (i); + } } printf (ASL_PREFIX "Terminating\n"); Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.c Sat Oct 19 14:56:44 2019 (r353764) @@ -366,7 +366,9 @@ const char *AslCompilerMsgs [] = /* ASL_MSG_TEMPORARY_OBJECT */ "Object is created temporarily in another method and cannot be accessed", /* ASL_MSG_UNDEFINED_EXTERNAL */ "Named object was declared external but the actual definition does not exist", /* ASL_MSG_BUFFER_FIELD_OVERFLOW */ "Buffer field extends beyond end of target buffer", -/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal" +/* ASL_MSG_INVALID_SPECIAL_NAME */ "declaration of this named object outside root scope is illegal", +/* ASL_MSG_INVALID_PROCESSOR_UID */ "_UID inside processor declaration must be an integer", +/* ASL_MSG_LEGACY_PROCESSOR_OP */ "Legacy Processor() keyword detected. Use Device() keyword instead." }; /* Table compiler */ @@ -385,7 +387,10 @@ const char *AslTableCompilerMsgs /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero" +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", +/* ASL_MSG_INVALID_LABEL */ "Invalid field label detected", +/* ASL_MSG_BUFFER_LIST */ "Invalid buffer initializer list", +/* ASL_MSG_ENTRY_LIST */ "Invalid entry initializer list" }; /* Preprocessor */ Modified: head/sys/contrib/dev/acpica/compiler/aslmessages.h ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmessages.h Sat Oct 19 14:56:44 2019 (r353764) @@ -369,6 +369,8 @@ typedef enum ASL_MSG_UNDEFINED_EXTERNAL, ASL_MSG_BUFFER_FIELD_OVERFLOW, ASL_MSG_INVALID_SPECIAL_NAME, + ASL_MSG_INVALID_PROCESSOR_UID, + ASL_MSG_LEGACY_PROCESSOR_OP, /* These messages are used by the Data Table compiler only */ @@ -385,6 +387,9 @@ typedef enum ASL_MSG_UNKNOWN_SUBTABLE, ASL_MSG_UNKNOWN_TABLE, ASL_MSG_ZERO_VALUE, + ASL_MSG_INVALID_LABEL, + ASL_MSG_BUFFER_LIST, + ASL_MSG_ENTRY_LIST, /* These messages are used by the Preprocessor only */ Modified: head/sys/contrib/dev/acpica/compiler/aslmethod.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslmethod.c Sat Oct 19 14:56:44 2019 (r353764) @@ -199,6 +199,8 @@ MtMethodAnalysisWalkBegin ( ACPI_PARSE_OBJECT *NextType; ACPI_PARSE_OBJECT *NextParamType; UINT8 ActualArgs = 0; + BOOLEAN HidExists; + BOOLEAN AdrExists; /* Build cross-reference output file if requested */ @@ -535,11 +537,25 @@ MtMethodAnalysisWalkBegin ( case PARSEOP_DEVICE: - if (!ApFindNameInDeviceTree (METHOD_NAME__HID, Op) && - !ApFindNameInDeviceTree (METHOD_NAME__ADR, Op)) + /* Check usage of _HID and _ADR objects */ + + HidExists = ApFindNameInDeviceTree (METHOD_NAME__HID, Op); + AdrExists = ApFindNameInDeviceTree (METHOD_NAME__ADR, Op); + + if (!HidExists && !AdrExists) { AslError (ASL_WARNING, ASL_MSG_MISSING_DEPENDENCY, Op, "Device object requires a _HID or _ADR in same scope"); + } + else if (HidExists && AdrExists) + { + /* + * According to the ACPI spec, "A device object must contain + * either an _HID object or an _ADR object, but should not contain + * both". + */ + AslError (ASL_WARNING, ASL_MSG_MULTIPLE_TYPES, Op, + "Device object requires either a _HID or _ADR, but not both"); } break; Modified: head/sys/contrib/dev/acpica/compiler/aslnamesp.c ============================================================================== --- head/sys/contrib/dev/acpica/compiler/aslnamesp.c Sat Oct 19 12:10:31 2019 (r353763) +++ head/sys/contrib/dev/acpica/compiler/aslnamesp.c Sat Oct 19 14:56:44 2019 (r353764) @@ -234,6 +234,10 @@ NsDisplayNamespace ( Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, FALSE, NsDoOneNamespaceObject, NULL, NULL, NULL); + if (ACPI_FAILURE (Status)) + { + return (Status); + } /* Print the full pathname for each namespace node */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910191456.x9JEuikq035737>