Commit 9e575f75 authored by James Hogan's avatar James Hogan Committed by Ralf Baechle

MIPS: Avoid magic numbers probing kscratch_mask

The decode_config4() function reads kscratch_mask from
CP0_Config4.KScrExist using a hard coded shift and mask. We already have
a definition for the mask in mipsregs.h, so add a definition for the
shift and make use of them.
Signed-off-by: default avatarJames Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13227/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 30228c40
...@@ -615,7 +615,8 @@ ...@@ -615,7 +615,8 @@
#define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14) #define MIPS_CONF4_MMUEXTDEF_MMUSIZEEXT (_ULCAST_(1) << 14)
#define MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT (_ULCAST_(2) << 14) #define MIPS_CONF4_MMUEXTDEF_FTLBSIZEEXT (_ULCAST_(2) << 14)
#define MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT (_ULCAST_(3) << 14) #define MIPS_CONF4_MMUEXTDEF_VTLBSIZEEXT (_ULCAST_(3) << 14)
#define MIPS_CONF4_KSCREXIST (_ULCAST_(255) << 16) #define MIPS_CONF4_KSCREXIST_SHIFT (16)
#define MIPS_CONF4_KSCREXIST (_ULCAST_(255) << MIPS_CONF4_KSCREXIST_SHIFT)
#define MIPS_CONF4_VTLBSIZEEXT_SHIFT (24) #define MIPS_CONF4_VTLBSIZEEXT_SHIFT (24)
#define MIPS_CONF4_VTLBSIZEEXT (_ULCAST_(15) << MIPS_CONF4_VTLBSIZEEXT_SHIFT) #define MIPS_CONF4_VTLBSIZEEXT (_ULCAST_(15) << MIPS_CONF4_VTLBSIZEEXT_SHIFT)
#define MIPS_CONF4_AE (_ULCAST_(1) << 28) #define MIPS_CONF4_AE (_ULCAST_(1) << 28)
......
...@@ -801,7 +801,8 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c) ...@@ -801,7 +801,8 @@ static inline unsigned int decode_config4(struct cpuinfo_mips *c)
} }
} }
c->kscratch_mask = (config4 >> 16) & 0xff; c->kscratch_mask = (config4 & MIPS_CONF4_KSCREXIST)
>> MIPS_CONF4_KSCREXIST_SHIFT;
asid_mask = MIPS_ENTRYHI_ASID; asid_mask = MIPS_ENTRYHI_ASID;
if (config4 & MIPS_CONF4_AE) if (config4 & MIPS_CONF4_AE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment