diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2017-10-14 13:22:22 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2017-10-31 17:25:36 +0000 |
commit | e6ca02a46ae0fafe59544b789e9172efa1a929c1 (patch) | |
tree | 71fc4e1297f8a3580f964da57dee46fbdfbdc9d9 /hw/dma | |
parent | 76d28ca7653b69df5e9a4e11b2d15cbe885e5698 (diff) |
sparc32_dma: make lance device child of ledma device
This makes it possible to reference the lance device from the ledma device as
required.
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.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c index 6009b94473..d4cff74871 100644 --- a/hw/dma/sparc32_dma.c +++ b/hw/dma/sparc32_dma.c @@ -340,11 +340,33 @@ static void sparc32_ledma_device_init(Object *obj) s->is_ledma = 1; } +static void sparc32_ledma_device_realize(DeviceState *dev, Error **errp) +{ + DeviceState *d; + NICInfo *nd = &nd_table[0]; + + qemu_check_nic_model(nd, TYPE_LANCE); + + d = qdev_create(NULL, TYPE_LANCE); + object_property_add_child(OBJECT(dev), "lance", OBJECT(d), errp); + qdev_set_nic_properties(d, nd); + qdev_prop_set_ptr(d, "dma", dev); + qdev_init_nofail(d); +} + +static void sparc32_ledma_device_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = sparc32_ledma_device_realize; +} + static const TypeInfo sparc32_ledma_device_info = { .name = TYPE_SPARC32_LEDMA_DEVICE, .parent = TYPE_SPARC32_DMA_DEVICE, .instance_size = sizeof(LEDMADeviceState), .instance_init = sparc32_ledma_device_init, + .class_init = sparc32_ledma_device_class_init, }; static void sparc32_dma_register_types(void) |