hi, the attached diff renames sgi's power(4) driver to nmi(4). that name makes actually a lot more sense.
i'll commit the manpage bits separately. ok? -- Stay Hungry. Stay Foolish. Index: share/man/man4/man4.sgi/Makefile =================================================================== RCS file: /cvs/src/share/man/man4/man4.sgi/Makefile,v retrieving revision 1.20 diff -p -u -p -u -r1.20 Makefile --- share/man/man4/man4.sgi/Makefile 8 Mar 2010 01:47:00 -0000 1.20 +++ share/man/man4/man4.sgi/Makefile 29 Mar 2010 21:39:39 -0000 @@ -2,7 +2,7 @@ MAN= dsrtc.4 gbe.4 iec.4 impact.4 intro.4 ioc.4 iockbc.4 iof.4 \ macebus.4 mavb.4 mec.4 mkbc.4 odyssey.4 \ - owmac.4 owserial.4 power.4 xbow.4 xbridge.4 xheart.4 + owmac.4 owserial.4 nmi.4 xbow.4 xbridge.4 xheart.4 MLINKS= macebus.4 macepcibr.4 \ xbridge.4 xbpci.4 Index: share/man/man4/man4.sgi/nmi.4 =================================================================== RCS file: share/man/man4/man4.sgi/nmi.4 diff -N share/man/man4/man4.sgi/nmi.4 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ share/man/man4/man4.sgi/nmi.4 29 Mar 2010 21:39:39 -0000 @@ -0,0 +1,57 @@ +.\" $OpenBSD$ +.\" +.\" Copyright (c) 2007,2010 Jasper Lievisse Adriaanse <jas...@openbsd.org> +.\" All rights reserved. +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd $Mdocdate$ +.Dt NMI 4 sgi +.Os +.Sh NAME +.Nm nmi +.Nd non-meaningful interrupt +.Sh SYNOPSIS +.Cd "nmi0 at macebus0" Pq "O2" +.Cd "nmi0 at mainbus0" Pq "Octane" +.Sh DESCRIPTION +The SGI O2 and Octane machines are equiped with a button that generates +a non-meaningfull interrupt (NMI) when pressed. +The +.Nm +driver catches that interrupt. +If the +.Va machdep.kbdreset +.Xr sysctl 8 +is set to 1, +.Nm +will then signal +.Xr init 8 +to do a clean +.Xr shutdown 8 . +.Sh SEE ALSO +.Xr intro 4 , +.Xr macebus 4 , +.Xr init 8 , +.Xr rc.shutdown 8 , +.Xr sysctl 8 +.Sh HISTORY +Support for the +.Nm +driver first appeared in +.Ox 4.8 . +.Sh AUTHORS +The +.Nm +driver was written by +.An Jasper Lievisse Adriaanse Aq jas...@openbsd.org . Index: share/man/man4/man4.sgi/power.4 =================================================================== RCS file: share/man/man4/man4.sgi/power.4 diff -N share/man/man4/man4.sgi/power.4 --- share/man/man4/man4.sgi/power.4 26 Oct 2009 18:38:09 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,57 +0,0 @@ -.\" $OpenBSD: power.4,v 1.3 2009/10/26 18:38:09 miod Exp $ -.\" -.\" Copyright (c) 2007 Jasper Lievisse Adriaanse <jas...@openbsd.org> -.\" All rights reserved. -.\" -.\" Permission to use, copy, modify, and distribute this software for any -.\" purpose with or without fee is hereby granted, provided that the above -.\" copyright notice and this permission notice appear in all copies. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -.\" -.Dd $Mdocdate: October 26 2009 $ -.Dt POWER 4 sgi -.Os -.Sh NAME -.Nm power -.Nd power button -.Sh SYNOPSIS -.Cd "power0 at macebus0" Pq "O2" -.Cd "power0 at mainbus0" Pq "Octane" -.Sh DESCRIPTION -The SGI O2 and Octane machines generate an interrupt when the power button -on the front panel is pressed. -The -.Nm -driver catches that interrupt. -If the -.Va machdep.kbdreset -.Xr sysctl 8 -is set to 1, -.Nm -will then signal -.Xr init 8 -to do a clean -.Xr shutdown 8 . -.Sh SEE ALSO -.Xr intro 4 , -.Xr macebus 4 , -.Xr init 8 , -.Xr rc.shutdown 8 , -.Xr sysctl 8 -.Sh HISTORY -Support for the -.Nm -driver first appeared in -.Ox 4.3 . -.Sh AUTHORS -The -.Nm -driver was written by -.An Jasper Lievisse Adriaanse Aq jas...@openbsd.org . Index: sys/arch/sgi/conf/GENERIC-IP30 =================================================================== RCS file: /cvs/src/sys/arch/sgi/conf/GENERIC-IP30,v retrieving revision 1.28 diff -p -u -p -u -r1.28 GENERIC-IP30 --- sys/arch/sgi/conf/GENERIC-IP30 28 Mar 2010 17:15:24 -0000 1.28 +++ sys/arch/sgi/conf/GENERIC-IP30 29 Mar 2010 21:39:39 -0000 @@ -39,7 +39,7 @@ config bsd swap generic mainbus0 at root cpu* at mainbus0 clock0 at mainbus0 -power0 at mainbus0 +nmi0 at mainbus0 #### Main local buses xbow0 at mainbus0 Index: sys/arch/sgi/conf/GENERIC-IP32 =================================================================== RCS file: /cvs/src/sys/arch/sgi/conf/GENERIC-IP32,v retrieving revision 1.19 diff -p -u -p -u -r1.19 GENERIC-IP32 --- sys/arch/sgi/conf/GENERIC-IP32 28 Mar 2010 17:15:24 -0000 1.19 +++ sys/arch/sgi/conf/GENERIC-IP32 29 Mar 2010 21:39:40 -0000 @@ -55,7 +55,7 @@ mkbc0 at macebus0 com0 at macebus0 base 0x00390000 com1 at macebus0 base 0x00398000 dsrtc0 at macebus0 -power0 at macebus0 +nmi0 at macebus0 #### PCI Bus macepcibr0 at macebus0 # MACE controller PCI Bus bridge. @@ -91,7 +91,7 @@ uvscom* at uhub? # SUNTAC Slipper U VS- ucom* at uvscom? ubsa* at uhub? # Belkin serial adapter ucom* at ubsa? -uaudio* at uhub? # USB Audio +uaudio* at uhub? # USB Audio audio* at uaudio? ulpt* at uhub? # USB Printers umass* at uhub? # USB Mass Storage devices Index: sys/arch/sgi/conf/files.sgi =================================================================== RCS file: /cvs/src/sys/arch/sgi/conf/files.sgi,v retrieving revision 1.45 diff -p -u -p -u -r1.45 files.sgi --- sys/arch/sgi/conf/files.sgi 22 Mar 2010 21:22:08 -0000 1.45 +++ sys/arch/sgi/conf/files.sgi 29 Mar 2010 21:39:40 -0000 @@ -164,12 +164,12 @@ device mkbc: pckbcslot attach mkbc at macebus file arch/sgi/dev/mkbc.c mkbc needs-flag -# Power button -device power -attach power at macebus with power_macebus -attach power at mainbus with power_mainbus -file arch/sgi/dev/power.c power | - power_macebus | power_mainbus +# Non-meaningful Interrupt +device nmi +attach nmi at macebus with nmi_macebus +attach nmi at mainbus with nmi_mainbus +file arch/sgi/dev/nmi.c nmi | + nmi_macebus | nmi_mainbus needs-flag # Raster operations Index: sys/arch/sgi/dev/dsrtc.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/dev/dsrtc.c,v retrieving revision 1.11 diff -p -u -p -u -r1.11 dsrtc.c --- sys/arch/sgi/dev/dsrtc.c 7 Nov 2009 14:49:01 -0000 1.11 +++ sys/arch/sgi/dev/dsrtc.c 29 Mar 2010 21:39:40 -0000 @@ -417,7 +417,7 @@ ds1742_set(void *v, struct tod_time *ct) /* * Routines allowing external access to the RTC registers, used by - * power(4). + * nmi(4). */ int Index: sys/arch/sgi/dev/dsrtcvar.h =================================================================== RCS file: /cvs/src/sys/arch/sgi/dev/dsrtcvar.h,v retrieving revision 1.1 diff -p -u -p -u -r1.1 dsrtcvar.h --- sys/arch/sgi/dev/dsrtcvar.h 15 May 2009 23:03:32 -0000 1.1 +++ sys/arch/sgi/dev/dsrtcvar.h 29 Mar 2010 21:39:40 -0000 @@ -18,7 +18,7 @@ /* * Routines allowing external access to the RTC registers, used by - * power(4). + * nmi(4). */ int dsrtc_register_read(int); Index: sys/arch/sgi/dev/nmi.c =================================================================== RCS file: sys/arch/sgi/dev/nmi.c diff -N sys/arch/sgi/dev/nmi.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ sys/arch/sgi/dev/nmi.c 29 Mar 2010 21:39:40 -0000 @@ -0,0 +1,149 @@ +/* $OpenBSD$ */ + +/* + * Copyright (c) 2007,2010 Jasper Lievisse Adriaanse <jas...@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/proc.h> +#include <sys/signalvar.h> + +#include <machine/autoconf.h> +#include <mips64/archtype.h> + +#include <dev/ic/ds1687reg.h> +#include <sgi/dev/dsrtcvar.h> + +#include "nmi.h" + +/* + * Non-meaningfull Interrupt (NMI) driver for the SGI O2 and Octane. + */ + +int nmi_intr(void *); + +struct cfdriver nmi_cd = { + NULL, "nmi", DV_DULL +}; + +#if NNMI_MACEBUS > 0 + +#include <sgi/localbus/macebusvar.h> + +void nmi_macebus_attach(struct device *, struct device *, void *); +int nmi_macebus_match(struct device *, void *, void *); + +struct cfattach nmi_macebus_ca = { + sizeof(struct device), nmi_macebus_match, nmi_macebus_attach +}; + +int +nmi_macebus_match(struct device *parent, void *match, void *aux) +{ + return (1); +} + +void +nmi_macebus_attach(struct device *parent, struct device *self, void *aux) +{ + struct macebus_attach_args *maa = aux; + + /* Establish interrupt handler. */ + if (macebus_intr_establish(maa->maa_intr, maa->maa_mace_intr, + IST_EDGE, IPL_TTY, nmi_intr, self, self->dv_xname)) + printf("\n"); + else + printf(": unable to establish interrupt!\n"); +} + +#endif + +#if NNMI_MAINBUS > 0 + +#include <sgi/xbow/xbow.h> +#include <sgi/xbow/xheartreg.h> + +void nmi_mainbus_attach(struct device *, struct device *, void *); +int nmi_mainbus_match(struct device *, void *, void *); +int nmi_mainbus_intr(void *); + +struct cfattach nmi_mainbus_ca = { + sizeof(struct device), nmi_mainbus_match, nmi_mainbus_attach +}; + +int +nmi_mainbus_match(struct device *parent, void *match, void *aux) +{ + struct mainbus_attach_args *maa = aux; + + if (strcmp(maa->maa_name, nmi_cd.cd_name) != 0) + return 0; + + return sys_config.system_type == SGI_OCTANE ? 1 : 0; +} + +void +nmi_mainbus_attach(struct device *parent, struct device *self, void *aux) +{ + /* Establish interrupt handler. */ + if (xbow_intr_establish(nmi_mainbus_intr, self, HEART_ISR_NMI, + IPL_TTY, self->dv_xname, NULL) != 0) { + printf(": unable to establish interrupt!\n"); + return; + } + + printf("\n"); +} + +int +nmi_mainbus_intr(void *v) +{ + /* + * Clear interrupt condition; debouncing the kickstart bit will not + * suffice. + */ + xbow_intr_clear(HEART_ISR_NMI); + + return nmi_intr(v); +} + +#endif + +int +nmi_intr(void *unused) +{ + extern int kbd_reset; + int val; + + /* + * Prevent further interrupts by clearing the kickstart flag + * in the DS1687's extended control register. + */ + val = dsrtc_register_read(DS1687_EXT_CTRL); + if (val == -1) + return 1; /* no rtc attached */ + + /* debounce condition */ + dsrtc_register_write(DS1687_EXT_CTRL, val & ~DS1687_KICKSTART); + + if (kbd_reset == 1) { + kbd_reset = 0; + psignal(initproc, SIGUSR2); + } + + return 1; +} Index: sys/arch/sgi/dev/power.c =================================================================== RCS file: sys/arch/sgi/dev/power.c diff -N sys/arch/sgi/dev/power.c --- sys/arch/sgi/dev/power.c 25 Nov 2009 11:23:29 -0000 1.13 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,149 +0,0 @@ -/* $OpenBSD: power.c,v 1.13 2009/11/25 11:23:29 miod Exp $ */ - -/* - * Copyright (c) 2007 Jasper Lievisse Adriaanse <jas...@openbsd.org> - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/device.h> -#include <sys/proc.h> -#include <sys/signalvar.h> - -#include <machine/autoconf.h> -#include <mips64/archtype.h> - -#include <dev/ic/ds1687reg.h> -#include <sgi/dev/dsrtcvar.h> - -#include "power.h" - -/* - * Power button driver for the SGI O2 and Octane. - */ - -int power_intr(void *); - -struct cfdriver power_cd = { - NULL, "power", DV_DULL -}; - -#if NPOWER_MACEBUS > 0 - -#include <sgi/localbus/macebusvar.h> - -void power_macebus_attach(struct device *, struct device *, void *); -int power_macebus_match(struct device *, void *, void *); - -struct cfattach power_macebus_ca = { - sizeof(struct device), power_macebus_match, power_macebus_attach -}; - -int -power_macebus_match(struct device *parent, void *match, void *aux) -{ - return (1); -} - -void -power_macebus_attach(struct device *parent, struct device *self, void *aux) -{ - struct macebus_attach_args *maa = aux; - - /* Establish interrupt handler. */ - if (macebus_intr_establish(maa->maa_intr, maa->maa_mace_intr, - IST_EDGE, IPL_TTY, power_intr, self, self->dv_xname)) - printf("\n"); - else - printf(": unable to establish interrupt!\n"); -} - -#endif - -#if NPOWER_MAINBUS > 0 - -#include <sgi/xbow/xbow.h> -#include <sgi/xbow/xheartreg.h> - -void power_mainbus_attach(struct device *, struct device *, void *); -int power_mainbus_match(struct device *, void *, void *); -int power_mainbus_intr(void *); - -struct cfattach power_mainbus_ca = { - sizeof(struct device), power_mainbus_match, power_mainbus_attach -}; - -int -power_mainbus_match(struct device *parent, void *match, void *aux) -{ - struct mainbus_attach_args *maa = aux; - - if (strcmp(maa->maa_name, power_cd.cd_name) != 0) - return 0; - - return sys_config.system_type == SGI_OCTANE ? 1 : 0; -} - -void -power_mainbus_attach(struct device *parent, struct device *self, void *aux) -{ - /* Establish interrupt handler. */ - if (xbow_intr_establish(power_mainbus_intr, self, HEART_ISR_POWER, - IPL_TTY, self->dv_xname, NULL) != 0) { - printf(": unable to establish interrupt!\n"); - return; - } - - printf("\n"); -} - -int -power_mainbus_intr(void *v) -{ - /* - * Clear interrupt condition; debouncing the kickstart bit will not - * suffice. - */ - xbow_intr_clear(HEART_ISR_POWER); - - return power_intr(v); -} - -#endif - -int -power_intr(void *unused) -{ - extern int kbd_reset; - int val; - - /* - * Prevent further interrupts by clearing the kickstart flag - * in the DS1687's extended control register. - */ - val = dsrtc_register_read(DS1687_EXT_CTRL); - if (val == -1) - return 1; /* no rtc attached */ - dsrtc_register_write(DS1687_EXT_CTRL, val & ~DS1687_KICKSTART); - - if (kbd_reset == 1) { - kbd_reset = 0; - psignal(initproc, SIGUSR2); - } - - return 1; -} Index: sys/arch/sgi/localbus/macebus.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/localbus/macebus.c,v retrieving revision 1.56 diff -p -u -p -u -r1.56 macebus.c --- sys/arch/sgi/localbus/macebus.c 25 Nov 2009 17:39:51 -0000 1.56 +++ sys/arch/sgi/localbus/macebus.c 29 Mar 2010 21:39:40 -0000 @@ -196,7 +196,7 @@ struct macebus_attach_args macebus_child MACEBUSDEV("mkbc", MACE_IO_KBC_OFFS, 5, MACE_ISA_INT_KBD | MACE_ISA_INT_KBD_POLL | MACE_ISA_INT_MOUSE | MACE_ISA_INT_MOUSE_POLL), - MACEBUSDEV("power", 0, 5, MACE_ISA_INT_RTC) + MACEBUSDEV("nmi", 0, 5, MACE_ISA_INT_RTC) }; #undef MACEBUSDEV Index: sys/arch/sgi/sgi/ip30_machdep.c =================================================================== RCS file: /cvs/src/sys/arch/sgi/sgi/ip30_machdep.c,v retrieving revision 1.38 diff -p -u -p -u -r1.38 ip30_machdep.c --- sys/arch/sgi/sgi/ip30_machdep.c 13 Mar 2010 21:55:30 -0000 1.38 +++ sys/arch/sgi/sgi/ip30_machdep.c 29 Mar 2010 21:39:41 -0000 @@ -257,7 +257,7 @@ ip30_autoconf(struct device *parent) config_found(parent, &caa.caa_maa, mbprint); caa.caa_maa.maa_name = "xbow"; config_found(parent, &caa.caa_maa, mbprint); - caa.caa_maa.maa_name = "power"; + caa.caa_maa.maa_name = "nmi"; config_found(parent, &caa.caa_maa, mbprint); }