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