aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2018-03-14 19:17:38 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2018-03-14 19:17:38 +0000
commite44d3d8ceb12ae786d331468fe4acf41a4af5424 (patch)
treea0c9c4018920a4690d41c0de4de76527c5f4f090
parent04f27355c01cb894338c3382792c0c2b75c86239 (diff)
downloadsrc-e44d3d8ceb12ae786d331468fe4acf41a4af5424.tar.gz
src-e44d3d8ceb12ae786d331468fe4acf41a4af5424.zip
Import ACPICA 20180313.vendor/acpica/20180313
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=330941 svn path=/vendor-sys/acpica/20180313/; revision=330942; tag=vendor/acpica/20180313
-rw-r--r--changes.txt46
-rw-r--r--source/components/debugger/dbdisply.c5
-rw-r--r--source/components/dispatcher/dspkginit.c33
-rw-r--r--source/components/events/evevent.c9
-rw-r--r--source/components/events/evgpe.c238
-rw-r--r--source/components/events/evgpeblk.c20
-rw-r--r--source/components/events/evrgnini.c5
-rw-r--r--source/components/events/evxface.c9
-rw-r--r--source/components/events/evxfgpe.c31
-rw-r--r--source/components/executer/exdebug.c7
-rw-r--r--source/components/hardware/hwgpe.c1
-rw-r--r--source/components/hardware/hwsleep.c12
-rw-r--r--source/components/hardware/hwxfsleep.c2
-rw-r--r--source/components/namespace/nsdumpdv.c5
-rw-r--r--source/components/namespace/nseval.c24
-rw-r--r--source/components/namespace/nsload.c24
-rw-r--r--source/components/namespace/nsparse.c26
-rw-r--r--source/components/namespace/nsxfname.c22
-rw-r--r--source/components/parser/psargs.c3
-rw-r--r--source/components/parser/psloop.c24
-rw-r--r--source/components/parser/psobject.c6
-rw-r--r--source/components/tables/tbdata.c18
-rw-r--r--source/components/tables/tbinstal.c6
-rw-r--r--source/components/tables/tbxfload.c13
-rw-r--r--source/components/utilities/utosi.c1
-rw-r--r--source/components/utilities/utxfinit.c48
-rw-r--r--source/include/acevents.h21
-rw-r--r--source/include/acmacros.h4
-rw-r--r--source/include/acpixf.h19
-rw-r--r--source/include/actypes.h27
-rw-r--r--source/include/platform/aclinux.h1
-rw-r--r--source/tools/acpiexec/aemain.c51
-rw-r--r--source/tools/acpiexec/aetables.c16
-rw-r--r--source/tools/acpinames/anmain.c40
-rw-r--r--source/tools/acpinames/anstubs.c43
-rw-r--r--source/tools/acpinames/antables.c6
-rw-r--r--source/tools/acpisrc/acpisrc.h10
-rw-r--r--source/tools/acpisrc/asconvrt.c39
-rw-r--r--source/tools/acpisrc/asfile.c7
-rw-r--r--source/tools/acpisrc/astable.c15
-rw-r--r--source/tools/acpisrc/asutils.c9
41 files changed, 628 insertions, 318 deletions
diff --git a/changes.txt b/changes.txt
index 61afab31cb20..855f3612e9ec 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,50 @@
----------------------------------------
+13 March 2018. Summary of changes for version 20180313:
+
+
+1) ACPICA kernel-resident subsystem:
+
+Implemented various improvements to the GPE support:
+
+1) Dispatch all active GPEs at initialization time so that no GPEs are
+lost.
+2) Enable runtime GPEs earlier. Some systems expect GPEs to be enabled
+before devices are enumerated.
+3) Don't unconditionally clear ACPI IRQs during suspend/resume, so that
+IRQs are not lost.
+4) Add parallel GPE handling to eliminate the possibility of dispatching
+the same GPE twice.
+5) Dispatch any pending GPEs after enabling for the first time.
+
+AcpiGetObjectInfo - removed support for the _STA method. This was causing
+problems on some platforms.
+
+Added a new _OSI string, "Windows 2017.2".
+
+Cleaned up and simplified the module-level code support. These changes
+are in preparation for the eventual removal of the legacy MLC support
+(deferred execution), replaced by the new MLC architecture which executes
+the MLC as a table is loaded (DSDT/SSDTs).
+
+Changed a compile-time option to a runtime option. Changes the option to
+ignore ACPI table load-time package resolution errors into a runtime
+option. Used only for platforms that generate many AE_NOT_FOUND errors
+during boot. AcpiGbl_IgnorePackageResolutionErrors.
+
+Fixed the ACPI_ERROR_NAMESPACE macro. This change involves putting some
+ACPI_ERROR_NAMESPACE parameters inside macros. By doing so, we avoid
+compilation errors from unused variables (seen with some compilers).
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+ASLTS: parallelized execution in order to achieve an (approximately) 2X
+performance increase.
+
+ASLTS: Updated to use the iASL __LINE__ and __METHOD__ macros. Improves
+error reporting.
+
+----------------------------------------
09 February 2018. Summary of changes for version 20180209:
diff --git a/source/components/debugger/dbdisply.c b/source/components/debugger/dbdisply.c
index 02b7643339c6..c1c81051e439 100644
--- a/source/components/debugger/dbdisply.c
+++ b/source/components/debugger/dbdisply.c
@@ -820,9 +820,8 @@ AcpiDbDisplayObjectType (
return;
}
- AcpiOsPrintf ("ADR: %8.8X%8.8X, STA: %8.8X, Flags: %X\n",
- ACPI_FORMAT_UINT64 (Info->Address),
- Info->CurrentStatus, Info->Flags);
+ AcpiOsPrintf ("ADR: %8.8X%8.8X, Flags: %X\n",
+ ACPI_FORMAT_UINT64 (Info->Address), Info->Flags);
AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X\n",
Info->HighestDstates[0], Info->HighestDstates[1],
diff --git a/source/components/dispatcher/dspkginit.c b/source/components/dispatcher/dspkginit.c
index a034df0dbff8..9e1cd6115fd4 100644
--- a/source/components/dispatcher/dspkginit.c
+++ b/source/components/dispatcher/dspkginit.c
@@ -546,34 +546,33 @@ AcpiDsResolvePackageElement (
ScopeInfo.Scope.Node = Element->Reference.Node; /* Prefix node */
- Status = AcpiNsLookup (&ScopeInfo,
- (char *) Element->Reference.Aml, /* Pointer to AML path */
+ Status = AcpiNsLookup (&ScopeInfo, (char *) Element->Reference.Aml,
ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
NULL, &ResolvedNode);
if (ACPI_FAILURE (Status))
{
-#if defined ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS && !defined ACPI_APPLICATION
- /*
- * For the kernel-resident ACPICA, optionally be silent about the
- * NOT_FOUND case. Although this is potentially a serious problem,
- * it can generate a lot of noise/errors on platforms whose
- * firmware carries around a bunch of unused Package objects.
- * To disable these errors, define ACPI_IGNORE_PACKAGE_RESOLUTION_ERRORS
- * in the OS-specific header.
- *
- * All errors are always reported for ACPICA applications such as
- * AcpiExec.
- */
- if (Status == AE_NOT_FOUND)
+ if ((Status == AE_NOT_FOUND) && AcpiGbl_IgnorePackageResolutionErrors)
{
- /* Reference name not found, set the element to NULL */
+ /*
+ * Optionally be silent about the NOT_FOUND case for the referenced
+ * name. Although this is potentially a serious problem,
+ * it can generate a lot of noise/errors on platforms whose
+ * firmware carries around a bunch of unused Package objects.
+ * To disable these errors, set this global to TRUE:
+ * AcpiGbl_IgnorePackageResolutionErrors
+ *
+ * If the AML actually tries to use such a package, the unresolved
+ * element(s) will be replaced with NULL elements.
+ */
+
+ /* Referenced name not found, set the element to NULL */
AcpiUtRemoveReference (*ElementPtr);
*ElementPtr = NULL;
return_VOID;
}
-#endif
+
Status2 = AcpiNsExternalizeName (ACPI_UINT32_MAX,
(char *) Element->Reference.Aml, NULL, &ExternalPath);
diff --git a/source/components/events/evevent.c b/source/components/events/evevent.c
index 755ab9935e73..791ee57ebec8 100644
--- a/source/components/events/evevent.c
+++ b/source/components/events/evevent.c
@@ -344,6 +344,7 @@ AcpiEvFixedEventDetect (
UINT32 FixedStatus;
UINT32 FixedEnable;
UINT32 i;
+ ACPI_STATUS Status;
ACPI_FUNCTION_NAME (EvFixedEventDetect);
@@ -353,8 +354,12 @@ AcpiEvFixedEventDetect (
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
*/
- (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
- (void) AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
+ Status = AcpiHwRegisterRead (ACPI_REGISTER_PM1_STATUS, &FixedStatus);
+ Status |= AcpiHwRegisterRead (ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (IntStatus);
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c
index ccc154787eb4..415df720a1ae 100644
--- a/source/components/events/evgpe.c
+++ b/source/components/events/evgpe.c
@@ -226,7 +226,7 @@ AcpiEvUpdateGpeEnableMask (
*
* RETURN: Status
*
- * DESCRIPTION: Clear a GPE of stale events and enable it.
+ * DESCRIPTION: Enable a GPE.
*
******************************************************************************/
@@ -240,14 +240,6 @@ AcpiEvEnableGpe (
ACPI_FUNCTION_TRACE (EvEnableGpe);
- /* Clear the GPE (of stale events) */
-
- Status = AcpiHwClearGpe (GpeEventInfo);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/* Enable the requested GPE */
Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE);
@@ -542,17 +534,12 @@ UINT32
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList)
{
- ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_NAMESPACE_NODE *GpeDevice;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
UINT32 GpeNumber;
- ACPI_GPE_HANDLER_INFO *GpeHandlerInfo;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
- UINT8 EnabledStatusByte;
- UINT64 StatusReg;
- UINT64 EnableReg;
ACPI_CPU_FLAGS Flags;
UINT32 i;
UINT32 j;
@@ -608,105 +595,25 @@ AcpiEvGpeDetect (
continue;
}
- /* Read the Status Register */
-
- Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- /* Read the Enable Register */
-
- Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
- if (ACPI_FAILURE (Status))
- {
- goto UnlockAndExit;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
- "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, "
- "RunEnable=%02X, WakeEnable=%02X\n",
- GpeRegisterInfo->BaseGpeNumber,
- GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1),
- (UINT32) StatusReg, (UINT32) EnableReg,
- GpeRegisterInfo->EnableForRun,
- GpeRegisterInfo->EnableForWake));
-
- /* Check if there is anything active at all in this register */
-
- EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
- if (!EnabledStatusByte)
- {
- /* No active GPEs in this register, move on */
-
- continue;
- }
-
/* Now look at the individual GPEs in this byte register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
- /* Examine one GPE bit */
+ /* Detect and dispatch one GPE bit */
GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
ACPI_GPE_REGISTER_WIDTH) + j];
GpeNumber = j + GpeRegisterInfo->BaseGpeNumber;
-
- if (EnabledStatusByte & (1 << j))
- {
- /* Invoke global event handler if present */
-
- AcpiGpeCount++;
- if (AcpiGbl_GlobalEventHandler)
- {
- AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE,
- GpeDevice, GpeNumber,
- AcpiGbl_GlobalEventHandlerContext);
- }
-
- /* Found an active GPE */
-
- if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
- ACPI_GPE_DISPATCH_RAW_HANDLER)
- {
- /* Dispatch the event to a raw handler */
-
- GpeHandlerInfo = GpeEventInfo->Dispatch.Handler;
-
- /*
- * There is no protection around the namespace node
- * and the GPE handler to ensure a safe destruction
- * because:
- * 1. The namespace node is expected to always
- * exist after loading a table.
- * 2. The GPE handler is expected to be flushed by
- * AcpiOsWaitEventsComplete() before the
- * destruction.
- */
- AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
- IntStatus |= GpeHandlerInfo->Address (
- GpeDevice, GpeNumber, GpeHandlerInfo->Context);
- Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
- }
- else
- {
- /*
- * Dispatch the event to a standard handler or
- * method.
- */
- IntStatus |= AcpiEvGpeDispatch (GpeDevice,
- GpeEventInfo, GpeNumber);
- }
- }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ IntStatus |= AcpiEvDetectGpe (
+ GpeDevice, GpeEventInfo, GpeNumber);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
}
}
GpeBlock = GpeBlock->Next;
}
-UnlockAndExit:
-
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
@@ -894,6 +801,137 @@ AcpiEvFinishGpe (
/*******************************************************************************
*
+ * FUNCTION: AcpiEvDetectGpe
+ *
+ * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
+ * GpeEventInfo - Info for this GPE
+ * GpeNumber - Number relative to the parent GPE block
+ *
+ * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
+ *
+ * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function
+ * (e.g. EC) or method (e.g. _Lxx/_Exx) handler.
+ * NOTE: GPE is W1C, so it is possible to handle a single GPE from both
+ * task and irq context in parallel as long as the process to
+ * detect and mask the GPE is atomic.
+ * However the atomicity of ACPI_GPE_DISPATCH_RAW_HANDLER is
+ * dependent on the raw handler itself.
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiEvDetectGpe (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber)
+{
+ UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
+ UINT8 EnabledStatusByte;
+ UINT64 StatusReg;
+ UINT64 EnableReg;
+ UINT32 RegisterBit;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ ACPI_GPE_HANDLER_INFO *GpeHandlerInfo;
+ ACPI_CPU_FLAGS Flags;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvGpeDetect);
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ /* Get the info block for the entire GPE register */
+
+ GpeRegisterInfo = GpeEventInfo->RegisterInfo;
+
+ /* Get the register bitmask for this GPE */
+
+ RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo);
+
+ /* GPE currently enabled (enable bit == 1)? */
+
+ Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ /* GPE currently active (status bit == 1)? */
+
+ Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress);
+ if (ACPI_FAILURE (Status))
+ {
+ goto ErrorExit;
+ }
+
+ /* Check if there is anything active at all in this GPE */
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
+ "Read registers for GPE %02X: Status=%02X, Enable=%02X, "
+ "RunEnable=%02X, WakeEnable=%02X\n",
+ GpeNumber,
+ (UINT32) (StatusReg & RegisterBit),
+ (UINT32) (EnableReg & RegisterBit),
+ GpeRegisterInfo->EnableForRun,
+ GpeRegisterInfo->EnableForWake));
+
+ EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
+ if (!(EnabledStatusByte & RegisterBit))
+ {
+ goto ErrorExit;
+ }
+
+ /* Invoke global event handler if present */
+
+ AcpiGpeCount++;
+ if (AcpiGbl_GlobalEventHandler)
+ {
+ AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE,
+ GpeDevice, GpeNumber,
+ AcpiGbl_GlobalEventHandlerContext);
+ }
+
+ /* Found an active GPE */
+
+ if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) ==
+ ACPI_GPE_DISPATCH_RAW_HANDLER)
+ {
+ /* Dispatch the event to a raw handler */
+
+ GpeHandlerInfo = GpeEventInfo->Dispatch.Handler;
+
+ /*
+ * There is no protection around the namespace node
+ * and the GPE handler to ensure a safe destruction
+ * because:
+ * 1. The namespace node is expected to always
+ * exist after loading a table.
+ * 2. The GPE handler is expected to be flushed by
+ * AcpiOsWaitEventsComplete() before the
+ * destruction.
+ */
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ IntStatus |= GpeHandlerInfo->Address (
+ GpeDevice, GpeNumber, GpeHandlerInfo->Context);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ }
+ else
+ {
+ /* Dispatch the event to a standard handler or method. */
+
+ IntStatus |= AcpiEvGpeDispatch (GpeDevice,
+ GpeEventInfo, GpeNumber);
+ }
+
+ErrorExit:
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ return (IntStatus);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvGpeDispatch
*
* PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1
@@ -905,8 +943,6 @@ AcpiEvFinishGpe (
* DESCRIPTION: Dispatch a General Purpose Event to either a function (e.g. EC)
* or method (e.g. _Lxx/_Exx) handler.
*
- * This function executes at interrupt level.
- *
******************************************************************************/
UINT32
diff --git a/source/components/events/evgpeblk.c b/source/components/events/evgpeblk.c
index cf208e6dde92..442f494c459b 100644
--- a/source/components/events/evgpeblk.c
+++ b/source/components/events/evgpeblk.c
@@ -585,7 +585,7 @@ ACPI_STATUS
AcpiEvInitializeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock,
- void *Ignored)
+ void *Context)
{
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
@@ -593,6 +593,8 @@ AcpiEvInitializeGpeBlock (
UINT32 GpeIndex;
UINT32 i;
UINT32 j;
+ BOOLEAN *IsPollingNeeded = Context;
+ ACPI_ERROR_ONLY (UINT32 GpeNumber);
ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
@@ -622,14 +624,14 @@ AcpiEvInitializeGpeBlock (
GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j;
GpeEventInfo = &GpeBlock->EventInfo[GpeIndex];
+ ACPI_ERROR_ONLY(GpeNumber = GpeBlock->BlockBaseNumber + GpeIndex);
+ GpeEventInfo->Flags |= ACPI_GPE_INITIALIZED;
/*
* Ignore GPEs that have no corresponding _Lxx/_Exx method
* and GPEs that are used to wake the system
*/
- if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_NONE) ||
- (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_HANDLER) ||
- (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == ACPI_GPE_DISPATCH_RAW_HANDLER) ||
+ if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_METHOD) ||
(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
{
continue;
@@ -640,10 +642,18 @@ AcpiEvInitializeGpeBlock (
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not enable GPE 0x%02X",
- GpeIndex + GpeBlock->BlockBaseNumber));
+ GpeNumber));
continue;
}
+ GpeEventInfo->Flags |= ACPI_GPE_AUTO_ENABLED;
+
+ if (IsPollingNeeded &&
+ ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
+ {
+ *IsPollingNeeded = TRUE;
+ }
+
GpeEnabledCount++;
}
}
diff --git a/source/components/events/evrgnini.c b/source/components/events/evrgnini.c
index 8dd9767cb0b7..678b23ccf6a5 100644
--- a/source/components/events/evrgnini.c
+++ b/source/components/events/evrgnini.c
@@ -736,9 +736,12 @@ AcpiEvInitializeRegion (
* Node's object was replaced by this Method object and we
* saved the handler in the method object.
*
+ * Note: Only used for the legacy MLC support. Will
+ * be removed in the future.
+ *
* See AcpiNsExecModuleCode
*/
- if (!AcpiGbl_ParseTableAsTermList &&
+ if (!AcpiGbl_ExecuteTablesAsMethods &&
ObjDesc->Method.InfoFlags & ACPI_METHOD_MODULE_LEVEL)
{
HandlerObj = ObjDesc->Method.Dispatch.Handler;
diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c
index 1c281d5f06e7..ba5e9c45fec2 100644
--- a/source/components/events/evxface.c
+++ b/source/components/events/evxface.c
@@ -1257,6 +1257,15 @@ AcpiRemoveGpeHandler (
Handler->OriginallyEnabled)
{
(void) AcpiEvAddGpeReference (GpeEventInfo);
+ if (ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
+ {
+ /* Poll edge triggered GPEs to handle existing events */
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ (void) AcpiEvDetectGpe (
+ GpeDevice, GpeEventInfo, GpeNumber);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ }
}
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c
index 1a76256d8cab..bd2a0e28636f 100644
--- a/source/components/events/evxfgpe.c
+++ b/source/components/events/evxfgpe.c
@@ -188,6 +188,7 @@ AcpiUpdateAllGpes (
void)
{
ACPI_STATUS Status;
+ BOOLEAN IsPollingNeeded = FALSE;
ACPI_FUNCTION_TRACE (AcpiUpdateAllGpes);
@@ -204,7 +205,8 @@ AcpiUpdateAllGpes (
goto UnlockAndExit;
}
- Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock, NULL);
+ Status = AcpiEvWalkGpeList (AcpiEvInitializeGpeBlock,
+ &IsPollingNeeded);
if (ACPI_SUCCESS (Status))
{
AcpiGbl_AllGpesInitialized = TRUE;
@@ -212,6 +214,13 @@ AcpiUpdateAllGpes (
UnlockAndExit:
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+
+ if (IsPollingNeeded && AcpiGbl_AllGpesInitialized)
+ {
+ /* Poll GPEs to handle already triggered events */
+
+ AcpiEvGpeDetect (AcpiGbl_GpeXruptListHead);
+ }
return_ACPI_STATUS (Status);
}
@@ -259,6 +268,16 @@ AcpiEnableGpe (
ACPI_GPE_DISPATCH_NONE)
{
Status = AcpiEvAddGpeReference (GpeEventInfo);
+ if (ACPI_SUCCESS (Status) &&
+ ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo))
+ {
+ /* Poll edge-triggered GPEs to handle existing events */
+
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ (void) AcpiEvDetectGpe (
+ GpeDevice, GpeEventInfo, GpeNumber);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ }
}
else
{
@@ -609,6 +628,16 @@ AcpiSetupGpeForWake (
GpeEventInfo->Flags =
(ACPI_GPE_DISPATCH_NOTIFY | ACPI_GPE_LEVEL_TRIGGERED);
}
+ else if (GpeEventInfo->Flags & ACPI_GPE_AUTO_ENABLED)
+ {
+ /*
+ * A reference to this GPE has been added during the GPE block
+ * initialization, so drop it now to prevent the GPE from being
+ * permanently enabled and clear its ACPI_GPE_AUTO_ENABLED flag.
+ */
+ (void) AcpiEvRemoveGpeReference (GpeEventInfo);
+ GpeEventInfo->Flags &= ~~ACPI_GPE_AUTO_ENABLED;
+ }
/*
* If we already have an implicit notify on this GPE, add
diff --git a/source/components/executer/exdebug.c b/source/components/executer/exdebug.c
index 758c1d1d70e4..b471cfcc8c76 100644
--- a/source/components/executer/exdebug.c
+++ b/source/components/executer/exdebug.c
@@ -204,15 +204,14 @@ AcpiExDoDebugObject (
return_VOID;
}
- /* Null string or newline -- don't emit the line header */
+ /* Newline -- don't emit the line header */
if (SourceDesc &&
(ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) &&
(SourceDesc->Common.Type == ACPI_TYPE_STRING))
{
- if ((SourceDesc->String.Length == 0) ||
- ((SourceDesc->String.Length == 1) &&
- (*SourceDesc->String.Pointer == '\n')))
+ if ((SourceDesc->String.Length == 1) &&
+ (*SourceDesc->String.Pointer == '\n'))
{
AcpiOsPrintf ("\n");
return_VOID;
diff --git a/source/components/hardware/hwgpe.c b/source/components/hardware/hwgpe.c
index 1227bbf6161e..581fcb9996a6 100644
--- a/source/components/hardware/hwgpe.c
+++ b/source/components/hardware/hwgpe.c
@@ -658,7 +658,6 @@ AcpiHwDisableAllGpes (
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
- Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
return_ACPI_STATUS (Status);
}
diff --git a/source/components/hardware/hwsleep.c b/source/components/hardware/hwsleep.c
index 947d666e6c80..fe111872cec0 100644
--- a/source/components/hardware/hwsleep.c
+++ b/source/components/hardware/hwsleep.c
@@ -198,16 +198,8 @@ AcpiHwLegacySleep (
return_ACPI_STATUS (Status);
}
- /* Clear all fixed and general purpose status bits */
-
- Status = AcpiHwClearAcpiStatus ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
/*
- * 1) Disable/Clear all GPEs
+ * 1) Disable all GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwDisableAllGpes ();
@@ -427,7 +419,7 @@ AcpiHwLegacyWake (
* might get fired there
*
* Restore the GPEs:
- * 1) Disable/Clear all GPEs
+ * 1) Disable all GPEs
* 2) Enable all runtime GPEs
*/
Status = AcpiHwDisableAllGpes ();
diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c
index 7536c38c280e..8ebb8c1d22c5 100644
--- a/source/components/hardware/hwxfsleep.c
+++ b/source/components/hardware/hwxfsleep.c
@@ -337,7 +337,7 @@ AcpiEnterSleepStateS4bios (
}
/*
- * 1) Disable/Clear all GPEs
+ * 1) Disable all GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwDisableAllGpes ();
diff --git a/source/components/namespace/nsdumpdv.c b/source/components/namespace/nsdumpdv.c
index 92a772f2aa1c..6ab5ba5214e5 100644
--- a/source/components/namespace/nsdumpdv.c
+++ b/source/components/namespace/nsdumpdv.c
@@ -208,9 +208,8 @@ AcpiNsDumpOneDevice (
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_TABLES,
- " HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
- Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address),
- Info->CurrentStatus));
+ " HID: %s, ADR: %8.8X%8.8X\n",
+ Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address)));
ACPI_FREE (Info);
}
diff --git a/source/components/namespace/nseval.c b/source/components/namespace/nseval.c
index b1e1af9a15ca..2a7eb8f595ad 100644
--- a/source/components/namespace/nseval.c
+++ b/source/components/namespace/nseval.c
@@ -429,6 +429,16 @@ AcpiNsEvaluate (
Status = AE_OK;
}
+ else if (ACPI_FAILURE(Status))
+ {
+ /* If ReturnObject exists, delete it */
+
+ if (Info->ReturnObject)
+ {
+ AcpiUtRemoveReference (Info->ReturnObject);
+ Info->ReturnObject = NULL;
+ }
+ }
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"*** Completed evaluation of object %s ***\n",
@@ -457,6 +467,17 @@ Cleanup:
* DESCRIPTION: Execute all elements of the global module-level code list.
* Each element is executed as a single control method.
*
+ * NOTE: With this option enabled, each block of detected executable AML
+ * code that is outside of any control method is wrapped with a temporary
+ * control method object and placed on a global list. The methods on this
+ * list are executed below.
+ *
+ * This function executes the module-level code for all tables only after
+ * all of the tables have been loaded. It is a legacy option and is
+ * not compatible with other ACPI implementations. See AcpiNsLoadTable.
+ *
+ * This function will be removed when the legacy option is removed.
+ *
******************************************************************************/
void
@@ -477,6 +498,9 @@ AcpiNsExecModuleCodeList (
Next = AcpiGbl_ModuleCodeList;
if (!Next)
{
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT_NAMES,
+ "Legacy MLC block list is empty\n"));
+
return_VOID;
}
diff --git a/source/components/namespace/nsload.c b/source/components/namespace/nsload.c
index ad00d92fca8a..698d3a572326 100644
--- a/source/components/namespace/nsload.c
+++ b/source/components/namespace/nsload.c
@@ -270,23 +270,17 @@ Unlock:
"**** Completed Table Object Initialization\n"));
/*
- * Execute any module-level code that was detected during the table load
- * phase. Although illegal since ACPI 2.0, there are many machines that
- * contain this type of code. Each block of detected executable AML code
- * outside of any control method is wrapped with a temporary control
- * method object and placed on a global list. The methods on this list
- * are executed below.
+ * This case handles the legacy option that groups all module-level
+ * code blocks together and defers execution until all of the tables
+ * are loaded. Execute all of these blocks at this time.
+ * Execute any module-level code that was detected during the table
+ * load phase.
*
- * This case executes the module-level code for each table immediately
- * after the table has been loaded. This provides compatibility with
- * other ACPI implementations. Optionally, the execution can be deferred
- * until later, see AcpiInitializeObjects.
+ * Note: this option is deprecated and will be eliminated in the
+ * future. Use of this option can cause problems with AML code that
+ * depends upon in-order immediate execution of module-level code.
*/
- if (!AcpiGbl_ParseTableAsTermList && !AcpiGbl_GroupModuleLevelCode)
- {
- AcpiNsExecModuleCodeList ();
- }
-
+ AcpiNsExecModuleCodeList ();
return_ACPI_STATUS (Status);
}
diff --git a/source/components/namespace/nsparse.c b/source/components/namespace/nsparse.c
index bb24bab91a8d..8e86ee4c5de9 100644
--- a/source/components/namespace/nsparse.c
+++ b/source/components/namespace/nsparse.c
@@ -171,8 +171,17 @@
*
* RETURN: Status
*
- * DESCRIPTION: Load ACPI/AML table by executing the entire table as a
- * TermList.
+ * DESCRIPTION: Load ACPI/AML table by executing the entire table as a single
+ * large control method.
+ *
+ * NOTE: The point of this is to execute any module-level code in-place
+ * as the table is parsed. Some AML code depends on this behavior.
+ *
+ * It is a run-time option at this time, but will eventually become
+ * the default.
+ *
+ * Note: This causes the table to only have a single-pass parse.
+ * However, this is compatible with other ACPI implementations.
*
******************************************************************************/
@@ -403,8 +412,19 @@ AcpiNsParseTable (
ACPI_FUNCTION_TRACE (NsParseTable);
- if (AcpiGbl_ParseTableAsTermList)
+ if (AcpiGbl_ExecuteTablesAsMethods)
{
+ /*
+ * This case executes the AML table as one large control method.
+ * The point of this is to execute any module-level code in-place
+ * as the table is parsed. Some AML code depends on this behavior.
+ *
+ * It is a run-time option at this time, but will eventually become
+ * the default.
+ *
+ * Note: This causes the table to only have a single-pass parse.
+ * However, this is compatible with other ACPI implementations.
+ */
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_PARSE,
"%s: **** Start table execution pass\n", ACPI_GET_FUNCTION_NAME));
diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c
index d5b32eda9ca9..f94c0e45de03 100644
--- a/source/components/namespace/nsxfname.c
+++ b/source/components/namespace/nsxfname.c
@@ -376,7 +376,7 @@ AcpiNsCopyDeviceId (
* namespace node and possibly by running several standard
* control methods (Such as in the case of a device.)
*
- * For Device and Processor objects, run the Device _HID, _UID, _CID, _STA,
+ * For Device and Processor objects, run the Device _HID, _UID, _CID,
* _CLS, _ADR, _SxW, and _SxD methods.
*
* Note: Allocates the return buffer, must be freed by the caller.
@@ -385,8 +385,9 @@ AcpiNsCopyDeviceId (
* discovery namespace traversal. Therefore, no complex methods can be
* executed, especially those that access operation regions. Therefore, do
* not add any additional methods that could cause problems in this area.
- * this was the fate of the _SUB method which was found to cause such
- * problems and was removed (11/2015).
+ * Because of this reason support for the following methods has been removed:
+ * 1) _SUB method was removed (11/2015)
+ * 2) _STA method was removed (02/2018)
*
******************************************************************************/
@@ -517,26 +518,13 @@ AcpiGetObjectInfo (
{
/*
* Get extra info for ACPI Device/Processor objects only:
- * Run the _STA, _ADR and, SxW, and _SxD methods.
+ * Run the _ADR and, SxW, and _SxD methods.
*
* Notes: none of these methods are required, so they may or may
* not be present for this device. The Info->Valid bitfield is used
* to indicate which methods were found and run successfully.
- *
- * For _STA, if the method does not exist, then (as per the ACPI
- * specification), the returned CurrentStatus flags will indicate
- * that the device is present/functional/enabled. Otherwise, the
- * CurrentStatus flags reflect the value returned from _STA.
*/
- /* Execute the Device._STA method */
-
- Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus);
- if (ACPI_SUCCESS (Status))
- {
- Valid |= ACPI_VALID_STA;
- }
-
/* Execute the Device._ADR method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node,
diff --git a/source/components/parser/psargs.c b/source/components/parser/psargs.c
index c9c173717e38..fba20f08e5a8 100644
--- a/source/components/parser/psargs.c
+++ b/source/components/parser/psargs.c
@@ -1051,6 +1051,9 @@ AcpiPsGetNextArg (
if (Arg->Common.AmlOpcode == AML_INT_METHODCALL_OP)
{
+ /* Free method call op and corresponding namestring sub-ob */
+
+ AcpiPsFreeOp (Arg->Common.Value.Arg);
AcpiPsFreeOp (Arg);
Arg = NULL;
WalkState->ArgCount = 1;
diff --git a/source/components/parser/psloop.c b/source/components/parser/psloop.c
index 74e8f0d6ebda..28d17962bafb 100644
--- a/source/components/parser/psloop.c
+++ b/source/components/parser/psloop.c
@@ -287,10 +287,18 @@ AcpiPsGetArguments (
WalkState->ArgCount, WalkState->PassNumber));
/*
- * Handle executable code at "module-level". This refers to
- * executable opcodes that appear outside of any control method.
+ * This case handles the legacy option that groups all module-level
+ * code blocks together and defers execution until all of the tables
+ * are loaded. Execute all of these blocks at this time.
+ * Execute any module-level code that was detected during the table
+ * load phase.
+ *
+ * Note: this option is deprecated and will be eliminated in the
+ * future. Use of this option can cause problems with AML code that
+ * depends upon in-order immediate execution of module-level code.
*/
- if ((WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2) &&
+ if (AcpiGbl_GroupModuleLevelCode &&
+ (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2) &&
((WalkState->ParseFlags & ACPI_PARSE_DISASSEMBLE) == 0))
{
/*
@@ -440,6 +448,16 @@ AcpiPsGetArguments (
* object to the global list. Note, the mutex field of the method
* object is used to link multiple module-level code objects.
*
+ * NOTE: In this legacy option, each block of detected executable AML
+ * code that is outside of any control method is wrapped with a temporary
+ * control method object and placed on a global list below.
+ *
+ * This function executes the module-level code for all tables only after
+ * all of the tables have been loaded. It is a legacy option and is
+ * not compatible with other ACPI implementations. See AcpiNsLoadTable.
+ *
+ * This function will be removed when the legacy option is removed.
+ *
******************************************************************************/
static void
diff --git a/source/components/parser/psobject.c b/source/components/parser/psobject.c
index b07b99f6a121..63e2b3b1ab8a 100644
--- a/source/components/parser/psobject.c
+++ b/source/components/parser/psobject.c
@@ -182,7 +182,7 @@ static ACPI_STATUS
AcpiPsGetAmlOpcode (
ACPI_WALK_STATE *WalkState)
{
- UINT32 AmlOffset;
+ ACPI_ERROR_ONLY (UINT32 AmlOffset);
ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState);
@@ -217,8 +217,8 @@ AcpiPsGetAmlOpcode (
if (WalkState->PassNumber == 2)
{
- AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
- WalkState->ParserState.AmlStart);
+ ACPI_ERROR_ONLY(AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml,
+ WalkState->ParserState.AmlStart));
ACPI_ERROR ((AE_INFO,
"Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring",
diff --git a/source/components/tables/tbdata.c b/source/components/tables/tbdata.c
index 7f0286a8c5f6..61a2d340d56d 100644
--- a/source/components/tables/tbdata.c
+++ b/source/components/tables/tbdata.c
@@ -1190,12 +1190,18 @@ AcpiTbLoadTable (
Status = AcpiNsLoadTable (TableIndex, ParentNode);
- /* Execute any module-level code that was found in the table */
-
- if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
- {
- AcpiNsExecModuleCodeList ();
- }
+ /*
+ * This case handles the legacy option that groups all module-level
+ * code blocks together and defers execution until all of the tables
+ * are loaded. Execute all of these blocks at this time.
+ * Execute any module-level code that was detected during the table
+ * load phase.
+ *
+ * Note: this option is deprecated and will be eliminated in the
+ * future. Use of this option can cause problems with AML code that
+ * depends upon in-order immediate execution of module-level code.
+ */
+ AcpiNsExecModuleCodeList ();
/*
* Update GPEs for any new _Lxx/_Exx methods. Ignore errors. The host is
diff --git a/source/components/tables/tbinstal.c b/source/components/tables/tbinstal.c
index e5d5692c8f8c..639448031083 100644
--- a/source/components/tables/tbinstal.c
+++ b/source/components/tables/tbinstal.c
@@ -356,11 +356,11 @@ AcpiTbOverrideTable (
ACPI_TABLE_DESC *OldTableDesc)
{
ACPI_STATUS Status;
- char *OverrideType;
ACPI_TABLE_DESC NewTableDesc;
ACPI_TABLE_HEADER *Table;
ACPI_PHYSICAL_ADDRESS Address;
UINT32 Length;
+ ACPI_ERROR_ONLY (char *OverrideType);
/* (1) Attempt logical override (returns a logical address) */
@@ -370,7 +370,7 @@ AcpiTbOverrideTable (
{
AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table),
ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL);
- OverrideType = "Logical";
+ ACPI_ERROR_ONLY (OverrideType = "Logical");
goto FinishOverride;
}
@@ -382,7 +382,7 @@ AcpiTbOverrideTable (
{
AcpiTbAcquireTempTable (&NewTableDesc, Address,
ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL);
- OverrideType = "Physical";
+ ACPI_ERROR_ONLY (OverrideType = "Physical");
goto FinishOverride;
}
diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c
index 7103f4a992d3..0119b684579f 100644
--- a/source/components/tables/tbxfload.c
+++ b/source/components/tables/tbxfload.c
@@ -219,13 +219,16 @@ AcpiLoadTables (
"While loading namespace from ACPI tables"));
}
- if (AcpiGbl_ParseTableAsTermList || !AcpiGbl_GroupModuleLevelCode)
+ if (AcpiGbl_ExecuteTablesAsMethods || !AcpiGbl_GroupModuleLevelCode)
{
/*
- * Initialize the objects that remain uninitialized. This
- * runs the executable AML that may be part of the
- * declaration of these objects:
- * OperationRegions, BufferFields, Buffers, and Packages.
+ * If the module-level code support is enabled, initialize the objects
+ * in the namespace that remain uninitialized. This runs the executable
+ * AML that may be part of the declaration of these name objects:
+ * OperationRegions, BufferFields, Buffers, and Packages.
+ *
+ * Note: The module-level code is optional at this time, but will
+ * become the default in the future.
*/
Status = AcpiNsInitializeObjects ();
if (ACPI_FAILURE (Status))
diff --git a/source/components/utilities/utosi.c b/source/components/utilities/utosi.c
index c408ec7681f7..e63690786417 100644
--- a/source/components/utilities/utosi.c
+++ b/source/components/utilities/utosi.c
@@ -216,6 +216,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] =
{"Windows 2015", NULL, 0, ACPI_OSI_WIN_10}, /* Windows 10 - Added 03/2015 */
{"Windows 2016", NULL, 0, ACPI_OSI_WIN_10_RS1}, /* Windows 10 version 1607 - Added 12/2017 */
{"Windows 2017", NULL, 0, ACPI_OSI_WIN_10_RS2}, /* Windows 10 version 1703 - Added 12/2017 */
+ {"Windows 2017.2", NULL, 0, ACPI_OSI_WIN_10_RS3}, /* Windows 10 version 1709 - Added 02/2018 */
/* Feature Group Strings */
diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c
index f79ac6f8c7a4..d24b6aa22e0d 100644
--- a/source/components/utilities/utxfinit.c
+++ b/source/components/utilities/utxfinit.c
@@ -381,43 +381,31 @@ AcpiInitializeObjects (
ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
-#ifdef ACPI_EXEC_APP
/*
- * This call implements the "initialization file" option for AcpiExec.
- * This is the precise point that we want to perform the overrides.
+ * This case handles the legacy option that groups all module-level
+ * code blocks together and defers execution until all of the tables
+ * are loaded. Execute all of these blocks at this time.
+ * Execute any module-level code that was detected during the table
+ * load phase.
+ *
+ * Note: this option is deprecated and will be eliminated in the
+ * future. Use of this option can cause problems with AML code that
+ * depends upon in-order immediate execution of module-level code.
*/
- AeDoObjectOverrides ();
-#endif
+ AcpiNsExecModuleCodeList ();
/*
- * Execute any module-level code that was detected during the table load
- * phase. Although illegal since ACPI 2.0, there are many machines that
- * contain this type of code. Each block of detected executable AML code
- * outside of any control method is wrapped with a temporary control
- * method object and placed on a global list. The methods on this list
- * are executed below.
- *
- * This case executes the module-level code for all tables only after
- * all of the tables have been loaded. It is a legacy option and is
- * not compatible with other ACPI implementations. See AcpiNsLoadTable.
+ * Initialize the objects that remain uninitialized. This
+ * runs the executable AML that may be part of the
+ * declaration of these objects:
+ * OperationRegions, BufferFields, Buffers, and Packages.
*/
- if (!AcpiGbl_ParseTableAsTermList && AcpiGbl_GroupModuleLevelCode)
+ if (!(Flags & ACPI_NO_OBJECT_INIT))
{
- AcpiNsExecModuleCodeList ();
-
- /*
- * Initialize the objects that remain uninitialized. This
- * runs the executable AML that may be part of the
- * declaration of these objects:
- * OperationRegions, BufferFields, Buffers, and Packages.
- */
- if (!(Flags & ACPI_NO_OBJECT_INIT))
+ Status = AcpiNsInitializeObjects ();
+ if (ACPI_FAILURE (Status))
{
- Status = AcpiNsInitializeObjects ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (Status);
}
}
diff --git a/source/include/acevents.h b/source/include/acevents.h
index b6737da5489c..3dc36606ba84 100644
--- a/source/include/acevents.h
+++ b/source/include/acevents.h
@@ -154,6 +154,21 @@
/*
+ * Conditions to trigger post enabling GPE polling:
+ * It is not sufficient to trigger edge-triggered GPE with specific GPE
+ * chips, software need to poll once after enabling.
+ */
+#ifdef ACPI_USE_GPE_POLLING
+#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) \
+ ((__gpe__)->RuntimeCount == 1 && \
+ (__gpe__)->Flags & ACPI_GPE_INITIALIZED && \
+ ((__gpe__)->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED)
+#else
+#define ACPI_GPE_IS_POLLING_NEEDED(__gpe__) FALSE
+#endif
+
+
+/*
* evevent
*/
ACPI_STATUS
@@ -250,6 +265,12 @@ ACPI_STATUS
AcpiEvFinishGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
+UINT32
+AcpiEvDetectGpe (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GPE_EVENT_INFO *GpeEventInfo,
+ UINT32 GpeNumber);
+
/*
* evgpeblk - Upper-level GPE block support
diff --git a/source/include/acmacros.h b/source/include/acmacros.h
index f0f7992454ca..f13523a3dc40 100644
--- a/source/include/acmacros.h
+++ b/source/include/acmacros.h
@@ -572,16 +572,18 @@
#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist
#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist
#define ACPI_BIOS_ERROR_PREDEFINED(plist) AcpiUtPredefinedBiosError plist
+#define ACPI_ERROR_ONLY(s) s
#else
/* No error messages */
-#define ACPI_ERROR_NAMESPACE(s, e)
+#define ACPI_ERROR_NAMESPACE(s, p, e)
#define ACPI_ERROR_METHOD(s, n, p, e)
#define ACPI_WARN_PREDEFINED(plist)
#define ACPI_INFO_PREDEFINED(plist)
#define ACPI_BIOS_ERROR_PREDEFINED(plist)
+#define ACPI_ERROR_ONLY(s)
#endif /* ACPI_NO_ERROR_MESSAGES */
diff --git a/source/include/acpixf.h b/source/include/acpixf.h
index 2f0ac5647cff..0ba430498306 100644
--- a/source/include/acpixf.h
+++ b/source/include/acpixf.h
@@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20180209
+#define ACPI_CA_VERSION 0x20180313
#include "acconfig.h"
#include "actypes.h"
@@ -308,13 +308,12 @@ ACPI_INIT_GLOBAL (UINT8, AcpiGbl_DoNotUseXsdt, FALSE);
ACPI_INIT_GLOBAL (UINT8, AcpiGbl_GroupModuleLevelCode, FALSE);
/*
- * Optionally support module level code by parsing the entire table as
- * a TermList. Default is FALSE, do not execute entire table until some
- * lock order issues are fixed.
+ * Optionally support module level code by parsing an entire table as
+ * a method as it is loaded. Default is TRUE.
* NOTE, this is essentially obsolete and will be removed soon
* (01/2018).
*/
-ACPI_INIT_GLOBAL (UINT8, AcpiGbl_ParseTableAsTermList, TRUE);
+ACPI_INIT_GLOBAL (UINT8, AcpiGbl_ExecuteTablesAsMethods, TRUE);
/*
* Optionally use 32-bit FADT addresses if and when there is a conflict
@@ -381,6 +380,16 @@ ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_ReducedHardware, FALSE);
ACPI_INIT_GLOBAL (UINT32, AcpiGbl_MaxLoopIterations, ACPI_MAX_LOOP_TIMEOUT);
/*
+ * Optionally ignore AE_NOT_FOUND errors from named reference package elements
+ * during DSDT/SSDT table loading. This reduces error "noise" in platforms
+ * whose firmware is carrying around a bunch of unused package objects that
+ * refer to non-existent named objects. However, If the AML actually tries to
+ * use such a package, the unresolved element(s) will be replaced with NULL
+ * elements.
+ */
+ACPI_INIT_GLOBAL (BOOLEAN, AcpiGbl_IgnorePackageResolutionErrors, FALSE);
+
+/*
* This mechanism is used to trace a specified AML method. The method is
* traced each time it is executed.
*/
diff --git a/source/include/actypes.h b/source/include/actypes.h
index 926bba933bdd..4d2438c9ec69 100644
--- a/source/include/actypes.h
+++ b/source/include/actypes.h
@@ -693,17 +693,17 @@ typedef UINT64 ACPI_INTEGER;
******************************************************************************/
/*
- * Initialization sequence
+ * Initialization sequence options
*/
-#define ACPI_FULL_INITIALIZATION 0x00
-#define ACPI_NO_ADDRESS_SPACE_INIT 0x01
-#define ACPI_NO_HARDWARE_INIT 0x02
-#define ACPI_NO_EVENT_INIT 0x04
-#define ACPI_NO_HANDLER_INIT 0x08
-#define ACPI_NO_ACPI_ENABLE 0x10
-#define ACPI_NO_DEVICE_INIT 0x20
-#define ACPI_NO_OBJECT_INIT 0x40
-#define ACPI_NO_FACS_INIT 0x80
+#define ACPI_FULL_INITIALIZATION 0x0000
+#define ACPI_NO_FACS_INIT 0x0001
+#define ACPI_NO_ACPI_ENABLE 0x0002
+#define ACPI_NO_HARDWARE_INIT 0x0004
+#define ACPI_NO_EVENT_INIT 0x0008
+#define ACPI_NO_HANDLER_INIT 0x0010
+#define ACPI_NO_OBJECT_INIT 0x0020
+#define ACPI_NO_DEVICE_INIT 0x0040
+#define ACPI_NO_ADDRESS_SPACE_INIT 0x0080
/*
* Initialization state
@@ -906,7 +906,7 @@ typedef UINT32 ACPI_EVENT_STATUS;
* | | | | +-- Type of dispatch:to method, handler, notify, or none
* | | | +----- Interrupt type: edge or level triggered
* | | +------- Is a Wake GPE
- * | +--------- Is GPE masked by the software GPE masking mechanism
+ * | +--------- Has been enabled automatically at init time
* +------------ <Reserved>
*/
#define ACPI_GPE_DISPATCH_NONE (UINT8) 0x00
@@ -922,6 +922,8 @@ typedef UINT32 ACPI_EVENT_STATUS;
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x08
#define ACPI_GPE_CAN_WAKE (UINT8) 0x10
+#define ACPI_GPE_AUTO_ENABLED (UINT8) 0x20
+#define ACPI_GPE_INITIALIZED (UINT8) 0x40
/*
* Flags for GPE and Lock interfaces
@@ -1388,7 +1390,6 @@ typedef struct acpi_device_info
UINT8 Flags; /* Miscellaneous info */
UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
UINT8 LowestDstates[5]; /* _SxW values: 0xFF indicates not valid */
- UINT32 CurrentStatus; /* _STA value */
UINT64 Address; /* _ADR value */
ACPI_PNP_DEVICE_ID HardwareId; /* _HID value */
ACPI_PNP_DEVICE_ID UniqueId; /* _UID value */
@@ -1403,7 +1404,6 @@ typedef struct acpi_device_info
/* Flags for Valid field above (AcpiGetObjectInfo) */
-#define ACPI_VALID_STA 0x0001
#define ACPI_VALID_ADR 0x0002
#define ACPI_VALID_HID 0x0004
#define ACPI_VALID_UID 0x0008
@@ -1511,6 +1511,7 @@ typedef enum
#define ACPI_OSI_WIN_10 0x0D
#define ACPI_OSI_WIN_10_RS1 0x0E
#define ACPI_OSI_WIN_10_RS2 0x0F
+#define ACPI_OSI_WIN_10_RS3 0x10
/* Definitions of getopt */
diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h
index 836b5eb53c99..4ab5308ccc47 100644
--- a/source/include/platform/aclinux.h
+++ b/source/include/platform/aclinux.h
@@ -172,6 +172,7 @@
#ifdef __KERNEL__
#define ACPI_USE_SYSTEM_INTTYPES
+#define ACPI_USE_GPE_POLLING
/* Kernel specific ACPICA configuration */
diff --git a/source/tools/acpiexec/aemain.c b/source/tools/acpiexec/aemain.c
index 32f5ecd5add3..0bf9b3c6193e 100644
--- a/source/tools/acpiexec/aemain.c
+++ b/source/tools/acpiexec/aemain.c
@@ -342,7 +342,7 @@ AeDoOptions (
case 'p':
- AcpiGbl_ParseTableAsTermList = FALSE;
+ AcpiGbl_ExecuteTablesAsMethods = FALSE;
break;
case 'r':
@@ -607,6 +607,11 @@ main (
AcpiDbgLevel = ACPI_NORMAL_DEFAULT;
AcpiDbgLayer = 0xFFFFFFFF;
+ /* Module-level code. Use new architecture */
+
+ AcpiGbl_ExecuteTablesAsMethods = TRUE;
+ AcpiGbl_GroupModuleLevelCode = FALSE;
+
/*
* Initialize ACPICA and start debugger thread.
*
@@ -711,6 +716,25 @@ main (
goto EnterDebugger;
}
+ Status = AeLoadTables ();
+
+ /*
+ * Exit namespace initialization for the "load namespace only" option.
+ * No control methods will be executed. However, still enter the
+ * the debugger.
+ */
+ if (AcpiGbl_AeLoadOnly)
+ {
+ goto EnterDebugger;
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ printf ("**** Could not load ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto EnterDebugger;
+ }
+
/* Setup initialization flags for ACPICA */
InitFlags = (ACPI_NO_HANDLER_INIT | ACPI_NO_ACPI_ENABLE);
@@ -737,31 +761,18 @@ main (
goto EnterDebugger;
}
- Status = AeLoadTables ();
-
- /*
- * Exit namespace initialization for the "load namespace only" option.
- * No control methods will be executed. However, still enter the
- * the debugger.
- */
- if (AcpiGbl_AeLoadOnly)
- {
- goto EnterDebugger;
- }
-
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not load ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto EnterDebugger;
- }
-
/*
* Install handlers for "device driver" space IDs (EC,SMBus, etc.)
* and fixed event handlers
*/
AeInstallLateHandlers ();
+ /*
+ * This call implements the "initialization file" option for AcpiExec.
+ * This is the precise point that we want to perform the overrides.
+ */
+ AeDoObjectOverrides ();
+
/* Finish the ACPICA initialization */
Status = AcpiInitializeObjects (InitFlags);
diff --git a/source/tools/acpiexec/aetables.c b/source/tools/acpiexec/aetables.c
index 7729acf5d999..4137f7b7ae78 100644
--- a/source/tools/acpiexec/aetables.c
+++ b/source/tools/acpiexec/aetables.c
@@ -259,9 +259,9 @@ AeInitializeTableHeader (
Header->Length = Length;
Header->OemRevision = 0x1001;
- strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
- strncpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
- strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
+ memcpy (Header->OemId, "Intel ", ACPI_OEM_ID_SIZE);
+ memcpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
+ ACPI_MOVE_NAME (Header->AslCompilerId, "INTL");
Header->AslCompilerRevision = ACPI_CA_VERSION;
/* Set the checksum, must set to zero first */
@@ -497,12 +497,12 @@ AeBuildLocalTables (
/* Miscellaneous FADT fields */
- LocalFADT.Gpe0BlockLength = 0x08;
- LocalFADT.Gpe0Block = 0x00001234;
+ LocalFADT.Gpe0BlockLength = 0x20;
+ LocalFADT.Gpe0Block = 0x00003210;
- LocalFADT.Gpe1BlockLength = 0x80;
- LocalFADT.Gpe1Block = 0x00005678;
- LocalFADT.Gpe1Base = 100;
+ LocalFADT.Gpe1BlockLength = 0x20;
+ LocalFADT.Gpe1Block = 0x0000BA98;
+ LocalFADT.Gpe1Base = 0x80;
LocalFADT.Pm1EventLength = 4;
LocalFADT.Pm1aEventBlock = 0x00001aaa;
diff --git a/source/tools/acpinames/anmain.c b/source/tools/acpinames/anmain.c
index c3ed3c7832c8..57b421e7c290 100644
--- a/source/tools/acpinames/anmain.c
+++ b/source/tools/acpinames/anmain.c
@@ -237,6 +237,11 @@ main (
AcpiDbgLevel = ACPI_NORMAL_DEFAULT | ACPI_LV_TABLES;
AcpiDbgLayer = 0xFFFFFFFF;
+ /* Set flags so that the interpreter is not used */
+
+ AcpiGbl_ExecuteTablesAsMethods = FALSE;
+ AcpiGbl_GroupModuleLevelCode = TRUE;
+
Status = AcpiInitializeSubsystem ();
ACPI_CHECK_OK (AcpiInitializeSubsystem, Status);
if (ACPI_FAILURE (Status))
@@ -361,9 +366,9 @@ AnDumpEntireNamespace (
return (-1);
}
- /* Load the ACPI namespace */
+ /* Build the namespace from the tables */
- Status = AcpiTbLoadNamespace ();
+ Status = AcpiLoadTables ();
if (Status == AE_CTRL_TERMINATE)
{
/* At least one table load failed -- terminate with error */
@@ -385,32 +390,15 @@ AnDumpEntireNamespace (
}
/*
- * Enable ACPICA. These calls don't do much for this
- * utility, since we only dump the namespace. There is no
- * hardware or event manager code underneath.
+ * NOTE:
+ * We don't need to do any further ACPICA initialization, since we don't
+ * have any hardware, nor is the interpreter configured.
+ *
+ * Namely, we don't need these calls:
+ * AcpiEnableSubsystem
+ * AcpiInitializeObjects
*/
- Status = AcpiEnableSubsystem (
- ACPI_NO_ACPI_ENABLE |
- ACPI_NO_ADDRESS_SPACE_INIT |
- ACPI_NO_EVENT_INIT |
- ACPI_NO_HANDLER_INIT);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not EnableSubsystem, %s\n",
- AcpiFormatException (Status));
- return (-1);
- }
- Status = AcpiInitializeObjects (
- ACPI_NO_ADDRESS_SPACE_INIT |
- ACPI_NO_DEVICE_INIT |
- ACPI_NO_EVENT_INIT);
- if (ACPI_FAILURE (Status))
- {
- printf ("**** Could not InitializeObjects, %s\n",
- AcpiFormatException (Status));
- return (-1);
- }
/*
* Perform a namespace walk to dump the contents
diff --git a/source/tools/acpinames/anstubs.c b/source/tools/acpinames/anstubs.c
index 28f54430b26a..4a8d7865cb81 100644
--- a/source/tools/acpinames/anstubs.c
+++ b/source/tools/acpinames/anstubs.c
@@ -173,6 +173,9 @@ AcpiUtCopyIobjectToEobject (
ACPI_OPERAND_OBJECT *Obj,
ACPI_BUFFER *RetBuffer)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -181,6 +184,9 @@ AcpiUtCopyEobjectToIobject (
ACPI_OBJECT *Obj,
ACPI_OPERAND_OBJECT **InternalObj)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -190,6 +196,9 @@ AcpiUtCopyIobjectToIobject (
ACPI_OPERAND_OBJECT **DestDesc,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -248,6 +257,9 @@ AcpiExReadDataFromField (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **RetBufferDesc)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -257,6 +269,9 @@ AcpiExWriteDataToField (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **ResultDesc)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -267,6 +282,9 @@ AcpiExStoreObjectToNode (
ACPI_WALK_STATE *WalkState,
UINT8 ImplicitConversion)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -277,6 +295,9 @@ ACPI_STATUS
AcpiNsEvaluate (
ACPI_EVALUATE_INFO *Info)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -284,6 +305,7 @@ void
AcpiNsExecModuleCodeList (
void)
{
+ return;
}
void
@@ -364,6 +386,9 @@ AcpiDsCallControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -372,6 +397,9 @@ AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -387,6 +415,9 @@ AcpiDsMethodError (
ACPI_STATUS Status,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -396,6 +427,9 @@ AcpiDsBeginMethodExecution (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -404,6 +438,9 @@ AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ResultObj)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -447,6 +484,9 @@ AcpiDsExecBeginOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT **OutOp)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
@@ -454,5 +494,8 @@ ACPI_STATUS
AcpiDsExecEndOp (
ACPI_WALK_STATE *State)
{
+ ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
+ "Stubbed function"));
+
return (AE_NOT_IMPLEMENTED);
}
diff --git a/source/tools/acpinames/antables.c b/source/tools/acpinames/antables.c
index 98ce6398623c..64495a964d76 100644
--- a/source/tools/acpinames/antables.c
+++ b/source/tools/acpinames/antables.c
@@ -210,9 +210,9 @@ AnInitializeTableHeader (
Header->Length = Length;
Header->OemRevision = 0x1001;
- strncpy (Header->OemId, "Intel", ACPI_OEM_ID_SIZE);
- strncpy (Header->OemTableId, "AcpiName", ACPI_OEM_TABLE_ID_SIZE);
- strncpy (Header->AslCompilerId, "INTL", ACPI_NAME_SIZE);
+ memcpy (Header->OemId, "Intel ", ACPI_OEM_ID_SIZE);
+ memcpy (Header->OemTableId, "AcpiExec", ACPI_OEM_TABLE_ID_SIZE);
+ ACPI_MOVE_NAME (Header->AslCompilerId, "INTL");
Header->AslCompilerRevision = ACPI_CA_VERSION;
/* Set the checksum, must set to zero first */
diff --git a/source/tools/acpisrc/acpisrc.h b/source/tools/acpisrc/acpisrc.h
index 7d1cfaa03b91..98fe25805ad4 100644
--- a/source/tools/acpisrc/acpisrc.h
+++ b/source/tools/acpisrc/acpisrc.h
@@ -166,7 +166,7 @@
#define LINES_IN_LEGAL_HEADER 115+36 /* intel+dual license. See legal header above at module start */
#define LEGAL_HEADER_SIGNATURE " * 2.1. This is your license from Intel Corp. under its intellectual property"
-#define LINES_IN_LINUX_HEADER 34
+#define LINES_IN_LINUX_HEADER 2 /* SPDX header is 1 line Intel copyright is another line */
#define LINUX_HEADER_SIGNATURE " * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS"
#define LINES_IN_ASL_HEADER 29 /* Header as output from disassembler */
@@ -280,6 +280,7 @@ typedef struct acpi_conversion_table
ACPI_TYPED_IDENTIFIER_TABLE *LowerCaseTable;
+ char *SourceSpdxHeader;
ACPI_STRING_TABLE *SourceStringTable;
ACPI_IDENTIFIER_TABLE *SourceLineTable;
ACPI_IDENTIFIER_TABLE *SourceConditionalTable;
@@ -288,6 +289,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *SourceSpecialMacroTable;
UINT32 SourceFunctions;
+ char *HeaderSpdxHeader;
ACPI_STRING_TABLE *HeaderStringTable;
ACPI_IDENTIFIER_TABLE *HeaderLineTable;
ACPI_IDENTIFIER_TABLE *HeaderConditionalTable;
@@ -296,6 +298,7 @@ typedef struct acpi_conversion_table
ACPI_IDENTIFIER_TABLE *HeaderSpecialMacroTable;
UINT32 HeaderFunctions;
+ /* SPDX header conversion for patches is not supported */
ACPI_STRING_TABLE *PatchStringTable;
ACPI_IDENTIFIER_TABLE *PatchLineTable;
ACPI_IDENTIFIER_TABLE *PatchConditionalTable;
@@ -464,6 +467,11 @@ AsReplaceHeader (
char *NewHeader);
void
+AsDoSpdxHeader (
+ char *Buffer,
+ char *SpdxHeader);
+
+void
AsConvertFile (
ACPI_CONVERSION_TABLE *ConversionTable,
char *FileBuffer,
diff --git a/source/tools/acpisrc/asconvrt.c b/source/tools/acpisrc/asconvrt.c
index 0589a8e5ba73..ffc8366f9832 100644
--- a/source/tools/acpisrc/asconvrt.c
+++ b/source/tools/acpisrc/asconvrt.c
@@ -183,12 +183,18 @@ AsCountLines (
char *Filename);
+
+#define MODULE_HEADER_BEGIN "/******************************************************************************\n *\n * Module Name:";
+#define MODULE_HEADER_END " *****************************************************************************/\n\n"
+#define INTEL_COPYRIGHT " * Copyright (C) 2000 - 2018, Intel Corp.\n"
+
/* Opening signature of the Intel legal header */
char *HeaderBegin = "/******************************************************************************\n *\n * 1. Copyright Notice";
UINT32 NonAnsiCommentCount;
+char CopyRightHeaderEnd[] = INTEL_COPYRIGHT " *\n" MODULE_HEADER_END;
/******************************************************************************
*
@@ -759,6 +765,39 @@ AsReplaceHeader (
/******************************************************************************
*
+ * FUNCTION: AsDoSpdxHeader
+ *
+ * DESCRIPTION: Replace the default Intel legal header with a new header
+ *
+ ******************************************************************************/
+
+void
+AsDoSpdxHeader (
+ char *Buffer,
+ char *SpdxHeader)
+{
+ char *SubBuffer;
+
+
+ /* Place an SPDX header at the very top */
+
+ AsReplaceData (Buffer, 0,
+ SpdxHeader, strlen (SpdxHeader));
+
+ /* Place an Intel copyright notice in the module header */
+
+ SubBuffer = strstr (Buffer, MODULE_HEADER_END);
+ if (!SubBuffer)
+ {
+ return;
+ }
+
+ AsReplaceData (SubBuffer, strlen (MODULE_HEADER_END),
+ CopyRightHeaderEnd, strlen (CopyRightHeaderEnd));
+}
+
+/******************************************************************************
+ *
* FUNCTION: AsReplaceString
*
* DESCRIPTION: Replace all instances of a target string with a replacement
diff --git a/source/tools/acpisrc/asfile.c b/source/tools/acpisrc/asfile.c
index b91007544860..ba68ff5f8208 100644
--- a/source/tools/acpisrc/asfile.c
+++ b/source/tools/acpisrc/asfile.c
@@ -422,6 +422,7 @@ AsConvertFile (
ACPI_IDENTIFIER_TABLE *LineTable;
ACPI_TYPED_IDENTIFIER_TABLE *StructTable;
ACPI_IDENTIFIER_TABLE *SpecialMacroTable;
+ char *SpdxHeader=NULL;
switch (FileType)
@@ -434,6 +435,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->SourceConditionalTable;
StructTable = ConversionTable->SourceStructTable;
SpecialMacroTable = ConversionTable->SourceSpecialMacroTable;
+ SpdxHeader = ConversionTable->SourceSpdxHeader;
break;
case FILE_TYPE_HEADER:
@@ -444,6 +446,7 @@ AsConvertFile (
ConditionalTable = ConversionTable->HeaderConditionalTable;
StructTable = ConversionTable->HeaderStructTable;
SpecialMacroTable = ConversionTable->HeaderSpecialMacroTable;
+ SpdxHeader = ConversionTable->HeaderSpdxHeader;
break;
case FILE_TYPE_PATCH:
@@ -639,6 +642,10 @@ AsConvertFile (
{
AsReplaceHeader (FileBuffer, ConversionTable->NewHeader);
}
+ if (SpdxHeader)
+ {
+ AsDoSpdxHeader (FileBuffer, SpdxHeader);
+ }
}
/*******************************************************************************
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 6dab920b0b99..62bbcc92b453 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -194,6 +194,7 @@ ACPI_STRING_TABLE StandardDataTypes[] = {
*
******************************************************************************/
+char EmptyHeader[] = "";
char DualLicenseHeader[] =
"/*\n"
" * Copyright (C) 2000 - 2018, Intel Corp.\n"
@@ -956,13 +957,14 @@ ACPI_IDENTIFIER_TABLE LinuxSpecialMacros[] = {
ACPI_CONVERSION_TABLE LinuxConversionTable =
{
- DualLicenseHeader,
+ EmptyHeader,
FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES,
AcpiIdentifiers,
/* C source files */
+ "// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0\n",
LinuxDataTypes,
LinuxEliminateLines_C,
NULL,
@@ -977,6 +979,7 @@ ACPI_CONVERSION_TABLE LinuxConversionTable =
/* C header files */
+ "/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */\n",
LinuxDataTypes,
LinuxEliminateLines_H,
LinuxConditionalIdentifiers,
@@ -1020,6 +1023,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -1031,6 +1035,7 @@ ACPI_CONVERSION_TABLE CleanupConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_TRIM_LINES | CVT_TRIM_WHITESPACE),
@@ -1060,6 +1065,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -1071,6 +1077,7 @@ ACPI_CONVERSION_TABLE StatsConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -1107,6 +1114,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -1118,6 +1126,7 @@ ACPI_CONVERSION_TABLE LicenseConversionTable =
NULL,
NULL,
NULL,
+ NULL,
(CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES |
CVT_COUNT_SHORTMULTILINE_COMMENTS),
@@ -1202,6 +1211,7 @@ ACPI_CONVERSION_TABLE CustomConversionTable =
/* C source files */
+ NULL,
CustomReplacements,
LinuxEliminateLines_H,
NULL,
@@ -1213,6 +1223,7 @@ ACPI_CONVERSION_TABLE CustomConversionTable =
/* C header files */
+ NULL,
CustomReplacements,
LinuxEliminateLines_H,
NULL,
@@ -1249,6 +1260,7 @@ ACPI_CONVERSION_TABLE IndentConversionTable =
/* C source files */
+ NULL,
LinuxSpecialStrings,
NULL,
NULL,
@@ -1260,6 +1272,7 @@ ACPI_CONVERSION_TABLE IndentConversionTable =
/* C header files */
+ NULL,
LinuxSpecialStrings,
NULL,
NULL,
diff --git a/source/tools/acpisrc/asutils.c b/source/tools/acpisrc/asutils.c
index 9e6fcba4ee51..ade0fcd4659c 100644
--- a/source/tools/acpisrc/asutils.c
+++ b/source/tools/acpisrc/asutils.c
@@ -243,12 +243,9 @@ AsReplaceData (
* 1) If adding more bytes than removing, make room for the new data
* 2) if removing more bytes than adding, delete the extra space
*/
- if (LengthToRemove > 0)
- {
- Gbl_MadeChanges = TRUE;
- memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove),
- (BufferLength - LengthToRemove));
- }
+ Gbl_MadeChanges = TRUE;
+ memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove),
+ (BufferLength - LengthToRemove));
}
/*