diff options
author | Aaron Durbin <adurbin@chromium.org> | 2018-05-05 15:25:18 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2018-05-07 02:03:08 +0000 |
commit | 1ecec5f979b903f7f789f7e05132061d633f65ea (patch) | |
tree | d6735b5ed4a7495c5c21b61d3c6cf1f513d6988a | |
parent | c48b70f74401784e851adbf0ea519eda394b54ce (diff) | |
download | coreboot-1ecec5f979b903f7f789f7e05132061d633f65ea.tar.xz |
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 <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/26117
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r-- | src/lib/bootmem.c | 12 |
1 files changed, 9 insertions, 3 deletions
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(); |