Add a function to retreive the machine name from the device tree once
the device tree has been unflattened. This is particularly useful for
multi-flavored virtual machine boards (like the Xen, virt, and ranchu
boards) where it is useful for user space to know which flavor of a
device-tree driven board you are running.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
static const char *config_cmdline = "";
#endif
+
+const char * __init of_flat_dt_get_machine_name(void)
+{
+ const char *name;
+ unsigned long dt_root = of_get_flat_dt_root();
+
+ name = of_get_flat_dt_prop(dt_root, "model", NULL);
+ if (!name)
+ name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
+ return name;
+}
+
int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
int depth, void *data)
{
int depth, void *data);
/* Other Prototypes */
+extern const char *of_flat_dt_get_machine_name(void);
extern void unflatten_device_tree(void);
extern void early_init_devtree(void *);
#else /* CONFIG_OF_FLATTREE */
+extern const char *of_flat_dt_get_machine_name(void) { return NULL; }
static inline void unflatten_device_tree(void) {}
#endif /* CONFIG_OF_FLATTREE */