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