diff --git a/Kernel/PCI/Initializer.cpp b/Kernel/PCI/Initializer.cpp index 40020f64cb..00a566b2fe 100644 --- a/Kernel/PCI/Initializer.cpp +++ b/Kernel/PCI/Initializer.cpp @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -23,10 +22,10 @@ void PCI::Initializer::initialize_pci_io_access() { PCI::IOAccess::initialize(); } -void PCI::Initializer::test_and_initialize(bool disable_pci_mmio, bool pci_force_probing) +void PCI::Initializer::test_and_initialize(bool disable_pci_mmio) { if (disable_pci_mmio) { - if (test_pci_io(pci_force_probing)) { + if (test_pci_io()) { initialize_pci_io_access(); } else { kprintf("No PCI Bus Access Method Detected, Halt!\n"); @@ -38,7 +37,7 @@ void PCI::Initializer::test_and_initialize(bool disable_pci_mmio, bool pci_force if (test_pci_mmio()) { initialize_pci_mmio_access_after_test(); } else { - if (test_pci_io(pci_force_probing)) { + if (test_pci_io()) { initialize_pci_io_access(); } else { kprintf("No PCI Bus Access Method Detected, Halt!\n"); @@ -46,7 +45,7 @@ void PCI::Initializer::test_and_initialize(bool disable_pci_mmio, bool pci_force } } } else { - if (test_pci_io(pci_force_probing)) { + if (test_pci_io()) { initialize_pci_io_access(); } else { kprintf("No PCI Bus Access Method Detected, Halt!\n"); @@ -65,29 +64,9 @@ bool PCI::Initializer::test_acpi() return true; } -bool PCI::Initializer::test_pci_io(bool pci_force_probing) +bool PCI::Initializer::test_pci_io() { - kprintf("Testing PCI via SMBIOS...\n"); - - if (!pci_force_probing) { - if (DMIDecoder::the().is_reliable()) { - if ((DMIDecoder::the().get_bios_characteristics() & (1 << 3)) != 0) { - kprintf("DMIDecoder: Warning, BIOS characteristics are not supported, skipping\n"); - } else if ((DMIDecoder::the().get_bios_characteristics() & (u32)SMBIOS::BIOSCharacteristics::PCI_support) != 0) { - kprintf("PCI *should* be supported according to SMBIOS...\n"); - return true; - } else { - kprintf("SMBIOS does not list PCI as supported, Falling back to manual probing!\n"); - } - } else { - kprintf("DMI is classified as unreliable, ignore it!\n"); - } - } else { - kprintf("Requested to force PCI probing...\n"); - } - kprintf("Testing PCI via manual probing... "); - u32 tmp = 0x80000000; IO::out32(PCI_ADDRESS_PORT, tmp); tmp = IO::in32(PCI_ADDRESS_PORT); @@ -118,7 +97,8 @@ void PCI::Initializer::dismiss() if (s_pci_initializer == nullptr) return; kprintf("PCI Subsystem Initializer dismissed.\n"); - s_pci_initializer->~Initializer(); + delete s_pci_initializer; + s_pci_initializer = nullptr; } PCI::Initializer::~Initializer() diff --git a/Kernel/PCI/Initializer.h b/Kernel/PCI/Initializer.h index 875ba2afa6..0c4143312a 100644 --- a/Kernel/PCI/Initializer.h +++ b/Kernel/PCI/Initializer.h @@ -9,14 +9,14 @@ public: static PCI::Initializer& the(); void initialize_pci_mmio_access(ACPI_RAW::MCFG& mcfg); void initialize_pci_io_access(); - void test_and_initialize(bool disable_pci_mmio, bool pci_force_probing); + void test_and_initialize(bool disable_pci_mmio); static void dismiss(); private: ~Initializer(); Initializer(); bool test_acpi(); - bool test_pci_io(bool pci_force_probing); + bool test_pci_io(); bool test_pci_mmio(); void initialize_pci_mmio_access_after_test(); }; \ No newline at end of file diff --git a/Kernel/grub.cfg b/Kernel/grub.cfg index 1b4534d88d..cbdf51158a 100644 --- a/Kernel/grub.cfg +++ b/Kernel/grub.cfg @@ -5,6 +5,11 @@ menuentry 'SerenityOS (normal)' { multiboot /boot/kernel root=/dev/hda1 } +menuentry 'SerenityOS (No ACPI)' { + root=hd0,1 + multiboot /boot/kernel root=/dev/hda1 noacpi +} + menuentry 'SerenityOS (with serial debug)' { root=hd0,1 multiboot /boot/kernel serial_debug root=/dev/hda1 diff --git a/Kernel/grub_gpt.cfg b/Kernel/grub_gpt.cfg index b890913116..e2703f33fd 100644 --- a/Kernel/grub_gpt.cfg +++ b/Kernel/grub_gpt.cfg @@ -5,6 +5,11 @@ menuentry 'SerenityOS (normal)' { multiboot /boot/kernel root=/dev/hda2 } +menuentry 'SerenityOS (No ACPI)' { + root=hd0,2 + multiboot /boot/kernel root=/dev/hda2 noacpi +} + menuentry 'SerenityOS (with serial debug)' { root=hd0,2 multiboot /boot/kernel serial_debug root=/dev/hda2 diff --git a/Kernel/init.cpp b/Kernel/init.cpp index 8022facf29..7b3c0ee7e3 100644 --- a/Kernel/init.cpp +++ b/Kernel/init.cpp @@ -79,6 +79,13 @@ VFS* vfs; root = "/dev/hda"; } + bool dmi_unreliable = KParams::the().has("dmi_unreliable"); + if (dmi_unreliable) { + DMIDecoder::initialize_untrusted(); + } else { + DMIDecoder::initialize(); + } + if (!root.starts_with("/dev/hda")) { kprintf("init_stage2: root filesystem must be on the first IDE hard drive (/dev/hda)\n"); hang(); @@ -258,17 +265,9 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables) bool complete_acpi_disable = KParams::the().has("noacpi"); bool dynamic_acpi_disable = KParams::the().has("noacpi_aml"); bool pci_mmio_disable = KParams::the().has("nopci_mmio"); - bool pci_force_probing = KParams::the().has("pci_nodmi"); - bool dmi_unreliable = KParams::the().has("dmi_unreliable"); MemoryManager::initialize(physical_address_for_kernel_page_tables); - if (dmi_unreliable) { - DMIDecoder::initialize_untrusted(); - } else { - DMIDecoder::initialize(); - } - if (complete_acpi_disable) { ACPIParser::initialize_limited(); } else { @@ -279,12 +278,6 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables) } } - // Sample test to see if the ACPI parser is working... - kprintf("ACPI: HPET table @ P 0x%x\n", ACPIParser::the().find_table("HPET")); - - PCI::Initializer::the().test_and_initialize(pci_mmio_disable, pci_force_probing); - PCI::Initializer::the().dismiss(); - vfs = new VFS; dev_debuglog = new DebugLogDevice; @@ -345,6 +338,12 @@ extern "C" [[noreturn]] void init(u32 physical_address_for_kernel_page_tables) tty1 = new VirtualConsole(1); VirtualConsole::switch_to(0); + // Sample test to see if the ACPI parser is working... + kprintf("ACPI: HPET table @ P 0x%x\n", ACPIParser::the().find_table("HPET")); + + PCI::Initializer::the().test_and_initialize(pci_mmio_disable); + PCI::Initializer::the().dismiss(); + if (APIC::init()) APIC::enable(0);