0001
0002 #ifndef _ASM_POWERPC_MMU_44X_H_
0003 #define _ASM_POWERPC_MMU_44X_H_
0004
0005
0006
0007
0008 #include <asm/asm-const.h>
0009
0010 #define PPC44x_MMUCR_TID 0x000000ff
0011 #define PPC44x_MMUCR_STS 0x00010000
0012
0013 #define PPC44x_TLB_PAGEID 0
0014 #define PPC44x_TLB_XLAT 1
0015 #define PPC44x_TLB_ATTRIB 2
0016
0017
0018 #define PPC44x_TLB_EPN_MASK 0xfffffc00
0019 #define PPC44x_TLB_VALID 0x00000200
0020 #define PPC44x_TLB_TS 0x00000100
0021 #define PPC44x_TLB_1K 0x00000000
0022 #define PPC44x_TLB_4K 0x00000010
0023 #define PPC44x_TLB_16K 0x00000020
0024 #define PPC44x_TLB_64K 0x00000030
0025 #define PPC44x_TLB_256K 0x00000040
0026 #define PPC44x_TLB_1M 0x00000050
0027 #define PPC44x_TLB_16M 0x00000070
0028 #define PPC44x_TLB_256M 0x00000090
0029
0030
0031 #define PPC44x_TLB_RPN_MASK 0xfffffc00
0032 #define PPC44x_TLB_ERPN_MASK 0x0000000f
0033
0034
0035 #define PPC44x_TLB_ATTR_MASK 0x0000ff80
0036 #define PPC44x_TLB_U0 0x00008000
0037 #define PPC44x_TLB_U1 0x00004000
0038 #define PPC44x_TLB_U2 0x00002000
0039 #define PPC44x_TLB_U3 0x00001000
0040 #define PPC44x_TLB_W 0x00000800
0041 #define PPC44x_TLB_I 0x00000400
0042 #define PPC44x_TLB_M 0x00000200
0043 #define PPC44x_TLB_G 0x00000100
0044 #define PPC44x_TLB_E 0x00000080
0045
0046 #define PPC44x_TLB_PERM_MASK 0x0000003f
0047 #define PPC44x_TLB_UX 0x00000020
0048 #define PPC44x_TLB_UW 0x00000010
0049 #define PPC44x_TLB_UR 0x00000008
0050 #define PPC44x_TLB_SX 0x00000004
0051 #define PPC44x_TLB_SW 0x00000002
0052 #define PPC44x_TLB_SR 0x00000001
0053
0054
0055 #define PPC44x_TLB_SIZE 64
0056
0057
0058 #define PPC47x_MMUCR_TID 0x0000ffff
0059 #define PPC47x_MMUCR_STS 0x00010000
0060
0061
0062 #define PPC47x_TLB0_EPN_MASK 0xfffff000
0063 #define PPC47x_TLB0_VALID 0x00000800
0064 #define PPC47x_TLB0_TS 0x00000400
0065 #define PPC47x_TLB0_4K 0x00000000
0066 #define PPC47x_TLB0_16K 0x00000010
0067 #define PPC47x_TLB0_64K 0x00000030
0068 #define PPC47x_TLB0_1M 0x00000070
0069 #define PPC47x_TLB0_16M 0x000000f0
0070 #define PPC47x_TLB0_256M 0x000001f0
0071 #define PPC47x_TLB0_1G 0x000003f0
0072 #define PPC47x_TLB0_BOLTED_R 0x00000008
0073
0074
0075 #define PPC47x_TLB1_RPN_MASK 0xfffff000
0076 #define PPC47x_TLB1_ERPN_MASK 0x000003ff
0077
0078
0079 #define PPC47x_TLB2_ATTR_MASK 0x0003ff80
0080 #define PPC47x_TLB2_IL1I 0x00020000
0081 #define PPC47x_TLB2_IL1D 0x00010000
0082 #define PPC47x_TLB2_U0 0x00008000
0083 #define PPC47x_TLB2_U1 0x00004000
0084 #define PPC47x_TLB2_U2 0x00002000
0085 #define PPC47x_TLB2_U3 0x00001000
0086 #define PPC47x_TLB2_W 0x00000800
0087 #define PPC47x_TLB2_I 0x00000400
0088 #define PPC47x_TLB2_M 0x00000200
0089 #define PPC47x_TLB2_G 0x00000100
0090 #define PPC47x_TLB2_E 0x00000080
0091 #define PPC47x_TLB2_PERM_MASK 0x0000003f
0092 #define PPC47x_TLB2_UX 0x00000020
0093 #define PPC47x_TLB2_UW 0x00000010
0094 #define PPC47x_TLB2_UR 0x00000008
0095 #define PPC47x_TLB2_SX 0x00000004
0096 #define PPC47x_TLB2_SW 0x00000002
0097 #define PPC47x_TLB2_SR 0x00000001
0098 #define PPC47x_TLB2_U_RWX (PPC47x_TLB2_UX|PPC47x_TLB2_UW|PPC47x_TLB2_UR)
0099 #define PPC47x_TLB2_S_RWX (PPC47x_TLB2_SX|PPC47x_TLB2_SW|PPC47x_TLB2_SR)
0100 #define PPC47x_TLB2_S_RW (PPC47x_TLB2_SW | PPC47x_TLB2_SR)
0101 #define PPC47x_TLB2_IMG (PPC47x_TLB2_I | PPC47x_TLB2_M | PPC47x_TLB2_G)
0102
0103 #ifndef __ASSEMBLY__
0104
0105 extern unsigned int tlb_44x_hwater;
0106 extern unsigned int tlb_44x_index;
0107
0108 typedef struct {
0109 unsigned int id;
0110 unsigned int active;
0111 void __user *vdso;
0112 } mm_context_t;
0113
0114
0115 extern s32 patch__tlb_44x_hwater_D, patch__tlb_44x_hwater_I;
0116
0117 #endif
0118
0119 #ifndef CONFIG_PPC_EARLY_DEBUG_44x
0120 #define PPC44x_EARLY_TLBS 1
0121 #else
0122 #define PPC44x_EARLY_TLBS 2
0123 #define PPC44x_EARLY_DEBUG_VIRTADDR (ASM_CONST(0xf0000000) \
0124 | (ASM_CONST(CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW) & 0xffff))
0125 #endif
0126
0127
0128 #define PPC_PIN_SIZE (1 << 28)
0129
0130 #if defined(CONFIG_PPC_4K_PAGES)
0131 #define PPC44x_TLBE_SIZE PPC44x_TLB_4K
0132 #define PPC47x_TLBE_SIZE PPC47x_TLB0_4K
0133 #define mmu_virtual_psize MMU_PAGE_4K
0134 #elif defined(CONFIG_PPC_16K_PAGES)
0135 #define PPC44x_TLBE_SIZE PPC44x_TLB_16K
0136 #define PPC47x_TLBE_SIZE PPC47x_TLB0_16K
0137 #define mmu_virtual_psize MMU_PAGE_16K
0138 #elif defined(CONFIG_PPC_64K_PAGES)
0139 #define PPC44x_TLBE_SIZE PPC44x_TLB_64K
0140 #define PPC47x_TLBE_SIZE PPC47x_TLB0_64K
0141 #define mmu_virtual_psize MMU_PAGE_64K
0142 #elif defined(CONFIG_PPC_256K_PAGES)
0143 #define PPC44x_TLBE_SIZE PPC44x_TLB_256K
0144 #define mmu_virtual_psize MMU_PAGE_256K
0145 #else
0146 #error "Unsupported PAGE_SIZE"
0147 #endif
0148
0149 #define mmu_linear_psize MMU_PAGE_256M
0150
0151 #define PPC44x_PGD_OFF_SHIFT (32 - PGDIR_SHIFT + PGD_T_LOG2)
0152 #define PPC44x_PGD_OFF_MASK_BIT (PGDIR_SHIFT - PGD_T_LOG2)
0153 #define PPC44x_PTE_ADD_SHIFT (32 - PGDIR_SHIFT + PTE_SHIFT + PTE_T_LOG2)
0154 #define PPC44x_PTE_ADD_MASK_BIT (32 - PTE_T_LOG2 - PTE_SHIFT)
0155
0156 #endif