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