1 /* SPDX-License-Identifier: GPL-2.0 */ 2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 4 #ifndef __ASM_CSKY_CKMMUV1_H 5 #define __ASM_CSKY_CKMMUV1_H 6 #include <abi/reg_ops.h> 7 8 static inline int read_mmu_index(void) 9 { 10 return cprcr("cpcr0"); 11 } 12 13 static inline void write_mmu_index(int value) 14 { 15 cpwcr("cpcr0", value); 16 } 17 18 static inline int read_mmu_entrylo0(void) 19 { 20 return cprcr("cpcr2") << 6; 21 } 22 23 static inline int read_mmu_entrylo1(void) 24 { 25 return cprcr("cpcr3") << 6; 26 } 27 28 static inline void write_mmu_pagemask(int value) 29 { 30 cpwcr("cpcr6", value); 31 } 32 33 static inline int read_mmu_entryhi(void) 34 { 35 return cprcr("cpcr4"); 36 } 37 38 static inline void write_mmu_entryhi(int value) 39 { 40 cpwcr("cpcr4", value); 41 } 42 43 /* 44 * TLB operations. 45 */ 46 static inline void tlb_probe(void) 47 { 48 cpwcr("cpcr8", 0x80000000); 49 } 50 51 static inline void tlb_read(void) 52 { 53 cpwcr("cpcr8", 0x40000000); 54 } 55 56 static inline void tlb_invalid_all(void) 57 { 58 cpwcr("cpcr8", 0x04000000); 59 } 60 61 static inline void tlb_invalid_indexed(void) 62 { 63 cpwcr("cpcr8", 0x02000000); 64 } 65 66 static inline void setup_pgd(unsigned long pgd, bool kernel) 67 { 68 cpwcr("cpcr29", pgd); 69 } 70 71 static inline unsigned long get_pgd(void) 72 { 73 return cprcr("cpcr29"); 74 } 75 #endif /* __ASM_CSKY_CKMMUV1_H */ 76