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
23 static void print_debug_pci_dev(unsigned dev)
26 print_debug_hex8((dev >> 20) & 0xff);
27 print_debug_char(':');
28 print_debug_hex8((dev >> 15) & 0x1f);
29 print_debug_char('.');
30 print_debug_hex8((dev >> 12) & 0x07);
33 static inline void print_pci_devices(void)
36 for(dev = PCI_DEV(0, 0, 0);
37 dev <= PCI_DEV(0, 0x1f, 0x7);
38 dev += PCI_DEV(0,0,1)) {
40 id = pci_read_config32(dev, PCI_VENDOR_ID);
41 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
42 (((id >> 16) & 0xffff) == 0xffff) ||
43 (((id >> 16) & 0xffff) == 0x0000)) {
46 print_debug_pci_dev(dev);
51 static void dump_pci_device(unsigned dev)
54 print_debug_pci_dev(dev);
57 for(i = 0; i <= 255; i++) {
59 if ((i & 0x0f) == 0) {
61 print_debug_char(':');
63 val = pci_read_config8(dev, i);
64 print_debug_char(' ');
65 print_debug_hex8(val);
66 if ((i & 0x0f) == 0x0f) {
72 static inline void dump_pci_devices(void)
75 for(dev = PCI_DEV(0, 0, 0);
76 dev <= PCI_DEV(0, 0x1f, 0x7);
77 dev += PCI_DEV(0,0,1)) {
79 id = pci_read_config32(dev, PCI_VENDOR_ID);
80 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
81 (((id >> 16) & 0xffff) == 0xffff) ||
82 (((id >> 16) & 0xffff) == 0x0000)) {
89 static inline void dump_spd_registers(void)
93 for(i = 0; i < 2; i++) {
98 print_debug("dimm: ");
101 print_debug_hex8(device);
102 for(j = 0; j < 256; j++) {
105 if ((j & 0xf) == 0) {
110 status = smbus_read_byte(device, j);
112 print_debug("bad device\n");
115 byte = status & 0xff;
116 print_debug_hex8(byte);
117 print_debug_char(' ');
124 static inline void dump_smbus_registers(void)
128 for(i = 1; i < 0x80; i++) {
132 print_debug("smbus: ");
133 print_debug_hex8(device);
134 for(j = 0; j < 256; j++) {
137 if ((j & 0xf) == 0) {
142 status = smbus_read_byte(device, j);
144 print_debug("bad device\n");
147 byte = status & 0xff;
148 print_debug_hex8(byte);
149 print_debug_char(' ');