Kernel: Clear AHCI pending interrupts

I have no idea why I did not have this in. All devices were just
constatly spamming interrupts like crazy :D
This commit is contained in:
Bananymous 2024-11-26 01:39:11 +02:00
parent 1941885cfd
commit a6fc3cf7a6
2 changed files with 9 additions and 5 deletions

View File

@ -77,7 +77,9 @@ namespace Kernel
{ {
auto& abar_mem = *(volatile HBAGeneralMemorySpace*)m_abar->vaddr(); auto& abar_mem = *(volatile HBAGeneralMemorySpace*)m_abar->vaddr();
uint32_t is = abar_mem.is; const uint32_t is = abar_mem.is;
abar_mem.is = is;
for (uint8_t i = 0; i < 32; i++) for (uint8_t i = 0; i < 32; i++)
{ {
if (is & (1 << i)) if (is & (1 << i))
@ -88,8 +90,6 @@ namespace Kernel
dwarnln("ignoring interrupt to device {}", i); dwarnln("ignoring interrupt to device {}", i);
} }
} }
abar_mem.is = is;
} }
BAN::Optional<AHCIPortType> AHCIController::check_port_type(volatile HBAPortMemorySpace& port) BAN::Optional<AHCIPortType> AHCIController::check_port_type(volatile HBAPortMemorySpace& port)

View File

@ -149,8 +149,12 @@ namespace Kernel
void AHCIDevice::handle_irq() void AHCIDevice::handle_irq()
{ {
uint16_t err = m_port->serr & 0xFFFF; const uint32_t is = m_port->is;
if (err) m_port->is = is;
const uint32_t serr = m_port->serr;
m_port->serr = serr;
if (auto err = serr & 0xFFFF)
print_error(err); print_error(err);
} }