2 EFI_USB2_HC_PROTOCOL as defined in UEFI 2.0.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef _USB2_HOSTCONTROLLER_H_
16 #define _USB2_HOSTCONTROLLER_H_
18 #include <IndustryStandard/Usb.h>
19 #include <Protocol/UsbIo.h>
21 #define EFI_USB2_HC_PROTOCOL_GUID \
23 0x3e745226, 0x9818, 0x45b6, {0xa2, 0xac, 0xd7, 0xcd, 0xe, 0x8b, 0xa2, 0xbc } \
27 // Forward reference for pure ANSI compatability
29 typedef struct _EFI_USB2_HC_PROTOCOL EFI_USB2_HC_PROTOCOL
;
31 #define EFI_USB_SPEED_FULL 0x0000 // 12 Mb/s, USB 1.1 OHCI and UHCI HC.
32 #define EFI_USB_SPEED_LOW 0x0001 // 1 Mb/s, USB 1.1 OHCI and UHCI HC.
33 #define EFI_USB_SPEED_HIGH 0x0002 // 480 Mb/s, USB 2.0 EHCI HC.
36 UINT8 TranslatorHubAddress
;
37 UINT8 TranslatorPortNumber
;
38 } EFI_USB2_HC_TRANSACTION_TRANSLATOR
;
41 // Protocol definitions
45 Retrieves the Host Controller capabilities.
47 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
48 @param MaxSpeed Host controller data transfer speed.
49 @param PortNumber Number of the root hub ports.
50 @param Is64BitCapable TRUE if controller supports 64-bit memory addressing,
53 @retval EFI_SUCCESS The host controller capabilities were retrieved successfully.
54 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
55 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
56 retrieve the capabilities.
61 (EFIAPI
*EFI_USB2_HC_PROTOCOL_GET_CAPABILITY
) (
62 IN EFI_USB2_HC_PROTOCOL
*This
,
64 OUT UINT8
*PortNumber
,
65 OUT UINT8
*Is64BitCapable
70 Provides software reset for the USB host controller.
72 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
73 @param Attributes A bit mask of the reset operation to perform.
75 @retval EFI_SUCCESS The reset operation succeeded.
76 @retval EFI_INVALID_PARAMETER Attributes is not valid.
77 @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently
78 supported by the host controller hardware.
79 @retval EFI_ACCESS_DENIED Reset operation is rejected due to the debug port being configured
80 and active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
81 EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Attributes can be used to
82 perform reset operation for this host controller.
83 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
84 retrieve the capabilities.
89 (EFIAPI
*EFI_USB2_HC_PROTOCOL_RESET
) (
90 IN EFI_USB2_HC_PROTOCOL
*This
,
97 @param EfiUsbHcStateHalt The host controller is in halt
98 state. No USB transactions can occur
99 while in this state. The host
100 controller can enter this state for
101 three reasons: 1) After host
102 controller hardware reset. 2)
103 Explicitly set by software. 3)
104 Triggered by a fatal error such as
105 consistency check failure.
108 @param EfiUsbHcStateOperational The host controller is in an
109 operational state. When in
111 controller can execute bus
112 traffic. This state must be
113 explicitly set to enable the
117 @param EfiUsbHcStateSuspend The host controller is in the
118 suspend state. No USB
119 transactions can occur while in
120 this state. The host controller
121 enters this state for the
122 following reasons: 1) Explicitly
123 set by software. 2) Triggered
124 when there is no bus traffic for
130 EfiUsbHcStateOperational
,
131 EfiUsbHcStateSuspend
,
136 Retrieves current state of the USB host controller.
138 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
139 @param State A pointer to the EFI_USB_HC_STATE data structure that
140 indicates current state of the USB host controller.
142 @retval EFI_SUCCESS The state information of the host controller was returned in State.
143 @retval EFI_INVALID_PARAMETER State is NULL.
144 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the
145 host controller's current state.
150 (EFIAPI
*EFI_USB2_HC_PROTOCOL_GET_STATE
) (
151 IN CONST EFI_USB2_HC_PROTOCOL
*This
,
152 OUT EFI_USB_HC_STATE
*State
157 Sets the USB host controller to a specific state.
159 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
160 @param State Indicates the state of the host controller that will be set.
162 @retval EFI_SUCCESS The USB host controller was successfully placed in the state
164 @retval EFI_INVALID_PARAMETER State is not valid.
165 @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error.
170 (EFIAPI
*EFI_USB2_HC_PROTOCOL_SET_STATE
) (
171 IN EFI_USB2_HC_PROTOCOL
*This
,
172 IN EFI_USB_HC_STATE State
177 Submits control transfer to a target USB device.
179 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
180 @param DeviceAddress Represents the address of the target device on the USB.
181 @param DeviceSpeed Indicates device speed.
182 @param MaximumPacketLength Indicates the maximum packet size that the default control transfer
183 endpoint is capable of sending or receiving.
184 @param Request A pointer to the USB device request that will be sent to the USB device.
185 @param TransferDirection Specifies the data direction for the transfer. There are three values
186 available, EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
187 @param Data A pointer to the buffer of data that will be transmitted to USB device or
188 received from USB device.
189 @param DataLength On input, indicates the size, in bytes, of the data buffer specified by Data.
190 On output, indicates the amount of data actually transferred.
191 @param Translator A pointer to the transaction translator data.
192 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
194 @param TransferResult A pointer to the detailed result information generated by this control
197 @retval EFI_SUCCESS The control transfer was completed successfully.
198 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
199 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.
200 @retval EFI_TIMEOUT The control transfer failed due to timeout.
201 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error.
202 Caller should check TransferResult for detailed error information.
207 (EFIAPI
*EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER
) (
208 IN EFI_USB2_HC_PROTOCOL
*This
,
209 IN UINT8 DeviceAddress
,
210 IN UINT8 DeviceSpeed
,
211 IN UINTN MaximumPacketLength
,
212 IN EFI_USB_DEVICE_REQUEST
*Request
,
213 IN EFI_USB_DATA_DIRECTION TransferDirection
,
214 IN OUT VOID
*Data OPTIONAL
,
215 IN OUT UINTN
*DataLength OPTIONAL
,
217 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
218 OUT UINT32
*TransferResult
222 #define EFI_USB_MAX_BULK_BUFFER_NUM 10
225 Submits bulk transfer to a bulk endpoint of a USB device.
227 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
228 @param DeviceAddress Represents the address of the target device on the USB.
229 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
231 @param DeviceSpeed Indicates device speed.
232 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
233 sending or receiving.
234 @param DataBuffersNumber Number of data buffers prepared for the transfer.
235 @param Data Array of pointers to the buffers of data that will be transmitted to USB
236 device or received from USB device.
237 @param DataLength When input, indicates the size, in bytes, of the data buffers specified by
238 Data. When output, indicates the actually transferred data size.
239 @param DataToggle A pointer to the data toggle value.
240 @param Translator A pointer to the transaction translator data.
241 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
243 @param TransferResult A pointer to the detailed result information of the bulk transfer.
245 @retval EFI_SUCCESS The bulk transfer was completed successfully.
246 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
247 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources.
248 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
249 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
250 Caller should check TransferResult for detailed error information.
255 (EFIAPI
*EFI_USB2_HC_PROTOCOL_BULK_TRANSFER
) (
256 IN EFI_USB2_HC_PROTOCOL
*This
,
257 IN UINT8 DeviceAddress
,
258 IN UINT8 EndPointAddress
,
259 IN UINT8 DeviceSpeed
,
260 IN UINTN MaximumPacketLength
,
261 IN UINT8 DataBuffersNumber
,
262 IN OUT VOID
*Data
[EFI_USB_MAX_BULK_BUFFER_NUM
],
263 IN OUT UINTN
*DataLength
,
264 IN OUT UINT8
*DataToggle
,
266 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
267 OUT UINT32
*TransferResult
272 Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
273 Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
275 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
276 @param DeviceAddress Represents the address of the target device on the USB.
277 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
279 @param DeviceSpeed Indicates device speed.
280 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
281 sending or receiving.
282 @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host and the
283 target interrupt endpoint. If FALSE, the specified asynchronous interrupt
284 pipe is canceled. If TRUE, and an interrupt transfer exists for the target
285 end point, then EFI_INVALID_PARAMETER is returned.
286 @param DataToggle A pointer to the data toggle value.
287 @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous interrupt
289 @param DataLength Indicates the length of data to be received at the rate specified by
290 PollingInterval from the target asynchronous interrupt endpoint.
291 @param Translator A pointr to the transaction translator data.
292 @param CallBackFunction The Callback function. This function is called at the rate specified by
294 @param Context The context that is passed to the CallBackFunction. This is an
295 optional parameter and may be NULL.
297 @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully
298 submitted or canceled.
299 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
300 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
305 (EFIAPI
*EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER
) (
306 IN EFI_USB2_HC_PROTOCOL
*This
,
307 IN UINT8 DeviceAddress
,
308 IN UINT8 EndPointAddress
,
309 IN UINT8 DeviceSpeed
,
310 IN UINTN MaxiumPacketLength
,
311 IN BOOLEAN IsNewTransfer
,
312 IN OUT UINT8
*DataToggle
,
313 IN UINTN PollingInterval OPTIONAL
,
314 IN UINTN DataLength OPTIONAL
,
315 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator OPTIONAL
,
316 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL
,
317 IN VOID
*Context OPTIONAL
322 Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
323 Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
325 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
326 @param DeviceAddress Represents the address of the target device on the USB.
327 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
329 @param DeviceSpeed Indicates device speed.
330 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
331 sending or receiving.
332 @param Data A pointer to the buffer of data that will be transmitted to USB device or
333 received from USB device.
334 @param DataLength On input, the size, in bytes, of the data buffer specified by Data. On
335 output, the number of bytes transferred.
336 @param DataToggle A pointer to the data toggle value.
337 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
339 @param Translator A pointr to the transaction translator data.
340 @param TransferResult A pointer to the detailed result information from the synchronous
343 @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully.
344 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
345 @retval EFI_OUT_OF_RESOURCES The synchronous interrupt transfer could not be submitted due to a lack of resources.
346 @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout.
347 @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error.
348 Caller should check TransferResult for detailed error information.
353 (EFIAPI
*EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER
) (
354 IN EFI_USB2_HC_PROTOCOL
*This
,
355 IN UINT8 DeviceAddress
,
356 IN UINT8 EndPointAddress
,
357 IN UINT8 DeviceSpeed
,
358 IN UINTN MaximumPacketLength
,
360 IN OUT UINTN
*DataLength
,
361 IN OUT UINT8
*DataToggle
,
363 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
364 OUT UINT32
*TransferResult
368 #define EFI_USB_MAX_ISO_BUFFER_NUM 7
369 #define EFI_USB_MAX_ISO_BUFFER_NUM1 2
372 Submits isochronous transfer to an isochronous endpoint of a USB device.
374 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
375 @param DeviceAddress Represents the address of the target device on the USB.
376 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
378 @param DeviceSpeed Indicates device speed.
379 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
380 sending or receiving.
381 @param DataBuffersNumber Number of data buffers prepared for the transfer.
382 @param Data Array of pointers to the buffers of data that will be transmitted to USB
383 device or received from USB device.
384 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
386 @param Translator A pointer to the transaction translator data.
387 @param TransferResult A pointer to the detailed result information of the isochronous transfer.
389 @retval EFI_SUCCESS The isochronous transfer was completed successfully.
390 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
391 @retval EFI_OUT_OF_RESOURCES The isochronous transfer could not be submitted due to a lack of resources.
392 @retval EFI_TIMEOUT The isochronous transfer cannot be completed within the one USB frame time.
393 @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error.
394 Caller should check TransferResult for detailed error information.
399 (EFIAPI
*EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER
) (
400 IN EFI_USB2_HC_PROTOCOL
*This
,
401 IN UINT8 DeviceAddress
,
402 IN UINT8 EndPointAddress
,
403 IN UINT8 DeviceSpeed
,
404 IN UINTN MaximumPacketLength
,
405 IN UINT8 DataBuffersNumber
,
406 IN OUT VOID
*Data
[EFI_USB_MAX_ISO_BUFFER_NUM
],
408 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
409 OUT UINT32
*TransferResult
414 Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.
416 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
417 @param DeviceAddress Represents the address of the target device on the USB.
418 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
420 @param DeviceSpeed Indicates device speed.
421 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
422 sending or receiving.
423 @param DataBuffersNumber Number of data buffers prepared for the transfer.
424 @param Data Array of pointers to the buffers of data that will be transmitted to USB
425 device or received from USB device.
426 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
428 @param Translator A pointer to the transaction translator data.
429 @param IsochronousCallback The Callback function. This function is called if the requested
430 isochronous transfer is completed.
431 @param Context Data passed to the IsochronousCallback function. This is an
432 optional parameter and may be NULL.
434 @retval EFI_SUCCESS The asynchronous isochronous transfer request has been successfully
435 submitted or canceled.
436 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
437 @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous transfer could not be submitted due to
443 (EFIAPI
*EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER
) (
444 IN EFI_USB2_HC_PROTOCOL
*This
,
445 IN UINT8 DeviceAddress
,
446 IN UINT8 EndPointAddress
,
447 IN UINT8 DeviceSpeed
,
448 IN UINTN MaximumPacketLength
,
449 IN UINT8 DataBuffersNumber
,
450 IN OUT VOID
*Data
[EFI_USB_MAX_ISO_BUFFER_NUM
],
452 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR
*Translator
,
453 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack
,
454 IN VOID
*Context OPTIONAL
459 Retrieves the current status of a USB root hub port.
461 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
462 @param PortNumber Specifies the root hub port from which the status is to be retrieved.
463 This value is zero based.
464 @param PortStatus A pointer to the current port status bits and port status change bits.
466 @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber
467 was returned in PortStatus.
468 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
473 (EFIAPI
*EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS
) (
474 IN CONST EFI_USB2_HC_PROTOCOL
*This
,
475 IN CONST UINT8 PortNumber
,
476 OUT EFI_USB_PORT_STATUS
*PortStatus
481 Sets a feature for the specified root hub port.
483 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
484 @param PortNumber Specifies the root hub port whose feature is requested to be set. This
486 @param PortFeature Indicates the feature selector associated with the feature set request.
488 @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB
489 root hub port specified by PortNumber.
490 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
495 (EFIAPI
*EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE
) (
496 IN EFI_USB2_HC_PROTOCOL
*This
,
498 IN EFI_USB_PORT_FEATURE PortFeature
503 Clears a feature for the specified root hub port.
505 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
506 @param PortNumber Specifies the root hub port whose feature is requested to be cleared. This
508 @param PortFeature Indicates the feature selector associated with the feature clear request.
510 @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB
511 root hub port specified by PortNumber.
512 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
517 (EFIAPI
*EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE
) (
518 IN EFI_USB2_HC_PROTOCOL
*This
,
520 IN EFI_USB_PORT_FEATURE PortFeature
524 struct _EFI_USB2_HC_PROTOCOL
{
525 EFI_USB2_HC_PROTOCOL_GET_CAPABILITY GetCapability
;
526 EFI_USB2_HC_PROTOCOL_RESET Reset
;
527 EFI_USB2_HC_PROTOCOL_GET_STATE GetState
;
528 EFI_USB2_HC_PROTOCOL_SET_STATE SetState
;
529 EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer
;
530 EFI_USB2_HC_PROTOCOL_BULK_TRANSFER BulkTransfer
;
531 EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer
;
532 EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer
;
533 EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer
;
534 EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer
;
535 EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus
;
536 EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature
;
537 EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature
;
538 UINT16 MajorRevision
;
539 UINT16 MinorRevision
;
542 extern EFI_GUID gEfiUsb2HcProtocolGuid
;