New if_is.c isolan ethernet driver that can handle multiple cards.

This commit is contained in:
Paul Richards 1993-06-18 20:25:32 +00:00
parent 4029d369d7
commit ba98737aba

View File

@ -31,12 +31,16 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* @(#)if_ne.c 7.4 (Berkeley) 5/21/91 * @(#)if_is.c
*/ */
/* /*
* Isolink 4110-2 Ethernet driver * Isolan AT 4141-0 Ethernet driver
*/ * Isolink 4110
*
* By Paul Richards
*
*/
#include "is.h" #include "is.h"
#if NIS > 0 #if NIS > 0
@ -91,62 +95,72 @@ struct mbuf *isget();
* Ethernet software status per interface. * Ethernet software status per interface.
* *
* Each interface is referenced by a network interface structure, * Each interface is referenced by a network interface structure,
* ns_if, which the routing code uses to locate the interface. * is_if, which the routing code uses to locate the interface.
* This structure contains the output queue for the interface, its address, ... * This structure contains the output queue for the interface, its address, ...
*/ */
struct is_softc { struct is_softc {
struct arpcom ns_ac; /* Ethernet common part */ struct arpcom ns_ac; /* Ethernet common part */
#define ns_if ns_ac.ac_if /* network-visible interface */ #define is_if ns_ac.ac_if /* network-visible interface */
#define ns_addr ns_ac.ac_enaddr /* hardware Ethernet address */ #define is_addr ns_ac.ac_enaddr /* hardware Ethernet address */
int iobase; /* IO base address of card */
struct mds *rd;
struct mds *td;
unsigned char *rbuf;
unsigned char *tbuf;
int last_rd; int last_rd;
int last_td; int last_td;
int no_td; int no_td;
} is_softc[NIS] ; } is_softc[NIS] ;
struct init_block init_block; struct init_block init_block[NIS];
struct mds *td, *rd;
unsigned char *rbuf,*tbuf;
int isc; iswrcsr(unit,port,val)
int unit;
iswrcsr(port,val)
u_short port; u_short port;
u_short val; u_short val;
{ {
outw(isc+RAP,port); int iobase;
outw(isc+RDP,val);
iobase = is_softc[unit].iobase;
outw(iobase+RAP,port);
outw(iobase+RDP,val);
} }
u_short isrdcsr(port) u_short isrdcsr(unit,port)
int unit;
u_short port; u_short port;
{ {
outw(isc+RAP,port); int iobase;
return(inw(isc+RDP));
iobase = is_softc[unit].iobase;
outw(iobase+RAP,port);
return(inw(iobase+RDP));
} }
isprobe(dvp) isprobe(isdev)
struct isa_device *dvp; struct isa_device *isdev;
{ {
int val,i,s; int val,i,s;
register struct is_softc *ns = &is_softc[0]; int unit = isdev->id_unit ;
register struct is_softc *is = &is_softc[unit];
isc = dvp->id_iobase; is->iobase = isdev->id_iobase;
s = splimp(); s = splimp();
/* Stop the lance chip, put it known state */ /* Stop the lance chip, put it known state */
iswrcsr(0,STOP); iswrcsr(unit,0,STOP);
DELAY(100); DELAY(100);
/* is there a lance? */ /* is there a lance? */
iswrcsr(3, 0xffff); iswrcsr(unit,3, 0xffff);
if (isrdcsr(3) != 7) { if (isrdcsr(unit,3) != 7) {
isc = 0; is->iobase = 0;
return (0); return (0);
} }
iswrcsr(3, 0); iswrcsr(unit,3, 0);
/* Extract board address */ /* Extract board address */
for(i=0; i < 6; i++) ns->ns_addr[i] = inb(isc+(i*2)); for(i=0; i < 6; i++) is->is_addr[i] = inb(is->iobase+(i*2));
splx(s); splx(s);
return (1); return (1);
@ -171,20 +185,20 @@ isreset(unit, uban)
* record. System will initialize the interface when it is ready * record. System will initialize the interface when it is ready
* to accept packets. We get the ethernet address here. * to accept packets. We get the ethernet address here.
*/ */
isattach(dvp) isattach(isdev)
struct isa_device *dvp; struct isa_device *isdev;
{ {
int unit = dvp->id_unit; int unit = isdev->id_unit;
register struct is_softc *is = &is_softc[unit]; register struct is_softc *is = &is_softc[unit];
register struct ifnet *ifp = &is->ns_if; register struct ifnet *ifp = &is->is_if;
/* Set up DMA */ /* Set up DMA */
isa_dmacascade(dvp->id_drq); isa_dmacascade(isdev->id_drq);
ifp->if_unit = unit; ifp->if_unit = unit;
ifp->if_name = isdriver.name ; ifp->if_name = isdriver.name ;
ifp->if_mtu = ETHERMTU; ifp->if_mtu = ETHERMTU;
printf (" ethernet address %s", ether_sprintf(is->ns_addr)) ; printf (" ethernet address %s", ether_sprintf(is->is_addr)) ;
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS;
ifp->if_init = isinit; ifp->if_init = isinit;
ifp->if_output = ether_output; ifp->if_output = ether_output;
@ -197,61 +211,63 @@ isattach(dvp)
/* Lance initialisation block set up */ /* Lance initialisation block set up */
init_mem() init_mem(unit)
int unit;
{ {
int i; int i;
u_long temp; u_long temp;
struct is_softc *is = &is_softc[unit];
/* Allocate memory */ /* Allocate memory */
/* Temporary hack, will use kmem_alloc in future */ /* Temporary hack, will use kmem_alloc in future */
#define MAXMEM ((NRBUF+NTBUF)*(BUFSIZE) + (NRBUF+NTBUF)*sizeof(struct mds) + 8) #define MAXMEM ((NRBUF+NTBUF)*(BUFSIZE) + (NRBUF+NTBUF)*sizeof(struct mds) + 8)
static u_char lance_mem[MAXMEM]; static u_char lance_mem[NIS][MAXMEM];
/* Align message descriptors on quad word boundary /* Align message descriptors on quad word boundary
(this is essential) */ (this is essential) */
temp = (u_long) &lance_mem; temp = (u_long) &lance_mem[unit];
temp = (temp+8) - (temp%8); temp = (temp+8) - (temp%8);
rd = (struct mds *) temp; is->rd = (struct mds *) temp;
td = (struct mds *) (temp + (NRBUF*sizeof(struct mds))); is->td = (struct mds *) (temp + (NRBUF*sizeof(struct mds)));
temp += (NRBUF+NTBUF) * sizeof(struct mds); temp += (NRBUF+NTBUF) * sizeof(struct mds);
init_block.mode = 0; init_block[unit].mode = 0;
/* Get ethernet address */ /* Get ethernet address */
for (i=0; i<6; i++) for (i=0; i<6; i++)
init_block.padr[i] = inb(isc+(i*2)); init_block[unit].padr[i] = is_softc[unit].is_addr[i];
/* Clear multicast address for now */ /* Clear multicast address for now */
for (i=0; i<8; i++) for (i=0; i<8; i++)
init_block.ladrf[i] = 0; init_block[unit].ladrf[i] = 0;
init_block.rdra = kvtop(rd); init_block[unit].rdra = kvtop(is->rd);
init_block.rlen = ((kvtop(rd) >> 16) & 0xff) | (RLEN<<13); init_block[unit].rlen = ((kvtop(is->rd) >> 16) & 0xff) | (RLEN<<13);
init_block.tdra = kvtop(td); init_block[unit].tdra = kvtop(is->td);
init_block.tlen = ((kvtop(td) >> 16) & 0xff) | (TLEN<<13); init_block[unit].tlen = ((kvtop(is->td) >> 16) & 0xff) | (TLEN<<13);
/* Set up receive ring descriptors */ /* Set up receive ring descriptors */
rbuf = (unsigned char *)temp; is->rbuf = (unsigned char *)temp;
for (i=0; i<NRBUF; i++) { for (i=0; i<NRBUF; i++) {
(rd+i)->addr = kvtop(temp); (is->rd+i)->addr = kvtop(temp);
(rd+i)->flags= ((kvtop(temp) >> 16) & 0xff) | OWN; (is->rd+i)->flags= ((kvtop(temp) >> 16) & 0xff) | OWN;
(rd+i)->bcnt = -BUFSIZE; (is->rd+i)->bcnt = -BUFSIZE;
(rd+i)->mcnt = 0; (is->rd+i)->mcnt = 0;
temp += BUFSIZE; temp += BUFSIZE;
} }
/* Set up transmit ring descriptors */ /* Set up transmit ring descriptors */
tbuf = (unsigned char *)temp; is->tbuf = (unsigned char *)temp;
#ifdef ISDEBUG #if ISDEBUG > 4
printf("rd = %x,td = %x, rbuf = %x, tbuf = %x,td+1=%x\n",rd,td,rbuf,tbuf,td+1); printf("rd = %x,td = %x, rbuf = %x, tbuf = %x,td+1=%x\n",is->rd,is->td,is->rbuf,is->tbuf,is->td+1);
#endif #endif
for (i=0; i<NTBUF; i++) { for (i=0; i<NTBUF; i++) {
(td+i)->addr = kvtop(temp); (is->td+i)->addr = kvtop(temp);
(td+i)->flags= ((kvtop(temp) >> 16) & 0xff); (is->td+i)->flags= ((kvtop(temp) >> 16) & 0xff);
(td+i)->bcnt = 0; (is->td+i)->bcnt = 0;
(td+i)->mcnt = 0; (is->td+i)->mcnt = 0;
temp += BUFSIZE; temp += BUFSIZE;
} }
@ -264,41 +280,41 @@ static u_char lance_mem[MAXMEM];
isinit(unit) isinit(unit)
int unit; int unit;
{ {
register struct is_softc *ns = &is_softc[unit]; register struct is_softc *is = &is_softc[unit];
struct ifnet *ifp = &ns->ns_if; struct ifnet *ifp = &is->is_if;
int s; int s;
register i; register i;
if (ifp->if_addrlist == (struct ifaddr *)0) return; if (ifp->if_addrlist == (struct ifaddr *)0) return;
ns->last_rd = ns->last_td = ns->no_td = 0; is->last_rd = is->last_td = is->no_td = 0;
s = splimp(); s = splimp();
/* Set up lance's memory area */ /* Set up lance's memory area */
init_mem(); init_mem(unit);
/* Stop Lance to get access to other registers */ /* Stop Lance to get access to other registers */
iswrcsr(0,STOP); iswrcsr(unit,0,STOP);
/* I wish I knew what this was */ /* I wish I knew what this was */
iswrcsr(3,0); iswrcsr(unit,3,0);
/* Give lance the physical address of its memory area */ /* Give lance the physical address of its memory area */
iswrcsr(1,kvtop(&init_block)); iswrcsr(unit,1,kvtop(&init_block[unit]));
iswrcsr(2,(kvtop(&init_block) >> 16) & 0xff); iswrcsr(unit,2,(kvtop(&init_block[unit]) >> 16) & 0xff);
/* OK, let's try and initialise the Lance */ /* OK, let's try and initialise the Lance */
iswrcsr(0,INIT); iswrcsr(unit,0,INIT);
/* Wait for initialisation to finish */ /* Wait for initialisation to finish */
for(i=0; i<1000; i++){ for(i=0; i<1000; i++){
if (isrdcsr(0)&IDON) if (isrdcsr(unit,0)&IDON)
break; break;
} }
if (isrdcsr(0)&IDON) { if (isrdcsr(unit,0)&IDON) {
/* Start lance */ /* Start lance */
iswrcsr(0,STRT|IDON|INEA); iswrcsr(unit,0,STRT|IDON|INEA);
ns->ns_if.if_flags |= IFF_RUNNING; is->is_if.if_flags |= IFF_RUNNING;
isstart(ifp); isstart(ifp);
} }
else else
@ -316,7 +332,8 @@ isinit(unit)
isstart(ifp) isstart(ifp)
struct ifnet *ifp; struct ifnet *ifp;
{ {
register struct is_softc *ns = &is_softc[ifp->if_unit]; int unit = ifp->if_unit;
register struct is_softc *is = &is_softc[unit];
struct mbuf *m0, *m; struct mbuf *m0, *m;
unsigned char *buffer; unsigned char *buffer;
u_short len; u_short len;
@ -324,15 +341,15 @@ isstart(ifp)
struct mds *cdm; struct mds *cdm;
if ((ns->ns_if.if_flags & IFF_RUNNING) == 0) if ((is->is_if.if_flags & IFF_RUNNING) == 0)
return; return;
do { do {
cdm = (td + ns->last_td); cdm = (is->td + is->last_td);
if (cdm->flags&OWN) if (cdm->flags&OWN)
return; return;
IF_DEQUEUE(&ns->ns_if.if_snd, m); IF_DEQUEUE(&is->is_if.if_snd, m);
if (m == 0) if (m == 0)
return; return;
@ -341,7 +358,7 @@ isstart(ifp)
* Copy the mbuf chain into the transmit buffer * Copy the mbuf chain into the transmit buffer
*/ */
buffer = tbuf+(BUFSIZE*ns->last_td); buffer = is->tbuf+(BUFSIZE*is->last_td);
len=0; len=0;
for (m0=m; m != 0; m=m->m_next) { for (m0=m; m != 0; m=m->m_next) {
bcopy(mtod(m,caddr_t),buffer,m->m_len); bcopy(mtod(m,caddr_t),buffer,m->m_len);
@ -359,18 +376,18 @@ isstart(ifp)
cdm->flags |= (OWN|STP|ENP); cdm->flags |= (OWN|STP|ENP);
cdm->bcnt = -len; cdm->bcnt = -len;
cdm->mcnt = 0; cdm->mcnt = 0;
#ifdef ISDEBUG #if ISDEBUG > 3
xmit_print(ns->last_td); xmit_print(unit,is->last_td);
#endif #endif
iswrcsr(0,TDMD|INEA); iswrcsr(unit,0,TDMD|INEA);
if (++ns->last_td >= NTBUF) if (++is->last_td >= NTBUF)
ns->last_td=0; is->last_td=0;
}while(++ns->no_td < NTBUF); }while(++is->no_td < NTBUF);
ns->no_td = NTBUF; is->no_td = NTBUF;
ns->ns_if.if_flags |= IFF_OACTIVE; is->is_if.if_flags |= IFF_OACTIVE;
#ifdef ISDEBUG #if ISDEBUG >4
printf("no_td = %x, last_td = %x\n",ns->no_td, ns->last_td); printf("no_td = %x, last_td = %x\n",is->no_td, is->last_td);
#endif #endif
return(0); return(0);
} }
@ -381,34 +398,37 @@ isstart(ifp)
*/ */
isintr(unit) isintr(unit)
{ {
register struct is_softc *ns = &is_softc[unit]; register struct is_softc *is = &is_softc[unit];
u_short isr; u_short isr;
while((isr=isrdcsr(0))&INTR) { while((isr=isrdcsr(unit,0))&INTR) {
if (isr&ERR) { if (isr&ERR) {
if (isr&BABL) if (isr&BABL)
printf("BABL\n"); printf("is%d:BABL\n",unit);
if (isr&CERR) if (isr&CERR)
printf("CERR\n"); printf("is%d:CERR\n",unit);
if (isr&MISS) if (isr&MISS)
printf("MISS\n"); printf("is%d:MISS\n",unit);
if (isr&MERR) if (isr&MERR)
printf("MERR\n"); printf("is%d:MERR\n",unit);
iswrcsr(0,BABL|CERR|MISS|MERR|INEA); iswrcsr(unit,0,BABL|CERR|MISS|MERR|INEA);
}
if (!(isr&TXON)) {
isreset(unit);
return(1);
} }
if (!(isr&RXON)) { if (!(isr&RXON)) {
printf("!(isr&RXON)\n");
isreset(unit); isreset(unit);
return(1); return(1);
} }
if (!(isr&TXON)) {
printf("!(isr&TXON)\n");
isreset(unit);
return(1);
}
if (isr&RINT) { if (isr&RINT) {
isrint(unit); isrint(unit);
} }
if (isr&TINT) { if (isr&TINT) {
iswrcsr(0,TINT|INEA); iswrcsr(unit,0,TINT|INEA);
istint(unit); istint(unit);
} }
} }
@ -418,15 +438,15 @@ istint(unit)
int unit; int unit;
{ {
struct is_softc *is = &is_softc[unit]; struct is_softc *is = &is_softc[unit];
register struct ifnet *ifp = &is->ns_if; register struct ifnet *ifp = &is->is_if;
int i,loopcount=0; int i,loopcount=0;
struct mds *cdm; struct mds *cdm;
do { do {
if ((i=is->last_td - is->no_td) < 0) if ((i=is->last_td - is->no_td) < 0)
i+=NTBUF; i+=NTBUF;
cdm = (td+i); cdm = (is->td+i);
#ifdef ISDEBUG #if ISDEBUG >4
printf("Trans cdm = %x\n",cdm); printf("Trans cdm = %x\n",cdm);
#endif #endif
if (cdm->flags&OWN) { if (cdm->flags&OWN) {
@ -435,69 +455,69 @@ istint(unit)
return; return;
} }
loopcount++; loopcount++;
is->ns_if.if_flags &= ~IFF_OACTIVE; is->is_if.if_flags &= ~IFF_OACTIVE;
}while(--is->no_td > 0); }while(--is->no_td > 0);
isstart(ifp); isstart(ifp);
} }
#define NEXTRDS \ #define NEXTRDS \
if (++rmd == NRBUF) rmd=0, cdm=rd; else ++cdm if (++rmd == NRBUF) rmd=0, cdm=is->rd; else ++cdm
isrint(unit) isrint(unit)
int unit; int unit;
{ {
register struct is_softc *is=&is_softc[unit]; register struct is_softc *is=&is_softc[unit];
register int rmd = is->last_rd; register int rmd = is->last_rd;
struct mds *cdm = (rd + rmd); struct mds *cdm = (is->rd + rmd);
/* Out of sync with hardware, should never happen */ /* Out of sync with hardware, should never happen */
if (cdm->flags & OWN) { if (cdm->flags & OWN) {
printf("is0 error: out of sync\n"); printf("is%d error: out of sync\n",unit);
iswrcsr(0,RINT|INEA); iswrcsr(unit,0,RINT|INEA);
return; return;
} }
/* Process all buffers with valid data */ /* Process all buffers with valid data */
while (!(cdm->flags&OWN)) { while (!(cdm->flags&OWN)) {
/* Clear interrupt to avoid race condition */ /* Clear interrupt to avoid race condition */
iswrcsr(0,RINT|INEA); iswrcsr(unit,0,RINT|INEA);
if (cdm->flags&ERR) { if (cdm->flags&ERR) {
if (cdm->flags&FRAM) if (cdm->flags&FRAM)
printf("FRAM\n"); printf("is%d:FRAM\n",unit);
if (cdm->flags&OFLO) if (cdm->flags&OFLO)
printf("OFLO\n"); printf("is%d:OFLO\n",unit);
if (cdm->flags&CRC) if (cdm->flags&CRC)
printf("CRC\n"); printf("is%d:CRC\n",unit);
if (cdm->flags&RBUFF) if (cdm->flags&RBUFF)
printf("RBUFF\n"); printf("is%d:RBUFF\n",unit);
}else }else
if (cdm->flags&(STP|ENP) != (STP|ENP)) { if (cdm->flags&(STP|ENP) != (STP|ENP)) {
do { do {
iswrcsr(0,RINT|INEA); iswrcsr(unit,0,RINT|INEA);
cdm->mcnt = 0; cdm->mcnt = 0;
cdm->flags |= OWN; cdm->flags |= OWN;
NEXTRDS; NEXTRDS;
}while (!(cdm->flags&(OWN|ERR|STP|ENP))); }while (!(cdm->flags&(OWN|ERR|STP|ENP)));
is->last_rd = rmd; is->last_rd = rmd;
printf("Chained buffer\n"); printf("is%d:Chained buffer\n",unit);
if ((cdm->flags & (OWN|ERR|STP|ENP)) != ENP) { if ((cdm->flags & (OWN|ERR|STP|ENP)) != ENP) {
isreset(unit); isreset(unit);
return; return;
} }
}else }else
{ {
#ifdef ISDEBUG #if ISDEBUG >2
recv_print(is->last_rd); recv_print(unit,is->last_rd);
#endif #endif
isread(is,rbuf+(BUFSIZE*rmd),cdm->mcnt); isread(is,is->rbuf+(BUFSIZE*rmd),cdm->mcnt);
} }
cdm->flags |= OWN; cdm->flags |= OWN;
cdm->mcnt = 0; cdm->mcnt = 0;
NEXTRDS; NEXTRDS;
#ifdef ISDEBUG #if ISDEBUG >4
printf("is->last_rd = %x, cdm = %x\n",is->last_rd,cdm); printf("is->last_rd = %x, cdm = %x\n",is->last_rd,cdm);
#endif #endif
} /* while */ } /* while */
@ -508,8 +528,8 @@ isrint(unit)
* Pass a packet to the higher levels. * Pass a packet to the higher levels.
* We deal with the trailer protocol here. * We deal with the trailer protocol here.
*/ */
isread(ns, buf, len) isread(is, buf, len)
register struct is_softc *ns; register struct is_softc *is;
char *buf; char *buf;
int len; int len;
{ {
@ -545,10 +565,10 @@ isread(ns, buf, len)
* information to be at the front, but we still have to drop * information to be at the front, but we still have to drop
* the type and length which are at the front of any trailer data. * the type and length which are at the front of any trailer data.
*/ */
m = isget(buf, len, off, &ns->ns_if); m = isget(buf, len, off, &is->is_if);
if (m == 0) return; if (m == 0) return;
ether_input(&ns->ns_if, eh, m); ether_input(&is->is_if, eh, m);
} }
/* /*
@ -641,7 +661,8 @@ isioctl(ifp, cmd, data)
caddr_t data; caddr_t data;
{ {
register struct ifaddr *ifa = (struct ifaddr *)data; register struct ifaddr *ifa = (struct ifaddr *)data;
struct is_softc *ns = &is_softc[ifp->if_unit]; int unit = ifp->if_unit;
struct is_softc *is = &is_softc[unit];
struct ifreq *ifr = (struct ifreq *)data; struct ifreq *ifr = (struct ifreq *)data;
int s = splimp(), error = 0; int s = splimp(), error = 0;
@ -663,10 +684,10 @@ isioctl(ifp, cmd, data)
#ifdef NS #ifdef NS
case AF_NS: case AF_NS:
{ {
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr); register struct is_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina)) if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *)(ns->ns_addr); ina->x_host = *(union ns_host *)(is->is_addr);
else { else {
/* /*
* The manual says we can't change the address * The manual says we can't change the address
@ -675,7 +696,7 @@ isioctl(ifp, cmd, data)
*/ */
ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host, bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)ns->ns_addr, sizeof(ns->ns_addr)); (caddr_t)is->is_addr, sizeof(is->is_addr));
} }
isinit(ifp->if_unit); /* does ne_setaddr() */ isinit(ifp->if_unit); /* does ne_setaddr() */
break; break;
@ -691,7 +712,7 @@ isioctl(ifp, cmd, data)
if ((ifp->if_flags & IFF_UP) == 0 && if ((ifp->if_flags & IFF_UP) == 0 &&
ifp->if_flags & IFF_RUNNING) { ifp->if_flags & IFF_RUNNING) {
ifp->if_flags &= ~IFF_RUNNING; ifp->if_flags &= ~IFF_RUNNING;
iswrcsr(0,STOP); iswrcsr(unit,0,STOP);
} else if (ifp->if_flags & IFF_UP && } else if (ifp->if_flags & IFF_UP &&
(ifp->if_flags & IFF_RUNNING) == 0) (ifp->if_flags & IFF_RUNNING) == 0)
isinit(ifp->if_unit); isinit(ifp->if_unit);
@ -699,8 +720,8 @@ isioctl(ifp, cmd, data)
#ifdef notdef #ifdef notdef
case SIOCGHWADDR: case SIOCGHWADDR:
bcopy((caddr_t)ns->ns_addr, (caddr_t) &ifr->ifr_data, bcopy((caddr_t)is->is_addr, (caddr_t) &ifr->ifr_data,
sizeof(ns->ns_addr)); sizeof(is->is_addr));
break; break;
#endif #endif
@ -711,36 +732,38 @@ isioctl(ifp, cmd, data)
return (error); return (error);
} }
recv_print(no) recv_print(unit,no)
int no; int unit,no;
{ {
register struct is_softc *is=&is_softc[unit];
struct mds *rmd; struct mds *rmd;
int len,i; int len,i;
rmd = (rd+no); rmd = (is->rd+no);
len = rmd->mcnt; len = rmd->mcnt;
printf("Receive buffer %d, len = %d\n",no,len); printf("is%d: Receive buffer %d, len = %d\n",unit,no,len);
printf("Status %x\n",isrdcsr(0)); printf("is%d: Status %x\n",unit,isrdcsr(unit,0));
for (i=0; i<len; i++) for (i=0; i<len; i++)
printf("%x ",*(rbuf+(BUFSIZE*no)+i)); printf("%x ",*(is->rbuf+(BUFSIZE*no)+i));
printf("\n"); printf("\n");
} }
xmit_print(no) xmit_print(unit,no)
int no; int unit,no;
{ {
register struct is_softc *is=&is_softc[unit];
struct mds *rmd; struct mds *rmd;
int i; int i;
u_short len; u_short len;
rmd = (td+no); rmd = (is->td+no);
len = -(rmd->bcnt); len = -(rmd->bcnt);
printf("Transmit buffer %d, len = %d\n",no,len); printf("is%d:Transmit buffer %d, len = %d\n",unit,no,len);
printf("Status %x\n",isrdcsr(0)); printf("is%d:Status %x\n",unit,isrdcsr(unit,0));
printf("addr %x, flags %x, bcnt %x, mcnt %x\n", printf("addr %x, flags %x, bcnt %x, mcnt %x\n",
rmd->addr,rmd->flags,rmd->bcnt,rmd->mcnt); rmd->addr,rmd->flags,rmd->bcnt,rmd->mcnt);
for (i=0; i<len; i++) for (i=0; i<len; i++)
printf("%x ",*(tbuf+(BUFSIZE*no)+i)); printf("%x ",*(is->tbuf+(BUFSIZE*no)+i));
printf("\n"); printf("\n");
} }