From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: hao.a.wu@intel.com) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by groups.io with SMTP; Wed, 07 Aug 2019 19:36:51 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 19:36:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,358,1559545200"; d="scan'208";a="168835273" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 07 Aug 2019 19:36:51 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 19:36:50 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 7 Aug 2019 19:36:50 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.112]) by shsmsx102.ccr.corp.intel.com ([169.254.2.19]) with mapi id 14.03.0439.000; Thu, 8 Aug 2019 10:36:48 +0800 From: "Wu, Hao A" To: "Albecki, Mateusz" , "devel@edk2.groups.io" Subject: Re: [PATCH 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Thread-Topic: [PATCH 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Thread-Index: AQHVTUBjKnJEORMn00WP9Tqr5IcWPabwgZiA Date: Thu, 8 Aug 2019 02:36:48 +0000 Message-ID: References: <20190807165107.688-1-mateusz.albecki@intel.com> <20190807165107.688-2-mateusz.albecki@intel.com> In-Reply-To: <20190807165107.688-2-mateusz.albecki@intel.com> 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 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Albecki, Mateusz > Sent: Thursday, August 08, 2019 12:51 AM > To: devel@edk2.groups.io > Cc: Albecki, Mateusz; Wu, Hao A > Subject: [PATCH 1/4] MdeModulePkg: Add definition of the > EDKII_UFS_HC_PLATFORM_PROTOCOL >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1343 >=20 > EDKII_UFS_HC_PLATFORM_PROTOCOL will allow the platform to inject > platform specific logic into standard UFS flows. Right now we > support callbacks pre and post host controller enable and pre > and post link startup. Provided callbacks allow the platform > driver to inject UIC programming after HCE is set which is > a standard initialization step covered by UFS specification as > well as cover some additional use cases during other calllbacks. > For instance platform driver may switch to fast mode after link > startup. >=20 > We also allow the platform to override host controller capabilities > and version which might be usefull to manage silicon bugs or > allow testign experimental features from new versions of the > specification. I will handle the below typos when pushing this patch: usefull -> useful testign -> testing >=20 > Cc: Hao A Wu > Signed-off-by: Mateusz Albecki > --- > .../Include/Protocol/UfsHostControllerPlatform.h | 124 > +++++++++++++++++++++ > MdeModulePkg/MdeModulePkg.dec | 3 + > 2 files changed, 127 insertions(+) > create mode 100644 > MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h >=20 > diff --git a/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h > b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h > new file mode 100644 > index 0000000000..0f6732a1f8 > --- /dev/null > +++ b/MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h > @@ -0,0 +1,124 @@ > +/** @file > + EDKII_UFS_HC_PLATFORM_PROTOCOL definition. > + > +Copyright (c) 2019, Intel Corporation. All rights reserved.
> +SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__ > +#define __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__ > + > +#include > + > +#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 1 > + > +extern EFI_GUID gEdkiiUfsHcPlatformProtocolGuid; > + > +typedef struct _EDKII_UFS_HC_PLATFORM_PROTOCOL > EDKII_UFS_HC_PLATFORM_PROTOCOL; > + > +typedef struct _EDKII_UFS_HC_DRIVER_INTERFACE > EDKII_UFS_HC_DRIVER_INTERFACE; > + > +typedef struct { > + UINT32 Opcode; > + UINT32 Arg1; > + UINT32 Arg2; > + UINT32 Arg3; > +} EDKII_UIC_COMMAND; > + > +/** > + Execute UIC command > + > + @param[in] This Pointer to driver interface produced by th= e UFS > controller. > + @param[in, out] UicCommand Descriptor of the command that will be > executed. > + > + @retval EFI_SUCCESS Command executed successfully. > + @retval EFI_INVALID_PARAMETER This or UicCommand is NULL. > + @retval Others Command failed to execute. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_UFS_EXEC_UIC_COMMAND) ( > + IN EDKII_UFS_HC_DRIVER_INTERFACE *This, > + IN OUT EDKII_UIC_COMMAND *UicCommand > +); > + > +struct _EDKII_UFS_HC_DRIVER_INTERFACE { > + /// > + /// Protocol to accesss host controller MMIO and PCI registers. > + /// > + EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHcProtocol; > + /// > + /// Function implementing UIC command execution. > + /// > + EDKII_UFS_EXEC_UIC_COMMAND UfsExecUicCommand; > +}; > + > +typedef struct { > + UINT32 Capabilities; > + UINT32 Version; > +} EDKII_UFS_HC_INFO; > + > +/** > + Allows platform protocol to override host controller information > + > + @param[in] ControllerHandle Handle of the UFS controller. > + @param[in, out] HcInfo Pointer EDKII_UFS_HC_INFO associated= with > host controller. > + > + @retval EFI_SUCCESS Function completed successfully. > + @retval EFI_INVALID_PARAMETER HcInfo is NULL. > + @retval Others Function failed to complete. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO) ( > + IN EFI_HANDLE ControllerHandle, > + IN OUT EDKII_UFS_HC_INFO *HcInfo > +); > + > +typedef enum { > + EdkiiUfsHcPreHce, > + EdkiiUfsHcPostHce, > + EdkiiUfsHcPreLinkStartup, > + EdkiiUfsHcPostLinkStartup > +} EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE; > + > +/** > + Callback function for platform driver. > + > + @param[in] ControllerHandle Handle of the UFS controller. > + @param[in] CallbackPhase Specifies when the platform protocol= is > called > + @param[in, out] CallbackData Data specific to the callback phase. > + For PreHce and PostHce - > EDKII_UFS_HC_DRIVER_INTERFACE. > + For PreLinkStartup and PostLinkStart= up - > EDKII_UFS_HC_DRIVER_INTERFACE. > + > + @retval EFI_SUCCESS Override function completed successfull= y. > + @retval EFI_INVALID_PARAMETER CallbackPhase is invalid or CallbackDat= a > is NULL when phase expects valid data. > + @retval Others Function failed to complete. > +**/ > +typedef > +EFI_STATUS > +(EFIAPI *EDKII_UFS_HC_PLATFORM_CALLBACK) ( > + IN EFI_HANDLE ControllerHandle, > + IN EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE CallbackPhase, > + IN OUT VOID *CallbackData > +); > + > +struct _EDKII_UFS_HC_PLATFORM_PROTOCOL { > + /// > + /// Version of the protocol. > + /// > + UINT32 Version; > + /// > + /// Allows platform driver to override host controller information. > + /// > + EDKII_UFS_HC_PLATFORM_OVERRIDE_HC_INFO OverrideHcInfo; > + /// > + /// Allows platform driver to implement platform specific flows > + /// for host controller. > + /// > + EDKII_UFS_HC_PLATFORM_CALLBACK Callback; > +}; > + > +#endif > + > diff --git a/MdeModulePkg/MdeModulePkg.dec > b/MdeModulePkg/MdeModulePkg.dec > index c4139753d3..b663453c8b 100644 > --- a/MdeModulePkg/MdeModulePkg.dec > +++ b/MdeModulePkg/MdeModulePkg.dec > @@ -558,6 +558,9 @@ > ## Include/Protocol/UfsHostController.h > gEdkiiUfsHostControllerProtocolGuid =3D { 0xebc01af5, 0x7a9, 0x489e, {= 0xb7, > 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } } >=20 > + ## Include/Protocol/UfsHostControllerPlatform.h > + gEdkiiUfsHcPlatformProtocolGuid =3D { 0x3d18ba13, 0xd9b1, 0x4dd4, {0xb= 9, > 0x16, 0xd3, 0x07, 0x96, 0x53, 0x9e, 0xd8}} > + Reviewed-by: Hao A Wu Best Regards, Hao Wu > ## Include/Protocol/EsrtManagement.h > gEsrtManagementProtocolGuid =3D { 0xa340c064, 0x723c, 0x4a9c, = { 0xa4, > 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 }} >=20 > -- > 2.14.1.windows.1