Skip to content

Commit 64dac50

Browse files
Maciej W. Rozyckiralfbaechle
authored andcommitted
System-specific handling of bus errors for DECstation variations
supporting parity errors only for memory (Pmax/3min/Maxine). Fixes for resources decoded by the KN04/KN05 MB ASIC. Additional clean-ups for the ECC handler. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 3b2396d commit 64dac50

9 files changed

Lines changed: 121 additions & 70 deletions

File tree

‎arch/mips/dec/Makefile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# Makefile for the DECstation family specific parts of the kernel
33
#
44

5-
obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn02-irq.o reset.o \
6-
setup.o time.o
5+
obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
6+
kn02-irq.o kn02xa-berr.o reset.o setup.o time.o
77

88
obj-$(CONFIG_PROM_CONSOLE) += promcon.o
99
obj-$(CONFIG_CPU_HAS_WB) += wbflush.o

‎arch/mips/dec/ecc-berr.c‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* 5000/240 (KN03), 5000/260 (KN05) and DECsystem 5900 (KN03),
77
* 5900/260 (KN05) systems.
88
*
9-
* Copyright (c) 2003 Maciej W. Rozycki
9+
* Copyright (c) 2003, 2005 Maciej W. Rozycki
1010
*
1111
* This program is free software; you can redistribute it and/or
1212
* modify it under the terms of the GNU General Public License
@@ -15,6 +15,7 @@
1515
*/
1616

1717
#include <linux/init.h>
18+
#include <linux/interrupt.h>
1819
#include <linux/kernel.h>
1920
#include <linux/sched.h>
2021
#include <linux/spinlock.h>
@@ -57,7 +58,7 @@ static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
5758

5859
const char *kind, *agent, *cycle, *event;
5960
const char *status = "", *xbit = "", *fmt = "";
60-
dma_addr_t address;
61+
unsigned long address;
6162
u16 syn = 0, sngl;
6263

6364
int i = 0;
@@ -66,15 +67,15 @@ static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
6667
u32 chksyn = *kn0x_chksyn;
6768
int action = MIPS_BE_FATAL;
6869

69-
/* For non-ECC ack ASAP, so any subsequent errors get caught. */
70+
/* For non-ECC ack ASAP, so that any subsequent errors get caught. */
7071
if ((erraddr & (KN0X_EAR_VALID | KN0X_EAR_ECCERR)) == KN0X_EAR_VALID)
7172
dec_ecc_be_ack();
7273

7374
kind = invoker ? intstr : excstr;
7475

7576
if (!(erraddr & KN0X_EAR_VALID)) {
7677
/* No idea what happened. */
77-
printk(KERN_ALERT "Unidentified bus error %s.\n", kind);
78+
printk(KERN_ALERT "Unidentified bus error %s\n", kind);
7879
return action;
7980
}
8081

@@ -126,7 +127,7 @@ static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
126127
/* Ack now, no rewrite will happen. */
127128
dec_ecc_be_ack();
128129

129-
fmt = KERN_ALERT "%s" "invalid.\n";
130+
fmt = KERN_ALERT "%s" "invalid\n";
130131
} else {
131132
sngl = syn & KN0X_ESR_SNGLO;
132133
syn &= KN0X_ESR_SYNLO;
@@ -161,12 +162,12 @@ static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
161162
if (syn == 0x01) {
162163
fmt = KERN_ALERT "%s"
163164
"%#04x -- %s bit error "
164-
"at check bit C%s.\n";
165+
"at check bit C%s\n";
165166
xbit = "X";
166167
} else {
167168
fmt = KERN_ALERT "%s"
168169
"%#04x -- %s bit error "
169-
"at check bit C%s%u.\n";
170+
"at check bit C%s%u\n";
170171
}
171172
i = syn >> 2;
172173
} else {
@@ -176,16 +177,16 @@ static int dec_ecc_be_backend(struct pt_regs *regs, int is_fixup, int invoker)
176177
if (i < 32)
177178
fmt = KERN_ALERT "%s"
178179
"%#04x -- %s bit error "
179-
"at data bit D%s%u.\n";
180+
"at data bit D%s%u\n";
180181
else
181182
fmt = KERN_ALERT "%s"
182-
"%#04x -- %s bit error.\n";
183+
"%#04x -- %s bit error\n";
183184
}
184185
}
185186
}
186187

187188
if (action != MIPS_BE_FIXUP)
188-
printk(KERN_ALERT "Bus error %s: %s %s %s at %#010lx.\n",
189+
printk(KERN_ALERT "Bus error %s: %s %s %s at %#010lx\n",
189190
kind, agent, cycle, event, address);
190191

191192
if (action != MIPS_BE_FIXUP && erraddr & KN0X_EAR_ECCERR)
@@ -207,8 +208,8 @@ irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id, struct pt_regs *regs)
207208
return IRQ_HANDLED;
208209

209210
/*
210-
* FIXME: Find affected processes and kill them, otherwise we
211-
* must die.
211+
* FIXME: Find the affected processes and kill them, otherwise
212+
* we must die.
212213
*
213214
* The interrupt is asynchronously delivered thus EPC and RA
214215
* may be irrelevant, but are printed for a reference.
@@ -235,7 +236,7 @@ static inline void dec_kn02_be_init(void)
235236
spin_lock_irqsave(&kn02_lock, flags);
236237

237238
/* Preset write-only bits of the Control Register cache. */
238-
cached_kn02_csr = *csr | KN03_CSR_LEDS;
239+
cached_kn02_csr = *csr | KN02_CSR_LEDS;
239240

240241
/* Set normal ECC detection and generation. */
241242
cached_kn02_csr &= ~(KN02_CSR_DIAGCHK | KN02_CSR_DIAGGEN);
@@ -250,7 +251,7 @@ static inline void dec_kn02_be_init(void)
250251
static inline void dec_kn03_be_init(void)
251252
{
252253
volatile u32 *mcr = (void *)(KN03_SLOT_BASE + IOASIC_MCR);
253-
volatile u32 *mbcs = (void *)(KN03_SLOT_BASE + KN05_MB_CSR);
254+
volatile u32 *mbcs = (void *)(KN4K_SLOT_BASE + KN4K_MB_CSR);
254255

255256
kn0x_erraddr = (void *)(KN03_SLOT_BASE + IOASIC_ERRADDR);
256257
kn0x_chksyn = (void *)(KN03_SLOT_BASE + IOASIC_CHKSYN);
@@ -265,7 +266,7 @@ static inline void dec_kn03_be_init(void)
265266
*mcr = (*mcr & ~(KN03_MCR_DIAGCHK | KN03_MCR_DIAGGEN)) |
266267
KN03_MCR_CORRECT;
267268
if (current_cpu_data.cputype == CPU_R4400SC)
268-
*mbcs |= KN05_MB_CSR_EE;
269+
*mbcs |= KN4K_MB_CSR_EE;
269270
fast_iob();
270271
}
271272

‎arch/mips/dec/kn02-irq.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* DECstation 5000/200 (KN02) Control and Status Register
55
* interrupts.
66
*
7-
* Copyright (c) 2002, 2003 Maciej W. Rozycki
7+
* Copyright (c) 2002, 2003, 2005 Maciej W. Rozycki
88
*
99
* This program is free software; you can redistribute it and/or
1010
* modify it under the terms of the GNU General Public License
@@ -111,7 +111,7 @@ void __init init_kn02_irqs(int base)
111111

112112
/* Mask interrupts. */
113113
spin_lock_irqsave(&kn02_lock, flags);
114-
cached_kn02_csr &= ~KN03_CSR_IOINTEN;
114+
cached_kn02_csr &= ~KN02_CSR_IOINTEN;
115115
*csr = cached_kn02_csr;
116116
iob();
117117
spin_unlock_irqrestore(&kn02_lock, flags);

‎arch/mips/dec/setup.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,16 @@ void __init dec_be_init(void)
113113
{
114114
switch (mips_machtype) {
115115
case MACH_DS23100: /* DS2100/DS3100 Pmin/Pmax */
116+
board_be_handler = dec_kn01_be_handler;
117+
busirq.handler = dec_kn01_be_interrupt;
116118
busirq.flags |= SA_SHIRQ;
119+
dec_kn01_be_init();
120+
break;
121+
case MACH_DS5000_1XX: /* DS5000/1xx 3min */
122+
case MACH_DS5000_XX: /* DS5000/xx Maxine */
123+
board_be_handler = dec_kn02xa_be_handler;
124+
busirq.handler = dec_kn02xa_be_interrupt;
125+
dec_kn02xa_be_init();
117126
break;
118127
case MACH_DS5000_200: /* DS5000/200 3max */
119128
case MACH_DS5000_2X0: /* DS5000/240 3max+ */

‎include/asm-mips/dec/ecc.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ struct pt_regs;
4949

5050
extern void dec_ecc_be_init(void);
5151
extern int dec_ecc_be_handler(struct pt_regs *regs, int is_fixup);
52-
extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id, struct pt_regs *regs);
52+
extern irqreturn_t dec_ecc_be_interrupt(int irq, void *dev_id,
53+
struct pt_regs *regs);
5354
#endif
5455

5556
#endif /* __ASM_MIPS_DEC_ECC_H */

‎include/asm-mips/dec/kn01.h‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
* Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
1010
* are by courtesy of Chris Fraser.
11-
* Copyright (C) 2002, 2003 Maciej W. Rozycki
11+
* Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
1212
*/
1313
#ifndef __ASM_MIPS_DEC_KN01_H
1414
#define __ASM_MIPS_DEC_KN01_H
@@ -80,4 +80,22 @@
8080
#define KN01_CSR_VRGTRB (1<<0) /* red DAC voltage over blue (r/o) */
8181
#define KN01_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
8282

83+
84+
#ifndef __ASSEMBLY__
85+
86+
#include <linux/interrupt.h>
87+
#include <linux/spinlock.h>
88+
#include <linux/types.h>
89+
90+
struct pt_regs;
91+
92+
extern u16 cached_kn01_csr;
93+
extern spinlock_t kn01_lock;
94+
95+
extern void dec_kn01_be_init(void);
96+
extern int dec_kn01_be_handler(struct pt_regs *regs, int is_fixup);
97+
extern irqreturn_t dec_kn01_be_interrupt(int irq, void *dev_id,
98+
struct pt_regs *regs);
99+
#endif
100+
83101
#endif /* __ASM_MIPS_DEC_KN01_H */

‎include/asm-mips/dec/kn02.h‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,11 @@
88
*
99
* Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
1010
* are by courtesy of Chris Fraser.
11-
* Copyright (C) 2002, 2003 Maciej W. Rozycki
11+
* Copyright (C) 2002, 2003, 2005 Maciej W. Rozycki
1212
*/
1313
#ifndef __ASM_MIPS_DEC_KN02_H
1414
#define __ASM_MIPS_DEC_KN02_H
1515

16-
#ifndef __ASSEMBLY__
17-
#include <linux/spinlock.h>
18-
#include <linux/types.h>
19-
#endif
20-
2116
#include <asm/addrspace.h>
2217
#include <asm/dec/ecc.h>
2318

@@ -53,8 +48,8 @@
5348
#define KN02_CSR_PSU (1<<27) /* power supply unit warning */
5449
#define KN02_CSR_NVRAM (1<<26) /* ~NVRAM clear jumper */
5550
#define KN02_CSR_REFEVEN (1<<25) /* mem refresh bank toggle */
56-
#define KN03_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
57-
#define KN03_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
51+
#define KN02_CSR_NRMOD (1<<24) /* ~NRMOD manufact. jumper */
52+
#define KN02_CSR_IOINTEN (0xff<<16) /* IRQ mask bits */
5853
#define KN02_CSR_DIAGCHK (1<<15) /* diagn/norml ECC reads */
5954
#define KN02_CSR_DIAGGEN (1<<14) /* diagn/norml ECC writes */
6055
#define KN02_CSR_CORRECT (1<<13) /* ECC correct/check */
@@ -63,8 +58,8 @@
6358
#define KN02_CSR_BNK32M (1<<10) /* 32M/8M stride */
6459
#define KN02_CSR_DIAGDN (1<<9) /* DIAGDN manufact. jumper */
6560
#define KN02_CSR_BAUD38 (1<<8) /* DZ11 38/19kbps ext. rate */
66-
#define KN03_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
67-
#define KN03_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
61+
#define KN02_CSR_IOINT (0xff<<0) /* IRQ status bits (r/o) */
62+
#define KN02_CSR_LEDS (0xff<<0) /* ~diagnostic LEDs (w/o) */
6863

6964

7065
/*
@@ -98,6 +93,10 @@
9893

9994

10095
#ifndef __ASSEMBLY__
96+
97+
#include <linux/spinlock.h>
98+
#include <linux/types.h>
99+
101100
extern u32 cached_kn02_csr;
102101
extern spinlock_t kn02_lock;
103102
extern void init_kn02_irqs(int base);

‎include/asm-mips/dec/kn02xa.h‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Copyright (C) 1995,1996 by Paul M. Antoine, some code and definitions
1111
* are by courtesy of Chris Fraser.
12-
* Copyright (C) 2000, 2002, 2003 Maciej W. Rozycki
12+
* Copyright (C) 2000, 2002, 2003, 2005 Maciej W. Rozycki
1313
*
1414
* These are addresses which have to be known early in the boot process.
1515
* For other addresses refer to tc.h, ioasic_addrs.h and friends.
@@ -52,8 +52,13 @@
5252
#define KN02XA_MER_PAGERR (1<<16) /* 2k page boundary error */
5353
#define KN02XA_MER_TRANSERR (1<<15) /* transfer length error */
5454
#define KN02XA_MER_PARDIS (1<<14) /* parity error disable */
55-
#define KN02XA_MER_RES_12 (0x3<<12) /* unused */
56-
#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask */
55+
#define KN02XA_MER_SIZE (1<<13) /* r/o mirror of MSR_SIZE */
56+
#define KN02XA_MER_RES_12 (1<<12) /* unused */
57+
#define KN02XA_MER_BYTERR (0xf<<8) /* byte lane error bitmask: */
58+
#define KN02XA_MER_BYTERR_3 (0x8<<8) /* byte lane #3 */
59+
#define KN02XA_MER_BYTERR_2 (0x4<<8) /* byte lane #2 */
60+
#define KN02XA_MER_BYTERR_1 (0x2<<8) /* byte lane #1 */
61+
#define KN02XA_MER_BYTERR_0 (0x1<<8) /* byte lane #0 */
5762
#define KN02XA_MER_RES_0 (0xff<<0) /* unused */
5863

5964
/*
@@ -72,4 +77,17 @@
7277
#define KN02XA_EAR_ADDRESS (0x7ffffff<<2) /* address involved */
7378
#define KN02XA_EAR_RES_0 (0x3<<0) /* unused */
7479

80+
81+
#ifndef __ASSEMBLY__
82+
83+
#include <linux/interrupt.h>
84+
85+
struct pt_regs;
86+
87+
extern void dec_kn02xa_be_init(void);
88+
extern int dec_kn02xa_be_handler(struct pt_regs *regs, int is_fixup);
89+
extern irqreturn_t dec_kn02xa_be_interrupt(int irq, void *dev_id,
90+
struct pt_regs *regs);
91+
#endif
92+
7593
#endif /* __ASM_MIPS_DEC_KN02XA_H */

0 commit comments

Comments
 (0)