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