From 6a0135c2a1bf7216a5ba5339042cfc6a23b8f1eb Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sat, 15 Feb 2014 10:44:21 +0100 Subject: [PATCH] kernel: Sync ACPICA with Intel's version 20140214. Module changes: * Implemented a new mechanism to proactively prevent problems with ill-behaved reentrant control methods that create named ACPI objects. It should allow serialization of methods without leading to AE_ALREADY_EXISTS exceptions if the method was actually entered by more than one thread. * Added the "Windows 2013" string to the _OSI support. * Hardened/updated the _PRT return value auto-repair code. * Added support to avoid the possibility of infinite loops when traversing object linked lists. * Add #pragma pack({push,pop}) to ensure that ACPICA headers are independent of compiler settings or host headers. Utilities changes: * iasl(8): Fix a problem with support for the SPMI table. The first reserved field was incorrectly forced to have a value of zero instead of one. * iasl(8): Removed the obsolete -g option. * acpiexec(8): Added missing support for "Extra" and "Data" subobjects and for diplaying entire object linked lists. For a more detailed list, see sys/contrib/dev/acpica/changes.txt. As of this commit, the hw.acpi.serialize_methods tunable (0 by default) is replaced with hw.acpi.auto_serialize_methods (1 by default). Users with the former tunable set to 1 in their loader.conf should therefore not experience any differences. --- share/man/man4/acpi.4 | 14 +- sys/contrib/dev/acpica/changes.txt | 65 ++++ .../dev/acpica/generate/unix/Makefile.config | 5 +- .../dev/acpica/source/common/adisasm.c | 102 +---- .../dev/acpica/source/common/dmextern.c | 44 ++- .../dev/acpica/source/common/dmtbinfo.c | 2 +- .../dev/acpica/source/compiler/aslcompiler.h | 8 +- .../dev/acpica/source/compiler/aslerror.c | 33 +- .../dev/acpica/source/compiler/aslfileio.c | 113 ++++-- .../dev/acpica/source/compiler/aslglobal.h | 2 +- .../dev/acpica/source/compiler/aslmain.c | 11 - .../dev/acpica/source/compiler/aslmessages.h | 2 +- .../dev/acpica/source/compiler/asloptions.c | 8 +- .../dev/acpica/source/compiler/aslpredef.c | 10 +- .../dev/acpica/source/compiler/aslprepkg.c | 24 +- .../dev/acpica/source/compiler/aslstartup.c | 4 +- .../dev/acpica/source/compiler/asltransform.c | 9 - .../dev/acpica/source/compiler/dtfield.c | 34 +- .../dev/acpica/source/compiler/dttemplate.h | 4 +- .../dev/acpica/source/compiler/prmacros.c | 13 +- .../source/components/debugger/dbdisply.c | 4 + .../source/components/dispatcher/dsinit.c | 61 ++- .../source/components/dispatcher/dsmethod.c | 139 +++++++ .../source/components/dispatcher/dswload.c | 17 + .../source/components/events/evregion.c | 12 + .../source/components/executer/exdump.c | 222 +++++++++-- .../source/components/executer/exsystem.c | 12 +- .../source/components/executer/exutils.c | 90 +---- .../source/components/namespace/nsinit.c | 5 +- .../source/components/namespace/nsload.c | 4 +- .../source/components/namespace/nsobject.c | 9 +- .../source/components/namespace/nsprepkg.c | 40 +- .../source/components/namespace/nsrepair.c | 25 +- .../source/components/namespace/nsrepair2.c | 38 +- .../acpica/source/components/parser/psloop.c | 5 + .../source/components/parser/psobject.c | 7 +- .../source/components/resources/rscalc.c | 2 +- .../source/components/resources/rscreate.c | 10 +- .../source/components/resources/rsdump.c | 2 +- .../source/components/resources/rsdumpinfo.c | 2 +- .../source/components/resources/rsinfo.c | 2 +- .../source/components/utilities/utdelete.c | 16 +- .../source/components/utilities/utglobal.c | 38 +- .../source/components/utilities/utosi.c | 29 ++ .../dev/acpica/source/include/acapps.h | 10 +- .../dev/acpica/source/include/acbuffer.h | 5 + .../dev/acpica/source/include/acconfig.h | 4 + .../dev/acpica/source/include/acdebug.h | 4 + .../dev/acpica/source/include/acdisasm.h | 4 + .../dev/acpica/source/include/acdispat.h | 18 +- .../dev/acpica/source/include/acevents.h | 4 + .../dev/acpica/source/include/acexcep.h | 4 + .../dev/acpica/source/include/acglobal.h | 364 +++++++++--------- .../dev/acpica/source/include/achware.h | 4 + .../dev/acpica/source/include/acinterp.h | 16 +- .../dev/acpica/source/include/aclocal.h | 4 + .../dev/acpica/source/include/acmacros.h | 4 + .../dev/acpica/source/include/acnamesp.h | 4 + .../dev/acpica/source/include/acobject.h | 4 +- .../dev/acpica/source/include/acoutput.h | 4 + .../dev/acpica/source/include/acparser.h | 4 + .../dev/acpica/source/include/acpiosxf.h | 4 + .../dev/acpica/source/include/acpixf.h | 8 +- .../dev/acpica/source/include/acpredef.h | 18 +- .../dev/acpica/source/include/acresrc.h | 4 + .../dev/acpica/source/include/acrestyp.h | 4 + .../dev/acpica/source/include/acstruct.h | 8 + .../dev/acpica/source/include/actables.h | 4 + sys/contrib/dev/acpica/source/include/actbl.h | 4 + .../dev/acpica/source/include/actbl1.h | 6 +- .../dev/acpica/source/include/actbl2.h | 6 +- .../dev/acpica/source/include/actbl3.h | 6 +- .../dev/acpica/source/include/actypes.h | 4 + .../dev/acpica/source/include/acutils.h | 5 + .../dev/acpica/source/include/amlcode.h | 5 + .../dev/acpica/source/include/amlresrc.h | 5 + .../os_specific/service_layers/oswindir.c | 1 + .../os_specific/service_layers/oswinxf.c | 27 -- .../acpica/source/tools/acpiexec/aecommon.h | 5 + .../dev/acpica/source/tools/acpiexec/aeexec.c | 2 +- .../acpica/source/tools/acpiexec/aehandlers.c | 2 +- .../dev/acpica/source/tools/acpiexec/aemain.c | 13 +- sys/dev/acpica/acpi.c | 14 +- 83 files changed, 1229 insertions(+), 685 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index cc1a324663..57c2b53925 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/share/man/man4/acpi.4,v 1.61.8.1 2009/04/15 03:14:26 kensmith Exp $ .\" -.Dd February 10, 2013 +.Dd February 15, 2014 .Dt ACPI 4 .Os .Sh NAME @@ -227,14 +227,10 @@ Enables calling the VESA reset BIOS vector on the resume path. This can fix some graphics cards that have problems such as LCD white-out after resume. Default is 0 (disabled). -.It Va hw.acpi.serialize_methods -Allow override of whether methods execute in parallel or not. -Enable this for serial behavior, which fixes -.Qq Li AE_ALREADY_EXISTS -errors for -AML that really cannot handle parallel method execution. -It is off by default since this breaks recursive methods and some IBMs use -such code. +.It Va hw.acpi.auto_serialize_methods +Auto-serialization of control methods to proactively prevent problems with +ill-behaved reentrant control methods that create named ACPI objects. +Default is 1 (enabled). .It Va hw.acpi.verbose Turn on verbose debugging information about what ACPI is doing. .It Va hw.pci.link.%s.%d.irq diff --git a/sys/contrib/dev/acpica/changes.txt b/sys/contrib/dev/acpica/changes.txt index 0f1ac8a5cd..bcd15f396f 100644 --- a/sys/contrib/dev/acpica/changes.txt +++ b/sys/contrib/dev/acpica/changes.txt @@ -1,3 +1,68 @@ +---------------------------------------- +14 February 2014. Summary of changes for version 20140214: + +1) ACPICA kernel-resident subsystem: + +Implemented a new mechanism to proactively prevent problems with ill- +behaved reentrant control methods that create named ACPI objects. This +behavior is illegal as per the ACPI specification, but is nonetheless +frequently seen in the field. Previously, this could lead to an +AE_ALREADY_EXISTS exception if the method was actually entered by more +than one thread. This new mechanism detects such methods at table load +time and marks them "serialized" to prevent reentrancy. A new global +option, AcpiGbl_AutoSerializeMethods, has been added to disable this +feature if desired. This mechanism and global option obsoletes and +supersedes the previous AcpiGbl_SerializeAllMethods option. + +Added the "Windows 2013" string to the _OSI support. ACPICA will now +respond TRUE to _OSI queries with this string. It is the stated policy of +ACPICA to add new strings to the _OSI support as soon as possible after +they are defined. See the full ACPICA _OSI policy which has been added to +the utilities/utosi.c file. + +Hardened/updated the _PRT return value auto-repair code: +1) Do not abort the repair on a single subpackage failure, continue to +check all subpackages. +2) Add check for the minimum subpackage length (4). +3) Properly handle extraneous NULL package elements. + +Added support to avoid the possibility of infinite loops when traversing +object linked lists. Never allow an infinite loop, even in the face of +corrupted object lists. + +ACPICA headers: Deployed the use of #pragma pack(push) and #pragma +pack(pop) directives to ensure that the ACPICA headers are independent of +compiler settings or other host headers. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and +has a much larger code and data size. + + Current Release: + Non-Debug Version: 96.5K Code, 27.2K Data, 123.7K Total + Debug Version: 188.6K Code, 79.0K Data, 267.6K Total + Previous Release: + Non-Debug Version: 96.2K Code, 27.0K Data, 123.2K Total + Debug Version: 187.5K Code, 78.3K Data, 265.8K Total + + +2) iASL Compiler/Disassembler and Tools: + +iASL/Table-compiler: Fixed a problem with support for the SPMI table. The +first reserved field was incorrectly forced to have a value of zero. This +change correctly forces the field to have a value of one. ACPICA BZ 1081. + +Debugger: Added missing support for the "Extra" and "Data" subobjects +when displaying object data. + +Debugger: Added support to display entire object linked lists when +displaying object data. + +iASL: Removed the obsolete -g option to obtain ACPI tables from the +Windows registry. This feature has been superseded by the acpidump +utility. + ---------------------------------------- 14 January 2014. Summary of changes for version 20140114: diff --git a/sys/contrib/dev/acpica/generate/unix/Makefile.config b/sys/contrib/dev/acpica/generate/unix/Makefile.config index e458f4cc10..b640d659c2 100644 --- a/sys/contrib/dev/acpica/generate/unix/Makefile.config +++ b/sys/contrib/dev/acpica/generate/unix/Makefile.config @@ -161,14 +161,15 @@ CWARNINGFLAGS = \ CWARNINGFLAGS += \ -Waddress\ -Waggregate-return\ - -Wchar-subscripts\ + -Winit-self\ + -Winline\ -Wmissing-declarations\ -Wmissing-field-initializers\ -Wnested-externs\ -Wold-style-definition\ + -Woverride-init\ -Wno-format-nonliteral\ -Wredundant-decls - # # Per-host flags and exclusions # diff --git a/sys/contrib/dev/acpica/source/common/adisasm.c b/sys/contrib/dev/acpica/source/common/adisasm.c index 538efe4e05..2a8fac3284 100644 --- a/sys/contrib/dev/acpica/source/common/adisasm.c +++ b/sys/contrib/dev/acpica/source/common/adisasm.c @@ -250,7 +250,6 @@ AdInitialize ( * OutToFile - TRUE if output should go to a file * Prefix - Path prefix for output * OutFilename - where the filename is returned - * GetAllTables - TRUE if all tables are desired * * RETURN: Status * @@ -263,8 +262,7 @@ AdAmlDisassemble ( BOOLEAN OutToFile, char *Filename, char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables) + char **OutFilename) { ACPI_STATUS Status; char *DisasmFilename = NULL; @@ -348,7 +346,7 @@ AdAmlDisassemble ( } else { - Status = AdGetLocalTables (Filename, GetAllTables); + Status = AdGetLocalTables (); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not get ACPI tables, %s\n", @@ -746,8 +744,7 @@ AdDisplayTables ( * * FUNCTION: AdGetLocalTables * - * PARAMETERS: Filename - Not used - * GetAllTables - TRUE if all tables are desired + * PARAMETERS: None * * RETURN: Status * @@ -757,105 +754,36 @@ AdDisplayTables ( ACPI_STATUS AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables) + void) { ACPI_STATUS Status; ACPI_TABLE_HEADER TableHeader; ACPI_TABLE_HEADER *NewTable; - UINT32 NumTables; - UINT32 PointerSize; UINT32 TableIndex; - if (GetAllTables) - { - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (!NewTable) - { - fprintf (stderr, "Could not obtain RSDT\n"); - return (AE_NO_ACPI_TABLES); - } - else - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_RSDT, NewTable->OemTableId); - } - - if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT)) - { - PointerSize = sizeof (UINT32); - } - else - { - PointerSize = sizeof (UINT64); - } - - /* - * Determine the number of tables pointed to by the RSDT/XSDT. - * This is defined by the ACPI Specification to be the number of - * pointers contained within the RSDT/XSDT. The size of the pointers - * is architecture-dependent. - */ - NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize; - AcpiOsPrintf ("There are %u tables defined in the %4.4s\n\n", - NumTables, NewTable->Signature); - - /* Get the FADT */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_FADT, NewTable->OemTableId); - } - AcpiOsPrintf ("\n"); - - /* Don't bother with FACS, it is usually all zeros */ - } - - /* Always get the DSDT */ + /* Get the DSDT via table override */ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT); AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AdWriteTable (NewTable, NewTable->Length, - ACPI_SIG_DSDT, NewTable->OemTableId); - - /* Store DSDT in the Table Manager */ - - Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, - 0, &TableIndex); - if (ACPI_FAILURE (Status)) - { - fprintf (stderr, "Could not store DSDT\n"); - return (AE_NO_ACPI_TABLES); - } - } - else + if (!NewTable) { fprintf (stderr, "Could not obtain DSDT\n"); return (AE_NO_ACPI_TABLES); } -#if 0 - /* TBD: Future implementation */ + AdWriteTable (NewTable, NewTable->Length, + ACPI_SIG_DSDT, NewTable->OemTableId); - AcpiOsPrintf ("\n"); + /* Store DSDT in the Table Manager */ - /* Get all SSDTs */ - - ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT); - do + Status = AcpiTbStoreTable (0, NewTable, NewTable->Length, + 0, &TableIndex); + if (ACPI_FAILURE (Status)) { - NewTable = NULL; - Status = AcpiOsTableOverride (&TableHeader, &NewTable); - - } while (NewTable); -#endif + fprintf (stderr, "Could not store DSDT\n"); + return (AE_NO_ACPI_TABLES); + } return (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/common/dmextern.c b/sys/contrib/dev/acpica/source/common/dmextern.c index 82b24d13d3..ba0041cc22 100644 --- a/sys/contrib/dev/acpica/source/common/dmextern.c +++ b/sys/contrib/dev/acpica/source/common/dmextern.c @@ -1265,10 +1265,16 @@ AcpiDmUnresolvedWarning ( " * were not specified. This resulting disassembler output file may not\n" " * compile because the disassembler did not know how many arguments\n" " * to assign to these methods. To specify the tables needed to resolve\n" - " * external control method references, use the one of the following\n" - " * example iASL invocations:\n" - " * iasl -e -d \n" - " * iasl -e -d \n" + " * external control method references, the -e option can be used to\n" + " * specify the filenames. Example iASL invocations:\n" + " * iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" + " * iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" + " * iasl -e ssdt*.aml -d dsdt.aml\n" + " *\n" + " * In addition, the -fe option can be used to specify a file containing\n" + " * control method external declarations with the associated method\n" + " * argument counts. Each line of the file must be of the form:\n" + " * External (, MethodObj, )\n" " */\n", AcpiGbl_NumExternalMethods); } @@ -1279,10 +1285,15 @@ AcpiDmUnresolvedWarning ( AcpiOsPrintf (" /*\n" " * iASL Warning: There were %u external control methods found during\n" " * disassembly, but only %u %s resolved (%u unresolved). Additional\n" - " * ACPI tables are required to properly disassemble the code. This\n" + " * ACPI tables may be required to properly disassemble the code. This\n" " * resulting disassembler output file may not compile because the\n" " * disassembler did not know how many arguments to assign to the\n" " * unresolved methods.\n" + " *\n" + " * If necessary, the -fe option can be used to specify a file containing\n" + " * control method external declarations with the associated method\n" + " * argument counts. Each line of the file must be of the form:\n" + " * External (, MethodObj, )\n" " */\n", AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), @@ -1301,10 +1312,16 @@ AcpiDmUnresolvedWarning ( "were not specified. The resulting disassembler output file may not\n" "compile because the disassembler did not know how many arguments\n" "to assign to these methods. To specify the tables needed to resolve\n" - "external control method references, use the one of the following\n" - "example iASL invocations:\n" - " iasl -e -d \n" - " iasl -e -d \n", + "external control method references, the -e option can be used to\n" + "specify the filenames. Example iASL invocations:\n" + " iasl -e ssdt1.aml ssdt2.aml ssdt3.aml -d dsdt.aml\n" + " iasl -e dsdt.aml ssdt2.aml -d ssdt1.aml\n" + " iasl -e ssdt*.aml -d dsdt.aml\n" + "\n" + "In addition, the -fe option can be used to specify a file containing\n" + "control method external declarations with the associated method\n" + "argument counts. Each line of the file must be of the form:\n" + " External (, MethodObj, )\n", AcpiGbl_NumExternalMethods); } else if (AcpiGbl_NumExternalMethods != AcpiGbl_ResolvedExternalMethods) @@ -1314,10 +1331,15 @@ AcpiDmUnresolvedWarning ( fprintf (stderr, "\n" "iASL Warning: There were %u external control methods found during\n" "disassembly, but only %u %s resolved (%u unresolved). Additional\n" - "ACPI tables are required to properly disassemble the code. The\n" + "ACPI tables may be required to properly disassemble the code. The\n" "resulting disassembler output file may not compile because the\n" "disassembler did not know how many arguments to assign to the\n" - "unresolved methods.\n", + "unresolved methods.\n" + "\n" + "If necessary, the -fe option can be used to specify a file containing\n" + "control method external declarations with the associated method\n" + "argument counts. Each line of the file must be of the form:\n" + " External (, MethodObj, )\n", AcpiGbl_NumExternalMethods, AcpiGbl_ResolvedExternalMethods, (AcpiGbl_ResolvedExternalMethods > 1 ? "were" : "was"), (AcpiGbl_NumExternalMethods - AcpiGbl_ResolvedExternalMethods)); diff --git a/sys/contrib/dev/acpica/source/common/dmtbinfo.c b/sys/contrib/dev/acpica/source/common/dmtbinfo.c index b719c97d98..13c9a59662 100644 --- a/sys/contrib/dev/acpica/source/common/dmtbinfo.c +++ b/sys/contrib/dev/acpica/source/common/dmtbinfo.c @@ -1940,7 +1940,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = { {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type", 0}, - {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", 0}, + {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", DT_NON_ZERO}, /* Value must be 1 */ {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number", 0}, diff --git a/sys/contrib/dev/acpica/source/compiler/aslcompiler.h b/sys/contrib/dev/acpica/source/compiler/aslcompiler.h index 91f6fad686..526dfb88e5 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslcompiler.h +++ b/sys/contrib/dev/acpica/source/compiler/aslcompiler.h @@ -280,6 +280,10 @@ ApCheckRegMethod ( * aslerror - error handling/reporting */ void +AslAbort ( + void); + +void AslError ( UINT8 Level, UINT8 MessageId, @@ -703,10 +707,6 @@ TrLinkPeerNodes ( * aslfiles - File I/O support */ void -AslAbort ( - void); - -void FlAddIncludeDirectory ( char *Dir); diff --git a/sys/contrib/dev/acpica/source/compiler/aslerror.c b/sys/contrib/dev/acpica/source/compiler/aslerror.c index 77b167b5d7..a60f608f29 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslerror.c +++ b/sys/contrib/dev/acpica/source/compiler/aslerror.c @@ -54,6 +54,36 @@ AeAddToErrorLog ( ASL_ERROR_MSG *Enode); +/******************************************************************************* + * + * FUNCTION: AslAbort + * + * PARAMETERS: None + * + * RETURN: None + * + * DESCRIPTION: Dump the error log and abort the compiler. Used for serious + * I/O errors. + * + ******************************************************************************/ + +void +AslAbort ( + void) +{ + + AePrintErrorLog (ASL_FILE_STDERR); + if (Gbl_DebugFlag) + { + /* Print error summary to stdout also */ + + AePrintErrorLog (ASL_FILE_STDOUT); + } + + exit (1); +} + + /******************************************************************************* * * FUNCTION: AeClearErrorLog @@ -817,7 +847,8 @@ AslError ( /* Check if user wants to ignore this exception */ - if (AslIsExceptionDisabled (Level, MessageId)) + if (Gbl_AllExceptionsDisabled || + AslIsExceptionDisabled (Level, MessageId)) { return; } diff --git a/sys/contrib/dev/acpica/source/compiler/aslfileio.c b/sys/contrib/dev/acpica/source/compiler/aslfileio.c index 2485ec35f6..90072f1fff 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslfileio.c +++ b/sys/contrib/dev/acpica/source/compiler/aslfileio.c @@ -46,35 +46,9 @@ #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslfileio") - -/******************************************************************************* - * - * FUNCTION: AslAbort - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump the error log and abort the compiler. Used for serious - * I/O errors. - * - ******************************************************************************/ - -void -AslAbort ( - void) -{ - - AePrintErrorLog (ASL_FILE_STDERR); - if (Gbl_DebugFlag) - { - /* Print error summary to stdout also */ - - AePrintErrorLog (ASL_FILE_STDOUT); - } - - exit (1); -} +long +UtGetFileSize ( + FILE *fp); /******************************************************************************* @@ -139,6 +113,65 @@ FlOpenFile ( } +/******************************************************************************* + * + * FUNCTION: UtGetFileSize + * + * PARAMETERS: fp - Open file handle + * + * RETURN: File Size. -1 on error. + * + * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * TBD: This function should be used to replace other similar + * functions in ACPICA. + * + ******************************************************************************/ + +long +UtGetFileSize ( + FILE *fp) +{ + long FileSize; + long CurrentOffset; + + + CurrentOffset = ftell (fp); + if (CurrentOffset < 0) + { + goto OffsetError; + } + + if (fseek (fp, 0, SEEK_END)) + { + goto SeekError; + } + + FileSize = ftell (fp); + if (FileSize < 0) + { + goto OffsetError; + } + + /* Restore file pointer */ + + if (fseek (fp, CurrentOffset, SEEK_SET)) + { + goto SeekError; + } + + return (FileSize); + + +OffsetError: + perror ("Could not get file offset"); + return (-1); + +SeekError: + perror ("Could not seek file"); + return (-1); +} + + /******************************************************************************* * * FUNCTION: FlGetFileSize @@ -147,7 +180,8 @@ FlOpenFile ( * * RETURN: File Size * - * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open. + * DESCRIPTION: Get current file size. Uses common seek-to-EOF function. + * File must be open. Aborts compiler on error. * ******************************************************************************/ @@ -155,21 +189,16 @@ UINT32 FlGetFileSize ( UINT32 FileId) { - FILE *fp; - UINT32 FileSize; - long Offset; - + long FileSize; - fp = Gbl_Files[FileId].Handle; - Offset = ftell (fp); - fseek (fp, 0, SEEK_END); - FileSize = (UINT32) ftell (fp); - - /* Restore file pointer */ + FileSize = UtGetFileSize (Gbl_Files[FileId].Handle); + if (FileSize == -1) + { + AslAbort(); + } - fseek (fp, Offset, SEEK_SET); - return (FileSize); + return ((UINT32) FileSize); } diff --git a/sys/contrib/dev/acpica/source/compiler/aslglobal.h b/sys/contrib/dev/acpica/source/compiler/aslglobal.h index 20248548be..2707f4da8d 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslglobal.h +++ b/sys/contrib/dev/acpica/source/compiler/aslglobal.h @@ -159,7 +159,6 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_WarningsAsErrors, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); @@ -170,6 +169,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseOriginalCompilerId, ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DoTemplates, FALSE); ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileGeneric, FALSE); +ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AllExceptionsDisabled, FALSE); #define HEX_OUTPUT_NONE 0 diff --git a/sys/contrib/dev/acpica/source/compiler/aslmain.c b/sys/contrib/dev/acpica/source/compiler/aslmain.c index 20468e520b..6f81d21d2c 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslmain.c +++ b/sys/contrib/dev/acpica/source/compiler/aslmain.c @@ -158,7 +158,6 @@ Usage ( ACPI_OPTION ("", " (Obtain DSDT from current system if no input file)"); ACPI_OPTION ("-e ", "Include ACPI table(s) for external symbol resolution"); ACPI_OPTION ("-fe ", "Specify external symbol declaration file"); - ACPI_OPTION ("-g", "Get ACPI tables and write to files (*.dat)"); ACPI_OPTION ("-in", "Ignore NoOp opcodes"); ACPI_OPTION ("-vt", "Dump binary table data in hex format within output file"); @@ -319,16 +318,6 @@ main ( /* Perform global actions first/only */ - if (Gbl_GetAllTables) - { - Status = AslDoOneFile (NULL); - if (ACPI_FAILURE (Status)) - { - return (-1); - } - return (0); - } - if (Gbl_DisassembleAll) { while (argv[Index1]) diff --git a/sys/contrib/dev/acpica/source/compiler/aslmessages.h b/sys/contrib/dev/acpica/source/compiler/aslmessages.h index ae066e2e0a..a97766ce3b 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslmessages.h +++ b/sys/contrib/dev/acpica/source/compiler/aslmessages.h @@ -445,7 +445,7 @@ char *AslMessages [] = /* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", /* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", /* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents", -/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", +/* ASL_MSG_RESERVED_VALUE */ "Reserved field", /* ASL_MSG_UNKNOWN_LABEL */ "Label is undefined", /* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", /* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", diff --git a/sys/contrib/dev/acpica/source/compiler/asloptions.c b/sys/contrib/dev/acpica/source/compiler/asloptions.c index 296356583d..7d73d20c49 100644 --- a/sys/contrib/dev/acpica/source/compiler/asloptions.c +++ b/sys/contrib/dev/acpica/source/compiler/asloptions.c @@ -118,8 +118,7 @@ AslCommandLine ( /* Next parameter must be the input filename */ if (!argv[AcpiGbl_Optind] && - !Gbl_DisasmFlag && - !Gbl_GetAllTables) + !Gbl_DisasmFlag) { printf ("Missing input filename\n"); BadCommandLine = TRUE; @@ -318,9 +317,8 @@ AslDoOptions ( case 'g': /* Get all ACPI tables */ - Gbl_GetAllTables = TRUE; - Gbl_DoCompile = FALSE; - break; + printf ("-g option is deprecated, use acpidump utility instead\n"); + exit (1); case 'h': diff --git a/sys/contrib/dev/acpica/source/compiler/aslpredef.c b/sys/contrib/dev/acpica/source/compiler/aslpredef.c index bdede7b294..33f6be9d41 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslpredef.c +++ b/sys/contrib/dev/acpica/source/compiler/aslpredef.c @@ -251,10 +251,16 @@ ApCheckPredefinedReturnValue ( const ACPI_PREDEFINED_INFO *ThisName; - /* Check parent method for a match against the predefined name list */ - + /* + * Check parent method for a match against the predefined name list. + * + * Note: Disable compiler errors/warnings because any errors will be + * caught when analyzing the parent method. Eliminates duplicate errors. + */ + Gbl_AllExceptionsDisabled = TRUE; Index = ApCheckForPredefinedName (MethodInfo->Op, MethodInfo->Op->Asl.NameSeg); + Gbl_AllExceptionsDisabled = FALSE; switch (Index) { diff --git a/sys/contrib/dev/acpica/source/compiler/aslprepkg.c b/sys/contrib/dev/acpica/source/compiler/aslprepkg.c index 85c44befb8..c05d19016c 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslprepkg.c +++ b/sys/contrib/dev/acpica/source/compiler/aslprepkg.c @@ -169,7 +169,7 @@ ApCheckPackage ( { case ACPI_PTYPE1_FIXED: /* - * The package count is fixed and there are no sub-packages + * The package count is fixed and there are no subpackages * * If package is too small, exit. * If package is larger than expected, issue warning but continue @@ -194,7 +194,7 @@ ApCheckPackage ( case ACPI_PTYPE1_VAR: /* - * The package count is variable, there are no sub-packages, + * The package count is variable, there are no subpackages, * and all elements must be of the same type */ for (i = 0; i < Count; i++) @@ -207,7 +207,7 @@ ApCheckPackage ( case ACPI_PTYPE1_OPTION: /* - * The package count is variable, there are no sub-packages. + * The package count is variable, there are no subpackages. * There are a fixed number of required elements, and a variable * number of optional elements. * @@ -251,7 +251,7 @@ ApCheckPackage ( Op = Op->Asl.Next; Count--; - /* Examine the sub-packages */ + /* Examine the subpackages */ ApCheckPackageList (Predefined->Info.Name, Op, Package, 1, Count); @@ -259,7 +259,7 @@ ApCheckPackage ( case ACPI_PTYPE2_PKG_COUNT: - /* First element is the (Integer) count of sub-packages to follow */ + /* First element is the (Integer) count of subpackages to follow */ Status = ApCheckObjectType (Predefined->Info.Name, Op, ACPI_RTYPE_INTEGER, 0); @@ -283,7 +283,7 @@ ApCheckPackage ( Op = Op->Asl.Next; - /* Examine the sub-packages */ + /* Examine the subpackages */ ApCheckPackageList (Predefined->Info.Name, Op, Package, 1, Count); @@ -296,10 +296,10 @@ ApCheckPackage ( case ACPI_PTYPE2_FIX_VAR: /* * These types all return a single Package that consists of a - * variable number of sub-Packages. + * variable number of subpackages. */ - /* Examine the sub-packages */ + /* Examine the subpackages */ ApCheckPackageList (Predefined->Info.Name, Op, Package, 0, Count); @@ -494,7 +494,7 @@ ApCheckPackageList ( case ACPI_PTYPE2_FIXED: - /* Each sub-package has a fixed length */ + /* Each subpackage has a fixed length */ ExpectedCount = Package->RetInfo2.Count; if (Count < ExpectedCount) @@ -517,7 +517,7 @@ ApCheckPackageList ( case ACPI_PTYPE2_MIN: - /* Each sub-package has a variable but minimum length */ + /* Each subpackage has a variable but minimum length */ ExpectedCount = Package->RetInfo.Count1; if (Count < ExpectedCount) @@ -527,7 +527,7 @@ ApCheckPackageList ( break; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ ApCheckPackageElements (PredefinedName, Op, Package->RetInfo.ObjectType1, Count, 0, 0); @@ -576,7 +576,7 @@ ApCheckPackageList ( Count = ExpectedCount; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ Op = Op->Asl.Next; ApCheckPackageElements (PredefinedName, Op, diff --git a/sys/contrib/dev/acpica/source/compiler/aslstartup.c b/sys/contrib/dev/acpica/source/compiler/aslstartup.c index 995cadef2a..1ed69724d2 100644 --- a/sys/contrib/dev/acpica/source/compiler/aslstartup.c +++ b/sys/contrib/dev/acpica/source/compiler/aslstartup.c @@ -251,7 +251,7 @@ AslDoDisassembly ( AcpiGbl_DbOpt_disasm = TRUE; Status = AdAmlDisassemble (AslToFile, Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_GetAllTables); + &Gbl_Files[ASL_FILE_INPUT].Filename); if (ACPI_FAILURE (Status)) { return (Status); @@ -331,7 +331,7 @@ AslDoOneFile ( /* * AML Disassembly (Optional) */ - if (Gbl_DisasmFlag || Gbl_GetAllTables) + if (Gbl_DisasmFlag) { Status = AslDoDisassembly (); if (Status != AE_CTRL_CONTINUE) diff --git a/sys/contrib/dev/acpica/source/compiler/asltransform.c b/sys/contrib/dev/acpica/source/compiler/asltransform.c index b22e4e1d3a..9615fe6c6e 100644 --- a/sys/contrib/dev/acpica/source/compiler/asltransform.c +++ b/sys/contrib/dev/acpica/source/compiler/asltransform.c @@ -450,10 +450,6 @@ TrDoSwitch ( { /* Add an ELSE to complete the previous CASE */ - if (!Conditional) - { - return; - } NewOp = TrCreateLeafNode (PARSEOP_ELSE); NewOp->Asl.Parent = Conditional->Asl.Parent; TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent); @@ -620,11 +616,6 @@ TrDoSwitch ( { /* Convert the DEFAULT node to an ELSE */ - if (!Conditional) - { - return; - } - TrAmlInitNode (DefaultOp, PARSEOP_ELSE); DefaultOp->Asl.Parent = Conditional->Asl.Parent; diff --git a/sys/contrib/dev/acpica/source/compiler/dtfield.c b/sys/contrib/dev/acpica/source/compiler/dtfield.c index 14e7485116..ff77242127 100644 --- a/sys/contrib/dev/acpica/source/compiler/dtfield.c +++ b/sys/contrib/dev/acpica/source/compiler/dtfield.c @@ -311,21 +311,37 @@ DtCompileInteger ( return; } - /* Ensure that reserved fields are set to zero */ - /* TBD: should we set to zero, or just make this an ERROR? */ - /* TBD: Probably better to use a flag */ + /* + * Ensure that reserved fields are set properly. Note: uses + * the DT_NON_ZERO flag to indicate that the reserved value + * must be exactly one. Otherwise, the value must be zero. + * This is sufficient for now. + */ + + /* TBD: Should use a flag rather than compare "Reserved" */ - if (!ACPI_STRCMP (Field->Name, "Reserved") && - (Value != 0)) + if (!ACPI_STRCMP (Field->Name, "Reserved")) { - DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field, - "Setting to zero"); - Value = 0; + if (Flags & DT_NON_ZERO) + { + if (Value != 1) + { + DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field, + "Must be one, setting to one"); + Value = 1; + } + } + else if (Value != 0) + { + DtError (ASL_WARNING, ASL_MSG_RESERVED_VALUE, Field, + "Must be zero, setting to zero"); + Value = 0; + } } /* Check if the value must be non-zero */ - if ((Value == 0) && (Flags & DT_NON_ZERO)) + else if ((Flags & DT_NON_ZERO) && (Value == 0)) { DtError (ASL_ERROR, ASL_MSG_ZERO_VALUE, Field, NULL); } diff --git a/sys/contrib/dev/acpica/source/compiler/dttemplate.h b/sys/contrib/dev/acpica/source/compiler/dttemplate.h index 990d919448..84da13a131 100644 --- a/sys/contrib/dev/acpica/source/compiler/dttemplate.h +++ b/sys/contrib/dev/acpica/source/compiler/dttemplate.h @@ -897,10 +897,10 @@ const unsigned char TemplateSpcr[] = const unsigned char TemplateSpmi[] = { 0x53,0x50,0x4D,0x49,0x41,0x00,0x00,0x00, /* 00000000 "SPMIA..." */ - 0x04,0xED,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ + 0x04,0x00,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */ 0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */ 0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x28,0x05,0x10,0x20,0x00,0x00,0x00,0x00, /* 00000020 "(.. ...." */ + 0x14,0x01,0x14,0x20,0x00,0x01,0x00,0x00, /* 00000020 "... ...." */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "........" */ 0x00,0x08,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000030 "........" */ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */ diff --git a/sys/contrib/dev/acpica/source/compiler/prmacros.c b/sys/contrib/dev/acpica/source/compiler/prmacros.c index 7c5f731e14..63bde607cf 100644 --- a/sys/contrib/dev/acpica/source/compiler/prmacros.c +++ b/sys/contrib/dev/acpica/source/compiler/prmacros.c @@ -360,7 +360,7 @@ PrAddMacro ( if (ArgCount >= PR_MAX_MACRO_ARGS) { PrError (ASL_ERROR, ASL_MSG_TOO_MANY_ARGUMENTS, TokenOffset); - return; + goto ErrorExit; } } @@ -400,7 +400,7 @@ PrAddMacro ( PrError (ASL_ERROR, ASL_MSG_TOO_MANY_ARGUMENTS, THIS_TOKEN_OFFSET (Token)); - return; + goto ErrorExit; } break; } @@ -432,7 +432,7 @@ AddMacroToList: THIS_TOKEN_OFFSET (Name)); } - return; + goto ErrorExit; } DbgPrint (ASL_DEBUG_OUTPUT, PR_PREFIX_ID @@ -451,6 +451,13 @@ AddMacroToList: DefineInfo->Args = Args; DefineInfo->ArgCount = ArgCount; } + + return; + + +ErrorExit: + ACPI_FREE (Args); + return; } diff --git a/sys/contrib/dev/acpica/source/components/debugger/dbdisply.c b/sys/contrib/dev/acpica/source/components/debugger/dbdisply.c index e913b3db32..fb47c7ba63 100644 --- a/sys/contrib/dev/acpica/source/components/debugger/dbdisply.c +++ b/sys/contrib/dev/acpica/source/components/debugger/dbdisply.c @@ -303,6 +303,10 @@ AcpiDbDecodeAndDisplayObject ( /* Is not a recognizeable object */ + AcpiOsPrintf ( + "Not a known ACPI internal object, descriptor type %2.2X\n", + ACPI_GET_DESCRIPTOR_TYPE (ObjPtr)); + Size = 16; if (AcpiOsReadable (ObjPtr, 64)) { diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dsinit.c b/sys/contrib/dev/acpica/source/components/dispatcher/dsinit.c index 47a42bc98f..3e7977d72c 100644 --- a/sys/contrib/dev/acpica/source/components/dispatcher/dsinit.c +++ b/sys/contrib/dev/acpica/source/components/dispatcher/dsinit.c @@ -52,6 +52,7 @@ #define _COMPONENT ACPI_DISPATCHER ACPI_MODULE_NAME ("dsinit") + /* Local prototypes */ static ACPI_STATUS @@ -91,8 +92,8 @@ AcpiDsInitOneObject ( { ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context; ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_OBJECT_TYPE Type; ACPI_STATUS Status; + ACPI_OPERAND_OBJECT *ObjDesc; ACPI_FUNCTION_ENTRY (); @@ -111,9 +112,7 @@ AcpiDsInitOneObject ( /* And even then, we are only interested in a few object types */ - Type = AcpiNsGetType (ObjHandle); - - switch (Type) + switch (AcpiNsGetType (ObjHandle)) { case ACPI_TYPE_REGION: @@ -129,8 +128,45 @@ AcpiDsInitOneObject ( break; case ACPI_TYPE_METHOD: - + /* + * Auto-serialization support. We will examine each method that is + * NotSerialized to determine if it creates any Named objects. If + * it does, it will be marked serialized to prevent problems if + * the method is entered by two or more threads and an attempt is + * made to create the same named object twice -- which results in + * an AE_ALREADY_EXISTS exception and method abort. + */ Info->MethodCount++; + ObjDesc = AcpiNsGetAttachedObject (Node); + if (!ObjDesc) + { + break; + } + + /* Ignore if already serialized */ + + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) + { + Info->SerialMethodCount++; + break; + } + + if (AcpiGbl_AutoSerializeMethods) + { + /* Parse/scan method and serialize it if necessary */ + + AcpiDsAutoSerializeMethod (Node, ObjDesc); + if (ObjDesc->Method.InfoFlags & ACPI_METHOD_SERIALIZED) + { + /* Method was just converted to Serialized */ + + Info->SerialMethodCount++; + Info->SerializedMethodCount++; + break; + } + } + + Info->NonSerialMethodCount++; break; case ACPI_TYPE_DEVICE: @@ -187,7 +223,6 @@ AcpiDsInitializeObjects ( ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "**** Starting initialization of namespace objects ****\n")); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:")); /* Set all init info to zero */ @@ -223,12 +258,14 @@ AcpiDsInitializeObjects ( } ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, - "\nTable [%4.4s](id %4.4X) - %u Objects with %u Devices %u Methods %u Regions\n", - Table->Signature, OwnerId, Info.ObjectCount, - Info.DeviceCount, Info.MethodCount, Info.OpRegionCount)); - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Methods, %u Regions\n", Info.MethodCount, Info.OpRegionCount)); + "Table [%4.4s] (id %4.4X) - %4u Objects with %3u Devices, " + "%3u Regions, %3u Methods (%u/%u/%u Serial/Non/Cvt)\n", + Table->Signature, OwnerId, Info.ObjectCount, Info.DeviceCount, + Info.OpRegionCount, Info.MethodCount, Info.SerialMethodCount, + Info.NonSerialMethodCount, Info.SerializedMethodCount)); + + ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "%u Methods, %u Regions\n", + Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c b/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c index 3fb2135fa8..5cefb4fbb6 100644 --- a/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c +++ b/sys/contrib/dev/acpica/source/components/dispatcher/dsmethod.c @@ -49,6 +49,8 @@ #include "acinterp.h" #include "acnamesp.h" #include "acdisasm.h" +#include "acparser.h" +#include "amlcode.h" #define _COMPONENT ACPI_DISPATCHER @@ -56,11 +58,148 @@ /* Local prototypes */ +static ACPI_STATUS +AcpiDsDetectNamedOpcodes ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp); + static ACPI_STATUS AcpiDsCreateMethodMutex ( ACPI_OPERAND_OBJECT *MethodDesc); +/******************************************************************************* + * + * FUNCTION: AcpiDsAutoSerializeMethod + * + * PARAMETERS: Node - Namespace Node of the method + * ObjDesc - Method object attached to node + * + * RETURN: Status + * + * DESCRIPTION: Parse a control method AML to scan for control methods that + * need serialization due to the creation of named objects. + * + * NOTE: It is a bit of overkill to mark all such methods serialized, since + * there is only a problem if the method actually blocks during execution. + * A blocking operation is, for example, a Sleep() operation, or any access + * to an operation region. However, it is probably not possible to easily + * detect whether a method will block or not, so we simply mark all suspicious + * methods as serialized. + * + * NOTE2: This code is essentially a generic routine for parsing a single + * control method. + * + ******************************************************************************/ + +ACPI_STATUS +AcpiDsAutoSerializeMethod ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *ObjDesc) +{ + ACPI_STATUS Status; + ACPI_PARSE_OBJECT *Op = NULL; + ACPI_WALK_STATE *WalkState; + + + ACPI_FUNCTION_TRACE_PTR (DsAutoSerializeMethod, Node); + + + ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, + "Method auto-serialization parse [%4.4s] %p\n", + AcpiUtGetNodeName (Node), Node)); + + /* Create/Init a root op for the method parse tree */ + + Op = AcpiPsAllocOp (AML_METHOD_OP); + if (!Op) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + AcpiPsSetName (Op, Node->Name.Integer); + Op->Common.Node = Node; + + /* Create and initialize a new walk state */ + + WalkState = AcpiDsCreateWalkState (Node->OwnerId, NULL, NULL, NULL); + if (!WalkState) + { + return_ACPI_STATUS (AE_NO_MEMORY); + } + + Status = AcpiDsInitAmlWalk (WalkState, Op, Node, ObjDesc->Method.AmlStart, + ObjDesc->Method.AmlLength, NULL, 0); + if (ACPI_FAILURE (Status)) + { + AcpiDsDeleteWalkState (WalkState); + return_ACPI_STATUS (Status); + } + + WalkState->DescendingCallback = AcpiDsDetectNamedOpcodes; + + /* Parse the method, scan for creation of named objects */ + + Status = AcpiPsParseAml (WalkState); + if (ACPI_FAILURE (Status)) + { + return_ACPI_STATUS (Status); + } + + AcpiPsDeleteParseTree (Op); + return_ACPI_STATUS (Status); +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDsDetectNamedOpcodes + * + * PARAMETERS: WalkState - Current state of the parse tree walk + * OutOp - Unused, required for parser interface + * + * RETURN: Status + * + * DESCRIPTION: Descending callback used during the loading of ACPI tables. + * Currently used to detect methods that must be marked serialized + * in order to avoid problems with the creation of named objects. + * + ******************************************************************************/ + +static ACPI_STATUS +AcpiDsDetectNamedOpcodes ( + ACPI_WALK_STATE *WalkState, + ACPI_PARSE_OBJECT **OutOp) +{ + + ACPI_FUNCTION_NAME (AcpiDsDetectNamedOpcodes); + + + /* We are only interested in opcodes that create a new name */ + + if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_CREATE | AML_FIELD))) + { + return (AE_OK); + } + + /* + * At this point, we know we have a Named object opcode. + * Mark the method as serialized. Later code will create a mutex for + * this method to enforce serialization. + */ + WalkState->MethodDesc->Method.InfoFlags |= ACPI_METHOD_SERIALIZED; + + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, + "Method serialized [%4.4s] %p - [%s] (%4.4X)\n", + WalkState->MethodNode->Name.Ascii, WalkState->MethodNode, + WalkState->OpInfo->Name, WalkState->Opcode)); + + /* Abort the parse, no need to examine this method any further */ + + return (AE_CTRL_TERMINATE); +} + + /******************************************************************************* * * FUNCTION: AcpiDsMethodError diff --git a/sys/contrib/dev/acpica/source/components/dispatcher/dswload.c b/sys/contrib/dev/acpica/source/components/dispatcher/dswload.c index d9bb12d536..0cafecd65c 100644 --- a/sys/contrib/dev/acpica/source/components/dispatcher/dswload.c +++ b/sys/contrib/dev/acpica/source/components/dispatcher/dswload.c @@ -80,8 +80,21 @@ AcpiDsInitCallbacks ( switch (PassNumber) { + case 0: + + /* Parse only - caller will setup callbacks */ + + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | + ACPI_PARSE_DELETE_TREE | + ACPI_PARSE_DISASSEMBLE; + WalkState->DescendingCallback = NULL; + WalkState->AscendingCallback = NULL; + break; + case 1: + /* Load pass 1 */ + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; WalkState->DescendingCallback = AcpiDsLoad1BeginOp; @@ -90,6 +103,8 @@ AcpiDsInitCallbacks ( case 2: + /* Load pass 2 */ + WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE; WalkState->DescendingCallback = AcpiDsLoad2BeginOp; @@ -98,6 +113,8 @@ AcpiDsInitCallbacks ( case 3: + /* Execution pass */ + #ifndef ACPI_NO_METHOD_EXECUTION WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE; diff --git a/sys/contrib/dev/acpica/source/components/events/evregion.c b/sys/contrib/dev/acpica/source/components/events/evregion.c index ce900cac88..4b5cb9b1dd 100644 --- a/sys/contrib/dev/acpica/source/components/events/evregion.c +++ b/sys/contrib/dev/acpica/source/components/events/evregion.c @@ -333,6 +333,7 @@ AcpiEvDetachRegion( { ACPI_OPERAND_OBJECT *HandlerObj; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; ACPI_ADR_SPACE_SETUP RegionSetup; void **RegionContext; @@ -363,6 +364,7 @@ AcpiEvDetachRegion( /* Find this region in the handler's list */ ObjDesc = HandlerObj->AddressSpace.RegionList; + StartDesc = ObjDesc; LastObjPtr = &HandlerObj->AddressSpace.RegionList; while (ObjDesc) @@ -457,6 +459,16 @@ AcpiEvDetachRegion( LastObjPtr = &ObjDesc->Region.Next; ObjDesc = ObjDesc->Region.Next; + + /* Prevent infinite loop if list is corrupted */ + + if (ObjDesc == StartDesc) + { + ACPI_ERROR ((AE_INFO, + "Circular handler list in region object %p", + RegionObj)); + return_VOID; + } } /* If we get here, the region was not in the handler's region list */ diff --git a/sys/contrib/dev/acpica/source/components/executer/exdump.c b/sys/contrib/dev/acpica/source/components/executer/exdump.c index 4bc104dc4c..ac92f90c47 100644 --- a/sys/contrib/dev/acpica/source/components/executer/exdump.c +++ b/sys/contrib/dev/acpica/source/components/executer/exdump.c @@ -114,13 +114,14 @@ static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] = {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"}, {ACPI_EXD_BUFFER, 0, NULL} }; -static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] = +static ACPI_EXDUMP_INFO AcpiExDumpPackage[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Package.Node), "Parent Node"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"}, @@ -130,9 +131,9 @@ static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] = static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.NotifyList[1]), "Device Notify"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Device.Handler), "Handler"} }; static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] = @@ -163,24 +164,26 @@ static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"} }; -static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] = +static ACPI_EXDUMP_INFO AcpiExDumpRegion[8] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Region.Node), "Parent Node"}, {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (Region.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"} }; -static ACPI_EXDUMP_INFO AcpiExDumpPower[5] = +static ACPI_EXDUMP_INFO AcpiExDumpPower[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[0]), "System Notify"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"} + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.NotifyList[1]), "Device Notify"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.Handler), "Handler"} }; static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] = @@ -243,7 +246,7 @@ static ACPI_EXDUMP_INFO AcpiExDumpReference[8] = {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Value), "Value"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Reference.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"}, {ACPI_EXD_REFERENCE,0, NULL} }; @@ -252,16 +255,16 @@ static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, + {ACPI_EXD_HDLR_LIST,ACPI_EXD_OFFSET (AddressSpace.Next), "Next"}, + {ACPI_EXD_RGN_LIST, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"} }; static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Notify.Node), "Node"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Notify.HandlerType), "Handler Type"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Handler), "Handler"}, {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}, @@ -269,15 +272,32 @@ static ACPI_EXDUMP_INFO AcpiExDumpNotify[7] = {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Next[1]), "Next Device Notify"} }; +static ACPI_EXDUMP_INFO AcpiExDumpExtra[6] = +{ + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpExtra), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.Method_REG), "_REG Method"}, + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (Extra.ScopeNode), "Scope Node"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.RegionContext), "Region Context"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Extra.AmlStart), "Aml Start"}, + {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Extra.AmlLength), "Aml Length"} +}; + +static ACPI_EXDUMP_INFO AcpiExDumpData[3] = +{ + {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpData), NULL}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Handler), "Handler"}, + {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Data.Pointer), "Raw Data"} +}; /* Miscellaneous tables */ -static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] = +static ACPI_EXDUMP_INFO AcpiExDumpCommon[5] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL}, {ACPI_EXD_TYPE , 0, NULL}, {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"}, - {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"} + {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}, + {ACPI_EXD_LIST, ACPI_EXD_OFFSET (Common.NextObject), "Object List"} }; static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = @@ -288,16 +308,18 @@ static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] = {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"}, {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"}, {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"}, - {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} + {ACPI_EXD_NODE, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"} }; -static ACPI_EXDUMP_INFO AcpiExDumpNode[5] = +static ACPI_EXDUMP_INFO AcpiExDumpNode[7] = { {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"}, {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"}, - {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"} + {ACPI_EXD_LIST, ACPI_EXD_NSOFFSET (Object), "Object List"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Parent), "Parent"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Child), "Child"}, + {ACPI_EXD_NODE, ACPI_EXD_NSOFFSET (Peer), "Peer"} }; @@ -332,7 +354,9 @@ static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] = AcpiExDumpAddressHandler, NULL, NULL, - NULL + NULL, + AcpiExDumpExtra, + AcpiExDumpData }; @@ -359,6 +383,10 @@ AcpiExDumpObject ( char *Name; const char *ReferenceName; UINT8 Count; + ACPI_OPERAND_OBJECT *Start; + ACPI_OPERAND_OBJECT *Data = NULL; + ACPI_OPERAND_OBJECT *Next; + ACPI_NAMESPACE_NODE *Node; if (!Info) @@ -386,7 +414,8 @@ AcpiExDumpObject ( case ACPI_EXD_TYPE: - AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc)); + AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", + ObjDesc->Common.Type, AcpiUtGetObjectTypeName (ObjDesc)); break; case ACPI_EXD_UINT8: @@ -447,6 +476,120 @@ AcpiExDumpObject ( AcpiExDumpReferenceObj (ObjDesc); break; + case ACPI_EXD_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->Common.NextObject) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->Common.NextObject; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Object list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n", Next); + break; + + case ACPI_EXD_HDLR_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->AddressSpace.Next) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->AddressSpace.Next; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Handler list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n", Next); + break; + + case ACPI_EXD_RGN_LIST: + + Start = *ACPI_CAST_PTR (void *, Target); + Next = Start; + + AcpiOsPrintf ("%20s : %p", Name, Next); + if (Next) + { + AcpiOsPrintf ("(%s %2.2X)", + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + while (Next->Region.Next) + { + if ((Next->Common.Type == ACPI_TYPE_LOCAL_DATA) && + !Data) + { + Data = Next; + } + + Next = Next->Region.Next; + AcpiOsPrintf ("->%p(%s %2.2X)", Next, + AcpiUtGetObjectTypeName (Next), Next->Common.Type); + + if ((Next == Start) || (Next == Data)) + { + AcpiOsPrintf ("\n**** Error: Region list appears to be circular linked"); + break; + } + } + } + + AcpiOsPrintf ("\n", Next); + break; + + case ACPI_EXD_NODE: + + Node = *ACPI_CAST_PTR (ACPI_NAMESPACE_NODE *, Target); + + AcpiOsPrintf ("%20s : %p", Name, Node); + if (Node) + { + AcpiOsPrintf (" [%4.4s]", Node->Name.Ascii); + } + AcpiOsPrintf ("\n"); + break; + default: AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", @@ -864,9 +1007,8 @@ AcpiExDumpNamespaceNode ( } AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node)); - AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type)); - AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node)); - AcpiExOutPointer ("Parent", Node->Parent); + AcpiOsPrintf ("%20s : %2.2X [%s]\n", "Type", + Node->Type, AcpiUtGetTypeName (Node->Type)); AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node), AcpiExDumpNode); @@ -1074,24 +1216,30 @@ AcpiExDumpObjectDescriptor ( AcpiOsPrintf ("\nAttached Object (%p):\n", ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object); - AcpiExDumpObjectDescriptor ( - ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags); - return_VOID; + ObjDesc = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object; + goto DumpObject; } if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) { AcpiOsPrintf ( - "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n", + "%p is not an ACPI operand object: [%s]\n", ObjDesc, AcpiUtGetDescriptorName (ObjDesc)); return_VOID; } - if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX) + /* Validate the object type */ + + if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) { + AcpiOsPrintf ("Not a known object type: %2.2X\n", + ObjDesc->Common.Type); return_VOID; } + +DumpObject: + /* Common Fields */ AcpiExDumpObject (ObjDesc, AcpiExDumpCommon); @@ -1099,6 +1247,22 @@ AcpiExDumpObjectDescriptor ( /* Object-specific fields */ AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); + + if (ObjDesc->Common.Type == ACPI_TYPE_REGION) + { + ObjDesc = ObjDesc->Common.NextObject; + if (ObjDesc->Common.Type > ACPI_TYPE_LOCAL_MAX) + { + AcpiOsPrintf ("Secondary object is not a known object type: %2.2X\n", + ObjDesc->Common.Type); + + return_VOID; + } + + AcpiOsPrintf ("\nExtra attached Object (%p):\n", ObjDesc); + AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]); + } + return_VOID; } diff --git a/sys/contrib/dev/acpica/source/components/executer/exsystem.c b/sys/contrib/dev/acpica/source/components/executer/exsystem.c index a5c1d40c90..09a470eced 100644 --- a/sys/contrib/dev/acpica/source/components/executer/exsystem.c +++ b/sys/contrib/dev/acpica/source/components/executer/exsystem.c @@ -87,7 +87,7 @@ AcpiExSystemWaitSemaphore ( { /* We must wait, so unlock the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout); @@ -97,7 +97,7 @@ AcpiExSystemWaitSemaphore ( /* Reacquire the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); @@ -140,7 +140,7 @@ AcpiExSystemWaitMutex ( { /* We must wait, so unlock the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); Status = AcpiOsAcquireMutex (Mutex, Timeout); @@ -150,7 +150,7 @@ AcpiExSystemWaitMutex ( /* Reacquire the interpreter */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); } return_ACPI_STATUS (Status); @@ -227,7 +227,7 @@ AcpiExSystemDoSleep ( /* Since this thread will sleep, we must release the interpreter */ - AcpiExRelinquishInterpreter (); + AcpiExExitInterpreter (); /* * For compatibility with other ACPI implementations and to prevent @@ -242,7 +242,7 @@ AcpiExSystemDoSleep ( /* And now we must get the interpreter again */ - AcpiExReacquireInterpreter (); + AcpiExEnterInterpreter (); return (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/components/executer/exutils.c b/sys/contrib/dev/acpica/source/components/executer/exutils.c index a3a918b739..dcc889d221 100644 --- a/sys/contrib/dev/acpica/source/components/executer/exutils.c +++ b/sys/contrib/dev/acpica/source/components/executer/exutils.c @@ -110,42 +110,6 @@ AcpiExEnterInterpreter ( } -/******************************************************************************* - * - * FUNCTION: AcpiExReacquireInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Reacquire the interpreter execution region from within the - * interpreter code. Failure to enter the interpreter region is a - * fatal system error. Used in conjunction with - * RelinquishInterpreter - * - ******************************************************************************/ - -void -AcpiExReacquireInterpreter ( - void) -{ - ACPI_FUNCTION_TRACE (ExReacquireInterpreter); - - - /* - * If the global serialized flag is set, do not release the interpreter, - * since it was not actually released by AcpiExRelinquishInterpreter. - * This forces the interpreter to be single threaded. - */ - if (!AcpiGbl_AllMethodsSerialized) - { - AcpiExEnterInterpreter (); - } - - return_VOID; -} - - /******************************************************************************* * * FUNCTION: AcpiExExitInterpreter @@ -156,7 +120,16 @@ AcpiExReacquireInterpreter ( * * DESCRIPTION: Exit the interpreter execution region. This is the top level * routine used to exit the interpreter when all processing has - * been completed. + * been completed, or when the method blocks. + * + * Cases where the interpreter is unlocked internally: + * 1) Method will be blocked on a Sleep() AML opcode + * 2) Method will be blocked on an Acquire() AML opcode + * 3) Method will be blocked on a Wait() AML opcode + * 4) Method will be blocked to acquire the global lock + * 5) Method will be blocked waiting to execute a serialized control + * method that is currently executing + * 6) About to invoke a user-installed opregion handler * ******************************************************************************/ @@ -180,49 +153,6 @@ AcpiExExitInterpreter ( } -/******************************************************************************* - * - * FUNCTION: AcpiExRelinquishInterpreter - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Exit the interpreter execution region, from within the - * interpreter - before attempting an operation that will possibly - * block the running thread. - * - * Cases where the interpreter is unlocked internally - * 1) Method to be blocked on a Sleep() AML opcode - * 2) Method to be blocked on an Acquire() AML opcode - * 3) Method to be blocked on a Wait() AML opcode - * 4) Method to be blocked to acquire the global lock - * 5) Method to be blocked waiting to execute a serialized control method - * that is currently executing - * 6) About to invoke a user-installed opregion handler - * - ******************************************************************************/ - -void -AcpiExRelinquishInterpreter ( - void) -{ - ACPI_FUNCTION_TRACE (ExRelinquishInterpreter); - - - /* - * If the global serialized flag is set, do not release the interpreter. - * This forces the interpreter to be single threaded. - */ - if (!AcpiGbl_AllMethodsSerialized) - { - AcpiExExitInterpreter (); - } - - return_VOID; -} - - /******************************************************************************* * * FUNCTION: AcpiExTruncateFor32bitTable diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsinit.c b/sys/contrib/dev/acpica/source/components/namespace/nsinit.c index c60b8eff0c..27ff7a1324 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsinit.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsinit.c @@ -129,9 +129,8 @@ AcpiNsInitializeObjects ( Info.PackageInit, Info.PackageCount, Info.ObjectCount)); ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Control Methods found\n", Info.MethodCount)); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%u Op Regions found\n", Info.OpRegionCount)); + "%u Control Methods found\n%u Op Regions found\n", + Info.MethodCount, Info.OpRegionCount)); return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsload.c b/sys/contrib/dev/acpica/source/components/namespace/nsload.c index 982e5a3387..e769c2013e 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsload.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsload.c @@ -148,12 +148,12 @@ Unlock: * parse trees. */ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Begin Table Method Parsing and Object Initialization\n")); + "**** Begin Table Object Initialization\n")); Status = AcpiDsInitializeObjects (TableIndex, Node); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "**** Completed Table Method Parsing and Object Initialization\n")); + "**** Completed Table Object Initialization\n")); return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsobject.c b/sys/contrib/dev/acpica/source/components/namespace/nsobject.c index a26ccc6da8..3317591742 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsobject.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsobject.c @@ -247,14 +247,19 @@ AcpiNsDetachObject ( } } - /* Clear the entry in all cases */ + /* Clear the Node entry in all cases */ Node->Object = NULL; if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND) { + /* Unlink object from front of possible object list */ + Node->Object = ObjDesc->Common.NextObject; + + /* Handle possible 2-descriptor object */ + if (Node->Object && - ((Node->Object)->Common.Type != ACPI_TYPE_LOCAL_DATA)) + (Node->Object->Common.Type != ACPI_TYPE_LOCAL_DATA)) { Node->Object = Node->Object->Common.NextObject; } diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsprepkg.c b/sys/contrib/dev/acpica/source/components/namespace/nsprepkg.c index acf773042a..1e66b5aee2 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsprepkg.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsprepkg.c @@ -144,13 +144,13 @@ AcpiNsCheckPackage ( * Decode the type of the expected package contents * * PTYPE1 packages contain no subpackages - * PTYPE2 packages contain sub-packages + * PTYPE2 packages contain subpackages */ switch (Package->RetInfo.Type) { case ACPI_PTYPE1_FIXED: /* - * The package count is fixed and there are no sub-packages + * The package count is fixed and there are no subpackages * * If package is too small, exit. * If package is larger than expected, issue warning but continue @@ -177,7 +177,7 @@ AcpiNsCheckPackage ( case ACPI_PTYPE1_VAR: /* - * The package count is variable, there are no sub-packages, and all + * The package count is variable, there are no subpackages, and all * elements must be of the same type */ for (i = 0; i < Count; i++) @@ -194,7 +194,7 @@ AcpiNsCheckPackage ( case ACPI_PTYPE1_OPTION: /* - * The package count is variable, there are no sub-packages. There are + * The package count is variable, there are no subpackages. There are * a fixed number of required elements, and a variable number of * optional elements. * @@ -250,14 +250,14 @@ AcpiNsCheckPackage ( Elements++; Count--; - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; case ACPI_PTYPE2_PKG_COUNT: - /* First element is the (Integer) count of sub-packages to follow */ + /* First element is the (Integer) count of subpackages to follow */ Status = AcpiNsCheckObjectType (Info, Elements, ACPI_RTYPE_INTEGER, 0); @@ -279,7 +279,7 @@ AcpiNsCheckPackage ( Count = ExpectedCount; Elements++; - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -291,9 +291,9 @@ AcpiNsCheckPackage ( case ACPI_PTYPE2_FIX_VAR: /* * These types all return a single Package that consists of a - * variable number of sub-Packages. + * variable number of subpackages. * - * First, ensure that the first element is a sub-Package. If not, + * First, ensure that the first element is a subpackage. If not, * the BIOS may have incorrectly returned the object as a single * package instead of a Package of Packages (a common error if * there is only one entry). We may be able to repair this by @@ -316,7 +316,7 @@ AcpiNsCheckPackage ( Count = 1; } - /* Examine the sub-packages */ + /* Examine the subpackages */ Status = AcpiNsCheckPackageList (Info, Package, Elements, Count); break; @@ -379,9 +379,9 @@ AcpiNsCheckPackageList ( /* - * Validate each sub-Package in the parent Package + * Validate each subpackage in the parent Package * - * NOTE: assumes list of sub-packages contains no NULL elements. + * NOTE: assumes list of subpackages contains no NULL elements. * Any NULL elements should have been removed by earlier call * to AcpiNsRemoveNullElements. */ @@ -400,7 +400,7 @@ AcpiNsCheckPackageList ( return (Status); } - /* Examine the different types of expected sub-packages */ + /* Examine the different types of expected subpackages */ Info->ParentPackage = SubPackage; switch (Package->RetInfo.Type) @@ -452,7 +452,7 @@ AcpiNsCheckPackageList ( case ACPI_PTYPE2_FIXED: - /* Each sub-package has a fixed length */ + /* Each subpackage has a fixed length */ ExpectedCount = Package->RetInfo2.Count; if (SubPackage->Package.Count < ExpectedCount) @@ -460,7 +460,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ for (j = 0; j < ExpectedCount; j++) { @@ -475,7 +475,7 @@ AcpiNsCheckPackageList ( case ACPI_PTYPE2_MIN: - /* Each sub-package has a variable but minimum length */ + /* Each subpackage has a variable but minimum length */ ExpectedCount = Package->RetInfo.Count1; if (SubPackage->Package.Count < ExpectedCount) @@ -483,7 +483,7 @@ AcpiNsCheckPackageList ( goto PackageTooSmall; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ Status = AcpiNsCheckPackageElements (Info, SubElements, Package->RetInfo.ObjectType1, @@ -532,7 +532,7 @@ AcpiNsCheckPackageList ( (*SubElements)->Integer.Value = ExpectedCount; } - /* Check the type of each sub-package element */ + /* Check the type of each subpackage element */ Status = AcpiNsCheckPackageElements (Info, (SubElements + 1), Package->RetInfo.ObjectType1, @@ -556,10 +556,10 @@ AcpiNsCheckPackageList ( PackageTooSmall: - /* The sub-package count was smaller than required */ + /* The subpackage count was smaller than required */ ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, - "Return Sub-Package[%u] is too small - found %u elements, expected %u", + "Return SubPackage[%u] is too small - found %u elements, expected %u", i, SubPackage->Package.Count, ExpectedCount)); return (AE_AML_OPERAND_VALUE); diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsrepair.c b/sys/contrib/dev/acpica/source/components/namespace/nsrepair.c index 282c75e313..3b659a91c7 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsrepair.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsrepair.c @@ -212,14 +212,29 @@ AcpiNsSimpleRepair ( * this predefined name. Either one return value is expected, or none, * for both methods and other objects. * - * Exit now if there is no return object. Warning if one was expected. + * Try to fix if there was no return object. Warning if failed to fix. */ if (!ReturnObject) { if (ExpectedBtypes && (!(ExpectedBtypes & ACPI_RTYPE_NONE))) { - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, - ACPI_WARN_ALWAYS, "Missing expected return value")); + if (PackageIndex != ACPI_NOT_PACKAGE_ELEMENT) + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + ACPI_WARN_ALWAYS, "Found unexpected NULL package element")); + + Status = AcpiNsRepairNullElement (Info, ExpectedBtypes, + PackageIndex, ReturnObjectPtr); + if (ACPI_SUCCESS (Status)) + { + return (AE_OK); /* Repair was successful */ + } + } + else + { + ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, + ACPI_WARN_ALWAYS, "Missing expected return value")); + } return (AE_AML_NO_RETURN_VALUE); } @@ -474,7 +489,7 @@ AcpiNsRepairNullElement ( * RETURN: None. * * DESCRIPTION: Remove all NULL package elements from packages that contain - * a variable number of sub-packages. For these types of + * a variable number of subpackages. For these types of * packages, NULL elements can be safely removed. * *****************************************************************************/ @@ -498,7 +513,7 @@ AcpiNsRemoveNullElements ( /* * We can safely remove all NULL elements from these package types: * PTYPE1_VAR packages contain a variable number of simple data types. - * PTYPE2 packages contain a variable number of sub-packages. + * PTYPE2 packages contain a variable number of subpackages. */ switch (PackageType) { diff --git a/sys/contrib/dev/acpica/source/components/namespace/nsrepair2.c b/sys/contrib/dev/acpica/source/components/namespace/nsrepair2.c index f2f72d6fb5..cb6ce06c69 100644 --- a/sys/contrib/dev/acpica/source/components/namespace/nsrepair2.c +++ b/sys/contrib/dev/acpica/source/components/namespace/nsrepair2.c @@ -478,8 +478,8 @@ AcpiNsRepair_CID ( * DESCRIPTION: Repair for the _CST object: * 1. Sort the list ascending by C state type * 2. Ensure type cannot be zero - * 3. A sub-package count of zero means _CST is meaningless - * 4. Count must match the number of C state sub-packages + * 3. A subpackage count of zero means _CST is meaningless + * 4. Count must match the number of C state subpackages * *****************************************************************************/ @@ -672,6 +672,7 @@ AcpiNsRepair_PRT ( ACPI_OPERAND_OBJECT **TopObjectList; ACPI_OPERAND_OBJECT **SubObjectList; ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *SubPackage; UINT32 ElementCount; UINT32 Index; @@ -681,9 +682,19 @@ AcpiNsRepair_PRT ( TopObjectList = PackageObject->Package.Elements; ElementCount = PackageObject->Package.Count; - for (Index = 0; Index < ElementCount; Index++) + /* Examine each subpackage */ + + for (Index = 0; Index < ElementCount; Index++, TopObjectList++) { - SubObjectList = (*TopObjectList)->Package.Elements; + SubPackage = *TopObjectList; + SubObjectList = SubPackage->Package.Elements; + + /* Check for minimum required element count */ + + if (SubPackage->Package.Count < 4) + { + continue; + } /* * If the BIOS has erroneously reversed the _PRT SourceName (index 2) @@ -698,14 +709,11 @@ AcpiNsRepair_PRT ( SubObjectList[2] = ObjDesc; Info->ReturnFlags |= ACPI_OBJECT_REPAIRED; - ACPI_WARN_PREDEFINED ((AE_INFO, Info->FullPathname, Info->NodeFlags, + ACPI_WARN_PREDEFINED ((AE_INFO, + Info->FullPathname, Info->NodeFlags, "PRT[%X]: Fixed reversed SourceName and SourceIndex", Index)); } - - /* Point to the next ACPI_OPERAND_OBJECT in the top level package */ - - TopObjectList++; } return (AE_OK); @@ -745,7 +753,7 @@ AcpiNsRepair_PSS ( /* - * Entries (sub-packages) in the _PSS Package must be sorted by power + * Entries (subpackages) in the _PSS Package must be sorted by power * dissipation, in descending order. If it appears that the list is * incorrectly sorted, sort it. We sort by CpuFrequency, since this * should be proportional to the power. @@ -838,9 +846,9 @@ AcpiNsRepair_TSS ( * * PARAMETERS: Info - Method execution information block * ReturnObject - Pointer to the top-level returned object - * StartIndex - Index of the first sub-package - * ExpectedCount - Minimum length of each sub-package - * SortIndex - Sub-package entry to sort on + * StartIndex - Index of the first subpackage + * ExpectedCount - Minimum length of each subpackage + * SortIndex - Subpackage entry to sort on * SortDirection - Ascending or descending * SortKeyName - Name of the SortIndex field * @@ -881,7 +889,7 @@ AcpiNsCheckSortedList ( } /* - * NOTE: assumes list of sub-packages contains no NULL elements. + * NOTE: assumes list of subpackages contains no NULL elements. * Any NULL elements should have been removed by earlier call * to AcpiNsRemoveNullElements. */ @@ -911,7 +919,7 @@ AcpiNsCheckSortedList ( return (AE_AML_OPERAND_TYPE); } - /* Each sub-package must have the minimum length */ + /* Each subpackage must have the minimum length */ if ((*OuterElements)->Package.Count < ExpectedCount) { diff --git a/sys/contrib/dev/acpica/source/components/parser/psloop.c b/sys/contrib/dev/acpica/source/components/parser/psloop.c index bbcf5253db..ace1d6b2bb 100644 --- a/sys/contrib/dev/acpica/source/components/parser/psloop.c +++ b/sys/contrib/dev/acpica/source/components/parser/psloop.c @@ -489,6 +489,11 @@ AcpiPsParseLoop ( Status = AE_OK; } + if (Status == AE_CTRL_TERMINATE) + { + return_ACPI_STATUS (Status); + } + Status = AcpiPsCompleteOp (WalkState, &Op, Status); if (ACPI_FAILURE (Status)) { diff --git a/sys/contrib/dev/acpica/source/components/parser/psobject.c b/sys/contrib/dev/acpica/source/components/parser/psobject.c index 23fade369f..661817178d 100644 --- a/sys/contrib/dev/acpica/source/components/parser/psobject.c +++ b/sys/contrib/dev/acpica/source/components/parser/psobject.c @@ -229,7 +229,10 @@ AcpiPsBuildNamedOp ( Status = WalkState->DescendingCallback (WalkState, Op); if (ACPI_FAILURE (Status)) { - ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog")); + if (Status != AE_CTRL_TERMINATE) + { + ACPI_EXCEPTION ((AE_INFO, Status, "During name lookup/catalog")); + } return_ACPI_STATUS (Status); } @@ -243,7 +246,7 @@ AcpiPsBuildNamedOp ( { if (Status == AE_CTRL_PENDING) { - return_ACPI_STATUS (AE_CTRL_PARSE_PENDING); + Status = AE_CTRL_PARSE_PENDING; } return_ACPI_STATUS (Status); } diff --git a/sys/contrib/dev/acpica/source/components/resources/rscalc.c b/sys/contrib/dev/acpica/source/components/resources/rscalc.c index 9f25e72049..0e9862dcf3 100644 --- a/sys/contrib/dev/acpica/source/components/resources/rscalc.c +++ b/sys/contrib/dev/acpica/source/components/resources/rscalc.c @@ -659,7 +659,7 @@ AcpiRsGetPciRoutingTableLength ( for (Index = 0; Index < NumberOfElements; Index++) { - /* Dereference the sub-package */ + /* Dereference the subpackage */ PackageElement = *TopObjectList; diff --git a/sys/contrib/dev/acpica/source/components/resources/rscreate.c b/sys/contrib/dev/acpica/source/components/resources/rscreate.c index 3c9c61a07d..c72dbc3584 100644 --- a/sys/contrib/dev/acpica/source/components/resources/rscreate.c +++ b/sys/contrib/dev/acpica/source/components/resources/rscreate.c @@ -297,7 +297,7 @@ AcpiRsCreatePciRoutingTable ( */ UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4); - /* Each sub-package must be of length 4 */ + /* Each subpackage must be of length 4 */ if ((*TopObjectList)->Package.Count != 4) { @@ -308,7 +308,7 @@ AcpiRsCreatePciRoutingTable ( } /* - * Dereference the sub-package. + * Dereference the subpackage. * The SubObjectList will now point to an array of the four IRQ * elements: [Address, Pin, Source, SourceIndex] */ @@ -317,7 +317,7 @@ AcpiRsCreatePciRoutingTable ( /* 1) First subobject: Dereference the PRT.Address */ ObjDesc = SubObjectList[0]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].Address) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); @@ -329,7 +329,7 @@ AcpiRsCreatePciRoutingTable ( /* 2) Second subobject: Dereference the PRT.Pin */ ObjDesc = SubObjectList[1]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].Pin) Need Integer, found %s", Index, AcpiUtGetObjectTypeName (ObjDesc))); @@ -410,7 +410,7 @@ AcpiRsCreatePciRoutingTable ( /* 4) Fourth subobject: Dereference the PRT.SourceIndex */ ObjDesc = SubObjectList[3]; - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) + if (!ObjDesc || ObjDesc->Common.Type != ACPI_TYPE_INTEGER) { ACPI_ERROR ((AE_INFO, "(PRT[%u].SourceIndex) Need Integer, found %s", diff --git a/sys/contrib/dev/acpica/source/components/resources/rsdump.c b/sys/contrib/dev/acpica/source/components/resources/rsdump.c index a37161e1e4..91675ed08d 100644 --- a/sys/contrib/dev/acpica/source/components/resources/rsdump.c +++ b/sys/contrib/dev/acpica/source/components/resources/rsdump.c @@ -52,7 +52,7 @@ ACPI_MODULE_NAME ("rsdump") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) /* Local prototypes */ diff --git a/sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c b/sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c index 090df2a222..665a76a1cf 100644 --- a/sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c +++ b/sys/contrib/dev/acpica/source/components/resources/rsdumpinfo.c @@ -52,7 +52,7 @@ ACPI_MODULE_NAME ("rsdumpinfo") -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) #define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f) diff --git a/sys/contrib/dev/acpica/source/components/resources/rsinfo.c b/sys/contrib/dev/acpica/source/components/resources/rsinfo.c index 1e9cea60c6..25fab81b01 100644 --- a/sys/contrib/dev/acpica/source/components/resources/rsinfo.c +++ b/sys/contrib/dev/acpica/source/components/resources/rsinfo.c @@ -141,7 +141,7 @@ ACPI_RSCONVERT_INFO *AcpiGbl_ConvertResourceSerialBusDispatch[] = }; -#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER) +#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUGGER) /* Dispatch table for resource dump functions */ diff --git a/sys/contrib/dev/acpica/source/components/utilities/utdelete.c b/sys/contrib/dev/acpica/source/components/utilities/utdelete.c index 480e1f764d..9e4c79b95a 100644 --- a/sys/contrib/dev/acpica/source/components/utilities/utdelete.c +++ b/sys/contrib/dev/acpica/source/components/utilities/utdelete.c @@ -86,6 +86,7 @@ AcpiUtDeleteInternalObj ( ACPI_OPERAND_OBJECT *HandlerDesc; ACPI_OPERAND_OBJECT *SecondDesc; ACPI_OPERAND_OBJECT *NextDesc; + ACPI_OPERAND_OBJECT *StartDesc; ACPI_OPERAND_OBJECT **LastObjPtr; @@ -250,9 +251,10 @@ AcpiUtDeleteInternalObj ( if (HandlerDesc) { NextDesc = HandlerDesc->AddressSpace.RegionList; + StartDesc = NextDesc; LastObjPtr = &HandlerDesc->AddressSpace.RegionList; - /* Remove the region object from the handler's list */ + /* Remove the region object from the handler list */ while (NextDesc) { @@ -262,10 +264,20 @@ AcpiUtDeleteInternalObj ( break; } - /* Walk the linked list of handler */ + /* Walk the linked list of handlers */ LastObjPtr = &NextDesc->Region.Next; NextDesc = NextDesc->Region.Next; + + /* Prevent infinite loop if list is corrupted */ + + if (NextDesc == StartDesc) + { + ACPI_ERROR ((AE_INFO, + "Circular region list in address handler object %p", + HandlerDesc)); + return_VOID; + } } if (HandlerDesc->AddressSpace.HandlerFlags & diff --git a/sys/contrib/dev/acpica/source/components/utilities/utglobal.c b/sys/contrib/dev/acpica/source/components/utilities/utglobal.c index 046f3bba60..0b029c8825 100644 --- a/sys/contrib/dev/acpica/source/components/utilities/utglobal.c +++ b/sys/contrib/dev/acpica/source/components/utilities/utglobal.c @@ -58,12 +58,7 @@ * ******************************************************************************/ -/* - * We want the debug switches statically initialized so they - * are already set when the debugger is entered. - */ - -/* Debug switch - level and trace mask */ +/* Debug output control masks */ #ifdef ACPI_DEBUG_OUTPUT UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT; @@ -71,24 +66,24 @@ UINT32 AcpiDbgLevel = ACPI_DEBUG_DEFAULT; UINT32 AcpiDbgLevel = ACPI_NORMAL_DEFAULT; #endif -/* Debug switch - layer (component) mask */ - UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT; -UINT32 AcpiGbl_NestingLevel = 0; - -/* Debugger globals */ - -BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; -BOOLEAN AcpiGbl_AbortMethod = FALSE; -BOOLEAN AcpiGbl_MethodExecuting = FALSE; -/* System flags */ +/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ -UINT32 AcpiGbl_StartupFlags = 0; +ACPI_TABLE_FADT AcpiGbl_FADT; +UINT32 AcpiGbl_TraceFlags; +ACPI_NAME AcpiGbl_TraceMethodName; +BOOLEAN AcpiGbl_SystemAwakeAndRunning; +UINT32 AcpiCurrentGpeCount; -/* System starts uninitialized */ +/* + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. + */ +BOOLEAN AcpiGbl_ReducedHardware; -BOOLEAN AcpiGbl_Shutdown = TRUE; +/* Various state name strings */ const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] = { @@ -309,7 +304,6 @@ AcpiUtInitGlobals ( AcpiGbl_DSDT = NULL; AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_DbTerminateThreads = FALSE; AcpiGbl_Shutdown = FALSE; AcpiGbl_NsLookupCount = 0; AcpiGbl_PsFindCount = 0; @@ -357,6 +351,10 @@ AcpiUtInitGlobals ( AcpiGbl_DisableMemTracking = FALSE; #endif +#ifdef ACPI_DEBUGGER + AcpiGbl_DbTerminateThreads = FALSE; +#endif + return_ACPI_STATUS (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/components/utilities/utosi.c b/sys/contrib/dev/acpica/source/components/utilities/utosi.c index c19ba41664..286fe67a6e 100644 --- a/sys/contrib/dev/acpica/source/components/utilities/utosi.c +++ b/sys/contrib/dev/acpica/source/components/utilities/utosi.c @@ -50,6 +50,34 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utosi") + +/****************************************************************************** + * + * ACPICA policy for new _OSI strings: + * + * It is the stated policy of ACPICA that new _OSI strings will be integrated + * into this module as soon as possible after they are defined. It is strongly + * recommended that all ACPICA hosts mirror this policy and integrate any + * changes to this module as soon as possible. There are several historical + * reasons behind this policy: + * + * 1) New BIOSs tend to test only the case where the host responds TRUE to + * the latest version of Windows, which would respond to the latest/newest + * _OSI string. Not responding TRUE to the latest version of Windows will + * risk executing untested code paths throughout the DSDT and SSDTs. + * + * 2) If a new _OSI string is recognized only after a significant delay, this + * has the potential to cause problems on existing working machines because + * of the possibility that a new and different path through the ASL code + * will be executed. + * + * 3) New _OSI strings are tending to come out about once per year. A delay + * in recognizing a new string for a significant amount of time risks the + * release of another string which only compounds the initial problem. + * + *****************************************************************************/ + + /* * Strings supported by the _OSI predefined control method (which is * implemented internally within this module.) @@ -78,6 +106,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ {"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 */ /* Feature Group Strings */ diff --git a/sys/contrib/dev/acpica/source/include/acapps.h b/sys/contrib/dev/acpica/source/include/acapps.h index 6a5577d30a..ad676cbc13 100644 --- a/sys/contrib/dev/acpica/source/include/acapps.h +++ b/sys/contrib/dev/acpica/source/include/acapps.h @@ -45,6 +45,8 @@ #define _ACAPPS +#pragma pack(push) /* Set default struct packing */ + #ifdef _MSC_VER /* disable some level-4 warnings */ #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ #endif @@ -123,8 +125,7 @@ AdAmlDisassemble ( BOOLEAN OutToFile, char *Filename, char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables); + char **OutFilename); void AdPrintStatistics ( @@ -141,8 +142,7 @@ AdDumpTables ( ACPI_STATUS AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables); + void); ACPI_STATUS AdParseTable ( @@ -221,4 +221,6 @@ AdWriteTable ( char *OemTableId); #endif +#pragma pack(pop) /* Restore original struct packing */ + #endif /* _ACAPPS */ diff --git a/sys/contrib/dev/acpica/source/include/acbuffer.h b/sys/contrib/dev/acpica/source/include/acbuffer.h index a36a980aa9..8e3cb3d831 100644 --- a/sys/contrib/dev/acpica/source/include/acbuffer.h +++ b/sys/contrib/dev/acpica/source/include/acbuffer.h @@ -44,6 +44,9 @@ #ifndef __ACBUFFER_H__ #define __ACBUFFER_H__ + +#pragma pack(push) /* Set default struct packing */ + /* * Contains buffer structures for these predefined names: * _FDE, _GRT, _GTM, _PLD, _SRT @@ -243,4 +246,6 @@ typedef struct acpi_pld_info #define ACPI_PLD_SET_HORIZ_OFFSET(dword,value) ACPI_SET_BITS (dword, 16, ACPI_16BIT_MASK, value) /* Offset 128+16=144, Len 16 */ +#pragma pack(pop) /* Restore original struct packing */ + #endif /* ACBUFFER_H */ diff --git a/sys/contrib/dev/acpica/source/include/acconfig.h b/sys/contrib/dev/acpica/source/include/acconfig.h index 4cad6f4b7e..3327d191ed 100644 --- a/sys/contrib/dev/acpica/source/include/acconfig.h +++ b/sys/contrib/dev/acpica/source/include/acconfig.h @@ -45,6 +45,8 @@ #define _ACCONFIG_H +#pragma pack(push) /* Set default struct packing */ + /****************************************************************************** * * Configuration options @@ -234,4 +236,6 @@ #define ACPI_DEBUGGER_EXECUTE_PROMPT '%' +#pragma pack(pop) /* Restore original struct packing */ + #endif /* _ACCONFIG_H */ diff --git a/sys/contrib/dev/acpica/source/include/acdebug.h b/sys/contrib/dev/acpica/source/include/acdebug.h index f85ec01ac2..59f8830e9f 100644 --- a/sys/contrib/dev/acpica/source/include/acdebug.h +++ b/sys/contrib/dev/acpica/source/include/acdebug.h @@ -45,6 +45,8 @@ #define __ACDEBUG_H__ +#pragma pack(push) /* Set default struct packing */ + #define ACPI_DEBUG_BUFFER_SIZE 0x4000 /* 16K buffer for return objects */ typedef struct acpi_db_command_info @@ -466,4 +468,6 @@ AcpiDbUint32ToHexString ( UINT32 Value, char *Buffer); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACDEBUG_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acdisasm.h b/sys/contrib/dev/acpica/source/include/acdisasm.h index a27c6bf697..00a469946d 100644 --- a/sys/contrib/dev/acpica/source/include/acdisasm.h +++ b/sys/contrib/dev/acpica/source/include/acdisasm.h @@ -47,6 +47,8 @@ #include "amlresrc.h" +#pragma pack(push) /* Set default struct packing */ + #define BLOCK_NONE 0 #define BLOCK_PAREN 1 #define BLOCK_BRACE 2 @@ -929,4 +931,6 @@ AdDisassemblerHeader ( char *Filename); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACDISASM_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acdispat.h b/sys/contrib/dev/acpica/source/include/acdispat.h index 607497bbb5..d20373d410 100644 --- a/sys/contrib/dev/acpica/source/include/acdispat.h +++ b/sys/contrib/dev/acpica/source/include/acdispat.h @@ -46,6 +46,8 @@ #define _ACDISPAT_H_ +#pragma pack(push) /* Set default struct packing */ + #define NAMEOF_LOCAL_NTE "__L0" #define NAMEOF_ARG_NTE "__A0" @@ -173,13 +175,15 @@ AcpiDsInitFieldObjects ( /* - * dsload - Parser/Interpreter interface, pass 1 namespace load callbacks + * dsload - Parser/Interpreter interface */ ACPI_STATUS AcpiDsInitCallbacks ( ACPI_WALK_STATE *WalkState, UINT32 PassNumber); +/* dsload - pass 1 namespace load callbacks */ + ACPI_STATUS AcpiDsLoad1BeginOp ( ACPI_WALK_STATE *WalkState, @@ -190,9 +194,8 @@ AcpiDsLoad1EndOp ( ACPI_WALK_STATE *WalkState); -/* - * dsload - Parser/Interpreter interface, pass 2 namespace load callbacks - */ +/* dsload - pass 2 namespace load callbacks */ + ACPI_STATUS AcpiDsLoad2BeginOp ( ACPI_WALK_STATE *WalkState, @@ -257,8 +260,9 @@ AcpiDsMethodDataInit ( * dsmethod - Parser/Interpreter interface - control method parsing */ ACPI_STATUS -AcpiDsParseMethod ( - ACPI_NAMESPACE_NODE *Node); +AcpiDsAutoSerializeMethod ( + ACPI_NAMESPACE_NODE *Node, + ACPI_OPERAND_OBJECT *ObjDesc); ACPI_STATUS AcpiDsCallControlMethod ( @@ -460,4 +464,6 @@ AcpiDsResultPush ( ACPI_OPERAND_OBJECT *Object, ACPI_WALK_STATE *WalkState); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* _ACDISPAT_H_ */ diff --git a/sys/contrib/dev/acpica/source/include/acevents.h b/sys/contrib/dev/acpica/source/include/acevents.h index 3db603534a..da998fb8ee 100644 --- a/sys/contrib/dev/acpica/source/include/acevents.h +++ b/sys/contrib/dev/acpica/source/include/acevents.h @@ -45,6 +45,8 @@ #define __ACEVENTS_H__ +#pragma pack(push) /* Set default struct packing */ + /* * evevent */ @@ -356,4 +358,6 @@ void AcpiEvTerminate ( void)) +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACEVENTS_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acexcep.h b/sys/contrib/dev/acpica/source/include/acexcep.h index aab6941a3c..40ea039c48 100644 --- a/sys/contrib/dev/acpica/source/include/acexcep.h +++ b/sys/contrib/dev/acpica/source/include/acexcep.h @@ -45,6 +45,8 @@ #define __ACEXCEP_H__ +#pragma pack(push) /* Set default struct packing */ + /* This module contains all possible exception codes for ACPI_STATUS */ /* @@ -345,4 +347,6 @@ static const ACPI_EXCEPTION_INFO AcpiGbl_ExceptionNames_Ctrl[] = #endif /* EXCEPTION_TABLE */ +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACEXCEP_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acglobal.h b/sys/contrib/dev/acpica/source/include/acglobal.h index 52e9747704..701955e9f7 100644 --- a/sys/contrib/dev/acpica/source/include/acglobal.h +++ b/sys/contrib/dev/acpica/source/include/acglobal.h @@ -45,6 +45,8 @@ #define __ACGLOBAL_H__ +#pragma pack(push) /* Set default struct packing */ + /* * Ensure that the globals are actually defined and initialized only once. * @@ -52,11 +54,19 @@ * to simplify maintenance of the code. */ #ifdef DEFINE_ACPI_GLOBALS -#define ACPI_EXTERN -#define ACPI_INIT_GLOBAL(a,b) a=b +#define ACPI_GLOBAL(type,name) \ + extern type name; \ + type name + +#define ACPI_INIT_GLOBAL(type,name,value) \ + type name=value + #else -#define ACPI_EXTERN extern -#define ACPI_INIT_GLOBAL(a,b) a +#define ACPI_GLOBAL(type,name) \ + extern type name + +#define ACPI_INIT_GLOBAL(type,name,value) \ + extern type name #endif @@ -84,33 +94,34 @@ * 5) Allow unresolved references (invalid target name) in package objects * 6) Enable warning messages for behavior that is not ACPI spec compliant */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableInterpreterSlack, FALSE); /* - * Automatically serialize ALL control methods? Default is FALSE, meaning - * to use the Serialized/NotSerialized method flags on a per method basis. - * Only change this if the ASL code is poorly written and cannot handle - * reentrancy even though methods are marked "NotSerialized". + * Automatically serialize all methods that create named objects? Default + * is TRUE, meaning that all NonSerialized methods are scanned once at + * table load time to determine those that create named objects. Methods + * that create named objects are marked Serialized in order to prevent + * possible run-time problems if they are entered by more than one thread. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_AllMethodsSerialized, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_AutoSerializeMethods, TRUE); /* * Create the predefined _OSI method in the namespace? Default is TRUE * because ACPI CA is fully compatible with other ACPI implementations. * Changing this will revert ACPI CA (and machine ASL) to pre-OSI behavior. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CreateOsiMethod, TRUE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CreateOsiMethod, TRUE); /* * Optionally use default values for the ACPI register widths. Set this to * TRUE to use the defaults, if an FADT contains incorrect widths/lengths. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_UseDefaultRegisterWidths, TRUE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_UseDefaultRegisterWidths, TRUE); /* * Optionally enable output from the AML Debug Object. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_EnableAmlDebugObject, FALSE); /* * Optionally copy the entire DSDT to local memory (instead of simply @@ -118,7 +129,7 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableAmlDebugObject, FALSE); * DSDT, creating the need for this option. Default is FALSE, do not copy * the DSDT. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_CopyDsdtLocally, FALSE); /* * Optionally ignore an XSDT if present and use the RSDT instead. @@ -126,8 +137,7 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_CopyDsdtLocally, FALSE); * of the RSDT, the XSDT has been found to be corrupt or ill-formed on * some machines. Default behavior is to use the XSDT if present. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DoNotUseXsdt, FALSE); - +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE); /* * Optionally use 32-bit FADT addresses if and when there is a conflict @@ -137,7 +147,7 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DoNotUseXsdt, FALSE); * some machines have been found to have a corrupted non-zero 64-bit * address. Default is FALSE, do not favor the 32-bit addresses. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_Use32BitFadtAddresses, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_Use32BitFadtAddresses, FALSE); /* * Optionally truncate I/O addresses to 16 bits. Provides compatibility @@ -145,47 +155,28 @@ UINT8 ACPI_INIT_GLOBAL (AcpiGbl_Use32BitFadtAddresses, FALSE); * this value is set to TRUE if any Windows OSI strings have been * requested by the BIOS. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_TruncateIoAddresses, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_TruncateIoAddresses, FALSE); /* * Disable runtime checking and repair of values returned by control methods. * Use only if the repair is causing a problem on a particular machine. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableAutoRepair, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableAutoRepair, FALSE); /* * Optionally do not load any SSDTs from the RSDT/XSDT during initialization. * This can be useful for debugging ACPI problems on some machines. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_DisableSsdtTableLoad, FALSE); +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DisableSsdtTableLoad, FALSE); /* * We keep track of the latest version of Windows that has been requested by * the BIOS. */ -UINT8 ACPI_INIT_GLOBAL (AcpiGbl_OsiData, 0); - - -/* AcpiGbl_FADT is a local copy of the FADT, converted to a common format. */ - -ACPI_TABLE_FADT AcpiGbl_FADT; -UINT32 AcpiCurrentGpeCount; -UINT32 AcpiGbl_TraceFlags; -ACPI_NAME AcpiGbl_TraceMethodName; -BOOLEAN AcpiGbl_SystemAwakeAndRunning; - -/* - * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning - * that the ACPI hardware is no longer required. A flag in the FADT indicates - * a reduced HW machine, and that flag is duplicated here for convenience. - */ -BOOLEAN AcpiGbl_ReducedHardware; +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_OsiData, 0); #endif /* DEFINE_ACPI_GLOBALS */ -/* Do not disassemble buffers to resource descriptors */ - -ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE); /***************************************************************************** * @@ -194,37 +185,36 @@ ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_NoResourceDisassembly, FALSE); ****************************************************************************/ /* - * AcpiGbl_RootTableList is the master list of ACPI tables that were - * found in the RSDT/XSDT. + * Master list of all ACPI tables that were found in the RSDT/XSDT. */ -ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList; +ACPI_GLOBAL (ACPI_TABLE_LIST, AcpiGbl_RootTableList); + +/* DSDT information. Used to check for DSDT corruption */ + +ACPI_GLOBAL (ACPI_TABLE_HEADER *, AcpiGbl_DSDT); +ACPI_GLOBAL (ACPI_TABLE_HEADER, AcpiGbl_OriginalDsdtHeader); #if (!ACPI_REDUCED_HARDWARE) -ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS; +ACPI_GLOBAL (ACPI_TABLE_FACS *, AcpiGbl_FACS); #endif /* !ACPI_REDUCED_HARDWARE */ /* These addresses are calculated from the FADT Event Block addresses */ -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aStatus; -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable; +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aStatus); +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1aEnable); -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bStatus; -ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable; - -/* DSDT information. Used to check for DSDT corruption */ - -ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT; -ACPI_EXTERN ACPI_TABLE_HEADER AcpiGbl_OriginalDsdtHeader; +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bStatus); +ACPI_GLOBAL (ACPI_GENERIC_ADDRESS, AcpiGbl_XPm1bEnable); /* - * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is + * Handle both ACPI 1.0 and ACPI 2.0+ Integer widths. The integer width is * determined by the revision of the DSDT: If the DSDT revision is less than * 2, use only the lower 32 bits of the internal 64-bit Integer. */ -ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth; -ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth; -ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerBitWidth); +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerByteWidth); +ACPI_GLOBAL (UINT8, AcpiGbl_IntegerNybbleWidth); /***************************************************************************** @@ -238,36 +228,36 @@ ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth; * actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs. * (The table maps local handles to the real OS handles) */ -ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]; +ACPI_GLOBAL (ACPI_MUTEX_INFO, AcpiGbl_MutexInfo[ACPI_NUM_MUTEX]); /* * Global lock mutex is an actual AML mutex object * Global lock semaphore works in conjunction with the actual global lock * Global lock spinlock is used for "pending" handshake */ -ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex; -ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore; -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GlobalLockPendingLock; -ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent; -ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPending; +ACPI_GLOBAL (ACPI_OPERAND_OBJECT *, AcpiGbl_GlobalLockMutex); +ACPI_GLOBAL (ACPI_SEMAPHORE, AcpiGbl_GlobalLockSemaphore); +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GlobalLockPendingLock); +ACPI_GLOBAL (UINT16, AcpiGbl_GlobalLockHandle); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockAcquired); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPresent); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_GlobalLockPending); /* * Spinlocks are used for interfaces that can be possibly called at * interrupt level */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */ -ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_ReferenceCountLock; +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_GpeLock); /* For GPE data structs and registers */ +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_HardwareLock); /* For ACPI H/W except GPE registers */ +ACPI_GLOBAL (ACPI_SPINLOCK, AcpiGbl_ReferenceCountLock); /* Mutex for _OSI support */ -ACPI_EXTERN ACPI_MUTEX AcpiGbl_OsiMutex; +ACPI_GLOBAL (ACPI_MUTEX, AcpiGbl_OsiMutex); /* Reader/Writer lock is used for namespace walk and dynamic table unload */ -ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; +ACPI_GLOBAL (ACPI_RW_LOCK, AcpiGbl_NamespaceRwLock); /***************************************************************************** @@ -278,69 +268,69 @@ ACPI_EXTERN ACPI_RW_LOCK AcpiGbl_NamespaceRwLock; /* Object caches */ -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache; -ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache; +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_NamespaceCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_StateCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_PsNodeExtCache); +ACPI_GLOBAL (ACPI_CACHE_T *, AcpiGbl_OperandCache); + +/* System */ + +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_StartupFlags, 0); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_Shutdown, TRUE); /* Global handlers */ -ACPI_EXTERN ACPI_GLOBAL_NOTIFY_HANDLER AcpiGbl_GlobalNotify[2]; -ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler; -ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler; -ACPI_EXTERN ACPI_TABLE_HANDLER AcpiGbl_TableHandler; -ACPI_EXTERN void *AcpiGbl_TableHandlerContext; -ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk; -ACPI_EXTERN ACPI_INTERFACE_HANDLER AcpiGbl_InterfaceHandler; -ACPI_EXTERN ACPI_SCI_HANDLER_INFO *AcpiGbl_SciHandlerList; +ACPI_GLOBAL (ACPI_GLOBAL_NOTIFY_HANDLER,AcpiGbl_GlobalNotify[2]); +ACPI_GLOBAL (ACPI_EXCEPTION_HANDLER, AcpiGbl_ExceptionHandler); +ACPI_GLOBAL (ACPI_INIT_HANDLER, AcpiGbl_InitHandler); +ACPI_GLOBAL (ACPI_TABLE_HANDLER, AcpiGbl_TableHandler); +ACPI_GLOBAL (void *, AcpiGbl_TableHandlerContext); +ACPI_GLOBAL (ACPI_WALK_STATE *, AcpiGbl_BreakpointWalk); +ACPI_GLOBAL (ACPI_INTERFACE_HANDLER, AcpiGbl_InterfaceHandler); +ACPI_GLOBAL (ACPI_SCI_HANDLER_INFO *, AcpiGbl_SciHandlerList); /* Owner ID support */ -ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]; -ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex; -ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset; +ACPI_GLOBAL (UINT32, AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS]); +ACPI_GLOBAL (UINT8, AcpiGbl_LastOwnerIdIndex); +ACPI_GLOBAL (UINT8, AcpiGbl_NextOwnerIdOffset); /* Initialization sequencing */ -ACPI_EXTERN BOOLEAN AcpiGbl_RegMethodsExecuted; +ACPI_GLOBAL (BOOLEAN, AcpiGbl_RegMethodsExecuted); /* Misc */ -ACPI_EXTERN UINT32 AcpiGbl_OriginalMode; -ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation; -ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount; -ACPI_EXTERN UINT32 AcpiGbl_PsFindCount; -ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave; -ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration; -ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall; -ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent; -ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized; -ACPI_EXTERN ACPI_INTERFACE_INFO *AcpiGbl_SupportedInterfaces; -ACPI_EXTERN ACPI_ADDRESS_RANGE *AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]; +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalMode); +ACPI_GLOBAL (UINT32, AcpiGbl_RsdpOriginalLocation); +ACPI_GLOBAL (UINT32, AcpiGbl_NsLookupCount); +ACPI_GLOBAL (UINT32, AcpiGbl_PsFindCount); +ACPI_GLOBAL (UINT16, AcpiGbl_Pm1EnableRegisterSave); +ACPI_GLOBAL (UINT8, AcpiGbl_DebuggerConfiguration); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_StepToNextCall); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_AcpiHardwarePresent); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_EventsInitialized); +ACPI_GLOBAL (ACPI_INTERFACE_INFO *, AcpiGbl_SupportedInterfaces); +ACPI_GLOBAL (ACPI_ADDRESS_RANGE *, AcpiGbl_AddressRangeList[ACPI_ADDRESS_RANGE_MAX]); -#ifndef DEFINE_ACPI_GLOBALS +/* Other miscellaneous, declared and initialized in utglobal */ -/* Other miscellaneous */ - -extern BOOLEAN AcpiGbl_Shutdown; -extern UINT32 AcpiGbl_StartupFlags; extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT]; extern const char *AcpiGbl_LowestDstateNames[ACPI_NUM_SxW_METHODS]; extern const char *AcpiGbl_HighestDstateNames[ACPI_NUM_SxD_METHODS]; -extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS]; -#endif +extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES]; #ifdef ACPI_DBG_TRACK_ALLOCATIONS -/* Lists for tracking memory allocations */ +/* Lists for tracking memory allocations (debug only) */ -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList; -ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList; -ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats; -ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; +ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_GlobalList); +ACPI_GLOBAL (ACPI_MEMORY_LIST *, AcpiGbl_NsNodeList); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisplayFinalMemStats); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DisableMemTracking); #endif @@ -356,22 +346,23 @@ ACPI_EXTERN BOOLEAN AcpiGbl_DisableMemTracking; #define NUM_PREDEFINED_NAMES 9 #endif -ACPI_EXTERN ACPI_NAMESPACE_NODE AcpiGbl_RootNodeStruct; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_RootNode; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_FadtGpeDevice; -ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_ModuleCodeList; +ACPI_GLOBAL (ACPI_NAMESPACE_NODE, AcpiGbl_RootNodeStruct); +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]; #ifdef ACPI_DEBUG_OUTPUT -ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeCount; -ACPI_EXTERN UINT32 AcpiGbl_CurrentNodeSize; -ACPI_EXTERN UINT32 AcpiGbl_MaxConcurrentNodeCount; -ACPI_EXTERN ACPI_SIZE *AcpiGbl_EntryStackPointer; -ACPI_EXTERN ACPI_SIZE *AcpiGbl_LowestStackPointer; -ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; +ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeCount); +ACPI_GLOBAL (UINT32, AcpiGbl_CurrentNodeSize); +ACPI_GLOBAL (UINT32, AcpiGbl_MaxConcurrentNodeCount); +ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_EntryStackPointer); +ACPI_GLOBAL (ACPI_SIZE *, AcpiGbl_LowestStackPointer); +ACPI_GLOBAL (UINT32, AcpiGbl_DeepestNesting); +ACPI_INIT_GLOBAL (UINT32, AcpiGbl_NestingLevel, 0); #endif @@ -381,11 +372,11 @@ ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting; * ****************************************************************************/ -ACPI_EXTERN ACPI_THREAD_STATE *AcpiGbl_CurrentWalkList; +ACPI_GLOBAL (ACPI_THREAD_STATE *, AcpiGbl_CurrentWalkList); /* Control method single step flag */ -ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; +ACPI_GLOBAL (UINT8, AcpiGbl_CmSingleStep); /***************************************************************************** @@ -394,9 +385,10 @@ ACPI_EXTERN UINT8 AcpiGbl_CmSingleStep; * ****************************************************************************/ -extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; -ACPI_EXTERN UINT8 AcpiGbl_SleepTypeA; -ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; +extern ACPI_BIT_REGISTER_INFO AcpiGbl_BitRegisterInfo[ACPI_NUM_BITREG]; + +ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeA); +ACPI_GLOBAL (UINT8, AcpiGbl_SleepTypeB); /***************************************************************************** @@ -407,13 +399,14 @@ ACPI_EXTERN UINT8 AcpiGbl_SleepTypeB; #if (!ACPI_REDUCED_HARDWARE) -ACPI_EXTERN UINT8 AcpiGbl_AllGpesInitialized; -ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead; -ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS]; -ACPI_EXTERN ACPI_GBL_EVENT_HANDLER AcpiGbl_GlobalEventHandler; -ACPI_EXTERN void *AcpiGbl_GlobalEventHandlerContext; -ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS]; -extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EVENTS]; +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 */ @@ -423,23 +416,19 @@ extern ACPI_FIXED_EVENT_INFO AcpiGbl_FixedEventInfo[ACPI_NUM_FIXED_EV * ****************************************************************************/ -/* Procedure nesting level for debug output */ - -extern UINT32 AcpiGbl_NestingLevel; - /* Event counters */ -ACPI_EXTERN UINT32 AcpiMethodCount; -ACPI_EXTERN UINT32 AcpiGpeCount; -ACPI_EXTERN UINT32 AcpiSciCount; -ACPI_EXTERN UINT32 AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]; +ACPI_GLOBAL (UINT32, AcpiMethodCount); +ACPI_GLOBAL (UINT32, AcpiGpeCount); +ACPI_GLOBAL (UINT32, AcpiSciCount); +ACPI_GLOBAL (UINT32, AcpiFixedEventCount[ACPI_NUM_FIXED_EVENTS]); /* Support for dynamic control method tracing mechanism */ -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel; -ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_OriginalDbgLayer); +ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_TraceDbgLayer); /***************************************************************************** @@ -448,63 +437,64 @@ ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer; * ****************************************************************************/ -ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags; +ACPI_GLOBAL (UINT8, AcpiGbl_DbOutputFlags); #ifdef ACPI_DISASSEMBLER -ACPI_EXTERN BOOLEAN ACPI_INIT_GLOBAL (AcpiGbl_IgnoreNoopOperator, FALSE); +/* Do not disassemble buffers to resource descriptors */ -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_disasm; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_verbose; -ACPI_EXTERN BOOLEAN AcpiGbl_NumExternalMethods; -ACPI_EXTERN UINT32 AcpiGbl_ResolvedExternalMethods; -ACPI_EXTERN ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList; -ACPI_EXTERN ACPI_EXTERNAL_FILE *AcpiGbl_ExternalFileList; -#endif +ACPI_INIT_GLOBAL (UINT8, AcpiGbl_NoResourceDisassembly, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnoreNoopOperator, FALSE); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_disasm); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_verbose); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_NumExternalMethods); +ACPI_GLOBAL (UINT32, AcpiGbl_ResolvedExternalMethods); +ACPI_GLOBAL (ACPI_EXTERNAL_LIST *, AcpiGbl_ExternalList); +ACPI_GLOBAL (ACPI_EXTERNAL_FILE *, AcpiGbl_ExternalFileList); +#endif #ifdef ACPI_DEBUGGER -extern BOOLEAN AcpiGbl_MethodExecuting; -extern BOOLEAN AcpiGbl_AbortMethod; -extern BOOLEAN AcpiGbl_DbTerminateThreads; +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_DbTerminateThreads, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_AbortMethod, FALSE); +ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_MethodExecuting, FALSE); -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_tables; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_stats; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_ini_methods; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOpt_NoRegionSupport; -ACPI_EXTERN BOOLEAN AcpiGbl_DbOutputToFile; -ACPI_EXTERN char *AcpiGbl_DbBuffer; -ACPI_EXTERN char *AcpiGbl_DbFilename; -ACPI_EXTERN UINT32 AcpiGbl_DbDebugLevel; -ACPI_EXTERN UINT32 AcpiGbl_DbConsoleDebugLevel; -ACPI_EXTERN ACPI_NAMESPACE_NODE *AcpiGbl_DbScopeNode; +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_tables); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_stats); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_ini_methods); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOpt_NoRegionSupport); +ACPI_GLOBAL (BOOLEAN, AcpiGbl_DbOutputToFile); +ACPI_GLOBAL (char *, AcpiGbl_DbBuffer); +ACPI_GLOBAL (char *, AcpiGbl_DbFilename); +ACPI_GLOBAL (UINT32, AcpiGbl_DbDebugLevel); +ACPI_GLOBAL (UINT32, AcpiGbl_DbConsoleDebugLevel); +ACPI_GLOBAL (ACPI_NAMESPACE_NODE *, AcpiGbl_DbScopeNode); -ACPI_EXTERN char *AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]; -ACPI_EXTERN ACPI_OBJECT_TYPE AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]; +ACPI_GLOBAL (char *, AcpiGbl_DbArgs[ACPI_DEBUGGER_MAX_ARGS]); +ACPI_GLOBAL (ACPI_OBJECT_TYPE, AcpiGbl_DbArgTypes[ACPI_DEBUGGER_MAX_ARGS]); /* These buffers should all be the same size */ -ACPI_EXTERN char AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]; -ACPI_EXTERN char AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]; +ACPI_GLOBAL (char, AcpiGbl_DbLineBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbParsedBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbScopeBuf[ACPI_DB_LINE_BUFFER_SIZE]); +ACPI_GLOBAL (char, AcpiGbl_DbDebugFilename[ACPI_DB_LINE_BUFFER_SIZE]); /* * Statistic globals */ -ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]; -ACPI_EXTERN UINT16 AcpiGbl_ObjTypeCountMisc; -ACPI_EXTERN UINT16 AcpiGbl_NodeTypeCountMisc; -ACPI_EXTERN UINT32 AcpiGbl_NumNodes; -ACPI_EXTERN UINT32 AcpiGbl_NumObjects; - - -ACPI_EXTERN UINT32 AcpiGbl_SizeOfParseTree; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfMethodTrees; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfNodeEntries; -ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; +ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); +ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCount[ACPI_TYPE_NS_NODE_MAX+1]); +ACPI_GLOBAL (UINT16, AcpiGbl_ObjTypeCountMisc); +ACPI_GLOBAL (UINT16, AcpiGbl_NodeTypeCountMisc); +ACPI_GLOBAL (UINT32, AcpiGbl_NumNodes); +ACPI_GLOBAL (UINT32, AcpiGbl_NumObjects); + +ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfParseTree); +ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfMethodTrees); +ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfNodeEntries); +ACPI_GLOBAL (UINT32, AcpiGbl_SizeOfAcpiObjects); #endif /* ACPI_DEBUGGER */ @@ -517,7 +507,7 @@ ACPI_EXTERN UINT32 AcpiGbl_SizeOfAcpiObjects; #ifdef ACPI_APPLICATION -ACPI_FILE ACPI_INIT_GLOBAL (AcpiGbl_DebugFile, NULL); +ACPI_INIT_GLOBAL (ACPI_FILE, AcpiGbl_DebugFile, NULL); #endif /* ACPI_APPLICATION */ @@ -528,7 +518,9 @@ ACPI_FILE ACPI_INIT_GLOBAL (AcpiGbl_DebugFile, NULL); * ****************************************************************************/ -extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; +extern const AH_PREDEFINED_NAME AslPredefinedInfo[]; + +#pragma pack(pop) /* Restore original struct packing */ #endif /* __ACGLOBAL_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/achware.h b/sys/contrib/dev/acpica/source/include/achware.h index 1b13318799..81d1bbf30b 100644 --- a/sys/contrib/dev/acpica/source/include/achware.h +++ b/sys/contrib/dev/acpica/source/include/achware.h @@ -45,6 +45,8 @@ #define __ACHWARE_H__ +#pragma pack(push) /* Set default struct packing */ + /* Values for the _SST predefined method */ #define ACPI_SST_INDICATOR_OFF 0 @@ -224,4 +226,6 @@ AcpiHwDerivePciId ( ACPI_HANDLE PciRegion); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACHWARE_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acinterp.h b/sys/contrib/dev/acpica/source/include/acinterp.h index 59ade0272c..bcb306cff5 100644 --- a/sys/contrib/dev/acpica/source/include/acinterp.h +++ b/sys/contrib/dev/acpica/source/include/acinterp.h @@ -45,6 +45,8 @@ #define __ACINTERP_H__ +#pragma pack(push) /* Set default struct packing */ + #define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1])) /* Macros for tables used for debug output */ @@ -89,6 +91,10 @@ typedef const struct acpi_exdump_info #define ACPI_EXD_PACKAGE 11 #define ACPI_EXD_FIELD 12 #define ACPI_EXD_REFERENCE 13 +#define ACPI_EXD_LIST 14 /* Operand object list */ +#define ACPI_EXD_HDLR_LIST 15 /* Address Handler list */ +#define ACPI_EXD_RGN_LIST 16 /* Region list */ +#define ACPI_EXD_NODE 17 /* Namespace Node */ /* restore default alignment */ @@ -612,14 +618,6 @@ void AcpiExExitInterpreter ( void); -void -AcpiExReacquireInterpreter ( - void); - -void -AcpiExRelinquishInterpreter ( - void); - BOOLEAN AcpiExTruncateFor32bitTable ( ACPI_OPERAND_OBJECT *ObjDesc); @@ -723,4 +721,6 @@ AcpiExDataTableSpaceHandler ( void *HandlerContext, void *RegionContext); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __INTERP_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/aclocal.h b/sys/contrib/dev/acpica/source/include/aclocal.h index 8f02f60947..3234066bf2 100644 --- a/sys/contrib/dev/acpica/source/include/aclocal.h +++ b/sys/contrib/dev/acpica/source/include/aclocal.h @@ -45,6 +45,8 @@ #define __ACLOCAL_H__ +#pragma pack(push) /* Set default struct packing */ + /* acpisrc:StructDefs -- for acpisrc conversion */ #define ACPI_SERIALIZED 0xFF @@ -1349,4 +1351,6 @@ typedef struct ah_predefined_name } AH_PREDEFINED_NAME; +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACLOCAL_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acmacros.h b/sys/contrib/dev/acpica/source/include/acmacros.h index 19a3e8e235..1212d0516b 100644 --- a/sys/contrib/dev/acpica/source/include/acmacros.h +++ b/sys/contrib/dev/acpica/source/include/acmacros.h @@ -45,6 +45,8 @@ #define __ACMACROS_H__ +#pragma pack(push) /* Set default struct packing */ + /* * Extract data using a pointer. Any more than a byte and we * get into potential aligment issues -- see the STORE macros below. @@ -433,4 +435,6 @@ #define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7')) +#pragma pack(pop) /* Restore original struct packing */ + #endif /* ACMACROS_H */ diff --git a/sys/contrib/dev/acpica/source/include/acnamesp.h b/sys/contrib/dev/acpica/source/include/acnamesp.h index 9fd3841c6c..a9c7d2212f 100644 --- a/sys/contrib/dev/acpica/source/include/acnamesp.h +++ b/sys/contrib/dev/acpica/source/include/acnamesp.h @@ -45,6 +45,8 @@ #define __ACNAMESP_H__ +#pragma pack(push) /* Set default struct packing */ + /* To search the entire name space, pass this as SearchBase */ #define ACPI_NS_ALL ((ACPI_HANDLE)0) @@ -535,4 +537,6 @@ void AcpiNsTerminate ( void); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACNAMESP_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acobject.h b/sys/contrib/dev/acpica/source/include/acobject.h index 654ec8283c..040f5b6277 100644 --- a/sys/contrib/dev/acpica/source/include/acobject.h +++ b/sys/contrib/dev/acpica/source/include/acobject.h @@ -44,6 +44,8 @@ #ifndef _ACOBJECT_H #define _ACOBJECT_H +#pragma pack(push) /* Set default struct packing */ + /* acpisrc:StructDefs -- for acpisrc conversion */ @@ -581,6 +583,6 @@ typedef union acpi_descriptor } ACPI_DESCRIPTOR; -#pragma pack() +#pragma pack(pop) /* Restore original struct packing */ #endif /* _ACOBJECT_H */ diff --git a/sys/contrib/dev/acpica/source/include/acoutput.h b/sys/contrib/dev/acpica/source/include/acoutput.h index 67a37987f8..fd4e4276ab 100644 --- a/sys/contrib/dev/acpica/source/include/acoutput.h +++ b/sys/contrib/dev/acpica/source/include/acoutput.h @@ -44,6 +44,8 @@ #ifndef __ACOUTPUT_H__ #define __ACOUTPUT_H__ +#pragma pack(push) /* Set default struct packing */ + /* * Debug levels and component IDs. These are used to control the * granularity of the output of the ACPI_DEBUG_PRINT macro -- on a @@ -468,4 +470,6 @@ #endif /* ACPI_DEBUG_OUTPUT */ +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACOUTPUT_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acparser.h b/sys/contrib/dev/acpica/source/include/acparser.h index bddd3c1142..74389d2ef7 100644 --- a/sys/contrib/dev/acpica/source/include/acparser.h +++ b/sys/contrib/dev/acpica/source/include/acparser.h @@ -46,6 +46,8 @@ #define __ACPARSER_H__ +#pragma pack(push) /* Set default struct packing */ + #define OP_HAS_RETURN_VALUE 1 /* Variable number of arguments. This field must be 32 bits */ @@ -353,4 +355,6 @@ AcpiPsShow ( ACPI_PARSE_OBJECT *op); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACPARSER_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acpiosxf.h b/sys/contrib/dev/acpica/source/include/acpiosxf.h index ebbcb6bd6f..a97921e169 100644 --- a/sys/contrib/dev/acpica/source/include/acpiosxf.h +++ b/sys/contrib/dev/acpica/source/include/acpiosxf.h @@ -50,6 +50,8 @@ #include "actypes.h" +#pragma pack(push) /* Set default struct packing */ + /* Types for AcpiOsExecute */ typedef enum @@ -551,4 +553,6 @@ AcpiOsCloseDirectory ( #endif +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACPIOSXF_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acpixf.h b/sys/contrib/dev/acpica/source/include/acpixf.h index d168353d14..a88491f503 100644 --- a/sys/contrib/dev/acpica/source/include/acpixf.h +++ b/sys/contrib/dev/acpica/source/include/acpixf.h @@ -47,13 +47,15 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20140114 +#define ACPI_CA_VERSION 0x20140214 #include "acconfig.h" #include "actypes.h" #include "actbl.h" #include "acbuffer.h" +#pragma pack(push) /* Set default struct packing */ + /* * Globals that are publically available */ @@ -70,7 +72,7 @@ extern UINT32 AcpiDbgLayer; /* ACPICA runtime options */ -extern UINT8 AcpiGbl_AllMethodsSerialized; +extern UINT8 AcpiGbl_AutoSerializeMethods; extern UINT8 AcpiGbl_CopyDsdtLocally; extern UINT8 AcpiGbl_CreateOsiMethod; extern UINT8 AcpiGbl_DisableAutoRepair; @@ -831,4 +833,6 @@ AcpiDebugPrintRaw ( ...); #endif +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACXFACE_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acpredef.h b/sys/contrib/dev/acpica/source/include/acpredef.h index 1de9888595..b8b75997ed 100644 --- a/sys/contrib/dev/acpica/source/include/acpredef.h +++ b/sys/contrib/dev/acpica/source/include/acpredef.h @@ -45,11 +45,13 @@ #define __ACPREDEF_H__ +#pragma pack(push) /* Set default struct packing */ + /****************************************************************************** * * Return Package types * - * 1) PTYPE1 packages do not contain sub-packages. + * 1) PTYPE1 packages do not contain subpackages. * * ACPI_PTYPE1_FIXED: Fixed-length length, 1 or 2 object types: * object type @@ -64,8 +66,8 @@ * (Used for _PRW) * * - * 2) PTYPE2 packages contain a Variable-length number of sub-packages. Each - * of the different types describe the contents of each of the sub-packages. + * 2) PTYPE2 packages contain a Variable-length number of subpackages. Each + * of the different types describe the contents of each of the subpackages. * * ACPI_PTYPE2: Each subpackage contains 1 or 2 object types. Zero-length * parent package is allowed: @@ -554,7 +556,7 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = /* * For _HPX, a single package is returned, containing a variable-length number - * of sub-packages. Each sub-package contains a PCI record setting. + * of subpackages. Each subpackage contains a PCI record setting. * There are several different type of record settings, of different * lengths, but all elements of all settings are Integers. */ @@ -684,6 +686,12 @@ const ACPI_PREDEFINED_INFO AcpiGbl_PredefinedMethods[] = METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Refs) */ PACKAGE_INFO (ACPI_PTYPE1_VAR, ACPI_RTYPE_REFERENCE, 0,0,0,0), + {{"_PRP", METHOD_0ARGS, + METHOD_RETURNS (ACPI_RTYPE_PACKAGE)}}, /* Variable-length (Pkgs) each: 1 Str, 1 Int/Str/Pkg */ + PACKAGE_INFO (ACPI_PTYPE2, ACPI_RTYPE_STRING, 1, + ACPI_RTYPE_INTEGER | ACPI_RTYPE_STRING | + ACPI_RTYPE_PACKAGE | ACPI_RTYPE_REFERENCE, 1,0), + {{"_PRS", METHOD_0ARGS, METHOD_RETURNS (ACPI_RTYPE_BUFFER)}}, @@ -1061,4 +1069,6 @@ static const ACPI_PREDEFINED_INFO AcpiGbl_ScopeNames[] = { extern const ACPI_PREDEFINED_INFO AcpiGbl_ResourceNames[]; #endif +#pragma pack(pop) /* Restore original struct packing */ + #endif diff --git a/sys/contrib/dev/acpica/source/include/acresrc.h b/sys/contrib/dev/acpica/source/include/acresrc.h index f761d3f099..5f658a6393 100644 --- a/sys/contrib/dev/acpica/source/include/acresrc.h +++ b/sys/contrib/dev/acpica/source/include/acresrc.h @@ -49,6 +49,8 @@ #include "amlresrc.h" +#pragma pack(push) /* Set default struct packing */ + /* * If possible, pack the following structures to byte alignment, since we * don't care about performance for debug output. Two cases where we cannot @@ -437,4 +439,6 @@ extern ACPI_RSDUMP_INFO AcpiRsDumpUartSerialBus[]; extern ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[]; #endif +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACRESRC_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acrestyp.h b/sys/contrib/dev/acpica/source/include/acrestyp.h index b0412aa63c..eaea4375db 100644 --- a/sys/contrib/dev/acpica/source/include/acrestyp.h +++ b/sys/contrib/dev/acpica/source/include/acrestyp.h @@ -45,6 +45,8 @@ #define __ACRESTYP_H__ +#pragma pack(push) /* Set default struct packing */ + /* * Definitions for Resource Attributes */ @@ -697,4 +699,6 @@ typedef struct acpi_pci_routing_table } ACPI_PCI_ROUTING_TABLE; +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACRESTYP_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acstruct.h b/sys/contrib/dev/acpica/source/include/acstruct.h index 5d2f4a06e8..c52db8f4e1 100644 --- a/sys/contrib/dev/acpica/source/include/acstruct.h +++ b/sys/contrib/dev/acpica/source/include/acstruct.h @@ -44,6 +44,9 @@ #ifndef __ACSTRUCT_H__ #define __ACSTRUCT_H__ + +#pragma pack(push) /* Set default struct packing */ + /* acpisrc:StructDefs -- for acpisrc conversion */ /***************************************************************************** @@ -139,6 +142,9 @@ typedef struct acpi_init_walk_info UINT32 TableIndex; UINT32 ObjectCount; UINT32 MethodCount; + UINT32 SerialMethodCount; + UINT32 NonSerialMethodCount; + UINT32 SerializedMethodCount; UINT32 DeviceCount; UINT32 OpRegionCount; UINT32 FieldCount; @@ -267,4 +273,6 @@ typedef struct acpi_walk_info #define ACPI_DISPLAY_SHORT (UINT8) 2 +#pragma pack(pop) /* Restore original struct packing */ + #endif diff --git a/sys/contrib/dev/acpica/source/include/actables.h b/sys/contrib/dev/acpica/source/include/actables.h index 4f006c1734..19f4e6d626 100644 --- a/sys/contrib/dev/acpica/source/include/actables.h +++ b/sys/contrib/dev/acpica/source/include/actables.h @@ -45,6 +45,8 @@ #define __ACTABLES_H__ +#pragma pack(push) /* Set default struct packing */ + ACPI_STATUS AcpiAllocateRootTable ( UINT32 InitialTableCount); @@ -194,4 +196,6 @@ ACPI_STATUS AcpiTbParseRootTable ( ACPI_PHYSICAL_ADDRESS RsdpAddress); +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACTABLES_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/actbl.h b/sys/contrib/dev/acpica/source/include/actbl.h index 8f5917c960..980529e02d 100644 --- a/sys/contrib/dev/acpica/source/include/actbl.h +++ b/sys/contrib/dev/acpica/source/include/actbl.h @@ -45,6 +45,8 @@ #define __ACTBL_H__ +#pragma pack(push) /* Set default struct packing */ + /******************************************************************************* * * Fundamental ACPI tables @@ -440,4 +442,6 @@ typedef struct acpi_table_desc #define ACPI_FADT_V3_SIZE (UINT32) (ACPI_FADT_OFFSET (SleepControl)) #define ACPI_FADT_V5_SIZE (UINT32) (sizeof (ACPI_TABLE_FADT)) +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACTBL_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/actbl1.h b/sys/contrib/dev/acpica/source/include/actbl1.h index ace4da91d8..bd2df958be 100644 --- a/sys/contrib/dev/acpica/source/include/actbl1.h +++ b/sys/contrib/dev/acpica/source/include/actbl1.h @@ -45,6 +45,8 @@ #define __ACTBL1_H__ +#pragma pack(push) /* Set default struct packing */ + /******************************************************************************* * * Additional ACPI Tables (1) @@ -1141,8 +1143,6 @@ typedef struct acpi_srat_x2apic_cpu_affinity #define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */ -/* Reset to default packing */ - -#pragma pack() +#pragma pack(pop) /* Restore original struct packing */ #endif /* __ACTBL1_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/actbl2.h b/sys/contrib/dev/acpica/source/include/actbl2.h index ae46ad8d81..514ecb0dc9 100644 --- a/sys/contrib/dev/acpica/source/include/actbl2.h +++ b/sys/contrib/dev/acpica/source/include/actbl2.h @@ -45,6 +45,8 @@ #define __ACTBL2_H__ +#pragma pack(push) /* Set default struct packing */ + /******************************************************************************* * * Additional ACPI Tables (2) @@ -1416,8 +1418,6 @@ typedef struct acpi_table_wdrt } ACPI_TABLE_WDRT; -/* Reset to default packing */ - -#pragma pack() +#pragma pack(pop) /* Restore original struct packing */ #endif /* __ACTBL2_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/actbl3.h b/sys/contrib/dev/acpica/source/include/actbl3.h index ce69acd454..1afc341d31 100644 --- a/sys/contrib/dev/acpica/source/include/actbl3.h +++ b/sys/contrib/dev/acpica/source/include/actbl3.h @@ -45,6 +45,8 @@ #define __ACTBL3_H__ +#pragma pack(push) /* Set default struct packing */ + /******************************************************************************* * * Additional ACPI Tables (3) @@ -732,8 +734,6 @@ typedef struct acpi_tpm2_control } ACPI_TPM2_CONTROL; -/* Reset to default packing */ - -#pragma pack() +#pragma pack(pop) /* Restore original struct packing */ #endif /* __ACTBL3_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/actypes.h b/sys/contrib/dev/acpica/source/include/actypes.h index 4a6e492fc9..1fa6c696c5 100644 --- a/sys/contrib/dev/acpica/source/include/actypes.h +++ b/sys/contrib/dev/acpica/source/include/actypes.h @@ -44,6 +44,8 @@ #ifndef __ACTYPES_H__ #define __ACTYPES_H__ +#pragma pack(push) /* Set default struct packing */ + /* acpisrc:StructDefs -- for acpisrc conversion */ /* @@ -1315,4 +1317,6 @@ typedef struct acpi_memory_list #define ACPI_OSI_WIN_8 0x0C +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __ACTYPES_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/acutils.h b/sys/contrib/dev/acpica/source/include/acutils.h index c115c24fe4..355e5752bf 100644 --- a/sys/contrib/dev/acpica/source/include/acutils.h +++ b/sys/contrib/dev/acpica/source/include/acutils.h @@ -45,6 +45,8 @@ #define _ACUTILS_H +#pragma pack(push) /* Set default struct packing */ + extern const UINT8 AcpiGbl_ResourceAmlSizes[]; extern const UINT8 AcpiGbl_ResourceAmlSerialBusSizes[]; @@ -1099,4 +1101,7 @@ AcpiUtMethodError ( const char *Path, ACPI_STATUS LookupStatus); + +#pragma pack(pop) /* Restore original struct packing */ + #endif /* _ACUTILS_H */ diff --git a/sys/contrib/dev/acpica/source/include/amlcode.h b/sys/contrib/dev/acpica/source/include/amlcode.h index bc8c0b0d3d..0695185e52 100644 --- a/sys/contrib/dev/acpica/source/include/amlcode.h +++ b/sys/contrib/dev/acpica/source/include/amlcode.h @@ -46,6 +46,9 @@ #ifndef __AMLCODE_H__ #define __AMLCODE_H__ +#pragma pack(push) /* Set default struct packing */ + + /* primary opcodes */ #define AML_NULL_CHAR (UINT16) 0x00 @@ -509,4 +512,6 @@ typedef enum #define AML_METHOD_SYNC_LEVEL 0xF0 +#pragma pack(pop) /* Restore original struct packing */ + #endif /* __AMLCODE_H__ */ diff --git a/sys/contrib/dev/acpica/source/include/amlresrc.h b/sys/contrib/dev/acpica/source/include/amlresrc.h index 23c4400a0d..03b1317bf0 100644 --- a/sys/contrib/dev/acpica/source/include/amlresrc.h +++ b/sys/contrib/dev/acpica/source/include/amlresrc.h @@ -47,6 +47,8 @@ #define __AMLRESRC_H +#pragma pack(push) /* Set default struct packing */ + /* * Resource descriptor tags, as defined in the ACPI specification. * Used to symbolically reference fields within a descriptor. @@ -574,4 +576,7 @@ typedef union aml_resource } AML_RESOURCE; + +#pragma pack(pop) /* Restore original struct packing */ + #endif diff --git a/sys/contrib/dev/acpica/source/os_specific/service_layers/oswindir.c b/sys/contrib/dev/acpica/source/os_specific/service_layers/oswindir.c index 3ed1aa90d9..713bc2a4b0 100644 --- a/sys/contrib/dev/acpica/source/os_specific/service_layers/oswindir.c +++ b/sys/contrib/dev/acpica/source/os_specific/service_layers/oswindir.c @@ -106,6 +106,7 @@ AcpiOsOpenDirectory ( if (!FullWildcardSpec) { printf ("Could not allocate buffer for wildcard pathname\n"); + free (SearchInfo); return (NULL); } diff --git a/sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c b/sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c index a1a073ad0b..ebb007edea 100644 --- a/sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c +++ b/sys/contrib/dev/acpica/source/os_specific/service_layers/oswinxf.c @@ -238,10 +238,6 @@ AcpiOsTableOverride ( ACPI_TABLE_HEADER *ExistingTable, ACPI_TABLE_HEADER **NewTable) { -#ifdef ACPI_ASL_COMPILER - ACPI_STATUS Status; - ACPI_PHYSICAL_ADDRESS Address; -#endif if (!ExistingTable || !NewTable) { @@ -258,29 +254,6 @@ AcpiOsTableOverride ( AeTableOverride (ExistingTable, NewTable); #endif - -#ifdef ACPI_ASL_COMPILER - - /* Attempt to get the table from the registry */ - - /* Construct a null-terminated string from table signature */ - - ACPI_MOVE_NAME (TableName, ExistingTable->Signature); - TableName[ACPI_NAME_SIZE] = 0; - - Status = AcpiOsGetTableByName (TableName, 0, NewTable, &Address); - if (ACPI_SUCCESS (Status)) - { - AcpiOsPrintf ("Table [%s] obtained from registry, %u bytes\n", - TableName, (*NewTable)->Length); - } - else - { - AcpiOsPrintf ("Could not read table %s from registry (%s)\n", - TableName, AcpiFormatException (Status)); - } -#endif - return (AE_OK); } diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h b/sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h index c27338d3d5..5f65795929 100644 --- a/sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h +++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aecommon.h @@ -63,6 +63,8 @@ #include #include +#pragma pack(push) /* Set default struct packing */ + extern BOOLEAN AcpiGbl_IgnoreErrors; extern UINT8 AcpiGbl_RegionFillValue; extern UINT8 AcpiGbl_UseHwReducedFadt; @@ -196,4 +198,7 @@ AeGlobalEventHandler ( UINT32 EventNumber, void *Context); + +#pragma pack(pop) /* Restore original struct packing */ + #endif /* _AECOMMON */ diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c index e76e7b9b01..4bf11ccdc0 100644 --- a/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c +++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aeexec.c @@ -287,7 +287,7 @@ AeTestPackageArgument ( PkgElements[3].Package.Count = 2; PkgElements[3].Package.Elements = Pkg2Elements; - /* Sub-package elements */ + /* Subpackage elements */ Pkg2Elements[0].Type = ACPI_TYPE_INTEGER; Pkg2Elements[0].Integer.Value = 0xAAAABBBB; diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c index d42b1c080c..faffdd9f26 100644 --- a/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c +++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aehandlers.c @@ -1507,7 +1507,7 @@ AeRegionHandler ( BufferResize = TRUE; } - else if ((BaseAddressEnd >= RegionAddress) && + else if ((BaseAddressEnd >= RegionAddress) && (BaseAddressEnd <= RegionAddressEnd) && (BaseAddress < RegionAddress)) { diff --git a/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c b/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c index 165e512d7b..3aa9343af2 100644 --- a/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c +++ b/sys/contrib/dev/acpica/source/tools/acpiexec/aemain.c @@ -126,13 +126,13 @@ usage ( ACPI_OPTION ("-di", "Disable execution of STA/INI methods during init"); ACPI_OPTION ("-do", "Disable Operation Region address simulation"); ACPI_OPTION ("-dr", "Disable repair of method return values"); + ACPI_OPTION ("-ds", "Disable method auto-serialization"); ACPI_OPTION ("-dt", "Disable allocation tracking (performance)"); printf ("\n"); ACPI_OPTION ("-ef", "Enable display of final memory statistics"); ACPI_OPTION ("-ei", "Enable additional tests for ACPICA interfaces"); ACPI_OPTION ("-el", "Enable loading of additional test tables"); - ACPI_OPTION ("-em", "Enable Interpreter Serialized Mode"); ACPI_OPTION ("-es", "Enable Interpreter Slack Mode"); ACPI_OPTION ("-et", "Enable debug semaphore timeout"); printf ("\n"); @@ -204,6 +204,11 @@ AeDoOptions ( AcpiGbl_DisableAutoRepair = TRUE; break; + case 's': + + AcpiGbl_AutoSerializeMethods = FALSE; + break; + case 't': #ifdef ACPI_DBG_TRACK_ALLOCATIONS @@ -239,12 +244,6 @@ AeDoOptions ( AcpiGbl_LoadTestTables = TRUE; break; - case 'm': - - AcpiGbl_AllMethodsSerialized = TRUE; - printf ("Enabling AML Interpreter serialized mode\n"); - break; - case 's': AcpiGbl_EnableInterpreterSlack = TRUE; diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 17f4b99b09..e76ac7c579 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -228,14 +228,12 @@ SYSCTL_STRING(_debug_acpi, OID_AUTO, acpi_ca_version, CTLFLAG_RD, acpi_ca_version, 0, "Version of Intel ACPI-CA"); /* - * Allow override of whether methods execute in parallel or not. - * Enable this for serial behavior, which fixes "AE_ALREADY_EXISTS" - * errors for AML that really can't handle parallel method execution. - * It is off by default since this breaks recursive methods and - * some IBMs use such code. + * Disable the control method auto-serialization mechanism that was added + * in 20140214 and superseded the previous AcpiGbl_SerializeAllMethods + * option. */ -static int acpi_serialize_methods; -TUNABLE_INT("hw.acpi.serialize_methods", &acpi_serialize_methods); +static int acpi_auto_serialize_methods = 1; +TUNABLE_INT("hw.acpi.auto_serialize_methods", &acpi_auto_serialize_methods); /* Power devices off and on in suspend and resume. XXX Remove once tested. */ static int acpi_do_powerstate = 1; @@ -446,7 +444,7 @@ acpi_attach(device_t dev) * Set the globals from our tunables. This is needed because ACPI-CA * uses UINT8 for some values and we have no tunable_byte. */ - AcpiGbl_AllMethodsSerialized = acpi_serialize_methods; + AcpiGbl_AutoSerializeMethods = acpi_auto_serialize_methods; AcpiGbl_EnableInterpreterSlack = TRUE; /* Start up the ACPI CA subsystem. */ -- 2.41.0