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