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