summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugh Graham <hugh@cvs.openbsd.org>2001-02-11 06:34:39 +0000
committerHugh Graham <hugh@cvs.openbsd.org>2001-02-11 06:34:39 +0000
commit8892fc1a51799002a13e596d5e2d4b118335553b (patch)
treef33375272b559a6e2241cd1e33e0af5bc0f7f186
parentd29be1547bf78d0b0a58621cfff8c29ddbd7d197 (diff)
Pick up a NetBSD hack to attach Cheetah to vsbus as well as ibus.
High kludge factor, but the payoff is vsbus scsi for free. Most of the work is by Michael Kukat and ragge, with a few other synchronisations thrown in.
-rw-r--r--sys/arch/vax/conf/GENERIC11
-rw-r--r--sys/arch/vax/conf/RAMDISK9
-rw-r--r--sys/arch/vax/conf/files.vax5
-rw-r--r--sys/arch/vax/vax/autoconf.c8
-rw-r--r--sys/arch/vax/vax/clock.c5
-rw-r--r--sys/arch/vax/vax/ibus.c36
-rw-r--r--sys/arch/vax/vax/vm_machdep.c12
-rw-r--r--sys/arch/vax/vsa/asc_vsbus.c11
-rw-r--r--sys/arch/vax/vsa/dz_ibus.c93
-rw-r--r--sys/arch/vax/vsa/if_le_vsbus.c8
-rw-r--r--sys/arch/vax/vsa/ncr.c6
-rw-r--r--sys/arch/vax/vsa/smg.c4
-rw-r--r--sys/arch/vax/vsa/vsbus.c169
13 files changed, 117 insertions, 260 deletions
diff --git a/sys/arch/vax/conf/GENERIC b/sys/arch/vax/conf/GENERIC
index 1418edc978a..c9264ae7149 100644
--- a/sys/arch/vax/conf/GENERIC
+++ b/sys/arch/vax/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.19 2001/01/28 01:19:58 hugh Exp $
+# $OpenBSD: GENERIC,v 1.20 2001/02/11 06:34:36 hugh Exp $
# $NetBSD: GENERIC,v 1.61 2000/04/19 06:50:36 itojun Exp $
machine vax # machine type; required
@@ -19,7 +19,7 @@ option VAX43 # VS 3100/76
option VAX46 # VS 4000/60
option VAX48 # VS 4000 VLC
option VAX49 # VS 4000/90
-option VAX53 # VAX 4000/10{0,5,6}
+option VAX53 # VAX 4000 10X, MicroVAX 3100m9X
option UVM # VAX uses UVM; REQUIRED
@@ -64,12 +64,12 @@ ibus0 at mainbus0 # All Microvax
le0 at vsbus0 csr 0x200e0000 # LANCE ethernet
ze0 at vsbus0 csr 0x20008000 # SGEC ethernet
dz0 at vsbus0 csr 0x200a0000 # DC-367 DZ-11 lookalike ctlr
-dz0 at vsbus0 csr 0x25000000 # VS4000/90 serial line
+dz0 at vsbus0 csr 0x25000000 # VS4000/90 4000/10X MV3100/9X serial
#hdc0 at vsbus0 csr 0x200c0000 # HDC9224 MFM/floppy ctlr
ncr0 at vsbus0 csr 0x200c0080 # VS2000/3100 SCSI-ctlr
ncr1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
-asc0 at vsbus0 csr 0x26000080 # VS4000/90 SCSI-ctlr
+asc0 at vsbus0 csr 0x26000080 # VS4000/90 4000/10X MV3100/9X SCSI
#smg0 at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
@@ -79,9 +79,8 @@ asc0 at vsbus0 csr 0x26000080 # VS4000/90 SCSI-ctlr
# Ibus, the internal bus on most Microvaxen
uba0 at ibus0 # Qbus adapter
ze0 at ibus0 # SGEC on-board ethernet
+le0 at ibus0 # LANCE ethernet (MV3400)
#shac0 at ibus0 # DSSI controller
-le0 at ibus0 # LANCE ethernet
-dz0 at ibus0 # DZ serial controller
# Devices connected at VAXBI
#cpu* at bi? node? # KA820/KA825 cpu
diff --git a/sys/arch/vax/conf/RAMDISK b/sys/arch/vax/conf/RAMDISK
index 050dff902bf..a457c885e60 100644
--- a/sys/arch/vax/conf/RAMDISK
+++ b/sys/arch/vax/conf/RAMDISK
@@ -1,4 +1,4 @@
-# $OpenBSD: RAMDISK,v 1.2 2001/01/28 01:19:58 hugh Exp $
+# $OpenBSD: RAMDISK,v 1.3 2001/02/11 06:34:36 hugh Exp $
machine vax # machine type
@@ -79,12 +79,12 @@ ibus0 at mainbus0 # All Microvax
le0 at vsbus0 csr 0x200e0000 # LANCE ethernet
ze0 at vsbus0 csr 0x20008000 # SGEC ethernet
dz0 at vsbus0 csr 0x200a0000 # DC-367 DZ-11 lookalike ctlr
-dz0 at vsbus0 csr 0x25000000 # VS4000/90 serial line
+dz0 at vsbus0 csr 0x25000000 # VS4000/90 4000/10X MV3100/9X serial
#hdc0 at vsbus0 csr 0x200c0000 # HDC9224 MFM/floppy ctlr
ncr0 at vsbus0 csr 0x200c0080 # VS2000/3100 SCSI-ctlr
ncr1 at vsbus0 csr 0x200c0180 # VS2000/3100 SCSI-ctlr
asc0 at vsbus0 csr 0x200c0080 # VS4000/60 (or VLC) SCSI-ctlr
-asc0 at vsbus0 csr 0x26000080 # VS4000/90 SCSI-ctlr
+asc0 at vsbus0 csr 0x26000080 # VS4000/90 4000/10X MV3100/9X SCSI
#smg0 at vsbus0 csr 0x200f0000 # Small monochrome display ctlr.
#clr0 at vsbus0 csr 0x30000000 # 4- or 8-bitplans color graphics
@@ -94,9 +94,8 @@ asc0 at vsbus0 csr 0x26000080 # VS4000/90 SCSI-ctlr
# Ibus, the internal bus on most Microvaxen
uba0 at ibus0 # Qbus adapter
ze0 at ibus0 # SGEC on-board ethernet
-#shac0 at ibus0 # DSSI controller
le0 at ibus0 # LANCE ethernet
-dz0 at ibus0 # DZ serial controller
+#shac0 at ibus0 # DSSI controller
# Devices connected at VAXBI
#cpu* at bi? node? # KA820/KA825 cpu
diff --git a/sys/arch/vax/conf/files.vax b/sys/arch/vax/conf/files.vax
index fcb889ac492..a97e1385259 100644
--- a/sys/arch/vax/conf/files.vax
+++ b/sys/arch/vax/conf/files.vax
@@ -1,4 +1,4 @@
-# $OpenBSD: files.vax,v 1.18 2001/01/28 01:19:58 hugh Exp $
+# $OpenBSD: files.vax,v 1.19 2001/02/11 06:34:36 hugh Exp $
# $NetBSD: files.vax,v 1.60 1999/08/27 20:04:32 ragge Exp $
#
# new style config file for vax architecture
@@ -111,8 +111,7 @@ attach ts at uba
file arch/vax/uba/ts.c ts needs-flag
attach dz at vsbus with dz_vsbus
-attach dz at ibus with dz_ibus
-file arch/vax/vsa/dz_ibus.c dz_vsbus | dz_ibus
+file arch/vax/vsa/dz_ibus.c dz_vsbus
# RD-type disks at VS2000's onboard MFM-controller
device hdc { drive = -1 }
diff --git a/sys/arch/vax/vax/autoconf.c b/sys/arch/vax/vax/autoconf.c
index 38c99ddbf63..b97195c9c37 100644
--- a/sys/arch/vax/vax/autoconf.c
+++ b/sys/arch/vax/vax/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.10 2000/04/27 01:10:11 bjc Exp $ */
+/* $OpenBSD: autoconf.c,v 1.11 2001/02/11 06:34:37 hugh Exp $ */
/* $NetBSD: autoconf.c,v 1.45 1999/10/23 14:56:05 ragge Exp $ */
/*
@@ -142,6 +142,12 @@ mainbus_attach(parent, self, hej)
*/
config_found(self, NULL, mainbus_print);
+#if VAX53
+ /* Kludge: To have two master buses */
+ if (vax_boardtype == VAX_BTYP_1303)
+ config_found(self, (void *)1, mainbus_print);
+#endif
+
if (dep_call->cpu_subconf)
(*dep_call->cpu_subconf)(self);
}
diff --git a/sys/arch/vax/vax/clock.c b/sys/arch/vax/vax/clock.c
index 1b55c2335e6..42942af7939 100644
--- a/sys/arch/vax/vax/clock.c
+++ b/sys/arch/vax/vax/clock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clock.c,v 1.10 2000/04/27 01:10:11 bjc Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
@@ -202,7 +202,8 @@ numtoyear(num)
return y;
}
-#if VAX750 || VAX780 || VAX8600 || VAX650
+#if VAX750 || VAX780 || VAX8600 || VAX650 || \
+ VAX660 || VAX670 || VAX680 || VAX53
/*
* Reads the TODR register; returns a (probably) true tick value,
* or CLKREAD_BAD if failed. The year is based on the argument
diff --git a/sys/arch/vax/vax/ibus.c b/sys/arch/vax/vax/ibus.c
index ea3f7e4846f..a3d0d46e083 100644
--- a/sys/arch/vax/vax/ibus.c
+++ b/sys/arch/vax/vax/ibus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ibus.c,v 1.2 2001/01/28 01:19:59 hugh Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1999 Ludd, University of Lule}, Sweden.
@@ -39,8 +39,6 @@
#include <machine/cpu.h>
#include <machine/sid.h>
-#include <machine/ibus.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*));
@@ -53,8 +51,6 @@ struct cfattach ibus_ca = {
sizeof(struct device), (cfmatch_t)ibus_match, ibus_attach
};
-struct ibus_edal *ibus_edal = NULL;
-
int
ibus_print(aux, name)
void *aux;
@@ -94,9 +90,6 @@ ibus_attach(parent, self, aux)
printf("\n");
- if (vax_boardtype == VAX_BTYP_1303)
- ibus_edal = (struct ibus_edal *) vax_map_physmem(0x25c00000, 1);
-
/*
* There may be a SGEC. Is badaddr() enough here?
*/
@@ -131,30 +124,3 @@ ibus_attach(parent, self, aux)
config_found(self, &bp, ibus_print);
}
-
-/*
- * Bitwise OR bits into the interrupt mask.
- * Returns the new mask.
- */
-unsigned char
-ibus_ormask(mask)
- unsigned char mask;
-{
- ibus_edal->edal_intmsk |= mask;
- return (ibus_edal->edal_intmsk);
-}
-
-/*
- * Sets a new interrupt mask. Returns the old one.
- * Works like spl functions.
- */
-unsigned char
-ibus_setmask(mask)
- unsigned char mask;
-{
- unsigned char ch;
-
- ch = ibus_edal->edal_intmsk;
- ibus_edal->edal_intmsk = mask;
- return ch;
-}
diff --git a/sys/arch/vax/vax/vm_machdep.c b/sys/arch/vax/vax/vm_machdep.c
index 68854567bf8..e93dd48fec0 100644
--- a/sys/arch/vax/vax/vm_machdep.c
+++ b/sys/arch/vax/vax/vm_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm_machdep.c,v 1.18 2000/10/09 23:11:57 bjc Exp $ */
+/* $OpenBSD: vm_machdep.c,v 1.19 2001/02/11 06:34:37 hugh Exp $ */
/* $NetBSD: vm_machdep.c,v 1.67 2000/06/29 07:14:34 mrg Exp $ */
/*
@@ -328,14 +328,15 @@ vmapbuf(bp, len)
struct buf *bp;
vsize_t len;
{
-#if VAX46 || VAX48 || VAX49
+#if VAX46 || VAX48 || VAX49 || VAX53
vaddr_t faddr, taddr, off;
paddr_t pa;
struct proc *p;
if (vax_boardtype != VAX_BTYP_46
&& vax_boardtype != VAX_BTYP_48
- && vax_boardtype != VAX_BTYP_49)
+ && vax_boardtype != VAX_BTYP_49
+ && vax_boardtype != VAX_BTYP_1303)
return;
if ((bp->b_flags & B_PHYS) == 0)
panic("vmapbuf");
@@ -366,12 +367,13 @@ vunmapbuf(bp, len)
struct buf *bp;
vsize_t len;
{
-#if VAX46 || VAX48 || VAX49
+#if VAX46 || VAX48 || VAX49 || VAX53
vaddr_t addr, off;
if (vax_boardtype != VAX_BTYP_46
&& vax_boardtype != VAX_BTYP_48
- && vax_boardtype != VAX_BTYP_49)
+ && vax_boardtype != VAX_BTYP_49
+ && vax_boardtype != VAX_BTYP_1303)
return;
if ((bp->b_flags & B_PHYS) == 0)
panic("vunmapbuf");
diff --git a/sys/arch/vax/vsa/asc_vsbus.c b/sys/arch/vax/vsa/asc_vsbus.c
index a9ad9c1b431..3e330022c7e 100644
--- a/sys/arch/vax/vsa/asc_vsbus.c
+++ b/sys/arch/vax/vsa/asc_vsbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asc_vsbus.c,v 1.2 2001/02/06 04:27:45 hugh Exp $ */
+/* $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 $ */
/*-
@@ -169,11 +169,10 @@ asc_vsbus_match( struct device *parent, void *conf, void *aux)
if (vax_boardtype == VAX_BTYP_46 || vax_boardtype == VAX_BTYP_48) {
if (cf->cf_loc[0] != 0x200c0080)
return 0;
-#if 1
- } else if (vax_boardtype == VAX_BTYP_49) {
+ } else if (vax_boardtype == VAX_BTYP_49 ||
+ vax_boardtype == VAX_BTYP_1303) {
if (cf->cf_loc[0] != 0x26000080)
return 0;
-#endif
} else {
return 0;
}
@@ -208,7 +207,6 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux)
{
struct vsbus_attach_args *va = aux;
struct asc_vsbus_softc *asc = (void *)self;
- struct vsbus_softc *vsc = (struct vsbus_softc *) parent;
struct ncr53c9x_softc *sc = &asc->sc_ncr53c9x;
int error;
@@ -257,6 +255,7 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux)
* them from there and knowing the internals of the
* bus_space implementation, we cast to bus_space_handles.
*/
+ struct vsbus_softc *vsc = (struct vsbus_softc *) parent;
asc->sc_adrh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_ADR);
asc->sc_dirh = (bus_space_handle_t) (vsc->sc_vsregs + ASC_REG_KA49_DIR);
#if 0
@@ -321,7 +320,6 @@ asc_vsbus_attach(struct device *parent, struct device *self, void *aux)
printf("\n%s", self->dv_xname); /* Pretty print */
- vsc->sc_mask |= 1 << (va->va_maskno-1);
/* Do the common parts of attachment. */
ncr53c9x_attach(sc, &asc_vsbus_ops, &asc_vsbus_dev);
}
@@ -504,4 +502,3 @@ asc_vsbus_dma_isactive(struct ncr53c9x_softc *sc)
return (asc->sc_flags & ASC_DMAACTIVE) != 0;
}
-
diff --git a/sys/arch/vax/vsa/dz_ibus.c b/sys/arch/vax/vsa/dz_ibus.c
index 967b86f6119..242d8921311 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.3 2001/01/30 17:05:02 hugh Exp $ */
+/* $OpenBSD: dz_ibus.c,v 1.4 2001/02/11 06:34:38 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.
@@ -49,7 +49,6 @@
#include <machine/sid.h>
#include <machine/uvax.h>
#include <machine/vsbus.h>
-#include <machine/ibus.h>
#include <machine/cpu.h>
#include <machine/scb.h>
@@ -62,8 +61,6 @@
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_ibus_match __P((struct device *, struct cfdata *, void *));
-static void dz_ibus_attach __P((struct device *, struct device *, void *));
static int dz_print __P((void *, const char *));
static vaddr_t dz_regs; /* Used for console */
@@ -72,10 +69,6 @@ struct cfattach dz_vsbus_ca = {
sizeof(struct dz_softc), (cfmatch_t)dz_vsbus_match, dz_vsbus_attach
};
-struct cfattach dz_ibus_ca = {
- sizeof(struct dz_softc), (cfmatch_t)dz_ibus_match, dz_ibus_attach
-};
-
#define REG(name) short name; short X##name##X;
static volatile struct ss_dz {/* base address of DZ-controller: 0x200A0000 */
REG(csr); /* 00 Csr: control/status register */
@@ -110,7 +103,12 @@ dz_vsbus_match(parent, cf, aux)
struct vsbus_attach_args *va = aux;
struct ss_dz *dzP;
short i;
- unsigned int n;
+
+#if VAX53
+ if (vax_boardtype == VAX_BTYP_1303)
+ if (cf->cf_loc[0] != 0x25000000)
+ return 0; /* Ugly */
+#endif
dzP = (struct ss_dz *)va->va_addr;
i = dzP->tcr;
@@ -119,11 +117,7 @@ dz_vsbus_match(parent, cf, aux)
DELAY(1000);
dzP->tcr = 1;
DELAY(100000);
- dzP->csr = DZ_CSR_MSE;
- DELAY(1000);
- dzP->tcr = 0;
-
- va->va_ivec = dzxint;
+ dzP->tcr = i;
/* If the device doesn't exist, no interrupt has been generated */
@@ -136,7 +130,6 @@ dz_vsbus_attach(parent, self, aux)
void *aux;
{
struct dz_softc *sc = (void *)self;
- struct vsbus_softc *vsc = (struct vsbus_softc *)parent;
struct vsbus_attach_args *va = aux;
/*
@@ -144,6 +137,10 @@ dz_vsbus_attach(parent, self, aux)
* due to the nature of how bus_space_* works on VAX, this will
* be perfectly good until everything is converted.
*/
+
+ if (dz_regs == 0) /* This isn't console */
+ dz_regs = vax_map_physmem(va->va_paddr, 1);
+
sc->sc_ioh = dz_regs;
sc->sc_dr.dr_csr = 0;
sc->sc_dr.dr_rbuf = 4;
@@ -156,9 +153,6 @@ dz_vsbus_attach(parent, self, aux)
sc->sc_type = DZ_DZV;
- vsc->sc_mask |= 1 << (va->va_maskno);
- vsc->sc_mask |= (1 << (va->va_maskno-1));
-
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);
@@ -172,52 +166,6 @@ dz_vsbus_attach(parent, self, aux)
config_found(self, 0, dz_print);
}
-static void
-dz_ibus_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-{
- struct dz_softc *sc = (struct dz_softc *)self;
-
- sc->sc_ioh = (vaddr_t)dz_regs;
- sc->sc_dr.dr_csr = 0; /* correct */
- sc->sc_dr.dr_rbuf = 4; /* correct */
- sc->sc_dr.dr_dtr = 9; /* unknown */
- sc->sc_dr.dr_break = 13; /* untested */
- sc->sc_dr.dr_tbuf = 12; /* correct */
- sc->sc_dr.dr_tcr = 8; /* correct */
- sc->sc_dr.dr_dcd = 13; /* works */
- sc->sc_dr.dr_ring = 13; /* untested */
-
- sc->sc_type = DZ_DC;
-
- sc->sc_dsr = 0x0f; /* XXX check if VS has modem ctrl bits */
-
- scb_vecalloc(0x154, dzxint, sc, SCB_ISTACK);
- scb_vecalloc(0x150, dzrint, sc, SCB_ISTACK);
-
- dzattach(sc);
-
- ibus_ormask(0x8);
- DELAY(1000);
-
- config_found(self, 0, dz_print);
-}
-
-static int
-dz_ibus_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- /* This function assumes all btype 1303 machines have a dz. */
-
- if (vax_boardtype == VAX_BTYP_1303)
- return (1);
-
- return (0);
-}
-
int
dzcngetc(dev)
dev_t dev;
@@ -334,19 +282,10 @@ dzcnpollc(dev, pollflag)
{
static u_char mask;
- switch(vax_boardtype) {
- case VAX_BTYP_1303:
- if(pollflag)
- mask = ibus_setmask(0);
- else
- ibus_setmask(mask);
- break;
- default:
- if (pollflag)
- mask = vsbus_setmask(0);
- else
- vsbus_setmask(mask);
- }
+ if (pollflag)
+ mask = vsbus_setmask(0);
+ else
+ vsbus_setmask(mask);
}
#if NLKC
diff --git a/sys/arch/vax/vsa/if_le_vsbus.c b/sys/arch/vax/vsa/if_le_vsbus.c
index 735a2dfff2a..8a3d1224a95 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.2 2000/10/11 06:19:19 bjc Exp $ */
+/* $OpenBSD: if_le_vsbus.c,v 1.3 2001/02/11 06:34:38 hugh Exp $ */
/* $NetBSD: if_le_vsbus.c,v 1.10 2000/06/29 07:14:18 mrg Exp $ */
/*-
@@ -96,9 +96,9 @@
#include <machine/cpu.h>
#include <machine/sid.h>
-#include <machine/bus.h>
#include <machine/scb.h>
#include <machine/rpb.h>
+#include <machine/bus.h>
#include <machine/vsbus.h>
#include <dev/ic/am7990reg.h>
@@ -157,7 +157,7 @@ le_vsbus_match(parent, cf, aux)
int rv = 0;
int error;
- if (vax_boardtype == VAX_BTYP_49)
+ if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_1303)
return 0;
error = bus_dmamap_create(va->va_dmat, sizeof(initblock), 1,
@@ -210,7 +210,6 @@ le_vsbus_attach(parent, self, aux)
void *aux;
{
struct vsbus_attach_args *va = aux;
- struct vsbus_softc *vsc = (struct vsbus_softc *)parent;
struct le_softc *sc = (void *)self;
bus_dma_segment_t seg;
int *lance_addr;
@@ -289,6 +288,5 @@ le_vsbus_attach(parent, self, aux)
/* Prettier printout */
printf("\n%s", self->dv_xname);
- vsc->sc_mask |= 1 << (va->va_maskno-1);
am7990_config(&sc->sc_am7990);
}
diff --git a/sys/arch/vax/vsa/ncr.c b/sys/arch/vax/vsa/ncr.c
index e24baf5237b..11ad8a458f0 100644
--- a/sys/arch/vax/vsa/ncr.c
+++ b/sys/arch/vax/vsa/ncr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ncr.c,v 1.7 2000/10/11 06:19:19 bjc Exp $ */
+/* $OpenBSD: ncr.c,v 1.8 2001/02/11 06:34:38 hugh Exp $ */
/* $NetBSD: ncr.c,v 1.32 2000/06/25 16:00:43 ragge Exp $ */
/*-
@@ -160,7 +160,7 @@ si_match(parent, cf, aux)
volatile char *si_csr = (char *) va->va_addr;
if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_46
- || vax_boardtype == VAX_BTYP_48)
+ || vax_boardtype == VAX_BTYP_48 || vax_boardtype == VAX_BTYP_1303)
return 0;
/* This is the way Linux autoprobes the interrupt MK-990321 */
si_csr[12] = 0;
@@ -177,14 +177,12 @@ si_attach(parent, self, aux)
void *aux;
{
struct vsbus_attach_args *va = aux;
- struct vsbus_softc *vsc = (struct vsbus_softc *)parent;
struct si_softc *sc = (struct si_softc *) self;
struct ncr5380_softc *ncr_sc = &sc->ncr_sc;
int tweak, target;
/* enable interrupts on vsbus too */
scb_vecalloc(va->va_cvec, (void (*)(void *)) ncr5380_intr, sc, SCB_ISTACK);
- vsc->sc_mask |= 1 << (va->va_maskno-1);
/*
* DMA area mapin.
diff --git a/sys/arch/vax/vsa/smg.c b/sys/arch/vax/vsa/smg.c
index 9c25ca4c312..00bf8b3378c 100644
--- a/sys/arch/vax/vsa/smg.c
+++ b/sys/arch/vax/vsa/smg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smg.c,v 1.1 2000/04/27 02:34:50 bjc Exp $ */
+/* $OpenBSD: smg.c,v 1.2 2001/02/11 06:34:38 hugh Exp $ */
/* $NetBSD: smg.c,v 1.21 2000/03/23 06:46:44 thorpej Exp $ */
/*
* Copyright (c) 1998 Ludd, University of Lule}, Sweden.
@@ -155,7 +155,7 @@ smg_match(parent, match, aux)
volatile short *cfgtst;
short tmp, tmp2;
- if (vax_boardtype == VAX_BTYP_49)
+ if (vax_boardtype == VAX_BTYP_49 || vax_boardtype == VAX_BTYP_1303)
return 0;
curcmd = (short *)va->va_addr;
diff --git a/sys/arch/vax/vsa/vsbus.c b/sys/arch/vax/vsa/vsbus.c
index 6e2df6f4a8b..43e18bf8584 100644
--- a/sys/arch/vax/vsa/vsbus.c
+++ b/sys/arch/vax/vsa/vsbus.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vsbus.c,v 1.5 2000/10/11 06:19:19 bjc Exp $ */
+/* $OpenBSD: vsbus.c,v 1.6 2001/02/11 06:34:38 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.
@@ -51,7 +51,7 @@
#include <vm/vm.h>
#include <vm/vm_kern.h>
-#define _VAX_BUS_DMA_PRIVATE
+#define _VAX_BUS_DMA_PRIVATE
#include <machine/bus.h>
#include <machine/pte.h>
#include <machine/sid.h>
@@ -67,15 +67,15 @@
#include <machine/vsbus.h>
-int vsbus_match __P((struct device *, struct cfdata *, void *));
+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_print __P((void *, const char *));
+int vsbus_search __P((struct device *, void *, void *));
void ka410_attach __P((struct device *, struct device *, void *));
void ka43_attach __P((struct device *, struct device *, void *));
-struct vax_bus_dma_tag vsbus_bus_dma_tag = {
+static struct vax_bus_dma_tag vsbus_bus_dma_tag = {
0,
0,
0,
@@ -131,9 +131,14 @@ vsbus_print(aux, name)
int
vsbus_match(parent, cf, aux)
struct device *parent;
- struct cfdata *cf;
+ struct cfdata *cf;
void *aux;
{
+#if VAX53
+ /* Kludge: VAX53 is... special */
+ if (vax_boardtype == VAX_BTYP_1303 && (int)aux == 1)
+ return 1; /* Hack */
+#endif
if (vax_bustype == VAX_VSBUS)
return 1;
return 0;
@@ -146,14 +151,14 @@ vsbus_attach(parent, self, aux)
{
struct vsbus_softc *sc = (void *)self;
int dbase, dsize;
- int discard;
printf("\n");
sc->sc_dmatag = vsbus_bus_dma_tag;
switch (vax_boardtype) {
-#if VAX49
+#if VAX49 || VAX53
+ case VAX_BTYP_1303:
case VAX_BTYP_49:
sc->sc_vsregs = vax_map_physmem(0x25c00000, 1);
sc->sc_intreq = (char *)sc->sc_vsregs + 12;
@@ -164,16 +169,15 @@ vsbus_attach(parent, self, aux)
#endif
#if VAX46 || VAX48
- case VAX_BTYP_48:
- case VAX_BTYP_46:
- sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
- sc->sc_intreq = (char *)sc->sc_vsregs + 15;
- sc->sc_intclr = (char *)sc->sc_vsregs + 15;
- sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
- vsbus_dma_init(sc, 32768);
+ case VAX_BTYP_48:
+ case VAX_BTYP_46:
+ sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
+ sc->sc_intreq = (char *)sc->sc_vsregs + 15;
+ sc->sc_intclr = (char *)sc->sc_vsregs + 15;
+ sc->sc_intmsk = (char *)sc->sc_vsregs + 12;
+ vsbus_dma_init(sc, 32768);
#endif
-
default:
sc->sc_vsregs = vax_map_physmem(VS_REGS, 1);
sc->sc_intreq = (char *)sc->sc_vsregs + 15;
@@ -203,28 +207,28 @@ vsbus_attach(parent, self, aux)
*sc->sc_intmsk = 0;
*sc->sc_intclr = 0xff;
DELAY(1000000); /* Wait a second */
- sc->sc_mask = discard = *sc->sc_intreq;
- printf("%s: interrupt mask %x\n", self->dv_xname, discard);
-
+ sc->sc_mask = *sc->sc_intreq;
+ printf("%s: interrupt mask %x\n", self->dv_xname, sc->sc_mask);
/*
* now check for all possible devices on this "bus"
*/
config_search(vsbus_search, self, NULL);
- *sc->sc_intmsk = sc->sc_mask ^ discard;
+ /* Autoconfig finished, enable interrupts */
+ *sc->sc_intmsk = ~sc->sc_mask;
}
int
vsbus_search(parent, cfd, aux)
- struct device *parent;
- void *cfd;
- void *aux;
+ struct device *parent;
+ void *cfd;
+ void *aux;
{
- struct vsbus_softc *sc = (void *)parent;
- struct vsbus_attach_args va;
- struct cfdata *cf = cfd;
- int i, vec, br;
- u_char c;
+ struct vsbus_softc *sc = (void *)parent;
+ struct vsbus_attach_args va;
+ struct cfdata *cf = cfd;
+ int i, vec, br;
+ u_char c;
va.va_paddr = cf->cf_loc[0];
va.va_addr = vax_map_physmem(va.va_paddr, 1);
@@ -235,10 +239,10 @@ vsbus_search(parent, cfd, aux)
*sc->sc_intclr = 0xff;
scb_vecref(0, 0); /* Clear vector ref */
- va.va_ivec = vsbus_intr;
i = (*cf->cf_attach->ca_match) (parent, cf, &va);
vax_unmap_physmem(va.va_addr, 1);
c = *sc->sc_intreq & ~sc->sc_mask;
+
if (i == 0)
goto forgetit;
if (i > 10)
@@ -246,87 +250,33 @@ vsbus_search(parent, cfd, aux)
else if (c == 0)
goto forgetit;
- va.va_maskno = ffs((u_int)c);
-
*sc->sc_intmsk = c;
DELAY(1000);
*sc->sc_intmsk = 0;
-
+ va.va_maskno = ffs((u_int)c);
i = scb_vecref(&vec, &br);
if (i == 0)
goto fail;
if (vec == 0)
goto fail;
-
- scb_vecalloc(vec, va.va_ivec, va.va_vecarg, SCB_ISTACK);
+
va.va_br = br;
va.va_cvec = vec;
- va.confargs = aux;
va.va_dmaaddr = sc->sc_dmaaddr;
va.va_dmasize = sc->sc_dmasize;
-
+ *sc->sc_intmsk = c; /* Allow interrupts during attach */
config_attach(parent, cf, &va, vsbus_print);
- return 1;
+ *sc->sc_intmsk = 0;
+ return 0;
fail:
- printf("%s%d at %s csr %x %s\n",
+ printf("%s%d at %s csr 0x%x %s\n",
cf->cf_driver->cd_name, cf->cf_unit, parent->dv_xname,
cf->cf_loc[0], (i ? "zero vector" : "didn't interrupt"));
forgetit:
return 0;
}
-#if 0
-static volatile struct dma_lock {
- int dl_locked;
- int dl_wanted;
- void *dl_owner;
- int dl_count;
-} dmalock = { 0, 0, NULL, 0 };
-
-int
-vsbus_lockDMA(ca)
- struct confargs *ca;
-{
- while (dmalock.dl_locked) {
- dmalock.dl_wanted++;
- sleep((caddr_t)&dmalock, PRIBIO); /* PLOCK or PRIBIO ? */
- dmalock.dl_wanted--;
- }
- dmalock.dl_locked++;
- dmalock.dl_owner = ca;
-
- /*
- * no checks yet, no timeouts, nothing...
- */
-
-#ifdef DEBUG
- if ((++dmalock.dl_count % 1000) == 0)
- printf("%d locks, owner: %s\n", dmalock.dl_count, ca->ca_name);
-#endif
- return (0);
-}
-
-int
-vsbus_unlockDMA(ca)
- struct confargs *ca;
-{
- if (dmalock.dl_locked != 1 || dmalock.dl_owner != ca) {
- printf("locking-problem: %d, %s\n", dmalock.dl_locked,
- (dmalock.dl_owner ? dmalock.dl_owner : "null"));
- dmalock.dl_locked = 0;
- return (-1);
- }
- dmalock.dl_owner = NULL;
- dmalock.dl_locked = 0;
- if (dmalock.dl_wanted) {
- wakeup((caddr_t)&dmalock);
- }
- return (0);
-}
-#endif
-
-
/*
* Sets a new interrupt mask. Returns the old one.
* Works like spl functions.
@@ -335,9 +285,13 @@ unsigned char
vsbus_setmask(mask)
unsigned char mask;
{
- struct vsbus_softc *sc = vsbus_cd.cd_devs[0];
+ struct vsbus_softc *sc;
unsigned char ch;
+ if (vsbus_cd.cd_ndevs == 0)
+ return 0;
+ sc = vsbus_cd.cd_devs[0];
+
ch = *sc->sc_intmsk;
*sc->sc_intmsk = mask;
return ch;
@@ -350,7 +304,11 @@ void
vsbus_clrintr(mask)
unsigned char mask;
{
- struct vsbus_softc *sc = vsbus_cd.cd_devs[0];
+ struct vsbus_softc *sc;
+
+ if (vsbus_cd.cd_ndevs == 0)
+ return;
+ sc = vsbus_cd.cd_devs[0];
*sc->sc_intclr = mask;
}
@@ -360,18 +318,15 @@ vsbus_clrintr(mask)
* Use the physical memory directly.
*/
void
-vsbus_copytoproc(p, from, to, len)
- struct proc *p;
- caddr_t from, to;
- int len;
+vsbus_copytoproc(struct proc *p, caddr_t from, caddr_t to, int len)
{
struct pte *pte;
paddr_t pa;
- if ((long)to & KERNBASE) { /* In kernel space */
- bcopy(from, to, len);
- return;
- }
+ if ((vaddr_t)to & KERNBASE) { /* In kernel space */
+ bcopy(from, to, len);
+ return;
+ }
pte = uvtopte(TRUNC_PAGE(to), (&p->p_addr->u_pcb));
if ((vaddr_t)to & PGOFSET) {
int cz = ROUND_PAGE(to) - (vaddr_t)to;
@@ -394,18 +349,15 @@ vsbus_copytoproc(p, from, to, len)
}
void
-vsbus_copyfromproc(p, from, to, len)
- struct proc *p;
- caddr_t from, to;
- int len;
+vsbus_copyfromproc(struct proc *p, caddr_t from, caddr_t to, int len)
{
struct pte *pte;
paddr_t pa;
- if ((long)from & KERNBASE) { /* In kernel space */
- bcopy(from, to, len);
- return;
- }
+ if ((vaddr_t)from & KERNBASE) { /* In kernel space */
+ bcopy(from, to, len);
+ return;
+ }
pte = uvtopte(TRUNC_PAGE(from), (&p->p_addr->u_pcb));
if ((vaddr_t)from & PGOFSET) {
int cz = ROUND_PAGE(from) - (vaddr_t)from;
@@ -436,6 +388,7 @@ static int vsbus_active = 0;
void
vsbus_dma_start(struct vsbus_dma *vd)
{
+
SIMPLEQ_INSERT_TAIL(&vsbus_dma, vd, vd_q);
if (vsbus_active == 0)