diff options
| author | Ye Li <[email protected]> | 2026-06-18 09:17:47 +0800 |
|---|---|---|
| committer | Fabio Estevam <[email protected]> | 2026-06-26 16:50:55 -0300 |
| commit | 5402b5980ee882bcee6cdaca7580e5b36ef99f42 (patch) | |
| tree | e3abd09c896ba02d629a12ce084859ee1f27f18a | |
| parent | 6902fb4c17faa375003124c451c2550deab5463d (diff) | |
imx9: scmi: Fix SPL trampoline buffer for 1GB DDR
After supporting get DRAM size from SM, the trampoline buffer address
still depends on PHYS_SDRAM_SIZE. If the real DDR size is less than
PHYS_SDRAM_SIZE, the trampoline buffer address is invalid and SPL will
crash. So use board_phys_sdram_size to get real DDR size to calculate
correct address.
Fixes: e1cc7117b630 ("imx9: scmi: Get DDR size through SM SCMI API")
Signed-off-by: Ye Li <[email protected]>
Reviewed-by: Peng Fan <[email protected]>
Tested-by: Emanuele Ghidoli <[email protected]>
| -rw-r--r-- | arch/arm/mach-imx/imx9/scmi/soc.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c index fbee435786c..1abd987c081 100644 --- a/arch/arm/mach-imx/imx9/scmi/soc.c +++ b/arch/arm/mach-imx/imx9/scmi/soc.c @@ -985,10 +985,11 @@ enum boot_device get_boot_device(void) bool arch_check_dst_in_secure(void *start, ulong size) { - ulong ns_end = CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE; -#ifdef PHYS_SDRAM_2_SIZE - ns_end += PHYS_SDRAM_2_SIZE; -#endif + ulong ns_end; + phys_size_t dram_size; + + board_phys_sdram_size(&dram_size); + ns_end = CFG_SYS_SDRAM_BASE + dram_size; if ((ulong)start < CFG_SYS_SDRAM_BASE || (ulong)start + size > ns_end) return true; @@ -998,5 +999,10 @@ bool arch_check_dst_in_secure(void *start, ulong size) void *arch_get_container_trampoline(void) { - return (void *)((ulong)CFG_SYS_SDRAM_BASE + PHYS_SDRAM_SIZE - SZ_16M); + phys_size_t size; + + board_phys_sdram_size(&size); + size = (size > PHYS_SDRAM_SIZE) ? PHYS_SDRAM_SIZE : size; + + return (void *)((ulong)CFG_SYS_SDRAM_BASE + size - SZ_16M); } |
