blob: 8da12d2826eb22d4f7ba18f265ede4fe9aac3f6b [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>
Nico Huber9fa8ebe2017-04-24 16:18:29 +02006 * Copyright (C) 2017 secunet Security Networks AG
Stefan Reinauer14e22772010-04-27 06:56:47 +00007 *
Stefan Reinauer23190272008-08-20 13:41:24 +00008 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Stefan Reinauer23190272008-08-20 13:41:24 +000016 */
17
18#include <stdio.h>
Nico Huber9fa8ebe2017-04-24 16:18:29 +020019#include <stdlib.h>
20#include <inttypes.h>
21#include <commonlib/helpers.h>
Stefan Reinauer23190272008-08-20 13:41:24 +000022#include "inteltool.h"
23
Nico Huber9fa8ebe2017-04-24 16:18:29 +020024static const io_register_t sunrise_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 { 0x30, 4, "SMI_EN" },
30 { 0x34, 4, "SMI_STS" },
31 { 0x40, 4, "GPE_CNTL" },
32 { 0x44, 2, "DEVACT_STS" }, /* Device Activity Status */
33 { 0x50, 4, "PM2_CNT" }, /* PM2 Control; ACPI pointer: PM2a_CNT_BLK */
34 { 0x54, 4, "OC_WDT_CTL" }, /* Overclocking WDT Control */
35 { 0x80, 4, "GPE0_STS_31_0" },
36 { 0x84, 4, "GPE0_STS_63_31" },
37 { 0x88, 4, "GPE0_STS_95_64" },
38 { 0x8c, 4, "GPE0_STS_127_96" },
39 { 0x90, 4, "GPE0_EN_31_0" },
40 { 0x94, 4, "GPE0_EN_63_31" },
41 { 0x98, 4, "GPE0_EN_95_64" },
42 { 0x9c, 4, "GPE0_EN_127_96" },
43};
44
Nico Huber5ed986b2013-03-29 19:00:37 +010045static const io_register_t pch_pm_registers[] = {
46 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
47 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
48 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
49 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
50 { 0x0c, 4, "RESERVED" },
51 { 0x10, 4, "RESERVED" },
52 { 0x14, 4, "RESERVED" },
53 { 0x18, 4, "RESERVED" },
54 { 0x1c, 4, "RESERVED" },
55 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
56 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
57 { 0x30, 4, "SMI_EN" },
58 { 0x34, 4, "SMI_STS" },
59 { 0x38, 2, "ALT_GP_SMI_EN" },
60 { 0x3a, 2, "ALT_GP_SMI_STS" },
61 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control
62 { 0x3d, 1, "RESERVED" },
63 { 0x3e, 2, "RESERVED" },
64 { 0x40, 2, "RESERVED" },
65 { 0x42, 1, "GPE_CNTL" },
66 { 0x43, 1, "RESERVED" },
67 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
68 { 0x46, 2, "RESERVED" },
69 { 0x48, 4, "RESERVED" },
70 { 0x4c, 4, "RESERVED" },
71 { 0x50, 1, "PM2_CNT" },
72 { 0x51, 1, "RESERVED" },
73 { 0x52, 2, "RESERVED" },
74 { 0x54, 4, "RESERVED" },
75 { 0x58, 4, "RESERVED" },
76 { 0x5c, 4, "RESERVED" },
77 /* The TCO registers start here. */
78 { 0x60, 2, "TCO_RLD" },
79 { 0x62, 1, "TCO_DAT_IN" },
80 { 0x63, 1, "TCO_DAT_OUT" },
81 { 0x64, 2, "TCO1_STS" },
82 { 0x66, 2, "TCO2_STS" },
83 { 0x68, 2, "TCO1_CNT" },
84 { 0x6a, 2, "TCO2_CNT" },
85 { 0x6c, 2, "TCO_MESSAGE" },
86 { 0x6e, 1, "TCO_WDCNT" },
87 { 0x6f, 1, "RESERVED" },
88 { 0x70, 1, "SW_IRQ_GEN" },
89 { 0x71, 1, "RESERVED" },
90 { 0x72, 2, "TCO_TMR" },
91 { 0x74, 4, "RESERVED" },
92 { 0x78, 4, "RESERVED" },
93 { 0x7c, 4, "RESERVED" },
94};
95
Warren Turkal3cf287d2010-09-03 09:36:37 +000096static const io_register_t ich10_pm_registers[] = {
97 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
98 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
99 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
100 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
101 { 0x0c, 4, "RESERVED" },
102 { 0x10, 4, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
103#if DANGEROUS_REGISTERS
104 /* These registers return 0 on read, but reading them may cause
105 * the system to enter Cx states, which might hang the system.
106 */
107 { 0x14, 1, "LV2 (Mobile)" },
108 { 0x15, 1, "LV3 (Mobile)" },
109 { 0x16, 1, "LV4 (Mobile)" },
110#endif
111 { 0x17, 2, "RESERVED" },
112 { 0x19, 1, "RESERVED" },
113 { 0x1a, 2, "RESERVED" },
114 { 0x1c, 4, "RESERVED" },
115 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +0200116 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Warren Turkal3cf287d2010-09-03 09:36:37 +0000117 { 0x30, 4, "SMI_EN" },
118 { 0x34, 4, "SMI_STS" },
119 { 0x38, 2, "ALT_GP_SMI_EN" },
120 { 0x3a, 2, "ALT_GP_SMI_STS" },
121 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
122 { 0x3d, 2, "RESERVED" },
123 { 0x3f, 1, "RESERVED" },
124 { 0x40, 2, "RESERVED" },
125 { 0x42, 1, "GPE_CNTL" },
126 { 0x43, 1, "RESERVED" },
127 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
128 { 0x46, 2, "RESERVED" },
129 { 0x48, 4, "RESERVED" },
130 { 0x4c, 4, "RESERVED" },
131 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
132 { 0x51, 1, "RESERVED" },
133 { 0x52, 2, "RESERVED" },
134 { 0x54, 4, "C3_RES (Mobile)" },
135 { 0x58, 4, "RESERVED" },
136 { 0x5c, 4, "RESERVED" },
137 /* Here start the TCO registers */
138 { 0x60, 2, "TCO_RLD" },
139 { 0x62, 1, "TCO_DAT_IN" },
140 { 0x63, 1, "TCO_DAT_OUT" },
141 { 0x64, 2, "TCO1_STS" },
142 { 0x66, 2, "TCO2_STS" },
143 { 0x68, 2, "TCO1_CNT" },
144 { 0x6a, 2, "TCO2_CNT" },
145 { 0x6c, 2, "TCO_MESSAGE" },
146 { 0x6e, 1, "TCO_WDCNT" },
147 { 0x6f, 1, "RESERVED" },
148 { 0x70, 1, "SW_IRQ_GEN" },
149 { 0x71, 1, "RESERVED" },
150 { 0x72, 2, "TCO_TMR" },
151 { 0x74, 4, "RESERVED" },
152 { 0x78, 4, "RESERVED" },
153 { 0x7c, 4, "RESERVED" },
154};
155
Anton Kochkovda0b4562010-05-30 12:33:12 +0000156static const io_register_t ich9_pm_registers[] = {
157 { 0x00, 2, "PM1_STS" }, // PM1 Status; ACPI pointer: PM1a_EVT_BLK
158 { 0x02, 2, "PM1_EN" }, // PM1 Enables; ACPI pointer: PM1a_EVT_BLK+2
159 { 0x04, 4, "PM1_CNT" }, // PM1 Control; ACPI pointer: PM1a_CNT_BLK
160 { 0x08, 4, "PM1_TMR" }, // PM1 Timer; ACPI pointer: PMTMR_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000161 { 0x0c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000162 { 0x10, 4, "PROC_CNT" }, // Processor Control; ACPI pointer: P_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000163#if DANGEROUS_REGISTERS
164 /* These registers return 0 on read, but reading them may cause
Anton Kochkovda0b4562010-05-30 12:33:12 +0000165 * the system to enter Cx states, which might hang the system.
Stefan Reinauer1162f252008-12-04 15:18:20 +0000166 */
Anton Kochkovda0b4562010-05-30 12:33:12 +0000167 { 0x14, 1, "LV2 (Mobile)" },
168 { 0x15, 1, "LV3 (Mobile)" },
169 { 0x16, 1, "LV4 (Mobile)" },
170 { 0x17, 1, "LV5 (Mobile)" },
171 { 0x18, 1, "LV6 (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000172#endif
Anton Kochkovda0b4562010-05-30 12:33:12 +0000173 { 0x19, 1, "RESERVED" },
174 { 0x1a, 2, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000175 { 0x1c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000176 { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
Nico Huberaa5eae62012-09-24 10:58:41 +0200177 { 0x28, 8, "GPE0_EN" }, // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
Stefan Reinauer1162f252008-12-04 15:18:20 +0000178 { 0x30, 4, "SMI_EN" },
179 { 0x34, 4, "SMI_STS" },
180 { 0x38, 2, "ALT_GP_SMI_EN" },
181 { 0x3a, 2, "ALT_GP_SMI_STS" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000182 { 0x3c, 1, "UPRWC" }, // USB Per-Port registers write control;
183 { 0x3d, 2, "RESERVED" },
184 { 0x3f, 1, "RESERVED" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000185 { 0x40, 2, "RESERVED" },
186 { 0x42, 1, "GPE_CNTL" },
187 { 0x43, 1, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000188 { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
Stefan Reinauer1162f252008-12-04 15:18:20 +0000189 { 0x46, 2, "RESERVED" },
190 { 0x48, 4, "RESERVED" },
191 { 0x4c, 4, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000192 { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
Stefan Reinauer1162f252008-12-04 15:18:20 +0000193 { 0x51, 1, "RESERVED" },
194 { 0x52, 2, "RESERVED" },
Anton Kochkovda0b4562010-05-30 12:33:12 +0000195 { 0x54, 4, "C3_RES (Mobile)" },
196 { 0x58, 4, "C5_RES (Mobile)" },
Stefan Reinauer1162f252008-12-04 15:18:20 +0000197 { 0x5c, 4, "RESERVED" },
198 /* Here start the TCO registers */
199 { 0x60, 2, "TCO_RLD" },
200 { 0x62, 1, "TCO_DAT_IN" },
201 { 0x63, 1, "TCO_DAT_OUT" },
202 { 0x64, 2, "TCO1_STS" },
203 { 0x66, 2, "TCO2_STS" },
204 { 0x68, 2, "TCO1_CNT" },
205 { 0x6a, 2, "TCO2_CNT" },
206 { 0x6c, 2, "TCO_MESSAGE" },
207 { 0x6e, 1, "TCO_WDCNT" },
208 { 0x6f, 1, "RESERVED" },
209 { 0x70, 1, "SW_IRQ_GEN" },
210 { 0x71, 1, "RESERVED" },
211 { 0x72, 2, "TCO_TMR" },
212 { 0x74, 4, "RESERVED" },
213 { 0x78, 4, "RESERVED" },
214 { 0x7c, 4, "RESERVED" },
215};
216
217static const io_register_t ich8_pm_registers[] = {
218 { 0x00, 2, "PM1_STS" },
219 { 0x02, 2, "PM1_EN" },
220 { 0x04, 4, "PM1_CNT" },
221 { 0x08, 4, "PM1_TMR" },
222 { 0x0c, 4, "RESERVED" },
223 { 0x10, 4, "PROC_CNT" },
224#if DANGEROUS_REGISTERS
225 /* These registers return 0 on read, but reading them may cause
226 * the system to enter Cx states, which might hang the system.
227 */
228 { 0x14, 1, "LV2 (Mobile)" },
229 { 0x15, 1, "LV3 (Mobile)" },
230 { 0x16, 1, "LV4 (Mobile)" },
231 { 0x17, 1, "LV5 (Mobile)" },
232 { 0x18, 1, "LV6 (Mobile)" },
233#endif
234 { 0x19, 1, "RESERVED" },
235 { 0x1a, 2, "RESERVED" },
236 { 0x1c, 4, "RESERVED" },
237 { 0x20, 1, "PM2_CNT (Mobile)" },
238 { 0x21, 1, "RESERVED" },
239 { 0x22, 2, "RESERVED" },
240 { 0x24, 4, "RESERVED" },
241 { 0x28, 4, "GPE0_STS" },
242 { 0x2C, 4, "GPE0_EN" },
243 { 0x30, 4, "SMI_EN" },
244 { 0x34, 4, "SMI_STS" },
245 { 0x38, 2, "ALT_GP_SMI_EN" },
246 { 0x3a, 2, "ALT_GP_SMI_STS" },
247 { 0x3c, 4, "RESERVED" },
248 { 0x40, 2, "RESERVED" },
249 { 0x42, 1, "GPE_CNTL" },
250 { 0x43, 1, "RESERVED" },
251 { 0x44, 2, "DEVACT_STS" },
252 { 0x46, 2, "RESERVED" },
253 { 0x48, 4, "RESERVED" },
254 { 0x4c, 4, "RESERVED" },
255 { 0x50, 1, "SS_CNT (Mobile)" },
256 { 0x51, 1, "RESERVED" },
257 { 0x52, 2, "RESERVED" },
258 { 0x54, 4, "C3_RES (Mobile)" },
259 { 0x58, 4, "C5_RES (Mobile)" },
260 { 0x5c, 4, "RESERVED" },
261 /* Here start the TCO registers */
262 { 0x60, 2, "TCO_RLD" },
263 { 0x62, 1, "TCO_DAT_IN" },
264 { 0x63, 1, "TCO_DAT_OUT" },
265 { 0x64, 2, "TCO1_STS" },
266 { 0x66, 2, "TCO2_STS" },
267 { 0x68, 2, "TCO1_CNT" },
268 { 0x6a, 2, "TCO2_CNT" },
269 { 0x6c, 2, "TCO_MESSAGE" },
270 { 0x6e, 1, "TCO_WDCNT" },
271 { 0x6f, 1, "RESERVED" },
272 { 0x70, 1, "SW_IRQ_GEN" },
273 { 0x71, 1, "RESERVED" },
274 { 0x72, 2, "TCO_TMR" },
275 { 0x74, 4, "RESERVED" },
276 { 0x78, 4, "RESERVED" },
277 { 0x7c, 4, "RESERVED" },
278};
279
Anton Kochkovda0b4562010-05-30 12:33:12 +0000280static const io_register_t ich7_pm_registers[] = {
281 { 0x00, 2, "PM1_STS" },
282 { 0x02, 2, "PM1_EN" },
283 { 0x04, 4, "PM1_CNT" },
284 { 0x08, 4, "PM1_TMR" },
285 { 0x0c, 4, "RESERVED" },
286 { 0x10, 4, "PROC_CNT" },
287#if DANGEROUS_REGISTERS
288 /* These registers return 0 on read, but reading them may cause
289 * the system to enter C2/C3/C4 state, which might hang the system.
290 */
291 { 0x14, 1, "LV2 (Mobile/Ultra Mobile)" },
292 { 0x15, 1, "LV3 (Mobile/Ultra Mobile)" },
293 { 0x16, 1, "LV4 (Mobile/Ultra Mobile)" },
294#endif
295 { 0x17, 1, "RESERVED" },
296 { 0x18, 4, "RESERVED" },
297 { 0x1c, 4, "RESERVED" },
298 { 0x20, 1, "PM2_CNT (Mobile/Ultra Mobile)" },
299 { 0x21, 1, "RESERVED" },
300 { 0x22, 2, "RESERVED" },
301 { 0x24, 4, "RESERVED" },
302 { 0x28, 4, "GPE0_STS" },
303 { 0x2C, 4, "GPE0_EN" },
304 { 0x30, 4, "SMI_EN" },
305 { 0x34, 4, "SMI_STS" },
306 { 0x38, 2, "ALT_GP_SMI_EN" },
307 { 0x3a, 2, "ALT_GP_SMI_STS" },
308 { 0x3c, 4, "RESERVED" },
309 { 0x40, 2, "RESERVED" },
310 { 0x42, 1, "GPE_CNTL" },
311 { 0x43, 1, "RESERVED" },
312 { 0x44, 2, "DEVACT_STS" },
313 { 0x46, 2, "RESERVED" },
314 { 0x48, 4, "RESERVED" },
315 { 0x4c, 4, "RESERVED" },
316 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
317 { 0x51, 1, "RESERVED" },
318 { 0x52, 2, "RESERVED" },
319 { 0x54, 4, "C3_RES (Mobile/Ultra Mobile)" },
320 { 0x58, 4, "RESERVED" },
321 { 0x5c, 4, "RESERVED" },
322 /* Here start the TCO registers */
323 { 0x60, 2, "TCO_RLD" },
324 { 0x62, 1, "TCO_DAT_IN" },
325 { 0x63, 1, "TCO_DAT_OUT" },
326 { 0x64, 2, "TCO1_STS" },
327 { 0x66, 2, "TCO2_STS" },
328 { 0x68, 2, "TCO1_CNT" },
329 { 0x6a, 2, "TCO2_CNT" },
330 { 0x6c, 2, "TCO_MESSAGE" },
331 { 0x6e, 1, "TCO_WDCNT" },
332 { 0x6f, 1, "RESERVED" },
333 { 0x70, 1, "SW_IRQ_GEN" },
334 { 0x71, 1, "RESERVED" },
335 { 0x72, 2, "TCO_TMR" },
336 { 0x74, 4, "RESERVED" },
337 { 0x78, 4, "RESERVED" },
338 { 0x7c, 4, "RESERVED" },
339};
340
Stefan Reinauer14e22772010-04-27 06:56:47 +0000341/*
Pat Erleyca3548e2010-04-21 06:23:19 +0000342 * INTEL I/O Controller Hub 6 Family
343 * http://www.intel.com/assets/pdf/datasheet/301473.pdf
344 */
345static const io_register_t ich6_pm_registers[] = {
346 /* 10.8.3 */
347 { 0x00, 2, "PM1_STS" },
348 { 0x02, 2, "PM1_EN" },
349 { 0x04, 4, "PM1_CNT" },
350 { 0x08, 4, "PM1_TMR" },
351 { 0x10, 4, "PROC_CNT" },
352#if DANGEROUS_REGISTERS
353 /* These registers return 0 on read, but reading them may cause
354 * the system to enter C2/C3/C4 state, which might hang the system.
355 */
356 { 0x14, 1, "LV2" },
357 { 0x15, 1, "LV3 (Mobile Only)" },
358 { 0x16, 1, "LV4 (Mobile Only)" },
359#endif
360 { 0x20, 1, "PM2_CNT (Mobile Only)" },
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 { 0x44, 2, "DEVACT_STS" },
368 { 0x50, 1, "SS_CNT (Mobile Only)" },
369 { 0x54, 4, "C3_RES (Mobile Only)" },
370};
371
Idwer Vollering312fc962010-12-17 22:34:58 +0000372static const io_register_t ich5_pm_registers[] = {
373 { 0x00, 2, "PM1_STS" },
374 { 0x02, 2, "PM1_EN" },
375 { 0x04, 4, "PM1_CNT" },
376 { 0x08, 4, "PM1_TMR" },
377 { 0x0c, 4, "RESERVED" },
378 { 0x10, 4, "PROC_CNT" },
379 { 0x14, 3, "RESERVED" },
380 { 0x17, 9, "RESERVED" },
381 { 0x20, 1, "RESERVED" },
382 { 0x28, 4, "GPE0_STS" },
383 { 0x2c, 4, "GPE0_EN" },
384 { 0x30, 4, "SMI_EN" },
385 { 0x34, 4, "SMI_STS" },
386 { 0x38, 2, "ALT_GP_SMI_EN" },
387 { 0x3a, 2, "ALT_GP_SMI_STS" },
388 { 0x3c, 4, "RESERVED" },
389 { 0x40, 1, "MON_SMI" },
390 { 0x42, 2, "RESERVED" },
391 { 0x44, 1, "DEVACT_STS" },
392 { 0x48, 1, "DEVTRAP_EN" },
393 { 0x50, 1, "RESERVED" },
394 { 0x51, 15, "RESERVED" },
395 { 0x60, 16, "RESERVED" },
396};
397
Stefan Reinauer04844812010-02-22 11:26:06 +0000398static const io_register_t ich4_pm_registers[] = {
399 { 0x00, 2, "PM1_STS" },
400 { 0x02, 2, "PM1_EN" },
401 { 0x04, 4, "PM1_CNT" },
402 { 0x08, 4, "PM1_TMR" },
403 { 0x0c, 4, "RESERVED" },
404 { 0x10, 4, "PROC_CNT" },
405#if DANGEROUS_REGISTERS
406 /* These registers return 0 on read, but reading them may cause
407 * the system to enter C2/C3/C4 state, which might hang the system.
408 */
409 { 0x14, 1, "LV2 (Mobile)" },
410 { 0x15, 1, "LV3 (Mobile)" },
411 { 0x16, 1, "LV4 (Mobile)" },
412#endif
413 { 0x17, 1, "RESERVED" },
414 { 0x18, 4, "RESERVED" },
415 { 0x1c, 4, "RESERVED" },
416 { 0x20, 1, "PM2_CNT (Mobile)" },
417 { 0x21, 1, "RESERVED" },
418 { 0x22, 2, "RESERVED" },
419 { 0x24, 4, "RESERVED" },
420 { 0x28, 4, "GPE0_STS" },
421 { 0x2C, 4, "GPE0_EN" },
422 { 0x30, 4, "SMI_EN" },
423 { 0x34, 4, "SMI_STS" },
424 { 0x38, 2, "ALT_GP_SMI_EN" },
425 { 0x3a, 2, "ALT_GP_SMI_STS" },
426 { 0x3c, 4, "RESERVED" },
427 { 0x40, 2, "MON_SMI" },
428 { 0x42, 2, "RESERVED" },
429 { 0x44, 2, "DEVACT_STS" },
430 { 0x46, 2, "RESERVED" },
431 { 0x48, 4, "DEVTRAP_EN" },
432 { 0x4c, 2, "BUS_ADDR_TRACK" },
433 { 0x4e, 2, "BUS_CYC_TRACK" },
434 { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
435 { 0x51, 1, "RESERVED" },
436 { 0x52, 2, "RESERVED" },
437 { 0x54, 4, "RESERVED" },
438 { 0x58, 4, "RESERVED" },
439 { 0x5c, 4, "RESERVED" },
440 /* Here start the TCO registers */
441 { 0x60, 1, "TCO_RLD" },
442 { 0x61, 1, "TCO_TMR" },
443 { 0x62, 1, "TCO_DAT_IN" },
444 { 0x63, 1, "TCO_DAT_OUT" },
445 { 0x64, 2, "TCO1_STS" },
446 { 0x66, 2, "TCO2_STS" },
447 { 0x68, 2, "TCO1_CNT" },
448 { 0x6a, 2, "TCO2_CNT" },
449 { 0x6c, 2, "TCO_MESSAGE" },
450 { 0x6e, 1, "TCO_WDSTATUS" },
451 { 0x6f, 1, "RESERVED" },
452 { 0x70, 1, "SW_IRQ_GEN" },
453 { 0x71, 1, "RESERVED" },
454 { 0x72, 2, "RESERVED" },
455 { 0x74, 4, "RESERVED" },
456 { 0x78, 4, "RESERVED" },
457 { 0x7c, 4, "RESERVED" },
458};
459
Joseph Smithe10757e2010-06-16 22:21:19 +0000460static const io_register_t ich2_pm_registers[] = {
461 { 0x00, 2, "PM1_STS" },
462 { 0x02, 2, "PM1_EN" },
463 { 0x04, 4, "PM1_CNT" },
464 { 0x08, 4, "PM1_TMR" },
465 { 0x0c, 4, "RESERVED" },
466 { 0x10, 4, "PROC_CNT" },
467#if DANGEROUS_REGISTERS
468 /* This register returns 0 on read, but reading it may cause
469 * the system to enter C2 state, which might hang the system.
470 */
471 { 0x14, 1, "LV2" },
472 { 0x15, 1, "RESERVED" },
473 { 0x16, 2, "RESERVED" },
474#endif
475 { 0x18, 4, "RESERVED" },
476 { 0x1c, 4, "RESERVED" },
477 { 0x20, 4, "RESERVED" },
478 { 0x24, 4, "RESERVED" },
479 { 0x28, 2, "GPE0_STS" },
480 { 0x2a, 2, "GPE0_EN" },
481 { 0x2c, 2, "GPE1_STS" },
482 { 0x2e, 2, "GPE1_EN" },
483 { 0x30, 2, "SMI_EN" },
484 { 0x32, 2, "RESERVED" },
485 { 0x34, 2, "SMI_STS" },
486 { 0x36, 2, "RESERVED" },
487 { 0x38, 4, "RESERVED" },
488 { 0x3c, 4, "RESERVED" },
489 { 0x40, 2, "MON_SMI_STS" },
490 { 0x42, 2, "RESERVED" },
491 { 0x44, 2, "DEV_TRP_STS" },
492 { 0x46, 2, "RESERVED" },
493 { 0x48, 2, "TRP_EN" },
494 { 0x4A, 2, "RESERVED" },
495 { 0x4c, 2, "BUS_ADDR_TRACK" },
496 { 0x4e, 1, "BUS_CYC_TRACK" },
497 { 0x4f, 1, "RESERVED" },
498 { 0x50, 4, "RESERVED" },
499 { 0x54, 4, "RESERVED" },
500 { 0x58, 4, "RESERVED" },
501 { 0x5c, 4, "RESERVED" },
502 /* Here start the TCO registers */
503 { 0x60, 1, "TCO_RLD" },
504 { 0x61, 1, "TCO_TMR" },
505 { 0x62, 1, "TCO_DAT_IN" },
506 { 0x63, 1, "TCO_DAT_OUT" },
507 { 0x64, 2, "TCO1_STS" },
508 { 0x66, 2, "TCO2_STS" },
509 { 0x68, 2, "TCO1_CNT" },
510 { 0x6a, 2, "TCO2_CNT" },
511 { 0x6c, 1, "TCO_MESSAGE1" },
512 { 0x6d, 1, "TCO_MESSAGE2" },
513 { 0x6e, 1, "TCO_WDSTATUS" },
514 { 0x6f, 1, "RESERVED" },
515 { 0x70, 1, "SW_IRQ_GEN" },
516 { 0x71, 1, "RESERVED" },
517 { 0x72, 2, "RESERVED" },
518 { 0x74, 4, "RESERVED" },
519 { 0x78, 4, "RESERVED" },
520 { 0x7c, 4, "RESERVED" },
521};
522
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000523static const io_register_t ich0_pm_registers[] = {
524 { 0x00, 2, "PM1_STS" },
525 { 0x02, 2, "PM1_EN" },
526 { 0x04, 4, "PM1_CNT" },
527 { 0x08, 4, "PM1_TMR" },
528 { 0x0c, 4, "RESERVED" },
529 { 0x10, 4, "PROC_CNT" },
530#if DANGEROUS_REGISTERS
531 /* This register returns 0 on read, but reading it may cause
532 * the system to enter C2 state, which might hang the system.
533 */
534 { 0x14, 1, "LV2" },
535 { 0x15, 1, "RESERVED" },
536 { 0x16, 2, "RESERVED" },
537#endif
538 { 0x18, 4, "RESERVED" },
539 { 0x1c, 4, "RESERVED" },
540 { 0x20, 4, "RESERVED" },
541 { 0x24, 4, "RESERVED" },
542 { 0x28, 4, "GPE0_STS" },
543 { 0x2C, 4, "GPE0_EN" },
544 { 0x30, 2, "SMI_EN" },
545 { 0x32, 2, "RESERVED" },
546 { 0x34, 2, "SMI_STS" },
547 { 0x36, 2, "RESERVED" },
548 { 0x38, 4, "RESERVED" },
549 { 0x3c, 4, "RESERVED" },
550 { 0x40, 2, "IOMON_STS_EN" },
551 { 0x42, 2, "RESERVED" },
552 { 0x44, 2, "DEVACT_STS" },
553 { 0x46, 2, "RESERVED" },
554 { 0x48, 4, "RESERVED" },
555 { 0x4c, 2, "BUS_ADDR_TRACK" },
556 { 0x4e, 1, "BUS_CYC_TRACK" },
557 { 0x4f, 1, "RESERVED" },
558 { 0x50, 4, "RESERVED" },
559 { 0x54, 4, "RESERVED" },
560 { 0x58, 4, "RESERVED" },
561 { 0x5c, 4, "RESERVED" },
562 /* Here start the TCO registers */
563 { 0x60, 1, "TCO_RLD" },
564 { 0x61, 1, "TCO_TMR" },
565 { 0x62, 1, "TCO_DAT_IN" },
566 { 0x63, 1, "TCO_DAT_OUT" },
567 { 0x64, 2, "TCO1_STS" },
568 { 0x66, 2, "TCO2_STS" },
569 { 0x68, 2, "TCO1_CNT" },
570 { 0x6a, 2, "TCO2_CNT" },
571 { 0x6c, 1, "TCO_MESSAGE1" },
572 { 0x6d, 1, "TCO_MESSAGE2" },
573 { 0x6e, 1, "TCO_WDSTATUS" },
574 { 0x6f, 1, "RESERVED" },
575 { 0x70, 4, "RESERVED" },
576 { 0x74, 4, "RESERVED" },
577 { 0x78, 4, "RESERVED" },
578 { 0x7c, 4, "RESERVED" },
579};
580
Maciej Pijanka90d17402009-09-30 17:05:46 +0000581static const io_register_t i82371xx_pm_registers[] = {
582 { 0x00, 2, "PMSTS" },
583 { 0x02, 2, "PMEN" },
584 { 0x04, 2, "PMCNTRL" },
585 { 0x06, 2, "RESERVED" },
586 { 0x08, 1, "PMTMR" },
587 { 0x09, 1, "RESERVED" },
588 { 0x0A, 1, "RESERVED" },
589 { 0x0B, 1, "RESERVED" },
590 { 0x0C, 2, "GPSTS" },
591 { 0x0E, 2, "GPEN" },
592 { 0x10, 4, "PCNTRL" },
593#if DANGEROUS_REGISTERS
594 /*
595 * This register returns 0 on read, but reading it may cause
596 * the system to enter C2 state, which might hang the system.
597 */
598 { 0x14, 1, "PLVL2" },
599 { 0x15, 1, "PLVL3" },
600 { 0x16, 2, "RESERVED" },
601#endif
602 { 0x18, 2, "GLBSTS" },
603 { 0x1A, 2, "RESERVED" },
604 { 0x1c, 4, "DEVSTS" },
605 { 0x20, 2, "GLBEN" },
606 { 0x22, 1, "RESERVED" },
607 { 0x23, 1, "RESERVED" },
608 { 0x24, 1, "RESERVED" },
609 { 0x25, 1, "RESERVED" },
610 { 0x26, 1, "RESERVED" },
611 { 0x27, 1, "RESERVED" },
612 { 0x28, 4, "GLBCTL" },
613 { 0x2C, 4, "DEVCTL" },
614 /* The registers 0x30-0x33 and 0x34-0x37 allow byte-wise reads only. */
615 { 0x30, 1, "GPIREG 0" },
616 { 0x31, 1, "GPIREG 1" },
617 { 0x32, 1, "GPIREG 2" },
618 { 0x33, 1, "GPIREG 3" },
619 { 0x34, 1, "GPOREG 0" },
620 { 0x35, 1, "GPOREG 1" },
621 { 0x36, 1, "GPOREG 2" },
622 { 0x37, 1, "GPOREG 3" },
623};
624
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100625static const io_register_t i63xx_pm_registers[] = {
626 { 0x00, 2, "PM1_STS" },
627 { 0x02, 2, "PM1_EN" },
628 { 0x04, 4, "PM1_CNT" },
629 { 0x08, 4, "PM1_TMR" },
630 { 0x0c, 4, "RESERVED" },
631 { 0x10, 4, "PROC_CNT" },
632#if DANGEROUS_REGISTERS
633 /* This register returns 0 on read, but reading it may cause
634 * the system to enter C2 state, which might hang the system.
635 */
636 { 0x14, 1, "LV2" },
637 { 0x15, 1, "RESERVED" },
638 { 0x16, 2, "RESERVED" },
639#endif
640 { 0x18, 4, "RESERVED" },
641 { 0x1c, 4, "RESERVED" },
642 { 0x20, 4, "RESERVED" },
643 { 0x24, 4, "RESERVED" },
644 { 0x28, 4, "GPE0_STS" },
645 { 0x2C, 4, "GPE0_EN" },
646 { 0x30, 4, "SMI_EN" },
647 { 0x34, 4, "SMI_STS" },
648 { 0x38, 2, "ALT_GP_SMI_EN" },
649 { 0x3a, 2, "ALT_GP_SMI_STS" },
650 { 0x3c, 4, "RESERVED" },
651 { 0x40, 4, "RESERVED" },
652 { 0x44, 2, "DEVACT_STS" },
653 { 0x46, 2, "RESERVED" },
654 { 0x48, 4, "RESERVED" },
655 { 0x4c, 4, "RESERVED" },
656 { 0x50, 4, "RESERVED" },
657 { 0x54, 4, "C3_RES" },
658 { 0x58, 4, "RESERVED" },
659 { 0x5c, 4, "RESERVED" },
660 { 0x60, 1, "RESERVED" },
661 { 0x64, 4, "RESERVED" },
662 { 0x68, 4, "RESERVED" },
663 { 0x6c, 4, "RESERVED" },
664 { 0x70, 4, "RESERVED" },
665 { 0x74, 4, "RESERVED" },
666 { 0x78, 4, "RESERVED" },
667 { 0x7c, 4, "RESERVED" },
668};
669
Tobias Diedrich3645e612010-11-27 14:44:19 +0000670int print_pmbase(struct pci_dev *sb, struct pci_access *pacc)
Stefan Reinauer23190272008-08-20 13:41:24 +0000671{
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200672 size_t i, size;
Stefan Reinauer23190272008-08-20 13:41:24 +0000673 uint16_t pmbase;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000674 const io_register_t *pm_registers;
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200675 uint64_t pwrmbase_phys = 0;
Tobias Diedrich3645e612010-11-27 14:44:19 +0000676 struct pci_dev *acpi;
Stefan Reinauer23190272008-08-20 13:41:24 +0000677
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200678 printf("\n========== PMBASE/ABASE =========\n\n");
Stefan Reinauer23190272008-08-20 13:41:24 +0000679
680 switch (sb->device_id) {
Stefan Taunerb75a39a2014-11-01 17:12:37 +0100681 case PCI_DEVICE_ID_INTEL_3400:
682 case PCI_DEVICE_ID_INTEL_3420:
683 case PCI_DEVICE_ID_INTEL_3450:
684 case PCI_DEVICE_ID_INTEL_3400_DESKTOP:
685 case PCI_DEVICE_ID_INTEL_3400_MOBILE:
686 case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF:
687 case PCI_DEVICE_ID_INTEL_B55_A:
688 case PCI_DEVICE_ID_INTEL_B55_B:
689 case PCI_DEVICE_ID_INTEL_H55:
690 case PCI_DEVICE_ID_INTEL_H57:
691 case PCI_DEVICE_ID_INTEL_HM55:
692 case PCI_DEVICE_ID_INTEL_HM57:
693 case PCI_DEVICE_ID_INTEL_P55:
694 case PCI_DEVICE_ID_INTEL_PM55:
695 case PCI_DEVICE_ID_INTEL_Q57:
696 case PCI_DEVICE_ID_INTEL_QM57:
697 case PCI_DEVICE_ID_INTEL_QS57:
Nico Huber5ed986b2013-03-29 19:00:37 +0100698 case PCI_DEVICE_ID_INTEL_Z68:
699 case PCI_DEVICE_ID_INTEL_P67:
700 case PCI_DEVICE_ID_INTEL_UM67:
701 case PCI_DEVICE_ID_INTEL_HM65:
702 case PCI_DEVICE_ID_INTEL_H67:
703 case PCI_DEVICE_ID_INTEL_HM67:
704 case PCI_DEVICE_ID_INTEL_Q65:
705 case PCI_DEVICE_ID_INTEL_QS67:
706 case PCI_DEVICE_ID_INTEL_Q67:
707 case PCI_DEVICE_ID_INTEL_QM67:
708 case PCI_DEVICE_ID_INTEL_B65:
709 case PCI_DEVICE_ID_INTEL_C202:
710 case PCI_DEVICE_ID_INTEL_C204:
711 case PCI_DEVICE_ID_INTEL_C206:
712 case PCI_DEVICE_ID_INTEL_H61:
713 case PCI_DEVICE_ID_INTEL_Z77:
714 case PCI_DEVICE_ID_INTEL_Z75:
715 case PCI_DEVICE_ID_INTEL_Q77:
716 case PCI_DEVICE_ID_INTEL_Q75:
717 case PCI_DEVICE_ID_INTEL_B75:
718 case PCI_DEVICE_ID_INTEL_H77:
719 case PCI_DEVICE_ID_INTEL_C216:
720 case PCI_DEVICE_ID_INTEL_QM77:
721 case PCI_DEVICE_ID_INTEL_QS77:
722 case PCI_DEVICE_ID_INTEL_HM77:
723 case PCI_DEVICE_ID_INTEL_UM77:
724 case PCI_DEVICE_ID_INTEL_HM76:
725 case PCI_DEVICE_ID_INTEL_HM75:
726 case PCI_DEVICE_ID_INTEL_HM70:
Dennis Wassenbergae6685f2014-10-30 10:30:40 +0100727 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL:
728 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM:
729 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE:
Youness Alaoui1244a512017-04-13 13:22:33 -0400730 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM:
Matt DeVillier5b667df2015-05-14 21:58:33 -0500731 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP:
Martin Roth51dde6f2014-12-07 22:11:54 -0700732 case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC:
qeedb775a622018-06-19 19:52:19 -0400733 case PCI_DEVICE_ID_INTEL_C8_MOBILE:
734 case PCI_DEVICE_ID_INTEL_C8_DESKTOP:
735 case PCI_DEVICE_ID_INTEL_Z87:
736 case PCI_DEVICE_ID_INTEL_Z85:
737 case PCI_DEVICE_ID_INTEL_HM86:
738 case PCI_DEVICE_ID_INTEL_H87:
739 case PCI_DEVICE_ID_INTEL_HM87:
740 case PCI_DEVICE_ID_INTEL_Q85:
741 case PCI_DEVICE_ID_INTEL_Q87:
742 case PCI_DEVICE_ID_INTEL_QM87:
743 case PCI_DEVICE_ID_INTEL_B85:
744 case PCI_DEVICE_ID_INTEL_C222:
745 case PCI_DEVICE_ID_INTEL_C224:
746 case PCI_DEVICE_ID_INTEL_C226:
747 case PCI_DEVICE_ID_INTEL_H81:
Felix Singer0a7543d2019-02-19 23:49:11 +0100748 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE:
749 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL:
750 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL:
751 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL:
752 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL:
753 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL:
754 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL:
Matthew Garrett2bf28e52018-07-23 21:09:47 -0700755 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE:
756 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM:
757 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM:
Nico Huber5ed986b2013-03-29 19:00:37 +0100758 pmbase = pci_read_word(sb, 0x40) & 0xff80;
759 pm_registers = pch_pm_registers;
760 size = ARRAY_SIZE(pch_pm_registers);
761 break;
Arthur Heymans026f7df2017-04-10 22:26:13 +0200762 case PCI_DEVICE_ID_INTEL_ICH10:
Warren Turkal3cf287d2010-09-03 09:36:37 +0000763 case PCI_DEVICE_ID_INTEL_ICH10R:
764 pmbase = pci_read_word(sb, 0x40) & 0xff80;
765 pm_registers = ich10_pm_registers;
766 size = ARRAY_SIZE(ich10_pm_registers);
767 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000768 case PCI_DEVICE_ID_INTEL_ICH7:
769 case PCI_DEVICE_ID_INTEL_ICH7M:
770 case PCI_DEVICE_ID_INTEL_ICH7DH:
771 case PCI_DEVICE_ID_INTEL_ICH7MDH:
Corey Osgoodf366ce02010-08-17 08:33:44 +0000772 case PCI_DEVICE_ID_INTEL_NM10:
Stefan Reinauer23190272008-08-20 13:41:24 +0000773 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000774 pm_registers = ich7_pm_registers;
775 size = ARRAY_SIZE(ich7_pm_registers);
776 break;
Anton Kochkovda0b4562010-05-30 12:33:12 +0000777 case PCI_DEVICE_ID_INTEL_ICH9DH:
778 case PCI_DEVICE_ID_INTEL_ICH9DO:
779 case PCI_DEVICE_ID_INTEL_ICH9R:
780 case PCI_DEVICE_ID_INTEL_ICH9:
781 case PCI_DEVICE_ID_INTEL_ICH9M:
782 case PCI_DEVICE_ID_INTEL_ICH9ME:
783 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
784 pm_registers = ich9_pm_registers;
785 size = ARRAY_SIZE(ich9_pm_registers);
786 break;
Corey Osgoodf366ce02010-08-17 08:33:44 +0000787 case PCI_DEVICE_ID_INTEL_ICH8:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000788 case PCI_DEVICE_ID_INTEL_ICH8M:
Lubomir Rintel2a13bad2015-03-01 10:14:15 +0100789 case PCI_DEVICE_ID_INTEL_ICH8ME:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000790 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
791 pm_registers = ich8_pm_registers;
792 size = ARRAY_SIZE(ich8_pm_registers);
Stefan Reinauer23190272008-08-20 13:41:24 +0000793 break;
Pat Erleyca3548e2010-04-21 06:23:19 +0000794 case PCI_DEVICE_ID_INTEL_ICH6:
795 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
796 pm_registers = ich6_pm_registers;
797 size = ARRAY_SIZE(ich6_pm_registers);
798 break;
Idwer Vollering312fc962010-12-17 22:34:58 +0000799 case PCI_DEVICE_ID_INTEL_ICH5:
800 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
801 pm_registers = ich5_pm_registers;
802 size = ARRAY_SIZE(ich5_pm_registers);
803 break;
Stefan Reinauer04844812010-02-22 11:26:06 +0000804 case PCI_DEVICE_ID_INTEL_ICH4:
805 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
806 pm_registers = ich4_pm_registers;
807 size = ARRAY_SIZE(ich4_pm_registers);
808 break;
Joseph Smithe10757e2010-06-16 22:21:19 +0000809 case PCI_DEVICE_ID_INTEL_ICH2:
810 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
811 pm_registers = ich2_pm_registers;
812 size = ARRAY_SIZE(ich2_pm_registers);
813 break;
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000814 case PCI_DEVICE_ID_INTEL_ICH0:
815 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
816 pm_registers = ich0_pm_registers;
817 size = ARRAY_SIZE(ich0_pm_registers);
818 break;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000819 case PCI_DEVICE_ID_INTEL_82371XX:
Tobias Diedrich3645e612010-11-27 14:44:19 +0000820 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 3);
821 if (!acpi) {
822 printf("Southbridge function 3 not found.\n");
823 return 1;
824 }
825 pmbase = pci_read_word(acpi, 0x40) & 0xfffc;
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200826 pci_free_dev(acpi);
827
Maciej Pijanka90d17402009-09-30 17:05:46 +0000828 pm_registers = i82371xx_pm_registers;
829 size = ARRAY_SIZE(i82371xx_pm_registers);
830 break;
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100831
832 case PCI_DEVICE_ID_INTEL_I63XX:
833 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
834 pm_registers = i63xx_pm_registers;
835 size = ARRAY_SIZE(i63xx_pm_registers);
836 break;
837
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200838 case PCI_DEVICE_ID_INTEL_CM236:
Christian Walter9a8c5e72019-05-06 17:50:57 +0200839 case PCI_DEVICE_ID_INTEL_C236:
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200840 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 2);
841 if (!acpi) {
842 printf("PMC device not found.\n");
843 return 1;
844 }
845 pmbase = pci_read_word(acpi, 0x40) & ~0xff;
846 pwrmbase_phys = pci_read_long(acpi, 0x48) & ~0xfff;
847 pci_free_dev(acpi);
848
849 pm_registers = sunrise_pm_registers;
850 size = ARRAY_SIZE(sunrise_pm_registers);
851 break;
852
Stefan Reinauer23190272008-08-20 13:41:24 +0000853 case 0x1234: // Dummy for non-existent functionality
854 printf("This southbridge does not have PMBASE.\n");
855 return 1;
856 default:
857 printf("Error: Dumping PMBASE on this southbridge is not (yet) supported.\n");
858 return 1;
859 }
860
861 printf("PMBASE = 0x%04x (IO)\n\n", pmbase);
862
Stefan Reinauer1162f252008-12-04 15:18:20 +0000863 for (i = 0; i < size; i++) {
864 switch (pm_registers[i].size) {
Nico Huberaa5eae62012-09-24 10:58:41 +0200865 case 8:
866 printf("pmbase+0x%04x: 0x%08x (%s)\n"
867 " 0x%08x\n",
868 pm_registers[i].addr,
869 inl(pmbase+pm_registers[i].addr),
870 pm_registers[i].name,
871 inl(pmbase+pm_registers[i].addr+4));
872 break;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000873 case 4:
874 printf("pmbase+0x%04x: 0x%08x (%s)\n",
875 pm_registers[i].addr,
876 inl(pmbase+pm_registers[i].addr),
877 pm_registers[i].name);
878 break;
879 case 2:
880 printf("pmbase+0x%04x: 0x%04x (%s)\n",
881 pm_registers[i].addr,
882 inw(pmbase+pm_registers[i].addr),
883 pm_registers[i].name);
884 break;
885 case 1:
886 printf("pmbase+0x%04x: 0x%02x (%s)\n",
887 pm_registers[i].addr,
888 inb(pmbase+pm_registers[i].addr),
889 pm_registers[i].name);
890 break;
891 }
Stefan Reinauer23190272008-08-20 13:41:24 +0000892 }
893
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200894 if (pwrmbase_phys) {
895 const size_t pwrmbase_size = 4 * KiB;
896 volatile const u8 *const pwrmbase =
897 map_physical(pwrmbase_phys, pwrmbase_size);
898 if (!pwrmbase) {
899 perror("Error mapping PWRMBASE");
900 exit(1);
901 }
902
903 printf("\n=========== PWRMBASE ===========\n\n");
904 printf("PWRMBASE = 0x%08" PRIx64 " (MEM)\n\n", pwrmbase_phys);
905
906 for (i = 0; i < pwrmbase_size; i += 4) {
907 if (*(uint32_t *)(pwrmbase + i))
908 printf("0x%04zx: 0x%08"PRIx32"\n",
909 i, *(uint32_t *)(pwrmbase + i));
910 }
911
912 unmap_physical((void *)pwrmbase, pwrmbase_size);
913 }
914
Stefan Reinauer23190272008-08-20 13:41:24 +0000915 return 0;
916}