2 Defines the PEI_USB_IO_PPI that the USB-related PEIM can use for I/O operations
3 on the USB BUS. This interface enables recovery from a
4 USB-class storage device, such as USB CD/DVD, USB hard drive, or USB FLASH
5 drive. These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
6 Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
9 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
11 SPDX-License-Identifier: BSD-2-Clause-Patent
15 #ifndef _PEI_USB_IO_PPI_H_
16 #define _PEI_USB_IO_PPI_H_
18 #include <Protocol/Usb2HostController.h>
21 /// Global ID for the PEI_USB_IO_PPI.
23 #define PEI_USB_IO_PPI_GUID \
25 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \
29 /// Forward declaration for the PEI_USB_IO_PPI.
31 typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI
;
34 Submits control transfer to a target USB device.
36 @param[in] PeiServices The pointer to the PEI Services Table.
37 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
38 @param[in] Request A pointer to the USB device request that will be
39 sent to the USB device.
40 @param[in] Direction Specifies the data direction for the transfer. There
41 are three values available:
42 EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.
43 @param[in] Timeout Indicates the maximum time, in milliseconds, that
44 the transfer is allowed to complete.
45 If Timeout is 0, then the caller must wait for the
46 function to be completed until EFI_SUCCESS or
47 EFI_DEVICE_ERROR is returned.
48 @param[in,out] Data A pointer to the buffer of data that will be
49 transmitted to or received from the USB device.
50 @param[in] DataLength On input, indicates the size, in bytes, of the data
51 buffer specified by Data.
53 @retval EFI_SUCCESS The control transfer was completed successfully.
54 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
55 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due
56 to a lack of resources.
57 @retval EFI_TIMEOUT The control transfer failed due to timeout.
58 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller
60 Caller should check TransferResult for detailed
66 (EFIAPI
*PEI_USB_CONTROL_TRANSFER
)(
67 IN EFI_PEI_SERVICES
**PeiServices
,
68 IN PEI_USB_IO_PPI
*This
,
69 IN EFI_USB_DEVICE_REQUEST
*Request
,
70 IN EFI_USB_DATA_DIRECTION Direction
,
72 IN OUT VOID
*Data OPTIONAL
,
73 IN UINTN DataLength OPTIONAL
77 Submits bulk transfer to a target USB device.
79 @param[in] PeiServices The pointer to the PEI Services Table.
80 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
81 @param[in] DeviceEndpoint The endpoint address.
82 @param[in] Data The data buffer to be transfered.
83 @param[in] DataLength The length of data buffer.
84 @param[in] Timeout The timeout for the transfer, in milliseconds.
85 If Timeout is 0, then the caller must wait for the
86 function to be completed until EFI_SUCCESS or
87 EFI_DEVICE_ERROR is returned.
89 @retval EFI_SUCCESS The bulk transfer completed successfully.
90 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
91 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to
93 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.
94 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller
96 Caller should check TransferResult for detailed
102 (EFIAPI
*PEI_USB_BULK_TRANSFER
)(
103 IN EFI_PEI_SERVICES
**PeiServices
,
104 IN PEI_USB_IO_PPI
*This
,
105 IN UINT8 DeviceEndpoint
,
107 IN OUT UINTN
*DataLength
,
112 Get interface descriptor from a USB device.
114 @param[in] PeiServices The pointer to the PEI Services Table.
115 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
116 @param[in] InterfaceDescriptor The interface descriptor.
118 @retval EFI_SUCCESS The interface descriptor was returned.
119 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
120 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
121 get the interface descriptor.
126 (EFIAPI
*PEI_USB_GET_INTERFACE_DESCRIPTOR
)(
127 IN EFI_PEI_SERVICES
**PeiServices
,
128 IN PEI_USB_IO_PPI
*This
,
129 IN EFI_USB_INTERFACE_DESCRIPTOR
**InterfaceDescriptor
133 Get endpoint descriptor from a USB device.
135 @param[in] PeiServices The pointer to the PEI Services Table.
136 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
137 @param[in] EndPointIndex The index of the end point.
138 @param[in] EndpointDescriptor The endpoint descriptor.
140 @retval EFI_SUCCESS The endpoint descriptor was returned.
141 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
142 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to
143 get the endpoint descriptor.
148 (EFIAPI
*PEI_USB_GET_ENDPOINT_DESCRIPTOR
)(
149 IN EFI_PEI_SERVICES
**PeiServices
,
150 IN PEI_USB_IO_PPI
*This
,
151 IN UINT8 EndpointIndex
,
152 IN EFI_USB_ENDPOINT_DESCRIPTOR
**EndpointDescriptor
156 Issue a port reset to the device.
158 @param[in] PeiServices The pointer to the PEI Services Table.
159 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.
161 @retval EFI_SUCCESS The port reset was issued successfully.
162 @retval EFI_INVALID_PARAMETER Some parameters are invalid.
163 @retval EFI_DEVICE_ERROR Device error occurred.
168 (EFIAPI
*PEI_USB_PORT_RESET
)(
169 IN EFI_PEI_SERVICES
**PeiServices
,
170 IN PEI_USB_IO_PPI
*This
174 /// This PPI contains a set of services to interact with the USB host controller.
175 /// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.
176 /// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on
177 /// these interfaces.
179 struct _PEI_USB_IO_PPI
{
180 PEI_USB_CONTROL_TRANSFER UsbControlTransfer
;
181 PEI_USB_BULK_TRANSFER UsbBulkTransfer
;
182 PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor
;
183 PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor
;
184 PEI_USB_PORT_RESET UsbPortReset
;
187 extern EFI_GUID gPeiUsbIoPpiGuid
;