xref: /openbmc/qemu/include/hw/intc/aspeed_intc.h (revision d831c5fd)
1 /*
2  * ASPEED INTC Controller
3  *
4  * Copyright (C) 2024 ASPEED Technology Inc.
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 #ifndef ASPEED_INTC_H
9 #define ASPEED_INTC_H
10 
11 #include "hw/sysbus.h"
12 #include "qom/object.h"
13 #include "hw/or-irq.h"
14 
15 #define TYPE_ASPEED_INTC "aspeed.intc"
16 #define TYPE_ASPEED_2700_INTC TYPE_ASPEED_INTC "-ast2700"
17 OBJECT_DECLARE_TYPE(AspeedINTCState, AspeedINTCClass, ASPEED_INTC)
18 
19 #define ASPEED_INTC_NR_REGS (0x2000 >> 2)
20 #define ASPEED_INTC_NR_INTS 9
21 
22 struct AspeedINTCState {
23     /*< private >*/
24     SysBusDevice parent_obj;
25 
26     /*< public >*/
27     MemoryRegion iomem;
28     uint32_t regs[ASPEED_INTC_NR_REGS];
29     OrIRQState orgates[ASPEED_INTC_NR_INTS];
30     qemu_irq output_pins[ASPEED_INTC_NR_INTS];
31 
32     uint32_t enable[ASPEED_INTC_NR_INTS];
33     uint32_t mask[ASPEED_INTC_NR_INTS];
34     uint32_t pending[ASPEED_INTC_NR_INTS];
35 };
36 
37 struct AspeedINTCClass {
38     SysBusDeviceClass parent_class;
39 
40     uint32_t num_lines;
41     uint32_t num_ints;
42 };
43 
44 #endif /* ASPEED_INTC_H */
45