gic_common_private.h 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef GIC_COMMON_PRIVATE_H
  7. #define GIC_COMMON_PRIVATE_H
  8. #include <stdint.h>
  9. #include <drivers/arm/gic_common.h>
  10. #include <lib/mmio.h>
  11. /*******************************************************************************
  12. * GIC Distributor interface register accessors that are common to GICv3 & GICv2
  13. ******************************************************************************/
  14. static inline unsigned int gicd_read_ctlr(uintptr_t base)
  15. {
  16. return mmio_read_32(base + GICD_CTLR);
  17. }
  18. static inline unsigned int gicd_read_typer(uintptr_t base)
  19. {
  20. return mmio_read_32(base + GICD_TYPER);
  21. }
  22. static inline unsigned int gicd_read_iidr(uintptr_t base)
  23. {
  24. return mmio_read_32(base + GICD_IIDR);
  25. }
  26. static inline void gicd_write_ctlr(uintptr_t base, unsigned int val)
  27. {
  28. mmio_write_32(base + GICD_CTLR, val);
  29. }
  30. /*******************************************************************************
  31. * GIC Distributor function prototypes for accessing entire registers.
  32. * Note: The raw register values correspond to multiple interrupt IDs and
  33. * the number of interrupt IDs involved depends on the register accessed.
  34. ******************************************************************************/
  35. unsigned int gicd_read_igroupr(uintptr_t base, unsigned int id);
  36. unsigned int gicd_read_isenabler(uintptr_t base, unsigned int id);
  37. unsigned int gicd_read_icenabler(uintptr_t base, unsigned int id);
  38. unsigned int gicd_read_ispendr(uintptr_t base, unsigned int id);
  39. unsigned int gicd_read_icpendr(uintptr_t base, unsigned int id);
  40. unsigned int gicd_read_isactiver(uintptr_t base, unsigned int id);
  41. unsigned int gicd_read_icactiver(uintptr_t base, unsigned int id);
  42. unsigned int gicd_read_ipriorityr(uintptr_t base, unsigned int id);
  43. unsigned int gicd_read_icfgr(uintptr_t base, unsigned int id);
  44. unsigned int gicd_read_nsacr(uintptr_t base, unsigned int id);
  45. unsigned int gicd_read_spendsgir(uintptr_t base, unsigned int id);
  46. unsigned int gicd_read_cpendsgir(uintptr_t base, unsigned int id);
  47. unsigned int gicd_read_itargetsr(uintptr_t base, unsigned int id);
  48. void gicd_write_igroupr(uintptr_t base, unsigned int id, unsigned int val);
  49. void gicd_write_isenabler(uintptr_t base, unsigned int id, unsigned int val);
  50. void gicd_write_icenabler(uintptr_t base, unsigned int id, unsigned int val);
  51. void gicd_write_ispendr(uintptr_t base, unsigned int id, unsigned int val);
  52. void gicd_write_icpendr(uintptr_t base, unsigned int id, unsigned int val);
  53. void gicd_write_isactiver(uintptr_t base, unsigned int id, unsigned int val);
  54. void gicd_write_icactiver(uintptr_t base, unsigned int id, unsigned int val);
  55. void gicd_write_ipriorityr(uintptr_t base, unsigned int id, unsigned int val);
  56. void gicd_write_icfgr(uintptr_t base, unsigned int id, unsigned int val);
  57. void gicd_write_nsacr(uintptr_t base, unsigned int id, unsigned int val);
  58. void gicd_write_spendsgir(uintptr_t base, unsigned int id, unsigned int val);
  59. void gicd_write_cpendsgir(uintptr_t base, unsigned int id, unsigned int val);
  60. void gicd_write_itargetsr(uintptr_t base, unsigned int id, unsigned int val);
  61. /*******************************************************************************
  62. * GIC Distributor function prototypes for accessing the GIC registers
  63. * corresponding to a single interrupt ID. These functions use bitwise
  64. * operations or appropriate register accesses to modify or return
  65. * the bit-field corresponding the single interrupt ID.
  66. ******************************************************************************/
  67. unsigned int gicd_get_igroupr(uintptr_t base, unsigned int id);
  68. void gicd_set_igroupr(uintptr_t base, unsigned int id);
  69. void gicd_clr_igroupr(uintptr_t base, unsigned int id);
  70. void gicd_set_isenabler(uintptr_t base, unsigned int id);
  71. void gicd_set_icenabler(uintptr_t base, unsigned int id);
  72. void gicd_set_ispendr(uintptr_t base, unsigned int id);
  73. void gicd_set_icpendr(uintptr_t base, unsigned int id);
  74. unsigned int gicd_get_isactiver(uintptr_t base, unsigned int id);
  75. void gicd_set_isactiver(uintptr_t base, unsigned int id);
  76. void gicd_set_icactiver(uintptr_t base, unsigned int id);
  77. void gicd_set_ipriorityr(uintptr_t base, unsigned int id, unsigned int pri);
  78. void gicd_set_icfgr(uintptr_t base, unsigned int id, unsigned int cfg);
  79. #endif /* GIC_COMMON_PRIVATE_H */