diff options
-rw-r--r-- | sys/dev/ic/i82596.c | 43 | ||||
-rw-r--r-- | sys/dev/ic/i82596reg.h | 6 | ||||
-rw-r--r-- | sys/dev/ic/i82596var.h | 6 |
3 files changed, 12 insertions, 43 deletions
diff --git a/sys/dev/ic/i82596.c b/sys/dev/ic/i82596.c index f0806f7351b..046b58befbf 100644 --- a/sys/dev/ic/i82596.c +++ b/sys/dev/ic/i82596.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596.c,v 1.13 2002/10/09 23:43:11 krw Exp $ */ +/* $OpenBSD: i82596.c,v 1.14 2002/10/13 14:21:49 mickey Exp $ */ /* $NetBSD: i82586.c,v 1.18 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -177,15 +177,6 @@ Mode of operation: #include <dev/ic/i82596reg.h> #include <dev/ic/i82596var.h> -/* So far only hppa, but in case other archs */ -#ifdef MD_CACHE_CTL -#define FLUSH(addr,size) MD_CACHE_CTL((vaddr_t)addr,size,MD_CACHE_FLUSH) -#define PURGE(addr,size) MD_CACHE_CTL((vaddr_t)addr,size,MD_CACHE_PURGE) -#else -#define FLUSH(addr,size) -#define PURGE(addr,size) -#endif - void i82596_reset(struct ie_softc *, int); void i82596_watchdog(struct ifnet *); int i82596_init(struct ie_softc *); @@ -245,10 +236,8 @@ i82596_probe(sc) (sc->ie_bus_write24)(sc, IE_SCP_ISCP(sc->scp), sc->sc_maddr); (sc->ie_bus_write16)(sc, IE_SCP_BUS_USE(sc->scp), sc->sysbus); - FLUSH(sc->sc_maddr, sc->sc_msize); (sc->hwreset)(sc, IE_CARD_RESET); - PURGE(sc->sc_maddr, sc->sc_msize); if ((sc->ie_bus_read16)(sc, IE_ISCP_BUSY(sc->iscp))) { #ifdef I82596_DEBUG printf ("%s: ISCP set failed\n", sc->sc_dev.dv_xname); @@ -259,12 +248,11 @@ i82596_probe(sc) if (sc->port) { (sc->ie_bus_write24)(sc, sc->scp, 0); (sc->ie_bus_write24)(sc, IE_SCP_TEST(sc->scp), -1); - FLUSH(sc->sc_maddr, sc->sc_msize); (sc->port)(sc, IE_PORT_TEST); for (i = 9000; i-- && (sc->ie_bus_read16)(sc, IE_SCP_TEST(sc->scp)); DELAY(100)) - PURGE(sc->sc_maddr, sc->sc_msize); + ; #ifdef I82596_DEBUG printf ("%s: test %x:%x\n", sc->sc_dev.dv_xname, @@ -314,9 +302,7 @@ i82596_attach(sc, name, etheraddr, media, nmedia, defmedia) (sc->ie_bus_write24)(sc, IE_ISCP_BASE(sc->iscp), sc->sc_maddr); (sc->ie_bus_write24)(sc, IE_SCP_ISCP(sc->scp), sc->sc_maddr +sc->iscp); (sc->ie_bus_write16)(sc, IE_SCP_BUS_USE(sc->scp), sc->sysbus); - FLUSH(sc->sc_maddr, sc->sc_msize); (sc->hwreset)(sc, IE_CARD_RESET); - PURGE(sc->sc_maddr, sc->sc_msize); /* Setup Iface */ bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); @@ -380,7 +366,6 @@ i82596_cmd_wait(sc) off = IE_SCB_CMD(sc->scb); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); - PURGE(sc->sc_maddr, sc->sc_msize); if ((sc->ie_bus_read16)(sc, off) == 0) { #ifdef I82596_DEBUG1 if (sc->sc_debug & IED_CMDS) @@ -395,7 +380,6 @@ i82596_cmd_wait(sc) printf ("i82596_cmd_wait: timo(%ssync): scb status: %b\n", sc->async_cmd_inprogress?"a":"", sc->ie_bus_read16(sc, off), IE_STAT_BITS); - PURGE(sc->sc_maddr, sc->sc_msize); return (1); /* Timeout */ } @@ -436,7 +420,6 @@ i82596_start_cmd(sc, cmd, iecmdbuf, mask, async) off = IE_SCB_CMD(sc->scb); (sc->ie_bus_write16)(sc, off, cmd); - FLUSH(sc->bh + off, 2); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_WRITE); (sc->chan_attn)(sc); @@ -456,7 +439,6 @@ i82596_start_cmd(sc, cmd, iecmdbuf, mask, async) for (i = 0; i < 36900; i++) { /* Read the command status */ off = IE_CMD_COMMON_STATUS(iecmdbuf); - PURGE(sc->bh + off, 2); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); status = (sc->ie_bus_read16)(sc, off); @@ -502,7 +484,6 @@ i82596_count_errors(struct ie_softc *sc) sc->ie_bus_write16(sc, IE_SCB_ERRALN(scb), 0); sc->ie_bus_write16(sc, IE_SCB_ERRRES(scb), 0); sc->ie_bus_write16(sc, IE_SCB_ERROVR(scb), 0); - FLUSH(sc->bh + sc->scb, IE_SCB_SZ); } static __inline void @@ -524,7 +505,6 @@ i82596_intr(v) register int off; off = IE_SCB_STATUS(sc->scb); - PURGE(sc->bh + off, 2); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); status = sc->ie_bus_read16(sc, off) /* & IE_ST_WHENCE */; @@ -573,7 +553,6 @@ loop: if (i82596_cmd_wait(sc)) goto out; - PURGE(sc->bh + off, 2); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); status = sc->ie_bus_read16(sc, off); if ((status & IE_ST_WHENCE) != 0) @@ -613,7 +592,6 @@ i82596_rint(sc, scbstatus) i = sc->rfhead; off = IE_RFRAME_STATUS(sc->rframes, i); - PURGE(sc->bh + off, 2); bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); status = sc->ie_bus_read16(sc, off); @@ -660,7 +638,6 @@ i82596_rint(sc, scbstatus) /* Clear frame status */ sc->ie_bus_write16(sc, off, 0); - PURGE(sc->bh + off, 2); /* Put fence at this frame (the head) */ off = IE_RFRAME_LAST(sc->rframes, i); @@ -673,7 +650,6 @@ i82596_rint(sc, scbstatus) /* Remove fence from current tail */ off = IE_RFRAME_LAST(sc->rframes, sc->rftail); sc->ie_bus_write16(sc, off, 0); - PURGE(sc->bh + off, 2); if (++sc->rftail == sc->nframes) sc->rftail = 0; @@ -776,7 +752,6 @@ i82596_tint(sc, scbstatus) off = IE_CMD_XMIT_STATUS(sc->xmit_cmds, sc->xctail); status = sc->ie_bus_read16(sc, off); - PURGE(sc->bh + off, 2); #ifdef I82596_DEBUG if (sc->sc_debug & IED_TINT) @@ -860,7 +835,6 @@ i82596_get_rbd_list(sc, start, end, pktlen) bus_space_barrier(sc->bt, sc->bh, off, 2, BUS_SPACE_BARRIER_READ); rbdstatus = sc->ie_bus_read16(sc, off); - PURGE(sc->bh + off, 2); if ((rbdstatus & IE_RBD_USED) == 0) { /* * This means we are somehow out of sync. So, we @@ -911,12 +885,10 @@ i82596_release_rbd_list(sc, start, end) rbindex = ((rbindex == 0) ? sc->nrxbuf : rbindex) - 1; off = IE_RBD_BUFLEN(rbbase, rbindex); sc->ie_bus_write16(sc, off, IE_RBUF_SIZE|IE_RBD_EOL); - FLUSH(sc->bh + off, 2); /* Remove EOL from current tail */ off = IE_RBD_BUFLEN(rbbase, sc->rbtail); sc->ie_bus_write16(sc, off, IE_RBUF_SIZE); - FLUSH(sc->bh + off, 2); /* New head & tail pointer */ /* hmm, why have both? head is always (tail + 1) % NRXBUF */ @@ -961,7 +933,6 @@ i82596_chk_rx_ring(sc) for (n = 0; n < sc->nrxbuf; n++) { off = IE_RBD_BUFLEN(sc->rbds, n); val = sc->ie_bus_read16(sc, off); - PURGE(sc->bh + off, 2); if ((n == sc->rbtail) ^ ((val & IE_RBD_EOL) != 0)) { /* `rbtail' and EOL flag out of sync */ log(LOG_ERR, @@ -976,7 +947,6 @@ i82596_chk_rx_ring(sc) for (n = 0; n < sc->nframes; n++) { off = IE_RFRAME_LAST(sc->rframes, n); val = sc->ie_bus_read16(sc, off); - PURGE(sc->bh + off, 2); if ((n == sc->rftail) ^ ((val & (IE_FD_EOL|IE_FD_SUSP)) != 0)) { /* `rftail' and EOL flag out of sync */ log(LOG_ERR, @@ -1082,7 +1052,6 @@ i82596_get(struct ie_softc *sc, int head, int totlen) off = IE_RBUF_ADDR(sc,head) + thisrboff; (sc->memcopyin)(sc, mtod(m, caddr_t) + thismboff, off, len); resid -= len; - PURGE(sc->bh + off, len); if (len == thismblen) { m = m->m_next; @@ -1495,7 +1464,7 @@ i82596_setup_bufs(sc) struct ie_softc *sc; { int n, r, ptr = sc->buf_area; /* memory pool */ - int cl = 16; + int cl = 32; /* * step 0: zero memory and figure out how many recv buffers and @@ -1532,11 +1501,11 @@ i82596_setup_bufs(sc) n = sc->buf_area_sz - (ptr - sc->buf_area); /* Compute size of one RECV frame */ - r = 48 + ((32 + IE_RBUF_SIZE) * B_PER_F); + r = 64 + ((32 + IE_RBUF_SIZE) * B_PER_F); sc->nframes = n / r; - if (sc->nframes <= 0) + if (sc->nframes <= 8) panic("ie: bogus buffer calc"); sc->nrxbuf = sc->nframes * B_PER_F; @@ -1544,7 +1513,7 @@ i82596_setup_bufs(sc) /* The receice frame descriptors */ ptr += cl; sc->rframes = ptr - 2; - ptr += sc->nframes * 48; + ptr += sc->nframes * 64; /* The receive buffer descriptors */ ptr += cl; diff --git a/sys/dev/ic/i82596reg.h b/sys/dev/ic/i82596reg.h index e965914cea1..0b2d80476cb 100644 --- a/sys/dev/ic/i82596reg.h +++ b/sys/dev/ic/i82596reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596reg.h,v 1.3 2001/03/23 00:16:49 mickey Exp $ */ +/* $OpenBSD: i82596reg.h,v 1.4 2002/10/13 14:21:49 mickey Exp $ */ /* $NetBSD: i82586reg.h,v 1.7 1998/02/28 01:07:45 pk Exp $ */ /*- @@ -219,7 +219,7 @@ struct __ie_recv_frame_desc { }; */ #define IE_RFRAME_SZ 24 -#define IE_RFRAME_ADDR(base,i) ((base) + (i) * 48) +#define IE_RFRAME_ADDR(base,i) ((base) + (i) * 64) #define IE_RFRAME_STATUS(b,i) (IE_RFRAME_ADDR(b,i) + 0) #define IE_RFRAME_LAST(b,i) (IE_RFRAME_ADDR(b,i) + 2) #define IE_RFRAME_NEXT(b,i) (IE_RFRAME_ADDR(b,i) + 4) @@ -381,7 +381,7 @@ struct __ie_mcast_cmd { #define ie_mcast_status com.ie_cmd_status // size (in bytes) of multicast addresses - u_short ie_mcast_bytes; + u_int16_t ie_mcast_bytes; struct __ie_en_addr ie_mcast_addrs[IE_MAXMCAST + 1];// space for them }; */ diff --git a/sys/dev/ic/i82596var.h b/sys/dev/ic/i82596var.h index 053ae043b8a..f8a84489e48 100644 --- a/sys/dev/ic/i82596var.h +++ b/sys/dev/ic/i82596var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: i82596var.h,v 1.8 2002/09/23 06:11:50 mickey Exp $ */ +/* $OpenBSD: i82596var.h,v 1.9 2002/10/13 14:21:49 mickey Exp $ */ /* $NetBSD: i82586var.h,v 1.10 1998/08/15 04:42:42 mycroft Exp $ */ /*- @@ -111,10 +111,10 @@ #define IED_CMDS 0x80 #define IED_ALL 0xff -#define B_PER_F 3 /* recv buffers per frame */ +#define B_PER_F 6 /* recv buffers per frame */ #define IE_RBUF_SIZE 256 /* size of each receive buffer; MUST BE POWER OF TWO */ -#define NTXBUF 2 /* number of transmit commands */ +#define NTXBUF 4 /* number of transmit commands */ #define IE_TBUF_SIZE ETHER_MAX_LEN /* length of transmit buffer */ #define IE_MAXMCAST (IE_TBUF_SIZE/6)/* must fit in transmit buffer */ |