pte-44x.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #ifndef _ASM_POWERPC_PTE_44x_H
  2. #define _ASM_POWERPC_PTE_44x_H
  3. #ifdef __KERNEL__
  4. /*
  5. * Definitions for PPC440
  6. *
  7. * Because of the 3 word TLB entries to support 36-bit addressing,
  8. * the attribute are difficult to map in such a fashion that they
  9. * are easily loaded during exception processing. I decided to
  10. * organize the entry so the ERPN is the only portion in the
  11. * upper word of the PTE and the attribute bits below are packed
  12. * in as sensibly as they can be in the area below a 4KB page size
  13. * oriented RPN. This at least makes it easy to load the RPN and
  14. * ERPN fields in the TLB. -Matt
  15. *
  16. * This isn't entirely true anymore, at least some bits are now
  17. * easier to move into the TLB from the PTE. -BenH.
  18. *
  19. * Note that these bits preclude future use of a page size
  20. * less than 4KB.
  21. *
  22. *
  23. * PPC 440 core has following TLB attribute fields;
  24. *
  25. * TLB1:
  26. * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  27. * RPN................................. - - - - - - ERPN.......
  28. *
  29. * TLB2:
  30. * 0 1 2 3 4 ... 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  31. * - - - - - - U0 U1 U2 U3 W I M G E - UX UW UR SX SW SR
  32. *
  33. * Newer 440 cores (440x6 as used on AMCC 460EX/460GT) have additional
  34. * TLB2 storage attibute fields. Those are:
  35. *
  36. * TLB2:
  37. * 0...10 11 12 13 14 15 16...31
  38. * no change WL1 IL1I IL1D IL2I IL2D no change
  39. *
  40. * There are some constrains and options, to decide mapping software bits
  41. * into TLB entry.
  42. *
  43. * - PRESENT *must* be in the bottom three bits because swap cache
  44. * entries use the top 29 bits for TLB2.
  45. *
  46. * - FILE *must* be in the bottom three bits because swap cache
  47. * entries use the top 29 bits for TLB2.
  48. *
  49. * - CACHE COHERENT bit (M) has no effect on original PPC440 cores,
  50. * because it doesn't support SMP. However, some later 460 variants
  51. * have -some- form of SMP support and so I keep the bit there for
  52. * future use
  53. *
  54. * With the PPC 44x Linux implementation, the 0-11th LSBs of the PTE are used
  55. * for memory protection related functions (see PTE structure in
  56. * include/asm-ppc/mmu.h). The _PAGE_XXX definitions in this file map to the
  57. * above bits. Note that the bit values are CPU specific, not architecture
  58. * specific.
  59. *
  60. * The kernel PTE entry holds an arch-dependent swp_entry structure under
  61. * certain situations. In other words, in such situations some portion of
  62. * the PTE bits are used as a swp_entry. In the PPC implementation, the
  63. * 3-24th LSB are shared with swp_entry, however the 0-2nd three LSB still
  64. * hold protection values. That means the three protection bits are
  65. * reserved for both PTE and SWAP entry at the most significant three
  66. * LSBs.
  67. *
  68. * There are three protection bits available for SWAP entry:
  69. * _PAGE_PRESENT
  70. * _PAGE_FILE
  71. * _PAGE_HASHPTE (if HW has)
  72. *
  73. * So those three bits have to be inside of 0-2nd LSB of PTE.
  74. *
  75. */
  76. #define _PAGE_PRESENT 0x00000001 /* S: PTE valid */
  77. #define _PAGE_RW 0x00000002 /* S: Write permission */
  78. #define _PAGE_FILE 0x00000004 /* S: nonlinear file mapping */
  79. #define _PAGE_EXEC 0x00000004 /* H: Execute permission */
  80. #define _PAGE_ACCESSED 0x00000008 /* S: Page referenced */
  81. #define _PAGE_DIRTY 0x00000010 /* S: Page dirty */
  82. #define _PAGE_SPECIAL 0x00000020 /* S: Special page */
  83. #define _PAGE_USER 0x00000040 /* S: User page */
  84. #define _PAGE_ENDIAN 0x00000080 /* H: E bit */
  85. #define _PAGE_GUARDED 0x00000100 /* H: G bit */
  86. #define _PAGE_COHERENT 0x00000200 /* H: M bit */
  87. #define _PAGE_NO_CACHE 0x00000400 /* H: I bit */
  88. #define _PAGE_WRITETHRU 0x00000800 /* H: W bit */
  89. /* TODO: Add large page lowmem mapping support */
  90. #define _PMD_PRESENT 0
  91. #define _PMD_PRESENT_MASK (PAGE_MASK)
  92. #define _PMD_BAD (~PAGE_MASK)
  93. /* ERPN in a PTE never gets cleared, ignore it */
  94. #define _PTE_NONE_MASK 0xffffffff00000000ULL
  95. #endif /* __KERNEL__ */
  96. #endif /* _ASM_POWERPC_PTE_44x_H */