summaryrefslogtreecommitdiff
path: root/Kernel/CommandLine.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/CommandLine.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/CommandLine.cpp')
-rw-r--r--Kernel/CommandLine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp
index fdb09c4d41..4294b97c9c 100644
--- a/Kernel/CommandLine.cpp
+++ b/Kernel/CommandLine.cpp
@@ -148,6 +148,19 @@ UNMAP_AFTER_INIT HPETMode CommandLine::hpet_mode() const
PANIC("Unknown HPETMode: {}", hpet_mode);
}
+UNMAP_AFTER_INIT AHCIResetMode CommandLine::ahci_reset_mode() const
+{
+ const auto ahci_reset_mode = lookup("ahci_reset_mode").value_or("controller");
+ if (ahci_reset_mode == "controller") {
+ return AHCIResetMode::ControllerOnly;
+ } else if (ahci_reset_mode == "none") {
+ return AHCIResetMode::None;
+ } else if (ahci_reset_mode == "complete") {
+ return AHCIResetMode::Complete;
+ }
+ PANIC("Unknown AHCIResetMode: {}", ahci_reset_mode);
+}
+
UNMAP_AFTER_INIT BootMode CommandLine::boot_mode() const
{
const auto boot_mode = lookup("boot_mode").value_or("graphical");