tree: drop last paragraph of GPL copyright header
[coreboot.git] / src / northbridge / intel / i855 / debug.c
bloba832dda00a0951f90e382b45a59a2b76e57913b6
1 /*
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.
17 #include <spd.h>
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)
27 device_t dev;
28 for(dev = PCI_DEV(0, 0, 0);
29 dev <= PCI_DEV(0, 0x1f, 0x7);
30 dev += PCI_DEV(0,0,1)) {
31 uint32_t id;
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)) {
36 continue;
38 print_debug_pci_dev(dev);
39 printk(BIOS_DEBUG, "\n");
43 static void dump_pci_device(unsigned dev)
45 int i;
46 print_debug_pci_dev(dev);
47 printk(BIOS_DEBUG, "\n");
49 for(i = 0; i <= 255; i++) {
50 unsigned char val;
51 if ((i & 0x0f) == 0)
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)
62 device_t dev;
63 for(dev = PCI_DEV(0, 0, 0);
64 dev <= PCI_DEV(0, 0x1f, 0x7);
65 dev += PCI_DEV(0,0,1)) {
66 uint32_t id;
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)) {
71 continue;
73 dump_pci_device(dev);
77 static inline void dump_spd_registers(void)
79 int i;
80 printk(BIOS_DEBUG, "\n");
81 for(i = 0; i < 2; i++) {
82 unsigned device;
83 device = DIMM0 + i;
84 if (device) {
85 int j;
86 printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device);
87 for(j = 0; j < 256; j++) {
88 int status;
89 unsigned char byte;
90 if ((j & 0xf) == 0)
91 printk(BIOS_DEBUG, "\n%02x: ", j);
92 status = smbus_read_byte(device, j);
93 if (status < 0) {
94 printk(BIOS_DEBUG, "bad device\n");
95 break;
97 byte = status & 0xff;
98 printk(BIOS_DEBUG, "%02x ", byte);
100 printk(BIOS_DEBUG, "\n");
105 static inline void dump_smbus_registers(void)
107 int i;
108 printk(BIOS_DEBUG, "\n");
109 for(i = 1; i < 0x80; i++) {
110 unsigned device;
111 device = i;
112 int j;
113 printk(BIOS_DEBUG, "smbus: %02x", device);
114 for(j = 0; j < 256; j++) {
115 int status;
116 unsigned char byte;
117 if ((j & 0xf) == 0)
118 printk(BIOS_DEBUG, "\n%02x: ", j);
119 status = smbus_read_byte(device, j);
120 if (status < 0) {
121 printk(BIOS_DEBUG, "bad device\n");
122 break;
124 byte = status & 0xff;
125 printk(BIOS_DEBUG, "%02x ", byte);
127 printk(BIOS_DEBUG, "\n");