[coreboot] [patch] ck804 mmconf

Jonathan A. Kollasch jakllsch at kollasch.net
Mon May 23 21:02:34 CEST 2011


Treat ck804 PCI memory mapped configuration space as a fixed resource.
 
Signed-off-by: Jonathan Kollasch <jakllsch at kollasch.net>
-------------- next part --------------
Index: src/southbridge/nvidia/ck804/Kconfig
===================================================================
--- src/southbridge/nvidia/ck804/Kconfig	(revision 6610)
+++ src/southbridge/nvidia/ck804/Kconfig	(working copy)
@@ -43,4 +43,16 @@
 	int
 	default 1
 
+config MMCONF_SUPPORT
+	bool
+	default y
+
+config MMCONF_BASE_ADDRESS
+	hex
+	default 0xe0000000
+
+config MMCONF_BUS_NUMBER
+	int
+	default 256
+
 endif
Index: src/southbridge/nvidia/ck804/ht.c
===================================================================
--- src/southbridge/nvidia/ck804/ht.c	(revision 6610)
+++ src/southbridge/nvidia/ck804/ht.c	(working copy)
@@ -23,11 +23,44 @@
 #include <device/pci.h>
 #include <device/pci_ids.h>
 #include <device/pci_ops.h>
+#include <lib.h>
 #include "ck804.h"
 
+static void ht_read_resources(device_t dev)
+{
+	struct resource *res;
+
+	pci_dev_read_resources(dev);
+
+	/* MCFG untested on dual-ck804 and/or fam10h boards */
+
+	res = new_resource(dev, 0x90); /* MMCONF */
+	res->base = CONFIG_MMCONF_BASE_ADDRESS;
+	res->size = 0x10000000;
+	res->align = log2(res->size);
+	res->gran = log2(res->size);
+	res->limit = 0xffffffff;
+	res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+}
+
+static void ht_set_resources(device_t dev)
+{
+	struct resource *res;
+
+	pci_dev_set_resources(dev);
+
+	/* enable MMCONF */
+	res = find_resource(dev, 0x90);
+	if (res) {
+		pci_write_config16(dev, 0x90, 1<<12|((res->base >> 28)&0xf));
+		res->flags |= IORESOURCE_STORED;
+		report_resource_stored(dev, res, "");
+	}
+}
+
 static struct device_operations ht_ops = {
-	.read_resources   = pci_dev_read_resources,
-	.set_resources    = pci_dev_set_resources,
+	.read_resources   = ht_read_resources,
+	.set_resources    = ht_set_resources,
 	.enable_resources = pci_dev_enable_resources,
 	.init             = 0,
 	.scan_bus         = 0,


More information about the coreboot mailing list