blob: e19799a0a4cea4f5e0bf25e893115955488e7863 [file] [log] [blame]
Achin Gupta1fa7eb62015-11-03 14:18:34 +00001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta1fa7eb62015-11-03 14:18:34 +00005 */
6
7#include <arm_def.h>
8#include <arm_gic.h>
9#include <plat_arm.h>
10#include <platform.h>
11#include <platform_def.h>
12
13/******************************************************************************
14 * The following function is defined as weak to allow a platform to override
15 * the way the Legacy GICv3 driver is initialised and used.
16 *****************************************************************************/
17#pragma weak plat_arm_gic_driver_init
18#pragma weak plat_arm_gic_init
19#pragma weak plat_arm_gic_cpuif_enable
20#pragma weak plat_arm_gic_cpuif_disable
21#pragma weak plat_arm_gic_pcpu_init
22
23/*
24 * In the GICv3 Legacy mode, the Group 1 secure interrupts are treated as Group
25 * 0 interrupts.
26 */
Soby Mathewcf022c52016-01-13 17:06:00 +000027static const unsigned int irq_sec_array[] = {
Achin Gupta1fa7eb62015-11-03 14:18:34 +000028 PLAT_ARM_G0_IRQS,
29 PLAT_ARM_G1S_IRQS
30};
31
32void plat_arm_gic_driver_init(void)
33{
34 arm_gic_init(PLAT_ARM_GICC_BASE,
35 PLAT_ARM_GICD_BASE,
36 PLAT_ARM_GICR_BASE,
37 irq_sec_array,
38 ARRAY_SIZE(irq_sec_array));
39}
40
41/******************************************************************************
42 * ARM common helper to initialize the GIC.
43 *****************************************************************************/
44void plat_arm_gic_init(void)
45{
46 arm_gic_setup();
47}
48
49/******************************************************************************
50 * ARM common helper to enable the GIC CPU interface
51 *****************************************************************************/
52void plat_arm_gic_cpuif_enable(void)
53{
54 arm_gic_cpuif_setup();
55}
56
57/******************************************************************************
58 * ARM common helper to disable the GIC CPU interface
59 *****************************************************************************/
60void plat_arm_gic_cpuif_disable(void)
61{
62 arm_gic_cpuif_deactivate();
63}
64
65/******************************************************************************
66 * ARM common helper to initialize the per-cpu distributor in GICv2 or
67 * redistributor interface in GICv3.
68 *****************************************************************************/
69void plat_arm_gic_pcpu_init(void)
70{
71 arm_gic_pcpu_distif_setup();
72}
Jeenu Viswambharan78132c92016-12-09 11:12:34 +000073
74/******************************************************************************
75 * Stubs for Redistributor power management. Although legacy configuration isn't
76 * supported, these are provided for the sake of uniform GIC API
77 *****************************************************************************/
78void plat_arm_gic_redistif_on(void)
79{
80 return;
81}
82
83void plat_arm_gic_redistif_off(void)
84{
85 return;
86}
Soby Mathew9ca28062017-10-11 16:08:58 +010087
88/******************************************************************************
89 * ARM common helper to save & restore the GICv3 on resume from system suspend.
90 *****************************************************************************/
91void plat_arm_gic_save(void)
92{
93 return;
94}
95
96void plat_arm_gic_resume(void)
97{
98 arm_gic_setup();
99}