+/*
+ * This file is part of the coreboot project.
+ *
+ * It was originally based on the Linux kernel (drivers/pci/pci.c).
+ *
+ * Modifications are:
+ * Copyright (C) 2003-2004 Linux Networx
+ * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
+ * Copyright (C) 2003-2006 Ronald G. Minnich <rminnich@gmail.com>
+ * Copyright (C) 2004-2005 Li-Ta Lo <ollie@lanl.gov>
+ * Copyright (C) 2005-2006 Tyan
+ * (Written by Yinghai Lu <yhlu@tyan.com> for Tyan)
+ * Copyright (C) 2005-2007 Stefan Reinauer <stepan@openbios.org>
+ */
+
/*
* PCI Bus Services, see include/linux/pci.h for further explanation.
*
* David Mosberger-Tang
*
* Copyright 1997 -- 1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
- *
- * Copyright 2003 -- Eric Biederman <ebiederman@lnxi.com>
*/
#include <console/console.h>
}
command = pci_read_config16(dev, PCI_COMMAND);
command |= dev->command;
- command |= (PCI_COMMAND_PARITY + PCI_COMMAND_SERR); /* error check */
printk_debug("%s cmd <- %02x\n", dev_path(dev), command);
pci_write_config16(dev, PCI_COMMAND, command);
}
((device & 0xffff) << 16) | (vendor & 0xffff));
}
+/** default handler: only runs the relevant pci bios. */
void pci_dev_init(struct device *dev)
{
-#if CONFIG_PCI_ROM_RUN == 1
+#if CONFIG_PCI_ROM_RUN == 1 || CONFIG_VGA_ROM_RUN == 1
+ void run_bios(struct device * dev, unsigned long addr);
struct rom_header *rom, *ram;
+#if CONFIG_PCI_ROM_RUN != 1
+ /* We want to execute VGA option ROMs when CONFIG_VGA_ROM_RUN
+ * is set but CONFIG_PCI_ROM_RUN is not. In this case we skip
+ * all other option ROM types.
+ */
+ if ((dev->class>>8)!=PCI_CLASS_DISPLAY_VGA)
+ return;
+#endif
+
rom = pci_rom_probe(dev);
if (rom == NULL)
return;
+
ram = pci_rom_load(dev, rom);
if (ram == NULL)
return;
- run_bios(dev, ram);
-#endif
+ run_bios(dev, (unsigned long)ram);
+
+#if CONFIG_CONSOLE_VGA == 1
+ /* vga_inited is a trigger of the VGA console code. */
+ if ((dev->class>>8) == PCI_CLASS_DISPLAY_VGA) {
+ extern int vga_inited;
+ vga_inited = 1;
+ }
+#endif /* CONFIG_CONSOLE_VGA */
+#endif /* CONFIG_PCI_ROM_RUN || CONFIG_VGA_ROM_RUN */
}
/** Default device operation for PCI devices */
return;
}
- printk_debug("%s: seeking driver for %x:%x class %x\n",
- __FUNCTION__, dev->vendor, dev->device, dev->class);
- /* Look through the list of setup drivers and find one for
+ /* Look through the list of setup drivers and find one for
* this pci device
*/
for(driver = &pci_drivers[0]; driver != &epci_drivers[0]; driver++) {
if ( (id == 0xffffffff) || (id == 0x00000000) ||
(id == 0x0000ffff) || (id == 0xffff0000))
{
- printk_spew("PCI: devfn 0x%x, bad id 0x%x\n", devfn, id);
+ printk_spew("%s, bad id 0x%x\n", dev_path(&dummy), id);
return NULL;
}
dev = alloc_dev(bus, &dummy.path);
device_t old_devices;
device_t child;
- printk_debug("PCI: pci_scan_bus for bus %d\n", bus->secondary);
+#if PCI_BUS_SEGN_BITS
+ printk_debug("PCI: pci_scan_bus for bus %04x:%02x\n", bus->secondary >> 8, bus->secondary & 0xff);
+#else
+ printk_debug("PCI: pci_scan_bus for bus %02x\n", bus->secondary);
+#endif
old_devices = bus->children;
bus->children = 0;
}
post_code(0x25);
- /* Die if any leftover Static devices are are found.
+ /* Die if any left over static devices are are found.
* There's probably a problem in the Config.lb.
*/
if(old_devices) {
for(left = old_devices; left; left = left->sibling) {
printk_err("%s\n", dev_path(left));
}
- die("PCI: Left over static devices. Check your Config.lb\n");
+ printk_warning("PCI: Left over static devices. Check your mainboard Config.lb\n");
}
/* For all children that implement scan_bus (i.e. bridges)
*
* Return how far we've got finding sub-buses.
*/
- printk_debug("PCI: pci_scan_bus returning with max=%02x\n", max);
+ printk_debug("PCI: pci_scan_bus returning with max=%03x\n", max);
post_code(0x55);
return max;
}