summaryrefslogtreecommitdiff
path: root/sys/arch/pmax
diff options
context:
space:
mode:
authorThomas Graichen <graichen@cvs.openbsd.org>1997-06-10 14:20:26 +0000
committerThomas Graichen <graichen@cvs.openbsd.org>1997-06-10 14:20:26 +0000
commitbf9e7496d94ce1c4da850b80d58038801f557a9b (patch)
treeecdb8c9d30648d2bc830e802b582a49d533fe92e /sys/arch/pmax
parentd78c3e0c4b3482bcc998de4d120c74e31c5728c5 (diff)
update the pmax specific stuff to NetBSD-current as of about 970608 - some
cosmetic things will follow together with an update to an exact NETBSD_CU- RRENT_xxxxxx level
Diffstat (limited to 'sys/arch/pmax')
-rw-r--r--sys/arch/pmax/pmax/autoconf.c7
-rw-r--r--sys/arch/pmax/pmax/conf-glue.c4
-rw-r--r--sys/arch/pmax/pmax/conf.c8
-rw-r--r--sys/arch/pmax/pmax/cpu_cons.c25
-rw-r--r--sys/arch/pmax/pmax/disksubr.c4
-rw-r--r--sys/arch/pmax/pmax/locore.S82
-rw-r--r--sys/arch/pmax/pmax/machdep.c196
-rw-r--r--sys/arch/pmax/pmax/mem.c9
-rw-r--r--sys/arch/pmax/pmax/pmap.c87
-rw-r--r--sys/arch/pmax/pmax/pmax_trap.c42
-rw-r--r--sys/arch/pmax/pmax/process_machdep.c4
-rw-r--r--sys/arch/pmax/pmax/trap.c8
-rw-r--r--sys/arch/pmax/pmax/trap.h6
-rw-r--r--sys/arch/pmax/pmax/vm_machdep.c9
-rw-r--r--sys/arch/pmax/tc/asic.c4
-rw-r--r--sys/arch/pmax/tc/scc.c34
-rw-r--r--sys/arch/pmax/tc/tc_subr.c28
17 files changed, 371 insertions, 186 deletions
diff --git a/sys/arch/pmax/pmax/autoconf.c b/sys/arch/pmax/pmax/autoconf.c
index d0e7c884dc9..6a108f39695 100644
--- a/sys/arch/pmax/pmax/autoconf.c
+++ b/sys/arch/pmax/pmax/autoconf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: autoconf.c,v 1.18 1996/10/13 03:39:44 christos Exp $ */
+/* $NetBSD: autoconf.c,v 1.24 1997/05/25 08:17:00 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -61,6 +61,7 @@
#include <sys/device.h>
#include <machine/cpu.h>
+#include <machine/autoconf.h>
#include <pmax/dev/device.h>
#include <pmax/pmax/pmaxtype.h>
#include <pmax/pmax/turbochannel.h>
@@ -80,10 +81,6 @@ void xconsinit __P((void)); /* XXX console-init continuation */
int spl0 __P((void));
#endif
-void configure __P((void));
-void makebootdev __P((char *cp));
-
-
/*
* The following several variables are related to
diff --git a/sys/arch/pmax/pmax/conf-glue.c b/sys/arch/pmax/pmax/conf-glue.c
index 8371016d16a..9a6ef834f8d 100644
--- a/sys/arch/pmax/pmax/conf-glue.c
+++ b/sys/arch/pmax/pmax/conf-glue.c
@@ -1,4 +1,4 @@
-/* $NetBSD: conf-glue.c,v 1.12 1996/10/13 03:39:47 christos Exp $ */
+/* $NetBSD: conf-glue.c,v 1.13 1997/05/24 09:37:45 jonathan Exp $ */
/*
* conf-glue.c:
@@ -229,7 +229,7 @@ noattach(parent, self, aux)
ca->ca_name, self->dv_unit,
parent->dv_xname);
#else
- panic("Can't do new-config attach of old device %s\n",
+ panic("Can't do new-config attach of old device %s%d\n",
ca->ca_name, self->dv_unit);
#endif
return;
diff --git a/sys/arch/pmax/pmax/conf.c b/sys/arch/pmax/pmax/conf.c
index b3fe13ce40c..5f8c5420d99 100644
--- a/sys/arch/pmax/pmax/conf.c
+++ b/sys/arch/pmax/pmax/conf.c
@@ -108,7 +108,8 @@ cdev_decl(mm);
#include "bpfilter.h"
#include "dtop.h"
cdev_decl(dtop);
-#include "dc.h"
+#include "dc_ioasic.h"
+#include "dc_ds.h"
cdev_decl(dc);
#include "scc.h"
cdev_decl(scc);
@@ -128,6 +129,11 @@ cdev_decl(xcfb);
cdev_decl(mfb);
dev_decl(filedesc,open);
+#if (NDC_DS > 0) || (NDC_IOASIC > 0)
+# define NDC 1
+#else
+# define NDC 0
+#endif
/* a framebuffer with an attached mouse: */
/* open, close, ioctl, poll, mmap */
diff --git a/sys/arch/pmax/pmax/cpu_cons.c b/sys/arch/pmax/pmax/cpu_cons.c
index 18839089813..b7c0c8953b4 100644
--- a/sys/arch/pmax/pmax/cpu_cons.c
+++ b/sys/arch/pmax/pmax/cpu_cons.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_cons.c,v 1.14 1996/10/13 03:39:48 christos Exp $ */
+/* $NetBSD: cpu_cons.c,v 1.17 1997/05/24 08:19:48 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -80,13 +80,15 @@
#include "mfb.h"
#include "xcfb.h"
#include "sfb.h"
-#include "dc.h"
+#include "dc_ds.h"
+#include "dc_ioasic.h"
#include "dtop.h"
#include "scc.h"
#include "asc.h"
#include "tc.h"
+#include "rasterconsole.h"
-#if NDC > 0
+#if (NDC_DS > 0) || (NDC_IOASIC > 0)
#include <machine/dc7085cons.h>
#include <pmax/dev/dc_cons.h>
#include <pmax/dev/dc_ds_cons.h>
@@ -209,6 +211,7 @@ consinit()
* whatever the PROM vector gave us.
*/
+#if NRASTERCONSOLE > 0
if (pmax_boardtype == DS_PMAX && kbd == 1)
screen = 1;
/*
@@ -229,7 +232,7 @@ consinit()
if (screen) {
switch (pmax_boardtype) {
case DS_PMAX:
-#if NDC > 0 && NPM > 0
+#if NDC_DS > 0 && NPM > 0
if (pminit(0, 0, 1)) {
cd.cn_pri = CN_INTERNAL;
cd.cn_dev = makedev(DCDEV, DCKBD_PORT);
@@ -238,7 +241,7 @@ consinit()
cd.cn_putc = rcons_vputc; /*XXX*/
return;
}
-#endif /* NDC and NPM */
+#endif /* NDC_DS and NPM */
goto remcons;
case DS_MAXINE:
@@ -259,13 +262,13 @@ consinit()
break;
case DS_3MAX:
-#if NDC > 0
+#if NDC_IOASIC > 0
if (kbd == 7) {
cd.cn_dev = makedev(DCDEV, DCKBD_PORT);
cd.cn_getc = LKgetc;
lk_divert(dcGetc, makedev(DCDEV, DCKBD_PORT));
} else
-#endif /* NDC */
+#endif /* NDC_IOASIC */
goto remcons;
break;
@@ -307,23 +310,25 @@ consinit()
remcons:
+#endif /* NRASTERCONSOLE > 0 */
+
/*
* Configure a serial port as a remote console.
*/
switch (pmax_boardtype) {
case DS_PMAX:
-#if NDC > 0
+#if NDC_DS > 0
if (kbd == 4)
cd.cn_dev = makedev(DCDEV, DCCOMM_PORT);
else
cd.cn_dev = makedev(DCDEV, DCPRINTER_PORT);
dc_ds_consinit(cd.cn_dev);
return;
-#endif /* NDC */
+#endif /* NDC_DS */
break;
case DS_3MAX:
-#if NDC > 0
+#if (NDC_IOASIC > 0)
cd.cn_dev = makedev(DCDEV, DCPRINTER_PORT);
dc_ioasic_consinit(cd.cn_dev);
return;
diff --git a/sys/arch/pmax/pmax/disksubr.c b/sys/arch/pmax/pmax/disksubr.c
index 29c40ee1b56..92ab45160a1 100644
--- a/sys/arch/pmax/pmax/disksubr.c
+++ b/sys/arch/pmax/pmax/disksubr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: disksubr.c,v 1.13 1996/10/13 03:39:49 christos Exp $ */
+/* $NetBSD: disksubr.c,v 1.14 1997/01/15 00:55:43 jonathan Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -46,7 +46,7 @@
#define b_cylin b_resid
#ifdef COMPAT_ULTRIX
-#include "../../stand/dec_boot.h"
+#include <pmax/stand/dec_boot.h>
extern char *
compat_label __P((dev_t dev, void (*strat) __P((struct buf *bp)),
diff --git a/sys/arch/pmax/pmax/locore.S b/sys/arch/pmax/pmax/locore.S
index ec2d9299926..65a54e85fe1 100644
--- a/sys/arch/pmax/pmax/locore.S
+++ b/sys/arch/pmax/pmax/locore.S
@@ -1028,6 +1028,88 @@ LEAF(splsoftnet)
and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
END(splsoftnet)
+/*
+ * hardware-level spls for hardware where the device interrupt priorites
+ * are ordered, and map onto mips interrupt pins in increasing priority.
+ * This maps directly onto BSD spl levels.
+ */
+
+/*
+ * Block out int2 (hardware interrupt 0) and lower mips levels.
+ */
+LEAF(cpu_spl0)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL0)
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable on r4x00
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl0)
+
+/*
+ * Block out Int3 (hardware interrupt 1) and lower mips levels.
+ */
+LEAF(cpu_spl1)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL1)
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable on r4x00
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl1)
+
+LEAF(cpu_spl2)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL2)
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable on r4x00
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl2)
+
+LEAF(cpu_spl3)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL3)
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable on r4x00
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl3)
+
+LEAF(cpu_spl4)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL4)
+
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl4)
+
+LEAF(cpu_spl5)
+ mfc0 v0, MACH_COP_0_STATUS_REG # read status register
+ li t0, ~(MACH_INT_MASK_SPL5)
+ and t0, t0, v0
+ mtc0 t0, MACH_COP_0_STATUS_REG # save it
+ nop # 3 ins to disable
+ j ra
+ and v0, v0, (MACH_INT_MASK | MIPS_SR_INT_IE)
+END(cpu_spl5)
+
+/*
+ * hardware-level spls for hardware where teh interrupt priorites
+ * DO NOT map onto levels.
+ *
+ * For now, that means DEcstations that use only two distinct CPU
+ * levels, one for TOD clock interrupts, and a second for all other
+ * external devices (via an external controller.
+ * XXX the spl handling really needs re-writing from scratch.
+ */
LEAF(Mach_spl0)
mfc0 v0, MACH_COP_0_STATUS_REG # read status register
li t0, ~(MACH_INT_MASK_0|MACH_SOFT_INT_MASK_1|MACH_SOFT_INT_MASK_0)
diff --git a/sys/arch/pmax/pmax/machdep.c b/sys/arch/pmax/pmax/machdep.c
index 715a4d82685..94ba8f7dcba 100644
--- a/sys/arch/pmax/pmax/machdep.c
+++ b/sys/arch/pmax/pmax/machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.67 1996/10/23 20:04:40 mhitch Exp $ */
+/* $NetBSD: machdep.c,v 1.76 1997/05/31 20:33:30 mhitch Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -77,12 +77,12 @@
#endif
#include <vm/vm_kern.h>
+#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
#include <machine/cpu.h>
#include <machine/reg.h>
#include <machine/psl.h>
#include <machine/pte.h>
-#include <machine/dc7085cons.h>
#include <pmax/stand/dec_prom.h>
@@ -100,27 +100,22 @@
#include <pmax/pmax/asic.h>
#include <pmax/pmax/turbochannel.h>
#include <pmax/pmax/pmaxtype.h>
+#include <pmax/pmax/trap.h> /* mboard-specific interrupt fns */
#include <pmax/pmax/cons.h>
-
#include "pm.h"
#include "cfb.h"
#include "mfb.h"
#include "xcfb.h"
#include "sfb.h"
-#include "dc.h"
#include "dtop.h"
#include "scc.h"
#include "le_ioasic.h"
#include "asc.h"
-#if NDTOP > 0
-#include <pmax/dev/dtopvar.h>
-#endif
-
-
extern void fbPutc();
+#if defined(DS5000_25) || defined(DS5000_100) || defined(DS5000_240)
/* Will scan from max to min, inclusive */
static int tc_max_slot = KN02_TC_MAX;
static int tc_min_slot = KN02_TC_MIN;
@@ -131,6 +126,7 @@ static u_int tc_slot_phys_base [TC_MAX_SLOTS] = {
KN02_PHYS_TC_4_START, KN02_PHYS_TC_5_START,
KN02_PHYS_TC_6_START, KN02_PHYS_TC_7_START
};
+#endif
/* the following is used externally (sysctl_hw) */
char machine[] = "pmax"; /* cpu "architecture" */
@@ -168,12 +164,7 @@ extern void (*tc_enable_interrupt) __P ((u_int slotno,
void (*tc_enable_interrupt) __P ((u_int slotno,
int (*handler) __P ((void *sc)),
void *sc, int onoff));
-extern int (*mips_hardware_intr)();
-
-int kn02_intr(), kmin_intr(), xine_intr();
-
#ifdef DS3100
-extern int kn01_intr();
void kn01_enable_intr __P ((u_int slotno,
int (*handler) __P ((intr_arg_t sc)),
intr_arg_t sc, int onoff));
@@ -183,28 +174,59 @@ void kn01_enable_intr __P ((u_int slotno,
# include <pmax/pmax/kn230var.h> /* kn230_establish_intr(), kn230_intr() */
#endif
-#ifdef DS5000_240
-int kn03_intr();
-#endif
+/*
+ * Interrupt-blocking functions defined in locore. These names aren't used
+ * directly except here and in interrupt handlers.
+ */
+
+/* Block out one hardware interrupt-enable bit. */
+extern int Mach_spl0 __P((void)), Mach_spl1 __P((void));
+extern int Mach_spl2 __P((void)), Mach_spl3 __P((void));
+
+/* Block out nested interrupt-enable bits. */
+extern int cpu_spl0 __P((void)), cpu_spl1 __P((void));
+extern int cpu_spl2 __P((void)), cpu_spl3 __P((void));
+extern int splhigh __P((void));
+
+/*
+ * Instead, we declare the standard splXXX names as function pointers,
+ * and initialie them to point to the above functions to match
+ * the way a specific motherboard is wired up.
+ */
+int (*Mach_splbio) __P((void)) = splhigh;
+int (*Mach_splnet)__P((void)) = splhigh;
+int (*Mach_spltty)__P((void)) = splhigh;
+int (*Mach_splimp)__P((void)) = splhigh;
+int (*Mach_splclock)__P((void)) = splhigh;
+int (*Mach_splstatclock)__P((void)) = splhigh;
-extern int Mach_spl0(), Mach_spl1(), Mach_spl2(), Mach_spl3(), splhigh();
-int (*Mach_splbio)() = splhigh;
-int (*Mach_splnet)() = splhigh;
-int (*Mach_spltty)() = splhigh;
-int (*Mach_splimp)() = splhigh;
-int (*Mach_splclock)() = splhigh;
-int (*Mach_splstatclock)() = splhigh;
extern volatile struct chiptime *Mach_clock_addr;
u_long kmin_tc3_imask, xine_tc3_imask;
+int savectx __P((struct user *up)); /* XXX save state b4 crash*/
+
+
+tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS];
+
+
+/*
+ * Local functions.
+ */
+#ifdef DS5000_240 /* XXX */
+static void asic_init __P((int isa_maxine));
+#endif
+extern int atoi __P((const char *cp));
+int initcpu __P((void));
#ifdef DS5000_240
-u_long kn03_tc3_imask;
-extern u_long latched_cycle_cnt;
+static u_long clkread __P((void)); /* get usec-resolution clock */
#endif
+void dumpsys __P((void)); /* do a dump */
+
+/* initialize bss, etc. from kernel start, before main() is called. */
+extern void
+mach_init __P((int argc, char *argv[], u_int code,
+ const struct callback *cv));
-tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS];
-static void asic_init();
-extern void RemconsInit();
#ifdef DS5000_200
void kn02_enable_intr __P ((u_int slotno,
@@ -223,6 +245,9 @@ void xine_enable_intr __P ((u_int slotno, int (*handler) (intr_arg_t sc),
#endif /*DS5000_25*/
#ifdef DS5000_240
+u_long kn03_tc3_imask;
+extern u_long latched_cycle_cnt;
+void kn03_tc_reset __P((void)); /* XXX unused? */
void kn03_enable_intr __P ((u_int slotno, int (*handler) (intr_arg_t sc),
intr_arg_t sc, int onoff));
#endif /*DS5000_240*/
@@ -235,6 +260,11 @@ volatile u_int *Mach_reset_addr;
void prom_halt __P((int, char *)) __attribute__((__noreturn__));
+#ifdef DEBUG
+/* stacktrace code violates prototypes to get callee's registers */
+extern void stacktrace __P((void)); /*XXX*/
+#endif
+
/*
* safepri is a safe priority for sleep to set for a spin-wait
@@ -245,6 +275,15 @@ int safepri = PSL_LOWIPL;
struct user *proc0paddr;
struct proc nullproc; /* for use by swtch_exit() */
+
+/*
+ * XXX locore callback-vector setup should be done via mips_vector_init()
+ * using CPU-family information, but that doesn't work yet, so for now we
+ * explicitly call the mips1 setup function.
+ */
+extern void mips1_vector_init __P((void));
+
+
/*
* Do all the stuff that locore normally does before calling main().
* Process arguments passed to us by the prom monitor.
@@ -263,8 +302,6 @@ mach_init(argc, argv, code, cv)
register caddr_t v;
caddr_t start;
extern char edata[], end[];
- extern char MachUTLBMiss[], MachUTLBMissEnd[];
- extern char mips_R2000_exception[], mips_R2000_exceptionEnd[];
/* clear the BSS segment */
v = (caddr_t)mips_round_page(end);
@@ -387,7 +424,8 @@ mach_init(argc, argv, code, cv)
i = (*cv->_getsysid)();
cp = "";
} else {
- if (cp = (*callv->_getenv)("systype"))
+ cp = (*callv->_getenv)("systype");
+ if (cp)
i = atoi(cp);
else {
cp = "";
@@ -418,12 +456,13 @@ mach_init(argc, argv, code, cv)
*/
mips_hardware_intr = kn01_intr;
tc_enable_interrupt = kn01_enable_intr; /*XXX*/
- Mach_splbio = Mach_spl0;
- Mach_splnet = Mach_spl1;
- Mach_spltty = Mach_spl2;
+ Mach_splbio = cpu_spl0;
+ Mach_splnet = cpu_spl1;
+ Mach_spltty = cpu_spl2;
Mach_splimp = splhigh; /*XXX Mach_spl1(), if not for malloc()*/
- Mach_splclock = Mach_spl3;
- Mach_splstatclock = Mach_spl3;
+ Mach_splclock = cpu_spl3;
+ Mach_splstatclock = cpu_spl3;
+
Mach_clock_addr = (volatile struct chiptime *)
MACH_PHYS_TO_UNCACHED(KN01_SYS_CLOCK);
strcpy(cpu_model, "3100");
@@ -475,8 +514,8 @@ mach_init(argc, argv, code, cv)
Mach_splnet = Mach_spl0;
Mach_spltty = Mach_spl0;
Mach_splimp = Mach_spl0;
- Mach_splclock = Mach_spl1;
- Mach_splstatclock = Mach_spl1;
+ Mach_splclock = cpu_spl1;
+ Mach_splstatclock = cpu_spl1;
Mach_clock_addr = (volatile struct chiptime *)
MACH_PHYS_TO_UNCACHED(KN02_SYS_CLOCK);
@@ -552,12 +591,24 @@ mach_init(argc, argv, code, cv)
ioasic_base = MACH_PHYS_TO_UNCACHED(XINE_SYS_ASIC);
mips_hardware_intr = xine_intr;
tc_enable_interrupt = xine_enable_intr;
+
+ /* On the MAXINE ioasic interrupts at level 3. */
Mach_splbio = Mach_spl3;
Mach_splnet = Mach_spl3;
Mach_spltty = Mach_spl3;
Mach_splimp = Mach_spl3;
- Mach_splclock = Mach_spl1;
- Mach_splstatclock = Mach_spl1;
+
+ /*
+ * Note priority inversion of ioasic and clock:
+ * clock interrupts are at hw priority 1, and when blocking
+ * clock interrups we we must block hw priority 3
+ * (bio,net,tty) also.
+ *
+ * XXX hw priority 2 is used for memory errors, we
+ * should not disable memory errors during clock interrupts!
+ */
+ Mach_splclock = cpu_spl3;
+ Mach_splstatclock = cpu_spl3;
Mach_clock_addr = (volatile struct chiptime *)
MACH_PHYS_TO_UNCACHED(XINE_SYS_CLOCK);
@@ -591,13 +642,16 @@ mach_init(argc, argv, code, cv)
/*
* Reset interrupts, clear any errors from newconf probes
*/
-
Mach_splbio = Mach_spl0;
Mach_splnet = Mach_spl0;
Mach_spltty = Mach_spl0;
- Mach_splimp = Mach_spl0;
- Mach_splclock = Mach_spl1;
- Mach_splstatclock = Mach_spl1;
+ Mach_splimp = Mach_spl0; /* XXX */
+ /*
+ * Clock interrupts at hw priority 1 must block bio,net,tty
+ * at hw priority 0.
+ */
+ Mach_splclock = cpu_spl1;
+ Mach_splstatclock = cpu_spl1;
Mach_clock_addr = (volatile struct chiptime *)
MACH_PHYS_TO_UNCACHED(KN03_SYS_CLOCK);
@@ -774,7 +828,6 @@ mach_init(argc, argv, code, cv)
* Initialize the virtual memory system.
*/
pmap_bootstrap((vm_offset_t)v);
-
}
@@ -787,7 +840,6 @@ void
cpu_startup()
{
register unsigned i;
- register caddr_t v;
int base, residual;
vm_offset_t minaddr, maxaddr;
vm_size_t size;
@@ -853,12 +905,8 @@ cpu_startup()
VM_PHYS_SIZE, TRUE);
/*
- * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
- * we use the more space efficient malloc in place of kmem_alloc.
+ * Finally, allocate mbuf cluster submap.
*/
- mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
- M_MBUF, M_NOWAIT);
- bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
VM_MBUF_SIZE, FALSE);
/*
@@ -872,7 +920,7 @@ cpu_startup()
#ifdef DEBUG
pmapdebug = opmapdebug;
#endif
- printf("avail mem = %d\n", ptoa(cnt.v_free_count));
+ printf("avail mem = %ld\n", ptoa(cnt.v_free_count));
printf("using %d buffers containing %d bytes of memory\n",
nbuf, bufpages * CLBYTES);
@@ -892,9 +940,11 @@ cpu_startup()
configure();
}
+
/*
* machine dependent system variables.
*/
+int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
@@ -919,6 +969,7 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
/* NOTREACHED */
}
+
/*
* Set registers on exec.
* Clear all registers except sp, pc, and t9.
@@ -940,7 +991,7 @@ setregs(p, pack, stack, retval)
p->p_md.md_regs[PC] = pack->ep_entry & ~3;
p->p_md.md_regs[T9] = pack->ep_entry & ~3; /* abicall requirement */
p->p_md.md_regs[PS] = PSL_USERSET;
- p->p_md.md_flags & ~MDP_FPUSED;
+ p->p_md.md_flags &= ~MDP_FPUSED;
if (machFPCurProcPtr == p)
machFPCurProcPtr = (struct proc *)0;
}
@@ -1009,8 +1060,8 @@ sendsig(catcher, sig, mask, code, type, val)
(void)grow(p, (unsigned)fp);
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) ||
- (sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
- printf("sendsig(%d): sig %d ssp %x usp %x scp %x\n",
+ ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
+ printf("sendsig(%d): sig %d ssp %p usp %p scp %p\n",
p->p_pid, sig, &oonstack, fp, &fp->sf_sc);
#endif
/*
@@ -1074,7 +1125,7 @@ bail:
regs[RA] = (int)PS_STRINGS - (esigcode - sigcode);
#ifdef DEBUG
if ((sigdebug & SDB_FOLLOW) ||
- (sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
+ ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid))
printf("sendsig(%d): sig %d returns\n",
p->p_pid, sig);
#endif
@@ -1108,7 +1159,7 @@ sys_sigreturn(p, v, retval)
scp = SCARG(uap, sigcntxp);
#ifdef DEBUG
if (sigdebug & SDB_FOLLOW)
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
+ printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
#endif
regs = p->p_md.md_regs;
/*
@@ -1119,7 +1170,7 @@ sys_sigreturn(p, v, retval)
if (error || ksc.sc_regs[ZERO] != 0xACEDBADE) {
#ifdef DEBUG
if (!(sigdebug & SDB_FOLLOW))
- printf("sigreturn: pid %d, scp %x\n", p->p_pid, scp);
+ printf("sigreturn: pid %d, scp %p\n", p->p_pid, scp);
printf(" old sp %x ra %x pc %x\n",
regs[SP], regs[RA], regs[PC]);
printf(" new sp %x ra %x pc %x err %d z %x\n",
@@ -1149,7 +1200,7 @@ sys_sigreturn(p, v, retval)
}
int waittime = -1;
-struct pcb dumppcb;
+struct user dumppcb; /* Actually, struct pcb would do. */
/*
@@ -1191,7 +1242,7 @@ dumpsys()
int error;
/* Save registers. */
- savectx(&dumppcb, 0);
+ savectx(&dumppcb);
msgbufmapped = 0;
if (dumpdev == NODEV)
@@ -1204,7 +1255,7 @@ dumpsys()
dumpconf();
if (dumplo < 0)
return;
- printf("\ndumping to dev %x, offset %d\n", dumpdev, dumplo);
+ printf("\ndumping to dev %x, offset %ld\n", dumpdev, dumplo);
printf("dump ");
/*
* XXX
@@ -1256,11 +1307,13 @@ prom_halt(howto, bootstr)
(*callv->_rex)('b');
}
} else if (howto & RB_HALT) {
- volatile void (*f)() = (volatile void (*)())DEC_PROM_REINIT;
+ volatile void (*f) __P((void)) =
+ (volatile void (*) __P((void))) DEC_PROM_REINIT;
(*f)(); /* jump back to prom monitor */
} else {
- volatile void (*f)() = (volatile void (*)())DEC_PROM_AUTOBOOT;
+ volatile void (*f) __P((void)) =
+ (volatile void (*) __P((void)))DEC_PROM_AUTOBOOT;
(*f)(); /* jump back to prom monitor and do 'auto' cmd */
}
@@ -1276,7 +1329,7 @@ boot(howto)
/* take a snap shot before clobbering any registers */
if (curproc)
- savectx(curproc->p_addr, 0);
+ savectx(curproc->p_addr);
#ifdef DEBUG
if (panicstr)
@@ -1324,10 +1377,11 @@ boot(howto)
#endif
dumpsys();
+haltsys:
+
/* run any shutdown hooks */
doshutdownhooks();
-haltsys:
/* Finally, halt/reboot the system. */
printf("%s\n\n", howto & RB_HALT ? "halted." : "rebooting...");
@@ -1423,8 +1477,6 @@ microtime(tvp)
{
int s = splclock();
static struct timeval lasttime;
- register long usec;
-
*tvp = time;
tvp->tv_usec += clkread();
@@ -1447,7 +1499,7 @@ int
initcpu()
{
register volatile struct chiptime *c;
- int i;
+ int i = 0;
#if defined(DS5000_200) || defined(DS5000_25) || defined(DS5000_100) || \
defined(DS5000_240)
@@ -1496,7 +1548,7 @@ initcpu()
*/
int
atoi(s)
- char *s;
+ const char *s;
{
int c;
unsigned base = 10, d;
@@ -1684,7 +1736,7 @@ kmin_enable_intr(slotno, handler, sc, on)
}
#if defined(DEBUG) || defined(DIAGNOSTIC)
- printf("3MIN: imask %x, %sabling slot %d, sc %x addr 0x%x\n",
+ printf("3MIN: imask %lx, %sabling slot %d, sc %p handler %p\n",
kmin_tc3_imask, (on? "en" : "dis"), slotno, sc, handler);
#endif
@@ -1888,6 +1940,7 @@ done:
#endif /* DS5000_240 */
+#ifdef DS5000_240 /* XXX */
/*
* Initialize the I/O asic
*/
@@ -1905,3 +1958,4 @@ asic_init(isa_maxine)
decoder = (volatile u_int *) IOASIC_REG_SCSI_DECODE(ioasic_base);
(*decoder) = 0x00000000e;
}
+#endif /* DS5000_240 XXX */
diff --git a/sys/arch/pmax/pmax/mem.c b/sys/arch/pmax/pmax/mem.c
index c1d99888c86..b41fb945532 100644
--- a/sys/arch/pmax/pmax/mem.c
+++ b/sys/arch/pmax/pmax/mem.c
@@ -52,6 +52,7 @@
#include <sys/malloc.h>
#include <sys/msgbuf.h>
+#include <pmax/conf.h>
#include <machine/cpu.h>
#include <vm/vm.h>
@@ -61,9 +62,10 @@ caddr_t zeropage;
/*ARGSUSED*/
int
-mmopen(dev, flag, mode)
+mmopen(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
return (0);
@@ -71,9 +73,10 @@ mmopen(dev, flag, mode)
/*ARGSUSED*/
int
-mmclose(dev, flag, mode)
+mmclose(dev, flag, mode, p)
dev_t dev;
int flag, mode;
+ struct proc *p;
{
return (0);
@@ -86,7 +89,7 @@ mmrw(dev, uio, flags)
struct uio *uio;
int flags;
{
- register vm_offset_t o, v;
+ register vm_offset_t v;
register int c;
register struct iovec *iov;
int error = 0;
diff --git a/sys/arch/pmax/pmax/pmap.c b/sys/arch/pmax/pmax/pmap.c
index 46b0b1e95c8..5bcb7e0882f 100644
--- a/sys/arch/pmax/pmax/pmap.c
+++ b/sys/arch/pmax/pmax/pmap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.13 1996/10/13 03:39:53 christos Exp $ */
+/* $NetBSD: pmap.c,v 1.17 1997/05/26 23:02:11 jonathan Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -98,7 +98,6 @@ typedef struct pv_entry {
} *pv_entry_t;
pv_entry_t pv_table; /* array of entries, one per page */
-extern void pmap_remove_pv();
#define pa_index(pa) atop((pa) - first_phys_addr)
#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
@@ -153,7 +152,7 @@ vm_offset_t avail_end; /* PA of last available physical page */
vm_size_t mem_size; /* memory size in bytes */
vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss)*/
vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */
-int pmaxpagesperpage; /* PAGE_SIZE / NBPG */
+int mipspagesperpage; /* PAGE_SIZE / NBPG */
#ifdef ATTR
char *pmap_attributes; /* reference and modify bits */
#endif
@@ -163,6 +162,13 @@ int tlbpid_cnt = 2; /* next available TLB PID */
pt_entry_t *Sysmap; /* kernel pte table */
u_int Sysmapsize; /* number of pte's in Sysmap */
+
+/* Forward function declarations */
+void pmap_remove_pv __P((pmap_t pmap, vm_offset_t va, vm_offset_t pa));
+int pmap_alloc_tlbpid __P((register struct proc *p));
+void pmap_zero_page __P((vm_offset_t phys));
+
+
/*
* Bootstrap the system enough to run with virtual memory.
* firstaddr is the first unused kseg0 address (not page aligned).
@@ -215,7 +221,7 @@ pmap_bootstrap(firstaddr)
virtual_avail = VM_MIN_KERNEL_ADDRESS;
virtual_end = VM_MIN_KERNEL_ADDRESS + Sysmapsize * NBPG;
/* XXX need to decide how to set cnt.v_page_size */
- pmaxpagesperpage = 1;
+ mipspagesperpage = 1;
simple_lock_init(&pmap_kernel()->pm_lock);
pmap_kernel()->pm_count = 1;
@@ -262,7 +268,7 @@ pmap_init(phys_start, phys_end)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_INIT))
- printf("pmap_init(%x, %x)\n", phys_start, phys_end);
+ printf("pmap_init(%lx, %lx)\n", phys_start, phys_end);
#endif
}
@@ -286,7 +292,7 @@ pmap_create(size)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_create(%x)\n", size);
+ printf("pmap_create(%lx)\n", size);
#endif
/*
* Software use map does not need a pmap
@@ -320,7 +326,7 @@ pmap_pinit(pmap)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_pinit(%x)\n", pmap);
+ printf("pmap_pinit(%p)\n", pmap);
#endif
simple_lock_init(&pmap->pm_lock);
pmap->pm_count = 1;
@@ -333,13 +339,12 @@ pmap_pinit(pmap)
} else {
register struct segtab *stp;
vm_page_t mem;
- void pmap_zero_page();
mem = vm_page_alloc1();
pmap_zero_page(VM_PAGE_TO_PHYS(mem));
pmap->pm_segtab = stp = (struct segtab *)
MACH_PHYS_TO_CACHED(VM_PAGE_TO_PHYS(mem));
- i = pmaxpagesperpage * (NBPG / sizeof(struct segtab));
+ i = mipspagesperpage * (NBPG / sizeof(struct segtab));
s = splimp();
while (--i != 0) {
stp++;
@@ -353,7 +358,7 @@ pmap_pinit(pmap)
if (pmap->pm_segtab->seg_tab[i] != 0)
panic("pmap_pinit: pm_segtab != 0");
#endif
- if (pmap == &vmspace0.vm_pmap) {
+ if (pmap == vmspace0.vm_map.pmap) {
/*
* The initial process has already been allocated a TLBPID
* in mach_init().
@@ -380,7 +385,7 @@ pmap_destroy(pmap)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_destroy(%x)\n", pmap);
+ printf("pmap_destroy(%p)\n", pmap);
#endif
if (pmap == NULL)
return;
@@ -406,7 +411,7 @@ pmap_release(pmap)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_CREATE))
- printf("pmap_release(%x)\n", pmap);
+ printf("pmap_release(%p)\n", pmap);
#endif
if (pmap->pm_segtab) {
@@ -450,7 +455,7 @@ pmap_reference(pmap)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_reference(%x)\n", pmap);
+ printf("pmap_reference(%p)\n", pmap);
#endif
if (pmap != NULL) {
simple_lock(&pmap->pm_lock);
@@ -476,7 +481,7 @@ pmap_remove(pmap, sva, eva)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%x, %x, %x)\n", pmap, sva, eva);
+ printf("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva);
remove_stats.calls++;
#endif
if (pmap == NULL)
@@ -576,8 +581,8 @@ pmap_page_protect(pa, prot)
#ifdef DEBUG
if ((pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) ||
- prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE))
- printf("pmap_page_protect(%x, %x)\n", pa, prot);
+ (prot == VM_PROT_NONE && (pmapdebug & PDB_REMOVE)))
+ printf("pmap_page_protect(%lx, %x)\n", pa, prot);
#endif
if (!IS_VM_PHYSADDR(pa))
return;
@@ -642,7 +647,8 @@ pmap_protect(pmap, sva, eva, prot)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT))
- printf("pmap_protect(%x, %x, %x, %x)\n", pmap, sva, eva, prot);
+ printf("pmap_protect(%p, %lx, %lx, %x)\n",
+ pmap, sva, eva, prot);
#endif
if (pmap == NULL)
return;
@@ -814,12 +820,12 @@ pmap_enter(pmap, va, pa, prot, wired)
{
register pt_entry_t *pte;
register u_int npte;
- register int i, j;
+ register int i;
vm_page_t mem;
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_ENTER))
- printf("pmap_enter(%x, %x, %x, %x, %x)\n",
+ printf("pmap_enter(%p, %lx, %lx, %x, %x)\n",
pmap, va, pa, prot, wired);
#endif
#ifdef DIAGNOSTIC
@@ -880,7 +886,7 @@ pmap_enter(pmap, va, pa, prot, wired)
s = splimp();
#ifdef DEBUG
if (pmapdebug & PDB_ENTER)
- printf("pmap_enter: pv %x: was %x/%x/%x\n",
+ printf("pmap_enter: pv %p: was %lx/%p/%p\n",
pv, pv->pv_va, pv->pv_pmap, pv->pv_next);
#endif
if (pv->pv_pmap == NULL) {
@@ -889,7 +895,7 @@ pmap_enter(pmap, va, pa, prot, wired)
*/
#ifdef DEBUG
if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: first pv: pmap %x va %x\n",
+ printf("pmap_enter: first pv: pmap %p va %lx\n",
pmap, va);
enter_stats.firstpv++;
#endif
@@ -930,7 +936,7 @@ pmap_enter(pmap, va, pa, prot, wired)
}
#ifdef DEBUG
if (pmapdebug & PDB_PVENTRY)
- printf("pmap_enter: new pv: pmap %x va %x\n",
+ printf("pmap_enter: new pv: pmap %p va %lx\n",
pmap, va);
#endif
/* can this cause us to recurse forever? */
@@ -975,10 +981,10 @@ pmap_enter(pmap, va, pa, prot, wired)
pte = kvtopte(va);
npte |= pa | PG_V | PG_G;
if (wired) {
- pmap->pm_stats.wired_count += pmaxpagesperpage;
+ pmap->pm_stats.wired_count += mipspagesperpage;
npte |= PG_WIRED;
}
- i = pmaxpagesperpage;
+ i = mipspagesperpage;
do {
if (!(pte->pt_entry & PG_V)) {
pmap->pm_stats.resident_count++;
@@ -1015,7 +1021,7 @@ pmap_enter(pmap, va, pa, prot, wired)
*/
npte |= pa | PG_V;
if (wired) {
- pmap->pm_stats.wired_count += pmaxpagesperpage;
+ pmap->pm_stats.wired_count += mipspagesperpage;
npte |= PG_WIRED;
}
#ifdef DEBUG
@@ -1026,7 +1032,7 @@ pmap_enter(pmap, va, pa, prot, wired)
printf("\n");
}
#endif
- i = pmaxpagesperpage;
+ i = mipspagesperpage;
do {
pte->pt_entry = npte;
if (pmap->pm_tlbgen == tlbpid_gen)
@@ -1057,7 +1063,7 @@ pmap_change_wiring(pmap, va, wired)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_WIRING))
- printf("pmap_change_wiring(%x, %x, %x)\n", pmap, va, wired);
+ printf("pmap_change_wiring(%p, %lx, %x)\n", pmap, va, wired);
#endif
if (pmap == NULL)
return;
@@ -1080,7 +1086,7 @@ pmap_change_wiring(pmap, va, wired)
pte += (va >> PGSHIFT) & (NPTEPG - 1);
}
- i = pmaxpagesperpage;
+ i = mipspagesperpage;
if (!(pte->pt_entry & PG_WIRED) && p)
pmap->pm_stats.wired_count += i;
else if ((pte->pt_entry & PG_WIRED) && !p)
@@ -1107,7 +1113,7 @@ pmap_extract(pmap, va)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract(%x, %x) -> ", pmap, va);
+ printf("pmap_extract(%p, %lx) -> ", pmap, va);
#endif
if (!pmap->pm_segtab) {
@@ -1131,7 +1137,7 @@ pmap_extract(pmap, va)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_extract: pa %x\n", pa);
+ printf("pmap_extract: pa %lx\n", pa);
#endif
return (pa);
}
@@ -1154,7 +1160,7 @@ pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy(%x, %x, %x, %x, %x)\n",
+ printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n",
dst_pmap, src_pmap, dst_addr, len, src_addr);
#endif
}
@@ -1195,7 +1201,7 @@ pmap_collect(pmap)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_collect(%x)\n", pmap);
+ printf("pmap_collect(%p)\n", pmap);
#endif
}
@@ -1211,10 +1217,11 @@ pmap_zero_page(phys)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_zero_page(%x)\n", phys);
+ printf("pmap_zero_page(%lx)\n", phys);
#endif
p = (int *)MACH_PHYS_TO_CACHED(phys);
end = p + PAGE_SIZE / sizeof(int);
+ /* XXX blkclr()? */
do {
p[0] = 0;
p[1] = 0;
@@ -1237,7 +1244,7 @@ pmap_copy_page(src, dst)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_copy_page(%x, %x)\n", src, dst);
+ printf("pmap_copy_page(%lx, %lx)\n", src, dst);
#endif
s = (int *)MACH_PHYS_TO_CACHED(src);
d = (int *)MACH_PHYS_TO_CACHED(dst);
@@ -1279,7 +1286,7 @@ pmap_pageable(pmap, sva, eva, pageable)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_pageable(%x, %x, %x, %x)\n",
+ printf("pmap_pageable(%p, %lx, %lx, %x)\n",
pmap, sva, eva, pageable);
#endif
}
@@ -1294,7 +1301,7 @@ pmap_clear_modify(pa)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_modify(%x)\n", pa);
+ printf("pmap_clear_modify(%lx)\n", pa);
#endif
#ifdef ATTR
pmap_attributes[atop(pa)] &= ~PMAP_ATTR_MOD;
@@ -1313,7 +1320,7 @@ pmap_clear_reference(pa)
#ifdef DEBUG
if (pmapdebug & PDB_FOLLOW)
- printf("pmap_clear_reference(%x)\n", pa);
+ printf("pmap_clear_reference(%lx)\n", pa);
#endif
#ifdef ATTR
pmap_attributes[atop(pa)] &= ~PMAP_ATTR_REF;
@@ -1386,7 +1393,7 @@ pmap_alloc_tlbpid(p)
register pmap_t pmap;
register int id;
- pmap = &p->p_vmspace->vm_pmap;
+ pmap = p->p_vmspace->vm_map.pmap;
if (pmap->pm_tlbgen != tlbpid_gen) {
id = tlbpid_cnt;
if (id == VMMACH_NUM_PIDS) {
@@ -1409,7 +1416,7 @@ pmap_alloc_tlbpid(p)
curproc->p_pid, curproc->p_comm);
else
printf("pmap_alloc_tlbpid: curproc <none> ");
- printf("segtab %x tlbpid %d pid %d '%s'\n",
+ printf("segtab %p tlbpid %d pid %d '%s'\n",
pmap->pm_segtab, id, p->p_pid, p->p_comm);
}
#endif
@@ -1429,7 +1436,7 @@ pmap_remove_pv(pmap, va, pa)
#ifdef DEBUG
if (pmapdebug & (PDB_FOLLOW|PDB_PVENTRY))
- printf("pmap_remove_pv(%x, %x, %x)\n", pmap, va, pa);
+ printf("pmap_remove_pv(%p, %lx, %lx)\n", pmap, va, pa);
#endif
/*
* Remove page from the PV table (raise IPL since we
diff --git a/sys/arch/pmax/pmax/pmax_trap.c b/sys/arch/pmax/pmax/pmax_trap.c
index e6300d3bc53..86968c3d611 100644
--- a/sys/arch/pmax/pmax/pmax_trap.c
+++ b/sys/arch/pmax/pmax/pmax_trap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pmax_trap.c,v 1.39 1996/10/13 03:39:54 christos Exp $ */
+/* $NetBSD: pmax_trap.c,v 1.44 1997/05/31 20:33:35 mhitch Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -84,13 +84,13 @@
#include <net/if.h>
#include <netinet/if_ether.h>
-struct ifnet; struct arpcom;
+struct ifnet; struct ethercom;
#include <dev/ic/am7990var.h> /* Lance interrupt for kn01 */
#include "asc.h"
#include "sii.h"
#include "le_pmax.h"
-#include "dc.h"
+#include "dc_ds.h"
#include <sys/cdefs.h>
#include <sys/syslog.h>
@@ -110,7 +110,10 @@ struct proc *machFPCurProcPtr; /* pointer to last proc to use FP */
+#ifdef DS3100
static void pmax_errintr __P((void));
+#endif
+
static void kn02_errintr __P((void)), kn02ba_errintr __P((void));
#ifdef DS5000_240
@@ -175,7 +178,7 @@ int leintr __P((void *));
#if NSII > 0
int siiintr __P((void *));
#endif
-#if NDC > 0
+#if NDC_DS > 0
int dcintr __P((void *));
#endif
@@ -204,11 +207,12 @@ kn01_intr(mask, pc, statusReg, causeReg)
hardclock(&cf);
intrcnt[HARDCLOCK]++;
- /* keep clock interrupts enabled */
+ /* keep clock interrupts enabled when we return */
causeReg &= ~MACH_INT_MASK_3;
}
- /* Re-enable clock interrupts ASAP*/
- splx(MACH_INT_MASK_3 | MACH_SR_INT_ENA_CUR);
+
+ /* If clock interrupts were enabled, re-enable them ASAP. */
+ splx(MACH_SR_INT_ENA_CUR | (statusReg & MACH_INT_MASK_3));
#if NSII > 0
if (mask & MACH_INT_MASK_0) {
@@ -230,12 +234,12 @@ kn01_intr(mask, pc, statusReg, causeReg)
}
#endif /* NLE_PMAX */
-#if NDC > 0
+#if NDC_DS > 0
if (mask & MACH_INT_MASK_2) {
dcintr(dc_cd.cd_devs[0]);
intrcnt[SERIAL0_INTR]++;
}
-#endif /* NDC */
+#endif /* NDC_DS */
if (mask & MACH_INT_MASK_4) {
pmax_errintr();
@@ -282,11 +286,13 @@ kn02_intr(mask, pc, statusReg, causeReg)
hardclock(&cf);
intrcnt[HARDCLOCK]++;
- /* keep clock interrupts enabled */
+ /* keep clock interrupts enabled when we return */
causeReg &= ~MACH_INT_MASK_1;
}
- /* Re-enable clock interrupts */
- splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR);
+
+ /* If clock interrups were enabled, re-enable them ASAP. */
+ splx(MACH_SR_INT_ENA_CUR | (statusReg & MACH_INT_MASK_1));
+
if (mask & MACH_INT_MASK_0) {
static int intr_map[8] = { SLOT0_INTR, SLOT1_INTR, SLOT2_INTR,
/* these two bits reserved */
@@ -476,10 +482,12 @@ xine_intr(mask, pc, statusReg, causeReg)
cf.sr = statusReg;
hardclock(&cf);
intrcnt[HARDCLOCK]++;
+ /* keep clock interrupts enabled when we return */
causeReg &= ~MACH_INT_MASK_1;
}
- /* reenable clock interrupts */
- splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR);
+
+ /* If clock interrups were enabled, re-enable them ASAP. */
+ splx(MACH_SR_INT_ENA_CUR | (statusReg & MACH_INT_MASK_1));
if (mask & MACH_INT_MASK_3) {
intr = *intrp;
@@ -616,10 +624,12 @@ kn03_intr(mask, pc, statusReg, causeReg)
hardclock(&cf);
intrcnt[HARDCLOCK]++;
old_buscycle = latched_cycle_cnt - old_buscycle;
+ /* keep clock interrupts enabled when we return */
causeReg &= ~MACH_INT_MASK_1;
}
- /* reenable clock interrupts */
- splx(MACH_INT_MASK_1 | MACH_SR_INT_ENA_CUR);
+
+ /* If clock interrups were enabled, re-enable them ASAP. */
+ splx(MACH_SR_INT_ENA_CUR | (statusReg & MACH_INT_MASK_1));
/*
* Check for late clock interrupts (allow 10% slop). Be careful
diff --git a/sys/arch/pmax/pmax/process_machdep.c b/sys/arch/pmax/pmax/process_machdep.c
index ef3ba42520a..a9124f6e224 100644
--- a/sys/arch/pmax/pmax/process_machdep.c
+++ b/sys/arch/pmax/pmax/process_machdep.c
@@ -102,9 +102,9 @@ int
process_sstep(p, sstep)
struct proc *p;
{
- /* XXX correct semantics: sstep once or forevermore? */
+ /* XXX what are the correct semantics: sstep once, or forevermore? */
if(sstep)
- cpu_singlestep(p);
+ mips_singlestep(p);
return (0);
}
diff --git a/sys/arch/pmax/pmax/trap.c b/sys/arch/pmax/pmax/trap.c
index 88ba03e83dc..e59dfc99cc3 100644
--- a/sys/arch/pmax/pmax/trap.c
+++ b/sys/arch/pmax/pmax/trap.c
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.50 1996/10/13 21:37:49 jonathan Exp $ */
+/* $NetBSD: trap.c,v 1.55 1997/05/25 10:01:38 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -346,6 +346,8 @@ extern void MachSwitchFPState __P((struct proc *from, struct user *to));
/* only called by locore */
extern u_int trap __P((u_int status, u_int cause, u_int vaddr, u_int pc,
int args));
+extern void interrupt __P((u_int status, u_int cause, u_int pc));
+extern void softintr __P((unsigned statusReg, unsigned pc));
#ifdef DEBUG /* stack trace code, also useful to DDB one day */
@@ -1044,7 +1046,7 @@ interrupt(statusReg, causeReg, pc /* XXX what, args */ )
/* process network interrupt if we trapped or will very soon */
/* XXX fixme: operator precedence botch? */
if ((mask & MACH_SOFT_INT_MASK_1) ||
- netisr && (statusReg & MACH_SOFT_INT_MASK_1)) {
+ (netisr && (statusReg & MACH_SOFT_INT_MASK_1))) {
clearsoftnet();
cnt.v_soft++;
intrcnt[SOFTNET_INTR]++;
@@ -1325,7 +1327,7 @@ MachEmulateBranch(regsPtr, instPC, fpcCSR, allowNonBranch)
* resuming execution, and then restoring the old instruction.
*/
int
-cpu_singlestep(p)
+mips_singlestep(p)
register struct proc *p;
{
register unsigned va;
diff --git a/sys/arch/pmax/pmax/trap.h b/sys/arch/pmax/pmax/trap.h
index 6637cb863df..b6176ed2d34 100644
--- a/sys/arch/pmax/pmax/trap.h
+++ b/sys/arch/pmax/pmax/trap.h
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.h,v 1.1 1995/08/28 20:01:34 jonathan Exp $ */
+/* $NetBSD: trap.h,v 1.2 1997/05/25 05:01:51 jonathan Exp $ */
/*
* Copyright (c) 1995, Jonathan Stone
@@ -33,7 +33,7 @@
/*
* Functions defined in trap.c, used in machdep.c and locore
*/
-extern int pmax_intr __P((u_int mask, u_int pc, u_int statusReg,
+extern int kn01_intr __P((u_int mask, u_int pc, u_int statusReg,
u_int causeReg));
extern int kmin_intr __P((u_int mask, u_int pc, u_int statusReg,
u_int causeReg));
@@ -43,7 +43,7 @@ extern int xine_intr __P((u_int mask, u_int pc, u_int statusReg,
extern int kn02_intr __P((u_int mask, u_int pc, u_int statusReg,
u_int causeReg));
-extern int (*pmax_hardware_intr) __P((u_int mask, u_int pc, u_int statusReg,
+extern int (*mips_hardware_intr) __P((u_int mask, u_int pc, u_int statusReg,
u_int causeReg));
#ifdef DS5000_240
extern int kn03_intr __P((u_int mask, u_int pc, u_int statusReg,
diff --git a/sys/arch/pmax/pmax/vm_machdep.c b/sys/arch/pmax/pmax/vm_machdep.c
index 3a211a943a0..2e95d9fd75f 100644
--- a/sys/arch/pmax/pmax/vm_machdep.c
+++ b/sys/arch/pmax/pmax/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.13 1996/10/13 03:39:57 christos Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.15 1997/05/25 10:16:17 jonathan Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -67,6 +67,8 @@ extern int copykstack __P((struct user *up));
extern void MachSaveCurFPState __P((struct proc *p));
extern int switch_exit __P((void)); /* XXX never returns? */
+extern vm_offset_t kvtophys __P((vm_offset_t kva)); /* XXX */
+
/*
* Finish a fork operation, with process p2 nearly set up.
* Copy and update the kernel stack and pcb, making the child
@@ -114,7 +116,7 @@ cpu_fork(p1, p2)
*/
p2->p_addr->u_pcb = p1->p_addr->u_pcb;
/* cache segtab for ULTBMiss() */
- p2->p_addr->u_pcb.pcb_segtab = (void *)p2->p_vmspace->vm_pmap.pm_segtab;
+ p2->p_addr->u_pcb.pcb_segtab = (void *)p2->p_vmspace->vm_map.pmap->pm_segtab;
/*
* Arrange for a non-local goto when the new process
@@ -346,7 +348,8 @@ vunmapbuf(bp, len)
* The first two are so cheap they could just be macros. The last two
* overlap, so we must check for UADDR pages first.
*
- * XXX the u-area mappng should all change anyway.
+ * XXX the double-mapped u-area holding the current process's kernel stack
+ * and u-area at a fixed address should be fixed.
*/
vm_offset_t
kvtophys(vm_offset_t kva)
diff --git a/sys/arch/pmax/tc/asic.c b/sys/arch/pmax/tc/asic.c
index 28771c00e55..7cb367b7dae 100644
--- a/sys/arch/pmax/tc/asic.c
+++ b/sys/arch/pmax/tc/asic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: asic.c,v 1.15 1996/10/13 03:39:58 christos Exp $ */
+/* $NetBSD: asic.c,v 1.16 1997/05/24 09:30:27 jonathan Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -113,7 +113,7 @@ struct asic_slot *asic_slots;
#ifdef IOASIC_DEBUG
#define IOASIC_DPRINTF(x) printf x
#else
-#define IOASIC_DPRINTF(x) (void) x
+#define IOASIC_DPRINTF(x) do { if (0) printf x ; } while (0)
#endif
int
diff --git a/sys/arch/pmax/tc/scc.c b/sys/arch/pmax/tc/scc.c
index 2c656655873..79252ac3c1b 100644
--- a/sys/arch/pmax/tc/scc.c
+++ b/sys/arch/pmax/tc/scc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scc.c,v 1.18 1996/10/16 05:04:51 jonathan Exp $ */
+/* $NetBSD: scc.c,v 1.22 1997/05/25 10:28:22 jonathan Exp $ */
/*
* Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University
@@ -66,8 +66,6 @@
*/
-#include "scc.h"
-#if NSCC > 0
/*
* Intel 82530 dual usart chip driver. Supports the serial port(s) on the
* Personal DECstation 5000/xx and DECstation 5000/1xx, plus the keyboard
@@ -124,6 +122,8 @@
#include <machine/conf.h>
+#include "rasterconsole.h"
+
extern void ttrstrt __P((void *));
#ifdef alpha
@@ -136,8 +136,10 @@ extern void ttrstrt __P((void *));
* support from the tty drivers. This is ugly and broken and won't
* compile on Alphas.
*/
-#ifdef pmax
+#if defined (pmax)
+#if NRASTERCONSOLE > 0
#define HAVE_RCONS
+#endif
extern int pending_remcons;
#endif
@@ -315,6 +317,7 @@ static struct consdev scccons = {
NULL, NULL, sccGetc, sccPutc, sccPollc, NODEV, 0
};
void scc_consinit __P((dev_t dev, scc_regmap_t *sccaddr));
+void scc_oconsinit __P((struct scc_softc *sc, dev_t dev));
/*
@@ -416,8 +419,12 @@ sccmatch(parent, cfdata, aux)
(strncmp(d->iada_modname, "scc", TC_ROM_LLEN)!= 0))
return (0);
- /* XXX MATCH CFLOC */
- if (cf->cf_unit >= NSCC)
+ /*
+ * Check user-specified offset against the ioasic offset.
+ * Allow it to be wildcarded.
+ */
+ if (cf->cf_loc[0] != -1 &&
+ cf->cf_loc[0] != d->iada_offset)
return (0);
/* Get the address, and check it for validity. */
@@ -510,10 +517,12 @@ sccattach(parent, self, aux)
* For a remote console, wait a while for previous output to
* complete.
*/
-#ifdef HAVE_RCONS
+#ifdef pmax
if (CONSOLE_ON_UNIT(unit) && (cn_tab->cn_pri == CN_REMOTE))
DELAY(10000);
-#else
+#endif
+
+#ifdef alpha
if ((cputype == ST_DEC_3000_500 && sc->sc_dv.dv_unit == 1) ||
(cputype == ST_DEC_3000_300 && sc->sc_dv.dv_unit == 0))
DELAY(10000);
@@ -557,8 +566,10 @@ sccattach(parent, self, aux)
* on kn03, maybe kmin?
* And what about maxine?
*/
- if (cn_tab->cn_dev == unit && cputype != DS_MAXINE)
+ if (cn_tab->cn_dev == unit && cputype != DS_MAXINE) {
+ printf ("\n");
return;
+ }
/*
* If we are using the PROM serial-console routines
@@ -576,7 +587,7 @@ sccattach(parent, self, aux)
printf(" (In sccattach: cn_dev = 0x%x)", cn_tab->cn_dev);
printf(" (Unit = %d)", unit);
- printf(": console");
+ printf(": console\n");
pending_remcons = 0;
/*
* XXX We should support configurations where the PROM
@@ -1448,14 +1459,12 @@ scc_modem_intr(dev)
* Is it related to console handling?
*/
#ifndef alpha
-#ifdef notyet /*XXX -does this help pmax console? */
if (car) {
/* carrier present */
if (!(tp->t_state & TS_CARR_ON))
(void)(*linesw[tp->t_line].l_modem)(tp, 1);
} else if (tp->t_state & TS_CARR_ON)
(void)(*linesw[tp->t_line].l_modem)(tp, 0);
-#endif /*notyet*/
#endif /* !alpha */
splx(s);
}
@@ -1603,4 +1612,3 @@ rr(msg, regs)
r0, r1, r2, r10, r15);
}
#endif /* SCC_DEBUG */
-#endif /* NSCC */
diff --git a/sys/arch/pmax/tc/tc_subr.c b/sys/arch/pmax/tc/tc_subr.c
index 22241ed5a5c..8cb7487cae0 100644
--- a/sys/arch/pmax/tc/tc_subr.c
+++ b/sys/arch/pmax/tc/tc_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_subr.c,v 1.9 1996/10/13 03:40:03 christos Exp $ */
+/* $NetBSD: tc_subr.c,v 1.10 1997/05/24 09:17:24 jonathan Exp $ */
/*
* Copyright 1996 The Board of Trustees of The Leland Stanford
@@ -14,17 +14,12 @@
*/
#include <sys/param.h>
+#include <sys/systm.h> /* printf() */
#include <sys/device.h>
#include <dev/cons.h>
#include <dev/tc/tcvar.h>
#include <machine/autoconf.h>
-
-/* Which TC framebuffers have drivers, for configuring a console device. */
-#include <cfb.h>
-#include <mfb.h>
-#include <sfb.h>
-
extern int pmax_boardtype;
@@ -64,6 +59,20 @@ static int tc_consprobeslot __P((tc_addr_t slotaddr));
#include <pmax/pmax/turbochannel.h>
+#include <machine/fbio.h>
+#include <machine/fbvar.h>
+#include <pmax/dev/cfbvar.h>
+#include <pmax/dev/mfbvar.h>
+#include <pmax/dev/sfbvar.h>
+#include <pmax/dev/xcfbvar.h>
+
+
+/* Which TC framebuffers have drivers, for configuring a console device. */
+#include "cfb.h"
+#include "mfb.h"
+#include "sfb.h"
+
+
/*#include <pmax/pmax/nameglue.h>*/
#define KV(x) ((tc_addr_t)MACH_PHYS_TO_UNCACHED(x))
@@ -389,7 +398,6 @@ tc_consprobeslot(tc_slotaddr)
char name[20];
void *slotaddr = (void *) tc_slotaddr;
- struct tcbus_attach_args * sc_desc;
if (tc_badaddr(slotaddr))
return (0);
@@ -445,7 +453,7 @@ tc_ds_intr_establish(dev, cookie, level, handler, val)
/* Never tested on these processors */
if (cputype == DS_3MIN || cputype == DS_MAXINE)
- printf("tc_enable %s sc %x slot %d\n",
+ printf("tc_enable %s sc %x slot %p\n",
dev->dv_xname, (int)val, cookie);
#ifdef DIAGNOSTIC
@@ -507,5 +515,5 @@ tc_ds_ioasic_iointr (framep, vec)
void * framep;
int vec;
{
- printf("bogus interrupt handler fp %x vec %d\n", framep, vec);
+ printf("bogus interrupt handler fp %p vec %d\n", framep, vec);
}