diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-04-27 23:21:07 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-04-27 23:21:07 +0000 |
commit | 68bd39a8215f0f8a94a812dd041e1f0257eadb4c (patch) | |
tree | 0cf3291275ed21e599146dea724c8f4c962a61db /sys/arch/mvme68k | |
parent | d75a8327a6482df990b368070cf1e837f96bae60 (diff) |
Jumbo commit to fix all compilation warnings on mvme68k (add prototypes,
add casts, fix a few errors and typos in the process, etc)
Diffstat (limited to 'sys/arch/mvme68k')
50 files changed, 1887 insertions, 1529 deletions
diff --git a/sys/arch/mvme68k/dev/bug.c b/sys/arch/mvme68k/dev/bug.c index 340ee115917..995ff686574 100644 --- a/sys/arch/mvme68k/dev/bug.c +++ b/sys/arch/mvme68k/dev/bug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bug.c,v 1.4 1999/09/27 20:30:31 smurph Exp $ */ +/* $OpenBSD: bug.c,v 1.5 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -35,11 +35,18 @@ * are preserved. */ #include <sys/param.h> + +#include <machine/bugio.h> #include <machine/prom.h> /* flag to traphandler to signify prom call. presumes splhigh() */ extern volatile int promcall; +void bug_outln(char *, char *); +void bug_delay(int); +void bug_stat(void); +void asm_bug_stat(void); + /* tty routines */ char bug_inchr() @@ -208,17 +215,6 @@ bug_brdid() return (pbrd_id); } -void -bug_rtc_rd(ptime) - struct bug_time *ptime; -{ - promcall = 1; - asm volatile ("movl %0,sp@-" :: "a" (ptime)); - MVMEPROM_CALL(MVMEPROM_RTC_RD); - asm volatile ("nop"); - promcall = 0; -} - int asm_callbuf[4]; void @@ -247,8 +243,3 @@ asm_bug_stat() asm volatile ("movl _asm_callbuf+8,d0"); asm volatile ("movl _asm_callbuf+12,d1"); } - - - - - diff --git a/sys/arch/mvme68k/dev/bugtty.c b/sys/arch/mvme68k/dev/bugtty.c index 91815f82be1..89473d018c0 100644 --- a/sys/arch/mvme68k/dev/bugtty.c +++ b/sys/arch/mvme68k/dev/bugtty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bugtty.c,v 1.6 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: bugtty.c,v 1.7 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Dale Rahn. @@ -36,12 +36,13 @@ #include <sys/device.h> #include <sys/tty.h> #include <sys/proc.h> -#include <sys/conf.h> #include <sys/uio.h> #include <sys/queue.h> #include <dev/cons.h> #include <machine/autoconf.h> +#include <machine/bugio.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <machine/prom.h> @@ -62,14 +63,12 @@ struct cfdriver bugtty_cd = { int bugttycnprobe(struct consdev *cp); int bugttycninit(struct consdev *cp); int bugttycngetc(dev_t dev); -int bugttycnputc(dev_t dev, char c); +void bugttycnputc(dev_t dev, char c); -int bugttyopen(dev_t dev, int flag, int mode, struct proc *p); -int bugttyclose(dev_t dev, int flag, int mode, struct proc *p); -int bugttyread(dev_t dev, struct uio *uio, int flag); -int bugttywrite(dev_t dev, struct uio *uio, int flag); -int bugttyioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p); -int bugttystop(struct tty *tp, int flag); +struct tty *bugttytty(dev_t); +int bugttymctl(dev_t, int, int); +int bugttyparam(struct tty*, struct termios *); +void bugtty_chkinput(void); #define DIALOUT(x) ((x) & 0x80) #define SWFLAGS(dev) (bugttyswflags | (DIALOUT(dev) ? TIOCFLAG_SOFTCAR : 0)) @@ -126,8 +125,8 @@ bugttymctl(dev, bits, how) dev_t dev; int bits, how; { - static int settings = TIOCM_DTR | TIOCM_RTS | - TIOCM_CTS | TIOCM_CD | TIOCM_DSR; + /*static int settings = TIOCM_DTR | TIOCM_RTS | + TIOCM_CTS | TIOCM_CD | TIOCM_DSR;*/ int s; /*printf("mctl: dev %x, bits %x, how %x,",dev, bits, how);*/ @@ -242,7 +241,9 @@ bugttyopen(dev, flag, mode, p) } int -bugttyparam() +bugttyparam(tp, tm) + struct tty*tp; + struct termios *tm; { return (0); } @@ -251,7 +252,7 @@ void bugttyoutput(tp) struct tty *tp; { - int cc, s, unit, cnt ; + int cc, s, cnt; /* only supports one unit */ @@ -302,6 +303,7 @@ bugttyread(dev, uio, flag) #if 1 /* only to be called at splclk() */ +void bugtty_chkinput() { struct tty *tp; @@ -354,7 +356,7 @@ bugttywrite(dev, uio, flag) int bugttyioctl(dev, cmd, data, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t data; int flag; struct proc *p; @@ -480,6 +482,7 @@ int bugttycninit(cp) struct consdev *cp; { + return (0); } int @@ -489,7 +492,7 @@ bugttycngetc(dev) return (bug_inchr()); } -int +void bugttycnputc(dev, c) dev_t dev; char c; diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c index 9bf8c735b4f..189ff4e91f4 100644 --- a/sys/arch/mvme68k/dev/cl.c +++ b/sys/arch/mvme68k/dev/cl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cl.c,v 1.25 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: cl.c,v 1.26 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -33,7 +33,6 @@ /* DMA mode still does not work!!! */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/proc.h> #include <sys/tty.h> @@ -41,12 +40,17 @@ #include <sys/systm.h> #include <sys/time.h> #include <sys/device.h> +#include <sys/syslog.h> /* #include <sys/queue.h> */ -#include <machine/cpu.h> + #include <machine/autoconf.h> +#include <machine/conf.h> +#include <machine/cpu.h> + #include <dev/cons.h> + #include <mvme68k/dev/clreg.h> -#include <sys/syslog.h> + #include "cl.h" #ifdef DDB @@ -59,7 +63,7 @@ #include <mvme68k/dev/pcctworeg.h> #endif -#define splcl() spl3() +#define splcl() spltty() #define USE_BUFFER /* min timeout 0xa, what is a good value */ @@ -170,9 +174,9 @@ void cl_unblock(struct tty *tp); int clccparam(struct clsoftc *sc, struct termios *par, int channel); int clparam(struct tty *tp, struct termios *t); -int cl_mintr(struct clsoftc *sc); -int cl_txintr(struct clsoftc *sc); -int cl_rxintr(struct clsoftc *sc); +int cl_mintr(void *); +int cl_txintr(void *); +int cl_rxintr(void *); void cl_overflow(struct clsoftc *sc, int channel, time_t *ptime, u_char *msg); void cl_parity(struct clsoftc *sc, int channel); void cl_frame(struct clsoftc *sc, int channel); @@ -183,20 +187,20 @@ void cl_dumpport(int channel); int clprobe(struct device *parent, void *self, void *aux); void clattach(struct device *parent, struct device *self, void *aux); -int clopen(dev_t dev, int flag, int mode, struct proc *p); -int clclose(dev_t dev, int flag, int mode, struct proc *p); -int clread(dev_t dev, struct uio *uio, int flag); -int clwrite(dev_t dev, struct uio *uio, int flag); -int clioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p); -int clstop(struct tty *tp, int flag); - -static void cl_initchannel(struct clsoftc *sc, int channel); -static void clputc(struct clsoftc *sc, int unit, u_char c); -static u_char clgetc(struct clsoftc *sc, int *channel); -static void cloutput(struct tty *tp); -void cl_softint(struct clsoftc *sc); +void cl_initchannel(struct clsoftc *sc, int channel); +void clputc(struct clsoftc *sc, int unit, u_char c); +u_char clgetc(struct clsoftc *sc, int *channel); +void cloutput(struct tty *tp); +void cl_softint(void *); void cl_appendbufn(struct clsoftc *sc, u_char channel, u_char *buf, u_short cnt); +struct tty *cltty(dev_t); +int cl_instat(struct clsoftc *); +void clcnpollc(dev_t, int); +void cl_chkinput(void); +void cl_break(struct clsoftc *, int); +void cl_appendbuf(struct clsoftc *, u_char, u_char); + struct cfattach cl_ca = { sizeof(struct clsoftc), clprobe, clattach }; @@ -213,9 +217,8 @@ int dopoll = 1; #define CL_CHANNEL(x) (minor(x) & 3) #define CL_TTY(x) (minor(x)) -extern int cputyp; - -struct tty * cltty(dev) +struct tty * +cltty(dev) dev_t dev; { int unit, channel; @@ -229,7 +232,8 @@ struct tty * cltty(dev) return sc->sc_cl[channel].tty; } -int clprobe(parent, self, aux) +int +clprobe(parent, self, aux) struct device *parent; void *self; void *aux; @@ -320,8 +324,9 @@ clattach(parent, self, aux) sc->ssir = allocate_sir(cl_softint, (void *)sc); #endif for (i = 0; i < CLCD_PORTS_PER_CHIP; i++) { - int j; #if 0 + int j; + for (j = 0; j < 2 ; j++) { sc->sc_cl[i].rxp[j] = (void *)kvtop(sc->sc_cl[i].rx[j]); printf("cl[%d].rxbuf[%d] %x p %x\n", @@ -387,7 +392,8 @@ clattach(parent, self, aux) evcnt_attach(&sc->sc_dev, "intr", &sc->sc_mxintrcnt); printf("\n"); } -static void + +void cl_initchannel(sc, channel) struct clsoftc *sc; int channel; @@ -529,7 +535,8 @@ int clmctl (dev, bits, how) return(bits); } -int clopen (dev, flag, mode, p) +int +clopen(dev, flag, mode, p) dev_t dev; int flag; int mode; @@ -697,6 +704,7 @@ int clparam(tp, t) return 0; } +#if 0 void cloutput(tp) struct tty *tp; { @@ -734,8 +742,10 @@ void cloutput(tp) } splx(s); } +#endif -int clclose (dev, flag, mode, p) +int +clclose(dev, flag, mode, p) dev_t dev; int flag; int mode; @@ -777,10 +787,12 @@ int clclose (dev, flag, mode, p) return 0; } -int clread (dev, uio, flag) + +int +clread (dev, uio, flag) dev_t dev; struct uio *uio; -int flag; + int flag; { int unit, channel; struct tty *tp; @@ -798,7 +810,9 @@ int flag; return ENXIO; return((*linesw[tp->t_line].l_read)(tp, uio, flag)); } -int clwrite (dev, uio, flag) + +int +clwrite (dev, uio, flag) dev_t dev; struct uio *uio; int flag; @@ -819,9 +833,11 @@ int clwrite (dev, uio, flag) return ENXIO; return((*linesw[tp->t_line].l_write)(tp, uio, flag)); } -int clioctl (dev, cmd, data, flag, p) + +int +clioctl(dev, cmd, data, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t data; int flag; struct proc *p; @@ -1001,7 +1017,10 @@ int clcngetc(dev) dev_t dev; { - u_char val, reoir, licr, isrl, data, status, fifo_cnt; + u_char val, reoir, licr, isrl, data, fifo_cnt; +#if 0 + u_char status; +#endif int got_char = 0; u_char ier_old = 0xff; struct clreg *cl_reg = cl_cons.cl_vaddr; @@ -1068,6 +1087,8 @@ clcnputc(dev, c) clputc(0, 0, c); return 0; } + +void clcnpollc(dev, on) dev_t dev; int on; @@ -1079,7 +1100,8 @@ clcnpollc(dev, on) } return; } -static void + +void clputc(sc, unit, c) struct clsoftc *sc; int unit; @@ -1181,7 +1203,8 @@ cl_chkinput() } } #endif -static u_char + +u_char clgetc(sc, channel) struct clsoftc *sc; int *channel; @@ -1406,9 +1429,12 @@ clstart(tp) struct tty *tp; { dev_t dev; +#if 0 u_char cbuf; + int cnt; +#endif struct clsoftc *sc; - int channel, unit, s, cnt; + int channel, unit, s; dev = tp->t_dev; channel = CL_CHANNEL(dev); @@ -1455,9 +1481,10 @@ clstart(tp) return; } int -cl_mintr(sc) - struct clsoftc *sc; +cl_mintr(arg) + void *arg; { + struct clsoftc *sc = (struct clsoftc *)arg; u_char mir, misr, msvr; int channel; if(((mir = sc->cl_reg->cl_mir) & 0x40) == 0x0) { @@ -1510,10 +1537,11 @@ cl_mintr(sc) } int -cl_txintr(sc) - struct clsoftc *sc; +cl_txintr(arg) + void *arg; { - static empty = 0; + struct clsoftc *sc = (struct clsoftc *)arg; + static int empty = 0; u_char tir, cmr, teoir; u_char max; int channel; @@ -1632,11 +1660,11 @@ cl_txintr(sc) } int -cl_rxintr(sc) - struct clsoftc *sc; +cl_rxintr(arg) + void *arg; { + struct clsoftc *sc = (struct clsoftc *)arg; u_char rir, channel, cmr, risrl; - u_char c; u_char fifocnt; struct tty *tp; int i; @@ -1859,31 +1887,6 @@ cl_break (sc, channel) } void -cl_dumpport0() -{ - cl_dumpport(0); - return; -} -void -cl_dumpport1() -{ - cl_dumpport(1); - return; -} -void -cl_dumpport2() -{ - cl_dumpport(2); - return; -} -void -cl_dumpport3() -{ - cl_dumpport(3); - return; -} - -void cl_dumpport(channel) int channel; { @@ -2010,7 +2013,7 @@ cl_appendbuf(sc, channel, c) u_char channel; u_char c; { - int s; + /* int s; */ /* s = splcl(); */ if (1 + sc->sc_cl[channel].nchar >= CL_BUFSIZE ) { cl_overflow (sc, channel, &sc->sc_fotime, "rbuf"); @@ -2034,7 +2037,7 @@ cl_appendbufn(sc, channel, buf, cnt) u_char *buf; u_short cnt; { - int s; + /* int s; */ int i; /* s = splcl(); */ /* should be called at splcl(). */ if (cnt + sc->sc_cl[channel].nchar >= CL_BUFSIZE ) { @@ -2059,9 +2062,10 @@ cl_appendbufn(sc, channel, buf, cnt) } void -cl_softint(sc) - struct clsoftc *sc; +cl_softint(arg) + void *arg; { + struct clsoftc *sc = (struct clsoftc *)arg; int i; int s; u_char c; diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c index 28d05823924..6dc13da265c 100644 --- a/sys/arch/mvme68k/dev/clock.c +++ b/sys/arch/mvme68k/dev/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.4 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: clock.c,v 1.5 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -74,8 +74,9 @@ */ #include <sys/param.h> -#include <sys/kernel.h> #include <sys/device.h> +#include <sys/kernel.h> +#include <sys/systm.h> #include <machine/psl.h> #include <machine/autoconf.h> @@ -226,6 +227,7 @@ clockintr(arg) * Set up real-time clock; we don't have a statistics clock at * present. */ +void cpu_initclocks() { register int statint, minint; @@ -375,8 +377,9 @@ statintr(cap) return (1); } +void delay(us) - register int us; + int us; { volatile register int c; @@ -391,7 +394,7 @@ delay(us) c = 2 * us; while (--c > 0) ; - return (0); + break; #endif #if NMC > 0 case BUS_MC: @@ -406,7 +409,7 @@ delay(us) while (sys_mc->mc_t3count < us) ; - return (0); + break; #endif #if NPCCTWO > 0 case BUS_PCCTWO: @@ -418,7 +421,7 @@ delay(us) c = 4 * us; while (--c > 0) ; - return (0); + break; #endif } } diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c index fbb994480e4..050b22b331a 100644 --- a/sys/arch/mvme68k/dev/flash.c +++ b/sys/arch/mvme68k/dev/flash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: flash.c,v 1.10 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: flash.c,v 1.11 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -32,7 +32,6 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/proc.h> #include <sys/user.h> @@ -44,7 +43,9 @@ #include <sys/syslog.h> #include <sys/fcntl.h> #include <sys/device.h> + #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <machine/mioctl.h> @@ -58,7 +59,7 @@ struct flashsoftc { struct device sc_dev; - u_char * sc_paddr; + u_char * sc_paddr; volatile u_char * sc_vaddr; u_char sc_manu; u_char sc_ii; @@ -79,6 +80,8 @@ struct cfdriver flash_cd = { int flashwritebyte(struct flashsoftc *sc, int addr, u_char val); int flasherasezone(struct flashsoftc *sc, int addr); +u_char *flashsavezone(struct flashsoftc *, int); +int flashwritezone(struct flashsoftc *, u_char *, int); struct flashii intel_flashii[] = { { "28F008SA", FLII_INTEL_28F008SA, 1024*1024, 64*1024 }, @@ -126,7 +129,7 @@ flashmatch(parent, cf, args) return (0); #endif - if (badpaddr(ca->ca_paddr, 1)) + if (badpaddr((paddr_t)ca->ca_paddr, 1)) return (0); if (!mc_hasflash()) @@ -229,7 +232,7 @@ flashwritezone(sc, zone, start) do { sc->sc_vaddr[0] = FLCMD_READSTAT; sr = sc->sc_vaddr[0]; - } while (sr & FLSR_WSMS == 0); + } while ((sr & FLSR_WSMS) == 0); if (sr & FLSR_BWS) return (i); /* write failed on this byte! */ sc->sc_vaddr[0] = FLCMD_RESET; @@ -296,21 +299,25 @@ flashwritebyte(sc, addr, val) /*ARGSUSED*/ int -flashopen(dev, flag, mode) +flashopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { + if (minor(dev) >= flash_cd.cd_ndevs || flash_cd.cd_devs[minor(dev)] == NULL) return (ENODEV); + return (0); } /*ARGSUSED*/ int -flashclose(dev, flag, mode) +flashclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -319,9 +326,10 @@ flashclose(dev, flag, mode) /*ARGSUSED*/ int flashioctl(dev, cmd, data, flag, p) - dev_t dev; - u_char *data; - int cmd, flag; + dev_t dev; + u_long cmd; + caddr_t data; + int flag; struct proc *p; { int unit = minor(dev); @@ -488,4 +496,3 @@ flashmmap(dev, off, prot) return (-1); return (m68k_btop(sc->sc_paddr + off)); } - diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c index ed0eb95e9d0..6dc8599c8d2 100644 --- a/sys/arch/mvme68k/dev/if_ie.c +++ b/sys/arch/mvme68k/dev/if_ie.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ie.c,v 1.18 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: if_ie.c,v 1.19 2002/04/27 23:21:05 miod Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. @@ -182,9 +182,9 @@ struct ie_softc { struct arpcom sc_arpcom;/* system arpcom structure */ - void (*reset_596)(); /* card dependent reset function */ - void (*chan_attn)(); /* card dependent attn function */ - void (*run_596)(); /* card depenent "go on-line" function */ + void (*reset_596)(void *); /* card dependent reset function */ + void (*chan_attn)(void *); /* card dependent attn function */ + void (*run_596)(void *); /* card dependent "go on-line" func */ void (*memcopy)(const void *, void *, u_int); /* card dependent memory copy function */ void (*memzero)(void *, u_int); @@ -241,9 +241,9 @@ struct ie_softc { #endif }; -static void ie_obreset(struct ie_softc *); -static void ie_obattend(struct ie_softc *); -static void ie_obrun(struct ie_softc *); +void ie_obreset(void *); +void ie_obattend(void *); +void ie_obrun(void *); void iewatchdog(struct ifnet *); int ieintr(void *); @@ -252,17 +252,29 @@ int ieinit(struct ie_softc *); int ieioctl(struct ifnet *, u_long, caddr_t); void iestart(struct ifnet *); void iereset(struct ie_softc *); -static void ie_readframe(struct ie_softc *, int); -static void ie_drop_packet_buffer(struct ie_softc *); -static int command_and_wait(struct ie_softc *, int, +void ie_readframe(struct ie_softc *, int); +void ie_drop_packet_buffer(struct ie_softc *); +int command_and_wait(struct ie_softc *, int, void volatile *, int); -/*static*/ void ierint(struct ie_softc *); -/*static*/ void ietint(struct ie_softc *); -static int ieget(struct ie_softc *, struct mbuf **, +void ierint(struct ie_softc *); +void ietint(struct ie_softc *); +int ieget(struct ie_softc *, struct mbuf **, struct ether_header *, int *); -static void setup_bufs(struct ie_softc *); -static int mc_setup(struct ie_softc *, void *); -static void mc_reset(struct ie_softc *); +void setup_bufs(struct ie_softc *); +int mc_setup(struct ie_softc *, void *); +void mc_reset(struct ie_softc *); + +void ie_setup_config(volatile struct ie_config_cmd *, int, int); +void ie_ack(struct ie_softc *, u_int); +int ether_equal(u_char *, u_char *); +int check_eh(struct ie_softc *, struct ether_header *, int *); +int ie_buflen(struct ie_softc *, int); +int ie_packet_len(struct ie_softc *); +void iexmit(struct ie_softc *); +int ieget(struct ie_softc *, struct mbuf **, struct ether_header *, int *); +int ie_setupram(struct ie_softc *); +void run_tdr(struct ie_softc *, struct ie_tdr_cmd *); +void iestop(struct ie_softc *); #ifdef IEDEBUG void print_rbd(volatile struct ie_recv_buf_desc *); @@ -271,8 +283,8 @@ int in_ierint = 0; int in_ietint = 0; #endif -int iematch(); -void ieattach(); +int iematch(struct device *, void *, void *); +void ieattach(struct device *, struct device *, void *); struct cfattach ie_ca = { sizeof(struct ie_softc), iematch, ieattach @@ -303,7 +315,7 @@ struct cfdriver ie_cd = { * Here are a few useful functions. We could have done these as macros, but * since we have the inline facility, it makes sense to use that instead. */ -static inline void +void ie_setup_config(cmd, promiscuous, manchester) volatile struct ie_config_cmd *cmd; int promiscuous, manchester; @@ -325,7 +337,7 @@ ie_setup_config(cmd, promiscuous, manchester) cmd->ie_miabf = 0x3f; } -static inline void +void ie_ack(sc, mask) struct ie_softc *sc; u_int mask; @@ -340,18 +352,19 @@ iematch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; - return (!badvaddr(ca->ca_vaddr, 4)); + + return (!badvaddr((vaddr_t)ca->ca_vaddr, 4)); } /* * Deep Magic: reset it, then set SCP address again. Pray. */ void -ie_obreset(sc) - struct ie_softc *sc; +ie_obreset(arg) + void *arg; { + struct ie_softc *sc = (struct ie_softc *)arg; volatile struct ieob *ieo = (struct ieob *) sc->sc_reg; volatile int t; u_long a; @@ -371,17 +384,19 @@ ie_obreset(sc) } void -ie_obattend(sc) - struct ie_softc *sc; +ie_obattend(arg) + void *arg; { + struct ie_softc *sc = (struct ie_softc *)arg; volatile struct ieob *ieo = (struct ieob *) sc->sc_reg; ieo->attn = 1; } +/* ARGSUSED */ void -ie_obrun(sc) - struct ie_softc *sc; +ie_obrun(arg) + void *arg; { } @@ -397,7 +412,6 @@ ieattach(parent, self, aux) struct confargs *ca = aux; struct ifnet *ifp = &sc->sc_arpcom.ac_if; extern void myetheraddr(u_char *); /* should be elsewhere */ - register struct bootpath *bp; int pri = ca->ca_ipl; volatile struct ieob *ieo; paddr_t pa; @@ -737,7 +751,7 @@ ietint(sc) * Compare two Ether/802 addresses for equality, inlined and unrolled for * speed. I'd love to have an inline assembler version of this... */ -static inline int +int ether_equal(one, two) u_char *one, *two; { @@ -760,7 +774,7 @@ ether_equal(one, two) * only client which will fiddle with IFF_PROMISC is BPF. This is * probably a good assumption, but we do not make it here. (Yet.) */ -static inline int +int check_eh(sc, eh, to_bpf) struct ie_softc *sc; struct ether_header *eh; @@ -869,7 +883,7 @@ check_eh(sc, eh, to_bpf) * IE_RBUF_SIZE is an even power of two. If somehow the act_len exceeds * the size of the buffer, then we are screwed anyway. */ -static inline int +int ie_buflen(sc, head) struct ie_softc *sc; int head; @@ -878,7 +892,7 @@ ie_buflen(sc, head) return (sc->rbuffs[head]->ie_rbd_actual & (IE_RBUF_SIZE | (IE_RBUF_SIZE - 1))); } -static inline int +int ie_packet_len(sc) struct ie_softc *sc; { @@ -911,7 +925,7 @@ ie_packet_len(sc) * command to the chip to be executed. On the way, if we have a BPF listener * also give him a copy. */ -inline static void +void iexmit(sc) struct ie_softc *sc; { @@ -966,7 +980,7 @@ sc->xmit_cbuffs[sc->xctail]); * chain of partially-full mbufs. This should help to speed up the * operation considerably. (Provided that it works, of course.) */ -static inline int +int ieget(sc, mp, ehp, to_bpf) struct ie_softc *sc; struct mbuf **mp; @@ -1142,7 +1156,7 @@ ieget(sc, mp, ehp, to_bpf) * on confusing code to deal with them. Hopefully, this machine will never ARP * for trailers anyway. */ -static void +void ie_readframe(sc, num) struct ie_softc *sc; int num; /* frame number to read */ @@ -1232,7 +1246,7 @@ ie_readframe(sc, num) ether_input(&sc->sc_arpcom.ac_if, &eh, m); } -static void +void ie_drop_packet_buffer(sc) struct ie_softc *sc; { @@ -1393,16 +1407,18 @@ iereset(sc) splx(s); } +#if 0 /* * This is called if we time out. */ -static void +void chan_attn_timeout(rock) caddr_t rock; { *(int *)rock = 1; } +#endif /* * Send a command to the controller and wait for it to either complete @@ -1413,7 +1429,7 @@ chan_attn_timeout(rock) * ((volatile struct ie_cmd_common *)pcmd)->ie_cmd_status & MASK * to become true. */ -static int +int command_and_wait(sc, cmd, pcmd, mask) struct ie_softc *sc; int cmd; @@ -1480,7 +1496,7 @@ command_and_wait(sc, cmd, pcmd, mask) /* * Run the time-domain reflectometer. */ -static void +void run_tdr(sc, cmd) struct ie_softc *sc; struct ie_tdr_cmd *cmd; @@ -1526,15 +1542,7 @@ run_tdr(sc, cmd) #define ALLOC(p, n) _ALLOC(p, ALIGN(n)) /* XXX convert to this? */ #endif -static inline caddr_t -Align(ptr) - caddr_t ptr; -{ - u_long l = (u_long)ptr; - - l = (l + 3) & ~3L; - return (caddr_t)l; -} +#define Align(ptr) ((caddr_t)(((u_long)(ptr) + 3) & ~3L)) /* * setup_bufs: set up the buffers @@ -1549,13 +1557,11 @@ Align(ptr) * note: this function was written to be easy to understand, rather than * highly efficient (it isn't in the critical path). */ -static void +void setup_bufs(sc) struct ie_softc *sc; { caddr_t ptr = sc->buf_area; /* memory pool */ - volatile struct ie_recv_frame_desc *rfd = (void *) ptr; - volatile struct ie_recv_buf_desc *rbd; int n, r; /* @@ -1680,7 +1686,7 @@ setup_bufs(sc) * Run the multicast setup command. * Called at splnet(). */ -static int +int mc_setup(sc, ptr) struct ie_softc *sc; void *ptr; @@ -1720,7 +1726,6 @@ ieinit(sc) { volatile struct ie_sys_ctl_block *scb = sc->scb; void *ptr; - int n; ptr = sc->buf_area; @@ -1808,7 +1813,7 @@ ieinit(sc) return 0; } -static void +void iestop(sc) struct ie_softc *sc; { @@ -1908,7 +1913,7 @@ ieioctl(ifp, cmd, data) return error; } -static void +void mc_reset(sc) struct ie_softc *sc; { @@ -1948,4 +1953,3 @@ print_rbd(rbd) rbd->mbz); } #endif - diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c index 222888e9662..f32b941ac18 100644 --- a/sys/arch/mvme68k/dev/if_le.c +++ b/sys/arch/mvme68k/dev/if_le.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_le.c,v 1.17 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: if_le.c,v 1.18 2002/04/27 23:21:05 miod Exp $ */ /*- * Copyright (c) 1982, 1992, 1993 @@ -80,25 +80,29 @@ struct cfattach le_ca = { static int lebustype; -hide void lewrcsr(struct am7990_softc *, u_int16_t, u_int16_t); -hide u_int16_t lerdcsr(struct am7990_softc *, u_int16_t); -hide void vlewrcsr(struct am7990_softc *, u_int16_t, u_int16_t); -hide u_int16_t vlerdcsr(struct am7990_softc *, u_int16_t); +void lewrcsr(struct am7990_softc *, u_int16_t, u_int16_t); +u_int16_t lerdcsr(struct am7990_softc *, u_int16_t); +void vlewrcsr(struct am7990_softc *, u_int16_t, u_int16_t); +u_int16_t vlerdcsr(struct am7990_softc *, u_int16_t); +void nvram_cmd(struct am7990_softc *, u_char, u_short); +u_int16_t nvram_read(struct am7990_softc *, u_char); +void vleetheraddr(struct am7990_softc *); +void vleinit(struct am7990_softc *); +void vlereset(struct am7990_softc *); +int vle_intr(void *); +void vle_copytobuf_contig(struct am7990_softc *, void *, int, int); +void vle_zerobuf_contig(struct am7990_softc *, int, int); /* send command to the nvram controller */ -nvram_cmd(sc, cmd, addr ) -struct am7990_softc *sc; -u_char cmd; -u_short addr; +void +nvram_cmd(sc, cmd, addr) + struct am7990_softc *sc; + u_char cmd; + u_short addr; { int i; - u_char rcmd = 0; - u_char rcmd2= 0; struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; - rcmd = addr; - rcmd = rcmd << 3; - rcmd |= cmd; for (i=0;i<8;i++) { reg1->ler1_ear=((cmd|(addr<<1))>>i); CDELAY; @@ -108,13 +112,12 @@ u_short addr; /* read nvram one bit at a time */ u_int16_t nvram_read(sc, nvram_addr) -struct am7990_softc *sc; -u_char nvram_addr; + struct am7990_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; struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; ((struct le_softc *)sc)->csr = 0x4f; ENABLE_NVRAM; @@ -136,7 +139,7 @@ u_char nvram_addr; void vleetheraddr(sc) -struct am7990_softc *sc; + struct am7990_softc *sc; { u_char * cp = sc->sc_arpcom.ac_enaddr; u_int16_t ival[3]; @@ -148,10 +151,10 @@ struct am7990_softc *sc; memcpy(cp, &ival[0], 6); } -hide void +void lewrcsr(sc, port, val) -struct am7990_softc *sc; -u_int16_t port, val; + struct am7990_softc *sc; + u_int16_t port, val; { register struct lereg1 *ler1 = (struct lereg1 *)((struct le_softc *)sc)->sc_r1; @@ -159,10 +162,10 @@ u_int16_t port, val; ler1->ler1_rdp = val; } -hide void +void vlewrcsr(sc, port, val) -struct am7990_softc *sc; -u_int16_t port, val; + struct am7990_softc *sc; + u_int16_t port, val; { register struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; @@ -170,10 +173,10 @@ u_int16_t port, val; ler1->ler1_rdp = val; } -hide u_int16_t +u_int16_t lerdcsr(sc, port) -struct am7990_softc *sc; -u_int16_t port; + struct am7990_softc *sc; + u_int16_t port; { register struct lereg1 *ler1 = (struct lereg1 *)((struct le_softc *)sc)->sc_r1; u_int16_t val; @@ -183,10 +186,10 @@ u_int16_t port; return (val); } -hide u_int16_t +u_int16_t vlerdcsr(sc, port) -struct am7990_softc *sc; -u_int16_t port; + struct am7990_softc *sc; + u_int16_t port; { register struct vlereg1 *ler1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; u_int16_t val; @@ -199,7 +202,7 @@ u_int16_t port; /* init MVME376, set ipl and vec */ void vleinit(sc) -struct am7990_softc *sc; + struct am7990_softc *sc; { register struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; u_char vec = ((struct le_softc *)sc)->sc_vec; @@ -213,7 +216,7 @@ struct am7990_softc *sc; /* MVME376 hardware reset */ void vlereset(sc) -struct am7990_softc *sc; + struct am7990_softc *sc; { register struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; RESET_HW; @@ -226,7 +229,7 @@ struct am7990_softc *sc; int vle_intr(sc) -register void *sc; + void *sc; { register struct vlereg1 *reg1 = (struct vlereg1 *)((struct le_softc *)sc)->sc_r1; int rc; @@ -237,9 +240,9 @@ register void *sc; void vle_copytobuf_contig(sc, from, boff, len) -struct am7990_softc *sc; -void *from; -int boff, len; + struct am7990_softc *sc; + void *from; + int boff, len; { volatile caddr_t buf = sc->sc_mem; @@ -255,8 +258,8 @@ int boff, len; void vle_zerobuf_contig(sc, boff, len) -struct am7990_softc *sc; -int boff, len; + struct am7990_softc *sc; + int boff, len; { volatile caddr_t buf = sc->sc_mem; /* @@ -271,16 +274,15 @@ int boff, len; int lematch(parent, vcf, args) -struct device *parent; -void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; /* check physical addr for bogus MVME162 addr @0xffffd200. wierd XXX - smurph */ if (cputyp == CPU_162 && ca->ca_paddr == (void *)0xffffd200) return (0); - return (!badvaddr(ca->ca_vaddr, 2)); + return (!badvaddr((vaddr_t)ca->ca_vaddr, 2)); } /* @@ -290,14 +292,13 @@ void *vcf, *args; */ void leattach(parent, self, aux) -struct device *parent; -struct device *self; -void *aux; + struct device *parent; + struct device *self; + void *aux; { register struct le_softc *lesc = (struct le_softc *)self; struct am7990_softc *sc = &lesc->sc_am7990; struct confargs *ca = aux; - register int a; int pri = ca->ca_ipl; extern void *etherbuf; caddr_t addr; @@ -344,7 +345,7 @@ void *aux; lesc->sc_vec = ca->ca_vec; sc->sc_memsize = VLEMEMSIZE; sc->sc_conf3 = LE_C3_BSWP; - sc->sc_addr = kvtop(sc->sc_mem); + sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); sc->sc_hwreset = vlereset; sc->sc_rdcsr = vlerdcsr; sc->sc_wrcsr = vlewrcsr; @@ -361,7 +362,7 @@ void *aux; sc->sc_mem = etherbuf; lesc->sc_r1 = (void *)ca->ca_vaddr; sc->sc_conf3 = LE_C3_BSWP /*| LE_C3_ACON | LE_C3_BCON*/; - sc->sc_addr = kvtop(sc->sc_mem); + sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); sc->sc_memsize = LEMEMSIZE; sc->sc_rdcsr = lerdcsr; sc->sc_wrcsr = lewrcsr; @@ -407,6 +408,3 @@ void *aux; #endif } } - - - diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c index a1ce3ab839d..d95f397ac21 100644 --- a/sys/arch/mvme68k/dev/ipic.c +++ b/sys/arch/mvme68k/dev/ipic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipic.c,v 1.8 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: ipic.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -43,13 +43,20 @@ #include <sys/syslog.h> #include <sys/fcntl.h> #include <sys/device.h> + #include <machine/autoconf.h> #include <machine/cpu.h> + #include <mvme68k/dev/ipicreg.h> #include <mvme68k/dev/mcreg.h> -void ipicattach(struct device *, struct device *, void *); -int ipicmatch(struct device *, void *, void *); +void ipicattach(struct device *, struct device *, void *); +int ipicmatch(struct device *, void *, void *); + +int ipicprint(void *, const char *); +int ipicscan(struct device *, void *, void *); +caddr_t ipicmap(struct ipicsoftc *, caddr_t, int); +void ipicunmap(struct ipicsoftc *, caddr_t, int); struct cfattach ipic_ca = { sizeof(struct ipicsoftc), ipicmatch, ipicattach @@ -68,7 +75,7 @@ ipicmatch(parent, cf, args) struct confargs *ca = args; struct ipicreg *ipic = (struct ipicreg *)ca->ca_vaddr; - if (badvaddr(ipic, 1) || ipic->ipic_chipid != IPIC_CHIPID) + if (badvaddr((vaddr_t)ipic, 1) || ipic->ipic_chipid != IPIC_CHIPID) return (0); return (1); } @@ -95,7 +102,6 @@ ipicscan(parent, child, args) { struct cfdata *cf = child; struct ipicsoftc *sc = (struct ipicsoftc *)parent; - register struct confargs *ca = args; struct confargs oca; int slot, n = 0; caddr_t ipv, ipp; @@ -112,7 +118,7 @@ ipicscan(parent, child, args) /* XXX can we determing IPIC_IPSPACE automatically? */ for (slot = 0; slot < sc->sc_nip; slot++) { ipp = sc->sc_ipspace + (slot * IPIC_IP_MODSIZE); - if (badpaddr(ipp + IPIC_IP_IDOFFSET, 2)) + if (badpaddr((paddr_t)ipp + IPIC_IP_IDOFFSET, 2)) continue; ipv = mapiodev(ipp, NBPG); diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h index 10a4e127d02..06cbdda8be0 100644 --- a/sys/arch/mvme68k/dev/ipicreg.h +++ b/sys/arch/mvme68k/dev/ipicreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ipicreg.h,v 1.3 1996/04/28 11:03:23 deraadt Exp $ */ +/* $OpenBSD: ipicreg.h,v 1.4 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -113,3 +113,5 @@ struct ipicsoftc { caddr_t sc_ipspace; int sc_nip; }; + +int ipicintr_establish(int, struct intrhand *); diff --git a/sys/arch/mvme68k/dev/lp.c b/sys/arch/mvme68k/dev/lp.c index f3970a0449d..7a8438173df 100644 --- a/sys/arch/mvme68k/dev/lp.c +++ b/sys/arch/mvme68k/dev/lp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lp.c,v 1.5 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: lp.c,v 1.6 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -32,7 +32,6 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/proc.h> #include <sys/user.h> @@ -43,8 +42,11 @@ #include <sys/syslog.h> #include <sys/fcntl.h> #include <sys/device.h> + #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/cpu.h> + #include <mvme68k/dev/pccreg.h> struct lpsoftc { @@ -102,16 +104,15 @@ int lpintr(dev) void *dev; { - struct lpsoftc *sc = dev; - return (0); } /*ARGSUSED*/ int -lpopen(dev, flag, mode) +lpopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -119,9 +120,10 @@ lpopen(dev, flag, mode) /*ARGSUSED*/ int -lpclose(dev, flag, mode) +lpclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -134,8 +136,10 @@ lpwrite(dev, uio, flags) struct uio *uio; int flags; { + return (EOPNOTSUPP); } +int lpioctl(dev, cmd, data, flag, p) dev_t dev; u_long cmd; @@ -143,5 +147,6 @@ lpioctl(dev, cmd, data, flag, p) int flag; struct proc *p; { + return (EOPNOTSUPP); } diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c index 7807912a998..6a1a1fdb45e 100644 --- a/sys/arch/mvme68k/dev/mc.c +++ b/sys/arch/mvme68k/dev/mc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mc.c,v 1.9 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: mc.c,v 1.10 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -62,7 +62,9 @@ struct mcsoftc { void mcattach(struct device *, struct device *, void *); int mcmatch(struct device *, void *, void *); -int mcabort(struct frame *); +int mcabort(void *); +int mc_print(void *, const char *); +int mc_scan(struct device *, void *, void *); struct cfattach mc_ca = { sizeof(struct mcsoftc), mcmatch, mcattach @@ -79,12 +81,11 @@ mcmatch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; struct mcreg *mc = (struct mcreg *)(IIOV(ca->ca_paddr) + MC_MCCHIP_OFF); - if ((cputyp != CPU_172 && cputyp != CPU_162) || badvaddr(mc, 1) || - mc->mc_chipid != MC_CHIPID) + if ((cputyp != CPU_172 && cputyp != CPU_162) || + badvaddr((vaddr_t)mc, 1) || mc->mc_chipid != MC_CHIPID) return (0); return (1); } @@ -110,7 +111,6 @@ mc_scan(parent, child, args) { struct cfdata *cf = child; struct mcsoftc *sc = (struct mcsoftc *)parent; - struct confargs *ca = args; struct confargs oca; if (parent->dv_cfdata->cf_driver->cd_indirect) { @@ -144,7 +144,6 @@ mcattach(parent, self, args) { struct confargs *ca = args; struct mcsoftc *sc = (struct mcsoftc *)self; - int i; if (sys_mc) panic("mc already attached!"); @@ -161,7 +160,6 @@ mcattach(parent, self, args) printf(": rev %d\n", sc->sc_mc->mc_chiprev); sc->sc_nmiih.ih_fn = mcabort; - sc->sc_nmiih.ih_arg = 0; sc->sc_nmiih.ih_ipl = 7; sc->sc_nmiih.ih_wantframe = 1; mcintr_establish(MCV_ABORT, &sc->sc_nmiih); @@ -191,7 +189,7 @@ mcintr_establish(vec, ih) int mcabort(frame) - struct frame *frame; + void *frame; { /* wait for it to debounce */ while (sys_mc->mc_abortirq & MC_ABORT_ABS) diff --git a/sys/arch/mvme68k/dev/mcreg.h b/sys/arch/mvme68k/dev/mcreg.h index d8dfb341833..df4625d93c3 100644 --- a/sys/arch/mvme68k/dev/mcreg.h +++ b/sys/arch/mvme68k/dev/mcreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mcreg.h,v 1.6 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: mcreg.h,v 1.7 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -174,3 +174,4 @@ void mc_enableflashwrite(int on); #define MC_DISFLASHWRITE_OFFSET 0xc8000 int mc_hasflash(void); +int mcintr_establish(int, struct intrhand *); diff --git a/sys/arch/mvme68k/dev/memc.c b/sys/arch/mvme68k/dev/memc.c index f4435780c3c..3a57dfb797b 100644 --- a/sys/arch/mvme68k/dev/memc.c +++ b/sys/arch/mvme68k/dev/memc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memc.c,v 1.6 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: memc.c,v 1.7 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -79,11 +79,10 @@ memcmatch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; struct memcreg *memc = (struct memcreg *)ca->ca_vaddr; - if (badvaddr(memc, 1)) + if (badvaddr((vaddr_t)memc, 1)) return (0); if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID) return (1); @@ -110,7 +109,6 @@ memcattach(parent, self, args) #if 0 sc->sc_ih.ih_fn = memcintr; - sc->sc_ih.ih_arg = 0; sc->sc_ih.ih_ipl = 7; sc->sc_ih.ih_wantframe = 1; mcintr_establish(xxx, &sc->sc_ih); diff --git a/sys/arch/mvme68k/dev/memdevs.c b/sys/arch/mvme68k/dev/memdevs.c index 32242ca083b..4bdf9443b2a 100644 --- a/sys/arch/mvme68k/dev/memdevs.c +++ b/sys/arch/mvme68k/dev/memdevs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memdevs.c,v 1.3 1996/04/28 11:03:25 deraadt Exp $ */ +/* $OpenBSD: memdevs.c,v 1.4 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -37,10 +37,12 @@ #include <sys/systm.h> #include <sys/uio.h> #include <sys/malloc.h> - #include <sys/device.h> -#include <machine/cpu.h> + #include <machine/autoconf.h> +#include <machine/cpu.h> + +#include <mvme68k/dev/memdevs.h> /*ARGSUSED*/ int @@ -50,9 +52,9 @@ memdevrw(base, len, uio, flags) struct uio *uio; int flags; { - register vm_offset_t o, v; - register int c; - register struct iovec *iov; + vaddr_t v; + int c; + struct iovec *iov; int error = 0; while (uio->uio_resid > 0 && error == 0) { diff --git a/sys/arch/mvme68k/dev/memdevs.h b/sys/arch/mvme68k/dev/memdevs.h new file mode 100644 index 00000000000..612c438f45e --- /dev/null +++ b/sys/arch/mvme68k/dev/memdevs.h @@ -0,0 +1,30 @@ +/* $OpenBSD: memdevs.h,v 1.1 2002/04/27 23:21:05 miod Exp $ */ +/* + * Copyright (c) 2002, Miodrag Vallat. + * All rights reserved. + * + * Permission to redistribute, use, copy, and modify this software + * without fee is hereby granted, provided that the following + * conditions are met: + * + * 1. This entire notice is included in all source code copies of any + * software which is or includes a copy or modification of this + * software. + * 2. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +extern int memdevrw(caddr_t, int, struct uio *, int); diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c index 82f0bbdd007..4d4fdb6a148 100644 --- a/sys/arch/mvme68k/dev/nvram.c +++ b/sys/arch/mvme68k/dev/nvram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvram.c,v 1.9 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: nvram.c,v 1.10 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -37,13 +37,18 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/kernel.h> #include <sys/ioctl.h> #include <sys/device.h> -#include <machine/psl.h> + #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/cpu.h> #include <machine/mioctl.h> +#include <machine/psl.h> + +#include <mvme68k/dev/memdevs.h> #include <mvme68k/dev/nvramreg.h> #if defined(GPROF) @@ -71,21 +76,20 @@ struct cfdriver nvram_cd = { int nvrammatch(parent, vcf, args) -struct device *parent; -void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; /*X*/ if (ca->ca_vaddr == (void *)-1) /*X*/ return (1); - return (!badvaddr(ca->ca_vaddr, 1)); + return (!badvaddr((vaddr_t)ca->ca_vaddr, 1)); } void nvramattach(parent, self, args) -struct device *parent, *self; -void *args; + struct device *parent, *self; + void *args; { struct confargs *ca = args; struct nvramsoftc *sc = (struct nvramsoftc *)self; @@ -100,7 +104,7 @@ void *args; /*X*/ if (sc->sc_vaddr == (void *)-1) /*X*/ sc->sc_vaddr = mapiodev((void *)sc->sc_paddr, -/*X*/ max(sc->sc_len, NBPG)); +/*X*/ MAX(sc->sc_len, NBPG)); /*X*/ if (sc->sc_vaddr == NULL) /*X*/ panic("failed to map!"); @@ -122,13 +126,12 @@ void *args; */ void microtime(tvp) -register struct timeval *tvp; + register struct timeval *tvp; { int s = splhigh(); static struct timeval lasttime; *tvp = time; - tvp->tv_usec; while (tvp->tv_usec >= 1000000) { tvp->tv_sec++; tvp->tv_usec -= 1000000; @@ -160,9 +163,22 @@ register struct timeval *tvp; const short dayyr[12] = { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; -static u_long +struct chiptime { + int sec; + int min; + int hour; + int wday; + int day; + int mon; + int year; +}; + +u_long chiptotime(int, int, int, int, int, int); +void timetochip(struct chiptime *); + +u_long chiptotime(sec, min, hour, day, mon, year) -register int sec, min, hour, day, mon, year; + register int sec, min, hour, day, mon, year; { register int days, yr; @@ -197,20 +213,11 @@ register int sec, min, hour, day, mon, year; return (days * SECDAY + hour * 3600 + min * 60 + sec); } -struct chiptime { - int sec; - int min; - int hour; - int wday; - int day; - int mon; - int year; -}; - +void timetochip(c) -register struct chiptime *c; + struct chiptime *c; { - register int t, t2, t3, now = time.tv_sec; + int t, t2, t3, now = time.tv_sec; /* January 1 1970 was a Thursday (4 in unix wdays) */ /* compute the days since the epoch */ @@ -258,8 +265,9 @@ register struct chiptime *c; /* * Set up the system's time, given a `reasonable' time value. */ +void inittodr(base) -time_t base; + time_t base; { struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0]; register struct clockreg *cl = sc->sc_regs; @@ -313,6 +321,7 @@ time_t base; * and when rebooting. Do nothing if the time is not yet known, e.g., * when crashing during autoconfig. */ +void resettodr() { struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[0]; @@ -335,9 +344,10 @@ resettodr() /*ARGSUSED*/ int -nvramopen(dev, flag, mode) -dev_t dev; -int flag, mode; +nvramopen(dev, flag, mode, p) + dev_t dev; + int flag, mode; + struct proc *p; { if (minor(dev) >= nvram_cd.cd_ndevs || nvram_cd.cd_devs[minor(dev)] == NULL) @@ -347,9 +357,10 @@ int flag, mode; /*ARGSUSED*/ int -nvramclose(dev, flag, mode) -dev_t dev; -int flag, mode; +nvramclose(dev, flag, mode, p) + dev_t dev; + int flag, mode; + struct proc *p; { return (0); @@ -358,10 +369,11 @@ int flag, mode; /*ARGSUSED*/ int nvramioctl(dev, cmd, data, flag, p) -dev_t dev; -caddr_t data; -int cmd, flag; -struct proc *p; + dev_t dev; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; { int unit = minor(dev); struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit]; @@ -381,9 +393,9 @@ struct proc *p; /*ARGSUSED*/ int nvramread(dev, uio, flags) -dev_t dev; -struct uio *uio; -int flags; + dev_t dev; + struct uio *uio; + int flags; { int unit = minor(dev); struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit]; @@ -394,9 +406,9 @@ int flags; /*ARGSUSED*/ int nvramwrite(dev, uio, flags) -dev_t dev; -struct uio *uio; -int flags; + dev_t dev; + struct uio *uio; + int flags; { int unit = minor(dev); struct nvramsoftc *sc = (struct nvramsoftc *) nvram_cd.cd_devs[unit]; diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c index 1f0d6411588..3bacda34bf2 100644 --- a/sys/arch/mvme68k/dev/pcc.c +++ b/sys/arch/mvme68k/dev/pcc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcc.c,v 1.8 2002/04/21 23:44:29 miod Exp $ */ +/* $OpenBSD: pcc.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -62,7 +62,9 @@ struct pccsoftc { void pccattach(struct device *, struct device *, void *); int pccmatch(struct device *, void *, void *); -int pccabort(struct frame *); +int pccabort(void *); +int pcc_print(void *, const char *); +int pcc_scan(struct device *, void *, void *); struct cfattach pcc_ca = { sizeof(struct pccsoftc), pccmatch, pccattach @@ -79,7 +81,6 @@ pccmatch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; /* the pcc only exist on vme147's */ @@ -109,7 +110,6 @@ pcc_scan(parent, child, args) { struct cfdata *cf = child; struct pccsoftc *sc = (struct pccsoftc *)parent; - struct confargs *ca = args; struct confargs oca; if (parent->dv_cfdata->cf_driver->cd_indirect) { @@ -143,7 +143,6 @@ pccattach(parent, self, args) { struct confargs *ca = args; struct pccsoftc *sc = (struct pccsoftc *)self; - int i; if (sys_pcc) panic("pcc already attached!"); @@ -160,7 +159,6 @@ pccattach(parent, self, args) printf(": rev %d\n", sc->sc_pcc->pcc_chiprev); sc->sc_nmiih.ih_fn = pccabort; - sc->sc_nmiih.ih_arg = 0; sc->sc_nmiih.ih_ipl = 7; sc->sc_nmiih.ih_wantframe = 1; pccintr_establish(PCCV_ABORT, &sc->sc_nmiih); @@ -191,7 +189,7 @@ pccintr_establish(vec, ih) int pccabort(frame) - struct frame *frame; + void *frame; { #if 0 /* XXX wait for it to debounce -- there is something wrong here */ @@ -213,15 +211,13 @@ pccspeed(pcc) volatile int cnt; int speed; - /*printf("counting...lim = %d\n", lim);*/ - pcc->pcc_t1irq = 0; /* just in case */ pcc->pcc_t1pload = 0; pcc->pcc_t1ctl = PCC_TIMERCLEAR; pcc->pcc_t1ctl = PCC_TIMERSTART; cnt = 0; - while (1) { + for (;;) { tmp = pcc->pcc_t1count; if (tmp > lim) break; diff --git a/sys/arch/mvme68k/dev/pccreg.h b/sys/arch/mvme68k/dev/pccreg.h index b434cea7032..8e7badc3030 100644 --- a/sys/arch/mvme68k/dev/pccreg.h +++ b/sys/arch/mvme68k/dev/pccreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pccreg.h,v 1.4 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: pccreg.h,v 1.5 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -154,5 +154,6 @@ extern struct pccreg *sys_pcc; /* XXX */ int pccintr_establish(int vec, struct intrhand *ih); +int pccspeed(struct pccreg *); #define PCC_GENCTL_IEN 0x10 diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c index 0b498bfcf7b..11502d78cea 100644 --- a/sys/arch/mvme68k/dev/pcctwo.c +++ b/sys/arch/mvme68k/dev/pcctwo.c @@ -1,5 +1,5 @@ -/* $OpenBSD: pcctwo.c,v 1.8 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: pcctwo.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -62,6 +62,8 @@ struct pcctwosoftc { void pcctwoattach(struct device *, struct device *, void *); int pcctwomatch(struct device *, void *, void *); +int pcctwo_print(void *, const char *); +int pcctwo_scan(struct device *, void *, void *); struct cfattach pcctwo_ca = { sizeof(struct pcctwosoftc), pcctwomatch, pcctwoattach @@ -78,7 +80,6 @@ pcctwomatch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; struct pcctworeg *pcc2; @@ -86,7 +87,7 @@ pcctwomatch(parent, vcf, args) if (cputyp == CPU_162 || cputyp == CPU_147 || cputyp == CPU_172) return (0); pcc2 = (struct pcctworeg *)(IIOV(ca->ca_paddr) + PCC2_PCC2CHIP_OFF); - if (badvaddr(pcc2, 1) || pcc2->pcc2_chipid != PCC2_CHIPID) + if (badvaddr((vaddr_t)pcc2, 1) || pcc2->pcc2_chipid != PCC2_CHIPID) return (0); return (1); } @@ -112,7 +113,6 @@ pcctwo_scan(parent, child, args) { struct cfdata *cf = child; struct pcctwosoftc *sc = (struct pcctwosoftc *)parent; - struct confargs *ca = args; struct confargs oca; if (parent->dv_cfdata->cf_driver->cd_indirect) { @@ -146,7 +146,6 @@ pcctwoattach(parent, self, args) { struct confargs *ca = args; struct pcctwosoftc *sc = (struct pcctwosoftc *)self; - int i; if (sys_pcc2) panic("pcc2 already attached!"); diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h index f7dc63d28e0..172acf4d582 100644 --- a/sys/arch/mvme68k/dev/pcctworeg.h +++ b/sys/arch/mvme68k/dev/pcctworeg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcctworeg.h,v 1.3 1996/04/28 11:03:28 deraadt Exp $ */ +/* $OpenBSD: pcctworeg.h,v 1.4 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -149,3 +149,5 @@ extern struct pcctworeg *sys_pcc2; #define PCC2_SC_SNOOP (1 << 6) #define PCC2_SC_INVAL (2 << 6) #define PCC2_SC_RESV (3 << 6) + +int pcctwointr_establish(int, struct intrhand *); diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c index 4845d9173b2..5a30ca3e007 100644 --- a/sys/arch/mvme68k/dev/sbic.c +++ b/sys/arch/mvme68k/dev/sbic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sbic.c,v 1.10 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: sbic.c,v 1.11 2002/04/27 23:21:05 miod Exp $ */ /* $NetBSD: sbic.c,v 1.2 1996/04/23 16:32:54 chuck Exp $ */ /* @@ -89,8 +89,6 @@ */ #define SBIC_WAIT(regs, until, timeo) sbicwait(regs, until, timeo, __LINE__) -extern u_int kvtop(); - int sbicicmd(struct sbic_softc *, void *, int, void *, int); int sbicgo(struct sbic_softc *, struct scsi_xfer *); int sbicdmaok(struct sbic_softc *, struct scsi_xfer *); @@ -113,6 +111,7 @@ void sbic_scsidone(struct sbic_acb *, int); void sbic_sched(struct sbic_softc *); void sbic_save_ptrs(struct sbic_softc *); void sbic_load_ptrs(struct sbic_softc *); +void sbicinit(struct sbic_softc *); /* * Synch xfer parameters, and timing conversions @@ -313,11 +312,11 @@ sbic_load_ptrs(dev) * do kvm to pa mappings */ vaddr = acb->sc_kv.dc_addr; - paddr = acb->sc_pa.dc_addr = (char *) kvtop(vaddr); + paddr = acb->sc_pa.dc_addr = (char *)kvtop((vaddr_t)vaddr); for (count = (NBPG - ((int)vaddr & PGOFSET)); count < acb->sc_kv.dc_count && - (char *)kvtop(vaddr + count + 4) == paddr + count + 4; + (char *)kvtop((vaddr_t)vaddr + count + 4) == paddr + count + 4; count += NBPG) ; /* Do nothing */ @@ -406,7 +405,7 @@ sbic_scsicmd(xs) acb->clen = xs->cmdlen; acb->sc_kv.dc_addr = xs->data; acb->sc_kv.dc_count = xs->datalen; - acb->pa_addr = xs->data ? (char *)kvtop(xs->data) : 0; + acb->pa_addr = xs->data ? (char *)kvtop((vaddr_t)xs->data) : 0; bcopy(xs->cmd, &acb->cmd, xs->cmdlen); if ( flags & SCSI_POLL ) { @@ -599,7 +598,7 @@ sbic_scsidone(acb, stat) acb->clen = sizeof(*ss); acb->sc_kv.dc_addr = (char *)&xs->sense; acb->sc_kv.dc_count = sizeof(struct scsi_sense_data); - acb->pa_addr = (char *)kvtop(&xs->sense); /* XXX check */ + acb->pa_addr = (char *)kvtop((vaddr_t)&xs->sense); /* XXX check */ acb->flags = ACB_ACTIVE | ACB_CHKSENSE | ACB_DATAIN; TAILQ_INSERT_HEAD(&dev->ready_list, acb, chain); @@ -1609,9 +1608,9 @@ sbicgo(dev, xs) addr = acb->sc_kv.dc_addr; count = acb->sc_kv.dc_count; - if ( count && ((char *)kvtop(addr) != acb->sc_pa.dc_addr) ) { + if ( count && ((char *)kvtop((vaddr_t)addr) != acb->sc_pa.dc_addr) ) { printf("sbic: DMA buffer mapping changed %x->%x\n", - acb->sc_pa.dc_addr, kvtop(addr)); + acb->sc_pa.dc_addr, kvtop((vaddr_t)addr)); #ifdef DDB Debugger(); #endif @@ -2432,9 +2431,9 @@ sbicnextstate(dev, csr, asr) */ GET_SBIC_csr(regs,csr); - if ( csr == SBIC_CSR_MIS | MESG_IN_PHASE || - csr == SBIC_CSR_MIS_1 | MESG_IN_PHASE || - csr == SBIC_CSR_MIS_2 | MESG_IN_PHASE ) { + if (csr == (SBIC_CSR_MIS | MESG_IN_PHASE) || + csr == (SBIC_CSR_MIS_1 | MESG_IN_PHASE) || + csr == (SBIC_CSR_MIS_2 | MESG_IN_PHASE)) { /* * Yup, gone to message in. Fetch the target LUN */ @@ -2596,7 +2595,7 @@ sbiccheckdmap(bp, len, mask) while ( len ) { - phy_buf = kvtop(buffer); + phy_buf = kvtop((vaddr_t)buffer); phy_len = NBPG - ((int) buffer & PGOFSET); if ( len < phy_len ) diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c index a06cdf4f2b7..85aa2ea2ab0 100644 --- a/sys/arch/mvme68k/dev/sram.c +++ b/sys/arch/mvme68k/dev/sram.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sram.c,v 1.8 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: sram.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -32,18 +32,20 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/buf.h> #include <sys/systm.h> #include <sys/uio.h> #include <sys/malloc.h> - #include <sys/device.h> -#include <machine/cpu.h> + #include <machine/autoconf.h> +#include <machine/conf.h> +#include <machine/cpu.h> #include <machine/mioctl.h> +#include <mvme68k/dev/memdevs.h> + #include "mc.h" #if NMC > 0 @@ -75,14 +77,13 @@ srammatch(parent, vcf, args) struct device *parent; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; if (cputyp == CPU_147) return (0); if (ca->ca_vaddr == (void *)-1) - return (!badpaddr(ca->ca_paddr, 1)); - return (!badvaddr(ca->ca_vaddr, 1)); + return (!badpaddr((paddr_t)ca->ca_paddr, 1)); + return (!badvaddr((vaddr_t)ca->ca_vaddr, 1)); } void @@ -93,7 +94,6 @@ sramattach(parent, self, args) struct confargs *ca = args; struct sramsoftc *sc = (struct sramsoftc *)self; struct mcreg *mc; - int i; switch (cputyp) { #ifdef MVME162 @@ -148,9 +148,10 @@ sramattach(parent, self, args) /*ARGSUSED*/ int -sramopen(dev, flag, mode) +sramopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { if (minor(dev) >= sram_cd.cd_ndevs || sram_cd.cd_devs[minor(dev)] == NULL) @@ -160,9 +161,10 @@ sramopen(dev, flag, mode) /*ARGSUSED*/ int -sramclose(dev, flag, mode) +sramclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -171,9 +173,10 @@ sramclose(dev, flag, mode) /*ARGSUSED*/ int sramioctl(dev, cmd, data, flag, p) - dev_t dev; + dev_t dev; + u_long cmd; caddr_t data; - int cmd, flag; + int flag; struct proc *p; { int unit = minor(dev); diff --git a/sys/arch/mvme68k/dev/ssh.c b/sys/arch/mvme68k/dev/ssh.c index ef574286139..1b835d3e5b7 100644 --- a/sys/arch/mvme68k/dev/ssh.c +++ b/sys/arch/mvme68k/dev/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.2 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: ssh.c,v 1.3 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -50,14 +50,16 @@ #include <sys/dkstat.h> #include <sys/buf.h> #include <sys/malloc.h> + #include <scsi/scsi_all.h> #include <scsi/scsiconf.h> + #include <machine/autoconf.h> +#include <machine/cpu.h> + #include <mvme68k/dev/sshreg.h> #include <mvme68k/dev/sshvar.h> -extern u_int kvtop(); - /* * SCSI delays * In u-seconds, primarily for state changes on the SPC. @@ -75,7 +77,11 @@ void sshsetdelay(int); void ssh_scsidone(struct ssh_acb *, int); void ssh_sched(struct ssh_softc *); int ssh_poll(struct ssh_softc *, struct ssh_acb *); -int sshintr(struct ssh_softc *); +void sshintr(struct ssh_softc *); +void sshinitialize(struct ssh_softc *); +void ssh_start(struct ssh_softc *, int, int, u_char *, int, u_char *, int); +int ssh_checkintr(struct ssh_softc *, u_char, u_char, u_char, int *); +void scsi_period_to_ssh(struct ssh_softc *, int); /* 53C710 script */ const @@ -149,7 +155,7 @@ struct scsi_xfer *xs; struct ssh_acb *acb; struct ssh_softc *sc; struct scsi_link *slp; - int flags, s, i; + int flags, s; slp = xs->sc_link; sc = slp->adapter_softc; @@ -267,7 +273,7 @@ struct ssh_softc *sc; { struct scsi_link *slp; struct ssh_acb *acb; - int stat, i; + int i; #ifdef DEBUG if (sc->sc_nexus) { @@ -320,7 +326,7 @@ int stat; struct scsi_xfer *xs = acb->xs; struct scsi_link *slp = xs->sc_link; struct ssh_softc *sc = slp->adapter_softc; - int s, dosched = 0; + int dosched = 0; #ifdef DIAGNOSTIC if (acb == NULL || xs == NULL) @@ -429,7 +435,9 @@ register struct ssh_softc *sc; ssh_regmap_p rp; char *where; { +#ifdef fix_this int i; +#endif printf ("%s: abort %s: dstat %02x, sstat0 %02x sbcl %02x\n", sc->sc_dev.dv_xname, @@ -476,14 +484,14 @@ char *where; void sshinitialize(sc) -struct ssh_softc *sc; + struct ssh_softc *sc; { /* * Need to check that scripts is on a long word boundary * Also should verify that dev doesn't span non-contiguous * physical pages. */ - sc->sc_scriptspa = kvtop(scripts); + sc->sc_scriptspa = kvtop((vaddr_t)scripts); /* * malloc sc_acb to ensure that DS is on a long word boundary. @@ -591,7 +599,7 @@ struct ssh_softc *sc; sc->sc_nexus->xs->error = XS_DRIVER_STUFFUP; ssh_scsidone(sc->sc_nexus, sc->sc_nexus->stat[0]); } - while (acb = sc->nexus_list.tqh_first) { + while ((acb = sc->nexus_list.tqh_first)) { acb->xs->error = XS_DRIVER_STUFFUP; ssh_scsidone(acb, acb->stat[0]); } @@ -614,16 +622,18 @@ struct ssh_softc *sc; void ssh_start (sc, target, lun, cbuf, clen, buf, len) -struct ssh_softc *sc; -int target; -int lun; -u_char *cbuf; -int clen; -u_char *buf; -int len; + struct ssh_softc *sc; + int target; + int lun; + u_char *cbuf; + int clen; + u_char *buf; + int len; { ssh_regmap_p rp = sc->sc_sshp; +#ifdef DEBUG int i; +#endif int nchain; int count, tcount; char *addr, *dmaend; @@ -650,20 +660,20 @@ int len; acb->msg[0] = -1; acb->ds.scsi_addr = (0x10000 << target) | (sc->sc_sync[target].sxfer << 8); acb->ds.idlen = 1; - acb->ds.idbuf = (char *) kvtop(&acb->msgout[0]); + acb->ds.idbuf = (char *) kvtop((vaddr_t)&acb->msgout[0]); acb->ds.cmdlen = clen; - acb->ds.cmdbuf = (char *) kvtop(cbuf); + acb->ds.cmdbuf = (char *) kvtop((vaddr_t)cbuf); acb->ds.stslen = 1; - acb->ds.stsbuf = (char *) kvtop(&acb->stat[0]); + acb->ds.stsbuf = (char *) kvtop((vaddr_t)&acb->stat[0]); acb->ds.msglen = 1; - acb->ds.msgbuf = (char *) kvtop(&acb->msg[0]); + acb->ds.msgbuf = (char *) kvtop((vaddr_t)&acb->msg[0]); acb->msg[1] = -1; acb->ds.msginlen = 1; acb->ds.extmsglen = 1; acb->ds.synmsglen = 3; - acb->ds.msginbuf = (char *) kvtop(&acb->msg[1]); - acb->ds.extmsgbuf = (char *) kvtop(&acb->msg[2]); - acb->ds.synmsgbuf = (char *) kvtop(&acb->msg[3]); + acb->ds.msginbuf = (char *) kvtop((vaddr_t)&acb->msg[1]); + acb->ds.extmsgbuf = (char *) kvtop((vaddr_t)&acb->msg[2]); + acb->ds.synmsgbuf = (char *) kvtop((vaddr_t)&acb->msg[3]); bzero(&acb->ds.chain, sizeof (acb->ds.chain)); if (sc->sc_sync[target].state == SYNC_START) { @@ -706,7 +716,7 @@ int len; addr = buf; dmaend = NULL; while (count > 0) { - acb->ds.chain[nchain].databuf = (char *) kvtop (addr); + acb->ds.chain[nchain].databuf = (char *) kvtop ((vaddr_t)addr); if (count < (tcount = NBPG - ((int) addr & PGOFSET))) tcount = count; acb->ds.chain[nchain].datalen = tcount; @@ -741,7 +751,7 @@ int len; #endif /* push data cache for all data the 53c710 needs to access */ - dma_cachectl (acb, sizeof (struct ssh_acb)); + dma_cachectl ((caddr_t)acb, sizeof (struct ssh_acb)); dma_cachectl (cbuf, clen); if (buf != NULL && len != 0) dma_cachectl (buf, len); @@ -762,7 +772,7 @@ int len; sc->sc_dev.dv_xname); rp->ssh_temp = 0; rp->ssh_sbcl = sc->sc_sync[target].sbcl; - rp->ssh_dsa = kvtop(&acb->ds); + rp->ssh_dsa = kvtop((vaddr_t)&acb->ds); rp->ssh_dsp = sc->sc_scriptspa; SSH_TRACE('s',1,0,0) } else { @@ -784,11 +794,11 @@ int len; int ssh_checkintr(sc, istat, dstat, sstat0, status) -struct ssh_softc *sc; -u_char istat; -u_char dstat; -u_char sstat0; -int *status; + struct ssh_softc *sc; + u_char istat; + u_char dstat; + u_char sstat0; + int *status; { ssh_regmap_p rp = sc->sc_sshp; struct ssh_acb *acb = sc->sc_nexus; @@ -931,7 +941,7 @@ int *status; } } #endif - dma_cachectl (acb, sizeof(*acb)); + dma_cachectl ((caddr_t)acb, sizeof(*acb)); } #ifdef DEBUG SSH_TRACE('m',rp->ssh_sbcl,(rp->ssh_dsp>>8),rp->ssh_dsp); @@ -1114,7 +1124,7 @@ int *status; } if (j < DMAMAXIO) acb->ds.chain[j].datalen = 0; - DCIAS(kvtop(&acb->ds.chain)); + DCIAS(kvtop((vaddr_t)&acb->ds.chain)); } ++sc->sc_tinfo[target].dconns; /* @@ -1171,8 +1181,8 @@ int *status; sc->sc_nexus = acb; sc->sc_flags |= acb->status; acb->status = 0; - DCIAS(kvtop(&acb->stat[0])); - rp->ssh_dsa = kvtop(&acb->ds); + DCIAS(kvtop((vaddr_t)&acb->stat[0])); + rp->ssh_dsa = kvtop((vaddr_t)&acb->ds); rp->ssh_sxfer = sc->sc_sync[acb->xs->sc_link->target].sxfer; rp->ssh_sbcl = sc->sc_sync[acb->xs->sc_link->target].sbcl; break; @@ -1183,16 +1193,16 @@ int *status; sc->nexus_list.tqh_first); panic("unable to find reselecting device"); } - dma_cachectl (acb, sizeof(*acb)); + dma_cachectl ((caddr_t)acb, sizeof(*acb)); rp->ssh_temp = 0; rp->ssh_dcntl |= SSH_DCNTL_STD; return (0); } if (dstat & SSH_DSTAT_SIR && rp->ssh_dsps == 0xff04) { +#ifdef DEBUG u_short ctest2 = rp->ssh_ctest2; /* reselect was interrupted (by Sig_P or select) */ -#ifdef DEBUG if (ssh_debug & 0x100 || (ctest2 & SSH_CTEST2_SIGP) == 0) printf ("%s: reselect interrupted (Sig_P?) scntl1 %x ctest2 %x @@ -1214,7 +1224,7 @@ int *status; } target = sc->sc_nexus->xs->sc_link->target; rp->ssh_temp = 0; - rp->ssh_dsa = kvtop(&sc->sc_nexus->ds); + rp->ssh_dsa = kvtop((vaddr_t)&sc->sc_nexus->ds); rp->ssh_sxfer = sc->sc_sync[target].sxfer; rp->ssh_sbcl = sc->sc_sync[target].sbcl; rp->ssh_dsp = sc->sc_scriptspa; @@ -1229,7 +1239,7 @@ int *status; printf ("%s: Unrecognized message in data sfbr %x msg %x sbcl %x\n", sc->sc_dev.dv_xname, rp->ssh_sfbr, acb->msg[1], rp->ssh_sbcl); /* what should be done here? */ - DCIAS(kvtop(&acb->msg[1])); + DCIAS(kvtop((vaddr_t)&acb->msg[1])); rp->ssh_dsp = sc->sc_scriptspa + Ent_switch; return (0); } @@ -1268,8 +1278,8 @@ int *status; */ printf ("sshchkintr: target %x ds %x\n", target, &acb->ds); printf ("scripts %x ds %x rp %x dsp %x dcmd %x\n", sc->sc_scriptspa, - kvtop(&acb->ds), kvtop(rp), rp->ssh_dsp, - *((long *)&rp->ssh_dcmd)); + kvtop((vaddr_t)&acb->ds), kvtop((vaddr_t)rp), rp->ssh_dsp, + *((long *)&rp->ssh_dcmd)); printf ("sshchkintr: istat %x dstat %x sstat0 %x dsps %x " "dsa %x sbcl %x sts %x msg %x %x sfbr %x\n", istat, dstat, sstat0, rp->ssh_dsps, rp->ssh_dsa, @@ -1324,7 +1334,7 @@ struct ssh_softc *sc; #endif ssh_start(sc, acb->xs->sc_link->target, acb->xs->sc_link->lun, - &acb->cmd, acb->clen, acb->daddr, acb->dleft); + (u_char *)&acb->cmd, acb->clen, acb->daddr, acb->dleft); return; } @@ -1332,10 +1342,9 @@ struct ssh_softc *sc; /* * 53C710 interrupt handler */ - -int -sshintr (sc) -register struct ssh_softc *sc; +void +sshintr(sc) + register struct ssh_softc *sc; { ssh_regmap_p rp; register u_char istat, dstat, sstat0; @@ -1413,10 +1422,12 @@ register struct ssh_softc *sc; * not be correct for other 53c710 boards. * */ +void scsi_period_to_ssh (sc, target) -struct ssh_softc *sc; + struct ssh_softc *sc; + int target; { - int period, offset, i, sxfer, sbcl; + int period, offset, sxfer, sbcl; period = sc->sc_nexus->msg[4]; offset = sc->sc_nexus->msg[5]; diff --git a/sys/arch/mvme68k/dev/sshdma.c b/sys/arch/mvme68k/dev/sshdma.c index 47430aae5b4..441ec1796e4 100644 --- a/sys/arch/mvme68k/dev/sshdma.c +++ b/sys/arch/mvme68k/dev/sshdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshdma.c,v 1.3 2002/04/21 23:45:16 miod Exp $ */ +/* $OpenBSD: sshdma.c,v 1.4 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -60,8 +60,10 @@ int afscmatch(struct device *, void *, void *); void afscattach(struct device *, struct device *, void *); -int sshintr(struct ssh_softc *); -int afsc_dmaintr(struct ssh_softc *); +void sshintr(struct ssh_softc *); +int afsc_dmaintr(void *); + +extern void sshinitialize(struct ssh_softc *); struct scsi_adapter afsc_scsiswitch = { ssh_scsicmd, @@ -90,10 +92,9 @@ afscmatch(pdp, vcf, args) struct device *pdp; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; - return (!badvaddr(ca->ca_vaddr, 4)); + return (!badvaddr((vaddr_t)ca->ca_vaddr, 4)); } void @@ -191,9 +192,10 @@ void *auxp; } int -afsc_dmaintr(sc) -struct ssh_softc *sc; +afsc_dmaintr(arg) + void *arg; { + struct ssh_softc *sc = (struct ssh_softc *)arg; ssh_regmap_p rp; u_char istat; diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c index df63dd35f15..89af7dab4e5 100644 --- a/sys/arch/mvme68k/dev/vme.c +++ b/sys/arch/mvme68k/dev/vme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vme.c,v 1.12 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vme.c,v 1.13 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -65,10 +65,13 @@ int vmematch(struct device *, void *, void *); void vmeattach(struct device *, struct device *, void *); -int vme1chip_init(struct vmesoftc *sc); -int vme2chip_init(struct vmesoftc *sc); +void vme1chip_init(struct vmesoftc *sc); +void vme2chip_init(struct vmesoftc *sc); u_long vme2chip_map(u_long base, int len, int dwidth); -int vme2abort(struct frame *frame); +int vme2abort(void *); + +void vmeunmap(void *, int); +int vmeprint(void *, const char *); static int vmebustype; @@ -240,7 +243,7 @@ vmerw(sc, uio, flags, bus) int flags; int bus; { - register vm_offset_t o, v; + register vm_offset_t v; register int c; register struct iovec *iov; void *vme; @@ -297,7 +300,6 @@ vmescan(parent, child, args, bustype) { struct cfdata *cf = child; struct vmesoftc *sc = (struct vmesoftc *)parent; - struct confargs *ca = args; struct confargs oca; if (parent->dv_cfdata->cf_driver->cd_indirect) { @@ -422,7 +424,7 @@ vmeintr_establish(vec, ih) } #if defined(MVME147) -int +void vme1chip_init(sc) struct vmesoftc *sc; { @@ -438,12 +440,12 @@ vme1chip_init(sc) /* * XXX what AM bits should be used for the D32/D16 mappings? */ -int +void vme2chip_init(sc) struct vmesoftc *sc; { struct vme2reg *vme2 = (struct vme2reg *)sc->sc_vaddr; - u_long ctl, addr, vasize; + u_long ctl; /* turn off SYSFAIL LED */ vme2->vme2_tctl &= ~VME2_TCTL_SYSFAIL; @@ -472,8 +474,8 @@ vme2chip_init(sc) printf("%s: 4phys 0x%08x-0x%08x to VME 0x%08x-0x%08x\n", sc->sc_dev.dv_xname, vme2->vme2_master4 << 16, vme2->vme2_master4 & 0xffff0000, - vme2->vme2_master4 << 16 + vme2->vme2_master4mod << 16, - vme2->vme2_master4 & 0xffff0000 + vme2->vme2_master4 & 0xffff0000); + (vme2->vme2_master4 << 16) + (vme2->vme2_master4mod << 16), + (vme2->vme2_master4 & 0xffff0000) + (vme2->vme2_master4 & 0xffff0000)); /* * Map the VME irq levels to the cpu levels 1:1. * This is rather inflexible, but much easier. @@ -493,7 +495,6 @@ vme2chip_init(sc) * pseudo driver, abort interrupt handler */ sc->sc_abih.ih_fn = vme2abort; - sc->sc_abih.ih_arg = 0; sc->sc_abih.ih_ipl = 7; sc->sc_abih.ih_wantframe = 1; @@ -525,18 +526,20 @@ vme2chip_map(base, len, dwidth) if (base < VME2_D32STARTVME) return (NULL); return (base - VME2_D32STARTVME + VME2_D32STARTPHYS); + default: + return (NULL); } } #if NPCCTWO > 0 int vme2abort(frame) - struct frame *frame; + void *frame; { struct vmesoftc *sc = (struct vmesoftc *)vme_cd.cd_devs[0]; struct vme2reg *vme2 = (struct vme2reg *)sc->sc_vaddr; - if (vme2->vme2_irqstat & VME2_IRQ_AB == 0) { + if ((vme2->vme2_irqstat & VME2_IRQ_AB) == 0) { printf("%s: abort irq not set\n", sc->sc_dev.dv_xname); return (0); } diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h index 8fd737e1be9..b830d0f8876 100644 --- a/sys/arch/mvme68k/dev/vme.h +++ b/sys/arch/mvme68k/dev/vme.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vme.h,v 1.7 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vme.h,v 1.8 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -338,3 +338,6 @@ void * vmepmap(struct vmesoftc *sc, void * vmeaddr, int len, void * vmemap(struct vmesoftc *sc, void * vmeaddr, int len, int bustype); int vmerw(struct vmesoftc *sc, struct uio *uio, int flags, int bus); + +int vmeintr_establish(int, struct intrhand *); +int vmescan(struct device *, void *, void *, int); diff --git a/sys/arch/mvme68k/dev/vmel.c b/sys/arch/mvme68k/dev/vmel.c index aeec0bc86da..99f543875d0 100644 --- a/sys/arch/mvme68k/dev/vmel.c +++ b/sys/arch/mvme68k/dev/vmel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmel.c,v 1.8 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vmel.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -32,14 +32,16 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/proc.h> #include <sys/user.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> + #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/cpu.h> + #include <mvme68k/dev/vme.h> /* @@ -51,6 +53,8 @@ void vmelattach(struct device *, struct device *, void *); int vmelmatch(struct device *, void *, void *); +int vmelscan(struct device *, void *, void *); + struct cfattach vmel_ca = { sizeof(struct vmelsoftc), vmelmatch, vmelattach }; @@ -91,9 +95,10 @@ vmelattach(parent, self, args) /*ARGSUSED*/ int -vmelopen(dev, flag, mode) +vmelopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { if (minor(dev) >= vmel_cd.cd_ndevs || vmel_cd.cd_devs[minor(dev)] == NULL) @@ -103,9 +108,10 @@ vmelopen(dev, flag, mode) /*ARGSUSED*/ int -vmelclose(dev, flag, mode) +vmelclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -114,13 +120,12 @@ vmelclose(dev, flag, mode) /*ARGSUSED*/ int vmelioctl(dev, cmd, data, flag, p) - dev_t dev; + dev_t dev; + u_long cmd; caddr_t data; - int cmd, flag; + int flag; struct proc *p; { - int unit = minor(dev); - struct vmelsoftc *sc = (struct vmelsoftc *) vmel_cd.cd_devs[unit]; int error = 0; switch (cmd) { diff --git a/sys/arch/mvme68k/dev/vmes.c b/sys/arch/mvme68k/dev/vmes.c index 635dfe03c05..3af03a7fadd 100644 --- a/sys/arch/mvme68k/dev/vmes.c +++ b/sys/arch/mvme68k/dev/vmes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmes.c,v 1.9 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vmes.c,v 1.10 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -32,14 +32,16 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/proc.h> #include <sys/user.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/device.h> + #include <machine/autoconf.h> +#include <machine/conf.h> #include <machine/cpu.h> + #include <mvme68k/dev/vme.h> /* @@ -51,6 +53,8 @@ void vmesattach(struct device *, struct device *, void *); int vmesmatch(struct device *, void *, void *); +int vmesscan(struct device *, void *, void *); + struct cfattach vmes_ca = { sizeof(struct vmessoftc), vmesmatch, vmesattach }; @@ -91,9 +95,10 @@ vmesattach(parent, self, args) /*ARGSUSED*/ int -vmesopen(dev, flag, mode) +vmesopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { if (minor(dev) >= vmes_cd.cd_ndevs || vmes_cd.cd_devs[minor(dev)] == NULL) @@ -103,9 +108,10 @@ vmesopen(dev, flag, mode) /*ARGSUSED*/ int -vmesclose(dev, flag, mode) +vmesclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -114,13 +120,12 @@ vmesclose(dev, flag, mode) /*ARGSUSED*/ int vmesioctl(dev, cmd, data, flag, p) - dev_t dev; + dev_t dev; + u_long cmd; caddr_t data; - int cmd, flag; + int flag; struct proc *p; { - int unit = minor(dev); - struct vmessoftc *sc = (struct vmessoftc *) vmes_cd.cd_devs[unit]; int error = 0; switch (cmd) { diff --git a/sys/arch/mvme68k/dev/vs.c b/sys/arch/mvme68k/dev/vs.c index d7330d66b7b..738b897a5a3 100644 --- a/sys/arch/mvme68k/dev/vs.c +++ b/sys/arch/mvme68k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.7 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vs.c,v 1.8 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -66,18 +66,23 @@ #include <mvme68k/dev/vsvar.h> #endif +void scopy(void *, void *, u_int); +void szero(void *, u_int); +int do_vspoll(struct vs_softc *, int); +void thaw_queue(struct vs_softc *, u_int8_t); int vs_checkintr(struct vs_softc *, struct scsi_xfer *, int *); -int vs_chksense(struct scsi_xfer *); +void vs_chksense(struct scsi_xfer *); void vs_reset(struct vs_softc *); void vs_resync(struct vs_softc *); void vs_initialize(struct vs_softc *); -int vs_intr(struct vs_softc *); +void vs_intr(void *); int vs_poll(struct vs_softc *, struct scsi_xfer *); void vs_scsidone(struct scsi_xfer *, int); -M328_CQE * vs_getcqe(struct vs_softc *); -M328_IOPB * vs_getiopb(struct vs_softc *); +M328_CQE *vs_getcqe(struct vs_softc *); +M328_IOPB *vs_getiopb(struct vs_softc *); +void vs_link_sg_element(sg_list_element_t *, vaddr_t, int); +void vs_link_sg_list(sg_list_element_t *, vaddr_t, int); -extern u_int kvtop(); /* * 16 bit 's' memory functions. MVME328 is a D16 board. * We must program with that in mind or else... @@ -92,599 +97,582 @@ extern u_int kvtop(); */ void -scopy(void *src, void *dst, unsigned short cnt) +scopy(src, dst, cnt) + void *src, *dst; + u_int cnt; { - register unsigned short volatile *x, *y, z; + u_int16_t volatile *x, *y, z; - z = cnt >> 1; - x = (unsigned short *) src; - y = (unsigned short *) dst; + z = cnt >> 1; + x = (u_int16_t *) src; + y = (u_int16_t *) dst; - while (z--) { - *y++ = *x++; - } + while (z--) { + *y++ = *x++; + } } void -szero(void *src, u_long cnt) +szero(src, cnt) + void *src; + u_int cnt; { - register unsigned short *source; - register unsigned short zero = 0; - register unsigned short z; + u_int16_t *source; + u_int16_t zero = 0; + u_int16_t z; - source = (unsigned short *) src; - z = cnt >> 1; + source = (u_int16_t *) src; + z = cnt >> 1; - while (z--) { - *source++ = zero; - } - return; + while (z--) { + *source++ = zero; + } } - - - - /* * default minphys routine for MVME328 based controllers */ void vs_minphys(bp) -struct buf *bp; + struct buf *bp; { - /* - * No max transfer at this level. - */ - minphys(bp); + /* + * No max transfer at this level. + */ + minphys(bp); } -int do_vspoll(sc, to) -struct vs_softc *sc; -int to; +int +do_vspoll(sc, to) + struct vs_softc *sc; + int to; { - int i; - if (to <= 0 ) to = 50000; - /* use cmd_wait values? */ - i = 50000; - /*spl0();*/ - while (!(CRSW & (M_CRSW_CRBV | M_CRSW_CC))) { - if (--i <= 0) { + int i; + + if (to <= 0 ) to = 50000; + /* use cmd_wait values? */ + i = 50000; + /*spl0();*/ + while (!(CRSW & (M_CRSW_CRBV | M_CRSW_CC))) { + if (--i <= 0) { #ifdef DEBUG - printf ("waiting: timeout %d crsw 0x%x\n", to, CRSW); + printf ("waiting: timeout %d crsw 0x%x\n", to, CRSW); #endif - i = 50000; - --to; - if (to <= 0) { - /*splx(s);*/ - vs_reset(sc); - vs_resync(sc); - printf ("timed out: timeout %d crsw 0x%x\n", to, CRSW); - return 1; - } - } - } - return 0; + i = 50000; + --to; + if (to <= 0) { + /*splx(s);*/ + vs_reset(sc); + vs_resync(sc); + printf ("timed out: timeout %d crsw 0x%x\n", + to, CRSW); + return 1; + } + } + } + return 0; } int vs_poll(sc, xs) -struct vs_softc *sc; -struct scsi_xfer *xs; + struct vs_softc *sc; + struct scsi_xfer *xs; { - M328_CIB *cib = (M328_CIB *)&sc->sc_vsreg->sh_CIB; - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_IOPB *miopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_CQE *cqep; - M328_IOPB *iopb; - int i; - int status; - int s; - int to; - - /*s = splbio();*/ - to = xs->timeout / 1000; - for (;;) { - if (do_vspoll(sc, to)) break; - if (vs_checkintr(sc, xs, &status)) { - vs_scsidone(xs, status); - } - if (CRSW & M_CRSW_ER) - CRB_CLR_ER(CRSW); - CRB_CLR_DONE(CRSW); - if (xs->flags & ITSDONE) break; - } - return (COMPLETE); + int status; + int to; + + /*s = splbio();*/ + to = xs->timeout / 1000; + for (;;) { + if (do_vspoll(sc, to)) break; + if (vs_checkintr(sc, xs, &status)) { + vs_scsidone(xs, status); + } + if (CRSW & M_CRSW_ER) + CRB_CLR_ER(CRSW); + CRB_CLR_DONE(CRSW); + if (xs->flags & ITSDONE) break; + } + return (COMPLETE); } -void thaw_queue(sc, target) -struct vs_softc *sc; -u_int8_t target; +void +thaw_queue(sc, target) + struct vs_softc *sc; + u_int8_t target; { - u_short t; - t = target << 8; - t |= 0x0001; - THAW_REG = t; - /* loop until thawed */ - while (THAW_REG & 0x01); + u_short t; + t = target << 8; + t |= 0x0001; + THAW_REG = t; + /* loop until thawed */ + while (THAW_REG & 0x01); } void vs_scsidone (xs, stat) -struct scsi_xfer *xs; -int stat; + struct scsi_xfer *xs; + int stat; { - struct scsi_link *slp = xs->sc_link; - struct vs_softc *sc = slp->adapter_softc; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - xs->status = stat; - while (xs->status == SCSI_CHECK) { - vs_chksense(xs); - thaw_queue(sc, slp->target + 1); - } - xs->flags |= ITSDONE; - /*sc->sc_tinfo[slp->target].cmds++;*/ - if (CRSW & M_CRSW_ER) - CRB_CLR_ER(CRSW); - CRB_CLR_DONE(CRSW); - thaw_queue(sc, slp->target + 1); - szero(riopb, sizeof(M328_IOPB)); - scsi_done(xs); + struct scsi_link *slp = xs->sc_link; + struct vs_softc *sc = slp->adapter_softc; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + + xs->status = stat; + while (xs->status == SCSI_CHECK) { + vs_chksense(xs); + thaw_queue(sc, slp->target + 1); + } + xs->flags |= ITSDONE; + /*sc->sc_tinfo[slp->target].cmds++;*/ + if (CRSW & M_CRSW_ER) + CRB_CLR_ER(CRSW); + CRB_CLR_DONE(CRSW); + thaw_queue(sc, slp->target + 1); + szero(riopb, sizeof(M328_IOPB)); + scsi_done(xs); } int vs_scsicmd(xs) -struct scsi_xfer *xs; + struct scsi_xfer *xs; { - struct scsi_link *slp = xs->sc_link; - struct vs_softc *sc = slp->adapter_softc; - int flags, s, i; - unsigned long buf, len; - u_short iopb_len; - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_IOPB *miopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_CQE *cqep; - M328_IOPB *iopb; - M328_CMD *m328_cmd; - - /* If the target doesn't exist, abort */ - if (!sc->sc_tinfo[slp->target].avail) { - xs->error = XS_SELTIMEOUT; - xs->status = -1; - xs->flags |= ITSDONE; - scsi_done(xs); - } - - slp->quirks |= SDEV_NOLUNS; - flags = xs->flags; + struct scsi_link *slp = xs->sc_link; + struct vs_softc *sc = slp->adapter_softc; + int flags; + unsigned long buf, len; + u_short iopb_len; + M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; + M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; + M328_IOPB *miopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; + M328_CQE *cqep; + M328_IOPB *iopb; + M328_CMD *m328_cmd; + + /* If the target doesn't exist, abort */ + if (!sc->sc_tinfo[slp->target].avail) { + xs->error = XS_SELTIMEOUT; + xs->status = -1; + xs->flags |= ITSDONE; + scsi_done(xs); + } + + slp->quirks |= SDEV_NOLUNS; + flags = xs->flags; #ifdef SDEBUG - printf("scsi_cmd() "); - if (xs->cmd->opcode == 0) { - printf("TEST_UNIT_READY "); - } else if (xs->cmd->opcode == REQUEST_SENSE) { - printf("REQUEST_SENSE "); - } else if (xs->cmd->opcode == INQUIRY) { - printf("INQUIRY "); - } else if (xs->cmd->opcode == MODE_SELECT) { - printf("MODE_SELECT "); - } else if (xs->cmd->opcode == MODE_SENSE) { - printf("MODE_SENSE "); - } else if (xs->cmd->opcode == START_STOP) { - printf("START_STOP "); - } else if (xs->cmd->opcode == RESERVE) { - printf("RESERVE "); - } else if (xs->cmd->opcode == RELEASE) { - printf("RELEASE "); - } else if (xs->cmd->opcode == PREVENT_ALLOW) { - printf("PREVENT_ALLOW "); - } else if (xs->cmd->opcode == POSITION_TO_ELEMENT) { - printf("POSITION_TO_EL "); - } else if (xs->cmd->opcode == CHANGE_DEFINITION) { - printf("CHANGE_DEF "); - } else if (xs->cmd->opcode == MODE_SENSE_BIG) { - printf("MODE_SENSE_BIG "); - } else if (xs->cmd->opcode == MODE_SELECT_BIG) { - printf("MODE_SELECT_BIG "); - } else if (xs->cmd->opcode == 0x25) { - printf("READ_CAPACITY "); - } else if (xs->cmd->opcode == 0x08) { - printf("READ_COMMAND "); - } + printf("scsi_cmd() "); + if (xs->cmd->opcode == 0) { + printf("TEST_UNIT_READY "); + } else if (xs->cmd->opcode == REQUEST_SENSE) { + printf("REQUEST_SENSE "); + } else if (xs->cmd->opcode == INQUIRY) { + printf("INQUIRY "); + } else if (xs->cmd->opcode == MODE_SELECT) { + printf("MODE_SELECT "); + } else if (xs->cmd->opcode == MODE_SENSE) { + printf("MODE_SENSE "); + } else if (xs->cmd->opcode == START_STOP) { + printf("START_STOP "); + } else if (xs->cmd->opcode == RESERVE) { + printf("RESERVE "); + } else if (xs->cmd->opcode == RELEASE) { + printf("RELEASE "); + } else if (xs->cmd->opcode == PREVENT_ALLOW) { + printf("PREVENT_ALLOW "); + } else if (xs->cmd->opcode == POSITION_TO_ELEMENT) { + printf("POSITION_TO_EL "); + } else if (xs->cmd->opcode == CHANGE_DEFINITION) { + printf("CHANGE_DEF "); + } else if (xs->cmd->opcode == MODE_SENSE_BIG) { + printf("MODE_SENSE_BIG "); + } else if (xs->cmd->opcode == MODE_SELECT_BIG) { + printf("MODE_SELECT_BIG "); + } else if (xs->cmd->opcode == 0x25) { + printf("READ_CAPACITY "); + } else if (xs->cmd->opcode == 0x08) { + printf("READ_COMMAND "); + } #endif - if (flags & SCSI_POLL) { - cqep = mc; - iopb = miopb; - } else { - cqep = vs_getcqe(sc); - iopb = vs_getiopb(sc); - } - if (cqep == NULL) { - xs->error = XS_DRIVER_STUFFUP; - return (TRY_AGAIN_LATER); - } - -/* s = splbio();*/ - iopb_len = sizeof(M328_short_IOPB) + xs->cmdlen; - szero(iopb, sizeof(M328_IOPB)); - - scopy(xs->cmd, &iopb->iopb_SCSI[0], xs->cmdlen); - iopb->iopb_CMD = IOPB_SCSI; + if (flags & SCSI_POLL) { + cqep = mc; + iopb = miopb; + } else { + cqep = vs_getcqe(sc); + iopb = vs_getiopb(sc); + } + if (cqep == NULL) { + xs->error = XS_DRIVER_STUFFUP; + return (TRY_AGAIN_LATER); + } + + /* s = splbio();*/ + iopb_len = sizeof(M328_short_IOPB) + xs->cmdlen; + szero(iopb, sizeof(M328_IOPB)); + + scopy(xs->cmd, &iopb->iopb_SCSI[0], xs->cmdlen); + iopb->iopb_CMD = IOPB_SCSI; #if 0 - LV(iopb->iopb_BUFF, kvtop(xs->data)); - LV(iopb->iopb_LENGTH, xs->datalen); + LV(iopb->iopb_BUFF, kvtop(xs->data)); + LV(iopb->iopb_LENGTH, xs->datalen); #endif - iopb->iopb_UNIT = slp->lun << 3; - iopb->iopb_UNIT |= slp->target; - iopb->iopb_NVCT = (u_char)sc->sc_nvec; - iopb->iopb_EVCT = (u_char)sc->sc_evec; - - /* - * Since the 88k's don't support cache snooping, we have - * to flush the cache for a write and flush with inval for - * a read, prior to starting the IO. - */ - if (xs->flags & SCSI_DATA_IN) { /* read */ + iopb->iopb_UNIT = slp->lun << 3; + iopb->iopb_UNIT |= slp->target; + iopb->iopb_NVCT = (u_char)sc->sc_nvec; + iopb->iopb_EVCT = (u_char)sc->sc_evec; + + /* + * Since the 88k's don't support cache snooping, we have + * to flush the cache for a write and flush with inval for + * a read, prior to starting the IO. + */ + if (xs->flags & SCSI_DATA_IN) { /* read */ #if defined(mvme88k) - dma_cachectl((vm_offset_t)xs->data, xs->datalen, - DMA_CACHE_SYNC_INVAL); + dma_cachectl(xs->data, xs->datalen, + DMA_CACHE_SYNC_INVAL); #endif - iopb->iopb_OPTION |= OPT_READ; - } else { /* write */ -#if defined(MVME187) - dma_cachectl((vm_offset_t)xs->data, xs->datalen, - DMA_CACHE_SYNC); + iopb->iopb_OPTION |= OPT_READ; + } else { /* write */ +#if defined(mvme88k) + dma_cachectl(xs->data, xs->datalen, + DMA_CACHE_SYNC); #endif - iopb->iopb_OPTION |= OPT_WRITE; - } - - if (flags & SCSI_POLL) { - iopb->iopb_OPTION |= OPT_INTDIS; - iopb->iopb_LEVEL = 0; - } else { - iopb->iopb_OPTION |= OPT_INTEN; - iopb->iopb_LEVEL = sc->sc_ipl; - } - iopb->iopb_ADDR = ADDR_MOD; - - /* - * Wait until we can use the command queue entry. - * Should only have to wait if the master command - * queue entry is busy. - */ - while (cqep->cqe_QECR & M_QECR_GO); - - cqep->cqe_IOPB_ADDR = OFF(iopb); - cqep->cqe_IOPB_LENGTH = iopb_len; - if (flags & SCSI_POLL) { - cqep->cqe_WORK_QUEUE = slp->target + 1; - } else { - cqep->cqe_WORK_QUEUE = slp->target + 1; - } + iopb->iopb_OPTION |= OPT_WRITE; + } + + if (flags & SCSI_POLL) { + iopb->iopb_OPTION |= OPT_INTDIS; + iopb->iopb_LEVEL = 0; + } else { + iopb->iopb_OPTION |= OPT_INTEN; + iopb->iopb_LEVEL = sc->sc_ipl; + } + iopb->iopb_ADDR = ADDR_MOD; + + /* + * Wait until we can use the command queue entry. + * Should only have to wait if the master command + * queue entry is busy. + */ + while (cqep->cqe_QECR & M_QECR_GO); + + cqep->cqe_IOPB_ADDR = OFF(iopb); + cqep->cqe_IOPB_LENGTH = iopb_len; + if (flags & SCSI_POLL) { + cqep->cqe_WORK_QUEUE = slp->target + 1; + } else { + cqep->cqe_WORK_QUEUE = slp->target + 1; + } - MALLOC(m328_cmd, M328_CMD*, sizeof(M328_CMD), M_DEVBUF, M_WAITOK); + MALLOC(m328_cmd, M328_CMD*, sizeof(M328_CMD), M_DEVBUF, M_WAITOK); - m328_cmd->xs = xs; - if (xs->datalen) { - m328_cmd->top_sg_list = vs_build_memory_structure(xs, iopb); - } else { - m328_cmd->top_sg_list = (M328_SG)0; - } - - LV(cqep->cqe_CTAG, m328_cmd); - - if (crb->crb_CRSW & M_CRSW_AQ) { - cqep->cqe_QECR = M_QECR_AA; - } - VL(buf, iopb->iopb_BUFF); - VL(len, iopb->iopb_LENGTH); + m328_cmd->xs = xs; + if (xs->datalen) { + m328_cmd->top_sg_list = vs_build_memory_structure(xs, iopb); + } else { + m328_cmd->top_sg_list = (M328_SG)0; + } + + LV(cqep->cqe_CTAG, m328_cmd); + + if (crb->crb_CRSW & M_CRSW_AQ) { + cqep->cqe_QECR = M_QECR_AA; + } + VL(buf, iopb->iopb_BUFF); + VL(len, iopb->iopb_LENGTH); #ifdef SDEBUG - printf("tgt %d lun %d buf %x len %d wqn %d ipl %d\n", slp->target, - slp->lun, buf, len, cqep->cqe_WORK_QUEUE, iopb->iopb_LEVEL); + printf("tgt %d lun %d buf %x len %d wqn %d ipl %d\n", slp->target, + slp->lun, buf, len, cqep->cqe_WORK_QUEUE, iopb->iopb_LEVEL); #endif - cqep->cqe_QECR |= M_QECR_GO; - - if (flags & SCSI_POLL) { - /* poll for the command to complete */ -/* splx(s);*/ - vs_poll(sc, xs); - return (COMPLETE); - } -/* splx(s);*/ - return (SUCCESSFULLY_QUEUED); + cqep->cqe_QECR |= M_QECR_GO; + + if (flags & SCSI_POLL) { + /* poll for the command to complete */ + /*splx(s);*/ + vs_poll(sc, xs); + return (COMPLETE); + } + /*splx(s);*/ + return (SUCCESSFULLY_QUEUED); } -int +void vs_chksense(xs) -struct scsi_xfer *xs; + struct scsi_xfer *xs; { - int flags, s, i; - struct scsi_link *slp = xs->sc_link; - struct vs_softc *sc = slp->adapter_softc; - struct scsi_sense *ss; - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_IOPB *miopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; - - /* ack and clear the error */ - CRB_CLR_DONE(CRSW); - CRB_CLR_ER(CRSW); - xs->status = 0; - - szero(miopb, sizeof(M328_IOPB)); - /* This is a command, so point to it */ - ss = (void *)&miopb->iopb_SCSI[0]; - szero(ss, sizeof(*ss)); - ss->opcode = REQUEST_SENSE; - ss->byte2 = slp->lun << 5; - ss->length = sizeof(struct scsi_sense_data); - - miopb->iopb_CMD = IOPB_SCSI; - miopb->iopb_OPTION = OPT_READ; - miopb->iopb_NVCT = (u_char)sc->sc_nvec; - miopb->iopb_EVCT = (u_char)sc->sc_evec; - miopb->iopb_LEVEL = 0; /*sc->sc_ipl;*/ - miopb->iopb_ADDR = ADDR_MOD; - LV(miopb->iopb_BUFF, kvtop(&xs->sense)); - LV(miopb->iopb_LENGTH, sizeof(struct scsi_sense_data)); - - szero(mc, sizeof(M328_CQE)); - mc->cqe_IOPB_ADDR = OFF(miopb); - mc->cqe_IOPB_LENGTH = sizeof(M328_short_IOPB) + sizeof(struct scsi_sense); - mc->cqe_WORK_QUEUE = 0; - mc->cqe_QECR = M_QECR_GO; - /* poll for the command to complete */ - s = splbio(); - do_vspoll(sc, 0); - /* - if (xs->cmd->opcode != PREVENT_ALLOW) { - xs->error = XS_SENSE; - } - */ - xs->status = riopb->iopb_STATUS >> 8; + int s; + struct scsi_link *slp = xs->sc_link; + struct vs_softc *sc = slp->adapter_softc; + struct scsi_sense *ss; + M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + M328_IOPB *miopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; + + /* ack and clear the error */ + CRB_CLR_DONE(CRSW); + CRB_CLR_ER(CRSW); + xs->status = 0; + + szero(miopb, sizeof(M328_IOPB)); + /* This is a command, so point to it */ + ss = (void *)&miopb->iopb_SCSI[0]; + szero(ss, sizeof(*ss)); + ss->opcode = REQUEST_SENSE; + ss->byte2 = slp->lun << 5; + ss->length = sizeof(struct scsi_sense_data); + + miopb->iopb_CMD = IOPB_SCSI; + miopb->iopb_OPTION = OPT_READ; + miopb->iopb_NVCT = (u_char)sc->sc_nvec; + miopb->iopb_EVCT = (u_char)sc->sc_evec; + miopb->iopb_LEVEL = 0; /*sc->sc_ipl;*/ + miopb->iopb_ADDR = ADDR_MOD; + LV(miopb->iopb_BUFF, kvtop((vaddr_t)&xs->sense)); + LV(miopb->iopb_LENGTH, sizeof(struct scsi_sense_data)); + + szero(mc, sizeof(M328_CQE)); + mc->cqe_IOPB_ADDR = OFF(miopb); + mc->cqe_IOPB_LENGTH = sizeof(M328_short_IOPB) + + sizeof(struct scsi_sense); + mc->cqe_WORK_QUEUE = 0; + mc->cqe_QECR = M_QECR_GO; + /* poll for the command to complete */ + s = splbio(); + do_vspoll(sc, 0); + /* + if (xs->cmd->opcode != PREVENT_ALLOW) { + xs->error = XS_SENSE; + } + */ + xs->status = riopb->iopb_STATUS >> 8; #ifdef SDEBUG - scsi_print_sense(xs, 2); + scsi_print_sense(xs, 2); #endif - splx(s); + splx(s); } M328_CQE * vs_getcqe(sc) -struct vs_softc *sc; + struct vs_softc *sc; { - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_CQE *cqep; + M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; + M328_CQE *cqep; - cqep = (M328_CQE *)&sc->sc_vsreg->sh_CQE[mcsb->mcsb_QHDP]; + cqep = (M328_CQE *)&sc->sc_vsreg->sh_CQE[mcsb->mcsb_QHDP]; - if (cqep->cqe_QECR & M_QECR_GO) - return NULL; /* Hopefully, this will never happen */ - mcsb->mcsb_QHDP++; - if (mcsb->mcsb_QHDP == NUM_CQE) mcsb->mcsb_QHDP = 0; - szero(cqep, sizeof(M328_CQE)); - return cqep; + if (cqep->cqe_QECR & M_QECR_GO) + return NULL; /* Hopefully, this will never happen */ + mcsb->mcsb_QHDP++; + if (mcsb->mcsb_QHDP == NUM_CQE) mcsb->mcsb_QHDP = 0; + szero(cqep, sizeof(M328_CQE)); + return cqep; } M328_IOPB * vs_getiopb(sc) -struct vs_softc *sc; + struct vs_softc *sc; { - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_IOPB *iopb; - int slot; - - if (mcsb->mcsb_QHDP == 0) { - slot = NUM_CQE; - } else { - slot = mcsb->mcsb_QHDP - 1; - } - iopb = (M328_IOPB *)&sc->sc_vsreg->sh_IOPB[slot]; - szero(iopb, sizeof(M328_IOPB)); - return iopb; + M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; + M328_IOPB *iopb; + int slot; + + if (mcsb->mcsb_QHDP == 0) { + slot = NUM_CQE; + } else { + slot = mcsb->mcsb_QHDP - 1; + } + iopb = (M328_IOPB *)&sc->sc_vsreg->sh_IOPB[slot]; + szero(iopb, sizeof(M328_IOPB)); + return iopb; } void vs_initialize(sc) -struct vs_softc *sc; + struct vs_softc *sc; { - M328_CIB *cib = (M328_CIB *)&sc->sc_vsreg->sh_CIB; - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_IOPB *iopb; - M328_WQCF *wiopb = (M328_WQCF *)&sc->sc_vsreg->sh_MCE_IOPB; - u_short i, crsw; - int failed = 0; - - CRB_CLR_DONE(CRSW); - szero(cib, sizeof(M328_CIB)); - mcsb->mcsb_QHDP = 0; - sc->sc_qhp = 0; - cib->cib_NCQE = 10; - cib->cib_BURST = 0; - cib->cib_NVECT = sc->sc_ipl << 8; - cib->cib_NVECT |= sc->sc_nvec; - cib->cib_EVECT = sc->sc_ipl << 8; - cib->cib_EVECT |= sc->sc_evec; - cib->cib_PID = 0x07; - cib->cib_SID = 0x00; - cib->cib_CRBO = OFF(crb); - cib->cib_SELECT_msw = HI(SELECTION_TIMEOUT); - cib->cib_SELECT_lsw = LO(SELECTION_TIMEOUT); - cib->cib_WQ0TIMO_msw = HI(4); - cib->cib_WQ0TIMO_lsw = LO(4); - cib->cib_VMETIMO_msw = 0; /*HI(VME_BUS_TIMEOUT);*/ - cib->cib_VMETIMO_lsw = 0; /*LO(VME_BUS_TIMEOUT);*/ - cib->cib_SBRIV = sc->sc_ipl << 8; - cib->cib_SBRIV |= sc->sc_evec; - cib->cib_SOF0 = 0x15; - cib->cib_SRATE0 = 100/4; - cib->cib_SOF1 = 0x0; - cib->cib_SRATE1 = 0x0; - - iopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; - szero(iopb, sizeof(M328_IOPB)); - iopb->iopb_CMD = CNTR_INIT; - iopb->iopb_OPTION = 0; - iopb->iopb_NVCT = (u_char)sc->sc_nvec; - iopb->iopb_EVCT = (u_char)sc->sc_evec; - iopb->iopb_LEVEL = 0; /*sc->sc_ipl;*/ - iopb->iopb_ADDR = SHIO_MOD; - LV(iopb->iopb_BUFF, OFF(cib)); - LV(iopb->iopb_LENGTH, sizeof(M328_CIB)); - - szero(mc, sizeof(M328_CQE)); - mc->cqe_IOPB_ADDR = OFF(iopb); - mc->cqe_IOPB_LENGTH = sizeof(M328_IOPB); - mc->cqe_WORK_QUEUE = 0; - mc->cqe_QECR = M_QECR_GO; - /* poll for the command to complete */ - do_vspoll(sc, 0); - CRB_CLR_DONE(CRSW); - - /* initialize work queues */ - for (i=1; i<8; i++) { - szero(wiopb, sizeof(M328_IOPB)); - wiopb->wqcf_CMD = CNTR_INIT_WORKQ; - wiopb->wqcf_OPTION = 0; - wiopb->wqcf_NVCT = (u_char)sc->sc_nvec; - wiopb->wqcf_EVCT = (u_char)sc->sc_evec; - wiopb->wqcf_ILVL = 0; /*sc->sc_ipl;*/ - wiopb->wqcf_WORKQ = i; - wiopb->wqcf_WOPT = (WQO_FOE | WQO_INIT); - wiopb->wqcf_SLOTS = JAGUAR_MAX_Q_SIZ; - LV(wiopb->wqcf_CMDTO, 2); - - szero(mc, sizeof(M328_CQE)); - mc->cqe_IOPB_ADDR = OFF(wiopb); - mc->cqe_IOPB_LENGTH = sizeof(M328_IOPB); - mc->cqe_WORK_QUEUE = 0; - mc->cqe_QECR = M_QECR_GO; - /* poll for the command to complete */ - do_vspoll(sc, 0); - if (CRSW & M_CRSW_ER) { - /*printf("\nerror: queue %d status = 0x%x\n", i, riopb->iopb_STATUS);*/ - /*failed = 1;*/ - CRB_CLR_ER(CRSW); - } - CRB_CLR_DONE(CRSW); - delay(500); - } - /* start queue mode */ - CRSW = 0; - mcsb->mcsb_MCR |= M_MCR_SQM; - crsw = CRSW; - do_vspoll(sc, 0); - if (CRSW & M_CRSW_ER) { - printf("error: status = 0x%x\n", riopb->iopb_STATUS); - CRB_CLR_ER(CRSW); - } - CRB_CLR_DONE(CRSW); - - if (failed) { - printf(": failed!\n"); - return; - } - /* reset SCSI bus */ - vs_reset(sc); - /* sync all devices */ - vs_resync(sc); - printf(": target %d\n", sc->sc_link.adapter_target); + M328_CIB *cib = (M328_CIB *)&sc->sc_vsreg->sh_CIB; + M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; + M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; + M328_IOPB *iopb; + M328_WQCF *wiopb = (M328_WQCF *)&sc->sc_vsreg->sh_MCE_IOPB; + u_short i, crsw; + int failed = 0; + + CRB_CLR_DONE(CRSW); + szero(cib, sizeof(M328_CIB)); + mcsb->mcsb_QHDP = 0; + sc->sc_qhp = 0; + cib->cib_NCQE = 10; + cib->cib_BURST = 0; + cib->cib_NVECT = sc->sc_ipl << 8; + cib->cib_NVECT |= sc->sc_nvec; + cib->cib_EVECT = sc->sc_ipl << 8; + cib->cib_EVECT |= sc->sc_evec; + cib->cib_PID = 0x07; + cib->cib_SID = 0x00; + cib->cib_CRBO = OFF(crb); + cib->cib_SELECT_msw = HI(SELECTION_TIMEOUT); + cib->cib_SELECT_lsw = LO(SELECTION_TIMEOUT); + cib->cib_WQ0TIMO_msw = HI(4); + cib->cib_WQ0TIMO_lsw = LO(4); + cib->cib_VMETIMO_msw = 0; /*HI(VME_BUS_TIMEOUT);*/ + cib->cib_VMETIMO_lsw = 0; /*LO(VME_BUS_TIMEOUT);*/ + cib->cib_SBRIV = sc->sc_ipl << 8; + cib->cib_SBRIV |= sc->sc_evec; + cib->cib_SOF0 = 0x15; + cib->cib_SRATE0 = 100/4; + cib->cib_SOF1 = 0x0; + cib->cib_SRATE1 = 0x0; + + iopb = (M328_IOPB *)&sc->sc_vsreg->sh_MCE_IOPB; + szero(iopb, sizeof(M328_IOPB)); + iopb->iopb_CMD = CNTR_INIT; + iopb->iopb_OPTION = 0; + iopb->iopb_NVCT = (u_char)sc->sc_nvec; + iopb->iopb_EVCT = (u_char)sc->sc_evec; + iopb->iopb_LEVEL = 0; /*sc->sc_ipl;*/ + iopb->iopb_ADDR = SHIO_MOD; + LV(iopb->iopb_BUFF, OFF(cib)); + LV(iopb->iopb_LENGTH, sizeof(M328_CIB)); + + szero(mc, sizeof(M328_CQE)); + mc->cqe_IOPB_ADDR = OFF(iopb); + mc->cqe_IOPB_LENGTH = sizeof(M328_IOPB); + mc->cqe_WORK_QUEUE = 0; + mc->cqe_QECR = M_QECR_GO; + /* poll for the command to complete */ + do_vspoll(sc, 0); + CRB_CLR_DONE(CRSW); + + /* initialize work queues */ + for (i=1; i<8; i++) { + szero(wiopb, sizeof(M328_IOPB)); + wiopb->wqcf_CMD = CNTR_INIT_WORKQ; + wiopb->wqcf_OPTION = 0; + wiopb->wqcf_NVCT = (u_char)sc->sc_nvec; + wiopb->wqcf_EVCT = (u_char)sc->sc_evec; + wiopb->wqcf_ILVL = 0; /*sc->sc_ipl;*/ + wiopb->wqcf_WORKQ = i; + wiopb->wqcf_WOPT = (WQO_FOE | WQO_INIT); + wiopb->wqcf_SLOTS = JAGUAR_MAX_Q_SIZ; + LV(wiopb->wqcf_CMDTO, 2); + + szero(mc, sizeof(M328_CQE)); + mc->cqe_IOPB_ADDR = OFF(wiopb); + mc->cqe_IOPB_LENGTH = sizeof(M328_IOPB); + mc->cqe_WORK_QUEUE = 0; + mc->cqe_QECR = M_QECR_GO; + /* poll for the command to complete */ + do_vspoll(sc, 0); + if (CRSW & M_CRSW_ER) { + /*printf("\nerror: queue %d status = 0x%x\n", + i, riopb->iopb_STATUS);*/ + /*failed = 1;*/ + CRB_CLR_ER(CRSW); + } + CRB_CLR_DONE(CRSW); + delay(500); + } + /* start queue mode */ + CRSW = 0; + mcsb->mcsb_MCR |= M_MCR_SQM; + crsw = CRSW; + do_vspoll(sc, 0); + if (CRSW & M_CRSW_ER) { + printf("error: status = 0x%x\n", riopb->iopb_STATUS); + CRB_CLR_ER(CRSW); + } + CRB_CLR_DONE(CRSW); + + if (failed) { + printf(": failed!\n"); + return; + } + /* reset SCSI bus */ + vs_reset(sc); + /* sync all devices */ + vs_resync(sc); + printf(": target %d\n", sc->sc_link.adapter_target); } void vs_resync(sc) -struct vs_softc *sc; + struct vs_softc *sc; { - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_DRCF *devreset = (M328_DRCF *)&sc->sc_vsreg->sh_MCE_IOPB; - u_short i; - - for (i=0; i<7; i++) { - szero(devreset, sizeof(M328_DRCF)); - devreset->drcf_CMD = CNTR_DEV_REINIT; - devreset->drcf_OPTION = 0x00; /* no interrupts yet... */ - devreset->drcf_NVCT = sc->sc_nvec; - devreset->drcf_EVCT = sc->sc_evec; - devreset->drcf_ILVL = 0; - devreset->drcf_UNIT = i; - - szero(mc, sizeof(M328_CQE)); - mc->cqe_IOPB_ADDR = OFF(devreset); - mc->cqe_IOPB_LENGTH = sizeof(M328_DRCF); - mc->cqe_WORK_QUEUE = 0; - mc->cqe_QECR = M_QECR_GO; - /* poll for the command to complete */ - do_vspoll(sc, 0); - if (riopb->iopb_STATUS) { - sc->sc_tinfo[i].avail = 0; - } else { - sc->sc_tinfo[i].avail = 1; - } - if (CRSW & M_CRSW_ER) { - CRB_CLR_ER(CRSW); - } - CRB_CLR_DONE(CRSW); - } + M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + M328_DRCF *devreset = (M328_DRCF *)&sc->sc_vsreg->sh_MCE_IOPB; + u_short i; + + for (i=0; i<7; i++) { + szero(devreset, sizeof(M328_DRCF)); + devreset->drcf_CMD = CNTR_DEV_REINIT; + devreset->drcf_OPTION = 0x00; /* no interrupts yet... */ + devreset->drcf_NVCT = sc->sc_nvec; + devreset->drcf_EVCT = sc->sc_evec; + devreset->drcf_ILVL = 0; + devreset->drcf_UNIT = i; + + szero(mc, sizeof(M328_CQE)); + mc->cqe_IOPB_ADDR = OFF(devreset); + mc->cqe_IOPB_LENGTH = sizeof(M328_DRCF); + mc->cqe_WORK_QUEUE = 0; + mc->cqe_QECR = M_QECR_GO; + /* poll for the command to complete */ + do_vspoll(sc, 0); + if (riopb->iopb_STATUS) { + sc->sc_tinfo[i].avail = 0; + } else { + sc->sc_tinfo[i].avail = 1; + } + if (CRSW & M_CRSW_ER) { + CRB_CLR_ER(CRSW); + } + CRB_CLR_DONE(CRSW); + } } void vs_reset(sc) -struct vs_softc *sc; + struct vs_softc *sc; { - struct vsreg * rp; - u_int s; - u_char i; - struct iopb_reset* iopr; - struct cqe *cqep; - struct iopb_scsi *iopbs; - struct scsi_sense *ss; - M328_CIB *cib = (M328_CIB *)&sc->sc_vsreg->sh_CIB; - M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - M328_MCSB *mcsb = (M328_MCSB *)&sc->sc_vsreg->sh_MCSB; - M328_SRCF *reset = (M328_SRCF *)&sc->sc_vsreg->sh_MCE_IOPB; - M328_IOPB *iopb; - - szero(reset, sizeof(M328_SRCF)); - reset->srcf_CMD = IOPB_RESET; - reset->srcf_OPTION = 0x00; /* no interrupts yet... */ - reset->srcf_NVCT = sc->sc_nvec; - reset->srcf_EVCT = sc->sc_evec; - reset->srcf_ILVL = 0; - reset->srcf_BUSID = 0; - s = splbio(); - - szero(mc, sizeof(M328_CQE)); - mc->cqe_IOPB_ADDR = OFF(reset); - mc->cqe_IOPB_LENGTH = sizeof(M328_SRCF); - mc->cqe_WORK_QUEUE = 0; - mc->cqe_QECR = M_QECR_GO; - /* poll for the command to complete */ - while (1) { - do_vspoll(sc, 0); - /* ack & clear scsi error condition cause by reset */ - if (CRSW & M_CRSW_ER) { - CRB_CLR_ER(CRSW); - CRB_CLR_DONE(CRSW); - riopb->iopb_STATUS = 0; - break; - } - CRB_CLR_DONE(CRSW); - } - /* thaw all work queues */ - thaw_queue(sc, 0xFF); - splx (s); + u_int s; + M328_CQE *mc = (M328_CQE*)&sc->sc_vsreg->sh_MCE; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + M328_SRCF *reset = (M328_SRCF *)&sc->sc_vsreg->sh_MCE_IOPB; + + szero(reset, sizeof(M328_SRCF)); + reset->srcf_CMD = IOPB_RESET; + reset->srcf_OPTION = 0x00; /* no interrupts yet... */ + reset->srcf_NVCT = sc->sc_nvec; + reset->srcf_EVCT = sc->sc_evec; + reset->srcf_ILVL = 0; + reset->srcf_BUSID = 0; + s = splbio(); + + szero(mc, sizeof(M328_CQE)); + mc->cqe_IOPB_ADDR = OFF(reset); + mc->cqe_IOPB_LENGTH = sizeof(M328_SRCF); + mc->cqe_WORK_QUEUE = 0; + mc->cqe_QECR = M_QECR_GO; + /* poll for the command to complete */ + for (;;) { + do_vspoll(sc, 0); + /* ack & clear scsi error condition cause by reset */ + if (CRSW & M_CRSW_ER) { + CRB_CLR_ER(CRSW); + CRB_CLR_DONE(CRSW); + riopb->iopb_STATUS = 0; + break; + } + CRB_CLR_DONE(CRSW); + } + /* thaw all work queues */ + thaw_queue(sc, 0xFF); + splx(s); } - /* * Process an interrupt from the MVME328 * We'll generally update: xs->{flags,resid,error,sense,status} and @@ -693,138 +681,139 @@ struct vs_softc *sc; int vs_checkintr(sc, xs, status) -struct vs_softc *sc; -struct scsi_xfer *xs; -int *status; + struct vs_softc *sc; + struct scsi_xfer *xs; + int *status; { - struct vsreg * rp = sc->sc_vsreg; - int target = -1; - int lun = -1; - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; - struct scsi_generic *cmd; - u_long buf; - u_long len; - u_char error; - - target = xs->sc_link->target; - lun = xs->sc_link->lun; - cmd = (struct scsi_generic *)&riopb->iopb_SCSI[0]; - - VL(buf, riopb->iopb_BUFF); - VL(len, riopb->iopb_LENGTH); - *status = riopb->iopb_STATUS >> 8; - error = riopb->iopb_STATUS & 0xFF; + int target = -1; + int lun = -1; + M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; + struct scsi_generic *cmd; + u_long buf; + u_long len; + u_char error; + + target = xs->sc_link->target; + lun = xs->sc_link->lun; + cmd = (struct scsi_generic *)&riopb->iopb_SCSI[0]; + + VL(buf, riopb->iopb_BUFF); + VL(len, riopb->iopb_LENGTH); + *status = riopb->iopb_STATUS >> 8; + error = riopb->iopb_STATUS & 0xFF; #ifdef SDEBUG - printf("scsi_chk() "); - - if (xs->cmd->opcode == 0) { - printf("TEST_UNIT_READY "); - } else if (xs->cmd->opcode == REQUEST_SENSE) { - printf("REQUEST_SENSE "); - } else if (xs->cmd->opcode == INQUIRY) { - printf("INQUIRY "); - } else if (xs->cmd->opcode == MODE_SELECT) { - printf("MODE_SELECT "); - } else if (xs->cmd->opcode == MODE_SENSE) { - printf("MODE_SENSE "); - } else if (xs->cmd->opcode == START_STOP) { - printf("START_STOP "); - } else if (xs->cmd->opcode == RESERVE) { - printf("RESERVE "); - } else if (xs->cmd->opcode == RELEASE) { - printf("RELEASE "); - } else if (xs->cmd->opcode == PREVENT_ALLOW) { - printf("PREVENT_ALLOW "); - } else if (xs->cmd->opcode == POSITION_TO_ELEMENT) { - printf("POSITION_TO_EL "); - } else if (xs->cmd->opcode == CHANGE_DEFINITION) { - printf("CHANGE_DEF "); - } else if (xs->cmd->opcode == MODE_SENSE_BIG) { - printf("MODE_SENSE_BIG "); - } else if (xs->cmd->opcode == MODE_SELECT_BIG) { - printf("MODE_SELECT_BIG "); - } else if (xs->cmd->opcode == 0x25) { - printf("READ_CAPACITY "); - } else if (xs->cmd->opcode == 0x08) { - printf("READ_COMMAND "); - } - - printf("tgt %d lun %d buf %x len %d status %x ", target, lun, buf, len, riopb->iopb_STATUS); - - if (CRSW & M_CRSW_EX) { - printf("[ex]"); - } - if (CRSW & M_CRSW_QMS) { - printf("[qms]"); - } - if (CRSW & M_CRSW_SC) { - printf("[sc]"); - } - if (CRSW & M_CRSW_SE) { - printf("[se]"); - } - if (CRSW & M_CRSW_AQ) { - printf("[aq]"); - } - if (CRSW & M_CRSW_ER) { - printf("[er]"); - } - printf("\n"); + printf("scsi_chk() "); + + if (xs->cmd->opcode == 0) { + printf("TEST_UNIT_READY "); + } else if (xs->cmd->opcode == REQUEST_SENSE) { + printf("REQUEST_SENSE "); + } else if (xs->cmd->opcode == INQUIRY) { + printf("INQUIRY "); + } else if (xs->cmd->opcode == MODE_SELECT) { + printf("MODE_SELECT "); + } else if (xs->cmd->opcode == MODE_SENSE) { + printf("MODE_SENSE "); + } else if (xs->cmd->opcode == START_STOP) { + printf("START_STOP "); + } else if (xs->cmd->opcode == RESERVE) { + printf("RESERVE "); + } else if (xs->cmd->opcode == RELEASE) { + printf("RELEASE "); + } else if (xs->cmd->opcode == PREVENT_ALLOW) { + printf("PREVENT_ALLOW "); + } else if (xs->cmd->opcode == POSITION_TO_ELEMENT) { + printf("POSITION_TO_EL "); + } else if (xs->cmd->opcode == CHANGE_DEFINITION) { + printf("CHANGE_DEF "); + } else if (xs->cmd->opcode == MODE_SENSE_BIG) { + printf("MODE_SENSE_BIG "); + } else if (xs->cmd->opcode == MODE_SELECT_BIG) { + printf("MODE_SELECT_BIG "); + } else if (xs->cmd->opcode == 0x25) { + printf("READ_CAPACITY "); + } else if (xs->cmd->opcode == 0x08) { + printf("READ_COMMAND "); + } + + printf("tgt %d lun %d buf %x len %d status %x ", + target, lun, buf, len, riopb->iopb_STATUS); + + if (CRSW & M_CRSW_EX) { + printf("[ex]"); + } + if (CRSW & M_CRSW_QMS) { + printf("[qms]"); + } + if (CRSW & M_CRSW_SC) { + printf("[sc]"); + } + if (CRSW & M_CRSW_SE) { + printf("[se]"); + } + if (CRSW & M_CRSW_AQ) { + printf("[aq]"); + } + if (CRSW & M_CRSW_ER) { + printf("[er]"); + } + printf("\n"); #endif - if (len != xs->datalen) { - xs->resid = xs->datalen - len; - } else { - xs->resid = 0; - } - - if (error == SCSI_SELECTION_TO) { - xs->error = XS_SELTIMEOUT; - xs->status = -1; - *status = -1; - } - return 1; + if (len != xs->datalen) { + xs->resid = xs->datalen - len; + } else { + xs->resid = 0; + } + + if (error == SCSI_SELECTION_TO) { + xs->error = XS_SELTIMEOUT; + xs->status = -1; + *status = -1; + } + return 1; } -int -vs_intr (sc) -register struct vs_softc *sc; +void +vs_intr(arg) + void *arg; { - M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; - struct scsi_xfer *xs; - M328_CMD *m328_cmd; - unsigned long loc; - int status; - int s; - s = splbio(); - /* Got a valid interrupt on this device */ - - VL(loc, crb->crb_CTAG); + struct vs_softc *sc = (struct vs_softc *)arg; + M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; + struct scsi_xfer *xs; + M328_CMD *m328_cmd; + unsigned long loc; + int status; + int s; + + s = splbio(); + /* Got a valid interrupt on this device */ + + VL(loc, crb->crb_CTAG); #ifdef SDEBUG - printf("Interrupt!!! "); - printf("loc == 0x%x\n", loc); + printf("Interrupt!!! "); + printf("loc == 0x%x\n", loc); #endif - /* - * If this is a controller error, there won't be a m328_cmd - * pointer in the CTAG feild. Bad things happen if you try - * to point to address 0. Controller error should be handeled - * in vsdma.c I'll change this soon - steve. - */ - if (loc) { - m328_cmd = (M328_CMD *)loc; - xs = m328_cmd->xs; - if (m328_cmd->top_sg_list) { - vs_dealloc_scatter_gather(m328_cmd->top_sg_list); - m328_cmd->top_sg_list = (M328_SG)0; - } + /* + * If this is a controller error, there won't be a m328_cmd + * pointer in the CTAG feild. Bad things happen if you try + * to point to address 0. Controller error should be handeled + * in vsdma.c I'll change this soon - steve. + */ + if (loc) { + m328_cmd = (M328_CMD *)loc; + xs = m328_cmd->xs; + if (m328_cmd->top_sg_list) { + vs_dealloc_scatter_gather(m328_cmd->top_sg_list); + m328_cmd->top_sg_list = (M328_SG)0; + } - FREE(m328_cmd, M_DEVBUF); /* free the command tag */ - if (vs_checkintr (sc, xs, &status)) { - vs_scsidone(xs, status); - } - } - splx(s); + FREE(m328_cmd, M_DEVBUF); /* free the command tag */ + if (vs_checkintr (sc, xs, &status)) { + vs_scsidone(xs, status); + } + } + splx(s); } /* @@ -832,188 +821,219 @@ register struct vs_softc *sc; */ M328_SG -vs_alloc_scatter_gather(void) +vs_alloc_scatter_gather() { - M328_SG sg; + M328_SG sg; - MALLOC(sg, M328_SG, sizeof(struct m328_sg), M_DEVBUF, M_WAITOK); - bzero(sg, sizeof(struct m328_sg)); + MALLOC(sg, M328_SG, sizeof(struct m328_sg), M_DEVBUF, M_WAITOK); + bzero(sg, sizeof(struct m328_sg)); - return (sg); + return (sg); } void -vs_dealloc_scatter_gather(M328_SG sg) +vs_dealloc_scatter_gather(sg) + M328_SG sg; { - register int i; - - if (sg->level > 0) { - for (i=0; sg->down[i] && i<MAX_SG_ELEMENTS; i++) { - vs_dealloc_scatter_gather(sg->down[i]); - } - } - FREE(sg, M_DEVBUF); + int i; + + if (sg->level > 0) { + for (i = 0; sg->down[i] && i<MAX_SG_ELEMENTS; i++) { + vs_dealloc_scatter_gather(sg->down[i]); + } + } + FREE(sg, M_DEVBUF); } void -vs_link_sg_element(sg_list_element_t * element, - register vm_offset_t phys_add, - register int len) +vs_link_sg_element(element, phys_add, len) + sg_list_element_t *element; + vaddr_t phys_add; + int len; { - element->count.bytes = len; - LV(element->address, phys_add); - element->link = 0; /* FALSE */ - element->transfer_type = NORMAL_TYPE; - element->memory_type = LONG_TRANSFER; - element->address_modifier = 0xD; + + element->count.bytes = len; + LV(element->address, phys_add); + element->link = 0; /* FALSE */ + element->transfer_type = NORMAL_TYPE; + element->memory_type = LONG_TRANSFER; + element->address_modifier = 0xD; } void -vs_link_sg_list(sg_list_element_t * list, - register vm_offset_t phys_add, - register int elements) +vs_link_sg_list(list, phys_add, elements) + sg_list_element_t *list; + vaddr_t phys_add; + int elements; { - list->count.scatter.gather = elements; - LV(list->address, phys_add); - list->link = 1; /* TRUE */ - list->transfer_type = NORMAL_TYPE; - list->memory_type = LONG_TRANSFER; - list->address_modifier = 0xD; + list->count.scatter.gather = elements; + LV(list->address, phys_add); + list->link = 1; /* TRUE */ + list->transfer_type = NORMAL_TYPE; + list->memory_type = LONG_TRANSFER; + list->address_modifier = 0xD; } - M328_SG vs_build_memory_structure(xs, iopb) -struct scsi_xfer *xs; -M328_IOPB *iopb; /* the iopb */ + struct scsi_xfer *xs; + M328_IOPB *iopb; /* the iopb */ { - M328_SG sg; - vm_offset_t starting_point_virt, starting_point_phys, point_virt, - point1_phys, point2_phys, virt; - unsigned len; - int level; - - sg = (M328_SG)0; /* Hopefully we need no scatter/gather list */ - - /* - * We have the following things: - * virt the virtuell address of the contiguous virtual memory block - * len the lenght of the contiguous virtual memory block - * starting_point_virt the virtual address of the contiguous *physical* memory block - * starting_point_phys the *physical* address of the contiguous *physical* memory block - * point_virt the pointer to the virtual memory we are checking at the moment - * point1_phys the pointer to the *physical* memory we are checking at the moment - * point2_phys the pointer to the *physical* memory we are checking at the moment - */ + M328_SG sg; + vaddr_t starting_point_virt, point_virt, virt; + paddr_t starting_point_phys, point1_phys, point2_phys; + u_int len; + int level; + + sg = (M328_SG)0; /* Hopefully we need no scatter/gather list */ + + /* + * We have the following things: + * virt the virtual address of the contiguous virtual + * memory block + * len the length of the contiguous virtual memory + * block + * starting_point_virt the virtual address of the contiguous + * *physical* memory block + * starting_point_phys the *physical* address of the contiguous + * *physical* memory block + * point_virt the pointer to the virtual memory we are + * checking at the moment + * point1_phys the pointer to the *physical* memory we are + * checking at the moment + * point2_phys the pointer to the *physical* memory we are + * checking at the moment + */ - level = 0; - virt = starting_point_virt = (vm_offset_t)xs->data; - point1_phys = starting_point_phys = kvtop(xs->data); - len = xs->datalen; - /* - * Check if we need scatter/gather - */ - - if (len > PAGE_SIZE) { - for (level = 0, point_virt = round_page(starting_point_virt+1); - /* if we do already scatter/gather we have to stay in the loop and jump */ - point_virt < virt + (vm_offset_t)len || sg ; - point_virt += PAGE_SIZE) { /* out later */ - - point2_phys = kvtop(point_virt); - - if ((point2_phys - trunc_page(point1_phys) - PAGE_SIZE) || /* physical memory is not contiguous */ - (point_virt - starting_point_virt >= MAX_SG_BLOCK_SIZE && sg)) { /* we only can access (1<<16)-1 bytes in scatter/gather_mode */ - if (point_virt - starting_point_virt >= MAX_SG_BLOCK_SIZE) { /* We were walking too far for one scatter/gather block ... */ - assert( MAX_SG_BLOCK_SIZE > PAGE_SIZE ); - point_virt = trunc_page(starting_point_virt+MAX_SG_BLOCK_SIZE-1); /* So go back to the beginning of the last matching page */ - /* and gererate the physadress of this location for the next time. */ - point2_phys = kvtop(point_virt); - } - - if (!sg) { - /* We allocate our fist scatter/gather list */ - sg = vs_alloc_scatter_gather(); - } + level = 0; + virt = starting_point_virt = (vaddr_t)xs->data; + point1_phys = starting_point_phys = kvtop((vaddr_t)xs->data); + len = xs->datalen; + + /* + * Check if we need scatter/gather + */ + if (len > PAGE_SIZE) { + for (level = 0, point_virt = round_page(starting_point_virt+1); + /* if we do already scatter/gather we have to stay in + the loop and jump */ + point_virt < virt + (vaddr_t)len || sg; + point_virt += PAGE_SIZE) { /* out later */ + + point2_phys = kvtop(point_virt); + + if ((point2_phys - trunc_page(point1_phys) - PAGE_SIZE) || + /* physical memory is not contiguous */ + (point_virt - starting_point_virt >= + MAX_SG_BLOCK_SIZE && sg)) { + /* we only can access (1<<16)-1 bytes in + scatter/gather_mode */ + if (point_virt - starting_point_virt >= + MAX_SG_BLOCK_SIZE) { + /* We were walking too far for one + scatter/gather block ... */ + assert( MAX_SG_BLOCK_SIZE > PAGE_SIZE ); + point_virt = + trunc_page(starting_point_virt + + MAX_SG_BLOCK_SIZE-1); + /* So go back to the beginning of the + last matching page and gererate the + physadress of this location for the + next time. */ + point2_phys = kvtop(point_virt); + } + + if (!sg) { + /* We allocate our fist scatter/gather + list */ + sg = vs_alloc_scatter_gather(); + } #if 1 /* broken firmware */ - - if (sg->elements >= MAX_SG_ELEMENTS) { - vs_dealloc_scatter_gather(sg); - return (NULL); - } - + if (sg->elements >= MAX_SG_ELEMENTS) { + vs_dealloc_scatter_gather(sg); + return (NULL); + } #else /* if the firmware will ever get fixed */ - while (sg->elements >= MAX_SG_ELEMENTS) { - if (!sg->up) { /* If the list full in this layer ? */ - sg->up = vs_alloc_scatter_gather(); - sg->up->level = sg->level+1; - sg->up->down[0] = sg; - sg->up->elements = 1; - } - /* link this full list also in physical memory */ - vs_link_sg_list(&(sg->up->list[sg->up->elements-1]), - kvtop((vm_offset_t)sg->list), - sg->elements); - sg = sg->up; /* Climb up */ - } - while (sg->level) { /* As long as we are not a the base level */ - register int i; - - i = sg->elements; - /* We need a new element */ - sg->down[i] = vs_alloc_scatter_gather(); - sg->down[i]->level = sg->level - 1; - sg->down[i]->up = sg; - sg->elements++; - sg = sg->down[i]; /* Climb down */ - } + while (sg->elements >= MAX_SG_ELEMENTS) { + /* If the list full in this layer ? */ + if (!sg->up) { + sg->up = + vs_alloc_scatter_gather(); + sg->up->level = sg->level+1; + sg->up->down[0] = sg; + sg->up->elements = 1; + } + /* link this full list also in physical + memory */ + vs_link_sg_list( + &(sg->up->list[ + sg->up->elements - 1]), + kvtop((vaddr_t)sg->list), + sg->elements); + sg = sg->up; /* Climb up */ + } + /* As long as we are not a the base level */ + while (sg->level) { + int i; + + i = sg->elements; + /* We need a new element */ + sg->down[i] = + vs_alloc_scatter_gather(); + sg->down[i]->level = sg->level - 1; + sg->down[i]->up = sg; + sg->elements++; + sg = sg->down[i]; /* Climb down */ + } #endif /* 1 */ - if (point_virt < virt+(vm_offset_t)len) { - /* linking element */ - vs_link_sg_element(&(sg->list[sg->elements]), - starting_point_phys, - point_virt-starting_point_virt); - sg->elements++; - } else { - /* linking last element */ - vs_link_sg_element(&(sg->list[sg->elements]), - starting_point_phys, - (vm_offset_t)(virt+len)-starting_point_virt); - sg->elements++; - break; /* We have now collected all blocks */ - } - starting_point_virt = point_virt; - starting_point_phys = point2_phys; - } - point1_phys = point2_phys; - } - } - - /* - * Climb up along the right side of the tree until we reach the top. - */ - - if (sg) { - while (sg->up) { - /* link this list also in physical memory */ - vs_link_sg_list(&(sg->up->list[sg->up->elements-1]), - kvtop((vm_offset_t)sg->list), - sg->elements); - sg = sg->up; /* Climb up */ - } - - iopb->iopb_OPTION |= M_OPT_SG; - iopb->iopb_ADDR |= M_ADR_SG_LINK; - LV(iopb->iopb_BUFF, kvtop((vm_offset_t)sg->list)); - LV(iopb->iopb_LENGTH, sg->elements); - LV(iopb->iopb_SGTTL, len); - } else { - /* no scatter/gather neccessary */ - LV(iopb->iopb_BUFF, starting_point_phys); - LV(iopb->iopb_LENGTH, len); - } - return (sg); + if (point_virt < virt+(vaddr_t)len) { + /* linking element */ + vs_link_sg_element( + &(sg->list[sg->elements]), + starting_point_phys, + point_virt-starting_point_virt); + sg->elements++; + } else { + /* linking last element */ + vs_link_sg_element( + &(sg->list[sg->elements]), + starting_point_phys, + (vaddr_t)(virt + len) - + starting_point_virt); + sg->elements++; + break; + /* We have now collected all blocks */ + } + starting_point_virt = point_virt; + starting_point_phys = point2_phys; + } + point1_phys = point2_phys; + } + } + + /* + * Climb up along the right side of the tree until we reach the top. + */ + + if (sg) { + while (sg->up) { + /* link this list also in physical memory */ + vs_link_sg_list(&(sg->up->list[sg->up->elements-1]), + kvtop((vaddr_t)sg->list), sg->elements); + sg = sg->up; /* Climb up */ + } + + iopb->iopb_OPTION |= M_OPT_SG; + iopb->iopb_ADDR |= M_ADR_SG_LINK; + LV(iopb->iopb_BUFF, kvtop((vaddr_t)sg->list)); + LV(iopb->iopb_LENGTH, sg->elements); + LV(iopb->iopb_SGTTL, len); + } else { + /* no scatter/gather neccessary */ + LV(iopb->iopb_BUFF, starting_point_phys); + LV(iopb->iopb_LENGTH, len); + } + return (sg); } - diff --git a/sys/arch/mvme68k/dev/vsdma.c b/sys/arch/mvme68k/dev/vsdma.c index 68ca1a7279b..5769a128bdf 100644 --- a/sys/arch/mvme68k/dev/vsdma.c +++ b/sys/arch/mvme68k/dev/vsdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vsdma.c,v 1.4 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vsdma.c,v 1.5 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. @@ -62,8 +62,8 @@ void vsattach(struct device *, struct device *, void *); int vsprint(void *auxp, char *); void vs_initialize(struct vs_softc *); int vs_intr(struct vs_softc *); -int vs_nintr(struct vs_softc *); -int vs_eintr(struct vs_softc *); +int vs_nintr(void *); +int vs_eintr(void *); struct scsi_adapter vs_scsiswitch = { vs_scsicmd, @@ -92,9 +92,8 @@ vsmatch(pdp, vcf, args) struct device *pdp; void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; - return(!badvaddr(ca->ca_vaddr, 1)); + return(!badvaddr((vaddr_t)ca->ca_vaddr, 1)); } void @@ -106,7 +105,6 @@ vsattach(parent, self, auxp) struct confargs *ca = auxp; struct vsreg * rp; int tmp; - extern int cpuspeed; sc->sc_vsreg = rp = ca->ca_vaddr; @@ -160,9 +158,11 @@ vsprint(auxp, pnp) /* normal interrupt function */ int -vs_nintr(sc) - struct vs_softc *sc; +vs_nintr(arg) + void *arg; { + struct vs_softc *sc = (struct vs_softc *)arg; + #ifdef SDEBUG printf("Normal Interrupt!!!\n"); #endif @@ -173,9 +173,11 @@ vs_nintr(sc) /* error interrupt function */ int -vs_eintr(sc) - struct vs_softc *sc; +vs_eintr(arg) + void *arg; { + struct vs_softc *sc = (struct vs_softc *)arg; + #ifdef SDEBUG printf("Error Interrupt!!!\n"); #endif diff --git a/sys/arch/mvme68k/dev/vsvar.h b/sys/arch/mvme68k/dev/vsvar.h index 0863e66302e..4095e672462 100644 --- a/sys/arch/mvme68k/dev/vsvar.h +++ b/sys/arch/mvme68k/dev/vsvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vsvar.h,v 1.2 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: vsvar.h,v 1.3 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1990 The Regents of the University of California. @@ -47,7 +47,7 @@ #define DMAMAXIO (MAXPHYS/NBPG+1) #define LO(x) (u_short)((unsigned long)x & 0x0000FFFF) #define HI(x) (u_short)((unsigned long)x >> 16) -#define OFF(x) (u_short)((long)kvtop(x) - (long)kvtop(sc->sc_vsreg)) +#define OFF(x) (u_short)((long)kvtop((vaddr_t)x) - (long)kvtop((vaddr_t)sc->sc_vsreg)) struct vs_tinfo { int cmds; /* #commands processed */ diff --git a/sys/arch/mvme68k/dev/wdsc.c b/sys/arch/mvme68k/dev/wdsc.c index 407e761620c..877942d942b 100644 --- a/sys/arch/mvme68k/dev/wdsc.c +++ b/sys/arch/mvme68k/dev/wdsc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wdsc.c,v 1.6 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: wdsc.c,v 1.7 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1996 Steve Woodford @@ -55,8 +55,11 @@ void wdsc_enintr(struct sbic_softc *); int wdsc_dmago(struct sbic_softc *, char *, int, int); int wdsc_dmanext(struct sbic_softc *); void wdsc_dmastop(struct sbic_softc *); -int wdsc_dmaintr(struct sbic_softc *); -int wdsc_scsiintr(struct sbic_softc *); +int wdsc_dmaintr(void *); +int wdsc_scsiintr(void *); + +extern void sbicinit(struct sbic_softc *); +extern int sbicintr(struct sbic_softc *); struct scsi_adapter wdsc_scsiswitch = { sbic_scsicmd, @@ -114,7 +117,6 @@ wdscattach(pdp, dp, auxp) struct sbic_softc *sc = (struct sbic_softc *)dp; struct confargs *ca = auxp; struct pccreg *pcc = (struct pccreg *)ca->ca_master; - int ipl; int tmp; sc->sc_enintr = wdsc_enintr; @@ -287,9 +289,10 @@ wdsc_dmastop(dev) * Come here following a DMA interrupt */ int -wdsc_dmaintr(dev) - struct sbic_softc *dev; +wdsc_dmaintr(arg) + void *arg; { + struct sbic_softc *dev = (struct sbic_softc *)arg; volatile struct pccreg *pc = dev->sc_cregs; int found = 0; @@ -316,9 +319,10 @@ wdsc_dmaintr(dev) * Come here for SCSI interrupts */ int -wdsc_scsiintr(dev) - struct sbic_softc *dev; +wdsc_scsiintr(arg) + void *arg; { + struct sbic_softc *dev = (struct sbic_softc *)arg; volatile struct pccreg *pc = dev->sc_cregs; int found; diff --git a/sys/arch/mvme68k/dev/wl.c b/sys/arch/mvme68k/dev/wl.c index 15b9c02f714..14001fb7b6f 100644 --- a/sys/arch/mvme68k/dev/wl.c +++ b/sys/arch/mvme68k/dev/wl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wl.c,v 1.8 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: wl.c,v 1.9 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. @@ -31,7 +31,6 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/proc.h> #include <sys/tty.h> @@ -39,16 +38,20 @@ #include <sys/systm.h> #include <sys/time.h> #include <sys/device.h> -#include <machine/cpu.h> +#include <sys/syslog.h> + #include <machine/autoconf.h> +#include <machine/conf.h> +#include <machine/cpu.h> + #include <mvme68k/dev/wlreg.h> #include <mvme68k/dev/vme.h> -#include <sys/syslog.h> + #include "cl.h" #include "vmes.h" -#define splcl() spl3() +#define splcl() spltty() /* min timeout 0xa, what is a good value */ #define CL_TIMEOUT 0x10 @@ -187,13 +190,6 @@ void cl_dumpport(int channel); int wlprobe(struct device *parent, void *self, void *aux); void wlattach(struct device *parent, struct device *self, void *aux); -int wlopen(dev_t dev, int flag, int mode, struct proc *p); -int wlclose(dev_t dev, int flag, int mode, struct proc *p); -int wlread(dev_t dev, struct uio *uio, int flag); -int wlwrite(dev_t dev, struct uio *uio, int flag); -int wlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p); -int wlstop(struct tty *tp, int flag); - static void cl_initchannel(struct wlsoftc *sc, int channel); static void clputc(struct wlsoftc *sc, int unit, u_char c); static u_char clgetc(struct wlsoftc *sc, int *channel); @@ -504,7 +500,8 @@ int clmctl (dev, bits, how) return(bits); } -int wlopen (dev, flag, mode, p) +int +wlopen(dev, flag, mode, p) dev_t dev; int flag; int mode; @@ -645,7 +642,8 @@ void cloutput(tp) splx(s); } -int wlclose (dev, flag, mode, p) +int +wlclose(dev, flag, mode, p) dev_t dev; int flag; int mode; @@ -685,7 +683,8 @@ int wlclose (dev, flag, mode, p) return (0); } -int wlread (dev, uio, flag) +int +wlread(dev, uio, flag) dev_t dev; struct uio *uio; int flag; @@ -706,7 +705,8 @@ int wlread (dev, uio, flag) return ENXIO; return((*linesw[tp->t_line].l_read)(tp, uio, flag)); } -int wlwrite (dev, uio, flag) +int +wlwrite(dev, uio, flag) dev_t dev; struct uio *uio; int flag; @@ -727,9 +727,10 @@ int wlwrite (dev, uio, flag) return ENXIO; return((*linesw[tp->t_line].l_write)(tp, uio, flag)); } -int wlioctl (dev, cmd, data, flag, p) +int +wlioctl(dev, cmd, data, flag, p) dev_t dev; - int cmd; + u_long cmd; caddr_t data; int flag; struct proc *p; diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c index 1d2dc73a241..693625179fa 100644 --- a/sys/arch/mvme68k/dev/zs.c +++ b/sys/arch/mvme68k/dev/zs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: zs.c,v 1.10 2002/03/14 01:26:37 millert Exp $ */ +/* $OpenBSD: zs.c,v 1.11 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 2000 Steve Murphree, Jr. @@ -36,7 +36,6 @@ * Serial I/O via an SCC, */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/ioctl.h> #include <sys/proc.h> #include <sys/user.h> @@ -47,8 +46,11 @@ #include <sys/syslog.h> #include <sys/fcntl.h> #include <sys/device.h> -#include <machine/cpu.h> + #include <machine/autoconf.h> +#include <machine/conf.h> +#include <machine/cpu.h> + #include <dev/cons.h> #include <mvme68k/dev/scc.h> @@ -130,16 +132,15 @@ int zs_cons_unit = 0; int zs_is_console = 0; struct sccregs *zs_cons_scc; -int zsopen(dev_t, int, int, struct proc *); void zsstart(struct tty *); int zsparam(struct tty *, struct termios *); -int zsirq(int unit); +int zsirq(void *); int zsregs(void *va, int unit, volatile u_char **crp, volatile u_char **drp); int zspclk(void); u_long sir_zs; -void zs_softint(void); +void zs_softint(void *); #define zsunit(dev) (minor(dev) >> 1) #define zsside(dev) (minor(dev) & 1) @@ -158,12 +159,30 @@ struct cfdriver zs_cd = { NULL, "zs", DV_TTY, 0 }; +void zs_ttydef(struct zs *); +struct tty *zstty(dev_t); +void zs_init(struct zs *); +void zscc_init(struct zs *, struct termios *); +int zscc_params(struct sccregs *, struct termios *); +int zscc_mget(struct sccregs *); +void zscc_mset(struct sccregs *, int); +void zscc_mclr(struct sccregs *, int); +void zs_drain(struct zs *); +void zs_unblock(struct tty *); +void zs_txint(struct zs *); +void zs_rxint(struct zs *); +void zs_extint(struct zs *); +int zscnprobe(struct consdev *); +void zscninit(void); +int zscngetc(dev_t); +void zscnputc(dev_t, int); +void zs_cnsetup(int, struct termios *); + int zsmatch(parent, vcf, args) -struct device *parent; -void *vcf, *args; + struct device *parent; + void *vcf, *args; { - struct cfdata *cf = vcf; struct confargs *ca = args; unsigned char *zstest = (unsigned char *)ca->ca_vaddr; /* @@ -172,7 +191,7 @@ void *vcf, *args; * the second scc still checks valid and every byte contains 0xFF. So * this is what we test with for now. XXX - smurph */ - if (!badvaddr(ca->ca_vaddr, 1)) + if (!badvaddr((vaddr_t)ca->ca_vaddr, 1)) if (*zstest == 0xFF) return (0); else @@ -183,8 +202,8 @@ void *vcf, *args; void zsattach(parent, self, args) -struct device *parent, *self; -void *args; + struct device *parent, *self; + void *args; { struct zssoftc *sc; struct zs *zp, *zc; @@ -300,7 +319,7 @@ void *args; void zs_ttydef(zp) -struct zs *zp; + struct zs *zp; { struct tty *tp = zp->tty; @@ -325,7 +344,7 @@ struct zs *zp; struct tty * zstty(dev) -dev_t dev; + dev_t dev; { if (minor(dev) < NZSLINE) return (zs_tty[minor(dev)]); @@ -335,9 +354,9 @@ dev_t dev; /* ARGSUSED */ int zsopen(dev, flag, mode, p) -dev_t dev; -int flag, mode; -struct proc *p; + dev_t dev; + int flag, mode; + struct proc *p; { register struct tty *tp; int error; @@ -376,9 +395,9 @@ struct proc *p; int zsclose(dev, flag, mode, p) -dev_t dev; -int flag, mode; -struct proc *p; + dev_t dev; + int flag, mode; + struct proc *p; { struct zs *zp; struct tty *tp; @@ -405,9 +424,9 @@ struct proc *p; /*ARGSUSED*/ int zsread(dev, uio, flag) -dev_t dev; -struct uio *uio; -int flag; + dev_t dev; + struct uio *uio; + int flag; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(dev)]; struct zs *zp = &sc->sc_zs[zsside(dev)]; @@ -419,9 +438,9 @@ int flag; /*ARGSUSED*/ int zswrite(dev, uio, flag) -dev_t dev; -struct uio *uio; -int flag; + dev_t dev; + struct uio *uio; + int flag; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(dev)]; struct zs *zp = &sc->sc_zs[zsside(dev)]; @@ -432,10 +451,11 @@ int flag; int zsioctl(dev, cmd, data, flag, p) -dev_t dev; -caddr_t data; -int cmd, flag; -struct proc *p; + dev_t dev; + u_long cmd; + caddr_t data; + int flag; + struct proc *p; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(dev)]; struct zs *zp = &sc->sc_zs[zsside(dev)]; @@ -491,8 +511,8 @@ struct proc *p; int zsparam(tp, t) -struct tty *tp; -struct termios *t; + struct tty *tp; + struct termios *t; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(tp->t_dev)]; struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; @@ -516,7 +536,7 @@ struct termios *t; void zsstart(tp) -struct tty *tp; + struct tty *tp; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(tp->t_dev)]; struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; @@ -539,9 +559,10 @@ struct tty *tp; splx(s); } +int zsstop(tp, flag) -struct tty *tp; -int flag; + struct tty *tp; + int flag; { struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[zsunit(tp->t_dev)]; struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)]; @@ -564,10 +585,12 @@ int flag; } } splx(s); + return (0); } +void zs_init(zp) -struct zs *zp; + struct zs *zp; { register int s; @@ -580,15 +603,16 @@ struct zs *zp; splx(s); } +void zscc_init(zp, par) -struct zs *zp; -struct termios *par; + struct zs *zp; + struct termios *par; { struct sccregs *scc; scc = &zp->scc; -#ifdef MVME162 - if (cputyp == CPU_162) +#if defined(MVME162) || defined(MVME172) + if (cputyp == CPU_162 || cputyp == CPU_172) ZWRITE(scc, 2, MC_VECBASE+MCV_ZS); #endif ZWRITE(scc, 10, 0); @@ -601,8 +625,8 @@ struct termios *par; int zscc_params(scc, par) -struct sccregs *scc; -struct termios *par; + struct sccregs *scc; + struct termios *par; { unsigned divisor, speed; int spd, imask, ints; @@ -650,7 +674,7 @@ struct termios *par; if ((par->c_cflag & CCTS_OFLOW) != 0) ints |= SCC_CTS; #if 0 - if (cputyp == CPU_162) { + if (cputyp == CPU_162 || cputyp == CPU_172) { ZWRITE(scc, 15, ints | 1); /* * now.. register 7 has become register 7': disable all @@ -663,8 +687,9 @@ struct termios *par; return (imask); } +int zscc_mget(scc) -register struct sccregs *scc; + register struct sccregs *scc; { int bits = 0, rr0; @@ -682,9 +707,10 @@ register struct sccregs *scc; return (bits); } +void zscc_mset(scc, bits) -register struct sccregs *scc; -int bits; + register struct sccregs *scc; + int bits; { if ((bits & TIOCM_LE) != 0) ZBIS(scc, 3, SCC_RCVEN); @@ -694,9 +720,10 @@ int bits; ZBIS(scc, 5, SCC_RTS); } +void zscc_mclr(scc, bits) -register struct sccregs *scc; -int bits; + register struct sccregs *scc; + int bits; { if ((bits & TIOCM_LE) != 0) ZBIC(scc, 3, SCC_RCVEN); @@ -706,8 +733,9 @@ int bits; ZBIC(scc, 5, SCC_RTS); } +void zs_drain(zp) -register struct zs *zp; + register struct zs *zp; { register int s; @@ -723,8 +751,9 @@ register struct zs *zp; splx(s); } +void zs_unblock(tp) -register struct tty *tp; + register struct tty *tp; { tp->t_state &= ~TS_DRAIN; if (tp->t_outq.c_cc != 0) @@ -735,12 +764,13 @@ register struct tty *tp; * Hardware interrupt from an SCC. */ int -zsirq(unit) -int unit; +zsirq(arg) + void *arg; { + int unit = (int)arg; struct zssoftc *sc = (struct zssoftc *) zs_cd.cd_devs[unit]; - register struct zs *zp = &sc->sc_zs[0]; - register int ipend, x; + struct zs *zp = &sc->sc_zs[0]; + int ipend; ipend = ZREAD(&zp->scc, 3); /* read int pending from A side */ if (ipend == 0) @@ -764,10 +794,10 @@ int unit; return (1); } +void zs_txint(zp) -register struct zs *zp; + register struct zs *zp; { - struct tty *tp = zp->tty; struct sccregs *scc; int c; u_char *get; @@ -791,8 +821,9 @@ register struct zs *zp; } } +void zs_rxint(zp) -register struct zs *zp; + register struct zs *zp; { register int stat, c, n, extra; u_char *put; @@ -838,8 +869,9 @@ register struct zs *zp; } /* Ext/status interrupt */ +void zs_extint(zp) -register struct zs *zp; + register struct zs *zp; { int rr0; struct tty *tp = zp->tty; @@ -861,10 +893,12 @@ register struct zs *zp; setsoftint(sir_zs); } +/* ARGSUSED */ void -zs_softint() +zs_softint(arg) + void *arg; { - int s, n, n0, c, stat, rr0; + int s, c, stat, rr0; struct zs *zp; struct tty *tp; u_char *get; @@ -965,14 +999,16 @@ zs_softint() */ /* probe for the SCC; should check hardware */ +int zscnprobe(cp) -struct consdev *cp; + struct consdev *cp; { int maj; switch (cputyp) { case CPU_147: case CPU_162: + case CPU_172: break; default: cp->cn_pri = CN_DEAD; @@ -1005,6 +1041,7 @@ struct termios zscn_termios = { struct sccregs zs_cons_sccregs; int zs_cons_imask; +void zscninit() { zs_cnsetup(0, &zscn_termios); @@ -1013,7 +1050,7 @@ zscninit() /* Polling routine for console input from a serial port. */ int zscngetc(dev) -dev_t dev; + dev_t dev; { register struct sccregs *scc = zs_cons_scc; int c, s, stat; @@ -1033,9 +1070,10 @@ dev_t dev; return (c); } +void zscnputc(dev, c) -dev_t dev; -int c; + dev_t dev; + int c; { register struct sccregs *scc = zs_cons_scc; int s; @@ -1047,9 +1085,10 @@ int c; splx(s); } +void zs_cnsetup(unit, tiop) -int unit; -struct termios *tiop; + int unit; + struct termios *tiop; { volatile u_char *scc_cr, *scc_dr; struct sccregs *scc; @@ -1076,8 +1115,8 @@ struct termios *tiop; scc->s_cr = scc_cr; scc->s_dr = scc_dr; -#ifdef MVME162 - if (cputyp == CPU_162) +#if defined(MVME162) || defined(MVME172) + if (cputyp == CPU_162 || cputyp == CPU_172) ZWRITE(scc, 2, MC_VECBASE+MCV_ZS); #endif ZWRITE(scc, 10, 0); @@ -1092,7 +1131,7 @@ struct termios *tiop; #ifdef MVME147 u_long zs_cons_addrs_147[] = { ZS0_PHYS_147, ZS1_PHYS_147}; #endif -#ifdef MVME162 +#if defined(MVME162) || defined(MVME172) u_long zs_cons_addrs_162[] = { ZS0_PHYS_162, ZS1_PHYS_162}; #endif @@ -1105,14 +1144,14 @@ u_long zs_cons_addrs_162[] = { ZS0_PHYS_162, ZS1_PHYS_162}; */ int zsregs(va, unit, crp, drp) -void *va; -int unit; -volatile u_char **crp, **drp; + void *va; + int unit; + volatile u_char **crp, **drp; { #ifdef MVME147 volatile struct scc_147 *scc_adr_147; #endif -#ifdef MVME162 +#if defined(MVME162) || defined(MVME172) volatile struct scc_162 *scc_adr_162; #endif volatile u_char *scc_cr, *scc_dr; @@ -1129,8 +1168,9 @@ volatile u_char **crp, **drp; size = sizeof(struct scc_147); break; #endif -#ifdef MVME162 +#if defined(MVME162) || defined(MVME172) case CPU_162: + case CPU_172: if (!va) va = (void *)IIOV(zs_cons_addrs_162[zsunit(unit)]); scc_adr_162 = (volatile struct scc_162 *)va; @@ -1154,9 +1194,12 @@ zspclk() case CPU_147: return (PCLK_FREQ_147); #endif -#ifdef MVME162 +#if defined(MVME162) || defined(MVME172) case CPU_162: + case CPU_172: return (PCLK_FREQ_162); #endif + default: + return 0; } } diff --git a/sys/arch/mvme68k/include/bugio.h b/sys/arch/mvme68k/include/bugio.h new file mode 100644 index 00000000000..2af0c26fc00 --- /dev/null +++ b/sys/arch/mvme68k/include/bugio.h @@ -0,0 +1,44 @@ +/* $OpenBSD: bugio.h,v 1.1 2002/04/27 23:21:05 miod Exp $ */ +/* + * Copyright (c) 2002, Miodrag Vallat. + * All rights reserved. + * + * Permission to redistribute, use, copy, and modify this software + * without fee is hereby granted, provided that the following + * conditions are met: + * + * 1. This entire notice is included in all source code copies of any + * software which is or includes a copy or modification of this + * software. + * 2. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_BUGIO_H_ +#define _MACHINE_BUGIO_H_ + +#include <sys/cdefs.h> + +#include <machine/prom.h> + +int bug_instat(void); +char bug_inchr(void); +void bug_outchr(char); +void bug_outstr(char *, char *); +void bug_return(void); +struct bug_brdid *bug_brdid(void); + +#endif /* _MACHINE_BUGIO_H_ */ diff --git a/sys/arch/mvme68k/include/conf.h b/sys/arch/mvme68k/include/conf.h new file mode 100644 index 00000000000..92763e018aa --- /dev/null +++ b/sys/arch/mvme68k/include/conf.h @@ -0,0 +1,48 @@ +/* $OpenBSD: conf.h,v 1.1 2002/04/27 23:21:05 miod Exp $ */ +/* + * Copyright (c) 2002, Miodrag Vallat. + * All rights reserved. + * + * Permission to redistribute, use, copy, and modify this software + * without fee is hereby granted, provided that the following + * conditions are met: + * + * 1. This entire notice is included in all source code copies of any + * software which is or includes a copy or modification of this + * software. + * 2. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE + * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/conf.h> + +#define mmread mmrw +#define mmwrite mmrw +cdev_decl(mm); + +cdev_decl(vmel); +cdev_decl(vmes); + +cdev_decl(flash); +cdev_decl(nvram); +cdev_decl(sram); + +cdev_decl(bugtty); +cdev_decl(cl); +cdev_decl(wl); +cdev_decl(zs); + +cdev_decl(lp); diff --git a/sys/arch/mvme68k/include/cpu.h b/sys/arch/mvme68k/include/cpu.h index c294452da6c..6ca9e45aaff 100644 --- a/sys/arch/mvme68k/include/cpu.h +++ b/sys/arch/mvme68k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.11 2002/04/25 22:18:20 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.12 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -137,7 +137,7 @@ struct clockframe { * Preempt the current process if in interrupt from user mode, * or after the current trap/syscall if in system mode. */ -int want_resched; +extern int want_resched; #define need_resched() { want_resched = 1; aston(); } /* @@ -153,7 +153,7 @@ int want_resched; */ #define signotify(p) aston() -int astpending; +extern int astpending; #define aston() (astpending = 1) extern char *intiobase, *intiolimit; @@ -193,17 +193,62 @@ extern int cputyp; struct intrhand { struct intrhand *ih_next; - int (*ih_fn)(); + int (*ih_fn)(void *); void *ih_arg; int ih_ipl; int ih_wantframe; }; +int intr_establish(int, struct intrhand *); + struct haltvec { struct haltvec *hv_next; void (*hv_fn)(void); int hv_pri; }; +struct frame; +struct fpframe; +struct pcb; + +void m68881_save(struct fpframe *); +void m68881_restore(struct fpframe *); +void DCIA(void); +void DCIS(void); +void DCIAS(vaddr_t); +void DCIU(void); +void ICIA(void); +void ICPA(void); +void PCIA(void); +void TBIA(void); +void TBIS(vaddr_t); +void TBIAS(void); +void TBIAU(void); +#if defined(M68040) +void DCFA(void); +void DCFP(paddr_t); +void DCFL(paddr_t); +void DCPL(paddr_t); +void DCPP(paddr_t); +void ICPL(paddr_t); +void ICPP(paddr_t); +#endif +int suline(caddr_t, caddr_t); +void savectx(struct pcb *); +void switch_exit(struct proc *); +__dead void doboot(void); +void loadustp(int); +void proc_trampoline(void); + +int badpaddr(paddr_t, int); +int badvaddr(vaddr_t, int); +void nmihand(void *); +int intr_findvec(int, int); + +void dma_cachectl(caddr_t, int); +paddr_t kvtop(vaddr_t); +void physaccess(vaddr_t, paddr_t, size_t, int); +void physunaccess(vaddr_t, size_t); + #endif /* _KERNEL */ #endif /* _MVME68K_CPU_H_ */ diff --git a/sys/arch/mvme68k/include/intr.h b/sys/arch/mvme68k/include/intr.h index f13dd140750..a395d966625 100644 --- a/sys/arch/mvme68k/include/intr.h +++ b/sys/arch/mvme68k/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.6 2002/03/14 03:15:56 millert Exp $ */ +/* $OpenBSD: intr.h,v 1.7 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (C) 2000 Steve Murphree, Jr. * All rights reserved. @@ -42,7 +42,7 @@ extern unsigned char ssir; #define setsoftint(x) ssir |= (x) #define setsoftnet() ssir |= SIR_NET #define setsoftclock() ssir |= SIR_CLOCK -u_long allocate_sir(void (*proc)(), void *arg); +u_long allocate_sir(void (*proc)(void *), void *arg); #define _spl(s) \ ({ \ diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h index a5bede421ac..67626190349 100644 --- a/sys/arch/mvme68k/include/param.h +++ b/sys/arch/mvme68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.17 2002/02/22 22:45:34 miod Exp $ */ +/* $OpenBSD: param.h,v 1.18 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -83,6 +83,7 @@ #ifdef _KERNEL +extern void delay(int); #define DELAY(n) delay(n) #endif diff --git a/sys/arch/mvme68k/include/prom.h b/sys/arch/mvme68k/include/prom.h index f9706a9a2f7..4eaff06c0a8 100644 --- a/sys/arch/mvme68k/include/prom.h +++ b/sys/arch/mvme68k/include/prom.h @@ -1,4 +1,4 @@ -/* $OpenBSD: prom.h,v 1.9 2001/06/12 22:53:16 miod Exp $ */ +/* $OpenBSD: prom.h,v 1.10 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -30,6 +30,8 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifndef _MACHINE_PROM_H_ +#define _MACHINE_PROM_H_ #define MVMEPROM_INCHR 0x00 #define MVMEPROM_INSTAT 0x01 @@ -190,3 +192,4 @@ struct mvmeprom_args { #define RB_NOSYM 0x4000 #endif +#endif /* _MACHINE_PROM_H_ */ diff --git a/sys/arch/mvme68k/mvme68k/autoconf.c b/sys/arch/mvme68k/mvme68k/autoconf.c index 917b53ace88..15851923aa5 100644 --- a/sys/arch/mvme68k/mvme68k/autoconf.c +++ b/sys/arch/mvme68k/mvme68k/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.17 2002/03/14 01:26:38 millert Exp $ */ +/* $OpenBSD: autoconf.c,v 1.18 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -96,8 +96,17 @@ #include <machine/cpu.h> #include <machine/pte.h> -struct device *parsedisk(char *, int, int, dev_t *); void setroot(void); +void swapconf(void); +int mainbus_print(void *, const char *); +int mainbus_scan(struct device *, void *, void *); +int findblkmajor(struct device *); +struct device *getdevunit(char *, int); +struct device *getdisk(char *, int, int, dev_t *); +struct device *parsedisk(char *, int, int, dev_t *); + +extern void init_sir(void); +extern void dumpconf(void); /* * XXX some storage space must be allocated statically because of @@ -224,7 +233,7 @@ mapiodev(pa, size) if (error != 0) return NULL; - physaccess(kva, pa, size, PG_RW|PG_CI); + physaccess((vaddr_t)kva, (paddr_t)pa, size, PG_RW|PG_CI); return (kva); } @@ -241,7 +250,7 @@ unmapiodev(kva, size) if (kva < extiobase || kva >= extiobase + ctob(EIOMAPSIZE)) panic("unmapiodev: bad address"); #endif - physunaccess(kva, size); + physunaccess((vaddr_t)kva, size); error = extent_free(extio, (u_long)kva, size, EX_NOWAIT); @@ -252,6 +261,7 @@ unmapiodev(kva, size) /* * Configure swap space and related parameters. */ +void swapconf() { register struct swdevt *swp; @@ -282,7 +292,7 @@ struct nam2blk { { "rd", 9 }, }; -static int +int findblkmajor(dv) struct device *dv; { @@ -295,7 +305,7 @@ findblkmajor(dv) return (-1); } -static struct device * +struct device * getdisk(str, len, defpart, devp) char *str; int len, defpart; diff --git a/sys/arch/mvme68k/mvme68k/conf.c b/sys/arch/mvme68k/mvme68k/conf.c index 4e3ba7ce802..3e897231a74 100644 --- a/sys/arch/mvme68k/mvme68k/conf.c +++ b/sys/arch/mvme68k/mvme68k/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.25 2001/12/11 23:19:02 miod Exp $ */ +/* $OpenBSD: conf.c,v 1.26 2002/04/27 23:21:05 miod Exp $ */ /*- * Copyright (c) 1995 Theo de Raadt @@ -69,9 +69,10 @@ #include <sys/buf.h> #include <sys/ioctl.h> #include <sys/tty.h> -#include <sys/conf.h> #include <sys/vnode.h> +#include <machine/conf.h> + #include "st.h" #include "sd.h" #include "cd.h" @@ -108,37 +109,19 @@ struct bdevsw bdevsw[] = }; int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); -#define mmread mmrw -#define mmwrite mmrw -cdev_decl(mm); - #include "sram.h" -cdev_decl(sram); - #include "vmel.h" -cdev_decl(vmel); - #include "vmes.h" -cdev_decl(vmes); - #include "nvram.h" -cdev_decl(nvram); - #include "flash.h" -cdev_decl(flash); #include "pty.h" cdev_decl(fd); #include "zs.h" -cdev_decl(zs); #include "cl.h" -cdev_decl(cl); #include "wl.h" -cdev_decl(wl); #include "bugtty.h" -cdev_decl(bugtty); - /* open, close, write, ioctl */ #define cdev_lp_init(c,n) { \ @@ -154,7 +137,6 @@ cdev_decl(bugtty); dev_init(c,n,mmap) } #include "lp.h" -cdev_decl(lp); #include "lptwo.h" cdev_decl(lptwo); #ifdef XFS @@ -251,6 +233,7 @@ dev_t swapdev = makedev(3, 0); /* * Returns true if dev is /dev/mem or /dev/kmem. */ +int iskmemdev(dev) dev_t dev; { @@ -261,6 +244,7 @@ iskmemdev(dev) /* * Returns true if dev is /dev/zero. */ +int iszerodev(dev) dev_t dev; { @@ -309,6 +293,7 @@ static int chrtoblktbl[] = { /* * Convert a character device number to a block device number. */ +dev_t chrtoblk(dev) dev_t dev; { diff --git a/sys/arch/mvme68k/mvme68k/disksubr.c b/sys/arch/mvme68k/mvme68k/disksubr.c index 68ba803851b..aab8437415c 100644 --- a/sys/arch/mvme68k/mvme68k/disksubr.c +++ b/sys/arch/mvme68k/mvme68k/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.24 2002/03/14 01:26:38 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.25 2002/04/27 23:21:05 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Dale Rahn. @@ -31,9 +31,9 @@ */ #include <sys/param.h> +#include <sys/systm.h> #include <sys/buf.h> #include <sys/device.h> -#define DKTYPENAMES #include <sys/disklabel.h> #include <sys/disk.h> @@ -185,12 +185,12 @@ readdisklabel(dev, strat, lp, clp, spoofonly) */ int setdisklabel(olp, nlp, openmask, clp) - register struct disklabel *olp, *nlp; + struct disklabel *olp, *nlp; u_long openmask; struct cpu_disklabel *clp; { - register i; - register struct partition *opp, *npp; + int i; + struct partition *opp, *npp; #ifdef DEBUG if(disksubr_debug > 0) { @@ -251,9 +251,10 @@ setdisklabel(olp, nlp, openmask, clp) /* * Write disk label back to device after modification. */ +int writedisklabel(dev, strat, lp, clp) dev_t dev; - void (*strat)(); + void (*strat)(struct buf *); register struct disklabel *lp; struct cpu_disklabel *clp; { @@ -277,7 +278,7 @@ writedisklabel(dev, strat, lp, clp) bp->b_cylin = 0; /* contained in block 0 */ (*strat)(bp); - if (error = biowait(bp)) { + if ((error = biowait(bp)) != 0) { /* nothing */ } else { bcopy(bp->b_data, clp, sizeof(struct cpu_disklabel)); @@ -536,7 +537,6 @@ cputobsdlabel(lp, clp) int i; if (clp->version == 0) { - struct cpu_disklabel_old *clpo = (void *) clp; #ifdef DEBUG if (disksubr_debug > 0) { printf("Reading old disklabel\n"); diff --git a/sys/arch/mvme68k/mvme68k/dkbad.c b/sys/arch/mvme68k/mvme68k/dkbad.c index 1295aadc15c..43991c5083c 100644 --- a/sys/arch/mvme68k/mvme68k/dkbad.c +++ b/sys/arch/mvme68k/mvme68k/dkbad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dkbad.c,v 1.5 1999/09/27 20:30:32 smurph Exp $ */ +/* $OpenBSD: dkbad.c,v 1.6 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -45,16 +45,15 @@ * the specified sector. Return index if found. * Return -1 if not found. */ -#ifndef NBT_BAD -#define NBT_BAD 126 -#endif +int isbad(struct dkbad *, int, int, int); +int isbad(bt, cyl, trk, sec) - register struct dkbad *bt; + struct dkbad *bt; int cyl, trk, sec; { - register int i; - register long blk, bblk; + int i; + long blk, bblk; blk = ((long)cyl << 16) + (trk << 8) + sec; for (i = 0; i < NBT_BAD; i++) { diff --git a/sys/arch/mvme68k/mvme68k/hpux_machdep.c b/sys/arch/mvme68k/mvme68k/hpux_machdep.c index 33857609b2b..5968f39457e 100644 --- a/sys/arch/mvme68k/mvme68k/hpux_machdep.c +++ b/sys/arch/mvme68k/mvme68k/hpux_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hpux_machdep.c,v 1.5 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: hpux_machdep.c,v 1.6 2002/04/27 23:21:06 miod Exp $ */ /* $NetBSD: hpux_machdep.c,v 1.9 1997/03/16 10:00:45 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ */ /* - * Machinde-dependent bits for HP-UX binary compatibility. + * Machine-dependent bits for HP-UX binary compatibility. */ #include <sys/param.h> @@ -74,12 +74,12 @@ #include <uvm/uvm_extern.h> -#include <machine/cpu.h> #include <machine/reg.h> #include <sys/syscallargs.h> #include <compat/hpux/hpux.h> +#include <compat/hpux/hpux_sig.h> #include <compat/hpux/hpux_util.h> #include <compat/hpux/hpux_syscall.h> #include <compat/hpux/hpux_syscallargs.h> @@ -143,6 +143,7 @@ hpux_cpu_makecmds(p, epp) /* set up command for exec header */ NEW_VMCMD(&epp->ep_vmcmds, hpux_cpu_vmcmd, sizeof(struct hpux_exec), (long)epp->ep_hdr, NULLVP, 0, 0); + return (0); } /* @@ -171,7 +172,7 @@ hpux_cpu_vmcmd(p, ev) p->p_md.md_flags &= ~MDP_CCBDATA; if (execp->ha_trsize & HPUXM_STKWT) - p->p_md.md_flags & ~MDP_CCBSTACK; + p->p_md.md_flags &= ~MDP_CCBSTACK; } return (0); diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index 68ea85fd832..64c9d413f3a 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.69 2002/04/18 21:39:51 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.70 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -106,16 +106,26 @@ #include <sys/shm.h> #endif -#include <machine/cpu.h> #include <machine/autoconf.h> +#include <machine/bugio.h> +#include <machine/cpu.h> +#include <machine/kcore.h> #include <machine/prom.h> -#include <machine/reg.h> #include <machine/psl.h> #include <machine/pte.h> -#include <machine/kcore.h> +#include <machine/reg.h> + +#include <mvme68k/dev/pccreg.h> + #include <dev/cons.h> + #include <net/netisr.h> +#ifdef DDB +#include <machine/db_machdep.h> +#include <ddb/db_extern.h> +#endif + #define MAXMEM 64*1024 /* XXX - from cmap.h */ #include <uvm/uvm_extern.h> @@ -182,6 +192,18 @@ static struct consdev bootcons = { void dumpsys(void); void initvectors(void); +void mvme68k_init(void); +void identifycpu(void); +int cpu_sysctl(int *, u_int, void *, size_t *, void *, size_t, struct proc *); +void halt_establish(void (*)(void), int); +void dumpconf(void); +void straytrap(int, u_short); +void netintr(void *); +void myetheraddr(u_char *); +int fpu_gettype(void); +int memsize162(void); +int memsize1x7(void); +int memsize(void); void mvme68k_init() @@ -215,6 +237,7 @@ mvme68k_init() void consinit() { + extern void db_machine_init(void); /* * Initialize the console before we print anything out. @@ -223,6 +246,7 @@ consinit() cninit(); #ifdef DDB + db_machine_init(); ddb_init(); if (boothowto & RB_KDB) @@ -480,9 +504,10 @@ int cpuspeed; struct mvmeprom_brdid brdid; +void identifycpu() { - char *t, mc; + char mc; char speed[6]; char suffix[30]; extern u_long fpvect_tab, fpvect_end, fpsp_tab; @@ -600,6 +625,7 @@ identifycpu() /* * machine dependent system variables. */ +int cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) int *name; u_int namelen; @@ -691,7 +717,7 @@ boot(howto) /* take a snap shot before clobbering any registers */ if (curproc && curproc->p_addr) - savectx(curproc->p_addr); + savectx(&curproc->p_addr->u_pcb); boothowto = howto; if ((howto & RB_NOSYNC) == 0 && waittime < 0) { @@ -983,6 +1009,7 @@ initvectors() #endif } +void straytrap(pc, evec) int pc; u_short evec; @@ -995,7 +1022,7 @@ int *nofault; int badpaddr(addr, size) - register void *addr; + paddr_t addr; int size; { int off = (int)addr & PGOFSET; @@ -1006,22 +1033,19 @@ badpaddr(addr, size) if (v == NULL) return (1); v += off; - x = badvaddr(v + off, size); + x = badvaddr((vaddr_t)v + off, size); unmapiodev(v, NBPG); return (x); } int badvaddr(addr, size) - register caddr_t addr; + vaddr_t addr; int size; { - register int i; + int i; label_t faultbuf; -#ifdef lint - i = *addr; if (i) return (0); -#endif nofault = (int *) &faultbuf; if (setjmp((label_t *)nofault)) { nofault = (int *)0; @@ -1043,7 +1067,8 @@ badvaddr(addr, size) } void -netintr() +netintr(arg) + void *arg; { #define DONETISR(bit, fn) \ do { \ @@ -1060,8 +1085,9 @@ netintr() * Level 7 interrupts are normally caused by the ABORT switch, * drop into ddb. */ +void nmihand(frame) -struct frame *frame; + void *frame; { #ifdef DDB printf("NMI ... going to debugger\n"); @@ -1085,11 +1111,10 @@ cpu_exec_aout_makecmds(p, epp) struct exec_package *epp; { int error = ENOEXEC; - struct exec *execp = epp->ep_hdr; #ifdef COMPAT_SUNOS { - extern sunos_exec_aout_makecmds(struct proc *, struct exec_package *); + extern int sunos_exec_aout_makecmds(struct proc *, struct exec_package *); if ((error = sunos_exec_aout_makecmds(p, epp)) == 0) return (0); } @@ -1146,7 +1171,7 @@ fpu_gettype() * Now, restore a NULL state to reset the FPU. */ fpframe[0] = fpframe[1] = 0; - m68881_restore(fpframe); + m68881_restore((struct fpframe *)fpframe); if (b == 0x18) return (FPU_68881); /* The size of a 68881 IDLE frame is 0x18 */ @@ -1213,7 +1238,7 @@ memsize1x7() #endif int -memsize(void) +memsize() { volatile unsigned int *look; unsigned int *max; @@ -1234,7 +1259,7 @@ memsize(void) look = (int *)((unsigned)look + STRIDE)) { unsigned save; - if (badvaddr((caddr_t)look, 2)) { + if (badvaddr((vaddr_t)look, 2)) { #if defined(DEBUG) printf("%x\n", look); #endif diff --git a/sys/arch/mvme68k/mvme68k/mem.c b/sys/arch/mvme68k/mvme68k/mem.c index b828e285990..99dd975062d 100644 --- a/sys/arch/mvme68k/mvme68k/mem.c +++ b/sys/arch/mvme68k/mvme68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.18 2001/12/08 02:24:06 art Exp $ */ +/* $OpenBSD: mem.c,v 1.19 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -74,13 +74,13 @@ */ #include <sys/param.h> -#include <sys/conf.h> #include <sys/buf.h> #include <sys/systm.h> #include <sys/uio.h> #include <sys/malloc.h> #include <machine/cpu.h> +#include <machine/conf.h> #include <uvm/uvm_extern.h> @@ -89,9 +89,10 @@ static caddr_t devzeropage; /*ARGSUSED*/ int -mmopen(dev, flag, mode) +mmopen(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { switch (minor(dev)) { @@ -107,9 +108,10 @@ mmopen(dev, flag, mode) /*ARGSUSED*/ int -mmclose(dev, flag, mode) +mmclose(dev, flag, mode, p) dev_t dev; int flag, mode; + struct proc *p; { return (0); @@ -202,7 +204,7 @@ mmrw(dev, uio, flags) * On the first call, allocate and zero a page * of memory for use with /dev/zero. * - * XXX on the hp300 we already know where there + * XXX on the mvme68k we already know where there * is a global zeroed page, the null segment table. */ if (devzeropage == NULL) { diff --git a/sys/arch/mvme68k/mvme68k/sys_machdep.c b/sys/arch/mvme68k/mvme68k/sys_machdep.c index 6133bb2f334..caa1f459304 100644 --- a/sys/arch/mvme68k/mvme68k/sys_machdep.c +++ b/sys/arch/mvme68k/mvme68k/sys_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_machdep.c,v 1.12 2001/11/06 19:53:15 miod Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.13 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1982, 1986, 1993 @@ -46,6 +46,9 @@ #include <sys/kernel.h> #include <sys/mtio.h> #include <sys/buf.h> +#include <sys/mount.h> + +#include <sys/syscallargs.h> #include <uvm/uvm_extern.h> @@ -58,6 +61,8 @@ #define CC_EXTPURGE 0x80000000 /* XXX end should be */ +int cachectl(int, vaddr_t, int); + /* * Note that what we do here for a 68040 is different than HP-UX. * @@ -69,19 +74,20 @@ * do pages, above that we do the entire cache. */ /*ARGSUSED1*/ +int cachectl(req, addr, len) -int req; -caddr_t addr; -int len; + int req; + vaddr_t addr; + int len; { int error = 0; #if defined(M68040) || defined(M68060) if (mmutype <= MMU_68040) { - register int inc = 0; - paddr_t pa = 0; + int inc = 0; int doall = 0; - caddr_t end; + paddr_t pa = 0; + vaddr_t end = 0; #ifdef COMPAT_HPUX extern struct emul emul_hpux; @@ -95,16 +101,16 @@ int len; } #endif if (addr == 0 || - (req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG) + ((req & ~CC_EXTPURGE) != CC_PURGE && len > 2*NBPG)) doall = 1; if (!doall) { end = addr + len; if (len <= 1024) { - addr = (caddr_t)((int)addr & ~0xF); + addr = addr & ~0xF; inc = 16; } else { - addr = (caddr_t)((int)addr & ~PGOFSET); + addr = addr & ~PGOFSET; inc = NBPG; } } @@ -115,49 +121,50 @@ int len; * entire cache (XXX is this a rational thing to do?) */ if (!doall && - (pa == 0 || ((int)addr & PGOFSET) == 0)) { - if (pmap_extract(curproc->p_vmspace->vm_map.pmap, - (vm_offset_t)addr, &pa) == FALSE) + (pa == 0 || ((int)addr & PGOFSET) == 0)) { + if (pmap_extract( + curproc->p_vmspace->vm_map.pmap, + addr, &pa) == FALSE) doall = 1; } switch (req) { - case CC_EXTPURGE|CC_IPURGE: - case CC_IPURGE: - if (doall) { - DCFA(); - ICPA(); - } else if (inc == 16) { - DCFL(pa); - ICPL(pa); - } else if (inc == NBPG) { - DCFP(pa); - ICPP(pa); - } - break; - - case CC_EXTPURGE|CC_PURGE: - case CC_PURGE: - if (doall) - DCFA(); /* note: flush not purge */ - else if (inc == 16) - DCPL(pa); - else if (inc == NBPG) - DCPP(pa); - break; - - case CC_EXTPURGE|CC_FLUSH: - case CC_FLUSH: - if (doall) - DCFA(); - else if (inc == 16) - DCFL(pa); - else if (inc == NBPG) - DCFP(pa); - break; - - default: - error = EINVAL; - break; + case CC_EXTPURGE|CC_IPURGE: + case CC_IPURGE: + if (doall) { + DCFA(); + ICPA(); + } else if (inc == 16) { + DCFL(pa); + ICPL(pa); + } else if (inc == NBPG) { + DCFP(pa); + ICPP(pa); + } + break; + + case CC_EXTPURGE|CC_PURGE: + case CC_PURGE: + if (doall) + DCFA(); /* note: flush not purge */ + else if (inc == 16) + DCPL(pa); + else if (inc == NBPG) + DCPP(pa); + break; + + case CC_EXTPURGE|CC_FLUSH: + case CC_FLUSH: + if (doall) + DCFA(); + else if (inc == 16) + DCFL(pa); + else if (inc == NBPG) + DCFP(pa); + break; + + default: + error = EINVAL; + break; } if (doall) break; @@ -168,21 +175,21 @@ int len; } #endif switch (req) { - case CC_EXTPURGE|CC_PURGE: - case CC_EXTPURGE|CC_FLUSH: - case CC_PURGE: - case CC_FLUSH: - DCIU(); - break; - case CC_EXTPURGE|CC_IPURGE: - DCIU(); - /* fall into... */ - case CC_IPURGE: - ICIA(); - break; - default: - error = EINVAL; - break; + case CC_EXTPURGE|CC_PURGE: + case CC_EXTPURGE|CC_FLUSH: + case CC_PURGE: + case CC_FLUSH: + DCIU(); + break; + case CC_EXTPURGE|CC_IPURGE: + DCIU(); + /* fall into... */ + case CC_IPURGE: + ICIA(); + break; + default: + error = EINVAL; + break; } return (error); } @@ -191,9 +198,10 @@ int len; * DMA cache control */ /*ARGSUSED1*/ +void dma_cachectl(addr, len) -caddr_t addr; -int len; + caddr_t addr; + int len; { #if defined(M68040) || defined(M68060) if (mmutype <= MMU_68040) { @@ -228,19 +236,20 @@ int len; } while (addr < end); } #endif /* M68040 */ - return (0); } int sys_sysarch(p, v, retval) -struct proc *p; -void *v; -register_t *retval; + struct proc *p; + void *v; + register_t *retval; { - struct sysarch_args /* { +#if 0 + struct sys_sysarch_args /* { syscallarg(int) op; syscallarg(char *) parms; } */ *uap = v; +#endif return ENOSYS; } diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 8cc271cbe58..8fae0449849 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.42 2002/03/14 01:26:38 millert Exp $ */ +/* $OpenBSD: trap.c,v 1.43 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -86,10 +86,11 @@ #include <sys/ktrace.h> #endif -#include <machine/psl.h> -#include <machine/trap.h> +#include <machine/db_machdep.h> #include <machine/cpu.h> +#include <machine/psl.h> #include <machine/reg.h> +#include <machine/trap.h> #ifdef COMPAT_SUNOS #include <compat/sunos/sunos_syscall.h> @@ -103,6 +104,9 @@ extern struct emul emul_sunos; #include <compat/hpux/hpux.h> #endif +int astpending; +int want_resched; + char *trap_type[] = { "Bus error", "Address error", @@ -162,11 +166,15 @@ int mmupid = -1; #endif #define NSIR 8 -void (*sir_routines[NSIR])(); +void (*sir_routines[NSIR])(void *); void *sir_args[NSIR]; u_char next_sir; -int writeback(struct frame *fp, int docachepush); +void trap(int, u_int, u_int, struct frame); +void syscall(register_t, struct frame); +void init_sir(void); +void hardintr(int, int, void *); +int writeback(struct frame *fp, int docachepush); /* * trap and syscall both need the following work done before returning @@ -226,7 +234,7 @@ again: "pid %d(%s): writeback aborted in sigreturn, pc=%x\n", p->p_pid, p->p_comm, fp->f_pc, faultaddr); #endif - } else if (sig = writeback(fp, fromtrap)) { + } else if ((sig = writeback(fp, fromtrap))) { register union sigval sv; beenhere = 1; @@ -246,10 +254,11 @@ again: * System calls are broken out for efficiency. T_ADDRERR */ /*ARGSUSED*/ +void trap(type, code, v, frame) int type; - unsigned code; - register unsigned v; + u_int code; + register u_int v; struct frame frame; { extern char fubail[], subail[]; @@ -279,12 +288,12 @@ trap(type, code, v, frame) dopanic: printf("trap type %d, code = %x, v = %x\n", type, code, v); #ifdef DDB - if (kdb_trap(type, &frame)) + if (kdb_trap(type, (db_regs_t *)&frame)) return; #endif regdump(&(frame.F_t), 128); type &= ~T_USER; - if ((unsigned)type < trap_types) + if ((u_int)type < trap_types) panic(trap_type[type]); panic("trap"); @@ -502,7 +511,7 @@ copyfault: case T_SSIR: /* software interrupt */ case T_SSIR|T_USER: - while (bit = ffs(ssir)) { + while ((bit = ffs(ssir))) { --bit; ssir &= ~(1 << bit); uvmexp.softs++; @@ -603,9 +612,9 @@ copyfault: */ if ((caddr_t)va >= vm->vm_maxsaddr && map != kernel_map) { if (rv == 0) { - unsigned nss; + u_int nss; - nss = btoc(USRSTACK-(unsigned)va); + nss = btoc(USRSTACK-(u_int)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == EACCES) @@ -757,8 +766,8 @@ writeback(fp, docachepush) * Writeback #1. * Position the "memory-aligned" data and write it out. */ - register u_int wb1d = f->f_wb1d; - register int off; + u_int wb1d = f->f_wb1d; + int off; #ifdef DEBUG if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) @@ -955,6 +964,7 @@ dumpwb(num, s, a, d) /* * Process a system call. */ +void syscall(code, frame) register_t code; struct frame frame; @@ -1107,7 +1117,7 @@ bad: */ u_long allocate_sir(proc, arg) - void (*proc)(); + void (*proc)(void *); void *arg; { int bit; @@ -1123,10 +1133,10 @@ allocate_sir(proc, arg) void init_sir() { - extern void netintr(); + extern void netintr(void *); sir_routines[0] = netintr; - sir_routines[1] = softclock; + sir_routines[1] = (void (*)(void *))softclock; next_sir = 2; } @@ -1137,14 +1147,15 @@ struct intrhand *intrs[256]; * This is an EXTREMELY good candidate for rewriting in assembly!! */ #ifndef INTR_ASM -int +void hardintr(pc, evec, frame) int pc; int evec; void *frame; { + extern void straytrap(int, u_short); int vec = (evec & 0xfff) >> 2; /* XXX should be m68k macro? */ - extern u_long intrcnt[]; /* XXX from locore */ + /*extern u_long intrcnt[];*/ /* XXX from locore */ struct intrhand *ih; int count = 0; int r; @@ -1158,12 +1169,14 @@ hardintr(pc, evec, frame) zscnputc(0, '0' + (vec - 0x70)); } #endif - r = (*ih->ih_fn)(ih->ih_wantframe ? frame : ih->ih_arg, vec); + r = (*ih->ih_fn)(ih->ih_wantframe ? frame : ih->ih_arg); if (r > 0) count++; } - if (count == 0) - return (straytrap(pc, evec)); + if (count != 0) + return; + + straytrap(pc, evec); } #endif /* !INTR_ASM */ @@ -1210,7 +1223,7 @@ intr_establish(vec, ih) ih->ih_next = NULL; /* just in case */ /* attach at tail */ - if (ihx = intrs[vec]) { + if ((ihx = intrs[vec])) { while (ihx->ih_next) ihx = ihx->ih_next; ihx->ih_next = ih; @@ -1224,8 +1237,16 @@ intr_establish(vec, ih) #include <machine/db_machdep.h> #include <ddb/db_command.h> +void db_prom_cmd(db_expr_t, int, db_expr_t, char *); +void db_machine_init(void); + +/* ARGSUSED */ void -db_prom_cmd() +db_prom_cmd(addr, have_addr, count, modif) + db_expr_t addr; + int have_addr; + db_expr_t count; + char *modif; { doboot(); } diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index eac4c6d4a47..a09bcc7a10b 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.33 2001/12/08 02:24:06 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.34 2002/04/27 23:21:06 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -79,7 +79,6 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) struct trapframe *tf; struct switchframe *sf; extern struct pcb *curpcb; - extern void proc_trampoline(), child_return(); p2->p_md.md_flags = p1->p_md.md_flags; @@ -188,11 +187,13 @@ pagemove(from, to, size) */ void physaccess(vaddr, paddr, size, prot) - caddr_t vaddr, paddr; - register int size, prot; + vaddr_t vaddr; + paddr_t paddr; + size_t size; + int prot; { - register pt_entry_t *pte; - register u_int page; + pt_entry_t *pte; + u_int page; pte = kvtopte(vaddr); page = (u_int)paddr & PG_FRAME; @@ -205,10 +206,10 @@ physaccess(vaddr, paddr, size, prot) void physunaccess(vaddr, size) - caddr_t vaddr; - register int size; + vaddr_t vaddr; + size_t size; { - register pt_entry_t *pte; + pt_entry_t *pte; pte = kvtopte(vaddr); for (size = btoc(size); size; size--) @@ -219,15 +220,16 @@ physunaccess(vaddr, size) /* * Convert kernel VA to physical address */ -int +paddr_t kvtop(addr) - caddr_t addr; + vaddr_t addr; { paddr_t pa; if (pmap_extract(pmap_kernel(), (vm_offset_t)addr, &pa) == FALSE) panic("kvtop: zero page frame"); - return((int)pa); + + return (pa); } /* |