Merge remote-tracking branch 'aneesh/for-upstream' into staging
[qemu-kvm.git] / hw / xilinx.h
blob7df21eb9584a9a82d805bb15e924911883b66082
1 #include "qemu-common.h"
2 #include "net.h"
4 static inline DeviceState *
5 xilinx_intc_create(target_phys_addr_t base, qemu_irq irq, int kind_of_intr)
7 DeviceState *dev;
9 dev = qdev_create(NULL, "xlnx.xps-intc");
10 qdev_prop_set_uint32(dev, "kind-of-intr", kind_of_intr);
11 qdev_init_nofail(dev);
12 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
13 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
14 return dev;
17 /* OPB Timer/Counter. */
18 static inline DeviceState *
19 xilinx_timer_create(target_phys_addr_t base, qemu_irq irq, int oto, int freq)
21 DeviceState *dev;
23 dev = qdev_create(NULL, "xlnx,xps-timer");
24 qdev_prop_set_uint32(dev, "one-timer-only", oto);
25 qdev_prop_set_uint32(dev, "frequency", freq);
26 qdev_init_nofail(dev);
27 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
28 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
29 return dev;
32 /* XPS Ethernet Lite MAC. */
33 static inline DeviceState *
34 xilinx_ethlite_create(NICInfo *nd, target_phys_addr_t base, qemu_irq irq,
35 int txpingpong, int rxpingpong)
37 DeviceState *dev;
39 qemu_check_nic_model(nd, "xlnx.xps-ethernetlite");
41 dev = qdev_create(NULL, "xlnx.xps-ethernetlite");
42 qdev_set_nic_properties(dev, nd);
43 qdev_prop_set_uint32(dev, "tx-ping-pong", txpingpong);
44 qdev_prop_set_uint32(dev, "rx-ping-pong", rxpingpong);
45 qdev_init_nofail(dev);
46 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
47 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
48 return dev;
51 static inline DeviceState *
52 xilinx_axiethernet_create(void *dmach,
53 NICInfo *nd, target_phys_addr_t base, qemu_irq irq,
54 int txmem, int rxmem)
56 DeviceState *dev;
57 qemu_check_nic_model(nd, "xlnx.axi-ethernet");
59 dev = qdev_create(NULL, "xlnx.axi-ethernet");
60 qdev_set_nic_properties(dev, nd);
61 qdev_prop_set_uint32(dev, "rxmem", rxmem);
62 qdev_prop_set_uint32(dev, "txmem", txmem);
63 qdev_prop_set_ptr(dev, "dmach", dmach);
64 qdev_init_nofail(dev);
65 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
66 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
68 return dev;
71 static inline DeviceState *
72 xilinx_axiethernetdma_create(void *dmach,
73 target_phys_addr_t base, qemu_irq irq,
74 qemu_irq irq2, int freqhz)
76 DeviceState *dev = NULL;
78 dev = qdev_create(NULL, "xlnx.axi-dma");
79 qdev_prop_set_uint32(dev, "freqhz", freqhz);
80 qdev_prop_set_ptr(dev, "dmach", dmach);
81 qdev_init_nofail(dev);
83 sysbus_mmio_map(sysbus_from_qdev(dev), 0, base);
84 sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
85 sysbus_connect_irq(sysbus_from_qdev(dev), 1, irq2);
87 return dev;