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