KNF
This commit is contained in:
parent
1f746cfba1
commit
89a7412206
|
@ -40,7 +40,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_ie.c,v 1.1 1994/10/26 07:11:18 deraadt Exp $
|
||||
* $Id: if_ie.c,v 1.2 1994/10/30 18:43:21 deraadt Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -143,9 +143,8 @@
|
|||
#include <machine/cpu.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
#include <sparc/dev/if_sunie.h> /* sun specific stuff */
|
||||
#include <sparc/dev/i82586.h> /* its a free world, baby
|
||||
(thanks to i386/isa/ic!) */
|
||||
#include <sparc/dev/if_ie.h>
|
||||
#include <sparc/dev/i82586.h>
|
||||
|
||||
static struct mbuf *last_not_for_us;
|
||||
|
||||
|
@ -181,10 +180,10 @@ enum ie_hardware {
|
|||
};
|
||||
|
||||
const char *ie_hardware_names[] = {
|
||||
"SUN MULTIBUS/VME",
|
||||
"SUN ON-BOARD",
|
||||
"SUN 3E/VME",
|
||||
"UNKNOWN"
|
||||
"multibus/vme",
|
||||
"onboard",
|
||||
"3e/vme",
|
||||
"unknown"
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -223,7 +222,6 @@ const char *ie_hardware_names[] = {
|
|||
* in KVA. note that since the SCP is at a fixed address it means
|
||||
* that we have to allocate a fixed KVA for the SCP.
|
||||
*/
|
||||
|
||||
struct ie_softc {
|
||||
struct device sc_dev; /* device structure */
|
||||
struct intrhand sc_ih; /* interrupt info */
|
||||
|
@ -244,24 +242,23 @@ struct ie_softc {
|
|||
int want_mcsetup; /* flag for multicast setup */
|
||||
int promisc; /* are we in promisc mode? */
|
||||
|
||||
/* pointers to the 3 major control structures */
|
||||
|
||||
/*
|
||||
* pointers to the 3 major control structures
|
||||
*/
|
||||
volatile struct ie_sys_conf_ptr *scp;
|
||||
volatile struct ie_int_sys_conf_ptr *iscp;
|
||||
volatile struct ie_sys_ctl_block *scb;
|
||||
|
||||
/*
|
||||
* pointer and size of a block of KVA where the buffers are to
|
||||
* be allocated from
|
||||
* pointer and size of a block of KVA where the buffers
|
||||
* are to be allocated from
|
||||
*/
|
||||
|
||||
caddr_t buf_area;
|
||||
int buf_area_sz;
|
||||
|
||||
/*
|
||||
* the actual buffers (recv and xmit)
|
||||
*/
|
||||
|
||||
volatile struct ie_recv_frame_desc *rframes[MXFRAMES];
|
||||
volatile struct ie_recv_buf_desc *rbuffs[MXRXBUF];
|
||||
volatile char *cbuffs[MXRXBUF];
|
||||
|
@ -281,28 +278,33 @@ struct ie_softc {
|
|||
#endif
|
||||
};
|
||||
|
||||
static void ie_obreset __P((struct ie_softc *));
|
||||
static void ie_obattend __P((struct ie_softc *));
|
||||
static void ie_obrun __P((struct ie_softc *));
|
||||
static void ie_vmereset __P((struct ie_softc *));
|
||||
static void ie_vmeattend __P((struct ie_softc *));
|
||||
static void ie_vmerun __P((struct ie_softc *));
|
||||
|
||||
int iewatchdog __P(( /* short */ ));
|
||||
int ieintr __P((void *));
|
||||
int ieinit __P((struct ie_softc * sc));
|
||||
int ieioctl __P((struct ifnet * ifp, int command, caddr_t data));
|
||||
int iestart __P((struct ifnet * ifp));
|
||||
static void ie_vmereset __P((struct ie_softc *));
|
||||
static void ie_vmeattend __P((struct ie_softc *));
|
||||
static void ie_vmerun __P((struct ie_softc *));
|
||||
void iereset __P((struct ie_softc *));
|
||||
static void ie_readframe __P((struct ie_softc * sc, int bufno));
|
||||
static void ie_drop_packet_buffer __P((struct ie_softc * sc));
|
||||
static int command_and_wait __P((struct ie_softc * sc, int command,
|
||||
void volatile * pcmd, int));
|
||||
/*static*/ void ierint __P((struct ie_softc *sc));
|
||||
/*static*/ void ietint __P((struct ie_softc *sc));
|
||||
/*static*/ void iernr __P((struct ie_softc *sc));
|
||||
static void ierint __P((struct ie_softc * sc));
|
||||
static void ietint __P((struct ie_softc * sc));
|
||||
static void iernr __P((struct ie_softc * sc));
|
||||
static void start_receiver __P((struct ie_softc * sc));
|
||||
static int ieget __P((struct ie_softc *, struct mbuf **,
|
||||
struct ether_header *, int *));
|
||||
static void setup_bufs __P((struct ie_softc * sc));
|
||||
static int mc_setup __P((struct ie_softc *, caddr_t));
|
||||
static void mc_reset __P((struct ie_softc * sc));
|
||||
|
||||
#ifdef IEDEBUG
|
||||
void print_rbd __P((volatile struct ie_recv_buf_desc * rbd));
|
||||
int in_ierint = 0;
|
||||
|
@ -322,7 +324,6 @@ struct cfdriver iecd = {
|
|||
* MK_16 = KVA -> 16 bit address in INTEL byte order
|
||||
* ST_24 = store a 24 bit address in SUN byte order to INTEL byte order
|
||||
*/
|
||||
|
||||
#define MK_24(base, ptr) ((caddr_t)((u_long)ptr - (u_long)base))
|
||||
#define MK_16(base, ptr) SWAP((u_short)( ((u_long)(ptr)) - ((u_long)(base)) ))
|
||||
#define ST_24(to, from) { \
|
||||
|
@ -330,7 +331,6 @@ struct cfdriver iecd = {
|
|||
u_char *t = (u_char *)&(to), *f = (u_char *)&fval; \
|
||||
t[0] = f[3]; t[1] = f[2]; t[2] = f[1]; /*t[3] = f[0];*/ \
|
||||
}
|
||||
|
||||
#define MEM sc->sc_maddr
|
||||
|
||||
/*
|
||||
|
@ -347,7 +347,6 @@ ie_setup_config(cmd, promiscuous)
|
|||
/*
|
||||
* these are all char's so don't swap them!
|
||||
*/
|
||||
|
||||
cmd->ie_config_count = 0x0c;
|
||||
cmd->ie_fifo = 8;
|
||||
cmd->ie_save_bad = 0x40;
|
||||
|
@ -384,7 +383,8 @@ ie_ack(sc, mask)
|
|||
}
|
||||
|
||||
|
||||
int iematch(parent, cf, aux)
|
||||
int
|
||||
iematch(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
|
@ -402,7 +402,8 @@ int iematch(parent, cf, aux)
|
|||
ra->ra_len = NBPG;
|
||||
if (ca->ca_bustype == BUS_OBIO && probeget(ra->ra_vaddr, 1) == -1)
|
||||
return (0);
|
||||
else if (probeget(ra->ra_vaddr, 2) == -1) return(0);
|
||||
if (probeget(ra->ra_vaddr, 2) == -1)
|
||||
return (0);
|
||||
|
||||
}
|
||||
return (1);
|
||||
|
@ -411,11 +412,9 @@ int iematch(parent, cf, aux)
|
|||
/*
|
||||
* MULTIBUS/VME support
|
||||
*/
|
||||
|
||||
void ie_vmereset(sc)
|
||||
|
||||
void
|
||||
ie_vmereset(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
volatile struct ievme *iev = (struct ievme *) sc->sc_reg;
|
||||
iev->status = IEVME_RESET;
|
||||
|
@ -423,9 +422,9 @@ void ie_vmereset(sc)
|
|||
iev->status = 0;
|
||||
}
|
||||
|
||||
void ie_vmeattend(sc)
|
||||
void
|
||||
ie_vmeattend(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
volatile struct ievme *iev = (struct ievme *) sc->sc_reg;
|
||||
|
||||
|
@ -433,15 +432,45 @@ void ie_vmeattend(sc)
|
|||
iev->status &= ~IEVME_ATTEN; /* down. */
|
||||
}
|
||||
|
||||
void ie_vmerun(sc)
|
||||
void
|
||||
ie_vmerun(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
volatile struct ievme *iev = (struct ievme *) sc->sc_reg;
|
||||
|
||||
iev->status |= (IEVME_ONAIR | IEVME_IENAB | IEVME_PEINT);
|
||||
}
|
||||
|
||||
/*
|
||||
* onboard ie support
|
||||
*/
|
||||
void
|
||||
ie_obreset(sc)
|
||||
struct ie_softc *sc;
|
||||
{
|
||||
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
||||
ieo->obctrl = 0;
|
||||
delay(100); /* XXX could be shorter? */
|
||||
ieo->obctrl = IEOB_NORSET;
|
||||
}
|
||||
void
|
||||
ie_obattend(sc)
|
||||
struct ie_softc *sc;
|
||||
{
|
||||
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
||||
|
||||
ieo->obctrl |= IEOB_ATTEN; /* flag! */
|
||||
ieo->obctrl &= ~IEOB_ATTEN; /* down. */
|
||||
}
|
||||
|
||||
void
|
||||
ie_obrun(sc)
|
||||
struct ie_softc *sc;
|
||||
{
|
||||
volatile struct ieob *ieo = (struct ieob *) sc->sc_reg;
|
||||
|
||||
ieo->obctrl |= (IEOB_ONAIR|IEOB_IENAB|IEOB_NORSET);
|
||||
}
|
||||
|
||||
/*
|
||||
* Taken almost exactly from Bill's if_is.c, then modified beyond recognition.
|
||||
|
@ -467,10 +496,12 @@ ieattach(parent, self, aux)
|
|||
case BUS_OBIO:
|
||||
printf("unsupported (for now)\n");
|
||||
return;
|
||||
case BUS_VME16: {
|
||||
case BUS_VME16:
|
||||
{
|
||||
struct ievme *iev;
|
||||
u_long rampaddr;
|
||||
int lcv;
|
||||
|
||||
sc->reset_586 = ie_vmereset;
|
||||
sc->chan_attn = ie_vmeattend;
|
||||
sc->run_586 = ie_vmerun;
|
||||
|
@ -479,15 +510,18 @@ ieattach(parent, self, aux)
|
|||
sc->sc_reg = mapiodev(ca->ca_ra.ra_paddr, sizeof(struct ievme),
|
||||
ca->ca_bustype);
|
||||
iev = (struct ievme *) sc->sc_reg;
|
||||
rampaddr = (u_long)ca->ca_ra.ra_paddr & 0xfff00000; /* top 12 bits */
|
||||
rampaddr = rampaddr | ((iev->status & IEVME_HADDR) << 16);/*4 more*/
|
||||
/* top 12 bits */
|
||||
rampaddr = (u_long) ca->ca_ra.ra_paddr & 0xfff00000;
|
||||
/* 4 more */
|
||||
rampaddr = rampaddr | ((iev->status & IEVME_HADDR) << 16);
|
||||
sc->sc_maddr = mapiodev((caddr_t) rampaddr, sc->sc_msize,
|
||||
ca->ca_bustype);
|
||||
sc->sc_iobase = sc->sc_maddr;
|
||||
|
||||
/*
|
||||
* set up mappings, direct map except for last page which is mapped
|
||||
* at zero and at high address (for scp), zero ram
|
||||
* set up mappings, direct map except for last page
|
||||
* which is mapped at zero and at high address (for
|
||||
* scp), zero ram
|
||||
*/
|
||||
|
||||
for (lcv = 0; lcv < IEVME_MAPSZ - 1; lcv++)
|
||||
|
@ -497,10 +531,9 @@ ieattach(parent, self, aux)
|
|||
|
||||
/*
|
||||
* set up pointers to data structures and buffer area.
|
||||
* scp is in double mapped page... get offset into page and add
|
||||
* to sc_maddr.
|
||||
* scp is in double mapped page... get offset into page
|
||||
* and add to sc_maddr.
|
||||
*/
|
||||
|
||||
sc->scp = (volatile struct ie_sys_conf_ptr *)
|
||||
(sc->sc_maddr + (IE_SCP_ADDR & (IEVME_PAGESIZE - 1)));
|
||||
sc->iscp = (volatile struct ie_int_sys_conf_ptr *)
|
||||
|
@ -508,11 +541,13 @@ ieattach(parent, self, aux)
|
|||
sc->scb = (volatile struct ie_sys_ctl_block *)
|
||||
sc->sc_maddr + sizeof(struct ie_int_sys_conf_ptr);
|
||||
/* scb follows iscp */
|
||||
/* rest of first page is unused, rest of ram for buffers */
|
||||
|
||||
/*
|
||||
* rest of first page is unused, rest of ram
|
||||
* for buffers
|
||||
*/
|
||||
sc->buf_area = sc->sc_maddr + IEVME_PAGESIZE;
|
||||
sc->buf_area_sz = sc->sc_msize - IEVME_PAGESIZE;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -524,10 +559,9 @@ ieattach(parent, self, aux)
|
|||
|
||||
if (ie_setupram(sc) == 0) {
|
||||
printf(": RAM CONFIG FAILED!\n");
|
||||
return;
|
||||
/* XXX should reclaim resources? */
|
||||
return;
|
||||
}
|
||||
|
||||
ifp->if_unit = sc->sc_dev.dv_unit;
|
||||
ifp->if_name = iecd.cd_name;
|
||||
ifp->if_output = ether_output;
|
||||
|
@ -561,7 +595,8 @@ ieattach(parent, self, aux)
|
|||
case BUS_VME32:
|
||||
sc->sc_ih.ih_fun = ieintr;
|
||||
sc->sc_ih.ih_arg = sc;
|
||||
vmeintr_establish(ca->ca_ra.ra_intr[0].int_vec, pri, &(sc->sc_ih));
|
||||
vmeintr_establish(ca->ca_ra.ra_intr[0].int_vec, pri,
|
||||
&(sc->sc_ih));
|
||||
break;
|
||||
#endif /* SUN4 */
|
||||
}
|
||||
|
@ -598,7 +633,6 @@ ieintr(v)
|
|||
/*
|
||||
* check for parity error
|
||||
*/
|
||||
|
||||
if (sc->hard_type == IE_VME) {
|
||||
volatile struct ievme *iev = (volatile struct ievme *) sc->sc_reg;
|
||||
if (iev->status & IEVME_PERR) {
|
||||
|
@ -607,8 +641,6 @@ ieintr(v)
|
|||
iev->pectrl = iev->pectrl | IEVME_PARACK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
loop:
|
||||
if (status & (IE_ST_RECV | IE_ST_RNR)) {
|
||||
#ifdef IEDEBUG
|
||||
|
@ -621,7 +653,6 @@ ieintr(v)
|
|||
in_ierint--;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (status & IE_ST_DONE) {
|
||||
#ifdef IEDEBUG
|
||||
in_ietint++;
|
||||
|
@ -633,7 +664,6 @@ ieintr(v)
|
|||
in_ietint--;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (status & IE_ST_RNR) {
|
||||
#ifdef IEDEBUG
|
||||
if (sc->sc_debug & IED_RNR)
|
||||
|
@ -641,7 +671,6 @@ ieintr(v)
|
|||
#endif
|
||||
iernr(sc);
|
||||
}
|
||||
|
||||
#ifdef IEDEBUG
|
||||
if ((status & IE_ST_ALLDONE) && (sc->sc_debug & IED_CNA))
|
||||
printf("%s: cna\n", sc->sc_dev.dv_xname);
|
||||
|
@ -652,7 +681,6 @@ ieintr(v)
|
|||
|
||||
if ((status = sc->scb->ie_status) & IE_ST_WHENCE)
|
||||
goto loop;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -750,7 +778,6 @@ ietint(sc)
|
|||
mc_setup(sc, (caddr_t) sc->xmit_cbuffs[0]);
|
||||
sc->want_mcsetup = 0;
|
||||
}
|
||||
|
||||
/* Wish I knew why this seems to be necessary... */
|
||||
sc->xmit_cmds[0]->ie_xmit_status |= IE_STAT_COMPL;
|
||||
|
||||
|
@ -817,14 +844,16 @@ check_eh(sc, eh, to_bpf)
|
|||
switch (sc->promisc) {
|
||||
case IFF_ALLMULTI:
|
||||
/*
|
||||
* Receiving all multicasts, but no unicasts except those destined for us.
|
||||
* Receiving all multicasts, but no unicasts except those
|
||||
* destined for us.
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0); /* BPF gets this packet if anybody cares */
|
||||
*to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0);
|
||||
#endif
|
||||
if (eh->ether_dhost[0] & 1)
|
||||
return 1;
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr))
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
case IFF_PROMISC:
|
||||
|
@ -835,7 +864,8 @@ check_eh(sc, eh, to_bpf)
|
|||
*to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0);
|
||||
#endif
|
||||
/* If for us, accept and hand up to BPF */
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr))
|
||||
return 1;
|
||||
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
|
@ -853,7 +883,8 @@ check_eh(sc, eh, to_bpf)
|
|||
* up.
|
||||
*/
|
||||
for (i = 0; i < sc->mcast_count; i++) {
|
||||
if (ether_equal(eh->ether_dhost, (u_char *)&sc->mcast_addrs[i])) {
|
||||
if (ether_equal(eh->ether_dhost,
|
||||
(u_char *)&sc->mcast_addrs[i])) {
|
||||
#if NBPFILTER > 0
|
||||
if (*to_bpf)
|
||||
*to_bpf = 1;
|
||||
|
@ -865,8 +896,8 @@ check_eh(sc, eh, to_bpf)
|
|||
|
||||
case IFF_ALLMULTI | IFF_PROMISC:
|
||||
/*
|
||||
* Acting as a multicast router, and BPF running at the same time.
|
||||
* Whew! (Hope this is a fast machine...)
|
||||
* Acting as a multicast router, and BPF running at the same
|
||||
* time. Whew! (Hope this is a fast machine...)
|
||||
*/
|
||||
#if NBPFILTER > 0
|
||||
*to_bpf = (sc->sc_arpcom.ac_if.if_bpf != 0);
|
||||
|
@ -876,7 +907,8 @@ check_eh(sc, eh, to_bpf)
|
|||
return 1;
|
||||
|
||||
/* We want to see our own packets */
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr)) return 1;
|
||||
if (ether_equal(eh->ether_dhost, sc->sc_arpcom.ac_enaddr))
|
||||
return 1;
|
||||
|
||||
/* Anything else goes to BPF but nothing else. */
|
||||
#if NBPFILTER > 0
|
||||
|
@ -935,7 +967,6 @@ ie_packet_len(sc)
|
|||
iereset(sc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
i = sc->rbuffs[head]->ie_rbd_actual & IE_RBD_LAST;
|
||||
|
||||
acc += ie_buflen(sc, head);
|
||||
|
@ -989,7 +1020,8 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
*/
|
||||
if (!check_eh(sc, ehp, to_bpf)) {
|
||||
ie_drop_packet_buffer(sc);
|
||||
sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's not an error */
|
||||
sc->sc_arpcom.ac_if.if_ierrors--; /* just this case, it's
|
||||
* not an error */
|
||||
return -1;
|
||||
}
|
||||
totlen -= (offset = sizeof *ehp);
|
||||
|
@ -999,7 +1031,6 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
ie_drop_packet_buffer(sc);
|
||||
return -1;
|
||||
}
|
||||
|
||||
m = *mp;
|
||||
m->m_pkthdr.rcvif = &sc->sc_arpcom.ac_if;
|
||||
m->m_len = MHLEN;
|
||||
|
@ -1013,12 +1044,12 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
*/
|
||||
do { /* while (resid > 0) */
|
||||
/*
|
||||
* Try to allocate an mbuf to hold the data that we have. If we
|
||||
* already allocated one, just get another one and stick it on the
|
||||
* end (eventually). If we don't already have one, try to allocate
|
||||
* an mbuf cluster big enough to hold the whole packet, if we think it's
|
||||
* reasonable, or a single mbuf which may or may not be big enough.
|
||||
* Got that?
|
||||
* Try to allocate an mbuf to hold the data that we have. If
|
||||
* we already allocated one, just get another one and stick it
|
||||
* on the end (eventually). If we don't already have one, try
|
||||
* to allocate an mbuf cluster big enough to hold the whole
|
||||
* packet, if we think it's reasonable, or a single mbuf which
|
||||
* may or may not be big enough. Got that?
|
||||
*/
|
||||
if (top) {
|
||||
MGET(m, M_DONTWAIT, MT_DATA);
|
||||
|
@ -1029,7 +1060,6 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
}
|
||||
m->m_len = MLEN;
|
||||
}
|
||||
|
||||
if (resid >= MINCLSIZE) {
|
||||
MCLGET(m, M_DONTWAIT);
|
||||
if (m->m_flags & M_EXT)
|
||||
|
@ -1069,11 +1099,12 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
mtod(m, caddr_t) + thismboff, (u_int) newlen);
|
||||
m = m->m_next;
|
||||
thismboff = 0; /* new mbuf, so no offset */
|
||||
offset += newlen; /* we are now this far into the packet */
|
||||
resid -= newlen; /* so there is this much left to get */
|
||||
offset += newlen; /* we are now this far into
|
||||
* the packet */
|
||||
resid -= newlen; /* so there is this much left
|
||||
* to get */
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* If there is more than enough space in the mbuf to hold the
|
||||
* contents of this buffer, copy everything in, advance pointers,
|
||||
|
@ -1082,11 +1113,11 @@ ieget(sc, mp, ehp, to_bpf)
|
|||
if (thislen < m->m_len - thismboff) {
|
||||
wcopy((caddr_t) (sc->cbuffs[head] + offset),
|
||||
mtod(m, caddr_t) + thismboff, (u_int) thislen);
|
||||
thismboff += thislen; /* we are this far into the mbuf */
|
||||
thismboff += thislen; /* we are this far into the
|
||||
* mbuf */
|
||||
resid -= thislen; /* and this much is left */
|
||||
goto nextbuf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Otherwise, there is exactly enough space to put this buffer's
|
||||
* contents into the current mbuf. Do the combination of the above
|
||||
|
@ -1160,7 +1191,6 @@ ie_readframe(sc, num)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef IEDEBUG
|
||||
if (sc->sc_debug & IED_READFRAME)
|
||||
printf("%s: frame from ether %s type %x\n", sc->sc_dev.dv_xname,
|
||||
|
@ -1174,7 +1204,6 @@ ie_readframe(sc, num)
|
|||
m_freem(last_not_for_us);
|
||||
last_not_for_us = 0;
|
||||
}
|
||||
|
||||
#if NBPFILTER > 0
|
||||
/*
|
||||
* Check for a BPF filter; if so, hand it up.
|
||||
|
@ -1238,7 +1267,6 @@ ie_readframe(sc, num)
|
|||
iereset(sc);
|
||||
return;
|
||||
}
|
||||
|
||||
i = sc->rbuffs[sc->rbhead]->ie_rbd_actual & IE_RBD_LAST;
|
||||
|
||||
sc->rbuffs[sc->rbhead]->ie_rbd_length |= IE_RBD_LAST;
|
||||
|
@ -1249,7 +1277,6 @@ ie_readframe(sc, num)
|
|||
} while (!i);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Start transmission on an interface.
|
||||
*/
|
||||
|
@ -1261,7 +1288,8 @@ ie_readframe(sc, num)
|
|||
struct mbuf *m0, *m;
|
||||
u_char *buffer;
|
||||
u_short len;
|
||||
/* This is not really volatile, in this routine, but it makes gcc happy. */
|
||||
/* This is not really volatile, in this routine, but it makes gcc
|
||||
* happy. */
|
||||
volatile u_short *bptr = &sc->scb->ie_command_list;
|
||||
|
||||
if ((ifp->if_flags ^ IFF_RUNNING) & (IFF_RUNNING | IFF_OACTIVE))
|
||||
|
@ -1290,7 +1318,8 @@ ie_readframe(sc, num)
|
|||
* before we commit it to the wire.
|
||||
*/
|
||||
if (sc->sc_arpcom.ac_if.if_bpf)
|
||||
bpf_tap(sc->sc_arpcom.ac_if.if_bpf, sc->xmit_cbuffs[sc->xmit_count],
|
||||
bpf_tap(sc->sc_arpcom.ac_if.if_bpf,
|
||||
sc->xmit_cbuffs[sc->xmit_count],
|
||||
len);
|
||||
#endif
|
||||
|
||||
|
@ -1329,11 +1358,9 @@ ie_readframe(sc, num)
|
|||
/*
|
||||
* set up IE's ram space
|
||||
*/
|
||||
|
||||
int ie_setupram(sc)
|
||||
|
||||
int
|
||||
ie_setupram(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
volatile struct ie_sys_conf_ptr *scp;
|
||||
volatile struct ie_int_sys_conf_ptr *iscp;
|
||||
|
@ -1367,7 +1394,6 @@ struct ie_softc *sc;
|
|||
splx(s);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Acknowledge any interrupts we may have caused...
|
||||
*/
|
||||
|
@ -1473,8 +1499,7 @@ command_and_wait(sc, cmd, pcmd, mask)
|
|||
*/
|
||||
(sc->chan_attn) (sc);
|
||||
|
||||
while (scb->ie_command)
|
||||
; /* spin lock */
|
||||
while (scb->ie_command); /* spin lock */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1483,11 +1508,10 @@ command_and_wait(sc, cmd, pcmd, mask)
|
|||
/*
|
||||
* Run the time-domain reflectometer...
|
||||
*/
|
||||
static void run_tdr(sc, cmd)
|
||||
|
||||
static void
|
||||
run_tdr(sc, cmd)
|
||||
struct ie_softc *sc;
|
||||
struct ie_tdr_cmd *cmd;
|
||||
|
||||
{
|
||||
int result;
|
||||
|
||||
|
@ -1552,11 +1576,9 @@ start_receiver(sc)
|
|||
* note: this function was written to be easy to understand, rather than
|
||||
* highly efficient (it isn't in the critical path).
|
||||
*/
|
||||
|
||||
static void setup_bufs(sc)
|
||||
|
||||
static void
|
||||
setup_bufs(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
caddr_t ptr = sc->buf_area; /* memory pool */
|
||||
volatile struct ie_recv_frame_desc *rfd = (void *) ptr;
|
||||
|
@ -1567,7 +1589,6 @@ static void setup_bufs(sc)
|
|||
* step 0: zero memory and figure out how many recv buffers and
|
||||
* frames we can have. XXX CURRENTLY HARDWIRED AT MAX
|
||||
*/
|
||||
|
||||
wzero(ptr, sc->buf_area_sz);
|
||||
ptr = Align(ptr); /* set alignment and stick with it */
|
||||
|
||||
|
@ -1585,7 +1606,8 @@ static void setup_bufs(sc)
|
|||
sc->nframes = n / r;
|
||||
if (sc->nframes <= 0)
|
||||
panic("ie: bogus buffer calc\n");
|
||||
if (sc->nframes > MXFRAMES) sc->nframes = MXFRAMES;
|
||||
if (sc->nframes > MXFRAMES)
|
||||
sc->nframes = MXFRAMES;
|
||||
|
||||
sc->nrxbuf = sc->nframes * B_PER_F;
|
||||
|
||||
|
@ -1596,7 +1618,6 @@ static void setup_bufs(sc)
|
|||
/*
|
||||
* step 1a: lay out and zero frame data structures for transmit and recv
|
||||
*/
|
||||
|
||||
for (n = 0; n < NTXBUF; n++) {
|
||||
sc->xmit_cmds[n] = (volatile struct ie_xmit_cmd *) ptr;
|
||||
ptr = Align(ptr + sizeof(struct ie_xmit_cmd));
|
||||
|
@ -1610,7 +1631,6 @@ static void setup_bufs(sc)
|
|||
/*
|
||||
* step 1b: link together the recv frames and set EOL on last one
|
||||
*/
|
||||
|
||||
for (n = 0; n < sc->nframes; n++) {
|
||||
sc->rframes[n]->ie_fd_next =
|
||||
MK_16(MEM, sc->rframes[(n + 1) % sc->nframes]);
|
||||
|
@ -1620,7 +1640,6 @@ static void setup_bufs(sc)
|
|||
/*
|
||||
* step 2a: lay out and zero frame buffer structures for xmit and recv
|
||||
*/
|
||||
|
||||
for (n = 0; n < NTXBUF; n++) {
|
||||
sc->xmit_buffs[n] = (volatile struct ie_xmit_buf *) ptr;
|
||||
ptr = Align(ptr + sizeof(struct ie_xmit_buf));
|
||||
|
@ -1634,7 +1653,6 @@ static void setup_bufs(sc)
|
|||
/*
|
||||
* step 2b: link together recv bufs and set EOL on last one
|
||||
*/
|
||||
|
||||
for (n = 0; n < sc->nrxbuf; n++) {
|
||||
sc->rbuffs[n]->ie_rbd_next =
|
||||
MK_16(MEM, sc->rbuffs[(n + 1) % sc->nrxbuf]);
|
||||
|
@ -1645,7 +1663,6 @@ static void setup_bufs(sc)
|
|||
* step 3: allocate the actual data buffers for xmit and recv
|
||||
* recv buffer gets linked into recv_buf_desc list here
|
||||
*/
|
||||
|
||||
for (n = 0; n < NTXBUF; n++) {
|
||||
sc->xmit_cbuffs[n] = (u_char *) ptr;
|
||||
ptr = Align(ptr + IE_TBUF_SIZE);
|
||||
|
@ -1677,7 +1694,6 @@ static void setup_bufs(sc)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Run the multicast setup command.
|
||||
* Called at splimp().
|
||||
|
@ -1716,10 +1732,9 @@ mc_setup(sc, ptr)
|
|||
*
|
||||
* THIS ROUTINE MUST BE CALLED AT splimp() OR HIGHER.
|
||||
*/
|
||||
int ieinit(sc)
|
||||
|
||||
int
|
||||
ieinit(sc)
|
||||
struct ie_softc *sc;
|
||||
|
||||
{
|
||||
volatile struct ie_sys_ctl_block *scb = sc->scb;
|
||||
caddr_t ptr;
|
||||
|
@ -1742,7 +1757,8 @@ int ieinit(sc)
|
|||
|
||||
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
|
||||
!(cmd->com.ie_cmd_status & IE_STAT_OK)) {
|
||||
printf("%s: configure command failed\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: configure command failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1938,7 +1954,6 @@ mc_reset(sc)
|
|||
ieioctl(&sc->sc_arpcom.ac_if, SIOCSIFFLAGS, (void *) 0);
|
||||
goto setflag;
|
||||
}
|
||||
|
||||
bcopy(enm->enm_addrlo, &sc->mcast_addrs[sc->mcast_count], 6);
|
||||
sc->mcast_count++;
|
||||
ETHER_NEXT_MULTI(step, enm);
|
||||
|
@ -1960,16 +1975,13 @@ print_rbd(rbd)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* ugly copy routines for debugging
|
||||
*/
|
||||
|
||||
wzero(b, l)
|
||||
|
||||
char *b;
|
||||
int l;
|
||||
|
||||
{
|
||||
while (l > 0) {
|
||||
*b++ = 0;
|
||||
|
@ -1978,19 +1990,12 @@ wzero(b, l)
|
|||
}
|
||||
|
||||
wcopy(b1, b2, l)
|
||||
|
||||
char *b1, *b2;
|
||||
int l;
|
||||
|
||||
{
|
||||
while (l > 0) {
|
||||
*b2++ = *b1++;
|
||||
l--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
/*
|
||||
* PART 1: VME/multibus defs
|
||||
*/
|
||||
|
||||
#define IEVME_PAGESIZE 1024 /* bytes */
|
||||
#define IEVME_PAGSHIFT 10 /* bits */
|
||||
#define IEVME_NPAGES 256 /* number of pages on chip */
|
||||
|
@ -97,7 +96,6 @@
|
|||
/*
|
||||
* PTE for the page map
|
||||
*/
|
||||
|
||||
#define IEVME_SBORDR 0x8000 /* sun byte order */
|
||||
#define IEVME_IBORDR 0x0000 /* intel byte ordr */
|
||||
|
||||
|
@ -118,7 +116,6 @@ struct ievme {
|
|||
/*
|
||||
* status bits
|
||||
*/
|
||||
|
||||
#define IEVME_RESET 0x8000 /* reset board */
|
||||
#define IEVME_ONAIR 0x4000 /* go out of loopback 'on-air' */
|
||||
#define IEVME_ATTEN 0x2000 /* attention */
|
||||
|
@ -133,7 +130,6 @@ struct ievme {
|
|||
/*
|
||||
* parity control
|
||||
*/
|
||||
|
||||
#define IEVME_PARACK 0x0100 /* parity error ack */
|
||||
#define IEVME_PARSRC 0x0080 /* parity error source */
|
||||
#define IEVME_PAREND 0x0040 /* which end of the data got the error */
|
||||
|
@ -143,11 +139,9 @@ struct ievme {
|
|||
/*
|
||||
* PART 2: the on-board interface
|
||||
*/
|
||||
|
||||
struct ieob {
|
||||
u_char obctrl;
|
||||
};
|
||||
|
||||
#define IEOB_NORSET 0x80 /* don't reset the board */
|
||||
#define IEOB_ONAIR 0x40 /* put us on the air */
|
||||
#define IEOB_ATTEN 0x20 /* attention! */
|
||||
|
@ -164,4 +158,3 @@ struct ieob {
|
|||
/*
|
||||
* not supported (yet?)
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue