]>
Commit | Line | Data |
---|---|---|
e237e7ae | 1 | /** @file\r |
8616fc4c | 2 | \r |
3 | Usb Bus Driver Binding and Bus IO Protocol.\r | |
4 | \r | |
d1102dba | 5 | Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9d510e61 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
e237e7ae | 7 | \r |
e237e7ae | 8 | **/\r |
9 | \r | |
10 | #ifndef _EFI_USB_BUS_H_\r | |
11 | #define _EFI_USB_BUS_H_\r | |
12 | \r | |
ed7748fe | 13 | \r |
60c93673 | 14 | #include <Uefi.h>\r |
ed7748fe | 15 | \r |
e237e7ae | 16 | #include <Protocol/Usb2HostController.h>\r |
17 | #include <Protocol/UsbHostController.h>\r | |
18 | #include <Protocol/UsbIo.h>\r | |
19 | #include <Protocol/DevicePath.h>\r | |
ed7748fe | 20 | \r |
77442a5a | 21 | #include <Library/BaseLib.h>\r |
e237e7ae | 22 | #include <Library/DebugLib.h>\r |
23 | #include <Library/BaseMemoryLib.h>\r | |
24 | #include <Library/UefiDriverEntryPoint.h>\r | |
25 | #include <Library/UefiBootServicesTableLib.h>\r | |
26 | #include <Library/UefiLib.h>\r | |
27 | #include <Library/DevicePathLib.h>\r | |
28 | #include <Library/MemoryAllocationLib.h>\r | |
3d0a2385 | 29 | #include <Library/ReportStatusCodeLib.h>\r |
e237e7ae | 30 | \r |
31 | \r | |
32 | #include <IndustryStandard/Usb.h>\r | |
33 | \r | |
34 | typedef struct _USB_DEVICE USB_DEVICE;\r | |
35 | typedef struct _USB_INTERFACE USB_INTERFACE;\r | |
36 | typedef struct _USB_BUS USB_BUS;\r | |
37 | typedef struct _USB_HUB_API USB_HUB_API;\r | |
38 | \r | |
39 | \r | |
40 | #include "UsbUtility.h"\r | |
41 | #include "UsbDesc.h"\r | |
42 | #include "UsbHub.h"\r | |
43 | #include "UsbEnumer.h"\r | |
44 | \r | |
1ccdbf2a | 45 | //\r |
46 | // USB bus timeout experience values\r | |
47 | //\r | |
48 | \r | |
49 | #define USB_MAX_LANG_ID 16\r | |
50 | #define USB_MAX_INTERFACE 16\r | |
51 | #define USB_MAX_DEVICES 128\r | |
52 | \r | |
53 | #define USB_BUS_1_MILLISECOND 1000\r | |
54 | \r | |
55 | //\r | |
56 | // Roothub and hub's polling interval, set by experience,\r | |
c843ef67 | 57 | // The unit of roothub is 100us, means 100ms as interval, and\r |
1ccdbf2a | 58 | // the unit of hub is 1ms, means 64ms as interval.\r |
59 | //\r | |
c843ef67 | 60 | #define USB_ROOTHUB_POLL_INTERVAL (100 * 10000U)\r |
1ccdbf2a | 61 | #define USB_HUB_POLL_INTERVAL 64\r |
62 | \r | |
63 | //\r | |
64 | // Wait for port stable to work, refers to specification\r | |
65 | // [USB20-9.1.2]\r | |
66 | //\r | |
67 | #define USB_WAIT_PORT_STABLE_STALL (100 * USB_BUS_1_MILLISECOND)\r | |
68 | \r | |
69 | //\r | |
70 | // Wait for port statue reg change, set by experience\r | |
71 | //\r | |
c843ef67 | 72 | #define USB_WAIT_PORT_STS_CHANGE_STALL (100)\r |
1ccdbf2a | 73 | \r |
74 | //\r | |
75 | // Wait for set device address, refers to specification\r | |
76 | // [USB20-9.2.6.3, it says 2ms]\r | |
77 | //\r | |
c843ef67 | 78 | #define USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND)\r |
1ccdbf2a | 79 | \r |
80 | //\r | |
81 | // Wait for retry max packet size, set by experience\r | |
82 | //\r | |
83 | #define USB_RETRY_MAX_PACK_SIZE_STALL (100 * USB_BUS_1_MILLISECOND)\r | |
84 | \r | |
85 | //\r | |
86 | // Wait for hub port power-on, refers to specification\r | |
87 | // [USB20-11.23.2]\r | |
88 | //\r | |
89 | #define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND)\r | |
90 | \r | |
91 | //\r | |
92 | // Wait for port reset, refers to specification\r | |
93 | // [USB20-7.1.7.5, it says 10ms for hub and 50ms for\r | |
94 | // root hub]\r | |
95 | //\r | |
71619ac2 | 96 | // According to USB2.0, Chapter 11.5.1.5 Resetting,\r |
97 | // the worst case for TDRST is 20ms\r | |
98 | //\r | |
99 | #define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)\r | |
1ccdbf2a | 100 | #define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)\r |
101 | \r | |
71619ac2 | 102 | //\r |
103 | // Wait for port recovery to accept SetAddress, refers to specification\r | |
104 | // [USB20-7.1.7.5, it says 10 ms for TRSTRCY]\r | |
105 | //\r | |
106 | #define USB_SET_PORT_RECOVERY_STALL (10 * USB_BUS_1_MILLISECOND)\r | |
107 | \r | |
1ccdbf2a | 108 | //\r |
109 | // Wait for clear roothub port reset, set by experience\r | |
110 | //\r | |
111 | #define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)\r | |
112 | \r | |
113 | //\r | |
114 | // Wait for set roothub port enable, set by experience\r | |
115 | //\r | |
116 | #define USB_SET_ROOT_PORT_ENABLE_STALL (20 * USB_BUS_1_MILLISECOND)\r | |
117 | \r | |
118 | //\r | |
119 | // Send general device request timeout.\r | |
d1102dba | 120 | //\r |
1ccdbf2a | 121 | // The USB Specification 2.0, section 11.24.1 recommends a value of\r |
20142bd6 | 122 | // 50 milliseconds. We use a value of 500 milliseconds to work\r |
1ccdbf2a | 123 | // around slower hubs and devices.\r |
124 | //\r | |
20142bd6 | 125 | #define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 500\r |
1ccdbf2a | 126 | \r |
127 | //\r | |
128 | // Send clear feature request timeout, set by experience\r | |
129 | //\r | |
130 | #define USB_CLEAR_FEATURE_REQUEST_TIMEOUT 10\r | |
ecb575d9 | 131 | \r |
8616fc4c | 132 | //\r |
133 | // Bus raises TPL to TPL_NOTIFY to serialize all its operations\r | |
134 | // to protect shared data structures.\r | |
135 | //\r | |
136 | #define USB_BUS_TPL TPL_NOTIFY\r | |
e237e7ae | 137 | \r |
f3f2e05d | 138 | #define USB_INTERFACE_SIGNATURE SIGNATURE_32 ('U', 'S', 'B', 'I')\r |
139 | #define USB_BUS_SIGNATURE SIGNATURE_32 ('U', 'S', 'B', 'B')\r | |
e237e7ae | 140 | \r |
141 | #define USB_BIT(a) ((UINTN)(1 << (a)))\r | |
142 | #define USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))\r | |
143 | \r | |
e237e7ae | 144 | #define USB_INTERFACE_FROM_USBIO(a) \\r |
145 | CR(a, USB_INTERFACE, UsbIo, USB_INTERFACE_SIGNATURE)\r | |
146 | \r | |
147 | #define USB_BUS_FROM_THIS(a) \\r | |
148 | CR(a, USB_BUS, BusId, USB_BUS_SIGNATURE)\r | |
149 | \r | |
150 | //\r | |
151 | // Used to locate USB_BUS\r | |
c8ad2d7a LG |
152 | // UsbBusProtocol is the private protocol.\r |
153 | // gEfiCallerIdGuid will be used as its protocol guid.\r | |
e237e7ae | 154 | //\r |
155 | typedef struct _EFI_USB_BUS_PROTOCOL {\r | |
156 | UINT64 Reserved;\r | |
157 | } EFI_USB_BUS_PROTOCOL;\r | |
158 | \r | |
159 | \r | |
160 | //\r | |
161 | // Stands for the real USB device. Each device may\r | |
13a623cf | 162 | // has several separately working interfaces.\r |
e237e7ae | 163 | //\r |
c52fa98c | 164 | struct _USB_DEVICE {\r |
e237e7ae | 165 | USB_BUS *Bus;\r |
166 | \r | |
167 | //\r | |
168 | // Configuration information\r | |
169 | //\r | |
170 | UINT8 Speed;\r | |
171 | UINT8 Address;\r | |
92870c98 | 172 | UINT32 MaxPacket0;\r |
e237e7ae | 173 | \r |
174 | //\r | |
175 | // The device's descriptors and its configuration\r | |
176 | //\r | |
177 | USB_DEVICE_DESC *DevDesc;\r | |
178 | USB_CONFIG_DESC *ActiveConfig;\r | |
179 | \r | |
180 | UINT16 LangId [USB_MAX_LANG_ID];\r | |
181 | UINT16 TotalLangId;\r | |
182 | \r | |
183 | UINT8 NumOfInterface;\r | |
184 | USB_INTERFACE *Interfaces [USB_MAX_INTERFACE];\r | |
185 | \r | |
186 | //\r | |
187 | // Parent child relationship\r | |
188 | //\r | |
189 | EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;\r | |
190 | \r | |
191 | UINT8 ParentAddr;\r | |
192 | USB_INTERFACE *ParentIf;\r | |
193 | UINT8 ParentPort; // Start at 0\r | |
92870c98 | 194 | UINT8 Tier;\r |
127884c5 | 195 | BOOLEAN DisconnectFail;\r |
c52fa98c | 196 | };\r |
e237e7ae | 197 | \r |
198 | //\r | |
199 | // Stands for different functions of USB device\r | |
200 | //\r | |
c52fa98c | 201 | struct _USB_INTERFACE {\r |
e237e7ae | 202 | UINTN Signature;\r |
203 | USB_DEVICE *Device;\r | |
204 | USB_INTERFACE_DESC *IfDesc;\r | |
205 | USB_INTERFACE_SETTING *IfSetting;\r | |
206 | \r | |
207 | //\r | |
208 | // Handles and protocols\r | |
209 | //\r | |
210 | EFI_HANDLE Handle;\r | |
211 | EFI_USB_IO_PROTOCOL UsbIo;\r | |
212 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
213 | BOOLEAN IsManaged;\r | |
214 | \r | |
215 | //\r | |
216 | // Hub device special data\r | |
217 | //\r | |
218 | BOOLEAN IsHub;\r | |
219 | USB_HUB_API *HubApi;\r | |
220 | UINT8 NumOfPort;\r | |
221 | EFI_EVENT HubNotify;\r | |
222 | \r | |
223 | //\r | |
224 | // Data used only by normal hub devices\r | |
225 | //\r | |
226 | USB_ENDPOINT_DESC *HubEp;\r | |
227 | UINT8 *ChangeMap;\r | |
228 | \r | |
229 | //\r | |
230 | // Data used only by root hub to hand over device to\r | |
231 | // companion UHCI driver if low/full speed devices are\r | |
232 | // connected to EHCI.\r | |
233 | //\r | |
234 | UINT8 MaxSpeed;\r | |
c52fa98c | 235 | };\r |
e237e7ae | 236 | \r |
237 | //\r | |
238 | // Stands for the current USB Bus\r | |
239 | //\r | |
c52fa98c | 240 | struct _USB_BUS {\r |
e237e7ae | 241 | UINTN Signature;\r |
242 | EFI_USB_BUS_PROTOCOL BusId;\r | |
243 | \r | |
244 | //\r | |
245 | // Managed USB host controller\r | |
246 | //\r | |
247 | EFI_HANDLE HostHandle;\r | |
248 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
249 | EFI_USB2_HC_PROTOCOL *Usb2Hc;\r | |
250 | EFI_USB_HC_PROTOCOL *UsbHc;\r | |
251 | \r | |
a9292c13 | 252 | //\r |
253 | // Recorded the max supported usb devices.\r | |
254 | // XHCI can support up to 255 devices.\r | |
255 | // EHCI/UHCI/OHCI supports up to 127 devices.\r | |
256 | //\r | |
257 | UINT32 MaxDevices;\r | |
e237e7ae | 258 | //\r |
259 | // An array of device that is on the bus. Devices[0] is\r | |
260 | // for root hub. Device with address i is at Devices[i].\r | |
261 | //\r | |
92870c98 | 262 | USB_DEVICE *Devices[256];\r |
ecb575d9 | 263 | \r |
264 | //\r | |
265 | // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r | |
266 | // usb child device will be recursively connected.\r | |
267 | //\r | |
13a623cf AC |
268 | // WantedUsbIoDPList tracks the Usb child devices which user want to recursively fully connecte,\r |
269 | // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structure is\r | |
ecb575d9 | 270 | // DEVICE_PATH_LIST_ITEM\r |
271 | //\r | |
272 | LIST_ENTRY WantedUsbIoDPList;\r | |
273 | \r | |
c52fa98c | 274 | };\r |
e237e7ae | 275 | \r |
9920ae74 | 276 | //\r |
277 | // USB Hub Api\r | |
278 | //\r | |
279 | struct _USB_HUB_API{\r | |
280 | USB_HUB_INIT Init;\r | |
281 | USB_HUB_GET_PORT_STATUS GetPortStatus;\r | |
282 | USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;\r | |
283 | USB_HUB_SET_PORT_FEATURE SetPortFeature;\r | |
284 | USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;\r | |
285 | USB_HUB_RESET_PORT ResetPort;\r | |
286 | USB_HUB_RELEASE Release;\r | |
287 | };\r | |
288 | \r | |
ecb575d9 | 289 | #define USB_US_LAND_ID 0x0409\r |
290 | \r | |
f3f2e05d | 291 | #define DEVICE_PATH_LIST_ITEM_SIGNATURE SIGNATURE_32('d','p','l','i')\r |
ecb575d9 | 292 | typedef struct _DEVICE_PATH_LIST_ITEM{\r |
293 | UINTN Signature;\r | |
294 | LIST_ENTRY Link;\r | |
295 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
296 | } DEVICE_PATH_LIST_ITEM;\r | |
297 | \r | |
298 | typedef struct {\r | |
299 | USB_CLASS_DEVICE_PATH UsbClass;\r | |
300 | EFI_DEVICE_PATH_PROTOCOL End;\r | |
301 | } USB_CLASS_FORMAT_DEVICE_PATH;\r | |
302 | \r | |
8616fc4c | 303 | /**\r |
304 | Free a DEVICE_PATH_LIST_ITEM list.\r | |
305 | \r | |
306 | @param UsbIoDPList a DEVICE_PATH_LIST_ITEM list pointer.\r | |
307 | \r | |
308 | @retval EFI_INVALID_PARAMETER If parameters are invalid, return this value.\r | |
309 | @retval EFI_SUCCESS If free operation is successful, return this value.\r | |
310 | \r | |
311 | **/\r | |
ecb575d9 | 312 | EFI_STATUS\r |
313 | EFIAPI\r | |
314 | UsbBusFreeUsbDPList (\r | |
315 | IN LIST_ENTRY *UsbIoDPList\r | |
316 | );\r | |
317 | \r | |
8616fc4c | 318 | /**\r |
319 | Store a wanted usb child device info (its Usb part of device path) which is indicated by\r | |
320 | RemainingDevicePath in a Usb bus which is indicated by UsbBusId.\r | |
321 | \r | |
322 | @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r | |
323 | @param RemainingDevicePath The remaining device patch.\r | |
324 | \r | |
325 | @retval EFI_SUCCESS Add operation is successful.\r | |
326 | @retval EFI_INVALID_PARAMETER The parameters are invalid.\r | |
327 | \r | |
328 | **/\r | |
ecb575d9 | 329 | EFI_STATUS\r |
330 | EFIAPI\r | |
331 | UsbBusAddWantedUsbIoDP (\r | |
332 | IN EFI_USB_BUS_PROTOCOL *UsbBusId,\r | |
333 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
334 | );\r | |
335 | \r | |
8616fc4c | 336 | /**\r |
337 | Check whether a usb child device is the wanted device in a bus.\r | |
338 | \r | |
339 | @param Bus The Usb bus's private data pointer.\r | |
13a623cf | 340 | @param UsbIf The usb child device interface.\r |
8616fc4c | 341 | \r |
342 | @retval True If a usb child device is the wanted device in a bus.\r | |
343 | @retval False If a usb child device is *NOT* the wanted device in a bus.\r | |
344 | \r | |
345 | **/\r | |
ecb575d9 | 346 | BOOLEAN\r |
347 | EFIAPI\r | |
348 | UsbBusIsWantedUsbIO (\r | |
349 | IN USB_BUS *Bus,\r | |
350 | IN USB_INTERFACE *UsbIf\r | |
351 | );\r | |
352 | \r | |
8616fc4c | 353 | /**\r |
13a623cf | 354 | Recursively connect every wanted usb child device to ensure they all fully connected.\r |
8616fc4c | 355 | Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r |
356 | \r | |
357 | @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r | |
358 | \r | |
359 | @retval EFI_SUCCESS Connect is done successfully.\r | |
360 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
361 | \r | |
362 | **/\r | |
ecb575d9 | 363 | EFI_STATUS\r |
364 | EFIAPI\r | |
365 | UsbBusRecursivelyConnectWantedUsbIo (\r | |
366 | IN EFI_USB_BUS_PROTOCOL *UsbBusId\r | |
367 | );\r | |
368 | \r | |
aa79b0b3 | 369 | /**\r |
370 | USB_IO function to execute a control transfer. This\r | |
371 | function will execute the USB transfer. If transfer\r | |
372 | successes, it will sync the internal state of USB bus\r | |
373 | with device state.\r | |
374 | \r | |
375 | @param This The USB_IO instance\r | |
376 | @param Request The control transfer request\r | |
377 | @param Direction Direction for data stage\r | |
378 | @param Timeout The time to wait before timeout\r | |
379 | @param Data The buffer holding the data\r | |
380 | @param DataLength Then length of the data\r | |
381 | @param UsbStatus USB result\r | |
382 | \r | |
383 | @retval EFI_INVALID_PARAMETER The parameters are invalid\r | |
384 | @retval EFI_SUCCESS The control transfer succeded.\r | |
385 | @retval Others Failed to execute the transfer\r | |
386 | \r | |
387 | **/\r | |
388 | EFI_STATUS\r | |
389 | EFIAPI\r | |
390 | UsbIoControlTransfer (\r | |
391 | IN EFI_USB_IO_PROTOCOL *This,\r | |
392 | IN EFI_USB_DEVICE_REQUEST *Request,\r | |
393 | IN EFI_USB_DATA_DIRECTION Direction,\r | |
394 | IN UINT32 Timeout,\r | |
395 | IN OUT VOID *Data, OPTIONAL\r | |
396 | IN UINTN DataLength, OPTIONAL\r | |
397 | OUT UINT32 *UsbStatus\r | |
398 | );\r | |
399 | \r | |
400 | /**\r | |
401 | Execute a bulk transfer to the device endpoint.\r | |
402 | \r | |
403 | @param This The USB IO instance.\r | |
404 | @param Endpoint The device endpoint.\r | |
405 | @param Data The data to transfer.\r | |
406 | @param DataLength The length of the data to transfer.\r | |
407 | @param Timeout Time to wait before timeout.\r | |
408 | @param UsbStatus The result of USB transfer.\r | |
409 | \r | |
410 | @retval EFI_SUCCESS The bulk transfer is OK.\r | |
411 | @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r | |
412 | @retval Others Failed to execute transfer, reason returned in\r | |
413 | UsbStatus.\r | |
414 | \r | |
415 | **/\r | |
416 | EFI_STATUS\r | |
417 | EFIAPI\r | |
418 | UsbIoBulkTransfer (\r | |
419 | IN EFI_USB_IO_PROTOCOL *This,\r | |
420 | IN UINT8 Endpoint,\r | |
421 | IN OUT VOID *Data,\r | |
422 | IN OUT UINTN *DataLength,\r | |
423 | IN UINTN Timeout,\r | |
424 | OUT UINT32 *UsbStatus\r | |
425 | );\r | |
426 | \r | |
427 | /**\r | |
428 | Execute a synchronous interrupt transfer.\r | |
429 | \r | |
430 | @param This The USB IO instance.\r | |
431 | @param Endpoint The device endpoint.\r | |
432 | @param Data The data to transfer.\r | |
433 | @param DataLength The length of the data to transfer.\r | |
434 | @param Timeout Time to wait before timeout.\r | |
435 | @param UsbStatus The result of USB transfer.\r | |
436 | \r | |
437 | @retval EFI_SUCCESS The synchronous interrupt transfer is OK.\r | |
438 | @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r | |
439 | @retval Others Failed to execute transfer, reason returned in\r | |
440 | UsbStatus.\r | |
441 | \r | |
442 | **/\r | |
443 | EFI_STATUS\r | |
444 | EFIAPI\r | |
445 | UsbIoSyncInterruptTransfer (\r | |
446 | IN EFI_USB_IO_PROTOCOL *This,\r | |
447 | IN UINT8 Endpoint,\r | |
448 | IN OUT VOID *Data,\r | |
449 | IN OUT UINTN *DataLength,\r | |
450 | IN UINTN Timeout,\r | |
451 | OUT UINT32 *UsbStatus\r | |
452 | );\r | |
453 | \r | |
454 | /**\r | |
455 | Queue a new asynchronous interrupt transfer, or remove the old\r | |
456 | request if (IsNewTransfer == FALSE).\r | |
457 | \r | |
458 | @param This The USB_IO instance.\r | |
459 | @param Endpoint The device endpoint.\r | |
460 | @param IsNewTransfer Whether this is a new request, if it's old, remove\r | |
461 | the request.\r | |
462 | @param PollInterval The interval to poll the transfer result, (in ms).\r | |
463 | @param DataLength The length of perodic data transfer.\r | |
13a623cf | 464 | @param Callback The function to call periodically when transfer is\r |
aa79b0b3 | 465 | ready.\r |
466 | @param Context The context to the callback.\r | |
467 | \r | |
468 | @retval EFI_SUCCESS New transfer is queued or old request is removed.\r | |
469 | @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r | |
470 | @retval Others Failed to queue the new request or remove the old\r | |
471 | request.\r | |
472 | \r | |
473 | **/\r | |
474 | EFI_STATUS\r | |
475 | EFIAPI\r | |
476 | UsbIoAsyncInterruptTransfer (\r | |
477 | IN EFI_USB_IO_PROTOCOL *This,\r | |
478 | IN UINT8 Endpoint,\r | |
479 | IN BOOLEAN IsNewTransfer,\r | |
480 | IN UINTN PollInterval, OPTIONAL\r | |
481 | IN UINTN DataLength, OPTIONAL\r | |
482 | IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, OPTIONAL\r | |
483 | IN VOID *Context OPTIONAL\r | |
484 | );\r | |
485 | \r | |
486 | /**\r | |
487 | Execute a synchronous isochronous transfer.\r | |
488 | \r | |
489 | @param This The USB IO instance.\r | |
490 | @param DeviceEndpoint The device endpoint.\r | |
491 | @param Data The data to transfer.\r | |
492 | @param DataLength The length of the data to transfer.\r | |
493 | @param UsbStatus The result of USB transfer.\r | |
494 | \r | |
495 | @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r | |
496 | \r | |
497 | **/\r | |
498 | EFI_STATUS\r | |
499 | EFIAPI\r | |
500 | UsbIoIsochronousTransfer (\r | |
501 | IN EFI_USB_IO_PROTOCOL *This,\r | |
502 | IN UINT8 DeviceEndpoint,\r | |
503 | IN OUT VOID *Data,\r | |
504 | IN UINTN DataLength,\r | |
505 | OUT UINT32 *Status\r | |
506 | );\r | |
507 | \r | |
508 | /**\r | |
509 | Queue an asynchronous isochronous transfer.\r | |
510 | \r | |
511 | @param This The USB_IO instance.\r | |
512 | @param DeviceEndpoint The device endpoint.\r | |
513 | @param Data The data to transfer.\r | |
514 | @param DataLength The length of perodic data transfer.\r | |
13a623cf | 515 | @param IsochronousCallBack The function to call periodically when transfer is\r |
aa79b0b3 | 516 | ready.\r |
517 | @param Context The context to the callback.\r | |
518 | \r | |
519 | @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r | |
520 | \r | |
521 | **/\r | |
522 | EFI_STATUS\r | |
523 | EFIAPI\r | |
524 | UsbIoAsyncIsochronousTransfer (\r | |
525 | IN EFI_USB_IO_PROTOCOL *This,\r | |
526 | IN UINT8 DeviceEndpoint,\r | |
527 | IN OUT VOID *Data,\r | |
528 | IN UINTN DataLength,\r | |
529 | IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r | |
530 | IN VOID *Context OPTIONAL\r | |
531 | );\r | |
532 | \r | |
533 | /**\r | |
534 | Retrieve the device descriptor of the device.\r | |
535 | \r | |
536 | @param This The USB IO instance.\r | |
537 | @param Descriptor The variable to receive the device descriptor.\r | |
538 | \r | |
539 | @retval EFI_SUCCESS The device descriptor is returned.\r | |
540 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
541 | \r | |
542 | **/\r | |
543 | EFI_STATUS\r | |
544 | EFIAPI\r | |
545 | UsbIoGetDeviceDescriptor (\r | |
546 | IN EFI_USB_IO_PROTOCOL *This,\r | |
547 | OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor\r | |
548 | );\r | |
549 | \r | |
550 | /**\r | |
551 | Return the configuration descriptor of the current active configuration.\r | |
552 | \r | |
553 | @param This The USB IO instance.\r | |
554 | @param Descriptor The USB configuration descriptor.\r | |
555 | \r | |
556 | @retval EFI_SUCCESS The active configuration descriptor is returned.\r | |
557 | @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r | |
558 | @retval EFI_NOT_FOUND Currently no active configuration is selected.\r | |
559 | \r | |
560 | **/\r | |
561 | EFI_STATUS\r | |
562 | EFIAPI\r | |
563 | UsbIoGetActiveConfigDescriptor (\r | |
564 | IN EFI_USB_IO_PROTOCOL *This,\r | |
565 | OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor\r | |
566 | );\r | |
567 | \r | |
568 | /**\r | |
569 | Retrieve the active interface setting descriptor for this USB IO instance.\r | |
570 | \r | |
571 | @param This The USB IO instance.\r | |
572 | @param Descriptor The variable to receive active interface setting.\r | |
573 | \r | |
574 | @retval EFI_SUCCESS The active interface setting is returned.\r | |
575 | @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r | |
576 | \r | |
577 | **/\r | |
578 | EFI_STATUS\r | |
579 | EFIAPI\r | |
580 | UsbIoGetInterfaceDescriptor (\r | |
581 | IN EFI_USB_IO_PROTOCOL *This,\r | |
582 | OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor\r | |
583 | );\r | |
584 | \r | |
585 | /**\r | |
586 | Retrieve the endpoint descriptor from this interface setting.\r | |
587 | \r | |
588 | @param This The USB IO instance.\r | |
589 | @param Index The index (start from zero) of the endpoint to\r | |
590 | retrieve.\r | |
591 | @param Descriptor The variable to receive the descriptor.\r | |
592 | \r | |
593 | @retval EFI_SUCCESS The endpoint descriptor is returned.\r | |
594 | @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r | |
595 | \r | |
596 | **/\r | |
597 | EFI_STATUS\r | |
598 | EFIAPI\r | |
599 | UsbIoGetEndpointDescriptor (\r | |
600 | IN EFI_USB_IO_PROTOCOL *This,\r | |
601 | IN UINT8 Index,\r | |
602 | OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor\r | |
603 | );\r | |
604 | \r | |
605 | /**\r | |
606 | Retrieve the supported language ID table from the device.\r | |
607 | \r | |
608 | @param This The USB IO instance.\r | |
609 | @param LangIDTable The table to return the language IDs.\r | |
84909ad4 | 610 | @param TableSize The size, in bytes, of the table LangIDTable.\r |
aa79b0b3 | 611 | \r |
612 | @retval EFI_SUCCESS The language ID is return.\r | |
613 | \r | |
614 | **/\r | |
615 | EFI_STATUS\r | |
616 | EFIAPI\r | |
617 | UsbIoGetSupportedLanguages (\r | |
618 | IN EFI_USB_IO_PROTOCOL *This,\r | |
619 | OUT UINT16 **LangIDTable,\r | |
620 | OUT UINT16 *TableSize\r | |
621 | );\r | |
622 | \r | |
623 | /**\r | |
624 | Retrieve an indexed string in the language of LangID.\r | |
625 | \r | |
626 | @param This The USB IO instance.\r | |
627 | @param LangID The language ID of the string to retrieve.\r | |
628 | @param StringIndex The index of the string.\r | |
629 | @param String The variable to receive the string.\r | |
630 | \r | |
631 | @retval EFI_SUCCESS The string is returned.\r | |
632 | @retval EFI_NOT_FOUND No such string existed.\r | |
633 | \r | |
634 | **/\r | |
635 | EFI_STATUS\r | |
636 | EFIAPI\r | |
637 | UsbIoGetStringDescriptor (\r | |
638 | IN EFI_USB_IO_PROTOCOL *This,\r | |
639 | IN UINT16 LangID,\r | |
640 | IN UINT8 StringIndex,\r | |
641 | OUT CHAR16 **String\r | |
642 | );\r | |
643 | \r | |
644 | /**\r | |
645 | Reset the device, then if that succeeds, reconfigure the\r | |
646 | device with its address and current active configuration.\r | |
647 | \r | |
648 | @param This The USB IO instance.\r | |
649 | \r | |
650 | @retval EFI_SUCCESS The device is reset and configured.\r | |
651 | @retval Others Failed to reset the device.\r | |
652 | \r | |
653 | **/\r | |
654 | EFI_STATUS\r | |
655 | EFIAPI\r | |
656 | UsbIoPortReset (\r | |
657 | IN EFI_USB_IO_PROTOCOL *This\r | |
658 | );\r | |
659 | \r | |
660 | /**\r | |
661 | Install Usb Bus Protocol on host controller, and start the Usb bus.\r | |
662 | \r | |
663 | @param This The USB bus driver binding instance.\r | |
664 | @param Controller The controller to check.\r | |
665 | @param RemainingDevicePath The remaining device patch.\r | |
666 | \r | |
667 | @retval EFI_SUCCESS The controller is controlled by the usb bus.\r | |
668 | @retval EFI_ALREADY_STARTED The controller is already controlled by the usb bus.\r | |
669 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r | |
670 | \r | |
671 | **/\r | |
672 | EFI_STATUS\r | |
673 | EFIAPI\r | |
674 | UsbBusBuildProtocol (\r | |
675 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
676 | IN EFI_HANDLE Controller,\r | |
677 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
678 | );\r | |
679 | \r | |
680 | /**\r | |
681 | The USB bus driver entry pointer.\r | |
682 | \r | |
683 | @param ImageHandle The driver image handle.\r | |
684 | @param SystemTable The system table.\r | |
685 | \r | |
686 | @return EFI_SUCCESS The component name protocol is installed.\r | |
687 | @return Others Failed to init the usb driver.\r | |
688 | \r | |
689 | **/\r | |
690 | EFI_STATUS\r | |
691 | EFIAPI\r | |
692 | UsbBusDriverEntryPoint (\r | |
693 | IN EFI_HANDLE ImageHandle,\r | |
694 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
695 | );\r | |
696 | \r | |
697 | /**\r | |
698 | Check whether USB bus driver support this device.\r | |
699 | \r | |
700 | @param This The USB bus driver binding protocol.\r | |
701 | @param Controller The controller handle to check.\r | |
702 | @param RemainingDevicePath The remaining device path.\r | |
703 | \r | |
704 | @retval EFI_SUCCESS The bus supports this controller.\r | |
705 | @retval EFI_UNSUPPORTED This device isn't supported.\r | |
706 | \r | |
707 | **/\r | |
708 | EFI_STATUS\r | |
709 | EFIAPI\r | |
710 | UsbBusControllerDriverSupported (\r | |
711 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
712 | IN EFI_HANDLE Controller,\r | |
713 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
714 | );\r | |
715 | \r | |
716 | /**\r | |
717 | Start to process the controller.\r | |
718 | \r | |
719 | @param This The USB bus driver binding instance.\r | |
720 | @param Controller The controller to check.\r | |
721 | @param RemainingDevicePath The remaining device patch.\r | |
722 | \r | |
723 | @retval EFI_SUCCESS The controller is controlled by the usb bus.\r | |
724 | @retval EFI_ALREADY_STARTED The controller is already controlled by the usb\r | |
725 | bus.\r | |
726 | @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r | |
727 | \r | |
728 | **/\r | |
729 | EFI_STATUS\r | |
730 | EFIAPI\r | |
731 | UsbBusControllerDriverStart (\r | |
732 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
733 | IN EFI_HANDLE Controller,\r | |
734 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
735 | );\r | |
736 | \r | |
737 | /**\r | |
738 | Stop handle the controller by this USB bus driver.\r | |
739 | \r | |
740 | @param This The USB bus driver binding protocol.\r | |
741 | @param Controller The controller to release.\r | |
742 | @param NumberOfChildren The child of USB bus that opened controller\r | |
743 | BY_CHILD.\r | |
744 | @param ChildHandleBuffer The array of child handle.\r | |
745 | \r | |
746 | @retval EFI_SUCCESS The controller or children are stopped.\r | |
747 | @retval EFI_DEVICE_ERROR Failed to stop the driver.\r | |
748 | \r | |
749 | **/\r | |
750 | EFI_STATUS\r | |
751 | EFIAPI\r | |
752 | UsbBusControllerDriverStop (\r | |
753 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
754 | IN EFI_HANDLE Controller,\r | |
755 | IN UINTN NumberOfChildren,\r | |
756 | IN EFI_HANDLE *ChildHandleBuffer\r | |
757 | );\r | |
758 | \r | |
62b9bb55 | 759 | extern EFI_USB_IO_PROTOCOL mUsbIoProtocol;\r |
760 | extern EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding;\r | |
761 | extern EFI_COMPONENT_NAME_PROTOCOL mUsbBusComponentName;\r | |
762 | extern EFI_COMPONENT_NAME2_PROTOCOL mUsbBusComponentName2;\r | |
e237e7ae | 763 | \r |
764 | #endif\r |