summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Murphree <smurph@cvs.openbsd.org>1998-12-15 05:52:32 +0000
committerSteve Murphree <smurph@cvs.openbsd.org>1998-12-15 05:52:32 +0000
commitbe8c8622ef57b334e07dd5c0f36cdacbd0ba355a (patch)
treebd550e88fe9e76416d05e97d3152a6fe0bf0a3b8
parent2fb8d39328cdf8894f11b9eb00c06436c0677e5d (diff)
Commit for the first real OpenBSD mvme88k port.
-rw-r--r--sys/arch/mvme88k/dev/bugio.c37
-rw-r--r--sys/arch/mvme88k/dev/bugtty.c37
-rw-r--r--sys/arch/mvme88k/dev/cl.c106
-rw-r--r--sys/arch/mvme88k/dev/clock.c323
-rw-r--r--sys/arch/mvme88k/dev/clockreg.h2
-rw-r--r--sys/arch/mvme88k/dev/clreg.h204
-rw-r--r--sys/arch/mvme88k/dev/i82586.h3
-rw-r--r--sys/arch/mvme88k/dev/if_ie.c112
-rw-r--r--sys/arch/mvme88k/dev/if_ie.h4
-rw-r--r--sys/arch/mvme88k/dev/mainbus.c105
-rw-r--r--sys/arch/mvme88k/dev/memc.c64
-rw-r--r--sys/arch/mvme88k/dev/memcreg.h63
-rw-r--r--sys/arch/mvme88k/dev/memdevs.c2
-rw-r--r--sys/arch/mvme88k/dev/nvram.c317
-rw-r--r--sys/arch/mvme88k/dev/nvramreg.h9
-rw-r--r--sys/arch/mvme88k/dev/pcctwo.c306
-rw-r--r--sys/arch/mvme88k/dev/pcctworeg.h229
-rw-r--r--sys/arch/mvme88k/dev/rd_root.c80
-rw-r--r--sys/arch/mvme88k/dev/siop.c339
-rw-r--r--sys/arch/mvme88k/dev/siop_script.out273
-rw-r--r--sys/arch/mvme88k/dev/siop_script.ss16
-rw-r--r--sys/arch/mvme88k/dev/siopdma.c69
-rw-r--r--sys/arch/mvme88k/dev/siopreg.h2
-rw-r--r--sys/arch/mvme88k/dev/siopvar.h2
-rw-r--r--sys/arch/mvme88k/dev/sram.c223
-rw-r--r--sys/arch/mvme88k/dev/vme.c245
-rw-r--r--sys/arch/mvme88k/dev/vme.h21
-rw-r--r--sys/arch/mvme88k/dev/vmel.c11
-rw-r--r--sys/arch/mvme88k/dev/vmes.c12
29 files changed, 1831 insertions, 1385 deletions
diff --git a/sys/arch/mvme88k/dev/bugio.c b/sys/arch/mvme88k/dev/bugio.c
index 941c7f143b5..be68ef99c17 100644
--- a/sys/arch/mvme88k/dev/bugio.c
+++ b/sys/arch/mvme88k/dev/bugio.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: bugio.c,v 1.2 1998/12/15 05:52:29 smurph Exp $ */
+/* Copyright (c) 1998 Steve Murphree, Jr. */
#include <machine/bugio.h>
#define INCHR "0x0000"
@@ -62,29 +64,14 @@ char
buginchr(void)
{
register int cc asm("r2");
-
BUGCTXT();
asm volatile ("or r9,r0," INCHR);
asm volatile ("tb0 0,r0,0x1F0");
- /*asm("or %0,r0,r2" : "=r" (cc) : );*/
+ asm volatile ("or %0,r0,r2" : "=r" (cc) : );
OSCTXT();
return ((char)cc & 0xFF);
}
-/* return 1 if not empty else 0 */
-
-buginstat(void)
-{
- int ret;
-
- BUGCTXT();
- asm volatile ("or r9,r0," INSTAT);
- asm volatile ("tb0 0,r0,0x1F0");
- asm volatile ("or %0,r0,r2" : "=r" (ret) : );
- OSCTXT();
- return (ret & 0x40 ? 1 : 0);
-}
-
bugoutchr(unsigned char c)
{
unsigned char cc;
@@ -103,6 +90,20 @@ bugoutchr(unsigned char c)
OSCTXT();
}
+/* return 1 if not empty else 0 */
+
+buginstat(void)
+{
+ int ret;
+
+ BUGCTXT();
+ asm volatile ("or r9,r0," INSTAT);
+ asm volatile ("tb0 0,r0,0x1F0");
+ asm volatile ("or %0,r0,r2" : "=r" (ret) : );
+ OSCTXT();
+ return (ret & 0x4 ? 1 : 0);
+}
+
bugoutstr(char *s, char *se)
{
BUGCTXT();
@@ -176,9 +177,9 @@ bugbrdid(struct bugbrdid *id)
bugnetctrl(struct bugniocall *niocall)
{
- BUGCTXT();
+/* BUGCTXT();*/
asm("or r2,r0,%0" : : "r" (niocall));
asm("or r9,r0, " NETCTRL);
asm("tb0 0,r0,0x1F0");
- OSCTXT();
+/* OSCTXT();*/
}
diff --git a/sys/arch/mvme88k/dev/bugtty.c b/sys/arch/mvme88k/dev/bugtty.c
index 0eeafd308c7..87e20c7189c 100644
--- a/sys/arch/mvme88k/dev/bugtty.c
+++ b/sys/arch/mvme88k/dev/bugtty.c
@@ -1,6 +1,5 @@
-/* $NetBSD$ */
-
-/*
+/* $OpenBSD: bugtty.c,v 1.4 1998/12/15 05:52:29 smurph Exp $ */
+/* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn.
* All rights reserved.
*
@@ -81,6 +80,17 @@ char bug_obuffer[BUGBUF+1];
#define bugtty_tty bugttytty
struct tty *bugtty_tty[NBUGTTY];
int needprom = 1;
+/*
+ int ca_bustype;
+ void *ca_vaddr;
+ void *ca_paddr;
+ int ca_offset;
+ int ca_len;
+ int ca_ipl;
+ int ca_vec;
+ char *ca_name;
+ void *ca_master; points to bus-dependent data
+*/
int
bugttymatch(parent, self, aux)
@@ -88,17 +98,15 @@ bugttymatch(parent, self, aux)
void *self;
void *aux;
{
- extern int needprom;
struct confargs *ca = aux;
if (needprom == 0)
return (0);
- /*
- * tell our parent our requirements
- */
- ca->ca_paddr = (caddr_t)0xfff45000;
- ca->ca_size = 0x200;
+ ca->ca_paddr = (void *)0xfff45000;
+ ca->ca_vaddr = (void *)0xfff45000;
+ ca->ca_len = 0x200;
ca->ca_ipl = IPL_TTY;
+ ca->ca_name = "bugtty\0";
return (1);
}
@@ -108,7 +116,7 @@ bugttyattach(parent, self, aux)
struct device *self;
void *aux;
{
- printf("\n");
+ printf(": bugtty\n");
}
#define BUGTTYUNIT(x) ((x) & (0x7f))
@@ -444,8 +452,8 @@ bugttycnprobe(cp)
struct consdev *cp;
{
int maj;
- extern int needprom;
-
+ int needprom = 1;
+
if (needprom == 0) {
cp->cn_pri = CN_DEAD;
return (0);
@@ -460,7 +468,8 @@ bugttycnprobe(cp)
default:
break;
}
-#else
+#endif
+#if 0
cp->cn_pri = CN_NORMAL;
return (0);
#endif /* 0 */
@@ -472,7 +481,6 @@ bugttycnprobe(cp)
cp->cn_dev = makedev(maj, 0);
cp->cn_pri = CN_NORMAL;
-
return (1);
}
@@ -480,6 +488,7 @@ int
bugttycninit(cp)
struct consdev *cp;
{
+ /* Nothing to do */
}
int
diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c
index 1c1ff9748ad..373c6816961 100644
--- a/sys/arch/mvme88k/dev/cl.c
+++ b/sys/arch/mvme88k/dev/cl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl.c,v 1.1 1997/03/03 19:32:04 rahnds Exp $ */
+/* $OpenBSD: cl.c,v 1.2 1998/12/15 05:52:29 smurph Exp $ */
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
@@ -84,10 +84,14 @@
#define CL_TXINTR 0x02
#define CL_RXINTR 0x02
+#ifdef DEBUG
+#undef DEBUG
+#endif
+#define DEBUG_KERN 1
struct cl_cons {
void *cl_paddr;
volatile struct clreg *cl_vaddr;
- volatile struct pcc2reg *pcctwoaddr;
+ volatile struct pcctworeg *pcctwoaddr;
u_char channel;
} cl_cons;
@@ -133,7 +137,7 @@ struct clsoftc {
struct intrhand sc_ih_m;
struct intrhand sc_ih_t;
struct intrhand sc_ih_r;
- struct pcc2reg *sc_pcctwo;
+ struct pcctworeg *sc_pcctwo;
int sc_flags;
};
struct {
@@ -241,46 +245,20 @@ int clprobe(parent, self, aux)
*/
struct clreg *cl_reg;
struct confargs *ca = aux;
- register struct cfdata *cf = self;
- caddr_t base;
-
int ret;
-#if 0
- if (cputyp != CPU_167 && cputyp != CPU_166
-#ifdef CPU_187
- && cputyp != CPU_187
-#endif
- )
- {
- return 0;
- }
-#endif /* 0 */
- if (cputyp != CPU_187) {
+ if (cputyp != CPU_187)
return 0;
- }
- /*
- * If bus or name do not match, fail.
- */
- if (ca->ca_bustype != BUS_PCCTWO ||
- strcmp(cf->cf_driver->cd_name, "cl")) {
- return 0;
- }
-
- base = (caddr_t)cf->cf_loc[0];
-
- if (badpaddr(base, 1) == -1) {
- return 0;
- }
-
- /*
- * tell our parent our requirements
- */
- ca->ca_paddr = (caddr_t)CD2400_BASE_ADDR;
- ca->ca_size = CD2400_SIZE;
ca->ca_ipl = IPL_TTY;
-
- return 1;
+ ca->ca_paddr = (void *)CD2400_BASE_ADDR;
+ cl_reg = (struct clreg *)ca->ca_vaddr;
+
+#if 0
+ ret = !badvaddr(&cl_reg->cl_gfrcr,1);
+#else
+ ret = 1;
+#endif
+ return ret;
}
void
@@ -294,7 +272,7 @@ clattach(parent, self, aux)
int i;
sc->cl_reg = (struct clreg *)ca->ca_vaddr;
- sc->sc_pcctwo = (struct pcc2reg *)ca->ca_parent;
+ sc->sc_pcctwo = ca->ca_master;
if ((u_char *)ca->ca_paddr == (u_char *)cl_cons.cl_paddr) {
/* if this device is configured as console,
@@ -305,6 +283,9 @@ clattach(parent, self, aux)
/* reset chip only if we are not console device */
/* wait for GFRCR */
}
+ /* allow chip to settle before continuing */
+ delay(100);
+
/* set up global registers */
sc->cl_reg->cl_tpr = CL_TIMEOUT;
sc->cl_reg->cl_rpilr = 0x03;
@@ -383,13 +364,13 @@ clattach(parent, self, aux)
intr_establish(PCC2_VECT + SMOIRQ, &sc->sc_ih_m);
intr_establish(PCC2_VECT + STxIRQ, &sc->sc_ih_t);
intr_establish(PCC2_VECT + SRxIRQ, &sc->sc_ih_r);
- sc->sc_pcctwo = (struct pcc2reg *)ca->ca_parent;
- sc->sc_pcctwo->pcc2_sccerrstat = 0x01; /* clear errors */
+ sc->sc_pcctwo = ca->ca_master;
+ sc->sc_pcctwo->pcc2_sccerr = 0x01; /* clear errors */
/* enable all interrupts at ca_ipl */
- sc->sc_pcctwo->pcc2_sccmoirq = 0x10 | (ca->ca_ipl & 0x7);
- sc->sc_pcctwo->pcc2_scctxirq = 0x10 | (ca->ca_ipl & 0x7);
- sc->sc_pcctwo->pcc2_sccrxirq = 0x10 | (ca->ca_ipl & 0x7);
+ sc->sc_pcctwo->pcc2_sccirq = 0x10 | (ca->ca_ipl & 0x7);
+ sc->sc_pcctwo->pcc2_scctx = 0x10 | (ca->ca_ipl & 0x7);
+ sc->sc_pcctwo->pcc2_sccrx = 0x10 | (ca->ca_ipl & 0x7);
break;
default:
/* oops */
@@ -959,29 +940,11 @@ int
clcninit(cp)
struct consdev *cp;
{
-#if defined(MVME187)
- volatile struct clreg *cl_reg;
- extern vm_offset_t clconsvaddr, pcc2consvaddr;
-
- cl_cons.cl_paddr = (void *)CD2400_BASE_ADDR;
- cl_cons.cl_vaddr = (struct clreg *)CD2400_BASE_ADDR;
- cl_cons.pcctwoaddr = (struct pcc2reg *)PCC2_BASE_ADDR;
-#else
-#ifdef MAP_DOES_WORK
- int size = (0x1ff + PGOFSET) & ~PGOFSET;
- int pcc2_size = (0x3C + PGOFSET) & ~PGOFSET;
-#endif
- struct clreg *cl_reg;
+ volatile struct clreg *cl_reg;
cl_cons.cl_paddr = (void *)0xfff45000;
-#ifdef MAP_DOES_WORK
- cl_cons.cl_vaddr = mapiodev(cl_cons.cl_paddr,size);
- cd_pcc2_base = mapiodev(0xfff42000,pcc2_size);
-#else
cl_cons.cl_vaddr = (struct clreg *)IIOV(cl_cons.cl_paddr);
cl_cons.pcctwoaddr = (void *)IIOV(0xfff42000);
-#endif
-#endif /* defined(MVME187)
cl_reg = cl_cons.cl_vaddr;
/* reset the chip? */
#ifdef CLCD_DO_RESET
@@ -1035,12 +998,13 @@ clcngetc(dev)
int got_char = 0;
u_char ier_old = 0xff;
volatile struct clreg *cl_reg = cl_cons.cl_vaddr;
- volatile struct pcc2reg *pcc2_base = cl_cons.pcctwoaddr;
+ volatile struct pcctworeg *pcc2_base = cl_cons.pcctwoaddr;
cl_reg->cl_car = 0;
if (!(cl_reg->cl_ier & 0x08)) {
ier_old = cl_reg->cl_ier;
cl_reg->cl_ier = 0x08;
}
+
while (got_char == 0) {
val = cl_reg->cl_rir;
/* if no receive interrupt pending wait */
@@ -1048,7 +1012,7 @@ clcngetc(dev)
continue;
}
/* XXX do we need to suck the entire FIFO contents? */
- reoir = pcc2_base->pcc2_sccrxpiack; /* receive PIACK */
+ reoir = pcc2_base->pcc2_sccrxiack; /* receive PIACK */
licr = cl_reg->cl_licr;
if (((licr >> 2) & 0x3) == 0) {
/* is the interrupt for us (port 0) */
@@ -1216,7 +1180,7 @@ clgetc(sc, channel)
int *channel;
{
volatile struct clreg *cl_reg;
- volatile struct pcc2reg *pcc2_base;
+ volatile struct pcctworeg *pcc2_base;
u_char val, reoir, licr, isrl, fifo_cnt, data;
if (0 == sc) {
cl_reg = cl_cons.cl_vaddr;
@@ -1231,7 +1195,7 @@ clgetc(sc, channel)
return 0;
}
/* XXX do we need to suck the entire FIFO contents? */
- reoir = pcc2_base->pcc2_sccrxpiack; /* receive PIACK */
+ reoir = pcc2_base->pcc2_sccrxiack; /* receive PIACK */
licr = cl_reg->cl_licr;
*channel = (licr >> 2) & 0x3;
/* is the interrupt for us (port 0) */
@@ -1685,7 +1649,7 @@ cl_rxintr(sc)
} else
/* We don't need no sinkin special characters */
if (risrl & 0x08) {
- cl_overflow (sc, channel, &sc->sc_fotime, "fifo");
+ cl_overflow (sc, channel, (long*)&sc->sc_fotime, "fifo");
reoir = 0x08;
} else
if (risrl & 0x04) {
@@ -1871,7 +1835,11 @@ cl_break (sc, channel)
struct clsoftc *sc;
int channel;
{
+#ifdef DEBUG_KERN
+ Debugger();
+#else
log(LOG_WARNING, "%s%d[%d]: break detected\n", cl_cd.cd_name, 0, channel);
+#endif
return;
}
diff --git a/sys/arch/mvme88k/dev/clock.c b/sys/arch/mvme88k/dev/clock.c
index 352bc426dfc..3535f83d231 100644
--- a/sys/arch/mvme88k/dev/clock.c
+++ b/sys/arch/mvme88k/dev/clock.c
@@ -1,6 +1,35 @@
-/* $NetBSD: clock.c,v 1.22 1995/05/29 23:57:15 pk Exp $ */
+/* $OpenBSD: clock.c,v 1.4 1998/12/15 05:52:29 smurph Exp $ */
/*
+ * Copyright (c) 1995 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
* Copyright (c) 1995 Nivas Madhur
@@ -58,10 +87,12 @@
#include <sys/gmon.h>
#endif
+#include <machine/psl.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <mvme88k/dev/pcctworeg.h>
+#include "pcctwo.h"
/*
* Statistics clock interval and variance, in usec. Variance must be a
@@ -79,12 +110,13 @@ u_long delay_factor = 1;
static int clockmatch __P((struct device *, void *, void *));
static void clockattach __P((struct device *, struct device *, void *));
-int clockintr __P((void *, void *));
-int statintr __P((void *, void *));
+/*int clockintr __P((void *, void *));*/
+/*#int statintr __P((void *, void *));*/
struct clocksoftc {
struct device sc_dev;
- volatile struct pcc2reg *sc_pcc2reg;
+ struct intrhand sc_profih;
+ struct intrhand sc_statih;
};
struct cfattach clock_ca = {
@@ -95,13 +127,23 @@ struct cfdriver clock_cd = {
NULL, "clock", DV_DULL, 0
};
-struct intrhand clockintrhand, statintrhand;
+int clockintr __P((void *));
+int statintr __P((void *));
+
+int clockbus;
+u_char stat_reset, prof_reset;
-static int
-clockmatch(struct device *parent, void *self, void *aux)
+ /*
+ * Every machine must have a clock tick device of some sort; for this
+ * platform this file manages it, no matter what form it takes.
+ */
+int
+clockmatch(parent, vcf, args)
+ struct device *parent;
+ void *vcf, *args;
{
- register struct confargs *ca = aux;
- register struct cfdata *cf = self;
+ register struct confargs *ca = args;
+ register struct cfdata *cf = vcf;
if (ca->ca_bustype != BUS_PCCTWO ||
strcmp(cf->cf_driver->cd_name, "clock")) {
@@ -115,100 +157,62 @@ clockmatch(struct device *parent, void *self, void *aux)
*/
ca->ca_ipl = IPL_CLOCK;
/* set size to 0 - see pcctwo.c:match for details */
- ca->ca_size = 0;
+ ca->ca_len = 0;
- return 1;
+
+ return (1);
}
-/* ARGSUSED */
-static void
-clockattach(struct device *parent, struct device *self, void *aux)
+void
+clockattach(parent, self, args)
+ struct device *parent, *self;
+ void *args;
{
- struct confargs *ca = aux;
+ struct confargs *ca = args;
struct clocksoftc *sc = (struct clocksoftc *)self;
- u_long elapsedtime;
- extern void delay(u_long);
- extern int cpuspeed;
+ sc->sc_profih.ih_fn = clockintr;
+ sc->sc_profih.ih_arg = 0;
+ sc->sc_profih.ih_wantframe = 1;
+ sc->sc_profih.ih_ipl = ca->ca_ipl;
- /*
- * save virtual address of the pcc2 block since our
- * registers are in that block.
- */
- sc->sc_pcc2reg = (struct pcc2reg *)ca->ca_vaddr;
+ sc->sc_statih.ih_fn = statintr;
+ sc->sc_statih.ih_arg = 0;
+ sc->sc_statih.ih_wantframe = 1;
+ sc->sc_statih.ih_ipl = ca->ca_ipl;
- /*
- * calibrate for delay() calls.
- * We do this by using tick timer1 in free running mode before
- * cpu_initclocks() is called so turn on clock interrupts etc.
- *
- * the approach is:
- * set count in timer to 0
- * call delay(1000) for a 1000 us delay
- * after return, stop count and figure out
- * how many us went by (call it x)
- * now the factor to multiply the arg. passed to
- * delay would be (x/1000) rounded up to an int.
- */
- printf("\n");
- sc->sc_pcc2reg->pcc2_t1ctl &= ~PCC2_TICTL_CEN;
- sc->sc_pcc2reg->pcc2_psclkadj = 256 - cpuspeed;
- sc->sc_pcc2reg->pcc2_t1irq &= ~PCC2_TTIRQ_IEN;
- sc->sc_pcc2reg->pcc2_t1cntr = 0;
- sc->sc_pcc2reg->pcc2_t1ctl |= PCC2_TICTL_CEN;
- delay(1000); /* delay for 1 ms */
- sc->sc_pcc2reg->pcc2_t1ctl &= ~PCC2_TICTL_CEN;
- elapsedtime = sc->sc_pcc2reg->pcc2_t1cntr;
-
- delay_factor = (u_long)(elapsedtime / 1000 + 1);
+ clockbus = ca->ca_bustype;
+ prof_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
+ stat_reset = ca->ca_ipl | PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
+ pcctwointr_establish(PCC2V_TIMER1, &sc->sc_profih);
+ pcctwointr_establish(PCC2V_TIMER2, &sc->sc_statih);
- /*
- * program clock to interrupt at IPL_CLOCK. Set everything
- * except compare registers, interrupt enable and counter
- * enable registers.
- */
- sc->sc_pcc2reg->pcc2_t1ctl &= ~(PCC2_TICTL_CEN);
- sc->sc_pcc2reg->pcc2_t1cntr= 0;
- sc->sc_pcc2reg->pcc2_t1ctl |= (PCC2_TICTL_COC|PCC2_TICTL_COVF);
- sc->sc_pcc2reg->pcc2_t1irq = (PCC2_TTIRQ_ICLR|IPL_CLOCK);
-
- sc->sc_pcc2reg->pcc2_t2ctl &= ~(PCC2_TICTL_CEN);
- sc->sc_pcc2reg->pcc2_t2cntr= 0;
- sc->sc_pcc2reg->pcc2_t2ctl |= (PCC2_TICTL_COC|PCC2_TICTL_COVF);
- sc->sc_pcc2reg->pcc2_t2irq = (PCC2_TTIRQ_ICLR|IPL_CLOCK);
+ printf("\n");
+}
/*
- * Establish inerrupt handlers.
+ * clockintr: ack intr and call hardclock
*/
- clockintrhand.ih_fn = clockintr;
- clockintrhand.ih_arg = 0; /* don't want anything */
- clockintrhand.ih_ipl = IPL_CLOCK;
- clockintrhand.ih_wantframe = 1;
- intr_establish(PCC2_VECT+9, &clockintrhand);
-
- statintrhand.ih_fn = statintr;
- statintrhand.ih_arg = 0; /* don't want anything */
- statintrhand.ih_ipl = IPL_CLOCK;
- statintrhand.ih_wantframe = 1;
- intr_establish(PCC2_VECT+8, &statintrhand);
-
- timerok = 1;
+int
+clockintr(arg)
+ void *arg;
+{
+ sys_pcc2->pcc2_t1irq = prof_reset;
+ hardclock(arg);
+#include "bugtty.h"
+#if NBUGTTY > 0
+ bugtty_chkinput();
+#endif /* NBUGTTY */
+ return (1);
}
/*
- * Set up the real-time and statistics clocks. Leave stathz 0 only if
- * no alternative timer is available. mvme167/mvme187 has 2 tick timers
- * in pcc2 - we are using timer 1 for clock interrupt and timer 2 for
- * statistics.
- *
- * The frequencies of these clocks must be an even number of microseconds.
+ * Set up real-time clock; we don't have a statistics clock at
+ * present.
*/
cpu_initclocks()
{
register int statint, minint;
- volatile struct pcc2reg *pcc2reg;
-
- pcc2reg = ((struct clocksoftc *)clock_cd.cd_devs[0])->sc_pcc2reg;
if (1000000 % hz) {
printf("cannot get %d Hz clock; using 100 Hz\n", hz);
@@ -227,91 +231,41 @@ cpu_initclocks()
minint = statint / 2 + 100;
while (statvar > minint)
statvar >>= 1;
- /*
- * hz value 100 means we want the clock to interrupt 100
- * times a sec or 100 times in 1000000 us ie, 1 interrupt
- * every 10000 us. Program the tick timer compare register
- * to this value.
- */
- pcc2reg->pcc2_t1cmp = tick;
- pcc2reg->pcc2_t2cmp = statint;
- statmin = statint - (statvar >> 1);
- /* start the clocks ticking */
- pcc2reg->pcc2_t1ctl = (PCC2_TICTL_CEN|PCC2_TICTL_COC|PCC2_TICTL_COVF);
- pcc2reg->pcc2_t2ctl = (PCC2_TICTL_CEN|PCC2_TICTL_COC|PCC2_TICTL_COVF);
- /* and enable those interrupts */
- pcc2reg->pcc2_t1irq |= (PCC2_TTIRQ_IEN|PCC2_TTIRQ_ICLR);
- pcc2reg->pcc2_t2irq |= (PCC2_TTIRQ_IEN|PCC2_TTIRQ_ICLR);
-}
+ /* profclock */
+ sys_pcc2->pcc2_t1ctl = 0;
+ sys_pcc2->pcc2_t1cmp = pcc2_timer_us2lim(tick);
+ sys_pcc2->pcc2_t1count = 0;
+ sys_pcc2->pcc2_t1ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC |
+ PCC2_TCTL_COVF;
+ sys_pcc2->pcc2_t1irq = prof_reset;
+
+ /* statclock */
+ sys_pcc2->pcc2_t2ctl = 0;
+ sys_pcc2->pcc2_t2cmp = pcc2_timer_us2lim(statint);
+ sys_pcc2->pcc2_t2count = 0;
+ sys_pcc2->pcc2_t2ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC |
+ PCC2_TCTL_COVF;
+ sys_pcc2->pcc2_t2irq = stat_reset;
-/*
- * Dummy setstatclockrate(), since we know profhz==hz.
- */
-/* ARGSUSED */
-void
-setstatclockrate(int newhz)
-{
- /* nothing */
+ statmin = statint - (statvar >> 1);
}
-/*
- * Delay: wait for `about' n microseconds to pass.
- */
void
-delay(volatile u_long n)
-{
- volatile u_long cnt = n * delay_factor;
-
- while (cnt-- > 0) {
- asm volatile("");
- }
-}
-
-/*
- * Clock interrupt handler. Calls hardclock() after setting up a
- * clockframe.
- */
-int
-clockintr(void *cap, void *frame)
+setstatclockrate(newhz)
+ int newhz;
{
- volatile struct pcc2reg *reg;
-
- reg = ((struct clocksoftc *)clock_cd.cd_devs[0])->sc_pcc2reg;
-
- /* Clear the interrupt */
- reg->pcc2_t1irq = (PCC2_TTIRQ_IEN|PCC2_TTIRQ_ICLR|IPL_CLOCK);
-#if 0
- reg->pcc2_t1irq |= PCC2_TTIRQ_ICLR;
-#endif /* 0 */
-
- hardclock((struct clockframe *)frame);
-#include "bugtty.h"
-#if NBUGTTY > 0
- bugtty_chkinput();
-#endif /* NBUGTTY */
-
- return (1);
}
-/*
- * Stat clock interrupt handler.
- */
int
-statintr(void *cap, void *frame)
+statintr(cap)
+ void *cap;
{
- volatile struct pcc2reg *reg;
register u_long newint, r, var;
- reg = ((struct clocksoftc *)clock_cd.cd_devs[0])->sc_pcc2reg;
-
- /* Clear the interrupt */
-#if 0
- reg->pcc2_t2irq |= PCC2_TTIRQ_ICLR;
-#endif /* 0 */
- reg->pcc2_t2irq = (PCC2_TTIRQ_IEN|PCC2_TTIRQ_ICLR|IPL_CLOCK);
+ sys_pcc2->pcc2_t2irq = stat_reset;
- statclock((struct clockframe *)frame);
+ statclock((struct clockframe *)cap);
/*
* Compute new randomized interval. The intervals are uniformly
@@ -324,48 +278,27 @@ statintr(void *cap, void *frame)
} while (r == 0);
newint = statmin + r;
- /*
- * reprogram statistics timer to interrupt at
- * newint us intervals.
- */
- reg->pcc2_t2ctl = ~(PCC2_TICTL_CEN);
- reg->pcc2_t2cntr = 0;
- reg->pcc2_t2cmp = newint;
- reg->pcc2_t2ctl = (PCC2_TICTL_CEN|PCC2_TICTL_COC|PCC2_TICTL_COVF);
- reg->pcc2_t2irq |= (PCC2_TTIRQ_ICLR|PCC2_TTIRQ_IEN);
+ sys_pcc2->pcc2_t2ctl = 0;
+ sys_pcc2->pcc2_t2cmp = pcc2_timer_us2lim(newint);
+ sys_pcc2->pcc2_t2count = 0; /* should I? */
+ sys_pcc2->pcc2_t2irq = stat_reset;
+ sys_pcc2->pcc2_t2ctl = PCC2_TCTL_CEN | PCC2_TCTL_COC;
return (1);
}
-/*
- * Return the best possible estimate of the time in the timeval
- * to which tvp points. We do this by returning the current time
- * plus the amount of time since the last clock interrupt.
- *
- * Check that this time is no less than any previously-reported time,
- * which could happen around the time of a clock adjustment. Just for
- * fun, we guarantee that the time will be greater than the value
- * obtained by a previous call.
- */
-void
-microtime(tvp)
- register struct timeval *tvp;
+delay(us)
+ register int us;
{
- int s;
- static struct timeval lasttime;
-
- s = splhigh();
- *tvp = time;
- while (tvp->tv_usec > 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- if (tvp->tv_sec == lasttime.tv_sec &&
- tvp->tv_usec <= lasttime.tv_usec &&
- (tvp->tv_usec = lasttime.tv_usec + 1) > 1000000) {
- tvp->tv_sec++;
- tvp->tv_usec -= 1000000;
- }
- lasttime = *tvp;
- splx(s);
+ volatile register int c;
+
+ /*
+ * XXX MVME167 doesn't have a 3rd free-running timer,
+ * so we use a stupid loop. Fix the code to watch t1:
+ * the profiling timer.
+ */
+ c = 4 * us;
+ while (--c > 0)
+ ;
+ return (0);
}
diff --git a/sys/arch/mvme88k/dev/clockreg.h b/sys/arch/mvme88k/dev/clockreg.h
index e2222446f1c..cb66b35e243 100644
--- a/sys/arch/mvme88k/dev/clockreg.h
+++ b/sys/arch/mvme88k/dev/clockreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: clockreg.h,v 1.5 1994/11/20 20:54:07 deraadt Exp $ */
+/* $OpenBSD: clockreg.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*
* Copyright (c) 1992, 1993
diff --git a/sys/arch/mvme88k/dev/clreg.h b/sys/arch/mvme88k/dev/clreg.h
index e2aead59379..8377578d063 100644
--- a/sys/arch/mvme88k/dev/clreg.h
+++ b/sys/arch/mvme88k/dev/clreg.h
@@ -1,5 +1,5 @@
-/* $NetBSD$ */
-/*
+/* $OpenBSD: clreg.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
+/* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Dale Rahn. All rights reserved.
*
*
@@ -30,136 +30,136 @@
*/
struct clreg {
- volatile u_char anon1[0x7];
- volatile u_char cl_cor7; /* 0x07 */
- volatile u_char anon2[0x1];
- volatile u_char cl_livr; /* 0x09 */
+ volatile u_char anon1[0x7];
+ volatile u_char cl_cor7; /* 0x07 */
+ volatile u_char anon2[0x1];
+ volatile u_char cl_livr; /* 0x09 */
volatile u_char anon3[0x6];
- volatile u_char cl_cor1; /* 0x10 */
- volatile u_char cl_ier; /* 0x11 */
- volatile u_char cl_stcr; /* 0x12 */
- volatile u_char cl_ccr; /* 0x13 */
- volatile u_char cl_cor5; /* 0x14 */
- volatile u_char cl_cor4; /* 0x15 */
- volatile u_char cl_cor3; /* 0x16 */
- volatile u_char cl_cor2; /* 0x17 */
- volatile u_char cl_cor6; /* 0x18 */
- volatile u_char cl_dmabsts; /* 0x19 */
- volatile u_char cl_csr; /* 0x1a */
- volatile u_char cl_cmr; /* 0x1b */
- volatile u_char cl_schr4; /* 0x1c */
- volatile u_char cl_schr3; /* 0x1d */
- volatile u_char cl_schr2; /* 0x1e */
- volatile u_char cl_schr1; /* 0x1f */
- volatile u_char anon5[0x2];
- volatile u_char cl_scrh; /* 0x22 */
- volatile u_char cl_scrl; /* 0x23 */
+ volatile u_char cl_cor1; /* 0x10 */
+ volatile u_char cl_ier; /* 0x11 */
+ volatile u_char cl_stcr; /* 0x12 */
+ volatile u_char cl_ccr; /* 0x13 */
+ volatile u_char cl_cor5; /* 0x14 */
+ volatile u_char cl_cor4; /* 0x15 */
+ volatile u_char cl_cor3; /* 0x16 */
+ volatile u_char cl_cor2; /* 0x17 */
+ volatile u_char cl_cor6; /* 0x18 */
+ volatile u_char cl_dmabsts; /* 0x19 */
+ volatile u_char cl_csr; /* 0x1a */
+ volatile u_char cl_cmr; /* 0x1b */
+ volatile u_char cl_schr4; /* 0x1c */
+ volatile u_char cl_schr3; /* 0x1d */
+ volatile u_char cl_schr2; /* 0x1e */
+ volatile u_char cl_schr1; /* 0x1f */
+ volatile u_char anon5[0x2];
+ volatile u_char cl_scrh; /* 0x22 */
+ volatile u_char cl_scrl; /* 0x23 */
#define cl_rtpr rtpr.rtpr_rtpr
#define cl_rtprh rtpr.hl.rtpr_rtprh
#define cl_rtprl rtpr.hl.rtpr_rtprl
union {
- volatile u_short rtpr_rtpr; /* 0x24 */
+ volatile u_short rtpr_rtpr; /* 0x24 */
struct {
- volatile u_char rtpr_rtprh; /* 0x24 */
- volatile u_char rtpr_rtprl; /* 0x25 */
+ volatile u_char rtpr_rtprh; /* 0x24 */
+ volatile u_char rtpr_rtprl; /* 0x25 */
}hl;
}rtpr;
- volatile u_char cl_licr; /* 0x26 */
- volatile u_char anon6[0x7];
- volatile u_char cl_lnxt; /* 0x2e */
- volatile u_char anon7[0x1];
- volatile u_char cl_rfoc; /* 0x30 */
- volatile u_char anon8[0x7];
- volatile u_short cl_tcbadru; /* 0x38 */
- volatile u_short cl_tcbadrl; /* 0x3a */
- volatile u_short cl_rcbadru; /* 0x3c */
- volatile u_short cl_rcbadrl; /* 0x3e */
- volatile u_short cl_arbadru; /* 0x40 */
- volatile u_short cl_arbadrl; /* 0x42 */
- volatile u_short cl_brbadru; /* 0x44 */
- volatile u_short cl_brbadrl; /* 0x46 */
- volatile u_short cl_brbcnt; /* 0x48 */
- volatile u_short cl_arbcnt; /* 0x4a */
- volatile u_char anoni[0x2];
- volatile u_char cl_brbsts; /* 0x4e */
- volatile u_char cl_arbsts; /* 0x4f */
+ volatile u_char cl_licr; /* 0x26 */
+ volatile u_char anon6[0x7];
+ volatile u_char cl_lnxt; /* 0x2e */
+ volatile u_char anon7[0x1];
+ volatile u_char cl_rfoc; /* 0x30 */
+ volatile u_char anon8[0x7];
+ volatile u_short cl_tcbadru; /* 0x38 */
+ volatile u_short cl_tcbadrl; /* 0x3a */
+ volatile u_short cl_rcbadru; /* 0x3c */
+ volatile u_short cl_rcbadrl; /* 0x3e */
+ volatile u_short cl_arbadru; /* 0x40 */
+ volatile u_short cl_arbadrl; /* 0x42 */
+ volatile u_short cl_brbadru; /* 0x44 */
+ volatile u_short cl_brbadrl; /* 0x46 */
+ volatile u_short cl_brbcnt; /* 0x48 */
+ volatile u_short cl_arbcnt; /* 0x4a */
+ volatile u_char anoni[0x2];
+ volatile u_char cl_brbsts; /* 0x4e */
+ volatile u_char cl_arbsts; /* 0x4f */
#define cl_atbadr atbadr.atbadr
#define cl_atbadru atbadr.hl.atbadru
#define cl_atbadrl atbadr.hl.atbadrl
union {
struct {
- volatile u_short atbadru; /* 0x50 */
- volatile u_short atbadrl; /* 0x52 */
+ volatile u_short atbadru; /* 0x50 */
+ volatile u_short atbadrl; /* 0x52 */
}hl;
- volatile u_long atbadr; /* 0x50 */
+ volatile u_long atbadr; /* 0x50 */
}atbadr;
#define cl_btbadr btbadr.btbadr
#define cl_btbadru btbadr.hl.btbadru
#define cl_btbadrl btbadr.hl.btbadrl
union {
struct {
- volatile u_short btbadru; /* 0x54 */
- volatile u_short btbadrl; /* 0x56 */
+ volatile u_short btbadru; /* 0x54 */
+ volatile u_short btbadrl; /* 0x56 */
}hl;
- volatile u_long btbadr; /* 0x54 */
+ volatile u_long btbadr; /* 0x54 */
}btbadr;
- volatile u_short cl_btbcnt; /* 0x58 */
- volatile u_short cl_atbcnt; /* 0x5a */
- volatile u_char anono[0x2];
- volatile u_char cl_btbsts; /* 0x5e */
- volatile u_char cl_atbsts; /* 0x5f */
- volatile u_char anonp[0x20];
- volatile u_char cl_tftc; /* 0x80 */
- volatile u_char cl_gfrcr; /* 0x81 */
- volatile u_char anonq[0x2];
- volatile u_char cl_reoir; /* 0x84 */
- volatile u_char cl_teoir; /* 0x85 */
- volatile u_char cl_meoir; /* 0x86 */
- volatile u_char anonr[0x1];
+ volatile u_short cl_btbcnt; /* 0x58 */
+ volatile u_short cl_atbcnt; /* 0x5a */
+ volatile u_char anono[0x2];
+ volatile u_char cl_btbsts; /* 0x5e */
+ volatile u_char cl_atbsts; /* 0x5f */
+ volatile u_char anonp[0x20];
+ volatile u_char cl_tftc; /* 0x80 */
+ volatile u_char cl_gfrcr; /* 0x81 */
+ volatile u_char anonq[0x2];
+ volatile u_char cl_reoir; /* 0x84 */
+ volatile u_char cl_teoir; /* 0x85 */
+ volatile u_char cl_meoir; /* 0x86 */
+ volatile u_char anonr[0x1];
#define cl_risr risr.risr_risr
#define cl_risrl risr.hl.risr_risrl
#define cl_risrh risr.hl.risr_risrh
union {
- volatile u_short risr_risr; /* 0x88 */
+ volatile u_short risr_risr; /* 0x88 */
struct {
- volatile u_char risr_risrh; /* 0x88 */
- volatile u_char risr_risrl; /* 0x89 */
+ volatile u_char risr_risrh; /* 0x88 */
+ volatile u_char risr_risrl; /* 0x89 */
}hl;
}risr;
- volatile u_char cl_tisr; /* 0x8a */
- volatile u_char cl_misr; /* 0x8b */
- volatile u_char anons[0x2];
- volatile u_char cl_bercnt; /* 0x8e */
- volatile u_char anont[0x31];
- volatile u_char cl_tcor; /* 0xc0 */
- volatile u_char anonu[0x2];
- volatile u_char cl_tbpr; /* 0xc3 */
- volatile u_char anonv[0x4];
- volatile u_char cl_rcor; /* 0xc8 */
- volatile u_char anonw[0x2];
- volatile u_char cl_rbpr; /* 0xcb */
- volatile u_char anonx[0xa];
- volatile u_char cl_cpsr; /* 0xd6 */
- volatile u_char anony[0x3];
- volatile u_char cl_tpr; /* 0xda */
- volatile u_char anonz[0x3];
- volatile u_char cl_msvr_rts; /* 0xde */
- volatile u_char cl_msvr_dtr; /* 0xdf */
- volatile u_char cl_tpilr; /* 0xe0 */
- volatile u_char cl_rpilr; /* 0xe1 */
- volatile u_char cl_stk; /* 0xe2 */
- volatile u_char cl_mpilr; /* 0xe3 */
- volatile u_char anonA[0x8];
- volatile u_char cl_tir; /* 0xec */
- volatile u_char cl_rir; /* 0xed */
- volatile u_char cl_car; /* 0xee */
- volatile u_char cl_mir; /* 0xef */
- volatile u_char anonB[0x6];
- volatile u_char cl_dmr; /* 0xf6 */
- volatile u_char anonC[0x1];
+ volatile u_char cl_tisr; /* 0x8a */
+ volatile u_char cl_misr; /* 0x8b */
+ volatile u_char anons[0x2];
+ volatile u_char cl_bercnt; /* 0x8e */
+ volatile u_char anont[0x31];
+ volatile u_char cl_tcor; /* 0xc0 */
+ volatile u_char anonu[0x2];
+ volatile u_char cl_tbpr; /* 0xc3 */
+ volatile u_char anonv[0x4];
+ volatile u_char cl_rcor; /* 0xc8 */
+ volatile u_char anonw[0x2];
+ volatile u_char cl_rbpr; /* 0xcb */
+ volatile u_char anonx[0xa];
+ volatile u_char cl_cpsr; /* 0xd6 */
+ volatile u_char anony[0x3];
+ volatile u_char cl_tpr; /* 0xda */
+ volatile u_char anonz[0x3];
+ volatile u_char cl_msvr_rts; /* 0xde */
+ volatile u_char cl_msvr_dtr; /* 0xdf */
+ volatile u_char cl_tpilr; /* 0xe0 */
+ volatile u_char cl_rpilr; /* 0xe1 */
+ volatile u_char cl_stk; /* 0xe2 */
+ volatile u_char cl_mpilr; /* 0xe3 */
+ volatile u_char anonA[0x8];
+ volatile u_char cl_tir; /* 0xec */
+ volatile u_char cl_rir; /* 0xed */
+ volatile u_char cl_car; /* 0xee */
+ volatile u_char cl_mir; /* 0xef */
+ volatile u_char anonB[0x6];
+ volatile u_char cl_dmr; /* 0xf6 */
+ volatile u_char anonC[0x1];
#define cl_rdr cl_tdr
- volatile u_char cl_tdr; /* 0xf8 */
- volatile u_char anonD[7];
+ volatile u_char cl_tdr; /* 0xf8 */
+ volatile u_char anonD[7];
};
diff --git a/sys/arch/mvme88k/dev/i82586.h b/sys/arch/mvme88k/dev/i82586.h
index fb6e2b1090f..f0bf80ade44 100644
--- a/sys/arch/mvme88k/dev/i82586.h
+++ b/sys/arch/mvme88k/dev/i82586.h
@@ -1,6 +1,7 @@
-/* $Id: i82586.h,v 1.1 1997/03/03 19:32:07 rahnds Exp $ */
+/* $OpenBSD: i82586.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*-
+ * Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1992, University of Vermont and State Agricultural College.
* Copyright (c) 1992, Garrett A. Wollman.
diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c
index 859e26b41b0..b832953497a 100644
--- a/sys/arch/mvme88k/dev/if_ie.c
+++ b/sys/arch/mvme88k/dev/if_ie.c
@@ -1,6 +1,7 @@
-/* $Id: if_ie.c,v 1.1 1997/03/03 19:32:06 rahnds Exp $ */
+/* $Id: if_ie.c,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*-
+ * Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1993, 1994, 1995 Charles Hannum.
* Copyright (c) 1992, 1993, University of Vermont and State
@@ -288,7 +289,7 @@ struct ie_softc {
struct mcreg *sc_mc;
#endif
#if NPCCTWO > 0
- struct pcc2reg *sc_pcc2;
+ struct pcctworeg *sc_pcc2;
#endif
};
@@ -339,13 +340,12 @@ struct cfdriver ie_cd = {
* MK_16 = KVA -> 16 bit address in INTEL byte order
* ST_24 = store a 24 bit address in SUN byte order to INTEL byte order
*/
-
-#define MK_24(base, ptr) ((caddr_t)(((u_long)(ptr)) & 0x00ffffff))
+#define MK_24(base, ptr) ((caddr_t)((u_long)ptr))
#define MK_16(base, ptr) SWAP((u_short)( ((u_long)(ptr)) - ((u_long)(base)) ))
#define ST_24(to, from) { \
u_long fval = (u_long)(from); \
u_char *t = (u_char *)&(to), *f = (u_char *)&fval; \
- t[0] = f[2]; t[1] = f[3]; t[2] = 0; t[3] = f[1]; \
+ t[0] = f[2]; t[1] = f[3]; /*t[2] = f[0]*/; t[3] = f[1]; \
}
/*
* Here are a few useful functions. We could have done these as macros, but
@@ -388,39 +388,13 @@ iematch(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
-
-#if defined(MVME187)
- caddr_t base;
- if (cputyp != CPU_187)
- {
- return 0;
- }
-
- /*
- * If bus or name do not match, fail.
- */
- if (ca->ca_bustype != BUS_PCCTWO ||
- strcmp(cf->cf_driver->cd_name, "ie")) {
- return 0;
- }
-
- base = (caddr_t)cf->cf_loc[0];
-
- if (badpaddr(base, 1) == -1) {
- return 0;
+ int ret;
+
+ if ((ret = badvaddr(IIOV(ca->ca_vaddr), 1)) <=0){
+ printf("==> ie: failed address check returning %ld.\n", ret);
+ return(0);
}
-
- /*
- * tell our parent our requirements
- */
- ca->ca_paddr = (caddr_t)LANCE_ADDR;
- ca->ca_size = 0x1000;
- ca->ca_ipl = IPL_NET;
-
- return 1;
-#else
- return (!badvaddr(ca->ca_vaddr, 4));
-#endif
+ return (1);
}
/*
@@ -433,25 +407,18 @@ ie_obreset(sc)
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
volatile int t;
u_long a;
- u_long b;
- /*
- * Convert a to the format the chip expects before writing
- * the high and low (16 bit) words of the CPU port.
- */
a = IE_PORT_RESET;
- ST_24(b, a);
- ieo->porthigh = b >> 16;
+ ieo->porthigh = a & 0xffff;
t = 0; t = 1;
- ieo->portlow = b & 0xffff;
+ ieo->portlow = a >> 16;
delay(1000);
- a = (u_long)pmap_extract(pmap_kernel(), (vm_offset_t)sc->scp)
- | IE_PORT_NEWSCPADDR;
- ST_24(b, a);
- ieo->porthigh = b >> 16;
+ a = (u_long)pmap_extract(pmap_kernel(), (vm_offset_t)sc->scp) |
+ IE_PORT_NEWSCPADDR;
+ ieo->porthigh = a & 0xffff;
t = 0; t = 1;
- ieo->portlow = b & 0xffff;
+ ieo->portlow = a >> 16;
delay(1000);
}
@@ -496,14 +463,10 @@ ieattach(parent, self, aux)
sc->sc_reg = ca->ca_vaddr;
ieo = (volatile struct ieob *) sc->sc_reg;
-#if XXXX
- /* Don't know what this yet XXX nivas */
/* Are we the boot device? */
if (ca->ca_paddr == bootaddr)
bootdv = self;
-#endif
-#if 0
sc->sc_maddr = etherbuf; /* maddr = vaddr */
pa = pmap_extract(pmap_kernel(), (vm_offset_t)sc->sc_maddr);
if (pa == 0) panic("ie pmap_extract");
@@ -521,28 +484,6 @@ ieattach(parent, self, aux)
/*printf("scpV %x iscpV %x scbV %x\n", sc->scp, sc->iscp, sc->scb);*/
sc->scp->ie_bus_use = 0; /* 16-bit */
-#endif /* 0 */
- sc->sc_maddr = etherbuf; /* maddr = vaddr */
- pa = pmap_extract(pmap_kernel(), (vm_offset_t)sc->sc_maddr);
- if (pa == 0) panic("ie pmap_extract");
- sc->sc_iobase = (caddr_t)pa; /* iobase = paddr (24 bit) */
-
- (sc->memzero)(sc->sc_maddr, sc->sc_msize);
-
- sc->scb = (volatile struct ie_sys_ctl_block *)
- sc->sc_maddr; /* @ location zero */
- sc->scp = (struct ie_sys_conf_ptr *)
- roundup((int)sc->scb + sizeof(struct ie_sys_ctl_block), 16);
- sc->iscp = (volatile struct ie_int_sys_conf_ptr *)
- roundup((int)sc->scp + sizeof(struct ie_sys_conf_ptr), 16);
-
- /*printf("maddrV %x iobaseP %x\n", sc->sc_maddr, sc->sc_iobase);*/
- /*printf("scpV %x iscpV %x scbV %x\n", sc->scp, sc->iscp, sc->scb);*/
-
- /*
- * init scp; iscp will be inited later in ie_setupram().
- */
- sc->scp->ie_bus_use = 0; /* 8-bit */
ST_24(sc->scp->ie_iscp_ptr,
pmap_extract(pmap_kernel(), (vm_offset_t)sc->iscp));
@@ -603,13 +544,12 @@ ieattach(parent, self, aux)
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
-
- intr_establish(PCC2_VECT + LANCIRQ, &sc->sc_ih);
- sc->sc_pcc2 = (struct pcc2reg *)ca->ca_parent;
- sc->sc_pcc2->pcc2_lancirq = pri |
+ pcctwointr_establish(PCC2V_IE, &sc->sc_ih);
+ sc->sc_pcc2 = (struct pcctworeg *)ca->ca_master;
+ sc->sc_pcc2->pcc2_ieirq = pri | PCC2_SC_SNOOP |
PCC2_IRQ_IEN | PCC2_IRQ_ICLR;
- intr_establish(PCC2_VECT + LANCERR, &sc->sc_failih);
- sc->sc_pcc2->pcc2_lancerrirq = pri | PCC2_IRQ_IEN |
+ pcctwointr_establish(PCC2V_IEFAIL, &sc->sc_failih);
+ sc->sc_pcc2->pcc2_iefailirq = pri | PCC2_IRQ_IEN |
PCC2_IRQ_ICLR;
break;
#endif
@@ -650,9 +590,9 @@ void *v;
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
- sc->sc_pcc2->pcc2_lancirq |= PCC2_IRQ_ICLR; /* safe: clear irq */
- sc->sc_pcc2->pcc2_lancerrirq |= PCC2_IRQ_ICLR; /* clear failure */
- sc->sc_pcc2->pcc2_lancerrstat = PCC2_IEERR_SCLR; /* reset error */
+ sc->sc_pcc2->pcc2_ieirq |= PCC2_IRQ_ICLR; /* safe: clear irq */
+ sc->sc_pcc2->pcc2_iefailirq |= PCC2_IRQ_ICLR; /* clear failure */
+ sc->sc_pcc2->pcc2_ieerr = PCC2_IEERR_SCLR; /* reset error */
break;
#endif
}
@@ -685,7 +625,7 @@ loop:
#endif
#if NPCCTWO > 0
case BUS_PCCTWO:
- sc->sc_pcc2->pcc2_lancirq |= PCC2_IRQ_ICLR; /* clear irq */
+ sc->sc_pcc2->pcc2_ieirq |= PCC2_IRQ_ICLR; /* clear irq */
break;
#endif
}
diff --git a/sys/arch/mvme88k/dev/if_ie.h b/sys/arch/mvme88k/dev/if_ie.h
index 78d1301fcb3..42b1a0edae0 100644
--- a/sys/arch/mvme88k/dev/if_ie.h
+++ b/sys/arch/mvme88k/dev/if_ie.h
@@ -1,6 +1,6 @@
-/* $Id: if_ie.h,v 1.1 1997/03/03 19:32:05 rahnds Exp $ */
+/* $OpenBSD: if_ie.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
-/*
+/* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1995 Theo de Raadt
* All rights reserved.
*
diff --git a/sys/arch/mvme88k/dev/mainbus.c b/sys/arch/mvme88k/dev/mainbus.c
index e51e630493b..49e002f1075 100644
--- a/sys/arch/mvme88k/dev/mainbus.c
+++ b/sys/arch/mvme88k/dev/mainbus.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: mainbus.c,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
+/* Copyright (c) 1998 Steve Murphree, Jr. */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/reboot.h>
@@ -8,17 +10,11 @@
#include <machine/cpu.h>
#include <machine/autoconf.h>
-void mbattach __P((struct device *, struct device *, void *));
-int mbprint __P((void *, const char *));
-int mbmatch __P((struct device *, void *, void *));
-int submatch __P((struct device *, void *, void *));
-
-/*
- * mainbus driver
- */
+void mainbus_attach __P((struct device *, struct device *, void *));
+int mainbus_match __P((struct device *, void *, void *));
struct cfattach mainbus_ca = {
- sizeof(struct device), mbmatch, mbattach
+ sizeof(struct device), mainbus_match, mainbus_attach
};
struct cfdriver mainbus_cd = {
@@ -26,70 +22,59 @@ struct cfdriver mainbus_cd = {
};
int
-mbmatch(struct device *pdp, void *self, void *auxp)
+mainbus_match(parent, cf, args)
+ struct device *parent;
+ void *cf;
+ void *args;
{
- struct cfdata *cfp = self;
-
- if (cfp->cf_unit > 0)
- return(0);
- /*
- * We are always here
- */
- return(1);
+ return (1);
}
-/*
- * "find" all the things that should be there.
- */
-void
-mbattach(struct device *pdp, struct device *dp, void *auxp)
+int
+mainbus_print(args, bus)
+ void *args;
+ const char *bus;
{
- struct cfdata *cf;
- extern int cputyp;
-
- /* nothing to do for this bus */
- printf (" machine type %x\n", cputyp);
-
- if ((cf = config_search(submatch, dp, auxp)) != NULL) {
- return;
- }
+ struct confargs *ca = args;
+ if (ca->ca_paddr != (void *)-1)
+ printf(" addr 0x%x", (u_int32_t)ca->ca_paddr);
+ return (UNCONF);
}
int
-mbprint(void *auxp, const char *pnp)
+mainbus_scan(parent, child, args)
+ struct device *parent;
+ void *child, *args;
{
- if (pnp)
- printf("%s at %s", (char *)auxp, pnp);
- return(UNCONF);
+ struct cfdata *cf = child;
+ struct confargs oca;
+
+ bzero(&oca, sizeof oca);
+ oca.ca_paddr = (void *)cf->cf_loc[0];
+ oca.ca_vaddr = (void *)-1;
+ oca.ca_ipl = -1;
+ oca.ca_bustype = BUS_MAIN;
+ oca.ca_name = cf->cf_driver->cd_name;
+ if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
+ return (0);
+ config_attach(parent, cf, &oca, mainbus_print);
+ return (1);
}
-int
-submatch(struct device *parent, void *self, void *aux)
+void
+mainbus_attach(parent, self, args)
+ struct device *parent, *self;
+ void *args;
{
- struct confargs *ca = aux;
- struct cfdata *cf = self;
-
- ca->ca_bustype = BUS_MAIN;
- ca->ca_paddr = (caddr_t)cf->cf_loc[0];
- ca->ca_size = cf->cf_loc[1];
-
- if (!(*cf->cf_attach->ca_match)(parent, cf, ca)) {
- if (!parent)
- cf->cf_fstate = FSTATE_FOUND;
-
- return 0;
- }
+ printf (" machine type %x\n", cputyp);
- /*
- * mapin the device memory of the child and call attach.
+ /* XXX
+ * should have a please-attach-first list for mainbus,
+ * to ensure that the pcc/vme2/mcc chips are attached
+ * first.
*/
-#if 0
- ca->ca_vaddr = (caddr_t)iomap_mapin(ca->ca_paddr, ca->ca_size, 1);
-#endif /* 0 */
- ca->ca_vaddr = ca->ca_paddr;
- config_attach(parent, cf, ca, mbprint);
-
- return 1;
+ (void)config_search(mainbus_scan, self, args);
}
+
diff --git a/sys/arch/mvme88k/dev/memc.c b/sys/arch/mvme88k/dev/memc.c
index 0cffad3f64b..f07337d3aec 100644
--- a/sys/arch/mvme88k/dev/memc.c
+++ b/sys/arch/mvme88k/dev/memc.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: memc.c,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
@@ -31,11 +32,9 @@
*/
/*
- * MEMC chip
- * XXX:
- * the databooks say that you should only ever access the higher-numbered
- * MEMC chip's control & status registers. this is strange. I disobey the
- * rules, hopefully there won't be any spanking.
+ * MEMC/MCECC chips
+ * these chips are rather similar in appearance except that the MEMC
+ * does parity while the MCECC does ECC.
*/
#include <sys/param.h>
#include <sys/conf.h>
@@ -58,7 +57,7 @@
struct memcsoftc {
struct device sc_dev;
- caddr_t sc_vaddr;
+ void * sc_vaddr;
struct memcreg *sc_memc;
struct intrhand sc_ih;
};
@@ -66,11 +65,16 @@ struct memcsoftc {
void memcattach __P((struct device *, struct device *, void *));
int memcmatch __P((struct device *, void *, void *));
-struct cfdriver memccd = {
- NULL, "memc", memcmatch, memcattach,
- DV_DULL, sizeof(struct memcsoftc), 0
+struct cfattach memc_ca = {
+ sizeof(struct memcsoftc), memcmatch, memcattach
};
+struct cfdriver memc_cd = {
+ NULL, "memc", DV_DULL, 0
+};
+
+/*int memcintr __P((struct frame *frame));*/
+
int
memcmatch(parent, vcf, args)
struct device *parent;
@@ -80,9 +84,11 @@ memcmatch(parent, vcf, args)
struct confargs *ca = args;
struct memcreg *memc = (struct memcreg *)ca->ca_vaddr;
- if (badvaddr(memc, 4) || memc->memc_chipid != MEMC_CHIPID)
+ if (badvaddr(memc, 1))
return (0);
- return (1);
+ if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID)
+ return (1);
+ return (0);
}
void
@@ -97,15 +103,33 @@ memcattach(parent, self, args)
* since we know ourself to land in intiobase land,
* we must adjust our address
*/
- sc->sc_memc = (struct memcreg *)sc->sc_vaddr;
+ sc->sc_memc = (struct memcreg *)ca->ca_vaddr;
- printf(": rev %d, unsupported\n", sc->sc_memc->memc_chiprev);
+ printf(": %s rev %d",
+ (sc->sc_memc->memc_chipid == MEMC_CHIPID) ? "MEMC040" : "MCECC",
+ sc->sc_memc->memc_chiprev);
#if 0
- sc->sc_nmiih.ih_fn = memcabort;
- sc->sc_nmiih.ih_arg = 0;
- sc->sc_nmiih.ih_ipl = 7;
- sc->sc_nmiih.ih_wantframe = 1;
- mcintr_establish(xxx, &sc->sc_nmiih);
+ sc->sc_ih.ih_fn = memcintr;
+ sc->sc_ih.ih_arg = 0;
+ sc->sc_ih.ih_ipl = 7;
+ sc->sc_ih.ih_wantframe = 1;
+ mcintr_establish(xxx, &sc->sc_ih);
#endif
+
+ switch (sc->sc_memc->memc_chipid) {
+ case MEMC_CHIPID:
+ break;
+ case MCECC_CHIPID:
+ break;
+ }
+
+ printf("\n");
}
+
+/*int
+memcintr(frame)
+ struct frame *frame;
+{
+ return (0);
+}*/
diff --git a/sys/arch/mvme88k/dev/memcreg.h b/sys/arch/mvme88k/dev/memcreg.h
index 304d35b6666..6295850a832 100644
--- a/sys/arch/mvme88k/dev/memcreg.h
+++ b/sys/arch/mvme88k/dev/memcreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: memcreg.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
@@ -31,7 +32,7 @@
*/
/*
- * the MEMC's registers are very similar to the MCECC chip
+ * the MEMC's registers are a subset of the MCECC chip
*/
struct memcreg {
volatile u_char memc_chipid;
@@ -40,10 +41,7 @@ struct memcreg {
volatile u_char xx1[3];
volatile u_char memc_memconf;
#define MEMC_MEMCONF_MSIZ 0x07
-/*
-#define MEMC_MEMCONF_RTOB(x) (((x) & MEMC_MEMCONF_MSIZ) * 4*1024*1024)
-*/
-#define MEMC_MEMCONF_RTOB(x) (1 << (((x) & MEMC_MEMCONF_MSIZ) + 22))
+#define MEMC_MEMCONF_RTOB(x) ((4*1024*1024) << ((x) & MEMC_MEMCONF_MSIZ))
volatile u_char xx2[3];
volatile u_char memc_x0;
volatile u_char xx3[3];
@@ -55,6 +53,55 @@ struct memcreg {
volatile u_char xx6[3];
volatile u_char memc_bclk;
volatile u_char xx7[3];
+
+ /* the following registers only exist on the MCECC */
+ volatile u_char memc_datactl;
+ volatile u_char xx8[3];
+ volatile u_char memc_scrubctl;
+ volatile u_char xx9[3];
+ volatile u_char memc_scrubperh;
+ volatile u_char xx10[3];
+ volatile u_char memc_scrubperl;
+ volatile u_char xx11[3];
+ volatile u_char memc_chipprescale;
+ volatile u_char xx12[3];
+ volatile u_char memc_scrubtime;
+ volatile u_char xx13[3];
+ volatile u_char memc_scrubprescaleh;
+ volatile u_char xx14[3];
+ volatile u_char memc_scrubprescalem;
+ volatile u_char xx15[3];
+ volatile u_char memc_scrubprescalel;
+ volatile u_char xx16[3];
+ volatile u_char memc_scrubtimeh;
+ volatile u_char xx17[3];
+ volatile u_char memc_scrubtimel;
+ volatile u_char xx18[3];
+ volatile u_char memc_scrubaddrhh;
+ volatile u_char xx19[3];
+ volatile u_char memc_scrubaddrhm;
+ volatile u_char xx20[3];
+ volatile u_char memc_scrubaddrlm;
+ volatile u_char xx21[3];
+ volatile u_char memc_scrubaddrll;
+ volatile u_char xx22[3];
+ volatile u_char memc_errlog;
+ volatile u_char xx23[3];
+ volatile u_char memc_errloghh;
+ volatile u_char xx24[3];
+ volatile u_char memc_errloghm;
+ volatile u_char xx25[3];
+ volatile u_char memc_errloglm;
+ volatile u_char xx26[3];
+ volatile u_char memc_errlogll;
+ volatile u_char xx27[3];
+ volatile u_char memc_errsyndrome;
+ volatile u_char xx28[3];
+ volatile u_char memc_defaults1;
+ volatile u_char xx29[3];
+ volatile u_char memc_defaults2;
+ volatile u_char xx30[3];
};
-#define MEMC_CHIPID 0x81
+#define MEMC_CHIPID 0x80
+#define MCECC_CHIPID 0x81
diff --git a/sys/arch/mvme88k/dev/memdevs.c b/sys/arch/mvme88k/dev/memdevs.c
index a966b8778cc..bb3163cc130 100644
--- a/sys/arch/mvme88k/dev/memdevs.c
+++ b/sys/arch/mvme88k/dev/memdevs.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: memdevs.c,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
diff --git a/sys/arch/mvme88k/dev/nvram.c b/sys/arch/mvme88k/dev/nvram.c
index 6a5a10c32c4..f34640f73f8 100644
--- a/sys/arch/mvme88k/dev/nvram.c
+++ b/sys/arch/mvme88k/dev/nvram.c
@@ -1,28 +1,62 @@
+/* $OpenBSD: nvram.c,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
+
+/*
+ * Copyright (c) 1995 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
#include <sys/param.h>
-#include <sys/conf.h>
-#include <sys/ioctl.h>
-#include <sys/proc.h>
-#include <sys/tty.h>
-#include <sys/uio.h>
-#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/ioctl.h>
#include <sys/device.h>
-#include <machine/cpu.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+#include <machine/psl.h>
#include <machine/autoconf.h>
-
+#include <machine/cpu.h>
+#include <machine/mioctl.h>
+#include <machine/vmparam.h>
#include <mvme88k/dev/nvramreg.h>
#include <mvme88k/dev/pcctworeg.h>
+
struct nvramsoftc {
struct device sc_dev;
- caddr_t sc_paddr;
- caddr_t sc_vaddr;
- int sc_size;
- volatile struct clockreg *sc_clockreg;
+ void * sc_paddr;
+ void * sc_vaddr;
+ int sc_len;
+ struct clockreg *sc_regs;
};
-int nvrammatch __P((struct device *, void *, void *));
void nvramattach __P((struct device *, struct device *, void *));
+int nvrammatch __P((struct device *, void *, void *));
struct cfattach nvram_ca = {
sizeof(struct nvramsoftc), nvrammatch, nvramattach
@@ -32,101 +66,86 @@ struct cfdriver nvram_cd = {
NULL, "nvram", DV_DULL, 0
};
-/* ARGSUSED */
int
-nvrammatch(struct device *parent, void *self, void *aux)
-{
- struct confargs *ca = aux;
- struct cfdata *cf = self;
- caddr_t base;
- int ret;
-
-#if 0
- if (cputyp != CPU_167 && cputyp != CPU_166
-#ifdef CPU_187
- && cputyp != CPU_187
-#endif
- )
+nvrammatch(parent, vcf, args)
+ struct device *parent;
+ void *vcf, *args;
{
- return 0;
- }
-#endif /* 0 */
-
- if (cputyp != CPU_187) {
- return 0;
- }
-
- /*
- * If bus or name do not match, fail.
- */
- if (ca->ca_bustype != BUS_PCCTWO ||
- strcmp(cf->cf_driver->cd_name, "nvram")) {
- return 0;
- }
-
-
- /* 3 locators base, size, ipl */
- base = (caddr_t)cf->cf_loc[0];
+ struct cfdata *cf = vcf;
+ struct confargs *ca = args;
- if (badpaddr(base, 1) == -1) {
- return 0;
- }
-
- /*
- * Tell our parent our requirements.
- */
- ca->ca_paddr = (caddr_t)cf->cf_loc[0];
- ca->ca_size = NVRAMSIZE;
- ca->ca_ipl = 0;
-
- return 1;
+/*X*/ if (ca->ca_vaddr == (void *)-1)
+/*X*/ return (1);
+ return (!badvaddr(ca->ca_vaddr, 1));
}
-/* ARGSUSED */
void
-nvramattach(struct device *parent, struct device *self, void *aux)
+nvramattach(parent, self, args)
+ struct device *parent, *self;
+ void *args;
{
+ struct confargs *ca = args;
struct nvramsoftc *sc = (struct nvramsoftc *)self;
- struct confargs *ca = aux;
- sc->sc_clockreg = (struct clockreg *)(ca->ca_vaddr + NVRAM_TOD_OFF);
+ sc->sc_paddr = ca->ca_paddr;
+ sc->sc_vaddr = ca->ca_vaddr;
+
+ sc->sc_len = MK48T08_SIZE;
- printf(": MK48T08\n");
+/*X*/ if (sc->sc_vaddr == (void *)-1)
+/*X*/ sc->sc_vaddr = mapiodev((void *)sc->sc_paddr,
+/*X*/ max(sc->sc_len, NBPG));
+/*X*/ if (sc->sc_vaddr == NULL)
+/*X*/ panic("failed to map!\n");
+
+ sc->sc_regs = (struct clockreg *)(sc->sc_vaddr + sc->sc_len -
+ sizeof(struct clockreg));
+
+ printf(": MK48T0%d len %d\n", sc->sc_len / 1024, sc->sc_len);
}
-#if 0
/*
- * Write en/dis-able clock registers. We coordinate so that several
- * writers can run simultaneously.
+ * Return the best possible estimate of the time in the timeval
+ * to which tvp points. We do this by returning the current time
+ * plus the amount of time since the last clock interrupt (clock.c:clkread).
+ *
+ * Check that this time is no less than any previously-reported time,
+ * which could happen around the time of a clock adjustment. Just for fun,
+ * we guarantee that the time will be greater than the value obtained by a
+ * previous call.
*/
void
-clk_wenable(onoff)
- int onoff;
+microtime(tvp)
+ register struct timeval *tvp;
{
- register int s;
- register vm_prot_t prot;/* nonzero => change prot */
- static int writers;
-
- s = splhigh();
- if (onoff)
- prot = writers++ == 0 ? VM_PROT_READ|VM_PROT_WRITE : 0;
- else
- prot = --writers == 0 ? VM_PROT_READ : 0;
+ int s = splhigh();
+ static struct timeval lasttime;
+
+ *tvp = time;
+ tvp->tv_usec;
+ while (tvp->tv_usec > 1000000) {
+ tvp->tv_sec++;
+ tvp->tv_usec -= 1000000;
+ }
+ if (tvp->tv_sec == lasttime.tv_sec &&
+ tvp->tv_usec <= lasttime.tv_usec &&
+ (tvp->tv_usec = lasttime.tv_usec + 1) > 1000000) {
+ tvp->tv_sec++;
+ tvp->tv_usec -= 1000000;
+ }
+ lasttime = *tvp;
splx(s);
- if (prot)
- pmap_changeprot(pmap_kernel(), (vm_offset_t)clockreg, prot, 1);
}
-#endif /* 0 */
/*
- * BCD to hex and hex to BCD.
+ * BCD to decimal and decimal to BCD.
*/
#define FROMBCD(x) (((x) >> 4) * 10 + ((x) & 0xf))
#define TOBCD(x) (((x) / 10 * 16) + ((x) % 10))
#define SECDAY (24 * 60 * 60)
#define SECYR (SECDAY * 365)
-#define LEAPYEAR(y) (((y) % 4 == 0) && ((y) % 100) != 0 || ((y) % 400) == 0)
+#define LEAPYEAR(y) (((y) & 3) == 0)
/*
* This code is defunct after 2068.
@@ -135,7 +154,9 @@ clk_wenable(onoff)
const short dayyr[12] =
{ 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
-chiptotime(int sec, int min, int hour, int day, int mon, int year)
+static u_long
+chiptotime(sec, min, hour, day, mon, year)
+ register int sec, min, hour, day, mon, year;
{
register int days, yr;
@@ -147,7 +168,7 @@ chiptotime(int sec, int min, int hour, int day, int mon, int year)
year = FROMBCD(year) + YEAR0;
/* simple sanity checks */
- if (year < 70 || mon < 1 || mon > 12 || day < 1 || day > 31)
+ if (year < 70 || year > 164 || mon < 1 || mon > 12 || day < 1 || day > 31)
return (0);
days = 0;
for (yr = 70; yr < year; yr++)
@@ -169,7 +190,8 @@ struct chiptime {
int year;
};
-timetochip(struct chiptime *c)
+timetochip(c)
+ register struct chiptime *c;
{
register int t, t2, t3, now = time.tv_sec;
@@ -216,16 +238,14 @@ timetochip(struct chiptime *c)
/*
* Set up the system's time, given a `reasonable' time value.
*/
-void
-inittodr(time_t base)
+void
+inittodr(base)
+ time_t base;
{
- register struct nvramsoftc *sc;
- register volatile struct clockreg *cl;
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0];
+ register struct clockreg *cl = sc->sc_regs;
int sec, min, hour, day, mon, year;
int badbase = 0, waszero = base == 0;
-
- sc = (struct nvramsoftc *)nvram_cd.cd_devs[0];
- cl = sc->sc_clockreg;
if (base < 5 * SECYR) {
/*
@@ -238,7 +258,6 @@ inittodr(time_t base)
base = 21*SECYR + 186*SECDAY + SECDAY/2;
badbase = 1;
}
-
cl->cl_csr |= CLK_READ; /* enable read (stop time) */
sec = cl->cl_sec;
min = cl->cl_min;
@@ -247,11 +266,8 @@ inittodr(time_t base)
mon = cl->cl_month;
year = cl->cl_year;
cl->cl_csr &= ~CLK_READ; /* time wears on */
-
- time.tv_sec = chiptotime(sec, min, hour, day, mon, year);
-
- if (time.tv_sec == 0) {
- printf("WARNING: bad date in battery clock");
+ if ((time.tv_sec = chiptotime(sec, min, hour, day, mon, year)) == 0) {
+ printf("WARNING: bad date in nvram");
/*
* Believe the time in the file system for lack of
* anything better, resetting the clock.
@@ -278,19 +294,15 @@ inittodr(time_t base)
* and when rebooting. Do nothing if the time is not yet known, e.g.,
* when crashing during autoconfig.
*/
-void
-resettodr()
+void resettodr()
{
- register struct nvramsoftc *sc;
- register volatile struct clockreg *cl;
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0];
+ register struct clockreg *cl = sc->sc_regs;
struct chiptime c;
- sc = (struct nvramsoftc *)nvram_cd.cd_devs[0];
-
- if (!time.tv_sec || (cl = sc->sc_clockreg) == NULL)
+ if (!time.tv_sec || cl == NULL)
return;
timetochip(&c);
-
cl->cl_csr |= CLK_WRITE; /* enable write */
cl->cl_sec = c.sec;
cl->cl_min = c.min;
@@ -301,3 +313,96 @@ resettodr()
cl->cl_year = c.year;
cl->cl_csr &= ~CLK_WRITE; /* load them up */
}
+
+/*ARGSUSED*/
+int
+nvramopen(dev, flag, mode)
+ dev_t dev;
+ int flag, mode;
+{
+ if (minor(dev) >= nvram_cd.cd_ndevs ||
+ nvram_cd.cd_devs[minor(dev)] == NULL)
+ return (ENODEV);
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+nvramclose(dev, flag, mode)
+ dev_t dev;
+ int flag, mode;
+{
+
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+nvramioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ caddr_t data;
+ int cmd, flag;
+ struct proc *p;
+{
+ int unit = minor(dev);
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
+ int error = 0;
+
+ switch (cmd) {
+ case MIOCGSIZ:
+ *(int *)data = sc->sc_len;
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return (error);
+}
+
+/*ARGSUSED*/
+int
+nvramread(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+ int unit = minor(dev);
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
+
+ return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
+}
+
+/*ARGSUSED*/
+int
+nvramwrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+ int unit = minor(dev);
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
+
+ return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
+}
+
+/*
+ * If the NVRAM is of the 2K variety, an extra 2K of who-knows-what
+ * will also be mmap'd, due to NBPG being 4K. On the MVME147 the NVRAM
+ * repeats, so userland gets two copies back-to-back.
+ */
+int
+nvrammmap(dev, off, prot)
+ dev_t dev;
+ int off, prot;
+{
+ int unit = minor(dev);
+ struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit];
+
+ if (minor(dev) != 0)
+ return (-1);
+
+ /* allow access only in RAM */
+ if (off > sc->sc_len)
+ return (-1);
+ return (m88k_btop(sc->sc_paddr + off));
+}
diff --git a/sys/arch/mvme88k/dev/nvramreg.h b/sys/arch/mvme88k/dev/nvramreg.h
index 4b92c0a5fd5..67de360c02e 100644
--- a/sys/arch/mvme88k/dev/nvramreg.h
+++ b/sys/arch/mvme88k/dev/nvramreg.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: nvramreg.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
+
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -79,10 +81,13 @@ struct clockreg {
struct clockreg *clockreg;
/*
- * Motorola chose the year `00' as their base count, so that
- * cl_year == 0 means 1900.
+ * Motorola chose the year `1900' as their base count.
+ * XXX what happens when it wraps?
*/
#define YEAR0 00
#define NVRAMSIZE 0x8000
#define NVRAM_TOD_OFF 0x1ff8 /* offset of tod in NVRAM space */
+#define MK48T02_SIZE 2*1024
+#define MK48T08_SIZE 8*1024
+
diff --git a/sys/arch/mvme88k/dev/pcctwo.c b/sys/arch/mvme88k/dev/pcctwo.c
index 7ad4c3abee1..4156a8f440e 100644
--- a/sys/arch/mvme88k/dev/pcctwo.c
+++ b/sys/arch/mvme88k/dev/pcctwo.c
@@ -1,210 +1,208 @@
+
+/* $OpenBSD: pcctwo.c,v 1.5 1998/12/15 05:52:30 smurph Exp $ */
+
+/*
+ * Copyright (c) 1995 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * VME18x PCC2 chip
+ */
#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/tty.h>
#include <sys/uio.h>
+#include <sys/callout.h>
#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/fcntl.h>
#include <sys/device.h>
#include <machine/cpu.h>
#include <machine/autoconf.h>
+#include <dev/cons.h>
#include <mvme88k/dev/pcctworeg.h>
struct pcctwosoftc {
- struct device sc_dev;
- volatile struct pcc2reg *sc_pcc2reg;
+ struct device sc_dev;
+ void *sc_vaddr; /* PCC2 space */
+ void *sc_paddr;
+ struct pcctworeg *sc_pcc2; /* the actual registers */
};
-int pcctwomatch __P((struct device *, void *, void *));
-int pcctwoscan __P((struct device *, void *, void *));
-void pcctwoattach __P((struct device *, struct device *, void *));
-
+void pcctwoattach __P((struct device *, struct device *, void *));
+int pcctwomatch __P((struct device *, void *, void *));
#ifdef MVME187
void setupiackvectors __P((void));
#endif /* MVME187 */
-struct cfattach pcctwo_ca = {
- sizeof(struct pcctwosoftc), pcctwomatch, pcctwoattach
+struct cfattach pcctwo_ca = {
+ sizeof(struct pcctwosoftc), pcctwomatch, pcctwoattach
};
struct cfdriver pcctwo_cd = {
- NULL, "pcctwo", DV_DULL, 0
-};
+ NULL, "pcctwo", DV_DULL, 0
+};
+
+struct pcctworeg *sys_pcc2 = NULL;
-/*ARGSUSED*/
int
-pcctwomatch(struct device *parent, void *self, void *aux)
+pcctwomatch(parent, vcf, args)
+ struct device *parent;
+ void *vcf, *args;
{
- int ret;
- u_char id, rev;
- caddr_t base;
- struct confargs *ca = aux;
- struct cfdata *cf = self;
-
-#if 0
- if (cputyp != CPU_167 && cputyp != CPU_166
-#ifdef MVME187
- && cputyp != CPU_187
-#endif
- )
- {
- return 0;
- }
-#endif /* 0 */
- if (cputyp != CPU_187) {
- return 0;
- }
-
- /*
- * If bus or name do not match, fail.
- */
- if (ca->ca_bustype != BUS_MAIN ||
- strcmp(cf->cf_driver->cd_name, "pcctwo")) {
- return 0;
+ struct cfdata *cf = vcf;
+ struct confargs *ca = args;
+ struct pcctworeg *pcc2;
+
+ /* Bomb if wrong cpu */
+ if (cputyp != CPU_187){
+ printf("==> pcctwo: wrong CPU type %x.\n", cputyp);
+ return (0);
}
- if ((base = (caddr_t)cf->cf_loc[0]) == (caddr_t)-1) {
- return 0;
+ pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr) + PCC2_PCC2CHIP_OFF);
+ if (badvaddr(pcc2, 4) <= 0){
+ printf("==> pcctwo: failed address check.\n");
+ return (0);
}
-
- id = badpaddr(base, 1);
- rev = badpaddr(base + 1, 1);
-
- if (id != PCC2_CHIP_ID || rev != PCC2_CHIP_REV) {
- return 0;
+ if (pcc2->pcc2_chipid != PCC2_CHIPID){
+ printf("==> pcctwo: wrong chip id %x.\n", pcc2->pcc2_chipid);
+ return (0);
}
-
- ca->ca_size = PCC2_SIZE;
- ca->ca_paddr = base;
-
- return 1;
+ return (1);
}
int
-pcctwoprint(void *aux, char *parent)
+pcctwo_print(args, bus)
+ void *args;
+ const char *bus;
{
- struct confargs *ca = aux;
-
- /*
- * We call pcctwoprint() via config_attach(). Parent
- * will always be null and config_attach() would have already
- * printed "nvram0 at pcctwo0".
- */
- printf(" addr %x size %x", ca->ca_paddr, ca->ca_size);
- if (ca->ca_ipl != -1) {
- printf(" ipl %x", ca->ca_ipl);
- }
+ struct confargs *ca = args;
+ if (ca->ca_offset != -1)
+ printf(" offset 0x%x", ca->ca_offset);
+ if (ca->ca_ipl > 0)
+ printf(" ipl %d", ca->ca_ipl);
return (UNCONF);
}
-/*ARGSUSED*/
int
-pcctwoscan(struct device *parent, void *self, void *aux)
+pcctwo_scan(parent, child, args)
+ struct device *parent;
+ void *child, *args;
{
- struct confargs ca;
- struct cfdata *cf = self;
+ struct cfdata *cf = child;
struct pcctwosoftc *sc = (struct pcctwosoftc *)parent;
-
- /*
- * Pcctwoscan gets called by config_search() for each
- * child of parent (pcctwo) specified in ioconf.c.
- * Fill in the bus type to be PCCTWO and call the child's
- * match routine. If the child's match returns 1, then
- * we need to allocate device memory, set it in confargs
- * and call config_attach(). This, in turn, will call the
- * child's attach.
- */
-
- ca.ca_bustype = BUS_PCCTWO;
-
- if ((*cf->cf_attach->ca_match)(parent, cf, &ca) == 0)
- return 0;
-
- /*
- * The child would have fixed up ca to reflect what its
- * requirements are.
- */
-
- if (cf->cf_loc[2] != ca.ca_ipl) {
- printf("Changing ipl %x specified in ioconf.c to %x for %s\n",
- cf->cf_loc[2], ca.ca_ipl, cf->cf_driver->cd_name);
+ struct confargs *ca = args;
+ struct confargs oca;
+
+ if (parent->dv_cfdata->cf_driver->cd_indirect) {
+ printf(" indirect devices not supported\n");
+ return 0;
+ }
+
+ bzero(&oca, sizeof oca);
+ oca.ca_offset = cf->cf_loc[0];
+ oca.ca_ipl = cf->cf_loc[1];
+ if ((oca.ca_offset != (void*)-1) && ISIIOVA(sc->sc_vaddr + oca.ca_offset)) {
+ oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
+ oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
+ } else {
+ oca.ca_vaddr = (void *)-1;
+ oca.ca_paddr = (void *)-1;
}
-
- /*
- * If the size specified by the child is 0, don't map
- * any IO space, but pass in the address of pcc2reg as vaddr.
- * This is for clock and parallel port which don't have a
- * separate address space by themselves but use pcc2's register
- * block.
- */
- if (ca.ca_size == 0) {
- /*
- * pcc2regs addr
- */
-#if 0
- ca.ca_vaddr = ((struct confargs *)aux)->ca_vaddr;
-#endif /* 0 */
- ca.ca_vaddr = (caddr_t)sc->sc_pcc2reg;
-
- } else {
- ca.ca_vaddr = ca.ca_paddr;
- }
-
-#if 0
- ca.ca_parent = ((struct confargs *)aux)->ca_vaddr;
-#endif /* 0 */
- ca.ca_parent = (caddr_t)sc->sc_pcc2reg;
-
- /*
- * Call child's attach using config_attach().
- */
- config_attach(parent, cf, &ca, pcctwoprint);
- return 1;
+ oca.ca_bustype = BUS_PCCTWO;
+ oca.ca_master = (void *)sc->sc_pcc2;
+ oca.ca_name = cf->cf_driver->cd_name;
+ if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0)
+ return (0);
+ config_attach(parent, cf, &oca, pcctwo_print);
+ return (1);
}
-/*
- * This function calls the match routine of the configured children
- * in turn. For each configured child, map the device address into
- * iomap space and then call config_attach() to attach the child.
- */
-
-/* ARGSUSED */
void
-pcctwoattach(struct device *parent, struct device *self, void *aux)
+pcctwoattach(parent, self, args)
+ struct device *parent, *self;
+ void *args;
{
- struct pcctwosoftc *sc = (struct pcctwosoftc *)self;
- struct confargs *ca = aux;
- caddr_t base;
-
- if (self->dv_unit > 0) {
- printf(" unsupported\n");
- return;
- }
-
- base = ca->ca_vaddr;
+ struct confargs *ca = args;
+ struct pcctwosoftc *sc = (struct pcctwosoftc *)self;
+ int i;
- printf(": PCCTWO id 0x%2x rev 0x%2x\n",
- *(u_char *)base, *((u_char *)base + 1));
+ if (sys_pcc2)
+ panic("pcc2 already attached!");
/*
- * mainbus driver would have mapped Pcc2 at base. Save
- * the address in pcctwosoftc.
+ * since we know ourself to land in intiobase land,
+ * we must adjust our address
*/
- sc->sc_pcc2reg = (struct pcc2reg *)base;
+ sc->sc_paddr = ca->ca_paddr;
+ sc->sc_vaddr = (void *)IIOV(sc->sc_paddr);
+ sc->sc_pcc2 = (struct pcctworeg *)(sc->sc_vaddr + PCC2_PCC2CHIP_OFF);
+ sys_pcc2 = sc->sc_pcc2;
+
+ printf(": rev %d\n", sc->sc_pcc2->pcc2_chiprev);
+
+ sc->sc_pcc2->pcc2_vecbase = PCC2_VECBASE;
+ sc->sc_pcc2->pcc2_genctl |= PCC2_GENCTL_IEN; /* global irq enable */
/*
* Set pcc2intr_mask and pcc2intr_ipl.
*/
- pcc2intr_ipl = (u_char *)&(sc->sc_pcc2reg->pcc2_ipl);
- pcc2intr_mask = (u_char *)&(sc->sc_pcc2reg->pcc2_imask);
+ pcc2intr_ipl = (u_char *)&(sc->sc_pcc2->pcc2_ipl);
+ pcc2intr_mask = (u_char *)&(sc->sc_pcc2->pcc2_mask);
#ifdef MVME187
- /*
- * Get mappings for iack vectors. This doesn't belong here
- * but is more closely related to pcc than anything I can
- * think of. (could probably do it in locore.s).
- */
-
+ printf("setting interrupt ack vectors.\n");
setupiackvectors();
#endif /* MVME187 */
- (void)config_search(pcctwoscan, self, aux);
+ config_search(pcctwo_scan, self, args);
+}
+
+/*
+ * PCC2 interrupts land in a PCC2_NVEC sized hole starting at PCC2_VECBASE
+ */
+int
+pcctwointr_establish(vec, ih)
+ int vec;
+ struct intrhand *ih;
+{
+ if (vec >= PCC2_NVEC) {
+ printf("pcctwo: illegal vector: 0x%x\n", vec);
+ panic("pcctwointr_establish");
+ }
+ return (intr_establish(PCC2_VECBASE+vec, ih));
}
diff --git a/sys/arch/mvme88k/dev/pcctworeg.h b/sys/arch/mvme88k/dev/pcctworeg.h
index b029797bd54..3a4cbbb1f2f 100644
--- a/sys/arch/mvme88k/dev/pcctworeg.h
+++ b/sys/arch/mvme88k/dev/pcctworeg.h
@@ -1,3 +1,5 @@
+/* $OpenBSD: pcctworeg.h,v 1.2 1998/12/15 05:52:30 smurph Exp $ */
+
/*
* Memory map for PCC2 chip found in mvme1x7 boards.
*
@@ -5,68 +7,61 @@
* two-bytes (16 bits), or four-bytes (32 bits).
*/
-struct pcc2reg {
- volatile u_char pcc2_chipid;
- volatile u_char pcc2_chiprev;
- volatile u_char pcc2_gcr;
- volatile u_char pcc2_vbr; /* vector base reg. */
- volatile u_long pcc2_t1cmp; /* timer1 compare reg */
- volatile u_long pcc2_t1cntr; /* timer1 counter reg */
- volatile u_long pcc2_t2cmp; /* timer2 compare reg */
- volatile u_long pcc2_t2cntr; /* timer2 counter reg */
- volatile u_char pcc2_pscntreg; /* prescalar count reg */
- volatile u_char pcc2_psclkadj; /* clock adjust reg */
- volatile u_char pcc2_t2ctl; /* timer2 control */
- volatile u_char pcc2_t1ctl; /* timer1 control */
- volatile u_char pcc2_gpiirq; /* GPIO intr ctl */
- volatile u_char pcc2_gpiopctl; /* GPIO pin control */
- volatile u_char pcc2_t2irq; /* Timer2 intr ctl */
- volatile u_char pcc2_t1irq; /* Timer1 intr ctl */
- volatile u_char pcc2_sccerrstat; /* SCC error status */
- volatile u_char pcc2_sccmoirq; /* Modem intr control */
- volatile u_char pcc2_scctxirq; /* Tx intr control */
- volatile u_char pcc2_sccrxirq; /* Rx intr control */
- volatile u_int :24;
- volatile u_char pcc2_sccmopiack; /* modem PIACK */
- volatile u_char :8;
- volatile u_char pcc2_scctxpiack; /* Tx PIACK */
- volatile u_char :8;
- volatile u_char pcc2_sccrxpiack; /* Rx PIACK */
- volatile u_char pcc2_lancerrstat; /* LANC error status */
- volatile u_char :8;
- volatile u_char pcc2_lancirq; /* LANC intr control */
- volatile u_char pcc2_lancerrirq; /* LANC err intr ctl */
- volatile u_char pcc2_scsierrstat; /* SCSI err status */
- volatile u_char :8;
- volatile u_char :8;
- volatile u_char pcc2_scsiirq; /* SCSI intr control */
- volatile u_char pcc2_packirq; /* printer ACK intr */
- volatile u_char pcc2_pfltirq; /* printer FAULT intr */
- volatile u_char pcc2_pselirq; /* printer SEL intr */
- volatile u_char pcc2_ppeirq; /* printer PE intr */
- volatile u_char pcc2_pbusyirq; /* printer BUSY intr */
- volatile u_char :8;
- volatile u_char pcc2_pstat; /* printer status reg */
- volatile u_char pcc2_pctl; /* printer port ctl */
- volatile u_short pcc2_chipspeed; /* chip speed (factory testing only) */
- volatile u_short pcc2_pdata; /* printer data */
- volatile u_int :16;
- volatile u_char pcc2_ipl; /* interrupt IPL */
- volatile u_char pcc2_imask; /* intr mask level */
+struct pcctworeg {
+ volatile u_char pcc2_chipid;
+ volatile u_char pcc2_chiprev;
+ volatile u_char pcc2_genctl;
+ volatile u_char pcc2_vecbase; /* irq vector base */
+ volatile u_long pcc2_t1cmp; /* timer1 compare */
+ volatile u_long pcc2_t1count; /* timer1 count */
+ volatile u_long pcc2_t2cmp; /* timer2 compare */
+ volatile u_long pcc2_t2count; /* timer2 count */
+ volatile u_char pcc2_pscalecnt; /* timer prescaler counter */
+ volatile u_char pcc2_pscaleadj; /* timer prescaler adjust */
+ volatile u_char pcc2_t2ctl; /* timer2 ctrl reg */
+ volatile u_char pcc2_t1ctl; /* timer1 ctrl reg */
+ volatile u_char pcc2_gpioirq; /* gpio irq */
+ volatile u_char pcc2_gpio; /* gpio i/o */
+ volatile u_char pcc2_t2irq;
+ volatile u_char pcc2_t1irq;
+ volatile u_char pcc2_sccerr;
+ volatile u_char pcc2_sccirq;
+ volatile u_char pcc2_scctx;
+ volatile u_char pcc2_sccrx;
+ volatile u_char :8;
+ volatile u_char :8;
+ volatile u_char :8;
+ volatile u_char pcc2_sccmoiack;
+ volatile u_char :8;
+ volatile u_char pcc2_scctxiack;
+ volatile u_char :8;
+ volatile u_char pcc2_sccrxiack;
+ volatile u_char pcc2_ieerr;
+ volatile u_char :8;
+ volatile u_char pcc2_ieirq;
+ volatile u_char pcc2_iefailirq;
+ volatile u_char pcc2_ncrerr;
+ volatile u_char :8;
+ volatile u_char :8;
+ volatile u_char pcc2_ncrirq;
+ volatile u_char pcc2_prtairq;
+ volatile u_char pcc2_prtfirq;
+ volatile u_char pcc2_prtsirq;
+ volatile u_char pcc2_prtpirq;
+ volatile u_char pcc2_prtbirq;
+ volatile u_char :8;
+ volatile u_char pcc2_prtstat;
+ volatile u_char pcc2_prtctl;
+ volatile u_short pcc2_speed; /* DO NOT USE */
+ volatile u_short pcc2_prtdat;
+ volatile u_short :16;
+ volatile u_char pcc2_ipl;
+ volatile u_char pcc2_mask;
};
-
-/*
- * Vaddrs for interrupt mask and pri registers
- */
-extern volatile u_char *pcc2intr_mask;
-extern volatile u_char *pcc2intr_ipl;
-
-extern volatile struct pcc2reg *pcc2addr;
-
+#define PCC2_PCC2CHIP_OFF 0x42000
+#define PCC2_CHIPID 0x20
#define PCC2_BASE_ADDR 0xFFF42000 /* base address */
#define PCC2_SIZE 0x1000 /* size */
-
-#define PCC2_CHIP_ID 0x20
#define PCC2_CHIP_REV 0x00
/* General Control Register */
@@ -97,29 +92,67 @@ extern volatile struct pcc2reg *pcc2addr;
#define STxIRQ 0x0e
#define SRxIRQ 0x0f
+
+/*
+ * Vaddrs for interrupt mask and pri registers
+ */
+extern volatile u_char *pcc2intr_mask;
+extern volatile u_char *pcc2intr_ipl;
+
+/*
+ * points to system's PCCTWO. This is not active until the pcctwo0
+ * device has been attached.
+ */
+extern struct pcctworeg *sys_pcc2;
+
+/*
+ * We lock off our interrupt vector at 0x50.
+ */
+#define PCC2_VECBASE 0x50
+#define PCC2_NVEC 16
+
/*
- * Timer control regs
+ * Vectors we use
*/
+#define PCC2V_NCR 0x05
+#define PCC2V_IEFAIL 0x06
+#define PCC2V_IE 0x07
+#define PCC2V_TIMER2 0x08
+#define PCC2V_TIMER1 0x09
+#define PCC2V_GPIO 0x0a
+#define PCC2V_SCC_RXE 0x0c
+#define PCC2V_SCC_M 0x0d
+#define PCC2V_SCC_TX 0x0e
+#define PCC2V_SCC_RX 0x0f
+
+#define PCC2_TCTL_CEN 0x01
+#define PCC2_TCTL_COC 0x02
+#define PCC2_TCTL_COVF 0x04
+#define PCC2_TCTL_OVF 0xf0
#define PCC2_TICTL_CEN 0x01
#define PCC2_TICTL_COC 0x02
#define PCC2_TICTL_COVF 0x04
#define PCC2_TTCTL_OVF_MASK (1 << 4) /* overflow bits mask */
-/* GPIO interrupt control */
+#define PCC2_GPIO_PLTY 0x80
+#define PCC2_GPIO_EL 0x40
-#define PCC2_GPIIRQ_PLTY 0x80
-#define PCC2_GPIIRQ_EL 0x40
-#define PCC2_GPIIRQ_INT 0x20
-#define PCC2_GPIIRQ_IEN 0x10
-#define PCC2_GPIIRQ_ICLR 0x08
-#define PCC2_GPIIRQ_IL 0x07 /* IL2-IL0 */
+#define PCC2_GPIOCR_OE 0x2
+#define PCC2_GPIOCR_O 0x1
-/* GPIO Pin Control Register */
+#define PCC2_SCC_AVEC 0x08
+#define PCC2_SCCRX_INHIBIT (0 << 6)
+#define PCC2_SCCRX_SNOOP (1 << 6)
+#define PCC2_SCCRX_INVAL (2 << 6)
+#define PCC2_SCCRX_RESV (3 << 6)
-#define PCC2_GPIOPCTL_GPI 0x04
-#define PCC2_GPIOPCTL_GPOE 0x02
-#define PCC2_GPIOPCTL_GPO 0x01
+#define pcc2_timer_us2lim(us) (us) /* timer increments in "us" */
+
+#define PCC2_IRQ_IPL 0x07
+#define PCC2_IRQ_ICLR 0x08
+#define PCC2_IRQ_IEN 0x10
+#define PCC2_IRQ_INT 0x20
/* Tick Timer Interrupt Control Register */
@@ -128,51 +161,13 @@ extern volatile struct pcc2reg *pcc2addr;
#define PCC2_TTIRQ_ICLR 0x08
#define PCC2_TTIRQ_IL 0x07 /* mask for IL2-IL0 */
-/* SCC Error Status Register */
-
-#define PCC2_SCCERRSTAT_RTRY 0x10
-#define PCC2_SCCERRSTAT_PRTY 0x08
-#define PCC2_SCCERRSTAT_EXT 0x04
-#define PCC2_SCCERRSTAT_LTO 0x02
-#define PCC2_SCCERRSTAT_SCLR 0x01
-
-/* SCC Modem Interrupt Control Register */
-
-#define PCC2_SCCMOIRQ_IRQ 0x20
-#define PCC2_SCCMOIRQ_IEN 0x10
-#define PCC2_SCCMOIRQ_AVEC 0x08
-#define PCC2_SCCMOIRQ_IL 0x07 /* int level mask */
-
-/* SCC Tx Interrupt Control Register */
-
-#define PCC2_SCCTXIRQ_IRQ 0x20
-#define PCC2_SCCTXIRQ_IEN 0x10
-#define PCC2_SCCTXIRQ_AVEC 0x08
-#define PCC2_SCCTXIRQ_IL 0x07
-
-/* SCC Tx Interrupt Control Register */
-
-#define PCC2_SCCRXIRQ_SNOOP (1 << 6)
-#define PCC2_SCCRXIRQ_IRQ 0x20
-#define PCC2_SCCRXIRQ_IEN 0x10
-#define PCC2_SCCRXIRQ_AVEC 0x08
-#define PCC2_SCCRXIRQ_IL 0x07
-
-/* SCSI Interrupt Control Register */
-
-#define PCC2_SCSIIRQ_IEN 0x10
-
-/* Interrupt Priority Level Register */
-
-#define PCC2_IPL_IPL 0x07
-
-/* Interrupt Mask Level Register */
+#define PCC2_IEERR_SCLR 0x01
-#define PCC2_IMASK_MSK 0x07
+#define PCC2_GENCTL_FAST 0x01
+#define PCC2_GENCTL_IEN 0x02
+#define PCC2_GENCTL_C040 0x03
-#define PCC2_IRQ_IPL 0x07
-#define PCC2_IRQ_ICLR 0x08
-#define PCC2_IRQ_IEN 0x10
-#define PCC2_IRQ_INT 0x20
-
-#define PCC2_IEERR_SCLR 0x01
+#define PCC2_SC_INHIBIT (0 << 6)
+#define PCC2_SC_SNOOP (1 << 6)
+#define PCC2_SC_INVAL (2 << 6)
+#define PCC2_SC_RESV (3 << 6)
diff --git a/sys/arch/mvme88k/dev/rd_root.c b/sys/arch/mvme88k/dev/rd_root.c
new file mode 100644
index 00000000000..1d952240d64
--- /dev/null
+++ b/sys/arch/mvme88k/dev/rd_root.c
@@ -0,0 +1,80 @@
+/* $OpenBSD: rd_root.c,v 1.1 1998/12/15 05:52:30 smurph Exp $ */
+
+/*
+ * Copyright (c) 1995 Gordon W. Ross
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/reboot.h>
+
+#include <dev/ramdisk.h>
+
+extern int boothowto;
+
+#ifndef MINIROOTSIZE
+#define MINIROOTSIZE 512
+#endif
+
+#define ROOTBYTES (MINIROOTSIZE << DEV_BSHIFT)
+
+/*
+ * This array will be patched to contain a file-system image.
+ * See the program: src/distrib/sun3/common/rdsetroot.c
+ */
+int rd_root_size = ROOTBYTES;
+char rd_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
+
+/*
+ * This is called during autoconfig.
+ */
+void
+rd_attach_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* Setup root ramdisk */
+ rd->rd_addr = (caddr_t) rd_root_image;
+ rd->rd_size = (size_t) rd_root_size;
+ rd->rd_type = RD_KMEM_FIXED;
+ printf("rd%d: fixed, %d blocks\n", unit, MINIROOTSIZE);
+ }
+}
+
+/*
+ * This is called during open (i.e. mountroot)
+ */
+void
+rd_open_hook(unit, rd)
+ int unit;
+ struct rd_conf *rd;
+{
+ if (unit == 0) {
+ /* The root ramdisk only works single-user. */
+ boothowto |= RB_SINGLE;
+ printf("rd%d: mounting root, single user mode.\n", unit);
+ }
+}
diff --git a/sys/arch/mvme88k/dev/siop.c b/sys/arch/mvme88k/dev/siop.c
index 67aee6e2a40..ba95e2bd449 100644
--- a/sys/arch/mvme88k/dev/siop.c
+++ b/sys/arch/mvme88k/dev/siop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: siop.c,v 1.23 1995/08/18 15:28:08 chopps Exp $ */
+/* $OpenBSD: siop.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -86,7 +86,7 @@ void siopsetdelay __P((int));
void siop_scsidone __P((struct siop_acb *, int));
void siop_sched __P((struct siop_softc *));
int siop_poll __P((struct siop_softc *, struct siop_acb *));
-void siopintr __P((struct siop_softc *));
+int siopintr __P((struct siop_softc *));
void scsi_period_to_siop __P((struct siop_softc *, int));
void siop_start __P((struct siop_softc *, int, int, u_char *, int, u_char *, int));
void siop_dump_acb __P((struct siop_acb *));
@@ -208,7 +208,7 @@ siop_scsicmd(xs)
struct siop_acb *acb;
struct siop_softc *sc;
struct scsi_link *slp;
- int flags, s;
+ int flags, s, i;
slp = xs->sc_link;
sc = slp->adapter_softc;
@@ -298,7 +298,7 @@ siop_poll(sc, acb)
(SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0) {
if (--i <= 0) {
#ifdef DEBUG
- printf ("waiting: tgt %d cmd %02x sbcl %02x dsp %lx (+%lx) dcmd %lx ds %p timeout %d\n",
+ printf ("waiting: tgt %d cmd %02x sbcl %02x dsp %x (+%x) dcmd %x ds %x timeout %d\n",
xs->sc_link->target, acb->cmd.opcode,
rp->siop_sbcl, rp->siop_dsp,
rp->siop_dsp - sc->sc_scriptspa,
@@ -343,11 +343,11 @@ siop_sched(sc)
{
struct scsi_link *slp;
struct siop_acb *acb;
- int i;
+ int stat, i;
#ifdef DEBUG
if (sc->sc_nexus) {
- printf("%s: siop_sched- nexus %p/%d ready %p/%d\n",
+ printf("%s: siop_sched- nexus %x/%d ready %x/%d\n",
sc->sc_dev.dv_xname, sc->sc_nexus,
sc->sc_nexus->xs->sc_link->target,
sc->ready_list.tqh_first,
@@ -393,10 +393,10 @@ siop_scsidone(acb, stat)
struct siop_acb *acb;
int stat;
{
- struct scsi_xfer *xs;
- struct scsi_link *slp;
- struct siop_softc *sc;
- int dosched = 0;
+ struct scsi_xfer *xs = acb->xs;
+ struct scsi_link *slp = xs->sc_link;
+ struct siop_softc *sc = slp->adapter_softc;
+ int s, dosched = 0;
if (acb == NULL || (xs = acb->xs) == NULL) {
#ifdef DIAGNOSTIC
@@ -510,9 +510,7 @@ siopabort(sc, rp, where)
siop_regmap_p rp;
char *where;
{
-#ifdef fix_this
int i;
-#endif
printf ("%s: abort %s: dstat %02x, sstat0 %02x sbcl %02x\n",
sc->sc_dev.dv_xname,
@@ -563,19 +561,11 @@ void
siopinitialize(sc)
struct siop_softc *sc;
{
- int i;
- u_int inhibit_sync;
- extern u_long scsi_nosync;
- extern int shift_nosync;
-
/*
- * Need to check that scripts is on a long word boundary.
+ * Need to check that scripts is on a long word boundary
* Also should verify that dev doesn't span non-contiguous
* physical pages.
*/
-
- dma_cachectl((vm_offset_t)scripts, sizeof(scripts), DMA_CACHE_SYNC);
-
sc->sc_scriptspa = kvtop(scripts);
/*
@@ -593,32 +583,16 @@ siopinitialize(sc)
sc->sc_minsync = sc->sc_tcp[1]; /* in 4ns units */
if (sc->sc_minsync < 25)
sc->sc_minsync = 25;
- if (sc->sc_clock_freq <= 25) {
- sc->sc_dcntl |= 0x80; /* SCLK/1 */
+#if not_used
+ if (sc->sc_clock_freq <= 25)
sc->sc_tcp[0] = sc->sc_tcp[1];
- } else if (sc->sc_clock_freq <= 37) {
- sc->sc_dcntl |= 0x40; /* SCLK/1.5 */
+ else if (sc->sc_clock_freq <= 37)
sc->sc_tcp[0] = sc->sc_tcp[2];
- } else if (sc->sc_clock_freq <= 50) {
- sc->sc_dcntl |= 0x00; /* SCLK/2 */
+ else if (sc->sc_clock_freq <= 50)
sc->sc_tcp[0] = sc->sc_tcp[3];
- } else {
- sc->sc_dcntl |= 0xc0; /* SCLK/3 */
+ else
sc->sc_tcp[0] = 3000 / sc->sc_clock_freq;
- }
-
- if (scsi_nosync) {
- inhibit_sync = (scsi_nosync >> shift_nosync) & 0xff;
- shift_nosync += 8;
-#ifdef DEBUG
- if (inhibit_sync)
- printf("%s: Inhibiting synchronous transfer %02x\n",
- sc->sc_dev.dv_xname, inhibit_sync);
#endif
- for (i = 0; i < 8; ++i)
- if (inhibit_sync & (1 << i))
- siop_inhibit_sync[i] = 1;
- }
siopreset (sc);
}
@@ -637,8 +611,6 @@ siopreset(sc)
if (sc->sc_flags & SIOP_ALIVE)
siopabort(sc, rp, "reset");
- printf("%s: ", sc->sc_dev.dv_xname); /* XXXX */
-
s = splbio();
/*
@@ -667,7 +639,7 @@ siopreset(sc)
rp->siop_dien = 0x00; /* don't enable interrupts yet */
rp->siop_scid = 1 << sc->sc_link.adapter_target;
rp->siop_dwt = 0x00;
- rp->siop_ctest0 = (SIOP_CTEST0_EAN|SIOP_CTEST0_BTD);
+ rp->siop_ctest0 |= SIOP_CTEST0_BTD | SIOP_CTEST0_EAN;
rp->siop_ctest7 = sc->sc_ctest7;
/* will need to re-negotiate sync xfers */
@@ -683,8 +655,8 @@ siopreset(sc)
splx (s);
delay (siop_reset_delay * 1000);
- printf("siop id %d reset V%d\n", sc->sc_link.adapter_target,
- rp->siop_ctest8 >> 4);
+ printf(": version %d target %d\n", rp->siop_ctest8 >> 4,
+ sc->sc_link.adapter_target);
if ((sc->sc_flags & SIOP_ALIVE) == 0) {
TAILQ_INIT(&sc->ready_list);
@@ -709,7 +681,7 @@ siopreset(sc)
sc->sc_nexus->xs->error = XS_DRIVER_STUFFUP;
siop_scsidone(sc->sc_nexus, sc->sc_nexus->stat[0]);
}
- while ((acb = sc->nexus_list.tqh_first) != 0) {
+ while (acb = sc->nexus_list.tqh_first) {
acb->xs->error = XS_DRIVER_STUFFUP;
siop_scsidone(acb, acb->stat[0]);
}
@@ -742,17 +714,15 @@ siop_start (sc, target, lun, cbuf, clen, buf, len)
int len;
{
siop_regmap_p rp = sc->sc_siopp;
+ int i;
int nchain;
int count, tcount;
char *addr, *dmaend;
struct siop_acb *acb = sc->sc_nexus;
-#ifdef DEBUG
- int i;
-#endif
#ifdef DEBUG
if (siop_debug & 0x100 && rp->siop_sbcl & SIOP_BSY) {
- printf ("ACK! siop was busy: rp %p script %p dsa %p active %ld\n",
+ printf ("ACK! siop was busy: rp %x script %x dsa %x active %d\n",
rp, &scripts, &acb->ds, sc->sc_active);
printf ("istat %02x sfbr %02x lcrc %02x sien %02x dien %02x\n",
rp->siop_istat, rp->siop_sfbr, rp->siop_lcrc,
@@ -857,7 +827,7 @@ siop_start (sc, target, lun, cbuf, clen, buf, len)
if (nchain != 1 && len != 0 && siop_debug & 3) {
printf ("DMA chaining set: %d\n", nchain);
for (i = 0; i < nchain; ++i) {
- printf (" [%d] %8p %lx\n", i, acb->ds.chain[i].databuf,
+ printf (" [%d] %8x %4x\n", i, acb->ds.chain[i].databuf,
acb->ds.chain[i].datalen);
}
}
@@ -889,7 +859,7 @@ siop_start (sc, target, lun, cbuf, clen, buf, len)
#ifdef DEBUG
if (siop_debug & 0x100 && rp->siop_sbcl & SIOP_BSY) {
- printf ("ACK! siop was busy at start: rp %p script %p dsa %p active %ld\n",
+ printf ("ACK! siop was busy at start: rp %x script %x dsa %x active %d\n",
rp, &scripts, &acb->ds, sc->sc_active);
#ifdef DDB
/*Debugger();*/
@@ -897,12 +867,9 @@ siop_start (sc, target, lun, cbuf, clen, buf, len)
}
#endif
if (sc->nexus_list.tqh_first == NULL) {
- if (rp->siop_istat & SIOP_ISTAT_CON) {
- printf("%s: siop_select while connected:RABSAMCI %x scntl_con %x\n",
- sc->sc_dev.dv_xname,
- rp->siop_sbcl, rp->siop_scntl1 & SIOP_SCNTL1_CON);
- }
-
+ if (rp->siop_istat & SIOP_ISTAT_CON)
+ printf("%s: siop_select while connected?\n",
+ sc->sc_dev.dv_xname);
rp->siop_temp = 0;
rp->siop_sbcl = sc->sc_sync[target].sbcl;
rp->siop_dsa = kvtop(&acb->ds);
@@ -956,12 +923,12 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
rp->siop_ctest8 |= SIOP_CTEST8_CLF;
while ((rp->siop_ctest1 & SIOP_CTEST1_FMT) != SIOP_CTEST1_FMT)
;
-
+ rp->siop_ctest8 &= ~SIOP_CTEST8_CLF;
#ifdef DEBUG
++siopints;
#if 0
if (siop_debug & 0x100) {
- cmmu_inval_cache(kvtop(&acb->stat[0]), 1); /* XXX */
+ DCIAS(&acb->stat[0]); /* XXX */
printf ("siopchkintr: istat %x dstat %x sstat0 %x dsps %x sbcl %x sts %x msg %x\n",
istat, dstat, sstat0, rp->siop_dsps, rp->siop_sbcl, acb->stat[0], acb->msg[0]);
printf ("sync msg in: %02x %02x %02x %02x %02x %02x\n",
@@ -971,7 +938,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
#endif
if (rp->siop_dsp && (rp->siop_dsp < sc->sc_scriptspa ||
rp->siop_dsp >= sc->sc_scriptspa + sizeof(scripts))) {
- printf ("%s: dsp not within script dsp %lx scripts %lx:%lx",
+ printf ("%s: dsp not within script dsp %x scripts %x:%x",
sc->sc_dev.dv_xname, rp->siop_dsp, sc->sc_scriptspa,
sc->sc_scriptspa + sizeof(scripts));
printf(" istat %x dstat %x sstat0 %x\n",
@@ -986,8 +953,8 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
/* Normal completion status, or check condition */
#ifdef DEBUG
if (rp->siop_dsa != kvtop(&acb->ds)) {
- printf ("siop: invalid dsa: %lx %x\n", rp->siop_dsa,
- kvtop((caddr_t)&acb->ds));
+ printf ("siop: invalid dsa: %x %x\n", rp->siop_dsa,
+ kvtop(&acb->ds));
panic("*** siop DSA invalid ***");
}
#endif
@@ -1063,26 +1030,141 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
sc->sc_dev.dv_xname, acb->msg[0]);
#endif
if (sc->nexus_list.tqh_first)
- rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
+ rp->siop_dcntl |= SIOP_DCNTL_STD;
return 1;
}
+ if (sstat0 & SIOP_SSTAT0_M_A) { /* Phase mismatch */
+#ifdef DEBUG
+ ++siopphmm;
+ if (acb == NULL)
+ printf("%s: Phase mismatch with no active command?\n",
+ sc->sc_dev.dv_xname);
+#endif
+ if (acb->iob_len) {
+ int adjust;
+ adjust = ((dfifo - (dbc & 0x7f)) & 0x7f);
+ if (sstat1 & SIOP_SSTAT1_ORF)
+ ++adjust;
+ if (sstat1 & SIOP_SSTAT1_OLF)
+ ++adjust;
+ acb->iob_curlen = *((long *)&rp->siop_dcmd) & 0xffffff;
+ acb->iob_curlen += adjust;
+ acb->iob_curbuf = *((long *)&rp->siop_dnad) - adjust;
+#ifdef DEBUG
+ if (siop_debug & 0x100) {
+ int i;
+ printf ("Phase mismatch: curbuf %x curlen %x dfifo %x dbc %x sstat1 %x adjust %x sbcl %x starts %d acb %x\n",
+ acb->iob_curbuf, acb->iob_curlen, dfifo,
+ dbc, sstat1, adjust, rp->siop_sbcl, siopstarts, acb);
+ if (acb->ds.chain[1].datalen) {
+ for (i = 0; acb->ds.chain[i].datalen; ++i)
+ printf("chain[%d] addr %x len %x\n",
+ i, acb->ds.chain[i].databuf,
+ acb->ds.chain[i].datalen);
+ }
+ }
+#endif
- if (dstat & SIOP_DSTAT_SIR && (rp->siop_dsps == 0xff01 ||
- rp->siop_dsps == 0xff02)) {
-
- if (acb == NULL) {
- printf("%s: Disconnect with no active command?\n",
+#if 0
+ dma_cachectl (acb, sizeof(*acb), DMA_CACHE_SYNC));
+#endif
+ }
+#ifdef DEBUG
+ SIOP_TRACE('m',rp->siop_sbcl,(rp->siop_dsp>>8),rp->siop_dsp);
+ if (siop_debug & 9)
+ printf ("Phase mismatch: %x dsp +%x dcmd %x\n",
+ rp->siop_sbcl,
+ rp->siop_dsp - sc->sc_scriptspa,
+ *((long *)&rp->siop_dcmd));
+#endif
+ if ((rp->siop_sbcl & SIOP_REQ) == 0) {
+ printf ("Phase mismatch: REQ not asserted! %02x dsp %x\n",
+ rp->siop_sbcl, rp->siop_dsp);
+#ifdef DEBUG
+ Debugger();
+#endif
+ }
+ switch (rp->siop_sbcl & 7) {
+ case 0: /* data out */
+ case 1: /* data in */
+ case 2: /* status */
+ case 3: /* command */
+ case 6: /* message in */
+ case 7: /* message out */
+ rp->siop_dsp = sc->sc_scriptspa + Ent_switch;
+ break;
+ default:
+ goto bad_phase;
+ }
+ return 0;
+ }
+ if (sstat0 & SIOP_SSTAT0_STO) { /* Select timed out */
+#ifdef DEBUG
+ if (acb == NULL)
+ printf("%s: Select timeout with no active command?\n",
sc->sc_dev.dv_xname);
+ if (rp->siop_sbcl & SIOP_BSY) {
+ printf ("ACK! siop was busy at timeout: rp %x script %x dsa %x\n",
+ rp, &scripts, &acb->ds);
+ printf(" sbcl %x sdid %x istat %x dstat %x sstat0 %x\n",
+ rp->siop_sbcl, rp->siop_sdid, istat, dstat, sstat0);
+ if (!(rp->siop_sbcl & SIOP_BSY)) {
+ printf ("Yikes, it's not busy now!\n");
+#if 0
+ *status = -1;
+ if (sc->nexus_list.tqh_first)
+ rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
+ return 1;
+#endif
+ }
+/* rp->siop_dcntl |= SIOP_DCNTL_STD;*/
return (0);
+#ifdef DDB
+ Debugger();
+#endif
}
+#endif
+ *status = -1;
+ acb->xs->error = XS_SELTIMEOUT;
+ if (sc->nexus_list.tqh_first)
+ rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
+ return 1;
+ }
+ if (acb)
+ target = acb->xs->sc_link->target;
+ else
+ target = 7;
+ if (sstat0 & SIOP_SSTAT0_UDC) {
+#ifdef DEBUG
+ if (acb == NULL)
+ printf("%s: Unexpected disconnect with no active command?\n",
+ sc->sc_dev.dv_xname);
+ printf ("%s: target %d disconnected unexpectedly\n",
+ sc->sc_dev.dv_xname, target);
+#endif
+#if 0
+ siopabort (sc, rp, "siopchkintr");
+#endif
+ *status = STS_BUSY;
+ if (sc->nexus_list.tqh_first)
+ rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
+ return 1;
+ }
+ if (dstat & SIOP_DSTAT_SIR && (rp->siop_dsps == 0xff01 ||
+ rp->siop_dsps == 0xff02)) {
#ifdef DEBUG
if (siop_debug & 0x100)
- printf ("%s: ID %02x disconnected TEMP %lx (+%lx) curbuf %lx curlen %lx buf %p len %lx dfifo %x dbc %x sstat1 %x starts %d acb %p\n",
+ printf ("%s: ID %02x disconnected TEMP %x (+%x) curbuf %x curlen %x buf %x len %x dfifo %x dbc %x sstat1 %x starts %d acb %x\n",
sc->sc_dev.dv_xname, 1 << target, rp->siop_temp,
rp->siop_temp ? rp->siop_temp - sc->sc_scriptspa : 0,
acb->iob_curbuf, acb->iob_curlen,
acb->ds.chain[0].databuf, acb->ds.chain[0].datalen, dfifo, dbc, sstat1, siopstarts, acb);
#endif
+ if (acb == NULL) {
+ printf("%s: Disconnect with no active command?\n",
+ sc->sc_dev.dv_xname);
+ return (0);
+ }
/*
* XXXX need to update iob_curbuf/iob_curlen to reflect
* current data transferred. If device disconnected in
@@ -1095,7 +1177,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
int n = rp->siop_temp - sc->sc_scriptspa;
if (acb->iob_curlen && acb->iob_curlen != acb->ds.chain[0].datalen)
- printf("%s: iob_curbuf/len already set? n %x iob %lx/%lx chain[0] %p/%lx\n",
+ printf("%s: iob_curbuf/len already set? n %x iob %x/%x chain[0] %x/%x\n",
sc->sc_dev.dv_xname, n, acb->iob_curbuf, acb->iob_curlen,
acb->ds.chain[0].databuf, acb->ds.chain[0].datalen);
if (n < Ent_datain)
@@ -1111,7 +1193,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
#ifdef DEBUG
if (siop_debug & 0x100) {
printf("%s: TEMP offset %d", sc->sc_dev.dv_xname, n);
- printf(" curbuf %lx curlen %lx\n", acb->iob_curbuf,
+ printf(" curbuf %x curlen %x\n", acb->iob_curbuf,
acb->iob_curlen);
}
#endif
@@ -1142,17 +1224,11 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
acb->ds.chain[i].datalen))
break;
}
- if (i >= DMAMAXIO || acb->ds.chain[i].datalen == 0) {
- printf("couldn't find saved data pointer: ");
- printf("curbuf %lx curlen %lx i %d\n",
- acb->iob_curbuf, acb->iob_curlen, i);
-#ifdef DDB
- Debugger();
-#endif
- }
+ if (i >= DMAMAXIO || acb->ds.chain[i].datalen == 0)
+ printf("couldn't find saved data pointer\n");
#ifdef DEBUG
if (siop_debug & 0x100)
- printf(" chain[0]: %p/%lx -> %lx/%lx\n",
+ printf(" chain[0]: %x/%x -> %x/%x\n",
acb->ds.chain[0].databuf,
acb->ds.chain[0].datalen,
acb->iob_curbuf,
@@ -1163,7 +1239,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
for (j = 1, ++i; i < DMAMAXIO && acb->ds.chain[i].datalen; ++i, ++j) {
#ifdef DEBUG
if (siop_debug & 0x100)
- printf(" chain[%d]: %p/%lx -> %p/%lx\n", j,
+ printf(" chain[%d]: %x/%x -> %x/%x\n", j,
acb->ds.chain[j].databuf,
acb->ds.chain[j].datalen,
acb->ds.chain[i].databuf,
@@ -1186,25 +1262,24 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
* try to start another command for another target/lun
*/
acb->status = sc->sc_flags & SIOP_INTSOFF;
- sc->sc_nexus = NULL;
TAILQ_INSERT_HEAD(&sc->nexus_list, acb, chain);
+ sc->sc_nexus = NULL; /* no current device */
/* start script to wait for reselect */
+ if (sc->sc_nexus == NULL)
rp->siop_dsp = sc->sc_scriptspa + Ent_wait_reselect;
+/* XXXX start another command ? */
if (sc->ready_list.tqh_first)
siop_sched(sc);
return (0);
}
-
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff03) {
-
int reselid = rp->siop_scratch & 0x7f;
int reselun = rp->siop_sfbr & 0x07;
sc->sc_sstat1 = rp->siop_sbcl; /* XXXX save current SBCL */
-
#ifdef DEBUG
if (siop_debug & 0x100)
- printf ("%s: target ID %02x reselected dsps %lx\n",
+ printf ("%s: target ID %02x reselected dsps %x\n",
sc->sc_dev.dv_xname, reselid,
rp->siop_dsps);
if ((rp->siop_sfbr & 0x80) == 0)
@@ -1249,7 +1324,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
break;
}
if (acb == NULL) {
- printf("%s: target ID %02x reselect nexus_list %p\n",
+ printf("%s: target ID %02x reselect nexus_list %x\n",
sc->sc_dev.dv_xname, reselid,
sc->nexus_list.tqh_first);
panic("unable to find reselecting device");
@@ -1258,12 +1333,33 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
dma_cachectl (acb, sizeof(*acb));
#endif
rp->siop_temp = 0;
- rp->siop_dsp = sc->sc_scriptspa + Ent_switch;
+ rp->siop_dcntl |= SIOP_DCNTL_STD;
return (0);
}
-
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff04) {
+ u_short ctest2 = rp->siop_ctest2;
+ /* reselect was interrupted (by Sig_P or select) */
+#ifdef DEBUG
+ if (siop_debug & 0x100 ||
+ (ctest2 & SIOP_CTEST2_SIGP) == 0)
+ printf ("%s: reselect interrupted (Sig_P?) scntl1 %x ctest2 %x sfbr %x istat %x/%x\n",
+ sc->sc_dev.dv_xname, rp->siop_scntl1,
+ ctest2, rp->siop_sfbr, istat, rp->siop_istat);
+#endif
+ /* XXX assumes it was not select */
+ if (sc->sc_nexus == NULL) {
+ printf("%s: reselect interrupted, sc_nexus == NULL\n",
+ sc->sc_dev.dv_xname);
+#if 0
+ siop_dump(sc);
+#ifdef DDB
+ Debugger();
+#endif
+#endif
+ rp->siop_dcntl |= SIOP_DCNTL_STD;
+ return(0);
+ }
target = sc->sc_nexus->xs->sc_link->target;
rp->siop_temp = 0;
rp->siop_dsa = kvtop(&sc->sc_nexus->ds);
@@ -1272,9 +1368,7 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
rp->siop_dsp = sc->sc_scriptspa;
return (0);
}
-
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff06) {
-
if (acb == NULL)
printf("%s: Bad message-in with no active command?\n",
sc->sc_dev.dv_xname);
@@ -1285,11 +1379,11 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
#endif
printf ("%s: Unrecognized message in data sfbr %x msg %x sbcl %x\n",
sc->sc_dev.dv_xname, rp->siop_sfbr, acb->msg[1], rp->siop_sbcl);
- siopreset (sc);
- *status = -1;
- return 0; /* siopreset has cleaned up */
+ /* what should be done here? */
+ /*DCIAS(kvtop(&acb->msg[1]));*/
+ rp->siop_dsp = sc->sc_scriptspa + Ent_switch;
+ return (0);
}
-
if (dstat & SIOP_DSTAT_SIR && rp->siop_dsps == 0xff0a) {
/* Status phase wasn't followed by message in phase? */
printf ("%s: Status phase not followed by message in phase? sbcl %x sbdl %x\n",
@@ -1504,10 +1598,8 @@ siop_checkintr(sc, istat, dstat, sstat0, status)
*status = -1;
return 0; /* siopreset has cleaned up */
}
-
if (sstat0 & SIOP_SSTAT0_SGE)
printf ("SIOP: SCSI Gross Error\n");
-
if (sstat0 & SIOP_SSTAT0_PAR)
printf ("SIOP: Parity Error\n");
@@ -1529,24 +1621,25 @@ bad_phase:
* then panics.
* XXXX need to clean this up to print out the info, reset, and continue
*/
- printf ("siopchkintr: target %x ds %p\n", target, &acb->ds);
- printf ("scripts %lx ds %x rp %x dsp %lx dcmd %lx\n", sc->sc_scriptspa,
+ printf ("siopchkintr: target %x ds %x\n", target, &acb->ds);
+ printf ("scripts %x ds %x rp %x dsp %x dcmd %x\n", sc->sc_scriptspa,
kvtop(&acb->ds), kvtop(rp), rp->siop_dsp,
*((long *)&rp->siop_dcmd));
- printf ("siopchkintr: istat %x dstat %x sstat0 %x dsps %lx dsa %lx sbcl %x sts %x msg %x %x sfbr %x\n",
+ printf ("siopchkintr: istat %x dstat %x sstat0 %x dsps %x "
+ "dsa %x sbcl %x sts %x msg %x %x sfbr %x\n",
istat, dstat, sstat0, rp->siop_dsps, rp->siop_dsa,
- rp->siop_sbcl, acb->stat[0], acb->msg[0], acb->msg[1], rp->siop_sfbr);
+ rp->siop_sbcl, acb->stat[0], acb->msg[0], acb->msg[1],
+ rp->siop_sfbr);
#ifdef DEBUG
if (siop_debug & 0x20)
panic("siopchkintr: **** temp ****");
-#endif
#ifdef DDB
- Debugger ();
+ /* Debugger(); */
+#endif
#endif
#endif /* XXX */
-
- *status = -1;
siopreset (sc); /* hard reset */
+ *status = -1;
return 0; /* siopreset cleaned up */
}
@@ -1581,7 +1674,7 @@ siop_select(sc)
}
#ifdef DEBUG
if (siop_debug & 1)
- printf ("siop_select: target %x cmd %02x ds %p\n",
+ printf ("siop_select: target %x cmd %02x ds %x\n",
acb->xs->sc_link->target, acb->cmd.opcode,
&sc->sc_nexus->ds);
#endif
@@ -1596,7 +1689,7 @@ siop_select(sc)
* 53C710 interrupt handler
*/
-void
+int
siopintr (sc)
register struct siop_softc *sc;
{
@@ -1629,9 +1722,8 @@ siopintr (sc)
printf ("%s: intr istat %x dstat %x sstat0 %x\n",
sc->sc_dev.dv_xname, istat, dstat, sstat0);
if (!sc->sc_active) {
- printf ("%s: spurious interrupt? istat %x dstat %x sstat0 %x nexus %p status %x\n",
- sc->sc_dev.dv_xname, istat, dstat, sstat0,
- sc->sc_nexus, sc->sc_nexus ? sc->sc_nexus->stat[0] : 0);
+ printf ("%s: spurious interrupt? istat %x dstat %x sstat0 %x status %x\n",
+ sc->sc_dev.dv_xname, istat, dstat, sstat0, sc->sc_nexus->stat[0]);
}
#endif
@@ -1655,8 +1747,10 @@ siopintr (sc)
rp->siop_dien = sc->sc_dien;
}
if (siop_checkintr (sc, istat, dstat, sstat0, &status)) {
+#if 1
if (status == 0xff)
printf ("siopintr: status == 0xff\n");
+#endif
if ((sc->sc_flags & (SIOP_INTSOFF | SIOP_INTDEFER)) != SIOP_INTSOFF) {
#if 0
if (rp->siop_sbcl & SIOP_BSY) {
@@ -1668,8 +1762,7 @@ siopintr (sc)
rp->siop_dsp - sc->sc_scriptspa);
}
#endif
- siop_scsidone(sc->sc_nexus, sc->sc_nexus ?
- sc->sc_nexus->stat[0] : -1);
+ siop_scsidone(sc->sc_nexus, sc->sc_nexus->stat[0]);
}
}
splx(s);
@@ -1680,7 +1773,7 @@ siopintr (sc)
* not be correct for other 53c710 boards.
* XXX fix this - nivas
*/
-void
+void
scsi_period_to_siop (sc, target)
struct siop_softc *sc;
int target;
@@ -1711,7 +1804,7 @@ scsi_period_to_siop (sc, target)
break;
}
if (sbcl > 3) {
- printf("siop sync: unable to compute sync params for period %dns\n",
+ printf("siop_sync: unable to compute sync params for period %dns\n",
period * 4);
/*
* XXX need to pick a value we can do and renegotiate
@@ -1769,10 +1862,10 @@ siop_dump_acb(acb)
for (i = acb->clen; i; --i)
printf(" %02x", *b++);
printf("\n");
- printf(" xs: %p data %p:%04x ", acb->xs, acb->xs->data,
+ printf(" xs: %08x data %8x:%04x ", acb->xs, acb->xs->data,
acb->xs->datalen);
- printf("va %p:%lx ", acb->iob_buf, acb->iob_len);
- printf("cur %lx:%lx\n", acb->iob_curbuf, acb->iob_curlen);
+ printf("va %8x:%04x ", acb->iob_buf, acb->iob_len);
+ printf("cur %8x:%04x\n", acb->iob_curbuf, acb->iob_curlen);
}
void
@@ -1790,21 +1883,21 @@ siop_dump(sc)
#endif
printf("%s@%p regs %p istat %x\n",
sc->sc_dev.dv_xname, sc, rp, rp->siop_istat);
- if ((acb = sc->free_list.tqh_first) != 0) {
+ if (acb = sc->free_list.tqh_first) {
printf("Free list:\n");
while (acb) {
siop_dump_acb(acb);
acb = acb->chain.tqe_next;
}
}
- if ((acb = sc->ready_list.tqh_first) != 0) {
+ if (acb = sc->ready_list.tqh_first) {
printf("Ready list:\n");
while (acb) {
siop_dump_acb(acb);
acb = acb->chain.tqe_next;
}
}
- if ((acb = sc->nexus_list.tqh_first) != 0) {
+ if (acb = sc->nexus_list.tqh_first) {
printf("Nexus list:\n");
while (acb) {
siop_dump_acb(acb);
diff --git a/sys/arch/mvme88k/dev/siop_script.out b/sys/arch/mvme88k/dev/siop_script.out
index 5263b8e943f..c6a91178fc8 100644
--- a/sys/arch/mvme88k/dev/siop_script.out
+++ b/sys/arch/mvme88k/dev/siop_script.out
@@ -1,106 +1,175 @@
-unsigned long scripts[] = {
- 0x47000000, 0x00000118,
- 0x878B0000, 0x00000030,
- 0x868A0000, 0x00000160,
- 0x828A0000, 0x00000168,
- 0x808A0000, 0x00000178,
- 0x818A0000, 0x00000200,
- 0x838A0000, 0x00000288,
- 0x98080000, 0x0000FF05,
- 0x1F000024, 0x00000024,
- 0x808C0001, 0x00000040,
- 0x808C0004, 0x00000078,
- 0x808C0002, 0x00000088,
- 0x808C0007, 0x00000010,
- 0x808C0003, 0x00000008,
- 0x98080000, 0x0000FF06,
- 0x60000040, 0x00000000,
- 0x60000008, 0x00000000,
- 0x80880000, 0xFFFFFF78,
- 0x60000040, 0x00000000,
- 0x1F00002C, 0x0000002C,
- 0x808C0003, 0x00000008,
- 0x98080000, 0x0000FF07,
- 0x60000040, 0x00000000,
- 0x1F000034, 0x00000034,
- 0x60000040, 0x00000000,
- 0x80880000, 0xFFFFFF38,
- 0x60000040, 0x00000000,
- 0x48000000, 0x00000000,
- 0x98080000, 0x0000FF02,
- 0x60000040, 0x00000000,
- 0x87830000, 0xFFFFFF10,
- 0x1F00002C, 0x0000002C,
- 0x98040004, 0x0000FF08,
- 0x60000040, 0x00000000,
- 0x48000000, 0x00000000,
- 0x98080000, 0x0000FF01,
- 0x54000000, 0x00000030,
- 0x72230000, 0x00000000,
- 0x6A340000, 0x00000000,
- 0x9F030000, 0x0000FF09,
- 0x1F00001C, 0x0000001C,
- 0x60000040, 0x00000000,
- 0x98080000, 0x0000FF03,
- 0x74212800, 0x00000000,
- 0x78160000, 0x00000000,
- 0x980C0020, 0x0000FF04,
- 0x80880000, 0xFFFFFFA8,
- 0x1E000004, 0x00000004,
- 0x80880000, 0xFFFFFE80,
- 0x60000008, 0x00000000,
- 0x1A00000C, 0x0000000C,
- 0x80880000, 0xFFFFFE68,
- 0x1800003C, 0x0000003C,
- 0x88830000, 0xFFFFFE58,
- 0x18000044, 0x00000044,
- 0x88830000, 0xFFFFFE48,
- 0x1800004C, 0x0000004C,
- 0x88830000, 0xFFFFFE38,
- 0x18000054, 0x00000054,
- 0x88830000, 0xFFFFFE28,
- 0x1800005C, 0x0000005C,
- 0x88830000, 0xFFFFFE18,
- 0x18000064, 0x00000064,
- 0x88830000, 0xFFFFFE08,
- 0x1800006C, 0x0000006C,
- 0x88830000, 0xFFFFFDF8,
- 0x18000074, 0x00000074,
- 0x88830000, 0xFFFFFDE8,
- 0x1800007C, 0x0000007C,
- 0x88880000, 0xFFFFFDD8,
- 0x1900003C, 0x0000003C,
- 0x89830000, 0xFFFFFDC8,
- 0x19000044, 0x00000044,
- 0x89830000, 0xFFFFFDB8,
- 0x1900004C, 0x0000004C,
- 0x89830000, 0xFFFFFDA8,
- 0x19000054, 0x00000054,
- 0x89830000, 0xFFFFFD98,
- 0x1900005C, 0x0000005C,
- 0x89830000, 0xFFFFFD88,
- 0x19000064, 0x00000064,
- 0x89830000, 0xFFFFFD78,
- 0x1900006C, 0x0000006C,
- 0x89830000, 0xFFFFFD68,
- 0x19000074, 0x00000074,
- 0x89830000, 0xFFFFFD58,
- 0x1900007C, 0x0000007C,
- 0x88880000, 0xFFFFFD48,
- 0x1B000014, 0x00000014,
- 0x9F030000, 0x0000FF0A,
- 0x1F00001C, 0x0000001C,
- 0x60000040, 0x00000000,
- 0x48000000, 0x00000000,
- 0x98080000, 0x0000FF00
-
+unsigned long scripts[] = {
+ 0x47000000, 0x00000118, /* 000 - 0 */
+ 0x878b0000, 0x00000030, /* 008 - 8 */
+ 0x868a0000, 0x00000168, /* 010 - 16 */
+ 0x828a0000, 0x00000170, /* 018 - 24 */
+ 0x808a0000, 0x00000180, /* 020 - 32 */
+ 0x818a0000, 0x00000288, /* 028 - 40 */
+ 0x838a0000, 0x00000390, /* 030 - 48 */
+ 0x98080000, 0x0000ff05, /* 038 - 56 */
+ 0x1f000024, 0x00000024, /* 040 - 64 */
+ 0x808c0001, 0x00000040, /* 048 - 72 */
+ 0x808c0004, 0x00000078, /* 050 - 80 */
+ 0x808c0002, 0x00000088, /* 058 - 88 */
+ 0x808c0007, 0x00000010, /* 060 - 96 */
+ 0x808c0003, 0x00000008, /* 068 - 104 */
+ 0x98080000, 0x0000ff06, /* 070 - 112 */
+ 0x60000040, 0x00000000, /* 078 - 120 */
+ 0x60000008, 0x00000000, /* 080 - 128 */
+ 0x80880000, 0xffffff78, /* 088 - 136 */
+ 0x60000040, 0x00000000, /* 090 - 144 */
+ 0x1f00002c, 0x0000002c, /* 098 - 152 */
+ 0x808c0003, 0x00000008, /* 0a0 - 160 */
+ 0x98080000, 0x0000ff07, /* 0a8 - 168 */
+ 0x60000040, 0x00000000, /* 0b0 - 176 */
+ 0x1f000034, 0x00000034, /* 0b8 - 184 */
+ 0x60000040, 0x00000000, /* 0c0 - 192 */
+ 0x80880000, 0xffffff38, /* 0c8 - 200 */
+ 0x60000040, 0x00000000, /* 0d0 - 208 */
+ 0x48000000, 0x00000000, /* 0d8 - 216 */
+ 0x98080000, 0x0000ff02, /* 0e0 - 224 */
+ 0x60000040, 0x00000000, /* 0e8 - 232 */
+ 0x87830000, 0xffffff10, /* 0f0 - 240 */
+ 0x1f00002c, 0x0000002c, /* 0f8 - 248 */
+ 0x98040004, 0x0000ff08, /* 100 - 256 */
+ 0x60000040, 0x00000000, /* 108 - 264 */
+ 0x48000000, 0x00000000, /* 110 - 272 */
+ 0x98080000, 0x0000ff01, /* 118 - 280 */
+ 0x54000000, 0x00000038, /* 120 - 288 */
+ 0x72230000, 0x00000000, /* 128 - 296 */
+ 0x6a340000, 0x00000000, /* 130 - 304 */
+ 0x9f030000, 0x0000ff09, /* 138 - 312 */
+ 0x1f00001c, 0x0000001c, /* 140 - 320 */
+ 0x98080000, 0x0000ff03, /* 148 - 328 */
+ 0x60000040, 0x00000000, /* 150 - 336 */
+ 0x80880000, 0xfffffea8, /* 158 - 344 */
+ 0x74011000, 0x00000000, /* 160 - 352 */
+ 0x980c0000, 0x0000ff04, /* 168 - 360 */
+ 0x74164000, 0x00000000, /* 170 - 368 */
+ 0x80880000, 0xffffffa0, /* 178 - 376 */
+ 0x1e000004, 0x00000004, /* 180 - 384 */
+ 0x80880000, 0xfffffe78, /* 188 - 392 */
+ 0x60000008, 0x00000000, /* 190 - 400 */
+ 0x1a00000c, 0x0000000c, /* 198 - 408 */
+ 0x80880000, 0xfffffe60, /* 1a0 - 416 */
+ 0x1800003c, 0x0000003c, /* 1a8 - 424 */
+ 0x88830000, 0xfffffe50, /* 1b0 - 432 */
+ 0x18000044, 0x00000044, /* 1b8 - 440 */
+ 0x88830000, 0xfffffe40, /* 1c0 - 448 */
+ 0x1800004c, 0x0000004c, /* 1c8 - 456 */
+ 0x88830000, 0xfffffe30, /* 1d0 - 464 */
+ 0x18000054, 0x00000054, /* 1d8 - 472 */
+ 0x88830000, 0xfffffe20, /* 1e0 - 480 */
+ 0x1800005c, 0x0000005c, /* 1e8 - 488 */
+ 0x88830000, 0xfffffe10, /* 1f0 - 496 */
+ 0x18000064, 0x00000064, /* 1f8 - 504 */
+ 0x88830000, 0xfffffe00, /* 200 - 512 */
+ 0x1800006c, 0x0000006c, /* 208 - 520 */
+ 0x88830000, 0xfffffdf0, /* 210 - 528 */
+ 0x18000074, 0x00000074, /* 218 - 536 */
+ 0x88830000, 0xfffffde0, /* 220 - 544 */
+ 0x1800007c, 0x0000007c, /* 228 - 552 */
+ 0x88830000, 0xfffffdd0, /* 230 - 560 */
+ 0x18000084, 0x00000084, /* 238 - 568 */
+ 0x88830000, 0xfffffdc0, /* 240 - 576 */
+ 0x1800008c, 0x0000008c, /* 248 - 584 */
+ 0x88830000, 0xfffffdb0, /* 250 - 592 */
+ 0x18000094, 0x00000094, /* 258 - 600 */
+ 0x88830000, 0xfffffda0, /* 260 - 608 */
+ 0x1800009c, 0x0000009c, /* 268 - 616 */
+ 0x88830000, 0xfffffd90, /* 270 - 624 */
+ 0x180000a4, 0x000000a4, /* 278 - 632 */
+ 0x88830000, 0xfffffd80, /* 280 - 640 */
+ 0x180000ac, 0x000000ac, /* 288 - 648 */
+ 0x88830000, 0xfffffd70, /* 290 - 656 */
+ 0x180000b4, 0x000000b4, /* 298 - 664 */
+ 0x88830000, 0xfffffd60, /* 2a0 - 672 */
+ 0x180000bc, 0x000000bc, /* 2a8 - 680 */
+ 0x88880000, 0xfffffd50, /* 2b0 - 688 */
+ 0x1900003c, 0x0000003c, /* 2b8 - 696 */
+ 0x89830000, 0xfffffd40, /* 2c0 - 704 */
+ 0x19000044, 0x00000044, /* 2c8 - 712 */
+ 0x89830000, 0xfffffd30, /* 2d0 - 720 */
+ 0x1900004c, 0x0000004c, /* 2d8 - 728 */
+ 0x89830000, 0xfffffd20, /* 2e0 - 736 */
+ 0x19000054, 0x00000054, /* 2e8 - 744 */
+ 0x89830000, 0xfffffd10, /* 2f0 - 752 */
+ 0x1900005c, 0x0000005c, /* 2f8 - 760 */
+ 0x89830000, 0xfffffd00, /* 300 - 768 */
+ 0x19000064, 0x00000064, /* 308 - 776 */
+ 0x89830000, 0xfffffcf0, /* 310 - 784 */
+ 0x1900006c, 0x0000006c, /* 318 - 792 */
+ 0x89830000, 0xfffffce0, /* 320 - 800 */
+ 0x19000074, 0x00000074, /* 328 - 808 */
+ 0x89830000, 0xfffffcd0, /* 330 - 816 */
+ 0x1900007c, 0x0000007c, /* 338 - 824 */
+ 0x89830000, 0xfffffcc0, /* 340 - 832 */
+ 0x19000084, 0x00000084, /* 348 - 840 */
+ 0x89830000, 0xfffffcb0, /* 350 - 848 */
+ 0x1900008c, 0x0000008c, /* 358 - 856 */
+ 0x89830000, 0xfffffca0, /* 360 - 864 */
+ 0x19000094, 0x00000094, /* 368 - 872 */
+ 0x89830000, 0xfffffc90, /* 370 - 880 */
+ 0x1900009c, 0x0000009c, /* 378 - 888 */
+ 0x89830000, 0xfffffc80, /* 380 - 896 */
+ 0x190000a4, 0x000000a4, /* 388 - 904 */
+ 0x89830000, 0xfffffc70, /* 390 - 912 */
+ 0x190000ac, 0x000000ac, /* 398 - 920 */
+ 0x89830000, 0xfffffc60, /* 3a0 - 928 */
+ 0x190000b4, 0x000000b4, /* 3a8 - 936 */
+ 0x89830000, 0xfffffc50, /* 3b0 - 944 */
+ 0x190000bc, 0x000000bc, /* 3b8 - 952 */
+ 0x88880000, 0xfffffc40, /* 3c0 - 960 */
+ 0x1b000014, 0x00000014, /* 3c8 - 968 */
+ 0x9f030000, 0x0000ff0a, /* 3d0 - 976 */
+ 0x1f00001c, 0x0000001c, /* 3d8 - 984 */
+ 0x60000040, 0x00000000, /* 3e0 - 992 */
+ 0x48000000, 0x00000000, /* 3e8 - 1000 */
+ 0x98080000, 0x0000ff00, /* 3f0 - 1008 */
+ 0x80880000, 0xfffffd20, /* 3f8 - 1016 */
};
-#define Ent_scripts 0x00000000
-#define Ent_switch 0x00000008
+#define A_ds_Device 0x00000000
+#define A_ds_MsgOut 0x00000004
+#define A_ds_Cmd 0x0000000c
+#define A_ds_Status 0x00000014
+#define A_ds_Msg 0x0000001c
+#define A_ds_MsgIn 0x00000024
+#define A_ds_ExtMsg 0x0000002c
+#define A_ds_SyncMsg 0x00000034
+#define A_ds_Data1 0x0000003c
+#define A_ds_Data2 0x00000044
+#define A_ds_Data3 0x0000004c
+#define A_ds_Data4 0x00000054
+#define A_ds_Data5 0x0000005c
+#define A_ds_Data6 0x00000064
+#define A_ds_Data7 0x0000006c
+#define A_ds_Data8 0x00000074
+#define A_ds_Data9 0x0000007c
+#define A_ds_Data10 0x00000084
+#define A_ds_Data11 0x0000008c
+#define A_ds_Data12 0x00000094
+#define A_ds_Data13 0x0000009c
+#define A_ds_Data14 0x000000a4
+#define A_ds_Data15 0x000000ac
+#define A_ds_Data16 0x000000b4
+#define A_ds_Data17 0x000000bc
+#define A_ok 0x0000ff00
+#define A_err1 0x0000ff01
+#define A_err2 0x0000ff02
+#define A_err3 0x0000ff03
+#define A_err4 0x0000ff04
+#define A_err5 0x0000ff05
+#define A_err6 0x0000ff06
+#define A_err7 0x0000ff07
+#define A_err8 0x0000ff08
+#define A_err9 0x0000ff09
+#define A_err10 0x0000ff0a
+#define Ent_scripts 0x00000000
+#define Ent_switch 0x00000008
#define Ent_wait_reselect 0x00000120
-#define Ent_dataout 0x000001a0
-#define Ent_datain 0x00000230
+#define Ent_dataout 0x000001a8
+#define Ent_datain 0x000002b8
-unsigned long INSTRUCTIONS = 0x0000005e;
-unsigned long PATCHES = 0x00000000;
+unsigned long INSTRUCTIONS = 0x00000080;
+unsigned long PATCHES = 0x00000000;
diff --git a/sys/arch/mvme88k/dev/siop_script.ss b/sys/arch/mvme88k/dev/siop_script.ss
index c8d107091aa..c107e71469b 100644
--- a/sys/arch/mvme88k/dev/siop_script.ss
+++ b/sys/arch/mvme88k/dev/siop_script.ss
@@ -1,4 +1,4 @@
-; $NetBSD: siop_script.ss,v 1.3 1995/08/18 15:28:11 chopps Exp $
+; $OpenBSD: siop_script.ss,v 1.2 1998/12/15 05:52:31 smurph Exp $
;
; Copyright (c) 1995 Michael L. Hitch
@@ -91,7 +91,6 @@ msgin:
JUMP REL(msg_sdp), IF 0x02 ; save data pointers
JUMP REL(msg_rej), IF 0x07 ; message reject
JUMP REL(msg_rdp), IF 0x03 ; restore data pointers
-
INT err6 ; unrecognized message
msg_rdp:
@@ -136,14 +135,16 @@ wait_reselect:
INT err9, WHEN NOT MSG_IN ; didn't get IDENTIFY
MOVE FROM ds_Msg, WHEN MSG_IN
- CLEAR ACK ; acknowlege the message
INT err3 ; let host know about reconnect
+ CLEAR ACK ; acknowlege the message
+ JUMP REL(switch)
+
select_adr:
- MOVE ISTAT & 0x28 to SFBR ; get connected status
- MOVE CTEST2 to CTEST2 ; clear Sig_P
- INT err4, IF 0x20 ; tell host of interrupted reselect
- JUMP REL(wait_reselect) ; try reselect again
+ MOVE SCNTL1 & 0x10 to SFBR ; get connected status
+ INT err4, IF 0x00 ; tell host if not connected
+ MOVE CTEST2 & 0x40 to SFBR ; clear Sig_P
+ JUMP REL(wait_reselect) ; and try reselect again
msgout:
MOVE FROM ds_MsgOut, WHEN MSG_OUT
@@ -201,3 +202,4 @@ end:
CLEAR ACK
WAIT DISCONNECT
INT ok ; signal completion
+ JUMP REL(wait_reselect)
diff --git a/sys/arch/mvme88k/dev/siopdma.c b/sys/arch/mvme88k/dev/siopdma.c
index 845dc3c1e6f..177f49669a0 100644
--- a/sys/arch/mvme88k/dev/siopdma.c
+++ b/sys/arch/mvme88k/dev/siopdma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: afsc.c,v 1.6 1995/02/12 19:19:00 chopps Exp $ */
+/* $OpenBSD: siopdma.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
@@ -113,39 +113,14 @@ afscmatch(pdp, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
+ int ret;
-#if defined(MVME187)
- caddr_t base;
- if (cputyp != CPU_187)
- {
- return 0;
- }
-
- /*
- * If bus or name do not match, fail.
- */
- if (ca->ca_bustype != BUS_PCCTWO ||
- strcmp(cf->cf_driver->cd_name, "siop")) {
- return 0;
- }
-
- base = (caddr_t)cf->cf_loc[0];
-
- if (badpaddr(base, 1) == -1) {
- return 0;
+ if ((ret = badvaddr(IIOV(ca->ca_vaddr), 4)) <=0){
+ printf("==> siop: failed address check returning %ld.\n", ret);
+ return(0);
}
- /*
- * tell our parent our requirements
- */
- ca->ca_paddr = (caddr_t)SCSI_ADDR;
- ca->ca_size = NCR710_SIZE;
- ca->ca_ipl = IPL_BIO;
-
- return 1;
-#else
- return (!badvaddr(ca->ca_vaddr, 4));
-#endif /* defined(MVME187) */
+ return (1);
}
void
@@ -156,16 +131,17 @@ afscattach(parent, self, auxp)
struct siop_softc *sc = (struct siop_softc *)self;
struct confargs *ca = auxp;
siop_regmap_p rp;
+ int tmp;
extern int cpuspeed;
- sc->sc_siopp = rp = (siop_regmap_p)ca->ca_vaddr;
+ sc->sc_siopp = rp = ca->ca_vaddr;
/*
* siop uses sc_clock_freq to define the dcntl & ctest7 reg values
* (was 0x0221, but i added SIOP_CTEST7_SC0 for snooping control)
+ * XXX does the clock frequency change for the 33MHz processors?
*/
sc->sc_clock_freq = cpuspeed * 2;
-
#ifdef MVME177
/* XXX this is a guess! */
if (cputyp == CPU_177)
@@ -226,16 +202,17 @@ afscattach(parent, self, auxp)
* just in case.
*/
- struct pcc2reg *pcc2 = (struct pcc2reg *)ca->ca_parent;
+ struct pcctworeg *pcc2 = (struct pcctworeg *)ca->ca_master;
pmap_cache_ctrl(pmap_kernel(), M88K_TRUNC_PAGE((vm_offset_t)sc),
M88K_ROUND_PAGE((vm_offset_t)sc + sizeof(*sc)),
CACHE_INH);
#endif
- intr_establish(PCC2_VECT + SCSIIRQ, &sc->sc_ih);
+ pcctwointr_establish(PCC2V_NCR, &sc->sc_ih);
+/* intr_establish(PCC2_VECT + SCSIIRQ, &sc->sc_ih);*/
/* enable interrupts at ca_ipl */
- pcc2->pcc2_scsiirq = ca->ca_ipl | PCC2_SCSIIRQ_IEN;
-
+ pcc2->pcc2_ncrirq = ca->ca_ipl | PCC2_IRQ_IEN;
+/* pcc2->pcc2_scsiirq = ca->ca_ipl | PCC2_SCSIIRQ_IEN;*/
break;
}
#endif
@@ -244,11 +221,15 @@ afscattach(parent, self, auxp)
evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
/*
- * attach all scsi units on us
+ * attach all scsi units on us, watching for boot device
+ * (see dk_establish).
*/
- config_found(self, &sc->sc_link, afscprint);
+ tmp = bootpart;
+ if (ca->ca_paddr != bootaddr)
+ bootpart = -1; /* invalid flag to dk_establish */
+ config_found(self, &sc->sc_link, scsiprint);
+ bootpart = tmp; /* restore old value */
}
-
/*
* print diag if pnp is NULL else just extra
*/
@@ -298,14 +279,14 @@ afsc_dmaintr(sc)
return (1);
}
-#ifdef DEBUG
+#ifdef XXX_CD_DEBUG /* XXXsmurph What is afsccd ?? */
void
afsc_dump()
{
int i;
- for (i = 0; i < siop_cd.cd_ndevs; ++i)
- if (siop_cd.cd_devs[i])
- siop_dump(siop_cd.cd_devs[i]);
+ for (i = 0; i < afsccd.cd_ndevs; ++i)
+ if (afsccd.cd_devs[i])
+ siop_dump(afsccd.cd_devs[i]);
}
#endif
diff --git a/sys/arch/mvme88k/dev/siopreg.h b/sys/arch/mvme88k/dev/siopreg.h
index 0fce258fbc5..d4345934bb5 100644
--- a/sys/arch/mvme88k/dev/siopreg.h
+++ b/sys/arch/mvme88k/dev/siopreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: siopreg.h,v 1.7 1995/08/18 15:28:13 chopps Exp $ */
+/* $OpenBSD: siopreg.h,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
diff --git a/sys/arch/mvme88k/dev/siopvar.h b/sys/arch/mvme88k/dev/siopvar.h
index b695891841e..0e61b358401 100644
--- a/sys/arch/mvme88k/dev/siopvar.h
+++ b/sys/arch/mvme88k/dev/siopvar.h
@@ -1,4 +1,4 @@
-/* $Id: siopvar.h,v 1.1 1997/03/03 19:32:05 rahnds Exp $ */
+/* $OpenBSD: siopvar.h,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
diff --git a/sys/arch/mvme88k/dev/sram.c b/sys/arch/mvme88k/dev/sram.c
new file mode 100644
index 00000000000..f930c54866b
--- /dev/null
+++ b/sys/arch/mvme88k/dev/sram.c
@@ -0,0 +1,223 @@
+/* $OpenBSD: sram.c,v 1.1 1998/12/15 05:52:31 smurph Exp $ */
+
+/*
+ * Copyright (c) 1995 Theo de Raadt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/ioctl.h>
+#include <sys/buf.h>
+#include <sys/systm.h>
+#include <sys/uio.h>
+#include <sys/malloc.h>
+
+#include <sys/device.h>
+#include <machine/cpu.h>
+#include <machine/autoconf.h>
+#include <machine/mioctl.h>
+#include <vm/vm.h>
+
+struct sramsoftc {
+ struct device sc_dev;
+ void * sc_paddr;
+ void * sc_vaddr;
+ int sc_len;
+};
+
+void sramattach __P((struct device *, struct device *, void *));
+int srammatch __P((struct device *, void *, void *));
+
+struct cfattach sram_ca = {
+ sizeof(struct sramsoftc), srammatch, sramattach
+};
+
+struct cfdriver sram_cd = {
+ NULL, "sram", DV_DULL, 0
+};
+
+int
+srammatch(parent, vcf, args)
+ struct device *parent;
+ void *vcf, *args;
+{
+ struct cfdata *cf = vcf;
+ struct confargs *ca = args;
+ int ret;
+
+ if (cputyp != CPU_187)
+ return (0);
+
+ ca->ca_paddr = (void *)0xffe00000;
+ ca->ca_vaddr = (void *)0xffe00000;
+
+ if (ca->ca_vaddr == (void *)-1){
+ if (badvaddr(ca->ca_vaddr, 4) <= 0){
+ printf("==> sram: failed physical address check.\n");
+ return (0);
+ }
+ }
+ if (badvaddr(ca->ca_vaddr, 1) <= 0){
+ printf("==> sram: failed virtual address check.\n");
+ return (0);
+ }
+ return (1);
+}
+
+void
+sramattach(parent, self, args)
+ struct device *parent, *self;
+ void *args;
+{
+ struct confargs *ca = args;
+ struct sramsoftc *sc = (struct sramsoftc *)self;
+ struct mcreg *mc;
+ int i;
+
+ switch (cputyp) {
+#ifdef MVME167
+ case CPU_167:
+ case CPU_166:
+ sc->sc_len = 128*1024; /* always 128K */
+ break;
+#endif
+#ifdef MVME177
+ case CPU_177:
+ sc->sc_len = 128*1024; /* always 128K */
+ break;
+#endif
+#ifdef MVME187
+ case CPU_187:
+ sc->sc_len = 128*1024; /* always 128K */
+ break;
+#endif
+ default:
+ sc->sc_len = 0;
+ break;
+ }
+
+ printf(": len %d", sc->sc_len);
+
+ sc->sc_paddr = ca->ca_paddr;
+ sc->sc_vaddr = mapiodev((void *)sc->sc_paddr, sc->sc_len);
+ if (sc->sc_vaddr == NULL) {
+ sc->sc_len = 0;
+ printf(" -- failed to map");
+ }
+ printf("\n");
+}
+
+/*ARGSUSED*/
+int
+sramopen(dev, flag, mode)
+ dev_t dev;
+ int flag, mode;
+{
+ if (minor(dev) >= sram_cd.cd_ndevs ||
+ sram_cd.cd_devs[minor(dev)] == NULL)
+ return (ENODEV);
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+sramclose(dev, flag, mode)
+ dev_t dev;
+ int flag, mode;
+{
+
+ return (0);
+}
+
+/*ARGSUSED*/
+int
+sramioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ caddr_t data;
+ int cmd, flag;
+ struct proc *p;
+{
+ int unit = minor(dev);
+ struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
+ int error = 0;
+
+ switch (cmd) {
+ case MIOCGSIZ:
+ *(int *)data = sc->sc_len;
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return (error);
+}
+
+/*ARGSUSED*/
+int
+sramread(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+ int unit = minor(dev);
+ struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
+
+ return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
+}
+
+/*ARGSUSED*/
+int
+sramwrite(dev, uio, flags)
+ dev_t dev;
+ struct uio *uio;
+ int flags;
+{
+ int unit = minor(dev);
+ struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
+
+ return (memdevrw(sc->sc_vaddr, sc->sc_len, uio, flags));
+}
+
+int
+srammmap(dev, off, prot)
+ dev_t dev;
+ int off, prot;
+{
+ int unit = minor(dev);
+ struct sramsoftc *sc = (struct sramsoftc *) sram_cd.cd_devs[unit];
+
+ if (minor(dev) != 0)
+ return (-1);
+
+ /* allow access only in RAM */
+ if (off > sc->sc_len)
+ return (-1);
+ return (m88k_btop(sc->sc_paddr + off));
+}
diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c
index 735f1037079..7e8b14fe3c9 100644
--- a/sys/arch/mvme88k/dev/vme.c
+++ b/sys/arch/mvme88k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: vme.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -45,6 +45,7 @@
#include <sys/device.h>
#include <machine/autoconf.h>
#include <machine/cpu.h>
+#include <machine/frame.h>
#include "pcctwo.h"
@@ -56,8 +57,7 @@ void vmeattach __P((struct device *, struct device *, void *));
int vme1chip_init __P((struct vmesoftc *sc));
int vme2chip_init __P((struct vmesoftc *sc));
u_long vme2chip_map __P((u_long base, int len, int dwidth));
-
-int vme2abort __P((void *cap, void *frame));
+int vme2abort __P((struct frame *frame));
static int vmebustype;
@@ -70,37 +70,41 @@ struct cfdriver vme_cd = {
};
int
-vmematch(parent, self, args)
+vmematch(parent, cf, args)
struct device *parent;
- void *self;
+ void *cf;
void *args;
{
- /* XXX should we look at the id/rev in GCSR area? nivas */
- caddr_t base;
- u_char id;
- u_char rev;
- struct cfdata *cf = self;
struct confargs *ca = args;
- /*
- * If bus or name do not match, fail.
- */
+#if NMC > 0
+ if (ca->ca_bustype == BUS_MC) {
+ struct mcreg *mc = (struct mcreg *)ca->ca_master;
- if (ca->ca_bustype != BUS_MAIN ||
- strcmp(cf->cf_driver->cd_name, "vme")) {
- return 0;
+ if (mc->mc_ver & MC_VER_NOVME)
+ return (0);
}
-
- if ((base = (caddr_t)cf->cf_loc[0]) == (caddr_t)-1) {
- return 0;
+#endif
+ return (1);
}
- ca->ca_size = 0x100;
- ca->ca_paddr = base;
- ca->ca_bustype = BUS_PCCTWO;
+#if defined(MVME162) || defined(MVME167) || defined(MVME177) || defined (MVME187)
+/*
+ * make local addresses 1G-2G correspond to VME addresses 3G-4G,
+ * as D32
+ */
+#define VME2_D32STARTPHYS (1*1024*1024*1024UL)
+#define VME2_D32ENDPHYS (2*1024*1024*1024UL)
+#define VME2_D32STARTVME (3*1024*1024*1024UL)
+#define VME2_D32BITSVME (3*1024*1024*1024UL)
- return (1);
-}
+/*
+ * make local addresses 3G-3.75G correspond to VME addresses 3G-3.75G,
+ * as D16
+ */
+#define VME2_D16STARTPHYS (3*1024*1024*1024UL)
+#define VME2_D16ENDPHYS (3*1024*1024*1024UL + 768*1024*1024UL)
+#endif
/*
* Returns a physical address mapping for a VME address & length.
@@ -108,14 +112,14 @@ vmematch(parent, self, args)
* mappings, ie. the MVME147 cannot do 32 bit accesses to VME bus
* addresses from 0 to physmem.
*/
-caddr_t
+void *
vmepmap(sc, vmeaddr, len, bustype)
struct vmesoftc *sc;
- caddr_t vmeaddr;
+ void *vmeaddr;
int len;
int bustype;
{
- u_long base = (u_long)vmeaddr;
+ u_int32_t base = (u_int32_t)vmeaddr;
len = roundup(len, NBPG);
switch (vmebustype) {
@@ -123,13 +127,18 @@ vmepmap(sc, vmeaddr, len, bustype)
case BUS_PCC:
switch (bustype) {
case BUS_VMES:
+ printf("base 0x%8x/0x%8x len 0x%x\n",
+ vmeaddr, base, len);
if (base > VME1_A16BASE &&
- (base+len - VME1_A16BASE) < VME1_A16D16LEN)
+ (base+len - VME1_A16BASE) < VME1_A16D16LEN) {
base = base - VME1_A16BASE + VME1_A16D16BASE;
- else if (base+len < VME1_A32D16LEN)
- base = base + VME1_A32D16BASE;
- else {
- printf("%s: cannot map pa %x len %x\n",
+ printf("vmes1: base = 0x%8x\n", base); /* 1:1 */
+ } else if (base > VME1_A32D16BASE &&
+ base+len < VME1_A16BASE) {
+ /* 1:1 mapped */
+ printf("vmes2: base = 0x%8x\n", base);
+ } else {
+ printf("%s: cannot map pa 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, base, len);
return (NULL);
}
@@ -140,7 +149,7 @@ vmepmap(sc, vmeaddr, len, bustype)
else if (base+len < VME1_A32D16LEN) /* HACK! */
base = base + VME1_A32D16BASE;
else {
- printf("%s: cannot map pa %x len %x\n",
+ printf("%s: cannot map pa 0x%x len 0x%x\n",
sc->sc_dev.dv_xname, base, len);
return (NULL);
}
@@ -153,15 +162,19 @@ vmepmap(sc, vmeaddr, len, bustype)
case BUS_PCCTWO:
switch (bustype) {
case BUS_VMES:
+ /*printf("base %x len %d\n", base, len);*/
if (base > VME2_A16BASE &&
- (base+len-VME2_A16BASE) < VME2_A16D16LEN)
+ (base+len-VME2_A16BASE) < VME2_A16D16LEN) {
+ /* XXX busted? */
base = base - VME2_A16BASE + VME2_A16D16BASE;
- else if (base > VME2_A24BASE &&
- (base+len-VME2_A24BASE) < VME2_A24D16LEN)
- base = base - VME2_A24BASE + VME2_A24D16BASE;
- else if ((base+len) < VME2_A32D16LEN)
+ } else if (base > VME2_A24BASE &&
+ (base+len-VME2_A24BASE) < VME2_A24D16LEN) {
+ base = base - VME2_A24BASE + VME2_D16STARTPHYS;
+ } else if ((base+len) < VME2_A32D16LEN) {
+ /* XXX busted? */
base = base + VME2_A32D16BASE;
- else {
+ } else {
+ printf("vme2chip_map\n");
base = vme2chip_map(base, len, 16);
if (base == NULL)
return (NULL);
@@ -181,38 +194,32 @@ vmepmap(sc, vmeaddr, len, bustype)
break;
#endif
}
- return ((caddr_t)base);
+ return ((void *)base);
}
/* if successful, returns the va of a vme bus mapping */
-caddr_t
+void *
vmemap(sc, vmeaddr, len, bustype)
struct vmesoftc *sc;
- caddr_t vmeaddr;
+ void *vmeaddr;
int len;
int bustype;
{
- caddr_t pa, va;
- extern vm_offset_t iomap_mapin(vm_offset_t, vm_size_t, boolean_t);
+ void *pa, *va;
- pa = vmepmap(sc, pa, len, bustype);
+ pa = vmepmap(sc, vmeaddr, len, bustype);
if (pa == NULL)
return (NULL);
-#if 0
- va = (caddr_t)iomap_mapin((vm_offset_t)pa, len, 1);
-#endif
- va = pa;
+ va = mapiodev(pa, len);
return (va);
}
void
vmeunmap(va, len)
- caddr_t va;
+ void *va;
int len;
{
-#if 0
- iomap_mapout(va, len);
-#endif
+ unmapiodev(va, len);
}
int
@@ -225,7 +232,7 @@ vmerw(sc, uio, flags, bus)
register vm_offset_t o, v;
register int c;
register struct iovec *iov;
- caddr_t vme;
+ void *vme;
int error = 0;
while (uio->uio_resid > 0 && error == 0) {
@@ -244,13 +251,13 @@ vmerw(sc, uio, flags, bus)
c = NBPG - (v & PGOFSET);
if (c == 0)
return (0);
- vme = vmemap(sc, (caddr_t)(v & ~PGOFSET),
+ vme = vmemap(sc, (void *)(v & ~PGOFSET),
NBPG, BUS_VMES);
if (vme == NULL) {
error = EFAULT; /* XXX? */
continue;
}
- error = uiomove((caddr_t)vme + (v & PGOFSET), c, uio);
+ error = uiomove((void *)vme + (v & PGOFSET), c, uio);
vmeunmap(vme, NBPG);
}
return (error);
@@ -259,14 +266,15 @@ vmerw(sc, uio, flags, bus)
int
vmeprint(args, bus)
void *args;
- char *bus;
+ const char *bus;
{
struct confargs *ca = args;
+ printf(" addr 0x%x", ca->ca_offset);
+ if (ca->ca_vec > 0)
+ printf(" vec 0x%x", ca->ca_vec);
if (ca->ca_ipl > 0)
printf(" ipl %d", ca->ca_ipl);
- if (ca->ca_vec > 0)
- printf(" vec %d", ca->ca_vec);
return (UNCONF);
}
@@ -288,31 +296,30 @@ vmescan(parent, child, args, bustype)
bzero(&oca, sizeof oca);
oca.ca_bustype = bustype;
- oca.ca_paddr = (caddr_t)cf->cf_loc[0];
- oca.ca_size = cf->cf_loc[1];
- oca.ca_ipl = cf->cf_loc[2];
- oca.ca_vec = cf->cf_loc[3];
-
- /*
- * Assign a vector if the config file did not specify
- * one.
- */
-
-#ifdef notyet
+ oca.ca_paddr = (void *)cf->cf_loc[0];
+ oca.ca_len = cf->cf_loc[1];
+ oca.ca_vec = cf->cf_loc[2];
+ oca.ca_ipl = cf->cf_loc[3];
if (oca.ca_ipl > 0 && oca.ca_vec == -1)
- oca.ca_vec = intr_freevec();
-#endif /* notyet */
+ oca.ca_vec = intr_findvec(255, 0);
+ if (oca.ca_len == -1)
+ oca.ca_len = 4096;
- oca.ca_vaddr = (void *)vmemap(sc, oca.ca_paddr, oca.ca_size,
- oca.ca_bustype);
+ oca.ca_offset = (u_int)oca.ca_paddr;
+ oca.ca_vaddr = vmemap(sc, oca.ca_paddr, oca.ca_len, oca.ca_bustype);
if (!oca.ca_vaddr)
oca.ca_vaddr = (void *)-1;
- oca.ca_parent = (void *)sc;
+ oca.ca_master = (void *)sc;
+ oca.ca_name = cf->cf_driver->cd_name;
if ((*cf->cf_attach->ca_match)(parent, cf, &oca) == 0) {
if (oca.ca_vaddr != (void *)-1)
- vmeunmap(oca.ca_vaddr, oca.ca_size);
+ vmeunmap(oca.ca_vaddr, oca.ca_len);
return (0);
}
+ /*
+ * If match works, the driver is responsible for
+ * vmunmap()ing if it does not need the mapping.
+ */
config_attach(parent, cf, &oca, vmeprint);
return (1);
}
@@ -351,8 +358,6 @@ vmeattach(parent, self, args)
vme2chip_init(sc);
break;
#endif
- default:
- printf(" unknown parent bus %x", ca->ca_bustype);
}
while (config_found(self, NULL, NULL))
@@ -418,23 +423,8 @@ vme1chip_init(sc)
}
#endif
-#if defined(MVME162) || defined(MVME167) || defined(MVME177) || defined(MVME187)
-
-/*
- * make local addresses 1G-2G correspond to VME addresses 3G-4G,
- * as D32
- */
-#define VME2_D32STARTPHYS (1*1024*1024*1024UL)
-#define VME2_D32ENDPHYS (2*1024*1024*1024UL)
-#define VME2_D32STARTVME (3*1024*1024*1024UL)
-#define VME2_D32BITSVME (3*1024*1024*1024UL)
-/*
- * make local addresses 3G-3.75G correspond to VME addresses 3G-3.75G,
- * as D16
- */
-#define VME2_D16STARTPHYS (3*1024*1024*1024UL)
-#define VME2_D16ENDPHYS (3*1024*1024*1024UL + 768*1024*1024UL)
+#if defined(MVME162) || defined(MVME167) || defined(MVME177) || defined (MVME187)
/*
* XXX what AM bits should be used for the D32/D16 mappings?
@@ -451,48 +441,47 @@ vme2chip_init(sc)
ctl = vme2->vme2_masterctl;
-#if 0
- /* unused decoders 1 & 2 */
- printf("%s: phys 0x%08x-0x%08x to VMExxx 0x%08x-0x%08x\n",
+ /* unused decoders 1 */
+ vme2->vme2_master1 = 0;
+ ctl &= ~(VME2_MASTERCTL_ALL << VME2_MASTERCTL_1SHIFT);
+ printf("%s: 1phys 0x%08x-0x%08x to VMExxx 0x%08x-0x%08x\n",
sc->sc_dev.dv_xname,
vme2->vme2_master1 << 16, vme2->vme2_master1 & 0xffff0000,
vme2->vme2_master1 << 16, vme2->vme2_master1 & 0xffff0000);
- printf("%s: phys 0x%08x-0x%08x to VMExxx 0x%08x-0x%08x\n",
+
+ /* unused decoders 2 */
+ vme2->vme2_master2 = 0;
+ ctl &= ~(VME2_MASTERCTL_ALL << VME2_MASTERCTL_2SHIFT);
+ printf("%s: 2phys 0x%08x-0x%08x to VMExxx 0x%08x-0x%08x\n",
sc->sc_dev.dv_xname,
vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000,
vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000);
-#endif
- /* setup a D16 space */
+ /* setup a A24D16 space */
vme2->vme2_master3 = ((VME2_D16ENDPHYS-1) & 0xffff0000) |
(VME2_D16STARTPHYS >> 16);
ctl &= ~(VME2_MASTERCTL_ALL << VME2_MASTERCTL_3SHIFT);
- ctl |= (VME2_MASTERCTL_AM32SP | VME2_MASTERCTL_D16) <<
+ ctl |= (VME2_MASTERCTL_D16 | VME2_MASTERCTL_AM24UD) <<
VME2_MASTERCTL_3SHIFT;
-#if 0
- printf("%s: phys 0x%08x-0x%08x to VMED16 0x%08x-0x%08x\n",
+ printf("%s: 3phys 0x%08x-0x%08x to VMED16 0x%08x-0x%08x\n",
sc->sc_dev.dv_xname,
- VME2_D16STARTPHYS, VME2_D16ENDPHYS-1,
- VME2_D16STARTPHYS, VME2_D16ENDPHYS-1);
-#endif
+ vme2->vme2_master3 << 16, vme2->vme2_master3 & 0xffff0000,
+ vme2->vme2_master3 << 16, vme2->vme2_master3 & 0xffff0000);
- /* setup a D32 space */
+ /* setup a A32D32 space */
vme2->vme2_master4 = ((VME2_D32ENDPHYS-1) & 0xffff0000) |
(VME2_D32STARTPHYS >> 16);
vme2->vme2_master4mod = (VME2_D32STARTVME & 0xffff0000) |
(VME2_D32BITSVME >> 16);
ctl &= ~(VME2_MASTERCTL_ALL << VME2_MASTERCTL_4SHIFT);
- ctl |= (VME2_MASTERCTL_AM32SP) <<
+ ctl |= (VME2_MASTERCTL_AM32UD) <<
VME2_MASTERCTL_4SHIFT;
-#if 0
- printf("%s: phys 0x%08x-0x%08x to VMED32 0x%08x-0x%08x\n",
+ printf("%s: 4phys 0x%08x-0x%08x to VMED32 0x%08x-0x%08x\n",
sc->sc_dev.dv_xname,
- VME2_D32STARTPHYS, VME2_D32ENDPHYS-1,
- VME2_D32STARTVME, VME2_D32STARTVME | ~VME2_D32BITSVME);
-#endif
+ vme2->vme2_master4 << 16, vme2->vme2_master4 & 0xffff0000,
+ vme2->vme2_master4 << 16, vme2->vme2_master4 & 0xffff0000);
vme2->vme2_masterctl = ctl;
-
ctl = vme2->vme2_gcsrctl;
/* enable A16 short IO map decoder (0xffffxxxx) */
@@ -520,11 +509,10 @@ vme2chip_init(sc)
(6 << VME2_IRQL4_VME6SHIFT) | (5 << VME2_IRQL4_VME5SHIFT) |
(4 << VME2_IRQL4_VME4SHIFT) | (3 << VME2_IRQL4_VME3SHIFT) |
(2 << VME2_IRQL4_VME2SHIFT) | (1 << VME2_IRQL4_VME1SHIFT);
- /*
- * disable all interrupts, they will be enabled by each
- * driver when it configures
- */
- vme2->vme2_irqen = 0;
+ printf("%s: vme2_irql4 = 0x%08x\n", sc->sc_dev.dv_xname,
+ vme2->vme2_irql4);
+
+#if NPCCTWO > 0
if (vmebustype == BUS_PCCTWO){
/*
* pseudo driver, abort interrupt handler
@@ -539,7 +527,8 @@ vme2chip_init(sc)
intr_establish(110, &sc->sc_abih);
vme2->vme2_irqen |= VME2_IRQ_AB;
}
-
+#endif
+ vme2->vme2_irqen = vme2->vme2_irqen | VME2_IRQ_ACF;
}
/*
@@ -565,22 +554,22 @@ vme2chip_map(base, len, dwidth)
return (base - VME2_D32STARTVME + VME2_D32STARTPHYS);
}
}
-#if 1
+
+#if NPCCTWO > 0
int
-vme2abort(void *cap, void *frame)
+vme2abort(frame)
+ struct frame *frame;
{
struct vmesoftc *sc = (struct vmesoftc *) vme_cd.cd_devs[0];
struct vme2reg *vme2 = (struct vme2reg *)sc->sc_vaddr;
- extern void nmihand(void *);
- if (!(vme2->vme2_irqstat & VME2_IRQ_AB)) {
- printf("vme2abort irq not set\n");
- return 0;
+ if (vme2->vme2_irqstat & VME2_IRQ_AB == 0) {
+ printf("%s: vme2chip irq not set\n", sc->sc_dev.dv_xname);
+ return (0);
}
-
vme2->vme2_irqclr = VME2_IRQ_AB;
nmihand(frame);
- return 1;
+ return (1);
}
#endif
#endif /* MVME1[678]x */
diff --git a/sys/arch/mvme88k/dev/vme.h b/sys/arch/mvme88k/dev/vme.h
index 7a20f7aa2c6..f0663440e3d 100644
--- a/sys/arch/mvme88k/dev/vme.h
+++ b/sys/arch/mvme88k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: vme.h,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -35,10 +35,18 @@
#endif
struct vmesoftc {
struct device sc_dev;
- caddr_t sc_vaddr;
-#if 1
+ void * sc_vaddr;
struct intrhand sc_abih; /* `abort' switch */
-#endif
+};
+
+struct vmessoftc {
+ struct device sc_dev;
+ struct vmesoftc *sc_vme;
+};
+
+struct vmelsoftc {
+ struct device sc_dev;
+ struct vmesoftc *sc_vme;
};
/*
@@ -222,6 +230,7 @@ struct vme2reg {
/*60*/ volatile u_long vme2_tctl;
#define VME2_TCTL_SCON 0x40000000 /* we are SCON */
#define VME2_TCTL_SYSFAIL 0x20000000 /* light SYSFAIL led */
+#define VME2_TCTL_SRST 0x00800000 /* system reset */
/*64*/ volatile u_long vme2_prescale;
/*68*/ volatile u_long vme2_irqstat;
/*6c*/ volatile u_long vme2_irqen;
@@ -322,8 +331,8 @@ struct vme2reg {
#define VME2_A16BASE 0xffff0000UL
#define VME2_A24BASE 0xff000000UL
-caddr_t vmepmap __P((struct vmesoftc *sc, caddr_t vmeaddr, int len,
+void * vmepmap __P((struct vmesoftc *sc, void * vmeaddr, int len,
int bustype));
-caddr_t vmemap __P((struct vmesoftc *sc, caddr_t vmeaddr, int len,
+void * vmemap __P((struct vmesoftc *sc, void * vmeaddr, int len,
int bustype));
int vmerw __P((struct vmesoftc *sc, struct uio *uio, int flags, int bus));
diff --git a/sys/arch/mvme88k/dev/vmel.c b/sys/arch/mvme88k/dev/vmel.c
index 04f7b840ee9..064a8fb4b26 100644
--- a/sys/arch/mvme88k/dev/vmel.c
+++ b/sys/arch/mvme88k/dev/vmel.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: vmel.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -50,11 +50,6 @@
void vmelattach __P((struct device *, struct device *, void *));
int vmelmatch __P((struct device *, void *, void *));
-struct vmelsoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
struct cfattach vmel_ca = {
sizeof(struct vmelsoftc), vmelmatch, vmelattach
};
@@ -166,9 +161,9 @@ vmelmmap(dev, off, prot)
{
int unit = minor(dev);
struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit];
- caddr_t pa;
+ void * pa;
- pa = vmepmap(sc->sc_vme, (caddr_t)off, NBPG, BUS_VMEL);
+ pa = vmepmap(sc->sc_vme, (void *)off, NBPG, BUS_VMEL);
printf("vmel %x pa %x\n", off, pa);
if (pa == NULL)
return (-1);
diff --git a/sys/arch/mvme88k/dev/vmes.c b/sys/arch/mvme88k/dev/vmes.c
index 9bfa8c6dc84..dfe5a6cccb9 100644
--- a/sys/arch/mvme88k/dev/vmes.c
+++ b/sys/arch/mvme88k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $OpenBSD: vmes.c,v 1.2 1998/12/15 05:52:31 smurph Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -50,11 +50,6 @@
void vmesattach __P((struct device *, struct device *, void *));
int vmesmatch __P((struct device *, void *, void *));
-struct vmessoftc {
- struct device sc_dev;
- struct vmesoftc *sc_vme;
-};
-
struct cfattach vmes_ca = {
sizeof(struct vmessoftc), vmesmatch, vmesattach
};
@@ -63,7 +58,6 @@ struct cfdriver vmes_cd = {
NULL, "vmes", DV_DULL, 0
};
-
int
vmesmatch(parent, cf, args)
struct device *parent;
@@ -167,9 +161,9 @@ vmesmmap(dev, off, prot)
{
int unit = minor(dev);
struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit];
- caddr_t pa;
+ void * pa;
- pa = vmepmap(sc->sc_vme, (caddr_t)off, NBPG, BUS_VMES);
+ pa = vmepmap(sc->sc_vme, (void *)off, NBPG, BUS_VMES);
printf("vmes %x pa %x\n", off, pa);
if (pa == NULL)
return (-1);