Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel/RTL8168: Change invalid u32 mmio reads to u8 #25651

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Kernel/Net/Realtek/RTL8168NetworkAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ UNMAP_AFTER_INIT ErrorOr<void> RTL8168NetworkAdapter::initialize(Badge<Networkin
// disable CMAC
out8(REG_IBCR2, in8(REG_IBCR2) & ~1);

while ((in32(REG_IBISR0) & 0x2) != 0)
while ((in8(REG_IBISR0) & 0x2) != 0)
Processor::wait_check();

out8(REG_IBISR0, in8(REG_IBISR0) | 0x20);
Expand All @@ -314,7 +314,7 @@ UNMAP_AFTER_INIT ErrorOr<void> RTL8168NetworkAdapter::initialize(Badge<Networkin
while ((in32(REG_TXCFG) & TXCFG_EMPTY) == 0)
Processor::wait_check();

while ((in32(REG_MCU) & (MCU_RX_EMPTY | MCU_TX_EMPTY)) == 0)
while ((in8(REG_MCU) & (MCU_RX_EMPTY | MCU_TX_EMPTY)) == 0)
Processor::wait_check();

out8(REG_COMMAND, in8(REG_COMMAND) & ~(COMMAND_RX_ENABLE | COMMAND_TX_ENABLE));
Expand All @@ -325,15 +325,15 @@ UNMAP_AFTER_INIT ErrorOr<void> RTL8168NetworkAdapter::initialize(Badge<Networkin
data &= ~(1 << 14);
ocp_out(0xe8de, data);

while ((in32(REG_MCU) & MCU_LINK_LIST_READY) == 0)
while ((in8(REG_MCU) & MCU_LINK_LIST_READY) == 0)
Processor::wait_check();

// vendor magic values ???
data = ocp_in(0xe8de);
data |= (1 << 15);
ocp_out(0xe8de, data);

while ((in32(REG_MCU) & MCU_LINK_LIST_READY) == 0)
while ((in8(REG_MCU) & MCU_LINK_LIST_READY) == 0)
Processor::wait_check();
}

Expand Down