18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_MMU_40X_H_ 38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_MMU_40X_H_ 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * PPC40x support 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#define PPC40X_TLB_SIZE 64 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* 128c2ecf20Sopenharmony_ci * TLB entries are defined by a "high" tag portion and a "low" data 138c2ecf20Sopenharmony_ci * portion. On all architectures, the data portion is 32-bits. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * TLB entries are managed entirely under software control by reading, 168c2ecf20Sopenharmony_ci * writing, and searchoing using the 4xx-specific tlbre, tlbwr, and tlbsx 178c2ecf20Sopenharmony_ci * instructions. 188c2ecf20Sopenharmony_ci */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define TLB_LO 1 218c2ecf20Sopenharmony_ci#define TLB_HI 0 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define TLB_DATA TLB_LO 248c2ecf20Sopenharmony_ci#define TLB_TAG TLB_HI 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci/* Tag portion */ 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define TLB_EPN_MASK 0xFFFFFC00 /* Effective Page Number */ 298c2ecf20Sopenharmony_ci#define TLB_PAGESZ_MASK 0x00000380 308c2ecf20Sopenharmony_ci#define TLB_PAGESZ(x) (((x) & 0x7) << 7) 318c2ecf20Sopenharmony_ci#define PAGESZ_1K 0 328c2ecf20Sopenharmony_ci#define PAGESZ_4K 1 338c2ecf20Sopenharmony_ci#define PAGESZ_16K 2 348c2ecf20Sopenharmony_ci#define PAGESZ_64K 3 358c2ecf20Sopenharmony_ci#define PAGESZ_256K 4 368c2ecf20Sopenharmony_ci#define PAGESZ_1M 5 378c2ecf20Sopenharmony_ci#define PAGESZ_4M 6 388c2ecf20Sopenharmony_ci#define PAGESZ_16M 7 398c2ecf20Sopenharmony_ci#define TLB_VALID 0x00000040 /* Entry is valid */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* Data portion */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define TLB_RPN_MASK 0xFFFFFC00 /* Real Page Number */ 448c2ecf20Sopenharmony_ci#define TLB_PERM_MASK 0x00000300 458c2ecf20Sopenharmony_ci#define TLB_EX 0x00000200 /* Instruction execution allowed */ 468c2ecf20Sopenharmony_ci#define TLB_WR 0x00000100 /* Writes permitted */ 478c2ecf20Sopenharmony_ci#define TLB_ZSEL_MASK 0x000000F0 488c2ecf20Sopenharmony_ci#define TLB_ZSEL(x) (((x) & 0xF) << 4) 498c2ecf20Sopenharmony_ci#define TLB_ATTR_MASK 0x0000000F 508c2ecf20Sopenharmony_ci#define TLB_W 0x00000008 /* Caching is write-through */ 518c2ecf20Sopenharmony_ci#define TLB_I 0x00000004 /* Caching is inhibited */ 528c2ecf20Sopenharmony_ci#define TLB_M 0x00000002 /* Memory is coherent */ 538c2ecf20Sopenharmony_ci#define TLB_G 0x00000001 /* Memory is guarded from prefetch */ 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_citypedef struct { 588c2ecf20Sopenharmony_ci unsigned int id; 598c2ecf20Sopenharmony_ci unsigned int active; 608c2ecf20Sopenharmony_ci unsigned long vdso_base; 618c2ecf20Sopenharmony_ci} mm_context_t; 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ci#define mmu_virtual_psize MMU_PAGE_4K 668c2ecf20Sopenharmony_ci#define mmu_linear_psize MMU_PAGE_256M 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_MMU_40X_H_ */ 69