[coreboot] New patch to review for coreboot: fc29761 amdk8: Increase limits for MMIO to TOLM..MMCONF

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Tue Mar 12 15:04:03 CET 2013


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2662

-gerrit

commit fc2976167726e066d16c1cd8c920d6df90144848
Author: Nico Huber <nico.huber at secunet.com>
Date:   Fri Mar 8 12:36:04 2013 +0100

    amdk8: Increase limits for MMIO to TOLM..MMCONF
    
    ACPI tells the OS that TOLM..MMCONF is safe to use for device's
    MMIO regions. Unfortunately we never told the chipset, but gave
    it only the region that our own resource assignment used.
    
    With this change, devices that are configured by the OS (for
    whatever reason: PCIe hotplug, because the OS feels like it, or
    as in our case, a bug in the coreboot resource allocator that
    leaves devices unallocated) actually work (assuming that there
    are no other bugs)
    
    Change-Id: Ib63c05484739d84198a9f10352be2055c6f14385
    Signed-off-by: Nico Huber <nico.huber at secunet.com>
    Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
 src/northbridge/amd/amdk8/northbridge.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c
index 5c1d97a..da8cf48 100644
--- a/src/northbridge/amd/amdk8/northbridge.c
+++ b/src/northbridge/amd/amdk8/northbridge.c
@@ -33,6 +33,8 @@
 
 #include <cpu/amd/amdk8_sysconf.h>
 
+#include <southbridge/amd/rs690/rs690.h>
+
 struct amdk8_sysconf_t sysconf;
 
 #define MAX_FX_DEVS 8
@@ -531,6 +533,10 @@ static void amdk8_set_resources(device_t dev)
 	struct bus *bus;
 	struct resource *res;
 
+	struct resource *mem_lowest = NULL, *mem_highest = NULL;
+
+	const uint32_t topmem = (uint32_t)bsp_topmem();
+
 	/* Find the nodeid */
 	nodeid = amdk8_nodeid(dev);
 
@@ -559,6 +565,29 @@ static void amdk8_set_resources(device_t dev)
 			res->index = index;
 
 		amdk8_set_resource(dev, res, nodeid);
+
+		if (res->flags & IORESOURCE_MEM) {
+			if (!mem_lowest || (res->base > topmem &&
+						res->base < mem_lowest->base))
+				mem_lowest = res;
+			if (!mem_highest ||
+					(res->base + res->size) >
+					(mem_highest->base + mem_highest->size))
+				mem_highest = res;
+		}
+	}
+
+	if (mem_lowest && mem_lowest->base > topmem) {
+		mem_lowest->size += mem_lowest->base - topmem;
+		mem_lowest->base = topmem;
+		mem_lowest->flags &= ~IORESOURCE_STORED;
+		amdk8_set_resource(dev, mem_lowest, nodeid);
+	}
+	if (mem_highest && (mem_highest->base + mem_highest->size) <
+							EXT_CONF_BASE_ADDRESS) {
+		mem_highest->size = EXT_CONF_BASE_ADDRESS - mem_highest->base;
+		mem_highest->flags &= ~IORESOURCE_STORED;
+		amdk8_set_resource(dev, mem_highest, nodeid);
 	}
 
 	compact_resources(dev);



More information about the coreboot mailing list