From 6aa62ed6b8cef3623083b1a90cecfb854f7c4a79 Mon Sep 17 00:00:00 2001 From: Mark Cave-Ayland Date: Sat, 14 Oct 2017 13:22:22 +0100 Subject: sparc32_dma: introduce new SPARC32_DMA type container object Create a new SPARC32_DMA container object (including an appropriate container memory region) and add instances of the SPARC32_ESPDMA_DEVICE and SPARC32_LEDMA_DEVICE as child objects. The benefit is that most of the gpio wiring complexity between esp/espdma and lance/ledma is now hidden within the SPARC32_DMA realize function. Since the sun4m IOMMU is already QOMified we can find a reference to it using object_resolve_path_type() allowing us to completely remove all external references to the iommu pointer. Finally we rework sun4m's sparc32_dma_init() to invoke the new SPARC32_DMA object and wire up the remaining board memory regions/IRQs. Signed-off-by: Mark Cave-Ayland Reviewed-by: Artyom Tarasenko Acked-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- include/hw/sparc/sparc32_dma.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include') diff --git a/include/hw/sparc/sparc32_dma.h b/include/hw/sparc/sparc32_dma.h index 5e39d81c8c..5deeca6c12 100644 --- a/include/hw/sparc/sparc32_dma.h +++ b/include/hw/sparc/sparc32_dma.h @@ -44,6 +44,18 @@ typedef struct LEDMADeviceState { SysBusPCNetState *lance; } LEDMADeviceState; +#define TYPE_SPARC32_DMA "sparc32-dma" +#define SPARC32_DMA(obj) OBJECT_CHECK(SPARC32DMAState, (obj), \ + TYPE_SPARC32_DMA) + +typedef struct SPARC32DMAState { + SysBusDevice parent_obj; + + MemoryRegion dmamem; + ESPDMADeviceState *espdma; + LEDMADeviceState *ledma; +} SPARC32DMAState; + /* sparc32_dma.c */ void ledma_memory_read(void *opaque, hwaddr addr, uint8_t *buf, int len, int do_bswap); -- cgit v1.2.3-55-g7522