]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h
MdeModulePkg SmmLockBoxSmmLib: Add debug message for the address of lockbox(smm)...
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusPei / HubPeim.h
CommitLineData
4b1bf81c 1/** @file\r
2Constants definitions for Usb Hub Peim\r
3\r
4Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
5 \r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions\r
8of the BSD License which accompanies this distribution. The\r
9full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15**/\r
16\r
17#ifndef _PEI_HUB_PEIM_H_\r
18#define _PEI_HUB_PEIM_H_\r
19\r
20\r
21//\r
22// Hub feature numbers\r
23//\r
24#define C_HUB_LOCAL_POWER 0\r
25#define C_HUB_OVER_CURRENT 1\r
26\r
27//\r
28// Hub class code & sub class code\r
29//\r
30#define CLASS_CODE_HUB 0x09\r
31#define SUB_CLASS_CODE_HUB 0\r
32\r
33//\r
34// Hub Status & Hub Change bit masks\r
35//\r
36#define HUB_STATUS_LOCAL_POWER 0x0001\r
37#define HUB_STATUS_OVERCURRENT 0x0002\r
38\r
39#define HUB_CHANGE_LOCAL_POWER 0x0001\r
40#define HUB_CHANGE_OVERCURRENT 0x0002\r
41\r
42//\r
43// Hub Characteristics\r
44//\r
45#define HUB_CHAR_LPSM 0x0003\r
46#define HUB_CHAR_COMPOUND 0x0004\r
47#define HUB_CHAR_OCPM 0x0018\r
48\r
49//\r
50// Standard hub request and request type\r
51// By [Spec-USB20/Chapter-11.24]\r
52//\r
53#define USB_HUB_CLEAR_FEATURE 0x01\r
54#define USB_HUB_CLEAR_FEATURE_REQ_TYPE 0x20\r
55\r
56#define USB_HUB_CLEAR_FEATURE_PORT 0x01\r
57#define USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23\r
58\r
59#define USB_HUB_GET_BUS_STATE 0x02\r
60#define USB_HUB_GET_BUS_STATE_REQ_TYPE 0xA3\r
61\r
62#define USB_HUB_GET_DESCRIPTOR 0x06\r
63#define USB_HUB_GET_DESCRIPTOR_REQ_TYPE 0xA0\r
64\r
65#define USB_HUB_GET_HUB_STATUS 0x00\r
66#define USB_HUB_GET_HUB_STATUS_REQ_TYPE 0xA0\r
67\r
68#define USB_HUB_GET_PORT_STATUS 0x00\r
69#define USB_HUB_GET_PORT_STATUS_REQ_TYPE 0xA3\r
70\r
71#define USB_HUB_SET_DESCRIPTOR 0x07\r
72#define USB_HUB_SET_DESCRIPTOR_REQ_TYPE 0x20\r
73\r
74#define USB_HUB_SET_HUB_FEATURE 0x03\r
75#define USB_HUB_SET_HUB_FEATURE_REQ_TYPE 0x20\r
76\r
77#define USB_HUB_SET_PORT_FEATURE 0x03\r
78#define USB_HUB_SET_PORT_FEATURE_REQ_TYPE 0x23\r
79\r
80#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)\r
81#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)\r
82\r
83#define MAXBYTES 8\r
84#pragma pack(1)\r
85//\r
86// Hub descriptor, the last two fields are of variable lenght.\r
87//\r
88typedef struct {\r
89 UINT8 Length;\r
90 UINT8 DescriptorType;\r
91 UINT8 NbrPorts;\r
92 UINT8 HubCharacteristics[2];\r
93 UINT8 PwrOn2PwrGood;\r
94 UINT8 HubContrCurrent;\r
95 UINT8 Filler[MAXBYTES];\r
96} EFI_USB_HUB_DESCRIPTOR;\r
97\r
98typedef struct {\r
99 UINT16 HubStatus;\r
100 UINT16 HubChangeStatus;\r
101} EFI_USB_HUB_STATUS;\r
102\r
103#pragma pack()\r
104/**\r
105 Get a given hub port status.\r
106\r
107 @param PeiServices General-purpose services that are available to every PEIM.\r
108 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
109 @param Port Usb hub port number (starting from 1).\r
110 @param PortStatus Current Hub port status and change status.\r
111\r
112 @retval EFI_SUCCESS Port status is obtained successfully.\r
113 @retval EFI_DEVICE_ERROR Cannot get the port status due to a hardware error.\r
114 @retval Others Other failure occurs.\r
115\r
116**/\r
117EFI_STATUS\r
118PeiHubGetPortStatus (\r
119 IN EFI_PEI_SERVICES **PeiServices,\r
120 IN PEI_USB_IO_PPI *UsbIoPpi,\r
121 IN UINT8 Port,\r
122 OUT UINT32 *PortStatus\r
123 );\r
124\r
125/**\r
126 Set specified feature to a given hub port.\r
127\r
128 @param PeiServices General-purpose services that are available to every PEIM.\r
129 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
130 @param Port Usb hub port number (starting from 1).\r
131 @param Value New feature value.\r
132\r
133 @retval EFI_SUCCESS Port feature is set successfully.\r
134 @retval EFI_DEVICE_ERROR Cannot set the port feature due to a hardware error.\r
135 @retval Others Other failure occurs.\r
136\r
137**/\r
138EFI_STATUS\r
139PeiHubSetPortFeature (\r
140 IN EFI_PEI_SERVICES **PeiServices,\r
141 IN PEI_USB_IO_PPI *UsbIoPpi,\r
142 IN UINT8 Port,\r
143 IN UINT8 Value\r
144 );\r
145\r
146/**\r
147 Set specified feature to a given hub.\r
148\r
149 @param PeiServices General-purpose services that are available to every PEIM.\r
150 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
151 @param Value New feature value.\r
152\r
153 @retval EFI_SUCCESS Port feature is set successfully.\r
154 @retval EFI_DEVICE_ERROR Cannot set the port feature due to a hardware error.\r
155 @retval Others Other failure occurs.\r
156\r
157**/\r
158EFI_STATUS\r
159PeiHubSetHubFeature (\r
160 IN EFI_PEI_SERVICES **PeiServices,\r
161 IN PEI_USB_IO_PPI *UsbIoPpi,\r
162 IN UINT8 Value\r
163 );\r
164\r
165/**\r
166 Get a given hub status.\r
167\r
168 @param PeiServices General-purpose services that are available to every PEIM.\r
169 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
170 @param HubStatus Current Hub status and change status.\r
171\r
172 @retval EFI_SUCCESS Hub status is obtained successfully.\r
173 @retval EFI_DEVICE_ERROR Cannot get the hub status due to a hardware error.\r
174 @retval Others Other failure occurs.\r
175\r
176**/\r
177EFI_STATUS\r
178PeiHubGetHubStatus (\r
179 IN EFI_PEI_SERVICES **PeiServices,\r
180 IN PEI_USB_IO_PPI *UsbIoPpi,\r
181 OUT UINT32 *HubStatus\r
182 );\r
183\r
184/**\r
185 Clear specified feature on a given hub port.\r
186\r
187 @param PeiServices General-purpose services that are available to every PEIM.\r
188 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
189 @param Port Usb hub port number (starting from 1).\r
190 @param Value Feature value that will be cleared from the hub port.\r
191\r
192 @retval EFI_SUCCESS Port feature is cleared successfully.\r
193 @retval EFI_DEVICE_ERROR Cannot clear the port feature due to a hardware error.\r
194 @retval Others Other failure occurs.\r
195\r
196**/\r
197EFI_STATUS\r
198PeiHubClearPortFeature (\r
199 IN EFI_PEI_SERVICES **PeiServices,\r
200 IN PEI_USB_IO_PPI *UsbIoPpi,\r
201 IN UINT8 Port,\r
202 IN UINT8 Value\r
203 );\r
204\r
205/**\r
206 Clear specified feature on a given hub.\r
207\r
208 @param PeiServices General-purpose services that are available to every PEIM.\r
209 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
210 @param Value Feature value that will be cleared from the hub port.\r
211\r
212 @retval EFI_SUCCESS Hub feature is cleared successfully.\r
213 @retval EFI_DEVICE_ERROR Cannot clear the hub feature due to a hardware error.\r
214 @retval Others Other failure occurs.\r
215\r
216**/\r
217EFI_STATUS\r
218PeiHubClearHubFeature (\r
219 IN EFI_PEI_SERVICES **PeiServices,\r
220 IN PEI_USB_IO_PPI *UsbIoPpi,\r
221 IN UINT8 Value\r
222 );\r
223\r
224/**\r
225 Get a given hub descriptor.\r
226\r
227 @param PeiServices General-purpose services that are available to every PEIM.\r
228 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
229 @param DescriptorSize The length of Hub Descriptor buffer.\r
230 @param HubDescriptor Caller allocated buffer to store the hub descriptor if\r
231 successfully returned.\r
232\r
233 @retval EFI_SUCCESS Hub descriptor is obtained successfully.\r
234 @retval EFI_DEVICE_ERROR Cannot get the hub descriptor due to a hardware error.\r
235 @retval Others Other failure occurs.\r
236\r
237**/\r
238EFI_STATUS\r
239PeiGetHubDescriptor (\r
240 IN EFI_PEI_SERVICES **PeiServices,\r
241 IN PEI_USB_IO_PPI *UsbIoPpi,\r
242 IN UINTN DescriptorSize,\r
243 OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor\r
244 );\r
245\r
246/**\r
247 Configure a given hub.\r
248\r
249 @param PeiServices General-purpose services that are available to every PEIM.\r
250 @param PeiUsbDevice Indicating the hub controller device that will be configured\r
251\r
252 @retval EFI_SUCCESS Hub configuration is done successfully.\r
253 @retval EFI_DEVICE_ERROR Cannot configure the hub due to a hardware error.\r
254\r
255**/\r
256EFI_STATUS\r
257PeiDoHubConfig (\r
258 IN EFI_PEI_SERVICES **PeiServices,\r
259 IN PEI_USB_DEVICE *PeiUsbDevice\r
260 );\r
261\r
262/**\r
263 Send reset signal over the given root hub port.\r
264\r
265 @param PeiServices General-purpose services that are available to every PEIM.\r
266 @param UsbIoPpi Indicates the PEI_USB_IO_PPI instance.\r
267 @param PortNum Usb hub port number (starting from 1).\r
268\r
269**/\r
270VOID\r
271PeiResetHubPort (\r
272 IN EFI_PEI_SERVICES **PeiServices,\r
273 IN PEI_USB_IO_PPI *UsbIoPpi,\r
274 IN UINT8 PortNum\r
275 );\r
276\r
277#endif\r
278\r
279\r