1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:17:36 +00:00

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.
This commit is contained in:
Liav A 2021-03-12 18:35:16 +02:00 committed by Andreas Kling
parent a93dc8c8c9
commit 793d315994
6 changed files with 58 additions and 5 deletions

View file

@ -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");