qemu_gicv3.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (c) 2019, Linaro Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <drivers/arm/gicv3.h>
  7. #include <drivers/arm/gic_common.h>
  8. #include <platform_def.h>
  9. #include <plat/common/platform.h>
  10. static const interrupt_prop_t qemu_interrupt_props[] = {
  11. PLATFORM_G1S_PROPS(INTR_GROUP1S),
  12. PLATFORM_G0_PROPS(INTR_GROUP0)
  13. };
  14. static uintptr_t qemu_rdistif_base_addrs[PLATFORM_CORE_COUNT];
  15. static unsigned int qemu_mpidr_to_core_pos(unsigned long mpidr)
  16. {
  17. return (unsigned int)plat_core_pos_by_mpidr(mpidr);
  18. }
  19. static const gicv3_driver_data_t qemu_gicv3_driver_data = {
  20. .gicd_base = GICD_BASE,
  21. .gicr_base = GICR_BASE,
  22. .interrupt_props = qemu_interrupt_props,
  23. .interrupt_props_num = ARRAY_SIZE(qemu_interrupt_props),
  24. .rdistif_num = PLATFORM_CORE_COUNT,
  25. .rdistif_base_addrs = qemu_rdistif_base_addrs,
  26. .mpidr_to_core_pos = qemu_mpidr_to_core_pos
  27. };
  28. void plat_qemu_gic_init(void)
  29. {
  30. gicv3_driver_init(&qemu_gicv3_driver_data);
  31. gicv3_distif_init();
  32. gicv3_rdistif_init(plat_my_core_pos());
  33. gicv3_cpuif_enable(plat_my_core_pos());
  34. }
  35. void qemu_pwr_gic_on_finish(void)
  36. {
  37. gicv3_rdistif_init(plat_my_core_pos());
  38. gicv3_cpuif_enable(plat_my_core_pos());
  39. }
  40. void qemu_pwr_gic_off(void)
  41. {
  42. gicv3_cpuif_disable(plat_my_core_pos());
  43. gicv3_rdistif_off(plat_my_core_pos());
  44. }