summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2001-01-29 18:00:35 +0000
committersos <sos@FreeBSD.org>2001-01-29 18:00:35 +0000
commitab7cbc336e725e50c14730d66dac04e3e4548555 (patch)
treebc30c09c1cf0608889d4e7efe206af8acb0ee496
parent096ea4ce98489d10af98c495b2100f992797b641 (diff)
downloadFreeBSD-src-ab7cbc336e725e50c14730d66dac04e3e4548555.zip
FreeBSD-src-ab7cbc336e725e50c14730d66dac04e3e4548555.tar.gz
Add option ATA_ENABLE_WC for enabling write caching (now off by default).
-rw-r--r--sys/conf/options3
-rw-r--r--sys/dev/ata/ata-disk.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/conf/options b/sys/conf/options
index 717a841..4670fe1 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -215,7 +215,8 @@ ATAPI_DEBUG opt_ata.h
ATA_DEBUG opt_ata.h
ATA_STATIC_ID opt_ata.h
ATA_ENABLE_ATAPI_DMA opt_ata.h
-ATA_ENABLE_TAGS opt_ata.h
+ATA_ENABLE_WC opt_ata.h
+ATA_ENABLE_TAGS opt_ata.h # also sets ATA_ENABLE_WC
DEV_ATADISK opt_ata.h
DEV_ATAPICD opt_ata.h
DEV_ATAPIST opt_ata.h
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index 74a151b..444ec21 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -133,10 +133,15 @@ ad_attach(struct ata_softc *scp, int device)
0, 0, 0, 0, ATA_C_F_ENAB_RCACHE, ATA_WAIT_INTR))
printf("ad%d: enabling readahead cache failed\n", adp->lun);
+#if defined(ATA_ENABLE_WC) || defined(ATA_ENABLE_TAGS)
if (ata_command(adp->controller, adp->unit, ATA_C_SETFEATURES,
0, 0, 0, 0, ATA_C_F_ENAB_WCACHE, ATA_WAIT_INTR))
printf("ad%d: enabling write cache failed\n", adp->lun);
-
+#else
+ if (ata_command(adp->controller, adp->unit, ATA_C_SETFEATURES,
+ 0, 0, 0, 0, ATA_C_F_DIS_WCACHE, ATA_WAIT_INTR))
+ printf("ad%d: disabling write cache failed\n", adp->lun);
+#endif
/* use DMA if drive & controller supports it */
ata_dmainit(adp->controller, adp->unit,
ata_pmode(AD_PARAM), ata_wmode(AD_PARAM), ata_umode(AD_PARAM));
OpenPOWER on IntegriCloud