blob: 7cdf452b9981b09fbfef9b6764571921e1587053 [file] [log] [blame]
Stefan Reinauer23190272008-08-20 13:41:24 +00001/*
2 * inteltool - dump all registers on an Intel CPU + chipset based system.
3 *
Stefan Reinauer14e22772010-04-27 06:56:47 +00004 * Copyright (C) 2008-2010 by coresystems GmbH
5 * written by Stefan Reinauer <stepan@coresystems.de>
6 *
Stefan Reinauer23190272008-08-20 13:41:24 +00007 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <stdio.h>
Stefan Reinauer23190272008-08-20 13:41:24 +000022#include "inteltool.h"
23
Nico Huber5ed986b2013-03-29 19:00:37 +010024static const io_register_t pch_pm_registers[] = {
25 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
26 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
27 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
28 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
29 { 0x0c, 4, "RESERVED" },
30 { 0x10, 4, "RESERVED" },
31 { 0x14, 4, "RESERVED" },
32 { 0x18, 4, "RESERVED" },
33 { 0x1c, 4, "RESERVED" },
34 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
35 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
36 { 0x30, 4, "SMI_EN" },
37 { 0x34, 4, "SMI_STS" },
38 { 0x38, 2, "ALT_GP_SMI_EN" },
39 { 0x3a, 2, "ALT_GP_SMI_STS" },
40 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control
41 { 0x3d, 1, "RESERVED" },
42 { 0x3e, 2, "RESERVED" },
43 { 0x40, 2, "RESERVED" },
44 { 0x42, 1, "GPE_CNTL" },
45 { 0x43, 1, "RESERVED" },
46 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
47 { 0x46, 2, "RESERVED" },
48 { 0x48, 4, "RESERVED" },
49 { 0x4c, 4, "RESERVED" },
50 { 0x50, 1, "PM2_CNT" },
51 { 0x51, 1, "RESERVED" },
52 { 0x52, 2, "RESERVED" },
53 { 0x54, 4, "RESERVED" },
54 { 0x58, 4, "RESERVED" },
55 { 0x5c, 4, "RESERVED" },
56 /* The TCO registers start here. */
57 { 0x60, 2, "TCO_RLD" },
58 { 0x62, 1, "TCO_DAT_IN" },
59 { 0x63, 1, "TCO_DAT_OUT" },
60 { 0x64, 2, "TCO1_STS" },
61 { 0x66, 2, "TCO2_STS" },
62 { 0x68, 2, "TCO1_CNT" },
63 { 0x6a, 2, "TCO2_CNT" },
64 { 0x6c, 2, "TCO_MESSAGE" },
65 { 0x6e, 1, "TCO_WDCNT" },
66 { 0x6f, 1, "RESERVED" },
67 { 0x70, 1, "SW_IRQ_GEN" },
68 { 0x71, 1, "RESERVED" },
69 { 0x72, 2, "TCO_TMR" },
70 { 0x74, 4, "RESERVED" },
71 { 0x78, 4, "RESERVED" },
72 { 0x7c, 4, "RESERVED" },
73};
74
Warren Turkal3cf287d2010-09-03 09:36:37 +000075static const io_register_t ich10_pm_registers[] = {
76 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
77 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
78 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
79 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
80 { 0x0c, 4, "RESERVED" },
81 { 0x10, 4, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
82#if DANGEROUS_REGISTERS
83 /* These registers return 0 on read, but reading them may cause
84 * the system to enter Cx states, which might hang the system.
85 */
86 { 0x14, 1, "LV2 (Mobile)" },
87 { 0x15, 1, "LV3 (Mobile)" },
88 { 0x16, 1, "LV4 (Mobile)" },
89#endif
90 { 0x17, 2, "RESERVED" },
91 { 0x19, 1, "RESERVED" },
92 { 0x1a, 2, "RESERVED" },
93 { 0x1c, 4, "RESERVED" },
94 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +020095 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Warren Turkal3cf287d2010-09-03 09:36:37 +000096 { 0x30, 4, "SMI_EN" },
97 { 0x34, 4, "SMI_STS" },
98 { 0x38, 2, "ALT_GP_SMI_EN" },
99 { 0x3a, 2, "ALT_GP_SMI_STS" },
100 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
101 { 0x3d, 2, "RESERVED" },
102 { 0x3f, 1, "RESERVED" },
103 { 0x40, 2, "RESERVED" },
104 { 0x42, 1, "GPE_CNTL" },
105 { 0x43, 1, "RESERVED" },
106 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
107 { 0x46, 2, "RESERVED" },
108 { 0x48, 4, "RESERVED" },
109 { 0x4c, 4, "RESERVED" },
110 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
111 { 0x51, 1, "RESERVED" },
112 { 0x52, 2, "RESERVED" },
113 { 0x54, 4, "C3_RES (Mobile)" },
114 { 0x58, 4, "RESERVED" },
115 { 0x5c, 4, "RESERVED" },
116 /* Here start the TCO registers */
117 { 0x60, 2, "TCO_RLD" },
118 { 0x62, 1, "TCO_DAT_IN" },
119 { 0x63, 1, "TCO_DAT_OUT" },
120 { 0x64, 2, "TCO1_STS" },
121 { 0x66, 2, "TCO2_STS" },
122 { 0x68, 2, "TCO1_CNT" },
123 { 0x6a, 2, "TCO2_CNT" },
124 { 0x6c, 2, "TCO_MESSAGE" },
125 { 0x6e, 1, "TCO_WDCNT" },
126 { 0x6f, 1, "RESERVED" },
127 { 0x70, 1, "SW_IRQ_GEN" },
128 { 0x71, 1, "RESERVED" },
129 { 0x72, 2, "TCO_TMR" },
130 { 0x74, 4, "RESERVED" },
131 { 0x78, 4, "RESERVED" },
132 { 0x7c, 4, "RESERVED" },
133};
134
Anton Kochkovda0b4562010-05-30 12:33:12 +0000135static const io_register_t ich9_pm_registers[] = {
136 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
137 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
138 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
139 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000140 { 0x0c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000141 { 0x10, 4, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000142#if DANGEROUS_REGISTERS
143 /* These registers return 0 on read, but reading them may cause
Anton Kochkovda0b4562010-05-30 12:33:12 +0000144 * the system to enter Cx states, which might hang the system.
Stefan Reinauer1162f252008-12-04 15:18:20 +0000145 */
Anton Kochkovda0b4562010-05-30 12:33:12 +0000146 { 0x14, 1, "LV2 (Mobile)" },
147 { 0x15, 1, "LV3 (Mobile)" },
148 { 0x16, 1, "LV4 (Mobile)" },
149 { 0x17, 1, "LV5 (Mobile)" },
150 { 0x18, 1, "LV6 (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000151#endif
Anton Kochkovda0b4562010-05-30 12:33:12 +0000152 { 0x19, 1, "RESERVED" },
153 { 0x1a, 2, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000154 { 0x1c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000155 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +0200156 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Stefan Reinauer1162f252008-12-04 15:18:20 +0000157 { 0x30, 4, "SMI_EN" },
158 { 0x34, 4, "SMI_STS" },
159 { 0x38, 2, "ALT_GP_SMI_EN" },
160 { 0x3a, 2, "ALT_GP_SMI_STS" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000161 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
162 { 0x3d, 2, "RESERVED" },
163 { 0x3f, 1, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000164 { 0x40, 2, "RESERVED" },
165 { 0x42, 1, "GPE_CNTL" },
166 { 0x43, 1, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000167 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
Stefan Reinauer1162f252008-12-04 15:18:20 +0000168 { 0x46, 2, "RESERVED" },
169 { 0x48, 4, "RESERVED" },
170 { 0x4c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000171 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000172 { 0x51, 1, "RESERVED" },
173 { 0x52, 2, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000174 { 0x54, 4, "C3_RES (Mobile)" },
175 { 0x58, 4, "C5_RES (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000176 { 0x5c, 4, "RESERVED" },
177 /* Here start the TCO registers */
178 { 0x60, 2, "TCO_RLD" },
179 { 0x62, 1, "TCO_DAT_IN" },
180 { 0x63, 1, "TCO_DAT_OUT" },
181 { 0x64, 2, "TCO1_STS" },
182 { 0x66, 2, "TCO2_STS" },
183 { 0x68, 2, "TCO1_CNT" },
184 { 0x6a, 2, "TCO2_CNT" },
185 { 0x6c, 2, "TCO_MESSAGE" },
186 { 0x6e, 1, "TCO_WDCNT" },
187 { 0x6f, 1, "RESERVED" },
188 { 0x70, 1, "SW_IRQ_GEN" },
189 { 0x71, 1, "RESERVED" },
190 { 0x72, 2, "TCO_TMR" },
191 { 0x74, 4, "RESERVED" },
192 { 0x78, 4, "RESERVED" },
193 { 0x7c, 4, "RESERVED" },
194};
195
196static const io_register_t ich8_pm_registers[] = {
197 { 0x00, 2, "PM1_STS" },
198 { 0x02, 2, "PM1_EN" },
199 { 0x04, 4, "PM1_CNT" },
200 { 0x08, 4, "PM1_TMR" },
201 { 0x0c, 4, "RESERVED" },
202 { 0x10, 4, "PROC_CNT" },
203#if DANGEROUS_REGISTERS
204 /* These registers return 0 on read, but reading them may cause
205 * the system to enter Cx states, which might hang the system.
206 */
207 { 0x14, 1, "LV2 (Mobile)" },
208 { 0x15, 1, "LV3 (Mobile)" },
209 { 0x16, 1, "LV4 (Mobile)" },
210 { 0x17, 1, "LV5 (Mobile)" },
211 { 0x18, 1, "LV6 (Mobile)" },
212#endif
213 { 0x19, 1, "RESERVED" },
214 { 0x1a, 2, "RESERVED" },
215 { 0x1c, 4, "RESERVED" },
216 { 0x20, 1, "PM2_CNT (Mobile)" },
217 { 0x21, 1, "RESERVED" },
218 { 0x22, 2, "RESERVED" },
219 { 0x24, 4, "RESERVED" },
220 { 0x28, 4, "GPE0_STS" },
221 { 0x2C, 4, "GPE0_EN" },
222 { 0x30, 4, "SMI_EN" },
223 { 0x34, 4, "SMI_STS" },
224 { 0x38, 2, "ALT_GP_SMI_EN" },
225 { 0x3a, 2, "ALT_GP_SMI_STS" },
226 { 0x3c, 4, "RESERVED" },
227 { 0x40, 2, "RESERVED" },
228 { 0x42, 1, "GPE_CNTL" },
229 { 0x43, 1, "RESERVED" },
230 { 0x44, 2, "DEVACT_STS" },
231 { 0x46, 2, "RESERVED" },
232 { 0x48, 4, "RESERVED" },
233 { 0x4c, 4, "RESERVED" },
234 { 0x50, 1, "SS_CNT (Mobile)" },
235 { 0x51, 1, "RESERVED" },
236 { 0x52, 2, "RESERVED" },
237 { 0x54, 4, "C3_RES (Mobile)" },
238 { 0x58, 4, "C5_RES (Mobile)" },
239 { 0x5c, 4, "RESERVED" },
240 /* Here start the TCO registers */
241 { 0x60, 2, "TCO_RLD" },
242 { 0x62, 1, "TCO_DAT_IN" },
243 { 0x63, 1, "TCO_DAT_OUT" },
244 { 0x64, 2, "TCO1_STS" },
245 { 0x66, 2, "TCO2_STS" },
246 { 0x68, 2, "TCO1_CNT" },
247 { 0x6a, 2, "TCO2_CNT" },
248 { 0x6c, 2, "TCO_MESSAGE" },
249 { 0x6e, 1, "TCO_WDCNT" },
250 { 0x6f, 1, "RESERVED" },
251 { 0x70, 1, "SW_IRQ_GEN" },
252 { 0x71, 1, "RESERVED" },
253 { 0x72, 2, "TCO_TMR" },
254 { 0x74, 4, "RESERVED" },
255 { 0x78, 4, "RESERVED" },
256 { 0x7c, 4, "RESERVED" },
257};
258
Anton Kochkovda0b4562010-05-30 12:33:12 +0000259static const io_register_t ich7_pm_registers[] = {
260 { 0x00, 2, "PM1_STS" },
261 { 0x02, 2, "PM1_EN" },
262 { 0x04, 4, "PM1_CNT" },
263 { 0x08, 4, "PM1_TMR" },
264 { 0x0c, 4, "RESERVED" },
265 { 0x10, 4, "PROC_CNT" },
266#if DANGEROUS_REGISTERS
267 /* These registers return 0 on read, but reading them may cause
268 * the system to enter C2/C3/C4 state, which might hang the system.
269 */
270 { 0x14, 1, "LV2 (Mobile/Ultra Mobile)" },
271 { 0x15, 1, "LV3 (Mobile/Ultra Mobile)" },
272 { 0x16, 1, "LV4 (Mobile/Ultra Mobile)" },
273#endif
274 { 0x17, 1, "RESERVED" },
275 { 0x18, 4, "RESERVED" },
276 { 0x1c, 4, "RESERVED" },
277 { 0x20, 1, "PM2_CNT (Mobile/Ultra Mobile)" },
278 { 0x21, 1, "RESERVED" },
279 { 0x22, 2, "RESERVED" },
280 { 0x24, 4, "RESERVED" },
281 { 0x28, 4, "GPE0_STS" },
282 { 0x2C, 4, "GPE0_EN" },
283 { 0x30, 4, "SMI_EN" },
284 { 0x34, 4, "SMI_STS" },
285 { 0x38, 2, "ALT_GP_SMI_EN" },
286 { 0x3a, 2, "ALT_GP_SMI_STS" },
287 { 0x3c, 4, "RESERVED" },
288 { 0x40, 2, "RESERVED" },
289 { 0x42, 1, "GPE_CNTL" },
290 { 0x43, 1, "RESERVED" },
291 { 0x44, 2, "DEVACT_STS" },
292 { 0x46, 2, "RESERVED" },
293 { 0x48, 4, "RESERVED" },
294 { 0x4c, 4, "RESERVED" },
295 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
296 { 0x51, 1, "RESERVED" },
297 { 0x52, 2, "RESERVED" },
298 { 0x54, 4, "C3_RES (Mobile/Ultra Mobile)" },
299 { 0x58, 4, "RESERVED" },
300 { 0x5c, 4, "RESERVED" },
301 /* Here start the TCO registers */
302 { 0x60, 2, "TCO_RLD" },
303 { 0x62, 1, "TCO_DAT_IN" },
304 { 0x63, 1, "TCO_DAT_OUT" },
305 { 0x64, 2, "TCO1_STS" },
306 { 0x66, 2, "TCO2_STS" },
307 { 0x68, 2, "TCO1_CNT" },
308 { 0x6a, 2, "TCO2_CNT" },
309 { 0x6c, 2, "TCO_MESSAGE" },
310 { 0x6e, 1, "TCO_WDCNT" },
311 { 0x6f, 1, "RESERVED" },
312 { 0x70, 1, "SW_IRQ_GEN" },
313 { 0x71, 1, "RESERVED" },
314 { 0x72, 2, "TCO_TMR" },
315 { 0x74, 4, "RESERVED" },
316 { 0x78, 4, "RESERVED" },
317 { 0x7c, 4, "RESERVED" },
318};
319
Stefan Reinauer14e22772010-04-27 06:56:47 +0000320/*
Pat Erleyca3548e2010-04-21 06:23:19 +0000321 * INTEL I/O Controller Hub 6 Family
322 * http://www.intel.com/assets/pdf/datasheet/301473.pdf
323 */
324static const io_register_t ich6_pm_registers[] = {
325 /* 10.8.3 */
326 { 0x00, 2, "PM1_STS" },
327 { 0x02, 2, "PM1_EN" },
328 { 0x04, 4, "PM1_CNT" },
329 { 0x08, 4, "PM1_TMR" },
330 { 0x10, 4, "PROC_CNT" },
331#if DANGEROUS_REGISTERS
332 /* These registers return 0 on read, but reading them may cause
333 * the system to enter C2/C3/C4 state, which might hang the system.
334 */
335 { 0x14, 1, "LV2" },
336 { 0x15, 1, "LV3 (Mobile Only)" },
337 { 0x16, 1, "LV4 (Mobile Only)" },
338#endif
339 { 0x20, 1, "PM2_CNT (Mobile Only)" },
340 { 0x28, 4, "GPE0_STS" },
341 { 0x2c, 4, "GPE0_EN" },
342 { 0x30, 4, "SMI_EN" },
343 { 0x34, 4, "SMI_STS" },
344 { 0x38, 2, "ALT_GP_SMI_EN" },
345 { 0x3a, 2, "ALT_GP_SMI_STS" },
346 { 0x44, 2, "DEVACT_STS" },
347 { 0x50, 1, "SS_CNT (Mobile Only)" },
348 { 0x54, 4, "C3_RES (Mobile Only)" },
349};
350
Idwer Vollering312fc962010-12-17 22:34:58 +0000351static const io_register_t ich5_pm_registers[] = {
352 { 0x00, 2, "PM1_STS" },
353 { 0x02, 2, "PM1_EN" },
354 { 0x04, 4, "PM1_CNT" },
355 { 0x08, 4, "PM1_TMR" },
356 { 0x0c, 4, "RESERVED" },
357 { 0x10, 4, "PROC_CNT" },
358 { 0x14, 3, "RESERVED" },
359 { 0x17, 9, "RESERVED" },
360 { 0x20, 1, "RESERVED" },
361 { 0x28, 4, "GPE0_STS" },
362 { 0x2c, 4, "GPE0_EN" },
363 { 0x30, 4, "SMI_EN" },
364 { 0x34, 4, "SMI_STS" },
365 { 0x38, 2, "ALT_GP_SMI_EN" },
366 { 0x3a, 2, "ALT_GP_SMI_STS" },
367 { 0x3c, 4, "RESERVED" },
368 { 0x40, 1, "MON_SMI" },
369 { 0x42, 2, "RESERVED" },
370 { 0x44, 1, "DEVACT_STS" },
371 { 0x48, 1, "DEVTRAP_EN" },
372 { 0x50, 1, "RESERVED" },
373 { 0x51, 15, "RESERVED" },
374 { 0x60, 16, "RESERVED" },
375};
376
Stefan Reinauer04844812010-02-22 11:26:06 +0000377static const io_register_t ich4_pm_registers[] = {
378 { 0x00, 2, "PM1_STS" },
379 { 0x02, 2, "PM1_EN" },
380 { 0x04, 4, "PM1_CNT" },
381 { 0x08, 4, "PM1_TMR" },
382 { 0x0c, 4, "RESERVED" },
383 { 0x10, 4, "PROC_CNT" },
384#if DANGEROUS_REGISTERS
385 /* These registers return 0 on read, but reading them may cause
386 * the system to enter C2/C3/C4 state, which might hang the system.
387 */
388 { 0x14, 1, "LV2 (Mobile)" },
389 { 0x15, 1, "LV3 (Mobile)" },
390 { 0x16, 1, "LV4 (Mobile)" },
391#endif
392 { 0x17, 1, "RESERVED" },
393 { 0x18, 4, "RESERVED" },
394 { 0x1c, 4, "RESERVED" },
395 { 0x20, 1, "PM2_CNT (Mobile)" },
396 { 0x21, 1, "RESERVED" },
397 { 0x22, 2, "RESERVED" },
398 { 0x24, 4, "RESERVED" },
399 { 0x28, 4, "GPE0_STS" },
400 { 0x2C, 4, "GPE0_EN" },
401 { 0x30, 4, "SMI_EN" },
402 { 0x34, 4, "SMI_STS" },
403 { 0x38, 2, "ALT_GP_SMI_EN" },
404 { 0x3a, 2, "ALT_GP_SMI_STS" },
405 { 0x3c, 4, "RESERVED" },
406 { 0x40, 2, "MON_SMI" },
407 { 0x42, 2, "RESERVED" },
408 { 0x44, 2, "DEVACT_STS" },
409 { 0x46, 2, "RESERVED" },
410 { 0x48, 4, "DEVTRAP_EN" },
411 { 0x4c, 2, "BUS_ADDR_TRACK" },
412 { 0x4e, 2, "BUS_CYC_TRACK" },
413 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
414 { 0x51, 1, "RESERVED" },
415 { 0x52, 2, "RESERVED" },
416 { 0x54, 4, "RESERVED" },
417 { 0x58, 4, "RESERVED" },
418 { 0x5c, 4, "RESERVED" },
419 /* Here start the TCO registers */
420 { 0x60, 1, "TCO_RLD" },
421 { 0x61, 1, "TCO_TMR" },
422 { 0x62, 1, "TCO_DAT_IN" },
423 { 0x63, 1, "TCO_DAT_OUT" },
424 { 0x64, 2, "TCO1_STS" },
425 { 0x66, 2, "TCO2_STS" },
426 { 0x68, 2, "TCO1_CNT" },
427 { 0x6a, 2, "TCO2_CNT" },
428 { 0x6c, 2, "TCO_MESSAGE" },
429 { 0x6e, 1, "TCO_WDSTATUS" },
430 { 0x6f, 1, "RESERVED" },
431 { 0x70, 1, "SW_IRQ_GEN" },
432 { 0x71, 1, "RESERVED" },
433 { 0x72, 2, "RESERVED" },
434 { 0x74, 4, "RESERVED" },
435 { 0x78, 4, "RESERVED" },
436 { 0x7c, 4, "RESERVED" },
437};
438
Joseph Smithe10757e2010-06-16 22:21:19 +0000439static const io_register_t ich2_pm_registers[] = {
440 { 0x00, 2, "PM1_STS" },
441 { 0x02, 2, "PM1_EN" },
442 { 0x04, 4, "PM1_CNT" },
443 { 0x08, 4, "PM1_TMR" },
444 { 0x0c, 4, "RESERVED" },
445 { 0x10, 4, "PROC_CNT" },
446#if DANGEROUS_REGISTERS
447 /* This register returns 0 on read, but reading it may cause
448 * the system to enter C2 state, which might hang the system.
449 */
450 { 0x14, 1, "LV2" },
451 { 0x15, 1, "RESERVED" },
452 { 0x16, 2, "RESERVED" },
453#endif
454 { 0x18, 4, "RESERVED" },
455 { 0x1c, 4, "RESERVED" },
456 { 0x20, 4, "RESERVED" },
457 { 0x24, 4, "RESERVED" },
458 { 0x28, 2, "GPE0_STS" },
459 { 0x2a, 2, "GPE0_EN" },
460 { 0x2c, 2, "GPE1_STS" },
461 { 0x2e, 2, "GPE1_EN" },
462 { 0x30, 2, "SMI_EN" },
463 { 0x32, 2, "RESERVED" },
464 { 0x34, 2, "SMI_STS" },
465 { 0x36, 2, "RESERVED" },
466 { 0x38, 4, "RESERVED" },
467 { 0x3c, 4, "RESERVED" },
468 { 0x40, 2, "MON_SMI_STS" },
469 { 0x42, 2, "RESERVED" },
470 { 0x44, 2, "DEV_TRP_STS" },
471 { 0x46, 2, "RESERVED" },
472 { 0x48, 2, "TRP_EN" },
473 { 0x4A, 2, "RESERVED" },
474 { 0x4c, 2, "BUS_ADDR_TRACK" },
475 { 0x4e, 1, "BUS_CYC_TRACK" },
476 { 0x4f, 1, "RESERVED" },
477 { 0x50, 4, "RESERVED" },
478 { 0x54, 4, "RESERVED" },
479 { 0x58, 4, "RESERVED" },
480 { 0x5c, 4, "RESERVED" },
481 /* Here start the TCO registers */
482 { 0x60, 1, "TCO_RLD" },
483 { 0x61, 1, "TCO_TMR" },
484 { 0x62, 1, "TCO_DAT_IN" },
485 { 0x63, 1, "TCO_DAT_OUT" },
486 { 0x64, 2, "TCO1_STS" },
487 { 0x66, 2, "TCO2_STS" },
488 { 0x68, 2, "TCO1_CNT" },
489 { 0x6a, 2, "TCO2_CNT" },
490 { 0x6c, 1, "TCO_MESSAGE1" },
491 { 0x6d, 1, "TCO_MESSAGE2" },
492 { 0x6e, 1, "TCO_WDSTATUS" },
493 { 0x6f, 1, "RESERVED" },
494 { 0x70, 1, "SW_IRQ_GEN" },
495 { 0x71, 1, "RESERVED" },
496 { 0x72, 2, "RESERVED" },
497 { 0x74, 4, "RESERVED" },
498 { 0x78, 4, "RESERVED" },
499 { 0x7c, 4, "RESERVED" },
500};
501
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000502static const io_register_t ich0_pm_registers[] = {
503 { 0x00, 2, "PM1_STS" },
504 { 0x02, 2, "PM1_EN" },
505 { 0x04, 4, "PM1_CNT" },
506 { 0x08, 4, "PM1_TMR" },
507 { 0x0c, 4, "RESERVED" },
508 { 0x10, 4, "PROC_CNT" },
509#if DANGEROUS_REGISTERS
510 /* This register returns 0 on read, but reading it may cause
511 * the system to enter C2 state, which might hang the system.
512 */
513 { 0x14, 1, "LV2" },
514 { 0x15, 1, "RESERVED" },
515 { 0x16, 2, "RESERVED" },
516#endif
517 { 0x18, 4, "RESERVED" },
518 { 0x1c, 4, "RESERVED" },
519 { 0x20, 4, "RESERVED" },
520 { 0x24, 4, "RESERVED" },
521 { 0x28, 4, "GPE0_STS" },
522 { 0x2C, 4, "GPE0_EN" },
523 { 0x30, 2, "SMI_EN" },
524 { 0x32, 2, "RESERVED" },
525 { 0x34, 2, "SMI_STS" },
526 { 0x36, 2, "RESERVED" },
527 { 0x38, 4, "RESERVED" },
528 { 0x3c, 4, "RESERVED" },
529 { 0x40, 2, "IOMON_STS_EN" },
530 { 0x42, 2, "RESERVED" },
531 { 0x44, 2, "DEVACT_STS" },
532 { 0x46, 2, "RESERVED" },
533 { 0x48, 4, "RESERVED" },
534 { 0x4c, 2, "BUS_ADDR_TRACK" },
535 { 0x4e, 1, "BUS_CYC_TRACK" },
536 { 0x4f, 1, "RESERVED" },
537 { 0x50, 4, "RESERVED" },
538 { 0x54, 4, "RESERVED" },
539 { 0x58, 4, "RESERVED" },
540 { 0x5c, 4, "RESERVED" },
541 /* Here start the TCO registers */
542 { 0x60, 1, "TCO_RLD" },
543 { 0x61, 1, "TCO_TMR" },
544 { 0x62, 1, "TCO_DAT_IN" },
545 { 0x63, 1, "TCO_DAT_OUT" },
546 { 0x64, 2, "TCO1_STS" },
547 { 0x66, 2, "TCO2_STS" },
548 { 0x68, 2, "TCO1_CNT" },
549 { 0x6a, 2, "TCO2_CNT" },
550 { 0x6c, 1, "TCO_MESSAGE1" },
551 { 0x6d, 1, "TCO_MESSAGE2" },
552 { 0x6e, 1, "TCO_WDSTATUS" },
553 { 0x6f, 1, "RESERVED" },
554 { 0x70, 4, "RESERVED" },
555 { 0x74, 4, "RESERVED" },
556 { 0x78, 4, "RESERVED" },
557 { 0x7c, 4, "RESERVED" },
558};
559
Maciej Pijanka90d17402009-09-30 17:05:46 +0000560static const io_register_t i82371xx_pm_registers[] = {
561 { 0x00, 2, "PMSTS" },
562 { 0x02, 2, "PMEN" },
563 { 0x04, 2, "PMCNTRL" },
564 { 0x06, 2, "RESERVED" },
565 { 0x08, 1, "PMTMR" },
566 { 0x09, 1, "RESERVED" },
567 { 0x0A, 1, "RESERVED" },
568 { 0x0B, 1, "RESERVED" },
569 { 0x0C, 2, "GPSTS" },
570 { 0x0E, 2, "GPEN" },
571 { 0x10, 4, "PCNTRL" },
572#if DANGEROUS_REGISTERS
573 /*
574 * This register returns 0 on read, but reading it may cause
575 * the system to enter C2 state, which might hang the system.
576 */
577 { 0x14, 1, "PLVL2" },
578 { 0x15, 1, "PLVL3" },
579 { 0x16, 2, "RESERVED" },
580#endif
581 { 0x18, 2, "GLBSTS" },
582 { 0x1A, 2, "RESERVED" },
583 { 0x1c, 4, "DEVSTS" },
584 { 0x20, 2, "GLBEN" },
585 { 0x22, 1, "RESERVED" },
586 { 0x23, 1, "RESERVED" },
587 { 0x24, 1, "RESERVED" },
588 { 0x25, 1, "RESERVED" },
589 { 0x26, 1, "RESERVED" },
590 { 0x27, 1, "RESERVED" },
591 { 0x28, 4, "GLBCTL" },
592 { 0x2C, 4, "DEVCTL" },
593 /* The registers 0x30-0x33 and 0x34-0x37 allow byte-wise reads only. */
594 { 0x30, 1, "GPIREG 0" },
595 { 0x31, 1, "GPIREG 1" },
596 { 0x32, 1, "GPIREG 2" },
597 { 0x33, 1, "GPIREG 3" },
598 { 0x34, 1, "GPOREG 0" },
599 { 0x35, 1, "GPOREG 1" },
600 { 0x36, 1, "GPOREG 2" },
601 { 0x37, 1, "GPOREG 3" },
602};
603
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100604static const io_register_t i63xx_pm_registers[] = {
605 { 0x00, 2, "PM1_STS" },
606 { 0x02, 2, "PM1_EN" },
607 { 0x04, 4, "PM1_CNT" },
608 { 0x08, 4, "PM1_TMR" },
609 { 0x0c, 4, "RESERVED" },
610 { 0x10, 4, "PROC_CNT" },
611#if DANGEROUS_REGISTERS
612 /* This register returns 0 on read, but reading it may cause
613 * the system to enter C2 state, which might hang the system.
614 */
615 { 0x14, 1, "LV2" },
616 { 0x15, 1, "RESERVED" },
617 { 0x16, 2, "RESERVED" },
618#endif
619 { 0x18, 4, "RESERVED" },
620 { 0x1c, 4, "RESERVED" },
621 { 0x20, 4, "RESERVED" },
622 { 0x24, 4, "RESERVED" },
623 { 0x28, 4, "GPE0_STS" },
624 { 0x2C, 4, "GPE0_EN" },
625 { 0x30, 4, "SMI_EN" },
626 { 0x34, 4, "SMI_STS" },
627 { 0x38, 2, "ALT_GP_SMI_EN" },
628 { 0x3a, 2, "ALT_GP_SMI_STS" },
629 { 0x3c, 4, "RESERVED" },
630 { 0x40, 4, "RESERVED" },
631 { 0x44, 2, "DEVACT_STS" },
632 { 0x46, 2, "RESERVED" },
633 { 0x48, 4, "RESERVED" },
634 { 0x4c, 4, "RESERVED" },
635 { 0x50, 4, "RESERVED" },
636 { 0x54, 4, "C3_RES" },
637 { 0x58, 4, "RESERVED" },
638 { 0x5c, 4, "RESERVED" },
639 { 0x60, 1, "RESERVED" },
640 { 0x64, 4, "RESERVED" },
641 { 0x68, 4, "RESERVED" },
642 { 0x6c, 4, "RESERVED" },
643 { 0x70, 4, "RESERVED" },
644 { 0x74, 4, "RESERVED" },
645 { 0x78, 4, "RESERVED" },
646 { 0x7c, 4, "RESERVED" },
647};
648
Tobias Diedrich3645e612010-11-27 14:44:19 +0000649int print_pmbase(struct pci_dev *sb, struct pci_access *pacc)
Stefan Reinauer23190272008-08-20 13:41:24 +0000650{
Stefan Reinauer1162f252008-12-04 15:18:20 +0000651 int i, size;
Stefan Reinauer23190272008-08-20 13:41:24 +0000652 uint16_t pmbase;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000653 const io_register_t *pm_registers;
Tobias Diedrich3645e612010-11-27 14:44:19 +0000654 struct pci_dev *acpi;
Stefan Reinauer23190272008-08-20 13:41:24 +0000655
656 printf("\n============= PMBASE ============\n\n");
657
658 switch (sb->device_id) {
Stefan Taunerb75a39a2014-11-01 17:12:37 +0100659 case PCI_DEVICE_ID_INTEL_3400:
660 case PCI_DEVICE_ID_INTEL_3420:
661 case PCI_DEVICE_ID_INTEL_3450:
662 case PCI_DEVICE_ID_INTEL_3400_DESKTOP:
663 case PCI_DEVICE_ID_INTEL_3400_MOBILE:
664 case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF:
665 case PCI_DEVICE_ID_INTEL_B55_A:
666 case PCI_DEVICE_ID_INTEL_B55_B:
667 case PCI_DEVICE_ID_INTEL_H55:
668 case PCI_DEVICE_ID_INTEL_H57:
669 case PCI_DEVICE_ID_INTEL_HM55:
670 case PCI_DEVICE_ID_INTEL_HM57:
671 case PCI_DEVICE_ID_INTEL_P55:
672 case PCI_DEVICE_ID_INTEL_PM55:
673 case PCI_DEVICE_ID_INTEL_Q57:
674 case PCI_DEVICE_ID_INTEL_QM57:
675 case PCI_DEVICE_ID_INTEL_QS57:
Nico Huber5ed986b2013-03-29 19:00:37 +0100676 case PCI_DEVICE_ID_INTEL_Z68:
677 case PCI_DEVICE_ID_INTEL_P67:
678 case PCI_DEVICE_ID_INTEL_UM67:
679 case PCI_DEVICE_ID_INTEL_HM65:
680 case PCI_DEVICE_ID_INTEL_H67:
681 case PCI_DEVICE_ID_INTEL_HM67:
682 case PCI_DEVICE_ID_INTEL_Q65:
683 case PCI_DEVICE_ID_INTEL_QS67:
684 case PCI_DEVICE_ID_INTEL_Q67:
685 case PCI_DEVICE_ID_INTEL_QM67:
686 case PCI_DEVICE_ID_INTEL_B65:
687 case PCI_DEVICE_ID_INTEL_C202:
688 case PCI_DEVICE_ID_INTEL_C204:
689 case PCI_DEVICE_ID_INTEL_C206:
690 case PCI_DEVICE_ID_INTEL_H61:
691 case PCI_DEVICE_ID_INTEL_Z77:
692 case PCI_DEVICE_ID_INTEL_Z75:
693 case PCI_DEVICE_ID_INTEL_Q77:
694 case PCI_DEVICE_ID_INTEL_Q75:
695 case PCI_DEVICE_ID_INTEL_B75:
696 case PCI_DEVICE_ID_INTEL_H77:
697 case PCI_DEVICE_ID_INTEL_C216:
698 case PCI_DEVICE_ID_INTEL_QM77:
699 case PCI_DEVICE_ID_INTEL_QS77:
700 case PCI_DEVICE_ID_INTEL_HM77:
701 case PCI_DEVICE_ID_INTEL_UM77:
702 case PCI_DEVICE_ID_INTEL_HM76:
703 case PCI_DEVICE_ID_INTEL_HM75:
704 case PCI_DEVICE_ID_INTEL_HM70:
Dennis Wassenbergae6685f2014-10-30 10:30:40 +0100705 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL:
706 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM:
707 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE:
Nico Huber5ed986b2013-03-29 19:00:37 +0100708 pmbase = pci_read_word(sb, 0x40) & 0xff80;
709 pm_registers = pch_pm_registers;
710 size = ARRAY_SIZE(pch_pm_registers);
711 break;
Warren Turkal3cf287d2010-09-03 09:36:37 +0000712 case PCI_DEVICE_ID_INTEL_ICH10R:
713 pmbase = pci_read_word(sb, 0x40) & 0xff80;
714 pm_registers = ich10_pm_registers;
715 size = ARRAY_SIZE(ich10_pm_registers);
716 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000717 case PCI_DEVICE_ID_INTEL_ICH7:
718 case PCI_DEVICE_ID_INTEL_ICH7M:
719 case PCI_DEVICE_ID_INTEL_ICH7DH:
720 case PCI_DEVICE_ID_INTEL_ICH7MDH:
Corey Osgoodf366ce02010-08-17 08:33:44 +0000721 case PCI_DEVICE_ID_INTEL_NM10:
Stefan Reinauer23190272008-08-20 13:41:24 +0000722 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000723 pm_registers = ich7_pm_registers;
724 size = ARRAY_SIZE(ich7_pm_registers);
725 break;
Anton Kochkovda0b4562010-05-30 12:33:12 +0000726 case PCI_DEVICE_ID_INTEL_ICH9DH:
727 case PCI_DEVICE_ID_INTEL_ICH9DO:
728 case PCI_DEVICE_ID_INTEL_ICH9R:
729 case PCI_DEVICE_ID_INTEL_ICH9:
730 case PCI_DEVICE_ID_INTEL_ICH9M:
731 case PCI_DEVICE_ID_INTEL_ICH9ME:
732 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
733 pm_registers = ich9_pm_registers;
734 size = ARRAY_SIZE(ich9_pm_registers);
735 break;
Corey Osgoodf366ce02010-08-17 08:33:44 +0000736 case PCI_DEVICE_ID_INTEL_ICH8:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000737 case PCI_DEVICE_ID_INTEL_ICH8M:
738 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
739 pm_registers = ich8_pm_registers;
740 size = ARRAY_SIZE(ich8_pm_registers);
Stefan Reinauer23190272008-08-20 13:41:24 +0000741 break;
Pat Erleyca3548e2010-04-21 06:23:19 +0000742 case PCI_DEVICE_ID_INTEL_ICH6:
743 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
744 pm_registers = ich6_pm_registers;
745 size = ARRAY_SIZE(ich6_pm_registers);
746 break;
Idwer Vollering312fc962010-12-17 22:34:58 +0000747 case PCI_DEVICE_ID_INTEL_ICH5:
748 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
749 pm_registers = ich5_pm_registers;
750 size = ARRAY_SIZE(ich5_pm_registers);
751 break;
Stefan Reinauer04844812010-02-22 11:26:06 +0000752 case PCI_DEVICE_ID_INTEL_ICH4:
753 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
754 pm_registers = ich4_pm_registers;
755 size = ARRAY_SIZE(ich4_pm_registers);
756 break;
Joseph Smithe10757e2010-06-16 22:21:19 +0000757 case PCI_DEVICE_ID_INTEL_ICH2:
758 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
759 pm_registers = ich2_pm_registers;
760 size = ARRAY_SIZE(ich2_pm_registers);
761 break;
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000762 case PCI_DEVICE_ID_INTEL_ICH0:
763 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
764 pm_registers = ich0_pm_registers;
765 size = ARRAY_SIZE(ich0_pm_registers);
766 break;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000767 case PCI_DEVICE_ID_INTEL_82371XX:
Tobias Diedrich3645e612010-11-27 14:44:19 +0000768 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 3);
769 if (!acpi) {
770 printf("Southbridge function 3 not found.\n");
771 return 1;
772 }
773 pmbase = pci_read_word(acpi, 0x40) & 0xfffc;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000774 pm_registers = i82371xx_pm_registers;
775 size = ARRAY_SIZE(i82371xx_pm_registers);
776 break;
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100777
778 case PCI_DEVICE_ID_INTEL_I63XX:
779 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
780 pm_registers = i63xx_pm_registers;
781 size = ARRAY_SIZE(i63xx_pm_registers);
782 break;
783
Stefan Reinauer23190272008-08-20 13:41:24 +0000784 case 0x1234: // Dummy for non-existent functionality
785 printf("This southbridge does not have PMBASE.\n");
786 return 1;
787 default:
788 printf("Error: Dumping PMBASE on this southbridge is not (yet) supported.\n");
789 return 1;
790 }
791
792 printf("PMBASE = 0x%04x (IO)\n\n", pmbase);
793
Stefan Reinauer1162f252008-12-04 15:18:20 +0000794 for (i = 0; i < size; i++) {
795 switch (pm_registers[i].size) {
Nico Huberaa5eae62012-09-24 10:58:41 +0200796 case 8:
797 printf("pmbase+0x%04x: 0x%08x (%s)\n"
798 " 0x%08x\n",
799 pm_registers[i].addr,
800 inl(pmbase+pm_registers[i].addr),
801 pm_registers[i].name,
802 inl(pmbase+pm_registers[i].addr+4));
803 break;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000804 case 4:
805 printf("pmbase+0x%04x: 0x%08x (%s)\n",
806 pm_registers[i].addr,
807 inl(pmbase+pm_registers[i].addr),
808 pm_registers[i].name);
809 break;
810 case 2:
811 printf("pmbase+0x%04x: 0x%04x (%s)\n",
812 pm_registers[i].addr,
813 inw(pmbase+pm_registers[i].addr),
814 pm_registers[i].name);
815 break;
816 case 1:
817 printf("pmbase+0x%04x: 0x%02x (%s)\n",
818 pm_registers[i].addr,
819 inb(pmbase+pm_registers[i].addr),
820 pm_registers[i].name);
821 break;
822 }
Stefan Reinauer23190272008-08-20 13:41:24 +0000823 }
824
825 return 0;
826}