[coreboot] r1112 - coreboot-v3/device
svn at coreboot.org
svn at coreboot.org
Fri Jan 9 15:17:09 CET 2009
Author: myles
Date: 2009-01-09 15:17:06 +0100 (Fri, 09 Jan 2009)
New Revision: 1112
Modified:
coreboot-v3/device/device.c
Log:
This patch adds the domain's resources and all links to the tree traversal for
constraining resources. Build and boot tested on qemu, serengeti, and
alix2c3.
Signed-off-by: Myles Watson <mylesgw at gmail.com>
Acked-by: Ward Vandewege <ward at gnu.org>
Modified: coreboot-v3/device/device.c
===================================================================
--- coreboot-v3/device/device.c 2009-01-08 20:07:21 UTC (rev 1111)
+++ coreboot-v3/device/device.c 2009-01-09 14:17:06 UTC (rev 1112)
@@ -705,41 +705,42 @@
#define MEM_TYPE (IORESOURCE_MEM)
#define IO_TYPE (IORESOURCE_IO)
- /* Descend into every child and look for fixed resources. */
- for (child=dev->link[0].children; child; child = child->sibling) {
- constrain_resources(child, limits);
- for (i = 0; i<child->resources; i++) {
- res = &child->resource[i];
- if (!(res->flags & IORESOURCE_FIXED))
- continue;
+ /* Constrain limits based on the fixed resources of this device. */
+ for (i = 0; i<dev->resources; i++) {
+ res = &dev->resource[i];
+ if (!(res->flags & IORESOURCE_FIXED))
+ continue;
- /* PREFETCH, MEM, or I/O - skip any others. */
- if ((res->flags & MEM_MASK) == PREF_TYPE)
- lim = &limits->pref;
- else if ((res->flags & MEM_MASK) == MEM_TYPE)
- lim = &limits->mem;
- else if ((res->flags & IO_MASK) == IO_TYPE)
- lim = &limits->io;
- else
- continue;
+ /* PREFETCH, MEM, or I/O - skip any others. */
+ if ((res->flags & MEM_MASK) == PREF_TYPE)
+ lim = &limits->pref;
+ else if ((res->flags & MEM_MASK) == MEM_TYPE)
+ lim = &limits->mem;
+ else if ((res->flags & IO_MASK) == IO_TYPE)
+ lim = &limits->io;
+ else
+ continue;
- /* Is it already outside the limits? */
- if (res->size &&
- (((res->base + res->size -1) < lim->base) ||
- (res->base > lim->limit)))
- continue;
+ /* Is it already outside the limits? */
+ if (res->size && (((res->base + res->size -1) < lim->base) ||
+ (res->base > lim->limit)))
+ continue;
- /* Choose to be above or below fixed resources. This
- * check is signed so that "negative" amounts of space
- * are handled correctly.
- */
- if ((s64)(lim->limit - (res->base + res->size -1)) >
- (s64)(res->base - lim->base))
- lim->base = res->base + res->size;
- else
- lim->limit = res->base -1;
- }
+ /* Choose to be above or below fixed resources. This
+ * check is signed so that "negative" amounts of space
+ * are handled correctly.
+ */
+ if ((s64)(lim->limit - (res->base + res->size -1)) >
+ (s64)(res->base - lim->base))
+ lim->base = res->base + res->size;
+ else
+ lim->limit = res->base -1;
}
+
+ /* Descend into every child and look for fixed resources. */
+ for (i = 0; i< dev->links; i++)
+ for (child=dev->link[i].children; child; child = child->sibling)
+ constrain_resources(child, limits);
}
static void avoid_fixed_resources(struct device *dev)
More information about the coreboot
mailing list