summaryrefslogtreecommitdiff
path: root/Kernel/Storage/AHCIController.cpp
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-03-12 18:35:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-13 09:52:31 +0100
commit793d315994875435418961b92f247a0a81452933 (patch)
tree9ab32c42d9fe27fd61d8774152646067ff7aad47 /Kernel/Storage/AHCIController.cpp
parenta93dc8c8c949a6e97ba5a77eb537a6712b9d9b86 (diff)
downloadserenity-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/AHCIController.cpp')
-rw-r--r--Kernel/Storage/AHCIController.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Kernel/Storage/AHCIController.cpp b/Kernel/Storage/AHCIController.cpp
index 1068ea104a..d2b0570469 100644
--- a/Kernel/Storage/AHCIController.cpp
+++ b/Kernel/Storage/AHCIController.cpp
@@ -28,6 +28,7 @@
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <AK/Types.h>
+#include <Kernel/CommandLine.h>
#include <Kernel/Storage/AHCIController.h>
#include <Kernel/Storage/SATADiskDevice.h>
#include <Kernel/VM/MemoryManager.h>
@@ -144,11 +145,13 @@ AHCIController::~AHCIController()
void AHCIController::initialize()
{
- if (!reset()) {
- dmesgln("{}: AHCI controller reset failed", pci_address());
- return;
+ if (kernel_command_line().ahci_reset_mode() != AHCIResetMode::None) {
+ if (!reset()) {
+ dmesgln("{}: AHCI controller reset failed", pci_address());
+ return;
+ }
+ dmesgln("{}: AHCI controller reset", pci_address());
}
- dmesgln("{}: AHCI controller reset", pci_address());
dbgln("{}: AHCI command list entries count - {}", pci_address(), hba_capabilities().max_command_list_entries_count);
hba().control_regs.ghc = 0x80000000; // Ensure that HBA knows we are AHCI aware.
PCI::enable_interrupt_line(pci_address());