diff options
author | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2014-12-10 12:27:58 +0000 |
---|---|---|
committer | Mike Belopuhov <mikeb@cvs.openbsd.org> | 2014-12-10 12:27:58 +0000 |
commit | 9ce9e30960b2e6222a244e6166aea039ac6e9239 (patch) | |
tree | 212abc4dfaf05d91acce75be7ded7a8eac5e95e7 /sys/dev | |
parent | 77392a36ec6c525667e826c787c431b014f99298 (diff) |
Convert watchdog(4) devices to use autoconf(9) framework.
ok deraadt, tests on glxpcib and ok mpi
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ipmi.c | 18 | ||||
-rw-r--r-- | sys/dev/isa/fins.c | 19 | ||||
-rw-r--r-- | sys/dev/isa/it.c | 19 | ||||
-rw-r--r-- | sys/dev/isa/sch311x.c | 19 | ||||
-rw-r--r-- | sys/dev/isa/viasio.c | 19 | ||||
-rw-r--r-- | sys/dev/pci/berkwdt.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/glxpcib.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/ichwdt.c | 19 | ||||
-rw-r--r-- | sys/dev/pci/pwdog.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/tcpcib.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/wdt.c | 18 |
11 files changed, 163 insertions, 20 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 5556db905ad..b53d643ac90 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.73 2014/10/21 08:48:38 uebayasi Exp $ */ +/* $OpenBSD: ipmi.c,v 1.74 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -158,6 +158,7 @@ int ipmi_watchdog(void *, int); int ipmi_intr(void *); int ipmi_match(struct device *, void *, void *); void ipmi_attach(struct device *, struct device *, void *); +int ipmi_activate(struct device *, int); long ipow(long, int); long ipmi_convert(u_int8_t, struct sdrtype1 *, long); @@ -835,7 +836,8 @@ struct ipmi_bmc_response { }; struct cfattach ipmi_ca = { - sizeof(struct ipmi_softc), ipmi_match, ipmi_attach + sizeof(struct ipmi_softc), ipmi_match, ipmi_attach, + NULL, ipmi_activate }; struct cfdriver ipmi_cd = { @@ -1761,6 +1763,18 @@ ipmi_attach(struct device *parent, struct device *self, void *aux) } int +ipmi_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + +int ipmi_watchdog(void *arg, int period) { struct ipmi_softc *sc = arg; diff --git a/sys/dev/isa/fins.c b/sys/dev/isa/fins.c index af5087fb17e..5fd0a256466 100644 --- a/sys/dev/isa/fins.c +++ b/sys/dev/isa/fins.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fins.c,v 1.3 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: fins.c,v 1.4 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2005, 2006 Mark Kettenis @@ -124,6 +124,7 @@ struct fins_softc { int fins_match(struct device *, void *, void *); void fins_attach(struct device *, struct device *, void *); +int fins_activate(struct device *, int); void fins_unlock(bus_space_tag_t, bus_space_handle_t); void fins_lock(bus_space_tag_t, bus_space_handle_t); @@ -150,7 +151,9 @@ int fins_wdog_cb(void *, int); struct cfattach fins_ca = { sizeof(struct fins_softc), fins_match, - fins_attach + fins_attach, + NULL, + fins_activate }; struct cfdriver fins_cd = { @@ -305,6 +308,18 @@ attach_done: printf("\n"); } +int +fins_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + u_int8_t fins_read(bus_space_tag_t iot, bus_space_handle_t ioh, int reg) { diff --git a/sys/dev/isa/it.c b/sys/dev/isa/it.c index 90a1801496c..b656e1ec57e 100644 --- a/sys/dev/isa/it.c +++ b/sys/dev/isa/it.c @@ -1,4 +1,4 @@ -/* $OpenBSD: it.c,v 1.44 2013/04/10 01:35:55 guenther Exp $ */ +/* $OpenBSD: it.c,v 1.45 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2007-2008 Oleg Safiullin <form@pdp-11.org.ru> @@ -48,6 +48,7 @@ int it_match(struct device *, void *, void *); void it_attach(struct device *, struct device *, void *); +int it_activate(struct device *, int); u_int8_t it_readreg(bus_space_tag_t, bus_space_handle_t, int); void it_writereg(bus_space_tag_t, bus_space_handle_t, int, u_int8_t); void it_enter(bus_space_tag_t, bus_space_handle_t, int); @@ -289,6 +290,18 @@ it_attach(struct device *parent, struct device *self, void *aux) sensordev_install(&sc->sc_sensordev); } +int +it_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + u_int8_t it_readreg(bus_space_tag_t iot, bus_space_handle_t ioh, int r) { @@ -525,7 +538,9 @@ it_wdog_cb(void *arg, int period) struct cfattach it_ca = { sizeof(struct it_softc), it_match, - it_attach + it_attach, + NULL, + it_activate }; struct cfdriver it_cd = { diff --git a/sys/dev/isa/sch311x.c b/sys/dev/isa/sch311x.c index 87cd1da851e..70eaf2966e0 100644 --- a/sys/dev/isa/sch311x.c +++ b/sys/dev/isa/sch311x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sch311x.c,v 1.13 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: sch311x.c,v 1.14 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2008 Mark Kettenis <kettenis@openbsd.org> * Copyright (c) 2009 Michael Knudsen <mk@openbsd.org> @@ -160,6 +160,7 @@ struct schsio_softc { int schsio_probe(struct device *, void *, void *); void schsio_attach(struct device *, struct device *, void *); +int schsio_activate(struct device *, int); static __inline void schsio_config_enable(bus_space_tag_t iot, bus_space_handle_t ioh); @@ -184,7 +185,9 @@ int schsio_wdt_cb(void *arg, int period); struct cfattach schsio_ca = { sizeof(struct schsio_softc), schsio_probe, - schsio_attach + schsio_attach, + NULL, + schsio_activate }; struct cfdriver schsio_cd = { @@ -318,6 +321,18 @@ schsio_attach(struct device *parent, struct device *self, void *aux) schsio_config_disable(sc->sc_iot, sc->sc_ioh); } +int +schsio_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + void schsio_hwm_init(struct schsio_softc *sc) { diff --git a/sys/dev/isa/viasio.c b/sys/dev/isa/viasio.c index 3b82c46ded5..32d2b9f29d3 100644 --- a/sys/dev/isa/viasio.c +++ b/sys/dev/isa/viasio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viasio.c,v 1.13 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: viasio.c,v 1.14 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org> * @@ -62,6 +62,7 @@ struct viasio_softc { int viasio_probe(struct device *, void *, void *); void viasio_attach(struct device *, struct device *, void *); +int viasio_activate(struct device *, int); void viasio_hm_init(struct viasio_softc *); void viasio_hm_refresh(void *); @@ -72,7 +73,9 @@ int viasio_wdg_cb(void *, int); struct cfattach viasio_ca = { sizeof(struct viasio_softc), viasio_probe, - viasio_attach + viasio_attach, + NULL, + viasio_activate }; struct cfdriver viasio_cd = { @@ -196,6 +199,18 @@ viasio_attach(struct device *parent, struct device *self, void *aux) viasio_conf_disable(sc->sc_iot, sc->sc_ioh); } +int +viasio_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + void viasio_hm_init(struct viasio_softc *sc) { diff --git a/sys/dev/pci/berkwdt.c b/sys/dev/pci/berkwdt.c index 47eaaa1c593..250f3973575 100644 --- a/sys/dev/pci/berkwdt.c +++ b/sys/dev/pci/berkwdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: berkwdt.c,v 1.7 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: berkwdt.c,v 1.8 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2009 Wim Van Sebroeck <wim@iguana.be> @@ -46,6 +46,7 @@ struct berkwdt_softc { int berkwdt_match(struct device *, void *, void *); void berkwdt_attach(struct device *, struct device *, void *); +int berkwdt_activate(struct device *, int); void berkwdt_start(struct berkwdt_softc *sc); void berkwdt_stop(struct berkwdt_softc *sc); @@ -55,7 +56,8 @@ int berkwdt_send_command(struct berkwdt_softc *sc, u_int8_t cmd, int *val); int berkwdt_set_timeout(void *, int); struct cfattach berkwdt_ca = { - sizeof(struct berkwdt_softc), berkwdt_match, berkwdt_attach + sizeof(struct berkwdt_softc), berkwdt_match, berkwdt_attach, + NULL, berkwdt_activate }; struct cfdriver berkwdt_cd = { @@ -214,6 +216,18 @@ berkwdt_attach(struct device *parent, struct device *self, void *aux) } int +berkwdt_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + +int berkwdt_set_timeout(void *self, int timeout) { struct berkwdt_softc *sc = self; diff --git a/sys/dev/pci/glxpcib.c b/sys/dev/pci/glxpcib.c index b68efd79ab0..1953a5a424f 100644 --- a/sys/dev/pci/glxpcib.c +++ b/sys/dev/pci/glxpcib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxpcib.c,v 1.13 2014/10/08 16:07:45 deraadt Exp $ */ +/* $OpenBSD: glxpcib.c,v 1.14 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2007 Marc Balmer <mbalmer@openbsd.org> @@ -454,6 +454,13 @@ glxpcib_activate(struct device *self, int act) #endif rv = config_activate_children(self, act); break; + case DVACT_POWERDOWN: +#ifndef SMALL_KERNEL + if (sc->sc_wdog) + wdog_shutdown(self); +#endif + rv = config_activate_children(self, act); + break; default: rv = config_activate_children(self, act); break; diff --git a/sys/dev/pci/ichwdt.c b/sys/dev/pci/ichwdt.c index 2d690932bdc..ef03dc979ba 100644 --- a/sys/dev/pci/ichwdt.c +++ b/sys/dev/pci/ichwdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ichwdt.c,v 1.4 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: ichwdt.c,v 1.5 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2004, 2005 Alexander Yurchenko <grange@openbsd.org> @@ -53,13 +53,16 @@ struct ichwdt_softc { int ichwdt_match(struct device *, void *, void *); void ichwdt_attach(struct device *, struct device *, void *); +int ichwdt_activate(struct device *, int); int ichwdt_cb(void *, int); struct cfattach ichwdt_ca = { sizeof(struct ichwdt_softc), ichwdt_match, - ichwdt_attach + ichwdt_attach, + NULL, + ichwdt_activate }; struct cfdriver ichwdt_cd = { @@ -140,6 +143,18 @@ ichwdt_attach(struct device *parent, struct device *self, void *aux) } int +ichwdt_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + +int ichwdt_cb(void *arg, int period) { struct ichwdt_softc *sc = arg; diff --git a/sys/dev/pci/pwdog.c b/sys/dev/pci/pwdog.c index c95d9aeb116..b3f48e06e30 100644 --- a/sys/dev/pci/pwdog.c +++ b/sys/dev/pci/pwdog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwdog.c,v 1.8 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: pwdog.c,v 1.9 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2006 Marc Balmer <mbalmer@openbsd.org> @@ -40,10 +40,12 @@ struct pwdog_softc { int pwdog_probe(struct device *, void *, void *); void pwdog_attach(struct device *, struct device *, void *); +int pwdog_activate(struct device *, int); int pwdog_set_timeout(void *, int); struct cfattach pwdog_ca = { - sizeof(struct pwdog_softc), pwdog_probe, pwdog_attach + sizeof(struct pwdog_softc), pwdog_probe, pwdog_attach, + NULL, pwdog_activate }; struct cfdriver pwdog_cd = { @@ -83,6 +85,18 @@ pwdog_attach(struct device *parent, struct device *self, void *aux) } int +pwdog_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + +int pwdog_set_timeout(void *self, int seconds) { struct pwdog_softc *pwdog = (struct pwdog_softc *)self; diff --git a/sys/dev/pci/tcpcib.c b/sys/dev/pci/tcpcib.c index 97c8f445cf8..c9f54d8b3f4 100644 --- a/sys/dev/pci/tcpcib.c +++ b/sys/dev/pci/tcpcib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcpcib.c,v 1.7 2013/12/06 21:03:04 deraadt Exp $ */ +/* $OpenBSD: tcpcib.c,v 1.8 2014/12/10 12:27:57 mikeb Exp $ */ /* * Copyright (c) 2012 Matt Dainty <matt@bodgit-n-scarper.com> @@ -295,6 +295,11 @@ tcpcib_activate(struct device *self, int act) E600_HPET_GC, E600_HPET_GC_ENABLE); rv = config_activate_children(self, act); break; + case DVACT_POWERDOWN: + if (sc->sc_active & E600_WDT_ACTIVE) + wdog_shutdown(self); + rv = config_activate_children(self, act); + break; default: rv = config_activate_children(self, act); break; diff --git a/sys/dev/pci/wdt.c b/sys/dev/pci/wdt.c index 2b48fe304f2..874864bc18b 100644 --- a/sys/dev/pci/wdt.c +++ b/sys/dev/pci/wdt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdt.c,v 1.21 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: wdt.c,v 1.22 2014/12/10 12:27:57 mikeb Exp $ */ /*- * Copyright (c) 1998,1999 Alex Nash @@ -53,6 +53,7 @@ struct wdt_softc { int wdt_probe(struct device *, void *, void *); void wdt_attach(struct device *, struct device *, void *); +int wdt_activate(struct device *, int); int wdt_is501(struct wdt_softc *); void wdt_8254_count(struct wdt_softc *, int, u_int16_t); @@ -64,7 +65,8 @@ void wdt_timer_disable(struct wdt_softc *); void wdt_buzzer_enable(struct wdt_softc *); struct cfattach wdt_ca = { - sizeof(struct wdt_softc), wdt_probe, wdt_attach + sizeof(struct wdt_softc), wdt_probe, wdt_attach, + NULL, wdt_activate }; struct cfdriver wdt_cd = { @@ -159,6 +161,18 @@ wdt_attach(struct device *parent, struct device *self, void *aux) wdog_register(wdt_set_timeout, wdt); } +int +wdt_activate(struct device *self, int act) +{ + switch (act) { + case DVACT_POWERDOWN: + wdog_shutdown(self); + break; + } + + return (0); +} + /* * wdt_is501 * |