2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Ronald G. Minnich
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * generic K8 debug code, used by mainboard specific romstage.c
27 static void print_debug_pci_dev(unsigned dev)
30 print_debug_hex8((dev >> 16) & 0xff);
31 print_debug_char(':');
32 print_debug_hex8((dev >> 11) & 0x1f);
33 print_debug_char('.');
34 print_debug_hex8((dev >> 8) & 7);
39 static void print_debug_pci_dev(unsigned dev)
42 print_debug_hex8((dev >> 20) & 0xff);
43 print_debug_char(':');
44 print_debug_hex8((dev >> 15) & 0x1f);
45 print_debug_char('.');
46 print_debug_hex8((dev >> 12) & 0x07);
49 static void print_pci_devices(void)
52 for(dev = PCI_DEV(0, 0, 0);
53 dev <= PCI_DEV(0, 0x1f, 0x7);
54 dev += PCI_DEV(0,0,1)) {
56 id = pci_read_config32(dev, PCI_VENDOR_ID);
57 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
58 (((id >> 16) & 0xffff) == 0xffff) ||
59 (((id >> 16) & 0xffff) == 0x0000)) {
62 print_debug_pci_dev(dev);
67 static void dump_pci_device(unsigned dev)
70 print_debug_pci_dev(dev);
73 for(i = 0; i <= 255; i++) {
75 if ((i & 0x0f) == 0) {
77 print_debug_char(':');
79 val = pci_read_config8(dev, i);
80 print_debug_char(' ');
81 print_debug_hex8(val);
82 if ((i & 0x0f) == 0x0f) {
88 static void dump_pci_devices(void)
91 for(dev = PCI_DEV(0, 0, 0);
92 dev <= PCI_DEV(0, 0x1f, 0x7);
93 dev += PCI_DEV(0,0,1)) {
95 id = pci_read_config32(dev, PCI_VENDOR_ID);
96 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
97 (((id >> 16) & 0xffff) == 0xffff) ||
98 (((id >> 16) & 0xffff) == 0x0000)) {
101 dump_pci_device(dev);
105 static void dump_spd_registers(const struct mem_controller *ctrl)
109 for(i = 0; i < 2; i++) {
111 device = ctrl->channel0[i];
114 print_debug("dimm: ");
117 print_debug_hex8(device);
118 for(j = 0; j < 256; j++) {
121 if ((j & 0xf) == 0) {
126 status = smbus_read_byte(device, j);
128 print_debug("bad device\n");
131 byte = status & 0xff;
132 print_debug_hex8(byte);
133 print_debug_char(' ');
138 device = ctrl->channel1[i];
141 print_debug("dimm: ");
144 print_debug_hex8(device);
145 for(j = 0; j < 256; j++) {
148 if ((j & 0xf) == 0) {
153 status = smbus_read_byte(device, j);
155 print_debug("bad device\n");
158 byte = status & 0xff;
159 print_debug_hex8(byte);
160 print_debug_char(' ');
167 static void dump_smbus_registers(void)
171 for(i = 1; i < 0x80; i++) {
175 print_debug("smbus: ");
176 print_debug_hex8(device);
177 for(j = 0; j < 256; j++) {
180 if ((j & 0xf) == 0) {
185 status = smbus_read_byte(device, j);
187 print_debug("bad device\n");
190 byte = status & 0xff;
191 print_debug_hex8(byte);
192 print_debug_char(' ');