mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-10 11:04:58 -06:00
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>
This commit is contained in:
parent
c10a576c19
commit
c0ad4eaf44
1 changed files with 16 additions and 0 deletions
|
@ -96,6 +96,21 @@ static void nubus_init(Object *obj)
|
||||||
NUBUS_SLOT_NB);
|
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)
|
static bool nubus_check_address(BusState *bus, DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
NubusDevice *nd = NUBUS_DEVICE(dev);
|
NubusDevice *nd = NUBUS_DEVICE(dev);
|
||||||
|
@ -130,6 +145,7 @@ static void nubus_class_init(ObjectClass *oc, void *data)
|
||||||
|
|
||||||
bc->realize = nubus_realize;
|
bc->realize = nubus_realize;
|
||||||
bc->check_address = nubus_check_address;
|
bc->check_address = nubus_check_address;
|
||||||
|
bc->get_dev_path = nubus_get_dev_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo nubus_bus_info = {
|
static const TypeInfo nubus_bus_info = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue