History log of /openbsd-current/sys/arch/macppc/dev/apm.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.37 29-May-2024 jsg

indent with tabs not spaces; from jon@elytron.openbsd.amsterdam


# 1.36 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.35 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@


Revision tags: OPENBSD_7_3_BASE
# 1.34 23-Oct-2022 gkoehler

Connect macppc's power button and lid to the SUSPEND stubs

A kernel with option SUSPEND now calls gosleep() if I run zzz(8),
press the power button (when machdep.pwraction=2), or close the lid
(when machdep.lidaction=1). Because gosleep() is an empty stub, the
macppc does not really suspend; it only suspends some devices and
immediately resumes.

The interrupt from the power button or the lid needs some thread
(other than systq) to call sleep_state(). Use taskq_create(9) to
create another thread.

Add a call to device_register_wakeup(). Without this call,
sleep_state() does nothing.

ok kettenis@ deraadt@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.33 13-Mar-2022 mpi

Constify struct cfattach.

ok miod@


# 1.32 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.31 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.30 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.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


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


Revision tags: OPENBSD_7_3_BASE
# 1.34 23-Oct-2022 gkoehler

Connect macppc's power button and lid to the SUSPEND stubs

A kernel with option SUSPEND now calls gosleep() if I run zzz(8),
press the power button (when machdep.pwraction=2), or close the lid
(when machdep.lidaction=1). Because gosleep() is an empty stub, the
macppc does not really suspend; it only suspends some devices and
immediately resumes.

The interrupt from the power button or the lid needs some thread
(other than systq) to call sleep_state(). Use taskq_create(9) to
create another thread.

Add a call to device_register_wakeup(). Without this call,
sleep_state() does nothing.

ok kettenis@ deraadt@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.33 13-Mar-2022 mpi

Constify struct cfattach.

ok miod@


# 1.32 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.31 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.30 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.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.34 23-Oct-2022 gkoehler

Connect macppc's power button and lid to the SUSPEND stubs

A kernel with option SUSPEND now calls gosleep() if I run zzz(8),
press the power button (when machdep.pwraction=2), or close the lid
(when machdep.lidaction=1). Because gosleep() is an empty stub, the
macppc does not really suspend; it only suspends some devices and
immediately resumes.

The interrupt from the power button or the lid needs some thread
(other than systq) to call sleep_state(). Use taskq_create(9) to
create another thread.

Add a call to device_register_wakeup(). Without this call,
sleep_state() does nothing.

ok kettenis@ deraadt@


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.33 13-Mar-2022 mpi

Constify struct cfattach.

ok miod@


# 1.32 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.31 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.30 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.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.33 13-Mar-2022 mpi

Constify struct cfattach.

ok miod@


# 1.32 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.31 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.30 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.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.32 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.31 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.30 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.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.29 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.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.28 12-Feb-2022 deraadt

add MP stubs


# 1.27 12-Feb-2022 deraadt

for non-SUSPEND kernel, put the ioctl pieces entirely inside #ifdef


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.26 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.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.25 10-Feb-2022 gkoehler

Add stubs for macppc suspend

These stubs don't work; they only pretend to suspend the machine.
SUSPEND + MULTIPROCESSOR doesn't build. zzz(8) stops giving an error
message, even in no-SUSPEND kernels.

Add intr_enable in <powerpc/cpu.h>, adapted from powerpc64, because
subr_suspend.c calls intr_enable().


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

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.24 26-Mar-2021 kn

Return EOPNOTSUPP for unsupported ioctls

Match what apm(4/macppc) says and make apmd(8) log an approiate warning when
unsupported power actions are requested.

Merge identical cases while here.

This syncs with the apm ioctl handlers on loongson and arm64.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.23 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_7_BASE OPENBSD_6_8_BASE
# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.22 07-Apr-2020 visa

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

OK mpi@, anton@


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.21 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.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


# 1.20 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_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.19 05-Dec-2016 fcambus

Harmonize battery state thresholds accross platforms.

Use the same values hardcoded in sys/dev/acpi/acpi.c where possible.

OK visa@


# 1.18 08-Oct-2016 guenther

Various printf claim to report the PID, so actually report that and not the TID

Build testing assistance from deraadt@


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE OPENBSD_6_0_BASE
# 1.17 02-Jul-2011 nicm

kqueue attach functions should return an errno or 0, not a plain 1. Fix
the obvious cases to return EINVAL and ENXIO.

ok tedu deraadt


# 1.16 16-Jun-2011 mpi

Uses generic confargs to attach the apm(4) and piic(4) drivers instead of
the specifics adb arguments.
Now apm(4) no longer depends on adb stuff and piic(4) doesn't attach on a
via-cuda machine (e.g. my color G3 iMac).

ok miod@


# 1.15 15-Jun-2011 miod

Add a const char* as first member of struct adb_attach_args, so that we can
pass a struct confargs * on macppc for some specific children of the adb
node, and not confuse real adb device attachments.
ok mpi@


Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.14 26-Feb-2009 oga

Add a two new ioctls to the apm(4) interface.

APM_IOC_{SUSPEND,STANDBY}_REQ: This is to fix an issue with apm suspend
where a call to zzz suspended the machine immediately, not giving anyone
listening for apm events (other than apmd) a chance to deal with the
upcoming change. This hit X hard since the introduction of drm, since it
needs to have time to idle the 3d engine and otherwise get the device
into a recoverable state. Such things are needed until we support
modesetting in the kernel.

Now, instead of forcing a suspend, using ioctl sends out an event similar
to if you had put the lid down, giving all userland applications a
chance to reply.

tested by sthen@ and beck@, especial thanks to sthen for sitting there
while I tried to debug this remotely, I owe him beer.

Prompted by and ok deraadt@


Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE
# 1.13 11-Dec-2007 tedu

reword license to change regents to authors, and remove advertising clause.
cleared with all original authors. ok deraadt


Revision tags: OPENBSD_3_9_BASE OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE
# 1.12 18-Jan-2006 miod

Factorize akbd and ams drivers between mac68k and macppc; while there, start
moving out common adb code as well, and merge adb_direct.c into adb.c to
simplify external header files.

No functional change; more cleanups to come.


# 1.11 15-Oct-2005 martin

- merge adb_direct.h bits into adbvar.h
- rename ADB_HW_PB to ADB_HW_PMU

from NetBSD

ok brad@; additonal testing krw@


Revision tags: OPENBSD_3_8_BASE
# 1.10 29-Mar-2005 miod

Missing break;


Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE OPENBSD_3_7_BASE SMP_SYNC_A SMP_SYNC_B
# 1.9 16-Oct-2003 deraadt

spaces


# 1.8 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE UBC_SYNC_A UBC_SYNC_B
# 1.7 15-Sep-2002 deraadt

backout premature


# 1.6 15-Sep-2002 deraadt

KNF


# 1.5 07-Jun-2002 miod

KNF


Revision tags: OPENBSD_3_1_BASE
# 1.4 14-Mar-2002 millert

Final __P removal plus some cosmetic fixups


# 1.3 14-Mar-2002 millert

First round of __P removal in sys


Revision tags: OPENBSD_3_0_BASE UBC_BASE
# 1.2 03-Oct-2001 drahn

branches: 1.2.4; 1.2.6;
Add $OpenBSD$ tags which were removed when this code was copied.


# 1.1 03-Oct-2001 drahn

apm support for macppc. This is not fully implemented, sleep modes
and power event are not handled, however it is enough support
to poll the battery/AC/charging states of the system.
Code by Alexander Guy.