tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / northbridge / intel / i945 / debug.c
blobd26e84ede05ca04e63dc85abbc8391e02fcfe592
1 /*
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
9 * the License.
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.
17 #include <spd.h>
18 #include <lib.h>
19 #include <arch/io.h>
20 #include <device/pci_def.h>
21 #include <console/console.h>
22 #include "i945.h"
24 void print_pci_devices(void)
26 device_t dev;
27 for(dev = PCI_DEV(0, 0, 0);
28 dev <= PCI_DEV(0, 0x1f, 0x7);
29 dev += PCI_DEV(0,0,1)) {
30 uint32_t id;
31 id = pci_read_config32(dev, PCI_VENDOR_ID);
32 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
33 (((id >> 16) & 0xffff) == 0xffff) ||
34 (((id >> 16) & 0xffff) == 0x0000)) {
35 continue;
37 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x", (dev >> 20) & 0xff,
38 (dev >> 15) & 0x1f, (dev >> 12) & 7);
39 printk(BIOS_DEBUG, " [%04x:%04x]\n", id &0xffff, id >> 16);
43 void dump_pci_device(unsigned dev)
45 int i;
47 printk(BIOS_DEBUG, "PCI: %02x:%02x.%02x\n", (dev >> 20) & 0xff, (dev >> 15) & 0x1f, (dev >> 12) & 7);
49 for(i = 0; i <= 255; i++) {
50 unsigned char val;
51 if ((i & 0x0f) == 0) {
52 printk(BIOS_DEBUG, "%02x:", i);
54 val = pci_read_config8(dev, i);
55 printk(BIOS_DEBUG, " %02x", val);
56 if ((i & 0x0f) == 0x0f) {
57 printk(BIOS_DEBUG, "\n");
62 void dump_pci_devices(void)
64 device_t dev;
65 for(dev = PCI_DEV(0, 0, 0);
66 dev <= PCI_DEV(0, 0x1f, 0x7);
67 dev += PCI_DEV(0,0,1)) {
68 uint32_t id;
69 id = pci_read_config32(dev, PCI_VENDOR_ID);
70 if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff) ||
71 (((id >> 16) & 0xffff) == 0xffff) ||
72 (((id >> 16) & 0xffff) == 0x0000)) {
73 continue;
75 dump_pci_device(dev);
79 void dump_spd_registers(void)
81 unsigned device;
82 device = DIMM0;
83 while(device <= DIMM3) {
84 int status = 0;
85 int i;
86 printk(BIOS_DEBUG, "\ndimm %02x", device);
88 for(i = 0; (i < 256) ; i++) {
89 if ((i % 16) == 0) {
90 printk(BIOS_DEBUG, "\n%02x: ", i);
92 status = smbus_read_byte(device, i);
93 if (status < 0) {
94 printk(BIOS_DEBUG, "bad device: %02x\n", -status);
95 break;
97 printk(BIOS_DEBUG, "%02x ", status);
99 device++;
100 printk(BIOS_DEBUG, "\n");
104 void dump_mem(unsigned start, unsigned end)
106 unsigned i;
107 printk(BIOS_DEBUG, "dump_mem:");
108 for(i=start;i<end;i++) {
109 if((i & 0xf)==0) {
110 printk(BIOS_DEBUG, "\n%08x:", i);
112 printk(BIOS_DEBUG, " %02x", (unsigned char)*((unsigned char *)i));
114 printk(BIOS_DEBUG, "\n");