poplar_gicv2.c 2.0 KB

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