mirror of https://github.com/acidanthera/audk.git
EmbeddedPkg/Lan9118Dxe: Handle EFI_STATUS from PhySoftReset() & SoftReset()
- Make the function PhySoftReset() return EFI_STATUS - EFI_STATUS was treated as a signed integer by the caller which is not correct. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15630 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
42de09370f
commit
42589b9ac9
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue