diff options
author | Liav A <liavalb@gmail.com> | 2021-03-12 18:35:16 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-13 09:52:31 +0100 |
commit | 793d315994875435418961b92f247a0a81452933 (patch) | |
tree | 9ab32c42d9fe27fd61d8774152646067ff7aad47 /Kernel/Storage/AHCIPort.cpp | |
parent | a93dc8c8c949a6e97ba5a77eb537a6712b9d9b86 (diff) | |
download | serenity-793d315994875435418961b92f247a0a81452933.zip |
Kernel: Don't reset AHCI ports during boot unless requested
Instead of blindly resetting every AHCI port, let's just reset only the
controller by default. The user can still request to reset everything
with a new kernel boot argument called ahci_reset_mode which is set
by default to "controller", so the code will only invoke an HBA reset.
This kernel boot argument can be set to 3 different values:
1. "controller" - reset the HBA and skip resetting AHCI ports
2. "none" - don't reset anything, so we rely on the firmware to
initialize the AHCI HBA and ports for us.
3. "complete" - reset the AHCI HBA and ports.
Diffstat (limited to 'Kernel/Storage/AHCIPort.cpp')
-rw-r--r-- | Kernel/Storage/AHCIPort.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Kernel/Storage/AHCIPort.cpp b/Kernel/Storage/AHCIPort.cpp index 91d7241a04..b3f1f464bf 100644 --- a/Kernel/Storage/AHCIPort.cpp +++ b/Kernel/Storage/AHCIPort.cpp @@ -210,6 +210,22 @@ bool AHCIPort::reset() if (!initiate_sata_reset()) { return false; } + return initialize(); +} + +bool AHCIPort::initialize_without_reset() +{ + ScopedSpinLock lock(m_lock); + dmesgln("AHCI Port {}: {}", representative_port_index(), try_disambiguate_sata_status()); + return initialize(); +} + +bool AHCIPort::initialize() +{ + VERIFY(m_lock.is_locked()); + dbgln_if(AHCI_DEBUG, "AHCI Port {}: SIG {:x}", representative_port_index(), static_cast<u32>(m_port_registers.sig)); + if (!is_phy_enabled()) + return false; rebase(); power_on(); spin_up(); |