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