]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/UsbHostController.h
Code Scrub for Protocol and Ppi Definition
[mirror_edk2.git] / MdePkg / Include / Protocol / UsbHostController.h
1 /** @file
2 EFI_USB_HC_PROTOCOL as defined in EFI 1.10.
3
4 The USB Host Controller Protocol is used by code, typically USB bus drivers,
5 running in the EFI boot services environment, to perform data transactions
6 over a USB bus. In addition, it provides an abstraction for the root hub of the USB bus.
7
8 Copyright (c) 2006 - 2008, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #ifndef _USB_HOSTCONTROLLER_H_
20 #define _USB_HOSTCONTROLLER_H_
21
22 #include <Protocol/Usb2HostController.h>
23
24 #define EFI_USB_HC_PROTOCOL_GUID \
25 { \
26 0xf5089266, 0x1aa0, 0x4953, {0x97, 0xd8, 0x56, 0x2f, 0x8a, 0x73, 0xb5, 0x19 } \
27 }
28
29 //
30 // Forward reference for pure ANSI compatability
31 //
32 typedef struct _EFI_USB_HC_PROTOCOL EFI_USB_HC_PROTOCOL;
33
34 //
35 // Protocol definitions
36 //
37
38 /**
39 Provides software reset for the USB host controller.
40
41 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
42 @param Attributes A bit mask of the reset operation to perform.
43
44 @retval EFI_SUCCESS The reset operation succeeded.
45 @retval EFI_UNSUPPORTED The type of reset specified by Attributes is not currently supported
46 by the host controller hardware.
47 @retval EFI_INVALID_PARAMETER Attributes is not valid.
48 @retval EFI_DEVICE_ERROR An error was encountered while attempting to perform the reset operation.
49
50 **/
51 typedef
52 EFI_STATUS
53 (EFIAPI *EFI_USB_HC_PROTOCOL_RESET)(
54 IN EFI_USB_HC_PROTOCOL *This,
55 IN UINT16 Attributes
56 );
57
58 /**
59 Retrieves current state of the USB host controller.
60
61 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
62 @param State A pointer to the EFI_USB_HC_STATE data structure that
63 indicates current state of the USB host controller.
64
65 @retval EFI_SUCCESS The state information of the host controller was returned in State.
66 @retval EFI_INVALID_PARAMETER State is NULL.
67 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the host controller's
68 current state.
69
70 **/
71 typedef
72 EFI_STATUS
73 (EFIAPI *EFI_USB_HC_PROTOCOL_GET_STATE)(
74 IN EFI_USB_HC_PROTOCOL *This,
75 OUT EFI_USB_HC_STATE *State
76 );
77
78 /**
79 Sets the USB host controller to a specific state.
80
81 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
82 @param State Indicates the state of the host controller that will be set.
83
84 @retval EFI_SUCCESS The USB host controller was successfully placed in the state specified by
85 State.
86 @retval EFI_INVALID_PARAMETER State is NULL.
87 @retval EFI_DEVICE_ERROR Failed to set the state specified by State due to device error.
88
89 **/
90 typedef
91 EFI_STATUS
92 (EFIAPI *EFI_USB_HC_PROTOCOL_SET_STATE)(
93 IN EFI_USB_HC_PROTOCOL *This,
94 IN EFI_USB_HC_STATE State
95 );
96
97 /**
98 Submits control transfer to a target USB device.
99
100 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
101 @param DeviceAddress Represents the address of the target device on the USB, which is
102 assigned during USB enumeration.
103 @param IsSlowDevice Indicates whether the target device is slow device or full-speed
104 device.
105 @param MaximumPacketLength Indicates the maximum packet size that the default control
106 transfer endpoint is capable of sending or receiving.
107 @param Request A pointer to the USB device request that will be sent to the USB
108 device.
109 @param TransferDirection Specifies the data direction for the transfer.
110 @param Data A pointer to the buffer of data that will be transmitted to USB
111 device or received from USB device.
112 @param DataLength On input, indicates the size, in bytes, of the data buffer specified
113 by Data. On output, indicates the amount of data actually
114 transferred.
115 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer
116 is allowed to complete.
117 @param TransferResult A pointer to the detailed result information generated by this
118 control transfer.
119
120 @retval EFI_SUCCESS The control transfer was completed successfully.
121 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.
122 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
123 @retval EFI_TIMEOUT The control transfer failed due to timeout.
124 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller or device error.
125
126 **/
127 typedef
128 EFI_STATUS
129 (EFIAPI *EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER)(
130 IN EFI_USB_HC_PROTOCOL *This,
131 IN UINT8 DeviceAddress,
132 IN BOOLEAN IsSlowDevice,
133 IN UINT8 MaximumPacketLength,
134 IN EFI_USB_DEVICE_REQUEST *Request,
135 IN EFI_USB_DATA_DIRECTION TransferDirection,
136 IN OUT VOID *Data OPTIONAL,
137 IN OUT UINTN *DataLength OPTIONAL,
138 IN UINTN TimeOut,
139 OUT UINT32 *TransferResult
140 );
141
142 /**
143 Submits bulk transfer to a bulk endpoint of a USB device.
144
145 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
146 @param DeviceAddress Represents the address of the target device on the USB, which is
147 assigned during USB enumeration.
148 @param EndPointAddress The combination of an endpoint number and an endpoint
149 direction of the target USB device.
150 @param MaximumPacketLength Indicates the maximum packet size that the default control
151 transfer endpoint is capable of sending or receiving.
152 @param Data A pointer to the buffer of data that will be transmitted to USB
153 device or received from USB device.
154 @param DataLength On input, indicates the size, in bytes, of the data buffer specified
155 by Data. On output, indicates the amount of data actually
156 transferred.
157 @param DataToggle A pointer to the data toggle value.
158 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer
159 is allowed to complete.
160 @param TransferResult A pointer to the detailed result information of the bulk transfer.
161
162 @retval EFI_SUCCESS The bulk transfer was completed successfully.
163 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to a lack of resources.
164 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
165 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
166 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
167
168 **/
169 typedef
170 EFI_STATUS
171 (EFIAPI *EFI_USB_HC_PROTOCOL_BULK_TRANSFER)(
172 IN EFI_USB_HC_PROTOCOL *This,
173 IN UINT8 DeviceAddress,
174 IN UINT8 EndPointAddress,
175 IN UINT8 MaximumPacketLength,
176 IN OUT VOID *Data,
177 IN OUT UINTN *DataLength,
178 IN OUT UINT8 *DataToggle,
179 IN UINTN TimeOut,
180 OUT UINT32 *TransferResult
181 );
182
183 /**
184 Submits an asynchronous interrupt transfer to an interrupt endpoint of a USB device.
185
186 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
187 @param DeviceAddress Represents the address of the target device on the USB, which is
188 assigned during USB enumeration.
189 @param EndPointAddress The combination of an endpoint number and an endpoint
190 direction of the target USB device.
191 @param IsSlowDevice Indicates whether the target device is slow device or full-speed
192 device.
193 @param MaximumPacketLength Indicates the maximum packet size that the default control
194 transfer endpoint is capable of sending or receiving.
195 @param IsNewTransfer If TRUE, an asynchronous interrupt pipe is built between the host
196 and the target interrupt endpoint. If FALSE, the specified
197 @param DataToggle A pointer to the data toggle value.
198 @param PollingInterval Indicates the interval, in milliseconds, that the asynchronous
199 interrupt transfer is polled. asynchronous interrupt pipe is canceled.
200 @param DataLength Indicates the length of data to be received at the rate specified by
201 PollingInterval from the target asynchronous interrupt
202 endpoint.
203 @param CallBackFunction The Callback function.
204 @param Context The context that is passed to the CallBackFunction.
205
206 @retval EFI_SUCCESS The asynchronous interrupt transfer request has been successfully
207 submitted or canceled.
208 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
209 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
210 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
211 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.
212
213 **/
214 typedef
215 EFI_STATUS
216 (EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER)(
217 IN EFI_USB_HC_PROTOCOL *This,
218 IN UINT8 DeviceAddress,
219 IN UINT8 EndPointAddress,
220 IN BOOLEAN IsSlowDevice,
221 IN UINT8 MaxiumPacketLength,
222 IN BOOLEAN IsNewTransfer,
223 IN OUT UINT8 *DataToggle,
224 IN UINTN PollingInterval OPTIONAL,
225 IN UINTN DataLength OPTIONAL,
226 IN EFI_ASYNC_USB_TRANSFER_CALLBACK CallBackFunction OPTIONAL,
227 IN VOID *Context OPTIONAL
228 );
229
230 /**
231 Submits synchronous interrupt transfer to an interrupt endpoint of a USB device.
232
233 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
234 @param DeviceAddress Represents the address of the target device on the USB, which is
235 assigned during USB enumeration.
236 @param EndPointAddress The combination of an endpoint number and an endpoint
237 direction of the target USB device.
238 @param IsSlowDevice Indicates whether the target device is slow device or full-speed
239 device.
240 @param MaximumPacketLength Indicates the maximum packet size that the default control
241 transfer endpoint is capable of sending or receiving.
242 @param Data A pointer to the buffer of data that will be transmitted to USB
243 device or received from USB device. asynchronous interrupt pipe is canceled.
244 @param DataLength On input, the size, in bytes, of the data buffer specified by Data.
245 On output, the number of bytes transferred.
246 @param DataToggle A pointer to the data toggle value.
247 @param TimeOut Indicates the maximum time, in milliseconds, which the transfer
248 is allowed to complete.
249 @param TransferResult A pointer to the detailed result information from the synchronous
250 interrupt transfer.
251
252 @retval EFI_SUCCESS The synchronous interrupt transfer was completed successfully.
253 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
254 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
255 @retval EFI_TIMEOUT The synchronous interrupt transfer failed due to timeout.
256 @retval EFI_DEVICE_ERROR The synchronous interrupt transfer failed due to host controller or device error.
257
258 **/
259 typedef
260 EFI_STATUS
261 (EFIAPI *EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER)(
262 IN EFI_USB_HC_PROTOCOL *This,
263 IN UINT8 DeviceAddress,
264 IN UINT8 EndPointAddress,
265 IN BOOLEAN IsSlowDevice,
266 IN UINT8 MaximumPacketLength,
267 IN OUT VOID *Data,
268 IN OUT UINTN *DataLength,
269 IN OUT UINT8 *DataToggle,
270 IN UINTN TimeOut,
271 OUT UINT32 *TransferResult
272 );
273
274 /**
275 Submits isochronous transfer to an isochronous endpoint of a USB device.
276
277 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
278 @param DeviceAddress Represents the address of the target device on the USB, which is
279 assigned during USB enumeration.
280 @param EndPointAddress The combination of an endpoint number and an endpoint
281 direction of the target USB device.
282 @param MaximumPacketLength Indicates the maximum packet size that the default control
283 transfer endpoint is capable of sending or receiving.
284 @param Data A pointer to the buffer of data that will be transmitted to USB
285 device or received from USB device. asynchronous interrupt pipe is canceled.
286 @param DataLength Specifies the length, in bytes, of the data to be sent to or received
287 from the USB device.
288 @param TransferResult A pointer to the detailed result information from the isochronous
289 transfer.
290
291 @retval EFI_SUCCESS The isochronous transfer was completed successfully.
292 @retval EFI_OUT_OF_RESOURCES The isochronous could not be completed due to a lack of resources.
293 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
294 @retval EFI_TIMEOUT The isochronous transfer failed due to timeout.
295 @retval EFI_DEVICE_ERROR The isochronous transfer failed due to host controller or device error.
296
297 **/
298 typedef
299 EFI_STATUS
300 (EFIAPI *EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER)(
301 IN EFI_USB_HC_PROTOCOL *This,
302 IN UINT8 DeviceAddress,
303 IN UINT8 EndPointAddress,
304 IN UINT8 MaximumPacketLength,
305 IN OUT VOID *Data,
306 IN UINTN DataLength,
307 OUT UINT32 *TransferResult
308 );
309
310 /**
311 Submits nonblocking isochronous transfer to an isochronous endpoint of a USB device.
312
313 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
314 @param DeviceAddress Represents the address of the target device on the USB, which is
315 assigned during USB enumeration.
316 @param EndPointAddress The combination of an endpoint number and an endpoint
317 direction of the target USB device.
318 @param MaximumPacketLength Indicates the maximum packet size that the default control
319 transfer endpoint is capable of sending or receiving.
320 @param Data A pointer to the buffer of data that will be transmitted to USB
321 device or received from USB device. asynchronous interrupt pipe is canceled.
322 @param DataLength Specifies the length, in bytes, of the data to be sent to or received
323 from the USB device.
324 @param IsochronousCallback The Callback function.
325 @param Context Data passed to the IsochronousCallback function. This is
326 an optional parameter and may be NULL.
327
328 @retval EFI_SUCCESS The asynchronous isochronous transfer was completed successfully.
329 @retval EFI_OUT_OF_RESOURCES The asynchronous isochronous could not be completed due to a lack of resources.
330 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
331
332 **/
333 typedef
334 EFI_STATUS
335 (EFIAPI *EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER)(
336 IN EFI_USB_HC_PROTOCOL *This,
337 IN UINT8 DeviceAddress,
338 IN UINT8 EndPointAddress,
339 IN UINT8 MaximumPacketLength,
340 IN OUT VOID *Data,
341 IN UINTN DataLength,
342 IN EFI_ASYNC_USB_TRANSFER_CALLBACK IsochronousCallBack,
343 IN VOID *Context OPTIONAL
344 );
345
346 /**
347 Retrieves the number of root hub ports.
348
349 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
350 @param PortNumber A pointer to the number of the root hub ports.
351
352 @retval EFI_SUCCESS The port number was retrieved successfully.
353 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve the port number.
354 @retval EFI_INVALID_PARAMETER PortNumber is NULL.
355
356 **/
357 typedef
358 EFI_STATUS
359 (EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER)(
360 IN EFI_USB_HC_PROTOCOL *This,
361 OUT UINT8 *PortNumber
362 );
363
364 /**
365 Retrieves the current status of a USB root hub port.
366
367 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
368 @param PortNumber Specifies the root hub port from which the status is to be retrieved.
369 This value is zero based.
370 @param PortStatus A pointer to the current port status bits and port status change bits.
371
372 @retval EFI_SUCCESS The status of the USB root hub port specified by PortNumber
373 was returned in PortStatus.
374 @retval EFI_INVALID_PARAMETER PortNumber is invalid.
375
376 **/
377 typedef
378 EFI_STATUS
379 (EFIAPI *EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS)(
380 IN EFI_USB_HC_PROTOCOL *This,
381 IN UINT8 PortNumber,
382 OUT EFI_USB_PORT_STATUS *PortStatus
383 );
384
385 /**
386 Sets a feature for the specified root hub port.
387
388 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
389 @param PortNumber Specifies the root hub port from which the status is to be retrieved.
390 This value is zero based.
391 @param PortFeature Indicates the feature selector associated with the feature set
392 request.
393
394 @retval EFI_SUCCESS The feature specified by PortFeature was set for the USB
395 root hub port specified by PortNumber.
396 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
397
398 **/
399 typedef
400 EFI_STATUS
401 (EFIAPI *EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE)(
402 IN EFI_USB_HC_PROTOCOL *This,
403 IN UINT8 PortNumber,
404 IN EFI_USB_PORT_FEATURE PortFeature
405 );
406
407 /**
408 Clears a feature for the specified root hub port.
409
410 @param This A pointer to the EFI_USB_HC_PROTOCOL instance.
411 @param PortNumber Specifies the root hub port from which the status is to be cleared.
412 This value is zero based.
413 @param PortFeature Indicates the feature selector associated with the feature clear
414 request.
415
416 @retval EFI_SUCCESS The feature specified by PortFeature was cleared for the USB
417 root hub port specified by PortNumber.
418 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid for this function.
419
420 **/
421 typedef
422 EFI_STATUS
423 (EFIAPI *EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE)(
424 IN EFI_USB_HC_PROTOCOL *This,
425 IN UINT8 PortNumber,
426 IN EFI_USB_PORT_FEATURE PortFeature
427 );
428
429
430 /**
431 @par Protocol Description:
432 The EFI_USB_HC_PROTOCOL provides USB host controller management, basic data transactions
433 over a USB bus, and USB root hub access. A device driver that wishes to manage a USB bus in a
434 system retrieves the EFI_USB_HC_PROTOCOL instance that is associated with the USB bus to be
435 managed. A device handle for a USB host controller will minimally contain an
436 EFI_DEVICE_PATH_PROTOCOL instance, and an EFI_USB_HC_PROTOCOL instance.
437
438 @param Reset
439 Software reset of USB.
440
441 @param GetState
442 Retrieves the current state of the USB host controller.
443
444 @param SetState
445 Sets the USB host controller to a specific state.
446
447 @param ControlTransfer
448 Submits a control transfer to a target USB device.
449
450 @param BulkTransfer
451 Submits a bulk transfer to a bulk endpoint of a USB device.
452
453 @param AsyncInterruptTransfer
454 Submits an asynchronous interrupt transfer to an interrupt endpoint
455 of a USB device.
456
457 @param SyncInterruptTransfer
458 Submits a synchronous interrupt transfer to an interrupt endpoint
459 of a USB device.
460
461 @param IsochronousTransfer
462 Submits isochronous transfer to an isochronous endpoint of a USB device.
463
464 @param AsyncIsochronousTransfer
465 Submits nonblocking USB isochronous transfer.
466
467 @param GetRootHubPortNumber
468 Retrieves the number of root hub ports that are produced by the
469 USB host controller.
470
471 @param GetRootHubPortStatus
472 Retrieves the status of the specified root hub port.
473
474 @param SetRootHubPortFeature
475 Sets the feature for the specified root hub port.
476
477 @param ClearRootHubPortFeature
478 Clears the feature for the specified root hub port.
479
480 @param MajorRevision
481 The major revision number of the USB host controller. The
482 revision information indicates the release of the Universal Serial
483 Bus Specification with which the host controller is compliant.
484
485 @param MinorRevision
486 The minor revision number of the USB host controller. The
487 revision information indicates the release of the Universal Serial
488 Bus Specification with which the host controller is compliant.
489
490 **/
491 struct _EFI_USB_HC_PROTOCOL {
492 EFI_USB_HC_PROTOCOL_RESET Reset;
493 EFI_USB_HC_PROTOCOL_GET_STATE GetState;
494 EFI_USB_HC_PROTOCOL_SET_STATE SetState;
495 EFI_USB_HC_PROTOCOL_CONTROL_TRANSFER ControlTransfer;
496 EFI_USB_HC_PROTOCOL_BULK_TRANSFER BulkTransfer;
497 EFI_USB_HC_PROTOCOL_ASYNC_INTERRUPT_TRANSFER AsyncInterruptTransfer;
498 EFI_USB_HC_PROTOCOL_SYNC_INTERRUPT_TRANSFER SyncInterruptTransfer;
499 EFI_USB_HC_PROTOCOL_ISOCHRONOUS_TRANSFER IsochronousTransfer;
500 EFI_USB_HC_PROTOCOL_ASYNC_ISOCHRONOUS_TRANSFER AsyncIsochronousTransfer;
501 EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;
502 EFI_USB_HC_PROTOCOL_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;
503 EFI_USB_HC_PROTOCOL_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;
504 EFI_USB_HC_PROTOCOL_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;
505 UINT16 MajorRevision;
506 UINT16 MinorRevision;
507 };
508
509 extern EFI_GUID gEfiUsbHcProtocolGuid;
510
511 #endif