xref: /openbmc/qemu/include/hw/sparc/sparc32_dma.h (revision f0984d40)
1 #ifndef SPARC32_DMA_H
2 #define SPARC32_DMA_H
3 
4 #include "hw/sysbus.h"
5 #include "hw/scsi/esp.h"
6 #include "hw/net/lance.h"
7 #include "qom/object.h"
8 
9 #define DMA_REGS 4
10 
11 #define TYPE_SPARC32_DMA_DEVICE "sparc32-dma-device"
12 OBJECT_DECLARE_SIMPLE_TYPE(DMADeviceState, SPARC32_DMA_DEVICE)
13 
14 
15 struct DMADeviceState {
16     SysBusDevice parent_obj;
17 
18     MemoryRegion iomem;
19     uint32_t dmaregs[DMA_REGS];
20     qemu_irq irq;
21     void *iommu;
22     qemu_irq gpio[2];
23 };
24 
25 #define TYPE_SPARC32_ESPDMA_DEVICE "sparc32-espdma"
26 OBJECT_DECLARE_SIMPLE_TYPE(ESPDMADeviceState, SPARC32_ESPDMA_DEVICE)
27 
28 struct ESPDMADeviceState {
29     DMADeviceState parent_obj;
30 
31     SysBusESPState esp;
32 };
33 
34 #define TYPE_SPARC32_LEDMA_DEVICE "sparc32-ledma"
35 OBJECT_DECLARE_SIMPLE_TYPE(LEDMADeviceState, SPARC32_LEDMA_DEVICE)
36 
37 struct LEDMADeviceState {
38     DMADeviceState parent_obj;
39 
40     SysBusPCNetState lance;
41 };
42 
43 #define TYPE_SPARC32_DMA "sparc32-dma"
44 OBJECT_DECLARE_SIMPLE_TYPE(SPARC32DMAState, SPARC32_DMA)
45 
46 struct SPARC32DMAState {
47     SysBusDevice parent_obj;
48 
49     MemoryRegion dmamem;
50     MemoryRegion ledma_alias;
51     ESPDMADeviceState espdma;
52     LEDMADeviceState ledma;
53 };
54 
55 /* sparc32_dma.c */
56 void ledma_memory_read(void *opaque, hwaddr addr,
57                        uint8_t *buf, int len, int do_bswap);
58 void ledma_memory_write(void *opaque, hwaddr addr,
59                         uint8_t *buf, int len, int do_bswap);
60 void espdma_memory_read(void *opaque, uint8_t *buf, int len);
61 void espdma_memory_write(void *opaque, uint8_t *buf, int len);
62 
63 #endif
64