diff options
author | sos <sos@FreeBSD.org> | 2004-07-12 10:50:50 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2004-07-12 10:50:50 +0000 |
commit | 4997cbe712449a6fb55de54834c60a5f4fb318bb (patch) | |
tree | 4d3274c94a39ed92f0e6199abc800283a3bdee96 /sys/dev | |
parent | 3805bd4f25689260cac29f17b765144fb2533692 (diff) | |
download | FreeBSD-src-4997cbe712449a6fb55de54834c60a5f4fb318bb.zip FreeBSD-src-4997cbe712449a6fb55de54834c60a5f4fb318bb.tar.gz |
Attempt to handle suspend/resume better.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ata/ata-all.c | 24 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.c | 1 |
2 files changed, 9 insertions, 16 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index d41f312..2c732e9 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -183,6 +183,13 @@ ata_detach(device_t dev) if (!dev || !(ch = device_get_softc(dev)) || !ch->r_irq) return ENXIO; + /* mark devices on this channel as detaching */ + ch->device[MASTER].flags |= ATA_D_DETACHING; + ch->device[SLAVE].flags |= ATA_D_DETACHING; + + /* fail outstanding requests on this channel */ + ata_fail_requests(ch, NULL); + /* detach devices on this channel */ if (ch->device[MASTER].detach) ch->device[MASTER].detach(&ch->device[MASTER]); @@ -192,9 +199,6 @@ ata_detach(device_t dev) atapi_cam_detach_bus(ch); #endif - /* fail outstanding requests on this channel */ - ata_fail_requests(ch, NULL); - /* flush cache and powerdown device */ if (ch->device[MASTER].param) { if (ch->device[MASTER].param->support.command2 & ATA_SUPPORT_FLUSHCACHE) @@ -285,18 +289,6 @@ ata_reinit(struct ata_channel *ch) ch->device[SLAVE].attach(&ch->device[SLAVE]); } - /* restore device config and transfermode on devices */ - if (ch->devices & (ATA_ATA_MASTER | ATA_ATAPI_MASTER)) { - if (ch->device[MASTER].config) - ch->device[MASTER].config(&ch->device[MASTER]); - ch->device[MASTER].setmode(&ch->device[MASTER],ch->device[MASTER].mode); - } - if (ch->devices & (ATA_ATA_SLAVE | ATA_ATAPI_SLAVE)) { - if (ch->device[SLAVE].config) - ch->device[SLAVE].config(&ch->device[SLAVE]); - ch->device[SLAVE].setmode(&ch->device[SLAVE], ch->device[SLAVE].mode); - } - #ifdef DEV_ATAPICAM atapi_cam_reinit_bus(ch); #endif @@ -632,6 +624,7 @@ ata_identify_devices(struct ata_channel *ch) if (ata_getparam(&ch->device[SLAVE], ATA_ATAPI_IDENTIFY)) ch->devices &= ~ATA_ATAPI_SLAVE; else { + ata_controlcmd(&ch->device[SLAVE], ATA_ATAPI_RESET, 0, 0, 0); switch (ch->device[SLAVE].param->config & ATA_ATAPI_TYPE_MASK) { #ifdef DEV_ATAPICD case ATA_ATAPI_TYPE_CDROM: @@ -663,6 +656,7 @@ ata_identify_devices(struct ata_channel *ch) if (ata_getparam(&ch->device[MASTER], ATA_ATAPI_IDENTIFY)) ch->devices &= ~ATA_ATAPI_MASTER; else { + ata_controlcmd(&ch->device[MASTER], ATA_ATAPI_RESET, 0, 0, 0); switch (ch->device[MASTER].param->config & ATA_ATAPI_TYPE_MASK) { #ifdef DEV_ATAPICD case ATA_ATAPI_TYPE_CDROM: diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index c8d96b2..46c0f62 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -160,7 +160,6 @@ ad_detach(struct ata_device *atadev) { struct ad_softc *adp = atadev->softc; - atadev->flags |= ATA_D_DETACHING; #ifdef DEV_ATARAID if (adp->flags & AD_F_RAID_SUBDISK) ata_raiddisk_detach(adp); |