blob: 71dfc49af22b65193ee7113854d188f99a785436 [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
Warren Turkal3cf287d2010-09-03 09:36:37 +000024static const io_register_t ich10_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, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
31#if DANGEROUS_REGISTERS
32 /* These registers return 0 on read, but reading them may cause
33 * the system to enter Cx states, which might hang the system.
34 */
35 { 0x14, 1, "LV2 (Mobile)" },
36 { 0x15, 1, "LV3 (Mobile)" },
37 { 0x16, 1, "LV4 (Mobile)" },
38#endif
39 { 0x17, 2, "RESERVED" },
40 { 0x19, 1, "RESERVED" },
41 { 0x1a, 2, "RESERVED" },
42 { 0x1c, 4, "RESERVED" },
43 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +020044 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Warren Turkal3cf287d2010-09-03 09:36:37 +000045 { 0x30, 4, "SMI_EN" },
46 { 0x34, 4, "SMI_STS" },
47 { 0x38, 2, "ALT_GP_SMI_EN" },
48 { 0x3a, 2, "ALT_GP_SMI_STS" },
49 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
50 { 0x3d, 2, "RESERVED" },
51 { 0x3f, 1, "RESERVED" },
52 { 0x40, 2, "RESERVED" },
53 { 0x42, 1, "GPE_CNTL" },
54 { 0x43, 1, "RESERVED" },
55 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
56 { 0x46, 2, "RESERVED" },
57 { 0x48, 4, "RESERVED" },
58 { 0x4c, 4, "RESERVED" },
59 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
60 { 0x51, 1, "RESERVED" },
61 { 0x52, 2, "RESERVED" },
62 { 0x54, 4, "C3_RES (Mobile)" },
63 { 0x58, 4, "RESERVED" },
64 { 0x5c, 4, "RESERVED" },
65 /* Here start the TCO registers */
66 { 0x60, 2, "TCO_RLD" },
67 { 0x62, 1, "TCO_DAT_IN" },
68 { 0x63, 1, "TCO_DAT_OUT" },
69 { 0x64, 2, "TCO1_STS" },
70 { 0x66, 2, "TCO2_STS" },
71 { 0x68, 2, "TCO1_CNT" },
72 { 0x6a, 2, "TCO2_CNT" },
73 { 0x6c, 2, "TCO_MESSAGE" },
74 { 0x6e, 1, "TCO_WDCNT" },
75 { 0x6f, 1, "RESERVED" },
76 { 0x70, 1, "SW_IRQ_GEN" },
77 { 0x71, 1, "RESERVED" },
78 { 0x72, 2, "TCO_TMR" },
79 { 0x74, 4, "RESERVED" },
80 { 0x78, 4, "RESERVED" },
81 { 0x7c, 4, "RESERVED" },
82};
83
Anton Kochkovda0b4562010-05-30 12:33:12 +000084static const io_register_t ich9_pm_registers[] = {
85 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
86 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
87 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
88 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +000089 { 0x0c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +000090 { 0x10, 4, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +000091#if DANGEROUS_REGISTERS
92 /* These registers return 0 on read, but reading them may cause
Anton Kochkovda0b4562010-05-30 12:33:12 +000093 * the system to enter Cx states, which might hang the system.
Stefan Reinauer1162f252008-12-04 15:18:20 +000094 */
Anton Kochkovda0b4562010-05-30 12:33:12 +000095 { 0x14, 1, "LV2 (Mobile)" },
96 { 0x15, 1, "LV3 (Mobile)" },
97 { 0x16, 1, "LV4 (Mobile)" },
98 { 0x17, 1, "LV5 (Mobile)" },
99 { 0x18, 1, "LV6 (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000100#endif
Anton Kochkovda0b4562010-05-30 12:33:12 +0000101 { 0x19, 1, "RESERVED" },
102 { 0x1a, 2, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000103 { 0x1c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000104 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +0200105 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Stefan Reinauer1162f252008-12-04 15:18:20 +0000106 { 0x30, 4, "SMI_EN" },
107 { 0x34, 4, "SMI_STS" },
108 { 0x38, 2, "ALT_GP_SMI_EN" },
109 { 0x3a, 2, "ALT_GP_SMI_STS" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000110 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
111 { 0x3d, 2, "RESERVED" },
112 { 0x3f, 1, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000113 { 0x40, 2, "RESERVED" },
114 { 0x42, 1, "GPE_CNTL" },
115 { 0x43, 1, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000116 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
Stefan Reinauer1162f252008-12-04 15:18:20 +0000117 { 0x46, 2, "RESERVED" },
118 { 0x48, 4, "RESERVED" },
119 { 0x4c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000120 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000121 { 0x51, 1, "RESERVED" },
122 { 0x52, 2, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000123 { 0x54, 4, "C3_RES (Mobile)" },
124 { 0x58, 4, "C5_RES (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000125 { 0x5c, 4, "RESERVED" },
126 /* Here start the TCO registers */
127 { 0x60, 2, "TCO_RLD" },
128 { 0x62, 1, "TCO_DAT_IN" },
129 { 0x63, 1, "TCO_DAT_OUT" },
130 { 0x64, 2, "TCO1_STS" },
131 { 0x66, 2, "TCO2_STS" },
132 { 0x68, 2, "TCO1_CNT" },
133 { 0x6a, 2, "TCO2_CNT" },
134 { 0x6c, 2, "TCO_MESSAGE" },
135 { 0x6e, 1, "TCO_WDCNT" },
136 { 0x6f, 1, "RESERVED" },
137 { 0x70, 1, "SW_IRQ_GEN" },
138 { 0x71, 1, "RESERVED" },
139 { 0x72, 2, "TCO_TMR" },
140 { 0x74, 4, "RESERVED" },
141 { 0x78, 4, "RESERVED" },
142 { 0x7c, 4, "RESERVED" },
143};
144
145static const io_register_t ich8_pm_registers[] = {
146 { 0x00, 2, "PM1_STS" },
147 { 0x02, 2, "PM1_EN" },
148 { 0x04, 4, "PM1_CNT" },
149 { 0x08, 4, "PM1_TMR" },
150 { 0x0c, 4, "RESERVED" },
151 { 0x10, 4, "PROC_CNT" },
152#if DANGEROUS_REGISTERS
153 /* These registers return 0 on read, but reading them may cause
154 * the system to enter Cx states, which might hang the system.
155 */
156 { 0x14, 1, "LV2 (Mobile)" },
157 { 0x15, 1, "LV3 (Mobile)" },
158 { 0x16, 1, "LV4 (Mobile)" },
159 { 0x17, 1, "LV5 (Mobile)" },
160 { 0x18, 1, "LV6 (Mobile)" },
161#endif
162 { 0x19, 1, "RESERVED" },
163 { 0x1a, 2, "RESERVED" },
164 { 0x1c, 4, "RESERVED" },
165 { 0x20, 1, "PM2_CNT (Mobile)" },
166 { 0x21, 1, "RESERVED" },
167 { 0x22, 2, "RESERVED" },
168 { 0x24, 4, "RESERVED" },
169 { 0x28, 4, "GPE0_STS" },
170 { 0x2C, 4, "GPE0_EN" },
171 { 0x30, 4, "SMI_EN" },
172 { 0x34, 4, "SMI_STS" },
173 { 0x38, 2, "ALT_GP_SMI_EN" },
174 { 0x3a, 2, "ALT_GP_SMI_STS" },
175 { 0x3c, 4, "RESERVED" },
176 { 0x40, 2, "RESERVED" },
177 { 0x42, 1, "GPE_CNTL" },
178 { 0x43, 1, "RESERVED" },
179 { 0x44, 2, "DEVACT_STS" },
180 { 0x46, 2, "RESERVED" },
181 { 0x48, 4, "RESERVED" },
182 { 0x4c, 4, "RESERVED" },
183 { 0x50, 1, "SS_CNT (Mobile)" },
184 { 0x51, 1, "RESERVED" },
185 { 0x52, 2, "RESERVED" },
186 { 0x54, 4, "C3_RES (Mobile)" },
187 { 0x58, 4, "C5_RES (Mobile)" },
188 { 0x5c, 4, "RESERVED" },
189 /* Here start the TCO registers */
190 { 0x60, 2, "TCO_RLD" },
191 { 0x62, 1, "TCO_DAT_IN" },
192 { 0x63, 1, "TCO_DAT_OUT" },
193 { 0x64, 2, "TCO1_STS" },
194 { 0x66, 2, "TCO2_STS" },
195 { 0x68, 2, "TCO1_CNT" },
196 { 0x6a, 2, "TCO2_CNT" },
197 { 0x6c, 2, "TCO_MESSAGE" },
198 { 0x6e, 1, "TCO_WDCNT" },
199 { 0x6f, 1, "RESERVED" },
200 { 0x70, 1, "SW_IRQ_GEN" },
201 { 0x71, 1, "RESERVED" },
202 { 0x72, 2, "TCO_TMR" },
203 { 0x74, 4, "RESERVED" },
204 { 0x78, 4, "RESERVED" },
205 { 0x7c, 4, "RESERVED" },
206};
207
Anton Kochkovda0b4562010-05-30 12:33:12 +0000208static const io_register_t ich7_pm_registers[] = {
209 { 0x00, 2, "PM1_STS" },
210 { 0x02, 2, "PM1_EN" },
211 { 0x04, 4, "PM1_CNT" },
212 { 0x08, 4, "PM1_TMR" },
213 { 0x0c, 4, "RESERVED" },
214 { 0x10, 4, "PROC_CNT" },
215#if DANGEROUS_REGISTERS
216 /* These registers return 0 on read, but reading them may cause
217 * the system to enter C2/C3/C4 state, which might hang the system.
218 */
219 { 0x14, 1, "LV2 (Mobile/Ultra Mobile)" },
220 { 0x15, 1, "LV3 (Mobile/Ultra Mobile)" },
221 { 0x16, 1, "LV4 (Mobile/Ultra Mobile)" },
222#endif
223 { 0x17, 1, "RESERVED" },
224 { 0x18, 4, "RESERVED" },
225 { 0x1c, 4, "RESERVED" },
226 { 0x20, 1, "PM2_CNT (Mobile/Ultra Mobile)" },
227 { 0x21, 1, "RESERVED" },
228 { 0x22, 2, "RESERVED" },
229 { 0x24, 4, "RESERVED" },
230 { 0x28, 4, "GPE0_STS" },
231 { 0x2C, 4, "GPE0_EN" },
232 { 0x30, 4, "SMI_EN" },
233 { 0x34, 4, "SMI_STS" },
234 { 0x38, 2, "ALT_GP_SMI_EN" },
235 { 0x3a, 2, "ALT_GP_SMI_STS" },
236 { 0x3c, 4, "RESERVED" },
237 { 0x40, 2, "RESERVED" },
238 { 0x42, 1, "GPE_CNTL" },
239 { 0x43, 1, "RESERVED" },
240 { 0x44, 2, "DEVACT_STS" },
241 { 0x46, 2, "RESERVED" },
242 { 0x48, 4, "RESERVED" },
243 { 0x4c, 4, "RESERVED" },
244 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
245 { 0x51, 1, "RESERVED" },
246 { 0x52, 2, "RESERVED" },
247 { 0x54, 4, "C3_RES (Mobile/Ultra Mobile)" },
248 { 0x58, 4, "RESERVED" },
249 { 0x5c, 4, "RESERVED" },
250 /* Here start the TCO registers */
251 { 0x60, 2, "TCO_RLD" },
252 { 0x62, 1, "TCO_DAT_IN" },
253 { 0x63, 1, "TCO_DAT_OUT" },
254 { 0x64, 2, "TCO1_STS" },
255 { 0x66, 2, "TCO2_STS" },
256 { 0x68, 2, "TCO1_CNT" },
257 { 0x6a, 2, "TCO2_CNT" },
258 { 0x6c, 2, "TCO_MESSAGE" },
259 { 0x6e, 1, "TCO_WDCNT" },
260 { 0x6f, 1, "RESERVED" },
261 { 0x70, 1, "SW_IRQ_GEN" },
262 { 0x71, 1, "RESERVED" },
263 { 0x72, 2, "TCO_TMR" },
264 { 0x74, 4, "RESERVED" },
265 { 0x78, 4, "RESERVED" },
266 { 0x7c, 4, "RESERVED" },
267};
268
Stefan Reinauer14e22772010-04-27 06:56:47 +0000269/*
Pat Erleyca3548e2010-04-21 06:23:19 +0000270 * INTEL I/O Controller Hub 6 Family
271 * http://www.intel.com/assets/pdf/datasheet/301473.pdf
272 */
273static const io_register_t ich6_pm_registers[] = {
274 /* 10.8.3 */
275 { 0x00, 2, "PM1_STS" },
276 { 0x02, 2, "PM1_EN" },
277 { 0x04, 4, "PM1_CNT" },
278 { 0x08, 4, "PM1_TMR" },
279 { 0x10, 4, "PROC_CNT" },
280#if DANGEROUS_REGISTERS
281 /* These registers return 0 on read, but reading them may cause
282 * the system to enter C2/C3/C4 state, which might hang the system.
283 */
284 { 0x14, 1, "LV2" },
285 { 0x15, 1, "LV3 (Mobile Only)" },
286 { 0x16, 1, "LV4 (Mobile Only)" },
287#endif
288 { 0x20, 1, "PM2_CNT (Mobile Only)" },
289 { 0x28, 4, "GPE0_STS" },
290 { 0x2c, 4, "GPE0_EN" },
291 { 0x30, 4, "SMI_EN" },
292 { 0x34, 4, "SMI_STS" },
293 { 0x38, 2, "ALT_GP_SMI_EN" },
294 { 0x3a, 2, "ALT_GP_SMI_STS" },
295 { 0x44, 2, "DEVACT_STS" },
296 { 0x50, 1, "SS_CNT (Mobile Only)" },
297 { 0x54, 4, "C3_RES (Mobile Only)" },
298};
299
Idwer Vollering312fc962010-12-17 22:34:58 +0000300static const io_register_t ich5_pm_registers[] = {
301 { 0x00, 2, "PM1_STS" },
302 { 0x02, 2, "PM1_EN" },
303 { 0x04, 4, "PM1_CNT" },
304 { 0x08, 4, "PM1_TMR" },
305 { 0x0c, 4, "RESERVED" },
306 { 0x10, 4, "PROC_CNT" },
307 { 0x14, 3, "RESERVED" },
308 { 0x17, 9, "RESERVED" },
309 { 0x20, 1, "RESERVED" },
310 { 0x28, 4, "GPE0_STS" },
311 { 0x2c, 4, "GPE0_EN" },
312 { 0x30, 4, "SMI_EN" },
313 { 0x34, 4, "SMI_STS" },
314 { 0x38, 2, "ALT_GP_SMI_EN" },
315 { 0x3a, 2, "ALT_GP_SMI_STS" },
316 { 0x3c, 4, "RESERVED" },
317 { 0x40, 1, "MON_SMI" },
318 { 0x42, 2, "RESERVED" },
319 { 0x44, 1, "DEVACT_STS" },
320 { 0x48, 1, "DEVTRAP_EN" },
321 { 0x50, 1, "RESERVED" },
322 { 0x51, 15, "RESERVED" },
323 { 0x60, 16, "RESERVED" },
324};
325
Stefan Reinauer04844812010-02-22 11:26:06 +0000326static const io_register_t ich4_pm_registers[] = {
327 { 0x00, 2, "PM1_STS" },
328 { 0x02, 2, "PM1_EN" },
329 { 0x04, 4, "PM1_CNT" },
330 { 0x08, 4, "PM1_TMR" },
331 { 0x0c, 4, "RESERVED" },
332 { 0x10, 4, "PROC_CNT" },
333#if DANGEROUS_REGISTERS
334 /* These registers return 0 on read, but reading them may cause
335 * the system to enter C2/C3/C4 state, which might hang the system.
336 */
337 { 0x14, 1, "LV2 (Mobile)" },
338 { 0x15, 1, "LV3 (Mobile)" },
339 { 0x16, 1, "LV4 (Mobile)" },
340#endif
341 { 0x17, 1, "RESERVED" },
342 { 0x18, 4, "RESERVED" },
343 { 0x1c, 4, "RESERVED" },
344 { 0x20, 1, "PM2_CNT (Mobile)" },
345 { 0x21, 1, "RESERVED" },
346 { 0x22, 2, "RESERVED" },
347 { 0x24, 4, "RESERVED" },
348 { 0x28, 4, "GPE0_STS" },
349 { 0x2C, 4, "GPE0_EN" },
350 { 0x30, 4, "SMI_EN" },
351 { 0x34, 4, "SMI_STS" },
352 { 0x38, 2, "ALT_GP_SMI_EN" },
353 { 0x3a, 2, "ALT_GP_SMI_STS" },
354 { 0x3c, 4, "RESERVED" },
355 { 0x40, 2, "MON_SMI" },
356 { 0x42, 2, "RESERVED" },
357 { 0x44, 2, "DEVACT_STS" },
358 { 0x46, 2, "RESERVED" },
359 { 0x48, 4, "DEVTRAP_EN" },
360 { 0x4c, 2, "BUS_ADDR_TRACK" },
361 { 0x4e, 2, "BUS_CYC_TRACK" },
362 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
363 { 0x51, 1, "RESERVED" },
364 { 0x52, 2, "RESERVED" },
365 { 0x54, 4, "RESERVED" },
366 { 0x58, 4, "RESERVED" },
367 { 0x5c, 4, "RESERVED" },
368 /* Here start the TCO registers */
369 { 0x60, 1, "TCO_RLD" },
370 { 0x61, 1, "TCO_TMR" },
371 { 0x62, 1, "TCO_DAT_IN" },
372 { 0x63, 1, "TCO_DAT_OUT" },
373 { 0x64, 2, "TCO1_STS" },
374 { 0x66, 2, "TCO2_STS" },
375 { 0x68, 2, "TCO1_CNT" },
376 { 0x6a, 2, "TCO2_CNT" },
377 { 0x6c, 2, "TCO_MESSAGE" },
378 { 0x6e, 1, "TCO_WDSTATUS" },
379 { 0x6f, 1, "RESERVED" },
380 { 0x70, 1, "SW_IRQ_GEN" },
381 { 0x71, 1, "RESERVED" },
382 { 0x72, 2, "RESERVED" },
383 { 0x74, 4, "RESERVED" },
384 { 0x78, 4, "RESERVED" },
385 { 0x7c, 4, "RESERVED" },
386};
387
Joseph Smithe10757e2010-06-16 22:21:19 +0000388static const io_register_t ich2_pm_registers[] = {
389 { 0x00, 2, "PM1_STS" },
390 { 0x02, 2, "PM1_EN" },
391 { 0x04, 4, "PM1_CNT" },
392 { 0x08, 4, "PM1_TMR" },
393 { 0x0c, 4, "RESERVED" },
394 { 0x10, 4, "PROC_CNT" },
395#if DANGEROUS_REGISTERS
396 /* This register returns 0 on read, but reading it may cause
397 * the system to enter C2 state, which might hang the system.
398 */
399 { 0x14, 1, "LV2" },
400 { 0x15, 1, "RESERVED" },
401 { 0x16, 2, "RESERVED" },
402#endif
403 { 0x18, 4, "RESERVED" },
404 { 0x1c, 4, "RESERVED" },
405 { 0x20, 4, "RESERVED" },
406 { 0x24, 4, "RESERVED" },
407 { 0x28, 2, "GPE0_STS" },
408 { 0x2a, 2, "GPE0_EN" },
409 { 0x2c, 2, "GPE1_STS" },
410 { 0x2e, 2, "GPE1_EN" },
411 { 0x30, 2, "SMI_EN" },
412 { 0x32, 2, "RESERVED" },
413 { 0x34, 2, "SMI_STS" },
414 { 0x36, 2, "RESERVED" },
415 { 0x38, 4, "RESERVED" },
416 { 0x3c, 4, "RESERVED" },
417 { 0x40, 2, "MON_SMI_STS" },
418 { 0x42, 2, "RESERVED" },
419 { 0x44, 2, "DEV_TRP_STS" },
420 { 0x46, 2, "RESERVED" },
421 { 0x48, 2, "TRP_EN" },
422 { 0x4A, 2, "RESERVED" },
423 { 0x4c, 2, "BUS_ADDR_TRACK" },
424 { 0x4e, 1, "BUS_CYC_TRACK" },
425 { 0x4f, 1, "RESERVED" },
426 { 0x50, 4, "RESERVED" },
427 { 0x54, 4, "RESERVED" },
428 { 0x58, 4, "RESERVED" },
429 { 0x5c, 4, "RESERVED" },
430 /* Here start the TCO registers */
431 { 0x60, 1, "TCO_RLD" },
432 { 0x61, 1, "TCO_TMR" },
433 { 0x62, 1, "TCO_DAT_IN" },
434 { 0x63, 1, "TCO_DAT_OUT" },
435 { 0x64, 2, "TCO1_STS" },
436 { 0x66, 2, "TCO2_STS" },
437 { 0x68, 2, "TCO1_CNT" },
438 { 0x6a, 2, "TCO2_CNT" },
439 { 0x6c, 1, "TCO_MESSAGE1" },
440 { 0x6d, 1, "TCO_MESSAGE2" },
441 { 0x6e, 1, "TCO_WDSTATUS" },
442 { 0x6f, 1, "RESERVED" },
443 { 0x70, 1, "SW_IRQ_GEN" },
444 { 0x71, 1, "RESERVED" },
445 { 0x72, 2, "RESERVED" },
446 { 0x74, 4, "RESERVED" },
447 { 0x78, 4, "RESERVED" },
448 { 0x7c, 4, "RESERVED" },
449};
450
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000451static const io_register_t ich0_pm_registers[] = {
452 { 0x00, 2, "PM1_STS" },
453 { 0x02, 2, "PM1_EN" },
454 { 0x04, 4, "PM1_CNT" },
455 { 0x08, 4, "PM1_TMR" },
456 { 0x0c, 4, "RESERVED" },
457 { 0x10, 4, "PROC_CNT" },
458#if DANGEROUS_REGISTERS
459 /* This register returns 0 on read, but reading it may cause
460 * the system to enter C2 state, which might hang the system.
461 */
462 { 0x14, 1, "LV2" },
463 { 0x15, 1, "RESERVED" },
464 { 0x16, 2, "RESERVED" },
465#endif
466 { 0x18, 4, "RESERVED" },
467 { 0x1c, 4, "RESERVED" },
468 { 0x20, 4, "RESERVED" },
469 { 0x24, 4, "RESERVED" },
470 { 0x28, 4, "GPE0_STS" },
471 { 0x2C, 4, "GPE0_EN" },
472 { 0x30, 2, "SMI_EN" },
473 { 0x32, 2, "RESERVED" },
474 { 0x34, 2, "SMI_STS" },
475 { 0x36, 2, "RESERVED" },
476 { 0x38, 4, "RESERVED" },
477 { 0x3c, 4, "RESERVED" },
478 { 0x40, 2, "IOMON_STS_EN" },
479 { 0x42, 2, "RESERVED" },
480 { 0x44, 2, "DEVACT_STS" },
481 { 0x46, 2, "RESERVED" },
482 { 0x48, 4, "RESERVED" },
483 { 0x4c, 2, "BUS_ADDR_TRACK" },
484 { 0x4e, 1, "BUS_CYC_TRACK" },
485 { 0x4f, 1, "RESERVED" },
486 { 0x50, 4, "RESERVED" },
487 { 0x54, 4, "RESERVED" },
488 { 0x58, 4, "RESERVED" },
489 { 0x5c, 4, "RESERVED" },
490 /* Here start the TCO registers */
491 { 0x60, 1, "TCO_RLD" },
492 { 0x61, 1, "TCO_TMR" },
493 { 0x62, 1, "TCO_DAT_IN" },
494 { 0x63, 1, "TCO_DAT_OUT" },
495 { 0x64, 2, "TCO1_STS" },
496 { 0x66, 2, "TCO2_STS" },
497 { 0x68, 2, "TCO1_CNT" },
498 { 0x6a, 2, "TCO2_CNT" },
499 { 0x6c, 1, "TCO_MESSAGE1" },
500 { 0x6d, 1, "TCO_MESSAGE2" },
501 { 0x6e, 1, "TCO_WDSTATUS" },
502 { 0x6f, 1, "RESERVED" },
503 { 0x70, 4, "RESERVED" },
504 { 0x74, 4, "RESERVED" },
505 { 0x78, 4, "RESERVED" },
506 { 0x7c, 4, "RESERVED" },
507};
508
Maciej Pijanka90d17402009-09-30 17:05:46 +0000509static const io_register_t i82371xx_pm_registers[] = {
510 { 0x00, 2, "PMSTS" },
511 { 0x02, 2, "PMEN" },
512 { 0x04, 2, "PMCNTRL" },
513 { 0x06, 2, "RESERVED" },
514 { 0x08, 1, "PMTMR" },
515 { 0x09, 1, "RESERVED" },
516 { 0x0A, 1, "RESERVED" },
517 { 0x0B, 1, "RESERVED" },
518 { 0x0C, 2, "GPSTS" },
519 { 0x0E, 2, "GPEN" },
520 { 0x10, 4, "PCNTRL" },
521#if DANGEROUS_REGISTERS
522 /*
523 * This register returns 0 on read, but reading it may cause
524 * the system to enter C2 state, which might hang the system.
525 */
526 { 0x14, 1, "PLVL2" },
527 { 0x15, 1, "PLVL3" },
528 { 0x16, 2, "RESERVED" },
529#endif
530 { 0x18, 2, "GLBSTS" },
531 { 0x1A, 2, "RESERVED" },
532 { 0x1c, 4, "DEVSTS" },
533 { 0x20, 2, "GLBEN" },
534 { 0x22, 1, "RESERVED" },
535 { 0x23, 1, "RESERVED" },
536 { 0x24, 1, "RESERVED" },
537 { 0x25, 1, "RESERVED" },
538 { 0x26, 1, "RESERVED" },
539 { 0x27, 1, "RESERVED" },
540 { 0x28, 4, "GLBCTL" },
541 { 0x2C, 4, "DEVCTL" },
542 /* The registers 0x30-0x33 and 0x34-0x37 allow byte-wise reads only. */
543 { 0x30, 1, "GPIREG 0" },
544 { 0x31, 1, "GPIREG 1" },
545 { 0x32, 1, "GPIREG 2" },
546 { 0x33, 1, "GPIREG 3" },
547 { 0x34, 1, "GPOREG 0" },
548 { 0x35, 1, "GPOREG 1" },
549 { 0x36, 1, "GPOREG 2" },
550 { 0x37, 1, "GPOREG 3" },
551};
552
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100553static const io_register_t i63xx_pm_registers[] = {
554 { 0x00, 2, "PM1_STS" },
555 { 0x02, 2, "PM1_EN" },
556 { 0x04, 4, "PM1_CNT" },
557 { 0x08, 4, "PM1_TMR" },
558 { 0x0c, 4, "RESERVED" },
559 { 0x10, 4, "PROC_CNT" },
560#if DANGEROUS_REGISTERS
561 /* This register returns 0 on read, but reading it may cause
562 * the system to enter C2 state, which might hang the system.
563 */
564 { 0x14, 1, "LV2" },
565 { 0x15, 1, "RESERVED" },
566 { 0x16, 2, "RESERVED" },
567#endif
568 { 0x18, 4, "RESERVED" },
569 { 0x1c, 4, "RESERVED" },
570 { 0x20, 4, "RESERVED" },
571 { 0x24, 4, "RESERVED" },
572 { 0x28, 4, "GPE0_STS" },
573 { 0x2C, 4, "GPE0_EN" },
574 { 0x30, 4, "SMI_EN" },
575 { 0x34, 4, "SMI_STS" },
576 { 0x38, 2, "ALT_GP_SMI_EN" },
577 { 0x3a, 2, "ALT_GP_SMI_STS" },
578 { 0x3c, 4, "RESERVED" },
579 { 0x40, 4, "RESERVED" },
580 { 0x44, 2, "DEVACT_STS" },
581 { 0x46, 2, "RESERVED" },
582 { 0x48, 4, "RESERVED" },
583 { 0x4c, 4, "RESERVED" },
584 { 0x50, 4, "RESERVED" },
585 { 0x54, 4, "C3_RES" },
586 { 0x58, 4, "RESERVED" },
587 { 0x5c, 4, "RESERVED" },
588 { 0x60, 1, "RESERVED" },
589 { 0x64, 4, "RESERVED" },
590 { 0x68, 4, "RESERVED" },
591 { 0x6c, 4, "RESERVED" },
592 { 0x70, 4, "RESERVED" },
593 { 0x74, 4, "RESERVED" },
594 { 0x78, 4, "RESERVED" },
595 { 0x7c, 4, "RESERVED" },
596};
597
Tobias Diedrich3645e612010-11-27 14:44:19 +0000598int print_pmbase(struct pci_dev *sb, struct pci_access *pacc)
Stefan Reinauer23190272008-08-20 13:41:24 +0000599{
Stefan Reinauer1162f252008-12-04 15:18:20 +0000600 int i, size;
Stefan Reinauer23190272008-08-20 13:41:24 +0000601 uint16_t pmbase;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000602 const io_register_t *pm_registers;
Tobias Diedrich3645e612010-11-27 14:44:19 +0000603 struct pci_dev *acpi;
Stefan Reinauer23190272008-08-20 13:41:24 +0000604
605 printf("\n============= PMBASE ============\n\n");
606
607 switch (sb->device_id) {
Warren Turkal3cf287d2010-09-03 09:36:37 +0000608 case PCI_DEVICE_ID_INTEL_ICH10R:
609 pmbase = pci_read_word(sb, 0x40) & 0xff80;
610 pm_registers = ich10_pm_registers;
611 size = ARRAY_SIZE(ich10_pm_registers);
612 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000613 case PCI_DEVICE_ID_INTEL_ICH7:
614 case PCI_DEVICE_ID_INTEL_ICH7M:
615 case PCI_DEVICE_ID_INTEL_ICH7DH:
616 case PCI_DEVICE_ID_INTEL_ICH7MDH:
Corey Osgoodf366ce02010-08-17 08:33:44 +0000617 case PCI_DEVICE_ID_INTEL_NM10:
Stefan Reinauer23190272008-08-20 13:41:24 +0000618 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000619 pm_registers = ich7_pm_registers;
620 size = ARRAY_SIZE(ich7_pm_registers);
621 break;
Anton Kochkovda0b4562010-05-30 12:33:12 +0000622 case PCI_DEVICE_ID_INTEL_ICH9DH:
623 case PCI_DEVICE_ID_INTEL_ICH9DO:
624 case PCI_DEVICE_ID_INTEL_ICH9R:
625 case PCI_DEVICE_ID_INTEL_ICH9:
626 case PCI_DEVICE_ID_INTEL_ICH9M:
627 case PCI_DEVICE_ID_INTEL_ICH9ME:
628 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
629 pm_registers = ich9_pm_registers;
630 size = ARRAY_SIZE(ich9_pm_registers);
631 break;
Corey Osgoodf366ce02010-08-17 08:33:44 +0000632 case PCI_DEVICE_ID_INTEL_ICH8:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000633 case PCI_DEVICE_ID_INTEL_ICH8M:
634 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
635 pm_registers = ich8_pm_registers;
636 size = ARRAY_SIZE(ich8_pm_registers);
Stefan Reinauer23190272008-08-20 13:41:24 +0000637 break;
Pat Erleyca3548e2010-04-21 06:23:19 +0000638 case PCI_DEVICE_ID_INTEL_ICH6:
639 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
640 pm_registers = ich6_pm_registers;
641 size = ARRAY_SIZE(ich6_pm_registers);
642 break;
Idwer Vollering312fc962010-12-17 22:34:58 +0000643 case PCI_DEVICE_ID_INTEL_ICH5:
644 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
645 pm_registers = ich5_pm_registers;
646 size = ARRAY_SIZE(ich5_pm_registers);
647 break;
Stefan Reinauer04844812010-02-22 11:26:06 +0000648 case PCI_DEVICE_ID_INTEL_ICH4:
649 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
650 pm_registers = ich4_pm_registers;
651 size = ARRAY_SIZE(ich4_pm_registers);
652 break;
Joseph Smithe10757e2010-06-16 22:21:19 +0000653 case PCI_DEVICE_ID_INTEL_ICH2:
654 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
655 pm_registers = ich2_pm_registers;
656 size = ARRAY_SIZE(ich2_pm_registers);
657 break;
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000658 case PCI_DEVICE_ID_INTEL_ICH0:
659 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
660 pm_registers = ich0_pm_registers;
661 size = ARRAY_SIZE(ich0_pm_registers);
662 break;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000663 case PCI_DEVICE_ID_INTEL_82371XX:
Tobias Diedrich3645e612010-11-27 14:44:19 +0000664 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 3);
665 if (!acpi) {
666 printf("Southbridge function 3 not found.\n");
667 return 1;
668 }
669 pmbase = pci_read_word(acpi, 0x40) & 0xfffc;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000670 pm_registers = i82371xx_pm_registers;
671 size = ARRAY_SIZE(i82371xx_pm_registers);
672 break;
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100673
674 case PCI_DEVICE_ID_INTEL_I63XX:
675 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
676 pm_registers = i63xx_pm_registers;
677 size = ARRAY_SIZE(i63xx_pm_registers);
678 break;
679
Stefan Reinauer23190272008-08-20 13:41:24 +0000680 case 0x1234: // Dummy for non-existent functionality
681 printf("This southbridge does not have PMBASE.\n");
682 return 1;
683 default:
684 printf("Error: Dumping PMBASE on this southbridge is not (yet) supported.\n");
685 return 1;
686 }
687
688 printf("PMBASE = 0x%04x (IO)\n\n", pmbase);
689
Stefan Reinauer1162f252008-12-04 15:18:20 +0000690 for (i = 0; i < size; i++) {
691 switch (pm_registers[i].size) {
Nico Huberaa5eae62012-09-24 10:58:41 +0200692 case 8:
693 printf("pmbase+0x%04x: 0x%08x (%s)\n"
694 " 0x%08x\n",
695 pm_registers[i].addr,
696 inl(pmbase+pm_registers[i].addr),
697 pm_registers[i].name,
698 inl(pmbase+pm_registers[i].addr+4));
699 break;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000700 case 4:
701 printf("pmbase+0x%04x: 0x%08x (%s)\n",
702 pm_registers[i].addr,
703 inl(pmbase+pm_registers[i].addr),
704 pm_registers[i].name);
705 break;
706 case 2:
707 printf("pmbase+0x%04x: 0x%04x (%s)\n",
708 pm_registers[i].addr,
709 inw(pmbase+pm_registers[i].addr),
710 pm_registers[i].name);
711 break;
712 case 1:
713 printf("pmbase+0x%04x: 0x%02x (%s)\n",
714 pm_registers[i].addr,
715 inb(pmbase+pm_registers[i].addr),
716 pm_registers[i].name);
717 break;
718 }
Stefan Reinauer23190272008-08-20 13:41:24 +0000719 }
720
721 return 0;
722}