summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2024-03-04 19:59:49 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2024-03-05 16:28:06 +0100
commit3361b466b5a7a1f5c3649d735f81a2f305a1480b (patch)
tree209b7ace81e0b8cc697a46d3dcaa1ec5727210b2
parent6debda9a26251380db7c30243ff14f80be5eb49b (diff)
downloadbarebox-3361b466b5a7.tar.gz
barebox-3361b466b5a7.tar.xz
boarddata: add barebox_boarddata_is_machine helper
In a later commit, the same barebox binary may be used either as EFI payload or as EFI loader being initialized from the device tree. The difference will be the barebox_boarddata, so add a helper for checking it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20240304190038.3486881-65-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/boarddata.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/boarddata.h b/include/boarddata.h
index 68ad0d1464..8c048fd957 100644
--- a/include/boarddata.h
+++ b/include/boarddata.h
@@ -38,4 +38,12 @@ static inline struct barebox_boarddata *boarddata_create(void *adr, u32 machine)
const struct barebox_boarddata *barebox_get_boarddata(void);
+static inline bool barebox_boarddata_is_machine(const struct barebox_boarddata *bd,
+ u32 machine)
+{
+ if (!bd || bd->magic != BAREBOX_BOARDDATA_MAGIC)
+ return false;
+ return bd->machine == machine;
+}
+
#endif /* _BAREBOX_BOARDDATA_H_ */