diff --git a/sys/dev/ofw/ofw_bus_subr.h b/sys/dev/ofw/ofw_bus_subr.h --- a/sys/dev/ofw/ofw_bus_subr.h +++ b/sys/dev/ofw/ofw_bus_subr.h @@ -117,6 +117,9 @@ int ofw_bus_is_compatible_strict(device_t, const char *); int ofw_bus_node_is_compatible(phandle_t, const char *); +/* Check if machine (root node) is compatible */ +bool ofw_bus_is_machine_compatible(const char *); + /* * Helper routine to search a list of compat properties. The table is * terminated by an entry with a NULL compat-string pointer; a pointer to that diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -298,6 +298,15 @@ return (0); } +bool +ofw_bus_is_machine_compatible(const char *compat) +{ + phandle_t root; + + root = OF_finddevice("/"); + return (ofw_bus_node_is_compatible(root, compat) != 0); +} + const struct ofw_compat_data * ofw_bus_search_compatible(device_t dev, const struct ofw_compat_data *compat) {