aboutsummaryrefslogtreecommitdiff
path: root/hw/dma
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-10-14 13:22:22 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-10-31 17:25:36 +0000
commit7f773ff5d0d2172a7fb4a16a283c1fc5965f6fac (patch)
tree424fde9cfab6e18e42d3511df3bc0f640278c958 /hw/dma
parent1b13a60c1c15d7d69164f6d89465915838ddc07b (diff)
downloadqemu-7f773ff5d0d2172a7fb4a16a283c1fc5965f6fac.zip
qemu-7f773ff5d0d2172a7fb4a16a283c1fc5965f6fac.tar.gz
qemu-7f773ff5d0d2172a7fb4a16a283c1fc5965f6fac.tar.bz2
sparc32_dma: make esp device child of espdma device
This makes it possible to reference the esp device from the espdma device as required, and by wiring up the device ourselves in sun4m.c we can drop use of the esp_init() function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Artyom Tarasenko <atar4qemu@gmail.com> Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw/dma')
-rw-r--r--hw/dma/sparc32_dma.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index c56a2ba..6009b94 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -298,11 +298,37 @@ static void sparc32_espdma_device_init(Object *obj)
s->is_ledma = 0;
}
+static void sparc32_espdma_device_realize(DeviceState *dev, Error **errp)
+{
+ DeviceState *d;
+ SysBusESPState *sysbus;
+ ESPState *esp;
+
+ d = qdev_create(NULL, TYPE_ESP);
+ object_property_add_child(OBJECT(dev), "esp", OBJECT(d), errp);
+ sysbus = ESP_STATE(d);
+ esp = &sysbus->esp;
+ esp->dma_memory_read = espdma_memory_read;
+ esp->dma_memory_write = espdma_memory_write;
+ esp->dma_opaque = SPARC32_DMA_DEVICE(dev);
+ sysbus->it_shift = 2;
+ esp->dma_enabled = 1;
+ qdev_init_nofail(d);
+}
+
+static void sparc32_espdma_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->realize = sparc32_espdma_device_realize;
+}
+
static const TypeInfo sparc32_espdma_device_info = {
.name = TYPE_SPARC32_ESPDMA_DEVICE,
.parent = TYPE_SPARC32_DMA_DEVICE,
.instance_size = sizeof(ESPDMADeviceState),
.instance_init = sparc32_espdma_device_init,
+ .class_init = sparc32_espdma_device_class_init,
};
static void sparc32_ledma_device_init(Object *obj)