2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2008 coresystems GmbH
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
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,
25 #include <arch/romcc_io.h>
26 #include <device/pci_def.h>
27 #include <console/console.h>
30 void print_pci_devices(void)
33 for(dev = PCI_DEV(0, 0, 0);
34 dev <= PCI_DEV(0, 0x1f, 0x7);
35 dev += PCI_DEV(0,0,1)) {
37 id = pci_read_config32(dev, PCI_VENDOR_ID);
38 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
39 (((id >> 16) & 0xffff) == 0xffff) ||
40 (((id >> 16) & 0xffff) == 0x0000)) {
43 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x", (dev >> 20) & 0xff,
44 (dev >> 15) & 0x1f, (dev >> 12) & 7);
45 printk(BIOS_DEBUG, " [%04x:%04x]\n", id &0xffff, id >> 16);
49 void dump_pci_device(unsigned dev)
53 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
55 for(i = 0; i <= 255; i++) {
57 if ((i & 0x0f) == 0) {
58 printk(BIOS_DEBUG, "%02x:", i);
60 val = pci_read_config8(dev, i);
61 printk(BIOS_DEBUG, " %02x", val);
62 if ((i & 0x0f) == 0x0f) {
63 printk(BIOS_DEBUG, "\n");
68 void dump_pci_devices(void)
71 for(dev = PCI_DEV(0, 0, 0);
72 dev <= PCI_DEV(0, 0x1f, 0x7);
73 dev += PCI_DEV(0,0,1)) {
75 id = pci_read_config32(dev, PCI_VENDOR_ID);
76 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
77 (((id >> 16) & 0xffff) == 0xffff) ||
78 (((id >> 16) & 0xffff) == 0x0000)) {
85 void dump_spd_registers(void)
89 while(device <= DIMM3) {
92 printk(BIOS_DEBUG, "\ndimm %02x", device);
94 for(i = 0; (i < 256) ; i++) {
96 printk(BIOS_DEBUG, "\n%02x: ", i);
98 status = smbus_read_byte(device, i);
100 printk(BIOS_DEBUG, "bad device: %02x\n", -status);
103 printk(BIOS_DEBUG, "%02x ", status);
106 printk(BIOS_DEBUG, "\n");
110 void dump_mem(unsigned start, unsigned end)
113 print_debug("dump_mem:");
114 for(i=start;i<end;i++) {
116 printk(BIOS_DEBUG, "\n%08x:", i);
118 printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));