History log of /openbsd-current/sys/arch/macppc/dev/pm_direct.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.35 22-Nov-2023 tobhe

Add support for keyboard backlight on Apple Powerbooks.

From jon (at) elytron (dot) openbsd (dot) amsterdam
ok gkoehler@


Revision tags: OPENBSD_7_3_BASE OPENBSD_7_4_BASE
# 1.34 28-Dec-2022 jca

Ansify, fixes clang 15 -Wdeprecated-non-prototype (fatal with -Werror)

ok millert@


# 1.33 23-Oct-2022 kn

Constify send/receive command tables

Both only used for printf calls.

OK gkoehler


# 1.32 21-Oct-2022 gkoehler

hw.power, machdep.lidaction, machdep.pwraction for macppc

I can now use the power button to power off my macppcs running
OpenBSD. The new sysctls machdep.lidaction and machdep.pwraction act
like acpibtn(4), but we are missing code to suspend or hibernate a
macppc. Small kernels (bsd.rd) continue to ignore the power button.

adb(4) sends an environment interrupt when I unplug my PowerBook's AC
or close its lid. Rename PMU_INT_WAKEUP to PMU_INT_ENVIRONMENT like
other BSDs and Linux. Handle PMU_ENV_LID_CLOSED as a lid sensor and
PMU_ENV_AC_POWER by setting sysctl hw.power. Power buttons can either
use PMU_ENV_POWER_BUTTON or go through akbd(4); handle both kinds of
power buttons in the same way. Other models of macppc, with different
power buttons or lids, might not work yet. The lid sensor looks like,

$ sysctl hw.sensors
hw.sensors.adb0.indicator0=On (lid open)

kettenis@ warned against calling prsignal() from interrupt context,
and pointed me to task_add(9).


Revision tags: OPENBSD_7_2_BASE
# 1.31 18-Sep-2022 gkoehler

Define PMU_ADB_CMD and PMU_INT_ACK

Taking these definitions from NetBSD's pm_direct.h; most PMU_*
commands have the same names in the BSDs and Linux.

ok miod@ kettenis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.30 03-Sep-2019 deraadt

a sprinkling of function ansification


# 1.29 03-Sep-2019 deraadt

delete incorrect casts, and a bit if ansi functions; ok jcs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev


# 1.34 28-Dec-2022 jca

Ansify, fixes clang 15 -Wdeprecated-non-prototype (fatal with -Werror)

ok millert@


# 1.33 23-Oct-2022 kn

Constify send/receive command tables

Both only used for printf calls.

OK gkoehler


# 1.32 21-Oct-2022 gkoehler

hw.power, machdep.lidaction, machdep.pwraction for macppc

I can now use the power button to power off my macppcs running
OpenBSD. The new sysctls machdep.lidaction and machdep.pwraction act
like acpibtn(4), but we are missing code to suspend or hibernate a
macppc. Small kernels (bsd.rd) continue to ignore the power button.

adb(4) sends an environment interrupt when I unplug my PowerBook's AC
or close its lid. Rename PMU_INT_WAKEUP to PMU_INT_ENVIRONMENT like
other BSDs and Linux. Handle PMU_ENV_LID_CLOSED as a lid sensor and
PMU_ENV_AC_POWER by setting sysctl hw.power. Power buttons can either
use PMU_ENV_POWER_BUTTON or go through akbd(4); handle both kinds of
power buttons in the same way. Other models of macppc, with different
power buttons or lids, might not work yet. The lid sensor looks like,

$ sysctl hw.sensors
hw.sensors.adb0.indicator0=On (lid open)

kettenis@ warned against calling prsignal() from interrupt context,
and pointed me to task_add(9).


Revision tags: OPENBSD_7_2_BASE
# 1.31 18-Sep-2022 gkoehler

Define PMU_ADB_CMD and PMU_INT_ACK

Taking these definitions from NetBSD's pm_direct.h; most PMU_*
commands have the same names in the BSDs and Linux.

ok miod@ kettenis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.30 03-Sep-2019 deraadt

a sprinkling of function ansification


# 1.29 03-Sep-2019 deraadt

delete incorrect casts, and a bit if ansi functions; ok jcs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev


# 1.33 23-Oct-2022 kn

Constify send/receive command tables

Both only used for printf calls.

OK gkoehler


# 1.32 21-Oct-2022 gkoehler

hw.power, machdep.lidaction, machdep.pwraction for macppc

I can now use the power button to power off my macppcs running
OpenBSD. The new sysctls machdep.lidaction and machdep.pwraction act
like acpibtn(4), but we are missing code to suspend or hibernate a
macppc. Small kernels (bsd.rd) continue to ignore the power button.

adb(4) sends an environment interrupt when I unplug my PowerBook's AC
or close its lid. Rename PMU_INT_WAKEUP to PMU_INT_ENVIRONMENT like
other BSDs and Linux. Handle PMU_ENV_LID_CLOSED as a lid sensor and
PMU_ENV_AC_POWER by setting sysctl hw.power. Power buttons can either
use PMU_ENV_POWER_BUTTON or go through akbd(4); handle both kinds of
power buttons in the same way. Other models of macppc, with different
power buttons or lids, might not work yet. The lid sensor looks like,

$ sysctl hw.sensors
hw.sensors.adb0.indicator0=On (lid open)

kettenis@ warned against calling prsignal() from interrupt context,
and pointed me to task_add(9).


Revision tags: OPENBSD_7_2_BASE
# 1.31 18-Sep-2022 gkoehler

Define PMU_ADB_CMD and PMU_INT_ACK

Taking these definitions from NetBSD's pm_direct.h; most PMU_*
commands have the same names in the BSDs and Linux.

ok miod@ kettenis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.30 03-Sep-2019 deraadt

a sprinkling of function ansification


# 1.29 03-Sep-2019 deraadt

delete incorrect casts, and a bit if ansi functions; ok jcs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev


# 1.31 18-Sep-2022 gkoehler

Define PMU_ADB_CMD and PMU_INT_ACK

Taking these definitions from NetBSD's pm_direct.h; most PMU_*
commands have the same names in the BSDs and Linux.

ok miod@ kettenis@


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.30 03-Sep-2019 deraadt

a sprinkling of function ansification


# 1.29 03-Sep-2019 deraadt

delete incorrect casts, and a bit if ansi functions; ok jcs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev


# 1.30 03-Sep-2019 deraadt

a sprinkling of function ansification


# 1.29 03-Sep-2019 deraadt

delete incorrect casts, and a bit if ansi functions; ok jcs


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev


Revision tags: OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.28 26-Dec-2016 jca

Fix typo, happend -> happened


Revision tags: OPENBSD_6_0_BASE
# 1.27 15-Mar-2016 deraadt

not compiled before commit


# 1.26 14-Mar-2016 krw

Change a bunch of (<blah> *)0 to NULL.

ok beck@ deraadt@


Revision tags: OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE OPENBSD_5_9_BASE
# 1.25 23-Apr-2013 mpi

Don't assume time_t is an uint32_t.

ok deraadt@


Revision tags: OPENBSD_5_3_BASE
# 1.24 05-Dec-2012 deraadt

Remove excessive sys/cdefs.h inclusion
ok guenther millert kettenis


Revision tags: OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.23 14-May-2011 mpi

pm_* methods are always attached to a PMU, no need to check for hardware.

ok miod@


Revision tags: OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE
# 1.22 18-Feb-2007 gwk

Correct yo-yo shutdowns:
Apparently some machines don't detect a clean (i.e. software initiated)
shutdown; and ignore the 'wake on AC loss' bit, meaning they wake up
immediatly after being told to shutdown e.g. via shutdown -hp.

So now we continue preserve the wake on AC loss behaivour, howerver if we
initiate a clean shutdown we clear this bit so that it the machine does not
immediately power back up again.

ok kettenis@


# 1.21 12-Feb-2007 gwk

Add cuda_fileserver_mode() and pmu_fileserver_mode() that enable the wake
on AC loss feature of the power management IC. Make this the default
behaviour when booting OpenBSD from now on.

This will only affect machines that have the power suddenly cut, Performing
a shutdown requesting power down will clear this mode and its then possible
to remove the power cord, and plug it back in without the machine comming
back on automatically.

Tested by myself, drahn
ok kettenis, drahn.


Revision tags: OPENBSD_4_0_BASE
# 1.20 07-Mar-2006 miod

On via-pmu systems, check whether the firmware has found adb devices on the
bus to decide whether to go the long way or not when resetting the bus.
Fixes the long delay probe on Mac Mini. Tested by various.


Revision tags: OPENBSD_3_9_BASE
# 1.19 22-Feb-2006 miod

Expect PMU_INT_SNDBRT while resetting the adb bus; although this brings the
long probe delay on the Mac Mini, this is necessary for reliable adb device
detection on several PowerBook families.


# 1.18 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.17 22-Dec-2005 miod

Remove orphaned adb/pmu stuff; ok hshoexer@ kettenis@


# 1.16 10-Dec-2005 pedro

Just poll for PMU_INT_ADB_AUTO and PMU_INT_ADB interrupts when resetting
the device, should fix a huge delay attaching adb(4) on some boxes,
thanks to everyone who tested, okay deraadt@.


# 1.15 06-Dec-2005 pedro

typo


# 1.14 21-Oct-2005 kettenis

Clean up RTC code.
ok drahn@


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

spaces


# 1.12 16-Oct-2003 drahn

more ANSI/KNF.


Revision tags: OPENBSD_3_4_BASE
# 1.11 02-Jul-2003 drahn

Use defines for the interrupt type, not magic numbers.


Revision tags: UBC_SYNC_A
# 1.10 11-May-2003 deraadt

string cleaning; krw ok


Revision tags: OPENBSD_3_3_BASE UBC_SYNC_B
# 1.9 18-Oct-2002 drahn

Remove some very pointless 'if 0' code, some of which prevented compilation
with gcc3.2, and add a ';' for a case statement as it requests.


Revision tags: OPENBSD_3_2_BASE
# 1.8 18-Jun-2002 itojun

KNF (whitespace)


# 1.7 07-Jun-2002 miod

Vacuum cleaning of the adb code, step 1: random KNF, remove mac68k
leftovers, unused variables and functions, fix some comments, etc.


Revision tags: OPENBSD_3_1_BASE
# 1.6 10-Apr-2002 drahn

Handle all pending adb interrupts when searching for devices.
Adjust delays in the probe code. ok miod, matthieu, lebel, brad.


# 1.5 14-Mar-2002 millert

First round of __P removal in sys


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

branches: 1.4.4; 1.4.6;
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.3 20-Sep-2001 mpech

occured->occurred

idea from deraadt@ via NetBSD
millert@ ok


# 1.2 01-Sep-2001 drahn

correct files for the powerpc/mac/ -> macppc/dev which did not get
renamed correctly.


# 1.1 01-Sep-2001 drahn

The "powerpc" port which has supported the newer Apple Macintosh powerpc based
is being renamed to macppc. This is to allow sharing of common code
between different powerpc base platforms.

Most of the work involved in the renaming process was performed by miod@

Files moved from powerpc/mac to macppc/dev