From 1ecec5f979b903f7f789f7e05132061d633f65ea Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Sat, 5 May 2018 15:25:18 -0600 Subject: lib/bootmem: ensure ramstage memory isn't given to OS When RELOCATABLE_RAMSTAGE is employed ramstage lives within the cbmem area. Don't mark it as OS usable under that circumstance. Change-Id: Ie15775806632bd943b8217c433bc13708904c696 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/26117 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph Reviewed-by: Paul Menzel Reviewed-by: Nico Huber --- src/lib/bootmem.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c index 7363a8b5cb..fd9195aa96 100644 --- a/src/lib/bootmem.c +++ b/src/lib/bootmem.c @@ -97,9 +97,15 @@ static void bootmem_init(void) /* Add memory used by CBMEM. */ cbmem_add_bootmem(); - /* Add memory used by coreboot. */ - bootmem_add_range((uintptr_t)_stack, _stack_size, BM_MEM_RAMSTAGE); - bootmem_add_range((uintptr_t)_program, _program_size, BM_MEM_RAMSTAGE); + /* Add memory used by coreboot -- only if RELOCATABLE_RAMSTAGE is not + * used. When RELOCATABLE_RAMSTAGE is employed ramstage lives in cbmem + * so cbmem_add_bootmem() takes care of that memory region. */ + if (!IS_ENABLED(CONFIG_RELOCATABLE_RAMSTAGE)) { + bootmem_add_range((uintptr_t)_stack, _stack_size, + BM_MEM_RAMSTAGE); + bootmem_add_range((uintptr_t)_program, _program_size, + BM_MEM_RAMSTAGE); + } bootmem_arch_add_ranges(); bootmem_platform_add_ranges(); -- cgit v1.2.3