Would you mind applying these and testing too?

Signed-off-by: Myles Watson <[email protected]>

Thanks,
Myles
Index: svn/src/northbridge/amd/amdfam10/northbridge.c
===================================================================
--- svn.orig/src/northbridge/amd/amdfam10/northbridge.c
+++ svn/src/northbridge/amd/amdfam10/northbridge.c
@@ -865,6 +865,9 @@ static void disable_hoist_memory(unsigne
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64	// maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
+#if CONFIG_GFXUMA == 1
+extern uint64_t uma_memory_base, uma_memory_size;
+#endif
 #endif
 
 static void amdfam10_domain_set_resources(device_t dev)
@@ -1038,7 +1041,11 @@ static void amdfam10_domain_set_resource
 #if CONFIG_WRITE_HIGH_TABLES==1
 					if (high_tables_base==0) {
 					/* Leave some space for ACPI, PIRQ and MP tables */
+#if CONFIG_GFXUMA == 1
+						high_tables_base = uma_memory_base - (HIGH_TABLES_SIZE * 1024);
+#else
 						high_tables_base = (mmio_basek - HIGH_TABLES_SIZE) * 1024;
+#endif
 						high_tables_size = HIGH_TABLES_SIZE * 1024;
 						printk(BIOS_DEBUG, " split: %dK table at =%08llx\n", HIGH_TABLES_SIZE,
 							     high_tables_base);
@@ -1073,7 +1080,11 @@ static void amdfam10_domain_set_resource
 			     i, mmio_basek, basek, limitk);
 		if (high_tables_base==0) {
 		/* Leave some space for ACPI, PIRQ and MP tables */
+#if CONFIG_GFXUMA == 1
+			high_tables_base = uma_memory_base - (HIGH_TABLES_SIZE * 1024);
+#else
 			high_tables_base = (limitk - HIGH_TABLES_SIZE) * 1024;
+#endif
 			high_tables_size = HIGH_TABLES_SIZE * 1024;
 		}
 #endif
Index: svn/src/mainboard/asus/m4a785-m/mainboard.c
===================================================================
--- svn.orig/src/mainboard/asus/m4a785-m/mainboard.c
+++ svn/src/mainboard/asus/m4a785-m/mainboard.c
@@ -46,9 +46,6 @@ extern int do_smbus_write_byte(u32 smbus
 
 uint64_t uma_memory_base, uma_memory_size;
 
-#define HIGH_TABLES_SIZE 64	// maximum size of high tables in KB
-extern uint64_t high_tables_base, high_tables_size;
-
 void set_pcie_dereset(void);
 void set_pcie_reset(void);
 u8 is_dev3_present(void);
@@ -274,10 +271,6 @@ static void m4a785m_enable(device_t dev)
 	uma_memory_base = 0x38000000;	/* 1GB  system memory supposed */
 #endif
 
-	// set location of Coreboot high_tables just below UMA
-	high_tables_size = HIGH_TABLES_SIZE * 1024; // convert KB to B
-	high_tables_base = uma_memory_base - high_tables_size;
-
 	set_pcie_dereset();
 	/* get_ide_dma66(); */
 	set_thermal_config();
Index: svn/src/mainboard/asus/m4a785-m/mainboard.c
===================================================================
--- svn.orig/src/mainboard/asus/m4a785-m/mainboard.c
+++ svn/src/mainboard/asus/m4a785-m/mainboard.c
@@ -21,7 +21,6 @@
 #include <device/device.h>
 #include <device/pci.h>
 #include <arch/io.h>
-#include <boot/tables.h>
 #include <cpu/x86/msr.h>
 #include <cpu/amd/mtrr.h>
 #include <device/pci_def.h>
@@ -276,20 +275,6 @@ static void m4a785m_enable(device_t dev)
 	set_thermal_config();
 }
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	/* UMA is removed from system memory in the northbridge code, but
-	 * in some circumstances we want the memory mentioned as reserved.
- 	 */
-#if (CONFIG_GFXUMA == 1)
-	printk(BIOS_INFO, "uma_memory_start=0x%llx, uma_memory_size=0x%llx \n",
-		    uma_memory_base, uma_memory_size);
-	lb_add_memory_range(mem, LB_MEM_RESERVED, uma_memory_base,
-			    uma_memory_size);
-#endif
-	return 0;
-}
-
 struct chip_operations mainboard_ops = {
 	CHIP_NAME("AMD M4A785M   Mainboard")
 	.enable_dev = m4a785m_enable,
Index: svn/src/northbridge/amd/amdfam10/northbridge.c
===================================================================
--- svn.orig/src/northbridge/amd/amdfam10/northbridge.c
+++ svn/src/northbridge/amd/amdfam10/northbridge.c
@@ -865,9 +865,22 @@ static void disable_hoist_memory(unsigne
 #if CONFIG_WRITE_HIGH_TABLES==1
 #define HIGH_TABLES_SIZE 64	// maximum size of high tables in KB
 extern uint64_t high_tables_base, high_tables_size;
+#endif
+
 #if CONFIG_GFXUMA == 1
 extern uint64_t uma_memory_base, uma_memory_size;
-#endif
+
+static void add_uma_resource(struct device *dev, int index)
+{
+	struct resource *resource;
+
+	printk(BIOS_DEBUG, "Adding UMA memory area\n");
+	resource = new_resource(dev, index);
+	resource->base = (resource_t) uma_memory_base;
+	resource->size = (resource_t) uma_memory_size;
+	resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE |
+	    IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
+}
 #endif
 
 static void amdfam10_domain_set_resources(device_t dev)
@@ -1090,6 +1103,10 @@ static void amdfam10_domain_set_resource
 #endif
 	}
 
+#if CONFIG_GFXUMA == 1
+	add_uma_resource(dev, 7);
+#endif
+
 	for(link = dev->link_list; link; link = link->next) {
 		if (link->children) {
 			assign_resources(link);
Index: svn/src/mainboard/asus/m4a785-m/Kconfig
===================================================================
--- svn.orig/src/mainboard/asus/m4a785-m/Kconfig
+++ svn/src/mainboard/asus/m4a785-m/Kconfig
@@ -15,7 +15,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_OPTION_TABLE
 	select GENERATE_PIRQ_TABLE
 	select GENERATE_MP_TABLE
-	select HAVE_MAINBOARD_RESOURCES
 	select CACHE_AS_RAM
 	select HAVE_HARD_RESET
 	select SB_HT_CHAIN_UNITID_OFFSET_ONLY
-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to