In ata_reinit, when ata_getparam fails for a new device (indicating that

the device is not actually present), clear the corresponding bit in
the ch->devices bitmap. This resolves a panic that occurred with ATAPI/CAM
after an APM suspend/resume, when the ATA hardware would erroneously
report an extra ATAPI device.

Approved by:	re, sos
Reviewed by:	roberto
MFC after:	7 days
This commit is contained in:
Thomas Quinot 2002-12-01 14:20:08 +00:00
parent 9f80feb348
commit 9e3a06e150

View File

@ -877,17 +877,18 @@ ata_reinit(struct ata_channel *ch)
if ((newdev = ~devices & ch->devices)) {
if (newdev & ATA_ATA_MASTER)
if (ata_getparam(&ch->device[MASTER], ATA_C_ATA_IDENTIFY))
newdev &= ~ATA_ATA_MASTER;
ch->devices &= ~ATA_ATA_MASTER;
if (newdev & ATA_ATA_SLAVE)
if (ata_getparam(&ch->device[SLAVE], ATA_C_ATA_IDENTIFY))
newdev &= ~ATA_ATA_SLAVE;
ch->devices &= ~ATA_ATA_SLAVE;
if (newdev & ATA_ATAPI_MASTER)
if (ata_getparam(&ch->device[MASTER], ATA_C_ATAPI_IDENTIFY))
newdev &= ~ATA_ATAPI_MASTER;
ch->devices &= ~ATA_ATAPI_MASTER;
if (newdev & ATA_ATAPI_SLAVE)
if (ata_getparam(&ch->device[SLAVE], ATA_C_ATAPI_IDENTIFY))
newdev &= ~ATA_ATAPI_SLAVE;
ch->devices &= ~ATA_ATAPI_SLAVE;
}
newdev = ~devices & ch->devices;
#ifdef DEV_ATADISK
if (newdev & ATA_ATA_MASTER && !ch->device[MASTER].driver)
ad_attach(&ch->device[MASTER]);