Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Complete support for VAX 4000/300. From Michael...
details: https://anonhg.NetBSD.org/src/rev/faf25a8a8c84
branches: trunk
changeset: 473515:faf25a8a8c84
user: ragge <ragge%NetBSD.org@localhost>
date: Sun Jun 06 14:23:46 1999 +0000
description:
Complete support for VAX 4000/300. From Michael Kukat. (michael%camaronet.de@localhost)
diffstat:
sys/arch/vax/include/ka670.h | 89 +++++++++++++++++
sys/arch/vax/vax/gencons.c | 7 +-
sys/arch/vax/vax/ka670.c | 222 +++++++++++++++++++++++++++++++++++++++++++
sys/arch/vax/vax/locore.c | 5 +-
4 files changed, 320 insertions(+), 3 deletions(-)
diffs (truncated from 374 to 300 lines):
diff -r 0d2619ff03e4 -r faf25a8a8c84 sys/arch/vax/include/ka670.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/include/ka670.h Sun Jun 06 14:23:46 1999 +0000
@@ -0,0 +1,89 @@
+/* $NetBSD: ka670.h,v 1.1 1999/06/06 14:23:46 ragge Exp $ */
+/*
+ * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Ludd by Bertram Barth.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Definitions for I/O addresses of
+ *
+ * VAX 4000/300 (KA670)
+ */
+
+#define KA670_SIDEX 0x20040004 /* SID extension register */
+#define KA670_IORESET 0x20020000 /* I/O Reset register */
+
+#define KA670_ROM_BASE 0x20040000 /* System module ROM */
+#define KA670_ROM_END 0x2007FFFF
+#define KA670_ROM_SIZE 0x40000
+
+/*
+ * The following values refer to bits/bitfields within the 4 internal
+ * registers controlling primary cache:
+ * PR_PCTAG(124, tag-register) PR_PCIDX(125, index-register)
+ * PR_PCERR(126, error-register) PR_PCSTS(127, status-register)
+ */
+#define KA670_PCTAG_TAG 0x1FFFF800 /* bits 11-29 */
+#define KA670_PCTAG_PARITY 0x40000000
+#define KA670_PCTAG_VALID 0x80000000
+
+#define KA670_PCIDX_INDEX 0x000007F8 /* 0x100 Q-word entries */
+
+#define KA670_PCERR_ADDR 0x3FFFFFFF
+
+#define KA670_PCS_FORCEHIT 0x00000001 /* Force hit */
+#define KA670_PCS_ENABLE 0x00000002 /* Enable primary cache */
+#define KA670_PCS_FLUSH 0x00000004 /* Flush cache */
+#define KA670_PCS_REFRESH 0x00000008 /* Enable refresh */
+#define KA670_PCS_HIT 0x00000010 /* Cache hit */
+#define KA670_PCS_INTERRUPT 0x00000020 /* Interrupt pending */
+#define KA670_PCS_TRAP2 0x00000040 /* Trap while trap */
+#define KA670_PCS_TRAP1 0x00000080 /* Micro trap/machine check */
+#define KA670_PCS_TPERR 0x00000100 /* Tag parity error */
+#define KA670_PCS_DPERR 0x00000200 /* Dal data parity error */
+#define KA670_PCS_PPERR 0x00000400 /* P data parity error */
+#define KA670_PCS_BUSERR 0x00000800 /* Bus error */
+#define KA670_PCS_BCHIT 0x00001000 /* B cache hit */
+
+#define KA670_PCSTS_BITS \
+ "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
+ "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
+
+#define KA670_BCSTS_BITS \
+ "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
+ "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
+
+/*
+ * Bits in PR_ACCS (Floating Point Accelerator Register)
+ */
+#define KA670_ACCS_VECTOR (1<<0) /* Vector Unit Present */
+#define KA670_ACCS_FCHIP (1<<1) /* FPU chip present */
+#define KA670_ACCS_WEP (1<<31) /* Write Even Parity */
diff -r 0d2619ff03e4 -r faf25a8a8c84 sys/arch/vax/vax/gencons.c
--- a/sys/arch/vax/vax/gencons.c Sun Jun 06 13:06:38 1999 +0000
+++ b/sys/arch/vax/vax/gencons.c Sun Jun 06 14:23:46 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gencons.c,v 1.20 1999/01/19 21:04:48 ragge Exp $ */
+/* $NetBSD: gencons.c,v 1.21 1999/06/06 14:23:46 ragge Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -66,7 +66,11 @@
static int pr_rxdb[4] = {PR_RXDB, PR_RXDB1, PR_RXDB2, PR_RXDB3};
cons_decl(gen);
+#ifdef DYNAMIC_DEVSW
+bcdev_decl(gencn);
+#else
cdev_decl(gencn);
+#endif
static int gencnparam __P((struct tty *, struct termios *));
static void gencnstart __P((struct tty *));
@@ -269,6 +273,7 @@
{
if ((vax_cputype < VAX_TYP_UV1) || /* All older has MTPR console */
(vax_boardtype == VAX_BTYP_630) ||
+ (vax_boardtype == VAX_BTYP_670) ||
(vax_boardtype == VAX_BTYP_650)) {
cndev->cn_dev = makedev(25, 0);
cndev->cn_pri = CN_NORMAL;
diff -r 0d2619ff03e4 -r faf25a8a8c84 sys/arch/vax/vax/ka670.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/vax/ka670.c Sun Jun 06 14:23:46 1999 +0000
@@ -0,0 +1,222 @@
+/* $NetBSD: ka670.c,v 1.1 1999/06/06 14:23:46 ragge Exp $ */
+/*
+ * Copyright (c) 1999 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to Ludd by Bertram Barth.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+
+#include <machine/pte.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/pmap.h>
+#include <machine/nexus.h>
+#include <machine/uvax.h>
+#include <machine/vsbus.h>
+#include <machine/ka670.h>
+#include <machine/clock.h>
+
+static void ka670_conf __P((struct device*, struct device*, void*));
+
+static int ka670_mchk __P((caddr_t));
+static void ka670_memerr __P((void));
+static int ka670_cache_init __P((void)); /* "int mapen" as argument? */
+static void ka670_halt __P((void));
+static void ka670_reboot __P((int));
+static void ka670_clrf __P((void));
+
+
+struct cpu_dep ka670_calls = {
+ 0,
+ ka670_mchk,
+ ka670_memerr,
+ ka670_conf,
+ generic_clkread,
+ generic_clkwrite,
+ 8, /* 8 VUP */
+ 2, /* SCB pages */
+ ka670_halt,
+ ka670_reboot,
+ ka670_clrf,
+};
+
+#define KA670_MC_RESTART 0x00008000 /* Restart possible*/
+#define KA670_PSL_FPDONE 0x00010000 /* First Part Done */
+
+struct ka670_mcframe { /* Format of RigelMAX machine check frame: */
+ int mc670_bcnt; /* byte count, always 24 (0x18) */
+ int mc670_code; /* machine check type code and restart bit */
+ int mc670_addr; /* most recent (faulting?) virtual address */
+ int mc670_viba; /* contents of VIBA register */
+ int mc670_sisr; /* ICCS bit 6 and SISR bits 15:0 */
+ int mc670_istate; /* internal state */
+ int mc670_sc; /* shift count register */
+ int mc670_pc; /* trapped PC */
+ int mc670_psl; /* trapped PSL */
+};
+
+static char *ka670_mctype[] = {
+ "no error (0)", /* Code 0: No error */
+ "FPA: protocol error", /* Code 1-5: FPA errors */
+ "FPA: illegal opcode",
+ "FPA: operand parity error",
+ "FPA: unknown status",
+ "FPA: result parity error",
+ "unused (6)", /* Code 6-7: Unused */
+ "unused (7)",
+ "MMU error (TLB miss)", /* Code 8-9: MMU errors */
+ "MMU error (TLB hit)",
+ "HW interrupt at unused IPL", /* Code 10: Interrupt error */
+ "MOVCx impossible state", /* Code 11-13: Microcode errors */
+ "undefined trap code (i-box)",
+ "undefined control store address",
+ "unused (14)", /* Code 14-15: Unused */
+ "unused (15)",
+ "PC tag or data parity error", /* Code 16: Cache error */
+ "data bus parity error", /* Code 17: Read error */
+ "data bus error (NXM)", /* Code 18: Write error */
+ "undefined data bus state", /* Code 19: Bus error */
+};
+#define MC670_MAX 19
+
+static int ka670_error_count = 0;
+
+int
+ka670_mchk(addr)
+ caddr_t addr;
+{
+ register struct ka670_mcframe *mcf = (void*)addr;
+
+ mtpr(0x00, PR_MCESR); /* Acknowledge the machine check */
+ printf("machine check %d (0x%x)\n", mcf->mc670_code, mcf->mc670_code);
+ printf("reason: %s\n", ka670_mctype[mcf->mc670_code & 0xff]);
+ if (++ka670_error_count > 10) {
+ printf("error_count exceeded: %d\n", ka670_error_count);
+ return (-1);
+ }
+
+ /*
+ * If either the Restart flag is set or the First-Part-Done flag
+ * is set, and the TRAP2 (double error) bit is not set, the the
+ * error is recoverable.
+ */
+ if (mfpr(PR_PCSTS) & KA670_PCS_TRAP2) {
+ printf("TRAP2 (double error) in ka670_mchk.\n");
+ panic("unrecoverable state in ka670_mchk.\n");
+ return (-1);
+ }
+ if ((mcf->mc670_code & KA670_MC_RESTART) ||
+ (mcf->mc670_psl & KA670_PSL_FPDONE)) {
+ printf("ka670_mchk: recovering from machine-check.\n");
+ ka670_cache_init(); /* reset caches */
+ return (0); /* go on; */
+ }
+
+ /*
+ * Unknown error state, panic/halt the machine!
+ */
+ printf("ka670_mchk: unknown error state!\n");
+ return (-1);
+}
+
+void
+ka670_memerr()
+{
+ /*
+ * Don\'t know what to do here. So just print some messages
+ * and try to go on...
+ */
+ printf("memory error!\n");
+ printf("primary cache status: %b\n", mfpr(PR_PCSTS), KA670_PCSTS_BITS);
+ printf("secondary cache status: %b\n", mfpr(PR_BCSTS), KA670_BCSTS_BITS);
+}
+
+int
+ka670_cache_init()
+{
+ int val;
+
Home |
Main Index |
Thread Index |
Old Index