From 6fe4e0a915d5ae2e126efbcce6c2a4aa66c404be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Schmidt?= Date: Mon, 29 Jan 2001 18:00:35 +0000 Subject: [PATCH] Add option ATA_ENABLE_WC for enabling write caching (now off by default). --- sys/conf/options | 3 ++- sys/dev/ata/ata-disk.c | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/conf/options b/sys/conf/options index 717a841ac2d..4670fe1f9b6 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 74a151bef19..444ec210425 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));