summaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-07-02 08:09:03 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-02 09:17:39 +0200
commit84d28cec7f49b9dabf14892323a6ea421c470fea (patch)
treeb71a1037cff51173245ae9d1e8b51b73534465c5 /arch/arm/include
parent5c29d3627ed510e0bb86ffdce4bdef5837131ace (diff)
downloadbarebox-84d28cec7f49b9dabf14892323a6ea421c470fea.tar.gz
barebox-84d28cec7f49b9dabf14892323a6ea421c470fea.tar.xz
ARM: add a machine number mechanism for boarddata
Multi machine barebox builds have to pass information on which board we are running on via boarddata. Usually this will be a pointer to a device tree. Some boards might not have a device tree available though because they are either not ported over to device tree yet, or are running in some limited first state environment which does not offer enough space for a device tree. For these cases this patch adds a mechanism to embed a machine number into a struct type along with a magic number. This makes it possible to check for a specific machine later during regular runtime. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/barebox-arm.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h
index dbc8aaaba7..0b8acb8b8e 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -48,7 +48,32 @@ void setup_c(void);
void relocate_to_current_adr(void);
void relocate_to_adr(unsigned long target);
void __noreturn barebox_arm_entry(unsigned long membase, unsigned long memsize, void *boarddata);
-void *barebox_arm_boarddata(void);
+
+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;
+}
+
+u32 barebox_arm_machine(void);
#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_ARM_EXCEPTIONS)
void arm_fixup_vectors(void);