mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-11 03:24:58 -06:00
hw/misc/empty_slot: Convert 'size' field as qdev property
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Acked-by: Artyom Tarasenko <atar4qemu@gmail.com> Message-Id: <20200510152840.13558-4-f4bug@amsat.org>
This commit is contained in:
parent
6c339493c8
commit
4bbadef0e3
1 changed files with 9 additions and 6 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "qemu/module.h"
|
#include "qemu/module.h"
|
||||||
|
#include "hw/qdev-properties.h"
|
||||||
#include "hw/empty_slot.h"
|
#include "hw/empty_slot.h"
|
||||||
|
|
||||||
//#define DEBUG_EMPTY_SLOT
|
//#define DEBUG_EMPTY_SLOT
|
||||||
|
@ -57,17 +58,13 @@ void empty_slot_init(hwaddr addr, uint64_t slot_size)
|
||||||
if (slot_size > 0) {
|
if (slot_size > 0) {
|
||||||
/* Only empty slots larger than 0 byte need handling. */
|
/* Only empty slots larger than 0 byte need handling. */
|
||||||
DeviceState *dev;
|
DeviceState *dev;
|
||||||
SysBusDevice *s;
|
|
||||||
EmptySlot *e;
|
|
||||||
|
|
||||||
dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
|
dev = qdev_create(NULL, TYPE_EMPTY_SLOT);
|
||||||
s = SYS_BUS_DEVICE(dev);
|
|
||||||
e = EMPTY_SLOT(dev);
|
|
||||||
e->size = slot_size;
|
|
||||||
|
|
||||||
|
qdev_prop_set_uint64(dev, "size", slot_size);
|
||||||
qdev_init_nofail(dev);
|
qdev_init_nofail(dev);
|
||||||
|
|
||||||
sysbus_mmio_map_overlap(s, 0, addr, -10000);
|
sysbus_mmio_map_overlap(SYS_BUS_DEVICE(dev), 0, addr, -10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +77,17 @@ static void empty_slot_realize(DeviceState *dev, Error **errp)
|
||||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Property empty_slot_properties[] = {
|
||||||
|
DEFINE_PROP_UINT64("size", EmptySlot, size, 0),
|
||||||
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
|
};
|
||||||
|
|
||||||
static void empty_slot_class_init(ObjectClass *klass, void *data)
|
static void empty_slot_class_init(ObjectClass *klass, void *data)
|
||||||
{
|
{
|
||||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||||
|
|
||||||
dc->realize = empty_slot_realize;
|
dc->realize = empty_slot_realize;
|
||||||
|
device_class_set_props(dc, empty_slot_properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const TypeInfo empty_slot_info = {
|
static const TypeInfo empty_slot_info = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue