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