qemu_gicv2.c 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <drivers/arm/gicv2.h>
  7. #include <drivers/arm/gic_common.h>
  8. #include <platform_def.h>
  9. static const interrupt_prop_t qemu_interrupt_props[] = {
  10. PLATFORM_G1S_PROPS(GICV2_INTR_GROUP0),
  11. PLATFORM_G0_PROPS(GICV2_INTR_GROUP0)
  12. };
  13. static const struct gicv2_driver_data plat_gicv2_driver_data = {
  14. .gicd_base = GICD_BASE,
  15. .gicc_base = GICC_BASE,
  16. .interrupt_props = qemu_interrupt_props,
  17. .interrupt_props_num = ARRAY_SIZE(qemu_interrupt_props),
  18. };
  19. void plat_qemu_gic_init(void)
  20. {
  21. /* Initialize the gic cpu and distributor interfaces */
  22. gicv2_driver_init(&plat_gicv2_driver_data);
  23. gicv2_distif_init();
  24. gicv2_pcpu_distif_init();
  25. gicv2_cpuif_enable();
  26. }
  27. void qemu_pwr_gic_on_finish(void)
  28. {
  29. /* TODO: This setup is needed only after a cold boot */
  30. gicv2_pcpu_distif_init();
  31. /* Enable the gic cpu interface */
  32. gicv2_cpuif_enable();
  33. }
  34. void qemu_pwr_gic_off(void)
  35. {
  36. gicv2_cpuif_disable();
  37. }