aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ata/ata-all.c
diff options
context:
space:
mode:
authorSøren Schmidt <sos@FreeBSD.org>2004-07-12 10:50:50 +0000
committerSøren Schmidt <sos@FreeBSD.org>2004-07-12 10:50:50 +0000
commitcc97de873c596e7847ff2eb43b37c26d1107c3ce (patch)
tree4d3274c94a39ed92f0e6199abc800283a3bdee96 /sys/dev/ata/ata-all.c
parent5292d2aec0d20a8bda87f5d518c040370bb7fc8a (diff)
downloadsrc-cc97de873c596e7847ff2eb43b37c26d1107c3ce.tar.gz
src-cc97de873c596e7847ff2eb43b37c26d1107c3ce.zip
Attempt to handle suspend/resume better.
Notes
Notes: svn path=/head/; revision=132030
Diffstat (limited to 'sys/dev/ata/ata-all.c')
-rw-r--r--sys/dev/ata/ata-all.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c
index d41f31280add..2c732e9d32c3 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: