summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>1997-09-10 12:04:54 +0000
committerMats O Jansson <maja@cvs.openbsd.org>1997-09-10 12:04:54 +0000
commit527830974744f2a3c3c81d19d69b2036823ea766 (patch)
tree1b6ebcf585d94364647aa6bb7c9dedbdb5fdef34 /sys/arch
parent663d76b808b184462dd249f52963bdc5d9ff84f7 (diff)
Sync with NetBSD 970516. -moj
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/vax/vax/autoconf.c112
-rw-r--r--sys/arch/vax/vax/clock.c138
-rw-r--r--sys/arch/vax/vax/conf.c16
-rw-r--r--sys/arch/vax/vax/dzcons.c75
-rw-r--r--sys/arch/vax/vax/emulate.s7
-rw-r--r--sys/arch/vax/vax/gencons.c32
-rw-r--r--sys/arch/vax/vax/intvec.s19
-rw-r--r--sys/arch/vax/vax/ka410.c175
-rw-r--r--sys/arch/vax/vax/ka43.c512
-rw-r--r--sys/arch/vax/vax/ka630.c83
-rw-r--r--sys/arch/vax/vax/ka650.c92
-rw-r--r--sys/arch/vax/vax/ka750.c23
-rw-r--r--sys/arch/vax/vax/ka780.c31
-rw-r--r--sys/arch/vax/vax/ka820.c102
-rw-r--r--sys/arch/vax/vax/ka860.c21
-rw-r--r--sys/arch/vax/vax/locore.c91
-rw-r--r--sys/arch/vax/vax/machdep.c13
-rw-r--r--sys/arch/vax/vax/pmap.c63
-rw-r--r--sys/arch/vax/vax/rootfil.c4
-rw-r--r--sys/arch/vax/vax/subr.s6
-rw-r--r--sys/arch/vax/vax/uvax.c217
-rw-r--r--sys/arch/vax/vax/vm_machdep.c9
22 files changed, 801 insertions, 1040 deletions
diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c
index 760ffc3c129..8a025b5c3e1 100644
--- a/sys/arch/vax/vax/autoconf.c
+++ b/sys/arch/vax/vax/autoconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: autoconf.c,v 1.7 1997/05/29 00:05:12 niklas Exp $ */
-/* $NetBSD: autoconf.c,v 1.20 1997/01/11 13:50:20 ragge Exp $ */
+/* $OpenBSD: autoconf.c,v 1.8 1997/09/10 12:04:42 maja Exp $ */
+/* $NetBSD: autoconf.c,v 1.25 1997/03/22 12:51:00 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -31,9 +31,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
- /* All bugs are subject to removal without further notice */
-
-
#include <sys/param.h>
#include <sys/types.h>
#include <sys/systm.h>
@@ -41,6 +38,8 @@
#include <sys/reboot.h>
#include <sys/conf.h>
+#include <vm/vm.h>
+
#include <machine/cpu.h>
#include <machine/sid.h>
#include <machine/param.h>
@@ -50,106 +49,16 @@
#include <machine/ka820.h>
#include <machine/ka750.h>
#include <machine/ka650.h>
-#include <machine/uvax.h>
#include <machine/clock.h>
#include <vax/vax/gencons.h>
-#include <vm/vm.h>
-
+struct cpu_dep *dep_call;
struct nexus *nexus;
-
-#define BACKPLANE 0
-#define BIBUSS 1
-#define SBIBUSS 2
-#define VSBUSS 4
-
int mastercpu; /* chief of the system */
+struct device *booted_from;
-#if defined(VAX630) || defined(VAX410) || defined(VAX43) || defined(VAX46)
-#define VAX_uVAX
-#endif
-
-#ifdef VAX8600 /* XXX These are in ka860 also */
-void ka86_conf __P((struct device *, struct device *, void *));
-void ka86_memenable __P((struct sbi_attach_args *, struct device *));
-void ka86_memerr __P((void));
-int ka86_mchk __P((caddr_t));
-void ka86_steal_pages __P((void));
-#endif
-#ifdef VAX780 /* XXX These are in ka780 also */
-void ka780_conf __P((struct device *, struct device *, void *));
-void ka780_memenable __P((struct sbi_attach_args *, void *));
-void ka780_memerr __P((void));
-int ka780_mchk __P((caddr_t));
-void ka780_steal_pages __P((void));
-#endif
-
-struct cpu_dep cpu_calls[]={
- /* Type 0,noexist */
- {NULL, NULL, NULL, NULL, NULL },
-#ifdef VAX780 /* Type 1, 11/{780,782,785} */
- {ka780_steal_pages,generic_clock, ka780_mchk, ka780_memerr, ka780_conf,
- generic_clkread, generic_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX750 /* Type 2, 11/750 */
- {ka750_steal_pages,generic_clock, ka750_mchk, ka750_memerr, ka750_conf,
- generic_clkread, generic_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX730 /* Type 3, 11/{730,725}, ceauciesco-vax */
- {NULL, NULL, NULL, NULL, NULL },
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX8600 /* Type 4, 8600/8650 (11/{790,795}) */
- {ka86_steal_pages, generic_clock, ka86_mchk, ka86_memerr, ka86_conf,
- generic_clkread, generic_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX8200 /* Type 5, 8200, 8300, 8350 */
- {ka820_steal_pages, generic_clock, ka820_mchk, ka820_memerr, NULL,
- ka820_clkread, ka820_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX8800 /* Type 6, 85X0, 8700, 88X0 */
- {NULL, generic_clock, NULL, NULL, NULL },
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX610 /* Type 7, KA610 */
- {NULL, NULL, NULL, NULL, NULL },
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX630 /* Type 8, KA630 or KA410 (uVAX II) */
- {uvax_steal_pages, no_nicr_clock, uvax_mchk, uvax_memerr, uvax_conf,
- uvax_clkread, uvax_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
- /* Type 9, not used */
- {NULL, NULL, NULL, NULL, NULL },
-#ifdef VAX650 /* Type 10, KA65X (uVAX III) */
- {uvaxIII_steal_pages, no_nicr_clock, uvaxIII_mchk, uvaxIII_memerr,
- uvaxIII_conf, generic_clkread, generic_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-#ifdef VAX_uVAX /* Type 11, RIGEL */
- {uvax_steal_pages, no_nicr_clock, uvax_mchk, uvax_memerr, uvax_conf,
- uvax_clkread, uvax_clkwrite},
-#else
- {NULL, NULL, NULL, NULL, NULL },
-#endif
-};
-
-void gencnslask __P((void));
+#define BACKPLANE 0
void
configure()
@@ -171,10 +80,6 @@ configure()
* Configure swap area and related system
* parameter based on device(s) used.
*/
- gencnslask(); /* XXX inte g|ras h{r */
-#if VAX410 || VAX43
- dzcnslask(); /* XXX inte g|ras h{r */
-#endif
swapconf();
cold = 0;
mtpr(GC_CCF, PR_TXDB); /* Clear cold start flag in cpu */
@@ -183,6 +88,7 @@ configure()
int printut __P((void *, const char *));
int backplane_match __P((struct device *, void *, void *));
void backplane_attach __P((struct device *, struct device *, void *));
+
int
printut(aux, hej)
void *aux;
@@ -367,7 +273,7 @@ cpu_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
- (*cpu_calls[vax_cputype].cpu_conf)(parent, self, aux);
+ (*dep_call->cpu_conf)(parent, self, aux);
}
int mem_match __P((struct device *, void *, void *));
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
index fbcd580fdab..bb951c61830 100644
--- a/sys/arch/vax/vax/clock.c
+++ b/sys/arch/vax/vax/clock.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: clock.c,v 1.7 1997/05/29 00:05:13 niklas Exp $ */
-/* $NetBSD: clock.c,v 1.18 1996/10/13 03:35:33 christos Exp $ */
+/* $OpenBSD: clock.c,v 1.8 1997/09/10 12:04:42 maja Exp $ */
+/* $NetBSD: clock.c,v 1.20 1997/04/18 18:49:37 ragge Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -36,9 +36,10 @@
#include <sys/systm.h>
#include <sys/device.h>
+#include <dev/clock_subr.h>
+
#include <machine/mtpr.h>
#include <machine/sid.h>
-#include <machine/uvax.h>
#include <machine/clock.h>
#include <machine/cpu.h>
@@ -104,7 +105,7 @@ inittodr(fs_time)
{
int rv;
- rv = (*cpu_calls[vax_cputype].cpu_clkread) (fs_time);
+ rv = (*dep_call->cpu_clkread) (fs_time);
switch (rv) {
case CLKREAD_BAD: /* No useable information from system clock */
@@ -139,7 +140,7 @@ inittodr(fs_time)
void
resettodr()
{
- (*cpu_calls[vax_cputype].cpu_clkwrite)();
+ (*dep_call->cpu_clkwrite)();
}
/*
* A delayloop that delays about the number of milliseconds that is
@@ -149,32 +150,7 @@ void
delay(i)
int i;
{
- int mul;
-
- switch (vax_cputype) {
-#if VAX750 || VAX630 || VAX410
- case VAX_750:
- case VAX_78032:
- mul = 1; /* <= 1 VUPS */
- break;
-#endif
-#if VAX780 || VAX8200
- case VAX_780:
- case VAX_8200:
- mul = 2; /* <= 2 VUPS */
- break;
-#endif
-#if VAX650
- case VAX_650:
- mul = 3; /* <= 3 VUPS */
- break;
-#endif
- default: /* Would be enough... */
- case VAX_8600:
- mul = 6; /* <= 6 VUPS */
- break;
- }
- asm ("1: sobgtr %0, 1b" : : "r" (mul * i));
+ asm ("1: sobgtr %0, 1b" : : "r" (dep_call->cpu_vups * i));
}
#if VAX750 || VAX780 || VAX8200 || VAX8600 || VAX8800
@@ -279,65 +255,71 @@ generic_clkwrite()
#if VAX630 || VAX410 || VAX43 || VAX8200
-static int dagar[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
+volatile short *clk_page; /* where the chip is mapped in virtual memory */
+int clk_adrshift; /* how much to multiply the in-page address with */
+int clk_tweak; /* Offset of time into word. */
+
+#define REGPEEK(off) (clk_page[off << clk_adrshift] >> clk_tweak)
+#define REGPOKE(off, v) (clk_page[off << clk_adrshift] = ((v) << clk_tweak))
-/*
- * Returns the number of days in month based on the current year.
- */
int
-daysinmonth(m, y)
- int m, y;
+chip_clkread(base)
+ time_t base;
{
- if (m == 2 && IS_LEAPYEAR(y))
- return 29;
- else
- return dagar[m - 1];
-}
+ struct clock_ymdhms c;
+ int timeout = 1<<15, s;
-/*
- * Converts chiptime (year/month/day/hour/min/sek) and returns ticks.
- */
-long
-chiptotime(c)
- struct chiptime *c;
-{
- int num, i;
+#ifdef DIAGNOSTIC
+ if (clk_page == 0)
+ panic("trying to use unset chip clock page");
+#endif
+
+ if ((REGPEEK(CSRD_OFF) & CSRD_VRT) == 0) {
+ printf("WARNING: TOY clock not marked valid");
+ return CLKREAD_BAD;
+ }
+ while (REGPEEK(CSRA_OFF) & CSRA_UIP)
+ if (--timeout == 0) {
+ printf ("TOY clock timed out");
+ return CLKREAD_BAD;
+ }
- num = c->sec;
- num += c->min * SEC_PER_MIN;
- num += c->hour * SEC_PER_HOUR;
- num += (c->day - 1) * SEC_PER_DAY;
- for(i = c->mon - 1; i > 0; i--)
- num += daysinmonth(i, c->year) * SEC_PER_DAY;
- num += yeartonum(c->year);
+ s = splhigh();
+ c.dt_year = REGPEEK(YR_OFF) + 1970;
+ c.dt_mon = REGPEEK(MON_OFF);
+ c.dt_day = REGPEEK(DAY_OFF);
+ c.dt_wday = REGPEEK(WDAY_OFF);
+ c.dt_hour = REGPEEK(HR_OFF);
+ c.dt_min = REGPEEK(MIN_OFF);
+ c.dt_sec = REGPEEK(SEC_OFF);
+ splx(s);
- return num;
+ time.tv_sec = clock_ymdhms_to_secs(&c);
+ return CLKREAD_OK;
}
-/*
- * Reads the system time and puts it into a chiptime struct.
- */
void
-timetochip(c)
- struct chiptime *c;
+chip_clkwrite()
{
- int tid = time.tv_sec, i, j;
+ struct clock_ymdhms c;
- c->year = numtoyear(tid);
- tid -= yeartonum(c->year);
+#ifdef DIAGNOSTIC
+ if (clk_page == 0)
+ panic("trying to use unset chip clock page");
+#endif
- c->mon = 1;
- while(tid >= (j = (daysinmonth(c->mon, c->year) * SEC_PER_DAY))) {
- c->mon++;
- tid -= j;
- }
- c->day = (tid / SEC_PER_DAY) + 1;
- tid %= SEC_PER_DAY;
+ REGPOKE(CSRB_OFF, CSRB_SET);
- c->hour = tid / SEC_PER_HOUR;
- tid %= SEC_PER_HOUR;
+ clock_secs_to_ymdhms(time.tv_sec, &c);
- c->min = tid / SEC_PER_MIN;
- c->sec = tid % SEC_PER_MIN;
-}
+ REGPOKE(YR_OFF, c.dt_year - 1970);
+ REGPOKE(MON_OFF, c.dt_mon);
+ REGPOKE(DAY_OFF, c.dt_day);
+ REGPOKE(WDAY_OFF, c.dt_wday);
+ REGPOKE(HR_OFF, c.dt_hour);
+ REGPOKE(MIN_OFF, c.dt_min);
+ REGPOKE(SEC_OFF, c.dt_sec);
+
+ REGPOKE(CSRB_OFF, CSRB_DM|CSRB_24);
+};
#endif
diff --git a/sys/arch/vax/vax/conf.c b/sys/arch/vax/vax/conf.c
index 41f34fa1d2c..ad015893de6 100644
--- a/sys/arch/vax/vax/conf.c
+++ b/sys/arch/vax/vax/conf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: conf.c,v 1.12 1997/05/28 23:17:59 niklas Exp $ */
-/* $NetBSD: conf.c,v 1.27 1997/01/07 11:35:20 mrg Exp $ */
+/* $OpenBSD: conf.c,v 1.13 1997/09/10 12:04:43 maja Exp $ */
+/* $NetBSD: conf.c,v 1.28 1997/02/04 19:13:17 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -113,9 +113,6 @@ bdev_decl(st);
#include "cd.h"
bdev_decl(cd);
-#include "md.h"
-bdev_decl(md);
-
struct bdevsw bdevsw[] =
{
bdev_disk_init(NHP,hp), /* 0: RP0?/RM0? */
@@ -141,7 +138,7 @@ struct bdevsw bdevsw[] =
bdev_disk_init(NSD,sd), /* 20: SCSI disk */
bdev_tape_init(NST,st), /* 21: SCSI tape */
bdev_disk_init(NCD,cd), /* 22: SCSI CD-ROM */
- bdev_disk_init(NMD,md), /* 23: memory disk driver */
+ bdev_notdef(), /* 23: was: memory disk driver */
};
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
@@ -336,6 +333,9 @@ cdev_decl(ipl);
#define NIPF 0
#endif
+#include "dl.h"
+cdev_decl(dl);
+
#if defined(INGRES)
#define NII 1
#else
@@ -353,7 +353,6 @@ cdev_decl(tun);
cdev_decl(cd);
#include "ch.h"
cdev_decl(ch);
-cdev_decl(md);
#include "ss.h"
cdev_decl(ss);
#include "uk.h"
@@ -431,11 +430,12 @@ struct cdevsw cdevsw[] =
cdev_disk_init(NSD,sd), /* 59: SCSI disk */
cdev_tape_init(NST,st), /* 60: SCSI tape */
cdev_disk_init(NCD,cd), /* 61: SCSI CD-ROM */
- cdev_disk_init(NMD,md), /* 62: memory disk driver */
+ cdev_notdef(), /* 62: was: memory disk driver */
cdev_ch_init(NCH,ch), /* 63: SCSI autochanger */
cdev_scanner_init(NSS,ss), /* 64: SCSI scanner */
cdev_uk_init(NUK,uk), /* 65: SCSI unknown */
cdev_random_init(1,random), /* 66: random data source */
+ cdev_tty_init(NDL,dl), /* 67; DL11 */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/vax/vax/dzcons.c b/sys/arch/vax/vax/dzcons.c
index b0b2d585fbe..8160e35445c 100644
--- a/sys/arch/vax/vax/dzcons.c
+++ b/sys/arch/vax/vax/dzcons.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: dzcons.c,v 1.2 1997/05/29 00:05:17 niklas Exp $ */
-/* $NetBSD: dzcons.c,v 1.2 1996/09/02 06:44:30 mycroft Exp $ */
+/* $OpenBSD: dzcons.c,v 1.3 1997/09/10 12:04:44 maja Exp $ */
+/* $NetBSD: dzcons.c,v 1.5 1997/03/22 12:51:01 ragge Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -59,6 +59,21 @@ volatile unsigned char *ka410_intmsk = (void*)KA410_INTMSK;
/*----------------------------------------------------------------------*/
+#define REG(name) short name; short X##name##X;
+static volatile struct {/* base address of DZ-controller: 0x200A0000 */
+ REG(csr); /* 00 Csr: control/status register */
+ REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */
+ REG(tcr); /* 08 Tcr: transmit console register */
+ REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */
+ REG(lpr0); /* 10 Lpr0: */
+ REG(lpr1); /* 14 Lpr0: */
+ REG(lpr2); /* 18 Lpr0: */
+ REG(lpr3); /* 1C Lpr0: */
+} *dz = (void*)0x200A0000;
+#undef REG
+
+void dzcnputc ();
+
int
dzcngetc(dev)
dev_t dev;
@@ -70,36 +85,19 @@ dzcngetc(dev)
imsk = *ka410_intmsk; /* save interrupt-mask */
*ka410_intmsk = 0; /* disable console-receive interrupt! */
-#if 0
do {
- c = get_fp() & 0xFF; /* 0x7F ??? */
+ while ((dz->csr & 0x80) == 0); /* Wait for char */
+ c = dz->rbuf & 0xff;
} while (c == 17 || c == 19); /* ignore XON/XOFF */
*ka410_intclr = 0x80; /* clear the interrupt request */
*ka410_intmsk = imsk; /* restore interrupt-mask */
-#else
- for (;;)
- ;
-#endif
if (c == 13)
c = 10;
return (c);
}
-#define REG(name) short name; short X##name##X;
-static volatile struct {/* base address of DZ-controller: 0x200A0000 */
- REG(csr); /* 00 Csr: control/status register */
- REG(rbuf); /* 04 Rbuf/Lpr: receive buffer/line param reg. */
- REG(tcr); /* 08 Tcr: transmit console register */
- REG(tdr); /* 0C Msr/Tdr: modem status reg/transmit data reg */
- REG(lpr0); /* 10 Lpr0: */
- REG(lpr1); /* 14 Lpr0: */
- REG(lpr2); /* 18 Lpr0: */
- REG(lpr3); /* 1C Lpr0: */
-} *dz = (void*)0x200A0000;
-#undef REG
-
struct tty *dzcn_tty[1];
int dzcnparam();
@@ -119,6 +117,9 @@ dzcnopen(dev, flag, mode, p)
unit = minor(dev);
if (unit) return ENXIO;
+ if (dzcn_tty[0] == NULL)
+ dzcn_tty[0] = ttymalloc();
+
tp = dzcn_tty[0];
tp->t_oproc = dzcnstart;
@@ -243,7 +244,8 @@ dzcnrint()
int i, j;
tp = dzcn_tty[0];
- i = dz->rbuf;
+ while ((dz->csr & 0x80) == 0); /* Wait for char */
+ i = dz->rbuf & 0xff;
#ifdef DDB
j = kdbrint(i);
@@ -297,6 +299,7 @@ dzcnprobe(cndev)
switch (vax_boardtype) {
case VAX_BTYP_410:
+ case VAX_BTYP_420:
case VAX_BTYP_43:
break;
@@ -319,28 +322,36 @@ int
dzcninit(cndev)
struct consdev *cndev;
{
+ dz = (void*)uvax_phys2virt ((int) dz);
+ ka410_intreq = (void*)uvax_phys2virt ((int)ka410_intreq);
+ ka410_intclr = (void*)uvax_phys2virt ((int)ka410_intclr);
+ ka410_intmsk = (void*)uvax_phys2virt ((int)ka410_intmsk);
+
+ dz->csr = 0; /* Disable scanning until initting is done */
+ dz->rbuf = 0; /* Turn off line 0's receiver */
+ dz->rbuf = 1; /* Turn off line 1's receiver */
+ dz->rbuf = 2; /* Turn off line 2's receiver */
+ /* Leave line 3 alone */
+ dz->tcr = 8; /* Turn off all but line 3's xmitter */
+ dz->csr = 0x20; /* Turn scanning back on */
}
-dzcnslask()
-{
- dzcn_tty[0] = ttymalloc();
-}
void
dzcnputc(dev,ch)
dev_t dev;
int ch;
{
+ int imsk;
int timeout = 1<<15; /* don't hang the machine! */
+
+ imsk = *ka410_intmsk;
+ *ka410_intmsk = 0;
+
while ((dz->csr & 0x8000) == 0) /* Wait until ready */
if (--timeout < 0)
break;
dz->tdr = ch; /* Put the character */
-}
-conout(str)
- char *str;
-{
- while (*str)
- gencnputc(0, *str++);
+ *ka410_intmsk = imsk;
}
diff --git a/sys/arch/vax/vax/emulate.s b/sys/arch/vax/vax/emulate.s
index 3376e015951..c09491f18ff 100644
--- a/sys/arch/vax/vax/emulate.s
+++ b/sys/arch/vax/vax/emulate.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: emulate.s,v 1.2 1997/05/29 00:05:18 niklas Exp $ */
-/* $NetBSD: emulate.s,v 1.1 1995/02/24 01:35:08 ragge Exp $ */
+/* $OpenBSD: emulate.s,v 1.3 1997/09/10 12:04:44 maja Exp $ */
+/* $NetBSD: emulate.s,v 1.2 1997/03/15 16:14:25 ragge Exp $ */
/*
* Copyright (c) 1986, 1987 The Regents of the University of California.
* All rights reserved.
@@ -38,7 +38,6 @@
* @(#)emulate.s 7.5 (Berkeley) 6/28/90
*/
-#if VAX630 || VAX650
/*
* String instruction emulation - MicroVAX only. These routines are called
* from locore.s when an "emulate" fault occurs on the MicroVAX. They are
@@ -1210,8 +1209,6 @@ _EMcmpp4:
return
-#endif UVAXII
-
#ifdef notdef
/*
diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c
index 98086f68c06..9ae23f7d4e5 100644
--- a/sys/arch/vax/vax/gencons.c
+++ b/sys/arch/vax/vax/gencons.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: gencons.c,v 1.5 1997/05/29 00:05:18 niklas Exp $ */
-/* $NetBSD: gencons.c,v 1.11 1996/09/02 06:44:32 mycroft Exp $ */
+/* $OpenBSD: gencons.c,v 1.6 1997/09/10 12:04:45 maja Exp $ */
+/* $NetBSD: gencons.c,v 1.13 1997/03/15 16:36:19 ragge Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@@ -49,6 +49,7 @@
#include <dev/cons.h>
#include <machine/mtpr.h>
+#include <machine/sid.h>
#include <machine/cpu.h>
#include <machine/../vax/gencons.h>
@@ -70,7 +71,6 @@ struct tty *gencntty __P((dev_t));
void gencnrint __P((void));
void gencntint __P((void));
void gencnstop __P((struct tty *, int));
-void gencnslask __P((void));
int
gencnopen(dev, flag, mode, p)
@@ -82,7 +82,11 @@ gencnopen(dev, flag, mode, p)
struct tty *tp;
unit = minor(dev);
- if (unit) return ENXIO;
+ if (unit)
+ return ENXIO;
+
+ if (gencn_tty[0] == NULL)
+ gencn_tty[0] = ttymalloc();
tp = gencn_tty[0];
@@ -224,7 +228,6 @@ gencnstop(tp, flag)
struct tty *tp;
int flag;
{
-
}
void
@@ -256,12 +259,13 @@ gencnprobe(cndev)
{
int i;
- for (i = 0; i < nchrdev; i++)
- if (cdevsw[i].d_open == gencnopen) {
- cndev->cn_dev = makedev(i,0);
- cndev->cn_pri = CN_NORMAL;
- break;
- }
+ if ((vax_cputype < VAX_TYP_UV1) || /* All older has MTPR console */
+ (vax_boardtype == VAX_BTYP_630) ||
+ (vax_boardtype == VAX_BTYP_650)) {
+ cndev->cn_dev = makedev(25, 0);
+ cndev->cn_pri = CN_NORMAL;
+ } else
+ cndev->cn_pri = CN_DEAD;
}
void
@@ -271,12 +275,6 @@ gencninit(cndev)
}
void
-gencnslask()
-{
- gencn_tty[0] = ttymalloc();
-}
-
-void
gencnputc(dev,ch)
dev_t dev;
int ch;
diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s
index ef141ce8181..34caecce194 100644
--- a/sys/arch/vax/vax/intvec.s
+++ b/sys/arch/vax/vax/intvec.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: intvec.s,v 1.6 1997/05/28 23:20:17 niklas Exp $ */
-/* $NetBSD: intvec.s,v 1.20 1996/07/20 18:20:44 ragge Exp $ */
+/* $OpenBSD: intvec.s,v 1.7 1997/09/10 12:04:45 maja Exp $ */
+/* $NetBSD: intvec.s,v 1.22 1997/03/22 23:02:07 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -151,8 +151,13 @@ _rpb:
INTVEC(strayEC, ISTACK) # Unused, EC
INTVEC(strayF0, ISTACK)
INTVEC(strayF4, ISTACK)
+#if VAX8600 || VAX8200 || VAX750 || VAX780 || VAX630 || VAX650
INTVEC(consrint, ISTACK) # Console Terminal Recieve Interrupt
INTVEC(constint, ISTACK) # Console Terminal Transmit Interrupt
+#else
+ INTVEC(strayF8, ISTACK)
+ INTVEC(strayFC, ISTACK)
+#endif
/* space for adapter vectors */
.space 0x100
@@ -342,9 +347,13 @@ hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag
STRAY(0,EC)
STRAY(0,F0)
STRAY(0,F4)
-
+#if VAX8600 || VAX8200 || VAX750 || VAX780 || VAX630 || VAX650
FASTINTR(consrint,gencnrint)
FASTINTR(constint,gencntint)
+#else
+ STRAY(0,F8)
+ STRAY(0,FC)
+#endif
/*
* Main routine for traps; all go through this.
@@ -371,7 +380,7 @@ _sret: movl (sp)+, fp
sbifltmsg:
.asciz "SBI fault",0
-#if VAX630 || VAX650
+#if VAX630 || VAX650 || VAX410
/*
* Table of emulated Microvax instructions supported by emulate.s.
* Use noemulate to convert unimplemented ones to reserved instruction faults.
@@ -436,7 +445,7 @@ _emtable:
.align 2
.globl emulate
emulate:
-#if VAX630 || VAX650
+#if VAX630 || VAX650 || VAX410
movl r11,32(sp) # save register r11 in unused operand
movl r10,36(sp) # save register r10 in unused operand
cvtbl (sp),r10 # get opcode
diff --git a/sys/arch/vax/vax/ka410.c b/sys/arch/vax/vax/ka410.c
index e1c2d6b597b..e383af37f78 100644
--- a/sys/arch/vax/vax/ka410.c
+++ b/sys/arch/vax/vax/ka410.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka410.c,v 1.2 1997/05/29 00:05:19 niklas Exp $ */
-/* $NetBSD: ka410.c,v 1.3 1996/10/13 03:35:42 christos Exp $ */
+/* $OpenBSD: ka410.c,v 1.3 1997/09/10 12:04:46 maja Exp $ */
+/* $NetBSD: ka410.c,v 1.6 1997/04/18 18:49:35 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -16,8 +16,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed at Ludd, University of
- * Lule}, Sweden and its contributors.
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@@ -33,8 +33,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-
-
#include <sys/param.h>
#include <sys/types.h>
#include <sys/device.h>
@@ -43,6 +41,7 @@
#include <vm/vm_kern.h>
#include <machine/pte.h>
+#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <machine/sid.h>
#include <machine/pmap.h>
@@ -51,70 +50,51 @@
#include <machine/ka410.h>
#include <machine/clock.h>
-/*
- * Maybe all these variables/functions should be static or "integrate"
- */
-void ka410_conf __P((struct device*, struct device*, void*));
-void ka410_memenable __P((struct sbi_attach_args *, struct device *));
-void ka410_steal_pages __P((void));
-
-#ifdef notyet
-void ka410_memerr __P((void));
-int ka410_mchk __P((caddr_t));
-#endif
-
-struct ka410_cpu *ka410_cpuptr = (void*)KA410_CPU_BASE;
-struct ka410_clock *ka410_clkptr = (void*)KA410_WAT_BASE;
-
-extern int uVAX_fillmap __P((struct uc_map *));
+static void ka410_conf __P((struct device*, struct device*, void*));
+static void ka410_memenable __P((struct sbi_attach_args*, struct device *));
+static void ka410_steal_pages __P((void));
+static void ka410_memerr __P((void));
+static int ka410_mchk __P((caddr_t));
-struct uc_map ka410_map[] = {
+static struct uc_map ka410_map[] = {
{ KA410_CFGTST, KA410_CFGTST+1023, 1024, 0 },
- { KA410_ROM_BASE, KA410_ROM_END, KA410_ROM_SIZE, 0 },
- { KA410_CPU_BASE, KA410_CPU_END, KA410_CPU_SIZE, 0 },
- { KA410_NWA_BASE, KA410_NWA_END, KA410_NWA_SIZE, 0 },
- { KA410_SER_BASE, KA410_SER_END, KA410_SER_SIZE, 0 },
- { KA410_WAT_BASE, KA410_WAT_END, KA410_WAT_SIZE, 0 },
+ { KA410_ROM_BASE, KA410_ROM_END, KA410_ROM_SIZE, 0 },
+ { (int)KA410_CPU_BASE, KA410_CPU_END, KA410_CPU_SIZE, 0 },
+ { KA410_NWA_BASE, KA410_NWA_END, KA410_NWA_SIZE, 0 },
+ { KA410_SER_BASE, KA410_SER_END, KA410_SER_SIZE, 0 },
+ { (int)KA410_WAT_BASE, KA410_WAT_END, KA410_WAT_SIZE, 0 },
#if 0
- { KA410_SCS_BASE, KA410_SCS_END, KA410_SCS_SIZE, 0 },
+ { KA410_SCS_BASE, KA410_SCS_END, KA410_SCS_SIZE, 0 },
#else
{ 0x200C0000, 0x200C01FF, 0x200, 0 },
#endif
- { KA410_LAN_BASE, KA410_LAN_END, KA410_LAN_SIZE, 0 },
- { KA410_CUR_BASE, KA410_CUR_END, KA410_CUR_SIZE, 0 },
- { KA410_DMA_BASE, KA410_DMA_END, KA410_DMA_SIZE, 0 },
+ { KA410_LAN_BASE, KA410_LAN_END, KA410_LAN_SIZE, 0 },
+ { KA410_CUR_BASE, KA410_CUR_END, KA410_CUR_SIZE, 0 },
+ { KA410_DMA_BASE, KA410_DMA_END, KA410_DMA_SIZE, 0 },
/*
* there's more to come, eg. framebuffers (mono + GPX)
*/
{0, 0, 0, 0},
};
-int
-ka410_setup(uc,flags)
- struct uvax_calls *uc;
- int flags;
-{
- uc->uc_name = "ka410";
-
- uc->uc_phys2virt = NULL; /* ka410_mapaddr; */
- uc->uc_physmap = ka410_map; /* ptv_map ? p2v_map */
-
- uc->uc_steal_pages = ka410_steal_pages;
- uc->uc_conf = ka410_conf;
- uc->uc_clkread = ka410_clkread;
- uc->uc_clkwrite = ka410_clkwrite;
-
-#ifdef notyet
- uc->uc_memerr = ka410_memerr;
- uc->uc_mchk = ka410_mchk;
-#endif
-
- uc->uc_intreq = (void*)KA410_INTREQ;
- uc->uc_intclr = (void*)KA410_INTCLR;
- uc->uc_intmsk = (void*)KA410_INTMSK;
+/*
+ * Declaration of 410-specific calls.
+ */
+struct cpu_dep ka410_calls = {
+ ka410_steal_pages,
+ no_nicr_clock,
+ ka410_mchk,
+ ka410_memerr,
+ ka410_conf,
+ chip_clkread,
+ chip_clkwrite,
+ 1, /* ~VUPS */
+ (void*)KA410_INTREQ, /* Used by vaxstation */
+ (void*)KA410_INTCLR, /* Used by vaxstation */
+ (void*)KA410_INTMSK, /* Used by vaxstation */
+ ka410_map,
+};
- uc->uc_busTypes = VAX_VSBUS;
-}
void
ka410_conf(parent, self, aux)
@@ -123,32 +103,52 @@ ka410_conf(parent, self, aux)
{
extern char cpu_model[];
- if (vax_confdata & 0x80) /* MSB in CFGTST */
- strcpy(cpu_model,"MicroVAX 2000");
- else
- strcpy(cpu_model,"VAXstation 2000");
+ switch (vax_cputype) {
+ case VAX_TYP_UV2:
+ if (vax_confdata & 0x80) /* MSB in CFGTST */
+ strcpy(cpu_model,"MicroVAX 2000");
+ else
+ strcpy(cpu_model,"VAXstation 2000");
+ break;
+
+ case VAX_TYP_CVAX:
+ /* if (((vax_siedata >> 8) & 0xff) == 2) */
+ strcpy(cpu_model,"MicroVAX 3100 (KA41)");
+ /* ka41_cache_enable(); */
+ }
printf(": %s\n", cpu_model);
}
+void
+ka410_memerr()
+{
+ printf("Memory err!\n");
+}
+
+int
+ka410_mchk(addr)
+ caddr_t addr;
+{
+ panic("Machine check");
+}
-/*
- *
- */
u_long le_iomem; /* base addr of RAM -- CPU's view */
u_long le_ioaddr; /* base addr of RAM -- LANCE's view */
void
ka410_steal_pages()
{
- extern vm_offset_t avail_start, virtual_avail, avail_end;
+ extern vm_offset_t avail_start, virtual_avail, avail_end;
+ extern short *clk_page;
+ extern int clk_adrshift, clk_tweak;
int junk;
int i;
struct {
- u_long :2;
- u_long data:8;
- u_long :22;
+ u_long :2;
+ u_long data:8;
+ u_long :22;
} *p;
int *srp; /* Scratch Ram */
char *q = (void*)&srp;
@@ -157,17 +157,17 @@ ka410_steal_pages()
p = (void*)KA410_SCR;
for (i=0; i<4; i++) {
printf("p[%d] = %x, ", i, p[i].data);
- q[i] = p[i].data;
+ q[i] = p[i].data;
}
p = (void*)KA410_SCRLEN;
printf("\nlen = %d\n", p->data);
printf("srp = 0x%x\n", srp);
for (i=0; i<0x2; i++) {
- printf("%x:0x%x ", i*4, srp[i]);
- if ((i & 0x07) == 0x07)
- printf("\n");
- }
+ printf("%x:0x%x ", i*4, srp[i]);
+ if ((i & 0x07) == 0x07)
+ printf("\n");
+ }
printf("\n");
/*
@@ -178,6 +178,12 @@ ka410_steal_pages()
*/
MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE);
+ clk_adrshift = 1; /* Addressed at long's... */
+ clk_tweak = 2; /* ...and shift two */
+ MAPVIRT(clk_page, 2);
+ pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA410_WAT_BASE,
+ (vm_offset_t)KA410_WAT_BASE + NBPG, VM_PROT_READ|VM_PROT_WRITE);
+
/*
* At top of physical memory there are some console-prom and/or
* restart-specific data. Make this area unavailable.
@@ -216,35 +222,18 @@ ka410_steal_pages()
* pmap_map(ptr,...) inserts a pair of virtual/physical addresses
* into the system maptable (Sysmap)
*/
- uVAX_fillmap(ka410_map);
+ uvax_fillmap();
/*
* Clear restart and boot in progress flags
* in the CPMBX. (ie. clear bits 4 and 5)
*/
- ka410_clkptr->cpmbx = (ka410_clkptr->cpmbx & ~0x30);
+ KA410_WAT_BASE->cpmbx = (KA410_WAT_BASE->cpmbx & ~0x30);
/*
* Enable memory parity error detection and clear error bits.
*/
- ka410_cpuptr->ka410_mser = 1;
+ KA410_CPU_BASE->ka410_mser = 1;
/* (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); */
- /*
- * MM is not yet enabled, thus we still used the physical addresses,
- * but before leaving this routine, we need to reset them to virtual.
- */
- ka410_cpuptr = (void*)uvax_phys2virt(KA410_CPU_BASE);
- ka410_clkptr = (void*)uvax_phys2virt(KA410_WAT_BASE);
-
}
-/*
- * define what we need and overwrite the uVAX_??? names
- */
-
-#define uVAX_clock ka410_clock
-#define uVAX_clkptr ka410_clkptr
-#define uVAX_clkread ka410_clkread
-#define uVAX_clkwrite ka410_clkwrite
-
-#include <arch/vax/vax/uvax_proto.c>
diff --git a/sys/arch/vax/vax/ka43.c b/sys/arch/vax/vax/ka43.c
index 55be467a39b..768fd02ea86 100644
--- a/sys/arch/vax/vax/ka43.c
+++ b/sys/arch/vax/vax/ka43.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka43.c,v 1.2 1997/05/29 00:05:20 niklas Exp $ */
-/* $NetBSD: ka43.c,v 1.3 1996/10/13 03:35:43 christos Exp $ */
+/* $OpenBSD: ka43.c,v 1.3 1997/09/10 12:04:46 maja Exp $ */
+/* $NetBSD: ka43.c,v 1.5 1997/04/18 18:53:38 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -16,8 +16,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed at Ludd, University of
- * Lule}, Sweden and its contributors.
+ * This product includes software developed at Ludd, University of
+ * Lule}, Sweden and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@@ -42,6 +42,7 @@
#include <vm/vm_kern.h>
#include <machine/pte.h>
+#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <machine/sid.h>
#include <machine/pmap.h>
@@ -49,22 +50,22 @@
#include <machine/uvax.h>
#include <machine/ka43.h>
#include <machine/clock.h>
-#include <machine/ka650.h> /* cache ??? */
-
-#define xtrace(x)
void ka43_conf __P((struct device*, struct device*, void*));
void ka43_steal_pages __P((void));
-void ka43_memerr __P((void));
int ka43_mchk __P((caddr_t));
+void ka43_memerr __P((void));
-struct ka43_cpu *ka43_cpuptr = (void*)KA43_CPU_BASE;
-struct ka43_clock *ka43_clkptr = (void*)KA43_WAT_BASE;
+int ka43_clear_errors __P((void));
-extern int uVAX_fillmap __P((struct uc_map *));
+int ka43_cache_init __P((void)); /* "int mapen" as argument? */
+int ka43_cache_reset __P((void));
+int ka43_cache_enable __P((void));
+int ka43_cache_disable __P((void));
+int ka43_cache_invalidate __P((void));
-struct uc_map ka43_map[] = {
+static struct uc_map ka43_map[] = {
{ KA43_CFGTST, KA43_CFGTST, 4, 0 },
{ KA43_ROM_BASE, KA43_ROM_END, KA43_ROM_SIZE, 0 },
{ KA43_CPU_BASE, KA43_CPU_END, KA43_CPU_SIZE, 0 },
@@ -84,206 +85,235 @@ struct uc_map ka43_map[] = {
{0, 0, 0, 0},
};
-#define CH1_BITS \
- "\020\015BCHIT\014BUSERR\013PPERR\012DPERR\011TPERR\010TRAP1" \
- "\007TRAP2\006INTR\005HIT\004REFRESH\003FLUSH\002ENABLE\001FORCEHIT"
-
-#define CH2_BITS \
- "\020\010TPE\007DPE\006MISS\005DIRTY\004CERR\003LERR\002SERR\001ENAB"
-
-void
-ka43_memerr()
-{
- int mapen;
- int *ch2reg;
+struct cpu_dep ka43_calls = {
+ ka43_steal_pages,
+ no_nicr_clock,
+ ka43_mchk,
+ ka43_memerr,
+ ka43_conf,
+ chip_clkread,
+ chip_clkwrite,
+ 7, /* 7.6 VUP */
+ (void*)KA43_INTREQ,
+ (void*)KA43_INTCLR,
+ (void*)KA43_INTMSK,
+ ka43_map,
+};
- printf("memory error!\n");
- printf("primary cache status: %b\n", mfpr(PR_PCSTS), CH1_BITS);
-
- mapen = mfpr(PR_MAPEN);
- if (mapen)
- ch2reg = (void*)uvax_phys2virt(KA43_CH2_CREG);
- else
- ch2reg = (void*)KA43_CH2_CREG;
- printf("secondary cache status: %b\n", *ch2reg, CH2_BITS);
-}
+/*
+ * ka43_steal_pages() is called with MMU disabled, after that call MMU gets
+ * enabled. Thus we initialize these four pointers with physical addresses,
+ * but before leving ka43_steal_pages() we reset them to virtual addresses.
+ */
+struct ka43_cpu *ka43_cpu = (void*)KA43_CPU_BASE;
+
+u_int *ka43_creg = (void*)KA43_CH2_CREG;
+u_int *ka43_ctag = (void*)KA43_CT2_BASE;
+
+#define KA43_MC_RESTART 0x00008000 /* Restart possible*/
+#define KA43_PSL_FPDONE 0x00010000 /* First Part Done */
+
+struct ka43_mcframe { /* Format of RigelMAX machine check frame: */
+ int mc43_bcnt; /* byte count, always 24 (0x18) */
+ int mc43_code; /* machine check type code and restart bit */
+ int mc43_addr; /* most recent (faulting?) virtual address */
+ int mc43_viba; /* contents of VIBA register */
+ int mc43_sisr; /* ICCS bit 6 and SISR bits 15:0 */
+ int mc43_istate; /* internal state */
+ int mc43_sc; /* shift count register */
+ int mc43_pc; /* trapped PC */
+ int mc43_psl; /* trapped PSL */
+};
-static char *mcc43[] = {
- "no error (0)",
- "FPA signalled protocoll error",
- "FPA signalled illegal opcode",
- "FPA detected parity error",
- "FPA returned unknown status",
- "FPA result has parity error",
- "unused (6)",
+static char *ka43_mctype[] = {
+ "no error (0)", /* Code 0: No error */
+ "FPA: protocol error", /* Code 1-5: FPA errors */
+ "FPA: illegal opcode",
+ "FPA: operand parity error",
+ "FPA: unknown status",
+ "FPA: result parity error",
+ "unused (6)", /* Code 6-7: Unused */
"unused (7)",
- "MMU error (TLB miss)",
+ "MMU error (TLB miss)", /* Code 8-9: MMU errors */
"MMU error (TLB hit)",
- "HW interrupt at unused IPL",
- "impossible microcode state",
+ "HW interrupt at unused IPL", /* Code 10: Interrupt error */
+ "MOVCx impossible state", /* Code 11-13: Microcode errors */
"undefined trap code (i-box)",
"undefined control store address",
- "unused (14)",
+ "unused (14)", /* Code 14-15: Unused */
"unused (15)",
- "PC tag or data parity error",
- "data bus parity error",
- "data bus error (NXM)",
- "undefined data bus state",
+ "PC tag or data parity error", /* Code 16: Cache error */
+ "data bus parity error", /* Code 17: Read error */
+ "data bus error (NXM)", /* Code 18: Write error */
+ "undefined data bus state", /* Code 19: Bus error */
};
+#define MC43_MAX 19
+
+static int ka43_error_count = 0;
int
ka43_mchk(addr)
caddr_t addr;
{
- struct {
- int bcount; /* byte count (0x18) */
- int mcc; /* "R"-flag and machine check code */
- int mrva; /* most recent virtual address */
- int viba; /* contents of VIBA register */
- int sisr; /* ICCS bit 6 and SISR bits 15:0 */
- int isd; /* internal state */
- int scr; /* shift count register */
- int pc; /* program counter */
- int psl; /* processor status longword */
- } *p = (void*)addr;
-
- printf("machine check: 0x%x\n", p->mcc);
- printf("reason: %s\n", mcc43[p->mcc & 0xff]);
-
- printf("bcount:0x%x, check-code:0x%x, virtaddr:0x%x\n",
- p->bcount, p->mcc, p->mrva);
- printf("pc:0x%x, psl:0x%x, viba: %x, state: %x\n",
- p->pc, p->psl, p->viba, p->isd);
+ register struct ka43_mcframe *mcf = (void*)addr;
+
+ mtpr(0x00, PR_MCESR); /* Acknowledge the machine check */
+ printf("machine check %d (0x%x)\n", mcf->mc43_code, mcf->mc43_code);
+ printf("reason: %s\n", ka43_mctype[mcf->mc43_code & 0xff]);
+ if (++ka43_error_count > 10) {
+ printf("error_count exceeded: %d\n", ka43_error_count);
+ return (-1);
+ }
+
+ /*
+ * If either the Restart flag is set or the First-Part-Done flag
+ * is set, and the TRAP2 (double error) bit is not set, the the
+ * error is recoverable.
+ */
+ if (mfpr(PR_PCSTS) & KA43_PCS_TRAP2) {
+ printf("TRAP2 (double error) in ka43_mchk.\n");
+ panic("unrecoverable state in ka43_mchk.\n");
+ return (-1);
+ }
+ if ((mcf->mc43_code & KA43_MC_RESTART) ||
+ (mcf->mc43_psl & KA43_PSL_FPDONE)) {
+ printf("ka43_mchk: recovering from machine-check.\n");
+ ka43_cache_reset(); /* reset caches */
+ return (0); /* go on; */
+ }
+ /*
+ * Unknown error state, panic/halt the machine!
+ */
+ printf("ka43_mchk: unknown error state!\n");
return (-1);
}
-int
-ka43_setup(uc,flags)
- struct uvax_calls *uc;
- int flags;
+void
+ka43_memerr()
{
- uc->uc_name = "ka43";
+ /*
+ * Don\'t know what to do here. So just print some messages
+ * and try to go on...
+ */
+ printf("memory error!\n");
+ printf("primary cache status: %b\n", mfpr(PR_PCSTS), KA43_PCSTS_BITS);
+ printf("secondary cache status: %b\n", *ka43_creg, KA43_SESR_BITS);
+}
- uc->uc_phys2virt = NULL;
- uc->uc_physmap = ka43_map;
+int
+ka43_cache_init()
+{
+ return (ka43_cache_reset());
+}
- uc->uc_steal_pages = ka43_steal_pages;
- uc->uc_conf = ka43_conf;
- uc->uc_clkread = ka43_clkread;
- uc->uc_clkwrite = ka43_clkwrite;
+int
+ka43_clear_errors()
+{
+ int val = *ka43_creg;
+ val |= KA43_SESR_SERR | KA43_SESR_LERR | KA43_SESR_CERR;
+ *ka43_creg = val;
+}
- uc->uc_memerr = ka43_memerr;
- uc->uc_mchk = ka43_mchk;
+int
+ka43_cache_reset()
+{
+ /*
+ * resetting primary and secondary caches is done in three steps:
+ * 1. disable both caches
+ * 2. manually clear secondary cache
+ * 3. enable both caches
+ */
+ ka43_cache_disable();
+ ka43_cache_invalidate();
+ ka43_cache_enable();
- uc->uc_intreq = (void*)KA43_INTREQ;
- uc->uc_intclr = (void*)KA43_INTCLR;
- uc->uc_intmsk = (void*)KA43_INTMSK;
+ printf("primary cache status: %b\n", mfpr(PR_PCSTS), KA43_PCSTS_BITS);
+ printf("secondary cache status: %b\n", *ka43_creg, KA43_SESR_BITS);
+ printf("cpu status: parctl=0x%x, hltcod=0x%x\n",
+ ka43_cpu->parctl, ka43_cpu->hltcod);
- uc->uc_busTypes = VAX_VSBUS;
+ return (0);
}
-ka43_discache()
+int
+ka43_cache_disable()
{
- int *ctag;
- int *creg;
- int mapen;
- int i;
-
- xtrace(("ka43_discache()\n"));
- return (0);
+ int i, val;
/*
- * first disable primary cache
+ * first disable primary cache and clear error flags
*/
-#if 0
- mtpr(0, PR_PCSTS);
- mtpr(0, PR_PCERR);
- mtpr(0, PR_PCIDX);
- mtpr(0, PR_PCTAG);
-#else
- i = mfpr(PR_PCSTS);
- mtpr((i & ~2), PR_PCSTS);
- printf("pcsts: %x --> %x\n", i, mfpr(PR_PCSTS));
-#endif
+ mtpr(KA43_PCS_REFRESH, PR_PCSTS); /* disable primary cache */
+ val = mfpr(PR_PCSTS);
+ mtpr(val, PR_PCSTS); /* clear error flags */
+
/*
- * now secondary cache
+ * now disable secondary cache and clear error flags
*/
- mapen = mfpr(PR_MAPEN);
- if (mapen) {
- ctag = (void*)uvax_phys2virt(KA43_CT2_BASE);
- creg = (void*)uvax_phys2virt(KA43_CH2_CREG);
- } else {
- ctag = (void*)KA43_CT2_BASE;
- creg = (void*)KA43_CH2_CREG;
- }
- i = *creg;
- *creg = (i & ~1);
- printf("creg: %x --> %x\n", i, *creg);
-
- xtrace(("ka43_discache() done.\n"));
+ val = *ka43_creg & ~KA43_SESR_CENB; /* BICL !!! */
+ *ka43_creg = val; /* disable secondary cache */
+ val = KA43_SESR_SERR | KA43_SESR_LERR | KA43_SESR_CERR;
+ *ka43_creg = val; /* clear error flags */
+
+ return (0);
}
-ka43_encache()
+int
+ka43_cache_invalidate()
{
- int *ctag;
- int *creg;
- int mapen;
- int i;
-
- xtrace(("ka43_encache()\n"));
+ int i, val;
- ka43_discache();
+ val = KA43_PCTAG_PARITY; /* clear valid flag, set parity bit */
+ for (i = 0; i < 256; i++) { /* 256 Quadword entries */
+ mtpr(i*8, PR_PCIDX); /* write index of tag */
+ mtpr(val, PR_PCTAG); /* write value into tag */
+ }
+ val = KA43_PCS_FLUSH | KA43_PCS_REFRESH;
+ mtpr(val, PR_PCSTS); /* flush primary cache */
/*
- * first enable primary cache
+ * Rigel\'s secondary cache doesn\'t implement a valid-flag.
+ * Thus we initialize all entries with out-of-range/dummy
+ * addresses which will never be referenced (ie. never hit).
+ * After enabling cache we also access 128K of memory starting
+ * at 0x00 so that secondary cache will be filled with these
+ * valid addresses...
*/
- printf("P-0");
- i = mfpr(PR_PCSTS);
- mtpr((i & ~2), PR_PCSTS);
- mtpr(0, PR_PCSTS);
- printf("P-1");
-#if 1
- mtpr(KA43_PCS_ENABLE | KA43_PCS_FLUSH | KA43_PCS_REFRESH, PR_PCSTS);
-#else
- mtpr(KA43_PCS_ENABLE, PR_PCSTS);
-#endif
- printf("P-2");
+ val = 0xff;
+ /* if (memory > 28 MB) val = 0x55; */
+ printf("clearing tags...\n");
+ for (i = 0; i < KA43_CT2_SIZE; i+= 4) { /* Quadword entries ?? */
+ ka43_ctag[i/4] = val; /* reset upper and lower */
+ }
+
+ return (0);
+}
+
+
+int
+ka43_cache_enable()
+{
+ volatile char *membase = (void*)0x80000000; /* physical 0x00 */
+ int i, val;
+
+ val = KA43_PCS_FLUSH | KA43_PCS_REFRESH;
+ mtpr(val, PR_PCSTS); /* flush primary cache */
/*
- * now secondary cache
+ * now we enable secondary cache and access first 128K of memory
+ * so that secondary cache gets really initialized and holds
+ * valid addresses/data...
*/
- mapen = mfpr(PR_MAPEN);
- if (mapen) {
- ctag = (void*)uvax_phys2virt(KA43_CT2_BASE);
- creg = (void*)uvax_phys2virt(KA43_CH2_CREG);
- } else {
- ctag = (void*)KA43_CT2_BASE;
- creg = (void*)KA43_CH2_CREG;
+ *ka43_creg = KA43_SESR_CENB; /* enable secondary cache */
+ for (i=0; i<128*1024; i++) {
+ val += membase[i]; /* some dummy operation... */
}
- printf("ctag: %x, creg: %x\n", ctag, creg);
- printf("S-1");
- i = *creg;
- printf("creg=[%x] ", *creg);
-#if 0
- *creg = (i & ~1);
- printf("creg=[%x] ", *creg);
- printf("S-2");
- for (i = 0; i < KA43_CT2_SIZE; i += 4) /* Quadword entries */
- ctag[i/4] = 0; /* reset lower half */
- printf("S-3");
- i = *creg;
- printf("creg=[%x] ", *creg);
- *creg = (i & ~1);
- printf("creg=[%x] ", *creg);
- printf("S-4");
- /* *creg = 1; */
- printf("S-5");
-#endif
- xtrace(("ka43_encache() done.\n"));
- printf("primary cache status: %b\n", mfpr(PR_PCSTS), CH1_BITS);
- printf("secondary cache status: %b\n", *creg, CH2_BITS);
+ val = KA43_PCS_ENABLE | KA43_PCS_REFRESH;
+ mtpr(val, PR_PCSTS); /* enable primary cache */
+
+ return (0);
}
void
@@ -303,12 +333,18 @@ ka43_conf(parent, self, aux)
printf(": %s\n", cpu_model);
- ka43_encache();
+ /*
+ * ka43_conf() gets called with MMU enabled, now it's save to
+ * init/reset the caches.
+ */
+ ka43_cache_init();
}
/*
- *
+ * The interface for communication with the LANCE ethernet controller
+ * is setup in the xxx_steal_pages() routine. We decrease highest
+ * available address by 64K and use this area as communication buffer.
*/
u_long le_iomem; /* base addr of RAM -- CPU's view */
u_long le_ioaddr; /* base addr of RAM -- LANCE's view */
@@ -316,49 +352,11 @@ u_long le_ioaddr; /* base addr of RAM -- LANCE's view */
void
ka43_steal_pages()
{
- extern vm_offset_t avail_start, virtual_avail, avail_end;
- int junk;
+ extern vm_offset_t avail_start, virtual_avail, avail_end;
+ extern short *clk_page;
+ extern int clk_adrshift, clk_tweak;
+ int junk, val;
int i;
- struct {
- u_long :2;
- u_long data:8;
- u_long :22;
- } *p;
- int *srp; /* Scratch Ram */
- int *pctl; /* parity control register */
- char *q = (void*)&srp;
- char line[20];
-
- ka43_encache();
-
- pctl = (void*)KA43_PARCTL;
- printf("parctl: 0x%x\n", *pctl);
-#if 0
- *pctl = KA43_PCTL_DPEN | KA43_PCTL_CPEN;
-#else
- *pctl = KA43_PCTL_CPEN;
-#endif
- printf("new value for parctl: ");
- gets(line);
- *pctl = *line - '0';
- printf("parctl: 0x%x\n", *pctl);
-
- srp = NULL;
- p = (void*)KA43_SCR;
- for (i=0; i<4; i++) {
- printf("p[%d] = %x, ", i, p[i].data);
- q[i] = p[i].data;
- }
- p = (void*)KA43_SCRLEN;
- printf("\nlen = %d\n", p->data);
- printf("srp = 0x%x\n", srp);
-
- for (i=0; i<0x2; i++) {
- printf("%x:0x%x ", i*4, srp[i]);
- if ((i & 0x07) == 0x07)
- printf("\n");
- }
- printf("\n");
printf ("ka43_steal_pages: avail_end=0x%x\n", avail_end);
@@ -370,76 +368,88 @@ ka43_steal_pages()
*/
MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE);
+ clk_adrshift = 1; /* Addressed at long's... */
+ clk_tweak = 2; /* ...and shift two */
+ MAPVIRT(clk_page, 2);
+ pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA43_WAT_BASE,
+ (vm_offset_t)KA43_WAT_BASE + NBPG, VM_PROT_READ|VM_PROT_WRITE);
+
+#if 0
/*
* At top of physical memory there are some console-prom and/or
* restart-specific data. Make this area unavailable.
*/
-#if 1
- avail_end -= 10 * NBPG;
+ avail_end -= 64 * NBPG; /* scratch RAM ??? */
+ avail_end = 0x00FC0000; /* XXX: for now from ">>> show mem" */
+
+This is no longer neccessary since the memsize in RPB does not include
+these unavailable pages. Only valid/available pages are counted in RPB.
+
#endif
/*
* If we need to map physical areas also, we can decrease avail_end
* (the highest available memory-address), copy the stuff into the
- * gap between and use pmap_map to map it...
+ * gap between and use pmap_map to map it. This is done for LANCE's
+ * 64K communication area.
*
* Don't use the MAPPHYS macro here, since this uses and changes(!)
* the value of avail_start. Use MAPVIRT even if it's name misleads.
*/
- avail_end &= ~0xffff;
- avail_end -= (64 * 1024);
-
- avail_end = 0xf00000;
- le_ioaddr = 0xf40000;
+ avail_end -= (64 * 1024); /* reserve 64K */
+ avail_end &= ~0xffff; /* force proper (quad?) alignment */
+ /*
+ * Oh holy shit! It took me over one year(!) to find out that
+ * the 3100/76 has to use diag-mem instead of physical memory
+ * for communication with LANCE (using phys-mem results in
+ * parity errors and mchk exceptions with code 17 (0x11)).
+ *
+ * Many thanks to Matt Thomas, without his help it could have
+ * been some more years... ;-)
+ */
+ le_ioaddr = avail_end | KA43_DIAGMEM; /* ioaddr in diag-mem!!! */
MAPVIRT(le_iomem, (64 * 1024)/NBPG);
pmap_map((vm_offset_t)le_iomem, le_ioaddr, le_ioaddr + 0xffff,
VM_PROT_READ|VM_PROT_WRITE);
- if (1 || le_ioaddr > 0xffffff) {
- le_ioaddr &= 0xffffff;
- *pctl |= KA43_PCTL_DMA;
- }
- printf("le_iomem: %x, le_ioaddr: %x, parctl:%x\n",
- le_iomem, le_ioaddr, *pctl);
+ /*
+ * if LANCE\'s io-buffer is above 16 MB, then the appropriate flag
+ * in the parity control register has to be set (it works as an
+ * additional address bit). In any case, don\'t enable CPEN and
+ * DPEN in the PARCTL register, somewhow they are internally managed
+ * by the RIGEL chip itself!?!
+ */
+ val = ka43_cpu->parctl & 0x03; /* read the old value */
+ if (le_ioaddr & (1 << 24)) /* if RAM above 16 MB */
+ val |= KA43_PCTL_DMA; /* set LANCE DMA flag */
+ ka43_cpu->parctl = val; /* and write new value */
+ le_ioaddr &= 0xffffff; /* Lance uses 24-bit addresses */
/*
* now map in anything listed in ka43_map...
*/
- uVAX_fillmap(ka43_map);
+ uvax_fillmap();
/*
* Clear restart and boot in progress flags in the CPMBX.
*/
- ka43_clkptr->cpmbx = ka43_clkptr->cpmbx & 0xF0;
+ ((struct ka43_clock *)KA43_WAT_BASE)->cpmbx =
+ ((struct ka43_clock *)KA43_WAT_BASE)->cpmbx & 0xF0;
+#if 0
/*
- * Enable memory parity error detection and clear error bits.
+ * Clear all error flags, not really neccessary here, this will
+ * be done by ka43_cache_init() anyway...
*/
- ka43_cpuptr->ka43_mser = 0x01;
- /* (UVAXIIMSER_PEN | UVAXIIMSER_MERR | UVAXIIMSER_LEB); */
+ ka43_clear_errors();
+#endif
/*
* MM is not yet enabled, thus we still used the physical addresses,
* but before leaving this routine, we need to reset them to virtual.
*/
- ka43_cpuptr = (void*)uvax_phys2virt(KA43_CPU_BASE);
- ka43_clkptr = (void*)uvax_phys2virt(KA43_WAT_BASE);
-
- printf ("steal_pages done.\n");
+ ka43_cpu = (void*)uvax_phys2virt(KA43_CPU_BASE);
+ ka43_creg = (void*)uvax_phys2virt(KA43_CH2_CREG);
+ ka43_ctag = (void*)uvax_phys2virt(KA43_CT2_BASE);
}
-
-/*
- * define what we need and overwrite the uVAX_??? names
- */
-
-#define NEED_UVAX_GENCLOCK
-#define NEED_UVAX_PROTOCLOCK
-
-#define uVAX_clock ka43_clock
-#define uVAX_clkptr ka43_clkptr
-#define uVAX_clkread ka43_clkread
-#define uVAX_clkwrite ka43_clkwrite
-#define uVAX_genclock ka43_genclock
-
-#include <arch/vax/vax/uvax_proto.c>
diff --git a/sys/arch/vax/vax/ka630.c b/sys/arch/vax/vax/ka630.c
index 45ffb651a7a..72511886c3d 100644
--- a/sys/arch/vax/vax/ka630.c
+++ b/sys/arch/vax/vax/ka630.c
@@ -1,8 +1,8 @@
-/* $OpenBSD: ka630.c,v 1.2 1997/05/29 00:05:20 niklas Exp $ */
-/* $NetBSD: ka630.c,v 1.4 1996/10/13 03:35:44 christos Exp $ */
+/* $OpenBSD: ka630.c,v 1.3 1997/09/10 12:04:47 maja Exp $ */
+/* $NetBSD: ka630.c,v 1.6 1997/04/18 18:49:36 ragge Exp $ */
/*-
* Copyright (c) 1982, 1988, 1990, 1993
- * The Regents of the University of California. All rights reserved.
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)ka630.c 7.8 (Berkeley) 5/9/91
+ * @(#)ka630.c 7.8 (Berkeley) 5/9/91
*/
#include <sys/param.h>
@@ -45,6 +45,7 @@
#include <vm/vm_kern.h>
#include <machine/pte.h>
+#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <machine/sid.h>
#include <machine/pmap.h>
@@ -53,38 +54,27 @@
#include <machine/ka630.h>
#include <machine/clock.h>
-struct uvaxIIcpu *uvaxIIcpu_ptr;
-
-struct ka630clock *ka630_clkptr = KA630CLK;
+static struct uvaxIIcpu *uvaxIIcpu_ptr;
static void ka630_conf __P((struct device *, struct device *, void *));
static void ka630_memerr __P((void));
static int ka630_mchk __P((caddr_t));
static void ka630_steal_pages __P((void));
+struct cpu_dep ka630_calls = {
+ ka630_steal_pages,
+ no_nicr_clock,
+ ka630_mchk,
+ ka630_memerr,
+ ka630_conf,
+ chip_clkread,
+ chip_clkwrite,
+ 1, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
-int
-ka630_setup(uc,flags)
- struct uvax_calls *uc;
- int flags;
-{
- uc->uc_name = "ka630";
-
- uc->uc_phys2virt = NULL;
- uc->uc_physmap = NULL; /* ptv_map ? p2v_map */
-
- uc->uc_steal_pages = ka630_steal_pages;
- uc->uc_conf = ka630_conf;
- uc->uc_clkread = ka630_clkread;
- uc->uc_clkwrite = ka630_clkwrite;
-
-#ifdef notyet
- uc->uc_memerr = ka630_memerr;
- uc->uc_mchk = ka630_mchk;
-#endif
-
- uc->uc_busTypes = VAX_UNIBUS;
-}
+};
/*
* uvaxII_conf() is called by cpu_attach to do the cpu_specific setup.
@@ -101,7 +91,8 @@ ka630_conf(parent, self, aux)
}
/* log crd errors */
-uvaxII_memerr()
+void
+ka630_memerr()
{
printf("memory err!\n");
}
@@ -122,7 +113,7 @@ struct mc78032frame {
int mc63_psl; /* trapped psl */
};
-uvaxII_mchk(cmcf)
+ka630_mchk(cmcf)
caddr_t cmcf;
{
register struct mc78032frame *mcf = (struct mc78032frame *)cmcf;
@@ -148,7 +139,9 @@ uvaxII_mchk(cmcf)
void
ka630_steal_pages()
{
- extern vm_offset_t avail_start, virtual_avail, avail_end;
+ extern vm_offset_t avail_start, virtual_avail, avail_end;
+ extern short *clk_page;
+ extern int clk_adrshift, clk_tweak;
int junk;
/*
@@ -166,29 +159,21 @@ ka630_steal_pages()
pmap_map((vm_offset_t)uvaxIIcpu_ptr, (vm_offset_t)UVAXIICPU,
(vm_offset_t)UVAXIICPU + NBPG, VM_PROT_READ|VM_PROT_WRITE);
- MAPVIRT(ka630_clkptr, 1);
- pmap_map((vm_offset_t)ka630_clkptr, (vm_offset_t)KA630CLK,
+ clk_adrshift = 0; /* Addressed at short's... */
+ clk_tweak = 0; /* ...and no shifting */
+ MAPVIRT(clk_page, 1);
+ pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA630CLK,
(vm_offset_t)KA630CLK + NBPG, VM_PROT_READ|VM_PROT_WRITE);
/*
- * Clear restart and boot in progress flags
- * in the CPMBX.
- /
- ka630clk_ptr->cpmbx = (ka630clk_ptr->cpmbx & KA630CLK_LANG);
+ * Clear restart and boot in progress flags in the CPMBX.
+ * Note: We are not running virtual yet.
+ */
+ KA630CLK->cpmbx = (KA630CLK->cpmbx & KA630CLK_LANG);
/*
* Enable memory parity error detection and clear error bits.
*/
- uvaxIIcpu_ptr->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR |
+ UVAXIICPU->uvaxII_mser = (UVAXIIMSER_PEN | UVAXIIMSER_MERR |
UVAXIIMSER_LEB);
-
}
-#define uVAX_gettodr ka630_gettodr
-#define uVAX_settodr ka630_settodr
-#define uVAX_clkptr ka630_clkptr
-#define uVAX_genclock ka630_genclock
-#define uVAX_clock ka630clock
-#define uVAX_clkread ka630_clkread
-#define uVAX_clkwrite ka630_clkwrite
-
-#include <arch/vax/vax/uvax_proto.c>
diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c
index 94c15538669..acca6d0ef67 100644
--- a/sys/arch/vax/vax/ka650.c
+++ b/sys/arch/vax/vax/ka650.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka650.c,v 1.4 1997/05/29 00:05:21 niklas Exp $ */
-/* $NetBSD: ka650.c,v 1.7 1997/01/11 11:31:57 ragge Exp $ */
+/* $OpenBSD: ka650.c,v 1.5 1997/09/10 12:04:47 maja Exp $ */
+/* $NetBSD: ka650.c,v 1.9 1997/02/19 10:04:16 ragge Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
@@ -51,10 +51,12 @@
#include <vm/vm_kern.h>
#include <machine/ka650.h>
+#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/psl.h>
#include <machine/mtpr.h>
#include <machine/nexus.h>
+#include <machine/sid.h>
struct ka650_merr *ka650merr_ptr;
struct ka650_cbd *ka650cbd_ptr;
@@ -63,8 +65,25 @@ struct ka650_ipcr *ka650ipcr_ptr;
int *KA650_CACHE_ptr;
static int subtyp;
-void ka650encache __P((void));
-void ka650discache __P((void));
+#define CACHEOFF 0
+#define CACHEON 1
+
+void ka650setcache __P((int));
+
+struct cpu_dep ka650_calls = {
+ uvaxIII_steal_pages,
+ no_nicr_clock,
+ uvaxIII_mchk,
+ uvaxIII_memerr,
+ uvaxIII_conf,
+ generic_clkread,
+ generic_clkwrite,
+ 4, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+
+};
/*
* uvaxIII_conf() is called by cpu_attach to do the cpu_specific setup.
@@ -75,14 +94,37 @@ uvaxIII_conf(parent, self, aux)
void *aux;
{
extern char cpu_model[];
+ int syssub = GETSYSSUBT(subtyp);
+ char *str;
/*
* There are lots of different MicroVAX III models, we should
- * check which here. but that later...
+ * check which hereas there are some differences in the setup code
+ * that depends on this.
*/
- strcpy(cpu_model,"MicroVAX III");
- printf(": %s\n", cpu_model);
- ka650encache();
+ strcpy(cpu_model,"MicroVAX ");
+ switch (syssub) {
+ case VAX_SIE_KA640:
+ str = "3300/3400";
+ break;
+
+ case VAX_SIE_KA650:
+ str = "3500/3600";
+ break;
+
+ case VAX_SIE_KA655:
+ str = "3800/3900";
+ break;
+
+ default:
+ str = "III";
+ break;
+ }
+ strcat(cpu_model, str);
+ printf(": %s\n",cpu_model);
+ printf("%s: CVAX microcode rev %d Firmware rev %d\n", self->dv_xname,
+ (vax_cpudata & 0xff), GETFRMREV(subtyp));
+ ka650setcache(CACHEON);
if (ctob(physmem) > ka650merr_ptr->merr_qbmbr) {
printf("physmem(0x%x) > qbmbr(0x%x)\n",
ctob(physmem), (int)ka650merr_ptr->merr_qbmbr);
@@ -145,12 +187,12 @@ uvaxIII_memerr()
if (ka650cbd.cbd_cacr & CACR_CPE) {
printf("cache 2 tag parity error: ");
if (time.tv_sec - cache2tag < 7) {
- ka650discache();
+ ka650setcache(CACHEOFF);
printf("cacheing disabled\n");
} else {
cache2tag = time.tv_sec;
printf("flushing cache\n");
- ka650encache();
+ ka650setcache(CACHEON);
}
}
m = ka650merr.merr_errstat;
@@ -235,11 +277,11 @@ uvaxIII_mchk(cmcf)
cdalerr = time.tv_sec;
}
if (time.tv_sec - i < 7) {
- ka650discache();
+ ka650setcache(CACHEOFF);
printf(" parity error: cacheing disabled\n");
} else {
printf(" parity error: flushing cache\n");
- ka650encache();
+ ka650setcache(CACHEON);
}
/*
* May be able to recover if type is 1-4, 0x80 or 0x81, but
@@ -262,20 +304,24 @@ uvaxIII_mchk(cmcf)
* Enable 1st level cache too.
*/
void
-ka650encache()
+ka650setcache(state)
{
register int i;
- ka650discache();
- for (i = 0; i < (KA650_CACHESIZE / sizeof(KA650_CACHE_ptr[0])); i += 2)
- KA650_CACHE_ptr[i] = 0;
- ka650cbd_ptr->cbd_cacr = CACR_CEN;
- mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
-}
-
-void
-ka650discache()
-{
+ /*
+ * Before doing anything, disable the cache.
+ */
mtpr(0, PR_CADR);
ka650cbd_ptr->cbd_cacr = CACR_CPE;
+
+ /*
+ * Check what we want to do, enable or disable.
+ */
+ if (state == CACHEON) {
+ for (i = 0; i < (KA650_CACHESIZE / sizeof(KA650_CACHE_ptr[0]));
+ i += 2)
+ KA650_CACHE_ptr[i] = 0;
+ ka650cbd_ptr->cbd_cacr = CACR_CEN;
+ mtpr(CADR_SEN2 | CADR_SEN1 | CADR_CENI | CADR_CEND, PR_CADR);
+ }
}
diff --git a/sys/arch/vax/vax/ka750.c b/sys/arch/vax/vax/ka750.c
index 733f71dee4d..5c67d604ab2 100644
--- a/sys/arch/vax/vax/ka750.c
+++ b/sys/arch/vax/vax/ka750.c
@@ -1,7 +1,6 @@
-/* $OpenBSD: ka750.c,v 1.6 1997/05/28 23:25:51 niklas Exp $ */
-/* $NetBSD: ka750.c,v 1.17 1996/10/13 03:35:48 christos Exp $ */
-
-/*-
+/* $OpenBSD: ka750.c,v 1.7 1997/09/10 12:04:48 maja Exp $ */
+/* $NetBSD: ka750.c,v 1.18 1997/02/19 10:04:17 ragge Exp $ */
+/*
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -47,6 +46,7 @@
#include <vm/vm_kern.h>
#include <machine/ka750.h>
+#include <machine/clock.h>
#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/sid.h>
@@ -58,6 +58,21 @@
void ctuattach __P((void));
+struct cpu_dep ka750_calls = {
+ ka750_steal_pages,
+ generic_clock,
+ ka750_mchk,
+ ka750_memerr,
+ ka750_conf,
+ generic_clkread,
+ generic_clkwrite,
+ 1, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+
+};
+
/*
* ka750_conf() is called by cpu_attach to do the cpu_specific setup.
*/
diff --git a/sys/arch/vax/vax/ka780.c b/sys/arch/vax/vax/ka780.c
index cad90833644..4cbb6dcf6a0 100644
--- a/sys/arch/vax/vax/ka780.c
+++ b/sys/arch/vax/vax/ka780.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka780.c,v 1.3 1997/05/29 00:05:21 niklas Exp $ */
-/* $NetBSD: ka780.c,v 1.6 1996/10/13 03:35:50 christos Exp $ */
+/* $OpenBSD: ka780.c,v 1.4 1997/09/10 12:04:48 maja Exp $ */
+/* $NetBSD: ka780.c,v 1.7 1997/02/19 10:04:18 ragge Exp $ */
/*-
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* All rights reserved.
@@ -48,6 +48,7 @@
#include <vm/vm_kern.h>
#include <machine/pte.h>
+#include <machine/clock.h>
#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <machine/scb.h>
@@ -57,12 +58,28 @@
#include <vax/uba/ubavar.h>
#include <vax/uba/ubareg.h>
-/* Prototypes. XXX These should be somewhere else */
-void ka780_conf __P((struct device *, struct device *, void *));
+static void ka780_conf __P((struct device *, struct device *, void *));
void ka780_memenable __P((struct sbi_attach_args *, void *));
-void ka780_memerr __P((void));
-int ka780_mchk __P((caddr_t));
-void ka780_steal_pages __P((void));
+static void ka780_memerr __P((void));
+static int ka780_mchk __P((caddr_t));
+static void ka780_steal_pages __P((void));
+
+/*
+ * Declaration of 780-specific calls.
+ */
+struct cpu_dep ka780_calls = {
+ ka780_steal_pages,
+ generic_clock,
+ ka780_mchk,
+ ka780_memerr,
+ ka780_conf,
+ generic_clkread,
+ generic_clkwrite,
+ 2, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+};
/*
* Memory controller register usage varies per controller.
diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c
index 11fde38c043..5bcca45fc38 100644
--- a/sys/arch/vax/vax/ka820.c
+++ b/sys/arch/vax/vax/ka820.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka820.c,v 1.2 1997/05/29 00:05:22 niklas Exp $ */
-/* $NetBSD: ka820.c,v 1.3 1996/10/13 03:35:51 christos Exp $ */
+/* $OpenBSD: ka820.c,v 1.3 1997/09/10 12:04:49 maja Exp $ */
+/* $NetBSD: ka820.c,v 1.5 1997/04/18 18:49:34 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -61,7 +61,6 @@
#include <arch/vax/bi/bireg.h>
#include <arch/vax/bi/bivar.h>
-struct ka820clock *ka820clock_ptr;
struct ka820port *ka820port_ptr;
struct rx50device *rx50device_ptr;
void *bi_nodebase; /* virtual base address for all possible bi nodes */
@@ -69,6 +68,21 @@ void *bi_nodebase; /* virtual base address for all possible bi nodes */
static int ka820_match __P((struct device *, void *, void *));
static void ka820_attach __P((struct device *, struct device *, void*));
+struct cpu_dep ka820_calls = {
+ ka820_steal_pages,
+ generic_clock,
+ ka820_mchk,
+ ka820_memerr,
+ NULL,
+ chip_clkread,
+ chip_clkwrite,
+ 3, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+
+};
+
struct cfattach cpu_bi_ca = {
sizeof(struct device), ka820_match, ka820_attach
};
@@ -95,6 +109,8 @@ ka820_steal_pages()
{
extern vm_offset_t avail_start, virtual_avail, avail_end;
extern struct ivec_dsp idsptch;
+ extern short *clk_page;
+ extern int clk_adrshift, clk_tweak;
struct scb *sb;
int junk, i, j;
@@ -106,8 +122,10 @@ ka820_steal_pages()
*/
sb = (void *)avail_start;
MAPPHYS(junk, j, VM_PROT_READ|VM_PROT_WRITE); /* SCB & vectors */
- MAPVIRT(ka820clock_ptr, 1);
- pmap_map((vm_offset_t)ka820clock_ptr, (vm_offset_t)KA820_CLOCKADDR,
+ clk_adrshift = 0; /* clk regs are addressed at short's */
+ clk_tweak = 1; /* ...but not exactly in each short */
+ MAPVIRT(clk_page, 1);
+ pmap_map((vm_offset_t)clk_page, (vm_offset_t)KA820_CLOCKADDR,
KA820_CLOCKADDR + NBPG, VM_PROT_READ|VM_PROT_WRITE);
MAPVIRT(ka820port_ptr, 1);
@@ -176,80 +194,6 @@ ka820_attach(parent, self, aux)
ba->ba_node->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
}
-/* Set system time from clock */
-/* ARGSUSED */
-ka820_clkread(base)
- time_t base;
-{
- struct chiptime c;
- int s, rv;
-
- rv = CLKREAD_OK;
- /* I wish I knew the differences between these */
- if ((ka820clock_ptr->csr3 & KA820CLK_3_VALID) == 0) {
- printf("WARNING: TOY clock not marked valid\n");
- rv = CLKREAD_WARN;
- }
- if ((ka820clock_ptr->csr1 & KA820CLK_1_GO) != KA820CLK_1_GO) {
- printf("WARNING: TOY clock stopped\n");
- rv = CLKREAD_WARN;
- }
- /* THIS IS NOT RIGHT (clock may change on us) */
- s = splhigh();
- while (ka820clock_ptr->csr0 & KA820CLK_0_BUSY)
- /* void */;
- c.sec = ka820clock_ptr->sec;
- c.min = ka820clock_ptr->min;
- c.hour = ka820clock_ptr->hr;
- c.day = ka820clock_ptr->day;
- c.mon = ka820clock_ptr->mon;
- c.year = ka820clock_ptr->yr;
- splx(s);
-
- /* the darn thing needs tweaking! */
- c.sec >>= 1; /* tweak */
- c.min >>= 1; /* tweak */
- c.hour >>= 1; /* tweak */
- c.day >>= 1; /* tweak */
- c.mon >>= 1; /* tweak */
- c.year >>= 1; /* tweak */
-
- time.tv_sec = chiptotime(&c);
- return (time.tv_sec ? rv : CLKREAD_BAD);
-}
-
-/* store time into clock */
-void
-ka820_clkwrite()
-{
- struct chiptime c;
- int s;
-
- timetochip(&c);
-
- /* play it again, sam (or mike or kirk or ...) */
- c.sec <<= 1; /* tweak */
- c.min <<= 1; /* tweak */
- c.hour <<= 1; /* tweak */
- c.day <<= 1; /* tweak */
- c.mon <<= 1; /* tweak */
- c.year <<= 1; /* tweak */
-
- s = splhigh();
- ka820clock_ptr->csr1 = KA820CLK_1_SET;
- while (ka820clock_ptr->csr0 & KA820CLK_0_BUSY)
- /* void */;
- ka820clock_ptr->sec = c.sec;
- ka820clock_ptr->min = c.min;
- ka820clock_ptr->hr = c.hour;
- ka820clock_ptr->day = c.day;
- ka820clock_ptr->mon = c.mon;
- ka820clock_ptr->yr = c.year;
- /* should we set a `rate'? */
- ka820clock_ptr->csr1 = KA820CLK_1_GO;
- splx(s);
-}
-
/*
* MS820 support.
*/
diff --git a/sys/arch/vax/vax/ka860.c b/sys/arch/vax/vax/ka860.c
index 683cb0d74a1..4aefc7bf30e 100644
--- a/sys/arch/vax/vax/ka860.c
+++ b/sys/arch/vax/vax/ka860.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ka860.c,v 1.3 1997/05/29 00:05:22 niklas Exp $ */
-/* $NetBSD: ka860.c,v 1.6 1996/10/13 03:35:53 christos Exp $ */
+/* $OpenBSD: ka860.c,v 1.4 1997/09/10 12:04:49 maja Exp $ */
+/* $NetBSD: ka860.c,v 1.7 1997/02/19 10:04:20 ragge Exp $ */
/*
* Copyright (c) 1986, 1988 Regents of the University of California.
* All rights reserved.
@@ -47,6 +47,7 @@
#include <vm/vm_kern.h>
#include <machine/cpu.h>
+#include <machine/clock.h>
#include <machine/mtpr.h>
#include <machine/nexus.h>
#include <machine/ioa.h>
@@ -54,7 +55,6 @@
struct ioa *ioa;
-/* XXX These are in autoconf.c also */
void ka86_conf __P((struct device *, struct device *, void *));
void ka86_memenable __P((struct sbi_attach_args *, struct device *));
void ka86_memerr __P((void));
@@ -63,6 +63,21 @@ void ka86_steal_pages __P((void));
void crlattach __P((void));
+struct cpu_dep ka860_calls = {
+ ka86_steal_pages,
+ generic_clock,
+ ka86_mchk,
+ ka86_memerr,
+ ka86_conf,
+ generic_clkread,
+ generic_clkwrite,
+ 6, /* ~VUPS */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+ 0, /* Used by vaxstation */
+
+};
+
/*
* 8600 memory register (MERG) bit definitions
*/
diff --git a/sys/arch/vax/vax/locore.c b/sys/arch/vax/vax/locore.c
index ba97f1d7b37..960d2d04b2d 100644
--- a/sys/arch/vax/vax/locore.c
+++ b/sys/arch/vax/vax/locore.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: locore.c,v 1.8 1997/05/29 00:05:23 niklas Exp $ */
-/* $NetBSD: locore.c,v 1.17 1996/08/20 14:13:54 ragge Exp $ */
+/* $OpenBSD: locore.c,v 1.9 1997/09/10 12:04:50 maja Exp $ */
+/* $NetBSD: locore.c,v 1.21 1997/04/06 20:37:05 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -37,6 +37,7 @@
#include <sys/types.h>
#include <sys/reboot.h>
#include <sys/device.h>
+#include <sys/systm.h>
#include <vm/vm.h>
@@ -53,10 +54,8 @@
void start __P((void));
void main __P((void));
-u_int proc0paddr;
-int *Sysmap, boothowto;
-char *esym;
-extern int bootdev;
+u_int proc0paddr, esym;
+int *Sysmap, bootdev;
/*
* We set up some information about the machine we're
@@ -72,43 +71,47 @@ int vax_systype; /* machine dependend identification of the system */
int vax_cpudata; /* contents of the SID register */
int vax_siedata; /* contents of the SIE register */
int vax_confdata; /* machine dependend, configuration/setup data */
+/*
+ * Also; the strict cpu-dependent information is set up here, in
+ * form of a pointer to a struct that is specific for each cpu.
+ */
+extern struct cpu_dep ka780_calls;
+extern struct cpu_dep ka750_calls;
+extern struct cpu_dep ka860_calls;
+extern struct cpu_dep ka820_calls;
+extern struct cpu_dep ka43_calls;
+extern struct cpu_dep ka410_calls;
+extern struct cpu_dep ka630_calls;
+extern struct cpu_dep ka650_calls;
/*
* Start is called from boot; the first routine that is called
* in kernel. Kernel stack is setup somewhere in a safe place;
* but we need to move it to a better known place. Memory
* management is disabled, and no interrupt system is active.
- * We shall be at kernel stack when called; not interrupt stack.
*/
void
start()
{
+ register __boothowto asm ("r11");
+ register __bootdev asm ("r10");
+ register __esym asm ("r9");
+ register __physmem asm ("r8");
+ extern vm_offset_t avail_end;
extern u_int *end;
extern void *scratch;
register tmpptr;
- mtpr(0x1f, PR_IPL); /* No interrupts before istack is ok, please */
-
/*
- * We can be running either in system or user space when
- * getting here. Need to figure out which and take care
- * of it. We also save all registers if panic gets called.
+ * We get parameters passed in registers from boot, put
+ * them in memory to save.
*/
- asm("
- bisl2 $0x80000000, r9
- movl r9, _esym
- movl r10, _bootdev
- movl r11, _boothowto
- jsb ett
-ett: cmpl (sp)+, $0x80000000
- bleq tvo # New boot
- pushl $0x001f0000
- pushl $tokmem
- rei
-tvo: movl (sp)+,_boothowto
- movl (sp)+,_bootdev
-tokmem: movw $0xfff, _panic
- ");
+ boothowto = __boothowto;
+ bootdev = __bootdev;
+ esym = __esym | 0x80000000;
+ avail_end = __physmem; /* Better to take from RPB, if available */
+
+ asm("pushl $0x001f0000;pushl $to;rei;to:movw $0xfff, _panic");
/*
* FIRST we must set up kernel stack, directly after end.
@@ -117,7 +120,7 @@ tokmem: movw $0xfff, _panic
PAGE_SIZE = NBPG * 2; /* Set logical page size */
#ifdef DDB
if ((boothowto & RB_KDB) != 0)
- proc0paddr = ROUND_PAGE(esym) | 0x80000000;
+ proc0paddr = ROUND_PAGE(esym);
else
#endif
proc0paddr = ROUND_PAGE(&end);
@@ -154,18 +157,21 @@ tokmem: movw $0xfff, _panic
case VAX_TYP_780:
vax_bustype = VAX_SBIBUS | VAX_CPUBUS;
vax_boardtype = VAX_BTYP_780;
+ dep_call = &ka780_calls;
break;
#endif
#if VAX750
case VAX_TYP_750:
vax_bustype = VAX_CMIBUS | VAX_CPUBUS;
vax_boardtype = VAX_BTYP_750;
+ dep_call = &ka750_calls;
break;
#endif
#if VAX8600
case VAX_TYP_790:
vax_bustype = VAX_CPUBUS | VAX_MEMBUS;
vax_boardtype = VAX_BTYP_790;
+ dep_call = &ka860_calls;
break;
#endif
#if VAX630 || VAX650 || VAX410 || VAX43
@@ -176,17 +182,33 @@ tokmem: movw $0xfff, _panic
vax_boardtype = (vax_cputype<<24) | ((vax_siedata>>24)&0xFF);
switch (vax_boardtype) {
+#if VAX410
+ case VAX_BTYP_420: /* They are very similar */
case VAX_BTYP_410:
+ dep_call = &ka410_calls;
+ vax_confdata = *(int *)(0x20020000);
+ vax_bustype = VAX_VSBUS | VAX_CPUBUS;
+ break;
+#endif
+#if VAX43
case VAX_BTYP_43:
vax_confdata = *(int *)(0x20020000);
vax_bustype = VAX_VSBUS | VAX_CPUBUS;
+ dep_call = &ka43_calls;
break;
-
+#endif
+#if VAX630
case VAX_BTYP_630:
+ dep_call = &ka630_calls;
+ vax_bustype = VAX_UNIBUS | VAX_CPUBUS;
+ break;
+#endif
+#if VAX650
case VAX_BTYP_650:
vax_bustype = VAX_UNIBUS | VAX_CPUBUS;
+ dep_call = &ka650_calls;
break;
-
+#endif
default:
break;
}
@@ -197,6 +219,7 @@ tokmem: movw $0xfff, _panic
vax_boardtype = VAX_BTYP_8000;
vax_bustype = VAX_BIBUS;
mastercpu = mfpr(PR_BINID);
+ dep_call = &ka820_calls;
break;
#endif
default:
@@ -204,14 +227,6 @@ tokmem: movw $0xfff, _panic
asm("halt");
}
- /*
- * before doing anything else, we need to setup the console
- * so that output (eg. debug and error messages) are visible.
- * They way console-output is done is different for different
- * VAXen, thus vax_cputype and vax_boardtype are setup/used.
- */
- cninit();
-
pmap_bootstrap();
((struct pcb *)proc0paddr)->framep = scratch;
diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c
index c9f14e09a14..2662f547577 100644
--- a/sys/arch/vax/vax/machdep.c
+++ b/sys/arch/vax/vax/machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: machdep.c,v 1.14 1997/08/30 09:50:28 maja Exp $ */
-/* $NetBSD: machdep.c,v 1.35 1997/01/11 11:31:26 ragge Exp $ */
+/* $OpenBSD: machdep.c,v 1.15 1997/09/10 12:04:50 maja Exp $ */
+/* $NetBSD: machdep.c,v 1.41 1997/04/19 15:02:31 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -394,7 +394,7 @@ dumpconf()
void
cpu_initclocks()
{
- (cpu_calls[vax_cputype].cpu_clock) ();
+ (*dep_call->cpu_clock) ();
}
int
@@ -418,6 +418,7 @@ setstatclockrate(hzrate)
void
consinit()
{
+ cninit();
#ifdef DDB
/* db_machine_init(); */
ddb_init();
@@ -700,9 +701,9 @@ void
machinecheck(frame)
caddr_t frame;
{
- if ((*cpu_calls[vax_cputype].cpu_mchk) (frame) == 0)
+ if ((*dep_call->cpu_mchk) (frame) == 0)
return;
- (*cpu_calls[vax_cputype].cpu_memerr) ();
+ (*dep_call->cpu_memerr) ();
panic("machine check");
}
@@ -849,5 +850,5 @@ process_sstep(p, sstep)
void
cmrerr()
{
- (*cpu_calls[vax_cputype].cpu_memerr) ();
+ (*dep_call->cpu_memerr) ();
}
diff --git a/sys/arch/vax/vax/pmap.c b/sys/arch/vax/vax/pmap.c
index 4b3338b67ec..61c2223c367 100644
--- a/sys/arch/vax/vax/pmap.c
+++ b/sys/arch/vax/vax/pmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.c,v 1.7 1997/01/15 23:25:20 maja Exp $ */
-/* $NetBSD: pmap.c,v 1.30 1996/10/13 03:35:57 christos Exp $ */
+/* $OpenBSD: pmap.c,v 1.8 1997/09/10 12:04:51 maja Exp $ */
+/* $NetBSD: pmap.c,v 1.35 1997/03/22 12:50:56 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -89,6 +89,8 @@ vm_offset_t avail_start, avail_end;
vm_offset_t virtual_avail, virtual_end; /* Available virtual memory */
/*
+ * THIS INFORMATION IS OUTDATED. It's left here just inform curious people.
+ *
* badaddr() doesn't work on some VAXstations
* (I've checked KA410 and KA43, don't know about others yet).
*
@@ -115,12 +117,6 @@ vm_offset_t virtual_avail, virtual_end; /* Available virtual memory */
* within this address-range, something went wrong and we're assuming
* some save amount of physical memory. This might be paranoid, but...
*/
-#ifndef MAX_PHYSMEM_AVAIL
-#define MAX_PHYSMEM_AVAIL 512*1024*1024
-#endif
-#ifndef MIN_PHYSMEM_AVAIL
-#define MIN_PHYSMEM_AVAIL 8*1024*1024
-#endif
/*
* pmap_bootstrap().
@@ -138,31 +134,35 @@ pmap_bootstrap()
p0pmap = &vmspace0.vm_pmap;
- sysptsize = SYSPTSIZE;
-
/*
- * Because of the badaddr() problem with some VAXstations we
- * compare the first page of memory (the SCB) with the new
- * counted up pages for equality. It's very unlikely that
- * another page will hold the same info as the SCB.
- * This is neccessary only if badaddr() doesn't work, but on other
- * machines checking the pattern doesn't hurt anyway...
+ * Machines older than MicroVAX II have their boot blocks
+ * loaded directly or the boot program loaded from console
+ * media, so we need to figure out their memory size.
+ * This is not easily done on MicroVAXen, so we get it from
+ * VMB instead.
*/
+ if (avail_end == 0)
+ while (badaddr((caddr_t)avail_end, 4) == 0)
+ avail_end += NBPG * 128;
- /* Kickoff for memory checking */
- avail_end = 0x200000; /* 2 MB */
+ avail_end = TRUNC_PAGE(avail_end); /* be sure */
- while (badaddr((caddr_t)avail_end, 4) == 0) {
-#if VAX410 || VAX420 || VAX43 || VAX46 || VAX49 || VAX50
- if (bcmp(0, (caddr_t)avail_end, NBPG) == 0)
- break;
-#endif
- avail_end += NBPG * 128;/* Memory is checked in 64K hunks */
- }
+ /*
+ * Calculation of the System Page Table is somewhat a pain,
+ * because it must be in contiguous physical memory and all
+ * size calculations must be done now.
+ * Remember: sysptsize is in PTEs and nothing else!
+ */
-#if VAX410 || VAX420 || VAX43 || VAX46 || VAX49 || VAX50
- sysptsize += (16 * 1024) >> PGSHIFT; /* guc->uc_sysptSpace ?? */
-#endif
+ /* Kernel alloc area */
+ sysptsize = (((0x100000 * maxproc) >> PGSHIFT) / 4);
+ /* reverse mapping struct */
+ sysptsize += (avail_end >> PGSHIFT);
+ /* User Page table area. This may grow big */
+#define USRPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / NBPG)
+ sysptsize += ((USRPTSIZE * 4) / NBPG) * maxproc;
+ /* Kernel stacks per process */
+ sysptsize += UPAGES * maxproc;
/*
* Virtual_* and avail_* is used for mapping of system page table.
@@ -172,7 +172,6 @@ pmap_bootstrap()
* a variable here that is changed dependent of the physical
* memory size.
*/
- sysptsize += avail_end >> PGSHIFT;
virtual_avail = KERNBASE;
virtual_end = KERNBASE + sysptsize * NBPG;
avail_start = 0;
@@ -234,14 +233,14 @@ pmap_bootstrap()
bcopy(0, (void *)avail_start, NBPG >> 1);
mtpr(avail_start, PR_SCBB);
bzero(0, NBPG >> 1);
- (cpu_calls[vax_cputype].cpu_steal_pages)();
+ (*dep_call->cpu_steal_pages)();
avail_start = ROUND_PAGE(avail_start);
virtual_avail = ROUND_PAGE(virtual_avail);
#ifdef PMAPDEBUG
printf("Sysmap %x, istack %x, scratch %x\n",Sysmap,istack,scratch);
printf("etext %x\n", &etext);
- printf("SYSPTSIZE %x, USRPTSIZE %x\n",sysptsize,USRPTSIZE);
+ printf("SYSPTSIZE %x\n",sysptsize);
printf("pv_table %x, vmmap %x, pte_cmap %x\n",
pv_table,vmmap,pte_cmap);
printf("avail_start %x, avail_end %x\n",avail_start,avail_end);
@@ -286,7 +285,7 @@ pmap_init(start, end)
/* reserve place on SPT for UPT */
pte_map = kmem_suballoc(kernel_map, &ptemapstart, &ptemapend,
- USRPTSIZE * 4, TRUE);
+ USRPTSIZE * 4 * maxproc, TRUE);
}
diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c
index 1aca6530f2d..ea79d7618a7 100644
--- a/sys/arch/vax/vax/rootfil.c
+++ b/sys/arch/vax/vax/rootfil.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rootfil.c,v 1.5 1997/05/29 00:05:24 niklas Exp $ */
+/* $OpenBSD: rootfil.c,v 1.6 1997/09/10 12:04:51 maja Exp $ */
/* $NetBSD: rootfil.c,v 1.14 1996/10/13 03:35:58 christos Exp $ */
/*
@@ -63,7 +63,9 @@
#include "ra.h"
#define DOSWAP /* Change swdevt, argdev, and dumpdev too */
+#ifdef MAJA
u_long bootdev; /* should be dev_t, but not until 32 bits */
+#endif
extern dev_t rootdev, dumpdev;
#define PARTITIONMASK 0x7
diff --git a/sys/arch/vax/vax/subr.s b/sys/arch/vax/vax/subr.s
index 3fdb201d259..79775c5fb74 100644
--- a/sys/arch/vax/vax/subr.s
+++ b/sys/arch/vax/vax/subr.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: subr.s,v 1.5 1997/05/29 00:05:25 niklas Exp $ */
-/* $NetBSD: subr.s,v 1.16 1996/03/17 22:56:18 ragge Exp $ */
+/* $OpenBSD: subr.s,v 1.6 1997/09/10 12:04:52 maja Exp $ */
+/* $NetBSD: subr.s,v 1.18 1997/03/22 23:02:13 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -190,7 +190,7 @@ _copystr: .word 0x7c
movl 12(ap),r2 # len
movl 16(ap),r3 # copied
-#if VAX630
+#if VAX630 || VAX650 || VAX410
movl r4, r1 # (3) string address == r1
movl r2, r0 # (2) string length == r0
jeql Llocc_out # forget zero length strings
diff --git a/sys/arch/vax/vax/uvax.c b/sys/arch/vax/vax/uvax.c
index ec7f2b0df87..065ebc1589e 100644
--- a/sys/arch/vax/vax/uvax.c
+++ b/sys/arch/vax/vax/uvax.c
@@ -1,10 +1,9 @@
-/* $OpenBSD: uvax.c,v 1.2 1997/05/29 00:05:27 niklas Exp $ */
-/* $NetBSD: uvax.c,v 1.3 1996/10/13 03:36:03 christos Exp $ */
+/* $OpenBSD: uvax.c,v 1.3 1997/09/10 12:04:52 maja Exp $ */
+/* $NetBSD: uvax.c,v 1.4 1997/02/19 10:04:27 ragge Exp $ */
/*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden.
- * All rights reserved.
- *
- * This code is derived from software contributed to Ludd by Bertram Barth.
+ * Copyright (c) 1982, 1988, 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -16,8 +15,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed at Ludd, University of
- * Lule}, Sweden and its contributors.
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@@ -51,151 +50,7 @@
#include <machine/pmap.h>
#include <machine/nexus.h>
#include <machine/uvax.h>
-
-#define xtrace(x)
-#define xdebug(x)
-
-
-struct uvax_calls guc; /* Generic uVAX Calls */
-/* struct uvax_calls *ucp = &guc; /* not yet public !!! */
-static int uvax_callsSetup = 0; /* not yet setup */
-
-u_long uVAX_phys2virt __P((u_long, struct uc_map *));
-
-/* u_long uVAX_physmap; /* XXX another ugly hack... */
-int
-uvax_notavail(s)
- char *s;
-{
- printf("\"%s()\" not available for uVAX (%s)\n", s, guc.uc_name);
- /*
- * should we panic() here???
- */
- return(0);
-}
-
-int
-uvax_setup(flags)
- int flags;
-{
- /*
- * insert some defaults here !!!
- */
-
- /*
- * Now call the specific routines to overwrite these defaults
- */
- switch (vax_boardtype) {
-#ifdef VAX630
- case VAX_BTYP_630:
- ka630_setup(&guc, flags);
- break;
-#endif
-#ifdef VAX410
- case VAX_BTYP_410:
- ka410_setup(&guc, flags);
- break;
-#endif
-#ifdef VAX43
- case VAX_BTYP_43:
- ka43_setup(&guc, flags);
- break;
-#endif
- default:
- printf("don't know how to handle 0x%x\n", vax_boardtype);
- printf("Let's try using the defaults...\n");
- }
- uvax_callsSetup = 1;
-}
-
-/*
- * XXX_steal_pages() is the first cpu/board specific function to be called.
- * Thus we use this call to setup the dispatch structure for further use.
- *
- * We should have a special setup-routine !!!
- */
-void
-uvax_steal_pages()
-{
- if (uvax_callsSetup == 0)
- uvax_setup(0);
-
- /*
- * now that specific functions are inserted, we can call 'em
- */
- if (guc.uc_steal_pages) {
- (guc.uc_steal_pages)();
- return;
- }
- uvax_notavail("uc_steal_pages");
-}
-
-u_long
-uvax_phys2virt(paddr)
- u_long paddr;
-{
- if (guc.uc_phys2virt)
- return ((guc.uc_phys2virt)(paddr));
- if (guc.uc_physmap)
- return (uVAX_phys2virt(paddr, guc.uc_physmap));
- uvax_notavail("uc_phys2virt");
- return (0);
-}
-
-void
-uvax_conf(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- if (guc.uc_conf) {
- (guc.uc_conf)(parent, self, aux);
- return;
- }
- uvax_notavail("uc_conf");
-}
-
-void
-uvax_memerr()
-{
- xtrace(("uvax_memerr()\n"));
-
- if (guc.uc_memerr) {
- (guc.uc_memerr)();
- return;
- }
- uvax_notavail("uc_memerr");
-}
-
-int
-uvax_mchk(addr)
- caddr_t addr;
-{
- xtrace(("uvax_mchk(0x%x)\n", addr));
-
- if (guc.uc_mchk)
- return ((guc.uc_mchk)(addr));
- uvax_notavail("uc_mchk");
- return (-1);
-}
-
-int
-uvax_clkread(base)
- time_t base;
-{
- if (guc.uc_clkread)
- return ((guc.uc_clkread)(base));
- uvax_notavail("uc_clkread");
-}
-
-void
-uvax_clkwrite()
-{
- if (guc.uc_clkwrite)
- (guc.uc_clkwrite)();
- else
- uvax_notavail("uc_clkwrite");
- return;
-}
+#include <machine/cpu.h>
/*
* NB: mapping should/must be done in chunks of PAGE_SIZE (ie. 1024),
@@ -205,46 +60,14 @@ uvax_clkwrite()
* the end-address up to be just beyond the next multiple of PAGE_SIZE.
* size is the number of bytes between start and end expressed in NBPG.
*/
-int
-uVAX_old_fillmap(um)
- struct uc_map *um;
-{
- extern vm_offset_t avail_start, virtual_avail, avail_end;
- register struct uc_map *p;
- register u_int base, end, size;
-
- for (p = um; p->um_base != 0; p++) {
- base = p->um_base & ~PAGE_SIZE; /* round base down */
- end = ROUND_PAGE(p->um_end + 1) - 1; /* round end up */
- size = (end - base + 1) / NBPG; /* size in pages */
- MAPVIRT(p->um_virt, size);
- pmap_map((vm_offset_t)p->um_virt, base, end,
- VM_PROT_READ|VM_PROT_WRITE);
-
- xdebug(("uVAX_fillmap: %x:%x[%x] (%x:%x[%x]) --> %x\n",
- p->um_base, p->um_end, p->um_size,
- base, end, size, p->um_virt));
-
- }
-}
-
-/*
- * NB: mapping should/must be done in chunks of PAGE_SIZE (ie. 1024),
- * while pmap_map() expects size to be in chunks of NBPG (ie. 512).
- *
- * Thus we round down the start-address to be aligned wrt PAGE_SIZE and
- * the end-address up to be just beyond the next multiple of PAGE_SIZE.
- * size is the number of bytes between start and end expressed in NBPG.
- */
-int
-uVAX_fillmap(um)
- struct uc_map *um;
+void
+uvax_fillmap()
{
extern vm_offset_t avail_start, virtual_avail, avail_end;
register struct uc_map *p;
register u_int base, end, off, size;
- for (p = um; p->um_base != 0; p++) {
+ for (p = dep_call->cpu_map; p->um_base != 0; p++) {
base = TRUNC_PAGE(p->um_base); /* round base down */
off = p->um_base - base;
size = ROUND_PAGE(off + p->um_size);
@@ -255,34 +78,28 @@ uVAX_fillmap(um)
end = base + size - 1;
MAPVIRT(p->um_virt, size/NBPG);
pmap_map((vm_offset_t)p->um_virt, base, end,
- VM_PROT_READ|VM_PROT_WRITE);
-
- xdebug(("uVAX_fillmap: %x:%x[%x] (%x:%x[%x]) --> %x\n",
- p->um_base, p->um_end, p->um_size,
- base, end, size, p->um_virt));
+ VM_PROT_READ|VM_PROT_WRITE);
}
}
u_long
-uVAX_phys2virt(phys,um)
+uvax_phys2virt(phys)
u_long phys;
- struct uc_map *um;
{
register struct uc_map *p;
u_long virt = 0;
- for (p = um; p->um_base != 0; p++) {
+ for (p = dep_call->cpu_map; p->um_base != 0; p++) {
if (p->um_base > phys || p->um_end < phys)
continue;
virt = p->um_virt + (phys - trunc_page(p->um_base));
break;
}
- if (virt == 0) {
- printf("invalid argument 0x%x to uvax_phys2virt()\n", phys);
- /* should we panic() here ??? */
- }
-
+#ifdef DIAGNOSTIC
+ if (virt == 0)
+ panic("invalid argument %p to uvax_phys2virt()\n", phys);
+#endif
return (virt);
}
diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c
index f5bfd72d72c..72b2cb28492 100644
--- a/sys/arch/vax/vax/vm_machdep.c
+++ b/sys/arch/vax/vax/vm_machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: vm_machdep.c,v 1.9 1997/05/28 23:31:16 niklas Exp $ */
-/* $NetBSD: vm_machdep.c,v 1.30 1997/01/11 11:23:09 ragge Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.10 1997/09/10 12:04:53 maja Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.31 1997/03/09 16:00:06 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@@ -598,9 +598,12 @@ vmapbuf(bp, len)
tmap = vm_map_pmap(phys_map);
len = len >> PGSHIFT;
while (len--) {
+ volatile int i = *(int *)faddr;
+
pa = pmap_extract(fmap, faddr);
if (pa == 0)
- panic("vmapbuf: null page frame for %x", faddr);
+ panic("vmapbuf: null page frame for %x", faddr);
+
pmap_enter(tmap, taddr, pa & ~(NBPG - 1),
VM_PROT_READ|VM_PROT_WRITE, TRUE);
faddr += NBPG;