2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2008 coresystems GmbH
5 * Copyright (C) 2009 Thomas Jourdan <thomas.jourdan@gmail.com>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; version 2 of
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 static void print_reg(unsigned char index)
32 print_debug_hex8(index);
34 print_debug_hex8(data);
39 static inline void xbus_en(void)
41 /* select the XBUS function in the SIO */
49 static void setup_func(unsigned char func)
51 /* select the function in the SIO */
54 /* print out the regs */
67 static inline void siodump(void)
72 print_debug("\n*** SERVER I/O REGISTERS ***\n");
73 for (i=0x10; i<=0x2d; i++) {
74 print_reg((unsigned char)i);
77 print_debug("\n*** XBUS REGISTERS ***\n");
79 for (i=0xf0; i<=0xff; i++) {
80 print_reg((unsigned char)i);
83 print_debug("\n*** SERIAL 1 CONFIG REGISTERS ***\n");
87 print_debug("\n*** SERIAL 2 CONFIG REGISTERS ***\n");
92 print_debug("\n*** GPIO REGISTERS ***\n");
94 for (i=0xf0; i<=0xf8; i++) {
95 print_reg((unsigned char)i);
97 print_debug("\n*** GPIO VALUES ***\n");
99 print_debug("\nGPDO 4: 0x");
100 print_debug_hex8(data);
102 print_debug("\nGPDI 4: 0x");
103 print_debug_hex8(data);
108 print_debug("\n*** WATCHDOG TIMER REGISTERS ***\n");
112 print_debug("\n*** FAN CONTROL REGISTERS ***\n");
117 print_debug("\n*** RTC REGISTERS ***\n");
127 print_debug("\n*** HEALTH MONITORING & CONTROL REGISTERS ***\n");
134 static void print_debug_pci_dev(unsigned dev)
136 print_debug("PCI: ");
137 print_debug_hex8((dev >> 16) & 0xff);
138 print_debug_char(':');
139 print_debug_hex8((dev >> 11) & 0x1f);
140 print_debug_char('.');
141 print_debug_hex8((dev >> 8) & 7);
144 static inline void print_pci_devices(void)
147 for(dev = PCI_DEV(0, 0, 0);
148 dev <= PCI_DEV(0, 0x1f, 0x7);
149 dev += PCI_DEV(0,0,1)) {
151 id = pci_read_config32(dev, PCI_VENDOR_ID);
152 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
153 (((id >> 16) & 0xffff) == 0xffff) ||
154 (((id >> 16) & 0xffff) == 0x0000)) {
157 print_debug_pci_dev(dev);
162 static inline void dump_pci_device(unsigned dev)
165 print_debug_pci_dev(dev);
168 for(i = 0; i <= 255; i++) {
170 if ((i & 0x0f) == 0) {
172 print_debug_char(':');
174 val = pci_read_config8(dev, i);
175 print_debug_char(' ');
176 print_debug_hex8(val);
177 if ((i & 0x0f) == 0x0f) {
183 static inline void dump_bar14(unsigned dev)
188 print_debug("BAR 14 Dump\n");
190 bar = pci_read_config32(dev, 0x14);
191 for(i = 0; i <= 0x300; i+=4) {
194 if ((i & 0x0f) == 0) {
196 print_debug_char(':');
198 val = pci_read_config8(dev, i);
202 print_debug_hex16(i);
203 print_debug_char(' ');
205 print_debug_hex32(read32(bar + i));
206 print_debug_char(' ');
211 static inline void dump_pci_devices(void)
214 for(dev = PCI_DEV(0, 0, 0);
215 dev <= PCI_DEV(0, 0x1f, 0x7);
216 dev += PCI_DEV(0,0,1)) {
218 id = pci_read_config32(dev, PCI_VENDOR_ID);
219 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
220 (((id >> 16) & 0xffff) == 0xffff) ||
221 (((id >> 16) & 0xffff) == 0x0000)) {
224 dump_pci_device(dev);
228 static inline void dump_spd_registers(void)
232 while(device <= DIMM7) {
236 print_debug("dimm ");
237 print_debug_hex8(device);
239 for(i = 0; (i < 256) ; i++) {
245 status = smbus_read_byte(device, i);
247 print_debug("bad device: ");
248 print_debug_hex8(-status);
252 print_debug_hex8(status);
253 print_debug_char(' ');
260 static inline void dump_ipmi_registers(void)
264 while(device <= 0x42) {
268 print_debug("ipmi ");
269 print_debug_hex8(device);
271 for(i = 0; (i < 8) ; i++) {
272 status = smbus_read_byte(device, 2);
274 print_debug("bad device: ");
275 print_debug_hex8(-status);
279 print_debug_hex8(status);
280 print_debug_char(' ');