[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/16] hw/misc/empty_slot: Convert 'size' field as qdev property
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 03/16] hw/misc/empty_slot: Convert 'size' field as qdev property |
Date: |
Tue, 9 Jun 2020 09:32:01 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Artyom Tarasenko <atar4qemu@gmail.com>
Message-Id: <20200510152840.13558-4-f4bug@amsat.org>
---
hw/core/empty_slot.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c
index 5ab426e965..0df086fe98 100644
--- a/hw/core/empty_slot.c
+++ b/hw/core/empty_slot.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
#include "qemu/module.h"
+#include "hw/qdev-properties.h"
#include "hw/empty_slot.h"
//#define DEBUG_EMPTY_SLOT
@@ -57,17 +58,13 @@ void empty_slot_init(hwaddr addr, uint64_t slot_size)
if (slot_size > 0) {
/* Only empty slots larger than 0 byte need handling. */
DeviceState *dev;
- SysBusDevice *s;
- EmptySlot *e;
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);
- 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);
}
+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)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = empty_slot_realize;
+ device_class_set_props(dc, empty_slot_properties);
}
static const TypeInfo empty_slot_info = {
--
2.21.3
- [PULL 00/16] SPARC patches for 2020-06-09, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 02/16] hw/misc/empty_slot: Lower address space priority, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 01/16] hw/sparc/sun4m: Use UnimplementedDevice for I/O devices, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 06/16] hw/misc/empty_slot: Move the 'hw/misc' and cover in MAINTAINERS, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 04/16] hw/misc/empty_slot: Add a 'name' qdev property, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 03/16] hw/misc/empty_slot: Convert 'size' field as qdev property,
Philippe Mathieu-Daudé <=
- [PULL 09/16] hw/sparc64/niagara: Map the UART device unconditionally, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 07/16] hw/misc/empty_slot: Name the slots when created, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 12/16] hw/misc/grlib_ahb_apb_pnp: Fix AHB PnP 8-bit accesses, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 05/16] hw/misc/empty_slot: Convert debug printf() to trace event, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 13/16] hw/misc/grlib_ahb_apb_pnp: Add trace events on read accesses, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 14/16] hw/timer/grlib_gptimer: Display frequency in decimal, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 11/16] hw/misc/grlib_ahb_apb_pnp: Avoid crash when writing to AHB PnP registers, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 15/16] target/sparc/int32_helper: Remove DEBUG_PCALL definition, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 08/16] hw/sparc/leon3: Map the UART device unconditionally, Philippe Mathieu-Daudé, 2020/06/09
- [PULL 10/16] hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition, Philippe Mathieu-Daudé, 2020/06/09