1994da93dSChristophe Leroy /* SPDX-License-Identifier: GPL-2.0 */ 2994da93dSChristophe Leroy #ifndef _ASM_POWERPC_MMU_40X_H_ 3994da93dSChristophe Leroy #define _ASM_POWERPC_MMU_40X_H_ 4994da93dSChristophe Leroy 5994da93dSChristophe Leroy /* 6994da93dSChristophe Leroy * PPC40x support 7994da93dSChristophe Leroy */ 8994da93dSChristophe Leroy 9994da93dSChristophe Leroy #define PPC40X_TLB_SIZE 64 10994da93dSChristophe Leroy 11994da93dSChristophe Leroy /* 12994da93dSChristophe Leroy * TLB entries are defined by a "high" tag portion and a "low" data 13994da93dSChristophe Leroy * portion. On all architectures, the data portion is 32-bits. 14994da93dSChristophe Leroy * 15994da93dSChristophe Leroy * TLB entries are managed entirely under software control by reading, 16994da93dSChristophe Leroy * writing, and searchoing using the 4xx-specific tlbre, tlbwr, and tlbsx 17994da93dSChristophe Leroy * instructions. 18994da93dSChristophe Leroy */ 19994da93dSChristophe Leroy 20994da93dSChristophe Leroy #define TLB_LO 1 21994da93dSChristophe Leroy #define TLB_HI 0 22994da93dSChristophe Leroy 23994da93dSChristophe Leroy #define TLB_DATA TLB_LO 24994da93dSChristophe Leroy #define TLB_TAG TLB_HI 25994da93dSChristophe Leroy 26994da93dSChristophe Leroy /* Tag portion */ 27994da93dSChristophe Leroy 28994da93dSChristophe Leroy #define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */ 29994da93dSChristophe Leroy #define TLB_PAGESZ_MASK 0x00000380 30994da93dSChristophe Leroy #define TLB_PAGESZ(x) (((x) & 0x7) << 7) 31994da93dSChristophe Leroy #define PAGESZ_1K 0 32994da93dSChristophe Leroy #define PAGESZ_4K 1 33994da93dSChristophe Leroy #define PAGESZ_16K 2 34994da93dSChristophe Leroy #define PAGESZ_64K 3 35994da93dSChristophe Leroy #define PAGESZ_256K 4 36994da93dSChristophe Leroy #define PAGESZ_1M 5 37994da93dSChristophe Leroy #define PAGESZ_4M 6 38994da93dSChristophe Leroy #define PAGESZ_16M 7 39994da93dSChristophe Leroy #define TLB_VALID 0x00000040 /* Entry is valid */ 40994da93dSChristophe Leroy 41994da93dSChristophe Leroy /* Data portion */ 42994da93dSChristophe Leroy 43994da93dSChristophe Leroy #define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */ 44994da93dSChristophe Leroy #define TLB_PERM_MASK 0x00000300 45994da93dSChristophe Leroy #define TLB_EX 0x00000200 /* Instruction execution allowed */ 46994da93dSChristophe Leroy #define TLB_WR 0x00000100 /* Writes permitted */ 47994da93dSChristophe Leroy #define TLB_ZSEL_MASK 0x000000F0 48994da93dSChristophe Leroy #define TLB_ZSEL(x) (((x) & 0xF) << 4) 49994da93dSChristophe Leroy #define TLB_ATTR_MASK 0x0000000F 50994da93dSChristophe Leroy #define TLB_W 0x00000008 /* Caching is write-through */ 51994da93dSChristophe Leroy #define TLB_I 0x00000004 /* Caching is inhibited */ 52994da93dSChristophe Leroy #define TLB_M 0x00000002 /* Memory is coherent */ 53994da93dSChristophe Leroy #define TLB_G 0x00000001 /* Memory is guarded from prefetch */ 54994da93dSChristophe Leroy 55994da93dSChristophe Leroy #ifndef __ASSEMBLY__ 56994da93dSChristophe Leroy 57994da93dSChristophe Leroy typedef struct { 58994da93dSChristophe Leroy unsigned int id; 59994da93dSChristophe Leroy unsigned int active; 60*c102f076SChristophe Leroy void __user *vdso; 61994da93dSChristophe Leroy } mm_context_t; 62994da93dSChristophe Leroy 63994da93dSChristophe Leroy #endif /* !__ASSEMBLY__ */ 64994da93dSChristophe Leroy 65994da93dSChristophe Leroy #define mmu_virtual_psize MMU_PAGE_4K 66994da93dSChristophe Leroy #define mmu_linear_psize MMU_PAGE_256M 67994da93dSChristophe Leroy 68994da93dSChristophe Leroy #endif /* _ASM_POWERPC_MMU_40X_H_ */ 69