diff options
Diffstat (limited to 'sys/arch/mvme88k')
24 files changed, 734 insertions, 807 deletions
diff --git a/sys/arch/mvme88k/dev/cl.c b/sys/arch/mvme88k/dev/cl.c index b46f2c14e4b..310c1f23616 100644 --- a/sys/arch/mvme88k/dev/cl.c +++ b/sys/arch/mvme88k/dev/cl.c @@ -1,8 +1,8 @@ -/* $OpenBSD: cl.c,v 1.31 2003/10/03 16:44:50 miod Exp $ */ +/* $OpenBSD: cl.c,v 1.32 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1995 Dale Rahn. All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -22,7 +22,7 @@ * 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. - */ + */ /* DMA mode still does not work!!! */ @@ -64,7 +64,7 @@ #define CL_RXDMAINT 0x82 #define CL_TXDMAINT 0x42 #define CL_TXMASK 0x47 -#define CL_RXMASK 0x87 +#define CL_RXMASK 0x87 #define CL_TXINTR 0x02 #define CL_RXINTR 0x02 @@ -189,13 +189,13 @@ void cloutput(struct tty *tp); void cl_chkinput(void); #endif -struct cfattach cl_ca = { +struct cfattach cl_ca = { sizeof(struct clsoftc), clprobe, clattach -}; - +}; + struct cfdriver cl_cd = { NULL, "cl", DV_TTY, 0 -}; +}; #define CLCDBUF 80 @@ -213,7 +213,7 @@ struct tty *cltty(dev) int unit, channel; struct clsoftc *sc; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (NULL); } @@ -221,19 +221,19 @@ struct tty *cltty(dev) return sc->sc_cl[channel].tty; } -int +int clprobe(parent, self, aux) struct device *parent; void *self; void *aux; { /* probing onboard 166/167/187 CL-cd2400 - * should be previously configured, + * should be previously configured, * we can check the value before resetting the chip */ struct clreg *cl_reg; struct confargs *ca = aux; - + if (brdtyp == BRD_188) return 0; @@ -241,7 +241,7 @@ clprobe(parent, self, aux) ca->ca_vaddr = ca->ca_paddr = (void *)CD2400_BASE_ADDR; cl_reg = (struct clreg *)ca->ca_vaddr; - if (badvaddr((vm_offset_t)&cl_reg->cl_gfrcr,1)) + if (badvaddr((vaddr_t)&cl_reg->cl_gfrcr,1)) return 0; return 1; } @@ -377,7 +377,7 @@ cl_initchannel(sc, channel) cl_reg->cl_ier = 0x00; /* if the port is not the console, should be init for all ports??*/ if (sc->sc_cl[channel].cl_consio != 1) { - cl_reg->cl_cmr = 0x02; + cl_reg->cl_cmr = 0x02; cl_reg->cl_cor1 = 0x17; cl_reg->cl_cor2 = 0x00; cl_reg->cl_cor3 = 0x02; @@ -483,7 +483,6 @@ clmctl(dev, bits, how) if( msvr & 0x01) { bits |= TIOCM_RTS; } - } break; } @@ -516,9 +515,9 @@ clopen(dev, flag, mode, p) struct cl_info *cl; struct clsoftc *sc; struct tty *tp; - + unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -582,7 +581,7 @@ clopen(dev, flag, mode, p) #ifdef CL_DMA_WORKS { sc->cl_reg->cl_cmr = - /* CL_TXDMAINT | */ CL_RXDMAINT; + /* CL_TXDMAINT | */ CL_RXDMAINT; sc->cl_reg->cl_ier = 0xa8; sc->cl_reg->cl_licr = 0x00; } @@ -612,11 +611,11 @@ if (channel == 2) { /* test one channel now */ #if 0 /* tx only */ sc->cl_reg->cl_licr = (CL_DMAMODE << 4); - sc->cl_reg->cl_cmr = 0x42; + sc->cl_reg->cl_cmr = 0x42; #endif /* rx only */ sc->cl_reg->cl_licr = 0x00; - sc->cl_reg->cl_cmr = 0x82; + sc->cl_reg->cl_cmr = 0x82; } sc->cl_reg->cl_ccr = 0x20; while (sc->cl_reg->cl_ccr != 0) { @@ -660,7 +659,7 @@ clparam(tp, t) dev = tp->t_dev; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -689,7 +688,7 @@ cloutput(tp) dev = tp->t_dev; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return; } @@ -729,7 +728,7 @@ clclose(dev, flag, mode, p) struct clsoftc *sc; int s; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -739,7 +738,7 @@ clclose(dev, flag, mode, p) (*linesw[tp->t_line].l_close)(tp, flag); s = splcl(); - + sc->cl_reg->cl_car = channel; if(cl->cl_consio == 0 && (tp->t_cflag & HUPCL) != 0) { sc->cl_reg->cl_msvr_rts = 0x00; @@ -771,7 +770,7 @@ clread(dev, uio, flag) struct cl_info *cl; struct clsoftc *sc; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -794,7 +793,7 @@ clwrite(dev, uio, flag) struct cl_info *cl; struct clsoftc *sc; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -820,7 +819,7 @@ clioctl(dev, cmd, data, flag, p) struct cl_info *cl; struct clsoftc *sc; unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -874,9 +873,9 @@ clioctl(dev, cmd, data, flag, p) *(int *)data = cl->cl_swflags; break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p, 0); if (error != 0) - return(EPERM); + return(EPERM); cl->cl_swflags = *(int *)data; cl->cl_swflags &= /* only allow valid flags */ @@ -940,7 +939,7 @@ clcninit(cp) struct consdev *cp; { struct clreg *volatile cl_reg; - + cl_cons.cl_paddr = (void *)CD2400_BASE_ADDR; cl_cons.cl_vaddr = (struct clreg *)IIOV(cl_cons.cl_paddr); cl_cons.pcctwoaddr = (void *)IIOV(0xfff42000); @@ -1048,7 +1047,7 @@ clcngetc(dev) cl_reg->cl_teoir = 0x00; } } - + return data; } @@ -1146,7 +1145,7 @@ cl_chkinput() if (dopoll == 0) return; for (unit = 0; unit < cl_cd.cd_ndevs; unit++) { - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { continue; } @@ -1173,7 +1172,7 @@ cl_chkinput() } #endif -u_char +u_char clgetc(sc, channel) struct clsoftc *sc; int *channel; @@ -1237,7 +1236,7 @@ clccparam(sc, par, channel) s = splcl(); sc->cl_reg->cl_car = channel; - if (par->c_ospeed == 0) { + if (par->c_ospeed == 0) { /* dont kill the console */ if(sc->sc_cl[channel].cl_consio == 0) { /* disconnect, drop RTS DTR stop receiver */ @@ -1293,7 +1292,7 @@ clccparam(sc, par, channel) } else { cor1 = 0x10 | clen; /* ignore parity */ } - if (sc->cl_reg->cl_cor1 != cor1) { + if (sc->cl_reg->cl_cor1 != cor1) { sc->cl_reg->cl_cor1 = cor1; sc->cl_reg->cl_ccr = 0x20; while (sc->cl_reg->cl_ccr != 0) { @@ -1337,7 +1336,7 @@ clccparam(sc, par, channel) static int clknum = 0; -u_char +u_char cl_clkdiv(speed) int speed; { @@ -1355,7 +1354,7 @@ cl_clkdiv(speed) return cl_clocks[4].divisor; } -u_char +u_char cl_clknum(speed) int speed; { @@ -1374,7 +1373,7 @@ cl_clknum(speed) return cl_clocks[4].clock; } -u_char +u_char cl_clkrxtimeout(speed) int speed; { @@ -1423,7 +1422,7 @@ clstart(tp) } #endif unit = CL_UNIT(dev); - if (unit >= cl_cd.cd_ndevs || + if (unit >= cl_cd.cd_ndevs || (sc = (struct clsoftc *) cl_cd.cd_devs[unit]) == NULL) { return; } @@ -1486,7 +1485,7 @@ cl_mintr(arg) log(LOG_WARNING, "cl_mintr: channel %x timer 2 unexpected\n",channel); } if (misr & 0x20) { - log(LOG_WARNING, "cl_mintr: channel %x cts %x\n",channel, + log(LOG_WARNING, "cl_mintr: channel %x cts %x\n",channel, ((msvr & 0x20) != 0x0) ); } @@ -1642,7 +1641,7 @@ cl_rxintr(arg) int i; u_char reoir; u_char buffer[CL_FIFO_MAX +1]; - + rir = sc->cl_reg->cl_rir; if((rir & 0x40) == 0x0) { /* only if intr is not shared ??? */ @@ -1706,7 +1705,7 @@ log(LOG_WARNING, "cl_txintr: DMAMODE channel %x dmabsts %x risrl %x risrh %x\n", #endif #if USE_BUFFER cl_appendbufn(sc, channel, sc->rx[nbuf], cnt); -#else +#else { int i; u_char *pbuf; diff --git a/sys/arch/mvme88k/dev/if_ie.c b/sys/arch/mvme88k/dev/if_ie.c index 3bd029ea9fa..75822401e63 100644 --- a/sys/arch/mvme88k/dev/if_ie.c +++ b/sys/arch/mvme88k/dev/if_ie.c @@ -1,7 +1,7 @@ -/* $OpenBSD: if_ie.c,v 1.25 2003/09/29 09:08:19 miod Exp $ */ +/* $OpenBSD: if_ie.c,v 1.26 2003/10/05 20:27:47 miod Exp $ */ /*- - * Copyright (c) 1998 Steve Murphree, Jr. + * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt * Copyright (c) 1993, 1994, 1995 Charles Hannum. * Copyright (c) 1992, 1993, University of Vermont and State @@ -59,7 +59,7 @@ * * Majorly cleaned up and 3C507 code merged by Charles Hannum. * - * Converted to SUN ie driver by Charles D. Cranor, + * Converted to SUN ie driver by Charles D. Cranor, * October 1994, January 1995. * This sun version based on i386 version 1.30. */ @@ -194,10 +194,10 @@ struct ie_softc { struct ie_sys_ctl_block *volatile scb; /* - * pointer and size of a block of KVA where the buffers + * pointer and size of a block of KVA where the buffers * are to be allocated from */ - + caddr_t buf_area; int buf_area_sz; @@ -343,7 +343,7 @@ ie_ack(sc, mask) command_and_wait(sc, scb->ie_status & mask, 0, 0); } -int +int iematch(parent, vcf, args) struct device *parent; void *vcf, *args; @@ -353,7 +353,7 @@ iematch(parent, vcf, args) if (badvaddr((unsigned)IIOV(ca->ca_vaddr), 1)){ return(0); } - return(1); + return(1); } /* @@ -410,7 +410,7 @@ ieattach(parent, self, aux) extern void myetheraddr(u_char *); /* should be elsewhere */ int pri = ca->ca_ipl; struct ieob *volatile ieo; - vm_offset_t pa; + paddr_t pa; sc->reset_596 = ie_obreset; sc->chan_attn = ie_obattend; @@ -533,7 +533,7 @@ ieintr(v) void *v; { struct ie_softc *sc = v; - register u_short status; + u_short status; status = sc->scb->ie_status; /*printf("I");*/ @@ -604,9 +604,9 @@ ierint(sc) sc->sc_arpcom.ac_if.if_ipackets++; if (!--timesthru) { sc->sc_arpcom.ac_if.if_ierrors += - MK_32(scb->ie_err_crc) + + MK_32(scb->ie_err_crc) + MK_32(scb->ie_err_align) + - MK_32(scb->ie_err_resource) + + MK_32(scb->ie_err_resource) + MK_32(scb->ie_err_overrun) + MK_32(scb->ie_err_coll) + MK_32(scb->ie_err_short); @@ -905,7 +905,7 @@ sc->xmit_cbuffs[sc->xctail]); ASWAP(sc->xmit_buffs[sc->xctail]); sc->xmit_cmds[sc->xctail]->ie_xmit_count = 0; - sc->scb->ie_command_list = + sc->scb->ie_command_list = ASWAP(sc->xmit_cmds[sc->xctail]); command_and_wait(sc, IE_CU_START, 0, 0); @@ -921,7 +921,7 @@ sc->xmit_cbuffs[sc->xctail]); * length of the data available. This enables us to allocate mbuf * clusters in many situations where before we would have had a long * chain of partially-full mbufs. This should help to speed up the - * operation considerably. (Provided that it works, of course.) + * operation considerably. (Provided that it works, of course.) */ int ieget(sc, mp, ehp, to_bpf) @@ -1252,7 +1252,7 @@ iestart(ifp) len = 0; buffer = sc->xmit_cbuffs[sc->xchead]; - for (m0 = m; m && (len +m->m_len) < IE_TBUF_SIZE; + for (m0 = m; m && (len +m->m_len) < IE_TBUF_SIZE; m = m->m_next) { bcopy(mtod(m, caddr_t), buffer, m->m_len); buffer += m->m_len; @@ -1285,7 +1285,7 @@ iestart(ifp) /* * set up IE's ram space */ -int +int ie_setupram(sc) struct ie_softc *sc; { @@ -1374,9 +1374,9 @@ chan_attn_timeout(rock) * or be accepted, depending on the command. If the command pointer * is null, then pretend that the command is not an action command. * If the command pointer is not null, and the command is an action - * command, wait for - * ((struct ie_cmd_common *volatile)pcmd)->ie_cmd_status & MASK - * to become true. + * command, wait for + * ((struct ie_cmd_common *volatile)pcmd)->ie_cmd_status & MASK + * to become true. */ int command_and_wait(sc, cmd, pcmd, mask) @@ -1514,7 +1514,7 @@ Align(ptr) * note: this function was written to be easy to understand, rather than * highly efficient (it isn't in the critical path). */ -void +void setup_bufs(sc) struct ie_softc *sc; { @@ -1731,7 +1731,7 @@ ieinit(sc) cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST; cmd->com.ie_cmd_link = 0xffffffff; - (sc->memcopy)(sc->sc_arpcom.ac_enaddr, + (sc->memcopy)(sc->sc_arpcom.ac_enaddr, (caddr_t)&cmd->ie_address, sizeof cmd->ie_address); if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) || @@ -1780,7 +1780,7 @@ iestop(sc) int ieioctl(ifp, cmd, data) - register struct ifnet *ifp; + struct ifnet *ifp; u_long cmd; caddr_t data; { diff --git a/sys/arch/mvme88k/dev/if_ve.c b/sys/arch/mvme88k/dev/if_ve.c index 53fb1538987..a9c828fb65d 100644 --- a/sys/arch/mvme88k/dev/if_ve.c +++ b/sys/arch/mvme88k/dev/if_ve.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ve.c,v 1.20 2003/09/29 09:08:19 miod Exp $ */ +/* $OpenBSD: if_ve.c,v 1.21 2003/10/05 20:27:47 miod Exp $ */ /*- * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1982, 1992, 1993 @@ -36,7 +36,7 @@ #include <sys/param.h> #include <sys/systm.h> -#include <sys/mbuf.h> +#include <sys/mbuf.h> #include <sys/syslog.h> #include <sys/socket.h> #include <sys/device.h> @@ -86,7 +86,7 @@ void ve_tint(struct vam7990_softc *); int ve_put(struct vam7990_softc *, int, struct mbuf *); struct mbuf *ve_get(struct vam7990_softc *, int, int); -void ve_read(struct vam7990_softc *, int, int); +void ve_read(struct vam7990_softc *, int, int); void ve_shutdown(void *); @@ -148,9 +148,9 @@ nvram_cmd(sc, cmd, addr) struct vereg1 *reg1 = ((struct ve_softc *)sc)->sc_r1; for (i=0;i<8;i++) { - reg1->ver1_ear=((cmd|(addr<<1))>>i); - CDELAY; - } + reg1->ver1_ear=((cmd|(addr<<1))>>i); + CDELAY; + } } /* read nvram one bit at a time */ @@ -171,12 +171,12 @@ nvram_read(sc, nvram_addr) ENABLE_NVRAM; nvram_cmd(sc, NVRAM_READ, nvram_addr); for (wbit=0; wbit<15; wbit++) { - (reg1->ver1_ear & 0x01) ? + (reg1->ver1_ear & 0x01) ? (val = (val | mask)) : (val = (val & (~mask))); mask = mask>>1; CDELAY; } - (reg1->ver1_ear & 0x01) ? + (reg1->ver1_ear & 0x01) ? (val = (val | 0x8000)) : (val = (val & 0x7FFF)); CDELAY; DISABLE_NVRAM; @@ -271,7 +271,7 @@ veattach(parent, self, aux) /* Are we the boot device? */ if (ca->ca_paddr == bootaddr) bootdv = self; - + lesc->sc_r1 = (struct vereg1 *)ca->ca_vaddr; lesc->sc_ipl = ca->ca_ipl; lesc->sc_vec = ca->ca_vec; @@ -291,13 +291,13 @@ veattach(parent, self, aux) default: panic("ve: invalid address"); } - + sc->sc_mem = (void *)mapiodev(addr, LEMEMSIZE); - + if (sc->sc_mem == NULL) panic("ve: no more memory in external I/O map"); sc->sc_memsize = LEMEMSIZE; sc->sc_conf3 = LE_C3_BSWP; - sc->sc_addr = kvtop((vm_offset_t)sc->sc_mem); + sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); /* get ether address via bug call */ veetheraddr(sc); @@ -400,7 +400,7 @@ ve_config(sc) printf("\n%s: address %s\n", sc->sc_dev.dv_xname, ether_sprintf(sc->sc_arpcom.ac_enaddr)); - printf("%s: %d receive buffers, %d transmit buffers\n", + printf("%s: %d receive buffers, %d transmit buffers\n", sc->sc_dev.dv_xname, sc->sc_nrbuf, sc->sc_ntbuf); sc->sc_sh = shutdownhook_establish(ve_shutdown, sc); @@ -882,7 +882,7 @@ ve_intr(arg) /* clear the interrupting condition */ (*sc->sc_wrcsr)(sc, LE_CSR0, - isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | + isr & (LE_C0_INEA | LE_C0_BABL | LE_C0_MISS | LE_C0_MERR | LE_C0_RINT | LE_C0_TINT | LE_C0_IDON)); if (isr & LE_C0_ERR) { if (isr & LE_C0_BABL) { @@ -1294,8 +1294,8 @@ ve_copytobuf_contig(sc, from, boff, len) { volatile caddr_t buf = sc->sc_mem; volatile caddr_t phys = (caddr_t)sc->sc_addr; - dma_cachectl((vm_offset_t)phys + boff, len, DMA_CACHE_SYNC); - dma_cachectl((vm_offset_t)buf + boff, len, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)phys + boff, len, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)buf + boff, len, DMA_CACHE_SYNC); /* * Just call bcopy() to do the work. @@ -1311,8 +1311,8 @@ ve_copyfrombuf_contig(sc, to, boff, len) { volatile caddr_t buf = sc->sc_mem; volatile caddr_t phys = (caddr_t)sc->sc_addr; - dma_cachectl((vm_offset_t)phys + boff, len, DMA_CACHE_SYNC_INVAL); - dma_cachectl((vm_offset_t)buf + boff, len, DMA_CACHE_SYNC_INVAL); + dma_cachectl((vaddr_t)phys + boff, len, DMA_CACHE_SYNC_INVAL); + dma_cachectl((vaddr_t)buf + boff, len, DMA_CACHE_SYNC_INVAL); /* * Just call bcopy() to do the work. */ @@ -1326,8 +1326,8 @@ ve_zerobuf_contig(sc, boff, len) { volatile caddr_t buf = sc->sc_mem; volatile caddr_t phys = (caddr_t)sc->sc_addr; - dma_cachectl((vm_offset_t)phys + boff, len, DMA_CACHE_SYNC); - dma_cachectl((vm_offset_t)buf + boff, len, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)phys + boff, len, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)buf + boff, len, DMA_CACHE_SYNC); /* * Just let bzero() do the work diff --git a/sys/arch/mvme88k/dev/memc.c b/sys/arch/mvme88k/dev/memc.c index 2f7907ed407..2f312096b77 100644 --- a/sys/arch/mvme88k/dev/memc.c +++ b/sys/arch/mvme88k/dev/memc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memc.c,v 1.7 2003/06/02 07:06:56 deraadt Exp $ */ +/* $OpenBSD: memc.c,v 1.8 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -78,7 +78,7 @@ memcmatch(parent, vcf, args) struct confargs *ca = args; struct memcreg *memc = (struct memcreg *)ca->ca_vaddr; - if (badvaddr((vm_offset_t)memc, 4)) + if (badvaddr((vaddr_t)memc, 4)) return (0); if (memc->memc_chipid==MEMC_CHIPID || memc->memc_chipid==MCECC_CHIPID) return (1); diff --git a/sys/arch/mvme88k/dev/memdevs.c b/sys/arch/mvme88k/dev/memdevs.c index 6d0f3212ce9..fe6eaa3aa97 100644 --- a/sys/arch/mvme88k/dev/memdevs.c +++ b/sys/arch/mvme88k/dev/memdevs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memdevs.c,v 1.4 2003/06/04 04:11:37 deraadt Exp $ */ +/* $OpenBSD: memdevs.c,v 1.5 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -46,9 +46,9 @@ memdevrw(base, len, uio, flags) struct uio *uio; int flags; { - register vm_offset_t 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/mvme88k/dev/pcctwo.c b/sys/arch/mvme88k/dev/pcctwo.c index 4d8143edb46..39eb2d53b12 100644 --- a/sys/arch/mvme88k/dev/pcctwo.c +++ b/sys/arch/mvme88k/dev/pcctwo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pcctwo.c,v 1.17 2003/06/02 07:06:56 deraadt Exp $ */ +/* $OpenBSD: pcctwo.c,v 1.18 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1995 Theo de Raadt * All rights reserved. @@ -96,7 +96,7 @@ void *vcf, *args; return (0); } - if (badvaddr((vm_offset_t)pcc2, 4)) { + if (badvaddr((vaddr_t)pcc2, 4)) { printf("==> pcctwo: failed address check.\n"); return (0); } @@ -171,7 +171,7 @@ void *args; */ sc->sc_paddr = ca->ca_paddr; sc->sc_vaddr = (void *)IIOV(sc->sc_paddr); - + pcc2bus = ca->ca_bustype; switch (pcc2bus) { @@ -181,16 +181,16 @@ void *args; #if NBUSSW > 0 case BUS_BUSSWITCH: sc->sc_pcc2 = (struct pcctworeg *)sc->sc_vaddr; - /* + /* * fake up our address so that pcc2 child devices * are offeset of 0xFFF00000 - XXX smurph */ sc->sc_paddr -= PCC2_PCC2CHIP_OFF; sc->sc_vaddr -= PCC2_PCC2CHIP_OFF; /* make sure the bus is mc68040 compatible */ - sc->sc_pcc2->pcc2_genctl |= PCC2_GENCTL_C040; + sc->sc_pcc2->pcc2_genctl |= PCC2_GENCTL_C040; break; -#endif +#endif } sys_pcc2 = sc->sc_pcc2; diff --git a/sys/arch/mvme88k/dev/ssh.c b/sys/arch/mvme88k/dev/ssh.c index d47a7f8d869..e3031e38262 100644 --- a/sys/arch/mvme88k/dev/ssh.c +++ b/sys/arch/mvme88k/dev/ssh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.15 2003/09/22 21:39:39 miod Exp $ */ +/* $OpenBSD: ssh.c,v 1.16 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -80,7 +80,7 @@ void ssh_sched(struct ssh_softc *); int ssh_poll(struct ssh_softc *, struct ssh_acb *); int sshintr(struct ssh_softc *); void scsi_period_to_ssh(struct ssh_softc *, int); -void ssh_start(struct ssh_softc *, int, int, u_char *, int, u_char *, int); +void ssh_start(struct ssh_softc *, int, int, u_char *, int, u_char *, int); void ssh_dump_acb(struct ssh_acb *); void sshinitialize(struct ssh_softc *sc); @@ -218,7 +218,7 @@ ssh_scsicmd(xs) sc = slp->adapter_softc; flags = xs->flags; xs->error = XS_NOERROR; - + /* XXXX ?? */ if (flags & SCSI_DATA_UIO) panic("ssh: scsi data uio requested"); @@ -254,10 +254,10 @@ ssh_scsicmd(xs) * We should move this ssh_sched() XXX */ if (xs->flags & SCSI_DATA_IN) { /* read */ - dma_cachectl((vm_offset_t)xs->data, xs->datalen, + dma_cachectl((vaddr_t)xs->data, xs->datalen, DMA_CACHE_SYNC_INVAL); } else { /* write */ - dma_cachectl((vm_offset_t)xs->data, xs->datalen, + dma_cachectl((vaddr_t)xs->data, xs->datalen, DMA_CACHE_SYNC); } @@ -472,7 +472,7 @@ ssh_scsidone(acb, stat) TAILQ_REMOVE(&sc->ready_list, acb, chain); SSH_TRACE('d','r',stat,0) } else { - register struct ssh_acb *acb2; + struct ssh_acb *acb2; for (acb2 = sc->nexus_list.tqh_first; acb2; acb2 = acb2->chain.tqe_next) if (acb2 == acb) { @@ -510,7 +510,7 @@ ssh_scsidone(acb, stat) void sshabort(sc, rp, where) - register struct ssh_softc *sc; + struct ssh_softc *sc; ssh_regmap_p rp; char *where; { @@ -572,15 +572,15 @@ sshinitialize(sc) * Also should verify that dev doesn't span non-contiguous * physical pages. */ - sc->sc_scriptspa = kvtop((vm_offset_t)scripts); + sc->sc_scriptspa = kvtop((vaddr_t)scripts); /* * malloc sc_acb to ensure that DS is on a long word boundary. */ - MALLOC(sc->sc_acb, struct ssh_acb *, + MALLOC(sc->sc_acb, struct ssh_acb *, sizeof(struct ssh_acb) * SSH_NACB, M_DEVBUF, M_NOWAIT); - if (sc->sc_acb == NULL) + if (sc->sc_acb == NULL) panic("sshinitialize: ACB malloc failed!"); sc->sc_tcp[1] = 1000 / sc->sc_clock_freq; @@ -674,9 +674,9 @@ sshreset(sc) for (i = 0; i < SSH_NACB; i++) { pmap_cache_ctrl(pmap_kernel(), - trunc_page((vm_offset_t)acb), - round_page((vm_offset_t)acb+sizeof(*acb)), - CACHE_INH); + trunc_page((vaddr_t)acb), + round_page((vaddr_t)acb + sizeof(*acb)), + CACHE_INH); TAILQ_INSERT_TAIL(&sc->free_list, acb, chain); acb++; @@ -746,20 +746,20 @@ ssh_start (sc, target, lun, cbuf, clen, buf, 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((vm_offset_t)&acb->msgout[0]); + acb->ds.idbuf = (char *) kvtop((vaddr_t)&acb->msgout[0]); acb->ds.cmdlen = clen; - acb->ds.cmdbuf = (char *) kvtop((vm_offset_t)cbuf); + acb->ds.cmdbuf = (char *) kvtop((vaddr_t)cbuf); acb->ds.stslen = 1; - acb->ds.stsbuf = (char *) kvtop((vm_offset_t)&acb->stat[0]); + acb->ds.stsbuf = (char *) kvtop((vaddr_t)&acb->stat[0]); acb->ds.msglen = 1; - acb->ds.msgbuf = (char *) kvtop((vm_offset_t)&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((vm_offset_t)&acb->msg[1]); - acb->ds.extmsgbuf = (char *) kvtop((vm_offset_t)&acb->msg[2]); - acb->ds.synmsgbuf = (char *) kvtop((vm_offset_t)&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) { @@ -803,7 +803,7 @@ ssh_start (sc, target, lun, cbuf, clen, buf, len) addr = buf; dmaend = NULL; while (count > 0) { - acb->ds.chain[nchain].databuf = (char *) kvtop((vm_offset_t)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; @@ -840,12 +840,7 @@ ssh_start (sc, target, lun, cbuf, clen, buf, len) } #endif -#if CACHECTL - /* push data cache for all data the 53c710 needs to access */ - dma_cachectl(sc, sizeof (struct ssh_softc), DMA_CACHE_SYNC); - dma_cachectl(acb, sizeof (*acb), DMA_CACHE_SYNC); -#endif - dma_cachectl((vm_offset_t)cbuf, clen, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)cbuf, clen, DMA_CACHE_SYNC); /* * Flushing the buf from data cache is very important for MVME187 @@ -855,10 +850,10 @@ ssh_start (sc, target, lun, cbuf, clen, buf, len) */ if (buf != NULL && len != 0) { if (acb->xs->flags & SCSI_DATA_IN) { /* read */ - dma_cachectl((vm_offset_t)buf, len, + dma_cachectl((vaddr_t)buf, len, DMA_CACHE_SYNC_INVAL); } else { /* write */ - dma_cachectl((vm_offset_t)buf, len, DMA_CACHE_SYNC); + dma_cachectl((vaddr_t)buf, len, DMA_CACHE_SYNC); } } @@ -877,7 +872,7 @@ ssh_start (sc, target, lun, cbuf, clen, buf, len) sc->sc_dev.dv_xname); rp->ssh_temp = 0; rp->ssh_sbcl = sc->sc_sync[target].sbcl; - rp->ssh_dsa = kvtop((vm_offset_t)&acb->ds); + rp->ssh_dsa = kvtop((vaddr_t)&acb->ds); rp->ssh_dsp = sc->sc_scriptspa; SSH_TRACE('s',1,0,0) } else { @@ -961,9 +956,9 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) if (dstat & SSH_DSTAT_SIR && rp->ssh_dsps == 0xff00) { /* Normal completion status, or check condition */ #ifdef DEBUG - if (rp->ssh_dsa != kvtop((vm_offset_t)&acb->ds)) { + if (rp->ssh_dsa != kvtop((vaddr_t)&acb->ds)) { printf ("ssh: invalid dsa: %x %x\n", rp->ssh_dsa, - kvtop((vm_offset_t)&acb->ds)); + kvtop((vaddr_t)&acb->ds)); panic("*** ssh DSA invalid ***"); } #endif @@ -1021,10 +1016,6 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) scsi_period_to_ssh (sc, target); } } -#if CACHECTL - /*cmmu_inval_cache(kvtop((vm_offset_t)&acb->stat[0]), 1);*/ - dma_cachectl(&acb->stat[0], 1); -#endif *status = acb->stat[0]; #ifdef DEBUG if (rp->ssh_sbcl & SSH_BSY) { @@ -1259,10 +1250,6 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) } if (j < DMAMAXIO) acb->ds.chain[j].datalen = 0; -#if CACHECTL - dma_cachectl(acb->ds.chain, - sizeof(acb->ds.chain)); -#endif } ++sc->sc_tinfo[target].dconns; /* @@ -1324,10 +1311,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) sc->sc_nexus = acb; sc->sc_flags |= acb->status; acb->status = 0; -#if CACHECTL - dma_cachectl(&acb->stat[0], sizeof(acb->stat[0])); -#endif - rp->ssh_dsa = kvtop((vm_offset_t)&acb->ds); + 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; @@ -1338,9 +1322,6 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) sc->nexus_list.tqh_first); panic("unable to find reselecting device"); } -#if CACHECTL - dma_cachectl (acb, sizeof(*acb)); -#endif rp->ssh_temp = 0; rp->ssh_dcntl |= SSH_DCNTL_STD; return (0); @@ -1373,7 +1354,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) } target = sc->sc_nexus->xs->sc_link->target; rp->ssh_temp = 0; - rp->ssh_dsa = kvtop((vm_offset_t)&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; @@ -1384,14 +1365,10 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) printf("%s: Bad message-in with no active command?\n", sc->sc_dev.dv_xname); /* Unrecognized message in byte */ -#if CACHECTL - /*cmmu_inval_cache(kvtop((vm_offset_t)&acb->msg[1]), 1);*/ - dma_cachectl (&acb->msg[1],1); -#endif 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((vm_offset_t)&acb->msg[1]));*/ + /*DCIAS(kvtop((vaddr_t)&acb->msg[1]));*/ rp->ssh_dsp = sc->sc_scriptspa + Ent_switch; return (0); } @@ -1472,7 +1449,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) goto bad_phase; } #if XXX - switch (rp->ssh_sbcl & 7) + switch (rp->ssh_sbcl & 7) #endif switch (rp->ssh_sstat2 & 7) { case 0: /* data out */ @@ -1538,7 +1515,7 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) * mode and single step mode, which we are not using. * I will give it a shot... nivas */ - + if (kludge_city) { dummy = rp->ssh_dsp; rp->ssh_dsp = dummy; @@ -1596,12 +1573,6 @@ ssh_checkintr(sc, istat, dstat, sstat0, status) } if (sstat0 == 0 && dstat & SSH_DSTAT_SIR) { -#if CACHECTL - /*cmmu_inval_cache(kvtop((vm_offset_t)&acb->stat[0]), 1); */ - /*cmmu_inval_cache(kvtop((vm_offset_t)&acb->msg[0]), 1); */ - dma_cachectl (&acb->stat[0], 1); - dma_cachectl (&acb->msg[0], 1); -#endif printf ("SSH interrupt: %lx sts %x msg %x %x sbcl %x\n", rp->ssh_dsps, acb->stat[0], acb->msg[0], acb->msg[1], rp->ssh_sbcl); @@ -1634,7 +1605,7 @@ bad_phase: */ 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((vm_offset_t)&acb->ds), kvtop((vm_offset_t)rp), rp->ssh_dsp, + 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", @@ -1702,10 +1673,10 @@ ssh_select(sc) int sshintr (sc) - register struct ssh_softc *sc; + struct ssh_softc *sc; { ssh_regmap_p rp; - register u_char istat, dstat, sstat0; + u_char istat, dstat, sstat0; int status; int s = splbio(); @@ -1722,7 +1693,7 @@ sshintr (sc) sstat0 = sc->sc_sstat0; if (dstat & SSH_DSTAT_SIR) sc->sc_intcode = rp->ssh_dsps; /* XXX use sc_intcode instead of dsps */ - + /* Clear the copies in sc */ sc->sc_istat = 0; sc->sc_dstat = 0; @@ -1740,12 +1711,6 @@ sshintr (sc) #ifdef DEBUG if (ssh_debug & 5) { -#if CACHECTL - /*cmmu_inval_cache(kvtop((vm_offset_t)&sc->sc_nexus->stat[0]), - sizeof(sc->sc_nexus->stat[0])); */ - dma_cachectl(&sc->sc_nexus->stat[0], - sizeof(sc->sc_nexus->stat[0])); -#endif printf ("%s: intr istat %x dstat %x sstat0 %x dsps %x sbcl %x sts %x msg %x\n", sc->sc_dev.dv_xname, istat, dstat, sstat0, rp->ssh_dsps, rp->ssh_sbcl, @@ -1786,7 +1751,7 @@ sshintr (sc) * not be correct for other 53c710 boards. * XXX fix this - nivas */ -void +void scsi_period_to_ssh (sc, target) struct ssh_softc *sc; int target; diff --git a/sys/arch/mvme88k/dev/sshdma.c b/sys/arch/mvme88k/dev/sshdma.c index 176edc072c5..5254ab41824 100644 --- a/sys/arch/mvme88k/dev/sshdma.c +++ b/sys/arch/mvme88k/dev/sshdma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshdma.c,v 1.12 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: sshdma.c,v 1.13 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur @@ -83,11 +83,11 @@ struct scsi_device afsc_scsidev = { struct cfattach ssh_ca = { sizeof(struct ssh_softc), afscmatch, afscattach, -}; - +}; + struct cfdriver ssh_cd = { - NULL, "ssh", DV_DULL, 0 -}; + NULL, "ssh", DV_DULL, 0 +}; int afscmatch(pdp, vcf, args) @@ -96,7 +96,7 @@ afscmatch(pdp, vcf, args) { struct confargs *ca = args; - if (badvaddr((vm_offset_t)IIOV(ca->ca_vaddr), 4)) { + if (badvaddr((vaddr_t)IIOV(ca->ca_vaddr), 4)) { return(0); } @@ -164,10 +164,9 @@ afscattach(parent, self, auxp) */ struct pcctworeg *pcc2 = (struct pcctworeg *)ca->ca_master; - - pmap_cache_ctrl(pmap_kernel(), trunc_page((vm_offset_t)sc), - round_page((vm_offset_t)sc + sizeof(*sc)), - CACHE_INH); + + pmap_cache_ctrl(pmap_kernel(), trunc_page((vaddr_t)sc), + round_page((vaddr_t)sc + sizeof(*sc)), CACHE_INH); pcctwointr_establish(PCC2V_NCR, &sc->sc_ih); /* enable interrupts at ca_ipl */ @@ -184,7 +183,7 @@ afscattach(parent, self, auxp) * (see dk_establish). */ tmp = bootpart; - if (ca->ca_paddr != bootaddr) + if (ca->ca_paddr != bootaddr) bootpart = -1; /* invalid flag to dk_establish */ config_found(self, &sc->sc_link, scsiprint); bootpart = tmp; /* restore old value */ diff --git a/sys/arch/mvme88k/dev/vme.c b/sys/arch/mvme88k/dev/vme.c index c404f19efe5..0c206d0c8de 100644 --- a/sys/arch/mvme88k/dev/vme.c +++ b/sys/arch/mvme88k/dev/vme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vme.c,v 1.21 2003/09/28 22:14:33 miod Exp $ */ +/* $OpenBSD: vme.c,v 1.22 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1995 Theo de Raadt @@ -49,7 +49,7 @@ #include "syscon.h" #include <mvme88k/dev/vme.h> -#if NSYSCON > 0 +#if NSYSCON > 0 #include <mvme88k/dev/sysconreg.h> #endif @@ -72,11 +72,11 @@ struct vme2reg *sys_vme2 = NULL; struct cfattach vme_ca = { sizeof(struct vmesoftc), vmematch, vmeattach -}; - +}; + struct cfdriver vme_cd = { NULL, "vme", DV_DULL, 0 -}; +}; int vmematch(parent, cf, args) @@ -186,9 +186,9 @@ vmerw(sc, uio, flags, bus) int flags; int bus; { - register vm_offset_t v; - register int c; - register struct iovec *iov; + vaddr_t v; + int c; + struct iovec *iov; void *vme; int error = 0; @@ -263,7 +263,7 @@ vmescan(parent, child, args, bustype) oca.ca_len = 4096; oca.ca_offset = (u_int)oca.ca_paddr; - oca.ca_vaddr = vmemap(sc, (vm_offset_t)oca.ca_paddr, oca.ca_len, + oca.ca_vaddr = vmemap(sc, (vaddr_t)oca.ca_paddr, oca.ca_len, oca.ca_bustype); if (!oca.ca_vaddr) oca.ca_vaddr = (void *)-1; @@ -276,7 +276,7 @@ vmescan(parent, child, args, bustype) } /* * If match works, the driver is responsible for - * vmunmap()ing if it does not need the mapping. + * vmunmap()ing if it does not need the mapping. */ config_attach(parent, cf, &oca, vmeprint); return (1); @@ -358,12 +358,12 @@ vme_findvec(void) */ /* - * All VME bus devices will use a vector starting with VBR1 + 0x10 - * and determined by intr_findvec(). (in machdep.c) vmeintr_establish() - * should be called with the 'vec' argument = 0 to 'auto vector' a + * All VME bus devices will use a vector starting with VBR1 + 0x10 + * and determined by intr_findvec(). (in machdep.c) vmeintr_establish() + * should be called with the 'vec' argument = 0 to 'auto vector' a * VME device. * - * The 8 SW interrupters will start with VBR1. The rest will start + * The 8 SW interrupters will start with VBR1. The rest will start * with VBR0< 4) & 0xFF. */ @@ -389,7 +389,7 @@ vmeintr_establish(vec, ih) VME2_IRQ_VME(ih->ih_ipl); break; #endif -#if NSYSCON > 0 +#if NSYSCON > 0 case BUS_SYSCON: syscon = (struct sysconreg *)sc->sc_vaddr; break; @@ -459,11 +459,11 @@ vme2chip_init(sc) /* * Map the Software VME irq levels to the cpu level 7. */ - vme2->vme2_irql3 = (7 << VME2_IRQL3_SW7SHIFT) | (7 << VME2_IRQL3_SW6SHIFT) | + vme2->vme2_irql3 = (7 << VME2_IRQL3_SW7SHIFT) | (7 << VME2_IRQL3_SW6SHIFT) | (7 << VME2_IRQL3_SW5SHIFT) | (7 << VME2_IRQL3_SW4SHIFT) | - (7 << VME2_IRQL3_SW3SHIFT) | (7 << VME2_IRQL3_SW2SHIFT) | + (7 << VME2_IRQL3_SW3SHIFT) | (7 << VME2_IRQL3_SW2SHIFT) | (7 << VME2_IRQL3_SW1SHIFT) | (7 << VME2_IRQL3_SW0SHIFT); - /* + /* * pseudo driver, abort interrupt handler */ sc->sc_abih.ih_fn = vme2abort; @@ -499,7 +499,7 @@ vmesyscon_init(sc) vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000, vme2->vme2_master2 << 16, vme2->vme2_master2 & 0xffff0000); - /* + /* * pseudo driver, abort interrupt handler */ sc->sc_abih.ih_fn = sysconabort; @@ -561,7 +561,7 @@ vme2abort(eframe) printf("%s: abort irq not set\n", sc->sc_dev.dv_xname); return (0); } -#endif +#endif vme2->vme2_irqclr = VME2_IRQ_AB; nmihand(frame); return (1); diff --git a/sys/arch/mvme88k/dev/vs.c b/sys/arch/mvme88k/dev/vs.c index 46ecc7401cc..d8823ba4f4e 100644 --- a/sys/arch/mvme88k/dev/vs.c +++ b/sys/arch/mvme88k/dev/vs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vs.c,v 1.19 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: vs.c,v 1.20 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. @@ -79,20 +79,20 @@ void vs_copy(void *, void *, unsigned short); void vs_zero(void *, u_long); int do_vspoll(struct vs_softc *, int); void thaw_queue(struct vs_softc *, u_int8_t); -void vs_link_sg_element(sg_list_element_t *, vm_offset_t, int); -void vs_link_sg_list(sg_list_element_t *, vm_offset_t, int); +void vs_link_sg_element(sg_list_element_t *, vaddr_t, int); +void vs_link_sg_list(sg_list_element_t *, vaddr_t, int); static __inline__ void vs_clear_return_info(struct vs_softc *); -/* +/* * 16 bit 's' memory functions. MVME328 is a D16 board. * We must program with that in mind or else... - * bcopy/bzero (the 'b' meaning byte) is implemented in - * 32 bit operations for speed, so thay are not really - * 'byte' operations at all!! MVME1x7 can be set up to - * handle D32 -> D16 read/writes via VMEChip2 Address + * bcopy/bzero (the 'b' meaning byte) is implemented in + * 32 bit operations for speed, so thay are not really + * 'byte' operations at all!! MVME1x7 can be set up to + * handle D32 -> D16 read/writes via VMEChip2 Address * modifiers, however MVME188 can not. These next two - * function insure 16 bit copy/zero operations. The + * function insure 16 bit copy/zero operations. The * structures are all implemented with 16 bit or less * types. smurph */ @@ -102,16 +102,16 @@ vs_copy(src, dst, cnt) void *src; void *dst; unsigned short cnt; -{ - register unsigned short *volatile x, *volatile y; - register unsigned short volatile z; +{ + unsigned short *volatile x, *volatile y; + unsigned short volatile z; - z = cnt >> 1; - x = (unsigned short *)src; - y = (unsigned short *)dst; + z = cnt >> 1; + x = (unsigned short *)src; + y = (unsigned short *)dst; while (z--) { - *y++ = *x++; + *y++ = *x++; } } @@ -120,12 +120,12 @@ vs_zero(src, cnt) void *src; u_long cnt; { - register unsigned short *source; - register unsigned short zero = 0; - register unsigned short z; + unsigned short *source; + unsigned short zero = 0; + unsigned short z; source = (unsigned short *) src; - z = cnt >> 1; + z = cnt >> 1; while (z--) { *source++ = zero; @@ -146,7 +146,7 @@ vs_minphys(bp) minphys(bp); } -int +int do_vspoll(sc, to) struct vs_softc *sc; int to; @@ -209,7 +209,7 @@ vs_poll(sc, xs) return (COMPLETE); } -void +void thaw_queue(sc, target) struct vs_softc *sc; u_int8_t target; @@ -222,13 +222,13 @@ thaw_queue(sc, target) while (THAW_REG & 0x01); } -void +void vs_scsidone (sc, xs, stat) struct vs_softc *sc; struct scsi_xfer *xs; - int stat; + int stat; { - int tgt; + int tgt; xs->status = stat; while (xs->status == SCSI_CHECK) { @@ -240,7 +240,7 @@ vs_scsidone (sc, xs, stat) tgt = xs->sc_link->target + 1; xs->flags |= ITSDONE; /*sc->sc_tinfo[slp->target].cmds++;*/ - + /* thaw all work queues */ thaw_queue(sc, tgt); scsi_done(xs); @@ -298,7 +298,7 @@ vs_scsicmd(xs) } else if (xs->cmd->opcode == 0x08) { printf("READ_COMMAND "); } -#endif +#endif if (flags & SCSI_POLL) { cqep = mc; iopb = miopb; @@ -328,15 +328,15 @@ vs_scsicmd(xs) */ if (xs->flags & SCSI_DATA_IN) { /* read */ #if defined(mvme88k) - dma_cachectl((vm_offset_t)xs->data, xs->datalen, + dma_cachectl((vaddr_t)xs->data, xs->datalen, DMA_CACHE_SYNC_INVAL); -#endif +#endif iopb->iopb_OPTION |= OPT_READ; } else { /* write */ #if defined(mvme88k) - dma_cachectl((vm_offset_t)xs->data, xs->datalen, + dma_cachectl((vaddr_t)xs->data, xs->datalen, DMA_CACHE_SYNC); -#endif +#endif iopb->iopb_OPTION |= OPT_WRITE; } @@ -351,7 +351,7 @@ vs_scsicmd(xs) /* * Wait until we can use the command queue entry. - * Should only have to wait if the master command + * Should only have to wait if the master command * queue entry is busy and we are polling. */ while (cqep->cqe_QECR & M_QECR_GO); @@ -381,10 +381,10 @@ vs_scsicmd(xs) 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 crsw 0x%x\n", - slp->target, slp->lun, buf, len, cqep->cqe_WORK_QUEUE, + printf("tgt %d lun %d buf %x len %d wqn %d ipl %d crsw 0x%x\n", + slp->target, slp->lun, buf, len, cqep->cqe_WORK_QUEUE, iopb->iopb_LEVEL, crb->crb_CRSW); -#endif +#endif cqep->cqe_QECR |= M_QECR_GO; if (flags & SCSI_POLL) { @@ -426,12 +426,12 @@ vs_chksense(xs) 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((vm_offset_t)&xs->sense)); + LV(miopb->iopb_BUFF, kvtop((vaddr_t)&xs->sense)); LV(miopb->iopb_LENGTH, sizeof(struct scsi_sense_data)); vs_zero(mc, sizeof(M328_CQE)); mc->cqe_IOPB_ADDR = OFF(miopb); - mc->cqe_IOPB_LENGTH = sizeof(M328_short_IOPB) + + mc->cqe_IOPB_LENGTH = sizeof(M328_short_IOPB) + sizeof(struct scsi_sense); mc->cqe_WORK_QUEUE = 0; mc->cqe_QECR = M_QECR_GO; @@ -446,7 +446,7 @@ vs_chksense(xs) xs->status = riopb->iopb_STATUS >> 8; #ifdef SDEBUG scsi_print_sense(xs, 2); -#endif +#endif splx(s); } @@ -603,7 +603,7 @@ vs_resync(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; + M328_DRCF *devreset = (M328_DRCF *)&sc->sc_vsreg->sh_MCE_IOPB; u_short i; for (i=0; i<7; i++) { vs_zero(devreset, sizeof(M328_DRCF)); @@ -624,7 +624,7 @@ vs_resync(sc) if (riopb->iopb_STATUS) { #ifdef SDEBUG printf("status: %x\n", riopb->iopb_STATUS); -#endif +#endif sc->sc_tinfo[i].avail = 0; } else { sc->sc_tinfo[i].avail = 1; @@ -643,7 +643,7 @@ vs_reset(sc) 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; + M328_SRCF *reset = (M328_SRCF *)&sc->sc_vsreg->sh_MCE_IOPB; vs_zero(reset, sizeof(M328_SRCF)); reset->srcf_CMD = IOPB_RESET; @@ -761,7 +761,7 @@ vs_checkintr(sc, xs, status) printf("[er]"); } printf("\n"); -#endif +#endif if (len != xs->datalen) { xs->resid = xs->datalen - len; } else { @@ -779,14 +779,14 @@ vs_checkintr(sc, xs, status) /* normal interrupt routine */ int vs_nintr(sc) - register struct vs_softc *sc; + struct vs_softc *sc; { M328_CRB *crb = (M328_CRB *)&sc->sc_vsreg->sh_CRB; M328_CMD *m328_cmd; struct scsi_xfer *xs; int status; int s; - + if ((CRSW & CONTROLLER_ERROR) == CONTROLLER_ERROR) return(vs_eintr(sc)); @@ -798,10 +798,10 @@ vs_nintr(sc) #ifdef SDEBUG printf("Interrupt!!! "); printf("m328_cmd == 0x%x\n", m328_cmd); -#endif +#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 + * pointer in the CTAG feild. Bad things happen if you try * to point to address 0. Controller error should be handled * in vsdma.c I'll change this soon - steve. */ @@ -828,7 +828,7 @@ vs_nintr(sc) int vs_eintr(sc) - register struct vs_softc *sc; + struct vs_softc *sc; { M328_CEVSB *crb = (M328_CEVSB *)&sc->sc_vsreg->sh_CRB; M328_CMD *m328_cmd; @@ -841,17 +841,17 @@ vs_eintr(sc) #endif int ecode = crb->cevsb_ERROR; int status, s; - + s = splbio(); /* Got a valid interrupt on this device */ sc->sc_intrcnt_e.ev_count++; - + VL((unsigned long)m328_cmd, crb->cevsb_CTAG); #ifdef SDEBUG printf("Error Interrupt!!! "); printf("m328_cmd == 0x%x\n", m328_cmd); -#endif +#endif xs = m328_cmd->xs; if (crsw & M_CRSW_RST) { @@ -895,9 +895,9 @@ vs_eintr(sc) #endif } #ifdef SDEBUG - printf("%s: crsw = 0x%x iopb_type = %d iopb_len = %d wq = %d error = 0x%x\n", + printf("%s: crsw = 0x%x iopb_type = %d iopb_len = %d wq = %d error = 0x%x\n", vs_name(sc), crsw, type, length, wq, ecode); -#endif +#endif if (CRSW & M_CRSW_ER) CRB_CLR_ER(CRSW); CRB_CLR_DONE(CRSW); @@ -910,7 +910,7 @@ vs_eintr(sc) static __inline__ void vs_clear_return_info(sc) - register struct vs_softc *sc; + struct vs_softc *sc; { M328_IOPB *riopb = (M328_IOPB *)&sc->sc_vsreg->sh_RET_IOPB; M328_CEVSB *crb = (M328_CEVSB *)&sc->sc_vsreg->sh_CRB; @@ -937,7 +937,7 @@ void vs_dealloc_scatter_gather(sg) M328_SG sg; { - register int i; + int i; if (sg->level > 0) { for (i=0; sg->down[i] && i<MAX_SG_ELEMENTS; i++) { @@ -950,8 +950,8 @@ vs_dealloc_scatter_gather(sg) void vs_link_sg_element(element, phys_add, len) sg_list_element_t *element; - register vm_offset_t phys_add; - register int len; + vaddr_t phys_add; + int len; { element->count.bytes = len; LV(element->address, phys_add); @@ -964,8 +964,8 @@ vs_link_sg_element(element, phys_add, len) void vs_link_sg_list(list, phys_add, elements) sg_list_element_t *list; - register vm_offset_t phys_add; - register int elements; + vaddr_t phys_add; + int elements; { list->count.scatter.gather = elements; @@ -976,13 +976,13 @@ vs_link_sg_list(list, phys_add, elements) list->address_modifier = 0xD; } -M328_SG +M328_SG vs_build_memory_structure(xs, iopb) struct scsi_xfer *xs; M328_IOPB *iopb; /* the iopb */ { M328_SG sg; - vm_offset_t starting_point_virt, starting_point_phys, point_virt, + vaddr_t starting_point_virt, starting_point_phys, point_virt, point1_phys, point2_phys, virt; unsigned len; int level; @@ -1001,8 +1001,8 @@ vs_build_memory_structure(xs, iopb) */ level = 0; - virt = starting_point_virt = (vm_offset_t)xs->data; - point1_phys = starting_point_phys = kvtop((vm_offset_t)xs->data); + 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 @@ -1011,7 +1011,7 @@ vs_build_memory_structure(xs, iopb) 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 < virt + (vaddr_t)len || sg ; point_virt += PAGE_SIZE) { /* out later */ point2_phys = kvtop(point_virt); @@ -1045,34 +1045,34 @@ vs_build_memory_structure(xs, iopb) 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), + vs_link_sg_list(&(sg->up->list[sg->up->elements-1]), + kvtop((vaddr_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; + int i; i = sg->elements; /* We need a new element */ - sg->down[i] = vs_alloc_scatter_gather(); + 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) { + if (point_virt < virt+(vaddr_t)len) { /* linking element */ - vs_link_sg_element(&(sg->list[sg->elements]), - starting_point_phys, + 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); + 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 */ } @@ -1090,15 +1090,15 @@ vs_build_memory_structure(xs, iopb) 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), + 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((vm_offset_t)sg->list)); + LV(iopb->iopb_BUFF, kvtop((vaddr_t)sg->list)); LV(iopb->iopb_LENGTH, sg->elements); LV(iopb->iopb_SGTTL, len); } else { diff --git a/sys/arch/mvme88k/dev/vsvar.h b/sys/arch/mvme88k/dev/vsvar.h index b9092a65db9..aa2de282d66 100644 --- a/sys/arch/mvme88k/dev/vsvar.h +++ b/sys/arch/mvme88k/dev/vsvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vsvar.h,v 1.6 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: vsvar.h,v 1.7 2003/10/05 20:27:48 miod Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1990 The Regents of the University of California. @@ -43,7 +43,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((vm_offset_t)x) - (long)kvtop((vm_offset_t)sc->sc_vsreg)) +#define OFF(x) (u_short)((long)kvtop((vaddr_t)x) - (long)kvtop((vaddr_t)sc->sc_vsreg)) #define vs_name(sc) (sc)->sc_dev.dv_xname /**************** Scater/Gather Stuff *******************/ @@ -62,12 +62,12 @@ typedef struct { unsigned short :3; unsigned short transfer_type :2; /* 0x0 is reserved */ - #define SHORT_TREANSFER 0x1 - #define LONG_TRANSFER 0x2 - #define SCATTER_GATTER_LIST_IN_SHORT_IO 0x3 + #define SHORT_TREANSFER 0x1 + #define LONG_TRANSFER 0x2 + #define SCATTER_GATTER_LIST_IN_SHORT_IO 0x3 unsigned short memory_type :2; - #define NORMAL_TYPE 0x0 - #define BLOCK_MODE 0x1 + #define NORMAL_TYPE 0x0 + #define BLOCK_MODE 0x1 /* 0x2 is reserved */ /* 0x3 is reserved */ unsigned short address_modifier :8; @@ -180,11 +180,11 @@ int vs_scsicmd(struct scsi_xfer *); M328_SG vs_alloc_scatter_gather(void); void vs_dealloc_scatter_gather(M328_SG sg); void vs_link_scatter_gather_element(sg_list_element_t *element, - register vm_offset_t phys_add, - register int len); + vaddr_t phys_add, + int len); void vs_link_scatter_gather_list(sg_list_element_t *list, - register vm_offset_t phys_add, - register int elements); + vaddr_t phys_add, + int elements); M328_SG vs_build_memory_structure(struct scsi_xfer *xs, M328_IOPB *iopb); #endif /* _M328VAR_H */ diff --git a/sys/arch/mvme88k/dev/vx.c b/sys/arch/mvme88k/dev/vx.c index 2362ddc4fc1..4924a266fe8 100644 --- a/sys/arch/mvme88k/dev/vx.c +++ b/sys/arch/mvme88k/dev/vx.c @@ -1,6 +1,6 @@ -/* $OpenBSD: vx.c,v 1.22 2003/08/15 20:32:14 tedu Exp $ */ +/* $OpenBSD: vx.c,v 1.23 2003/10/05 20:27:48 miod Exp $ */ /* - * Copyright (c) 1999 Steve Murphree, Jr. + * Copyright (c) 1999 Steve Murphree, Jr. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,7 +24,7 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ + */ #include <sys/param.h> #include <sys/ioctl.h> @@ -150,14 +150,14 @@ int create_free_queue(struct vxsoftc *); void print_dump(struct vxsoftc *); struct envelope *get_cmd_tail(struct vxsoftc *); -struct cfattach vx_ca = { +struct cfattach vx_ca = { sizeof(struct vxsoftc), vxmatch, vxattach -}; +}; struct cfdriver vx_cd = { NULL, "vx", DV_TTY, 0 -}; - +}; + #define VX_UNIT(x) (int)(minor(x) / 9) #define VX_PORT(x) (int)(minor(x) % 9) @@ -170,7 +170,7 @@ struct tty * vxtty(dev) int unit, port; struct vxsoftc *sc; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (NULL); } @@ -178,7 +178,7 @@ struct tty * vxtty(dev) return sc->sc_info[port].tty; } -int +int vxmatch(parent, self, aux) struct device *parent; void *self; @@ -186,7 +186,7 @@ vxmatch(parent, self, aux) { struct vxreg *vx_reg; struct confargs *ca = aux; - + #ifdef OLD_MAPPINGS ca->ca_vaddr = ca->ca_paddr; #endif @@ -208,21 +208,21 @@ vxattach(parent, self, aux) { struct vxsoftc *sc = (struct vxsoftc *)self; struct confargs *ca = aux; - + /* set up dual port memory and registers and init*/ sc->vx_reg = (struct vxreg *)ca->ca_vaddr; sc->channel = (struct channel *)(ca->ca_vaddr + 0x0100); #if defined(MVME187) || defined(MVME197) sc->sc_vme2 = ca->ca_master; -#endif - sc->sc_ipl = ca->ca_ipl; - sc->sc_vec = ca->ca_vec; +#endif + sc->sc_ipl = ca->ca_ipl; + sc->sc_vec = ca->ca_vec; sc->board_addr = (unsigned int)ca->ca_vaddr; printf("\n"); if (create_channels(sc)) { - printf("%s: failed to create channel %d\n", sc->sc_dev.dv_xname, + printf("%s: failed to create channel %d\n", sc->sc_dev.dv_xname, sc->channel->channel_number); return; } @@ -408,7 +408,7 @@ int vxopen (dev, flag, mode, p) unit = VX_UNIT(dev); port = VX_PORT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -431,7 +431,7 @@ int vxopen (dev, flag, mode, p) #ifdef DEBUG_VXT printf("unit %d, port %d, ", unit, port); printf("error = %d\n", opkt.error_l); -#endif +#endif return (ENODEV); } @@ -442,7 +442,7 @@ int vxopen (dev, flag, mode, p) if (vxt->tty) { tp = vxt->tty; } else { - tp = vxt->tty = ttymalloc(); + tp = vxt->tty = ttymalloc(); } /* set line status */ @@ -506,7 +506,7 @@ int vxopen (dev, flag, mode, p) return ((*linesw[tp->t_line].l_open)(dev, tp)); } -int +int vx_param(tp, t) struct tty *tp; struct termios *t; @@ -517,7 +517,7 @@ vx_param(tp, t) dev = tp->t_dev; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -530,7 +530,7 @@ vx_param(tp, t) return 0; } -int +int vxclose (dev, flag, mode, p) dev_t dev; int flag; @@ -544,7 +544,7 @@ vxclose (dev, flag, mode, p) int s; struct close_packet cpkt; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -579,7 +579,7 @@ vxclose (dev, flag, mode, p) return (0); } -void +void read_wakeup(sc, port) struct vxsoftc *sc; int port; @@ -587,8 +587,8 @@ read_wakeup(sc, port) struct read_wakeup_packet rwp; struct vx_info *volatile vxt; vxt = &sc->sc_info[port]; - /* - * If we already have a read_wakeup paket + /* + * If we already have a read_wakeup paket * for this port, do nothing. */ if (vxt->read_pending) { @@ -609,13 +609,13 @@ read_wakeup(sc, port) /* * Do not wait. Characters will be transferred - * to (*linesw[tp->t_line].l_rint)(c,tp); by + * to (*linesw[tp->t_line].l_rint)(c,tp); by * vx_intr() (IPC will notify via interrupt) */ bpp_send(sc, &rwp, NOWAIT); } -int +int vxread (dev, uio, flag) dev_t dev; struct uio *uio; @@ -627,7 +627,7 @@ vxread (dev, uio, flag) struct vxsoftc *volatile sc; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -638,7 +638,7 @@ vxread (dev, uio, flag) return ((*linesw[tp->t_line].l_read)(tp, uio, flag)); } -int +int vxwrite (dev, uio, flag) dev_t dev; struct uio *uio; @@ -653,7 +653,7 @@ vxwrite (dev, uio, flag) u_short get, put; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -706,7 +706,7 @@ vxwrite (dev, uio, flag) } } return ((*linesw[tp->t_line].l_write)(tp, uio, flag)); -} +} int vxioctl (dev, cmd, data, flag, p) @@ -722,7 +722,7 @@ vxioctl (dev, cmd, data, flag, p) struct vx_info *vxt; struct vxsoftc *sc; unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return (ENODEV); } @@ -778,7 +778,7 @@ vxioctl (dev, cmd, data, flag, p) break; case TIOCSFLAGS: - error = suser(p, 0); + error = suser(p, 0); if (error != 0) return (EPERM); @@ -968,7 +968,7 @@ vx_ccparam(sc, par, port) else lflag &= ~VICANON; if (par->c_lflag & ISIG) lflag |= VISIG; else lflag &= ~VISIG; -#endif +#endif pkt.command = CMD_IOCTL; pkt.ioctl_cmd_l = IOCTL_TCSETA; pkt.command_pipe_number = sc->channel_number; @@ -1008,7 +1008,7 @@ vxstart(tp) dev = tp->t_dev; port = VX_PORT(dev); unit = VX_UNIT(dev); - if (unit >= vx_cd.cd_ndevs || + if (unit >= vx_cd.cd_ndevs || (sc = (struct vxsoftc *) vx_cd.cd_devs[unit]) == NULL) { return; } @@ -1038,16 +1038,16 @@ vxstart(tp) return; } -void +void read_chars(sc, port) struct vxsoftc *sc; int port; { - /* + /* * This routine is called by vx_intr() when there are - * characters in the read ring. It will process one + * characters in the read ring. It will process one * cooked line, put the chars in the line disipline ring, - * and then return. The characters may then + * and then return. The characters may then * be read by vxread. */ struct vx_info *vxt; @@ -1066,7 +1066,7 @@ read_chars(sc, port) #ifdef DEBUG_VXT printf("read_chars() get=%d, put=%d ", get, put); printf("open = %d ring at 0x%x\n", open, rp); -#endif +#endif while (get != put) { frame_count = rp->data[rp->get++ & (RRING_BUF_SIZE - 1)]; rp->get &= (RRING_BUF_SIZE - 1); @@ -1122,7 +1122,6 @@ vx_intr(arg) if (vme2->vme2_vbr & VME2_SYSFAIL) { /* do something... print_dump(sc); */ - } #endif /* defined(MVME187) || defined(MVME197) */ if (!cold) sc->sc_intrcnt.ev_count++; @@ -1132,7 +1131,7 @@ vx_intr(arg) valid = env_isvalid(get_status_head(sc)); cmd = pktp->command; port = pktp->device_number; - /* if we are waiting on this packet, strore the info so bpp_send + /* if we are waiting on this packet, strore the info so bpp_send can process the packet */ if (sc->sc_bppwait_pktp == pktp) memcpy2(&sc->sc_bppwait_pkt, pktp, sizeof(struct packet)); @@ -1149,34 +1148,34 @@ vx_intr(arg) switch (cmd) { case CMD_READW: #ifdef DEBUG_VXT - printf("READW Packet\n"); -#endif - read_chars(sc, port); + printf("READW Packet\n"); +#endif + read_chars(sc, port); return 1; break; case CMD_WRITEW: #ifdef DEBUG_VXT printf("WRITEW Packet\n"); /* Still don't know XXXsmurph */ -#endif +#endif return 1; break; case CMD_EVENT: #ifdef DEBUG_VXT - printf("EVENT Packet\n"); -#endif + printf("EVENT Packet\n"); +#endif vx_event(sc, &pkt); return 1; break; case CMD_PROCCESED: #ifdef DEBUG_VXT printf("CMD_PROCCESED Packet\n"); -#endif +#endif return 1; break; default: #ifdef DEBUG_VXT - printf("Other packet 0x%x\n", cmd); -#endif + printf("Other packet 0x%x\n", cmd); +#endif return 1; break; } @@ -1184,7 +1183,7 @@ vx_intr(arg) return 1; } -int +int vx_event(sc, evntp) struct vxsoftc *sc; struct packet *evntp; @@ -1225,19 +1224,15 @@ vx_event(sc, evntp) } if (code & E_PR_FAULT) { /* do something... */ - } if (code & E_PR_POUT) { /* do something... */ - } if (code & E_PR_SELECT) { /* do something... */ - } if (code & E_SWITCH) { /* do something... */ - } if (code & E_BREAK) { vx_break (sc, evntp->device_number); @@ -1300,27 +1295,25 @@ vx_break (sc, port) void memcpy2(void *dest, const void *src, size_t size) { - int i; - short *d, *s; - d = (short *) dest; - s = (short *) src; - for (i=0; i<(size/2); i++) { - *d = *s; - d++; - s++; - } + size_t i; + u_int16_t *d, *s; + + d = (u_int16_t *)dest; + s = (u_int16_t *)src; + size /= 2; + for (i = 0; i < size; i++) + *d++ = *s++; } void wzero(void *addr, size_t size) { - int i; - short *d; - d = (short *) addr; - for (i=0; i<(size/2); i++) { - *d = 0; - d++; - } + u_int16_t *d; + + d = (u_int16_t *)addr; + size /= 2; + while (size-- != 0) + *d++ = 0; } int @@ -1362,7 +1355,7 @@ create_free_queue(sc) } void * -get_free_envelope(sc) +get_free_envelope(sc) struct vxsoftc *sc; { void *envp; @@ -1373,7 +1366,7 @@ get_free_envelope(sc) return envp; } -void +void put_free_envelope(sc, ep) struct vxsoftc *sc; void * ep; @@ -1385,7 +1378,7 @@ put_free_envelope(sc, ep) sc->elist_tail = envp; } -void * +void * get_free_packet(sc) struct vxsoftc *sc; { @@ -1397,7 +1390,7 @@ get_free_packet(sc) return pktp; } -void +void put_free_packet(sc, pp) struct vxsoftc *sc; void *pp; @@ -1410,12 +1403,12 @@ put_free_packet(sc, pp) sc->plist_tail = pktp; } -/* +/* * This is the nitty gritty. All the rest if this code - * was hell to come by. Getting this right from the - * Moto manual took *time*! + * was hell to come by. Getting this right from the + * Moto manual took *time*! */ -int +int create_channels(sc) struct vxsoftc *sc; { @@ -1450,7 +1443,7 @@ create_channels(sc) sc->channel->datasize = 0; /* 32 bit data mode */ /* loop until TAS bit is zero */ - while ((ipc_csr->ipc_tas & IPC_TAS_TAS)); + while ((ipc_csr->ipc_tas & IPC_TAS_TAS)); ipc_csr->ipc_tas |= IPC_TAS_TAS; /* load address of channel header */ ipc_csr->ipc_addrh = HI(sc->channel); @@ -1477,29 +1470,29 @@ create_channels(sc) /* check and see if the channel was created */ if (!status && sc->channel->valid) { sc->channel_number = sc->channel->channel_number; - printf("%s: created channel %d\n", sc->sc_dev.dv_xname, + printf("%s: created channel %d\n", sc->sc_dev.dv_xname, sc->channel->channel_number); return 0; } else { switch (status) { case 0x0000: - printf("%s: channel not valid\n", + printf("%s: channel not valid\n", sc->sc_dev.dv_xname); break; case 0xFFFF: - printf("%s: invalid CSR command\n", + printf("%s: invalid CSR command\n", sc->sc_dev.dv_xname); break; case 0xC000: - printf("%s: could not read channel structure\n", + printf("%s: could not read channel structure\n", sc->sc_dev.dv_xname); break; case 0x8000: - printf("%s: could not write channel structure\n", + printf("%s: could not write channel structure\n", sc->sc_dev.dv_xname); break; default: - printf("%s: unknown IPC CSR command error 0x%x\n", + printf("%s: unknown IPC CSR command error 0x%x\n", sc->sc_dev.dv_xname, status); break; } @@ -1528,7 +1521,7 @@ get_next_envelope(thisenv) return ((void *)thisenv->link); } -int +int env_isvalid(thisenv) struct envelope *thisenv; { @@ -1537,7 +1530,7 @@ env_isvalid(thisenv) struct envelope * get_cmd_tail(sc) - struct vxsoftc *sc; + struct vxsoftc *sc; { unsigned long retaddr; retaddr = (unsigned long)sc->vx_reg; @@ -1562,7 +1555,6 @@ set_status_head(sc, envp) { sc->channel->status_pipe_head_ptr_h = HI(envp); sc->channel->status_pipe_head_ptr_l = LO(envp); - return; } struct packet * @@ -1570,15 +1562,15 @@ get_packet(sc, thisenv) struct vxsoftc *sc; struct envelope *thisenv; { - unsigned long baseaddr; + unsigned long baseaddr; if (thisenv == NULL) return NULL; baseaddr = (unsigned long)sc->vx_reg; - /* + /* * packet ptr returned on status pipe is only last two bytes * so we must supply the full address based on the board address. * This also works for all envelopes because every address is an - * offset to the board address + * offset to the board address */ baseaddr |= thisenv->packet_ptr; return ((void *)baseaddr); @@ -1587,7 +1579,7 @@ get_packet(sc, thisenv) /* * Send a command via BPP */ -int +int bpp_send(struct vxsoftc *sc, void *pkt, int wait_flag) { struct envelope *envp; @@ -1612,7 +1604,7 @@ bpp_send(struct vxsoftc *sc, void *pkt, int wait_flag) while (pktp->command != CMD_PROCCESED) { #ifdef DEBUG_VXT printf("Polling for packet 0x%x in envelope 0x%x...\n", pktp, envp); -#endif +#endif vx_intr(sc); delay(5000); } @@ -1626,7 +1618,7 @@ bpp_send(struct vxsoftc *sc, void *pkt, int wait_flag) * BPP commands */ -int +int vx_init(sc) struct vxsoftc *sc; { @@ -1656,7 +1648,7 @@ vx_init(sc) sc->sc_info[i].rringp = rringp; #ifdef DEBUG_VXT printf("write at 0x%8x, read at 0x%8x\n", wringp, rringp); -#endif +#endif infp->write_ring_size = WRING_DATA_SIZE; infp->read_ring_size = RRING_DATA_SIZE; infp->def_termio.c_iflag = VBRKINT; diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h index ebbdbb7de5a..f05cf538b5a 100644 --- a/sys/arch/mvme88k/include/cpu.h +++ b/sys/arch/mvme88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.21 2003/09/20 13:57:35 miod Exp $ */ +/* $OpenBSD: cpu.h,v 1.22 2003/10/05 20:27:46 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -94,7 +94,7 @@ struct clockframe { * conversion between physical and kernel virtual addresses is easy. */ -#ifdef VIRTMAP +#ifdef VIRTMAP /* This will do non 1:1 phys/virt memory mapping in the future - SPM */ #define ISIIOVA(va) \ ((char *)(va) >= intiobase && (char *)(va) < intiolimit) @@ -131,7 +131,7 @@ extern int want_resched; /* resched() was called */ /* * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the sparc, request an ast to send us + * buffer pages are invalid. On the sparc, request an ast to send us * through trap(), marking the proc as needing a profiling tick. */ #define need_proftick(p) ((p)->p_flag |= P_OWEUPC, want_ast = 1) @@ -191,9 +191,8 @@ struct md_p { extern struct md_p md; - -int badvaddr(vm_offset_t va, int size); -void nmihand(void *framep); +int badvaddr(vaddr_t, int); +void nmihand(void *); #endif /* _KERNEL */ #endif /* __MACHINE_CPU_H__ */ diff --git a/sys/arch/mvme88k/include/locore.h b/sys/arch/mvme88k/include/locore.h index 78632f0c043..f45fc68659d 100644 --- a/sys/arch/mvme88k/include/locore.h +++ b/sys/arch/mvme88k/include/locore.h @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.h,v 1.18 2003/09/16 20:52:19 miod Exp $ */ +/* $OpenBSD: locore.h,v 1.19 2003/10/05 20:27:46 miod Exp $ */ #ifndef _MACHINE_LOCORE_H_ #define _MACHINE_LOCORE_H_ @@ -11,27 +11,27 @@ /* locore_asm_routines.S */ -unsigned int do_load_word(vm_offset_t address, +unsigned int do_load_word(vaddr_t address, boolean_t supervisor_mode); -unsigned int do_load_half(vm_offset_t address, +unsigned int do_load_half(vaddr_t address, boolean_t supervisor_mode); -unsigned int do_load_byte(vm_offset_t address, +unsigned int do_load_byte(vaddr_t address, boolean_t supervisor_mode); -void do_store_word(vm_offset_t address, unsigned int data, +void do_store_word(vaddr_t address, unsigned int data, boolean_t supervisor_mode); -void do_store_half(vm_offset_t address, unsigned int data, +void do_store_half(vaddr_t address, unsigned int data, boolean_t supervisor_mode); -void do_store_byte(vm_offset_t address, unsigned int data, +void do_store_byte(vaddr_t address, unsigned int data, boolean_t supervisor_mode); -unsigned do_xmem_word(vm_offset_t address, unsigned int data, +unsigned do_xmem_word(vaddr_t address, unsigned int data, boolean_t supervisor_mode); -unsigned do_xmem_byte(vm_offset_t address, unsigned int data, +unsigned do_xmem_byte(vaddr_t address, unsigned int data, boolean_t supervisor_mode); unsigned read_processor_identification_register(void); -int badaddr(vm_offset_t addr, int size); +int badaddr(vaddr_t addr, int size); #define badwordaddr(x) badaddr(x, 4) void set_cpu_number(unsigned number); void doboot(void); @@ -50,7 +50,7 @@ unsigned getipl(void); /* machdep.c */ void _doboot(void); -vm_offset_t get_slave_stack(void); +vaddr_t get_slave_stack(void); void slave_pre_main(void); int slave_main(void); int intr_findvec(int start, int end); diff --git a/sys/arch/mvme88k/include/m88410.h b/sys/arch/mvme88k/include/m88410.h index 3b99b15f6ac..2fe22af4771 100644 --- a/sys/arch/mvme88k/include/m88410.h +++ b/sys/arch/mvme88k/include/m88410.h @@ -1,4 +1,4 @@ -/* $OpenBSD: m88410.h,v 1.6 2003/08/20 20:33:44 miod Exp $ */ +/* $OpenBSD: m88410.h,v 1.7 2003/10/05 20:27:46 miod Exp $ */ /* * Copyright (c) 2001 Steve Murphree, Jr. * All rights reserved. @@ -44,7 +44,7 @@ #include <machine/psl.h> #ifdef _KERNEL #include <mvme88k/dev/busswreg.h> -#endif +#endif #define XCC_NOP "0x0" #define XCC_FLUSH_PAGE "0x1" @@ -53,14 +53,14 @@ #define XCC_ADDR 0xFF800000 static __inline__ void -mc88410_flush_page(vm_offset_t physaddr) +mc88410_flush_page(paddr_t physaddr) { - vm_offset_t xccaddr = XCC_ADDR | (physaddr >> PGSHIFT); + paddr_t xccaddr = XCC_ADDR | (physaddr >> PGSHIFT); m88k_psr_type psr; struct bussw_reg *bs = (struct bussw_reg *)BS_BASE; u_short bs_gcsr = bs->bs_gcsr; u_short bs_romcr = bs->bs_romcr; - + psr = get_psr(); /* mask misaligned exceptions */ set_psr(psr | PSR_MXM); @@ -78,11 +78,11 @@ mc88410_flush_page(vm_offset_t physaddr) __asm__ __volatile__("ld r4,r5,lo16(%0)" : : "r" (xccaddr)); /* make the double write. bang! */ __asm__ __volatile__("st.d r2,r4,0"); - + /* spin until the operation starts */ while ((bs->bs_xccr & BS_XCC_FBSY) == 0) ; - + /* restore PSR and friends */ set_psr(psr); flush_pipeline(); @@ -97,7 +97,7 @@ mc88410_flush(void) struct bussw_reg *bs = (struct bussw_reg *)BS_BASE; u_short bs_gcsr = bs->bs_gcsr; u_short bs_romcr = bs->bs_romcr; - + psr = get_psr(); /* mask misaligned exceptions */ set_psr(psr | PSR_MXM); @@ -114,12 +114,12 @@ mc88410_flush(void) __asm__ __volatile__("or.u r5,r0,hi16(0xFF800000)"); __asm__ __volatile__("or r4,r5,r0"); /* r4 is now 0xFF800000 */ /* make the double write. bang! */ - __asm__ __volatile__("st.d r2,r4,0"); - + __asm__ __volatile__("st.d r2,r4,0"); + /* spin until the operation starts */ while ((bs->bs_xccr & BS_XCC_FBSY) == 0) ; - + /* restore PSR and friends */ set_psr(psr); flush_pipeline(); @@ -134,7 +134,7 @@ mc88410_inval(void) struct bussw_reg *bs = (struct bussw_reg *)BS_BASE; u_short bs_gcsr = bs->bs_gcsr; u_short bs_romcr = bs->bs_romcr; - + psr = get_psr(); /* mask misaligned exceptions */ set_psr(psr | PSR_MXM); @@ -151,12 +151,12 @@ mc88410_inval(void) __asm__ __volatile__("or.u r5,r0,hi16(0xFF800000)"); __asm__ __volatile__("or r4,r5,r0"); /* r4 is now 0xFF800000 */ /* make the double write. bang! */ - __asm__ __volatile__("st.d r2,r4,0"); - + __asm__ __volatile__("st.d r2,r4,0"); + /* spin until the operation starts */ while ((bs->bs_xccr & BS_XCC_FBSY) == 0) ; - + /* restore PSR and friends */ set_psr(psr); flush_pipeline(); @@ -168,7 +168,7 @@ static __inline__ void mc88410_sync(void) { mc88410_flush(); - mc88410_inval(); + mc88410_inval(); } static __inline__ int diff --git a/sys/arch/mvme88k/include/mmu.h b/sys/arch/mvme88k/include/mmu.h index 283f87bcb68..041568fcba9 100644 --- a/sys/arch/mvme88k/include/mmu.h +++ b/sys/arch/mvme88k/include/mmu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mmu.h,v 1.21 2003/09/26 22:27:25 miod Exp $ */ +/* $OpenBSD: mmu.h,v 1.22 2003/10/05 20:27:46 miod Exp $ */ /* * This file bears almost no resemblance to the original m68k file, @@ -172,7 +172,7 @@ typedef u_int32_t pt_ind_entry_t; #define PDT_SIZE (sizeof(pt_entry_t) * PDT_ENTRIES) /* - * Shifts and masks + * Shifts and masks */ #define SDT_SHIFT (PDT_BITS + PG_BITS) @@ -242,17 +242,15 @@ typedef u_int32_t pt_ind_entry_t; #define DMA_CACHE_SYNC_INVAL 0x2 #define DMA_CACHE_INV 0x3 -void dma_cachectl(vm_offset_t, int, int); +pt_entry_t invalidate_pte(pt_entry_t *); -unsigned invalidate_pte(pt_entry_t *); - -extern vm_offset_t kmapva; +extern vaddr_t kmapva; #define kvtopte(va) \ ((pt_entry_t *)(PG_PFNUM(*((sdt_entry_t *)kmapva + \ SDTIDX(va) + SDT_ENTRIES)) << PDT_SHIFT) + PDTIDX(va)) -u_int kvtop(vm_offset_t); +u_int kvtop(vaddr_t); #endif /* __MACHINE_MMU_H__ */ diff --git a/sys/arch/mvme88k/include/pmap_table.h b/sys/arch/mvme88k/include/pmap_table.h index 8d12e028e70..faab4e416ee 100644 --- a/sys/arch/mvme88k/include/pmap_table.h +++ b/sys/arch/mvme88k/include/pmap_table.h @@ -1,27 +1,27 @@ -/* $OpenBSD: pmap_table.h,v 1.9 2003/09/16 20:52:19 miod Exp $ */ -/* +/* $OpenBSD: pmap_table.h,v 1.10 2003/10/05 20:27:46 miod Exp $ */ +/* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon + * + * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -34,9 +34,9 @@ * end of list is indicated by pm_size 0xffffffff */ typedef struct { - vm_offset_t phys_start; /* in bytes */ - vm_offset_t virt_start; /* in bytes */ - unsigned int size; /* in bytes */ + vaddr_t phys_start; /* in bytes */ + vaddr_t virt_start; /* in bytes */ + vsize_t size; /* in bytes */ unsigned int prot; /* vm_prot_read, vm_prot_write */ unsigned int cacheability; /* none, writeback, normal */ } pmap_table_entry; diff --git a/sys/arch/mvme88k/include/types.h b/sys/arch/mvme88k/include/types.h index ac004821b12..bd182614d5a 100644 --- a/sys/arch/mvme88k/include/types.h +++ b/sys/arch/mvme88k/include/types.h @@ -1,5 +1,5 @@ /* $NetBSD: types.h,v 1.7 1995/07/05 17:46:11 pk Exp $ */ -/* $OpenBSD: types.h,v 1.11 2003/08/01 07:44:58 miod Exp $ */ +/* $OpenBSD: types.h,v 1.12 2003/10/05 20:27:46 miod Exp $ */ /* * Copyright (c) 1992, 1993 @@ -52,9 +52,6 @@ typedef struct label_t { } label_t; #endif -typedef unsigned long vm_offset_t; -typedef unsigned long vm_size_t; - typedef unsigned long vaddr_t; typedef unsigned long paddr_t; typedef unsigned long vsize_t; diff --git a/sys/arch/mvme88k/include/vmparam.h b/sys/arch/mvme88k/include/vmparam.h index d8ac921c26c..01d5683df30 100644 --- a/sys/arch/mvme88k/include/vmparam.h +++ b/sys/arch/mvme88k/include/vmparam.h @@ -1,27 +1,27 @@ -/* $OpenBSD: vmparam.h,v 1.23 2003/10/02 10:18:11 miod Exp $ */ -/* +/* $OpenBSD: vmparam.h,v 1.24 2003/10/05 20:27:46 miod Exp $ */ +/* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University * All Rights Reserved. - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon + * + * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. */ @@ -77,14 +77,14 @@ */ #define MAXSLP 20 -#define VM_MIN_ADDRESS ((vm_offset_t) 0) -#define VM_MAX_ADDRESS ((vm_offset_t) 0xffc00000) +#define VM_MIN_ADDRESS ((vaddr_t) 0) +#define VM_MAX_ADDRESS ((vaddr_t) 0xffc00000) #define VM_MAXUSER_ADDRESS VM_MAX_ADDRESS /* on vme188, max = 0xf0000000 */ -#define VM_MIN_KERNEL_ADDRESS ((vm_offset_t) 0) -#define VM_MAX_KERNEL_ADDRESS ((vm_offset_t) 0x20000000) +#define VM_MIN_KERNEL_ADDRESS ((vaddr_t) 0) +#define VM_MAX_KERNEL_ADDRESS ((vaddr_t) 0x20000000) #define KERNEL_STACK_SIZE (3 * PAGE_SIZE) /* kernel stack size */ #define INTSTACK_SIZE (4 * PAGE_SIZE) /* interrupt stack size */ diff --git a/sys/arch/mvme88k/mvme88k/cmmu.c b/sys/arch/mvme88k/mvme88k/cmmu.c index dc7be3bc3bc..b95139df190 100644 --- a/sys/arch/mvme88k/mvme88k/cmmu.c +++ b/sys/arch/mvme88k/mvme88k/cmmu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmmu.c,v 1.21 2003/09/16 20:52:22 miod Exp $ */ +/* $OpenBSD: cmmu.c,v 1.22 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -63,13 +63,14 @@ #include <machine/cmmu.h> #include <machine/cpu_number.h> -/* - * This lock protects the cmmu SAR and SCR's; other ports - * can be accessed without locking it +/* + * This lock protects the cmmu SAR and SCR's; other ports + * can be accessed without locking it. * * May be used from "db_interface.c". */ struct simplelock cmmu_cpu_lock; + unsigned cache_policy = /*CACHE_INH*/ 0; unsigned cpu_sets[MAX_CPUS]; unsigned master_cpu = 0; @@ -78,12 +79,11 @@ int cpu_cmmu_ratio; struct cmmu_p *cmmu; -void md_cmmu_flush_tlb(unsigned kernel, vm_offset_t vaddr, int size); +void md_cmmu_flush_tlb(unsigned kernel, vaddr_t vaddr, int size); /* This is here so that process.S doesn't have to decide the CPU type */ -void -md_cmmu_flush_tlb(unsigned kernel, vm_offset_t vaddr, int size) +void +md_cmmu_flush_tlb(unsigned kernel, vaddr_t vaddr, int size) { cmmu_flush_tlb(kernel, vaddr, size); } - diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 8db1e20fe39..fb0314e151b 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.115 2003/10/02 10:19:11 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.116 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -88,7 +88,7 @@ #include <machine/trap.h> #ifdef M88100 #include <machine/m88100.h> /* DMT_VALID */ -#endif +#endif #include <dev/cons.h> @@ -113,7 +113,7 @@ #endif /* DDB */ struct intrhand *intr_handlers[256]; -vm_offset_t interrupt_stack[MAX_CPUS]; +vaddr_t interrupt_stack[MAX_CPUS]; /* machine dependant function pointers. */ struct md_p md; @@ -123,11 +123,11 @@ void setupiackvectors(void); void regdump(struct trapframe *f); void dumpsys(void); void consinit(void); -vm_offset_t size_memory(void); -vm_offset_t memsize187(void); +vaddr_t size_memory(void); +vaddr_t memsize187(void); int getcpuspeed(void); void identifycpu(void); -void save_u_area(struct proc *, vm_offset_t); +void save_u_area(struct proc *, vaddr_t); void load_u_area(struct proc *); void dumpconf(void); void m187_ext_int(u_int v, struct m88100_saved_state *eframe); @@ -157,20 +157,20 @@ unsigned int *volatile int_mask_reg[MAX_CPUS] = { (unsigned int *)IEN2_REG, (unsigned int *)IEN3_REG }; -#endif +#endif #if defined(MVME187) || defined(MVME197) -volatile vm_offset_t obiova; +volatile vaddr_t obiova; #ifdef MVME187 -volatile vm_offset_t bugromva; -volatile vm_offset_t sramva; +volatile vaddr_t bugromva; +volatile vaddr_t sramva; #endif #ifdef MVME197 -volatile vm_offset_t flashva; +volatile vaddr_t flashva; #endif #endif #ifdef MVME188 -volatile vm_offset_t utilva; +volatile vaddr_t utilva; #endif int ssir; @@ -252,31 +252,26 @@ int brdtyp; /* set in locore.S */ int cpumod; /* set in mvme_bootstrap() */ int cpuspeed; -vm_offset_t first_addr = 0; -vm_offset_t last_addr = 0; +vaddr_t first_addr; +vaddr_t last_addr; -vm_offset_t avail_start, avail_end; -vm_offset_t virtual_avail, virtual_end; +vaddr_t avail_start, avail_end; +vaddr_t virtual_avail, virtual_end; pcb_t curpcb; extern struct user *proc0paddr; -/* - * XXX this is to fake out the console routines, while +/* + * XXX this is to fake out the console routines, while * booting. New and improved! :-) smurph */ -void bootcnprobe(struct consdev *); -void bootcninit(struct consdev *); -void bootcnputc(dev_t, int); -int bootcngetc(dev_t); -extern void nullcnpollc(dev_t, int); - +cons_decl(boot); #define bootcnpollc nullcnpollc struct consdev bootcons = { - NULL, - NULL, - bootcngetc, + NULL, + NULL, + bootcngetc, bootcnputc, bootcnpollc, NULL, @@ -313,17 +308,17 @@ consinit() * Figure out how much memory is available, by querying the memory controllers */ #include <mvme88k/dev/memcreg.h> -vm_offset_t +vaddr_t memsize187() { struct memcreg *memc; - vm_offset_t x; + vaddr_t x; - memc = (struct memcreg *)0xfff43000; + memc = (struct memcreg *)MEM_CTLR; x = MEMC_MEMCONF_RTOB(memc->memc_memconf); - memc = (struct memcreg *)0xfff43100; - if (!badaddr((vm_offset_t)&memc->memc_memconf, 1)) + memc = (struct memcreg *)(MEM_CTLR + 0x100); + if (!badaddr((vaddr_t)&memc->memc_memconf, 1)) x += MEMC_MEMCONF_RTOB(memc->memc_memconf); return x; @@ -336,7 +331,7 @@ memsize187() * Start looking from the megabyte after the end of the kernel data, * until we find non-memory. */ -vm_offset_t +vaddr_t size_memory() { unsigned int *volatile look; @@ -374,7 +369,7 @@ size_memory() break; *look = save; } - + return (trunc_page((unsigned)look)); } #endif /* defined(MVME188) || defined(MVME197) */ @@ -423,60 +418,50 @@ identifycpu() */ void -save_u_area(struct proc *p, vm_offset_t va) +save_u_area(struct proc *p, vaddr_t va) { - int i; - for (i=0; i<UPAGES; i++) { - p->p_md.md_upte[i] = *((pt_entry_t *)kvtopte((va + (i * NBPG)))); + int i; + + for (i = 0; i < UPAGES; i++) { + p->p_md.md_upte[i] = *((pt_entry_t *)kvtopte(va)); + va += NBPG; } } void load_u_area(struct proc *p) { + int i; + vaddr_t va; pt_entry_t *t; - int i; - for (i=0; i<UPAGES; i++) { - t = kvtopte((UADDR + (i * NBPG))); + for (i = 0, va = UADDR; i < UPAGES; i++) { + t = kvtopte(va); *t = p->p_md.md_upte[i]; + va += NBPG; } - for (i=0; i<UPAGES; i++) { - cmmu_flush_tlb(1, (UADDR + (i * NBPG)), NBPG); - } + cmmu_flush_tlb(1, va, USPACE); } /* * Set up real-time clocks. * These function pointers are set in dev/clock.c and dev/sclock.c */ -void +void cpu_initclocks() { -#ifdef DEBUG - printf("cpu_initclocks(): "); -#endif if (md.clock_init_func != NULL) { -#ifdef DEBUG - printf("[interval clock] "); -#endif (*md.clock_init_func)(); } if (md.statclock_init_func != NULL) { -#ifdef DEBUG - printf("[statistics clock]"); -#endif (*md.statclock_init_func)(); } -#ifdef DEBUG - printf("\n"); -#endif } void setstatclockrate(int newhz) { - /* function stub */ + /* function stub */ } @@ -485,7 +470,7 @@ cpu_startup() { caddr_t v; int sz, i; - vm_size_t size; + vsize_t size; int base, residual; vaddr_t minaddr, maxaddr, uarea_pages; @@ -494,8 +479,8 @@ cpu_startup() * avail_end was pre-decremented in mvme_bootstrap() to compensate. */ for (i = 0; i < btoc(MSGBUFSIZE); i++) - pmap_kenter_pa((vm_offset_t)msgbufp + i * NBPG, - avail_end + i * NBPG, VM_PROT_READ|VM_PROT_WRITE); + pmap_kenter_pa((paddr_t)msgbufp + i * NBPG, + avail_end + i * NBPG, VM_PROT_READ | VM_PROT_WRITE); pmap_update(pmap_kernel()); initmsgbuf((caddr_t)msgbufp, round_page(MSGBUFSIZE)); @@ -527,8 +512,8 @@ cpu_startup() UVM_ADV_NORMAL, 0)); if (uarea_pages != UADDR) panic("uarea_pages %x: UADDR not free\n", uarea_pages); - - /* + + /* * Grab machine dependant memory spaces */ switch (brdtyp) { @@ -555,7 +540,7 @@ cpu_startup() UVM_ADV_NORMAL, 0)); if (bugromva != BUG187_START) panic("bugromva %x: BUGROM not free\n", bugromva); - + /* * Grab the OBIO space that we hardwired in pmap_bootstrap */ @@ -567,7 +552,7 @@ cpu_startup() if (obiova != OBIO_START) panic("obiova %x: OBIO not free\n", obiova); break; -#endif +#endif #ifdef MVME197 case BRD_197: /* @@ -580,7 +565,7 @@ cpu_startup() UVM_ADV_NORMAL, 0)); if (flashva != FLASH_START) panic("flashva %x: FLASH not free\n", flashva); - + /* * Grab the OBIO space that we hardwired in pmap_bootstrap */ @@ -592,7 +577,7 @@ cpu_startup() if (obiova != OBIO_START) panic("obiova %x: OBIO not free\n", obiova); break; -#endif +#endif #ifdef MVME188 case BRD_188: /* @@ -638,7 +623,7 @@ cpu_startup() * for the first "residual" buffers, and then we allocate * "base" pages for the rest. */ - curbuf = (vm_offset_t) buffers + (i * MAXBSIZE); + curbuf = (vaddr_t)buffers + (i * MAXBSIZE); curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { @@ -647,7 +632,7 @@ cpu_startup() panic("cpu_startup: not enough memory for " "buffer cache"); pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg), - VM_PROT_READ|VM_PROT_WRITE); + VM_PROT_READ | VM_PROT_WRITE); curbuf += PAGE_SIZE; curbufsize -= PAGE_SIZE; } @@ -660,14 +645,14 @@ cpu_startup() */ exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, 16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL); - + /* * Allocate map for physio. */ phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE, 0, FALSE, NULL); - /* + /* * Allocate map for external I/O. */ iomap_map = uvm_km_suballoc(kernel_map, &iomapbase, &maxaddr, @@ -716,7 +701,7 @@ cpu_startup() */ caddr_t allocsys(v) - register caddr_t v; + caddr_t v; { #define valloc(name, type, num) \ @@ -750,8 +735,8 @@ allocsys(v) /* Restrict to at most 70% filled kvm */ if (nbuf > - (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 7 / 10) - nbuf = (VM_MAX_KERNEL_ADDRESS-VM_MIN_KERNEL_ADDRESS) / + (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 7 / 10) + nbuf = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ @@ -774,7 +759,7 @@ setregs(p, pack, stack, retval) u_long stack; int retval[2]; { - register struct trapframe *tf = USER_REGS(p); + struct trapframe *tf = USER_REGS(p); /* * The syscall will ``return'' to snip; set it. @@ -804,21 +789,21 @@ setregs(p, pack, stack, retval) } #endif /* 0 */ bzero((caddr_t)tf, sizeof *tf); - + if (cputyp == CPU_88110) { - /* - * user mode, serialize mem, interrupts enabled, - * graphics unit, fp enabled + /* + * user mode, serialize mem, interrupts enabled, + * graphics unit, fp enabled */ - tf->epsr = PSR_SRM | PSR_SFD; + tf->epsr = PSR_SRM | PSR_SFD; /* * XXX disable OoO for now... */ tf->epsr |= PSR_SER; } else { - /* - * user mode, interrupts enabled, - * no graphics unit, fp enabled + /* + * user mode, interrupts enabled, + * no graphics unit, fp enabled */ tf->epsr = PSR_SFD | PSR_SFD2; } @@ -881,9 +866,9 @@ sendsig(catcher, sig, mask, code, type, val) int type; union sigval val; { - register struct proc *p = curproc; - register struct trapframe *tf; - register struct sigacts *psp = p->p_sigacts; + struct proc *p = curproc; + struct trapframe *tf; + struct sigacts *psp = p->p_sigacts; struct sigframe *fp; int oonstack, fsize; struct sigframe sf; @@ -907,7 +892,7 @@ sendsig(catcher, sig, mask, code, type, val) psp->ps_sigstk.ss_flags |= SS_ONSTACK; } else fp = (struct sigframe *)(tf->r[31] - fsize); - if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) + if ((unsigned)fp <= USRSTACK - ctob(p->p_vmspace->vm_ssize)) (void)uvm_grow(p, (unsigned)fp); #ifdef DEBUG @@ -998,7 +983,7 @@ sendsig(catcher, sig, mask, code, type, val) psignal(p, SIGILL); return; } - /* + /* * Build the argument list for the signal handler. * Signal trampoline code is at base of user stack. */ @@ -1041,8 +1026,8 @@ sys_sigreturn(p, v, retval) struct sys_sigreturn_args /* { syscallarg(struct sigcontext *) sigcntxp; } */ *uap = v; - register struct sigcontext *scp; - register struct trapframe *tf; + struct sigcontext *scp; + struct trapframe *tf; struct sigcontext ksc; scp = (struct sigcontext *)SCARG(uap, sigcntxp); @@ -1070,7 +1055,7 @@ sys_sigreturn(p, v, retval) scp->sc_xip, scp->sc_nip, scp->sc_fip); return (EINVAL); } -#endif +#endif /* * this can be improved by doing * bcopy(sc_reg to tf, sizeof sigcontext - 2 words) @@ -1149,7 +1134,7 @@ _doboot() __dead void boot(howto) - register int howto; + int howto; { /* take a snapshot before clobbering any registers */ if (curproc && curproc->p_addr) @@ -1197,7 +1182,7 @@ haltsys: } #ifdef MVME188 -void +void m188_reset() { volatile int cnt; @@ -1351,7 +1336,7 @@ abort: case 0: printf("succeeded\n"); break; - + case ENXIO: printf("device bad\n"); break; @@ -1384,10 +1369,10 @@ abort: void setupiackvectors() { - register u_char *vaddr; + u_char *vaddr; #undef MAP_VEC /* Switching to new virtual addresses XXX smurph */ #ifdef MAP_VEC - extern vm_offset_t iomap_mapin(vm_offset_t, vm_size_t, boolean_t); + extern vaddr_t iomap_mapin(paddr_t, psize_t, boolean_t); #endif /* * map a page in for phys address 0xfffe0000 (M187) and set the @@ -1434,7 +1419,7 @@ setupiackvectors() } #ifdef DEBUG printf("interrupt ACK address mapped at 0x%x\n", vaddr); -#endif +#endif #if defined(MVME187) || defined(MVME197) if (brdtyp != BRD_188) { @@ -1451,12 +1436,12 @@ setupiackvectors() } /* gets an interrupt stack for slave processors */ -vm_offset_t +vaddr_t get_slave_stack() { - vm_offset_t addr; + vaddr_t addr; - addr = (vm_offset_t)uvm_km_zalloc(kernel_map, INTSTACK_SIZE); + addr = (vaddr_t)uvm_km_zalloc(kernel_map, INTSTACK_SIZE); if (addr == NULL) panic("Cannot allocate slave stack for cpu %d", @@ -1525,7 +1510,7 @@ intr_findvec(start, end) int intr_establish(int vec, struct intrhand *ihand) { - register struct intrhand *intr; + struct intrhand *intr; if (vec < 0 || vec > 255) { #if DIAGNOSTIC @@ -1578,14 +1563,14 @@ unsigned obio_vec[32] = { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,SYSCV_SCC,0,0,SYSCV_SYSF,SYSCV_TIMER2,0,0, - 0,0,0,0,SYSCV_TIMER1,0,SYSCV_ACF,SYSCV_ABRT, + 0,0,0,0,SYSCV_TIMER1,0,SYSCV_ACF,SYSCV_ABRT, }; #define GET_MASK(cpu, val) *int_mask_reg[cpu] & (val) #define VME_VECTOR_MASK 0x1ff /* mask into VIACK register */ #define VME_BERR_MASK 0x100 /* timeout during VME IACK cycle */ -void +void m188_ext_int(u_int v, struct m88100_saved_state *eframe) { int cpu = cpu_number(); @@ -1610,17 +1595,17 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) uvmexp.intrs++; - /* + /* * We want to service all interrupts marked in the IST register * They are all valid because the mask would have prevented them * from being generated otherwise. We will service them in order of - * priority. + * priority. */ do { level = safe_level(cur_mask, old_spl); if (old_spl >= level) { - register int i; + int i; printf("safe level %d <= old level %d\n", level, old_spl); printf("cur_mask = 0x%b\n", cur_mask, IST_STRING); @@ -1643,7 +1628,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) #endif setipl(level); - + /* * Do not enable interrupts yet if we know, from cur_mask, * that we have not cleared enough conditions yet. @@ -1653,12 +1638,12 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) if ((cur_mask & DTI_BIT) == 0) { enable_interrupt(); } - + /* generate IACK and get the vector */ - /* - * This is tricky. If you don't catch all the - * interrupts, you die. Game over. Insert coin... + /* + * This is tricky. If you don't catch all the + * interrupts, you die. Game over. Insert coin... * XXX smurph */ @@ -1699,7 +1684,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) if ((intr = intr_handlers[vec]) == NULL) { /* increment intr counter */ - intrcnt[M88K_SPUR_IRQ]++; + intrcnt[M88K_SPUR_IRQ]++; printf("Spurious interrupt: level = %d vec = 0x%x, " "intbit = %d mask = 0x%b\n", level, vec, intbit, 1 << intbit, IST_STRING); @@ -1716,7 +1701,7 @@ m188_ext_int(u_int v, struct m88100_saved_state *eframe) ret = (*intr->ih_fn)(intr->ih_arg); if (ret != 0) { /* increment intr counter */ - intrcnt[level]++; + intrcnt[level]++; break; } } @@ -1810,7 +1795,7 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) if ((intr = intr_handlers[vec]) == NULL) { /* increment intr counter */ - intrcnt[M88K_SPUR_IRQ]++; + intrcnt[M88K_SPUR_IRQ]++; printf("Spurious interrupt (level %x and vec %x)\n", level, vec); } else { @@ -1835,7 +1820,7 @@ m187_ext_int(u_int v, struct m88100_saved_state *eframe) ret = (*intr->ih_fn)(intr->ih_arg); if (ret != 0) { /* increment intr counter */ - intrcnt[level]++; + intrcnt[level]++; break; } } @@ -1874,7 +1859,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) /* get src and mask */ mask = *md.intr_mask & 0x07; src = *md.intr_src; - + if (v == T_NON_MASK) { /* This is the abort switch */ level = IPL_NMI; @@ -1915,7 +1900,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) if ((intr = intr_handlers[vec]) == NULL) { /* increment intr counter */ - intrcnt[M88K_SPUR_IRQ]++; + intrcnt[M88K_SPUR_IRQ]++; printf("Spurious interrupt (level %x and vec %x)\n", level, vec); } else { @@ -1937,7 +1922,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) ret = (*intr->ih_fn)(intr->ih_arg); if (ret != 0) { /* increment intr counter */ - intrcnt[level]++; + intrcnt[level]++; break; } } @@ -1956,7 +1941,7 @@ m197_ext_int(u_int v, struct m88100_saved_state *eframe) */ setipl(eframe->mask); } -#endif +#endif int cpu_exec_aout_makecmds(p, epp) @@ -2042,14 +2027,14 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) } /* - * insert an element into a queue + * insert an element into a queue */ void _insque(velement, vhead) void *velement, *vhead; { - register struct prochd *element, *head; + struct prochd *element, *head; element = velement; head = vhead; element->ph_link = head->ph_link; @@ -2066,7 +2051,7 @@ void _remque(velement) void *velement; { - register struct prochd *element; + struct prochd *element; element = velement; ((struct prochd *)(element->ph_link))->ph_rlink = element->ph_rlink; ((struct prochd *)(element->ph_rlink))->ph_link = element->ph_link; @@ -2101,11 +2086,11 @@ copystr(fromaddr, toaddr, maxlength, lencopied) void setrunqueue(p) - register struct proc *p; + struct proc *p; { - register struct prochd *q; - register struct proc *oldlast; - register int which = p->p_priority >> 2; + struct prochd *q; + struct proc *oldlast; + int which = p->p_priority >> 2; if (p->p_back != NULL) panic("setrunqueue %x", p); @@ -2125,9 +2110,9 @@ void remrunqueue(vp) struct proc *vp; { - register struct proc *p = vp; - register int which = p->p_priority >> 2; - register struct prochd *q; + struct proc *p = vp; + int which = p->p_priority >> 2; + struct prochd *q; if ((whichqs & (1 << which)) == 0) panic("remrq %x", p); @@ -2206,7 +2191,7 @@ MY_info(f, p, flags, s) { regdump(f); printf("proc %x flags %x type %s\n", p, flags, s); -} +} void MY_info_done(f, flags) @@ -2214,7 +2199,7 @@ MY_info_done(f, flags) int flags; { regdump(f); -} +} #endif @@ -2263,25 +2248,25 @@ regdump(struct trapframe *f) dae_print((unsigned *)f); } if (longformat && cputyp != CPU_88110) { - printf("fpsr %x fpcr %x epsr %x ssbr %x\n", + printf("fpsr %x fpcr %x epsr %x ssbr %x\n", f->fpsr, f->fpcr, f->epsr, f->ssbr); - printf("fpecr %x fphs1 %x fpls1 %x fphs2 %x fpls2 %x\n", + printf("fpecr %x fphs1 %x fpls1 %x fphs2 %x fpls2 %x\n", f->fpecr, f->fphs1, f->fpls1, f->fphs2, f->fpls2); - printf("fppt %x fprh %x fprl %x fpit %x\n", + printf("fppt %x fprh %x fprl %x fpit %x\n", f->fppt, f->fprh, f->fprl, f->fpit); - printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", + printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", f->vector, f->mask, f->mode, f->scratch1, f->cpu); } -#endif +#endif #ifdef M88110 if (longformat && cputyp == CPU_88110) { - printf("fpsr %x fpcr %x fpecr %x epsr %x\n", + printf("fpsr %x fpcr %x fpecr %x epsr %x\n", f->fpsr, f->fpcr, f->fpecr, f->epsr); printf("dsap %x duap %x dsr %x dlar %x dpar %x\n", f->dsap, f->duap, f->dsr, f->dlar, f->dpar); printf("isap %x iuap %x isr %x ilar %x ipar %x\n", f->isap, f->iuap, f->isr, f->ilar, f->ipar); - printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", + printf("vector %d mask %x mode %x scratch1 %x cpu %x\n", f->vector, f->mask, f->mode, f->scratch1, f->cpu); } #endif @@ -2295,7 +2280,7 @@ regdump(struct trapframe *f) printf("istr = 0x%b\n", istr, IST_STRING); printf("cmask = 0x%b\n", cur_mask, IST_STRING); } -#endif +#endif } /* @@ -2308,14 +2293,16 @@ mvme_bootstrap() { extern int kernelstart; extern struct consdev *cn_tab; + extern struct cmmu_p cmmu88110; + extern struct cmmu_p cmmu8820x; extern void set_tcfp(void); struct mvmeprom_brdid brdid; - + /* * Must initialize p_addr before autoconfig or * the fault handler will get a NULL reference. - * Do this early so that we can take a data or + * Do this early so that we can take a data or * instruction fault and survive it. XXX smurph */ proc0.p_addr = proc0paddr; @@ -2335,8 +2322,8 @@ mvme_bootstrap() /* XXX Need to flag the 8120 has a second cl(4) device on-board */ } - /* - * set up interrupt and fp exception handlers + /* + * set up interrupt and fp exception handlers * based on the machine. */ switch (brdtyp) { @@ -2426,7 +2413,7 @@ mvme_bootstrap() if (!spin_cpu(i)) printf("CPU%d started\n", i); } -#endif +#endif break; case BRD_197: /* @@ -2446,19 +2433,19 @@ mvme_bootstrap() #ifdef DEBUG printf("MVME%x boot: memory from 0x%x to 0x%x\n", brdtyp, avail_start, avail_end); -#endif - pmap_bootstrap((vm_offset_t)trunc_page((unsigned)&kernelstart) /* = loadpt */, +#endif + pmap_bootstrap((vaddr_t)trunc_page((unsigned)&kernelstart) /* = loadpt */, &avail_start, &avail_end, &virtual_avail, &virtual_end); /* - * Tell the VM system about available physical memory. + * Tell the VM system about available physical memory. * mvme88k only has one segment. */ uvm_page_physload(atop(avail_start), atop(avail_end), atop(avail_start), atop(avail_end),VM_FREELIST_DEFAULT); /* Initialize cached PTEs for u-area mapping. */ - save_u_area(&proc0, (vm_offset_t)proc0paddr); + save_u_area(&proc0, (vaddr_t)proc0paddr); /* * Map proc0's u-area at the standard address (UADDR). @@ -2469,11 +2456,11 @@ mvme_bootstrap() bzero((caddr_t)UADDR, UPAGES*NBPG); #ifdef DEBUG printf("leaving mvme_bootstrap()\n"); -#endif +#endif } /* - * Boot console routines: + * Boot console routines: * Enables printing of boot messages before consinit(). */ void diff --git a/sys/arch/mvme88k/mvme88k/mem.c b/sys/arch/mvme88k/mvme88k/mem.c index ade674bfc4f..85004ea86da 100644 --- a/sys/arch/mvme88k/mvme88k/mem.c +++ b/sys/arch/mvme88k/mvme88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.18 2003/06/02 23:27:52 millert Exp $ */ +/* $OpenBSD: mem.c,v 1.19 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -94,9 +94,9 @@ mmrw(dev, uio, flags) struct uio *uio; int flags; { - register vm_offset_t o, v; - register int c; - register struct iovec *iov; + vaddr_t o, v; + int c; + struct iovec *iov; int error = 0; static int physlock = 0; extern caddr_t vmmap; @@ -131,7 +131,7 @@ mmrw(dev, uio, flags) error = EFAULT; goto unlock; } - pmap_enter(pmap_kernel(), (vm_offset_t)vmmap, + pmap_enter(pmap_kernel(), (vaddr_t)vmmap, trunc_page(v), uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE, (uio->uio_rw == UIO_READ ? VM_PROT_READ : VM_PROT_WRITE) | PMAP_WIRED); @@ -139,8 +139,8 @@ mmrw(dev, uio, flags) o = uio->uio_offset & PGOFSET; c = min(uio->uio_resid, (int)(NBPG - o)); error = uiomove((caddr_t)vmmap + o, c, uio); - pmap_remove(pmap_kernel(), (vm_offset_t)vmmap, - (vm_offset_t)vmmap + NBPG); + pmap_remove(pmap_kernel(), (vaddr_t)vmmap, + (vaddr_t)vmmap + NBPG); pmap_update(pmap_kernel()); continue; @@ -165,7 +165,7 @@ mmrw(dev, uio, flags) bzero(zeropage, PAGE_SIZE); } c = min(c, NBPG - (int)v); - v = (vm_offset_t)zeropage; + v = (vaddr_t)zeropage; } else #endif return (EFAULT); diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index 6d30ad32016..49458fd4fb3 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.53 2003/10/02 10:20:12 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.54 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -59,12 +59,11 @@ #include <uvm/uvm_extern.h> #include <machine/asm_macro.h> /* enable/disable interrupts */ -#include <machine/bugio.h> /* bugreturn() */ #include <machine/cpu.h> #include <machine/locore.h> #ifdef M88100 -#include <machine/m88100.h> -#include <machine/m8820x.h> +#include <machine/m88100.h> /* DMT_xxx */ +#include <machine/m8820x.h> /* CMMU_PFSR_xxx */ #endif #ifdef M88110 #include <machine/m88110.h> @@ -85,10 +84,10 @@ unsigned traptrace = 0; #endif -#if DDB -#define DEBUG_MSG db_printf +#ifdef DDB +#define DEBUG_MSG(x) db_printf x #else -#define DEBUG_MSG printf +#define DEBUG_MSG(x) #endif /* DDB */ #define USERMODE(PSR) (((PSR) & PSR_MODE) == 0) @@ -98,7 +97,7 @@ unsigned traptrace = 0; extern int procfs_domem(struct proc *, struct proc *, void *, struct uio *); extern void regdump(struct trapframe *f); -void error_fatal(struct m88100_saved_state *frame); +__dead void error_fatal(struct m88100_saved_state *frame); char *trap_type[] = { "Reset", @@ -153,35 +152,38 @@ userret(struct proc *p, struct m88100_saved_state *frame, u_quad_t oticks) if (p->p_flag & P_PROFIL) { extern int psratio; - addupc_task(p, frame->sxip & ~3, + addupc_task(p, frame->sxip & XIP_ADDR, (int)(p->p_sticks - oticks) * psratio); } curpriority = p->p_priority; } -void +__dead void panictrap(int type, struct m88100_saved_state *frame) { +#ifdef DDB static int panicing = 0; if (panicing++ == 0) { if (type == 2 && cputyp == CPU_88100) { /* instruction exception */ - DEBUG_MSG("\nInstr access fault (%s) v = %x, frame %x\n", + db_printf("\nInstr access fault (%s) v = %x, frame %x\n", pbus_exception_type[(frame->ipfsr >> 16) & 0x7], - frame->sxip & ~3, frame); + frame->sxip & XIP_ADDR, frame); } else if (type == 3 && cputyp == CPU_88100) { /* data access exception */ - DEBUG_MSG("\nData access fault (%s) v = %x, frame %x\n", + db_printf("\nData access fault (%s) v = %x, frame %x\n", pbus_exception_type[(frame->dpfsr >> 16) & 0x7], - frame->sxip & ~3, frame); + frame->sxip & XIP_ADDR, frame); } else - DEBUG_MSG("\ntrap type %d, v = %x, frame %x\n", type, frame->sxip & ~3, frame); + db_printf("\ntrap type %d, v = %x, frame %x\n", type, frame->sxip & XIP_ADDR, frame); regdump(frame); } +#endif if ((u_int)type < trap_types) panic(trap_type[type]); - panic("trap"); + else + panic("trap %d", type); /*NOTREACHED*/ } @@ -195,21 +197,21 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) struct proc *p; u_quad_t sticks = 0; struct vm_map *map; - vm_offset_t va; + vaddr_t va; vm_prot_t ftype; int fault_type, pbus_type; u_long fault_code; unsigned nss, fault_addr; struct vmspace *vm; union sigval sv; - int result; + int result, s; int sig = 0; unsigned pc = PC_REGS(frame); /* get program counter (sxip) */ extern struct vm_map *kernel_map; - extern unsigned guarded_access_start; - extern unsigned guarded_access_end; - extern unsigned guarded_access_bad; + extern caddr_t guarded_access_start; + extern caddr_t guarded_access_end; + extern caddr_t guarded_access_bad; if (type != last_trap[3]) { last_trap[0] = last_trap[1]; @@ -231,56 +233,40 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) switch (type) { default: panictrap(frame->vector, frame); + break; /*NOTREACHED*/ #if defined(DDB) case T_KDB_BREAK: - { - int s = splhigh(); - db_enable_interrupt(); - ddb_break_trap(T_KDB_BREAK,(db_regs_t*)frame); - db_disable_interrupt(); - splx(s); - return; - } + s = splhigh(); + db_enable_interrupt(); + ddb_break_trap(T_KDB_BREAK, (db_regs_t*)frame); + db_disable_interrupt(); + splx(s); + return; case T_KDB_ENTRY: - { - int s = splhigh(); - db_enable_interrupt(); - ddb_entry_trap(T_KDB_ENTRY,(db_regs_t*)frame); - db_disable_interrupt(); - splx(s); - return; - } - -#if 0 - case T_ILLFLT: - { - int s = splhigh(); - db_enable_interrupt(); - ddb_error_trap(type == T_ILLFLT ? "unimplemented opcode" : - "error fault", (db_regs_t*)frame); - db_disable_interrupt(); - splx(s); - return; - } -#endif /* 0 */ + s = splhigh(); + db_enable_interrupt(); + ddb_entry_trap(T_KDB_ENTRY, (db_regs_t*)frame); + db_disable_interrupt(); + splx(s); + return; #endif /* DDB */ case T_ILLFLT: - DEBUG_MSG("Unimplemented opcode!\n"); + DEBUG_MSG(("Unimplemented opcode!\n")); panictrap(frame->vector, frame); break; case T_INT: case T_INT+T_USER: - /* This function pointer is set in machdep.c + /* This function pointer is set in machdep.c It calls m188_ext_int or sbc_ext_int depending on the value of brdtyp - smurph */ (*md.interrupt_func)(T_INT, frame); return; case T_MISALGNFLT: - DEBUG_MSG("kernel misaligned " - "access exception @ 0x%08x\n", frame->sxip); + DEBUG_MSG(("kernel misaligned " + "access exception @ 0x%08x\n", frame->sxip)); panictrap(frame->vector, frame); break; @@ -288,8 +274,8 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) /* kernel mode instruction access fault. * Should never, never happen for a non-paged kernel. */ - DEBUG_MSG("kernel mode instruction " - "page fault @ 0x%08x\n", frame->sxip); + DEBUG_MSG(("kernel mode instruction " + "page fault @ 0x%08x\n", frame->sxip)); panictrap(frame->vector, frame); break; @@ -311,7 +297,7 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) fault_code = VM_PROT_READ; } - va = trunc_page((vm_offset_t)fault_addr); + va = trunc_page((vaddr_t)fault_addr); if (va == 0) { panic("trap: bad kernel access at %x", fault_addr); } @@ -324,16 +310,16 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) printf("Kernel Data access fault #%d (%s) v = 0x%x, frame 0x%x cpu %d\n", pbus_type, pbus_exception_type[pbus_type], fault_addr, frame, frame->cpu); -#endif +#endif switch (pbus_type) { case CMMU_PFSR_BERROR: /* * If it is a guarded access, bus error is OK. */ - if ((frame->sxip & ~3) >= + if ((frame->sxip & XIP_ADDR) >= (unsigned)&guarded_access_start && - (frame->sxip & ~3) <= + (frame->sxip & XIP_ADDR) <= (unsigned)&guarded_access_end) { frame->snip = ((unsigned)&guarded_access_bad ) | NIP_V; @@ -356,9 +342,9 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) break; case CMMU_PFSR_SUCCESS: /* - * The fault was resolved. Call data_access_emulation - * to drain the data unit pipe line and reset dmt0 - * so that trap won't get called again. + * The fault was resolved. Call data_access_emulation + * to drain the data unit pipe line and reset dmt0 + * so that trap won't get called again. */ data_access_emulation((unsigned *)frame); frame->dpfsr = 0; @@ -366,7 +352,7 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) return; case CMMU_PFSR_SFAULT: case CMMU_PFSR_PFAULT: - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == 0) { /* * We could resolve the fault. Call @@ -396,10 +382,10 @@ m88100_trap(unsigned type, struct m88100_saved_state *frame) frame->sfip = ((unsigned)p->p_addr->u_pcb.pcb_onfault + 4) | FIP_V; frame->sxip = 0; - /* We sort of resolved the fault ourselves because + /* We sort of resolved the fault ourselves because * we know where it came from [copyxxx()] - * But we must still think about the other possible - * transactions in dmt1 & dmt2. Mark dmt0 so that + * But we must still think about the other possible + * transactions in dmt1 & dmt2. Mark dmt0 so that * data_access_emulation skips it. XXX smurph */ frame->dmt0 |= DMT_SKIP; @@ -423,17 +409,17 @@ user_fault: printf("User Data access fault #%d (%s) v = 0x%x, frame 0x%x cpu %d\n", pbus_type, pbus_exception_type[pbus_type], fault_addr, frame, frame->cpu); -#endif +#endif - if (frame->dmt0 & (DMT_WRITE|DMT_LOCKBAR)) { - ftype = VM_PROT_READ|VM_PROT_WRITE; + if (frame->dmt0 & (DMT_WRITE | DMT_LOCKBAR)) { + ftype = VM_PROT_READ | VM_PROT_WRITE; fault_code = VM_PROT_WRITE; } else { ftype = VM_PROT_READ; fault_code = VM_PROT_READ; } - va = trunc_page((vm_offset_t)fault_addr); + va = trunc_page((vaddr_t)fault_addr); vm = p->p_vmspace; map = &vm->vm_map; @@ -447,7 +433,7 @@ user_fault: result = EACCES; break; default: - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); break; } @@ -550,7 +536,7 @@ user_fault: p->p_md.md_ss_addr, p->p_md.md_ss_instr); /* XXX */ #endif /* check and see if we got here by accident */ - if ((p->p_md.md_ss_addr != pc && + if ((p->p_md.md_ss_addr != pc && p->p_md.md_ss_taken_addr != pc) || instr != SSBREAKPOINT) { sig = SIGTRAP; @@ -562,9 +548,9 @@ user_fault: va = p->p_md.md_ss_addr; if (va != 0) { iov.iov_base = (caddr_t)&instr; - iov.iov_len = sizeof(int); + iov.iov_len = sizeof(int); uio.uio_iov = &iov; - uio.uio_iovcnt = 1; + uio.uio_iovcnt = 1; uio.uio_offset = (off_t)va; uio.uio_resid = sizeof(int); uio.uio_segflg = UIO_SYSSPACE; @@ -578,9 +564,9 @@ user_fault: va = p->p_md.md_ss_taken_addr; if (instr != 0) { iov.iov_base = (caddr_t)&instr; - iov.iov_len = sizeof(int); + iov.iov_len = sizeof(int); uio.uio_iov = &iov; - uio.uio_iovcnt = 1; + uio.uio_iovcnt = 1; uio.uio_offset = (off_t)va; uio.uio_resid = sizeof(int); uio.uio_segflg = UIO_SYSSPACE; @@ -633,7 +619,7 @@ user_fault: if (sig) { sv.sival_int = fault_addr; trapsignal(p, sig, fault_code, fault_type, sv); - /* + /* * don't want multiple faults - we are going to * deliver signal. */ @@ -652,7 +638,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) struct proc *p; u_quad_t sticks = 0; struct vm_map *map; - vm_offset_t va; + vaddr_t va; vm_prot_t ftype; int fault_type; u_long fault_code; @@ -670,7 +656,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) extern struct vm_map *kernel_map; extern unsigned guarded_access_start; extern unsigned guarded_access_end; - extern pt_entry_t *pmap_pte(pmap_t, vm_offset_t); + extern pt_entry_t *pmap_pte(pmap_t, vaddr_t); uvmexp.traps++; if ((p = curproc) == NULL) @@ -696,21 +682,26 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) switch (type) { default: panictrap(frame->vector, frame); + break; /*NOTREACHED*/ + case T_197_READ+T_USER: case T_197_READ: - DEBUG_MSG("DMMU read miss: Hardware Table Searches should be enabled!\n"); + DEBUG_MSG(("DMMU read miss: Hardware Table Searches should be enabled!\n")); panictrap(frame->vector, frame); + break; /*NOTREACHED*/ case T_197_WRITE+T_USER: case T_197_WRITE: - DEBUG_MSG("DMMU write miss: Hardware Table Searches should be enabled!\n"); + DEBUG_MSG(("DMMU write miss: Hardware Table Searches should be enabled!\n")); panictrap(frame->vector, frame); + break; /*NOTREACHED*/ case T_197_INST+T_USER: case T_197_INST: - DEBUG_MSG("IMMU miss: Hardware Table Searches should be enabled!\n"); + DEBUG_MSG(("IMMU miss: Hardware Table Searches should be enabled!\n")); panictrap(frame->vector, frame); + break; /*NOTREACHED*/ #ifdef DDB case T_KDB_TRACE: @@ -751,12 +742,12 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) #endif /* 0 */ #endif /* DDB */ case T_ILLFLT: - DEBUG_MSG("Unimplemented opcode!\n"); + DEBUG_MSG(("Unimplemented opcode!\n")); panictrap(frame->vector, frame); break; case T_NON_MASK: case T_NON_MASK+T_USER: - /* This function pointer is set in machdep.c + /* This function pointer is set in machdep.c It calls m197_ext_int - smurph */ (*md.interrupt_func)(T_NON_MASK, frame); return; @@ -765,18 +756,20 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) (*md.interrupt_func)(T_INT, frame); return; case T_MISALGNFLT: - DEBUG_MSG("kernel mode misaligned " - "access exception @ 0x%08x\n", frame->exip); + DEBUG_MSG(("kernel mode misaligned " + "access exception @ 0x%08x\n", frame->exip)); panictrap(frame->vector, frame); + break; /*NOTREACHED*/ case T_INSTFLT: /* kernel mode instruction access fault. * Should never, never happen for a non-paged kernel. */ - DEBUG_MSG("kernel mode instruction " - "page fault @ 0x%08x\n", frame->exip); + DEBUG_MSG(("kernel mode instruction " + "page fault @ 0x%08x\n", frame->exip)); panictrap(frame->vector, frame); + break; /*NOTREACHED*/ case T_DATAFLT: @@ -797,7 +790,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) fault_code = VM_PROT_WRITE; } - va = trunc_page((vm_offset_t)fault_addr); + va = trunc_page((vaddr_t)fault_addr); if (va == 0) { panic("trap: bad kernel access at %x", fault_addr); } @@ -809,9 +802,9 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) /* * If it is a guarded access, bus error is OK. */ - if ((frame->exip & ~3) >= + if ((frame->exip & XIP_ADDR) >= (unsigned)&guarded_access_start && - (frame->exip & ~3) <= + (frame->exip & XIP_ADDR) <= (unsigned)&guarded_access_end) { return; } @@ -821,19 +814,19 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) * On a segment or a page fault, call uvm_fault() to * resolve the fault. */ - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == 0) return; } if (frame->dsr & CMMU_DSR_WE) { /* write fault */ /* - * This could be a write protection fault or an + * This could be a write protection fault or an * exception to set the used and modified bits - * in the pte. Basically, if we got a write error, - * then we already have a pte entry that faulted + * in the pte. Basically, if we got a write error, + * then we already have a pte entry that faulted * in from a previous seg fault or page fault. - * Get the pte and check the status of the - * modified and valid bits to determine if this + * Get the pte and check the status of the + * modified and valid bits to determine if this * indeed a real write fault. XXX smurph */ pte = pmap_pte(map->pmap, va); @@ -850,7 +843,7 @@ m88110_trap(unsigned type, struct m88100_saved_state *frame) printf("Kernel Write protect???? pte %x\n", *pte); #endif - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); if (result == 0) return; #endif @@ -885,7 +878,7 @@ m88110_user_fault: } } - va = trunc_page((vm_offset_t)fault_addr); + va = trunc_page((vaddr_t)fault_addr); vm = p->p_vmspace; map = &vm->vm_map; @@ -902,7 +895,7 @@ m88110_user_fault: } else if (frame->dsr & (CMMU_DSR_SI | CMMU_DSR_PI)) { /* segment or page fault */ - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); #ifdef DEBUG if (result != 0) printf("Data Access Error @ 0x%x\n", va); @@ -914,14 +907,14 @@ m88110_user_fault: } else if (frame->dsr & CMMU_DSR_WE) { /* write fault */ - /* This could be a write protection fault or an + /* This could be a write protection fault or an * exception to set the used and modified bits * in the pte. Basically, if we got a write * error, then we already have a pte entry that * faulted in from a previous seg fault or page * fault. - * Get the pte and check the status of the - * modified and valid bits to determine if this + * Get the pte and check the status of the + * modified and valid bits to determine if this * indeed a real write fault. XXX smurph */ pte = pmap_pte(vm_map_pmap(map), va); @@ -945,20 +938,20 @@ m88110_user_fault: printf("Write protect???? pte %x\n", *pte); #endif - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); } } else { #ifdef DEBUG printf("unexpected data fault dsr %x\n", frame->dsr); #endif - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); } } else { /* instruction faults */ if (frame->isr & (CMMU_ISR_SI | CMMU_ISR_PI)) { /* segment or page fault */ - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); } else if (frame->isr & (CMMU_ISR_BE | CMMU_ISR_SP | CMMU_ISR_TBE)) { @@ -969,7 +962,7 @@ m88110_user_fault: printf("unexpected instr fault dsr %x\n", frame->isr); #endif - result = uvm_fault(map, va, 0, ftype); + result = uvm_fault(map, va, VM_FAULT_INVALID, ftype); } } @@ -1057,15 +1050,15 @@ m88110_user_fault: fault_type = TRAP_TRACE; break; } -#endif +#endif /* restore original instruction and clear BP */ /*sig = suiword((caddr_t)pc, p->p_md.md_ss_instr);*/ instr = p->p_md.md_ss_instr; if (instr != 0) { iov.iov_base = (caddr_t)&instr; - iov.iov_len = sizeof(int); + iov.iov_len = sizeof(int); uio.uio_iov = &iov; - uio.uio_iovcnt = 1; + uio.uio_iovcnt = 1; uio.uio_offset = (off_t)pc; uio.uio_resid = sizeof(int); uio.uio_segflg = UIO_SYSSPACE; @@ -1107,7 +1100,7 @@ m88110_user_fault: if (sig) { sv.sival_int = fault_addr; trapsignal(p, sig, fault_code, fault_type, sv); - /* + /* * don't want multiple faults - we are going to * deliver signal. */ @@ -1119,34 +1112,31 @@ m88110_user_fault: #endif /* MVME197 */ -void +__dead void error_fatal(struct m88100_saved_state *frame) { +#ifdef DDB switch (frame->vector) { case 0: - DEBUG_MSG("\n[RESET EXCEPTION (Really Bad News[tm]) frame 0x%08x]\n", frame); - DEBUG_MSG("This is usually caused by a branch to a NULL function pointer.\n"); - DEBUG_MSG("e.g. jump to address 0. Use the debugger trace command to track it down.\n"); + db_printf("\n[RESET EXCEPTION (Really Bad News[tm]) frame 0x%08x]\n", frame); + db_printf("This is usually caused by a branch to a NULL function pointer.\n"); + db_printf("e.g. jump to address 0. Use the debugger trace command to track it down.\n"); break; default: - DEBUG_MSG("\n[ERROR EXCEPTION (Bad News[tm]) frame 0x%08x]\n", frame); - DEBUG_MSG("This is usually an exception within an exception. The trap\n"); - DEBUG_MSG("frame shadow registers you are about to see are invalid.\n"); - DEBUG_MSG("(read totaly useless) But R1 to R31 might be interesting.\n"); + db_printf("\n[ERROR EXCEPTION (Bad News[tm]) frame 0x%08x]\n", frame); + db_printf("This is usually an exception within an exception. The trap\n"); + db_printf("frame shadow registers you are about to see are invalid.\n"); + db_printf("(read totaly useless) But R1 to R31 might be interesting.\n"); break; } regdump((struct trapframe*)frame); #ifdef M88100 - DEBUG_MSG("trap trace %d -> %d -> %d -> %d ", last_trap[0], last_trap[1], last_trap[2], last_trap[3]); - DEBUG_MSG("last exception vector = %d\n", last_vector); -#endif -#if DDB - Debugger(); - DEBUG_MSG("You really can't restart after exception %d!\n", frame->vector); + db_printf("trap trace %d -> %d -> %d -> %d ", last_trap[0], last_trap[1], last_trap[2], last_trap[3]); + db_printf("last exception vector = %d\n", last_vector); +#endif Debugger(); #endif /* DDB */ - bugreturn(); /* This gets us to Bug instead of a loop forever */ - + panic("unrecoverable exception %d", frame->vector); } #ifdef M88100 @@ -1248,7 +1238,7 @@ m88100_syscall(register_t code, struct m88100_saved_state *tf) * jmp r1 <- sfip * err: or.u r3, r0, hi16(errno) * st r2, r3, lo16(errno) - * subu r2, r0, 1 + * subu r2, r0, 1 * jmp r1 * * So, when we take syscall trap, sxip/snip/sfip will be as @@ -1424,7 +1414,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) * jmp r1 * err: or.u r3, r0, hi16(errno) * st r2, r3, lo16(errno) - * subu r2, r0, 1 + * subu r2, r0, 1 * jmp r1 * * So, when we take syscall trap, exip/enip will be as @@ -1432,7 +1422,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) * Given this, * 1. If the system call returned 0, need to jmp r1. * exip += 8 - * 2. If the system call returned an errno > 0, increment + * 2. If the system call returned an errno > 0, increment * exip += 4 and plug the value in r2. This will have us * executing "br err" on return to user space. * 3. If the system call code returned ERESTART, @@ -1456,7 +1446,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) tf->r[3] = rval[1]; tf->epsr &= ~PSR_C; tf->exip += 4 + 4; - tf->exip &= ~3; + tf->exip &= XIP_ADDR; break; case ERESTART: /* @@ -1469,7 +1459,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) case EJUSTRETURN: tf->epsr &= ~PSR_C; tf->exip += 4; - tf->exip &= ~3; + tf->exip &= XIP_ADDR; break; default: if (p->p_emul->e_errno) @@ -1477,7 +1467,7 @@ m88110_syscall(register_t code, struct m88100_saved_state *tf) tf->r[2] = error; tf->epsr |= PSR_C; /* fail */ tf->exip += 4; - tf->exip &= ~3; + tf->exip &= XIP_ADDR; break; } @@ -1508,11 +1498,11 @@ child_return(arg) tf->r[3] = 0; tf->epsr &= ~PSR_C; if (cputyp != CPU_88110) { - tf->snip = tf->sfip & ~3; + tf->snip = tf->sfip & XIP_ADDR; tf->sfip = tf->snip + 4; } else { tf->exip += 4 + 4; - tf->exip &= ~3; + tf->exip &= XIP_ADDR; } userret(p, tf, p->p_sticks); @@ -1526,7 +1516,7 @@ child_return(arg) * User Single Step Debugging Support * \************************************/ -unsigned +unsigned ss_get_value(struct proc *p, unsigned addr, int size) { struct uio uio; @@ -1534,9 +1524,9 @@ ss_get_value(struct proc *p, unsigned addr, int size) unsigned value; iov.iov_base = (caddr_t)&value; - iov.iov_len = size; + iov.iov_len = size; uio.uio_iov = &iov; - uio.uio_iovcnt = 1; + uio.uio_iovcnt = 1; uio.uio_offset = (off_t)addr; uio.uio_resid = size; uio.uio_segflg = UIO_SYSSPACE; @@ -1546,7 +1536,7 @@ ss_get_value(struct proc *p, unsigned addr, int size) return value; } -int +int ss_put_value(struct proc *p, unsigned addr, unsigned value, int size) { struct uio uio; @@ -1554,9 +1544,9 @@ ss_put_value(struct proc *p, unsigned addr, unsigned value, int size) int i; iov.iov_base = (caddr_t)&value; - iov.iov_len = size; + iov.iov_len = size; uio.uio_iov = &iov; - uio.uio_iovcnt = 1; + uio.uio_iovcnt = 1; uio.uio_offset = (off_t)addr; uio.uio_resid = size; uio.uio_segflg = UIO_SYSSPACE; @@ -1712,9 +1702,9 @@ register struct proc *p; brpc = ss_branch_taken(curinstr, pc, ss_getreg_val, sstf); if (brpc != pc) { /* self-branches are hopeless */ #if 0 - printf("SS %s (%d): next taken breakpoint set at %x\n", + printf("SS %s (%d): next taken breakpoint set at %x\n", p->p_comm, p->p_pid, brpc); -#endif +#endif p->p_md.md_ss_taken_addr = brpc; p->p_md.md_ss_taken_instr = ss_get_value(p, brpc, sizeof(int)); /* Store breakpoint instruction at the "next" location now. */ @@ -1724,15 +1714,15 @@ register struct proc *p; } pc = ss_next_instr_address(p, pc, 0); #if 0 - printf("SS %s (%d): next breakpoint set at %x\n", + printf("SS %s (%d): next breakpoint set at %x\n", p->p_comm, p->p_pid, pc); -#endif +#endif } else { pc = PC_REGS(sstf) + 4; #if 0 - printf("SS %s (%d): next breakpoint set at %x\n", + printf("SS %s (%d): next breakpoint set at %x\n", p->p_comm, p->p_pid, pc); -#endif +#endif } if (p->p_md.md_ss_addr) { diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 72c459f3df7..c2f43d03798 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,9 +1,9 @@ -/* $OpenBSD: vm_machdep.c,v 1.53 2003/08/08 13:47:36 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.54 2003/10/05 20:27:47 miod Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1993 Adam Glass * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. * All rights reserved. @@ -66,12 +66,12 @@ extern struct extent *iomap_extent; extern struct vm_map *iomap_map; -vm_offset_t iomap_mapin(vm_offset_t, vm_size_t, boolean_t); -void iomap_mapout(vm_offset_t, vm_size_t); +vaddr_t iomap_mapin(paddr_t, psize_t, boolean_t); +void iomap_mapout(vaddr_t, vsize_t); void *mapiodev(void *, int); void unmapiodev(void *, int); -vm_offset_t mapiospace(caddr_t, int); -void unmapiospace(vm_offset_t); +vaddr_t mapiospace(caddr_t, int); +void unmapiospace(vaddr_t); int badpaddr(caddr_t, int); /* @@ -99,7 +99,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) } *ksfp; extern struct pcb *curpcb; extern void proc_trampoline(void); - extern void save_u_area(struct proc *, vm_offset_t); + extern void save_u_area(struct proc *, vaddr_t); /* Copy pcb from p1 to p2. */ if (p1 == curproc) { @@ -110,13 +110,13 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) else if (p1 != &proc0) panic("cpu_fork: curproc"); #endif - + bcopy(&p1->p_addr->u_pcb, &p2->p_addr->u_pcb, sizeof(struct pcb)); p2->p_addr->u_pcb.kernel_state.pcb_ipl = IPL_NONE; /* XXX */ p2->p_md.md_tf = USER_REGS(p2); /*XXX these may not be necessary nivas */ - save_u_area(p2, (vm_offset_t)p2->p_addr); + save_u_area(p2, (vaddr_t)p2->p_addr); /* * Create a switch frame for proc 2 @@ -221,9 +221,9 @@ cpu_coredump(p, vp, cred, chdr) void cpu_swapin(struct proc *p) { - extern void save_u_area(struct proc *, vm_offset_t); + extern void save_u_area(struct proc *, vaddr_t); - save_u_area(p, (vm_offset_t)p->p_addr); + save_u_area(p, (vaddr_t)p->p_addr); } /* @@ -251,11 +251,11 @@ cpu_swapin(struct proc *p) void vmapbuf(bp, len) struct buf *bp; - vm_size_t len; + vsize_t len; { - register caddr_t addr; - register vm_offset_t kva, off; - vm_offset_t pa; + caddr_t addr; + vaddr_t kva, off; + paddr_t pa; struct pmap *pmap; #ifdef DIAGNOSTIC @@ -264,7 +264,7 @@ vmapbuf(bp, len) #endif addr = (caddr_t)trunc_page((vaddr_t)(bp->b_saveaddr = bp->b_data)); - off = (vm_offset_t)bp->b_saveaddr & PGOFSET; + off = (vaddr_t)bp->b_saveaddr & PGOFSET; len = round_page(off + len); pmap = vm_map_pmap(&bp->b_proc->p_vmspace->vm_map); @@ -276,7 +276,7 @@ vmapbuf(bp, len) */ kva = uvm_km_valloc_wait(phys_map, len); - + /* * Flush the TLB for the range [kva, kva + off]. Strictly speaking, * we should do this in vunmapbuf(), but we do it lazily here, when @@ -287,7 +287,7 @@ vmapbuf(bp, len) bp->b_data = (caddr_t)(kva + off); while (len > 0) { - if (pmap_extract(pmap, (vm_offset_t)addr, &pa) == FALSE) + if (pmap_extract(pmap, (vaddr_t)addr, &pa) == FALSE) panic("vmapbuf: null page frame"); pmap_enter(vm_map_pmap(phys_map), kva, pa, VM_PROT_READ | VM_PROT_WRITE, @@ -306,9 +306,9 @@ vmapbuf(bp, len) void vunmapbuf(bp, len) struct buf *bp; - vm_size_t len; + vsize_t len; { - register vm_offset_t addr, off; + vaddr_t addr, off; #ifdef DIAGNOSTIC if ((bp->b_flags & B_PHYS) == 0) @@ -316,7 +316,7 @@ vunmapbuf(bp, len) #endif addr = trunc_page((vaddr_t)bp->b_data); - off = (vm_offset_t)bp->b_data & PGOFSET; + off = (vaddr_t)bp->b_data & PGOFSET; len = round_page(off + len); uvm_km_free_wakeup(phys_map, addr, len); bp->b_data = bp->b_saveaddr; @@ -332,15 +332,16 @@ vunmapbuf(bp, len) * of pa. However, it is advisable to have pa page aligned since otherwise, * we might have several mappings for a given chunk of the IO page. */ -vm_offset_t -iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) +vaddr_t +iomap_mapin(paddr_t pa, psize_t len, boolean_t canwait) { - vm_offset_t iova, tva, off, ppa; - int s, error; + vaddr_t iova, tva, off; + paddr_t ppa; + int s, error; if (len == 0) return NULL; - + ppa = pa; off = (u_long)ppa & PGOFSET; @@ -353,7 +354,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) if (error != 0) return NULL; - + cmmu_flush_tlb(1, iova, len); ppa = trunc_page(ppa); @@ -362,7 +363,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) tva = iova; #else tva = ppa; -#endif +#endif while (len>0) { pmap_enter(vm_map_pmap(iomap_map), tva, ppa, @@ -377,7 +378,7 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) return (iova + off); #else return (pa + off); -#endif +#endif } @@ -385,9 +386,9 @@ iomap_mapin(vm_offset_t pa, vm_size_t len, boolean_t canwait) * Free up the mapping in iomap. */ void -iomap_mapout(vm_offset_t kva, vm_size_t len) +iomap_mapout(vaddr_t kva, vsize_t len) { - vm_offset_t off; + vaddr_t off; int s, error; off = kva & PGOFSET; @@ -414,8 +415,8 @@ mapiodev(pa, size) void *pa; int size; { - vm_offset_t ppa; - ppa = (vm_offset_t)pa; + paddr_t ppa; + ppa = (paddr_t)pa; return ((void *)iomap_mapin(ppa, size, 0)); } @@ -424,8 +425,8 @@ unmapiodev(kva, size) void *kva; int size; { - vm_offset_t va; - va = (vm_offset_t)kva; + vaddr_t va; + va = (vaddr_t)kva; iomap_mapout(va, size); } @@ -435,18 +436,18 @@ unmapiodev(kva, size) * Should have some sort of lockig for the use of phys_map_vaddr. XXX nivas */ -vm_offset_t +vaddr_t mapiospace(caddr_t pa, int len) { int off = (u_long)pa & PGOFSET; - extern vm_offset_t phys_map_vaddr1; + extern vaddr_t phys_map_vaddr1; pa = (caddr_t)trunc_page((paddr_t)pa); - pmap_kenter_pa(phys_map_vaddr1, (vm_offset_t)pa, + pmap_kenter_pa(phys_map_vaddr1, (paddr_t)pa, VM_PROT_READ|VM_PROT_WRITE); pmap_update(pmap_kernel()); - + return (phys_map_vaddr1 + off); } @@ -455,7 +456,7 @@ mapiospace(caddr_t pa, int len) */ void -unmapiospace(vm_offset_t va) +unmapiospace(vaddr_t va) { va = trunc_page(va); @@ -464,7 +465,7 @@ unmapiospace(vm_offset_t va) } int -badvaddr(vm_offset_t va, int size) +badvaddr(vaddr_t va, int size) { register int x; if (badaddr(va, size)) { @@ -490,7 +491,7 @@ badvaddr(vm_offset_t va, int size) int badpaddr(caddr_t pa, int size) { - vm_offset_t va; + vaddr_t va; int val; /* @@ -540,9 +541,9 @@ pagemove(from, to, size) u_int kvtop(va) - vm_offset_t va; + vaddr_t va; { - vm_offset_t pa; + paddr_t pa; pmap_extract(pmap_kernel(), va, &pa); return ((u_int)pa); |