From b585710bc28dc6b72f15c50835a4b81e7fa2eaa3 Mon Sep 17 00:00:00 2001 From: "Ronald G. Minnich" Date: Tue, 29 Apr 2008 03:52:57 +0000 Subject: [PATCH] properly align bridge resources. Signed-off-by: Aaron Lwe Acked-by: Joseph Smith Tested on v3 and Signed-off-by: Ronald G. Minnich This patch also (accidently) includes a simple fix for the null pointer reference problem. I had forgotten that the fix was in there, but I will include it here and hope no one is too upset about its inclusion. git-svn-id: svn://coreboot.org/repository/coreboot-v3@669 f3766cd6-281f-0410-b1cd-43a5c92072e9 --- device/device.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/device/device.c b/device/device.c index 76ecc8a0dd..2a0d251294 100644 --- a/device/device.c +++ b/device/device.c @@ -292,9 +292,10 @@ static void read_resources(struct bus *bus) int i; printk(BIOS_SPEW, "%s: %s(%s) dtsname %s have_resources %d enabled %d\n", - __func__, bus->dev->dtsname, dev_path(bus->dev), - curdev->dtsname, - curdev->have_resources, curdev->enabled); + __func__, bus->dev? bus->dev->dtsname : "NOBUSDEV", + bus->dev ? dev_path(bus->dev) : "NOBUSDEV", + curdev->dtsname, + curdev->have_resources, curdev->enabled); if (curdev->have_resources) { continue; } @@ -469,10 +470,6 @@ void compute_allocate_resource(struct bus *bus, struct resource *bridge, * they have no size. PCI bridge resources are a good example * of this. */ - /* Propagate 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; @@ -481,6 +478,11 @@ void compute_allocate_resource(struct bus *bus, struct resource *bridge, align = min_align; } + /* Propogate the resource alignment to the bridge register */ + if (align > bridge->align) { + bridge->align = align; + } + if (resource->flags & IORESOURCE_FIXED) { continue; }