]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/Usb2HostController.h
Make variable names for protocol GUIDs consistent
[mirror_edk2.git] / MdePkg / 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
233 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
234 @param DeviceAddress Represents the address of the target device on the USB.
235 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
236 target USB device.
237 @param DeviceSpeed Indicates device speed.
238 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
239 sending or receiving.
240 @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host and the
241 target interrupt endpoint. If FALSE, the specified asynchronous interrupt
242 pipe is canceled. If TRUE, and an interrupt transfer exists for the target
243 end point, then EFI_INVALID_PARAMETER is returned.
244 @param DataToggle A pointer to the data toggle value.
245 @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous interrupt
246 transfer is polled.
247 @param DataLength Indicates the length of data to be received at the rate specified by
248 PollingInterval from the target asynchronous interrupt endpoint.
249 @param CallBackFunction The Callback function. This function is called at the rate specified by
250 PollingInterval.
251 @param Context The context that is passed to the CallBackFunction. This is an
252 optional parameter and may be NULL.
253
254 @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully
255 submitted or canceled.
256 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
257 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
258
259 **/
260 typedef
261 EFI_STATUS
262 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER) (
263 IN EFI_USB2_HC_PROTOCOL *This,
264 IN UINT8 DeviceAddress,
265 IN UINT8 EndPointAddress,
266 IN UINT8 DeviceSpeed,
267 IN UINTN MaxiumPacketLength,
268 IN BOOLEAN IsNewTransfer,
269 IN OUT UINT8 *DataToggle,
270 IN UINTN PollingInterval OPTIONAL,
271 IN UINTN DataLength OPTIONAL,
272 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL,
273 IN VOID *Context OPTIONAL
274 )
275 ;
276
277 /**
278 Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
279
280 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
281 @param DeviceAddress Represents the address of the target device on the USB.
282 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
283 target USB device.
284 @param DeviceSpeed Indicates device speed.
285 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
286 sending or receiving.
287 @param Data A pointer to the buffer of data that will be transmitted to USB device or
288 received from USB device.
289 @param DataLength On input, the size, in bytes, of the data buffer specified by Data. On
290 output, the number of bytes transferred.
291 @param DataToggle A pointer to the data toggle value.
292 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer is
293 allowed to complete.
294 @param TransferResult A pointer to the detailed result information from the synchronous
295 interrupt transfer.
296
297 @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully.
298 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
299 @retval EFI_OUT_OF_RESOURCES The synchronous interrupt transfer could not be submitted due to a lack of resources.
300 @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout.
301 @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error.
302 Caller should check TransferResult for detailed error information.
303
304 **/
305 typedef
306 EFI_STATUS
307 (EFIAPI *EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER) (
308 IN EFI_USB2_HC_PROTOCOL *This,
309 IN UINT8 DeviceAddress,
310 IN UINT8 EndPointAddress,
311 IN UINT8 DeviceSpeed,
312 IN UINTN MaximumPacketLength,
313 IN OUT VOID *Data,
314 IN OUT UINTN *DataLength,
315 IN OUT UINT8 *DataToggle,
316 IN UINTN TimeOut,
317 OUT UINT32 *TransferResult
318 )
319 ;
320
321 #define EFI_USB_MAX_ISO_BUFFER_NUM 7
322 #define EFI_USB_MAX_ISO_BUFFER_NUM1 2
323
324 /**
325 Submits isochronous transfer to an isochronous endpoint of a USB device.
326
327 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
328 @param DeviceAddress Represents the address of the target device on the USB.
329 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
330 target USB device.
331 @param DeviceSpeed Indicates device speed.
332 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
333 sending or receiving.
334 @param DataBuffersNumber Number of data buffers prepared for the transfer.
335 @param Data Array of pointers to the buffers of data that will be transmitted to USB
336 device or received from USB device.
337 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
338 the USB device.
339 @param Translator A pointer to the transaction translator data.
340 @param TransferResult A pointer to the detailed result information of the isochronous transfer.
341
342 @retval EFI_SUCCESS The isochronous transfer was completed successfully.
343 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
344 @retval EFI_OUT_OF_RESOURCES The isochronous transfer could not be submitted due to a lack of resources.
345 @retval EFI_TIMEOUT The isochronous transfer cannot be completed within the one USB frame time.
346 @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error.
347 Caller should check TransferResult for detailed error information.
348
349 **/
350 typedef
351 EFI_STATUS
352 (EFIAPI *EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER) (
353 IN EFI_USB2_HC_PROTOCOL *This,
354 IN UINT8 DeviceAddress,
355 IN UINT8 EndPointAddress,
356 IN UINT8 DeviceSpeed,
357 IN UINTN MaximumPacketLength,
358 IN UINT8 DataBuffersNumber,
359 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
360 IN UINTN DataLength,
361 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
362 OUT UINT32 *TransferResult
363 )
364 ;
365
366 /**
367 Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.
368
369 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
370 @param DeviceAddress Represents the address of the target device on the USB.
371 @param EndPointAddress The combination of an endpoint number and an endpoint direction of the
372 target USB device.
373 @param DeviceSpeed Indicates device speed.
374 @param MaximumPacketLength Indicates the maximum packet size the target endpoint is capable of
375 sending or receiving.
376 @param DataBuffersNumber Number of data buffers prepared for the transfer.
377 @param Data Array of pointers to the buffers of data that will be transmitted to USB
378 device or received from USB device.
379 @param DataLength Specifies the length, in bytes, of the data to be sent to or received from
380 the USB device.
381 @param Translator A pointer to the transaction translator data.
382 @param IsochronousCallback The Callback function. This function is called if the requested
383 isochronous transfer is completed.
384 @param Context Data passed to the IsochronousCallback function. This is an
385 optional parameter and may be NULL.
386
387 @retval EFI_SUCCESS The asynchronous isochronous transfer request has been successfully
388 submitted or canceled.
389 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
390 @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous transfer could not be submitted due to
391 a lack of resources.
392
393 **/
394 typedef
395 EFI_STATUS
396 (EFIAPI *EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER) (
397 IN EFI_USB2_HC_PROTOCOL *This,
398 IN UINT8 DeviceAddress,
399 IN UINT8 EndPointAddress,
400 IN UINT8 DeviceSpeed,
401 IN UINTN MaximumPacketLength,
402 IN UINT8 DataBuffersNumber,
403 IN OUT VOID *Data[EFI_USB_MAX_ISO_BUFFER_NUM],
404 IN UINTN DataLength,
405 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,
406 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
407 IN VOID *Context OPTIONAL
408 )
409 ;
410
411 /**
412 Retrieves the current status of a USB root hub port.
413
414 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
415 @param PortNumber Specifies the root hub port from which the status is to be retrieved.
416 This value is zero based.
417 @param PortStatus A pointer to the current port status bits and port status change bits.
418
419 @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber
420 was returned in PortStatus.
421 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
422
423 **/
424 typedef
425 EFI_STATUS
426 (EFIAPI *EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS) (
427 IN EFI_USB2_HC_PROTOCOL *This,
428 IN UINT8 PortNumber,
429 OUT EFI_USB_PORT_STATUS *PortStatus
430 )
431 ;
432
433 /**
434 Sets a feature for the specified root hub port.
435
436 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
437 @param PortNumber Specifies the root hub port whose feature is requested to be set. This
438 value is zero based.
439 @param PortFeature Indicates the feature selector associated with the feature set request.
440
441 @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB
442 root hub port specified by PortNumber.
443 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
444
445 **/
446 typedef
447 EFI_STATUS
448 (EFIAPI *EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE) (
449 IN EFI_USB2_HC_PROTOCOL *This,
450 IN UINT8 PortNumber,
451 IN EFI_USB_PORT_FEATURE PortFeature
452 )
453 ;
454
455 /**
456 Clears a feature for the specified root hub port.
457
458 @param This A pointer to the EFI_USB2_HC_PROTOCOL instance.
459 @param PortNumber Specifies the root hub port whose feature is requested to be cleared. This
460 value is zero based.
461 @param PortFeature Indicates the feature selector associated with the feature clear request.
462
463 @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB
464 root hub port specified by PortNumber.
465 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
466
467 **/
468 typedef
469 EFI_STATUS
470 (EFIAPI *EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE) (
471 IN EFI_USB2_HC_PROTOCOL *This,
472 IN UINT8 PortNumber,
473 IN EFI_USB_PORT_FEATURE PortFeature
474 )
475 ;
476
477 struct _EFI_USB2_HC_PROTOCOL {
478 EFI_USB2_HC_PROTOCOL_GET_CAPABILITY GetCapability;
479 EFI_USB2_HC_PROTOCOL_RESET Reset;
480 EFI_USB2_HC_PROTOCOL_GET_STATE GetState;
481 EFI_USB2_HC_PROTOCOL_SET_STATE SetState;
482 EFI_USB2_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer;
483 EFI_USB2_HC_PROTOCOL_BULK_TRANSFER BulkTransfer;
484 EFI_USB2_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer;
485 EFI_USB2_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer;
486 EFI_USB2_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer;
487 EFI_USB2_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer;
488 EFI_USB2_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
489 EFI_USB2_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
490 EFI_USB2_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
491 UINT16 MajorRevision;
492 UINT16 MinorRevision;
493 };
494
495 extern EFI_GUID gEfiUsb2HcProtocolGuid;
496
497 #endif