blob: 1c1be47fb89e00efb41838634a95aab0dcefa95f [file] [log] [blame]
Antonio Nino Diaz6766bb12018-10-26 11:12:31 +01001/*
2 * Copyright (c) 2015-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <gicv2.h>
8#include <platform.h>
9#include <platform_def.h>
10
11/******************************************************************************
12 * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
13 * interrupts.
14 *****************************************************************************/
15static const interrupt_prop_t poplar_interrupt_props[] = {
16 POPLAR_G1S_IRQ_PROPS(GICV2_INTR_GROUP0),
17 POPLAR_G0_IRQ_PROPS(GICV2_INTR_GROUP0)
18};
19
20static unsigned int target_mask_array[PLATFORM_CORE_COUNT];
21
22static const gicv2_driver_data_t poplar_gic_data = {
23 .gicd_base = POPLAR_GICD_BASE,
24 .gicc_base = POPLAR_GICC_BASE,
25 .interrupt_props = poplar_interrupt_props,
26 .interrupt_props_num = ARRAY_SIZE(poplar_interrupt_props),
27 .target_masks = target_mask_array,
28 .target_masks_num = ARRAY_SIZE(target_mask_array),
29};
30
31/******************************************************************************
32 * Helper to initialize the GICv2 only driver.
33 *****************************************************************************/
34void poplar_gic_driver_init(void)
35{
36 gicv2_driver_init(&poplar_gic_data);
37}
38
39void poplar_gic_init(void)
40{
41 gicv2_distif_init();
42 gicv2_pcpu_distif_init();
43 gicv2_set_pe_target_mask(plat_my_core_pos());
44 gicv2_cpuif_enable();
45}
46
47/******************************************************************************
48 * Helper to enable the GICv2 CPU interface
49 *****************************************************************************/
50void poplar_gic_cpuif_enable(void)
51{
52 gicv2_cpuif_enable();
53}
54
55/******************************************************************************
56 * Helper to initialize the per cpu distributor interface in GICv2
57 *****************************************************************************/
58void poplar_gic_pcpu_init(void)
59{
60 gicv2_pcpu_distif_init();
61 gicv2_set_pe_target_mask(plat_my_core_pos());
62}