Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 1 | /* |
Dan Handley | e83b0ca | 2014-01-14 18:17:09 +0000 | [diff] [blame] | 2 | * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #include <arch_helpers.h> |
Achin Gupta | 191e86e | 2014-05-09 10:03:15 +0100 | [diff] [blame] | 32 | #include <assert.h> |
| 33 | #include <bl_common.h> |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 34 | #include <debug.h> |
Dan Handley | 930ee2e | 2014-04-17 17:48:52 +0100 | [diff] [blame] | 35 | #include <gic_v2.h> |
| 36 | #include <gic_v3.h> |
Achin Gupta | 191e86e | 2014-05-09 10:03:15 +0100 | [diff] [blame] | 37 | #include <interrupt_mgmt.h> |
Dan Handley | 2bd4ef2 | 2014-04-09 13:14:54 +0100 | [diff] [blame] | 38 | #include <platform.h> |
| 39 | #include <stdint.h> |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 40 | |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 41 | /******************************************************************************* |
| 42 | * This function does some minimal GICv3 configuration. The Firmware itself does |
| 43 | * not fully support GICv3 at this time and relies on GICv2 emulation as |
| 44 | * provided by GICv3. This function allows software (like Linux) in later stages |
| 45 | * to use full GICv3 features. |
| 46 | ******************************************************************************/ |
| 47 | void gicv3_cpuif_setup(void) |
| 48 | { |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 49 | unsigned int scr_val, val; |
| 50 | uintptr_t base; |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 51 | |
| 52 | /* |
| 53 | * When CPUs come out of reset they have their GICR_WAKER.ProcessorSleep |
| 54 | * bit set. In order to allow interrupts to get routed to the CPU we |
| 55 | * need to clear this bit if set and wait for GICR_WAKER.ChildrenAsleep |
| 56 | * to clear (GICv3 Architecture specification 5.4.23). |
| 57 | * GICR_WAKER is NOT banked per CPU, compute the correct base address |
| 58 | * per CPU. |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 59 | */ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 60 | base = gicv3_get_rdist(BASE_GICR_BASE, read_mpidr()); |
| 61 | if (base == (uintptr_t)NULL) { |
| 62 | /* No re-distributor base address. This interface cannot be |
| 63 | * configured. |
| 64 | */ |
| 65 | panic(); |
| 66 | } |
| 67 | |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 68 | val = gicr_read_waker(base); |
| 69 | |
| 70 | val &= ~WAKER_PS; |
| 71 | gicr_write_waker(base, val); |
| 72 | dsb(); |
| 73 | |
| 74 | /* We need to wait for ChildrenAsleep to clear. */ |
| 75 | val = gicr_read_waker(base); |
| 76 | while (val & WAKER_CA) { |
| 77 | val = gicr_read_waker(base); |
| 78 | } |
| 79 | |
| 80 | /* |
| 81 | * We need to set SCR_EL3.NS in order to see GICv3 non-secure state. |
| 82 | * Restore SCR_EL3.NS again before exit. |
| 83 | */ |
| 84 | scr_val = read_scr(); |
| 85 | write_scr(scr_val | SCR_NS_BIT); |
Andrew Thoelke | 42e75a7 | 2014-04-28 12:28:39 +0100 | [diff] [blame] | 86 | isb(); /* ensure NS=1 takes effect before accessing ICC_SRE_EL2 */ |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 87 | |
| 88 | /* |
| 89 | * By default EL2 and NS-EL1 software should be able to enable GICv3 |
| 90 | * System register access without any configuration at EL3. But it turns |
| 91 | * out that GICC PMR as set in GICv2 mode does not affect GICv3 mode. So |
| 92 | * we need to set it here again. In order to do that we need to enable |
| 93 | * register access. We leave it enabled as it should be fine and might |
| 94 | * prevent problems with later software trying to access GIC System |
| 95 | * Registers. |
| 96 | */ |
| 97 | val = read_icc_sre_el3(); |
| 98 | write_icc_sre_el3(val | ICC_SRE_EN | ICC_SRE_SRE); |
| 99 | |
| 100 | val = read_icc_sre_el2(); |
| 101 | write_icc_sre_el2(val | ICC_SRE_EN | ICC_SRE_SRE); |
| 102 | |
Jon Medhurst | d0212c2 | 2014-02-11 14:48:56 +0000 | [diff] [blame] | 103 | write_icc_pmr_el1(GIC_PRI_MASK); |
Andrew Thoelke | 42e75a7 | 2014-04-28 12:28:39 +0100 | [diff] [blame] | 104 | isb(); /* commite ICC_* changes before setting NS=0 */ |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 105 | |
| 106 | /* Restore SCR_EL3 */ |
| 107 | write_scr(scr_val); |
Andrew Thoelke | 42e75a7 | 2014-04-28 12:28:39 +0100 | [diff] [blame] | 108 | isb(); /* ensure NS=0 takes effect immediately */ |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | /******************************************************************************* |
| 112 | * This function does some minimal GICv3 configuration when cores go |
| 113 | * down. |
| 114 | ******************************************************************************/ |
| 115 | void gicv3_cpuif_deactivate(void) |
| 116 | { |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 117 | unsigned int val; |
| 118 | uintptr_t base; |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 119 | |
| 120 | /* |
| 121 | * When taking CPUs down we need to set GICR_WAKER.ProcessorSleep and |
| 122 | * wait for GICR_WAKER.ChildrenAsleep to get set. |
| 123 | * (GICv3 Architecture specification 5.4.23). |
| 124 | * GICR_WAKER is NOT banked per CPU, compute the correct base address |
| 125 | * per CPU. |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 126 | */ |
Harry Liebel | eaec590 | 2013-12-12 13:00:29 +0000 | [diff] [blame] | 127 | base = gicv3_get_rdist(BASE_GICR_BASE, read_mpidr()); |
| 128 | if (base == (uintptr_t)NULL) { |
| 129 | /* No re-distributor base address. This interface cannot be |
| 130 | * configured. |
| 131 | */ |
| 132 | panic(); |
| 133 | } |
| 134 | |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 135 | val = gicr_read_waker(base); |
| 136 | val |= WAKER_PS; |
| 137 | gicr_write_waker(base, val); |
| 138 | dsb(); |
| 139 | |
| 140 | /* We need to wait for ChildrenAsleep to set. */ |
| 141 | val = gicr_read_waker(base); |
| 142 | while ((val & WAKER_CA) == 0) { |
| 143 | val = gicr_read_waker(base); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | |
| 148 | /******************************************************************************* |
| 149 | * Enable secure interrupts and use FIQs to route them. Disable legacy bypass |
| 150 | * and set the priority mask register to allow all interrupts to trickle in. |
| 151 | ******************************************************************************/ |
| 152 | void gic_cpuif_setup(unsigned int gicc_base) |
| 153 | { |
| 154 | unsigned int val; |
| 155 | |
| 156 | val = gicc_read_iidr(gicc_base); |
| 157 | |
| 158 | /* |
| 159 | * If GICv3 we need to do a bit of additional setup. We want to |
| 160 | * allow default GICv2 behaviour but allow the next stage to |
| 161 | * enable full gicv3 features. |
| 162 | */ |
| 163 | if (((val >> GICC_IIDR_ARCH_SHIFT) & GICC_IIDR_ARCH_MASK) >= 3) { |
| 164 | gicv3_cpuif_setup(); |
| 165 | } |
| 166 | |
| 167 | val = ENABLE_GRP0 | FIQ_EN | FIQ_BYP_DIS_GRP0; |
| 168 | val |= IRQ_BYP_DIS_GRP0 | FIQ_BYP_DIS_GRP1 | IRQ_BYP_DIS_GRP1; |
| 169 | |
Jon Medhurst | d0212c2 | 2014-02-11 14:48:56 +0000 | [diff] [blame] | 170 | gicc_write_pmr(gicc_base, GIC_PRI_MASK); |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 171 | gicc_write_ctlr(gicc_base, val); |
| 172 | } |
| 173 | |
| 174 | /******************************************************************************* |
| 175 | * Place the cpu interface in a state where it can never make a cpu exit wfi as |
| 176 | * as result of an asserted interrupt. This is critical for powering down a cpu |
| 177 | ******************************************************************************/ |
| 178 | void gic_cpuif_deactivate(unsigned int gicc_base) |
| 179 | { |
| 180 | unsigned int val; |
| 181 | |
| 182 | /* Disable secure, non-secure interrupts and disable their bypass */ |
| 183 | val = gicc_read_ctlr(gicc_base); |
| 184 | val &= ~(ENABLE_GRP0 | ENABLE_GRP1); |
| 185 | val |= FIQ_BYP_DIS_GRP1 | FIQ_BYP_DIS_GRP0; |
| 186 | val |= IRQ_BYP_DIS_GRP0 | IRQ_BYP_DIS_GRP1; |
| 187 | gicc_write_ctlr(gicc_base, val); |
| 188 | |
| 189 | val = gicc_read_iidr(gicc_base); |
| 190 | |
| 191 | /* |
| 192 | * If GICv3 we need to do a bit of additional setup. Make sure the |
| 193 | * RDIST is put to sleep. |
| 194 | */ |
| 195 | if (((val >> GICC_IIDR_ARCH_SHIFT) & GICC_IIDR_ARCH_MASK) >= 3) { |
| 196 | gicv3_cpuif_deactivate(); |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | /******************************************************************************* |
| 201 | * Per cpu gic distributor setup which will be done by all cpus after a cold |
| 202 | * boot/hotplug. This marks out the secure interrupts & enables them. |
| 203 | ******************************************************************************/ |
| 204 | void gic_pcpu_distif_setup(unsigned int gicd_base) |
| 205 | { |
| 206 | gicd_write_igroupr(gicd_base, 0, ~0); |
| 207 | |
| 208 | gicd_clr_igroupr(gicd_base, IRQ_SEC_PHY_TIMER); |
| 209 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_0); |
| 210 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_1); |
| 211 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_2); |
| 212 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_3); |
| 213 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_4); |
| 214 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_5); |
| 215 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_6); |
| 216 | gicd_clr_igroupr(gicd_base, IRQ_SEC_SGI_7); |
| 217 | |
Jon Medhurst | d0212c2 | 2014-02-11 14:48:56 +0000 | [diff] [blame] | 218 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_PHY_TIMER, GIC_HIGHEST_SEC_PRIORITY); |
| 219 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_0, GIC_HIGHEST_SEC_PRIORITY); |
| 220 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_1, GIC_HIGHEST_SEC_PRIORITY); |
| 221 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_2, GIC_HIGHEST_SEC_PRIORITY); |
| 222 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_3, GIC_HIGHEST_SEC_PRIORITY); |
| 223 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_4, GIC_HIGHEST_SEC_PRIORITY); |
| 224 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_5, GIC_HIGHEST_SEC_PRIORITY); |
| 225 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_6, GIC_HIGHEST_SEC_PRIORITY); |
| 226 | gicd_set_ipriorityr(gicd_base, IRQ_SEC_SGI_7, GIC_HIGHEST_SEC_PRIORITY); |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 227 | |
| 228 | gicd_set_isenabler(gicd_base, IRQ_SEC_PHY_TIMER); |
| 229 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_0); |
| 230 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_1); |
| 231 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_2); |
| 232 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_3); |
| 233 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_4); |
| 234 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_5); |
| 235 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_6); |
| 236 | gicd_set_isenabler(gicd_base, IRQ_SEC_SGI_7); |
| 237 | } |
| 238 | |
| 239 | /******************************************************************************* |
| 240 | * Global gic distributor setup which will be done by the primary cpu after a |
| 241 | * cold boot. It marks out the secure SPIs, PPIs & SGIs and enables them. It |
| 242 | * then enables the secure GIC distributor interface. |
| 243 | ******************************************************************************/ |
| 244 | void gic_distif_setup(unsigned int gicd_base) |
| 245 | { |
| 246 | unsigned int ctr, num_ints, ctlr; |
| 247 | |
| 248 | /* Disable the distributor before going further */ |
| 249 | ctlr = gicd_read_ctlr(gicd_base); |
| 250 | ctlr &= ~(ENABLE_GRP0 | ENABLE_GRP1); |
| 251 | gicd_write_ctlr(gicd_base, ctlr); |
| 252 | |
| 253 | /* |
| 254 | * Mark out non-secure interrupts. Calculate number of |
| 255 | * IGROUPR registers to consider. Will be equal to the |
| 256 | * number of IT_LINES |
| 257 | */ |
| 258 | num_ints = gicd_read_typer(gicd_base) & IT_LINES_NO_MASK; |
| 259 | num_ints++; |
| 260 | for (ctr = 0; ctr < num_ints; ctr++) |
| 261 | gicd_write_igroupr(gicd_base, ctr << IGROUPR_SHIFT, ~0); |
| 262 | |
| 263 | /* Configure secure interrupts now */ |
| 264 | gicd_clr_igroupr(gicd_base, IRQ_TZ_WDOG); |
Jon Medhurst | d0212c2 | 2014-02-11 14:48:56 +0000 | [diff] [blame] | 265 | gicd_set_ipriorityr(gicd_base, IRQ_TZ_WDOG, GIC_HIGHEST_SEC_PRIORITY); |
Ian Spray | 8468739 | 2014-01-02 16:57:12 +0000 | [diff] [blame] | 266 | gicd_set_itargetsr(gicd_base, IRQ_TZ_WDOG, |
| 267 | platform_get_core_pos(read_mpidr())); |
| 268 | gicd_set_isenabler(gicd_base, IRQ_TZ_WDOG); |
| 269 | gic_pcpu_distif_setup(gicd_base); |
| 270 | |
| 271 | gicd_write_ctlr(gicd_base, ctlr | ENABLE_GRP0); |
| 272 | } |
| 273 | |
| 274 | void gic_setup(void) |
| 275 | { |
| 276 | unsigned int gicd_base, gicc_base; |
| 277 | |
| 278 | gicd_base = platform_get_cfgvar(CONFIG_GICD_ADDR); |
| 279 | gicc_base = platform_get_cfgvar(CONFIG_GICC_ADDR); |
| 280 | |
| 281 | gic_cpuif_setup(gicc_base); |
| 282 | gic_distif_setup(gicd_base); |
| 283 | } |
Achin Gupta | 191e86e | 2014-05-09 10:03:15 +0100 | [diff] [blame] | 284 | |
| 285 | /******************************************************************************* |
| 286 | * An ARM processor signals interrupt exceptions through the IRQ and FIQ pins. |
| 287 | * The interrupt controller knows which pin/line it uses to signal a type of |
| 288 | * interrupt. The platform knows which interrupt controller type is being used |
| 289 | * in a particular security state e.g. with an ARM GIC, normal world could use |
| 290 | * the GICv2 features while the secure world could use GICv3 features and vice |
| 291 | * versa. |
| 292 | * This function is exported by the platform to let the interrupt management |
| 293 | * framework determine for a type of interrupt and security state, which line |
| 294 | * should be used in the SCR_EL3 to control its routing to EL3. The interrupt |
| 295 | * line is represented as the bit position of the IRQ or FIQ bit in the SCR_EL3. |
| 296 | ******************************************************************************/ |
| 297 | uint32_t plat_interrupt_type_to_line(uint32_t type, uint32_t security_state) |
| 298 | { |
| 299 | uint32_t gicc_base = platform_get_cfgvar(CONFIG_GICC_ADDR); |
| 300 | |
| 301 | assert(type == INTR_TYPE_S_EL1 || |
| 302 | type == INTR_TYPE_EL3 || |
| 303 | type == INTR_TYPE_NS); |
| 304 | |
| 305 | assert(security_state == NON_SECURE || security_state == SECURE); |
| 306 | |
| 307 | /* |
| 308 | * We ignore the security state parameter under the assumption that |
| 309 | * both normal and secure worlds are using ARM GICv2. This parameter |
| 310 | * will be used when the secure world starts using GICv3. |
| 311 | */ |
| 312 | #if FVP_GIC_ARCH == 2 |
| 313 | return gicv2_interrupt_type_to_line(gicc_base, type); |
| 314 | #else |
| 315 | #error "Invalid GIC architecture version specified for FVP port" |
| 316 | #endif |
| 317 | } |
| 318 | |
Achin Gupta | 02d3628 | 2014-05-04 19:02:52 +0100 | [diff] [blame^] | 319 | #if FVP_GIC_ARCH == 2 |
| 320 | /******************************************************************************* |
| 321 | * This function returns the type of the highest priority pending interrupt at |
| 322 | * the GIC cpu interface. INTR_TYPE_INVAL is returned when there is no |
| 323 | * interrupt pending. |
| 324 | ******************************************************************************/ |
| 325 | uint32_t ic_get_pending_interrupt_type() |
| 326 | { |
| 327 | uint32_t id, gicc_base; |
| 328 | |
| 329 | gicc_base = platform_get_cfgvar(CONFIG_GICC_ADDR); |
| 330 | id = gicc_read_hppir(gicc_base); |
| 331 | |
| 332 | /* Assume that all secure interrupts are S-EL1 interrupts */ |
| 333 | if (id < 1022) |
| 334 | return INTR_TYPE_S_EL1; |
| 335 | |
| 336 | if (id == GIC_SPURIOUS_INTERRUPT) |
| 337 | return INTR_TYPE_INVAL; |
| 338 | |
| 339 | return INTR_TYPE_NS; |
| 340 | } |
| 341 | |
| 342 | /******************************************************************************* |
| 343 | * This function returns the id of the highest priority pending interrupt at |
| 344 | * the GIC cpu interface. INTR_ID_UNAVAILABLE is returned when there is no |
| 345 | * interrupt pending. |
| 346 | ******************************************************************************/ |
| 347 | uint32_t ic_get_pending_interrupt_id() |
| 348 | { |
| 349 | uint32_t id, gicc_base; |
| 350 | |
| 351 | gicc_base = platform_get_cfgvar(CONFIG_GICC_ADDR); |
| 352 | id = gicc_read_hppir(gicc_base); |
| 353 | |
| 354 | if (id < 1022) |
| 355 | return id; |
| 356 | |
| 357 | if (id == 1023) |
| 358 | return INTR_ID_UNAVAILABLE; |
| 359 | |
| 360 | /* |
| 361 | * Find out which non-secure interrupt it is under the assumption that |
| 362 | * the GICC_CTLR.AckCtl bit is 0. |
| 363 | */ |
| 364 | return gicc_read_ahppir(gicc_base); |
| 365 | } |
| 366 | |
| 367 | /******************************************************************************* |
| 368 | * This functions reads the GIC cpu interface Interrupt Acknowledge register |
| 369 | * to start handling the pending interrupt. It returns the contents of the IAR. |
| 370 | ******************************************************************************/ |
| 371 | uint32_t ic_acknowledge_interrupt() |
| 372 | { |
| 373 | return gicc_read_IAR(platform_get_cfgvar(CONFIG_GICC_ADDR)); |
| 374 | } |
| 375 | |
| 376 | /******************************************************************************* |
| 377 | * This functions writes the GIC cpu interface End Of Interrupt register with |
| 378 | * the passed value to finish handling the active interrupt |
| 379 | ******************************************************************************/ |
| 380 | void ic_end_of_interrupt(uint32_t id) |
| 381 | { |
| 382 | gicc_write_EOIR(platform_get_cfgvar(CONFIG_GICC_ADDR), id); |
| 383 | return; |
| 384 | } |
| 385 | |
| 386 | /******************************************************************************* |
| 387 | * This function returns the type of the interrupt id depending upon the group |
| 388 | * this interrupt has been configured under by the interrupt controller i.e. |
| 389 | * group0 or group1. |
| 390 | ******************************************************************************/ |
| 391 | uint32_t ic_get_interrupt_type(uint32_t id) |
| 392 | { |
| 393 | uint32_t group; |
| 394 | |
| 395 | group = gicd_get_igroupr(platform_get_cfgvar(CONFIG_GICD_ADDR), id); |
| 396 | |
| 397 | /* Assume that all secure interrupts are S-EL1 interrupts */ |
| 398 | if (group == GRP0) |
| 399 | return INTR_TYPE_S_EL1; |
| 400 | else |
| 401 | return INTR_TYPE_NS; |
| 402 | } |
| 403 | |
| 404 | #else |
| 405 | #error "Invalid GIC architecture version specified for FVP port" |
| 406 | #endif |