mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>,
	 BAREBOX <barebox@lists.infradead.org>
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	 Michael Tretter <m.tretter@pengutronix.de>
Subject: [PATCH 1/9] arm: socfpga: agilex5: cleanup TF-A loading
Date: Thu, 16 Apr 2026 11:48:05 +0200	[thread overview]
Message-ID: <20260416-socfpga-agilex5-sdram-v1-1-07556aa7219f@pengutronix.de> (raw)
In-Reply-To: <20260416-socfpga-agilex5-sdram-v1-0-07556aa7219f@pengutronix.de>

Use local variables for the bl31 and bl33 address to be able to change
these more easily and consistently.

Print the TF-A memory locations to the logs.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/mach-socfpga/atf.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-socfpga/atf.c b/arch/arm/mach-socfpga/atf.c
index d0f57d95415e..98460472227e 100644
--- a/arch/arm/mach-socfpga/atf.c
+++ b/arch/arm/mach-socfpga/atf.c
@@ -11,23 +11,25 @@
 
 void __noreturn agilex5_load_and_start_image_via_tfa(unsigned long memsize)
 {
-	unsigned long atf_dest = AGILEX5_ATF_BL31_BASE_ADDR;
-	void __noreturn (*bl31)(void) = (void *)atf_dest;
+	void *bl31 = (void *)AGILEX5_ATF_BL31_BASE_ADDR;
+	void *bl33 = (void *)AGILEX5_ATF_BL33_BASE_ADDR;
 	struct fwobj tfa;
 
-	pr_debug("Load TFA\n");
-
-	memcpy((void *)AGILEX5_ATF_BL33_BASE_ADDR, __image_start, barebox_image_size);
+	pr_debug("copy bl33 to %p from %p (%zu bytes)\n",
+		 bl33, __image_start, barebox_image_size);
+	memcpy(bl33, __image_start, barebox_image_size);
 
 	get_builtin_firmware(agilex5_bl31_bin, &tfa);
 
+	pr_debug("copy bl31 to %p from %p (%zu bytes)\n",
+		 bl31, tfa.data, tfa.size);
 	memcpy(bl31, tfa.data, tfa.size);
 
 	asm volatile("msr sp_el2, %0" : :
-		     "r" (AGILEX5_ATF_BL33_BASE_ADDR - 16) :
+		     "r" (bl33 - 16) :
 		     "cc");
 
-	pr_debug("Jumping to @0x%08lx\n", atf_dest);
-	bl31_entry((uintptr_t)bl31, 0, AGILEX5_ATF_BL33_BASE_ADDR, 0);
+	pr_debug("Jump to bl31 0x%p\n", bl31);
+	bl31_entry((uintptr_t)bl31, 0, (uintptr_t)bl33, 0);
 	__builtin_unreachable();
 }

-- 
2.47.3




  reply	other threads:[~2026-04-16  9:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  9:48 [PATCH 0/9] arm: socfpga: agilex5: rework low level code Michael Tretter
2026-04-16  9:48 ` Michael Tretter [this message]
2026-04-16  9:48 ` [PATCH 2/9] arm: socfgpa: agilex5: remove unused memsize Michael Tretter
2026-04-16  9:48 ` [PATCH 3/9] arm: socfpga: agilex5: configure firewall with base and size Michael Tretter
2026-04-16  9:48 ` [PATCH 4/9] arm: socfpga: agilex5: fix read of memory limit Michael Tretter
2026-04-16  9:48 ` [PATCH 5/9] arm: socfpga: agilex5: fix SDRAM size calculation Michael Tretter
2026-04-16  9:48 ` [PATCH 6/9] arm: socfpga: agilex5: remove unused declarations Michael Tretter
2026-04-16  9:48 ` [PATCH 7/9] arm: socfpga: agilex5: read SDRAM limits from firewall Michael Tretter
2026-04-16  9:48 ` [PATCH 8/9] arm: socfpga: agilex5: add agilex5_barebox_entry Michael Tretter
2026-04-16  9:48 ` [PATCH 9/9] arm: socfpga: agilex5: add explicit unreachable after TF-A load Michael Tretter
2026-04-17  8:25 ` [PATCH 0/9] arm: socfpga: agilex5: rework low level code Sascha Hauer

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=20260416-socfpga-agilex5-sdram-v1-1-07556aa7219f@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    --cc=s.trumtrar@pengutronix.de \
    /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