This patch adds inteltool support for i810E and ICH2.
[coreboot.git] / util / inteltool / powermgt.c
1 /*
2  * inteltool - dump all registers on an Intel CPU + chipset based system.
3  *
4  * Copyright (C) 2008-2010 by coresystems GmbH
5  *  written by Stefan Reinauer <stepan@coresystems.de>
6  *
7  * 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>
22 #include "inteltool.h"
23
24 static const io_register_t ich9_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         { 0x17, 1, "LV5 (Mobile)" },
39         { 0x18, 1, "LV6 (Mobile)" },
40 #endif
41         { 0x19, 1, "RESERVED" },
42         { 0x1a, 2, "RESERVED" },
43         { 0x1c, 4, "RESERVED" },
44         { 0x20, 8, "GPE0_STS" }, // General Purpose Event 0 Status; ACPI pointer: GPE0_BLK
45         { 0x2C, 4, "GPE0_EN" },  // General Purpose Event 0 Enables; ACPI pointer: GPE0_BLK+8
46         { 0x30, 4, "SMI_EN" },
47         { 0x34, 4, "SMI_STS" },
48         { 0x38, 2, "ALT_GP_SMI_EN" },
49         { 0x3a, 2, "ALT_GP_SMI_STS" },
50         { 0x3c, 1, "UPRWC" },   // USB Per-Port registers write control;
51         { 0x3d, 2, "RESERVED" },
52         { 0x3f, 1, "RESERVED" },
53         { 0x40, 2, "RESERVED" },
54         { 0x42, 1, "GPE_CNTL" },
55         { 0x43, 1, "RESERVED" },
56         { 0x44, 2, "DEVACT_STS" }, // Device Activity Status
57         { 0x46, 2, "RESERVED" },
58         { 0x48, 4, "RESERVED" },
59         { 0x4c, 4, "RESERVED" },
60         { 0x50, 1, "PM2_CNT (Mobile)" }, // PM2 Control (Mobile only); ACPI pointer: PM2a_CNT_BLK
61         { 0x51, 1, "RESERVED" },
62         { 0x52, 2, "RESERVED" },
63         { 0x54, 4, "C3_RES (Mobile)" },
64         { 0x58, 4, "C5_RES (Mobile)" },
65         { 0x5c, 4, "RESERVED" },
66         /* Here start the TCO registers */
67         { 0x60, 2, "TCO_RLD" },
68         { 0x62, 1, "TCO_DAT_IN" },
69         { 0x63, 1, "TCO_DAT_OUT" },
70         { 0x64, 2, "TCO1_STS" },
71         { 0x66, 2, "TCO2_STS" },
72         { 0x68, 2, "TCO1_CNT" },
73         { 0x6a, 2, "TCO2_CNT" },
74         { 0x6c, 2, "TCO_MESSAGE" },
75         { 0x6e, 1, "TCO_WDCNT" },
76         { 0x6f, 1, "RESERVED" },
77         { 0x70, 1, "SW_IRQ_GEN" },
78         { 0x71, 1, "RESERVED" },
79         { 0x72, 2, "TCO_TMR" },
80         { 0x74, 4, "RESERVED" },
81         { 0x78, 4, "RESERVED" },
82         { 0x7c, 4, "RESERVED" },
83 };
84
85 static const io_register_t ich8_pm_registers[] = {
86         { 0x00, 2, "PM1_STS" },
87         { 0x02, 2, "PM1_EN" },
88         { 0x04, 4, "PM1_CNT" },
89         { 0x08, 4, "PM1_TMR" },
90         { 0x0c, 4, "RESERVED" },
91         { 0x10, 4, "PROC_CNT" },
92 #if DANGEROUS_REGISTERS
93         /* These registers return 0 on read, but reading them may cause
94          * the system to enter Cx states, which might hang the system.
95          */
96         { 0x14, 1, "LV2 (Mobile)" },
97         { 0x15, 1, "LV3 (Mobile)" },
98         { 0x16, 1, "LV4 (Mobile)" },
99         { 0x17, 1, "LV5 (Mobile)" },
100         { 0x18, 1, "LV6 (Mobile)" },
101 #endif
102         { 0x19, 1, "RESERVED" },
103         { 0x1a, 2, "RESERVED" },
104         { 0x1c, 4, "RESERVED" },
105         { 0x20, 1, "PM2_CNT (Mobile)" },
106         { 0x21, 1, "RESERVED" },
107         { 0x22, 2, "RESERVED" },
108         { 0x24, 4, "RESERVED" },
109         { 0x28, 4, "GPE0_STS" },
110         { 0x2C, 4, "GPE0_EN" },
111         { 0x30, 4, "SMI_EN" },
112         { 0x34, 4, "SMI_STS" },
113         { 0x38, 2, "ALT_GP_SMI_EN" },
114         { 0x3a, 2, "ALT_GP_SMI_STS" },
115         { 0x3c, 4, "RESERVED" },
116         { 0x40, 2, "RESERVED" },
117         { 0x42, 1, "GPE_CNTL" },
118         { 0x43, 1, "RESERVED" },
119         { 0x44, 2, "DEVACT_STS" },
120         { 0x46, 2, "RESERVED" },
121         { 0x48, 4, "RESERVED" },
122         { 0x4c, 4, "RESERVED" },
123         { 0x50, 1, "SS_CNT (Mobile)" },
124         { 0x51, 1, "RESERVED" },
125         { 0x52, 2, "RESERVED" },
126         { 0x54, 4, "C3_RES (Mobile)" },
127         { 0x58, 4, "C5_RES (Mobile)" },
128         { 0x5c, 4, "RESERVED" },
129         /* Here start the TCO registers */
130         { 0x60, 2, "TCO_RLD" },
131         { 0x62, 1, "TCO_DAT_IN" },
132         { 0x63, 1, "TCO_DAT_OUT" },
133         { 0x64, 2, "TCO1_STS" },
134         { 0x66, 2, "TCO2_STS" },
135         { 0x68, 2, "TCO1_CNT" },
136         { 0x6a, 2, "TCO2_CNT" },
137         { 0x6c, 2, "TCO_MESSAGE" },
138         { 0x6e, 1, "TCO_WDCNT" },
139         { 0x6f, 1, "RESERVED" },
140         { 0x70, 1, "SW_IRQ_GEN" },
141         { 0x71, 1, "RESERVED" },
142         { 0x72, 2, "TCO_TMR" },
143         { 0x74, 4, "RESERVED" },
144         { 0x78, 4, "RESERVED" },
145         { 0x7c, 4, "RESERVED" },
146 };
147
148 static const io_register_t ich7_pm_registers[] = {
149         { 0x00, 2, "PM1_STS" },
150         { 0x02, 2, "PM1_EN" },
151         { 0x04, 4, "PM1_CNT" },
152         { 0x08, 4, "PM1_TMR" },
153         { 0x0c, 4, "RESERVED" },
154         { 0x10, 4, "PROC_CNT" },
155 #if DANGEROUS_REGISTERS
156         /* These registers return 0 on read, but reading them may cause
157          * the system to enter C2/C3/C4 state, which might hang the system.
158          */
159         { 0x14, 1, "LV2 (Mobile/Ultra Mobile)" },
160         { 0x15, 1, "LV3 (Mobile/Ultra Mobile)" },
161         { 0x16, 1, "LV4 (Mobile/Ultra Mobile)" },
162 #endif
163         { 0x17, 1, "RESERVED" },
164         { 0x18, 4, "RESERVED" },
165         { 0x1c, 4, "RESERVED" },
166         { 0x20, 1, "PM2_CNT (Mobile/Ultra Mobile)" },
167         { 0x21, 1, "RESERVED" },
168         { 0x22, 2, "RESERVED" },
169         { 0x24, 4, "RESERVED" },
170         { 0x28, 4, "GPE0_STS" },
171         { 0x2C, 4, "GPE0_EN" },
172         { 0x30, 4, "SMI_EN" },
173         { 0x34, 4, "SMI_STS" },
174         { 0x38, 2, "ALT_GP_SMI_EN" },
175         { 0x3a, 2, "ALT_GP_SMI_STS" },
176         { 0x3c, 4, "RESERVED" },
177         { 0x40, 2, "RESERVED" },
178         { 0x42, 1, "GPE_CNTL" },
179         { 0x43, 1, "RESERVED" },
180         { 0x44, 2, "DEVACT_STS" },
181         { 0x46, 2, "RESERVED" },
182         { 0x48, 4, "RESERVED" },
183         { 0x4c, 4, "RESERVED" },
184         { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
185         { 0x51, 1, "RESERVED" },
186         { 0x52, 2, "RESERVED" },
187         { 0x54, 4, "C3_RES (Mobile/Ultra Mobile)" },
188         { 0x58, 4, "RESERVED" },
189         { 0x5c, 4, "RESERVED" },
190         /* Here start the TCO registers */
191         { 0x60, 2, "TCO_RLD" },
192         { 0x62, 1, "TCO_DAT_IN" },
193         { 0x63, 1, "TCO_DAT_OUT" },
194         { 0x64, 2, "TCO1_STS" },
195         { 0x66, 2, "TCO2_STS" },
196         { 0x68, 2, "TCO1_CNT" },
197         { 0x6a, 2, "TCO2_CNT" },
198         { 0x6c, 2, "TCO_MESSAGE" },
199         { 0x6e, 1, "TCO_WDCNT" },
200         { 0x6f, 1, "RESERVED" },
201         { 0x70, 1, "SW_IRQ_GEN" },
202         { 0x71, 1, "RESERVED" },
203         { 0x72, 2, "TCO_TMR" },
204         { 0x74, 4, "RESERVED" },
205         { 0x78, 4, "RESERVED" },
206         { 0x7c, 4, "RESERVED" },
207 };
208
209 /*
210  * INTEL I/O Controller Hub 6 Family
211  * http://www.intel.com/assets/pdf/datasheet/301473.pdf
212  */
213 static const io_register_t ich6_pm_registers[] = {
214         /* 10.8.3 */
215         { 0x00, 2, "PM1_STS" },
216         { 0x02, 2, "PM1_EN" },
217         { 0x04, 4, "PM1_CNT" },
218         { 0x08, 4, "PM1_TMR" },
219         { 0x10, 4, "PROC_CNT" },
220 #if DANGEROUS_REGISTERS
221         /* These registers return 0 on read, but reading them may cause
222          * the system to enter C2/C3/C4 state, which might hang the system.
223          */
224         { 0x14, 1, "LV2" },
225         { 0x15, 1, "LV3 (Mobile Only)" },
226         { 0x16, 1, "LV4 (Mobile Only)" },
227 #endif
228         { 0x20, 1, "PM2_CNT (Mobile Only)" },
229         { 0x28, 4, "GPE0_STS" },
230         { 0x2c, 4, "GPE0_EN" },
231         { 0x30, 4, "SMI_EN" },
232         { 0x34, 4, "SMI_STS" },
233         { 0x38, 2, "ALT_GP_SMI_EN" },
234         { 0x3a, 2, "ALT_GP_SMI_STS" },
235         { 0x44, 2, "DEVACT_STS" },
236         { 0x50, 1, "SS_CNT (Mobile Only)" },
237         { 0x54, 4, "C3_RES (Mobile Only)" },
238 };
239
240 static const io_register_t ich4_pm_registers[] = {
241         { 0x00, 2, "PM1_STS" },
242         { 0x02, 2, "PM1_EN" },
243         { 0x04, 4, "PM1_CNT" },
244         { 0x08, 4, "PM1_TMR" },
245         { 0x0c, 4, "RESERVED" },
246         { 0x10, 4, "PROC_CNT" },
247 #if DANGEROUS_REGISTERS
248         /* These registers return 0 on read, but reading them may cause
249          * the system to enter C2/C3/C4 state, which might hang the system.
250          */
251         { 0x14, 1, "LV2 (Mobile)" },
252         { 0x15, 1, "LV3 (Mobile)" },
253         { 0x16, 1, "LV4 (Mobile)" },
254 #endif
255         { 0x17, 1, "RESERVED" },
256         { 0x18, 4, "RESERVED" },
257         { 0x1c, 4, "RESERVED" },
258         { 0x20, 1, "PM2_CNT (Mobile)" },
259         { 0x21, 1, "RESERVED" },
260         { 0x22, 2, "RESERVED" },
261         { 0x24, 4, "RESERVED" },
262         { 0x28, 4, "GPE0_STS" },
263         { 0x2C, 4, "GPE0_EN" },
264         { 0x30, 4, "SMI_EN" },
265         { 0x34, 4, "SMI_STS" },
266         { 0x38, 2, "ALT_GP_SMI_EN" },
267         { 0x3a, 2, "ALT_GP_SMI_STS" },
268         { 0x3c, 4, "RESERVED" },
269         { 0x40, 2, "MON_SMI" },
270         { 0x42, 2, "RESERVED" },
271         { 0x44, 2, "DEVACT_STS" },
272         { 0x46, 2, "RESERVED" },
273         { 0x48, 4, "DEVTRAP_EN" },
274         { 0x4c, 2, "BUS_ADDR_TRACK" },
275         { 0x4e, 2, "BUS_CYC_TRACK" },
276         { 0x50, 1, "SS_CNT (Mobile/Ultra Mobile)" },
277         { 0x51, 1, "RESERVED" },
278         { 0x52, 2, "RESERVED" },
279         { 0x54, 4, "RESERVED" },
280         { 0x58, 4, "RESERVED" },
281         { 0x5c, 4, "RESERVED" },
282         /* Here start the TCO registers */
283         { 0x60, 1, "TCO_RLD" },
284         { 0x61, 1, "TCO_TMR" },
285         { 0x62, 1, "TCO_DAT_IN" },
286         { 0x63, 1, "TCO_DAT_OUT" },
287         { 0x64, 2, "TCO1_STS" },
288         { 0x66, 2, "TCO2_STS" },
289         { 0x68, 2, "TCO1_CNT" },
290         { 0x6a, 2, "TCO2_CNT" },
291         { 0x6c, 2, "TCO_MESSAGE" },
292         { 0x6e, 1, "TCO_WDSTATUS" },
293         { 0x6f, 1, "RESERVED" },
294         { 0x70, 1, "SW_IRQ_GEN" },
295         { 0x71, 1, "RESERVED" },
296         { 0x72, 2, "RESERVED" },
297         { 0x74, 4, "RESERVED" },
298         { 0x78, 4, "RESERVED" },
299         { 0x7c, 4, "RESERVED" },
300 };
301
302 static const io_register_t ich2_pm_registers[] = {
303         { 0x00, 2, "PM1_STS" },
304         { 0x02, 2, "PM1_EN" },
305         { 0x04, 4, "PM1_CNT" },
306         { 0x08, 4, "PM1_TMR" },
307         { 0x0c, 4, "RESERVED" },
308         { 0x10, 4, "PROC_CNT" },
309 #if DANGEROUS_REGISTERS
310         /* This register returns 0 on read, but reading it may cause
311          * the system to enter C2 state, which might hang the system.
312          */
313         { 0x14, 1, "LV2" },
314         { 0x15, 1, "RESERVED" },
315         { 0x16, 2, "RESERVED" },
316 #endif
317         { 0x18, 4, "RESERVED" },
318         { 0x1c, 4, "RESERVED" },
319         { 0x20, 4, "RESERVED" },
320         { 0x24, 4, "RESERVED" },
321         { 0x28, 2, "GPE0_STS" },
322         { 0x2a, 2, "GPE0_EN" },
323         { 0x2c, 2, "GPE1_STS" },
324         { 0x2e, 2, "GPE1_EN" },
325         { 0x30, 2, "SMI_EN" },
326         { 0x32, 2, "RESERVED" },
327         { 0x34, 2, "SMI_STS" },
328         { 0x36, 2, "RESERVED" },
329         { 0x38, 4, "RESERVED" },
330         { 0x3c, 4, "RESERVED" },
331         { 0x40, 2, "MON_SMI_STS" },
332         { 0x42, 2, "RESERVED" },
333         { 0x44, 2, "DEV_TRP_STS" },
334         { 0x46, 2, "RESERVED" },
335         { 0x48, 2, "TRP_EN" },
336         { 0x4A, 2, "RESERVED" },
337         { 0x4c, 2, "BUS_ADDR_TRACK" },
338         { 0x4e, 1, "BUS_CYC_TRACK" },
339         { 0x4f, 1, "RESERVED" },
340         { 0x50, 4, "RESERVED" },
341         { 0x54, 4, "RESERVED" },
342         { 0x58, 4, "RESERVED" },
343         { 0x5c, 4, "RESERVED" },
344         /* Here start the TCO registers */
345         { 0x60, 1, "TCO_RLD" },
346         { 0x61, 1, "TCO_TMR" },
347         { 0x62, 1, "TCO_DAT_IN" },
348         { 0x63, 1, "TCO_DAT_OUT" },
349         { 0x64, 2, "TCO1_STS" },
350         { 0x66, 2, "TCO2_STS" },
351         { 0x68, 2, "TCO1_CNT" },
352         { 0x6a, 2, "TCO2_CNT" },
353         { 0x6c, 1, "TCO_MESSAGE1" },
354         { 0x6d, 1, "TCO_MESSAGE2" },
355         { 0x6e, 1, "TCO_WDSTATUS" },
356         { 0x6f, 1, "RESERVED" },
357         { 0x70, 1, "SW_IRQ_GEN" },
358         { 0x71, 1, "RESERVED" },
359         { 0x72, 2, "RESERVED" },
360         { 0x74, 4, "RESERVED" },
361         { 0x78, 4, "RESERVED" },
362         { 0x7c, 4, "RESERVED" },
363 };
364
365 static const io_register_t ich0_pm_registers[] = {
366         { 0x00, 2, "PM1_STS" },
367         { 0x02, 2, "PM1_EN" },
368         { 0x04, 4, "PM1_CNT" },
369         { 0x08, 4, "PM1_TMR" },
370         { 0x0c, 4, "RESERVED" },
371         { 0x10, 4, "PROC_CNT" },
372 #if DANGEROUS_REGISTERS
373         /* This register returns 0 on read, but reading it may cause
374          * the system to enter C2 state, which might hang the system.
375          */
376         { 0x14, 1, "LV2" },
377         { 0x15, 1, "RESERVED" },
378         { 0x16, 2, "RESERVED" },
379 #endif
380         { 0x18, 4, "RESERVED" },
381         { 0x1c, 4, "RESERVED" },
382         { 0x20, 4, "RESERVED" },
383         { 0x24, 4, "RESERVED" },
384         { 0x28, 4, "GPE0_STS" },
385         { 0x2C, 4, "GPE0_EN" },
386         { 0x30, 2, "SMI_EN" },
387         { 0x32, 2, "RESERVED" },
388         { 0x34, 2, "SMI_STS" },
389         { 0x36, 2, "RESERVED" },
390         { 0x38, 4, "RESERVED" },
391         { 0x3c, 4, "RESERVED" },
392         { 0x40, 2, "IOMON_STS_EN" },
393         { 0x42, 2, "RESERVED" },
394         { 0x44, 2, "DEVACT_STS" },
395         { 0x46, 2, "RESERVED" },
396         { 0x48, 4, "RESERVED" },
397         { 0x4c, 2, "BUS_ADDR_TRACK" },
398         { 0x4e, 1, "BUS_CYC_TRACK" },
399         { 0x4f, 1, "RESERVED" },
400         { 0x50, 4, "RESERVED" },
401         { 0x54, 4, "RESERVED" },
402         { 0x58, 4, "RESERVED" },
403         { 0x5c, 4, "RESERVED" },
404         /* Here start the TCO registers */
405         { 0x60, 1, "TCO_RLD" },
406         { 0x61, 1, "TCO_TMR" },
407         { 0x62, 1, "TCO_DAT_IN" },
408         { 0x63, 1, "TCO_DAT_OUT" },
409         { 0x64, 2, "TCO1_STS" },
410         { 0x66, 2, "TCO2_STS" },
411         { 0x68, 2, "TCO1_CNT" },
412         { 0x6a, 2, "TCO2_CNT" },
413         { 0x6c, 1, "TCO_MESSAGE1" },
414         { 0x6d, 1, "TCO_MESSAGE2" },
415         { 0x6e, 1, "TCO_WDSTATUS" },
416         { 0x6f, 1, "RESERVED" },
417         { 0x70, 4, "RESERVED" },
418         { 0x74, 4, "RESERVED" },
419         { 0x78, 4, "RESERVED" },
420         { 0x7c, 4, "RESERVED" },
421 };
422
423 static const io_register_t i82371xx_pm_registers[] = {
424         { 0x00, 2, "PMSTS" },
425         { 0x02, 2, "PMEN" },
426         { 0x04, 2, "PMCNTRL" },
427         { 0x06, 2, "RESERVED" },
428         { 0x08, 1, "PMTMR" },
429         { 0x09, 1, "RESERVED" },
430         { 0x0A, 1, "RESERVED" },
431         { 0x0B, 1, "RESERVED" },
432         { 0x0C, 2, "GPSTS" },
433         { 0x0E, 2, "GPEN" },
434         { 0x10, 4, "PCNTRL" },
435 #if DANGEROUS_REGISTERS
436         /*
437          * This register returns 0 on read, but reading it may cause
438          * the system to enter C2 state, which might hang the system.
439          */
440         { 0x14, 1, "PLVL2" },
441         { 0x15, 1, "PLVL3" },
442         { 0x16, 2, "RESERVED" },
443 #endif
444         { 0x18, 2, "GLBSTS" },
445         { 0x1A, 2, "RESERVED" },
446         { 0x1c, 4, "DEVSTS" },
447         { 0x20, 2, "GLBEN" },
448         { 0x22, 1, "RESERVED" },
449         { 0x23, 1, "RESERVED" },
450         { 0x24, 1, "RESERVED" },
451         { 0x25, 1, "RESERVED" },
452         { 0x26, 1, "RESERVED" },
453         { 0x27, 1, "RESERVED" },
454         { 0x28, 4, "GLBCTL" },
455         { 0x2C, 4, "DEVCTL" },
456         /* The registers 0x30-0x33 and 0x34-0x37 allow byte-wise reads only. */
457         { 0x30, 1, "GPIREG 0" },
458         { 0x31, 1, "GPIREG 1" },
459         { 0x32, 1, "GPIREG 2" },
460         { 0x33, 1, "GPIREG 3" },
461         { 0x34, 1, "GPOREG 0" },
462         { 0x35, 1, "GPOREG 1" },
463         { 0x36, 1, "GPOREG 2" },
464         { 0x37, 1, "GPOREG 3" },
465 };
466
467 int print_pmbase(struct pci_dev *sb)
468 {
469         int i, size;
470         uint16_t pmbase;
471         const io_register_t *pm_registers;
472
473         printf("\n============= PMBASE ============\n\n");
474
475         switch (sb->device_id) {
476         case PCI_DEVICE_ID_INTEL_ICH7:
477         case PCI_DEVICE_ID_INTEL_ICH7M:
478         case PCI_DEVICE_ID_INTEL_ICH7DH:
479         case PCI_DEVICE_ID_INTEL_ICH7MDH:
480                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
481                 pm_registers = ich7_pm_registers;
482                 size = ARRAY_SIZE(ich7_pm_registers);
483                 break;
484         case PCI_DEVICE_ID_INTEL_ICH9DH:
485         case PCI_DEVICE_ID_INTEL_ICH9DO:
486         case PCI_DEVICE_ID_INTEL_ICH9R:
487         case PCI_DEVICE_ID_INTEL_ICH9:
488         case PCI_DEVICE_ID_INTEL_ICH9M:
489         case PCI_DEVICE_ID_INTEL_ICH9ME:
490                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
491                 pm_registers = ich9_pm_registers;
492                 size = ARRAY_SIZE(ich9_pm_registers);
493                 break;
494         case PCI_DEVICE_ID_INTEL_ICH8M:
495                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
496                 pm_registers = ich8_pm_registers;
497                 size = ARRAY_SIZE(ich8_pm_registers);
498                 break;
499         case PCI_DEVICE_ID_INTEL_ICH6:
500                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
501                 pm_registers = ich6_pm_registers;
502                 size = ARRAY_SIZE(ich6_pm_registers);
503                 break;
504         case PCI_DEVICE_ID_INTEL_ICH4:
505                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
506                 pm_registers = ich4_pm_registers;
507                 size = ARRAY_SIZE(ich4_pm_registers);
508                 break;
509         case PCI_DEVICE_ID_INTEL_ICH2:
510                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
511                 pm_registers = ich2_pm_registers;
512                 size = ARRAY_SIZE(ich2_pm_registers);
513                 break;
514         case PCI_DEVICE_ID_INTEL_ICH0:
515                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
516                 pm_registers = ich0_pm_registers;
517                 size = ARRAY_SIZE(ich0_pm_registers);
518                 break;
519         case PCI_DEVICE_ID_INTEL_82371XX:
520                 pmbase = pci_read_word(sb, 0x40) & 0xfffc;
521                 pm_registers = i82371xx_pm_registers;
522                 size = ARRAY_SIZE(i82371xx_pm_registers);
523                 break;
524         case 0x1234: // Dummy for non-existent functionality
525                 printf("This southbridge does not have PMBASE.\n");
526                 return 1;
527         default:
528                 printf("Error: Dumping PMBASE on this southbridge is not (yet) supported.\n");
529                 return 1;
530         }
531
532         printf("PMBASE = 0x%04x (IO)\n\n", pmbase);
533
534         for (i = 0; i < size; i++) {
535                 switch (pm_registers[i].size) {
536                 case 4:
537                         printf("pmbase+0x%04x: 0x%08x (%s)\n",
538                                 pm_registers[i].addr,
539                                 inl(pmbase+pm_registers[i].addr),
540                                 pm_registers[i].name);
541                         break;
542                 case 2:
543                         printf("pmbase+0x%04x: 0x%04x     (%s)\n",
544                                 pm_registers[i].addr,
545                                 inw(pmbase+pm_registers[i].addr),
546                                 pm_registers[i].name);
547                         break;
548                 case 1:
549                         printf("pmbase+0x%04x: 0x%02x       (%s)\n",
550                                 pm_registers[i].addr,
551                                 inb(pmbase+pm_registers[i].addr),
552                                 pm_registers[i].name);
553                         break;
554                 }
555         }
556
557         return 0;
558 }
559