summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/ata-disk.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2005-06-27 09:12:11 +0000
committersos <sos@FreeBSD.org>2005-06-27 09:12:11 +0000
commitf96bc0932a6b8cc433756c45de86b963304877b5 (patch)
tree82da3dd3e67373b897ef0c32df43a4d84ed1a3a9 /sys/dev/ata/ata-disk.c
parente544a2f3f980f000db3e6dbbc43307d0923bf354 (diff)
downloadFreeBSD-src-f96bc0932a6b8cc433756c45de86b963304877b5.zip
FreeBSD-src-f96bc0932a6b8cc433756c45de86b963304877b5.tar.gz
Dont call ata_finish in ad_dump as that is no longer needed and causes panic.
Dont try to enable read/write caching on devices that doesn't support it, this reduces the noise from ATA on flash devices and the like. Approved by: re@ (scottl)
Diffstat (limited to 'sys/dev/ata/ata-disk.c')
-rw-r--r--sys/dev/ata/ata-disk.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c
index 64a4172..9aed614 100644
--- a/sys/dev/ata/ata-disk.c
+++ b/sys/dev/ata/ata-disk.c
@@ -203,8 +203,7 @@ ad_reinit(device_t dev)
struct ata_channel *ch = device_get_softc(device_get_parent(dev));
struct ata_device *atadev = device_get_softc(dev);
- /* if detach pending flag set, return error */
-
+ /* if detach pending, return error */
if (((atadev->unit == ATA_MASTER) && !(ch->devices & ATA_ATA_MASTER)) ||
((atadev->unit == ATA_SLAVE) && !(ch->devices & ATA_ATA_SLAVE))) {
return 1;
@@ -327,7 +326,6 @@ ad_dump(void *arg, void *virtual, vm_offset_t physical,
do {
DELAY(20);
} while (ch->hw.end_transaction(&request) == ATA_OP_CONTINUES);
- ata_finish(&request);
}
if (request.status & ATA_S_ERROR)
return EIO;
@@ -341,14 +339,17 @@ ad_init(device_t dev)
ATA_SETMODE(device_get_parent(dev), dev);
- /* enable read caching */
- ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_RCACHE, 0, 0);
+ /* enable readahead caching */
+ if (atadev->param.support.command1 & ATA_SUPPORT_LOOKAHEAD)
+ ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_RCACHE, 0, 0);
- /* enable write caching if enabled */
- if (ata_wc)
- ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_WCACHE, 0, 0);
- else
- ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_DIS_WCACHE, 0, 0);
+ /* enable write caching if supported and configured */
+ if (atadev->param.support.command1 & ATA_SUPPORT_WRITECACHE) {
+ if (ata_wc)
+ ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_ENAB_WCACHE, 0, 0);
+ else
+ ata_controlcmd(dev, ATA_SETFEATURES, ATA_SF_DIS_WCACHE, 0, 0);
+ }
/* use multiple sectors/interrupt if device supports it */
if (ad_version(atadev->param.version_major)) {
OpenPOWER on IntegriCloud