]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Include/Ppi/Usb2HostController.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / Usb2HostController.h
... / ...
CommitLineData
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 - 2018, Intel Corporation. All rights reserved. <BR>\r
9\r
10SPDX-License-Identifier: BSD-2-Clause-Patent\r
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
33 Initiate a USB control transfer using a specific USB Host controller on the USB bus.\r
34\r
35 @param[in] PeiServices The pointer to the PEI Services Table.\r
36 @param[in] This The pointer to this instance of the\r
37 PEI_USB2_HOST_CONTROLLER_PPI.\r
38 @param[in] DeviceAddress Represents the address of the target device\r
39 on the USB.\r
40 @param[in] DeviceSpeed Indicates device speed.\r
41 @param[in] MaximumPacketLength Indicates the maximum packet size that the\r
42 default control transfer\r
43 endpoint is capable of sending or receiving.\r
44 @param[in] Request A pointer to the USB device request that\r
45 will be sent to the USB device.\r
46 @param[in] TransferDirection Specifies the data direction for the transfer.\r
47 There are three values available:\r
48 EfiUsbDataIn, EfiUsbDataOut and EfiUsbNoData.\r
49 @param[in,out] Data A pointer to the buffer of data that will\r
50 be transmitted to USB device or\r
51 received from USB device.\r
52 @param[in,out] DataLength On input, indicates the size, in bytes, of\r
53 the data buffer specified by Data.\r
54 On output, indicates the amount of data\r
55 actually transferred.\r
56 @param[in] TimeOut Indicates the maximum time, in milliseconds,\r
57 that the transfer is allowed to complete.\r
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
61 @param[in] Translator A pointer to the transaction translator data.\r
62 @param[out] TransferResult A pointer to the detailed result information\r
63 generated by this control transfer.\r
64\r
65 @retval EFI_SUCCESS The control transfer was completed successfully.\r
66 @retval EFI_DEVICE_ERROR The control transfer failed due to host controller\r
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
71\r
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
92 Initiate a USB bulk transfer using a specific USB Host controller on the USB bus.\r
93\r
94 @param[in] PeiServices The pointer to the PEI Services Table.\r
95 @param[in] This The pointer to this instance of the\r
96 PEI_USB2_HOST_CONTROLLER_PPI.\r
97 @param[in] DeviceAddress Represents the address of the target device\r
98 on the USB.\r
99 @param[in] EndPointAddress The combination of an endpoint number and\r
100 an endpoint direction of the target USB device.\r
101 @param[in] DeviceSpeed Indicates device speed.\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
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
116 @param[in] Translator A pointer to the transaction translator data.\r
117 @param[out] TransferResult A pointer to the detailed result information\r
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
125 @retval EFI_TIMEOUT The bulk transfer failed due to timeout.\r
126\r
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
136 IN UINT8 DeviceSpeed,\r
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
150 @param[in] This The pointer to this instance of the\r
151 PEI_USB2_HOST_CONTROLLER_PPI.\r
152 @param[out] PortNumber The pointer to the number of the root hub ports.\r
153\r
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
170 @param[in] This The pointer to this instance of the\r
171 PEI_USB2_HOST_CONTROLLER_PPI.\r
172 @param[in] PortNumber Specifies the root hub port from which the status is\r
173 to be retrieved.\r
174 This value is zero based.\r
175 @param[out] PortStatus A pointer to the current port status bits and port\r
176 status change bits.\r
177\r
178 @retval EFI_SUCCESS The status of the USB root hub port specified by\r
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
196 @param[in] This The pointer to this instance of the\r
197 PEI_USB2_HOST_CONTROLLER_PPI.\r
198 @param[in] PortNumber Specifies the root hub port whose feature is requested\r
199 to be set. This value is zero based.\r
200 @param[in] PortFeature Indicates the feature selector associated with the feature\r
201 set request.\r
202\r
203 @retval EFI_SUCCESS The feature specified by PortFeature was set for\r
204 the USB root hub port specified by PortNumber.\r
205 @retval EFI_INVALID_PARAMETER PortNumber is invalid or PortFeature is invalid\r
206 for this function.\r
207 @retval EFI_TIMEOUT The time out occurred\r
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
223 @param[in] This The pointer to this instance of the\r
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
247/// EFI_USB2_HOST_CONTROLLER_PROTOCOL. Refer to section 16.1 of the UEFI 2.3\r
248/// Specification for more information on these interfaces.\r
249///\r
250struct _PEI_USB2_HOST_CONTROLLER_PPI {\r
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
257};\r
258\r
259extern EFI_GUID gPeiUsb2HostControllerPpiGuid;\r
260\r
261#endif\r
262\r