Additional to the normal detection of device presence, use the trick previously
present in the IDE bus_manager when detecting devices to avoid long timeouts when waiting for possible ATAPI devices. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30052 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -379,8 +379,12 @@ ATAChannel::Wait(uint8 setBits, uint8 clearedBits, uint32 flags,
|
||||
&& (status & ATA_STATUS_ERROR) != 0)
|
||||
return B_ERROR;
|
||||
|
||||
if ((status & setBits) == setBits && (status & clearedBits) == 0)
|
||||
return B_OK;
|
||||
if ((status & clearedBits) == 0) {
|
||||
if ((flags & ATA_WAIT_ANY_BIT) != 0 && (status & setBits) != 0)
|
||||
return B_OK;
|
||||
if ((status & setBits) == setBits)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
bigtime_t elapsedTime = system_time() - startTime;
|
||||
//TRACE("wait status after %lld: %u\n", elapsedTime, status);
|
||||
|
||||
@@ -432,6 +432,13 @@ ATADevice::Identify()
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
if (fChannel->Wait(ATA_STATUS_BUSY | ATA_STATUS_DATA_REQUEST, 0,
|
||||
ATA_WAIT_ANY_BIT, 100 * 1000) != B_OK) {
|
||||
TRACE_ALWAYS("no data request and not busy within 100ms, assuming "
|
||||
"no device present\n");
|
||||
return B_TIMED_OUT;
|
||||
}
|
||||
|
||||
if (fChannel->Wait(ATA_STATUS_DATA_REQUEST, ATA_STATUS_BUSY, 0,
|
||||
IsATAPI() ? 20 * 1000 * 1000 : 500 * 1000) != B_OK) {
|
||||
TRACE_ERROR("timeout waiting for identify request\n");
|
||||
|
||||
@@ -29,7 +29,8 @@ enum {
|
||||
ATA_IS_WRITE = 0x02,
|
||||
ATA_DMA_TRANSFER = 0x03,
|
||||
ATA_CHECK_ERROR_BIT = 0x04,
|
||||
ATA_WAIT_FINISH = 0x08
|
||||
ATA_WAIT_FINISH = 0x08,
|
||||
ATA_WAIT_ANY_BIT = 0x10
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user