]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
Replace SHA1 with SHA256 digest algorithm.
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusDxe / UsbBus.h
CommitLineData
e237e7ae 1/** @file\r
8616fc4c 2\r
3 Usb Bus Driver Binding and Bus IO Protocol.\r
4\r
3d0a2385 5Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>\r
cd5ebaa0 6This program and the accompanying materials\r
e237e7ae 7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT 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
40typedef struct _USB_DEVICE USB_DEVICE;\r
41typedef struct _USB_INTERFACE USB_INTERFACE;\r
42typedef struct _USB_BUS USB_BUS;\r
43typedef 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
141#define EFI_USB_BUS_PROTOCOL_GUID \\r
84b5c78e 142 {0x2B2F68CC, 0x0CD2, 0x44cf, {0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75}}\r
e237e7ae 143\r
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
152//\r
153typedef struct _EFI_USB_BUS_PROTOCOL {\r
154 UINT64 Reserved;\r
155} EFI_USB_BUS_PROTOCOL;\r
156\r
157\r
158//\r
159// Stands for the real USB device. Each device may\r
160// has several seperately working interfaces.\r
161//\r
c52fa98c 162struct _USB_DEVICE {\r
e237e7ae 163 USB_BUS *Bus;\r
164\r
165 //\r
166 // Configuration information\r
167 //\r
168 UINT8 Speed;\r
169 UINT8 Address;\r
92870c98 170 UINT32 MaxPacket0;\r
e237e7ae 171\r
172 //\r
173 // The device's descriptors and its configuration\r
174 //\r
175 USB_DEVICE_DESC *DevDesc;\r
176 USB_CONFIG_DESC *ActiveConfig;\r
177\r
178 UINT16 LangId [USB_MAX_LANG_ID];\r
179 UINT16 TotalLangId;\r
180\r
181 UINT8 NumOfInterface;\r
182 USB_INTERFACE *Interfaces [USB_MAX_INTERFACE];\r
183\r
184 //\r
185 // Parent child relationship\r
186 //\r
187 EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;\r
188\r
189 UINT8 ParentAddr;\r
190 USB_INTERFACE *ParentIf;\r
191 UINT8 ParentPort; // Start at 0\r
92870c98 192 UINT8 Tier;\r
c52fa98c 193};\r
e237e7ae 194\r
195//\r
196// Stands for different functions of USB device\r
197//\r
c52fa98c 198struct _USB_INTERFACE {\r
e237e7ae 199 UINTN Signature;\r
200 USB_DEVICE *Device;\r
201 USB_INTERFACE_DESC *IfDesc;\r
202 USB_INTERFACE_SETTING *IfSetting;\r
203\r
204 //\r
205 // Handles and protocols\r
206 //\r
207 EFI_HANDLE Handle;\r
208 EFI_USB_IO_PROTOCOL UsbIo;\r
209 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
210 BOOLEAN IsManaged;\r
211\r
212 //\r
213 // Hub device special data\r
214 //\r
215 BOOLEAN IsHub;\r
216 USB_HUB_API *HubApi;\r
217 UINT8 NumOfPort;\r
218 EFI_EVENT HubNotify;\r
219\r
220 //\r
221 // Data used only by normal hub devices\r
222 //\r
223 USB_ENDPOINT_DESC *HubEp;\r
224 UINT8 *ChangeMap;\r
225\r
226 //\r
227 // Data used only by root hub to hand over device to\r
228 // companion UHCI driver if low/full speed devices are\r
229 // connected to EHCI.\r
230 //\r
231 UINT8 MaxSpeed;\r
c52fa98c 232};\r
e237e7ae 233\r
234//\r
235// Stands for the current USB Bus\r
236//\r
c52fa98c 237struct _USB_BUS {\r
e237e7ae 238 UINTN Signature;\r
239 EFI_USB_BUS_PROTOCOL BusId;\r
240\r
241 //\r
242 // Managed USB host controller\r
243 //\r
244 EFI_HANDLE HostHandle;\r
245 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
246 EFI_USB2_HC_PROTOCOL *Usb2Hc;\r
247 EFI_USB_HC_PROTOCOL *UsbHc;\r
248\r
249 //\r
250 // An array of device that is on the bus. Devices[0] is\r
251 // for root hub. Device with address i is at Devices[i].\r
252 //\r
92870c98 253 USB_DEVICE *Devices[256];\r
ecb575d9 254\r
255 //\r
256 // USB Bus driver need to control the recursive connect policy of the bus, only those wanted\r
257 // usb child device will be recursively connected.\r
258 //\r
259 // WantedUsbIoDPList tracks the Usb child devices which user want to recursivly fully connecte,\r
260 // every wanted child device is stored in a item of the WantedUsbIoDPList, whose structrure is\r
261 // DEVICE_PATH_LIST_ITEM\r
262 //\r
263 LIST_ENTRY WantedUsbIoDPList;\r
264\r
c52fa98c 265};\r
e237e7ae 266\r
9920ae74 267//\r
268// USB Hub Api\r
269//\r
270struct _USB_HUB_API{\r
271 USB_HUB_INIT Init;\r
272 USB_HUB_GET_PORT_STATUS GetPortStatus;\r
273 USB_HUB_CLEAR_PORT_CHANGE ClearPortChange;\r
274 USB_HUB_SET_PORT_FEATURE SetPortFeature;\r
275 USB_HUB_CLEAR_PORT_FEATURE ClearPortFeature;\r
276 USB_HUB_RESET_PORT ResetPort;\r
277 USB_HUB_RELEASE Release;\r
278};\r
279\r
ecb575d9 280#define USB_US_LAND_ID 0x0409\r
281\r
f3f2e05d 282#define DEVICE_PATH_LIST_ITEM_SIGNATURE SIGNATURE_32('d','p','l','i')\r
ecb575d9 283typedef struct _DEVICE_PATH_LIST_ITEM{\r
284 UINTN Signature;\r
285 LIST_ENTRY Link;\r
286 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
287} DEVICE_PATH_LIST_ITEM;\r
288\r
289typedef struct {\r
290 USB_CLASS_DEVICE_PATH UsbClass;\r
291 EFI_DEVICE_PATH_PROTOCOL End;\r
292} USB_CLASS_FORMAT_DEVICE_PATH;\r
293\r
8616fc4c 294/**\r
295 Free a DEVICE_PATH_LIST_ITEM list.\r
296\r
297 @param UsbIoDPList a DEVICE_PATH_LIST_ITEM list pointer.\r
298\r
299 @retval EFI_INVALID_PARAMETER If parameters are invalid, return this value.\r
300 @retval EFI_SUCCESS If free operation is successful, return this value.\r
301\r
302**/\r
ecb575d9 303EFI_STATUS\r
304EFIAPI\r
305UsbBusFreeUsbDPList (\r
306 IN LIST_ENTRY *UsbIoDPList\r
307 );\r
308\r
8616fc4c 309/**\r
310 Store a wanted usb child device info (its Usb part of device path) which is indicated by\r
311 RemainingDevicePath in a Usb bus which is indicated by UsbBusId.\r
312\r
313 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
314 @param RemainingDevicePath The remaining device patch.\r
315\r
316 @retval EFI_SUCCESS Add operation is successful.\r
317 @retval EFI_INVALID_PARAMETER The parameters are invalid.\r
318\r
319**/\r
ecb575d9 320EFI_STATUS\r
321EFIAPI\r
322UsbBusAddWantedUsbIoDP (\r
323 IN EFI_USB_BUS_PROTOCOL *UsbBusId,\r
324 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
325 );\r
326\r
8616fc4c 327/**\r
328 Check whether a usb child device is the wanted device in a bus.\r
329\r
330 @param Bus The Usb bus's private data pointer.\r
331 @param UsbIf The usb child device inferface.\r
332\r
333 @retval True If a usb child device is the wanted device in a bus.\r
334 @retval False If a usb child device is *NOT* the wanted device in a bus.\r
335\r
336**/\r
ecb575d9 337BOOLEAN\r
338EFIAPI\r
339UsbBusIsWantedUsbIO (\r
340 IN USB_BUS *Bus,\r
341 IN USB_INTERFACE *UsbIf\r
342 );\r
343\r
8616fc4c 344/**\r
345 Recursively connnect every wanted usb child device to ensure they all fully connected.\r
346 Check all the child Usb IO handles in this bus, recursively connecte if it is wanted usb child device.\r
347\r
348 @param UsbBusId Point to EFI_USB_BUS_PROTOCOL interface.\r
349\r
350 @retval EFI_SUCCESS Connect is done successfully.\r
351 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
352\r
353**/\r
ecb575d9 354EFI_STATUS\r
355EFIAPI\r
356UsbBusRecursivelyConnectWantedUsbIo (\r
357 IN EFI_USB_BUS_PROTOCOL *UsbBusId\r
358 );\r
359\r
aa79b0b3 360/**\r
361 USB_IO function to execute a control transfer. This\r
362 function will execute the USB transfer. If transfer\r
363 successes, it will sync the internal state of USB bus\r
364 with device state.\r
365\r
366 @param This The USB_IO instance\r
367 @param Request The control transfer request\r
368 @param Direction Direction for data stage\r
369 @param Timeout The time to wait before timeout\r
370 @param Data The buffer holding the data\r
371 @param DataLength Then length of the data\r
372 @param UsbStatus USB result\r
373\r
374 @retval EFI_INVALID_PARAMETER The parameters are invalid\r
375 @retval EFI_SUCCESS The control transfer succeded.\r
376 @retval Others Failed to execute the transfer\r
377\r
378**/\r
379EFI_STATUS\r
380EFIAPI\r
381UsbIoControlTransfer (\r
382 IN EFI_USB_IO_PROTOCOL *This,\r
383 IN EFI_USB_DEVICE_REQUEST *Request,\r
384 IN EFI_USB_DATA_DIRECTION Direction,\r
385 IN UINT32 Timeout,\r
386 IN OUT VOID *Data, OPTIONAL\r
387 IN UINTN DataLength, OPTIONAL\r
388 OUT UINT32 *UsbStatus\r
389 );\r
390\r
391/**\r
392 Execute a bulk transfer to the device endpoint.\r
393\r
394 @param This The USB IO instance.\r
395 @param Endpoint The device endpoint.\r
396 @param Data The data to transfer.\r
397 @param DataLength The length of the data to transfer.\r
398 @param Timeout Time to wait before timeout.\r
399 @param UsbStatus The result of USB transfer.\r
400\r
401 @retval EFI_SUCCESS The bulk transfer is OK.\r
402 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
403 @retval Others Failed to execute transfer, reason returned in\r
404 UsbStatus.\r
405\r
406**/\r
407EFI_STATUS\r
408EFIAPI\r
409UsbIoBulkTransfer (\r
410 IN EFI_USB_IO_PROTOCOL *This,\r
411 IN UINT8 Endpoint,\r
412 IN OUT VOID *Data,\r
413 IN OUT UINTN *DataLength,\r
414 IN UINTN Timeout,\r
415 OUT UINT32 *UsbStatus\r
416 );\r
417\r
418/**\r
419 Execute a synchronous interrupt transfer.\r
420\r
421 @param This The USB IO instance.\r
422 @param Endpoint The device endpoint.\r
423 @param Data The data to transfer.\r
424 @param DataLength The length of the data to transfer.\r
425 @param Timeout Time to wait before timeout.\r
426 @param UsbStatus The result of USB transfer.\r
427\r
428 @retval EFI_SUCCESS The synchronous interrupt transfer is OK.\r
429 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
430 @retval Others Failed to execute transfer, reason returned in\r
431 UsbStatus.\r
432\r
433**/\r
434EFI_STATUS\r
435EFIAPI\r
436UsbIoSyncInterruptTransfer (\r
437 IN EFI_USB_IO_PROTOCOL *This,\r
438 IN UINT8 Endpoint,\r
439 IN OUT VOID *Data,\r
440 IN OUT UINTN *DataLength,\r
441 IN UINTN Timeout,\r
442 OUT UINT32 *UsbStatus\r
443 );\r
444\r
445/**\r
446 Queue a new asynchronous interrupt transfer, or remove the old\r
447 request if (IsNewTransfer == FALSE).\r
448\r
449 @param This The USB_IO instance.\r
450 @param Endpoint The device endpoint.\r
451 @param IsNewTransfer Whether this is a new request, if it's old, remove\r
452 the request.\r
453 @param PollInterval The interval to poll the transfer result, (in ms).\r
454 @param DataLength The length of perodic data transfer.\r
455 @param Callback The function to call periodicaly when transfer is\r
456 ready.\r
457 @param Context The context to the callback.\r
458\r
459 @retval EFI_SUCCESS New transfer is queued or old request is removed.\r
460 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
461 @retval Others Failed to queue the new request or remove the old\r
462 request.\r
463\r
464**/\r
465EFI_STATUS\r
466EFIAPI\r
467UsbIoAsyncInterruptTransfer (\r
468 IN EFI_USB_IO_PROTOCOL *This,\r
469 IN UINT8 Endpoint,\r
470 IN BOOLEAN IsNewTransfer,\r
471 IN UINTN PollInterval, OPTIONAL\r
472 IN UINTN DataLength, OPTIONAL\r
473 IN EFI_ASYNC_USB_TRANSFER_CALLBACK Callback, OPTIONAL\r
474 IN VOID *Context OPTIONAL\r
475 );\r
476\r
477/**\r
478 Execute a synchronous isochronous transfer.\r
479\r
480 @param This The USB IO instance.\r
481 @param DeviceEndpoint The device endpoint.\r
482 @param Data The data to transfer.\r
483 @param DataLength The length of the data to transfer.\r
484 @param UsbStatus The result of USB transfer.\r
485\r
486 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
487\r
488**/\r
489EFI_STATUS\r
490EFIAPI\r
491UsbIoIsochronousTransfer (\r
492 IN EFI_USB_IO_PROTOCOL *This,\r
493 IN UINT8 DeviceEndpoint,\r
494 IN OUT VOID *Data,\r
495 IN UINTN DataLength,\r
496 OUT UINT32 *Status\r
497 );\r
498\r
499/**\r
500 Queue an asynchronous isochronous transfer.\r
501\r
502 @param This The USB_IO instance.\r
503 @param DeviceEndpoint The device endpoint.\r
504 @param Data The data to transfer.\r
505 @param DataLength The length of perodic data transfer.\r
506 @param IsochronousCallBack The function to call periodicaly when transfer is\r
507 ready.\r
508 @param Context The context to the callback.\r
509\r
510 @retval EFI_UNSUPPORTED Currently isochronous transfer isn't supported.\r
511\r
512**/\r
513EFI_STATUS\r
514EFIAPI\r
515UsbIoAsyncIsochronousTransfer (\r
516 IN EFI_USB_IO_PROTOCOL *This,\r
517 IN UINT8 DeviceEndpoint,\r
518 IN OUT VOID *Data,\r
519 IN UINTN DataLength,\r
520 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,\r
521 IN VOID *Context OPTIONAL\r
522 );\r
523\r
524/**\r
525 Retrieve the device descriptor of the device.\r
526\r
527 @param This The USB IO instance.\r
528 @param Descriptor The variable to receive the device descriptor.\r
529\r
530 @retval EFI_SUCCESS The device descriptor is returned.\r
531 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
532\r
533**/\r
534EFI_STATUS\r
535EFIAPI\r
536UsbIoGetDeviceDescriptor (\r
537 IN EFI_USB_IO_PROTOCOL *This,\r
538 OUT EFI_USB_DEVICE_DESCRIPTOR *Descriptor\r
539 );\r
540\r
541/**\r
542 Return the configuration descriptor of the current active configuration.\r
543\r
544 @param This The USB IO instance.\r
545 @param Descriptor The USB configuration descriptor.\r
546\r
547 @retval EFI_SUCCESS The active configuration descriptor is returned.\r
548 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
549 @retval EFI_NOT_FOUND Currently no active configuration is selected.\r
550\r
551**/\r
552EFI_STATUS\r
553EFIAPI\r
554UsbIoGetActiveConfigDescriptor (\r
555 IN EFI_USB_IO_PROTOCOL *This,\r
556 OUT EFI_USB_CONFIG_DESCRIPTOR *Descriptor\r
557 );\r
558\r
559/**\r
560 Retrieve the active interface setting descriptor for this USB IO instance.\r
561\r
562 @param This The USB IO instance.\r
563 @param Descriptor The variable to receive active interface setting.\r
564\r
565 @retval EFI_SUCCESS The active interface setting is returned.\r
566 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
567\r
568**/\r
569EFI_STATUS\r
570EFIAPI\r
571UsbIoGetInterfaceDescriptor (\r
572 IN EFI_USB_IO_PROTOCOL *This,\r
573 OUT EFI_USB_INTERFACE_DESCRIPTOR *Descriptor\r
574 );\r
575\r
576/**\r
577 Retrieve the endpoint descriptor from this interface setting.\r
578\r
579 @param This The USB IO instance.\r
580 @param Index The index (start from zero) of the endpoint to\r
581 retrieve.\r
582 @param Descriptor The variable to receive the descriptor.\r
583\r
584 @retval EFI_SUCCESS The endpoint descriptor is returned.\r
585 @retval EFI_INVALID_PARAMETER Some parameter is invalid.\r
586\r
587**/\r
588EFI_STATUS\r
589EFIAPI\r
590UsbIoGetEndpointDescriptor (\r
591 IN EFI_USB_IO_PROTOCOL *This,\r
592 IN UINT8 Index,\r
593 OUT EFI_USB_ENDPOINT_DESCRIPTOR *Descriptor\r
594 );\r
595\r
596/**\r
597 Retrieve the supported language ID table from the device.\r
598\r
599 @param This The USB IO instance.\r
600 @param LangIDTable The table to return the language IDs.\r
84909ad4 601 @param TableSize The size, in bytes, of the table LangIDTable.\r
aa79b0b3 602\r
603 @retval EFI_SUCCESS The language ID is return.\r
604\r
605**/\r
606EFI_STATUS\r
607EFIAPI\r
608UsbIoGetSupportedLanguages (\r
609 IN EFI_USB_IO_PROTOCOL *This,\r
610 OUT UINT16 **LangIDTable,\r
611 OUT UINT16 *TableSize\r
612 );\r
613\r
614/**\r
615 Retrieve an indexed string in the language of LangID.\r
616\r
617 @param This The USB IO instance.\r
618 @param LangID The language ID of the string to retrieve.\r
619 @param StringIndex The index of the string.\r
620 @param String The variable to receive the string.\r
621\r
622 @retval EFI_SUCCESS The string is returned.\r
623 @retval EFI_NOT_FOUND No such string existed.\r
624\r
625**/\r
626EFI_STATUS\r
627EFIAPI\r
628UsbIoGetStringDescriptor (\r
629 IN EFI_USB_IO_PROTOCOL *This,\r
630 IN UINT16 LangID,\r
631 IN UINT8 StringIndex,\r
632 OUT CHAR16 **String\r
633 );\r
634\r
635/**\r
636 Reset the device, then if that succeeds, reconfigure the\r
637 device with its address and current active configuration.\r
638\r
639 @param This The USB IO instance.\r
640\r
641 @retval EFI_SUCCESS The device is reset and configured.\r
642 @retval Others Failed to reset the device.\r
643\r
644**/\r
645EFI_STATUS\r
646EFIAPI\r
647UsbIoPortReset (\r
648 IN EFI_USB_IO_PROTOCOL *This\r
649 );\r
650\r
651/**\r
652 Install Usb Bus Protocol on host controller, and start the Usb bus.\r
653\r
654 @param This The USB bus driver binding instance.\r
655 @param Controller The controller to check.\r
656 @param RemainingDevicePath The remaining device patch.\r
657\r
658 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
659 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb bus.\r
660 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
661\r
662**/\r
663EFI_STATUS\r
664EFIAPI\r
665UsbBusBuildProtocol (\r
666 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
667 IN EFI_HANDLE Controller,\r
668 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
669 );\r
670\r
671/**\r
672 The USB bus driver entry pointer.\r
673\r
674 @param ImageHandle The driver image handle.\r
675 @param SystemTable The system table.\r
676\r
677 @return EFI_SUCCESS The component name protocol is installed.\r
678 @return Others Failed to init the usb driver.\r
679\r
680**/\r
681EFI_STATUS\r
682EFIAPI\r
683UsbBusDriverEntryPoint (\r
684 IN EFI_HANDLE ImageHandle,\r
685 IN EFI_SYSTEM_TABLE *SystemTable\r
686 );\r
687\r
688/**\r
689 Check whether USB bus driver support this device.\r
690\r
691 @param This The USB bus driver binding protocol.\r
692 @param Controller The controller handle to check.\r
693 @param RemainingDevicePath The remaining device path.\r
694\r
695 @retval EFI_SUCCESS The bus supports this controller.\r
696 @retval EFI_UNSUPPORTED This device isn't supported.\r
697\r
698**/\r
699EFI_STATUS\r
700EFIAPI\r
701UsbBusControllerDriverSupported (\r
702 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
703 IN EFI_HANDLE Controller,\r
704 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
705 );\r
706\r
707/**\r
708 Start to process the controller.\r
709\r
710 @param This The USB bus driver binding instance.\r
711 @param Controller The controller to check.\r
712 @param RemainingDevicePath The remaining device patch.\r
713\r
714 @retval EFI_SUCCESS The controller is controlled by the usb bus.\r
715 @retval EFI_ALREADY_STARTED The controller is already controlled by the usb\r
716 bus.\r
717 @retval EFI_OUT_OF_RESOURCES Failed to allocate resources.\r
718\r
719**/\r
720EFI_STATUS\r
721EFIAPI\r
722UsbBusControllerDriverStart (\r
723 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
724 IN EFI_HANDLE Controller,\r
725 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
726 );\r
727\r
728/**\r
729 Stop handle the controller by this USB bus driver.\r
730\r
731 @param This The USB bus driver binding protocol.\r
732 @param Controller The controller to release.\r
733 @param NumberOfChildren The child of USB bus that opened controller\r
734 BY_CHILD.\r
735 @param ChildHandleBuffer The array of child handle.\r
736\r
737 @retval EFI_SUCCESS The controller or children are stopped.\r
738 @retval EFI_DEVICE_ERROR Failed to stop the driver.\r
739\r
740**/\r
741EFI_STATUS\r
742EFIAPI\r
743UsbBusControllerDriverStop (\r
744 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
745 IN EFI_HANDLE Controller,\r
746 IN UINTN NumberOfChildren,\r
747 IN EFI_HANDLE *ChildHandleBuffer\r
748 );\r
749\r
92870c98 750extern UINT16 mMaxUsbDeviceNum;\r
62b9bb55 751extern EFI_USB_IO_PROTOCOL mUsbIoProtocol;\r
752extern EFI_DRIVER_BINDING_PROTOCOL mUsbBusDriverBinding;\r
753extern EFI_COMPONENT_NAME_PROTOCOL mUsbBusComponentName;\r
754extern EFI_COMPONENT_NAME2_PROTOCOL mUsbBusComponentName2;\r
e237e7ae 755\r
756#endif\r