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