MPC5646C_HWInit.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * FILE : MPC564xBC_HWInit.h
  3. * Contains the declarations for device initialization.
  4. */
  5. #ifndef _MPC564xBC_HWINIT_H_
  6. #define _MPC564xBC_HWINIT_H_
  7. /*----------------------------------------------------------------------------*/
  8. /* Includes */
  9. /*----------------------------------------------------------------------------*/
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /*******************************************************/
  14. /* MPC564xBC derivative specific hardware initialization */
  15. /*******************************************************/
  16. __asm void INIT_Derivative(void);
  17. /*----------------------------------------------------------------------------*/
  18. /* MMU Table Entries Defines */
  19. /*----------------------------------------------------------------------------*/
  20. /**
  21. * Generate MMU Assist 0 value from the parameters provided.
  22. * In accordance with the PowerPC Zen core specification the TLBSEL value
  23. * is always set to 01b to maintain future compatibility.
  24. *
  25. */
  26. #define MAS0_VALUE(eselcam) ((unsigned long)(0x10000000 | (eselcam << 16)))
  27. /**
  28. * Generate MMU Assist 1 value from the parameters provided
  29. *
  30. * parameter valid: 1 if the MMU entry is valid, otherwise \c 0 (invalid).
  31. * parameter iprot: Invalidation protection value
  32. * parameter tid: the translation ID
  33. * parameter ts: the translation space value
  34. * parameter tsize: the translation size
  35. */
  36. #define MAS1_VALUE(valid, iprot, tid, ts, tsize) \
  37. ((unsigned long)((valid << 31) | (iprot << 30) | (tid << 16) | (ts << 12) | (tsize << 7)))
  38. /** Translation address space. This bit is compared with the IS or DS fields
  39. of the MSR (depending on the type of access) to determine if this TLB
  40. entry may be used for translation.
  41. */
  42. #define TS_ON 1
  43. #define TS_OFF 0
  44. /** V TLB valid bit */
  45. #define V_INVALID 0
  46. #define V_VALID 1
  47. /** IPROT TLB Invalidate protect bit */
  48. #define IPROT_NOTPROTECTED 0
  49. #define IPROT_PROTECTED 1
  50. /** Translation ID defines the TID as global and matches all process IDs */
  51. #define TID_GLOBAL 0
  52. /** Translation size */
  53. #define TSIZE_1KB 0
  54. #define TSIZE_2KB 1
  55. #define TSIZE_4KB 2
  56. #define TSIZE_8KB 3
  57. #define TSIZE_16KB 4
  58. #define TSIZE_32KB 5
  59. #define TSIZE_64KB 6
  60. #define TSIZE_128KB 7
  61. #define TSIZE_256KB 8
  62. #define TSIZE_512KB 9
  63. #define TSIZE_1MB 10
  64. #define TSIZE_2MB 11
  65. #define TSIZE_4MB 12
  66. #define TSIZE_8MB 13
  67. #define TSIZE_16MB 14
  68. #define TSIZE_32MB 15
  69. #define TSIZE_64MB 16
  70. #define TSIZE_128MB 17
  71. #define TSIZE_256MB 18
  72. #define TSIZE_512MB 19
  73. #define TSIZE_1GB 20
  74. #define TSIZE_2GB 21
  75. #define TSIZE_4GB 22
  76. /**
  77. * Generate MMU Assist 2 value from the parameters provided
  78. *
  79. * Effective Page Number (start address of logical memory region)
  80. * must be computed directly in the assembly code.
  81. *
  82. * parameter epn: effective page number
  83. * parameter vle: VLE flag
  84. * parameter w: Write-through Required
  85. * parameter i: Cache Inhibited
  86. * parameter m: Memory Coherence Required
  87. * parameter g: Guarded
  88. * parameter e: Endianness
  89. */
  90. #define MAS2_VALUE(epn, vle, w, i, m, g, e) \
  91. ((unsigned long)((epn << 12) | (vle << 5) | (w << 4) | (i << 3) | (m << 2) | (g << 1) | (e)))
  92. /** MAS2[VLE]: Book E mode */
  93. #define BOOK_E_MODE 0
  94. /** MAS2[VLE]: VLE mode */
  95. #define VLE_MODE 1
  96. /** MAS2[W]: Update data in the cache only */
  97. #define WRITE_BACK 0
  98. /** MAS2[W]: All stores performed are written through to memory */
  99. #define WRITE_THROUGH 1
  100. /** MAS2[I]: The page is considered cacheable */
  101. #define CACHEABLE 0
  102. /** MAS2[I]: The page is cache-inhibited */
  103. #define CACHE_INHIBIT 1
  104. /** MAS2[M]: Memory Coherence is not-required */
  105. #define MEM_COHERENCE_NREQ 0
  106. /** MAS2[M]: Memory Coherence is required */
  107. #define MEM_COHENRECE_REQ 1
  108. /** MAS2[G]: Access to page is not guarded */
  109. #define NOT_GUARDED 0
  110. /** MAS2[G]: All loads and stores are performed without speculation */
  111. #define GUARDED 1
  112. /** MAS2[E]: Page is accessed in big-endian order */
  113. #define BIG_ENDIAN 0
  114. /** MAS2[E]: Page is accessed in little-endian order */
  115. #define LITTLE_ENDIAN 1
  116. /**
  117. * Generate MMU Assist 3 flags from the parameters provided
  118. *
  119. * Real Page Number (start address of physical memory region)
  120. * must be computed directly in the assembly code
  121. *
  122. * parameter rpn: real page number
  123. * parameter permissions: Permission bits
  124. */
  125. #define MAS3_VALUE(rpn, permissions) \
  126. ((unsigned long)((rpn << 12) | permissions))
  127. /** MAS3[U/S{XWR}]: Read. Write and Execute permission */
  128. #define READ_WRITE_EXECUTE 0x3f
  129. /** MAS3[U/S{XWR}]: Read and Execute permission */
  130. #define READ_EXECUTE 0x33
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134. #endif