From owner-svn-src-vendor@freebsd.org Wed Mar 14 19:17:41 2018 Return-Path: Delivered-To: svn-src-vendor@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED735F3A17A; Wed, 14 Mar 2018 19:17:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 998827234F; Wed, 14 Mar 2018 19:17:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 942713F79; Wed, 14 Mar 2018 19:17:40 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2EJHeJn023166; Wed, 14 Mar 2018 19:17:40 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2EJHcp8023141; Wed, 14 Mar 2018 19:17:38 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201803141917.w2EJHcp8023141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 14 Mar 2018 19:17:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r330941 - in vendor-sys/acpica/dist: . source/components/debugger source/components/dispatcher source/components/events source/components/executer source/components/hardware source/comp... X-SVN-Group: vendor-sys X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in vendor-sys/acpica/dist: . source/components/debugger source/components/dispatcher source/components/events source/components/executer source/components/hardware source/components/namespace source/c... X-SVN-Commit-Revision: 330941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2018 19:17:41 -0000 Author: jkim Date: Wed Mar 14 19:17:38 2018 New Revision: 330941 URL: https://svnweb.freebsd.org/changeset/base/330941 Log: Import ACPICA 20180313. Modified: vendor-sys/acpica/dist/changes.txt vendor-sys/acpica/dist/source/components/debugger/dbdisply.c vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c vendor-sys/acpica/dist/source/components/events/evevent.c vendor-sys/acpica/dist/source/components/events/evgpe.c vendor-sys/acpica/dist/source/components/events/evgpeblk.c vendor-sys/acpica/dist/source/components/events/evrgnini.c vendor-sys/acpica/dist/source/components/events/evxface.c vendor-sys/acpica/dist/source/components/events/evxfgpe.c vendor-sys/acpica/dist/source/components/executer/exdebug.c vendor-sys/acpica/dist/source/components/hardware/hwgpe.c vendor-sys/acpica/dist/source/components/hardware/hwsleep.c vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c vendor-sys/acpica/dist/source/components/namespace/nseval.c vendor-sys/acpica/dist/source/components/namespace/nsload.c vendor-sys/acpica/dist/source/components/namespace/nsparse.c vendor-sys/acpica/dist/source/components/namespace/nsxfname.c vendor-sys/acpica/dist/source/components/parser/psargs.c vendor-sys/acpica/dist/source/components/parser/psloop.c vendor-sys/acpica/dist/source/components/parser/psobject.c vendor-sys/acpica/dist/source/components/tables/tbdata.c vendor-sys/acpica/dist/source/components/tables/tbinstal.c vendor-sys/acpica/dist/source/components/tables/tbxfload.c vendor-sys/acpica/dist/source/components/utilities/utosi.c vendor-sys/acpica/dist/source/components/utilities/utxfinit.c vendor-sys/acpica/dist/source/include/acevents.h vendor-sys/acpica/dist/source/include/acmacros.h vendor-sys/acpica/dist/source/include/acpixf.h vendor-sys/acpica/dist/source/include/actypes.h vendor-sys/acpica/dist/source/include/platform/aclinux.h vendor-sys/acpica/dist/source/tools/acpiexec/aemain.c vendor-sys/acpica/dist/source/tools/acpiexec/aetables.c vendor-sys/acpica/dist/source/tools/acpinames/anmain.c vendor-sys/acpica/dist/source/tools/acpinames/anstubs.c vendor-sys/acpica/dist/source/tools/acpinames/antables.c vendor-sys/acpica/dist/source/tools/acpisrc/acpisrc.h vendor-sys/acpica/dist/source/tools/acpisrc/asconvrt.c vendor-sys/acpica/dist/source/tools/acpisrc/asfile.c vendor-sys/acpica/dist/source/tools/acpisrc/astable.c vendor-sys/acpica/dist/source/tools/acpisrc/asutils.c Modified: vendor-sys/acpica/dist/changes.txt ============================================================================== --- vendor-sys/acpica/dist/changes.txt Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/changes.txt Wed Mar 14 19:17:38 2018 (r330941) @@ -1,4 +1,50 @@ ---------------------------------------- +13 March 2018. Summary of changes for version 20180313: + + +1) ACPICA kernel-resident subsystem: + +Implemented various improvements to the GPE support: + +1) Dispatch all active GPEs at initialization time so that no GPEs are +lost. +2) Enable runtime GPEs earlier. Some systems expect GPEs to be enabled +before devices are enumerated. +3) Don't unconditionally clear ACPI IRQs during suspend/resume, so that +IRQs are not lost. +4) Add parallel GPE handling to eliminate the possibility of dispatching +the same GPE twice. +5) Dispatch any pending GPEs after enabling for the first time. + +AcpiGetObjectInfo - removed support for the _STA method. This was causing +problems on some platforms. + +Added a new _OSI string, "Windows 2017.2". + +Cleaned up and simplified the module-level code support. These changes +are in preparation for the eventual removal of the legacy MLC support +(deferred execution), replaced by the new MLC architecture which executes +the MLC as a table is loaded (DSDT/SSDTs). + +Changed a compile-time option to a runtime option. Changes the option to +ignore ACPI table load-time package resolution errors into a runtime +option. Used only for platforms that generate many AE_NOT_FOUND errors +during boot. AcpiGbl_IgnorePackageResolutionErrors. + +Fixed the ACPI_ERROR_NAMESPACE macro. This change involves putting some +ACPI_ERROR_NAMESPACE parameters inside macros. By doing so, we avoid +compilation errors from unused variables (seen with some compilers). + + +2) iASL Compiler/Disassembler and Tools: + +ASLTS: parallelized execution in order to achieve an (approximately) 2X +performance increase. + +ASLTS: Updated to use the iASL __LINE__ and __METHOD__ macros. Improves +error reporting. + +---------------------------------------- 09 February 2018. Summary of changes for version 20180209: Modified: vendor-sys/acpica/dist/source/components/debugger/dbdisply.c ============================================================================== --- vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/debugger/dbdisply.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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], Modified: vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c ============================================================================== --- vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/dispatcher/dspkginit.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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); Modified: vendor-sys/acpica/dist/source/components/events/evevent.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evevent.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evevent.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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", Modified: vendor-sys/acpica/dist/source/components/events/evgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evgpe.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evgpe.c Wed Mar 14 19:17:38 2018 (r330941) @@ -226,7 +226,7 @@ AcpiEvUpdateGpeEnableMask ( * * RETURN: Status * - * DESCRIPTION: Clear a GPE of stale events and enable it. + * DESCRIPTION: Enable a GPE. * ******************************************************************************/ @@ -240,14 +240,6 @@ AcpiEvEnableGpe ( ACPI_FUNCTION_TRACE (EvEnableGpe); - /* Clear the GPE (of stale events) */ - - Status = AcpiHwClearGpe (GpeEventInfo); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - /* Enable the requested GPE */ Status = AcpiHwLowSetGpe (GpeEventInfo, ACPI_GPE_ENABLE); @@ -542,17 +534,12 @@ UINT32 AcpiEvGpeDetect ( ACPI_GPE_XRUPT_INFO *GpeXruptList) { - ACPI_STATUS Status; ACPI_GPE_BLOCK_INFO *GpeBlock; ACPI_NAMESPACE_NODE *GpeDevice; ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; ACPI_GPE_EVENT_INFO *GpeEventInfo; UINT32 GpeNumber; - ACPI_GPE_HANDLER_INFO *GpeHandlerInfo; UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; - UINT8 EnabledStatusByte; - UINT64 StatusReg; - UINT64 EnableReg; ACPI_CPU_FLAGS Flags; UINT32 i; UINT32 j; @@ -608,105 +595,25 @@ AcpiEvGpeDetect ( continue; } - /* Read the Status Register */ - - Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - /* Read the Enable Register */ - - Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress); - if (ACPI_FAILURE (Status)) - { - goto UnlockAndExit; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, - "Read registers for GPE %02X-%02X: Status=%02X, Enable=%02X, " - "RunEnable=%02X, WakeEnable=%02X\n", - GpeRegisterInfo->BaseGpeNumber, - GpeRegisterInfo->BaseGpeNumber + (ACPI_GPE_REGISTER_WIDTH - 1), - (UINT32) StatusReg, (UINT32) EnableReg, - GpeRegisterInfo->EnableForRun, - GpeRegisterInfo->EnableForWake)); - - /* Check if there is anything active at all in this register */ - - EnabledStatusByte = (UINT8) (StatusReg & EnableReg); - if (!EnabledStatusByte) - { - /* No active GPEs in this register, move on */ - - continue; - } - /* Now look at the individual GPEs in this byte register */ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) { - /* Examine one GPE bit */ + /* Detect and dispatch one GPE bit */ GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i * ACPI_GPE_REGISTER_WIDTH) + j]; GpeNumber = j + GpeRegisterInfo->BaseGpeNumber; - - if (EnabledStatusByte & (1 << j)) - { - /* Invoke global event handler if present */ - - AcpiGpeCount++; - if (AcpiGbl_GlobalEventHandler) - { - AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, - GpeDevice, GpeNumber, - AcpiGbl_GlobalEventHandlerContext); - } - - /* Found an active GPE */ - - if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == - ACPI_GPE_DISPATCH_RAW_HANDLER) - { - /* Dispatch the event to a raw handler */ - - GpeHandlerInfo = GpeEventInfo->Dispatch.Handler; - - /* - * There is no protection around the namespace node - * and the GPE handler to ensure a safe destruction - * because: - * 1. The namespace node is expected to always - * exist after loading a table. - * 2. The GPE handler is expected to be flushed by - * AcpiOsWaitEventsComplete() before the - * destruction. - */ - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); - IntStatus |= GpeHandlerInfo->Address ( - GpeDevice, GpeNumber, GpeHandlerInfo->Context); - Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); - } - else - { - /* - * Dispatch the event to a standard handler or - * method. - */ - IntStatus |= AcpiEvGpeDispatch (GpeDevice, - GpeEventInfo, GpeNumber); - } - } + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + IntStatus |= AcpiEvDetectGpe ( + GpeDevice, GpeEventInfo, GpeNumber); + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); } } GpeBlock = GpeBlock->Next; } -UnlockAndExit: - AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); return (IntStatus); } @@ -894,6 +801,137 @@ AcpiEvFinishGpe ( /******************************************************************************* * + * FUNCTION: AcpiEvDetectGpe + * + * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 + * GpeEventInfo - Info for this GPE + * GpeNumber - Number relative to the parent GPE block + * + * RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED + * + * DESCRIPTION: Detect and dispatch a General Purpose Event to either a function + * (e.g. EC) or method (e.g. _Lxx/_Exx) handler. + * NOTE: GPE is W1C, so it is possible to handle a single GPE from both + * task and irq context in parallel as long as the process to + * detect and mask the GPE is atomic. + * However the atomicity of ACPI_GPE_DISPATCH_RAW_HANDLER is + * dependent on the raw handler itself. + * + ******************************************************************************/ + +UINT32 +AcpiEvDetectGpe ( + ACPI_NAMESPACE_NODE *GpeDevice, + ACPI_GPE_EVENT_INFO *GpeEventInfo, + UINT32 GpeNumber) +{ + UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED; + UINT8 EnabledStatusByte; + UINT64 StatusReg; + UINT64 EnableReg; + UINT32 RegisterBit; + ACPI_GPE_REGISTER_INFO *GpeRegisterInfo; + ACPI_GPE_HANDLER_INFO *GpeHandlerInfo; + ACPI_CPU_FLAGS Flags; + ACPI_STATUS Status; + + + ACPI_FUNCTION_TRACE (EvGpeDetect); + + + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + + /* Get the info block for the entire GPE register */ + + GpeRegisterInfo = GpeEventInfo->RegisterInfo; + + /* Get the register bitmask for this GPE */ + + RegisterBit = AcpiHwGetGpeRegisterBit (GpeEventInfo); + + /* GPE currently enabled (enable bit == 1)? */ + + Status = AcpiHwRead (&EnableReg, &GpeRegisterInfo->EnableAddress); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + /* GPE currently active (status bit == 1)? */ + + Status = AcpiHwRead (&StatusReg, &GpeRegisterInfo->StatusAddress); + if (ACPI_FAILURE (Status)) + { + goto ErrorExit; + } + + /* Check if there is anything active at all in this GPE */ + + ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS, + "Read registers for GPE %02X: Status=%02X, Enable=%02X, " + "RunEnable=%02X, WakeEnable=%02X\n", + GpeNumber, + (UINT32) (StatusReg & RegisterBit), + (UINT32) (EnableReg & RegisterBit), + GpeRegisterInfo->EnableForRun, + GpeRegisterInfo->EnableForWake)); + + EnabledStatusByte = (UINT8) (StatusReg & EnableReg); + if (!(EnabledStatusByte & RegisterBit)) + { + goto ErrorExit; + } + + /* Invoke global event handler if present */ + + AcpiGpeCount++; + if (AcpiGbl_GlobalEventHandler) + { + AcpiGbl_GlobalEventHandler (ACPI_EVENT_TYPE_GPE, + GpeDevice, GpeNumber, + AcpiGbl_GlobalEventHandlerContext); + } + + /* Found an active GPE */ + + if (ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) == + ACPI_GPE_DISPATCH_RAW_HANDLER) + { + /* Dispatch the event to a raw handler */ + + GpeHandlerInfo = GpeEventInfo->Dispatch.Handler; + + /* + * There is no protection around the namespace node + * and the GPE handler to ensure a safe destruction + * because: + * 1. The namespace node is expected to always + * exist after loading a table. + * 2. The GPE handler is expected to be flushed by + * AcpiOsWaitEventsComplete() before the + * destruction. + */ + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + IntStatus |= GpeHandlerInfo->Address ( + GpeDevice, GpeNumber, GpeHandlerInfo->Context); + Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); + } + else + { + /* Dispatch the event to a standard handler or method. */ + + IntStatus |= AcpiEvGpeDispatch (GpeDevice, + GpeEventInfo, GpeNumber); + } + +ErrorExit: + AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); + return (IntStatus); +} + + +/******************************************************************************* + * * FUNCTION: AcpiEvGpeDispatch * * PARAMETERS: GpeDevice - Device node. NULL for GPE0/GPE1 @@ -904,8 +942,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. * ******************************************************************************/ Modified: vendor-sys/acpica/dist/source/components/events/evgpeblk.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evgpeblk.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evgpeblk.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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,8 +642,16 @@ 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++; Modified: vendor-sys/acpica/dist/source/components/events/evrgnini.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evrgnini.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evrgnini.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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; Modified: vendor-sys/acpica/dist/source/components/events/evxface.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evxface.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evxface.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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); Modified: vendor-sys/acpica/dist/source/components/events/evxfgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/events/evxfgpe.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/events/evxfgpe.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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 { @@ -608,6 +627,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; } /* Modified: vendor-sys/acpica/dist/source/components/executer/exdebug.c ============================================================================== --- vendor-sys/acpica/dist/source/components/executer/exdebug.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/executer/exdebug.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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; Modified: vendor-sys/acpica/dist/source/components/hardware/hwgpe.c ============================================================================== --- vendor-sys/acpica/dist/source/components/hardware/hwgpe.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/hardware/hwgpe.c Wed Mar 14 19:17:38 2018 (r330941) @@ -658,7 +658,6 @@ AcpiHwDisableAllGpes ( Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, NULL); - Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, NULL); return_ACPI_STATUS (Status); } Modified: vendor-sys/acpica/dist/source/components/hardware/hwsleep.c ============================================================================== --- vendor-sys/acpica/dist/source/components/hardware/hwsleep.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/hardware/hwsleep.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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 (); Modified: vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c ============================================================================== --- vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/hardware/hwxfsleep.c Wed Mar 14 19:17:38 2018 (r330941) @@ -337,7 +337,7 @@ AcpiEnterSleepStateS4bios ( } /* - * 1) Disable/Clear all GPEs + * 1) Disable all GPEs * 2) Enable all wakeup GPEs */ Status = AcpiHwDisableAllGpes (); Modified: vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/namespace/nsdumpdv.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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); } Modified: vendor-sys/acpica/dist/source/components/namespace/nseval.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nseval.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/namespace/nseval.c Wed Mar 14 19:17:38 2018 (r330941) @@ -429,7 +429,17 @@ 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", Info->RelativePathname)); @@ -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; } Modified: vendor-sys/acpica/dist/source/components/namespace/nsload.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsload.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/namespace/nsload.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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); } Modified: vendor-sys/acpica/dist/source/components/namespace/nsparse.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsparse.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/namespace/nsparse.c Wed Mar 14 19:17:38 2018 (r330941) @@ -171,9 +171,18 @@ * * 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. + * ******************************************************************************/ ACPI_STATUS @@ -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)); Modified: vendor-sys/acpica/dist/source/components/namespace/nsxfname.c ============================================================================== --- vendor-sys/acpica/dist/source/components/namespace/nsxfname.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/namespace/nsxfname.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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,25 +518,12 @@ 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 */ Modified: vendor-sys/acpica/dist/source/components/parser/psargs.c ============================================================================== --- vendor-sys/acpica/dist/source/components/parser/psargs.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/parser/psargs.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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; Modified: vendor-sys/acpica/dist/source/components/parser/psloop.c ============================================================================== --- vendor-sys/acpica/dist/source/components/parser/psloop.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/parser/psloop.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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)) { /* @@ -439,6 +447,16 @@ AcpiPsGetArguments ( * DESCRIPTION: Wrap the module-level code with a method object and link the * 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. * ******************************************************************************/ Modified: vendor-sys/acpica/dist/source/components/parser/psobject.c ============================================================================== --- vendor-sys/acpica/dist/source/components/parser/psobject.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/parser/psobject.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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", Modified: vendor-sys/acpica/dist/source/components/tables/tbdata.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbdata.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/tables/tbdata.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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 Modified: vendor-sys/acpica/dist/source/components/tables/tbinstal.c ============================================================================== --- vendor-sys/acpica/dist/source/components/tables/tbinstal.c Wed Mar 14 19:09:58 2018 (r330940) +++ vendor-sys/acpica/dist/source/components/tables/tbinstal.c Wed Mar 14 19:17:38 2018 (r330941) @@ -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 OUTPUT TRUNCATED AT 1000 LINES ***