Date: Wed, 03 Dec 2025 06:51:58 +0000 Message-ID: <692fde0e.22d76.185bc98a@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mmel: URL: https://cgit.FreeBSD.org/src/commit/?id=d14a985898eebd3bda8bb30c4078bde3ebd135f2 commit d14a985898eebd3bda8bb30c4078bde3ebd135f2 Author: Michal Meloun <mmel@FreeBSD.org> AuthorDate: 2025-11-06 18:50:52 +0000 Commit: Michal Meloun <mmel@FreeBSD.org> CommitDate: 2025-12-03 06:47:41 +0000 ofw: Add ofw_bus_is_machine_compat(). We need a quick way to identify a given machine (SoC), mainly when implementing quirks for a given SoC. MFC after: 2 weeks Reviwed by: imp Differential Revision: https://reviews.freebsd.org/D53992 --- sys/dev/ofw/ofw_bus_subr.c | 9 +++++++++ sys/dev/ofw/ofw_bus_subr.h | 3 +++ 2 files changed, 12 insertions(+) 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?692fde0e.22d76.185bc98a>
