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