summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Bus
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Bus')
-rw-r--r--EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c165
1 files changed, 52 insertions, 113 deletions
diff --git a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
index 006cc73bcb..88c4c3aec8 100644
--- a/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
+++ b/EdkModulePkg/Bus/Scsi/ScsiDisk/Dxe/ScsiDisk.c
@@ -874,43 +874,34 @@ Returns:
&InquiryDataLength,
FALSE
);
- switch (Status) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- case EFI_SUCCESS:
- case EFI_WARN_BUFFER_TOO_SMALL:
+ if ((Status == EFI_SUCCESS) || (Status == EFI_WARN_BUFFER_TOO_SMALL)) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
ParseInquiryData (ScsiDiskDevice);
return EFI_SUCCESS;
-
- case EFI_NOT_READY:
+ } else if (Status == EFI_NOT_READY) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_INVALID_PARAMETER:
- case EFI_UNSUPPORTED:
+ } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
-
+ }
//
// go ahead to check HostAdapterStatus and TargetStatus
// (EFI_TIMEOUT, EFI_DEVICE_ERROR)
//
- default:
- break;
- }
-
Status = CheckHostAdapterStatus (HostAdapterStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_TIMEOUT:
- case EFI_NOT_READY:
+ if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
//
// reset the scsi channel
//
@@ -920,19 +911,14 @@ Returns:
}
Status = CheckTargetStatus (TargetStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_NOT_READY:
+ if (Status == EFI_NOT_READY) {
//
// reset the scsi device
//
ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
}
@@ -1022,37 +1008,27 @@ ScsiDiskTestUnitReady (
&HostAdapterStatus,
&TargetStatus
);
- switch (Status) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- case EFI_NOT_READY:
+ if (Status == EFI_NOT_READY) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_INVALID_PARAMETER:
- case EFI_UNSUPPORTED:
+ } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
-
+ }
//
// go ahead to check HostAdapterStatus and TargetStatus
//
- default:
- break;
- }
-
Status = CheckHostAdapterStatus (HostAdapterStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_TIMEOUT:
- case EFI_NOT_READY:
+ if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
//
// reset the scsi channel
//
@@ -1062,19 +1038,14 @@ ScsiDiskTestUnitReady (
}
Status = CheckTargetStatus (TargetStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_NOT_READY:
+ if (Status == EFI_NOT_READY) {
//
// reset the scsi device
//
ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
}
@@ -1258,42 +1229,35 @@ Returns:
&DataLength,
FALSE
);
- switch (CommandStatus) {
- //
- // no need to check HostAdapterStatus and TargetStatus
- //
- case EFI_SUCCESS:
+ if (CommandStatus == EFI_SUCCESS) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
GetMediaInfo (ScsiDiskDevice, &CapacityData);
return EFI_SUCCESS;
-
- case EFI_NOT_READY:
+ } else if (CommandStatus == EFI_NOT_READY) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_INVALID_PARAMETER:
- case EFI_UNSUPPORTED:
+ } else if ((CommandStatus == EFI_INVALID_PARAMETER) || (CommandStatus == EFI_UNSUPPORTED)) {
+ //
+ // no need to check HostAdapterStatus and TargetStatus
+ //
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
-
+ }
//
// go ahead to check HostAdapterStatus and TargetStatus
// (EFI_TIMEOUT, EFI_DEVICE_ERROR, EFI_WARN_BUFFER_TOO_SMALL)
//
- default:
- break;
- }
-
+
Status = CheckHostAdapterStatus (HostAdapterStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_TIMEOUT:
- case EFI_NOT_READY:
+ if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
//
// reset the scsi channel
//
@@ -1303,19 +1267,14 @@ Returns:
}
Status = CheckTargetStatus (TargetStatus);
- switch (Status) {
- case EFI_SUCCESS:
- break;
-
- case EFI_NOT_READY:
+ if (Status == EFI_NOT_READY) {
//
// reset the scsi device
//
ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
*NeedRetry = TRUE;
return EFI_DEVICE_ERROR;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
*NeedRetry = FALSE;
return EFI_DEVICE_ERROR;
}
@@ -1506,40 +1465,20 @@ ScsiDiskRequestSenseKeys (
&HostAdapterStatus,
&TargetStatus
);
- switch (Status) {
-
- case EFI_SUCCESS:
-
- //
- // fall through
- //
- case EFI_WARN_BUFFER_TOO_SMALL:
+ if ((Status == EFI_SUCCESS) || (Status == EFI_WARN_BUFFER_TOO_SMALL)) {
FallStatus = EFI_SUCCESS;
- break;
-
- case EFI_TIMEOUT:
-
- //
- // fall through
- //
- case EFI_NOT_READY:
+ } else if ((Status == EFI_TIMEOUT) || (Status == EFI_NOT_READY)) {
*NeedRetry = TRUE;
FallStatus = EFI_DEVICE_ERROR;
- break;
-
- case EFI_INVALID_PARAMETER:
- case EFI_UNSUPPORTED:
+ } else if ((Status == EFI_INVALID_PARAMETER) || (Status == EFI_UNSUPPORTED)) {
*NeedRetry = FALSE;
FallStatus = EFI_DEVICE_ERROR;
- break;
-
- case EFI_DEVICE_ERROR:
+ } else if (Status == EFI_DEVICE_ERROR) {
if (AskResetIfError) {
ScsiDiskDevice->ScsiIo->ResetDevice (ScsiDiskDevice->ScsiIo);
}
FallStatus = EFI_DEVICE_ERROR;
- break;
}
if (EFI_ERROR (FallStatus)) {