Revert "EmbeddedPkg/Lan9118Dxe: use MemoryFence"
Commita4626006bb
("EmbeddedPkg/Lan9118Dxe: use MemoryFence") replaced some stalls with memory fences, on the presumption that these were erroneously being used to order memory accesses. However, this was not the case. LAN9118 devices require a timing delay between state-changing reads/writes and subsequent reads, as updates to the register file are asynchronous and the effects of state-changes are not immediately visible to subsequent reads. This delay cannot be ensured through the use of memory barriers, which only enforce observable ordering, and not timing. Thus, converting these stalls to memory fences was erroneous, and may result in stale values being read. This reverts commita4626006bb
. Cc: Leif Lindholm <leif.lindholm@linaro.org> Cc: Ryan Harkin <ryan.harkin@linaro.org> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
This commit is contained in:
committed by
Ard Biesheuvel
parent
d1ec2b2f78
commit
28f52b9fae
@@ -307,7 +307,8 @@ SnpInitialize (
|
||||
|
||||
// Write the current configuration to the register
|
||||
MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
|
||||
MemoryFence();
|
||||
gBS->Stall (LAN9118_STALL);
|
||||
gBS->Stall (LAN9118_STALL);
|
||||
|
||||
// Configure GPIO and HW
|
||||
Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
|
||||
@@ -430,7 +431,7 @@ SnpReset (
|
||||
|
||||
// Write the current configuration to the register
|
||||
MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
|
||||
MemoryFence();
|
||||
gBS->Stall (LAN9118_STALL);
|
||||
|
||||
// Reactivate the LEDs
|
||||
Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
|
||||
@@ -445,7 +446,7 @@ SnpReset (
|
||||
HwConf |= HW_CFG_TX_FIFO_SIZE(gTxBuffer); // assign size chosen in SnpInitialize
|
||||
|
||||
MmioWrite32 (LAN9118_HW_CFG, HwConf); // Write the conf
|
||||
MemoryFence();
|
||||
gBS->Stall (LAN9118_STALL);
|
||||
}
|
||||
|
||||
// Enable the receiver and transmitter and clear their contents
|
||||
@@ -700,7 +701,7 @@ SnpReceiveFilters (
|
||||
// Write the options to the MAC_CSR
|
||||
//
|
||||
IndirectMACWrite32 (INDIRECT_MAC_INDEX_CR, MacCSRValue);
|
||||
MemoryFence();
|
||||
gBS->Stall (LAN9118_STALL);
|
||||
|
||||
//
|
||||
// If we have to retrieve something, start packet reception.
|
||||
|
Reference in New Issue
Block a user