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>
This commit is contained in:
parent
76d28ca765
commit
e6ca02a46a
@ -340,11 +340,33 @@ static void sparc32_ledma_device_init(Object *obj)
|
|||||||
s->is_ledma = 1;
|
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 = {
|
static const TypeInfo sparc32_ledma_device_info = {
|
||||||
.name = TYPE_SPARC32_LEDMA_DEVICE,
|
.name = TYPE_SPARC32_LEDMA_DEVICE,
|
||||||
.parent = TYPE_SPARC32_DMA_DEVICE,
|
.parent = TYPE_SPARC32_DMA_DEVICE,
|
||||||
.instance_size = sizeof(LEDMADeviceState),
|
.instance_size = sizeof(LEDMADeviceState),
|
||||||
.instance_init = sparc32_ledma_device_init,
|
.instance_init = sparc32_ledma_device_init,
|
||||||
|
.class_init = sparc32_ledma_device_class_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sparc32_dma_register_types(void)
|
static void sparc32_dma_register_types(void)
|
||||||
|
@ -320,26 +320,6 @@ static void *sparc32_dma_init(hwaddr daddr, void *iommu, int is_ledma)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lance_init(NICInfo *nd, hwaddr leaddr,
|
|
||||||
void *dma_opaque, qemu_irq irq)
|
|
||||||
{
|
|
||||||
DeviceState *dev;
|
|
||||||
SysBusDevice *s;
|
|
||||||
qemu_irq reset;
|
|
||||||
|
|
||||||
qemu_check_nic_model(&nd_table[0], "lance");
|
|
||||||
|
|
||||||
dev = qdev_create(NULL, "lance");
|
|
||||||
qdev_set_nic_properties(dev, nd);
|
|
||||||
qdev_prop_set_ptr(dev, "dma", dma_opaque);
|
|
||||||
qdev_init_nofail(dev);
|
|
||||||
s = SYS_BUS_DEVICE(dev);
|
|
||||||
sysbus_mmio_map(s, 0, leaddr);
|
|
||||||
sysbus_connect_irq(s, 0, irq);
|
|
||||||
reset = qdev_get_gpio_in(dev, 0);
|
|
||||||
qdev_connect_gpio_out(dma_opaque, 0, reset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DeviceState *slavio_intctl_init(hwaddr addr,
|
static DeviceState *slavio_intctl_init(hwaddr addr,
|
||||||
hwaddr addrg,
|
hwaddr addrg,
|
||||||
qemu_irq **parent_irq)
|
qemu_irq **parent_irq)
|
||||||
@ -817,7 +797,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
|||||||
DeviceState *slavio_intctl;
|
DeviceState *slavio_intctl;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
void *iommu, *nvram;
|
void *iommu, *nvram;
|
||||||
DeviceState *espdma, *esp, *ledma;
|
DeviceState *espdma, *esp, *ledma, *lance;
|
||||||
SysBusDevice *sbd;
|
SysBusDevice *sbd;
|
||||||
qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS];
|
qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS];
|
||||||
qemu_irq fdc_tc;
|
qemu_irq fdc_tc;
|
||||||
@ -889,6 +869,12 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
|||||||
sbd = SYS_BUS_DEVICE(ledma);
|
sbd = SYS_BUS_DEVICE(ledma);
|
||||||
sysbus_connect_irq(sbd, 0, slavio_irq[16]);
|
sysbus_connect_irq(sbd, 0, slavio_irq[16]);
|
||||||
|
|
||||||
|
lance = DEVICE(object_resolve_path_component(OBJECT(ledma), "lance"));
|
||||||
|
sbd = SYS_BUS_DEVICE(lance);
|
||||||
|
sysbus_mmio_map(sbd, 0, hwdef->le_base);
|
||||||
|
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(ledma, 0));
|
||||||
|
qdev_connect_gpio_out(ledma, 0, qdev_get_gpio_in(lance, 0));
|
||||||
|
|
||||||
if (graphic_depth != 8 && graphic_depth != 24) {
|
if (graphic_depth != 8 && graphic_depth != 24) {
|
||||||
error_report("Unsupported depth: %d", graphic_depth);
|
error_report("Unsupported depth: %d", graphic_depth);
|
||||||
exit (1);
|
exit (1);
|
||||||
@ -940,9 +926,6 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
|||||||
empty_slot_init(hwdef->sx_base, 0x2000);
|
empty_slot_init(hwdef->sx_base, 0x2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
lance_init(&nd_table[0], hwdef->le_base, ledma,
|
|
||||||
qdev_get_gpio_in(ledma, 0));
|
|
||||||
|
|
||||||
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 1968, 8);
|
nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, 0x2000, 1968, 8);
|
||||||
|
|
||||||
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
slavio_timer_init_all(hwdef->counter_base, slavio_irq[19], slavio_cpu_irq, smp_cpus);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "hw/sysbus.h"
|
#include "hw/sysbus.h"
|
||||||
#include "hw/scsi/esp.h"
|
#include "hw/scsi/esp.h"
|
||||||
|
#include "hw/net/lance.h"
|
||||||
|
|
||||||
#define DMA_REGS 4
|
#define DMA_REGS 4
|
||||||
|
|
||||||
@ -39,6 +40,8 @@ typedef struct ESPDMADeviceState {
|
|||||||
|
|
||||||
typedef struct LEDMADeviceState {
|
typedef struct LEDMADeviceState {
|
||||||
DMADeviceState parent_obj;
|
DMADeviceState parent_obj;
|
||||||
|
|
||||||
|
SysBusPCNetState *lance;
|
||||||
} LEDMADeviceState;
|
} LEDMADeviceState;
|
||||||
|
|
||||||
/* sparc32_dma.c */
|
/* sparc32_dma.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user