2 The USB Function Protocol provides an I/O abstraction for a USB Controller
3 operating in Function mode (also commonly referred to as Device, Peripheral,
4 or Target mode) and the mechanisms by which the USB Function can communicate
5 with the USB Host. It is used by other UEFI drivers or applications to
6 perform data transactions and basic USB controller management over a USB
9 This simple protocol only supports USB 2.0 bulk transfers on systems with a
10 single configuration and a single interface. It does not support isochronous
11 or interrupt transfers, alternate interfaces, or USB 3.0 functionality.
12 Future revisions of this protocol may support these or additional features.
14 Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>
15 This program and the accompanying materials
16 are licensed and made available under the terms and conditions of the BSD License
17 which accompanies this distribution. The full text of the license may be found at
18 http://opensource.org/licenses/bsd-license.php
20 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 #ifndef __USB_FUNCTION_IO_H__
26 #define __USB_FUNCTION_IO_H__
28 #include <Protocol/UsbIo.h>
30 #define EFI_USBFN_IO_PROTOCOL_GUID \
32 0x32d2963a, 0xfe5d, 0x4f30, {0xb6, 0x33, 0x6e, 0x5d, 0xc5, 0x58, 0x3, 0xcc} \
35 typedef struct _EFI_USBFN_IO_PROTOCOL EFI_USBFN_IO_PROTOCOL
;
37 #define EFI_USBFN_IO_PROTOCOL_REVISION 0x00010001
39 typedef enum _EFI_USBFN_PORT_TYPE
{
40 EfiUsbUnknownPort
= 0,
41 EfiUsbStandardDownstreamPort
,
42 EfiUsbChargingDownstreamPort
,
43 EfiUsbDedicatedChargingPort
,
44 EfiUsbInvalidDedicatedChargingPort
45 } EFI_USBFN_PORT_TYPE
;
48 EFI_USB_INTERFACE_DESCRIPTOR
*InterfaceDescriptor
;
49 EFI_USB_ENDPOINT_DESCRIPTOR
**EndpointDescriptorTable
;
50 } EFI_USB_INTERFACE_INFO
;
53 EFI_USB_CONFIG_DESCRIPTOR
*ConfigDescriptor
;
54 EFI_USB_INTERFACE_INFO
**InterfaceInfoTable
;
55 } EFI_USB_CONFIG_INFO
;
58 EFI_USB_DEVICE_DESCRIPTOR
*DeviceDescriptor
;
59 EFI_USB_CONFIG_INFO
**ConfigInfoTable
;
60 } EFI_USB_DEVICE_INFO
;
62 typedef enum _EFI_USB_ENDPOINT_TYPE
{
63 UsbEndpointControl
= 0x00,
64 //UsbEndpointIsochronous = 0x01,
65 UsbEndpointBulk
= 0x02,
66 //UsbEndpointInterrupt = 0x03
67 } EFI_USB_ENDPOINT_TYPE
;
69 typedef enum _EFI_USBFN_DEVICE_INFO_ID
{
70 EfiUsbDeviceInfoUnknown
= 0,
71 EfiUsbDeviceInfoSerialNumber
,
72 EfiUsbDeviceInfoManufacturerName
,
73 EfiUsbDeviceInfoProductName
74 } EFI_USBFN_DEVICE_INFO_ID
;
76 typedef enum _EFI_USBFN_ENDPOINT_DIRECTION
{
77 EfiUsbEndpointDirectionHostOut
= 0,
78 EfiUsbEndpointDirectionHostIn
,
79 EfiUsbEndpointDirectionDeviceTx
= EfiUsbEndpointDirectionHostIn
,
80 EfiUsbEndpointDirectionDeviceRx
= EfiUsbEndpointDirectionHostOut
81 } EFI_USBFN_ENDPOINT_DIRECTION
;
83 typedef enum _EFI_USBFN_MESSAGE
{
89 // SETUP packet is received, returned Buffer contains
90 // EFI_USB_DEVICE_REQUEST struct
94 // Indicates that some of the requested data has been received from the
95 // host. It is the responsibility of the class driver to determine if it
96 // needs to wait for any remaining data. Returned Buffer contains
97 // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer
98 // status and count of bytes received.
100 EfiUsbMsgEndpointStatusChangedRx
,
102 // Indicates that some of the requested data has been transmitted to the
103 // host. It is the responsibility of the class driver to determine if any
104 // remaining data needs to be resent. Returned Buffer contains
105 // EFI_USBFN_TRANSFER_RESULT struct containing endpoint number, transfer
106 // status and count of bytes sent.
108 EfiUsbMsgEndpointStatusChangedTx
,
110 // DETACH bus event signaled
112 EfiUsbMsgBusEventDetach
,
114 // ATTACH bus event signaled
116 EfiUsbMsgBusEventAttach
,
118 // RESET bus event signaled
120 EfiUsbMsgBusEventReset
,
122 // SUSPEND bus event signaled
124 EfiUsbMsgBusEventSuspend
,
126 // RESUME bus event signaled
128 EfiUsbMsgBusEventResume
,
130 // Bus speed updated, returned buffer indicated bus speed using
131 // following enumeration named EFI_USB_BUS_SPEED
133 EfiUsbMsgBusEventSpeed
136 typedef enum _EFI_USBFN_TRANSFER_STATUS
{
137 UsbTransferStatusUnknown
= 0,
138 UsbTransferStatusComplete
,
139 UsbTransferStatusAborted
,
140 UsbTransferStatusActive
,
141 UsbTransferStatusNone
142 } EFI_USBFN_TRANSFER_STATUS
;
144 typedef struct _EFI_USBFN_TRANSFER_RESULT
{
145 UINTN BytesTransferred
;
146 EFI_USBFN_TRANSFER_STATUS TransferStatus
;
148 EFI_USBFN_ENDPOINT_DIRECTION Direction
;
150 } EFI_USBFN_TRANSFER_RESULT
;
152 typedef enum _EFI_USB_BUS_SPEED
{
153 UsbBusSpeedUnknown
= 0,
158 UsbBusSpeedMaximum
= UsbBusSpeedSuper
161 typedef union _EFI_USBFN_MESSAGE_PAYLOAD
{
162 EFI_USB_DEVICE_REQUEST udr
;
163 EFI_USBFN_TRANSFER_RESULT utr
;
164 EFI_USB_BUS_SPEED ubs
;
165 } EFI_USBFN_MESSAGE_PAYLOAD
;
167 typedef enum _EFI_USBFN_POLICY_TYPE
{
168 EfiUsbPolicyUndefined
= 0,
169 EfiUsbPolicyMaxTransactionSize
,
170 EfiUsbPolicyZeroLengthTerminationSupport
,
171 EfiUsbPolicyZeroLengthTermination
172 } EFI_USBFN_POLICY_TYPE
;
175 Returns information about what USB port type was attached.
177 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
178 @param[out] PortType Returns the USB port type.
180 @retval EFI_SUCCESS The function returned successfully.
181 @retval EFI_INVALID_PARAMETER A parameter is invalid.
182 @retval EFI_DEVICE_ERROR The physical device reported an error.
183 @retval EFI_NOT_READY The physical device is busy or not ready to
184 process this request or there is no USB port
185 attached to the device.
190 (EFIAPI
*EFI_USBFN_IO_DETECT_PORT
) (
191 IN EFI_USBFN_IO_PROTOCOL
*This
,
192 OUT EFI_USBFN_PORT_TYPE
*PortType
196 Configures endpoints based on supplied device and configuration descriptors.
198 Assuming that the hardware has already been initialized, this function configures
199 the endpoints using the device information supplied by DeviceInfo, activates the
200 port, and starts receiving USB events.
202 This function must ignore the bMaxPacketSize0field of the Standard Device Descriptor
203 and the wMaxPacketSize field of the Standard Endpoint Descriptor that are made
204 available through DeviceInfo.
206 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
207 @param[out] DeviceInfo A pointer to EFI_USBFN_DEVICE_INFO instance.
209 @retval EFI_SUCCESS The function returned successfully.
210 @retval EFI_INVALID_PARAMETER A parameter is invalid.
211 @retval EFI_DEVICE_ERROR The physical device reported an error.
212 @retval EFI_NOT_READY The physical device is busy or not ready to process
214 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to lack of
220 (EFIAPI
*EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS
) (
221 IN EFI_USBFN_IO_PROTOCOL
*This
,
222 OUT EFI_USB_DEVICE_INFO
*DeviceInfo
226 Returns the maximum packet size of the specified endpoint type for the supplied
229 If the BusSpeed is UsbBusSpeedUnknown, the maximum speed the underlying controller
232 This protocol currently does not support isochronous or interrupt transfers. Future
233 revisions of this protocol may eventually support it.
235 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.
236 @param[in] EndpointType Endpoint type as defined as EFI_USB_ENDPOINT_TYPE.
237 @param[in] BusSpeed Bus speed as defined as EFI_USB_BUS_SPEED.
238 @param[out] MaxPacketSize The maximum packet size, in bytes, of the specified
241 @retval EFI_SUCCESS The function returned successfully.
242 @retval EFI_INVALID_PARAMETER A parameter is invalid.
243 @retval EFI_DEVICE_ERROR The physical device reported an error.
244 @retval EFI_NOT_READY The physical device is busy or not ready to process
250 (EFIAPI
*EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE
) (
251 IN EFI_USBFN_IO_PROTOCOL
*This
,
252 IN EFI_USB_ENDPOINT_TYPE EndpointType
,
253 IN EFI_USB_BUS_SPEED BusSpeed
,
254 OUT UINT16
*MaxPacketSize
258 Returns device specific information based on the supplied identifier as a Unicode string.
260 If the supplied Buffer isn't large enough, or is NULL, the method fails with
261 EFI_BUFFER_TOO_SMALL and the required size is returned through BufferSize. All returned
262 strings are in Unicode format.
264 An Id of EfiUsbDeviceInfoUnknown is treated as an invalid parameter.
266 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOLinstance.
267 @param[in] Id The requested information id.
270 @param[in] BufferSize On input, the size of the Buffer in bytes. On output, the
271 amount of data returned in Buffer in bytes.
272 @param[out] Buffer A pointer to a buffer to returnthe requested information
275 @retval EFI_SUCCESS The function returned successfully.
276 @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:
278 *BufferSize is not 0 and Buffer is NULL.
280 @retval EFI_DEVICE_ERROR The physical device reported an error.
281 @retval EFI_BUFFER_TOO_SMALL The buffer is too small to hold the buffer.
282 *BufferSize has been updated with the size needed to hold the request string.
287 (EFIAPI
*EFI_USBFN_IO_GET_DEVICE_INFO
) (
288 IN EFI_USBFN_IO_PROTOCOL
*This
,
289 IN EFI_USBFN_DEVICE_INFO_ID Id
,
290 IN OUT UINTN
*BufferSize
,
291 OUT VOID
*Buffer OPTIONAL
295 Returns the vendor-id and product-id of the device.
297 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
298 @param[out] Vid Returned vendor-id of the device.
299 @param[out] Pid Returned product-id of the device.
301 @retval EFI_SUCCESS The function returned successfully.
302 @retval EFI_INVALID_PARAMETER A parameter is invalid.
303 @retval EFI_NOT_FOUND Unable to return the vendor-id or the product-id.
308 (EFIAPI
*EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID
) (
309 IN EFI_USBFN_IO_PROTOCOL
*This
,
315 Aborts the transfer on the specified endpoint.
317 This function should fail with EFI_INVALID_PARAMETER if the specified direction
318 is incorrect for the endpoint.
320 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
321 @param[in] EndpointIndex Indicates the endpoint on which the ongoing transfer
322 needs to be canceled.
323 @param[in] Direction Direction of the endpoint.
325 @retval EFI_SUCCESS The function returned successfully.
326 @retval EFI_INVALID_PARAMETER A parameter is invalid.
327 @retval EFI_DEVICE_ERROR The physical device reported an error.
328 @retval EFI_NOT_READY The physical device is busy or not ready to process
334 (EFIAPI
*EFI_USBFN_IO_ABORT_TRANSFER
) (
335 IN EFI_USBFN_IO_PROTOCOL
*This
,
336 IN UINT8 EndpointIndex
,
337 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
341 Returns the stall state on the specified endpoint.
343 This function should fail with EFI_INVALID_PARAMETER if the specified direction
344 is incorrect for the endpoint.
346 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
347 @param[in] EndpointIndex Indicates the endpoint.
348 @param[in] Direction Direction of the endpoint.
349 @param[in, out] State Boolean, true value indicates that the endpoint
350 is in a stalled state, false otherwise.
352 @retval EFI_SUCCESS The function returned successfully.
353 @retval EFI_INVALID_PARAMETER A parameter is invalid.
354 @retval EFI_DEVICE_ERROR The physical device reported an error.
355 @retval EFI_NOT_READY The physical device is busy or not ready to process
361 (EFIAPI
*EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE
) (
362 IN EFI_USBFN_IO_PROTOCOL
*This
,
363 IN UINT8 EndpointIndex
,
364 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
,
365 IN OUT BOOLEAN
*State
369 Sets or clears the stall state on the specified endpoint.
371 This function should fail with EFI_INVALID_PARAMETER if the specified direction
372 is incorrect for the endpoint.
374 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
375 @param[in] EndpointIndex Indicates the endpoint.
376 @param[in] Direction Direction of the endpoint.
377 @param[in] State Requested stall state on the specified endpoint.
378 True value causes the endpoint to stall; false
379 value clears an existing stall.
381 @retval EFI_SUCCESS The function returned successfully.
382 @retval EFI_INVALID_PARAMETER A parameter is invalid.
383 @retval EFI_DEVICE_ERROR The physical device reported an error.
384 @retval EFI_NOT_READY The physical device is busy or not ready to process
390 (EFIAPI
*EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE
) (
391 IN EFI_USBFN_IO_PROTOCOL
*This
,
392 IN UINT8 EndpointIndex
,
393 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
,
394 IN OUT BOOLEAN
*State
398 This function is called repeatedly to get information on USB bus states,
399 receive-completion and transmit-completion events on the endpoints, and
400 notification on setup packet on endpoint 0.
402 A class driver must call EFI_USBFN_IO_PROTOCOL.EventHandler()repeatedly
403 to receive updates on the transfer status and number of bytes transferred
404 on various endpoints.
406 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
407 @param[out] Message Indicates the event that initiated this notification.
408 @param[in, out] PayloadSize On input, the size of the memory pointed by
409 Payload. On output, the amount ofdata returned
411 @param[out] Payload A pointer to EFI_USBFN_MESSAGE_PAYLOAD instance
412 to return additional payload for current message.
414 @retval EFI_SUCCESS The function returned successfully.
415 @retval EFI_INVALID_PARAMETER A parameter is invalid.
416 @retval EFI_DEVICE_ERROR The physical device reported an error.
417 @retval EFI_NOT_READY The physical device is busy or not ready to process
419 @retval EFI_BUFFER_TOO_SMALL The Supplied buffer is not large enough to hold
425 (EFIAPI
*EFI_USBFN_IO_EVENTHANDLER
) (
426 IN EFI_USBFN_IO_PROTOCOL
*This
,
427 OUT EFI_USBFN_MESSAGE
*Message
,
428 IN OUT UINTN
*PayloadSize
,
429 OUT EFI_USBFN_MESSAGE_PAYLOAD
*Payload
433 This function handles transferring data to or from the host on the specified
434 endpoint, depending on the direction specified.
436 A class driver must call EFI_USBFN_IO_PROTOCOL.EventHandler() repeatedly to
437 receive updates on the transfer status and the number of bytes transferred on
438 various endpoints. Upon an update of the transfer status, the Buffer field of
439 the EFI_USBFN_TRANSFER_RESULT structure (as described in the function description
440 for EFI_USBFN_IO_PROTOCOL.EventHandler()) must be initialized with the Buffer
441 pointer that was supplied to this method.
443 The overview of the call sequence is illustrated in the Figure 54.
445 This function should fail with EFI_INVALID_PARAMETER if the specified direction
446 is incorrect for the endpoint.
448 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
449 @param[in] EndpointIndex Indicates the endpoint on which TX or RX transfer
451 @param[in] Direction Direction of the endpoint.
452 @param[in, out] BufferSize If Direction is EfiUsbEndpointDirectionDeviceRx:
453 On input, the size of the Bufferin bytes.
454 On output, the amount of data returned in Buffer
456 If Direction is EfiUsbEndpointDirectionDeviceTx:
457 On input, the size of the Bufferin bytes.
458 On output, the amount of data transmitted in bytes.
459 @param[in, out] Buffer If Direction is EfiUsbEndpointDirectionDeviceRx:
460 The Buffer to return the received data.
461 If Directionis EfiUsbEndpointDirectionDeviceTx:
462 The Buffer that contains the data to be transmitted.
464 @retval EFI_SUCCESS The function returned successfully.
465 @retval EFI_INVALID_PARAMETER A parameter is invalid.
466 @retval EFI_DEVICE_ERROR The physical device reported an error.
467 @retval EFI_NOT_READY The physical device is busy or not ready to process
473 (EFIAPI
*EFI_USBFN_IO_TRANSFER
) (
474 IN EFI_USBFN_IO_PROTOCOL
*This
,
475 IN UINT8 EndpointIndex
,
476 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
,
477 IN OUT UINTN
*BufferSize
,
482 Returns the maximum supported transfer size.
484 Returns the maximum number of bytes that the underlying controller can accommodate
485 in a single transfer.
487 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
488 @param[out] MaxTransferSize The maximum supported transfer size, in bytes.
490 @retval EFI_SUCCESS The function returned successfully.
491 @retval EFI_INVALID_PARAMETER A parameter is invalid.
492 @retval EFI_DEVICE_ERROR The physical device reported an error.
493 @retval EFI_NOT_READY The physical device is busy or not ready to process
499 (EFIAPI
*EFI_USBFN_IO_GET_MAXTRANSFER_SIZE
) (
500 IN EFI_USBFN_IO_PROTOCOL
*This
,
501 OUT UINTN
*MaxTransferSize
505 Allocates a transfer buffer of the specified sizethat satisfies the controller
508 The AllocateTransferBuffer() function allocates a memory region of Size bytes and
509 returns the address of the allocated memory that satisfies the underlying controller
510 requirements in the location referenced by Buffer.
512 The allocated transfer buffer must be freed using a matching call to
513 EFI_USBFN_IO_PROTOCOL.FreeTransferBuffer()function.
515 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
516 @param[in] Size The number of bytes to allocate for the transfer buffer.
517 @param[out] Buffer A pointer to a pointer to the allocated buffer if the
518 call succeeds; undefined otherwise.
520 @retval EFI_SUCCESS The function returned successfully.
521 @retval EFI_INVALID_PARAMETER A parameter is invalid.
522 @retval EFI_OUT_OF_RESOURCES The requested transfer buffer could not be allocated.
527 (EFIAPI
*EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER
) (
528 IN EFI_USBFN_IO_PROTOCOL
*This
,
534 Deallocates the memory allocated for the transfer buffer by the
535 EFI_USBFN_IO_PROTOCOL.AllocateTransferBuffer() function.
537 The EFI_USBFN_IO_PROTOCOL.FreeTransferBuffer() function deallocates the
538 memory specified by Buffer. The Buffer that is freed must have been allocated
539 by EFI_USBFN_IO_PROTOCOL.AllocateTransferBuffer().
541 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
542 @param[in] Buffer A pointer to the transfer buffer to deallocate.
544 @retval EFI_SUCCESS The function returned successfully.
545 @retval EFI_INVALID_PARAMETER A parameter is invalid.
550 (EFIAPI
*EFI_USBFN_IO_FREE_TRANSFER_BUFFER
) (
551 IN EFI_USBFN_IO_PROTOCOL
*This
,
556 This function supplies power to the USB controller if needed and initializes
557 the hardware and the internal data structures. The port must not be activated
560 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
562 @retval EFI_SUCCESS The function returned successfully.
563 @retval EFI_INVALID_PARAMETER A parameter is invalid.
564 @retval EFI_DEVICE_ERROR The physical device reported an error.
569 (EFIAPI
*EFI_USBFN_IO_START_CONTROLLER
) (
570 IN EFI_USBFN_IO_PROTOCOL
*This
574 This function stops the USB hardware device.
576 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
578 @retval EFI_SUCCESS The function returned successfully.
579 @retval EFI_INVALID_PARAMETER A parameter is invalid.
580 @retval EFI_DEVICE_ERROR The physical device reported an error.
585 (EFIAPI
*EFI_USBFN_IO_STOP_CONTROLLER
) (
586 IN EFI_USBFN_IO_PROTOCOL
*This
590 This function sets the configuration policy for the specified non-control
593 This function can only be called before EFI_USBFN_IO_PROTOCOL.StartController()
594 or after EFI_USBFN_IO_PROTOCOL.StopController() has been called.
596 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
597 @param[in] EndpointIndex Indicates the non-control endpoint for which the
598 policy needs to be set.
599 @param[in] Direction Direction of the endpoint.
600 @param[in] PolicyType Policy type the user is trying to set for the
601 specified non-control endpoint.
602 @param[in] BufferSize The size of the Bufferin bytes.
603 @param[in] Buffer The new value for the policy parameter that
604 PolicyType specifies.
606 @retval EFI_SUCCESS The function returned successfully.
607 @retval EFI_INVALID_PARAMETER A parameter is invalid.
608 @retval EFI_DEVICE_ERROR The physical device reported an error.
609 @retval EFI_UNSUPPORTED Changing this policy value is not supported.
614 (EFIAPI
*EFI_USBFN_IO_SET_ENDPOINT_POLICY
) (
615 IN EFI_USBFN_IO_PROTOCOL
*This
,
616 IN UINT8 EndpointIndex
,
617 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
,
618 IN EFI_USBFN_POLICY_TYPE PolicyType
,
624 This function sets the configuration policy for the specified non-control
627 This function can only be called before EFI_USBFN_IO_PROTOCOL.StartController()
628 or after EFI_USBFN_IO_PROTOCOL.StopController() has been called.
630 @param[in] This A pointer to the EFI_USBFN_IO_PROTOCOL instance.
631 @param[in] EndpointIndex Indicates the non-control endpoint for which the
632 policy needs to be set.
633 @param[in] Direction Direction of the endpoint.
634 @param[in] PolicyType Policy type the user is trying to retrieve for
635 the specified non-control endpoint.
636 @param[in, out] BufferSize On input, the size of Bufferin bytes. On output,
637 the amount of data returned in Bufferin bytes.
638 @param[in, out] Buffer A pointer to a buffer to return requested endpoint
641 @retval EFI_SUCCESS The function returned successfully.
642 @retval EFI_INVALID_PARAMETER A parameter is invalid.
643 @retval EFI_DEVICE_ERROR The specified policy value is not supported.
644 @retval EFI_BUFFER_TOO_SMALL Supplied buffer is not large enough to hold requested
650 (EFIAPI
*EFI_USBFN_IO_GET_ENDPOINT_POLICY
) (
651 IN EFI_USBFN_IO_PROTOCOL
*This
,
652 IN UINT8 EndpointIndex
,
653 IN EFI_USBFN_ENDPOINT_DIRECTION Direction
,
654 IN EFI_USBFN_POLICY_TYPE PolicyType
,
655 IN OUT UINTN
*BufferSize
,
660 /// The EFI_USBFN_IO_PROTOCOL provides basic data transactions and basic USB
661 /// controller management for a USB Function port.
663 struct _EFI_USBFN_IO_PROTOCOL
{
665 EFI_USBFN_IO_DETECT_PORT DetectPort
;
666 EFI_USBFN_IO_CONFIGURE_ENABLE_ENDPOINTS ConfigureEnableEndpoints
;
667 EFI_USBFN_IO_GET_ENDPOINT_MAXPACKET_SIZE GetEndpointMaxPacketSize
;
668 EFI_USBFN_IO_GET_DEVICE_INFO GetDeviceInfo
;
669 EFI_USBFN_IO_GET_VENDOR_ID_PRODUCT_ID GetVendorIdProductId
;
670 EFI_USBFN_IO_ABORT_TRANSFER AbortTransfer
;
671 EFI_USBFN_IO_GET_ENDPOINT_STALL_STATE GetEndpointStallState
;
672 EFI_USBFN_IO_SET_ENDPOINT_STALL_STATE SetEndpointStallState
;
673 EFI_USBFN_IO_EVENTHANDLER EventHandler
;
674 EFI_USBFN_IO_TRANSFER Transfer
;
675 EFI_USBFN_IO_GET_MAXTRANSFER_SIZE GetMaxTransferSize
;
676 EFI_USBFN_IO_ALLOCATE_TRANSFER_BUFFER AllocateTransferBuffer
;
677 EFI_USBFN_IO_FREE_TRANSFER_BUFFER FreeTransferBuffer
;
678 EFI_USBFN_IO_START_CONTROLLER StartController
;
679 EFI_USBFN_IO_STOP_CONTROLLER StopController
;
680 EFI_USBFN_IO_SET_ENDPOINT_POLICY SetEndpointPolicy
;
681 EFI_USBFN_IO_GET_ENDPOINT_POLICY GetEndpointPolicy
;
684 extern EFI_GUID gEfiUsbFunctionIoProtocolGuid
;