From f626b9311daa77f5f439bdcc4336839cd93844ee Mon Sep 17 00:00:00 2001 From: Lee Leahy Date: Sun, 10 Jul 2016 14:13:19 -0700 Subject: soc/intel/quark: Set CBMEM top from HW register Properly obtain the top of memory address from the hardware registers set by FSP. TEST=Build and run on Galileo Gen2 Change-Id: I7681d32112408b8358b4dad67f8d69581c7dde2e Signed-off-by: Lee Leahy Reviewed-on: https://review.coreboot.org/15594 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/soc/intel/quark/memmap.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/soc/intel/quark') diff --git a/src/soc/intel/quark/memmap.c b/src/soc/intel/quark/memmap.c index 71e478433e..351fab7f1c 100644 --- a/src/soc/intel/quark/memmap.c +++ b/src/soc/intel/quark/memmap.c @@ -15,6 +15,8 @@ #include #include +#include +#include size_t mmap_region_granularity(void) { @@ -24,6 +26,16 @@ size_t mmap_region_granularity(void) void *cbmem_top(void) { - /* TODO: Get this dynamically*/ - return (void *)0x0afd0000; + UINT32 top_of_memory; + + /* Determine the TSEG base */ + top_of_memory = reg_host_bridge_unit_read(QNC_MSG_FSBIC_REG_HSMMC); + top_of_memory &= SMM_START_MASK; + top_of_memory <<= 16; + + /* Reserve 64 KiB for RMU firmware */ + top_of_memory -= 0x10000; + + /* Return the top of memory */ + return (void *)top_of_memory; } -- cgit v1.2.3