summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme68k/dev')
-rw-r--r--sys/arch/mvme68k/dev/clock.c31
-rw-r--r--sys/arch/mvme68k/dev/vme.c23
2 files changed, 36 insertions, 18 deletions
diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c
index d0836dd2fbb..ee5cd1b447d 100644
--- a/sys/arch/mvme68k/dev/clock.c
+++ b/sys/arch/mvme68k/dev/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.8 2003/06/02 23:27:50 millert Exp $ */
+/* $OpenBSD: clock.c,v 1.9 2003/10/08 20:18:34 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -81,15 +81,13 @@
#endif
#if NPCCTWO > 0
#include <mvme68k/dev/pcctworeg.h>
+#include <mvme68k/dev/vme.h>
+extern struct vme2reg *sys_vme2;
#endif
#if NMC > 0
#include <mvme68k/dev/mcreg.h>
#endif
-#if defined(GPROF)
-#include <sys/gmon.h>
-#endif
-
/*
* Statistics clock interval and variance, in usec. Variance must be a
* power of two. Since this gives us an even number, not an odd number,
@@ -406,13 +404,24 @@ delay(us)
#if NPCCTWO > 0
case BUS_PCCTWO:
/*
- * XXX MVME167 doesn't have a 3rd free-running timer,
- * so we use a stupid loop. Fix the code to watch t1:
- * the profiling timer.
+ * Use the first VMEChip2 timer in polling mode whenever
+ * possible. However, since clock attaches before vme,
+ * use a tight loop if necessary.
*/
- c = 4 * us;
- while (--c > 0)
- ;
+ if (sys_vme2 != NULL) {
+ sys_vme2->vme2_t1cmp = 0xffffffff;
+ sys_vme2->vme2_t1count = 0;
+ sys_vme2->vme2_tctl |= VME2_TCTL_CEN;
+
+ while (sys_vme2->vme2_t1count < us)
+ ;
+
+ sys_vme2->vme2_tctl &= ~VME2_TCTL_CEN;
+ } else {
+ c = 4 * us;
+ while (--c > 0)
+ ;
+ }
break;
#endif
}
diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c
index 179237d2523..1dbca59ebca 100644
--- a/sys/arch/mvme68k/dev/vme.c
+++ b/sys/arch/mvme68k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vme.c,v 1.15 2003/06/02 05:09:14 deraadt Exp $ */
+/* $OpenBSD: vme.c,v 1.16 2003/10/08 20:18:34 miod Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -69,6 +69,8 @@ int vmeprint(void *, const char *);
static int vmebustype;
+struct vme2reg *sys_vme2;
+
struct cfattach vme_ca = {
sizeof(struct vmesoftc), vmematch, vmeattach
};
@@ -344,7 +346,6 @@ vmeattach(parent, self, args)
#if NMC > 0 || NPCCTWO > 0
struct vme2reg *vme2;
#endif
- int scon;
sc->sc_vaddr = ca->ca_vaddr;
@@ -353,8 +354,9 @@ vmeattach(parent, self, args)
#if NPCC > 0
case BUS_PCC:
vme1 = (struct vme1reg *)sc->sc_vaddr;
- scon = (vme1->vme1_scon & VME1_SCON_SWITCH);
- printf(": %sscon\n", scon ? "" : "not ");
+ if (vme1->vme1_scon & VME1_SCON_SWITCH)
+ printf(": system controller");
+ printf("\n");
vme1chip_init(sc);
break;
#endif
@@ -362,8 +364,9 @@ vmeattach(parent, self, args)
case BUS_MC:
case BUS_PCCTWO:
vme2 = (struct vme2reg *)sc->sc_vaddr;
- scon = (vme2->vme2_tctl & VME2_TCTL_SCON);
- printf(": %ssystem controller\n", scon ? "" : "not ");
+ if (vme2->vme2_tctl & VME2_TCTL_SCON)
+ printf(": system controller");
+ printf("\n");
vme2chip_init(sc);
break;
#endif
@@ -445,6 +448,8 @@ vme2chip_init(sc)
struct vme2reg *vme2 = (struct vme2reg *)sc->sc_vaddr;
u_long ctl;
+ sys_vme2 = vme2;
+
/* turn off SYSFAIL LED */
vme2->vme2_tctl &= ~VME2_TCTL_SYSFAIL;
@@ -500,7 +505,11 @@ vme2chip_init(sc)
vme2->vme2_irqen |= VME2_IRQ_AB;
}
#endif
- vme2->vme2_irqen = vme2->vme2_irqen | VME2_IRQ_ACF;
+ /*
+ * Enable ACFAIL interrupt, but disable Timer 1 interrupt - we
+ * prefer it without for delay().
+ */
+ vme2->vme2_irqen = (vme2->vme2_irqen | VME2_IRQ_ACF) & ~VME2_IRQ_TIC1;
}
/*