diff options
| -rw-r--r-- | sys/dev/ata/ata-lowlevel.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/sys/dev/ata/ata-lowlevel.c b/sys/dev/ata/ata-lowlevel.c index b1655c8445e9..21a205d4633b 100644 --- a/sys/dev/ata/ata-lowlevel.c +++ b/sys/dev/ata/ata-lowlevel.c @@ -270,30 +270,37 @@ ata_interrupt(void *data) { struct ata_channel *ch = (struct ata_channel *)data; struct ata_request *request = ch->running; + u_int8_t status; int length; + /* if the channel is idle this interrupt is not for us (shared) */ + if (ch->state == ATA_IDLE) + return; + + /* if device is busy it didn't interrupt, ignore interrupt (shared) */ + if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) { + DELAY(100); + if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DRQ)) + return; + } + + /* clear interrupt and get status */ + status = ATA_IDX_INB(ch, ATA_STATUS); + /* if we dont have a running request shout and ignore this interrupt */ if (request == NULL) { - if (bootverbose) { + if (1 || bootverbose) { printf("ata%d: spurious interrupt - ", device_get_unit(ch->dev)); if (request) printf("request OK - "); printf("status=0x%02x error=0x%02x reason=0x%02x\n", - ATA_IDX_INB(ch, ATA_ALTSTAT), ATA_IDX_INB(ch, ATA_ERROR), + status, ATA_IDX_INB(ch, ATA_ERROR), ATA_IDX_INB(ch, ATA_IREASON)); } return; } - /* if device is busy it didn't interrupt */ - if (ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_BUSY) { - DELAY(100); - if (!(ATA_IDX_INB(ch, ATA_ALTSTAT) & ATA_S_DRQ)) - return; - } - - /* clear interrupt and get status */ - request->status = ATA_IDX_INB(ch, ATA_STATUS); + request->status = status; switch (request->flags & (ATA_R_ATAPI | ATA_R_DMA)) { |
