]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Ppi/UsbIo.h
MdeModulePkg: Clean up source files
[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
11This program and the accompanying materials\r
12are licensed and made available under the terms and conditions\r
13of the BSD License which accompanies this distribution. The\r
14full text of the license may be found at\r
15http://opensource.org/licenses/bsd-license.php\r
16\r
17THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
18WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
19\r
20**/\r
21\r
22#ifndef _PEI_USB_IO_PPI_H_\r
23#define _PEI_USB_IO_PPI_H_\r
24\r
25#include <Protocol/Usb2HostController.h>\r
26\r
27///\r
28/// Global ID for the PEI_USB_IO_PPI.\r
29///\r
30#define PEI_USB_IO_PPI_GUID \\r
31 { \\r
32 0x7c29785c, 0x66b9, 0x49fc, { 0xb7, 0x97, 0x1c, 0xa5, 0x55, 0xe, 0xf2, 0x83} \\r
33 }\r
34\r
35///\r
36/// Forward declaration for the PEI_USB_IO_PPI.\r
37///\r
38typedef struct _PEI_USB_IO_PPI PEI_USB_IO_PPI;\r
39\r
40/**\r
41 Submits control transfer to a target USB device.\r
42\r
43 @param[in] PeiServices The pointer to the PEI Services Table.\r
44 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
d1102dba 45 @param[in] Request A pointer to the USB device request that will be\r
4b1bf81c 46 sent to the USB device.\r
d1102dba
LG
47 @param[in] Direction Specifies the data direction for the transfer. There\r
48 are three values available:\r
4b1bf81c 49 EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
d1102dba 50 @param[in] Timeout Indicates the maximum time, in milliseconds, that\r
4b1bf81c 51 the transfer is allowed to complete.\r
ca243131
FT
52 If Timeout is 0, then the caller must wait for the\r
53 function to be completed until EFI_SUCCESS or\r
54 EFI_DEVICE_ERROR is returned.\r
d1102dba 55 @param[in,out] Data A pointer to the buffer of data that will be\r
4b1bf81c 56 transmitted to or received from the USB device.\r
d1102dba 57 @param[in] DataLength On input, indicates the size, in bytes, of the data\r
4b1bf81c 58 buffer specified by Data.\r
d1102dba 59\r
4b1bf81c 60 @retval EFI_SUCCESS The control transfer was completed successfully.\r
61 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 62 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due\r
4b1bf81c 63 to a lack of resources.\r
64 @retval EFI_TIMEOUT The control transfer failed due to timeout.\r
d1102dba 65 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller\r
4b1bf81c 66 or device error.\r
d1102dba 67 Caller should check TransferResult for detailed\r
4b1bf81c 68 error information.\r
69\r
70**/\r
71typedef\r
72EFI_STATUS\r
73(EFIAPI *PEI_USB_CONTROL_TRANSFER)(\r
74 IN EFI_PEI_SERVICES **PeiServices,\r
75 IN PEI_USB_IO_PPI *This,\r
76 IN EFI_USB_DEVICE_REQUEST *Request,\r
77 IN EFI_USB_DATA_DIRECTION Direction,\r
78 IN UINT32 Timeout,\r
79 IN OUT VOID *Data OPTIONAL,\r
80 IN UINTN DataLength OPTIONAL\r
81 );\r
82\r
83/**\r
84 Submits bulk transfer to a target USB device.\r
85\r
86 @param[in] PeiServices The pointer to the PEI Services Table.\r
87 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
ca243131 88 @param[in] DeviceEndpoint The endpoint address.\r
4b1bf81c 89 @param[in] Data The data buffer to be transfered.\r
90 @param[in] DataLength The length of data buffer.\r
ca243131
FT
91 @param[in] Timeout The timeout for the transfer, in milliseconds.\r
92 If Timeout is 0, then the caller must wait for the\r
93 function to be completed until EFI_SUCCESS or\r
94 EFI_DEVICE_ERROR is returned.\r
4b1bf81c 95\r
96 @retval EFI_SUCCESS The bulk transfer completed successfully.\r
97 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 98 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be completed due to\r
4b1bf81c 99 a lack of resources.\r
100 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
d1102dba 101 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller\r
4b1bf81c 102 or device error.\r
d1102dba 103 Caller should check TransferResult for detailed\r
4b1bf81c 104 error information.\r
105\r
106**/\r
107typedef\r
108EFI_STATUS\r
109(EFIAPI *PEI_USB_BULK_TRANSFER)(\r
110 IN EFI_PEI_SERVICES **PeiServices,\r
111 IN PEI_USB_IO_PPI *This,\r
112 IN UINT8 DeviceEndpoint,\r
113 IN OUT VOID *Data,\r
114 IN OUT UINTN *DataLength,\r
115 IN UINTN Timeout\r
116 );\r
117\r
118/**\r
119 Get interface descriptor from a USB device.\r
120\r
121 @param[in] PeiServices The pointer to the PEI Services Table.\r
122 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
123 @param[in] InterfaceDescriptor The interface descriptor.\r
124\r
125 @retval EFI_SUCCESS The interface descriptor was returned.\r
126 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 127 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to\r
4b1bf81c 128 get the interface descriptor.\r
129\r
130**/\r
131typedef\r
132EFI_STATUS\r
133(EFIAPI *PEI_USB_GET_INTERFACE_DESCRIPTOR)(\r
134 IN EFI_PEI_SERVICES **PeiServices,\r
135 IN PEI_USB_IO_PPI *This,\r
136 IN EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor\r
137 );\r
138\r
139/**\r
140 Get endpoint descriptor from a USB device.\r
141\r
142 @param[in] PeiServices The pointer to the PEI Services Table.\r
143 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
144 @param[in] EndPointIndex The index of the end point.\r
145 @param[in] EndpointDescriptor The endpoint descriptor.\r
146\r
147 @retval EFI_SUCCESS The endpoint descriptor was returned.\r
148 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
d1102dba 149 @retval EFI_DEVICE_ERROR A device error occurred, the function failed to\r
4b1bf81c 150 get the endpoint descriptor.\r
151\r
152**/\r
153typedef\r
154EFI_STATUS\r
155(EFIAPI *PEI_USB_GET_ENDPOINT_DESCRIPTOR)(\r
156 IN EFI_PEI_SERVICES **PeiServices,\r
157 IN PEI_USB_IO_PPI *This,\r
158 IN UINT8 EndpointIndex,\r
159 IN EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor\r
160 );\r
161\r
162/**\r
163 Issue a port reset to the device.\r
164\r
165 @param[in] PeiServices The pointer to the PEI Services Table.\r
166 @param[in] This The pointer to this instance of the PEI_USB_IO_PPI.\r
167\r
168 @retval EFI_SUCCESS The port reset was issued successfully.\r
169 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
170 @retval EFI_DEVICE_ERROR Device error occurred.\r
171\r
172**/\r
173typedef\r
174EFI_STATUS\r
175(EFIAPI *PEI_USB_PORT_RESET)(\r
176 IN EFI_PEI_SERVICES **PeiServices,\r
177 IN PEI_USB_IO_PPI *This\r
178 );\r
179\r
180///\r
181/// This PPI contains a set of services to interact with the USB host controller.\r
182/// These interfaces are modeled on the UEFI 2.3 specification EFI_USB_IO_PROTOCOL.\r
d1102dba 183/// Refer to section 16.2.4 of the UEFI 2.3 Specification for more information on\r
4b1bf81c 184/// these interfaces.\r
185///\r
186struct _PEI_USB_IO_PPI {\r
187 PEI_USB_CONTROL_TRANSFER UsbControlTransfer;\r
188 PEI_USB_BULK_TRANSFER UsbBulkTransfer;\r
189 PEI_USB_GET_INTERFACE_DESCRIPTOR UsbGetInterfaceDescriptor;\r
190 PEI_USB_GET_ENDPOINT_DESCRIPTOR UsbGetEndpointDescriptor;\r
191 PEI_USB_PORT_RESET UsbPortReset;\r
192};\r
193\r
194extern EFI_GUID gPeiUsbIoPpiGuid;\r
195\r
196#endif\r