Skip to content

Commit b4fdedd

Browse files
committed
MIPS: kernel: Rename read/write_c0_ecc to read/writec0_errctl
CP0 register 26 is used as ECC register for legacy cores, but newer cores (MIPS32/MIPS64) use it as an ErrCtl register. Since the kernel only uses CP0 26 as ErrCtl register rename the access functions to the more fitting name. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 40384c8 commit b4fdedd

File tree

4 files changed

+21
-26
lines changed

4 files changed

+21
-26
lines changed

arch/mips/include/asm/mipsregs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,8 +2039,8 @@ do { \
20392039
#define read_c0_perfcntr3_64() __read_64bit_c0_register($25, 7)
20402040
#define write_c0_perfcntr3_64(val) __write_64bit_c0_register($25, 7, val)
20412041

2042-
#define read_c0_ecc() __read_32bit_c0_register($26, 0)
2043-
#define write_c0_ecc(val) __write_32bit_c0_register($26, 0, val)
2042+
#define read_c0_errctl() __read_32bit_c0_register($26, 0)
2043+
#define write_c0_errctl(val) __write_32bit_c0_register($26, 0, val)
20442044

20452045
#define read_c0_derraddr0() __read_ulong_c0_register($26, 1)
20462046
#define write_c0_derraddr0(val) __write_ulong_c0_register($26, 1, val)

arch/mips/kernel/mips-mt.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,8 @@ void mips_mt_set_cpuoptions(void)
122122
unsigned long ectlval;
123123
unsigned long itcblkgrn;
124124

125-
/* ErrCtl register is known as "ecc" to Linux */
126-
ectlval = read_c0_ecc();
127-
write_c0_ecc(ectlval | (0x1 << 26));
125+
ectlval = read_c0_errctl();
126+
write_c0_errctl(ectlval | (0x1 << 26));
128127
ehb();
129128
#define INDEX_0 (0x80000000)
130129
#define INDEX_8 (0x80000008)
@@ -145,7 +144,7 @@ void mips_mt_set_cpuoptions(void)
145144
ehb();
146145
/* Write out to ITU with CACHE op */
147146
cache_op(Index_Store_Tag_D, INDEX_0);
148-
write_c0_ecc(ectlval);
147+
write_c0_errctl(ectlval);
149148
ehb();
150149
printk("Mapped %ld ITC cells starting at 0x%08x\n",
151150
((itcblkgrn & 0x7fe00000) >> 20), itc_base);

arch/mips/kernel/spram.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626

2727
#define ERRCTL_SPRAM (1 << 28)
2828

29-
/* errctl access */
30-
#define read_c0_errctl(x) read_c0_ecc(x)
31-
#define write_c0_errctl(x) write_c0_ecc(x)
32-
3329
/*
3430
* Different semantics to the set_c0_* function built by __BUILD_SET_C0
3531
*/

arch/mips/kernel/traps.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,10 +1705,10 @@ static inline __init void parity_protection_init(void)
17051705
l2parity &= l1parity;
17061706

17071707
/* Probe L1 ECC support */
1708-
cp0_ectl = read_c0_ecc();
1709-
write_c0_ecc(cp0_ectl | ERRCTL_PE);
1708+
cp0_ectl = read_c0_errctl();
1709+
write_c0_errctl(cp0_ectl | ERRCTL_PE);
17101710
back_to_back_c0_hazard();
1711-
cp0_ectl = read_c0_ecc();
1711+
cp0_ectl = read_c0_errctl();
17121712

17131713
/* Probe L2 ECC support */
17141714
gcr_ectl = read_gcr_err_control();
@@ -1727,9 +1727,9 @@ static inline __init void parity_protection_init(void)
17271727
cp0_ectl |= ERRCTL_PE;
17281728
else
17291729
cp0_ectl &= ~ERRCTL_PE;
1730-
write_c0_ecc(cp0_ectl);
1730+
write_c0_errctl(cp0_ectl);
17311731
back_to_back_c0_hazard();
1732-
WARN_ON(!!(read_c0_ecc() & ERRCTL_PE) != l1parity);
1732+
WARN_ON(!!(read_c0_errctl() & ERRCTL_PE) != l1parity);
17331733

17341734
/* Configure L2 ECC checking */
17351735
if (l2parity)
@@ -1761,18 +1761,18 @@ static inline __init void parity_protection_init(void)
17611761
unsigned long errctl;
17621762
unsigned int l1parity_present, l2parity_present;
17631763

1764-
errctl = read_c0_ecc();
1764+
errctl = read_c0_errctl();
17651765
errctl &= ~(ERRCTL_PE|ERRCTL_L2P);
17661766

17671767
/* probe L1 parity support */
1768-
write_c0_ecc(errctl | ERRCTL_PE);
1768+
write_c0_errctl(errctl | ERRCTL_PE);
17691769
back_to_back_c0_hazard();
1770-
l1parity_present = (read_c0_ecc() & ERRCTL_PE);
1770+
l1parity_present = (read_c0_errctl() & ERRCTL_PE);
17711771

17721772
/* probe L2 parity support */
1773-
write_c0_ecc(errctl|ERRCTL_L2P);
1773+
write_c0_errctl(errctl|ERRCTL_L2P);
17741774
back_to_back_c0_hazard();
1775-
l2parity_present = (read_c0_ecc() & ERRCTL_L2P);
1775+
l2parity_present = (read_c0_errctl() & ERRCTL_L2P);
17761776

17771777
if (l1parity_present && l2parity_present) {
17781778
if (l1parity)
@@ -1791,9 +1791,9 @@ static inline __init void parity_protection_init(void)
17911791

17921792
printk(KERN_INFO "Writing ErrCtl register=%08lx\n", errctl);
17931793

1794-
write_c0_ecc(errctl);
1794+
write_c0_errctl(errctl);
17951795
back_to_back_c0_hazard();
1796-
errctl = read_c0_ecc();
1796+
errctl = read_c0_errctl();
17971797
printk(KERN_INFO "Readback ErrCtl register=%08lx\n", errctl);
17981798

17991799
if (l1parity_present)
@@ -1812,11 +1812,11 @@ static inline __init void parity_protection_init(void)
18121812
case CPU_5KC:
18131813
case CPU_5KE:
18141814
case CPU_LOONGSON32:
1815-
write_c0_ecc(0x80000000);
1815+
write_c0_errctl(0x80000000);
18161816
back_to_back_c0_hazard();
18171817
/* Set the PE bit (bit 31) in the c0_errctl register. */
18181818
printk(KERN_INFO "Cache parity protection %sabled\n",
1819-
(read_c0_ecc() & 0x80000000) ? "en" : "dis");
1819+
(read_c0_errctl() & 0x80000000) ? "en" : "dis");
18201820
break;
18211821
case CPU_20KC:
18221822
case CPU_25KF:
@@ -1887,8 +1887,8 @@ asmlinkage void do_ftlb(void)
18871887
if ((cpu_has_mips_r2_r6) &&
18881888
(((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_MIPS) ||
18891889
((current_cpu_data.processor_id & 0xff0000) == PRID_COMP_LOONGSON))) {
1890-
pr_err("FTLB error exception, cp0_ecc=0x%08x:\n",
1891-
read_c0_ecc());
1890+
pr_err("FTLB error exception, cp0_errctl=0x%08x:\n",
1891+
read_c0_errctl());
18921892
pr_err("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
18931893
reg_val = read_c0_cacheerr();
18941894
pr_err("c0_cacheerr == %08x\n", reg_val);

0 commit comments

Comments
 (0)