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/3] RISC-V: asm: factor relocation related functions into asm/reloc.h
Date: Fri,  5 Aug 2022 09:42:35 +0200	[thread overview]
Message-ID: <20220805074237.1148255-1-a.fatoum@pengutronix.de> (raw)

To allow use of global_variable_offset() from common PBL code,
move the definition into a new <asm/reloc.h> header.
At current time, it's expected that PBL enabled platforms define
at least get_runtime_offset() there.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/riscv/include/asm/barebox-riscv.h |  7 +------
 arch/riscv/include/asm/reloc.h         | 15 +++++++++++++++
 include/asm-generic/reloc.h            | 10 ++++++++++
 3 files changed, 26 insertions(+), 6 deletions(-)
 create mode 100644 arch/riscv/include/asm/reloc.h
 create mode 100644 include/asm-generic/reloc.h

diff --git a/arch/riscv/include/asm/barebox-riscv.h b/arch/riscv/include/asm/barebox-riscv.h
index 5c87d37c9eb8..db6ff0ea7131 100644
--- a/arch/riscv/include/asm/barebox-riscv.h
+++ b/arch/riscv/include/asm/barebox-riscv.h
@@ -21,12 +21,7 @@
 #include <asm/barebox-riscv-head.h>
 #include <asm/system.h>
 #include <asm/cache.h>
-
-unsigned long get_runtime_offset(void);
-
-void setup_c(void);
-void relocate_to_current_adr(void);
-void relocate_to_adr(unsigned long target);
+#include <asm/reloc.h>
 
 void __noreturn __naked barebox_riscv_entry(unsigned long membase, unsigned long memsize,
 					    void *boarddata, unsigned int flags);
diff --git a/arch/riscv/include/asm/reloc.h b/arch/riscv/include/asm/reloc.h
new file mode 100644
index 000000000000..9a59326cad27
--- /dev/null
+++ b/arch/riscv/include/asm/reloc.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _ASM_RELOC_H_
+#define _ASM_RELOC_H_
+
+unsigned long get_runtime_offset(void);
+
+void relocate_to_current_adr(void);
+void relocate_to_adr(unsigned long target);
+
+void setup_c(void);
+
+#include <asm-generic/reloc.h>
+
+#endif	/* _BAREBOX_RISCV_H_ */
diff --git a/include/asm-generic/reloc.h b/include/asm-generic/reloc.h
new file mode 100644
index 000000000000..90459371ebe8
--- /dev/null
+++ b/include/asm-generic/reloc.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _ASM_GENERIC_RELOC_H_
+#define _ASM_GENERIC_RELOC_H_
+
+#ifndef global_variable_offset
+#define global_variable_offset() get_runtime_offset()
+#endif
+
+#endif
-- 
2.30.2




             reply	other threads:[~2022-08-05  7:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05  7:42 Ahmad Fatoum [this message]
2022-08-05  7:42 ` [PATCH 2/3] ARM: asm: factor relocation related functions in asm/reloc.h Ahmad Fatoum
2022-08-05  7:42 ` [PATCH 3/3] MIPS: asm: add get_runtime_offset stub Ahmad Fatoum
2022-08-08 12:48 ` [PATCH 1/3] RISC-V: asm: factor relocation related functions into asm/reloc.h 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=20220805074237.1148255-1-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