xref: /openbmc/qemu/include/hw/intc/arm_gic.h (revision 017b2e7363629302da8ea5274e828bc8a8908a73)
183728796SAndreas Färber /*
283728796SAndreas Färber  * ARM GIC support
383728796SAndreas Färber  *
483728796SAndreas Färber  * Copyright (c) 2012 Linaro Limited
583728796SAndreas Färber  * Written by Peter Maydell
683728796SAndreas Färber  *
783728796SAndreas Färber  * This program is free software; you can redistribute it and/or modify
883728796SAndreas Färber  * it under the terms of the GNU General Public License as published by
983728796SAndreas Färber  * the Free Software Foundation, either version 2 of the License, or
1083728796SAndreas Färber  * (at your option) any later version.
1183728796SAndreas Färber  *
1283728796SAndreas Färber  * This program is distributed in the hope that it will be useful,
1383728796SAndreas Färber  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1483728796SAndreas Färber  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1583728796SAndreas Färber  * GNU General Public License for more details.
1683728796SAndreas Färber  *
1783728796SAndreas Färber  * You should have received a copy of the GNU General Public License along
1883728796SAndreas Färber  * with this program; if not, see <http://www.gnu.org/licenses/>.
1983728796SAndreas Färber  */
2083728796SAndreas Färber 
2148314d83SPeter Maydell /*
2248314d83SPeter Maydell  * QEMU interface:
2348314d83SPeter Maydell  *  + QOM property "num-cpu": number of CPUs to support
2448314d83SPeter Maydell  *  + QOM property "num-irq": number of IRQs (including both SPIs and PPIs)
2548314d83SPeter Maydell  *  + QOM property "revision": GIC version (1 or 2), or 0 for the 11MPCore GIC
2648314d83SPeter Maydell  *  + QOM property "has-security-extensions": set true if the GIC should
2748314d83SPeter Maydell  *    implement the security extensions
2848314d83SPeter Maydell  *  + QOM property "has-virtualization-extensions": set true if the GIC should
2948314d83SPeter Maydell  *    implement the virtualization extensions
3048314d83SPeter Maydell  *  + unnamed GPIO inputs: (where P is number of SPIs, i.e. num-irq - 32)
3148314d83SPeter Maydell  *    [0..P-1]  SPIs
3248314d83SPeter Maydell  *    [P..P+31] PPIs for CPU 0
3348314d83SPeter Maydell  *    [P+32..P+63] PPIs for CPU 1
3448314d83SPeter Maydell  *    ...
3548314d83SPeter Maydell  *  + sysbus IRQs: (in order; number will vary depending on number of cores)
3648314d83SPeter Maydell  *    - IRQ for CPU 0
3748314d83SPeter Maydell  *    - IRQ for CPU 1
3848314d83SPeter Maydell  *      ...
3948314d83SPeter Maydell  *    - FIQ for CPU 0
4048314d83SPeter Maydell  *    - FIQ for CPU 1
4148314d83SPeter Maydell  *      ...
4248314d83SPeter Maydell  *    - VIRQ for CPU 0 (exists even if virt extensions not present)
4348314d83SPeter Maydell  *    - VIRQ for CPU 1 (exists even if virt extensions not present)
4448314d83SPeter Maydell  *      ...
4548314d83SPeter Maydell  *    - VFIQ for CPU 0 (exists even if virt extensions not present)
4648314d83SPeter Maydell  *    - VFIQ for CPU 1 (exists even if virt extensions not present)
4748314d83SPeter Maydell  *      ...
4848314d83SPeter Maydell  *    - maintenance IRQ for CPU i/f 0 (only if virt extensions present)
4948314d83SPeter Maydell  *    - maintenance IRQ for CPU i/f 1 (only if virt extensions present)
5048314d83SPeter Maydell  *  + sysbus MMIO regions: (in order; numbers will vary depending on
5148314d83SPeter Maydell  *    whether virtualization extensions are present and on number of cores)
5248314d83SPeter Maydell  *    - distributor registers (GICD*)
5348314d83SPeter Maydell  *    - CPU interface for the accessing core (GICC*)
5448314d83SPeter Maydell  *    - virtual interface control registers (GICH*) (only if virt extns present)
5548314d83SPeter Maydell  *    - virtual CPU interface for the accessing core (GICV*) (only if virt)
5648314d83SPeter Maydell  *    - CPU 0 CPU interface registers
5748314d83SPeter Maydell  *    - CPU 1 CPU interface registers
5848314d83SPeter Maydell  *      ...
5948314d83SPeter Maydell  *    - CPU 0 virtual interface control registers (only if virt extns present)
6048314d83SPeter Maydell  *    - CPU 1 virtual interface control registers (only if virt extns present)
6148314d83SPeter Maydell  *      ...
6248314d83SPeter Maydell  */
6348314d83SPeter Maydell 
6483728796SAndreas Färber #ifndef HW_ARM_GIC_H
6583728796SAndreas Färber #define HW_ARM_GIC_H
6683728796SAndreas Färber 
6783728796SAndreas Färber #include "arm_gic_common.h"
68db1015e9SEduardo Habkost #include "qom/object.h"
6983728796SAndreas Färber 
70c8efd802SAndrew Jones /* Number of SGI target-list bits */
71c8efd802SAndrew Jones #define GIC_TARGETLIST_BITS 8
7211411489SSai Pavan Boddu #define GIC_MAX_PRIORITY_BITS 8
7311411489SSai Pavan Boddu #define GIC_MIN_PRIORITY_BITS 4
74c8efd802SAndrew Jones 
7583728796SAndreas Färber #define TYPE_ARM_GIC "arm_gic"
76db1015e9SEduardo Habkost typedef struct ARMGICClass ARMGICClass;
77fa34a3c5SEduardo Habkost /* This is reusing the GICState typedef from TYPE_ARM_GIC_COMMON */
78fa34a3c5SEduardo Habkost DECLARE_OBJ_CHECKERS(GICState, ARMGICClass,
79fa34a3c5SEduardo Habkost                      ARM_GIC, TYPE_ARM_GIC)
8083728796SAndreas Färber 
81db1015e9SEduardo Habkost struct ARMGICClass {
8283728796SAndreas Färber     /*< private >*/
8383728796SAndreas Färber     ARMGICCommonClass parent_class;
8483728796SAndreas Färber     /*< public >*/
8583728796SAndreas Färber 
8683728796SAndreas Färber     DeviceRealize parent_realize;
87db1015e9SEduardo Habkost };
8883728796SAndreas Färber 
89*0c40daf0SPhilippe Mathieu-Daudé const char *gic_class_name(void);
90*0c40daf0SPhilippe Mathieu-Daudé 
9183728796SAndreas Färber #endif
92