Add abuild support for the dbm690t. (trivial)
[coreboot.git] / src / devices / pci_device.c
index 2a7502b2804a0be672da3f7a6f9a4cc60d58e27f..7fb86933be60536068430ccc384ba3eda1c0b537 100644 (file)
@@ -1,3 +1,18 @@
+/*
+ * 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.
  *
@@ -5,8 +20,6 @@
  *      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>
@@ -590,7 +603,6 @@ void pci_dev_enable_resources(struct device *dev)
        }
        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);
 }
@@ -631,20 +643,40 @@ void pci_dev_set_subsystem(device_t dev, unsigned vendor, unsigned device)
                ((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 */
@@ -761,9 +793,7 @@ static void set_pci_ops(struct device *dev)
                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++) {
@@ -893,7 +923,7 @@ device_t pci_probe_dev(device_t dev, struct bus *bus, unsigned devfn)
                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);
@@ -1004,7 +1034,11 @@ unsigned int pci_scan_bus(struct bus *bus,
        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;
@@ -1037,7 +1071,7 @@ unsigned int pci_scan_bus(struct bus *bus,
        }
        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) {
@@ -1045,7 +1079,7 @@ unsigned int pci_scan_bus(struct bus *bus,
                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)
@@ -1062,7 +1096,7 @@ unsigned int pci_scan_bus(struct bus *bus,
         *
         * 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;
 }