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