summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2003-08-25 07:59:50 +0000
committersos <sos@FreeBSD.org>2003-08-25 07:59:50 +0000
commitfee680ed0c0bb234f2bad2d0cd193aeda925bc72 (patch)
tree6bef55007d546e8d66ad87bb423931749ce20c30 /sys
parent4fd68c81f45c89bbb85d37876153a7e2568f949c (diff)
downloadFreeBSD-src-fee680ed0c0bb234f2bad2d0cd193aeda925bc72.zip
FreeBSD-src-fee680ed0c0bb234f2bad2d0cd193aeda925bc72.tar.gz
Only call FLUSH_CACHE on devices that say they can.
This will get rid of the warnings issued at shutdown (that seems to worry alot of users), but will also no flush cache on lots of devices that can, but doesn't set the right support bits...
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-all.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index 6f93858..0a66ec2 100644
--- a/sys/dev/ata/ata-all.c
+++ b/sys/dev/ata/ata-all.c
@@ -196,12 +196,14 @@ ata_detach(device_t dev)
mtx_unlock(&ch->queue_mtx);
if (ch->device[MASTER].param) {
- ata_controlcmd(&ch->device[MASTER], ATA_FLUSHCACHE, 0, 0, 0);
+ if (ch->device[MASTER].param->support.command2 & ATA_SUPPORT_FLUSHCACHE)
+ ata_controlcmd(&ch->device[MASTER], ATA_FLUSHCACHE, 0, 0, 0);
free(ch->device[MASTER].param, M_ATA);
ch->device[MASTER].param = NULL;
}
if (ch->device[SLAVE].param) {
- ata_controlcmd(&ch->device[SLAVE], ATA_FLUSHCACHE, 0, 0, 0);
+ if (ch->device[SLAVE].param->support.command2 & ATA_SUPPORT_FLUSHCACHE)
+ ata_controlcmd(&ch->device[SLAVE], ATA_FLUSHCACHE, 0, 0, 0);
free(ch->device[SLAVE].param, M_ATA);
ch->device[SLAVE].param = NULL;
}
@@ -303,9 +305,11 @@ ata_shutdown(void *arg, int howto)
for (ctlr = 0; ctlr < devclass_get_maxunit(ata_devclass); ctlr++) {
if (!(ch = devclass_get_softc(ata_devclass, ctlr)))
continue;
- if (ch->device[MASTER].param)
+ if (ch->device[MASTER].param &&
+ ch->device[MASTER].param->support.command2 & ATA_SUPPORT_FLUSHCACHE)
ata_controlcmd(&ch->device[MASTER], ATA_FLUSHCACHE, 0, 0, 0);
- if (ch->device[SLAVE].param)
+ if (ch->device[SLAVE].param &&
+ ch->device[SLAVE].param->support.command2 & ATA_SUPPORT_FLUSHCACHE)
ata_controlcmd(&ch->device[SLAVE], ATA_FLUSHCACHE, 0, 0, 0);
}
}
OpenPOWER on IntegriCloud