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,
23 #define SMBUS_MEM_DEVICE_START 0x50
24 #define SMBUS_MEM_DEVICE_END 0x57
25 #define SMBUS_MEM_DEVICE_INC 1
27 static void print_reg(unsigned char index)
34 print_debug_hex8(index);
36 print_debug_hex8(data);
41 static inline void xbus_en(void)
43 /* select the XBUS function in the SIO */
51 static void setup_func(unsigned char func)
53 /* select the function in the SIO */
56 /* print out the regs */
69 static inline void siodump(void)
74 print_debug("\n*** SERVER I/O REGISTERS ***\n");
75 for (i=0x10; i<=0x2d; i++) {
76 print_reg((unsigned char)i);
79 print_debug("\n*** XBUS REGISTERS ***\n");
81 for (i=0xf0; i<=0xff; i++) {
82 print_reg((unsigned char)i);
85 print_debug("\n*** SERIAL 1 CONFIG REGISTERS ***\n");
89 print_debug("\n*** SERIAL 2 CONFIG REGISTERS ***\n");
94 print_debug("\n*** GPIO REGISTERS ***\n");
96 for (i=0xf0; i<=0xf8; i++) {
97 print_reg((unsigned char)i);
99 print_debug("\n*** GPIO VALUES ***\n");
101 print_debug("\nGPDO 4: 0x");
102 print_debug_hex8(data);
104 print_debug("\nGPDI 4: 0x");
105 print_debug_hex8(data);
110 print_debug("\n*** WATCHDOG TIMER REGISTERS ***\n");
114 print_debug("\n*** FAN CONTROL REGISTERS ***\n");
119 print_debug("\n*** RTC REGISTERS ***\n");
129 print_debug("\n*** HEALTH MONITORING & CONTROL REGISTERS ***\n");
136 static void print_debug_pci_dev(unsigned dev)
138 print_debug("PCI: ");
139 print_debug_hex8((dev >> 16) & 0xff);
140 print_debug_char(':');
141 print_debug_hex8((dev >> 11) & 0x1f);
142 print_debug_char('.');
143 print_debug_hex8((dev >> 8) & 7);
146 static inline void print_pci_devices(void)
149 for(dev = PCI_DEV(0, 0, 0);
150 dev <= PCI_DEV(0, 0x1f, 0x7);
151 dev += PCI_DEV(0,0,1)) {
153 id = pci_read_config32(dev, PCI_VENDOR_ID);
154 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
155 (((id >> 16) & 0xffff) == 0xffff) ||
156 (((id >> 16) & 0xffff) == 0x0000)) {
159 print_debug_pci_dev(dev);
164 static inline void dump_pci_device(unsigned dev)
167 print_debug_pci_dev(dev);
170 for(i = 0; i <= 255; i++) {
172 if ((i & 0x0f) == 0) {
174 print_debug_char(':');
176 val = pci_read_config8(dev, i);
177 print_debug_char(' ');
178 print_debug_hex8(val);
179 if ((i & 0x0f) == 0x0f) {
185 static inline void dump_bar14(unsigned dev)
190 print_debug("BAR 14 Dump\n");
192 bar = pci_read_config32(dev, 0x14);
193 for(i = 0; i <= 0x300; i+=4) {
196 if ((i & 0x0f) == 0) {
198 print_debug_char(':');
200 val = pci_read_config8(dev, i);
204 print_debug_hex16(i);
205 print_debug_char(' ');
207 print_debug_hex32(read32(bar + i));
208 print_debug_char(' ');
213 static inline void dump_pci_devices(void)
216 for(dev = PCI_DEV(0, 0, 0);
217 dev <= PCI_DEV(0, 0x1f, 0x7);
218 dev += PCI_DEV(0,0,1)) {
220 id = pci_read_config32(dev, PCI_VENDOR_ID);
221 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
222 (((id >> 16) & 0xffff) == 0xffff) ||
223 (((id >> 16) & 0xffff) == 0x0000)) {
226 dump_pci_device(dev);
230 static inline void dump_spd_registers(void)
233 device = SMBUS_MEM_DEVICE_START;
234 while(device <= SMBUS_MEM_DEVICE_END) {
238 print_debug("dimm ");
239 print_debug_hex8(device);
241 for(i = 0; (i < 256) ; i++) {
247 status = smbus_read_byte(device, i);
249 print_debug("bad device: ");
250 print_debug_hex8(-status);
254 print_debug_hex8(status);
255 print_debug_char(' ');
257 device += SMBUS_MEM_DEVICE_INC;
262 static inline void dump_ipmi_registers(void)
266 while(device <= 0x42) {
270 print_debug("ipmi ");
271 print_debug_hex8(device);
273 for(i = 0; (i < 8) ; i++) {
274 status = smbus_read_byte(device, 2);
276 print_debug("bad device: ");
277 print_debug_hex8(-status);
281 print_debug_hex8(status);
282 print_debug_char(' ');
284 device += SMBUS_MEM_DEVICE_INC;