]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Include/Ppi/UsbHostController.h
MdeModulePkg: Add match2 opcode support in SetupBrowserDxe and sample code in DriverS...
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / UsbHostController.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
ca243131 8Copyright (c) 2006 - 2013, 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_USB_HOST_CONTROLLER_PPI_H_\r
22#define _PEI_USB_HOST_CONTROLLER_PPI_H_\r
23\r
24#include <Protocol/Usb2HostController.h>\r
25\r
26///\r
27/// Global ID for the PEI_USB_HOST_CONTROLLER_PPI.\r
28///\r
29#define PEI_USB_HOST_CONTROLLER_PPI_GUID \\r
30 { \\r
31 0x652b38a9, 0x77f4, 0x453f, { 0x89, 0xd5, 0xe7, 0xbd, 0xc3, 0x52, 0xfc, 0x53} \\r
32 }\r
33\r
34///\r
35/// Forward declaration for the PEI_USB_HOST_CONTROLLER_PPI.\r
36///\r
37typedef struct _PEI_USB_HOST_CONTROLLER_PPI PEI_USB_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_USB_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
ca243131
FT
64 that the transfer is allowed to complete. \r
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[out] TransferResult A pointer to the detailed result information \r
69 generated by this control transfer.\r
70\r
71 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller \r
72 or device error.\r
73 @retval EFI_SUCCESS The control transfer was completed successfully.\r
74\r
75**/\r
76typedef\r
77EFI_STATUS\r
78(EFIAPI *PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER)(\r
79 IN EFI_PEI_SERVICES **PeiServices,\r
80 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
81 IN UINT8 DeviceAddress,\r
82 IN UINT8 DeviceSpeed,\r
83 IN UINT8 MaximumPacketLength,\r
84 IN USB_DEVICE_REQUEST *Request,\r
85 IN EFI_USB_DATA_DIRECTION TransferDirection,\r
86 IN OUT VOID *Data OPTIONAL,\r
87 IN OUT UINTN *DataLength OPTIONAL,\r
88 IN UINTN TimeOut,\r
89 OUT UINT32 *TransferResult\r
90 );\r
91\r
92/**\r
93 Initiate a USB bulk transfer using a specific USB Host controller on the USB bus. \r
94\r
95 @param[in] PeiServices The pointer to the PEI Services Table.\r
96 @param[in] This The pointer to this instance of the \r
97 PEI_USB_HOST_CONTROLLER_PPI.\r
98 @param[in] DeviceAddress Represents the address of the target device \r
99 on the USB.\r
100 @param[in] EndPointAddress The combination of an endpoint number and \r
101 an endpoint direction of the target USB device.\r
102 @param[in] MaximumPacketLength Indicates the maximum packet size the target \r
103 endpoint is capable of sending or receiving.\r
104 @param[in,out] Data Array of pointers to the buffers of data \r
105 that will be transmitted to USB device or \r
106 received from USB device.\r
107 @param[in,out] DataLength When input, indicates the size, in bytes, of \r
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[out] TransferResult A pointer to the detailed result information \r
117 of the bulk transfer.\r
118\r
119 @retval EFI_SUCCESS The bulk transfer was completed successfully.\r
120 @retval EFI_DEVICE_ERROR The bulk transfer failed due to host controller or device error.\r
121 Caller should check TransferResult for detailed error information.\r
122\r
123**/\r
124typedef\r
125EFI_STATUS\r
126(EFIAPI *PEI_USB_HOST_CONTROLLER_BULK_TRANSFER)(\r
127 IN EFI_PEI_SERVICES **PeiServices,\r
128 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
129 IN UINT8 DeviceAddress,\r
130 IN UINT8 EndPointAddress,\r
131 IN UINT8 MaximumPacketLength,\r
132 IN OUT VOID *Data,\r
133 IN OUT UINTN *DataLength,\r
134 IN OUT UINT8 *DataToggle,\r
135 IN UINTN TimeOut,\r
136 OUT UINT32 *TransferResult\r
137 );\r
138\r
139/**\r
140 Retrieves the number of root hub ports.\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 \r
144 PEI_USB_HOST_CONTROLLER_PPI.\r
145 @param[out] PortNumber The pointer to the number of the root hub ports. \r
146 \r
147 @retval EFI_SUCCESS The port number was retrieved successfully.\r
148 @retval EFI_DEVICE_ERROR An error was encountered while attempting to retrieve \r
149 the port number.\r
150 @retval EFI_INVALID_PARAMETER PortNumber is NULL.\r
151\r
152**/\r
153typedef\r
154EFI_STATUS\r
155(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER)(\r
156 IN EFI_PEI_SERVICES **PeiServices,\r
157 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
158 OUT UINT8 *PortNumber\r
159 );\r
160\r
161/**\r
162 Retrieves the current status of a USB root hub port.\r
163\r
164 @param[in] PeiServices The pointer to the PEI Services Table.\r
165 @param[in] This The pointer to this instance of the \r
166 PEI_USB_HOST_CONTROLLER_PPI.\r
167 @param[in] PortNumber Specifies the root hub port from which the status is \r
168 to be retrieved.\r
169 This value is zero based.\r
170 @param[out] PortStatus A pointer to the current port status bits and port \r
171 status change bits.\r
172 \r
173 @retval EFI_SUCCESS The status of the USB root hub port specified by \r
174 PortNumber was returned in PortStatus.\r
175 @retval EFI_INVALID_PARAMETER PortNumber is invalid.\r
176\r
177**/\r
178typedef\r
179EFI_STATUS\r
180(EFIAPI *PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS)(\r
181 IN EFI_PEI_SERVICES **PeiServices,\r
182 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
183 IN UINT8 PortNumber,\r
184 OUT EFI_USB_PORT_STATUS *PortStatus\r
185 );\r
186\r
187/**\r
188 Sets a feature for the specified root hub port.\r
189\r
190 @param[in] PeiServices The pointer to the PEI Services Table.\r
191 @param[in] This The pointer to this instance of the \r
192 PEI_USB_HOST_CONTROLLER_PPI.\r
193 @param[in] PortNumber Specifies the root hub port whose feature is requested \r
194 to be set. This value is zero based.\r
195 @param[in] PortFeature Indicates the feature selector associated with the feature \r
196 set request.\r
197 \r
198 @retval EFI_SUCCESS The feature specified by PortFeature was set for \r
199 the USB root hub port specified by PortNumber.\r
200 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid \r
201 for this function.\r
202\r
203**/\r
204typedef\r
205EFI_STATUS\r
206(EFIAPI *PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE)(\r
207 IN EFI_PEI_SERVICES **PeiServices,\r
208 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
209 IN UINT8 PortNumber,\r
210 IN EFI_USB_PORT_FEATURE PortFeature\r
211 );\r
212\r
213/**\r
214 Clears a feature for the specified root hub port.\r
215\r
216 @param[in] PeiServices The pointer to the PEI Services Table.\r
217 @param[in] This The pointer to this instance of the \r
218 PEI_USB_HOST_CONTROLLER_PPI.\r
219 @param[in] PortNumber Specifies the root hub port whose feature is\r
220 requested to be cleared.\r
221 @param[in] PortFeature Indicates the feature selector associated with the\r
222 feature clear request.\r
223\r
224 @return EFI_SUCCESS The feature specified by PortFeature was cleared\r
225 for the USB root hub port specified by PortNumber.\r
226 @return EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid.\r
227 @return EFI_DEVICE_ERROR Can't read the register.\r
228\r
229**/\r
230typedef\r
231EFI_STATUS\r
232(EFIAPI *PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE)(\r
233 IN EFI_PEI_SERVICES **PeiServices,\r
234 IN PEI_USB_HOST_CONTROLLER_PPI *This,\r
235 IN UINT8 PortNumber,\r
236 IN EFI_USB_PORT_FEATURE PortFeature\r
237 );\r
238\r
239///\r
240/// This PPI contains a set of services to interact with the USB host controller.\r
241/// These interfaces are modeled on the UEFI 2.3 specification protocol\r
242/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3 \r
243/// Specification for more information on these interfaces.\r
244///\r
245struct _PEI_USB_HOST_CONTROLLER_PPI {\r
246 PEI_USB_HOST_CONTROLLER_CONTROL_TRANSFER ControlTransfer;\r
247 PEI_USB_HOST_CONTROLLER_BULK_TRANSFER BulkTransfer;\r
248 PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_NUMBER GetRootHubPortNumber;\r
249 PEI_USB_HOST_CONTROLLER_GET_ROOTHUB_PORT_STATUS GetRootHubPortStatus;\r
250 PEI_USB_HOST_CONTROLLER_SET_ROOTHUB_PORT_FEATURE SetRootHubPortFeature;\r
251 PEI_USB_HOST_CONTROLLER_CLEAR_ROOTHUB_PORT_FEATURE ClearRootHubPortFeature;\r
252};\r
253\r
254extern EFI_GUID gPeiUsbHostControllerPpiGuid;\r
255\r
256#endif\r
257\r