From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Ke, VincentX" <vincentx.ke@intel.com>
Cc: "Ni, Ray" <ray.ni@intel.com>, "Chiu, Ian" <Ian.chiu@intel.com>,
"Chu, Maggie" <maggie.chu@intel.com>
Subject: Re: [edk2-devel] [PATCH v6 3/3] MdeModulePkg: Put off UFS HCS.DP checking to fix timing problem
Date: Thu, 23 Dec 2021 05:44:35 +0000 [thread overview]
Message-ID: <DM6PR11MB4025031617E49D182CC4C9DECA7E9@DM6PR11MB4025.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211223041919.1307-4-vincentx.ke@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> VincentX Ke
> Sent: Thursday, December 23, 2021 12:19 PM
> To: devel@edk2.groups.io
> Cc: Ke, VincentX <vincentx.ke@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Chiu, Ian
> <Ian.chiu@intel.com>; Chu, Maggie <maggie.chu@intel.com>
> Subject: [edk2-devel] [PATCH v6 3/3] MdeModulePkg: Put off UFS HCS.DP
> checking to fix timing problem
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3776
>
> Put off UFS HCS.DP (Device Attached) checking until UfsDeviceDetection() to
> fix timing problem.
>
> Cc: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Ian Chiu <Ian.chiu@intel.com>
> Cc: Maggie Chu <maggie.chu@intel.com>
> Signed-off-by: VincentX Ke <vincentx.ke@intel.com>
> ---
> MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 47 +++++++++------------
> 1 file changed, 19 insertions(+), 28 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> index cffe8e02a7..864bf6928d 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> @@ -1353,23 +1353,6 @@ UfsExecUicCommands (
> }
> }
>
> - //
> - // Check value of HCS.DP and make sure that there is a device attached to
> the Link.
> - //
> - Address = UfsHcBase + UFS_HC_STATUS_OFFSET;
> - Data = MmioRead32 (Address);
> - if ((Data & UFS_HC_HCS_DP) == 0) {
> - Address = UfsHcBase + UFS_HC_IS_OFFSET;
> - Status = UfsWaitMemSet (Address, UFS_HC_IS_ULSS, UFS_HC_IS_ULSS,
> UFS_TIMEOUT);
> - if (EFI_ERROR (Status)) {
> - return EFI_DEVICE_ERROR;
> - }
> -
> - return EFI_NOT_FOUND;
> - }
> -
> - DEBUG ((DEBUG_INFO, "UfsblockioPei: found a attached UFS device\n"));
> -
> return EFI_SUCCESS;
> }
>
> @@ -1443,6 +1426,8 @@ UfsDeviceDetection (
> )
> {
> UINTN Retry;
> + UINTN Address;
> + UINT32 Data;
> EFI_STATUS Status;
>
> //
> @@ -1451,22 +1436,28 @@ UfsDeviceDetection (
> //
> for (Retry = 0; Retry < 3; Retry++) {
> Status = UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0);
> - if (!EFI_ERROR (Status)) {
> - break;
> + if (EFI_ERROR (Status)) {
> + return EFI_DEVICE_ERROR;
> }
>
> - if (Status == EFI_NOT_FOUND) {
> - continue;
> + //
> + // Check value of HCS.DP and make sure that there is a device attached to
> the Link
> + //
> + Address = Private->UfsHcBase + UFS_HC_STATUS_OFFSET;
> + Data = MmioRead32 (Address);
> + if ((Data & UFS_HC_HCS_DP) == 0) {
> + Address = Private->UfsHcBase + UFS_HC_IS_OFFSET;
> + Status = UfsWaitMemSet (Address, UFS_HC_IS_ULSS, UFS_HC_IS_ULSS,
> UFS_TIMEOUT);
> + if (EFI_ERROR (Status)) {
> + return EFI_DEVICE_ERROR;
> + }
> + } else {
> + DEBUG ((DEBUG_INFO, "UfsblockioPei: found a attached UFS
> device\n"));
> + return EFI_SUCCESS;
> }
> -
> - return EFI_DEVICE_ERROR;
> }
>
> - if (Retry == 3) {
> - return EFI_NOT_FOUND;
> - }
> -
> - return EFI_SUCCESS;
> + return EFI_NOT_FOUND;
> }
>
> /**
> --
> 2.31.1.windows.1
>
>
>
>
>
prev parent reply other threads:[~2021-12-23 5:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 4:19 [PATCH v6 0/3] MdeModulePkg: Fix UfsBlockIoPei timing problem VincentX Ke
2021-12-23 4:19 ` [PATCH v6 1/3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem VincentX Ke
2021-12-23 5:44 ` Wu, Hao A
2021-12-23 4:19 ` [PATCH v6 2/3] MdeModulePkg: Refactoring UFS DME request and fix timing problem VincentX Ke
2021-12-23 5:42 ` Wu, Hao A
2021-12-23 4:19 ` [PATCH v6 3/3] MdeModulePkg: Put off UFS HCS.DP checking to " VincentX Ke
2021-12-23 5:44 ` Wu, Hao A [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DM6PR11MB4025031617E49D182CC4C9DECA7E9@DM6PR11MB4025.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox