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