]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Protocol/UfsHostController.h
MdeModulePkg: Add match2 opcode support in SetupBrowserDxe and sample code in DriverS...
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / UfsHostController.h
CommitLineData
0591696e
FT
1/** @file\r
2\r
3 EDKII Universal Flash Storage Host Controller Protocol.\r
4\r
5Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials are licensed and made available under \r
7the terms and conditions of the BSD License that accompanies this distribution. \r
8The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php. \r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16\r
17#ifndef __EDKII_UFS_HC_PROTOCOL_H__\r
18#define __EDKII_UFS_HC_PROTOCOL_H__\r
19\r
20//\r
21// UFS Host Controller Protocol GUID value\r
22//\r
23#define EDKII_UFS_HOST_CONTROLLER_PROTOCOL_GUID \\r
24 { \\r
25 0xebc01af5, 0x7a9, 0x489e, { 0xb7, 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } \\r
26 }\r
27\r
28//\r
29// Forward reference for pure ANSI compatability\r
30//\r
31typedef struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL EDKII_UFS_HOST_CONTROLLER_PROTOCOL;\r
32\r
33\r
34/**\r
35 Get the MMIO base address of UFS host controller.\r
36\r
37 @param This The protocol instance pointer.\r
38 @param MmioBar Pointer to the UFS host controller MMIO base address.\r
39\r
40 @retval EFI_SUCCESS The operation succeeds.\r
41 @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
42\r
43**/\r
44typedef\r
45EFI_STATUS\r
46(EFIAPI *EDKII_UFS_HC_GET_MMIO_BAR)(\r
47 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r
48 OUT UINTN *MmioBar\r
49 );\r
50\r
51///\r
52/// *******************************************************\r
53/// EFI_UFS_HOST_CONTROLLER_OPERATION\r
54/// *******************************************************\r
55///\r
56typedef enum {\r
57 ///\r
58 /// A read operation from system memory by a bus master.\r
59 ///\r
60 EdkiiUfsHcOperationBusMasterRead,\r
61 ///\r
62 /// A write operation from system memory by a bus master.\r
63 ///\r
64 EdkiiUfsHcOperationBusMasterWrite,\r
65 ///\r
66 /// Provides both read and write access to system memory by both the processor and a\r
67 /// bus master. The buffer is coherent from both the processor's and the bus master's point of view.\r
68 ///\r
69 EdkiiUfsHcOperationBusMasterCommonBuffer,\r
70 EdkiiUfsHcOperationMaximum\r
71} EDKII_UFS_HOST_CONTROLLER_OPERATION;\r
72\r
73/** \r
74 Provides the UFS controller-specific addresses needed to access system memory.\r
75 \r
76 @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
77 @param Operation Indicates if the bus master is going to read or write to system memory.\r
78 @param HostAddress The system memory address to map to the UFS controller.\r
79 @param NumberOfBytes On input the number of bytes to map. On output the number of bytes\r
80 that were mapped. \r
81 @param DeviceAddress The resulting map address for the bus master UFS controller to use to\r
82 access the hosts HostAddress. \r
83 @param Mapping A resulting value to pass to Unmap().\r
84 \r
85 @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r
86 @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer. \r
87 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
88 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
89 @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r
90 \r
91**/\r
92typedef\r
93EFI_STATUS\r
94(EFIAPI *EDKII_UFS_HC_MAP)(\r
95 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r
96 IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation,\r
97 IN VOID *HostAddress,\r
98 IN OUT UINTN *NumberOfBytes,\r
99 OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
100 OUT VOID **Mapping\r
101 );\r
102\r
103/** \r
104 Completes the Map() operation and releases any corresponding resources.\r
105 \r
106 @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. \r
107 @param Mapping The mapping value returned from Map().\r
108 \r
109 @retval EFI_SUCCESS The range was unmapped.\r
110 @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r
111 \r
112**/\r
113typedef\r
114EFI_STATUS\r
115(EFIAPI *EDKII_UFS_HC_UNMAP)(\r
116 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r
117 IN VOID *Mapping\r
118 );\r
119\r
120/** \r
121 Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer\r
122 mapping. \r
123 \r
124 @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r
125 @param Type This parameter is not used and must be ignored.\r
126 @param MemoryType The type of memory to allocate, EfiBootServicesData or\r
127 EfiRuntimeServicesData. \r
128 @param Pages The number of pages to allocate. \r
129 @param HostAddress A pointer to store the base system memory address of the\r
130 allocated range. \r
131 @param Attributes The requested bit mask of attributes for the allocated range.\r
132 \r
133 @retval EFI_SUCCESS The requested memory pages were allocated.\r
134 @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are\r
135 MEMORY_WRITE_COMBINE and MEMORY_CACHED. \r
136 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r
137 @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated. \r
138 \r
139**/\r
140typedef\r
141EFI_STATUS\r
142(EFIAPI *EDKII_UFS_HC_ALLOCATE_BUFFER)(\r
143 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r
144 IN EFI_ALLOCATE_TYPE Type,\r
145 IN EFI_MEMORY_TYPE MemoryType,\r
146 IN UINTN Pages,\r
147 OUT VOID **HostAddress,\r
148 IN UINT64 Attributes\r
149 );\r
150\r
151/** \r
152 Frees memory that was allocated with AllocateBuffer().\r
153 \r
154 @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. \r
155 @param Pages The number of pages to free. \r
156 @param HostAddress The base system memory address of the allocated range. \r
157 \r
158 @retval EFI_SUCCESS The requested memory pages were freed.\r
159 @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r
160 was not allocated with AllocateBuffer().\r
161 \r
162**/\r
163typedef\r
164EFI_STATUS\r
165(EFIAPI *EDKII_UFS_HC_FREE_BUFFER)(\r
166 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r
167 IN UINTN Pages,\r
168 IN VOID *HostAddress\r
169 );\r
170\r
171/** \r
172 Flushes all posted write transactions from the UFS bus to attached UFS device.\r
173 \r
174 @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance. \r
175 \r
176 @retval EFI_SUCCESS The posted write transactions were flushed from the UFS bus\r
177 to attached UFS device. \r
178 @retval EFI_DEVICE_ERROR The posted write transactions were not flushed from the UFS\r
179 bus to attached UFS device due to a hardware error. \r
180 \r
181**/\r
182typedef\r
183EFI_STATUS\r
184(EFIAPI *EDKII_UFS_HC_FLUSH)(\r
185 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This\r
186 );\r
187\r
188///\r
189/// UFS Host Controller Protocol structure.\r
190///\r
191struct _EDKII_UFS_HOST_CONTROLLER_PROTOCOL {\r
192 EDKII_UFS_HC_GET_MMIO_BAR GetUfsHcMmioBar;\r
193 EDKII_UFS_HC_ALLOCATE_BUFFER AllocateBuffer;\r
194 EDKII_UFS_HC_FREE_BUFFER FreeBuffer;\r
195 EDKII_UFS_HC_MAP Map;\r
196 EDKII_UFS_HC_UNMAP Unmap;\r
197 EDKII_UFS_HC_FLUSH Flush;\r
198};\r
199\r
200///\r
201/// UFS Host Controller Protocol GUID variable.\r
202///\r
203extern EFI_GUID gEdkiiUfsHostControllerProtocolGuid;\r
204\r
205#endif\r