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.
19 static void print_debug_pci_dev(unsigned dev
)
21 printk(BIOS_DEBUG
, "PCI: %02x:%02x.%x",
22 (dev
>> 20) & 0xff, (dev
>> 15) & 0x1f, (dev
>> 12) & 0x07);
25 static inline void print_pci_devices(void)
28 for(dev
= PCI_DEV(0, 0, 0);
29 dev
<= PCI_DEV(0, 0x1f, 0x7);
30 dev
+= PCI_DEV(0,0,1)) {
32 id
= pci_read_config32(dev
, PCI_VENDOR_ID
);
33 if (((id
& 0xffff) == 0x0000) || ((id
& 0xffff) == 0xffff) ||
34 (((id
>> 16) & 0xffff) == 0xffff) ||
35 (((id
>> 16) & 0xffff) == 0x0000)) {
38 print_debug_pci_dev(dev
);
39 printk(BIOS_DEBUG
, "\n");
43 static void dump_pci_device(unsigned dev
)
46 print_debug_pci_dev(dev
);
47 printk(BIOS_DEBUG
, "\n");
49 for(i
= 0; i
<= 255; i
++) {
52 printk(BIOS_DEBUG
, "%02x:", i
);
53 val
= pci_read_config8(dev
, i
);
54 printk(BIOS_DEBUG
, " %02x", val
);
55 if ((i
& 0x0f) == 0x0f)
56 printk(BIOS_DEBUG
, "\n");
60 static inline void dump_pci_devices(void)
63 for(dev
= PCI_DEV(0, 0, 0);
64 dev
<= PCI_DEV(0, 0x1f, 0x7);
65 dev
+= PCI_DEV(0,0,1)) {
67 id
= pci_read_config32(dev
, PCI_VENDOR_ID
);
68 if (((id
& 0xffff) == 0x0000) || ((id
& 0xffff) == 0xffff) ||
69 (((id
>> 16) & 0xffff) == 0xffff) ||
70 (((id
>> 16) & 0xffff) == 0x0000)) {
77 static inline void dump_spd_registers(void)
80 printk(BIOS_DEBUG
, "\n");
81 for(i
= 0; i
< 2; i
++) {
86 printk(BIOS_DEBUG
, "dimm: %02x.0: %02x", i
, device
);
87 for(j
= 0; j
< 256; j
++) {
91 printk(BIOS_DEBUG
, "\n%02x: ", j
);
92 status
= smbus_read_byte(device
, j
);
94 printk(BIOS_DEBUG
, "bad device\n");
98 printk(BIOS_DEBUG
, "%02x ", byte
);
100 printk(BIOS_DEBUG
, "\n");
105 static inline void dump_smbus_registers(void)
108 printk(BIOS_DEBUG
, "\n");
109 for(i
= 1; i
< 0x80; i
++) {
113 printk(BIOS_DEBUG
, "smbus: %02x", device
);
114 for(j
= 0; j
< 256; j
++) {
118 printk(BIOS_DEBUG
, "\n%02x: ", j
);
119 status
= smbus_read_byte(device
, j
);
121 printk(BIOS_DEBUG
, "bad device\n");
124 byte
= status
& 0xff;
125 printk(BIOS_DEBUG
, "%02x ", byte
);
127 printk(BIOS_DEBUG
, "\n");