2 * This file is part of the coreboot project.
4 * (C) 2007-2009 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.
17 static void print_debug_pci_dev(unsigned int dev
)
19 printk(BIOS_DEBUG
, "PCI: %02x:%02x.%x",
20 (dev
>> 16) & 0xff, (dev
>> 11) & 0x1f, (dev
>> 8) & 7);
23 static inline void print_pci_devices(void)
26 for (dev
= PCI_DEV(0, 0, 0);
27 dev
<= PCI_DEV(0x00, 0x1f, 0x7); dev
+= PCI_DEV(0, 0, 1)) {
29 id
= pci_read_config32(dev
, PCI_VENDOR_ID
);
30 if (((id
& 0xffff) == 0x0000) || ((id
& 0xffff) == 0xffff)
31 || (((id
>> 16) & 0xffff) == 0xffff)
32 || (((id
>> 16) & 0xffff) == 0x0000)) {
35 print_debug_pci_dev(dev
);
36 printk(BIOS_DEBUG
, "\n");
40 static void dump_pci_device(unsigned int dev
)
43 print_debug_pci_dev(dev
);
44 printk(BIOS_DEBUG
, "\n");
46 for (i
= 0; i
<= 255; i
++) {
49 printk(BIOS_DEBUG
, "%02x:", i
);
50 val
= pci_read_config8(dev
, i
);
51 printk(BIOS_DEBUG
, " %02x", val
);
52 if ((i
& 0x0f) == 0x0f)
53 printk(BIOS_DEBUG
, "\n");
57 static inline void dump_pci_devices(void)
60 for (dev
= PCI_DEV(0, 0, 0);
61 dev
<= PCI_DEV(0, 0x1f, 0x7); dev
+= PCI_DEV(0, 0, 1)) {
63 id
= pci_read_config32(dev
, PCI_VENDOR_ID
);
64 if (((id
& 0xffff) == 0x0000) || ((id
& 0xffff) == 0xffff)
65 || (((id
>> 16) & 0xffff) == 0xffff)
66 || (((id
>> 16) & 0xffff) == 0x0000)) {
74 static inline void dump_io_resources(unsigned int port
)
77 printk(BIOS_DEBUG
, "%04x:\n", port
);
78 for (i
= 0; i
< 256; i
++) {
81 printk(BIOS_DEBUG
, "%02x:", i
);
83 printk(BIOS_DEBUG
, " %02x", val
);
84 if ((i
& 0x0f) == 0x0f)
85 printk(BIOS_DEBUG
, "\n");