diff options
-rw-r--r-- | EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c | 55 | ||||
-rw-r--r-- | EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c | 6 | ||||
-rw-r--r-- | EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.h | 2 |
3 files changed, 38 insertions, 25 deletions
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c index 191215f7ca..4146526592 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c @@ -275,7 +275,8 @@ SnpInitialize ( }
// Initiate a PHY reset
- if (PhySoftReset (PHY_RESET_PMT | PHY_RESET_CHECK_LINK, Snp) < 0) {
+ Status = PhySoftReset (PHY_RESET_PMT | PHY_RESET_CHECK_LINK, Snp);
+ if (EFI_ERROR (Status)) {
Snp->Mode->State = EfiSimpleNetworkStopped;
DEBUG ((EFI_D_WARN, "Warning: Link not ready after TimeOut. Check ethernet cable\n"));
return EFI_NOT_STARTED;
@@ -375,9 +376,10 @@ SnpReset ( IN BOOLEAN Verification
)
{
- UINT32 PmConf;
- UINT32 HwConf;
- UINT32 ResetFlags;
+ UINT32 PmConf;
+ UINT32 HwConf;
+ UINT32 ResetFlags;
+ EFI_STATUS Status;
PmConf = 0;
HwConf = 0;
@@ -398,7 +400,8 @@ SnpReset ( }
// Initiate a PHY reset
- if (PhySoftReset (PHY_RESET_PMT | PHY_RESET_CHECK_LINK, Snp) < 0) {
+ Status = PhySoftReset (PHY_RESET_PMT | PHY_RESET_CHECK_LINK, Snp);
+ if (EFI_ERROR (Status)) {
Snp->Mode->State = EfiSimpleNetworkStopped;
return EFI_NOT_STARTED;
}
@@ -410,7 +413,8 @@ SnpReset ( ResetFlags |= SOFT_RESET_SELF_TEST;
}
- if (SoftReset (ResetFlags, Snp) < 0) {
+ Status = SoftReset (ResetFlags, Snp);
+ if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN, "Warning: Soft Reset Failed: Hardware Error\n"));
return EFI_DEVICE_ERROR;
}
@@ -457,6 +461,8 @@ SnpShutdown ( IN EFI_SIMPLE_NETWORK_PROTOCOL* Snp
)
{
+ EFI_STATUS Status;
+
// Check Snp Instance
if (Snp == NULL) {
return EFI_INVALID_PARAMETER;
@@ -472,12 +478,16 @@ SnpShutdown ( }
// Initiate a PHY reset
- PhySoftReset (PHY_RESET_PMT, Snp);
+ Status = PhySoftReset (PHY_RESET_PMT, Snp);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
// Initiate a software reset
- if (SoftReset (0, Snp) < 0) {
+ Status = SoftReset (0, Snp);
+ if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_WARN, "Warning: Soft Reset Failed: Hardware Error\n"));
- return EFI_DEVICE_ERROR;
+ return Status;
}
return EFI_SUCCESS;
@@ -941,7 +951,8 @@ SnpGetStatus ( DEBUG ((EFI_D_ERROR, "LAN9118: Transmitter error. Restarting..."));
// Initiate a software reset
- if (SoftReset (0, Snp) < 0) {
+ Status = SoftReset (0, Snp);
+ if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "\n\tSoft Reset Failed: Hardware Error\n"));
return EFI_DEVICE_ERROR;
}
@@ -1160,18 +1171,19 @@ SnpReceive ( OUT UINT16 *Protocol OPTIONAL
)
{
- LAN9118_DRIVER *LanDriver;
- UINT32 RxFifoStatus;
- UINT32 NumPackets;
- UINT32 RxCfgValue;
- UINT32 PLength; // Packet length
- UINT32 ReadLimit;
- UINT32 Count;
- UINT32 Padding;
- UINT32 *RawData;
+ LAN9118_DRIVER *LanDriver;
+ UINT32 RxFifoStatus;
+ UINT32 NumPackets;
+ UINT32 RxCfgValue;
+ UINT32 PLength; // Packet length
+ UINT32 ReadLimit;
+ UINT32 Count;
+ UINT32 Padding;
+ UINT32 *RawData;
EFI_MAC_ADDRESS Dst;
EFI_MAC_ADDRESS Src;
- UINTN DroppedFrames;
+ UINTN DroppedFrames;
+ EFI_STATUS Status;
LanDriver = INSTANCE_FROM_SNP_THIS (Snp);
@@ -1301,7 +1313,8 @@ SnpReceive ( DEBUG ((EFI_D_WARN, "Warning: Receiver Error. Restarting...\n"));
// Initiate a software reset
- if (SoftReset (0, Snp) < 0) {
+ Status = SoftReset (0, Snp);
+ if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Error: Soft Reset Failed: Hardware Error.\n"));
return EFI_DEVICE_ERROR;
}
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c index d271dcd0dd..a4a660f975 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.c @@ -485,7 +485,7 @@ SoftReset ( // Perform PHY software reset
-INT32
+EFI_STATUS
PhySoftReset (
UINT32 Flags,
EFI_SIMPLE_NETWORK_PROTOCOL *Snp
@@ -524,7 +524,7 @@ PhySoftReset ( // Timed out
if (LinkTo <= 0) {
- return -1;
+ return EFI_TIMEOUT;
}
}
@@ -535,7 +535,7 @@ PhySoftReset ( MmioWrite32 (LAN9118_INT_STS, 0xFFFFFFFF);
}
- return 0;
+ return EFI_SUCCESS;
}
diff --git a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.h b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.h index e75bbad3c0..5bc4501c1a 100644 --- a/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.h +++ b/EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118DxeUtil.h @@ -119,7 +119,7 @@ SoftReset ( #define PHY_SOFT_RESET_CLEAR_INT BIT3
// Perform PHY software reset
-INT32
+EFI_STATUS
PhySoftReset (
UINT32 Flags,
EFI_SIMPLE_NETWORK_PROTOCOL *Snp
|