1 /* 2 * Copyright 2020 Broadcom 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_INCLUDE_DRIVERS_INTC_GIC_COMMON_PRIV_H_ 8 #define ZEPHYR_INCLUDE_DRIVERS_INTC_GIC_COMMON_PRIV_H_ 9 10 /* Offsets from GICD base or GICR(n) SGI_base */ 11 #define GIC_DIST_IGROUPR 0x0080 12 #define GIC_DIST_ISENABLER 0x0100 13 #define GIC_DIST_ICENABLER 0x0180 14 #define GIC_DIST_ISPENDR 0x0200 15 #define GIC_DIST_ICPENDR 0x0280 16 #define GIC_DIST_ISACTIVER 0x0300 17 #define GIC_DIST_ICACTIVER 0x0380 18 #define GIC_DIST_IPRIORITYR 0x0400 19 #define GIC_DIST_ITARGETSR 0x0800 20 #define GIC_DIST_ICFGR 0x0c00 21 #define GIC_DIST_IGROUPMODR 0x0d00 22 #define GIC_DIST_SGIR 0x0f00 23 24 /* GICD GICR common access macros */ 25 #define IGROUPR(base, n) (base + GIC_DIST_IGROUPR + (n) * 4) 26 #define ISENABLER(base, n) (base + GIC_DIST_ISENABLER + (n) * 4) 27 #define ICENABLER(base, n) (base + GIC_DIST_ICENABLER + (n) * 4) 28 #define ISPENDR(base, n) (base + GIC_DIST_ISPENDR + (n) * 4) 29 #define ICPENDR(base, n) (base + GIC_DIST_ICPENDR + (n) * 4) 30 #define IPRIORITYR(base, n) (base + GIC_DIST_IPRIORITYR + n) 31 #define ITARGETSR(base, n) (base + GIC_DIST_ITARGETSR + (n) * 4) 32 #define ICFGR(base, n) (base + GIC_DIST_ICFGR + (n) * 4) 33 #define IGROUPMODR(base, n) (base + GIC_DIST_IGROUPMODR + (n) * 4) 34 35 /* 36 * selects redistributor SGI_base for current core for PPI and SGI 37 * selects distributor base for SPI 38 * The macro translates to distributor base for GICv2 and GICv1 39 */ 40 41 #if CONFIG_GIC_VER <= 2 42 #define GET_DIST_BASE(intid) GIC_DIST_BASE 43 #else 44 #define GET_DIST_BASE(intid) ((intid < GIC_SPI_INT_BASE) ? \ 45 (gic_get_rdist() + GICR_SGI_BASE_OFF) \ 46 : GIC_DIST_BASE) 47 #endif 48 #endif /* ZEPHYR_INCLUDE_DRIVERS_INTC_GIC_COMMON_PRIV_H */ 49