diff options
author | Markos Chandras <markos.chandras@imgtec.com> | 2013-09-19 13:18:41 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-01-22 14:18:56 -0500 |
commit | 175cba8c7457a4d1c331a45323600368ba977fbf (patch) | |
tree | b38fcbe0290b5f68f8dd168ed7b563d9d51a5877 /arch/mips/mm | |
parent | 40149889ce4d3c99fdbea6b6ca803bb872daebb5 (diff) |
MIPS: mm: c-r4k: Panic if IL or DL fields have a reserved value
According to MIPS32 and MIPS64 PRA documents,
a value of 7 in IL and DL fields is marked as "Reserved"
so panic if the core uses this value in the config1 register.
Also simplify the code a little bit.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/5861/
Diffstat (limited to 'arch/mips/mm')
-rw-r--r-- | arch/mips/mm/c-r4k.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 62ffd20ea869..a4e1a692e45a 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -1013,10 +1013,14 @@ static void probe_pcache(void) | |||
1013 | */ | 1013 | */ |
1014 | config1 = read_c0_config1(); | 1014 | config1 = read_c0_config1(); |
1015 | 1015 | ||
1016 | if ((lsize = ((config1 >> 19) & 7))) | 1016 | lsize = (config1 >> 19) & 7; |
1017 | c->icache.linesz = 2 << lsize; | 1017 | |
1018 | else | 1018 | /* IL == 7 is reserved */ |
1019 | c->icache.linesz = lsize; | 1019 | if (lsize == 7) |
1020 | panic("Invalid icache line size"); | ||
1021 | |||
1022 | c->icache.linesz = lsize ? 2 << lsize : 0; | ||
1023 | |||
1020 | c->icache.sets = 32 << (((config1 >> 22) + 1) & 7); | 1024 | c->icache.sets = 32 << (((config1 >> 22) + 1) & 7); |
1021 | c->icache.ways = 1 + ((config1 >> 16) & 7); | 1025 | c->icache.ways = 1 + ((config1 >> 16) & 7); |
1022 | 1026 | ||
@@ -1033,10 +1037,14 @@ static void probe_pcache(void) | |||
1033 | */ | 1037 | */ |
1034 | c->dcache.flags = 0; | 1038 | c->dcache.flags = 0; |
1035 | 1039 | ||
1036 | if ((lsize = ((config1 >> 10) & 7))) | 1040 | lsize = (config1 >> 10) & 7; |
1037 | c->dcache.linesz = 2 << lsize; | 1041 | |
1038 | else | 1042 | /* DL == 7 is reserved */ |
1039 | c->dcache.linesz= lsize; | 1043 | if (lsize == 7) |
1044 | panic("Invalid dcache line size"); | ||
1045 | |||
1046 | c->dcache.linesz = lsize ? 2 << lsize : 0; | ||
1047 | |||
1040 | c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7); | 1048 | c->dcache.sets = 32 << (((config1 >> 13) + 1) & 7); |
1041 | c->dcache.ways = 1 + ((config1 >> 7) & 7); | 1049 | c->dcache.ways = 1 + ((config1 >> 7) & 7); |
1042 | 1050 | ||