Clear pending interrupts after reset and timeouts

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33039 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2009-09-10 19:03:55 +00:00
parent e717a35b6f
commit 3c13be106e
2 changed files with 15 additions and 1 deletions
@@ -405,6 +405,9 @@ ATAChannel::Reset()
_FlushAndWait(150 * 1000);
// read status to clear any pending interrupts
_Status();
return B_OK;
}
@@ -564,7 +567,8 @@ ATAChannel::WaitForInterrupt(bigtime_t timeout)
status_t
ATAChannel::RecoverLostInterrupt()
{
uint8 status = AltStatus();
// read status to clear any pending interrupts
uint8 status = _Status();
if (status & (ATA_STATUS_BUSY | ATA_STATUS_DATA_REQUEST)) {
TRACE_ERROR("RecoverLostInterrupt: device busy, status 0x%02x\n", status);
return B_ERROR;
@@ -828,6 +832,15 @@ ATAChannel::_WriteRegs(ata_task_file *taskFile, ata_reg_mask mask)
return fController->write_command_block_regs(fCookie, taskFile, mask);
}
uint8
ATAChannel::_Status()
{
ata_task_file taskFile;
if (_ReadRegs(&taskFile, ATA_MASK_STATUS) != B_OK)
return 0x01;
return taskFile.read.status;
}
status_t
ATAChannel::_WriteControl(uint8 value)
@@ -120,6 +120,7 @@ private:
status_t _WriteRegs(ata_task_file *taskFile,
ata_reg_mask mask);
status_t _WriteControl(uint8 value);
uint8 _Status();
void _FlushAndWait(bigtime_t waitTime);