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