]>
Commit | Line | Data |
---|---|---|
21bd4958 FT |
1 | /** @file\r |
2 | The USB Function Protocol provides an I/O abstraction for a USB Controller\r | |
3 | operating in Function mode (also commonly referred to as Device, Peripheral,\r | |
4 | or Target mode) and the mechanisms by which the USB Function can communicate\r | |
5 | with the USB Host. It is used by other UEFI drivers or applications to\r | |
6 | perform data transactions and basic USB controller management over a USB\r | |
7 | Function port.\r | |
8 | \r | |
9 | This simple protocol only supports USB 2.0 bulk transfers on systems with a\r | |
10 | single configuration and a single interface. It does not support isochronous\r | |
11 | or interrupt transfers, alternate interfaces, or USB 3.0 functionality.\r | |
12 | Future revisions of this protocol may support these or additional features.\r | |
13 | \r | |
497a5fb1 | 14 | Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r |
21bd4958 FT |
15 | This program and the accompanying materials\r |
16 | are licensed and made available under the terms and conditions of the BSD License\r | |
17 | which accompanies this distribution. The full text of the license may be found at\r | |
18 | http://opensource.org/licenses/bsd-license.php\r | |
19 | \r | |
20 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
21 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
22 | \r | |
497a5fb1 SZ |
23 | @par Revision Reference:\r |
24 | This Protocol was introduced in UEFI Specification 2.5.\r | |
25 | \r | |
21bd4958 FT |
26 | **/\r |
27 | \r | |
28 | #ifndef __USB_FUNCTION_IO_H__\r | |
29 | #define __USB_FUNCTION_IO_H__\r | |
30 | \r | |
31 | #include <Protocol/UsbIo.h>\r | |
32 | \r | |
33 | #define EFI_USBFN_IO_PROTOCOL_GUID \\r | |
34 | { \\r | |
35 | 0x32d2963a, 0xfe5d, 0x4f30, {0xb6, 0x33, 0x6e, 0x5d, 0xc5, 0x58, 0x3, 0xcc} \\r | |
36 | }\r | |
37 | \r | |
38 | typedef struct _EFI_USBFN_IO_PROTOCOL EFI_USBFN_IO_PROTOCOL;\r | |
39 | \r | |
40 | #define EFI_USBFN_IO_PROTOCOL_REVISION 0x00010001\r | |
41 | \r | |
42 | typedef enum _EFI_USBFN_PORT_TYPE {\r | |
43 | EfiUsbUnknownPort = 0,\r | |
44 | EfiUsbStandardDownstreamPort,\r | |
45 | EfiUsbChargingDownstreamPort,\r | |
46 | EfiUsbDedicatedChargingPort,\r | |
47 | EfiUsbInvalidDedicatedChargingPort\r | |
48 | } EFI_USBFN_PORT_TYPE;\r | |
49 | \r | |
50 | typedef struct {\r | |
51 | EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescriptor;\r | |
52 | EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptorTable;\r | |
53 | } EFI_USB_INTERFACE_INFO;\r | |
54 | \r | |
55 | typedef struct {\r | |
56 | EFI_USB_CONFIG_DESCRIPTOR *ConfigDescriptor;\r | |
57 | EFI_USB_INTERFACE_INFO **InterfaceInfoTable;\r | |
58 | } EFI_USB_CONFIG_INFO;\r | |
59 | \r | |
60 | typedef struct {\r | |
61 | EFI_USB_DEVICE_DESCRIPTOR *DeviceDescriptor;\r | |
62 | EFI_USB_CONFIG_INFO **ConfigInfoTable;\r | |
63 | } EFI_USB_DEVICE_INFO;\r | |
64 | \r | |
65 | typedef enum _EFI_USB_ENDPOINT_TYPE {\r | |
66 | UsbEndpointControl = 0x00,\r | |
67 | //UsbEndpointIsochronous = 0x01,\r | |
68 | UsbEndpointBulk = 0x02,\r | |
69 | //UsbEndpointInterrupt = 0x03\r | |
70 | } EFI_USB_ENDPOINT_TYPE;\r | |
71 | \r | |
72 | typedef enum _EFI_USBFN_DEVICE_INFO_ID {\r | |
73 | EfiUsbDeviceInfoUnknown = 0,\r | |
74 | EfiUsbDeviceInfoSerialNumber,\r | |
75 | EfiUsbDeviceInfoManufacturerName,\r | |
76 | EfiUsbDeviceInfoProductName\r | |
77 | } EFI_USBFN_DEVICE_INFO_ID;\r | |
78 | \r | |
79 | typedef enum _EFI_USBFN_ENDPOINT_DIRECTION {\r | |
80 | EfiUsbEndpointDirectionHostOut = 0,\r | |
81 | EfiUsbEndpointDirectionHostIn,\r | |
82 | EfiUsbEndpointDirectionDeviceTx = EfiUsbEndpointDirectionHostIn,\r | |
83 | EfiUsbEndpointDirectionDeviceRx = EfiUsbEndpointDirectionHostOut\r | |
84 | } EFI_USBFN_ENDPOINT_DIRECTION;\r | |
85 | \r | |
86 | typedef enum _EFI_USBFN_MESSAGE {\r | |
87 | //\r | |
88 | // Nothing\r | |
89 | //\r | |
90 | EfiUsbMsgNone = 0,\r | |
91 | //\r | |
92 | // SETUP packet is received, returned Buffer contains\r | |
93 | // EFI_USB_DEVICE_REQUEST struct\r | |
94 | //\r | |
95 | EfiUsbMsgSetupPacket,\r | |
96 | //\r | |
97 | // Indicates that some of the requested data has been received from the\r | |
98 | // host. It is the responsibility of the class driver to determine if it\r | |
99 | // needs to wait for any remaining data. Returned Buffer contains\r | |
100 | // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer\r | |
101 | // status and count of bytes received.\r | |
102 | //\r | |
103 | EfiUsbMsgEndpointStatusChangedRx,\r | |
104 | //\r | |
105 | // Indicates that some of the requested data has been transmitted to the\r | |
106 | // host. It is the responsibility of the class driver to determine if any\r | |
107 | // remaining data needs to be resent. Returned Buffer contains\r | |
108 | // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer\r | |
109 | // status and count of bytes sent.\r | |
110 | //\r | |
111 | EfiUsbMsgEndpointStatusChangedTx,\r | |
112 | //\r | |
113 | // DETACH bus event signaled\r | |
114 | //\r | |
115 | EfiUsbMsgBusEventDetach,\r | |
116 | //\r | |
117 | // ATTACH bus event signaled\r | |
118 | //\r | |
119 | EfiUsbMsgBusEventAttach,\r | |
120 | //\r | |
121 | // RESET bus event signaled\r | |
122 | //\r | |
123 | EfiUsbMsgBusEventReset,\r | |
124 | //\r | |
125 | // SUSPEND bus event signaled\r | |
126 | //\r | |
127 | EfiUsbMsgBusEventSuspend,\r | |
128 | //\r | |
129 | // RESUME bus event signaled\r | |
130 | //\r | |
131 | EfiUsbMsgBusEventResume,\r | |
132 | //\r | |
133 | // Bus speed updated, returned buffer indicated bus speed using\r | |
134 | // following enumeration named EFI_USB_BUS_SPEED\r | |
135 | //\r | |
136 | EfiUsbMsgBusEventSpeed\r | |
137 | } EFI_USBFN_MESSAGE;\r | |
138 | \r | |
139 | typedef enum _EFI_USBFN_TRANSFER_STATUS {\r | |
140 | UsbTransferStatusUnknown = 0,\r | |
141 | UsbTransferStatusComplete,\r | |
142 | UsbTransferStatusAborted,\r | |
143 | UsbTransferStatusActive,\r | |
144 | UsbTransferStatusNone\r | |
145 | } EFI_USBFN_TRANSFER_STATUS;\r | |
146 | \r | |
147 | typedef struct _EFI_USBFN_TRANSFER_RESULT {\r | |
148 | UINTN BytesTransferred;\r | |
149 | EFI_USBFN_TRANSFER_STATUS TransferStatus;\r | |
150 | UINT8 EndpointIndex;\r | |
151 | EFI_USBFN_ENDPOINT_DIRECTION Direction;\r | |
152 | VOID *Buffer;\r | |
153 | } EFI_USBFN_TRANSFER_RESULT;\r | |
154 | \r | |
155 | typedef enum _EFI_USB_BUS_SPEED {\r | |
156 | UsbBusSpeedUnknown = 0,\r | |
157 | UsbBusSpeedLow,\r | |
158 | UsbBusSpeedFull,\r | |
159 | UsbBusSpeedHigh,\r | |
160 | UsbBusSpeedSuper,\r | |
161 | UsbBusSpeedMaximum = UsbBusSpeedSuper\r | |
162 | } EFI_USB_BUS_SPEED;\r | |
163 | \r | |
164 | typedef union _EFI_USBFN_MESSAGE_PAYLOAD {\r | |
165 | EFI_USB_DEVICE_REQUEST udr;\r | |
166 | EFI_USBFN_TRANSFER_RESULT utr;\r | |
167 | EFI_USB_BUS_SPEED ubs;\r | |
168 | } EFI_USBFN_MESSAGE_PAYLOAD;\r | |
169 | \r | |
170 | typedef enum _EFI_USBFN_POLICY_TYPE {\r | |
171 | EfiUsbPolicyUndefined = 0,\r | |
172 | EfiUsbPolicyMaxTransactionSize,\r | |
173 | EfiUsbPolicyZeroLengthTerminationSupport,\r | |
174 | EfiUsbPolicyZeroLengthTermination\r | |
175 | } EFI_USBFN_POLICY_TYPE;\r | |
176 | \r | |
177 | /**\r | |
178 | Returns information about what USB port type was attached.\r | |
179 | \r | |
180 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
181 | @param[out] PortType Returns the USB port type.\r | |
182 | \r | |
183 | @retval EFI_SUCCESS The function returned successfully.\r | |
184 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
185 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
186 | @retval EFI_NOT_READY The physical device is busy or not ready to\r | |
187 | process this request or there is no USB port\r | |
188 | attached to the device.\r | |
189 | \r | |
190 | **/\r | |
191 | typedef\r | |
192 | EFI_STATUS\r | |
193 | (EFIAPI *EFI_USBFN_IO_DETECT_PORT) (\r | |
194 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
195 | OUT EFI_USBFN_PORT_TYPE *PortType\r | |
196 | );\r | |
197 | \r | |
198 | /**\r | |
199 | Configures endpoints based on supplied device and configuration descriptors.\r | |
200 | \r | |
201 | Assuming that the hardware has already been initialized, this function configures\r | |
202 | the endpoints using the device information supplied by DeviceInfo, activates the\r | |
203 | port, and starts receiving USB events.\r | |
204 | \r | |
205 | This function must ignore the bMaxPacketSize0field of the Standard Device Descriptor\r | |
206 | and the wMaxPacketSize field of the Standard Endpoint Descriptor that are made\r | |
207 | available through DeviceInfo.\r | |
208 | \r | |
209 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
210 | @param[out] DeviceInfo A pointer to EFI_USBFN_DEVICE_INFO instance.\r | |
211 | \r | |
212 | @retval EFI_SUCCESS The function returned successfully.\r | |
213 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
214 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
215 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
216 | this request.\r | |
217 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of\r | |
218 | resources.\r | |
219 | \r | |
220 | **/\r | |
221 | typedef\r | |
222 | EFI_STATUS\r | |
223 | (EFIAPI *EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS) (\r | |
224 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
225 | OUT EFI_USB_DEVICE_INFO *DeviceInfo\r | |
226 | );\r | |
227 | \r | |
228 | /**\r | |
229 | Returns the maximum packet size of the specified endpoint type for the supplied\r | |
230 | bus speed.\r | |
231 | \r | |
232 | If the BusSpeed is UsbBusSpeedUnknown, the maximum speed the underlying controller\r | |
233 | supports is assumed.\r | |
234 | \r | |
235 | This protocol currently does not support isochronous or interrupt transfers. Future\r | |
236 | revisions of this protocol may eventually support it.\r | |
237 | \r | |
238 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.\r | |
239 | @param[in] EndpointType Endpoint type as defined as EFI_USB_ENDPOINT_TYPE.\r | |
240 | @param[in] BusSpeed Bus speed as defined as EFI_USB_BUS_SPEED.\r | |
241 | @param[out] MaxPacketSize The maximum packet size, in bytes, of the specified\r | |
242 | endpoint type.\r | |
243 | \r | |
244 | @retval EFI_SUCCESS The function returned successfully.\r | |
245 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
246 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
247 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
248 | this request.\r | |
249 | \r | |
250 | **/\r | |
251 | typedef\r | |
252 | EFI_STATUS\r | |
253 | (EFIAPI *EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE) (\r | |
254 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
255 | IN EFI_USB_ENDPOINT_TYPE EndpointType,\r | |
256 | IN EFI_USB_BUS_SPEED BusSpeed,\r | |
257 | OUT UINT16 *MaxPacketSize\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Returns device specific information based on the supplied identifier as a Unicode string.\r | |
262 | \r | |
263 | If the supplied Buffer isn't large enough, or is NULL, the method fails with\r | |
264 | EFI_BUFFER_TOO_SMALL and the required size is returned through BufferSize. All returned\r | |
265 | strings are in Unicode format.\r | |
266 | \r | |
267 | An Id of EfiUsbDeviceInfoUnknown is treated as an invalid parameter.\r | |
268 | \r | |
269 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.\r | |
270 | @param[in] Id The requested information id.\r | |
271 | \r | |
272 | \r | |
273 | @param[in] BufferSize On input, the size of the Buffer in bytes. On output, the\r | |
274 | amount of data returned in Buffer in bytes.\r | |
275 | @param[out] Buffer A pointer to a buffer to returnthe requested information\r | |
276 | as a Unicode string.\r | |
277 | \r | |
278 | @retval EFI_SUCCESS The function returned successfully.\r | |
1683ecec SZ |
279 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r |
280 | BufferSize is NULL.\r | |
281 | *BufferSize is not 0 and Buffer is NULL.\r | |
282 | Id in invalid.\r | |
21bd4958 | 283 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r |
1683ecec SZ |
284 | @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.\r |
285 | *BufferSize has been updated with the size needed to hold the request string.\r | |
21bd4958 FT |
286 | \r |
287 | **/\r | |
288 | typedef\r | |
289 | EFI_STATUS\r | |
290 | (EFIAPI *EFI_USBFN_IO_GET_DEVICE_INFO) (\r | |
291 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
292 | IN EFI_USBFN_DEVICE_INFO_ID Id,\r | |
293 | IN OUT UINTN *BufferSize,\r | |
294 | OUT VOID *Buffer OPTIONAL\r | |
295 | );\r | |
296 | \r | |
297 | /**\r | |
298 | Returns the vendor-id and product-id of the device.\r | |
299 | \r | |
300 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
301 | @param[out] Vid Returned vendor-id of the device.\r | |
302 | @param[out] Pid Returned product-id of the device.\r | |
303 | \r | |
304 | @retval EFI_SUCCESS The function returned successfully.\r | |
305 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
306 | @retval EFI_NOT_FOUND Unable to return the vendor-id or the product-id.\r | |
307 | \r | |
308 | **/\r | |
309 | typedef\r | |
310 | EFI_STATUS\r | |
311 | (EFIAPI *EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID) (\r | |
312 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
313 | OUT UINT16 *Vid,\r | |
314 | OUT UINT16 *Pid\r | |
315 | );\r | |
316 | \r | |
317 | /**\r | |
318 | Aborts the transfer on the specified endpoint.\r | |
319 | \r | |
320 | This function should fail with EFI_INVALID_PARAMETER if the specified direction\r | |
321 | is incorrect for the endpoint.\r | |
322 | \r | |
323 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
324 | @param[in] EndpointIndex Indicates the endpoint on which the ongoing transfer\r | |
325 | needs to be canceled.\r | |
326 | @param[in] Direction Direction of the endpoint.\r | |
327 | \r | |
328 | @retval EFI_SUCCESS The function returned successfully.\r | |
329 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
330 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
331 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
332 | this request.\r | |
333 | \r | |
334 | **/\r | |
335 | typedef\r | |
336 | EFI_STATUS\r | |
337 | (EFIAPI *EFI_USBFN_IO_ABORT_TRANSFER) (\r | |
338 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
339 | IN UINT8 EndpointIndex,\r | |
340 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction\r | |
341 | );\r | |
342 | \r | |
343 | /**\r | |
344 | Returns the stall state on the specified endpoint.\r | |
345 | \r | |
346 | This function should fail with EFI_INVALID_PARAMETER if the specified direction\r | |
347 | is incorrect for the endpoint.\r | |
348 | \r | |
349 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
350 | @param[in] EndpointIndex Indicates the endpoint.\r | |
351 | @param[in] Direction Direction of the endpoint.\r | |
352 | @param[in, out] State Boolean, true value indicates that the endpoint\r | |
353 | is in a stalled state, false otherwise.\r | |
354 | \r | |
355 | @retval EFI_SUCCESS The function returned successfully.\r | |
356 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
357 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
358 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
359 | this request.\r | |
360 | \r | |
361 | **/\r | |
362 | typedef\r | |
363 | EFI_STATUS\r | |
364 | (EFIAPI *EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE) (\r | |
365 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
366 | IN UINT8 EndpointIndex,\r | |
367 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction,\r | |
368 | IN OUT BOOLEAN *State\r | |
369 | );\r | |
370 | \r | |
371 | /**\r | |
372 | Sets or clears the stall state on the specified endpoint.\r | |
373 | \r | |
374 | This function should fail with EFI_INVALID_PARAMETER if the specified direction\r | |
375 | is incorrect for the endpoint.\r | |
376 | \r | |
377 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
378 | @param[in] EndpointIndex Indicates the endpoint.\r | |
379 | @param[in] Direction Direction of the endpoint.\r | |
380 | @param[in] State Requested stall state on the specified endpoint.\r | |
381 | True value causes the endpoint to stall; false\r | |
382 | value clears an existing stall.\r | |
383 | \r | |
384 | @retval EFI_SUCCESS The function returned successfully.\r | |
385 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
386 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
387 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
388 | this request.\r | |
389 | \r | |
390 | **/\r | |
391 | typedef\r | |
392 | EFI_STATUS\r | |
393 | (EFIAPI *EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE) (\r | |
394 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
395 | IN UINT8 EndpointIndex,\r | |
396 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction,\r | |
397 | IN OUT BOOLEAN *State\r | |
398 | );\r | |
399 | \r | |
400 | /**\r | |
401 | This function is called repeatedly to get information on USB bus states,\r | |
402 | receive-completion and transmit-completion events on the endpoints, and\r | |
403 | notification on setup packet on endpoint 0.\r | |
404 | \r | |
405 | A class driver must call EFI_USBFN_IO_PROTOCOL.EventHandler()repeatedly\r | |
406 | to receive updates on the transfer status and number of bytes transferred\r | |
407 | on various endpoints.\r | |
408 | \r | |
409 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
410 | @param[out] Message Indicates the event that initiated this notification.\r | |
411 | @param[in, out] PayloadSize On input, the size of the memory pointed by\r | |
412 | Payload. On output, the amount ofdata returned\r | |
413 | in Payload.\r | |
414 | @param[out] Payload A pointer to EFI_USBFN_MESSAGE_PAYLOAD instance\r | |
415 | to return additional payload for current message.\r | |
416 | \r | |
417 | @retval EFI_SUCCESS The function returned successfully.\r | |
418 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
419 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
420 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
421 | this request.\r | |
422 | @retval EFI_BUFFER_TOO_SMALL The Supplied buffer is not large enough to hold\r | |
423 | the message payload.\r | |
424 | \r | |
425 | **/\r | |
426 | typedef\r | |
427 | EFI_STATUS\r | |
428 | (EFIAPI *EFI_USBFN_IO_EVENTHANDLER) (\r | |
429 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
430 | OUT EFI_USBFN_MESSAGE *Message,\r | |
431 | IN OUT UINTN *PayloadSize,\r | |
432 | OUT EFI_USBFN_MESSAGE_PAYLOAD *Payload\r | |
433 | );\r | |
434 | \r | |
435 | /**\r | |
436 | This function handles transferring data to or from the host on the specified\r | |
437 | endpoint, depending on the direction specified.\r | |
438 | \r | |
439 | A class driver must call EFI_USBFN_IO_PROTOCOL.EventHandler() repeatedly to\r | |
440 | receive updates on the transfer status and the number of bytes transferred on\r | |
441 | various endpoints. Upon an update of the transfer status, the Buffer field of\r | |
442 | the EFI_USBFN_TRANSFER_RESULT structure (as described in the function description\r | |
443 | for EFI_USBFN_IO_PROTOCOL.EventHandler()) must be initialized with the Buffer\r | |
444 | pointer that was supplied to this method.\r | |
445 | \r | |
446 | The overview of the call sequence is illustrated in the Figure 54.\r | |
447 | \r | |
448 | This function should fail with EFI_INVALID_PARAMETER if the specified direction\r | |
449 | is incorrect for the endpoint.\r | |
450 | \r | |
451 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
452 | @param[in] EndpointIndex Indicates the endpoint on which TX or RX transfer\r | |
453 | needs to take place.\r | |
454 | @param[in] Direction Direction of the endpoint.\r | |
455 | @param[in, out] BufferSize If Direction is EfiUsbEndpointDirectionDeviceRx:\r | |
456 | On input, the size of the Bufferin bytes.\r | |
457 | On output, the amount of data returned in Buffer\r | |
458 | in bytes.\r | |
459 | If Direction is EfiUsbEndpointDirectionDeviceTx:\r | |
460 | On input, the size of the Bufferin bytes.\r | |
461 | On output, the amount of data transmitted in bytes.\r | |
462 | @param[in, out] Buffer If Direction is EfiUsbEndpointDirectionDeviceRx:\r | |
463 | The Buffer to return the received data.\r | |
464 | If Directionis EfiUsbEndpointDirectionDeviceTx:\r | |
465 | The Buffer that contains the data to be transmitted.\r | |
466 | \r | |
467 | @retval EFI_SUCCESS The function returned successfully.\r | |
468 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
469 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
470 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
471 | this request.\r | |
472 | \r | |
473 | **/\r | |
474 | typedef\r | |
475 | EFI_STATUS\r | |
476 | (EFIAPI *EFI_USBFN_IO_TRANSFER) (\r | |
477 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
478 | IN UINT8 EndpointIndex,\r | |
479 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction,\r | |
480 | IN OUT UINTN *BufferSize,\r | |
481 | IN OUT VOID *Buffer\r | |
482 | );\r | |
483 | \r | |
484 | /**\r | |
485 | Returns the maximum supported transfer size.\r | |
486 | \r | |
487 | Returns the maximum number of bytes that the underlying controller can accommodate\r | |
488 | in a single transfer.\r | |
489 | \r | |
490 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
491 | @param[out] MaxTransferSize The maximum supported transfer size, in bytes.\r | |
492 | \r | |
493 | @retval EFI_SUCCESS The function returned successfully.\r | |
494 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
495 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
496 | @retval EFI_NOT_READY The physical device is busy or not ready to process\r | |
497 | this request.\r | |
498 | \r | |
499 | **/\r | |
500 | typedef\r | |
501 | EFI_STATUS\r | |
502 | (EFIAPI *EFI_USBFN_IO_GET_MAXTRANSFER_SIZE) (\r | |
503 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
504 | OUT UINTN *MaxTransferSize\r | |
505 | );\r | |
506 | \r | |
507 | /**\r | |
508 | Allocates a transfer buffer of the specified sizethat satisfies the controller\r | |
509 | requirements.\r | |
510 | \r | |
511 | The AllocateTransferBuffer() function allocates a memory region of Size bytes and\r | |
512 | returns the address of the allocated memory that satisfies the underlying controller\r | |
513 | requirements in the location referenced by Buffer.\r | |
514 | \r | |
515 | The allocated transfer buffer must be freed using a matching call to\r | |
516 | EFI_USBFN_IO_PROTOCOL.FreeTransferBuffer()function.\r | |
517 | \r | |
518 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
519 | @param[in] Size The number of bytes to allocate for the transfer buffer.\r | |
520 | @param[out] Buffer A pointer to a pointer to the allocated buffer if the\r | |
521 | call succeeds; undefined otherwise.\r | |
522 | \r | |
523 | @retval EFI_SUCCESS The function returned successfully.\r | |
524 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
525 | @retval EFI_OUT_OF_RESOURCES The requested transfer buffer could not be allocated.\r | |
526 | \r | |
527 | **/\r | |
528 | typedef\r | |
529 | EFI_STATUS\r | |
530 | (EFIAPI *EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER) (\r | |
531 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
532 | IN UINTN Size,\r | |
533 | OUT VOID **Buffer\r | |
534 | );\r | |
535 | \r | |
536 | /**\r | |
537 | Deallocates the memory allocated for the transfer buffer by the\r | |
538 | EFI_USBFN_IO_PROTOCOL.AllocateTransferBuffer() function.\r | |
539 | \r | |
540 | The EFI_USBFN_IO_PROTOCOL.FreeTransferBuffer() function deallocates the\r | |
541 | memory specified by Buffer. The Buffer that is freed must have been allocated\r | |
542 | by EFI_USBFN_IO_PROTOCOL.AllocateTransferBuffer().\r | |
543 | \r | |
544 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
545 | @param[in] Buffer A pointer to the transfer buffer to deallocate.\r | |
546 | \r | |
547 | @retval EFI_SUCCESS The function returned successfully.\r | |
548 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
549 | \r | |
550 | **/\r | |
551 | typedef\r | |
552 | EFI_STATUS\r | |
553 | (EFIAPI *EFI_USBFN_IO_FREE_TRANSFER_BUFFER) (\r | |
554 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
555 | IN VOID *Buffer\r | |
556 | );\r | |
557 | \r | |
558 | /**\r | |
559 | This function supplies power to the USB controller if needed and initializes\r | |
560 | the hardware and the internal data structures. The port must not be activated\r | |
561 | by this function.\r | |
562 | \r | |
563 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
564 | \r | |
565 | @retval EFI_SUCCESS The function returned successfully.\r | |
566 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
567 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
568 | \r | |
569 | **/\r | |
570 | typedef\r | |
571 | EFI_STATUS\r | |
572 | (EFIAPI *EFI_USBFN_IO_START_CONTROLLER) (\r | |
573 | IN EFI_USBFN_IO_PROTOCOL *This\r | |
574 | );\r | |
575 | \r | |
576 | /**\r | |
577 | This function stops the USB hardware device.\r | |
578 | \r | |
579 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
580 | \r | |
581 | @retval EFI_SUCCESS The function returned successfully.\r | |
582 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
583 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
584 | \r | |
585 | **/\r | |
586 | typedef\r | |
587 | EFI_STATUS\r | |
588 | (EFIAPI *EFI_USBFN_IO_STOP_CONTROLLER) (\r | |
589 | IN EFI_USBFN_IO_PROTOCOL *This\r | |
590 | );\r | |
591 | \r | |
592 | /**\r | |
593 | This function sets the configuration policy for the specified non-control\r | |
594 | endpoint.\r | |
595 | \r | |
596 | This function can only be called before EFI_USBFN_IO_PROTOCOL.StartController()\r | |
597 | or after EFI_USBFN_IO_PROTOCOL.StopController() has been called.\r | |
598 | \r | |
599 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
600 | @param[in] EndpointIndex Indicates the non-control endpoint for which the\r | |
601 | policy needs to be set.\r | |
602 | @param[in] Direction Direction of the endpoint.\r | |
603 | @param[in] PolicyType Policy type the user is trying to set for the\r | |
604 | specified non-control endpoint.\r | |
605 | @param[in] BufferSize The size of the Bufferin bytes.\r | |
606 | @param[in] Buffer The new value for the policy parameter that\r | |
607 | PolicyType specifies.\r | |
608 | \r | |
609 | @retval EFI_SUCCESS The function returned successfully.\r | |
610 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
611 | @retval EFI_DEVICE_ERROR The physical device reported an error.\r | |
612 | @retval EFI_UNSUPPORTED Changing this policy value is not supported.\r | |
613 | \r | |
614 | **/\r | |
615 | typedef\r | |
616 | EFI_STATUS\r | |
617 | (EFIAPI *EFI_USBFN_IO_SET_ENDPOINT_POLICY) (\r | |
618 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
619 | IN UINT8 EndpointIndex,\r | |
620 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction,\r | |
621 | IN EFI_USBFN_POLICY_TYPE PolicyType,\r | |
622 | IN UINTN BufferSize,\r | |
623 | IN VOID *Buffer\r | |
624 | );\r | |
625 | \r | |
626 | /**\r | |
627 | This function sets the configuration policy for the specified non-control\r | |
628 | endpoint.\r | |
629 | \r | |
630 | This function can only be called before EFI_USBFN_IO_PROTOCOL.StartController()\r | |
631 | or after EFI_USBFN_IO_PROTOCOL.StopController() has been called.\r | |
632 | \r | |
633 | @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.\r | |
634 | @param[in] EndpointIndex Indicates the non-control endpoint for which the\r | |
635 | policy needs to be set.\r | |
636 | @param[in] Direction Direction of the endpoint.\r | |
637 | @param[in] PolicyType Policy type the user is trying to retrieve for\r | |
638 | the specified non-control endpoint.\r | |
639 | @param[in, out] BufferSize On input, the size of Bufferin bytes. On output,\r | |
640 | the amount of data returned in Bufferin bytes.\r | |
641 | @param[in, out] Buffer A pointer to a buffer to return requested endpoint\r | |
642 | policy value.\r | |
643 | \r | |
644 | @retval EFI_SUCCESS The function returned successfully.\r | |
645 | @retval EFI_INVALID_PARAMETER A parameter is invalid.\r | |
646 | @retval EFI_DEVICE_ERROR The specified policy value is not supported.\r | |
647 | @retval EFI_BUFFER_TOO_SMALL Supplied buffer is not large enough to hold requested\r | |
648 | policy value.\r | |
649 | \r | |
650 | **/\r | |
651 | typedef\r | |
652 | EFI_STATUS\r | |
653 | (EFIAPI *EFI_USBFN_IO_GET_ENDPOINT_POLICY) (\r | |
654 | IN EFI_USBFN_IO_PROTOCOL *This,\r | |
655 | IN UINT8 EndpointIndex,\r | |
656 | IN EFI_USBFN_ENDPOINT_DIRECTION Direction,\r | |
657 | IN EFI_USBFN_POLICY_TYPE PolicyType,\r | |
658 | IN OUT UINTN *BufferSize,\r | |
659 | IN OUT VOID *Buffer\r | |
660 | );\r | |
661 | \r | |
662 | ///\r | |
663 | /// The EFI_USBFN_IO_PROTOCOL provides basic data transactions and basic USB\r | |
664 | /// controller management for a USB Function port.\r | |
665 | ///\r | |
666 | struct _EFI_USBFN_IO_PROTOCOL {\r | |
667 | UINT32 Revision;\r | |
668 | EFI_USBFN_IO_DETECT_PORT DetectPort;\r | |
669 | EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS ConfigureEnableEndpoints;\r | |
670 | EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE GetEndpointMaxPacketSize;\r | |
671 | EFI_USBFN_IO_GET_DEVICE_INFO GetDeviceInfo;\r | |
672 | EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID GetVendorIdProductId;\r | |
673 | EFI_USBFN_IO_ABORT_TRANSFER AbortTransfer;\r | |
674 | EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE GetEndpointStallState;\r | |
675 | EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE SetEndpointStallState;\r | |
676 | EFI_USBFN_IO_EVENTHANDLER EventHandler;\r | |
677 | EFI_USBFN_IO_TRANSFER Transfer;\r | |
678 | EFI_USBFN_IO_GET_MAXTRANSFER_SIZE GetMaxTransferSize;\r | |
679 | EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER AllocateTransferBuffer;\r | |
680 | EFI_USBFN_IO_FREE_TRANSFER_BUFFER FreeTransferBuffer;\r | |
681 | EFI_USBFN_IO_START_CONTROLLER StartController;\r | |
682 | EFI_USBFN_IO_STOP_CONTROLLER StopController;\r | |
683 | EFI_USBFN_IO_SET_ENDPOINT_POLICY SetEndpointPolicy;\r | |
684 | EFI_USBFN_IO_GET_ENDPOINT_POLICY GetEndpointPolicy;\r | |
685 | };\r | |
686 | \r | |
687 | extern EFI_GUID gEfiUsbFunctionIoProtocolGuid;\r | |
688 | \r | |
689 | #endif\r | |
690 | \r |