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