diff options
Diffstat (limited to 'sys/arch/sparc64/dev')
-rw-r--r-- | sys/arch/sparc64/dev/fd.c | 24 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/lom.c | 20 | ||||
-rw-r--r-- | sys/arch/sparc64/dev/sab.c | 32 |
3 files changed, 59 insertions, 17 deletions
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c index 529cbb64ed7..d35aaa680cc 100644 --- a/sys/arch/sparc64/dev/fd.c +++ b/sys/arch/sparc64/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.37 2013/01/01 01:00:14 miod Exp $ */ +/* $OpenBSD: fd.c,v 1.38 2013/05/30 16:15:01 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */ /*- @@ -265,8 +265,6 @@ struct fd_softc { int sc_cylin; /* where we think the head is */ int sc_opts; /* user-set options */ - void *sc_sdhook; /* shutdownhook cookie */ - TAILQ_ENTRY(fd_softc) sc_drivechain; int sc_ops; /* I/O ops since last switch */ struct buf sc_q; /* pending I/O requests */ @@ -275,9 +273,11 @@ struct fd_softc { /* floppy driver configuration */ int fdmatch(struct device *, void *, void *); void fdattach(struct device *, struct device *, void *); +int fdactivate(struct device *, int); struct cfattach fd_ca = { - sizeof(struct fd_softc), fdmatch, fdattach + sizeof(struct fd_softc), fdmatch, fdattach, + NULL, fdactivate }; struct cfdriver fd_cd = { @@ -670,9 +670,21 @@ fdattach(parent, self, aux) fd->sc_dk.dk_flags = DKF_NOLABELREAD; fd->sc_dk.dk_name = fd->sc_dv.dv_xname; disk_attach(&fd->sc_dv, &fd->sc_dk); +} + +int +fdactivate(struct device *self, int act) +{ + int ret = 0; + + switch (act) { + case DVACT_POWERDOWN: + /* Make sure the drive motor gets turned off at shutdown time. */ + fd_motor_off(self); + break; + } - /* Make sure the drive motor gets turned off at shutdown time. */ - fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd); + return (ret); } __inline struct fd_type * diff --git a/sys/arch/sparc64/dev/lom.c b/sys/arch/sparc64/dev/lom.c index a4ce57ba5e8..883b90df077 100644 --- a/sys/arch/sparc64/dev/lom.c +++ b/sys/arch/sparc64/dev/lom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lom.c,v 1.23 2012/10/17 22:32:01 deraadt Exp $ */ +/* $OpenBSD: lom.c,v 1.24 2013/05/30 16:15:01 deraadt Exp $ */ /* * Copyright (c) 2009 Mark Kettenis * @@ -179,9 +179,11 @@ struct lom_softc { int lom_match(struct device *, void *, void *); void lom_attach(struct device *, struct device *, void *); +int lom_activate(struct device *, int); struct cfattach lom_ca = { - sizeof(struct lom_softc), lom_match, lom_attach + sizeof(struct lom_softc), lom_match, lom_attach, + NULL, lom_activate }; struct cfdriver lom_cd = { @@ -357,8 +359,20 @@ lom_attach(struct device *parent, struct device *self, void *aux) printf(": %s rev %d.%d\n", sc->sc_type < LOM_LOMLITE2 ? "LOMlite" : "LOMlite2", fw_rev >> 4, fw_rev & 0x0f); +} + +int +lom_activate(struct device *self, int act) +{ + int ret = 0; + + switch (act) { + case DVACT_POWERDOWN: + lom_shutdown(self); + break; + } - shutdownhook_establish(lom_shutdown, sc); + return (ret); } int diff --git a/sys/arch/sparc64/dev/sab.c b/sys/arch/sparc64/dev/sab.c index abbcbd8b334..000003495ec 100644 --- a/sys/arch/sparc64/dev/sab.c +++ b/sys/arch/sparc64/dev/sab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sab.c,v 1.30 2010/07/02 17:27:01 nicm Exp $ */ +/* $OpenBSD: sab.c,v 1.31 2013/05/30 16:15:01 deraadt Exp $ */ /* * Copyright (c) 2001 Jason L. Wright (jason@thought.net) @@ -121,6 +121,7 @@ struct sabtty_softc *sabtty_cons_output; int sab_match(struct device *, void *, void *); void sab_attach(struct device *, struct device *, void *); + int sab_print(void *, const char *); int sab_intr(void *); void sab_softintr(void *); @@ -130,6 +131,8 @@ void sab_cnpollc(dev_t, int); int sabtty_match(struct device *, void *, void *); void sabtty_attach(struct device *, struct device *, void *); +int sabtty_activate(struct device *, int); + void sabtty_start(struct tty *); int sabtty_param(struct tty *, struct termios *); int sabtty_intr(struct sabtty_softc *, int *); @@ -143,7 +146,7 @@ int sabtty_speed(int); void sabtty_console_flags(struct sabtty_softc *); void sabtty_console_speed(struct sabtty_softc *); void sabtty_cnpollc(struct sabtty_softc *, int); -void sabtty_shutdown(void *); +void sabtty_shutdown(struct sabtty_softc *); int sabttyparam(struct sabtty_softc *, struct tty *, struct termios *); int sabttyopen(dev_t, int, int, struct proc *); @@ -166,7 +169,8 @@ struct cfdriver sab_cd = { }; struct cfattach sabtty_ca = { - sizeof(struct sabtty_softc), sabtty_match, sabtty_attach + sizeof(struct sabtty_softc), sabtty_match, sabtty_attach, + NULL, sabtty_activate }; struct cfdriver sabtty_cd = { @@ -305,6 +309,22 @@ sab_attach(parent, self, aux) } int +sabtty_activate(struct device *self, int act) +{ + struct sabtty_softc *sc = (struct sabtty_softc *)self; + int ret = 0; + + switch (act) { + case DVACT_POWERDOWN: + if (sc->sc_flags & SABTTYF_CONS_IN) + sabtty_shutdown(sc); + break; + } + + return (ret); +} + +int sab_print(args, name) void *args; const char *name; @@ -444,7 +464,6 @@ sabtty_attach(parent, self, aux) cn_tab->cn_pollc = sab_cnpollc; cn_tab->cn_getc = sab_cngetc; cn_tab->cn_dev = makedev(77/*XXX*/, self->dv_unit); - shutdownhook_establish(sabtty_shutdown, sc); } if (sc->sc_flags & SABTTYF_CONS_OUT) { @@ -1389,11 +1408,8 @@ sabtty_abort(sc) } void -sabtty_shutdown(vsc) - void *vsc; +sabtty_shutdown(struct sabtty_softc *sc) { - struct sabtty_softc *sc = vsc; - /* Have to put the chip back into single char mode */ sc->sc_flags |= SABTTYF_DONTDDB; SAB_WRITE(sc, SAB_RFC, SAB_READ(sc, SAB_RFC) & ~SAB_RFC_RFDF); |