]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Ppi/Usb2HostController.h
MdeModulePkg Variable: Make sure no more than one Variable HOB
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / Usb2HostController.h
CommitLineData
4b1bf81c 1/** @file\r
d1102dba
LG
2 Defines the USB Host Controller PPI that provides I/O services for a USB Host\r
3 Controller that may be used to access recovery devices. These interfaces are\r
4b1bf81c 4 modeled on the UEFI 2.3 specification EFI_USB2_HOST_CONTROLLER_PROTOCOL.\r
d1102dba 5 Refer to section 16.1 of the UEFI 2.3 Specification for more information on\r
4b1bf81c 6 these interfaces.\r
d1102dba
LG
7\r
8Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved. <BR>\r
4b1bf81c 9\r
10This program and the accompanying materials\r
11are licensed and made available under the terms and conditions\r
12of the BSD License which accompanies this distribution. The\r
13full text of the license may be found at\r
14http://opensource.org/licenses/bsd-license.php\r
15\r
16THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
17WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
18\r
19**/\r
20\r
21#ifndef _PEI_USB2_HOST_CONTROLLER_PPI_H_\r
22#define _PEI_USB2_HOST_CONTROLLER_PPI_H_\r
23\r
24#include <Protocol/Usb2HostController.h>\r
25\r
26///\r
27/// Global ID for the PEI_USB2_HOST_CONTROLLER_PPI.\r
28///\r
29#define PEI_USB2_HOST_CONTROLLER_PPI_GUID \\r
30 { \\r
31 0xa7d09fe1, 0x74d4, 0x4ba5, { 0x84, 0x7c, 0x12, 0xed, 0x5b, 0x19, 0xad, 0xe4 } \\r
32 }\r
33\r
34///\r
35/// Forward declaration for the PEI_USB2_HOST_CONTROLLER_PPI.\r
36///\r
37typedef struct _PEI_USB2_HOST_CONTROLLER_PPI PEI_USB2_HOST_CONTROLLER_PPI;\r
38\r
39/**\r
d1102dba 40 Initiate a USB control transfer using a specific USB Host controller on the USB bus.\r
4b1bf81c 41\r
42 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 43 @param[in] This The pointer to this instance of the\r
4b1bf81c 44 PEI_USB2_HOST_CONTROLLER_PPI.\r
d1102dba 45 @param[in] DeviceAddress Represents the address of the target device\r
4b1bf81c 46 on the USB.\r
47 @param[in] DeviceSpeed Indicates device speed.\r
d1102dba 48 @param[in] MaximumPacketLength Indicates the maximum packet size that the\r
4b1bf81c 49 default control transfer\r
50 endpoint is capable of sending or receiving.\r
d1102dba 51 @param[in] Request A pointer to the USB device request that\r
4b1bf81c 52 will be sent to the USB device.\r
d1102dba
LG
53 @param[in] TransferDirection Specifies the data direction for the transfer.\r
54 There are three values available:\r
4b1bf81c 55 EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
d1102dba 56 @param[in,out] Data A pointer to the buffer of data that will\r
4b1bf81c 57 be transmitted to USB device or\r
58 received from USB device.\r
d1102dba 59 @param[in,out] DataLength On input, indicates the size, in bytes, of\r
4b1bf81c 60 the data buffer specified by Data.\r
d1102dba 61 On output, indicates the amount of data\r
4b1bf81c 62 actually transferred.\r
d1102dba 63 @param[in] TimeOut Indicates the maximum time, in milliseconds,\r
4b1bf81c 64 that the transfer is allowed to complete.\r
ca243131
FT
65 If Timeout is 0, then the caller must wait for\r
66 the function to be completed until EFI_SUCCESS\r
67 or EFI_DEVICE_ERROR is returned.\r
4b1bf81c 68 @param[in] Translator A pointer to the transaction translator data.\r
d1102dba 69 @param[out] TransferResult A pointer to the detailed result information\r
4b1bf81c 70 generated by this control transfer.\r
71\r
72 @retval EFI_SUCCESS The control transfer was completed successfully.\r
d1102dba 73 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller\r
4b1bf81c 74 or device error.\r
75 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
76 @retval EFI_OUT_OF_RESOURCES The control transfer could not be completed due to a lack of resources.\r
77 @retval EFI_TIMEOUT The control transfer failed due to timeout.\r
d1102dba 78\r
4b1bf81c 79\r
80**/\r
81typedef\r
82EFI_STATUS\r
83(EFIAPI *PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER)(\r
84 IN EFI_PEI_SERVICES **PeiServices,\r
85 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
86 IN UINT8 DeviceAddress,\r
87 IN UINT8 DeviceSpeed,\r
88 IN UINTN MaximumPacketLength,\r
89 IN USB_DEVICE_REQUEST *Request,\r
90 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
91 IN OUT VOID *Data OPTIONAL,\r
92 IN OUT UINTN *DataLength OPTIONAL,\r
93 IN UINTN TimeOut,\r
94 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
95 OUT UINT32 *TransferResult\r
96 );\r
97\r
98/**\r
d1102dba 99 Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.\r
4b1bf81c 100\r
101 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 102 @param[in] This The pointer to this instance of the\r
4b1bf81c 103 PEI_USB2_HOST_CONTROLLER_PPI.\r
d1102dba 104 @param[in] DeviceAddress Represents the address of the target device\r
4b1bf81c 105 on the USB.\r
d1102dba 106 @param[in] EndPointAddress The combination of an endpoint number and\r
4b1bf81c 107 an endpoint direction of the target USB device.\r
108 @param[in] DeviceSpeed Indicates device speed.\r
d1102dba 109 @param[in] MaximumPacketLength Indicates the maximum packet size the target\r
4b1bf81c 110 endpoint is capable of sending or receiving.\r
d1102dba
LG
111 @param[in,out] Data Array of pointers to the buffers of data\r
112 that will be transmitted to USB device or\r
4b1bf81c 113 received from USB device.\r
d1102dba 114 @param[in,out] DataLength When input, indicates the size, in bytes, of\r
4b1bf81c 115 the data buffers specified by Data. When output,\r
116 indicates the data size actually transferred.\r
117 @param[in,out] DataToggle A pointer to the data toggle value.\r
118 @param[in] TimeOut Indicates the maximum time, in milliseconds,\r
119 in which the transfer is allowed to complete.\r
ca243131
FT
120 If Timeout is 0, then the caller must wait for\r
121 the function to be completed until EFI_SUCCESS\r
122 or EFI_DEVICE_ERROR is returned.\r
4b1bf81c 123 @param[in] Translator A pointer to the transaction translator data.\r
d1102dba 124 @param[out] TransferResult A pointer to the detailed result information\r
4b1bf81c 125 of the bulk transfer.\r
126\r
127 @retval EFI_SUCCESS The bulk transfer was completed successfully.\r
128 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.\r
129 Caller should check TransferResult for detailed error information.\r
130 @retval EFI_INVALID_PARAMETER Some parameters are invalid.\r
131 @retval EFI_OUT_OF_RESOURCES The bulk transfer could not be submitted due to a lack of resources.\r
d1102dba
LG
132 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
133\r
4b1bf81c 134\r
135**/\r
136typedef\r
137EFI_STATUS\r
138(EFIAPI *PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER)(\r
139 IN EFI_PEI_SERVICES **PeiServices,\r
140 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
141 IN UINT8 DeviceAddress,\r
142 IN UINT8 EndPointAddress,\r
d1102dba 143 IN UINT8 DeviceSpeed,\r
4b1bf81c 144 IN UINTN MaximumPacketLength,\r
145 IN OUT VOID *Data[EFI_USB_MAX_BULK_BUFFER_NUM],\r
146 IN OUT UINTN *DataLength,\r
147 IN OUT UINT8 *DataToggle,\r
148 IN UINTN TimeOut,\r
149 IN EFI_USB2_HC_TRANSACTION_TRANSLATOR *Translator,\r
150 OUT UINT32 *TransferResult\r
151 );\r
152\r
153/**\r
154 Retrieves the number of root hub ports.\r
155\r
156 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 157 @param[in] This The pointer to this instance of the\r
4b1bf81c 158 PEI_USB2_HOST_CONTROLLER_PPI.\r
d1102dba
LG
159 @param[out] PortNumber The pointer to the number of the root hub ports.\r
160\r
4b1bf81c 161 @retval EFI_SUCCESS The port number was retrieved successfully.\r
162 @retval EFI_INVALID_PARAMETER PortNumber is NULL.\r
163\r
164**/\r
165typedef\r
166EFI_STATUS\r
167(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(\r
168 IN EFI_PEI_SERVICES **PeiServices,\r
169 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
170 OUT UINT8 *PortNumber\r
171 );\r
172\r
173/**\r
174 Retrieves the current status of a USB root hub port.\r
175\r
176 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 177 @param[in] This The pointer to this instance of the\r
4b1bf81c 178 PEI_USB2_HOST_CONTROLLER_PPI.\r
d1102dba 179 @param[in] PortNumber Specifies the root hub port from which the status is\r
4b1bf81c 180 to be retrieved.\r
181 This value is zero based.\r
d1102dba 182 @param[out] PortStatus A pointer to the current port status bits and port\r
4b1bf81c 183 status change bits.\r
d1102dba
LG
184\r
185 @retval EFI_SUCCESS The status of the USB root hub port specified by\r
4b1bf81c 186 PortNumber was returned in PortStatus.\r
187 @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
188\r
189**/\r
190typedef\r
191EFI_STATUS\r
192(EFIAPI *PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(\r
193 IN EFI_PEI_SERVICES **PeiServices,\r
194 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
195 IN UINT8 PortNumber,\r
196 OUT EFI_USB_PORT_STATUS *PortStatus\r
197 );\r
198\r
199/**\r
200 Sets a feature for the specified root hub port.\r
201\r
202 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 203 @param[in] This The pointer to this instance of the\r
4b1bf81c 204 PEI_USB2_HOST_CONTROLLER_PPI.\r
d1102dba 205 @param[in] PortNumber Specifies the root hub port whose feature is requested\r
4b1bf81c 206 to be set. This value is zero based.\r
d1102dba 207 @param[in] PortFeature Indicates the feature selector associated with the feature\r
4b1bf81c 208 set request.\r
d1102dba
LG
209\r
210 @retval EFI_SUCCESS The feature specified by PortFeature was set for\r
4b1bf81c 211 the USB root hub port specified by PortNumber.\r
d1102dba 212 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid\r
4b1bf81c 213 for this function.\r
d1102dba 214 @retval EFI_TIMEOUT The time out occurred\r
4b1bf81c 215\r
216**/\r
217typedef\r
218EFI_STATUS\r
219(EFIAPI *PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(\r
220 IN EFI_PEI_SERVICES **PeiServices,\r
221 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
222 IN UINT8 PortNumber,\r
223 IN EFI_USB_PORT_FEATURE PortFeature\r
224 );\r
225\r
226/**\r
227 Clears a feature for the specified root hub port.\r
228\r
229 @param[in] PeiServices The pointer to the PEI Services Table.\r
d1102dba 230 @param[in] This The pointer to this instance of the\r
4b1bf81c 231 PEI_USB2_HOST_CONTROLLER_PPI.\r
232 @param[in] PortNumber Specifies the root hub port whose feature is\r
233 requested to be cleared.\r
234 @param[in] PortFeature Indicates the feature selector associated with the\r
235 feature clear request.\r
236\r
237 @return EFI_SUCCESS The feature specified by PortFeature was cleared\r
238 for the USB root hub port specified by PortNumber.\r
239 @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
240\r
241**/\r
242typedef\r
243EFI_STATUS\r
244(EFIAPI *PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(\r
245 IN EFI_PEI_SERVICES **PeiServices,\r
246 IN PEI_USB2_HOST_CONTROLLER_PPI *This,\r
247 IN UINT8 PortNumber,\r
248 IN EFI_USB_PORT_FEATURE PortFeature\r
249 );\r
250\r
251///\r
252/// This PPI contains a set of services to interact with the USB host controller.\r
253/// These interfaces are modeled on the UEFI 2.3 specification protocol\r
d1102dba 254/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3\r
4b1bf81c 255/// Specification for more information on these interfaces.\r
256///\r
257struct _PEI_USB2_HOST_CONTROLLER_PPI {\r
258 PEI_USB2_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;\r
259 PEI_USB2_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;\r
260 PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;\r
261 PEI_USB2_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;\r
262 PEI_USB2_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;\r
263 PEI_USB2_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;\r
264};\r
265\r
266extern EFI_GUID gPeiUsb2HostControllerPpiGuid;\r
267\r
268#endif\r
269\r