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