qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 06/20] nubus: implement BusClass get_dev_path()


From: Laurent Vivier
Subject: Re: [PATCH v4 06/20] nubus: implement BusClass get_dev_path()
Date: Mon, 20 Sep 2021 21:57:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Le 17/09/2021 à 09:50, Mark Cave-Ayland a écrit :
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/nubus/nubus-bus.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c
> index 141876b579..63e7d66b95 100644
> --- a/hw/nubus/nubus-bus.c
> +++ b/hw/nubus/nubus-bus.c
> @@ -87,6 +87,21 @@ static void nubus_init(Object *obj)
>      nubus->slot_available_mask = MAKE_64BIT_MASK(0, 16);
>  }
>  
> +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);
> @@ -129,6 +144,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 = {
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]