From 6d8f2501407063c52a950c01a2722447d0fb9a56 Mon Sep 17 00:00:00 2001 From: deraadt Date: Sat, 28 Dec 2013 03:39:16 +0000 Subject: [PATCH] Attempt to approximate what should happen on a suspend/resume cycle. If the driver was doing some IO, we remove the timeouts, and force the fdc state machine into IOTIMEDOUT state with the final timeout count before a clean retry. In theory upon resume it should freak out quietly, and try the operation again. Noone has stepped forward to test this yet. --- sys/dev/isa/fd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c index 335ca1909c8..496249126f3 100644 --- a/sys/dev/isa/fd.c +++ b/sys/dev/isa/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.97 2013/11/21 00:13:33 dlg Exp $ */ +/* $OpenBSD: fd.c,v 1.98 2013/12/28 03:39:16 deraadt Exp $ */ /* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */ /*- @@ -312,9 +312,20 @@ fdattach(struct device *parent, struct device *self, void *aux) int fdactivate(struct device *self, int act) { + struct fd_softc *fd = (void *)self; + struct fdc_softc *fdc = (void *)fd->sc_dev.dv_parent; int rv = 0; switch (act) { + case DVACT_SUSPEND: + if (fdc->sc_state != DEVIDLE) { + timeout_del(&fd->fd_motor_on_to); + timeout_del(&fd->fd_motor_off_to); + timeout_del(&fd->fdtimeout_to); + fdc->sc_state = IOTIMEDOUT; + fdc->sc_errors = 4; + } + break; case DVACT_POWERDOWN: fd_motor_off(self); break; -- 2.20.1