mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: More work on bringing up E1000 support.
This commit is contained in:
parent
a36eaeb18c
commit
47b096feb4
Notes:
sideshowbarker
2024-07-19 15:05:12 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/47b096feb48
4 changed files with 15 additions and 0 deletions
|
@ -108,6 +108,9 @@ E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address pci_address, byte irq)
|
|||
{
|
||||
s_the = this;
|
||||
kprintf("E1000: Found at PCI address %b:%b:%b\n", pci_address.bus(), pci_address.slot(), pci_address.function());
|
||||
|
||||
enable_bus_mastering(m_pci_address);
|
||||
|
||||
m_mmio_base = PhysicalAddress(PCI::get_BAR0(m_pci_address));
|
||||
MM.map_for_kernel(LinearAddress(m_mmio_base.get()), m_mmio_base);
|
||||
MM.map_for_kernel(LinearAddress(m_mmio_base.offset(4096).get()), m_mmio_base.offset(4096));
|
||||
|
|
|
@ -56,6 +56,9 @@ void MemoryManager::populate_page_directory(PageDirectory& page_directory)
|
|||
{
|
||||
page_directory.m_directory_page = allocate_supervisor_physical_page();
|
||||
page_directory.entries()[0] = kernel_page_directory().entries()[0];
|
||||
// Defer to the kernel page tables for 0xC0000000-0xFFFFFFFF
|
||||
for (int i = 768; i < 1024; ++i)
|
||||
page_directory.entries()[i] = kernel_page_directory().entries()[i];
|
||||
}
|
||||
|
||||
void MemoryManager::initialize_paging()
|
||||
|
|
|
@ -103,6 +103,14 @@ dword get_BAR3(Address address) { return read_field<dword>(address, PCI_BAR3); }
|
|||
dword get_BAR4(Address address) { return read_field<dword>(address, PCI_BAR4); }
|
||||
dword get_BAR5(Address address) { return read_field<dword>(address, PCI_BAR5); }
|
||||
|
||||
void enable_bus_mastering(Address address)
|
||||
{
|
||||
auto value = read_field<word>(address, PCI_COMMAND);
|
||||
value |= (1 << 2);
|
||||
value |= (1 << 0);
|
||||
write_field<word>(address, PCI_COMMAND, value);
|
||||
}
|
||||
|
||||
void enumerate_all(Function<void(Address, ID)> callback)
|
||||
{
|
||||
// Single PCI host controller.
|
||||
|
|
|
@ -47,5 +47,6 @@ dword get_BAR2(Address);
|
|||
dword get_BAR3(Address);
|
||||
dword get_BAR4(Address);
|
||||
dword get_BAR5(Address);
|
||||
void enable_bus_mastering(Address);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue