Kernel: Introduce two new boot arguments to assist with bare metal debug

The first one is for disabling the PS2 controller, the other one is for
disabling physical storage enumeration.
We can't be sure any machine will work with our implementation,
therefore this will help us to test more machines.
This commit is contained in:
Liav A 2021-04-08 21:18:48 +03:00 committed by Andreas Kling
parent 649564585e
commit a0be30f655
Notes: sideshowbarker 2024-07-18 20:38:49 +09:00
4 changed files with 24 additions and 9 deletions

View File

@ -155,6 +155,16 @@ UNMAP_AFTER_INIT HPETMode CommandLine::hpet_mode() const
PANIC("Unknown HPETMode: {}", hpet_mode);
}
UNMAP_AFTER_INIT bool CommandLine::disable_ps2_controller() const
{
return contains("disable_ps2_controller");
}
UNMAP_AFTER_INIT bool CommandLine::disable_physical_storage() const
{
return contains("disable_physical_storage");
}
UNMAP_AFTER_INIT AHCIResetMode CommandLine::ahci_reset_mode() const
{
const auto ahci_reset_mode = lookup("ahci_reset_mode").value_or("controller");

View File

@ -84,6 +84,8 @@ public:
[[nodiscard]] AcpiFeatureLevel acpi_feature_level() const;
[[nodiscard]] BootMode boot_mode() const;
[[nodiscard]] HPETMode hpet_mode() const;
[[nodiscard]] bool disable_physical_storage() const;
[[nodiscard]] bool disable_ps2_controller() const;
[[nodiscard]] AHCIResetMode ahci_reset_mode() const;
[[nodiscard]] String userspace_init() const;
[[nodiscard]] Vector<String> userspace_init_args() const;

View File

@ -26,6 +26,7 @@
#include <AK/Singleton.h>
#include <Kernel/ACPI/Parser.h>
#include <Kernel/CommandLine.h>
#include <Kernel/Devices/HID/HIDManagement.h>
#include <Kernel/Devices/HID/I8042Controller.h>
@ -125,7 +126,7 @@ UNMAP_AFTER_INIT void HIDManagement::enumerate()
// emulation of the PS/2 controller if it was set by the BIOS.
// If ACPI indicates we have an i8042 controller and the USB controller was
// set to emulate PS/2, we should not initialize the PS/2 controller.
if (!ACPI::Parser::the()->have_8042())
if (!ACPI::Parser::the()->have_8042() || kernel_command_line().disable_ps2_controller())
return;
m_i8042_controller = I8042Controller::initialize();
m_i8042_controller->detect_devices();

View File

@ -65,18 +65,20 @@ bool StorageManagement::boot_argument_contains_partition_uuid()
UNMAP_AFTER_INIT NonnullRefPtrVector<StorageController> StorageManagement::enumerate_controllers(bool force_pio) const
{
NonnullRefPtrVector<StorageController> controllers;
if (kernel_command_line().is_ide_enabled()) {
if (!kernel_command_line().disable_physical_storage()) {
if (kernel_command_line().is_ide_enabled()) {
PCI::enumerate([&](const PCI::Address& address, PCI::ID) {
if (PCI::get_class(address) == 0x1 && PCI::get_subclass(address) == 0x1) {
controllers.append(IDEController::initialize(address, force_pio));
}
});
}
PCI::enumerate([&](const PCI::Address& address, PCI::ID) {
if (PCI::get_class(address) == 0x1 && PCI::get_subclass(address) == 0x1) {
controllers.append(IDEController::initialize(address, force_pio));
if (PCI::get_class(address) == 0x1 && PCI::get_subclass(address) == 0x6 && PCI::get_programming_interface(address) == 0x1) {
controllers.append(AHCIController::initialize(address));
}
});
}
PCI::enumerate([&](const PCI::Address& address, PCI::ID) {
if (PCI::get_class(address) == 0x1 && PCI::get_subclass(address) == 0x6 && PCI::get_programming_interface(address) == 0x1) {
controllers.append(AHCIController::initialize(address));
}
});
controllers.append(RamdiskController::initialize());
return controllers;
}