mmu-8xx.h 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #ifndef _ASM_POWERPC_MMU_8XX_H_
  2. #define _ASM_POWERPC_MMU_8XX_H_
  3. /*
  4. * PPC8xx support
  5. */
  6. /* Control/status registers for the MPC8xx.
  7. * A write operation to these registers causes serialized access.
  8. * During software tablewalk, the registers used perform mask/shift-add
  9. * operations when written/read. A TLB entry is created when the Mx_RPN
  10. * is written, and the contents of several registers are used to
  11. * create the entry.
  12. */
  13. #define SPRN_MI_CTR 784 /* Instruction TLB control register */
  14. #define MI_GPM 0x80000000 /* Set domain manager mode */
  15. #define MI_PPM 0x40000000 /* Set subpage protection */
  16. #define MI_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
  17. #define MI_RSV4I 0x08000000 /* Reserve 4 TLB entries */
  18. #define MI_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
  19. #define MI_IDXMASK 0x00001f00 /* TLB index to be loaded */
  20. #define MI_RESETVAL 0x00000000 /* Value of register at reset */
  21. /* These are the Ks and Kp from the PowerPC books. For proper operation,
  22. * Ks = 0, Kp = 1.
  23. */
  24. #define SPRN_MI_AP 786
  25. #define MI_Ks 0x80000000 /* Should not be set */
  26. #define MI_Kp 0x40000000 /* Should always be set */
  27. /*
  28. * All pages' PP exec bits are set to 000, which means Execute for Supervisor
  29. * and no Execute for User.
  30. * Then we use the APG to say whether accesses are according to Page rules,
  31. * "all Supervisor" rules (Exec for all) and "all User" rules (Exec for noone)
  32. * Therefore, we define 4 APG groups. msb is _PAGE_EXEC, lsb is _PAGE_USER
  33. * 0 (00) => Not User, no exec => 11 (all accesses performed as user)
  34. * 1 (01) => User but no exec => 11 (all accesses performed as user)
  35. * 2 (10) => Not User, exec => 01 (rights according to page definition)
  36. * 3 (11) => User, exec => 00 (all accesses performed as supervisor)
  37. */
  38. #define MI_APG_INIT 0xf4ffffff
  39. /* The effective page number register. When read, contains the information
  40. * about the last instruction TLB miss. When MI_RPN is written, bits in
  41. * this register are used to create the TLB entry.
  42. */
  43. #define SPRN_MI_EPN 787
  44. #define MI_EPNMASK 0xfffff000 /* Effective page number for entry */
  45. #define MI_EVALID 0x00000200 /* Entry is valid */
  46. #define MI_ASIDMASK 0x0000000f /* ASID match value */
  47. /* Reset value is undefined */
  48. /* A "level 1" or "segment" or whatever you want to call it register.
  49. * For the instruction TLB, it contains bits that get loaded into the
  50. * TLB entry when the MI_RPN is written.
  51. */
  52. #define SPRN_MI_TWC 789
  53. #define MI_APG 0x000001e0 /* Access protection group (0) */
  54. #define MI_GUARDED 0x00000010 /* Guarded storage */
  55. #define MI_PSMASK 0x0000000c /* Mask of page size bits */
  56. #define MI_PS8MEG 0x0000000c /* 8M page size */
  57. #define MI_PS512K 0x00000004 /* 512K page size */
  58. #define MI_PS4K_16K 0x00000000 /* 4K or 16K page size */
  59. #define MI_SVALID 0x00000001 /* Segment entry is valid */
  60. /* Reset value is undefined */
  61. /* Real page number. Defined by the pte. Writing this register
  62. * causes a TLB entry to be created for the instruction TLB, using
  63. * additional information from the MI_EPN, and MI_TWC registers.
  64. */
  65. #define SPRN_MI_RPN 790
  66. #define MI_SPS16K 0x00000008 /* Small page size (0 = 4k, 1 = 16k) */
  67. /* Define an RPN value for mapping kernel memory to large virtual
  68. * pages for boot initialization. This has real page number of 0,
  69. * large page size, shared page, cache enabled, and valid.
  70. * Also mark all subpages valid and write access.
  71. */
  72. #define MI_BOOTINIT 0x000001fd
  73. #define SPRN_MD_CTR 792 /* Data TLB control register */
  74. #define MD_GPM 0x80000000 /* Set domain manager mode */
  75. #define MD_PPM 0x40000000 /* Set subpage protection */
  76. #define MD_CIDEF 0x20000000 /* Set cache inhibit when MMU dis */
  77. #define MD_WTDEF 0x10000000 /* Set writethrough when MMU dis */
  78. #define MD_RSV4I 0x08000000 /* Reserve 4 TLB entries */
  79. #define MD_TWAM 0x04000000 /* Use 4K page hardware assist */
  80. #define MD_PPCS 0x02000000 /* Use MI_RPN prob/priv state */
  81. #define MD_IDXMASK 0x00001f00 /* TLB index to be loaded */
  82. #define MD_RESETVAL 0x04000000 /* Value of register at reset */
  83. #define SPRN_M_CASID 793 /* Address space ID (context) to match */
  84. #define MC_ASIDMASK 0x0000000f /* Bits used for ASID value */
  85. /* These are the Ks and Kp from the PowerPC books. For proper operation,
  86. * Ks = 0, Kp = 1.
  87. */
  88. #define SPRN_MD_AP 794
  89. #define MD_Ks 0x80000000 /* Should not be set */
  90. #define MD_Kp 0x40000000 /* Should always be set */
  91. /*
  92. * All pages' PP data bits are set to either 000 or 011, which means
  93. * respectively RW for Supervisor and no access for User, or RO for
  94. * Supervisor and no access for user.
  95. * Then we use the APG to say whether accesses are according to Page rules or
  96. * "all Supervisor" rules (Access to all)
  97. * Therefore, we define 2 APG groups. lsb is _PAGE_USER
  98. * 0 => No user => 01 (all accesses performed according to page definition)
  99. * 1 => User => 00 (all accesses performed as supervisor
  100. * according to page definition)
  101. */
  102. #define MD_APG_INIT 0x4fffffff
  103. /* The effective page number register. When read, contains the information
  104. * about the last instruction TLB miss. When MD_RPN is written, bits in
  105. * this register are used to create the TLB entry.
  106. */
  107. #define SPRN_MD_EPN 795
  108. #define MD_EPNMASK 0xfffff000 /* Effective page number for entry */
  109. #define MD_EVALID 0x00000200 /* Entry is valid */
  110. #define MD_ASIDMASK 0x0000000f /* ASID match value */
  111. /* Reset value is undefined */
  112. /* The pointer to the base address of the first level page table.
  113. * During a software tablewalk, reading this register provides the address
  114. * of the entry associated with MD_EPN.
  115. */
  116. #define SPRN_M_TWB 796
  117. #define M_L1TB 0xfffff000 /* Level 1 table base address */
  118. #define M_L1INDX 0x00000ffc /* Level 1 index, when read */
  119. /* Reset value is undefined */
  120. /* A "level 1" or "segment" or whatever you want to call it register.
  121. * For the data TLB, it contains bits that get loaded into the TLB entry
  122. * when the MD_RPN is written. It is also provides the hardware assist
  123. * for finding the PTE address during software tablewalk.
  124. */
  125. #define SPRN_MD_TWC 797
  126. #define MD_L2TB 0xfffff000 /* Level 2 table base address */
  127. #define MD_L2INDX 0xfffffe00 /* Level 2 index (*pte), when read */
  128. #define MD_APG 0x000001e0 /* Access protection group (0) */
  129. #define MD_GUARDED 0x00000010 /* Guarded storage */
  130. #define MD_PSMASK 0x0000000c /* Mask of page size bits */
  131. #define MD_PS8MEG 0x0000000c /* 8M page size */
  132. #define MD_PS512K 0x00000004 /* 512K page size */
  133. #define MD_PS4K_16K 0x00000000 /* 4K or 16K page size */
  134. #define MD_WT 0x00000002 /* Use writethrough page attribute */
  135. #define MD_SVALID 0x00000001 /* Segment entry is valid */
  136. /* Reset value is undefined */
  137. /* Real page number. Defined by the pte. Writing this register
  138. * causes a TLB entry to be created for the data TLB, using
  139. * additional information from the MD_EPN, and MD_TWC registers.
  140. */
  141. #define SPRN_MD_RPN 798
  142. #define MD_SPS16K 0x00000008 /* Small page size (0 = 4k, 1 = 16k) */
  143. /* This is a temporary storage register that could be used to save
  144. * a processor working register during a tablewalk.
  145. */
  146. #define SPRN_M_TW 799
  147. #ifndef __ASSEMBLY__
  148. typedef struct {
  149. unsigned int id;
  150. unsigned int active;
  151. unsigned long vdso_base;
  152. } mm_context_t;
  153. #endif /* !__ASSEMBLY__ */
  154. #if (PAGE_SHIFT == 12)
  155. #define mmu_virtual_psize MMU_PAGE_4K
  156. #elif (PAGE_SHIFT == 14)
  157. #define mmu_virtual_psize MMU_PAGE_16K
  158. #else
  159. #error "Unsupported PAGE_SIZE"
  160. #endif
  161. #define mmu_linear_psize MMU_PAGE_8M
  162. #endif /* _ASM_POWERPC_MMU_8XX_H_ */