mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:58:11 +00:00
Kernel/PCI: Unify disable checks under PCI::Access::is_disabled method
To declare that we don't have a PCI bus in the system we do two things: 1. Probe IO ports before enabling access - In case we are using the QEMU ISA-PC machine type, IO probing results in floating bus condition (returning 0xFF values), thus, we know we don't have PCI bus on the system. 2. Allow the user to specify to not use the PCI bus at all in the kernel commandline.
This commit is contained in:
parent
f6e635938f
commit
2272d93215
5 changed files with 22 additions and 6 deletions
|
@ -17,6 +17,9 @@
|
|||
namespace Kernel {
|
||||
namespace PCI {
|
||||
|
||||
READONLY_AFTER_INIT bool g_pci_access_io_probe_failed;
|
||||
READONLY_AFTER_INIT bool g_pci_access_is_disabled_from_commandline;
|
||||
|
||||
static bool test_pci_io();
|
||||
|
||||
UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
|
||||
|
@ -28,7 +31,7 @@ UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
|
|||
if (boot_determined != PCIAccessLevel::IOAddressing)
|
||||
return boot_determined;
|
||||
|
||||
if (test_pci_io())
|
||||
if (!g_pci_access_io_probe_failed)
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
|
||||
PANIC("No PCI bus access method detected!");
|
||||
|
@ -36,7 +39,10 @@ UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
|
|||
|
||||
UNMAP_AFTER_INIT void initialize()
|
||||
{
|
||||
VERIFY(kernel_command_line().pci_access_level() != PCIAccessLevel::None);
|
||||
g_pci_access_io_probe_failed = !test_pci_io();
|
||||
g_pci_access_is_disabled_from_commandline = kernel_command_line().is_pci_disabled();
|
||||
if (g_pci_access_is_disabled_from_commandline || g_pci_access_io_probe_failed)
|
||||
return;
|
||||
switch (detect_optimal_access_type()) {
|
||||
case PCIAccessLevel::MemoryAddressing: {
|
||||
auto mcfg = ACPI::Parser::the()->find_table("MCFG");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue