public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers
@ 2019-08-09 14:36 Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Albecki, Mateusz @ 2019-08-09 14:36 UTC (permalink / raw)
  To: devel; +Cc: Mateusz Albecki, Hao A Wu

To cover additional host controller programming mentioned in the UFS specification we have added an additional protocol that allows the UEFI driver to give control to platform driver. This allows the platform to perform any additional steps needed for the stable operation.

Changes in v3:
- UFS driver will abort initializaton when it fails to get host controler information
- Fixed bug with calling post link startup callback on failed device detection

Test coverage:
Tested on platform with UFS 2.1 host controller with Samsung UFS2.0 part with 3 LUs enabled All LUs have been enumerated in boot manager.
Tested that enumeration works without platform protocol installed(on host controller that can support it) Tested that enumeration works with platform protocol installed and with additional programming steps after link startup(power mode change to GEAR2).

Cc: Hao A Wu <hao.a.wu@intel.com


Mateusz Albecki (4):
  MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL
  MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function
  MdeModulePkg/UfsPassThruDxe: Refactor private data to use
    EDKII_UFS_HC_INFO
  MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL

 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  26 +++-
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  44 +++++-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf      |   3 +-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 173 +++++++++++++++------
 .../Include/Protocol/UfsHostControllerPlatform.h   | 124 +++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |   3 +
 6 files changed, 324 insertions(+), 49 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h

-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCHv3 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL
  2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
@ 2019-08-09 14:36 ` Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 2/4] MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function Albecki, Mateusz
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Albecki, Mateusz @ 2019-08-09 14:36 UTC (permalink / raw)
  To: devel; +Cc: Mateusz Albecki, Hao A Wu

https://bugzilla.tianocore.org/show_bug.cgi?id=1343

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.

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.

Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
---
 .../Include/Protocol/UfsHostControllerPlatform.h   | 124 +++++++++++++++++++++
 MdeModulePkg/MdeModulePkg.dec                      |   3 +
 2 files changed, 127 insertions(+)
 create mode 100644 MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h

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.<BR>
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__
+#define __EDKII_UFS_HC_PLATFORM_PROTOCOL_H__
+
+#include <Protocol/UfsHostController.h>
+
+#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 the 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 PostLinkStartup - EDKII_UFS_HC_DRIVER_INTERFACE.
+
+  @retval EFI_SUCCESS            Override function completed successfully.
+  @retval EFI_INVALID_PARAMETER  CallbackPhase is invalid or CallbackData 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 = { 0xebc01af5, 0x7a9, 0x489e, { 0xb7, 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } }
 
+  ## Include/Protocol/UfsHostControllerPlatform.h
+  gEdkiiUfsHcPlatformProtocolGuid = { 0x3d18ba13, 0xd9b1, 0x4dd4, {0xb9, 0x16, 0xd3, 0x07, 0x96, 0x53, 0x9e, 0xd8}}
+
   ## Include/Protocol/EsrtManagement.h
   gEsrtManagementProtocolGuid         = { 0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 }}
 
-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv3 2/4] MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function
  2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
@ 2019-08-09 14:36 ` Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 3/4] MdeModulePkg/UfsPassThruDxe: Refactor private data to use EDKII_UFS_HC_INFO Albecki, Mateusz
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Albecki, Mateusz @ 2019-08-09 14:36 UTC (permalink / raw)
  To: devel; +Cc: Mateusz Albecki, Hao A Wu

https://bugzilla.tianocore.org/show_bug.cgi?id=1343

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 <hao.a.wu@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
---
 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/MdeModulePkg/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
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -13,6 +13,7 @@
 #include <Protocol/ScsiPassThruExt.h>
 #include <Protocol/UfsDeviceConfig.h>
 #include <Protocol/UfsHostController.h>
+#include <Protocol/UfsHostControllerPlatform.h>
 
 #include <Library/DebugLib.h>
 #include <Library/UefiDriverEntryPoint.h>
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/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.
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -1633,11 +1633,8 @@ Exit1:
 /**
   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.
-  @param[in] Arg1             The value for 1st argument of the UIC command.
-  @param[in] Arg2             The value for 2nd argument of the UIC command.
-  @param[in] Arg3             The value for 3rd argument of the UIC command.
+  @param[in]      Private     The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.
+  @param[in, out] UicCommand  UIC command descriptor. On exit contains UIC command results.
 
   @return EFI_SUCCESS      Successfully execute this UIC command and detect attached UFS device.
   @return EFI_DEVICE_ERROR Fail to execute this UIC command and detect attached 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, UICCMDARG2 and UICCMDARG3)
   // are set.
   //
-  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG1_OFFSET, Arg1);
+  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG1_OFFSET, UicCommand->Arg1);
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
-  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG2_OFFSET, Arg2);
+  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG2_OFFSET, UicCommand->Arg2);
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
-  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG3_OFFSET, Arg3);
+  Status = UfsMmioWrite32 (Private, UFS_HC_UCMD_ARG3_OFFSET, UicCommand->Arg3);
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -1698,7 +1692,7 @@ UfsExecUicCommands (
     return Status;
   }
 
-  Status = UfsMmioWrite32 (Private, UFS_HC_UIC_CMD_OFFSET, (UINT32)UicOpcode);
+  Status = UfsMmioWrite32 (Private, UFS_HC_UIC_CMD_OFFSET, UicCommand->Opcode);
   if (EFI_ERROR (Status)) {
     return Status;
   }
@@ -1712,14 +1706,18 @@ UfsExecUicCommands (
     return Status;
   }
 
-  if (UicOpcode != UfsUicDmeReset) {
-    Status = UfsMmioRead32 (Private, UFS_HC_UCMD_ARG2_OFFSET, &Data);
+  if (UicCommand->Opcode != UfsUicDmeReset) {
+    Status = UfsMmioRead32 (Private, UFS_HC_UCMD_ARG2_OFFSET, &UicCommand->Arg2);
     if (EFI_ERROR (Status)) {
       return Status;
     }
-    if ((Data & 0xFF) != 0) {
+    Status = UfsMmioRead32 (Private, UFS_HC_UCMD_ARG3_OFFSET, &UicCommand->Arg3);
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+    if ((UicCommand->Arg2 & 0xFF) != 0) {
       DEBUG_CODE_BEGIN();
-        DumpUicCmdExecResult (UicOpcode, (UINT8)(Data & 0xFF));
+        DumpUicCmdExecResult ((UINT8)UicCommand->Opcode, (UINT8)(UicCommand->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;
 
   //
   // Start UFS device detection.
   // Try up to 3 times for establishing data link with device.
   //
   for (Retry = 0; Retry < 3; Retry++) {
-    Status = UfsExecUicCommands (Private, UfsUicDmeLinkStartup, 0, 0, 0);
+    LinkStartupCommand.Opcode = UfsUicDmeLinkStartup;
+    LinkStartupCommand.Arg1 = 0;
+    LinkStartupCommand.Arg2 = 0;
+    LinkStartupCommand.Arg3 = 0;
+    Status = UfsExecUicCommands (Private, &LinkStartupCommand);
     if (EFI_ERROR (Status)) {
       return EFI_DEVICE_ERROR;
     }
-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv3 3/4] MdeModulePkg/UfsPassThruDxe: Refactor private data to use EDKII_UFS_HC_INFO
  2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 2/4] MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function Albecki, Mateusz
@ 2019-08-09 14:36 ` Albecki, Mateusz
  2019-08-09 14:36 ` [PATCHv3 4/4] MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
  2019-08-12  2:38 ` [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Wu, Hao A
  4 siblings, 0 replies; 7+ messages in thread
From: Albecki, Mateusz @ 2019-08-09 14:36 UTC (permalink / raw)
  To: devel; +Cc: Mateusz Albecki, Hao A Wu

https://bugzilla.tianocore.org/show_bug.cgi?id=1343

Private data has been refactored to use EDKII_UFS_HC_INFO structure
to store host controller capabilities and version
information. Getting host controller data has been moved
into single place and is done before host controller enable.

Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  9 +++-
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  | 15 +++++-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 57 ++++++++++++++--------
 3 files changed, 58 insertions(+), 23 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 1518b251d8..7dce217d49 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -1,6 +1,6 @@
 /** @file
 
-  Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -35,7 +35,7 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
   },
   0,                              // UfsHostController
   0,                              // UfsHcBase
-  0,                              // Capabilities
+  {0, 0},                         // UfsHcInfo
   0,                              // TaskTag
   0,                              // UtpTrlBase
   0,                              // Nutrs
@@ -865,6 +865,11 @@ UfsPassThruDriverBindingStart (
   Private->UfsHostController    = UfsHc;
   Private->UfsHcBase            = UfsHcBase;
   InitializeListHead (&Private->Queue);
+  Status = GetUfsHcInfo (Private);
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "Failed to initialize UfsHcInfo\n"));
+    goto Error;
+  }
 
   //
   // Initialize UFS Host Controller H/W.
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index b79be77709..c511aa8c7a 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -62,7 +62,7 @@ typedef struct _UFS_PASS_THRU_PRIVATE_DATA {
   EFI_UFS_DEVICE_CONFIG_PROTOCOL      UfsDevConfig;
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL  *UfsHostController;
   UINTN                               UfsHcBase;
-  UINT32                              Capabilities;
+  EDKII_UFS_HC_INFO                   UfsHcInfo;
 
   UINT8                               TaskTag;
 
@@ -959,6 +959,19 @@ UfsRwUfsAttribute (
   IN OUT UINT32                        *AttrSize
   );
 
+/**
+  Initializes UfsHcInfo field in private data.
+
+  @param[in] Private  Pointer to host controller private data.
+
+  @retval EFI_SUCCESS  UfsHcInfo initialized successfully.
+  @retval Others       Failed to initalize UfsHcInfo.
+**/
+EFI_STATUS
+GetUfsHcInfo (
+  IN UFS_PASS_THRU_PRIVATE_DATA  *Private
+  );
+
 extern EFI_COMPONENT_NAME_PROTOCOL  gUfsPassThruComponentName;
 extern EFI_COMPONENT_NAME2_PROTOCOL gUfsPassThruComponentName2;
 extern EFI_DRIVER_BINDING_PROTOCOL  gUfsPassThruDriverBinding;
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 6ea27e473c..74be3efc41 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -731,7 +731,7 @@ UfsFindAvailableSlotInTrl (
     return Status;
   }
 
-  Nutrs   = (UINT8)((Private->Capabilities & UFS_HC_CAP_NUTRS) + 1);
+  Nutrs   = (UINT8)((Private->UfsHcInfo.Capabilities & UFS_HC_CAP_NUTRS) + 1);
 
   for (Index = 0; Index < Nutrs; Index++) {
     if ((Data & (BIT0 << Index)) == 0) {
@@ -1754,7 +1754,7 @@ UfsAllocateAlignCommonBuffer (
   BOOLEAN                              Is32BitAddr;
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL   *UfsHc;
 
-  if ((Private->Capabilities & UFS_HC_CAP_64ADDR) == UFS_HC_CAP_64ADDR) {
+  if ((Private->UfsHcInfo.Capabilities & UFS_HC_CAP_64ADDR) == UFS_HC_CAP_64ADDR) {
     Is32BitAddr = FALSE;
   } else {
     Is32BitAddr = TRUE;
@@ -1947,7 +1947,6 @@ UfsInitTaskManagementRequestList (
   IN  UFS_PASS_THRU_PRIVATE_DATA     *Private
   )
 {
-  UINT32                 Data;
   UINT8                  Nutmrs;
   VOID                   *CmdDescHost;
   EFI_PHYSICAL_ADDRESS   CmdDescPhyAddr;
@@ -1961,17 +1960,10 @@ UfsInitTaskManagementRequestList (
   CmdDescMapping = NULL;
   CmdDescPhyAddr = 0;
 
-  Status = UfsMmioRead32 (Private, UFS_HC_CAP_OFFSET, &Data);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Private->Capabilities = Data;
-
   //
   // Allocate and initialize UTP Task Management Request List.
   //
-  Nutmrs = (UINT8) (RShiftU64 ((Private->Capabilities & UFS_HC_CAP_NUTMRS), 16) + 1);
+  Nutmrs = (UINT8) (RShiftU64 ((Private->UfsHcInfo.Capabilities & UFS_HC_CAP_NUTMRS), 16) + 1);
   Status = UfsAllocateAlignCommonBuffer (Private, Nutmrs * sizeof (UTP_TMRD), &CmdDescHost, &CmdDescPhyAddr, &CmdDescMapping);
   if (EFI_ERROR (Status)) {
     return Status;
@@ -2020,7 +2012,6 @@ UfsInitTransferRequestList (
   IN  UFS_PASS_THRU_PRIVATE_DATA     *Private
   )
 {
-  UINT32                 Data;
   UINT8                  Nutrs;
   VOID                   *CmdDescHost;
   EFI_PHYSICAL_ADDRESS   CmdDescPhyAddr;
@@ -2034,17 +2025,10 @@ UfsInitTransferRequestList (
   CmdDescMapping = NULL;
   CmdDescPhyAddr = 0;
 
-  Status = UfsMmioRead32 (Private, UFS_HC_CAP_OFFSET, &Data);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Private->Capabilities = Data;
-
   //
   // Allocate and initialize UTP Transfer Request List.
   //
-  Nutrs  = (UINT8)((Private->Capabilities & UFS_HC_CAP_NUTRS) + 1);
+  Nutrs  = (UINT8)((Private->UfsHcInfo.Capabilities & UFS_HC_CAP_NUTRS) + 1);
   Status = UfsAllocateAlignCommonBuffer (Private, Nutrs * sizeof (UTP_TRD), &CmdDescHost, &CmdDescPhyAddr, &CmdDescMapping);
   if (EFI_ERROR (Status)) {
     return Status;
@@ -2366,3 +2350,36 @@ ProcessAsyncTaskList (
   }
 }
 
+/**
+  Initializes UfsHcInfo field in private data.
+
+  @param[in] Private  Pointer to host controller private data.
+
+  @retval EFI_SUCCESS  UfsHcInfo initialized successfully.
+  @retval Others       Failed to initalize UfsHcInfo.
+**/
+EFI_STATUS
+GetUfsHcInfo (
+  IN UFS_PASS_THRU_PRIVATE_DATA  *Private
+  )
+{
+  UINT32      Data;
+  EFI_STATUS  Status;
+
+  Status = UfsMmioRead32 (Private, UFS_HC_VER_OFFSET, &Data);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  Private->UfsHcInfo.Version = Data;
+
+  Status = UfsMmioRead32 (Private, UFS_HC_CAP_OFFSET, &Data);
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
+  Private->UfsHcInfo.Capabilities = Data;
+
+  return EFI_SUCCESS;
+}
+
-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCHv3 4/4] MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL
  2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
                   ` (2 preceding siblings ...)
  2019-08-09 14:36 ` [PATCHv3 3/4] MdeModulePkg/UfsPassThruDxe: Refactor private data to use EDKII_UFS_HC_INFO Albecki, Mateusz
@ 2019-08-09 14:36 ` Albecki, Mateusz
  2019-08-12  2:38 ` [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Wu, Hao A
  4 siblings, 0 replies; 7+ messages in thread
From: Albecki, Mateusz @ 2019-08-09 14:36 UTC (permalink / raw)
  To: devel; +Cc: Mateusz Albecki, Hao A Wu

https://bugzilla.tianocore.org/show_bug.cgi?id=1343

This commit adds EDKII_UFS_HC_PLATFORM_PROTOCOL implementation
in UfsPassThruDxe driver in version 1. Driver assumes that at
most one instance of the protocol exists in the system. Presence
of the protocol is not mandatory.

Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  | 17 ++++++
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  | 26 ++++++++
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf      |  3 +-
 .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 69 +++++++++++++++++++++-
 4 files changed, 112 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 7dce217d49..b12404aacb 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -36,6 +36,7 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
   0,                              // UfsHostController
   0,                              // UfsHcBase
   {0, 0},                         // UfsHcInfo
+  {NULL, NULL},                   // UfsHcDriverInterface
   0,                              // TaskTag
   0,                              // UtpTrlBase
   0,                              // Nutrs
@@ -92,6 +93,8 @@ UFS_DEVICE_PATH    mUfsDevicePathTemplate = {
 
 UINT8 mUfsTargetId[TARGET_MAX_BYTES];
 
+GLOBAL_REMOVE_IF_UNREFERENCED EDKII_UFS_HC_PLATFORM_PROTOCOL  *mUfsHcPlatform;
+
 /**
   Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
   supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
@@ -864,7 +867,21 @@ UfsPassThruDriverBindingStart (
   Private->ExtScsiPassThru.Mode = &Private->ExtScsiPassThruMode;
   Private->UfsHostController    = UfsHc;
   Private->UfsHcBase            = UfsHcBase;
+  Private->Handle               = Controller;
+  Private->UfsHcDriverInterface.UfsHcProtocol = UfsHc;
+  Private->UfsHcDriverInterface.UfsExecUicCommand = UfsHcDriverInterfaceExecUicCommand;
   InitializeListHead (&Private->Queue);
+
+  //
+  // This has to be done before initializing UfsHcInfo or calling the UfsControllerInit
+  //
+  if (mUfsHcPlatform == NULL) {
+    Status = gBS->LocateProtocol (&gEdkiiUfsHcPlatformProtocolGuid, NULL, (VOID**)&mUfsHcPlatform);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_INFO, "No UfsHcPlatformProtocol present\n"));
+    }
+  }
+
   Status = GetUfsHcInfo (Private);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "Failed to initialize UfsHcInfo\n"));
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
index c511aa8c7a..cbc0c2126e 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h
@@ -63,6 +63,7 @@ typedef struct _UFS_PASS_THRU_PRIVATE_DATA {
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL  *UfsHostController;
   UINTN                               UfsHcBase;
   EDKII_UFS_HC_INFO                   UfsHcInfo;
+  EDKII_UFS_HC_DRIVER_INTERFACE       UfsHcDriverInterface;
 
   UINT8                               TaskTag;
 
@@ -126,6 +127,13 @@ typedef struct {
       UFS_PASS_THRU_SIG \
       )
 
+#define UFS_PASS_THRU_PRIVATE_DATA_FROM_DRIVER_INTF(a) \
+  CR (a, \
+      UFS_PASS_THRU_PRIVATE_DATA, \
+      UfsHcDriverInterface, \
+      UFS_PASS_THRU_SIG \
+      )
+
 typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET {
   UINT64           Timeout;
   VOID             *DataBuffer;
@@ -959,6 +967,23 @@ UfsRwUfsAttribute (
   IN OUT UINT32                        *AttrSize
   );
 
+/**
+  Execute UIC command.
+
+  @param[in]      This        Pointer to driver interface produced by the 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.
+**/
+EFI_STATUS
+EFIAPI
+UfsHcDriverInterfaceExecUicCommand (
+  IN     EDKII_UFS_HC_DRIVER_INTERFACE  *This,
+  IN OUT EDKII_UIC_COMMAND              *UicCommand
+  );
+
 /**
   Initializes UfsHcInfo field in private data.
 
@@ -975,5 +1000,6 @@ GetUfsHcInfo (
 extern EFI_COMPONENT_NAME_PROTOCOL  gUfsPassThruComponentName;
 extern EFI_COMPONENT_NAME2_PROTOCOL gUfsPassThruComponentName2;
 extern EFI_DRIVER_BINDING_PROTOCOL  gUfsPassThruDriverBinding;
+extern EDKII_UFS_HC_PLATFORM_PROTOCOL  *mUfsHcPlatform;
 
 #endif
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf
index 24f5ea3a8f..92dc25714b 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 # Description file for the Universal Flash Storage (UFS) Pass Thru driver.
 #
-# Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -54,6 +54,7 @@
   gEfiExtScsiPassThruProtocolGuid               ## BY_START
   gEfiUfsDeviceConfigProtocolGuid               ## BY_START
   gEdkiiUfsHostControllerProtocolGuid           ## TO_START
+  gEdkiiUfsHcPlatformProtocolGuid               ## SOMETIMES_CONSUMES
 
 [UserExtensions.TianoCore."ExtraFiles"]
   UfsPassThruExtra.uni
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 74be3efc41..0b95e7dddd 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -1202,8 +1202,6 @@ UfsSetFlag (
   return Status;
 }
 
-
-
 /**
   Read specified flag from a UFS device.
 
@@ -1835,6 +1833,14 @@ UfsEnableHostController (
   EFI_STATUS             Status;
   UINT32                 Data;
 
+  if (mUfsHcPlatform != NULL && mUfsHcPlatform->Callback != NULL) {
+    Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPreHce, &Private->UfsHcDriverInterface);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failure from platform driver during EdkiiUfsHcPreHce, Status = %r\n", Status));
+      return Status;
+    }
+  }
+
   //
   // UFS 2.0 spec section 7.1.1 - Host Controller Initialization
   //
@@ -1878,6 +1884,14 @@ UfsEnableHostController (
     return EFI_DEVICE_ERROR;
   }
 
+  if (mUfsHcPlatform != NULL && mUfsHcPlatform->Callback != NULL) {
+    Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPostHce, &Private->UfsHcDriverInterface);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failure from platform driver during EdkiiUfsHcPostHce, Status = %r\n", Status));
+      return Status;
+    }
+  }
+
   return EFI_SUCCESS;
 }
 
@@ -1901,6 +1915,14 @@ UfsDeviceDetection (
   UINT32             Data;
   EDKII_UIC_COMMAND  LinkStartupCommand;
 
+  if (mUfsHcPlatform != NULL && mUfsHcPlatform->Callback != NULL) {
+    Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPreLinkStartup, &Private->UfsHcDriverInterface);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failure from platform driver during EdkiiUfsHcPreLinkStartup, Status = %r\n", Status));
+      return Status;
+    }
+  }
+
   //
   // Start UFS device detection.
   // Try up to 3 times for establishing data link with device.
@@ -1926,6 +1948,13 @@ UfsDeviceDetection (
         return EFI_DEVICE_ERROR;
       }
     } else {
+      if (mUfsHcPlatform != NULL && mUfsHcPlatform->Callback != NULL) {
+        Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPostLinkStartup, &Private->UfsHcDriverInterface);
+        if (EFI_ERROR (Status)) {
+          DEBUG ((DEBUG_ERROR, "Failure from platform driver during EdkiiUfsHcPostLinkStartup, Status = %r\n", Status));
+          return Status;
+        }
+      }
       return EFI_SUCCESS;
     }
   }
@@ -2350,6 +2379,34 @@ ProcessAsyncTaskList (
   }
 }
 
+/**
+  Execute UIC command.
+
+  @param[in]      This        Pointer to driver interface produced by the 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.
+**/
+EFI_STATUS
+EFIAPI
+UfsHcDriverInterfaceExecUicCommand (
+  IN     EDKII_UFS_HC_DRIVER_INTERFACE  *This,
+  IN OUT EDKII_UIC_COMMAND              *UicCommand
+  )
+{
+  UFS_PASS_THRU_PRIVATE_DATA    *Private;
+
+  if (This == NULL || UicCommand == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  Private = UFS_PASS_THRU_PRIVATE_DATA_FROM_DRIVER_INTF (This);
+
+  return UfsExecUicCommands (Private, UicCommand);
+}
+
 /**
   Initializes UfsHcInfo field in private data.
 
@@ -2380,6 +2437,14 @@ GetUfsHcInfo (
 
   Private->UfsHcInfo.Capabilities = Data;
 
+  if (mUfsHcPlatform != NULL && mUfsHcPlatform->OverrideHcInfo != NULL) {
+    Status = mUfsHcPlatform->OverrideHcInfo (Private->Handle, &Private->UfsHcInfo);
+    if (EFI_ERROR (Status)) {
+      DEBUG ((DEBUG_ERROR, "Failure from platform on OverrideHcInfo, Status = %r\n", Status));
+      return Status;
+    }
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.14.1.windows.1

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | 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 wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek
przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by
others is strictly prohibited.


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers
  2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
                   ` (3 preceding siblings ...)
  2019-08-09 14:36 ` [PATCHv3 4/4] MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
@ 2019-08-12  2:38 ` Wu, Hao A
  2019-08-13  2:56   ` [edk2-devel] " Wu, Hao A
  4 siblings, 1 reply; 7+ messages in thread
From: Wu, Hao A @ 2019-08-12  2:38 UTC (permalink / raw)
  To: Albecki, Mateusz, devel@edk2.groups.io
  Cc: Andrew Fish, Laszlo Ersek, Leif Lindholm, Kinney, Michael D,
	Gao, Liming

> -----Original Message-----
> From: Albecki, Mateusz
> Sent: Friday, August 09, 2019 10:36 PM
> To: devel@edk2.groups.io
> Cc: Albecki, Mateusz; Wu, Hao A
> Subject: [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to
> support platform specific programming of UFS host controllers
> 
> To cover additional host controller programming mentioned in the UFS
> specification we have added an additional protocol that allows the UEFI
> driver to give control to platform driver. This allows the platform to perform
> any additional steps needed for the stable operation.
> 
> Changes in v3:
> - UFS driver will abort initializaton when it fails to get host controler
> information
> - Fixed bug with calling post link startup callback on failed device detection
> 
> Test coverage:
> Tested on platform with UFS 2.1 host controller with Samsung UFS2.0 part
> with 3 LUs enabled All LUs have been enumerated in boot manager.
> Tested that enumeration works without platform protocol installed(on host
> controller that can support it) Tested that enumeration works with platform
> protocol installed and with additional programming steps after link
> startup(power mode change to GEAR2).
> 
> Cc: Hao A Wu <hao.a.wu@intel.com
> 
> 
> Mateusz Albecki (4):
>   MdeModulePkg: Add definition of the
> EDKII_UFS_HC_PLATFORM_PROTOCOL
>   MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function
>   MdeModulePkg/UfsPassThruDxe: Refactor private data to use
>     EDKII_UFS_HC_INFO
>   MdeModulePkg/UfsPassThruDxe: Implement
> EDKII_UFS_HC_PLATFORM_PROTOCOL


For the 3rd patch, in order to please the PatchCheck.py, I will change the
title a little bit to:
* MdeModulePkg/UfsPassThruDxe: Refactor private data to use UfsHcInfo

Other than that, for the series,
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>

Since there is already a confirmation from Laszlo for adding this feature in
the upcoming stable tag:
https://edk2.groups.io/g/devel/message/45217?p=,,,20,0,0,0::Created,,ufs,20,2,0,32784353

I plan to push the series tomorrow (after around 24 hours, in case if there
are additional feedbacks).

Best Regards,
Hao Wu


> 
>  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  26 +++-
>  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  44 +++++-
>  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf      |   3 +-
>  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 173 +++++++++++++++-
> -----
>  .../Include/Protocol/UfsHostControllerPlatform.h   | 124 +++++++++++++++
>  MdeModulePkg/MdeModulePkg.dec                      |   3 +
>  6 files changed, 324 insertions(+), 49 deletions(-)
>  create mode 100644
> MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h
> 
> --
> 2.14.1.windows.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers
  2019-08-12  2:38 ` [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Wu, Hao A
@ 2019-08-13  2:56   ` Wu, Hao A
  0 siblings, 0 replies; 7+ messages in thread
From: Wu, Hao A @ 2019-08-13  2:56 UTC (permalink / raw)
  To: devel@edk2.groups.io, Wu, Hao A, Albecki, Mateusz
  Cc: Andrew Fish, Laszlo Ersek, Leif Lindholm, Kinney, Michael D,
	Gao, Liming

> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Wu, Hao A
> Sent: Monday, August 12, 2019 10:39 AM
> To: Albecki, Mateusz; devel@edk2.groups.io
> Cc: Andrew Fish; Laszlo Ersek; Leif Lindholm; Kinney, Michael D; Gao, Liming
> Subject: Re: [edk2-devel] [PATCHv3 0/4] Add
> EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific
> programming of UFS host controllers
> 
> > -----Original Message-----
> > From: Albecki, Mateusz
> > Sent: Friday, August 09, 2019 10:36 PM
> > To: devel@edk2.groups.io
> > Cc: Albecki, Mateusz; Wu, Hao A
> > Subject: [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to
> > support platform specific programming of UFS host controllers
> >
> > To cover additional host controller programming mentioned in the UFS
> > specification we have added an additional protocol that allows the UEFI
> > driver to give control to platform driver. This allows the platform to perform
> > any additional steps needed for the stable operation.
> >
> > Changes in v3:
> > - UFS driver will abort initializaton when it fails to get host controler
> > information
> > - Fixed bug with calling post link startup callback on failed device detection
> >
> > Test coverage:
> > Tested on platform with UFS 2.1 host controller with Samsung UFS2.0 part
> > with 3 LUs enabled All LUs have been enumerated in boot manager.
> > Tested that enumeration works without platform protocol installed(on host
> > controller that can support it) Tested that enumeration works with
> platform
> > protocol installed and with additional programming steps after link
> > startup(power mode change to GEAR2).
> >
> > Cc: Hao A Wu <hao.a.wu@intel.com
> >
> >
> > Mateusz Albecki (4):
> >   MdeModulePkg: Add definition of the
> > EDKII_UFS_HC_PLATFORM_PROTOCOL
> >   MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function
> >   MdeModulePkg/UfsPassThruDxe: Refactor private data to use
> >     EDKII_UFS_HC_INFO
> >   MdeModulePkg/UfsPassThruDxe: Implement
> > EDKII_UFS_HC_PLATFORM_PROTOCOL
> 
> 
> For the 3rd patch, in order to please the PatchCheck.py, I will change the
> title a little bit to:
> * MdeModulePkg/UfsPassThruDxe: Refactor private data to use UfsHcInfo
> 
> Other than that, for the series,
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
> 
> Since there is already a confirmation from Laszlo for adding this feature in
> the upcoming stable tag:
> https://edk2.groups.io/g/devel/message/45217?p=,,,20,0,0,0::Created,,ufs,2
> 0,2,0,32784353
> 
> I plan to push the series tomorrow (after around 24 hours, in case if there
> are additional feedbacks).


Thanks all, the series has been pushed via commits 12dcad5b1e..ecc32c90ee.

Best Regards,
Hao Wu


> 
> Best Regards,
> Hao Wu
> 
> 
> >
> >  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c  |  26 +++-
> >  MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h  |  44 +++++-
> >  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf      |   3 +-
> >  .../Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c        | 173
> +++++++++++++++-
> > -----
> >  .../Include/Protocol/UfsHostControllerPlatform.h   | 124
> +++++++++++++++
> >  MdeModulePkg/MdeModulePkg.dec                      |   3 +
> >  6 files changed, 324 insertions(+), 49 deletions(-)
> >  create mode 100644
> > MdeModulePkg/Include/Protocol/UfsHostControllerPlatform.h
> >
> > --
> > 2.14.1.windows.1
> 
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-13  2:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-09 14:36 [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Albecki, Mateusz
2019-08-09 14:36 ` [PATCHv3 1/4] MdeModulePkg: Add definition of the EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
2019-08-09 14:36 ` [PATCHv3 2/4] MdeModulePkg/UfsPassThruDxe: Refactor UfsExecUicCommand function Albecki, Mateusz
2019-08-09 14:36 ` [PATCHv3 3/4] MdeModulePkg/UfsPassThruDxe: Refactor private data to use EDKII_UFS_HC_INFO Albecki, Mateusz
2019-08-09 14:36 ` [PATCHv3 4/4] MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL Albecki, Mateusz
2019-08-12  2:38 ` [PATCHv3 0/4] Add EDKII_UFS_HC_PLATFORM_PROTOCOL to support platform specific programming of UFS host controllers Wu, Hao A
2019-08-13  2:56   ` [edk2-devel] " Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox