From nobody Fri Mar 29 01:35:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52982+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52982+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1578395209; cv=none; d=zohomail.com; s=zohoarc; b=JfS3+mpsmBX+nZzLKEg3Ti6e2y7Nt7lk6u9+UQrFjqJqmjv5T2AYrCHxGxDnVYLtFMd4UTJ9iKuf2QrHxGCIkhL3WW2/zVcQhULrOiOdtRQ/iV9cgAZbkP0r4MHGt7DzzO83uqkjtctzD8wCuy9P+gTcGhDTC1pjQyljNoYiJAY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578395209; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=FJqqDrAn7Q0Ph10ILb8vbtlnAvuXdiuk4poBvEyXWxc=; b=NvTw1iooYlIWeHhUT3VS9zw37Yb3bOY00az4QYcCLe/4locHeMuSWJgvt2euCC+aRD3YegEeeAOLxUgfSdUFdxeE/HkRPkNdlPEgQsfLgcSYROdeZSXFCPrwslEAFrRB4dMkTGEOfbTn+bu8q1fpg4Ts7LsZ4+rAdiw9vhQlxGY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52982+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578395209756400.3235641801101; Tue, 7 Jan 2020 03:06:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zPyGYY1788612xoeW85BjU2B; Tue, 07 Jan 2020 03:06:49 -0800 X-Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.4171.1578395207142852474 for ; Tue, 07 Jan 2020 03:06:47 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 03:06:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,405,1571727600"; d="scan'208";a="422445531" X-Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by fmsmga006.fm.intel.com with ESMTP; 07 Jan 2020 03:06:44 -0800 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Hao A Wu , Marcin Wojtas , Zhichao Gao , Liming Gao Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/SdMmcPciHcDxe: Refactor command error detection Date: Tue, 7 Jan 2020 12:06:19 +0100 Message-Id: <20200107110621.232-2-mateusz.albecki@intel.com> In-Reply-To: <20200107110621.232-1-mateusz.albecki@intel.com> References: <20200107110621.232-1-mateusz.albecki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mateusz.albecki@intel.com X-Gm-Message-State: VWOM5UgsBIir6D6dusgCQ6I6x1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578395209; bh=QS0aHGUrvdkalHZR/BC3GKDUnVqu5/Fv4uQZVcIkkGY=; h=Cc:Date:From:Reply-To:Subject:To; b=jCFF2D7mXYEubAVevXNxicldPI8XCC15zzQjTcO6ixRAHkG37KMj112mspA8sWW2yix 3ZrPbpkzM/FrHuNwGaFEVYOAkhwDxKv4KuKtPd7w1fz8gbWOnm6csQN/t5BhFV7dMqzLi DLVH+ZF1XQ/49G2VMfur46GhYdUl4Koxruw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1140 Error detection function will now check if the command failure has been caused by one of the errors that can appear randomly on link(CRC error + end bit error). If such an error has been a cause of failure function will return EFI_CRC_ERROR instead of EFI_DEVICE_ERROR to indicate to the higher level that command has a chance of succeeding if resent. In addition this patch also fixes 2 small bugs. First one is DAT lane being reset on current limit error. Second one is data timeout error not being cleared after transfer has been completed. Cc: Hao A Wu Cc: Marcin Wojtas Cc: Zhichao Gao Cc: Liming Gao Signed-off-by: Mateusz Albecki --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 234 +++++++++++++++----= ---- 1 file changed, 158 insertions(+), 76 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePk= g/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c index e7f2fac69b..8b5e54f321 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c @@ -7,7 +7,7 @@ It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use. =20 Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. - Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -2137,6 +2137,154 @@ SdMmcExecTrb ( return Status; } =20 +/** + Performs SW reset based on passed error status mask. + + @param[in] Private Pointer to driver private data. + @param[in] Slot Index of the slot to reset. + @param[in] ErrIntStatus Error interrupt status mask. + + @retval EFI_SUCCESS Software reset performed successfully. + @retval Other Software reset failed. +**/ +EFI_STATUS +SdMmcSoftwareReset ( + IN SD_MMC_HC_PRIVATE_DATA *Private, + IN UINT8 Slot, + IN UINT16 ErrIntStatus + ) +{ + UINT8 SwReset; + EFI_STATUS Status; + + SwReset =3D 0; + if ((ErrIntStatus & 0x0F) !=3D 0) { + SwReset |=3D BIT1; + } + if ((ErrIntStatus & 0x70) !=3D 0) { + SwReset |=3D BIT2; + } + + Status =3D SdMmcHcRwMmio ( + Private->PciIo, + Slot, + SD_MMC_HC_SW_RST, + FALSE, + sizeof (SwReset), + &SwReset + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D SdMmcHcWaitMmioSet ( + Private->PciIo, + Slot, + SD_MMC_HC_SW_RST, + sizeof (SwReset), + 0xFF, + 0, + SD_MMC_HC_GENERIC_TIMEOUT + ); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} + +/** + Checks the error status in error status register + and issues appropriate software reset as described in + SD specification section 3.10. + + @param[in] Private Pointer to driver private data. + @param[in] Trb Pointer to currently executing TRB. + + @retval EFI_CRC_ERROR CRC error happened during CMD execution. + @retval EFI_SUCCESS No error reported. + @retval Others Some other error happened. + +**/ +EFI_STATUS +SdMmcCheckAndRecoverErrors ( + IN SD_MMC_HC_PRIVATE_DATA *Private, + IN UINT8 Slot + ) +{ + UINT16 IntStatus; + UINT16 ErrIntStatus; + UINT16 ErrIntStatusOr; + EFI_STATUS Status; + EFI_STATUS ErrorStatus; + + Status =3D SdMmcHcRwMmio ( + Private->PciIo, + Slot, + SD_MMC_HC_NOR_INT_STS, + TRUE, + sizeof (IntStatus), + &IntStatus + ); + if (EFI_ERROR (Status)) { + return Status; + } + + if ((IntStatus & BIT15) =3D=3D 0) { + return EFI_SUCCESS; + } + + Status =3D SdMmcHcRwMmio ( + Private->PciIo, + Slot, + SD_MMC_HC_ERR_INT_STS, + TRUE, + sizeof (ErrIntStatus), + &ErrIntStatus + ); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // We treat both CMD and DAT CRC errors and + // end bits errors as EFI_CRC_ERROR. This will + // let higher layer know that the error possibly + // happened due to random bus condition and the + // command can be retried. + // + if (ErrIntStatus & (BIT1 | BIT2 | BIT5 | BIT6)) { + ErrorStatus =3D EFI_CRC_ERROR; + } else if ((ErrIntStatus & BIT4) && (IntStatus & BIT1)){ + // + // If the data timeout error is reported + // but data transfer is signaled as completed we + // have to ignore data timeout. + // + ErrorStatus =3D EFI_SUCCESS; + ErrIntStatusOr =3D BIT4; + Status =3D SdMmcHcOrMmio ( + Private->PciIo, + Slot, + SD_MMC_HC_ERR_INT_STS, + sizeof (ErrIntStatus), + &ErrIntStatusOr + ); + if (EFI_ERROR (Status)) { + return Status; + } + } else { + ErrorStatus =3D EFI_DEVICE_ERROR; + } + + Status =3D SdMmcSoftwareReset (Private, Slot, ErrIntStatus); + if (EFI_ERROR (Status)) { + return Status; + } + + return ErrorStatus; +} + /** Check the TRB execution result. =20 @@ -2160,10 +2308,8 @@ SdMmcCheckTrbResult ( UINT32 Response[4]; UINT64 SdmaAddr; UINT8 Index; - UINT8 SwReset; UINT32 PioLength; =20 - SwReset =3D 0; Packet =3D Trb->Packet; // // Check Trb execution result by reading Normal Interrupt Status registe= r. @@ -2179,87 +2325,23 @@ SdMmcCheckTrbResult ( if (EFI_ERROR (Status)) { goto Done; } + // - // Check Transfer Complete bit is set or not. + // Check if there are any errors reported by host controller + // and if neccessary recover the controller before next command is execu= ted. // - if ((IntStatus & BIT1) =3D=3D BIT1) { - if ((IntStatus & BIT15) =3D=3D BIT15) { - // - // Read Error Interrupt Status register to check if the error is - // Data Timeout Error. - // If yes, treat it as success as Transfer Complete has higher - // priority than Data Timeout Error. - // - Status =3D SdMmcHcRwMmio ( - Private->PciIo, - Trb->Slot, - SD_MMC_HC_ERR_INT_STS, - TRUE, - sizeof (IntStatus), - &IntStatus - ); - if (!EFI_ERROR (Status)) { - if ((IntStatus & BIT4) =3D=3D BIT4) { - Status =3D EFI_SUCCESS; - } else { - Status =3D EFI_DEVICE_ERROR; - } - } - } - + Status =3D SdMmcCheckAndRecoverErrors (Private, Trb->Slot); + if (EFI_ERROR (Status)) { goto Done; } + // - // Check if there is a error happened during cmd execution. - // If yes, then do error recovery procedure to follow SD Host Controller - // Simplified Spec 3.0 section 3.10.1. + // Check Transfer Complete bit is set or not. // - if ((IntStatus & BIT15) =3D=3D BIT15) { - Status =3D SdMmcHcRwMmio ( - Private->PciIo, - Trb->Slot, - SD_MMC_HC_ERR_INT_STS, - TRUE, - sizeof (IntStatus), - &IntStatus - ); - if (EFI_ERROR (Status)) { - goto Done; - } - if ((IntStatus & 0x0F) !=3D 0) { - SwReset |=3D BIT1; - } - if ((IntStatus & 0xF0) !=3D 0) { - SwReset |=3D BIT2; - } - - Status =3D SdMmcHcRwMmio ( - Private->PciIo, - Trb->Slot, - SD_MMC_HC_SW_RST, - FALSE, - sizeof (SwReset), - &SwReset - ); - if (EFI_ERROR (Status)) { - goto Done; - } - Status =3D SdMmcHcWaitMmioSet ( - Private->PciIo, - Trb->Slot, - SD_MMC_HC_SW_RST, - sizeof (SwReset), - 0xFF, - 0, - SD_MMC_HC_GENERIC_TIMEOUT - ); - if (EFI_ERROR (Status)) { - goto Done; - } - - Status =3D EFI_DEVICE_ERROR; + if ((IntStatus & BIT1) =3D=3D BIT1) { goto Done; } + // // Check if DMA interrupt is signalled for the SDMA transfer. // --=20 2.14.1.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. 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. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52982): https://edk2.groups.io/g/devel/message/52982 Mute This Topic: https://groups.io/mt/69499845/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 01:35:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52983+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52983+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1578395215; cv=none; d=zohomail.com; s=zohoarc; b=CSEJUao8n8X4LAxz6JcrCpExzu2OWm1/nJ7CHUiYDf03Br6TlzRhDmnpOHCJLehPGgGnO/At+Ye3FmTJ+JG4r3GJUN4baEVRjlNm/UtUFnFii7XK9AgEtjw5SkM21ZNnaHWHNg1jlUpzfHRFyQ15qV3poIpk/CHl7DvMH6bydwY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578395215; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=mLkY9RSKtjydg5z6u6WOgOIOjv/DwSgtKJzsCaSZDfw=; b=mxndtvEkc/CGGg4RqIoLi2iX8tXx9+SXtWK2joRqAzDIg4LduPIKO6SEsS6DYTNqguKgp55uUyFuB9gc+no5871m1Ic+x+XF3nUB4YDqc136n0sucs47P8pWbMdLoE/oPGORiIbwFp/QGCp5wlCsj6BjD1jiGCXRzzPzbUmLMDg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52983+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1578395215008320.5411488685611; Tue, 7 Jan 2020 03:06:55 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id kHMxYY1788612x04mGxDRUZt; Tue, 07 Jan 2020 03:06:54 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.4174.1578395213718605702 for ; Tue, 07 Jan 2020 03:06:53 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 03:06:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,405,1571727600"; d="scan'208";a="422445552" X-Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by fmsmga006.fm.intel.com with ESMTP; 07 Jan 2020 03:06:51 -0800 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Hao A Wu , Marcin Wojtas , Zhichao Gao , Liming Gao Subject: [edk2-devel] [PATCH 2/3] MdeModulePkg/SdMmcPciHcDxe: Add retries for sync commands Date: Tue, 7 Jan 2020 12:06:20 +0100 Message-Id: <20200107110621.232-3-mateusz.albecki@intel.com> In-Reply-To: <20200107110621.232-1-mateusz.albecki@intel.com> References: <20200107110621.232-1-mateusz.albecki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mateusz.albecki@intel.com X-Gm-Message-State: 8w3X0gTTchbp5AS8rKcAJCbAx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578395214; bh=QJ4bLVJk5eu54v1PpFoJh/Jkn4BCMNPi9TdK8r6nTtE=; h=Cc:Date:From:Reply-To:Subject:To; b=s3PCw1enZT6nPUWz4hbQkRAk3n3aLqecpeIspzbcw0PzMJHq4kUhnmgvRK9MjGPL/CC KqFAieXUjsydpde0q9iJtPbpSCL7Cg4hRdT3p+ww1NKvba6+FlpACz+2STVDDDKDuOWwf W+l0q0RM0ThycoEGQrI0a9Bfsm5taANaiso= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1140 To increase the resiliency driver will now attempt to retry the commands that failed due to the CRC error up to 5 times. This should address the problems with the commands that fail due to random condition on links. This should also help the boards on which CMD13 is particularly unstable after switching the link frequency. Cc: Hao A Wu Cc: Marcin Wojtas Cc: Zhichao Gao Cc: Liming Gao Signed-off-by: Mateusz Albecki Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 83 ++++++++++++++----= ---- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 5 +- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c | 1 + 3 files changed, 59 insertions(+), 30 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModule= Pkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 373f1bed45..193b0f24e2 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -7,7 +7,7 @@ It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use. =20 Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. - Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.
+ Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -974,6 +974,58 @@ SdMmcPciHcDriverBindingStop ( return Status; } =20 +/** + Execute TRB synchronously. + + @param[in] Private Pointer to driver private data. + @param[in] Trb Pointer to TRB to execute. + + @retval EFI_SUCCESS TRB executed successfully. + @retval Other TRB failed. +**/ +EFI_STATUS +SdMmcPassThruExecSyncTrb ( + IN SD_MMC_HC_PRIVATE_DATA *Private, + IN SD_MMC_HC_TRB *Trb + ) +{ + EFI_STATUS Status; + EFI_TPL OldTpl; + + // + // Wait async I/O list is empty before execute sync I/O operation. + // + while (TRUE) { + OldTpl =3D gBS->RaiseTPL (TPL_NOTIFY); + if (IsListEmpty (&Private->Queue)) { + gBS->RestoreTPL (OldTpl); + break; + } + gBS->RestoreTPL (OldTpl); + } + + while (Trb->Retries) { + Status =3D SdMmcWaitTrbEnv (Private, Trb); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D SdMmcExecTrb (Private, Trb); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D SdMmcWaitTrbResult (Private, Trb); + if (Status =3D=3D EFI_CRC_ERROR) { + Trb->Retries--; + } else { + return Status; + } + } + + return Status; +} + /** Sends SD command to an SD card that is attached to the SD controller. =20 @@ -1023,7 +1075,6 @@ SdMmcPassThruPassThru ( EFI_STATUS Status; SD_MMC_HC_PRIVATE_DATA *Private; SD_MMC_HC_TRB *Trb; - EFI_TPL OldTpl; =20 if ((This =3D=3D NULL) || (Packet =3D=3D NULL)) { return EFI_INVALID_PARAMETER; @@ -1066,34 +1117,8 @@ SdMmcPassThruPassThru ( return EFI_SUCCESS; } =20 - // - // Wait async I/O list is empty before execute sync I/O operation. - // - while (TRUE) { - OldTpl =3D gBS->RaiseTPL (TPL_NOTIFY); - if (IsListEmpty (&Private->Queue)) { - gBS->RestoreTPL (OldTpl); - break; - } - gBS->RestoreTPL (OldTpl); - } - - Status =3D SdMmcWaitTrbEnv (Private, Trb); - if (EFI_ERROR (Status)) { - goto Done; - } - - Status =3D SdMmcExecTrb (Private, Trb); - if (EFI_ERROR (Status)) { - goto Done; - } + Status =3D SdMmcPassThruExecSyncTrb (Private, Trb); =20 - Status =3D SdMmcWaitTrbResult (Private, Trb); - if (EFI_ERROR (Status)) { - goto Done; - } - -Done: SdMmcFreeTrb (Trb); =20 return Status; diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h b/MdeModule= Pkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h index 0304960132..5bc3577ba2 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h @@ -3,7 +3,7 @@ Provides some data structure definitions used by the SD/MMC host control= ler driver. =20 Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. -Copyright (c) 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -130,6 +130,8 @@ typedef struct { =20 #define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T') =20 +#define SD_MMC_TRB_RETRIES 5 + // // TRB (Transfer Request Block) contains information for the cmd request. // @@ -152,6 +154,7 @@ typedef struct { EFI_EVENT Event; BOOLEAN Started; UINT64 Timeout; + UINT32 Retries; =20 SD_MMC_HC_ADMA_32_DESC_LINE *Adma32Desc; SD_MMC_HC_ADMA_64_V3_DESC_LINE *Adma64V3Desc; diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c b/MdeModulePk= g/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c index 8b5e54f321..676ace847b 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c @@ -1683,6 +1683,7 @@ SdMmcCreateTrb ( Trb->Event =3D Event; Trb->Started =3D FALSE; Trb->Timeout =3D Packet->Timeout; + Trb->Retries =3D SD_MMC_TRB_RETRIES; Trb->Private =3D Private; =20 if ((Packet->InTransferLength !=3D 0) && (Packet->InDataBuffer !=3D NULL= )) { --=20 2.14.1.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. 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. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52983): https://edk2.groups.io/g/devel/message/52983 Mute This Topic: https://groups.io/mt/69499848/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Mar 29 01:35:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+52984+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52984+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1578395221; cv=none; d=zohomail.com; s=zohoarc; b=AeI8nGgC5T7eVAiUp33wfrAiK+NrblkvSOjW9b1v3WvPKwLeRjy2aIyx6ETESbMaWT5VRfTsgBMsF7Hn5JD9aTsjGadr+6DarWQ1kSStuF2DcBdcb/r5SEd5Vtkf0tX87yWbIuIVeENT3VW42jWlmHD4awvyciSB493hRzbG4/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578395221; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=t4VfGhxjtpsupFsObPdp1gIhOTuPODPuJqqQkIb4Q6E=; b=nxft+hTc54ATkyapjQibcXQTmnE2LAhrvEl87+Bz/tWG4E+qYmtA9UrqEqxwCWIVm9aPI5mM0RLsHIcCxEBPYTru0/64HoFmcRkGykIW7Ynki1+sElfMq/1H6iG5cmrQUHol3K3kus2vDXZCrux5iMvCwWwYEqf+c5XKHQNrH5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+52984+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 157839522126625.43253373827497; Tue, 7 Jan 2020 03:07:01 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id xA7aYY1788612x6mtwMHKSYY; Tue, 07 Jan 2020 03:07:00 -0800 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.4281.1578395220350157535 for ; Tue, 07 Jan 2020 03:07:00 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 03:06:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,405,1571727600"; d="scan'208";a="422445566" X-Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by fmsmga006.fm.intel.com with ESMTP; 07 Jan 2020 03:06:57 -0800 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Hao A Wu , Marcin Wojtas , Zhichao Gao , Liming Gao Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/SdMmcPciHcDxe: Add retries for async commands Date: Tue, 7 Jan 2020 12:06:21 +0100 Message-Id: <20200107110621.232-4-mateusz.albecki@intel.com> In-Reply-To: <20200107110621.232-1-mateusz.albecki@intel.com> References: <20200107110621.232-1-mateusz.albecki@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mateusz.albecki@intel.com X-Gm-Message-State: VGlgnqAnqpgMKEFz1ho3jArtx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1578395220; bh=iJymTRgM8jNy6+veHCEINKNq3wo5VgmeLmWcIsiu+j4=; h=Cc:Date:From:Reply-To:Subject:To; b=CfcwA/xC4ls6I2HkM64moMMNyXjkXbf9KYuFh+KTApYuzKdK5/vfmGZKTfdZYp+YrYk JMRSRhjPKN1xkAgoJW+JjJTObTHNHQ1uO5/2D8EpoKNka8PBw2ul/PA+7iqVcvW0zUq/G zLe3++QXunRc7qMJ57vnkVHfJmlH1uUVfQI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This patch adds retries for async execution for commands that failed due to the CRC errors. Cc: Hao A Wu Cc: Marcin Wojtas Cc: Zhichao Gao Cc: Liming Gao Signed-off-by: Mateusz Albecki Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModule= Pkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c index 193b0f24e2..b18ff3e972 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c @@ -211,8 +211,10 @@ Done: gBS->SignalEvent (TrbEvent); return; } - } - if ((Trb !=3D NULL) && (Status !=3D EFI_NOT_READY)) { + } else if ((Trb !=3D NULL) && (Status =3D=3D EFI_CRC_ERROR) && (Trb->Ret= ries > 0)) { + Trb->Retries--; + Trb->Started =3D FALSE; + } else if ((Trb !=3D NULL)) { RemoveEntryList (Link); Trb->Packet->TransactionStatus =3D Status; TrbEvent =3D Trb->Event; --=20 2.14.1.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. 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. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#52984): https://edk2.groups.io/g/devel/message/52984 Mute This Topic: https://groups.io/mt/69499850/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-