sq_gicv3.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <assert.h>
  7. #include <platform_def.h>
  8. #include <common/interrupt_props.h>
  9. #include <drivers/arm/gicv3.h>
  10. #include <plat/common/platform.h>
  11. #include "sq_common.h"
  12. static uintptr_t sq_rdistif_base_addrs[PLATFORM_CORE_COUNT];
  13. static const interrupt_prop_t sq_interrupt_props[] = {
  14. /* G0 interrupts */
  15. /* SGI0 */
  16. INTR_PROP_DESC(8, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP0,
  17. GIC_INTR_CFG_EDGE),
  18. /* SGI6 */
  19. INTR_PROP_DESC(14, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP0,
  20. GIC_INTR_CFG_EDGE),
  21. /* G1S interrupts */
  22. /* Timer */
  23. INTR_PROP_DESC(29, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  24. GIC_INTR_CFG_LEVEL),
  25. /* SGI1 */
  26. INTR_PROP_DESC(9, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  27. GIC_INTR_CFG_EDGE),
  28. /* SGI2 */
  29. INTR_PROP_DESC(10, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  30. GIC_INTR_CFG_EDGE),
  31. /* SGI3 */
  32. INTR_PROP_DESC(11, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  33. GIC_INTR_CFG_EDGE),
  34. /* SGI4 */
  35. INTR_PROP_DESC(12, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  36. GIC_INTR_CFG_EDGE),
  37. /* SGI5 */
  38. INTR_PROP_DESC(13, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  39. GIC_INTR_CFG_EDGE),
  40. /* SGI7 */
  41. INTR_PROP_DESC(15, GIC_HIGHEST_SEC_PRIORITY, INTR_GROUP1S,
  42. GIC_INTR_CFG_EDGE)
  43. };
  44. static unsigned int sq_mpidr_to_core_pos(u_register_t mpidr)
  45. {
  46. return plat_core_pos_by_mpidr(mpidr);
  47. }
  48. static const struct gicv3_driver_data sq_gic_driver_data = {
  49. .gicd_base = PLAT_SQ_GICD_BASE,
  50. .gicr_base = PLAT_SQ_GICR_BASE,
  51. .interrupt_props = sq_interrupt_props,
  52. .interrupt_props_num = ARRAY_SIZE(sq_interrupt_props),
  53. .rdistif_num = PLATFORM_CORE_COUNT,
  54. .rdistif_base_addrs = sq_rdistif_base_addrs,
  55. .mpidr_to_core_pos = sq_mpidr_to_core_pos,
  56. };
  57. void sq_gic_driver_init(void)
  58. {
  59. gicv3_driver_init(&sq_gic_driver_data);
  60. }
  61. void sq_gic_init(void)
  62. {
  63. gicv3_distif_init();
  64. gicv3_rdistif_init(plat_my_core_pos());
  65. gicv3_cpuif_enable(plat_my_core_pos());
  66. }
  67. void sq_gic_cpuif_enable(void)
  68. {
  69. gicv3_cpuif_enable(plat_my_core_pos());
  70. }
  71. void sq_gic_cpuif_disable(void)
  72. {
  73. gicv3_cpuif_disable(plat_my_core_pos());
  74. }
  75. void sq_gic_pcpu_init(void)
  76. {
  77. gicv3_rdistif_init(plat_my_core_pos());
  78. }