spapr: Expose the name of the interrupt controller node
[qemu/ar7.git] / include / hw / char / pl011.h
blobdad3cf2912116e29795cce5cef5781204cd07415
1 /*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms and conditions of the GNU General Public License,
4 * version 2 or later, as published by the Free Software Foundation.
6 * This program is distributed in the hope it will be useful, but WITHOUT
7 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
9 * more details.
11 * You should have received a copy of the GNU General Public License along with
12 * this program. If not, see <http://www.gnu.org/licenses/>.
15 #ifndef HW_PL011_H
16 #define HW_PL011_H
18 #include "hw/sysbus.h"
19 #include "chardev/char-fe.h"
21 #define TYPE_PL011 "pl011"
22 #define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
24 /* This shares the same struct (and cast macro) as the base pl011 device */
25 #define TYPE_PL011_LUMINARY "pl011_luminary"
27 typedef struct PL011State {
28 SysBusDevice parent_obj;
30 MemoryRegion iomem;
31 uint32_t readbuff;
32 uint32_t flags;
33 uint32_t lcr;
34 uint32_t rsr;
35 uint32_t cr;
36 uint32_t dmacr;
37 uint32_t int_enabled;
38 uint32_t int_level;
39 uint32_t read_fifo[16];
40 uint32_t ilpr;
41 uint32_t ibrd;
42 uint32_t fbrd;
43 uint32_t ifl;
44 int read_pos;
45 int read_count;
46 int read_trigger;
47 CharBackend chr;
48 qemu_irq irq[6];
49 const unsigned char *id;
50 } PL011State;
52 static inline DeviceState *pl011_create(hwaddr addr,
53 qemu_irq irq,
54 Chardev *chr)
56 DeviceState *dev;
57 SysBusDevice *s;
59 dev = qdev_create(NULL, "pl011");
60 s = SYS_BUS_DEVICE(dev);
61 qdev_prop_set_chr(dev, "chardev", chr);
62 qdev_init_nofail(dev);
63 sysbus_mmio_map(s, 0, addr);
64 sysbus_connect_irq(s, 0, irq);
66 return dev;
69 static inline DeviceState *pl011_luminary_create(hwaddr addr,
70 qemu_irq irq,
71 Chardev *chr)
73 DeviceState *dev;
74 SysBusDevice *s;
76 dev = qdev_create(NULL, "pl011_luminary");
77 s = SYS_BUS_DEVICE(dev);
78 qdev_prop_set_chr(dev, "chardev", chr);
79 qdev_init_nofail(dev);
80 sysbus_mmio_map(s, 0, addr);
81 sysbus_connect_irq(s, 0, irq);
83 return dev;
86 #endif