summaryrefslogtreecommitdiff
path: root/sys/arch/arc/dev/if_sn.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/arc/dev/if_sn.c')
-rw-r--r--sys/arch/arc/dev/if_sn.c71
1 files changed, 14 insertions, 57 deletions
diff --git a/sys/arch/arc/dev/if_sn.c b/sys/arch/arc/dev/if_sn.c
index 02fc28a0ee3..1b2ad7c7084 100644
--- a/sys/arch/arc/dev/if_sn.c
+++ b/sys/arch/arc/dev/if_sn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sn.c,v 1.8 1997/03/12 19:16:50 pefo Exp $ */
+/* $OpenBSD: if_sn.c,v 1.9 1997/04/19 17:19:52 pefo Exp $ */
/*
* National Semiconductor SONIC Driver
* Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk)
@@ -12,6 +12,8 @@
#include "sn.h"
#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/buf.h>
@@ -52,6 +54,7 @@ typedef unsigned char uchar;
#define SWR(a, x) (a) = (x)
#define SRD(a) ((a) & 0xffff)
+#include <machine/pte.h>
#include <machine/cpu.h>
/*
@@ -128,41 +131,6 @@ struct cfdriver sn_cd = {
#endif
#endif
-void
-m_check(m)
- struct mbuf *m;
-{
- if (m->m_flags & M_EXT) {
- assert(m->m_len >= 0);
- assert(m->m_len <= m->m_ext.ext_size);
- assert(m->m_data >= &m->m_ext.ext_buf[0]);
- assert(m->m_data <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
- assert(m->m_data + m->m_len <= &m->m_ext.ext_buf[m->m_ext.ext_size]);
- } else if (m->m_flags & M_PKTHDR) {
- assert(m->m_len >= 0);
- assert(m->m_len <= MHLEN);
- assert(m->m_data >= m->m_pktdat);
- assert(m->m_data <= &m->m_pktdat[MHLEN]);
- assert(m->m_data + m->m_len <= &m->m_pktdat[MHLEN]);
- } else {
- assert(m->m_len >= 0);
- assert(m->m_len <= MLEN);
- assert(m->m_data >= m->m_dat);
- assert(m->m_data <= &m->m_dat[MLEN]);
- assert(m->m_data + m->m_len <= &m->m_dat[MLEN]);
- }
-}
-
-void
-m_checkm(m)
- struct mbuf *m;
-{
- while (m) {
- m_check(m);
- m = m->m_next;
- }
-}
-
int ethdebug = 0;
int snintr __P((struct sn_softc *));
@@ -260,7 +228,6 @@ snmatch(parent, match, aux)
struct device *parent;
void *match, *aux;
{
- struct cfdata *cf = match;
struct confargs *ca = aux;
/* XXX CHECK BUS */
@@ -284,7 +251,6 @@ snattach(parent, self, aux)
struct sn_softc *sc = (void *)self;
struct confargs *ca = aux;
struct ifnet *ifp = &sc->sc_if;
- struct cfdata *cf = sc->sc_dev.dv_cfdata;
int p, pp;
sc->sc_csr = (struct sonic_reg *)BUS_CVTADDR(ca);
@@ -455,7 +421,6 @@ snstart(ifp)
{
struct sn_softc *sc = ifp->if_softc;
struct mbuf *m;
- int len;
if ((sc->sc_if.if_flags & IFF_RUNNING) == 0)
return;
@@ -512,7 +477,7 @@ sninit(sc)
struct sn_softc *sc;
{
struct sonic_reg *csr = sc->sc_csr;
- int s, error;
+ int s;
if (sc->sc_if.if_flags & IFF_RUNNING)
/* already running */
@@ -523,8 +488,8 @@ sninit(sc)
csr->s_cr = CR_RST; /* s_dcr only accessable reset mode! */
/* config it */
- csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 | DCR_DMABLOCK |
- DCR_RFT16 | DCR_TFT16;
+ csr->s_dcr = DCR_LBR | DCR_SYNC | DCR_WAIT0 | DCR_DW32 |
+ DCR_RFT4 | DCR_TFT28; /*XXX RFT & TFT according to MIPS manual */
csr->s_rcr = RCR_BRD | RCR_LBNONE;
csr->s_imr = IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_HBLEN | IMR_LCDEN;
@@ -564,10 +529,6 @@ sninit(sc)
splx(s);
return (0);
-
-bad:
- snstop(sc);
- return (error);
}
/*
@@ -589,7 +550,7 @@ snstop(sc)
/* free all receive buffers (currently static so nothing to do) */
/* free all pending transmit mbufs */
- while (mtd = mtdhead) {
+ while ((mtd = mtdhead)) {
mtdhead = mtdhead->mtd_link;
if (mtd->mtd_mbuf)
m_freem(mtd->mtd_mbuf);
@@ -643,7 +604,6 @@ sonicput(sc, m0)
struct mtd *mtdnew;
struct mbuf *m;
int len = 0, fr = 0;
- int i;
int fragoffset; /* Offset in viritual dma space for fragment */
/* grab the replacement mtd */
@@ -761,10 +721,9 @@ int
sngetaddr(sc)
struct sn_softc *sc;
{
- unsigned i, x, y;
- char *cp, *ea;
-
#if 0
+ int i;
+
sc->sc_csr->s_cr = CR_RST;
wbflush();
sc->sc_csr->s_cep = 0;
@@ -851,7 +810,6 @@ camprogram(sc)
{
struct sonic_reg *csr;
int timeout;
- int i;
csr = sc->sc_csr;
csr->s_cdp = LOWER(v_cda);
@@ -989,7 +947,7 @@ snintr(sc)
struct sonic_reg *csr = sc->sc_csr;
int isr;
- while (isr = (csr->s_isr & ISR_ALL)) {
+ while ((isr = (csr->s_isr & ISR_ALL))) {
/* scrub the interrupts that we are going to service */
csr->s_isr = isr;
wbflush();
@@ -1045,7 +1003,7 @@ sonictxint(sc)
csr = sc->sc_csr;
- while (mtd = mtdhead) {
+ while ((mtd = mtdhead)) {
struct mbuf *m = mtd->mtd_mbuf;
if (m == 0)
@@ -1111,7 +1069,6 @@ sonicrxint(sc)
{
struct sonic_reg *csr = sc->sc_csr;
struct RXpkt *rxp;
- u_long addr;
int orra;
rxp = &p_rda[sc->sc_rxmark];
@@ -1188,7 +1145,7 @@ sonic_read(sc, rxp)
/*extern char *ether_sprintf();*/
struct ether_header *et;
struct mbuf *m;
- int len, off, i;
+ int len;
caddr_t pkt;
/*
@@ -1228,7 +1185,7 @@ sonic_read(sc, rxp)
(et->ether_dhost[0] & 1) == 0 && /* !mcast and !bcast */
bcmp(et->ether_dhost, sc->sc_enaddr,
sizeof(et->ether_dhost)) != 0)
- return;
+ return(0);
}
#endif
m = sonic_get(sc, et, len);