Deleted Added
sdiff udiff text old ( 148368 ) new ( 148369 )
full compact
1/*-
2 * Copyright (C) 2001 Eduardo Horvath.
3 * Copyright (c) 2001-2003 Thomas Moestl
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 14 unchanged lines hidden (view full) ---

23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * from: NetBSD: gem.c,v 1.21 2002/06/01 23:50:58 lukem Exp
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/dev/gem/if_gem.c 148368 2005-07-24 18:12:31Z marius $");
32
33/*
34 * Driver for Sun GEM ethernet controllers.
35 */
36
37#if 0
38#define GEM_DEBUG
39#endif

--- 5 unchanged lines hidden (view full) ---

45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/bus.h>
48#include <sys/callout.h>
49#include <sys/endian.h>
50#include <sys/mbuf.h>
51#include <sys/malloc.h>
52#include <sys/kernel.h>
53#include <sys/module.h>
54#include <sys/socket.h>
55#include <sys/sockio.h>
56
57#include <net/bpf.h>
58#include <net/ethernet.h>
59#include <net/if.h>
60#include <net/if_arp.h>
61#include <net/if_dl.h>

--- 6 unchanged lines hidden (view full) ---

68#include <dev/mii/miivar.h>
69
70#include <dev/gem/if_gemreg.h>
71#include <dev/gem/if_gemvar.h>
72
73#define TRIES 10000
74
75static void gem_start(struct ifnet *);
76static void gem_stop(struct ifnet *, int);
77static int gem_ioctl(struct ifnet *, u_long, caddr_t);
78static void gem_cddma_callback(void *, bus_dma_segment_t *, int, int);
79static void gem_txdma_callback(void *, bus_dma_segment_t *, int,
80 bus_size_t, int);
81static void gem_tick(void *);
82static void gem_watchdog(struct ifnet *);
83static void gem_init(void *);
84static void gem_init_regs(struct gem_softc *sc);
85static int gem_ringsize(int sz);
86static int gem_meminit(struct gem_softc *);
87static int gem_load_txmbuf(struct gem_softc *, struct mbuf *);
88static void gem_mifinit(struct gem_softc *);
89static int gem_bitwait(struct gem_softc *sc, bus_addr_t r,
90 u_int32_t clr, u_int32_t set);
91static int gem_reset_rx(struct gem_softc *);

--- 35 unchanged lines hidden (view full) ---

127gem_attach(sc)
128 struct gem_softc *sc;
129{
130 struct ifnet *ifp;
131 struct mii_softc *child;
132 int i, error;
133 u_int32_t v;
134
135 ifp = sc->sc_ifp = if_alloc(IFT_ETHER);
136 if (ifp == NULL)
137 return (ENOSPC);
138
139 /* Make sure the chip is stopped. */
140 ifp->if_softc = sc;
141 gem_reset(sc);
142
143 error = bus_dma_tag_create(NULL, 1, 0, BUS_SPACE_MAXADDR_32BIT,
144 BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, GEM_NSEGS,
145 BUS_SPACE_MAXSIZE_32BIT, 0, NULL, NULL, &sc->sc_pdmatag);
146 if (error)
147 goto fail_ifnet;
148
149 error = bus_dma_tag_create(sc->sc_pdmatag, 1, 0,

--- 71 unchanged lines hidden (view full) ---

221 &sc->sc_rxsoft[i].rxs_dmamap)) != 0) {
222 device_printf(sc->sc_dev, "unable to create rx DMA map "
223 "%d, error = %d\n", i, error);
224 goto fail_rxd;
225 }
226 sc->sc_rxsoft[i].rxs_mbuf = NULL;
227 }
228
229 gem_mifinit(sc);
230
231 if ((error = mii_phy_probe(sc->sc_dev, &sc->sc_miibus, gem_mediachange,
232 gem_mediastatus)) != 0) {
233 device_printf(sc->sc_dev, "phy probe failed: %d\n", error);
234 goto fail_rxd;
235 }
236 sc->sc_mii = device_get_softc(sc->sc_miibus);
237

--- 12 unchanged lines hidden (view full) ---

250 device_printf(sc->sc_dev, "%ukB RX FIFO, %ukB TX FIFO\n",
251 sc->sc_rxfifosize / 1024, v / 16);
252
253 /* Initialize ifnet structure. */
254 ifp->if_softc = sc;
255 if_initname(ifp, device_get_name(sc->sc_dev),
256 device_get_unit(sc->sc_dev));
257 ifp->if_mtu = ETHERMTU;
258 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST |
259 IFF_NEEDSGIANT;
260 ifp->if_start = gem_start;
261 ifp->if_ioctl = gem_ioctl;
262 ifp->if_watchdog = gem_watchdog;
263 ifp->if_init = gem_init;
264 ifp->if_snd.ifq_maxlen = GEM_TXQUEUELEN;
265 /*
266 * Walk along the list of attached MII devices and
267 * establish an `MII instance' to `phy number'

--- 47 unchanged lines hidden (view full) ---

315 * resume.
316 */
317 sc->sc_powerhook = powerhook_establish(gem_power, sc);
318 if (sc->sc_powerhook == NULL)
319 device_printf(sc->sc_dev, "WARNING: unable to establish power "
320 "hook\n");
321#endif
322
323 callout_init(&sc->sc_tick_ch, 0);
324#ifdef GEM_RINT_TIMEOUT
325 callout_init(&sc->sc_rx_ch, 0);
326#endif
327 return (0);
328
329 /*
330 * Free any resources we've allocated during the failed attach
331 * attempt. Do this in reverse order and fall through.
332 */
333fail_rxd:

--- 27 unchanged lines hidden (view full) ---

361
362void
363gem_detach(sc)
364 struct gem_softc *sc;
365{
366 struct ifnet *ifp = sc->sc_ifp;
367 int i;
368
369 gem_stop(ifp, 1);
370 ether_ifdetach(ifp);
371 if_free(ifp);
372 device_delete_child(sc->sc_dev, sc->sc_miibus);
373
374 for (i = 0; i < GEM_NRXDESC; i++) {
375 if (sc->sc_rxsoft[i].rxs_dmamap != NULL)
376 bus_dmamap_destroy(sc->sc_rdmatag,
377 sc->sc_rxsoft[i].rxs_dmamap);

--- 15 unchanged lines hidden (view full) ---

393}
394
395void
396gem_suspend(sc)
397 struct gem_softc *sc;
398{
399 struct ifnet *ifp = sc->sc_ifp;
400
401 gem_stop(ifp, 0);
402}
403
404void
405gem_resume(sc)
406 struct gem_softc *sc;
407{
408 struct ifnet *ifp = sc->sc_ifp;
409
410 if (ifp->if_flags & IFF_UP)
411 gem_init(ifp);
412}
413
414static void
415gem_cddma_callback(xsc, segs, nsegs, error)
416 void *xsc;
417 bus_dma_segment_t *segs;
418 int nsegs;
419 int error;

--- 84 unchanged lines hidden (view full) ---

504 ("gem_txdma_callback: missed end of packet!"));
505}
506
507static void
508gem_tick(arg)
509 void *arg;
510{
511 struct gem_softc *sc = arg;
512 int s;
513
514 s = splnet();
515 mii_tick(sc->sc_mii);
516 splx(s);
517
518 callout_reset(&sc->sc_tick_ch, hz, gem_tick, sc);
519}
520
521static int
522gem_bitwait(sc, r, clr, set)
523 struct gem_softc *sc;
524 bus_addr_t r;

--- 12 unchanged lines hidden (view full) ---

537}
538
539void
540gem_reset(sc)
541 struct gem_softc *sc;
542{
543 bus_space_tag_t t = sc->sc_bustag;
544 bus_space_handle_t h = sc->sc_h;
545 int s;
546
547 s = splnet();
548#ifdef GEM_DEBUG
549 CTR1(KTR_GEM, "%s: gem_reset", device_get_name(sc->sc_dev));
550#endif
551 gem_reset_rx(sc);
552 gem_reset_tx(sc);
553
554 /* Do a full reset */
555 bus_space_write_4(t, h, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX);
556 if (!gem_bitwait(sc, GEM_RESET, GEM_RESET_RX | GEM_RESET_TX, 0))
557 device_printf(sc->sc_dev, "cannot reset device\n");
558 splx(s);
559}
560
561
562/*
563 * gem_rxdrain:
564 *
565 * Drain the receive queue.
566 */

--- 261 unchanged lines hidden (view full) ---

828 break;
829 default:
830 printf("gem: invalid Receive Descriptor ring size\n");
831 break;
832 }
833 return (v);
834}
835
836/*
837 * Initialization of interface; set up initialization block
838 * and transmit/receive descriptor rings.
839 */
840static void
841gem_init(xsc)
842 void *xsc;
843{
844 struct gem_softc *sc = (struct gem_softc *)xsc;
845 struct ifnet *ifp = sc->sc_ifp;
846 bus_space_tag_t t = sc->sc_bustag;
847 bus_space_handle_t h = sc->sc_h;
848 int s;
849 u_int32_t v;
850
851 s = splnet();
852
853#ifdef GEM_DEBUG
854 CTR1(KTR_GEM, "%s: gem_init: calling stop", device_get_name(sc->sc_dev));
855#endif
856 /*
857 * Initialization sequence. The numbered steps below correspond
858 * to the sequence outlined in section 6.3.5.1 in the Ethernet
859 * Channel Engine manual (part of the PCIO manual).

--- 70 unchanged lines hidden (view full) ---

930 * and an ON Threshold of 1/4 full.
931 */
932 bus_space_write_4(t, h, GEM_RX_PAUSE_THRESH,
933 (3 * sc->sc_rxfifosize / 256) |
934 ( (sc->sc_rxfifosize / 256) << 12));
935 bus_space_write_4(t, h, GEM_RX_BLANKING, (6<<12)|6);
936
937 /* step 11. Configure Media */
938 mii_mediachg(sc->sc_mii);
939
940 /* step 12. RX_MAC Configuration Register */
941 v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG);
942 v |= GEM_MAC_RX_ENABLE;
943 bus_space_write_4(t, h, GEM_MAC_RX_CONFIG, v);
944
945 /* step 14. Issue Transmit Pending command */
946
947 /* step 15. Give the reciever a swift kick */
948 bus_space_write_4(t, h, GEM_RX_KICK, GEM_NRXDESC-4);
949
950 /* Start the one second timer. */
951 callout_reset(&sc->sc_tick_ch, hz, gem_tick, sc);
952
953 ifp->if_flags |= IFF_RUNNING;
954 ifp->if_flags &= ~IFF_OACTIVE;
955 ifp->if_timer = 0;
956 sc->sc_ifflags = ifp->if_flags;
957 splx(s);
958}
959
960static int
961gem_load_txmbuf(sc, m0)
962 struct gem_softc *sc;
963 struct mbuf *m0;
964{
965 struct gem_txdma txd;

--- 133 unchanged lines hidden (view full) ---

1099 bus_space_write_4(t, h, GEM_MAC_XIF_CONFIG, v);
1100}
1101
1102static void
1103gem_start(ifp)
1104 struct ifnet *ifp;
1105{
1106 struct gem_softc *sc = (struct gem_softc *)ifp->if_softc;
1107 struct mbuf *m0 = NULL;
1108 int firsttx, ntx = 0, ofree, txmfail;
1109
1110 if ((ifp->if_flags & (IFF_RUNNING | IFF_OACTIVE)) != IFF_RUNNING)
1111 return;
1112
1113 /*
1114 * Remember the previous number of free descriptors and

--- 188 unchanged lines hidden (view full) ---

1303#endif
1304
1305 if (progress) {
1306 if (sc->sc_txfree == GEM_NTXDESC - 1)
1307 sc->sc_txwin = 0;
1308
1309 /* Freed some descriptors, so reset IFF_OACTIVE and restart. */
1310 ifp->if_flags &= ~IFF_OACTIVE;
1311 gem_start(ifp);
1312
1313 if (STAILQ_EMPTY(&sc->sc_txdirtyq))
1314 ifp->if_timer = 0;
1315 }
1316
1317#ifdef GEM_DEBUG
1318 CTR2(KTR_GEM, "%s: gem_tint: watchdog %d",
1319 device_get_name(sc->sc_dev), ifp->if_timer);
1320#endif
1321}
1322
1323#ifdef GEM_RINT_TIMEOUT
1324static void
1325gem_rint_timeout(arg)
1326 void *arg;
1327{
1328
1329 gem_rint((struct gem_softc *)arg);
1330}
1331#endif
1332
1333/*
1334 * Receive interrupt.
1335 */
1336static void
1337gem_rint(sc)

--- 86 unchanged lines hidden (view full) ---

1424 continue;
1425 }
1426 m->m_data += 2; /* We're already off by two */
1427
1428 m->m_pkthdr.rcvif = ifp;
1429 m->m_pkthdr.len = m->m_len = len - ETHER_CRC_LEN;
1430
1431 /* Pass it on. */
1432 (*ifp->if_input)(ifp, m);
1433 }
1434
1435 if (progress) {
1436 GEM_CDSYNC(sc, BUS_DMASYNC_PREWRITE);
1437 /* Update the receive pointer. */
1438 if (i == sc->sc_rxptr) {
1439 device_printf(sc->sc_dev, "rint: ring wrap\n");
1440 }

--- 80 unchanged lines hidden (view full) ---

1521gem_intr(v)
1522 void *v;
1523{
1524 struct gem_softc *sc = (struct gem_softc *)v;
1525 bus_space_tag_t t = sc->sc_bustag;
1526 bus_space_handle_t seb = sc->sc_h;
1527 u_int32_t status;
1528
1529 status = bus_space_read_4(t, seb, GEM_STATUS);
1530#ifdef GEM_DEBUG
1531 CTR3(KTR_GEM, "%s: gem_intr: cplt %x, status %x",
1532 device_get_name(sc->sc_dev), (status>>19),
1533 (u_int)status);
1534#endif
1535
1536 if ((status & (GEM_INTR_RX_TAG_ERR | GEM_INTR_BERR)) != 0)

--- 7 unchanged lines hidden (view full) ---

1544
1545 /* We should eventually do more than just print out error stats. */
1546 if (status & GEM_INTR_TX_MAC) {
1547 int txstat = bus_space_read_4(t, seb, GEM_MAC_TX_STATUS);
1548 if (txstat & ~GEM_MAC_TX_XMIT_DONE)
1549 device_printf(sc->sc_dev, "MAC tx fault, status %x\n",
1550 txstat);
1551 if (txstat & (GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG))
1552 gem_init(sc);
1553 }
1554 if (status & GEM_INTR_RX_MAC) {
1555 int rxstat = bus_space_read_4(t, seb, GEM_MAC_RX_STATUS);
1556 if (rxstat & ~(GEM_MAC_RX_DONE | GEM_MAC_RX_FRAME_CNT))
1557 device_printf(sc->sc_dev, "MAC rx fault, status %x\n",
1558 rxstat);
1559 if ((rxstat & GEM_MAC_RX_OVERFLOW) != 0)
1560 gem_init(sc);
1561 }
1562}
1563
1564
1565static void
1566gem_watchdog(ifp)
1567 struct ifnet *ifp;
1568{
1569 struct gem_softc *sc = ifp->if_softc;
1570
1571#ifdef GEM_DEBUG
1572 CTR3(KTR_GEM, "gem_watchdog: GEM_RX_CONFIG %x GEM_MAC_RX_STATUS %x "
1573 "GEM_MAC_RX_CONFIG %x",
1574 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_RX_CONFIG),
1575 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_STATUS),
1576 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_RX_CONFIG));
1577 CTR3(KTR_GEM, "gem_watchdog: GEM_TX_CONFIG %x GEM_MAC_TX_STATUS %x "
1578 "GEM_MAC_TX_CONFIG %x",
1579 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_TX_CONFIG),
1580 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_TX_STATUS),
1581 bus_space_read_4(sc->sc_bustag, sc->sc_h, GEM_MAC_TX_CONFIG));
1582#endif
1583
1584 device_printf(sc->sc_dev, "device timeout\n");
1585 ++ifp->if_oerrors;
1586
1587 /* Try to get more packets going. */
1588 gem_init(ifp);
1589}
1590
1591/*
1592 * Initialize the MII Management Interface
1593 */
1594static void
1595gem_mifinit(sc)
1596 struct gem_softc *sc;
1597{
1598 bus_space_tag_t t = sc->sc_bustag;
1599 bus_space_handle_t mif = sc->sc_h;
1600
1601 /* Configure the MIF in frame mode */
1602 sc->sc_mif_config = bus_space_read_4(t, mif, GEM_MIF_CONFIG);
1603 sc->sc_mif_config &= ~GEM_MIF_CONFIG_BB_ENA;
1604 bus_space_write_4(t, mif, GEM_MIF_CONFIG, sc->sc_mif_config);
1605}
1606
1607/*
1608 * MII interface

--- 15 unchanged lines hidden (view full) ---

1624 int phy, reg;
1625{
1626 struct gem_softc *sc = device_get_softc(dev);
1627 bus_space_tag_t t = sc->sc_bustag;
1628 bus_space_handle_t mif = sc->sc_h;
1629 int n;
1630 u_int32_t v;
1631
1632#ifdef GEM_DEBUG_PHY
1633 printf("gem_mii_readreg: phy %d reg %d\n", phy, reg);
1634#endif
1635
1636#if 0
1637 /* Select the desired PHY in the MIF configuration register */
1638 v = bus_space_read_4(t, mif, GEM_MIF_CONFIG);
1639 /* Clear PHY select bit */

--- 7 unchanged lines hidden (view full) ---

1647 /* Construct the frame command */
1648 v = (reg << GEM_MIF_REG_SHIFT) | (phy << GEM_MIF_PHY_SHIFT) |
1649 GEM_MIF_FRAME_READ;
1650
1651 bus_space_write_4(t, mif, GEM_MIF_FRAME, v);
1652 for (n = 0; n < 100; n++) {
1653 DELAY(1);
1654 v = bus_space_read_4(t, mif, GEM_MIF_FRAME);
1655 if (v & GEM_MIF_FRAME_TA0)
1656 return (v & GEM_MIF_FRAME_DATA);
1657 }
1658
1659 device_printf(sc->sc_dev, "mii_read timeout\n");
1660 return (0);
1661}
1662
1663int
1664gem_mii_writereg(dev, phy, reg, val)
1665 device_t dev;
1666 int phy, reg, val;
1667{
1668 struct gem_softc *sc = device_get_softc(dev);
1669 bus_space_tag_t t = sc->sc_bustag;
1670 bus_space_handle_t mif = sc->sc_h;
1671 int n;
1672 u_int32_t v;
1673
1674#ifdef GEM_DEBUG_PHY
1675 printf("gem_mii_writereg: phy %d reg %d val %x\n", phy, reg, val);
1676#endif
1677
1678#if 0
1679 /* Select the desired PHY in the MIF configuration register */
1680 v = bus_space_read_4(t, mif, GEM_MIF_CONFIG);
1681 /* Clear PHY select bit */

--- 8 unchanged lines hidden (view full) ---

1690 (phy << GEM_MIF_PHY_SHIFT) |
1691 (reg << GEM_MIF_REG_SHIFT) |
1692 (val & GEM_MIF_FRAME_DATA);
1693
1694 bus_space_write_4(t, mif, GEM_MIF_FRAME, v);
1695 for (n = 0; n < 100; n++) {
1696 DELAY(1);
1697 v = bus_space_read_4(t, mif, GEM_MIF_FRAME);
1698 if (v & GEM_MIF_FRAME_TA0)
1699 return (1);
1700 }
1701
1702 device_printf(sc->sc_dev, "mii_write timeout\n");
1703 return (0);
1704}
1705
1706void
1707gem_mii_statchg(dev)
1708 device_t dev;
1709{
1710 struct gem_softc *sc = device_get_softc(dev);
1711#ifdef GEM_DEBUG
1712 int instance = IFM_INST(sc->sc_mii->mii_media.ifm_cur->ifm_media);
1713#endif
1714 bus_space_tag_t t = sc->sc_bustag;
1715 bus_space_handle_t mac = sc->sc_h;
1716 u_int32_t v;
1717
1718#ifdef GEM_DEBUG
1719 if (sc->sc_debug)
1720 printf("gem_mii_statchg: status change: phy = %d\n",
1721 sc->sc_phys[instance]);
1722#endif
1723
1724 /* Set tx full duplex options */
1725 bus_space_write_4(t, mac, GEM_MAC_TX_CONFIG, 0);
1726 DELAY(10000); /* reg must be cleared and delay before changing. */

--- 23 unchanged lines hidden (view full) ---

1750 v |= GEM_MAC_XIF_GMII_MODE;
1751 else
1752 v &= ~GEM_MAC_XIF_GMII_MODE;
1753 } else {
1754 /* Internal MII needs buf enable */
1755 v |= GEM_MAC_XIF_MII_BUF_ENA;
1756 }
1757 bus_space_write_4(t, mac, GEM_MAC_XIF_CONFIG, v);
1758}
1759
1760int
1761gem_mediachange(ifp)
1762 struct ifnet *ifp;
1763{
1764 struct gem_softc *sc = ifp->if_softc;
1765

--- 4 unchanged lines hidden (view full) ---

1770
1771void
1772gem_mediastatus(ifp, ifmr)
1773 struct ifnet *ifp;
1774 struct ifmediareq *ifmr;
1775{
1776 struct gem_softc *sc = ifp->if_softc;
1777
1778 if ((ifp->if_flags & IFF_UP) == 0)
1779 return;
1780
1781 mii_pollstat(sc->sc_mii);
1782 ifmr->ifm_active = sc->sc_mii->mii_media_active;
1783 ifmr->ifm_status = sc->sc_mii->mii_media_status;
1784}
1785
1786/*
1787 * Process an ioctl request.
1788 */
1789static int
1790gem_ioctl(ifp, cmd, data)
1791 struct ifnet *ifp;
1792 u_long cmd;
1793 caddr_t data;
1794{
1795 struct gem_softc *sc = ifp->if_softc;
1796 struct ifreq *ifr = (struct ifreq *)data;
1797 int s, error = 0;
1798
1799 switch (cmd) {
1800 case SIOCSIFADDR:
1801 case SIOCGIFADDR:
1802 case SIOCSIFMTU:
1803 error = ether_ioctl(ifp, cmd, data);
1804 break;
1805 case SIOCSIFFLAGS:
1806 if (ifp->if_flags & IFF_UP) {
1807 if ((sc->sc_ifflags ^ ifp->if_flags) == IFF_PROMISC)
1808 gem_setladrf(sc);
1809 else
1810 gem_init(sc);
1811 } else {
1812 if (ifp->if_flags & IFF_RUNNING)
1813 gem_stop(ifp, 0);
1814 }
1815 sc->sc_ifflags = ifp->if_flags;
1816 error = 0;
1817 break;
1818 case SIOCADDMULTI:
1819 case SIOCDELMULTI:
1820 gem_setladrf(sc);
1821 error = 0;
1822 break;
1823 case SIOCGIFMEDIA:
1824 case SIOCSIFMEDIA:
1825 error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii->mii_media, cmd);
1826 break;
1827 default:
1828 error = ENOTTY;
1829 break;
1830 }
1831
1832 /* Try to get things going again */
1833 if (ifp->if_flags & IFF_UP)
1834 gem_start(ifp);
1835 splx(s);
1836 return (error);
1837}
1838
1839/*
1840 * Set up the logical address filter.
1841 */
1842static void
1843gem_setladrf(sc)
1844 struct gem_softc *sc;
1845{
1846 struct ifnet *ifp = sc->sc_ifp;
1847 struct ifmultiaddr *inm;
1848 bus_space_tag_t t = sc->sc_bustag;
1849 bus_space_handle_t h = sc->sc_h;
1850 u_int32_t crc;
1851 u_int32_t hash[16];
1852 u_int32_t v;
1853 int i;
1854
1855 /* Get current RX configuration */
1856 v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG);
1857
1858 /*
1859 * Turn off promiscuous mode, promiscuous group mode (all multicast),
1860 * and hash filter. Depending on the case, the right bit will be
1861 * enabled.
1862 */

--- 52 unchanged lines hidden ---