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