mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 05/12] ARM: Add relocate_to_adr_full()
Date: Mon, 21 Jun 2021 11:27:55 +0200	[thread overview]
Message-ID: <20210621092802.27275-6-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20210621092802.27275-1-s.hauer@pengutronix.de>

relocate_to_adr() currently relocates the PBL code to another address,
but doesn't move the piggy data (compressed barebox image). This patch
adds relocate_to_adr_full() which moves the full image including the
piggy data. This is needed for upcoming Rockchip RK3568 support. Here
we are started at address 0x0, but must move away from that address as
this is where the ATF/OP-Tee binaries are expected to be loaded.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210615141641.31577-6-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/setupc_64.S           | 13 ++++++++++---
 arch/arm/include/asm/barebox-arm.h |  1 +
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/setupc_64.S b/arch/arm/cpu/setupc_64.S
index ee9ea6cfc0..e24acbd0da 100644
--- a/arch/arm/cpu/setupc_64.S
+++ b/arch/arm/cpu/setupc_64.S
@@ -24,9 +24,18 @@ ENDPROC(setup_c)
  * executing at new address.
  */
 .section .text.relocate_to_adr
-ENTRY(relocate_to_adr)
 					/* x0: target address */
+#ifdef __PBL__
+ENTRY(relocate_to_adr_full)
+	ldr	x2, =__piggydata_end
+	b	1f
+#endif
+
+ENTRY(relocate_to_adr)
+	ldr	x2, =__bss_start
+	b	1f
 
+1:
 	stp	x19, x20, [sp, #-16]!
 	stp	x21, x22, [sp, #-16]!
 
@@ -45,8 +54,6 @@ ENTRY(relocate_to_adr)
 	cmp	x1, x21			/* already at correct address? */
 	beq	1f			/* yes, skip copy to new address */
 
-	ldr	x2, =__bss_start
-
 	sub	x2, x2, x0		/* x2: size */
 	mov	x0, x21			/* x0: target */
 
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 348a55e804..24f9bce2ef 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -53,6 +53,7 @@ void setup_c(void);
 void pbl_barebox_break(void);
 void relocate_to_current_adr(void);
 void relocate_to_adr(unsigned long target);
+void relocate_to_adr_full(unsigned long target);
 void __noreturn barebox_arm_entry(unsigned long membase, unsigned long memsize, void *boarddata);
 
 struct barebox_arm_boarddata {
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-06-21  9:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  9:27 [PATCH v2 00/12] Rockchip RK3568 support Sascha Hauer
2021-06-21  9:27 ` [PATCH 01/12] clk: Add clk_name_* functions Sascha Hauer
2021-06-21  9:27 ` [PATCH 02/12] clk: rockchip rk3568: Initialize clocks Sascha Hauer
2021-06-21  9:27 ` [PATCH 03/12] filetype: Add Rockchip boot image type Sascha Hauer
2021-06-21  9:27 ` [PATCH 04/12] ARM: Rockchip: Add rkimage tool Sascha Hauer
2021-06-21  9:27 ` Sascha Hauer [this message]
2021-06-21  9:27 ` [PATCH 06/12] ARM: Rockchip: Add rk3568 dtsi files Sascha Hauer
2021-06-21  9:27 ` [PATCH 07/12] ARM: Rockchip: Add rk3568 support Sascha Hauer
2021-06-21  9:27 ` [PATCH 08/12] ARM: Add atf common support Sascha Hauer
2021-06-21  9:27 ` [PATCH 09/12] ARM: rockchip: Add bootm handler for RKNS images Sascha Hauer
2021-06-21  9:28 ` [PATCH 10/12] ARM: Rockchip: Add rk3568 evb board support Sascha Hauer
2021-06-21  9:28 ` [PATCH 11/12] Add rockchip_v8_defconfig Sascha Hauer
2021-06-21  9:28 ` [PATCH 12/12] fixup! clk: Rockchip: Add rk3568 clk support 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=20210621092802.27275-6-s.hauer@pengutronix.de \
    --to=s.hauer@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