Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: features: Add initial support for Segmentation Control registers

MIPS32R3 introduced a new set of Segmentation Control registers which
increase the flexibility of the segmented-based memory scheme.

Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/6131/

authored by

Steven J. Hill and committed by
Ralf Baechle
4a0156fb 1745c1ef

+36
+4
arch/mips/include/asm/cpu-features.h
··· 23 23 #ifndef cpu_has_tlbinv 24 24 #define cpu_has_tlbinv (cpu_data[0].options & MIPS_CPU_TLBINV) 25 25 #endif 26 + #ifndef cpu_has_segments 27 + #define cpu_has_segments (cpu_data[0].options & MIPS_CPU_SEGMENTS) 28 + #endif 29 + 26 30 27 31 /* 28 32 * For the moment we don't consider R6000 and R8000 so we can assume that
+1
arch/mips/include/asm/cpu.h
··· 352 352 #define MIPS_CPU_RIXI 0x00800000 /* CPU has TLB Read/eXec Inhibit */ 353 353 #define MIPS_CPU_MICROMIPS 0x01000000 /* CPU has microMIPS capability */ 354 354 #define MIPS_CPU_TLBINV 0x02000000 /* CPU supports TLBINV/F */ 355 + #define MIPS_CPU_SEGMENTS 0x04000000 /* CPU supports Segmentation Control registers */ 355 356 356 357 /* 357 358 * CPU ASE encodings
+29
arch/mips/include/asm/mipsregs.h
··· 664 664 #define MIPS_FPIR_L (_ULCAST_(1) << 21) 665 665 #define MIPS_FPIR_F64 (_ULCAST_(1) << 22) 666 666 667 + /* 668 + * Bits in the MIPS32 Memory Segmentation registers. 669 + */ 670 + #define MIPS_SEGCFG_PA_SHIFT 9 671 + #define MIPS_SEGCFG_PA (_ULCAST_(127) << MIPS_SEGCFG_PA_SHIFT) 672 + #define MIPS_SEGCFG_AM_SHIFT 4 673 + #define MIPS_SEGCFG_AM (_ULCAST_(7) << MIPS_SEGCFG_AM_SHIFT) 674 + #define MIPS_SEGCFG_EU_SHIFT 3 675 + #define MIPS_SEGCFG_EU (_ULCAST_(1) << MIPS_SEGCFG_EU_SHIFT) 676 + #define MIPS_SEGCFG_C_SHIFT 0 677 + #define MIPS_SEGCFG_C (_ULCAST_(7) << MIPS_SEGCFG_C_SHIFT) 678 + 679 + #define MIPS_SEGCFG_UUSK _ULCAST_(7) 680 + #define MIPS_SEGCFG_USK _ULCAST_(5) 681 + #define MIPS_SEGCFG_MUSUK _ULCAST_(4) 682 + #define MIPS_SEGCFG_MUSK _ULCAST_(3) 683 + #define MIPS_SEGCFG_MSK _ULCAST_(2) 684 + #define MIPS_SEGCFG_MK _ULCAST_(1) 685 + #define MIPS_SEGCFG_UK _ULCAST_(0) 686 + 667 687 #ifndef __ASSEMBLY__ 668 688 669 689 /* ··· 1158 1138 #define read_c0_ebase() __read_32bit_c0_register($15, 1) 1159 1139 #define write_c0_ebase(val) __write_32bit_c0_register($15, 1, val) 1160 1140 1141 + /* MIPSR3 */ 1142 + #define read_c0_segctl0() __read_32bit_c0_register($5, 2) 1143 + #define write_c0_segctl0(val) __write_32bit_c0_register($5, 2, val) 1144 + 1145 + #define read_c0_segctl1() __read_32bit_c0_register($5, 3) 1146 + #define write_c0_segctl1(val) __write_32bit_c0_register($5, 3, val) 1147 + 1148 + #define read_c0_segctl2() __read_32bit_c0_register($5, 4) 1149 + #define write_c0_segctl2(val) __write_32bit_c0_register($5, 4, val) 1161 1150 1162 1151 /* Cavium OCTEON (cnMIPS) */ 1163 1152 #define read_c0_cvmcount() __read_ulong_c0_register($9, 6)
+2
arch/mips/kernel/cpu-probe.c
··· 272 272 c->options |= MIPS_CPU_MICROMIPS; 273 273 if (config3 & MIPS_CONF3_VZ) 274 274 c->ases |= MIPS_ASE_VZ; 275 + if (config3 & MIPS_CONF3_SC) 276 + c->options |= MIPS_CPU_SEGMENTS; 275 277 276 278 return config3 & MIPS_CONF_M; 277 279 }