Merge ACPICA 20180313.

This commit is contained in:
Jung-uk Kim 2018-03-14 23:45:48 +00:00
commit 8438a7a80a
31 changed files with 480 additions and 277 deletions

View File

@ -1,3 +1,49 @@
----------------------------------------
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:

View File

@ -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],

View File

@ -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);

View File

@ -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",

View File

@ -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

View File

@ -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++;
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -658,7 +658,6 @@ AcpiHwDisableAllGpes (
Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL);
Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL);
return_ACPI_STATUS (Status);
}

View File

@ -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 ();

View File

@ -337,7 +337,7 @@ AcpiEnterSleepStateS4bios (
}
/*
* 1) Disable/Clear all GPEs
* 1) Disable all GPEs
* 2) Enable all wakeup GPEs
*/
Status = AcpiHwDisableAllGpes ();

View File

@ -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);
}

View File

@ -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 @@ AcpiNsEvaluate (
* 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;
}

View File

@ -270,23 +270,17 @@ AcpiNsLoadTable (
"**** 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);
}

View File

@ -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));

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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",

View File

@ -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

View File

@ -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;
}

View File

@ -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))

View File

@ -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 */

View File

@ -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.
*/
AeDoObjectOverrides ();
#endif
/*
* 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 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.
* 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 ();
/*
* 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))
/*
* 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);
}
}

View File

@ -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

View File

@ -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 */

View File

@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20180209
#define ACPI_CA_VERSION 0x20180313
#include <contrib/dev/acpica/include/acconfig.h>
#include <contrib/dev/acpica/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.

View File

@ -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 */

View File

@ -2209,20 +2209,20 @@ acpi_enable_fixed_events(struct acpi_softc *sc)
BOOLEAN
acpi_DeviceIsPresent(device_t dev)
{
ACPI_DEVICE_INFO *devinfo;
ACPI_HANDLE h;
BOOLEAN present;
ACPI_HANDLE h;
UINT32 s;
ACPI_STATUS status;
if ((h = acpi_get_handle(dev)) == NULL ||
ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
return (FALSE);
h = acpi_get_handle(dev);
if (h == NULL)
return (FALSE);
status = acpi_GetInteger(h, "_STA", &s);
/* If no _STA method, must be present */
present = (devinfo->Valid & ACPI_VALID_STA) == 0 ||
ACPI_DEVICE_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE;
/* If no _STA method, must be present */
if (ACPI_FAILURE(status))
return (status == AE_NOT_FOUND ? TRUE : FALSE);
AcpiOsFree(devinfo);
return (present);
return (ACPI_DEVICE_PRESENT(s) ? TRUE : FALSE);
}
/*
@ -2231,20 +2231,20 @@ acpi_DeviceIsPresent(device_t dev)
BOOLEAN
acpi_BatteryIsPresent(device_t dev)
{
ACPI_DEVICE_INFO *devinfo;
ACPI_HANDLE h;
BOOLEAN present;
ACPI_HANDLE h;
UINT32 s;
ACPI_STATUS status;
if ((h = acpi_get_handle(dev)) == NULL ||
ACPI_FAILURE(AcpiGetObjectInfo(h, &devinfo)))
return (FALSE);
h = acpi_get_handle(dev);
if (h == NULL)
return (FALSE);
status = acpi_GetInteger(h, "_STA", &s);
/* If no _STA method, must be present */
present = (devinfo->Valid & ACPI_VALID_STA) == 0 ||
ACPI_BATTERY_PRESENT(devinfo->CurrentStatus) ? TRUE : FALSE;
/* If no _STA method, must be present */
if (ACPI_FAILURE(status))
return (status == AE_NOT_FOUND ? TRUE : FALSE);
AcpiOsFree(devinfo);
return (present);
return (ACPI_BATTERY_PRESENT(s) ? TRUE : FALSE);
}
/*