diff options
author | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
---|---|---|
committer | Hugh Graham <hugh@cvs.openbsd.org> | 2001-08-25 13:33:38 +0000 |
commit | 2f9f539a801e8c00430eacc3a70495465ca02e4e (patch) | |
tree | a8c95a4e7bd59da4baa2c4974425216c11ff94b4 | |
parent | 1195029145310bb1c26d5da6e89f13372126bc9b (diff) |
Bring in some useful stuff from NetBSD. Mostly work by Matt Thomas,
and concerned with intvec counting. Also some ANSIfication.
38 files changed, 702 insertions, 578 deletions
diff --git a/sys/arch/vax/boot/boot/autoconf.c b/sys/arch/vax/boot/boot/autoconf.c index 44dc0e0ba06..85cc3b0c0e6 100644 --- a/sys/arch/vax/boot/boot/autoconf.c +++ b/sys/arch/vax/boot/boot/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.4 2001/01/28 01:21:32 hugh Exp $ */ +/* $OpenBSD: autoconf.c,v 1.5 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: autoconf.c,v 1.5 1999/08/23 19:09:27 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. @@ -37,8 +37,7 @@ #include "sys/param.h" #include "../../include/mtpr.h" #include "../../include/sid.h" -#include "../../include/trap.h" -#include "../../include/frame.h" +#include "../../include/scb.h" #include "vaxstand.h" extern const struct ivec_dsp idsptch; /* since we are not KERNEL */ @@ -191,10 +190,10 @@ scbinit() int i; /* - * Allocate space. We need one page for the SCB, and 128*16 == 2k + * Allocate space. We need one page for the SCB, and 128*20 == 2.5k * for the vectors. The SCB must be on a page boundary. */ - i = alloc(VAX_NBPG * 6) + VAX_PGOFSET; + i = (int)alloc(VAX_NBPG + 128*sizeof(scb_vec[0])) + VAX_PGOFSET; i &= ~VAX_PGOFSET; mtpr(i, PR_SCBB); @@ -203,9 +202,11 @@ scbinit() for (i = 0; i < 128; i++) { scb[i] = &scb_vec[i]; - (int)scb[i] |= 1; /* Only interrupt stack */ - memcpy(&scb_vec[i], &idsptch, sizeof(struct ivec_dsp)); + (int)scb[i] |= SCB_ISTACK; /* Only interrupt stack */ + scb_vec[i] = idsptch; scb_vec[i].hoppaddr = scb_stray; + scb_vec[i].pushlarg = (void *) (i * 4); + scb_vec[i].ev = NULL; } scb_vec[0xc0/4].hoppaddr = rtimer; @@ -238,19 +239,23 @@ rtimer() } asm(" + .align 2 .globl _idsptch, _eidsptch _idsptch: - pushr $0x3f - pushl $1 - .long 0x9f01fb01 - .long 0x12345678 -# -# gas do not accept this :-/ use hexcode instead -# nop -# calls $1, *$0x12345678 - popr $0x3f - rei + pushr $0x3f + .word 0x9f16 + .long _cmn_idsptch + .long 0 + .long 0 + .long 0 _eidsptch: + +_cmn_idsptch: + movl (sp)+,r0 + pushl 4(r0) + calls $1,*(r0) + popr $0x3f + rei "); /* @@ -261,14 +266,10 @@ void scb_stray(arg) int arg; { - static struct callsframe *cf; - static int vector, ipl, *a; + static int vector, ipl; - cf = FRAMEOFFSET(arg); - a = &cf->ca_arg1; ipl = mfpr(PR_IPL); - vector = ((cf->ca_pc - (u_int)scb_vec)/4) & ~3; - printf("stray interrupt: pc %x vector 0x%x, ipl %d\n", - cf->ca_pc, vector, ipl); + vector = (int) arg; + printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl); } diff --git a/sys/arch/vax/if/if_le.c b/sys/arch/vax/if/if_le.c index f370c74eb64..f37a00d2f6e 100644 --- a/sys/arch/vax/if/if_le.c +++ b/sys/arch/vax/if/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.5 2000/04/27 03:14:43 bjc Exp $ */ +/* $OpenBSD: if_le.c,v 1.6 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: if_le.c,v 1.14 1999/08/14 18:40:23 ragge Exp $ */ /*- @@ -108,6 +108,7 @@ struct le_softc { struct am7990_softc sc_am7990; /* Must be first */ + struct evcnt sc_intrcnt; volatile u_short *sc_rap; volatile u_short *sc_rdp; }; @@ -184,7 +185,9 @@ le_ibus_attach(parent, self, aux) i = scb_vecref(&vec, &br); if (i == 0 || vec == 0) return; - scb_vecalloc(vec, (void *)am7990_intr, sc, SCB_ISTACK); + scb_vecalloc(vec, (void *)am7990_intr, sc, + SCB_ISTACK, &sc->sc_intrcnt); + evcnt_attach(self, "intr", &sc->sc_intrcnt); printf(": vec %o ipl %x\n%s", vec, br, self->dv_xname); /* diff --git a/sys/arch/vax/if/if_ze.c b/sys/arch/vax/if/if_ze.c index 9421b1d786f..6853271ccdd 100644 --- a/sys/arch/vax/if/if_ze.c +++ b/sys/arch/vax/if/if_ze.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ze.c,v 1.2 2001/05/20 14:19:43 hugh Exp $ */ +/* $OpenBSD: if_ze.c,v 1.3 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: if_ze.c,v 1.3 2000/01/24 02:54:03 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. @@ -127,7 +127,8 @@ zeattach(parent, self, aux) vax_unmap_physmem((vaddr_t)ea, 1); - scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc, SCB_ISTACK); + scb_vecalloc(SGECVEC, (void (*)(void *)) sgec_intr, sc, + SCB_ISTACK, &sc->sc_intrcnt); sgec_attach(sc); } diff --git a/sys/arch/vax/if/sgec.c b/sys/arch/vax/if/sgec.c index 0352be31789..7259a99acd5 100644 --- a/sys/arch/vax/if/sgec.c +++ b/sys/arch/vax/if/sgec.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sgec.c,v 1.2 2001/02/20 19:39:35 mickey Exp $ */ -/* $NetBSD: sgec.c,v 1.1 1999/08/08 11:41:29 ragge Exp $ */ +/* $OpenBSD: sgec.c,v 1.3 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: sgec.c,v 1.5 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -173,6 +173,10 @@ sgec_attach(sc) } } + /* For vmstat -i + */ + evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); + /* * Create ring loops of the buffer chains. * This is only done once. @@ -306,6 +310,7 @@ zestart(ifp) paddr_t buffer; struct mbuf *m, *m0; int idx, len, s, i, totlen, error; + int old_inq = sc->sc_inq; short orword; s = splimp(); @@ -388,7 +393,7 @@ zestart(ifp) if (sc->sc_inq == (TXDESCS - 1)) ifp->if_flags |= IFF_OACTIVE; -out: if (sc->sc_inq) +out: if (old_inq < sc->sc_inq) ifp->if_timer = 5; /* If transmit logic dies */ splx(s); } @@ -412,6 +417,7 @@ sgec_intr(sc) while ((zc->zc_recv[sc->sc_nextrx].ze_framelen & ZE_FRAMELEN_OW) == 0) { + ifp->if_ipackets++; m = sc->sc_rxmbuf[sc->sc_nextrx]; len = zc->zc_recv[sc->sc_nextrx].ze_framelen; ze_add_rxbuf(sc, sc->sc_nextrx); @@ -424,9 +430,9 @@ sgec_intr(sc) if (ifp->if_bpf) { bpf_mtap(ifp->if_bpf, m); if ((ifp->if_flags & IFF_PROMISC) != 0 && + ((eh->ether_dhost[0] & 1) == 0) && bcmp(sc->sc_ac.ac_enaddr, eh->ether_dhost, - ETHER_ADDR_LEN) != 0 && - ((eh->ether_dhost[0] & 1) == 0)) { + ETHER_ADDR_LEN) != 0) { m_freem(m); continue; } @@ -458,17 +464,20 @@ sgec_intr(sc) if (++sc->sc_lastack == TXDESCS) sc->sc_lastack = 0; - /* XXX collect statistics */ if ((zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_DT) == ZE_TDES1_DT_SETUP) continue; + /* XXX collect statistics */ + if (zc->zc_xmit[idx].ze_tdes1 & ZE_TDES1_LS) + ifp->if_opackets++; bus_dmamap_unload(sc->sc_dmat, sc->sc_xmtmap[idx]); if (sc->sc_txmbuf[idx]) { m_freem(sc->sc_txmbuf[idx]); sc->sc_txmbuf[idx] = 0; } } - ifp->if_timer = 0; + if (sc->sc_inq == 0) + ifp->if_timer = 0; ifp->if_flags &= ~IFF_OACTIVE; zestart(ifp); /* Put in more in queue */ } @@ -480,7 +489,7 @@ sgec_intr(sc) */ int zeioctl(ifp, cmd, data) - register struct ifnet *ifp; + struct ifnet *ifp; u_long cmd; caddr_t data; { diff --git a/sys/arch/vax/if/sgecvar.h b/sys/arch/vax/if/sgecvar.h index 7cf93770817..fdee7fa4a43 100644 --- a/sys/arch/vax/if/sgecvar.h +++ b/sys/arch/vax/if/sgecvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: sgecvar.h,v 1.1 2000/04/27 03:14:44 bjc Exp $ */ -/* $NetBSD: sgecvar.h,v 1.1 1999/08/08 11:41:30 ragge Exp $ */ +/* $OpenBSD: sgecvar.h,v 1.2 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: sgecvar.h,v 1.2 2000/06/04 02:14:14 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -44,6 +44,7 @@ struct ze_cdata { struct ze_softc { struct device sc_dev; /* Configuration common part */ + struct evcnt sc_intrcnt; /* Interrupt counters */ struct arpcom sc_ac; /* Ethernet common part */ #define sc_if sc_ac.ac_if /* network-visible interface */ bus_space_tag_t sc_iot; diff --git a/sys/arch/vax/include/frame.h b/sys/arch/vax/include/frame.h index fd092b47dbc..f83892f8195 100644 --- a/sys/arch/vax/include/frame.h +++ b/sys/arch/vax/include/frame.h @@ -1,5 +1,5 @@ -/* $OpenBSD: frame.h,v 1.2 1997/05/29 00:04:39 niklas Exp $ */ -/* $NetBSD: frame.h,v 1.1 1995/11/12 15:07:30 ragge Exp $ */ +/* $OpenBSD: frame.h,v 1.3 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: frame.h,v 1.2 2000/06/04 19:30:15 matt Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -31,6 +31,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _VAX_FRAME_H_ +#define _VAX_FRAME_H_ + /* * Description of calls frame on stack. This is the * standard way of making procedure calls on vax systems. @@ -46,6 +49,16 @@ struct callsframe { /* This can be followed by more arguments */ }; -/* Offset to beginning of calls frame from first arg */ -#define FRAMEOFFSET(arg1) ((struct callsframe *)((unsigned int)&(arg1) - 24)) +struct icallsframe { + struct callsframe ica_frame; /* std call frame */ + unsigned int ica_r0; /* interrupt saved r0 */ + unsigned int ica_r1; /* interrupt saved r1 */ + unsigned int ica_r2; /* interrupt saved r2 */ + unsigned int ica_r3; /* interrupt saved r3 */ + unsigned int ica_r4; /* interrupt saved r4 */ + unsigned int ica_r5; /* interrupt saved r5 */ + unsigned int ica_pc; /* interrupt saved pc */ + unsigned int ica_psl; /* interrupt saved psl */ +}; +#endif /* _VAX_FRAME_H */ diff --git a/sys/arch/vax/include/ioa.h b/sys/arch/vax/include/ioa.h index e818d109080..5518d18a36f 100644 --- a/sys/arch/vax/include/ioa.h +++ b/sys/arch/vax/include/ioa.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ioa.h,v 1.6 2001/08/12 12:03:03 heko Exp $ */ -/* $NetBSD: ioa.h,v 1.5 1999/04/12 20:57:52 pk Exp $ */ +/* $OpenBSD: ioa.h,v 1.7 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: ioa.h,v 1.6 2000/01/24 02:40:32 matt Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. * All rights reserved. diff --git a/sys/arch/vax/include/nexus.h b/sys/arch/vax/include/nexus.h index 7c50f1e1fec..9a377317deb 100644 --- a/sys/arch/vax/include/nexus.h +++ b/sys/arch/vax/include/nexus.h @@ -1,5 +1,5 @@ -/* $OpenBSD: nexus.h,v 1.8 2000/04/26 03:08:42 bjc Exp $ */ -/* $NetBSD: nexus.h,v 1.15 1999/08/07 10:36:46 ragge Exp $ */ +/* $OpenBSD: nexus.h,v 1.9 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: nexus.h,v 1.17 2000/06/04 17:58:19 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -38,6 +38,9 @@ #ifndef _VAX_NEXUS_H_ #define _VAX_NEXUS_H_ + +#include <machine/bus.h> + /* * Different definitions for nicer autoconf probing. */ @@ -97,10 +100,10 @@ struct nexus { }; struct sbi_attach_args { - u_int nexnum; /* This nexus TR number */ - u_int type; /* This nexus type */ - int nexinfo; /* Some info sent between attach & match */ - void *nexaddr; /* Virtual address of this nexus */ + int sa_nexnum; /* This nexus TR number */ + int sa_type; /* This nexus type */ + bus_space_tag_t sa_iot; + bus_space_handle_t sa_ioh; }; /* Memory device struct. This should be somewhere else */ @@ -118,9 +121,6 @@ struct bp_conf { int bp_addr; }; -extern caddr_t *nex_vec; -#define nex_vec_num(ipl, nexnum) nex_vec[(ipl-14)*16+nexnum] - #endif /* @@ -136,7 +136,7 @@ extern caddr_t *nex_vec; #define NEX_CFGFLT (0xfc000000) #ifndef _LOCORE -#if defined(VAX780) || defined(VAX8600) +#if VAX780 || VAX8600 #define NEXFLT_BITS \ "\20\40PARFLT\37WSQFLT\36URDFLT\35ISQFLT\34MXTFLT\33XMTFLT" #endif @@ -182,9 +182,10 @@ extern caddr_t *nex_vec; #define NEX_MEM256I 0x74 /* 256K chips, interleaved */ /* Memory classes */ -#define M780C 0 -#define M780EL 1 -#define M780EU 2 +#define M_NONE 0 +#define M780C 1 +#define M780EL 2 +#define M780EU 3 /* Memory recover defines */ #define MCHK_PANIC -1 diff --git a/sys/arch/vax/include/scb.h b/sys/arch/vax/include/scb.h index 745c2a372aa..c870085725f 100644 --- a/sys/arch/vax/include/scb.h +++ b/sys/arch/vax/include/scb.h @@ -1,5 +1,5 @@ -/* $OpenBSD: scb.h,v 1.5 2000/04/26 03:08:42 bjc Exp $ */ -/* $NetBSD: scb.h,v 1.6 2000/01/24 02:40:32 matt Exp $ */ +/* $OpenBSD: scb.h,v 1.6 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: scb.h,v 1.11 2000/07/10 09:14:34 ragge Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -108,13 +108,34 @@ struct scb { #define SCB_KSTACK 0 #define SCB_ISTACK 1 +#define vecnum(bus, ipl, tr) (256+(ipl-0x14)*64+tr*4+bus*256) + +/* + * This struct is used when setting up interrupt vectors dynamically. + * It put a opaque 32 bit quanity on the stack and also has a placeholder + * for evcnt structure. + */ +struct ivec_dsp { + char pushr; /* pushr */ + char pushrarg; /* $0x3f */ + char jsb; + char mode; + long displacement; + void (*hoppaddr)(void *); + void *pushlarg; + struct evcnt *ev; +}; + #ifdef _KERNEL +extern const struct ivec_dsp idsptch; extern struct scb *scb; +extern struct ivec_dsp *scb_vec; +extern struct evcnt devipl_intrcnts[4]; /* IPL 2[0123] */ -extern paddr_t scb_init __P((paddr_t)); -extern int scb_vecref __P((int *, int *)); -extern void scb_fake __P((int, int)); -extern void scb_vecalloc __P((int, void(*)(void *), void *, int)); +extern paddr_t scb_init (paddr_t); +extern int scb_vecref (int *, int *); +extern void scb_fake (int, int); +extern void scb_vecalloc (int, void(*)(void *), void *, int, struct evcnt *); #endif /* _KERNEL */ #endif /* _VAX_SCB_H */ diff --git a/sys/arch/vax/include/trap.h b/sys/arch/vax/include/trap.h index 5b19bbb71e3..499c7e6d80d 100644 --- a/sys/arch/vax/include/trap.h +++ b/sys/arch/vax/include/trap.h @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.h,v 1.10 2000/04/26 03:08:43 bjc Exp $ */ -/* $NetBSD: trap.h,v 1.17 2000/01/24 02:40:32 matt Exp $ */ +/* $OpenBSD: trap.h,v 1.11 2001/08/25 13:33:36 hugh Exp $ */ +/* $NetBSD: trap.h,v 1.18 2000/06/04 02:19:26 matt Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -92,26 +92,6 @@ struct trapframe { long psl; /* User psl */ }; -/* - * This struct is used when setting up interrupt vectors dynamically. - * It pushes a longword between 0-63 on the stack; this number is - * normally used as the ctlr number on devices. This use effectively - * limits the number of interruptable ctlrs on one unibus to 64. - */ -struct ivec_dsp { - char pushr; /* pushr */ - char pushrarg; /* $0x3f */ - char jsb; - char mode; - long displacement; - void (*hoppaddr) __P((void *)); - void *pushlarg; -}; - -#ifdef _KERNEL -extern const struct ivec_dsp idsptch; -#endif - #endif /* _LOCORE */ #endif /* _VAX_TRAP_H_ */ diff --git a/sys/arch/vax/include/vsbus.h b/sys/arch/vax/include/vsbus.h index 1c0eb6af228..2b99b7d7758 100644 --- a/sys/arch/vax/include/vsbus.h +++ b/sys/arch/vax/include/vsbus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbus.h,v 1.5 2000/10/09 23:11:57 bjc Exp $ */ +/* $OpenBSD: vsbus.h,v 1.6 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: vsbus.h,v 1.13 2000/06/25 16:00:46 ragge Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. @@ -44,29 +44,6 @@ #include <machine/bus.h> #include <machine/sgmap.h> -struct vsbus_softc { - struct device sc_dev; -#if 0 - volatile struct vs_cpu *sc_cpu; -#endif - u_char *sc_intmsk; /* Mask register */ - u_char *sc_intclr; /* Clear interrupt register */ - u_char *sc_intreq; /* Interrupt request register */ - u_char sc_mask; /* Interrupts to enable after autoconf */ - vaddr_t sc_vsregs; /* Where the VS_REGS are mapped */ - vaddr_t sc_dmaaddr; /* Mass storage virtual DMA area */ - vsize_t sc_dmasize; /* Size of the DMA area */ - - struct vax_bus_dma_tag sc_dmatag; - struct vax_sgmap sc_sgmap; -}; - -struct vsbus_dma { - SIMPLEQ_ENTRY(vsbus_dma) vd_q; - void (*vd_go)(void *); - void *vd_arg; -}; - struct confargs { char ca_name[16]; /* device name */ int ca_intslot; /* device interrupt-slot */ @@ -143,14 +120,33 @@ struct vsbus_attach_args { #define SMADDR 0x30000000 #define SMSIZE 0x20000 /* Actually 256k, only 128k used */ +struct vsbus_softc { + struct device sc_dev; + u_char *sc_intmsk; /* Mask register */ + u_char *sc_intclr; /* Clear interrupt register */ + u_char *sc_intreq; /* Interrupt request register */ + u_char sc_mask; /* Interrupts to enable after autoconf */ + vaddr_t sc_vsregs; /* Where the VS_REGS are mapped */ + vaddr_t sc_dmaaddr; /* Mass storage virtual DMA area */ + vsize_t sc_dmasize; /* Size of the DMA area */ + + struct vax_bus_dma_tag sc_dmatag; + struct vax_sgmap sc_sgmap; +}; + +struct vsbus_dma { + SIMPLEQ_ENTRY(vsbus_dma) vd_q; + void (*vd_go)(void *); + void *vd_arg; +}; + #ifdef _KERNEL -void vsbus_dma_init __P((struct vsbus_softc *, unsigned ptecnt)); -u_char vsbus_setmask __P((unsigned char)); -void vsbus_clrintr __P((unsigned char)); -void vsbus_intr __P((void *)); -void vsbus_copytoproc __P((struct proc *, caddr_t, caddr_t, int)); -void vsbus_copyfromproc __P((struct proc *, caddr_t, caddr_t, int)); -void vsbus_dma_start __P((struct vsbus_dma *)); -void vsbus_dma_intr __P((void)); +void vsbus_dma_init(struct vsbus_softc *, unsigned ptecnt); +u_char vsbus_setmask(int); +void vsbus_clrintr(int); +void vsbus_copytoproc(struct proc *, caddr_t, caddr_t, int); +void vsbus_copyfromproc(struct proc *, caddr_t, caddr_t, int); +void vsbus_dma_start(struct vsbus_dma *); +void vsbus_dma_intr(void); #endif #endif /* _VAX_VSBUS_H_ */ diff --git a/sys/arch/vax/qbus/dz.c b/sys/arch/vax/qbus/dz.c index 1beb48682de..5367934003b 100644 --- a/sys/arch/vax/qbus/dz.c +++ b/sys/arch/vax/qbus/dz.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dz.c,v 1.5 2001/08/19 23:54:27 miod Exp $ */ -/* $NetBSD: dz.c,v 1.19 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dz.c,v 1.6 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dz.c,v 1.23 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1992, 1993 @@ -110,10 +110,10 @@ static struct speedtab dzspeedtab[] = { -1, -1 } }; -static void dzstart __P((struct tty *)); -static int dzparam __P((struct tty *, struct termios *)); -static unsigned dzmctl __P((struct dz_softc *, int, int, int)); -static void dzscan __P((void *)); +static void dzstart(struct tty *); +static int dzparam(struct tty *, struct termios *); +static unsigned dzmctl(struct dz_softc *, int, int, int); +static void dzscan(void *); struct cfdriver dz_cd = { NULL, "dz", DV_TTY @@ -133,10 +133,9 @@ struct timeout dz_timeout; #define DZ_DZV 4 /* Q-bus DZV-11 or DZQ-11 */ void -dzattach(sc) - struct dz_softc *sc; +dzattach(struct dz_softc *sc) { - register int n; + int n; sc->sc_rxint = sc->sc_brk = 0; @@ -150,6 +149,9 @@ dzattach(sc) for (n = 0; n < sc->sc_type; n++) sc->sc_dz[n].dz_tty = ttymalloc(); + evcnt_attach(&sc->sc_dev, "rintr", &sc->sc_rintrcnt); + evcnt_attach(&sc->sc_dev, "tintr", &sc->sc_tintrcnt); + /* Alas no interrupt on modem bit changes, so we manually scan */ if (dz_timer == 0) { @@ -164,13 +166,12 @@ dzattach(sc) /* Receiver Interrupt */ void -dzrint(arg) - void *arg; +dzrint(void *arg) { struct dz_softc *sc = arg; - register struct tty *tp; - register int cc, line; - register unsigned c; + struct tty *tp; + int cc, line; + unsigned c; int overrun = 0; sc->sc_rxint++; @@ -220,13 +221,12 @@ dzrint(arg) /* Transmitter Interrupt */ void -dzxint(arg) - void *arg; +dzxint(void *arg) { - register struct dz_softc *sc = arg; - register struct tty *tp; - register struct clist *cl; - register int line, ch, csr; + struct dz_softc *sc = arg; + struct tty *tp; + struct clist *cl; + int line, ch, csr; u_char tcr; /* @@ -270,9 +270,6 @@ dzxint(arg) tcr &= ~(1 << line); DZ_WRITE_BYTE(dr_tcr, tcr); - if (sc->sc_dz[line].dz_catch) - continue; - if (tp->t_state & TS_FLUSH) tp->t_state &= ~TS_FLUSH; else @@ -286,13 +283,10 @@ dzxint(arg) } int -dzopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dzopen(dev_t dev, int flag, int mode, struct proc *p) { - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; struct dz_softc *sc; int s, error = 0; @@ -344,14 +338,11 @@ dzopen(dev, flag, mode, p) /*ARGSUSED*/ int -dzclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dzclose(dev_t dev, int flag, int mode, struct proc *p) { struct dz_softc *sc; - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; unit = DZ_I2C(minor(dev)); @@ -373,11 +364,9 @@ dzclose(dev, flag, mode, p) } int -dzread (dev, uio, flag) - dev_t dev; - struct uio *uio; +dzread(dev_t dev, struct uio *uio, int flag) { - register struct tty *tp; + struct tty *tp; struct dz_softc *sc; sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; @@ -387,11 +376,9 @@ dzread (dev, uio, flag) } int -dzwrite (dev, uio, flag) - dev_t dev; - struct uio *uio; +dzwrite(dev_t dev, struct uio *uio, int flag) { - register struct tty *tp; + struct tty *tp; struct dz_softc *sc; sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; @@ -402,16 +389,11 @@ dzwrite (dev, uio, flag) /*ARGSUSED*/ int -dzioctl (dev, cmd, data, flag, p) - dev_t dev; - u_long cmd; - caddr_t data; - int flag; - struct proc *p; +dzioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { struct dz_softc *sc; - register struct tty *tp; - register int unit, line; + struct tty *tp; + int unit, line; int error; unit = DZ_I2C(minor(dev)); @@ -467,8 +449,7 @@ dzioctl (dev, cmd, data, flag, p) } struct tty * -dztty (dev) - dev_t dev; +dztty(dev_t dev) { struct dz_softc *sc = dz_cd.cd_devs[DZ_I2C(minor(dev))]; struct tty *tp = sc->sc_dz[DZ_PORT(minor(dev))].dz_tty; @@ -478,27 +459,20 @@ dztty (dev) /*ARGSUSED*/ int -dzstop(tp, flag) - register struct tty *tp; +dzstop(struct tty *tp, int flag) { - int s; - - s = spltty(); if (tp->t_state & TS_BUSY) if (!(tp->t_state & TS_TTSTOP)) tp->t_state |= TS_FLUSH; - splx(s); - - return 0; + return(0); } void -dzstart(tp) - register struct tty *tp; +dzstart(struct tty *tp) { - register struct dz_softc *sc; - register struct clist *cl; - register int unit, line, s; + struct dz_softc *sc; + struct clist *cl; + int unit, line, s; char state; unit = DZ_I2C(minor(tp->t_dev)); @@ -530,16 +504,14 @@ dzstart(tp) } static int -dzparam(tp, t) - register struct tty *tp; - register struct termios *t; +dzparam(struct tty *tp, struct termios *t) { struct dz_softc *sc; - register int cflag = t->c_cflag; + int cflag = t->c_cflag; int unit, line; int ispeed = ttspeedtab(t->c_ispeed, dzspeedtab); int ospeed = ttspeedtab(t->c_ospeed, dzspeedtab); - register unsigned lpr; + unsigned lpr; int s; unit = DZ_I2C(minor(tp->t_dev)); @@ -592,13 +564,11 @@ dzparam(tp, t) } static unsigned -dzmctl(sc, line, bits, how) - register struct dz_softc *sc; - int line, bits, how; +dzmctl(struct dz_softc *sc, int line, int bits, int how) { - register unsigned status; - register unsigned mbits; - register unsigned bit; + unsigned status; + unsigned mbits; + unsigned bit; int s; s = spltty(); @@ -671,12 +641,11 @@ dzmctl(sc, line, bits, how) * Check to see if modem status bits have changed. */ static void -dzscan(arg) - void *arg; +dzscan(void *arg) { - register struct dz_softc *sc; - register struct tty *tp; - register int n, bit, port; + struct dz_softc *sc; + struct tty *tp; + int n, bit, port; unsigned csr; int s; @@ -728,3 +697,28 @@ dzscan(arg) timeout_add(&dz_timeout, hz); return; } + +/* + * Called after an ubareset. The DZ card is reset, but the only thing + * that must be done is to start the receiver and transmitter again. + * No DMA setup to care about. + */ +void +dzreset(struct device *dev) +{ + struct dz_softc *sc = (void *)dev; + struct tty *tp; + int i; + + for (i = 0; i < sc->sc_type; i++) { + tp = sc->sc_dz[i].dz_tty; + + if (((tp->t_state & TS_ISOPEN) == 0)) + continue; + + dzparam(tp, &tp->t_termios); + dzmctl(sc, i, DML_DTR, DMSET); + tp->t_state &= ~TS_BUSY; + dzstart(tp); /* Kick off transmitter again */ + } +} diff --git a/sys/arch/vax/qbus/dz_uba.c b/sys/arch/vax/qbus/dz_uba.c index d9595840a52..910e6fe9285 100644 --- a/sys/arch/vax/qbus/dz_uba.c +++ b/sys/arch/vax/qbus/dz_uba.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dz_uba.c,v 1.1 2000/04/27 03:14:47 bjc Exp $ */ -/* $NetBSD: dz_uba.c,v 1.8 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dz_uba.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dz_uba.c,v 1.11 2000/06/04 06:17:02 matt Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved. * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. @@ -74,7 +74,7 @@ dz_uba_match(parent, cf, aux) struct uba_attach_args *ua = aux; bus_space_tag_t iot = ua->ua_iot; bus_space_handle_t ioh = ua->ua_ioh; - register int n; + int n; iot = iot; /* Silly GCC */ /* Reset controller to initialize, enable TX interrupts */ @@ -113,7 +113,7 @@ dz_uba_attach(parent, self, aux) void *aux; { struct dz_softc *sc = (void *)self; - register struct uba_attach_args *ua = aux; + struct uba_attach_args *ua = aux; sc->sc_iot = ua->ua_iot; sc->sc_ioh = ua->ua_ioh; @@ -130,8 +130,11 @@ dz_uba_attach(parent, self, aux) sc->sc_type = DZ_DZ; /* Now register the TX & RX interrupt handlers */ - uba_intr_establish(ua->ua_icookie, ua->ua_cvec, dzxint, sc); - uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, dzrint, sc); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec, + dzxint, sc, &sc->sc_tintrcnt); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec - 4, + dzrint, sc, &sc->sc_rintrcnt); + uba_reset_establish(dzreset, self); dzattach(sc); } diff --git a/sys/arch/vax/qbus/dzvar.h b/sys/arch/vax/qbus/dzvar.h index f429b085830..2ece7a31ff3 100644 --- a/sys/arch/vax/qbus/dzvar.h +++ b/sys/arch/vax/qbus/dzvar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: dzvar.h,v 1.2 2001/05/16 22:15:18 hugh Exp $ */ -/* $NetBSD: dzvar.h,v 1.6 2000/01/24 02:40:29 matt Exp $ */ +/* $OpenBSD: dzvar.h,v 1.3 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: dzvar.h,v 1.8 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1992, 1993 @@ -51,6 +51,8 @@ struct dz_softc { struct device sc_dev; /* Autoconf blaha */ + struct evcnt sc_rintrcnt; /* recevive interrupt counts */ + struct evcnt sc_tintrcnt; /* transmit interrupt counts */ struct dz_regs sc_dr; /* reg pointers */ bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -62,7 +64,7 @@ struct dz_softc { struct dz_softc *dz_sc; /* backpointer to softc */ int dz_line; /* sub-driver unit number */ void *dz_private; /* sub-driver data pointer */ - int (*dz_catch) __P((void *, int)); /* Fast catch recv */ + int (*dz_catch)(void *, int); /* Fast catch recv */ struct tty * dz_tty; /* what we work on */ #ifdef notyet caddr_t dz_mem; /* pointers to clist output */ @@ -71,6 +73,7 @@ struct dz_softc { } sc_dz[NDZLINE]; }; -void dzattach __P((struct dz_softc *)); -void dzrint __P((void *)); -void dzxint __P((void *)); +void dzattach(struct dz_softc *); +void dzrint(void *); +void dzxint(void *); +void dzreset(struct device *); diff --git a/sys/arch/vax/qbus/uba.c b/sys/arch/vax/qbus/uba.c index 13844d68105..cb71db90a7c 100644 --- a/sys/arch/vax/qbus/uba.c +++ b/sys/arch/vax/qbus/uba.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uba.c,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: uba.c,v 1.49 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: uba.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: uba.c,v 1.52 2000/06/04 02:14:12 matt Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. @@ -61,8 +61,8 @@ #include <arch/vax/qbus/ubavar.h> -static int ubasearch __P((struct device *, struct cfdata *, void *)); -static int ubaprint __P((void *, const char *)); +static int ubasearch (struct device *, struct cfdata *, void *); +static int ubaprint (void *, const char *); struct cfdriver uba_cd = { NULL, "uba", DV_DULL @@ -75,8 +75,7 @@ struct cfdriver uba_cd = { * Unibus systems, Qbus systems have more map registers than usable. */ void -uba_enqueue(uu) - struct uba_unit *uu; +uba_enqueue(struct uba_unit *uu) { struct uba_softc *uh; int s; @@ -95,8 +94,7 @@ uba_enqueue(uu) * This routine must be called at splimp. */ void -uba_done(uh) - struct uba_softc *uh; +uba_done(struct uba_softc *uh) { struct uba_unit *uu; @@ -110,24 +108,44 @@ uba_done(uh) } /* + * Each device that needs some handling if an ubareset occurs must + * register for reset first through this routine. + */ +void +uba_reset_establish(void (*reset)(struct device *), struct device *dev) +{ + struct uba_softc *uh = (void *)dev->dv_parent; + struct uba_reset *ur; + + ur = malloc(sizeof(struct uba_reset), M_DEVBUF, M_NOWAIT); + ur->ur_dev = dev; + ur->ur_reset = reset; + + SIMPLEQ_INSERT_TAIL(&uh->uh_resetq, ur, ur_resetq); +} + +/* * Generate a reset on uba number uban. Then * call each device that asked to be called during attach, * giving it a chance to clean up so as to be able to continue. */ void -ubareset(uban) - int uban; +ubareset(struct uba_softc *uh) { - register struct uba_softc *uh = uba_cd.cd_devs[uban]; - int s, i; + struct uba_reset *ur; + int s; s = splimp(); SIMPLEQ_INIT(&uh->uh_resq); printf("%s: reset", uh->uh_dev.dv_xname); (*uh->uh_ubainit)(uh); - for (i = 0; i < uh->uh_resno; i++) - (*uh->uh_reset[i])(uh->uh_resarg[i]); + ur = SIMPLEQ_FIRST(&uh->uh_resetq); + if (ur) do { + printf(" %s", ur->ur_dev->dv_xname); + (*ur->ur_reset)(ur->ur_dev); + } while ((ur = SIMPLEQ_NEXT(ur, ur_resetq))); + printf("\n"); splx(s); } @@ -137,9 +155,7 @@ ubareset(uban) * Calls the scan routine to search for uba devices. */ void -uba_attach(sc, iopagephys) - struct uba_softc *sc; - paddr_t iopagephys; +uba_attach(struct uba_softc *sc, paddr_t iopagephys) { /* @@ -149,6 +165,7 @@ uba_attach(sc, iopagephys) */ sc->uh_lastiv = 0x200; SIMPLEQ_INIT(&sc->uh_resq); + SIMPLEQ_INIT(&sc->uh_resetq); /* * Allocate place for unibus I/O space in virtual space. @@ -168,10 +185,7 @@ uba_attach(sc, iopagephys) } int -ubasearch(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +ubasearch(struct device *parent, struct cfdata *cf, void *aux) { struct uba_softc *sc = (struct uba_softc *)parent; struct uba_attach_args ua; @@ -180,7 +194,6 @@ ubasearch(parent, cf, aux) ua.ua_ioh = ubdevreg(cf->cf_loc[0]) + sc->uh_ioh; ua.ua_iot = sc->uh_iot; ua.ua_dmat = sc->uh_dmat; - ua.ua_reset = NULL; if (badaddr((caddr_t)ua.ua_ioh, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0)) @@ -200,24 +213,6 @@ ubasearch(parent, cf, aux) goto fail; if (vec == 0) goto fail; - - if (ua.ua_reset) { /* device wants ubareset */ - if (sc->uh_resno == 0) { -#define RESETSIXE 128 - sc->uh_reset = malloc(sizeof(void *) * RESETSIXE, - M_DEVBUF, M_NOWAIT); - sc->uh_resarg = malloc(sizeof(void *) * RESETSIXE, - M_DEVBUF, M_NOWAIT); - } - if (sc->uh_resno < RESETSIXE) { - sc->uh_resarg[sc->uh_resno] = cf->cf_unit; - sc->uh_reset[sc->uh_resno++] = ua.ua_reset; - } else { - printf("%s: Expand reset table, skipping reset %s%d\n", - sc->uh_dev.dv_xname, cf->cf_driver->cd_name, - cf->cf_unit); - } - } ua.ua_br = br; ua.ua_cvec = vec; @@ -239,9 +234,7 @@ forgetit: * Print out some interesting info common to all unibus devices. */ int -ubaprint(aux, uba) - void *aux; - const char *uba; +ubaprint(void *aux, const char *uba) { struct uba_attach_args *ua = aux; @@ -254,11 +247,12 @@ ubaprint(aux, uba) * Move to machdep eventually */ void -uba_intr_establish(icookie, vec, ifunc, iarg) +uba_intr_establish(icookie, vec, ifunc, iarg, ev) void *icookie; int vec; void (*ifunc)(void *iarg); void *iarg; + struct evcnt *ev; { - scb_vecalloc(vec, ifunc, iarg, SCB_ISTACK); + scb_vecalloc(vec, ifunc, iarg, SCB_ISTACK, ev); } diff --git a/sys/arch/vax/qbus/ubavar.h b/sys/arch/vax/qbus/ubavar.h index 942b8eb7af7..90a086a003d 100644 --- a/sys/arch/vax/qbus/ubavar.h +++ b/sys/arch/vax/qbus/ubavar.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ubavar.h,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: ubavar.h,v 1.26 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: ubavar.h,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ubavar.h,v 1.29 2000/06/04 06:17:04 matt Exp $ */ /* * Copyright (c) 1982, 1986 Regents of the University of California. @@ -70,10 +70,9 @@ */ struct uba_softc { struct device uh_dev; /* Device struct, autoconfig */ + struct evcnt uh_intrcnt; /* interrupt counting */ SIMPLEQ_HEAD(, uba_unit) uh_resq; /* resource wait chain */ - void (**uh_reset) __P((int));/* UBA reset function array */ - int *uh_resarg; /* array of ubareset args */ - int uh_resno; /* Number of devices to reset */ + SIMPLEQ_HEAD(, uba_reset) uh_resetq; /* ubareset queue */ int uh_lastiv; /* last free interrupt vector */ int (*uh_errchk) __P((struct uba_softc *)); void (*uh_beforescan) __P((struct uba_softc *)); @@ -103,6 +102,16 @@ struct uba_unit { }; /* + * Reset structure. All devices that needs to be reinitialized + * after an ubareset registers with this struct. + */ +struct uba_reset { + SIMPLEQ_ENTRY(uba_reset) ur_resetq; + void (*ur_reset)(struct device *); + struct device *ur_dev; +}; + +/* * uba_attach_args is used during autoconfiguration. It is sent * from ubascan() to each (possible) device. */ @@ -111,8 +120,6 @@ struct uba_attach_args { bus_addr_t ua_ioh; /* I/O regs addr */ bus_dma_tag_t ua_dmat; void *ua_icookie; /* Cookie for interrupt establish */ - /* UBA reset routine, filled in by probe */ - void (*ua_reset) __P((int)); int ua_iaddr; /* Full CSR address of device */ int ua_br; /* IPL this dev interrupted on */ int ua_cvec; /* Vector for this device */ @@ -135,14 +142,12 @@ struct uba_attach_args { #define ubdevreg(addr) ((addr) & 017777) #ifdef _KERNEL -#define b_forw b_hash.le_next /* Nice to have when handling uba queues */ - -void uba_intr_establish __P((void *, int, void (*)(void *), void *)); -void uba_attach __P((struct uba_softc *, unsigned long)); -void uba_enqueue __P((struct uba_unit *)); -void uba_done __P((struct uba_softc *)); -void ubareset __P((int)); - +void uba_intr_establish(void *, int, void (*)(void *), void *, struct evcnt *); +void uba_reset_establish(void (*)(struct device *), struct device *); +void uba_attach(struct uba_softc *, unsigned long); +void uba_enqueue(struct uba_unit *); +void uba_done(struct uba_softc *); +void ubareset(struct uba_softc *); #endif /* _KERNEL */ #endif /* _QBUS_UBAVAR_H */ diff --git a/sys/arch/vax/qbus/uda.c b/sys/arch/vax/qbus/uda.c index ae91879ef04..791e5c03dee 100644 --- a/sys/arch/vax/qbus/uda.c +++ b/sys/arch/vax/qbus/uda.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uda.c,v 1.1 2000/04/27 03:14:49 bjc Exp $ */ -/* $NetBSD: uda.c,v 1.32 2000/01/24 02:40:30 matt Exp $ */ +/* $OpenBSD: uda.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: uda.c,v 1.36 2000/06/04 06:17:05 matt Exp $ */ /* * Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1988 Regents of the University of California. @@ -63,6 +63,7 @@ */ struct uda_softc { struct device sc_dev; /* Autoconfig info */ + struct evcnt sc_intrcnt; /* Interrupt counting */ struct uba_unit sc_unit; /* Struct common for UBA to communicate */ struct mscp_pack *sc_uuda; /* Unibus address of uda struct */ struct mscp_pack sc_uda; /* Struct for uda communication */ @@ -79,10 +80,8 @@ struct uda_softc { static int udamatch __P((struct device *, struct cfdata *, void *)); static void udaattach __P((struct device *, struct device *, void *)); -static void udareset __P((int)); -static void mtcreset __P((int)); -static void reset __P((struct uda_softc *)); -static void intr __P((void *)); +static void udareset(struct device *); +static void udaintr __P((void *)); int udaready __P((struct uba_unit *)); void udactlrdone __P((struct device *)); int udaprint __P((void *, const char *)); @@ -177,12 +176,6 @@ again: } /* should have interrupted by now */ - if (strcmp(cf->cf_driver->cd_name, mtc_cd.cd_name)) { - ua->ua_reset = udareset; - } else { - ua->ua_reset = mtcreset; - } - return 1; bad: if (++tries < 2) @@ -206,7 +199,10 @@ udaattach(parent, self, aux) uh->uh_lastiv -= 4; /* remove dynamic interrupt vector */ - uba_intr_establish(ua->ua_icookie, ua->ua_cvec, intr, sc); + uba_intr_establish(ua->ua_icookie, ua->ua_cvec, + udaintr, sc, &sc->sc_intrcnt); + uba_reset_establish(udareset, &sc->sc_dev); + evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt); sc->sc_iot = ua->ua_iot; sc->sc_iph = ua->ua_ioh; @@ -299,7 +295,7 @@ udago(usc, mxi) */ if (sc->sc_inq == 0) { err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, - bp->b_un.b_addr, + bp->b_data, bp->b_bcount, bp->b_proc, BUS_DMA_NOWAIT); if (err == 0) { mscp_dgo(sc->sc_softc, mxi); @@ -331,7 +327,7 @@ udaready(uu) struct buf *bp = mxi->mxi_bp; int err; - err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_un.b_addr, + err = bus_dmamap_load(sc->sc_dmat, mxi->mxi_dmam, bp->b_data, bp->b_bcount, bp->b_proc, BUS_DMA_NOWAIT); if (err) return 0; @@ -396,8 +392,8 @@ udasaerror(usc, doreset) int doreset; { struct uda_softc *sc = (void *)usc; - register int code = bus_space_read_2(sc->sc_iot, sc->sc_sah, 0); - register struct saerr *e; + int code = bus_space_read_2(sc->sc_iot, sc->sc_sah, 0); + struct saerr *e; if ((code & MP_ERR) == 0) return; @@ -421,7 +417,7 @@ udasaerror(usc, doreset) * interrupts, and process responses. */ static void -intr(arg) +udaintr(arg) void *arg; { struct uda_softc *sc = arg; @@ -456,26 +452,10 @@ intr(arg) * A Unibus reset has occurred on UBA uban. Reinitialise the controller(s) * on that Unibus, and requeue outstanding I/O. */ -void -udareset(ctlr) - int ctlr; -{ - reset(uda_cd.cd_devs[ctlr]); -} - -void -mtcreset(ctlr) - int ctlr; -{ - reset(mtc_cd.cd_devs[ctlr]); -} - static void -reset(sc) - struct uda_softc *sc; +udareset(struct device *dev) { - printf(" %s", sc->sc_dev.dv_xname); - + struct uda_softc *sc = (void *)dev; /* * Our BDP (if any) is gone; our command (if any) is * flushed; the device is no longer mapped; and the diff --git a/sys/arch/vax/stand/boot/autoconf.c b/sys/arch/vax/stand/boot/autoconf.c index 44dc0e0ba06..85cc3b0c0e6 100644 --- a/sys/arch/vax/stand/boot/autoconf.c +++ b/sys/arch/vax/stand/boot/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.4 2001/01/28 01:21:32 hugh Exp $ */ +/* $OpenBSD: autoconf.c,v 1.5 2001/08/25 13:33:36 hugh Exp $ */ /* $NetBSD: autoconf.c,v 1.5 1999/08/23 19:09:27 ragge Exp $ */ /* * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. @@ -37,8 +37,7 @@ #include "sys/param.h" #include "../../include/mtpr.h" #include "../../include/sid.h" -#include "../../include/trap.h" -#include "../../include/frame.h" +#include "../../include/scb.h" #include "vaxstand.h" extern const struct ivec_dsp idsptch; /* since we are not KERNEL */ @@ -191,10 +190,10 @@ scbinit() int i; /* - * Allocate space. We need one page for the SCB, and 128*16 == 2k + * Allocate space. We need one page for the SCB, and 128*20 == 2.5k * for the vectors. The SCB must be on a page boundary. */ - i = alloc(VAX_NBPG * 6) + VAX_PGOFSET; + i = (int)alloc(VAX_NBPG + 128*sizeof(scb_vec[0])) + VAX_PGOFSET; i &= ~VAX_PGOFSET; mtpr(i, PR_SCBB); @@ -203,9 +202,11 @@ scbinit() for (i = 0; i < 128; i++) { scb[i] = &scb_vec[i]; - (int)scb[i] |= 1; /* Only interrupt stack */ - memcpy(&scb_vec[i], &idsptch, sizeof(struct ivec_dsp)); + (int)scb[i] |= SCB_ISTACK; /* Only interrupt stack */ + scb_vec[i] = idsptch; scb_vec[i].hoppaddr = scb_stray; + scb_vec[i].pushlarg = (void *) (i * 4); + scb_vec[i].ev = NULL; } scb_vec[0xc0/4].hoppaddr = rtimer; @@ -238,19 +239,23 @@ rtimer() } asm(" + .align 2 .globl _idsptch, _eidsptch _idsptch: - pushr $0x3f - pushl $1 - .long 0x9f01fb01 - .long 0x12345678 -# -# gas do not accept this :-/ use hexcode instead -# nop -# calls $1, *$0x12345678 - popr $0x3f - rei + pushr $0x3f + .word 0x9f16 + .long _cmn_idsptch + .long 0 + .long 0 + .long 0 _eidsptch: + +_cmn_idsptch: + movl (sp)+,r0 + pushl 4(r0) + calls $1,*(r0) + popr $0x3f + rei "); /* @@ -261,14 +266,10 @@ void scb_stray(arg) int arg; { - static struct callsframe *cf; - static int vector, ipl, *a; + static int vector, ipl; - cf = FRAMEOFFSET(arg); - a = &cf->ca_arg1; ipl = mfpr(PR_IPL); - vector = ((cf->ca_pc - (u_int)scb_vec)/4) & ~3; - printf("stray interrupt: pc %x vector 0x%x, ipl %d\n", - cf->ca_pc, vector, ipl); + vector = (int) arg; + printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl); } diff --git a/sys/arch/vax/uba/uba.c b/sys/arch/vax/uba/uba.c index 5d06ea578aa..54dd5a55021 100644 --- a/sys/arch/vax/uba/uba.c +++ b/sys/arch/vax/uba/uba.c @@ -1,5 +1,5 @@ -/* $OpenBSD: uba.c,v 1.9 2000/04/27 03:14:51 bjc Exp $ */ -/* $NetBSD: uba.c,v 1.42 1999/02/02 18:37:20 ragge Exp $ */ +/* $OpenBSD: uba.c,v 1.10 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: uba.c,v 1.43 2000/01/24 02:40:36 matt Exp $ */ /* * Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. @@ -201,10 +201,9 @@ void uba_dw780int(uba) int uba; { - int br, vec, arg; + int br, vec; struct uba_softc *sc = uba_cd.cd_devs[uba]; struct uba_regs *ur = sc->uh_uba; - void (*func) __P((int)); br = mfpr(PR_IPL); vec = ur->uba_brrvr[br - 0x14]; @@ -216,10 +215,9 @@ uba_dw780int(uba) if (cold) scb_fake(vec + sc->uh_ibase, br); else { - struct ivec_dsp *scb_vec = (struct ivec_dsp *)((int)scb + 512); - func = scb_vec[vec/4].hoppaddr; - arg = scb_vec[vec/4].pushlarg; - (*func)(arg); + struct ivec_dsp *scb_vec = (struct ivec_dsp *)((int)scb + 512 + vec * 4); + (*scb_vec->hoppaddr)(scb_vec->pushlarg); + } } diff --git a/sys/arch/vax/uba/ubareg.h b/sys/arch/vax/uba/ubareg.h index fc882153aff..1eddbc950a6 100644 --- a/sys/arch/vax/uba/ubareg.h +++ b/sys/arch/vax/uba/ubareg.h @@ -1,5 +1,5 @@ -/* $OpenBSD: ubareg.h,v 1.8 2000/04/27 03:14:51 bjc Exp $ */ -/* $NetBSD: ubareg.h,v 1.10 1998/10/18 18:51:30 ragge Exp $ */ +/* $OpenBSD: ubareg.h,v 1.9 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ubareg.h,v 1.11 2000/01/24 02:40:36 matt Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -67,7 +67,7 @@ #define DW730 3 /* has adaptor regs, no sr: 750, 730 */ #endif -#if VAX630 || VAX650 +#if VAX630 || VAX650 || VAX660 || VAX670 #define QBA 4 /* 22-bit Q-bus, no adaptor regs: uVAX II */ #endif diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c index 42942af7939..239473154bb 100644 --- a/sys/arch/vax/vax/clock.c +++ b/sys/arch/vax/vax/clock.c @@ -1,5 +1,5 @@ -/* $OpenBSD: clock.c,v 1.11 2001/02/11 06:34:37 hugh Exp $ */ -/* $NetBSD: clock.c,v 1.28 1999/05/01 16:13:43 ragge Exp $ */ +/* $OpenBSD: clock.c,v 1.12 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: clock.c,v 1.35 2000/06/04 06:16:58 matt Exp $ */ /* * Copyright (c) 1995 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -47,6 +47,8 @@ int yeartonum __P((int)); int numtoyear __P((int)); +struct evcnt clock_intrcnt; + /* * microtime() should return number of usecs in struct timeval. * We may get wrap-arounds, but that will be fixed with lasttime @@ -71,6 +73,17 @@ microtime(tvp) break; } #endif +#ifdef VAX48 + case VAX_BTYP_48: { + /* + * PR_ICR doesn't exist. We could use the vc_diagtimu + * counter, saving the value on the timer interrupt and + * subtracting that from the current value. + */ + i = 0; + break; + } +#endif default: i = mfpr(PR_ICR); break; @@ -162,8 +175,16 @@ delay(i) void cpu_initclocks() { + /* + * The current evcnt mechanism sucks, so provide a struct + * device for vmstat's sake, until it can be replaced. + */ + static struct device clockdev; + strcpy(clockdev.dv_xname, "clock"); + mtpr(-10000, PR_NICR); /* Load in count register */ mtpr(0x800000d1, PR_ICCS); /* Start clock and enable interrupt */ + evcnt_attach(&clockdev, "intr", &clock_intrcnt); } /* diff --git a/sys/arch/vax/vax/genassym.cf b/sys/arch/vax/vax/genassym.cf index 38c3413d4a3..888629311e0 100644 --- a/sys/arch/vax/vax/genassym.cf +++ b/sys/arch/vax/vax/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.1 2000/04/27 01:10:11 bjc Exp $ +# $OpenBSD: genassym.cf,v 1.2 2001/08/25 13:33:37 hugh Exp $ # $NetBSD: genassym.cf,v 1.10 1999/11/19 22:09:55 ragge Exp $ # # Copyright (c) 1997 Ludd, University of Lule}, Sweden. @@ -108,6 +108,8 @@ define USPACE USPACE define ENAMETOOLONG ENAMETOOLONG +define EV_COUNT offsetof(struct evcnt, ev_count) + define SYS_sigreturn SYS_sigreturn define SYS_exit SYS_exit diff --git a/sys/arch/vax/vax/gencons.c b/sys/arch/vax/vax/gencons.c index 2aacbabe813..4962482355b 100644 --- a/sys/arch/vax/vax/gencons.c +++ b/sys/arch/vax/vax/gencons.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gencons.c,v 1.11 2001/06/15 22:45:33 miod Exp $ */ +/* $OpenBSD: gencons.c,v 1.12 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: gencons.c,v 1.22 2000/01/24 02:40:33 matt Exp $ */ /* @@ -65,16 +65,10 @@ static int pr_txdb[4] = {PR_TXDB, PR_TXDB1, PR_TXDB2, PR_TXDB3}; static int pr_rxdb[4] = {PR_RXDB, PR_RXDB1, PR_RXDB2, PR_RXDB3}; cons_decl(gen); -#ifdef DYNAMIC_DEVSW -bcdev_decl(gencn); -#else cdev_decl(gencn); -#endif static int gencnparam __P((struct tty *, struct termios *)); static void gencnstart __P((struct tty *)); -void gencnrint __P((void *)); -void gencntint __P((void *)); int gencnopen(dev, flag, mode, p) @@ -82,11 +76,11 @@ gencnopen(dev, flag, mode, p) int flag, mode; struct proc *p; { - int unit; - struct tty *tp; + int unit; + struct tty *tp; - unit = minor(dev); - if (unit >= maxttys) + unit = minor(dev); + if (unit >= maxttys) return ENXIO; if (gencn_tty[unit] == NULL) @@ -94,21 +88,21 @@ gencnopen(dev, flag, mode, p) tp = gencn_tty[unit]; - tp->t_oproc = gencnstart; - tp->t_param = gencnparam; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) { - ttychars(tp); - tp->t_iflag = TTYDEF_IFLAG; - tp->t_oflag = TTYDEF_OFLAG; - tp->t_cflag = TTYDEF_CFLAG; - tp->t_lflag = TTYDEF_LFLAG; - tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; - gencnparam(tp, &tp->t_termios); - ttsetwater(tp); - } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) - return EBUSY; - tp->t_state |= TS_CARR_ON; + tp->t_oproc = gencnstart; + tp->t_param = gencnparam; + tp->t_dev = dev; + if ((tp->t_state & TS_ISOPEN) == 0) { + ttychars(tp); + tp->t_iflag = TTYDEF_IFLAG; + tp->t_oflag = TTYDEF_OFLAG; + tp->t_cflag = TTYDEF_CFLAG; + tp->t_lflag = TTYDEF_LFLAG; + tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED; + gencnparam(tp, &tp->t_termios); + ttsetwater(tp); + } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) + return EBUSY; + tp->t_state |= TS_CARR_ON; if (unit == 0) consopened = 1; mtpr(GC_RIE, pr_rxcs[unit]); /* Turn on interrupts */ @@ -123,42 +117,35 @@ gencnclose(dev, flag, mode, p) int flag, mode; struct proc *p; { - struct tty *tp = gencn_tty[minor(dev)]; + struct tty *tp = gencn_tty[minor(dev)]; if (minor(dev) == 0) consopened = 0; - (*linesw[tp->t_line].l_close)(tp, flag); - ttyclose(tp); - return (0); + (*linesw[tp->t_line].l_close)(tp, flag); + ttyclose(tp); + return (0); } struct tty * -gencntty(dev) - dev_t dev; +gencntty(dev_t dev) { return gencn_tty[minor(dev)]; } int -gencnread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; +gencnread(dev_t dev, struct uio *uio, int flag) { - struct tty *tp = gencn_tty[minor(dev)]; + struct tty *tp = gencn_tty[minor(dev)]; - return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); + return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } int -gencnwrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; +gencnwrite(dev_t dev, struct uio *uio, int flag) { - struct tty *tp = gencn_tty[minor(dev)]; + struct tty *tp = gencn_tty[minor(dev)]; - return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); + return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); } int @@ -169,33 +156,32 @@ gencnioctl(dev, cmd, data, flag, p) int flag; struct proc *p; { - struct tty *tp = gencn_tty[minor(dev)]; - int error; - - error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); - if (error >= 0) - return error; - error = ttioctl(tp, cmd, data, flag, p); - if (error >= 0) + struct tty *tp = gencn_tty[minor(dev)]; + int error; + + error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); + if (error >= 0) + return error; + error = ttioctl(tp, cmd, data, flag, p); + if (error >= 0) return error; return ENOTTY; } void -gencnstart(tp) - struct tty *tp; +gencnstart(struct tty *tp) { - struct clist *cl; - int s, ch; + struct clist *cl; + int s, ch; - s = spltty(); - if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT)) - goto out; - cl = &tp->t_outq; + s = spltty(); + if (tp->t_state & (TS_BUSY|TS_TTSTOP|TS_TIMEOUT)) + goto out; + cl = &tp->t_outq; if(cl->c_cc){ - tp->t_state |= TS_BUSY; + tp->t_state |= TS_BUSY; ch = getc(cl); mtpr(ch, pr_txdb[minor(tp->t_dev)]); } else { @@ -210,8 +196,7 @@ out: splx(s); } void -gencnrint(arg) - void *arg; +gencnrint(void *arg) { struct tty *tp = *(struct tty **) arg; int unit = (struct tty **) arg - gencn_tty; @@ -236,16 +221,13 @@ gencnrint(arg) } int -gencnstop(tp, flag) - struct tty *tp; - int flag; +gencnstop(struct tty *tp, int flag) { return 0; } void -gencntint(arg) - void *arg; +gencntint(void *arg) { struct tty *tp = *(struct tty **) arg; @@ -255,22 +237,20 @@ gencntint(arg) } int -gencnparam(tp, t) - struct tty *tp; - struct termios *t; +gencnparam(struct tty *tp, struct termios *t) { - /* XXX - These are ignored... */ - tp->t_ispeed = t->c_ispeed; - tp->t_ospeed = t->c_ospeed; - tp->t_cflag = t->c_cflag; + /* XXX - These are ignored... */ + tp->t_ispeed = t->c_ispeed; + tp->t_ospeed = t->c_ospeed; + tp->t_cflag = t->c_cflag; return 0; } void -gencnprobe(cndev) - struct consdev *cndev; +gencnprobe(struct consdev *cndev) { - if ((vax_cputype < VAX_TYP_UV1) || /* All older has MTPR console */ + if ((vax_cputype < VAX_TYP_UV2) || /* All older has MTPR console */ + (vax_boardtype == VAX_BTYP_9RR) || (vax_boardtype == VAX_BTYP_630) || (vax_boardtype == VAX_BTYP_650) || (vax_boardtype == VAX_BTYP_660) || @@ -284,33 +264,56 @@ gencnprobe(cndev) } void -gencninit(cndev) - struct consdev *cndev; +gencninit(struct consdev *cndev) { /* Allocate interrupt vectors */ - scb_vecalloc(SCB_G0R, gencnrint, &gencn_tty[0], SCB_ISTACK); - scb_vecalloc(SCB_G0T, gencntint, &gencn_tty[0], SCB_ISTACK); + scb_vecalloc(SCB_G0R, gencnrint, &gencn_tty[0], SCB_ISTACK, NULL); + scb_vecalloc(SCB_G0T, gencntint, &gencn_tty[0], SCB_ISTACK, NULL); if (vax_cputype == VAX_TYP_8SS) { maxttys = 4; - scb_vecalloc(SCB_G1R, gencnrint, &gencn_tty[1], SCB_ISTACK); - scb_vecalloc(SCB_G1T, gencntint, &gencn_tty[1], SCB_ISTACK); + scb_vecalloc(SCB_G1R, gencnrint, &gencn_tty[1], SCB_ISTACK, NULL); + scb_vecalloc(SCB_G1T, gencntint, &gencn_tty[1], SCB_ISTACK, NULL); - scb_vecalloc(SCB_G2R, gencnrint, &gencn_tty[2], SCB_ISTACK); - scb_vecalloc(SCB_G2T, gencntint, &gencn_tty[2], SCB_ISTACK); + scb_vecalloc(SCB_G2R, gencnrint, &gencn_tty[2], SCB_ISTACK, NULL); + scb_vecalloc(SCB_G2T, gencntint, &gencn_tty[2], SCB_ISTACK, NULL); - scb_vecalloc(SCB_G3R, gencnrint, &gencn_tty[3], SCB_ISTACK); - scb_vecalloc(SCB_G3T, gencntint, &gencn_tty[3], SCB_ISTACK); + scb_vecalloc(SCB_G3R, gencnrint, &gencn_tty[3], SCB_ISTACK, NULL); + scb_vecalloc(SCB_G3T, gencntint, &gencn_tty[3], SCB_ISTACK, NULL); } + mtpr(0, PR_RXCS); + mtpr(0, PR_TXCS); mtpr(0, PR_TBIA); /* ??? */ } void -gencnputc(dev,ch) - dev_t dev; - int ch; +gencnputc(dev_t dev, int ch) { +#ifdef VAX8800 + /* + * On KA88 we may get C-S/C-Q from the console. + * XXX - this will cause a loop at spltty() in kernel and will + * interfere with other console communication. Fortunately + * kernel printf's are uncommon. + */ + if (vax_cputype == VAX_TYP_8NN) { + int s = spltty(); + + while (mfpr(PR_RXCS) & GC_DON) { + if ((mfpr(PR_RXDB) & 0x7f) == 19) { + while (1) { + while ((mfpr(PR_RXCS) & GC_DON) == 0) + ; + if ((mfpr(PR_RXDB) & 0x7f) == 17) + break; + } + } + } + splx(s); + } +#endif + while ((mfpr(PR_TXCS) & GC_RDY) == 0) /* Wait until xmit ready */ ; mtpr(ch, PR_TXDB); /* xmit character */ @@ -320,8 +323,7 @@ gencnputc(dev,ch) } int -gencngetc(dev) - dev_t dev; +gencngetc(dev_t dev) { int i; @@ -334,15 +336,13 @@ gencngetc(dev) } void -gencnpollc(dev, pollflag) - dev_t dev; - int pollflag; +gencnpollc(dev_t dev, int pollflag) { - if (pollflag) { - mtpr(0, PR_RXCS); - mtpr(0, PR_TXCS); + if (pollflag) { + mtpr(0, PR_RXCS); + mtpr(0, PR_TXCS); } else if (consopened) { - mtpr(GC_RIE, PR_RXCS); - mtpr(GC_TIE, PR_TXCS); + mtpr(GC_RIE, PR_RXCS); + mtpr(GC_TIE, PR_TXCS); } } diff --git a/sys/arch/vax/vax/ibus.c b/sys/arch/vax/vax/ibus.c index a3d0d46e083..e804ad2d416 100644 --- a/sys/arch/vax/vax/ibus.c +++ b/sys/arch/vax/vax/ibus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ibus.c,v 1.3 2001/02/11 06:34:37 hugh Exp $ */ -/* $NetBSD: ibus.c,v 1.2 1999/08/14 18:42:46 ragge Exp $ */ +/* $OpenBSD: ibus.c,v 1.4 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ibus.c,v 1.7 2001/02/04 20:36:32 ragge Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -39,9 +39,9 @@ #include <machine/cpu.h> #include <machine/sid.h> -static int ibus_print __P((void *, const char *)); -static int ibus_match __P((struct device *, struct cfdata *, void *)); -static void ibus_attach __P((struct device *, struct device *, void*)); +static int ibus_print(void *, const char *); +static int ibus_match(struct device *, struct cfdata *, void *); +static void ibus_attach(struct device *, struct device *, void*); struct cfdriver ibus_cd = { NULL, "ibus", DV_DULL @@ -52,9 +52,7 @@ struct cfattach ibus_ca = { }; int -ibus_print(aux, name) - void *aux; - const char *name; +ibus_print(void *aux, const char *name) { struct bp_conf *bp = aux; @@ -66,19 +64,17 @@ ibus_print(aux, name) int -ibus_match(parent, cf, aux) - struct device *parent; - struct cfdata *cf; - void *aux; +ibus_match(struct device *parent, struct cfdata *cf, void *aux) { if (vax_bustype == VAX_IBUS) return 1; return 0; } -#define MVNIADDR 0x20084400 -#define SGECADDR 0x20008000 -#define SHACADDR 0x20004200 +#define MVNIADDR 0x20084400 +#define SGECADDR 0x20008000 +#define SHACADDR 0x20004200 +#define SHAC1303ADDR 0x20008200 void ibus_attach(parent, self, aux) @@ -112,7 +108,10 @@ ibus_attach(parent, self, aux) * The same procedure for SHAC. */ bp.type = "shac"; - va = vax_map_physmem(SHACADDR, 1); + if (vax_boardtype == VAX_BTYP_1303) + va = vax_map_physmem(SHAC1303ADDR, 1); + else + va = vax_map_physmem(SHACADDR, 1); if (badaddr((caddr_t)va + 0x48, 4) == 0) config_found(self, &bp, ibus_print); vax_unmap_physmem(va, 1); diff --git a/sys/arch/vax/vax/intvec.s b/sys/arch/vax/vax/intvec.s index 8f8a1ca6256..4cf915f418a 100644 --- a/sys/arch/vax/vax/intvec.s +++ b/sys/arch/vax/vax/intvec.s @@ -1,4 +1,4 @@ -/* $OpenBSD: intvec.s,v 1.13 2000/10/24 01:50:19 hugh Exp $ */ +/* $OpenBSD: intvec.s,v 1.14 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: intvec.s,v 1.39 1999/06/28 08:20:48 itojun Exp $ */ /* @@ -214,8 +214,9 @@ ENTRY(privinflt) # Privileged/unimplemented instruction * put in a need for an extra check when the fault is gotten during * PTE reference. Handled in pmap.c. */ - .align 2 -transl_v: .globl transl_v # Translation violation, 20 + .align 2 + .globl transl_v # 20: Translation violation +transl_v: pushr $0x3f pushl 28(sp) pushl 28(sp) @@ -228,8 +229,9 @@ transl_v: .globl transl_v # Translation violation, 20 1: popr $0x3f brb access_v - .align 2 -access_v:.globl access_v # Access cntrl viol fault, 24 + .align 2 + .globl access_v # 24: Access cntrl viol fault +access_v: blbs (sp), ptelen pushl $T_ACCFLT bbc $1,4(sp),1f @@ -273,7 +275,7 @@ ENTRY(cmrerr) rei ENTRY(sbiflt); - movab sbifltmsg, -(sp) + pushab sbifltmsg calls $1, _panic TRAPCALL(astintr, T_ASTFLT) @@ -316,6 +318,8 @@ ENTRY(netint) .globl hardclock hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag pushr $0x3f + incl _clock_intrcnt+EV_COUNT # count the number of clock interrupts +# adwc $0,_clock_intrcnt+EV_COUNT+4 #ifdef VAX46 cmpl _vax_boardtype,$VAX_BTYP_46 bneq 1f diff --git a/sys/arch/vax/vax/ka49.c b/sys/arch/vax/vax/ka49.c index 48bc1c8b77e..3887d37b821 100644 --- a/sys/arch/vax/vax/ka49.c +++ b/sys/arch/vax/vax/ka49.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka49.c,v 1.2 2001/06/25 00:43:19 mickey Exp $ */ +/* $OpenBSD: ka49.c,v 1.3 2001/08/25 13:33:37 hugh Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -60,7 +60,7 @@ struct cpu_dep ka49_calls = { ka49_conf, chip_clkread, chip_clkwrite, - 16, /* ~VUPS */ + 32, /* ~VUPS */ 2, /* SCB pages */ ka49_halt, ka49_reboot, @@ -209,12 +209,11 @@ ka49_mchk(addr) void ka49_steal_pages() { - /* * Get the soft and hard memory error vectors now. */ - scb_vecalloc(0x54, ka49_softmem, 0, 0); - scb_vecalloc(0x60, ka49_hardmem, 0, 0); + scb_vecalloc(0x54, ka49_softmem, NULL, 0, NULL); + scb_vecalloc(0x60, ka49_hardmem, NULL, 0, NULL); /* Turn on caches (to speed up execution a bit) */ ka49_cache_enable(); diff --git a/sys/arch/vax/vax/ka53.c b/sys/arch/vax/vax/ka53.c index 60331470026..214a6dc7d81 100644 --- a/sys/arch/vax/vax/ka53.c +++ b/sys/arch/vax/vax/ka53.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka53.c,v 1.3 2001/06/25 00:43:19 mickey Exp $ */ +/* $OpenBSD: ka53.c,v 1.4 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: ka53.c,v 1.2 2000/06/04 02:19:27 matt Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. @@ -79,7 +79,7 @@ ka53_conf() {volatile int *hej = (void *)mfpr(PR_ISP); *hej = *hej; hej[-1] = hej[-1];} /* This vector (qbus related?) comes out of nowhere, ignore it for now */ - scb_vecalloc(0x0, (void *)nullop, 0, SCB_ISTACK); + scb_vecalloc(0x0, (void *)nullop, NULL, SCB_ISTACK, NULL); switch((vax_siedata >> 8) & 0xFF) { case VAX_STYP_50: @@ -229,8 +229,8 @@ ka53_steal_pages() * Get the soft and hard memory error vectors now. */ - scb_vecalloc(0x54, ka53_softmem, 0, 0); - scb_vecalloc(0x60, ka53_hardmem, 0, 0); + scb_vecalloc(0x54, ka53_softmem, NULL, 0, NULL); + scb_vecalloc(0x60, ka53_hardmem, NULL, 0, NULL); /* Turn on caches (to speed up execution a bit) */ diff --git a/sys/arch/vax/vax/ka650.c b/sys/arch/vax/vax/ka650.c index e0ffa4a5b72..7605a24b481 100644 --- a/sys/arch/vax/vax/ka650.c +++ b/sys/arch/vax/vax/ka650.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ka650.c,v 1.7 2000/04/27 01:10:12 bjc Exp $ */ -/* $NetBSD: ka650.c,v 1.20 1999/08/07 10:36:49 ragge Exp $ */ +/* $OpenBSD: ka650.c,v 1.8 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ka650.c,v 1.25 2001/04/27 15:02:37 ragge Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. * All rights reserved. @@ -110,8 +110,7 @@ uvaxIII_conf() syssub == VAX_SIE_KA640 ? 4 : 5, syssub == VAX_SIE_KA655 ? 5 : 0, (vax_cpudata & 0xff), GETFRMREV(vax_siedata)); - if (syssub != VAX_SIE_KA640) - ka650setcache(CACHEON); + ka650setcache(CACHEON); if (ctob(physmem) > ka650merr_ptr->merr_qbmbr) { printf("physmem(0x%x) > qbmbr(0x%x)\n", ctob(physmem), (int)ka650merr_ptr->merr_qbmbr); @@ -250,25 +249,30 @@ uvaxIII_mchk(cmcf) * Enable 1st level cache too. */ void -ka650setcache(state) +ka650setcache(int state) { - register int i; + int syssub = GETSYSSUBT(vax_siedata); + int i; /* * Before doing anything, disable the cache. */ mtpr(0, PR_CADR); - ka650cbd_ptr->cbd_cacr = CACR_CPE; + if (syssub != VAX_SIE_KA640) + 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); + if (syssub != VAX_SIE_KA640) { + for (i = 0; + i < (KA650_CACHESIZE / sizeof(KA650_CACHE_ptr[0])); + i += 2) + KA650_CACHE_ptr[i] = 0; + ka650cbd_ptr->cbd_cacr = CACR_CEN; + } } } diff --git a/sys/arch/vax/vax/ka680.c b/sys/arch/vax/vax/ka680.c index eff212da9ac..0cc8f9aa5c0 100644 --- a/sys/arch/vax/vax/ka680.c +++ b/sys/arch/vax/vax/ka680.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ka680.c,v 1.5 2001/06/25 00:43:19 mickey Exp $ */ +/* $OpenBSD: ka680.c,v 1.6 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: ka680.c,v 1.3 2001/01/28 21:01:53 ragge Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. @@ -245,8 +245,8 @@ ka680_steal_pages() /* * Get the soft and hard memory error vectors now. */ - scb_vecalloc(0x54, ka680_softmem, 0, 0); - scb_vecalloc(0x60, ka680_hardmem, 0, 0); + scb_vecalloc(0x54, ka680_softmem, NULL, 0, NULL); + scb_vecalloc(0x60, ka680_hardmem, NULL, 0, NULL); /* Turn on caches (to speed up execution a bit) */ ka680_cache_enable(); diff --git a/sys/arch/vax/vax/ka820.c b/sys/arch/vax/vax/ka820.c index 27db9a89263..5de12c0f1ea 100644 --- a/sys/arch/vax/vax/ka820.c +++ b/sys/arch/vax/vax/ka820.c @@ -1,5 +1,5 @@ -/* $OpenBSD: ka820.c,v 1.4 2000/04/27 01:10:12 bjc Exp $ */ -/* $NetBSD: ka820.c,v 1.17 1999/09/06 19:52:52 ragge Exp $ */ +/* $OpenBSD: ka820.c,v 1.5 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: ka820.c,v 1.22 2000/06/04 02:19:27 matt Exp $ */ /* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. @@ -67,19 +67,25 @@ struct ka820port *ka820port_ptr; struct rx50device *rx50device_ptr; - -static int ka820_match __P((struct device *, struct cfdata *, void *)); -static void ka820_attach __P((struct device *, struct device *, void*)); -static void rxcdintr __P((int)); -void crxintr __P((int)); +static volatile struct ka820clock *ka820_clkpage; + +static int ka820_match __P((struct device *, struct cfdata *, void *)); +static void ka820_attach __P((struct device *, struct device *, void*)); +static void ka820_memerr __P((void)); +static void ka820_conf __P((void)); +static int ka820_mchk __P((caddr_t)); +static int ka820_clkread(time_t base); +static void ka820_clkwrite(void); +static void rxcdintr __P((void *)); +static void vaxbierr(void *); struct cpu_dep ka820_calls = { 0, ka820_mchk, ka820_memerr, - NULL, - chip_clkread, - chip_clkwrite, + ka820_conf, + ka820_clkread, + ka820_clkwrite, 3, /* ~VUPS */ 5, /* SCB pages */ }; @@ -124,16 +130,16 @@ ka820_attach(parent, self, aux) struct bi_attach_args *ba = aux; register int csr; u_short rev; - extern char cpu_model[]; rev = bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_DTYPE) >> 16; - strcpy(cpu_model,"VAX 8200"); + strcpy(cpu_model, "VAX 8200"); cpu_model[6] = rev & 0x8000 ? '5' : '0'; printf(": ka82%c (%s) cpu rev %d, u patch rev %d, sec patch %d\n", cpu_model[6], mastercpu == ba->ba_nodenr ? "master" : "slave", ((rev >> 11) & 15), ((rev >> 1) &1023), rev & 1); /* reset the console and enable the RX50 */ + ka820port_ptr = (void *)vax_map_physmem(KA820_PORTADDR, 1); csr = ka820port_ptr->csr; csr &= ~KA820PORT_RSTHALT; /* ??? */ csr |= KA820PORT_CONSCLR | KA820PORT_CRDCLR | KA820PORT_CONSEN | @@ -145,18 +151,30 @@ ka820_attach(parent, self, aux) bus_space_read_4(ba->ba_iot, ba->ba_ioh, BIREG_VAXBICSR) | BICSR_SEIE | BICSR_HEIE); - /* XXX - should be done somewhere else */ - scb_vecalloc(SCB_RX50, crxintr, 0, SCB_ISTACK); +} - clk_adrshift = 0; /* clk regs are addressed at short's */ - clk_tweak = 1; /* ...but not exactly in each short */ - clk_page = (short *)vax_map_physmem((paddr_t)KA820_CLOCKADDR, 1); +void +ka820_conf() +{ + /* + * Setup parameters necessary to read time from clock chip. + */ + ka820_clkpage = (void *)vax_map_physmem(KA820_CLOCKADDR, 1); /* Steal the interrupt vectors that are unique for us */ - scb_vecalloc(KA820_INT_RXCD, rxcdintr, 0, SCB_ISTACK); + scb_vecalloc(KA820_INT_RXCD, rxcdintr, NULL, SCB_ISTACK, NULL); + scb_vecalloc(0x50, vaxbierr, NULL, SCB_ISTACK, NULL); + /* XXX - should be done somewhere else */ + scb_vecalloc(SCB_RX50, crxintr, NULL, SCB_ISTACK, NULL); rx50device_ptr = (void *)vax_map_physmem(KA820_RX50ADDR, 1); - ka820port_ptr = (void *)vax_map_physmem(KA820_PORTADDR, 1); +} + +void +vaxbierr(void *arg) +{ + if (cold == 0) + panic("vaxbierr"); } #ifdef notdef @@ -374,10 +392,60 @@ ka820_mchk(cmcf) */ void rxcdintr(arg) - int arg; + void *arg; { register int c = mfpr(PR_RXCD); /* not sure what (if anything) to do with these */ printf("rxcd node %x c=0x%x\n", (c >> 8) & 0xf, c & 0xff); } + +int +ka820_clkread(time_t base) +{ + struct clock_ymdhms c; + int s; + + while (ka820_clkpage->csr0 & KA820CLK_0_BUSY) + ; + s = splhigh(); + c.dt_sec = ka820_clkpage->sec; + c.dt_min = ka820_clkpage->min; + c.dt_hour = ka820_clkpage->hr; + c.dt_wday = ka820_clkpage->dayofwk; + c.dt_day = ka820_clkpage->day; + c.dt_mon = ka820_clkpage->mon; + c.dt_year = ka820_clkpage->yr; + splx(s); + + /* strange conversion */ + c.dt_sec = ((c.dt_sec << 7) | (c.dt_sec >> 1)) & 0377; + c.dt_min = ((c.dt_min << 7) | (c.dt_min >> 1)) & 0377; + c.dt_hour = ((c.dt_hour << 7) | (c.dt_hour >> 1)) & 0377; + c.dt_wday = ((c.dt_wday << 7) | (c.dt_wday >> 1)) & 0377; + c.dt_day = ((c.dt_day << 7) | (c.dt_day >> 1)) & 0377; + c.dt_mon = ((c.dt_mon << 7) | (c.dt_mon >> 1)) & 0377; + c.dt_year = ((c.dt_year << 7) | (c.dt_year >> 1)) & 0377; + + time.tv_sec = clock_ymdhms_to_secs(&c); + return CLKREAD_OK; +} + +void +ka820_clkwrite(void) +{ + struct clock_ymdhms c; + + clock_secs_to_ymdhms(time.tv_sec, &c); + + ka820_clkpage->csr1 = KA820CLK_1_SET; + ka820_clkpage->sec = ((c.dt_sec << 1) | (c.dt_sec >> 7)) & 0377; + ka820_clkpage->min = ((c.dt_min << 1) | (c.dt_min >> 7)) & 0377; + ka820_clkpage->hr = ((c.dt_hour << 1) | (c.dt_hour >> 7)) & 0377; + ka820_clkpage->dayofwk = ((c.dt_wday << 1) | (c.dt_wday >> 7)) & 0377; + ka820_clkpage->day = ((c.dt_day << 1) | (c.dt_day >> 7)) & 0377; + ka820_clkpage->mon = ((c.dt_mon << 1) | (c.dt_mon >> 7)) & 0377; + ka820_clkpage->yr = ((c.dt_year << 1) | (c.dt_year >> 7)) & 0377; + + ka820_clkpage->csr1 = KA820CLK_1_GO; +} diff --git a/sys/arch/vax/vax/scb.c b/sys/arch/vax/vax/scb.c index 115c9b3bc54..f7884dcedb8 100644 --- a/sys/arch/vax/vax/scb.c +++ b/sys/arch/vax/vax/scb.c @@ -1,5 +1,5 @@ -/* $OpenBSD: scb.c,v 1.2 2001/06/25 00:43:19 mickey Exp $ */ -/* $NetBSD: scb.c,v 1.9 2000/01/24 02:40:34 matt Exp $ */ +/* $OpenBSD: scb.c,v 1.3 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: scb.c,v 1.12 2000/06/04 06:16:59 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -37,6 +37,7 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/device.h> #include <machine/trap.h> #include <machine/scb.h> @@ -45,16 +46,17 @@ #include <machine/sid.h> #include <machine/mtpr.h> -static void scb_stray __P((void *)); +struct scb *scb; +struct ivec_dsp *scb_vec; -static struct ivec_dsp *scb_vec; +static void scb_stray __P((void *)); static volatile int vector, ipl, gotintr; + /* * Generates a new SCB. */ paddr_t -scb_init(avail_start) - paddr_t avail_start; +scb_init(paddr_t avail_start) { struct ivec_dsp **ivec = (struct ivec_dsp **)avail_start; struct ivec_dsp **old = (struct ivec_dsp **)KERNBASE; @@ -72,6 +74,7 @@ scb_init(avail_start) scb_vec[i] = idsptch; scb_vec[i].hoppaddr = scb_stray; scb_vec[i].pushlarg = (void *) (i * 4); + scb_vec[i].ev = NULL; } /* * Copy all pre-set interrupt vectors to the new SCB. @@ -86,7 +89,8 @@ scb_init(avail_start) mtpr(avail_start, PR_SCBB); /* Return new avail_start. Also save space for the dispatchers. */ - return avail_start + (scb_size * 5) * VAX_NBPG; + return avail_start + (1 + sizeof(struct ivec_dsp) / sizeof(void *)) + * scb_size * VAX_NBPG; }; /* @@ -94,19 +98,19 @@ scb_init(avail_start) * This function must _not_ save any registers (in the reg save mask). */ void -scb_stray(arg) - void *arg; +scb_stray(void *arg) { - struct callsframe *cf = FRAMEOFFSET(arg); - int *a = &cf->ca_arg1; - gotintr = 1; vector = ((int) arg) & ~3; ipl = mfpr(PR_IPL); + if (cold == 0) printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl); - else - a[8] = (a[8] & 0xffe0ffff) | ipl << 16; + else { + struct icallsframe *icf = (void *) __builtin_frame_address(0); + + icf->ica_psl = (icf->ica_psl & ~PSL_IPL) | ipl << 16; + } mtpr(ipl + 1, PR_IPL); } @@ -147,16 +151,18 @@ scb_vecref(rvec, ripl) * Sets a vector to the specified function. * Arg may not be greater than 63. */ + void -scb_vecalloc(vecno, func, arg, stack) +scb_vecalloc(vecno, func, arg, stack, ev) int vecno; - void (*func) __P((void *)); + void (*func)(void *); void *arg; int stack; + struct evcnt *ev; { struct ivec_dsp *dsp = &scb_vec[vecno / 4]; - u_int *iscb = (u_int *)scb; /* XXX */ dsp->hoppaddr = func; dsp->pushlarg = arg; - iscb[vecno/4] = (u_int)(dsp) | stack; + dsp->ev = ev; + ((u_int *) scb)[vecno/4] = (u_int)(dsp) | stack; } diff --git a/sys/arch/vax/vax/subr.s b/sys/arch/vax/vax/subr.s index e1cef336322..34b3604693d 100644 --- a/sys/arch/vax/vax/subr.s +++ b/sys/arch/vax/vax/subr.s @@ -1,4 +1,4 @@ -/* $OpenBSD: subr.s,v 1.14 2001/06/15 22:45:34 miod Exp $ */ +/* $OpenBSD: subr.s,v 1.15 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: subr.s,v 1.32 1999/03/25 00:41:48 mrg Exp $ */ /* @@ -118,21 +118,26 @@ _ultrix_esigcode: .globl _idsptch, _eidsptch _idsptch: pushr $0x3f - .word 0x9f16 - .long _cmn_idsptch - .long 0 - .long 0 + .word 0x9f16 # jsb to absolute address + .long _cmn_idsptch # the absolute address + .long 0 # the callback interrupt routine + .long 0 # its argument + .long 0 # ptr to correspond evcnt struct _eidsptch: _cmn_idsptch: - movl (sp)+,r0 - pushl 4(r0) - calls $1,*(r0) - popr $0x3f - rei + movl (sp)+,r0 # get pointer to idspvec + movl 8(r0),r1 # get evcnt pointer + beql 1f # no ptr, skip increment + incl EV_COUNT(r1) # increment low longword +# adwc $0,EV_COUNT+4(r1) # add any carry to hi longword +1: pushl 4(r0) # push argument + calls $1,*(r0) # call interrupt routine + popr $0x3f # pop registers + rei # return from interrut ENTRY(badaddr,R2|R3) # Called with addr,b/w/l - mfpr $0x12,r0 + mfpr $0x12,r0 # splhigh() mtpr $0x1f,$0x12 movl 4(ap),r2 # First argument, the address movl 8(ap),r1 # Sec arg, b,w,l diff --git a/sys/arch/vax/vsa/asc_vsbus.c b/sys/arch/vax/vsa/asc_vsbus.c index 3e330022c7e..00ffed74ce3 100644 --- a/sys/arch/vax/vsa/asc_vsbus.c +++ b/sys/arch/vax/vsa/asc_vsbus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: asc_vsbus.c,v 1.3 2001/02/11 06:34:37 hugh Exp $ */ -/* $NetBSD: asc_vsbus.c,v 1.20 2000/07/26 21:50:48 matt Exp $ */ +/* $OpenBSD: asc_vsbus.c,v 1.4 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: asc_vsbus.c,v 1.22 2001/02/04 20:36:32 ragge Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -284,7 +284,8 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux) sc->sc_freq /= 1000000; scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr53c9x_intr, - &asc->sc_ncr53c9x, SCB_ISTACK); + &asc->sc_ncr53c9x, SCB_ISTACK, &asc->sc_intrcnt); + evcnt_attach(self, "intr", &asc->sc_intrcnt); /* * XXX More of this should be in ncr53c9x_attach(), but diff --git a/sys/arch/vax/vsa/dz_ibus.c b/sys/arch/vax/vsa/dz_ibus.c index 0be9c27a6d7..e6e3383aca4 100644 --- a/sys/arch/vax/vsa/dz_ibus.c +++ b/sys/arch/vax/vsa/dz_ibus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dz_ibus.c,v 1.6 2001/06/15 22:45:34 miod Exp $ */ +/* $OpenBSD: dz_ibus.c,v 1.7 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: dz_ibus.c,v 1.15 1999/08/27 17:50:42 ragge Exp $ */ /* * Copyright (c) 1998 Ludd, University of Lule}, Sweden. @@ -14,8 +14,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 * @@ -51,6 +51,7 @@ #include <machine/vsbus.h> #include <machine/cpu.h> #include <machine/scb.h> +#include <machine/nexus.h> #include <machine/../vax/gencons.h> @@ -62,8 +63,8 @@ #include "dzkbd.h" #include "dzms.h" -static int dz_vsbus_match __P((struct device *, struct cfdata *, void *)); -static void dz_vsbus_attach __P((struct device *, struct device *, void *)); +static int dz_vsbus_match(struct device *, struct cfdata *, void *); +static void dz_vsbus_attach(struct device *, struct device *, void *); static vaddr_t dz_regs; /* Used for console */ @@ -175,8 +176,11 @@ dz_vsbus_attach(parent, self, aux) sc->sc_type = DZ_DZV; sc->sc_dsr = 0x0f; /* XXX check if VS has modem ctrl bits */ - scb_vecalloc(va->va_cvec, dzxint, sc, SCB_ISTACK); - scb_vecalloc(va->va_cvec - 4, dzrint, sc, SCB_ISTACK); + scb_vecalloc(va->va_cvec, dzxint, sc, SCB_ISTACK, + &sc->sc_tintrcnt); + scb_vecalloc(va->va_cvec - 4, dzrint, sc, SCB_ISTACK, + &sc->sc_rintrcnt); + printf("\n%s: 4 lines", self->dv_xname); dzattach(sc); diff --git a/sys/arch/vax/vsa/if_le_vsbus.c b/sys/arch/vax/vsa/if_le_vsbus.c index 8a3d1224a95..4fa5949eb34 100644 --- a/sys/arch/vax/vsa/if_le_vsbus.c +++ b/sys/arch/vax/vsa/if_le_vsbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le_vsbus.c,v 1.3 2001/02/11 06:34:38 hugh Exp $ */ +/* $OpenBSD: if_le_vsbus.c,v 1.4 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: if_le_vsbus.c,v 1.10 2000/06/29 07:14:18 mrg Exp $ */ /*- @@ -225,7 +225,9 @@ le_vsbus_attach(parent, self, aux) sc->sc_am7990.sc_wrcsr = lewrcsr; sc->sc_am7990.sc_nocarrier = NULL; - scb_vecalloc(va->va_cvec, (void (*)(void *)) am7990_intr, sc, SCB_ISTACK); + scb_vecalloc(va->va_cvec, (void (*)(void *)) am7990_intr, sc, + SCB_ISTACK, &sc->sc_intrcnt); + evcnt_attach(self, "intr", &sc->sc_intrcnt); /* * Allocate a (DMA-safe) block for all descriptors and buffers. diff --git a/sys/arch/vax/vsa/if_ze_vsbus.c b/sys/arch/vax/vsa/if_ze_vsbus.c index 64414a4e448..34d6ccb6156 100644 --- a/sys/arch/vax/vsa/if_ze_vsbus.c +++ b/sys/arch/vax/vsa/if_ze_vsbus.c @@ -1,5 +1,5 @@ -/* $OpenBSD: if_ze_vsbus.c,v 1.1 2000/04/27 02:34:50 bjc Exp $ */ -/* $NetBSD: if_ze_vsbus.c,v 1.2 2000/01/24 02:40:35 matt Exp $ */ +/* $OpenBSD: if_ze_vsbus.c,v 1.2 2001/08/25 13:33:37 hugh Exp $ */ +/* $NetBSD: if_ze_vsbus.c,v 1.5 2000/07/26 21:50:49 matt Exp $ */ /* * Copyright (c) 1999 Ludd, University of Lule}, Sweden. All rights reserved. * @@ -63,8 +63,8 @@ #define NISA_ROM 0x27800000 #define SGECVEC 0x108 -static int zematch __P((struct device *, void *, void *)); -static void zeattach __P((struct device *, struct device *, void *)); +static int zematch(struct device *, void *, void *); +static void zeattach(struct device *, struct device *, void *); struct cfattach ze_vsbus_ca = { sizeof(struct ze_softc), zematch, zeattach @@ -103,6 +103,7 @@ zeattach(parent, self, aux) { struct ze_softc *sc = (struct ze_softc *)self; struct vsbus_attach_args *va = aux; + extern struct vax_bus_dma_tag vax_bus_dma_tag; int *ea, i; /* @@ -110,10 +111,11 @@ zeattach(parent, self, aux) */ sc->sc_ioh = vax_map_physmem(SGECADDR, 1); sc->sc_iot = 0; /* :-) */ - sc->sc_dmat = va->va_dmat; + sc->sc_dmat = &vax_bus_dma_tag; sc->sc_intvec = SGECVEC; - scb_vecalloc(va->va_cvec, (void (*)(void *)) sgec_intr, sc, SCB_ISTACK); + scb_vecalloc(va->va_cvec, (void (*)(void *)) sgec_intr, + sc, SCB_ISTACK, &sc->sc_intrcnt); /* * Map in, read and release ethernet rom address. diff --git a/sys/arch/vax/vsa/ncr.c b/sys/arch/vax/vsa/ncr.c index 7bacbaf2a43..b38fb32635e 100644 --- a/sys/arch/vax/vsa/ncr.c +++ b/sys/arch/vax/vsa/ncr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ncr.c,v 1.9 2001/02/15 13:15:03 hugh Exp $ */ +/* $OpenBSD: ncr.c,v 1.10 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: ncr.c,v 1.32 2000/06/25 16:00:43 ragge Exp $ */ /*- @@ -91,6 +91,7 @@ struct si_dma_handle { struct si_softc { struct ncr5380_softc ncr_sc; + struct evcnt ncr_intrcnt; caddr_t ncr_addr; int ncr_off; int ncr_dmaaddr; @@ -108,18 +109,18 @@ struct si_softc { static int ncr_dmasize; -static int si_match __P((struct device *, void *, void *)); -static void si_attach __P((struct device *, struct device *, void *)); -static void si_minphys __P((struct buf *)); +static int si_match(struct device *, void *, void *); +static void si_attach(struct device *, struct device *, void *); +static void si_minphys(struct buf *); -static void si_dma_alloc __P((struct ncr5380_softc *)); -static void si_dma_free __P((struct ncr5380_softc *)); -static void si_dma_setup __P((struct ncr5380_softc *)); -static void si_dma_start __P((struct ncr5380_softc *)); -static void si_dma_poll __P((struct ncr5380_softc *)); -static void si_dma_eop __P((struct ncr5380_softc *)); -static void si_dma_stop __P((struct ncr5380_softc *)); -static void si_dma_go __P((void *)); +static void si_dma_alloc(struct ncr5380_softc *); +static void si_dma_free(struct ncr5380_softc *); +static void si_dma_setup(struct ncr5380_softc *); +static void si_dma_start(struct ncr5380_softc *); +static void si_dma_poll(struct ncr5380_softc *); +static void si_dma_eop(struct ncr5380_softc *); +static void si_dma_stop(struct ncr5380_softc *); +static void si_dma_go(void *); #define NCR5380_READ(sc, reg) bus_space_read_1(sc->sc_regt, \ 0, sc->ncr_sc.reg) @@ -182,7 +183,9 @@ si_attach(parent, self, aux) int tweak, target; /* enable interrupts on vsbus too */ - scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr5380_intr, sc, SCB_ISTACK); + scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr5380_intr, sc, + SCB_ISTACK, &sc->ncr_intrcnt); + evcnt_attach(self, "intr", &sc->ncr_intrcnt); /* * DMA area mapin. diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c index 43e18bf8584..bbf9fe688e8 100644 --- a/sys/arch/vax/vsa/vsbus.c +++ b/sys/arch/vax/vsa/vsbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsbus.c,v 1.6 2001/02/11 06:34:38 hugh Exp $ */ +/* $OpenBSD: vsbus.c,v 1.7 2001/08/25 13:33:37 hugh Exp $ */ /* $NetBSD: vsbus.c,v 1.29 2000/06/29 07:14:37 mrg Exp $ */ /* * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden. @@ -67,13 +67,13 @@ #include <machine/vsbus.h> -int vsbus_match __P((struct device *, struct cfdata *, void *)); -void vsbus_attach __P((struct device *, struct device *, void *)); -int vsbus_print __P((void *, const char *)); -int vsbus_search __P((struct device *, void *, void *)); +int vsbus_match(struct device *, struct cfdata *, void *); +void vsbus_attach(struct device *, struct device *, void *); +int vsbus_print(void *, const char *); +int vsbus_search(struct device *, void *, void *); -void ka410_attach __P((struct device *, struct device *, void *)); -void ka43_attach __P((struct device *, struct device *, void *)); +void ka410_attach(struct device *, struct device *, void *); +void ka43_attach(struct device *, struct device *, void *); static struct vax_bus_dma_tag vsbus_bus_dma_tag = { 0, |