From: Michael Grzeschik <m.grzeschik@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] ARM: i.MX93: allow board code to configure the bl33 loadaddr
Date: Tue, 28 Jan 2025 16:22:11 +0100 [thread overview]
Message-ID: <20250128152211.1146024-1-m.grzeschik@pengutronix.de> (raw)
Add parameterized __imx93_load_and_start_image_via_tfa function to
load_and_start the image on arbitrary load addresses. This should be
taken with caution since it requires to configure the TF-A correctly as
well, therefore the function is prefixt with '__'.
One use case of the new helper is to place OP-TEE at the very beginning
of the DRAM and barebox afterwards.
It has shown that the OPTEE can only operate with the ELE device if
it uses the MU wih messages that are addressed after 0xE0000000.
If OPTEE will be linked to the upper end of the memory layout on systems
with more then 3.5GB the ELE device can therefor not be used anymore.
So moving the layout is crucial for these platforms to properly operate
with OPTEE that is including ELE support.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
arch/arm/mach-imx/atf.c | 10 +++++++---
include/mach/imx/xload.h | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c
index 4e7a548340..6dc80cb700 100644
--- a/arch/arm/mach-imx/atf.c
+++ b/arch/arm/mach-imx/atf.c
@@ -386,12 +386,16 @@ __noreturn void __imx8mq_load_and_start_image_via_tfa(void *bl33)
}
void __noreturn imx93_load_and_start_image_via_tfa(void)
+{
+ __imx93_load_and_start_image_via_tfa((void *)MX93_ATF_BL33_BASE_ADDR);
+}
+
+void __noreturn __imx93_load_and_start_image_via_tfa(void *bl33)
{
unsigned long atf_dest = MX93_ATF_BL31_BASE_ADDR;
void __noreturn (*bl31)(void) = (void *)atf_dest;
const void *tfa;
size_t tfa_size;
- void *bl33 = (void *)MX93_ATF_BL33_BASE_ADDR;
unsigned long endmem = MX9_DDR_CSD1_BASE_ADDR + imx9_ddrc_sdram_size();
imx_set_cpu_type(IMX_CPU_IMX93);
@@ -434,12 +438,12 @@ void __noreturn imx93_load_and_start_image_via_tfa(void)
* it there. The USB protocol transfers data in chunks of 1024 bytes,
* so align the copy size up to the next 1KiB boundary.
*/
- memcpy((void *)MX93_ATF_BL33_BASE_ADDR, __image_start, ALIGN(barebox_pbl_size, 1024));
+ memcpy(bl33, __image_start, ALIGN(barebox_pbl_size, 1024));
memcpy(bl31, tfa, tfa_size);
asm volatile("msr sp_el2, %0" : :
- "r" (MX93_ATF_BL33_BASE_ADDR - 16) :
+ "r" (bl33 - 16) :
"cc");
bl31();
__builtin_unreachable();
diff --git a/include/mach/imx/xload.h b/include/mach/imx/xload.h
index 3a396ac453..62b853f585 100644
--- a/include/mach/imx/xload.h
+++ b/include/mach/imx/xload.h
@@ -38,6 +38,7 @@ void __noreturn __imx8mp_load_and_start_image_via_tfa(void *bl33);
void __noreturn __imx8mq_load_and_start_image_via_tfa(void *bl33);
void __noreturn imx93_load_and_start_image_via_tfa(void);
+void __noreturn __imx93_load_and_start_image_via_tfa(void *bl33);
int imx_load_image(ptrdiff_t address, ptrdiff_t entry, u32 offset,
u32 ivt_offset, bool start, unsigned int alignment,
--
2.39.5
reply other threads:[~2025-01-28 15:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250128152211.1146024-1-m.grzeschik@pengutronix.de \
--to=m.grzeschik@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox