diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-08 22:36:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2003-10-08 22:36:12 +0000 |
commit | 8f167219007d99193220cb340c7fb5e760fccf3d (patch) | |
tree | d91904a93ffc381874de04686aeb10f009894eea /sys/arch | |
parent | aed69c053f17e2089eaf663c73da3b75a5a6e0dc (diff) |
Sync VMEChip2 timer usage with mvme68k (i.e. make it slightly more sane).
Also, use it even when the 1x7 is not a system controller - this does not
matter.
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mvme88k/dev/clock.c | 53 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sclock.c | 17 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/vme.c | 47 |
3 files changed, 56 insertions, 61 deletions
diff --git a/sys/arch/mvme88k/dev/clock.c b/sys/arch/mvme88k/dev/clock.c index 5166a30746a..03b2fa8f1ad 100644 --- a/sys/arch/mvme88k/dev/clock.c +++ b/sys/arch/mvme88k/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.24 2003/10/08 19:10:04 miod Exp $ */ +/* $OpenBSD: clock.c,v 1.25 2003/10/08 22:36:11 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -87,15 +87,14 @@ #include <machine/bugio.h> #include <machine/cpu.h> #include <machine/cmmu.h> /* DMA_CACHE_SYNC, etc... */ + #include "pcctwo.h" #if NPCCTWO > 0 #include <mvme88k/dev/pcctwofunc.h> #include <mvme88k/dev/pcctworeg.h> -#include "bugtty.h" -#if NBUGTTY > 0 -#include <mvme88k/dev/bugttyfunc.h> -#endif +extern struct vme2reg *sys_vme2; #endif + #include "syscon.h" #if NSYSCON > 0 #include <mvme88k/dev/sysconfunc.h> @@ -103,7 +102,10 @@ #endif #include <mvme88k/dev/vme.h> -extern struct vme2reg *sys_vme2; +#include "bugtty.h" +#if NBUGTTY > 0 +#include <mvme88k/dev/bugttyfunc.h> +#endif int clockmatch(struct device *, void *, void *); void clockattach(struct device *, struct device *, void *); @@ -129,7 +131,6 @@ struct cfdriver clock_cd = { int sbc_clockintr(void *); int m188_clockintr(void *); -int clockbus; u_char prof_reset; /* @@ -153,9 +154,9 @@ clockmatch(parent, vcf, args) * We return the ipl here so that the parent can print * a message if it is different from what ioconf.c says. */ - ca->ca_ipl = IPL_CLOCK; + ca->ca_ipl = IPL_CLOCK; /* set size to 0 - see pcctwo.c:match for details */ - ca->ca_len = 0; + ca->ca_len = 0; return (1); } @@ -167,9 +168,7 @@ clockattach(parent, self, args) struct confargs *ca = args; struct clocksoftc *sc = (struct clocksoftc *)self; - clockbus = ca->ca_bustype; - - switch (clockbus) { + switch (ca->ca_bustype) { #if NPCCTWO > 0 case BUS_PCCTWO: sc->sc_profih.ih_fn = sbc_clockintr; @@ -179,7 +178,6 @@ clockattach(parent, self, args) prof_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR; pcctwointr_establish(PCC2V_TIMER1, &sc->sc_profih); md.clock_init_func = sbc_initclock; - printf(": VME1x7"); break; #endif /* NPCCTWO */ #if NSYSCON > 0 @@ -190,7 +188,6 @@ clockattach(parent, self, args) sc->sc_profih.ih_ipl = ca->ca_ipl; sysconintr_establish(SYSCV_TIMER1, &sc->sc_profih); md.clock_init_func = m188_initclock; - printf(": VME188"); break; #endif /* NSYSCON */ } @@ -214,8 +211,7 @@ sbc_initclock(void) sys_pcc2->pcc2_t1ctl = 0; sys_pcc2->pcc2_t1cmp = pcc2_timer_us2lim(tick); sys_pcc2->pcc2_t1count = 0; - sys_pcc2->pcc2_t1ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC | - PCC2_TCTL_COVF; + sys_pcc2->pcc2_t1ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC | PCC2_TCTL_COVF; sys_pcc2->pcc2_t1irq = prof_reset; } @@ -245,23 +241,26 @@ delay(us) { volatile int c; +#if NPCCTWO > 0 /* * We use the vme system controller for the delay clock. * Do not go to the real timer until vme device is present. * Or, in the case of MVME188, not at all. */ - if (sys_vme2 == NULL || brdtyp == BRD_188) { - c = 3 * us; /* XXX not accurate! */ - while (--c > 0); + if (sys_vme2 != NULL) { + sys_vme2->vme2_t1cmp = 0xffffffff; + sys_vme2->vme2_t1count = 0; + sys_vme2->vme2_tctl |= VME2_TCTL1_CEN; + + while (sys_vme2->vme2_t1count < us) + ; + sys_vme2->vme2_tctl &= ~VME2_TCTL1_CEN; return; } - sys_vme2->vme2_irql1 |= (0 << VME2_IRQL1_TIC1SHIFT); - sys_vme2->vme2_t1count = 0; - sys_vme2->vme2_tctl |= (VME2_TCTL1_CEN | VME2_TCTL1_COVF); - - while (sys_vme2->vme2_t1count < us) +#endif + c = 3 * us; /* XXX not accurate! */ + while (--c > 0) ; - sys_vme2->vme2_tctl &= ~(VME2_TCTL1_CEN | VME2_TCTL1_COVF); } #if NSYSCON > 0 @@ -274,11 +273,7 @@ m188_clockintr(eframe) volatile int tmp; /* acknowledge the timer interrupt */ -#if 0 - dma_cachectl(DART_BASE, PAGE_SIZE, DMA_CACHE_SYNC_INVAL); -#else tmp = *(int *volatile)DART_ISR; -#endif /* stop the timer while the interrupt is being serviced */ tmp = *(int *volatile)DART_STOPC; diff --git a/sys/arch/mvme88k/dev/sclock.c b/sys/arch/mvme88k/dev/sclock.c index 6814ffaa40e..e389a17da59 100644 --- a/sys/arch/mvme88k/dev/sclock.c +++ b/sys/arch/mvme88k/dev/sclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sclock.c,v 1.15 2003/10/05 20:25:08 miod Exp $ */ +/* $OpenBSD: sclock.c,v 1.16 2003/10/08 22:36:11 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * @@ -81,19 +81,19 @@ #include <machine/psl.h> #include <machine/autoconf.h> #include <machine/cpu.h> + #include "pcctwo.h" #if NPCCTWO > 0 #include <mvme88k/dev/pcctwofunc.h> #include <mvme88k/dev/pcctworeg.h> #endif + #include "syscon.h" #if NSYSCON > 0 #include <mvme88k/dev/sysconfunc.h> #include <mvme88k/dev/sysconreg.h> #endif -#include <mvme88k/dev/vme.h> -extern struct vme2reg *sys_vme2; struct simplelock cio_lock; /* * Statistics clock interval and variance, in usec. Variance must be a @@ -131,7 +131,6 @@ struct cfdriver sclock_cd = { int sbc_statintr(void *); int m188_statintr(void *); -int sclockbus; u_char stat_reset; /* @@ -155,9 +154,9 @@ sclockmatch(parent, vcf, args) * We return the ipl here so that the parent can print * a message if it is different from what ioconf.c says. */ - ca->ca_ipl = IPL_CLOCK; + ca->ca_ipl = IPL_CLOCK; /* set size to 0 - see pcctwo.c:match for details */ - ca->ca_len = 0; + ca->ca_len = 0; return (1); } @@ -169,9 +168,7 @@ sclockattach(parent, self, args) struct confargs *ca = args; struct sclocksoftc *sc = (struct sclocksoftc *)self; - sclockbus = ca->ca_bustype; - - switch (sclockbus) { + switch (ca->ca_bustype) { #if NPCCTWO > 0 case BUS_PCCTWO: sc->sc_statih.ih_fn = sbc_statintr; @@ -181,7 +178,6 @@ sclockattach(parent, self, args) stat_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR; pcctwointr_establish(PCC2V_TIMER2, &sc->sc_statih); md.statclock_init_func = sbc_initstatclock; - printf(": VME1x7"); break; #endif /* NPCCTWO */ #if NSYSCON > 0 @@ -192,7 +188,6 @@ sclockattach(parent, self, args) sc->sc_statih.ih_ipl = ca->ca_ipl; sysconintr_establish(SYSCV_TIMER2, &sc->sc_statih); md.statclock_init_func = m188_initstatclock; - printf(": VME188"); break; #endif /* NSYSCON */ } diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c index 0c206d0c8de..79deee14eee 100644 --- a/sys/arch/mvme88k/dev/vme.c +++ b/sys/arch/mvme88k/dev/vme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vme.c,v 1.22 2003/10/05 20:27:48 miod Exp $ */ +/* $OpenBSD: vme.c,v 1.23 2003/10/08 22:36:11 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -68,7 +68,7 @@ void vmesyscon_init(struct vmesoftc *); int vmebustype; int vmevecbase; -struct vme2reg *sys_vme2 = NULL; +struct vme2reg *sys_vme2; struct cfattach vme_ca = { sizeof(struct vmesoftc), vmematch, vmeattach @@ -297,7 +297,6 @@ vmeattach(parent, self, args) #if NPCCTWO > 0 case BUS_PCCTWO: { - int scon; struct vme2reg *vme2; vme2 = (struct vme2reg *)sc->sc_vaddr; @@ -306,12 +305,9 @@ vmeattach(parent, self, args) panic("Correct the VME Vector Base Registers in the Bug ROM.\nSuggested values are 0x60 for VME Vec0 and 0x70 for VME Vec1."); } vmevecbase = VME2_GET_VBR1(vme2) + 0x10; - scon = (vme2->vme2_tctl & VME2_TCTL_SCON); printf(": vector base 0x%x", vmevecbase); - if (scon != 0) + if (vme2->vme2_tctl & VME2_TCTL_SCON) printf(", system controller"); - if (scon) - sys_vme2 = vme2; printf("\n"); vme2chip_init(sc); } @@ -407,6 +403,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; @@ -459,20 +457,27 @@ vme2chip_init(sc) /* * Map the Software VME irq levels to the cpu level 7. */ - vme2->vme2_irql3 = (7 << VME2_IRQL3_SW7SHIFT) | (7 << VME2_IRQL3_SW6SHIFT) | - (7 << VME2_IRQL3_SW5SHIFT) | (7 << VME2_IRQL3_SW4SHIFT) | - (7 << VME2_IRQL3_SW3SHIFT) | (7 << VME2_IRQL3_SW2SHIFT) | - (7 << VME2_IRQL3_SW1SHIFT) | (7 << VME2_IRQL3_SW0SHIFT); - /* - * pseudo driver, abort interrupt handler - */ - sc->sc_abih.ih_fn = vme2abort; - sc->sc_abih.ih_arg = 0; - sc->sc_abih.ih_wantframe = 1; - sc->sc_abih.ih_ipl = IPL_NMI; - intr_establish(110, &sc->sc_abih); - vme2->vme2_irqen |= VME2_IRQ_AB; - vme2->vme2_irqen |= VME2_IRQ_ACF; + vme2->vme2_irql3 = (7 << VME2_IRQL3_SW7SHIFT) | + (7 << VME2_IRQL3_SW6SHIFT) | (7 << VME2_IRQL3_SW5SHIFT) | + (7 << VME2_IRQL3_SW4SHIFT) | (7 << VME2_IRQL3_SW3SHIFT) | + (7 << VME2_IRQL3_SW2SHIFT) | (7 << VME2_IRQL3_SW1SHIFT) | + (7 << VME2_IRQL3_SW0SHIFT); + + /* + * pseudo driver, abort interrupt handler + */ + sc->sc_abih.ih_fn = vme2abort; + sc->sc_abih.ih_arg = 0; + sc->sc_abih.ih_wantframe = 1; + sc->sc_abih.ih_ipl = IPL_NMI; + intr_establish(110, &sc->sc_abih); + vme2->vme2_irqen |= VME2_IRQ_AB; + + /* + * 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; } #endif /* NPCCTWO */ |