• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   EFI_USB2_HC_PROTOCOL as defined in UEFI 2.0.
3   The USB Host Controller Protocol is used by code, typically USB bus drivers,
4   running in the EFI boot services environment, to perform data transactions over
5   a USB bus. In addition, it provides an abstraction for the root hub of the USB bus.
6 
7   Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
8   This program and the accompanying materials
9   are licensed and made available under the terms and conditions of the BSD License
10   which accompanies this distribution.  The full text of the license may be found at
11   http://opensource.org/licenses/bsd-license.php
12 
13   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 
16 **/
17 
18 #ifndef _USB2_HOSTCONTROLLER_H_
19 #define _USB2_HOSTCONTROLLER_H_
20 
21 #include <Protocol/UsbIo.h>
22 
23 #define EFI_USB2_HC_PROTOCOL_GUID \
24   { \
25     0x3e745226, 0x9818, 0x45b6, {0xa2, 0xac, 0xd7, 0xcd, 0xe, 0x8b, 0xa2, 0xbc } \
26   }
27 
28 ///
29 /// Forward reference for pure ANSI compatability
30 ///
31 typedef struct _EFI_USB2_HC_PROTOCOL EFI_USB2_HC_PROTOCOL;
32 
33 
34 typedef struct {
35   UINT16          PortStatus;        ///< Contains current port status bitmap.
36   UINT16          PortChangeStatus;  ///< Contains current port status change bitmap.
37 } EFI_USB_PORT_STATUS;
38 
39 ///
40 /// EFI_USB_PORT_STATUS.PortStatus bit definition
41 ///
42 #define USB_PORT_STAT_CONNECTION    0x0001
43 #define USB_PORT_STAT_ENABLE        0x0002
44 #define USB_PORT_STAT_SUSPEND       0x0004
45 #define USB_PORT_STAT_OVERCURRENT   0x0008
46 #define USB_PORT_STAT_RESET         0x0010
47 #define USB_PORT_STAT_POWER         0x0100
48 #define USB_PORT_STAT_LOW_SPEED     0x0200
49 #define USB_PORT_STAT_HIGH_SPEED    0x0400
50 #define USB_PORT_STAT_SUPER_SPEED   0x0800
51 #define USB_PORT_STAT_OWNER         0x2000
52 
53 ///
54 /// EFI_USB_PORT_STATUS.PortChangeStatus bit definition
55 ///
56 #define USB_PORT_STAT_C_CONNECTION  0x0001
57 #define USB_PORT_STAT_C_ENABLE      0x0002
58 #define USB_PORT_STAT_C_SUSPEND     0x0004
59 #define USB_PORT_STAT_C_OVERCURRENT 0x0008
60 #define USB_PORT_STAT_C_RESET       0x0010
61 
62 
63 ///
64 /// Usb port features value
65 /// Each value indicates its bit index in the port status and status change bitmaps,
66 /// if combines these two bitmaps into a 32-bit bitmap.
67 ///
68 typedef enum {
69   EfiUsbPortEnable            = 1,
70   EfiUsbPortSuspend           = 2,
71   EfiUsbPortReset             = 4,
72   EfiUsbPortPower             = 8,
73   EfiUsbPortOwner             = 13,
74   EfiUsbPortConnectChange     = 16,
75   EfiUsbPortEnableChange      = 17,
76   EfiUsbPortSuspendChange     = 18,
77   EfiUsbPortOverCurrentChange = 19,
78   EfiUsbPortResetChange       = 20
79 } EFI_USB_PORT_FEATURE;
80 
81 #define EFI_USB_SPEED_FULL      0x0000  ///< 12 Mb/s, USB 1.1 OHCI and UHCI HC.
82 #define EFI_USB_SPEED_LOW       0x0001  ///< 1 Mb/s, USB 1.1 OHCI and UHCI HC.
83 #define EFI_USB_SPEED_HIGH      0x0002  ///< 480 Mb/s, USB 2.0 EHCI HC.
84 #define EFI_USB_SPEED_SUPER     0x0003  ///< 4.8 Gb/s, USB 3.0 XHCI HC.
85 
86 typedef struct {
87   UINT8      TranslatorHubAddress; ///< device address
88   UINT8      TranslatorPortNumber; ///< the port number of the hub that device is connected to.
89 } EFI_USB2_HC_TRANSACTION_TRANSLATOR;
90 
91 //
92 // Protocol definitions
93 //
94 
95 /**
96   Retrieves the Host Controller capabilities.
97 
98   @param  This           A pointer to the EFI_USB2_HC_PROTOCOL instance.
99   @param  MaxSpeed       Host controller data transfer speed.
100   @param  PortNumber     Number of the root hub ports.
101   @param  Is64BitCapable TRUE if controller supports 64-bit memory addressing,
102                          FALSE otherwise.
103 
104   @retval EFI_SUCCESS           The host controller capabilities were retrieved successfully.
105   @retval EFI_INVALID_PARAMETER One of the input args was NULL.
106   @retval EFI_DEVICE_ERROR      An error was encountered while attempting to
107                                 retrieve the capabilities.
108 
109 **/
110 typedef
111 EFI_STATUS
112 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_CAPABILITY)(
113   IN  EFI_USB2_HC_PROTOCOL  *This,
114   OUT UINT8                 *MaxSpeed,
115   OUT UINT8                 *PortNumber,
116   OUT UINT8                 *Is64BitCapable
117   );
118 
119 #define EFI_USB_HC_RESET_GLOBAL             0x0001
120 #define EFI_USB_HC_RESET_HOST_CONTROLLER    0x0002
121 #define EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG  0x0004
122 #define EFI_USB_HC_RESET_HOST_WITH_DEBUG    0x0008
123 /**
124   Provides software reset for the USB host controller.
125 
126   @param  This       A pointer to the EFI_USB2_HC_PROTOCOL instance.
127   @param  Attributes A bit mask of the reset operation to perform.
128 
129   @retval EFI_SUCCESS           The reset operation succeeded.
130   @retval EFI_INVALID_PARAMETER Attributes is not valid.
131   @retval EFI_UNSUPPORTED       The type of reset specified by Attributes is not currently
132                                 supported by the host controller hardware.
133   @retval EFI_ACCESS_DENIED     Reset operation is rejected due to the debug port being configured
134                                 and active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
135                                 EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Attributes can be used to
136                                 perform reset operation for this host controller.
137   @retval EFI_DEVICE_ERROR      An error was encountered while attempting to
138                                 retrieve the capabilities.
139 
140 **/
141 typedef
142 EFI_STATUS
143 (EFIAPI *EFI_USB2_HC_PROTOCOL_RESET)(
144   IN EFI_USB2_HC_PROTOCOL   *This,
145   IN UINT16                 Attributes
146   );
147 
148 /**
149   Enumration value for status of USB HC.
150 **/
151 typedef enum {
152   EfiUsbHcStateHalt,                ///< The host controller is in halt
153                                     ///< state. No USB transactions can occur
154                                     ///< while in this state. The host
155                                     ///< controller can enter this state for
156                                     ///< three reasons: 1) After host
157                                     ///< controller hardware reset. 2)
158                                     ///< Explicitly set by software. 3)
159                                     ///< Triggered by a fatal error such as
160                                     ///< consistency check failure.
161 
162   EfiUsbHcStateOperational,         ///< The host controller is in an
163                                     ///< operational state. When in
164                                     ///< this state, the host
165                                     ///< controller can execute bus
166                                     ///< traffic. This state must be
167                                     ///< explicitly set to enable the
168                                     ///< USB bus traffic.
169 
170   EfiUsbHcStateSuspend,             ///< The host controller is in the
171                                     ///< suspend state. No USB
172                                     ///< transactions can occur while in
173                                     ///< this state. The host controller
174                                     ///< enters this state for the
175                                     ///< following reasons: 1) Explicitly
176                                     ///< set by software. 2) Triggered
177                                     ///< when there is no bus traffic for
178                                     ///< 3 microseconds.
179 
180   EfiUsbHcStateMaximum              ///< Maximum value for enumration value of HC status.
181 } EFI_USB_HC_STATE;
182 
183 /**
184   Retrieves current state of the USB host controller.
185 
186   @param  This  A pointer to the EFI_USB2_HC_PROTOCOL instance.
187   @param  State A pointer to the EFI_USB_HC_STATE data structure that
188                 indicates current state of the USB host controller.
189 
190   @retval EFI_SUCCESS           The state information of the host controller was returned in State.
191   @retval EFI_INVALID_PARAMETER State is NULL.
192   @retval EFI_DEVICE_ERROR      An error was encountered while attempting to retrieve the
193                                 host controller's current state.
194 
195 **/
196 typedef
197 EFI_STATUS
198 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_STATE)(
199   IN        EFI_USB2_HC_PROTOCOL    *This,
200   OUT       EFI_USB_HC_STATE        *State
201 );
202 
203 /**
204   Sets the USB host controller to a specific state.
205 
206   @param  This  A pointer to the EFI_USB2_HC_PROTOCOL instance.
207   @param  State Indicates the state of the host controller that will be set.
208 
209   @retval EFI_SUCCESS           The USB host controller was successfully placed in the state
210                                 specified by State.
211   @retval EFI_INVALID_PARAMETER State is not valid.
212   @retval EFI_DEVICE_ERROR      Failed to set the state specified by State due to device error.
213 
214 **/
215 typedef
216 EFI_STATUS
217 (EFIAPI *EFI_USB2_HC_PROTOCOL_SET_STATE)(
218   IN EFI_USB2_HC_PROTOCOL    *This,
219   IN EFI_USB_HC_STATE        State
220   );
221 
222 /**
223   Submits control transfer to a target USB device.
224 
225   @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.
226   @param  DeviceAddress       Represents the address of the target device on the USB.
227   @param  DeviceSpeed         Indicates device speed.
228   @param  MaximumPacketLength Indicates the maximum packet size that the default control transfer
229                               endpoint is capable of sending or receiving.
230   @param  Request             A pointer to the USB device request that will be sent to the USB device.
231   @param  TransferDirection   Specifies the data direction for the transfer. There are three values
232                               available, EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
233   @param  Data                A pointer to the buffer of data that will be transmitted to USB device or
234                               received from USB device.
235   @param  DataLength          On input, indicates the size, in bytes, of the data buffer specified by Data.
236                               On output, indicates the amount of data actually transferred.
237   @param  TimeOut             Indicates the maximum time, in milliseconds, which the transfer is
238                               allowed to complete.
239   @param  Translator          A pointer to the transaction translator data.
240   @param  TransferResult      A pointer to the detailed result information generated by this control
241                               transfer.
242 
243   @retval EFI_SUCCESS           The control transfer was completed successfully.
244   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
245   @retval EFI_OUT_OF_RESOURCES  The control transfer could not be completed due to a lack of resources.
246   @retval EFI_TIMEOUT           The control transfer failed due to timeout.
247   @retval EFI_DEVICE_ERROR      The control transfer failed due to host controller or device error.
248                                 Caller should check TransferResult for detailed error information.
249 
250 **/
251 typedef
252 EFI_STATUS
253 (EFIAPI *EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER)(
254   IN     EFI_USB2_HC_PROTOCOL               *This,
255   IN     UINT8                              DeviceAddress,
256   IN     UINT8                              DeviceSpeed,
257   IN     UINTN                              MaximumPacketLength,
258   IN     EFI_USB_DEVICE_REQUEST             *Request,
259   IN     EFI_USB_DATA_DIRECTION             TransferDirection,
260   IN OUT VOID                               *Data       OPTIONAL,
261   IN OUT UINTN                              *DataLength OPTIONAL,
262   IN     UINTN                              TimeOut,
263   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
264   OUT    UINT32                             *TransferResult
265   );
266 
267 #define EFI_USB_MAX_BULK_BUFFER_NUM 10
268 
269 /**
270   Submits bulk transfer to a bulk endpoint of a USB device.
271 
272   @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.
273   @param  DeviceAddress       Represents the address of the target device on the USB.
274   @param  EndPointAddress     The combination of an endpoint number and an endpoint direction of the
275                               target USB device.
276   @param  DeviceSpeed         Indicates device speed.
277   @param  MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
278                               sending or receiving.
279   @param  DataBuffersNumber   Number of data buffers prepared for the transfer.
280   @param  Data                Array of pointers to the buffers of data that will be transmitted to USB
281                               device or received from USB device.
282   @param  DataLength          When input, indicates the size, in bytes, of the data buffers specified by
283                               Data. When output, indicates the actually transferred data size.
284   @param  DataToggle          A pointer to the data toggle value.
285   @param  TimeOut             Indicates the maximum time, in milliseconds, which the transfer is
286                               allowed to complete.
287   @param  Translator          A pointer to the transaction translator data.
288   @param  TransferResult      A pointer to the detailed result information of the bulk transfer.
289 
290   @retval EFI_SUCCESS           The bulk transfer was completed successfully.
291   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
292   @retval EFI_OUT_OF_RESOURCES  The bulk transfer could not be submitted due to a lack of resources.
293   @retval EFI_TIMEOUT           The bulk transfer failed due to timeout.
294   @retval EFI_DEVICE_ERROR      The bulk transfer failed due to host controller or device error.
295                                 Caller should check TransferResult for detailed error information.
296 
297 **/
298 typedef
299 EFI_STATUS
300 (EFIAPI *EFI_USB2_HC_PROTOCOL_BULK_TRANSFER)(
301   IN     EFI_USB2_HC_PROTOCOL               *This,
302   IN     UINT8                              DeviceAddress,
303   IN     UINT8                              EndPointAddress,
304   IN     UINT8                              DeviceSpeed,
305   IN     UINTN                              MaximumPacketLength,
306   IN     UINT8                              DataBuffersNumber,
307   IN OUT VOID                               *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
308   IN OUT UINTN                              *DataLength,
309   IN OUT UINT8                              *DataToggle,
310   IN     UINTN                              TimeOut,
311   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
312   OUT    UINT32                             *TransferResult
313   );
314 
315 /**
316   Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
317   Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
318 
319   @param  This                A pointer to the EFI_USB2_HC_PROTOCOL instance.
320   @param  DeviceAddress       Represents the address of the target device on the USB.
321   @param  EndPointAddress     The combination of an endpoint number and an endpoint direction of the
322                               target USB device.
323   @param  DeviceSpeed         Indicates device speed.
324   @param  MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
325                               sending or receiving.
326   @param  IsNewTransfer       If TRUE, an asynchronous interrupt pipe is built between the host and the
327                               target interrupt endpoint. If FALSE, the specified asynchronous interrupt
328                               pipe is canceled. If TRUE, and an interrupt transfer exists for the target
329                               end point, then EFI_INVALID_PARAMETER is returned.
330   @param  DataToggle          A pointer to the data toggle value.
331   @param  PollingInterval     Indicates the interval, in milliseconds, that the asynchronous interrupt
332                               transfer is polled.
333   @param  DataLength          Indicates the length of data to be received at the rate specified by
334                               PollingInterval from the target asynchronous interrupt endpoint.
335   @param  Translator          A pointr to the transaction translator data.
336   @param  CallBackFunction    The Callback function. This function is called at the rate specified by
337                               PollingInterval.
338   @param  Context             The context that is passed to the CallBackFunction. This is an
339                               optional parameter and may be NULL.
340 
341   @retval EFI_SUCCESS           The asynchronous interrupt transfer request has been successfully
342                                 submitted or canceled.
343   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
344   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
345 
346 **/
347 typedef
348 EFI_STATUS
349 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER)(
350   IN     EFI_USB2_HC_PROTOCOL                                *This,
351   IN     UINT8                                               DeviceAddress,
352   IN     UINT8                                               EndPointAddress,
353   IN     UINT8                                               DeviceSpeed,
354   IN     UINTN                                               MaxiumPacketLength,
355   IN     BOOLEAN                                             IsNewTransfer,
356   IN OUT UINT8                                               *DataToggle,
357   IN     UINTN                                               PollingInterval  OPTIONAL,
358   IN     UINTN                                               DataLength       OPTIONAL,
359   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR                  *Translator      OPTIONAL,
360   IN     EFI_ASYNC_USB_TRANSFER_CALLBACK                     CallBackFunction OPTIONAL,
361   IN     VOID                                                *Context         OPTIONAL
362   );
363 
364 /**
365   Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
366   Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
367 
368   @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.
369   @param  DeviceAddress         Represents the address of the target device on the USB.
370   @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the
371                                 target USB device.
372   @param  DeviceSpeed           Indicates device speed.
373   @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of
374                                 sending or receiving.
375   @param  Data                  A pointer to the buffer of data that will be transmitted to USB device or
376                                 received from USB device.
377   @param  DataLength            On input, the size, in bytes, of the data buffer specified by Data. On
378                                 output, the number of bytes transferred.
379   @param  DataToggle            A pointer to the data toggle value.
380   @param  TimeOut               Indicates the maximum time, in milliseconds, which the transfer is
381                                 allowed to complete.
382   @param  Translator            A pointr to the transaction translator data.
383   @param  TransferResult        A pointer to the detailed result information from the synchronous
384                                 interrupt transfer.
385 
386   @retval EFI_SUCCESS           The synchronous interrupt transfer was completed successfully.
387   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
388   @retval EFI_OUT_OF_RESOURCES  The synchronous interrupt transfer could not be submitted due to a lack of resources.
389   @retval EFI_TIMEOUT           The synchronous interrupt transfer failed due to timeout.
390   @retval EFI_DEVICE_ERROR      The synchronous interrupt transfer failed due to host controller or device error.
391                                 Caller should check TransferResult for detailed error information.
392 
393 **/
394 typedef
395 EFI_STATUS
396 (EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER)(
397   IN     EFI_USB2_HC_PROTOCOL                        *This,
398   IN     UINT8                                       DeviceAddress,
399   IN     UINT8                                       EndPointAddress,
400   IN     UINT8                                       DeviceSpeed,
401   IN     UINTN                                       MaximumPacketLength,
402   IN OUT VOID                                        *Data,
403   IN OUT UINTN                                       *DataLength,
404   IN OUT UINT8                                       *DataToggle,
405   IN     UINTN                                       TimeOut,
406   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR          *Translator,
407   OUT    UINT32                                      *TransferResult
408   );
409 
410 #define EFI_USB_MAX_ISO_BUFFER_NUM  7
411 #define EFI_USB_MAX_ISO_BUFFER_NUM1 2
412 
413 /**
414   Submits isochronous transfer to an isochronous endpoint of a USB device.
415 
416   This function is used to submit isochronous transfer to a target endpoint of a USB device.
417   The target endpoint is specified by DeviceAddressand EndpointAddress. Isochronous transfers are
418   used when working with isochronous date. It provides periodic, continuous communication between
419   the host and a device. Isochronous transfers can beused only by full-speed, high-speed, and
420   super-speed devices.
421 
422   High-speed isochronous transfers can be performed using multiple data buffers. The number of
423   buffers that are actually prepared for the transfer is specified by DataBuffersNumber. For
424   full-speed isochronous transfers this value is ignored.
425 
426   Data represents a list of pointers to the data buffers. For full-speed isochronous transfers
427   only the data pointed by Data[0]shall be used. For high-speed isochronous transfers and for
428   the split transactions depending on DataLengththere several data buffers canbe used. For the
429   high-speed isochronous transfers the total number of buffers must not exceed EFI_USB_MAX_ISO_BUFFER_NUM.
430 
431   For split transactions performed on full-speed device by high-speed host controller the total
432   number of buffers is limited to EFI_USB_MAX_ISO_BUFFER_NUM1.
433   If the isochronous transfer is successful, then EFI_SUCCESSis returned. The isochronous transfer
434   is designed to be completed within one USB frame time, if it cannot be completed, EFI_TIMEOUT
435   is returned. If an error other than timeout occurs during the USB transfer, then EFI_DEVICE_ERROR
436   is returned and the detailed status code will be returned in TransferResult.
437 
438   EFI_INVALID_PARAMETERis returned if one of the following conditionsis satisfied:
439     - Data is NULL.
440     - DataLength is 0.
441     - DeviceSpeed is not one of the supported values listed above.
442     - MaximumPacketLength is invalid. MaximumPacketLength must be 1023 or less for full-speed devices,
443       and 1024 or less for high-speed and super-speed devices.
444     - TransferResult is NULL.
445 
446   @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.
447   @param  DeviceAddress         Represents the address of the target device on the USB.
448   @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the
449                                 target USB device.
450   @param  DeviceSpeed           Indicates device speed. The supported values are EFI_USB_SPEED_FULL,
451                                 EFI_USB_SPEED_HIGH, or EFI_USB_SPEED_SUPER.
452   @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of
453                                 sending or receiving.
454   @param  DataBuffersNumber     Number of data buffers prepared for the transfer.
455   @param  Data                  Array of pointers to the buffers of data that will be transmitted to USB
456                                 device or received from USB device.
457   @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received from
458                                 the USB device.
459   @param  Translator            A pointer to the transaction translator data.
460   @param  TransferResult        A pointer to the detailed result information of the isochronous transfer.
461 
462   @retval EFI_SUCCESS           The isochronous transfer was completed successfully.
463   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
464   @retval EFI_OUT_OF_RESOURCES  The isochronous transfer could not be submitted due to a lack of resources.
465   @retval EFI_TIMEOUT           The isochronous transfer cannot be completed within the one USB frame time.
466   @retval EFI_DEVICE_ERROR      The isochronous transfer failed due to host controller or device error.
467                                 Caller should check TransferResult for detailed error information.
468 
469 **/
470 typedef
471 EFI_STATUS
472 (EFIAPI *EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER)(
473   IN     EFI_USB2_HC_PROTOCOL               *This,
474   IN     UINT8                              DeviceAddress,
475   IN     UINT8                              EndPointAddress,
476   IN     UINT8                              DeviceSpeed,
477   IN     UINTN                              MaximumPacketLength,
478   IN     UINT8                              DataBuffersNumber,
479   IN OUT VOID                               *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
480   IN     UINTN                              DataLength,
481   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
482   OUT    UINT32                             *TransferResult
483   );
484 
485 /**
486   Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.
487 
488   This is an asynchronous type of USB isochronous transfer. If the caller submits a USB
489   isochronous transfer request through this function, this function will return immediately.
490 
491   When the isochronous transfer completes, the IsochronousCallbackfunction will be triggered,
492   the caller can know the transfer results. If the transfer is successful, the caller can get
493   the data received or sent in this callback function.
494 
495   The target endpoint is specified by DeviceAddressand EndpointAddress. Isochronous transfers
496   are used when working with isochronous date. It provides periodic, continuous communication
497   between the host and a device. Isochronous transfers can be used only by full-speed, high-speed,
498   and super-speed devices.
499 
500   High-speed isochronous transfers can be performed using multiple data buffers. The number of
501   buffers that are actually prepared for the transfer is specified by DataBuffersNumber. For
502   full-speed isochronous transfers this value is ignored.
503 
504   Data represents a list of pointers to the data buffers. For full-speed isochronous transfers
505   only the data pointed by Data[0] shall be used. For high-speed isochronous transfers and for
506   the split transactions depending on DataLength there several data buffers can be used. For
507   the high-speed isochronous transfers the total number of buffers must not exceed EFI_USB_MAX_ISO_BUFFER_NUM.
508 
509   For split transactions performed on full-speed device by high-speed host controller the total
510   number of buffers is limited to EFI_USB_MAX_ISO_BUFFER_NUM1.
511 
512   EFI_INVALID_PARAMETER is returned if one of the following conditionsis satisfied:
513     - Data is NULL.
514     - DataLength is 0.
515     - DeviceSpeed is not one of the supported values listed above.
516     - MaximumPacketLength is invalid. MaximumPacketLength must be 1023 or less for full-speed
517       devices and 1024 or less for high-speed and super-speed devices.
518 
519   @param  This                  A pointer to the EFI_USB2_HC_PROTOCOL instance.
520   @param  DeviceAddress         Represents the address of the target device on the USB.
521   @param  EndPointAddress       The combination of an endpoint number and an endpoint direction of the
522                                 target USB device.
523   @param  DeviceSpeed           Indicates device speed. The supported values are EFI_USB_SPEED_FULL,
524                                 EFI_USB_SPEED_HIGH, or EFI_USB_SPEED_SUPER.
525   @param  MaximumPacketLength   Indicates the maximum packet size the target endpoint is capable of
526                                 sending or receiving.
527   @param  DataBuffersNumber     Number of data buffers prepared for the transfer.
528   @param  Data                  Array of pointers to the buffers of data that will be transmitted to USB
529                                 device or received from USB device.
530   @param  DataLength            Specifies the length, in bytes, of the data to be sent to or received from
531                                 the USB device.
532   @param  Translator            A pointer to the transaction translator data.
533   @param  IsochronousCallback   The Callback function. This function is called if the requested
534                                 isochronous transfer is completed.
535   @param  Context               Data passed to the IsochronousCallback function. This is an
536                                 optional parameter and may be NULL.
537 
538   @retval EFI_SUCCESS           The asynchronous isochronous transfer request has been successfully
539                                 submitted or canceled.
540   @retval EFI_INVALID_PARAMETER Some parameters are invalid.
541   @retval EFI_OUT_OF_RESOURCES  The asynchronous isochronous transfer could not be submitted due to
542                                 a lack of resources.
543 
544 **/
545 typedef
546 EFI_STATUS
547 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER)(
548   IN     EFI_USB2_HC_PROTOCOL               *This,
549   IN     UINT8                              DeviceAddress,
550   IN     UINT8                              EndPointAddress,
551   IN     UINT8                              DeviceSpeed,
552   IN     UINTN                              MaximumPacketLength,
553   IN     UINT8                              DataBuffersNumber,
554   IN OUT VOID                               *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
555   IN     UINTN                              DataLength,
556   IN     EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
557   IN     EFI_ASYNC_USB_TRANSFER_CALLBACK    IsochronousCallBack,
558   IN     VOID                               *Context OPTIONAL
559   );
560 
561 /**
562   Retrieves the current status of a USB root hub port.
563 
564   @param  This       A pointer to the EFI_USB2_HC_PROTOCOL instance.
565   @param  PortNumber Specifies the root hub port from which the status is to be retrieved.
566                      This value is zero based.
567   @param  PortStatus A pointer to the current port status bits and port status change bits.
568 
569   @retval EFI_SUCCESS           The status of the USB root hub port specified by PortNumber
570                                 was returned in PortStatus.
571   @retval EFI_INVALID_PARAMETER PortNumber is invalid.
572 
573 **/
574 typedef
575 EFI_STATUS
576 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS)(
577   IN        EFI_USB2_HC_PROTOCOL    *This,
578   IN        UINT8                   PortNumber,
579   OUT       EFI_USB_PORT_STATUS     *PortStatus
580   );
581 
582 /**
583   Sets a feature for the specified root hub port.
584 
585   @param  This        A pointer to the EFI_USB2_HC_PROTOCOL instance.
586   @param  PortNumber  Specifies the root hub port whose feature is requested to be set. This
587                       value is zero based.
588   @param  PortFeature Indicates the feature selector associated with the feature set request.
589 
590   @retval EFI_SUCCESS           The feature specified by PortFeature was set for the USB
591                                 root hub port specified by PortNumber.
592   @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
593 
594 **/
595 typedef
596 EFI_STATUS
597 (EFIAPI *EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE)(
598   IN EFI_USB2_HC_PROTOCOL    *This,
599   IN UINT8                   PortNumber,
600   IN EFI_USB_PORT_FEATURE    PortFeature
601   );
602 
603 /**
604   Clears a feature for the specified root hub port.
605 
606   @param  This        A pointer to the EFI_USB2_HC_PROTOCOL instance.
607   @param  PortNumber  Specifies the root hub port whose feature is requested to be cleared. This
608                       value is zero based.
609   @param  PortFeature Indicates the feature selector associated with the feature clear request.
610 
611   @retval EFI_SUCCESS           The feature specified by PortFeature was cleared for the USB
612                                 root hub port specified by PortNumber.
613   @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
614 
615 **/
616 typedef
617 EFI_STATUS
618 (EFIAPI *EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE)(
619   IN EFI_USB2_HC_PROTOCOL    *This,
620   IN UINT8                   PortNumber,
621   IN EFI_USB_PORT_FEATURE    PortFeature
622   );
623 
624 ///
625 /// The EFI_USB2_HC_PROTOCOL provides USB host controller management, basic
626 /// data transactions over a USB bus, and USB root hub access. A device driver
627 /// that wishes to manage a USB bus in a system retrieves the EFI_USB2_HC_PROTOCOL
628 /// instance that is associated with the USB bus to be managed. A device handle
629 /// for a USB host controller will minimally contain an EFI_DEVICE_PATH_PROTOCOL
630 /// instance, and an EFI_USB2_HC_PROTOCOL instance.
631 ///
632 struct _EFI_USB2_HC_PROTOCOL {
633   EFI_USB2_HC_PROTOCOL_GET_CAPABILITY              GetCapability;
634   EFI_USB2_HC_PROTOCOL_RESET                       Reset;
635   EFI_USB2_HC_PROTOCOL_GET_STATE                   GetState;
636   EFI_USB2_HC_PROTOCOL_SET_STATE                   SetState;
637   EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER            ControlTransfer;
638   EFI_USB2_HC_PROTOCOL_BULK_TRANSFER               BulkTransfer;
639   EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER    AsyncInterruptTransfer;
640   EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER     SyncInterruptTransfer;
641   EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER        IsochronousTransfer;
642   EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER  AsyncIsochronousTransfer;
643   EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS     GetRootHubPortStatus;
644   EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE    SetRootHubPortFeature;
645   EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE  ClearRootHubPortFeature;
646 
647   ///
648   /// The major revision number of the USB host controller. The revision information
649   /// indicates the release of the Universal Serial Bus Specification with which the
650   /// host controller is compliant.
651   ///
652   UINT16                                           MajorRevision;
653 
654   ///
655   /// The minor revision number of the USB host controller. The revision information
656   /// indicates the release of the Universal Serial Bus Specification with which the
657   /// host controller is compliant.
658   ///
659   UINT16                                           MinorRevision;
660 };
661 
662 extern EFI_GUID gEfiUsb2HcProtocolGuid;
663 
664 #endif
665