summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
index 0503dbce1e..3b7882d5d7 100644
--- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
+++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
@@ -434,6 +434,12 @@ SnpReset (
MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
// Check that a buffer size was specified in SnpInitialize
if (gTxBuffer != 0) {
HwConf = MmioRead32 (LAN9118_HW_CFG); // Read the HW register
@@ -1062,19 +1068,28 @@ SnpGetStatus (
if (Interrupts & INSTS_TXE) {
DEBUG ((EFI_D_ERROR, "LAN9118: Transmitter error. Restarting..."));
- // Initiate a software reset
+ // Software reset, the TXE interrupt is cleared by the reset.
Status = SoftReset (0, Snp);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "\n\tSoft Reset Failed: Hardware Error\n"));
return EFI_DEVICE_ERROR;
}
- // Acknowledge the TXE
- MmioWrite32 (LAN9118_INT_STS, INSTS_TXE);
- gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- // Restart the transmitter
+ //
+ // Restart the transmitter and if necessary the receiver.
+ // Do not ask for FIFO reset as it has already been done
+ // by SoftReset().
+ //
StartTx (START_TX_MAC | START_TX_CFG, Snp);
+ if (Snp->Mode->ReceiveFilterSetting != 0) {
+ StartRx (0, Snp);
+ }
}
// Update the media status
@@ -1442,19 +1457,25 @@ SnpReceive (
if (MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {
DEBUG ((EFI_D_WARN, "Warning: Receiver Error. Restarting...\n"));
- // Initiate a software reset
+ // Software reset, the RXE interrupt is cleared by the reset.
Status = SoftReset (0, Snp);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Error: Soft Reset Failed: Hardware Error.\n"));
return EFI_DEVICE_ERROR;
}
- // Acknowledge the RXE
- MmioWrite32 (LAN9118_INT_STS, INSTS_RXE);
- gBS->Stall (LAN9118_STALL);
+ // Reactivate the LEDs
+ Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
- // Restart the rx (and do not clear FIFO)
+ //
+ // Restart the receiver and the transmitter without reseting the FIFOs
+ // as it has been done by SoftReset().
+ //
StartRx (0, Snp);
+ StartTx (START_TX_MAC | START_TX_CFG, Snp);
// Say that command could not be sent
return EFI_DEVICE_ERROR;