summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1996-05-03 09:10:29 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1996-05-03 09:10:29 +0000
commit595cbd2e050401adf0cab2bab6ce52f902dfbb54 (patch)
tree8474c159022572bb93d15b7f2c287d1044321bc1 /sys/arch
parent3472e7ae763d3e453e57b218243b6d60ece25b43 (diff)
sync w/ 0430
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/vax/Makefile5
-rw-r--r--sys/arch/vax/boot/Makefile12
-rw-r--r--sys/arch/vax/boot/autoconf.c32
-rw-r--r--sys/arch/vax/boot/bootxx.c16
-rw-r--r--sys/arch/vax/boot/conf.c5
-rw-r--r--sys/arch/vax/boot/ctu.c181
-rw-r--r--sys/arch/vax/boot/devopen.c5
-rw-r--r--sys/arch/vax/boot/hp.c10
-rw-r--r--sys/arch/vax/boot/ra.c6
-rw-r--r--sys/arch/vax/boot/srt0.s13
-rw-r--r--sys/arch/vax/boot/start.s7
-rw-r--r--sys/arch/vax/boot/tmscp.c10
-rw-r--r--sys/arch/vax/boot/vaxstand.h6
-rw-r--r--sys/arch/vax/conf/EVERYTHING3
-rw-r--r--sys/arch/vax/conf/GENERIC55
-rw-r--r--sys/arch/vax/conf/Makefile.vax189
-rw-r--r--sys/arch/vax/conf/files.vax208
-rw-r--r--sys/arch/vax/conf/mkoldconf.awk54
-rw-r--r--sys/arch/vax/consolerl/Makefile29
-rw-r--r--sys/arch/vax/consolerl/anyboo.com18
-rw-r--r--sys/arch/vax/consolerl/defboo.hk18
-rw-r--r--sys/arch/vax/consolerl/defboo.hp18
-rw-r--r--sys/arch/vax/consolerl/defboo.ra18
-rw-r--r--sys/arch/vax/consolerl/defboo.up18
-rw-r--r--sys/arch/vax/consolerl/hkmboo.com18
-rw-r--r--sys/arch/vax/consolerl/hksboo.com18
-rw-r--r--sys/arch/vax/consolerl/hpmboo.com18
-rw-r--r--sys/arch/vax/consolerl/hpsboo.com18
-rw-r--r--sys/arch/vax/consolerl/ramboo.com18
-rw-r--r--sys/arch/vax/consolerl/rasboo.com18
-rw-r--r--sys/arch/vax/consolerl/upmboo.com18
-rw-r--r--sys/arch/vax/consolerl/upsboo.com18
-rw-r--r--sys/arch/vax/floppy/Makefile45
-rw-r--r--sys/arch/vax/floppy/NOTE5
-rw-r--r--sys/arch/vax/floppy/anyboo.cmd13
-rw-r--r--sys/arch/vax/floppy/defboo.MS780C-interleaved17
-rw-r--r--sys/arch/vax/floppy/defboo.hk14
-rw-r--r--sys/arch/vax/floppy/defboo.hp14
-rw-r--r--sys/arch/vax/floppy/defboo.kra14
-rw-r--r--sys/arch/vax/floppy/defboo.ra14
-rw-r--r--sys/arch/vax/floppy/defboo.up14
-rw-r--r--sys/arch/vax/floppy/hkmboo.cmd13
-rw-r--r--sys/arch/vax/floppy/hksboo.cmd13
-rw-r--r--sys/arch/vax/floppy/hpmboo.cmd13
-rw-r--r--sys/arch/vax/floppy/hpsboo.cmd13
-rw-r--r--sys/arch/vax/floppy/ramboo.cmd13
-rw-r--r--sys/arch/vax/floppy/rasboo.cmd13
-rw-r--r--sys/arch/vax/floppy/restar.cmd16
-rw-r--r--sys/arch/vax/floppy/upmboo.cmd13
-rw-r--r--sys/arch/vax/floppy/upsboo.cmd13
-rw-r--r--sys/arch/vax/floppy/utboot.cmd20
-rw-r--r--sys/arch/vax/if/if_de.c125
-rw-r--r--sys/arch/vax/if/if_dereg.h4
-rw-r--r--sys/arch/vax/if/if_qe.c120
-rw-r--r--sys/arch/vax/if/if_uba.c56
-rw-r--r--sys/arch/vax/if/if_uba.h11
-rw-r--r--sys/arch/vax/include/ansi.h3
-rw-r--r--sys/arch/vax/include/cpu.h33
-rw-r--r--sys/arch/vax/include/db_machdep.h4
-rw-r--r--sys/arch/vax/include/endian.h10
-rw-r--r--sys/arch/vax/include/ioa.h118
-rw-r--r--sys/arch/vax/include/ka650.h11
-rw-r--r--sys/arch/vax/include/ka750.h11
-rw-r--r--sys/arch/vax/include/macros.h6
-rw-r--r--sys/arch/vax/include/mtpr.h24
-rw-r--r--sys/arch/vax/include/nexus.h25
-rw-r--r--sys/arch/vax/include/param.h20
-rw-r--r--sys/arch/vax/include/pcb.h4
-rw-r--r--sys/arch/vax/include/pmap.h16
-rw-r--r--sys/arch/vax/include/pte.h12
-rw-r--r--sys/arch/vax/include/rsp.h89
-rw-r--r--sys/arch/vax/include/trap.h8
-rw-r--r--sys/arch/vax/include/types.h7
-rw-r--r--sys/arch/vax/include/uvaxII.h15
-rw-r--r--sys/arch/vax/include/vmparam.h4
-rw-r--r--sys/arch/vax/mba/hp.c719
-rw-r--r--sys/arch/vax/mba/hpreg.h44
-rw-r--r--sys/arch/vax/mba/mba.c343
-rw-r--r--sys/arch/vax/mba/mbareg.h21
-rw-r--r--sys/arch/vax/mba/mbavar.h107
-rw-r--r--sys/arch/vax/stand/Makefile12
-rw-r--r--sys/arch/vax/stand/autoconf.c32
-rw-r--r--sys/arch/vax/stand/bootxx.c16
-rw-r--r--sys/arch/vax/stand/conf.c5
-rw-r--r--sys/arch/vax/stand/ctu.c181
-rw-r--r--sys/arch/vax/stand/devopen.c5
-rw-r--r--sys/arch/vax/stand/hp.c10
-rw-r--r--sys/arch/vax/stand/ra.c6
-rw-r--r--sys/arch/vax/stand/srt0.s13
-rw-r--r--sys/arch/vax/stand/start.s7
-rw-r--r--sys/arch/vax/stand/tmscp.c10
-rw-r--r--sys/arch/vax/stand/vaxstand.h6
-rw-r--r--sys/arch/vax/uba/dhu.c858
-rw-r--r--sys/arch/vax/uba/dhureg.h140
-rw-r--r--sys/arch/vax/uba/dz.c819
-rw-r--r--sys/arch/vax/uba/dzreg.h116
-rw-r--r--sys/arch/vax/uba/tmscp.c171
-rw-r--r--sys/arch/vax/uba/ts.c140
-rw-r--r--sys/arch/vax/uba/uba.c476
-rw-r--r--sys/arch/vax/uba/ubareg.h8
-rw-r--r--sys/arch/vax/uba/ubavar.h48
-rw-r--r--sys/arch/vax/uba/uda.c82
-rw-r--r--sys/arch/vax/vax/autoconf.c352
-rw-r--r--sys/arch/vax/vax/clock.c53
-rw-r--r--sys/arch/vax/vax/conf.c17
-rw-r--r--sys/arch/vax/vax/crl.c264
-rw-r--r--sys/arch/vax/vax/crl.h78
-rw-r--r--sys/arch/vax/vax/ctu.c411
-rw-r--r--sys/arch/vax/vax/db_disasm.c11
-rw-r--r--sys/arch/vax/vax/db_machdep.c66
-rw-r--r--sys/arch/vax/vax/disksubr.c35
-rw-r--r--sys/arch/vax/vax/gencons.c74
-rw-r--r--sys/arch/vax/vax/gencons.h9
-rw-r--r--sys/arch/vax/vax/in_cksum.c152
-rw-r--r--sys/arch/vax/vax/intvec.s186
-rw-r--r--sys/arch/vax/vax/ka650.c43
-rw-r--r--sys/arch/vax/vax/ka750.c85
-rw-r--r--sys/arch/vax/vax/ka780.c341
-rw-r--r--sys/arch/vax/vax/ka860.c327
-rw-r--r--sys/arch/vax/vax/locore.c38
-rw-r--r--sys/arch/vax/vax/machdep.c213
-rw-r--r--sys/arch/vax/vax/mem.c9
-rw-r--r--sys/arch/vax/vax/mscp.c90
-rw-r--r--sys/arch/vax/vax/mscpvar.h45
-rw-r--r--sys/arch/vax/vax/ns_cksum.c163
-rw-r--r--sys/arch/vax/vax/pmap.c256
-rw-r--r--sys/arch/vax/vax/rootfil.c110
-rw-r--r--sys/arch/vax/vax/sbi.c66
-rw-r--r--sys/arch/vax/vax/subr.s119
-rw-r--r--sys/arch/vax/vax/swapgeneric.c41
-rw-r--r--sys/arch/vax/vax/trap.c145
-rw-r--r--sys/arch/vax/vax/uvaxII.c265
-rw-r--r--sys/arch/vax/vax/vm_machdep.c223
133 files changed, 8545 insertions, 2243 deletions
diff --git a/sys/arch/vax/Makefile b/sys/arch/vax/Makefile
new file mode 100644
index 00000000000..97de99cb8b3
--- /dev/null
+++ b/sys/arch/vax/Makefile
@@ -0,0 +1,5 @@
+# $NetBSD: Makefile,v 1.1 1996/03/16 11:03:11 ragge Exp $
+#
+SUBDIR= boot
+
+.include <bsd.subdir.mk>
diff --git a/sys/arch/vax/boot/Makefile b/sys/arch/vax/boot/Makefile
index f6763596bc0..0078dcd8cfc 100644
--- a/sys/arch/vax/boot/Makefile
+++ b/sys/arch/vax/boot/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 1995/12/28 15:27:21 ragge Exp $
+# $NetBSD: Makefile,v 1.9 1996/03/16 11:03:12 ragge Exp $
#
INCPATH=-I. -I../../.. -I../.. -I../../../lib/libsa
@@ -11,7 +11,7 @@ S= ../../..
RELOC= 100000
CFLAGS+=-O ${INCPATH} -DSTANDALONE -DRELOC=0x${RELOC} -D_VAX_INLINE_
-DEVS= autoconf.o hp.o ra.o tmscp.o
+DEVS= autoconf.o hp.o ra.o tmscp.o ctu.o
LIBKERN=libkern.a
KERNOBJ=__main.o strlen.o strcmp.o strncmp.o strncpy.o min.o strcpy.o
@@ -102,6 +102,14 @@ libkern.a: ${KERNOBJ}
@ar rv libkern.a `lorder ${KERNOBJ} | tsort`
#
+install: boot xxboot
+ install -c -o ${BINOWN} -g ${BINGRP} -m 444 boot ${DESTDIR}/
+ install -c -o ${BINOWN} -g ${BINGRP} -m 444 xxboot ${DESTDIR}/usr/mdec
+ rm -f ${DESTDIR}/usr/mdec/raboot
+ ln ${DESTDIR}/usr/mdec/xxboot ${DESTDIR}/usr/mdec/raboot
+ rm -f ${DESTDIR}/usr/mdec/hpboot
+ ln ${DESTDIR}/usr/mdec/xxboot ${DESTDIR}/usr/mdec/hpboot
+
clean::
rm -f start.o romread.o bootxx.o init.o xxboot boot racopy \
libsvax.a udiv.o urem.o consio.o ${DEVS} edlabel edlabel.o
diff --git a/sys/arch/vax/boot/autoconf.c b/sys/arch/vax/boot/autoconf.c
index 654d6a68680..ca08f01214a 100644
--- a/sys/arch/vax/boot/autoconf.c
+++ b/sys/arch/vax/boot/autoconf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.3 1995/09/16 13:34:20 ragge Exp $ */
+/* $NetBSD: autoconf.c,v 1.5 1996/03/07 23:27:06 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -47,6 +47,14 @@ static int uba750[]={0xf30000,0xf32000};
static int uio750[]={0xfc0000,0xf80000};
static int uda750[]={0772150};
+/* 11/780's only have 4, 8600 have 8 of these. */
+static int mba780[]={0x20010000,0x20012000,0x20014000,0x20016000,
+ 0x22010000,0x22012000,0x22014000,0x22016000};
+static int uba780[]={0x20006000,0x20008000,0x2000a000,0x2000c000,
+ 0x22006000,0x22008000,0x2200a000,0x2200c000};
+static int uio780[]={0x20100000,0x20140000,0x20180000,0x201c0000,
+ 0x22100000,0x22140000,0x22180000,0x221c0000};
+
static int uba630[]={0x20087800};
static int uio630[]={0x30000000};
#define qbdev(csr) (((csr) & 017777)-0x10000000)
@@ -67,6 +75,28 @@ autoconf()
printf("CPU type %d not supported by boot\n",i);
asm("halt");
+ case VAX_8600:
+ nmba = 8;
+ nuba = 8;
+ nuda = 1;
+ mbaaddr = mba780;
+ ubaaddr = uba780;
+ udaaddr = uda750;
+ uioaddr = uio780;
+ tmsaddr = 0774500;
+ break;
+
+ case VAX_780:
+ nmba = 4;
+ nuba = 4;
+ nuda = 1;
+ mbaaddr = mba780;
+ ubaaddr = uba780;
+ udaaddr = uda750;
+ uioaddr = uio780;
+ tmsaddr = 0774500;
+ break;
+
case VAX_750:
nmba = 3;
nuba = 2;
diff --git a/sys/arch/vax/boot/bootxx.c b/sys/arch/vax/boot/bootxx.c
index b60d7e7931c..4a1b34f83d6 100644
--- a/sys/arch/vax/boot/bootxx.c
+++ b/sys/arch/vax/boot/bootxx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bootxx.c,v 1.4 1995/10/20 13:35:43 ragge Exp $ */
+/* $NetBSD: bootxx.c,v 1.5 1996/02/17 18:23:21 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@@ -41,15 +41,15 @@
#include "lib/libsa/stand.h"
#include "lib/libsa/ufs.h"
-#include "../mba/mbareg.h"
-#include "../mba/hpreg.h"
-
#include "../include/pte.h"
#include "../include/sid.h"
#include "../include/mtpr.h"
#include "../include/reg.h"
#include "../include/rpb.h"
+#include "../mba/mbareg.h"
+#include "../mba/hpreg.h"
+
#define NRSP 0 /* Kludge */
#define NCMD 0 /* Kludge */
#include "../uba/ubareg.h"
@@ -197,6 +197,10 @@ getbootdev()
is_tmscp = 1; /* use tape spec in mscp routines */
break;
+ case 64:
+ major = 8;
+ break;
+
default:
printf("Unsupported boot device %d, trying anyway.\n", bootdev);
boothowto |= (RB_SINGLE | RB_ASKNAME);
@@ -236,7 +240,7 @@ devopen(f, fname, file)
char line[64];
f->f_dev = &devsw[0];
- *file = fname;
+ *file = (char *)fname;
/*
* On uVAX we need to init [T]MSCP ctlr to be able to use it.
@@ -382,7 +386,7 @@ hpread(block, size, buf)
pfnum = (u_int) buf >> PGSHIFT;
for (mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG)
- mr->mba_map[mapnr++] = PG_V | pfnum++;
+ *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++;
mr->mba_var = ((u_int) buf & PGOFSET);
mr->mba_bc = (~size) + 1;
bn = block;
diff --git a/sys/arch/vax/boot/conf.c b/sys/arch/vax/boot/conf.c
index 15236d763df..f516c4d2c3a 100644
--- a/sys/arch/vax/boot/conf.c
+++ b/sys/arch/vax/boot/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.4 1995/09/16 13:18:28 ragge Exp $ */
+/* $NetBSD: conf.c,v 1.5 1996/02/17 18:23:18 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -40,6 +40,7 @@
int raopen(), rastrategy();
int hpopen(), hpstrategy();
+int ctuopen(), ctustrategy();
int tmscpopen(), tmscpstrategy();
struct devsw devsw[]={
@@ -51,7 +52,7 @@ struct devsw devsw[]={
SADEV("tm",nullsys, nodev, nullsys, noioctl),
SADEV("ts",nullsys, nodev, nullsys, noioctl),
SADEV("mt",nullsys, nodev, nullsys, noioctl),
- SADEV("tu",nullsys, nodev, nullsys, noioctl),
+ SADEV("ctu",ctustrategy, ctuopen, nullsys, noioctl),
SADEV("ra",rastrategy, raopen, nullsys, noioctl),
SADEV("ut",nullsys, nodev, nullsys, noioctl),
SADEV("id",nullsys, nodev, nullsys, noioctl),
diff --git a/sys/arch/vax/boot/ctu.c b/sys/arch/vax/boot/ctu.c
new file mode 100644
index 00000000000..26f29525160
--- /dev/null
+++ b/sys/arch/vax/boot/ctu.c
@@ -0,0 +1,181 @@
+/* $NetBSD: ctu.c,v 1.1 1996/02/17 18:23:20 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Standalone device driver for 11/750 Console TU58.
+ * It can only handle reads, and doesn't calculate checksum.
+ */
+
+#include <sys/param.h>
+
+#include <lib/libsa/stand.h>
+
+#include <machine/mtpr.h>
+#include <machine/rsp.h>
+
+enum tu_state {
+ SC_INIT,
+ SC_READY,
+ SC_SEND_CMD,
+ SC_GET_RESP,
+};
+
+volatile struct tu_softc {
+ enum tu_state sc_state;
+ char sc_rsp[15]; /* Should be struct rsb; but don't work */
+ u_char *sc_xfptr; /* Current char to xfer */
+ int sc_nbytes; /* Number of bytes to xfer */
+ int sc_xbytes; /* Number of xfer'd bytes */
+ int sc_bbytes; /* Number of xfer'd bytes this block */
+} tu_sc;
+
+void ctutintr __P(());
+void cturintr __P(());
+
+int
+ctuopen(f, adapt, ctlr, unit, part)
+ struct open_file *f;
+ int ctlr, unit, part;
+{
+
+ tu_sc.sc_state = SC_INIT;
+
+ mtpr(RSP_TYP_INIT, PR_CSTD);
+ cturintr();
+ tu_sc.sc_state = SC_READY;
+ return 0;
+
+}
+
+int
+ctustrategy(ra, func, dblk, size, buf, rsize)
+ struct ra_softc *ra;
+ int func;
+ daddr_t dblk;
+ char *buf;
+ u_int size, *rsize;
+{
+ int s;
+
+ struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
+
+ tu_sc.sc_xfptr = buf;
+ tu_sc.sc_nbytes = size;
+ tu_sc.sc_xbytes = tu_sc.sc_bbytes = 0;
+
+ rsp->rsp_typ = RSP_TYP_COMMAND;
+ rsp->rsp_sz = 012;
+ rsp->rsp_op = RSP_OP_READ;
+ rsp->rsp_mod = 0;
+ rsp->rsp_drv = 0;
+ rsp->rsp_sw = rsp->rsp_xx1 = rsp->rsp_xx2 = 0;
+ rsp->rsp_cnt = tu_sc.sc_nbytes;
+ rsp->rsp_blk = dblk;
+ rsp->rsp_sum = ctu_cksum(rsp, 6);
+ tu_sc.sc_state = SC_SEND_CMD;
+ while (tu_sc.sc_state != SC_GET_RESP)
+ ctutintr();
+ while (tu_sc.sc_state != SC_READY)
+ cturintr();
+ *rsize = size;
+ return 0;
+}
+
+void
+cturintr()
+{
+ int status;
+
+ while ((mfpr(PR_CSRS) & 0x80) == 0)
+ ;
+
+ status = mfpr(PR_CSRD);
+
+ switch (tu_sc.sc_state) {
+
+ case SC_INIT:
+ break;
+
+ case SC_GET_RESP:
+ if (tu_sc.sc_xbytes == tu_sc.sc_nbytes) {
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes == 146)
+ tu_sc.sc_state = SC_READY;
+ break;
+ }
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes < 3) /* Data header */
+ break;
+ if (tu_sc.sc_bbytes == 132) { /* Finished */
+ tu_sc.sc_bbytes = 0;
+ break;
+ }
+ if (tu_sc.sc_bbytes == 131) /* First checksum */
+ break;
+ tu_sc.sc_xfptr[tu_sc.sc_xbytes++] = status;
+ break;
+
+ }
+
+}
+
+void
+ctutintr()
+{
+ int c;
+
+ while ((mfpr(PR_CSTS) & 0x80) == 0)
+ ;
+
+ c = tu_sc.sc_rsp[tu_sc.sc_xbytes++] & 0xff;
+ mtpr(c, PR_CSTD);
+ if (tu_sc.sc_xbytes > 13) {
+ tu_sc.sc_state = SC_GET_RESP;
+ tu_sc.sc_xbytes = 0;
+ }
+}
+
+ctu_cksum(buf, words)
+ unsigned short *buf;
+ int words;
+{
+ int i, cksum;
+
+ for (i = cksum = 0; i < words; i++)
+ cksum += buf[i];
+
+hej: if (cksum > 65535) {
+ cksum = (cksum & 65535) + (cksum >> 16);
+ goto hej;
+ }
+ return cksum;
+}
diff --git a/sys/arch/vax/boot/devopen.c b/sys/arch/vax/boot/devopen.c
index 6200f477f49..d3468b427dd 100644
--- a/sys/arch/vax/boot/devopen.c
+++ b/sys/arch/vax/boot/devopen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.3 1995/09/16 13:18:29 ragge Exp $ */
+/* $NetBSD: devopen.c,v 1.4 1996/03/16 11:02:28 ragge Exp $ */
/*-
* Copyright (c) 1993 John Brezak
* All rights reserved.
@@ -182,13 +182,14 @@ devopen(f, fname, file)
{
int n, error;
int dev, ctlr, unit, part;
- int adapt = 0; /* XXX not used on HP */
+ int adapt;
struct devsw *dp = &devsw[0];
dev = B_TYPE(bootdev);
ctlr = B_CONTROLLER(bootdev);
unit = B_UNIT(bootdev);
part = B_PARTITION(bootdev);
+ adapt = B_ADAPTOR(bootdev);
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
return(error);
diff --git a/sys/arch/vax/boot/hp.c b/sys/arch/vax/boot/hp.c
index c7019a3527d..74400d2470d 100644
--- a/sys/arch/vax/boot/hp.c
+++ b/sys/arch/vax/boot/hp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hp.c,v 1.4 1995/09/16 15:43:25 ragge Exp $ */
+/* $NetBSD: hp.c,v 1.5 1996/02/17 18:23:22 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -38,12 +38,12 @@
#include "lib/libsa/stand.h"
-#include "../mba/mbareg.h"
-#include "../mba/hpreg.h"
-
#include "../include/pte.h"
#include "../include/macros.h"
+#include "../mba/mbareg.h"
+#include "../mba/hpreg.h"
+
#include "vaxstand.h"
/*
@@ -132,7 +132,7 @@ hpstrategy(hs, func, dblk, size, buf, rsize)
pfnum = (u_int)buf >> PGSHIFT;
for(mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG)
- mr->mba_map[mapnr++] = PG_V | pfnum++;
+ *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++;
mr->mba_var = ((u_int)buf & PGOFSET);
mr->mba_bc = (~size) + 1;
diff --git a/sys/arch/vax/boot/ra.c b/sys/arch/vax/boot/ra.c
index a0ecefc1a1b..43e368fe098 100644
--- a/sys/arch/vax/boot/ra.c
+++ b/sys/arch/vax/boot/ra.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ra.c,v 1.3 1995/09/16 13:34:22 ragge Exp $ */
+/* $NetBSD: ra.c,v 1.4 1996/02/17 18:23:23 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -96,7 +96,7 @@ raopen(f, adapt, ctlr, unit, part)
ra->unit=unit;
ra->part = part;
udacsr=(void*)ra->udaddr;
- nisse=&mr->uba_map[0];
+ nisse=(u_int *)&mr->uba_map[0];
nisse[494]=PG_V|(((u_int)&uda)>>9);
nisse[495]=nisse[494]+1;
ubauda=(void*)0x3dc00+(((u_int)(&uda))&0x1ff);
@@ -163,7 +163,7 @@ rastrategy(ra, func, dblk, size, buf, rsize)
ur = (void *)ra->ubaddr;
udadev = (void*)ra->udaddr;
- ptmapp = &ur->uba_map[0];
+ ptmapp = (u_int *)&ur->uba_map[0];
lp = &ralabel;
pfnum = (u_int)buf >> PGSHIFT;
diff --git a/sys/arch/vax/boot/srt0.s b/sys/arch/vax/boot/srt0.s
index a85d02538ba..1fc8dfca8e3 100644
--- a/sys/arch/vax/boot/srt0.s
+++ b/sys/arch/vax/boot/srt0.s
@@ -1,4 +1,4 @@
-/* $NetBSD: srt0.s,v 1.4 1995/09/16 16:20:20 ragge Exp $ */
+/* $NetBSD: srt0.s,v 1.5 1996/03/07 23:27:10 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -48,11 +48,12 @@ _start: .globl _start
movl $_start, sp # Probably safe place for stack
subl2 $52, sp # do not overwrite saved boot-registers
- subl3 $_start, $_end, r0
- moval _start, r1
- movl $_start, r2
- movc3 r0, (r1), (r2) # should use movc5 instead, to clear bss.
-
+ subl3 $_start, $_edata, r0
+ moval _start, r1
+ subl3 $_start, $_end, r2
+ movl $_start, r3
+ movc5 r0, (r1), $0, r2, (r3)
+
jsb 1f
1: movl $relocated, (sp) # return-address on top of stack
rsb # can be replaced with new address
diff --git a/sys/arch/vax/boot/start.s b/sys/arch/vax/boot/start.s
index 80040a7c2d7..55b2fc0438a 100644
--- a/sys/arch/vax/boot/start.s
+++ b/sys/arch/vax/boot/start.s
@@ -1,4 +1,4 @@
-/* $NetBSD: start.s,v 1.5 1995/10/20 13:35:41 ragge Exp $ */
+/* $NetBSD: start.s,v 1.7 1996/02/02 19:08:33 mycroft Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -36,11 +36,10 @@
/* All bugs are subject to removal without further notice */
-#define LOCORE
+#define _LOCORE
+
#include "sys/disklabel.h"
-#undef LOCORE
-#define ASSEMBLER
#include "../include/mtpr.h"
#include "../include/asm.h"
diff --git a/sys/arch/vax/boot/tmscp.c b/sys/arch/vax/boot/tmscp.c
index eb143e61426..f5d0fe11879 100644
--- a/sys/arch/vax/boot/tmscp.c
+++ b/sys/arch/vax/boot/tmscp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tmscp.c,v 1.1 1995/09/16 12:57:35 ragge Exp $ */
+/* $NetBSD: tmscp.c,v 1.2 1996/02/17 18:23:24 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -91,7 +91,7 @@ tmscpopen(f, adapt, ctlr, unit, part)
ra->ubaddr=(int)mr;
ra->unit=unit;
udacsr=(void*)ra->udaddr;
- nisse=&mr->uba_map[0];
+ nisse=(u_int *)&mr->uba_map[0];
nisse[494]=PG_V|(((u_int)&uda)>>9);
nisse[495]=nisse[494]+1;
ubauda=(void*)0x3dc00+(((u_int)(&uda))&0x1ff);
@@ -112,8 +112,8 @@ tmscpopen(f, adapt, ctlr, unit, part)
uda.uda_ca.ca_rspdsc=(int)&ubauda->uda_rsp.mscp_cmdref;
uda.uda_ca.ca_cmddsc=(int)&ubauda->uda_cmd.mscp_cmdref;
- uda.uda_cmd.mscp_un.un_seq.seq_addr = &uda.uda_ca.ca_cmddsc;
- uda.uda_rsp.mscp_un.un_seq.seq_addr = &uda.uda_ca.ca_rspdsc;
+ uda.uda_cmd.mscp_un.un_seq.seq_addr = (long *)&uda.uda_ca.ca_cmddsc;
+ uda.uda_rsp.mscp_un.un_seq.seq_addr = (long *)&uda.uda_ca.ca_rspdsc;
uda.uda_cmd.mscp_vcid = 1;
uda.uda_cmd.mscp_un.un_sccc.sccc_ctlrflags = 0;
@@ -164,7 +164,7 @@ tmscpstrategy(ra, func, dblk, size, buf, rsize)
u_int i,j,pfnum, mapnr, nsize, bn, cn, sn, tn;
volatile struct uba_regs *ur=(void *)ra->ubaddr;
volatile struct udadevice *udadev=(void*)ra->udaddr;
- volatile u_int *ptmapp=&ur->uba_map[0];
+ volatile u_int *ptmapp = (u_int *)&ur->uba_map[0];
volatile int hej;
pfnum=(u_int)buf>>PGSHIFT;
diff --git a/sys/arch/vax/boot/vaxstand.h b/sys/arch/vax/boot/vaxstand.h
index 17ec1cbcd03..f3217fdb235 100644
--- a/sys/arch/vax/boot/vaxstand.h
+++ b/sys/arch/vax/boot/vaxstand.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vaxstand.h,v 1.3 1995/04/25 14:14:34 ragge Exp $ */
+/* $NetBSD: vaxstand.h,v 1.4 1996/02/17 18:23:25 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -44,8 +44,8 @@ extern int *ubaaddr, *mbaaddr, *udaaddr, *uioaddr;
/* devsw type definitions, used in bootxx and conf */
#define SADEV(name,strategy,open,close,ioctl) \
- { name, \
- (int(*)(void *, int ,daddr_t , u_int , char *, u_int *))strategy, \
+ { (char *)name, \
+ (int(*)(void *, int ,daddr_t , size_t, void *, size_t *))strategy, \
(int(*)(struct open_file *, ...))open, \
(int(*)(struct open_file *))close, \
(int(*)(struct open_file *,u_long, void *))ioctl}
diff --git a/sys/arch/vax/conf/EVERYTHING b/sys/arch/vax/conf/EVERYTHING
index 97703691c5c..2624f10ef11 100644
--- a/sys/arch/vax/conf/EVERYTHING
+++ b/sys/arch/vax/conf/EVERYTHING
@@ -1,3 +1,4 @@
+# $OpenBSD: EVERYTHING,v 1.2 1996/05/03 09:09:07 mickey Exp $
# $NetBSD: EVERYTHING,v 1.1 1995/03/29 22:54:02 ragge Exp $
#
# This file contains everything that is known to be compiled
@@ -64,7 +65,7 @@ options LKM
# Kernel(s) to compile
-config vmunix root on hp0 swap on hp0
+config bsd root on hp0 swap on hp0
# All supported CPU:s
cpu0 at backplane0
diff --git a/sys/arch/vax/conf/GENERIC b/sys/arch/vax/conf/GENERIC
index 6c0176464b0..03306e42244 100644
--- a/sys/arch/vax/conf/GENERIC
+++ b/sys/arch/vax/conf/GENERIC
@@ -1,38 +1,42 @@
-# $NetBSD: GENERIC,v 1.8 1995/11/30 00:59:20 jtc Exp $
+# $OpenBSD: GENERIC,v 1.3 1996/05/03 09:09:08 mickey Exp $
+# $NetBSD: GENERIC,v 1.12 1996/03/17 22:56:29 ragge Exp $
#
-# GENERIC VAX, currently only supports 11/750 anyway.
+# GENERIC VAX configuration file; all supported devices.
#
include "std.vax"
# Here are all different supported CPU types listed.
+options "VAX8600"
+options "VAX780"
options "VAX750"
options "VAX630"
+options "VAX650"
# Kernel identification
options GENERIC
# Max users on system; this is just a hint
-maxusers 16
+maxusers 8
# Paging system, we always have them all.
options SWAPPAGER, DEVPAGER, VNODEPAGER
# Kernel compiled-in symbolic debugger & system call tracer
-#options DDB
+options DDB
options KTRACE
+options DIAGNOSTIC
# Network support
#options GATEWAY
options INET
-options ETHER
# All supported filesystem types
options FFS,QUOTA
options LFS
options MFS
-options NFSSERVER
options NFSCLIENT
+options NFSSERVER
options FDESC
options FIFO
options KERNFS
@@ -46,31 +50,34 @@ options SYSVMSG
options SYSVSEM
options SYSVSHM
-# Old compat stuff; needed to run 4.3BSD Reno programs
+# Old compat stuff; needed to run 4.3BSD Reno programs.
+# Note that if COMPAT_ULTRIX is set, you lose compatibility with
+# 4.3BSD Reno programs and get Ultrix compatibility instead.
+# (They cannot coexist).
options COMPAT_43
options COMPAT_09
options COMPAT_10
-options COMPAT_RENO
+#options COMPAT_ULTRIX
options TCP_COMPAT_42
options LKM
# Kernel(s) to compile
-config netbsd swap generic
-
-# All supported CPU:s
-cpu0 at backplane0
+config bsd swap generic
-# Main buses at backplane
-sbi* at backplane0
+# Devices directly attached to backplane.
+cpu0 at backplane0 # Only one CPU so far.
+sbi* at backplane0 # SBI's are always at backplane (Abus).
+mem* at backplane0 # Some machines have memory at backplane.
# Devices connected at sbi
mem* at sbi? tr? # Memory subsystems
-uba0 at sbi? tr? # Unibus adapters
-uba1 at sbi? tr? # Unibus adapters
-uba2 at sbi? tr? # Unibus adapters
-uba3 at sbi? tr? # Unibus adapters
+uba* at sbi? tr? # Unibus adapters
+mba* at sbi? tr? # Massbus adapters
+
+# Devices on Massbus adapters
+hp* at mba? drive? # RM/RP disk drives
# Disk controllers at Unibus
uda0 at uba? csr 0172150
@@ -86,12 +93,16 @@ ra6 at uda1 drive 2
ra7 at uda1 drive 3
# Ethernet cards
-de0 at uba? csr 0174510
-qe0 at uba? csr 0174440
+de0 at uba? csr 0174510 # DELUA/DEUNA
+qe0 at uba? csr 0174440 # DEQNA/DELQA
# Tape drivers
-tmscp0 at uba? csr 0174500
-tms0 at tmscp0 drive ?
+tmscp0 at uba? csr 0174500 # TMSCP ctlr
+tms0 at tmscp0 drive ? # TMSCP tape
+ts0 at uba? csr 0172520 # TS11/TSV05 tape.
+
+# Terminal lines
+dhu0 at uba? csr 0160440 # DHU-11
pseudo-device loop 1
pseudo-device pty 48
diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax
index 0443a62c2e0..72e75036bef 100644
--- a/sys/arch/vax/conf/Makefile.vax
+++ b/sys/arch/vax/conf/Makefile.vax
@@ -1,15 +1,16 @@
-# $NetBSD: Makefile.vax,v 1.12 1995/09/19 23:57:55 thorpej Exp $
+# $OpenBSD: Makefile.vax,v 1.3 1996/05/03 09:09:08 mickey Exp $
+# $NetBSD: Makefile.vax,v 1.20 1996/02/29 20:57:46 cgd Exp $
-# @(#)Makefile.vax 7.18 (Berkeley) 12/16/90
+# Makefile for OpenBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
-# /sys/vax/conf/``machineid''
+# /sys/arch/vax/conf/``machineid''
# after which you should do
-# config machineid
+# config machineid
# Machine generic makefile changes should be made in
-# /sys/conf/Makefile.``machinetype''
+# /sys/arch/vax/conf/Makefile.vax
# after which config should be rerun for all machines of that type.
#
# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
@@ -18,20 +19,26 @@
# -DTRACE compile in kernel tracing hooks
# -DQUOTA compile in file system quotas
# -DUUDMA compile in unibus tu58 pseudo-dma code
-#
-CC= cc
-CPP= cpp
-LD= /usr/bin/ld
-AWK= awk
+# DEBUG is set to -g if debugging.
+# PROF is set to -pg if profiling.
+
+AS?= as
+CC?= cc
+CPP?= cpp
+LD?= ld
+STRIP?= strip -d
+TOUCH?= touch -f -c
+
+# source tree is located via $S relative to the compilation directory
S= ../../../..
VAX= ../..
-INCLUDES= -I. -I$S/arch -I$S -I$S/sys
-COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -D_VAX_INLINE_
-AOPTS= ${COPTS} -DASSEMBLER
-CFLAGS= -Werror ${COPTS}
-LOAD_ADDRESS=80000000
+INCLUDES= -I. -I$S/arch -I$S
+CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -D_VAX_INLINE_
+CFLAGS= ${DEBUG} -O2 -Werror
+AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
+LINKFLAGS= -Z -Ttext 80000000 -e _start
### find out what to use for libkern
.include "$S/lib/libkern/Makefile.inc"
@@ -49,77 +56,121 @@ LIBCOMPAT= ${COMPATLIB}
LIBCOMPAT= ${COMPATLIB_PROF}
.endif
-NORMAL_C= ${CC} -O -c ${CFLAGS} ${PROF} $<
-NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-NORMAL_S= ${CC} -x assembler-with-cpp -E -I. -DLOCORE ${COPTS} $< | \
- ${AS} ${ASFLAGS} -o $*.o
-DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
-DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
-SYSTEM_ASMS=intvec.o subr.o
-SYSTEM_OBJS=${SYSTEM_ASMS} lim.o vnode_if.o ${OBJS} param.o ioconf.o \
- ${LIBKERN} ${LIBCOMPAT}
-#SYSTEM_DEP=${SYSTEM_ASMS} lovm.o pmap.o
-SYSTEM_DEP=${SYSTEM_ASMS} ${SYSTEM_OBJS}
-SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
-SYSTEM_LD= ${LD} -Z -e _start -T ${LOAD_ADDRESS} -o $@ ${SYSTEM_OBJS} vers.o
-#SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; ${DBSYM} -f
-SYSTEM_LD_TAIL=@echo Nu {r k{rnan klar!!!!
-
-
-%OBJS
-
-%CFILES
-
-%LOAD
-
-clean::
- rm -f eddep *vmunix tags *.o subr.i [a-tv-z]*.s \
- Errs errs linterrs makelinks vnode_if.* genassym
-
-lint: /tmp param.c
- @lint -hbxn -DGENERIC ${COPTS} ${PARAM} \
- ${VAX}/vax/Locore.c ${CFILES} ioconf.c param.c | \
- grep -v 'struct/union .* never defined' | \
- grep -v 'possible pointer alignment problem'
+# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
+# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
+# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
+# is marked as config-dependent.
-symbols.sort: ${VAX}/vax/symbols.raw
- grep -v '^#' ${VAX}/vax/symbols.raw \
- | sed 's/^ //' | sort -u > symbols.sort
+NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-intvec.o: ${VAX}/vax/intvec.s
- ${CC} -x assembler-with-cpp -E ${AOPTS} ${VAX}/vax/intvec.s| as -o intvec.o
+DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
+DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
-subr.o: ${VAX}/vax/subr.s
- ${CC} -x assembler-with-cpp -E ${AOPTS} ${VAX}/vax/subr.s| as -o subr.o
+NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
+NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
+%OBJS
-depend: ${CFILES}
- mkdep ${COPTS} ${.ALLSRC:M*.c} ioconf.c
- mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM}
+%CFILES
-ioconf.o:
- ${CC} -c ${CFLAGS} ${PARAM} ioconf.c
+%SFILES
+
+# load lines for config "xxx" will be emitted as:
+# xxx: ${SYSTEM_DEP} swapxxx.o
+# ${SYSTEM_LD_HEAD}
+# ${SYSTEM_LD} swapxxx.o
+# ${SYSTEM_LD_TAIL}
+SYSTEM_OBJ= intvec.o subr.o lim.o \
+ param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
+SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
+SYSTEM_LD_HEAD= @rm -f $@
+SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
+SYSTEM_LD_TAIL= @size $@; chmod 755 $@
+
+DEBUG?=
+.if ${DEBUG} == "-g"
+LINKFLAGS+= -X
+SYSTEM_LD_TAIL+=; \
+ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
+ echo ${STRIP} $@; ${STRIP} $@
+.else
+LINKFLAGS+= -x
+.endif
-lim.o: Makefile
- ../../conf/mkoldconf.awk < ioconf.c > lim.c
- ${CC} -O -c ${CFLAGS} ${PARAM} lim.c
+%LOAD
param.c: $S/conf/param.c
rm -f param.c
cp $S/conf/param.c .
param.o: param.c Makefile
- ${CC} -O -c ${CFLAGS} ${PARAM} param.c
+ ${NORMAL_C_C}
-conf.o: ${VAX}/vax/conf.c
- ${CC} -O -c ${CFLAGS} ${PARAM} ${VAX}/vax/conf.c
+ioconf.o: ioconf.c
+ ${NORMAL_C}
-newvers:
+newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
sh $S/conf/newvers.sh
- ${CC} ${CFLAGS} -c vers.c
+ ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
- AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
+clean::
+ rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \
+ [Ee]rrs linterrs makelinks
+
+lint:
+ @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
+ ${VAX}/vax/Locore.c ${CFILES} ${VAX}/vax/swapgeneric.c \
+ ioconf.c param.c | \
+ grep -v 'static function .* unused'
+
+tags:
+ @echo "see $S/kern/Makefile for tags"
+
+links:
+ egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
+ sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
+ echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
+ sort -u | comm -23 - dontlink | \
+ sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
+ sh makelinks && rm -f dontlink
+
+SRCS= ${VAX}/vax/intvec.s ${VAX}/vax/subr.s lim.c \
+ param.c ioconf.c ${CFILES} ${SFILES}
+depend: .depend
+.depend: ${SRCS} param.c
+ mkdep ${AFLAGS} ${CPPFLAGS} ${VAX}/vax/intvec.s ${VAX}/vax/subr.s
+ mkdep -a ${CFLAGS} ${CPPFLAGS} lim.c
+ mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
+ mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
+
+
+# depend on root or device configuration
+autoconf.o conf.o: Makefile
+
+# depend on network or filesystem configuration
+uipc_proto.o vfs_conf.o: Makefile
+
+# depend on maxusers
+machdep.o: Makefile
+
+# depend on CPU configuration
+tmscp.o ts.o uba.o uda.o autoconf.o clock.o conf.o emulate.o intvec.o: Makefile
+machdep.o sbi.o subr.o uvaxII.o: Makefile
+
+
+intvec.o: ${VAX}/vax/intvec.s
+ ${NORMAL_S}
+
+subr.o: ${VAX}/vax/subr.s
+ ${NORMAL_S}
+
+lim.c: ioconf.c
+ ../../conf/mkoldconf.awk < ioconf.c > lim.c
+
+lim.o: lim.c
+ ${NORMAL_C_C}
%RULES
diff --git a/sys/arch/vax/conf/files.vax b/sys/arch/vax/conf/files.vax
index 52c4ac00ac3..92394880176 100644
--- a/sys/arch/vax/conf/files.vax
+++ b/sys/arch/vax/conf/files.vax
@@ -1,4 +1,4 @@
-# $NetBSD: files.vax,v 1.13 1995/07/24 18:58:36 ragge Exp $
+# $NetBSD: files.vax,v 1.18 1996/03/17 22:56:30 ragge Exp $
#
# new style config file for vax architecture
#
@@ -8,185 +8,236 @@ maxpartitions 8
maxusers 8 32 64
-device backplane at root { }
-device sbi at backplane { tr=-1 }
-device bi at backplane { node=-1 }
+device backplane { }
+attach backplane at root
-device cpu at backplane, bi, sbi
-device mem at backplane, bi, sbi
+device sbi { tr=-1 }
+attach sbi at backplane
+device bi { node=-1 }
+attach bi at backplane
+
+device cpu
+attach cpu at backplane with cpu_backplane
+attach cpu at bi with cpu_bi
+device mem
+attach mem at backplane with mem_backplane
+attach mem at bi with mem_bi
+attach mem at sbi with mem_sbi
file arch/vax/vax/sbi.c sbi needs-flag
file arch/vax/vax/bi.c bi needs-flag
-device mba at sbi { drive = -1 }
+device mba { drive = -1 }
+attach mba at sbi
file arch/vax/mba/mba.c mba needs-flag
-device hp at mba
+device hp: disk
+attach hp at mba
file arch/vax/mba/hp.c hp needs-flag
major {hp = 0}
-device ht at mba
+device ht
+attach ht at mba
file arch/vax/mba/ht.c ht needs-flag
-device uba at sbi, bi { csr }
-file arch/vax/uba/uba.c uba needs-count
+device uba { csr }
+attach uba at sbi, bi
+file arch/vax/uba/uba.c uba
-device uda at uba { drive=-1 }
+device uda { drive=-1 }
+attach uda at uba
file arch/vax/uba/uda.c uda needs-count
-device de at uba:ifnet, ether
-file arch/vax/if/if_de.c de needs-count
+device de:ifnet, ether
+attach de at uba
+file arch/vax/if/if_de.c de
-device ra at uda
+device ra: disk
+attach ra at uda
file arch/vax/vax/mscp.c ra needs-count
major {ra = 9}
# TK50/TU81 at UBA
-device tmscp at uba {drive = -1}
-device tms at tmscp
+device tmscp {drive = -1}
+attach tmscp at uba
+device tms
+attach tms at tmscp
file arch/vax/uba/tmscp.c tmscp needs-count
# DEQNA/DELQA used on Qbus
-device qe at uba:ifnet, ether
-file arch/vax/if/if_qe.c qe needs-count
+device qe:ifnet, ether
+attach qe at uba
+file arch/vax/if/if_qe.c qe
+
+# TS11 at UBA
+device ts
+attach ts at uba
+file arch/vax/uba/ts.c ts needs-count
+
+# DHU-11 at UBA
+device dhu
+attach dhu at uba
+file arch/vax/uba/dhu.c dhu needs-count
# These devices aren't tested (or even compiled!)
# They are just included here to make some files happy ;)
#
# Ikonas framebuffer
-device ik at uba
+device ik
+attach ik at uba
file arch/vax/uba/ik.c ik needs-count
-device vs at uba
+device vs
+attach vs at uba
file arch/vax/uba/vs.c vs needs-count
-# TU58 on 750/730
-device tu at root
-file arch/vax/vax/tu.c tu needs-count
-
# RK06/07 on UBA
-device rk at uba
+device rk
+attach rk at uba
file arch/vax/uba/rk.c rk needs-count
# TM11/TE10 at UBA
-device te at uba
+device te
+attach te at uba
file arch/vax/uba/tm.c te needs-count
-# TS11 at UBA
-device ts at uba
-file arch/vax/uba/ts.c ts needs-count
-
# TU78 at MBA
-device mu at mba
+device mu
+attach mu at mba
file arch/vax/mba/mt.c mu needs-count
# KDB50 on BI
-device kdb at bi { drive=-1 }
+device kdb { drive=-1 }
+attach kdb at bi
file arch/vax/bi/kdb.c kdb needs-count
# DMF32 on UBA
-device dmf at uba
+device dmf
+attach dmf at uba
file arch/vax/uba/dmf.c dmf needs-count
file arch/vax/uba/dmz.c dmf needs-count
# DMZ32 on UBA
-device dmz at uba
+device dmz
+attach dmz at uba
file arch/vax/uba/dmx.c dmz needs-count
# DN-11 on UBA
-device dn at uba
+device dn
+attach dn at uba
file arch/vax/uba/dn.c dn needs-count
# DZ11 at UBA
-device dz at uba
+device dz
+attach dz at uba
file arch/vax/uba/dz.c dz needs-count
# IDC (RB730) on UBA (VAX 11/730)
-device idc at uba { drive=-1 }
-device rb at idc
+device idc { drive=-1 }
+attach idc at uba
+device rb
+attach rb at idc
file arch/vax/uba/idc.c rb needs-count
# LP-11 at UBA
-device lp at uba
+device lp
+attach lp at uba
file arch/vax/uba/lp.c lp needs-count
# ???? at UBA
-device lpa at uba
+device lpa
+attach lpa at uba
file arch/vax/uba/lpa.c lpa needs-count
# PS2 at UBA
-device ps at uba
+device ps
+attach ps at uba
file arch/vax/uba/ps.c ps needs-count
# RL02/RL11 at UBA
-device hl at uba { drive=-1 }
-device rl at hl
+device hl { drive=-1 }
+attach hl at uba
+device rl
+attach rl at hl
file arch/vax/uba/rl.c rl needs-count
# RX211/RX02 at UBA
-device fx at uba { drive=-1 }
-device rx at fx
+device fx { drive=-1 }
+attach fx at uba
+device rx
+attach rx at fx
file arch/vax/uba/rx.c rx needs-count
# SC-21/SC-31 at UBA
-device sc at uba { drive=-1 }
-device up at sc
+device sc { drive=-1 }
+attach sc at uba
+device up
+attach up at sc
file arch/vax/uba/up.c up needs-count
# TU45 at UBA
-device ut at uba { drive=-1}
-device tj at ut
+device ut { drive=-1}
+attach ut at uba
+device tj
+attach tj at ut
file arch/vax/uba/ut.c tj needs-count
# TU58/DECtape II
-device uu at uba
+device uu
+attach uu at uba
file arch/vax/uba/uu.c uu needs-count
# Benson-Varian plotter at UBA
-device va at uba { drive=-1}
-device vz at va
+device va { drive=-1}
+attach va at uba
+device vz
+attach vz at va
file arch/vax/uba/va.c va needs-count
# Versatec plotter at UBA
-device vp at uba
+device vp
+attach vp at uba
file arch/vax/uba/vp.c vp needs-count
# QVSS at UBA
-device qv at uba
+device qv
+attach qv at uba
file arch/vax/uba/qv.c qv needs-count
file arch/vax/uba/qfont.c qv needs-count
# QDSS at UBA
-device qd at uba
+device qd
+attach qd at uba
file arch/vax/uba/qd.c qd needs-count
# Interlan NP100 at UBA
-device np at uba
+device np
+attach np at uba
file arch/vax/if/if_ix.c np needs-count
file arch/vax/uba/np.c np needs-count
# ACC LH/DH IMP on UBA
-device acc at uba
+device acc
+attach acc at uba
file arch/vax/if/if_acc.c acc needs-count
# DR11C at UBA
-device ct at uba
+device ct
+attach ct at uba
file arch/vax/uba/ct.c ct needs-count
# A/D-converter on UBA
-device ad at uba
+device ad
+attach ad at uba
file arch/vax/uba/ad.c ad needs-count
# DH-11/DM-11 on UBA
-device dh at uba
+device dh
+attach dh at uba
file arch/vax/uba/dh.c dh needs-count
-# DHU-11 at UBA
-device dhu at uba
-file arch/vax/uba/dhu.c dhu needs-count
-
# These are general files needed for compilation.
file dev/cons.c
file dev/cninit.c
@@ -197,8 +248,13 @@ file arch/vax/vax/gencons.c
file arch/vax/vax/pmap.c
file arch/vax/vax/machdep.c
file arch/vax/vax/ka750.c vax750
+file arch/vax/vax/ka780.c vax780
+file arch/vax/vax/ctu.c vax750
file arch/vax/vax/uvaxII.c vax630
-file arch/vax/vax/emulate.s vax630
+file arch/vax/vax/emulate.s vax630 | ka650
+file arch/vax/vax/ka650.c vax650
+file arch/vax/vax/ka860.c vax8600
+file arch/vax/vax/crl.c vax8600
file arch/vax/vax/conf.c
file arch/vax/vax/urem.s
file arch/vax/vax/udiv.s
@@ -207,31 +263,22 @@ file arch/vax/vax/trap.c
file arch/vax/vax/vm_machdep.c
file arch/vax/vax/autoconf.c
-#file arch/vax/vax/cpu_machdep.c
-#file arch/vax/vax/in_cksum.c inet
-file netinet/in_cksum.c inet
file arch/vax/vax/random.s inet
+file arch/vax/vax/in_cksum.c inet
+file arch/vax/vax/ns_cksum.c ns
file arch/vax/vax/disksubr.c ffs
-file arch/vax/if/if_uba.c de qe
+file arch/vax/if/if_uba.c de | qe
file arch/vax/vax/db_machdep.c ddb
file arch/vax/vax/db_disasm.c ddb
+include "../../../compat/ultrix/files.ultrix"
+
# Dom h{ra f}r vara kvar s} l{nge f}r vi se vilka vi beh|ver...
-#arch/vax/vax/crl.c standard
#arch/vax/vax/dkbad.c standard
#arch/vax/vax/flp.c standard
-#arch/vax/vax/ka650.c standard
-#arch/vax/vax/ka630.c standard
#arch/vax/vax/ka730.c standard
-#arch/vax/vax/ka750.c standard
-#arch/vax/vax/ka780.c standard
#arch/vax/vax/ka820.c standard
-#arch/vax/vax/ka860.c standard
-#arch/vax/vax/kdb_machdep.c optional kadb
-#arch/vax/vax/kdb_opset.c optional kadb
-#arch/vax/vax/ns_cksum.c optional ns
#arch/vax/vax/rx50.c standard
-#arch/vax/vax/sys_machdep.c standard
#arch/vax/vax/iidr.o optional ii
#arch/vax/vax/iidrsys.o optional ii
#arch/vax/vax/iidr_glob.o optional ii
@@ -247,6 +294,5 @@ file arch/vax/vax/db_disasm.c ddb
#arch/vax/if/if_hy.c optional hy device-driver
#arch/vax/if/if_il.c optional il device-driver
#arch/vax/if/if_pcl.c optional pcl device-driver
-##arch/vax/if/if_uba.c optional ns device-driver
#arch/vax/if/if_vv.c optional vv device-driver
#arch/vax/if/raw_hy.c optional hy device-driver
diff --git a/sys/arch/vax/conf/mkoldconf.awk b/sys/arch/vax/conf/mkoldconf.awk
index 893e4eec395..81b2cb1e0d7 100644
--- a/sys/arch/vax/conf/mkoldconf.awk
+++ b/sys/arch/vax/conf/mkoldconf.awk
@@ -1,29 +1,29 @@
#!/usr/bin/awk -f
#
-# $NetBSD: mkoldconf.awk,v 1.4 1995/12/16 15:05:03 ragge Exp $
+# $NetBSD: mkoldconf.awk,v 1.7 1996/03/17 22:56:31 ragge Exp $
#
-/tmscd/{
- tmsplats[ntms]=$2;
- tmsaddr[ntms]=$5;
+/tms_cd/{
+ tmsplats[ntms]=$3;
+ tmsaddr[ntms]=$6;
ntms++;
}
-/tscd/{
- tsplats[nts]=$2;
- tsaddr[nts]=$5;
+/ts_cd/{
+ tsplats[nts]=$3;
+ tsaddr[nts]=$6;
nts++;
}
-/racd/{
- raplats[nra]=$2;
- raaddr[nra]=$5;
+/ra_cd/{
+ raplats[nra]=$3;
+ raaddr[nra]=$6;
nra++;
}
{
if(savenext==1){
- l=sprintf("%d",$2)
+ l=sprintf("%d",$3)
udanummer[l-1]=nuda-1
savenext=0;
}
@@ -32,27 +32,27 @@
{
if(tmssavenext==1){
- l=sprintf("%d",$2)
+ l=sprintf("%d",$3)
tmsnummer[l-1]=ntmscp-1
tmssavenext=0;
}
if(tssavenext==1){
- l=sprintf("%d",$2)
+ l=sprintf("%d",$3)
tsnummer[l-1]=nts-1
tssavenext=0;
}
}
-/tmscpcd/{
- tmscpplats[ntmscp]=$2;
- tmscpaddr[ntmscp]=$5;
+/tmscp_cd/{
+ tmscpplats[ntmscp]=$3;
+ tmscpaddr[ntmscp]=$6;
ntmscp++;
tmssavenext=1;
}
-/udacd/{
- udaplats[nuda]=$2;
- udaddr[nuda]=$5;
+/uda_cd/{
+ udaplats[nuda]=$3;
+ udaddr[nuda]=$6;
nuda++;
savenext=1;
}
@@ -91,12 +91,12 @@
END{
-printf "#include \"sys/param.h\"\n"
-printf "#include \"machine/pte.h\"\n"
-printf "#include \"sys/buf.h\"\n"
-printf "#include \"sys/map.h\"\n"
+printf "#include <sys/param.h>\n"
+printf "#include <machine/pte.h>\n"
+printf "#include <sys/buf.h>\n"
+printf "#include <sys/map.h>\n"
-printf "#include \"vax/uba/ubavar.h\"\n"
+printf "#include <vax/uba/ubavar.h>\n"
printf "int antal_ra=%d;\n",nra-1
printf "int antal_uda=%d;\n",nuda-1
@@ -110,13 +110,13 @@ if(nts) printf "void tsintr();\n"
if(ntms) printf "extern struct uba_driver tmscpdriver;\n"
if(ntms) printf "void tmscpintr();\n"
printf "void udaintr();\n"
-printf "int racd=0, tmscd=0;\n"
+printf "int ra_cd=0, ra_ca=0, tms_cd=0, tms_ca=0;\n"
printf "#define C (caddr_t)\n"
printf "struct uba_ctlr ubminit[]={\n"
for(i=1;i<nuda;i++){
k=sprintf("%d",udaddr[i])
- printf " { &udadriver, %d,0,0,udaintr,C %s},\n",
+ printf " { &udadriver, %d,'?',0,udaintr,C %s},\n",
udaplats[i],loc[k+1]
}
for(i=1;i<nts;i++){
@@ -134,7 +134,7 @@ printf "0};\n"
printf "struct uba_device ubdinit[]={\n"
for(i=1;i<nra;i++){
k=sprintf("%d",raaddr[i])
- printf " { &udadriver,%d,%d,0,%d,0,0,1,0},\n",raplats[i],
+ printf " { &udadriver,%d,%d,'?',%d,0,0,1,0},\n",raplats[i],
rr++/4,loc[k+1]
}
for(i=1;i<nts;i++){
diff --git a/sys/arch/vax/consolerl/Makefile b/sys/arch/vax/consolerl/Makefile
new file mode 100644
index 00000000000..9cc3fc74a8f
--- /dev/null
+++ b/sys/arch/vax/consolerl/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD: Makefile,v 1.1 1996/03/08 12:41:33 ragge Exp $
+# @(#)Makefile 7.2 (Berkeley) 5/8/91
+
+BOOTS= boot
+STDBOOS= defboo.com anyboo.com
+DEFBOOS= defboo.hk defboo.hp defboo.ra defboo.up
+DEVBOOS= hkmboo.com hksboo.com hpmboo.com hpsboo.com \
+ ramboo.com rasboo.com upmboo.com upsboo.com
+#UTILS= format copy drtest
+# order is NOT random...
+OBJS= ${BOOTS} ${STDBOOS} ${DEVBOOS} ${UTILS}
+DRIVE= /dev/crl
+
+# build a boot console rl02 from a DEC console rl02 pack
+update: ${OBJS}
+ arff rmf ${DRIVE} ${OBJS}
+ -rm -f defboo.com
+
+defboo.com:
+ @echo You must copy one of ${DEFBOOS} to defboo.com.
+ @echo See installing and operating guide for details.
+ @/bin/false #force exits
+
+boot: ../boot/boot
+ (cd ../boot;make boot)
+ dd if=../boot/boot of=boot bs=32 skip=1
+
+clean:
+ rm -f ${BOOTS} ${UTILS} defboo.com
diff --git a/sys/arch/vax/consolerl/anyboo.com b/sys/arch/vax/consolerl/anyboo.com
new file mode 100644
index 00000000000..d10e93242fd
--- /dev/null
+++ b/sys/arch/vax/consolerl/anyboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! Conversational boot to single user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 0 ! Not used for conversational boot
+DEPOSIT R11 3 ! Software boot flags (conversational and single)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/defboo.hk b/sys/arch/vax/consolerl/defboo.hk
new file mode 100644
index 00000000000..91afd768200
--- /dev/null
+++ b/sys/arch/vax/consolerl/defboo.hk
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! rk07 drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 3 ! rk07 drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/defboo.hp b/sys/arch/vax/consolerl/defboo.hp
new file mode 100644
index 00000000000..ca3f5b2b0a6
--- /dev/null
+++ b/sys/arch/vax/consolerl/defboo.hp
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'hp' drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 0 ! 'hp' drive type - mba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/defboo.ra b/sys/arch/vax/consolerl/defboo.ra
new file mode 100644
index 00000000000..7c6e5aae128
--- /dev/null
+++ b/sys/arch/vax/consolerl/defboo.ra
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'ra' MSCP drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 9 ! 'ra' MSCP drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/defboo.up b/sys/arch/vax/consolerl/defboo.up
new file mode 100644
index 00000000000..b394b49403e
--- /dev/null
+++ b/sys/arch/vax/consolerl/defboo.up
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'up' drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 2 ! 'up' drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/hkmboo.com b/sys/arch/vax/consolerl/hkmboo.com
new file mode 100644
index 00000000000..91afd768200
--- /dev/null
+++ b/sys/arch/vax/consolerl/hkmboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! rk07 drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 3 ! rk07 drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/hksboo.com b/sys/arch/vax/consolerl/hksboo.com
new file mode 100644
index 00000000000..ca20e30f60e
--- /dev/null
+++ b/sys/arch/vax/consolerl/hksboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! rk07 drive type boot to single user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 3 ! rk07 drive type - uba0 - drive 0
+DEPOSIT R11 2 ! Software boot flags (single user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/hpmboo.com b/sys/arch/vax/consolerl/hpmboo.com
new file mode 100644
index 00000000000..ca3f5b2b0a6
--- /dev/null
+++ b/sys/arch/vax/consolerl/hpmboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'hp' drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 0 ! 'hp' drive type - mba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/hpsboo.com b/sys/arch/vax/consolerl/hpsboo.com
new file mode 100644
index 00000000000..4b9d6be9111
--- /dev/null
+++ b/sys/arch/vax/consolerl/hpsboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'hp' drive type boot to single user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 0 ! 'hp' drive type - mba0 - drive 0
+DEPOSIT R11 2 ! Software boot flags (single user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/ramboo.com b/sys/arch/vax/consolerl/ramboo.com
new file mode 100644
index 00000000000..7c6e5aae128
--- /dev/null
+++ b/sys/arch/vax/consolerl/ramboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'ra' MSCP drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 9 ! 'ra' MSCP drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/rasboo.com b/sys/arch/vax/consolerl/rasboo.com
new file mode 100644
index 00000000000..9e43ec98c50
--- /dev/null
+++ b/sys/arch/vax/consolerl/rasboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'ra' MSCP drive type boot to single user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 9 ! 'ra' MSCP drive type - uba0 - drive 0
+DEPOSIT R11 2 ! Software boot flags (single user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/upmboo.com b/sys/arch/vax/consolerl/upmboo.com
new file mode 100644
index 00000000000..b394b49403e
--- /dev/null
+++ b/sys/arch/vax/consolerl/upmboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'up' drive type boot to multi user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 2 ! 'up' drive type - uba0 - drive 0
+DEPOSIT R11 0 ! Software boot flags (multi user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/consolerl/upsboo.com b/sys/arch/vax/consolerl/upsboo.com
new file mode 100644
index 00000000000..2420463aac1
--- /dev/null
+++ b/sys/arch/vax/consolerl/upsboo.com
@@ -0,0 +1,18 @@
+!
+! Load 'boot.' and boot 4.3BSD.
+!
+! 'up' drive type boot to single user mode
+!
+!
+SET SNAP ON ! Enable ERROR_HALT snapshots
+SET FBOX OFF ! System will turn on Fbox
+INIT ! SRM processor init
+UNJAM ! UNJAM SBIA's and enable master sbia interrupts
+INIT/PAMM ! INIT physical address memory map
+DEPOSIT CSWP 8 ! Turn off the cache - System will enable cache
+
+DEPOSIT R10 2 ! 'up' drive type - uba0 - drive 0
+DEPOSIT R11 2 ! Software boot flags (single user mode)
+
+LOAD/START:0 BOOT. ! Load 'boot.' at memory location 0
+START 2 ! Start 'boot.' at the address 2
diff --git a/sys/arch/vax/floppy/Makefile b/sys/arch/vax/floppy/Makefile
new file mode 100644
index 00000000000..0ce301f6865
--- /dev/null
+++ b/sys/arch/vax/floppy/Makefile
@@ -0,0 +1,45 @@
+# $NetBSD: Makefile,v 1.1 1996/03/02 17:57:34 ragge Exp $
+# @(#)Makefile 7.2 (Berkeley) 5/9/91
+
+# Make a 780 rx01 floppy
+#
+BOOTS= boot
+STDBOO= defboo.cmd anyboo.cmd restar.cmd
+DEFBOO= defboo.hk defboo.hp defboo.ra defboo.up
+DEVBOO= hkmboo.cmd hksboo.cmd hpmboo.cmd hpsboo.cmd \
+ ramboo.cmd rasboo.cmd upmboo.cmd upsboo.cmd
+UTILS= format copy drtest
+
+# order is NOT random...
+OBJS= ${BOOTS} ${STDBOO} ${DEVBOO} ${UTILS}
+FROMDEC=du* dm* db* s[mbr]* *boo.* vmb.exe *.hlp cs* ci*
+
+FLOPPY= /dev/floppy
+#FLOPPY= /dev/rrx0b # for using RX device
+
+all: floppy
+
+floppy: 3tracks ${OBJS}
+ cp 3tracks floppy
+ arff crf floppy ${OBJS}
+
+install: floppy
+ dd if=floppy of=${FLOPPY}
+
+# build a boot floppy from a DEC console floppy
+update: ${OBJS}
+ -mkdir fromdec
+ cd fromdec; arff xf ${FLOPPY}; rm -f ${FROMDEC} ${OBJS} ${DEFBOO}; \
+ flcopy -t3 -f ${FLOPPY}; rm -f floppy; arff crf ${FLOPPY} *
+ rm -rf fromdec
+ arff rf ${FLOPPY} ${OBJS}
+ -rm -f defboo.cmd
+
+defboo.cmd:
+ @echo You must copy one of \{${DEFBOO}\} to defboo.cmd.
+ @echo See installing and operating guide for details.
+ @/bin/false #force exits
+
+clean:
+ rm -f ${BOOTS} ${UTILS} floppy defboo.cmd
+ rm -rf fromdec
diff --git a/sys/arch/vax/floppy/NOTE b/sys/arch/vax/floppy/NOTE
new file mode 100644
index 00000000000..a0936cfb5ed
--- /dev/null
+++ b/sys/arch/vax/floppy/NOTE
@@ -0,0 +1,5 @@
+This are the boot files needed to boot up a 11/780 system.
+BUT; both arff and flcopy are missing from the distribution;
+neither is there a driver for the LSI11 RX01 in the kernel.
+Anyway, these files must be installed on the console RX01
+to be able to boot up a 11/780 system.
diff --git a/sys/arch/vax/floppy/anyboo.cmd b/sys/arch/vax/floppy/anyboo.cmd
new file mode 100644
index 00000000000..347604774a0
--- /dev/null
+++ b/sys/arch/vax/floppy/anyboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ANY DEVICE TO A SINGLE USER SHELL
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R11 3 ! 3=RB_ASKNAME+RB_SINGLE
+! R10 NICHTS ! DEVICE CHOICE ISNT APPLICABLE
+START 2
diff --git a/sys/arch/vax/floppy/defboo.MS780C-interleaved b/sys/arch/vax/floppy/defboo.MS780C-interleaved
new file mode 100644
index 00000000000..ced73085ad1
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.MS780C-interleaved
@@ -0,0 +1,17 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+D 20002000 101
+D 20004000 101
+D 20004004 4000
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 0 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK)
+START 2
diff --git a/sys/arch/vax/floppy/defboo.hk b/sys/arch/vax/floppy/defboo.hk
new file mode 100644
index 00000000000..26cc2627734
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.hk
@@ -0,0 +1,14 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 3 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)
+START 2
diff --git a/sys/arch/vax/floppy/defboo.hp b/sys/arch/vax/floppy/defboo.hp
new file mode 100644
index 00000000000..d57691057f1
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.hp
@@ -0,0 +1,14 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 0 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)
+START 2
diff --git a/sys/arch/vax/floppy/defboo.kra b/sys/arch/vax/floppy/defboo.kra
new file mode 100644
index 00000000000..a09d592326b
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.kra
@@ -0,0 +1,14 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 10 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA, 16=KRA)
+START 2
diff --git a/sys/arch/vax/floppy/defboo.ra b/sys/arch/vax/floppy/defboo.ra
new file mode 100644
index 00000000000..9317d5638fc
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.ra
@@ -0,0 +1,14 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 9 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)
+START 2
diff --git a/sys/arch/vax/floppy/defboo.up b/sys/arch/vax/floppy/defboo.up
new file mode 100644
index 00000000000..655e3dd45b8
--- /dev/null
+++ b/sys/arch/vax/floppy/defboo.up
@@ -0,0 +1,14 @@
+!
+! BOOTSTRAP BY BOOT() SYSCALL
+! GO MULTI-USER AFTER CHECKING; BOOT FROM DEFAULT DEVICE
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D/G B 0 ! BOOT PARAMETERS: MULTI USER AFTER CHECK
+D/G A 2 ! DEV TO BOOT FROM (0=HP, 2=UP, 3=HK, 9=RA)
+START 2
diff --git a/sys/arch/vax/floppy/hkmboo.cmd b/sys/arch/vax/floppy/hkmboo.cmd
new file mode 100644
index 00000000000..db424340872
--- /dev/null
+++ b/sys/arch/vax/floppy/hkmboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON HK, GOING MULTI USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 3 ! DEVICE CHOICE 3=HK
+D R11 0 ! 0= AUTOBOOT
+START 2
diff --git a/sys/arch/vax/floppy/hksboo.cmd b/sys/arch/vax/floppy/hksboo.cmd
new file mode 100644
index 00000000000..670f9e6dfbf
--- /dev/null
+++ b/sys/arch/vax/floppy/hksboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON HK, LEAVING SINGLE USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 3 ! DEVICE CHOICE 3=HK
+D R11 2 ! 2= RB_SINGLE
+START 2
diff --git a/sys/arch/vax/floppy/hpmboo.cmd b/sys/arch/vax/floppy/hpmboo.cmd
new file mode 100644
index 00000000000..e424d5fb05a
--- /dev/null
+++ b/sys/arch/vax/floppy/hpmboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON RP, GOING MULTI USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 0 ! DEVICE CHOICE 0=HP
+D R11 0 ! 0= AUTOBOOT
+START 2
diff --git a/sys/arch/vax/floppy/hpsboo.cmd b/sys/arch/vax/floppy/hpsboo.cmd
new file mode 100644
index 00000000000..2d9d81ed484
--- /dev/null
+++ b/sys/arch/vax/floppy/hpsboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON RP, LEAVING SINGLE USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 0 ! DEVICE CHOICE 0=HP
+D R11 2 ! 2= RB_SINGLE
+START 2
diff --git a/sys/arch/vax/floppy/ramboo.cmd b/sys/arch/vax/floppy/ramboo.cmd
new file mode 100644
index 00000000000..40d2e8cf526
--- /dev/null
+++ b/sys/arch/vax/floppy/ramboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON UP, GOING MULTI USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 9 ! DEVICE CHOICE 9=RA
+D R11 0 ! 0= AUTOBOOT
+START 2
diff --git a/sys/arch/vax/floppy/rasboo.cmd b/sys/arch/vax/floppy/rasboo.cmd
new file mode 100644
index 00000000000..bade1bbd7e1
--- /dev/null
+++ b/sys/arch/vax/floppy/rasboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON UP, LEAVING SINGLE USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 9 ! DEVICE CHOICE 9=RA
+D R11 2 ! 2= RB_SINGLE
+START 2
diff --git a/sys/arch/vax/floppy/restar.cmd b/sys/arch/vax/floppy/restar.cmd
new file mode 100644
index 00000000000..64e345dfb88
--- /dev/null
+++ b/sys/arch/vax/floppy/restar.cmd
@@ -0,0 +1,16 @@
+! RESTART COMMMAND FILE
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT ! HALT PROCESSOR
+UNJAM ! UNJAM SBI
+INIT ! INITIALIZE PROCESSOR
+D/I 11 20003800 ! SET SCBB TO ROM
+D/G 0 0
+D/G 1 3 ! UBA TR NUMBER
+D/G 2 0
+D/G 3 0
+D/G 4 0
+D/G 5 0
+D/G FP 0
+S 20003004
diff --git a/sys/arch/vax/floppy/upmboo.cmd b/sys/arch/vax/floppy/upmboo.cmd
new file mode 100644
index 00000000000..41be64da676
--- /dev/null
+++ b/sys/arch/vax/floppy/upmboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON UP, GOING MULTI USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 2 ! DEVICE CHOICE 2=UP
+D R11 0 ! 0= AUTOBOOT
+START 2
diff --git a/sys/arch/vax/floppy/upsboo.cmd b/sys/arch/vax/floppy/upsboo.cmd
new file mode 100644
index 00000000000..af96678067b
--- /dev/null
+++ b/sys/arch/vax/floppy/upsboo.cmd
@@ -0,0 +1,13 @@
+!
+! BOOTSTRAP ON UP, LEAVING SINGLE USER
+!
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+LOAD BOOT
+D R10 2 ! DEVICE CHOICE 2=UP
+D R11 2 ! 2= RB_SINGLE
+START 2
diff --git a/sys/arch/vax/floppy/utboot.cmd b/sys/arch/vax/floppy/utboot.cmd
new file mode 100644
index 00000000000..fe89eb5ebea
--- /dev/null
+++ b/sys/arch/vax/floppy/utboot.cmd
@@ -0,0 +1,20 @@
+SET DEF HEX
+SET DEF LONG
+SET REL:0
+HALT
+UNJAM
+INIT
+D/P 200 0036EFD0
+D + D0510000
+D + 2000008F
+D + 0800C180
+D + 0804C1D4
+D + 0026EFD0
+D + C8520000
+D + 00F5208F
+D + 8FB05200
+D + 1AA204C0
+02008fae 8fae06a2
+0000060 02a20100 b004a2b4 00006239 20006000
+0000100 2013e000
+0000104
diff --git a/sys/arch/vax/if/if_de.c b/sys/arch/vax/if/if_de.c
index d0ca45bd9ac..997d43d9468 100644
--- a/sys/arch/vax/if/if_de.c
+++ b/sys/arch/vax/if/if_de.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_de.c,v 1.12 1995/12/30 19:42:16 ragge Exp $ */
+/* $NetBSD: if_de.c,v 1.19 1996/04/08 18:34:54 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1989 Regents of the University of California.
@@ -45,49 +45,50 @@
* timeout routine (get statistics)
*/
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/mbuf.h"
-#include "sys/buf.h"
-#include "sys/protosw.h"
-#include "sys/socket.h"
-#include "sys/ioctl.h"
-#include "sys/errno.h"
-#include "sys/syslog.h"
-#include "sys/device.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/buf.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/errno.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
-#include "machine/pte.h"
-#include "machine/sid.h"
+#include <machine/pte.h>
+#include <machine/sid.h>
-#include "net/if.h"
-#include "net/netisr.h"
-#include "net/route.h"
+#include <net/if.h>
+#include <net/netisr.h>
+#include <net/route.h>
#ifdef INET
-#include "netinet/in.h"
-#include "netinet/in_systm.h"
-#include "netinet/in_var.h"
-#include "netinet/ip.h"
-#include "netinet/if_ether.h"
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/ip.h>
+#include <netinet/if_ether.h>
#endif
#ifdef NS
-#include "netns/ns.h"
-#include "netns/ns_if.h"
+#include <netns/ns.h>
+#include <netns/ns_if.h>
#endif
#ifdef ISO
-#include "netiso/iso.h"
-#include "netiso/iso_var.h"
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
extern char all_es_snpa[], all_is_snpa[];
#endif
-#include "../include/cpu.h"
-#include "../include/mtpr.h"
-#include "if_dereg.h"
-#include "if_uba.h"
-#include "../uba/ubareg.h"
-#include "../uba/ubavar.h"
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+
+#include <vax/if/if_dereg.h>
+#include <vax/if/if_uba.h>
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
#define NXMT 3 /* number of transmit buffers */
#define NRCV 7 /* number of receive buffers (must be > 1) */
@@ -144,16 +145,21 @@ void deattach __P((struct device *, struct device *, void *));
int dewait __P((struct de_softc *, char *));
void deinit __P((int));
int deioctl __P((struct ifnet *, u_long, caddr_t));
-int dereset __P((int));
+void dereset __P((int));
void destart __P((struct ifnet *));
void deread __P((struct de_softc *, struct ifrw *, int));
void derecv __P((int));
void de_setaddr __P((u_char *, int));
+void deintr __P((int));
-struct cfdriver decd =
- { 0,"de",dematch, deattach, DV_IFNET, sizeof(struct de_softc) };
+struct cfdriver de_cd = {
+ NULL, "de", DV_IFNET
+};
+struct cfattach de_ca = {
+ sizeof(struct de_softc), dematch, deattach
+};
/*
* Interface exists: make available by filling in network interface
* record. System will initialize the interface when it is ready
@@ -195,7 +201,7 @@ deattach(parent, self, aux)
* the pcbb buffer onto the Unibus.
*/
addr->pcsr0 = 0; /* reset INTE */
- DELAY(5000);
+ DELAY(100);
addr->pcsr0 = PCSR0_RSET;
(void)dewait(ds, "reset");
@@ -216,7 +222,6 @@ deattach(parent, self, aux)
printf("de%d: hardware address %s\n", ds->ds_device.dv_unit,
ether_sprintf(ds->ds_addr));
ifp->if_ioctl = deioctl;
- ifp->if_reset = dereset;
ifp->if_start = destart;
ds->ds_deuba.iff_flags = UBA_CANTWAIT;
#ifdef notdef
@@ -229,26 +234,20 @@ deattach(parent, self, aux)
/*
* Reset of interface after UNIBUS reset.
- * If interface is on specified uba, reset its state.
*/
-int
+void
dereset(unit)
int unit;
{
-#if 0
- register struct uba_device *ui;
+ struct de_softc *sc = de_cd.cd_devs[unit];
+ volatile struct dedevice *addr = sc->ds_vaddr;
- if (unit >= NDE || (ui = deinfo[unit]) == 0 || ui->ui_alive == 0 ||
- ui->ui_ubanum != uban)
- return;
printf(" de%d", unit);
- de_softc[unit].ds_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
- de_softc[unit].ds_flags &= ~DSF_RUNNING;
- ((struct dedevice *)ui->ui_addr)->pcsr0 = PCSR0_RSET;
- (void)dewait(ui, "reset");
+ sc->ds_if.if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
+ sc->ds_flags &= ~DSF_RUNNING;
+ addr->pcsr0 = PCSR0_RSET;
+ (void)dewait(sc, "reset");
deinit(unit);
-#endif
- return 0;
}
/*
@@ -267,7 +266,7 @@ deinit(unit)
struct de_ring *rp;
int s,incaddr;
- ds = (struct de_softc *)decd.cd_devs[unit];
+ ds = (struct de_softc *)de_cd.cd_devs[unit];
ifp = &ds->ds_if;
/* not yet, if address still unknown */
@@ -294,7 +293,7 @@ deinit(unit)
addr->pcsr2 = incaddr & 0xffff;
addr->pcsr3 = (incaddr >> 16) & 0x3;
addr->pclow = 0; /* reset INTE */
- DELAY(5000);
+ DELAY(500);
addr->pclow = CMD_GETPCBB;
(void)dewait(ds, "pcbb");
@@ -366,8 +365,7 @@ destart(ifp)
struct ifnet *ifp;
{
int len;
- int unit = ifp->if_unit;
- register struct de_softc *ds = decd.cd_devs[ifp->if_unit];
+ register struct de_softc *ds = de_cd.cd_devs[ifp->if_unit];
volatile struct dedevice *addr = ds->ds_vaddr;
register struct de_ring *rp;
struct mbuf *m;
@@ -419,7 +417,7 @@ deintr(unit)
register struct ifxmt *ifxp;
short csr0;
- ds = decd.cd_devs[unit];
+ ds = de_cd.cd_devs[unit];
addr = ds->ds_vaddr;
@@ -501,7 +499,7 @@ void
derecv(unit)
int unit;
{
- register struct de_softc *ds = decd.cd_devs[unit];
+ register struct de_softc *ds = de_cd.cd_devs[unit];
register struct de_ring *rp;
int len;
@@ -550,8 +548,6 @@ deread(ds, ifrw, len)
{
struct ether_header *eh;
struct mbuf *m;
- int s;
- register struct ifqueue *inq;
/*
* Deal with trailer protocol: if type is trailer type
@@ -581,7 +577,7 @@ deioctl(ifp, cmd, data)
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *)data;
- register struct de_softc *ds = decd.cd_devs[ifp->if_unit];
+ register struct de_softc *ds = de_cd.cd_devs[ifp->if_unit];
int s = splnet(), error = 0;
switch (cmd) {
@@ -639,7 +635,7 @@ de_setaddr(physaddr, unit)
u_char *physaddr;
int unit;
{
- register struct de_softc *ds = decd.cd_devs[unit];
+ register struct de_softc *ds = de_cd.cd_devs[unit];
volatile struct dedevice *addr= ds->ds_vaddr;
if (! (ds->ds_flags & DSF_RUNNING))
@@ -682,7 +678,6 @@ dematch(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct de_softc *sc = match;
struct uba_attach_args *ua = aux;
volatile struct dedevice *addr = (struct dedevice *)ua->ua_addr;
int i;
@@ -697,9 +692,9 @@ dematch(parent, match, aux)
(addr->pcsr1 & PCSR1_STMASK) == STAT_RESET;
++i)
DELAY(50000);
- if ((addr->pcsr0 & PCSR0_FATI) != 0 ||
- (addr->pcsr1 & PCSR1_STMASK) != STAT_READY &&
- (addr->pcsr1 & PCSR1_STMASK) != STAT_RUN)
+ if (((addr->pcsr0 & PCSR0_FATI) != 0) ||
+ (((addr->pcsr1 & PCSR1_STMASK) != STAT_READY) &&
+ ((addr->pcsr1 & PCSR1_STMASK) != STAT_RUN)))
return(0);
addr->pcsr0 = 0;
@@ -713,7 +708,9 @@ dematch(parent, match, aux)
addr->pcsr3 = 0;
addr->pcsr0 = PCSR0_INTE|CMD_GETPCBB;
DELAY(50000);
+
ua->ua_ivec = deintr;
- ua->ua_iarg = sc->ds_device.dv_unit;
+ ua->ua_reset = dereset; /* Wish to be called after ubareset */
+
return 1;
}
diff --git a/sys/arch/vax/if/if_dereg.h b/sys/arch/vax/if/if_dereg.h
index 2f2b48c9796..d18f5fe043d 100644
--- a/sys/arch/vax/if/if_dereg.h
+++ b/sys/arch/vax/if/if_dereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_dereg.h,v 1.2 1994/10/26 08:01:51 cgd Exp $ */
+/* $NetBSD: if_dereg.h,v 1.3 1996/04/08 18:34:55 ragge Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@@ -177,7 +177,7 @@ struct de_ring {
#define XFLG_BITS "\10\10OWN\7ERRS\6MTCH\5MORE\4ONE\3DEF\2STP\1ENP"
#define XERR_BUFL 0x8000 /* Buffer length error */
-#define XERR_UBTO 0x4000 /* UNIBUS tiemout
+#define XERR_UBTO 0x4000 /* UNIBUS tiemout */
#define XERR_LCOL 0x1000 /* Late collision */
#define XERR_LCAR 0x0800 /* Loss of carrier */
#define XERR_RTRY 0x0400 /* Failed after 16 retries */
diff --git a/sys/arch/vax/if/if_qe.c b/sys/arch/vax/if/if_qe.c
index 8f44ae74658..6e1eaecd033 100644
--- a/sys/arch/vax/if/if_qe.c
+++ b/sys/arch/vax/if/if_qe.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_qe.c,v 1.8 1995/12/24 02:30:55 mycroft Exp $ */
+/* $NetBSD: if_qe.c,v 1.13 1996/03/18 16:47:25 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -137,49 +137,50 @@
/*
* Digital Q-BUS to NI Adapter
*/
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/mbuf.h"
-#include "sys/buf.h"
-#include "sys/protosw.h"
-#include "sys/socket.h"
-#include "sys/ioctl.h"
-#include "sys/errno.h"
-#include "sys/syslog.h"
-#include "sys/device.h"
-#include "sys/time.h"
-#include "sys/kernel.h"
-
-#include "net/if.h"
-#include "net/netisr.h"
-#include "net/route.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/mbuf.h>
+#include <sys/buf.h>
+#include <sys/protosw.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/errno.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+#include <sys/time.h>
+#include <sys/kernel.h>
+
+#include <net/if.h>
+#include <net/netisr.h>
+#include <net/route.h>
#ifdef INET
-#include "netinet/in.h"
-#include "netinet/in_systm.h"
-#include "netinet/in_var.h"
-#include "netinet/ip.h"
-#include "netinet/if_ether.h"
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/in_var.h>
+#include <netinet/ip.h>
+#include <netinet/if_ether.h>
#endif
#ifdef NS
-#include "netns/ns.h"
-#include "netns/ns_if.h"
+#include <netns/ns.h>
+#include <netns/ns_if.h>
#endif
#ifdef ISO
-#include "netiso/iso.h"
-#include "netiso/iso_var.h"
+#include <netiso/iso.h>
+#include <netiso/iso_var.h>
extern char all_es_snpa[], all_is_snpa[], all_l1is_snpa[], all_l2is_snpa[];
#endif
-#include "machine/pte.h"
-#include "machine/cpu.h"
-#include "machine/mtpr.h"
-#include "if_qereg.h"
-#include "if_uba.h"
-#include "vax/uba/ubareg.h"
-#include "vax/uba/ubavar.h"
+#include <machine/pte.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+
+#include <vax/if/if_qereg.h>
+#include <vax/if/if_uba.h>
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
#define NRCV 15 /* Receive descriptors */
#define NXMT 5 /* Transmit descriptors */
@@ -200,7 +201,7 @@ void qetimeout(int);
* This structure contains the output queue for the interface, its address, ...
*/
struct qe_softc {
- struct device qe_device; /* Configuration common part */
+ struct device qe_dev; /* Configuration common part */
struct arpcom qe_ac; /* Ethernet common part */
#define qe_if qe_ac.ac_if /* network-visible interface */
#define qe_addr qe_ac.ac_enaddr /* hardware Ethernet address */
@@ -231,7 +232,7 @@ struct qe_softc {
int qematch __P((struct device *, void *, void *));
void qeattach __P((struct device *, struct device *, void *));
-int qereset __P((int));
+void qereset __P((int));
void qeinit __P((int));
void qestart __P((struct ifnet *));
void qeintr __P((int));
@@ -245,9 +246,13 @@ void qeread __P((struct qe_softc *, struct ifrw *, int));
void qetimeout __P((int));
void qerestart __P((struct qe_softc *));
-struct cfdriver qecd =
- { 0, "qe", qematch, qeattach, DV_IFNET, sizeof(struct qe_softc) };
+struct cfdriver qe_cd = {
+ NULL, "qe", DV_IFNET
+};
+struct cfattach qe_ca = {
+ sizeof(struct qe_softc), qematch, qeattach
+};
#define QEUNIT(x) minor(x)
/*
@@ -339,7 +344,6 @@ qematch(parent, match, aux)
ubarelse(0, (int *)&sc->rringaddr);
sc->ipl = 0x15;
ua->ua_ivec = qeintr;
- ua->ua_iarg = sc->qe_device.dv_unit;
return 1;
}
@@ -361,7 +365,7 @@ qeattach(parent, self, aux)
printf("\n");
sc->qe_vaddr = addr;
- ifp->if_unit = sc->qe_device.dv_unit;
+ ifp->if_unit = sc->qe_dev.dv_unit;
ifp->if_name = "qe";
/*
* The Deqna is cable of transmitting broadcasts, but
@@ -376,7 +380,7 @@ qeattach(parent, self, aux)
sc->setup_pkt[i][1] = sc->qe_addr[i] =
addr->qe_sta_addr[i] & 0xff;
addr->qe_vector |= 1;
- printf("qe%d: %s, hardware address %s\n", sc->qe_device.dv_unit,
+ printf("qe%d: %s, hardware address %s\n", sc->qe_dev.dv_unit,
addr->qe_vector&01 ? "delqa":"deqna",
ether_sprintf(sc->qe_addr));
addr->qe_vector &= ~1;
@@ -388,7 +392,6 @@ qeattach(parent, self, aux)
ifp->if_start = qestart;
ifp->if_ioctl = qeioctl;
- ifp->if_reset = qereset;
ifp->if_watchdog = qetimeout;
sc->qe_uba.iff_flags = UBA_CANTWAIT;
if_attach(ifp);
@@ -397,22 +400,16 @@ qeattach(parent, self, aux)
/*
* Reset of interface after UNIBUS reset.
- * If interface is on specified uba, reset its state.
*/
+void
qereset(unit)
int unit;
{
- register struct uba_device *ui;
+ struct qe_softc *sc = qe_cd.cd_devs[unit];
- panic("qereset");
-#ifdef notyet
- if (unit >= NQE || (ui = qeinfo[unit]) == 0 || ui->ui_alive == 0 ||
- ui->ui_ubanum != uban)
- return;
- printf(" qe%d", unit);
- qe_softc[unit].qe_if.if_flags &= ~IFF_RUNNING;
+ printf(" %s", sc->qe_dev.dv_xname);
+ sc->qe_if.if_flags &= ~IFF_RUNNING;
qeinit(unit);
-#endif
}
/*
@@ -422,7 +419,7 @@ void
qeinit(unit)
int unit;
{
- struct qe_softc *sc = (struct qe_softc *)qecd.cd_devs[unit];
+ struct qe_softc *sc = (struct qe_softc *)qe_cd.cd_devs[unit];
struct qedevice *addr = sc->qe_vaddr;
struct ifnet *ifp = (struct ifnet *)&sc->qe_if;
int i;
@@ -452,7 +449,7 @@ qeinit(unit)
/*
* init buffers and maps
*/
- if (if_ubaminit(&sc->qe_uba, sc->qe_device.dv_parent->dv_unit,
+ if (if_ubaminit(&sc->qe_uba, sc->qe_dev.dv_parent->dv_unit,
sizeof (struct ether_header), (int)btoc(MAXPACKETSIZE),
sc->qe_ifr, NRCV, sc->qe_ifw, NXMT) == 0) {
fail:
@@ -518,8 +515,7 @@ void
qestart(ifp)
struct ifnet *ifp;
{
- int unit = ifp->if_unit;
- register struct qe_softc *sc = qecd.cd_devs[ifp->if_unit];
+ register struct qe_softc *sc = qe_cd.cd_devs[ifp->if_unit];
volatile struct qedevice *addr = sc->qe_vaddr;
register struct qe_ring *rp;
register index;
@@ -603,7 +599,7 @@ qeintr(unit)
volatile struct qedevice *addr;
int buf_addr, csr;
- sc = qecd.cd_devs[unit];
+ sc = qe_cd.cd_devs[unit];
addr = sc->qe_vaddr;
splx(sc->ipl);
if (!(sc->qe_flags & QEF_FASTTIMEO))
@@ -633,7 +629,7 @@ void
qetint(unit)
int unit;
{
- register struct qe_softc *sc = qecd.cd_devs[unit];
+ register struct qe_softc *sc = qe_cd.cd_devs[unit];
register struct qe_ring *rp;
register struct ifxmt *ifxp;
int status1, setupflag;
@@ -689,7 +685,7 @@ void
qerint(unit)
int unit;
{
- register struct qe_softc *sc = qecd.cd_devs[unit];
+ register struct qe_softc *sc = qe_cd.cd_devs[unit];
register struct qe_ring *rp;
register int nrcv = 0;
int len, status1, status2;
@@ -771,7 +767,7 @@ qeioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
- struct qe_softc *sc = qecd.cd_devs[ifp->if_unit];
+ struct qe_softc *sc = qe_cd.cd_devs[ifp->if_unit];
struct ifaddr *ifa = (struct ifaddr *)data;
int s = splnet(), error = 0;
@@ -827,7 +823,7 @@ qe_setaddr(physaddr, unit)
u_char *physaddr;
int unit;
{
- register struct qe_softc *sc = qecd.cd_devs[unit];
+ register struct qe_softc *sc = qe_cd.cd_devs[unit];
register int i;
for (i = 0; i < 6; i++)
@@ -906,8 +902,6 @@ qeread(sc, ifrw, len)
{
struct ether_header *eh;
struct mbuf *m;
- int s;
- struct ifqueue *inq;
/*
* Deal with trailer protocol: if type is INET trailer
@@ -950,7 +944,7 @@ qetimeout(unit)
{
register struct qe_softc *sc;
- sc = qecd.cd_devs[unit];
+ sc = qe_cd.cd_devs[unit];
#ifdef notdef
log(LOG_ERR, "qe%d: transmit timeout, restarted %d\n",
unit, sc->qe_restarts++);
diff --git a/sys/arch/vax/if/if_uba.c b/sys/arch/vax/if/if_uba.c
index c2e012fb217..5c793de044c 100644
--- a/sys/arch/vax/if/if_uba.c
+++ b/sys/arch/vax/if/if_uba.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_uba.c,v 1.7 1995/11/10 19:25:56 ragge Exp $ */
+/* $NetBSD: if_uba.c,v 1.11 1996/03/17 22:56:36 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -35,28 +35,30 @@
* @(#)if_uba.c 7.16 (Berkeley) 12/16/90
*/
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/malloc.h"
-#include "sys/mbuf.h"
-#include "sys/map.h"
-#include "sys/buf.h"
-#include "sys/socket.h"
-#include "sys/syslog.h"
-#include "net/if.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/malloc.h>
+#include <sys/mbuf.h>
+#include <sys/map.h>
+#include <sys/buf.h>
+#include <sys/socket.h>
+#include <sys/syslog.h>
-#include "machine/pte.h"
-#include "machine/mtpr.h"
-#include "machine/vmparam.h"
-#include "machine/macros.h"
-#include "if_uba.h"
-#include "vax/uba/ubareg.h"
-#include "vax/uba/ubavar.h"
+#include <net/if.h>
-static if_ubaalloc(struct ifubinfo *, struct ifrw *, int);
-static rcv_xmtbuf(struct ifxmt *);
-static restor_xmtbuf(struct ifxmt *);
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/vmparam.h>
+#include <machine/macros.h>
+
+#include <vax/if/if_uba.h>
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
+
+static int if_ubaalloc __P((struct ifubinfo *, struct ifrw *, int));
+static void rcv_xmtbuf __P((struct ifxmt *));
+static void restor_xmtbuf __P((struct ifxmt *));
/*
* Routines supporting UNIBUS network interfaces.
@@ -72,6 +74,7 @@ static restor_xmtbuf(struct ifxmt *);
* doing this once for each read and once for each write buffer. We also
* allocate page frames in the mbuffer pool for these pages.
*/
+int
if_ubaminit(ifu, uban, hlen, nmr, ifr, nr, ifw, nw)
register struct ifubinfo *ifu;
int uban, hlen, nmr, nr, nw;
@@ -109,7 +112,7 @@ if_ubaminit(ifu, uban, hlen, nmr, ifr, nr, ifw, nw)
}
ifu->iff_hlen = hlen;
ifu->iff_uban = uban;
- ubasc = ubacd.cd_devs[uban];
+ ubasc = uba_cd.cd_devs[uban];
ifu->iff_uba = ubasc->uh_uba;
ifu->iff_ubamr = ubasc->uh_mr;
}
@@ -147,7 +150,7 @@ bad:
* possibly a buffered data path, and initializing the fields of
* the ifrw structure to minimize run-time overhead.
*/
-static
+static int
if_ubaalloc(ifu, ifrw, nmr)
struct ifubinfo *ifu;
register struct ifrw *ifrw;
@@ -281,7 +284,7 @@ out:
* of the fact that clusters are placed on the xtofree list
* in inverse order, finding the last one.
*/
-static
+static void
rcv_xmtbuf(ifw)
register struct ifxmt *ifw;
{
@@ -290,7 +293,7 @@ rcv_xmtbuf(ifw)
register i;
char *cp;
- while (i = ffs((long)ifw->ifw_xswapd)) {
+ while ((i = ffs((long)ifw->ifw_xswapd)) != 0) {
cp = ifw->ifw_base + i * MCLBYTES;
i--;
ifw->ifw_xswapd &= ~(1<<i);
@@ -312,7 +315,7 @@ rcv_xmtbuf(ifw)
* Put a transmit buffer back together after doing an if_ubaget on it,
* which may have swapped pages.
*/
-static
+static void
restor_xmtbuf(ifw)
register struct ifxmt *ifw;
{
@@ -329,6 +332,7 @@ restor_xmtbuf(ifw)
* header which is copied to be in the mapped, aligned
* i/o space.
*/
+int
if_ubaput(ifu, ifw, m)
struct ifubinfo *ifu;
register struct ifxmt *ifw;
@@ -376,7 +380,7 @@ if_ubaput(ifu, ifw, m)
cc = cp - ifw->ifw_addr;
x = ((cc - ifu->iff_hlen) + MCLBYTES - 1) >> MCLSHIFT;
ifw->ifw_xswapd &= ~xswapd;
- while (i = ffs((long)ifw->ifw_xswapd)) {
+ while ((i = ffs((long)ifw->ifw_xswapd)) != 0) {
i--;
if (i >= x)
break;
diff --git a/sys/arch/vax/if/if_uba.h b/sys/arch/vax/if/if_uba.h
index b1d6a2a203f..8b425fd98f0 100644
--- a/sys/arch/vax/if/if_uba.h
+++ b/sys/arch/vax/if/if_uba.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_uba.h,v 1.3 1995/05/11 16:53:12 jtc Exp $ */
+/* $NetBSD: if_uba.h,v 1.5 1996/04/08 18:34:57 ragge Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@@ -132,5 +132,12 @@ struct ifuba {
if_ubaget(&(ifu)->ifu_info, &(ifu)->ifu_r, totlen, off0, ifp)
#define if_wubaput(ifu, m) \
if_ubaput(&(ifu)->ifu_info, &(ifu)->ifu_xmt, m)
-struct mbuf *if_ubaget();
+
+/* Prototypes */
+int if_ubaminit __P((struct ifubinfo *, int, int, int,
+ struct ifrw *, int, struct ifxmt *, int));
+int if_ubaput __P((struct ifubinfo *, struct ifxmt *, struct mbuf *));
+struct mbuf *if_ubaget __P((struct ifubinfo *, struct ifrw *, int,
+ struct ifnet *));
+
#endif
diff --git a/sys/arch/vax/include/ansi.h b/sys/arch/vax/include/ansi.h
index 5af1f55f91a..088f4a3dbec 100644
--- a/sys/arch/vax/include/ansi.h
+++ b/sys/arch/vax/include/ansi.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ansi.h,v 1.3 1994/10/26 08:01:59 cgd Exp $ */
+/* $NetBSD: ansi.h,v 1.4 1996/03/16 01:32:03 jtc Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -56,5 +56,6 @@
#define _BSD_TIME_T_ long /* time() */
#define _BSD_VA_LIST_ char * /* va_list */
#define _BSD_WCHAR_T_ int /* wchar_t */
+#define _BSD_WINT_T_ int /* wint_t */
#endif /* _ANSI_H_ */
diff --git a/sys/arch/vax/include/cpu.h b/sys/arch/vax/include/cpu.h
index 12ce8363e99..684bafd2e04 100644
--- a/sys/arch/vax/include/cpu.h
+++ b/sys/arch/vax/include/cpu.h
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.13 1995/12/13 18:57:57 ragge Exp $ */
+/* $NetBSD: cpu.h,v 1.16 1996/04/08 18:35:46 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -32,9 +32,9 @@
/* All bugs are subject to removal without further notice */
-#include "sys/cdefs.h"
-#include "machine/mtpr.h"
-#include "machine/pcb.h"
+#include <sys/cdefs.h>
+#include <machine/mtpr.h>
+#include <machine/pcb.h>
#define enablertclock()
#define cpu_wait(p)
@@ -45,12 +45,11 @@ extern int cpunumber, cpu_type;
extern struct cpu_dep cpu_calls[];
struct cpu_dep {
- int (*cpu_steal_pages)(); /* Pmap init before mm is on */
- int (*cpu_clock)(); /* CPU dependent clock handling */
- int (*cpu_mchk)(); /* Machine check handling */
- int (*cpu_memerr)(); /* Memory subsystem errors */
- int (*cpu_conf)(); /* Autoconfiguration */
-/* int (*cpu_cmrerr)(); /* Memory parity errors */
+ void (*cpu_steal_pages) __P((void)); /* pmap init before mm is on */
+ int (*cpu_clock) __P((void)); /* CPU dependent clock handling */
+ int (*cpu_mchk) __P((caddr_t)); /* Machine check handling */
+ void (*cpu_memerr) __P((void)); /* Memory subsystem errors */
+ void (*cpu_conf) __P((void *, void *, void *)); /* Autoconfiguration */
};
struct clockframe {
@@ -87,3 +86,17 @@ extern int want_resched; /* resched() was called */
*/
#define need_proftick(p) {(p)->p_flag |= P_OWEUPC; mtpr(AST_OK,PR_ASTLVL); }
+/* Some low-level prototypes */
+int badaddr __P((caddr_t, int));
+void cpu_set_kpc __P((struct proc *, void (*)(struct proc *)));
+void cpu_swapin __P((struct proc *));
+int hp_getdev __P((int, int));
+void configure __P((void));
+void dumpconf __P((void));
+void dumpsys __P((void));
+void setroot __P((void));
+void setconf __P((void));
+void swapconf __P((void));
+#ifdef DDB
+int kdbrint __P((int));
+#endif
diff --git a/sys/arch/vax/include/db_machdep.h b/sys/arch/vax/include/db_machdep.h
index b2a9fd68642..1cbaa2c5d43 100644
--- a/sys/arch/vax/include/db_machdep.h
+++ b/sys/arch/vax/include/db_machdep.h
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.1 1995/06/16 15:17:27 ragge Exp $ */
+/* $NetBSD: db_machdep.h,v 1.2 1996/04/08 18:35:47 ragge Exp $ */
/*
* Mach Operating System
@@ -70,4 +70,6 @@ db_regs_t ddb_regs; /* register state */
#define inst_load(ins) 0
#define inst_store(ins) 0
+/* Prototypes */
+void kdb_trap __P((struct trapframe *));
#endif /* _VAX_DB_MACHDEP_H_ */
diff --git a/sys/arch/vax/include/endian.h b/sys/arch/vax/include/endian.h
index 05e1526909c..b43df880e93 100644
--- a/sys/arch/vax/include/endian.h
+++ b/sys/arch/vax/include/endian.h
@@ -1,4 +1,4 @@
-/* $NetBSD: endian.h,v 1.6 1995/08/21 16:36:32 ragge Exp $ */
+/* $NetBSD: endian.h,v 1.7 1996/04/08 18:35:48 ragge Exp $ */
/*
* Copyright (c) 1987, 1991 Regents of the University of California.
@@ -102,10 +102,10 @@ __END_DECLS
/*
* Macros for network/external number representation conversion.
*/
-#define NTOHL(x) (x) = ntohl((unsigned long)(x))
-#define NTOHS(x) (x) = ntohs((unsigned long)(x))
-#define HTONL(x) (x) = htonl((unsigned long)(x))
-#define HTONS(x) (x) = htons((unsigned long)(x))
+#define NTOHL(x) (x) = ntohl((unsigned long)(x))
+#define NTOHS(x) (x) = ntohs((unsigned long)(x))
+#define HTONL(x) (x) = htonl((unsigned long)(x))
+#define HTONS(x) (x) = htons((unsigned long)(x))
#endif /* _POSIX_SOURCE */
diff --git a/sys/arch/vax/include/ioa.h b/sys/arch/vax/include/ioa.h
new file mode 100644
index 00000000000..86df5510434
--- /dev/null
+++ b/sys/arch/vax/include/ioa.h
@@ -0,0 +1,118 @@
+/* $NetBSD: ioa.h,v 1.4 1996/03/07 23:23:58 ragge Exp $ */
+/*-
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)ioa.h 7.3 (Berkeley) 5/9/91
+ */
+
+/****************************************************************
+ * *
+ * Licensed from Digital Equipment Corporation *
+ * Copyright (c) *
+ * Digital Equipment Corporation *
+ * Maynard, Massachusetts *
+ * 1985, 1986 *
+ * All rights reserved. *
+ * *
+ * The Information in this software is subject to change *
+ * without notice and should not be construed as a commitment *
+ * by Digital Equipment Corporation. Digital makes no *
+ * representations about the suitability of this software for *
+ * any purpose. It is supplied "As Is" without expressed or *
+ * implied warranty. *
+ * *
+ * If the Regents of the University of California or its *
+ * licensees modify the software in a manner creating *
+ * diriviative copyright rights, appropriate copyright *
+ * legends may be placed on the drivative work in addition *
+ * to that set forth above. *
+ * *
+ ****************************************************************/
+
+#if VAX8600
+#define MAXNIOA 4
+#define NIOA8600 2
+#define IOASIZE 0x2000000
+#define IOAMAPSIZ 512 /* Map one page to get at SBIA regs */
+#define IOA8600(i) ((caddr_t)(0x20080000+IOASIZE*i))
+
+struct sbia_regs
+{
+ int sbi_cfg;
+ int sbi_csr;
+ int sbi_errsum;
+ int sbi_dctl;
+ int sbi_dmaica;
+ int sbi_dmaiid;
+ int sbi_dmaaca;
+ int sbi_dmaaid;
+ int sbi_dmabcs;
+ int sbi_dmabid;
+ int sbi_dmaccs;
+ int sbi_dmacid;
+ int sbi_silo;
+ int sbi_error;
+ int sbi_timo;
+ int sbi_fltsts;
+ int sbi_silcmp;
+ int sbi_maint;
+ int sbi_unjam;
+ int sbi_qclr;
+ int sbi_unused[12];
+ int sbi_iv10;
+ int sbi_iv11;
+ int sbi_iv12;
+ int sbi_iv13;
+ int sbi_iv14;
+ int sbi_iv15;
+ int sbi_iv16;
+ int sbi_iv17;
+ int sbi_iv18;
+ int sbi_iv19;
+ int sbi_iv1a;
+ int sbi_iv1b;
+ int sbi_iv1c;
+ int sbi_iv1d;
+ int sbi_iv1e;
+};
+struct ioa {
+ union ioacsr {
+ long ioa_csr;
+ u_char ioa_type;
+ } ioacsr;
+ long ioa_pad[IOAMAPSIZ / sizeof (long) - 1];
+};
+
+#define IOA_TYPMSK 0xf0
+#define IOA_SBIA 0x10
+
+#endif VAX8600
diff --git a/sys/arch/vax/include/ka650.h b/sys/arch/vax/include/ka650.h
index 237402cac5c..63d9f42d93f 100644
--- a/sys/arch/vax/include/ka650.h
+++ b/sys/arch/vax/include/ka650.h
@@ -233,3 +233,14 @@ struct ka650_ipcr {
#define KA650ROM_PUTS 0x2006000c /* (jsb) put string to console */
#define KA650ROM_GETS 0x20060010 /* (jsb) read string with prompt */
#define KA650_CONSTYPE 0x20140401 /* byte at which console type resides */
+
+/* prototypes */
+struct sbi_attach_args;
+
+void uvaxIII_conf __P((void *, void *, void *));
+int uvaxIII_clock __P((void));
+void uvaxIII_memenable __P((struct sbi_attach_args *, struct device *));
+void uvaxIII_memerr __P((void));
+int uvaxIII_mchk __P((caddr_t));
+void uvaxIII_steal_pages __P((void));
+
diff --git a/sys/arch/vax/include/ka750.h b/sys/arch/vax/include/ka750.h
index 9b5f71b0745..cb6ff375a18 100644
--- a/sys/arch/vax/include/ka750.h
+++ b/sys/arch/vax/include/ka750.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ka750.h,v 1.3 1995/11/12 14:37:20 ragge Exp $ */
+/* $NetBSD: ka750.h,v 1.5 1996/04/08 18:35:50 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -30,7 +30,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "machine/nexus.h"
+#include <machine/nexus.h>
#define V750UCODE(x) ((x>>8)&255)
#define V750HARDW(x) (x&255)
@@ -42,3 +42,10 @@
/* 11/750 specific pages needed to be stolen when bootstrapping */
#define V750PGS 4
+/* 11/750 specific prototypes */
+void ka750_conf __P((void *, void *, void *));
+int ka750_clock __P((void));
+void ka750_memenable __P((struct sbi_attach_args *, struct device *));
+void ka750_memerr __P((void));
+int ka750_mchk __P((caddr_t));
+void ka750_steal_pages __P((void));
diff --git a/sys/arch/vax/include/macros.h b/sys/arch/vax/include/macros.h
index 969735a6640..b08881f0791 100644
--- a/sys/arch/vax/include/macros.h
+++ b/sys/arch/vax/include/macros.h
@@ -1,4 +1,4 @@
-/* $NetBSD: macros.h,v 1.6 1995/12/13 18:56:01 ragge Exp $ */
+/* $NetBSD: macros.h,v 1.8 1996/03/17 22:44:50 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,7 +33,7 @@
/* All bugs are subject to removal without further notice */
#if !defined(_VAX_MACROS_H_) && (defined(STANDALONE) || \
- (!defined(ASSEMBLER) && defined(_VAX_INLINE_)))
+ (!defined(_LOCORE) && defined(_VAX_INLINE_)))
#define _VAX_MACROS_H_
/* Here general macros are supposed to be stored */
@@ -137,7 +137,7 @@ static __inline__ int scanc(u_int size, u_char *cp,u_char *table, int mask){
return ret;
}
-static __inline__ int skpc(int mask, int size, char *cp){
+static __inline__ int skpc(int mask, size_t size, u_char *cp){
register ret;
asm __volatile("skpc %1,%2,(%3);movl r0,%0"
diff --git a/sys/arch/vax/include/mtpr.h b/sys/arch/vax/include/mtpr.h
index 6da155b2f69..0ee73aa8575 100644
--- a/sys/arch/vax/include/mtpr.h
+++ b/sys/arch/vax/include/mtpr.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mtpr.h,v 1.5 1995/05/03 19:53:45 ragge Exp $ */
+/* $NetBSD: mtpr.h,v 1.8 1996/03/07 23:23:59 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -35,7 +35,7 @@
#ifndef _VAX_MTPR_H_
#define _VAX_MTPR_H_
-#include "machine/macros.h"
+#include <machine/macros.h>
/******************************************************************************
@@ -103,11 +103,27 @@
#define PR_SID 62 /* System ID Register */
#define PR_TBCHK 63 /* Translation Buffer Check */
+#define PR_PAMACC 64 /* Physical Address Memory Map Access (KA86) */
+#define PR_PAMLOC 65 /* Physical Address Memory Map Location (KA86) */
+#define PR_CSWP 66 /* Cache Sweep (KA86) */
+#define PR_MDECC 67 /* MBOX Data Ecc Register (KA86) */
+#define PR_MENA 68 /* MBOX Error Enable Register (KA86) */
+#define PR_MDCTL 69 /* MBOX Data Control Register (KA86) */
+#define PR_MCCTL 70 /* MBOX Mcc Control Register (KA86) */
+#define PR_MERG 71 /* MBOX Error Generator Register (KA86) */
+#define PR_CRBT 72 /* Console Reboot (KA86) */
+#define PR_DFI 73 /* Diagnostic Fault Insertion Register (KA86) */
+#define PR_EHSR 74 /* Error Handling Status Register (KA86) */
+#define PR_STXCS 76 /* Console Storage C/S (KA86) */
+#define PR_STXDB 77 /* Console Storage D/B (KA86) */
+#define PR_ESPA 78 /* EBOX Scratchpad Address (KA86) */
+#define PR_ESPD 79 /* EBOX Scratchpad Data (KA86) */
+
/* Definitions for AST */
#define AST_NO 4
#define AST_OK 3
-#ifndef ASSEMBLER
+#ifndef _LOCORE
#define mtpr(val,reg) \
{ \
@@ -124,6 +140,6 @@
: "g" (reg)); \
val; \
})
-#endif /* ASSEMBLER */
+#endif /* _LOCORE */
#endif /* _VAX_MTPR_H_ */
diff --git a/sys/arch/vax/include/nexus.h b/sys/arch/vax/include/nexus.h
index 7f65fcae77d..60343f3df2c 100644
--- a/sys/arch/vax/include/nexus.h
+++ b/sys/arch/vax/include/nexus.h
@@ -1,4 +1,4 @@
-/* $NetBSD: nexus.h,v 1.6 1995/12/13 18:55:27 ragge Exp $ */
+/* $NetBSD: nexus.h,v 1.10 1996/03/02 14:27:53 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -75,9 +75,9 @@
#define MAXNNEXUS NNEXSBI
#endif
-#ifndef ASSEMBLER
+#ifndef _LOCORE
-#include "sys/types.h"
+#include <sys/types.h>
struct nexus {
union nexcsr {
@@ -94,6 +94,14 @@ struct sbi_attach_args {
void *nexaddr; /* Virtual address of this nexus */
};
+/* Memory device struct. This should be somewhere else */
+struct mem_softc {
+ struct device sc_dev;
+ caddr_t sc_memaddr;
+ int sc_memtype;
+ int sc_memnr;
+};
+
struct iobus {
int io_type;
int io_addr;
@@ -173,7 +181,16 @@ extern caddr_t *nex_vec;
#define NEX_MEM256UI 0x73 /* 256K chips, ext-interleaved, upper */
#define NEX_MEM256I 0x74 /* 256K chips, interleaved */
-#ifndef ASSEMBLER
+/* Memory classes */
+#define M780C 0
+#define M780EL 1
+#define M780EU 2
+
+/* Memory recover defines */
+#define MCHK_PANIC -1
+#define MCHK_RECOVERED 0
+
+#ifndef _LOCORE
struct nexus *nexus;
#endif
diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h
index c9be598e85d..ef969e37240 100644
--- a/sys/arch/vax/include/param.h
+++ b/sys/arch/vax/include/param.h
@@ -1,5 +1,4 @@
-/* $NetBSD: param.h,v 1.14 1995/12/30 21:37:31 ragge Exp $ */
-
+/* $NetBSD: param.h,v 1.19 1996/03/04 05:04:43 cgd Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -41,16 +40,18 @@
#ifndef _VAX_PARAM_H_
#define _VAX_PARAM_H_
-#include "machine/macros.h"
-#include "machine/psl.h"
+#include <machine/macros.h>
+#include <machine/psl.h>
/*
* Machine dependent constants for VAX.
*/
-#define MACHINE "vax"
+#define _MACHINE vax
+#define MACHINE "vax"
+#define _MACHINE_ARCH vax
#define MACHINE_ARCH "vax"
-#define MID_MACHINE MID_VAX
+#define MID_MACHINE MID_VAX
/*
* Round p (pointer or byte index) up to a correctly-aligned value
@@ -163,7 +164,7 @@
#define splbio() splx(0x15) /* IPL15 */
#define splnet() splx(0x15) /* IPL15 */
#define spltty() splx(0x15) /* IPL15 */
-#define splimp() splx(0x16) /* IPL16 */
+#define splimp() splx(0x17) /* IPL17 */
#define splclock() splx(0x18) /* IPL18 */
#define splhigh() splx(0x1f) /* IPL1F */
#define splstatclock() splclock()
@@ -173,6 +174,11 @@
#define vmapbuf(p,q)
#define vunmapbuf(p,q)
+/* Prototype needed for delay() */
+#ifndef _LOCORE
+void delay __P((int));
+#endif
+
#define DELAY(x) delay(x)
#endif /* _VAX_PARAM_H_ */
diff --git a/sys/arch/vax/include/pcb.h b/sys/arch/vax/include/pcb.h
index 14f952dadc9..532a643480b 100644
--- a/sys/arch/vax/include/pcb.h
+++ b/sys/arch/vax/include/pcb.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.9 1996/01/28 12:27:19 ragge Exp $ */
+/* $NetBSD: pcb.h,v 1.10 1996/02/02 18:08:26 mycroft Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -35,7 +35,7 @@
#ifndef _VAX_PCB_H_
#define _VAX_PCB_H_
-#include "machine/trap.h"
+#include <machine/trap.h>
struct pcb {
diff --git a/sys/arch/vax/include/pmap.h b/sys/arch/vax/include/pmap.h
index bfc1996e920..870776d4a5e 100644
--- a/sys/arch/vax/include/pmap.h
+++ b/sys/arch/vax/include/pmap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.11 1995/11/12 14:41:41 ragge Exp $ */
+/* $NetBSD: pmap.h,v 1.16 1996/04/08 18:35:51 ragge Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
@@ -46,7 +46,7 @@
#ifndef PMAP_H
#define PMAP_H
-#include "machine/mtpr.h"
+#include <machine/mtpr.h>
#define VAX_PAGE_SIZE NBPG
@@ -99,13 +99,11 @@ typedef struct pv_entry {
avail_start += (count) * NBPG;
#ifdef _KERNEL
-pv_entry_t pv_table; /* array of entries,
- one per LOGICAL page */
-struct pmap kernel_pmap_store;
-
#define pa_index(pa) atop(pa)
#define pa_to_pvh(pa) (&pv_table[atop(pa)])
+extern struct pmap kernel_pmap_store;
+
#define pmap_kernel() (&kernel_pmap_store)
#endif /* _KERNEL */
@@ -117,6 +115,10 @@ struct pmap kernel_pmap_store;
#define pmap_collect(pmap) /* No need so far */
#define pmap_reference(pmap) if(pmap) (pmap)->ref_count++
#define pmap_pinit(pmap) (pmap)->ref_count=1;
-#define pmap_phys_address(phys) ((u_int)(phys)<<PAGE_SIZE)
+#define pmap_phys_address(phys) ((u_int)(phys)<<PAGE_SHIFT)
+/* Prototypes */
+void pmap_bootstrap __P((void));
+void pmap_expandp0 __P((struct pmap *, int));
+void pmap_expandp1 __P((struct pmap *));
#endif PMAP_H
diff --git a/sys/arch/vax/include/pte.h b/sys/arch/vax/include/pte.h
index 1251b7fc61a..3b2adb9dd5b 100644
--- a/sys/arch/vax/include/pte.h
+++ b/sys/arch/vax/include/pte.h
@@ -1,4 +1,4 @@
-/* $NetBSD: pte.h,v 1.7 1996/01/28 12:31:24 ragge Exp $ */
+/* $NetBSD: pte.h,v 1.10 1996/02/23 17:54:33 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -30,9 +30,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "machine/param.h"
+#include <machine/param.h>
-#ifndef ASSEMBLER
+#ifndef _LOCORE
/*
* VAX page table entries
@@ -52,7 +52,7 @@ struct pte {
typedef struct pte pt_entry_t; /* Mach page table entry */
-#endif ASSEMBLER
+#endif _LOCORE
#define PT_ENTRY_NULL ((pt_entry_t *) 0)
@@ -73,7 +73,7 @@ typedef struct pte pt_entry_t; /* Mach page table entry */
#define PG_FRAME 0x001fffff
#define PG_PFNUM(x) ((x) >> PGSHIFT)
-#ifndef ASSEMBLER
+#ifndef _LOCORE
extern pt_entry_t *Sysmap;
/*
* Kernel virtual address to page table entry and to physical address.
@@ -87,6 +87,6 @@ extern pt_entry_t *Sysmap;
#define kvtophys(va) \
(((kvtopte(va))->pg_pfn << PGSHIFT) | ((int)(va) & PGOFSET))
#define uvtopte(va, pcb) \
- (((unsigned)va < 0x40000000) || ((unsigned)va > 0x40000000) ? \
+ (((unsigned)va < 0x40000000) || ((unsigned)va > 0x80000000) ? \
&((pcb->P0BR)[(unsigned)va >> PGSHIFT]) : \
&((pcb->P1BR)[((unsigned)va & 0x3fffffff) >> PGSHIFT]))
diff --git a/sys/arch/vax/include/rsp.h b/sys/arch/vax/include/rsp.h
new file mode 100644
index 00000000000..5822f4bf780
--- /dev/null
+++ b/sys/arch/vax/include/rsp.h
@@ -0,0 +1,89 @@
+/* $NetBSD: rsp.h,v 1.1 1996/02/17 18:14:50 ragge Exp $ */
+/*
+ * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+
+/*
+ * The Radial Serial Protocol (RSP) that TU58 (DECtape II) uses
+ * is a strange animal that is sent over serial lines.
+ * Most packet types can match the struct rsp, but some can't (i.e.
+ * data packets).
+ * More about RSP can be read in Digital Peripherals Handbook, p. 92.
+ */
+
+struct rsp {
+ char rsp_typ; /* Packet type */
+ char rsp_sz; /* Packet size */
+ char rsp_op; /* Operation */
+ char rsp_mod; /* Modifier */
+ char rsp_drv; /* Tape drive number */
+ char rsp_sw; /* Switches */
+ char rsp_xx1; /* Unused, always zero */
+ char rsp_xx2; /* Unused, always zero */
+ short rsp_cnt; /* Byte count to transfer */
+ short rsp_blk; /* Block number */
+ short rsp_sum; /* Checksum of packet */
+};
+
+/* Types of packets */
+#define RSP_TYP_DATA 001 /* DATA packet */
+#define RSP_TYP_COMMAND 002 /* COMMAND packet */
+#define RSP_TYP_INIT 004 /* INITIALIZE packet */
+#define RSP_TYP_BOOT 010 /* BOOTSTRAP packet (PDP11) */
+#define RSP_TYP_CONTINUE 020 /* CONTINUE packet */
+#define RSP_TYP_XOFF 023 /* XOFF packet */
+
+/* Operation types */
+#define RSP_OP_NOP 000 /* No operation */
+#define RSP_OP_RESET 001 /* Reset */
+#define RSP_OP_READ 002 /* Read data */
+#define RSP_OP_WRITE 003 /* Write data */
+#define RSP_OP_POS 005 /* Position tape */
+#define RSP_OP_DIAG 007 /* internal diagnose */
+#define RSP_OP_GSTAT 010 /* Get status */
+#define RSP_OP_SSTAT 011 /* Set status */
+#define RSP_OP_END 100 /* End packet */
+
+/* Modifier */
+#define RSP_MOD_VERIFY 001 /* Verify read data */
+#define RSP_MOD_OK 000 /* Success */
+#define RSP_MOD_RETR 001 /* Success w/ retries */
+#define RSP_MOD_FAIL -1 /* Failed self-test */
+#define RSP_MOD_PART -2 /* Partial operation */
+#define RSP_MOD_NET -8 /* Non-existent tape drive */
+#define RSP_MOD_NOC -9 /* No cartridge */
+#define RSP_MOD_WP -11 /* Write protected */
+#define RSP_MOD_DERR -17 /* Data error */
+#define RSP_MOD_SERR -32 /* Seek error */
+#define RSP_MOD_STOP -33 /* Motor stopped */
+#define RSP_MOD_INVAL -48 /* Invalid opcode */
+#define RSP_MOD_INVBLK -55 /* Invalid bloch number */
+
diff --git a/sys/arch/vax/include/trap.h b/sys/arch/vax/include/trap.h
index 6ce8f0aa6aa..ff7f89cf3b1 100644
--- a/sys/arch/vax/include/trap.h
+++ b/sys/arch/vax/include/trap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.h,v 1.11 1996/01/28 12:30:13 ragge Exp $ */
+/* $NetBSD: trap.h,v 1.13 1996/04/08 18:35:52 ragge Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -67,7 +67,7 @@
/* Trap's coming from user mode */
#define T_USER 0x100
-#ifndef ASSEMBLER
+#ifndef _LOCORE
struct trapframe {
unsigned fp; /* Stack frame pointer */
unsigned ap; /* Argument pointer on user stack */
@@ -103,13 +103,13 @@ struct ivec_dsp {
char pushlarg; /* $? */
char nop; /* nop, for foolish gcc */
char calls[3]; /* calls $1,? */
- void (*hoppaddr)(); /* jump for calls */
+ void (*hoppaddr) __P((int)); /* jump for calls */
char popr; /* popr $0x3f */
char poprarg;
char rei; /* rei */
char pad; /* sizeof(struct ivec_dsp) == 16 */
};
-#endif /* ASSEMBLER */
+#endif /* _LOCORE */
#endif _VAX_TRAP_H_
diff --git a/sys/arch/vax/include/types.h b/sys/arch/vax/include/types.h
index b37de79c8e7..7248b4711a3 100644
--- a/sys/arch/vax/include/types.h
+++ b/sys/arch/vax/include/types.h
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.6 1995/12/09 04:41:57 mycroft Exp $ */
+/* $NetBSD: types.h,v 1.9 1996/04/08 18:35:53 ragge Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -41,7 +41,6 @@
#include <sys/cdefs.h>
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
-#if 0
typedef struct _physadr {
int r[1];
} *physadr;
@@ -50,7 +49,6 @@ typedef struct _physadr {
typedef struct label_t {
int val[6];
} label_t;
-#endif /* 0 */
#endif
typedef unsigned long vm_offset_t;
@@ -74,7 +72,4 @@ typedef unsigned long long u_int64_t;
typedef int32_t register_t;
-#define __BDEVSW_DUMP_OLD_TYPE
-#define __FORK_BRAINDAMAGE
-
#endif /* _MACHTYPES_H_ */
diff --git a/sys/arch/vax/include/uvaxII.h b/sys/arch/vax/include/uvaxII.h
index c5376d0ee80..7612b7abb35 100644
--- a/sys/arch/vax/include/uvaxII.h
+++ b/sys/arch/vax/include/uvaxII.h
@@ -1,4 +1,4 @@
-/* $NetBSD: uvaxII.h,v 1.1 1995/02/23 17:51:45 ragge Exp $ */
+/* $NetBSD: uvaxII.h,v 1.3 1996/04/08 18:35:54 ragge Exp $ */
/*-
* Copyright (c) 1986, 1988 The Regents of the University of California.
* All rights reserved.
@@ -62,8 +62,8 @@ struct uvaxIIcpu {
#define UVAXIICEAR_PG 0x00007fff
#define UVAXIIDEAR_PG 0x00007fff
-u_long uvaxII_gettodr();
-void uvaxII_settodr();
+u_long uvaxII_gettodr __P((int *));
+void uvaxII_settodr __P((time_t));
#endif
/*
@@ -122,4 +122,13 @@ struct ka630clock {
};
#endif
+struct sbi_attach_args;
+
+/* Prototypes */
+void uvaxII_conf __P((void *, void *, void *));
+int uvaxII_clock __P((void));
+void uvaxII_memenable __P((struct sbi_attach_args *, struct device *));
+void uvaxII_memerr __P((void));
+int uvaxII_mchk __P((caddr_t));
+void uvaxII_steal_pages __P((void));
#endif
diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h
index 8f449eabbd3..36d52b2b10a 100644
--- a/sys/arch/vax/include/vmparam.h
+++ b/sys/arch/vax/include/vmparam.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.10 1995/12/13 18:53:15 ragge Exp $ */
+/* $NetBSD: vmparam.h,v 1.11 1996/02/02 19:08:43 mycroft Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -39,7 +39,7 @@
*
* @(#)vmparam.h 5.9 (Berkeley) 5/12/91
*/
-#ifndef ASSEMBLER
+#ifndef _LOCORE
#include <vm/vm_param.h>
#endif
diff --git a/sys/arch/vax/mba/hp.c b/sys/arch/vax/mba/hp.c
index 4220d547acb..0dbb14fd472 100644
--- a/sys/arch/vax/mba/hp.c
+++ b/sys/arch/vax/mba/hp.c
@@ -1,6 +1,6 @@
-/* $NetBSD: hp.c,v 1.1 1995/02/13 00:43:59 ragge Exp $ */
+/* $NetBSD: hp.c,v 1.8 1996/04/08 18:38:58 ragge Exp $ */
/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
+ * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -13,7 +13,8 @@
* 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}.
+ * 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
*
@@ -29,338 +30,464 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- /* All bugs are subject to removal without further notice */
-
+/*
+ * Simple device driver routine for massbuss disks.
+ * TODO:
+ * Fix support for Standard DEC BAD144 bad block forwarding.
+ * Be able to to handle soft/hard transfer errors.
+ * Handle non-data transfer interrupts.
+ * Autoconfiguration of disk drives 'on the fly'.
+ * Handle disk media changes.
+ * Dual-port operations should be supported.
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/disklabel.h>
+#include <sys/disk.h>
+#include <sys/dkio.h>
+#include <sys/buf.h>
+#include <sys/stat.h>
+#include <sys/ioccom.h>
+#include <sys/fcntl.h>
+#include <sys/syslog.h>
+#include <sys/cpu.h>
+
+#include <machine/trap.h>
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/cpu.h>
+
+#include <vax/mba/mbavar.h>
+#include <vax/mba/mbareg.h>
+#include <vax/mba/hpreg.h>
+
+#define HPMASK 0xffff
+
+struct hp_softc {
+ struct device sc_dev;
+ struct disk sc_disk;
+ struct mba_device sc_md; /* Common struct used by mbaqueue. */
+ int sc_wlabel; /* Disklabel area is writable */
+ int sc_physnr; /* Physical disk number */
+};
+int hpmatch __P((struct device *, void *, void *));
+void hpattach __P((struct device *, struct device *, void *));
+void hpstrategy __P((struct buf *));
+void hpstart __P((struct mba_device *));
+int hpattn __P((struct mba_device *));
+enum xfer_action hpfinish __P((struct mba_device *, int, int *));
+int hpopen __P((dev_t, int, int));
+int hpclose __P((dev_t, int, int));
+int hpioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int hpdump __P((dev_t, caddr_t, caddr_t, size_t));
+int hpread __P((dev_t, struct uio *));
+int hpwrite __P((dev_t, struct uio *));
+int hpsize __P((dev_t));
+
+struct cfdriver hp_cd = {
+ NULL, "hp", DV_DISK
+};
-/* hp.c - drivrutiner f|r massbussdiskar 940325/ragge */
+struct cfattach hp_ca = {
+ sizeof(struct hp_softc), hpmatch, hpattach
+};
-#include "param.h"
-#include "types.h"
-#include "fcntl.h"
-#include "syslog.h"
-#include "disklabel.h"
-#include "buf.h"
-#include "vax/mba/mbareg.h"
-#include "vax/mba/mbavar.h"
-#include "vax/mba/hpdefs.h"
-#include "hp.h"
+/*
+ * Check if this is a disk drive; done by checking type from mbaattach.
+ */
+int
+hpmatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct cfdata *cf = match;
+ struct mba_attach_args *ma = aux;
-struct mba_device *hpinfo[NHP];
-struct hp_info hp_info[NHP];
-struct disklabel hplabel[NHP];
-int hpslave(), hpattach();
+ if (cf->cf_loc[0] != -1 && cf->cf_loc[0] != ma->unit)
+ return 0;
-char hptypes[]={
- 0x22,0
-};
+ if (ma->devtyp != MB_RP)
+ return 0;
-struct mba_driver hpdriver={
- hpslave, 0, "hp", hptypes, hpattach, hpinfo
-};
+ return 1;
+}
-hpslave(){
- printf("Hpslave.\n");
- asm("halt");
-};
+/*
+ * Disk drive found; fake a disklabel and try to read the real one.
+ * If the on-disk label can't be read; we lose.
+ */
+void
+hpattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct hp_softc *sc = (void *)self;
+ struct mba_softc *ms = (void *)parent;
+ struct disklabel *dl;
+ struct mba_attach_args *ma = aux;
+ char *msg;
-hpopen(){
- printf("hpopen");
- asm("halt");
-};
+ /*
+ * Init the common struct for both the adapter and its slaves.
+ */
+ sc->sc_md.md_softc = (void *)sc; /* Pointer to this softc */
+ sc->sc_md.md_mba = (void *)parent; /* Pointer to parent softc */
+ sc->sc_md.md_start = hpstart; /* Disk start routine */
+ sc->sc_md.md_attn = hpattn; /* Disk attention routine */
+ sc->sc_md.md_finish = hpfinish; /* Disk xfer finish routine */
-hpclose(){
- printf("hpclose\n");
- asm("halt");
-};
+ ms->sc_md[ma->unit] = &sc->sc_md; /* Per-unit backpointer */
-hpioctl(){
- printf("hpioctl\n");
- asm("halt");
-}
+ sc->sc_physnr = ma->unit;
+ /*
+ * Init and attach the disk structure.
+ */
+ sc->sc_disk.dk_name = sc->sc_dev.dv_xname;
+ disk_attach(&sc->sc_disk);
-hpdump(){
- printf("hpdump\n");
- asm("halt");
-};
+ /*
+ * Fake a disklabel to be able to read in the real label.
+ */
+ dl = sc->sc_disk.dk_label;
-hpsize(){
- printf("hpsize");
- asm("halt");
-};
+ dl->d_secsize = DEV_BSIZE;
+ dl->d_ntracks = 1;
+ dl->d_nsectors = 32;
+ dl->d_secpercyl = 32;
+ /*
+ * Read in label.
+ */
+ if ((msg = readdisklabel(makedev(0, self->dv_unit * 8), hpstrategy,
+ dl, NULL)) != NULL)
+ printf(": %s", msg);
+ printf(": %s, size = %d sectors\n", dl->d_typename, dl->d_secperunit);
+}
-hpattach(mi)
- struct mba_device *mi;
+void
+hpstrategy(bp)
+ struct buf *bp;
{
- struct mba_drv *md;
+ struct hp_softc *sc;
+ struct buf *gp;
+ int unit, s;
+
+ unit = DISKUNIT(bp->b_dev);
+ sc = hp_cd.cd_devs[unit];
+
+ if (bounds_check_with_label(bp, sc->sc_disk.dk_label, sc->sc_wlabel)
+ <= 0)
+ goto done;
+ s = splbio();
+
+ gp = sc->sc_md.md_q.b_actf;
+ disksort(&sc->sc_md.md_q, bp);
+ if (gp == 0)
+ mbaqueue(&sc->sc_md);
+
+ splx(s);
+ return;
+
+done:
+ bp->b_resid = bp->b_bcount;
+ biodone(bp);
+}
/*
- * We check status of the drive first; to see if there is any idea
- * to try to read the label.
+ * Start transfer on given disk. Called from mbastart().
*/
- md=&(mi->mi_mba->mba_drv[mi->drive]);
- if(!md->rmcs1&HPCS1_DVA){
- printf(": Drive not available");
- return;
- }
- if(!md->rmds&HPDS_MOL){
- printf(": Drive offline");
- return;
+void
+hpstart(md)
+ struct mba_device *md;
+{
+ struct hp_softc *sc = md->md_softc;
+ struct mba_regs *mr = md->md_mba->sc_mbareg;
+ volatile struct hp_regs *hr;
+ struct disklabel *lp = sc->sc_disk.dk_label;
+ struct buf *bp = md->md_q.b_actf;
+ unsigned bn, cn, sn, tn;
+ int part = DISKPART(bp->b_dev);
+
+ /*
+ * Collect statistics.
+ */
+ disk_busy(&sc->sc_disk);
+ sc->sc_disk.dk_seek++;
+
+ hr = (void *)&mr->mba_md[DISKUNIT(bp->b_dev)];
+
+ bn = bp->b_blkno + lp->d_partitions[part].p_offset;
+ if (bn) {
+ cn = bn / lp->d_secpercyl;
+ sn = bn % lp->d_secpercyl;
+ tn = sn / lp->d_nsectors;
+ sn = sn % lp->d_nsectors;
+ } else
+ cn = sn = tn = 0;
+
+ hr->hp_dc = cn;
+ hr->hp_da = (tn << 8) | sn;
+ if (bp->b_flags & B_READ)
+ hr->hp_cs1 = HPCS_READ; /* GO */
+ else
+ hr->hp_cs1 = HPCS_WRITE;
+}
+
+int
+hpopen(dev, flag, fmt)
+ dev_t dev;
+ int flag, fmt;
+{
+ struct hp_softc *sc;
+ int unit, part;
+
+ unit = DISKUNIT(dev);
+ if (unit >= hp_cd.cd_ndevs)
+ return ENXIO;
+ sc = hp_cd.cd_devs[unit];
+ if (sc == 0)
+ return ENXIO;
+
+ part = DISKPART(dev);
+
+ if (part >= sc->sc_disk.dk_label->d_npartitions)
+ return ENXIO;
+
+ switch (fmt) {
+ case S_IFCHR:
+ sc->sc_disk.dk_copenmask |= (1 << part);
+ break;
+
+ case S_IFBLK:
+ sc->sc_disk.dk_bopenmask |= (1 << part);
+ break;
}
- if (hpinit(mi, 0))
- printf(": offline");
-/* else if (ra_info[unit].ra_state == OPEN) {
- printf(": %s, size = %d sectors",
- udalabel[unit].d_typename, ra_info[unit].ra_dsize);
-*/
- printf("rmcs1: %x, rmds: %x, rmdt: %x rmsn: %x\n",
- md->rmcs1, md->rmds, md->rmdt, md->rmsn);
+ sc->sc_disk.dk_openmask =
+ sc->sc_disk.dk_copenmask | sc->sc_disk.dk_bopenmask;
+ return 0;
+}
-/* asm("halt"); */
-/*
- if (MSCP_MID_ECH(1, ra_info[unit].ra_mediaid) == 'X' - '@') {
- printf(": floppy");
- return;
- }
- if (ui->ui_dk >= 0)
- dk_wpms[ui->ui_dk] = (60 * 31 * 256);
- udaip[ui->ui_ctlr][ui->ui_slave] = ui;
-
- if (uda_rainit(ui, 0))
- printf(": offline");
- else if (ra_info[unit].ra_state == OPEN) {
- printf(": %s, size = %d sectors",
- udalabel[unit].d_typename, ra_info[unit].ra_dsize);
- }*/
+int
+hpclose(dev, flag, fmt)
+ dev_t dev;
+ int flag, fmt;
+{
+ struct hp_softc *sc;
+ int unit, part;
+
+ unit = DISKUNIT(dev);
+ sc = hp_cd.cd_devs[unit];
+
+ part = DISKPART(dev);
+
+ switch (fmt) {
+ case S_IFCHR:
+ sc->sc_disk.dk_copenmask &= ~(1 << part);
+ break;
+
+ case S_IFBLK:
+ sc->sc_disk.dk_bopenmask &= ~(1 << part);
+ break;
+ }
+ sc->sc_disk.dk_openmask =
+ sc->sc_disk.dk_copenmask | sc->sc_disk.dk_bopenmask;
+
+ return 0;
}
+int
+hpioctl(dev, cmd, addr, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t addr;
+ int flag;
+ struct proc *p;
+{
+ struct hp_softc *sc = hp_cd.cd_devs[DISKUNIT(dev)];
+ struct disklabel *lp = sc->sc_disk.dk_label;
+ int error;
+
+ switch (cmd) {
+ case DIOCGDINFO:
+ bcopy(lp, addr, sizeof (struct disklabel));
+ return 0;
+
+ case DIOCGPART:
+ ((struct partinfo *)addr)->disklab = lp;
+ ((struct partinfo *)addr)->part =
+ &lp->d_partitions[DISKPART(dev)];
+ break;
+
+ case DIOCSDINFO:
+ if ((flag & FWRITE) == 0)
+ return EBADF;
+
+ return setdisklabel(lp, (struct disklabel *)addr, 0, 0);
+
+ case DIOCWDINFO:
+ if ((flag & FWRITE) == 0)
+ error = EBADF;
+ else {
+ sc->sc_wlabel = 1;
+ error = writedisklabel(dev, hpstrategy, lp, 0);
+ sc->sc_wlabel = 0;
+ }
+ return error;
+ case DIOCWLABEL:
+ if ((flag & FWRITE) == 0)
+ return EBADF;
+ sc->sc_wlabel = 1;
+ break;
+
+ default:
+ printf("hpioctl: command %x\n", (unsigned int)cmd);
+ return ENOTTY;
+ }
+ return 0;
+}
/*
- * Initialise a drive. If it is not already, bring it on line,
- * and set a timeout on it in case it fails to respond.
- * When on line, read in the pack label.
+ * Called when a transfer is finished. Check if transfer went OK,
+ * Return info about what-to-do-now.
*/
-hpinit(mi, flags)
- struct mba_device *mi;
+enum xfer_action
+hpfinish(md, mbasr, attn)
+ struct mba_device *md;
+ int mbasr, *attn;
{
-/* struct uda_softc *sc = &uda_softc[ui->ui_ctlr]; */
- struct disklabel *lp;
- struct hp_info *hp;
-/* struct mscp *mp; */
- int unit = mi->unit;
- char *msg, *readdisklabel();
- int s, i, hpstrategy();
- extern int cold;
-
- hp = &hp_info[unit];
-/*
- if ((ui->ui_flags & UNIT_ONLINE) == 0) {
- mp = mscp_getcp(&sc->sc_mi, MSCP_WAIT);
- mp->mscp_opcode = M_OP_ONLINE;
- mp->mscp_unit = ui->ui_slave;
- mp->mscp_cmdref = (long)&ui->ui_flags;
- *mp->mscp_addr |= MSCP_OWN | MSCP_INT;
- ra->ra_state = WANTOPEN;
- if (!cold)
- s = spl5();
- i = ((struct udadevice *)ui->ui_addr)->udaip;
-
- if (cold) {
- i = todr() + 1000;
- while ((ui->ui_flags & UNIT_ONLINE) == 0)
- if (todr() > i)
- break;
- } else {
- timeout(wakeup, (caddr_t)&ui->ui_flags, 10 * hz);
- sleep((caddr_t)&ui->ui_flags, PSWP + 1);
- splx(s);
- untimeout(wakeup, (caddr_t)&ui->ui_flags);
- }
- if (ra->ra_state != OPENRAW) {
- ra->ra_state = CLOSED;
- wakeup((caddr_t)ra);
- return (EIO);
- }
- }
-*/
- lp = &hplabel[unit];
- lp->d_secsize = DEV_BSIZE;
-
- lp->d_secsize = DEV_BSIZE;
- lp->d_secperunit = 15 /*ra->ra_dsize*/;
-
- if (flags & O_NDELAY)
- return (0);
- hp->hp_state = RDLABEL;
- /*
- * Set up default sizes until we have the label, or longer
- * if there is none. Set secpercyl, as readdisklabel wants
- * to compute b_cylin (although we do not need it), and set
- * nsectors in case diskerr is called.
- */
- lp->d_secpercyl = 1;
- lp->d_npartitions = 1;
- lp->d_secsize = 512;
-/* lp->d_secperunit = ra->ra_dsize; */
- lp->d_nsectors = 15 /*ra->ra_geom.rg_nsectors*/;
- lp->d_partitions[0].p_size = lp->d_secperunit;
- lp->d_partitions[0].p_offset = 0;
-
- /*
- * Read pack label.
- */
- if ((msg = readdisklabel(hpminor(unit, 0), hpstrategy, lp)) != NULL) {
- if (cold)
- printf(": %s", msg);
- else
- log(LOG_ERR, "hp%d: %s", unit, msg);
-/* ra->ra_state = OPENRAW; */
-/* uda_makefakelabel(ra, lp); */
- } else
-/* ra->ra_state = OPEN; */
-/* wakeup((caddr_t)hp); */
- return (0);
+ struct hp_softc *sc = md->md_softc;
+ struct buf *bp = md->md_q.b_actf;
+ volatile struct mba_regs *mr = md->md_mba->sc_mbareg;
+ volatile struct hp_regs *hr = (void *)&mr->mba_md[DISKUNIT(bp->b_dev)];
+ int er1, er2;
+ volatile int bc; /* to get GCC read whole longword */
+ unsigned byte;
+
+ er1 = hr->hp_er1 & HPMASK;
+ er2 = hr->hp_er2 & HPMASK;
+ hr->hp_er1 = hr->hp_er2 = 0;
+hper1:
+ switch (ffs(er1) - 1) {
+ case -1:
+ hr->hp_er1 = 0;
+ goto hper2;
+
+ case HPER1_DCK: /* Corrected? data read. Just notice. */
+ bc = mr->mba_bc;
+ byte = ~(bc >> 16);
+ diskerr(buf, hp_cd.cd_name, "soft ecc", LOG_PRINTF,
+ btodb(bp->b_bcount - byte), sc->sc_disk.dk_label);
+ er1 &= ~(1<<HPER1_DCK);
+ er1 &= HPMASK;
+ break;
+
+ default:
+ printf("drive error :%s er1 %x er2 %x\n",
+ sc->sc_dev.dv_xname, er1, er2);
+ hr->hp_er1 = hr->hp_er2 = 0;
+ goto hper2;
+ }
+ goto hper1;
+
+hper2:
+ mbasr &= ~(MBASR_DTBUSY|MBASR_DTCMP|MBASR_ATTN);
+ if (mbasr)
+ printf("massbuss error :%s %x\n",
+ sc->sc_dev.dv_xname, mbasr);
+
+ md->md_q.b_actf->b_resid = 0;
+ disk_unbusy(&sc->sc_disk, md->md_q.b_actf->b_bcount);
+ return XFER_FINISH;
}
/*
- * Queue a transfer request, and if possible, hand it to the controller.
- *
- * This routine is broken into two so that the internal version
- * udastrat1() can be called by the (nonexistent, as yet) bad block
- * revectoring routine.
+ * Non-data transfer interrupt; like volume change.
*/
-hpstrategy(bp)
- register struct buf *bp;
+int
+hpattn(md)
+ struct mba_device *md;
{
- register int unit;
- register struct uba_device *ui;
- register struct hp_info *hp;
- struct partition *pp;
- int p;
- daddr_t sz, maxsz;
+ struct hp_softc *sc = md->md_softc;
+ struct mba_softc *ms = (void *)sc->sc_dev.dv_parent;
+ struct mba_regs *mr = ms->sc_mbareg;
+ struct hp_regs *hr = (void *)&mr->mba_md[sc->sc_dev.dv_unit];
+ int er1, er2;
+
+ er1 = hr->hp_er1 & HPMASK;
+ er2 = hr->hp_er2 & HPMASK;
+
+ printf("%s: Attention! er1 %x er2 %x\n",
+ sc->sc_dev.dv_xname, er1, er2);
+ return 0;
+}
- /*
- * Make sure this is a reasonable drive to use.
- */
-/* bp->b_error = ENXIO;
- goto bad;
-*/
- unit = hpunit(bp->b_dev);
-
- /*
- * If drive is open `raw' or reading label, let it at it.
- */
-
- if (hp->hp_state < OPEN) {
- hpstrat1(bp);
- return;
- }
+int
+hpsize(dev)
+ dev_t dev;
+{
+ int size, unit = DISKUNIT(dev);
+ struct hp_softc *sc;
-/* if ((unit = udaunit(bp->b_dev)) >= NRA ||
- (ui = udadinfo[unit]) == NULL || ui->ui_alive == 0 ||
- (ra = &ra_info[unit])->ra_state == CLOSED) {
- bp->b_error = ENXIO;
- goto bad;
- }
-*/
- /*
- * If drive is open `raw' or reading label, let it at it.
- */
-/*
- if (ra->ra_state < OPEN) {
- udastrat1(bp);
- return;
- }
- p = udapart(bp->b_dev);
- if ((ra->ra_openpart & (1 << p)) == 0) {
- bp->b_error = ENODEV;
- goto bad;
- }
-*/
- /*
- * Determine the size of the transfer, and make sure it is
- * within the boundaries of the partition.
- */
-/*
- pp = &udalabel[unit].d_partitions[p];
- maxsz = pp->p_size;
- if (pp->p_offset + pp->p_size > ra->ra_dsize)
- maxsz = ra->ra_dsize - pp->p_offset;
- sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
- if (bp->b_blkno + pp->p_offset <= LABELSECTOR &&
-#if LABELSECTOR != 0
- bp->b_blkno + pp->p_offset + sz > LABELSECTOR &&
-#endif
- (bp->b_flags & B_READ) == 0 && ra->ra_wlabel == 0) {
- bp->b_error = EROFS;
- goto bad;
- }
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
- /* if exactly at end of disk, return an EOF */
-/*
- if (bp->b_blkno == maxsz) {
- bp->b_resid = bp->b_bcount;
- biodone(bp);
- return;
- }
- /* or truncate if part of it fits */
-/*
- sz = maxsz - bp->b_blkno;
- if (sz <= 0) {
- bp->b_error = EINVAL; /* or hang it up */
-/*
- goto bad;
- }
- bp->b_bcount = sz << DEV_BSHIFT;
- }
- udastrat1(bp);
- return;
-*/
-bad:
- bp->b_flags |= B_ERROR;
- biodone(bp);
+ if (unit >= hp_cd.cd_ndevs || hp_cd.cd_devs[unit] == 0)
+ return -1;
+
+ sc = hp_cd.cd_devs[unit];
+ size = sc->sc_disk.dk_label->d_partitions[DISKPART(dev)].p_size;
+
+ return size;
+}
+
+int
+hpdump(dev, a1, a2, size)
+ dev_t dev;
+ caddr_t a1, a2;
+ size_t size;
+{
+ printf("hpdump: Not implemented yet.\n");
+ return 0;
+}
+
+int
+hpread(dev, uio)
+ dev_t dev;
+ struct uio *uio;
+{
+ return (physio(hpstrategy, NULL, dev, B_READ, minphys, uio));
+}
+
+int
+hpwrite(dev, uio)
+ dev_t dev;
+ struct uio *uio;
+{
+ return (physio(hpstrategy, NULL, dev, B_WRITE, minphys, uio));
}
/*
- * Work routine for udastrategy.
+ * Convert physical adapternr and unit to the unit number used by kernel.
*/
-hpstrat1(bp)
- register struct buf *bp;
+int
+hp_getdev(mbanr, unit)
+ int mbanr, unit;
{
- register int unit = hpunit(bp->b_dev);
- register struct hp_ctlr *um;
- register struct buf *dp;
- struct hp_device *ui;
-/* int s = spl5(); */
-
- asm("halt");
- /*
- * Append the buffer to the drive queue, and if it is not
- * already there, the drive to the controller queue. (However,
- * if the drive queue is marked to be requeued, we must be
- * awaiting an on line or get unit status command; in this
- * case, leave it off the controller queue.)
- */
-/*
- um = (ui = udadinfo[unit])->ui_mi;
- dp = &udautab[unit];
- APPEND(bp, dp, av_forw);
- if (dp->b_active == 0 && (ui->ui_flags & UNIT_REQUEUE) == 0) {
- APPEND(dp, &um->um_tab, b_forw);
- dp->b_active++;
- }
-
- /*
- * Start activity on the controller. Note that unlike other
- * Unibus drivers, we must always do this, not just when the
- * controller is not active.
- */
-/*
- udastart(um);
- splx(s);
-*/
+ struct mba_softc *ms;
+ struct hp_softc *sc;
+ int i;
+
+ for (i = 0; i < hp_cd.cd_ndevs; i++) {
+ if (hp_cd.cd_devs[i] == 0)
+ continue;
+
+ sc = hp_cd.cd_devs[i];
+ ms = (void *)sc->sc_dev.dv_parent;
+ if (ms->sc_physnr == mbanr && sc->sc_physnr == unit)
+ return i;
+ }
+ return -1;
}
+
diff --git a/sys/arch/vax/mba/hpreg.h b/sys/arch/vax/mba/hpreg.h
index 3b367afdec1..f20fa837685 100644
--- a/sys/arch/vax/mba/hpreg.h
+++ b/sys/arch/vax/mba/hpreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hpreg.h,v 1.3 1995/10/20 13:43:43 ragge Exp $ */
+/* $NetBSD: hpreg.h,v 1.4 1996/02/11 13:19:35 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -29,10 +29,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- /* All bugs are subject to removal without further notice */
-
-
-
struct hp_regs {
int hp_cs1;
int hp_ds;
@@ -78,23 +74,35 @@ struct hp_regs {
#define HPDS_DRY 0x80 /* Drive ready to accept commands */
#define HPDS_DPR 0x100 /* Drive present */
#define HPDS_PGM 0x200 /* Programmable in dual-port config */
+#define HPDS_LBT 0x400 /* Last block transferred */
#define HPDS_WRL 0x800 /* Write locked media */
#define HPDS_MOL 0x1000 /* Medium on-line */
+#define HPDS_PIP 0x2000 /* Positioning in progress */
+#define HPDS_ERR 0x4000 /* ORed error bit, something wrong */
+#define HPDS_ATA 0x8000 /* Attention drive */
#define HPDT_DRQ 0x800 /* Dual-port disk */
#define HPOF_FMT 0x1000 /* 16/18 bit data */
-#if 0
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#define HPCS_
-#endif
-
-
-
+/*
+ * Error registers. The defines are the corresponding bit number
+ * in the error register, instead of a bit mask.
+ * Use (1<<HPER1_FOO) when touching registers.
+ */
+#define HPER1_ILF 0 /* Illegal function */
+#define HPER1_ILR 1 /* Illegal register */
+#define HPER1_RMR 2 /* Register modification refused */
+#define HPER1_PAR 3 /* Parity error */
+#define HPER1_FER 4 /* Format error */
+#define HPER1_WCF 5 /* Write clock failed */
+#define HPER1_ECH 6 /* ECC hard error */
+#define HPER1_HCE 7 /* Header compare error */
+#define HPER1_HCRC 8 /* Header CRC error */
+#define HPER1_AOE 9 /* Address overflow error */
+#define HPER1_IAE 10 /* Invalid address error */
+#define HPER1_WLE 11 /* Write lock error */
+#define HPER1_DTE 12 /* Drive timing error */
+#define HPER1_OPI 13 /* Operation incomplete */
+#define HPER1_UNS 14 /* Unsafe drive */
+#define HPER1_DCK 15 /* Data check error */
diff --git a/sys/arch/vax/mba/mba.c b/sys/arch/vax/mba/mba.c
index 4b2d13f7864..01a40b19c06 100644
--- a/sys/arch/vax/mba/mba.c
+++ b/sys/arch/vax/mba/mba.c
@@ -1,7 +1,6 @@
-
-/* $NetBSD: mba.c,v 1.1 1995/02/13 00:44:02 ragge Exp $ */
+/* $NetBSD: mba.c,v 1.6 1996/04/08 18:38:59 ragge Exp $ */
/*
- * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
+ * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -14,7 +13,8 @@
* 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}.
+ * 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
*
@@ -30,70 +30,325 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- /* All bugs are subject to removal without further notice */
-
+/*
+ * Simple massbus drive routine.
+ * TODO:
+ * Autoconfig new devices 'on the fly'.
+ * More intelligent way to handle different interrupts.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/queue.h>
+#include <sys/buf.h>
+#include <sys/proc.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
-/* mba.c - main mba routines, 930312/ragge */
+#include <machine/trap.h>
+#include <machine/scb.h>
+#include <machine/nexus.h>
+#include <machine/pte.h>
+#include <machine/pcb.h>
+#include <machine/sid.h>
-#include "mba.h"
-#include "nexus.h"
-#include "vax/mba/mbavar.h"
-#include "vax/mba/mbareg.h"
+#include <vax/mba/mbareg.h>
+#include <vax/mba/mbavar.h>
-struct mba_ctrl mba_ctrl[NMBA];
+struct mbaunit mbaunit[] = {
+ {MBADT_RP04, "rp04", MB_RP},
+ {MBADT_RP05, "rp05", MB_RP},
+ {MBADT_RP06, "rp06", MB_RP},
+ {MBADT_RP07, "rp07", MB_RP},
+ {MBADT_RM02, "rm02", MB_RP},
+ {MBADT_RM03, "rm03", MB_RP},
+ {MBADT_RM05, "rm05", MB_RP},
+ {MBADT_RM80, "rm80", MB_RP},
+ {0, 0, 0}
+};
-extern mba_0(), mba_1(), mba_2(), mba_3();
-int (*mbaintv[4])() = { mba_0, mba_1, mba_2, mba_3 };
-#if NMBA > 4
- Need to expand the table for more than 4 massbus adaptors
-#endif
+int mbamatch __P((struct device *, void *, void *));
+void mbaattach __P((struct device *, struct device *, void *));
+void mbaintr __P((int));
+int mbaprint __P((void *, char *));
+void mbaqueue __P((struct mba_device *));
+void mbastart __P((struct mba_softc *));
+void mbamapregs __P((struct mba_softc *));
+
+struct cfdriver mba_cd = {
+ NULL, "mba", DV_DULL
+};
+
+struct cfattach mba_ca = {
+ sizeof(struct mba_softc), mbamatch, mbaattach
+};
+
+/*
+ * Look if this is a massbuss adapter.
+ */
+int
+mbamatch(parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
+ struct cfdata *cf = match;
+
+ if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1 ))
+ return 0;
+
+ if (sa->type == NEX_MBA)
+ return 1;
-mbainterrupt(mba){
+ return 0;
+}
+
+/*
+ * Attach the found massbuss adapter. Setup its interrupt vectors,
+ * reset it and go searching for drives on it.
+ */
+void
+mbaattach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct mba_softc *sc = (void *)self;
+ struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
+ volatile struct mba_regs *mbar = (struct mba_regs *)sa->nexaddr;
+ struct mba_attach_args ma;
+ extern struct ivec_dsp idsptch;
+ int i, j;
+
+ printf("\n");
+ /*
+ * Set up interrupt vectors for this MBA.
+ */
+ bcopy(&idsptch, &sc->sc_dsp, sizeof(struct ivec_dsp));
+ scb->scb_nexvec[0][sa->nexnum] = scb->scb_nexvec[1][sa->nexnum] =
+ scb->scb_nexvec[2][sa->nexnum] = scb->scb_nexvec[3][sa->nexnum] =
+ &sc->sc_dsp;
+ sc->sc_dsp.pushlarg = sc->sc_dev.dv_unit;
+ sc->sc_dsp.hoppaddr = mbaintr;
+
+ sc->sc_physnr = sa->nexnum - 8; /* MBA's have TR between 8 - 11... */
+#ifdef VAX750
+ if (cpunumber == VAX_750)
+ sc->sc_physnr += 4; /* ...but not on 11/750 */
+#endif
+ sc->sc_first = 0;
+ sc->sc_last = (void *)&sc->sc_first;
+ sc->sc_mbareg = (struct mba_regs *)mbar;
+ mbar->mba_cr = MBACR_INIT; /* Reset adapter */
+ mbar->mba_cr = MBACR_IE; /* Enable interrupts */
- if(mba_hd[mba].mh_mba->mba_sr&MBA_NED){
- printf("Adresserat icke existerande massbussenhet.\n");
- mba_hd[mba].mh_mba->mba_sr=MBA_NED+MBA_MCPE;
- return;
+ for (i = 0; i < MAXMBADEV; i++) {
+ sc->sc_state = SC_AUTOCONF;
+ if ((mbar->mba_md[i].md_ds & MBADS_DPR) == 0)
+ continue;
+ /* We have a drive, ok. */
+ ma.unit = i;
+ ma.type = mbar->mba_md[i].md_dt & 0777;
+ j = 0;
+ while (mbaunit[j++].nr)
+ if (mbaunit[j].nr == ma.type)
+ break;
+ ma.devtyp = mbaunit[j].devtyp;
+ ma.name = mbaunit[j].name;
+ config_found(&sc->sc_dev, (void *)&ma, mbaprint);
}
- printf("Interrupt fr}n massbussadapter %d\n",mba);
- printf("mba_hd[mba]->mba_sr: %x\n",mba_hd[mba].mh_mba->mba_sr);
}
/*
- * mbafind() set up interrupt vectors for each found mba and calls
- * config routines for hp disks, tu and mt tapes (currently only hp).
+ * We got an interrupt. Check type of interrupt and call the specific
+ * device interrupt handling routine.
*/
+void
+mbaintr(mba)
+ int mba;
+{
+ struct mba_softc *sc = mba_cd.cd_devs[mba];
+ volatile struct mba_regs *mr = sc->sc_mbareg;
+ struct mba_device *md;
+ struct buf *bp;
+ int itype, attn, anr;
+
+ itype = mr->mba_sr;
+ mr->mba_sr = itype; /* Write back to clear bits */
+
+ attn = mr->mba_md[0].md_as & 0xff;
+ mr->mba_md[0].md_as = attn;
+
+ if (sc->sc_state == SC_AUTOCONF)
+ return; /* During autoconfig */
+
+ md = sc->sc_first;
+ bp = md->md_q.b_actf;
+ /*
+ * A data-transfer interrupt. Current operation is finished,
+ * call that device's finish routine to see what to do next.
+ */
+ if (sc->sc_state == SC_ACTIVE) {
+
+ sc->sc_state = SC_IDLE;
+ switch ((*md->md_finish)(md, itype, &attn)) {
-mbafind(nexnum,nexaddr){
- struct mba_regs *mbr;
- struct mba_device *mi;
+ case XFER_FINISH:
+ /*
+ * Transfer is finished. Take buffer of drive
+ * queue, and take drive of adapter queue.
+ * If more to transfer, start the adapter again
+ * by calling mbastart().
+ */
+ md->md_q.b_actf = bp->b_actf;
+ sc->sc_first = md->md_back;
+ md->md_back = 0;
+ if (sc->sc_first == 0)
+ sc->sc_last = (void *)&sc->sc_first;
+
+ if (md->md_q.b_actf) {
+ sc->sc_last->md_back = md;
+ sc->sc_last = md;
+ }
+
+ bp->b_resid = 0;
+ biodone(bp);
+ if (sc->sc_first)
+ mbastart(sc);
+ break;
+
+ case XFER_RESTART:
+ /*
+ * Something went wrong with the transfer. Try again.
+ */
+ mbastart(sc);
+ break;
+ }
+ }
+
+ while (attn) {
+ anr = ffs(attn) - 1;
+ attn &= ~(1 << anr);
+ if (sc->sc_md[anr]->md_attn == 0)
+ panic("Should check for new MBA device %d", anr);
+ (*sc->sc_md[anr]->md_attn)(sc->sc_md[anr]);
+ }
+}
+
+int
+mbaprint(aux, mbaname)
+ void *aux;
+ char *mbaname;
+{
+ struct mba_attach_args *ma = aux;
+
+ if (mbaname) {
+ if (ma->name)
+ printf("%s", ma->name);
+ else
+ printf("device type %o", ma->type);
+ printf(" at %s", mbaname);
+ }
+ printf(" drive %d", ma->unit);
+ return (ma->name ? UNCONF : UNSUPP);
+}
- mba_ctrl[nmba].mba_regs= (struct mba_regs *)nexaddr;
- mbr=&(mba_ctrl[nmba].mba_regs);
/*
- * Set up interruptvectors and enable interrupt
+ * A device calls mbaqueue() when it wants to get on the adapter queue.
+ * Called at splbio(). If the adapter is inactive, start it.
*/
- nex_vec_num(14,nexnum)=nex_vec_num(15,nexnum)=
- nex_vec_num(16,nexnum)=nex_vec_num(17,nexnum)=
- (caddr_t)mbaintv[nmba];
- mbr->mba_cr=MBCR_INIT;
- mbr->mba_cr=MBCR_IE;
+void
+mbaqueue(md)
+ struct mba_device *md;
+{
+ struct mba_softc *sc = md->md_mba;
+ int i = (int)sc->sc_first;
+
+ sc->sc_last->md_back = md;
+ sc->sc_last = md;
+
+ if (i == 0)
+ mbastart(sc);
+}
+
/*
- * Loop thru all massbuss devices and check for existance
+ * Start activity on (idling) adapter. Calls mbamapregs() to setup
+ * for dma transfer, then the unit-specific start routine.
*/
+void
+mbastart(sc)
+ struct mba_softc *sc;
+{
+ struct mba_device *md = sc->sc_first;
+ volatile struct mba_regs *mr = sc->sc_mbareg;
+ struct buf *bp = md->md_q.b_actf;
+
+ mbamapregs(sc);
+
+ sc->sc_state = SC_ACTIVE;
+ mr->mba_var = ((u_int)bp->b_un.b_addr & PGOFSET);
+ mr->mba_bc = (~bp->b_bcount) + 1;
+ (*md->md_start)(md); /* machine-dependent start */
+}
- for(i=0;i<8;i++){
- if(!mbr->mba_drv[i].rmds&MBDS_DPR) continue;
/*
- * Device found; check if generated
+ * Setup map registers for a dma transfer.
+ * This routine could be synced with the other adapter map routines!
*/
- for(mi = mbdinit; mi->driver; mi++) {
- if(mi->alive) continue; /* Already config'd */
- }
+void
+mbamapregs(sc)
+ struct mba_softc *sc;
+{
+ struct mba_device *md = sc->sc_first;
+ volatile struct mba_regs *mr = sc->sc_mbareg;
+ struct buf *bp = md->md_q.b_actf;
+ struct pcb *pcb;
+ pt_entry_t *pte;
+ volatile pt_entry_t *io;
+ int pfnum, npf, o, i;
+ caddr_t addr;
+
+ o = (int)bp->b_un.b_addr & PGOFSET;
+ npf = btoc(bp->b_bcount + o) + 1;
+ addr = bp->b_un.b_addr;
+
+ /*
+ * Get a pointer to the pte pointing out the first virtual address.
+ * Use different ways in kernel and user space.
+ */
+ if ((bp->b_flags & B_PHYS) == 0) {
+ pte = kvtopte(addr);
+ } else {
+ pcb = bp->b_proc->p_vmspace->vm_pmap.pm_pcb;
+ pte = uvtopte(addr, pcb);
}
+ /*
+ * When we are doing DMA to user space, be sure that all pages
+ * we want to transfer to is mapped. WHY DO WE NEED THIS???
+ * SHOULDN'T THEY ALWAYS BE MAPPED WHEN DOING THIS???
+ */
+ for (i = 0; i < (npf - 1); i++) {
+ if ((pte + i)->pg_pfn == 0) {
+ int rv;
+ rv = vm_fault(&bp->b_proc->p_vmspace->vm_map,
+ (unsigned)addr + i * NBPG,
+ VM_PROT_READ|VM_PROT_WRITE, FALSE);
+ if (rv)
+ panic("MBA DMA to nonexistent page, %d", rv);
+ }
+ }
+ io = &mr->mba_map[0];
+ while (--npf > 0) {
+ pfnum = pte->pg_pfn;
+ if (pfnum == 0)
+ panic("mba zero entry");
+ pte++;
+ *(int *)io++ = pfnum | PG_V;
+ }
+ *(int *)io = 0;
}
diff --git a/sys/arch/vax/mba/mbareg.h b/sys/arch/vax/mba/mbareg.h
index 77c00757c42..128da4ae3c5 100644
--- a/sys/arch/vax/mba/mbareg.h
+++ b/sys/arch/vax/mba/mbareg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mbareg.h,v 1.2 1995/10/20 13:43:44 ragge Exp $ */
+/* $NetBSD: mbareg.h,v 1.3 1996/02/11 13:19:38 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
* All rights reserved.
@@ -29,12 +29,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/* mbareg.h - 940320/ragge */
-
-struct mba_device {
+struct mba_hack {
u_int pad1;
u_int md_ds; /* unit status */
- u_int pad2[4];
+ u_int pad4[2];
+ u_int md_as; /* Attention summary */
+ u_int pad2;
u_int md_dt; /* unit type */
u_int pad3[25];
};
@@ -49,8 +49,8 @@ struct mba_regs {
u_int mba_smr;
u_int mba_car;
u_int utrymme[248];
- struct mba_device mba_md[8]; /* unit specific regs */
- u_int mba_map[256];
+ struct mba_hack mba_md[8]; /* unit specific regs */
+ struct pte mba_map[256];
};
/*
@@ -65,6 +65,7 @@ struct mba_regs {
/* Read from mba_sr: */
#define MBASR_DTBUSY 0x80000000
+#define MBASR_NRCONF 0x40000000
#define MBASR_CRD 0x20000000
#define MBASR_CBHUNG 0x800000
#define MBASR_PGE 0x80000
@@ -77,13 +78,15 @@ struct mba_regs {
#define MBASR_DLT 0x800 /* Data LaTe */
#define MBASR_WCKUE 0x400 /* Write check upper error */
#define MBASR_WCKLE 0x200 /* Write check lower error */
-#define MBASR_MXE 0x100 /* Miss transfer error */
+#define MBASR_MXF 0x100 /* Miss transfer fault */
#define MBASR_MBEXC 0x80 /* Massbuss exception */
#define MBASR_MDPE 0x40 /* Massbuss data parity error */
#define MBASR_MAPPE 0x20 /* Page frame map parity error */
#define MBASR_INVMAP 0x10 /* Invalid map */
#define MBASR_ERR_STAT 0x8 /* Error status */
-#define MBASR_NRSTAT 0x2 /* No Response status */
+#define MBASR_ERRC 0x4 /* Error confirmation */
+#define MBASR_ISTIMO 0x2 /* Interface sequence timeout */
+#define MBASR_RDTIMO 0x1 /* Read data timeout status */
/* Definitions in mba_device md_ds */
#define MBADS_DPR 0x100 /* Unit present */
diff --git a/sys/arch/vax/mba/mbavar.h b/sys/arch/vax/mba/mbavar.h
index b020564bee6..212e489a77f 100644
--- a/sys/arch/vax/mba/mbavar.h
+++ b/sys/arch/vax/mba/mbavar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mbavar.h,v 1.1 1995/02/13 00:44:04 ragge Exp $ */
+/* $NetBSD: mbavar.h,v 1.4 1996/04/08 18:39:01 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
* All rights reserved.
@@ -29,9 +29,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- /* All bugs are subject to removal without further notice */
-
-/* Mba n}nting... ragge 940311 */
+#include <sys/device.h>
#define MBCR_INIT 1
#define MBCR_IE (1<<2)
@@ -47,48 +45,77 @@
#define OPEN 3
#define OPENRAW 4
-struct mba_ctrl {
- struct mba_regs *mba_regs;
- struct mba_device *mba_device[8];
+#define MAXMBADEV 8 /* Max units per MBA */
+
+/*
+ * Devices that have different device drivers.
+ */
+enum mb_devices {
+ MB_RP, /* RM/RP disk */
+ MB_TU, /* TM03 based tape, ex. TU45 or TU77 */
+ MB_MT /* TU78 tape */
+};
+
+/*
+ * Current state of the adapter.
+ */
+enum sc_state {
+ SC_AUTOCONF,
+ SC_ACTIVE,
+ SC_IDLE
+};
+
+/*
+ * Return value after a finished data transfer, from device driver.
+ */
+enum xfer_action {
+ XFER_RESTART,
+ XFER_FINISH
};
-struct mba_device {
- struct mba_driver *driver;
- int unit;
- int mbanum;
- int drive;
- int dk;
- int alive;
- int type;
- struct mba_regs *mi_mba;
- struct mba_hd *hd;
- int drv;
- int device;
+/*
+ * Info passed do unit device driver during autoconfig.
+ */
+struct mba_attach_args {
+ int unit;
+ int type;
+ char *name;
+ enum mb_devices devtyp;
};
-struct mba_slave {
- struct mba_driver *driver;
- int ctlr;
- int unit;
- int slave;
- int alive;
+/*
+ * Common struct used to communicate between the mba device driver
+ * and the unit device driver.
+ */
+struct mba_device {
+ struct mba_device *md_back; /* linked list of runnable devices */
+ /* Start routine to be called by mbastart. */
+ void (*md_start) __P((struct mba_device *));
+ /* Routine to be called after attn intr */
+ int (*md_attn)__P((struct mba_device *));
+ /* Call after xfer finish */
+ enum xfer_action (*md_finish) __P((struct mba_device *, int, int *));
+ void *md_softc; /* Backpointer to this units softc. */
+ struct mba_softc *md_mba;
+ struct buf md_q; /* Buffer head for transfers */
};
-struct mba_driver {
- int (*slave)();
- char *sname;
- char *dname;
- short *type;
- int (*attach)();
- struct mba_device **info;
+struct mba_softc {
+ struct device sc_dev;
+ struct ivec_dsp sc_dsp; /* Interrupt catch routine */
+ struct mba_regs *sc_mbareg;
+ struct mba_device *sc_first, *sc_last;
+ enum sc_state sc_state;
+ int sc_physnr; /* Physical number of this mba */
+ struct mba_device *sc_md[MAXMBADEV];
};
-struct mba_hd {
- struct mba_device *device[8]; /* XXX - Var tidigare mh_mbip */
- int ndrive;
- int mh_active;
- struct mba_regs *mh_mba;
- struct mba_regs *mh_physmba;
- struct mba_device *mh_actf;
- struct mba_device *mh_actl;
+struct mbaunit {
+ int nr;
+ char *name;
+ enum mb_devices devtyp;
};
+
+/* Common prototypes */
+void mbaqueue __P((struct mba_device *));
+
diff --git a/sys/arch/vax/stand/Makefile b/sys/arch/vax/stand/Makefile
index f6763596bc0..0078dcd8cfc 100644
--- a/sys/arch/vax/stand/Makefile
+++ b/sys/arch/vax/stand/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 1995/12/28 15:27:21 ragge Exp $
+# $NetBSD: Makefile,v 1.9 1996/03/16 11:03:12 ragge Exp $
#
INCPATH=-I. -I../../.. -I../.. -I../../../lib/libsa
@@ -11,7 +11,7 @@ S= ../../..
RELOC= 100000
CFLAGS+=-O ${INCPATH} -DSTANDALONE -DRELOC=0x${RELOC} -D_VAX_INLINE_
-DEVS= autoconf.o hp.o ra.o tmscp.o
+DEVS= autoconf.o hp.o ra.o tmscp.o ctu.o
LIBKERN=libkern.a
KERNOBJ=__main.o strlen.o strcmp.o strncmp.o strncpy.o min.o strcpy.o
@@ -102,6 +102,14 @@ libkern.a: ${KERNOBJ}
@ar rv libkern.a `lorder ${KERNOBJ} | tsort`
#
+install: boot xxboot
+ install -c -o ${BINOWN} -g ${BINGRP} -m 444 boot ${DESTDIR}/
+ install -c -o ${BINOWN} -g ${BINGRP} -m 444 xxboot ${DESTDIR}/usr/mdec
+ rm -f ${DESTDIR}/usr/mdec/raboot
+ ln ${DESTDIR}/usr/mdec/xxboot ${DESTDIR}/usr/mdec/raboot
+ rm -f ${DESTDIR}/usr/mdec/hpboot
+ ln ${DESTDIR}/usr/mdec/xxboot ${DESTDIR}/usr/mdec/hpboot
+
clean::
rm -f start.o romread.o bootxx.o init.o xxboot boot racopy \
libsvax.a udiv.o urem.o consio.o ${DEVS} edlabel edlabel.o
diff --git a/sys/arch/vax/stand/autoconf.c b/sys/arch/vax/stand/autoconf.c
index 654d6a68680..ca08f01214a 100644
--- a/sys/arch/vax/stand/autoconf.c
+++ b/sys/arch/vax/stand/autoconf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.3 1995/09/16 13:34:20 ragge Exp $ */
+/* $NetBSD: autoconf.c,v 1.5 1996/03/07 23:27:06 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -47,6 +47,14 @@ static int uba750[]={0xf30000,0xf32000};
static int uio750[]={0xfc0000,0xf80000};
static int uda750[]={0772150};
+/* 11/780's only have 4, 8600 have 8 of these. */
+static int mba780[]={0x20010000,0x20012000,0x20014000,0x20016000,
+ 0x22010000,0x22012000,0x22014000,0x22016000};
+static int uba780[]={0x20006000,0x20008000,0x2000a000,0x2000c000,
+ 0x22006000,0x22008000,0x2200a000,0x2200c000};
+static int uio780[]={0x20100000,0x20140000,0x20180000,0x201c0000,
+ 0x22100000,0x22140000,0x22180000,0x221c0000};
+
static int uba630[]={0x20087800};
static int uio630[]={0x30000000};
#define qbdev(csr) (((csr) & 017777)-0x10000000)
@@ -67,6 +75,28 @@ autoconf()
printf("CPU type %d not supported by boot\n",i);
asm("halt");
+ case VAX_8600:
+ nmba = 8;
+ nuba = 8;
+ nuda = 1;
+ mbaaddr = mba780;
+ ubaaddr = uba780;
+ udaaddr = uda750;
+ uioaddr = uio780;
+ tmsaddr = 0774500;
+ break;
+
+ case VAX_780:
+ nmba = 4;
+ nuba = 4;
+ nuda = 1;
+ mbaaddr = mba780;
+ ubaaddr = uba780;
+ udaaddr = uda750;
+ uioaddr = uio780;
+ tmsaddr = 0774500;
+ break;
+
case VAX_750:
nmba = 3;
nuba = 2;
diff --git a/sys/arch/vax/stand/bootxx.c b/sys/arch/vax/stand/bootxx.c
index b60d7e7931c..4a1b34f83d6 100644
--- a/sys/arch/vax/stand/bootxx.c
+++ b/sys/arch/vax/stand/bootxx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bootxx.c,v 1.4 1995/10/20 13:35:43 ragge Exp $ */
+/* $NetBSD: bootxx.c,v 1.5 1996/02/17 18:23:21 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
* All rights reserved.
@@ -41,15 +41,15 @@
#include "lib/libsa/stand.h"
#include "lib/libsa/ufs.h"
-#include "../mba/mbareg.h"
-#include "../mba/hpreg.h"
-
#include "../include/pte.h"
#include "../include/sid.h"
#include "../include/mtpr.h"
#include "../include/reg.h"
#include "../include/rpb.h"
+#include "../mba/mbareg.h"
+#include "../mba/hpreg.h"
+
#define NRSP 0 /* Kludge */
#define NCMD 0 /* Kludge */
#include "../uba/ubareg.h"
@@ -197,6 +197,10 @@ getbootdev()
is_tmscp = 1; /* use tape spec in mscp routines */
break;
+ case 64:
+ major = 8;
+ break;
+
default:
printf("Unsupported boot device %d, trying anyway.\n", bootdev);
boothowto |= (RB_SINGLE | RB_ASKNAME);
@@ -236,7 +240,7 @@ devopen(f, fname, file)
char line[64];
f->f_dev = &devsw[0];
- *file = fname;
+ *file = (char *)fname;
/*
* On uVAX we need to init [T]MSCP ctlr to be able to use it.
@@ -382,7 +386,7 @@ hpread(block, size, buf)
pfnum = (u_int) buf >> PGSHIFT;
for (mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG)
- mr->mba_map[mapnr++] = PG_V | pfnum++;
+ *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++;
mr->mba_var = ((u_int) buf & PGOFSET);
mr->mba_bc = (~size) + 1;
bn = block;
diff --git a/sys/arch/vax/stand/conf.c b/sys/arch/vax/stand/conf.c
index 15236d763df..f516c4d2c3a 100644
--- a/sys/arch/vax/stand/conf.c
+++ b/sys/arch/vax/stand/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.4 1995/09/16 13:18:28 ragge Exp $ */
+/* $NetBSD: conf.c,v 1.5 1996/02/17 18:23:18 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -40,6 +40,7 @@
int raopen(), rastrategy();
int hpopen(), hpstrategy();
+int ctuopen(), ctustrategy();
int tmscpopen(), tmscpstrategy();
struct devsw devsw[]={
@@ -51,7 +52,7 @@ struct devsw devsw[]={
SADEV("tm",nullsys, nodev, nullsys, noioctl),
SADEV("ts",nullsys, nodev, nullsys, noioctl),
SADEV("mt",nullsys, nodev, nullsys, noioctl),
- SADEV("tu",nullsys, nodev, nullsys, noioctl),
+ SADEV("ctu",ctustrategy, ctuopen, nullsys, noioctl),
SADEV("ra",rastrategy, raopen, nullsys, noioctl),
SADEV("ut",nullsys, nodev, nullsys, noioctl),
SADEV("id",nullsys, nodev, nullsys, noioctl),
diff --git a/sys/arch/vax/stand/ctu.c b/sys/arch/vax/stand/ctu.c
new file mode 100644
index 00000000000..26f29525160
--- /dev/null
+++ b/sys/arch/vax/stand/ctu.c
@@ -0,0 +1,181 @@
+/* $NetBSD: ctu.c,v 1.1 1996/02/17 18:23:20 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Standalone device driver for 11/750 Console TU58.
+ * It can only handle reads, and doesn't calculate checksum.
+ */
+
+#include <sys/param.h>
+
+#include <lib/libsa/stand.h>
+
+#include <machine/mtpr.h>
+#include <machine/rsp.h>
+
+enum tu_state {
+ SC_INIT,
+ SC_READY,
+ SC_SEND_CMD,
+ SC_GET_RESP,
+};
+
+volatile struct tu_softc {
+ enum tu_state sc_state;
+ char sc_rsp[15]; /* Should be struct rsb; but don't work */
+ u_char *sc_xfptr; /* Current char to xfer */
+ int sc_nbytes; /* Number of bytes to xfer */
+ int sc_xbytes; /* Number of xfer'd bytes */
+ int sc_bbytes; /* Number of xfer'd bytes this block */
+} tu_sc;
+
+void ctutintr __P(());
+void cturintr __P(());
+
+int
+ctuopen(f, adapt, ctlr, unit, part)
+ struct open_file *f;
+ int ctlr, unit, part;
+{
+
+ tu_sc.sc_state = SC_INIT;
+
+ mtpr(RSP_TYP_INIT, PR_CSTD);
+ cturintr();
+ tu_sc.sc_state = SC_READY;
+ return 0;
+
+}
+
+int
+ctustrategy(ra, func, dblk, size, buf, rsize)
+ struct ra_softc *ra;
+ int func;
+ daddr_t dblk;
+ char *buf;
+ u_int size, *rsize;
+{
+ int s;
+
+ struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
+
+ tu_sc.sc_xfptr = buf;
+ tu_sc.sc_nbytes = size;
+ tu_sc.sc_xbytes = tu_sc.sc_bbytes = 0;
+
+ rsp->rsp_typ = RSP_TYP_COMMAND;
+ rsp->rsp_sz = 012;
+ rsp->rsp_op = RSP_OP_READ;
+ rsp->rsp_mod = 0;
+ rsp->rsp_drv = 0;
+ rsp->rsp_sw = rsp->rsp_xx1 = rsp->rsp_xx2 = 0;
+ rsp->rsp_cnt = tu_sc.sc_nbytes;
+ rsp->rsp_blk = dblk;
+ rsp->rsp_sum = ctu_cksum(rsp, 6);
+ tu_sc.sc_state = SC_SEND_CMD;
+ while (tu_sc.sc_state != SC_GET_RESP)
+ ctutintr();
+ while (tu_sc.sc_state != SC_READY)
+ cturintr();
+ *rsize = size;
+ return 0;
+}
+
+void
+cturintr()
+{
+ int status;
+
+ while ((mfpr(PR_CSRS) & 0x80) == 0)
+ ;
+
+ status = mfpr(PR_CSRD);
+
+ switch (tu_sc.sc_state) {
+
+ case SC_INIT:
+ break;
+
+ case SC_GET_RESP:
+ if (tu_sc.sc_xbytes == tu_sc.sc_nbytes) {
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes == 146)
+ tu_sc.sc_state = SC_READY;
+ break;
+ }
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes < 3) /* Data header */
+ break;
+ if (tu_sc.sc_bbytes == 132) { /* Finished */
+ tu_sc.sc_bbytes = 0;
+ break;
+ }
+ if (tu_sc.sc_bbytes == 131) /* First checksum */
+ break;
+ tu_sc.sc_xfptr[tu_sc.sc_xbytes++] = status;
+ break;
+
+ }
+
+}
+
+void
+ctutintr()
+{
+ int c;
+
+ while ((mfpr(PR_CSTS) & 0x80) == 0)
+ ;
+
+ c = tu_sc.sc_rsp[tu_sc.sc_xbytes++] & 0xff;
+ mtpr(c, PR_CSTD);
+ if (tu_sc.sc_xbytes > 13) {
+ tu_sc.sc_state = SC_GET_RESP;
+ tu_sc.sc_xbytes = 0;
+ }
+}
+
+ctu_cksum(buf, words)
+ unsigned short *buf;
+ int words;
+{
+ int i, cksum;
+
+ for (i = cksum = 0; i < words; i++)
+ cksum += buf[i];
+
+hej: if (cksum > 65535) {
+ cksum = (cksum & 65535) + (cksum >> 16);
+ goto hej;
+ }
+ return cksum;
+}
diff --git a/sys/arch/vax/stand/devopen.c b/sys/arch/vax/stand/devopen.c
index 6200f477f49..d3468b427dd 100644
--- a/sys/arch/vax/stand/devopen.c
+++ b/sys/arch/vax/stand/devopen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: devopen.c,v 1.3 1995/09/16 13:18:29 ragge Exp $ */
+/* $NetBSD: devopen.c,v 1.4 1996/03/16 11:02:28 ragge Exp $ */
/*-
* Copyright (c) 1993 John Brezak
* All rights reserved.
@@ -182,13 +182,14 @@ devopen(f, fname, file)
{
int n, error;
int dev, ctlr, unit, part;
- int adapt = 0; /* XXX not used on HP */
+ int adapt;
struct devsw *dp = &devsw[0];
dev = B_TYPE(bootdev);
ctlr = B_CONTROLLER(bootdev);
unit = B_UNIT(bootdev);
part = B_PARTITION(bootdev);
+ adapt = B_ADAPTOR(bootdev);
if (error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))
return(error);
diff --git a/sys/arch/vax/stand/hp.c b/sys/arch/vax/stand/hp.c
index c7019a3527d..74400d2470d 100644
--- a/sys/arch/vax/stand/hp.c
+++ b/sys/arch/vax/stand/hp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hp.c,v 1.4 1995/09/16 15:43:25 ragge Exp $ */
+/* $NetBSD: hp.c,v 1.5 1996/02/17 18:23:22 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -38,12 +38,12 @@
#include "lib/libsa/stand.h"
-#include "../mba/mbareg.h"
-#include "../mba/hpreg.h"
-
#include "../include/pte.h"
#include "../include/macros.h"
+#include "../mba/mbareg.h"
+#include "../mba/hpreg.h"
+
#include "vaxstand.h"
/*
@@ -132,7 +132,7 @@ hpstrategy(hs, func, dblk, size, buf, rsize)
pfnum = (u_int)buf >> PGSHIFT;
for(mapnr = 0, nsize = size; (nsize + NBPG) > 0; nsize -= NBPG)
- mr->mba_map[mapnr++] = PG_V | pfnum++;
+ *(int *)&mr->mba_map[mapnr++] = PG_V | pfnum++;
mr->mba_var = ((u_int)buf & PGOFSET);
mr->mba_bc = (~size) + 1;
diff --git a/sys/arch/vax/stand/ra.c b/sys/arch/vax/stand/ra.c
index a0ecefc1a1b..43e368fe098 100644
--- a/sys/arch/vax/stand/ra.c
+++ b/sys/arch/vax/stand/ra.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ra.c,v 1.3 1995/09/16 13:34:22 ragge Exp $ */
+/* $NetBSD: ra.c,v 1.4 1996/02/17 18:23:23 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -96,7 +96,7 @@ raopen(f, adapt, ctlr, unit, part)
ra->unit=unit;
ra->part = part;
udacsr=(void*)ra->udaddr;
- nisse=&mr->uba_map[0];
+ nisse=(u_int *)&mr->uba_map[0];
nisse[494]=PG_V|(((u_int)&uda)>>9);
nisse[495]=nisse[494]+1;
ubauda=(void*)0x3dc00+(((u_int)(&uda))&0x1ff);
@@ -163,7 +163,7 @@ rastrategy(ra, func, dblk, size, buf, rsize)
ur = (void *)ra->ubaddr;
udadev = (void*)ra->udaddr;
- ptmapp = &ur->uba_map[0];
+ ptmapp = (u_int *)&ur->uba_map[0];
lp = &ralabel;
pfnum = (u_int)buf >> PGSHIFT;
diff --git a/sys/arch/vax/stand/srt0.s b/sys/arch/vax/stand/srt0.s
index a85d02538ba..1fc8dfca8e3 100644
--- a/sys/arch/vax/stand/srt0.s
+++ b/sys/arch/vax/stand/srt0.s
@@ -1,4 +1,4 @@
-/* $NetBSD: srt0.s,v 1.4 1995/09/16 16:20:20 ragge Exp $ */
+/* $NetBSD: srt0.s,v 1.5 1996/03/07 23:27:10 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -48,11 +48,12 @@ _start: .globl _start
movl $_start, sp # Probably safe place for stack
subl2 $52, sp # do not overwrite saved boot-registers
- subl3 $_start, $_end, r0
- moval _start, r1
- movl $_start, r2
- movc3 r0, (r1), (r2) # should use movc5 instead, to clear bss.
-
+ subl3 $_start, $_edata, r0
+ moval _start, r1
+ subl3 $_start, $_end, r2
+ movl $_start, r3
+ movc5 r0, (r1), $0, r2, (r3)
+
jsb 1f
1: movl $relocated, (sp) # return-address on top of stack
rsb # can be replaced with new address
diff --git a/sys/arch/vax/stand/start.s b/sys/arch/vax/stand/start.s
index 80040a7c2d7..55b2fc0438a 100644
--- a/sys/arch/vax/stand/start.s
+++ b/sys/arch/vax/stand/start.s
@@ -1,4 +1,4 @@
-/* $NetBSD: start.s,v 1.5 1995/10/20 13:35:41 ragge Exp $ */
+/* $NetBSD: start.s,v 1.7 1996/02/02 19:08:33 mycroft Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -36,11 +36,10 @@
/* All bugs are subject to removal without further notice */
-#define LOCORE
+#define _LOCORE
+
#include "sys/disklabel.h"
-#undef LOCORE
-#define ASSEMBLER
#include "../include/mtpr.h"
#include "../include/asm.h"
diff --git a/sys/arch/vax/stand/tmscp.c b/sys/arch/vax/stand/tmscp.c
index eb143e61426..f5d0fe11879 100644
--- a/sys/arch/vax/stand/tmscp.c
+++ b/sys/arch/vax/stand/tmscp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tmscp.c,v 1.1 1995/09/16 12:57:35 ragge Exp $ */
+/* $NetBSD: tmscp.c,v 1.2 1996/02/17 18:23:24 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -91,7 +91,7 @@ tmscpopen(f, adapt, ctlr, unit, part)
ra->ubaddr=(int)mr;
ra->unit=unit;
udacsr=(void*)ra->udaddr;
- nisse=&mr->uba_map[0];
+ nisse=(u_int *)&mr->uba_map[0];
nisse[494]=PG_V|(((u_int)&uda)>>9);
nisse[495]=nisse[494]+1;
ubauda=(void*)0x3dc00+(((u_int)(&uda))&0x1ff);
@@ -112,8 +112,8 @@ tmscpopen(f, adapt, ctlr, unit, part)
uda.uda_ca.ca_rspdsc=(int)&ubauda->uda_rsp.mscp_cmdref;
uda.uda_ca.ca_cmddsc=(int)&ubauda->uda_cmd.mscp_cmdref;
- uda.uda_cmd.mscp_un.un_seq.seq_addr = &uda.uda_ca.ca_cmddsc;
- uda.uda_rsp.mscp_un.un_seq.seq_addr = &uda.uda_ca.ca_rspdsc;
+ uda.uda_cmd.mscp_un.un_seq.seq_addr = (long *)&uda.uda_ca.ca_cmddsc;
+ uda.uda_rsp.mscp_un.un_seq.seq_addr = (long *)&uda.uda_ca.ca_rspdsc;
uda.uda_cmd.mscp_vcid = 1;
uda.uda_cmd.mscp_un.un_sccc.sccc_ctlrflags = 0;
@@ -164,7 +164,7 @@ tmscpstrategy(ra, func, dblk, size, buf, rsize)
u_int i,j,pfnum, mapnr, nsize, bn, cn, sn, tn;
volatile struct uba_regs *ur=(void *)ra->ubaddr;
volatile struct udadevice *udadev=(void*)ra->udaddr;
- volatile u_int *ptmapp=&ur->uba_map[0];
+ volatile u_int *ptmapp = (u_int *)&ur->uba_map[0];
volatile int hej;
pfnum=(u_int)buf>>PGSHIFT;
diff --git a/sys/arch/vax/stand/vaxstand.h b/sys/arch/vax/stand/vaxstand.h
index 17ec1cbcd03..f3217fdb235 100644
--- a/sys/arch/vax/stand/vaxstand.h
+++ b/sys/arch/vax/stand/vaxstand.h
@@ -1,4 +1,4 @@
-/* $NetBSD: vaxstand.h,v 1.3 1995/04/25 14:14:34 ragge Exp $ */
+/* $NetBSD: vaxstand.h,v 1.4 1996/02/17 18:23:25 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -44,8 +44,8 @@ extern int *ubaaddr, *mbaaddr, *udaaddr, *uioaddr;
/* devsw type definitions, used in bootxx and conf */
#define SADEV(name,strategy,open,close,ioctl) \
- { name, \
- (int(*)(void *, int ,daddr_t , u_int , char *, u_int *))strategy, \
+ { (char *)name, \
+ (int(*)(void *, int ,daddr_t , size_t, void *, size_t *))strategy, \
(int(*)(struct open_file *, ...))open, \
(int(*)(struct open_file *))close, \
(int(*)(struct open_file *,u_long, void *))ioctl}
diff --git a/sys/arch/vax/uba/dhu.c b/sys/arch/vax/uba/dhu.c
new file mode 100644
index 00000000000..807cbb3aec8
--- /dev/null
+++ b/sys/arch/vax/uba/dhu.c
@@ -0,0 +1,858 @@
+/* $NetBSD: dhu.c,v 1.4 1996/04/08 18:37:28 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell and Rick Macklem.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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 "dhu.h"
+
+#if NDHU > 0
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/map.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+
+#include <machine/trap.h>
+
+#include <vax/uba/ubavar.h>
+
+#include <vax/uba/dhureg.h>
+
+/* A DHU has 16 ports while a DHV has only 8 */
+
+#define NDHULINE (NDHU*16)
+
+/* This is an experiment to try and fake DHU behavior with a DHV.
+ * The DHV does not have any programmable delay on input silo level
+ * but interrupts immediately when the first character enters.
+ * This is really kludgy and so I doubt it will stay. From what could
+ * be measured, doing a timeout() delay reduced the input interrupt
+ * rate by an order of magnitude (from over 700 to at most 30) with
+ * heavy input (e.g. via kermit). Input performance increased 5% too
+ * as more CPU cycles were available for the application to consume input.
+ */
+
+#define RX_DELAY 0 /* ticks to delay RX intr handling */
+
+struct dhu_softc
+{
+ dhuregs * sc_addr; /* controller reg address */
+ struct tty * sc_tty; /* what we work on */
+ unsigned sc_txaddr; /* UBA map address to TX buf */
+ u_char sc_type; /* controller type, DHU or DHV */
+ u_char sc_state; /* to manage TX output status */
+ u_short sc_cc; /* character count on TX */
+ u_short sc_modem; /* modem bits state */
+};
+
+struct dhu_softc dhu_softc[NDHULINE];
+
+#define IS_DHU 0 /* cntlr is a DHU */
+#define IS_DHV 1 /* cntlr is a DHV */
+
+#define STATE_IDLE 000 /* no current output in progress */
+#define STATE_DMA_RUNNING 001 /* DMA TX in progress */
+#define STATE_DMA_STOPPED 002 /* DMA TX was aborted */
+#define STATE_TX_ONE_CHAR 004 /* did a single char directly */
+
+/* Flags used to monitor modem bits, make them understood outside driver */
+
+#define DML_DTR TIOCM_DTR
+#define DML_RTS TIOCM_RTS
+#define DML_CTS TIOCM_CTS
+#define DML_DCD TIOCM_CD
+#define DML_RI TIOCM_RI
+#define DML_DSR TIOCM_DSR
+#define DML_BRK 0100000 /* no equivalent, we will mask */
+
+/* On a stock DHV, channel pairs (0/1, 2/3, etc.) must use */
+/* a baud rate from the same group. So limiting to B is likely */
+/* best, although clone boards like the ABLE QHV allow all settings. */
+
+static struct speedtab dhuspeedtab[] =
+{
+ { 0, 0 }, /* Groups */
+ { 50, DHU_LPR_B50 }, /* A */
+ { 75, DHU_LPR_B75 }, /* B */
+ { 110, DHU_LPR_B110 }, /* A and B */
+ { 134, DHU_LPR_B134 }, /* A and B */
+ { 150, DHU_LPR_B150 }, /* B */
+ { 300, DHU_LPR_B300 }, /* A and B */
+ { 600, DHU_LPR_B600 }, /* A and B */
+ { 1200, DHU_LPR_B1200 }, /* A and B */
+ { 1800, DHU_LPR_B1800 }, /* B */
+ { 2000, DHU_LPR_B2000 }, /* B */
+ { 2400, DHU_LPR_B2400 }, /* A and B */
+ { 4800, DHU_LPR_B4800 }, /* A and B */
+ { 7200, DHU_LPR_B7200 }, /* A */
+ { 9600, DHU_LPR_B9600 }, /* A and B */
+ { 19200, DHU_LPR_B19200 }, /* B */
+ { 38400, DHU_LPR_B38400 }, /* A */
+ { -1, -1 }
+};
+
+static int dhu_match __P((struct device *, void *, void *));
+static void dhu_attach __P((struct device *, struct device *, void *));
+
+struct cfdriver dhu_cd = {
+ NULL, "dhu", DV_TTY
+};
+
+struct cfattach dhu_ca = {
+ sizeof(struct device), dhu_match, dhu_attach
+};
+
+static void dhurint __P((int));
+static void dhuxint __P((int));
+static void dhustart __P((struct tty *));
+static int dhuparam __P((struct tty *, struct termios *));
+static int dhuiflow __P((struct tty *, int));
+ int dhustop __P((struct tty *, int));
+static unsigned dhumctl __P((int, int, int));
+ int dhuopen __P((dev_t, int, int, struct proc *));
+ int dhuclose __P((dev_t, int, int, struct proc *));
+ int dhuread __P((dev_t, struct uio *, int));
+ int dhuwrite __P((dev_t, struct uio *, int));
+ int dhuioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+struct tty * dhutty __P((dev_t));
+
+
+/* Autoconfig handles: setup the controller to interrupt, */
+/* then complete the housecleaning for full operation */
+
+static int
+dhu_match (parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct uba_attach_args *ua = aux;
+ static int nunits = 0;
+ register dhuregs *dhuaddr;
+ register int n;
+
+ if (nunits > NDHU)
+ return 0;
+
+ dhuaddr = (dhuregs *) ua->ua_addr;
+
+ /* Reset controller to initialize, enable TX/RX interrupts */
+ /* to catch floating vector info elsewhere when completed */
+
+ dhuaddr->dhu_csr = (DHU_CSR_MASTER_RESET | DHU_CSR_RXIE | DHU_CSR_TXIE);
+
+ /* Now wait up to 3 seconds for self-test to complete. */
+
+ for (n = 0; n < 300; n++) {
+ DELAY(10000);
+ if ((dhuaddr->dhu_csr & DHU_CSR_MASTER_RESET) == 0)
+ break;
+ }
+
+ /* If the RESET did not clear after 3 seconds, */
+ /* the controller must be broken. */
+
+ if (n >= 300)
+ return 0;
+
+ /* Check whether diagnostic run has signalled a failure. */
+
+ if ((dhuaddr->dhu_csr & DHU_CSR_DIAG_FAIL) != 0)
+ return 0;
+
+ /* Register the RX interrupt handler and pass unit # as arg */
+
+ ua->ua_ivec = dhurint;
+
+ nunits++;
+ return 1;
+}
+
+static void
+dhu_attach (parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ register struct uba_attach_args *ua = aux;
+ register dhuregs *dhuaddr;
+ register unsigned c;
+ register int n, m;
+
+ dhuaddr = (dhuregs *) ua->ua_addr;
+
+ /* Process the 8 bytes of diagnostic info put into */
+ /* the FIFO following the master reset operation. */
+
+ printf ("\ndhv%d:", self->dv_unit);
+ for (n = 0; n < 8; n++) {
+ c = dhuaddr->dhu_rbuf;
+
+ if ((c&DHU_DIAG_CODE) == DHU_DIAG_CODE) {
+ if ((c&0200) == 0000)
+ printf (" rom(%d) version %d",
+ ((c>>1)&01), ((c>>2)&037));
+ else if (((c>>2)&07) != 0)
+ printf (" diag-error(proc%d)=%x",
+ ((c>>1)&01), ((c>>2)&07));
+ }
+ }
+ printf ("\n");
+
+ /* Initialize our static softc structure. */
+
+ c = dhuaddr->dhu_stat; /* get flag to distinguish DHU from DHV */
+
+ for (n = 0; n < ((c & DHU_STAT_DHU)? 16: 8); n++) {
+ m = ((self->dv_unit) << 4) + n;
+ dhu_softc[m].sc_addr = dhuaddr;
+ dhu_softc[m].sc_tty = ttymalloc();
+ dhu_softc[m].sc_type = (c & DHU_STAT_DHU)? IS_DHU: IS_DHV;
+ dhu_softc[m].sc_state = STATE_IDLE;
+
+ dhu_softc[m].sc_txaddr = uballoc (parent->dv_unit,
+ dhu_softc[m].sc_tty->t_outq.c_cs,
+ dhu_softc[m].sc_tty->t_outq.c_cn,
+ UBA_CANTWAIT);
+ }
+
+ /* Now stuff TX interrupt handler in place */
+
+ ubasetvec (self, ua->ua_cvec+1, dhuxint);
+ return;
+}
+
+/* Receiver Interrupt */
+
+#if RX_DELAY > 0
+
+static int RXtimeout = 0;
+
+static void
+dhurint (cntlr)
+ int cntlr;
+{
+ static void dhuRXint __P((void *));
+ if (RXtimeout == 0) {
+ RXtimeout = 1;
+ timeout (dhuRXint, (void *)cntlr, RX_DELAY);
+ }
+ return;
+}
+
+static void
+dhuRXint (arg)
+ void * arg;
+{
+
+#else
+
+static void
+dhurint (cntlr)
+ int cntlr;
+{
+
+#endif
+ register dhuregs *dhuaddr;
+ register struct tty *tp;
+ register int cc, unit;
+ register unsigned c, delta;
+ int overrun = 0;
+#if RX_DELAY > 0
+ int cntlr = (int) arg;
+ int s;
+
+ s = spltty();
+#endif
+
+ dhuaddr = dhu_softc[cntlr].sc_addr;
+
+ while ((c = dhuaddr->dhu_rbuf) & DHU_RBUF_DATA_VALID)
+ {
+ /* Ignore diagnostic FIFO entries. */
+
+ if ((c&DHU_DIAG_CODE) == DHU_DIAG_CODE)
+ continue;
+
+ cc = c & 0xff;
+ unit = (cntlr<<4) | ((c>>8)&017);
+ tp = dhu_softc[unit].sc_tty;
+
+ /* LINK.TYPE is set so we get modem control FIFO entries */
+
+ if ((c & DHU_DIAG_CODE) == DHU_MODEM_CODE) {
+ c = (c << 8);
+ /* Do MDMBUF flow control, wakeup sleeping opens */
+ if (c & DHU_STAT_DCD) {
+ if (!(tp->t_state & TS_CARR_ON))
+ (void)(*linesw[tp->t_line].l_modem)(tp, 1);
+ }
+ else if ((tp->t_state & TS_CARR_ON) &&
+ (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
+ (void) dhumctl (unit, 0, DMSET);
+
+ /* Do CRTSCTS flow control */
+ delta = c ^ dhu_softc[unit].sc_modem;
+ dhu_softc[unit].sc_modem = c;
+ if ((delta & DHU_STAT_CTS) &&
+ (tp->t_state & TS_ISOPEN) &&
+ (tp->t_cflag & CRTSCTS)) {
+ if (c & DHU_STAT_CTS) {
+ tp->t_state &= ~TS_TTSTOP;
+ ttstart (tp);
+ } else {
+ tp->t_state |= TS_TTSTOP;
+ dhustop (tp, 0);
+ }
+ }
+ continue;
+ }
+
+ if ((c & DHU_RBUF_OVERRUN_ERR) && overrun == 0) {
+ log(LOG_WARNING, "dhv(%d,%d): silo overflow\n",
+ cntlr, (c >> 8) & 017);
+ overrun = 1;
+ }
+ /* A BREAK key will appear as a NULL with a framing error */
+ if (c & DHU_RBUF_FRAMING_ERR)
+ cc |= TTY_FE;
+ if (c & DHU_RBUF_PARITY_ERR)
+ cc |= TTY_PE;
+
+ (*linesw[tp->t_line].l_rint)(cc, tp);
+ }
+#if RX_DELAY > 0
+ RXtimeout = 0;
+ (void) splx(s);
+#endif
+ return;
+}
+
+/* Transmitter Interrupt */
+
+static void
+dhuxint (cntlr)
+ int cntlr;
+{
+ register dhuregs *dhuaddr;
+ register struct dhu_softc *sc;
+ register struct tty *tp;
+ register unsigned csr;
+ register int unit;
+
+ dhuaddr = dhu_softc[cntlr].sc_addr;
+
+ csr = (dhuaddr->dhu_csr_hi) << 8;
+
+ unit = (cntlr<<4)|((csr>>8)&017);
+
+ sc = &dhu_softc[unit];
+
+ tp = sc->sc_tty;
+
+ tp->t_state &= ~TS_BUSY;
+ if (tp->t_state & TS_FLUSH)
+ tp->t_state &= ~TS_FLUSH;
+ else {
+ if (sc->sc_state == STATE_DMA_STOPPED)
+ sc->sc_cc -= dhuaddr->dhu_tbufcnt;
+ ndflush (&tp->t_outq, sc->sc_cc);
+ sc->sc_cc = 0;
+ }
+
+ sc->sc_state = STATE_IDLE;
+
+ if (tp->t_line)
+ (*linesw[tp->t_line].l_start)(tp);
+ else
+ dhustart (tp);
+
+ return;
+}
+
+int
+dhuopen (dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ register struct tty *tp;
+ register int unit;
+ int s, error = 0;
+
+ unit = minor(dev);
+ if (unit >= NDHULINE)
+ return (ENXIO);
+ tp = dhu_softc[unit].sc_tty;
+ if (tp == NULL)
+ tp = dhu_softc[unit].sc_tty = ttymalloc();
+ tp->t_oproc = dhustart;
+ tp->t_param = dhuparam;
+ tp->t_hwiflow = dhuiflow;
+ tp->t_dev = dev;
+ if ((tp->t_state & TS_ISOPEN) == 0) {
+ tp->t_state |= TS_WOPEN;
+ ttychars(tp);
+ if (tp->t_ispeed == 0) {
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+ }
+ (void) dhuparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+ } else if ((tp->t_state & TS_XCLUDE) && curproc->p_ucred->cr_uid != 0)
+ return (EBUSY);
+ /* Use DMBIS and *not* DMSET or else we clobber incoming bits */
+ if (dhumctl (unit, DML_DTR|DML_RTS, DMBIS) & DML_DCD)
+ tp->t_state |= TS_CARR_ON;
+ s = spltty();
+ while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
+ !(tp->t_state & TS_CARR_ON)) {
+ tp->t_state |= TS_WOPEN;
+ error = ttysleep(tp, (caddr_t)&tp->t_rawq,
+ TTIPRI | PCATCH, ttopen, 0);
+ if (error)
+ break;
+ }
+ (void) splx(s);
+ if (error)
+ return (error);
+ return ((*linesw[tp->t_line].l_open)(dev, tp));
+}
+
+/*ARGSUSED*/
+int
+dhuclose (dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ register struct tty *tp;
+ register int unit = minor(dev);
+
+ tp = dhu_softc[unit].sc_tty;
+
+ (*linesw[tp->t_line].l_close)(tp, flag);
+
+ /* Make sure a BREAK state is not left enabled. */
+
+ (void) dhumctl (unit, DML_BRK, DMBIC);
+
+ /* Do a hangup if so required. */
+
+ if ((tp->t_cflag & HUPCL) || (tp->t_state & TS_WOPEN) ||
+ !(tp->t_state & TS_ISOPEN))
+ (void) dhumctl (unit, 0, DMSET);
+
+ return (ttyclose(tp));
+}
+
+int
+dhuread (dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+{
+ register struct tty *tp;
+
+ tp = dhu_softc[minor(dev)].sc_tty;
+ return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
+}
+
+int
+dhuwrite (dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+{
+ register struct tty *tp;
+
+ tp = dhu_softc[minor(dev)].sc_tty;
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+}
+
+/*ARGSUSED*/
+int
+dhuioctl (dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ register struct tty *tp;
+ register int unit = minor(dev);
+ int error;
+
+ tp = dhu_softc[unit].sc_tty;
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return (error);
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return (error);
+
+ switch (cmd) {
+
+ case TIOCSBRK:
+ (void) dhumctl (unit, DML_BRK, DMBIS);
+ break;
+
+ case TIOCCBRK:
+ (void) dhumctl (unit, DML_BRK, DMBIC);
+ break;
+
+ case TIOCSDTR:
+ (void) dhumctl (unit, DML_DTR|DML_RTS, DMBIS);
+ break;
+
+ case TIOCCDTR:
+ (void) dhumctl (unit, DML_DTR|DML_RTS, DMBIC);
+ break;
+
+ case TIOCMSET:
+ (void) dhumctl (unit, *(int *)data, DMSET);
+ break;
+
+ case TIOCMBIS:
+ (void) dhumctl (unit, *(int *)data, DMBIS);
+ break;
+
+ case TIOCMBIC:
+ (void) dhumctl (unit, *(int *)data, DMBIC);
+ break;
+
+ case TIOCMGET:
+ *(int *)data = (dhumctl (unit, 0, DMGET) & ~DML_BRK);
+ break;
+
+ default:
+ return (ENOTTY);
+ }
+ return (0);
+}
+
+struct tty *
+dhutty (dev)
+ dev_t dev;
+{
+ struct tty *tp = dhu_softc[minor(dev)].sc_tty;
+ return (tp);
+}
+
+/*ARGSUSED*/
+int
+dhustop (tp, flag)
+ register struct tty *tp;
+{
+ register dhuregs *dhuaddr;
+ register struct dhu_softc *sc;
+ int unit = minor(tp->t_dev);
+ int s;
+
+ s = spltty();
+
+ if (tp->t_state & TS_BUSY)
+ {
+ sc = &dhu_softc[unit];
+
+ if (sc->sc_state == STATE_DMA_RUNNING)
+ {
+ sc->sc_state = STATE_DMA_STOPPED;
+
+ dhuaddr = sc->sc_addr;
+ dhuaddr->dhu_csr_lo = (DHU_CSR_RXIE | (unit & 017));
+ dhuaddr->dhu_lnctrl |= DHU_LNCTRL_DMA_ABORT;
+ }
+
+ if (!(tp->t_state & TS_TTSTOP))
+ tp->t_state |= TS_FLUSH;
+ }
+ (void) splx(s);
+ return 0;
+}
+
+static void
+dhustart (tp)
+ register struct tty *tp;
+{
+ register struct dhu_softc *sc;
+ register dhuregs *dhuaddr;
+ register int unit = minor(tp->t_dev);
+ register unsigned addr;
+ register int cc;
+ int s;
+
+ s = spltty();
+ if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
+ goto out;
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (tp->t_state & TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup((caddr_t)&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
+ }
+ if (tp->t_outq.c_cc == 0)
+ goto out;
+ cc = ndqb(&tp->t_outq, 0);
+ if (cc == 0)
+ goto out;
+
+ tp->t_state |= TS_BUSY;
+
+ sc = &dhu_softc[unit];
+
+ dhuaddr = sc->sc_addr;
+ dhuaddr->dhu_csr_lo = (DHU_CSR_RXIE | (unit & 017));
+
+ sc->sc_cc = cc;
+
+ if (cc == 1)
+ {
+ sc->sc_state = STATE_TX_ONE_CHAR;
+ dhuaddr->dhu_txchar = DHU_TXCHAR_DATA_VALID | *tp->t_outq.c_cf;
+ }
+ else
+ {
+ sc->sc_state = STATE_DMA_RUNNING;
+
+ addr = UBAI_ADDR(sc->sc_txaddr) +
+ (tp->t_outq.c_cf - tp->t_outq.c_cs);
+
+ dhuaddr->dhu_tbufcnt = cc;
+ dhuaddr->dhu_tbufad1 = (addr & 0xffff);
+ dhuaddr->dhu_tbufad2 = ((addr>>16) & 0x3f) |
+ DHU_TBUFAD2_TX_ENABLE;
+
+ dhuaddr->dhu_lnctrl &= ~DHU_LNCTRL_DMA_ABORT;
+ dhuaddr->dhu_tbufad2 |= DHU_TBUFAD2_DMA_START;
+ }
+out:
+ (void) splx(s);
+ return;
+}
+
+static int
+dhuparam (tp, t)
+ register struct tty *tp;
+ register struct termios *t;
+{
+ register dhuregs *dhuaddr;
+ register int cflag = t->c_cflag;
+ int unit = minor(tp->t_dev);
+ int ispeed = ttspeedtab(t->c_ispeed, dhuspeedtab);
+ int ospeed = ttspeedtab(t->c_ospeed, dhuspeedtab);
+ register unsigned lpr, lnctrl;
+ int s;
+
+ /* check requested parameters */
+ if (ospeed < 0 || ispeed < 0)
+ return (EINVAL);
+
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = cflag;
+
+ if (ospeed == 0) {
+ (void) dhumctl (unit, 0, DMSET); /* hang up line */
+ return (0);
+ }
+
+ s = spltty();
+ dhuaddr = dhu_softc[unit].sc_addr;
+ dhuaddr->dhu_csr_lo = (DHU_CSR_RXIE | (unit & 017));
+
+ lpr = ((ispeed&017)<<8) | ((ospeed&017)<<12) ;
+
+ switch (cflag & CSIZE)
+ {
+ case CS5:
+ lpr |= DHU_LPR_5_BIT_CHAR;
+ break;
+ case CS6:
+ lpr |= DHU_LPR_6_BIT_CHAR;
+ break;
+ case CS7:
+ lpr |= DHU_LPR_7_BIT_CHAR;
+ break;
+ default:
+ lpr |= DHU_LPR_8_BIT_CHAR;
+ break;
+ }
+ if (cflag & PARENB)
+ lpr |= DHU_LPR_PARENB;
+ if (!(cflag & PARODD))
+ lpr |= DHU_LPR_EPAR;
+ if (cflag & CSTOPB)
+ lpr |= DHU_LPR_2_STOP;
+
+ dhuaddr->dhu_lpr = lpr;
+
+ dhuaddr->dhu_tbufad2 |= DHU_TBUFAD2_TX_ENABLE;
+
+ lnctrl = dhuaddr->dhu_lnctrl;
+
+ /* Setting LINK.TYPE enables modem signal change interrupts. */
+
+ lnctrl |= (DHU_LNCTRL_RX_ENABLE | DHU_LNCTRL_LINK_TYPE);
+
+ if (t->c_iflag & IXON)
+ lnctrl |= DHU_LNCTRL_OAUTO;
+ else
+ lnctrl &= ~DHU_LNCTRL_OAUTO;
+
+ if (t->c_iflag & IXOFF)
+ lnctrl |= DHU_LNCTRL_IAUTO;
+ else
+ lnctrl &= ~DHU_LNCTRL_IAUTO;
+
+ dhuaddr->dhu_lnctrl = lnctrl;
+
+ dhu_softc[unit].sc_modem = dhuaddr->dhu_stat;
+
+ (void) splx(s);
+ return (0);
+}
+
+static int
+dhuiflow (tp, flag)
+ struct tty *tp;
+ int flag;
+{
+ int unit = minor(tp->t_dev);
+
+ if (tp->t_cflag & CRTSCTS) {
+ (void) dhumctl (unit, DML_RTS, ((flag)? DMBIC: DMBIS));
+ return (1);
+ }
+ return (0);
+}
+
+static unsigned
+dhumctl (unit, bits, how)
+ int unit, bits, how;
+{
+ register dhuregs *dhuaddr;
+ register unsigned status;
+ register unsigned lnctrl;
+ register unsigned mbits;
+ int s;
+
+ s = spltty();
+
+ dhuaddr = dhu_softc[unit].sc_addr;
+ dhuaddr->dhu_csr_lo = (DHU_CSR_RXIE | (unit & 017));
+
+ mbits = 0;
+
+ /* external signals as seen from the port */
+
+ status = dhuaddr->dhu_stat;
+
+ if (status & DHU_STAT_CTS)
+ mbits |= DML_CTS;
+
+ if (status & DHU_STAT_DCD)
+ mbits |= DML_DCD;
+
+ if (status & DHU_STAT_DSR)
+ mbits |= DML_DSR;
+
+ if (status & DHU_STAT_RI)
+ mbits |= DML_RI;
+
+ /* internal signals/state delivered to port */
+
+ lnctrl = dhuaddr->dhu_lnctrl;
+
+ if (lnctrl & DHU_LNCTRL_RTS)
+ mbits |= DML_RTS;
+
+ if (lnctrl & DHU_LNCTRL_DTR)
+ mbits |= DML_DTR;
+
+ if (lnctrl & DHU_LNCTRL_BREAK)
+ mbits |= DML_BRK;
+
+ switch (how)
+ {
+ case DMSET:
+ mbits = bits;
+ break;
+
+ case DMBIS:
+ mbits |= bits;
+ break;
+
+ case DMBIC:
+ mbits &= ~bits;
+ break;
+
+ case DMGET:
+ (void) splx(s);
+ return (mbits);
+ }
+
+ if (mbits & DML_RTS)
+ lnctrl |= DHU_LNCTRL_RTS;
+ else
+ lnctrl &= ~DHU_LNCTRL_RTS;
+
+ if (mbits & DML_DTR)
+ lnctrl |= DHU_LNCTRL_DTR;
+ else
+ lnctrl &= ~DHU_LNCTRL_DTR;
+
+ if (mbits & DML_BRK)
+ lnctrl |= DHU_LNCTRL_BREAK;
+ else
+ lnctrl &= ~DHU_LNCTRL_BREAK;
+
+ dhuaddr->dhu_lnctrl = lnctrl;
+
+ (void) splx(s);
+ return (mbits);
+}
+
+#endif /* #if NDHU > 0 */
diff --git a/sys/arch/vax/uba/dhureg.h b/sys/arch/vax/uba/dhureg.h
new file mode 100644
index 00000000000..2ecb20291dd
--- /dev/null
+++ b/sys/arch/vax/uba/dhureg.h
@@ -0,0 +1,140 @@
+/* $NetBSD: dhureg.h,v 1.2 1996/03/17 22:51:50 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+union w_b
+{
+ u_short word;
+ struct {
+ u_char byte_lo;
+ u_char byte_hi;
+ } bytes;
+};
+
+struct DHUregs
+{
+ volatile union w_b u_csr; /* Control/Status Register (R/W) */
+ volatile u_short dhu_rbuf; /* Receive Buffer (R only) */
+#define dhu_txchar dhu_rbuf /* Transmit Character (W only) */
+ volatile u_short dhu_lpr; /* Line Parameter Register (R/W) */
+ volatile u_short dhu_stat; /* Line Status (R only) */
+ volatile u_short dhu_lnctrl; /* Line Control (R/W) */
+ volatile u_short dhu_tbufad1; /* Transmit Buffer Address 1 (R/W) */
+ volatile u_short dhu_tbufad2; /* Transmit Buffer Address 2 (R/W) */
+ volatile u_short dhu_tbufcnt; /* Transmit Buffer Count (R/W) */
+};
+
+#define dhu_csr u_csr.word
+#define dhu_csr_lo u_csr.bytes.byte_lo
+#define dhu_csr_hi u_csr.bytes.byte_hi
+
+typedef struct DHUregs dhuregs;
+
+/* CSR bits */
+
+#define DHU_CSR_TX_ACTION 0100000
+#define DHU_CSR_TXIE 0040000
+#define DHU_CSR_DIAG_FAIL 0020000
+#define DHU_CSR_TX_DMA_ERROR 0010000
+#define DHU_CSR_TX_LINE_MASK 0007400
+#define DHU_CSR_RX_DATA_AVAIL 0000200
+#define DHU_CSR_RXIE 0000100
+#define DHU_CSR_MASTER_RESET 0000040
+#define DHU_CSR_UNUSED 0000020
+#define DHU_CSR_CHANNEL_MASK 0000017
+
+/* RBUF bits */
+
+#define DHU_RBUF_DATA_VALID 0100000
+#define DHU_RBUF_OVERRUN_ERR 0040000
+#define DHU_RBUF_FRAMING_ERR 0020000
+#define DHU_RBUF_PARITY_ERR 0010000
+#define DHU_RBUF_RX_LINE_MASK 0007400
+
+#define DHU_DIAG_CODE 0070001
+#define DHU_MODEM_CODE 0070000
+
+/* TXCHAR bits */
+
+#define DHU_TXCHAR_DATA_VALID 0100000
+
+/* LPR bits */
+
+#define DHU_LPR_B50 0x0
+#define DHU_LPR_B75 0x1
+#define DHU_LPR_B110 0x2
+#define DHU_LPR_B134 0x3
+#define DHU_LPR_B150 0x4
+#define DHU_LPR_B300 0x5
+#define DHU_LPR_B600 0x6
+#define DHU_LPR_B1200 0x7
+#define DHU_LPR_B1800 0x8
+#define DHU_LPR_B2000 0x9
+#define DHU_LPR_B2400 0xA
+#define DHU_LPR_B4800 0xB
+#define DHU_LPR_B7200 0xC
+#define DHU_LPR_B9600 0xD
+#define DHU_LPR_B19200 0xE
+#define DHU_LPR_B38400 0xF
+
+#define DHU_LPR_5_BIT_CHAR 0000000
+#define DHU_LPR_6_BIT_CHAR 0000010
+#define DHU_LPR_7_BIT_CHAR 0000020
+#define DHU_LPR_8_BIT_CHAR 0000030
+#define DHU_LPR_PARENB 0000040
+#define DHU_LPR_EPAR 0000100
+#define DHU_LPR_2_STOP 0000200
+
+/* STAT bits */
+
+#define DHU_STAT_DSR 0100000
+#define DHU_STAT_RI 0020000
+#define DHU_STAT_DCD 0010000
+#define DHU_STAT_CTS 0004000
+#define DHU_STAT_DHU 0000400
+
+/* LNCTRL bits */
+
+#define DHU_LNCTRL_DMA_ABORT 0000001
+#define DHU_LNCTRL_IAUTO 0000002
+#define DHU_LNCTRL_RX_ENABLE 0000004
+#define DHU_LNCTRL_BREAK 0000010
+#define DHU_LNCTRL_OAUTO 0000020
+#define DHU_LNCTRL_FORCE_XOFF 0000040
+#define DHU_LNCTRL_LINK_TYPE 0000400
+#define DHU_LNCTRL_DTR 0001000
+#define DHU_LNCTRL_RTS 0010000
+
+/* TBUFAD2 bits */
+
+#define DHU_TBUFAD2_DMA_START 0000200
+#define DHU_TBUFAD2_TX_ENABLE 0100000
diff --git a/sys/arch/vax/uba/dz.c b/sys/arch/vax/uba/dz.c
new file mode 100644
index 00000000000..f1636b7f3ef
--- /dev/null
+++ b/sys/arch/vax/uba/dz.c
@@ -0,0 +1,819 @@
+/* $NetBSD: dz.c,v 1.1 1996/04/08 17:22:20 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Ralph Campbell and Rick Macklem.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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/systm.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/proc.h>
+#include <sys/map.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/device.h>
+
+#include <machine/pte.h>
+#include <machine/trap.h>
+
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
+
+#include <vax/uba/dzreg.h>
+
+/* A DZ-11 has 8 ports while a DZV/DZQ-11 has only 4. We use 8 by default */
+
+#define NDZLINE 8
+
+#define DZ_C2I(c) ((c)<<3) /* convert controller # to index */
+#define DZ_I2C(c) ((c)>>3) /* convert minor to controller # */
+#define DZ_PORT(u) ((u)&07) /* extract the port # */
+
+struct dz_softc {
+ struct device sc_dev; /* Autoconf blaha */
+ dzregs * sc_addr; /* controller reg address */
+ int sc_type; /* DZ11 or DZV11? */
+ int sc_rxint; /* Receive interrupt count XXX */
+ u_char sc_brk; /* Break asserted on some lines */
+ struct {
+ struct tty * dz_tty; /* what we work on */
+ caddr_t dz_mem; /* pointers to clist output */
+ caddr_t dz_end; /* allowing pdma action */
+ } sc_dz[NDZLINE];
+};
+
+/* Flags used to monitor modem bits, make them understood outside driver */
+
+#define DML_DTR TIOCM_DTR
+#define DML_DCD TIOCM_CD
+#define DML_RI TIOCM_RI
+#define DML_BRK 0100000 /* no equivalent, we will mask */
+
+static struct speedtab dzspeedtab[] =
+{
+ { 0, 0 },
+ { 50, DZ_LPR_B50 },
+ { 75, DZ_LPR_B75 },
+ { 110, DZ_LPR_B110 },
+ { 134, DZ_LPR_B134 },
+ { 150, DZ_LPR_B150 },
+ { 300, DZ_LPR_B300 },
+ { 600, DZ_LPR_B600 },
+ { 1200, DZ_LPR_B1200 },
+ { 1800, DZ_LPR_B1800 },
+ { 2000, DZ_LPR_B2000 },
+ { 2400, DZ_LPR_B2400 },
+ { 3600, DZ_LPR_B3600 },
+ { 4800, DZ_LPR_B4800 },
+ { 7200, DZ_LPR_B7200 },
+ { 9600, DZ_LPR_B9600 },
+ { -1, -1 }
+};
+
+static int dz_match __P((struct device *, void *, void *));
+static void dz_attach __P((struct device *, struct device *, void *));
+static void dzrint __P((int));
+static void dzxint __P((int));
+static void dzstart __P((struct tty *));
+static int dzparam __P((struct tty *, struct termios *));
+static unsigned dzmctl __P((struct dz_softc *, int, int, int));
+static void dzscan __P((void *));
+struct tty * dztty __P((dev_t));
+ int dzopen __P((dev_t, int, int, struct proc *));
+ int dzclose __P((dev_t, int, int, struct proc *));
+ int dzread __P((dev_t, struct uio *, int));
+ int dzwrite __P((dev_t, struct uio *, int));
+ int dzioctl __P((dev_t, int, caddr_t, int, struct proc *));
+ int dzstop __P((struct tty *, int));
+
+struct cfdriver dz_cd = {
+ NULL, "dz", DV_TTY
+};
+
+struct cfattach dz_ca = {
+ sizeof(struct dz_softc), dz_match, dz_attach
+};
+
+
+/*
+ * The DZ series doesn't interrupt on carrier transitions,
+ * so we have to use a timer to watch it.
+ */
+static int dz_timer = 0; /* true if timer started */
+
+#define DZ_DZ 8 /* Unibus DZ-11 board linecount */
+#define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */
+
+/* Autoconfig handles: setup the controller to interrupt, */
+/* then complete the housecleaning for full operation */
+
+static int
+dz_match (parent, match, aux)
+ struct device *parent;
+ void *match, *aux;
+{
+ struct uba_attach_args *ua = aux;
+ register dzregs *dzaddr;
+ register int n;
+
+ dzaddr = (dzregs *) ua->ua_addr;
+
+ /* Reset controller to initialize, enable TX interrupts */
+ /* to catch floating vector info elsewhere when completed */
+
+ dzaddr->dz_csr = (DZ_CSR_MSE | DZ_CSR_TXIE);
+ dzaddr->dz_tcr = 1; /* Force a TX interrupt */
+
+ DELAY(100000); /* delay 1/10 second */
+
+ dzaddr->dz_csr = DZ_CSR_RESET;
+
+ /* Now wait up to 3 seconds for reset/clear to complete. */
+
+ for (n = 0; n < 300; n++) {
+ DELAY(10000);
+ if ((dzaddr->dz_csr & DZ_CSR_RESET) == 0)
+ break;
+ }
+
+ /* If the RESET did not clear after 3 seconds, */
+ /* the controller must be broken. */
+
+ if (n >= 300)
+ return (0);
+
+ /* Register the TX interrupt handler */
+
+ ua->ua_ivec = dzxint;
+
+ return (1);
+}
+
+static void
+dz_attach (parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct uba_softc *uh = (void *)parent;
+ struct dz_softc *sc = (void *)self;
+ register struct uba_attach_args *ua = aux;
+ register dzregs *dzaddr;
+ register int n;
+
+ dzaddr = (dzregs *) ua->ua_addr;
+ sc->sc_addr = dzaddr;
+
+#ifdef QBA
+ if (uh->uh_type == QBA)
+ sc->sc_type = DZ_DZV;
+ else
+#endif
+ sc->sc_type = DZ_DZ;
+
+ sc->sc_rxint = sc->sc_brk = 0;
+
+ dzaddr->dz_csr = (DZ_CSR_MSE | DZ_CSR_RXIE | DZ_CSR_TXIE);
+ dzaddr->dz_dtr = 0; /* Make sure DTR bits are zero */
+ dzaddr->dz_break = 0; /* Status of BREAK bits, all off */
+
+ /* Initialize our softc structure. Should be done in open? */
+
+ for (n = 0; n < sc->sc_type; n++)
+ sc->sc_dz[n].dz_tty = ttymalloc();
+
+ /* Now register the RX interrupt handler */
+ ubasetvec(self, ua->ua_cvec-1, dzrint);
+
+ /* Alas no interrupt on modem bit changes, so we manually scan */
+
+ if (dz_timer == 0) {
+ dz_timer = 1;
+ timeout(dzscan, (void *)0, hz);
+ }
+
+ printf("\n");
+ return;
+}
+
+/* Receiver Interrupt */
+
+static void
+dzrint(cntlr)
+ int cntlr;
+{
+ struct dz_softc *sc = dz_cd.cd_devs[cntlr];
+ volatile dzregs *dzaddr;
+ register struct tty *tp;
+ register int cc, line;
+ register unsigned c;
+ int overrun = 0;
+
+ sc->sc_rxint++;
+
+ dzaddr = sc->sc_addr;
+
+ while ((c = dzaddr->dz_rbuf) & DZ_RBUF_DATA_VALID) {
+ cc = c & 0xFF;
+ line = DZ_PORT(c>>8);
+ tp = sc->sc_dz[line].dz_tty;
+
+ if (!(tp->t_state & TS_ISOPEN)) {
+ wakeup((caddr_t)&tp->t_rawq);
+ continue;
+ }
+
+ if ((c & DZ_RBUF_OVERRUN_ERR) && overrun == 0) {
+ log(LOG_WARNING, "%s: silo overflow, line %d\n",
+ sc->sc_dev.dv_xname, line);
+ overrun = 1;
+ }
+ /* A BREAK key will appear as a NULL with a framing error */
+ if (c & DZ_RBUF_FRAMING_ERR)
+ cc |= TTY_FE;
+ if (c & DZ_RBUF_PARITY_ERR)
+ cc |= TTY_PE;
+
+ (*linesw[tp->t_line].l_rint)(cc, tp);
+ }
+ return;
+}
+
+/* Transmitter Interrupt */
+
+static void
+dzxint(cntlr)
+ int cntlr;
+{
+ volatile dzregs *dzaddr;
+ register struct dz_softc *sc = dz_cd.cd_devs[cntlr];
+ register struct tty *tp;
+ register unsigned csr;
+ register int line;
+
+ dzaddr = sc->sc_addr;
+
+ /*
+ * Switch to POLLED mode.
+ * Some simple measurements indicated that even on
+ * one port, by freeing the scanner in the controller
+ * by either providing a character or turning off
+ * the port when output is complete, the transmitter
+ * was ready to accept more output when polled again.
+ * With just two ports running the game "worms,"
+ * almost every interrupt serviced both transmitters!
+ * Each UART is double buffered, so if the scanner
+ * is quick enough and timing works out, we can even
+ * feed the same port twice.
+ */
+
+ dzaddr->dz_csr &= ~(DZ_CSR_TXIE);
+
+ while (((csr = dzaddr->dz_csr) & DZ_CSR_TX_READY) != 0) {
+
+ line = DZ_PORT(csr>>8);
+
+ if (sc->sc_dz[line].dz_mem < sc->sc_dz[line].dz_end) {
+ dzaddr->dz_tbuf = *sc->sc_dz[line].dz_mem++;
+ continue;
+ }
+
+ /*
+ * Turn off this TX port as all pending output
+ * has been completed - thus freeing the scanner
+ * on the controller to hopefully find another
+ * pending TX operation we can service now.
+ * (avoiding the overhead of another interrupt)
+ */
+
+ dzaddr->dz_tcr &= ~(1 << line);
+
+ tp = sc->sc_dz[line].dz_tty;
+
+ tp->t_state &= ~TS_BUSY;
+
+ if (tp->t_state & TS_FLUSH)
+ tp->t_state &= ~TS_FLUSH;
+ else {
+ ndflush (&tp->t_outq, (sc->sc_dz[line].dz_mem -
+ (caddr_t)tp->t_outq.c_cf));
+ sc->sc_dz[line].dz_end = sc->sc_dz[line].dz_mem =
+ tp->t_outq.c_cf;
+ }
+
+ if (tp->t_line)
+ (*linesw[tp->t_line].l_start)(tp);
+ else
+ dzstart(tp);
+ }
+
+ /*
+ * Re-enable TX interrupts.
+ */
+
+ dzaddr->dz_csr |= (DZ_CSR_TXIE);
+ return;
+}
+
+int
+dzopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ register struct tty *tp;
+ register int unit, line;
+ struct dz_softc *sc;
+ int s, error = 0;
+
+ unit = DZ_I2C(minor(dev));
+ line = DZ_PORT(minor(dev));
+
+ if (unit >= dz_cd.cd_ndevs || dz_cd.cd_devs[unit] == NULL)
+ return (ENXIO);
+
+ sc = dz_cd.cd_devs[unit];
+
+ if (line >= sc->sc_type)
+ return ENXIO;
+
+ tp = sc->sc_dz[line].dz_tty;
+ if (tp == NULL)
+ return (ENODEV);
+ tp->t_oproc = dzstart;
+ tp->t_param = dzparam;
+ tp->t_dev = dev;
+ if ((tp->t_state & TS_ISOPEN) == 0) {
+ tp->t_state |= TS_WOPEN;
+ ttychars(tp);
+ if (tp->t_ispeed == 0) {
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
+ }
+ (void) dzparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+ } else if ((tp->t_state & TS_XCLUDE) && p->p_ucred->cr_uid != 0)
+ return (EBUSY);
+ /* Use DMBIS and *not* DMSET or else we clobber incoming bits */
+ if (dzmctl(sc, line, DML_DTR, DMBIS) & DML_DCD)
+ tp->t_state |= TS_CARR_ON;
+ s = spltty();
+ while (!(flag & O_NONBLOCK) && !(tp->t_cflag & CLOCAL) &&
+ !(tp->t_state & TS_CARR_ON)) {
+ tp->t_state |= TS_WOPEN;
+ error = ttysleep(tp, (caddr_t)&tp->t_rawq,
+ TTIPRI | PCATCH, ttopen, 0);
+ if (error)
+ break;
+ }
+ (void) splx(s);
+ if (error)
+ return (error);
+ return ((*linesw[tp->t_line].l_open)(dev, tp));
+}
+
+/*ARGSUSED*/
+int
+dzclose (dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ struct dz_softc *sc;
+ register struct tty *tp;
+ register int unit, line;
+
+
+ unit = DZ_I2C(minor(dev));
+ line = DZ_PORT(minor(dev));
+ sc = dz_cd.cd_devs[unit];
+
+ tp = sc->sc_dz[line].dz_tty;
+
+ (*linesw[tp->t_line].l_close)(tp, flag);
+
+ /* Make sure a BREAK state is not left enabled. */
+ (void) dzmctl(sc, line, DML_BRK, DMBIC);
+
+ /* Do a hangup if so required. */
+ if ((tp->t_cflag & HUPCL) || (tp->t_state & TS_WOPEN) ||
+ !(tp->t_state & TS_ISOPEN))
+ (void) dzmctl(sc, line, 0, DMSET);
+
+ return (ttyclose(tp));
+}
+
+int
+dzread (dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+{
+ register struct tty *tp;
+ struct dz_softc *sc;
+
+ sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
+
+ tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
+ return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
+}
+
+int
+dzwrite (dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+{
+ register struct tty *tp;
+ struct dz_softc *sc;
+
+ sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
+
+ tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+}
+
+/*ARGSUSED*/
+int
+dzioctl (dev, cmd, data, flag, p)
+ dev_t dev;
+ int cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ struct dz_softc *sc;
+ register struct tty *tp;
+ register int unit, line;
+ int error;
+
+ unit = DZ_I2C(minor(dev));
+ line = DZ_PORT(minor(dev));
+ sc = dz_cd.cd_devs[unit];
+ tp = sc->sc_dz[line].dz_tty;
+
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return (error);
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return (error);
+
+ switch (cmd) {
+
+ case TIOCSBRK:
+ (void) dzmctl(sc, line, DML_BRK, DMBIS);
+ break;
+
+ case TIOCCBRK:
+ (void) dzmctl(sc, line, DML_BRK, DMBIC);
+ break;
+
+ case TIOCSDTR:
+ (void) dzmctl(sc, line, DML_DTR, DMBIS);
+ break;
+
+ case TIOCCDTR:
+ (void) dzmctl(sc, line, DML_DTR, DMBIC);
+ break;
+
+ case TIOCMSET:
+ (void) dzmctl(sc, line, *(int *)data, DMSET);
+ break;
+
+ case TIOCMBIS:
+ (void) dzmctl(sc, line, *(int *)data, DMBIS);
+ break;
+
+ case TIOCMBIC:
+ (void) dzmctl(sc, line, *(int *)data, DMBIC);
+ break;
+
+ case TIOCMGET:
+ *(int *)data = (dzmctl(sc, line, 0, DMGET) & ~DML_BRK);
+ break;
+
+ default:
+ return (ENOTTY);
+ }
+ return (0);
+}
+
+struct tty *
+dztty (dev)
+ dev_t dev;
+{
+ struct dz_softc *sc = dz_cd.cd_devs[DZ_I2C(minor(dev))];
+ struct tty *tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty;
+
+ return (tp);
+}
+
+/*ARGSUSED*/
+int
+dzstop (tp, flag)
+ register struct tty *tp;
+{
+ register struct dz_softc *sc;
+ int unit, line, s;
+
+ unit = DZ_I2C(minor(tp->t_dev));
+ line = DZ_PORT(minor(tp->t_dev));
+ sc = dz_cd.cd_devs[unit];
+
+ s = spltty();
+
+ if (tp->t_state & TS_BUSY)
+ {
+ sc->sc_dz[line].dz_end = sc->sc_dz[line].dz_mem;
+ if (!(tp->t_state & TS_TTSTOP))
+ tp->t_state |= TS_FLUSH;
+ }
+ (void) splx(s);
+ return 0;
+}
+
+static void
+dzstart (tp)
+ register struct tty *tp;
+{
+ register struct dz_softc *sc;
+ register dzregs *dzaddr;
+ register int unit, line;
+ register int cc;
+ int s;
+
+ unit = DZ_I2C(minor(tp->t_dev));
+ line = DZ_PORT(minor(tp->t_dev));
+ sc = dz_cd.cd_devs[unit];
+
+ s = spltty();
+ if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))
+ goto out;
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (tp->t_state & TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup((caddr_t)&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
+ }
+ if (tp->t_outq.c_cc == 0)
+ goto out;
+ cc = ndqb(&tp->t_outq, 0);
+ if (cc == 0)
+ goto out;
+
+ tp->t_state |= TS_BUSY;
+
+ dzaddr = sc->sc_addr;
+
+ sc->sc_dz[line].dz_end = sc->sc_dz[line].dz_mem = tp->t_outq.c_cf;
+ sc->sc_dz[line].dz_end += cc;
+ dzaddr->dz_tcr |= (1 << line); /* Enable this TX port */
+
+out:
+ (void) splx(s);
+ return;
+}
+
+static int
+dzparam(tp, t)
+ register struct tty *tp;
+ register struct termios *t;
+{
+ struct dz_softc *sc;
+ register dzregs *dzaddr;
+ register int cflag = t->c_cflag;
+ int unit, line;
+ int ispeed = ttspeedtab(t->c_ispeed, dzspeedtab);
+ int ospeed = ttspeedtab(t->c_ospeed, dzspeedtab);
+ register unsigned lpr;
+ int s;
+
+ unit = DZ_I2C(minor(tp->t_dev));
+ line = DZ_PORT(minor(tp->t_dev));
+ sc = dz_cd.cd_devs[unit];
+
+ /* check requested parameters */
+ if (ospeed < 0 || ispeed < 0 || ispeed != ospeed)
+ return (EINVAL);
+
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = cflag;
+
+ if (ospeed == 0) {
+ (void) dzmctl(sc, line, 0, DMSET); /* hang up line */
+ return (0);
+ }
+
+ s = spltty();
+ dzaddr = sc->sc_addr;
+
+ lpr = DZ_LPR_RX_ENABLE | ((ispeed&0xF)<<8) | line;
+
+ switch (cflag & CSIZE)
+ {
+ case CS5:
+ lpr |= DZ_LPR_5_BIT_CHAR;
+ break;
+ case CS6:
+ lpr |= DZ_LPR_6_BIT_CHAR;
+ break;
+ case CS7:
+ lpr |= DZ_LPR_7_BIT_CHAR;
+ break;
+ default:
+ lpr |= DZ_LPR_8_BIT_CHAR;
+ break;
+ }
+ if (cflag & PARENB)
+ lpr |= DZ_LPR_PARENB;
+ if (cflag & PARODD)
+ lpr |= DZ_LPR_OPAR;
+ if (cflag & CSTOPB)
+ lpr |= DZ_LPR_2_STOP;
+
+ dzaddr->dz_lpr = lpr;
+
+ (void) splx(s);
+ return (0);
+}
+
+static unsigned
+dzmctl(sc, line, bits, how)
+ register struct dz_softc *sc;
+ int line, bits, how;
+{
+ register dzregs *dzaddr;
+ register unsigned status;
+ register unsigned mbits;
+ register unsigned bit;
+ int s;
+
+ s = spltty();
+
+ dzaddr = sc->sc_addr;
+
+ mbits = 0;
+
+ bit = (1 << line);
+
+ /* external signals as seen from the port */
+
+ status = dzaddr->dz_dcd;
+
+ if (status & bit)
+ mbits |= DML_DCD;
+
+ status = dzaddr->dz_ring;
+
+ if (status & bit)
+ mbits |= DML_RI;
+
+ /* internal signals/state delivered to port */
+
+ status = dzaddr->dz_dtr;
+
+ if (status & bit)
+ mbits |= DML_DTR;
+
+ if (sc->sc_brk & bit)
+ mbits |= DML_BRK;
+
+ switch (how)
+ {
+ case DMSET:
+ mbits = bits;
+ break;
+
+ case DMBIS:
+ mbits |= bits;
+ break;
+
+ case DMBIC:
+ mbits &= ~bits;
+ break;
+
+ case DMGET:
+ (void) splx(s);
+ return (mbits);
+ }
+
+ if (mbits & DML_DTR)
+ dzaddr->dz_dtr |= bit;
+ else
+ dzaddr->dz_dtr &= ~bit;
+
+ if (mbits & DML_BRK)
+ dzaddr->dz_break = (sc->sc_brk |= bit);
+ else
+ dzaddr->dz_break = (sc->sc_brk &= ~bit);
+
+ (void) splx(s);
+ return (mbits);
+}
+
+/*
+ * This is called by timeout() periodically.
+ * Check to see if modem status bits have changed.
+ */
+static void
+dzscan(arg)
+ void *arg;
+{
+ register dzregs *dzaddr;
+ register struct dz_softc *sc;
+ register struct tty *tp;
+ register int n, bit, port;
+ unsigned csr;
+ int s;
+
+ s = spltty();
+
+ for (n = 0; n < dz_cd.cd_ndevs; n++) {
+
+ if (dz_cd.cd_devs[n] == NULL)
+ continue;
+
+ sc = dz_cd.cd_devs[n];
+
+ for (port = 0; port < sc->sc_type; port++) {
+
+ dzaddr = sc->sc_addr;
+ tp = sc->sc_dz[port].dz_tty;
+ bit = (1 << port);
+
+ if (dzaddr->dz_dcd & bit) { /* carrier present */
+
+ if (!(tp->t_state & TS_CARR_ON))
+ (void)(*linesw[tp->t_line].l_modem)
+ (tp, 1);
+ } else if ((tp->t_state & TS_CARR_ON) &&
+ (*linesw[tp->t_line].l_modem)(tp, 0) == 0)
+ dzaddr->dz_tcr &= ~bit;
+ }
+
+ /*
+ * If the RX interrupt rate is this high, switch
+ * the controller to Silo Alarm - which means don't
+ * interrupt until the RX silo has 16 characters in
+ * it (the silo is 64 characters in all).
+ * Avoid oscillating SA on and off by not turning
+ * if off unless the rate is appropriately low.
+ */
+
+ dzaddr = sc->sc_addr;
+
+ csr = dzaddr->dz_csr;
+
+ if (sc->sc_rxint > (16*10)) {
+ if ((csr & DZ_CSR_SAE) == 0)
+ dzaddr->dz_csr = (csr | DZ_CSR_SAE);
+ } else if ((csr & DZ_CSR_SAE) != 0)
+ if (sc->sc_rxint < 10)
+ dzaddr->dz_csr = (csr & ~(DZ_CSR_SAE));
+
+ sc->sc_rxint = 0;
+ }
+ (void) splx(s);
+ timeout(dzscan, (void *)0, hz);
+ return;
+}
diff --git a/sys/arch/vax/uba/dzreg.h b/sys/arch/vax/uba/dzreg.h
new file mode 100644
index 00000000000..c347cc6105d
--- /dev/null
+++ b/sys/arch/vax/uba/dzreg.h
@@ -0,0 +1,116 @@
+/* $NetBSD: dzreg.h,v 1.1 1996/04/08 17:22:21 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+union w_b
+{
+ u_short word;
+ struct {
+ u_char byte_lo;
+ u_char byte_hi;
+ } bytes;
+};
+
+struct DZregs
+{
+ volatile u_short dz_csr; /* Control/Status Register (R/W) */
+ volatile u_short dz_rbuf; /* Receive Buffer (R only) */
+#define dz_lpr dz_rbuf /* Line Parameter Register (W only) */
+ volatile union w_b u_tcr; /* Transmit Control Register (R/W) */
+ volatile union w_b u_msr; /* Modem Status Register (R only) */
+#define u_tdr u_msr /* Transmit Data Register (W only) */
+};
+
+#define dz_tcr u_tcr.bytes.byte_lo /* tx enable bits */
+#define dz_dtr u_tcr.bytes.byte_hi /* DTR status bits */
+#define dz_ring u_msr.bytes.byte_lo /* RI status bits */
+#define dz_dcd u_msr.bytes.byte_hi /* DCD status bits */
+#define dz_tbuf u_tdr.bytes.byte_lo /* transmit character */
+#define dz_break u_tdr.bytes.byte_hi /* BREAK set/clr bits */
+
+typedef struct DZregs dzregs;
+
+/* CSR bits */
+
+#define DZ_CSR_TX_READY 0100000 /* Transmitter Ready */
+#define DZ_CSR_TXIE 0040000 /* Transmitter Interrupt Enable */
+#define DZ_CSR_SA 0020000 /* Silo Alarm */
+#define DZ_CSR_SAE 0010000 /* Silo Alarm Enable */
+#define DZ_CSR_TX_LINE_MASK 0007400 /* Which TX line */
+
+#define DZ_CSR_RX_DONE 0000200 /* Receiver Done */
+#define DZ_CSR_RXIE 0000100 /* Receiver Interrupt Enable */
+#define DZ_CSR_MSE 0000040 /* Master Scan Enable */
+#define DZ_CSR_RESET 0000020 /* Clear (reset) Controller */
+#define DZ_CSR_MAINTENANCE 0000010
+#define DZ_CSR_UNUSED 0000007
+
+/* RBUF bits */
+
+#define DZ_RBUF_DATA_VALID 0100000
+#define DZ_RBUF_OVERRUN_ERR 0040000
+#define DZ_RBUF_FRAMING_ERR 0020000
+#define DZ_RBUF_PARITY_ERR 0010000
+#define DZ_RBUF_RX_LINE_MASK 0007400
+
+/* LPR bits */
+
+#define DZ_LPR_UNUSED 0160000
+#define DZ_LPR_RX_ENABLE 0010000
+
+#define DZ_LPR_B50 0x0
+#define DZ_LPR_B75 0x1
+#define DZ_LPR_B110 0x2
+#define DZ_LPR_B134 0x3
+#define DZ_LPR_B150 0x4
+#define DZ_LPR_B300 0x5
+#define DZ_LPR_B600 0x6
+#define DZ_LPR_B1200 0x7
+#define DZ_LPR_B1800 0x8
+#define DZ_LPR_B2000 0x9
+#define DZ_LPR_B2400 0xA
+#define DZ_LPR_B3600 0xB
+#define DZ_LPR_B4800 0xC
+#define DZ_LPR_B7200 0xD
+#define DZ_LPR_B9600 0xE
+#define DZ_LPR_ILLEGAL 0xF
+
+#define DZ_LPR_OPAR 0000200
+#define DZ_LPR_PARENB 0000100
+#define DZ_LPR_2_STOP 0000040
+
+#define DZ_LPR_5_BIT_CHAR 0000000
+#define DZ_LPR_6_BIT_CHAR 0000010
+#define DZ_LPR_7_BIT_CHAR 0000020
+#define DZ_LPR_8_BIT_CHAR 0000030
+
+#define DZ_LPR_CHANNEL_MASK 0000007
diff --git a/sys/arch/vax/uba/tmscp.c b/sys/arch/vax/uba/tmscp.c
index e08cd17f2fa..ef490d93e3d 100644
--- a/sys/arch/vax/uba/tmscp.c
+++ b/sys/arch/vax/uba/tmscp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tmscp.c,v 1.7 1995/12/13 19:02:53 ragge Exp $ */
+/* $NetBSD: tmscp.c,v 1.12 1996/04/08 18:37:30 ragge Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -158,27 +158,29 @@
#include "tmscp.h"
#if NTMSCP > 0
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/buf.h"
-#include "sys/conf.h"
-#include "sys/errno.h"
-#include "sys/file.h"
-#include "sys/map.h"
-#include "sys/ioctl.h"
-#include "sys/syslog.h"
-#include "sys/mtio.h"
-/* #include "sys/cmap.h" */
-#include "sys/uio.h"
-#include "sys/proc.h"
-#include "sys/tprintf.h"
-
-#include "vax/include/pte.h"
-#include "vax/include/cpu.h"
-#include "vax/include/mtpr.h"
-#include "vax/include/sid.h"
-#include "vax/uba/ubareg.h"
-#include "vax/uba/ubavar.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/map.h>
+#include <sys/ioctl.h>
+#include <sys/syslog.h>
+#include <sys/mtio.h>
+/* #include <sys/cmap.h> */
+#include <sys/uio.h>
+#include <sys/proc.h>
+#include <sys/tprintf.h>
+#include <sys/proc.h>
+
+#include <machine/pte.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
#define TENSEC (1000)
#define TMS_PRI LOG_INFO
@@ -188,16 +190,20 @@
#define NRSP (1<<NRSPL2)
#define NCMD (1<<NCMDL2)
-#include "tmscpreg.h"
-#include "vax/vax/tmscpinf.h"
-#include "vax/vax/mscpvar.h"
+#include <vax/uba/tmscpreg.h>
+#include <vax/vax/tmscpinf.h>
+#include <vax/vax/mscpvar.h>
int tmscp_match __P((struct device *, void *, void *));
void tmscp_attach __P((struct device *, struct device *, void *));
void tmscpstrategy __P((struct buf *));
-struct cfdriver tmscpcd = {
- NULL, "tmscp", tmscp_match, tmscp_attach, DV_DULL, sizeof(struct device)
+struct cfdriver tmscp_cd = {
+ NULL, "tmscp", DV_DULL
+};
+
+struct cfattach tmscp_ca = {
+ sizeof(struct device), tmscp_match, tmscp_attach
};
/* Software state per controller */
@@ -220,7 +226,27 @@ struct tmscp {
struct mscp tmscp_cmd[NCMD]; /* command packets */
} tmscp[NTMSCP];
-void tmscpstrategy(struct buf *);
+int tmscpprobe __P((caddr_t, int, struct uba_ctlr *, struct uba_softc *));
+int tmscpslave __P((struct uba_device *, caddr_t));
+int tmscpinit __P((int));
+void tmscpattach __P((struct uba_device *));
+void tmscpintr __P((int));
+void tmscprsp __P((struct uba_ctlr *, struct tmscp *,
+ struct tmscp_softc *, int));
+void tmscpstart __P((struct uba_ctlr *));
+void tmscpcommand __P((dev_t, int, int));
+struct mscp *tmscpgetcp __P((struct uba_ctlr *));
+void errinfo __P((int));
+int tmscpcmd __P((int, struct tmscp *, struct tmscpdevice *));
+
+int tmscpopen __P((dev_t, int, int, struct proc *p));
+int tmscpclose __P((dev_t, int, int, struct proc *p));
+void tmscpstrategy __P((struct buf *));
+int tmscpread __P((dev_t, struct uio *));
+int tmscpwrite __P((dev_t, struct uio *));
+int tmscpdump __P((dev_t, daddr_t, caddr_t, size_t));
+int tmscpioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+void tmscpreset __P((int));
/*
* Per drive-unit info
@@ -241,6 +267,10 @@ struct tms_info {
short tms_format; /* the unit's current format (density) */
tpr_t tms_tpr; /* tprintf handle */
} tms_info[NTMS];
+
+void tmserror __P((struct uba_ctlr *, struct mslg *));
+
+
struct uba_ctlr *tmscpminfo[NTMSCP];
struct uba_device *tmsdinfo[NTMS];
/*
@@ -293,7 +323,6 @@ short utoctlr[NTMS]; /* Slave unit to controller mapping */
int tmscperror = 0; /* causes hex dump of packets */
int tmscp_cp_wait = 0; /* Something to wait on for command */
/* packets and or credits. */
-void wakeup();
extern int hz; /* Should find the right include */
#ifdef DEBUG
@@ -302,13 +331,10 @@ int tmscpdebug = 1;
#define printd10 if(tmscpdebug >= 10) printf
#endif
-int tmscpprobe(), tmscpslave(), tmscpattach(), tmscpintr();
-struct mscp *tmscpgetcp();
-
#define DRVNAME "tms"
#define CTRLNAME "tmscp"
-u_short tmscpstd[] = { 0174500, 0 };
+u_short tmscpstd[] = { 0174504, 0 };
struct uba_driver tmscpdriver =
{ tmscpprobe, tmscpslave, tmscpattach, 0, tmscpstd, DRVNAME, tmsdinfo, CTRLNAME
, tmscpminfo, 0};
@@ -320,7 +346,7 @@ struct uba_driver tmscpdriver =
/*************************************************************************/
#define DELAYTEN 1000
-extern struct cfdriver ubacd;
+extern struct cfdriver uba_cd;
/*
* Unfortunately qbgetpri can't be used because the TK50 doesn't flip the
@@ -328,10 +354,12 @@ extern struct cfdriver ubacd;
* has been acknowledged by the cpu. If you are at spl6(), the TMSCP_STEP2
* flag never gets set and you return (0).
*/
-tmscpprobe(reg, ctlr, um)
+int
+tmscpprobe(reg, ctlr, um, uh)
caddr_t reg; /* address of the IP register */
int ctlr; /* index of controller in the tmscp_softc array */
struct uba_ctlr *um;
+ struct uba_softc *uh;
{
/* register int br, cvec; MUST be 1st (r11 & r10): IPL and intr vec */
register struct tmscp_softc *sc = &tmscp_softc[ctlr];
@@ -353,7 +381,7 @@ tmscpprobe(reg, ctlr, um)
* The device is not really initialized at this point, this is just to
* find out if the device exists.
*/
- ubasc = ubacd.cd_devs[0]; /* XXX */
+ ubasc = uba_cd.cd_devs[0]; /* XXX */
sc->sc_ivec = (ubasc->uh_lastiv -= 4);
tmscpaddr->tmscpip = 0;
@@ -391,13 +419,14 @@ tmscpprobe(reg, ctlr, um)
* Try to find a slave (a drive) on the controller.
* If the controller is not in the run state, call init to initialize it.
*/
+int
tmscpslave (ui, reg)
struct uba_device *ui; /* ptr to the uba device structure */
caddr_t reg; /* addr of the device controller */
{
register struct uba_ctlr *um = tmscpminfo[ui->ui_ctlr];
- register struct tmscp_softc *sc = &tmscp_softc[ui->ui_ctlr];
- register struct tms_info *tms = &tms_info[ui->ui_unit];
+ volatile struct tmscp_softc *sc = &tmscp_softc[ui->ui_ctlr];
+ volatile struct tms_info *tms = &tms_info[ui->ui_unit];
volatile struct tmscpdevice *tmscpaddr; /* ptr to IP & SA */
volatile struct mscp *mp;
volatile int i; /* Something to write into to start */
@@ -476,6 +505,7 @@ tmscpslave (ui, reg)
* Unit to Controller mapping is set up here.
* Open routine will issue the online command, later.
*/
+void
tmscpattach (ui)
register struct uba_device *ui; /* ptr to unibus dev struct */
{
@@ -497,7 +527,9 @@ tmscpattach (ui)
/*
* TMSCP interrupt routine.
*/
+void
tmscpintr(d)
+ int d;
{
volatile struct uba_ctlr *um = tmscpminfo[d];
volatile struct tmscpdevice *tmscpaddr =
@@ -704,7 +736,8 @@ tmscpintr(d)
i %= NRSP;
if (tm->tmscp_ca.ca_rspdsc[i]&TMSCP_OWN)
break;
- tmscprsp(um, tm, sc, i);
+ tmscprsp((struct uba_ctlr *)um, tm,
+ (struct tmscp_softc *)sc, i);
tm->tmscp_ca.ca_rspdsc[i] |= TMSCP_OWN;
}
sc->sc_lastrsp = i;
@@ -722,7 +755,7 @@ tmscpintr(d)
}
if(tmscp_cp_wait)
wakeup((caddr_t)&tmscp_cp_wait);
- (void) tmscpstart(um);
+ (void) tmscpstart((struct uba_ctlr *)um);
}
@@ -732,9 +765,11 @@ tmscpintr(d)
*/
/* ARGSUSED */
-tmscpopen(dev, flag)
+int
+tmscpopen(dev, flag, type, p)
dev_t dev;
- int flag;
+ int flag, type;
+ struct proc *p;
{
register int unit;
register struct uba_device *ui;
@@ -854,9 +889,11 @@ tmscpopen(dev, flag)
* command with the CSE modifier.
* Make the tape available to others, by clearing openf flag.
*/
-tmscpclose(dev, flag)
+int
+tmscpclose(dev, flag, type, p)
register dev_t dev;
- register flag;
+ register flag, type;
+ struct proc *p;
{
register struct tms_info *tms;
register struct uba_device *ui;
@@ -868,7 +905,7 @@ tmscpclose(dev, flag)
if(tmscpdebug)DELAY(10000);
# endif
tms = &tms_info[ui->ui_unit];
- if (flag == FWRITE || (flag&FWRITE) && tms->tms_lastiow)
+ if (flag == FWRITE || ((flag&FWRITE) && tms->tms_lastiow))
{
/* device, command, count */
tmscpcommand (dev, TMS_WRITM, 1);
@@ -903,7 +940,7 @@ tmscpclose(dev, flag)
* with the command. The start routine is called by the strategy or the
* interrupt routine.
*/
-
+void
tmscpcommand (dev, com, count)
register dev_t dev;
int com, count;
@@ -1000,6 +1037,7 @@ tmscpgetcp(um)
* initialize data structures, and start hardware
* initialization sequence.
*/
+int
tmscpinit (d)
int d; /* index to the controller */
{
@@ -1053,7 +1091,7 @@ tmscpinit (d)
* Start I/O operation
* This code is convoluted. The majority of it was copied from the uda driver.
*/
-
+void
tmscpstart(um)
register struct uba_ctlr *um;
{
@@ -1349,7 +1387,7 @@ tmscpstart(um)
i %= NRSP;
if (tm->tmscp_ca.ca_rspdsc[i]&TMSCP_OWN)
break;
- tmscprsp(um, tm, sc, i);
+ tmscprsp(um, (struct tmscp *)tm, sc, i);
tm->tmscp_ca.ca_rspdsc[i] |= TMSCP_OWN;
}
sc->sc_lastrsp = i;
@@ -1359,9 +1397,10 @@ tmscpstart(um)
/*
* Process a response packet
*/
+void
tmscprsp(um, tm, sc, i)
register struct uba_ctlr *um;
- register volatile struct tmscp *tm;
+ struct tmscp *tm;
register struct tmscp_softc *sc;
int i;
{
@@ -1459,7 +1498,7 @@ tmscprsp(um, tm, sc, i)
} /* end if st == M_ST_SUCC */
else
{
- if (bp = dp->b_actf)
+ if ((bp = dp->b_actf))
tprintf(tms->tms_tpr,
"tms%d: hard error bn%d: OFFLINE\n",
minor(bp->b_dev)&03, bp->b_blkno);
@@ -1467,7 +1506,7 @@ tmscprsp(um, tm, sc, i)
tprintf(tms->tms_tpr,
"tms%d: hard error: OFFLINE\n",
ui->ui_unit);
- while (bp = dp->b_actf)
+ while ((bp = dp->b_actf))
{
dp->b_actf = bp->b_actf;
bp->b_flags |= B_ERROR;
@@ -1554,7 +1593,7 @@ tmscprsp(um, tm, sc, i)
panic("tmscp: don't work2!");
dp->b_actf = bp->b_actf;
# if defined(VAX750)
- ubasc = ubacd.cd_devs[um->um_ubanum];
+ ubasc = uba_cd.cd_devs[um->um_ubanum];
if (cpunumber == VAX_750) {
if ((tmscpwtab[um->um_ctlr].b_actf == NULL) &&
(um->um_ubinfo != 0)) {
@@ -1657,6 +1696,7 @@ tmscprsp(um, tm, sc, i)
* Give a meaningful error when the mscp_status field returns an error code.
*/
+void
errinfo(st)
int st; /* the status code */
{
@@ -1809,8 +1849,12 @@ tmscpwrite(dev, uio)
struct tmscp tmscpd[NTMSCP];
-tmscpdump(dev)
+int
+tmscpdump(dev, blkno, va, size)
dev_t dev;
+ daddr_t blkno;
+ caddr_t va;
+ size_t size;
{
#ifdef notyet
volatile struct tmscpdevice *tmscpaddr;
@@ -1900,10 +1944,11 @@ tmscpdump(dev)
* Perform a standalone tmscp command. This routine is only used by tmscpdump.
*/
+int
tmscpcmd(op, tmscpp, tmscpaddr)
int op;
- register volatile struct tmscp *tmscpp;
- volatile struct tmscpdevice *tmscpaddr;
+ struct tmscp *tmscpp;
+ struct tmscpdevice *tmscpaddr;
{
volatile int i;
@@ -1942,11 +1987,13 @@ tmscpcmd(op, tmscpp, tmscpaddr)
*/
/* ARGSUSED */
-tmscpioctl(dev, cmd, data, flag)
+int
+tmscpioctl(dev, cmd, data, flag, p)
dev_t dev;
- int cmd;
+ u_long cmd;
caddr_t data;
int flag;
+ struct proc *p;
{
register struct buf *bp = &ctmscpbuf[TMSCPCTLR(dev)];
register callcount; /* number of times to call cmd routine */
@@ -2025,7 +2072,7 @@ tmscpioctl(dev, cmd, data, flag)
/*
* Reset (for raw mode use only).
*/
-
+void
tmscpreset (uban)
int uban;
{
@@ -2085,7 +2132,7 @@ tmscpreset (uban)
* information is printed. Eventually should
* send message to an error logger.
*/
-
+void
tmserror(um, mp)
register struct uba_ctlr *um;
register struct mslg *mp;
@@ -2106,7 +2153,8 @@ tmserror(um, mp)
break;
case M_FM_BUSADDR:
log(TMS_PRI, "host memory access error, event 0%o, addr 0%o\n",
- mp->mslg_event, mp->mslg_unitid & 0xffffffff);
+ mp->mslg_event,
+ (unsigned int)(mp->mslg_unitid & 0xffffffff));
break;
case M_FM_TAPETRN:
log(TMS_PRI, "tape transfer error, unit %d, grp 0x%x, event 0%o\n",
@@ -2140,11 +2188,12 @@ tmserror(um, mp)
register long *p = (long *)mp;
for (i = 0; i < mp->mslg_header.tmscp_msglen; i += sizeof(*p))
- printf("%x ", *p++);
+ printf("%x ", (unsigned int)*p++);
printf("\n");
}
}
+int
tmscp_match(parent, match, aux)
struct device *parent;
void *match, *aux;
diff --git a/sys/arch/vax/uba/ts.c b/sys/arch/vax/uba/ts.c
index 3f5ac796775..c2bb299e6a2 100644
--- a/sys/arch/vax/uba/ts.c
+++ b/sys/arch/vax/uba/ts.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ts.c,v 1.1 1996/01/06 16:43:46 ragge Exp $ */
+/* $NetBSD: ts.c,v 1.6 1996/04/08 18:37:32 ragge Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -61,7 +61,7 @@
* legends may be placed on the drivative work in addition *
* to that set forth above. *
* *
- ************************************************************************
+ ************************************************************************/
/*
* TSV05/TS05 device driver, written by Bertram Barth.
@@ -134,37 +134,41 @@ int tstrace = 1;
#if NTS > 0
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/kernel.h"
-#include "sys/buf.h"
-#include "sys/conf.h"
-#include "sys/errno.h"
-#include "sys/file.h"
-#include "sys/map.h"
-#include "sys/syslog.h"
-#include "sys/ioctl.h"
-#include "sys/mtio.h"
-#include "sys/uio.h"
-#include "sys/proc.h"
-#include "sys/tprintf.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/map.h>
+#include <sys/syslog.h>
+#include <sys/ioctl.h>
+#include <sys/mtio.h>
+#include <sys/uio.h>
+#include <sys/proc.h>
+#include <sys/tprintf.h>
-#include "machine/pte.h"
-#include "machine/sid.h"
-#include "machine/cpu.h"
-#include "machine/mtpr.h"
+#include <machine/pte.h>
+#include <machine/sid.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
-#include "vax/uba/ubareg.h"
-#include "vax/uba/ubavar.h"
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
-#include "tsreg.h"
+#include <vax/uba/tsreg.h>
int ts_match __P((struct device *, void *, void *));
void ts_attach __P((struct device *, struct device *, void *));
void tsstrategy __P((struct buf *));
-struct cfdriver tscd = {
- NULL, "ts", ts_match, ts_attach, DV_DULL, sizeof(struct device)
+struct cfdriver ts_cd = {
+ NULL, "ts", DV_DULL
+};
+
+struct cfattach ts_ca = {
+ sizeof(struct device), ts_match, ts_attach
};
/*
@@ -201,6 +205,27 @@ struct ts_softc {
tpr_t sc_tpr; /* tprintf handle */
} ts_softc[NTS];
+int tsprobe __P((caddr_t, int, struct uba_ctlr *, struct uba_softc *));
+int tsslave __P((struct uba_device *, caddr_t));
+void tsattach __P((struct uba_device *));
+void tsintr __P((int));
+int tsinit __P((int));
+void tscommand __P((dev_t, int, int));
+int tsstatus __P((int));
+int tsexec __P((int, int));
+int tsstart __P((struct uba_ctlr *, struct buf *));
+int tswchar __P((int));
+void tsreset __P((int));
+void tsxstatus __P((struct tsmsg *));
+
+int tsopen __P((dev_t, int, int, struct proc *));
+int tsclose __P((dev_t, int, int, struct proc *));
+int tsioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int tsread __P((dev_t, struct uio *));
+int tswrite __P((dev_t, struct uio *));
+int tsdump __P((dev_t, daddr_t, caddr_t, size_t));
+
+
#define ST_INVALID 0 /* uninitialized, before probe */
#define ST_PROBE 1 /* during tsprobe(), not used */
#define ST_SLAVE 2 /* in tsslave(), init almost complete */
@@ -226,8 +251,6 @@ struct ts_softc {
struct uba_ctlr *zsinfo[NTS]; /* controller-info */
struct uba_device *tsinfo[NTS]; /* unit(tape)-info */
-int tsprobe(), tsslave(), tsattach(), tsdgo(), tsintr();
-
u_short tsstd[] = { 0172520, 0172524, /* standart csr for ts */
0172530, 0172534, 0 }; /* standart csr for ts */
@@ -303,7 +326,6 @@ tsexec (ctlr, cmd)
volatile struct tsdevice *tsreg = ts[ctlr].reg;
volatile char *dbx = ((char*)tsreg) + 3;
volatile short sr;
- char *cmdName;
sc->sc_cmdf |= TS_CF_ACK | TS_CF_IE;
tscmdp->cmdr = sc->sc_cmdf | cmd;
@@ -375,7 +397,7 @@ tsexec (ctlr, cmd)
* This routine sets up a buffer and calls the strategy routine which
* issues the command to the controller.
*/
-int
+void
tscommand (dev, cmd, count)
register dev_t dev;
int cmd;
@@ -445,7 +467,6 @@ tsstart (um, bp)
volatile struct tsdevice *tsreg = ts[um->um_ctlr].reg;
register struct tscmd *tscmdp = &ts[um->um_ctlr].cmd;
register struct buf *dp;
- register struct ts *tp;
volatile int i, itmp;
int unit;
int ioctl;
@@ -577,7 +598,7 @@ tsstart (um, bp)
break;
default:
printf ("%s%d: bad ioctl %d\n",
- CTLRNAME, unit, bp->b_resid);
+ CTLRNAME, unit, (int)bp->b_resid);
/* Need a no-op. get status */
cmd = TS_CMD_STAT;
} /* end switch (bp->b_resid) */
@@ -629,7 +650,6 @@ int
tswchar (ctlr)
int ctlr;
{
- register struct ts_softc *sc = &ts_softc[ctlr];
volatile struct tsdevice *tsregs = ts[ctlr].reg;
volatile struct tscmd *tscmdp = &ts[ctlr].cmd;
volatile struct tsmsg *tsmsgp = &ts[ctlr].msg;
@@ -705,11 +725,10 @@ tswchar (ctlr)
/*
*
*/
-int
-tsreset (ctlr)
+void
+tsreset(ctlr)
int ctlr;
{
- register struct ts_softc *sc = &ts_softc[ctlr];
volatile struct tsdevice *tsreg = ts[ctlr].reg;
volatile unsigned int sr, timeout;
@@ -729,23 +748,24 @@ tsreset (ctlr)
printf ("%s%d: timeout waiting for TS_SSR\n",
CTLRNAME, ctlr);
tsstatus (sr);
- return (-1);
+ return;
}
} while ((sr & TS_SSR) == 0); /* wait until subsystem ready */
tsstatus (sr);
- return (tswchar (ctlr));
+ return;
}
-extern struct cfdriver ubacd;
+extern struct cfdriver uba_cd;
/*
* probe for device. If found, try to raise an interrupt.
*/
int
-tsprobe (reg, ctlr, um)
+tsprobe (reg, ctlr, um, uh)
caddr_t reg; /* address of TSDB register */
int ctlr; /* index of the controller */
struct uba_ctlr *um; /* controller-info */
+ struct uba_softc *uh;
{
register struct ts_softc *sc;
register struct tsdevice *tsregs = (struct tsdevice*) reg;
@@ -768,7 +788,7 @@ tsprobe (reg, ctlr, um)
* The device is not really initialized at this point, this is just to
* find out if the device exists.
*/
- ubasc = ubacd.cd_devs[0]; /* XXX */
+ ubasc = uba_cd.cd_devs[0]; /* XXX */
sc->sc_ivec = (ubasc->uh_lastiv -= 4);
count = 0;
@@ -851,37 +871,35 @@ tsslave (ui, reg)
* Open routine will issue the online command, later.
* Just reset the flags and do nothing ...
*/
-int
+void
tsattach (ui)
- register struct uba_device *ui;
+ struct uba_device *ui;
{
trace (("\ntsattach (%x)", ui));
ui->ui_flags = 0; /* mark unit offline */
- return (0);
}
/*
* TSV05/TS05 interrupt routine
*/
-int
+void
tsintr(ctlr)
+ int ctlr;
{
register struct ts_softc *sc = &ts_softc[ctlr];
register struct tsmsg *tsmsgp = &ts[ctlr].msg;
register struct tscmd *tscmdp = &ts[ctlr].cmd;
volatile struct tsdevice *tsreg = ts[ctlr].reg;
- volatile struct uba_ctlr *um = zsinfo[ctlr];
+ struct uba_ctlr *um = zsinfo[ctlr];
register struct buf *bp;
unsigned short sr = tsreg->tssr; /* save TSSR */
unsigned short mh = tsmsgp->hdr; /* and msg-header */
/* clear the message header ??? */
- short cmode = tscmdp->cmdr & TS_CF_CMODE;
short ccode = tscmdp->cmdr & TS_CF_CCODE;
short cmask = tscmdp->cmdr & TS_CF_CMASK;
- short error = 0;
#ifdef DEBUG
printf ("TSSR: %b, MSG: %x ", sr, TS_TSSR_BITS, mh);
@@ -1165,9 +1183,10 @@ tsintr(ctlr)
* in the run state, call init to initialize the ts controller first.
*/
int
-tsopen (dev, flag)
+tsopen (dev, flag, type, p)
dev_t dev;
- int flag;
+ int flag, type;
+ struct proc *p;
{
register struct uba_device *ui;
register struct uba_ctlr *um;
@@ -1226,15 +1245,16 @@ tsopen (dev, flag)
* Make the tape available to others, by clearing openf flag.
*/
int
-tsclose (dev, flag)
+tsclose (dev, flag, type, p)
dev_t dev;
- int flag;
+ int flag, type;
+ struct proc *p;
{
register struct ts_softc *sc = &ts_softc[TS_UNIT(dev)];
trace (("tsclose (%x, %d)\n", dev, flag));
- if (flag == FWRITE || (flag & FWRITE) && sc->sc_liowf) {
+ if (flag == FWRITE || ((flag & FWRITE) && sc->sc_liowf)) {
debug (("tsclose: writing eot\n"));
/*
* We are writing two tape marks (EOT), but place the tape
@@ -1267,8 +1287,6 @@ tsstrategy (bp)
{
register struct uba_device *ui;
register struct uba_ctlr *um;
- register struct buf *dp;
- register int ctlr = TS_CTLR(bp->b_dev);
register int unit = TS_UNIT(bp->b_dev);
int s;
@@ -1319,14 +1337,14 @@ tsstrategy (bp)
* Catch ioctl commands, and call the "command" routine to do them.
*/
int
-tsioctl (dev, cmd, data, flag)
+tsioctl (dev, cmd, data, flag, p)
dev_t dev;
- int cmd;
+ u_long cmd;
caddr_t data;
int flag;
+ struct proc *p;
{
register struct buf *bp = &ts_cbuf[TS_UNIT(dev)];
- register struct uba_device *ui;
register struct ts_softc *sc;
register struct mtop *mtop; /* mag tape cmd op to perform */
register struct mtget *mtget; /* mag tape struct to get info in */
@@ -1447,10 +1465,14 @@ tswrite (dev, uio)
*
*/
int
-tsdump (dev)
+tsdump(dev, blkno, va, size)
dev_t dev;
+ daddr_t blkno;
+ caddr_t va;
+ size_t size;
{
trace (("tsdump (%x)\n", dev));
+ return 0;
}
/*----------------------------------------------------------------------*/
@@ -1489,7 +1511,7 @@ tsstatus (sr)
return (0);
}
-int
+void
tsxstatus (mp)
struct tsmsg *mp;
{
diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c
index 999fb900183..7444fc60d88 100644
--- a/sys/arch/vax/uba/uba.c
+++ b/sys/arch/vax/uba/uba.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uba.c,v 1.12 1995/12/28 19:17:07 thorpej Exp $ */
+/* $NetBSD: uba.c,v 1.22 1996/04/08 18:37:34 ragge Exp $ */
/*
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -37,34 +37,34 @@
* @(#)autoconf.c 7.20 (Berkeley) 5/9/91
*/
-#include "sys/param.h"
-#include "sys/types.h"
-#include "sys/time.h"
-#include "sys/systm.h"
-#include "sys/map.h"
-#include "sys/buf.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/conf.h"
-#include "sys/dkstat.h"
-#include "sys/kernel.h"
-#include "sys/malloc.h"
-#include "sys/device.h"
-
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
-
-#include "machine/pte.h"
-#include "machine/cpu.h"
-#include "machine/mtpr.h"
-#include "machine/nexus.h"
-#include "machine/sid.h"
-#include "machine/scb.h"
-#include "machine/trap.h"
-#include "machine/frame.h"
-
-#include "ubareg.h"
-#include "ubavar.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/systm.h>
+#include <sys/map.h>
+#include <sys/buf.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/conf.h>
+#include <sys/dkstat.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+
+#include <machine/pte.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/nexus.h>
+#include <machine/sid.h>
+#include <machine/scb.h>
+#include <machine/trap.h>
+#include <machine/frame.h>
+
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
extern int cold;
@@ -74,60 +74,55 @@ int uba_match __P((struct device *, void *, void *));
void uba_attach __P((struct device *, struct device *, void *));
void ubascan __P((struct device *, void *));
int ubaprint __P((void *, char *));
-
-struct cfdriver ubacd = {
- NULL, "uba", uba_match, uba_attach, DV_DULL,
- sizeof(struct uba_softc), 1
+void uba_dw780int __P((int));
+void ubaerror __P((int, struct uba_softc *, int *, int *,
+ struct uba_regs *));
+void ubainit __P((struct uba_softc *));
+void ubastray __P((int));
+void unifind __P((struct uba_softc *, caddr_t));
+void ubapurge __P((struct uba_ctlr *));
+void ubainitmaps __P((struct uba_softc *));
+int qbgetpri __P((void));
+int ubamem __P((int, int, int, int));
+void uba_dw780int __P((int));
+
+
+struct cfdriver uba_cd = {
+ NULL, "uba", DV_DULL, 1
};
+struct cfattach uba_ca = {
+ sizeof(struct uba_softc), uba_match, uba_attach
+};
-#ifdef 0
-/*
- * Mark addresses starting at "addr" and continuing
- * "size" bytes as allocated in the map "ualloc".
- * Warn if the new allocation overlaps a previous allocation.
- */
-static
-csralloc(ualloc, addr, size)
- caddr_t ualloc;
- u_short addr;
- register int size;
-{
- register caddr_t p;
- int warned = 0;
-
- p = &ualloc[ubdevreg(addr+size)];
- while (--size >= 0) {
- if (*--p && !warned) {
- printf(
- "WARNING: device registers overlap those for a previous device!\n");
- warned = 1;
- }
- *p = 1;
- }
-}
-#endif
/*
- * Stray interrupt vector handler, used when nowhere else to
- * go to.
+ * Stray interrupt vector handler, used when nowhere else to go to.
*/
void
ubastray(arg)
int arg;
{
struct callsframe *cf = FRAMEOFFSET(arg);
- struct uba_softc *sc = ubacd.cd_devs[arg];
+ struct uba_softc *sc = uba_cd.cd_devs[arg];
+ struct uba_regs *ur = sc->uh_uba;
int vektor;
- vektor = (cf->ca_pc - (unsigned)&sc->uh_idsp[0]) >> 4;
+ rbr = mfpr(PR_IPL);
+#ifdef DW780
+ if (sc->uh_type == DW780)
+ vektor = ur->uba_brrvr[rbr - 0x14] >> 2;
+ else
+#endif
+ vektor = (cf->ca_pc - (unsigned)&sc->uh_idsp[0]) >> 4;
- if(cold){
- rbr = mfpr(PR_IPL);
- rcvec = vektor;
- } else {
- printf("uba%d: unexpected interrupt, vector %o, level %d",
- arg, vektor << 2, mfpr(PR_IPL));
- }
+ if (cold) {
+#ifdef DW780
+ if (sc->uh_type != DW780)
+#endif
+ rcvec = vektor;
+ } else
+ printf("uba%d: unexpected interrupt, vector %o, br %d\n",
+ arg, vektor << 2, rbr - 20);
}
/*
@@ -136,7 +131,7 @@ ubastray(arg)
* and then fills in the tables, with help from a per-driver
* slave initialization routine.
*/
-
+void
unifind(uhp0, pumem)
struct uba_softc *uhp0;
caddr_t pumem;
@@ -144,75 +139,12 @@ unifind(uhp0, pumem)
register struct uba_device *ui;
register struct uba_ctlr *um;
register struct uba_softc *uhp = uhp0;
+ volatile struct uba_regs *ubar = uhp->uh_uba;
u_short *reg, *ap, addr;
struct uba_driver *udp;
int i;
- caddr_t ualloc;
- volatile extern int br, cvec;
volatile extern int rbr, rcvec;
-#if DW780 || DWBUA
- struct uba_regs *vubp = uhp->uh_uba;
-#endif
-#if 0
- /*
- * Initialize the UNIBUS, by freeing the map
- * registers and the buffered data path registers
- */
- uhp->uh_map = (struct map *)
- malloc((u_long)(UAMSIZ * sizeof (struct map)), M_DEVBUF,
- M_NOWAIT);
- if (uhp->uh_map == 0)
- panic("no mem for unibus map");
- bzero((caddr_t)uhp->uh_map, (unsigned)(UAMSIZ * sizeof (struct map)));
- ubainitmaps(uhp);
- /*
- * Set last free interrupt vector for devices with
- * programmable interrupt vectors. Use is to decrement
- * this number and use result as interrupt vector.
- */
- uhp->uh_lastiv = 0x200;
-
-#ifdef DWBUA
- if (uhp->uh_type == DWBUA)
- BUA(vubp)->bua_offset = (int)uhp->uh_vec - (int)&scb[0];
-#endif
-
-#ifdef DW780
- if (uhp->uh_type == DW780) {
- vubp->uba_sr = vubp->uba_sr;
- vubp->uba_cr = UBACR_IFS|UBACR_BRIE;
- }
-#endif
- /*
- * First configure devices that have unibus memory,
- * allowing them to allocate the correct map registers.
- */
- ubameminit(uhp->uh_dev.dv_unit);
- /*
- * Grab some memory to record the umem address space we allocate,
- * so we can be sure not to place two devices at the same address.
- *
- * We could use just 1/8 of this (we only want a 1 bit flag) but
- * we are going to give it back anyway, and that would make the
- * code here bigger (which we can't give back), so ...
- *
- * One day, someone will make a unibus with something other than
- * an 8K i/o address space, & screw this totally.
- */
- ualloc = (caddr_t)malloc((u_long)(8 * 1024), M_TEMP, M_NOWAIT);
- if (ualloc == (caddr_t)0)
- panic("no mem for unifind");
- bzero(ualloc, 8*1024);
-
- /*
- * Map the first page of UNIBUS i/o
- * space to the first page of memory
- * for devices which will need to dma
- * output to produce an interrupt.
- */
- *(int *)(&uhp->uh_mr[0]) = UBAMR_MRV;
-#endif
#define ubaddr(uhp, off) (u_short *)((int)(uhp)->uh_iopage + ubdevreg(off))
/*
* Check each unibus mass storage controller.
@@ -220,9 +152,9 @@ unifind(uhp0, pumem)
* see if it is really there, and if it is record it and
* then go looking for slaves.
*/
- for (um = ubminit; udp = um->um_driver; um++) {
- if (um->um_ubanum != uhp->uh_dev.dv_unit &&
- um->um_ubanum != '?' || um->um_alive)
+ for (um = ubminit; (udp = um->um_driver); um++) {
+ if ((um->um_ubanum != uhp->uh_dev.dv_unit &&
+ um->um_ubanum != '?') || um->um_alive)
continue;
addr = (u_short)(u_long)um->um_addr;
/*
@@ -232,26 +164,21 @@ unifind(uhp0, pumem)
* in the driver til we find it
*/
for (ap = udp->ud_addr; addr || (addr = *ap++); addr = 0) {
-#if 0
- if (ualloc[ubdevreg(addr)])
- continue;
-#endif
reg = ubaddr(uhp, addr);
-
if (badaddr((caddr_t)reg, 2))
continue;
-#ifdef DW780
- if (uhp->uh_type == DW780 && vubp->uba_sr) {
- vubp->uba_sr = vubp->uba_sr;
+#if DW780
+ if (uhp->uh_type == DW780 && ubar->uba_sr) {
+ ubar->uba_sr = ubar->uba_sr;
continue;
}
#endif
rcvec = 0x200;
- i = (*udp->ud_probe)(reg, um->um_ctlr, um);
-#ifdef DW780
- if (uhp->uh_type == DW780 && vubp->uba_sr) {
- vubp->uba_sr = vubp->uba_sr;
+ i = (*udp->ud_probe)((caddr_t)reg, um->um_ctlr, um, uhp);
+#if DW780
+ if (uhp->uh_type == DW780 && ubar->uba_sr) {
+ ubar->uba_sr = ubar->uba_sr;
continue;
}
#endif
@@ -268,9 +195,6 @@ unifind(uhp0, pumem)
continue;
}
printf("vec %o, ipl %x\n", rcvec << 2, rbr);
-#if 0
- csralloc(ualloc, addr, i);
-#endif
um->um_alive = 1;
um->um_ubanum = uhp->uh_dev.dv_unit;
um->um_hd = uhp;
@@ -282,13 +206,13 @@ unifind(uhp0, pumem)
int t;
if (ui->ui_driver != udp || ui->ui_alive ||
- ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' ||
- ui->ui_ubanum != uhp->uh_dev.dv_unit &&
- ui->ui_ubanum != '?')
+ (ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?') ||
+ (ui->ui_ubanum != uhp->uh_dev.dv_unit &&
+ ui->ui_ubanum != '?'))
continue;
t = ui->ui_ctlr;
ui->ui_ctlr = um->um_ctlr;
- if ((*udp->ud_slave)(ui, reg) == 0)
+ if ((*udp->ud_slave)(ui, (caddr_t)reg) == 0)
ui->ui_ctlr = t;
else {
ui->ui_alive = 1;
@@ -313,9 +237,6 @@ unifind(uhp0, pumem)
break;
}
}
-#if 0
- free(ualloc, M_TEMP);
-#endif
}
@@ -341,6 +262,7 @@ char ubasr_bits[] = UBASR_BITS;
* to the controller, unless it is zero, indicating that the controller
* does not now have a BDP.
*/
+int
ubaqueue(ui, onq)
register struct uba_device *ui;
int onq;
@@ -350,13 +272,13 @@ ubaqueue(ui, onq)
register struct uba_driver *ud;
register int s, unit;
- uh = ubacd.cd_devs[um->um_ubanum];
+ uh = uba_cd.cd_devs[um->um_ubanum];
ud = um->um_driver;
s = spluba();
/*
* Honor exclusive BDP use requests.
*/
- if (ud->ud_xclu && uh->uh_users > 0 || uh->uh_xclu)
+ if ((ud->ud_xclu && uh->uh_users > 0) || uh->uh_xclu)
goto rwait;
if (ud->ud_keepbdp) {
/*
@@ -405,10 +327,11 @@ rwait:
return (0);
}
+void
ubadone(um)
struct uba_ctlr *um;
{
- struct uba_softc *uh = ubacd.cd_devs[um->um_ubanum];
+ struct uba_softc *uh = uba_cd.cd_devs[um->um_ubanum];
if (um->um_driver->ud_xclu)
uh->uh_xclu = 0;
@@ -425,11 +348,12 @@ ubadone(um)
* Return value encodes map register plus page offset,
* bdp number and number of map registers.
*/
+int
ubasetup(uban, bp, flags)
struct buf *bp;
int uban, flags;
{
- struct uba_softc *uh = ubacd.cd_devs[uban];
+ struct uba_softc *uh = uba_cd.cd_devs[uban];
struct pte *pte, *io;
int npf;
int pfnum, temp;
@@ -491,7 +415,8 @@ ubasetup(uban, bp, flags)
if ((bp->b_flags & B_PHYS) == 0)
pte = (struct pte *)kvtopte(bp->b_un.b_addr);
else {
- u_int *hej, i;
+ struct pte *hej;
+ int i;
rp = bp->b_proc;
v = btop((u_int)bp->b_un.b_addr&0x3fffffff);
@@ -506,7 +431,7 @@ ubasetup(uban, bp, flags)
else
hej = rp->p_vmspace->vm_pmap.pm_pcb->P1BR;
- pte = (struct pte *)&hej[v];
+ pte = &hej[v];
for (i = 0; i < (npf - 1); i++) {
if ((pte + i)->pg_pfn == 0) {
int rv;
@@ -534,6 +459,7 @@ ubasetup(uban, bp, flags)
/*
* Non buffer setup interface... set up a buffer and call ubasetup.
*/
+int
uballoc(uban, addr, bcnt, flags)
caddr_t addr;
int uban, bcnt, flags;
@@ -552,10 +478,11 @@ uballoc(uban, addr, bcnt, flags)
* The map register parameter is by value since we need to block
* against uba resets on 11/780's.
*/
+void
ubarelse(uban, amr)
int uban, *amr;
{
- register struct uba_softc *uh = ubacd.cd_devs[uban];
+ register struct uba_softc *uh = uba_cd.cd_devs[uban];
register int bdp, reg, npf, s;
int mr;
@@ -583,7 +510,6 @@ ubarelse(uban, amr)
break;
#endif
#ifdef DW780
-sdjhfgsadjkfhgasj
case DW780:
uh->uh_uba->uba_dpr[bdp] |= UBADPR_BNE;
break;
@@ -627,6 +553,7 @@ sdjhfgsadjkfhgasj
;
}
+void
ubapurge(um)
register struct uba_ctlr *um;
{
@@ -654,6 +581,7 @@ ubapurge(um)
}
}
+void
ubainitmaps(uhp)
register struct uba_softc *uhp;
{
@@ -684,15 +612,15 @@ ubainitmaps(uhp)
/*
* Generate a reset on uba number uban. Then
- * call each device in the character device table,
+ * call each device that asked to be called during attach,
* giving it a chance to clean up so as to be able to continue.
*/
+void
ubareset(uban)
int uban;
{
- register struct cdevsw *cdp;
- register struct uba_softc *uh = ubacd.cd_devs[uban];
- int s;
+ register struct uba_softc *uh = uba_cd.cd_devs[uban];
+ int s, i;
s = spluba();
uh->uh_users = 0;
@@ -704,39 +632,26 @@ ubareset(uban)
ubainitmaps(uh);
wakeup((caddr_t)&uh->uh_bdpwant);
wakeup((caddr_t)&uh->uh_mrwant);
- printf("uba%d: reset", uban);
+ printf("%s: reset", uh->uh_dev.dv_xname);
ubainit(uh);
#ifdef notyet
ubameminit(uban);
#endif
- /* XXX - ???
- * Intressant, vi m}ste l|sa det h{r med ubareset() p} n}t smart
- * s{tt. En l{nkad lista som s{tts upp vid autoconfiggen? Kanske.
- * N{r anv{nds dom? Jag vet faktiskt inte; det verkar vara en
- * ren sm|rja den gamla koden. F}r peturba lite mer docs...
- * 950428/Ragge
- */
- udareset(0); /* XXX */
-/* for (cdp = cdevsw; cdp < cdevsw + nchrdev; cdp++)
- (*cdp->d_reset)(uban);
- ifubareset(uban);
- */
+ for (i = 0; i < uh->uh_resno; i++)
+ (*uh->uh_reset[i])(uh->uh_resarg[i]);
printf("\n");
splx(s);
}
/*
- * Init a uba. This is called with a pointer
- * rather than a virtual address since it is called
- * by code which runs with memory mapping disabled.
- * In these cases we really don't need the interrupts
- * enabled, but since we run with ipl high, we don't care
- * if they are, they will never happen anyways.
+ * Init a uba.
*/
void
ubainit(uhp)
struct uba_softc *uhp;
{
+ volatile struct uba_regs *ur = uhp->uh_uba;
+
switch (uhp->uh_type) {
#ifdef DWBUA
case DWBUA:
@@ -745,11 +660,11 @@ ubainit(uhp)
DELAY(500000);
break;
#endif
-#ifdef DW780
+#if DW780
case DW780:
- uba->uba_cr = UBACR_ADINIT;
- uba->uba_cr = UBACR_IFS|UBACR_BRIE|UBACR_USEFIE|UBACR_SUEFIE;
- while ((uba->uba_cnfgr & UBACNFGR_UBIC) == 0)
+ ur->uba_cr = UBACR_ADINIT;
+ ur->uba_cr = UBACR_IFS|UBACR_BRIE|UBACR_USEFIE|UBACR_SUEFIE;
+ while ((ur->uba_cnfgr & UBACNFGR_UBIC) == 0)
;
break;
#endif
@@ -791,13 +706,14 @@ ubainit(uhp)
* delaying as necessary, then call this routine
* before resetting the device.
*/
+int
qbgetpri()
{
+#ifdef notyet
int pri;
extern int cvec;
panic("qbgetpri");
-#if 0
for (pri = 0x17; pri > 0x14; ) {
if (cvec && cvec != 0x200) /* interrupted at pri */
break;
@@ -806,6 +722,8 @@ qbgetpri()
}
(void) spl0();
return (pri);
+#else
+ return 0x17;
#endif
}
#endif
@@ -823,15 +741,16 @@ int zvcnt_max = 5000; /* in 8 sec */
* It must not be declared register.
*/
/*ARGSUSED*/
+void
ubaerror(uban, uh, ipl, uvec, uba)
register int uban;
register struct uba_softc *uh;
- int ipl, uvec;
+ int *ipl, *uvec;
register struct uba_regs *uba;
{
register sr, s;
- if (uvec == 0) {
+ if (*uvec == 0) {
/*
* Declare dt as unsigned so that negative values
* are handled as >8 below, in case time was set back.
@@ -845,9 +764,9 @@ ubaerror(uban, uh, ipl, uvec, uba)
}
if (++uh->uh_zvcnt > zvcnt_max) {
printf("uba%d: too many zero vectors (%d in <%d sec)\n",
- uban, uh->uh_zvcnt, dt + 1);
+ uban, uh->uh_zvcnt, (int)dt + 1);
printf("\tIPL 0x%x\n\tcnfgr: %b Adapter Code: 0x%x\n",
- ipl, uba->uba_cnfgr&(~0xff), UBACNFGR_BITS,
+ *ipl, uba->uba_cnfgr&(~0xff), UBACNFGR_BITS,
uba->uba_cnfgr&0xff);
printf("\tsr: %b\n\tdcr: %x (MIC %sOK)\n",
uba->uba_sr, ubasr_bits, uba->uba_dcr,
@@ -861,7 +780,7 @@ ubaerror(uban, uh, ipl, uvec, uba)
uban, uba->uba_sr, ubasr_bits,
uba->uba_cnfgr, NEXFLT_BITS);
ubareset(uban);
- uvec = 0;
+ *uvec = 0;
return;
}
sr = uba->uba_sr;
@@ -870,13 +789,13 @@ ubaerror(uban, uh, ipl, uvec, uba)
uban, uba->uba_sr, ubasr_bits, uba->uba_fmer, 4*uba->uba_fubar);
splx(s);
uba->uba_sr = sr;
- uvec &= UBABRRVR_DIV;
+ *uvec &= UBABRRVR_DIV;
if (++uh->uh_errcnt % ubawedgecnt == 0) {
if (uh->uh_errcnt > ubacrazy)
panic("uba crazy");
printf("ERROR LIMIT ");
ubareset(uban);
- uvec = 0;
+ *uvec = 0;
return;
}
return;
@@ -894,7 +813,7 @@ ubaerror(uban, uh, ipl, uvec, uba)
ubameminit(uban)
{
register struct uba_device *ui;
- register struct uba_softc *uh = ubacd.cd_devs[uban];
+ register struct uba_softc *uh = uba_cd.cd_devs[uban];
caddr_t umembase, addr;
#define ubaoff(off) ((int)(off) & 0x1fff)
@@ -938,11 +857,6 @@ jdhfgsjdkfhgsdjkfghak
}
#endif
-rmget(){
- showstate(curproc);
- panic("rmget() not implemented. (in uba.c)");
-}
-
/*
* Allocate UNIBUS memory. Allocates and initializes
* sufficient mapping registers for access. On a 780,
@@ -954,17 +868,19 @@ rmget(){
* the last unibus memory would free unusable map registers.
* Doalloc is 1 to allocate, 0 to deallocate.
*/
+int
ubamem(uban, addr, npg, doalloc)
int uban, addr, npg, doalloc;
{
- register struct uba_softc *uh = ubacd.cd_devs[uban];
+ register struct uba_softc *uh = uba_cd.cd_devs[uban];
register int a;
int s;
a = (addr >> 9) + 1;
s = spluba();
if (doalloc)
- a = rmget(uh->uh_map, npg, a);
+ panic("uba: rmget");
+/* a = rmget(uh->uh_map, npg, a); */
else
rmfree(uh->uh_map, (long)npg, (long)a);
splx(s);
@@ -1020,12 +936,36 @@ unmaptouser(vaddress)
}
#endif
-resuba()
+#ifdef DW780
+void
+uba_dw780int(uba)
+ int uba;
{
- showstate(curproc);
- panic("resuba");
+ int br, svec, vec, arg;
+ struct uba_softc *sc = uba_cd.cd_devs[uba];
+ struct uba_regs *ur = sc->uh_uba;
+ void (*func) __P((int));
+
+ br = mfpr(PR_IPL);
+ svec = ur->uba_brrvr[br - 0x14];
+ if (svec < 0) {
+ ubaerror(uba, sc, &br, &svec, ur);
+ if (svec == 0)
+ return;
+ }
+ vec = svec >> 2;
+ if (cold)
+ rcvec = vec;
+ func = sc->uh_idsp[vec].hoppaddr;
+ arg = sc->uh_idsp[vec].pushlarg;
+ (*func)(arg);
}
+#endif
+/*
+ * The match routine checks which UBA adapter number it is, to
+ * be sure to use correct interrupt vectors.
+ */
int
uba_match(parent, vcf, aux)
struct device *parent;
@@ -1057,6 +997,12 @@ uba_match(parent, vcf, aux)
return 1;
}
+/*
+ * The attach routines:
+ * Allocates interrupt vectors.
+ * Puts correct (cpu-specific) addresses in uba_softc.
+ * Calls the scan routine to search for uba devices.
+ */
void
uba_attach(parent, self, aux)
struct device *parent, *self;
@@ -1066,10 +1012,7 @@ uba_attach(parent, self, aux)
struct uba_regs *ubar = (struct uba_regs *)sa->nexaddr;
struct uba_softc *sc = (struct uba_softc *)self;
vm_offset_t min, max, ubaphys, ubaiophys;
-#if DW780 || DWBUA
- struct uba_regs *vubp = sc->uh_uba;
-#endif
- void ubascan();
+ extern struct ivec_dsp idsptch;
printf("\n");
/*
@@ -1084,13 +1027,13 @@ uba_attach(parent, self, aux)
sc->uh_memsize = UBAPAGES;
sc->uh_iopage = (void *)min + (sc->uh_memsize * NBPG);
sc->uh_iarea = (void *)scb + NBPG + sa->nexinfo * NBPG;
+ sc->uh_resno = 0;
/*
* Create interrupt dispatchers for this uba.
*/
#define NO_IVEC 128
{
vm_offset_t iarea;
- extern struct ivec_dsp idsptch;
int i;
iarea = kmem_alloc(kernel_map,
@@ -1100,13 +1043,34 @@ uba_attach(parent, self, aux)
for (i = 0; i < NO_IVEC; i++) {
bcopy(&idsptch, &sc->uh_idsp[i],
sizeof(struct ivec_dsp));
- sc->uh_idsp[i].pushlarg = sa->nexinfo;
+ sc->uh_idsp[i].pushlarg = sc->uh_dev.dv_unit;
sc->uh_idsp[i].hoppaddr = ubastray;
sc->uh_iarea[i] = (unsigned int)&sc->uh_idsp[i];
}
}
switch (cpunumber) {
+#if VAX780 || VAX8600
+ case VAX_780:
+ case VAX_8600:
+ sc->uh_mr = (void *)ubar->uba_map;
+ sc->uh_type = DW780;
+ sc->uh_physuba = (struct uba_regs *)kvtophys(sa->nexaddr);
+ if (parent->dv_unit == 0) {
+ ubaphys = UMEMA8600(sa->nexinfo);
+ ubaiophys = UMEMA8600(sa->nexinfo) + (UBAPAGES * NBPG);
+ } else {
+ ubaphys = UMEMB8600(sa->nexinfo);
+ ubaiophys = UMEMB8600(sa->nexinfo) + (UBAPAGES * NBPG);
+ }
+ bcopy(&idsptch, &sc->uh_dw780, sizeof(struct ivec_dsp));
+ sc->uh_dw780.pushlarg = sc->uh_dev.dv_unit;
+ sc->uh_dw780.hoppaddr = uba_dw780int;
+ scb->scb_nexvec[0][sa->nexnum] = scb->scb_nexvec[1][sa->nexnum]
+ = scb->scb_nexvec[2][sa->nexnum]
+ = scb->scb_nexvec[3][sa->nexnum] = &sc->uh_dw780;
+ break;
+#endif
#if VAX750
case VAX_750:
sc->uh_mr = (void *)ubar->uba_map;
@@ -1128,6 +1092,9 @@ uba_attach(parent, self, aux)
ubaiophys = QIOPAGE630;
break;
#endif
+ default:
+ ubaphys = QMEM630;
+ ubaiophys = QIOPAGE630;
};
break;
#endif
@@ -1140,6 +1107,9 @@ uba_attach(parent, self, aux)
ubaiophys = QIOPAGE630; /* XXX */
break;
#endif
+ default:
+ printf("Bad luck, this cputype does not support UBA's\n");
+ return;
};
/*
* Map uba space in kernel virtual; especially i/o space.
@@ -1170,14 +1140,14 @@ uba_attach(parent, self, aux)
sc->uh_lastiv = 0x200;
#ifdef DWBUA
- if (uhp->uh_type == DWBUA)
- BUA(vubp)->bua_offset = (int)uhp->uh_vec - (int)&scb[0];
+ if (sc->uh_type == DWBUA)
+ BUA(ubar)->bua_offset = (int)sc->uh_vec - (int)&scb[0];
#endif
#ifdef DW780
- if (uhp->uh_type == DW780) {
- vubp->uba_sr = vubp->uba_sr;
- vubp->uba_cr = UBACR_IFS|UBACR_BRIE;
+ if (sc->uh_type == DW780) {
+ ubar->uba_sr = ubar->uba_sr;
+ ubar->uba_cr = UBACR_IFS|UBACR_BRIE;
}
#endif
#ifdef notyet
@@ -1197,14 +1167,14 @@ uba_attach(parent, self, aux)
/*
* Now start searching for devices.
*/
- unifind(sc, ubaiophys); /* Some devices are not yet converted */
+ unifind(sc, (caddr_t)ubaiophys);/* Some devices are not yet converted */
config_scan(ubascan,self);
#ifdef DW780
- if (uhp->uh_type == DW780)
- uhp->uh_uba->uba_cr = UBACR_IFS | UBACR_BRIE |
+ if (sc->uh_type == DW780)
+ ubar->uba_cr = UBACR_IFS | UBACR_BRIE |
UBACR_USEFIE | UBACR_SUEFIE |
- (uhp->uh_uba->uba_cr & 0x7c000000);
+ (ubar->uba_cr & 0x7c000000);
#endif
}
@@ -1217,27 +1187,29 @@ ubascan(parent, match)
struct device *dev = match;
struct cfdata *cf = dev->dv_cfdata;
struct uba_softc *sc = (struct uba_softc *)parent;
+ volatile struct uba_regs *ubar = sc->uh_uba;
struct uba_attach_args ua;
int i;
ua.ua_addr = (caddr_t)ubaddr(sc, cf->cf_loc[0]);
+ ua.ua_reset = NULL;
if (badaddr(ua.ua_addr, 2))
goto forgetit;
#ifdef DW780
- if (uhp->uh_type == DW780 && vubp->uba_sr) {
- vubp->uba_sr = vubp->uba_sr;
- continue;
+ if (sc->uh_type == DW780 && ubar->uba_sr) {
+ ubar->uba_sr = ubar->uba_sr;
+ goto forgetit;
}
#endif
rcvec = 0x200;
- i = (*cf->cf_driver->cd_match) (parent, dev, &ua);
+ i = (*cf->cf_attach->ca_match) (parent, dev, &ua);
#ifdef DW780
- if (uhp->uh_type == DW780 && vubp->uba_sr) {
- vubp->uba_sr = vubp->uba_sr;
- continue;
+ if (sc->uh_type == DW780 && ubar->uba_sr) {
+ ubar->uba_sr = ubar->uba_sr;
+ goto forgetit;
}
#endif
if (i == 0)
@@ -1247,7 +1219,15 @@ ubascan(parent, match)
goto fail;
sc->uh_idsp[rcvec].hoppaddr = ua.ua_ivec;
- sc->uh_idsp[rcvec].pushlarg = ua.ua_iarg;
+ sc->uh_idsp[rcvec].pushlarg = dev->dv_unit;
+ if (ua.ua_reset) { /* device wants ubaeset */
+ if (sc->uh_resno == 0) {
+ sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT);
+ sc->uh_resarg = malloc(256, M_DEVBUF, M_NOWAIT);
+ }
+ sc->uh_resarg[sc->uh_resno] = dev->dv_unit;
+ sc->uh_reset[sc->uh_resno++] = ua.ua_reset;
+ }
ua.ua_br = rbr;
ua.ua_cvec = rcvec;
ua.ua_iaddr = dev->dv_cfdata->cf_loc[0];
@@ -1257,13 +1237,33 @@ ubascan(parent, match)
fail:
printf("%s at %s csr %o %s\n", dev->dv_cfdata->cf_driver->cd_name,
- parent->dv_xname, dev->dv_cfdata->cf_loc[0] << 2,
+ parent->dv_xname, dev->dv_cfdata->cf_loc[0],
rcvec ? "didn't interrupt\n" : "zero vector\n");
forgetit:
free(dev, M_DEVBUF);
}
+/*
+ * Called when a device needs more than one interrupt vector.
+ * (Like DHU11, DMF32). Argument is the device's softc, vector
+ * number and a function pointer to the interrupt catcher.
+ */
+void
+ubasetvec(dev, vec, func)
+ struct device *dev;
+ int vec;
+ void (*func) __P((int));
+{
+ struct uba_softc *sc = (void *)dev->dv_parent;
+
+ sc->uh_idsp[vec].hoppaddr = func;
+ sc->uh_idsp[vec].pushlarg = dev->dv_unit;
+}
+
+/*
+ * Print out some interesting info common to all unibus devices.
+ */
int
ubaprint(aux, uba)
void *aux;
diff --git a/sys/arch/vax/uba/ubareg.h b/sys/arch/vax/uba/ubareg.h
index f654615f127..be7dd1ab475 100644
--- a/sys/arch/vax/uba/ubareg.h
+++ b/sys/arch/vax/uba/ubareg.h
@@ -223,7 +223,7 @@ struct uba_regs {
#define UBADPR_BS 0x007f0000 /* buffer state field */
#define UBADPR_BUBA 0x0000ffff /* buffered UNIBUS address */
#define UBA_PURGE780(uba, bdp) \
- ((uba)->uba_dpr[bdp] |= UBADPR_BNE)
+ ((uba)->uba_dpr[(int)bdp] |= UBADPR_BNE)
#else
#define UBA_PURGE780(uba, bdp)
#endif
@@ -234,8 +234,8 @@ struct uba_regs {
#define UBADPR_PURGE 0x00000001 /* purge bdp */
/* the DELAY is for a hardware problem */
#define UBA_PURGE750(uba, bdp) { \
- ((uba)->uba_dpr[bdp] |= (UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE)); \
- {int N=8;while(N--);} \
+ ((uba)->uba_dpr[(int)bdp] |= (UBADPR_PURGE|UBADPR_NXM|UBADPR_UCE)); \
+ {volatile int N=8;while(N--);} \
}
#else
#define UBA_PURGE750(uba, bdp)
@@ -317,7 +317,7 @@ struct uba_regs {
#define UMEM8200(i) (0x20400000+(i)*0x40000)
#endif
-#if VAX8600
+#if VAX8600 || VAX780
#define UMEMA8600(i) (0x20100000+(i)*0x40000)
#define UMEMB8600(i) (0x22100000+(i)*0x40000)
#endif
diff --git a/sys/arch/vax/uba/ubavar.h b/sys/arch/vax/uba/ubavar.h
index 23d190ebcc6..1cc8ea8ce9e 100644
--- a/sys/arch/vax/uba/ubavar.h
+++ b/sys/arch/vax/uba/ubavar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: ubavar.h,v 1.8 1995/12/01 19:23:01 ragge Exp $ */
+/* $NetBSD: ubavar.h,v 1.15 1996/04/08 18:37:36 ragge Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@@ -44,8 +44,10 @@
* Each unibus device has a uba_device structure.
*/
-#include "sys/buf.h"
-#include "sys/device.h"
+#include <sys/buf.h>
+#include <sys/device.h>
+
+#include <machine/trap.h> /* For struct ivec_dsp */
/*
* Per-uba structure.
*
@@ -76,7 +78,9 @@ struct uba_softc {
int uh_memsize; /* size of uba memory, pages */
caddr_t uh_mem; /* start of uba memory address space */
caddr_t uh_iopage; /* start of uba io page */
- void (**Nuh_vec)(); /* interrupt vector */
+ void (**uh_reset) __P((int));/* UBA reset function array */
+ int *uh_resarg; /* array of ubareset args */
+ int uh_resno; /* Number of devices to reset */
struct ivec_dsp *uh_idsp; /* Interrupt dispatch area */
u_int *uh_iarea; /* Interrupt vector array */
struct uba_device *uh_actf; /* head of queue to transfer */
@@ -95,6 +99,7 @@ struct uba_softc {
int uh_lastmem; /* limit of any unibus memory */
#define UAMSIZ 100
struct map *uh_map; /* register free map */
+ struct ivec_dsp uh_dw780; /* Interrupt handles for DW780 */
};
/* given a pointer to uba_regs, find DWBUA registers */
@@ -117,7 +122,7 @@ struct uba_ctlr {
short um_ctlr; /* controller index in driver */
short um_ubanum; /* the uba it is on */
short um_alive; /* controller exists */
- void (*um_intr)(); /* interrupt handler(s) */
+ void (*um_intr) __P((int)); /* interrupt handler(s) XXX */
caddr_t um_addr; /* address of device in i/o space */
struct uba_softc *um_hd;
/* the driver saves the prototype command here for use in its go routine */
@@ -149,7 +154,7 @@ struct uba_device {
short ui_ctlr; /* mass ctlr number; -1 if none */
short ui_ubanum; /* the uba it is on */
short ui_slave; /* slave on controller */
- void (*ui_intr)(); /* interrupt handler(s) */
+ void (*ui_intr) __P((int)); /* interrupt handler(s) XXX */
caddr_t ui_addr; /* address of device in i/o space */
short ui_dk; /* if init 1 set to number for iostat */
int ui_flags; /* parameter from system specification */
@@ -171,10 +176,15 @@ struct uba_device {
* These are used at boot time by the configuration program.
*/
struct uba_driver {
- int (*ud_probe)(); /* see if a driver is really there */
- int (*ud_slave)(); /* see if a slave is there */
- int (*ud_attach)(); /* setup driver for a slave */
- int (*ud_dgo)(); /* fill csr/ba to start transfer */
+ /* see if a driver is really there XXX*/
+ int (*ud_probe) __P((caddr_t, int, struct uba_ctlr *,
+ struct uba_softc *));
+ /* see if a slave is there XXX */
+ int (*ud_slave) __P((struct uba_device *, caddr_t));
+ /* setup driver for a slave XXX */
+ void (*ud_attach) __P((struct uba_device *));
+ /* fill csr/ba to start transfer XXX */
+ void (*ud_dgo) __P((struct uba_ctlr *));
u_short *ud_addr; /* device csr addresses */
char *ud_dname; /* name of a device */
struct uba_device **ud_dinfo; /* backpointers to ubdinit structs */
@@ -182,7 +192,8 @@ struct uba_driver {
struct uba_ctlr **ud_minfo; /* backpointers to ubminit structs */
short ud_xclu; /* want exclusive use of bdp's */
short ud_keepbdp; /* hang on to bdp's once allocated */
- int (*ud_ubamem)(); /* see if dedicated memory is present */
+ int (*ud_ubamem) __P((struct uba_device *, int));
+ /* see if dedicated memory is present */
};
/*
@@ -191,8 +202,10 @@ struct uba_driver {
*/
struct uba_attach_args {
caddr_t ua_addr;
- void (*ua_ivec)();
- int ua_iarg;
+ /* Pointer to int routine, filled in by probe*/
+ void (*ua_ivec) __P((int));
+ /* UBA reset routine, filled in by probe */
+ void (*ua_reset) __P((int));
int ua_iaddr;
int ua_br;
int ua_cvec;
@@ -242,9 +255,16 @@ struct ubinfo {
extern struct uba_ctlr ubminit[];
extern struct uba_device ubdinit[];
-extern struct cfdriver ubacd;
+extern struct cfdriver uba_cd;
void ubainit __P((struct uba_softc *));
+void ubasetvec __P((struct device *, int, void (*) __P((int))));
+int uballoc __P((int, caddr_t, int, int));
+void ubarelse __P((int, int *));
+int ubaqueue __P((struct uba_device *, int));
+void ubadone __P((struct uba_ctlr *));
+void ubareset __P((int));
+int ubasetup __P((int, struct buf *, int));
#endif /* _KERNEL */
#endif !LOCORE
diff --git a/sys/arch/vax/uba/uda.c b/sys/arch/vax/uba/uda.c
index 11ea94f68f7..cb541c4bcb9 100644
--- a/sys/arch/vax/uba/uda.c
+++ b/sys/arch/vax/uba/uda.c
@@ -1,4 +1,4 @@
-/* $NetBSD: uda.c,v 1.10 1995/12/13 19:02:47 ragge Exp $ */
+/* $NetBSD: uda.c,v 1.15 1996/03/17 22:56:50 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -85,35 +85,35 @@
#define STEP3MASK ALLSTEPS
#define STEP3GOOD UDA_STEP4
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/buf.h"
-#include "sys/conf.h"
-#include "sys/file.h"
-#include "sys/ioctl.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/map.h"
-#include "sys/device.h"
-#include "sys/dkstat.h"
-#include "sys/disklabel.h"
-#include "sys/syslog.h"
-#include "sys/stat.h"
-
-#include "machine/pte.h"
-#include "machine/sid.h"
-#include "machine/cpu.h"
-
-#include "vax/uba/ubareg.h"
-#include "vax/uba/ubavar.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/conf.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/map.h>
+#include <sys/device.h>
+#include <sys/dkstat.h>
+#include <sys/disklabel.h>
+#include <sys/syslog.h>
+#include <sys/stat.h>
+
+#include <machine/pte.h>
+#include <machine/sid.h>
+#include <machine/cpu.h>
+
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
#define NRSP (1 << NRSPL2)
#define NCMD (1 << NCMDL2)
-#include "vax/uba/udareg.h"
-#include "vax/vax/mscp.h"
-#include "vax/vax/mscpvar.h"
-#include "machine/mtpr.h"
+#include <vax/uba/udareg.h>
+#include <vax/vax/mscp.h>
+#include <vax/vax/mscpvar.h>
+#include <machine/mtpr.h>
extern int cold;
@@ -128,7 +128,7 @@ extern int cold;
if ((udaddr->udasa & mask) != result) { \
volatile int count = 0; \
while ((udaddr->udasa & mask) != result) { \
- DELAY(1000); \
+ DELAY(10000); \
count += 1; \
if (count > DELAYTEN) \
break; \
@@ -177,8 +177,12 @@ struct udastats {
int udamatch __P((struct device *, void *, void *));
void uda_attach __P((struct device *, struct device *, void *));
-struct cfdriver udacd = {
- NULL, "uda", udamatch, uda_attach, DV_DULL, sizeof(struct device)
+struct cfdriver uda_cd = {
+ NULL, "uda", DV_DULL
+};
+
+struct cfattach uda_ca = {
+ sizeof(struct device), udamatch, uda_attach
};
/*
@@ -298,7 +302,6 @@ void udawatch(); /* watchdog timer */
* Externals
*/
int hz;
-extern struct cfdriver ubacd;
/*
* Poke at a supposed UDA50 to see if it is there.
@@ -321,10 +324,11 @@ uda_attach(parent, self, aux)
{
}
-udaprobe(reg, ctlr, um)
+udaprobe(reg, ctlr, um, uhp)
caddr_t reg;
int ctlr;
struct uba_ctlr *um;
+ struct uba_softc *uhp;
{
struct uda_softc *sc;
volatile struct udadevice *udaddr;
@@ -347,7 +351,6 @@ udaprobe(reg, ctlr, um)
if (MACHID(cpu_type) == VAX_750)
udadriver.ud_keepbdp = 1;
#endif
-/* printf("udaprobe\n"); */
probeum = um; /* remember for udaslave() */
/*
* Set up the controller-specific generic MSCP driver info.
@@ -366,12 +369,7 @@ udaprobe(reg, ctlr, um)
mi->mi_rsp.mri_size = NRSP;
mi->mi_rsp.mri_desc = sc->sc_uda.uda_ca.ca_rspdsc;
mi->mi_rsp.mri_ring = sc->sc_uda.uda_rsp;
-#ifdef ragge
- mi->mi_wtab.b_actf = NULL;
-#else
mi->mi_wtab.b_actf = &mi->mi_wtab;
-#endif
-/* Was: mi->mi_wtab.av_forw = mi->mi_wtab.av_back = &mi->mi_wtab; */
/*
* More controller specific variables. Again, this should
@@ -386,7 +384,7 @@ udaprobe(reg, ctlr, um)
* problem; but it would be easily fixed if we had a controller
* attach routine. Sigh.
*/
- ubasc = ubacd.cd_devs[0]; /* XXX */
+ ubasc = uhp;
sc->sc_ivec = ubasc->uh_lastiv -= 4;
udaddr = (struct udadevice *) reg;
@@ -488,7 +486,7 @@ again:
return (0);
timeout = 1000;
while (timeout-- > 0) {
- DELAY(3000);
+ DELAY(10000);
if (sc->sc_state == ST_RUN)
goto findunit;
}
@@ -677,7 +675,7 @@ udainit(ctlr)
int ctlr;
{
register struct uda_softc *sc;
- register struct udadevice *udaddr;
+ volatile struct udadevice *udaddr;
struct uba_ctlr *um;
int timo, ubinfo, count, i, wait_status;
unsigned short hej;
@@ -927,7 +925,7 @@ uda_rainit(ui, flags)
if (cold) {
i = 1000;
while ((ui->ui_flags & UNIT_ONLINE) == 0) {
- DELAY(1000);
+ DELAY(10000);
if (i-- < 0)
break;
}
@@ -2098,7 +2096,7 @@ udadump(dev)
* comes on, or ten seconds pass without response, return true (error).
*/
udadumpwait(udaddr, bits)
- register struct udadevice *udaddr;
+ volatile struct udadevice *udaddr;
register int bits;
{
register int timo = todr() + 1000;
diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c
index a5f7b7e8518..a6651d66f57 100644
--- a/sys/arch/vax/vax/autoconf.c
+++ b/sys/arch/vax/vax/autoconf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.5 1995/12/13 18:45:57 ragge Exp $ */
+/* $NetBSD: autoconf.c,v 1.12 1996/04/08 18:32:26 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,19 +33,26 @@
/* All bugs are subject to removal without further notice */
-#include "sys/param.h"
-#include "machine/cpu.h"
-#include "machine/sid.h"
-#include "sys/types.h"
-#include "sys/device.h"
-#include "sys/reboot.h"
-#include "sys/conf.h"
-#include "machine/param.h"
-#include "machine/vmparam.h"
-#include "machine/nexus.h"
-#include "machine/ka750.h"
-#include "machine/../vax/gencons.h"
-#include "vm/vm.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/reboot.h>
+#include <sys/conf.h>
+
+#include <machine/cpu.h>
+#include <machine/sid.h>
+#include <machine/param.h>
+#include <machine/vmparam.h>
+#include <machine/nexus.h>
+#include <machine/ioa.h>
+#include <machine/ka750.h>
+#include <machine/ka650.h>
+#include <machine/uvaxII.h>
+
+#include <vax/vax/gencons.h>
+
+#include <vm/vm.h>
#define BACKPLANE 0
#define BIBUSS 1
@@ -59,102 +66,151 @@ struct bp_conf {
extern int cold;
-int cpu_notsupp(),cpu_notgen();
+void notsupp_conf __P((void *, void *, void *));
+int notsupp_clock __P((void));
+void notsupp_memerr __P((void));
+int notsupp_mchk __P((caddr_t));
+void notsupp_steal_pages __P((void));
+
+
+#ifdef VAX8600 /* XXX These are in ka860 also */
+void ka86_conf __P((void *, void *, void *));
+int ka86_clock __P((void));
+void ka86_memenable __P((struct sbi_attach_args *, struct device *));
+void ka86_memerr __P((void));
+int ka86_mchk __P((caddr_t));
+void ka86_steal_pages __P((void));
+#endif
+#ifdef VAX780 /* XXX These are in ka780 also */
+void ka780_conf __P((void *, void *, void *));
+int ka780_clock __P((void));
+void ka780_memenable __P((struct sbi_attach_args *, void *));
+void ka780_memerr __P((void));
+int ka780_mchk __P((caddr_t));
+void ka780_steal_pages __P((void));
+#endif
#ifdef VAX750
-int ka750_mchk(),ka750_memerr(),ka750_clock(),ka750_conf();
-int ka750_steal_pages();
int nexty750[]={ NEX_MEM16, NEX_MEM16, NEX_MEM16, NEX_MEM16,
NEX_MBA, NEX_MBA, NEX_MBA, NEX_MBA,
NEX_UBA0, NEX_UBA1, NEX_ANY, NEX_ANY,
NEX_ANY, NEX_ANY, NEX_ANY, NEX_ANY};
#endif
#if VAX730
-int ka750_steal_pages();
int nexty730[NNEX730] = {
NEX_MEM16, NEX_ANY, NEX_ANY, NEX_ANY,
NEX_ANY, NEX_ANY, NEX_ANY, NEX_ANY,
};
#endif
-#if VAX630
-int uvaxII_steal_pages();
-int uvaxII_mchk(), uvaxII_memerr(), uvaxII_clock(), uvaxII_conf();
-#endif
-#if VAX650
-int uvaxIII_steal_pages();
-int uvaxIII_mchk(), uvaxIII_memerr(), uvaxIII_clock(), uvaxIII_conf();
-#endif
struct cpu_dep cpu_calls[VAX_MAX+1]={
/* Type 0,noexist */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#ifdef VAX780 /* Type 1, 11/{780,782,785} */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {ka780_steal_pages, ka780_clock, ka780_mchk, ka780_memerr, ka780_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX750 /* Type 2, 11/750 */
- ka750_steal_pages,ka750_clock,ka750_mchk,ka750_memerr,ka750_conf,
+ {ka750_steal_pages, ka750_clock, ka750_mchk, ka750_memerr, ka750_conf},
#else
- cpu_notgen,cpu_notgen,cpu_notgen,cpu_notgen,cpu_notgen,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX730 /* Type 3, 11/{730,725}, ceauciesco-vax */
- ka730_steal_pages,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX8600 /* Type 4, 8600/8650 (11/{790,795}) */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {ka86_steal_pages, ka86_clock, ka86_mchk, ka86_memerr, ka86_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX8200 /* Type 5, 8200, 8300, 8350 */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX8800 /* Type 6, 85X0, 8700, 88X0 */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX610 /* Type 7, KA610 */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
#ifdef VAX630 /* Type 8, KA630 or KA410 (uVAX II) */
- uvaxII_steal_pages, uvaxII_clock, uvaxII_mchk, uvaxII_memerr,
- uvaxII_conf,
+ {uvaxII_steal_pages, uvaxII_clock, uvaxII_mchk, uvaxII_memerr,
+ uvaxII_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
/* Type 9, not used */
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#ifdef VAX650 /* Type 10, KA65X (uVAX III) */
- uvaxIII_steal_pages, uvaxIII_clock, uvaxIII_mchk, uvaxIII_memerr,
- uvaxIII_conf,
+ {uvaxIII_steal_pages, uvaxIII_clock, uvaxIII_mchk, uvaxIII_memerr,
+ uvaxIII_conf},
#else
- cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,cpu_notsupp,
+ {notsupp_steal_pages, notsupp_clock, notsupp_mchk, notsupp_memerr,
+ notsupp_conf},
#endif
};
-cpu_notgen()
+void
+notsupp_steal_pages()
{
- conout("This cputype not generated.\n");
+ printf("This cputype not supported.\n");
asm("halt");
}
-cpu_notsupp()
+
+void
+notsupp_conf(dev, dev2, a)
+ void *dev, *dev2, *a;
{
- conout("This cputype not supported.\n");
- asm("halt");
}
+int
+notsupp_clock()
+{
+ return 0;
+}
+
+void
+notsupp_memerr()
+{
+}
+
+int
+notsupp_mchk(a)
+ caddr_t a;
+{
+ return 0;
+}
+
+void gencnslask __P((void));
+
+void
configure()
{
extern int boothowto;
- if (!config_rootfound("backplane", NULL))
+ if (config_rootfound("backplane", NULL) == NULL)
panic("backplane not configured");
#if GENERIC
@@ -174,23 +230,27 @@ configure()
mtpr(GC_CCF, PR_TXDB); /* Clear cold start flag in cpu */
}
-
+int printut __P((void *, char *));
+int backplane_match __P((struct device *, void *, void *));
+void backplane_attach __P((struct device *, struct device *, void *));
int
printut(aux, hej)
void *aux;
char *hej;
{
+ struct bp_conf *bp = aux;
if (hej)
- printf("printut %s\n",hej);
+ printf("printut %s %s %d\n",hej, bp->type, bp->num);
return (UNSUPP);
}
int
-backplane_match(parent, cf, aux)
+backplane_match(parent, gcf, aux)
struct device *parent;
- struct cfdata *cf;
- void *aux;
+ void *gcf, *aux;
{
+ struct cfdata *cf = gcf;
+
if (cf->cf_unit == 0 &&
strcmp(cf->cf_driver->cd_name, "backplane") == 0)
return 1; /* First (and only) backplane */
@@ -198,6 +258,10 @@ backplane_match(parent, cf, aux)
return (0);
}
+static void find_sbi __P((struct device *, struct bp_conf *,
+ int (*) __P((void *, char *))));
+
+
void
backplane_attach(parent, self, hej)
struct device *parent, *self;
@@ -208,13 +272,21 @@ backplane_attach(parent, self, hej)
printf("\n");
- switch(cpunumber){
+ switch (cpunumber) {
case VAX_750:
case VAX_650:
case VAX_78032:
+ case VAX_780:
cmem = cbi = 0;
ccpu = csbi = 1;
break;
+
+ case VAX_8600:
+ cmem = ccpu = 1;
+ cbi = csbi = 0;
+ break;
+ default:
+ cmem = ccpu = cbi = csbi = 0;
}
bp.partyp = BACKPLANE;
@@ -238,24 +310,72 @@ backplane_attach(parent, self, hej)
bp.num = i;
config_found(self, &bp, printut);
}
+#if VAX8600
+ if (cpunumber == VAX_8600)
+ find_sbi(self, &bp, printut);
+#endif
+}
+
+#if VAX8600
+void
+find_sbi(self, bp, print)
+ struct device *self;
+ struct bp_conf *bp;
+ int (*print) __P((void *, char *));
+{
+ volatile int tmp;
+ volatile struct sbia_regs *sbiar;
+ extern struct ioa *ioa;
+ int type, i;
+
+ for (i = 0; i < MAXNIOA; i++) {
+ if (badaddr((caddr_t)&ioa[i], 4))
+ continue;
+ tmp = ioa[i].ioacsr.ioa_csr;
+ type = tmp & IOA_TYPMSK;
+
+ switch (type) {
+
+ case IOA_SBIA:
+ bp->type = "sbi";
+ bp->num = i;
+ config_found(self, bp, printut);
+ sbiar = (void *)&ioa[i];
+ sbiar->sbi_errsum = -1;
+ sbiar->sbi_error = 0x1000;
+ sbiar->sbi_fltsts = 0xc0000;
+ break;
+
+ default:
+ printf("IOAdapter %x unsupported\n", type);
+ break;
+ }
+ }
}
+#endif
+
+int cpu_match __P((struct device *, void *, void *));
+void cpu_attach __P((struct device *, struct device *, void *));
+
int
-cpu_match(parent, cf, aux)
+cpu_match(parent, gcf, aux)
struct device *parent;
- struct cfdata *cf;
- void *aux;
+ void *gcf, *aux;
{
+ struct cfdata *cf = gcf;
struct bp_conf *bp = aux;
- if (strcmp(cf->cf_driver->cd_name, "cpu"))
+ if (strcmp(bp->type, "cpu"))
return 0;
switch (cpunumber) {
-#if VAX750 || VAX630 || VAX650
+#if VAX750 || VAX630 || VAX650 || VAX780 || VAX8600
case VAX_750:
case VAX_78032:
case VAX_650:
+ case VAX_780:
+ case VAX_8600:
if(cf->cf_unit == 0 && bp->partyp == BACKPLANE)
return 1;
break;
@@ -273,23 +393,56 @@ cpu_attach(parent, self, aux)
(*cpu_calls[cpunumber].cpu_conf)(parent, self, aux);
}
-int nmcr = 0;
+int mem_match __P((struct device *, void *, void *));
+void mem_attach __P((struct device *, struct device *, void *));
int
-mem_match(parent, cf, aux)
+mem_match(parent, gcf, aux)
struct device *parent;
- struct cfdata *cf;
- void *aux;
+ void *gcf, *aux;
{
- struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
-
+ struct cfdata *cf = gcf;
+ struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
+ struct bp_conf *bp = aux;
+
+#if VAX8600
+ if (cpunumber == VAX_8600 && !strcmp(parent->dv_xname, "backplane0")) {
+ if (strcmp(bp->type, "mem"))
+ return 0;
+ return 1;
+ }
+#endif
if ((cf->cf_loc[0] != sa->nexnum) && (cf->cf_loc[0] > -1))
- return 0; /* memory doesn't match spec's */
+ return 0;
+
switch (sa->type) {
+ case NEX_MEM4:
+ case NEX_MEM4I:
case NEX_MEM16:
- return 1;
+ case NEX_MEM16I:
+ sa->nexinfo = M780C;
+ break;
+
+ case NEX_MEM64I:
+ case NEX_MEM64L:
+ case NEX_MEM64LI:
+ case NEX_MEM256I:
+ case NEX_MEM256L:
+ case NEX_MEM256LI:
+ sa->nexinfo = M780EL;
+ break;
+
+ case NEX_MEM64U:
+ case NEX_MEM64UI:
+ case NEX_MEM256U:
+ case NEX_MEM256UI:
+ sa->nexinfo = M780EU;
+ break;
+
+ default:
+ return 0;
}
- return 0;
+ return 1;
}
void
@@ -297,30 +450,61 @@ mem_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
+ struct sbi_attach_args *sa = (struct sbi_attach_args *)aux;
+ struct mem_softc *sc = (void *)self;
+
+#if VAX8600
+ if (cpunumber == VAX_8600) {
+ ka86_memenable(0, 0);
+ printf("\n");
+ return;
+ }
+#endif
+ sc->sc_memaddr = sa->nexaddr;
+ sc->sc_memtype = sa->nexinfo;
+ sc->sc_memnr = sa->type;
switch (cpunumber) {
#ifdef VAX750
case VAX_750:
- ka750_memenable(sa, self);
+ ka750_memenable(sa, (void *)sc);
+ break;
+#endif
+#ifdef VAX780
+ case VAX_780:
+ ka780_memenable(sa, sc);
break;
#endif
-
default:
break;
}
}
-struct cfdriver backplanecd =
- { 0, "backplane", backplane_match, backplane_attach,
- DV_DULL, sizeof(struct device) };
+struct cfdriver backplane_cd = {
+ NULL, "backplane", DV_DULL
+};
-struct cfdriver cpucd =
- { 0, "cpu", cpu_match, cpu_attach, DV_CPU, sizeof(struct device) };
+struct cfattach backplane_ca = {
+ sizeof(struct device), backplane_match, backplane_attach
+};
+struct cfdriver cpu_cd = {
+ NULL, "cpu", DV_CPU
+};
-struct cfdriver memcd =
- { 0, "mem", mem_match, mem_attach, DV_CPU, sizeof(struct device) };
+struct cfattach cpu_backplane_ca = {
+ sizeof(struct device), cpu_match, cpu_attach
+};
+struct cfdriver mem_cd = {
+ NULL, "mem", DV_CPU
+};
+
+struct cfattach mem_backplane_ca = {
+ sizeof(struct device), mem_match, mem_attach
+};
+struct cfattach mem_sbi_ca = {
+ sizeof(struct device), mem_match, mem_attach
+};
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
index 6aa1bd20e9a..8de6a4ca178 100644
--- a/sys/arch/vax/vax/clock.c
+++ b/sys/arch/vax/vax/clock.c
@@ -1,4 +1,4 @@
-/* $NetBSD: clock.c,v 1.9 1995/12/13 18:45:56 ragge Exp $ */
+/* $NetBSD: clock.c,v 1.13 1996/04/08 18:32:27 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -32,9 +32,11 @@
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/systm.h>
-#include "machine/mtpr.h"
-#include "machine/sid.h"
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/uvaxII.h>
#define SEC_PER_DAY (60*60*24)
@@ -102,7 +104,7 @@ inittodr(fs_time)
{
unsigned long tmp_year, sluttid, year_ticks;
- int clock_stopped;
+ int clock_stopped = 0;
sluttid = fs_time;
year = (fs_time / SEC_PER_DAY / 365) * 365 * SEC_PER_DAY;
@@ -123,6 +125,12 @@ inittodr(fs_time)
year_ticks = uvaxII_gettodr(&clock_stopped);
break;
#endif
+#if VAX780 || VAX8600
+ case VAX_780:
+ case VAX_8600:
+ year_ticks = mfpr(PR_TODR);
+ break;
+#endif
default:
year_ticks = 0;
clock_stopped = 1;
@@ -149,7 +157,7 @@ inittodr(fs_time)
} else if (year_ticks / 100 > fs_time - year + SEC_PER_DAY * 3) {
printf(
"WARNING: Clock has gained %d days - CHECK AND RESET THE DATE.\n",
- (year_ticks / 100 - (fs_time - year)) / SEC_PER_DAY);
+ (int)(year_ticks / 100 - (fs_time - year)) / SEC_PER_DAY);
sluttid = year + (year_ticks / 100);
} else if (year_ticks / 100 < fs_time - year) {
printf(
@@ -184,26 +192,39 @@ resettodr()
uvaxII_settodr((time.tv_sec - year) * 100 + 1);
break;
#endif
+ default:
+ mtpr((time.tv_sec - year) * 100, PR_TODR);
};
todrstopped = 0;
}
/*
- * Unfortunately the 78032 cpu chip (MicroVAXII cpu) does not have a functional
- * todr register, so this function is necessary.
- * (the x and y variables are used to confuse the optimizer enough to ensure
- * that the code actually loops:-)
+ * A delayloop that delays about the number of milliseconds that is
+ * given as argument.
*/
void
delay(i)
int i;
{
- volatile int n;
+ int mul;
- n = i;
-
- while (--n)
- ;
-
- return;
+ switch (cpunumber) {
+#if VAX750 || VAX630 || VAX780
+ case VAX_750:
+ case VAX_78032:
+ case VAX_780:
+ mul = 1; /* <= 1 VUPS */
+ break;
+#endif
+#if VAX650
+ case VAX_650:
+ mul = 3; /* <= 3 VUPS */
+ break;
+#endif
+ default: /* Would be enough... */
+ case VAX_8600:
+ mul = 6; /* <= 6 VUPS */
+ break;
+ }
+ asm ("1: sobgtr %0, 1b" : : "r" (mul * i));
}
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
index 557676fa29c..ce5e911fb86 100644
--- a/sys/arch/vax/vax/conf.c
+++ b/sys/arch/vax/vax/conf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf.c,v 1.15 1996/01/28 11:46:54 ragge Exp $ */
+/* $NetBSD: conf.c,v 1.21 1996/04/08 18:32:29 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -47,14 +47,12 @@ int ttselect __P((dev_t, int, struct proc *));
#ifndef LKM
#define lkmenodev enodev
-#else
-int lkmenodev();
#endif
#include "hp.h" /* 0 */
bdev_decl(hp);
-#include "tu.h"
+#include "ht.h"
bdev_decl(ht);
#include "rk.h"
@@ -114,7 +112,7 @@ bdev_decl(vnd);
struct bdevsw bdevsw[] =
{
bdev_disk_init(NHP,hp), /* 0: RP0?/RM0? */
- bdev_tape_init(NTU,ht), /* 1: TU77 w/ TM03 */
+ bdev_tape_init(NHT,ht), /* 1: TU77 w/ TM03 */
bdev_disk_init(NUP,up), /* 2: SC-21/SC-31 */
bdev_disk_init(NRK,rk), /* 3: RK06/07 */
bdev_swap_init(1,sw), /* 4: swap pseudo-device */
@@ -257,7 +255,7 @@ cdev_decl(crl);
#define crxwrite crxrw
cdev_decl(crx);
-#if VAX780
+#if VAX780 && 0
#define NFL 1
#else
#define NFL 0
@@ -320,6 +318,8 @@ cdev_decl(bpf);
#include "tun.h"
cdev_decl(tun);
+dev_decl(filedesc,open);
+
struct cdevsw cdevsw[] =
{
cdev_cn_init(1,cn), /* 0: virtual console */
@@ -375,7 +375,7 @@ struct cdevsw cdevsw[] =
cdev_notdef(), /* 50 */
cdev_cnstore_init(NCRX,crx), /* 51: Console RX50 at 8200 */
cdev_disk_init(NKDB,kdb), /* 52: KDB50/RA?? */
- cdev_fd_init(1,fd), /* 53: file descriptor pseudo-device */
+ cdev_fd_init(1,filedesc), /* 53: file descriptor pseudo-device */
cdev_disk_init(NCCD,ccd), /* 54: concatenated disk driver */
cdev_disk_init(NVND,vnd), /* 55: vnode disk driver */
cdev_bpftun_init(NBPFILTER,bpf),/* 56: berkeley packet filter */
@@ -455,6 +455,7 @@ int chrtoblktbl[] = {
18, /* 55 */
};
+int
chrtoblk(dev)
dev_t dev;
{
@@ -466,6 +467,7 @@ chrtoblk(dev)
/*
* Returns true if dev is /dev/mem or /dev/kmem.
*/
+int
iskmemdev(dev)
dev_t dev;
{
@@ -477,6 +479,7 @@ iskmemdev(dev)
* Returns true if dev is /dev/zero.
* ?? Shall I use 12 as /dev/zero?
*/
+int
iszerodev(dev)
dev_t dev;
{
diff --git a/sys/arch/vax/vax/crl.c b/sys/arch/vax/vax/crl.c
new file mode 100644
index 00000000000..c928997904f
--- /dev/null
+++ b/sys/arch/vax/vax/crl.c
@@ -0,0 +1,264 @@
+/* $NetBSD: crl.c,v 1.2 1996/04/08 18:32:30 ragge Exp $ */
+/*-
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)crl.c 7.5 (Berkeley) 5/9/91
+ */
+
+/*
+ * TO DO (tef 7/18/85):
+ * 1) change printf's to log() instead???
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/conf.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/buf.h>
+
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/scb.h>
+
+#include <vax/vax/crl.h>
+
+struct {
+ short crl_state; /* open and busy flags */
+ short crl_active; /* driver state flag */
+ struct buf *crl_buf; /* buffer we're using */
+ ushort *crl_xaddr; /* transfer address */
+ short crl_errcnt;
+} crltab;
+
+struct {
+ int crl_cs; /* saved controller status */
+ int crl_ds; /* saved drive status */
+} crlstat;
+
+void crlintr __P((int));
+void crlattach __P((void));
+static void crlstart __P((void));
+
+int crlopen __P((dev_t, int, struct proc *));
+int crlclose __P((dev_t, int, struct proc *));
+int crlrw __P((dev_t, struct uio *, int));
+
+
+struct ivec_dsp crl_intr;
+
+void
+crlattach()
+{
+ extern struct ivec_dsp idsptch;
+
+ bcopy(&idsptch, &crl_intr, sizeof(struct ivec_dsp));
+ scb->scb_csrint = &crl_intr;
+ crl_intr.hoppaddr = crlintr;
+}
+
+/*ARGSUSED*/
+int
+crlopen(dev, flag, p)
+ dev_t dev;
+ int flag;
+ struct proc *p;
+{
+ if (cpunumber != VAX_8600)
+ return (ENXIO);
+ if (crltab.crl_state != CRL_IDLE)
+ return (EALREADY);
+ crltab.crl_state = CRL_OPEN;
+ crltab.crl_buf = geteblk(512);
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+crlclose(dev, flag, p)
+ dev_t dev;
+ int flag;
+ struct proc *p;
+{
+
+ brelse(crltab.crl_buf);
+ crltab.crl_state = CRL_IDLE;
+ return 0;
+}
+
+/*ARGSUSED*/
+int
+crlrw(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ register struct buf *bp;
+ register int i;
+ register int s;
+ int error;
+
+ if (uio->uio_resid == 0)
+ return (0);
+ s = spl4();
+ while (crltab.crl_state & CRL_BUSY)
+ sleep((caddr_t)&crltab, PRIBIO);
+ crltab.crl_state |= CRL_BUSY;
+ splx(s);
+
+ bp = crltab.crl_buf;
+ error = 0;
+ while ((i = imin(CRLBYSEC, uio->uio_resid)) > 0) {
+ bp->b_blkno = uio->uio_offset>>9;
+ if (bp->b_blkno >= MAXSEC || (uio->uio_offset & 0x1FF) != 0) {
+ error = EIO;
+ break;
+ }
+ if (uio->uio_rw == UIO_WRITE) {
+ error = uiomove(bp->b_un.b_addr, i, uio);
+ if (error)
+ break;
+ }
+ bp->b_flags = uio->uio_rw == UIO_WRITE ? B_WRITE : B_READ;
+ s = spl4();
+ crlstart();
+ while ((bp->b_flags & B_DONE) == 0)
+ sleep((caddr_t)bp, PRIBIO);
+ splx(s);
+ if (bp->b_flags & B_ERROR) {
+ error = EIO;
+ break;
+ }
+ if (uio->uio_rw == UIO_READ) {
+ error = uiomove(bp->b_un.b_addr, i, uio);
+ if (error)
+ break;
+ }
+ }
+ crltab.crl_state &= ~CRL_BUSY;
+ wakeup((caddr_t)&crltab);
+ return (error);
+}
+
+void
+crlstart()
+{
+ register struct buf *bp;
+
+ bp = crltab.crl_buf;
+ crltab.crl_errcnt = 0;
+ crltab.crl_xaddr = (ushort *) bp->b_un.b_addr;
+ bp->b_resid = 0;
+
+ if ((mfpr(PR_STXCS) & STXCS_RDY) == 0)
+ /* not ready to receive order */
+ return;
+ if ((bp->b_flags&(B_READ|B_WRITE)) == B_READ) {
+ crltab.crl_active = CRL_F_READ;
+ mtpr(bp->b_blkno<<8 | STXCS_IE | CRL_F_READ, PR_STXCS);
+ } else {
+ crltab.crl_active = CRL_F_WRITE;
+ mtpr(bp->b_blkno<<8 | STXCS_IE | CRL_F_WRITE, PR_STXCS);
+ }
+#ifdef lint
+ crlintr();
+#endif
+}
+
+void
+crlintr(arg)
+ int arg;
+{
+ register struct buf *bp;
+ int i;
+
+ bp = crltab.crl_buf;
+ i = mfpr(PR_STXCS);
+ switch ((i>>24) & 0xFF) {
+
+ case CRL_S_XCMPLT:
+ switch (crltab.crl_active) {
+
+ case CRL_F_RETSTS:
+ crlstat.crl_ds = mfpr(PR_STXDB);
+ printf("crlcs=0x%b, crlds=0x%b\n", crlstat.crl_cs,
+ CRLCS_BITS, crlstat.crl_ds, CRLDS_BITS);
+ break;
+
+ case CRL_F_READ:
+ case CRL_F_WRITE:
+ bp->b_flags |= B_DONE;
+ }
+ crltab.crl_active = 0;
+ wakeup((caddr_t)bp);
+ break;
+
+ case CRL_S_XCONT:
+ switch (crltab.crl_active) {
+
+ case CRL_F_WRITE:
+ mtpr(*crltab.crl_xaddr++, PR_STXDB);
+ mtpr(bp->b_blkno<<8 | STXCS_IE | CRL_F_WRITE, PR_STXCS);
+ break;
+
+ case CRL_F_READ:
+ *crltab.crl_xaddr++ = mfpr(PR_STXDB);
+ mtpr(bp->b_blkno<<8 | STXCS_IE | CRL_F_READ, PR_STXCS);
+ }
+ break;
+
+ case CRL_S_ABORT:
+ crltab.crl_active = CRL_F_RETSTS;
+ mtpr(STXCS_IE | CRL_F_RETSTS, PR_STXCS);
+ bp->b_flags |= B_DONE|B_ERROR;
+ break;
+
+ case CRL_S_RETSTS:
+ crlstat.crl_cs = mfpr(PR_STXDB);
+ mtpr(STXCS_IE | CRL_S_RETSTS, PR_STXCS);
+ break;
+
+ case CRL_S_HNDSHK:
+ printf("crl: hndshk error\n"); /* dump out some status too? */
+ crltab.crl_active = 0;
+ bp->b_flags |= B_DONE|B_ERROR;
+ wakeup((caddr_t)bp);
+ break;
+
+ case CRL_S_HWERR:
+ printf("crl: hard error sn%d\n", bp->b_blkno);
+ crltab.crl_active = CRL_F_ABORT;
+ mtpr(STXCS_IE | CRL_F_ABORT, PR_STXCS);
+ break;
+ }
+}
diff --git a/sys/arch/vax/vax/crl.h b/sys/arch/vax/vax/crl.h
new file mode 100644
index 00000000000..6022ac85464
--- /dev/null
+++ b/sys/arch/vax/vax/crl.h
@@ -0,0 +1,78 @@
+/* $NetBSD: crl.h,v 1.1 1996/03/08 12:32:53 ragge Exp $ */
+/*
+ * @(#)crl.h 7.1 (Berkeley) 6/5/86
+ */
+
+/****************************************************************
+ * *
+ * Licensed from Digital Equipment Corporation *
+ * Copyright (c) *
+ * Digital Equipment Corporation *
+ * Maynard, Massachusetts *
+ * 1985, 1986 *
+ * All rights reserved. *
+ * *
+ * The Information in this software is subject to change *
+ * without notice and should not be construed as a commitment *
+ * by Digital Equipment Corporation. Digital makes no *
+ * representations about the suitability of this software for *
+ * any purpose. It is supplied "As Is" without expressed or *
+ * implied warranty. *
+ * *
+ * If the Regents of the University of California or its *
+ * licensees modify the software in a manner creating *
+ * diriviative copyright rights, appropriate copyright *
+ * legends may be placed on the drivative work in addition *
+ * to that set forth above. *
+ ****************************************************************/
+
+/*
+ * Console RL02 status of current transfer (read only)
+ */
+#define CRL_S_XCMPLT 1 /* transaction complete */
+#define CRL_S_XCONT 2 /* continue transaction */
+#define CRL_S_ABORT 3 /* transation abort */
+#define CRL_S_RETSTS 4 /* return device status */
+#define CRL_S_HNDSHK 0x80 /* handshake err during transaction */
+#define CRL_S_HWERR 0x81 /* hardware err during transaction */
+
+/*
+ * Console RL02 function codes
+ */
+#define CRL_F_NOOP 0 /* No operation */
+#define CRL_F_RSTSTS 2 /* reset and return device status */
+#define CRL_F_ABORT 3 /* abort transfer */
+#define CRL_F_RETSTS 4 /* read device status */
+#define CRL_F_WRITE 5 /* write block data */
+#define CRL_F_READ 6 /* read block data */
+
+/*
+ * Console sectoring information.
+ * The console understands the rl02 as having 512 byte sectors.
+ */
+#define CRLBYSEC 512 /* bytes/sector */
+#define MAXSEC 20480 /* sectors/rl02 */
+
+/*
+ * STXCS bit definitions
+ */
+#define STXCS_RDY 0x00000080 /* ready bit */
+#define STXCS_IE 0x00000040 /* interrupt enable */
+
+#define CRLERRS 5 /* number of retries before quitting */
+
+/*
+ * The state byte is used to retain exclusivity,
+ * and contains the busy flag.
+ */
+#define CRL_IDLE 0
+#define CRL_OPEN 1
+#define CRL_BUSY 2
+
+
+#define CRLDS_BITS \
+"\20\20WDE\17CHE\16WL\15SKTO\14SPE\13WGE\12VC\11DSE\
+\10DT\7HS\6CO\5HO\4BH\3STC\2STB\1STA"
+
+#define CRLCS_BITS \
+"\20\20CE\17DE\16NXM\15DLT\14DCRC\13OPI\1DRDY"
diff --git a/sys/arch/vax/vax/ctu.c b/sys/arch/vax/vax/ctu.c
new file mode 100644
index 00000000000..2584aaa194d
--- /dev/null
+++ b/sys/arch/vax/vax/ctu.c
@@ -0,0 +1,411 @@
+/* $NetBSD: ctu.c,v 1.3 1996/04/08 18:32:31 ragge Exp $ */
+/*
+ * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * Device driver for 11/750 Console TU58.
+ *
+ * Error checking is almost nonexistent, the driver should be
+ * fixed to at least calculate checksum on incoming packets.
+ * Writing of tapes does not work, by some unknown reason so far.
+ * It is almost useless to try to use this driver when running
+ * multiuser, because the serial device don't have any buffers
+ * so we will loose interrupts.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/buf.h>
+#include <sys/fcntl.h>
+#include <sys/malloc.h>
+#include <sys/ioctl.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+#include <sys/disklabel.h> /* For disklabel prototype */
+
+#include <machine/mtpr.h>
+#include <machine/rsp.h>
+#include <machine/scb.h>
+#include <machine/trap.h>
+
+enum tu_state {
+ SC_UNUSED,
+ SC_INIT,
+ SC_READY,
+ SC_SEND_CMD,
+ SC_GET_RESP,
+ SC_GET_WCONT,
+ SC_GET_END,
+ SC_RESTART,
+};
+
+volatile struct tu_softc {
+ enum tu_state sc_state;
+ int sc_error;
+ char sc_rsp[15]; /* Should be struct rsb; but don't work */
+ u_char *sc_xfptr; /* Current char to xfer */
+ u_char *sc_blk; /* Base of current 128b block */
+ int sc_tpblk; /* Start block number */
+ int sc_nbytes; /* Number of bytes to xfer */
+ int sc_xbytes; /* Number of xfer'd bytes */
+ int sc_bbytes; /* Number of xfer'd bytes this block */
+ int sc_op; /* Read/write */
+ int sc_xmtok; /* set if OK to xmit */
+ struct buf sc_q; /* Current buffer */
+} tu_sc;
+
+struct ivec_dsp tu_recv, tu_xmit;
+
+void ctutintr __P((int));
+void cturintr __P((int));
+void ctuattach __P((void));
+void ctustart __P((struct buf *));
+void ctuwatch __P((void *));
+short ctu_cksum __P((unsigned short *, int));
+
+int ctuopen __P((dev_t, int, int, struct proc *));
+int ctuclose __P((dev_t, int, int, struct proc *));
+void ctustrategy __P((struct buf *));
+int ctuioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int ctudump __P((dev_t, daddr_t, caddr_t, size_t));
+
+
+void
+ctuattach()
+{
+ extern struct ivec_dsp idsptch;
+
+ bcopy(&idsptch, &tu_recv, sizeof(struct ivec_dsp));
+ bcopy(&idsptch, &tu_xmit, sizeof(struct ivec_dsp));
+ scb->scb_csrint = (void *)&tu_recv;
+ scb->scb_cstint = (void *)&tu_xmit;
+ tu_recv.hoppaddr = cturintr;
+ tu_xmit.hoppaddr = ctutintr;
+}
+
+int
+ctuopen(dev, oflags, devtype, p)
+ dev_t dev;
+ int oflags, devtype;
+ struct proc *p;
+{
+ int unit, error;
+
+ unit = minor(dev);
+
+ if (unit)
+ return ENXIO;
+
+ if (tu_sc.sc_state != SC_UNUSED)
+ return EBUSY;
+
+ tu_sc.sc_error = 0;
+ mtpr(0100, PR_CSRS); /* Enable receive interrupt */
+ timeout(ctuwatch, 0, 100); /* Check once/second */
+
+ tu_sc.sc_state = SC_INIT;
+
+ mtpr(RSP_TYP_INIT, PR_CSTD);
+
+ if ((error = tsleep((caddr_t)&tu_sc, (PZERO + 10)|PCATCH,
+ "ctuopen", 0)))
+ return (error);
+
+ if (tu_sc.sc_error)
+ return tu_sc.sc_error;
+
+ tu_sc.sc_state = SC_READY;
+ tu_sc.sc_xmtok = 1;
+
+ mtpr(0100, PR_CSTS);
+ return 0;
+
+}
+
+int
+ctuclose(dev, oflags, devtype, p)
+ dev_t dev;
+ int oflags, devtype;
+ struct proc *p;
+{
+ mtpr(0, PR_CSRS);
+ mtpr(0, PR_CSTS);
+ tu_sc.sc_state = SC_UNUSED;
+ untimeout(ctuwatch, 0);
+ return 0;
+}
+
+void
+ctustrategy(bp)
+ struct buf *bp;
+{
+ int s;
+
+#ifdef TUDEBUG
+ printf("addr %x, block %x, nblock %x, read %x\n",
+ bp->b_un.b_addr, bp->b_blkno, bp->b_bcount,
+ bp->b_flags & B_READ);
+#endif
+
+ if (bp->b_blkno >= 512) {
+ iodone(bp);
+ return;
+ }
+ bp->b_cylinder = bp->b_blkno;
+ s = splimp();
+ disksort((struct buf *)&tu_sc.sc_q, bp); /* Why not use disksort? */
+ if (tu_sc.sc_state == SC_READY)
+ ctustart(bp);
+ splx(s);
+}
+
+void
+ctustart(bp)
+ struct buf *bp;
+{
+ struct rsp *rsp = (struct rsp *)tu_sc.sc_rsp;
+
+
+ tu_sc.sc_xfptr = tu_sc.sc_blk = bp->b_un.b_addr;
+ tu_sc.sc_tpblk = bp->b_blkno;
+ tu_sc.sc_nbytes = bp->b_bcount;
+ tu_sc.sc_xbytes = tu_sc.sc_bbytes = 0;
+ tu_sc.sc_op = bp->b_flags & B_READ ? RSP_OP_READ : RSP_OP_WRITE;
+
+ rsp->rsp_typ = RSP_TYP_COMMAND;
+ rsp->rsp_sz = 012;
+ rsp->rsp_op = tu_sc.sc_op;
+ rsp->rsp_mod = 0;
+ rsp->rsp_drv = 0;
+ rsp->rsp_sw = rsp->rsp_xx1 = rsp->rsp_xx2 = 0;
+ rsp->rsp_cnt = tu_sc.sc_nbytes;
+ rsp->rsp_blk = tu_sc.sc_tpblk;
+ rsp->rsp_sum = ctu_cksum((unsigned short *)rsp, 6);
+ tu_sc.sc_state = SC_SEND_CMD;
+ if (tu_sc.sc_xmtok) {
+ tu_sc.sc_xmtok = 0;
+ ctutintr(0);
+ }
+}
+
+int
+ctuioctl(dev, cmd, data, fflag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int fflag;
+ struct proc *p;
+{
+ return 0;
+}
+
+/*
+ * Not bloody likely...
+ */
+int
+ctudump(dev, blkno, va, size)
+ dev_t dev;
+ daddr_t blkno;
+ caddr_t va;
+ size_t size;
+{
+ return 0;
+}
+
+void
+cturintr(arg)
+ int arg;
+{
+ int status = mfpr(PR_CSRD);
+ struct buf *bp;
+
+ bp = tu_sc.sc_q.b_actf;
+ switch (tu_sc.sc_state) {
+
+ case SC_UNUSED:
+ printf("stray console storage interrupt, got %o\n", status);
+ break;
+
+ case SC_INIT:
+ if (status != RSP_TYP_CONTINUE)
+ tu_sc.sc_error = EIO;
+ wakeup((void *)&tu_sc);
+ break;
+ case SC_GET_RESP:
+ tu_sc.sc_tpblk++;
+ if (tu_sc.sc_xbytes == tu_sc.sc_nbytes) {
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes == 146) { /* We're finished! */
+#ifdef TUDEBUG
+ printf("Xfer ok\n");
+#endif
+ tu_sc.sc_q.b_actf = bp->b_actf;
+ iodone(bp);
+ tu_sc.sc_xmtok = 1;
+ tu_sc.sc_state = SC_READY;
+ if (tu_sc.sc_q.b_actf)
+ ctustart(tu_sc.sc_q.b_actf);
+ }
+ break;
+ }
+ tu_sc.sc_bbytes++;
+ if (tu_sc.sc_bbytes < 3) /* Data header */
+ break;
+ if (tu_sc.sc_bbytes == 132) { /* Finished */
+ tu_sc.sc_bbytes = 0;
+ break;
+ }
+ if (tu_sc.sc_bbytes == 131) /* First checksum */
+ break;
+ tu_sc.sc_xfptr[tu_sc.sc_xbytes++] = status;
+ break;
+
+ case SC_GET_WCONT:
+ if (status != 020)
+ printf("SC_GET_WCONT: status %o\n", status);
+ else
+ ctutintr(0);
+ tu_sc.sc_xmtok = 0;
+ break;
+
+ case SC_RESTART:
+ ctustart(tu_sc.sc_q.b_actf);
+ break;
+
+ default:
+ if (status == 4) { /* Protocol error, or something */
+ tu_sc.sc_state = SC_RESTART;
+ mtpr(RSP_TYP_INIT, PR_CSTD);
+ return;
+ }
+ printf("Unknown receive ctuintr state %d, pack %o\n",
+ tu_sc.sc_state, status);
+ }
+
+}
+
+void
+ctutintr(arg)
+ int arg;
+{
+ int c;
+
+ if (tu_sc.sc_xmtok)
+ return;
+
+ switch (tu_sc.sc_state) {
+ case SC_SEND_CMD:
+ c = tu_sc.sc_rsp[tu_sc.sc_xbytes++] & 0xff;
+ mtpr(c, PR_CSTD);
+ if (tu_sc.sc_xbytes > 13) {
+ tu_sc.sc_state = (tu_sc.sc_op == RSP_OP_READ ?
+ SC_GET_RESP : SC_GET_WCONT);
+ tu_sc.sc_xbytes = 0;
+ tu_sc.sc_xmtok++;
+ }
+ break;
+
+ case SC_GET_WCONT:
+ switch (tu_sc.sc_bbytes) {
+ case 0:
+ mtpr(1, PR_CSTD); /* This is a data packet */
+ break;
+
+ case 1:
+ mtpr(128, PR_CSTD); /* # of bytes to send */
+ break;
+
+ case 130:
+ mtpr(0, PR_CSTD); /* First checksum */
+ break;
+
+ case 131:
+ mtpr(0, PR_CSTD); /* Second checksum */
+ break;
+
+ case 132: /* Nothing to send... */
+ tu_sc.sc_bbytes = -1;
+ if (tu_sc.sc_xbytes == tu_sc.sc_nbytes + 1)
+ tu_sc.sc_op = SC_GET_END;
+ break;
+ default:
+ c = tu_sc.sc_rsp[tu_sc.sc_xbytes++] & 0xff;
+ mtpr(c, PR_CSTD);
+ break;
+ }
+ tu_sc.sc_bbytes++;
+ break;
+
+ default:
+ printf("Unknown xmit ctuintr state %d\n",tu_sc.sc_state);
+ }
+}
+
+short
+ctu_cksum(buf, words)
+ unsigned short *buf;
+ int words;
+{
+ int i, cksum;
+
+ for (i = cksum = 0; i < words; i++)
+ cksum += buf[i];
+
+hej: if (cksum > 65535) {
+ cksum = (cksum & 65535) + (cksum >> 16);
+ goto hej;
+ }
+ return cksum;
+}
+
+int oldtp;
+
+/*
+ * Watch so that we don't get blocked unnecessary due to lost int's.
+ */
+void
+ctuwatch(arg)
+ void *arg;
+{
+
+ timeout(ctuwatch, 0, 1000);
+
+ if (tu_sc.sc_state == SC_GET_RESP && tu_sc.sc_tpblk != 0 &&
+ tu_sc.sc_tpblk == oldtp && (tu_sc.sc_tpblk % 128 != 0)) {
+ printf("tu0: lost recv interrupt\n");
+ ctustart(tu_sc.sc_q.b_actf);
+ return;
+ }
+ if (tu_sc.sc_state == SC_RESTART)
+ mtpr(RSP_TYP_INIT, PR_CSTS);
+ oldtp = tu_sc.sc_tpblk;
+}
diff --git a/sys/arch/vax/vax/db_disasm.c b/sys/arch/vax/vax/db_disasm.c
index 429d357aaa3..26950657de7 100644
--- a/sys/arch/vax/vax/db_disasm.c
+++ b/sys/arch/vax/vax/db_disasm.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.3 1996/01/28 11:31:25 ragge Exp $ */
+/* $NetBSD: db_disasm.c,v 1.6 1996/04/08 18:32:32 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -35,14 +35,17 @@
#include <sys/param.h>
+#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/reboot.h>
-#include <ddb/db_variables.h>
#include <machine/db_machdep.h>
#include <ddb/db_sym.h>
+#include <ddb/db_output.h>
+#include <ddb/db_interface.h>
+#include <ddb/db_variables.h>
-#include "vax/vax/db_disasm.h"
+#include <vax/vax/db_disasm.h>
#ifdef VMS_MODE
#define DEFERRED '@'
@@ -469,7 +472,7 @@ add_str(ib, s)
inst_buffer *ib;
char *s;
{
- while (*ib->curp++ = *s++);
+ while ((*ib->curp++ = *s++));
*--ib->curp = '\0';
}
diff --git a/sys/arch/vax/vax/db_machdep.c b/sys/arch/vax/vax/db_machdep.c
index 07c789e864f..317e005abf8 100644
--- a/sys/arch/vax/vax/db_machdep.c
+++ b/sys/arch/vax/vax/db_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.c,v 1.3 1996/01/28 12:05:55 ragge Exp $ */
+/* $NetBSD: db_machdep.c,v 1.6 1996/04/08 18:32:33 ragge Exp $ */
/*
* Mach Operating System
@@ -37,18 +37,25 @@
#include <sys/reboot.h>
#include <sys/systm.h> /* just for boothowto --eichin */
-#include <ddb/db_variables.h>
-
#include <vm/vm.h>
#include <machine/db_machdep.h>
#include <machine/trap.h>
#include <machine/frame.h>
+#include <machine/cpu.h>
#include <machine/../vax/gencons.h>
-#include <setjmp.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_command.h>
+#include <ddb/db_output.h>
+#include <ddb/db_extern.h>
+#include <ddb/db_access.h>
+#include <ddb/db_interface.h>
+#include <ddb/db_variables.h>
-extern jmp_buf *db_recover;
+extern label_t *db_recover;
+
+void kdbprinttrap __P((int, int));
int db_active = 0;
@@ -58,7 +65,7 @@ int db_active = 0;
* If it is the result of a panic, set the ddb register frame to
* contain the registers when panic was called. (easy to debug).
*/
-int
+void
kdb_trap(frame)
struct trapframe *frame;
{
@@ -87,7 +94,7 @@ kdb_trap(frame)
default:
if ((boothowto & RB_KDB) == 0)
- return 0;
+ return;
kdbprinttrap(frame->trap, frame->code);
if (db_recover != 0) {
@@ -115,7 +122,7 @@ kdb_trap(frame)
bcopy(&ddb_regs, frame, sizeof(struct trapframe));
frame->sp = mfpr(PR_USP);
- return (1);
+ return;
}
extern char *traptypes[];
@@ -124,6 +131,7 @@ extern int no_traps;
/*
* Print trap reason.
*/
+void
kdbprinttrap(type, code)
int type, code;
{
@@ -141,7 +149,7 @@ kdbprinttrap(type, code)
void
db_read_bytes(addr, size, data)
vm_offset_t addr;
- register int size;
+ register size_t size;
register char *data;
{
register char *src;
@@ -157,7 +165,7 @@ db_read_bytes(addr, size, data)
void
db_write_bytes(addr, size, data)
vm_offset_t addr;
- register int size;
+ register size_t size;
register char *data;
{
register char *dst;
@@ -167,7 +175,7 @@ db_write_bytes(addr, size, data)
*dst++ = *data++;
}
-int
+void
Debugger()
{
int s = splx(0xe); /* Is this good? We must lower anyway... */
@@ -179,23 +187,23 @@ Debugger()
* Machine register set.
*/
struct db_variable db_regs[] = {
- "r0", &ddb_regs.r0, FCN_NULL,
- "r1", &ddb_regs.r1, FCN_NULL,
- "r2", &ddb_regs.r2, FCN_NULL,
- "r3", &ddb_regs.r3, FCN_NULL,
- "r4", &ddb_regs.r4, FCN_NULL,
- "r5", &ddb_regs.r5, FCN_NULL,
- "r6", &ddb_regs.r6, FCN_NULL,
- "r7", &ddb_regs.r7, FCN_NULL,
- "r8", &ddb_regs.r8, FCN_NULL,
- "r9", &ddb_regs.r9, FCN_NULL,
- "r10", &ddb_regs.r10, FCN_NULL,
- "r11", &ddb_regs.r11, FCN_NULL,
- "ap", &ddb_regs.ap, FCN_NULL,
- "fp", &ddb_regs.fp, FCN_NULL,
- "sp", &ddb_regs.sp, FCN_NULL,
- "pc", &ddb_regs.pc, FCN_NULL,
- "psl", &ddb_regs.psl, FCN_NULL,
+ {"r0", &ddb_regs.r0, FCN_NULL},
+ {"r1", &ddb_regs.r1, FCN_NULL},
+ {"r2", &ddb_regs.r2, FCN_NULL},
+ {"r3", &ddb_regs.r3, FCN_NULL},
+ {"r4", &ddb_regs.r4, FCN_NULL},
+ {"r5", &ddb_regs.r5, FCN_NULL},
+ {"r6", &ddb_regs.r6, FCN_NULL},
+ {"r7", &ddb_regs.r7, FCN_NULL},
+ {"r8", &ddb_regs.r8, FCN_NULL},
+ {"r9", &ddb_regs.r9, FCN_NULL},
+ {"r10", &ddb_regs.r10, FCN_NULL},
+ {"r11", &ddb_regs.r11, FCN_NULL},
+ {"ap", &ddb_regs.ap, FCN_NULL},
+ {"fp", &ddb_regs.fp, FCN_NULL},
+ {"sp", &ddb_regs.sp, FCN_NULL},
+ {"pc", &ddb_regs.pc, FCN_NULL},
+ {"psl", &ddb_regs.psl, FCN_NULL},
};
struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
@@ -206,7 +214,7 @@ db_stack_trace_cmd(addr, have_addr, count, modif)
db_expr_t count;
char *modif;
{
- printf("db_stack_trace_cmd - addr %x, have_addr %x, count %x, modif %x\n",addr, have_addr, count, modif);
+ printf("db_stack_trace_cmd - addr %x, have_addr %x, count %x, modif %x\n",addr, have_addr, count, (int)modif);
}
static int ddbescape = 0;
diff --git a/sys/arch/vax/vax/disksubr.c b/sys/arch/vax/vax/disksubr.c
index 99be68c5613..a81294004b7 100644
--- a/sys/arch/vax/vax/disksubr.c
+++ b/sys/arch/vax/vax/disksubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.7 1996/01/28 12:14:48 ragge Exp $ */
+/* $NetBSD: disksubr.c,v 1.9 1996/04/08 18:32:35 ragge Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -35,13 +35,15 @@
* @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
*/
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "dkbad.h"
-#include "disklabel.h"
-#include "syslog.h"
-#include "machine/macros.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/dkbad.h>
+#include <sys/disklabel.h>
+#include <sys/syslog.h>
+#include <sys/cpu.h>
+
+#include <machine/macros.h>
/* XXX encoding of disk minor numbers, should be elsewhere... */
#define dkunit(dev) (minor(dev) >> 3)
@@ -50,6 +52,11 @@
#define b_cylin b_resid
+int cpu_setdisklabel __P((struct disklabel *, struct disklabel *, u_long,
+ struct cpu_disklabel *));
+int cpu_writedisklabel __P((dev_t, void (*)(struct buf *),
+ struct disklabel *, struct cpu_disklabel *));
+
/*
* Determine the size of the transfer, and make sure it is
* within the boundaries of the partition. Adjust transfer
@@ -104,6 +111,7 @@ bad:
* Check new disk label for sensibility
* before setting it.
*/
+int
setdisklabel(olp, nlp, openmask, osdep)
register struct disklabel *olp, *nlp;
u_long openmask;
@@ -116,9 +124,10 @@ setdisklabel(olp, nlp, openmask, osdep)
/*
* Write disk label back to device after modification.
*/
+int
writedisklabel(dev, strat, lp, osdep)
dev_t dev;
- void (*strat)();
+ void (*strat) __P((struct buf *));
register struct disklabel *lp;
struct cpu_disklabel *osdep;
{
@@ -139,7 +148,7 @@ writedisklabel(dev, strat, lp, osdep)
char *
readdisklabel(dev, strat, lp, osdep)
dev_t dev;
- void (*strat)();
+ void (*strat) __P((struct buf *));
register struct disklabel *lp;
struct cpu_disklabel *osdep;
{
@@ -187,6 +196,7 @@ readdisklabel(dev, strat, lp, osdep)
* Check new disk label for sensibility
* before setting it.
*/
+int
cpu_setdisklabel(olp, nlp, openmask, osdep)
register struct disklabel *olp, *nlp;
u_long openmask;
@@ -231,9 +241,10 @@ cpu_setdisklabel(olp, nlp, openmask, osdep)
/*
* Write disk label back to device after modification.
*/
+int
cpu_writedisklabel(dev, strat, lp, osdep)
dev_t dev;
- int (*strat)();
+ void (*strat) __P((struct buf *));
register struct disklabel *lp;
struct cpu_disklabel *osdep;
{
@@ -254,7 +265,7 @@ cpu_writedisklabel(dev, strat, lp, osdep)
bp->b_bcount = lp->d_secsize;
bp->b_flags = B_READ;
(*strat)(bp);
- if (error = biowait(bp))
+ if ((error = biowait(bp)))
goto done;
for (dlp = (struct disklabel *)bp->b_un.b_addr;
dlp <= (struct disklabel *)
diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c
index cfe1b9c2cfc..63bd67ec238 100644
--- a/sys/arch/vax/vax/gencons.c
+++ b/sys/arch/vax/vax/gencons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: gencons.c,v 1.7 1996/01/28 12:11:57 ragge Exp $ */
+/* $NetBSD: gencons.c,v 1.10 1996/04/08 18:32:36 ragge Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -35,27 +35,41 @@
/* All bugs are subject to removal without further notice */
-#include "sys/param.h"
-#include "sys/proc.h"
-#include "sys/systm.h"
-#include "sys/ioctl.h"
-#include "sys/tty.h"
-#include "sys/file.h"
-#include "sys/conf.h"
-#include "sys/device.h"
-#include "sys/reboot.h"
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/file.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+#include <sys/reboot.h>
-#include "dev/cons.h"
+#include <dev/cons.h>
-#include "machine/mtpr.h"
-#include "machine/../vax/gencons.h"
+#include <machine/mtpr.h>
+#include <machine/cpu.h>
+#include <machine/../vax/gencons.h>
struct tty *gencn_tty[1];
-int consinied = 0;
-
-int gencnparam();
-void gencnstart();
+int consinied = 0;
+
+int gencnparam __P((struct tty *, struct termios *));
+void gencnstart __P((struct tty *));
+int gencnopen __P((dev_t, int, int, struct proc *));
+int gencnclose __P((dev_t, int, int, struct proc *));
+int gencnread __P((dev_t, struct uio *, int));
+int gencnwrite __P((dev_t, struct uio *, int));
+int gencnioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
+int gencngetc __P((dev_t));
+void gencnprobe __P((struct consdev *));
+void gencninit __P((struct consdev *));
+struct tty *gencntty __P((dev_t));
+void gencnrint __P((void));
+void gencntint __P((void));
+int gencnstop __P((struct tty *, int));
+void gencnslask __P((void));
int
gencnopen(dev, flag, mode, p)
@@ -99,7 +113,6 @@ gencnclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
- int unit = minor(dev);
struct tty *tp = gencn_tty[0];
(*linesw[tp->t_line].l_close)(tp, flag);
@@ -120,7 +133,6 @@ gencnread(dev, uio, flag)
struct uio *uio;
int flag;
{
- int unit = minor(dev);
struct tty *tp = gencn_tty[0];
return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
@@ -132,7 +144,6 @@ gencnwrite(dev, uio, flag)
struct uio *uio;
int flag;
{
- int unit = minor(dev);
struct tty *tp = gencn_tty[0];
return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
@@ -140,13 +151,12 @@ gencnwrite(dev, uio, flag)
int
gencnioctl(dev, cmd, data, flag, p)
dev_t dev;
- int cmd;
+ u_long cmd;
caddr_t data;
int flag;
struct proc *p;
{
int error;
- int unit = minor(dev);
struct tty *tp = gencn_tty[0];
error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
@@ -185,13 +195,14 @@ gencnstart(tp)
out: splx(s);
}
+void
gencnrint()
{
struct tty *tp;
int i, j;
tp = gencn_tty[0];
- i = mfpr(PR_RXDB);
+ i = mfpr(PR_RXDB) & 0377; /* Mask status flags etc... */
#ifdef DDB
j = kdbrint(i);
@@ -212,8 +223,10 @@ gencnstop(tp, flag)
struct tty *tp;
int flag;
{
+ return 0;
}
+void
gencntint()
{
struct tty *tp;
@@ -236,7 +249,7 @@ gencnparam(tp, t)
return 0;
}
-int
+void
gencnprobe(cndev)
struct consdev *cndev;
{
@@ -248,21 +261,21 @@ gencnprobe(cndev)
cndev->cn_pri = CN_NORMAL;
break;
}
- return 0;
}
-int
+void
gencninit(cndev)
struct consdev *cndev;
{
}
+void
gencnslask()
{
gencn_tty[0] = ttymalloc();
}
-int
+void
gencnputc(dev,ch)
dev_t dev;
int ch;
@@ -288,10 +301,3 @@ gencngetc(dev)
i = 10;
return i;
}
-
-conout(str)
- char *str;
-{
- while (*str)
- gencnputc(0, *str++);
-}
diff --git a/sys/arch/vax/vax/gencons.h b/sys/arch/vax/vax/gencons.h
index cd985437709..b1385a33fa2 100644
--- a/sys/arch/vax/vax/gencons.h
+++ b/sys/arch/vax/vax/gencons.h
@@ -1,4 +1,4 @@
-/* $NetBSD: gencons.h,v 1.3 1995/06/05 16:26:38 ragge Exp $ */
+/* $NetBSD: gencons.h,v 1.5 1996/04/08 18:32:37 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -41,6 +41,10 @@
/* PR_TXCS */
#define GC_RDY 0x80 /* Console ready to xmit chr */
#define GC_TIE 0x40 /* xmit interrupt enable */
+#if VAX8600
+#define GC_LT 0x80000 /* Enable logical terminal */
+#define GC_WRT 0x8000 /* Allow mtpr's to console */
+#endif
/* PR_RXCS */
#define GC_DON 0x80 /* character received */
@@ -53,3 +57,6 @@
/* PR_TXDB */
#define GC_BOOT 0xf02 /* boot machine */
#define GC_CCF 0xf04 /* clear cold start flag */
+
+/* Prototypes */
+void gencnputc __P((dev_t, int));
diff --git a/sys/arch/vax/vax/in_cksum.c b/sys/arch/vax/vax/in_cksum.c
new file mode 100644
index 00000000000..fa336ba344a
--- /dev/null
+++ b/sys/arch/vax/vax/in_cksum.c
@@ -0,0 +1,152 @@
+/* $NetBSD: in_cksum.c,v 1.2 1996/04/08 18:32:38 ragge Exp $ */
+
+/*
+ * Copyright (c) 1988, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93
+ */
+
+#include <sys/param.h>
+#include <sys/mbuf.h>
+#include <sys/systm.h>
+
+#include <netinet/in.h>
+
+/*
+ * Checksum routine for Internet Protocol family headers.
+ *
+ * This routine is very heavily used in the network
+ * code and should be modified for each CPU to be as fast as possible.
+ *
+ * This implementation is VAX version.
+ */
+
+#define REDUCE {sum = (sum & 0xffff) + (sum >> 16);}
+#define ADDCARRY {if (sum > 0xffff) sum -= 0xffff;}
+#define ADVANCE(n) {w += n; mlen -= n;}
+#define SWAP {sum <<= 8;} /* depends on recent REDUCE */
+
+#define Asm __asm __volatile
+#define ADDL Asm("addl2 (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
+#define ADWC Asm("adwc (%2)+,%0" : "=r" (sum) : "0" (sum), "r" (w))
+#define ADDC Asm("adwc $0,%0" : "=r" (sum) : "0" (sum))
+#define UNSWAP Asm("rotl $8,%0,%0" : "=r" (sum) : "0" (sum))
+#define ADDBYTE {sum += *w; SWAP; byte_swapped ^= 1;}
+#define ADDWORD {sum += *(u_short *)w;}
+
+int
+in_cksum(m, len)
+ register struct mbuf *m;
+ register int len;
+{
+ register u_char *w;
+ register u_int sum = 0;
+ register int mlen = 0;
+ int byte_swapped = 0;
+
+ for (;m && len; m = m->m_next) {
+ if ((mlen = m->m_len) == 0)
+ continue;
+ w = mtod(m, u_char *);
+ if (len < mlen)
+ mlen = len;
+ len -= mlen;
+ if (mlen < 16)
+ goto short_mbuf;
+ /*
+ * Ensure that we're aligned on a word boundary here so
+ * that we can do 32 bit operations below.
+ */
+ if ((3 & (long)w) != 0) {
+ REDUCE;
+ if ((1 & (long)w) != 0) {
+ ADDBYTE;
+ ADVANCE(1);
+ }
+ if ((2 & (long)w) != 0) {
+ ADDWORD;
+ ADVANCE(2);
+ }
+ }
+ /*
+ * Do as much of the checksum as possible 32 bits at at time.
+ * In fact, this loop is unrolled to make overhead from
+ * branches &c small.
+ */
+ while ((mlen -= 32) >= 0) {
+ /*
+ * Add with carry 16 words and fold in the last carry
+ * by adding a 0 with carry.
+ */
+ ADDL; ADWC; ADWC; ADWC;
+ ADWC; ADWC; ADWC; ADWC;
+ ADDC;
+ }
+ mlen += 32;
+ if (mlen >= 16) {
+ ADDL; ADWC; ADWC; ADWC;
+ ADDC;
+ mlen -= 16;
+ }
+ short_mbuf:
+ if (mlen >= 8) {
+ ADDL; ADWC;
+ ADDC;
+ mlen -= 8;
+ }
+ if (mlen >= 4) {
+ ADDL;
+ ADDC;
+ mlen -= 4;
+ }
+ if (mlen > 0) {
+ REDUCE;
+ if (mlen >= 2) {
+ ADDWORD;
+ ADVANCE(2);
+ }
+ if (mlen >= 1) {
+ ADDBYTE;
+ }
+ }
+ }
+
+ if (len)
+ printf("cksum: out of data\n");
+ if (byte_swapped) {
+ UNSWAP;
+ }
+ REDUCE;
+ ADDCARRY;
+ return (sum ^ 0xffff);
+}
+
diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s
index 1e740e0d41e..8c0939381f2 100644
--- a/sys/arch/vax/vax/intvec.s
+++ b/sys/arch/vax/vax/intvec.s
@@ -1,4 +1,4 @@
-/* $NetBSD: intvec.s,v 1.13 1996/01/28 12:22:55 ragge Exp $ */
+/* $NetBSD: intvec.s,v 1.19 1996/03/09 23:36:40 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -34,22 +34,43 @@
-#include "machine/mtpr.h"
-#include "machine/pte.h"
-#include "machine/trap.h"
-
-#define TRAPCALL(namn, typ) \
- .align 2; namn ## :;.globl namn ;pushl $0; pushl $typ; jbr trap;
+#include <machine/mtpr.h>
+#include <machine/pte.h>
+#include <machine/trap.h>
+
+#define ENTRY(name) \
+ .text ; \
+ .align 2 ; \
+ .globl name ; \
+name /**/:
+
+#define TRAPCALL(namn, typ) \
+ENTRY(namn) ; \
+ pushl $0 ; \
+ pushl $typ ; \
+ jbr trap
+
+#define TRAPARGC(namn, typ) \
+ENTRY(namn) ; \
+ pushl $typ ; \
+ jbr trap
+
+#define FASTINTR(namn, rutin) \
+ENTRY(namn) ; \
+ pushr $0x3f ; \
+ calls $0,_/**/rutin ; \
+ popr $0x3f ; \
+ rei
-#define TRAPARGC(namn, typ) \
- .align 2; namn ## :;.globl namn ; pushl $typ; jbr trap;
+#define STRAY(scbnr, vecnr) \
+ENTRY(stray/**/vecnr) ; \
+ pushr $0x3f ; \
+ pushl $/**/0x/**/vecnr ; \
+ pushl $scbnr ; \
+ calls $2,_stray ; \
+ popr $0x3f ; \
+ rei
-#define FASTINTR(namn, rutin) \
- .align 2; namn ## :;.globl namn ;pushr $0x3f; \
- calls $0,_ ## rutin ;popr $0x3f;rei
-#define STRAY(scbnr,vecnr) \
- .align 2;stray ## vecnr ## :;pushr $0x3f;pushl $ ## 0x ## vecnr; \
- pushl $scbnr; calls $2,_stray ; popr $0x3f; rei;
#define KSTACK 0
#define ISTACK 1
#define INTVEC(label,stack) \
@@ -89,7 +110,7 @@ _rpb:
INTVEC(stray50, ISTACK) # System Backplane Exception, 50
INTVEC(cmrerr, ISTACK) # Corrected Memory Read, 54
INTVEC(stray58, ISTACK) # System Backplane Alert, 58
- INTVEC(stray5C, ISTACK) # System Backplane Fault, 5C
+ INTVEC(sbiflt, ISTACK) # System Backplane Fault, 5C
INTVEC(stray60, ISTACK) # Memory Write Timeout, 60
INTVEC(stray64, ISTACK) # Unused, 64
INTVEC(stray68, ISTACK) # Unused, 68
@@ -126,20 +147,15 @@ _rpb:
INTVEC(strayE4, ISTACK) # Unused, E4
INTVEC(strayE8, ISTACK) # Unused, E8
INTVEC(strayEC, ISTACK) # Unused, EC
-#ifdef VAX750
- INTVEC(cstrint, ISTACK) # Console Storage Recieve Interrupt
- INTVEC(csttint, ISTACK) # Console Storage Transmit Interrupt
-#else
INTVEC(strayF0, ISTACK)
INTVEC(strayF4, ISTACK)
-#endif
INTVEC(consrint, ISTACK) # Console Terminal Recieve Interrupt
INTVEC(constint, ISTACK) # Console Terminal Transmit Interrupt
/* space for adapter vectors */
.space 0x100
- STRAY(0, 00)
+ STRAY(0,00)
.align 2
#
@@ -161,15 +177,27 @@ mcheck: .globl mcheck
rei
L4: addl2 (sp)+,sp # remove info pushed on stack
- mtpr $0xF,$PR_MCESR # clear the bus error bit
- movl _memtest,(sp) # REI to new adress
+ cmpl _cpunumber, $1 # Is it a 11/780?
+ bneq 1f # No...
+
+ mtpr $0, $PR_SBIFS # Clear SBI fault register
+ brb 2f
+
+1: cmpl _cpunumber, $4 # Is it a 8600?
+ bneq 3f
+
+ mtpr $0, $PR_EHSR # Clear Error status register
+ brb 2f
+
+3: mtpr $0xF,$PR_MCESR # clear the bus error bit
+2: movl _memtest,(sp) # REI to new adress
rei
TRAPCALL(invkstk, T_KSPNOTVAL)
- STRAY(0, 0C)
+ STRAY(0,0C)
TRAPCALL(privinflt, T_PRIVINFLT)
- STRAY(0, 14)
+ STRAY(0,14)
TRAPCALL(resopflt, T_RESOPFLT)
TRAPCALL(resadflt, T_RESADFLT)
@@ -196,12 +224,12 @@ ptelen: movl $T_PTELEN, (sp) # PTE must expand (or send segv)
TRAPCALL(tracep, T_TRCTRAP)
TRAPCALL(breakp, T_BPTFLT)
- STRAY(0, 30)
+ STRAY(0,30)
TRAPARGC(arithflt, T_ARITHFLT)
- STRAY(0, 38)
- STRAY(0, 3C)
+ STRAY(0,38)
+ STRAY(0,3C)
@@ -225,42 +253,45 @@ syscall:
mtpr $0x1f, $PR_IPL # Be sure we can REI
rei
- STRAY(0, 44)
- STRAY(0, 48)
- STRAY(0, 4C)
- STRAY(0, 50)
- FASTINTR(cmrerr, cmrerr)
- STRAY(0, 58)
- STRAY(0, 5C)
- STRAY(0, 60)
- STRAY(0, 64)
- STRAY(0, 68)
- STRAY(0, 6C)
- STRAY(0, 70)
- STRAY(0, 74)
- STRAY(0, 78)
- STRAY(0, 7C)
- STRAY(0, 80)
- STRAY(0, 84)
+ STRAY(0,44)
+ STRAY(0,48)
+ STRAY(0,4C)
+ STRAY(0,50)
+ FASTINTR(cmrerr,cmrerr)
+ STRAY(0,58)
+ ENTRY(sbiflt);
+ moval sbifltmsg, -(sp)
+ calls $1, _panic
+
+ STRAY(0,60)
+ STRAY(0,64)
+ STRAY(0,68)
+ STRAY(0,6C)
+ STRAY(0,70)
+ STRAY(0,74)
+ STRAY(0,78)
+ STRAY(0,7C)
+ STRAY(0,80)
+ STRAY(0,84)
TRAPCALL(astintr, T_ASTFLT)
- STRAY(0, 8C)
- STRAY(0, 90)
- STRAY(0, 94)
- STRAY(0, 98)
- STRAY(0, 9C)
+ STRAY(0,8C)
+ STRAY(0,90)
+ STRAY(0,94)
+ STRAY(0,98)
+ STRAY(0,9C)
- FASTINTR(softclock, softclock)
+ FASTINTR(softclock,softclock)
- STRAY(0, A4)
- STRAY(0, A8)
- STRAY(0, AC)
+ STRAY(0,A4)
+ STRAY(0,A8)
+ STRAY(0,AC)
- FASTINTR(netint, netintr) #network packet interrupt
+ FASTINTR(netint,netintr) #network packet interrupt
- STRAY(0, B4)
- STRAY(0, B8)
+ STRAY(0,B4)
+ STRAY(0,B8)
TRAPCALL(ddbtrap, T_KDBTRAP)
.align 2
@@ -273,27 +304,21 @@ hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag
popr $0x3f
rei
- STRAY(0, C4)
- STRAY(0, CC)
- STRAY(0, D0)
- STRAY(0, D4)
- STRAY(0, D8)
- STRAY(0, DC)
- STRAY(0, E0)
- STRAY(0, E4)
- STRAY(0, E8)
- STRAY(0, EC)
-
-#ifdef VAX750
- FASTINTR(cstrint, cturintr)
- FASTINTR(csttint, ctutintr)
-#else
- STRAY(0, F0)
- STRAY(0, F4)
-#endif
-
- FASTINTR(consrint, gencnrint)
- FASTINTR(constint, gencntint)
+ STRAY(0,C4)
+ STRAY(0,CC)
+ STRAY(0,D0)
+ STRAY(0,D4)
+ STRAY(0,D8)
+ STRAY(0,DC)
+ STRAY(0,E0)
+ STRAY(0,E4)
+ STRAY(0,E8)
+ STRAY(0,EC)
+ STRAY(0,F0)
+ STRAY(0,F4)
+
+ FASTINTR(consrint,gencnrint)
+ FASTINTR(constint,gencntint)
/*
* Main routine for traps; all go through this.
@@ -317,6 +342,9 @@ _sret: movl (sp)+, fp
mtpr $0x1f, $PR_IPL # Be sure we can REI
rei
+sbifltmsg:
+ .asciz "SBI fault",0
+
#if VAX630 || VAX650
/*
* Table of emulated Microvax instructions supported by emulate.s.
diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c
index b943600bd74..be709787e56 100644
--- a/sys/arch/vax/vax/ka650.c
+++ b/sys/arch/vax/vax/ka650.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ka650.c,v 1.1 1995/12/13 18:45:52 ragge Exp $ */
+/* $NetBSD: ka650.c,v 1.3 1996/04/08 18:32:41 ragge Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
@@ -41,19 +41,19 @@
* vax650-specific code.
*/
-#include "sys/param.h"
-#include "sys/time.h"
-#include "sys/kernel.h"
-#include "sys/systm.h"
-#include "sys/device.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
-#include "machine/ka650.h"
-#include "machine/cpu.h"
-#include "machine/psl.h"
-#include "machine/mtpr.h"
-#include "machine/nexus.h"
+#include <machine/ka650.h>
+#include <machine/cpu.h>
+#include <machine/psl.h>
+#include <machine/mtpr.h>
+#include <machine/nexus.h>
struct ka650_merr *ka650merr_ptr;
struct ka650_cbd *ka650cbd_ptr;
@@ -62,6 +62,9 @@ struct ka650_ipcr *ka650ipcr_ptr;
int *KA650_CACHE_ptr;
static int subtyp;
+void ka650encache __P((void));
+void ka650discache __P((void));
+
/*
* uvaxIII_conf() is called by cpu_attach to do the cpu_specific setup.
*/
@@ -80,11 +83,12 @@ uvaxIII_conf(parent, self, aux)
ka650encache();
if (ctob(physmem) > ka650merr_ptr->merr_qbmbr) {
printf("physmem(0x%x) > qbmbr(0x%x)\n",
- ctob(physmem), ka650merr_ptr->merr_qbmbr);
+ ctob(physmem), (int)ka650merr_ptr->merr_qbmbr);
panic("qbus map unprotected");
}
}
+void
uvaxIII_steal_pages()
{
extern vm_offset_t avail_start, virtual_avail, avail_end;
@@ -125,15 +129,16 @@ uvaxIII_steal_pages()
jon = (int *)0x20040004;
subtyp = *jon;
- return 0;
}
+int
uvaxIII_clock()
{
mtpr(0x40, PR_ICCS); /* Start clock and enable interrupt */
return 1;
}
+void
uvaxIII_memerr()
{
printf("memory err!\n");
@@ -193,6 +198,7 @@ struct mc650frame {
int mc65_psl; /* trapped psl */
};
+int
uvaxIII_mchk(cmcf)
caddr_t cmcf;
{
@@ -209,8 +215,9 @@ uvaxIII_mchk(cmcf)
mcf->mc65_mrvaddr, mcf->mc65_istate1, mcf->mc65_istate2,
mcf->mc65_pc, mcf->mc65_psl);
printf("dmaser=0x%b qbear=0x%x dmaear=0x%x\n",
- ka650merr_ptr->merr_dser, DMASER_BITS, ka650merr_ptr->merr_qbear,
- ka650merr_ptr->merr_dear);
+ ka650merr_ptr->merr_dser, DMASER_BITS,
+ (int)ka650merr_ptr->merr_qbear,
+ (int)ka650merr_ptr->merr_dear);
ka650merr_ptr->merr_dser = DSER_CLEAR;
i = mfpr(PR_CAER);
@@ -259,6 +266,7 @@ uvaxIII_mchk(cmcf)
* 2nd level cache (by writing to each quadword entry), then enable it.
* Enable 1st level cache too.
*/
+void
ka650encache()
{
register int i;
@@ -270,6 +278,7 @@ ka650encache()
mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
}
+void
ka650discache()
{
mtpr(0, PR_CADR);
diff --git a/sys/arch/vax/vax/ka750.c b/sys/arch/vax/vax/ka750.c
index 180523c50b6..fbcf608c377 100644
--- a/sys/arch/vax/vax/ka750.c
+++ b/sys/arch/vax/vax/ka750.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ka750.c,v 1.8 1995/12/13 18:50:34 ragge Exp $ */
+/* $NetBSD: ka750.c,v 1.12 1996/04/08 18:32:42 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
@@ -37,18 +37,23 @@
* @(#)autoconf.c 7.20 (Berkeley) 5/9/91
*/
-#include "sys/param.h"
-#include "sys/types.h"
-#include "sys/device.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/systm.h>
-#include "machine/ka750.h"
-#include "machine/pte.h"
-#include "machine/cpu.h"
-#include "machine/mtpr.h"
-#include "vax/uba/ubavar.h"
-#include "vax/uba/ubareg.h"
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+
+#include <machine/ka750.h>
+#include <machine/pte.h>
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/scb.h>
+#include <vax/uba/ubavar.h>
+#include <vax/uba/ubareg.h>
+
+void ctuattach __P((void));
/*
* ka750_conf() is called by cpu_attach to do the cpu_specific setup.
@@ -58,7 +63,7 @@ ka750_conf(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- extern char cpu_model[];
+ extern char cpu_model[];
strcpy(cpu_model,"VAX 11/750");
printf(": 11/750, hardware rev %d, ucode rev %d\n",
@@ -69,6 +74,9 @@ ka750_conf(parent, self, aux)
mtpr(0x8000, PR_ACCS);
} else
printf("no FPA\n");
+
+ /* Call ctuattach() here so it can setup its vectors. */
+ ctuattach();
}
/*
@@ -114,34 +122,48 @@ struct mcr750 {
#define M750_ADDR(err) (((err) >> 9) & 0x7fff)
/* enable crd interrupts */
+void
ka750_memenable(sa,self)
struct sbi_attach_args *sa;
struct device *self;
{
- extern int nmcr;
- int k,l,m,cardinfo;
- struct mcr750 *mcr=(struct mcr750 *)sa->nexaddr;
+ int k, l, m, cardinfo;
+ struct mcr750 *mcr = (struct mcr750 *)sa->nexaddr;
- mcraddr[self->dv_unit]=(caddr_t)sa->nexaddr;
+ mcraddr[self->dv_unit] = (caddr_t)sa->nexaddr;
/* We will use this info for error reporting - later! */
- cardinfo=mcr->mc_inf;
- switch((cardinfo>>24)&3){
+ cardinfo = mcr->mc_inf;
+ switch ((cardinfo >> 24) & 3) {
case 0: printf(": L0011 ");
break;
+
case 1: printf(": L0016 ");
- m=cardinfo&0xaaaa;
- for(k=l=0;k<16;k++){if(m&1)l++;m>>=1;}
+ m = cardinfo & 0xaaaa;
+ for (k = l = 0; k < 16; k++){
+ if (m & 1)
+ l++;
+ m >>= 1;
+ }
printf("with %d M8750",l);
break;
+
case 3: printf(": L0022 ");
- m=cardinfo&0x5555;
- for(k=l=0;k<16;k++){if(m&1)l++;m>>=1;}
+ m = cardinfo & 0x5555;
+ for (k = l = 0; k < 16; k++) {
+ if (m & 1)
+ l++;
+ m>>=1;
+ }
printf("with %d M7199",l);
- m=cardinfo&0xaaaa;
- if(m){
- for(k=l=0;k<16;k++){if(m&1)l++;m>>=1;}
- printf(" and %d M8750",l);
+ m = cardinfo & 0xaaaa;
+ if (m) {
+ for (k = l = 0; k < 16; k++) {
+ if (m & 1)
+ l++;
+ m >>= 1;
+ }
+ printf(" and %d M8750",l);
}
break;
}
@@ -152,6 +174,7 @@ ka750_memenable(sa,self)
}
/* log crd errors */
+void
ka750_memerr()
{
register struct mcr750 *mcr = (struct mcr750 *)mcraddr[0];
@@ -188,6 +211,7 @@ struct mc750frame {
#define MC750_TBERR 2 /* type code of cp tbuf par */
#define MC750_TBPAR 4 /* tbuf par bit in mcesr */
+int
ka750_mchk(cmcf)
caddr_t cmcf;
{
@@ -208,11 +232,12 @@ ka750_mchk(cmcf)
mtpr(0xf, PR_MCESR);
if (type == MC750_TBERR && (mcf->mc5_mcesr&0xe) == MC750_TBPAR) {
printf("tbuf par: flushing and returning\n");
- return (0);
+ return (MCHK_RECOVERED);
}
- return (-1);
+ return (MCHK_PANIC);
}
+void
ka750_steal_pages()
{
extern vm_offset_t avail_start, virtual_avail;
@@ -228,7 +253,5 @@ ka750_steal_pages()
MAPVIRT(nexus, btoc(NEX750SZ));
pmap_map((vm_offset_t)nexus, NEX750, NEX750 + NEX750SZ,
VM_PROT_READ|VM_PROT_WRITE);
-
- return 0;
}
diff --git a/sys/arch/vax/vax/ka780.c b/sys/arch/vax/vax/ka780.c
new file mode 100644
index 00000000000..7eb7e0569b8
--- /dev/null
+++ b/sys/arch/vax/vax/ka780.c
@@ -0,0 +1,341 @@
+/* $NetBSD: ka780.c,v 1.3 1996/04/08 18:32:43 ragge Exp $ */
+/*-
+ * Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)ka780.c 7.4 (Berkeley) 5/9/91
+ */
+
+/*
+ * 780-specific code.
+ */
+
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/device.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/scb.h>
+#include <machine/nexus.h>
+#include <vax/uba/ubavar.h>
+#include <vax/uba/ubareg.h>
+
+/* Prototypes. XXX These should be somewhere else */
+void ka780_conf __P((struct device *, struct device *, void *));
+int ka780_clock __P((void));
+void ka780_memenable __P((struct sbi_attach_args *, void *));
+void ka780_memerr __P((void));
+int ka780_mchk __P((caddr_t));
+void ka780_steal_pages __P((void));
+
+/*
+ * Memory controller register usage varies per controller.
+ */
+struct mcr780 {
+ int mc_reg[4];
+};
+
+#define M780_ICRD 0x40000000 /* inhibit crd interrupts, in [2] */
+#define M780_HIER 0x20000000 /* high error rate, in reg[2] */
+#define M780_ERLOG 0x10000000 /* error log request, in reg[2] */
+/* on a 780, memory crd's occur only when bit 15 is set in the SBIER */
+/* register; bit 14 there is an error bit which we also clear */
+/* these bits are in the back of the ``red book'' (or in the VMS code) */
+
+#define M780C_INH(mcr) \
+ ((mcr)->mc_reg[2] = (M780_ICRD|M780_HIER|M780_ERLOG)); \
+ mtpr(0, PR_SBIER);
+#define M780C_ENA(mcr) \
+ ((mcr)->mc_reg[2] = (M780_HIER|M780_ERLOG)); mtpr(3<<14, PR_SBIER);
+#define M780C_ERR(mcr) \
+ ((mcr)->mc_reg[2] & (M780_ERLOG))
+
+#define M780C_SYN(mcr) ((mcr)->mc_reg[2] & 0xff)
+#define M780C_ADDR(mcr) (((mcr)->mc_reg[2] >> 8) & 0xfffff)
+
+#define M780EL_INH(mcr) \
+ ((mcr)->mc_reg[2] = (M780_ICRD|M780_HIER|M780_ERLOG)); \
+ mtpr(0, PR_SBIER);
+#define M780EL_ENA(mcr) \
+ ((mcr)->mc_reg[2] = (M780_HIER|M780_ERLOG)); mtpr(3<<14, PR_SBIER);
+#define M780EL_ERR(mcr) \
+ ((mcr)->mc_reg[2] & (M780_ERLOG))
+
+#define M780EL_SYN(mcr) ((mcr)->mc_reg[2] & 0x7f)
+#define M780EL_ADDR(mcr) (((mcr)->mc_reg[2] >> 11) & 0x1ffff)
+
+#define M780EU_INH(mcr) \
+ ((mcr)->mc_reg[3] = (M780_ICRD|M780_HIER|M780_ERLOG)); \
+ mtpr(0, PR_SBIER);
+#define M780EU_ENA(mcr) \
+ ((mcr)->mc_reg[3] = (M780_HIER|M780_ERLOG)); mtpr(3<<14, PR_SBIER);
+#define M780EU_ERR(mcr) \
+ ((mcr)->mc_reg[3] & (M780_ERLOG))
+
+#define M780EU_SYN(mcr) ((mcr)->mc_reg[3] & 0x7f)
+#define M780EU_ADDR(mcr) (((mcr)->mc_reg[3] >> 11) & 0x1ffff)
+
+/* enable crd interrrupts */
+void
+ka780_memenable(sa, osc)
+ struct sbi_attach_args *sa;
+ void *osc;
+{
+ struct mem_softc *sc = osc;
+ register struct mcr780 *mcr = (void *)sc->sc_memaddr;
+
+ printf(": ");
+ switch (sc->sc_memtype) {
+
+ case M780C:
+ printf("standard");
+ M780C_ENA(mcr);
+ break;
+
+ case M780EL:
+ printf("(el) ");
+ M780EL_ENA(mcr);
+ if (sc->sc_memnr != NEX_MEM64I && sc->sc_memnr != NEX_MEM256I)
+ break;
+
+ case M780EU:
+ printf("(eu)");
+ M780EU_ENA(mcr);
+ break;
+ }
+ printf("\n");
+}
+
+/* log crd errors */
+void
+ka780_memerr()
+{
+ extern struct cfdriver mem_cd;
+ struct mem_softc *sc;
+ register struct mcr780 *mcr;
+ register int m;
+
+ for (m = 0; m < mem_cd.cd_ndevs; m++) {
+ if (mem_cd.cd_devs[m] == 0)
+ continue;
+
+ sc = (void *)mem_cd.cd_devs[m];
+ mcr = (struct mcr780 *)sc->sc_memaddr;
+ switch (sc->sc_memtype) {
+
+ case M780C:
+ if (M780C_ERR(mcr)) {
+ printf("%s: soft ecc addr %x syn %x\n",
+ sc->sc_dev.dv_xname, M780C_ADDR(mcr),
+ M780C_SYN(mcr));
+#ifdef TRENDATA
+ memlog(m, mcr);
+#endif
+ M780C_INH(mcr);
+ }
+ break;
+
+ case M780EL:
+ if (M780EL_ERR(mcr)) {
+ printf("%s: soft ecc addr %x syn %x\n",
+ sc->sc_dev.dv_xname, M780EL_ADDR(mcr),
+ M780EL_SYN(mcr));
+ M780EL_INH(mcr);
+ }
+ if (sc->sc_memnr != NEX_MEM64I &&
+ sc->sc_memnr != NEX_MEM256I)
+ break;
+
+ case M780EU:
+ if (M780EU_ERR(mcr)) {
+ printf("%s: soft ecc addr %x syn %x\n",
+ sc->sc_dev.dv_xname, M780EU_ADDR(mcr),
+ M780EU_SYN(mcr));
+ M780EU_INH(mcr);
+ }
+ break;
+ }
+ }
+}
+
+#ifdef TRENDATA
+/*
+ * Figure out what chip to replace on Trendata boards.
+ * Assumes all your memory is Trendata or the non-Trendata
+ * memory never fails..
+ */
+struct {
+ u_char m_syndrome;
+ char m_chip[4];
+} memlogtab[] = {
+ 0x01, "C00", 0x02, "C01", 0x04, "C02", 0x08, "C03",
+ 0x10, "C04", 0x19, "L01", 0x1A, "L02", 0x1C, "L04",
+ 0x1F, "L07", 0x20, "C05", 0x38, "L00", 0x3B, "L03",
+ 0x3D, "L05", 0x3E, "L06", 0x40, "C06", 0x49, "L09",
+ 0x4A, "L10", 0x4c, "L12", 0x4F, "L15", 0x51, "L17",
+ 0x52, "L18", 0x54, "L20", 0x57, "L23", 0x58, "L24",
+ 0x5B, "L27", 0x5D, "L29", 0x5E, "L30", 0x68, "L08",
+ 0x6B, "L11", 0x6D, "L13", 0x6E, "L14", 0x70, "L16",
+ 0x73, "L19", 0x75, "L21", 0x76, "L22", 0x79, "L25",
+ 0x7A, "L26", 0x7C, "L28", 0x7F, "L31", 0x80, "C07",
+ 0x89, "U01", 0x8A, "U02", 0x8C, "U04", 0x8F, "U07",
+ 0x91, "U09", 0x92, "U10", 0x94, "U12", 0x97, "U15",
+ 0x98, "U16", 0x9B, "U19", 0x9D, "U21", 0x9E, "U22",
+ 0xA8, "U00", 0xAB, "U03", 0xAD, "U05", 0xAE, "U06",
+ 0xB0, "U08", 0xB3, "U11", 0xB5, "U13", 0xB6, "U14",
+ 0xB9, "U17", 0xBA, "U18", 0xBC, "U20", 0xBF, "U23",
+ 0xC1, "U25", 0xC2, "U26", 0xC4, "U28", 0xC7, "U31",
+ 0xE0, "U24", 0xE3, "U27", 0xE5, "U29", 0xE6, "U30"
+};
+
+memlog(m, mcr)
+ int m;
+ struct mcr780 *mcr;
+{
+ register i;
+
+ for (i = 0; i < (sizeof (memlogtab) / sizeof (memlogtab[0])); i++)
+ if ((u_char)(M780C_SYN(mcr)) == memlogtab[i].m_syndrome) {
+ printf (
+ "mcr%d: replace %s chip in %s bank of memory board %d (0-15)\n",
+ m,
+ memlogtab[i].m_chip,
+ (M780C_ADDR(mcr) & 0x8000) ? "upper" : "lower",
+ (M780C_ADDR(mcr) >> 16));
+ return;
+ }
+ printf ("mcr%d: multiple errors, not traceable\n", m);
+ break;
+}
+#endif TRENDATA
+
+char *mc780[]={"0","1","2","3","4","5","6","7","8","9","10","11","12","13",
+ "14","15"};
+
+struct mc780frame {
+ int mc8_bcnt; /* byte count == 0x28 */
+ int mc8_summary; /* summary parameter (as above) */
+ int mc8_cpues; /* cpu error status */
+ int mc8_upc; /* micro pc */
+ int mc8_vaviba; /* va/viba register */
+ int mc8_dreg; /* d register */
+ int mc8_tber0; /* tbuf error reg 0 */
+ int mc8_tber1; /* tbuf error reg 1 */
+ int mc8_timo; /* timeout address divided by 4 */
+ int mc8_parity; /* parity */
+ int mc8_sbier; /* sbi error register */
+ int mc8_pc; /* trapped pc */
+ int mc8_psl; /* trapped psl */
+};
+
+int
+ka780_mchk(cmcf)
+ caddr_t cmcf;
+{
+ register struct mc780frame *mcf = (struct mc780frame *)cmcf;
+ register int type = mcf->mc8_summary;
+ register int sbifs;
+
+ printf("machine check %x: %s%s\n", type, mc780[type&0xf],
+ (type&0xf0) ? " abort" : " fault");
+ printf("\tcpues %x upc %x va/viba %x dreg %x tber %x %x\n",
+ mcf->mc8_cpues, mcf->mc8_upc, mcf->mc8_vaviba,
+ mcf->mc8_dreg, mcf->mc8_tber0, mcf->mc8_tber1);
+ sbifs = mfpr(PR_SBIFS);
+ printf("\ttimo %x parity %x sbier %x pc %x psl %x sbifs %x\n",
+ mcf->mc8_timo*4, mcf->mc8_parity, mcf->mc8_sbier,
+ mcf->mc8_pc, mcf->mc8_psl, sbifs);
+ /* THE FUNNY BITS IN THE FOLLOWING ARE FROM THE ``BLACK BOOK'' */
+ /* AND SHOULD BE PUT IN AN ``sbi.h'' */
+ mtpr(sbifs &~ 0x2000000, PR_SBIFS);
+ mtpr(mfpr(PR_SBIER) | 0x70c0, PR_SBIER);
+ return (MCHK_PANIC);
+}
+
+struct ka78x {
+ unsigned snr:12,
+ plant:3,
+ eco:8,
+ v785:1,
+ type:8;
+};
+
+void
+ka780_conf(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ extern char cpu_model[];
+ struct ka78x *ka78 = (void *)&cpu_type;
+
+ /* Enable cache */
+ mtpr(0x200000, PR_SBIMT);
+
+ strcpy(cpu_model,"VAX 11/780");
+ if (ka78->v785)
+ cpu_model[9] = '5';
+ printf(": %s, serial number %d(%d), hardware ECO level %d(%d)\n",
+ &cpu_model[4], ka78->snr, ka78->plant, ka78->eco >> 4, ka78->eco);
+ printf("%s: ", self->dv_xname);
+ if (mfpr(PR_ACCS) & 255) {
+ printf("FPA present, enabling.\n");
+ mtpr(0x8000, PR_ACCS);
+ } else
+ printf("no FPA\n");
+
+}
+
+int
+ka780_clock()
+{
+ mtpr(-10000, PR_NICR); /* Load in count register */
+ mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */
+ return 0;
+}
+
+void
+ka780_steal_pages()
+{
+ extern vm_offset_t avail_start, virtual_avail;
+ extern struct nexus *nexus;
+ int junk;
+
+ MAPPHYS(junk, 4, VM_PROT_READ|VM_PROT_WRITE);
+ MAPVIRT(nexus, btoc(8192*16));
+ pmap_map((vm_offset_t)nexus, 0x20000000, 0x20020000,
+ VM_PROT_READ|VM_PROT_WRITE);
+}
diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c
new file mode 100644
index 00000000000..b41b228b360
--- /dev/null
+++ b/sys/arch/vax/vax/ka860.c
@@ -0,0 +1,327 @@
+/* $NetBSD: ka860.c,v 1.3 1996/04/08 18:32:45 ragge Exp $ */
+/*
+ * Copyright (c) 1986, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)ka860.c 7.4 (Berkeley) 12/16/90
+ */
+
+/*
+ * VAX 8600 specific routines.
+ */
+
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+
+#include <machine/cpu.h>
+#include <machine/mtpr.h>
+#include <machine/nexus.h>
+#include <machine/ioa.h>
+
+struct ioa *ioa;
+
+/* XXX These are in autoconf.c also */
+void ka86_conf __P((struct device *, struct device *, void *));
+int ka86_clock __P((void));
+void ka86_memenable __P((struct sbi_attach_args *, struct device *));
+void ka86_memerr __P((void));
+int ka86_mchk __P((caddr_t));
+void ka86_steal_pages __P((void));
+
+void crlattach __P((void));
+
+/*
+ * 8600 memory register (MERG) bit definitions
+ */
+#define M8600_ICRD 0x400 /* inhibit crd interrupts */
+#define M8600_TB_ERR 0xf00 /* translation buffer error mask */
+
+/*
+ * MDECC register
+ */
+#define M8600_ADDR_PE 0x080000 /* address parity error */
+#define M8600_DBL_ERR 0x100000 /* data double bit error */
+#define M8600_SNG_ERR 0x200000 /* data single bit error */
+#define M8600_BDT_ERR 0x400000 /* bad data error */
+
+/*
+ * ESPA register is used to address scratch pad registers in the Ebox.
+ * To access a register in the scratch pad, write the ESPA with the address
+ * and then read the ESPD register.
+ *
+ * NOTE: In assmebly code, the mfpr instruction that reads the ESPD
+ * register must immedately follow the mtpr instruction that setup
+ * the ESPA register -- per the VENUS processor register spec.
+ *
+ * The scratchpad registers that are supplied for a single bit ECC
+ * error are:
+ */
+#define SPAD_MSTAT1 0x25 /* scratch pad mstat1 register */
+#define SPAD_MSTAT2 0x26 /* scratch pad mstat2 register */
+#define SPAD_MDECC 0x27 /* scratch pad mdecc register */
+#define SPAD_MEAR 0x2a /* scratch pad mear register */
+
+#define M8600_MEMERR(mdecc) ((mdecc) & 0x780000)
+#define M8600_HRDERR(mdecc) ((mdecc) & 0x580000)
+#define M8600_SYN(mdecc) (((mdecc) >> 9) & 0x3f)
+#define M8600_ADDR(mear) ((mear) & 0x3ffffffc)
+#define M8600_ARRAY(mear) (((mear) >> 22) & 0x0f)
+
+#define M8600_MDECC_BITS \
+"\20\27BAD_DT_ERR\26SNG_BIT_ERR\25DBL_BIT_ERR\24ADDR_PE"
+
+#define M8600_MSTAT1_BITS "\20\30CPR_PE_A\27CPR_PE_B\26ABUS_DT_PE\
+\25ABUS_CTL_MSK_PE\24ABUS_ADR_PE\23ABUS_C/A_CYCLE\22ABUS_ADP_1\21ABUS_ADP_0\
+\20TB_MISS\17BLK_HIT\16C0_TAG_MISS\15CHE_MISS\14TB_VAL_ERR\13TB_PTE_B_PE\
+\12TB_PTE_A_PE\11TB_TAG_PE\10WR_DT_PE_B3\7WR_DT_PE_B2\6WR_DT_PE_B1\
+\5WR_DT_PE_B0\4CHE_RD_DT_PE\3CHE_SEL\2ANY_REFL\1CP_BW_CHE_DT_PE"
+
+#define M8600_MSTAT2_BITS "\20\20CP_BYT_WR\17ABUS_BD_DT_CODE\10MULT_ERR\
+\7CHE_TAG_PE\6CHE_TAG_W_PE\5CHE_WRTN_BIT\4NXM\3CP-IO_BUF_ERR\2MBOX_LOCK"
+
+/* enable CRD reports */
+void
+ka86_memenable(sa, dev)
+ struct sbi_attach_args *sa; /* XXX */
+ struct device *dev;
+{
+ mtpr(mfpr(PR_MERG) & ~M8600_ICRD, PR_MERG);
+}
+
+/* log CRD errors */
+void
+ka86_memerr()
+{
+ register int reg11 = 0; /* known to be r11 below */
+ int mdecc, mear, mstat1, mstat2, array;
+
+ /*
+ * Scratchpad registers in the Ebox must be read by
+ * storing their ID number in ESPA and then immediately
+ * reading ESPD's contents with no other intervening
+ * machine instructions!
+ *
+ * The asm's below have a number of constants which
+ * are defined correctly above and in mtpr.h.
+ */
+#ifdef lint
+ reg11 = 0;
+#else
+ asm("mtpr $0x27,$0x4e; mfpr $0x4f,%0":: "r" (reg11));
+#endif
+ mdecc = reg11; /* must acknowledge interrupt? */
+ if (M8600_MEMERR(mdecc)) {
+ asm("mtpr $0x2a,$0x4e; mfpr $0x4f,%0":: "r" (reg11));
+ mear = reg11;
+ asm("mtpr $0x25,$0x4e; mfpr $0x4f,%0":: "r" (reg11));
+ mstat1 = reg11;
+ asm("mtpr $0x26,$0x4e; mfpr $0x4f,%0":: "r" (reg11));
+ mstat2 = reg11;
+ array = M8600_ARRAY(mear);
+
+ printf("mcr0: ecc error, addr %x (array %d) syn %x\n",
+ M8600_ADDR(mear), array, M8600_SYN(mdecc));
+ printf("\tMSTAT1 = %b\n\tMSTAT2 = %b\n",
+ mstat1, M8600_MSTAT1_BITS,
+ mstat2, M8600_MSTAT2_BITS);
+ mtpr(0, PR_EHSR);
+ mtpr(mfpr(PR_MERG) | M8600_ICRD, PR_MERG);
+ }
+}
+
+#define NMC8600 7
+char *mc8600[] = {
+ "unkn type", "fbox error", "ebox error", "ibox error",
+ "mbox error", "tbuf error", "mbox 1D error"
+};
+/* codes for above */
+#define MC_FBOX 1
+#define MC_EBOX 2
+#define MC_IBOX 3
+#define MC_MBOX 4
+#define MC_TBUF 5
+#define MC_MBOX1D 6
+
+/* error bits */
+#define MBOX_FE 0x8000 /* Mbox fatal error */
+#define FBOX_SERV 0x10000000 /* Fbox service error */
+#define IBOX_ERR 0x2000 /* Ibox error */
+#define EBOX_ERR 0x1e00 /* Ebox error */
+#define MBOX_1D 0x81d0000 /* Mbox 1D error */
+#define EDP_PE 0x200
+
+struct mc8600frame {
+ int mc86_bcnt; /* byte count == 0x58 */
+ int mc86_ehmsts;
+ int mc86_evmqsav;
+ int mc86_ebcs;
+ int mc86_edpsr;
+ int mc86_cslint;
+ int mc86_ibesr;
+ int mc86_ebxwd1;
+ int mc86_ebxwd2;
+ int mc86_ivasav;
+ int mc86_vibasav;
+ int mc86_esasav;
+ int mc86_isasav;
+ int mc86_cpc;
+ int mc86_mstat1;
+ int mc86_mstat2;
+ int mc86_mdecc;
+ int mc86_merg;
+ int mc86_cshctl;
+ int mc86_mear;
+ int mc86_medr;
+ int mc86_accs;
+ int mc86_cses;
+ int mc86_pc; /* trapped pc */
+ int mc86_psl; /* trapped psl */
+};
+
+/* machine check */
+int
+ka86_mchk(cmcf)
+ caddr_t cmcf;
+{
+ register struct mc8600frame *mcf = (struct mc8600frame *)cmcf;
+ register int type;
+
+ if (mcf->mc86_ebcs & MBOX_FE)
+ mcf->mc86_ehmsts |= MC_MBOX;
+ else if (mcf->mc86_ehmsts & FBOX_SERV)
+ mcf->mc86_ehmsts |= MC_FBOX;
+ else if (mcf->mc86_ebcs & EBOX_ERR) {
+ if (mcf->mc86_ebcs & EDP_PE)
+ mcf->mc86_ehmsts |= MC_MBOX;
+ else
+ mcf->mc86_ehmsts |= MC_EBOX;
+ } else if (mcf->mc86_ehmsts & IBOX_ERR)
+ mcf->mc86_ehmsts |= MC_IBOX;
+ else if (mcf->mc86_mstat1 & M8600_TB_ERR)
+ mcf->mc86_ehmsts |= MC_TBUF;
+ else if ((mcf->mc86_cslint & MBOX_1D) == MBOX_1D)
+ mcf->mc86_ehmsts |= MC_MBOX1D;
+
+ type = mcf->mc86_ehmsts & 0x7;
+ printf("machine check %x: %s\n", type,
+ type < NMC8600 ? mc8600[type] : "???");
+ printf("\tehm.sts %x evmqsav %x ebcs %x edpsr %x cslint %x\n",
+ mcf->mc86_ehmsts, mcf->mc86_evmqsav, mcf->mc86_ebcs,
+ mcf->mc86_edpsr, mcf->mc86_cslint);
+ printf("\tibesr %x ebxwd %x %x ivasav %x vibasav %x\n",
+ mcf->mc86_ibesr, mcf->mc86_ebxwd1, mcf->mc86_ebxwd2,
+ mcf->mc86_ivasav, mcf->mc86_vibasav);
+ printf("\tesasav %x isasav %x cpc %x mstat %x %x mdecc %x\n",
+ mcf->mc86_esasav, mcf->mc86_isasav, mcf->mc86_cpc,
+ mcf->mc86_mstat1, mcf->mc86_mstat2, mcf->mc86_mdecc);
+ printf("\tmerg %x cshctl %x mear %x medr %x accs %x cses %x\n",
+ mcf->mc86_merg, mcf->mc86_cshctl, mcf->mc86_mear,
+ mcf->mc86_medr, mcf->mc86_accs, mcf->mc86_cses);
+ printf("\tpc %x psl %x\n", mcf->mc86_pc, mcf->mc86_psl);
+ mtpr(0, PR_EHSR);
+ return (MCHK_PANIC);
+}
+
+void
+ka86_steal_pages()
+{
+ extern vm_offset_t avail_start, virtual_avail;
+ extern struct nexus *nexus;
+ int junk;
+
+ /* 8600 may have 2 SBI's == 4 pages */
+ MAPPHYS(junk, 4, VM_PROT_READ|VM_PROT_WRITE);
+
+ /* Map in ioa register space */
+ MAPVIRT(ioa, MAXNIOA);
+ pmap_map((vm_offset_t)ioa, (u_int)IOA8600(0),
+ (u_int)IOA8600(0) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE);
+ pmap_map((vm_offset_t)ioa + IOAMAPSIZ, (u_int)IOA8600(1),
+ (u_int)IOA8600(1) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE);
+ pmap_map((vm_offset_t)ioa + 2 * IOAMAPSIZ, (u_int)IOA8600(2),
+ (u_int)IOA8600(2) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE);
+ pmap_map((vm_offset_t)ioa + 3 * IOAMAPSIZ, (u_int)IOA8600(3),
+ (u_int)IOA8600(3) + IOAMAPSIZ, VM_PROT_READ|VM_PROT_WRITE);
+
+ /* Map in possible nexus space */
+ MAPVIRT(nexus, btoc(NEXSIZE * MAXNNEXUS));
+ pmap_map((vm_offset_t)nexus, (u_int)NEXA8600,
+ (u_int)NEXA8600 + NNEX8600 * NEXSIZE, VM_PROT_READ|VM_PROT_WRITE);
+ pmap_map((vm_offset_t)&nexus[NNEXSBI], (u_int)NEXB8600,
+ (u_int)NEXB8600 + NNEX8600 * NEXSIZE, VM_PROT_READ|VM_PROT_WRITE);
+}
+
+struct ka86 {
+ unsigned snr:12,
+ plant:4,
+ eco:7,
+ v8650:1,
+ type:8;
+};
+
+void
+ka86_conf(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ extern char cpu_model[];
+ struct ka86 *ka86 = (void *)&cpu_type;
+
+ /* Enable cache */
+ mtpr(3, PR_CSWP);
+
+ strcpy(cpu_model,"VAX 8600");
+ if (ka86->v8650)
+ cpu_model[5] = '5';
+ printf(": %s, serial number %d(%d), hardware ECO level %d(%d)\n",
+ &cpu_model[4], ka86->snr, ka86->plant, ka86->eco >> 4, ka86->eco);
+ printf("%s: ", self->dv_xname);
+ if (mfpr(PR_ACCS) & 255) {
+ printf("FPA present, type %d, serial number %d, enabling.\n",
+ mfpr(PR_ACCS) & 255, mfpr(PR_ACCS) >> 16);
+ mtpr(0x8000, PR_ACCS);
+ } else
+ printf("no FPA\n");
+ crlattach();
+}
+
+int
+ka86_clock()
+{
+ mtpr(-10000, PR_NICR); /* Load in count register */
+ mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */
+ return 0;
+}
+
diff --git a/sys/arch/vax/vax/locore.c b/sys/arch/vax/vax/locore.c
index 36f3b3e0bde..fe4b6ed8092 100644
--- a/sys/arch/vax/vax/locore.c
+++ b/sys/arch/vax/vax/locore.c
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.c,v 1.11 1996/01/28 12:18:06 ragge Exp $ */
+/* $NetBSD: locore.c,v 1.14 1996/04/08 18:32:46 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,18 +33,24 @@
/* All bugs are subject to removal without further notice */
-#include "sys/param.h"
-#include "sys/types.h"
-#include "sys/reboot.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/reboot.h>
-#include "vm/vm.h"
+#include <vm/vm.h>
-#include "machine/cpu.h"
-#include "machine/sid.h"
-#include "machine/uvaxII.h"
-#include "machine/param.h"
-#include "machine/vmparam.h"
-#include "machine/pcb.h"
+#include <dev/cons.h>
+
+#include <machine/cpu.h>
+#include <machine/sid.h>
+#include <machine/uvaxII.h>
+#include <machine/param.h>
+#include <machine/vmparam.h>
+#include <machine/pcb.h>
+#include <machine/pmap.h>
+
+void start __P((void));
+void main __P((void));
u_int proc0paddr;
int cpunumber, *Sysmap, boothowto, cpu_type;
@@ -63,7 +69,7 @@ start()
{
extern u_int *end;
extern void *scratch;
- register curtop;
+ register tmpptr;
mtpr(0x1f, PR_IPL); /* No interrupts before istack is ok, please */
@@ -92,7 +98,6 @@ tokmem: movw $0xfff, _panic
* FIRST we must set up kernel stack, directly after end.
* This is the only thing we have to setup here, rest in pmap.
*/
-
PAGE_SIZE = NBPG * 2; /* Set logical page size */
#ifdef DDB
if ((boothowto & RB_KDB) != 0)
@@ -101,7 +106,8 @@ tokmem: movw $0xfff, _panic
#endif
proc0paddr = ROUND_PAGE(&end);
- mtpr(proc0paddr, PR_PCBB); /* must be set before ksp for some cpus */
+ tmpptr = proc0paddr & 0x7fffffff;
+ mtpr(tmpptr, PR_PCBB); /* must be set before ksp for some cpus */
mtpr(proc0paddr + UPAGES * NBPG, PR_KSP); /* new kernel stack */
/*
@@ -111,12 +117,12 @@ tokmem: movw $0xfff, _panic
/* Be sure some important internal registers have safe values */
((struct pcb *)proc0paddr)->P0LR = 0;
- ((struct pcb *)proc0paddr)->P0BR = 0;
+ ((struct pcb *)proc0paddr)->P0BR = (void *)0x80000000;
((struct pcb *)proc0paddr)->P1LR = 0;
((struct pcb *)proc0paddr)->P1BR = (void *)0x80000000;
((struct pcb *)proc0paddr)->iftrap = NULL;
mtpr(0, PR_P0LR);
- mtpr(0, PR_P0BR);
+ mtpr(0x80000000, PR_P0BR);
mtpr(0, PR_P1LR);
mtpr(0x80000000, PR_P1BR);
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index c88115b7b7d..1daedbd9cff 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.23 1996/01/28 12:22:54 ragge Exp $ */
+/* $NetBSD: machdep.c,v 1.29 1996/04/08 18:32:47 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -45,48 +45,76 @@
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
*/
-#include "sys/param.h"
-#include "sys/systm.h"
-#include "sys/map.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/time.h"
-#include "sys/signal.h"
-#include "sys/kernel.h"
-#include "sys/reboot.h"
-#include "sys/msgbuf.h"
-#include "sys/buf.h"
-#include "sys/mbuf.h"
-#include "sys/reboot.h"
-#include "sys/conf.h"
-#include "sys/callout.h"
-#include "sys/device.h"
-#include "sys/exec.h"
-#include "sys/mount.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/map.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/time.h>
+#include <sys/signal.h>
+#include <sys/kernel.h>
+#include <sys/reboot.h>
+#include <sys/msgbuf.h>
+#include <sys/buf.h>
+#include <sys/mbuf.h>
+#include <sys/reboot.h>
+#include <sys/conf.h>
+#include <sys/callout.h>
+#include <sys/device.h>
+#include <sys/exec.h>
+#include <sys/mount.h>
+#include <sys/cpu.h>
+#include <sys/syscallargs.h>
+#include <sys/ptrace.h>
#ifdef SYSVMSG
-#include "sys/msg.h"
+#include <sys/msg.h>
#endif
#ifdef SYSVSEM
-#include "sys/sem.h"
+#include <sys/sem.h>
#endif
#ifdef SYSVSHM
-#include "sys/shm.h"
+#include <sys/shm.h>
#endif
-#include "machine/sid.h"
-#include "machine/pte.h"
-#include "machine/mtpr.h"
-#include "machine/cpu.h"
-#include "machine/macros.h"
-#include "machine/nexus.h"
-#include "machine/trap.h"
-#include "machine/reg.h"
-#include "machine/../vax/gencons.h"
-#include "vm/vm_kern.h"
-#include "net/netisr.h"
-#include <sys/syscallargs.h>
+#include <vm/vm_kern.h>
+
+#include <net/netisr.h>
+#include <net/if.h>
+#ifdef INET
+#include <netinet/in.h>
+#include <netinet/if_ether.h>
+#include <netinet/ip_var.h>
+#endif
+#ifdef NS
+#include <netns/ns_var.h>
+#endif
#include "ppp.h" /* For NERISR_PPP */
+#if NPPP > 0
+#include <net/ppp_defs.h>
+#include <net/if_ppp.h>
+#endif
+
+#include <machine/sid.h>
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/cpu.h>
+#include <machine/macros.h>
+#include <machine/nexus.h>
+#include <machine/trap.h>
+#include <machine/reg.h>
+#include <machine/db_machdep.h>
+#include <vax/vax/gencons.h>
+
+#ifdef DDB
+#include <ddb/db_sym.h>
+#include <ddb/db_extern.h>
+#endif
+
+void netintr __P((void));
+void machinecheck __P((u_int));
+void cmrerr __P((void));
+
extern int virtual_avail, virtual_end;
/*
* We do these external declarations here, maybe they should be done
@@ -122,15 +150,16 @@ int nbuf = NBUF;
int nbuf = 0;
#endif
+void
cpu_startup()
{
- caddr_t v, tempaddr;
+ caddr_t v;
extern char version[];
int base, residual, i, sz;
vm_offset_t minaddr, maxaddr;
vm_size_t size;
- extern int cpu_type, boothowto, startpmapdebug;
- extern unsigned int avail_start, avail_end;
+ extern int cpu_type, boothowto;
+ extern unsigned int avail_end;
/*
* Initialize error message buffer.
@@ -224,7 +253,7 @@ cpu_startup()
callout[i - 1].c_next = &callout[i];
callout[i - 1].c_next = NULL;
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
+ printf("avail mem = %d\n", (int)ptoa(cnt.v_free_count));
printf("Using %d buffers containing %d bytes of memory.\n",
nbuf, bufpages * CLBYTES);
@@ -304,7 +333,9 @@ allocsys(v)
}
long dumplo = 0;
+long dumpmag = 0x8fca0101;
+void
dumpconf()
{
int nblks;
@@ -329,12 +360,19 @@ dumpconf()
dumplo = btodb(CLBYTES);
}
+void
cpu_initclocks()
{
(cpu_calls[cpunumber].cpu_clock) ();
}
-cpu_sysctl()
+int
+cpu_sysctl(a, b, c, d, e, f, g)
+ int *a;
+ u_int b;
+ void *c, *e;
+ size_t *d, f;
+ struct proc *g;
{
printf("cpu_sysctl:\n");
return (EOPNOTSUPP);
@@ -347,6 +385,7 @@ setstatclockrate(hzrate)
panic("setstatclockrate");
}
+void
consinit()
{
#ifdef DDB
@@ -417,7 +456,7 @@ sendsig(catcher, sig, mask, code)
struct sigcontext *sigctx;
struct trampframe *trampf;
unsigned cursp;
- int oonstack;
+ int oonstack = psp->ps_sigstk.ss_flags & SS_ONSTACK;
extern char sigcode[], esigcode[];
/*
* Allocate and validate space for the signal handler context. Note
@@ -482,11 +521,14 @@ sendsig(catcher, sig, mask, code)
syscf->sp = cursp;
}
-int waittime = -1;
+int waittime = -1;
+static volatile int showto; /* Must be volatile to survive MM on -> MM off */
+void
boot(howto)
- int howto;
+ register howto;
{
+ showto = howto;
if ((howto & RB_NOSYNC) == 0 && waittime < 0) {
waittime = 0;
vfs_shutdown();
@@ -499,16 +541,60 @@ boot(howto)
splhigh(); /* extreme priority */
if (howto & RB_HALT) {
printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
- for (;;);
+ for ( ; ; )
+ ;
} else {
- if (howto & RB_DUMP)
+ /*
+ * Now it's time to:
+ * 0. Save some registers that are needed in new world.
+ * 1. Change stack to somewhere that will survive MM off.
+ * (RPB page is good page to save things in).
+ * 2. Actually turn MM off.
+ * 3. Dump away memory to disk, if asked.
+ * 4. Reboot as asked.
+ * The RPB page is _always_ first page in memory, we can
+ * rely on that.
+ */
+ asm(" movl sp, (0x80000200)
+ movl 0x80000200, sp
+ mfpr $0x10, -(sp) # PR_PCBB
+ mfpr $0x11, -(sp) # PR_SCBB
+ mfpr $0xc, -(sp) # PR_SBR
+ mfpr $0xd, -(sp) # PR_SLR
+ mtpr $0, $0x38 # PR_MAPEN
+ ");
+ if (showto & RB_DUMP)
dumpsys();
- asm("movl %0,r5":: "g" (howto)); /* How to boot */
- mtpr(GC_BOOT, PR_TXDB); /* boot command */
- asm("halt");
+
+ asm("movl %0,r5":: "g" (showto)); /* How to boot */
+
+ switch (cpunumber) {
+ int state;
+
+#if VAX750 || VAX780 || VAX630
+ case VAX_780:
+ case VAX_750:
+ case VAX_630:
+ mtpr(GC_BOOT, PR_TXDB); /* boot command */
+ break;
+#endif
+#if VAX8600
+ case VAX_8600:
+ state = mfpr(PR_TXCS);
+ gencnputc(0, GC_LT | GC_WRT);
+ mtpr(0x2, PR_TXDB); /* XXX */
+ gencnputc(0, state | GC_WRT);
+ break;
+#endif
+ }
+
}
+ asm("movl %0, r11":: "r"(showto));
+ asm("halt");
+ panic("Halt sket sej");
}
+void
netintr()
{
#ifdef INET
@@ -546,6 +632,7 @@ netintr()
#endif
}
+void
machinecheck(frame)
u_int frame;
{
@@ -555,6 +642,7 @@ machinecheck(frame)
panic("machine check");
}
+void
dumpsys()
{
extern int dumpdev;
@@ -570,9 +658,9 @@ dumpsys()
dumpconf();
if (dumplo < 0)
return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
+ printf("\ndumping to dev %x, offset %d\n", dumpdev, (int)dumplo);
printf("dump ");
- switch ((*bdevsw[major(dumpdev)].d_dump) (dumpdev)) {
+ switch ((*bdevsw[major(dumpdev)].d_dump) (dumpdev, 0, 0, 0)) {
case ENXIO:
printf("device bad\n");
@@ -596,21 +684,31 @@ dumpsys()
}
}
-fuswintr()
+int
+fuswintr(addr)
+ caddr_t addr;
{
panic("fuswintr: need to be implemented");
+ return 0;
+
}
+int
suibyte(base, byte)
int byte;
void *base;
{
panic("suibyte: need to be implemented");
+ return 0;
}
-suswintr()
+int
+suswintr(addr, cnt)
+ caddr_t addr;
+ u_int cnt;
{
panic("suswintr: need to be implemented");
+ return 0;
}
int
@@ -685,17 +783,8 @@ process_sstep(p, sstep)
return (0);
}
-ns_cksum()
-{
- panic("ns_cksum");
-}
-
+void
cmrerr()
{
-#if 0
- switch (cpunumber) {
- case VAX_750:
- ka750_memerr();
- }
-#endif
+ (*cpu_calls[cpunumber].cpu_memerr) ();
}
diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c
index 66fbd913205..fd94382b9b1 100644
--- a/sys/arch/vax/vax/mem.c
+++ b/sys/arch/vax/vax/mem.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mem.c,v 1.8 1995/10/30 16:27:56 ragge Exp $ */
+/* $NetBSD: mem.c,v 1.9 1996/04/08 18:32:48 ragge Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -50,6 +50,7 @@
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <machine/pte.h>
#include <machine/mtpr.h>
@@ -59,6 +60,12 @@
extern unsigned int vmmap, avail_end;
caddr_t zeropage;
+int mmopen __P((dev_t, int, int));
+int mmclose __P((dev_t, int, int));
+int mmrw __P((dev_t, struct uio *, int));
+int mmmmap __P((dev_t, int, int));
+
+
/*ARGSUSED*/
int
mmopen(dev, flag, mode)
diff --git a/sys/arch/vax/vax/mscp.c b/sys/arch/vax/vax/mscp.c
index 7ee2c2265bd..427c0258b88 100644
--- a/sys/arch/vax/vax/mscp.c
+++ b/sys/arch/vax/vax/mscp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mscp.c,v 1.6 1995/11/30 00:59:37 jtc Exp $ */
+/* $NetBSD: mscp.c,v 1.9 1996/04/08 18:32:50 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -42,18 +42,25 @@
* MSCP generic driver routines
*/
-#include "sys/param.h"
-#include "sys/buf.h"
-#include "sys/errno.h"
-#include "sys/dkstat.h"
-#include "sys/ioctl.h"
-#include "sys/disklabel.h"
-#include "sys/syslog.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/errno.h>
+#include <sys/dkstat.h>
+#include <sys/ioctl.h>
+#include <sys/disklabel.h>
+#include <sys/syslog.h>
+#include <sys/proc.h>
+
+#include <vax/uba/ubavar.h>
+
+#include <vax/vax/mscp.h>
+#include <vax/vax/mscpvar.h>
+
+void mscp_hexdump __P((struct mscp *));
+
-#include "../uba/ubavar.h"
-#include "mscp.h"
-#include "mscpvar.h"
#define PCMD PSWP /* priority for command packet waits */
@@ -138,6 +145,7 @@ int mscp_aeb_xor = 0x8000bb80;
* such a case by changing this command into an on line request and
* not dequeuing the transfer after all.
*/
+void
mscp_go(mi, mp, info)
register struct mscp_info *mi;
register struct mscp *mp;
@@ -159,9 +167,12 @@ mscp_go(mi, mp, info)
dp->b_actf = bp->b_actf; /* transfer off drive queue */
mi->mi_tab->b_actf = dp->b_hash.le_next;/* drive off ctlr queue */
MSCP_APPEND(dp, mi->mi_tab, b_hash.le_next); /* then back again */
-/* Was: dp->b_actf = bp->av_forw; /* transfer off drive queue */
-/* Was: mi->mi_tab->b_actf = dp->b_forw;/* drive off ctlr queue */
-/* Was: MSCP_APPEND(dp, mi->mi_tab, b_forw); /* then back again */
+
+#ifdef oldway
+ dp->b_actf = bp->av_forw; /* transfer off drive queue */
+ mi->mi_tab->b_actf = dp->b_forw; /* drive off ctlr queue */
+ MSCP_APPEND(dp, mi->mi_tab, b_forw); /* then back again */
+#endif
/*
* Move the buffer to the I/O wait queue.
@@ -177,11 +188,13 @@ mscp_go(mi, mp, info)
while(tmp->b_actf!=&mi->mi_wtab) tmp=tmp->b_actf;
tmp->b_actf=bp;
}}
-
-/* Was: bp->av_back = mi->mi_wtab.av_back;
-/* Was: bp->av_forw = &mi->mi_wtab;
-/* Was: mi->mi_wtab.av_back->av_forw = bp;
-/* Was: mi->mi_wtab.av_back = bp;
+
+#ifdef oldway
+ bp->av_back = mi->mi_wtab.av_back;
+ bp->av_forw = &mi->mi_wtab;
+ mi->mi_wtab.av_back->av_forw = bp;
+ mi->mi_wtab.av_back = bp;
+#endif
/*
* Save the mapping info, finish the command packet, and give
@@ -222,6 +235,7 @@ found:
/*
* Handle a response ring transition.
*/
+void
mscp_dorsp(mi)
register struct mscp_info *mi;
{
@@ -326,7 +340,7 @@ loop:
*/
if (st == M_ST_INVALCMD && mp->mscp_cmdref != 0) {
printf("%s%d: bad lbn (%d)?\n", drivename,
- ui->ui_unit, mp->mscp_seq.seq_lbn);
+ ui->ui_unit, (int)mp->mscp_seq.seq_lbn);
error = EIO;
goto rwend;
}
@@ -601,6 +615,7 @@ done:
* Dump the entire contents of an MSCP packet in hex. Mainly useful
* for debugging....
*/
+void
mscp_hexdump(mp)
register struct mscp *mp;
{
@@ -611,7 +626,7 @@ mscp_hexdump(mp)
i = 256;
i /= sizeof (*p); /* ASSUMES MULTIPLE OF sizeof(long) */
while (--i >= 0)
- printf("0x%x ", *p++);
+ printf("0x%x ", (int)*p++);
printf("\n");
}
@@ -620,6 +635,7 @@ mscp_hexdump(mp)
* Also requeue any drives that have on line or unit status
* info pending.
*/
+void
mscp_requeue(mi)
struct mscp_info *mi;
{
@@ -846,24 +862,25 @@ struct code_decode {
char **cdc_submsgs;
} code_decode[] = {
#define SC(m) sizeof (m) / sizeof (m[0]), m
- "success", SC(succ_msgs),
- "invalid command", SC(icmd_msgs),
- "command aborted", 0, 0,
- "unit offline", SC(offl_msgs),
- "unit available", 0, 0,
- "media format error", SC(media_fmt_msgs),
- "write protected", SC(wrprot_msgs),
- "compare error", 0, 0,
- "data error", SC(data_msgs),
- "host buffer access error", SC(host_buffer_msgs),
- "controller error", SC(cntlr_msgs),
- "drive error", SC(drive_msgs),
+ {"success", SC(succ_msgs)},
+ {"invalid command", SC(icmd_msgs)},
+ {"command aborted", 0, 0},
+ {"unit offline", SC(offl_msgs)},
+ {"unit available", 0, 0},
+ {"media format error", SC(media_fmt_msgs)},
+ {"write protected", SC(wrprot_msgs)},
+ {"compare error", 0, 0},
+ {"data error", SC(data_msgs)},
+ {"host buffer access error", SC(host_buffer_msgs)},
+ {"controller error", SC(cntlr_msgs)},
+ {"drive error", SC(drive_msgs)},
#undef SC
};
/*
* Print the decoded error event from an MSCP error datagram.
*/
+void
mscp_printevent(mp)
struct mscp *mp;
{
@@ -899,6 +916,7 @@ mscp_printevent(mp)
* THIS IS PROBABLY PECULIAR TO DISK DRIVES. IT SURE WOULD BE
* NICE IF DEC SOLD DOCUMENTATION FOR THEIR OWN CONTROLLERS.
*/
+void
mscp_decodeerror(name, ctlr, mp)
char *name;
int ctlr;
@@ -930,7 +948,7 @@ mscp_decodeerror(name, ctlr, mp)
break;
case M_FM_BUSADDR: /* host memory access error */
- printf(" memory addr 0x%x:", mp->mscp_erd.erd_busaddr);
+ printf(" memory addr 0x%x:", (int)mp->mscp_erd.erd_busaddr);
break;
case M_FM_DISKTRN:
@@ -938,13 +956,13 @@ mscp_decodeerror(name, ctlr, mp)
mp->mscp_unit,
mp->mscp_erd.erd_level, mp->mscp_erd.erd_retry,
BADCODE(mp->mscp_erd.erd_hdr),
- BADLBN(mp->mscp_erd.erd_hdr));
+ (int)BADLBN(mp->mscp_erd.erd_hdr));
break;
case M_FM_SDI:
printf(" unit %d: %s %d:", mp->mscp_unit,
BADCODE(mp->mscp_erd.erd_hdr),
- BADLBN(mp->mscp_erd.erd_hdr));
+ (int)BADLBN(mp->mscp_erd.erd_hdr));
break;
case M_FM_SMLDSK:
diff --git a/sys/arch/vax/vax/mscpvar.h b/sys/arch/vax/vax/mscpvar.h
index f9f3f4706e4..52213fab869 100644
--- a/sys/arch/vax/vax/mscpvar.h
+++ b/sys/arch/vax/vax/mscpvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mscpvar.h,v 1.6 1995/11/10 19:09:58 ragge Exp $ */
+/* $NetBSD: mscpvar.h,v 1.7 1996/04/08 18:32:51 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -78,6 +78,8 @@
* to the buffer describing the transfer in error.
* END OUT OF DATE
*/
+struct mscp_info;
+
struct mscp_driver {
int md_ndpc; /* number of drives per ctlr */
int md_nunits; /* total number drives (all ctlrs) */
@@ -85,15 +87,26 @@ struct mscp_driver {
struct buf *md_utab; /* pointer to device queues */
struct disklabel *md_lab; /* pointer to devicee disklabels */
struct uba_device **md_dinfo; /* pointer to device info */
- int (*md_dgram)(); /* error datagram */
- int (*md_ctlrdone)(); /* controller operation complete */
- int (*md_unconf)(); /* response from unconfigured drive */
- int (*md_iodone)(); /* normal I/O is done */
- int (*md_online)(); /* drive on line */
- int (*md_gotstatus)(); /* got unit status */
- int (*md_replace)(); /* replace done */
- int (*md_ioerr)(); /* read or write failed */
- int (*md_bb)(); /* B_BAD io done */
+ /* error datagram */
+ void (*md_dgram) __P((struct mscp_info *, struct mscp *));
+ /* controller operation complete */
+ void (*md_ctlrdone) __P((struct mscp_info *, struct mscp *));
+ /* response from unconfigured drive */
+ int (*md_unconf) __P((struct mscp_info *, struct mscp *));
+ /* normal I/O is done */
+ void (*md_iodone) __P((struct mscp_info *, struct buf *, int));
+ /* drive on line */
+ int (*md_online) __P((struct uba_device *, struct mscp *));/*XXX*/
+ /* got unit status */
+ int (*md_gotstatus) __P((struct uba_device *, struct mscp *));
+ /* replace done */
+ void (*md_replace) __P((struct uba_device *, struct mscp *));
+ /* read or write failed */
+ int (*md_ioerr) __P((struct uba_device *, struct mscp *,
+ struct buf *));
+ /* B_BAD io done */
+ void (*md_bb) __P((struct uba_device *, struct mscp *,
+ struct buf *));
char *md_mname; /* name of controllers */
char *md_dname; /* name of drives */
};
@@ -163,7 +176,8 @@ struct mscp_info {
#define MSCP_WAIT 1
#define MSCP_DONTWAIT 0
-struct mscp *mscp_getcp(); /* get a command packet */
+ /* get a command packet */
+struct mscp *mscp_getcp __P((struct mscp_info *, int));
/*
* Unit flags
@@ -217,3 +231,12 @@ struct mscp *mscp_getcp(); /* get a command packet */
(queue)->b_actl = (bp); \
}
*/
+
+/* Prototypes */
+
+void mscp_printevent __P((struct mscp *));
+void mscp_go __P((struct mscp_info *, struct mscp *, int));
+void mscp_requeue __P((struct mscp_info *));
+void mscp_dorsp __P((struct mscp_info *));
+void mscp_decodeerror __P((char *, int, struct mscp *));
+
diff --git a/sys/arch/vax/vax/ns_cksum.c b/sys/arch/vax/vax/ns_cksum.c
new file mode 100644
index 00000000000..0a7f59bbba7
--- /dev/null
+++ b/sys/arch/vax/vax/ns_cksum.c
@@ -0,0 +1,163 @@
+/* $NetBSD: ns_cksum.c,v 1.1 1996/03/03 11:54:37 ragge Exp $ */
+/*
+ * Copyright (c) 1985, 1986 Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ * @(#)ns_cksum.c 7.6 (Berkeley) 12/16/90
+ */
+
+#include <sys/param.h>
+#include <sys/mbuf.h>
+
+
+/*
+ * Checksum routine for Network Systems Protocol Packets (VAX Version).
+ *
+ * This routine is very heavily used in the network
+ * code and should be modified for each CPU to be as fast as possible.
+ */
+
+u_short
+ns_cksum(m, len)
+ register struct mbuf *m;
+ register int len;
+{
+ register u_short *w asm("r9"); /* on vax, known to be r9 */
+ register int sum asm("r8"); /* on vax, known to be r8 */
+ register int low asm("r7"); /* on vax, known to be r7 */
+ register int mlen; /* want 0, shuts lint up about low */
+
+ sum = 0;
+ low = 0;
+ mlen = 0;
+ for (;;) {
+ /*
+ * Each trip around loop adds in
+ * word from one mbuf segment.
+ */
+ w = mtod(m, u_short *);
+ if (mlen == -1) {
+ /*
+ * There is a byte left from the last segment;
+ * add it into the checksum. Don't have to worry
+ * about a carry-out here because we make sure
+ * that high part of (32 bit) sum is small below.
+ */
+ sum += *(u_char *)w << 8;
+ sum += sum;
+ w = (u_short *)((char *)w + 1);
+ mlen = m->m_len - 1;
+ len--;
+ } else
+ mlen = m->m_len;
+ m = m->m_next;
+ if (len < mlen)
+ mlen = len;
+ len -= mlen;
+ /*
+ * Force to long boundary so we do longword aligned
+ * memory operations. It is too hard to do byte
+ * adjustment, do only word adjustment.
+ */
+ if (((int)w&0x2) && mlen >= 2) {
+ sum += *w++;
+ sum += sum;
+ mlen -= 2;
+ }
+ /*
+ *
+ * We can do a 16 bit ones complement sum using
+ * 32 bit arithmetic registers for adding,
+ * with carries from the low added
+ * into the high (by normal carry-chaining)
+ * so long as we fold back before 16 carries have occured.
+ *
+ */
+ while ((mlen -= 32) >= 0) {
+ /*asm("bicpsw $1"); clears carry */
+#undef ADD
+#define ADD asm("movw (r9)+,r7; addl2 r7,r8; addl2 r8,r8")
+#define FOLD { asm("ashl $-16,r8,r0; addw2 r0,r8; adwc $0,r8; movzwl r8,r8"); }
+ FOLD;
+ ADD; ADD; ADD; ADD; ADD; ADD; ADD; ADD;
+ FOLD;
+ ADD; ADD; ADD; ADD; ADD; ADD; ADD; ADD;
+ }
+ mlen += 32;
+ while ((mlen -= 8) >= 0) {
+ /*asm("bicpsw $1"); clears carry */
+ FOLD;
+ ADD; ADD; ADD; ADD;
+ }
+ mlen += 8;
+ /*
+ * Now eliminate the possibility of carry-out's by
+ * folding back to a 16 bit number (adding high and
+ * low parts together.) Then mop up trailing words
+ * and maybe an odd byte.
+ */
+ FOLD;
+ while ((mlen -= 2) >= 0) {
+ ADD;
+ }
+ if (mlen == -1) {
+ sum += *(u_char *)w;
+ }
+ if (len == 0)
+ break;
+ /*
+ * Locate the next block with some data.
+ * If there is a word split across a boundary we
+ * will wrap to the top with mlen == -1 and
+ * then add it in shifted appropriately.
+ */
+ for (;;) {
+ if (m == 0) {
+ printf("idpcksum: out of data\n");
+ goto done;
+ }
+ if (m->m_len)
+ break;
+ m = m->m_next;
+ }
+ }
+done:
+ /*
+ * Add together high and low parts of sum
+ * and carry to get cksum.
+ * Have to be careful to not drop the last
+ * carry here.
+ */
+ FOLD;
+
+ if(sum==0xffff) sum = 0;
+ return (sum);
+}
diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c
index 7cf8c2f65af..54a61b57004 100644
--- a/sys/arch/vax/vax/pmap.c
+++ b/sys/arch/vax/vax/pmap.c
@@ -1,5 +1,4 @@
-/* $NetBSD: pmap.c,v 1.19 1995/12/13 18:50:20 ragge Exp $ */
-#define DEBUG
+/* $NetBSD: pmap.c,v 1.26 1996/04/08 18:32:53 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -30,38 +29,38 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/queue.h"
-#include "sys/malloc.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/msgbuf.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/queue.h>
+#include <sys/malloc.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/msgbuf.h>
+#include <sys/systm.h>
-#include "vm/vm.h"
-#include "vm/vm_page.h"
-#include "vm/vm_kern.h"
+#include <vm/vm.h>
+#include <vm/vm_page.h>
+#include <vm/vm_kern.h>
-#include "machine/pte.h"
-#include "machine/pcb.h"
-#include "machine/mtpr.h"
-#include "machine/macros.h"
-#include "machine/sid.h"
-#include "machine/uvaxII.h"
-#include "machine/cpu.h"
-#include "machine/scb.h"
+#include <machine/pte.h>
+#include <machine/pcb.h>
+#include <machine/mtpr.h>
+#include <machine/macros.h>
+#include <machine/sid.h>
+#include <machine/uvaxII.h>
+#include <machine/cpu.h>
+#include <machine/scb.h>
-pt_entry_t *pmap_virt2pte(pmap_t, u_int);
-static pv_entry_t alloc_pv_entry();
-static void free_pv_entry();
+static pt_entry_t *pmap_virt2pte __P((pmap_t, u_int));
+static pv_entry_t alloc_pv_entry __P((void));
+static void free_pv_entry __P((pv_entry_t));
+static int remove_pmap_from_mapping __P((pv_entry_t, pmap_t));
#define ISTACK_SIZE (4 * NBPG)
#define PTE_TO_PV(pte) (PHYS_TO_PV((pte&PG_FRAME)<<PGSHIFT))
-
-
struct pmap kernel_pmap_store;
static int prot_array[]={ PG_NONE, PG_RO, PG_RW, PG_RW,
@@ -72,11 +71,12 @@ static int kernel_prot[]={ PG_NONE, PG_KR, PG_KW, PG_KW,
static pv_entry_t pv_head = NULL;
static unsigned int pv_count = 0;
-
+pv_entry_t pv_table; /* array of entries,
+ one per LOGICAL page */
unsigned *pte_cmap;
void *scratch;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
int startpmapdebug = 0;
extern int startsysc, faultdebug;
#endif
@@ -97,7 +97,7 @@ void
pmap_bootstrap()
{
unsigned int junk, sysptsize, istack;
- extern unsigned int proc0paddr, sigcode, esigcode, etext;
+ extern unsigned int proc0paddr, etext;
extern struct vmspace vmspace0;
struct pmap *p0pmap;
@@ -112,7 +112,7 @@ pmap_bootstrap()
* a variable here that is changed dependent of the physical
* memory size.
*/
- while (!badaddr(avail_end, 4)) /* Memory is in 64K hunks */
+ while (!badaddr((caddr_t)avail_end, 4)) /* Memory is in 64K hunks */
avail_end += NBPG * 128;
sysptsize += avail_end >> PGSHIFT;
virtual_avail = KERNBASE;
@@ -178,7 +178,7 @@ pmap_bootstrap()
bzero(0, NBPG >> 1);
(cpu_calls[cpunumber].cpu_steal_pages)();
-#ifdef DEBUG
+#ifdef PMAPDEBUG
printf("Sysmap %x, istack %x, scratch %x\n",Sysmap,istack,scratch);
printf("etext %x\n", &etext);
printf("SYSPTSIZE %x, USRPTSIZE %x\n",sysptsize,USRPTSIZE);
@@ -198,16 +198,16 @@ pmap_bootstrap()
p0pmap->pm_pcb = (struct pcb *)proc0paddr;
p0pmap->pm_pcb->P1BR = (void *)0x80000000;
- p0pmap->pm_pcb->P0BR = 0;
+ p0pmap->pm_pcb->P0BR = (void *)0x80000000;
p0pmap->pm_pcb->P1LR = 0x200000;
p0pmap->pm_pcb->P0LR = AST_PCB;
mtpr(0x80000000, PR_P1BR);
- mtpr(0, PR_P0BR);
+ mtpr(0x80000000, PR_P0BR);
mtpr(0x200000, PR_P1LR);
mtpr(AST_PCB, PR_P0LR);
-/*
- * Now everything should be complete, start virtual memory.
- */
+ /*
+ * Now everything should be complete, start virtual memory.
+ */
mtpr(sysptsize, PR_SLR);
mtpr(1, PR_MAPEN);
}
@@ -240,7 +240,7 @@ pmap_create(phys_size)
{
pmap_t pmap;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_create: phys_size %x\n",phys_size);
#endif
if (phys_size)
@@ -262,7 +262,7 @@ void
pmap_release(pmap)
struct pmap *pmap;
{
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_release: pmap %x\n",pmap);
#endif
@@ -291,7 +291,7 @@ pmap_destroy(pmap)
{
int count;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_destroy: pmap %x\n",pmap);
#endif
if (pmap == NULL)
@@ -315,7 +315,7 @@ pmap_enter(pmap, v, p, prot, wired)
vm_prot_t prot;
boolean_t wired;
{
- u_int j, i, pte, s, *patch;
+ u_int i, pte, s, *patch;
pv_entry_t pv, tmp;
if (v > 0x7fffffff) pte = kernel_prot[prot] | PG_PFNUM(p) | PG_V;
@@ -323,7 +323,7 @@ pmap_enter(pmap, v, p, prot, wired)
s = splimp();
pv = PHYS_TO_PV(p);
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)
printf("pmap_enter: pmap: %x,virt %x, phys %x,pv %x prot %x\n",
pmap,v,p,pv,prot);
@@ -415,7 +415,7 @@ pmap_map(virtuell, pstart, pend, prot)
vm_offset_t count;
int *pentry;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)
printf("pmap_map: virt %x, pstart %x, pend %x, Sysmap %x\n",
virtuell, pstart, pend, Sysmap);
@@ -438,8 +438,8 @@ pmap_extract(pmap, va)
vm_offset_t va;
{
- int *pte, nypte;
-#ifdef DEBUG
+ int *pte;
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_extract: pmap %x, va %x\n",pmap, va);
#endif
@@ -460,7 +460,7 @@ pmap_protect(pmap, start, end, prot)
{
int pte, *patch, s;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("pmap_protect: pmap %x, start %x, end %x, prot %x\n",
pmap, start, end,prot);
#endif
@@ -504,20 +504,22 @@ pmap_remove(pmap, start, slut)
pmap_t pmap;
vm_offset_t start, slut;
{
- u_int *ptestart, *pteslut,i,s,*temp;
+ u_int *ptestart, *pteslut, s, *temp;
pv_entry_t pv;
vm_offset_t countup;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("pmap_remove: pmap=0x %x, start=0x %x, slut=0x %x\n",
pmap, start, slut);
#endif
- if(!pmap) return;
+ if (!pmap)
+ return;
if(!pmap->pm_pcb&&start<0x80000000) return; /* No page registers */
/* First, get pte first address */
if(start<0x40000000){ /* P0 */
- if(!(temp=pmap->pm_pcb->P0BR)) return; /* No page table */
+ if (!(temp = (unsigned *)pmap->pm_pcb->P0BR))
+ return; /* No page table */
ptestart=&temp[start>>PGSHIFT];
pteslut=&temp[slut>>PGSHIFT];
if(pteslut>&temp[(pmap->pm_pcb->P0LR&~AST_MASK)])
@@ -526,14 +528,15 @@ if(startpmapdebug) printf("pmap_remove: pmap=0x %x, start=0x %x, slut=0x %x\n",
ptestart=(u_int *)&Sysmap[(start&0x3fffffff)>>PGSHIFT];
pteslut=(u_int *)&Sysmap[(slut&0x3fffffff)>>PGSHIFT];
} else { /* P1 (stack) region */
- if(!(temp=pmap->pm_pcb->P1BR)) return; /* No page table */
+ if (!(temp = (unsigned *)pmap->pm_pcb->P1BR))
+ return; /* No page table */
pteslut=&temp[(slut&0x3fffffff)>>PGSHIFT];
ptestart=&temp[(start&0x3fffffff)>>PGSHIFT];
if(ptestart<&temp[pmap->pm_pcb->P1LR])
ptestart=&temp[pmap->pm_pcb->P1LR];
}
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)
printf("pmap_remove: ptestart %x, pteslut %x, pv %x\n",ptestart, pteslut,pv);
#endif
@@ -555,7 +558,7 @@ printf("pmap_remove: ptestart %x, pteslut %x, pv %x\n",ptestart, pteslut,pv);
splx(s);
}
-
+int
remove_pmap_from_mapping(pv, pmap)
pv_entry_t pv;
pmap_t pmap;
@@ -600,7 +603,7 @@ pmap_copy_page(src, dst)
int s;
extern uint vmmap;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_copy_page: src %x, dst %x\n",src, dst);
#endif
s=splimp();
@@ -660,7 +663,7 @@ alloc_pv_entry()
if (temporary == 0)
panic("alloc_pv_entry");
#endif
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("alloc_pv_entry: %x\n",temporary);
#endif
} else {
@@ -700,7 +703,7 @@ pmap_is_referenced(pa)
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
spte|=*pte++;
spte|=*pte;
- } while(pv=pv->pv_next);
+ } while((pv=pv->pv_next));
return((spte&PG_REF)?1:0);
}
@@ -717,7 +720,7 @@ pmap_is_modified(pa)
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
spte|=*pte++;
spte|=*pte;
- } while(pv=pv->pv_next);
+ } while((pv=pv->pv_next));
return((spte&PG_M)?1:0);
}
@@ -731,12 +734,12 @@ pmap_clear_reference(pa)
vm_offset_t pa;
{
struct pv_entry *pv;
- int *pte,s,i;
+ int *pte;
/*
* Simulate page reference bit
*/
pv=PHYS_TO_PV(pa);
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("pmap_clear_reference: pa %x, pv %x\n",pa,pv);
#endif
@@ -749,7 +752,7 @@ if(startpmapdebug) printf("pmap_clear_reference: pa %x, pv %x\n",pa,pv);
*pte++|=PG_SREF;
*pte&= ~(PG_REF|PG_V);
*pte|=PG_SREF;
- } while(pv=pv->pv_next);
+ } while((pv=pv->pv_next));
mtpr(0,PR_TBIA);
}
@@ -758,7 +761,7 @@ pmap_clear_modify(pa)
vm_offset_t pa;
{
struct pv_entry *pv;
- u_int *pte,spte=0,s;
+ u_int *pte;
pv=PHYS_TO_PV(pa);
if(!pv->pv_pmap) return;
@@ -766,7 +769,7 @@ pmap_clear_modify(pa)
pte=(u_int *)pmap_virt2pte(pv->pv_pmap,pv->pv_va);
*pte++&= ~PG_M;
*pte&= ~PG_M;
- } while(pv=pv->pv_next);
+ } while((pv=pv->pv_next));
}
void
@@ -776,7 +779,7 @@ pmap_change_wiring(pmap, va, wired)
boolean_t wired;
{
int *pte;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("pmap_change_wiring: pmap %x, va %x, wired %x\n",
pmap, va, wired);
#endif
@@ -800,7 +803,7 @@ pmap_page_protect(pa, prot)
pv_entry_t pv,opv;
u_int s,*pte,*pte1,nyprot,kprot;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
#endif
pv = PHYS_TO_PV(pa);
@@ -827,7 +830,7 @@ if(startpmapdebug) printf("pmap_page_protect: pa %x, prot %x\n",pa, prot);
*pte1|=nyprot;
}
splx(s);
- } while(pv=pv->pv_next);
+ } while((pv=pv->pv_next));
mtpr(0,PR_TBIA);
break;
@@ -865,87 +868,96 @@ void
pmap_zero_page(phys)
vm_offset_t phys;
{
- int s;
+ int s;
-#ifdef DEBUG
+#ifdef PMAPDEBUG
if(startpmapdebug)printf("pmap_zero_page(phys %x, vmmap %x, pte_cmap %x\n",
phys,vmmap,pte_cmap);
#endif
- s=splimp();
- pte_cmap[0]=(phys>>PGSHIFT)|PG_V|PG_KW;
- pte_cmap[1]=pte_cmap[0]+1;
- mtpr(vmmap,PR_TBIS);
- mtpr(vmmap+NBPG,PR_TBIS);
- bzero((void *)vmmap,NBPG*2);
- pte_cmap[0]=pte_cmap[1]=0;
- mtpr(vmmap,PR_TBIS);
- mtpr(vmmap+NBPG,PR_TBIS);
+ s = splimp();
+ pte_cmap[0] = (phys >> PGSHIFT) | PG_V|PG_KW;
+ pte_cmap[1] = pte_cmap[0] + 1;
+ mtpr(vmmap, PR_TBIS);
+ mtpr(vmmap+ NBPG, PR_TBIS);
+ bzero((void *)vmmap, NBPG * 2);
+ pte_cmap[0] = pte_cmap[1] = 0;
+ mtpr(vmmap, PR_TBIS);
+ mtpr(vmmap + NBPG, PR_TBIS);
splx(s);
}
pt_entry_t *
-pmap_virt2pte(pmap,vaddr)
+pmap_virt2pte(pmap, vaddr)
pmap_t pmap;
u_int vaddr;
{
- u_int *pte,scr;
-
- if(vaddr<0x40000000){
- pte=pmap->pm_pcb->P0BR;
- if((vaddr>>PGSHIFT)>(pmap->pm_pcb->P0LR&~AST_MASK)) return 0;
- } else if(vaddr<(u_int)0x80000000){
- pte=pmap->pm_pcb->P1BR;
- if(((vaddr&0x3fffffff)>>PGSHIFT)<pmap->pm_pcb->P1LR) return 0;
- } else {
- pte=(u_int *)Sysmap;
- }
-
- vaddr&=(u_int)0x3fffffff;
-
- return((pt_entry_t *)&pte[vaddr>>PGSHIFT]);
+ u_int *pte;
+
+ if (vaddr < 0x40000000) {
+ pte = (unsigned *)pmap->pm_pcb->P0BR;
+ if ((vaddr >> PGSHIFT) > (pmap->pm_pcb->P0LR & ~AST_MASK))
+ return 0;
+ } else if (vaddr < (u_int)0x80000000) {
+ pte = (unsigned *)pmap->pm_pcb->P1BR;
+ if (((vaddr & 0x3fffffff) >> PGSHIFT) < pmap->pm_pcb->P1LR)
+ return 0;
+ } else
+ pte = (u_int *)Sysmap;
+
+ vaddr &= (u_int)0x3fffffff;
+
+ return ((pt_entry_t *)&pte[vaddr >> PGSHIFT]);
}
-pmap_expandp0(pmap,ny_storlek)
- struct pmap *pmap;
+void
+pmap_expandp0(pmap, ny_storlek)
+ struct pmap *pmap;
{
- u_int tmp,s,size,osize,oaddr,astlvl,*i,j;
-
- astlvl=pmap->pm_pcb->P0LR&AST_MASK;
- osize=(pmap->pm_pcb->P0LR&~AST_MASK)*4;
- size=ny_storlek*4;
- tmp=kmem_alloc_wait(pte_map, size);
- s=splhigh();
- if(osize) blkcpy(pmap->pm_pcb->P0BR, (void*)tmp,osize);
- oaddr=(u_int)pmap->pm_pcb->P0BR;
- mtpr(tmp,PR_P0BR);
- mtpr(((size>>2)|astlvl),PR_P0LR);
- mtpr(0,PR_TBIA);
- pmap->pm_pcb->P0BR=(void*)tmp;
- pmap->pm_pcb->P0LR=((size>>2)|astlvl);
+ u_int tmp, s, size, osize, oaddr, astlvl;
+
+ astlvl = pmap->pm_pcb->P0LR & AST_MASK;
+ osize = (pmap->pm_pcb->P0LR & ~AST_MASK) * 4;
+ size = ny_storlek * 4;
+ tmp = kmem_alloc_wait(pte_map, size);
+ if (osize)
+ blkcpy(pmap->pm_pcb->P0BR, (void*)tmp, osize);
+
+ s = splimp();
+ oaddr = (u_int)pmap->pm_pcb->P0BR;
+ mtpr(tmp, PR_P0BR);
+ mtpr(((size >> 2) | astlvl), PR_P0LR);
+ mtpr(0, PR_TBIA);
+ pmap->pm_pcb->P0BR = (void*)tmp;
+ pmap->pm_pcb->P0LR = ((size >> 2) | astlvl);
splx(s);
+
if(osize)
kmem_free_wakeup(pte_map, (vm_offset_t)oaddr, osize);
}
+void
pmap_expandp1(pmap)
- struct pmap *pmap;
+ struct pmap *pmap;
{
- u_int tmp,s,size,osize,oaddr,*i,j;
-
- osize=0x800000-(pmap->pm_pcb->P1LR*4);
- size=osize+PAGE_SIZE;
- tmp=kmem_alloc_wait(pte_map, size);
- s=splhigh();
-
- if(osize) blkcpy((void*)pmap->pm_stack, (void*)tmp+PAGE_SIZE,osize);
- oaddr=pmap->pm_stack;
- pmap->pm_pcb->P1BR=(void*)(tmp+size-0x800000);
- pmap->pm_pcb->P1LR=(0x800000-size)>>2;
- pmap->pm_stack=tmp;
- mtpr(pmap->pm_pcb->P1BR,PR_P1BR);
- mtpr(pmap->pm_pcb->P1LR,PR_P1LR);
- mtpr(0,PR_TBIA);
+ u_int tmp, s, size, osize, oaddr;
+
+ osize = 0x800000 - (pmap->pm_pcb->P1LR * 4);
+ size = osize + PAGE_SIZE;
+ tmp = kmem_alloc_wait(pte_map, size);
+
+ if (osize)
+ blkcpy((void*)pmap->pm_stack, (void*)tmp + PAGE_SIZE, osize);
+
+ s = splimp();
+ oaddr = pmap->pm_stack;
+ pmap->pm_pcb->P1BR = (void*)(tmp + size - 0x800000);
+ pmap->pm_pcb->P1LR = (0x800000 - size) >> 2;
+ pmap->pm_stack = tmp;
+ mtpr(pmap->pm_pcb->P1BR, PR_P1BR);
+ mtpr(pmap->pm_pcb->P1LR, PR_P1LR);
+ mtpr(0, PR_TBIA);
splx(s);
+
if (osize)
kmem_free_wakeup(pte_map, (vm_offset_t)oaddr, osize);
}
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index 5f2d3e6e11f..67fab5824c0 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rootfil.c,v 1.7 1996/01/28 12:09:34 ragge Exp $ */
+/* $NetBSD: rootfil.c,v 1.11 1996/04/08 18:32:54 ragge Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -44,40 +44,47 @@
*/
/* All bugs are subject to removal without further notice */
-#include "param.h"
-#include "vax/include/sid.h"
-#include "buf.h"
-#include "mbuf.h"
-#include "vax/include/pte.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/mbuf.h>
+#include <sys/reboot.h>
+#include <sys/conf.h>
+#include <sys/device.h>
+
+#include <machine/macros.h>
+#include <machine/nexus.h>
+#include <machine/sid.h>
+#include <machine/pte.h>
+#include <machine/cpu.h>
+
+#include <vax/uba/ubavar.h>
+
#include "uda.h"
-#include "reboot.h"
-#include "conf.h"
-#include "vax/include/macros.h"
-#include "vax/include/nexus.h"
-#include "vax/uba/ubavar.h"
+#include "hp.h"
#define DOSWAP /* Change swdevt, argdev, and dumpdev too */
u_long bootdev; /* should be dev_t, but not until 32 bits */
extern dev_t rootdev, dumpdev;
static char devname[][2] = {
- 'h','p', /* 0 = hp */
- 0,0, /* 1 = ht */
- 'u','p', /* 2 = up */
- 'r','k', /* 3 = hk */
- 0,0, /* 4 = sw */
- 0,0, /* 5 = tm */
- 0,0, /* 6 = ts */
- 0,0, /* 7 = mt */
- 0,0, /* 8 = tu */
- 'r','a', /* 9 = ra */
- 0,0, /* 10 = ut */
- 'r','b', /* 11 = rb */
- 0,0, /* 12 = uu */
- 0,0, /* 13 = rx */
- 'r','l', /* 14 = rl */
- 0,0, /* 15 = tmscp */
- 'k','r', /* 16 = ra on kdb50 */
+ {'h','p'}, /* 0 = hp */
+ {0,0}, /* 1 = ht */
+ {'u','p'}, /* 2 = up */
+ {'r','k'}, /* 3 = hk */
+ {0,0}, /* 4 = sw */
+ {0,0}, /* 5 = tm */
+ {0,0}, /* 6 = ts */
+ {0,0}, /* 7 = mt */
+ {0,0}, /* 8 = tu */
+ {'r','a'}, /* 9 = ra */
+ {0,0}, /* 10 = ut */
+ {'r','b'}, /* 11 = rb */
+ {0,0}, /* 12 = uu */
+ {0,0}, /* 13 = rx */
+ {'r','l'}, /* 14 = rl */
+ {0,0}, /* 15 = tmscp */
+ {'k','r'}, /* 16 = ra on kdb50 */
};
#define PARTITIONMASK 0x7
@@ -88,10 +95,11 @@ static char devname[][2] = {
* If we can do so, and not instructed not to do so,
* change rootdev to correspond to the load device.
*/
+void
setroot()
{
int majdev, mindev, unit, part, controller, adaptor;
- dev_t temp, orootdev;
+ dev_t temp = 0, orootdev;
#if NUDA > 0
extern struct uba_device ubdinit[];
#endif
@@ -109,43 +117,10 @@ setroot()
part = B_PARTITION(bootdev);
unit = B_UNIT(bootdev);
if (majdev == 0) { /* MBA device */
-#if NMBA > 0
- register struct mba_device *mbap;
- int mask;
-
-/*
- * The MBA number used at boot time is not necessarily the same as the
- * MBA number used by the kernel. In order to change the rootdev we need to
- * convert the boot MBA number to the kernel MBA number. The address space
- * for an MBA used by the boot code is 0x20010000 + 0x2000 * MBA_number
- * on the 78? and 86?0, 0xf28000 + 0x2000 * MBA_number on the 750.
- * Therefore we can search the mba_hd table for the MBA that has the physical
- * address corresponding to the boot MBA number.
- */
-#define PHYSADRSHFT 13
-#define PHYSMBAMASK780 0x7
-#define PHYSMBAMASK750 0x3
-
- switch (MACHID(cpu_type)) {
-
- case VAX_780:
-/* case VAX_8600: */
- default:
- mask = PHYSMBAMASK780;
- break;
-
- case VAX_750:
- mask = PHYSMBAMASK750;
- break;
- }
- for (mbap = mbdinit; mbap->driver; mbap++)
- if (mbap->alive && mbap->drive == unit &&
- (((long)mbap->hd->mh_physmba >> PHYSADRSHFT)
- & mask) == adaptor)
- break;
- if (mbap->driver == 0)
- return;
- mindev = mbap->unit;
+#if NHP > 0
+ mindev = hp_getdev(adaptor, unit);
+ if (mindev < 0)
+ return;
#else
return;
#endif
@@ -153,7 +128,6 @@ setroot()
register struct uba_device *ubap;
for (ubap = ubdinit; ubap->ui_driver; ubap++){
- printf("ubap %x\n",ubap);
if (ubap->ui_alive && ubap->ui_slave == unit &&
ubap->ui_ctlr == controller &&
ubap->ui_ubanum == adaptor &&
@@ -164,7 +138,6 @@ setroot()
if (ubap->ui_driver == 0)
return;
mindev = ubap->ui_unit;
- printf("mindev %x, majdev %x\n",mindev,majdev);
}
mindev = (mindev << PARTITIONSHIFT) + part;
orootdev = rootdev;
@@ -209,6 +182,7 @@ setroot()
/*
* Configure swap space and related parameters.
*/
+void
swapconf()
{
register struct swdevt *swp;
diff --git a/sys/arch/vax/vax/sbi.c b/sys/arch/vax/vax/sbi.c
index 98cd05ef646..2ded418713a 100644
--- a/sys/arch/vax/vax/sbi.c
+++ b/sys/arch/vax/vax/sbi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sbi.c,v 1.4 1995/12/13 18:45:53 ragge Exp $ */
+/* $NetBSD: sbi.c,v 1.9 1996/04/08 18:32:55 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -29,19 +29,24 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/device.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
-#include "vm/vm_page.h"
-#include "machine/ka750.h"
-#include "machine/pmap.h"
-#include "machine/sid.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+#include <machine/ka750.h>
+#include <machine/pmap.h>
+#include <machine/sid.h>
+#include <machine/cpu.h>
struct nexus *nexus;
-static int sbi_attached = 0;
+static int sbi_print __P((void *, char *));
+ int sbi_match __P((struct device *, void *, void *));
+ void sbi_attach __P((struct device *, struct device *, void*));
+
struct bp_conf {
char *type;
@@ -62,7 +67,6 @@ sbi_print(aux, name)
switch (sa->type) {
case NEX_MBA:
printf("mba%d at %s",nmba++, name);
- unsupp++;
break;
default:
printf("unknown device 0x%x at %s", sa->type, name);
@@ -76,14 +80,13 @@ sbi_print(aux, name)
int
sbi_match(parent, cf, aux)
struct device *parent;
- struct cfdata *cf;
- void *aux;
+ void *cf, *aux;
{
struct bp_conf *bp = aux;
if (strcmp(bp->type, "sbi"))
- return 1;
- return 0;
+ return 0;
+ return 1;
}
void
@@ -91,9 +94,8 @@ sbi_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- void *nisse;
- u_int nextype, nexnum, maxnex;
- struct sbi_attach_args sa;
+ u_int nexnum, maxnex, minnex;
+ struct sbi_attach_args sa;
switch (cpunumber) {
#ifdef VAX730
@@ -133,6 +135,9 @@ sbi_attach(parent, self, aux)
printf(": SBI780\n");
break;
#endif
+ default:
+ maxnex = 0; /* Leave it */
+ break;
}
/*
@@ -140,21 +145,24 @@ sbi_attach(parent, self, aux)
* in different ways (if they identifies themselves at all).
* We have to fake identifying depending on different CPUs.
*/
- for (nexnum = 0; nexnum < maxnex; nexnum++) {
+ minnex = self->dv_unit * maxnex;
+ for (nexnum = minnex; nexnum < minnex + maxnex; nexnum++) {
+ volatile int tmp;
+
if (badaddr((caddr_t)&nexus[nexnum], 4))
continue;
- switch(cpunumber){
+ switch (cpunumber) {
#ifdef VAX750
case VAX_750:
- { extern int nexty750[];
+ { extern int nexty750[];
sa.type = nexty750[nexnum];
break;
}
#endif
#ifdef VAX730
case VAX_730:
- { extern int nexty730[];
+ { extern int nexty730[];
sa.type = nexty730[nexnum];
break;
}
@@ -166,7 +174,8 @@ sbi_attach(parent, self, aux)
break;
#endif
default:
- sa.type = nexus[nexnum].nexcsr.nex_type;
+ tmp = nexus[nexnum].nexcsr.nex_csr; /* no byte reads */
+ sa.type = tmp & 255;
}
sa.nexnum = nexnum;
sa.nexaddr = nexus + nexnum;
@@ -174,6 +183,11 @@ sbi_attach(parent, self, aux)
}
}
-struct cfdriver sbicd =
- { NULL, "sbi", sbi_match, sbi_attach, DV_DULL, sizeof(struct device) };
+struct cfdriver sbi_cd = {
+ NULL, "sbi", DV_DULL
+};
+struct cfattach sbi_ca = {
+ sizeof(struct device), sbi_match, sbi_attach
+};
+
diff --git a/sys/arch/vax/vax/subr.s b/sys/arch/vax/vax/subr.s
index f0a6e60b84b..699406cc6da 100644
--- a/sys/arch/vax/vax/subr.s
+++ b/sys/arch/vax/vax/subr.s
@@ -1,4 +1,4 @@
-/* $NetBSD: subr.s,v 1.13 1996/01/28 12:22:52 ragge Exp $ */
+/* $NetBSD: subr.s,v 1.16 1996/03/17 22:56:18 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -33,13 +33,13 @@
/* All bugs are subject to removal without further notice */
-#include "sys/syscall.h"
-#include "sys/errno.h"
+#include <sys/syscall.h>
+#include <sys/errno.h>
-#include "machine/mtpr.h"
-#include "machine/vmparam.h"
-#include "machine/pte.h"
-#include "machine/nexus.h"
+#include <machine/mtpr.h>
+#include <machine/vmparam.h>
+#include <machine/pte.h>
+#include <machine/nexus.h>
.text
@@ -117,57 +117,65 @@ _badaddr: .word 0x0
ret
#
-# copyin(from, to, len) copies from userspace to kernelspace.
+# Speeded up locopyin/locopyout written by Ken Wellsch.
#
+# locopyin (from, to, len, addr) copies from userspace to kernelspace.
+# addr is iftrap addr for faulting.
+#
+ .globl _locopyin
+ .align 2
- .globl _locopyin
-_locopyin:.word 0x1c
- movl 16(ap),r0 # Get fault pointer flag
- movl $ci,(r0)
-
- movl 4(ap),r0 # from
- movl 8(ap),r1 # to
- movl 12(ap),r2 # len
+_locopyin: .word 0x3c # save R2|R3|R4|R5
- movl r0,r4
- movl r2,r3
+ movl 4(ap),r4 # stash userspace address
+ movl 12(ap),r3 # and length in case of fault?
- tstl r2
- beql 3f
-2: movb (r0)+,(r1)+ # XXX Should be done in a faster way.
- decl r2
- bneq 2b
-3: movl 16(ap),r0
- clrl (r0)
- clrl r0
-ci: ret
+ brb copyio
#
-# locopyout(from, to, len, addr) in the same manner as copyin()
-# addr is iftrap addr for faulting.
+# locopyout (from, to, len, addr) copies from kernelspace to userspace.
+# addr is iftrap addr for faulting.
#
+ .globl _locopyout
+ .align 2
- .globl _locopyout
-_locopyout:.word 0x1c
- movl 16(ap),r0 # Get fault pointer flag
- movl $co,(r0) # and save ret addr
+_locopyout: .word 0x3c # save R2|R3|R4|R5
- movl 4(ap),r0 # from
- movl 8(ap),r1 # to
- movl 12(ap),r2 # len
+ movl 8(ap),r4 # stash userspace address
+ movl 12(ap),r3 # and length in case of fault?
- movl r1,r4
- movl r2,r3
+copyio:
+
+ movl 12(ap),r2 # len
+ beql 5f
+
+ movl 16(ap),r0 # Get fault pointer flag
+ movl $cio,(r0) # and stuff return address into it
+
+ movl 4(ap),r0 # from
+ movl 8(ap),r1 # to
+
+ ashl $-3,r2,r5 # convert length to quad words
+ beql 2f
+1:
+ movq (r0)+,(r1)+ # do the copying in large hunks
+ sobgtr r5,1b # (although movc3 is twice as fast
+ # alas movc5 clobbers [r0-r5] thus
+ # damaging the magic r3/r4 pair)
+2:
+ bicl3 $-8,r2,r5 # compute trailing bytes (<=7)
+ beql 4f
+3:
+ movb (r0)+,(r1)+
+ sobgtr r5,3b
+4:
+ movl 16(ap),r0 # remove fault address
+ clrl (r0)
+5:
+ clrl r0 # flag the successful operation
+cio:
+ ret
- tstl r2
- beql 3f
-2: movb (r0)+,(r1)+ # XXX Should be done in a faster way.
- decl r2
- bneq 2b
-3: movl 16(ap),r0
- clrl (r0)
- clrl r0
-co: ret
#
# copystr(from, to, maxlen, *copied, addr)
@@ -222,6 +230,23 @@ _loswtch: .globl _loswtch
_memtest: .long 0 ; .globl _memtest # Memory test in progress.
+# Have bcopy and bzero here to be sure that system files that not gets
+# macros.h included will not complain.
+_bcopy: .globl _bcopy
+ .word 0x0
+ movl 4(ap), r0
+ movl 8(ap), r1
+ movl 0xc(ap), r2
+ movc3 r2, (r0), (r1)
+ ret
+
+_bzero: .globl _bzero
+ .word 0x0
+ movl 4(ap), r0
+ movl 8(ap), r1
+ movc5 $0, (r0), $0, r1, (r0)
+ ret
+
#ifdef DDB
/*
* DDB is the only routine that uses setjmp/longjmp.
diff --git a/sys/arch/vax/vax/swapgeneric.c b/sys/arch/vax/vax/swapgeneric.c
index 613fb771a21..88fc116f2a1 100644
--- a/sys/arch/vax/vax/swapgeneric.c
+++ b/sys/arch/vax/vax/swapgeneric.c
@@ -1,4 +1,4 @@
-/* $NetBSD: swapgeneric.c,v 1.6 1996/01/28 12:09:37 ragge Exp $ */
+/* $NetBSD: swapgeneric.c,v 1.9 1996/04/08 18:32:57 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -38,18 +38,26 @@
#include "uda.h"
#include "hp.h"
-#include "sys/param.h"
-#include "sys/conf.h"
-#include "sys/buf.h"
-#include "sys/systm.h"
-#include "sys/reboot.h"
-#include "sys/device.h"
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/buf.h>
+#include <sys/systm.h>
+#include <sys/reboot.h>
+#include <sys/device.h>
-#include "machine/pte.h"
-#include "machine/mtpr.h"
+#include <dev/cons.h>
-#include "../uba/ubareg.h"
-#include "../uba/ubavar.h"
+#include <ufs/ffs/ffs_extern.h>
+
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/cpu.h>
+
+#include <vax/uba/ubareg.h>
+#include <vax/uba/ubavar.h>
+
+
+void gets __P((char *));
/*
* Generic configuration; all in one
@@ -67,8 +75,7 @@ struct swdevt swdevt[] = {
long dumplo;
int dmmin, dmmax, dmtext;
-extern int ffs_mountroot();
-int (*mountroot)() = ffs_mountroot;
+int (*mountroot) __P((void)) = ffs_mountroot;
extern struct uba_driver scdriver;
extern struct uba_driver hkdriver;
@@ -77,14 +84,14 @@ extern struct uba_driver hldriver;
extern struct uba_driver udadriver;
extern struct uba_driver kdbdriver;
-extern struct cfdriver hpcd;
+extern struct cfdriver hp_cd;
struct ngcconf {
struct cfdriver *ng_cf;
dev_t ng_root;
} ngcconf[] = {
#if NHP > 0
- { &hpcd, makedev(0, 0), },
+ { &hp_cd, makedev(0, 0), },
#endif
{ 0 },
};
@@ -94,7 +101,7 @@ struct genericconf {
char *gc_name;
dev_t gc_root;
} genericconf[] = {
-/* { (caddr_t)&hpcd, "hp", makedev(0, 0), },
+/* { (caddr_t)&hp_cd, "hp", makedev(0, 0), },
{ (caddr_t)&scdriver, "up", makedev(2, 0), }, */
#if NUDA > 0
{ (caddr_t)&udadriver, "ra", makedev(9, 0), },
@@ -107,6 +114,7 @@ struct genericconf {
{ 0 },
};
+void
setconf()
{
#if NUDA > 0
@@ -213,6 +221,7 @@ doswap:
rootdev = dumpdev;
}
+void
gets(cp)
char *cp;
{
diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c
index cffdcdec840..906be1f8aa7 100644
--- a/sys/arch/vax/vax/trap.c
+++ b/sys/arch/vax/vax/trap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.15 1996/01/28 12:24:33 ragge Exp $ */
+/* $NetBSD: trap.c,v 1.20 1996/04/08 18:32:58 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -34,29 +34,48 @@
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/syscall.h"
-#include "sys/systm.h"
-#include "sys/signalvar.h"
-#include "sys/exec.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
-#include "vm/vm_page.h"
-#include "vax/include/mtpr.h"
-#include "vax/include/pte.h"
-#include "vax/include/pcb.h"
-#include "vax/include/trap.h"
-#include "vax/include/pmap.h"
-#include "kern/syscalls.c"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/syscall.h>
+#include <sys/systm.h>
+#include <sys/signalvar.h>
+#include <sys/exec.h>
+#include <sys/cpu.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+
+#include <machine/mtpr.h>
+#include <machine/pte.h>
+#include <machine/pcb.h>
+#include <machine/trap.h>
+#include <machine/pmap.h>
+
+#ifdef DDB
+#include <machine/db_machdep.h>
+#endif
+#include <kern/syscalls.c>
+#ifdef KTRACE
+#include <sys/ktrace.h>
+#endif
extern int want_resched,whichqs;
-volatile int startsysc=0,ovalidstart=0,faultdebug=0,haltfault=0;
+#ifdef TRAPDEBUG
+volatile int startsysc=0,faultdebug=0;
+#endif
+static void userret __P((struct proc *, u_int, u_int));
+void arithflt __P((struct trapframe *));
+void syscall __P((struct trapframe *));
+void showregs __P((struct trapframe *));
+void showstate __P((struct proc *));
+void stray __P((int, int));
+void printstack __P((u_int *, u_int *));
+void
userret(p, pc, psl)
struct proc *p;
u_int pc, psl;
@@ -77,7 +96,7 @@ userret(p, pc, psl)
*/
s=splstatclock();
setrunqueue(curproc);
- cpu_switch();
+ cpu_switch(0);
splx(s);
while ((sig = CURSIG(curproc)) != 0)
postsig(sig);
@@ -108,11 +127,12 @@ char *traptypes[]={
};
int no_traps = 18;
+void
arithflt(frame)
struct trapframe *frame;
{
u_int sig, type=frame->trap,trapsig=1,s;
- u_int rv, addr,*i,j;
+ u_int rv, addr;
struct proc *p=curproc;
struct pmap *pm;
vm_map_t map;
@@ -127,11 +147,12 @@ arithflt(frame)
type&=~(T_WRITE|T_PTEFETCH);
-
+#ifdef TRAPDEBUG
if(frame->trap==7) goto fram;
if(faultdebug)printf("Trap: type %x, code %x, pc %x, psl %x\n",
frame->trap, frame->code, frame->pc, frame->psl);
fram:
+#endif
switch(type){
default:
@@ -195,10 +216,12 @@ faulter:
/* Fall into... */
case T_ACCFLT:
case T_ACCFLT|T_USER:
+#ifdef TRAPDEBUG
if(faultdebug)printf("trap accflt type %x, code %x, pc %x, psl %x\n",
frame->trap, frame->code, frame->pc, frame->psl);
-
- if(!p) panic("trap: access fault without process");
+#endif
+ if (!p)
+ panic("trap: access fault without process");
pm=&p->p_vmspace->vm_pmap;
if(frame->trap&T_PTEFETCH){
u_int faultaddr,testaddr=(u_int)frame->code&0x3fffffff;
@@ -223,9 +246,8 @@ if(faultdebug)printf("trap accflt type %x, code %x, pc %x, psl %x\n",
sig=SIGSEGV;
goto bad;
- } else trapsig=0;
-/* return; /* We don't know if it was a trap only for PTE*/
-/* break; */
+ } else
+ trapsig=0;
}
addr=(frame->code& ~PAGE_MASK);
if((frame->pc>(unsigned)0x80000000)&&
@@ -254,8 +276,10 @@ if(faultdebug)printf("trap accflt type %x, code %x, pc %x, psl %x\n",
case T_PTELEN:
case T_PTELEN|T_USER: /* Page table length exceeded */
pm=&p->p_vmspace->vm_pmap;
+#ifdef TRAPDEBUG
if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n",
frame->trap, frame->code, frame->pc, frame->psl);
+#endif
if(frame->code<0x40000000){ /* P0 */
int i;
@@ -306,9 +330,11 @@ if(faultdebug)printf("trap ptelen type %x, code %x, pc %x, psl %x\n",
trapsig=0;
break;
+#ifdef DDB
case T_KDBTRAP:
kdb_trap(frame);
return;
+#endif
}
bad:
if (trapsig)
@@ -317,6 +343,7 @@ uret:
userret(curproc, frame->pc, frame->psl);
};
+void
showstate(p)
struct proc *p;
{
@@ -326,9 +353,9 @@ if(p){
p->p_vmspace->vm_tsize, p->p_vmspace->vm_dsize,p->p_vmspace->
vm_ssize);
printf("virt text %x, virt data %x, max stack %x\n",
- p->p_vmspace->vm_taddr,p->p_vmspace->vm_daddr,
- p->p_vmspace->vm_maxsaddr);
- printf("kernel uarea %x, end uarea %x\n",p->p_addr,
+ (u_int)p->p_vmspace->vm_taddr, (u_int)p->p_vmspace->vm_daddr,
+ (u_int)p->p_vmspace->vm_maxsaddr);
+ printf("kernel uarea %x, end uarea %x\n",(u_int)p->p_addr,
(u_int)p->p_addr + USPACE);
} else {
printf("No process\n");
@@ -354,20 +381,23 @@ setregs(p, pack, stack, retval)
retval[0] = retval[1] = 0;
}
+void
syscall(frame)
struct trapframe *frame;
{
struct sysent *callp;
int nsys;
- int err,rval[2],args[8],sig;
+ int err, rval[2], args[8];
struct trapframe *exptr;
- struct proc *p=curproc;
+ struct proc *p = curproc;
+#ifdef TRAPDEBUG
if(startsysc)printf("trap syscall %s pc %x, psl %x, sp %x, pid %d, frame %x\n",
syscallnames[frame->code], frame->pc, frame->psl,frame->sp,
curproc->p_pid,frame);
+#endif
- p->p_addr->u_pcb.framep = frame;
+ exptr = p->p_addr->u_pcb.framep = frame;
callp = p->p_emul->e_sysent;
nsys = p->p_emul->e_nsysent;
@@ -386,40 +416,66 @@ if(startsysc)printf("trap syscall %s pc %x, psl %x, sp %x, pid %d, frame %x\n",
rval[0]=0;
rval[1]=frame->r1;
- if(callp->sy_narg)
- copyin((char*)frame->ap+4, args, callp->sy_argsize);
-
+ if(callp->sy_narg) {
+ err = copyin((char*)frame->ap+4, args, callp->sy_argsize);
+ if (err) {
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSCALL))
+ ktrsyscall(p->p_tracep, frame->code,
+ callp->sy_argsize, args);
+#endif
+ goto bad;
+ }
+ }
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSCALL))
+ ktrsyscall(p->p_tracep, frame->code, callp->sy_argsize, args);
+#endif
err=(*callp->sy_call)(curproc,args,rval);
- exptr=curproc->p_addr->u_pcb.framep;
+ exptr = curproc->p_addr->u_pcb.framep;
+#ifdef TRAPDEBUG
if(startsysc)
printf("retur %s pc %x, psl %x, sp %x, pid %d, v{rde %d r0 %d, r1 %d, frame %x\n",
syscallnames[exptr->code], exptr->pc, exptr->psl,exptr->sp,
curproc->p_pid,err,rval[0],rval[1],exptr);
+#endif
- switch(err){
+bad:
+ switch (err) {
case 0:
- exptr->r1=rval[1];
- exptr->r0=rval[0];
+ exptr->r1 = rval[1];
+ exptr->r0 = rval[0];
exptr->psl &= ~PSL_C;
break;
+
case EJUSTRETURN:
return;
+
case ERESTART:
- exptr->pc=exptr->pc-2;
+ exptr->pc = exptr->pc-2;
break;
+
default:
- exptr->r0=err;
+ exptr->r0 = err;
exptr->psl |= PSL_C;
break;
}
userret(curproc, exptr->pc, exptr->psl);
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_SYSRET))
+ ktrsysret(p->p_tracep, frame->code, err, rval[0]);
+#endif
}
-stray(scb, vec){
+void
+stray(scb, vec)
+ int scb, vec;
+{
printf("stray interrupt scb %d, vec 0x%x\n", scb, vec);
}
+void
printstack(loaddr, highaddr)
u_int *loaddr, *highaddr;
{
@@ -429,9 +485,10 @@ printstack(loaddr, highaddr)
for (;tmp < highaddr;tmp += 4)
printf("%8x: %8x %8x %8x %8x\n",
- tmp, *tmp, *(tmp + 1), *(tmp + 2), *(tmp + 3));
+ (int)tmp, *tmp, *(tmp + 1), *(tmp + 2), *(tmp + 3));
}
+void
showregs(frame)
struct trapframe *frame;
{
diff --git a/sys/arch/vax/vax/uvaxII.c b/sys/arch/vax/vax/uvaxII.c
index d209d56493e..fe115911879 100644
--- a/sys/arch/vax/vax/uvaxII.c
+++ b/sys/arch/vax/vax/uvaxII.c
@@ -1,8 +1,11 @@
-/* $NetBSD: uvaxII.c,v 1.5 1996/01/28 11:45:07 ragge Exp $ */
+/* $NetBSD: uvaxII.c,v 1.8 1996/04/08 18:32:59 ragge Exp $ */
/*-
- * Copyright (c) 1988 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1994 Gordon W. Ross
+ * Copyright (c) 1993 Adam Glass
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1982, 1988, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -35,25 +38,39 @@
* @(#)ka630.c 7.8 (Berkeley) 5/9/91
*/
-#include "sys/param.h"
-#include "sys/types.h"
-#include "sys/device.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
+#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/device.h>
+#include <sys/systm.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
-#include "machine/uvaxII.h"
-#include "machine/pte.h"
-#include "machine/mtpr.h"
-#include "machine/sid.h"
-#include "machine/pmap.h"
-#include "machine/nexus.h"
+#include <machine/uvaxII.h>
+#include <machine/pte.h>
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/pmap.h>
+#include <machine/nexus.h>
struct uvaxIIcpu *uvaxIIcpu_ptr;
#if VAX630
struct ka630clock *ka630clk_ptr;
-u_long ka630_clkread();
-void ka630_clkwrite();
+static time_t ka630_clkread __P((int *));
+static void ka630_clkwrite __P((time_t));
+
+struct watclk {
+ u_short wat_sec;
+ u_short wat_min;
+ u_short wat_hour;
+ u_short wat_dow;
+ u_short wat_day;
+ u_short wat_month;
+ u_short wat_year;
+};
+
+void gmt_to_wat (time_t *tp, struct watclk *wt);
+void wat_to_gmt (struct watclk *wt, time_t *tp);
#endif
/*
@@ -73,11 +90,14 @@ uvaxII_conf(parent, self, aux)
case VAX_410:
strcpy(cpu_model,"MicroVAX 2000");
break;
+ default:
+ strcpy(cpu_model, "MicroVAX 78032/78132");
+ break;
};
- strcpy(cpu_model, "MicroVAX 78032/78132");
printf(": %s\n", cpu_model);
}
+int
uvaxII_clock()
{
mtpr(0x40, PR_ICCS); /* Start clock and enable interrupt */
@@ -85,6 +105,7 @@ uvaxII_clock()
}
/* log crd errors */
+void
uvaxII_memerr()
{
printf("memory err!\n");
@@ -106,6 +127,7 @@ struct mc78032frame {
int mc63_psl; /* trapped psl */
};
+int
uvaxII_mchk(cmcf)
caddr_t cmcf;
{
@@ -119,11 +141,11 @@ uvaxII_mchk(cmcf)
mcf->mc63_mrvaddr, mcf->mc63_istate,
mcf->mc63_pc, mcf->mc63_psl);
if (uvaxIIcpu_ptr && uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_MERR) {
- printf("\tmser=0x%x ", uvaxIIcpu_ptr->uvaxII_mser);
+ printf("\tmser=0x%x ", (int)uvaxIIcpu_ptr->uvaxII_mser);
if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_CPUE)
- printf("page=%d", uvaxIIcpu_ptr->uvaxII_cear);
+ printf("page=%d", (int)uvaxIIcpu_ptr->uvaxII_cear);
if (uvaxIIcpu_ptr->uvaxII_mser & UVAXIIMSER_DQPE)
- printf("page=%d", uvaxIIcpu_ptr->uvaxII_dear);
+ printf("page=%d", (int)uvaxIIcpu_ptr->uvaxII_dear);
printf("\n");
}
return (-1);
@@ -134,9 +156,9 @@ uvaxII_mchk(cmcf)
*/
u_long
uvaxII_gettodr(stopped_flag)
- int *stopped_flag;
+ int *stopped_flag;
{
- register u_long year_secs;
+ register time_t year_secs;
switch (cpu_type) {
#if VAX630
@@ -153,9 +175,9 @@ uvaxII_gettodr(stopped_flag)
void
uvaxII_settodr(year_ticks)
- u_long year_ticks;
+ time_t year_ticks;
{
- register u_long year_secs;
+ register time_t year_secs;
year_secs = year_ticks / 100;
switch (cpu_type) {
@@ -168,43 +190,46 @@ uvaxII_settodr(year_ticks)
}
#if VAX630
-static short dayyr[12] = { 0,31,59,90,120,151,181,212,243,273,304,334 };
/* init system time from tod clock */
/* ARGSUSED */
-u_long
+time_t
ka630_clkread(stopped_flag)
- int *stopped_flag;
+ int *stopped_flag;
{
register struct ka630clock *claddr = ka630clk_ptr;
- register int days, yr;
- register u_long year_secs;
+ struct watclk wt;
+ time_t year_secs;
*stopped_flag = 0;
+
claddr->csr1 = KA630CLK_SET;
while ((claddr->csr0 & KA630CLK_UIP) != 0)
;
+
+ wt.wat_sec = claddr->sec;
+ wt.wat_min = claddr->min;
+ wt.wat_hour = claddr->hr;
+ wt.wat_day = claddr->day;
+ wt.wat_month = claddr->mon;
+ wt.wat_year = claddr->yr;
+
/* If the clock is valid, use it. */
if ((claddr->csr3 & KA630CLK_VRT) != 0 &&
(claddr->csr1 & KA630CLK_ENABLE) == KA630CLK_ENABLE) {
/* simple sanity checks */
- if (claddr->mon < 1 || claddr->mon > 12 ||
- claddr->day < 1 || claddr->day > 31) {
+ if (wt.wat_month < 1 || wt.wat_month > 12 ||
+ wt.wat_day < 1 || wt.wat_day > 31) {
printf("WARNING: preposterous clock chip time.\n");
year_secs = 0;
- } else {
- days = dayyr[claddr->mon - 1] + claddr->day - 1;
- year_secs = days * DAYSEC + claddr->hr * HRSEC +
- claddr->min * MINSEC + claddr->sec;
- }
- claddr->yr = 70; /* any non-leap year */
-#ifndef lint
- { volatile int t = claddr->csr2; } /* ??? */
-#endif
+ } else
+ wat_to_gmt (&wt, &year_secs);
+
claddr->csr0 = KA630CLK_RATE;
claddr->csr1 = KA630CLK_ENABLE;
return (year_secs);
}
+
printf("WARNING: TOY clock invalid.\n");
return (0);
}
@@ -212,44 +237,35 @@ ka630_clkread(stopped_flag)
/* Set the time of day clock, called via. stime system call.. */
void
ka630_clkwrite(year_secs)
- u_long year_secs;
+ time_t year_secs;
{
register struct ka630clock *claddr = ka630clk_ptr;
- register int t, t2;
+ struct watclk wt;
int s;
+ gmt_to_wat (&year_secs, &wt);
+
s = splhigh();
+
claddr->csr1 = KA630CLK_SET;
while ((claddr->csr0 & KA630CLK_UIP) != 0)
;
- claddr->yr = 70; /* any non-leap year is ok */
-
- /* t = month + day; separate */
- t = year_secs % YEARSEC;
- for (t2 = 1; t2 < 12; t2++)
- if (t < dayyr[t2])
- break;
-
- /* t2 is month */
- claddr->mon = t2;
- claddr->day = t - dayyr[t2 - 1] + 1;
-
- /* the rest is easy */
- t = year_secs % DAYSEC;
- claddr->hr = t / HRSEC;
- t %= HRSEC;
- claddr->min = t / MINSEC;
- claddr->sec = t % MINSEC;
-#ifndef lint
- { volatile int t = claddr->csr2; } /* ??? */
- { volatile int t = claddr->csr3; } /* ??? */
-#endif
+
+ claddr->sec = wt.wat_sec;
+ claddr->min = wt.wat_min;
+ claddr->hr = wt.wat_hour;
+ claddr->day = wt.wat_day;
+ claddr->mon = wt.wat_month;
+ claddr->yr = wt.wat_year;
+
claddr->csr0 = KA630CLK_RATE;
claddr->csr1 = KA630CLK_ENABLE;
+
splx(s);
}
#endif
+void
uvaxII_steal_pages()
{
extern vm_offset_t avail_start, virtual_avail, avail_end;
@@ -277,7 +293,7 @@ uvaxII_steal_pages()
/*
* Clear restart and boot in progress flags
* in the CPMBX.
- /
+ */
ka630clk_ptr->cpmbx = (ka630clk_ptr->cpmbx & KA630CLK_LANG);
/*
@@ -293,3 +309,122 @@ uvaxII_steal_pages()
cpu_type = (((*UVAXIISID) >> 24) & 0xff) |
(cpu_type & 0xff000000);
}
+
+#if VAX630
+/*
+ * Generic routines to convert to or from a POSIX date
+ * (seconds since 1/1/1970) and yr/mo/day/hr/min/sec
+ * (These are derived from the sun3 clock chip code.)
+ */
+
+/*
+ * Machine dependent base year:
+ * Note: must be < 1970
+ */
+#define CLOCK_BASE_YEAR 1900
+
+/* Traditional UNIX base year */
+#define POSIX_BASE_YEAR 1970
+#define FEBRUARY 2
+
+#define SECDAY 86400L
+#define SECYR (SECDAY * 365)
+
+#define leapyear(year) ((year) % 4 == 0)
+#define days_in_year(a) (leapyear(a) ? 366 : 365)
+#define days_in_month(a) (month_days[(a) - 1])
+
+static int month_days[12] = {
+ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+};
+
+void
+gmt_to_wat(tp, wt)
+ time_t *tp;
+ struct watclk *wt;
+{
+ register int i;
+ register long days, secs;
+
+ days = *tp / SECDAY;
+ secs = *tp % SECDAY;
+
+ /* Hours, minutes, seconds are easy */
+ wt->wat_hour = secs / 3600;
+ secs = secs % 3600;
+ wt->wat_min = secs / 60;
+ secs = secs % 60;
+ wt->wat_sec = secs;
+
+ /* Day of week (Note: 1/1/1970 was a Thursday) */
+ wt->wat_dow = (days + 4) % 7;
+
+ /* Number of years in days */
+ i = POSIX_BASE_YEAR;
+ while (days >= days_in_year(i)) {
+ days -= days_in_year(i);
+ i++;
+ }
+ wt->wat_year = i - CLOCK_BASE_YEAR;
+
+ /* Number of months in days left */
+ if (leapyear(i))
+ days_in_month(FEBRUARY) = 29;
+ for (i = 1; days >= days_in_month(i); i++)
+ days -= days_in_month(i);
+ days_in_month(FEBRUARY) = 28;
+ wt->wat_month = i;
+
+ /* Days are what is left over (+1) from all that. */
+ wt->wat_day = days + 1;
+}
+
+void
+wat_to_gmt(wt, tp)
+ time_t *tp;
+ struct watclk *wt;
+{
+ register int i;
+ register long tmp;
+ int year;
+
+ /*
+ * Hours are different for some reason. Makes no sense really.
+ */
+
+ tmp = 0;
+
+ if (wt->wat_hour >= 24) goto out;
+ if (wt->wat_day > 31) goto out;
+ if (wt->wat_month > 12) goto out;
+
+ year = wt->wat_year + CLOCK_BASE_YEAR;
+
+ /*
+ * Compute days since start of time
+ * First from years, then from months.
+ */
+ for (i = POSIX_BASE_YEAR; i < year; i++)
+ tmp += days_in_year(i);
+ if (leapyear(year) && wt->wat_month > FEBRUARY)
+ tmp++;
+
+ /* Months */
+ for (i = 1; i < wt->wat_month; i++)
+ tmp += days_in_month(i);
+ tmp += (wt->wat_day - 1);
+
+ /* Now do hours */
+ tmp = tmp * 24 + wt->wat_hour;
+
+ /* Now do minutes */
+ tmp = tmp * 60 + wt->wat_min;
+
+ /* Now do seconds */
+ tmp = tmp * 60 + wt->wat_sec;
+
+ out:
+ *tp = tmp;
+}
+#endif /* VAX630 */
+
diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c
index 8a39aab0def..426252e664b 100644
--- a/sys/arch/vax/vax/vm_machdep.c
+++ b/sys/arch/vax/vax/vm_machdep.c
@@ -1,6 +1,5 @@
-/* $NetBSD: vm_machdep.c,v 1.19 1996/01/28 12:22:49 ragge Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.24 1996/04/08 18:33:01 ragge Exp $ */
-#undef SWDEBUG
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -33,25 +32,30 @@
/* All bugs are subject to removal without further notice */
-#include "sys/types.h"
-#include "sys/param.h"
-#include "sys/proc.h"
-#include "sys/user.h"
-#include "sys/exec.h"
-#include "sys/vnode.h"
-#include "sys/core.h"
-#include "sys/mount.h"
-#include "vm/vm.h"
-#include "vm/vm_kern.h"
-#include "vm/vm_page.h"
-#include "machine/vmparam.h"
-#include "machine/mtpr.h"
-#include "machine/pmap.h"
-#include "machine/pte.h"
-#include "machine/macros.h"
-#include "machine/trap.h"
-#include "machine/pcb.h"
-#include "machine/frame.h"
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/exec.h>
+#include <sys/vnode.h>
+#include <sys/core.h>
+#include <sys/mount.h>
+#include <sys/cpu.h>
+
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+
+#include <machine/vmparam.h>
+#include <machine/mtpr.h>
+#include <machine/pmap.h>
+#include <machine/pte.h>
+#include <machine/macros.h>
+#include <machine/trap.h>
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#include <machine/cpu.h>
#include <sys/syscallargs.h>
@@ -64,7 +68,7 @@ volatile int whichqs;
void
pagemove(from, to, size)
caddr_t from, to;
- int size;
+ size_t size;
{
pt_entry_t *fpte, *tpte;
int stor;
@@ -79,8 +83,8 @@ pagemove(from, to, size)
}
#define VIRT2PHYS(x) \
- (((*(int *)((((((int)x)&0x7fffffff)>>9)*4)+ \
- (unsigned int)Sysmap))&0x1fffff)<<9)
+ (((*(int *)((((((int)x) & 0x7fffffff) >> 9) * 4) + \
+ (unsigned int)Sysmap)) & 0x1fffff) << 9)
/*
* cpu_fork() copies parent process trapframe directly into child PCB
@@ -91,15 +95,13 @@ pagemove(from, to, size)
* No need for either double-map kernel stack or relocate it when
* forking.
*/
-int
+void
cpu_fork(p1, p2)
struct proc *p1, *p2;
{
struct pcb *nyproc;
struct trapframe *tf;
struct pmap *pmap, *opmap;
- u_int *p2pte;
- extern vm_map_t pte_map;
nyproc = &p2->p_addr->u_pcb;
tf = p1->p_addr->u_pcb.framep;
@@ -122,7 +124,7 @@ cpu_fork(p1, p2)
nyproc->P0LR = opmap->pm_pcb->P0LR;
nyproc->P1LR = opmap->pm_pcb->P1LR;
#else
- nyproc->P0BR = (void *)0;
+ nyproc->P0BR = (void *)0x80000000;
nyproc->P1BR = (void *)0x80000000;
nyproc->P0LR = AST_PCB;
nyproc->P1LR = 0x200000;
@@ -141,7 +143,7 @@ cpu_fork(p1, p2)
nyproc->R[0] = p1->p_pid; /* parent pid. (shouldn't be needed) */
nyproc->R[1] = 1;
- return 0; /* Child is ready. Parent, return! */
+ return; /* Child is ready. Parent, return! */
}
@@ -154,8 +156,8 @@ cpu_fork(p1, p2)
*/
void
cpu_set_kpc(p, pc)
- struct proc *p;
- u_int pc;
+ struct proc *p;
+ void (*pc) __P((struct proc *));
{
struct pcb *nyproc;
struct {
@@ -178,77 +180,105 @@ cpu_set_kpc(p, pc)
nyproc->framep = (void *)&kc->tf;
nyproc->AP = (unsigned)&kc->cf.ca_argno;
nyproc->FP = nyproc->KSP = (unsigned)kc;
- nyproc->PC = pc + 2;
+ nyproc->PC = (unsigned)pc + 2;
}
+/*
+ * Put in a process on the correct run queue based on it's priority
+ * and set the bit corresponding to the run queue.
+ */
void
setrunqueue(p)
struct proc *p;
{
- struct prochd *q;
- int knummer;
+ struct prochd *q;
+ int knummer;
- if(p->p_back)
- panic("sket sig i setrunqueue\n");
- knummer=(p->p_priority>>2);
- bitset(knummer,whichqs);
- q=&qs[knummer];
+ if (p->p_back)
+ panic("sket sig i setrunqueue");
- _insque(p,q);
+ knummer = (p->p_priority >> 2);
+ bitset(knummer, whichqs);
+ q = &qs[knummer];
+
+ _insque(p, q);
return;
}
+/*
+ * Remove a process from the run queue. If this is the last process
+ * on that queue, clear the queue bit in whichqs.
+ */
void
remrq(p)
struct proc *p;
{
- struct proc *qp;
- int bitnr;
+ struct proc *qp;
+ int bitnr;
- bitnr=(p->p_priority>>2);
- if(bitisclear(bitnr,whichqs))
- panic("remrq: Process not in queue\n");
+ bitnr = (p->p_priority >> 2);
+ if (bitisclear(bitnr, whichqs))
+ panic("remrq: Process not in queue");
_remque(p);
- qp=(struct proc *)&qs[bitnr];
- if(qp->p_forw==qp)
- bitclear(bitnr,whichqs);
+ qp = (struct proc *)&qs[bitnr];
+ if (qp->p_forw == qp)
+ bitclear(bitnr, whichqs);
}
-volatile caddr_t curpcb,nypcb;
+volatile caddr_t curpcb, nypcb;
-cpu_switch(){
- int i,j,s;
- struct proc *p;
- volatile struct proc *q;
- extern unsigned int want_resched,scratch;
+/*
+ * Machine dependent part of switch function. Find the next process
+ * with the highest priority to run. If the process queues are empty,
+ * sleep waiting for something to happen. The idle loop resides here.
+ */
+void
+cpu_switch(pp)
+ struct proc *pp;
+{
+ int i,s;
+ struct proc *p, *q;
+ extern unsigned int scratch;
-hej:
- /* F|rst: Hitta en k|. */
- s=splhigh();
- if((i=ffs(whichqs)-1)<0) goto idle;
+again:
+ /* First: Search for a queue. */
+ s = splhigh();
+ if ((i = ffs(whichqs) -1 ) < 0)
+ goto idle;
-found:
+ /*
+ * A queue with runnable processes found.
+ * Get first process from queue.
+ */
asm(".data;savpsl: .long 0;.text;movpsl savpsl");
- q=(struct proc *)&qs[i];
- if(q->p_forw==q)
+ q = (struct proc *)&qs[i];
+ if (q->p_forw == q)
panic("swtch: no process queued");
- bitclear(i,whichqs);
- p=q->p_forw;
+ /* Remove process from queue */
+ bitclear(i, whichqs);
+ p = q->p_forw;
_remque(p);
- if(q->p_forw!=q) bitset(i,whichqs);
- if(curproc) (u_int)curpcb=VIRT2PHYS(&curproc->p_addr->u_pcb);
- else (u_int)curpcb=scratch;
- (u_int)nypcb=VIRT2PHYS(&p->p_addr->u_pcb);
+ if (q->p_forw != q)
+ bitset(i, whichqs);
+ if (curproc)
+ (u_int)curpcb = VIRT2PHYS(&curproc->p_addr->u_pcb);
+ else
+ (u_int)curpcb = scratch & 0x7fffffff;
+ (u_int)nypcb = VIRT2PHYS(&p->p_addr->u_pcb);
- if(!p) panic("switch: null proc pointer\n");
- want_resched=0;
- curproc=p;
- if(curpcb==nypcb) return;
+ if (p == 0)
+ panic("switch: null proc pointer");
+ want_resched = 0;
+ curproc = p;
+
+ /* Don't change process if it's the same that we'r already running */
+ if (curpcb == nypcb)
+ return;
asm("pushl savpsl");
asm("jsb _loswtch");
@@ -257,14 +287,16 @@ found:
idle:
spl0();
- while(!whichqs);
- goto hej;
+ while (whichqs == 0)
+ ;
+ goto again;
}
/* Should check that values is in bounds XXX */
+int
copyinstr(from, to, maxlen, lencopied)
-void *from, *to;
-u_int *lencopied,maxlen;
+ void *from, *to;
+ u_int *lencopied,maxlen;
{
u_int i;
void *addr=&curproc->p_addr->u_pcb.iftrap;
@@ -285,9 +317,10 @@ ok:
asm("Lstr: ret");
/* Should check that values is in bounds XXX */
+int
copyoutstr(from, to, maxlen, lencopied)
-void *from, *to;
-u_int *lencopied,maxlen;
+ void *from, *to;
+ u_int *lencopied,maxlen;
{
u_int i;
char *gfrom=from, *gto=to;
@@ -305,15 +338,19 @@ ok:
return 0;
}
+int reno_zmagic __P((struct proc *, struct exec_package *));
+
+
+int
cpu_exec_aout_makecmds(p, epp)
struct proc *p;
struct exec_package *epp;
{
int error;
struct exec *ep;
-/*
- * Compatibility with reno programs.
- */
+ /*
+ * Compatibility with reno programs.
+ */
ep=epp->ep_hdr;
switch (ep->a_midmag) {
case 0x10b: /* ZMAGIC in 4.3BSD Reno programs */
@@ -400,23 +437,26 @@ reno_zmagic(p, epp)
void
cpu_exit(p)
- struct proc *p;
+ struct proc *p;
{
- extern unsigned int scratch;
+ extern unsigned int scratch;
- if(!p) panic("cpu_exit from null process");
+ if (p == 0)
+ panic("cpu_exit from null process");
vmspace_free(p->p_vmspace);
(void) splimp();
- mtpr(scratch+NBPG,PR_KSP);/* Must change kernel stack before freeing */
+ /* Must change kernel stack before freeing */
+ mtpr(scratch + NBPG, PR_KSP);
kmem_free(kernel_map, (vm_offset_t)p->p_addr, ctob(UPAGES));
- cpu_switch();
+ cpu_switch(0);
/* NOTREACHED */
}
-suword(ptr,val)
+int
+suword(ptr, val)
void *ptr;
- int val;
+ long val;
{
void *addr=&curproc->p_addr->u_pcb.iftrap;
@@ -470,18 +510,25 @@ cpu_coredump(p, vp, cred, chdr)
return error;
}
+int locopyout __P((void *, void *, size_t, void *));
+int locopyin __P((void *, void *, size_t, void *));
+
+int
copyout(from, to, len)
void *from, *to;
+ size_t len;
{
void *addr=&curproc->p_addr->u_pcb.iftrap;
return locopyout(from, to, len, addr);
}
+int
copyin(from, to, len)
void *from, *to;
+ size_t len;
{
- void *addr=&curproc->p_addr->u_pcb.iftrap;
+ void *addr = &curproc->p_addr->u_pcb.iftrap;
return locopyin(from, to, len, addr);
}