From nobody Mon Feb 9 09:43:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45277+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45277+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565361404; cv=none; d=zoho.com; s=zohoarc; b=ofQFDPeifWiQEuPlHnAG5ku02y5ztz1ySKkc7n1TUrDw+Na5JzdOP3EGdAxp+o578Ovs2y4YAQeIl72VhFMvS4yJDnn2ht9qLC2nwYRMjHCVNVYCvqyREhZvIaU9x3VOLd61QWKH+f81SVatnZBAUH7lB31C5Y6BHmN8LQ/JvjU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565361404; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=DiNHSTYQ87ZTMXDKFcF+J1XWoOhWDCjwqmAL6ycRQ2w=; b=Pc7+bSMdDLHwfoIYwRv+wbRPOAO2nJF5x2s9MIs3XocRX+2OgJcbwL59F9dzD+Zb5+tFGCVVDMBqw39IfOsbaWBk+b+OsqA/KruH+uIbiDyRAFLviaZW2S5plMWAf/fJt/7XYpCqYLHfqKRJ2TRXBgObuPeUhTk99MK92SnLy2Y= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45277+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 156536140464518.01132986518644; Fri, 9 Aug 2019 07:36:44 -0700 (PDT) Return-Path: X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by groups.io with SMTP; Fri, 09 Aug 2019 07:36:44 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Aug 2019 07:36:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,364,1559545200"; d="scan'208";a="203942017" X-Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by fmsmga002.fm.intel.com with ESMTP; 09 Aug 2019 07:36:41 -0700 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Hao A Wu Subject: [edk2-devel] [PATCHv3 2/4] MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function Date: Fri, 9 Aug 2019 16:36:18 +0200 Message-Id: <20190809143620.4924-3-mateusz.albecki@intel.com> In-Reply-To: <20190809143620.4924-1-mateusz.albecki@intel.com> References: <20190809143620.4924-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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565361404; bh=iQyW5yKrsl7eIjctxFqGANbp2Nyx4oSz9pHXBd91XfE=; h=Cc:Date:From:Reply-To:Subject:To; b=v5s4rYJaN18OdtE6GD2oaf4Mjg14ouS+BepTxhy3bzUKKuiw8mRTZ9jTOTU1MCMUt9d PWgTnIcOlyCEFv9sI8XIeuhfhA7Hw7/rrKCBGsXm94cOY++5amVbQkbTADIt/ZzVTpbMs +XOipo5QDGCiVnxYlJwVine2KkrDQseJR8g= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D1343 UfsExecUicCommand function has been refactored to allow the caller to check the command results which is important for commands such as UIC read. Cc: Hao A Wu Signed-off-by: Mateusz Albecki --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 3 +- .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 47 ++++++++++++------= ---- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModuleP= kg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h index 9b68db5ffe..b79be77709 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h @@ -1,6 +1,6 @@ /** @file =20 - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include #include diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModu= lePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c index 912d6f8202..6ea27e473c 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c @@ -2,7 +2,7 @@ UfsPassThruDxe driver is used to produce EFI_EXT_SCSI_PASS_THRU protocol= interface for upper layer application to execute UFS-supported SCSI cmds. =20 - Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -1633,11 +1633,8 @@ Exit1: /** Send UIC command. =20 - @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DAT= A data structure. - @param[in] UicOpcode The opcode of the UIC command. - @param[in] Arg1 The value for 1st argument of the UIC comman= d. - @param[in] Arg2 The value for 2nd argument of the UIC comman= d. - @param[in] Arg3 The value for 3rd argument of the UIC comman= d. + @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DAT= A data structure. + @param[in, out] UicCommand UIC command descriptor. On exit contains UIC= command results. =20 @return EFI_SUCCESS Successfully execute this UIC command and detec= t attached UFS device. @return EFI_DEVICE_ERROR Fail to execute this UIC command and detect att= ached UFS device. @@ -1646,10 +1643,7 @@ Exit1: EFI_STATUS UfsExecUicCommands ( IN UFS_PASS_THRU_PRIVATE_DATA *Private, - IN UINT8 UicOpcode, - IN UINT32 Arg1, - IN UINT32 Arg2, - IN UINT32 Arg3 + IN OUT EDKII_UIC_COMMAND *UicCommand ) { EFI_STATUS Status; @@ -1675,17 +1669,17 @@ UfsExecUicCommands ( // only after all the UIC command argument registers (UICCMDARG1, UICCMD= ARG2 and UICCMDARG3) // are set. // - Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG1_OFFSET, Arg1); + Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG1_OFFSET, UicCommand-= >Arg1); if (EFI_ERROR (Status)) { return Status; } =20 - Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG2_OFFSET, Arg2); + Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG2_OFFSET, UicCommand-= >Arg2); if (EFI_ERROR (Status)) { return Status; } =20 - Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG3_OFFSET, Arg3); + Status =3D UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG3_OFFSET, UicCommand-= >Arg3); if (EFI_ERROR (Status)) { return Status; } @@ -1698,7 +1692,7 @@ UfsExecUicCommands ( return Status; } =20 - Status =3D UfsMmioWrite32 (Private, UFS_HC_UIC_CMD_OFFSET, (UINT32)UicOp= code); + Status =3D UfsMmioWrite32 (Private, UFS_HC_UIC_CMD_OFFSET, UicCommand->O= pcode); if (EFI_ERROR (Status)) { return Status; } @@ -1712,14 +1706,18 @@ UfsExecUicCommands ( return Status; } =20 - if (UicOpcode !=3D UfsUicDmeReset) { - Status =3D UfsMmioRead32 (Private, UFS_HC_UCMD_ARG2_OFFSET, &Data); + if (UicCommand->Opcode !=3D UfsUicDmeReset) { + Status =3D UfsMmioRead32 (Private, UFS_HC_UCMD_ARG2_OFFSET, &UicComman= d->Arg2); if (EFI_ERROR (Status)) { return Status; } - if ((Data & 0xFF) !=3D 0) { + Status =3D UfsMmioRead32 (Private, UFS_HC_UCMD_ARG3_OFFSET, &UicComman= d->Arg3); + if (EFI_ERROR (Status)) { + return Status; + } + if ((UicCommand->Arg2 & 0xFF) !=3D 0) { DEBUG_CODE_BEGIN(); - DumpUicCmdExecResult (UicOpcode, (UINT8)(Data & 0xFF)); + DumpUicCmdExecResult ((UINT8)UicCommand->Opcode, (UINT8)(UicComman= d->Arg2 & 0xFF)); DEBUG_CODE_END(); return EFI_DEVICE_ERROR; } @@ -1898,16 +1896,21 @@ UfsDeviceDetection ( IN UFS_PASS_THRU_PRIVATE_DATA *Private ) { - UINTN Retry; - EFI_STATUS Status; - UINT32 Data; + UINTN Retry; + EFI_STATUS Status; + UINT32 Data; + EDKII_UIC_COMMAND LinkStartupCommand; =20 // // Start UFS device detection. // Try up to 3 times for establishing data link with device. // for (Retry =3D 0; Retry < 3; Retry++) { - Status =3D UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0); + LinkStartupCommand.Opcode =3D UfsUicDmeLinkStartup; + LinkStartupCommand.Arg1 =3D 0; + LinkStartupCommand.Arg2 =3D 0; + LinkStartupCommand.Arg3 =3D 0; + Status =3D UfsExecUicCommands (Private, &LinkStartupCommand); if (EFI_ERROR (Status)) { return EFI_DEVICE_ERROR; } --=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 (#45277): https://edk2.groups.io/g/devel/message/45277 Mute This Topic: https://groups.io/mt/32811059/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-