1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

Kernel/Interrupts: Return boolean on whether we handled the interrupt

If we are in a shared interrupt handler, the called handlers might
indicate it was not their interrupt, so we should not increment the
call counter of these handlers.
This commit is contained in:
Liav A 2021-06-05 09:00:18 +03:00 committed by Andreas Kling
parent 7a6d5a7b8b
commit b91df26d4a
43 changed files with 125 additions and 71 deletions

View file

@ -63,7 +63,7 @@ static void print_ide_status(u8 status)
(status & ATA_SR_ERR) != 0);
}
void BMIDEChannel::handle_irq(const RegisterState&)
bool BMIDEChannel::handle_irq(const RegisterState&)
{
u8 status = m_io_group.io_base().offset(ATA_REG_STATUS).in<u8>();
@ -74,7 +74,7 @@ void BMIDEChannel::handle_irq(const RegisterState&)
if (!(bstatus & 0x4)) {
// interrupt not from this device, ignore
dbgln_if(PATA_DEBUG, "BMIDEChannel: ignore interrupt");
return;
return false;
}
// clear bus master interrupt status
m_io_group.bus_master_base().value().offset(2).out<u8>(m_io_group.bus_master_base().value().offset(2).in<u8>() | 4);
@ -87,7 +87,7 @@ void BMIDEChannel::handle_irq(const RegisterState&)
if (!m_current_request) {
dbgln("BMIDEChannel: IRQ but no pending request!");
return;
return false;
}
if (status & ATA_SR_ERR) {
@ -96,10 +96,11 @@ void BMIDEChannel::handle_irq(const RegisterState&)
dbgln("BMIDEChannel: Error {:#02x}!", (u8)m_device_error);
try_disambiguate_error();
complete_current_request(AsyncDeviceRequest::Failure);
return;
return true;
}
m_device_error = 0;
complete_current_request(AsyncDeviceRequest::Success);
return true;
}
void BMIDEChannel::complete_current_request(AsyncDeviceRequest::RequestResult result)