Message ID | 20210917075057.20924-4-mark.cave-ayland@ilande.co.uk |
---|---|
State | New |
Headers | show |
Series | nubus: bus, device, bridge, IRQ and address space improvements | expand |
Le 17/09/2021 à 09:50, Mark Cave-Ayland a écrit : > This prepares for allowing Nubus devices to be placed in a specific slot instead > of always being auto-allocated by the bus itself. > > Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> > --- > hw/nubus/nubus-device.c | 6 ++++++ > include/hw/nubus/nubus.h | 2 +- > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c > index 36203848e5..c1832f73da 100644 > --- a/hw/nubus/nubus-device.c > +++ b/hw/nubus/nubus-device.c > @@ -191,12 +191,18 @@ static void nubus_device_realize(DeviceState *dev, Error **errp) > nubus_register_format_block(nd); > } > > +static Property nubus_device_properties[] = { > + DEFINE_PROP_INT32("slot", NubusDevice, slot, -1), > + DEFINE_PROP_END_OF_LIST() > +}; > + > static void nubus_device_class_init(ObjectClass *oc, void *data) > { > DeviceClass *dc = DEVICE_CLASS(oc); > > dc->realize = nubus_device_realize; > dc->bus_type = TYPE_NUBUS_BUS; > + device_class_set_props(dc, nubus_device_properties); > } > > static const TypeInfo nubus_device_type_info = { > diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h > index 89b0976aaa..357f621d15 100644 > --- a/include/hw/nubus/nubus.h > +++ b/include/hw/nubus/nubus.h > @@ -42,7 +42,7 @@ struct NubusBus { > struct NubusDevice { > DeviceState qdev; > > - int slot; > + int32_t slot; > MemoryRegion super_slot_mem; > MemoryRegion slot_mem; > > I think this patch should be merged with the following one because slot is simply ignored for the moment as it is overwritten in nubus_device_realize(). Reviewed-by: Laurent Vivier <laurent@vivier.eu>
On 20/09/2021 18:31, Laurent Vivier wrote: > Le 17/09/2021 à 09:50, Mark Cave-Ayland a écrit : >> This prepares for allowing Nubus devices to be placed in a specific slot instead >> of always being auto-allocated by the bus itself. >> >> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> >> --- >> hw/nubus/nubus-device.c | 6 ++++++ >> include/hw/nubus/nubus.h | 2 +- >> 2 files changed, 7 insertions(+), 1 deletion(-) >> >> diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c >> index 36203848e5..c1832f73da 100644 >> --- a/hw/nubus/nubus-device.c >> +++ b/hw/nubus/nubus-device.c >> @@ -191,12 +191,18 @@ static void nubus_device_realize(DeviceState *dev, Error **errp) >> nubus_register_format_block(nd); >> } >> >> +static Property nubus_device_properties[] = { >> + DEFINE_PROP_INT32("slot", NubusDevice, slot, -1), >> + DEFINE_PROP_END_OF_LIST() >> +}; >> + >> static void nubus_device_class_init(ObjectClass *oc, void *data) >> { >> DeviceClass *dc = DEVICE_CLASS(oc); >> >> dc->realize = nubus_device_realize; >> dc->bus_type = TYPE_NUBUS_BUS; >> + device_class_set_props(dc, nubus_device_properties); >> } >> >> static const TypeInfo nubus_device_type_info = { >> diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h >> index 89b0976aaa..357f621d15 100644 >> --- a/include/hw/nubus/nubus.h >> +++ b/include/hw/nubus/nubus.h >> @@ -42,7 +42,7 @@ struct NubusBus { >> struct NubusDevice { >> DeviceState qdev; >> >> - int slot; >> + int32_t slot; >> MemoryRegion super_slot_mem; >> MemoryRegion slot_mem; >> >> > > I think this patch should be merged with the following one because slot is simply ignored for the > moment as it is overwritten in nubus_device_realize(). > > Reviewed-by: Laurent Vivier <laurent@vivier.eu> Okay I can do that. My original thinking was to introduce the property first, then change the logic to make the follow-on patch easier to review but I don't mind either way. ATB, Mark.
diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 36203848e5..c1832f73da 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -191,12 +191,18 @@ static void nubus_device_realize(DeviceState *dev, Error **errp) nubus_register_format_block(nd); } +static Property nubus_device_properties[] = { + DEFINE_PROP_INT32("slot", NubusDevice, slot, -1), + DEFINE_PROP_END_OF_LIST() +}; + static void nubus_device_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = nubus_device_realize; dc->bus_type = TYPE_NUBUS_BUS; + device_class_set_props(dc, nubus_device_properties); } static const TypeInfo nubus_device_type_info = { diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 89b0976aaa..357f621d15 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -42,7 +42,7 @@ struct NubusBus { struct NubusDevice { DeviceState qdev; - int slot; + int32_t slot; MemoryRegion super_slot_mem; MemoryRegion slot_mem;
This prepares for allowing Nubus devices to be placed in a specific slot instead of always being auto-allocated by the bus itself. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> --- hw/nubus/nubus-device.c | 6 ++++++ include/hw/nubus/nubus.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-)