diff --git a/src/arch/arm64/include/arch/memlayout.h b/src/arch/arm64/include/arch/memlayout.h index d84e7714fc..5c938517be 100644 --- a/src/arch/arm64/include/arch/memlayout.h +++ b/src/arch/arm64/include/arch/memlayout.h @@ -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, \ diff --git a/src/include/symbols.h b/src/include/symbols.h index 53dbfb94a3..b9bde838fc 100644 --- a/src/include/symbols.h +++ b/src/include/symbols.h @@ -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)