summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Leahy <leroy.p.leahy@intel.com>2016-07-10 14:13:19 -0700
committerLee Leahy <leroy.p.leahy@intel.com>2016-07-12 18:51:09 +0200
commitf626b9311daa77f5f439bdcc4336839cd93844ee (patch)
tree8941aa71898973687994ba55641ecaf8f37ce822
parent660c67a01f93817efebf312c5f6d685e8329312e (diff)
downloadcoreboot-f626b9311daa77f5f439bdcc4336839cd93844ee.tar.xz
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 <leroy.p.leahy@intel.com> Reviewed-on: https://review.coreboot.org/15594 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <martinroth@google.com>
-rw-r--r--src/soc/intel/quark/memmap.c16
1 files changed, 14 insertions, 2 deletions
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 <cbmem.h>
#include <fsp/memmap.h>
+#include <soc/QuarkNcSocId.h>
+#include <soc/reg_access.h>
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;
}