diff options
author | Steve Murphree <smurph@cvs.openbsd.org> | 2001-02-12 08:16:26 +0000 |
---|---|---|
committer | Steve Murphree <smurph@cvs.openbsd.org> | 2001-02-12 08:16:26 +0000 |
commit | 9a9ae5302e41f0879df7c11b4ff60352055c1807 (patch) | |
tree | 73db1c914ed4b22e7818bc89d08cc84dbeb2b5f8 /sys/arch/mvme88k/dev | |
parent | 66350380586255bb69d50cd6b025c66c25b4cff5 (diff) |
correct buginstat(), statclock now working for '188, systat vmstat now works,
serial driver for '188 working better.
Diffstat (limited to 'sys/arch/mvme88k/dev')
-rw-r--r-- | sys/arch/mvme88k/dev/bugio.c | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/bugtty.c | 76 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/cl.c | 103 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/clock.c | 12 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/dart.c | 351 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_ve.c | 185 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/if_vereg.h | 3 | ||||
-rw-r--r-- | sys/arch/mvme88k/dev/sclock.c | 17 |
8 files changed, 424 insertions, 327 deletions
diff --git a/sys/arch/mvme88k/dev/bugio.c b/sys/arch/mvme88k/dev/bugio.c index 24346d014e0..19cfef7804e 100644 --- a/sys/arch/mvme88k/dev/bugio.c +++ b/sys/arch/mvme88k/dev/bugio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugio.c,v 1.5 2001/02/01 03:38:13 smurph Exp $ */ +/* $OpenBSD: bugio.c,v 1.6 2001/02/12 08:16:21 smurph Exp $ */ /* Copyright (c) 1998 Steve Murphree, Jr. */ #include <machine/bugio.h> @@ -105,7 +105,7 @@ buginstat(void) asm volatile ("tb0 0,r0,0x1F0"); asm volatile ("or %0,r0,r2" : "=r" (ret) : ); OSCTXT(); - return (ret & 0x4 ? 1 : 0); + return (ret & 0x4 ? 0 : 1); } bugoutstr(char *s, char *se) diff --git a/sys/arch/mvme88k/dev/bugtty.c b/sys/arch/mvme88k/dev/bugtty.c index 87e20c7189c..32edeb79178 100644 --- a/sys/arch/mvme88k/dev/bugtty.c +++ b/sys/arch/mvme88k/dev/bugtty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugtty.c,v 1.4 1998/12/15 05:52:29 smurph Exp $ */ +/* $OpenBSD: bugtty.c,v 1.5 2001/02/12 08:16:22 smurph Exp $ */ /* Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. * All rights reserved. @@ -77,7 +77,6 @@ char bugtty_ibuffer[BUGBUF+1]; volatile char *pinchar = bugtty_ibuffer; char bug_obuffer[BUGBUF+1]; -#define bugtty_tty bugttytty struct tty *bugtty_tty[NBUGTTY]; int needprom = 1; /* @@ -125,10 +124,22 @@ void bugttyoutput __P((struct tty *tp)); int bugttydefaultrate = TTYDEF_SPEED; int bugttyswflags; +struct tty * +bugttytty(dev) +dev_t dev; +{ + int unit; + unit = BUGTTYUNIT(dev); + if (unit >= 4) { + return (NULL); + } + return bugtty_tty[unit]; +} + int bugttymctl(dev, bits, how) - dev_t dev; - int bits, how; +dev_t dev; +int bits, how; { static int settings = TIOCM_DTR | TIOCM_RTS | TIOCM_CTS | TIOCM_CD | TIOCM_DSR; @@ -165,9 +176,9 @@ bugttymctl(dev, bits, how) int bugttyopen(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dev_t dev; +int flag, mode; +struct proc *p; { int s, unit = BUGTTYUNIT(dev); struct tty *tp; @@ -252,7 +263,7 @@ bugttyparam() void bugttyoutput(tp) - struct tty *tp; +struct tty *tp; { int cc, s, unit, cnt ; @@ -274,9 +285,9 @@ bugttyoutput(tp) int bugttyclose(dev, flag, mode, p) - dev_t dev; - int flag, mode; - struct proc *p; +dev_t dev; +int flag, mode; +struct proc *p; { int unit = BUGTTYUNIT(dev); struct tty *tp = bugtty_tty[unit]; @@ -292,9 +303,9 @@ bugttyclose(dev, flag, mode, p) int bugttyread(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; +dev_t dev; +struct uio *uio; +int flag; { struct tty *tp; @@ -308,12 +319,12 @@ bugttyread(dev, uio, flag) bugtty_chkinput() { struct tty *tp; - + int rc = 0; tp = bugtty_tty[0]; /* Kinda ugly hack */ if (tp == NULL ) return; - if (buginstat()) { + if (rc = buginstat()) { while (buginstat()) { u_char c = buginchr() & 0xff; (*linesw[tp->t_line].l_rint)(c, tp); @@ -327,9 +338,9 @@ bugtty_chkinput() int bugttywrite(dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; +dev_t dev; +struct uio *uio; +int flag; { #if 0 /* bypass tty output routines. */ @@ -356,11 +367,11 @@ bugttywrite(dev, uio, flag) int bugttyioctl(dev, cmd, data, flag, p) - dev_t dev; - int cmd; - caddr_t data; - int flag; - struct proc *p; +dev_t dev; +int cmd; +caddr_t data; +int flag; +struct proc *p; { int unit = BUGTTYUNIT(dev); struct tty *tp = bugtty_tty[unit]; @@ -430,8 +441,8 @@ bugttyioctl(dev, cmd, data, flag, p) int bugttystop(tp, flag) - struct tty *tp; - int flag; +struct tty *tp; +int flag; { int s; @@ -449,7 +460,7 @@ bugttystop(tp, flag) */ int bugttycnprobe(cp) - struct consdev *cp; +struct consdev *cp; { int maj; int needprom = 1; @@ -486,22 +497,23 @@ bugttycnprobe(cp) int bugttycninit(cp) - struct consdev *cp; +struct consdev *cp; { - /* Nothing to do */ + /* Nothing to do */ + return 0; } int bugttycngetc(dev) - dev_t dev; +dev_t dev; { return (buginchr()); } int bugttycnputc(dev, c) - dev_t dev; - char c; +dev_t dev; +char c; { int s; diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c index 06aec3f0659..8a07a627861 100644 --- a/sys/arch/mvme88k/dev/cl.c +++ b/sys/arch/mvme88k/dev/cl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl.c,v 1.7 2001/02/01 03:38:14 smurph Exp $ */ +/* $OpenBSD: cl.c,v 1.8 2001/02/12 08:16:22 smurph Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -748,8 +748,8 @@ int clclose (dev, flag, mode, p) return 0; } int clread (dev, uio, flag) - dev_t dev; - struct uio *uio; +dev_t dev; +struct uio *uio; int flag; { int unit, channel; @@ -768,10 +768,11 @@ int flag; return ENXIO; return((*linesw[tp->t_line].l_read)(tp, uio, flag)); } + int clwrite (dev, uio, flag) - dev_t dev; - struct uio *uio; - int flag; +dev_t dev; +struct uio *uio; +int flag; { int unit, channel; struct tty *tp; @@ -789,12 +790,13 @@ int clwrite (dev, uio, flag) return ENXIO; return((*linesw[tp->t_line].l_write)(tp, uio, flag)); } + int clioctl (dev, cmd, data, flag, p) - dev_t dev; - int cmd; - caddr_t data; - int flag; - struct proc *p; +dev_t dev; +int cmd; +caddr_t data; +int flag; +struct proc *p; { int error; int unit, channel; @@ -1366,6 +1368,7 @@ cl_clkrxtimeout(speed) /* return some sane value if unknown speed */ return cl_clocks[4].rx_timeout; } + void cl_unblock(tp) struct tty *tp; @@ -1374,6 +1377,7 @@ cl_unblock(tp) if (tp->t_outq.c_cc != 0) clstart(tp); } + void clstart(tp) struct tty *tp; @@ -1427,6 +1431,7 @@ clstart(tp) splx(s); return; } + int cl_mintr(sc) struct clsoftc *sc; @@ -1475,7 +1480,7 @@ cl_mintr(sc) int cl_txintr(sc) - struct clsoftc *sc; +struct clsoftc *sc; { static empty = 0; u_char tir, cmr, teoir; @@ -1485,16 +1490,16 @@ cl_txintr(sc) int cnt; u_char buffer[CL_FIFO_MAX +1]; u_char *tptr; - if(((tir = sc->cl_reg->cl_tir) & 0x40) == 0x0) { + if (((tir = sc->cl_reg->cl_tir) & 0x40) == 0x0) { /* only if intr is not shared ??? */ log(LOG_WARNING, "cl_txintr extra intr\n"); return 0; } sc->sc_txintrcnt.ev_count++; - channel = tir & 0x03; - cmr = sc->cl_reg->cl_cmr; - + channel = tir & 0x03; + cmr = sc->cl_reg->cl_cmr; + sc->sc_cl[channel].txcnt ++; tp = sc->sc_cl[channel].tty; @@ -1510,8 +1515,8 @@ cl_txintr(sc) int nbuf, busy, resid; void *pbuffer; dmabsts = sc->cl_reg->cl_dmabsts; - log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x\n", - channel, dmabsts); + log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x\n", + channel, dmabsts); nbuf = ((dmabsts & 0x8) >> 3) & 0x1; busy = ((dmabsts & 0x4) >> 2) & 0x1; @@ -1519,27 +1524,27 @@ cl_txintr(sc) pbuffer = sc->sc_cl[channel].tx[nbuf]; resid = tp->t_outq.c_cc; cnt = min (CL_BUFSIZE,resid); - log(LOG_WARNING, "cl_txintr: resid %x cnt %x pbuf %x\n", - resid, cnt, pbuffer); + log(LOG_WARNING, "cl_txintr: resid %x cnt %x pbuf %x\n", + resid, cnt, pbuffer); if (cnt != 0) { cnt = q_to_b(&tp->t_outq, pbuffer, cnt); resid -= cnt; if (nbuf == 0) { sc->cl_reg->cl_atbadru = - ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16; + ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16; sc->cl_reg->cl_atbadrl = - ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff; + ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff; sc->cl_reg->cl_atbcnt = cnt; sc->cl_reg->cl_atbsts = 0x43; } else { sc->cl_reg->cl_btbadru = - ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16; + ((u_long) sc->sc_cl[channel].txp[nbuf]) >> 16; sc->cl_reg->cl_btbadrl = - ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff; + ((u_long) sc->sc_cl[channel].txp[nbuf]) & 0xffff; sc->cl_reg->cl_btbcnt = cnt; sc->cl_reg->cl_btbsts = 0x43; } - teoir = 0x08; + teoir = 0x08; } else { teoir = 0x08; if (tp->t_state & TS_BUSY) { @@ -1555,7 +1560,7 @@ cl_txintr(sc) nbuf = ~nbuf & 0x1; busy--; } while (resid != 0 && busy != -1);/* if not busy do other buffer */ - log(LOG_WARNING, "cl_txintr: done\n"); + log(LOG_WARNING, "cl_txintr: done\n"); } break; case CL_TXINTR: @@ -1570,8 +1575,8 @@ cl_txintr(sc) teoir = 0x00; } else { if (empty > 5 && ((empty % 20000 )== 0)) { - log(LOG_WARNING, "cl_txintr to many empty intr %d channel %d\n", - empty, channel); + log(LOG_WARNING, "cl_txintr to many empty intr %d channel %d\n", + empty, channel); } empty++; teoir = 0x08; @@ -1683,36 +1688,36 @@ channel, nbuf, cnt, status); u_char *pbuf; tp = sc->sc_cl[channel].tty; pbuf = sc->sc_cl[channel].rx[nbuf]; - /* this should be done at off level */ -{ - u_short rcbadru, rcbadrl; - u_char arbsts, brbsts; - u_char *pbufs, *pbufe; - rcbadru = sc->cl_reg->cl_rcbadru; - rcbadrl = sc->cl_reg->cl_rcbadrl; - arbsts = sc->cl_reg->cl_arbsts; - brbsts = sc->cl_reg->cl_brbsts; - pbufs = sc->sc_cl[channel].rxp[nbuf]; - pbufe = (u_char *)(((u_long)rcbadru << 16) | (u_long)rcbadrl); - cnt = pbufe - pbufs; + /* this should be done at off level */ + { + u_short rcbadru, rcbadrl; + u_char arbsts, brbsts; + u_char *pbufs, *pbufe; + rcbadru = sc->cl_reg->cl_rcbadru; + rcbadrl = sc->cl_reg->cl_rcbadrl; + arbsts = sc->cl_reg->cl_arbsts; + brbsts = sc->cl_reg->cl_brbsts; + pbufs = sc->sc_cl[channel].rxp[nbuf]; + pbufe = (u_char *)(((u_long)rcbadru << 16) | (u_long)rcbadrl); + cnt = pbufe - pbufs; #ifdef DMA_DEBUG - log(LOG_WARNING, "cl_rxintr: rcbadru %x rcbadrl %x arbsts %x brbsts %x cnt %x\n", - rcbadru, rcbadrl, arbsts, brbsts, cnt); + log(LOG_WARNING, "cl_rxintr: rcbadru %x rcbadrl %x arbsts %x brbsts %x cnt %x\n", + rcbadru, rcbadrl, arbsts, brbsts, cnt); #endif #ifdef DMA_DEBUG1 - log(LOG_WARNING, "cl_rxintr: buf %x cnt %x\n", - nbuf, cnt); + log(LOG_WARNING, "cl_rxintr: buf %x cnt %x\n", + nbuf, cnt); #endif -} + } reoir = 0x0 | (bufcomplete) ? 0 : 0xd0; sc->cl_reg->cl_reoir = reoir; #ifdef DMA_DEBUG -log(LOG_WARNING, "cl_rxintr: reoir %x\n", reoir); + log(LOG_WARNING, "cl_rxintr: reoir %x\n", reoir); #endif delay(10); /* give the chip a moment */ #ifdef DMA_DEBUG -log(LOG_WARNING, "cl_rxintr: 2channel %x buf %x cnt %x status %x\n", -channel, nbuf, cnt, status); + log(LOG_WARNING, "cl_rxintr: 2channel %x buf %x cnt %x status %x\n", + channel, nbuf, cnt, status); #endif for (i = 0; i < cnt; i++) { u_char c; @@ -1752,7 +1757,7 @@ channel, nbuf, cnt, status); u_char c; c = buffer[i]; #if USE_BUFFER - cl_appendbuf(sc, channel, c); + cl_appendbuf(sc, channel, c); #else /* does any restricitions exist on spl * for this call diff --git a/sys/arch/mvme88k/dev/clock.c b/sys/arch/mvme88k/dev/clock.c index 06295289264..b113c1583a5 100644 --- a/sys/arch/mvme88k/dev/clock.c +++ b/sys/arch/mvme88k/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.7 2001/02/01 03:38:14 smurph Exp $ */ +/* $OpenBSD: clock.c,v 1.8 2001/02/12 08:16:22 smurph Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -237,10 +237,14 @@ sbc_clockintr(arg) void *arg; { sys_pcc2->pcc2_t1irq = prof_reset; + + /* increment intr counter */ + intrcnt[M88K_CLK_IRQ]++; + hardclock(arg); #include "bugtty.h" #if NBUGTTY > 0 -/* bugtty_chkinput();*/ + bugtty_chkinput(); #endif /* NBUGTTY */ timerok = 1; return (1); @@ -285,6 +289,8 @@ void *arg; volatile int *ist = (volatile int *)MVME188_IST; register unsigned long sp; + /* increment intr counter */ + intrcnt[M88K_CLK_IRQ]++; /* acknowledge the timer interrupt */ dma_cachectl(0xFFF82000, 0x1000, DMA_CACHE_SYNC_INVAL); tmp = *dti_stop; @@ -317,7 +323,7 @@ void *arg; hardclock(arg); #include "bugtty.h" #if NBUGTTY > 0 -/* bugtty_chkinput(); */ + bugtty_chkinput(); #endif /* NBUGTTY */ /* give the start counter/timer command */ tmp = *dti_start; diff --git a/sys/arch/mvme88k/dev/dart.c b/sys/arch/mvme88k/dev/dart.c index c46ae78a9c6..124c2eeb040 100644 --- a/sys/arch/mvme88k/dev/dart.c +++ b/sys/arch/mvme88k/dev/dart.c @@ -50,12 +50,12 @@ #include <machine/db_machdep.h> /* for details on entering kdb */ #define DDB_ENTER_BREAK 0x1 #define DDB_ENTER_CHAR 0x2 -unsigned char ddb_break_mode = DDB_ENTER_BREAK | DDB_ENTER_CHAR; -unsigned char ddb_break_char = '!'; +unsigned char ddb_break_mode = DDB_ENTER_BREAK; +unsigned char ddb_break_char = 0; #endif -#if DEBUG - int dart_debug = 0; +#ifdef DEBUG + int dart_debug = 1; #define dprintf(stuff) if (dart_debug) printf stuff #else #define dprintf(stuff) @@ -71,6 +71,7 @@ struct dartsoftc { struct device sc_dev; struct evcnt sc_intrcnt; union dartreg *dart_reg; + union dart_pt_io *port_reg[2]; struct dart_info sc_dart[2]; struct intrhand sc_ih; int sc_flags; @@ -89,6 +90,7 @@ struct cfdriver dart_cd = { NULL, "dart", DV_TTY, 0 }; +int dart_cons = -1; /* prototypes */ int dartcnprobe __P((struct consdev *cp)); int dartcninit __P((struct consdev *cp)); @@ -118,26 +120,41 @@ void dartbreak __P((dev_t dev, int state)); struct dart_sv_reg dart_sv_reg; /* speed tables */ -int dart_speeds[] = -{ - 0, /* 0 baud, special HUP condition */ - NOBAUD, /* 50 baud, not implemented */ - BD75, /* 75 baud */ - BD110, /* 110 baud */ - BD134, /* 134.5 baud */ - BD150, /* 150 baud */ - NOBAUD, /* 200 baud, not implemented */ - BD300, /* 300 baud */ - BD600, /* 600 baud */ - BD1200, /* 1200 baud */ - BD1800, /* 1800 baud */ - BD2400, /* 2400 baud */ - BD4800, /* 4800 baud */ - BD9600, /* 9600 baud */ - BD19200, /* 19200 baud */ - NOBAUD /* 38400 baud, not implemented */ +struct dart_s { + int kspeed; + int dspeed; +} dart_speeds[] = { + {B0, 0 }, /* 0 baud, special HUP condition */ + {B50, NOBAUD }, /* 50 baud, not implemented */ + {B75, BD75 }, /* 75 baud */ + {B110, BD110 }, /* 110 baud */ + {B134, BD134 }, /* 134.5 baud */ + {B150, BD150 }, /* 150 baud */ + {B200, NOBAUD }, /* 200 baud, not implemented */ + {B300, BD300 }, /* 300 baud */ + {B600, BD600 }, /* 600 baud */ + {B1200, BD1200 }, /* 1200 baud */ + {B1800, BD1800 }, /* 1800 baud */ + {B2400, BD2400 }, /* 2400 baud */ + {B4800, BD4800 }, /* 4800 baud */ + {B9600, BD9600 }, /* 9600 baud */ + {B19200, BD19200 }, /* 19200 baud */ + {0xFFFF, NOBAUD }, /* anything more is uncivilized */ }; +int +dart_speed(speed) +int speed; +{ + struct dart_s *ds = dart_speeds; + while (ds->kspeed != 0xFFFF) { + if (ds->kspeed == speed) + return ds->dspeed; + ds++; + } + return NOBAUD; +} + struct tty* darttty(dev) dev_t dev; @@ -184,7 +201,13 @@ void *aux; /* set up dual port memory and registers and init*/ sc->dart_reg = (union dartreg *)ca->ca_vaddr; + ptaddr = (union dart_pt_io *)ca->ca_vaddr; + sc->port_reg[A_PORT] = ptaddr; + ptaddr++; + sc->port_reg[B_PORT] = ptaddr; sc->sc_ipl = ca->ca_ipl = IPL_TTY; /* always... hard coded ipl */ + sc->sc_dart[A_PORT].tty = NULL; + sc->sc_dart[B_PORT].tty = NULL; ca->ca_vec = SYSCV_SCC; /* hard coded vector */ sc->sc_vec = ca->ca_vec; @@ -206,8 +229,12 @@ void *aux; /* Start out with Tx and RX interrupts disabled */ /* Enable input port change interrupt */ dart_sv_reg.sv_imr = IIPCHG; + + if (dart_cons >= 0) { + printf(" console (tty%s) ", dart_cons == 0 ? "a" : "b"); + } - dprintf(("dartattach: resetting port A\n")); + dprintf(("\ndartattach: resetting port A\n")); /* reset port a */ addr->write.wr_cra = RXRESET | TXDIS | RXDIS; @@ -277,65 +304,82 @@ struct tty *tp; { dev_t dev; struct dartsoftc *sc; - int s, cnt; + int s, cnt, cc; union dart_pt_io *ptaddr; union dartreg *addr; int port; int c; dev = tp->t_dev; - port = DART_PORT(dev); + if((port = DART_PORT(dev)) > 1) + return; + sc = (struct dartsoftc *) dart_cd.cd_devs[0]; + addr = sc->dart_reg; + ptaddr = sc->port_reg[port]; if ((tp->t_state & TS_ISOPEN) == 0) return; + + s = spltty(); + + if (tp->t_state & (TS_TIMEOUT |TS_BUSY | TS_TTSTOP)) + goto bail; + + if (tp->t_outq.c_cc <= tp->t_lowat) { + if (tp->t_state & TS_ASLEEP) { + tp->t_state &= ~TS_ASLEEP; + wakeup((caddr_t)&tp->t_outq); + } + if (tp->t_outq.c_cc == 0) + goto bail; + selwakeup(&tp->t_wsel); + } - addr = sc->dart_reg; - ptaddr = (union dart_pt_io *)addr + port; + if (tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP)) + goto bail; - if (tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP)) - goto out; + dprintf(("dartstart: dev(%d, %d)\n", major(dev), minor(dev))); - /* - if (tp->t_outq.c_cc <= TTLOWAT(tp)) { - ttwakeup(tp); - } - */ + if (port != dart_cons) + dprintf(("dartstart: ptaddr = 0x%08x from uart at 0x%08x\n", + ptaddr, addr)); if (tp->t_outq.c_cc != 0) { - tp->t_state |= TS_BUSY; - + cc = tp->t_outq.c_cc; /* load transmitter until it is full */ while (ptaddr->read.rd_sr & TXRDY) { + if(cc == 0) + break; c = getc(&tp->t_outq); - + cc--; if (tp->t_flags & CS8 || c <= 0177) { - - dprintf(("dartstart: writing char \"%c\" (0x%02x)\n", - c & 0xff, c % 0xff)); + if (port != dart_cons) + dprintf(("dartstart: writing char \"%c\" (0x%02x) to port %d\n", + c & 0xff, c & 0xff, port)); ptaddr->write.wr_tb = c & 0xff; - - dprintf(("dartstart: enabling Tx int\n")); + + if (port != dart_cons) + dprintf(("dartstart: enabling Tx int\n")); if (port == A_PORT) dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYA; else dart_sv_reg.sv_imr = dart_sv_reg.sv_imr | ITXRDYB; - addr -> write.wr_imr = dart_sv_reg.sv_imr; + addr->write.wr_imr = dart_sv_reg.sv_imr; + } else { tp->t_state &= ~TS_BUSY; - dprintf(("dartxint: timing out char \"%c\" (0x%02x)\n", + if (port != dart_cons) + dprintf(("dartxint: timing out char \"%c\" (0x%02x)\n", c & 0xff, c % 0xff)); -#if 1 timeout_add(&tp->t_rstrt_to, 1); -#else - ttrstrt(tp); -#endif tp->t_state |= TS_TIMEOUT; } } } -out: +bail: + splx(s); return; } @@ -348,11 +392,13 @@ struct tty *tp; int flag; { int s; + s = spltty(); if (tp->t_state & TS_BUSY) { if ((tp->t_state & TS_TTSTOP) == 0) tp->t_state |= TS_FLUSH; } + splx(s); return 0; } @@ -387,6 +433,7 @@ int how; int newflags = 0; struct dart_info *dart; struct dartsoftc *sc; + int s; if (port = DART_PORT(dev) > 1) { return (ENODEV); @@ -396,6 +443,7 @@ int how; addr = sc->dart_reg; /* special case: set or clear break */ +#if 0 if (flags & TIOCSBRK) { dartbreak(port, 1); flags &= ~TIOCSBRK; @@ -404,7 +452,9 @@ int how; dartbreak(port, 0); flags &= ~TIOCCBRK; } - +#endif + s = spltty(); + HANDLE_FLAG(TIOCM_DTR, port, OPDTRA, OPDTRB); HANDLE_FLAG(TIOCM_RTS, port, OPRTSA, OPRTSB); @@ -440,7 +490,7 @@ int how; dcdstate = !(addr->read.rd_ip & ((port == A_PORT) ? IPDCDA : IPDCDB)); dprintf(("dartmctl: DCD is %s\n", dcdstate ? "up" : "down")); - + splx(s); return dcdstate; } @@ -465,11 +515,11 @@ int state; dart = &sc->sc_dart[port]; addr = sc->dart_reg; - ptaddr = (union dart_pt_io *) addr + port; - + ptaddr = sc->port_reg[port]; + if (state == 1) { /* the duart must be enabled with a dummy byte, - to prevent the transmitter empty interrupt */ + to prevent the transmitter empty interrupt */ ptaddr->write.wr_cr = BRKSTART|TXEN; ptaddr->write.wr_tb = 0; } else { @@ -540,6 +590,8 @@ struct proc *p; /* *(int *)data = dartmctl(dev, 0, DMGET);*/ break; case TIOCGFLAGS: + if (dart_cons == port) + dart->dart_swflags |= TIOCFLAG_SOFTCAR; *(int *)data = dart->dart_swflags; break; case TIOCSFLAGS: @@ -548,6 +600,8 @@ struct proc *p; return(EPERM); dart->dart_swflags = *(int *)data; + if (dart_cons == port) + dart->dart_swflags |= TIOCFLAG_SOFTCAR; dart->dart_swflags &= /* only allow valid flags */ (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS); break; @@ -576,17 +630,17 @@ struct termios *t; struct dartsoftc *sc; dev_t dev; - dprintf(("dartparam: setting param for dev %d\n", dev)); - dev = tp->t_dev; - if (port = DART_PORT(dev) > 1) { + dprintf(("dartparam: setting param for dev(%d, %d)\n", major(dev), minor(dev))); + if ((port = DART_PORT(dev)) > 1) { return (ENODEV); } sc = (struct dartsoftc *) dart_cd.cd_devs[0]; dart = &sc->sc_dart[port]; addr = sc->dart_reg; - ptaddr = (union dart_pt_io *) addr + port; + ptaddr = sc->port_reg[port]; + tp->t_ispeed = t->c_ispeed; tp->t_ospeed = t->c_ospeed; tp->t_cflag = t->c_cflag; @@ -597,81 +651,86 @@ struct termios *t; /* disable Tx and Rx */ dprintf(("dartparam: disabling Tx and Rx int\n")); - if (port == A_PORT) - dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYA | IRXRDYA); - else - dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYB | IRXRDYB); - addr -> write.wr_imr = dart_sv_reg.sv_imr; - - /* hang up on zero baud rate */ - if (tp->t_ispeed == 0) { - dprintf(("dartparam: ispeed == 0 -> HUP\n")); - dartmctl(tp, HUPCL, DMSET); - return; + if (dart_cons == port) { + dprintf(("dartparam: skipping console init\n")); } else { - /* set baudrate */ - speeds = dart_speeds[(unsigned char)tp->t_ispeed]; - if (speeds == NOBAUD) - speeds = dart_sv_reg.sv_csr[port]; - ptaddr->write.wr_csr = speeds; - dart_sv_reg.sv_csr[port] = speeds; - dprintf(("dartparam: baudrate set param = %d\n", speeds)); - } + if (port == A_PORT) + dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYA | IRXRDYA); + else + dart_sv_reg.sv_imr = dart_sv_reg.sv_imr & ~(ITXRDYB | IRXRDYB); + addr -> write.wr_imr = dart_sv_reg.sv_imr; - /* get saved mode registers and clear set up parameters */ - mr1 = dart_sv_reg.sv_mr1[port]; - mr1 &= ~(CLMASK | PARTYPEMASK | PARMODEMASK); + /* hang up on zero baud rate */ + if (tp->t_ispeed == 0) { + dprintf(("dartparam: ispeed == 0 -> HUP\n")); + dartmctl(tp, HUPCL, DMSET); + return 0; + } else { + /* set baudrate */ + speeds = dart_speed(tp->t_ispeed); + dprintf(("dartparam: speed 0x%x, baudrate %d\n", speeds, tp->t_ispeed)); + if (speeds == NOBAUD) + speeds = dart_sv_reg.sv_csr[port]; + ptaddr->write.wr_csr = speeds; + dart_sv_reg.sv_csr[port] = speeds; + dprintf(("dartparam: baudrate set param = %d\n", speeds)); + } - mr2 = dart_sv_reg.sv_mr2[port]; - mr2 &= ~SBMASK; + /* get saved mode registers and clear set up parameters */ + mr1 = dart_sv_reg.sv_mr1[port]; + mr1 &= ~(CLMASK | PARTYPEMASK | PARMODEMASK); - /* set up character size */ - if (flags & CS8) { - mr1 |= CL8; - dprintf(("dartparam: PASS8\n")); - } else if (tp->t_ispeed == B134) { - mr1 |= CL6; - dprintf(("dartparam: CS6\n")); - } else { - mr1 |= CL7; - dprintf(("dartparam: CS7\n")); - } + mr2 = dart_sv_reg.sv_mr2[port]; + mr2 &= ~SBMASK; - /* set up stop bits */ - if (tp->t_ospeed == B110) { - mr2 |= SB2; - dprintf(("dartparam: two stop bits\n")); - } else { - mr2 |= SB1; - dprintf(("dartparam: one stop bit\n")); - } + /* set up character size */ + if (flags & CS8) { + mr1 |= CL8; + dprintf(("dartparam: PASS8\n")); + } else if (tp->t_ispeed == B134) { + mr1 |= CL6; + dprintf(("dartparam: CS6\n")); + } else { + mr1 |= CL7; + dprintf(("dartparam: CS7\n")); + } - /* set up parity */ - if (((flags & PARENB) != PARENB) && - (flags & PARENB)) { - mr1 |= PAREN; - if (flags & PARODD) { - mr1 |= ODDPAR; - dprintf(("dartparam: odd parity\n")); + /* set up stop bits */ + if (tp->t_ospeed == B110) { + mr2 |= SB2; + dprintf(("dartparam: two stop bits\n")); } else { - mr1 |= EVENPAR; - dprintf(("dartparam: even parity\n")); + mr2 |= SB1; + dprintf(("dartparam: one stop bit\n")); + } + + /* set up parity */ + if (((flags & PARENB) != PARENB) && + (flags & PARENB)) { + mr1 |= PAREN; + if (flags & PARODD) { + mr1 |= ODDPAR; + dprintf(("dartparam: odd parity\n")); + } else { + mr1 |= EVENPAR; + dprintf(("dartparam: even parity\n")); + } + } else { + mr1 |= PARDIS; + dprintf(("dartparam: no parity\n")); } - } else { - mr1 |= PARDIS; - dprintf(("dartparam: no parity\n")); - } - if ((dart_sv_reg.sv_mr1[port] != mr1) - || (dart_sv_reg.sv_mr2[port] != mr2)) { - /* write mode registers to duart */ - ptaddr->write.wr_cr = MRRESET; - ptaddr->write.wr_mr = mr1; - ptaddr->write.wr_mr = mr2; + if ((dart_sv_reg.sv_mr1[port] != mr1) + || (dart_sv_reg.sv_mr2[port] != mr2)) { + /* write mode registers to duart */ + ptaddr->write.wr_cr = MRRESET; + ptaddr->write.wr_mr = mr1; + ptaddr->write.wr_mr = mr2; - /* save changed mode registers */ - dart_sv_reg.sv_mr1[port] = mr1; - dart_sv_reg.sv_mr2[port] = mr2; + /* save changed mode registers */ + dart_sv_reg.sv_mr1[port] = mr1; + dart_sv_reg.sv_mr2[port] = mr2; + } } /* enable transmitter? */ @@ -747,12 +806,12 @@ struct proc *p; struct dartsoftc *sc; struct tty *tp; - if (port = DART_PORT(dev) > 1) { + if ((port = DART_PORT(dev)) > 1) { return (ENODEV); } - sc = (struct dartsoftc *) dart_cd.cd_devs[0]; + sc = (struct dartsoftc *) dart_cd.cd_devs[0]; /* the only one */ dart = &sc->sc_dart[port]; - s = spldart(); + s = spltty(); if (dart->tty) { tp = dart->tty; @@ -773,7 +832,7 @@ struct proc *p; tp->t_lflag = TTYDEF_LFLAG; tp->t_ispeed = tp->t_ospeed = B9600; dartparam(tp, &tp->t_termios); - if (port == 0) { + if (port == dart_cons) { /* console is 8N1 */ tp->t_cflag = (CREAD | CS8 | HUPCL); } else { @@ -783,8 +842,8 @@ struct proc *p; (void)dartmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET); tp->t_state |= TS_CARR_ON; } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) { - splx(s); simple_unlock(&dart->t_lock); + splx(s); return (EBUSY); } /* @@ -810,17 +869,16 @@ struct proc *p; struct dartsoftc *sc; int s, port; - if (port = DART_PORT(dev) > 1) { + if ((port = DART_PORT(dev)) > 1) { + printf("dartclose: inavalid device dev(%d, %d)\n", major(dev), minor(dev)); return (ENODEV); } sc = (struct dartsoftc *) dart_cd.cd_devs[0]; dart = &sc->sc_dart[port]; tp = dart->tty; (*linesw[tp->t_line].l_close)(tp, flag); - - s = spldart(); ttyclose(tp); - splx(s); + return 0; } @@ -885,7 +943,7 @@ int port; addr = sc->dart_reg; /* read status reg */ - ptaddr = (union dart_pt_io *) addr + port; + ptaddr = sc->port_reg[port]; dprintf(("dartrint: Rx int port %d\n", port)); @@ -902,7 +960,7 @@ int port; dprintf(("dartrint: read char \"%c\" (0x%02x) tp = 0x%x\n", data, data, tp)); - if ((tp->t_state & (TS_ISOPEN|TS_WOPEN)) == 0) { + if ((tp->t_state & (TS_ISOPEN|TS_WOPEN)) == 0 && dart_cons != port) { return; } @@ -942,17 +1000,18 @@ int port; gimmeabreak(); } else #endif + (*linesw[tp->t_line].l_rint)(data,tp); +#if 0 { if (tp->t_ispeed == B134) /* CS6 */ data &= 077; -#if 0 /* XXX ??? */ - else if (tp->t_flags & (RAW|LITOUT|PASS8)) /*CS8*/ + else if (tp->t_flags & CS8) ; -#endif else data &= 0177; /* CS7 */ ttyinput(data, tp); } +#endif } } } @@ -992,7 +1051,7 @@ int port; return; } } - out: +out: /* disable transmitter */ if (port == 0) @@ -1022,14 +1081,15 @@ struct dartsoftc *sc; addr = sc->dart_reg; isr = addr->read.rd_isr; + isr &= dart_sv_reg.sv_imr; - + if (isr) { /* interrupt from this duart */ if (isr & IIPCHG) { unsigned int ip = addr->read.rd_ip; unsigned int ipcr = addr->read.rd_ipcr; dartmodemtrans(sc, ip, ipcr); - return 0; + return 1; } if (isr & (IRXRDYA | ITXRDYA)) @@ -1095,7 +1155,8 @@ int dartcninit(cp) struct consdev *cp; { - /* Nothing to do */ + dart_cons = A_PORT; + return 0; } int @@ -1114,13 +1175,13 @@ char c; addr = (union dartreg *) MVME188_DUART; #if 1 - ptaddr = (union dart_pt_io *) addr + port; + ptaddr = (union dart_pt_io *) addr + (port * 0x20); #else ptaddr = (union dart_pt_io *) addr + ((dev & 1) ? 1 : 0); #endif #if 1 - s = spldart(); + s = spltty(); #else psr = disable_interrupts_return_psr(); #endif @@ -1177,13 +1238,13 @@ dev_t dev; port = DART_PORT(dev); #if 1 - s = spldart(); + s = spltty(); #else psr = disable_interrupts_return_psr(); #endif addr = (union dartreg *) DART_BASE; #if 1 - ptaddr = (union dart_pt_io *) addr + port; + ptaddr = (union dart_pt_io *) addr + (port * 0x20); #else ptaddr = (union dart_pt_io *) addr + ((dev & 1) ? 1 : 0); #endif diff --git a/sys/arch/mvme88k/dev/if_ve.c b/sys/arch/mvme88k/dev/if_ve.c index ec724fdb277..570ae98a6f1 100644 --- a/sys/arch/mvme88k/dev/if_ve.c +++ b/sys/arch/mvme88k/dev/if_ve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ve.c,v 1.2 2001/02/01 03:38:14 smurph Exp $ */ +/* $OpenBSD: if_ve.c,v 1.3 2001/02/12 08:16:23 smurph Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1982, 1992, 1993 @@ -141,23 +141,24 @@ hide void vewrcsr __P((struct vam7990_softc *, u_int16_t, u_int16_t)); hide u_int16_t verdcsr __P((struct vam7990_softc *, u_int16_t)); /* send command to the nvram controller */ +void nvram_cmd(sc, cmd, addr ) struct vam7990_softc *sc; u_char cmd; u_short addr; { - int i; - u_char rcmd = 0; - u_char rcmd2= 0; + int i; + u_char rcmd = 0; + u_char rcmd2= 0; struct vereg1 *reg1 = ((struct ve_softc *)sc)->sc_r1; - - rcmd = addr; - rcmd = rcmd << 3; - rcmd |= cmd; - for(i=0;i<8;i++){ - reg1->ver1_ear=((cmd|(addr<<1))>>i); - CDELAY; - } + + rcmd = addr; + rcmd = rcmd << 3; + rcmd |= cmd; + for (i=0;i<8;i++) { + reg1->ver1_ear=((cmd|(addr<<1))>>i); + CDELAY; + } } /* read nvram one bit at a time */ @@ -166,27 +167,29 @@ nvram_read(sc, nvram_addr) struct vam7990_softc *sc; u_char nvram_addr; { - u_short val = 0, mask = 0x04000; - u_int16_t wbit; - /* these used by macros DO NOT CHANGE!*/ - int i; + u_short val = 0, mask = 0x04000; + u_int16_t wbit; + /* these used by macros DO NOT CHANGE!*/ + int i; struct vereg1 *reg1 = ((struct ve_softc *)sc)->sc_r1; - sc->csr = 0x4f; - ENABLE_NVRAM; - nvram_cmd(sc, NVRAM_RCL, 0); - DISABLE_NVRAM; - CDELAY; - ENABLE_NVRAM; - nvram_cmd(sc, NVRAM_READ, nvram_addr); - for (wbit=0; wbit<15; wbit++) { - (reg1->ver1_ear & 0x01) ? (val = (val | mask)) : (val = (val & (~mask))); - mask = mask>>1; - CDELAY; - } - (reg1->ver1_ear & 0x01) ? (val = (val | 0x8000)) : (val = (val & 0x7FFF)); - CDELAY; - DISABLE_NVRAM; - return (val); + sc->csr = 0x4f; + ENABLE_NVRAM; + nvram_cmd(sc, NVRAM_RCL, 0); + DISABLE_NVRAM; + CDELAY; + ENABLE_NVRAM; + nvram_cmd(sc, NVRAM_READ, nvram_addr); + for (wbit=0; wbit<15; wbit++) { + (reg1->ver1_ear & 0x01) ? + (val = (val | mask)) : (val = (val & (~mask))); + mask = mask>>1; + CDELAY; + } + (reg1->ver1_ear & 0x01) ? + (val = (val | 0x8000)) : (val = (val & 0x7FFF)); + CDELAY; + DISABLE_NVRAM; + return (val); } hide void @@ -216,14 +219,14 @@ verdcsr(sc, port) /* reset MVME376, set ipl and vec */ void vereset(sc) - struct vam7990_softc *sc; +struct vam7990_softc *sc; { register struct vereg1 *reg1 = ((struct ve_softc *)sc)->sc_r1; - u_char vec = ((struct ve_softc *)sc)->sc_vec; - u_char ipl = ((struct ve_softc *)sc)->sc_ipl; - sc->csr = 0x4f; - WRITE_CSR_AND( ~ipl ); - SET_VEC(vec); + u_char vec = ((struct ve_softc *)sc)->sc_vec; + u_char ipl = ((struct ve_softc *)sc)->sc_ipl; + sc->csr = 0x4f; + WRITE_CSR_AND( ~ipl ); + SET_VEC(vec); return; } @@ -234,24 +237,21 @@ struct vam7990_softc *sc; { register struct vereg1 *reg1 = ((struct ve_softc *)sc)->sc_r1; ENABLE_INTR; + CLEAR_INTR; } int vematch(parent, vcf, args) - struct device *parent; - void *vcf, *args; +struct device *parent; +void *vcf, *args; { struct confargs *ca = args; if (!badvaddr(ca->ca_vaddr, 1)) { - if (ca->ca_vec & 0x03) { - printf("ve: bad vector 0x%x\n", ca->ca_vec); - return (0); - } - return(1); - } else { + return (1); + } else { return (0); - } + } } /* @@ -261,9 +261,9 @@ vematch(parent, vcf, args) */ void veattach(parent, self, aux) - struct device *parent; - struct device *self; - void *aux; +struct device *parent; +struct device *self; +void *aux; { register struct ve_softc *lesc = (struct ve_softc *)self; struct vam7990_softc *sc = &lesc->sc_am7990; @@ -288,32 +288,35 @@ veattach(parent, self, aux) bootdv = self; lesc->sc_r1 = (struct vereg1 *)ca->ca_vaddr; - lesc->sc_ipl = ca->ca_ipl; - lesc->sc_vec = ca->ca_vec; - - /* get the first avaliable etherbuf */ - switch ((int)ca->ca_paddr) { - case 0xFFFF1200: - addr = (caddr_t)0xFD6C0000; - break; - case 0xFFFF1400: - addr = (caddr_t)0xFD700000; - break; - case 0xFFFF1600: - addr = (caddr_t)0xFD740000; - break; - default: - panic("ve: invalid address"); - } - sc->sc_mem = (void *)mapiodev(addr, LEMEMSIZE); - if (sc->sc_mem == NULL) panic("ve: no more memory in external I/O map"); + lesc->sc_ipl = ca->ca_ipl; + lesc->sc_vec = ca->ca_vec; + + + /* get the first avaliable etherbuf */ + switch ((int)ca->ca_paddr) { + case 0xFFFF1200: + addr = (caddr_t)0xFD6C0000; + break; + case 0xFFFF1400: + addr = (caddr_t)0xFD700000; + break; + case 0xFFFF1600: + addr = (caddr_t)0xFD740000; + break; + default: + panic("ve: invalid address"); + } + + sc->sc_mem = (void *)mapiodev(addr, LEMEMSIZE); + + if (sc->sc_mem == NULL) panic("ve: no more memory in external I/O map"); sc->sc_memsize = LEMEMSIZE; sc->sc_conf3 = LE_C3_BSWP; sc->sc_addr = kvtop(sc->sc_mem); - + /* get ether address via bug call */ veetheraddr(sc); - + evcnt_attach(&sc->sc_dev, "intr", &lesc->sc_intrcnt); evcnt_attach(&sc->sc_dev, "errs", &lesc->sc_errcnt); @@ -342,19 +345,19 @@ void veetheraddr(sc) struct vam7990_softc *sc; { - u_char * cp = sc->sc_arpcom.ac_enaddr; - u_int16_t ival[3]; - u_char i; - - for (i=0; i<3; i++) { - ival[i] = nvram_read(sc, i); - } - memcpy(cp, &ival[0], 6); + u_char * cp = sc->sc_arpcom.ac_enaddr; + u_int16_t ival[3]; + u_char i; + + for (i=0; i<3; i++) { + ival[i] = nvram_read(sc, i); + } + memcpy(cp, &ival[0], 6); } void ve_config(sc) - struct vam7990_softc *sc; +struct vam7990_softc *sc; { int mem; @@ -368,7 +371,7 @@ ve_config(sc) ifp->if_ioctl = ve_ioctl; ifp->if_watchdog = ve_watchdog; ifp->if_flags = - IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; + IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST; #ifdef LANCE_REVC_BUG ifp->if_flags &= ~IFF_MULTICAST; #endif @@ -414,9 +417,9 @@ ve_config(sc) } printf("\n%s: address %s\n", sc->sc_dev.dv_xname, - ether_sprintf(sc->sc_arpcom.ac_enaddr)); + ether_sprintf(sc->sc_arpcom.ac_enaddr)); printf("%s: %d receive buffers, %d transmit buffers\n", - sc->sc_dev.dv_xname, sc->sc_nrbuf, sc->sc_ntbuf); + sc->sc_dev.dv_xname, sc->sc_nrbuf, sc->sc_ntbuf); sc->sc_sh = shutdownhook_establish(ve_shutdown, sc); if (sc->sc_sh == NULL) @@ -455,7 +458,7 @@ ve_reset(sc) */ void ve_meminit(sc) - register struct vam7990_softc *sc; +register struct vam7990_softc *sc; { u_long a; int bix; @@ -470,11 +473,11 @@ ve_meminit(sc) #endif init.init_mode = LE_MODE_NORMAL; init.init_padr[0] = - (sc->sc_arpcom.ac_enaddr[1] << 8) | sc->sc_arpcom.ac_enaddr[0]; + (sc->sc_arpcom.ac_enaddr[1] << 8) | sc->sc_arpcom.ac_enaddr[0]; init.init_padr[1] = - (sc->sc_arpcom.ac_enaddr[3] << 8) | sc->sc_arpcom.ac_enaddr[2]; + (sc->sc_arpcom.ac_enaddr[3] << 8) | sc->sc_arpcom.ac_enaddr[2]; init.init_padr[2] = - (sc->sc_arpcom.ac_enaddr[5] << 8) | sc->sc_arpcom.ac_enaddr[4]; + (sc->sc_arpcom.ac_enaddr[5] << 8) | sc->sc_arpcom.ac_enaddr[4]; ve_setladrf(&sc->sc_arpcom, init.init_ladrf); sc->sc_last_rd = 0; @@ -501,7 +504,7 @@ ve_meminit(sc) rmd.rmd2 = -LEBLEN | LE_XMD2_ONES; rmd.rmd3 = 0; (*sc->sc_copytodesc)(sc, &rmd, LE_RMDADDR(sc, bix), - sizeof(rmd)); + sizeof(rmd)); } /* @@ -511,11 +514,11 @@ ve_meminit(sc) a = sc->sc_addr + LE_TBUFADDR(sc, bix); tmd.tmd0 = a; tmd.tmd1_hadr = a >> 16; - tmd.tmd1_bits = 0; - tmd.tmd2 = 0 | LE_XMD2_ONES; + tmd.tmd1_bits = LE_R1_STP | LE_R1_ENP; + tmd.tmd2 = -2000 | LE_XMD2_ONES; tmd.tmd3 = 0; (*sc->sc_copytodesc)(sc, &tmd, LE_TMDADDR(sc, bix), - sizeof(tmd)); + sizeof(tmd)); } } diff --git a/sys/arch/mvme88k/dev/if_vereg.h b/sys/arch/mvme88k/dev/if_vereg.h index 7977ea4d867..aece081683f 100644 --- a/sys/arch/mvme88k/dev/if_vereg.h +++ b/sys/arch/mvme88k/dev/if_vereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vereg.h,v 1.2 2000/12/21 16:54:56 aaron Exp $ */ +/* $OpenBSD: if_vereg.h,v 1.3 2001/02/12 08:16:23 smurph Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -67,6 +67,7 @@ struct vereg1 { #define ENABLE_NVRAM WRITE_CSR_AND(~NVRAM_EN) #define DISABLE_NVRAM WRITE_CSR_OR(NVRAM_EN) #define ENABLE_INTR WRITE_CSR_AND(~INTR_EN) +#define CLEAR_INTR WRITE_CSR_OR(HW_RS | PARITYB | NVRAM_EN) #define DISABLE_INTR WRITE_CSR_OR(INTR_EN) #define RESET_HW WRITE_CSR_AND(~0xFF00);WRITE_CSR_AND(~HW_RS);CDELAY #define SET_IPL(x) WRITE_CSR_AND(~x) diff --git a/sys/arch/mvme88k/dev/sclock.c b/sys/arch/mvme88k/dev/sclock.c index f00541d0136..1e01b9d087d 100644 --- a/sys/arch/mvme88k/dev/sclock.c +++ b/sys/arch/mvme88k/dev/sclock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sclock.c,v 1.2 2001/02/01 03:38:14 smurph Exp $ */ +/* $OpenBSD: sclock.c,v 1.3 2001/02/12 08:16:23 smurph Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * @@ -247,6 +247,9 @@ void *cap; sys_pcc2->pcc2_t2irq = stat_reset; + /* increment intr counter */ + intrcnt[M88K_SCLK_IRQ]++; + statclock((struct clockframe *)cap); /* @@ -281,6 +284,10 @@ void *cap; volatile int *ist = (volatile int *)MVME188_IST; CIO_LOCK; + + /* increment intr counter */ + intrcnt[M88K_SCLK_IRQ]++; + statclock((struct clockframe *)cap); write_cio(CIO_CSR1, CIO_GCB|CIO_CIP); /* Ack the interrupt */ @@ -299,11 +306,13 @@ void *cap; */ write_cio(CIO_CT1MSB, (newint & 0xFF00) >> 8); /* Load time constant CTC #1 */ write_cio(CIO_CT1LSB, newint & 0xFF); - /* force a trigger event */ - write_cio(CIO_CSR1, CIO_GCB|CIO_TCB|CIO_IE); /* Start CTC #1 running */ - if (*ist & DTI_BIT) { + + write_cio(CIO_CSR1, CIO_GCB|CIO_CIP); /* Start CTC #1 running */ +#if 0 + if (*ist & CIOI_BIT) { printf("CIOI not clearing!\n"); } +#endif CIO_UNLOCK; return (1); } |