Allocate (almost) all interrupt vectors dynamically. Simplifies much

work when adding support for new machines and devices.
This commit is contained in:
ragge 1999-01-19 21:04:47 +00:00
parent 3ef6c36461
commit bef0af5311
36 changed files with 430 additions and 481 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba_bi.c,v 1.2 1999/01/01 21:43:17 ragge Exp $ */ /* $NetBSD: uba_bi.c,v 1.3 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -157,7 +157,6 @@ uba_bi_attach(parent, self, aux)
sc->uh_ubainit = bua_init; sc->uh_ubainit = bua_init;
/* sc->uh_type not used */ /* sc->uh_type not used */
sc->uh_memsize = UBAPAGES; sc->uh_memsize = UBAPAGES;
sc->uh_iarea = (void *)&scb[1 + allocvec++];
sc->uh_mr = BUA(sc->uh_uba)->bn_map; sc->uh_mr = BUA(sc->uh_uba)->bn_map;
#ifdef notdef #ifdef notdef
@ -177,7 +176,7 @@ uba_bi_attach(parent, self, aux)
BUA(sc->uh_uba)->bn_biic.bi_intrdes = ba->ba_intcpu; BUA(sc->uh_uba)->bn_biic.bi_intrdes = ba->ba_intcpu;
BUA(sc->uh_uba)->bn_biic.bi_csr = BUA(sc->uh_uba)->bn_biic.bi_csr =
(BUA(sc->uh_uba)->bn_biic.bi_csr&~BICSR_ARB_MASK) | BICSR_ARB_HIGH; (BUA(sc->uh_uba)->bn_biic.bi_csr&~BICSR_ARB_MASK) | BICSR_ARB_HIGH;
BUA(sc->uh_uba)->bn_vor = (int)sc->uh_iarea - (int)&scb[0]; BUA(sc->uh_uba)->bn_vor = VAX_NBPG + (VAX_NBPG * allocvec++);
uba_attach(sc, BUA(sc->uh_uba)->bn_biic.bi_sadr + UBAPAGES * VAX_NBPG); uba_attach(sc, BUA(sc->uh_uba)->bn_biic.bi_sadr + UBAPAGES * VAX_NBPG);
} }

View File

@ -1,4 +1,4 @@
# $NetBSD: files.vax,v 1.44 1998/11/29 14:31:53 ragge Exp $ # $NetBSD: files.vax,v 1.45 1999/01/19 21:04:47 ragge Exp $
# #
# new style config file for vax architecture # new style config file for vax architecture
# #
@ -327,6 +327,7 @@ file arch/vax/vax/ka43.c vax43
file arch/vax/vax/ka46.c vax46 file arch/vax/vax/ka46.c vax46
file arch/vax/vax/emulate.s vax630|vax650|vax410 file arch/vax/vax/emulate.s vax630|vax650|vax410
file arch/vax/vax/ka650.c vax650 file arch/vax/vax/ka650.c vax650
file arch/vax/vax/scb.c
file arch/vax/vax/conf.c file arch/vax/vax/conf.c
file arch/vax/vax/urem.s file arch/vax/vax/urem.s
file arch/vax/vax/udiv.s file arch/vax/vax/udiv.s

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.32 1998/10/27 21:18:53 matt Exp $ */ /* $NetBSD: cpu.h,v 1.33 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@ -57,7 +57,8 @@ struct cpu_dep {
void (*cpu_conf) __P((struct device *, struct device *, void *)); void (*cpu_conf) __P((struct device *, struct device *, void *));
int (*cpu_clkread) __P((time_t)); /* Read cpu clock time */ int (*cpu_clkread) __P((time_t)); /* Read cpu clock time */
void (*cpu_clkwrite) __P((void)); /* Write system time to cpu */ void (*cpu_clkwrite) __P((void)); /* Write system time to cpu */
int cpu_vups; /* speed of cpu */ short cpu_vups; /* speed of cpu */
short cpu_scbsz; /* (estimated) size of system control block */
void (*cpu_halt) __P((void)); /* Cpu dependent halt call */ void (*cpu_halt) __P((void)); /* Cpu dependent halt call */
void (*cpu_reboot) __P((int)); /* Cpu dependent reboot call */ void (*cpu_reboot) __P((int)); /* Cpu dependent reboot call */
void (*cpu_clrf) __P((void)); /* Clear cold/warm start flags */ void (*cpu_clrf) __P((void)); /* Clear cold/warm start flags */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka820.h,v 1.1 1996/07/20 17:33:09 ragge Exp $ */ /* $NetBSD: ka820.h,v 1.2 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -90,6 +90,9 @@
#define KA820PORT_CRDCLR 0x00000002 /* clear CRD interrupt */ #define KA820PORT_CRDCLR 0x00000002 /* clear CRD interrupt */
#define KA820PORT_CRDINTR 0x00000001 /* CRD interrupt request */ #define KA820PORT_CRDINTR 0x00000001 /* CRD interrupt request */
/* interrupt vectors unique for this CPU */
#define KA820_INT_RXCD 0x58
/* what the heck */ /* what the heck */
#define KA820PORT_BITS \ #define KA820PORT_BITS \
"\20\40RSTHALT\37LCONS\36LCONSEN\35BIRESET\34BISTF\33ENBAPT\32STPASS\31RUN\ "\20\40RSTHALT\37LCONS\36LCONSEN\35BIRESET\34BISTF\33ENBAPT\32STPASS\31RUN\

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.34 1999/01/01 21:43:18 ragge Exp $ */ /* $NetBSD: param.h,v 1.35 1999/01/19 21:04:48 ragge Exp $ */
/*- /*-
* Copyright (c) 1990 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -160,7 +160,7 @@
* For now though just use DEV_BSIZE. * For now though just use DEV_BSIZE.
*/ */
// #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) #define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
#ifdef _KERNEL #ifdef _KERNEL
#ifndef lint #ifndef lint

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.30 1999/01/01 21:43:18 ragge Exp $ */ /* $NetBSD: pmap.h,v 1.31 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1987 Carnegie-Mellon University * Copyright (c) 1987 Carnegie-Mellon University
@ -129,7 +129,7 @@ extern struct pmap kernel_pmap_store;
/* Prototypes */ /* Prototypes */
void pmap_bootstrap __P((void)); void pmap_bootstrap __P((void));
vm_offset_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int)); vaddr_t pmap_map __P((vm_offset_t, vm_offset_t, vm_offset_t, int));
void pmap_pinit __P((pmap_t)); void pmap_pinit __P((pmap_t));
#endif PMAP_H #endif PMAP_H

View File

@ -1,4 +1,4 @@
/* $NetBSD: scb.h,v 1.4 1995/12/13 18:54:56 ragge Exp $ */ /* $NetBSD: scb.h,v 1.5 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -103,6 +103,14 @@ struct scb {
struct ivec_dsp *scb_nexvec[4][16]; /* Nexus interrupt vectors */ struct ivec_dsp *scb_nexvec[4][16]; /* Nexus interrupt vectors */
}; };
#define SCB_KSTACK 0
#define SCB_ISTACK 1
#ifdef _KERNEL #ifdef _KERNEL
extern struct scb *scb; extern struct scb *scb;
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(*)(int), int, int));
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: dhu.c,v 1.12 1998/04/13 12:14:42 ragge Exp $ */ /* $NetBSD: dhu.c,v 1.13 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -51,9 +51,9 @@
#include <sys/device.h> #include <sys/device.h>
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/scb.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
#include <vax/uba/dhureg.h> #include <vax/uba/dhureg.h>
/* A DHU-11 has 16 ports while a DHV-11 has only 8. We use 16 by default */ /* A DHU-11 has 16 ports while a DHV-11 has only 8. We use 16 by default */
@ -224,9 +224,7 @@ dhu_attach(parent, self, aux)
sc->sc_type = (c & DHU_STAT_DHU)? IS_DHU: IS_DHV; sc->sc_type = (c & DHU_STAT_DHU)? IS_DHU: IS_DHV;
/* Now stuff TX interrupt handler in place */ /* Now stuff TX interrupt handler in place */
scb_vecalloc(ua->ua_cvec + 4, dhuxint, self->dv_unit, SCB_ISTACK);
ubasetvec(self, ua->ua_cvec + 1, dhuxint);
return;
} }
/* Receiver Interrupt */ /* Receiver Interrupt */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.c,v 1.5 1998/04/13 12:14:42 ragge Exp $ */ /* $NetBSD: dl.c,v 1.6 1999/01/19 21:04:48 ragge Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -96,6 +96,7 @@
#include <machine/pte.h> #include <machine/pte.h>
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/scb.h>
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
@ -217,10 +218,9 @@ dl_attach (parent, self, aux)
tty_attach(sc->sc_tty); tty_attach(sc->sc_tty);
/* Now register the RX interrupt handler */ /* Now register the RX interrupt handler */
ubasetvec(self, ua->ua_cvec-1, dlrint); scb_vecalloc(ua->ua_cvec - 4, dlrint, self->dv_unit, SCB_ISTACK);
printf("\n"); printf("\n");
return;
} }
/* Receiver Interrupt Handler */ /* Receiver Interrupt Handler */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dz_uba.c,v 1.1 1998/05/17 18:51:13 ragge Exp $ */ /* $NetBSD: dz_uba.c,v 1.2 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved. * Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@ -46,6 +46,7 @@
#include <machine/pte.h> #include <machine/pte.h>
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/scb.h>
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
@ -136,7 +137,7 @@ dz_uba_attach(parent, self, aux)
sc->sc_type = DZ_DZ; sc->sc_type = DZ_DZ;
/* Now register the RX interrupt handler */ /* Now register the RX interrupt handler */
ubasetvec(self, ua->ua_cvec-1, dzrint); scb_vecalloc(ua->ua_cvec - 4, dzrint, self->dv_unit, SCB_ISTACK);
dzattach(sc); dzattach(sc);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: qd.c,v 1.11 1999/01/01 21:43:18 ragge Exp $ */ /* $NetBSD: qd.c,v 1.12 1999/01/19 21:04:48 ragge Exp $ */
/*- /*-
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
@ -68,34 +68,28 @@
#include "qd.h" #include "qd.h"
#if NQD > 0 #if NQD > 0
#include <sys/types.h>
#include <machine/pte.h>
#include <machine/mtpr.h>
#include <sys/param.h> #include <sys/param.h>
#include <machine/cpu.h> #include <sys/systm.h>
#include <sys/conf.h> #include <sys/conf.h>
#include <sys/user.h>
#include <machine/qdioctl.h>
#include <sys/tty.h> #include <sys/tty.h>
#include <sys/map.h>
#include <sys/buf.h>
#include <vm/vm.h>
#include <sys/clist.h>
#include <sys/file.h>
#include <sys/uio.h>
#include <sys/kernel.h> #include <sys/kernel.h>
#include <sys/exec.h>
#include <sys/proc.h>
#include <sys/device.h> #include <sys/device.h>
#include <vax/uba/ubareg.h> #include <sys/poll.h>
#include <vax/uba/ubavar.h>
#include <sys/syslog.h> #include <vm/vm.h>
#include <dev/cons.h>
#include <machine/pte.h>
#include <machine/cpu.h>
#include <machine/qdioctl.h>
#include <machine/qduser.h> /* definitions shared with user level client */ #include <machine/qduser.h> /* definitions shared with user level client */
#include <machine/qdreg.h> /* QDSS device register structures */ #include <machine/qdreg.h> /* QDSS device register structures */
#include <sys/poll.h>
#include <dev/cons.h>
#include <machine/sid.h> #include <machine/sid.h>
#include <sys/systm.h> #include <machine/scb.h>
#include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h>
#include "ioconf.h" #include "ioconf.h"
@ -727,9 +721,9 @@ void qd_attach(parent, self, aux)
unit = self->dv_unit; /* get QDSS number */ unit = self->dv_unit; /* get QDSS number */
/* Grab the other two interrupt vectors */ /* Grab the other two interrupt vectors */
ubasetvec(self, ua->ua_cvec + 1, qdaint); scb_vecalloc(ua->ua_cvec + 4, qdaint, self->dv_unit, SCB_ISTACK);
ubasetvec(self, ua->ua_cvec + 2, qdiint); scb_vecalloc(ua->ua_cvec + 8, qdiint, self->dv_unit, SCB_ISTACK);
/* /*
* init "qdflags[]" for this QDSS * init "qdflags[]" for this QDSS
*/ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba.c,v 1.39 1999/01/01 21:43:18 ragge Exp $ */ /* $NetBSD: uba.c,v 1.40 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -66,11 +66,13 @@
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
volatile int rbr, rcvec, svec; volatile int /* rbr, rcvec,*/ svec;
static int ubasearch __P((struct device *, struct cfdata *, void *)); static int ubasearch __P((struct device *, struct cfdata *, void *));
static int ubaprint __P((void *, const char *)); static int ubaprint __P((void *, const char *));
#if 0
static void ubastray __P((int)); static void ubastray __P((int));
#endif
static void ubainitmaps __P((struct uba_softc *)); static void ubainitmaps __P((struct uba_softc *));
extern struct cfdriver uba_cd; extern struct cfdriver uba_cd;
@ -130,6 +132,7 @@ dw780_attach(parent, self, aux)
struct uba_softc *sc = (void *)self; struct uba_softc *sc = (void *)self;
struct sbi_attach_args *sa = aux; struct sbi_attach_args *sa = aux;
int ubaddr = sa->type & 3; int ubaddr = sa->type & 3;
int i;
printf(": DW780\n"); printf(": DW780\n");
@ -146,15 +149,12 @@ dw780_attach(parent, self, aux)
sc->uh_ubainit = dw780_init; sc->uh_ubainit = dw780_init;
sc->uh_type = DW780; sc->uh_type = DW780;
sc->uh_memsize = UBAPAGES; sc->uh_memsize = UBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG + ubaddr * VAX_NBPG; sc->uh_ibase = VAX_NBPG + ubaddr * VAX_NBPG;
sc->uh_mr = sc->uh_uba->uba_map; sc->uh_mr = sc->uh_uba->uba_map;
bcopy(&idsptch, &sc->uh_dw780, sizeof(struct ivec_dsp)); for (i = 0; i < 4; i++)
sc->uh_dw780.pushlarg = sc->uh_dev.dv_unit; scb_vecalloc(256 + i * 64 + sa->nexnum * 4, uba_dw780int,
sc->uh_dw780.hoppaddr = uba_dw780int; sc->uh_dev.dv_unit, SCB_ISTACK);
scb->scb_nexvec[0][sa->nexnum] = scb->scb_nexvec[1][sa->nexnum]
= scb->scb_nexvec[2][sa->nexnum]
= scb->scb_nexvec[3][sa->nexnum] = &sc->uh_dw780;
uba_attach(sc, (parent->dv_unit ? UMEMB8600(ubaddr) : uba_attach(sc, (parent->dv_unit ? UMEMB8600(ubaddr) :
UMEMA8600(ubaddr)) + (UBAPAGES * VAX_NBPG)); UMEMA8600(ubaddr)) + (UBAPAGES * VAX_NBPG));
@ -206,18 +206,20 @@ uba_dw780int(uba)
void (*func) __P((int)); void (*func) __P((int));
br = mfpr(PR_IPL); br = mfpr(PR_IPL);
svec = ur->uba_brrvr[br - 0x14]; vec = ur->uba_brrvr[br - 0x14];
if (svec <= 0) { if (vec <= 0) {
ubaerror(sc, &br, (int *)&svec); ubaerror(sc, &br, (int *)&vec);
if (svec == 0) if (svec == 0)
return; return;
} }
vec = svec >> 2;
if (cold) if (cold)
rcvec = vec; scb_fake(vec + sc->uh_ibase, br);
func = sc->uh_idsp[vec].hoppaddr; else {
arg = sc->uh_idsp[vec].pushlarg; struct ivec_dsp *scb_vec = (void *)scb + 512;
(*func)(arg); func = scb_vec[vec/4].hoppaddr;
arg = scb_vec[vec/4].pushlarg;
(*func)(arg);
}
} }
void void
@ -347,7 +349,6 @@ dw750_attach(parent, self, aux)
sc->uh_ubainit = dw750_init; sc->uh_ubainit = dw750_init;
sc->uh_type = DW750; sc->uh_type = DW750;
sc->uh_memsize = UBAPAGES; sc->uh_memsize = UBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG + ubaddr * VAX_NBPG;
sc->uh_mr = sc->uh_uba->uba_map; sc->uh_mr = sc->uh_uba->uba_map;
uba_attach(sc, UMEM750(ubaddr) + (UBAPAGES * VAX_NBPG)); uba_attach(sc, UMEM750(ubaddr) + (UBAPAGES * VAX_NBPG));
@ -424,7 +425,6 @@ qba_attach(parent, self, aux)
sc->uh_ubainit = qba_init; sc->uh_ubainit = qba_init;
sc->uh_type = QBA; sc->uh_type = QBA;
sc->uh_memsize = QBAPAGES; sc->uh_memsize = QBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG;
/* /*
* Map in the UBA page map into kernel space. On other UBAs, * Map in the UBA page map into kernel space. On other UBAs,
* the map registers are in the bus IO space. * the map registers are in the bus IO space.
@ -468,6 +468,7 @@ struct cfattach uba_dw730_ca = {
sizeof(struct uba_softc), dw730_match, dw730_attach sizeof(struct uba_softc), dw730_match, dw730_attach
}; };
#endif #endif
#if 0
/* /*
* Stray interrupt vector handler, used when nowhere else to go to. * Stray interrupt vector handler, used when nowhere else to go to.
*/ */
@ -496,7 +497,7 @@ ubastray(arg)
printf("uba%d: unexpected interrupt, vector 0x%x, br 0x%x\n", printf("uba%d: unexpected interrupt, vector 0x%x, br 0x%x\n",
arg, svec, rbr); arg, svec, rbr);
} }
#endif
/* /*
* Do transfer on device argument. The controller * Do transfer on device argument. The controller
* and uba involved are implied by the device. * and uba involved are implied by the device.
@ -806,7 +807,6 @@ uba_attach(sc, iopagephys)
unsigned long iopagephys; unsigned long iopagephys;
{ {
vm_offset_t mini, maxi; vm_offset_t mini, maxi;
extern struct ivec_dsp idsptch;
/* /*
* Set last free interrupt vector for devices with * Set last free interrupt vector for devices with
@ -816,31 +816,6 @@ uba_attach(sc, iopagephys)
sc->uh_lastiv = 0x200; sc->uh_lastiv = 0x200;
SIMPLEQ_INIT(&sc->uh_resq); SIMPLEQ_INIT(&sc->uh_resq);
/*
* Create interrupt dispatchers for this uba.
*/
#define NO_IVEC 128
{
vm_offset_t iarea;
int i;
#if defined(UVM)
iarea = uvm_km_valloc(kernel_map,
NO_IVEC * sizeof(struct ivec_dsp));
#else
iarea = kmem_alloc(kernel_map,
NO_IVEC * sizeof(struct ivec_dsp));
#endif
sc->uh_idsp = (struct ivec_dsp *)iarea;
for (i = 0; i < NO_IVEC; i++) {
bcopy(&idsptch, &sc->uh_idsp[i],
sizeof(struct ivec_dsp));
sc->uh_idsp[i].pushlarg = sc->uh_dev.dv_unit;
sc->uh_idsp[i].hoppaddr = ubastray;
sc->uh_iarea[i] = (unsigned int)&sc->uh_idsp[i];
}
}
/* /*
* Allocate place for unibus memory in virtual space. * Allocate place for unibus memory in virtual space.
* This is done with kmem_suballoc() but after that * This is done with kmem_suballoc() but after that
@ -889,7 +864,7 @@ ubasearch(parent, cf, aux)
{ {
struct uba_softc *sc = (struct uba_softc *)parent; struct uba_softc *sc = (struct uba_softc *)parent;
struct uba_attach_args ua; struct uba_attach_args ua;
int i; int i, vec, br;
ua.ua_addr = (caddr_t)((int)sc->uh_iopage + ubdevreg(cf->cf_loc[0])); ua.ua_addr = (caddr_t)((int)sc->uh_iopage + ubdevreg(cf->cf_loc[0]));
ua.ua_reset = NULL; ua.ua_reset = NULL;
@ -897,7 +872,7 @@ ubasearch(parent, cf, aux)
if (badaddr(ua.ua_addr, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0)) if (badaddr(ua.ua_addr, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0))
goto forgetit; goto forgetit;
rcvec = 0x200; scb_vecref(0, 0); /* Clear vector ref */
i = (*cf->cf_attach->ca_match) (parent, cf, &ua); i = (*cf->cf_attach->ca_match) (parent, cf, &ua);
if (sc->uh_errchk) if (sc->uh_errchk)
@ -906,11 +881,13 @@ ubasearch(parent, cf, aux)
if (i == 0) if (i == 0)
goto forgetit; goto forgetit;
if (rcvec == 0 || rcvec == 0x200) i = scb_vecref(&vec, &br);
if (i == 0)
goto fail;
if (vec == 0)
goto fail; goto fail;
sc->uh_idsp[rcvec].hoppaddr = ua.ua_ivec; scb_vecalloc(vec, ua.ua_ivec, cf->cf_unit, SCB_ISTACK);
sc->uh_idsp[rcvec].pushlarg = cf->cf_unit;
if (ua.ua_reset) { /* device wants ubareset */ if (ua.ua_reset) { /* device wants ubareset */
if (sc->uh_resno == 0) { if (sc->uh_resno == 0) {
sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT); sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT);
@ -928,39 +905,22 @@ ubasearch(parent, cf, aux)
sc->uh_reset[sc->uh_resno++] = ua.ua_reset; sc->uh_reset[sc->uh_resno++] = ua.ua_reset;
} }
} }
ua.ua_br = rbr; ua.ua_br = br;
ua.ua_cvec = rcvec; ua.ua_cvec = vec;
ua.ua_iaddr = cf->cf_loc[0]; ua.ua_iaddr = cf->cf_loc[0];
config_attach(parent, cf, &ua, ubaprint); config_attach(parent, cf, &ua, ubaprint);
return 0; return 0;
fail: fail:
printf("%s%d at %s csr %o %s\n", cf->cf_driver->cd_name, cf->cf_unit, printf("%s%d at %s csr %o %s\n",
parent->dv_xname, cf->cf_loc[0], cf->cf_driver->cd_name, cf->cf_unit, parent->dv_xname,
rcvec ? "didn't interrupt\n" : "zero vector\n"); cf->cf_loc[0], (i ? "zero vector" : "didn't interrupt"));
forgetit: forgetit:
return 0; return 0;
} }
/*
* Called when a device needs more than one interrupt vector.
* (Like DHU11, DMF32). Argument is the device's softc, vector
* number and a function pointer to the interrupt catcher.
*/
void
ubasetvec(dev, vec, func)
struct device *dev;
int vec;
void (*func) __P((int));
{
struct uba_softc *sc = (void *)dev->dv_parent;
sc->uh_idsp[vec].hoppaddr = func;
sc->uh_idsp[vec].pushlarg = dev->dv_unit;
}
/* /*
* Print out some interesting info common to all unibus devices. * Print out some interesting info common to all unibus devices.
*/ */
@ -972,6 +932,6 @@ ubaprint(aux, uba)
struct uba_attach_args *ua = aux; struct uba_attach_args *ua = aux;
printf(" csr %o vec %o ipl %x", ua->ua_iaddr, printf(" csr %o vec %o ipl %x", ua->ua_iaddr,
ua->ua_cvec << 2, ua->ua_br); ua->ua_cvec & 511, ua->ua_br);
return UNCONF; return UNCONF;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ubavar.h,v 1.20 1998/10/18 18:51:30 ragge Exp $ */ /* $NetBSD: ubavar.h,v 1.21 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1982, 1986 Regents of the University of California. * Copyright (c) 1982, 1986 Regents of the University of California.
@ -80,8 +80,6 @@ struct uba_softc {
void (**uh_reset) __P((int));/* UBA reset function array */ void (**uh_reset) __P((int));/* UBA reset function array */
int *uh_resarg; /* array of ubareset args */ int *uh_resarg; /* array of ubareset args */
int uh_resno; /* Number of devices to reset */ int uh_resno; /* Number of devices to reset */
struct ivec_dsp *uh_idsp; /* Interrupt dispatch area */
u_int *uh_iarea; /* Interrupt vector array */
short uh_mrwant; /* someone is waiting for map reg */ short uh_mrwant; /* someone is waiting for map reg */
short uh_bdpwant; /* someone awaits bdp's */ short uh_bdpwant; /* someone awaits bdp's */
int uh_bdpfree; /* free bdp's */ int uh_bdpfree; /* free bdp's */
@ -98,11 +96,9 @@ struct uba_softc {
void (*uh_afterscan) __P((struct uba_softc *)); void (*uh_afterscan) __P((struct uba_softc *));
void (*uh_ubainit) __P((struct uba_softc *)); void (*uh_ubainit) __P((struct uba_softc *));
void (*uh_ubapurge) __P((struct uba_softc *, int)); void (*uh_ubapurge) __P((struct uba_softc *, int));
#ifdef DW780
struct ivec_dsp uh_dw780; /* Interrupt handles for DW780 */
#endif
short uh_nr; /* Unibus sequential number */ short uh_nr; /* Unibus sequential number */
short uh_nbdp; /* # of BDP's */ short uh_nbdp; /* # of BDP's */
int uh_ibase; /* Base address for vectors */
}; };
#define UAMSIZ 100 #define UAMSIZ 100
@ -177,7 +173,6 @@ struct ubinfo {
#define b_forw b_hash.le_next /* Nice to have when handling uba queues */ #define b_forw b_hash.le_next /* Nice to have when handling uba queues */
void uba_attach __P((struct uba_softc *, unsigned long)); void uba_attach __P((struct uba_softc *, unsigned long));
void ubasetvec __P((struct device *, int, void (*) __P((int))));
int uballoc __P((struct uba_softc *, caddr_t, int, int)); int uballoc __P((struct uba_softc *, caddr_t, int, int));
void ubarelse __P((struct uba_softc *, int *)); void ubarelse __P((struct uba_softc *, int *));
int ubaqueue __P((struct uba_unit *, struct buf *)); int ubaqueue __P((struct uba_unit *, struct buf *));

View File

@ -1,4 +1,4 @@
/* $Id: crx.c,v 1.1 1998/11/07 20:58:09 ragge Exp $ */ /* $Id: crx.c,v 1.2 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -236,9 +236,10 @@ crxrw(dev, uio, flags)
return (error); return (error);
} }
void crxintr __P((void)); void crxintr __P((int));
void void
crxintr() crxintr(arg)
int arg;
{ {
register struct rx50state *rs = &rx50state; register struct rx50state *rs = &rx50state;

View File

@ -1,4 +1,4 @@
/* $NetBSD: crx.h,v 1.1 1998/11/07 20:58:09 ragge Exp $ */ /* $NetBSD: crx.h,v 1.2 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -63,6 +63,9 @@ struct rx50device {
#define RX50SEC 10 /* sectors per track */ #define RX50SEC 10 /* sectors per track */
#define RX50MAXSEC 800 /* 10 sectors times 80 tracks */ #define RX50MAXSEC 800 /* 10 sectors times 80 tracks */
/* Interrupt vector */
#define SCB_RX50 0xf0
/* /*
* Do the sector skew given the sector and track * Do the sector skew given the sector and track
* number (it depends on both!). * number (it depends on both!).

View File

@ -1,4 +1,4 @@
/* $NetBSD: gencons.c,v 1.19 1998/08/31 18:43:30 ragge Exp $ */ /* $NetBSD: gencons.c,v 1.20 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1994 Gordon W. Ross * Copyright (c) 1994 Gordon W. Ross
@ -52,6 +52,7 @@
#include <machine/mtpr.h> #include <machine/mtpr.h>
#include <machine/sid.h> #include <machine/sid.h>
#include <machine/cpu.h> #include <machine/cpu.h>
#include <machine/scb.h>
#include <machine/../vax/gencons.h> #include <machine/../vax/gencons.h>
static struct tty *gencn_tty[4]; static struct tty *gencn_tty[4];
@ -271,7 +272,6 @@ gencnprobe(cndev)
(vax_boardtype == VAX_BTYP_650)) { (vax_boardtype == VAX_BTYP_650)) {
cndev->cn_dev = makedev(25, 0); cndev->cn_dev = makedev(25, 0);
cndev->cn_pri = CN_NORMAL; cndev->cn_pri = CN_NORMAL;
maxttys = (vax_cputype == VAX_TYP_8SS ? 4 : 1);
} else } else
cndev->cn_pri = CN_DEAD; cndev->cn_pri = CN_DEAD;
} }
@ -280,6 +280,19 @@ void
gencninit(cndev) gencninit(cndev)
struct consdev *cndev; struct consdev *cndev;
{ {
/* Allocate interrupt vectors */
scb_vecalloc(SCB_G0R, gencnrint, 0, SCB_ISTACK);
scb_vecalloc(SCB_G0T, gencntint, 0, SCB_ISTACK);
if (vax_cputype == VAX_TYP_8SS) {
maxttys = 4;
scb_vecalloc(SCB_G1R, gencnrint, 1, SCB_ISTACK);
scb_vecalloc(SCB_G1T, gencntint, 1, SCB_ISTACK);
scb_vecalloc(SCB_G2R, gencnrint, 2, SCB_ISTACK);
scb_vecalloc(SCB_G2T, gencntint, 2, SCB_ISTACK);
scb_vecalloc(SCB_G3R, gencnrint, 3, SCB_ISTACK);
scb_vecalloc(SCB_G3T, gencntint, 3, SCB_ISTACK);
}
mtpr(0, PR_TBIA); /* ??? */
} }
void void

View File

@ -1,4 +1,4 @@
/* $NetBSD: gencons.h,v 1.6 1997/11/02 14:07:13 ragge Exp $ */ /* $NetBSD: gencons.h,v 1.7 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -60,5 +60,15 @@
#define GC_CWFL 0x3 /* clear warm start flag */ #define GC_CWFL 0x3 /* clear warm start flag */
#define GC_CCFL 0x4 /* clear cold start flag */ #define GC_CCFL 0x4 /* clear cold start flag */
/* Interrupt vectors used */
#define SCB_G0R 0xf8
#define SCB_G0T 0xfc
#define SCB_G1R 0xc8
#define SCB_G1T 0xcc
#define SCB_G2R 0xd0
#define SCB_G2T 0xd4
#define SCB_G3R 0xd8
#define SCB_G3T 0xdc
/* Prototypes */ /* Prototypes */
void gencnputc __P((dev_t, int)); void gencnputc __P((dev_t, int));

View File

@ -1,4 +1,4 @@
/* $NetBSD: intvec.s,v 1.35 1998/11/07 20:58:09 ragge Exp $ */ /* $NetBSD: intvec.s,v 1.36 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1997 Ludd, University of Lule}, Sweden.
@ -64,20 +64,12 @@ ENTRY(namn) ; \
popr $0x3f ; \ popr $0x3f ; \
rei rei
#define STRAY(scbnr, vecnr) \
ENTRY(stray/**/vecnr) ; \
pushr $0x3f ; \
pushl $/**/0x/**/vecnr ; \
pushl $scbnr ; \
calls $2,_stray ; \
popr $0x3f ; \
rei
#define PUSHR pushr $0x3f #define PUSHR pushr $0x3f
#define POPR popr $0x3f #define POPR popr $0x3f
#define KSTACK 0 #define KSTACK 0
#define ISTACK 1 #define ISTACK 1
#define NOVEC .long 0
#define INTVEC(label,stack) \ #define INTVEC(label,stack) \
.long label+stack; .long label+stack;
.text .text
@ -93,14 +85,10 @@ _rpb:
* and move the SCB later to somewhere else. * and move the SCB later to somewhere else.
*/ */
#if VAX8200 NOVEC; # Unused, 0
INTVEC(stray00, ISTACK) # Passive Release, 0
#else
INTVEC(stray00, ISTACK) # Unused., 0
#endif
INTVEC(mcheck, ISTACK) # Machine Check., 4 INTVEC(mcheck, ISTACK) # Machine Check., 4
INTVEC(invkstk, ISTACK) # Kernel Stack Invalid., 8 INTVEC(invkstk, ISTACK) # Kernel Stack Invalid., 8
INTVEC(stray0C, ISTACK) # Power Failed., C NOVEC; # Power Failed., C
INTVEC(privinflt, KSTACK) # Privileged/Reserved Instruction. INTVEC(privinflt, KSTACK) # Privileged/Reserved Instruction.
INTVEC(xfcflt, KSTACK) # Customer Reserved Instruction, 14 INTVEC(xfcflt, KSTACK) # Customer Reserved Instruction, 14
INTVEC(resopflt, KSTACK) # Reserved Operand/Boot Vector(?), 18 INTVEC(resopflt, KSTACK) # Reserved Operand/Boot Vector(?), 18
@ -109,82 +97,62 @@ _rpb:
INTVEC(transl_v, KSTACK) # Translation Invalid, 24 INTVEC(transl_v, KSTACK) # Translation Invalid, 24
INTVEC(tracep, KSTACK) # Trace Pending, 28 INTVEC(tracep, KSTACK) # Trace Pending, 28
INTVEC(breakp, KSTACK) # Breakpoint Instruction, 2C INTVEC(breakp, KSTACK) # Breakpoint Instruction, 2C
INTVEC(stray30, ISTACK) # Compatibility Exception, 30 NOVEC; # Compatibility Exception, 30
INTVEC(arithflt, KSTACK) # Arithmetic Fault, 34 INTVEC(arithflt, KSTACK) # Arithmetic Fault, 34
INTVEC(stray38, ISTACK) # Unused, 38 NOVEC; # Unused, 38
INTVEC(stray3C, ISTACK) # Unused, 3C NOVEC; # Unused, 3C
INTVEC(syscall, KSTACK) # main syscall trap, chmk, 40 INTVEC(syscall, KSTACK) # main syscall trap, chmk, 40
INTVEC(resopflt, KSTACK) # chme, 44 INTVEC(resopflt, KSTACK) # chme, 44
INTVEC(resopflt, KSTACK) # chms, 48 INTVEC(resopflt, KSTACK) # chms, 48
INTVEC(resopflt, KSTACK) # chmu, 4C INTVEC(resopflt, KSTACK) # chmu, 4C
INTVEC(sbiexc, ISTACK) # System Backplane Exception/BIerror, 50 NOVEC; # System Backplane Exception/BIerror, 50
INTVEC(cmrerr, ISTACK) # Corrected Memory Read, 54 INTVEC(cmrerr, ISTACK) # Corrected Memory Read, 54
INTVEC(rxcs, ISTACK) # System Backplane Alert/RXCD, 58 NOVEC; # System Backplane Alert/RXCD, 58
INTVEC(sbiflt, ISTACK) # System Backplane Fault, 5C INTVEC(sbiflt, ISTACK) # System Backplane Fault, 5C
INTVEC(stray60, ISTACK) # Memory Write Timeout, 60 NOVEC; # Memory Write Timeout, 60
INTVEC(stray64, ISTACK) # Unused, 64 NOVEC; # Unused, 64
INTVEC(stray68, ISTACK) # Unused, 68 NOVEC; # Unused, 68
INTVEC(stray6C, ISTACK) # Unused, 6C NOVEC; # Unused, 6C
INTVEC(stray70, ISTACK) # Unused, 70 NOVEC; # Unused, 70
INTVEC(stray74, ISTACK) # Unused, 74 NOVEC; # Unused, 74
INTVEC(stray78, ISTACK) # Unused, 78 NOVEC; # Unused, 78
INTVEC(stray7C, ISTACK) # Unused, 7C NOVEC; # Unused, 7C
INTVEC(stray80, ISTACK) # Unused, 80 NOVEC; # Unused, 80
INTVEC(stray84, ISTACK) # Unused, 84 NOVEC; # Unused, 84
INTVEC(astintr, KSTACK) # Asynchronous Sustem Trap, AST INTVEC(astintr, KSTACK) # Asynchronous Sustem Trap, AST
INTVEC(stray8C, ISTACK) # Unused, 8C NOVEC; # Unused, 8C
INTVEC(stray90, ISTACK) # Unused, 90 NOVEC; # Unused, 90
INTVEC(stray94, ISTACK) # Unused, 94 NOVEC; # Unused, 94
INTVEC(stray98, ISTACK) # Unused, 98 NOVEC; # Unused, 98
INTVEC(stray9C, ISTACK) # Unused, 9C NOVEC; # Unused, 9C
INTVEC(softclock,ISTACK) # Software clock interrupt INTVEC(softclock,ISTACK) # Software clock interrupt
INTVEC(strayA4, ISTACK) # Unused, A4 NOVEC; # Unused, A4
INTVEC(strayA8, ISTACK) # Unused, A8 NOVEC; # Unused, A8
INTVEC(strayAC, ISTACK) # Unused, AC NOVEC; # Unused, AC
INTVEC(netint, ISTACK) # Network interrupt INTVEC(netint, ISTACK) # Network interrupt
INTVEC(strayB4, ISTACK) # Unused, B4 NOVEC; # Unused, B4
INTVEC(strayB8, ISTACK) # Unused, B8 NOVEC; # Unused, B8
INTVEC(ddbtrap, ISTACK) # Kernel debugger trap, BC INTVEC(ddbtrap, ISTACK) # Kernel debugger trap, BC
INTVEC(hardclock,ISTACK) # Interval Timer INTVEC(hardclock,ISTACK) # Interval Timer
INTVEC(strayC4, ISTACK) # Unused, C4 NOVEC; # Unused, C4
#if VAX8200 INTVEC(emulate, KSTACK) # Subset instruction emulation, C8
INTVEC(slu1rintr, ISTACK) # Serial Unit 1 Receive Interrupt NOVEC; # Unused, CC
INTVEC(slu1tintr, ISTACK) # Serial Unit 1 Transmit Interrupt NOVEC; # Unused, D0
INTVEC(slu2rintr, ISTACK) # Serial Unit 2 Receive Interrupt NOVEC; # Unused, D4
INTVEC(slu2tintr, ISTACK) # Serial Unit 2 Transmit Interrupt NOVEC; # Unused, D8
INTVEC(slu3rintr, ISTACK) # Serial Unit 3 Receive Interrupt NOVEC; # Unused, DC
INTVEC(slu3tintr, ISTACK) # Serial Unit 3 Transmit Interrupt NOVEC; # Unused, E0
#else NOVEC; # Unused, E4
INTVEC(emulate, KSTACK) # Subset instruction emulation NOVEC; # Unused, E8
INTVEC(strayCC, ISTACK) # Unused, CC NOVEC; # Unused, EC
INTVEC(strayD0, ISTACK) # Unused, D0 NOVEC;
INTVEC(strayD4, ISTACK) # Unused, D4 NOVEC;
INTVEC(strayD8, ISTACK) # Unused, D8 NOVEC;
INTVEC(strayDC, ISTACK) # Unused, DC NOVEC;
#endif
INTVEC(strayE0, ISTACK) # Unused, E0
INTVEC(strayE4, ISTACK) # Unused, E4
INTVEC(strayE8, ISTACK) # Unused, E8
INTVEC(strayEC, ISTACK) # Unused, EC
#if VAX8200
INTVEC(crx50int, ISTACK) # Console storage on VAX 8200 (RX50)
#else
INTVEC(strayF0, ISTACK)
#endif
INTVEC(strayF4, ISTACK)
#if VAX8600 || VAX8200 || VAX750 || VAX780 || VAX630 || VAX650
INTVEC(consrint, ISTACK) # Console Terminal Recieve Interrupt
INTVEC(constint, ISTACK) # Console Terminal Transmit Interrupt
#else
INTVEC(strayF8, ISTACK)
INTVEC(strayFC, ISTACK)
#endif
/* space for adapter vectors */ /* space for adapter vectors */
.space 0x100 .space 0x100
STRAY(0,00)
.align 2 .align 2
# #
# mcheck is the badaddress trap, also called when referencing # mcheck is the badaddress trap, also called when referencing
@ -229,7 +197,6 @@ L4: addl2 (sp)+,sp # remove info pushed on stack
rei rei
TRAPCALL(invkstk, T_KSPNOTVAL) TRAPCALL(invkstk, T_KSPNOTVAL)
STRAY(0,0C)
TRAPCALL(privinflt, T_PRIVINFLT) TRAPCALL(privinflt, T_PRIVINFLT)
TRAPCALL(xfcflt, T_XFCFLT); TRAPCALL(xfcflt, T_XFCFLT);
@ -303,13 +270,9 @@ ptelen: movl $T_PTELEN, (sp) # PTE must expand (or send segv)
TRAPCALL(tracep, T_TRCTRAP) TRAPCALL(tracep, T_TRCTRAP)
TRAPCALL(breakp, T_BPTFLT) TRAPCALL(breakp, T_BPTFLT)
STRAY(0,30)
TRAPARGC(arithflt, T_ARITHFLT) TRAPARGC(arithflt, T_ARITHFLT)
STRAY(0,38)
STRAY(0,3C)
ENTRY(syscall) # Main system call ENTRY(syscall) # Main system call
pushl $T_SYSCALL pushl $T_SYSCALL
pushr $0xfff pushr $0xfff
@ -326,19 +289,6 @@ ENTRY(syscall) # Main system call
mtpr $0x1f, $PR_IPL # Be sure we can REI mtpr $0x1f, $PR_IPL # Be sure we can REI
rei rei
STRAY(0,44)
STRAY(0,48)
STRAY(0,4C)
ENTRY(sbiexc)
tstl _cold /* Is it ok to get errs during boot??? */
bneq 1f
pushr $0x3f
pushl $0x50
pushl $0
calls $2,_stray
popr $0x3f
1: rei
ENTRY(cmrerr) ENTRY(cmrerr)
PUSHR PUSHR
@ -347,49 +297,14 @@ ENTRY(cmrerr)
POPR POPR
rei rei
ENTRY(rxcs); /* console interrupt from some other processor */ ENTRY(sbiflt);
pushr $0x3f
#if VAX8200
cmpl $5,_vax_cputype
bneq 1f
calls $0,_rxcdintr
brb 2f
#endif
1: pushl $0x58
pushl $0
calls $2,_stray
2: popr $0x3f
rei
ENTRY(sbiflt);
movab sbifltmsg, -(sp) movab sbifltmsg, -(sp)
calls $1, _panic calls $1, _panic
STRAY(0,60)
STRAY(0,64)
STRAY(0,68)
STRAY(0,6C)
STRAY(0,70)
STRAY(0,74)
STRAY(0,78)
STRAY(0,7C)
STRAY(0,80)
STRAY(0,84)
TRAPCALL(astintr, T_ASTFLT) TRAPCALL(astintr, T_ASTFLT)
STRAY(0,8C)
STRAY(0,90)
STRAY(0,94)
STRAY(0,98)
STRAY(0,9C)
FASTINTR(softclock,softclock) FASTINTR(softclock,softclock)
STRAY(0,A4)
STRAY(0,A8)
STRAY(0,AC)
ENTRY(netint) ENTRY(netint)
PUSHR PUSHR
#ifdef INET #ifdef INET
@ -416,8 +331,6 @@ ENTRY(netint)
POPR POPR
rei rei
STRAY(0,B4)
STRAY(0,B8)
TRAPCALL(ddbtrap, T_KDBTRAP) TRAPCALL(ddbtrap, T_KDBTRAP)
.align 2 .align 2
@ -436,72 +349,6 @@ hardclock: mtpr $0xc1,$PR_ICCS # Reset interrupt flag
popr $0x3f popr $0x3f
rei rei
STRAY(0,C4)
#if VAX8200
ENTRY(slu1rintr) # May be emulate on some machines.
cmpl _vax_cputype,$VAX_TYP_8SS
beql 1f
jmp emulate
1: pushr $0x3f
pushl $1
jbr rint
ENTRY(slu2tintr)
pushr $0x3f
pushl $2
jbr tint
ENTRY(slu3tintr)
pushr $0x3f
pushl $3
jbr tint
ENTRY(slu1tintr)
pushr $0x3f
pushl $1
jbr tint
ENTRY(slu2rintr)
pushr $0x3f
pushl $2
jbr rint
ENTRY(slu3rintr)
pushr $0x3f
pushl $3
jbr rint
#else
STRAY(0,CC)
STRAY(0,D0)
STRAY(0,D4)
STRAY(0,D8)
STRAY(0,DC)
#endif
STRAY(0,E0)
STRAY(0,E4)
STRAY(0,E8)
STRAY(0,EC)
#if VAX8200
FASTINTR(crx50int,crxintr)
#else
STRAY(0,F0)
#endif
STRAY(0,F4)
#if VAX8600 || VAX8200 || VAX750 || VAX780 || VAX630 || VAX650
ENTRY(consrint)
pushr $0x3f
pushl $0
rint: calls $1,_gencnrint
popr $0x3f
rei
ENTRY(constint)
pushr $0x3f
pushl $0
tint: calls $1,_gencntint
popr $0x3f
rei
#else
STRAY(0,F8)
STRAY(0,FC)
#endif
/* /*
* Main routine for traps; all go through this. * Main routine for traps; all go through this.
* Note that we put USP on the frame here, which sometimes should * Note that we put USP on the frame here, which sometimes should

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka410.c,v 1.14 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: ka410.c,v 1.15 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -82,6 +82,7 @@ struct cpu_dep ka410_calls = {
chip_clkread, chip_clkread,
chip_clkwrite, chip_clkwrite,
1, /* ~VUPS */ 1, /* ~VUPS */
2, /* SCB pages */
ka410_halt, ka410_halt,
ka410_reboot, ka410_reboot,
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka43.c,v 1.12 1999/01/06 14:54:45 ragge Exp $ */ /* $NetBSD: ka43.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1996 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -78,6 +78,7 @@ struct cpu_dep ka43_calls = {
chip_clkread, chip_clkread,
chip_clkwrite, chip_clkwrite,
7, /* 7.6 VUP */ 7, /* 7.6 VUP */
2, /* SCB pages */
}; };
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka46.c,v 1.3 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: ka46.c,v 1.4 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -76,6 +76,7 @@ struct cpu_dep ka46_calls = {
chip_clkread, chip_clkread,
chip_clkwrite, chip_clkwrite,
12, /* ~VUPS */ 12, /* ~VUPS */
2, /* SCB pages */
ka46_halt, ka46_halt,
ka46_reboot, ka46_reboot,
}; };

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka630.c,v 1.12 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: ka630.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */
/*- /*-
* Copyright (c) 1982, 1988, 1990, 1993 * Copyright (c) 1982, 1988, 1990, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -70,6 +70,7 @@ struct cpu_dep ka630_calls = {
chip_clkread, chip_clkread,
chip_clkwrite, chip_clkwrite,
1, /* ~VUPS */ 1, /* ~VUPS */
2, /* SCB pages */
ka630_halt, ka630_halt,
ka630_reboot, ka630_reboot,
ka630_clrf, ka630_clrf,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka650.c,v 1.15 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: ka650.c,v 1.16 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1988 The Regents of the University of California. * Copyright (c) 1988 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -80,6 +80,7 @@ struct cpu_dep ka650_calls = {
generic_clkread, generic_clkread,
generic_clkwrite, generic_clkwrite,
4, /* ~VUPS */ 4, /* ~VUPS */
2, /* SCB pages */
ka650_halt, ka650_halt,
ka650_reboot, ka650_reboot,
}; };
@ -109,16 +110,13 @@ uvaxIII_conf(parent, self, aux)
void void
uvaxIII_steal_pages() uvaxIII_steal_pages()
{ {
extern vm_offset_t avail_start, virtual_avail; extern vm_offset_t virtual_avail;
int junk, *jon;
/* /*
* MicroVAX III: We map in SCB, interrupt vectors, * MicroVAX III: We map in Qbus map registers, memory
* Qbus map registers, memory
* error registers, cache control registers, SSC registers, * error registers, cache control registers, SSC registers,
* interprocessor registers and cache diag space. * interprocessor registers and cache diag space.
*/ */
MAPPHYS(junk, 2, VM_PROT_READ|VM_PROT_WRITE); /* SCB & vectors */
MAPVIRT(nexus, vax_btoc(0x400000)); /* Qbus map registers */ MAPVIRT(nexus, vax_btoc(0x400000)); /* Qbus map registers */
pmap_map((vm_offset_t)nexus, 0x20088000, 0x20090000, pmap_map((vm_offset_t)nexus, 0x20088000, 0x20090000,
VM_PROT_READ|VM_PROT_WRITE); VM_PROT_READ|VM_PROT_WRITE);
@ -143,8 +141,7 @@ uvaxIII_steal_pages()
pmap_map((vm_offset_t)KA650_CACHE_ptr, (vm_offset_t)KA650_CACHE, pmap_map((vm_offset_t)KA650_CACHE_ptr, (vm_offset_t)KA650_CACHE,
KA650_CACHE + KA650_CACHESIZE, VM_PROT_READ|VM_PROT_WRITE); KA650_CACHE + KA650_CACHESIZE, VM_PROT_READ|VM_PROT_WRITE);
jon = (int *)0x20040004; subtyp = *(int *)0x20040004;
subtyp = *jon;
} }
void void

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka750.c,v 1.25 1998/11/29 14:48:53 ragge Exp $ */ /* $NetBSD: ka750.c,v 1.26 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -71,6 +71,7 @@ struct cpu_dep ka750_calls = {
generic_clkread, generic_clkread,
generic_clkwrite, generic_clkwrite,
1, /* ~VUPS */ 1, /* ~VUPS */
4, /* SCB pages */
0, /* halt call */ 0, /* halt call */
0, /* Reboot call */ 0, /* Reboot call */
ka750_clrf, ka750_clrf,

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka780.c,v 1.10 1998/11/29 14:48:53 ragge Exp $ */ /* $NetBSD: ka780.c,v 1.11 1999/01/19 21:04:49 ragge Exp $ */
/*- /*-
* Copyright (c) 1982, 1986, 1988 The Regents of the University of California. * Copyright (c) 1982, 1986, 1988 The Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -75,6 +75,7 @@ struct cpu_dep ka780_calls = {
generic_clkread, generic_clkread,
generic_clkwrite, generic_clkwrite,
2, /* ~VUPS */ 2, /* ~VUPS */
5, /* SCB pages */
}; };
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka820.c,v 1.12 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: ka820.c,v 1.13 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1988 Regents of the University of California. * Copyright (c) 1988 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -61,14 +61,18 @@
#include <arch/vax/bi/bireg.h> #include <arch/vax/bi/bireg.h>
#include <arch/vax/bi/bivar.h> #include <arch/vax/bi/bivar.h>
#include <vax/vax/crx.h>
#include "locators.h" #include "locators.h"
struct ka820port *ka820port_ptr; struct ka820port *ka820port_ptr;
struct rx50device *rx50device_ptr; struct rx50device *rx50device_ptr;
void *bi_nodebase; /* virtual base address for all possible bi nodes */ void *bi_nodebase; /* virtual base address for all possible bi nodes */
static int ka820_match __P((struct device *, struct cfdata *, void *)); static int ka820_match __P((struct device *, struct cfdata *, void *));
static void ka820_attach __P((struct device *, struct device *, void*)); static void ka820_attach __P((struct device *, struct device *, void*));
static void rxcdintr __P((int));
void crxintr __P((int));
struct cpu_dep ka820_calls = { struct cpu_dep ka820_calls = {
ka820_steal_pages, ka820_steal_pages,
@ -79,6 +83,7 @@ struct cpu_dep ka820_calls = {
chip_clkread, chip_clkread,
chip_clkwrite, chip_clkwrite,
3, /* ~VUPS */ 3, /* ~VUPS */
5, /* SCB pages */
}; };
struct cfattach cpu_bi_ca = { struct cfattach cpu_bi_ca = {
@ -92,27 +97,14 @@ char bootram[KA820_BRPAGES * VAX_NBPG];
char eeprom[KA820_EEPAGES * VAX_NBPG]; char eeprom[KA820_EEPAGES * VAX_NBPG];
#endif #endif
struct ivec_dsp nollhanterare;
static void hant __P((int));
static void
hant(arg)
int arg;
{
if (cold == 0)
printf("stray interrupt from vaxbi bus\n");
}
void void
ka820_steal_pages() ka820_steal_pages()
{ {
extern vm_offset_t avail_start, virtual_avail; extern vm_offset_t avail_start, virtual_avail;
extern struct ivec_dsp idsptch;
extern short *clk_page; extern short *clk_page;
extern int clk_adrshift, clk_tweak; extern int clk_adrshift, clk_tweak;
struct scb *sb; struct scb *sb;
int junk, i, j; int junk;
/* /*
* On the ka820, we map in the port CSR, the clock registers * On the ka820, we map in the port CSR, the clock registers
@ -145,12 +137,9 @@ ka820_steal_pages()
pmap_map((vm_offset_t)bi_nodebase, (vm_offset_t)BI_BASE(0,0), pmap_map((vm_offset_t)bi_nodebase, (vm_offset_t)BI_BASE(0,0),
BI_BASE(0,0) + sizeof(struct bi_node) * NNODEBI, BI_BASE(0,0) + sizeof(struct bi_node) * NNODEBI,
VM_PROT_READ|VM_PROT_WRITE); VM_PROT_READ|VM_PROT_WRITE);
bcopy(&idsptch, &nollhanterare, sizeof(struct ivec_dsp));
nollhanterare.hoppaddr = hant;
for (i = 0; i < 4; i++)
for (j = 0; j < 16; j++)
sb->scb_nexvec[i][j] = &nollhanterare;
/* Steal the interrupt vectors that are unique for us */
scb_vecalloc(KA820_INT_RXCD, rxcdintr, 0, SCB_ISTACK);
} }
int int
@ -198,6 +187,9 @@ ka820_attach(parent, self, aux)
ka820port_ptr->csr = csr; ka820port_ptr->csr = csr;
ba->ba_node->biic.bi_intrdes = ba->ba_intcpu; ba->ba_node->biic.bi_intrdes = ba->ba_intcpu;
ba->ba_node->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE; ba->ba_node->biic.bi_csr |= BICSR_SEIE | BICSR_HEIE;
/* XXX - should be done somewhere else */
scb_vecalloc(SCB_RX50, crxintr, 0, SCB_ISTACK);
} }
/* /*
@ -406,12 +398,12 @@ ka820_mchk(cmcf)
return (MCHK_PANIC); return (MCHK_PANIC);
} }
void rxcdintr __P((void));
/* /*
* Receive a character from logical console. * Receive a character from logical console.
*/ */
void void
rxcdintr() rxcdintr(arg)
int arg;
{ {
register int c = mfpr(PR_RXCD); register int c = mfpr(PR_RXCD);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ka860.c,v 1.11 1998/11/29 14:48:53 ragge Exp $ */ /* $NetBSD: ka860.c,v 1.12 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1986, 1988 Regents of the University of California. * Copyright (c) 1986, 1988 Regents of the University of California.
* All rights reserved. * All rights reserved.
@ -74,6 +74,7 @@ struct cpu_dep ka860_calls = {
generic_clkread, generic_clkread,
generic_clkwrite, generic_clkwrite,
6, /* ~VUPS */ 6, /* ~VUPS */
10, /* SCB pages */
0, /* Halt call, nothing special */ 0, /* Halt call, nothing special */
ka86_reboot, ka86_reboot,
ka86_clrf, ka86_clrf,

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.c,v 1.32 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: locore.c,v 1.33 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -95,6 +95,7 @@ start()
{ {
extern char cpu_model[]; extern char cpu_model[];
extern void *scratch; extern void *scratch;
struct pte *pt;
mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */ mtpr(AST_NO, PR_ASTLVL); /* Turn off ASTs */
@ -265,6 +266,10 @@ start()
pmap_bootstrap(); pmap_bootstrap();
/* Now running virtual. set red zone for proc0 */
pt = kvtopte((u_int)proc0.p_addr + VAX_NBPG);
pt->pg_v = 0;
((struct pcb *)proc0paddr)->framep = scratch; ((struct pcb *)proc0paddr)->framep = scratch;
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.69 1999/01/09 22:10:22 thorpej Exp $ */ /* $NetBSD: machdep.c,v 1.70 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
@ -843,3 +843,23 @@ process_sstep(p, sstep)
return (0); return (0);
} }
#ifdef notyet
/*
* Allocates a virtual range suitable for mapping in physical memory.
* This differs from the bus_space routines in that it allocates on
* physical page sizes instead of logical sizes.
*/
vaddr_t
vax_map_physmem(phys, size)
paddr_t phys;
psize_t size;
{
if (size > NBPG) { /* Need to alloc new virtual chunk */
} else {
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.56 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: pmap.c,v 1.57 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -232,25 +232,18 @@ pmap_bootstrap()
MAPVIRT(qd_ubaio, 16); MAPVIRT(qd_ubaio, 16);
#endif #endif
/* /* Init SCB and set up stray vectors. */
* We move SCB here from physical address 0 to an address avail_start = scb_init(avail_start);
* somewhere else, so that we can dynamically allocate
* space for interrupt vectors and other machine-specific
* things. We move it here, but the rest of the allocation
* is done in a cpu-specific routine.
* avail_start is modified in the cpu-specific routine.
*/
scb = (struct scb *)(avail_start + KERNBASE);
bcopy(0, (void *)avail_start, VAX_NBPG >> 1);
mtpr(avail_start, PR_SCBB);
bzero(0, VAX_NBPG >> 1); bzero(0, VAX_NBPG >> 1);
(*dep_call->cpu_steal_pages)(); (*dep_call->cpu_steal_pages)();
avail_start = ROUND_PAGE(avail_start); avail_start = ROUND_PAGE(avail_start);
virtual_avail = ROUND_PAGE(virtual_avail); virtual_avail = ROUND_PAGE(virtual_avail);
virtual_end = TRUNC_PAGE(virtual_end); virtual_end = TRUNC_PAGE(virtual_end);
#ifdef PMAPDEBUG #if defined(PMAPDEBUG)
cninit(); cninit();
printf("Sysmap %p, istack %lx, scratch %p\n",Sysmap,istack,scratch); printf("Sysmap %p, istack %lx, scratch %p\n",Sysmap,istack,scratch);
printf("etext %p\n", &etext); printf("etext %p\n", &etext);
@ -847,6 +840,35 @@ if(startpmapdebug) printf("pmap_protect: pmap %p, start %lx, end %lx, prot %x\n"
mtpr(0,PR_TBIA); mtpr(0,PR_TBIA);
} }
#ifdef NEW_REF
/*
* Called from interrupt vector routines if we get a page invalid fault.
* Note: the save mask must be or'ed with 0x3f for this function.
* Returns 0 if normal call, 1 if CVAX bug detected.
*/
int
pmap_simulref(bits, addr)
int bits, addr;
{
#ifdef DEBUG
if (bits & 1)
panic("pte trans len");
#endif
/* First decode userspace addr */
if (addr >= 0) {
if ((addr << 1) < 0)
pte = mfpr(PR_P1BR);
else
pte = mfpr(PR_P0BR);
if (bits & 2) { /* PTE reference */
#endif
/* /*
* Checks if page is referenced; returns true or false depending on result. * Checks if page is referenced; returns true or false depending on result.
*/ */
@ -873,6 +895,7 @@ pmap_is_referenced(pa)
if (pv->pv_attr & PG_V) if (pv->pv_attr & PG_V)
return 1; return 1;
#ifndef NEW_REF
if (pv->pv_pte) if (pv->pv_pte)
if ((pv->pv_pte[0].pg_v | pv->pv_pte[2].pg_v | if ((pv->pv_pte[0].pg_v | pv->pv_pte[2].pg_v |
pv->pv_pte[4].pg_v | pv->pv_pte[6].pg_v)) { pv->pv_pte[4].pg_v | pv->pv_pte[6].pg_v)) {
@ -893,6 +916,7 @@ pmap_is_referenced(pa)
} }
#ifdef PMAPDEBUG #ifdef PMAPDEBUG
if (startpmapdebug) printf("No pmap_is_referenced\n"); if (startpmapdebug) printf("No pmap_is_referenced\n");
#endif
#endif #endif
return 0; return 0;
} }

121
sys/arch/vax/vax/scb.c Normal file
View File

@ -0,0 +1,121 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <machine/trap.h>
#include <machine/scb.h>
#include <machine/frame.h>
#include <machine/cpu.h>
#include <machine/mtpr.h>
static void scb_stray __P((int));
static struct ivec_dsp *scb_vec;
static volatile int vector, ipl, gotintr;
/*
* Generates a new SCB.
*/
paddr_t
scb_init(avail_start)
paddr_t avail_start;
{
struct ivec_dsp **ivec = (struct ivec_dsp **)avail_start;
struct ivec_dsp **old = (struct ivec_dsp **)KERNBASE;
vaddr_t vavail = avail_start + KERNBASE;
int scb_size = dep_call->cpu_scbsz;
int i;
scb = (struct scb *)vavail;
scb_vec = (struct ivec_dsp *)(vavail + (scb_size * VAX_NBPG));
/* Init the whole SCB with interrupt catchers */
for (i = 0; i < (scb_size * VAX_NBPG)/4; i++) {
ivec[i] = &scb_vec[i];
memcpy(&scb_vec[i], &idsptch, sizeof(struct ivec_dsp));
scb_vec[i].hoppaddr = scb_stray;
}
/*
* Copy all pre-set interrupt vectors to the new SCB.
* It is known that these vectors is at KERNBASE from the
* beginning, and that if the vector is zero it should call
* stray instead.
*/
for (i = 0; i < 64; i++)
if (old[i])
ivec[i] = old[i];
/* Last action: set the SCB */
mtpr(avail_start, PR_SCBB);
/* Return new avail_start. Also save space for the dispatchers. */
return avail_start + (scb_size * 5) * VAX_NBPG;
};
/*
* Stray interrupt handler.
* This function must _not_ save any registers (in the reg save mask).
*/
void
scb_stray(arg)
int arg;
{
struct callsframe *cf = FRAMEOFFSET(arg);
gotintr = 1;
vector = ((cf->ca_pc - (u_int)scb_vec)/4) & ~3;
ipl = mfpr(PR_IPL);
if (cold == 0)
printf("stray interrupt: vector 0x%x, ipl %d\n", vector, ipl);
#ifdef DEBUG
else
printf("config interrupt: vector 0x%x, ipl %d\n", vector, ipl);
#endif
}
/*
* Fake interrupt handler, to fool some bus' autodetect system.
* (May I say DW780? :-)
*/
void
scb_fake(vec, br)
int vec, br;
{
vector = vec;
ipl = br;
gotintr = 1;
}
/*
* Returns last vector/ipl referenced. Clears vector/ipl after reading.
*/
int
scb_vecref(rvec, ripl)
int *rvec, *ripl;
{
if (rvec)
*rvec = vector;
if (ripl)
*ripl = ipl;
vector = ipl = 0;
return gotintr;
}
/*
* Sets a vector to the specified function.
* Arg may not be greater than 63.
*/
void
scb_vecalloc(vecno, func, arg, stack)
int vecno;
void (*func) __P((int));
int arg, stack;
{
u_int *iscb = (u_int *)scb; /* XXX */
#ifdef DIAGNOSTIC
if ((unsigned)arg > 63)
panic("scb_vecalloc: vecno 0x%x func %p arg %d",
vecno, func, arg);
#endif
scb_vec[vecno/4].pushlarg = arg;
scb_vec[vecno/4].hoppaddr = func;
iscb[vecno/4] = (u_int)(&scb_vec[vecno/4]) | stack;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.40 1999/01/01 21:43:19 ragge Exp $ */ /* $NetBSD: trap.c,v 1.41 1999/01/19 21:04:49 ragge Exp $ */
/* /*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden. * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
* All rights reserved. * All rights reserved.
@ -68,7 +68,6 @@ volatile int startsysc = 0, faultdebug = 0;
void arithflt __P((struct trapframe *)); void arithflt __P((struct trapframe *));
void syscall __P((struct trapframe *)); void syscall __P((struct trapframe *));
void stray __P((int, int));
char *traptypes[]={ char *traptypes[]={
"reserved addressing", "reserved addressing",
@ -238,6 +237,7 @@ ufault: if (rv == KERN_RESOURCE_SHORTAGE)
case T_PTELEN: case T_PTELEN:
if (p->p_addr) if (p->p_addr)
FAULTCHK; FAULTCHK;
asm("halt");
panic("ptelen fault in system space: addr %lx pc %lx", panic("ptelen fault in system space: addr %lx pc %lx",
frame->code, frame->pc); frame->code, frame->pc);
@ -438,10 +438,3 @@ bad:
ktrsysret(p->p_tracep, frame->code, err, rval[0]); ktrsysret(p->p_tracep, frame->code, err, rval[0]);
#endif #endif
} }
void
stray(scb, vec)
int scb, vec;
{
printf("stray interrupt scb %d, vec 0x%x\n", scb, vec);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: dl.c,v 1.5 1998/04/13 12:14:42 ragge Exp $ */ /* $NetBSD: dl.c,v 1.6 1999/01/19 21:04:48 ragge Exp $ */
/*- /*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -96,6 +96,7 @@
#include <machine/pte.h> #include <machine/pte.h>
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/scb.h>
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
@ -217,10 +218,9 @@ dl_attach (parent, self, aux)
tty_attach(sc->sc_tty); tty_attach(sc->sc_tty);
/* Now register the RX interrupt handler */ /* Now register the RX interrupt handler */
ubasetvec(self, ua->ua_cvec-1, dlrint); scb_vecalloc(ua->ua_cvec - 4, dlrint, self->dv_unit, SCB_ISTACK);
printf("\n"); printf("\n");
return;
} }
/* Receiver Interrupt Handler */ /* Receiver Interrupt Handler */

View File

@ -1,4 +1,4 @@
/* $NetBSD: dz_uba.c,v 1.1 1998/05/17 18:51:13 ragge Exp $ */ /* $NetBSD: dz_uba.c,v 1.2 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved. * Copyright (c) 1998 Ludd, University of Lule}, Sweden. All rights reserved.
* Copyright (c) 1996 Ken C. Wellsch. All rights reserved. * Copyright (c) 1996 Ken C. Wellsch. All rights reserved.
@ -46,6 +46,7 @@
#include <machine/pte.h> #include <machine/pte.h>
#include <machine/trap.h> #include <machine/trap.h>
#include <machine/scb.h>
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
@ -136,7 +137,7 @@ dz_uba_attach(parent, self, aux)
sc->sc_type = DZ_DZ; sc->sc_type = DZ_DZ;
/* Now register the RX interrupt handler */ /* Now register the RX interrupt handler */
ubasetvec(self, ua->ua_cvec-1, dzrint); scb_vecalloc(ua->ua_cvec - 4, dzrint, self->dv_unit, SCB_ISTACK);
dzattach(sc); dzattach(sc);
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: uba.c,v 1.39 1999/01/01 21:43:18 ragge Exp $ */ /* $NetBSD: uba.c,v 1.40 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1996 Jonathan Stone. * Copyright (c) 1996 Jonathan Stone.
* Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden. * Copyright (c) 1994, 1996 Ludd, University of Lule}, Sweden.
@ -66,11 +66,13 @@
#include <vax/uba/ubareg.h> #include <vax/uba/ubareg.h>
#include <vax/uba/ubavar.h> #include <vax/uba/ubavar.h>
volatile int rbr, rcvec, svec; volatile int /* rbr, rcvec,*/ svec;
static int ubasearch __P((struct device *, struct cfdata *, void *)); static int ubasearch __P((struct device *, struct cfdata *, void *));
static int ubaprint __P((void *, const char *)); static int ubaprint __P((void *, const char *));
#if 0
static void ubastray __P((int)); static void ubastray __P((int));
#endif
static void ubainitmaps __P((struct uba_softc *)); static void ubainitmaps __P((struct uba_softc *));
extern struct cfdriver uba_cd; extern struct cfdriver uba_cd;
@ -130,6 +132,7 @@ dw780_attach(parent, self, aux)
struct uba_softc *sc = (void *)self; struct uba_softc *sc = (void *)self;
struct sbi_attach_args *sa = aux; struct sbi_attach_args *sa = aux;
int ubaddr = sa->type & 3; int ubaddr = sa->type & 3;
int i;
printf(": DW780\n"); printf(": DW780\n");
@ -146,15 +149,12 @@ dw780_attach(parent, self, aux)
sc->uh_ubainit = dw780_init; sc->uh_ubainit = dw780_init;
sc->uh_type = DW780; sc->uh_type = DW780;
sc->uh_memsize = UBAPAGES; sc->uh_memsize = UBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG + ubaddr * VAX_NBPG; sc->uh_ibase = VAX_NBPG + ubaddr * VAX_NBPG;
sc->uh_mr = sc->uh_uba->uba_map; sc->uh_mr = sc->uh_uba->uba_map;
bcopy(&idsptch, &sc->uh_dw780, sizeof(struct ivec_dsp)); for (i = 0; i < 4; i++)
sc->uh_dw780.pushlarg = sc->uh_dev.dv_unit; scb_vecalloc(256 + i * 64 + sa->nexnum * 4, uba_dw780int,
sc->uh_dw780.hoppaddr = uba_dw780int; sc->uh_dev.dv_unit, SCB_ISTACK);
scb->scb_nexvec[0][sa->nexnum] = scb->scb_nexvec[1][sa->nexnum]
= scb->scb_nexvec[2][sa->nexnum]
= scb->scb_nexvec[3][sa->nexnum] = &sc->uh_dw780;
uba_attach(sc, (parent->dv_unit ? UMEMB8600(ubaddr) : uba_attach(sc, (parent->dv_unit ? UMEMB8600(ubaddr) :
UMEMA8600(ubaddr)) + (UBAPAGES * VAX_NBPG)); UMEMA8600(ubaddr)) + (UBAPAGES * VAX_NBPG));
@ -206,18 +206,20 @@ uba_dw780int(uba)
void (*func) __P((int)); void (*func) __P((int));
br = mfpr(PR_IPL); br = mfpr(PR_IPL);
svec = ur->uba_brrvr[br - 0x14]; vec = ur->uba_brrvr[br - 0x14];
if (svec <= 0) { if (vec <= 0) {
ubaerror(sc, &br, (int *)&svec); ubaerror(sc, &br, (int *)&vec);
if (svec == 0) if (svec == 0)
return; return;
} }
vec = svec >> 2;
if (cold) if (cold)
rcvec = vec; scb_fake(vec + sc->uh_ibase, br);
func = sc->uh_idsp[vec].hoppaddr; else {
arg = sc->uh_idsp[vec].pushlarg; struct ivec_dsp *scb_vec = (void *)scb + 512;
(*func)(arg); func = scb_vec[vec/4].hoppaddr;
arg = scb_vec[vec/4].pushlarg;
(*func)(arg);
}
} }
void void
@ -347,7 +349,6 @@ dw750_attach(parent, self, aux)
sc->uh_ubainit = dw750_init; sc->uh_ubainit = dw750_init;
sc->uh_type = DW750; sc->uh_type = DW750;
sc->uh_memsize = UBAPAGES; sc->uh_memsize = UBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG + ubaddr * VAX_NBPG;
sc->uh_mr = sc->uh_uba->uba_map; sc->uh_mr = sc->uh_uba->uba_map;
uba_attach(sc, UMEM750(ubaddr) + (UBAPAGES * VAX_NBPG)); uba_attach(sc, UMEM750(ubaddr) + (UBAPAGES * VAX_NBPG));
@ -424,7 +425,6 @@ qba_attach(parent, self, aux)
sc->uh_ubainit = qba_init; sc->uh_ubainit = qba_init;
sc->uh_type = QBA; sc->uh_type = QBA;
sc->uh_memsize = QBAPAGES; sc->uh_memsize = QBAPAGES;
sc->uh_iarea = (void *)scb + VAX_NBPG;
/* /*
* Map in the UBA page map into kernel space. On other UBAs, * Map in the UBA page map into kernel space. On other UBAs,
* the map registers are in the bus IO space. * the map registers are in the bus IO space.
@ -468,6 +468,7 @@ struct cfattach uba_dw730_ca = {
sizeof(struct uba_softc), dw730_match, dw730_attach sizeof(struct uba_softc), dw730_match, dw730_attach
}; };
#endif #endif
#if 0
/* /*
* Stray interrupt vector handler, used when nowhere else to go to. * Stray interrupt vector handler, used when nowhere else to go to.
*/ */
@ -496,7 +497,7 @@ ubastray(arg)
printf("uba%d: unexpected interrupt, vector 0x%x, br 0x%x\n", printf("uba%d: unexpected interrupt, vector 0x%x, br 0x%x\n",
arg, svec, rbr); arg, svec, rbr);
} }
#endif
/* /*
* Do transfer on device argument. The controller * Do transfer on device argument. The controller
* and uba involved are implied by the device. * and uba involved are implied by the device.
@ -806,7 +807,6 @@ uba_attach(sc, iopagephys)
unsigned long iopagephys; unsigned long iopagephys;
{ {
vm_offset_t mini, maxi; vm_offset_t mini, maxi;
extern struct ivec_dsp idsptch;
/* /*
* Set last free interrupt vector for devices with * Set last free interrupt vector for devices with
@ -816,31 +816,6 @@ uba_attach(sc, iopagephys)
sc->uh_lastiv = 0x200; sc->uh_lastiv = 0x200;
SIMPLEQ_INIT(&sc->uh_resq); SIMPLEQ_INIT(&sc->uh_resq);
/*
* Create interrupt dispatchers for this uba.
*/
#define NO_IVEC 128
{
vm_offset_t iarea;
int i;
#if defined(UVM)
iarea = uvm_km_valloc(kernel_map,
NO_IVEC * sizeof(struct ivec_dsp));
#else
iarea = kmem_alloc(kernel_map,
NO_IVEC * sizeof(struct ivec_dsp));
#endif
sc->uh_idsp = (struct ivec_dsp *)iarea;
for (i = 0; i < NO_IVEC; i++) {
bcopy(&idsptch, &sc->uh_idsp[i],
sizeof(struct ivec_dsp));
sc->uh_idsp[i].pushlarg = sc->uh_dev.dv_unit;
sc->uh_idsp[i].hoppaddr = ubastray;
sc->uh_iarea[i] = (unsigned int)&sc->uh_idsp[i];
}
}
/* /*
* Allocate place for unibus memory in virtual space. * Allocate place for unibus memory in virtual space.
* This is done with kmem_suballoc() but after that * This is done with kmem_suballoc() but after that
@ -889,7 +864,7 @@ ubasearch(parent, cf, aux)
{ {
struct uba_softc *sc = (struct uba_softc *)parent; struct uba_softc *sc = (struct uba_softc *)parent;
struct uba_attach_args ua; struct uba_attach_args ua;
int i; int i, vec, br;
ua.ua_addr = (caddr_t)((int)sc->uh_iopage + ubdevreg(cf->cf_loc[0])); ua.ua_addr = (caddr_t)((int)sc->uh_iopage + ubdevreg(cf->cf_loc[0]));
ua.ua_reset = NULL; ua.ua_reset = NULL;
@ -897,7 +872,7 @@ ubasearch(parent, cf, aux)
if (badaddr(ua.ua_addr, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0)) if (badaddr(ua.ua_addr, 2) || (sc->uh_errchk ? (*sc->uh_errchk)(sc):0))
goto forgetit; goto forgetit;
rcvec = 0x200; scb_vecref(0, 0); /* Clear vector ref */
i = (*cf->cf_attach->ca_match) (parent, cf, &ua); i = (*cf->cf_attach->ca_match) (parent, cf, &ua);
if (sc->uh_errchk) if (sc->uh_errchk)
@ -906,11 +881,13 @@ ubasearch(parent, cf, aux)
if (i == 0) if (i == 0)
goto forgetit; goto forgetit;
if (rcvec == 0 || rcvec == 0x200) i = scb_vecref(&vec, &br);
if (i == 0)
goto fail;
if (vec == 0)
goto fail; goto fail;
sc->uh_idsp[rcvec].hoppaddr = ua.ua_ivec; scb_vecalloc(vec, ua.ua_ivec, cf->cf_unit, SCB_ISTACK);
sc->uh_idsp[rcvec].pushlarg = cf->cf_unit;
if (ua.ua_reset) { /* device wants ubareset */ if (ua.ua_reset) { /* device wants ubareset */
if (sc->uh_resno == 0) { if (sc->uh_resno == 0) {
sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT); sc->uh_reset = malloc(1024, M_DEVBUF, M_NOWAIT);
@ -928,39 +905,22 @@ ubasearch(parent, cf, aux)
sc->uh_reset[sc->uh_resno++] = ua.ua_reset; sc->uh_reset[sc->uh_resno++] = ua.ua_reset;
} }
} }
ua.ua_br = rbr; ua.ua_br = br;
ua.ua_cvec = rcvec; ua.ua_cvec = vec;
ua.ua_iaddr = cf->cf_loc[0]; ua.ua_iaddr = cf->cf_loc[0];
config_attach(parent, cf, &ua, ubaprint); config_attach(parent, cf, &ua, ubaprint);
return 0; return 0;
fail: fail:
printf("%s%d at %s csr %o %s\n", cf->cf_driver->cd_name, cf->cf_unit, printf("%s%d at %s csr %o %s\n",
parent->dv_xname, cf->cf_loc[0], cf->cf_driver->cd_name, cf->cf_unit, parent->dv_xname,
rcvec ? "didn't interrupt\n" : "zero vector\n"); cf->cf_loc[0], (i ? "zero vector" : "didn't interrupt"));
forgetit: forgetit:
return 0; return 0;
} }
/*
* Called when a device needs more than one interrupt vector.
* (Like DHU11, DMF32). Argument is the device's softc, vector
* number and a function pointer to the interrupt catcher.
*/
void
ubasetvec(dev, vec, func)
struct device *dev;
int vec;
void (*func) __P((int));
{
struct uba_softc *sc = (void *)dev->dv_parent;
sc->uh_idsp[vec].hoppaddr = func;
sc->uh_idsp[vec].pushlarg = dev->dv_unit;
}
/* /*
* Print out some interesting info common to all unibus devices. * Print out some interesting info common to all unibus devices.
*/ */
@ -972,6 +932,6 @@ ubaprint(aux, uba)
struct uba_attach_args *ua = aux; struct uba_attach_args *ua = aux;
printf(" csr %o vec %o ipl %x", ua->ua_iaddr, printf(" csr %o vec %o ipl %x", ua->ua_iaddr,
ua->ua_cvec << 2, ua->ua_br); ua->ua_cvec & 511, ua->ua_br);
return UNCONF; return UNCONF;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: ubavar.h,v 1.20 1998/10/18 18:51:30 ragge Exp $ */ /* $NetBSD: ubavar.h,v 1.21 1999/01/19 21:04:48 ragge Exp $ */
/* /*
* Copyright (c) 1982, 1986 Regents of the University of California. * Copyright (c) 1982, 1986 Regents of the University of California.
@ -80,8 +80,6 @@ struct uba_softc {
void (**uh_reset) __P((int));/* UBA reset function array */ void (**uh_reset) __P((int));/* UBA reset function array */
int *uh_resarg; /* array of ubareset args */ int *uh_resarg; /* array of ubareset args */
int uh_resno; /* Number of devices to reset */ int uh_resno; /* Number of devices to reset */
struct ivec_dsp *uh_idsp; /* Interrupt dispatch area */
u_int *uh_iarea; /* Interrupt vector array */
short uh_mrwant; /* someone is waiting for map reg */ short uh_mrwant; /* someone is waiting for map reg */
short uh_bdpwant; /* someone awaits bdp's */ short uh_bdpwant; /* someone awaits bdp's */
int uh_bdpfree; /* free bdp's */ int uh_bdpfree; /* free bdp's */
@ -98,11 +96,9 @@ struct uba_softc {
void (*uh_afterscan) __P((struct uba_softc *)); void (*uh_afterscan) __P((struct uba_softc *));
void (*uh_ubainit) __P((struct uba_softc *)); void (*uh_ubainit) __P((struct uba_softc *));
void (*uh_ubapurge) __P((struct uba_softc *, int)); void (*uh_ubapurge) __P((struct uba_softc *, int));
#ifdef DW780
struct ivec_dsp uh_dw780; /* Interrupt handles for DW780 */
#endif
short uh_nr; /* Unibus sequential number */ short uh_nr; /* Unibus sequential number */
short uh_nbdp; /* # of BDP's */ short uh_nbdp; /* # of BDP's */
int uh_ibase; /* Base address for vectors */
}; };
#define UAMSIZ 100 #define UAMSIZ 100
@ -177,7 +173,6 @@ struct ubinfo {
#define b_forw b_hash.le_next /* Nice to have when handling uba queues */ #define b_forw b_hash.le_next /* Nice to have when handling uba queues */
void uba_attach __P((struct uba_softc *, unsigned long)); void uba_attach __P((struct uba_softc *, unsigned long));
void ubasetvec __P((struct device *, int, void (*) __P((int))));
int uballoc __P((struct uba_softc *, caddr_t, int, int)); int uballoc __P((struct uba_softc *, caddr_t, int, int));
void ubarelse __P((struct uba_softc *, int *)); void ubarelse __P((struct uba_softc *, int *));
int ubaqueue __P((struct uba_unit *, struct buf *)); int ubaqueue __P((struct uba_unit *, struct buf *));