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