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>
This commit is contained in:
Aaron Durbin 2018-05-05 15:25:18 -06:00
parent c48b70f744
commit 1ecec5f979
1 changed files with 9 additions and 3 deletions

View File

@ -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();