]>
Commit | Line | Data |
---|---|---|
0591696e FT |
1 | /** @file\r |
2 | \r | |
90952ad7 | 3 | Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 4 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
0591696e FT |
5 | \r |
6 | **/\r | |
7 | \r | |
8 | #ifndef _UFS_PASS_THRU_H_\r | |
9 | #define _UFS_PASS_THRU_H_\r | |
10 | \r | |
11 | #include <Uefi.h>\r | |
12 | \r | |
13 | #include <Protocol/ScsiPassThruExt.h>\r | |
32c9049d | 14 | #include <Protocol/UfsDeviceConfig.h>\r |
0591696e | 15 | #include <Protocol/UfsHostController.h>\r |
90952ad7 | 16 | #include <Protocol/UfsHostControllerPlatform.h>\r |
0591696e FT |
17 | \r |
18 | #include <Library/DebugLib.h>\r | |
19 | #include <Library/UefiDriverEntryPoint.h>\r | |
20 | #include <Library/BaseLib.h>\r | |
21 | #include <Library/UefiLib.h>\r | |
22 | #include <Library/BaseMemoryLib.h>\r | |
23 | #include <Library/MemoryAllocationLib.h>\r | |
24 | #include <Library/UefiBootServicesTableLib.h>\r | |
25 | #include <Library/DevicePathLib.h>\r | |
0591696e FT |
26 | #include <Library/TimerLib.h>\r |
27 | \r | |
28 | #include "UfsPassThruHci.h"\r | |
29 | \r | |
30 | #define UFS_PASS_THRU_SIG SIGNATURE_32 ('U', 'F', 'S', 'P')\r | |
31 | \r | |
32 | //\r | |
d1102dba | 33 | // Lun 0~7 is for 8 common luns.\r |
0591696e FT |
34 | // Lun 8~11 is for those 4 well known luns (Refer to UFS 2.0 spec Table 10.58 for details):\r |
35 | // Lun 8: REPORT LUNS\r | |
36 | // Lun 9: UFS DEVICE\r | |
37 | // Lun 10: BOOT\r | |
38 | // Lun 11: RPMB\r | |
39 | //\r | |
40 | #define UFS_MAX_LUNS 12\r | |
41 | #define UFS_WLUN_PREFIX 0xC1\r | |
42 | \r | |
43 | typedef struct {\r | |
44 | UINT8 Lun[UFS_MAX_LUNS];\r | |
45 | UINT16 BitMask:12; // Bit 0~7 is 1/1 mapping to common luns. Bit 8~11 is 1/1 mapping to well-known luns.\r | |
46 | UINT16 Rsvd:4;\r | |
47 | } UFS_EXPOSED_LUNS;\r | |
48 | \r | |
0350b57c | 49 | //\r |
ed356b9e | 50 | // Iterate through the double linked list. This is delete-safe.\r |
0350b57c HW |
51 | // Do not touch NextEntry\r |
52 | //\r | |
53 | #define EFI_LIST_FOR_EACH_SAFE(Entry, NextEntry, ListHead) \\r | |
54 | for(Entry = (ListHead)->ForwardLink, NextEntry = Entry->ForwardLink;\\r | |
55 | Entry != (ListHead); Entry = NextEntry, NextEntry = Entry->ForwardLink)\r | |
56 | \r | |
d1102dba | 57 | typedef struct _UFS_PASS_THRU_PRIVATE_DATA {\r |
0591696e FT |
58 | UINT32 Signature;\r |
59 | EFI_HANDLE Handle;\r | |
60 | EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;\r | |
61 | EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;\r | |
32c9049d | 62 | EFI_UFS_DEVICE_CONFIG_PROTOCOL UfsDevConfig;\r |
0591696e FT |
63 | EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHostController;\r |
64 | UINTN UfsHcBase;\r | |
a71272ed | 65 | EDKII_UFS_HC_INFO UfsHcInfo;\r |
ecc32c90 | 66 | EDKII_UFS_HC_DRIVER_INTERFACE UfsHcDriverInterface;\r |
0591696e FT |
67 | \r |
68 | UINT8 TaskTag;\r | |
69 | \r | |
70 | VOID *UtpTrlBase;\r | |
71 | UINT8 Nutrs;\r | |
72 | VOID *TrlMapping;\r | |
73 | VOID *UtpTmrlBase;\r | |
74 | UINT8 Nutmrs;\r | |
75 | VOID *TmrlMapping;\r | |
76 | \r | |
77 | UFS_EXPOSED_LUNS Luns;\r | |
0350b57c HW |
78 | \r |
79 | //\r | |
80 | // For Non-blocking operation.\r | |
81 | //\r | |
82 | EFI_EVENT TimerEvent;\r | |
83 | LIST_ENTRY Queue;\r | |
0591696e FT |
84 | } UFS_PASS_THRU_PRIVATE_DATA;\r |
85 | \r | |
0350b57c HW |
86 | #define UFS_PASS_THRU_TRANS_REQ_SIG SIGNATURE_32 ('U', 'F', 'S', 'T')\r |
87 | \r | |
88 | typedef struct {\r | |
89 | UINT32 Signature;\r | |
90 | LIST_ENTRY TransferList;\r | |
91 | \r | |
92 | UINT8 Slot;\r | |
93 | UTP_TRD *Trd;\r | |
94 | UINT32 CmdDescSize;\r | |
95 | VOID *CmdDescHost;\r | |
96 | VOID *CmdDescMapping;\r | |
a37e18f6 AM |
97 | VOID *AlignedDataBuf;\r |
98 | UINTN AlignedDataBufSize;\r | |
0350b57c HW |
99 | VOID *DataBufMapping;\r |
100 | \r | |
101 | EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet;\r | |
102 | UINT64 TimeoutRemain;\r | |
103 | EFI_EVENT CallerEvent;\r | |
104 | } UFS_PASS_THRU_TRANS_REQ;\r | |
105 | \r | |
106 | #define UFS_PASS_THRU_TRANS_REQ_FROM_THIS(a) \\r | |
107 | CR(a, UFS_PASS_THRU_TRANS_REQ, TransferList, UFS_PASS_THRU_TRANS_REQ_SIG)\r | |
108 | \r | |
0591696e | 109 | #define UFS_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)\r |
0350b57c | 110 | #define UFS_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS(1)\r |
0591696e FT |
111 | \r |
112 | #define ROUNDUP8(x) (((x) % 8 == 0) ? (x) : ((x) / 8 + 1) * 8)\r | |
113 | \r | |
114 | #define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r | |
115 | \r | |
116 | #define UFS_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \\r | |
117 | CR (a, \\r | |
118 | UFS_PASS_THRU_PRIVATE_DATA, \\r | |
119 | ExtScsiPassThru, \\r | |
120 | UFS_PASS_THRU_SIG \\r | |
121 | )\r | |
122 | \r | |
32c9049d HW |
123 | #define UFS_PASS_THRU_PRIVATE_DATA_FROM_DEV_CONFIG(a) \\r |
124 | CR (a, \\r | |
125 | UFS_PASS_THRU_PRIVATE_DATA, \\r | |
126 | UfsDevConfig, \\r | |
127 | UFS_PASS_THRU_SIG \\r | |
128 | )\r | |
129 | \r | |
ecc32c90 AM |
130 | #define UFS_PASS_THRU_PRIVATE_DATA_FROM_DRIVER_INTF(a) \\r |
131 | CR (a, \\r | |
132 | UFS_PASS_THRU_PRIVATE_DATA, \\r | |
133 | UfsHcDriverInterface, \\r | |
134 | UFS_PASS_THRU_SIG \\r | |
135 | )\r | |
136 | \r | |
0591696e FT |
137 | typedef struct _UFS_DEVICE_MANAGEMENT_REQUEST_PACKET {\r |
138 | UINT64 Timeout;\r | |
95ad8f7f | 139 | VOID *DataBuffer;\r |
0591696e FT |
140 | UINT8 Opcode;\r |
141 | UINT8 DescId;\r | |
142 | UINT8 Index;\r | |
143 | UINT8 Selector;\r | |
95ad8f7f | 144 | UINT32 TransferLength;\r |
0591696e | 145 | UINT8 DataDirection;\r |
0591696e FT |
146 | } UFS_DEVICE_MANAGEMENT_REQUEST_PACKET;\r |
147 | \r | |
148 | //\r | |
149 | // function prototype\r | |
150 | //\r | |
151 | /**\r | |
152 | Tests to see if this driver supports a given controller. If a child device is provided,\r | |
153 | it further tests to see if this driver supports creating a handle for the specified child device.\r | |
154 | \r | |
155 | This function checks to see if the driver specified by This supports the device specified by\r | |
156 | ControllerHandle. Drivers will typically use the device path attached to\r | |
157 | ControllerHandle and/or the services from the bus I/O abstraction attached to\r | |
158 | ControllerHandle to determine if the driver supports ControllerHandle. This function\r | |
159 | may be called many times during platform initialization. In order to reduce boot times, the tests\r | |
160 | performed by this function must be very small, and take as little time as possible to execute. This\r | |
161 | function must not change the state of any hardware devices, and this function must be aware that the\r | |
162 | device specified by ControllerHandle may already be managed by the same driver or a\r | |
163 | different driver. This function must match its calls to AllocatePages() with FreePages(),\r | |
164 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r | |
165 | Since ControllerHandle may have been previously started by the same driver, if a protocol is\r | |
166 | already in the opened state, then it must not be closed with CloseProtocol(). This is required\r | |
167 | to guarantee the state of ControllerHandle is not modified by this function.\r | |
168 | \r | |
169 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
170 | @param[in] ControllerHandle The handle of the controller to test. This handle\r | |
171 | must support a protocol interface that supplies\r | |
172 | an I/O abstraction to the driver.\r | |
173 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r | |
174 | parameter is ignored by device drivers, and is optional for bus\r | |
175 | drivers. For bus drivers, if this parameter is not NULL, then\r | |
176 | the bus driver must determine if the bus controller specified\r | |
177 | by ControllerHandle and the child controller specified\r | |
178 | by RemainingDevicePath are both supported by this\r | |
179 | bus driver.\r | |
180 | \r | |
181 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
182 | RemainingDevicePath is supported by the driver specified by This.\r | |
183 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
184 | RemainingDevicePath is already being managed by the driver\r | |
185 | specified by This.\r | |
186 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
187 | RemainingDevicePath is already being managed by a different\r | |
188 | driver or an application that requires exclusive access.\r | |
189 | Currently not implemented.\r | |
190 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
191 | RemainingDevicePath is not supported by the driver specified by This.\r | |
192 | **/\r | |
193 | EFI_STATUS\r | |
194 | EFIAPI\r | |
195 | UfsPassThruDriverBindingSupported (\r | |
196 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
197 | IN EFI_HANDLE Controller,\r | |
198 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
199 | );\r | |
200 | \r | |
201 | /**\r | |
202 | Starts a device controller or a bus controller.\r | |
203 | \r | |
204 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
205 | As a result, much of the error checking on the parameters to Start() has been moved into this\r | |
206 | common boot service. It is legal to call Start() from other locations,\r | |
207 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
208 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
209 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
210 | EFI_DEVICE_PATH_PROTOCOL.\r | |
211 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
212 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r | |
213 | \r | |
214 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
215 | @param[in] ControllerHandle The handle of the controller to start. This handle\r | |
216 | must support a protocol interface that supplies\r | |
217 | an I/O abstraction to the driver.\r | |
218 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r | |
219 | parameter is ignored by device drivers, and is optional for bus\r | |
220 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
221 | for all the children of Controller are created by this driver.\r | |
222 | If this parameter is not NULL and the first Device Path Node is\r | |
223 | not the End of Device Path Node, then only the handle for the\r | |
224 | child device specified by the first Device Path Node of\r | |
225 | RemainingDevicePath is created by this driver.\r | |
226 | If the first Device Path Node of RemainingDevicePath is\r | |
227 | the End of Device Path Node, no child handle is created by this\r | |
228 | driver.\r | |
229 | \r | |
230 | @retval EFI_SUCCESS The device was started.\r | |
231 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
232 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
233 | @retval Others The driver failded to start the device.\r | |
234 | \r | |
235 | **/\r | |
236 | EFI_STATUS\r | |
237 | EFIAPI\r | |
238 | UfsPassThruDriverBindingStart (\r | |
239 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
240 | IN EFI_HANDLE Controller,\r | |
241 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
242 | );\r | |
243 | \r | |
244 | /**\r | |
245 | Stops a device controller or a bus controller.\r | |
246 | \r | |
247 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r | |
248 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
249 | into this common boot service. It is legal to call Stop() from other locations,\r | |
250 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
251 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
252 | same driver's Start() function.\r | |
253 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
254 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
255 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
256 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
257 | \r | |
258 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
259 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r | |
260 | support a bus specific I/O protocol for the driver\r | |
261 | to use to stop the device.\r | |
262 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
263 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r | |
264 | if NumberOfChildren is 0.\r | |
265 | \r | |
266 | @retval EFI_SUCCESS The device was stopped.\r | |
267 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
268 | \r | |
269 | **/\r | |
270 | EFI_STATUS\r | |
271 | EFIAPI\r | |
272 | UfsPassThruDriverBindingStop (\r | |
273 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
274 | IN EFI_HANDLE Controller,\r | |
275 | IN UINTN NumberOfChildren,\r | |
276 | IN EFI_HANDLE *ChildHandleBuffer\r | |
277 | );\r | |
278 | \r | |
279 | //\r | |
280 | // EFI Component Name Functions\r | |
281 | //\r | |
282 | /**\r | |
283 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
284 | \r | |
285 | This function retrieves the user readable name of a driver in the form of a\r | |
286 | Unicode string. If the driver specified by This has a user readable name in\r | |
287 | the language specified by Language, then a pointer to the driver name is\r | |
288 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
289 | by This does not support the language specified by Language,\r | |
290 | then EFI_UNSUPPORTED is returned.\r | |
291 | \r | |
292 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
293 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
294 | \r | |
295 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
296 | array indicating the language. This is the\r | |
297 | language of the driver name that the caller is\r | |
298 | requesting, and it must match one of the\r | |
299 | languages specified in SupportedLanguages. The\r | |
300 | number of languages supported by a driver is up\r | |
301 | to the driver writer. Language is specified\r | |
302 | in RFC 4646 or ISO 639-2 language code format.\r | |
303 | \r | |
304 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
305 | This Unicode string is the name of the\r | |
306 | driver specified by This in the language\r | |
307 | specified by Language.\r | |
308 | \r | |
309 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
310 | This and the language specified by Language was\r | |
311 | returned in DriverName.\r | |
312 | \r | |
313 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
314 | \r | |
315 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
316 | \r | |
317 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
318 | the language specified by Language.\r | |
319 | \r | |
320 | **/\r | |
321 | EFI_STATUS\r | |
322 | EFIAPI\r | |
323 | UfsPassThruComponentNameGetDriverName (\r | |
324 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
325 | IN CHAR8 *Language,\r | |
326 | OUT CHAR16 **DriverName\r | |
327 | );\r | |
328 | \r | |
329 | \r | |
330 | /**\r | |
331 | Retrieves a Unicode string that is the user readable name of the controller\r | |
332 | that is being managed by a driver.\r | |
333 | \r | |
334 | This function retrieves the user readable name of the controller specified by\r | |
335 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
336 | driver specified by This has a user readable name in the language specified by\r | |
337 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
338 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
339 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
340 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
341 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
342 | \r | |
343 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
344 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
345 | \r | |
346 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
347 | specified by This is managing. This handle\r | |
348 | specifies the controller whose name is to be\r | |
349 | returned.\r | |
350 | \r | |
351 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
352 | the name of. This is an optional parameter that\r | |
353 | may be NULL. It will be NULL for device\r | |
354 | drivers. It will also be NULL for a bus drivers\r | |
355 | that wish to retrieve the name of the bus\r | |
356 | controller. It will not be NULL for a bus\r | |
357 | driver that wishes to retrieve the name of a\r | |
358 | child controller.\r | |
359 | \r | |
360 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
361 | array indicating the language. This is the\r | |
362 | language of the driver name that the caller is\r | |
363 | requesting, and it must match one of the\r | |
364 | languages specified in SupportedLanguages. The\r | |
365 | number of languages supported by a driver is up\r | |
366 | to the driver writer. Language is specified in\r | |
367 | RFC 4646 or ISO 639-2 language code format.\r | |
368 | \r | |
369 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
370 | This Unicode string is the name of the\r | |
371 | controller specified by ControllerHandle and\r | |
372 | ChildHandle in the language specified by\r | |
373 | Language from the point of view of the driver\r | |
374 | specified by This.\r | |
375 | \r | |
376 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
377 | the language specified by Language for the\r | |
378 | driver specified by This was returned in\r | |
379 | DriverName.\r | |
380 | \r | |
381 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r | |
382 | \r | |
383 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
384 | EFI_HANDLE.\r | |
385 | \r | |
386 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
387 | \r | |
388 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
389 | \r | |
390 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
391 | managing the controller specified by\r | |
392 | ControllerHandle and ChildHandle.\r | |
393 | \r | |
394 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
395 | the language specified by Language.\r | |
396 | \r | |
397 | **/\r | |
398 | EFI_STATUS\r | |
399 | EFIAPI\r | |
400 | UfsPassThruComponentNameGetControllerName (\r | |
401 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
402 | IN EFI_HANDLE ControllerHandle,\r | |
403 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
404 | IN CHAR8 *Language,\r | |
405 | OUT CHAR16 **ControllerName\r | |
406 | );\r | |
407 | \r | |
408 | /**\r | |
409 | Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function\r | |
410 | supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r | |
411 | nonblocking I/O functionality is optional.\r | |
412 | \r | |
413 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
414 | @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r | |
415 | the id of the SCSI device to send the SCSI Request Packet. Each\r | |
416 | transport driver may choose to utilize a subset of this size to suit the needs\r | |
417 | of transport target representation. For example, a Fibre Channel driver\r | |
418 | may use only 8 bytes (WWN) to represent an FC target.\r | |
419 | @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r | |
420 | @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r | |
421 | specified by Target and Lun.\r | |
422 | @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r | |
423 | I/O is performed. If Event is NULL, then blocking I/O is performed. If\r | |
424 | Event is not NULL and non blocking I/O is supported, then\r | |
425 | nonblocking I/O is performed, and Event will be signaled when the\r | |
426 | SCSI Request Packet completes.\r | |
427 | \r | |
428 | @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r | |
429 | commands, InTransferLength bytes were transferred from\r | |
430 | InDataBuffer. For write and bi-directional commands,\r | |
431 | OutTransferLength bytes were transferred by\r | |
432 | OutDataBuffer.\r | |
433 | @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r | |
434 | could be transferred is returned in InTransferLength. For write\r | |
435 | and bi-directional commands, OutTransferLength bytes were\r | |
436 | transferred by OutDataBuffer.\r | |
437 | @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r | |
438 | SCSI Request Packets already queued. The caller may retry again later.\r | |
439 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r | |
440 | Packet.\r | |
441 | @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r | |
442 | @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r | |
443 | by the host adapter. This includes the case of Bi-directional SCSI\r | |
444 | commands not supported by the implementation. The SCSI Request\r | |
445 | Packet was not sent, so no additional status information is available.\r | |
446 | @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r | |
447 | \r | |
448 | **/\r | |
449 | EFI_STATUS\r | |
450 | EFIAPI\r | |
451 | UfsPassThruPassThru (\r | |
452 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
453 | IN UINT8 *Target,\r | |
454 | IN UINT64 Lun,\r | |
455 | IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r | |
456 | IN EFI_EVENT Event OPTIONAL\r | |
457 | );\r | |
458 | \r | |
459 | /**\r | |
460 | Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These\r | |
461 | can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r | |
462 | Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the\r | |
463 | Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI\r | |
464 | channel.\r | |
465 | \r | |
466 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
467 | @param Target On input, a pointer to the Target ID (an array of size\r | |
468 | TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r | |
469 | On output, a pointer to the Target ID (an array of\r | |
470 | TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r | |
471 | channel. An input value of 0xF(all bytes in the array are 0xF) in the\r | |
472 | Target array retrieves the Target ID of the first SCSI device present on a\r | |
473 | SCSI channel.\r | |
474 | @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r | |
475 | channel. On output, a pointer to the LUN of the next SCSI device present\r | |
476 | on a SCSI channel.\r | |
477 | \r | |
478 | @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r | |
479 | channel was returned in Target and Lun.\r | |
480 | @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r | |
481 | not returned on a previous call to GetNextTargetLun().\r | |
482 | @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r | |
483 | \r | |
484 | **/\r | |
485 | EFI_STATUS\r | |
486 | EFIAPI\r | |
487 | UfsPassThruGetNextTargetLun (\r | |
488 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
489 | IN OUT UINT8 **Target,\r | |
490 | IN OUT UINT64 *Lun\r | |
491 | );\r | |
492 | \r | |
493 | /**\r | |
494 | Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r | |
495 | \r | |
496 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
497 | @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r | |
498 | Target ID of the SCSI device for which a device path node is to be\r | |
499 | allocated and built. Transport drivers may chose to utilize a subset of\r | |
500 | this size to suit the representation of targets. For example, a Fibre\r | |
501 | Channel driver may use only 8 bytes (WWN) in the array to represent a\r | |
502 | FC target.\r | |
503 | @param Lun The LUN of the SCSI device for which a device path node is to be\r | |
504 | allocated and built.\r | |
505 | @param DevicePath A pointer to a single device path node that describes the SCSI device\r | |
506 | specified by Target and Lun. This function is responsible for\r | |
507 | allocating the buffer DevicePath with the boot service\r | |
508 | AllocatePool(). It is the caller's responsibility to free\r | |
509 | DevicePath when the caller is finished with DevicePath.\r | |
510 | \r | |
511 | @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r | |
512 | Target and Lun was allocated and returned in\r | |
513 | DevicePath.\r | |
514 | @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r | |
515 | @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r | |
516 | on the SCSI channel.\r | |
517 | @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r | |
518 | \r | |
519 | **/\r | |
520 | EFI_STATUS\r | |
521 | EFIAPI\r | |
522 | UfsPassThruBuildDevicePath (\r | |
523 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
524 | IN UINT8 *Target,\r | |
525 | IN UINT64 Lun,\r | |
526 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r | |
527 | );\r | |
528 | \r | |
529 | /**\r | |
530 | Used to translate a device path node to a Target ID and LUN.\r | |
531 | \r | |
532 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
533 | @param DevicePath A pointer to a single device path node that describes the SCSI device\r | |
534 | on the SCSI channel.\r | |
535 | @param Target A pointer to the Target Array which represents the ID of a SCSI device\r | |
536 | on the SCSI channel.\r | |
537 | @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r | |
538 | \r | |
539 | @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r | |
540 | LUN, and they were returned in Target and Lun.\r | |
541 | @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r | |
542 | @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r | |
543 | does not exist.\r | |
544 | @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r | |
545 | DevicePath.\r | |
546 | \r | |
547 | **/\r | |
548 | EFI_STATUS\r | |
549 | EFIAPI\r | |
550 | UfsPassThruGetTargetLun (\r | |
551 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
552 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r | |
553 | OUT UINT8 **Target,\r | |
554 | OUT UINT64 *Lun\r | |
555 | );\r | |
556 | \r | |
557 | /**\r | |
558 | Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r | |
559 | \r | |
560 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
561 | \r | |
562 | @retval EFI_SUCCESS The SCSI channel was reset.\r | |
563 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r | |
564 | @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r | |
565 | @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r | |
566 | \r | |
567 | **/\r | |
568 | EFI_STATUS\r | |
569 | EFIAPI\r | |
570 | UfsPassThruResetChannel (\r | |
571 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r | |
572 | );\r | |
573 | \r | |
574 | /**\r | |
575 | Resets a SCSI logical unit that is connected to a SCSI channel.\r | |
576 | \r | |
577 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
578 | @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r | |
579 | target port ID of the SCSI device containing the SCSI logical unit to\r | |
580 | reset. Transport drivers may chose to utilize a subset of this array to suit\r | |
581 | the representation of their targets.\r | |
582 | @param Lun The LUN of the SCSI device to reset.\r | |
583 | \r | |
584 | @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r | |
585 | @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r | |
586 | @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r | |
587 | specified by Target and Lun.\r | |
588 | @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r | |
589 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r | |
590 | specified by Target and Lun.\r | |
591 | \r | |
592 | **/\r | |
593 | EFI_STATUS\r | |
594 | EFIAPI\r | |
595 | UfsPassThruResetTargetLun (\r | |
596 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
597 | IN UINT8 *Target,\r | |
598 | IN UINT64 Lun\r | |
599 | );\r | |
600 | \r | |
601 | /**\r | |
602 | Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either\r | |
603 | be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r | |
604 | for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to\r | |
605 | see if a SCSI device is actually present at that location on the SCSI channel.\r | |
606 | \r | |
607 | @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r | |
608 | @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r | |
609 | On output, a pointer to the Target ID (an array of\r | |
610 | TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r | |
611 | channel. An input value of 0xF(all bytes in the array are 0xF) in the\r | |
612 | Target array retrieves the Target ID of the first SCSI device present on a\r | |
613 | SCSI channel.\r | |
614 | \r | |
615 | @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r | |
616 | channel was returned in Target.\r | |
617 | @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r | |
618 | @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not\r | |
619 | returned on a previous call to GetNextTarget().\r | |
620 | @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r | |
621 | \r | |
622 | **/\r | |
623 | EFI_STATUS\r | |
624 | EFIAPI\r | |
625 | UfsPassThruGetNextTarget (\r | |
626 | IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r | |
627 | IN OUT UINT8 **Target\r | |
628 | );\r | |
629 | \r | |
630 | /**\r | |
631 | Sends a UFS-supported SCSI Request Packet to a UFS device that is attached to the UFS host controller.\r | |
632 | \r | |
633 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
634 | @param[in] Lun The LUN of the UFS device to send the SCSI Request Packet.\r | |
635 | @param[in, out] Packet A pointer to the SCSI Request Packet to send to a specified Lun of the\r | |
636 | UFS device.\r | |
0350b57c HW |
637 | @param[in] Event If nonblocking I/O is not supported then Event is ignored, and blocking\r |
638 | I/O is performed. If Event is NULL, then blocking I/O is performed. If\r | |
639 | Event is not NULL and non blocking I/O is supported, then\r | |
640 | nonblocking I/O is performed, and Event will be signaled when the\r | |
641 | SCSI Request Packet completes.\r | |
0591696e FT |
642 | \r |
643 | @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r | |
644 | commands, InTransferLength bytes were transferred from\r | |
645 | InDataBuffer. For write and bi-directional commands,\r | |
646 | OutTransferLength bytes were transferred by\r | |
647 | OutDataBuffer.\r | |
648 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r | |
649 | Packet.\r | |
650 | @retval EFI_OUT_OF_RESOURCES The resource for transfer is not available.\r | |
651 | @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r | |
652 | \r | |
653 | **/\r | |
654 | EFI_STATUS\r | |
655 | UfsExecScsiCmds (\r | |
656 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
657 | IN UINT8 Lun,\r | |
0350b57c HW |
658 | IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r |
659 | IN EFI_EVENT Event OPTIONAL\r | |
0591696e FT |
660 | );\r |
661 | \r | |
662 | /**\r | |
663 | Initialize the UFS host controller.\r | |
664 | \r | |
665 | @param[in] Private The pointer to the NVME_CONTROLLER_PRIVATE_DATA data structure.\r | |
666 | \r | |
667 | @retval EFI_SUCCESS The NVM Express Controller is initialized successfully.\r | |
668 | @retval Others A device error occurred while initializing the controller.\r | |
669 | \r | |
670 | **/\r | |
671 | EFI_STATUS\r | |
672 | UfsControllerInit (\r | |
673 | IN UFS_PASS_THRU_PRIVATE_DATA *Private\r | |
674 | );\r | |
675 | \r | |
676 | /**\r | |
677 | Stop the UFS host controller.\r | |
678 | \r | |
679 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
680 | \r | |
681 | @retval EFI_SUCCESS The Ufs Host Controller is stopped successfully.\r | |
682 | @retval Others A device error occurred while stopping the controller.\r | |
683 | \r | |
684 | **/\r | |
685 | EFI_STATUS\r | |
686 | UfsControllerStop (\r | |
687 | IN UFS_PASS_THRU_PRIVATE_DATA *Private\r | |
688 | );\r | |
689 | \r | |
690 | /**\r | |
691 | Allocate common buffer for host and UFS bus master access simultaneously.\r | |
692 | \r | |
693 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
694 | @param[in] Size The length of buffer to be allocated.\r | |
695 | @param[out] CmdDescHost A pointer to store the base system memory address of the allocated range.\r | |
696 | @param[out] CmdDescPhyAddr The resulting map address for the UFS bus master to use to access the hosts CmdDescHost.\r | |
697 | @param[out] CmdDescMapping A resulting value to pass to Unmap().\r | |
698 | \r | |
699 | @retval EFI_SUCCESS The common buffer was allocated successfully.\r | |
700 | @retval EFI_DEVICE_ERROR The allocation fails.\r | |
701 | @retval EFI_OUT_OF_RESOURCES The memory resource is insufficient.\r | |
702 | \r | |
703 | **/\r | |
704 | EFI_STATUS\r | |
705 | UfsAllocateAlignCommonBuffer (\r | |
706 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
707 | IN UINTN Size,\r | |
708 | OUT VOID **CmdDescHost,\r | |
709 | OUT EFI_PHYSICAL_ADDRESS *CmdDescPhyAddr,\r | |
710 | OUT VOID **CmdDescMapping\r | |
711 | );\r | |
712 | \r | |
713 | /**\r | |
714 | Set specified flag to 1 on a UFS device.\r | |
715 | \r | |
716 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
717 | @param[in] FlagId The ID of flag to be set.\r | |
718 | \r | |
719 | @retval EFI_SUCCESS The flag was set successfully.\r | |
720 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to set the flag.\r | |
721 | @retval EFI_TIMEOUT A timeout occurred while waiting for the completion of setting the flag.\r | |
722 | \r | |
723 | **/\r | |
724 | EFI_STATUS\r | |
725 | UfsSetFlag (\r | |
726 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
727 | IN UINT8 FlagId\r | |
728 | );\r | |
729 | \r | |
95ad8f7f HW |
730 | /**\r |
731 | Read specified flag from a UFS device.\r | |
732 | \r | |
733 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
734 | @param[in] FlagId The ID of flag to be read.\r | |
735 | @param[out] Value The flag's value.\r | |
736 | \r | |
737 | @retval EFI_SUCCESS The flag was read successfully.\r | |
738 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to read the flag.\r | |
739 | @retval EFI_TIMEOUT A timeout occurred while waiting for the completion of reading the flag.\r | |
740 | \r | |
741 | **/\r | |
742 | EFI_STATUS\r | |
743 | UfsReadFlag (\r | |
744 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
745 | IN UINT8 FlagId,\r | |
746 | OUT UINT8 *Value\r | |
747 | );\r | |
748 | \r | |
32c9049d HW |
749 | /**\r |
750 | Read or write specified flag of a UFS device.\r | |
751 | \r | |
752 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
753 | @param[in] Read The boolean variable to show r/w direction.\r | |
754 | @param[in] FlagId The ID of flag to be read or written.\r | |
755 | @param[in, out] Value The value to set or clear flag.\r | |
756 | \r | |
757 | @retval EFI_SUCCESS The flag was read/written successfully.\r | |
758 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to r/w the flag.\r | |
759 | @retval EFI_TIMEOUT A timeout occurred while waiting for the completion of r/w the flag.\r | |
760 | \r | |
761 | **/\r | |
762 | EFI_STATUS\r | |
763 | UfsRwFlags (\r | |
764 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
765 | IN BOOLEAN Read,\r | |
766 | IN UINT8 FlagId,\r | |
767 | IN OUT UINT8 *Value\r | |
768 | );\r | |
769 | \r | |
0591696e FT |
770 | /**\r |
771 | Read or write specified device descriptor of a UFS device.\r | |
772 | \r | |
773 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
774 | @param[in] Read The boolean variable to show r/w direction.\r | |
775 | @param[in] DescId The ID of device descriptor.\r | |
776 | @param[in] Index The Index of device descriptor.\r | |
777 | @param[in] Selector The Selector of device descriptor.\r | |
778 | @param[in, out] Descriptor The buffer of device descriptor to be read or written.\r | |
32c9049d HW |
779 | @param[in, out] DescSize The size of device descriptor buffer. On input, the size, in bytes,\r |
780 | of the data buffer specified by Descriptor. On output, the number\r | |
781 | of bytes that were actually transferred.\r | |
0591696e FT |
782 | \r |
783 | @retval EFI_SUCCESS The device descriptor was read/written successfully.\r | |
784 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to r/w the device descriptor.\r | |
785 | @retval EFI_TIMEOUT A timeout occurred while waiting for the completion of r/w the device descriptor.\r | |
786 | \r | |
787 | **/\r | |
788 | EFI_STATUS\r | |
789 | UfsRwDeviceDesc (\r | |
790 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
791 | IN BOOLEAN Read,\r | |
792 | IN UINT8 DescId,\r | |
793 | IN UINT8 Index,\r | |
794 | IN UINT8 Selector,\r | |
795 | IN OUT VOID *Descriptor,\r | |
32c9049d | 796 | IN OUT UINT32 *DescSize\r |
0591696e FT |
797 | );\r |
798 | \r | |
95ad8f7f HW |
799 | /**\r |
800 | Read or write specified attribute of a UFS device.\r | |
801 | \r | |
802 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
803 | @param[in] Read The boolean variable to show r/w direction.\r | |
804 | @param[in] AttrId The ID of Attribute.\r | |
805 | @param[in] Index The Index of Attribute.\r | |
806 | @param[in] Selector The Selector of Attribute.\r | |
807 | @param[in, out] Attributes The value of Attribute to be read or written.\r | |
808 | \r | |
809 | @retval EFI_SUCCESS The Attribute was read/written successfully.\r | |
810 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to r/w the Attribute.\r | |
811 | @retval EFI_TIMEOUT A timeout occurred while waiting for the completion of r/w the Attribute.\r | |
812 | \r | |
813 | **/\r | |
814 | EFI_STATUS\r | |
815 | UfsRwAttributes (\r | |
816 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
817 | IN BOOLEAN Read,\r | |
818 | IN UINT8 AttrId,\r | |
819 | IN UINT8 Index,\r | |
820 | IN UINT8 Selector,\r | |
821 | IN OUT UINT32 *Attributes\r | |
822 | );\r | |
823 | \r | |
0591696e FT |
824 | /**\r |
825 | Sends NOP IN cmd to a UFS device for initialization process request.\r | |
826 | For more details, please refer to UFS 2.0 spec Figure 13.3.\r | |
827 | \r | |
828 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data structure.\r | |
829 | \r | |
830 | @retval EFI_SUCCESS The NOP IN command was sent by the host. The NOP OUT response was\r | |
831 | received successfully.\r | |
832 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to execute NOP IN command.\r | |
833 | @retval EFI_OUT_OF_RESOURCES The resource for transfer is not available.\r | |
834 | @retval EFI_TIMEOUT A timeout occurred while waiting for the NOP IN command to execute.\r | |
835 | \r | |
836 | **/\r | |
837 | EFI_STATUS\r | |
838 | UfsExecNopCmds (\r | |
839 | IN UFS_PASS_THRU_PRIVATE_DATA *Private\r | |
840 | );\r | |
841 | \r | |
0350b57c HW |
842 | /**\r |
843 | Call back function when the timer event is signaled.\r | |
844 | \r | |
845 | @param[in] Event The Event this notify function registered to.\r | |
846 | @param[in] Context Pointer to the context data registered to the Event.\r | |
847 | \r | |
848 | **/\r | |
849 | VOID\r | |
850 | EFIAPI\r | |
851 | ProcessAsyncTaskList (\r | |
852 | IN EFI_EVENT Event,\r | |
853 | IN VOID *Context\r | |
854 | );\r | |
855 | \r | |
856 | /**\r | |
857 | Internal helper function which will signal the caller event and clean up\r | |
858 | resources.\r | |
859 | \r | |
860 | @param[in] Private The pointer to the UFS_PASS_THRU_PRIVATE_DATA data\r | |
861 | structure.\r | |
862 | @param[in] TransReq The pointer to the UFS_PASS_THRU_TRANS_REQ data\r | |
863 | structure.\r | |
864 | \r | |
865 | **/\r | |
866 | VOID\r | |
867 | EFIAPI\r | |
868 | SignalCallerEvent (\r | |
869 | IN UFS_PASS_THRU_PRIVATE_DATA *Private,\r | |
870 | IN UFS_PASS_THRU_TRANS_REQ *TransReq\r | |
871 | );\r | |
872 | \r | |
32c9049d HW |
873 | /**\r |
874 | Read or write specified device descriptor of a UFS device.\r | |
875 | \r | |
876 | The function is used to read/write UFS device descriptors. The consumer of this API is\r | |
877 | responsible for allocating the data buffer pointed by Descriptor.\r | |
878 | \r | |
879 | @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.\r | |
880 | @param[in] Read The boolean variable to show r/w direction.\r | |
881 | @param[in] DescId The ID of device descriptor.\r | |
882 | @param[in] Index The Index of device descriptor.\r | |
883 | @param[in] Selector The Selector of device descriptor.\r | |
884 | @param[in, out] Descriptor The buffer of device descriptor to be read or written.\r | |
885 | @param[in, out] DescSize The size of device descriptor buffer. On input, the size, in bytes,\r | |
886 | of the data buffer specified by Descriptor. On output, the number\r | |
887 | of bytes that were actually transferred.\r | |
888 | \r | |
889 | @retval EFI_SUCCESS The device descriptor is read/written successfully.\r | |
890 | @retval EFI_INVALID_PARAMETER This is NULL or Descriptor is NULL or DescSize is NULL.\r | |
891 | DescId, Index and Selector are invalid combination to point to a\r | |
892 | type of UFS device descriptor.\r | |
893 | @retval EFI_DEVICE_ERROR The device descriptor is not read/written successfully.\r | |
894 | \r | |
895 | **/\r | |
896 | EFI_STATUS\r | |
897 | EFIAPI\r | |
898 | UfsRwUfsDescriptor (\r | |
899 | IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,\r | |
900 | IN BOOLEAN Read,\r | |
901 | IN UINT8 DescId,\r | |
902 | IN UINT8 Index,\r | |
903 | IN UINT8 Selector,\r | |
904 | IN OUT UINT8 *Descriptor,\r | |
905 | IN OUT UINT32 *DescSize\r | |
906 | );\r | |
907 | \r | |
908 | /**\r | |
909 | Read or write specified flag of a UFS device.\r | |
910 | \r | |
911 | The function is used to read/write UFS flag descriptors. The consumer of this API is responsible\r | |
912 | for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is\r | |
913 | just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value.\r | |
914 | \r | |
915 | @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.\r | |
916 | @param[in] Read The boolean variable to show r/w direction.\r | |
917 | @param[in] FlagId The ID of flag to be read or written.\r | |
918 | @param[in, out] Flag The buffer to set or clear flag.\r | |
919 | \r | |
920 | @retval EFI_SUCCESS The flag descriptor is set/clear successfully.\r | |
921 | @retval EFI_INVALID_PARAMETER This is NULL or Flag is NULL.\r | |
922 | FlagId is an invalid UFS flag ID.\r | |
923 | @retval EFI_DEVICE_ERROR The flag is not set/clear successfully.\r | |
924 | \r | |
925 | **/\r | |
926 | EFI_STATUS\r | |
927 | EFIAPI\r | |
928 | UfsRwUfsFlag (\r | |
929 | IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,\r | |
930 | IN BOOLEAN Read,\r | |
931 | IN UINT8 FlagId,\r | |
932 | IN OUT UINT8 *Flag\r | |
933 | );\r | |
934 | \r | |
935 | /**\r | |
936 | Read or write specified attribute of a UFS device.\r | |
937 | \r | |
938 | The function is used to read/write UFS attributes. The consumer of this API is responsible for\r | |
939 | allocating the data buffer pointed by Attribute.\r | |
940 | \r | |
941 | @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.\r | |
942 | @param[in] Read The boolean variable to show r/w direction.\r | |
943 | @param[in] AttrId The ID of Attribute.\r | |
944 | @param[in] Index The Index of Attribute.\r | |
945 | @param[in] Selector The Selector of Attribute.\r | |
946 | @param[in, out] Attribute The buffer of Attribute to be read or written.\r | |
947 | @param[in, out] AttrSize The size of Attribute buffer. On input, the size, in bytes, of the\r | |
948 | data buffer specified by Attribute. On output, the number of bytes\r | |
949 | that were actually transferred.\r | |
950 | \r | |
951 | @retval EFI_SUCCESS The attribute is read/written successfully.\r | |
952 | @retval EFI_INVALID_PARAMETER This is NULL or Attribute is NULL or AttrSize is NULL.\r | |
953 | AttrId, Index and Selector are invalid combination to point to a\r | |
954 | type of UFS attribute.\r | |
955 | @retval EFI_DEVICE_ERROR The attribute is not read/written successfully.\r | |
956 | \r | |
957 | **/\r | |
958 | EFI_STATUS\r | |
959 | EFIAPI\r | |
960 | UfsRwUfsAttribute (\r | |
961 | IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,\r | |
962 | IN BOOLEAN Read,\r | |
963 | IN UINT8 AttrId,\r | |
964 | IN UINT8 Index,\r | |
965 | IN UINT8 Selector,\r | |
966 | IN OUT UINT8 *Attribute,\r | |
967 | IN OUT UINT32 *AttrSize\r | |
968 | );\r | |
969 | \r | |
ecc32c90 AM |
970 | /**\r |
971 | Execute UIC command.\r | |
972 | \r | |
973 | @param[in] This Pointer to driver interface produced by the UFS controller.\r | |
974 | @param[in, out] UicCommand Descriptor of the command that will be executed.\r | |
975 | \r | |
976 | @retval EFI_SUCCESS Command executed successfully.\r | |
977 | @retval EFI_INVALID_PARAMETER This or UicCommand is NULL.\r | |
978 | @retval Others Command failed to execute.\r | |
979 | **/\r | |
980 | EFI_STATUS\r | |
981 | EFIAPI\r | |
982 | UfsHcDriverInterfaceExecUicCommand (\r | |
983 | IN EDKII_UFS_HC_DRIVER_INTERFACE *This,\r | |
984 | IN OUT EDKII_UIC_COMMAND *UicCommand\r | |
985 | );\r | |
986 | \r | |
a71272ed AM |
987 | /**\r |
988 | Initializes UfsHcInfo field in private data.\r | |
989 | \r | |
990 | @param[in] Private Pointer to host controller private data.\r | |
991 | \r | |
992 | @retval EFI_SUCCESS UfsHcInfo initialized successfully.\r | |
993 | @retval Others Failed to initalize UfsHcInfo.\r | |
994 | **/\r | |
995 | EFI_STATUS\r | |
996 | GetUfsHcInfo (\r | |
997 | IN UFS_PASS_THRU_PRIVATE_DATA *Private\r | |
998 | );\r | |
999 | \r | |
5966dd8f FT |
1000 | extern EFI_COMPONENT_NAME_PROTOCOL gUfsPassThruComponentName;\r |
1001 | extern EFI_COMPONENT_NAME2_PROTOCOL gUfsPassThruComponentName2;\r | |
1002 | extern EFI_DRIVER_BINDING_PROTOCOL gUfsPassThruDriverBinding;\r | |
ecc32c90 | 1003 | extern EDKII_UFS_HC_PLATFORM_PROTOCOL *mUfsHcPlatform;\r |
0591696e FT |
1004 | \r |
1005 | #endif\r |