aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ofw
diff options
context:
space:
mode:
authorMichal Meloun <mmel@FreeBSD.org>2025-11-06 18:50:52 +0000
committerMichal Meloun <mmel@FreeBSD.org>2025-12-03 06:47:41 +0000
commitd14a985898eebd3bda8bb30c4078bde3ebd135f2 (patch)
treea64472385c89dc7b0e3e4749093e8f195b5b6afa /sys/dev/ofw
parentb033e3684fd14c798405420449eb55e1d4f9df1e (diff)
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r--sys/dev/ofw/ofw_bus_subr.c9
-rw-r--r--sys/dev/ofw/ofw_bus_subr.h3
2 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c
index b99d784929bc..efca3ea14e2f 100644
--- a/sys/dev/ofw/ofw_bus_subr.c
+++ b/sys/dev/ofw/ofw_bus_subr.c
@@ -298,6 +298,15 @@ ofw_bus_is_compatible_strict(device_t dev, const char *compatible)
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)
{
diff --git a/sys/dev/ofw/ofw_bus_subr.h b/sys/dev/ofw/ofw_bus_subr.h
index 1a33d7655f77..203c9689f156 100644
--- 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(device_t, const char *);
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