]> git.proxmox.com Git - mirror_edk2.git/blob - OldMdePkg/Include/Protocol/Usb2HostController.h
Adding top-level Conf directory for next generation of EDK II build infrastructure...
[mirror_edk2.git] / OldMdePkg / Include / Protocol / Usb2HostController.h
1 /** @file
2 EFI_USB2_HC_PROTOCOL as defined in UEFI 2.0.
3
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: Usb2HostController.h
14
15 **/
16
17 #ifndef _USB2_HOSTCONTROLLER_H_
18 #define _USB2_HOSTCONTROLLER_H_
19
20 #define EFI_USB2_HC_PROTOCOL_GUID \
21 { \
22 0x3e745226, 0x9818, 0x45b6, {0xa2, 0xac, 0xd7, 0xcd, 0xe, 0x8b, 0xa2, 0xbc } \
23 }
24
25 //
26 // Forward reference for pure ANSI compatability
27 //
28 typedef struct _EFI_USB2_HC_PROTOCOL EFI_USB2_HC_PROTOCOL;
29
30 #define EFI_USB_SPEED_FULL 0x0000 // 12 Mb/s, USB 1.1 OHCI and UHCI HC.
31 #define EFI_USB_SPEED_LOW 0x0001 // 1 Mb/s, USB 1.1 OHCI and UHCI HC.
32 #define EFI_USB_SPEED_HIGH 0x0002 // 480 Mb/s, USB 2.0 EHCI HC.
33
34 typedef struct {
35 UINT8 TranslatorHubAddress;
36 UINT8 TranslatorPortNumber;
37 } EFI_USB2_HC_TRANSACTION_TRANSLATOR;
38
39 //
40 // Protocol definitions
41 //
42
43 /**
44 Retrieves the Host Controller capabilities.
45
46 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
47 @param MaxSpeed Host controller data transfer speed.
48 @param PortNumber Number of the root hub ports.
49 @param Is64BitCapable TRUE if controller supports 64-bit memory addressing,
50 FALSE otherwise.
51
52 @retval EFI_SUCCESS The host controller capabilities were retrieved successfully.
53 @retval EFI_INVALID_PARAMETER One of the input args was NULL.
54 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
55 retrieve the capabilities.
56
57 **/
58 typedef
59 EFI_STATUS
60 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_CAPABILITY) (
61 IN EFI_USB2_HC_PROTOCOL *This,
62 OUT UINT8 *MaxSpeed,
63 OUT UINT8 *PortNumber,
64 OUT UINT8 *Is64BitCapable
65 )
66 ;
67
68 /**
69 Provides software reset for the USB host controller.
70
71 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
72 @param Attributes A bit mask of the reset operation to perform.
73
74 @retval EFI_SUCCESS The reset operation succeeded.
75 @retval EFI_INVALID_PARAMETER Attributes is not valid.
76 @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently
77 supported by the host controller hardware.
78 @retval EFI_ACCESS_DENIED Reset operation is rejected due to the debug port being configured
79 and active; only EFI_USB_HC_RESET_GLOBAL_WITH_DEBUG or
80 EFI_USB_HC_RESET_HOST_WITH_DEBUG reset Attributes can be used to
81 perform reset operation for this host controller.
82 @retval EFI_DEVICE_ERROR An error was encountered while attempting to
83 retrieve the capabilities.
84
85 **/
86 typedef
87 EFI_STATUS
88 (EFIAPI *EFI_USB2_HC_PROTOCOL_RESET) (
89 IN EFI_USB2_HC_PROTOCOL *This,
90 IN UINT16 Attributes
91 )
92 ;
93
94 /**
95 Retrieves current state of the USB host controller.
96
97 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
98 @param State A pointer to the EFI_USB_HC_STATE data structure that
99 indicates current state of the USB host controller.
100
101 @retval EFI_SUCCESS The state information of the host controller was returned in State.
102 @retval EFI_INVALID_PARAMETER State is NULL.
103 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the
104 host controller's current state.
105
106 **/
107 typedef
108 EFI_STATUS
109 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_STATE) (
110 IN EFI_USB2_HC_PROTOCOL *This,
111 OUT EFI_USB_HC_STATE *State
112 )
113 ;
114
115 /**
116 Sets the USB host controller to a specific state.
117
118 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
119 @param State Indicates the state of the host controller that will be set.
120
121 @retval EFI_SUCCESS The USB host controller was successfully placed in the state
122 specified by State.
123 @retval EFI_INVALID_PARAMETER State is not valid.
124 @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error.
125
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_USB2_HC_PROTOCOL_SET_STATE) (
130 IN EFI_USB2_HC_PROTOCOL *This,
131 IN EFI_USB_HC_STATE State
132 )
133 ;
134
135 /**
136 Submits control transfer to a target USB device.
137
138 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
139 @param DeviceAddress Represents the address of the target device on the USB.
140 @param DeviceSpeed Indicates device speed.
141 @param MaximumPacketLength Indicates the maximum packet size that the default control transfer
142 endpoint is capable of sending or receiving.
143 @param Request A pointer to the USB device request that will be sent to the USB device.
144 @param TransferDirection Specifies the data direction for the transfer. There are three values
145 available, EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
146 @param Data A pointer to the buffer of data that will be transmitted to USB device or
147 received from USB device.
148 @param DataLength On input, indicates the size, in bytes, of the data buffer specified by Data.
149 On output, indicates the amount of data actually transferred.
150 @param Translator A pointer to the transaction translator data.
151 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
152 allowed to complete.
153 @param TransferResult A pointer to the detailed result information generated by this control
154 transfer.
155
156 @retval EFI_SUCCESS The control transfer was completed successfully.
157 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
158 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.
159 @retval EFI_TIMEOUT The control transfer failed due to timeout.
160 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error.
161 Caller should check TransferResult for detailed error information.
162
163 **/
164 typedef
165 EFI_STATUS
166 (EFIAPI *EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER) (
167 IN EFI_USB2_HC_PROTOCOL *This,
168 IN UINT8 DeviceAddress,
169 IN UINT8 DeviceSpeed,
170 IN UINTN MaximumPacketLength,
171 IN EFI_USB_DEVICE_REQUEST *Request,
172 IN EFI_USB_DATA_DIRECTION TransferDirection,
173 IN OUT VOID *Data OPTIONAL,
174 IN OUT UINTN *DataLength OPTIONAL,
175 IN UINTN TimeOut,
176 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
177 OUT UINT32 *TransferResult
178 )
179 ;
180
181 #define EFI_USB_MAX_BULK_BUFFER_NUM 10
182
183 /**
184 Submits bulk transfer to a bulk endpoint of a USB device.
185
186 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
187 @param DeviceAddress Represents the address of the target device on the USB.
188 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
189 target USB device.
190 @param DeviceSpeed Indicates device speed.
191 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
192 sending or receiving.
193 @param DataBuffersNumber Number of data buffers prepared for the transfer.
194 @param Data Array of pointers to the buffers of data that will be transmitted to USB
195 device or received from USB device.
196 @param DataLength When input, indicates the size, in bytes, of the data buffers specified by
197 Data. When output, indicates the actually transferred data size.
198 @param DataToggle A pointer to the data toggle value.
199 @param Translator A pointer to the transaction translator data.
200 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
201 allowed to complete.
202 @param TransferResult A pointer to the detailed result information of the bulk transfer.
203
204 @retval EFI_SUCCESS The bulk transfer was completed successfully.
205 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
206 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources.
207 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
208 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
209 Caller should check TransferResult for detailed error information.
210
211 **/
212 typedef
213 EFI_STATUS
214 (EFIAPI *EFI_USB2_HC_PROTOCOL_BULK_TRANSFER) (
215 IN EFI_USB2_HC_PROTOCOL *This,
216 IN UINT8 DeviceAddress,
217 IN UINT8 EndPointAddress,
218 IN UINT8 DeviceSpeed,
219 IN UINTN MaximumPacketLength,
220 IN UINT8 DataBuffersNumber,
221 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],
222 IN OUT UINTN *DataLength,
223 IN OUT UINT8 *DataToggle,
224 IN UINTN TimeOut,
225 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
226 OUT UINT32 *TransferResult
227 )
228 ;
229
230 /**
231 Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
232 Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
233
234 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
235 @param DeviceAddress Represents the address of the target device on the USB.
236 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
237 target USB device.
238 @param DeviceSpeed Indicates device speed.
239 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
240 sending or receiving.
241 @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host and the
242 target interrupt endpoint. If FALSE, the specified asynchronous interrupt
243 pipe is canceled. If TRUE, and an interrupt transfer exists for the target
244 end point, then EFI_INVALID_PARAMETER is returned.
245 @param DataToggle A pointer to the data toggle value.
246 @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous interrupt
247 transfer is polled.
248 @param DataLength Indicates the length of data to be received at the rate specified by
249 PollingInterval from the target asynchronous interrupt endpoint.
250 @param Translator A pointr to the transaction translator data.
251 @param CallBackFunction The Callback function. This function is called at the rate specified by
252 PollingInterval.
253 @param Context The context that is passed to the CallBackFunction. This is an
254 optional parameter and may be NULL.
255
256 @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully
257 submitted or canceled.
258 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
259 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
260
261 **/
262 typedef
263 EFI_STATUS
264 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) (
265 IN EFI_USB2_HC_PROTOCOL *This,
266 IN UINT8 DeviceAddress,
267 IN UINT8 EndPointAddress,
268 IN UINT8 DeviceSpeed,
269 IN UINTN MaxiumPacketLength,
270 IN BOOLEAN IsNewTransfer,
271 IN OUT UINT8 *DataToggle,
272 IN UINTN PollingInterval OPTIONAL,
273 IN UINTN DataLength OPTIONAL,
274 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator OPTIONAL,
275 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL,
276 IN VOID *Context OPTIONAL
277 )
278 ;
279
280 /**
281 Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
282 Translator parameter doesn't exist in UEFI2.0 spec, but it will be updated in the following specification version.
283
284 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
285 @param DeviceAddress Represents the address of the target device on the USB.
286 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
287 target USB device.
288 @param DeviceSpeed Indicates device speed.
289 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
290 sending or receiving.
291 @param Data A pointer to the buffer of data that will be transmitted to USB device or
292 received from USB device.
293 @param DataLength On input, the size, in bytes, of the data buffer specified by Data. On
294 output, the number of bytes transferred.
295 @param DataToggle A pointer to the data toggle value.
296 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
297 allowed to complete.
298 @param Translator A pointr to the transaction translator data.
299 @param TransferResult A pointer to the detailed result information from the synchronous
300 interrupt transfer.
301
302 @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully.
303 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
304 @retval EFI_OUT_OF_RESOURCES The synchronous interrupt transfer could not be submitted due to a lack of resources.
305 @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout.
306 @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error.
307 Caller should check TransferResult for detailed error information.
308
309 **/
310 typedef
311 EFI_STATUS
312 (EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (
313 IN EFI_USB2_HC_PROTOCOL *This,
314 IN UINT8 DeviceAddress,
315 IN UINT8 EndPointAddress,
316 IN UINT8 DeviceSpeed,
317 IN UINTN MaximumPacketLength,
318 IN OUT VOID *Data,
319 IN OUT UINTN *DataLength,
320 IN OUT UINT8 *DataToggle,
321 IN UINTN TimeOut,
322 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
323 OUT UINT32 *TransferResult
324 )
325 ;
326
327 #define EFI_USB_MAX_ISO_BUFFER_NUM 7
328 #define EFI_USB_MAX_ISO_BUFFER_NUM1 2
329
330 /**
331 Submits isochronous transfer to an isochronous endpoint of a USB device.
332
333 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
334 @param DeviceAddress Represents the address of the target device on the USB.
335 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
336 target USB device.
337 @param DeviceSpeed Indicates device speed.
338 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
339 sending or receiving.
340 @param DataBuffersNumber Number of data buffers prepared for the transfer.
341 @param Data Array of pointers to the buffers of data that will be transmitted to USB
342 device or received from USB device.
343 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
344 the USB device.
345 @param Translator A pointer to the transaction translator data.
346 @param TransferResult A pointer to the detailed result information of the isochronous transfer.
347
348 @retval EFI_SUCCESS The isochronous transfer was completed successfully.
349 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
350 @retval EFI_OUT_OF_RESOURCES The isochronous transfer could not be submitted due to a lack of resources.
351 @retval EFI_TIMEOUT The isochronous transfer cannot be completed within the one USB frame time.
352 @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error.
353 Caller should check TransferResult for detailed error information.
354
355 **/
356 typedef
357 EFI_STATUS
358 (EFIAPI *EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) (
359 IN EFI_USB2_HC_PROTOCOL *This,
360 IN UINT8 DeviceAddress,
361 IN UINT8 EndPointAddress,
362 IN UINT8 DeviceSpeed,
363 IN UINTN MaximumPacketLength,
364 IN UINT8 DataBuffersNumber,
365 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
366 IN UINTN DataLength,
367 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
368 OUT UINT32 *TransferResult
369 )
370 ;
371
372 /**
373 Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.
374
375 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
376 @param DeviceAddress Represents the address of the target device on the USB.
377 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
378 target USB device.
379 @param DeviceSpeed Indicates device speed.
380 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
381 sending or receiving.
382 @param DataBuffersNumber Number of data buffers prepared for the transfer.
383 @param Data Array of pointers to the buffers of data that will be transmitted to USB
384 device or received from USB device.
385 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
386 the USB device.
387 @param Translator A pointer to the transaction translator data.
388 @param IsochronousCallback The Callback function. This function is called if the requested
389 isochronous transfer is completed.
390 @param Context Data passed to the IsochronousCallback function. This is an
391 optional parameter and may be NULL.
392
393 @retval EFI_SUCCESS The asynchronous isochronous transfer request has been successfully
394 submitted or canceled.
395 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
396 @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous transfer could not be submitted due to
397 a lack of resources.
398
399 **/
400 typedef
401 EFI_STATUS
402 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) (
403 IN EFI_USB2_HC_PROTOCOL *This,
404 IN UINT8 DeviceAddress,
405 IN UINT8 EndPointAddress,
406 IN UINT8 DeviceSpeed,
407 IN UINTN MaximumPacketLength,
408 IN UINT8 DataBuffersNumber,
409 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
410 IN UINTN DataLength,
411 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
412 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
413 IN VOID *Context OPTIONAL
414 )
415 ;
416
417 /**
418 Retrieves the current status of a USB root hub port.
419
420 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
421 @param PortNumber Specifies the root hub port from which the status is to be retrieved.
422 This value is zero based.
423 @param PortStatus A pointer to the current port status bits and port status change bits.
424
425 @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber
426 was returned in PortStatus.
427 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
428
429 **/
430 typedef
431 EFI_STATUS
432 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) (
433 IN EFI_USB2_HC_PROTOCOL *This,
434 IN UINT8 PortNumber,
435 OUT EFI_USB_PORT_STATUS *PortStatus
436 )
437 ;
438
439 /**
440 Sets a feature for the specified root hub port.
441
442 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
443 @param PortNumber Specifies the root hub port whose feature is requested to be set. This
444 value is zero based.
445 @param PortFeature Indicates the feature selector associated with the feature set request.
446
447 @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB
448 root hub port specified by PortNumber.
449 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
450
451 **/
452 typedef
453 EFI_STATUS
454 (EFIAPI *EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) (
455 IN EFI_USB2_HC_PROTOCOL *This,
456 IN UINT8 PortNumber,
457 IN EFI_USB_PORT_FEATURE PortFeature
458 )
459 ;
460
461 /**
462 Clears a feature for the specified root hub port.
463
464 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
465 @param PortNumber Specifies the root hub port whose feature is requested to be cleared. This
466 value is zero based.
467 @param PortFeature Indicates the feature selector associated with the feature clear request.
468
469 @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB
470 root hub port specified by PortNumber.
471 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
472
473 **/
474 typedef
475 EFI_STATUS
476 (EFIAPI *EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) (
477 IN EFI_USB2_HC_PROTOCOL *This,
478 IN UINT8 PortNumber,
479 IN EFI_USB_PORT_FEATURE PortFeature
480 )
481 ;
482
483 struct _EFI_USB2_HC_PROTOCOL {
484 EFI_USB2_HC_PROTOCOL_GET_CAPABILITY GetCapability;
485 EFI_USB2_HC_PROTOCOL_RESET Reset;
486 EFI_USB2_HC_PROTOCOL_GET_STATE GetState;
487 EFI_USB2_HC_PROTOCOL_SET_STATE SetState;
488 EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer;
489 EFI_USB2_HC_PROTOCOL_BULK_TRANSFER BulkTransfer;
490 EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer;
491 EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer;
492 EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer;
493 EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer;
494 EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
495 EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
496 EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
497 UINT16 MajorRevision;
498 UINT16 MinorRevision;
499 };
500
501 extern EFI_GUID gEfiUsb2HcProtocolGuid;
502
503 #endif