summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPankaj Raghav <dev@pankajraghav.com>2023-05-08 21:36:47 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-05-16 23:22:12 +0200
commit6c7ee5344ce7a89355fbe6fb536890471161da50 (patch)
treea0df86a9e8cc5ee8f08b7486c820fce7feb69a21
parent8f62e62cfedb5084a6663ea96f7579c51eb0dee1 (diff)
downloadserenity-6c7ee5344ce7a89355fbe6fb536890471161da50.zip
Kernel: Add MSI support to AHCI
Add MSI support to AHCI. Prefer MSI interrupts over pin-based interrupts.
-rw-r--r--Kernel/Storage/ATA/AHCI/Controller.cpp5
-rw-r--r--Kernel/Storage/ATA/AHCI/InterruptHandler.cpp2
-rw-r--r--Kernel/Storage/ATA/AHCI/InterruptHandler.h4
3 files changed, 6 insertions, 5 deletions
diff --git a/Kernel/Storage/ATA/AHCI/Controller.cpp b/Kernel/Storage/ATA/AHCI/Controller.cpp
index ca39c04cb4..100b98dac9 100644
--- a/Kernel/Storage/ATA/AHCI/Controller.cpp
+++ b/Kernel/Storage/ATA/AHCI/Controller.cpp
@@ -167,12 +167,13 @@ UNMAP_AFTER_INIT ErrorOr<void> AHCIController::initialize_hba(PCI::DeviceIdentif
u32 version = hba().control_regs.version;
hba().control_regs.ghc = 0x80000000; // Ensure that HBA knows we are AHCI aware.
- PCI::enable_interrupt_line(device_identifier());
PCI::enable_bus_mastering(device_identifier());
+ TRY(reserve_irqs(1, true));
+ auto irq = MUST(allocate_irq(0));
enable_global_interrupts();
auto implemented_ports = AHCI::MaskedBitField((u32 volatile&)(hba().control_regs.pi));
- m_irq_handler = AHCIInterruptHandler::create(*this, pci_device_identifier.interrupt_line().value(), implemented_ports).release_value_but_fixme_should_propagate_errors();
+ m_irq_handler = AHCIInterruptHandler::create(*this, irq, implemented_ports).release_value_but_fixme_should_propagate_errors();
TRY(reset());
dbgln_if(AHCI_DEBUG, "{}: AHCI Controller Version = {:#08x}", device_identifier().address(), version);
diff --git a/Kernel/Storage/ATA/AHCI/InterruptHandler.cpp b/Kernel/Storage/ATA/AHCI/InterruptHandler.cpp
index b17cbb0210..1b8915bcc7 100644
--- a/Kernel/Storage/ATA/AHCI/InterruptHandler.cpp
+++ b/Kernel/Storage/ATA/AHCI/InterruptHandler.cpp
@@ -23,7 +23,7 @@ void AHCIInterruptHandler::allocate_resources_and_initialize_ports()
}
UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
- : IRQHandler(irq)
+ : PCIIRQHandler(controller, irq)
, m_parent_controller(controller)
, m_taken_ports(taken_ports)
, m_pending_ports_interrupts(create_pending_ports_interrupts_bitfield())
diff --git a/Kernel/Storage/ATA/AHCI/InterruptHandler.h b/Kernel/Storage/ATA/AHCI/InterruptHandler.h
index 1e425147b5..97203dcc93 100644
--- a/Kernel/Storage/ATA/AHCI/InterruptHandler.h
+++ b/Kernel/Storage/ATA/AHCI/InterruptHandler.h
@@ -7,7 +7,7 @@
#pragma once
#include <Kernel/Devices/Device.h>
-#include <Kernel/Interrupts/IRQHandler.h>
+#include <Kernel/Interrupts/PCIIRQHandler.h>
#include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Locking/Mutex.h>
#include <Kernel/Memory/PhysicalPage.h>
@@ -25,7 +25,7 @@ class AsyncBlockDeviceRequest;
class AHCIController;
class AHCIPort;
-class AHCIInterruptHandler final : public IRQHandler {
+class AHCIInterruptHandler final : public PCIIRQHandler {
friend class AHCIController;
public: