mcsi.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (c) 2019, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef MCSI_H
  7. #define MCSI_H
  8. #define SLAVE_IFACE7_OFFSET 0x1700
  9. #define SLAVE_IFACE6_OFFSET 0x1600
  10. #define SLAVE_IFACE5_OFFSET 0x1500
  11. #define SLAVE_IFACE4_OFFSET 0x1400
  12. #define SLAVE_IFACE3_OFFSET 0x1300
  13. #define SLAVE_IFACE2_OFFSET 0x1200
  14. #define SLAVE_IFACE1_OFFSET 0x1100
  15. #define SLAVE_IFACE0_OFFSET 0x1000
  16. #define SLAVE_IFACE_OFFSET(index) (SLAVE_IFACE0_OFFSET + \
  17. (0x100 * (index)))
  18. /* Control and ID register offsets */
  19. #define CENTRAL_CTRL_REG 0x0
  20. #define ERR_FLAG_REG 0x4
  21. #define SF_INIT_REG 0x10
  22. #define SF_CTRL_REG 0x14
  23. #define DCM_CTRL_REG 0x18
  24. #define ERR_FLAG2_REG 0x20
  25. #define SNP_PENDING_REG 0x28
  26. #define ACP_PENDING_REG 0x2c
  27. #define FLUSH_SF 0x500
  28. #define SYS_CCE_CTRL 0x2000
  29. #define MST1_CTRL 0x2100
  30. #define MTS2_CTRL 0x2200
  31. #define XBAR_ARAW_ARB 0x3000
  32. #define XBAR_R_ARB 0x3004
  33. /* Slave interface register offsets */
  34. #define SNOOP_CTRL_REG 0x0
  35. #define QOS_CTRL_REG 0x4
  36. #define QOS_OVERRIDE_REG 0x8
  37. #define QOS_TARGET_REG 0xc
  38. #define BD_CTRL_REG 0x40
  39. /* Snoop Control register bit definitions */
  40. #define DVM_SUPPORT (1U << 31)
  41. #define SNP_SUPPORT (1 << 30)
  42. #define SHAREABLE_OVWRT (1 << 2)
  43. #define DVM_EN_BIT (1 << 1)
  44. #define SNOOP_EN_BIT (1 << 0)
  45. #define SF2_INIT_DONE (1 << 17)
  46. #define SF1_INIT_DONE (1 << 16)
  47. #define TRIG_SF2_INIT (1 << 1)
  48. #define TRIG_SF1_INIT (1 << 0)
  49. /* Status register bit definitions */
  50. #define SNP_PENDING 31
  51. /* Status bit */
  52. #define NS_ACC 1
  53. #define S_ACC 0
  54. /* Central control register bit definitions */
  55. #define PMU_SECURE_ACC_EN (1 << 4)
  56. #define INT_EN (1 << 3)
  57. #define SECURE_ACC_EN (1 << 2)
  58. #define DVM_DIS (1 << 1)
  59. #define SNOOP_DIS (1 << 0)
  60. #define MSCI_MEMORY_SZ (0x10000)
  61. #define MCSI_REG_ACCESS_READ (0x0)
  62. #define MCSI_REG_ACCESS_WRITE (0x1)
  63. #define MCSI_REG_ACCESS_SET_BITMASK (0x2)
  64. #define MCSI_REG_ACCESS_CLEAR_BITMASK (0x3)
  65. #define NR_MAX_SLV (7)
  66. /* ICCS */
  67. #define CACHE_INSTR_EN (1 << 2)
  68. #define IDLE_CACHE (1 << 3)
  69. #define USE_SHARED_CACHE (1 << 4)
  70. #define CACHE_SHARED_PRE_EN (1 << 5)
  71. #define CACHE_SHARED_POST_EN (1 << 6)
  72. #define ACP_PENDING_MASK (0x1007f)
  73. #define CCI_CLK_CTRL (MCUCFG_BASE + 0x660)
  74. #ifndef __ASSEMBLER__
  75. #include <plat/common/common_def.h>
  76. #include <stdint.h>
  77. /* Function declarations */
  78. /*
  79. * The MCSI driver must be initialized with the base address of the
  80. * MCSI device in the platform memory map, and the cluster indices for
  81. * the MCSI slave interfaces 3 and 4 respectively. These are the fully
  82. * coherent ACE slave interfaces of MCSI.
  83. * The cluster indices must either be 0 or 1, corresponding to the level 1
  84. * affinity instance of the mpidr representing the cluster. A negative cluster
  85. * index indicates that no cluster is present on that slave interface.
  86. */
  87. void mcsi_init(unsigned long cci_base,
  88. unsigned int num_cci_masters);
  89. void mcsi_cache_flush(void);
  90. void cci_enable_cluster_coherency(unsigned long mpidr);
  91. void cci_disable_cluster_coherency(unsigned long mpidr);
  92. void cci_secure_switch(unsigned int ns);
  93. void cci_init_sf(void);
  94. unsigned long cci_reg_access(unsigned int op, unsigned long offset, unsigned long val);
  95. #endif /* __ASSEMBLER__ */
  96. #endif /* MCSI_H */