Message ID | 20180313215615.21805-1-colin.king@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | ACPICA: Update to version 20180313 | expand |
On 2018-03-13 02:56 PM, Colin King wrote: > From: Colin Ian King<colin.king@canonical.com> > > changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2018-March/001752.html > > Signed-off-by: Colin Ian King<colin.king@canonical.com> Acked-by: Alex Hung <alex.hung@canonical.com>
On 03/14/2018 05:56 AM, Colin King wrote: > From: Colin Ian King <colin.king@canonical.com> > > changes in this release of ACPICA are detailed at the following > link on the ACPICA developer mailing list: > > https://lists.acpica.org/pipermail/devel/2018-March/001752.html > > Signed-off-by: Colin Ian King <colin.king@canonical.com> > --- > src/acpica/source/components/debugger/dbdisply.c | 5 +- > .../source/components/dispatcher/dspkginit.c | 33 ++- > src/acpica/source/components/events/evevent.c | 9 +- > src/acpica/source/components/events/evgpe.c | 238 ++++++++++++--------- > src/acpica/source/components/events/evgpeblk.c | 20 +- > src/acpica/source/components/events/evrgnini.c | 5 +- > src/acpica/source/components/events/evxface.c | 9 + > src/acpica/source/components/events/evxfgpe.c | 31 ++- > src/acpica/source/components/executer/exdebug.c | 7 +- > src/acpica/source/components/hardware/hwgpe.c | 1 - > src/acpica/source/components/hardware/hwsleep.c | 12 +- > src/acpica/source/components/hardware/hwxfsleep.c | 2 +- > src/acpica/source/components/namespace/nsdumpdv.c | 5 +- > src/acpica/source/components/namespace/nseval.c | 24 +++ > src/acpica/source/components/namespace/nsload.c | 24 +-- > src/acpica/source/components/namespace/nsparse.c | 26 ++- > src/acpica/source/components/namespace/nsxfname.c | 22 +- > src/acpica/source/components/parser/psargs.c | 3 + > src/acpica/source/components/parser/psloop.c | 24 ++- > src/acpica/source/components/parser/psobject.c | 6 +- > src/acpica/source/components/tables/tbdata.c | 18 +- > src/acpica/source/components/tables/tbinstal.c | 6 +- > src/acpica/source/components/tables/tbxfload.c | 13 +- > src/acpica/source/components/utilities/utosi.c | 1 + > src/acpica/source/components/utilities/utxfinit.c | 48 ++--- > src/acpica/source/include/acevents.h | 21 ++ > src/acpica/source/include/acmacros.h | 4 +- > src/acpica/source/include/acpixf.h | 19 +- > src/acpica/source/include/actypes.h | 27 +-- > src/acpica/source/include/platform/aclinux.h | 1 + > 30 files changed, 411 insertions(+), 253 deletions(-) > > diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c > index 02b76433..c1c81051 100644 > --- a/src/acpica/source/components/debugger/dbdisply.c > +++ b/src/acpica/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/src/acpica/source/components/dispatcher/dspkginit.c b/src/acpica/source/components/dispatcher/dspkginit.c > index a034df0d..9e1cd611 100644 > --- a/src/acpica/source/components/dispatcher/dspkginit.c > +++ b/src/acpica/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/src/acpica/source/components/events/evevent.c b/src/acpica/source/components/events/evevent.c > index 755ab993..791ee57e 100644 > --- a/src/acpica/source/components/events/evevent.c > +++ b/src/acpica/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/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c > index ccc15478..415df720 100644 > --- a/src/acpica/source/components/events/evgpe.c > +++ b/src/acpica/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); > } > @@ -892,6 +799,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 > @@ -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/src/acpica/source/components/events/evgpeblk.c b/src/acpica/source/components/events/evgpeblk.c > index cf208e6d..442f494c 100644 > --- a/src/acpica/source/components/events/evgpeblk.c > +++ b/src/acpica/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/src/acpica/source/components/events/evrgnini.c b/src/acpica/source/components/events/evrgnini.c > index 8dd9767c..678b23cc 100644 > --- a/src/acpica/source/components/events/evrgnini.c > +++ b/src/acpica/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/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c > index 1c281d5f..ba5e9c45 100644 > --- a/src/acpica/source/components/events/evxface.c > +++ b/src/acpica/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/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c > index 1a76256d..bd2a0e28 100644 > --- a/src/acpica/source/components/events/evxfgpe.c > +++ b/src/acpica/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/src/acpica/source/components/executer/exdebug.c b/src/acpica/source/components/executer/exdebug.c > index 758c1d1d..b471cfcc 100644 > --- a/src/acpica/source/components/executer/exdebug.c > +++ b/src/acpica/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/src/acpica/source/components/hardware/hwgpe.c b/src/acpica/source/components/hardware/hwgpe.c > index 1227bbf6..581fcb99 100644 > --- a/src/acpica/source/components/hardware/hwgpe.c > +++ b/src/acpica/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/src/acpica/source/components/hardware/hwsleep.c b/src/acpica/source/components/hardware/hwsleep.c > index 947d666e..fe111872 100644 > --- a/src/acpica/source/components/hardware/hwsleep.c > +++ b/src/acpica/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/src/acpica/source/components/hardware/hwxfsleep.c b/src/acpica/source/components/hardware/hwxfsleep.c > index 7536c38c..8ebb8c1d 100644 > --- a/src/acpica/source/components/hardware/hwxfsleep.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nsdumpdv.c b/src/acpica/source/components/namespace/nsdumpdv.c > index 92a772f2..6ab5ba52 100644 > --- a/src/acpica/source/components/namespace/nsdumpdv.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nseval.c b/src/acpica/source/components/namespace/nseval.c > index b1e1af9a..2a7eb8f5 100644 > --- a/src/acpica/source/components/namespace/nseval.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c > index ad00d92f..698d3a57 100644 > --- a/src/acpica/source/components/namespace/nsload.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nsparse.c b/src/acpica/source/components/namespace/nsparse.c > index bb24bab9..8e86ee4c 100644 > --- a/src/acpica/source/components/namespace/nsparse.c > +++ b/src/acpica/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/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c > index d5b32eda..f94c0e45 100644 > --- a/src/acpica/source/components/namespace/nsxfname.c > +++ b/src/acpica/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/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c > index c9c17371..fba20f08 100644 > --- a/src/acpica/source/components/parser/psargs.c > +++ b/src/acpica/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/src/acpica/source/components/parser/psloop.c b/src/acpica/source/components/parser/psloop.c > index 74e8f0d6..28d17962 100644 > --- a/src/acpica/source/components/parser/psloop.c > +++ b/src/acpica/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/src/acpica/source/components/parser/psobject.c b/src/acpica/source/components/parser/psobject.c > index b07b99f6..63e2b3b1 100644 > --- a/src/acpica/source/components/parser/psobject.c > +++ b/src/acpica/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/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c > index 7f0286a8..61a2d340 100644 > --- a/src/acpica/source/components/tables/tbdata.c > +++ b/src/acpica/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/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c > index e5d5692c..63944803 100644 > --- a/src/acpica/source/components/tables/tbinstal.c > +++ b/src/acpica/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/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c > index 7103f4a9..0119b684 100644 > --- a/src/acpica/source/components/tables/tbxfload.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/utosi.c b/src/acpica/source/components/utilities/utosi.c > index c408ec76..e6369078 100644 > --- a/src/acpica/source/components/utilities/utosi.c > +++ b/src/acpica/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/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c > index f79ac6f8..d24b6aa2 100644 > --- a/src/acpica/source/components/utilities/utxfinit.c > +++ b/src/acpica/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/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h > index b6737da5..3dc36606 100644 > --- a/src/acpica/source/include/acevents.h > +++ b/src/acpica/source/include/acevents.h > @@ -153,6 +153,21 @@ > #define __ACEVENTS_H__ > > > +/* > + * 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 > */ > @@ -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/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h > index f0f79924..f13523a3 100644 > --- a/src/acpica/source/include/acmacros.h > +++ b/src/acpica/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/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h > index 2f0ac564..0ba43049 100644 > --- a/src/acpica/source/include/acpixf.h > +++ b/src/acpica/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 > @@ -380,6 +379,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/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h > index 926bba93..4d2438c9 100644 > --- a/src/acpica/source/include/actypes.h > +++ b/src/acpica/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/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h > index 836b5eb5..4ab5308c 100644 > --- a/src/acpica/source/include/platform/aclinux.h > +++ b/src/acpica/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 */ > > Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff --git a/src/acpica/source/components/debugger/dbdisply.c b/src/acpica/source/components/debugger/dbdisply.c index 02b76433..c1c81051 100644 --- a/src/acpica/source/components/debugger/dbdisply.c +++ b/src/acpica/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/src/acpica/source/components/dispatcher/dspkginit.c b/src/acpica/source/components/dispatcher/dspkginit.c index a034df0d..9e1cd611 100644 --- a/src/acpica/source/components/dispatcher/dspkginit.c +++ b/src/acpica/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/src/acpica/source/components/events/evevent.c b/src/acpica/source/components/events/evevent.c index 755ab993..791ee57e 100644 --- a/src/acpica/source/components/events/evevent.c +++ b/src/acpica/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/src/acpica/source/components/events/evgpe.c b/src/acpica/source/components/events/evgpe.c index ccc15478..415df720 100644 --- a/src/acpica/source/components/events/evgpe.c +++ b/src/acpica/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); } @@ -892,6 +799,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 @@ -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/src/acpica/source/components/events/evgpeblk.c b/src/acpica/source/components/events/evgpeblk.c index cf208e6d..442f494c 100644 --- a/src/acpica/source/components/events/evgpeblk.c +++ b/src/acpica/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/src/acpica/source/components/events/evrgnini.c b/src/acpica/source/components/events/evrgnini.c index 8dd9767c..678b23cc 100644 --- a/src/acpica/source/components/events/evrgnini.c +++ b/src/acpica/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/src/acpica/source/components/events/evxface.c b/src/acpica/source/components/events/evxface.c index 1c281d5f..ba5e9c45 100644 --- a/src/acpica/source/components/events/evxface.c +++ b/src/acpica/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/src/acpica/source/components/events/evxfgpe.c b/src/acpica/source/components/events/evxfgpe.c index 1a76256d..bd2a0e28 100644 --- a/src/acpica/source/components/events/evxfgpe.c +++ b/src/acpica/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/src/acpica/source/components/executer/exdebug.c b/src/acpica/source/components/executer/exdebug.c index 758c1d1d..b471cfcc 100644 --- a/src/acpica/source/components/executer/exdebug.c +++ b/src/acpica/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/src/acpica/source/components/hardware/hwgpe.c b/src/acpica/source/components/hardware/hwgpe.c index 1227bbf6..581fcb99 100644 --- a/src/acpica/source/components/hardware/hwgpe.c +++ b/src/acpica/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/src/acpica/source/components/hardware/hwsleep.c b/src/acpica/source/components/hardware/hwsleep.c index 947d666e..fe111872 100644 --- a/src/acpica/source/components/hardware/hwsleep.c +++ b/src/acpica/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/src/acpica/source/components/hardware/hwxfsleep.c b/src/acpica/source/components/hardware/hwxfsleep.c index 7536c38c..8ebb8c1d 100644 --- a/src/acpica/source/components/hardware/hwxfsleep.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nsdumpdv.c b/src/acpica/source/components/namespace/nsdumpdv.c index 92a772f2..6ab5ba52 100644 --- a/src/acpica/source/components/namespace/nsdumpdv.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nseval.c b/src/acpica/source/components/namespace/nseval.c index b1e1af9a..2a7eb8f5 100644 --- a/src/acpica/source/components/namespace/nseval.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nsload.c b/src/acpica/source/components/namespace/nsload.c index ad00d92f..698d3a57 100644 --- a/src/acpica/source/components/namespace/nsload.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nsparse.c b/src/acpica/source/components/namespace/nsparse.c index bb24bab9..8e86ee4c 100644 --- a/src/acpica/source/components/namespace/nsparse.c +++ b/src/acpica/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/src/acpica/source/components/namespace/nsxfname.c b/src/acpica/source/components/namespace/nsxfname.c index d5b32eda..f94c0e45 100644 --- a/src/acpica/source/components/namespace/nsxfname.c +++ b/src/acpica/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/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c index c9c17371..fba20f08 100644 --- a/src/acpica/source/components/parser/psargs.c +++ b/src/acpica/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/src/acpica/source/components/parser/psloop.c b/src/acpica/source/components/parser/psloop.c index 74e8f0d6..28d17962 100644 --- a/src/acpica/source/components/parser/psloop.c +++ b/src/acpica/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/src/acpica/source/components/parser/psobject.c b/src/acpica/source/components/parser/psobject.c index b07b99f6..63e2b3b1 100644 --- a/src/acpica/source/components/parser/psobject.c +++ b/src/acpica/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/src/acpica/source/components/tables/tbdata.c b/src/acpica/source/components/tables/tbdata.c index 7f0286a8..61a2d340 100644 --- a/src/acpica/source/components/tables/tbdata.c +++ b/src/acpica/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/src/acpica/source/components/tables/tbinstal.c b/src/acpica/source/components/tables/tbinstal.c index e5d5692c..63944803 100644 --- a/src/acpica/source/components/tables/tbinstal.c +++ b/src/acpica/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/src/acpica/source/components/tables/tbxfload.c b/src/acpica/source/components/tables/tbxfload.c index 7103f4a9..0119b684 100644 --- a/src/acpica/source/components/tables/tbxfload.c +++ b/src/acpica/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/src/acpica/source/components/utilities/utosi.c b/src/acpica/source/components/utilities/utosi.c index c408ec76..e6369078 100644 --- a/src/acpica/source/components/utilities/utosi.c +++ b/src/acpica/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/src/acpica/source/components/utilities/utxfinit.c b/src/acpica/source/components/utilities/utxfinit.c index f79ac6f8..d24b6aa2 100644 --- a/src/acpica/source/components/utilities/utxfinit.c +++ b/src/acpica/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/src/acpica/source/include/acevents.h b/src/acpica/source/include/acevents.h index b6737da5..3dc36606 100644 --- a/src/acpica/source/include/acevents.h +++ b/src/acpica/source/include/acevents.h @@ -153,6 +153,21 @@ #define __ACEVENTS_H__ +/* + * 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 */ @@ -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/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h index f0f79924..f13523a3 100644 --- a/src/acpica/source/include/acmacros.h +++ b/src/acpica/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/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h index 2f0ac564..0ba43049 100644 --- a/src/acpica/source/include/acpixf.h +++ b/src/acpica/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 @@ -380,6 +379,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/src/acpica/source/include/actypes.h b/src/acpica/source/include/actypes.h index 926bba93..4d2438c9 100644 --- a/src/acpica/source/include/actypes.h +++ b/src/acpica/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/src/acpica/source/include/platform/aclinux.h b/src/acpica/source/include/platform/aclinux.h index 836b5eb5..4ab5308c 100644 --- a/src/acpica/source/include/platform/aclinux.h +++ b/src/acpica/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 */