[PATCH v2 063/113] ARM: make board data definitions accessible to other architectures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



struct barebox_arm_boarddata is a way for PBL to handover a machine
number instead of a FDT. We will reuse this mechanism to hand over EFI
image handle and system table in a later commit, so prepare for that by
moving it to a central location and adjust the naming.

Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
---
 arch/arm/include/asm/barebox-arm.h | 30 +++++-----------------
 include/boarddata.h                | 41 ++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 23 deletions(-)
 create mode 100644 include/boarddata.h

diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index 361edcf37eef..7a7e5a240317 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -23,34 +23,14 @@
 #include <asm/sections.h>
 #include <asm/reloc.h>
 #include <linux/stringify.h>
+#include <boarddata.h>
 
 #define ARM_EARLY_PAGETABLE_SIZE	SZ_64K
 
 void __noreturn barebox_arm_entry(unsigned long membase, unsigned long memsize, void *boarddata);
 
-struct barebox_arm_boarddata {
-#define BAREBOX_ARM_BOARDDATA_MAGIC	0xabe742c3
-	u32 magic;
-	u32 machine; /* machine number to pass to barebox. This may or may
-		      * not be a ARM machine number registered on arm.linux.org.uk.
-		      * It must only be unique across barebox. Please use a number
-		      * that do not potientially clashes with registered machines,
-		      * i.e. use a number > 0x10000.
-		      */
-};
-
-/*
- * Create a boarddata struct at given address. Suitable to be passed
- * as boarddata to barebox_arm_entry(). The machine can be retrieved
- * later with barebox_arm_machine().
- */
-static inline void boarddata_create(void *adr, u32 machine)
-{
-	struct barebox_arm_boarddata *bd = adr;
-
-	bd->magic = BAREBOX_ARM_BOARDDATA_MAGIC;
-	bd->machine = machine;
-}
+#define barebox_arm_boarddata		barebox_boarddata
+#define BAREBOX_ARM_BOARDDATA_MAGIC	BAREBOX_BOARDDATA_MAGIC
 
 u32 barebox_arm_machine(void);
 
@@ -58,6 +38,10 @@ unsigned long arm_mem_ramoops_get(void);
 unsigned long arm_mem_membase_get(void);
 unsigned long arm_mem_endmem_get(void);
 
+struct barebox_arm_boarddata *barebox_arm_get_boarddata(void);
+
+#define barebox_arm_get_boarddata barebox_get_boarddata
+
 #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_ARM_EXCEPTIONS)
 void arm_fixup_vectors(void);
 #else
diff --git a/include/boarddata.h b/include/boarddata.h
new file mode 100644
index 000000000000..68ad0d146495
--- /dev/null
+++ b/include/boarddata.h
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef _BAREBOX_BOARDDATA_H_
+#define _BAREBOX_BOARDDATA_H_
+
+#include <linux/types.h>
+
+struct barebox_boarddata {
+#define BAREBOX_BOARDDATA_MAGIC		0xabe742c3
+	u32 magic;
+#define BAREBOX_MACH_TYPE_EFI		0xef1bbef1
+	u32 machine; /* machine number to pass to barebox. This may or may
+		      * not be a ARM machine number registered on arm.linux.org.uk.
+		      * It must only be unique across barebox. Please use a number
+		      * that do not potientially clashes with registered machines,
+		      * i.e. use a number > 0x10000.
+		      */
+#ifdef CONFIG_EFI_STUB
+	void *image;
+	void *sys_table;
+#endif
+};
+
+/*
+ * Create a boarddata struct at given address. Suitable to be passed
+ * as boarddata to barebox_$ARCH_entry(). The boarddata can be retrieved
+ * later with barebox_get_boarddata().
+ */
+static inline struct barebox_boarddata *boarddata_create(void *adr, u32 machine)
+{
+	struct barebox_boarddata *bd = adr;
+
+	bd->magic = BAREBOX_BOARDDATA_MAGIC;
+	bd->machine = machine;
+
+	return bd;
+}
+
+const struct barebox_boarddata *barebox_get_boarddata(void);
+
+#endif	/* _BAREBOX_BOARDDATA_H_ */
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux