]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Protocol/UfsHostController.h
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / UfsHostController.h
index 83db1a7bbd0c9a8e70262d4a35e6c3c3180e809b..694ae3031532f04bb9c839443dcd2052cdaa284e 100644 (file)
@@ -2,13 +2,13 @@
 \r
   EDKII Universal Flash Storage Host Controller Protocol.\r
 \r
-Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
-This program and the accompanying materials are licensed and made available under \r
-the terms and conditions of the BSD License that accompanies this distribution.  \r
+Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available under\r
+the terms and conditions of the BSD License that accompanies this distribution.\r
 The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php.                                            \r
+http://opensource.org/licenses/bsd-license.php.\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
@@ -70,24 +70,24 @@ typedef enum {
   EdkiiUfsHcOperationMaximum\r
 } EDKII_UFS_HOST_CONTROLLER_OPERATION;\r
 \r
-/**                                                                 \r
+/**\r
   Provides the UFS controller-specific addresses needed to access system memory.\r
-            \r
+\r
   @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
   @param  Operation             Indicates if the bus master is going to read or write to system memory.\r
   @param  HostAddress           The system memory address to map to the UFS controller.\r
   @param  NumberOfBytes         On input the number of bytes to map. On output the number of bytes\r
-                                that were mapped.                                                 \r
+                                that were mapped.\r
   @param  DeviceAddress         The resulting map address for the bus master UFS controller to use to\r
-                                access the hosts HostAddress.                                        \r
+                                access the hosts HostAddress.\r
   @param  Mapping               A resulting value to pass to Unmap().\r
-                                  \r
+\r
   @retval EFI_SUCCESS           The range was mapped for the returned NumberOfBytes.\r
-  @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.                                \r
+  @retval EFI_UNSUPPORTED       The HostAddress cannot be mapped as a common buffer.\r
   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
   @retval EFI_DEVICE_ERROR      The system hardware could not map the requested address.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -100,15 +100,15 @@ EFI_STATUS
      OUT VOID                                 **Mapping\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Completes the Map() operation and releases any corresponding resources.\r
-            \r
-  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.                                      \r
+\r
+  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
   @param  Mapping               The mapping value returned from Map().\r
-                                  \r
+\r
   @retval EFI_SUCCESS           The range was unmapped.\r
   @retval EFI_DEVICE_ERROR      The data was not committed to the target system memory.\r
-                                   \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -117,25 +117,25 @@ EFI_STATUS
   IN  VOID                                   *Mapping\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer\r
-  mapping.                                                                       \r
-            \r
+  mapping.\r
+\r
   @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
   @param  Type                  This parameter is not used and must be ignored.\r
   @param  MemoryType            The type of memory to allocate, EfiBootServicesData or\r
-                                EfiRuntimeServicesData.                               \r
-  @param  Pages                 The number of pages to allocate.                                \r
+                                EfiRuntimeServicesData.\r
+  @param  Pages                 The number of pages to allocate.\r
   @param  HostAddress           A pointer to store the base system memory address of the\r
-                                allocated range.                                        \r
+                                allocated range.\r
   @param  Attributes            The requested bit mask of attributes for the allocated range.\r
-                                  \r
+\r
   @retval EFI_SUCCESS           The requested memory pages were allocated.\r
   @retval EFI_UNSUPPORTED       Attributes is unsupported. The only legal attribute bits are\r
-                                MEMORY_WRITE_COMBINE and MEMORY_CACHED.                     \r
+                                MEMORY_WRITE_COMBINE and MEMORY_CACHED.\r
   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
-  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.  \r
-                                   \r
+  @retval EFI_OUT_OF_RESOURCES  The memory pages could not be allocated.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -148,17 +148,17 @@ EFI_STATUS
   IN     UINT64                               Attributes\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Frees memory that was allocated with AllocateBuffer().\r
-            \r
-  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.  \r
-  @param  Pages                 The number of pages to free.                                \r
-  @param  HostAddress           The base system memory address of the allocated range.                                    \r
-                                  \r
+\r
+  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
+  @param  Pages                 The number of pages to free.\r
+  @param  HostAddress           The base system memory address of the allocated range.\r
+\r
   @retval EFI_SUCCESS           The requested memory pages were freed.\r
   @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r
                                 was not allocated with AllocateBuffer().\r
-                                     \r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -168,16 +168,16 @@ EFI_STATUS
   IN  VOID                                 *HostAddress\r
   );\r
 \r
-/**                                                                 \r
+/**\r
   Flushes all posted write transactions from the UFS bus to attached UFS device.\r
-            \r
-  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.  \r
-                                  \r
+\r
+  @param  This                  A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
+\r
   @retval EFI_SUCCESS           The posted write transactions were flushed from the UFS bus\r
-                                to attached UFS device.                                      \r
+                                to attached UFS device.\r
   @retval EFI_DEVICE_ERROR      The posted write transactions were not flushed from the UFS\r
-                                bus to attached UFS device due to a hardware error.                           \r
-                                     \r
+                                bus to attached UFS device due to a hardware error.\r
+\r
 **/\r
 typedef\r
 EFI_STATUS\r
@@ -185,6 +185,42 @@ EFI_STATUS
   IN  EDKII_UFS_HOST_CONTROLLER_PROTOCOL   *This\r
   );\r
 \r
+typedef enum {\r
+  EfiUfsHcWidthUint8      = 0,\r
+  EfiUfsHcWidthUint16,\r
+  EfiUfsHcWidthUint32,\r
+  EfiUfsHcWidthUint64,\r
+  EfiUfsHcWidthMaximum\r
+} EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH;\r
+\r
+/**\r
+  Enable a UFS bus driver to access UFS MMIO registers in the UFS Host Controller memory space.\r
+\r
+  @param  This                  A pointer to the EDKII_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
+  @param  Width                 Signifies the width of the memory operations.\r
+  @param  Offset                The offset within the UFS Host Controller MMIO space to start the\r
+                                memory operation.\r
+  @param  Count                 The number of memory operations to perform.\r
+  @param  Buffer                For read operations, the destination buffer to store the results.\r
+                                For write operations, the source buffer to write data from.\r
+\r
+  @retval EFI_SUCCESS           The data was read from or written to the UFS host controller.\r
+  @retval EFI_UNSUPPORTED       The address range specified by Offset, Width, and Count is not\r
+                                valid for the UFS Host Controller memory space.\r
+  @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.\r
+  @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_UFS_HC_MMIO_READ_WRITE)(\r
+  IN     EDKII_UFS_HOST_CONTROLLER_PROTOCOL        *This,\r
+  IN     EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH  Width,\r
+  IN     UINT64                                    Offset,\r
+  IN     UINTN                                     Count,\r
+  IN OUT VOID                                      *Buffer\r
+  );\r
+\r
 ///\r
 ///  UFS Host Controller Protocol structure.\r
 ///\r
@@ -195,6 +231,8 @@ struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL {
   EDKII_UFS_HC_MAP                    Map;\r
   EDKII_UFS_HC_UNMAP                  Unmap;\r
   EDKII_UFS_HC_FLUSH                  Flush;\r
+  EDKII_UFS_HC_MMIO_READ_WRITE        Read;\r
+  EDKII_UFS_HC_MMIO_READ_WRITE        Write;\r
 };\r
 \r
 ///\r