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