From 4dc6705af38e4fdffea2a9c405a99940914c795b Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 30 Dec 1995 08:25:43 +0000 Subject: from perry: fixed my own pr 1758 -- the floppy drive motor was not being turned off at halt time, especially if a floppy was mounted. Added a shutdown hook to turn off the motor. Per a request by mycroft, the cookie from the hook is saved in a new member I added to the fd_softc structure. --- sys/arch/i386/isa/fd.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sys/arch/i386/isa') diff --git a/sys/arch/i386/isa/fd.c b/sys/arch/i386/isa/fd.c index 6dc8d799112..a32d7ad0c47 100644 --- a/sys/arch/i386/isa/fd.c +++ b/sys/arch/i386/isa/fd.c @@ -167,6 +167,8 @@ struct fd_softc { #define FD_MOTOR_WAIT 0x04 /* motor coming up */ int sc_cylin; /* where we think the head is */ + void *sc_sdhook; /* saved shutdown hook for drive. */ + TAILQ_ENTRY(fd_softc) sc_drivechain; int sc_ops; /* I/O ops since last switch */ struct buf sc_q; /* head of buf chain */ @@ -408,6 +410,8 @@ fdattach(parent, self, aux) /* XXX Need to do some more fiddling with sc_dk. */ dk_establish(&fd->sc_dk, &fd->sc_dev); #endif + /* Needed to power off if the motor is on when we halt. */ + fd->sc_sdhook = shutdownhook_establish(fd_motor_off, fd); } /* -- cgit v1.2.3