[PATCH v3 11/17] imx9: scmi: soc: Override h_spl_load_read with trampoline buffer

Marek Vasut marex at denx.de
Sun Jan 5 22:56:29 CET 2025


On 1/3/25 7:45 AM, Alice Guo wrote:
> From: Ye Li <ye.li at nxp.com>
> 
> When SPL loading image to secure region, for example, ATF and tee to
> DDR secure region. Because the USDHC controller is non-secure master,
> it can't access this region and will cause loading issue.
> 
> So override h_spl_load_read to use a trampoline buffer in nonsecure
> region, then use CPU to copy the image from trampoline buffer to
> destination secure region.
> 
> Signed-off-by: Ye Li <ye.li at nxp.com>
> Signed-off-by: Alice Guo <alice.guo at nxp.com>
> Reviewed-by: Peng Fan <peng.fan at nxp.com>
> ---
>   arch/arm/mach-imx/imx9/scmi/soc.c | 40 +++++++++++++++++++++++++++++++++++++++
>   common/spl/spl_mmc.c              |  2 +-
>   2 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-imx/imx9/scmi/soc.c b/arch/arm/mach-imx/imx9/scmi/soc.c
> index fefb1a6f4ca58722a5d93c39e4f6a7aaf85aa177..8a7df24afecc1d6d77b7162be639b56af95fd975 100644
> --- a/arch/arm/mach-imx/imx9/scmi/soc.c
> +++ b/arch/arm/mach-imx/imx9/scmi/soc.c
> @@ -41,6 +41,8 @@
>   #include <scmi_agent.h>
>   #include <scmi_protocols.h>
>   #endif
> +#include <spl.h>
> +#include <mmc.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> @@ -830,3 +832,41 @@ enum boot_device get_boot_device(void)
>   	return boot_dev;
>   }
>   #endif
> +
> +ulong h_spl_load_read(struct spl_load_info *load, ulong off,
> +		      ulong size, void *buf)

Can you simply define spl_get_load_buffer() instead to make sure SPL 
loads your stuff into the correct location ?

This hack in generic code is a NAK.


More information about the U-Boot mailing list