mirror of https://github.com/acidanthera/audk.git
EmbeddedPkg/Lan9118Dxe: Fix the reset after a receiver or transmitter error
The Lan9118 driver did not recover after a receiver error as the error handling code stopped the transmitter but did not restart it. Added the restart of the transmitter. Added also the restart of the receiver after a transmitter error and the reactivation of the LEDs after all resets. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ronald Cron <ronald.cron@arm.com> Reviewed-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17106 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
88ff5ba793
commit
ac8f1e103d
|
@ -434,6 +434,12 @@ SnpReset (
|
||||||
MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
|
MmioWrite32 (LAN9118_PMT_CTRL, PmConf);
|
||||||
gBS->Stall (LAN9118_STALL);
|
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
|
// Check that a buffer size was specified in SnpInitialize
|
||||||
if (gTxBuffer != 0) {
|
if (gTxBuffer != 0) {
|
||||||
HwConf = MmioRead32 (LAN9118_HW_CFG); // Read the HW register
|
HwConf = MmioRead32 (LAN9118_HW_CFG); // Read the HW register
|
||||||
|
@ -1062,19 +1068,28 @@ SnpGetStatus (
|
||||||
if (Interrupts & INSTS_TXE) {
|
if (Interrupts & INSTS_TXE) {
|
||||||
DEBUG ((EFI_D_ERROR, "LAN9118: Transmitter error. Restarting..."));
|
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);
|
Status = SoftReset (0, Snp);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_ERROR, "\n\tSoft Reset Failed: Hardware Error\n"));
|
DEBUG ((EFI_D_ERROR, "\n\tSoft Reset Failed: Hardware Error\n"));
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Acknowledge the TXE
|
// Reactivate the LEDs
|
||||||
MmioWrite32 (LAN9118_INT_STS, INSTS_TXE);
|
Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
|
||||||
gBS->Stall (LAN9118_STALL);
|
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);
|
StartTx (START_TX_MAC | START_TX_CFG, Snp);
|
||||||
|
if (Snp->Mode->ReceiveFilterSetting != 0) {
|
||||||
|
StartRx (0, Snp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the media status
|
// Update the media status
|
||||||
|
@ -1442,19 +1457,25 @@ SnpReceive (
|
||||||
if (MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {
|
if (MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {
|
||||||
DEBUG ((EFI_D_WARN, "Warning: Receiver Error. Restarting...\n"));
|
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);
|
Status = SoftReset (0, Snp);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
DEBUG ((EFI_D_ERROR, "Error: Soft Reset Failed: Hardware Error.\n"));
|
DEBUG ((EFI_D_ERROR, "Error: Soft Reset Failed: Hardware Error.\n"));
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Acknowledge the RXE
|
// Reactivate the LEDs
|
||||||
MmioWrite32 (LAN9118_INT_STS, INSTS_RXE);
|
Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);
|
||||||
gBS->Stall (LAN9118_STALL);
|
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);
|
StartRx (0, Snp);
|
||||||
|
StartTx (START_TX_MAC | START_TX_CFG, Snp);
|
||||||
|
|
||||||
// Say that command could not be sent
|
// Say that command could not be sent
|
||||||
return EFI_DEVICE_ERROR;
|
return EFI_DEVICE_ERROR;
|
||||||
|
|
Loading…
Reference in New Issue