mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/5] ARM: asm: set aside new arm_mem_scratch space
Date: Tue,  1 Nov 2022 19:06:39 +0100	[thread overview]
Message-ID: <20221101180643.244270-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20221101180643.244270-1-a.fatoum@pengutronix.de>

While ARMv7 and later allow mapping the interrupt vector table at
arbitrary address, older ARMs only accept 0x0000_0000 and 0xFFFF_0000
(i.e. SZ_4G - SZ_64K).

For this reason, barebox grows its stack down from the last SZ_64K
of the early memory bank and leaves the last 64K for MMU IVT setup.
That way if the early memory bank extends till the end of the 4G
address space, installing the IVT at 0xFFFF_0000 won't break anything.

SZ_64K is way more than any IVT would need, so let us repurpose the
last SZ_32K to be some generic scratch space for prebootloader to report
data to barebox proper. No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/include/asm/barebox-arm.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index dd12f642d993..2dcd4153200f 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -73,6 +73,13 @@ static inline void arm_fixup_vectors(void)
 
 void *barebox_arm_boot_dtb(void);
 
+#define __arm_mem_scratch(endmem) ((endmem) - SZ_32K)
+
+static inline const void *arm_mem_scratch_get(void)
+{
+	return (const void *)__arm_mem_scratch(arm_mem_endmem_get());
+}
+
 #define __arm_mem_stack_top(membase, endmem) ((endmem) - SZ_64K)
 
 #if defined(CONFIG_BOOTM_OPTEE) || defined(CONFIG_PBL_OPTEE)
-- 
2.30.2




  reply	other threads:[~2022-11-01 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-01 18:06 [PATCH 0/5] ARM: i.MX8M: implement bootrom log viewing command Ahmad Fatoum
2022-11-01 18:06 ` Ahmad Fatoum [this message]
2022-11-01 18:06 ` [PATCH 2/5] ARM: i.MX8M: esdctl: export imx8m_barebox_earlymem_size Ahmad Fatoum
2022-11-01 18:06 ` [PATCH 3/5] ARM: i.MX8M: define imx8mX_scratch_space() helper Ahmad Fatoum
2022-11-01 18:06 ` [PATCH 4/5] ARM: i.MX8M: support saving BootROM event log before clobbering OCRAM Ahmad Fatoum
2022-11-01 18:06 ` [PATCH 5/5] ARM: i.MX8M: implement bootrom log viewing command Ahmad Fatoum
2022-12-02  8:46 ` [PATCH 0/5] " 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=20221101180643.244270-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@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