Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha Enable Pchip and Cchip error interrupts (mach...
details: https://anonhg.NetBSD.org/src/rev/2c7ed6d8e958
branches: trunk
changeset: 757968:2c7ed6d8e958
user: hans <hans%NetBSD.org@localhost>
date: Thu Oct 07 19:55:02 2010 +0000
description:
Enable Pchip and Cchip error interrupts (machine checks) on DEC 6600
systems. Add some basic pretty-printing for those errors. Tested on
a DS20.
diffstat:
sys/arch/alpha/alpha/dec_6600.c | 99 ++++++++++++++++++++++++++++++++++++-
sys/arch/alpha/include/alpha_cpu.h | 3 +-
sys/arch/alpha/include/logout.h | 40 ++++++++++++++-
sys/arch/alpha/pci/tsc.c | 33 +++++++++++-
sys/arch/alpha/pci/tsp_pci.c | 57 +++++++++++++++++++++-
sys/arch/alpha/pci/tsreg.h | 13 ++++-
sys/arch/alpha/pci/tsvar.h | 8 ++-
7 files changed, 241 insertions(+), 12 deletions(-)
diffs (truncated from 385 to 300 lines):
diff -r 555b124a3e05 -r 2c7ed6d8e958 sys/arch/alpha/alpha/dec_6600.c
--- a/sys/arch/alpha/alpha/dec_6600.c Thu Oct 07 19:39:30 2010 +0000
+++ b/sys/arch/alpha/alpha/dec_6600.c Thu Oct 07 19:55:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_6600.c,v 1.29 2009/09/14 02:46:29 mhitch Exp $ */
+/* $NetBSD: dec_6600.c,v 1.30 2010/10/07 19:55:02 hans Exp $ */
/*
* Copyright (c) 1995, 1996, 1997 Carnegie-Mellon University.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.29 2009/09/14 02:46:29 mhitch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_6600.c,v 1.30 2010/10/07 19:55:02 hans Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -44,6 +44,8 @@
#include <machine/autoconf.h>
#include <machine/cpuconf.h>
#include <machine/bus.h>
+#include <machine/alpha.h>
+#include <machine/logout.h>
#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>
@@ -83,6 +85,10 @@
void dec_6600_init(void);
static void dec_6600_cons_init(void);
static void dec_6600_device_register(struct device *, void *);
+static void dec_6600_mcheck(unsigned long, struct ev6_logout_area *);
+static void dec_6600_mcheck_sys(unsigned int, struct ev6_logout_area *);
+static void dec_6600_mcheck_handler(unsigned long, struct trapframe *,
+ unsigned long, unsigned long);
#ifdef KGDB
#include <machine/db_machdep.h>
@@ -107,8 +113,11 @@
platform.iobus = "tsc";
platform.cons_init = dec_6600_cons_init;
platform.device_register = dec_6600_device_register;
- STQP(TS_C_DIM0) = 0UL;
- STQP(TS_C_DIM1) = 0UL;
+ platform.mcheck_handler = dec_6600_mcheck_handler;
+
+ /* enable Cchip and Pchip error interrupts */
+ STQP(TS_C_DIM0) = 0xe000000000000000;
+ STQP(TS_C_DIM1) = 0xe000000000000000;
}
static void
@@ -362,3 +371,85 @@
found = 1;
}
}
+
+
+static void
+dec_6600_mcheck(unsigned long vector, struct ev6_logout_area *la)
+{
+ const char *t = "Unknown", *c = "";
+
+ if (vector == ALPHA_SYS_ERROR || vector == ALPHA_PROC_ERROR)
+ c = " Correctable";
+
+ switch (vector) {
+ case ALPHA_SYS_ERROR:
+ case ALPHA_SYS_MCHECK:
+ t = "System";
+ break;
+
+ case ALPHA_PROC_ERROR:
+ case ALPHA_PROC_MCHECK:
+ t = "Processor";
+ break;
+
+ case ALPHA_ENV_MCHECK:
+ t = "Environmental";
+ break;
+ }
+
+ printf("\n%s%s Machine Check (%lx): "
+ "Rev 0x%x, Code 0x%x, Flags 0x%x\n\n",
+ t, c, vector, la->mchk_rev, la->mchk_code, la->la.la_flags);
+}
+
+static void
+dec_6600_mcheck_sys(unsigned int indent, struct ev6_logout_area *la)
+{
+ struct ev6_logout_sys *ls =
+ (struct ev6_logout_sys *)ALPHA_LOGOUT_SYSTEM_AREA(&la->la);
+
+#define FMT "%-30s = 0x%016lx\n"
+
+ IPRINTF(indent, FMT, "Software Error Summary Flags", ls->flags);
+
+ IPRINTF(indent, FMT, "CPU Device Interrupt Requests", ls->dir);
+ tsc_print_dir(indent + 1, ls->dir);
+
+ IPRINTF(indent, FMT, "Cchip Miscellaneous Register", ls->misc);
+ tsc_print_misc(indent + 1, ls->misc);
+
+ IPRINTF(indent, FMT, "Pchip 0 Error Register", ls->p0_error);
+ if (ls->flags & 0x5)
+ tsp_print_error(indent + 1, ls->p0_error);
+
+ IPRINTF(indent, FMT, "Pchip 1 Error Register", ls->p1_error);
+ if (ls->flags & 0x6)
+ tsp_print_error(indent + 1, ls->p1_error);
+}
+
+static void
+dec_6600_mcheck_handler(unsigned long mces, struct trapframe *framep,
+ unsigned long vector, unsigned long param)
+{
+ struct mchkinfo *mcp;
+ struct ev6_logout_area *la = (struct ev6_logout_area *)param;
+
+ /*
+ * If we expected a machine check, just go handle it in common code.
+ */
+ mcp = &curcpu()->ci_mcinfo;
+ if (mcp->mc_expected)
+ machine_check(mces, framep, vector, param);
+
+ dec_6600_mcheck(vector, la);
+
+ switch (vector) {
+ case ALPHA_SYS_ERROR:
+ case ALPHA_SYS_MCHECK:
+ dec_6600_mcheck_sys(1, la);
+ break;
+
+ }
+
+ machine_check(mces, framep, vector, param);
+}
diff -r 555b124a3e05 -r 2c7ed6d8e958 sys/arch/alpha/include/alpha_cpu.h
--- a/sys/arch/alpha/include/alpha_cpu.h Thu Oct 07 19:39:30 2010 +0000
+++ b/sys/arch/alpha/include/alpha_cpu.h Thu Oct 07 19:55:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: alpha_cpu.h,v 1.48 2006/02/16 20:17:13 perry Exp $ */
+/* $NetBSD: alpha_cpu.h,v 1.49 2010/10/07 19:55:02 hans Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -183,6 +183,7 @@
#define ALPHA_PROC_ERROR 0x630 /* Processor correctable error */
#define ALPHA_SYS_MCHECK 0x660 /* System machine check */
#define ALPHA_PROC_MCHECK 0x670 /* Processor machine check */
+#define ALPHA_ENV_MCHECK 0x680 /* Environmental error */
/*
* Virtual Memory Management definitions [OSF/1 PALcode Specific]
diff -r 555b124a3e05 -r 2c7ed6d8e958 sys/arch/alpha/include/logout.h
--- a/sys/arch/alpha/include/logout.h Thu Oct 07 19:39:30 2010 +0000
+++ b/sys/arch/alpha/include/logout.h Thu Oct 07 19:55:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: logout.h,v 1.6 2005/12/11 12:16:16 christos Exp $ */
+/* $NetBSD: logout.h,v 1.7 2010/10/07 19:55:02 hans Exp $ */
/*
* Copyright (c) 1998 by Matthew Jacob
@@ -262,3 +262,41 @@
#ifdef _KERNEL
extern void ev5_logout_print(mc_hdr_ev5 *, mc_uc_ev5 *);
#endif
+
+/*
+ * EV6/67 specific Machine Check logout definitions
+ * from DS20E Service Guide, EK-K8F6W-SV. A01
+ */
+
+struct ev6_logout_area {
+ struct alpha_logout_area la;
+ uint32_t mchk_code;
+ uint32_t mchk_rev;
+};
+
+struct ev6_logout_proc {
+ uint64_t i_stat;
+ uint64_t dc_stat;
+ uint64_t c_addr;
+ uint64_t c_syndrome1;
+ uint64_t c_syndrome0;
+ uint64_t c_stat;
+ uint64_t c_sts;
+ uint64_t mm_stat;
+ uint64_t exc_addr;
+ uint64_t ier_cm;
+ uint64_t isum;
+ uint64_t _r;
+ uint64_t pal_base;
+ uint64_t i_ctl;
+ uint64_t pctx;
+};
+
+struct ev6_logout_sys {
+ uint64_t flags;
+ uint64_t dir;
+ uint64_t misc;
+ uint64_t p0_error;
+ uint64_t p1_error;
+};
+
diff -r 555b124a3e05 -r 2c7ed6d8e958 sys/arch/alpha/pci/tsc.c
--- a/sys/arch/alpha/pci/tsc.c Thu Oct 07 19:39:30 2010 +0000
+++ b/sys/arch/alpha/pci/tsc.c Thu Oct 07 19:55:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.17 2010/04/15 03:09:12 jakllsch Exp $ */
+/* $NetBSD: tsc.c,v 1.18 2010/10/07 19:55:02 hans Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@@ -35,7 +35,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.17 2010/04/15 03:09:12 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.18 2010/10/07 19:55:02 hans Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -244,3 +244,32 @@
return (0);
}
+
+void
+tsc_print_dir(unsigned int indent, unsigned long dir)
+{
+ char buf[60];
+
+ snprintb(buf, 60,
+ "\177\20"
+ "b\77Internal Cchip asynchronous error\0"
+ "b\76Pchip 0 error\0"
+ "b\75Pchip 1 error\0"
+ "b\74Pchip 2 error\0"
+ "b\73Pchip 3 error\0",
+ dir);
+ IPRINTF(indent, "DIR = %s\n", buf);
+}
+
+void
+tsc_print_misc(unsigned int indent, unsigned long misc)
+{
+ unsigned long tmp = MISC_NXM_SRC(misc);
+
+ if (!MISC_NXM(misc))
+ return;
+
+ IPRINTF(indent, "NXM address detected\n");
+ IPRINTF(indent, "NXM source = %s %lu\n",
+ tmp <= 3 ? "CPU" : "Pchip", tmp <= 3 ? tmp : tmp - 4);
+}
diff -r 555b124a3e05 -r 2c7ed6d8e958 sys/arch/alpha/pci/tsp_pci.c
--- a/sys/arch/alpha/pci/tsp_pci.c Thu Oct 07 19:39:30 2010 +0000
+++ b/sys/arch/alpha/pci/tsp_pci.c Thu Oct 07 19:55:02 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tsp_pci.c,v 1.6 2009/03/14 21:04:02 dsl Exp $ */
+/* $NetBSD: tsp_pci.c,v 1.7 2010/10/07 19:55:02 hans Exp $ */
/*-
* Copyright (c) 1999 by Ross Harvey. All rights reserved.
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tsp_pci.c,v 1.6 2009/03/14 21:04:02 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsp_pci.c,v 1.7 2010/10/07 19:55:02 hans Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -130,3 +130,56 @@
*datap = data;
alpha_mb();
}
+
+#define NTH_STR(n, ...) ((const char *[]){ __VA_ARGS__ }[n])
+
+void
+tsp_print_error(unsigned int indent, unsigned long p_error)
+{
+ char buf[40];
+
+ if (PER_INV(p_error)) {
+ IPRINTF(indent, "data invalid\n");
+ return;
+ }
+
+ if (!PER_ERR(p_error))
+ return;
+
+ snprintb(buf, 40,
+ "\177\20"
+ "b\0Error lost\0"
+ "b\1PCI SERR#\0"
+ "b\2PCI PERR#\0"
Home |
Main Index |
Thread Index |
Old Index