SCCS-vsn: sys/tahoe/vba/ik.c 1.6
SCCS-vsn: sys/tahoe/vba/mp.c 1.6
SCCS-vsn: sys/tahoe/vba/mpreg.h 1.3
SCCS-vsn: sys/tahoe/vba/vba.c 1.13
+/*
+ * @(#)ik.c 1.6 (Berkeley) %G%
+ */
#include "ik.h"
#if NIK > 0
#include "ik.h"
#if NIK > 0
}
splx(s);
bp->b_flags = B_BUSY | B_WRITE;
}
splx(s);
bp->b_flags = B_BUSY | B_WRITE;
- error = copyin(lp->pl_name, sc->is_buf, (unsigned)lp->pl_len);
+ error = copyin(lp->pl_name, (caddr_t)sc->is_buf,
+ (unsigned)lp->pl_len);
if (error == 0) {
if (lp->pl_len&1)
sc->is_buf[lp->pl_len] = '\0';
if (error == 0) {
if (lp->pl_len&1)
sc->is_buf[lp->pl_len] = '\0';
+/*
+ * Copyright (c) 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ *
+ * @(#)mp.c 1.6 (Berkeley) %G%
+ */
#include "mp.h"
#if NMP > 0
#include "mp.h"
#if NMP > 0
* Multi Protocol Communications Controller (MPCC).
* Asynchronous Terminal Protocol Support.
*/
* Multi Protocol Communications Controller (MPCC).
* Asynchronous Terminal Protocol Support.
*/
-#include "../machine/pte.h"
-#include "../machine/mtpr.h"
-
#include "param.h"
#include "ioctl.h"
#include "tty.h"
#include "param.h"
#include "ioctl.h"
#include "tty.h"
#include "kernel.h"
#include "clist.h"
#include "kernel.h"
#include "clist.h"
+#include "../machine/pte.h"
+#include "../machine/mtpr.h"
+
#include "../tahoevba/vbavar.h"
#include "../tahoevba/mpreg.h"
#include "../tahoevba/vbavar.h"
#include "../tahoevba/mpreg.h"
#ifdef lint
br = 0; cvec = br; br = cvec;
mpintr(0);
#ifdef lint
br = 0; cvec = br; br = cvec;
mpintr(0);
#endif
if (badaddr(reg, 2))
return (0);
#endif
if (badaddr(reg, 2))
return (0);
/*
* Open an mpcc port.
*/
/*
* Open an mpcc port.
*/
mpopen(dev, mode)
dev_t dev;
{
mpopen(dev, mode)
dev_t dev;
{
/*
* Close an mpcc port.
*/
/*
* Close an mpcc port.
*/
+/* ARGSUSED */
+mpclose(dev, flag)
dev_t dev;
{
register struct tty *tp;
dev_t dev;
{
register struct tty *tp;
- hxp->dblock[i] = (caddr_t)vtoph(0, (int)outq.c_cf);
+ hxp->dblock[i] = (caddr_t)kvtophys(outq.c_cf);
hxp->size[i] = n;
xcnt++; /* count of xmts to send */
ndadvance(&outq, n);
hxp->size[i] = n;
xcnt++; /* count of xmts to send */
ndadvance(&outq, n);
/*
* Stop output on a line, e.g. for ^S/^Q or output flush.
*/
/*
* Stop output on a line, e.g. for ^S/^Q or output flush.
*/
mpstop(tp, rw)
register struct tty *tp;
int rw;
{
mpstop(tp, rw)
register struct tty *tp;
int rw;
{
- int s, port;
- struct mpevent *ev;
- struct mblok *mb;
s = spl8();
/* XXX: DISABLE TRANSMITTER */
s = spl8();
/* XXX: DISABLE TRANSMITTER */
ev->ev_error = 0;
ev->ev_flags = 0;
ev->ev_count = 0;
ev->ev_error = 0;
ev->ev_flags = 0;
ev->ev_count = 0;
- ev->ev_un.hxl = (struct hxmtl *) vtoph(0, &ms->ms_hxl[port]);
- ev->ev_params = (caddr_t) vtoph(0, &ms->ms_async[port][i]);
+ ev->ev_un.hxl = (struct hxmtl *) kvtophys(&ms->ms_hxl[port]);
+ ev->ev_params = (caddr_t) kvtophys(&ms->ms_async[port][i]);
}
ev = &mp->mp_sendq[0];
for (i = 0; ev < &mp->mp_sendq[MPOUTSET]; ev++, i++) {
}
ev = &mp->mp_sendq[0];
for (i = 0; ev < &mp->mp_sendq[MPOUTSET]; ev++, i++) {
ev->ev_flags = 0;
ev->ev_count = 0;
ptr = (caddr_t) &ms->ms_cbuf[port][i][0];
ev->ev_flags = 0;
ev->ev_count = 0;
ptr = (caddr_t) &ms->ms_cbuf[port][i][0];
- ev->ev_un.rcvblk = (u_char *)vtoph(0, ptr);
- ev->ev_params = (caddr_t) vtoph(0, ptr);
+ ev->ev_un.rcvblk = (u_char *)kvtophys(ptr);
+ ev->ev_params = (caddr_t) kvtophys(ptr);
* If not a close request, verify one extra
* event is available for closing the port.
*/
* If not a close request, verify one extra
* event is available for closing the port.
*/
- if ((mp->mp_flags && MP_PROGRESS) == 0) {
+ if ((mp->mp_flags & MP_PROGRESS) == 0) {
if ((i = mp->mp_on + 1) >= MPINSET)
i = 0;
if (mp->mp_recvq[i].ev_status != EVSTATUS_FREE)
if ((i = mp->mp_on + 1) >= MPINSET)
i = 0;
if (mp->mp_recvq[i].ev_status != EVSTATUS_FREE)
mp = &mb->mb_port[port];
if (mp->mp_proto == MPPROTO_ASYNC) {
mp->mp_flags = MP_REMBSY;
mp = &mb->mb_port[port];
if (mp->mp_proto == MPPROTO_ASYNC) {
mp->mp_flags = MP_REMBSY;
- /* flush I/O queues and send hangup signals */
+ /* signal loss of carrier and close */
tp = &mp_tty[mb->mb_unit*MPCHUNK+port];
tp = &mp_tty[mb->mb_unit*MPCHUNK+port];
- tp->t_state &= ~TS_CARR_ON;
ttyflush(tp, FREAD|FWRITE);
ttyflush(tp, FREAD|FWRITE);
- gsignal(tp->t_pgrp, SIGHUP);
- gsignal(tp->t_pgrp, SIGKILL);
- mpclose(tp->t_dev, 0);
+ (void) (*linesw[tp->t_line].l_modem)(tp, 0);
+ (void) mpclose(tp->t_dev, 0);
register struct mpport *mp;
register struct mpevent *ev;
register int i;
register struct mpport *mp;
register struct mpevent *ev;
register int i;
int unit;
mp = &mb->mb_port[port];
int unit;
mp = &mb->mb_port[port];
{
register struct mblok *mb;
register struct his *his;
{
register struct mblok *mb;
register struct his *his;
mb = mp_softc[mpcc].ms_mb;
if (mb == 0) {
mb = mp_softc[mpcc].ms_mb;
if (mb == 0) {
* Handler for processing completion of transmitted events.
*/
mpxintr(unit, list)
* Handler for processing completion of transmitted events.
*/
mpxintr(unit, list)
{
register struct mpport *mp;
register struct mpevent *ev;
{
register struct mpport *mp;
register struct mpevent *ev;
for(; ev->ev_status & EVSTATUS_DONE; ev = nextevent(mp)) {
/* YUCK */
ap = &ms->ms_async[port][mp->mp_off];
for(; ev->ev_status & EVSTATUS_DONE; ev = nextevent(mp)) {
/* YUCK */
ap = &ms->ms_async[port][mp->mp_off];
- mppurge(ap, sizeof (*ap));
+ mppurge((caddr_t)ap, (int)sizeof (*ap));
switch (ev->ev_cmd) {
case EVCMD_OPEN:
/*
switch (ev->ev_cmd) {
case EVCMD_OPEN:
/*
tp->t_state &= ~TS_FLUSH;
wakeup((caddr_t)&tp->t_state);
} else {
tp->t_state &= ~TS_FLUSH;
wakeup((caddr_t)&tp->t_state);
} else {
- register int cc = 0, i;
+ register int cc = 0, n;
struct hxmtl *hxp;
hxp = &ms->ms_hxl[port];
struct hxmtl *hxp;
hxp = &ms->ms_hxl[port];
- for(i = 0; i < ev->ev_count; i++)
- cc += hxp->size[i];
+ for(n = 0; n < ev->ev_count; n++)
+ cc += hxp->size[n];
ndflush(&tp->t_outq, cc);
}
switch (ev->ev_error) {
ndflush(&tp->t_outq, cc);
}
switch (ev->ev_error) {
mpstart(tp);
break;
default:
mpstart(tp);
break;
default:
- mplog(unit, port, A_INVCMD, ev->ev_cmd);
+ mplog(unit, port, A_INVCMD, (int)ev->ev_cmd);
break;
}
/* re-init all values in this entry */
break;
}
/* re-init all values in this entry */
* Handler for processing received events.
*/
mprintr(unit, list)
* Handler for processing received events.
*/
mprintr(unit, list)
{
register struct tty *tp;
register struct mpport *mp;
{
register struct tty *tp;
register struct mpport *mp;
if (ev->ev_cmd != EVCMD_READ &&
ev->ev_cmd != EVCMD_STATUS) {
mplog(unit, port, "unexpected command",
if (ev->ev_cmd != EVCMD_READ &&
ev->ev_cmd != EVCMD_STATUS) {
mplog(unit, port, "unexpected command",
goto next;
}
if (ev->ev_cmd == EVCMD_STATUS) {
goto next;
}
if (ev->ev_cmd == EVCMD_STATUS) {
else
mplog(unit, port,
"unexpect status command",
else
mplog(unit, port,
"unexpect status command",
}
/* setup for next read */
ptr = (caddr_t)&mp_softc[unit].ms_cbuf[port][mp->mp_nextrcv][0];
}
/* setup for next read */
ptr = (caddr_t)&mp_softc[unit].ms_cbuf[port][mp->mp_nextrcv][0];
- ev->ev_un.rcvblk = (u_char *)vtoph(0, ptr);
- ev->ev_params = (caddr_t) vtoph(0, ptr);
+ ev->ev_un.rcvblk = (u_char *)kvtophys(ptr);
+ ev->ev_params = (caddr_t) kvtophys(ptr);
switch(ev->ev_error) {
case RCVDTA: /* Normal (good) rcv data */
/* do not report the following */
switch(ev->ev_error) {
case RCVDTA: /* Normal (good) rcv data */
/* do not report the following */
rcverr = "undefined rcv error";
}
if (rcverr != (char *)0)
rcverr = "undefined rcv error";
}
if (rcverr != (char *)0)
- mplog(unit, port, rcverr, ev->ev_error);
+ mplog(unit, port, rcverr, (int)ev->ev_error);
next:
ev->ev_cmd = 0;
ev->ev_opts = 0;
next:
ev->ev_cmd = 0;
ev->ev_opts = 0;
*/
mpintmpcc(mb, port)
register struct mblok *mb;
*/
mpintmpcc(mb, port)
register struct mblok *mb;
{
mb->mb_intr[port] |= MPSEMA_WORK;
{
mb->mb_intr[port] |= MPSEMA_WORK;
mb->mb_mpintcnt = 0;
*(u_short *)mpinfo[mb->mb_unit]->ui_addr = 2;
if (mb->mb_mpintclk) {
mb->mb_mpintcnt = 0;
*(u_short *)mpinfo[mb->mb_unit]->ui_addr = 2;
if (mb->mb_mpintclk) {
- untimeout(mptimeint, mb);
+ untimeout(mptimeint, (caddr_t)mb);
mb->mb_mpintclk = 0;
}
} else {
if (mb->mb_mpintclk == 0) {
mb->mb_mpintclk = 0;
}
} else {
if (mb->mb_mpintclk == 0) {
- timeout(mptimeint, mb, 4);
+ timeout(mptimeint, (caddr_t)mb, 4);
mb->mb_mpintclk = (caddr_t)1;
}
}
mb->mb_mpintclk = (caddr_t)1;
}
}
return (EFAULT);
dl = &ms->ms_mb->mb_dl;
dl->mpdl_count = uio->uio_iov->iov_len;
return (EFAULT);
dl = &ms->ms_mb->mb_dl;
dl->mpdl_count = uio->uio_iov->iov_len;
- dl->mpdl_data = (caddr_t) vtoph((struct proc *)0, mpdlbuf);
- if (error = uiomove(mpdlbuf, dl->mpdl_count, UIO_WRITE, uio))
+ dl->mpdl_data = (caddr_t) kvtophys(mpdlbuf);
+ if (error = uiomove(mpdlbuf, (int)dl->mpdl_count, UIO_WRITE, uio))
return (error);
uio->uio_resid -= dl->mpdl_count; /* set up return from write */
dl->mpdl_cmd = MPDLCMD_NORMAL;
return (error);
uio->uio_resid -= dl->mpdl_count; /* set up return from write */
dl->mpdl_cmd = MPDLCMD_NORMAL;
dev_t dev;
{
register struct mblok *mb = mp_softc[MPUNIT(minor(dev))].ms_mb;
dev_t dev;
{
register struct mblok *mb = mp_softc[MPUNIT(minor(dev))].ms_mb;
if (mb == 0 || mb->mb_status != MP_DLDONE) {
mpbogus.status = 0;
if (mb == 0 || mb->mb_status != MP_DLDONE) {
mpbogus.status = 0;
-mpreset(dev)
- dev_t dev;
-{
- /* XXX */
-}
-
mpdlioctl(dev, cmd, data, flag)
dev_t dev;
caddr_t data;
{
register struct mblok *mb;
register struct mpdl *dl;
mpdlioctl(dev, cmd, data, flag)
dev_t dev;
caddr_t data;
{
register struct mblok *mb;
register struct mpdl *dl;
- int unit, error, s, i, j;
mb = mp_softc[unit=MPUNIT(minor(dev))].ms_mb;
if (mb == 0)
mb = mp_softc[unit=MPUNIT(minor(dev))].ms_mb;
if (mb == 0)
break;
case MPIOASYNCNF:
bcopy(data, mpdlbuf, sizeof (struct abdcf));
break;
case MPIOASYNCNF:
bcopy(data, mpdlbuf, sizeof (struct abdcf));
- dl->mpdl_data = (caddr_t) vtoph((struct proc *)0, mpdlbuf);
+ dl->mpdl_data = (caddr_t) kvtophys(mpdlbuf);
dl->mpdl_count = sizeof (struct abdcf);
dl->mpdl_cmd = MPIOASYNCNF&IOCPARM_MASK;
error = mpdlwait(dl);
dl->mpdl_count = sizeof (struct abdcf);
dl->mpdl_cmd = MPIOASYNCNF&IOCPARM_MASK;
error = mpdlwait(dl);
mb->mb_diagswitch[1] = 'P';
s = spl8();
*(u_short *)mpinfo[unit]->ui_addr = 2;
mb->mb_diagswitch[1] = 'P';
s = spl8();
*(u_short *)mpinfo[unit]->ui_addr = 2;
- timeout(mpdltimeout, mb, 30*hz); /* approx 15 seconds */
+ timeout(mpdltimeout, (caddr_t)mb, 30*hz);
sleep((caddr_t)&mb->mb_status, PZERO+1);
splx(s);
if (mb->mb_status == MP_DLOPEN) {
sleep((caddr_t)&mb->mb_status, PZERO+1);
splx(s);
if (mb->mb_status == MP_DLOPEN) {
- untimeout(mpdltimeout, mb);
+ untimeout(mpdltimeout, (caddr_t)mb);
} else if (mb->mb_status == MP_DLTIME) {
mpbogus.status = 0;
error = ETIMEDOUT;
} else if (mb->mb_status == MP_DLTIME) {
mpbogus.status = 0;
error = ETIMEDOUT;
log(LOG_ERR, "mp%d: start download: unknown status %x",
unit, mb->mb_status);
}
log(LOG_ERR, "mp%d: start download: unknown status %x",
unit, mb->mb_status);
}
- bzero(mb->mb_port, sizeof (mb->mb_port));
+ bzero((caddr_t)mb->mb_port, sizeof (mb->mb_port));
break;
case MPIORESETBOARD:
s = spl8();
break;
case MPIORESETBOARD:
s = spl8();
return;
case MP_DLPEND:
mb->mb_status = MP_DLOPEN;
return;
case MP_DLPEND:
mb->mb_status = MP_DLOPEN;
- wakeup(&mb->mb_status);
+ wakeup((caddr_t)&mb->mb_status);
/* fall thru... */
case MP_DLTIME:
return;
/* fall thru... */
case MP_DLTIME:
return;
-/* mpreg.h 7.1 88/05/21 */
+/*
+ * @(#)mpreg.h 1.3 (Berkeley) %G%
+ */
/*
* MPCC Asynchronous Communications Interface.
/*
* MPCC Asynchronous Communications Interface.
u_char brdnum; /* Virtual brd number for protocol */
u_char unused;
struct {
u_char brdnum; /* Virtual brd number for protocol */
u_char unused;
struct {
- char inbdone[MPMAXPORT]; /* Ports w/ inbound completed */
- char outbdone[MPMAXPORT]; /* Ports w/ outbound available */
+ u_char inbdone[MPMAXPORT]; /* Ports w/ inbound completed */
+ u_char outbdone[MPMAXPORT]; /* Ports w/outbound available */
u_int fill[2];
} proto[NMPPROTO];
};
u_int fill[2];
} proto[NMPPROTO];
};
-#define MPPORT_EOL -1 /* end of port list */
+#define MPPORT_EOL 0xff /* end of port list */
/*
* Async host transmit list structure.
/*
* Async host transmit list structure.
- * Copyright (c) 1987 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1987, 1988 Regents of the University of California.
+ * All rights reserved.
- * @(#)vba.c 7.1 (Berkeley) %G%
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of California at Berkeley. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ *
+ * @(#)vba.c 1.13 (Berkeley) %G%
register n;
vb->vb_flags = flags;
register n;
vb->vb_flags = flags;
- if (vbmapalloc(btoc(xsize) + 1, &vb->vb_map, &vb->vb_utl) == 0) {
+ if (vbmapalloc((int)btoc(xsize) + 1, &vb->vb_map, &vb->vb_utl) == 0) {
printf("vbmap exhausted\n");
return (0);
}
n = roundup(xsize, NBPG);
vb->vb_bufsize = n;
if (vb->vb_rawbuf == 0)
printf("vbmap exhausted\n");
return (0);
}
n = roundup(xsize, NBPG);
vb->vb_bufsize = n;
if (vb->vb_rawbuf == 0)
- vb->vb_rawbuf = (caddr_t)malloc(n, M_DEVBUF, M_NOWAIT);
+ vb->vb_rawbuf = (caddr_t)malloc((u_long)n, M_DEVBUF, M_NOWAIT);
if (vb->vb_rawbuf == 0) {
printf("no memory for device buffer\n");
return (0);
}
if ((int)vb->vb_rawbuf & PGOFSET)
panic("vbinit pgoff");
if (vb->vb_rawbuf == 0) {
printf("no memory for device buffer\n");
return (0);
}
if ((int)vb->vb_rawbuf & PGOFSET)
panic("vbinit pgoff");
- vb->vb_physbuf = vtoph((struct proc *)0, vb->vb_rawbuf);
+ vb->vb_physbuf = (u_long)kvtophys(vb->vb_rawbuf);
if (flags & VB_20BIT)
vb->vb_maxphys = btoc(VB_MAXADDR20);
else if (flags & VB_24BIT)
if (flags & VB_20BIT)
vb->vb_maxphys = btoc(VB_MAXADDR20);
else if (flags & VB_24BIT)
{
register struct pte *spte;
register struct addr_chain *adr;
{
register struct pte *spte;
register struct addr_chain *adr;
int o;
o = (int)bp->b_un.b_addr & PGOFSET;
int o;
o = (int)bp->b_un.b_addr & PGOFSET;
- npf = btoc(bp->b_bcount + o);
vb->vb_iskernel = (((int)bp->b_un.b_addr & KERNBASE) == KERNBASE);
vb->vb_copy = 0;
if (vb->vb_iskernel) {
vb->vb_iskernel = (((int)bp->b_un.b_addr & KERNBASE) == KERNBASE);
vb->vb_copy = 0;
if (vb->vb_iskernel) {
i = (i + 1) >> 1;
for (adr = sg->addr_chain; i > 0; adr++, i -= NBPG / 2) {
adr->nxt_addr = (spte++)->pg_pfnum << PGSHIFT;
i = (i + 1) >> 1;
for (adr = sg->addr_chain; i > 0; adr++, i -= NBPG / 2) {
adr->nxt_addr = (spte++)->pg_pfnum << PGSHIFT;
- adr->nxt_len = min(i, NBPG / 2);
+ adr->nxt_len = imin(i, NBPG / 2);
}
adr->nxt_addr = 0;
adr++->nxt_len = 0;
}
adr->nxt_addr = 0;
adr++->nxt_len = 0;