Yann Gautier | 9d135e4 | 2018-07-16 19:36:06 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016-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 <gicv2.h> |
| 9 | #include <platform.h> |
| 10 | #include <platform_def.h> |
| 11 | #include <utils.h> |
| 12 | |
| 13 | #include <stm32mp1_private.h> |
| 14 | |
| 15 | /****************************************************************************** |
| 16 | * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 |
| 17 | * interrupts. |
| 18 | *****************************************************************************/ |
| 19 | static const interrupt_prop_t stm32mp1_interrupt_props[] = { |
| 20 | PLATFORM_G1S_PROPS(GICV2_INTR_GROUP0), |
| 21 | PLATFORM_G0_PROPS(GICV2_INTR_GROUP0) |
| 22 | }; |
| 23 | |
| 24 | static unsigned int target_mask_array[PLATFORM_CORE_COUNT]; |
| 25 | |
| 26 | static const gicv2_driver_data_t platform_gic_data = { |
| 27 | .gicd_base = STM32MP1_GICD_BASE, |
| 28 | .gicc_base = STM32MP1_GICC_BASE, |
| 29 | .interrupt_props = stm32mp1_interrupt_props, |
| 30 | .interrupt_props_num = ARRAY_SIZE(stm32mp1_interrupt_props), |
| 31 | .target_masks = target_mask_array, |
| 32 | .target_masks_num = ARRAY_SIZE(target_mask_array), |
| 33 | }; |
| 34 | |
| 35 | void stm32mp1_gic_init(void) |
| 36 | { |
| 37 | gicv2_driver_init(&platform_gic_data); |
| 38 | gicv2_distif_init(); |
| 39 | |
| 40 | stm32mp1_gic_pcpu_init(); |
| 41 | } |
| 42 | |
| 43 | void stm32mp1_gic_pcpu_init(void) |
| 44 | { |
| 45 | gicv2_pcpu_distif_init(); |
| 46 | gicv2_set_pe_target_mask(plat_my_core_pos()); |
| 47 | gicv2_cpuif_enable(); |
| 48 | } |