diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2021-09-24 08:37:54 +0100 |
---|---|---|
committer | Laurent Vivier <laurent@vivier.eu> | 2021-09-29 10:45:19 +0200 |
commit | c0ad4eaf44d9aea4c2872e00bab5b36d05c9e0d6 (patch) | |
tree | b0106b59223f3cacdad21135057045ffb4e1ec42 /hw/nubus | |
parent | c10a576c19665a617ce00cb93afd115142b6a7af (diff) |
nubus: implement BusClass get_dev_path()
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20210924073808.1041-7-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'hw/nubus')
-rw-r--r-- | hw/nubus/nubus-bus.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 96ef027bad..04f11edd24 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -96,6 +96,21 @@ static void nubus_init(Object *obj) NUBUS_SLOT_NB); } +static char *nubus_get_dev_path(DeviceState *dev) +{ + NubusDevice *nd = NUBUS_DEVICE(dev); + BusState *bus = qdev_get_parent_bus(dev); + char *p = qdev_get_dev_path(bus->parent); + + if (p) { + char *ret = g_strdup_printf("%s/%s/%02x", p, bus->name, nd->slot); + g_free(p); + return ret; + } else { + return g_strdup_printf("%s/%02x", bus->name, nd->slot); + } +} + static bool nubus_check_address(BusState *bus, DeviceState *dev, Error **errp) { NubusDevice *nd = NUBUS_DEVICE(dev); @@ -130,6 +145,7 @@ static void nubus_class_init(ObjectClass *oc, void *data) bc->realize = nubus_realize; bc->check_address = nubus_check_address; + bc->get_dev_path = nubus_get_dev_path; } static const TypeInfo nubus_bus_info = { |