More cleanup of MI mb86960 driver:

- Add support for byte system bus mode. Based on patch in kern/17193 by
  Christian Groessler, with some improvements by me.
- Rename sc_flags in mb86960_softc to sc_stat, rename "type" to sc_flags
  to specify controller quirks and remove enum mb86960_type.
- Pass controller type via new sc_flags in mb86960_softc rather than
  via an mb86960_attach() arg.
- Handle unaligned mbufs properly in mb86960_write_mbufs(). (from ne2000.c)
- Fix a signed/unsigned comparision warning.
- Add definitions of status bits in the RX packed header.
- Change types of some members in mb86960_softc.
This commit is contained in:
tsutsui 2002-11-30 14:15:10 +00:00
parent 4b413dd039
commit 9604e7689d
7 changed files with 211 additions and 158 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fmv.c,v 1.2 2002/10/05 17:52:31 tsutsui Exp $ */
/* $NetBSD: fmv.c,v 1.3 2002/11/30 14:15:11 tsutsui Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fmv.c,v 1.2 2002/10/05 17:52:31 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: fmv.c,v 1.3 2002/11/30 14:15:11 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -145,7 +145,7 @@ fmv_attach(sc)
printf(": %s Ethernet\n", typestr);
/* This interface is always enabled. */
sc->sc_flags |= FE_FLAGS_ENABLED;
sc->sc_stat |= FE_STAT_ENABLED;
/*
* Minimum initialization of the hardware.
@ -163,7 +163,7 @@ fmv_attach(sc)
/*
* Do generic MB86960 attach.
*/
mb86960_attach(sc, MB86960_TYPE_86965, myea);
mb86960_attach(sc, myea);
/* Is this really needs to be done here? XXX */
/* Turn the "master interrupt control" flag of ASIC on. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86960.c,v 1.53 2002/10/04 15:22:29 tsutsui Exp $ */
/* $NetBSD: mb86960.c,v 1.54 2002/11/30 14:15:10 tsutsui Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.53 2002/10/04 15:22:29 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.54 2002/11/30 14:15:10 tsutsui Exp $");
/*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
@ -94,6 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: mb86960.c,v 1.53 2002/10/04 15:22:29 tsutsui Exp $")
#include <dev/ic/mb86960var.h>
#ifndef __BUS_SPACE_HAS_STREAM_METHODS
#define bus_space_write_stream_2 bus_space_write_2
#define bus_space_write_multi_stream_2 bus_space_write_multi_2
#define bus_space_read_multi_stream_2 bus_space_read_multi_2
#endif /* __BUS_SPACE_HAS_STREAM_METHODS */
@ -106,16 +107,16 @@ void mb86960_reset __P((struct mb86960_softc *));
void mb86960_watchdog __P((struct ifnet *));
/* Local functions. Order of declaration is confused. FIXME. */
int mb86960_get_packet __P((struct mb86960_softc *, int));
int mb86960_get_packet __P((struct mb86960_softc *, u_int));
void mb86960_stop __P((struct mb86960_softc *));
void mb86960_tint __P((struct mb86960_softc *, u_char));
void mb86960_rint __P((struct mb86960_softc *, u_char));
void mb86960_tint __P((struct mb86960_softc *, u_int8_t));
void mb86960_rint __P((struct mb86960_softc *, u_int8_t));
static __inline__
void mb86960_xmit __P((struct mb86960_softc *));
void mb86960_write_mbufs __P((struct mb86960_softc *, struct mbuf *));
static __inline__
void mb86960_droppacket __P((struct mb86960_softc *));
void mb86960_getmcaf __P((struct ethercom *, u_char *));
void mb86960_getmcaf __P((struct ethercom *, u_int8_t *));
void mb86960_setmode __P((struct mb86960_softc *));
void mb86960_loadmar __P((struct mb86960_softc *));
@ -127,41 +128,35 @@ void mb86960_dump __P((int, struct mb86960_softc *));
#endif
void
mb86960_attach(sc, type, myea)
mb86960_attach(sc, myea)
struct mb86960_softc *sc;
enum mb86960_type type;
u_int8_t *myea;
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
sc->type = type;
/* Register values which depend on board design. */
sc->proto_dlcr4 = FE_D4_LBC_DISABLE | FE_D4_CNTRL;
sc->proto_dlcr5 = 0;
sc->proto_dlcr7 = FE_D7_BYTSWP_LH;
if ((sc->sc_flags & FE_FLAGS_MB86960) != 0)
sc->proto_dlcr7 |= FE_D7_ED_TEST; /* XXX */
sc->proto_bmpr13 = FE_B13_TPTYPE_UTP | FE_B13_PORT_AUTO;
switch (sc->type) {
case MB86960_TYPE_86960:
sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_ED_TEST; /* XXX */
break;
case MB86960_TYPE_86965:
sc->proto_dlcr7 = FE_D7_BYTSWP_LH;
break;
}
/*
* Program the 86960 as follows:
* Program the 86960 as following defaults:
* SRAM: 32KB, 100ns, byte-wide access.
* Transmission buffer: 4KB x 2.
* System bus interface: 16 bits.
* We cannot change these values but TXBSIZE, because they
* are hard-wired on the board. Modifying TXBSIZE will affect
* These values except TXBSIZE should be modified as per
* sc_flags which is set in MD attachments, because they
* are hard-wired on the board. Modifying TXBSIZE will affect
* the driver performance.
*/
sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x4KB |
FE_D6_BBW_BYTE | FE_D6_SBW_WORD | FE_D6_SRAM_100ns;
if (sc->sc_flags & FE_FLAGS_SBW_BYTE)
sc->proto_dlcr6 &= ~FE_D6_SBW_WORD;
/*
* Minimum initialization of the hardware.
@ -220,7 +215,7 @@ mb86960_config(sc, media, nmedia, defmedia)
#if FE_SINGLE_TRANSMISSION
/* Override txb config to allocate minimum. */
sc->proto_dlcr6 &= ~FE_D6_TXBSIZ
sc->proto_dlcr6 &= ~FE_D6_TXBSIZ;
sc->proto_dlcr6 |= FE_D6_TXBSIZ_2x2KB;
#endif
@ -335,7 +330,7 @@ mb86960_config(sc, media, nmedia, defmedia)
#endif
/* The attach is successful. */
sc->sc_flags |= FE_FLAGS_ATTACHED;
sc->sc_stat |= FE_STAT_ATTACHED;
}
/*
@ -362,7 +357,7 @@ mb86960_mediastatus(ifp, ifmr)
{
struct mb86960_softc *sc = ifp->if_softc;
if ((sc->sc_flags & FE_FLAGS_ENABLED) == 0) {
if ((sc->sc_stat & FE_STAT_ENABLED) == 0) {
ifmr->ifm_active = IFM_ETHER | IFM_NONE;
ifmr->ifm_status = 0;
return;
@ -754,7 +749,7 @@ mb86960_start(ifp)
* buffer can hold 130 blocks of 62 bytes long...
*/
if (sc->txb_free <
(ETHER_MAX_LEN - ETHER_CRC_LEN) + FE_DATA_LEN_LEN) {
(ETHER_MAX_LEN - ETHER_CRC_LEN) + FE_TXLEN_SIZE) {
/* No room. */
goto indicate_active;
}
@ -823,7 +818,7 @@ indicate_active:
void
mb86960_tint(sc, tstat)
struct mb86960_softc *sc;
u_char tstat;
u_int8_t tstat;
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
@ -964,13 +959,12 @@ mb86960_tint(sc, tstat)
void
mb86960_rint(sc, rstat)
struct mb86960_softc *sc;
u_char rstat;
u_int8_t rstat;
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
struct ifnet *ifp = &sc->sc_ec.ec_if;
int len;
u_char status;
u_int status, len;
int i;
/*
@ -990,7 +984,7 @@ mb86960_rint(sc, rstat)
/*
* MB86960 has a flag indicating "receive queue empty."
* We just loop cheking the flag to pull out all received
* We just loop checking the flag to pull out all received
* packets.
*
* We limit the number of iterrations to avoid infinite loop.
@ -1004,12 +998,15 @@ mb86960_rint(sc, rstat)
break;
/*
* Extract A receive status byte.
* As our 86960 is in 16 bit bus access mode, we have to
* use inw() to get the status byte. The significant
* value is returned in lower 8 bits.
* Extract receive packet status from the receive
* packet header.
*/
status = (u_char)bus_space_read_2(bst, bsh, FE_BMPR8);
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
status = bus_space_read_1(bst, bsh, FE_BMPR8);
(void)bus_space_read_1(bst, bsh, FE_BMPR8);
} else
status = bus_space_read_2(bst, bsh, FE_BMPR8);
#if FE_DEBUG >= 4
log(LOG_INFO, "%s: receive status = %02x\n",
sc->sc_dev.dv_xname, status);
@ -1020,7 +1017,7 @@ mb86960_rint(sc, rstat)
* the packet, unless the interface is in promiscuous
* mode.
*/
if ((status & 0xF0) != 0x20) { /* XXXX ? */
if ((status & FE_RXSTAT_GOODPKT) == 0) {
if ((ifp->if_flags & IFF_PROMISC) == 0) {
ifp->if_ierrors++;
mb86960_droppacket(sc);
@ -1029,11 +1026,15 @@ mb86960_rint(sc, rstat)
}
/*
* Extract the packet length.
* Extract the packet length from the receive packet header.
* It is a sum of a header (14 bytes) and a payload.
* CRC has been stripped off by the 86960.
*/
len = bus_space_read_2(bst, bsh, FE_BMPR8);
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
len = bus_space_read_1(bst, bsh, FE_BMPR8);
len |= bus_space_read_1(bst, bsh, FE_BMPR8) << 8;
} else
len = bus_space_read_2(bst, bsh, FE_BMPR8);
/*
* MB86965 checks the packet length and drop big packet
@ -1074,7 +1075,7 @@ mb86960_rint(sc, rstat)
/*
* Go get a packet.
*/
if (!mb86960_get_packet(sc, len)) {
if (mb86960_get_packet(sc, len) == 0) {
/* Skip a packet, updating statistics. */
#if FE_DEBUG >= 2
log(LOG_WARNING,
@ -1108,9 +1109,9 @@ mb86960_intr(arg)
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
struct ifnet *ifp = &sc->sc_ec.ec_if;
u_char tstat, rstat;
u_int8_t tstat, rstat;
if ((sc->sc_flags & FE_FLAGS_ENABLED) == 0 ||
if ((sc->sc_stat & FE_STAT_ENABLED) == 0 ||
(sc->sc_dev.dv_flags & DVF_ACTIVE) == 0)
return (0);
@ -1282,7 +1283,7 @@ mb86960_ioctl(ifp, cmd, data)
case SIOCADDMULTI:
case SIOCDELMULTI:
if ((sc->sc_flags & FE_FLAGS_ENABLED) == 0) {
if ((sc->sc_stat & FE_STAT_ENABLED) == 0) {
error = EIO;
break;
}
@ -1324,7 +1325,7 @@ mb86960_ioctl(ifp, cmd, data)
int
mb86960_get_packet(sc, len)
struct mb86960_softc *sc;
int len;
u_int len;
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
@ -1348,7 +1349,7 @@ mb86960_get_packet(sc, len)
* least MINCLSIZE (208 bytes) to allocate a cluster. For a
* packet of a size between (MHLEN - 2) to (MINCLSIZE - 2),
* our code violates the rule...
* On the other hand, the current code is short, simle,
* On the other hand, the current code is short, simple,
* and fast, however. It does no harmful thing, just waists
* some memory. Any comments? FIXME.
*/
@ -1372,8 +1373,12 @@ mb86960_get_packet(sc, len)
m->m_len = len;
/* Get a packet. */
bus_space_read_multi_stream_2(bst, bsh, FE_BMPR8, mtod(m, u_int16_t *),
(len + 1) >> 1);
if (sc->sc_flags & FE_FLAGS_SBW_BYTE)
bus_space_read_multi_1(bst, bsh, FE_BMPR8,
mtod(m, u_int8_t *), len);
else
bus_space_read_multi_stream_2(bst, bsh, FE_BMPR8,
mtod(m, u_int16_t *), (len + 1) >> 1);
#if NBPFILTER > 0
/*
@ -1412,22 +1417,21 @@ mb86960_write_mbufs(sc, m)
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
u_char *data;
u_short savebyte; /* WARNING: Architecture dependent! */
int totlen, len, wantbyte;
int totlen, len;
#if FE_DEBUG >= 2
struct mbuf *mp;
#endif
/* XXX thorpej 960116 - quiet bogus compiler warning. */
savebyte = 0;
#if FE_DELAYED_PADDING
/* Do the "delayed padding." */
len = sc->txb_padding >> 1;
if (len > 0) {
while (--len >= 0)
bus_space_write_2(bst, bsh, FE_BMPR8, 0);
if (sc->txb_padding > 0) {
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
for (len = sc->txb_padding; len > 0; len--)
bus_space_write_1(bst, bsh, FE_BMPR8, 0);
} else {
for (len = sc->txb_padding >> 1; len > 0; len--)
bus_space_write_2(bst, bsh, FE_BMPR8, 0);
}
sc->txb_padding = 0;
}
#endif
@ -1473,15 +1477,22 @@ mb86960_write_mbufs(sc, m)
* packet in the transmission buffer, we can skip the
* padding process. It may gain performance slightly. FIXME.
*/
bus_space_write_2(bst, bsh, FE_BMPR8,
max(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN)));
len = max(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
bus_space_write_1(bst, bsh, FE_BMPR8, len);
bus_space_write_1(bst, bsh, FE_BMPR8, len >> 8);
} else {
bus_space_write_2(bst, bsh, FE_BMPR8, len);
/* roundup packet length since we will use word access */
totlen = (totlen + 1) & ~1;
}
/*
* Update buffer status now.
* Truncate the length up to an even number, since we use outw().
* Truncate the length up to an even number
* if the chip is set in SBW_WORD mode.
*/
totlen = (totlen + 1) & ~1;
sc->txb_free -= FE_DATA_LEN_LEN +
sc->txb_free -= FE_TXLEN_SIZE +
max(totlen, (ETHER_MIN_LEN - ETHER_CRC_LEN));
sc->txb_count++;
@ -1493,53 +1504,94 @@ mb86960_write_mbufs(sc, m)
/*
* Transfer the data from mbuf chain to the transmission buffer.
* MB86960 seems to require that data be transferred as words, and
* only words. So that we require some extra code to patch
* over odd-length mbufs.
* If the MB86960 is configured in word mode, data needs to be
* transferred as words, and only words.
* So that we require some extra code to patch over odd-length
* or unaligned mbufs.
*/
wantbyte = 0;
for (; m != 0; m = m->m_next) {
/* Ignore empty mbuf. */
len = m->m_len;
if (len == 0)
continue;
/* Find the actual data to send. */
data = mtod(m, caddr_t);
/* Finish the last byte. */
if (wantbyte) {
bus_space_write_2(bst, bsh, FE_BMPR8,
savebyte | (*data << 8));
data++;
len--;
wantbyte = 0;
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
/* It's simple in byte mode. */
for (; m != NULL; m = m->m_next) {
if (m->m_len) {
bus_space_write_multi_1(bst, bsh, FE_BMPR8,
mtod(m, u_int8_t *), m->m_len);
}
}
} else {
/* a bit trickier in word mode. */
u_int8_t *data, savebyte[2];
int leftover;
/* Output contiguous words. */
if (len > 1)
bus_space_write_multi_stream_2(bst, bsh, FE_BMPR8,
(u_int16_t *)data, len >> 1);
leftover = 0;
savebyte[0] = savebyte[1] = 0;
/* Save remaining byte, if there is one. */
if (len & 1) {
data += len & ~1;
savebyte = *data;
wantbyte = 1;
for (; m != NULL; m = m->m_next) {
len = m->m_len;
if (len == 0)
continue;
data = mtod(m, u_int8_t *);
while (len > 0) {
if (leftover) {
/*
* Data left over (from mbuf or
* realignment). Buffer the next
* byte, and write it and the
* leftover data out.
*/
savebyte[1] = *data++;
len--;
bus_space_write_stream_2(bst, bsh,
FE_BMPR8, *(u_int16_t *)savebyte);
leftover = 0;
} else if (BUS_SPACE_ALIGNED_POINTER(data,
u_int16_t) == 0) {
/*
* Unaligned data; buffer the next byte.
*/
savebyte[0] = *data++;
len--;
leftover = 1;
} else {
/*
* Aligned data; output contiguous
* words as much as we can, then
* buffer the remaining byte, if any.
*/
leftover = len & 1;
len &= ~1;
bus_space_write_multi_stream_2(bst, bsh,
FE_BMPR8, (u_int16_t *)data,
len >> 1);
data += len;
if (leftover)
savebyte[0] = *data++;
len = 0;
}
}
if (len < 0)
panic("mb86960_write_mbufs: negative len");
}
if (leftover) {
savebyte[1] = 0;
bus_space_write_stream_2(bst, bsh, FE_BMPR8,
*(u_int16_t *)savebyte);
}
}
/* Spit the last byte, if the length is odd. */
if (wantbyte)
bus_space_write_2(bst, bsh, FE_BMPR8, savebyte);
#if ! FE_DELAYED_PADDING
#if FE_DELAYED_PADDING == 0
/*
* Pad the packet to the minimum length if necessary.
*/
len = ((ETHER_MIN_LEN - ETHER_CRC_LEN) >> 1) - (totlen >> 1);
while (--len >= 0)
bus_space_write_2(bst, bsh, FE_BMPR8, 0);
len = (ETHER_MIN_LEN - ETHER_CRC_LEN) - totlen;
if (len > 0) {
if (sc->sc_flags & FE_FLAGS_SBW_BYTE) {
while (len-- > 0)
bus_space_write_1(bst, bsh, FE_BMPR8, 0);
} else {
len >>= 1;
while (len-- > 0)
bus_space_write_2(bst, bsh, FE_BMPR8, 0);
}
}
#endif
}
@ -1550,7 +1602,7 @@ mb86960_write_mbufs(sc, m)
void
mb86960_getmcaf(ec, af)
struct ethercom *ec;
u_char *af;
u_int8_t *af;
{
struct ifnet *ifp = &ec->ec_if;
struct ether_multi *enm;
@ -1568,7 +1620,7 @@ mb86960_getmcaf(ec, af)
if ((ifp->if_flags & IFF_PROMISC) != 0)
goto allmulti;
af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0x00;
memset(af, 0, FE_FILTER_LEN);
ETHER_FIRST_MULTI(step, ec, enm);
while (enm != NULL) {
if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
@ -1599,7 +1651,7 @@ mb86960_getmcaf(ec, af)
allmulti:
ifp->if_flags |= IFF_ALLMULTI;
af[0] = af[1] = af[2] = af[3] = af[4] = af[5] = af[6] = af[7] = 0xff;
memset(af, 0xff, FE_FILTER_LEN);
}
/*
@ -1675,7 +1727,7 @@ mb86960_setmode(sc)
*
* Note that the DLC (Data Linc Control unit, i.e. transmitter
* and receiver) must be stopped when feeding the filter, and
* DLC trushes all packets in both transmission and receive
* DLC trashes all packets in both transmission and receive
* buffers when stopped.
*
* ... Are the above sentenses correct? I have to check the
@ -1758,7 +1810,7 @@ mb86960_enable(sc)
log(LOG_INFO, "%s: mb86960_enable()\n", sc->sc_dev.dv_xname);
#endif
if ((sc->sc_flags & FE_FLAGS_ENABLED) == 0 && sc->sc_enable != NULL) {
if ((sc->sc_stat & FE_STAT_ENABLED) == 0 && sc->sc_enable != NULL) {
if ((*sc->sc_enable)(sc) != 0) {
printf("%s: device enable failed\n",
sc->sc_dev.dv_xname);
@ -1766,7 +1818,7 @@ mb86960_enable(sc)
}
}
sc->sc_flags |= FE_FLAGS_ENABLED;
sc->sc_stat |= FE_STAT_ENABLED;
return (0);
}
@ -1782,9 +1834,9 @@ mb86960_disable(sc)
log(LOG_INFO, "%s: mb86960_disable()\n", sc->sc_dev.dv_xname);
#endif
if ((sc->sc_flags & FE_FLAGS_ENABLED) != 0 && sc->sc_disable != NULL) {
if ((sc->sc_stat & FE_STAT_ENABLED) != 0 && sc->sc_disable != NULL) {
(*sc->sc_disable)(sc);
sc->sc_flags &= ~FE_FLAGS_ENABLED;
sc->sc_stat &= ~FE_STAT_ENABLED;
}
}
@ -1799,8 +1851,9 @@ mb86960_activate(self, act)
enum devact act;
{
struct mb86960_softc *sc = (struct mb86960_softc *)self;
int rv = 0, s;
int rv, s;
rv = 0;
s = splnet();
switch (act) {
case DVACT_ACTIVATE:
@ -1827,7 +1880,7 @@ mb86960_detach(sc)
struct ifnet *ifp = &sc->sc_ec.ec_if;
/* Succeed now if there's no work to do. */
if ((sc->sc_flags & FE_FLAGS_ATTACHED) == 0)
if ((sc->sc_stat & FE_STAT_ATTACHED) == 0)
return (0);
/* Delete all media. */
@ -1931,7 +1984,7 @@ mb86960_dump(level, sc)
{
bus_space_tag_t bst = sc->sc_bst;
bus_space_handle_t bsh = sc->sc_bsh;
u_char save_dlcr7;
u_int8_t save_dlcr7;
save_dlcr7 = bus_space_read_1(bst, bsh, FE_DLCR7);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86960reg.h,v 1.7 2002/10/04 15:22:30 tsutsui Exp $ */
/* $NetBSD: mb86960reg.h,v 1.8 2002/11/30 14:15:10 tsutsui Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -340,8 +340,15 @@
/* How many packets we can put in the transmission buffer on NIC memory. */
#define FE_QUEUEING_MAX 127
/* Length (in bytes) of a "packet length" word in transmission buffer. */
#define FE_DATA_LEN_LEN 2
/* Size (in bytes) of a "packet length" word in transmission buffer. */
#define FE_TXLEN_SIZE 2
/* receive packet status in the receive packet header. */
#define FE_RXSTAT_GOODPKT 0x20
#define FE_RXSTAT_RMT0900 0x10
#define FE_RXSTAT_SHORTPKT 0x08
#define FE_RXSTAT_ALIGNERR 0x04
#define FE_RXSTAT_CRCERR 0x02
/*
* FUJITSU MBH10302 specific Registers.

View File

@ -1,4 +1,4 @@
/* $NetBSD: mb86960var.h,v 1.31 2002/10/05 15:16:12 tsutsui Exp $ */
/* $NetBSD: mb86960var.h,v 1.32 2002/11/30 14:15:10 tsutsui Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -93,9 +93,6 @@
/* Force DLCR6 override. */
#define FE_FLAGS_OVERRIDE_DLCR6 0x0080
/* A cludge for PCMCIA support. */
#define FE_FLAGS_PCMCIA 0x8000
/*
* Supported hardware (Ethernet card) types
* This information is currently used only for debugging
@ -124,11 +121,6 @@ enum fe_type {
FE_TYPE_MBH10304
};
enum mb86960_type {
MB86960_TYPE_86960,
MB86960_TYPE_86965
};
/*
* fe_softc: per line info and status
*/
@ -141,28 +133,30 @@ struct mb86960_softc {
bus_space_handle_t sc_bsh;
/* Set by probe() and not modified in later phases. */
enum mb86960_type type; /* controller type */
u_int32_t sc_flags; /* controller quirks */
#define FE_FLAGS_MB86960 0x0001 /* DLCR7 is differnt on MB86960 */
#define FE_FLAGS_SBW_BYTE 0x0002 /* byte access mode for system bus */
u_char proto_dlcr4; /* DLCR4 prototype. */
u_char proto_dlcr5; /* DLCR5 prototype. */
u_char proto_dlcr6; /* DLCR6 prototype. */
u_char proto_dlcr7; /* DLCR7 prototype. */
u_char proto_bmpr13; /* BMPR13 prototype. */
u_int8_t proto_dlcr4; /* DLCR4 prototype. */
u_int8_t proto_dlcr5; /* DLCR5 prototype. */
u_int8_t proto_dlcr6; /* DLCR6 prototype. */
u_int8_t proto_dlcr7; /* DLCR7 prototype. */
u_int8_t proto_bmpr13; /* BMPR13 prototype. */
/* Vendor specific hooks. */
void (*init_card) __P((struct mb86960_softc *));
void (*stop_card) __P((struct mb86960_softc *));
/* Transmission buffer management. */
u_short txb_size; /* total bytes in TX buffer */
u_short txb_free; /* free bytes in TX buffer */
u_char txb_count; /* number of packets in TX buffer */
u_char txb_sched; /* number of scheduled packets */
u_char txb_padding; /* number of delayed padding bytes */
int txb_size; /* total bytes in TX buffer */
int txb_free; /* free bytes in TX buffer */
int txb_count; /* number of packets in TX buffer */
int txb_sched; /* number of scheduled packets */
int txb_padding; /* number of delayed padding bytes */
/* Multicast address filter management. */
u_char filter_change; /* MARs must be changed ASAP. */
u_char filter[FE_FILTER_LEN]; /* new filter value. */
int filter_change; /* MARs must be changed ASAP. */
u_int8_t filter[FE_FILTER_LEN]; /* new filter value. */
u_int8_t sc_enaddr[ETHER_ADDR_LEN];
@ -170,9 +164,9 @@ struct mb86960_softc {
rndsource_element_t rnd_source;
#endif
u_int32_t sc_flags; /* misc. flags */
#define FE_FLAGS_ENABLED 0x0001 /* power enabled on interface */
#define FE_FLAGS_ATTACHED 0x0002 /* attach has succeeded */
u_int32_t sc_stat; /* driver status */
#define FE_STAT_ENABLED 0x0001 /* power enabled on interface */
#define FE_STAT_ATTACHED 0x0002 /* attach has succeeded */
int (*sc_enable) __P((struct mb86960_softc *));
void (*sc_disable) __P((struct mb86960_softc *));
@ -200,8 +194,7 @@ struct mb86960_softc {
* Hence FE_MAX_RECV_COUNT is the upper limit for number
* of packets in the receive buffer. */
void mb86960_attach __P((struct mb86960_softc *, enum mb86960_type,
u_int8_t *));
void mb86960_attach __P((struct mb86960_softc *, u_int8_t *));
void mb86960_config __P((struct mb86960_softc *, int *, int, int));
int mb86960_intr __P((void *));
int mb86960_enable __P((struct mb86960_softc *));

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ate.c,v 1.38 2002/10/05 17:52:32 tsutsui Exp $ */
/* $NetBSD: if_ate.c,v 1.39 2002/11/30 14:15:11 tsutsui Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ate.c,v 1.38 2002/10/05 17:52:32 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ate.c,v 1.39 2002/11/30 14:15:11 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -412,12 +412,12 @@ ate_attach(parent, self, aux)
printf(": %s Ethernet\n", typestr);
/* This interface is always enabled. */
sc->sc_flags |= FE_FLAGS_ENABLED;
sc->sc_stat |= FE_STAT_ENABLED;
/*
* Do generic MB86960 attach.
*/
mb86960_attach(sc, MB86960_TYPE_86965, myea);
mb86960_attach(sc, myea);
mb86960_config(sc, NULL, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ate_mca.c,v 1.8 2002/10/04 15:22:31 tsutsui Exp $ */
/* $NetBSD: if_ate_mca.c,v 1.9 2002/11/30 14:15:12 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ate_mca.c,v 1.8 2002/10/04 15:22:31 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ate_mca.c,v 1.9 2002/11/30 14:15:12 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -198,12 +198,12 @@ ate_mca_attach(parent, self, aux)
type = atp->at_type;
/* This interface is always enabled. */
sc->sc_flags |= FE_FLAGS_ENABLED;
sc->sc_stat |= FE_STAT_ENABLED;
/*
* Do generic MB86960 attach.
*/
mb86960_attach(sc, MB86960_TYPE_86965, myea);
mb86960_attach(sc, myea);
mb86960_config(sc, NULL, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_mbe_pcmcia.c,v 1.29 2002/10/02 16:52:11 thorpej Exp $ */
/* $NetBSD: if_mbe_pcmcia.c,v 1.30 2002/11/30 14:15:12 tsutsui Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_mbe_pcmcia.c,v 1.29 2002/10/02 16:52:11 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_mbe_pcmcia.c,v 1.30 2002/11/30 14:15:12 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -292,9 +292,9 @@ mbe_pcmcia_attach(parent, self, aux)
/* Perform generic initialization. */
if ((mpp->flags & MBH10302) != 0)
mb86960_attach(sc, MB86960_TYPE_86960, pgea.enaddr);
else
mb86960_attach(sc, MB86960_TYPE_86965, pgea.enaddr);
sc->sc_flags |= FE_FLAGS_MB86960;
mb86960_attach(sc, pgea.enaddr);
mb86960_config(sc, NULL, 0, 0);