mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Kernel: Add MSI support to AHCI
Add MSI support to AHCI. Prefer MSI interrupts over pin-based interrupts.
This commit is contained in:
parent
8f62e62cfe
commit
6c7ee5344c
Notes:
sideshowbarker
2024-07-16 22:34:39 +09:00
Author: https://github.com/Panky-codes Commit: https://github.com/SerenityOS/serenity/commit/6c7ee5344c Pull-request: https://github.com/SerenityOS/serenity/pull/18732 Reviewed-by: https://github.com/gmta ✅ Reviewed-by: https://github.com/supercomputer7 ✅
3 changed files with 6 additions and 5 deletions
|
@ -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);
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in a new issue