diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -169,6 +169,7 @@ DEVMETHOD(bus_child_location, uhub_child_location), DEVMETHOD(bus_child_pnpinfo, uhub_child_pnpinfo), + DEVMETHOD(bus_get_device_path, uhub_get_device_path), DEVMETHOD(bus_driver_added, uhub_driver_added), DEVMETHOD_END }; @@ -1679,6 +1680,37 @@ return (0); } +int +uhub_get_device_path(device_t bus, device_t child, const char *locator, + struct sbuf *sb) +{ + struct uhub_softc *sc; + struct usb_hub *hub; + struct hub_result res; + int rv; + + if (strcmp(locator, BUS_LOCATOR_UEFI) == 0) { + rv = bus_generic_get_device_path(device_get_parent(bus), bus, locator, sb); + + sc = device_get_softc(bus); + hub = sc->sc_udev->hub; + + mtx_lock(&Giant); + uhub_find_iface_index(hub, child, &res); + if (!res.udev) { + printf("device not on hub\n"); + goto done; + } + sbuf_printf(sb, "/USB(0x%x,0x%x)", res.portno - 1, res.iface_index); + done: + mtx_unlock(&Giant); + return (0); + } + + /* For the rest, punt to the default handler */ + return (bus_generic_get_device_path(bus, child, locator, sb)); +} + static int uhub_child_pnpinfo(device_t parent, device_t child, struct sbuf*sb) { diff --git a/sys/dev/usb/usb_hub_acpi.c b/sys/dev/usb/usb_hub_acpi.c --- a/sys/dev/usb/usb_hub_acpi.c +++ b/sys/dev/usb/usb_hub_acpi.c @@ -559,8 +559,8 @@ if (strcmp(locator, BUS_LOCATOR_ACPI) == 0) return (acpi_get_acpi_device_path(bus, child, locator, sb)); - /* For the rest, punt to the default handler */ - return (bus_generic_get_device_path(bus, child, locator, sb)); + /* Otherwise call the parent class' method. */ + return (uhub_get_device_path(bus, child, locator, sb)); } static device_method_t acpi_uhub_methods[] = { diff --git a/sys/dev/usb/usb_hub_private.h b/sys/dev/usb/usb_hub_private.h --- a/sys/dev/usb/usb_hub_private.h +++ b/sys/dev/usb/usb_hub_private.h @@ -81,5 +81,6 @@ device_attach_t uhub_attach; device_detach_t uhub_detach; bus_child_location_t uhub_child_location; +bus_get_device_path_t uhub_get_device_path; #endif