2010-04-03 14:41:41 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the coreboot project.
|
|
|
|
*
|
|
|
|
* (C) 2007-2009 coresystems GmbH
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; version 2 of
|
|
|
|
* the License.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*/
|
2006-01-28 00:46:30 +01:00
|
|
|
|
2017-03-09 01:34:12 +01:00
|
|
|
static void print_debug_pci_dev(unsigned int dev)
|
2006-01-28 00:46:30 +01:00
|
|
|
{
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "PCI: %02x:%02x.%x",
|
|
|
|
(dev >> 16) & 0xff, (dev >> 11) & 0x1f, (dev >> 8) & 7);
|
2006-01-28 00:46:30 +01:00
|
|
|
}
|
|
|
|
|
2010-04-03 14:41:41 +02:00
|
|
|
static inline void print_pci_devices(void)
|
2006-01-28 00:46:30 +01:00
|
|
|
{
|
2018-06-12 22:06:09 +02:00
|
|
|
#if defined(__SIMPLE_DEVICE__)
|
|
|
|
pci_devfn_t dev;
|
|
|
|
#else
|
|
|
|
struct device *dev;
|
|
|
|
#endif
|
2010-04-03 14:41:41 +02:00
|
|
|
for (dev = PCI_DEV(0, 0, 0);
|
2010-04-15 14:43:07 +02:00
|
|
|
dev <= PCI_DEV(0x00, 0x1f, 0x7); dev += PCI_DEV(0, 0, 1)) {
|
2010-04-03 14:41:41 +02:00
|
|
|
u32 id;
|
2006-01-28 00:46:30 +01:00
|
|
|
id = pci_read_config32(dev, PCI_VENDOR_ID);
|
2010-04-03 14:41:41 +02:00
|
|
|
if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff)
|
|
|
|
|| (((id >> 16) & 0xffff) == 0xffff)
|
|
|
|
|| (((id >> 16) & 0xffff) == 0x0000)) {
|
2006-01-28 00:46:30 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
print_debug_pci_dev(dev);
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "\n");
|
2006-01-28 00:46:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-09 01:34:12 +01:00
|
|
|
static void dump_pci_device(unsigned int dev)
|
2006-01-28 00:46:30 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
print_debug_pci_dev(dev);
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "\n");
|
2010-04-03 14:41:41 +02:00
|
|
|
|
|
|
|
for (i = 0; i <= 255; i++) {
|
2006-01-28 00:46:30 +01:00
|
|
|
unsigned char val;
|
2015-01-05 22:12:38 +01:00
|
|
|
if ((i & 0x0f) == 0)
|
|
|
|
printk(BIOS_DEBUG, "%02x:", i);
|
2006-01-28 00:46:30 +01:00
|
|
|
val = pci_read_config8(dev, i);
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, " %02x", val);
|
|
|
|
if ((i & 0x0f) == 0x0f)
|
|
|
|
printk(BIOS_DEBUG, "\n");
|
2006-01-28 00:46:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-04-03 14:41:41 +02:00
|
|
|
static inline void dump_pci_devices(void)
|
2006-01-28 00:46:30 +01:00
|
|
|
{
|
2018-06-12 22:06:09 +02:00
|
|
|
#if defined(__SIMPLE_DEVICE__)
|
|
|
|
pci_devfn_t dev;
|
|
|
|
#else
|
|
|
|
struct device *dev;
|
|
|
|
#endif
|
2010-04-03 14:41:41 +02:00
|
|
|
for (dev = PCI_DEV(0, 0, 0);
|
|
|
|
dev <= PCI_DEV(0, 0x1f, 0x7); dev += PCI_DEV(0, 0, 1)) {
|
|
|
|
u32 id;
|
2006-01-28 00:46:30 +01:00
|
|
|
id = pci_read_config32(dev, PCI_VENDOR_ID);
|
2010-04-03 14:41:41 +02:00
|
|
|
if (((id & 0xffff) == 0x0000) || ((id & 0xffff) == 0xffff)
|
|
|
|
|| (((id >> 16) & 0xffff) == 0xffff)
|
|
|
|
|| (((id >> 16) & 0xffff) == 0x0000)) {
|
2006-01-28 00:46:30 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
dump_pci_device(dev);
|
|
|
|
}
|
|
|
|
}
|
2010-04-03 14:41:41 +02:00
|
|
|
|
|
|
|
|
2017-03-09 01:34:12 +01:00
|
|
|
static inline void dump_io_resources(unsigned int port)
|
2010-04-03 14:41:41 +02:00
|
|
|
{
|
|
|
|
int i;
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, "%04x:\n", port);
|
2010-04-03 14:41:41 +02:00
|
|
|
for (i = 0; i < 256; i++) {
|
|
|
|
u8 val;
|
2015-01-05 22:12:38 +01:00
|
|
|
if ((i & 0x0f) == 0)
|
|
|
|
printk(BIOS_DEBUG, "%02x:", i);
|
2010-04-03 14:41:41 +02:00
|
|
|
val = inb(port);
|
2015-01-05 22:12:38 +01:00
|
|
|
printk(BIOS_DEBUG, " %02x", val);
|
|
|
|
if ((i & 0x0f) == 0x0f)
|
|
|
|
printk(BIOS_DEBUG, "\n");
|
2010-04-03 14:41:41 +02:00
|
|
|
port++;
|
|
|
|
}
|
|
|
|
}
|