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