Kernel: Add MSI support to AHCI

Add MSI support to AHCI. Prefer MSI interrupts over pin-based
interrupts.
This commit is contained in:
Pankaj Raghav 2023-05-08 21:36:47 +02:00 committed by Jelle Raaijmakers
parent 8f62e62cfe
commit 6c7ee5344c
Notes: sideshowbarker 2024-07-16 22:34:39 +09:00
3 changed files with 6 additions and 5 deletions

View file

@ -167,12 +167,13 @@ UNMAP_AFTER_INIT ErrorOr<void> AHCIController::initialize_hba(PCI::DeviceIdentif
u32 version = hba().control_regs.version; u32 version = hba().control_regs.version;
hba().control_regs.ghc = 0x80000000; // Ensure that HBA knows we are AHCI aware. 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()); PCI::enable_bus_mastering(device_identifier());
TRY(reserve_irqs(1, true));
auto irq = MUST(allocate_irq(0));
enable_global_interrupts(); enable_global_interrupts();
auto implemented_ports = AHCI::MaskedBitField((u32 volatile&)(hba().control_regs.pi)); 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()); TRY(reset());
dbgln_if(AHCI_DEBUG, "{}: AHCI Controller Version = {:#08x}", device_identifier().address(), version); dbgln_if(AHCI_DEBUG, "{}: AHCI Controller Version = {:#08x}", device_identifier().address(), version);

View file

@ -23,7 +23,7 @@ void AHCIInterruptHandler::allocate_resources_and_initialize_ports()
} }
UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports) UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
: IRQHandler(irq) : PCIIRQHandler(controller, irq)
, m_parent_controller(controller) , m_parent_controller(controller)
, m_taken_ports(taken_ports) , m_taken_ports(taken_ports)
, m_pending_ports_interrupts(create_pending_ports_interrupts_bitfield()) , m_pending_ports_interrupts(create_pending_ports_interrupts_bitfield())

View file

@ -7,7 +7,7 @@
#pragma once #pragma once
#include <Kernel/Devices/Device.h> #include <Kernel/Devices/Device.h>
#include <Kernel/Interrupts/IRQHandler.h> #include <Kernel/Interrupts/PCIIRQHandler.h>
#include <Kernel/Library/LockRefPtr.h> #include <Kernel/Library/LockRefPtr.h>
#include <Kernel/Locking/Mutex.h> #include <Kernel/Locking/Mutex.h>
#include <Kernel/Memory/PhysicalPage.h> #include <Kernel/Memory/PhysicalPage.h>
@ -25,7 +25,7 @@ class AsyncBlockDeviceRequest;
class AHCIController; class AHCIController;
class AHCIPort; class AHCIPort;
class AHCIInterruptHandler final : public IRQHandler { class AHCIInterruptHandler final : public PCIIRQHandler {
friend class AHCIController; friend class AHCIController;
public: public: