include: Make DRAM an explicit region
This patch makes DRAM an explicit region by introducing DECLARE_OPTIONAL_REGION(dram) and DRAM_END(). Note: many SoC platforms determine DRAM size and layout dynamically during boot, making a static compile-time value is not feasible always. Attempting to use REGION_SIZE(dram) in this scenario would result in a missing symbol `_dram_size` error. By making dram an optional region, we allow its size and address to be defined only when available, preventing build failures on platforms that configure DRAM dynamically. The old extern u8 _dram[] is removed, as it's now covered by the new region definition. This is a preparatory step for future changes that will make use of the new DRAM_END() macro. This symbol is necessary for systems that require the DRAM size to be known and accessible from the linker script or other parts of the build system. Additionally, a new macro DRAM_END(addr) is defined in memlayout.h. This macro provides a consistent way to mark the end of the DRAM region, similar to how REGION_END and other start/end macros are used throughout the codebase. TEST=Able to build and boot google/quenbi. Change-Id: Ib98ec4b991eed56385c83be6a9ca39ff1380ff1b Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88751 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
parent
11c8d423d1
commit
b4347f11d9
2 changed files with 3 additions and 2 deletions
|
|
@ -60,6 +60,8 @@
|
|||
#define SRAM_END(addr) REGION_END(sram, addr)
|
||||
|
||||
#define DRAM_START(addr) REGION_START(dram, addr)
|
||||
/* This should rarely be used because DRAM-size is usually not compile-time constant. */
|
||||
#define DRAM_END(addr) REGION_END(dram, addr)
|
||||
|
||||
#define TIMESTAMP(addr, size) \
|
||||
REGION(timestamp, addr, size, 8) \
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
#include <types.h>
|
||||
|
||||
extern u8 _dram[];
|
||||
|
||||
#define REGION_SIZE(name) ((size_t)_##name##_size)
|
||||
|
||||
#define DECLARE_REGION(name) \
|
||||
|
|
@ -28,6 +26,7 @@ extern u8 _dram[];
|
|||
__maybe_unused __weak extern u8 _##name##_size[];
|
||||
|
||||
DECLARE_REGION(sram)
|
||||
DECLARE_OPTIONAL_REGION(dram)
|
||||
DECLARE_OPTIONAL_REGION(timestamp)
|
||||
DECLARE_REGION(preram_cbmem_console)
|
||||
DECLARE_REGION(cbmem_init_hooks)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue