From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.100; helo=mga07.intel.com; envelope-from=hao.a.wu@intel.com; receiver=edk2-devel@lists.01.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D473F208AE379 for ; Sun, 31 Mar 2019 23:53:20 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Mar 2019 23:53:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,295,1549958400"; d="scan'208";a="138925077" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 31 Mar 2019 23:53:20 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Sun, 31 Mar 2019 23:53:19 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.92]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.42]) with mapi id 14.03.0415.000; Mon, 1 Apr 2019 14:53:18 +0800 From: "Wu, Hao A" To: "Albecki, Mateusz" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH 2/3] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection Thread-Index: AQHU5W4OLOUOdMt6eUK6Ny0vM2ERgaYiRHEw Date: Mon, 1 Apr 2019 06:53:17 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 2/3] MdeModulePkg/UfsPassThruDxe: Refactor UFS device presence detection X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Apr 2019 06:53:21 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----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 >=20 > 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. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Cc: Hao Wu > Signed-off-by: Albecki Mateusz > --- > .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 49 ++++++++--------= ------ > 1 file changed, 18 insertions(+), 31 deletions(-) >=20 > 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: > } >=20 > /** > - Sent UIC DME_LINKSTARTUP command to start the link startup procedure. > + Send UIC command. >=20 > @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_D= ATA > 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 Best Regards, Hao Wu > @@ -1716,24 +1716,6 @@ UfsExecUicCommands ( > } > } >=20 > - // > - // Check value of HCS.DP and make sure that there is a device attached= to > the Link. > - // > - Status =3D UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data); > - if (EFI_ERROR (Status)) { > - return Status; > - } > - > - if ((Data & UFS_HC_HCS_DP) =3D=3D 0) { > - Status =3D 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; > } >=20 > @@ -1907,8 +1889,9 @@ UfsDeviceDetection ( > IN UFS_PASS_THRU_PRIVATE_DATA *Private > ) > { > - UINTN Retry; > - EFI_STATUS Status; > + UINTN Retry; > + EFI_STATUS Status; > + UINT32 Data; >=20 > // > // Start UFS device detection. > @@ -1916,22 +1899,26 @@ UfsDeviceDetection ( > // > for (Retry =3D 0; Retry < 3; Retry++) { > Status =3D UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, = 0); > - if (!EFI_ERROR (Status)) { > - break; > + if (EFI_ERROR (Status)) { > + return EFI_DEVICE_ERROR; > } >=20 > - if (Status =3D=3D EFI_NOT_FOUND) { > - continue; > + Status =3D UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Data); > + if (EFI_ERROR (Status)) { > + return EFI_DEVICE_ERROR; > } >=20 > - return EFI_DEVICE_ERROR; > - } > - > - if (Retry =3D=3D 3) { > - return EFI_NOT_FOUND; > + if ((Data & UFS_HC_HCS_DP) =3D=3D 0) { > + Status =3D UfsWaitMemSet (Private, UFS_HC_IS_OFFSET, UFS_HC_IS_ULS= S, > UFS_HC_IS_ULSS, UFS_TIMEOUT); > + if (EFI_ERROR (Status)) { > + return EFI_DEVICE_ERROR; > + } > + } else { > + return EFI_SUCCESS; > + } > } >=20 > - return EFI_SUCCESS; > + return EFI_NOT_FOUND; > } >=20 > /** > -- > 2.14.1.windows.1