From 23d62dd15c39b3628b102cf6417d476e78ffcdaf Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 12 Apr 2018 10:36:57 +0200 Subject: lib/bootmem: Add more bootmem tags Introduce new bootmem tags to allow more fine grained control over buffer allocation on various platforms. The new tags are: BM_MEM_RAMSTAGE : Memory where any kind of boot firmware resides and that should not be touched by bootmem (by example: stack, TTB, program, ...). BM_MEM_PAYLOAD : Memory where any kind of payload resides and that should not be touched by bootmem. Starting with this commit all bootmem methods will no longer see memory that is used by coreboot as usable RAM. Bootmem changes: * Introduce a weak function to add platform specific memranges. * Mark memory allocated by bootmem as BM_TAG_PAYLOAD. * Assert on failures. * Add _stack and _program as BM_MEM_RAMSTAGE. ARMv7 and ARMv8 specific changes: * Add _ttb and _postram_cbfs_cache as BM_MEM_RAMSTAGE. ARMv7 specific changes: * Add _ttb_subtables as BM_MEM_RAMSTAGE. Change-Id: I0c983ce43616147c519a43edee3b61d54eadbb9a Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/25383 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/include/bootmem.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/include') diff --git a/src/include/bootmem.h b/src/include/bootmem.h index df2233f202..4964c18f38 100644 --- a/src/include/bootmem.h +++ b/src/include/bootmem.h @@ -21,7 +21,12 @@ #include /** - * Bootmem types match to LB_MEM tags. + * Bootmem types match to LB_MEM tags, except for the following: + * BM_MEM_RAMSTAGE : Memory where any kind of boot firmware resides and that + * should not be touched by bootmem (by example: stack, + * TTB, program, ...). + * BM_MEM_PAYLOAD : Memory where any kind of payload resides and that should + * not be touched by bootmem. * Start at 0x10000 to make sure that the caller doesn't provide LB_MEM tags. */ enum bootmem_type { @@ -33,18 +38,29 @@ enum bootmem_type { BM_MEM_UNUSABLE, /* Unusable address space */ BM_MEM_VENDOR_RSVD, /* Vendor Reserved */ BM_MEM_TABLE, /* Ram configuration tables are kept in */ + BM_MEM_RAMSTAGE, + BM_MEM_PAYLOAD, BM_MEM_LAST, /* Last entry in this list */ }; -/* Write memory coreboot table. Current resource map is serialized into +/** + * Write memory coreboot table. Current resource map is serialized into * memtable (LB_MEM_* types). bootmem library is unusable until this function - * is called first in the write tables path before payload is loaded. */ + * is called first in the write tables path before payload is loaded. + * + * Bootmem types match to LB_MEM tags, except for the following: + * BM_MEM_RAMSTAGE : Translates to LB_MEM_RAM. + * BM_MEM_PAYLOAD : Translates to LB_MEM_RAM. + */ void bootmem_write_memory_table(struct lb_memory *mem); /* Architecture hook to add bootmem areas the architecture controls when * bootmem_write_memory_table() is called. */ void bootmem_arch_add_ranges(void); +/* Platform hook to add bootmem areas the platform / board controls. */ +void bootmem_platform_add_ranges(void); + /* Add a range of a given type to the bootmem address space. */ void bootmem_add_range(uint64_t start, uint64_t size, const enum bootmem_type tag); -- cgit v1.2.3