mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:47:44 +00:00
IDEDiskDevice: Use wait_for_irq() when waiting for DMA transfers.
Also make sure we return any device errors to caller.
This commit is contained in:
parent
c818773983
commit
ed79116e94
1 changed files with 4 additions and 9 deletions
|
@ -320,17 +320,12 @@ bool IDEDiskDevice::read_sector_with_dma(dword lba, byte* outbuf)
|
||||||
// Start bus master
|
// Start bus master
|
||||||
IO::out8(m_bus_master_base, 0x9);
|
IO::out8(m_bus_master_base, 0x9);
|
||||||
|
|
||||||
for (;;) {
|
wait_for_irq();
|
||||||
auto status = IO::in8(m_bus_master_base + 2);
|
|
||||||
auto dstatus = IO::in8(io_base + ATA_REG_STATUS);
|
|
||||||
if (!(status & 4))
|
|
||||||
continue;
|
|
||||||
if (!(dstatus & ATA_SR_BSY))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
disable_irq();
|
disable_irq();
|
||||||
|
|
||||||
|
if (m_device_error)
|
||||||
|
return false;
|
||||||
|
|
||||||
// I read somewhere that this may trigger a cache flush so let's do it.
|
// I read somewhere that this may trigger a cache flush so let's do it.
|
||||||
IO::out8(m_bus_master_base + 2, IO::in8(m_bus_master_base + 2) | 0x6);
|
IO::out8(m_bus_master_base + 2, IO::in8(m_bus_master_base + 2) | 0x6);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue