PATA: Ignore interrupts that weren't generated by the disk

This commit is contained in:
Tom 2020-06-29 17:15:29 -06:00 committed by Andreas Kling
parent a2fd824dff
commit 5674a77bd6
Notes: sideshowbarker 2024-07-19 05:17:38 +09:00

View file

@ -183,12 +183,19 @@ void PATAChannel::wait_for_irq()
void PATAChannel::handle_irq(const RegisterState&)
{
// FIXME: We might get random interrupts due to malfunctioning hardware, so we should check that we actually requested something to happen.
u8 status = m_io_base.offset(ATA_REG_STATUS).in<u8>();
m_entropy_source.add_random_event(status);
u8 bstatus = m_bus_master_base.offset(2).in<u8>();
if (!(bstatus & 0x4)) {
// interrupt not from this device, ignore
#ifdef PATA_DEBUG
klog() << "PATAChannel: ignore interrupt";
#endif
return;
}
if (status & ATA_SR_ERR) {
print_ide_status(status);
m_device_error = m_io_base.offset(ATA_REG_ERROR).in<u8>();