Index: dev/ata/ata-disk.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.c,v retrieving revision 1.83 diff -u -r1.83 ata-disk.c --- dev/ata/ata-disk.c 2000/10/17 10:05:47 1.83 +++ dev/ata/ata-disk.c 2000/10/17 23:13:58 @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -89,6 +90,9 @@ /* experimental cache flush on BIO_ORDERED */ #define ATA_FLUSHCACHE_ON +int ad_wce = 0; +SYSCTL_INT(_hw, OID_AUTO, ad_wce, CTLFLAG_RW, &ad_wce, 0, ""); + void ad_attach(struct ata_softc *scp, int device) { @@ -135,9 +139,11 @@ 0, 0, 0, 0, ATA_C_F_ENAB_RCACHE, ATA_WAIT_INTR)) printf("ad%d: enabling readahead cache failed\n", adp->lun); +#if 0 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); +#endif /* use DMA if drive & controller supports it */ ata_dmainit(adp->controller, adp->unit, @@ -331,6 +337,15 @@ struct bio *bp = bioq_first(&adp->queue); struct ad_request *request; int tag = 0; + + if (adp->wce != ad_wce) { + printf("ad%d: %sabling write cache\n", adp->lun, ad_wce ? "en":"dis"); + ata_command(adp->controller, adp->unit, ATA_C_SETFEATURES, + 0, 0, 0, 0, ad_wce ? ATA_C_F_ENAB_WCACHE : + ATA_C_F_DIS_WCACHE, ATA_IMMEDIATE); + adp->wce = ad_wce; + return; + } if (!bp) return; Index: dev/ata/ata-disk.h =================================================================== RCS file: /home/ncvs/src/sys/dev/ata/ata-disk.h,v retrieving revision 1.30 diff -u -r1.30 ata-disk.h --- dev/ata/ata-disk.h 2000/10/13 13:04:45 1.30 +++ dev/ata/ata-disk.h 2000/10/17 23:13:58 @@ -71,6 +71,7 @@ struct ad_request *tags[32]; /* tag array of requests */ int outstanding; /* tags not serviced yet */ + int wce; struct bio_queue_head queue; /* head of request queue */ struct devstat stats; /* devstat entry */ struct disk disk; /* disklabel/slice stuff */