|
@@ -181,14 +181,14 @@ namespace Kernel {
|
|
#define TX_BUFFER_SIZE 0x1FF8
|
|
#define TX_BUFFER_SIZE 0x1FF8
|
|
#define RX_BUFFER_SIZE 0x1FF8 // FIXME: this should be increased (0x3FFF)
|
|
#define RX_BUFFER_SIZE 0x1FF8 // FIXME: this should be increased (0x3FFF)
|
|
|
|
|
|
-UNMAP_AFTER_INIT RefPtr<RTL8168NetworkAdapter> RTL8168NetworkAdapter::try_to_initialize(PCI::DeviceIdentifier const& pci_device_identifier)
|
|
|
|
|
|
+UNMAP_AFTER_INIT RefPtr<RTL8168NetworkAdapter> RTL8168NetworkAdapter::try_to_initialize(PCI::DeviceIdentifier const& pci_device_identifier, NonnullOwnPtr<KString> interface_name)
|
|
{
|
|
{
|
|
if (pci_device_identifier.hardware_id().vendor_id != PCI::VendorID::Realtek)
|
|
if (pci_device_identifier.hardware_id().vendor_id != PCI::VendorID::Realtek)
|
|
return {};
|
|
return {};
|
|
if (pci_device_identifier.hardware_id().device_id != 0x8168)
|
|
if (pci_device_identifier.hardware_id().device_id != 0x8168)
|
|
return {};
|
|
return {};
|
|
u8 irq = pci_device_identifier.interrupt_line().value();
|
|
u8 irq = pci_device_identifier.interrupt_line().value();
|
|
- return adopt_ref_if_nonnull(new (nothrow) RTL8168NetworkAdapter(pci_device_identifier.address(), irq));
|
|
|
|
|
|
+ return adopt_ref_if_nonnull(new (nothrow) RTL8168NetworkAdapter(pci_device_identifier.address(), irq, move(interface_name)));
|
|
}
|
|
}
|
|
|
|
|
|
bool RTL8168NetworkAdapter::determine_supported_version() const
|
|
bool RTL8168NetworkAdapter::determine_supported_version() const
|
|
@@ -236,15 +236,14 @@ bool RTL8168NetworkAdapter::determine_supported_version() const
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address address, u8 irq)
|
|
|
|
- : PCI::Device(address)
|
|
|
|
|
|
+UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address address, u8 irq, NonnullOwnPtr<KString> interface_name)
|
|
|
|
+ : NetworkAdapter(move(interface_name))
|
|
|
|
+ , PCI::Device(address)
|
|
, IRQHandler(irq)
|
|
, IRQHandler(irq)
|
|
, m_io_base(PCI::get_BAR0(pci_address()) & ~1)
|
|
, m_io_base(PCI::get_BAR0(pci_address()) & ~1)
|
|
, m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)), "RTL8168 RX", Memory::Region::Access::ReadWrite).release_value())
|
|
, m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(TXDescriptor) * (number_of_rx_descriptors + 1)), "RTL8168 RX", Memory::Region::Access::ReadWrite).release_value())
|
|
, m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)), "RTL8168 TX", Memory::Region::Access::ReadWrite).release_value())
|
|
, m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(RXDescriptor) * (number_of_tx_descriptors + 1)), "RTL8168 TX", Memory::Region::Access::ReadWrite).release_value())
|
|
{
|
|
{
|
|
- set_interface_name(address);
|
|
|
|
-
|
|
|
|
dmesgln("RTL8168: Found @ {}", pci_address());
|
|
dmesgln("RTL8168: Found @ {}", pci_address());
|
|
dmesgln("RTL8168: I/O port base: {}", m_io_base);
|
|
dmesgln("RTL8168: I/O port base: {}", m_io_base);
|
|
|
|
|