[PATCH 064/112] boarddata: add barebox_boarddata_is_machine helper
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Jan 3 10:12:24 PST 2024
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 at pengutronix.de>
---
include/boarddata.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/boarddata.h b/include/boarddata.h
index 68ad0d146495..8c048fd957b4 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_ */
--
2.39.2
More information about the barebox
mailing list