From 9e3a06e15026c50e3ec1ed64e84491e80f4f775c Mon Sep 17 00:00:00 2001 From: Thomas Quinot Date: Sun, 1 Dec 2002 14:20:08 +0000 Subject: [PATCH] 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 --- sys/dev/ata/ata-all.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index c7cc11f6a4d6..17f3dc3c9bf7 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -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]);