mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] RISC-V: asm: factor relocation related functions into asm/reloc.h
@ 2022-08-05  7:42 Ahmad Fatoum
  2022-08-05  7:42 ` [PATCH 2/3] ARM: asm: factor relocation related functions in asm/reloc.h Ahmad Fatoum
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-08-05  7:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-08 12:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05  7:42 [PATCH 1/3] RISC-V: asm: factor relocation related functions into asm/reloc.h Ahmad Fatoum
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox