History log of /openbsd-current/sys/arch/arm64/dev/apm.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.25 28-May-2024 kettenis

Garbage collect sleep_abort(); it doesn't do anything useful anymore.

ok deraadt@, mlarkin@


Revision tags: OPENBSD_7_4_BASE OPENBSD_7_5_BASE
# 1.24 08-Jul-2023 tobhe

Adds request_sleep(), a MI way of sending the machine to sleep in
a safe thread. Support is limited to amd64, i386 and arm64 at the
moment, macppc gets only an empty stub.

feedback from kettenis@
tested by bluhm@
ok phessler@


# 1.23 05-Jul-2023 tobhe

Suspend from suspend_taskq in apmioctl.

ok kettenis@


Revision tags: OPENBSD_7_3_BASE
# 1.22 10-Feb-2023 visa

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@


# 1.21 22-Jan-2023 kettenis

Simplify the (so far unused) apm_record_event() function a bit and use it
to send a resume event to userland when we come out of suspend.

ok deraadt@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.24 08-Jul-2023 tobhe

Adds request_sleep(), a MI way of sending the machine to sleep in
a safe thread. Support is limited to amd64, i386 and arm64 at the
moment, macppc gets only an empty stub.

feedback from kettenis@
tested by bluhm@
ok phessler@


# 1.23 05-Jul-2023 tobhe

Suspend from suspend_taskq in apmioctl.

ok kettenis@


Revision tags: OPENBSD_7_3_BASE
# 1.22 10-Feb-2023 visa

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@


# 1.21 22-Jan-2023 kettenis

Simplify the (so far unused) apm_record_event() function a bit and use it
to send a resume event to userland when we come out of suspend.

ok deraadt@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.23 05-Jul-2023 tobhe

Suspend from suspend_taskq in apmioctl.

ok kettenis@


Revision tags: OPENBSD_7_3_BASE
# 1.22 10-Feb-2023 visa

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@


# 1.21 22-Jan-2023 kettenis

Simplify the (so far unused) apm_record_event() function a bit and use it
to send a resume event to userland when we come out of suspend.

ok deraadt@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.22 10-Feb-2023 visa

Adjust knote(9) API

Make knote(9) lock the knote list internally, and add knote_locked(9)
for the typical situation where the list is already locked.

Remove the KNOTE(9) macro to simplify the API.

Manual page OK jmc@
OK mpi@ mvs@


# 1.21 22-Jan-2023 kettenis

Simplify the (so far unused) apm_record_event() function a bit and use it
to send a resume event to userland when we come out of suspend.

ok deraadt@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.21 22-Jan-2023 kettenis

Simplify the (so far unused) apm_record_event() function a bit and use it
to send a resume event to userland when we come out of suspend.

ok deraadt@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.20 09-Jan-2023 kettenis

Implement suspend on lid close.

ok tobhe@, deraadt@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.19 10-Nov-2022 jsg

pscivar.h include no longer needed
ok kettenis@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.18 10-Nov-2022 kettenis

arm64 can suspend without PSCI support now

ok deraadt@, phessler@


Revision tags: OPENBSD_7_2_BASE
# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.17 13-Jul-2022 kettenis

Implement the fundamentals for suspend/resume on arm64. This uses PSCI
to turn off the secondary CPUs and suspend the primary CPU using the
CPU_OFF and SYSTEM_SUSPEND calls. A new "halt" IPI is added to turn off
the ssecondary CPUs. This IPI is implemented for the ampintc(4) and
agintc(4) interrupt controllers. Fulle suspend/resume support is only
implemented for ampintc(4). This is enough to suspend and resume boards
based on the Allwinner A64 SoC, provided the necessary wakeup interrupts
have been set up (not part of this commit).

ok patrick@


Revision tags: OPENBSD_7_1_BASE
# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.16 16-Feb-2022 deraadt

change MD gosleep() and sleep_finish() to return int, the MI code will be
able to react to this suitably.


# 1.15 15-Feb-2022 deraadt

Since acpitoshiba brightness button processing no longer plays games
with AML parsing outside the acpi thread, the locking-release dance
around wsdisplay_{suspend,resume} can be removed
ok kettenis


# 1.14 15-Feb-2022 deraadt

when the MI suspend code encounters problems, we need a way to
reset the MD state before bailing out. New MD function sleep_abort()
does that.


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.13 15-Feb-2022 deraadt

MI disable_lid_wakeups() is not needed, x86 systems can do this
in sleep_resume(), which seems sensible for other future systems also


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.12 11-Feb-2022 deraadt

the sleep_clocks() hook is not needed because the architectures which
need to do this can do it a few moments later in a different hook


# 1.11 11-Feb-2022 deraadt

sleep_cpu/resume_cpu are part of an earlier MI split attempt
noticed by kettenis


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.10 10-Feb-2022 deraadt

#ifdef the SUSPEND ioctl block


# 1.9 09-Feb-2022 deraadt

*** empty log message ***


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.8 24-Oct-2021 mpi

Constify struct cfattach.

ok visa@ a long time ago, ok patrick@


Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.7 26-Mar-2021 kn

Fix errno, merge ioctl cases

The EBADF error is always overwritten for the standby, suspend and
hibernate ioctls, only the mode ioctl has it right.

Merge the now identical casese while here.

OK patrick


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.6 25-Dec-2020 visa

Refactor klist insertion and removal

Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.

Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.

OK mpi@


Revision tags: OPENBSD_6_8_BASE
# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.5 29-May-2020 deraadt

dev/rndvar.h no longer has statistical interfaces (removed during various
conversion steps). it only contains kernel prototypes for 4 interfaces,
all of which legitimately belong in sys/systm.h, which are already included
by all enqueue_randomness() users.


Revision tags: OPENBSD_6_7_BASE
# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.4 07-Apr-2020 visa

Abstract the head of knote lists. This allows extending the lists,
for example, with locking assertions.

OK mpi@, anton@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@


# 1.3 20-Feb-2020 visa

Replace field f_isfd with field f_flags in struct filterops to allow
adding more filter properties without cluttering the struct.

OK mpi@, anton@


# 1.2 31-Dec-2019 visa

Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.

OK mpi@, deraadt@, anton@, bluhm@


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.1 23-Jan-2019 phessler

Add the apm(4) subsystem to arm64.

NB: acpi(4) is not hooked up to this yet.

previous version OK deraadt@ patrick@
OK jsg@