aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ofw
diff options
context:
space:
mode:
authorTakanori Watanabe <takawata@FreeBSD.org>2022-10-18 06:08:53 +0000
committerTakanori Watanabe <takawata@FreeBSD.org>2022-10-18 07:55:47 +0000
commit7b5d62bb73e32d50bb07024ac483532fbcaafe81 (patch)
treec70d1390c2c493f37fce010205066fde86feced5 /sys/dev/ofw
parent469ad8603127bf8fea094d47223ccb3d0a3481cd (diff)
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r--sys/dev/ofw/ofw_bus_subr.c16
-rw-r--r--sys/dev/ofw/ofw_bus_subr.h1
-rw-r--r--sys/dev/ofw/ofw_cpu.c1
3 files changed, 18 insertions, 0 deletions
diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c
index 404bed3c73fa..169bea1f5997 100644
--- a/sys/dev/ofw/ofw_bus_subr.c
+++ b/sys/dev/ofw/ofw_bus_subr.c
@@ -104,6 +104,22 @@ ofw_bus_gen_child_pnpinfo(device_t cbdev, device_t child, struct sbuf *sb)
return (0);
};
+int
+ofw_bus_gen_get_device_path(device_t cbdev, device_t child, const char *locator,
+ struct sbuf *sb)
+{
+ int rv;
+
+ if ( strcmp(locator, BUS_LOCATOR_OFW) == 0){
+ rv = bus_generic_get_device_path(cbdev, child, locator, sb);
+ if (rv == 0){
+ sbuf_printf(sb, "/%s", ofw_bus_get_name(child));
+ }
+ return (rv);
+ }
+ return (bus_generic_get_device_path(cbdev, child, locator, sb));
+};
+
const char *
ofw_bus_gen_get_compat(device_t bus, device_t dev)
{
diff --git a/sys/dev/ofw/ofw_bus_subr.h b/sys/dev/ofw/ofw_bus_subr.h
index 89f291f92373..8dcf517fd58b 100644
--- a/sys/dev/ofw/ofw_bus_subr.h
+++ b/sys/dev/ofw/ofw_bus_subr.h
@@ -84,6 +84,7 @@ ofw_bus_get_type_t ofw_bus_gen_get_type;
/* Helper method to report interesting OF properties in pnpinfo */
bus_child_pnpinfo_t ofw_bus_gen_child_pnpinfo;
+bus_get_device_path_t ofw_bus_gen_get_device_path;
/* Routines for processing firmware interrupt maps */
void ofw_bus_setup_iinfo(phandle_t, struct ofw_bus_iinfo *, int);
diff --git a/sys/dev/ofw/ofw_cpu.c b/sys/dev/ofw/ofw_cpu.c
index f7bfc10b7b73..8b48e645f1b4 100644
--- a/sys/dev/ofw/ofw_cpu.c
+++ b/sys/dev/ofw/ofw_cpu.c
@@ -68,6 +68,7 @@ static device_method_t ofw_cpulist_methods[] = {
/* Bus interface */
DEVMETHOD(bus_add_child, bus_generic_add_child),
DEVMETHOD(bus_child_pnpinfo, ofw_bus_gen_child_pnpinfo),
+ DEVMETHOD(bus_get_device_path, ofw_bus_gen_get_device_path),
/* ofw_bus interface */
DEVMETHOD(ofw_bus_get_devinfo, ofw_cpulist_get_devinfo),