Home | History | Annotate | Download | only in acpi
History log of /src/sys/dev/acpi/acpi_wakedev.c
RevisionDateAuthorComments
 1.30  09-Dec-2024  jmcneill Don't setup GPEs on HW reduced platforms
 1.29  31-May-2022  mrg allow ACPI to compile without PCI support. fixes ia64 build.
 1.28  20-Dec-2021  skrll Fix struct member prefix to be consistent. same code before and after.
 1.27  01-Jun-2017  chs remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.26  25-Feb-2014  pooka branches: 1.26.6;
Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.25  14-Aug-2012  jruoho branches: 1.25.2; 1.25.4;
Use KM_SLEEP.
 1.24  19-Feb-2011  jruoho branches: 1.24.4;
Revisit the wake-device code once more.

1. Remove the AcpiEnableGpe() call. This was wrong.

2. Only call _PSW or _DSW for devices that are scheduled for wake.
This was an old bug.

3. Only enable wake GPEs during suspend. Disabling these for
devices not setup for wake was causing problems.

4. No wake GPEs should be enabled at runtime.
Unconditionally disable these during resume.

This should make the wake-device code work again. Note that waking via
pckbd(4) has always been unreliable; the _PRW object is not typically located
under the PC keyboard object, but in the parent of it (e.g. the LPC bridge).
 1.23  18-Feb-2011  jruoho A small cleanup for the previous; use kmem(9), add assertions, etc.
 1.22  17-Feb-2011  jruoho As explained in the new ACPICA documentation, as of ACPICA 20101207, the
_PRW methods are no longer automatically executed as part of the ACPICA
initialization. Refactor and rewrite the wake-device code to account this.
 1.21  17-Feb-2011  jruoho ACPICA 20101209:

Completed the major overhaul of the GPE support code that was begun in July
2010. Major features include: removal of _PRW execution in ACPICA (host
executes _PRWs anyway), cleanup of "wake" GPE interfaces and processing,
changes to existing interfaces, simplification of GPE handler operation, and
a handful of new interfaces:

AcpiUpdateAllGpes
AcpiFinishGpe
AcpiSetupGpeForWake
AcpiSetGpeWakeMask

ACPICA 20100702:

Implemented several updates to the recently added GPE reference count
support. The model for "wake" GPEs is changing to give the host OS complete
control of these GPEs. Eventually, the ACPICA core will not execute any _PRW
methods, since the host already must execute them. Also, additional changes
were made to help ensure that the reference counts are kept in proper
synchronization with reality. Rafael J. Wysocki.

1) Ensure that GPEs are not enabled twice during initialization.
2) Ensure that GPE enable masks stay in sync with the reference count.
3) Do not inadvertently enable GPEs when writing GPE registers.
4) Remove the internal wake reference counter and add new AcpiGpeWakeup
interface. This interface will set or clear individual GPEs for wakeup.
5) Remove GpeType argument from AcpiEnable and AcpiDisable. These interfaces
are now used for "runtime" GPEs only.
 1.20  02-Jan-2011  jruoho branches: 1.20.2; 1.20.4;
Adjust error messages for the previous commit.
 1.19  02-Jan-2011  jruoho Use "real" device names for the hw.acpi.wake and hw.acpi.power sysctl(8)
trees. For instance, instead of hw.acpi.wake.DURT, we have hw.acpi.wake.wm0
for wm(4). This is a temporary solution, but without solving the big
abstraction questions, this is the best we can do.
 1.18  08-Oct-2010  gsutre Store sysctl MIBs instead of a pointer to the root of the sysctl
sub-tree (because the pointer may be invalid at the time we use it).

ok jruoho@
 1.17  07-Jun-2010  jruoho Fix a bug: the last elements in the _PRW package are direct references to
power resources, not devices. Thus, we can not use the function that sets
the power state of a device.
 1.16  07-Jun-2010  jruoho Instead of disabling all GPEs for non-wakedevs, set both runtime and wake
GPEs, but unset only wake GPEs. The old behavior was questionable, as the
intention was only to disable a device's ability to wake the system.
Maintaining the runtime GPE generation is more important now as ACPICA
supports sharing a single GPE across multiple devices.

Discussed with jmcneill@.
 1.15  06-Jun-2010  jruoho ACPICA 20100331:

Completed a major update for the GPE support in order to improve
support for shared GPEs and to simplify both host OS and ACPICA
code. Added a reference count mechanism to support shared GPEs that
require multiple device drivers. Several external interfaces have
changed. One external interface has been removed. One new external
interface was added. Most of the GPE external interfaces now use the
GPE spinlock instead of the events mutex (and the Flags parameter
for many GPE interfaces has been removed.) See the updated ACPICA
Programmer Reference for details. Matthew Garrett, Bob Moore, Rafael
Wysocki. ACPICA BZ 831.

Changed:
AcpiEnableGpe, AcpiDisableGpe, AcpiClearGpe, AcpiGetGpeStatus
Removed:
AcpiSetGpeType
New:
AcpiSetGpe
 1.14  05-Jun-2010  jruoho Switch the third argument to the _DSW method from 3 to 0. This means that
devices should be placed in the D0 state ("fully on") after resume. We were
not prepared to handle the previous value as it implied that devices could
be placed in an arbitrary power state once in S0.

Minimal functional change, given that the _DSW is seldom seen in the field.
 1.13  05-Jun-2010  jruoho Complete the support for wakeup devices. As imposed by the standard, all
power resources should be turned on for wakeup devices. This follows common
sense: a device cannot wake if the power of it is turned off.

ok jmcneill@
 1.12  18-Apr-2010  jruoho branches: 1.12.2;
From Gregoire Sutre:

Modify the main ACPI namespace scan by including a parent-child
relationship for each node. The result is a bi-directional tree.

ok jmcneill@
 1.11  14-Apr-2010  jruoho Simplify the setting of the GPEs. Add a debug-printf.
 1.10  14-Apr-2010  jruoho Reorganize the main file: add several missing prototypes, move the functions
around so that they appear in their logical order and place, etc. In
addition, split the utility functions to a separate file.

No functional change. Ok jmcneill@.
 1.9  12-Apr-2010  jruoho Rework the sysctl-support.

Changes:

hw.wake -> hw.acpi.wake
hw.acpi.debug_layer -> hw.acpi.debug.layer
hw.acpi.debug_level -> hw.acpi.debug.level

Additions:

hw.acpi.stat.gpe # Number of dispatched GPEs
hw.acpi.stat.sci # Number of SCI interrupts
hw.acpi.stat.fixed # Number of fixed events
hw.acpi.stat.method # Number of executed methods

ok jmcneill@
 1.8  16-Mar-2010  jruoho Remove unused headers.
 1.7  16-Mar-2010  jruoho With the intent of making 'struct acpi_devnode' as the central place for
information related to ACPI device nodes: (a) introduce a generic scan
function for ACPI device driver "capabilities", and (b) eliminate local data
structures from ACPI wake-devices. Discussed with jmcneill@.
 1.6  09-Mar-2010  jruoho branches: 1.6.2;
Remove the namespace scopes.

These are neither used nor useful beyond the parser and interpreter.

ok jmcneill@, joerg@
 1.5  05-Mar-2010  jruoho Add the _COMPONENT definition and missing prototypes. Some related cosmetics.
 1.4  05-Mar-2010  jruoho Preparing a device for wakeup involves:

(a) turning on all power resources required by the device; and
(b) executing _DSW (or _PSW) control method.

This implements (b). Ok jmcneill@.
 1.3  05-Mar-2010  jruoho Remove <dev/acpi/acpica.h> from all files. It is included from
<dev/acpi/acpivar.h>. Ditto for <dev/sysmon/sysmonvar.h>, <sys/bus.h>,
<dev/pci/pcivar.h>, and <dev/isa/isavar.h>.

Also nuke a lot of unused and invalid headers. Some of these are audibly
provided by standard headers (namely <sys/param.h> and <sys/device.h>), some
have nothing to do with ACPI devices (e.g. <sys/syslog.h>), and some are
nonexistent local includes (e.g. "mpu_ym.h"). Moreoever, try to group the
includes into their respective blocks.

Tested with GENERIC and ALL (i386). No functional change.
 1.2  04-Aug-2009  jmcneill branches: 1.2.2; 1.2.4; 1.2.6;
remove extra semicolon, spotted by snj
 1.1  04-Aug-2009  jmcneill add hw.wake.* sysctl subtree for toggling which devices are allowed to
restore the system from sleep. set/clear wake GPEs as specified before
entering sleep.

by default, the following devices are enabled for wake:
- sleep/power buttons
- lid switch
- pc kbd controller

reviewed by: joerg
 1.2.6.3  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.2.6.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.2.6.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.2.4.2  05-Sep-2009  bouyer Pull up following revision(s) (requested by jmcneill in ticket #896):
sys/dev/acpi/acpi_button.c: revision 1.27 via patch
sys/dev/acpi/acpi_wakedev.h: revision 1.1 via patch
sys/dev/acpi/acpi_wakedev.c: revision 1.1 via patch
sys/dev/acpi/files.acpi: revision 1.55 via patch
sys/dev/acpi/acpi.c: revision 1.127 via patch
sys/dev/acpi/acpi_lid.c: revision 1.27 via patch
add hw.wake.* sysctl subtree for toggling which devices are allowed to
restore the system from sleep. set/clear wake GPEs as specified before
entering sleep.
by default, the following devices are enabled for wake:
- sleep/power buttons
- lid switch
- pc kbd controller
reviewed by: joerg
 1.2.4.1  04-Aug-2009  bouyer file acpi_wakedev.c was added on branch netbsd-5 on 2009-09-05 11:34:26 +0000
 1.2.2.4  11-Aug-2010  yamt sync with head.
 1.2.2.3  11-Mar-2010  yamt sync with head
 1.2.2.2  19-Aug-2009  yamt sync with head.
 1.2.2.1  04-Aug-2009  yamt file acpi_wakedev.c was added on branch yamt-nfs-mp on 2009-08-19 18:47:03 +0000
 1.6.2.3  05-Mar-2011  rmind sync with head
 1.6.2.2  03-Jul-2010  rmind sync with head
 1.6.2.1  30-May-2010  rmind sync with head
 1.12.2.2  21-Apr-2010  matt sync to netbsd-5
 1.12.2.1  18-Apr-2010  matt file acpi_wakedev.c was added on branch matt-nb5-mips64 on 2010-04-21 00:27:33 +0000
 1.20.4.2  05-Mar-2011  bouyer Sync with HEAD
 1.20.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.20.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.24.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.24.4.1  30-Oct-2012  yamt sync with head
 1.25.4.1  18-May-2014  rmind sync with head
 1.25.2.2  03-Dec-2017  jdolecek update from HEAD
 1.25.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.26.6.1  28-Aug-2017  skrll Sync with HEAD

RSS XML Feed