memlayout: Introduce PRERAM and POSTRAM TTB regions

Refactor the TTB memory region definition to support stage-specific
usage. Certain boot modes require separate TTB regions for early stages
(such as bootblock or romstage) and for later ramstage usage. On Bluey,
the off-mode/low-battery charging path requires this separation because
the boot IMEM, where the early-stage TTB resides, becomes unavailable
once the ADSP comes out of reset.

This change ensures that the correct TTB region is selected for each
stage and prevents early‑stage memory constraints from impacting the
ramstage boot flow.

BUG=b:436391478
TEST=Able to build and boot google/bluey.

Change-Id: I8cedab8c744220599527de1c303a777f9ff8b1da
Signed-off-by: Venkateshwar S <vens@qualcomm.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91361
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Venkateshwar S 2026-02-17 23:04:48 -08:00 committed by Matt DeVillier
commit 4734da172b
2 changed files with 20 additions and 0 deletions

View file

@ -9,6 +9,24 @@
REGION(ttb, addr, size, 4K) \
_ = ASSERT(size % 4K == 0, "TTB size must be divisible by 4K!");
#if ENV_ROMSTAGE_OR_BEFORE
#define PRERAM_TTB(addr, size) \
REGION(preram_ttb, addr, size, 4K) \
_ = ASSERT(size % 4K == 0, "preram_ttb size must be divisible by 4K!"); \
ALIAS_REGION(preram_ttb, ttb)
#define POSTRAM_TTB(addr, size) \
REGION(postram_ttb, addr, size, 4K) \
_ = ASSERT(size >= _preram_ttb_size, "The postram_ttb size cannot be smaller than the preram_ttb size.");
#else
#define PRERAM_TTB(addr, size) \
REGION(preram_ttb, addr, size, 4K)
#define POSTRAM_TTB(addr, size) \
REGION(postram_ttb, addr, size, 4K) \
_ = ASSERT(size % 4K == 0, "postram_ttb size must be divisible by 4K!"); \
_ = ASSERT(size >= _preram_ttb_size, "The postram_ttb size cannot be smaller than the preram_ttb size."); \
ALIAS_REGION(postram_ttb, ttb)
#endif
#define FRAMEBUFFER(addr, size) \
REGION(framebuffer, addr, size, 1M) \
_ = ASSERT(size % 1M == 0, \

View file

@ -74,6 +74,8 @@ DECLARE_REGION(ramstage)
DECLARE_REGION(pagetables)
DECLARE_REGION(ttb)
DECLARE_OPTIONAL_REGION(preram_ttb)
DECLARE_OPTIONAL_REGION(postram_ttb)
DECLARE_OPTIONAL_REGION(ttb_subtables)
DECLARE_OPTIONAL_REGION(preram_dma_coherent)
DECLARE_OPTIONAL_REGION(postram_dma_coherent)