mmu-hash32.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef _ASM_POWERPC_MMU_HASH32_H_
  2. #define _ASM_POWERPC_MMU_HASH32_H_
  3. /*
  4. * 32-bit hash table MMU support
  5. */
  6. /*
  7. * BATs
  8. */
  9. /* Block size masks */
  10. #define BL_128K 0x000
  11. #define BL_256K 0x001
  12. #define BL_512K 0x003
  13. #define BL_1M 0x007
  14. #define BL_2M 0x00F
  15. #define BL_4M 0x01F
  16. #define BL_8M 0x03F
  17. #define BL_16M 0x07F
  18. #define BL_32M 0x0FF
  19. #define BL_64M 0x1FF
  20. #define BL_128M 0x3FF
  21. #define BL_256M 0x7FF
  22. /* BAT Access Protection */
  23. #define BPP_XX 0x00 /* No access */
  24. #define BPP_RX 0x01 /* Read only */
  25. #define BPP_RW 0x02 /* Read/write */
  26. #ifndef __ASSEMBLY__
  27. /* Contort a phys_addr_t into the right format/bits for a BAT */
  28. #ifdef CONFIG_PHYS_64BIT
  29. #define BAT_PHYS_ADDR(x) ((u32)((x & 0x00000000fffe0000ULL) | \
  30. ((x & 0x0000000e00000000ULL) >> 24) | \
  31. ((x & 0x0000000100000000ULL) >> 30)))
  32. #else
  33. #define BAT_PHYS_ADDR(x) (x)
  34. #endif
  35. struct ppc_bat {
  36. u32 batu;
  37. u32 batl;
  38. };
  39. #endif /* !__ASSEMBLY__ */
  40. /*
  41. * Hash table
  42. */
  43. /* Values for PP (assumes Ks=0, Kp=1) */
  44. #define PP_RWXX 0 /* Supervisor read/write, User none */
  45. #define PP_RWRX 1 /* Supervisor read/write, User read */
  46. #define PP_RWRW 2 /* Supervisor read/write, User read/write */
  47. #define PP_RXRX 3 /* Supervisor read, User read */
  48. #ifndef __ASSEMBLY__
  49. /*
  50. * Hardware Page Table Entry
  51. * Note that the xpn and x bitfields are used only by processors that
  52. * support extended addressing; otherwise, those bits are reserved.
  53. */
  54. struct hash_pte {
  55. unsigned long v:1; /* Entry is valid */
  56. unsigned long vsid:24; /* Virtual segment identifier */
  57. unsigned long h:1; /* Hash algorithm indicator */
  58. unsigned long api:6; /* Abbreviated page index */
  59. unsigned long rpn:20; /* Real (physical) page number */
  60. unsigned long xpn:3; /* Real page number bits 0-2, optional */
  61. unsigned long r:1; /* Referenced */
  62. unsigned long c:1; /* Changed */
  63. unsigned long w:1; /* Write-thru cache mode */
  64. unsigned long i:1; /* Cache inhibited */
  65. unsigned long m:1; /* Memory coherence */
  66. unsigned long g:1; /* Guarded */
  67. unsigned long x:1; /* Real page number bit 3, optional */
  68. unsigned long pp:2; /* Page protection */
  69. };
  70. typedef struct {
  71. unsigned long id;
  72. unsigned long vdso_base;
  73. } mm_context_t;
  74. #endif /* !__ASSEMBLY__ */
  75. /* We happily ignore the smaller BATs on 601, we don't actually use
  76. * those definitions on hash32 at the moment anyway
  77. */
  78. #define mmu_virtual_psize MMU_PAGE_4K
  79. #define mmu_linear_psize MMU_PAGE_256M
  80. #endif /* _ASM_POWERPC_MMU_HASH32_H_ */