From 907b3dd0f385c1521e3499ce6791fb9eecd07886 Mon Sep 17 00:00:00 2001 From: Liav A Date: Sat, 29 May 2021 01:22:27 +0300 Subject: [PATCH] Kernel/Storage: Enable interrupts for AHCI ports if PHY is not enabled This change allows the controller to utilize interrupts even if no device was connected to a port when we initialize it, so we can support hotplug events now. --- Kernel/Storage/AHCIPort.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Kernel/Storage/AHCIPort.cpp b/Kernel/Storage/AHCIPort.cpp index e03dee6add..bf641ef2a2 100644 --- a/Kernel/Storage/AHCIPort.cpp +++ b/Kernel/Storage/AHCIPort.cpp @@ -241,6 +241,10 @@ bool AHCIPort::initialize(ScopedSpinLock>& main_lock) VERIFY(m_lock.is_locked()); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Initialization. Signature = 0x{:08x}", representative_port_index(), static_cast(m_port_registers.sig)); if (!is_phy_enabled()) { + // Note: If PHY is not enabled, just clear the interrupt status and enable interrupts, in case + // we are going to hotplug a device later. + m_interrupt_status.clear(); + m_interrupt_enable.set_all(); dbgln_if(AHCI_DEBUG, "AHCI Port {}: Bailing initialization, Phy is not enabled.", representative_port_index()); return false; }