(trivial) add filo call back for those few mainboards that still (need to)
[coreboot.git] / src / devices / device.c
index 1b239f9d15e5a2ee555f3bb3b1c7bad778238d9d..06d32ea1f8bb61260a99f95613d816352a4d9898 100644 (file)
@@ -1,7 +1,21 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * It was originally based on the Linux kernel (arch/i386/kernel/pci-pc.c).
+ *
+ * Modifications are:
+ * Copyright (C) 2003 Eric Biederman <ebiederm@xmission.com>
+ * Copyright (C) 2003-2004 Linux Networx
+ * (Written by Eric Biederman <ebiederman@lnxi.com> for Linux Networx)
+ * Copyright (C) 2003 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-2006 Stefan Reinauer <stepan@openbios.org>
+ */
+
 /*
  *      (c) 1999--2000 Martin Mares <mj@suse.cz>
- *      (c) 2003 Eric Biederman <ebiederm@xmission.com>
- *     (c) 2003 Linux Networx
  */
 /* lots of mods by ron minnich (rminnich@lanl.gov), with 
  * the final architecture guidance from Tom Merritt (tjm@codegen.com)
@@ -258,7 +272,7 @@ void compute_allocate_resource(
        min_align = 0;
        base = bridge->base;
 
-       printk_spew("%s compute_allocate_%s: base: %08Lx size: %08Lx align: %d gran: %d\n", 
+       printk_spew("%s compute_allocate_resource %s: base: %08Lx size: %08Lx align: %d gran: %d\n", 
                dev_path(bus->dev),
                (bridge->flags & IORESOURCE_IO)? "io":
                (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem",
@@ -291,11 +305,6 @@ void compute_allocate_resource(
                 * return them.   Some resources must be set even when they have
                 * no size.  PCI bridge resources are a good example of this.
                 */
-               /* Propogate the resource alignment to the bridge register  */
-               if (resource->align > bridge->align) {
-                       bridge->align = resource->align;
-               }
-
                /* Make certain we are dealing with a good minimum size */
                size = resource->size;
                align = resource->align;
@@ -303,6 +312,11 @@ void compute_allocate_resource(
                        align = min_align;
                }
 
+               /* Propagate the resource alignment to the bridge register  */
+               if (align > bridge->align) {
+                       bridge->align = align;
+               }
+
                if (resource->flags & IORESOURCE_FIXED) {
                        continue;
                }
@@ -311,10 +325,12 @@ void compute_allocate_resource(
                if (bridge->limit > resource->limit) {
                        bridge->limit = resource->limit;
                }
+#warning This heuristic should be replaced by real devices with fixed resources.
                /* Artificially deny limits between DEVICE_MEM_HIGH and 0xffffffff */
                if ((bridge->limit > DEVICE_MEM_HIGH) && (bridge->limit <= 0xffffffff)) {
                        bridge->limit = DEVICE_MEM_HIGH;
                }
+
                if (resource->flags & IORESOURCE_IO) {
                        /* Don't allow potential aliases over the
                         * legacy pci expansion card addresses.
@@ -341,8 +357,7 @@ void compute_allocate_resource(
                        resource->flags &= ~IORESOURCE_STORED;
                        base += size;
                        
-                       printk_spew(
-                               "%s %02x *  [0x%08Lx - 0x%08Lx] %s\n",
+                       printk_spew("%s %02lx *  [0x%08Lx - 0x%08Lx] %s\n",
                                dev_path(dev),
                                resource->index, 
                                resource->base, 
@@ -350,6 +365,12 @@ void compute_allocate_resource(
                                (resource->flags & IORESOURCE_IO)? "io":
                                (resource->flags & IORESOURCE_PREFETCH)? "prefmem": "mem");
                }
+#if CONFIG_PCIE_CONFIGSPACE_HOLE
+#warning Handle PCIe hole differently...
+               if (base >= 0xf0000000 && base < 0xf4000000) {
+                       base = 0xf4000000;
+               }
+#endif
        }
        /* A pci bridge resource does not need to be a power
         * of two size, but it does have a minimum granularity.
@@ -359,7 +380,7 @@ void compute_allocate_resource(
         */
        bridge->size = round(base, bridge->gran) - bridge->base;
 
-       printk_spew("%s compute_allocate_%s: base: %08Lx size: %08Lx align: %d gran: %d done\n", 
+       printk_spew("%s compute_allocate_resource %s: base: %08Lx size: %08Lx align: %d gran: %d done\n", 
                dev_path(bus->dev),
                (bridge->flags & IORESOURCE_IO)? "io":
                (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem",
@@ -619,7 +640,7 @@ void dev_enumerate(void)
  * relocated to their final position and stored to the hardware.
  *
  * I/O resources start at DEVICE_IO_START and grow upward. MEM resources start
- * at DEVICE_MEM_START and grow downward.
+ * at DEVICE_MEM_HIGH and grow downward.
  *
  * Since the assignment is hierarchical we set the values into the dev_root
  * struct.