blob: 0edd3e8d6d945e343cf41a2867823cfaeaae135e [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{
Michael Niewöhner099975d2020-03-13 18:48:16 +0100672 size_t i, pm_registers_size = 0;
Michael Niewöhner8ca1ada2020-03-13 21:17:21 +0100673 size_t pm_cfg_registers_size = 0;
Stefan Reinauer23190272008-08-20 13:41:24 +0000674 uint16_t pmbase;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000675 const io_register_t *pm_registers;
Michael Niewöhner8ca1ada2020-03-13 21:17:21 +0100676 const io_register_t *pm_cfg_registers;
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200677 uint64_t pwrmbase_phys = 0;
Michael Niewöhner8ca1ada2020-03-13 21:17:21 +0100678 struct pci_dev *acpi = NULL;
Stefan Reinauer23190272008-08-20 13:41:24 +0000679
Michael Niewöhner8ca1ada2020-03-13 21:17:21 +0100680 printf("\n========== ACPI/PMC =========\n\n");
Stefan Reinauer23190272008-08-20 13:41:24 +0000681
682 switch (sb->device_id) {
Stefan Taunerb75a39a2014-11-01 17:12:37 +0100683 case PCI_DEVICE_ID_INTEL_3400:
684 case PCI_DEVICE_ID_INTEL_3420:
685 case PCI_DEVICE_ID_INTEL_3450:
686 case PCI_DEVICE_ID_INTEL_3400_DESKTOP:
687 case PCI_DEVICE_ID_INTEL_3400_MOBILE:
688 case PCI_DEVICE_ID_INTEL_3400_MOBILE_SFF:
689 case PCI_DEVICE_ID_INTEL_B55_A:
690 case PCI_DEVICE_ID_INTEL_B55_B:
691 case PCI_DEVICE_ID_INTEL_H55:
692 case PCI_DEVICE_ID_INTEL_H57:
693 case PCI_DEVICE_ID_INTEL_HM55:
694 case PCI_DEVICE_ID_INTEL_HM57:
695 case PCI_DEVICE_ID_INTEL_P55:
696 case PCI_DEVICE_ID_INTEL_PM55:
697 case PCI_DEVICE_ID_INTEL_Q57:
698 case PCI_DEVICE_ID_INTEL_QM57:
699 case PCI_DEVICE_ID_INTEL_QS57:
Nico Huber5ed986b2013-03-29 19:00:37 +0100700 case PCI_DEVICE_ID_INTEL_Z68:
701 case PCI_DEVICE_ID_INTEL_P67:
702 case PCI_DEVICE_ID_INTEL_UM67:
703 case PCI_DEVICE_ID_INTEL_HM65:
704 case PCI_DEVICE_ID_INTEL_H67:
705 case PCI_DEVICE_ID_INTEL_HM67:
706 case PCI_DEVICE_ID_INTEL_Q65:
707 case PCI_DEVICE_ID_INTEL_QS67:
708 case PCI_DEVICE_ID_INTEL_Q67:
709 case PCI_DEVICE_ID_INTEL_QM67:
710 case PCI_DEVICE_ID_INTEL_B65:
711 case PCI_DEVICE_ID_INTEL_C202:
712 case PCI_DEVICE_ID_INTEL_C204:
713 case PCI_DEVICE_ID_INTEL_C206:
714 case PCI_DEVICE_ID_INTEL_H61:
715 case PCI_DEVICE_ID_INTEL_Z77:
716 case PCI_DEVICE_ID_INTEL_Z75:
717 case PCI_DEVICE_ID_INTEL_Q77:
718 case PCI_DEVICE_ID_INTEL_Q75:
719 case PCI_DEVICE_ID_INTEL_B75:
720 case PCI_DEVICE_ID_INTEL_H77:
721 case PCI_DEVICE_ID_INTEL_C216:
722 case PCI_DEVICE_ID_INTEL_QM77:
723 case PCI_DEVICE_ID_INTEL_QS77:
724 case PCI_DEVICE_ID_INTEL_HM77:
725 case PCI_DEVICE_ID_INTEL_UM77:
726 case PCI_DEVICE_ID_INTEL_HM76:
727 case PCI_DEVICE_ID_INTEL_HM75:
728 case PCI_DEVICE_ID_INTEL_HM70:
Dennis Wassenbergae6685f2014-10-30 10:30:40 +0100729 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_FULL:
730 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_PREM:
731 case PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_BASE:
Youness Alaoui1244a512017-04-13 13:22:33 -0400732 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP_PREM:
Matt DeVillier5b667df2015-05-14 21:58:33 -0500733 case PCI_DEVICE_ID_INTEL_WILDCATPOINT_LP:
Martin Roth51dde6f2014-12-07 22:11:54 -0700734 case PCI_DEVICE_ID_INTEL_BAYTRAIL_LPC:
qeedb775a622018-06-19 19:52:19 -0400735 case PCI_DEVICE_ID_INTEL_C8_MOBILE:
736 case PCI_DEVICE_ID_INTEL_C8_DESKTOP:
737 case PCI_DEVICE_ID_INTEL_Z87:
738 case PCI_DEVICE_ID_INTEL_Z85:
739 case PCI_DEVICE_ID_INTEL_HM86:
740 case PCI_DEVICE_ID_INTEL_H87:
741 case PCI_DEVICE_ID_INTEL_HM87:
742 case PCI_DEVICE_ID_INTEL_Q85:
743 case PCI_DEVICE_ID_INTEL_Q87:
744 case PCI_DEVICE_ID_INTEL_QM87:
745 case PCI_DEVICE_ID_INTEL_B85:
746 case PCI_DEVICE_ID_INTEL_C222:
747 case PCI_DEVICE_ID_INTEL_C224:
748 case PCI_DEVICE_ID_INTEL_C226:
749 case PCI_DEVICE_ID_INTEL_H81:
Nico Huber5ed986b2013-03-29 19:00:37 +0100750 pmbase = pci_read_word(sb, 0x40) & 0xff80;
751 pm_registers = pch_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100752 pm_registers_size = ARRAY_SIZE(pch_pm_registers);
Nico Huber5ed986b2013-03-29 19:00:37 +0100753 break;
Arthur Heymans026f7df2017-04-10 22:26:13 +0200754 case PCI_DEVICE_ID_INTEL_ICH10:
Warren Turkal3cf287d2010-09-03 09:36:37 +0000755 case PCI_DEVICE_ID_INTEL_ICH10R:
756 pmbase = pci_read_word(sb, 0x40) & 0xff80;
757 pm_registers = ich10_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100758 pm_registers_size = ARRAY_SIZE(ich10_pm_registers);
Warren Turkal3cf287d2010-09-03 09:36:37 +0000759 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000760 case PCI_DEVICE_ID_INTEL_ICH7:
761 case PCI_DEVICE_ID_INTEL_ICH7M:
762 case PCI_DEVICE_ID_INTEL_ICH7DH:
763 case PCI_DEVICE_ID_INTEL_ICH7MDH:
Corey Osgoodf366ce02010-08-17 08:33:44 +0000764 case PCI_DEVICE_ID_INTEL_NM10:
Stefan Reinauer23190272008-08-20 13:41:24 +0000765 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000766 pm_registers = ich7_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100767 pm_registers_size = ARRAY_SIZE(ich7_pm_registers);
Stefan Reinauer1162f252008-12-04 15:18:20 +0000768 break;
Anton Kochkovda0b4562010-05-30 12:33:12 +0000769 case PCI_DEVICE_ID_INTEL_ICH9DH:
770 case PCI_DEVICE_ID_INTEL_ICH9DO:
771 case PCI_DEVICE_ID_INTEL_ICH9R:
772 case PCI_DEVICE_ID_INTEL_ICH9:
773 case PCI_DEVICE_ID_INTEL_ICH9M:
774 case PCI_DEVICE_ID_INTEL_ICH9ME:
775 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
776 pm_registers = ich9_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100777 pm_registers_size = ARRAY_SIZE(ich9_pm_registers);
Anton Kochkovda0b4562010-05-30 12:33:12 +0000778 break;
Corey Osgoodf366ce02010-08-17 08:33:44 +0000779 case PCI_DEVICE_ID_INTEL_ICH8:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000780 case PCI_DEVICE_ID_INTEL_ICH8M:
Lubomir Rintel2a13bad2015-03-01 10:14:15 +0100781 case PCI_DEVICE_ID_INTEL_ICH8ME:
Stefan Reinauer1162f252008-12-04 15:18:20 +0000782 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
783 pm_registers = ich8_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100784 pm_registers_size = ARRAY_SIZE(ich8_pm_registers);
Stefan Reinauer23190272008-08-20 13:41:24 +0000785 break;
Pat Erleyca3548e2010-04-21 06:23:19 +0000786 case PCI_DEVICE_ID_INTEL_ICH6:
787 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
788 pm_registers = ich6_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100789 pm_registers_size = ARRAY_SIZE(ich6_pm_registers);
Pat Erleyca3548e2010-04-21 06:23:19 +0000790 break;
Idwer Vollering312fc962010-12-17 22:34:58 +0000791 case PCI_DEVICE_ID_INTEL_ICH5:
792 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
793 pm_registers = ich5_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100794 pm_registers_size = ARRAY_SIZE(ich5_pm_registers);
Idwer Vollering312fc962010-12-17 22:34:58 +0000795 break;
Stefan Reinauer04844812010-02-22 11:26:06 +0000796 case PCI_DEVICE_ID_INTEL_ICH4:
797 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
798 pm_registers = ich4_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100799 pm_registers_size = ARRAY_SIZE(ich4_pm_registers);
Stefan Reinauer04844812010-02-22 11:26:06 +0000800 break;
Joseph Smithe10757e2010-06-16 22:21:19 +0000801 case PCI_DEVICE_ID_INTEL_ICH2:
802 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
803 pm_registers = ich2_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100804 pm_registers_size = ARRAY_SIZE(ich2_pm_registers);
Joseph Smithe10757e2010-06-16 22:21:19 +0000805 break;
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000806 case PCI_DEVICE_ID_INTEL_ICH0:
807 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
808 pm_registers = ich0_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100809 pm_registers_size = ARRAY_SIZE(ich0_pm_registers);
Stefan Reinauerb2aedb12009-08-29 15:45:43 +0000810 break;
Maciej Pijanka90d17402009-09-30 17:05:46 +0000811 case PCI_DEVICE_ID_INTEL_82371XX:
Tobias Diedrich3645e612010-11-27 14:44:19 +0000812 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 3);
813 if (!acpi) {
814 printf("Southbridge function 3 not found.\n");
815 return 1;
816 }
817 pmbase = pci_read_word(acpi, 0x40) & 0xfffc;
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200818
Maciej Pijanka90d17402009-09-30 17:05:46 +0000819 pm_registers = i82371xx_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100820 pm_registers_size = ARRAY_SIZE(i82371xx_pm_registers);
Maciej Pijanka90d17402009-09-30 17:05:46 +0000821 break;
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100822 case PCI_DEVICE_ID_INTEL_I63XX:
823 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
824 pm_registers = i63xx_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100825 pm_registers_size = ARRAY_SIZE(i63xx_pm_registers);
Sven Schnelle54a5aed2011-10-30 13:30:36 +0100826 break;
Michael Niewöhnerb6b8575c2019-09-19 17:02:28 +0200827 case PCI_DEVICE_ID_INTEL_H110:
828 case PCI_DEVICE_ID_INTEL_H170:
829 case PCI_DEVICE_ID_INTEL_Z170:
830 case PCI_DEVICE_ID_INTEL_Q170:
831 case PCI_DEVICE_ID_INTEL_Q150:
832 case PCI_DEVICE_ID_INTEL_B150:
Christian Walter9a8c5e72019-05-06 17:50:57 +0200833 case PCI_DEVICE_ID_INTEL_C236:
Michael Niewöhnerb6b8575c2019-09-19 17:02:28 +0200834 case PCI_DEVICE_ID_INTEL_C232:
835 case PCI_DEVICE_ID_INTEL_QM170:
836 case PCI_DEVICE_ID_INTEL_HM170:
837 case PCI_DEVICE_ID_INTEL_CM236:
838 case PCI_DEVICE_ID_INTEL_HM175:
839 case PCI_DEVICE_ID_INTEL_QM175:
840 case PCI_DEVICE_ID_INTEL_CM238:
841 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_PRE:
842 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_SKL:
843 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_SKL:
844 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_SKL:
845 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_BASE_KBL:
846 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_PREM_KBL:
847 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_PREM_KBL:
848 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_BASE:
849 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_U_IHDCP_PREM:
850 case PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_Y_IHDCP_PREM:
Matt DeVillier3c784452019-06-11 23:23:46 -0500851 case PCI_DEVICE_ID_INTEL_CANNONPOINT_LP_U_PREM:
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200852 acpi = pci_get_dev(pacc, sb->domain, sb->bus, sb->dev, 2);
853 if (!acpi) {
854 printf("PMC device not found.\n");
855 return 1;
856 }
857 pmbase = pci_read_word(acpi, 0x40) & ~0xff;
858 pwrmbase_phys = pci_read_long(acpi, 0x48) & ~0xfff;
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200859
860 pm_registers = sunrise_pm_registers;
Michael Niewöhner099975d2020-03-13 18:48:16 +0100861 pm_registers_size = ARRAY_SIZE(sunrise_pm_registers);
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200862 break;
Stefan Reinauer23190272008-08-20 13:41:24 +0000863 default:
864 printf("Error: Dumping PMBASE on this southbridge is not (yet) supported.\n");
865 return 1;
866 }
867
Michael Niewöhner8ca1ada2020-03-13 21:17:21 +0100868 for (i = 0; i < pm_cfg_registers_size; i++) {
869 switch (pm_cfg_registers[i].size) {
870 case 8:
871 printf("0x%04x: 0x%08x (%s)\n"
872 " 0x%08x\n",
873 pm_cfg_registers[i].addr,
874 pci_read_long(acpi, pm_cfg_registers[i].addr),
875 pm_cfg_registers[i].name,
876 pci_read_long(acpi, pm_cfg_registers[i].addr+4));
877 break;
878 case 4:
879 printf("0x%04x: 0x%08x (%s)\n",
880 pm_cfg_registers[i].addr,
881 pci_read_long(acpi, pm_cfg_registers[i].addr),
882 pm_cfg_registers[i].name);
883 break;
884 case 2:
885 printf("0x%04x: 0x%04x (%s)\n",
886 pm_cfg_registers[i].addr,
887 pci_read_word(acpi, pm_cfg_registers[i].addr),
888 pm_cfg_registers[i].name);
889 break;
890 case 1:
891 printf("0x%04x: 0x%02x (%s)\n",
892 pm_cfg_registers[i].addr,
893 pci_read_byte(acpi, pm_cfg_registers[i].addr),
894 pm_cfg_registers[i].name);
895 break;
896 }
897 }
898
899 if (acpi)
900 pci_free_dev(acpi);
901
902 printf("\n========== ABASE/PMBASE =========\n\n");
Stefan Reinauer23190272008-08-20 13:41:24 +0000903 printf("PMBASE = 0x%04x (IO)\n\n", pmbase);
904
Michael Niewöhner099975d2020-03-13 18:48:16 +0100905 for (i = 0; i < pm_registers_size; i++) {
Stefan Reinauer1162f252008-12-04 15:18:20 +0000906 switch (pm_registers[i].size) {
Nico Huberaa5eae62012-09-24 10:58:41 +0200907 case 8:
908 printf("pmbase+0x%04x: 0x%08x (%s)\n"
909 " 0x%08x\n",
910 pm_registers[i].addr,
911 inl(pmbase+pm_registers[i].addr),
912 pm_registers[i].name,
913 inl(pmbase+pm_registers[i].addr+4));
914 break;
Stefan Reinauer1162f252008-12-04 15:18:20 +0000915 case 4:
916 printf("pmbase+0x%04x: 0x%08x (%s)\n",
917 pm_registers[i].addr,
918 inl(pmbase+pm_registers[i].addr),
919 pm_registers[i].name);
920 break;
921 case 2:
922 printf("pmbase+0x%04x: 0x%04x (%s)\n",
923 pm_registers[i].addr,
924 inw(pmbase+pm_registers[i].addr),
925 pm_registers[i].name);
926 break;
927 case 1:
928 printf("pmbase+0x%04x: 0x%02x (%s)\n",
929 pm_registers[i].addr,
930 inb(pmbase+pm_registers[i].addr),
931 pm_registers[i].name);
932 break;
933 }
Stefan Reinauer23190272008-08-20 13:41:24 +0000934 }
935
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200936 if (pwrmbase_phys) {
937 const size_t pwrmbase_size = 4 * KiB;
938 volatile const u8 *const pwrmbase =
939 map_physical(pwrmbase_phys, pwrmbase_size);
940 if (!pwrmbase) {
941 perror("Error mapping PWRMBASE");
942 exit(1);
943 }
944
945 printf("\n=========== PWRMBASE ===========\n\n");
946 printf("PWRMBASE = 0x%08" PRIx64 " (MEM)\n\n", pwrmbase_phys);
947
948 for (i = 0; i < pwrmbase_size; i += 4) {
Michael Niewöhner10d52212020-03-13 19:08:21 +0100949 if (read32(pwrmbase + i))
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200950 printf("0x%04zx: 0x%08"PRIx32"\n",
Michael Niewöhner10d52212020-03-13 19:08:21 +0100951 i, read32(pwrmbase + i));
Nico Huber9fa8ebe2017-04-24 16:18:29 +0200952 }
953
954 unmap_physical((void *)pwrmbase, pwrmbase_size);
955 }
956
Stefan Reinauer23190272008-08-20 13:41:24 +0000957 return 0;
958}