vax 8200 support from torek: generalize cpu support, ops, clock ops
authorMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 8 May 1988 05:20:19 +0000 (21:20 -0800)
committerMike Karels <karels@ucbvax.Berkeley.EDU>
Sun, 8 May 1988 05:20:19 +0000 (21:20 -0800)
SCCS-vsn: sys/vax/vax/Locore.c 7.3
SCCS-vsn: sys/vax/vax/autoconf.c 7.14
SCCS-vsn: sys/vax/vax/clock.c 7.2
SCCS-vsn: sys/vax/include/clock.h 7.2
SCCS-vsn: sys/vax/vax/cons.c 7.5
SCCS-vsn: sys/vax/include/cpu.h 7.4
SCCS-vsn: sys/vax/vax/cpudata.c 7.3
SCCS-vsn: sys/vax/vax/ka630.c 7.4
SCCS-vsn: sys/vax/vax/ka630.h 7.2
SCCS-vsn: sys/vax/vax/locore.s 7.10
SCCS-vsn: sys/vax/vax/machdep.c 7.12
SCCS-vsn: sys/vax/vax/mem.h 7.2
SCCS-vsn: sys/vax/vax/mscp.c 1.2
SCCS-vsn: sys/vax/include/mtpr.h 7.3
SCCS-vsn: sys/vax/vax/scb.h 7.2
SCCS-vsn: sys/vax/vax/scb.s 7.3
SCCS-vsn: sys/vax/vax/swapgeneric.c 7.4

17 files changed:
usr/src/sys/vax/include/clock.h
usr/src/sys/vax/include/cpu.h
usr/src/sys/vax/include/mtpr.h
usr/src/sys/vax/vax/Locore.c
usr/src/sys/vax/vax/autoconf.c
usr/src/sys/vax/vax/clock.c
usr/src/sys/vax/vax/cons.c
usr/src/sys/vax/vax/cpudata.c
usr/src/sys/vax/vax/ka630.c
usr/src/sys/vax/vax/ka630.h
usr/src/sys/vax/vax/locore.s
usr/src/sys/vax/vax/machdep.c
usr/src/sys/vax/vax/mem.h
usr/src/sys/vax/vax/mscp.c
usr/src/sys/vax/vax/scb.h
usr/src/sys/vax/vax/scb.s
usr/src/sys/vax/vax/swapgeneric.c

index ee4d333..2124355 100644 (file)
  * Software clock is software interrupt level 8,
  * implemented as mtpr(SIRR, 0x8) in asm.sed.
  */
  * Software clock is software interrupt level 8,
  * implemented as mtpr(SIRR, 0x8) in asm.sed.
  */
+
+#ifndef LOCORE
+/*
+ * 8200s and 630s have a clock chip like those found in digital alarm
+ * clocks and watches.  Converting this to and from system times is
+ * painful, so we do it in only one place.  The routine chiptotime()
+ * converts a chiptime to the right value for time.tv_sec, and
+ * timetochip converts time.tv_sec back.
+ */
+struct chiptime {
+       int     sec;
+       int     min;
+       int     hour;
+       int     day;
+       int     mon;
+       int     year;
+};
+
+/*
+ * Clock read routine return values.
+ */
+#define        CLKREAD_OK      0       /* success, time.tv_sec set */
+#define        CLKREAD_WARN    1       /* clock appears wrong but time set anyway */
+#define        CLKREAD_BAD     2       /* clock is bad, no time available */
+#endif
index 7e65f1b..0659b08 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)cpu.h       7.3 (Berkeley) %G%
+ *     @(#)cpu.h       7.4 (Berkeley) %G%
  */
 
 #ifndef LOCORE
  */
 
 #ifndef LOCORE
@@ -22,10 +22,19 @@ union cpusid {
                        cp_eco:8,               /* eco level */
                        cp_type:8;              /* VAX_8600 */
        } cpu8600;
                        cp_eco:8,               /* eco level */
                        cp_type:8;              /* VAX_8600 */
        } cpu8600;
+       struct cpu8200 {
+               u_int   cp_urev:8,              /* ucode rev */
+                       cp_secp:1,              /* secondary patch? */
+                       cp_patch:10,            /* patch number */
+                       cp_hrev:4,              /* hardware rev */
+                       cp_5:1,                 /* true iff KA825 */
+                       cp_type:8;              /* VAX_8200 */
+       } cpu8200;
        struct cpu780 {
                u_int   cp_sno:12,              /* serial number */
                        cp_plant:3,             /* plant number */
        struct cpu780 {
                u_int   cp_sno:12,              /* serial number */
                        cp_plant:3,             /* plant number */
-                       cp_eco:9,               /* eco level */
+                       cp_eco:8,               /* eco level */
+                       cp_5:1,                 /* true iff 785 */
                        cp_type:8;              /* VAX_780 */
        } cpu780;
        struct cpu750 {
                        cp_type:8;              /* VAX_780 */
        } cpu780;
        struct cpu750 {
@@ -53,8 +62,12 @@ union cpusid {
 #define        VAX_780         1
 #define        VAX_750         2
 #define        VAX_730         3
 #define        VAX_780         1
 #define        VAX_750         2
 #define        VAX_730         3
-#define VAX_8600       4
-#define        VAX_630         8
+#define        VAX_8600        4
+#define        VAX_8200        5
+#define        VAX_8800        6       /* not positive */
+#define        VAX_8500        6       /* same as 8800, 8700 */
+#define        VAX_610         7       /* uVAX I */
+#define        VAX_630         8       /* uVAX II */
 
 #define        VAX_MAX         8
 
 
 #define        VAX_MAX         8
 
@@ -67,8 +80,30 @@ union cpusid {
 #define        IO_XXX730       3
 #define IO_ABUS                4
 #define IO_QBUS                5
 #define        IO_XXX730       3
 #define IO_ABUS                4
 #define IO_QBUS                5
+#define        IO_BI           6
 
 #ifndef LOCORE
 
 #ifndef LOCORE
+/*
+ * CPU-dependent operations.
+ */
+struct clockops {
+       int     (*clkstartrt)();        /* start real time clock */
+       int     (*clkread)();           /* set system time from clock */
+       int     (*clkwrite)();          /* reset clock from system time */
+};
+
+struct cpuops {
+       struct  clockops *cpu_clock;    /* clock operations */
+       int     (*cpu_memenable)();     /* memory error (CRD intr) enable */
+       int     (*cpu_memerr)();        /* memory error handler */
+       int     (*cpu_mchk)();          /* machine check handler */
+       int     (*cpu_init)();          /* special initialisation, if any */
+};
+
+/* return values from cpu_mchk */
+#define        MCHK_PANIC      -1
+#define        MCHK_RECOVERED  0
+
 /*
  * Per-cpu information for system.
  */
 /*
  * Per-cpu information for system.
  */
@@ -77,6 +112,7 @@ struct       percpu {
        short   pc_cpuspeed;            /* relative speed of cpu */
        short   pc_nioa;                /* number of IO adaptors/nexus blocks */
        struct  iobus *pc_io;           /* descriptions of IO adaptors */
        short   pc_cpuspeed;            /* relative speed of cpu */
        short   pc_nioa;                /* number of IO adaptors/nexus blocks */
        struct  iobus *pc_io;           /* descriptions of IO adaptors */
+       struct  cpuops *pc_ops;         /* per-cpu operations */
 };
 
 /*
 };
 
 /*
@@ -101,13 +137,21 @@ struct nexusconnect {
        struct  nexus *psb_nexbase;     /* base of nexus space */
        short   psb_ubatype;            /* type of "unibus adaptor" */
        short   psb_nubabdp;            /* number of bdp's per uba */
        struct  nexus *psb_nexbase;     /* base of nexus space */
        short   psb_ubatype;            /* type of "unibus adaptor" */
        short   psb_nubabdp;            /* number of bdp's per uba */
-       caddr_t *psb_umaddr;            /* "unibus" memory addresses */
+       caddr_t *psb_umaddr;            /* unibus memory addresses */
 /* the 750 has some slots which don't promise to tell you their types */
 /* if this pointer is non-zero, then you get the type from this array */
 /* rather than from the (much more sensible) low byte of the config register */
        short   *psb_nextype;           /* botch */
 };
 
 /* the 750 has some slots which don't promise to tell you their types */
 /* if this pointer is non-zero, then you get the type from this array */
 /* rather than from the (much more sensible) low byte of the config register */
        short   *psb_nextype;           /* botch */
 };
 
+/*
+ * Description of a BI bus configuration.
+ */
+struct bibus {
+       struct  bi_node *pbi_base;      /* base of node space */
+       /* that cannot possibly be all! */
+};
+
 /*
  * Description of a Q-bus configuration.
  */
 /*
  * Description of a Q-bus configuration.
  */
@@ -121,11 +165,15 @@ struct qbus {
 
 #ifdef KERNEL
 int    cpu;
 
 #ifdef KERNEL
 int    cpu;
+#if VAX8800 || VAX8200
+int    mastercpu;              /* if multiple cpus, this identifies master */
+#endif
 struct percpu percpu[];
 struct percpu percpu[];
+struct cpuops *cpuops;
 #endif
 
 /*
  * Enable realtime clock (always enabled).
  */
 #define        enablertclock()
 #endif
 
 /*
  * Enable realtime clock (always enabled).
  */
 #define        enablertclock()
-#endif
+#endif /* LOCORE */
index 43d47d0..8644490 100644 (file)
@@ -1,9 +1,9 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
+ * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)mtpr.h      7.2 (Berkeley) %G%
+ *     @(#)mtpr.h      7.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #define        ASTLVL  0x13            /* async. system trap level */
 #define        SIRR    0x14            /* software interrupt request */
 #define        SISR    0x15            /* software interrupt summary */
 #define        ASTLVL  0x13            /* async. system trap level */
 #define        SIRR    0x14            /* software interrupt request */
 #define        SISR    0x15            /* software interrupt summary */
+#if VAX8200
+#define        IPIR    0x16            /* interprocessor interrupt register */
+#endif
+#if VAX750 || VAX730
+#define        MCSR    0x17            /* machine check status register */
+#endif
 #define        ICCS    0x18            /* interval clock control */
 #define        NICR    0x19            /* next interval count */
 #define        ICR     0x1a            /* interval count */
 #define        ICCS    0x18            /* interval clock control */
 #define        NICR    0x19            /* next interval count */
 #define        ICR     0x1a            /* interval count */
+#if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX730
 #define        TODR    0x1b            /* time of year (day) */
 #define        TODR    0x1b            /* time of year (day) */
+#endif
+#if VAX750 || VAX730
+#define        CSRS    0x1c            /* console storage receive status register */
+#define        CSRD    0x1d            /* console storage receive data register */
+#define        CSTS    0x1e            /* console storage transmit status register */
+#define        CSTD    0x1f            /* console storage transmit data register */
+#endif
 #define        RXCS    0x20            /* console receiver control and status */
 #define        RXDB    0x21            /* console receiver data buffer */
 #define        TXCS    0x22            /* console transmitter control and status */
 #define        TXDB    0x23            /* console transmitter data buffer */
 #define        RXCS    0x20            /* console receiver control and status */
 #define        RXDB    0x21            /* console receiver data buffer */
 #define        TXCS    0x22            /* console transmitter control and status */
 #define        TXDB    0x23            /* console transmitter data buffer */
+#if VAX8200 || VAX750 || VAX730
+#define        TBDR    0x24            /* translation buffer disable register */
+#define        CADR    0x25            /* cache disable register */
+#define        MCESR   0x26            /* machine check error summary register */
+#endif
+#if VAX750 || VAX730
+#define        CAER    0x27            /* cache error */
+#endif
+#define        ACCS    0x28            /* accelerator control and status */
+#if VAX780
+#define        ACCR    0x29            /* accelerator maintenance */
+#endif
+#if VAX8200 || VAX780
+#define        WCSA    0x2c            /* WCS address */
+#define        WCSD    0x2d            /* WCS data */
+#endif
+#if VAX8200
+#define        WCSL    0x2e            /* WCS load */
+#endif
+#if VAX8600 || VAX780
+#define        SBIFS   0x30            /* SBI fault and status */
+#define        SBIS    0x31            /* SBI silo */
+#define        SBISC   0x32            /* SBI silo comparator */
+#define        SBIMT   0x33            /* SBI maintenance */
+#define        SBIER   0x34            /* SBI error register */
+#define        SBITA   0x35            /* SBI timeout address */
+#define        SBIQC   0x36            /* SBI quadword clear */
+#endif
+#if VAX750 || VAX730 || VAX630
+#define        IUR     0x37            /* init unibus (Qbus on 630) register */
+#endif
 #define        MAPEN   0x38            /* memory management enable */
 #define        TBIA    0x39            /* translation buffer invalidate all */
 #define        TBIS    0x3a            /* translation buffer invalidate single */
 #define        MAPEN   0x38            /* memory management enable */
 #define        TBIA    0x39            /* translation buffer invalidate all */
 #define        TBIS    0x3a            /* translation buffer invalidate single */
+#if VAX750 || VAX730
+#define        TB      0x3b            /* translation buffer */
+#endif
+#if VAX780
+#define        MBRK    0x3c            /* micro-program breakpoint */
+#endif
 #define        PMR     0x3d            /* performance monitor enable */
 #define        SID     0x3e            /* system identification */
 #define        PMR     0x3d            /* performance monitor enable */
 #define        SID     0x3e            /* system identification */
-
-#if defined(VAX780) || defined(VAX8600)
-#define        ACCS    0x28            /* accelerator control and status */
-#endif
-
-#if defined(VAX8600)
+#if VAX8600 || VAX8200
 #define TBCHK  0x3f            /* Translation Buffer Check */
 #define TBCHK  0x3f            /* Translation Buffer Check */
+#endif
+#if VAX8600
 #define PAMACC 0x40            /* PAMM access */
 #define PAMLOC 0x41            /* PAMM location */
 #define CSWP   0x42            /* Cache sweep */
 #define PAMACC 0x40            /* PAMM access */
 #define PAMLOC 0x41            /* PAMM location */
 #define CSWP   0x42            /* Cache sweep */
 #define ESPA   0x4e            /* EBOX scratchpad address */
 #define ESPD   0x4f            /* EBOX sratchpad data */
 #endif
 #define ESPA   0x4e            /* EBOX scratchpad address */
 #define ESPD   0x4f            /* EBOX sratchpad data */
 #endif
-
-#if defined(VAX780)
-#define        ACCR    0x29            /* accelerator maintenance */
-#define        WCSA    0x2c            /* WCS address */
-#define        WCSD    0x2d            /* WCS data */
-#define        SBIFS   0x30            /* SBI fault and status */
-#define        SBIS    0x31            /* SBI silo */
-#define        SBISC   0x32            /* SBI silo comparator */
-#define        SBIMT   0x33            /* SBI maintenance */
-#define        SBIER   0x34            /* SBI error register */
-#define        SBITA   0x35            /* SBI timeout address */
-#define        SBIQC   0x36            /* SBI quadword clear */
-#define        MBRK    0x3c            /* micro-program breakpoint */
-#endif
-
-#if defined(VAX750) || defined(VAX730)
-#define        MCSR    0x17            /* machine check status register */
-#define        CSRS    0x1c            /* console storage receive status register */
-#define        CSRD    0x1d            /* console storage receive data register */
-#define        CSTS    0x1e            /* console storage transmit status register */
-#define        CSTD    0x1f            /* console storage transmit data register */
-#define        TBDR    0x24            /* translation buffer disable register */
-#define        CADR    0x25            /* cache disable register */
-#define        MCESR   0x26            /* machine check error summary register */
-#define        CAER    0x27            /* cache error */
-#define        TB      0x3b            /* translation buffer */
-#endif
-
-#if defined(VAX750) || defined(VAX730) || defined(VAX630)
-#define        IUR     0x37            /* init unibus register */
+#if VAX8200
+#define        RXCS1   0x50            /* receive csr, console line 1 */
+#define        RXDB1   0x51            /* receive data buffer, console line 1 */
+#define        TXCS1   0x52            /* transmit csr, console line 1 */
+#define        TXDB1   0x53            /* transmit data buffer, console line 1 */
+#define        RXCS2   0x54            /* etc */
+#define        RXDB2   0x55
+#define        TXCS2   0x56
+#define        TXDB2   0x57
+#define        RXCS3   0x58
+#define        RXDB3   0x59
+#define        TXCS3   0x5a
+#define        TXDB3   0x5b
+#define        RXCD    0x5c            /* receive console data register */
+#define        CACHEX  0x5d            /* cache invalidate register */
+#define        BINID   0x5e            /* VAXBI node ID register */
+#define        BISTOP  0x5f            /* VAXBI stop register */
 #endif
 #endif
index 5d62827..372fbe3 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)Locore.c    7.2 (Berkeley) %G%
+ *     @(#)Locore.c    7.3 (Berkeley) %G%
  */
 
 #include "dz.h"
  */
 
 #include "dz.h"
 #include "protosw.h"
 #include "domain.h"
 #include "map.h"
 #include "protosw.h"
 #include "domain.h"
 #include "map.h"
+#include "dkbad.h"
 
 
+#include "scb.h"
 #include "nexus.h"
 #include "ioa.h"
 #include "nexus.h"
 #include "ioa.h"
-#include "ka630.h"
 #include "../vaxuba/ubavar.h"
 #include "../vaxuba/ubareg.h"
 
 #include "../vaxuba/ubavar.h"
 #include "../vaxuba/ubareg.h"
 
@@ -37,7 +38,7 @@
  * Pseudo file for lint to show what is used/defined in locore.s.
  */
 
  * Pseudo file for lint to show what is used/defined in locore.s.
  */
 
-struct scb scb;
+struct scb scb[1];
 int    (*UNIvec[128])();
 #if NUBA > 1
 int    (*UNI1vec[128])();
 int    (*UNIvec[128])();
 #if NUBA > 1
 int    (*UNI1vec[128])();
@@ -53,15 +54,17 @@ int szicode = sizeof (icode);
  * Variables declared for savecore, or
  * implicitly, such as by config or the loader.
  */
  * Variables declared for savecore, or
  * implicitly, such as by config or the loader.
  */
-char   version[] = "4.2 BSD UNIX ....";
+char   version[] = "4.3 BSD UNIX ....";
 int    etext;
 
 doadump() { dumpsys(); }
 
 int    etext;
 
 doadump() { dumpsys(); }
 
+#if NMBA > 0
 Xmba3int() { }
 Xmba2int() { }
 Xmba1int() { }
 Xmba0int() { }
 Xmba3int() { }
 Xmba2int() { }
 Xmba1int() { }
 Xmba0int() { }
+#endif
 
 lowinit()
 {
 
 lowinit()
 {
@@ -73,9 +76,6 @@ lowinit()
        extern int arptab_size;
        extern int dk_ndrive;
        extern struct domain unixdomain;
        extern int arptab_size;
        extern int dk_ndrive;
        extern struct domain unixdomain;
-#ifdef PUP
-       extern struct domain pupdomain;
-#endif
 #ifdef INET
        extern struct domain inetdomain;
 #endif
 #ifdef INET
        extern struct domain inetdomain;
 #endif
@@ -90,10 +90,6 @@ lowinit()
        /* cpp messes these up for lint so put them here */
        unixdomain.dom_next = domains;
        domains = &unixdomain;
        /* cpp messes these up for lint so put them here */
        unixdomain.dom_next = domains;
        domains = &unixdomain;
-#ifdef PUP
-       pupdomain.dom_next = domains;
-       domains = &pupdomain;
-#endif
 #ifdef INET
        inetdomain.dom_next = domains;
        domains = &inetdomain;
 #ifdef INET
        inetdomain.dom_next = domains;
        domains = &inetdomain;
@@ -117,7 +113,7 @@ lowinit()
        lowinit();
        intstack[0] = intstack[1];
        rpb = rpb;
        lowinit();
        intstack[0] = intstack[1];
        rpb = rpb;
-       scb = scb;
+       scb[0] = scb[0];
        maxmem = physmem = freemem = 0;
        u = u;
        fixctlrmask();
        maxmem = physmem = freemem = 0;
        u = u;
        fixctlrmask();
@@ -143,6 +139,13 @@ lowinit()
 #endif
 #if NMBA > 0
        mbintr(0);
 #endif
 #if NMBA > 0
        mbintr(0);
+#endif
+#if VAX8200                    /* XXX wrong conditional */
+       bi_buserr(0);
+#endif
+#if VAX8200
+       rxcdintr();
+       rx50intr();
 #endif
        hardclock((caddr_t)0, 0);
        softclock((caddr_t)0, 0);
 #endif
        hardclock((caddr_t)0, 0);
        softclock((caddr_t)0, 0);
@@ -155,13 +158,25 @@ lowinit()
 #ifdef NS
        nsintr();
 #endif
 #ifdef NS
        nsintr();
 #endif
+       machinecheck((caddr_t)0);
+       memerr();
 
 
+       /*
+        * Miscellaneous routines called from configurable
+        * drivers.
+        */
+       ubapurge((struct uba_ctlr *)0);
+       ubattydma(0);
+       (void) ubamem(0, 0, 16, 1);
+       (void) isbad((struct dkbad *)0, 0, 0, 0);
+       disksort((struct buf *)0, (struct buf *)0);
+       (void) uwritec((struct uio *)0);
+       (void) todr();
        if (vmemall((struct pte *)0, 0, (struct proc *)0, 0))
                return;         /* use value */
        if (vmemall((struct pte *)0, 0, (struct proc *)0, 0))
                return;         /* use value */
-       machinecheck((caddr_t)0);
-       memerr();
        boothowto = 0;
        dumpflag = 0; dumpflag = dumpflag;
        boothowto = 0;
        dumpflag = 0; dumpflag = dumpflag;
+       bootesym = 0; bootesym = bootesym;
 #if !defined(GPROF)
        cp = (caddr_t)&etext;
        cp = cp;
 #if !defined(GPROF)
        cp = (caddr_t)&etext;
        cp = cp;
@@ -174,7 +189,7 @@ consdout() { }
 dzdma() { dzxint((struct tty *)0); }
 #endif
 
 dzdma() { dzxint((struct tty *)0); }
 #endif
 
-int    catcher[256];
+quad   catcher[128];
 int    cold = 1;
 
 Xustray() { }
 int    cold = 1;
 
 Xustray() { }
@@ -184,7 +199,9 @@ char        Sysbase[6*NPTEPG*NBPG];
 int    umbabeg;
 struct pte Nexmap[16][16];
 struct nexus nexus[MAXNNEXUS];
 int    umbabeg;
 struct pte Nexmap[16][16];
 struct nexus nexus[MAXNNEXUS];
+#if VAX8600
 struct pte Ioamap[MAXNIOA][IOAMAPSIZ/NBPG];
 struct pte Ioamap[MAXNIOA][IOAMAPSIZ/NBPG];
+#endif
 struct pte UMEMmap[NUBA][512];
 char   umem[NUBA][512*NBPG];
 int    umbaend;
 struct pte UMEMmap[NUBA][512];
 char   umem[NUBA][512*NBPG];
 int    umbaend;
@@ -212,16 +229,17 @@ struct    pte Mbmap[NMBCLUSTERS/CLSIZE];
 struct mbuf mbutl[NMBCLUSTERS*CLBYTES/sizeof (struct mbuf)];
 struct pte msgbufmap[CLSIZE];
 struct msgbuf msgbuf;
 struct mbuf mbutl[NMBCLUSTERS*CLBYTES/sizeof (struct mbuf)];
 struct pte msgbufmap[CLSIZE];
 struct msgbuf msgbuf;
-struct pte kmempt[100];
-#ifdef VAX630
-struct pte Clockmap[1];
-struct cldevice cldevice;
+struct pte kmempt[200];
+#if VAX8200
+struct pte RX50map[1];
+struct pte Ka820map[1];
+#endif
+#if VAX630
 struct pte Ka630map[1];
 struct pte Ka630map[1];
-struct ka630cpu ka630cpu;
 #endif
 int    kmembase, kmemlimit;
 #endif
 int    kmembase, kmemlimit;
-#ifdef unneeded
-char   caspace[32*NBPG];
+#if VAX8200 || VAX630
+struct pte Clockmap[1];
 #endif
 
 /*ARGSUSED*/
 #endif
 
 /*ARGSUSED*/
@@ -333,10 +351,12 @@ mfpr(reg) int reg; { return (0); }
 /*ARGSUSED*/
 setjmp(lp) label_t *lp; { return (0); }
 
 /*ARGSUSED*/
 setjmp(lp) label_t *lp; { return (0); }
 
+#ifndef VAX630
 /*ARGSUSED*/
 scanc(size, cp, table, mask)
     unsigned size; char *cp, table[]; int mask;
 { return (0); }
 /*ARGSUSED*/
 scanc(size, cp, table, mask)
     unsigned size; char *cp, table[]; int mask;
 { return (0); }
+#endif
 
 /*ARGSUSED*/
 skpc(mask, size, cp) int mask; int size; char *cp; { return (0); }
 
 /*ARGSUSED*/
 skpc(mask, size, cp) int mask; int size; char *cp; { return (0); }
index 0e0d885..8bfbbe9 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)autoconf.c  7.13 (Berkeley) %G%
+ *     @(#)autoconf.c  7.14 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -17,6 +17,7 @@
 
 #include "mba.h"
 #include "uba.h"
 
 #include "mba.h"
 #include "uba.h"
+#include "kra.h"               /* XXX wrong file */
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
@@ -42,6 +43,7 @@
 #include "nexus.h"
 #include "scb.h"
 #include "ioa.h"
 #include "nexus.h"
 #include "scb.h"
 #include "ioa.h"
+#include "../vaxbi/bireg.h"
 #include "../vaxmba/mbareg.h"
 #include "../vaxmba/mbavar.h"
 #include "../vaxuba/ubareg.h"
 #include "../vaxmba/mbareg.h"
 #include "../vaxmba/mbavar.h"
 #include "../vaxuba/ubareg.h"
@@ -60,6 +62,9 @@ int   cpuspeed = 1;   /* relative cpu speed */
  * Addresses of the (locore) routines which bootstrap us from
  * hardware traps to C code.  Filled into the system control block
  * as necessary.
  * Addresses of the (locore) routines which bootstrap us from
  * hardware traps to C code.  Filled into the system control block
  * as necessary.
+ *
+ * RIDICULOUS!  CONFIG SHOULD GENERATE AN ioconf.h FOR US, with
+ * mba glue also in `glue.s'.  (Unibus adapter glue is special, though.)
  */
 #if NMBA > 0
 int    (*mbaintv[4])() =       { Xmba0int, Xmba1int, Xmba2int, Xmba3int };
  */
 #if NMBA > 0
 int    (*mbaintv[4])() =       { Xmba0int, Xmba1int, Xmba2int, Xmba3int };
@@ -79,6 +84,14 @@ int  (*ubaintv[])() =
 #endif
 };
 #endif
 #endif
 };
 #endif
+#if NKDB > 0
+/* kdb50 driver does not appear in udminit[] (not without csr!) */
+int    Xkdbintr0();            /* generated by autoconf */
+int    (*kdbintv[])() = { Xkdbintr0 };
+#if NKDB > 1
+       Need to expand the table for more than 1 KDB adapter
+#endif
+#endif
 
 /*
  * This allocates the space for the per-uba information,
 
 /*
  * This allocates the space for the per-uba information,
@@ -95,13 +108,60 @@ configure()
 {
        union cpusid cpusid;
        register struct percpu *ocp;
 {
        union cpusid cpusid;
        register struct percpu *ocp;
-       register int *ip;
+       register struct pte *ip;
        extern char Sysbase[];
 
        cpusid.cpusid = mfpr(SID);
        extern char Sysbase[];
 
        cpusid.cpusid = mfpr(SID);
+       switch (cpusid.cpuany.cp_type) {
+#if VAX8600
+       case VAX_8600:
+               printf("VAX 8600, serial# %d(%d), hardware ECO level %d(%d)\n",
+                       cpusid.cpu780.cp_sno, cpusid.cpu780.cp_plant,
+                       cpusid.cpu780.cp_eco >> 4, cpusid.cpu780.cp_eco);
+               break;
+#endif
+#if VAX8200
+       case VAX_8200:
+               printf("\
+VAX 82%c0, hardware rev %d, ucode patch rev %d, sec patch %d, ucode rev %d\n",
+                       cpusid.cpu8200.cp_5 ? '5' : '0',
+                       cpusid.cpu8200.cp_hrev, cpusid.cpu8200.cp_patch,
+                       cpusid.cpu8200.cp_secp, cpusid.cpu8200.cp_urev);
+               mastercpu = mfpr(BINID);
+               break;
+#endif
+#if VAX780
+       case VAX_780:
+               printf("\
+VAX 11/78%c, serial# %d(%d), hardware ECO level %d(%d)\n",
+                       cpusid.cpu780.cp_5 ? '5' : '0',
+                       cpusid.cpu780.cp_sno, cpusid.cpu780.cp_plant,
+                       cpusid.cpu780.cp_eco >> 4, cpusid.cpu780.cp_eco);
+               break;
+#endif
+#if VAX750
+       case VAX_750:
+               printf("VAX 11/750, hardware rev %d, ucode rev %d\n",
+                       cpusid.cpu750.cp_hrev, cpusid.cpu750.cp_urev);
+               break;
+#endif
+#if VAX730
+       case VAX_730:
+               printf("VAX 11/730, ucode rev %d\n", cpusid.cpu730.cp_urev);
+               break;
+#endif
+#if VAX630
+       case VAX_630:
+               printf("MicroVAX-II\n");
+               break;
+#endif
+       }
        for (ocp = percpu; ocp->pc_cputype; ocp++)
                if (ocp->pc_cputype == cpusid.cpuany.cp_type) {
                        cpuspeed = ocp->pc_cpuspeed;
        for (ocp = percpu; ocp->pc_cputype; ocp++)
                if (ocp->pc_cputype == cpusid.cpuany.cp_type) {
                        cpuspeed = ocp->pc_cpuspeed;
+                       cpuops = ocp->pc_ops;
+                       if (cpuops->cpu_init != NULL)
+                               (*cpuops->cpu_init)();
                        probeio(ocp);
                        /*
                         * Write protect the scb and UNIBUS interrupt vectors.
                        probeio(ocp);
                        /*
                         * Write protect the scb and UNIBUS interrupt vectors.
@@ -110,12 +170,11 @@ configure()
                         * write-enable was done in assembly language
                         * to which we will never return.
                         */
                         * write-enable was done in assembly language
                         * to which we will never return.
                         */
-                       ip = (int *)Sysmap + 1; *ip &= ~PG_PROT; *ip |= PG_KR;
-                       ip++; *ip &= ~PG_PROT; *ip |= PG_KR;
-#if NUBA > 1
-                       ip++; *ip &= ~PG_PROT; *ip |= PG_KR;
-#endif
-                       mtpr(TBIS, Sysbase);
+                       for (ip = kvtopte(scb); ip < kvtopte(eUNIvec); ip++) {
+                               *(int *)ip &= ~PG_PROT;
+                               *(int *)ip |= PG_KR;
+                       }
+                       mtpr(TBIA, 0);
 #if GENERIC
                        if ((boothowto & RB_ASKNAME) == 0)
                                setroot();
 #if GENERIC
                        if ((boothowto & RB_ASKNAME) == 0)
                                setroot();
@@ -140,6 +199,10 @@ configure()
 int    nexnum;         /* current nexus number */
 int    nsbi;           /* current sbi number */
 #endif
 int    nexnum;         /* current nexus number */
 int    nsbi;           /* current sbi number */
 #endif
+#if VAX8200
+int    numkdb;         /* current ``kdb'' number */
+int    bi_nodes;       /* XXX remembers found bi nodes */
+#endif
 
 /*
  * Probe the main IO bus(es).
 
 /*
  * Probe the main IO bus(es).
@@ -175,6 +238,13 @@ probeio(pcpu)
                        probe_Abus(ioanum, iob);
                        break;
 #endif
                        probe_Abus(ioanum, iob);
                        break;
 #endif
+
+#if VAX8200
+               case IO_BI:
+                       probe_bi((struct bibus *)iob->io_details);
+                       break;
+#endif
+
                default:
                        if (iob->io_addr) {
                            printf(
                default:
                        if (iob->io_addr) {
                            printf(
@@ -196,6 +266,9 @@ probe_Abus(ioanum, iob)
        union ioacsr ioacsr;
        int type;
        struct sbia_regs *sbiaregs;
        union ioacsr ioacsr;
        int type;
        struct sbia_regs *sbiaregs;
+#ifdef notyet
+       int sbi1fail(), sbi1alert(), sbi1fault(), sbi1err();
+#endif
 
        ioap = &ioa[ioanum];
        ioaccess(iob->io_addr, Ioamap[ioanum], iob->io_size);
 
        ioap = &ioa[ioanum];
        ioaccess(iob->io_addr, Ioamap[ioanum], iob->io_size);
@@ -209,6 +282,17 @@ probe_Abus(ioanum, iob)
        case IOA_SBIA:
                printf("SBIA%d at IO adaptor %d address 0x%x\n",
                    nsbi, ioanum, iob->io_addr);
        case IOA_SBIA:
                printf("SBIA%d at IO adaptor %d address 0x%x\n",
                    nsbi, ioanum, iob->io_addr);
+#ifdef notyet
+               /* I AM NOT SURE THESE ARE IN THE SAME PLACES */
+               if (nscb == 1) {
+                       scb[1].scb_sbifail = scbentry(sbi1fail, SCB_ISTACK);
+                       /* maybe not sbifail, maybe scb1.scb_cmrd */
+                       /* but how can I find out without a broken SBIA1? */
+                       scb[1].scb_sbialert = scbentry(sbi1alert, SCB_ISTACK);
+                       scb[1].scb_sbifault = scbentry(sbi1fault, SCB_ISTACK);
+                       scb[1].scb_sbierr = scbentry(sbi1err, SCB_ISTACK);
+               }
+#endif
                probenexi((struct nexusconnect *)iob->io_details);
                nsbi++;
                sbiaregs = (struct sbia_regs *)ioap;
                probenexi((struct nexusconnect *)iob->io_details);
                nsbi++;
                sbiaregs = (struct sbia_regs *)ioap;
@@ -230,7 +314,6 @@ probe_Abus(ioanum, iob)
  * Probe nexus space, finding the interconnects
  * and setting up and probing mba's and uba's for devices.
  */
  * Probe nexus space, finding the interconnects
  * and setting up and probing mba's and uba's for devices.
  */
-/*ARGSUSED*/
 probenexi(pnc)
        register struct nexusconnect *pnc;
 {
 probenexi(pnc)
        register struct nexusconnect *pnc;
 {
@@ -238,11 +321,11 @@ probenexi(pnc)
        struct nexus *nxp = pnc->psb_nexbase;
        union nexcsr nexcsr;
        int i;
        struct nexus *nxp = pnc->psb_nexbase;
        union nexcsr nexcsr;
        int i;
-       
-       nexnum = 0, nxv = &nexus[nsbi * NNEXSBI];
-       for (; nexnum < pnc->psb_nnexus; nexnum++, nxp++, nxv++) {
-               ioaccess((caddr_t)nxp, Nexmap[nsbi * NNEXSBI + nexnum],
-                    sizeof(struct nexus));
+
+       ioaccess((caddr_t)nxp, Nexmap[nsbi * NNEXSBI],
+           pnc->psb_nnexus * sizeof(struct nexus));
+       nxv = &nexus[nsbi * NNEXSBI];
+       for (nexnum = 0; nexnum < pnc->psb_nnexus; nexnum++, nxp++, nxv++) {
                if (badaddr((caddr_t)nxv, 4))
                        continue;
                if (pnc->psb_nextype && pnc->psb_nextype[nexnum] != NEX_ANY)
                if (badaddr((caddr_t)nxv, 4))
                        continue;
                if (pnc->psb_nextype && pnc->psb_nextype[nexnum] != NEX_ANY)
@@ -256,7 +339,7 @@ probenexi(pnc)
                case NEX_MBA:
                        printf("mba%d at tr%d\n", nummba, nexnum);
                        if (nummba >= NMBA) {
                case NEX_MBA:
                        printf("mba%d at tr%d\n", nummba, nexnum);
                        if (nummba >= NMBA) {
-                               printf("%d mba's", nummba++);
+                               printf("%d mba's", ++nummba);
                                goto unconfig;
                        }
 #if NMBA > 0
                                goto unconfig;
                        }
 #if NMBA > 0
@@ -270,23 +353,25 @@ probenexi(pnc)
                case NEX_UBA2:
                case NEX_UBA3:
                        printf("uba%d at tr%d\n", numuba, nexnum);
                case NEX_UBA2:
                case NEX_UBA3:
                        printf("uba%d at tr%d\n", numuba, nexnum);
+                       if (numuba >= NUBA) {
+                               printf("%d uba's", ++numuba);
+                               goto unconfig;
+                       }
+#if NUBA > 0
 #if VAX750
                        if (numuba >= 2 && cpu == VAX_750) {
                                printf("More than 2 UBA's");
                                goto unsupp;
                        }
 #endif
 #if VAX750
                        if (numuba >= 2 && cpu == VAX_750) {
                                printf("More than 2 UBA's");
                                goto unsupp;
                        }
 #endif
-                       if (numuba >= NUBA) {
-                               printf("%d uba's", ++numuba);
-                               goto unconfig;
-                       }
 #if defined(VAX780) || defined(VAX8600)
 #if defined(VAX780) || defined(VAX8600)
-                       if ((cpu == VAX_780) || (cpu == VAX_8600))
+                       if (cpu == VAX_780 || cpu == VAX_8600)
                                setscbnex(ubaintv[numuba]);
 #endif
                        i = nexcsr.nex_type - NEX_UBA0;
                        probeuba((struct uba_regs *)nxv, (struct uba_regs *)nxp,
                            pnc->psb_umaddr[i]);
                                setscbnex(ubaintv[numuba]);
 #endif
                        i = nexcsr.nex_type - NEX_UBA0;
                        probeuba((struct uba_regs *)nxv, (struct uba_regs *)nxp,
                            pnc->psb_umaddr[i]);
+#endif /* NUBA */
                        break;
 
                case NEX_DR32:
                        break;
 
                case NEX_DR32:
@@ -299,24 +384,24 @@ probenexi(pnc)
                case NEX_MEM16:
                case NEX_MEM16I:
                        printf("mcr%d at tr%d\n", nmcr, nexnum);
                case NEX_MEM16:
                case NEX_MEM16I:
                        printf("mcr%d at tr%d\n", nmcr, nexnum);
-                       if (nmcr >= 4) {
-                               printf("5 mcr's");
-                               goto unsupp;
+                       if (nmcr >= MAXNMCR) {
+                               printf("%d mcr's", ++nmcr);
+                               goto unconfig;
                        }
                        switch (cpu) {
                        }
                        switch (cpu) {
+#if VAX780
                        case VAX_780:
                        case VAX_780:
+                               /* only ka780 code looks at type */
                                mcrtype[nmcr] = M780C;
                                break;
                                mcrtype[nmcr] = M780C;
                                break;
-                       case VAX_750:
-                               mcrtype[nmcr] = M750;
-                               break;
-                       case VAX_730:
-                               mcrtype[nmcr] = M730;
+#endif
+                       default:
                                break;
                        }
                                break;
                        }
-                       mcraddr[nmcr++] = (struct mcr *)nxv;
+                       mcraddr[nmcr++] = (caddr_t)nxv;
                        break;
 
                        break;
 
+#if VAX780
                case NEX_MEM64I:
                case NEX_MEM64L:
                case NEX_MEM64LI:
                case NEX_MEM64I:
                case NEX_MEM64L:
                case NEX_MEM64LI:
@@ -324,15 +409,14 @@ probenexi(pnc)
                case NEX_MEM256L:
                case NEX_MEM256LI:
                        printf("mcr%d (el) at tr%d\n", nmcr, nexnum);
                case NEX_MEM256L:
                case NEX_MEM256LI:
                        printf("mcr%d (el) at tr%d\n", nmcr, nexnum);
-                       if (nmcr >= 4) {
-                               printf("5 mcr's");
-                               goto unsupp;
+                       if (nmcr >= MAXNMCR) {
+                               printf("%d mcr's", ++nmcr);
+                               goto unconfig;
                        }
                        }
-                       if (cpu == VAX_780)
-                               mcrtype[nmcr] = M780EL;
-                       mcraddr[nmcr++] = (struct mcr *)nxv;
+                       mcrtype[nmcr] = M780EL;
+                       mcraddr[nmcr++] = (caddr_t)nxv;
                        if (nexcsr.nex_type != NEX_MEM64I && 
                        if (nexcsr.nex_type != NEX_MEM64I && 
-                         nexcsr.nex_type != NEX_MEM256I)
+                           nexcsr.nex_type != NEX_MEM256I)
                                break;
                        /* fall into ... */
 
                                break;
                        /* fall into ... */
 
@@ -341,14 +425,14 @@ probenexi(pnc)
                case NEX_MEM256U:
                case NEX_MEM256UI:
                        printf("mcr%d (eu) at tr%d\n", nmcr, nexnum);
                case NEX_MEM256U:
                case NEX_MEM256UI:
                        printf("mcr%d (eu) at tr%d\n", nmcr, nexnum);
-                       if (nmcr >= 4) {
-                               printf("5 mcr's");
-                               goto unsupp;
+                       if (nmcr >= MAXNMCR) {
+                               printf("%d mcr's", ++nmcr);
+                               goto unconfig;
                        }
                        }
-                       if (cpu == VAX_780)
-                               mcrtype[nmcr] = M780EU;
-                       mcraddr[nmcr++] = (struct mcr *)nxv;
+                       mcrtype[nmcr] = M780EU;
+                       mcraddr[nmcr++] = (caddr_t)nxv;
                        break;
                        break;
+#endif
 
                case NEX_MPM0:
                case NEX_MPM1:
 
                case NEX_MPM0:
                case NEX_MPM1:
@@ -375,20 +459,194 @@ unconfig:
                nummba = NMBA;
        if (numuba > NUBA)
                numuba = NUBA;
                nummba = NMBA;
        if (numuba > NUBA)
                numuba = NUBA;
+       if (nmcr > MAXNMCR)
+               nmcr = MAXNMCR;
 }
 
 setscbnex(fn)
        int (*fn)();
 {
 }
 
 setscbnex(fn)
        int (*fn)();
 {
-       register struct scb *scbp = &scb;
+       register struct scb *scbp = &scb[nsbi];
 
 
-       scbp = (struct scb *)((caddr_t)scbp + nsbi * 512);
        scbp->scb_ipl14[nexnum] = scbp->scb_ipl15[nexnum] =
            scbp->scb_ipl16[nexnum] = scbp->scb_ipl17[nexnum] =
                scbentry(fn, SCB_ISTACK);
 }
 #endif
 
        scbp->scb_ipl14[nexnum] = scbp->scb_ipl15[nexnum] =
            scbp->scb_ipl16[nexnum] = scbp->scb_ipl17[nexnum] =
                scbentry(fn, SCB_ISTACK);
 }
 #endif
 
+#include "bi.h"
+#if NBI > 0
+/*
+ * Probe BI node space.
+ *
+ * THIS DEPENDS ON BI SPACE == NEXUS SPACE
+ * THIS WILL NOT WORK FOR MULTIPLE BIs
+ */
+probe_bi(p)
+       register struct bibus *p;
+{
+       register struct bi_node *biv, *bip;
+       register int node;
+       short dtype;
+
+       /* must ignore BI errors while configuring */
+       bip = p->pbi_base;
+       ioaccess((caddr_t)bip, Nexmap[0], sizeof(*bip) * NNODEBI);/* XXX */
+       printf("vaxbi0 at address 0x%x\n", bip);
+       biv = (struct bi_node *) &nexus[0];     /* XXX */
+       for (node = 0; node < NNODEBI; node++, bip++, biv++) {
+               if (badaddr((caddr_t)biv, 4))
+                       continue;
+               bi_nodes |= 1 << node;          /* XXX */
+               dtype = biv->biic.bi_dtype;
+               /* clear bus errors */
+               biv->biic.bi_ber = ~(BIBER_MBZ|BIBER_NMR|BIBER_UPEN);
+               switch (dtype) {
+
+               case BIDT_KA820: {
+                       /* is this right?? */
+                       int cp5 = biv->biic.bi_revs & 0x8000 ? '5' : '0';
+
+                       if (node != mastercpu) {
+                               printf("slave ka82%c cpu", cp5);
+                               goto unsupp;
+                       }
+                       printf("ka82%c cpu at node %x\n", cp5, node);
+                       biv->biic.bi_intrdes = 1 << mastercpu;
+                       biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
+                       break;
+               }
+
+               case BIDT_DWBUA:
+                       if (numuba >= NUBA || /*XXX*/numuba > 2) {
+                               printf("%d uba's", ++numuba);
+                               goto unconfig;
+                       }
+#if NUBA > 0
+                       printf("uba%d at node %x\n", numuba, node);
+
+                       /*
+                        * Run a self test reset to drop any `old' errors,
+                        * so that they cannot cause a BI bus error.
+                        */
+                       (void) bi_selftest(&biv->biic);
+
+                       /*
+                        * Enable interrupts.  DWBUAs must have
+                        * high priority.
+                        */
+                       biv->biic.bi_intrdes = 1 << mastercpu;
+                       biv->biic.bi_csr = (biv->biic.bi_csr&~BICSR_ARB_MASK) |
+                               BICSR_ARB_HIGH;
+                       probeuba((struct uba_regs *)biv, (struct uba_regs *)bip,
+                               (caddr_t)UMEM8200(node));
+#endif /* NUBA */
+                       break;
+
+               case BIDT_MS820:
+                       printf("mcr%d at node %x\n", nmcr, node);
+                       if (nmcr >= MAXNMCR) {
+                               printf("%d mcr's", ++nmcr);
+                               goto unconfig;
+                       }
+                       mcraddr[nmcr++] = (caddr_t)biv;
+                       biv->biic.bi_intrdes = 1 << mastercpu;
+                       biv->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
+                       break;
+
+               case BIDT_KDB50:
+                       if (numkdb >= NKDB) {
+                               printf("%d kdb's", ++numkdb);
+                               goto unconfig;
+                       }
+#if NKDB > 0
+                       printf("kdb%d at node %x\n", numkdb, node);
+                       kdbconfig(numkdb, (struct biiregs *)biv,
+                               (struct biiregs *)bip,
+                               (int)&scb[0].scb_ipl15[node] - (int)&scb[0]);
+                       scb[0].scb_ipl15[node] =
+                               scbentry(kdbintv[numkdb], SCB_ISTACK);
+                       kdbfind(numkdb);
+#endif
+                       numkdb++;
+                       break;
+
+               case BIDT_DEBNA:
+               case BIDT_DEBNK:
+                       printf("debna/debnk ethernet");
+                       goto unsupp;
+
+               default:
+                       printf("node type 0x%x ", dtype);
+unsupp:
+                       printf(" unsupported (at node %x)\n", node);
+                       break;
+unconfig:
+                       printf(" not configured (at node %x)\n", node);
+                       continue;
+               }
+#ifdef DO_EINTRCSR
+               biv->biic.bi_eintrcsr = BIEIC_IPL17 |
+                       (int)&scb[0].scb_bierr - (int)&scb[0];
+               /* but bi reset will need to restore this */
+#endif
+       }
+       if (numuba > NUBA)
+               numuba = NUBA;
+       if (numkdb > NKDB)
+               numkdb = NKDB;
+       if (nmcr > MAXNMCR)
+               nmcr = MAXNMCR;
+}
+
+#if NKDB > 0
+/*
+ * Find drives attached to a particular KDB50.
+ */
+kdbfind(kdbnum)
+       int kdbnum;
+{
+       extern struct uba_driver kdbdriver;
+       register struct uba_device *ui;
+       register struct uba_driver *udp = &kdbdriver;
+       int t;
+
+       for (ui = ubdinit; ui->ui_driver; ui++) {
+               /* ui->ui_ubanum is trash */
+               if (ui->ui_driver != udp || ui->ui_alive ||
+                   ui->ui_ctlr != kdbnum && ui->ui_ctlr != '?')
+                       continue;
+               t = ui->ui_ctlr;
+               ui->ui_ctlr = kdbnum;
+               if ((*udp->ud_slave)(ui) == 0) {
+                       ui->ui_ctlr = t;
+                       continue;
+               }
+               ui->ui_alive = 1;
+               ui->ui_ubanum = -1;
+
+               /* make these invalid so we can see if someone uses them */
+               /* might as well make each one different too */
+               ui->ui_hd = (struct uba_hd *)0xc0000010;
+               ui->ui_addr = (caddr_t)0xc0000014;
+               ui->ui_physaddr = (caddr_t)0xc0000018;
+               ui->ui_mi = (struct uba_ctlr *)0xc000001c;
+
+               if (ui->ui_dk && dkn < DK_NDRIVE)
+                       ui->ui_dk = dkn++;
+               else
+                       ui->ui_dk = -1;
+               /* ui_type comes from driver */
+               udp->ud_dinfo[ui->ui_unit] = ui;
+               printf("%s%d at %s%d slave %d\n",
+                   udp->ud_dname, ui->ui_unit,
+                   udp->ud_mname, ui->ui_ctlr, ui->ui_slave);
+               (*udp->ud_attach)(ui);
+       }
+}
+#endif /* NKDB > 0 */
+#endif /* NBI > 0 */
+
 #if NMBA > 0
 struct mba_device *mbaconfig();
 /*
 #if NMBA > 0
 struct mba_device *mbaconfig();
 /*
@@ -527,7 +785,7 @@ fixctlrmask()
                *phys(ud->ud_probe, short *) &= ~0xc00;
 }
 
                *phys(ud->ud_probe, short *) &= ~0xc00;
 }
 
-#if VAX630
+#ifdef QBA
 /*
  * Configure a Q-bus.
  */
 /*
  * Configure a Q-bus.
  */
@@ -536,7 +794,8 @@ probeqbus(qb)
 {
        register struct uba_hd *uhp = &uba_hd[numuba];
 
 {
        register struct uba_hd *uhp = &uba_hd[numuba];
 
-       ioaccess(qb->qb_map, Nexmap[0], qb->qb_memsize * sizeof (struct pte));
+       ioaccess((caddr_t)qb->qb_map, Nexmap[0],
+               qb->qb_memsize * sizeof (struct pte));
        uhp->uh_type = qb->qb_type;
        uhp->uh_uba = (struct uba_regs *)0xc0000000;   /* no uba adaptor regs */
        uhp->uh_mr = (struct pte *)&nexus[0];
        uhp->uh_type = qb->qb_type;
        uhp->uh_uba = (struct uba_regs *)0xc0000000;   /* no uba adaptor regs */
        uhp->uh_mr = (struct pte *)&nexus[0];
@@ -563,12 +822,12 @@ probeqbus(qb)
 }
 #endif
 
 }
 #endif
 
+#if NUBA > 0
 probeuba(vubp, pubp, pumem)
        struct uba_regs *vubp, *pubp;
        caddr_t pumem;
 {
        register struct uba_hd *uhp = &uba_hd[numuba];
 probeuba(vubp, pubp, pumem)
        struct uba_regs *vubp, *pubp;
        caddr_t pumem;
 {
        register struct uba_hd *uhp = &uba_hd[numuba];
-       caddr_t vumem;
 
        /*
         * Save virtual and physical addresses of adaptor.
 
        /*
         * Save virtual and physical addresses of adaptor.
@@ -589,6 +848,11 @@ probeuba(vubp, pubp, pumem)
        case VAX_730:
                uhp->uh_type = DW730;
                break;
        case VAX_730:
                uhp->uh_type = DW730;
                break;
+#endif
+#ifdef DWBUA
+       case VAX_8200:
+               uhp->uh_type = DWBUA;
+               break;
 #endif
        default:
                panic("unknown UBA type");
 #endif
        default:
                panic("unknown UBA type");
@@ -633,8 +897,8 @@ unifind(uhp0, pumem)
        struct uba_driver *udp;
        int i, (**ivec)();
        caddr_t ualloc;
        struct uba_driver *udp;
        int i, (**ivec)();
        caddr_t ualloc;
-       extern int catcher[256];
-#ifdef DW780
+       extern quad catcher[128];
+#if DW780 || DWBUA
        struct uba_regs *vubp = uhp->uh_uba;
 #endif
 
        struct uba_regs *vubp = uhp->uh_uba;
 #endif
 
@@ -650,27 +914,19 @@ unifind(uhp0, pumem)
        ubainitmaps(uhp);
 
        /*
        ubainitmaps(uhp);
 
        /*
-        * Allocate and initialize space
-        * for the UNIBUS interrupt vectors.
-        * On the 8600, can't use UNIvec;
-        * the vectors for the second SBI overlap it.
+        * Initialize space for the UNIBUS interrupt vectors.
+        * On the 8600, can't use first slot in UNIvec
+        * (the vectors for the second SBI overlap it);
+        * move each set of vectors forward.
         */
 #if    VAX8600
        if (cpu == VAX_8600)
         */
 #if    VAX8600
        if (cpu == VAX_8600)
-               uhp->uh_vec = (int(**)())malloc(512, M_DEVBUF, M_NOWAIT);
+               uhp->uh_vec = UNIvec[numuba + 1];
        else
 #endif
        else
 #endif
-       if (numuba == 0)
-               uhp->uh_vec = UNIvec;
-#if NUBA > 1
-       else if (numuba == 1)
-               uhp->uh_vec = UNI1vec;
-       else
-               uhp->uh_vec = (int(**)())malloc(512, M_DEVBUF, M_NOWAIT);
-#endif
+               uhp->uh_vec = UNIvec[numuba];
        for (i = 0; i < 128; i++)
        for (i = 0; i < 128; i++)
-               uhp->uh_vec[i] =
-                   scbentry(&catcher[i*2], SCB_ISTACK);
+               uhp->uh_vec[i] = scbentry(&catcher[i], SCB_ISTACK);
        /*
         * Set last free interrupt vector for devices with
         * programmable interrupt vectors.  Use is to decrement
        /*
         * Set last free interrupt vector for devices with
         * programmable interrupt vectors.  Use is to decrement
@@ -678,6 +934,11 @@ unifind(uhp0, pumem)
         */
        uhp->uh_lastiv = 0x200;
 
         */
        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;
 #ifdef DW780
        if (uhp->uh_type == DW780) {
                vubp->uba_sr = vubp->uba_sr;
@@ -721,7 +982,8 @@ unifind(uhp0, pumem)
         * then go looking for slaves.
         */
        for (um = ubminit; udp = um->um_driver; um++) {
         * then go looking for slaves.
         */
        for (um = ubminit; udp = um->um_driver; um++) {
-               if (um->um_ubanum != numuba && um->um_ubanum != '?')
+               if (um->um_ubanum != numuba && um->um_ubanum != '?' ||
+                   um->um_alive)
                        continue;
                addr = (u_short)um->um_addr;
                /*
                        continue;
                addr = (u_short)um->um_addr;
                /*
@@ -767,24 +1029,26 @@ unifind(uhp0, pumem)
                csralloc(ualloc, addr, i);
                um->um_alive = 1;
                um->um_ubanum = numuba;
                csralloc(ualloc, addr, i);
                um->um_alive = 1;
                um->um_ubanum = numuba;
-               um->um_hd = &uba_hd[numuba];
+               um->um_hd = uhp;
                um->um_addr = (caddr_t)reg;
                udp->ud_minfo[um->um_ctlr] = um;
                um->um_addr = (caddr_t)reg;
                udp->ud_minfo[um->um_ctlr] = um;
-               for (ivec = um->um_intr; *ivec; ivec++) {
-                       um->um_hd->uh_vec[cvec/4] =
-                           scbentry(*ivec, SCB_ISTACK);
-                       cvec += 4;
-               }
+               for (cvec /= 4, ivec = um->um_intr; *ivec; cvec++, ivec++)
+                       uhp->uh_vec[cvec] = scbentry(*ivec, SCB_ISTACK);
                for (ui = ubdinit; ui->ui_driver; ui++) {
                for (ui = ubdinit; ui->ui_driver; ui++) {
+                       int t;
+
                        if (ui->ui_driver != udp || ui->ui_alive ||
                            ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' ||
                            ui->ui_ubanum != numuba && ui->ui_ubanum != '?')
                                continue;
                        if (ui->ui_driver != udp || ui->ui_alive ||
                            ui->ui_ctlr != um->um_ctlr && ui->ui_ctlr != '?' ||
                            ui->ui_ubanum != numuba && ui->ui_ubanum != '?')
                                continue;
-                       if ((*udp->ud_slave)(ui, reg)) {
+                       t = ui->ui_ctlr;
+                       ui->ui_ctlr = um->um_ctlr;
+                       if ((*udp->ud_slave)(ui, reg) == 0)
+                               ui->ui_ctlr = t;
+                       else {
                                ui->ui_alive = 1;
                                ui->ui_alive = 1;
-                               ui->ui_ctlr = um->um_ctlr;
                                ui->ui_ubanum = numuba;
                                ui->ui_ubanum = numuba;
-                               ui->ui_hd = &uba_hd[numuba];
+                               ui->ui_hd = uhp;
                                ui->ui_addr = (caddr_t)reg;
                                ui->ui_physaddr = pumem + ubdevreg(addr);
                                if (ui->ui_dk && dkn < DK_NDRIVE)
                                ui->ui_addr = (caddr_t)reg;
                                ui->ui_physaddr = pumem + ubdevreg(addr);
                                if (ui->ui_dk && dkn < DK_NDRIVE)
@@ -794,10 +1058,11 @@ unifind(uhp0, pumem)
                                ui->ui_mi = um;
                                /* ui_type comes from driver */
                                udp->ud_dinfo[ui->ui_unit] = ui;
                                ui->ui_mi = um;
                                /* ui_type comes from driver */
                                udp->ud_dinfo[ui->ui_unit] = ui;
-                               printf("%s%d at %s%d slave %d\n",
+                               printf("%s%d at %s%d slave %d",
                                    udp->ud_dname, ui->ui_unit,
                                    udp->ud_mname, um->um_ctlr, ui->ui_slave);
                                (*udp->ud_attach)(ui);
                                    udp->ud_dname, ui->ui_unit,
                                    udp->ud_mname, um->um_ctlr, ui->ui_slave);
                                (*udp->ud_attach)(ui);
+                               printf("\n");
                        }
                }
                break;
                        }
                }
                break;
@@ -847,12 +1112,9 @@ unifind(uhp0, pumem)
                }
                printf("vec %o, ipl %x\n", cvec, br);
                csralloc(ualloc, addr, i);
                }
                printf("vec %o, ipl %x\n", cvec, br);
                csralloc(ualloc, addr, i);
-               ui->ui_hd = &uba_hd[numuba];
-               for (ivec = ui->ui_intr; *ivec; ivec++) {
-                       ui->ui_hd->uh_vec[cvec/4] =
-                           scbentry(*ivec, SCB_ISTACK);
-                       cvec += 4;
-               }
+               ui->ui_hd = uhp;
+               for (cvec /= 4, ivec = ui->ui_intr; *ivec; cvec++, ivec++)
+                       uhp->uh_vec[cvec] = scbentry(*ivec, SCB_ISTACK);
                ui->ui_alive = 1;
                ui->ui_ubanum = numuba;
                ui->ui_addr = (caddr_t)reg;
                ui->ui_alive = 1;
                ui->ui_ubanum = numuba;
                ui->ui_addr = (caddr_t)reg;
@@ -901,6 +1163,7 @@ unifind(uhp0, pumem)
 
        free(ualloc, M_TEMP);
 }
 
        free(ualloc, M_TEMP);
 }
+#endif /* NUBA */
 
 /*
  * Mark addresses starting at "addr" and continuing
 
 /*
  * Mark addresses starting at "addr" and continuing
@@ -1044,6 +1307,8 @@ static    char devname[][2] = {
        0,0,            /* 12 = uu */
        0,0,            /* 13 = rx */
        'r','l',        /* 14 = rl */
        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
 };
 
 #define        PARTITIONMASK   0x7
index 0a40fc9..30de15b 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)clock.c     7.1 (Berkeley) %G%
+ *     @(#)clock.c     7.2 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
  */
 startrtclock()
 {
  */
 startrtclock()
 {
-#ifdef VAX630
-       if (cpu == VAX_630) {
-               mtpr(ICCS, ICCS_IE);
-       } else {
-#endif
-               mtpr(NICR, -1000000/hz);
-               mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);
-#ifdef VAX630
-       }
-#endif
+
+       (*cpuops->cpu_clock->clkstartrt)();
 }
 
 /*
  * Initialze the time of day register, based on the time base which is, e.g.
  * from a filesystem.  Base provides the time to within six months,
 }
 
 /*
  * Initialze the time of day register, based on the time base which is, e.g.
  * from a filesystem.  Base provides the time to within six months,
- * and the time of year clock provides the rest.
+ * and the time of year clock (if any) provides the rest.
  */
 inittodr(base)
        time_t base;
 {
  */
 inittodr(base)
        time_t base;
 {
-       register u_int todr = mfpr(TODR);
-       long deltat;
-       int year = YRREF;
-#if VAX630
-       /*
-        * If this is a Ka630, call ka630tod to handle the funny tod clock.
-        */
-       if (cpu == VAX_630) {
-               ka630tod(base);
-               return;
-       }
-#endif
+       long deltat, badbase = 0;
+
        if (base < 5*SECYR) {
        if (base < 5*SECYR) {
-               printf("WARNING: preposterous time in file system");
-               time.tv_sec = 6*SECYR + 186*SECDAY + SECDAY/2;
-               resettodr();
-               goto check;
+               printf("WARNING: preposterous time in file system\n");
+               /* read the system clock anyway */
+               base = 6*SECYR + 186*SECDAY + SECDAY/2;
+               badbase = 1;
        }
        }
+       switch ((*cpuops->cpu_clock->clkread)(base)) {
+
+       case CLKREAD_BAD:
+               /*
+                * Believe the time in the file system for lack of
+                * anything better, resetting the TODR.
+                */
+               time.tv_sec = base;
+               if (!badbase)
+                       resettodr();
+               break;
+
+       case CLKREAD_WARN:
+               break;
+
+       case CLKREAD_OK:
+               if (badbase)
+                       break;
+               /*
+                * See if we gained/lost two or more days;
+                * if so, assume something is amiss.
+                */
+               deltat = time.tv_sec - base;
+               if (deltat < 0)
+                       deltat = -deltat;
+               if (deltat < 2 * SECDAY)
+                       return;
+               printf("WARNING: clock %s %d days",
+                   time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
+               break;
+
+       default:
+               panic("inittodr");
+               /* NOTREACHED */
+       }
+       printf(" -- CHECK AND RESET THE DATE!\n");
+}
+
+/*
+ * Reset the TODR based on the time value; used when the TODR
+ * has a preposterous value and also when the time is reset
+ * by the stime system call.  Also called when the TODR goes past
+ * TODRZERO + 100*(SECYEAR+2*SECDAY) (e.g. on Jan 2 just after midnight)
+ * to wrap the TODR around.
+ */
+resettodr()
+{
+
+       (*cpuops->cpu_clock->clkwrite)();
+}
+
+/*
+ * ``Standard'' VAX clock routines.
+ */
+#if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX730
+vaxstd_clkstartrt()
+{
+
+       mtpr(NICR, -1000000/hz);
+       mtpr(ICCS, ICCS_RUN+ICCS_IE+ICCS_TRANS+ICCS_INT+ICCS_ERR);
+}
+#endif
+
+#if VAX8600 || VAX780 || VAX750 || VAX730
+vaxstd_clkread(base)
+       time_t base;
+{
+       register u_int todr = mfpr(TODR);
+       int year;
+
        /*
         * TODRZERO is base used by VMS, which runs on local time.
         */
        if (todr < TODRZERO) {
                printf("WARNING: todr too small");
        /*
         * TODRZERO is base used by VMS, which runs on local time.
         */
        if (todr < TODRZERO) {
                printf("WARNING: todr too small");
-               time.tv_sec = base;
-               /*
-                * Believe the time in the file system for lack of
-                * anything better, resetting the TODR.
-                */
-               resettodr();
-               goto check;
+               return (CLKREAD_BAD);
        }
 
        /*
        }
 
        /*
@@ -91,52 +137,24 @@ inittodr(base)
         * seconds in the current year takes us to the end of the current year
         * and then around into the next year to the same position.
         */
         * seconds in the current year takes us to the end of the current year
         * and then around into the next year to the same position.
         */
-       time.tv_sec = (todr-TODRZERO)/100;
-       while (time.tv_sec < base-SECYR/2) {
+       time.tv_sec = (todr - TODRZERO) / 100;
+       year = YRREF;
+       while (time.tv_sec < base - SECYR/2) {
                if (LEAPYEAR(year))
                        time.tv_sec += SECDAY;
                year++;
                time.tv_sec += SECYR;
        }
 
                if (LEAPYEAR(year))
                        time.tv_sec += SECDAY;
                year++;
                time.tv_sec += SECYR;
        }
 
-       /*
-        * See if we gained/lost two or more days;
-        * if so, assume something is amiss.
-        */
-       deltat = time.tv_sec - base;
-       if (deltat < 0)
-               deltat = -deltat;
-       if (deltat < 2*SECDAY)
-               return;
-       printf("WARNING: clock %s %d days",
-           time.tv_sec < base ? "lost" : "gained", deltat / SECDAY);
-check:
-       printf(" -- CHECK AND RESET THE DATE!\n");
+       return (CLKREAD_OK);
 }
 
 }
 
-/*
- * Reset the TODR based on the time value; used when the TODR
- * has a preposterous value and also when the time is reset
- * by the stime system call.  Also called when the TODR goes past
- * TODRZERO + 100*(SECYEAR+2*SECDAY) (e.g. on Jan 2 just after midnight)
- * to wrap the TODR around.
- */
-resettodr()
+vaxstd_clkwrite()
 {
        int year = YRREF;
        u_int secyr;
        u_int yrtime = time.tv_sec;
 
 {
        int year = YRREF;
        u_int secyr;
        u_int yrtime = time.tv_sec;
 
-#if VAX630
-       /*
-        * If this is a ka630, call ka630stod to set the funny tod clock.
-        */
-       if (cpu == VAX_630) {
-               ka630stod();
-               return;
-       }
-#endif
-
        /*
         * Whittle the time down to an offset in the current year,
         * by subtracting off whole years as long as possible.
        /*
         * Whittle the time down to an offset in the current year,
         * by subtracting off whole years as long as possible.
@@ -152,3 +170,68 @@ resettodr()
        }
        mtpr(TODR, TODRZERO + yrtime*100);
 }
        }
        mtpr(TODR, TODRZERO + yrtime*100);
 }
+#endif
+
+#if VAX8200 || VAX630
+/*
+ * This code is defunct after 2099.
+ * Will Unix still be here then??
+ */
+short dayyr[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
+
+chiptotime(c)
+       register struct chiptime *c;
+{
+       register int days, yr;
+
+       /* simple sanity checks */
+       if (c->year < 70 || c->mon < 1 || c->mon > 12 ||
+           c->day < 1 || c->day > 31) {
+               printf("WARNING: preposterous clock chip time");
+               return (0);
+       }
+       days = 0;
+       for (yr = 70; yr < c->year; yr++)
+               days += LEAPYEAR(yr) ? 366 : 365;
+       days += dayyr[c->mon - 1] + c->day - 1;
+       if (LEAPYEAR(yr) && c->mon > 2)
+               days++;
+       /* now have days since Jan 1, 1970; the rest is easy... */
+       return (days * SECDAY + c->hour * 3600 + c->min * 60 + c->sec);
+}
+
+timetochip(c)
+       register struct chiptime *c;
+{
+       register int t, t2, t3;
+
+       /* compute the year */
+       t2 = time.tv_sec / SECDAY;
+       t = 69;
+       while (t2 >= 0) {       /* whittle off years */
+               t3 = t2;
+               t++;
+               t2 -= LEAPYEAR(t) ? 366 : 365;
+       }
+       c->year = t;
+
+       /* t3 = month + day; separate */
+       t = LEAPYEAR(t);
+       for (t2 = 1; t2 < 12; t2++)
+               if (t3 < dayyr[t2] + (t && t2 > 1))
+                       break;
+
+       /* t2 is month */
+       c->mon = t2;
+       c->day = t3 - dayyr[t2 - 1] + 1;
+       if (t && t2 > 2)
+               c->day--;
+
+       /* the rest is easy */
+       t = time.tv_sec % SECDAY;
+       c->hour = t / 3600;
+       t %= 3600;
+       c->min = t / 60;
+       c->sec = t % 60;
+}
+#endif
index c4c5aa8..b925150 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)cons.c      7.4 (Berkeley) %G%
+ *     @(#)cons.c      7.5 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -129,7 +129,7 @@ cnrint(dev)
                return;
        }
        tp = &cons;
                return;
        }
        tp = &cons;
-#ifdef KDB
+#ifdef KADB
        if (!kdbrintr(c, tp))
 #endif
        (*linesw[tp->t_line].l_rint)(c, tp);
        if (!kdbrintr(c, tp))
 #endif
        (*linesw[tp->t_line].l_rint)(c, tp);
@@ -248,7 +248,7 @@ cnputc(c)
        mtpr(TXCS, s);
 }
 
        mtpr(TXCS, s);
 }
 
-#if defined(KDB) || defined(GENERIC)
+#if (defined(KADB) || defined(GENERIC)) && !defined(lint)
 /*
  * Get character from console.
  */
 /*
  * Get character from console.
  */
@@ -266,7 +266,7 @@ cngetc()
 }
 #endif
 
 }
 #endif
 
-#ifdef KDB
+#ifdef KADB
 cnpoll(onoff)
        int onoff;
 {
 cnpoll(onoff)
        int onoff;
 {
index edbe799..fab6b57 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)cpudata.c   7.2 (Berkeley) %G%
+ *     @(#)cpudata.c   7.3 (Berkeley) %G%
  */
 
 #include "pte.h"
  */
 
 #include "pte.h"
@@ -13,6 +13,7 @@
 #include "cpu.h"
 #include "nexus.h"
 #include "ioa.h"
 #include "cpu.h"
 #include "nexus.h"
 #include "ioa.h"
+#include "../vaxbi/bireg.h"
 #include "../vaxuba/ubareg.h"
 
 /*
 #include "../vaxuba/ubareg.h"
 
 /*
@@ -71,6 +72,19 @@ short        nexty730[NNEX730] = {
 };
 #endif
 
 };
 #endif
 
+#if VAX8800
+/* I think this is how the thing is shaped: */
+struct bibus bi8800[] = {
+       { BI_BASE(0) },
+       { BI_BASE(1) },
+};
+struct iobus io8800 = {
+       { IO_BIA, somewhere, somesize, (caddr_t)&bi8800[0] },
+       { IO_BIA, somewhere, somesize, (caddr_t)&bi8800[1] },
+};
+/* but you will have to make it work yourself (sorry) */
+#endif
+
 #if VAX8600
 struct nexusconnect sbi8600[] = {
        { NNEX8600, NEXA8600, DW780, NBDP8600, umaddr8600a, 0 },
 #if VAX8600
 struct nexusconnect sbi8600[] = {
        { NNEX8600, NEXA8600, DW780, NBDP8600, umaddr8600a, 0 },
@@ -82,6 +96,16 @@ struct iobus io8600[] = {
 };
 #endif
 
 };
 #endif
 
+#if VAX8200
+/* BEWARE, this is all limited to one BI for now */
+struct bibus bi8200[] = {
+       { BI_BASE(0) },
+};
+struct iobus io8200[] = {
+       { IO_BI, 0, 0, (caddr_t)&bi8200[0] },
+};
+#endif
+
 #if VAX780
 struct nexusconnect sbi780 = {
        NNEX780, NEX780, DW780, NBDP780, umaddr780, 0,
 #if VAX780
 struct nexusconnect sbi780 = {
        NNEX780, NEX780, DW780, NBDP780, umaddr780, 0,
@@ -109,22 +133,93 @@ struct qbus qbus630 = {
 struct iobus io630[] = { IO_QBUS, 0, 0, (caddr_t)&qbus630 };
 #endif
 
 struct iobus io630[] = { IO_QBUS, 0, 0, (caddr_t)&qbus630 };
 #endif
 
+/*
+ * Clock info
+ */
+#if VAX8600 || VAX780 || VAX750 || VAX730
+int vaxstd_clkstartrt(), vaxstd_clkread(), vaxstd_clkwrite();
+struct clockops vaxstd_clockops = {
+       vaxstd_clkstartrt, vaxstd_clkread, vaxstd_clkwrite
+};
+#endif
+
+#if VAX8200
+int vaxstd_clkstartrt(), ka820_clkread(), ka820_clkwrite();
+struct clockops ka820_clockops = {
+       vaxstd_clkstartrt, ka820_clkread, ka820_clkwrite
+};
+#endif
+
+#if VAX630
+int ka630_clkstartrt(), ka630_clkread(), ka630_clkwrite();
+struct clockops ka630_clockops = {
+       ka630_clkstartrt, ka630_clkread, ka630_clkwrite
+};
+#endif
+
+/*
+ * CPU dependent routines.
+ */
+#if VAX8600
+int    ka860_memenable(), ka860_memerr(), ka860_mchk();
+struct cpuops ka860_ops = {
+       &vaxstd_clockops, ka860_memenable, ka860_memerr, ka860_mchk, NULL
+};
+#endif
+
+#if VAX8200
+int    ka820_memenable(), ka820_memerr(), ka820_mchk(), ka820_init();
+struct cpuops ka820_ops = {
+       &ka820_clockops, ka820_memenable, ka820_memerr, ka820_mchk, ka820_init
+};
+#endif
+
+#if VAX780
+int    ka780_memenable(), ka780_memerr(), ka780_mchk();
+struct cpuops ka780_ops = {
+       &vaxstd_clockops, ka780_memenable, ka780_memerr, ka780_mchk, NULL
+};
+#endif
+
+#if VAX750
+int    ka750_memenable(), ka750_memerr(), ka750_mchk();
+struct cpuops ka750_ops = {
+       &vaxstd_clockops, ka750_memenable, ka750_memerr, ka750_mchk, NULL
+};
+#endif
+
+#if VAX730
+int    ka730_memenable(), ka730_memerr(), ka730_mchk();
+struct cpuops ka730_ops = {
+       &vaxstd_clockops, ka730_memenable, ka730_memerr, ka730_mchk, NULL
+};
+#endif
+
+#if VAX630
+int    ka630_memnop(), ka630_mchk(), ka630_init();
+struct cpuops ka630_ops = {
+       &ka630_clockops, ka630_memnop, ka630_memnop, ka630_mchk, ka630_init
+};
+#endif
 
 struct percpu percpu[] = {
 #if VAX8600
 
 struct percpu percpu[] = {
 #if VAX8600
-       { VAX_8600, 6, 2, io8600 },
+       { VAX_8600, 6, 2, io8600, &ka860_ops },
+#endif
+#if VAX8200
+       { VAX_8200, 2, 1, io8200, &ka820_ops },
 #endif
 #if VAX780
 #endif
 #if VAX780
-       { VAX_780, 2, 1, io780 },
+       { VAX_780, 2, 1, io780, &ka780_ops },
 #endif
 #if VAX750
 #endif
 #if VAX750
-       { VAX_750, 1, 1, io750 },
+       { VAX_750, 1, 1, io750, &ka750_ops },
 #endif
 #if VAX730
 #endif
 #if VAX730
-       { VAX_730, 1, 1, io730 },
+       { VAX_730, 1, 1, io730, &ka730_ops },
 #endif
 #if VAX630
 #endif
 #if VAX630
-       { VAX_630, 2, 1, io630 },
+       { VAX_630, 2, 1, io630, &ka630_ops },
 #endif
        0,
 };
 #endif
        0,
 };
index 6879749..4932fa6 100644 (file)
@@ -1,8 +1,8 @@
 /*
 /*
- *     @(#)ka630.c     7.3 (Berkeley) %G%
+ *     @(#)ka630.c     7.4 (Berkeley) %G%
  */
  */
-#if defined(VAX630)
-/* ka630.c routines for the ka630 clock chip... */
+
+#ifdef VAX630
 #include "param.h"
 #include "time.h"
 #include "kernel.h"
 #include "param.h"
 #include "time.h"
 #include "kernel.h"
 #include "ka630.h"
 
 /*
 #include "ka630.h"
 
 /*
- * These two fuctions handle the tod clock
- * This code is defunct at the end of the century.
- * Will Unix still be here then??
+ * 630-specific routines
  */
  */
+extern struct pte Clockmap[];
+extern struct pte Ka630map[];
+struct ka630clock ka630clock;
+struct ka630cpu ka630cpu;
 
 
-extern struct cldevice cldevice;
-extern struct ka630cpu ka630cpu;
-static int clkinit;
-
-short dayyr[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, };
-/* Starts the tod clock. Called from clkstart... */
-ka630tod(base)
-       time_t base;
+ka630_init()
 {
 {
-       register int tmp1, tmp2;
-       register struct cldevice *claddr = &cldevice;
-       struct ka630cpu *ka630addr = &ka630cpu;
 
 
-       /* Enable system page for registers */
-       ioaccess(0x200b8000, &Clockmap[0], sizeof(struct cldevice));
-       ioaccess(0x20080000, &Ka630map[0], sizeof(struct ka630cpu));
-       clkinit = 1;
+       /*
+        * Map in the clock and the CPU.
+        */
+       ioaccess((caddr_t)0x200b8000, &Clockmap[0], sizeof(struct ka630clock));
+       ioaccess((caddr_t)0x20080000, &Ka630map[0], sizeof(struct ka630cpu));
 
        /*
 
        /*
-        * Clear restart and boot in progress flags in the CPMBX. This has
-        * nothing to do with the clock except that it the CPMBX reg. is a
-        * byte in the clock's ram.
+        * Clear restart and boot in progress flags in the CPMBX.
         */
         */
-       claddr->cpmbx=(u_short)((claddr->cpmbx&KA630CLK_LANG)|KA630CLK_REBOOT);
+       ka630clock.cpmbx = (ka630clock.cpmbx & KA630CLK_LANG) | KA630CLK_REBOOT;
+
        /*
        /*
-        * Enable memory parity error detection. again nothing to do with the
-        * tod clock except for being a convenient place.
+        * Enable memory parity error detection.
         */
         */
-       ka630addr->ka630_mser = KA630MSER_PAREN;
+       ka630cpu.ka630_mser = KA630MSER_PAREN;
+}
+
+/* Start the real-time clock */
+ka630_clkstartrt()
+{
+
+       mtpr(ICCS, ICCS_IE);
+}
+
+/* init system time from tod clock */
+/* ARGSUSED */
+ka630_clkread(base)
+       time_t base;
+{
+       register struct ka630clock *claddr = &ka630clock;
+       struct chiptime c;
+
        claddr->csr1 = KA630CLK_SET;
        while ((claddr->csr0 & KA630CLK_UIP) != 0)
                ;
        /* If the clock is valid, use it. */
        if ((claddr->csr3 & KA630CLK_VRT) != 0 &&
            (claddr->csr1 & KA630CLK_ENABLE) == KA630CLK_ENABLE) {
        claddr->csr1 = KA630CLK_SET;
        while ((claddr->csr0 & KA630CLK_UIP) != 0)
                ;
        /* If the clock is valid, use it. */
        if ((claddr->csr3 & KA630CLK_VRT) != 0 &&
            (claddr->csr1 & KA630CLK_ENABLE) == KA630CLK_ENABLE) {
-               /* Convert yr,mon,day,hr,min,sec to sec past Jan.1, 1970. */
-               tmp2 = 0;
-               for (tmp1 = 70; tmp1 < claddr->yr; tmp1++) {
-                       tmp2 += 365;
-                       /* I just luv leap years... */
-                       if (LEAPYEAR(tmp1))
-                               tmp2++;
-               }
-               tmp2 += (dayyr[claddr->mon-1]+claddr->day-1);
-               if (LEAPYEAR(claddr->yr) && claddr->mon > 2)
-                       tmp2++;
-               /* Finally got days past Jan. 1,1970. the rest is easy.. */
-               time.tv_sec = tmp2*SECDAY+claddr->hr*HRSEC+
-                       claddr->min*MINSEC+claddr->sec;
-               tmp1 = claddr->csr2;
+               c.sec = claddr->sec;
+               c.min = claddr->min;
+               c.hour = claddr->hr;
+               c.day = claddr->day;
+               c.mon = claddr->mon;
+               c.year = claddr->yr;
+#ifndef lint
+               { int t = claddr->csr2; }       /* ??? */
+#endif
                claddr->csr0 = KA630CLK_RATE;
                claddr->csr1 = KA630CLK_ENABLE;
                claddr->csr0 = KA630CLK_RATE;
                claddr->csr1 = KA630CLK_ENABLE;
-       } else if (base < 5*SECYR) {
-               printf("WARNING: preposterous time in file system\n");
-               time.tv_sec = 6*SECYR+186*SECDAY+SECDAY/2;
-               ka630stod();
-       } else {
-               printf("WARNING: Time set via file system\n");
-               time.tv_sec = base;
-               ka630stod();
+
+               time.tv_sec = chiptotime(&c);
+               return (time.tv_sec ? CLKREAD_OK : CLKREAD_BAD);
        }
        }
+       printf("WARNING: TOY clock invalid");
+       return (CLKREAD_BAD);
 }
 }
+
 /* Set the time of day clock, called via. stime system call.. */
 /* Set the time of day clock, called via. stime system call.. */
-ka630stod()
+ka630_clkwrite()
 {
 {
-       register int tmp1, tmp3;
-       register struct cldevice *claddr = &cldevice;
-       long tmp2, tmp4;
+       register struct ka630clock *claddr = &ka630clock;
+       struct chiptime c;
+       int s;
 
 
-       if (clkinit == 0)
-               return;
+       timetochip(&c);
+       s = splhigh();
        claddr->csr1 = KA630CLK_SET;
        while ((claddr->csr0 & KA630CLK_UIP) != 0)
                ;
        claddr->csr1 = KA630CLK_SET;
        while ((claddr->csr0 & KA630CLK_UIP) != 0)
                ;
-       /* The reverse of above, sec. past Jan. 1,1970 to yr, mon... */
-       tmp2 = time.tv_sec/HRSEC;
-       tmp4 = tmp2 = tmp2/24;
-       tmp1 = 69;
-       while (tmp2 >= 0) {
-               tmp3 = tmp2;
-               tmp2 -= 365;
-               tmp1++;
-               if (LEAPYEAR(tmp1))
-                       tmp2--;
-       }
-       /* Got the year... */
-       claddr->yr = tmp1;
-       tmp1 = -1;
-       do {
-               tmp2 = tmp3-dayyr[++tmp1];
-               if (LEAPYEAR(claddr->yr) && tmp1 > 1)
-                       tmp2--;
-       } while (tmp2 >= 0);
-       /* Finally, got the rest... */
-       claddr->mon = tmp1;
-       claddr->day = tmp3-dayyr[tmp1-1]+1;
-       if (LEAPYEAR(claddr->yr) && tmp1 > 2)
-               claddr->day--;
-       tmp2 = time.tv_sec-(tmp4*SECDAY);
-       claddr->hr = tmp2/HRSEC;
-       tmp2 = tmp2%HRSEC;
-       claddr->min = tmp2/MINSEC;
-       tmp2 = tmp2%MINSEC;
-       claddr->sec = tmp2;
-       tmp1 = claddr->csr2;
-       tmp1 = claddr->csr3;
+       claddr->sec = c.sec;
+       claddr->min = c.min;
+       claddr->hr = c.hour;
+       claddr->day = c.day;
+       claddr->mon = c.mon;
+       claddr->yr = c.year;
+#ifndef lint
+       { int t = claddr->csr2; }       /* ??? */
+       { int t = claddr->csr3; }       /* ??? */
+#endif
        claddr->csr0 = KA630CLK_RATE;
        claddr->csr1 = KA630CLK_ENABLE;
        claddr->csr0 = KA630CLK_RATE;
        claddr->csr1 = KA630CLK_ENABLE;
+       splx(s);
+}
+
+ka630_memnop()
+{
+
+       /* void */
+}
+
+#define NMC630 10
+char *mc630[] = {
+       0,              "immcr (fsd)",  "immcr (ssd)",  "fpu err 0",
+       "fpu err 7",    "mmu st(tb)",   "mmu st(m=0)",  "pte in p0",
+       "pte in p1",    "un intr id",
+};
+
+struct mc630frame {
+       int     mc63_bcnt;              /* byte count == 0xc */
+       int     mc63_summary;           /* summary parameter */
+       int     mc63_mrvaddr;           /* most recent vad */
+       int     mc63_istate;            /* internal state */
+       int     mc63_pc;                /* trapped pc */
+       int     mc63_psl;               /* trapped psl */
+};
+
+ka630_mchk(cmcf)
+       caddr_t cmcf;
+{
+       register struct ka630cpu *ka630addr = &ka630cpu;
+       register struct mc630frame *mcf = (struct mc630frame *)cmcf;
+       register u_int type = mcf->mc63_summary;
+
+       printf("machine check %x: %s\n", type,
+           type < NMC630 ? mc630[type] : "???");
+       printf("\tvap %x istate %x pc %x psl %x\n",
+           mcf->mc63_mrvaddr, mcf->mc63_istate,
+           mcf->mc63_pc, mcf->mc63_psl);
+       if (ka630addr->ka630_mser & KA630MSER_MERR) {
+               printf("\tmser=0x%x ", ka630addr->ka630_mser);
+               if (ka630addr->ka630_mser & KA630MSER_CPUER)
+                       printf("page=%d", ka630addr->ka630_cear);
+               if (ka630addr->ka630_mser & KA630MSER_DQPE)
+                       printf("page=%d", ka630addr->ka630_dear);
+               printf("\n");
+       }
+       return (MCHK_PANIC);
 }
 #endif
 }
 #endif
index 583c4f7..338dec5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- *     @(#)ka630.h     7.1 (Berkeley) %G%
+ *     @(#)ka630.h     7.2 (Berkeley) %G%
  *
  * Definitions specific to the ka630 uvax2 cpu card. Includes the tod
  * clock chip and the cpu registers.
  *
  * Definitions specific to the ka630 uvax2 cpu card. Includes the tod
  * clock chip and the cpu registers.
@@ -49,7 +49,7 @@
 #define        KA630CLK_LANG   0360
 
 #ifndef LOCORE
 #define        KA630CLK_LANG   0360
 
 #ifndef LOCORE
-struct cldevice {
+struct ka630clock {
        u_short sec;
        u_short secalrm;
        u_short min;
        u_short sec;
        u_short secalrm;
        u_short min;
index 8fe3a00..dec63d3 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)locore.s    7.9 (Berkeley) %G%
+ *     @(#)locore.s    7.10 (Berkeley) %G%
  */
 
 #include "psl.h"
  */
 
 #include "psl.h"
@@ -20,6 +20,7 @@
 #include "clock.h"
 #include "ioa.h"
 #include "ka630.h"
 #include "clock.h"
 #include "ioa.h"
 #include "ka630.h"
+#include "ka820.h"
 #include "../vaxuba/ubareg.h"
 
 #include "dz.h"
 #include "../vaxuba/ubareg.h"
 
 #include "dz.h"
@@ -56,7 +57,7 @@ eintstack:
        .globl  _doadump
 _doadump:
        nop; nop                                # .word 0x0101
        .globl  _doadump
 _doadump:
        nop; nop                                # .word 0x0101
-#define        _rpbmap _Sysmap                         # rpb, scb, UNI*vec, istack*4
+#define        _rpbmap _Sysmap                         # rpb, scb, UNIvec[], istack*4
        bicl2   $PG_PROT,_rpbmap
        bisl2   $PG_KW,_rpbmap
        mtpr    $0,$TBIA
        bicl2   $PG_PROT,_rpbmap
        bisl2   $PG_KW,_rpbmap
        mtpr    $0,$TBIA
@@ -73,8 +74,8 @@ _doadump:
        pushr   $0x3fff
        calls   $0,_dumpsys
 1:
        pushr   $0x3fff
        calls   $0,_dumpsys
 1:
-       pushl   $TXDB_BOOT
-       calls   $1,_tocons
+       clrl    r11                             # boot flags
+       calls   $0,_vaxboot
        halt
 
 /*
        halt
 
 /*
@@ -106,12 +107,12 @@ SCBVEC(machcheck):
        .word   5f-0b           # 2 is 750
        .word   5f-0b           # 3 is 730
        .word   7f-0b           # 4 is 8600
        .word   5f-0b           # 2 is 750
        .word   5f-0b           # 3 is 730
        .word   7f-0b           # 4 is 8600
-       .word   1f-0b           # ???
-       .word   1f-0b           # ???
-       .word   1f-0b           # ???
+       .word   5f-0b           # 5 is 8200
+       .word   1f-0b           # 6 is 8800 (unsupported)
+       .word   1f-0b           # 7 is 610  (unsupported)
        .word   1f-0b           # 8 is 630
 5:
        .word   1f-0b           # 8 is 630
 5:
-#if defined(VAX750) || defined(VAX730)
+#if defined(VAX8200) || defined(VAX750) || defined(VAX730)
        mtpr    $0xf,$MCESR
 #endif
        brb     1f
        mtpr    $0xf,$MCESR
 #endif
        brb     1f
@@ -129,21 +130,136 @@ SCBVEC(machcheck):
        movl    nofault,(sp)
        rei
 SCBVEC(kspnotval):
        movl    nofault,(sp)
        rei
 SCBVEC(kspnotval):
-       PUSHR; PANIC("KSP not valid");
+       PANIC("KSP not valid");
 SCBVEC(powfail):
        halt
 SCBVEC(chme): SCBVEC(chms): SCBVEC(chmu):
 SCBVEC(powfail):
        halt
 SCBVEC(chme): SCBVEC(chms): SCBVEC(chmu):
-       PUSHR; PANIC("CHM? in kernel");
-SCBVEC(stray):
-       PUSHR; PRINTF(0, "stray scb interrupt\n"); POPR;
+       PANIC("CHM? in kernel");
+
+SCBVEC(nex0zvec):
+       PUSHR
+       clrl    r0
+       brb     1f
+SCBVEC(nex1zvec):
+       PUSHR
+       movl    $1,r0
+1:
+       cmpl    _cpu,$VAX_8600          # this is a frill
+       beql    2f
+       mfpr    $IPL,-(sp)
+       PRINTF(1, "nexus stray intr ipl%x\n")
+       POPR
        rei
        rei
-SCBVEC(nexzvec):
-       PUSHR; mfpr $IPL,-(sp); PRINTF(1, "nexus stray intr ipl%x\n"); POPR; rei
+2:
+       pushl   r0
+       mfpr    $IPL,-(sp)
+       PRINTF(2, "nexus stray intr ipl%x sbia%d\n")
+       POPR
+       rei
+
 SCBVEC(cmrd):
        PUSHR; calls $0,_memerr; POPR; rei
 SCBVEC(cmrd):
        PUSHR; calls $0,_memerr; POPR; rei
-SCBVEC(wtime):
-       PUSHR; pushl 6*4(sp); PRINTF(1,"write timeout %x\n"); POPR;
-       PANIC("wtimo");
+
+SCBVEC(wtime):                 /* sbi0err on 8600 */
+#if VAX8600
+       cmpl    _cpu,$VAX_8600
+       bneq    wtimo
+       PANIC("sbia0 error")
+wtimo:
+#endif
+       PUSHR; pushl 6*4(sp); PRINTF(1, "write timeout %x\n"); POPR
+       PANIC("wtimo")
+
+SCBVEC(sbi0fail):
+       PANIC("sbia0 fail")
+SCBVEC(sbi0alert):
+#if VAX8200
+       cmpl    _cpu,$VAX_8200
+       bneq    alert
+       PUSHR; calls $0,_rxcdintr; POPR; rei
+alert:
+#endif
+       PANIC("sbia0 alert")
+SCBVEC(sbi0fault):
+       PANIC("sbia0 fault")
+
+#ifdef notyet
+#if VAX8600
+SCBVEC(sbi1fail):
+       PANIC("sbia1 fail")
+SCBVEC(sbi1alert):
+       PANIC("sbia1 alert")
+SCBVEC(sbi1fault):
+       PANIC("sbia1 fault")
+SCBVEC(sbi1err):
+       PANIC("sbia1 error")
+#endif
+#endif
+
+/*
+ * BI 0 bus error (8200), or SBI silo compare error (others)
+ * VMS boot leaves us 1 BI error to ignore.
+ */
+#if VAX8200 && 0
+       .data
+       .align  2
+_ignorebi: .globl _ignorebi
+       .long   1
+       .text
+#endif VAX8200
+
+SCBVEC(sbisilo):
+#if VAX8200
+       cmpl    _cpu,$VAX_8200
+       bneq    sbisilo
+#if 0
+       blbs    _ignorebi,1f
+#else
+       blbs    _cold,1f
+#endif
+       PUSHR; pushl $0; calls $1,_bi_buserr; POPR
+1:
+       rei
+#endif
+sbisilo:
+       PANIC("sbi silo compare error")
+
+/*
+ * SCB stray interrupt catcher.  Compute and print the actual
+ * SCB vector (for fault diagnosis).
+ */
+       .align  2
+_scbstray: .globl _scbstray
+#define        PJ      PUSHR;jsb 1f
+       /* 128 of 'em */
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+#if VAX8600
+       /* and another 128, for the second SBIA's scb */
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+       PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ;PJ
+#endif
+#undef PJ
+1:
+       subl3   $_scbstray+8,(sp)+,r0
+       mfpr    $IPL,-(sp)
+       ashl    $-1,r0,-(sp)
+/* call a C handler instead? perhaps later */
+       PRINTF(2, "stray scb intr vec 0x%x ipl%x\n")
+       POPR
+       rei
 
 #if NMBA > 0
 SCBVEC(mba3int):
 
 #if NMBA > 0
 SCBVEC(mba3int):
@@ -258,15 +374,15 @@ SCBVEC(netintr):
        incl    _cnt+V_SOFT
        rei
 
        incl    _cnt+V_SOFT
        rei
 
-#if defined(VAX750) || defined(VAX730) || defined(VAX8600)
 SCBVEC(consdin):
        PUSHR;
 SCBVEC(consdin):
        PUSHR;
-       incl _intrcnt+I_TUR
-       casel   _cpu,$VAX_750,$VAX_8600
+       incl    _intrcnt+I_TUR
+       casel   _cpu,$VAX_750,$VAX_8200
 0:
        .word   5f-0b           # 2 is VAX_750
        .word   3f-0b           # 3 is VAX_730
        .word   6f-0b           # 4 is VAX_8600
 0:
        .word   5f-0b           # 2 is VAX_750
        .word   3f-0b           # 3 is VAX_730
        .word   6f-0b           # 4 is VAX_8600
+       .word   7f-0b           # 5 is VAX_8200
        halt
 5:
 #if defined(VAX750) && !defined(MRSP)
        halt
 5:
 #if defined(VAX750) && !defined(MRSP)
@@ -274,25 +390,28 @@ SCBVEC(consdin):
 #endif
 3:
 #if defined(VAX750) || defined(VAX730)
 #endif
 3:
 #if defined(VAX750) || defined(VAX730)
-       calls $0,_turintr
-       brb 2f
+       calls   $0,_turintr
+       brb     2f
+#else
+       halt
+#endif
+7:
+#if VAX8200
+       calls   $0,_rx50intr
+       brb     2f
 #else
        halt
 #endif
 6:
 #if VAX8600
 #else
        halt
 #endif
 6:
 #if VAX8600
-       calls $0, _crlintr
+       calls   $0,_crlintr
 #else
        halt
 #endif
 2:
 #else
        halt
 #endif
 2:
-       POPR;
-       incl _cnt+V_INTR;
+       POPR
+       incl    _cnt+V_INTR
        rei
        rei
-#else
-SCBVEC(consdin):
-       halt
-#endif
 
 #if defined(VAX750) || defined(VAX730)
 SCBVEC(consdout):
 
 #if defined(VAX750) || defined(VAX730)
 SCBVEC(consdout):
@@ -512,6 +631,12 @@ tudma:
        rsb
 #endif
 
        rsb
 #endif
 
+/*
+ * BI passive release things.
+ */
+SCBVEC(passiverel):
+       rei                             # well that was useless
+
 /*
  * Stray UNIBUS interrupt catch routines
  */
 /*
  * Stray UNIBUS interrupt catch routines
  */
@@ -601,7 +726,7 @@ SCBVEC(bptflt):
 SCBVEC(compatflt):
        TRAP(COMPATFLT);
 SCBVEC(kdbintr):
 SCBVEC(compatflt):
        TRAP(COMPATFLT);
 SCBVEC(kdbintr):
-       pushl $0; TRAP(KDBTRAP);
+       pushl $0; TRAP(KDBTRAP)
 SCBVEC(tracep):
        pushl $0; TRAP(TRCTRAP)
 SCBVEC(arithtrap):
 SCBVEC(tracep):
        pushl $0; TRAP(TRCTRAP)
 SCBVEC(arithtrap):
@@ -726,20 +851,33 @@ _/**/mname:       .globl  _/**/mname;             \
 
        SYSMAP(UMBAbeg  ,umbabeg        ,0              )
        SYSMAP(Nexmap   ,nexus          ,16*MAXNNEXUS   )
 
        SYSMAP(UMBAbeg  ,umbabeg        ,0              )
        SYSMAP(Nexmap   ,nexus          ,16*MAXNNEXUS   )
-       SYSMAP(UMEMmap  ,umem           ,(UBAPAGES+UBAIOPAGES)*NUBA     )
+       SYSMAP(UMEMmap  ,umem           ,(UBAPAGES+UBAIOPAGES)*NUBA )
 #if VAX8600
        SYSMAP(Ioamap   ,ioa            ,MAXNIOA*IOAMAPSIZ/NBPG )
 #endif
 #if VAX8600
        SYSMAP(Ioamap   ,ioa            ,MAXNIOA*IOAMAPSIZ/NBPG )
 #endif
+#if VAX8200 || VAX630
+       SYSMAP(Clockmap ,ka630clock     ,1              )
+#endif
+#if VAX8200
+       /* alas, the clocks on the 8200 and 630 are not quite identical */
+       /* they could be shared for now, but this seemed cleaner */
+       .globl _ka820clock; .set _ka820clock,_ka630clock
+       SYSMAP(Ka820map ,ka820port      ,1              )
+       SYSMAP(RX50map  ,rx50device     ,1              )
+#ifdef notyet
+       SYSMAP(BRAMmap  ,ka820bootram   ,KA820_BRPAGES  )
+       SYSMAP(EEPROMmap,ka820eeprom    ,KA820_EEPAGES  )
+#endif
+#endif
 #if VAX630
 #if VAX630
-       SYSMAP(Clockmap ,cldevice       ,1              )
        SYSMAP(Ka630map ,ka630cpu       ,1              )
        SYSMAP(Ka630map ,ka630cpu       ,1              )
-       /* 
-        * qvss and qdss can't coexist - one map will suffice 
+       /*
+        * qvss and qdss can't coexist - one map will suffice
         * for either. qvss is 256K each and qdss is 64K each.
         */
 #include "qv.h"
 #include "qd.h"
         * for either. qvss is 256K each and qdss is 64K each.
         */
 #include "qv.h"
 #include "qd.h"
-#if NQV > 0 || NQD > 0 
+#if NQV > 0 || NQD > 0
        SYSMAP(QVmap    ,qvmem          ,((512*NQV)+(128*NQD)))
 #endif /* NQV || NQD */
 #endif /* VAX630 */
        SYSMAP(QVmap    ,qvmem          ,((512*NQV)+(128*NQD)))
 #endif /* NQV || NQD */
 #endif /* VAX630 */
@@ -801,7 +939,7 @@ start:
 /* clear memory from kernel bss and pages for proc 0 u. and page table */
        movab   _edata,r6; bicl2 $SYSTEM,r6
        movab   _end,r5; bicl2 $SYSTEM,r5
 /* clear memory from kernel bss and pages for proc 0 u. and page table */
        movab   _edata,r6; bicl2 $SYSTEM,r6
        movab   _end,r5; bicl2 $SYSTEM,r5
-#ifdef KDB
+#ifdef KADB
        subl2   $4,r5
 1:     clrl    (r6); acbl r5,$4,r6,1b          # clear just bss
        addl2   $4,r5
        subl2   $4,r5
 1:     clrl    (r6); acbl r5,$4,r6,1b          # clear just bss
        addl2   $4,r5
@@ -823,7 +961,10 @@ start:
        clrl    r2
        movab   eintstack,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 1:     bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
        clrl    r2
        movab   eintstack,r1; bbcc $31,r1,0f; 0: ashl $-PGSHIFT,r1,r1
 1:     bisl3   $PG_V|PG_KW,r2,_Sysmap[r2]; aoblss r1,r2,1b
-/* make rpb, scb read-only as red zone for interrupt stack */
+/*
+ * make rpb read-only as red zone for interrupt stack
+ * (scb(s) and UNIvec are write-protected later)
+ */
        bicl2   $PG_PROT,_rpbmap
        bisl2   $PG_KR,_rpbmap
 /* make kernel text space read-only */
        bicl2   $PG_PROT,_rpbmap
        bisl2   $PG_KR,_rpbmap
 /* make kernel text space read-only */
@@ -839,8 +980,7 @@ start:
        movl    _maxmem,_physmem
        movl    _maxmem,_freemem
 /* setup context for proc[0] == Scheduler */
        movl    _maxmem,_physmem
        movl    _maxmem,_freemem
 /* setup context for proc[0] == Scheduler */
-       bicl3   $SYSTEM,r9,r6
-       bicl2   $NBPG-1,r6              # make page boundary
+       bicl3   $SYSTEM|(NBPG-1),r9,r6  # make phys, page boundary
 /* setup page table for proc[0] */
        ashl    $-PGSHIFT,r6,r3                 # r3 = btoc(r6)
        bisl3   $PG_V|PG_KW,r3,_Usrptmap        # init first upt entry
 /* setup page table for proc[0] */
        ashl    $-PGSHIFT,r6,r3                 # r3 = btoc(r6)
        bisl3   $PG_V|PG_KW,r3,_Usrptmap        # init first upt entry
@@ -1310,7 +1450,7 @@ ENTRY(savectx, 0)
        clrl    r0
        ret
 
        clrl    r0
        ret
 
-#ifdef KDB
+#ifdef KADB
 /*
  * C library -- reset, setexit
  *
 /*
  * C library -- reset, setexit
  *
@@ -1323,7 +1463,7 @@ ENTRY(savectx, 0)
  * The returned value is x; on the original
  * call the returned value is 0.
  */
  * The returned value is x; on the original
  * call the returned value is 0.
  */
-ENTRY(setexit)
+ENTRY(setexit, 0)
        movab   setsav,r0
        movq    r6,(r0)+
        movq    r8,(r0)+
        movab   setsav,r0
        movq    r6,(r0)+
        movq    r8,(r0)+
@@ -1334,7 +1474,7 @@ ENTRY(setexit)
        clrl    r0
        ret
 
        clrl    r0
        ret
 
-ENTRY(reset)
+ENTRY(reset, 0)
        movl    4(ap),r0        # returned value
        movab   setsav,r1
        movq    (r1)+,r6
        movl    4(ap),r0        # returned value
        movab   setsav,r1
        movq    (r1)+,r6
index f2a53e9..c8ff68c 100644 (file)
@@ -1,20 +1,17 @@
 /*
 /*
- * Copyright (c) 1982 Regents of the University of California.
+ * Copyright (c) 1982,1986,1988 Regents of the University of California.
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)machdep.c   7.11 (Berkeley) %G%
+ *     @(#)machdep.c   7.12 (Berkeley) %G%
  */
 
  */
 
-#include "reg.h"
-#include "pte.h"
-#include "psl.h"
-
 #include "param.h"
 #include "systm.h"
 #include "dir.h"
 #include "user.h"
 #include "kernel.h"
 #include "param.h"
 #include "systm.h"
 #include "dir.h"
 #include "user.h"
 #include "kernel.h"
+#include "malloc.h"
 #include "map.h"
 #include "vm.h"
 #include "proc.h"
 #include "map.h"
 #include "vm.h"
 #include "proc.h"
 #include "mbuf.h"
 #include "msgbuf.h"
 #include "quota.h"
 #include "mbuf.h"
 #include "msgbuf.h"
 #include "quota.h"
-#include "malloc.h"
 
 
+#include "reg.h"
+#include "pte.h"
+#include "psl.h"
 #include "frame.h"
 #include "clock.h"
 #include "cons.h"
 #include "frame.h"
 #include "clock.h"
 #include "cons.h"
@@ -40,6 +39,7 @@
 #include "mtpr.h"
 #include "rpb.h"
 #include "ka630.h"
 #include "mtpr.h"
 #include "rpb.h"
 #include "ka630.h"
+
 #include "../vaxuba/ubavar.h"
 #include "../vaxuba/ubareg.h"
 
 #include "../vaxuba/ubavar.h"
 #include "../vaxuba/ubareg.h"
 
@@ -68,7 +68,7 @@ startup(firstaddr)
        register int unixsize;
        register unsigned i;
        register struct pte *pte;
        register int unixsize;
        register unsigned i;
        register struct pte *pte;
-       int mapaddr, j;
+       int mapaddr, j, n;
        register caddr_t v;
        int maxbufs, base, residual;
 
        register caddr_t v;
        int maxbufs, base, residual;
 
@@ -127,7 +127,7 @@ startup(firstaddr)
         * An index into the kernel page table corresponding to the
         * virtual memory address maintained in "v" is kept in "mapaddr".
         */
         * An index into the kernel page table corresponding to the
         * virtual memory address maintained in "v" is kept in "mapaddr".
         */
-       v = (caddr_t)(0x80000000 | (firstaddr * NBPG));
+       v = (caddr_t)(KERNBASE | (firstaddr * NBPG));
 #define        valloc(name, type, num) \
            (name) = (type *)v; v = (caddr_t)((name)+(num))
 #define        valloclim(name, type, num, lim) \
 #define        valloc(name, type, num) \
            (name) = (type *)v; v = (caddr_t)((name)+(num))
 #define        valloclim(name, type, num, lim) \
@@ -177,10 +177,10 @@ startup(firstaddr)
         * Now the amount of virtual memory remaining for buffers
         * can be calculated, estimating needs for the cmap.
         */
         * Now the amount of virtual memory remaining for buffers
         * can be calculated, estimating needs for the cmap.
         */
-       ncmap = (maxmem*NBPG - ((int)v &~ 0x80000000)) /
+       ncmap = (maxmem*NBPG - ((int)v &~ KERNBASE)) /
                (CLBYTES + sizeof(struct cmap)) + 2;
        maxbufs = ((SYSPTSIZE * NBPG) -
                (CLBYTES + sizeof(struct cmap)) + 2;
        maxbufs = ((SYSPTSIZE * NBPG) -
-           ((int)(v + ncmap * sizeof(struct cmap)) - 0x80000000)) /
+           ((int)(v + ncmap * sizeof(struct cmap)) - KERNBASE)) /
                (MAXBSIZE + sizeof(struct buf));
        if (maxbufs < 16)
                panic("sys pt too small");
                (MAXBSIZE + sizeof(struct buf));
        if (maxbufs < 16)
                panic("sys pt too small");
@@ -201,7 +201,7 @@ startup(firstaddr)
         * and buffer headers not yet allocated.
         * Add 2: 1 because the 0th entry is unused, 1 for rounding.
         */
         * and buffer headers not yet allocated.
         * Add 2: 1 because the 0th entry is unused, 1 for rounding.
         */
-       ncmap = (maxmem*NBPG - ((int)(v + bufpages*CLBYTES) &~ 0x80000000)) /
+       ncmap = (maxmem*NBPG - ((int)(v + bufpages*CLBYTES) &~ KERNBASE)) /
                (CLBYTES + sizeof(struct cmap)) + 2;
        valloclim(cmap, struct cmap, ncmap, ecmap);
 
                (CLBYTES + sizeof(struct cmap)) + 2;
        valloclim(cmap, struct cmap, ncmap, ecmap);
 
@@ -209,7 +209,7 @@ startup(firstaddr)
         * Clear space allocated thus far, and make r/w entries
         * for the space in the kernel map.
         */
         * Clear space allocated thus far, and make r/w entries
         * for the space in the kernel map.
         */
-       unixsize = btoc((int)v &~ 0x80000000);
+       unixsize = btoc((int)v &~ KERNBASE);
        while (firstaddr < unixsize) {
                *(int *)(&Sysmap[firstaddr]) = PG_V | PG_KW | firstaddr;
                clearseg((unsigned)firstaddr);
        while (firstaddr < unixsize) {
                *(int *)(&Sysmap[firstaddr]) = PG_V | PG_KW | firstaddr;
                clearseg((unsigned)firstaddr);
@@ -225,16 +225,9 @@ startup(firstaddr)
        base = bufpages / nbuf;
        residual = bufpages % nbuf;
        mapaddr = firstaddr;
        base = bufpages / nbuf;
        residual = bufpages % nbuf;
        mapaddr = firstaddr;
-       for (i = 0; i < residual; i++) {
-               for (j = 0; j < (base + 1) * CLSIZE; j++) {
-                       *(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
-                       clearseg((unsigned)firstaddr);
-                       firstaddr++;
-               }
-               mapaddr += MAXBSIZE / NBPG;
-       }
-       for (i = residual; i < nbuf; i++) {
-               for (j = 0; j < base * CLSIZE; j++) {
+       for (i = 0; i < nbuf; i++) {
+               n = (i < residual ? base + 1 : base) * CLSIZE;
+               for (j = 0; j < n; j++) {
                        *(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
                        clearseg((unsigned)firstaddr);
                        firstaddr++;
                        *(int *)(&Sysmap[mapaddr+j]) = PG_V | PG_KW | firstaddr;
                        clearseg((unsigned)firstaddr);
                        firstaddr++;
@@ -242,7 +235,7 @@ startup(firstaddr)
                mapaddr += MAXBSIZE / NBPG;
        }
 
                mapaddr += MAXBSIZE / NBPG;
        }
 
-       unixsize = btoc((int)v &~ 0x80000000);
+       unixsize = btoc((int)v &~ KERNBASE);
        if (firstaddr >= physmem - 8*UPAGES)
                panic("no memory");
        mtpr(TBIA, 0);                  /* After we just cleared it all! */
        if (firstaddr >= physmem - 8*UPAGES)
                panic("no memory");
        mtpr(TBIA, 0);                  /* After we just cleared it all! */
@@ -519,7 +512,7 @@ dorti()
 #endif
 
 /*
 #endif
 
 /*
- * Memenable enables the memory controlle corrected data reporting.
+ * Memenable enables memory controller corrected data reporting.
  * This runs at regular intervals, turning on the interrupt.
  * The interrupt is turned off, per memory controller, when error
  * reporting occurs.  Thus we report at most once per memintvl.
  * This runs at regular intervals, turning on the interrupt.
  * The interrupt is turned off, per memory controller, when error
  * reporting occurs.  Thus we report at most once per memintvl.
@@ -528,44 +521,8 @@ int        memintvl = MEMINTVL;
 
 memenable()
 {
 
 memenable()
 {
-       register struct mcr *mcr;
-       register int m;
 
 
-#if VAX630
-       if (cpu == VAX_630)
-               return;
-#endif
-#ifdef VAX8600
-       if (cpu == VAX_8600) {
-               M8600_ENA;
-       } else
-#endif
-       for (m = 0; m < nmcr; m++) {
-               mcr = mcraddr[m];
-               switch (mcrtype[m]) {
-#if VAX780
-               case M780C:
-                       M780C_ENA(mcr);
-                       break;
-               case M780EL:
-                       M780EL_ENA(mcr);
-                       break;
-               case M780EU:
-                       M780EU_ENA(mcr);
-                       break;
-#endif
-#if VAX750
-               case M750:
-                       M750_ENA(mcr);
-                       break;
-#endif
-#if VAX730
-               case M730:
-                       M730_ENA(mcr);
-                       break;
-#endif
-               }
-       }
+       (*cpuops->cpu_memenable)();
        if (memintvl > 0)
                timeout(memenable, (caddr_t)0, memintvl*hz);
 }
        if (memintvl > 0)
                timeout(memenable, (caddr_t)0, memintvl*hz);
 }
@@ -578,179 +535,9 @@ memenable()
  */
 memerr()
 {
  */
 memerr()
 {
-#ifdef VAX8600
-       register int reg11;     /* known to be r11 below */
-#endif
-       register struct mcr *mcr;
-       register int m;
-
-#if VAX630
-       if (cpu == VAX_630)
-               return;
-#endif
-#ifdef VAX8600
-       if (cpu == VAX_8600) {
-               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 in mem.h and mtpr.h.
-                */
-#ifdef lint
-               reg11 = 0;
-#else
-               asm("mtpr $0x27,$0x4e; mfpr $0x4f,r11");
-#endif
-               mdecc = reg11;  /* must acknowledge interrupt? */
-               if (M8600_MEMERR(mdecc)) {
-                       asm("mtpr $0x2a,$0x4e; mfpr $0x4f,r11");
-                       mear = reg11;
-                       asm("mtpr $0x25,$0x4e; mfpr $0x4f,r11");
-                       mstat1 = reg11;
-                       asm("mtpr $0x26,$0x4e; mfpr $0x4f,r11");
-                       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);
-                       M8600_INH;
-               }
-       } else
-#endif
-       for (m = 0; m < nmcr; m++) {
-               mcr = mcraddr[m];
-               switch (mcrtype[m]) {
-#if VAX780
-               case M780C:
-                       if (M780C_ERR(mcr)) {
-                               printf("mcr%d: soft ecc addr %x syn %x\n",
-                                   m, M780C_ADDR(mcr), M780C_SYN(mcr));
-#ifdef TRENDATA
-                               memlog(m, mcr);
-#endif
-                               M780C_INH(mcr);
-                       }
-                       break;
-
-               case M780EL:
-                       if (M780EL_ERR(mcr)) {
-                               printf("mcr%d: soft ecc addr %x syn %x\n",
-                                   m, M780EL_ADDR(mcr), M780EL_SYN(mcr));
-                               M780EL_INH(mcr);
-                       }
-                       break;
-
-               case M780EU:
-                       if (M780EU_ERR(mcr)) {
-                               printf("mcr%d: soft ecc addr %x syn %x\n",
-                                   m, M780EU_ADDR(mcr), M780EU_SYN(mcr));
-                               M780EU_INH(mcr);
-                       }
-                       break;
-#endif
-#if VAX750
-               case M750:
-                       if (M750_ERR(mcr)) {
-                               struct mcr amcr;
-                               amcr.mc_reg[0] = mcr->mc_reg[0];
-                               printf("mcr%d: %s",
-                                   m, (amcr.mc_reg[0] & M750_UNCORR) ?
-                                   "hard error" : "soft ecc");
-                               printf(" addr %x syn %x\n",
-                                   M750_ADDR(&amcr), M750_SYN(&amcr));
-                               M750_INH(mcr);
-                       }
-                       break;
-#endif
-#if VAX730
-               case M730: {
-                       struct mcr amcr;
-
-                       /*
-                        * Must be careful on the 730 not to use invalid
-                        * instructions in I/O space, so make a copy;
-                        */
-                       amcr.mc_reg[0] = mcr->mc_reg[0];
-                       amcr.mc_reg[1] = mcr->mc_reg[1];
-                       if (M730_ERR(&amcr)) {
-                               printf("mcr%d: %s",
-                                   m, (amcr.mc_reg[1] & M730_UNCORR) ?
-                                   "hard error" : "soft ecc");
-                               printf(" addr %x syn %x\n",
-                                   M730_ADDR(&amcr), M730_SYN(&amcr));
-                               M730_INH(mcr);
-                       }
-                       break;
-               }
-#endif
-               }
-       }
-}
-
-#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 mcr *mcr;
-{
-       register i;
-
-       switch (mcrtype[m]) {
-
-#if VAX780
-       case M780C:
-       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
-       }
+       (*cpuops->cpu_memerr)();
 }
 }
-#endif
 
 /*
  * Invalidate single all pte's in a cluster
 
 /*
  * Invalidate single all pte's in a cluster
@@ -775,14 +562,12 @@ tbiscl(v)
   
 int    waittime = -1;
 
   
 int    waittime = -1;
 
-boot(arghowto)
-       int arghowto;
-{
+boot(howto)
        register int howto;             /* r11 == how to boot */
        register int howto;             /* r11 == how to boot */
+{
        register int devtype;           /* r10 == major of root dev */
        extern char *panicstr;
 
        register int devtype;           /* r10 == major of root dev */
        extern char *panicstr;
 
-       howto = arghowto;
        if ((howto&RB_NOSYNC)==0 && waittime < 0 && bfreelist[0].b_forw) {
                register struct buf *bp;
                int iter, nbusy;
        if ((howto&RB_NOSYNC)==0 && waittime < 0 && bfreelist[0].b_forw) {
                register struct buf *bp;
                int iter, nbusy;
@@ -820,39 +605,68 @@ boot(arghowto)
        splx(0x1f);                     /* extreme priority */
        devtype = major(rootdev);
        if (howto&RB_HALT) {
        splx(0x1f);                     /* extreme priority */
        devtype = major(rootdev);
        if (howto&RB_HALT) {
+               /* 630 can be told to halt, but how? */
                printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
                printf("halting (in tight loop); hit\n\t^P\n\tHALT\n\n");
-               mtpr(IPL, 0x1f);
                for (;;)
                        ;
        } else {
                for (;;)
                        ;
        } else {
-               if (howto & RB_DUMP) {
-                       doadump();              /* TXDB_BOOT's itself */
-                       /*NOTREACHED*/
-               }
-               tocons(TXDB_BOOT);
+               if (howto & RB_DUMP)
+                       doadump();
+               vaxboot();
        }
        }
-#if defined(VAX750) || defined(VAX730) || defined(VAX630)
-       if (cpu == VAX_750 || cpu == VAX_730 || cpu == VAX_630)
-               { asm("movl r11,r5"); }         /* boot flags go in r5 */
-#endif
-       for (;;)
-               asm("halt");
 #ifdef lint
 #ifdef lint
-       printf("howto %d, devtype %d\n", arghowto, devtype);
+       devtype = devtype;
 #endif
        /*NOTREACHED*/
 }
 
 #endif
        /*NOTREACHED*/
 }
 
+/*
+ * Reboot after panic or via reboot system call.  Note that r11
+ * and r10 must already have the proper boot values (`call by voodoo').
+ */
+vaxboot()
+{
+
+       switch (cpu) {
+
+#ifdef VAX8200
+       case VAX_8200:
+               /*
+                * TXDB_BOOT erases memory!  Instead we set the `did
+                * a dump' flag in the rpb.
+                */
+               *(int *)&Sysmap[0] &= ~PG_PROT;
+               *(int *)&Sysmap[0] |= PG_KW;
+               mtpr(TBIS, &rpb);
+               rpb.rp_flag = 1;
+               break;
+#endif
+
+       default:
+               tocons(TXDB_BOOT);
+       }
+
+       /*
+        * Except on 780s and 8600s, boot flags go in r5.  SBI
+        * VAXen do not care, so copy boot flags to r5 always.
+        */
+       asm("movl r11,r5");
+       for (;;) {
+               asm("halt");
+       }
+}
+
 tocons(c)
 {
 tocons(c)
 {
-       register oldmask;
+       register int oldmask;
 
        while (((oldmask = mfpr(TXCS)) & TXCS_RDY) == 0)
                continue;
 
        switch (cpu) {
 
 
        while (((oldmask = mfpr(TXCS)) & TXCS_RDY) == 0)
                continue;
 
        switch (cpu) {
 
-#if VAX780 || VAX750 || VAX730 || VAX630
+#if VAX8200 || VAX780 || VAX750 || VAX730 || VAX630
+       case VAX_8200:
        case VAX_780:
        case VAX_750:
        case VAX_730:
        case VAX_780:
        case VAX_750:
        case VAX_730:
@@ -882,6 +696,9 @@ tocons(c)
                break;
        }
 #endif
                break;
        }
 #endif
+#ifdef lint
+       oldmask = oldmask;
+#endif
 }
 
 int    dumpmag = 0x8fca0101;   /* magic number for savecore */
 }
 
 int    dumpmag = 0x8fca0101;   /* magic number for savecore */
@@ -935,263 +752,29 @@ dumpsys()
 
 /*
  * Machine check error recovery code.
 
 /*
  * Machine check error recovery code.
- * Print out the machine check frame and then give up.
  */
  */
-#if VAX8600
-#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
-#endif
+machinecheck(cmcf)
+       caddr_t cmcf;
+{
+
+       if ((*cpuops->cpu_mchk)(cmcf) == MCHK_RECOVERED)
+               return;
+       (*cpuops->cpu_memerr)();
+       panic("mchk");
+}
 
 #if defined(VAX780) || defined(VAX750)
 
 #if defined(VAX780) || defined(VAX750)
-char *mc780[] = {
+/*
+ * These strings are shared between the 780 and 750 machine check code
+ * in ka780.c and ka730.c.
+ */
+char *mc780750[16] = {
        "cp read",      "ctrl str par", "cp tbuf par",  "cp cache par",
        "cp rdtimo",    "cp rds",       "ucode lost",   0,
        0,              0,              "ib tbuf par",  0,
        "ib rds",       "ib rd timo",   0,              "ib cache par"
 };
        "cp read",      "ctrl str par", "cp tbuf par",  "cp cache par",
        "cp rdtimo",    "cp rds",       "ucode lost",   0,
        0,              0,              "ib tbuf par",  0,
        "ib rds",       "ib rd timo",   0,              "ib cache par"
 };
-#define MC750_TBERR    2               /* type code of cp tbuf par */
-#define        MC750_TBPAR     4               /* tbuf par bit in mcesr */
-#endif
-
-#if VAX730
-#define        NMC730  12
-char *mc730[] = {
-       "tb par",       "bad retry",    "bad intr id",  "cant write ptem",
-       "unkn mcr err", "iib rd err",   "nxm ref",      "cp rds",
-       "unalgn ioref", "nonlw ioref",  "bad ioaddr",   "unalgn ubaddr",
-};
-#endif
-#if VAX630
-#define NMC630 10
-extern struct ka630cpu ka630cpu;
-char *mc630[] = {
-       0,              "immcr (fsd)",  "immcr (ssd)",  "fpu err 0",
-       "fpu err 7",    "mmu st(tb)",   "mmu st(m=0)",  "pte in p0",
-       "pte in p1",    "un intr id",
-};
-#endif
-
-/*
- * Frame for each cpu
- */
-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 */
-};
-struct mc750frame {
-       int     mc5_bcnt;               /* byte count == 0x28 */
-       int     mc5_summary;            /* summary parameter (as above) */
-       int     mc5_va;                 /* virtual address register */
-       int     mc5_errpc;              /* error pc */
-       int     mc5_mdr;
-       int     mc5_svmode;             /* saved mode register */
-       int     mc5_rdtimo;             /* read lock timeout */
-       int     mc5_tbgpar;             /* tb group parity error register */
-       int     mc5_cacherr;            /* cache error register */
-       int     mc5_buserr;             /* bus error register */
-       int     mc5_mcesr;              /* machine check status register */
-       int     mc5_pc;                 /* trapped pc */
-       int     mc5_psl;                /* trapped psl */
-};
-struct mc730frame {
-       int     mc3_bcnt;               /* byte count == 0xc */
-       int     mc3_summary;            /* summary parameter */
-       int     mc3_parm[2];            /* parameter 1 and 2 */
-       int     mc3_pc;                 /* trapped pc */
-       int     mc3_psl;                /* trapped psl */
-};
-struct mc630frame {
-       int     mc63_bcnt;              /* byte count == 0xc */
-       int     mc63_summary;           /* summary parameter */
-       int     mc63_mrvaddr;           /* most recent vad */
-       int     mc63_istate;            /* internal state */
-       int     mc63_pc;                        /* trapped pc */
-       int     mc63_psl;               /* trapped psl */
-};
-struct mc8600frame {
-       int     mc6_bcnt;               /* byte count == 0x58 */
-       int     mc6_ehmsts;
-       int     mc6_evmqsav;
-       int     mc6_ebcs;
-       int     mc6_edpsr;
-       int     mc6_cslint;
-       int     mc6_ibesr;
-       int     mc6_ebxwd1;
-       int     mc6_ebxwd2;
-       int     mc6_ivasav;
-       int     mc6_vibasav;
-       int     mc6_esasav;
-       int     mc6_isasav;
-       int     mc6_cpc;
-       int     mc6_mstat1;
-       int     mc6_mstat2;
-       int     mc6_mdecc;
-       int     mc6_merg;
-       int     mc6_cshctl;
-       int     mc6_mear;
-       int     mc6_medr;
-       int     mc6_accs;
-       int     mc6_cses;
-       int     mc6_pc;                 /* trapped pc */
-       int     mc6_psl;                /* trapped psl */
-};
-
-machinecheck(cmcf)
-       caddr_t cmcf;
-{
-       register u_int type = ((struct mc780frame *)cmcf)->mc8_summary;
-
-       printf("machine check %x: ", type);
-       switch (cpu) {
-#if VAX8600
-       case VAX_8600: {
-               register struct mc8600frame *mcf = (struct mc8600frame *)cmcf;
-
-               if (mcf->mc6_ebcs & MBOX_FE)
-                       mcf->mc6_ehmsts |= MC_MBOX;
-               else if (mcf->mc6_ehmsts & FBOX_SERV)
-                       mcf->mc6_ehmsts |= MC_FBOX;
-               else if (mcf->mc6_ebcs & EBOX_ERR) {
-                       if (mcf->mc6_ebcs & EDP_PE)
-                               mcf->mc6_ehmsts |= MC_MBOX;
-                       else
-                               mcf->mc6_ehmsts |= MC_EBOX;
-               } else if (mcf->mc6_ehmsts & IBOX_ERR)
-                       mcf->mc6_ehmsts |= MC_IBOX;
-               else if (mcf->mc6_mstat1 & M8600_TB_ERR)
-                       mcf->mc6_ehmsts |= MC_TBUF;
-               else if ((mcf->mc6_cslint & MBOX_1D) == MBOX_1D)
-                       mcf->mc6_ehmsts |= MC_MBOX1D;
-
-               type = mcf->mc6_ehmsts & 0x7;
-               if (type < NMC8600)
-                       printf("machine check %x: %s", type, mc8600[type]);
-               printf("\n");
-               printf("\tehm.sts %x evmqsav %x ebcs %x edpsr %x cslint %x\n",
-                   mcf->mc6_ehmsts, mcf->mc6_evmqsav, mcf->mc6_ebcs,
-                   mcf->mc6_edpsr, mcf->mc6_cslint);
-               printf("\tibesr %x ebxwd %x %x ivasav %x vibasav %x\n",
-                   mcf->mc6_ibesr, mcf->mc6_ebxwd1, mcf->mc6_ebxwd2,
-                   mcf->mc6_ivasav, mcf->mc6_vibasav);
-               printf("\tesasav %x isasav %x cpc %x mstat %x %x mdecc %x\n",
-                   mcf->mc6_esasav, mcf->mc6_isasav, mcf->mc6_cpc,
-                   mcf->mc6_mstat1, mcf->mc6_mstat2, mcf->mc6_mdecc);
-               printf("\tmerg %x cshctl %x mear %x medr %x accs %x cses %x\n",
-                   mcf->mc6_merg, mcf->mc6_cshctl, mcf->mc6_mear,
-                   mcf->mc6_medr, mcf->mc6_accs, mcf->mc6_cses);
-               printf("\tpc %x psl %x\n", mcf->mc6_pc, mcf->mc6_psl);
-               mtpr(EHSR, 0);
-               break;
-       };
-#endif
-#if VAX780
-       case VAX_780: {
-               register struct mc780frame *mcf = (struct mc780frame *)cmcf;
-
-               register int sbifs;
-               printf("%s%s\n", 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(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, sbifs &~ 0x2000000);
-               mtpr(SBIER, mfpr(SBIER) | 0x70c0);
-               break;
-       }
-#endif
-#if VAX750
-       case VAX_750: {
-               register struct mc750frame *mcf = (struct mc750frame *)cmcf;
-
-               int mcsr = mfpr(MCSR);
-               printf("%s%s\n", mc780[type&0xf],
-                   (type&0xf0) ? " abort" : " fault"); 
-               mtpr(TBIA, 0);
-               mtpr(MCESR, 0xf);
-               printf("\tva %x errpc %x mdr %x smr %x rdtimo %x tbgpar %x cacherr %x\n",
-                   mcf->mc5_va, mcf->mc5_errpc, mcf->mc5_mdr, mcf->mc5_svmode,
-                   mcf->mc5_rdtimo, mcf->mc5_tbgpar, mcf->mc5_cacherr);
-               printf("\tbuserr %x mcesr %x pc %x psl %x mcsr %x\n",
-                   mcf->mc5_buserr, mcf->mc5_mcesr, mcf->mc5_pc, mcf->mc5_psl,
-                   mcsr);
-               if (type == MC750_TBERR && (mcf->mc5_mcesr&0xe) == MC750_TBPAR){
-                       printf("tbuf par: flushing and returning\n");
-                       return;
-               }
-               break;
-               }
-#endif
-#if VAX730
-       case VAX_730: {
-               register struct mc730frame *mcf = (struct mc730frame *)cmcf;
-
-               if (type < NMC730)
-                       printf("%s", mc730[type]);
-               printf("\n");
-               printf("params %x,%x pc %x psl %x mcesr %x\n",
-                   mcf->mc3_parm[0], mcf->mc3_parm[1],
-                   mcf->mc3_pc, mcf->mc3_psl, mfpr(MCESR));
-               mtpr(MCESR, 0xf);
-               break;
-               }
 #endif
 #endif
-#if VAX630
-       case VAX_630: {
-               register struct ka630cpu *ka630addr = &ka630cpu;
-               register struct mc630frame *mcf = (struct mc630frame *)cmcf;
-               printf("vap %x istate %x pc %x psl %x\n",
-                   mcf->mc63_mrvaddr, mcf->mc63_istate,
-                   mcf->mc63_pc, mcf->mc63_psl);
-               if (ka630addr->ka630_mser & KA630MSER_MERR) {
-                       printf("mser=0x%x ",ka630addr->ka630_mser);
-                       if (ka630addr->ka630_mser & KA630MSER_CPUER)
-                               printf("page=%d",ka630addr->ka630_cear);
-                       if (ka630addr->ka630_mser & KA630MSER_DQPE)
-                               printf("page=%d",ka630addr->ka630_dear);
-                       printf("\n");
-               }
-               break;
-               }
-#endif
-       }
-       memerr();
-       panic("mchk");
-}
 
 /*
  * Return the best possible estimate of the time in the timeval
 
 /*
  * Return the best possible estimate of the time in the timeval
@@ -1230,22 +813,6 @@ microtime(tvp)
        splx(s);
 }
 
        splx(s);
 }
 
-physstrat(bp, strat, prio)
-       struct buf *bp;
-       int (*strat)(), prio;
-{
-       int s;
-
-       (*strat)(bp);
-       /* pageout daemon doesn't wait for pushed pages */
-       if (bp->b_flags & B_DIRTY)
-               return;
-       s = splbio();
-       while ((bp->b_flags & B_DONE) == 0)
-               sleep((caddr_t)bp, prio);
-       splx(s);
-}
-
 initcpu()
 {
        /*
 initcpu()
 {
        /*
@@ -1253,6 +820,16 @@ initcpu()
         */
        switch (cpu) {
 
         */
        switch (cpu) {
 
+#if VAX8600
+       case VAX_8600:
+               mtpr(CSWP, 3);
+               break;
+#endif
+#if VAX8200
+       case VAX_8200:
+               mtpr(CADR, 0);
+               break;
+#endif
 #if VAX780
        case VAX_780:
                mtpr(SBIMT, 0x200000);
 #if VAX780
        case VAX_780:
                mtpr(SBIMT, 0x200000);
@@ -1262,11 +839,6 @@ initcpu()
        case VAX_750:
                mtpr(CADR, 0);
                break;
        case VAX_750:
                mtpr(CADR, 0);
                break;
-#endif
-#if VAX8600
-       case VAX_8600:
-               mtpr(CSWP, 3);
-               break;
 #endif
        default:
                break;
 #endif
        default:
                break;
@@ -1279,8 +851,8 @@ initcpu()
        switch(cpu) {
 
 #if VAX8600 || VAX780
        switch(cpu) {
 
 #if VAX8600 || VAX780
-       case VAX_780:
        case VAX_8600:
        case VAX_8600:
+       case VAX_780:
                if ((mfpr(ACCS) & 0xff) != 0) {
                        printf("Enabling FPA\n");
                        mtpr(ACCS, 0x8000);
                if ((mfpr(ACCS) & 0xff) != 0) {
                        printf("Enabling FPA\n");
                        mtpr(ACCS, 0x8000);
@@ -1292,17 +864,18 @@ initcpu()
 }
 
 /*
 }
 
 /*
- * Return a reasonable approximation to a time-of-day register.
+ * Return a reasonable approximation of the time of day register.
  * More precisely, return a number that increases by one about
  * once every ten milliseconds.
  */
 todr()
 {
  * More precisely, return a number that increases by one about
  * once every ten milliseconds.
  */
 todr()
 {
+
        switch (cpu) {
 
 #if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX730
        case VAX_8600:
        switch (cpu) {
 
 #if VAX8600 || VAX8200 || VAX780 || VAX750 || VAX730
        case VAX_8600:
-       /* case VAX_8200: */
+       case VAX_8200:
        case VAX_780:
        case VAX_750:
        case VAX_730:
        case VAX_780:
        case VAX_750:
        case VAX_730:
index bcbfeff..225b177 100644 (file)
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)mem.h       7.1 (Berkeley) %G%
+ *     @(#)mem.h       7.2 (Berkeley) %G%
  */
 
  */
 
-/*
- * Memory controller registers
- *
- * The way in which the data is stored in these registers varies
- * per controller and cpu, so we define macros here to mask that.
- */
-struct mcr {
-       int     mc_reg[6];
-};
-
 /*
  * Compute maximum possible number of memory controllers,
  * for sizing of the mcraddr array.
  */
 /*
  * Compute maximum possible number of memory controllers,
  * for sizing of the mcraddr array.
  */
-#if VAX780
+#if VAX8200 || VAX780
 #define        MAXNMCR         4
 #else
 #define        MAXNMCR         1
 #endif
 
 #define        MAXNMCR         4
 #else
 #define        MAXNMCR         1
 #endif
 
-/*
- * For each controller type we define 5 macros:
- *     M???_INH(mcr)           inhibits further crd interrupts from mcr
- *     M???_ENA(mcr)           enables another crd interrupt from mcr
- *     M???_ERR(mcr)           tells whether an error is waiting
- *     M???_SYN(mcr)           gives the syndrome bits of the error
- *     M???_ADDR(mcr)          gives the address of the error
- */
-
-#if VAX8600
-/*
- * 8600 register 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 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_ENA (mtpr(MERG, (mfpr(MERG) & ~M8600_ICRD)))
-#define M8600_INH (mtpr(EHSR, 0), mtpr(MERG, (mfpr(MERG) | M8600_ICRD)))
-#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"
-#endif VAX8600
-
 #if VAX780
 #if VAX780
-#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(SBIER, 0))
-#define        M780C_ENA(mcr)  \
-       (((mcr)->mc_reg[2] = (M780_HIER|M780_ERLOG)), mtpr(SBIER, 3<<14))
-#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(SBIER, 0))
-#define        M780EL_ENA(mcr) \
-       (((mcr)->mc_reg[2] = (M780_HIER|M780_ERLOG)), mtpr(SBIER, 3<<14))
-#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(SBIER, 0))
-#define        M780EU_ENA(mcr) \
-       (((mcr)->mc_reg[3] = (M780_HIER|M780_ERLOG)), mtpr(SBIER, 3<<14))
-#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)
-#endif
-
-#if VAX750
-#define        M750_ICRD       0x10000000      /* inhibit crd interrupts, in [1] */
-#define        M750_UNCORR     0xc0000000      /* uncorrectable error, in [0] */
-#define        M750_CORERR     0x20000000      /* correctable error, in [0] */
-
-#define        M750_INH(mcr)   ((mcr)->mc_reg[1] = 0)
-#define        M750_ENA(mcr)   ((mcr)->mc_reg[0] = (M750_UNCORR|M750_CORERR), \
-                           (mcr)->mc_reg[1] = M750_ICRD)
-#define        M750_ERR(mcr)   ((mcr)->mc_reg[0] & (M750_UNCORR|M750_CORERR))
-
-#define        M750_SYN(mcr)   ((mcr)->mc_reg[0] & 0x7f)
-#define        M750_ADDR(mcr)  (((mcr)->mc_reg[0] >> 9) & 0x7fff)
-#endif
-
-#if VAX730
-#define        M730_UNCORR     0x80000000      /* rds, uncorrectable error, in [1] */
-#define        M730_CRD        0x40000000      /* crd, in [1] */
-#define        M730_FTBPE      0x20000000      /* force tbuf parity error, in [1] */
-#define        M730_ENACRD     0x10000000      /* enable crd interrupt, in [1] */
-#define        M730_MME        0x08000000      /* mem-man enable (ala ipr), in [1] */
-#define        M730_DM         0x04000000      /* diagnostic mode, in [1] */
-#define        M730_DISECC     0x02000000      /* disable ecc, in [1] */
-
-#define        M730_INH(mcr)   ((mcr)->mc_reg[1] = M730_MME)
-#define        M730_ENA(mcr)   ((mcr)->mc_reg[1] = (M730_MME|M730_ENACRD))
-#define        M730_ERR(mcr)   ((mcr)->mc_reg[1] & (M730_UNCORR|M730_CRD))
-#define        M730_SYN(mcr)   ((mcr)->mc_reg[0] & 0x7f)
-#define        M730_ADDR(mcr)  (((mcr)->mc_reg[0] >> 8) & 0x7fff)
-#endif
-
 /* controller types */
 #define        M780C   1
 #define        M780EL  2
 #define        M780EU  3
 /* controller types */
 #define        M780C   1
 #define        M780EL  2
 #define        M780EU  3
-#define        M750    4
-#define        M730    5
+#endif
 
 #define        MEMINTVL        (60*10)         /* 10 minutes */
 
 #ifdef KERNEL
 int    nmcr;
 
 #define        MEMINTVL        (60*10)         /* 10 minutes */
 
 #ifdef KERNEL
 int    nmcr;
-struct mcr *mcraddr[MAXNMCR];
+caddr_t        mcraddr[MAXNMCR];
+#if VAX780
 int    mcrtype[MAXNMCR];
 #endif
 int    mcrtype[MAXNMCR];
 #endif
+#endif
index fad893d..0cab5fb 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)mscp.c      1.1 (Berkeley) %G%
+ *     @(#)mscp.c      1.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -90,30 +90,6 @@ again:
 #undef mri
 }
 
 #undef mri
 }
 
-/*
- * Decode and print an MSCP media ID.  It is made up of five 5-bit
- * `characters' and 7 bits of numeric information.  BITS(i)
- * selects character i's bits; CHAR returns the corresponding
- * character.
- */
-mscp_printmedia(id)
-       register u_long id;
-{
-       int c4, c3, c2, c1, c0;
-#define        BITS(i) ((id >> ((i) * 5 + 7)) & 0x1f)
-#define        CHAR(c) ((c) ? (c) + '@' : ' ')
-
-       c4 = BITS(4);
-       c3 = BITS(3);
-       c2 = BITS(2);
-       c1 = BITS(1);
-       c0 = BITS(0);
-       printf("%c%c %c%c%c%d", CHAR(c4), CHAR(c3), CHAR(c2),
-               CHAR(c1), CHAR(c0), id & 0x7f);
-#undef BITS
-#undef CHAR
-}
-
 #ifdef AVOID_EMULEX_BUG
 int    mscp_aeb_xor = 0x8000bb80;
 #endif
 #ifdef AVOID_EMULEX_BUG
 int    mscp_aeb_xor = 0x8000bb80;
 #endif
index 2af743d..bf7dd6b 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)scb.h       7.1 (Berkeley) %G%
+ *     @(#)scb.h       7.2 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -11,7 +11,7 @@
  */
 
 struct scb {
  */
 
 struct scb {
-       int     (*scb_stray)();         /* reserved */
+       int     (*scb_passiverel)();    /* BI passive release */
        int     (*scb_machchk)();       /* machine chack */
        int     (*scb_kspinval)();      /* KSP invalid */
        int     (*scb_powfail)();       /* power fail */
        int     (*scb_machchk)();       /* machine chack */
        int     (*scb_kspinval)();      /* KSP invalid */
        int     (*scb_powfail)();       /* power fail */
@@ -32,14 +32,23 @@ struct scb {
        int     (*scb_chms)();          /* CHMS instr */
        int     (*scb_chmu)();          /* CHMU instr */
        int     (*scb_sbisilo)();       /* SBI silo compare */
        int     (*scb_chms)();          /* CHMS instr */
        int     (*scb_chmu)();          /* CHMU instr */
        int     (*scb_sbisilo)();       /* SBI silo compare */
+#define        scb_bierr scb_sbisilo           /*=BI error (8200) */
        int     (*scb_cmrd)();          /* corrected mem read data */
        int     (*scb_sbialert)();      /* SBI alert */
        int     (*scb_cmrd)();          /* corrected mem read data */
        int     (*scb_sbialert)();      /* SBI alert */
-       int     (*scb_sbiflt)();        /* SBI fault */
+       int     (*scb_sbifault)();      /* SBI fault */
        int     (*scb_wtime)();         /* memory write timeout */
        int     (*scb_wtime)();         /* memory write timeout */
-       int     (*scb_stray4[8])();
+#define scb_sbierr scb_wtime           /*=SBI error (8600) */
+       int     (*scb_sbifail)();       /* SBI fail (8600) */
+       int     (*scb_stray4[7])();
        int     (*scb_soft[15])();      /* software interrupt */
        int     (*scb_timer)();         /* interval timer interrupt */
        int     (*scb_soft[15])();      /* software interrupt */
        int     (*scb_timer)();         /* interval timer interrupt */
-       int     (*scb_stray5[7])();
+       int     (*scb_stray5)();
+       int     (*scb_cn1rint)();       /* console terminal 1 rcv (8200) */
+       int     (*scb_cn1xint)();       /* console terminal 1 xmt (8200) */
+       int     (*scb_cn2rint)();       /* console 2 rcv (8200) */
+       int     (*scb_cn2xint)();       /* console 2 xmt (8200) */
+       int     (*scb_cn3rint)();       /* console 3 rcv (8200) */
+       int     (*scb_cn3xint)();       /* console 3 xmt (8200) */
        int     (*scb_stray6[4])();
        int     (*scb_csdr)();          /* console storage receive */
        int     (*scb_csdx)();          /* console storage transmit */
        int     (*scb_stray6[4])();
        int     (*scb_csdr)();          /* console storage receive */
        int     (*scb_csdx)();          /* console storage transmit */
@@ -49,13 +58,15 @@ struct scb {
        int     (*scb_ipl15[16])();     /*   "          "    IPL 15 */
        int     (*scb_ipl16[16])();     /*   "          "    IPL 16 */
        int     (*scb_ipl17[16])();     /*   "          "    IPL 17 */
        int     (*scb_ipl15[16])();     /*   "          "    IPL 15 */
        int     (*scb_ipl16[16])();     /*   "          "    IPL 16 */
        int     (*scb_ipl17[16])();     /*   "          "    IPL 17 */
-       int     (*scb_ubaint[128])();   /* Unibus device intr */
-       int     (*scb_uba1int[128])();  /* Unibus 1 device intr */
+       /*
+        * On the 8600, this is followed by a second copy of the SCB.
+        * On the 750, this is followed by 128 uba0 device interrupts,
+        * then 128 uba1 device interrupts.
+        */
 };
 
 #ifdef KERNEL
 };
 
 #ifdef KERNEL
-extern struct scb scb;
-/* scb.scb_ubaint is the same as UNIvec */
+extern struct scb scb[];
 #endif
 
 #define        scbentry(f, how)                ((int (*)())(((int)f)+how))
 #endif
 
 #define        scbentry(f, how)                ((int (*)())(((int)f)+how))
index 7dcecd7..be3e562 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)scb.s       7.2 (Berkeley) %G%
+ *     @(#)scb.s       7.3 (Berkeley) %G%
  */
 
 #include "uba.h"
  */
 
 #include "uba.h"
 
 _scb:  .globl  _scb
 
 
 _scb:  .globl  _scb
 
-#define        STRAY   .long   _Xstray+INTSTK
-#define        STRAY8  STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY
-#define        STRAY15 STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY;STRAY8
 #define        KS(a)   .long   _X/**/a
 #define        IS(a)   .long   _X/**/a+INTSTK
 #define        STOP(a) .long   _X/**/a+HALT
 
 #define        KS(a)   .long   _X/**/a
 #define        IS(a)   .long   _X/**/a+INTSTK
 #define        STOP(a) .long   _X/**/a+HALT
 
-/* 000 */      STRAY;          IS(machcheck);  IS(kspnotval);  STOP(powfail);
+#define        STRAY(x)        .long   _scbstray+2*(x)+INTSTK
+#define        STRAY3(n)       STRAY(n);STRAY(n+4);STRAY(n+8)
+#define        STRAY4(n)       STRAY3(n);STRAY(n+12)
+#define        STRAY15(n)      STRAY4(n);STRAY4(n+16);STRAY4(n+32);STRAY3(n+48)
+#define        STRAY16(n)      STRAY15(n);STRAY(n+60)
+#define        NEX0(n) IS(nex0zvec);STRAY15(n+4)
+#define        NEX1(n) IS(nex1zvec);STRAY15(n+4)
+
+/* 000 */      IS(passiverel); IS(machcheck);  IS(kspnotval);  STOP(powfail);
 /* 010 */      KS(privinflt);  KS(xfcflt);     KS(resopflt);   KS(resadflt);
 /* 020 */      KS(protflt);    KS(transflt);   KS(tracep);     KS(bptflt);
 /* 010 */      KS(privinflt);  KS(xfcflt);     KS(resopflt);   KS(resadflt);
 /* 020 */      KS(protflt);    KS(transflt);   KS(tracep);     KS(bptflt);
-/* 030 */      KS(compatflt);  KS(arithtrap);  STRAY;          STRAY;
+/* 030 */      KS(compatflt);  KS(arithtrap);  STRAY(0x38);    STRAY(0x3c);
 /* 040 */      KS(syscall);    KS(chme);       KS(chms);       KS(chmu);
 /* 040 */      KS(syscall);    KS(chme);       KS(chms);       KS(chmu);
-/* 050 */      STRAY;          IS(cmrd);       STRAY;          STRAY;
-/* 060 */      IS(wtime);      STRAY;          STRAY;          STRAY;
-/* 070 */      STRAY;          STRAY;          STRAY;          STRAY;
-/* 080 */      STRAY;          STRAY;          KS(astflt);     STRAY;
-/* 090 */      STRAY;          STRAY;          STRAY;          STRAY;
-/* 0a0 */      IS(softclock);  STRAY;          STRAY;          STRAY;
-/* 0b0 */      IS(netintr);    STRAY;          STRAY;          IS(kdbintr);
-/* 0c0 */      IS(hardclock);  STRAY;          KS(emulate);    KS(emulateFPD);
-/* 0d0 */      STRAY;          STRAY;          STRAY;          STRAY;
-/* 0e0 */      STRAY;          STRAY;          STRAY;          STRAY;
+/* 050 */      IS(sbisilo);    IS(cmrd);       IS(sbi0alert);  IS(sbi0fault);
+/* 060 */      IS(wtime);      IS(sbi0fail);   STRAY(0x68);    STRAY(0x6c);
+/* 070 */      STRAY(0x70);    STRAY(0x74);    STRAY(0x78);    STRAY(0x7c);
+/* 080 */      STRAY(0x80);    STRAY(0x84);    KS(astflt);     STRAY(0x8c);
+/* 090 */      STRAY(0x90);    STRAY(0x94);    STRAY(0x98);    STRAY(0x9c);
+/* 0a0 */      IS(softclock);  STRAY(0xa4);    STRAY(0xa8);    STRAY(0xac);
+/* 0b0 */      IS(netintr);    STRAY(0xb4);    STRAY(0xb8);    IS(kdbintr);
+/* 0c0 */      IS(hardclock);  STRAY(0xc4);    KS(emulate);    KS(emulateFPD);
+/* 0d0 */      STRAY(0xd0);    STRAY(0xd4);    STRAY(0xd8);    STRAY(0xdc);
+/* 0e0 */      STRAY(0xe0);    STRAY(0xe4);    STRAY(0xe8);    STRAY(0xec);
 /* 0f0 */      IS(consdin);    IS(consdout);   IS(cnrint);     IS(cnxint);
 /* 0f0 */      IS(consdin);    IS(consdout);   IS(cnrint);     IS(cnxint);
-/* 100 */      IS(nexzvec); STRAY15;           /* ipl 0x14, nexus 0-15 */
-/* 140 */      IS(nexzvec); STRAY15;           /* ipl 0x15, nexus 0-15 */
-/* 180 */      IS(nexzvec); STRAY15;           /* ipl 0x16, nexus 0-15 */
-/* 1c0 */      IS(nexzvec); STRAY15;           /* ipl 0x17, nexus 0-15 */
-
-       .globl  _UNIvec
-_UNIvec:       .space  512             # 750 unibus intr vector
-                                       # 1st UBA jump table on 780's
+/* 100 */      NEX0(0x100);            /* ipl 0x14, nexus 0-15 */
+/* 140 */      NEX0(0x140);            /* ipl 0x15, nexus 0-15 */
+/* 180 */      NEX0(0x180);            /* ipl 0x16, nexus 0-15 */
+/* 1c0 */      NEX0(0x1c0);            /* ipl 0x17, nexus 0-15 */
+
+/*
+ * 750 hardware reads through UNIvec (scb + 512 bytes) to find Unibus
+ * interrupt vectors.  780s use this space as a jump table (lookup
+ * code in locore.s makes 780s work like 750s).  Additional pages
+ * of interrupt vectors for additional UBAs follow immediately
+ *
+ * 8600s use this area as a second SCB, for which purpose we init it
+ * here.  Everything else will simply replace these with Unibus vectors.
+ * An additional page is provided for UBA jump tables if the second
+ * scb might be present.
+ */
+       .globl  _UNIvec,_eUNIvec
+_UNIvec:
+/* 200 */      STRAY16(0x200);         /* unused (?) */
+/* 240 */      STRAY16(0x240);         /* sbi1fail etc. set at boot time */
+/* 280 */      STRAY16(0x280);         /* unused (?) */
+/* 2c0 */      STRAY16(0x2c0);         /* unused (?) */
+/* 300 */      NEX1(0x300);            /* ipl 0x14, nexus 0-15, sbia 1 */
+/* 340 */      NEX1(0x340);            /* ipl 0x15, nexus 0-15, sbia 1 */
+/* 380 */      NEX1(0x380);            /* ipl 0x16, nexus 0-15, sbia 1 */
+/* 3c0 */      NEX1(0x3c0);            /* ipl 0x17, nexus 0-15, sbia 1 */
+
+#if VAX8600
+               .space  512             # replacement space for UBA
+#endif
 #if NUBA > 1
 #if NUBA > 1
-       .globl  _UNI1vec
-_UNI1vec:      .space  512             # 750 second unibus intr vector
-                                       # 2nd UBA jump table on 780's
+               .space  512*(NUBA-1)    # 750 second unibus intr vector
+                                       # 2nd+ UBA jump table on 780's
 #endif
 #endif
+_eUNIvec:
index 29339b6..9af3da2 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)swapgeneric.c       7.3 (Berkeley) %G%
+ *     @(#)swapgeneric.c       7.4 (Berkeley) %G%
  */
 
 #include "mba.h"
  */
 
 #include "mba.h"
@@ -44,6 +44,7 @@ extern        struct uba_driver hkdriver;
 extern struct uba_driver idcdriver;
 extern struct uba_driver hldriver;
 extern struct uba_driver udadriver;
 extern struct uba_driver idcdriver;
 extern struct uba_driver hldriver;
 extern struct uba_driver udadriver;
+extern struct uba_driver kdbdriver;
 
 struct genericconf {
        caddr_t gc_driver;
 
 struct genericconf {
        caddr_t gc_driver;
@@ -57,15 +58,18 @@ struct      genericconf {
        { (caddr_t)&hldriver,   "rl",   makedev(14, 0), },
        { (caddr_t)&hkdriver,   "hk",   makedev(3, 0),  },
        { (caddr_t)&hkdriver,   "rk",   makedev(3, 0),  },
        { (caddr_t)&hldriver,   "rl",   makedev(14, 0), },
        { (caddr_t)&hkdriver,   "hk",   makedev(3, 0),  },
        { (caddr_t)&hkdriver,   "rk",   makedev(3, 0),  },
+       { (caddr_t)&kdbdriver,  "kra",  makedev(16, 0), },
        { 0 },
 };
 
 setconf()
 {
        { 0 },
 };
 
 setconf()
 {
+#if NMBA > 0
        register struct mba_device *mi;
        register struct mba_device *mi;
+#endif
        register struct uba_device *ui;
        register struct genericconf *gc;
        register struct uba_device *ui;
        register struct genericconf *gc;
-       register char *cp;
+       register char *cp, *gp;
        int unit, swaponroot = 0;
 
        if (rootdev != NODEV)
        int unit, swaponroot = 0;
 
        if (rootdev != NODEV)
@@ -76,13 +80,13 @@ retry:
                printf("root device? ");
                gets(name);
                for (gc = genericconf; gc->gc_driver; gc++)
                printf("root device? ");
                gets(name);
                for (gc = genericconf; gc->gc_driver; gc++)
-                       if (gc->gc_name[0] == name[0] &&
-                           gc->gc_name[1] == name[1])
+                   for (cp = name, gp = gc->gc_name; *cp == *gp; cp++, gp++)
+                       if (*gp == 0)
                                goto gotit;
                                goto gotit;
-               printf("use hp%%d, up%%d, ra%%d, rb%%d, rl%%d or hk%%d\n");
+               printf(
+                 "use hp%%d, up%%d, ra%%d, rb%%d, rl%%d, hk%%d or kra%%d\n");
                goto retry;
 gotit:
                goto retry;
 gotit:
-               cp = name + 2;
                if (*cp < '0' || *cp > '9') {
                        printf("bad/missing unit number\n");
                        goto retry;
                if (*cp < '0' || *cp > '9') {
                        printf("bad/missing unit number\n");
                        goto retry;
@@ -95,6 +99,7 @@ gotit:
        }
        unit = 0;
        for (gc = genericconf; gc->gc_driver; gc++) {
        }
        unit = 0;
        for (gc = genericconf; gc->gc_driver; gc++) {
+#if NMBA > 0
                for (mi = mbdinit; mi->mi_driver; mi++) {
                        if (mi->mi_alive == 0)
                                continue;
                for (mi = mbdinit; mi->mi_driver; mi++) {
                        if (mi->mi_alive == 0)
                                continue;
@@ -105,6 +110,7 @@ gotit:
                                goto found;
                        }
                }
                                goto found;
                        }
                }
+#endif
                for (ui = ubdinit; ui->ui_driver; ui++) {
                        if (ui->ui_alive == 0)
                                continue;
                for (ui = ubdinit; ui->ui_driver; ui++) {
                        if (ui->ui_alive == 0)
                                continue;