CBMEM AMD: Fix calls to set_top_of_ram_once()
We can postpone the call to set_top_of_ram_once() outside the
loops and make just one call instead.
As set_top_of_ram() is now only called once, it is no longer
necessary to check if high_tables_base was already set.
Change-Id: I302d9af52ac40c7fa8c7c7e65f82e00b031cd397
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/3895
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/src/northbridge/amd/agesa/family14/northbridge.c b/src/northbridge/amd/agesa/family14/northbridge.c
index fbf8e44..7cc812b 100644
--- a/src/northbridge/amd/agesa/family14/northbridge.c
+++ b/src/northbridge/amd/agesa/family14/northbridge.c
@@ -575,6 +575,7 @@
#endif
unsigned long mmio_basek;
u32 pci_tolm;
+ u64 ramtop = 0;
int idx;
struct bus *link;
#if CONFIG_HW_MEM_HOLE_SIZEK != 0
@@ -716,11 +717,8 @@
pre_sizek);
idx += 0x10;
sizek -= pre_sizek;
-#if CONFIG_GFXUMA
- set_top_of_ram_once(uma_memory_base);
-#else
- set_top_of_ram_once(mmio_basek * 1024);
-#endif
+ if (!ramtop)
+ ramtop = mmio_basek * 1024;
}
basek = mmio_basek;
}
@@ -737,16 +735,16 @@
printk(BIOS_DEBUG,
"%d: mmio_basek=%08lx, basek=%08llx, limitk=%08llx\n", 0,
mmio_basek, basek, limitk);
-#if CONFIG_GFXUMA
- set_top_of_ram_once(uma_memory_base);
-#else
- set_top_of_ram_once(limitk * 1024);
-#endif
+ if (!ramtop)
+ ramtop = limitk * 1024;
}
printk(BIOS_DEBUG, " adsr - mmio_basek = %lx.\n", mmio_basek);
#if CONFIG_GFXUMA
+ set_top_of_ram(uma_memory_base);
uma_resource(dev, 7, uma_memory_base >> 10, uma_memory_size >> 10);
+#else
+ set_top_of_ram(ramtop);
#endif
for (link = dev->link_list; link; link = link->next) {