1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 3 * Definitions for Sun3 custom MMU. 4 */ 5 #ifndef __SUN3_MMU_H__ 6 #define __SUN3_MMU_H__ 7 8 #include <linux/types.h> 9 #include <asm/movs.h> 10 #include <asm/sun3-head.h> 11 12 /* MMU characteristics. */ 13 #define SUN3_SEGMAPS_PER_CONTEXT 2048 14 #define SUN3_PMEGS_NUM 256 15 #define SUN3_CONTEXTS_NUM 8 16 17 #define SUN3_PMEG_SIZE_BITS 17 18 #define SUN3_PMEG_SIZE (1 << SUN3_PM 19 #define SUN3_PMEG_MASK (SUN3_PMEG_SI 20 21 #define SUN3_PTE_SIZE_BITS 13 22 #define SUN3_PTE_SIZE (1 << SUN3_PT 23 #define SUN3_PTE_MASK (SUN3_PTE_SIZ 24 25 #define SUN3_CONTROL_MASK (0x0FFFFFFC) 26 #define SUN3_INVALID_PMEG 255 27 #define SUN3_INVALID_CONTEXT 255 28 29 #define AC_IDPROM 0x00000000 /* 34 ID 30 #define AC_PAGEMAP 0x10000000 /* 3 Pag 31 #define AC_SEGMAP 0x20000000 /* 3 Seg 32 #define AC_CONTEXT 0x30000000 /* 34c cur 33 #define AC_SENABLE 0x40000000 /* 34c sys 34 #define AC_UDVMA_ENB 0x50000000 /* 34 Not 35 #define AC_BUS_ERROR 0x60000000 /* 34 Cle 36 #define AC_SYNC_ERR 0x60000000 /* c fau 37 #define AC_SYNC_VA 0x60000004 /* c fau 38 #define AC_ASYNC_ERR 0x60000008 /* c asy 39 #define AC_ASYNC_VA 0x6000000c /* c asy 40 #define AC_LEDS 0x70000000 /* 34 Zer 41 #define AC_CACHETAGS 0x80000000 /* 34c dir 42 #define AC_CACHEDDATA 0x90000000 /* 3 c dir 43 #define AC_UDVMA_MAP 0xD0000000 /* 4 Not 44 #define AC_VME_VECTOR 0xE0000000 /* 4 For 45 #define AC_BOOT_SCC 0xF0000000 /* 34 byp 46 47 #define SUN3_PAGE_CHG_MASK (SUN3_PAGE_PGNUM_MA 48 | SUN3_PAGE_ACCESS 49 50 /* Bus access type within PTE. */ 51 #define SUN3_PAGE_TYPE_MASK (0x0c000000) 52 #define SUN3_PAGE_TYPE_MEMORY (0x00000000) 53 #define SUN3_PAGE_TYPE_IO (0x04000000) 54 #define SUN3_PAGE_TYPE_VME16 (0x08000000) 55 #define SUN3_PAGE_TYPE_VME32 (0x0c000000) 56 57 /* Mask for page number within PTE. */ 58 #define SUN3_PAGE_PGNUM_MASK (0x0007FFFF) 59 60 /* Bits within bus-error register. */ 61 #define SUN3_BUSERR_WATCHDOG (0x01) 62 #define SUN3_BUSERR_unused (0x02) 63 #define SUN3_BUSERR_FPAENERR (0x04) 64 #define SUN3_BUSERR_FPABERR (0x08) 65 #define SUN3_BUSERR_VMEBERR (0x10) 66 #define SUN3_BUSERR_TIMEOUT (0x20) 67 #define SUN3_BUSERR_PROTERR (0x40) 68 #define SUN3_BUSERR_INVALID (0x80) 69 70 #ifndef __ASSEMBLY__ 71 72 /* Read bus error status register (implicitly 73 static inline unsigned char sun3_get_buserr(vo 74 { 75 unsigned char sfc, c; 76 77 GET_SFC (sfc); 78 SET_SFC (FC_CONTROL); 79 GET_CONTROL_BYTE (AC_BUS_ERROR, c); 80 SET_SFC (sfc); 81 82 return c; 83 } 84 85 /* Read segmap from hardware MMU. */ 86 static inline unsigned long sun3_get_segmap(un 87 { 88 register unsigned long entry; 89 unsigned char c, sfc; 90 91 GET_SFC (sfc); 92 SET_SFC (FC_CONTROL); 93 GET_CONTROL_BYTE (AC_SEGMAP | (addr & 94 SET_SFC (sfc); 95 entry = c; 96 97 return entry; 98 } 99 100 /* Write segmap to hardware MMU. */ 101 static inline void sun3_put_segmap(unsigned lo 102 { 103 unsigned char sfc; 104 105 GET_DFC (sfc); 106 SET_DFC (FC_CONTROL); 107 SET_CONTROL_BYTE (AC_SEGMAP | (addr & 108 SET_DFC (sfc); 109 110 return; 111 } 112 113 /* Read PTE from hardware MMU. */ 114 static inline unsigned long sun3_get_pte(unsig 115 { 116 register unsigned long entry; 117 unsigned char sfc; 118 119 GET_SFC (sfc); 120 SET_SFC (FC_CONTROL); 121 GET_CONTROL_WORD (AC_PAGEMAP | (addr & 122 SET_SFC (sfc); 123 124 return entry; 125 } 126 127 /* Write PTE to hardware MMU. */ 128 static inline void sun3_put_pte(unsigned long 129 { 130 unsigned char sfc; 131 132 GET_DFC (sfc); 133 SET_DFC (FC_CONTROL); 134 SET_CONTROL_WORD (AC_PAGEMAP | (addr & 135 SET_DFC (sfc); 136 137 return; 138 } 139 140 /* get current context */ 141 static inline unsigned char sun3_get_context(v 142 { 143 unsigned char sfc, c; 144 145 GET_SFC(sfc); 146 SET_SFC(FC_CONTROL); 147 GET_CONTROL_BYTE(AC_CONTEXT, c); 148 SET_SFC(sfc); 149 150 return c; 151 } 152 153 /* set alternate context */ 154 static inline void sun3_put_context(unsigned c 155 { 156 unsigned char dfc; 157 GET_DFC(dfc); 158 SET_DFC(FC_CONTROL); 159 SET_CONTROL_BYTE(AC_CONTEXT, c); 160 SET_DFC(dfc); 161 162 return; 163 } 164 165 extern void __iomem *sun3_ioremap(unsigned lon 166 unsigned long type); 167 168 extern int sun3_map_test(unsigned long addr, c 169 170 #endif /* !__ASSEMBLY__ */ 171 172 #endif /* !__SUN3_MMU_H__ */ 173
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.