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
21 static void print_debug_pci_dev(unsigned dev)
24 print_debug_hex8((dev >> 20) & 0xff);
25 print_debug_char(':');
26 print_debug_hex8((dev >> 15) & 0x1f);
27 print_debug_char('.');
28 print_debug_hex8((dev >> 12) & 0x07);
31 static inline void print_pci_devices(void)
34 for(dev = PCI_DEV(0, 0, 0);
35 dev <= PCI_DEV(0, 0x1f, 0x7);
36 dev += PCI_DEV(0,0,1)) {
38 id = pci_read_config32(dev, PCI_VENDOR_ID);
39 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
40 (((id >> 16) & 0xffff) == 0xffff) ||
41 (((id >> 16) & 0xffff) == 0x0000)) {
44 print_debug_pci_dev(dev);
49 static void dump_pci_device(unsigned dev)
52 print_debug_pci_dev(dev);
55 for(i = 0; i <= 255; i++) {
57 if ((i & 0x0f) == 0) {
59 print_debug_char(':');
61 val = pci_read_config8(dev, i);
62 print_debug_char(' ');
63 print_debug_hex8(val);
64 if ((i & 0x0f) == 0x0f) {
70 static inline void dump_pci_devices(void)
73 for(dev = PCI_DEV(0, 0, 0);
74 dev <= PCI_DEV(0, 0x1f, 0x7);
75 dev += PCI_DEV(0,0,1)) {
77 id = pci_read_config32(dev, PCI_VENDOR_ID);
78 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
79 (((id >> 16) & 0xffff) == 0xffff) ||
80 (((id >> 16) & 0xffff) == 0x0000)) {
87 static inline void dump_spd_registers(const struct mem_controller *ctrl)
91 for(i = 0; i < 2; i++) {
93 device = ctrl->channel0[i];
96 print_debug("dimm: ");
99 print_debug_hex8(device);
100 for(j = 0; j < 256; j++) {
103 if ((j & 0xf) == 0) {
108 status = smbus_read_byte(device, j);
110 print_debug("bad device\n");
113 byte = status & 0xff;
114 print_debug_hex8(byte);
115 print_debug_char(' ');
122 static inline void dump_smbus_registers(void)
126 for(i = 1; i < 0x80; i++) {
130 print_debug("smbus: ");
131 print_debug_hex8(device);
132 for(j = 0; j < 256; j++) {
135 if ((j & 0xf) == 0) {
140 status = smbus_read_byte(device, j);
142 print_debug("bad device\n");
145 byte = status & 0xff;
146 print_debug_hex8(byte);
147 print_debug_char(' ');