mirror of
https://github.com/RGBCube/serenity
synced 2025-07-02 22:42:08 +00:00
Kernel: Create support for PCI ECAM
The new PCI subsystem is initialized during runtime. PCI::Initializer is supposed to be called during early boot, to perform a few tests, and initialize the proper configuration space access mechanism. Kernel boot parameters can be specified by a user to determine what tests will occur, to aid debugging on problematic machines. After that, PCI::Initializer should be dismissed. PCI::IOAccess is a class that is derived from PCI::Access class and implements PCI configuration space access mechanism via x86 IO ports. PCI::MMIOAccess is a class that is derived from PCI::Access and implements PCI configurtaion space access mechanism via memory access. The new PCI subsystem also supports determination of IO/MMIO space needed by a device by checking a given BAR. In addition, Every device or component that use the PCI subsystem has changed to match the last changes.
This commit is contained in:
parent
d85874be4b
commit
e5ffa960d7
20 changed files with 878 additions and 16 deletions
|
@ -1,6 +1,5 @@
|
|||
#include <Kernel/IO.h>
|
||||
#include <Kernel/Net/E1000NetworkAdapter.h>
|
||||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
||||
#define REG_CTRL 0x0000
|
||||
|
@ -119,6 +118,7 @@ E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address pci_address, u8 irq)
|
|||
enable_bus_mastering(m_pci_address);
|
||||
|
||||
m_mmio_base = PhysicalAddress(PCI::get_BAR0(m_pci_address));
|
||||
u32 mmio_base_size = PCI::get_BAR_Space_Size(pci_address, 0);
|
||||
MM.map_for_kernel(VirtualAddress(m_mmio_base.get()), m_mmio_base);
|
||||
MM.map_for_kernel(VirtualAddress(m_mmio_base.offset(4096).get()), m_mmio_base.offset(4096));
|
||||
MM.map_for_kernel(VirtualAddress(m_mmio_base.offset(8192).get()), m_mmio_base.offset(8192));
|
||||
|
@ -129,6 +129,7 @@ E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address pci_address, u8 irq)
|
|||
m_interrupt_line = PCI::get_interrupt_line(m_pci_address);
|
||||
kprintf("E1000: IO port base: %w\n", m_io_base);
|
||||
kprintf("E1000: MMIO base: P%x\n", m_mmio_base);
|
||||
kprintf("E1000: MMIO base size: %u bytes\n", mmio_base_size);
|
||||
kprintf("E1000: Interrupt line: %u\n", m_interrupt_line);
|
||||
detect_eeprom();
|
||||
kprintf("E1000: Has EEPROM? %u\n", m_has_eeprom);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue