spr-defs.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. /* Special Purpose Registers definitions
  2. Copyright (C) 2017-2022 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #ifndef SPR_DEFS_H
  14. #define SPR_DEFS_H
  15. #define MAX_GRPS 32
  16. #define MAX_SPRS_PER_GRP_BITS 11
  17. /* Base addresses for the groups */
  18. #define SPRGROUP_SYS (0<< MAX_SPRS_PER_GRP_BITS)
  19. #define SPRGROUP_DMMU (1<< MAX_SPRS_PER_GRP_BITS)
  20. #define SPRGROUP_IMMU (2<< MAX_SPRS_PER_GRP_BITS)
  21. #define SPRGROUP_DC (3<< MAX_SPRS_PER_GRP_BITS)
  22. #define SPRGROUP_IC (4<< MAX_SPRS_PER_GRP_BITS)
  23. #define SPRGROUP_MAC (5<< MAX_SPRS_PER_GRP_BITS)
  24. #define SPRGROUP_D (6<< MAX_SPRS_PER_GRP_BITS)
  25. #define SPRGROUP_PC (7<< MAX_SPRS_PER_GRP_BITS)
  26. #define SPRGROUP_PM (8<< MAX_SPRS_PER_GRP_BITS)
  27. #define SPRGROUP_PIC (9<< MAX_SPRS_PER_GRP_BITS)
  28. #define SPRGROUP_TT (10<< MAX_SPRS_PER_GRP_BITS)
  29. #define SPRGROUP_FP (11<< MAX_SPRS_PER_GRP_BITS)
  30. /* System control and status group */
  31. #define SPR_VR (SPRGROUP_SYS + 0)
  32. #define SPR_UPR (SPRGROUP_SYS + 1)
  33. #define SPR_CPUCFGR (SPRGROUP_SYS + 2)
  34. #define SPR_DMMUCFGR (SPRGROUP_SYS + 3)
  35. #define SPR_IMMUCFGR (SPRGROUP_SYS + 4)
  36. #define SPR_DCCFGR (SPRGROUP_SYS + 5)
  37. #define SPR_ICCFGR (SPRGROUP_SYS + 6)
  38. #define SPR_DCFGR (SPRGROUP_SYS + 7)
  39. #define SPR_PCCFGR (SPRGROUP_SYS + 8)
  40. #define SPR_NPC (SPRGROUP_SYS + 16)
  41. #define SPR_SR (SPRGROUP_SYS + 17)
  42. #define SPR_PPC (SPRGROUP_SYS + 18)
  43. #define SPR_FPCSR (SPRGROUP_SYS + 20)
  44. #define SPR_EPCR_BASE (SPRGROUP_SYS + 32)
  45. #define SPR_EPCR_LAST (SPRGROUP_SYS + 47)
  46. #define SPR_EEAR_BASE (SPRGROUP_SYS + 48)
  47. #define SPR_EEAR_LAST (SPRGROUP_SYS + 63)
  48. #define SPR_ESR_BASE (SPRGROUP_SYS + 64)
  49. #define SPR_ESR_LAST (SPRGROUP_SYS + 79)
  50. #define SPR_GPR_BASE (SPRGROUP_SYS + 1024)
  51. /* Data MMU group */
  52. #define SPR_DMMUCR (SPRGROUP_DMMU + 0)
  53. #define SPR_DMMUPR (SPRGROUP_DMMU + 1)
  54. #define SPR_DTLBEIR (SPRGROUP_DMMU + 2)
  55. #define SPR_DTLBMR_BASE(WAY) (SPRGROUP_DMMU + 0x200 + (WAY) * 0x100)
  56. #define SPR_DTLBMR_LAST(WAY) (SPRGROUP_DMMU + 0x27f + (WAY) * 0x100)
  57. #define SPR_DTLBTR_BASE(WAY) (SPRGROUP_DMMU + 0x280 + (WAY) * 0x100)
  58. #define SPR_DTLBTR_LAST(WAY) (SPRGROUP_DMMU + 0x2ff + (WAY) * 0x100)
  59. /* Instruction MMU group */
  60. #define SPR_IMMUCR (SPRGROUP_IMMU + 0)
  61. #define SPR_ITLBEIR (SPRGROUP_IMMU + 2)
  62. #define SPR_ITLBMR_BASE(WAY) (SPRGROUP_IMMU + 0x200 + (WAY) * 0x100)
  63. #define SPR_ITLBMR_LAST(WAY) (SPRGROUP_IMMU + 0x27f + (WAY) * 0x100)
  64. #define SPR_ITLBTR_BASE(WAY) (SPRGROUP_IMMU + 0x280 + (WAY) * 0x100)
  65. #define SPR_ITLBTR_LAST(WAY) (SPRGROUP_IMMU + 0x2ff + (WAY) * 0x100)
  66. /* Data cache group */
  67. #define SPR_DCCR (SPRGROUP_DC + 0)
  68. #define SPR_DCBPR (SPRGROUP_DC + 1)
  69. #define SPR_DCBFR (SPRGROUP_DC + 2)
  70. #define SPR_DCBIR (SPRGROUP_DC + 3)
  71. #define SPR_DCBWR (SPRGROUP_DC + 4)
  72. #define SPR_DCBLR (SPRGROUP_DC + 5)
  73. #define SPR_DCR_BASE(WAY) (SPRGROUP_DC + 0x200 + (WAY) * 0x200)
  74. #define SPR_DCR_LAST(WAY) (SPRGROUP_DC + 0x3ff + (WAY) * 0x200)
  75. /* Instruction cache group */
  76. #define SPR_ICCR (SPRGROUP_IC + 0)
  77. #define SPR_ICBPR (SPRGROUP_IC + 1)
  78. #define SPR_ICBIR (SPRGROUP_IC + 2)
  79. #define SPR_ICBLR (SPRGROUP_IC + 3)
  80. #define SPR_ICR_BASE(WAY) (SPRGROUP_IC + 0x200 + (WAY) * 0x200)
  81. #define SPR_ICR_LAST(WAY) (SPRGROUP_IC + 0x3ff + (WAY) * 0x200)
  82. /* MAC group */
  83. #define SPR_MACLO (SPRGROUP_MAC + 1)
  84. #define SPR_MACHI (SPRGROUP_MAC + 2)
  85. /* Bit definitions for the Supervision Register. */
  86. #define SPR_SR_SM 0x00000001 /* Supervisor Mode */
  87. #define SPR_SR_TEE 0x00000002 /* Tick timer Exception Enable */
  88. #define SPR_SR_IEE 0x00000004 /* Interrupt Exception Enable */
  89. #define SPR_SR_DCE 0x00000008 /* Data Cache Enable */
  90. #define SPR_SR_ICE 0x00000010 /* Instruction Cache Enable */
  91. #define SPR_SR_DME 0x00000020 /* Data MMU Enable */
  92. #define SPR_SR_IME 0x00000040 /* Instruction MMU Enable */
  93. #define SPR_SR_LEE 0x00000080 /* Little Endian Enable */
  94. #define SPR_SR_CE 0x00000100 /* CID Enable */
  95. #define SPR_SR_F 0x00000200 /* Condition Flag */
  96. #define SPR_SR_CY 0x00000400 /* Carry flag */
  97. #define SPR_SR_OV 0x00000800 /* Overflow flag */
  98. #define SPR_SR_OVE 0x00001000 /* Overflow flag Exception */
  99. #define SPR_SR_DSX 0x00002000 /* Delay Slot Exception */
  100. #define SPR_SR_EPH 0x00004000 /* Exception Prefix High */
  101. #define SPR_SR_FO 0x00008000 /* Fixed one */
  102. #define SPR_SR_SUMRA 0x00010000 /* Supervisor SPR read access */
  103. #define SPR_SR_RES 0x0ffe0000 /* Reserved */
  104. #define SPR_SR_CID 0xf0000000 /* Context ID */
  105. #endif /* SPR_DEFS_H */