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 | |
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')
-rw-r--r-- | sys/arch/mvme88k/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/mvme88k/conf/M188 | 161 | ||||
-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 | ||||
-rw-r--r-- | sys/arch/mvme88k/include/psl.h | 33 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/locore.S | 25 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/machdep.c | 83 | ||||
-rw-r--r-- | sys/arch/mvme88k/mvme88k/pmap.c | 118 |
14 files changed, 683 insertions, 492 deletions
diff --git a/sys/arch/mvme88k/conf/GENERIC b/sys/arch/mvme88k/conf/GENERIC index 72d2d7a9541..78900b81b55 100644 --- a/sys/arch/mvme88k/conf/GENERIC +++ b/sys/arch/mvme88k/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.13 2001/02/01 03:38:11 smurph Exp $ +# $OpenBSD: GENERIC,v 1.14 2001/02/12 08:16:20 smurph Exp $ machine mvme88k @@ -7,7 +7,7 @@ include "../../../conf/GENERIC" option "M88000" # support for 88K option MVME187 # support for 187 option MVME188 # support for 188 -option MVME197 # support for 197 +#option MVME197 # support for 197 option UVM # use the UVM virtual memory system option FFS_SOFTUPDATES # Soft Updates option "NCPUS=1" # number of CPUs supported (max 4) diff --git a/sys/arch/mvme88k/conf/M188 b/sys/arch/mvme88k/conf/M188 index 629e60f8e53..0b14e82fb05 100644 --- a/sys/arch/mvme88k/conf/M188 +++ b/sys/arch/mvme88k/conf/M188 @@ -1,73 +1,98 @@ -# $OpenBSD: M188,v 1.2 2001/01/14 20:25:22 smurph Exp $ +# $OpenBSD: M188,v 1.3 2001/02/12 08:16:21 smurph Exp $ machine mvme88k maxusers 64 -option TIMEZONE=300, DST=1 - # processors this kernel should support option "M88000" # support for 88K -option MVME188 # support for 188 +option MVME188 # support for 187 +option "NCPUS=1" # Number of cpus supported (max 4) +option UVM # use the UVM virtual memory system + option BUGMAP # use Bug Rom VME Mappings -option SWAPPAGER # Pager for processes (Required) -option VNODEPAGER # Pager for vnodes (Required) -option DEVPAGER # Pager for devices (Required) +#option INSECURE # default to secure + +option TIMEZONE=0 # time zone to adjust RTC time by +option DST=0 # daylight savings time used by RTC +option NTP # hooks supporting the Network Time Protocol + +option SWAPPAGER # paging; REQUIRED +option DEVPAGER # mmap() of devices + +option DDB # in-kernel debugger +#option DDB_SAFE_CONSOLE # allow break into ddb during boot +#makeoptions DEBUG="-g" # compile full symbol table +#makeoptions PROF="-pg" # build profiled kernel +#option GPROF # kernel profiling, kgmon(8) +option DIAGNOSTIC # internal consistency checks +option KTRACE # system call tracing, a la ktrace(1) +option KMEMSTATS # collect malloc(9) statistics -option SYSVSHM -option SYSVSEM -option SYSVMSG +option CRYPTO # Cryptographic framework -# File system related options +option SYSVMSG # System V-like message queues +option SYSVSEM # System V-like semaphores +option SYSVSHM # System V-like memory sharing -#option QUOTA # Disk quotas for local disks -option NFSSERVER # Network File System server side code -option NFSCLIENT # Network File System client side code +option UVM_SWAP_ENCRYPT# support encryption of pages going to swap -# File systems +#option COMPAT_09 # Kernel compatibility with NetBSD 0.9, +#option COMPAT_10 # NetBSD 1.0, +option COMPAT_11 # NetBSD 1.1, +option COMPAT_43 # and 4.3BSD +#option TCP_COMPAT_42 # TCP bug compatibility with 4.2BSD + +option LKM # loadable kernel modules + +option FFS # UFS +option QUOTA # UFS quotas +#option LFS # log-structured file system +option EXT2FS # Second Extended Filesystem +option MFS # memory file system +#option XFS # xfs filesystem + +option TCP_SACK # Selective Acknowledgements for TCP +#option TCP_FACK # Forward Acknowledgements for TCP +#option TCP_SIGNATURE # TCP MD5 Signatures, for BGP routing sessions + +option NFSCLIENT # Network File System client +option NFSSERVER # Network File System server -option FFS # Berkeley fast file system -option MFS # Memory based filesystem -option FIFO # FIFO operations on vnodes (Recommended) option CD9660 # ISO 9660 + Rock Ridge file system -#option MSDOSFS # MS-DOS file system +option MSDOSFS # MS-DOS file system option FDESC # /dev/fd +option FIFO # FIFOs; RECOMMENDED option KERNFS # /kern option NULLFS # loopback file system -#option PORTAL # ? +option PORTAL # dynamically created filesystem objects option PROCFS # /proc -#option UMAPFS # NULLFS + uid and gid remapping +option UMAPFS # NULLFS + uid and gid remapping option UNION # union file system -# Networking options - -option NTP # hooks supporting the Network Time Protocol +#option GATEWAY # packet forwarding +option INET # IP + ICMP + TCP + UDP +option INET6 # IPv6 (needs INET) +option PULLDOWN_TEST # use m_pulldown for IPv6 packet parsing +option IPSEC # IPsec +#option KEY # PF_KEY (implied by IPSEC) +#option NS # XNS +#option NSIP # XNS tunneling over IP +#option IPX # IPX+SPX +#option IPXIP # IPX tunneling over IP +#option ISO,TPIP # OSI +#option EON # OSI tunneling over IP +#option NETATALK # AppleTalk +#option CCITT,LLC,HDLC # X.25 option IPFILTER # IP packet filter for security option IPFILTER_LOG # use /dev/ipl to log IPF -option INET -option GATEWAY # IP packet forwarding -#option TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP -#option ISO # OSI networking -#option TPIP -#option EON -#option COMPAT_43 -#option EXEC_COFF -#option LKM +option PPP_BSDCOMP # PPP BSD compression +option PPP_DEFLATE +#option MROUTING # Multicast router +#option BOOT_CONFIG # add support for boot -c -# Support for various kernel options - -option DIAGNOSTIC # Add additional error checking code -#option "NKMEMCLUSTERS=512" # Size of kernel malloc area - -# Misc. debuging options - -option PANICWAIT # Require keystroke to dump/reboot -option DEBUG # Add debugging statements -option DDB # Kernel debugger -#option SYSCALL_DEBUG # debug all syscalls. -option KTRACE # debug all syscalls. # ------------------------------ devices -------------------------------- mainbus0 at root @@ -88,19 +113,19 @@ vmes0 at vme0 vmel0 at vme0 # ------------------------------ vmes0 devices ------------------------- -vx0 at vmes0 addr 0xff780000 ipl 3 vec 0x70 len 0x10000 -vx1 at vmes0 addr 0xff790000 ipl 3 vec 0x71 len 0x10000 -vx2 at vmes0 addr 0xff7a0000 ipl 3 vec 0x72 len 0x10000 -vx3 at vmes0 addr 0xff7b0000 ipl 3 vec 0x73 len 0x10000 -ve0 at vmes0 addr 0xffff1200 ipl 1 vec 0x74 len 0x100 -ve1 at vmes0 addr 0xffff1400 ipl 1 vec 0x75 len 0x100 -ve2 at vmes0 addr 0xffff1600 ipl 1 vec 0x76 len 0x100 -vs0 at vmes0 addr 0xffff9000 ipl 2 vec 0x80 len 0x800 -vs1 at vmes0 addr 0xffff9800 ipl 2 vec 0x82 len 0x800 -vs2 at vmes0 addr 0xffff4800 ipl 2 vec 0x84 len 0x800 -vs3 at vmes0 addr 0xffff5800 ipl 2 vec 0x86 len 0x800 -vs4 at vmes0 addr 0xffff7000 ipl 2 vec 0x88 len 0x800 -vs5 at vmes0 addr 0xffff7800 ipl 2 vec 0x8a len 0x800 +vx0 at vmes0 addr 0xff780000 ipl 3 len 0x10000 +vx1 at vmes0 addr 0xff790000 ipl 3 len 0x10000 +vx2 at vmes0 addr 0xff7a0000 ipl 3 len 0x10000 +vx3 at vmes0 addr 0xff7b0000 ipl 3 len 0x10000 +ve0 at vmes0 addr 0xffff1200 ipl 1 len 0x100 +ve1 at vmes0 addr 0xffff1400 ipl 1 len 0x100 +ve2 at vmes0 addr 0xffff1600 ipl 1 len 0x100 +vs0 at vmes0 addr 0xffff9000 ipl 2 len 0x800 +vs1 at vmes0 addr 0xffff9800 ipl 2 len 0x800 +vs2 at vmes0 addr 0xffff4800 ipl 2 len 0x800 +vs3 at vmes0 addr 0xffff5800 ipl 2 len 0x800 +vs4 at vmes0 addr 0xffff7000 ipl 2 len 0x800 +vs5 at vmes0 addr 0xffff7800 ipl 2 len 0x800 # ------------------------------ svme0 devices ------------------------- scsibus* at vs? @@ -111,16 +136,24 @@ st* at scsibus? target ? lun ? cd* at scsibus? target ? lun ? # ------------------------------ pseudo devices ------------------------ -pseudo-device vnd 4 # paging to files +pseudo-device rd 2 # ram disk drives + +pseudo-device loop 2 # network loopback pseudo-device bpfilter 8 # packet filter -pseudo-device sl 2 # CSLIP +pseudo-device sl 2 # CSLIP +pseudo-device ppp 2 # PPP +pseudo-device sppp # Sync PPP/HDLC pseudo-device tun 2 # network tunneling over tty -pseudo-device ppp 2 # PPP +pseudo-device enc 1 # IPSEC needs the encapsulation interface +#pseudo-device strip 1 # Starmode Radio IP interface + pseudo-device pty 64 # pseudo-terminals -pseudo-device loop 2 # network loopback pseudo-device tb 1 # tablet line discipline -pseudo-device enc 1 # encryption device +pseudo-device vnd 4 # paging to files pseudo-device ccd 4 # concatenated disk devices -pseudo-device rd 2 # ram disk drives +pseudo-device ksyms 1 # kernel symbols device +pseudo-device bridge 2 # network bridging support +#pseudo-device vlan 2 # IEEE 802.1Q VLAN +pseudo-device gre 1 # GRE encapsulation interface config bsd swap on generic 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); } diff --git a/sys/arch/mvme88k/include/psl.h b/sys/arch/mvme88k/include/psl.h index 63f7ff51dc5..a8b9a652fb4 100644 --- a/sys/arch/mvme88k/include/psl.h +++ b/sys/arch/mvme88k/include/psl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: psl.h,v 1.5 2000/07/06 15:25:04 ho Exp $ */ +/* $OpenBSD: psl.h,v 1.6 2001/02/12 08:16:23 smurph Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -45,6 +45,37 @@ #ifndef __M88K_M88100_PSL_H__ #define __M88K_M88100_PSL_H__ +/* + * INTERRUPT STAT levels. for 'systat vmstat' + * intrcnt and friends are defined in locore.S + * XXX smurph + */ +#ifndef _LOCORE + +#define M88K_NIRQ 12 + +#define M88K_SPUR_IRQ 0 +#define M88K_LEVEL1_IRQ 1 +#define M88K_LEVEL2_IRQ 2 +#define M88K_LEVEL3_IRQ 3 +#define M88K_LEVEL4_IRQ 4 +#define M88K_LEVEL5_IRQ 5 +#define M88K_LEVEL6_IRQ 6 +#define M88K_LEVEL7_IRQ 7 +/* + * We keep track of these seperately, but + * they will be reflected with the above also. + */ +#define M88K_CLK_IRQ 8 +#define M88K_SCLK_IRQ 9 +#define M88K_PCLK_IRQ 10 +#define M88K_NMI_IRQ 11 + +extern int intrcnt[M88K_NIRQ]; + +#endif + + /* needs major cleanup - XXX nivas */ #if 0 diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S index 11a6f286436..7319705b686 100644 --- a/sys/arch/mvme88k/mvme88k/locore.S +++ b/sys/arch/mvme88k/mvme88k/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.10 2001/02/01 03:38:20 smurph Exp $ */ +/* $OpenBSD: locore.S,v 1.11 2001/02/12 08:16:24 smurph Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -530,3 +530,26 @@ _sigcode: or r0, r0, 0 global _esigcode _esigcode: + +/* interrupt counters */ + global _intrcnt,_eintrcnt,_intrnames,_eintrnames +_intrnames: + string "spur\0" + string "lev1\0" + string "lev2\0" + string "lev3\0" + string "lev4\0" + string "lev5\0" + string "lev6\0" + string "lev7\0" + string "clk\0" + string "sclk\0" + string "pclk\0" + string "nmi\0" +_eintrnames: + .align 8 +_intrcnt: + word 0,0,0,0,0,0,0,0,0,0,0,0 +_eintrcnt: + + diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 900b52e8701..0b4cc6456f8 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.25 2001/02/01 03:38:21 smurph Exp $ */ +/* $OpenBSD: machdep.c,v 1.26 2001/02/12 08:16:24 smurph Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -151,7 +151,7 @@ volatile unsigned int *int_mask_reg[MAX_CPUS] = { #if defined(MVME187) || defined(MVME197) u_char *int_mask_level = (u_char *)INT_MASK_LEVEL; u_char *int_pri_level = (u_char *)INT_PRI_LEVEL; -#endif /* MVME188 */ +#endif /* defined(MVME187) || defined(MVME197) */ u_char *iackaddr; volatile u_char *pcc2intr_mask; @@ -352,7 +352,8 @@ size_memory(void) *look = save; } if ((look > (unsigned int *)0x01FFF000) && (cputyp == CPU_188)) { - look = (unsigned int *)0x01FFF000; /* temp hack to fake 32Meg on MVME188 */ + /* temp hack to fake 32Meg on MVME188 */ + look = (unsigned int *)0x01FFF000; } physmem = btoc(trunc_page((unsigned)look)); /* in pages */ return (trunc_page((unsigned)look)); @@ -523,25 +524,6 @@ cpu_startup() panic("bad UADDR"); } - /* - * Grab the BUGROM space that we hardwired in pmap_bootstrap - */ - bugromva = BUGROM_START; - -#if defined(UVM) - uvm_map(kernel_map, (vaddr_t *)&bugromva, BUGROM_SIZE, - NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, - UVM_PROT_NONE, - UVM_INH_NONE, - UVM_ADV_NORMAL, 0)); -#else - vm_map_find(kernel_map, vm_object_allocate(BUGROM_SIZE), 0, - (vm_offset_t *)&bugromva, BUGROM_SIZE, TRUE); -#endif - if (bugromva != BUGROM_START) { - printf("bugromva %x: BUGROM not free\n", bugromva); - panic("bad bugromva"); - } /* * Grab machine dependant memory spaces */ @@ -555,6 +537,26 @@ cpu_startup() #if defined(MVME187) || defined(MVME197) /* + * Grab the BUGROM space that we hardwired in pmap_bootstrap + */ + bugromva = BUGROM_START; + +#if defined(UVM) + uvm_map(kernel_map, (vaddr_t *)&bugromva, BUGROM_SIZE, + NULL, UVM_UNKNOWN_OFFSET,UVM_MAPFLAG(UVM_PROT_NONE, + UVM_PROT_NONE, + UVM_INH_NONE, + UVM_ADV_NORMAL, 0)); +#else + vm_map_find(kernel_map, vm_object_allocate(BUGROM_SIZE), 0, + (vm_offset_t *)&bugromva, BUGROM_SIZE, TRUE); +#endif + if (bugromva != BUGROM_START) { + printf("bugromva %x: BUGROM not free\n", bugromva); + panic("bad bugromva"); + } + + /* * Grab the SRAM space that we hardwired in pmap_bootstrap */ sramva = SRAM_START; @@ -1578,15 +1580,13 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) return; } - /* We want to service all interrupts marked in the IST register */ - /* They are all valid because the mask would have prevented them */ - /* from being generated otherwise. We will service them in order of */ - /* priority. */ + /* + * We want to service all interrupts marked in the IST register + * They are all valid because the mask would have prevented them + * from being generated otherwise. We will service them in order of + * priority. + */ do { - /* - printf("interrupt: mask = 0x%08x spl = %d imr = 0x%x\n", ISR_GET_CURRENT_MASK(cpu), - old_spl, *int_mask_reg[cpu]); - */ level = safe_level(cur_mask, old_spl); if (old_spl >= level) { @@ -1635,6 +1635,10 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) printf("unknown onboard interrupt: mask = 0x%b\n", 1 << intbit, IST_STRING); panic("m188_ext_int"); } + + + #define M88K_OBIO1_IRQ 8 + } else if (HW_FAILURE_MASK & (1 << intbit)) { vec = obio_vec[intbit]; if (vec == 0) { @@ -1665,9 +1669,13 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) vec, level, ivec[level]); } - if ((intr = intr_handlers[vec]) == 0) + if ((intr = intr_handlers[vec]) == 0){ + /* increment intr counter */ + intrcnt[M88K_SPUR_IRQ]++; printf("Spurious interrupt: level = %d vec = 0x%x, intbit = %d mask = 0x%b\n", level, vec, intbit, 1 << intbit, IST_STRING); + + } /* * Walk through all interrupt handlers in the chain for the * given vector, calling each handler in turn, till some handler @@ -1678,8 +1686,11 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) ret = (*intr->ih_fn)(intr->ih_arg, (void *)eframe); else ret = (*intr->ih_fn)(intr->ih_arg); - if (ret) + if (ret){ + /* increment intr counter */ + intrcnt[level]++; break; + } } if (ret == 0) { printf("Unclaimed interrupt: level = %d vec = 0x%x, intbit = %d mask = 0x%b\n", @@ -1785,6 +1796,8 @@ sbc_ext_int(u_int v, struct m88100_saved_state *eframe) enable_interrupt(); if ((intr = intr_handlers[vec]) == 0) { + /* increment intr counter */ + intrcnt[M88K_SPUR_IRQ]++; printf("Spurious interrupt (level %x and vec %x)\n", level, vec); } @@ -1804,8 +1817,11 @@ sbc_ext_int(u_int v, struct m88100_saved_state *eframe) ret = (*intr->ih_fn)(intr->ih_arg, (void *)eframe); else ret = (*intr->ih_fn)(intr->ih_arg); - if (ret) + if (ret){ + /* increment intr counter */ + intrcnt[level]++; break; + } } if (ret == 0) { @@ -2312,7 +2328,6 @@ mvme_bootstrap(void) #else vm_set_page_size(); #endif - first_addr = m88k_round_page(first_addr); if (!no_symbols) boothowto |= RB_KDB; diff --git a/sys/arch/mvme88k/mvme88k/pmap.c b/sys/arch/mvme88k/mvme88k/pmap.c index 62a8d52c07e..ce698b216cd 100644 --- a/sys/arch/mvme88k/mvme88k/pmap.c +++ b/sys/arch/mvme88k/mvme88k/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.19 2001/02/01 03:38:21 smurph Exp $ */ +/* $OpenBSD: pmap.c,v 1.20 2001/02/12 08:16:25 smurph Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * All rights reserved. @@ -350,7 +350,7 @@ boolean_t pmap_initialized = FALSE;/* Has pmap_init completed? */ * in pmap_con_dbg. */ -#ifdef DEBUG +#ifdef DEBUG static void check_pv_list __P((vm_offset_t, pv_entry_t, char *)); static void check_pmap_consistency __P((char *)); @@ -405,7 +405,7 @@ flush_atc_entry(long users, vm_offset_t va, int kernel) register int cpu; long tusers = users; -#if 0 +#ifdef DIAGNOSTIC if (ff1(tusers) > 4) { /* can't be more than 4 */ printf("ff1 users = %d!\n", ff1(tusers)); panic("bogus amount of users!!!"); @@ -443,7 +443,6 @@ m88k_protection(pmap_t map, vm_prot_t prot) } /* m88k_protection */ - /* * Routine: PMAP_PTE * @@ -465,7 +464,6 @@ m88k_protection(pmap_t map, vm_prot_t prot) * SDT_VALID * PDT_IDX */ -vm_offset_t va_tmp = (vm_offset_t)0xDEADBEEF; pt_entry_t * pmap_pte(pmap_t map, vm_offset_t virt) @@ -478,9 +476,6 @@ pmap_pte(pmap_t map, vm_offset_t virt) panic("pmap_pte: pmap is NULL"); sdt = SDTENT(map,virt); - if (virt == va_tmp) { - printf("check sdt @ 0x%x\n", sdt); - } /* * Check whether page table is exist or not. */ @@ -536,11 +531,10 @@ pmap_expand_kmap(vm_offset_t virt, vm_prot_t prot) kpdt_entry_t kpdt_ent; pmap_t map = kernel_pmap; -#if DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_KMAP | CD_FULL)) == (CD_KMAP | CD_FULL)) printf("(pmap_expand_kmap :%x) v %x\n", curproc,virt); #endif - aprot = m88k_protection (map, prot); /* segment table entry derivate from map and virt. */ @@ -621,7 +615,7 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) cmode = (prot & 0xffff0000) >> 16; prot &= 0x0000ffff; -#if DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_MAP | CD_NORM)) == (CD_MAP | CD_NORM)) printf ("(pmap_map :%x) phys address from %x to %x mapped at virtual %x, prot %x cmode %x\n", curproc, start, end, virt, prot, cmode); @@ -642,7 +636,7 @@ pmap_map(vm_offset_t virt, vm_offset_t start, vm_offset_t end, vm_prot_t prot) if ((pte = pmap_expand_kmap(virt, VM_PROT_READ|VM_PROT_WRITE)) == PT_ENTRY_NULL) panic ("pmap_map: Cannot allocate pte table"); -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_MAP | CD_FULL)) == (CD_MAP | CD_FULL)) if (pte->dtype) printf("(pmap_map :%x) pte @ 0x%x already valid\n", curproc, (unsigned)pte); @@ -723,7 +717,7 @@ pmap_map_batc(vm_offset_t virt, vm_offset_t start, vm_offset_t end, batc_template_t batctmp; register int i; -#if DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_MAPB | CD_FULL)) == (CD_MAPB | CD_FULL)) printf ("(pmap_map_batc :%x) phys address from %x to %x mapped at virtual %x, prot %x\n", curproc, start, end, virt, prot); @@ -1182,12 +1176,12 @@ pmap_bootstrap(vm_offset_t load_start, /* IN */ *phys_start += etherlen; if (vaddr != *virt_start) { - #ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_BOOT | CD_FULL)) == (CD_BOOT | CD_FULL)) { printf("2:vaddr %x *virt_start %x *phys_start %x\n", vaddr, *virt_start, *phys_start); } - #endif +#endif *virt_start = vaddr; *phys_start = round_page(*phys_start); } @@ -1439,7 +1433,7 @@ pmap_init(void) struct simplelock *lock; int bank; -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_INIT | CD_NORM)) == (CD_INIT | CD_NORM)) printf("pmap_init()\n"); #endif @@ -1454,7 +1448,7 @@ pmap_init(void) s += PV_LOCK_TABLE_SIZE(npages); /* pv_lock_table */ s += npages * sizeof(char); /* pmap_modify_list */ -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_INIT | CD_FULL)) == (CD_INIT | CD_FULL)) { printf("(pmap_init) nbr of managed pages = %x\n", npages); printf("(pmap_init) size of pv_list = %x\n", @@ -1515,7 +1509,7 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) register int i; vm_size_t pvl_table_size; -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_INIT | CD_NORM)) == (CD_INIT | CD_NORM)) printf("(pmap_init) phys_start %x phys_end %x\n", phys_start, phys_end); #endif @@ -1529,7 +1523,7 @@ pmap_init(vm_offset_t phys_start, vm_offset_t phys_end) s += PV_LOCK_TABLE_SIZE(npages); /* pv_lock_table */ s += npages * sizeof(char); /* pmap_modify_list */ -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_INIT | CD_FULL)) == (CD_INIT | CD_FULL)) { printf("(pmap_init) nbr of managed pages = %x\n", npages); printf("(pmap_init) size of pv_list = %x\n", @@ -1704,7 +1698,7 @@ pmap_pinit(pmap_t p) * Allocate memory for *actual* segment table and *shadow* table. */ s = M88K_ROUND_PAGE(2 * SDT_SIZE); -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_CREAT | CD_NORM)) == (CD_CREAT | CD_NORM)) { printf("(pmap_create :%x) need %d pages for sdt\n", curproc, atop(s)); @@ -1737,13 +1731,14 @@ pmap_pinit(pmap_t p) panic("pmap_create: sdt_table not aligned on page boundary"); } -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_CREAT | CD_NORM)) == (CD_CREAT | CD_NORM)) { printf("(pmap_create :%x) pmap=0x%x, sdt_vaddr=0x%x, sdt_paddr=0x%x\n", curproc, (unsigned)p, p->sdt_vaddr, p->sdt_paddr); } #endif +#ifdef MVME188 if (cputyp == CPU_188) { /* * memory for page tables should be CACHE DISABLED on MVME188 @@ -1753,6 +1748,7 @@ pmap_pinit(pmap_t p) (vm_offset_t)segdt+ (SDT_SIZE*2), CACHE_INH); } +#endif /* * Initialize SDT_ENTRIES. */ @@ -1783,7 +1779,7 @@ pmap_pinit(pmap_t p) stats->resident_count = 0; stats->wired_count = 0; -#ifdef DEBUG +#ifdef DEBUG /* link into list of pmaps, just after kernel pmap */ p->next = kernel_pmap->next; p->prev = kernel_pmap; @@ -1825,7 +1821,7 @@ pmap_free_tables(pmap_t pmap) pt_entry_t *gdttbl; /* ptr to first entry in a page table */ unsigned int i,j; -#if DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_FREE | CD_NORM)) == (CD_FREE | CD_NORM)) printf("(pmap_free_tables :%x) pmap %x\n", curproc, pmap); #endif @@ -1844,7 +1840,7 @@ pmap_free_tables(pmap_t pmap) for ( ; i < j; i++) { sdt_va = PDT_TABLE_GROUP_VA_SPACE*i; if ((gdttbl = pmap_pte(pmap, (vm_offset_t)sdt_va)) != PT_ENTRY_NULL) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_FREE | CD_FULL)) == (CD_FREE | CD_FULL)) printf("(pmap_free_tables :%x) free page table = 0x%x\n", curproc, gdttbl); @@ -1853,7 +1849,7 @@ pmap_free_tables(pmap_t pmap) } } /* Segment Loop */ -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_FREE | CD_FULL)) == (CD_FREE | CD_FULL)) printf("(pmap_free_tables :%x) free segment table = 0x%x\n", curproc, sdttbl); @@ -1873,14 +1869,13 @@ void pmap_release(register pmap_t p) { pmap_free_tables(p); -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_DESTR | CD_NORM)) == (CD_DESTR | CD_NORM)) printf("(pmap_destroy :%x) ref_count = 0\n", curproc); /* unlink from list of pmap structs */ p->prev->next = p->next; p->next->prev = p->prev; #endif - } /* @@ -1913,7 +1908,7 @@ pmap_destroy(pmap_t p) register int c, s; if (p == PMAP_NULL) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_DESTR | CD_NORM)) == (CD_DESTR | CD_NORM)) printf("(pmap_destroy :%x) pmap is NULL\n", curproc); #endif @@ -2275,7 +2270,7 @@ pmap_remove_all(vm_offset_t phys) if (!PMAP_MANAGED(phys)) { /* not a managed page. */ -#ifdef DEBUG +#ifdef DEBUG if (pmap_con_dbg & CD_RMAL) printf("(pmap_remove_all :%x) phys addr 0x%x not a managed page\n", curproc, phys); #endif @@ -2410,7 +2405,7 @@ pmap_copy_on_write(vm_offset_t phys) int kflush; if (!PMAP_MANAGED(phys)) { -#ifdef DEBUG +#ifdef DEBUG if (pmap_con_dbg & CD_CMOD) printf("(pmap_copy_on_write :%x) phys addr 0x%x not managed \n", curproc, phys); #endif @@ -2425,7 +2420,7 @@ copy_on_write_Retry: LOCK_PVH(phys); if (pv_e->pmap == PMAP_NULL) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_COW | CD_NORM)) == (CD_COW | CD_NORM)) printf("(pmap_copy_on_write :%x) phys addr 0x%x not mapped\n", curproc, phys); #endif @@ -2575,7 +2570,7 @@ pmap_protect(pmap_t pmap, vm_offset_t s, vm_offset_t e, vm_prot_t prot) va += (1<<SDT_SHIFT) - PAGE_SIZE; /* no page table, skip to next seg entry */ else /* wrap around */ break; -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_PROT | CD_FULL)) == (CD_PROT | CD_FULL)) printf("(pmap_protect :%x) no page table :: skip to 0x%x\n", curproc, va + PAGE_SIZE); #endif @@ -2583,7 +2578,7 @@ pmap_protect(pmap_t pmap, vm_offset_t s, vm_offset_t e, vm_prot_t prot) } if (!PDT_VALID(pte)) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_PROT | CD_FULL)) == (CD_PROT | CD_FULL)) printf("(pmap_protect :%x) pte invalid pte @ 0x%x\n", curproc, pte); #endif @@ -2669,7 +2664,7 @@ pmap_expand(pmap_t map, vm_offset_t v) panic("pmap_expand: pmap is NULL"); } -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_EXP | CD_NORM)) == (CD_EXP | CD_NORM)) printf ("(pmap_expand :%x) map %x v %x\n", curproc, map, v); #endif @@ -2684,7 +2679,7 @@ pmap_expand(pmap_t map, vm_offset_t v) if (pmap_expand_kmap(v, VM_PROT_READ|VM_PROT_WRITE) == PT_ENTRY_NULL) panic ("pmap_expand: Cannot allocate kernel pte table"); PMAP_UNLOCK(map, spl); -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_EXP | CD_FULL)) == (CD_EXP | CD_FULL)) printf("(pmap_expand :%x) kernel_pmap\n", curproc); #endif @@ -2699,12 +2694,14 @@ pmap_expand(pmap_t map, vm_offset_t v) #endif pdt_paddr = pmap_extract(kernel_pmap, pdt_vaddr); +#ifdef MVME188 if (cputyp == CPU_188) { /* * the page for page tables should be CACHE DISABLED on MVME188 */ pmap_cache_ctrl(kernel_pmap, pdt_vaddr, pdt_vaddr+PAGE_SIZE, CACHE_INH); } +#endif PMAP_LOCK(map, spl); @@ -2721,7 +2718,7 @@ pmap_expand(pmap_t map, vm_offset_t v) kmem_free (kernel_map, pdt_vaddr, PAGE_SIZE); #endif -#ifdef DEBUG +#ifdef DEBUG if (pmap_con_dbg & CD_EXP) printf("(pmap_expand :%x) table has already allocated\n", curproc); #endif @@ -2859,7 +2856,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, * Range check no longer use, since we use whole address space */ -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_ENT | CD_NORM)) == (CD_ENT | CD_NORM)) { if (pmap == kernel_pmap) printf ("(pmap_enter :%x) pmap kernel va %x pa %x\n", curproc, va, pa); @@ -2867,7 +2864,6 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, printf ("(pmap_enter :%x) pmap %x va %x pa %x\n", curproc, pmap, va, pa); } #endif - ap = m88k_protection (pmap, prot); /* @@ -2957,7 +2953,7 @@ Retry: * Invalidate the translation buffer, * then remove the mapping. */ -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_ENT | CD_NORM)) == (CD_ENT | CD_NORM)) { if (va == phys_map_vaddr1 || va == phys_map_vaddr2) { printf("vaddr1 0x%x vaddr2 0x%x va 0x%x pa 0x%x managed %x\n", @@ -2976,7 +2972,7 @@ Retry: } if (PMAP_MANAGED(pa)) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_ENT | CD_NORM)) == (CD_ENT | CD_NORM)) { if (va == phys_map_vaddr1 || va == phys_map_vaddr2) { printf("va 0x%x and managed pa 0x%x\n", va, pa); @@ -3000,7 +2996,7 @@ Retry: pvl->next = PV_ENTRY_NULL; } else { -#ifdef DEBUG +#ifdef DEBUG /* * check that this mapping is not already there */ @@ -3244,7 +3240,7 @@ void pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, vm_offset_t src_addr) { -#ifdef lint +#ifdef lint dst_pmap++; src_pmap++; dst_addr++; len++; src_addr++; #endif @@ -3276,7 +3272,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, void pmap_update(void) { -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_UPD | CD_FULL)) == (CD_UPD | CD_FULL)) printf("(pmap_update :%x) Called \n", curproc); #endif @@ -3356,7 +3352,7 @@ pmap_collect(pmap_t pmap) CHECK_PMAP_CONSISTENCY ("pmap_collect"); -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_COL | CD_NORM)) == (CD_COL | CD_NORM)) printf ("(pmap_collect :%x) pmap %x\n", curproc, pmap); #endif @@ -3429,7 +3425,7 @@ pmap_collect(pmap_t pmap) PMAP_UNLOCK(pmap, spl); -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_COL | CD_NORM)) == (CD_COL | CD_NORM)) printf ("(pmap_collect :%x) done \n", curproc); #endif @@ -3636,7 +3632,6 @@ pmap_copy_page(vm_offset_t src, vm_offset_t dst) } /* pmap_copy_page() */ - /* * copy_to_phys * @@ -3790,7 +3785,7 @@ void pmap_pageable(pmap_t pmap, vm_offset_t start, vm_offset_t end, boolean_t pageable) { -#ifdef lint +#ifdef lint pmap++; start++; end++; pageable++; #endif } /* pmap_pagealbe() */ @@ -3905,7 +3900,7 @@ pmap_clear_modify(vm_offset_t phys) int kflush; if (!PMAP_MANAGED(phys)) { -#ifdef DBG +#ifdef DEBUG if (pmap_con_dbg & CD_CMOD) printf("(pmap_clear_modify :%x) phys addr 0x%x not managed \n", curproc, phys); #endif @@ -3923,7 +3918,7 @@ clear_modify_Retry: SET_ATTRIB(phys, 0); if (pvl->pmap == PMAP_NULL) { -#ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_CMOD | CD_NORM)) == (CD_CMOD | CD_NORM)) printf("(pmap_clear_modify :%x) phys addr 0x%x not mapped\n", curproc, phys); #endif @@ -4020,7 +4015,7 @@ pmap_is_modified(vm_offset_t phys) boolean_t modified_flag; if (!PMAP_MANAGED(phys)) { -#ifdef DBG +#ifdef DEBUG if (pmap_con_dbg & CD_IMOD) printf("(pmap_is_modified :%x) phys addr 0x%x not managed\n", curproc, phys); #endif @@ -4036,7 +4031,7 @@ pmap_is_modified(vm_offset_t phys) if ((boolean_t) PA_TO_ATTRIB(phys)) { /* we've already cached a modify flag for this page, no use looking further... */ -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_IMOD | CD_NORM)) == (CD_IMOD | CD_NORM)) printf("(pmap_is_modified :%x) already cached a modify flag for this page\n", curproc); #endif @@ -4049,7 +4044,7 @@ pmap_is_modified(vm_offset_t phys) /* unmapped page - get info from page_modified array maintained by pmap_remove_range/ pmap_remove_all */ modified_flag = (boolean_t) PA_TO_ATTRIB(phys); -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_IMOD | CD_NORM)) == (CD_IMOD | CD_NORM)) printf("(pmap_is_modified :%x) phys addr 0x%x not mapped\n", curproc, phys); #endif @@ -4074,7 +4069,7 @@ pmap_is_modified(vm_offset_t phys) for (i = ptes_per_vm_page; i > 0; i--) { if (ptep->modified) { simple_unlock(&pvep->pmap->lock); -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_IMOD | CD_FULL)) == (CD_IMOD | CD_FULL)) printf("(pmap_is_modified :%x) modified page pte@0x%x\n", curproc, (unsigned)ptep); #endif @@ -4141,7 +4136,7 @@ pmap_clear_reference(vm_offset_t phys) int kflush; if (!PMAP_MANAGED(phys)) { -#ifdef DBG +#ifdef DEBUG if (pmap_con_dbg & CD_CREF) { printf("(pmap_clear_reference :%x) phys addr 0x%x not managed\n", curproc,phys); } @@ -4158,7 +4153,7 @@ pmap_clear_reference(vm_offset_t phys) if (pvl->pmap == PMAP_NULL) { -#ifdef DBG +#ifdef DEBUG if ((pmap_con_dbg & (CD_CREF | CD_NORM)) == (CD_CREF | CD_NORM)) printf("(pmap_clear_reference :%x) phys addr 0x%x not mapped\n", curproc,phys); #endif @@ -4358,7 +4353,7 @@ pmap_verify_free(vm_offset_t phys) boolean_t pmap_valid_page(vm_offset_t p) { -#ifdef lint +#ifdef lint p++; #endif return (TRUE); @@ -4454,13 +4449,13 @@ pagemove(vm_offset_t from, vm_offset_t to, int size) panic("pagemove: Distination pte already valid"); } - #ifdef DEBUG +#ifdef DEBUG if ((pmap_con_dbg & (CD_PGMV | CD_NORM)) == (CD_PGMV | CD_NORM)) printf("(pagemove :%x) from 0x%x to 0x%x\n", curproc, from, to); if ((pmap_con_dbg & (CD_PGMV | CD_FULL)) == (CD_PGMV | CD_FULL)) printf("(pagemove :%x) srcpte @ 0x%x = %x dstpte @ 0x%x = %x\n", curproc, (unsigned)srcpte, *(unsigned *)srcpte, (unsigned)dstpte, *(unsigned *)dstpte); - #endif /* DEBUG */ +#endif /* DEBUG */ /* * Update pv_list @@ -4662,7 +4657,7 @@ pmap_cache_flush(pmap_t pmap, vm_offset_t virt, int bytes, int mode) PMAP_UNLOCK(pmap, spl); } /* pmap_cache_flush */ -#ifdef DEBUG +#ifdef DEBUG /* * DEBUGGING ROUTINES - check_pv_list and check_pmp_consistency are used * only for debugging. They are invoked only @@ -4936,7 +4931,6 @@ check_pmap_consistency(char *who) int bank; unsigned npages; #endif - if ((pmap_con_dbg & (CD_CHKPM | CD_NORM)) == (CD_CHKPM | CD_NORM)) printf("check_pmap_consistency (%s :%x) start.\n", who, curproc); @@ -5061,7 +5055,6 @@ pmap_print(pmap_t pmap) pmap->stats.loopups, pmap->stats.faults); #endif - sdtp = (sdt_entry_t *) pmap->sdt_vaddr; /* addr of physical table */ sdtv = sdtp + SDT_ENTRIES; /* shadow table with virt address */ if (sdtp == (sdt_entry_t *)0) @@ -5178,7 +5171,7 @@ pmap_print_trace (pmap_t pmap, vm_offset_t va, boolean_t long_format) /* get addrs of page (pte) table (no shadow table) */ sdtp = ((sdt_entry_t *)pmap->sdt_vaddr) + SDTIDX(va); -#ifdef DBG +#ifdef DEBUG printf("*** DEBUG (sdtp) "); PRINT_SDT(sdtp); #endif @@ -5502,4 +5495,3 @@ pmap_range_remove(pmap_range_t *ranges, vm_offset_t start, vm_offset_t end) range->start = end; } #endif /* FUTURE_MAYBE */ - |