summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorAlbecki, Mateusz <mateusz.albecki@intel.com>2022-10-18 23:54:19 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-12 01:53:49 +0000
commita6542894391bae58b7704b2624b541a2b8b9ed93 (patch)
treeb5e78625519609b12696b7cf29386621da334575 /MdeModulePkg
parent4cb94f20b002c99dd2b4b75f07c5495b81a34ffd (diff)
downloadedk2-a6542894391bae58b7704b2624b541a2b8b9ed93.tar.gz
edk2-a6542894391bae58b7704b2624b541a2b8b9ed93.tar.bz2
edk2-a6542894391bae58b7704b2624b541a2b8b9ed93.zip
MdeModulePkg/Ata: Fix command status reporting
Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=4016 AtaAtapiPassThru driver was reporting recovery status on failed command packets which led to incorrect flows in upper layers and to SCT tests fails. This commit will change the logic to report command status. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
index a240be940d..06c4a3e052 100644
--- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
+++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c
@@ -949,6 +949,7 @@ AhciPioTransfer (
EFI_AHCI_COMMAND_LIST CmdList;
UINT32 PrdCount;
UINT32 Retry;
+ EFI_STATUS RecoveryStatus;
if (Read) {
Flag = EfiPciIoOperationBusMasterWrite;
@@ -1026,8 +1027,8 @@ AhciPioTransfer (
if (Status == EFI_DEVICE_ERROR) {
DEBUG ((DEBUG_ERROR, "PIO command failed at retry %d\n", Retry));
- Status = AhciRecoverPortError (PciIo, Port);
- if (EFI_ERROR (Status)) {
+ RecoveryStatus = AhciRecoverPortError (PciIo, Port);
+ if (EFI_ERROR (RecoveryStatus)) {
break;
}
} else {
@@ -1122,6 +1123,7 @@ AhciDmaTransfer (
EFI_PCI_IO_PROTOCOL *PciIo;
EFI_TPL OldTpl;
UINT32 Retry;
+ EFI_STATUS RecoveryStatus;
Map = NULL;
PciIo = Instance->PciIo;
@@ -1220,8 +1222,8 @@ AhciDmaTransfer (
Status = AhciWaitUntilFisReceived (PciIo, Port, Timeout, SataFisD2H);
if (Status == EFI_DEVICE_ERROR) {
DEBUG ((DEBUG_ERROR, "DMA command failed at retry: %d\n", Retry));
- Status = AhciRecoverPortError (PciIo, Port);
- if (EFI_ERROR (Status)) {
+ RecoveryStatus = AhciRecoverPortError (PciIo, Port);
+ if (EFI_ERROR (RecoveryStatus)) {
break;
}
} else {
@@ -1261,14 +1263,14 @@ AhciDmaTransfer (
Status = AhciCheckFisReceived (PciIo, Port, SataFisD2H);
if (Status == EFI_DEVICE_ERROR) {
DEBUG ((DEBUG_ERROR, "DMA command failed at retry: %d\n", Task->RetryTimes));
- Status = AhciRecoverPortError (PciIo, Port);
+ RecoveryStatus = AhciRecoverPortError (PciIo, Port);
//
// If recovery passed mark the Task as not started and change the status
// to EFI_NOT_READY. This will make the higher level call this function again
// and on next call the command will be re-issued due to IsStart being FALSE.
// This also makes the next condition decrement the RetryTimes.
//
- if (Status == EFI_SUCCESS) {
+ if (RecoveryStatus == EFI_SUCCESS) {
Task->IsStart = FALSE;
Status = EFI_NOT_READY;
}
@@ -1375,6 +1377,7 @@ AhciNonDataTransfer (
EFI_AHCI_COMMAND_FIS CFis;
EFI_AHCI_COMMAND_LIST CmdList;
UINT32 Retry;
+ EFI_STATUS RecoveryStatus;
//
// Package read needed
@@ -1415,8 +1418,8 @@ AhciNonDataTransfer (
Status = AhciWaitUntilFisReceived (PciIo, Port, Timeout, SataFisD2H);
if (Status == EFI_DEVICE_ERROR) {
DEBUG ((DEBUG_ERROR, "Non data transfer failed at retry %d\n", Retry));
- Status = AhciRecoverPortError (PciIo, Port);
- if (EFI_ERROR (Status)) {
+ RecoveryStatus = AhciRecoverPortError (PciIo, Port);
+ if (EFI_ERROR (RecoveryStatus)) {
break;
}
} else {