]>
Commit | Line | Data |
---|---|---|
0591696e FT |
1 | /** @file\r |
2 | UfsHcDxe driver is used to provide platform-dependent info, mainly UFS host controller\r | |
3 | MMIO base, to upper layer UFS drivers.\r | |
4 | \r | |
d1102dba | 5 | Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r |
0591696e FT |
6 | This program and the accompanying materials\r |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php.\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _EFI_UFS_HOST_CONTROLLER_H_\r | |
17 | #define _EFI_UFS_HOST_CONTROLLER_H_\r | |
18 | \r | |
19 | #include <Uefi.h>\r | |
20 | \r | |
21 | #include <IndustryStandard/Pci.h>\r | |
095f0779 | 22 | #include <IndustryStandard/Acpi.h>\r |
0591696e FT |
23 | \r |
24 | #include <Protocol/ComponentName.h>\r | |
25 | #include <Protocol/ComponentName2.h>\r | |
26 | #include <Protocol/DriverBinding.h>\r | |
27 | #include <Protocol/LoadedImage.h>\r | |
28 | #include <Protocol/DevicePath.h>\r | |
29 | #include <Protocol/PciIo.h>\r | |
30 | #include <Protocol/UfsHostController.h>\r | |
31 | \r | |
32 | #include <Library/BaseLib.h>\r | |
33 | #include <Library/DebugLib.h>\r | |
34 | #include <Library/UefiLib.h>\r | |
35 | #include <Library/DevicePathLib.h>\r | |
36 | #include <Library/MemoryAllocationLib.h>\r | |
37 | #include <Library/UefiBootServicesTableLib.h>\r | |
38 | #include <Library/UefiDriverEntryPoint.h>\r | |
39 | \r | |
40 | extern EFI_DRIVER_BINDING_PROTOCOL gUfsHcDriverBinding;\r | |
41 | extern EFI_COMPONENT_NAME_PROTOCOL gUfsHcComponentName;\r | |
42 | extern EFI_COMPONENT_NAME2_PROTOCOL gUfsHcComponentName2;\r | |
43 | \r | |
44 | //\r | |
45 | // Unique signature for private data structure.\r | |
46 | //\r | |
47 | #define UFS_HC_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('U','F','S','H')\r | |
48 | \r | |
49 | typedef struct _UFS_HOST_CONTROLLER_PRIVATE_DATA UFS_HOST_CONTROLLER_PRIVATE_DATA;\r | |
50 | \r | |
51 | //\r | |
c36ea72e | 52 | // Ufs host controller private data structure.\r |
0591696e FT |
53 | //\r |
54 | struct _UFS_HOST_CONTROLLER_PRIVATE_DATA {\r | |
55 | UINT32 Signature;\r | |
0591696e FT |
56 | \r |
57 | EDKII_UFS_HOST_CONTROLLER_PROTOCOL UfsHc;\r | |
d1102dba | 58 | EFI_PCI_IO_PROTOCOL *PciIo;\r |
095f0779 | 59 | UINT8 BarIndex;\r |
0591696e FT |
60 | UINT64 PciAttributes;\r |
61 | };\r | |
62 | \r | |
63 | #define UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC(a) \\r | |
64 | CR (a, \\r | |
65 | UFS_HOST_CONTROLLER_PRIVATE_DATA, \\r | |
66 | UfsHc, \\r | |
67 | UFS_HC_PRIVATE_DATA_SIGNATURE \\r | |
68 | )\r | |
69 | \r | |
70 | /**\r | |
71 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
72 | \r | |
73 | This function retrieves the user readable name of a driver in the form of a\r | |
74 | Unicode string. If the driver specified by This has a user readable name in\r | |
75 | the language specified by Language, then a pointer to the driver name is\r | |
76 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
77 | by This does not support the language specified by Language,\r | |
78 | then EFI_UNSUPPORTED is returned.\r | |
79 | \r | |
80 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
81 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
82 | \r | |
83 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
84 | array indicating the language. This is the\r | |
85 | language of the driver name that the caller is\r | |
86 | requesting, and it must match one of the\r | |
87 | languages specified in SupportedLanguages. The\r | |
88 | number of languages supported by a driver is up\r | |
89 | to the driver writer. Language is specified\r | |
90 | in RFC 4646 or ISO 639-2 language code format.\r | |
91 | \r | |
92 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
93 | This Unicode string is the name of the\r | |
94 | driver specified by This in the language\r | |
95 | specified by Language.\r | |
96 | \r | |
97 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
98 | This and the language specified by Language was\r | |
99 | returned in DriverName.\r | |
100 | \r | |
101 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
102 | \r | |
103 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
104 | \r | |
105 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
106 | the language specified by Language.\r | |
107 | \r | |
108 | **/\r | |
109 | EFI_STATUS\r | |
110 | EFIAPI\r | |
111 | UfsHcComponentNameGetDriverName (\r | |
112 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
113 | IN CHAR8 *Language,\r | |
114 | OUT CHAR16 **DriverName\r | |
115 | );\r | |
116 | \r | |
117 | /**\r | |
118 | Retrieves a Unicode string that is the user readable name of the controller\r | |
119 | that is being managed by a driver.\r | |
120 | \r | |
121 | This function retrieves the user readable name of the controller specified by\r | |
122 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
123 | driver specified by This has a user readable name in the language specified by\r | |
124 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
125 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
126 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
127 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
128 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
129 | \r | |
130 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
131 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
132 | \r | |
133 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
134 | specified by This is managing. This handle\r | |
135 | specifies the controller whose name is to be\r | |
136 | returned.\r | |
137 | \r | |
138 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
139 | the name of. This is an optional parameter that\r | |
140 | may be NULL. It will be NULL for device\r | |
141 | drivers. It will also be NULL for a bus drivers\r | |
142 | that wish to retrieve the name of the bus\r | |
143 | controller. It will not be NULL for a bus\r | |
144 | driver that wishes to retrieve the name of a\r | |
145 | child controller.\r | |
146 | \r | |
147 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
148 | array indicating the language. This is the\r | |
149 | language of the driver name that the caller is\r | |
150 | requesting, and it must match one of the\r | |
151 | languages specified in SupportedLanguages. The\r | |
152 | number of languages supported by a driver is up\r | |
153 | to the driver writer. Language is specified in\r | |
154 | RFC 4646 or ISO 639-2 language code format.\r | |
155 | \r | |
156 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
157 | This Unicode string is the name of the\r | |
158 | controller specified by ControllerHandle and\r | |
159 | ChildHandle in the language specified by\r | |
160 | Language from the point of view of the driver\r | |
161 | specified by This.\r | |
162 | \r | |
163 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
164 | the language specified by Language for the\r | |
165 | driver specified by This was returned in\r | |
166 | DriverName.\r | |
167 | \r | |
168 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
169 | \r | |
170 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
171 | EFI_HANDLE.\r | |
172 | \r | |
173 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
174 | \r | |
175 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
176 | \r | |
177 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
178 | managing the controller specified by\r | |
179 | ControllerHandle and ChildHandle.\r | |
180 | \r | |
181 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
182 | the language specified by Language.\r | |
183 | \r | |
184 | **/\r | |
185 | EFI_STATUS\r | |
186 | EFIAPI\r | |
187 | UfsHcComponentNameGetControllerName (\r | |
188 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
189 | IN EFI_HANDLE ControllerHandle,\r | |
190 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
191 | IN CHAR8 *Language,\r | |
192 | OUT CHAR16 **ControllerName\r | |
193 | );\r | |
194 | \r | |
195 | /**\r | |
196 | Tests to see if this driver supports a given controller. If a child device is provided,\r | |
197 | it further tests to see if this driver supports creating a handle for the specified child device.\r | |
198 | \r | |
199 | This function checks to see if the driver specified by This supports the device specified by\r | |
200 | ControllerHandle. Drivers will typically use the device path attached to\r | |
201 | ControllerHandle and/or the services from the bus I/O abstraction attached to\r | |
202 | ControllerHandle to determine if the driver supports ControllerHandle. This function\r | |
203 | may be called many times during platform initialization. In order to reduce boot times, the tests\r | |
204 | performed by this function must be very small, and take as little time as possible to execute. This\r | |
205 | function must not change the state of any hardware devices, and this function must be aware that the\r | |
206 | device specified by ControllerHandle may already be managed by the same driver or a\r | |
207 | different driver. This function must match its calls to AllocatePages() with FreePages(),\r | |
208 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r | |
209 | Since ControllerHandle may have been previously started by the same driver, if a protocol is\r | |
210 | already in the opened state, then it must not be closed with CloseProtocol(). This is required\r | |
211 | to guarantee the state of ControllerHandle is not modified by this function.\r | |
212 | \r | |
213 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
214 | @param[in] ControllerHandle The handle of the controller to test. This handle\r | |
215 | must support a protocol interface that supplies\r | |
216 | an I/O abstraction to the driver.\r | |
217 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r | |
218 | parameter is ignored by device drivers, and is optional for bus\r | |
219 | drivers. For bus drivers, if this parameter is not NULL, then\r | |
220 | the bus driver must determine if the bus controller specified\r | |
221 | by ControllerHandle and the child controller specified\r | |
222 | by RemainingDevicePath are both supported by this\r | |
223 | bus driver.\r | |
224 | \r | |
225 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
226 | RemainingDevicePath is supported by the driver specified by This.\r | |
227 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
228 | RemainingDevicePath is already being managed by the driver\r | |
229 | specified by This.\r | |
230 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
231 | RemainingDevicePath is already being managed by a different\r | |
232 | driver or an application that requires exclusive access.\r | |
233 | Currently not implemented.\r | |
234 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
235 | RemainingDevicePath is not supported by the driver specified by This.\r | |
236 | **/\r | |
237 | EFI_STATUS\r | |
238 | EFIAPI\r | |
239 | UfsHcDriverBindingSupported (\r | |
240 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
241 | IN EFI_HANDLE Controller,\r | |
242 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
243 | );\r | |
244 | \r | |
245 | /**\r | |
246 | Starts a device controller or a bus controller.\r | |
247 | \r | |
248 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
249 | As a result, much of the error checking on the parameters to Start() has been moved into this\r | |
250 | common boot service. It is legal to call Start() from other locations,\r | |
251 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
252 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
253 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
254 | EFI_DEVICE_PATH_PROTOCOL.\r | |
255 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
256 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r | |
257 | \r | |
258 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
259 | @param[in] ControllerHandle The handle of the controller to start. This handle\r | |
260 | must support a protocol interface that supplies\r | |
261 | an I/O abstraction to the driver.\r | |
262 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r | |
263 | parameter is ignored by device drivers, and is optional for bus\r | |
264 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
265 | for all the children of Controller are created by this driver.\r | |
266 | If this parameter is not NULL and the first Device Path Node is\r | |
267 | not the End of Device Path Node, then only the handle for the\r | |
268 | child device specified by the first Device Path Node of\r | |
269 | RemainingDevicePath is created by this driver.\r | |
270 | If the first Device Path Node of RemainingDevicePath is\r | |
271 | the End of Device Path Node, no child handle is created by this\r | |
272 | driver.\r | |
273 | \r | |
274 | @retval EFI_SUCCESS The device was started.\r | |
275 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
276 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
277 | @retval Others The driver failded to start the device.\r | |
278 | \r | |
279 | **/\r | |
280 | EFI_STATUS\r | |
281 | EFIAPI\r | |
282 | UfsHcDriverBindingStart (\r | |
283 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
284 | IN EFI_HANDLE Controller,\r | |
285 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
286 | );\r | |
287 | \r | |
288 | /**\r | |
289 | Stops a device controller or a bus controller.\r | |
290 | \r | |
291 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r | |
292 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
293 | into this common boot service. It is legal to call Stop() from other locations,\r | |
294 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
295 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
296 | same driver's Start() function.\r | |
297 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
298 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
299 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
300 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
301 | \r | |
302 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
303 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r | |
304 | support a bus specific I/O protocol for the driver\r | |
305 | to use to stop the device.\r | |
306 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
307 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r | |
308 | if NumberOfChildren is 0.\r | |
309 | \r | |
310 | @retval EFI_SUCCESS The device was stopped.\r | |
311 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
312 | \r | |
313 | **/\r | |
314 | EFI_STATUS\r | |
315 | EFIAPI\r | |
316 | UfsHcDriverBindingStop (\r | |
317 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
318 | IN EFI_HANDLE Controller,\r | |
319 | IN UINTN NumberOfChildren,\r | |
320 | IN EFI_HANDLE *ChildHandleBuffer\r | |
321 | );\r | |
322 | \r | |
323 | /**\r | |
324 | Get the MMIO base of the UFS host controller.\r | |
325 | \r | |
326 | @param[in] This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
327 | @param[out] MmioBar The MMIO base address of UFS host controller.\r | |
328 | \r | |
329 | @retval EFI_SUCCESS The operation succeeds.\r | |
330 | @retval others The operation fails.\r | |
331 | **/\r | |
332 | EFI_STATUS\r | |
333 | EFIAPI\r | |
334 | UfsHcGetMmioBar (\r | |
335 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
336 | OUT UINTN *MmioBar\r | |
337 | );\r | |
338 | \r | |
d1102dba | 339 | /**\r |
0591696e | 340 | Provides the UFS controller-specific addresses needed to access system memory.\r |
d1102dba | 341 | \r |
0591696e FT |
342 | @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r |
343 | @param Operation Indicates if the bus master is going to read or write to system memory.\r | |
344 | @param HostAddress The system memory address to map to the UFS controller.\r | |
345 | @param NumberOfBytes On input the number of bytes to map. On output the number of bytes\r | |
d1102dba | 346 | that were mapped.\r |
0591696e | 347 | @param DeviceAddress The resulting map address for the bus master UFS controller to use to\r |
d1102dba | 348 | access the hosts HostAddress.\r |
0591696e | 349 | @param Mapping A resulting value to pass to Unmap().\r |
d1102dba | 350 | \r |
0591696e | 351 | @retval EFI_SUCCESS The range was mapped for the returned NumberOfBytes.\r |
d1102dba | 352 | @retval EFI_UNSUPPORTED The HostAddress cannot be mapped as a common buffer.\r |
0591696e FT |
353 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r |
354 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
355 | @retval EFI_DEVICE_ERROR The system hardware could not map the requested address.\r | |
d1102dba | 356 | \r |
0591696e FT |
357 | **/\r |
358 | EFI_STATUS\r | |
359 | EFIAPI\r | |
360 | UfsHcMap (\r | |
361 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
362 | IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation,\r | |
363 | IN VOID *HostAddress,\r | |
364 | IN OUT UINTN *NumberOfBytes,\r | |
365 | OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r | |
366 | OUT VOID **Mapping\r | |
367 | );\r | |
368 | \r | |
d1102dba | 369 | /**\r |
0591696e | 370 | Completes the Map() operation and releases any corresponding resources.\r |
d1102dba LG |
371 | \r |
372 | @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
0591696e | 373 | @param Mapping The mapping value returned from Map().\r |
d1102dba | 374 | \r |
0591696e FT |
375 | @retval EFI_SUCCESS The range was unmapped.\r |
376 | @retval EFI_DEVICE_ERROR The data was not committed to the target system memory.\r | |
d1102dba | 377 | \r |
0591696e FT |
378 | **/\r |
379 | EFI_STATUS\r | |
380 | EFIAPI\r | |
381 | UfsHcUnmap (\r | |
382 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
383 | IN VOID *Mapping\r | |
384 | );\r | |
385 | \r | |
d1102dba | 386 | /**\r |
0591696e | 387 | Allocates pages that are suitable for an EfiUfsHcOperationBusMasterCommonBuffer\r |
d1102dba LG |
388 | mapping.\r |
389 | \r | |
0591696e FT |
390 | @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r |
391 | @param Type This parameter is not used and must be ignored.\r | |
392 | @param MemoryType The type of memory to allocate, EfiBootServicesData or\r | |
d1102dba LG |
393 | EfiRuntimeServicesData.\r |
394 | @param Pages The number of pages to allocate.\r | |
0591696e | 395 | @param HostAddress A pointer to store the base system memory address of the\r |
d1102dba | 396 | allocated range.\r |
0591696e | 397 | @param Attributes The requested bit mask of attributes for the allocated range.\r |
d1102dba | 398 | \r |
0591696e FT |
399 | @retval EFI_SUCCESS The requested memory pages were allocated.\r |
400 | @retval EFI_UNSUPPORTED Attributes is unsupported. The only legal attribute bits are\r | |
d1102dba | 401 | MEMORY_WRITE_COMBINE and MEMORY_CACHED.\r |
0591696e | 402 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r |
d1102dba LG |
403 | @retval EFI_OUT_OF_RESOURCES The memory pages could not be allocated.\r |
404 | \r | |
0591696e FT |
405 | **/\r |
406 | EFI_STATUS\r | |
407 | EFIAPI\r | |
408 | UfsHcAllocateBuffer (\r | |
409 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
410 | IN EFI_ALLOCATE_TYPE Type,\r | |
411 | IN EFI_MEMORY_TYPE MemoryType,\r | |
412 | IN UINTN Pages,\r | |
413 | OUT VOID **HostAddress,\r | |
414 | IN UINT64 Attributes\r | |
415 | );\r | |
416 | \r | |
d1102dba | 417 | /**\r |
0591696e | 418 | Frees memory that was allocated with AllocateBuffer().\r |
d1102dba LG |
419 | \r |
420 | @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
421 | @param Pages The number of pages to free.\r | |
422 | @param HostAddress The base system memory address of the allocated range.\r | |
423 | \r | |
0591696e FT |
424 | @retval EFI_SUCCESS The requested memory pages were freed.\r |
425 | @retval EFI_INVALID_PARAMETER The memory range specified by HostAddress and Pages\r | |
426 | was not allocated with AllocateBuffer().\r | |
d1102dba | 427 | \r |
0591696e FT |
428 | **/\r |
429 | EFI_STATUS\r | |
430 | EFIAPI\r | |
431 | UfsHcFreeBuffer (\r | |
432 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
433 | IN UINTN Pages,\r | |
434 | IN VOID *HostAddress\r | |
435 | );\r | |
436 | \r | |
d1102dba | 437 | /**\r |
0591696e | 438 | Flushes all posted write transactions from the UFS bus to attached UFS device.\r |
d1102dba LG |
439 | \r |
440 | @param This A pointer to the EFI_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
441 | \r | |
0591696e | 442 | @retval EFI_SUCCESS The posted write transactions were flushed from the UFS bus\r |
d1102dba | 443 | to attached UFS device.\r |
0591696e | 444 | @retval EFI_DEVICE_ERROR The posted write transactions were not flushed from the UFS\r |
d1102dba LG |
445 | bus to attached UFS device due to a hardware error.\r |
446 | \r | |
0591696e FT |
447 | **/\r |
448 | EFI_STATUS\r | |
449 | EFIAPI\r | |
450 | UfsHcFlush (\r | |
451 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This\r | |
452 | );\r | |
453 | \r | |
d1102dba | 454 | /**\r |
095f0779 FT |
455 | Enable a UFS bus driver to access UFS MMIO registers in the UFS Host Controller memory space.\r |
456 | \r | |
457 | @param This A pointer to the EDKII_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
458 | @param Width Signifies the width of the memory operations.\r | |
459 | @param Offset The offset within the UFS Host Controller MMIO space to start the\r | |
460 | memory operation.\r | |
461 | @param Count The number of memory operations to perform.\r | |
462 | @param Buffer For read operations, the destination buffer to store the results.\r | |
463 | For write operations, the source buffer to write data from.\r | |
464 | \r | |
465 | @retval EFI_SUCCESS The data was read from or written to the UFS host controller.\r | |
466 | @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not\r | |
467 | valid for the UFS Host Controller memory space.\r | |
468 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
469 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
470 | \r | |
471 | **/\r | |
472 | EFI_STATUS\r | |
473 | EFIAPI\r | |
474 | UfsHcMmioRead (\r | |
475 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
476 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width,\r | |
477 | IN UINT64 Offset,\r | |
478 | IN UINTN Count,\r | |
479 | IN OUT VOID *Buffer\r | |
480 | );\r | |
481 | \r | |
d1102dba | 482 | /**\r |
095f0779 FT |
483 | Enable a UFS bus driver to access UFS MMIO registers in the UFS Host Controller memory space.\r |
484 | \r | |
485 | @param This A pointer to the EDKII_UFS_HOST_CONTROLLER_PROTOCOL instance.\r | |
486 | @param Width Signifies the width of the memory operations.\r | |
487 | @param Offset The offset within the UFS Host Controller MMIO space to start the\r | |
488 | memory operation.\r | |
489 | @param Count The number of memory operations to perform.\r | |
490 | @param Buffer For read operations, the destination buffer to store the results.\r | |
491 | For write operations, the source buffer to write data from.\r | |
492 | \r | |
493 | @retval EFI_SUCCESS The data was read from or written to the UFS host controller.\r | |
494 | @retval EFI_UNSUPPORTED The address range specified by Offset, Width, and Count is not\r | |
495 | valid for the UFS Host Controller memory space.\r | |
496 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
497 | @retval EFI_INVALID_PARAMETER One or more parameters are invalid.\r | |
498 | \r | |
499 | **/\r | |
500 | EFI_STATUS\r | |
501 | EFIAPI\r | |
502 | UfsHcMmioWrite (\r | |
503 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This,\r | |
504 | IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width,\r | |
505 | IN UINT64 Offset,\r | |
506 | IN UINTN Count,\r | |
507 | IN OUT VOID *Buffer\r | |
508 | );\r | |
509 | \r | |
0591696e | 510 | #endif\r |