From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web10.8828.1666108502999273708 for ; Tue, 18 Oct 2022 08:55:03 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=n8tDWALG; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: mateusz.albecki@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666108503; x=1697644503; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OZKzYvB/s3wumQpNk74hZayFAIpovzpOkMnwExHz87M=; b=n8tDWALGrJT92GD9aYX7uVHwjSQZiO7Aa7ZAKAfoiHY8I+p4004wbFD+ DHJJwubsiIHI6CKOYZeggoNNdFO925Co3PIArDAFaFDJhsjVI63ozsoAo Iucx7rXYP5jGqAtMtIOd6yl49bCta/+pO3OI4agngdc1Mwz1x5K7lbxkD iuHKMazZPOznxDUNhaLvhbhGocCAW2mheuwSqEhfsFKPxG/rNbvcAs0IA KzyEPLd/6paxUMzH0kxH4JwKOFOzebzkjiy+TEelfVV6rZNuGxDIyTTFP 9KWZalqygeRjiPUry9g64X2Lib5ktDe7KbQvKb2MEN7K3r6lAz6RDePlZ Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="286540358" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="286540358" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 08:54:57 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="606607077" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="606607077" Received: from malbecki-mobl.ger.corp.intel.com ([10.252.43.77]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 08:54:55 -0700 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Hao A Wu , Ray Ni Subject: [PATCH 1/1] MdeModulePkg/Ata: Fix command status reporting Date: Tue, 18 Oct 2022 17:54:19 +0200 Message-Id: <20221018155419.2808-2-mateusz.albecki@intel.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20221018155419.2808-1-mateusz.albecki@intel.com> References: <20221018155419.2808-1-mateusz.albecki@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4016 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 Cc: Ray Ni Signed-off-by: Mateusz Albecki --- .../Bus/Ata/AtaAtapiPassThru/AhciMode.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.c b/MdeModulePk= g/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 =3D EfiPciIoOperationBusMasterWrite; @@ -1026,8 +1027,8 @@ AhciPioTransfer ( = if (Status =3D=3D EFI_DEVICE_ERROR) { DEBUG ((DEBUG_ERROR, "PIO command failed at retry %d\n", Retry)); - Status =3D AhciRecoverPortError (PciIo, Port); - if (EFI_ERROR (Status)) { + RecoveryStatus =3D 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 =3D NULL; PciIo =3D Instance->PciIo; @@ -1220,8 +1222,8 @@ AhciDmaTransfer ( Status =3D AhciWaitUntilFisReceived (PciIo, Port, Timeout, SataFisD2= H); if (Status =3D=3D EFI_DEVICE_ERROR) { DEBUG ((DEBUG_ERROR, "DMA command failed at retry: %d\n", Retry)); - Status =3D AhciRecoverPortError (PciIo, Port); - if (EFI_ERROR (Status)) { + RecoveryStatus =3D AhciRecoverPortError (PciIo, Port); + if (EFI_ERROR (RecoveryStatus)) { break; } } else { @@ -1261,14 +1263,14 @@ AhciDmaTransfer ( Status =3D AhciCheckFisReceived (PciIo, Port, SataFisD2H); if (Status =3D=3D EFI_DEVICE_ERROR) { DEBUG ((DEBUG_ERROR, "DMA command failed at retry: %d\n", Task->Re= tryTimes)); - Status =3D AhciRecoverPortError (PciIo, Port); + RecoveryStatus =3D 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 fun= ction again // and on next call the command will be re-issued due to IsStart b= eing FALSE. // This also makes the next condition decrement the RetryTimes. // - if (Status =3D=3D EFI_SUCCESS) { + if (RecoveryStatus =3D=3D EFI_SUCCESS) { Task->IsStart =3D FALSE; Status =3D 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 =3D AhciWaitUntilFisReceived (PciIo, Port, Timeout, SataFisD2H); if (Status =3D=3D EFI_DEVICE_ERROR) { DEBUG ((DEBUG_ERROR, "Non data transfer failed at retry %d\n", Retry= )); - Status =3D AhciRecoverPortError (PciIo, Port); - if (EFI_ERROR (Status)) { + RecoveryStatus =3D AhciRecoverPortError (PciIo, Port); + if (EFI_ERROR (RecoveryStatus)) { break; } } else { -- = 2.28.0.windows.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydz= ial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-31= 6 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu usta= wy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w trans= akcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata= i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wi= adomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiek= olwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the s= ole use of the intended recipient(s). If you are not the intended recipient= , please contact the sender and delete all copies; any review or distributi= on by others is strictly prohibited.