[coreboot] [patch] ck804 mmconf

Jonathan A. Kollasch jakllsch at kollasch.net
Sun May 22 17:12:06 CEST 2011


Optionally treat ck804 memory-mapped PCI configuration space window as a
resource.  Not enabled by default because the resource should be
non-posted and there's no way to express that to the resource allocator.

Signed-off-by: Jonathan Kollasch <jakllsch at kollasch.net>
-------------- next part --------------
Index: src/southbridge/nvidia/ck804/Kconfig
===================================================================
--- src/southbridge/nvidia/ck804/Kconfig	(revision 6607)
+++ src/southbridge/nvidia/ck804/Kconfig	(working copy)
@@ -43,4 +43,12 @@
 	int
 	default 1
 
+config CK804_MMCONF_SUPPORT
+	bool
+	default n
+
+config CK804_MMCONF_BASE_ADDRESS
+	hex
+	default 0xe0000000
+
 endif
Index: src/southbridge/nvidia/ck804/ht.c
===================================================================
--- src/southbridge/nvidia/ck804/ht.c	(revision 6607)
+++ src/southbridge/nvidia/ck804/ht.c	(working copy)
@@ -25,9 +25,47 @@
 #include <device/pci_ops.h>
 #include "ck804.h"
 
+static void ht_read_resources(device_t dev)
+{
+#if CONFIG_CK804_MMCONF_SUPPORT
+	struct resource *res;
+#endif
+
+	pci_dev_read_resources(dev);
+
+#if CONFIG_CK804_MMCONF_SUPPORT
+	res = new_resource(dev, 0x90); /* MMCONF */
+	res->base = CONFIG_CK804_MMCONF_BASE_ADDRESS;
+	res->size = 0x10000000;
+	res->align = 28;
+	res->gran = 28;
+	res->limit = 0xffffffff;
+	res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+#endif
+}
+
+static void ht_set_resources(device_t dev)
+{
+#if CONFIG_CK804_MMCONF_SUPPORT
+	struct resource *res;
+#endif
+
+	pci_dev_set_resources(dev);
+
+#if CONFIG_CK804_MMCONF_SUPPORT
+	/* 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, "");
+	}
+#endif
+}
+
 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