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

Peng Fan peng.fan at oss.nxp.com
Fri Jan 10 10:49:41 CET 2025


On Sun, Jan 05, 2025 at 10:56:29PM +0100, Marek Vasut wrote:
>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 ?

spl_get_load_buffer does not help here, unless do a big change to spl_mmc.c
h_spl_load_read is set to info->read, info->read is not just for reading
headers, it also needs to read container image data.

>
>This hack in generic code is a NAK.

This is set it as __weak, and overwrite in soc code, there are many
similar code

Regards,
Peng


More information about the U-Boot mailing list