mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
Kernel/Net: Enable usage of RTL8168E and RTL8168H in RTL8168 driver
I tested both (version 15 and 30 of the RTL8168 chipset) with PCI- passthrough of these cards, and they seem to work just fine with the driver.
This commit is contained in:
parent
86fa5d71c0
commit
23ef46f4f7
2 changed files with 54 additions and 4 deletions
|
@ -192,6 +192,51 @@ UNMAP_AFTER_INIT RefPtr<RTL8168NetworkAdapter> RTL8168NetworkAdapter::try_to_ini
|
||||||
return adopt_ref_if_nonnull(new (nothrow) RTL8168NetworkAdapter(address, irq));
|
return adopt_ref_if_nonnull(new (nothrow) RTL8168NetworkAdapter(address, irq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RTL8168NetworkAdapter::determine_supported_version() const
|
||||||
|
{
|
||||||
|
switch (m_version) {
|
||||||
|
case ChipVersion::Version1:
|
||||||
|
case ChipVersion::Version2:
|
||||||
|
case ChipVersion::Version3:
|
||||||
|
return true;
|
||||||
|
case ChipVersion::Version4:
|
||||||
|
case ChipVersion::Version5:
|
||||||
|
case ChipVersion::Version6:
|
||||||
|
case ChipVersion::Version7:
|
||||||
|
case ChipVersion::Version8:
|
||||||
|
case ChipVersion::Version9:
|
||||||
|
case ChipVersion::Version10:
|
||||||
|
case ChipVersion::Version11:
|
||||||
|
case ChipVersion::Version12:
|
||||||
|
case ChipVersion::Version13:
|
||||||
|
case ChipVersion::Version14:
|
||||||
|
return false;
|
||||||
|
case ChipVersion::Version15:
|
||||||
|
return true;
|
||||||
|
case ChipVersion::Version16:
|
||||||
|
return false;
|
||||||
|
case ChipVersion::Version17:
|
||||||
|
return true;
|
||||||
|
case ChipVersion::Version18:
|
||||||
|
case ChipVersion::Version19:
|
||||||
|
case ChipVersion::Version20:
|
||||||
|
case ChipVersion::Version21:
|
||||||
|
case ChipVersion::Version22:
|
||||||
|
case ChipVersion::Version23:
|
||||||
|
case ChipVersion::Version24:
|
||||||
|
case ChipVersion::Version25:
|
||||||
|
case ChipVersion::Version26:
|
||||||
|
case ChipVersion::Version27:
|
||||||
|
case ChipVersion::Version28:
|
||||||
|
case ChipVersion::Version29:
|
||||||
|
return false;
|
||||||
|
case ChipVersion::Version30:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address address, u8 irq)
|
UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address address, u8 irq)
|
||||||
: PCI::Device(address)
|
: PCI::Device(address)
|
||||||
, IRQHandler(irq)
|
, IRQHandler(irq)
|
||||||
|
@ -206,7 +251,8 @@ UNMAP_AFTER_INIT RTL8168NetworkAdapter::RTL8168NetworkAdapter(PCI::Address addre
|
||||||
|
|
||||||
identify_chip_version();
|
identify_chip_version();
|
||||||
dmesgln("RTL8168: Version detected - {} ({}{})", possible_device_name(), (u8)m_version, m_version_uncertain ? "?" : "");
|
dmesgln("RTL8168: Version detected - {} ({}{})", possible_device_name(), (u8)m_version, m_version_uncertain ? "?" : "");
|
||||||
if (m_version == ChipVersion::Unknown || (m_version >= ChipVersion::Version4 && m_version <= ChipVersion::Version16) || m_version >= ChipVersion::Version18) {
|
|
||||||
|
if (!determine_supported_version()) {
|
||||||
dmesgln("RTL8168: Aborting initialization! Support for your chip version ({}) is not implemented yet, please open a GH issue and include this message.", (u8)m_version);
|
dmesgln("RTL8168: Aborting initialization! Support for your chip version ({}) is not implemented yet, please open a GH issue and include this message.", (u8)m_version);
|
||||||
return; // Each ChipVersion requires a specific implementation of configure_phy and hardware_quirks
|
return; // Each ChipVersion requires a specific implementation of configure_phy and hardware_quirks
|
||||||
}
|
}
|
||||||
|
@ -389,8 +435,10 @@ void RTL8168NetworkAdapter::configure_phy()
|
||||||
TODO();
|
TODO();
|
||||||
case ChipVersion::Version14:
|
case ChipVersion::Version14:
|
||||||
TODO();
|
TODO();
|
||||||
case ChipVersion::Version15:
|
case ChipVersion::Version15: {
|
||||||
TODO();
|
configure_phy_e_2();
|
||||||
|
return;
|
||||||
|
}
|
||||||
case ChipVersion::Version16:
|
case ChipVersion::Version16:
|
||||||
TODO();
|
TODO();
|
||||||
case ChipVersion::Version17: {
|
case ChipVersion::Version17: {
|
||||||
|
@ -822,7 +870,7 @@ void RTL8168NetworkAdapter::hardware_quirks()
|
||||||
case ChipVersion::Version14:
|
case ChipVersion::Version14:
|
||||||
TODO();
|
TODO();
|
||||||
case ChipVersion::Version15:
|
case ChipVersion::Version15:
|
||||||
TODO();
|
return;
|
||||||
case ChipVersion::Version16:
|
case ChipVersion::Version16:
|
||||||
TODO();
|
TODO();
|
||||||
case ChipVersion::Version17:
|
case ChipVersion::Version17:
|
||||||
|
|
|
@ -43,6 +43,8 @@ private:
|
||||||
virtual bool handle_irq(const RegisterState&) override;
|
virtual bool handle_irq(const RegisterState&) override;
|
||||||
virtual StringView class_name() const override { return "RTL8168NetworkAdapter"sv; }
|
virtual StringView class_name() const override { return "RTL8168NetworkAdapter"sv; }
|
||||||
|
|
||||||
|
bool determine_supported_version() const;
|
||||||
|
|
||||||
struct [[gnu::packed]] TXDescriptor {
|
struct [[gnu::packed]] TXDescriptor {
|
||||||
volatile u16 frame_length; // top 2 bits are reserved
|
volatile u16 frame_length; // top 2 bits are reserved
|
||||||
volatile u16 flags;
|
volatile u16 flags;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue