summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2010-06-30 19:06:30 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2010-06-30 19:06:30 +0000
commit3bfd24c054b5586f7f89310f5ccdd65a63ac9822 (patch)
treea6e48771bfd29fe73aaea6707a3b55814d257ee3
parentbd6fac7bb3f28e49754bcc5c39542eea2e697256 (diff)
Flush cache before suspend.
ok krw@, marco@
-rw-r--r--sys/scsi/scsiconf.c6
-rw-r--r--sys/scsi/sd.c13
2 files changed, 17 insertions, 2 deletions
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index a9e294c3eb7..a2e742927b7 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.157 2010/04/23 21:34:40 deraadt Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.158 2010/06/30 19:06:29 kettenis Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -274,6 +274,10 @@ scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act)
#endif /* NMPATH */
config_deactivate(dev);
break;
+ case DVACT_SUSPEND:
+ case DVACT_RESUME:
+ config_suspend(dev, act);
+ break;
default:
#ifdef DIAGNOSTIC
printf("%s: unsupported act %d\n", sc->sc_dev.dv_xname, act);
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 11e207b3ff9..79cd0b93a82 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sd.c,v 1.198 2010/06/28 08:35:46 jsing Exp $ */
+/* $OpenBSD: sd.c,v 1.199 2010/06/30 19:06:29 kettenis Exp $ */
/* $NetBSD: sd.c,v 1.111 1997/04/02 02:29:41 mycroft Exp $ */
/*-
@@ -288,6 +288,17 @@ sdactivate(struct device *self, int act)
sc->flags |= SDF_DYING;
bufq_drain(sc->sc_bufq);
break;
+ case DVACT_SUSPEND:
+ /*
+ * If the disk cache needs to be flushed, and the disk
+ * supports it, flush it. We're cold at this point,
+ * so we poll for completion.
+ */
+ if ((sc->flags & SDF_DIRTY) != 0)
+ sd_flush(sc, SCSI_AUTOCONF);
+ break;
+ case DVACT_RESUME:
+ break;
}
return (rv);