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,
24 #include <arch/romcc_io.h>
25 #include <device/pci_def.h>
26 #include <console/console.h>
29 #define SMBUS_MEM_DEVICE_START 0x50
30 #define SMBUS_MEM_DEVICE_END 0x53
31 #define SMBUS_MEM_DEVICE_INC 1
33 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 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x", (dev >> 20) & 0xff,
47 (dev >> 15) & 0x1f, (dev >> 12) & 7);
48 printk(BIOS_DEBUG, " [%04x:%04x]\n", id &0xffff, id >> 16);
52 void dump_pci_device(unsigned dev)
56 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
58 for(i = 0; i <= 255; i++) {
60 if ((i & 0x0f) == 0) {
61 printk(BIOS_DEBUG, "%02x:", i);
63 val = pci_read_config8(dev, i);
64 printk(BIOS_DEBUG, " %02x", val);
65 if ((i & 0x0f) == 0x0f) {
66 printk(BIOS_DEBUG, "\n");
71 void dump_pci_devices(void)
74 for(dev = PCI_DEV(0, 0, 0);
75 dev <= PCI_DEV(0, 0x1f, 0x7);
76 dev += PCI_DEV(0,0,1)) {
78 id = pci_read_config32(dev, PCI_VENDOR_ID);
79 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
80 (((id >> 16) & 0xffff) == 0xffff) ||
81 (((id >> 16) & 0xffff) == 0x0000)) {
88 void dump_spd_registers(void)
91 device = SMBUS_MEM_DEVICE_START;
92 while(device <= SMBUS_MEM_DEVICE_END) {
95 printk(BIOS_DEBUG, "\ndimm %02x", device);
97 for(i = 0; (i < 256) ; i++) {
99 printk(BIOS_DEBUG, "\n%02x: ", i);
101 status = smbus_read_byte(device, i);
103 printk(BIOS_DEBUG, "bad device: %02x\n", -status);
106 printk(BIOS_DEBUG, "%02x ", status);
108 device += SMBUS_MEM_DEVICE_INC;
109 printk(BIOS_DEBUG, "\n");
113 void dump_mem(unsigned start, unsigned end)
116 print_debug("dump_mem:");
117 for(i=start;i<end;i++) {
119 printk(BIOS_DEBUG, "\n%08x:", i);
121 printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));