| plan 9 kernel history: overview | file list | diff list |
1990/1228/port/devlance.c (diff list | history)
| 1990/11211/sys/src/9/port/devlance.c:24,40 – 1990/1228/sys/src/9/port/devlance.c:24,29 (short | long | prev | next) | ||
| 1990/0707 | #define NOW (MACHP(0)->ticks*MS2HZ) | |
| 1990/03042 | ||
| 1990/0227 | /* | |
| 1990/0911 |
| |
| 1990/0227 | * Communication with the lance is via a transmit and receive ring of * message descriptors. The Initblock contains pointers to and sizes of * these rings. The rings must be in RAM addressible by the lance | |
| 1990/11211/sys/src/9/port/devlance.c:70,81 – 1990/1228/sys/src/9/port/devlance.c:59,69 | ||
| 1990/0227 | Msg tmr[Ntrb]; /* transmit message ring */ /* | |
| 1990/0911 |
| |
| 1990/1228 | * packet buffers (for SGI IO2 version only) | |
| 1990/0227 | */ | |
| 1990/0911 |
| |
| 1990/1228 | Etherpkt rp[Nrrb]; Etherpkt tp[Ntrb]; | |
| 1990/0227 | } Lancemem; | |
| 1990/0911 |
| |
| 1990/0227 | /* * Some macros for dealing with lance memory addresses. The lance splits | |
| 1990/11211/sys/src/9/port/devlance.c:83,88 – 1990/1228/sys/src/9/port/devlance.c:71,86 | ||
| 1990/0227 | */ | |
| 1990/0911 | #define HADDR(a) ((((ulong)(a))>>16)&0xFF) | |
| 1990/0227 | #define LADDR(a) (((ulong)a)&0xFFFF) | |
| 1990/1228 | /* * The following functions exist to sidestep a quirk in the SGI IO3 lance * interface. In all other processors, the lance's initialization block and * descriptor rings look like normal memory. In the SGI IO3, the CPU sees a * 6 byte pad twixt all lance memory shorts. Therefore, we use the following * macros to compute the address whenever accessing the lance memory to make * the code portable. Sic transit gloria. */ #define LANCEMEM ((Lancemem*)0) | |
| 1990/0911 | #define MPs(a) (*(short *)(l.lanceram + l.sep*((ushort*)&a - (ushort*)0))) #define MPus(a) (*(ushort *)(l.lanceram + l.sep*((ushort*)&a - (ushort*)0))) | |
| 1990/0227 | ||
| 1990/11211/sys/src/9/port/devlance.c:147,154 – 1990/1228/sys/src/9/port/devlance.c:145,152 | ||
| 1990/0227 | int kstarted; Debqueue dq; | |
| 1990/0911 |
| |
| 1990/1228 | Etherpkt *rp; /* receive buffers */ Etherpkt *tp; /* transmit buffers */ | |
| 1990/0911 | uchar *rpa[Nrrb]; /* receive buffer address in lance space */ uchar *tpa[Ntrb]; /* transmit buffer address in lance space */ | |
| 1990/11211/sys/src/9/port/devlance.c:256,262 – 1990/1228/sys/src/9/port/devlance.c:254,260 | ||
| 1990/0227 | * save a message in a circular queue for later debugging */ void | |
| 1990/03042 |
| |
| 1990/1228 | lancedebq(char tag, Etherpkt *p, int len) | |
| 1990/0227 | { | |
| 1990/03042 | Trace *t; | |
| 1990/11211/sys/src/9/port/devlance.c:338,344 – 1990/1228/sys/src/9/port/devlance.c:336,342 | ||
| 1990/0227 | lanceoput(Queue *q, Block *bp ) { int n, len; | |
| 1990/1228 | Etherpkt *p; | |
| 1990/0227 | Msg *m; if(bp->type == M_CTL){ | |
| 1990/11211/sys/src/9/port/devlance.c:375,381 – 1990/1228/sys/src/9/port/devlance.c:373,379 | ||
| 1990/0227 | */ len = 0; while(bp = getq(q)){ | |
| 1990/0312 |
| |
| 1990/1228 | if(sizeof(Etherpkt) - len >= (n = BLEN(bp))){ | |
| 1990/03042 | memcpy(((uchar *)p)+len, bp->rptr, n); | |
| 1990/0227 | len += n; } else | |
| 1990/11211/sys/src/9/port/devlance.c:425,430 – 1990/1228/sys/src/9/port/devlance.c:423,444 | ||
| 1990/03042 | Dirtab lancedir[Ndir]; | |
| 1990/0227 | /* | |
| 1990/1228 | * configure the lance */ void lanceconfig(void *ramstart, void *ramend, void *rap, void *rdp, int sep, void *lancemem, uchar* ea) { l.lanceram = ramstart; l.lanceend = ramend; l.rap = rap; l.rdp = rdp; l.sep = sep; l.lm = lancemem; /* where lance sees its memory start */ memcpy(l.ea, ea, 6); } /* | |
| 1990/0227 | * stop the lance, disable all ring buffers, and free all staged rcv buffers */ void | |
| 1990/11211/sys/src/9/port/devlance.c:431,466 – 1990/1228/sys/src/9/port/devlance.c:445,464 | ||
| 1990/0227 | lancereset(void) { int i; | |
| 1990/0911 |
| |
| 1990/0227 | /* | |
| 1990/0911 |
| |
| 1990/1228 | * stop the lance | |
| 1990/0227 | */ | |
| 1990/0911 |
| |
| 1990/1228 | *l.rap = 0; *l.rdp = STOP; | |
| 1990/0227 |
| |
| 1990/0911 |
| |
| 1990/0227 |
| |
| 1990/0911 | if(already == 0){ already = 1; if(ioid < IO3R1){ /* | |
| 1990/0227 | ||
| 1990/0911 |
| |
| 1990/11211/sys/src/9/port/devlance.c:468,492 – 1990/1228/sys/src/9/port/devlance.c:466,479 | ||
| 1990/0911 | for(i = 0; i < Ntrb; i++) l.tpa[i] = (uchar *)&l.lm->tp[i]; | |
| 1990/0912 |
| |
| 1990/1228 | l.rp = ((Lancemem *)l.lanceram)->rp; l.tp = ((Lancemem *)l.lanceram)->tp; | |
| 1990/0911 | } else { /* | |
| 1990/1228 | l.rp = (Etherpkt *)ialloc((Nrrb + Ntrb)*sizeof(Etherpkt), 1); | |
| 1990/0911 | l.tp = l.rp + Nrrb; index = 0x1E00; for(i = 0; i < Nrrb; i++){ | |
| 1990/11211/sys/src/9/port/devlance.c:504,515 – 1990/1228/sys/src/9/port/devlance.c:491,496 | ||
| 1990/0911 | } } | |
| 1990/0227 |
| |
| 1990/0911 |
| |
| 1990/0227 | } /* | |
| 1990/11211/sys/src/9/port/devlance.c:520,526 – 1990/1228/sys/src/9/port/devlance.c:501,507 | ||
| 1990/0227 | lancestart(void) { int i; | |
| 1990/1228 | Etherpkt *p; | |
| 1990/0911 | Lancemem *lm = LANCEMEM; Msg *m; | |
| 1990/0227 | ||
| 1990/11211/sys/src/9/port/devlance.c:536,550 – 1990/1228/sys/src/9/port/devlance.c:517,525 | ||
| 1990/0227 | * the id prom has them in reverse order, the init * structure wants them in byte swapped order */ | |
| 1990/0911 |
| |
| 1990/0227 |
| |
| 1990/1228 | MPus(lm->etheraddr[0]) = (l.ea[1]<<8) | l.ea[0]; MPus(lm->etheraddr[1]) = (l.ea[3]<<8) | l.ea[2]; MPus(lm->etheraddr[2]) = (l.ea[5]<<8) | l.ea[4]; | |
| 1990/0227 | /* * ignore multicast addresses | |
| 1990/11211/sys/src/9/port/devlance.c:559,565 – 1990/1228/sys/src/9/port/devlance.c:534,540 | ||
| 1990/0227 | */ | |
| 1990/0911 | m = lm->rmr; for(i = 0; i < Nrrb; i++, m++){ | |
| 1990/1228 | MPs(m->size) = -sizeof(Etherpkt); | |
| 1990/0911 | MPus(m->cntflags) = 0; MPus(m->laddr) = LADDR(l.rpa[i]); MPus(m->flags) = HADDR(l.rpa[i]); | |
| 1990/11211/sys/src/9/port/devlance.c:860,866 – 1990/1228/sys/src/9/port/devlance.c:835,841 | ||
| 1990/0227 | lancekproc(void *arg) { Block *bp; | |
| 1990/1228 | Etherpkt *p; | |
| 1990/0227 | Ethertype *e; int t; int len; | |
| 1990/11211/sys/src/9/port/devlance.c:930,936 – 1990/1228/sys/src/9/port/devlance.c:905,911 | ||
| 1990/0227 | * stage the next input buffer */ m = &(lm->rmr[l.rc]); | |
| 1990/0911 |
| |
| 1990/1228 | MPs(m->size) = -sizeof(Etherpkt); | |
| 1990/0911 | MPus(m->cntflags) = 0; MPus(m->laddr) = LADDR(l.rpa[l.rc]); MPus(m->flags) = OWN|HADDR(l.rpa[l.rc]); | |