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