summaryrefslogtreecommitdiff
path: root/sys/dev/ata/atascsi.c
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2007-12-06 12:19:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2007-12-06 12:19:02 +0000
commitfe91120c2180f5cdb7c49b510a26e847d79edd09 (patch)
treeb44547cee5e4d011cb23fbeae13706496acfe6d1 /sys/dev/ata/atascsi.c
parente1f3657121e8490c48e61ba0d0a12528ea795f01 (diff)
Ask for write cache and read look ahead to be turned
on if supported as per the wd changes. Some drives don't do this for us and it helps performance by a large amount. ok dlg@
Diffstat (limited to 'sys/dev/ata/atascsi.c')
-rw-r--r--sys/dev/ata/atascsi.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/sys/dev/ata/atascsi.c b/sys/dev/ata/atascsi.c
index 264166eaba2..4710e2a71f0 100644
--- a/sys/dev/ata/atascsi.c
+++ b/sys/dev/ata/atascsi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: atascsi.c,v 1.51 2007/11/28 18:16:07 dlg Exp $ */
+/* $OpenBSD: atascsi.c,v 1.52 2007/12/06 12:19:01 jsg Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -215,6 +215,34 @@ atascsi_probe(struct scsi_link *link)
as->as_ports[port] = ap;
+ /* Enable write cache if supported */
+ if (ap->ap_identify.cmdset82 & ATA_IDENTIFY_WRITECACHE) {
+ xa = ata_get_xfer(ap, 1);
+ if (xa == NULL)
+ panic("no free xfers on a new port");
+ xa->fis->command = ATA_C_SET_FEATURES;
+ xa->fis->features = ATA_SF_WRITECACHE_EN;
+ xa->fis->flags = ATA_H2D_FLAGS_CMD;
+ xa->flags = ATA_F_READ | ATA_F_PIO | ATA_F_POLL;
+ xa->complete = ata_put_xfer;
+ xa->timeout = 1000;
+ ata_exec(as, xa); /* we dont care if this works or not */
+ }
+
+ /* Enable read lookahead if supported */
+ if (ap->ap_identify.cmdset82 & ATA_IDENTIFY_LOOKAHEAD) {
+ xa = ata_get_xfer(ap, 1);
+ if (xa == NULL)
+ panic("no free xfers on a new port");
+ xa->fis->command = ATA_C_SET_FEATURES;
+ xa->fis->features = ATA_SF_LOOKAHEAD_EN;
+ xa->fis->flags = ATA_H2D_FLAGS_CMD;
+ xa->flags = ATA_F_READ | ATA_F_PIO | ATA_F_POLL;
+ xa->complete = ata_put_xfer;
+ xa->timeout = 1000;
+ ata_exec(as, xa); /* we dont care if this works or not */
+ }
+
/*
* FREEZE LOCK the device so malicous users can't lock it on us.
* As there is no harm in issuing this to devices that don't