]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Ppi/UsbIo.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / UsbIo.h
CommitLineData
4b1bf81c 1/** @file\r
d1102dba
LG
2 Defines the PEI_USB_IO_PPI that the USB-related PEIM can use for I/O operations\r
3 on the USB BUS. This interface enables recovery from a\r
4 USB-class storage device, such as USB CD/DVD, USB hard drive, or USB FLASH\r
4b1bf81c 5 drive. These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.\r
d1102dba 6 Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on\r
4b1bf81c 7 these interfaces.\r
8\r
d1102dba 9Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
4b1bf81c 10\r
9d510e61 11SPDX-License-Identifier: BSD-2-Clause-Patent\r
4b1bf81c 12\r
13**/\r
14\r
15#ifndef _PEI_USB_IO_PPI_H_\r
16#define _PEI_USB_IO_PPI_H_\r
17\r
18#include <Protocol/Usb2HostController.h>\r
19\r
20///\r
21/// Global ID for the PEI_USB_IO_PPI.\r
22///\r
23#define PEI_USB_IO_PPI_GUID \\r
24 { \\r
25 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \\r
26 }\r
27\r
28///\r
29/// Forward declaration for the PEI_USB_IO_PPI.\r
30///\r
1436aea4 31typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI;\r
4b1bf81c 32\r
33/**\r
34 Submits control transfer to a target USB device.\r
35\r
36 @param[in] PeiServices The pointer to the PEI Services Table.\r
37 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
d1102dba 38 @param[in] Request A pointer to the USB device request that will be\r
4b1bf81c 39 sent to the USB device.\r
d1102dba
LG
40 @param[in] Direction Specifies the data direction for the transfer. There\r
41 are three values available:\r
4b1bf81c 42 EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
d1102dba 43 @param[in] Timeout Indicates the maximum time, in milliseconds, that\r
4b1bf81c 44 the transfer is allowed to complete.\r
ca243131
FT
45 If Timeout is 0, then the caller must wait for the\r
46 function to be completed until EFI_SUCCESS or\r
47 EFI_DEVICE_ERROR is returned.\r
d1102dba 48 @param[in,out] Data A pointer to the buffer of data that will be\r
4b1bf81c 49 transmitted to or received from the USB device.\r
d1102dba 50 @param[in] DataLength On input, indicates the size, in bytes, of the data\r
4b1bf81c 51 buffer specified by Data.\r
d1102dba 52\r
4b1bf81c 53 @retval EFI_SUCCESS The control transfer was completed successfully.\r
54 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 55 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due\r
4b1bf81c 56 to a lack of resources.\r
57 @retval EFI_TIMEOUT The control transfer failed due to timeout.\r
d1102dba 58 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller\r
4b1bf81c 59 or device error.\r
d1102dba 60 Caller should check TransferResult for detailed\r
4b1bf81c 61 error information.\r
62\r
63**/\r
64typedef\r
65EFI_STATUS\r
66(EFIAPI *PEI_USB_CONTROL_TRANSFER)(\r
67 IN EFI_PEI_SERVICES **PeiServices,\r
68 IN PEI_USB_IO_PPI *This,\r
69 IN EFI_USB_DEVICE_REQUEST *Request,\r
70 IN EFI_USB_DATA_DIRECTION Direction,\r
71 IN UINT32 Timeout,\r
72 IN OUT VOID *Data OPTIONAL,\r
73 IN UINTN DataLength OPTIONAL\r
74 );\r
75\r
76/**\r
77 Submits bulk transfer to a target USB device.\r
78\r
79 @param[in] PeiServices The pointer to the PEI Services Table.\r
80 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
ca243131 81 @param[in] DeviceEndpoint The endpoint address.\r
4b1bf81c 82 @param[in] Data The data buffer to be transfered.\r
83 @param[in] DataLength The length of data buffer.\r
ca243131
FT
84 @param[in] Timeout The timeout for the transfer, in milliseconds.\r
85 If Timeout is 0, then the caller must wait for the\r
86 function to be completed until EFI_SUCCESS or\r
87 EFI_DEVICE_ERROR is returned.\r
4b1bf81c 88\r
89 @retval EFI_SUCCESS The bulk transfer completed successfully.\r
90 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 91 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to\r
4b1bf81c 92 a lack of resources.\r
93 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
d1102dba 94 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller\r
4b1bf81c 95 or device error.\r
d1102dba 96 Caller should check TransferResult for detailed\r
4b1bf81c 97 error information.\r
98\r
99**/\r
100typedef\r
101EFI_STATUS\r
102(EFIAPI *PEI_USB_BULK_TRANSFER)(\r
103 IN EFI_PEI_SERVICES **PeiServices,\r
104 IN PEI_USB_IO_PPI *This,\r
105 IN UINT8 DeviceEndpoint,\r
106 IN OUT VOID *Data,\r
107 IN OUT UINTN *DataLength,\r
108 IN UINTN Timeout\r
109 );\r
110\r
111/**\r
112 Get interface descriptor from a USB device.\r
113\r
114 @param[in] PeiServices The pointer to the PEI Services Table.\r
115 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
116 @param[in] InterfaceDescriptor The interface descriptor.\r
117\r
118 @retval EFI_SUCCESS The interface descriptor was returned.\r
119 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 120 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to\r
4b1bf81c 121 get the interface descriptor.\r
122\r
123**/\r
124typedef\r
125EFI_STATUS\r
126(EFIAPI *PEI_USB_GET_INTERFACE_DESCRIPTOR)(\r
127 IN EFI_PEI_SERVICES **PeiServices,\r
128 IN PEI_USB_IO_PPI *This,\r
129 IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor\r
130 );\r
131\r
132/**\r
133 Get endpoint descriptor from a USB device.\r
134\r
135 @param[in] PeiServices The pointer to the PEI Services Table.\r
136 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
137 @param[in] EndPointIndex The index of the end point.\r
138 @param[in] EndpointDescriptor The endpoint descriptor.\r
139\r
140 @retval EFI_SUCCESS The endpoint descriptor was returned.\r
141 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 142 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to\r
4b1bf81c 143 get the endpoint descriptor.\r
144\r
145**/\r
146typedef\r
147EFI_STATUS\r
148(EFIAPI *PEI_USB_GET_ENDPOINT_DESCRIPTOR)(\r
149 IN EFI_PEI_SERVICES **PeiServices,\r
150 IN PEI_USB_IO_PPI *This,\r
151 IN UINT8 EndpointIndex,\r
152 IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor\r
153 );\r
154\r
155/**\r
156 Issue a port reset to the device.\r
157\r
158 @param[in] PeiServices The pointer to the PEI Services Table.\r
159 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
160\r
161 @retval EFI_SUCCESS The port reset was issued successfully.\r
162 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
163 @retval EFI_DEVICE_ERROR Device error occurred.\r
164\r
165**/\r
166typedef\r
167EFI_STATUS\r
168(EFIAPI *PEI_USB_PORT_RESET)(\r
169 IN EFI_PEI_SERVICES **PeiServices,\r
170 IN PEI_USB_IO_PPI *This\r
171 );\r
172\r
173///\r
174/// This PPI contains a set of services to interact with the USB host controller.\r
175/// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.\r
d1102dba 176/// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on\r
4b1bf81c 177/// these interfaces.\r
178///\r
179struct _PEI_USB_IO_PPI {\r
1436aea4
MK
180 PEI_USB_CONTROL_TRANSFER UsbControlTransfer;\r
181 PEI_USB_BULK_TRANSFER UsbBulkTransfer;\r
182 PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;\r
183 PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;\r
184 PEI_USB_PORT_RESET UsbPortReset;\r
4b1bf81c 185};\r
186\r
1436aea4 187extern EFI_GUID gPeiUsbIoPpiGuid;\r
4b1bf81c 188\r
189#endif\r