blob: 3253130f6e765f63c05f2d233d15ad8681f56fe9 [file] [log] [blame]
Nishanth Menonf97ad372016-10-14 01:13:49 +00001/*
2 * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <bl_common.h>
8#include <gicv3.h>
9#include <interrupt_props.h>
10#include <k3_gicv3.h>
11#include <platform.h>
12#include <platform_def.h>
13#include <utils.h>
14
15/* The GICv3 driver only needs to be initialized in EL3 */
16uintptr_t rdistif_base_addrs[PLATFORM_CORE_COUNT];
17
18static const interrupt_prop_t k3_interrupt_props[] = {
19 PLAT_ARM_G1S_IRQ_PROPS(INTR_GROUP1S),
20 PLAT_ARM_G0_IRQ_PROPS(INTR_GROUP0)
21};
22
23static unsigned int k3_mpidr_to_core_pos(unsigned long mpidr)
24{
25 return (unsigned int)plat_core_pos_by_mpidr(mpidr);
26}
27
28gicv3_driver_data_t k3_gic_data = {
29 .rdistif_num = PLATFORM_CORE_COUNT,
30 .rdistif_base_addrs = rdistif_base_addrs,
31 .interrupt_props = k3_interrupt_props,
32 .interrupt_props_num = ARRAY_SIZE(k3_interrupt_props),
33 .mpidr_to_core_pos = k3_mpidr_to_core_pos,
34};
35
36void k3_gic_driver_init(uintptr_t gicd_base, uintptr_t gicr_base)
37{
38 /*
39 * The GICv3 driver is initialized in EL3 and does not need
40 * to be initialized again in SEL1. This is because the S-EL1
41 * can use GIC system registers to manage interrupts and does
42 * not need GIC interface base addresses to be configured.
43 */
44 k3_gic_data.gicd_base = gicd_base;
45 k3_gic_data.gicr_base = gicr_base;
46 gicv3_driver_init(&k3_gic_data);
47}
48
49void k3_gic_init(void)
50{
51 gicv3_distif_init();
52 gicv3_rdistif_init(plat_my_core_pos());
53 gicv3_cpuif_enable(plat_my_core_pos());
54}
55
56void k3_gic_cpuif_enable(void)
57{
58 gicv3_cpuif_enable(plat_my_core_pos());
59}
60
61void k3_gic_cpuif_disable(void)
62{
63 gicv3_cpuif_disable(plat_my_core_pos());
64}
65
66void k3_gic_pcpu_init(void)
67{
68 gicv3_rdistif_init(plat_my_core_pos());
69}