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