Achin Gupta | 1fa7eb6 | 2015-11-03 14:18:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 1fa7eb6 | 2015-11-03 14:18:34 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <gicv2.h> |
| 8 | #include <plat_arm.h> |
| 9 | #include <platform.h> |
| 10 | #include <platform_def.h> |
| 11 | |
| 12 | /****************************************************************************** |
| 13 | * The following functions are defined as weak to allow a platform to override |
| 14 | * the way the GICv2 driver is initialised and used. |
| 15 | *****************************************************************************/ |
| 16 | #pragma weak plat_arm_gic_driver_init |
| 17 | #pragma weak plat_arm_gic_init |
| 18 | #pragma weak plat_arm_gic_cpuif_enable |
| 19 | #pragma weak plat_arm_gic_cpuif_disable |
| 20 | #pragma weak plat_arm_gic_pcpu_init |
| 21 | |
| 22 | /****************************************************************************** |
| 23 | * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 |
| 24 | * interrupts. |
| 25 | *****************************************************************************/ |
Soby Mathew | cf022c5 | 2016-01-13 17:06:00 +0000 | [diff] [blame] | 26 | static const unsigned int g0_interrupt_array[] = { |
Achin Gupta | 1fa7eb6 | 2015-11-03 14:18:34 +0000 | [diff] [blame] | 27 | PLAT_ARM_G1S_IRQS, |
| 28 | PLAT_ARM_G0_IRQS |
| 29 | }; |
| 30 | |
Soby Mathew | cf022c5 | 2016-01-13 17:06:00 +0000 | [diff] [blame] | 31 | static const gicv2_driver_data_t arm_gic_data = { |
Achin Gupta | 1fa7eb6 | 2015-11-03 14:18:34 +0000 | [diff] [blame] | 32 | .gicd_base = PLAT_ARM_GICD_BASE, |
| 33 | .gicc_base = PLAT_ARM_GICC_BASE, |
| 34 | .g0_interrupt_num = ARRAY_SIZE(g0_interrupt_array), |
| 35 | .g0_interrupt_array = g0_interrupt_array, |
| 36 | }; |
| 37 | |
| 38 | /****************************************************************************** |
| 39 | * ARM common helper to initialize the GICv2 only driver. |
| 40 | *****************************************************************************/ |
| 41 | void plat_arm_gic_driver_init(void) |
| 42 | { |
| 43 | gicv2_driver_init(&arm_gic_data); |
| 44 | } |
| 45 | |
| 46 | void plat_arm_gic_init(void) |
| 47 | { |
| 48 | gicv2_distif_init(); |
| 49 | gicv2_pcpu_distif_init(); |
| 50 | gicv2_cpuif_enable(); |
| 51 | } |
| 52 | |
| 53 | /****************************************************************************** |
| 54 | * ARM common helper to enable the GICv2 CPU interface |
| 55 | *****************************************************************************/ |
| 56 | void plat_arm_gic_cpuif_enable(void) |
| 57 | { |
| 58 | gicv2_cpuif_enable(); |
| 59 | } |
| 60 | |
| 61 | /****************************************************************************** |
| 62 | * ARM common helper to disable the GICv2 CPU interface |
| 63 | *****************************************************************************/ |
| 64 | void plat_arm_gic_cpuif_disable(void) |
| 65 | { |
| 66 | gicv2_cpuif_disable(); |
| 67 | } |
| 68 | |
| 69 | /****************************************************************************** |
| 70 | * ARM common helper to initialize the per cpu distributor interface in GICv2 |
| 71 | *****************************************************************************/ |
| 72 | void plat_arm_gic_pcpu_init(void) |
| 73 | { |
| 74 | gicv2_pcpu_distif_init(); |
| 75 | } |
Jeenu Viswambharan | 78132c9 | 2016-12-09 11:12:34 +0000 | [diff] [blame] | 76 | |
| 77 | /****************************************************************************** |
| 78 | * Stubs for Redistributor power management. Although GICv2 doesn't have |
| 79 | * Redistributor interface, these are provided for the sake of uniform GIC API |
| 80 | *****************************************************************************/ |
| 81 | void plat_arm_gic_redistif_on(void) |
| 82 | { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | void plat_arm_gic_redistif_off(void) |
| 87 | { |
| 88 | return; |
| 89 | } |