From: "Wu, Hao A" <hao.a.wu@intel.com>
To: "Albecki, Mateusz" <mateusz.albecki@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH 2/3] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection
Date: Mon, 1 Apr 2019 06:53:17 +0000 [thread overview]
Message-ID: <B80AF82E9BFB8E4FBD8C89DA810C6A093C8B9FFB@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <e3cef0bd6e33dd0d8826d7386b96f69cd54d1f0a.1553774396.git.mateusz.albecki@intel.com>
> -----Original Message-----
> From: Albecki, Mateusz
> Sent: Thursday, March 28, 2019 9:56 PM
> To: edk2-devel@lists.01.org
> Cc: Albecki, Mateusz; Wu, Hao A
> Subject: [PATCH 2/3] MdeModulePkg/UfsPassThruDxe: Refactor UFS device
> presence detection
>
> In current implementation we are checking for device presence every
> time we execute UIC command. To make UfsExecUicCommands more generic
> checking device presence has been moved to UfsDeviceDetection.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Cc: Hao Wu <hao.a.wu@intel.com>
> Signed-off-by: Albecki Mateusz <mateusz.albecki@intel.com>
> ---
> .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 49 ++++++++--------------
> 1 file changed, 18 insertions(+), 31 deletions(-)
>
> diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> index 9d0793c6be..c37161c4ae 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> @@ -1621,7 +1621,7 @@ Exit1:
> }
>
> /**
> - Sent UIC DME_LINKSTARTUP command to start the link startup procedure.
> + Send UIC command.
>
> @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA
> data structure.
> @param[in] UicOpcode The opcode of the UIC command.
Please help to update remove the line:
@return EFI_NOT_FOUND The presence of the UFS device isn't detected.
from the description of functions UfsExecUicCommands().
Other than this, the patch is good to me:
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> @@ -1716,24 +1716,6 @@ UfsExecUicCommands (
> }
> }
>
> - //
> - // Check value of HCS.DP and make sure that there is a device attached to
> the Link.
> - //
> - Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> - if (EFI_ERROR (Status)) {
> - return Status;
> - }
> -
> - if ((Data & UFS_HC_HCS_DP) == 0) {
> - Status = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET, 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, "UfsPassThruDxe: found a attached UFS device\n"));
> -
> return EFI_SUCCESS;
> }
>
> @@ -1907,8 +1889,9 @@ UfsDeviceDetection (
> IN UFS_PASS_THRU_PRIVATE_DATA *Private
> )
> {
> - UINTN Retry;
> - EFI_STATUS Status;
> + UINTN Retry;
> + EFI_STATUS Status;
> + UINT32 Data;
>
> //
> // Start UFS device detection.
> @@ -1916,22 +1899,26 @@ 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;
> + Status = UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data);
> + if (EFI_ERROR (Status)) {
> + return EFI_DEVICE_ERROR;
> }
>
> - return EFI_DEVICE_ERROR;
> - }
> -
> - if (Retry == 3) {
> - return EFI_NOT_FOUND;
> + if ((Data & UFS_HC_HCS_DP) == 0) {
> + Status = UfsWaitMemSet (Private, UFS_HC_IS_OFFSET, UFS_HC_IS_ULSS,
> UFS_HC_IS_ULSS, UFS_TIMEOUT);
> + if (EFI_ERROR (Status)) {
> + return EFI_DEVICE_ERROR;
> + }
> + } else {
> + return EFI_SUCCESS;
> + }
> }
>
> - return EFI_SUCCESS;
> + return EFI_NOT_FOUND;
> }
>
> /**
> --
> 2.14.1.windows.1
next prev parent reply other threads:[~2019-04-01 6:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-28 13:48 [PATCH 0/3] Implement UFS info protocol to pass additional UIC programming data from platform/silicon specific driver Albecki, Mateusz
2019-03-28 13:48 ` [PATCH 1/3] MdeModulePkg/UfsPassThruDxe: Fix unaligned data transfer handling Albecki, Mateusz
2019-03-28 13:56 ` [PATCH 2/3] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection Albecki, Mateusz
2019-04-01 6:53 ` Wu, Hao A [this message]
2019-03-28 13:56 ` [PATCH 3/3] MdeModulePkg/UfsPassThruDxe: Add UFS info protocol Albecki, Mateusz
2019-04-01 6:53 ` Wu, Hao A
[not found] ` <92CF190FF2351747A47C1708F0E09C0875DE7165@IRSMSX102.ger.corp.intel.com>
2019-04-12 6:35 ` Wu, Hao A
2019-04-12 23:22 ` Albecki, Mateusz
2019-04-15 5:56 ` Wu, Hao A
2019-04-01 6:53 ` [PATCH 0/3] Implement UFS info protocol to pass additional UIC programming data from platform/silicon specific driver Wu, Hao A
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=B80AF82E9BFB8E4FBD8C89DA810C6A093C8B9FFB@SHSMSX104.ccr.corp.intel.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