hw/misc/empty_slot: Add a 'name' qdev property
Add a 'name' qdev property so when multiple slots are accessed, we can notice which one is accessed. Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Artyom Tarasenko <atar4qemu@gmail.com> Message-Id: <20200510152840.13558-5-f4bug@amsat.org>
This commit is contained in:
parent
4bbadef0e3
commit
07ddf5cbe2
|
@ -31,6 +31,7 @@ typedef struct EmptySlot {
|
||||||
SysBusDevice parent_obj;
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
|
char *name;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
} EmptySlot;
|
} EmptySlot;
|
||||||
|
|
||||||
|
@ -72,13 +73,17 @@ static void empty_slot_realize(DeviceState *dev, Error **errp)
|
||||||
{
|
{
|
||||||
EmptySlot *s = EMPTY_SLOT(dev);
|
EmptySlot *s = EMPTY_SLOT(dev);
|
||||||
|
|
||||||
|
if (s->name == NULL) {
|
||||||
|
s->name = g_strdup("empty-slot");
|
||||||
|
}
|
||||||
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
|
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
|
||||||
"empty-slot", s->size);
|
s->name, s->size);
|
||||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Property empty_slot_properties[] = {
|
static Property empty_slot_properties[] = {
|
||||||
DEFINE_PROP_UINT64("size", EmptySlot, size, 0),
|
DEFINE_PROP_UINT64("size", EmptySlot, size, 0),
|
||||||
|
DEFINE_PROP_STRING("name", EmptySlot, name),
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue