summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Drivers
diff options
context:
space:
mode:
authorRyan Harkin <ryan.harkin@linaro.org>2016-02-08 14:38:05 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2016-02-10 17:56:43 +0100
commitb7b7fb3decf5fa5663ad34cbfc186a36d1f6a02c (patch)
tree558b38d0a2d44a83d478e43b9d6ba13f73f76aa0 /EmbeddedPkg/Drivers
parenta4626006bbf86113453aeb7920895e66cdd04737 (diff)
downloadedk2-b7b7fb3decf5fa5663ad34cbfc186a36d1f6a02c.tar.gz
edk2-b7b7fb3decf5fa5663ad34cbfc186a36d1f6a02c.tar.bz2
edk2-b7b7fb3decf5fa5663ad34cbfc186a36d1f6a02c.zip
EmbeddedPkg/Lan9118Dxe: add PCD for negotiation timeout
Add a PCD for the link negotiation timeout so the platform can over-ride the default value. The code previously did 2000 iterations of the loop with a 2us stall, so the code has been changed subtly to set the number of iterations equal to the PCD value divided by the stall time. Since the stall time has not changed, the default PCD value is set at 4000 so the original behaviour is not changed. The problems were discovered when the ARM Juno Development Platform used the "EFI Network" option with then LAN9118 driver. It fails to boot the first time and so the board drops back to Shell again: Warning: LAN9118 Driver in stopped state Link timeout in auto-negotiation. Lan9118: Auto Negociation not supported. EhcExecTransfer: transfer failed with 2 EhcControlTransfer: error - Device Error, transfer - 2 Buffer: EFI Hard Drive Booting EFI Misc Device Booting EFI Misc Device 1 Booting EFI Hard Drive Booting EFI Network Warning: LAN9118 Driver not initialized Link timeout in auto-negotiation. Lan9118: Auto Negociation not supported. Booting EFI Internal Shell Exiting Shell drops the user back to the Intel BDS UI. Selecting "Continue" then succeeds in booting from the EFI Network: Booting EFI Misc Device Booting EFI Misc Device 1 Booting EFI Hard Drive Booting EFI Network ..MnpFreeTxBuf: Duplicated recycle report from SNP. MnpFreeTxBuf: Duplicated recycle report from SNP. [snip repeated errors] Discussion on the edk2-devel mailing list [1] prompted Laszlo Ersek to suggest the time taken for the NIC to negotiate was causing a problem. He suggested the solution contained in this patch to provide a PCD configurable by the platform. The default PCD value does not work for Juno. Setting the PCD to a larger value works for Juno R0, R1 and R2. [1] http://article.gmane.org/gmane.comp.bios.edk2.devel/7341 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'EmbeddedPkg/Drivers')
-rw-r--r--EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf1
-rw-r--r--EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
index 9e5f98b4bd..3c2246fb8a 100644
--- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
+++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.inf
@@ -51,6 +51,7 @@
[FixedPcd]
gEmbeddedTokenSpaceGuid.PcdLan9118DxeBaseAddress
gEmbeddedTokenSpaceGuid.PcdLan9118DefaultMacAddress
+ gEmbeddedTokenSpaceGuid.PcdLan9118DefaultNegotiationTimeout
[Depex]
TRUE
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c
index 2ef1ecbb28..c57c7ceff1 100644
--- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c
+++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c
@@ -586,7 +586,7 @@ AutoNegotiate (
// Check that link is up first
if ((PhyStatus & PHYSTS_LINK_STS) == 0) {
// Wait until it is up or until Time Out
- TimeOut = 2000;
+ TimeOut = FixedPcdGet32 (PcdLan9118DefaultNegotiationTimeout) / LAN9118_STALL;
while ((IndirectPHYRead32 (PHY_INDEX_BASIC_STATUS) & PHYSTS_LINK_STS) == 0) {
MemoryFence();
gBS->Stall (LAN9118_STALL);