Deleted Added
full compact
if_wb.c (148654) if_wb.c (148887)
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997, 1998
3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/pci/if_wb.c 148654 2005-08-03 00:18:35Z rwatson $");
34__FBSDID("$FreeBSD: head/sys/pci/if_wb.c 148887 2005-08-09 10:20:02Z rwatson $");
35
36/*
37 * Winbond fast ethernet PCI NIC driver
38 *
39 * Supports various cheap network adapters based on the Winbond W89C840F
40 * fast ethernet controller chip. This includes adapters manufactured by
41 * Winbond itself and some made by Linksys.
42 *

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

1221{
1222 struct ifnet *ifp;
1223
1224 ifp = sc->wb_ifp;
1225
1226 ifp->if_timer = 0;
1227
1228 if (sc->wb_cdata.wb_tx_head == NULL) {
35
36/*
37 * Winbond fast ethernet PCI NIC driver
38 *
39 * Supports various cheap network adapters based on the Winbond W89C840F
40 * fast ethernet controller chip. This includes adapters manufactured by
41 * Winbond itself and some made by Linksys.
42 *

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

1221{
1222 struct ifnet *ifp;
1223
1224 ifp = sc->wb_ifp;
1225
1226 ifp->if_timer = 0;
1227
1228 if (sc->wb_cdata.wb_tx_head == NULL) {
1229 ifp->if_flags &= ~IFF_OACTIVE;
1229 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1230 sc->wb_cdata.wb_tx_tail = NULL;
1231 } else {
1232 if (WB_TXOWN(sc->wb_cdata.wb_tx_head) == WB_UNSENT) {
1233 WB_TXOWN(sc->wb_cdata.wb_tx_head) = WB_TXSTAT_OWN;
1234 ifp->if_timer = 5;
1235 CSR_WRITE_4(sc, WB_TXSTART, 0xFFFFFFFF);
1236 }
1237 }

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

1457 sc = ifp->if_softc;
1458 WB_LOCK(sc);
1459
1460 /*
1461 * Check for an available queue slot. If there are none,
1462 * punt.
1463 */
1464 if (sc->wb_cdata.wb_tx_free->wb_mbuf != NULL) {
1230 sc->wb_cdata.wb_tx_tail = NULL;
1231 } else {
1232 if (WB_TXOWN(sc->wb_cdata.wb_tx_head) == WB_UNSENT) {
1233 WB_TXOWN(sc->wb_cdata.wb_tx_head) = WB_TXSTAT_OWN;
1234 ifp->if_timer = 5;
1235 CSR_WRITE_4(sc, WB_TXSTART, 0xFFFFFFFF);
1236 }
1237 }

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

1457 sc = ifp->if_softc;
1458 WB_LOCK(sc);
1459
1460 /*
1461 * Check for an available queue slot. If there are none,
1462 * punt.
1463 */
1464 if (sc->wb_cdata.wb_tx_free->wb_mbuf != NULL) {
1465 ifp->if_flags |= IFF_OACTIVE;
1465 ifp->if_drv_flags |= IFF_DRV_OACTIVE;
1466 WB_UNLOCK(sc);
1467 return;
1468 }
1469
1470 start_tx = sc->wb_cdata.wb_tx_free;
1471
1472 while(sc->wb_cdata.wb_tx_free->wb_mbuf == NULL) {
1473 IF_DEQUEUE(&ifp->if_snd, m_head);

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

1644 CSR_WRITE_4(sc, WB_RXSTART, 0xFFFFFFFF);
1645
1646 WB_CLRBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON);
1647 CSR_WRITE_4(sc, WB_TXADDR, vtophys(&sc->wb_ldata->wb_tx_list[0]));
1648 WB_SETBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON);
1649
1650 mii_mediachg(mii);
1651
1466 WB_UNLOCK(sc);
1467 return;
1468 }
1469
1470 start_tx = sc->wb_cdata.wb_tx_free;
1471
1472 while(sc->wb_cdata.wb_tx_free->wb_mbuf == NULL) {
1473 IF_DEQUEUE(&ifp->if_snd, m_head);

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

1644 CSR_WRITE_4(sc, WB_RXSTART, 0xFFFFFFFF);
1645
1646 WB_CLRBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON);
1647 CSR_WRITE_4(sc, WB_TXADDR, vtophys(&sc->wb_ldata->wb_tx_list[0]));
1648 WB_SETBIT(sc, WB_NETCFG, WB_NETCFG_TX_ON);
1649
1650 mii_mediachg(mii);
1651
1652 ifp->if_flags |= IFF_RUNNING;
1653 ifp->if_flags &= ~IFF_OACTIVE;
1652 ifp->if_drv_flags |= IFF_DRV_RUNNING;
1653 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
1654
1655 sc->wb_stat_ch = timeout(wb_tick, sc, hz);
1656 WB_UNLOCK(sc);
1657
1658 return;
1659}
1660
1661/*

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

1710
1711 WB_LOCK(sc);
1712
1713 switch(command) {
1714 case SIOCSIFFLAGS:
1715 if (ifp->if_flags & IFF_UP) {
1716 wb_init(sc);
1717 } else {
1654
1655 sc->wb_stat_ch = timeout(wb_tick, sc, hz);
1656 WB_UNLOCK(sc);
1657
1658 return;
1659}
1660
1661/*

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

1710
1711 WB_LOCK(sc);
1712
1713 switch(command) {
1714 case SIOCSIFFLAGS:
1715 if (ifp->if_flags & IFF_UP) {
1716 wb_init(sc);
1717 } else {
1718 if (ifp->if_flags & IFF_RUNNING)
1718 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
1719 wb_stop(sc);
1720 }
1721 error = 0;
1722 break;
1723 case SIOCADDMULTI:
1724 case SIOCDELMULTI:
1725 wb_setmulti(sc);
1726 error = 0;

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

1809 m_freem(sc->wb_cdata.wb_tx_chain[i].wb_mbuf);
1810 sc->wb_cdata.wb_tx_chain[i].wb_mbuf = NULL;
1811 }
1812 }
1813
1814 bzero((char *)&sc->wb_ldata->wb_tx_list,
1815 sizeof(sc->wb_ldata->wb_tx_list));
1816
1719 wb_stop(sc);
1720 }
1721 error = 0;
1722 break;
1723 case SIOCADDMULTI:
1724 case SIOCDELMULTI:
1725 wb_setmulti(sc);
1726 error = 0;

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

1809 m_freem(sc->wb_cdata.wb_tx_chain[i].wb_mbuf);
1810 sc->wb_cdata.wb_tx_chain[i].wb_mbuf = NULL;
1811 }
1812 }
1813
1814 bzero((char *)&sc->wb_ldata->wb_tx_list,
1815 sizeof(sc->wb_ldata->wb_tx_list));
1816
1817 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
1817 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
1818 WB_UNLOCK(sc);
1819
1820 return;
1821}
1822
1823/*
1824 * Stop all chip I/O so that the kernel's probe routines don't
1825 * get confused by errant DMAs when rebooting.

--- 12 unchanged lines hidden ---
1818 WB_UNLOCK(sc);
1819
1820 return;
1821}
1822
1823/*
1824 * Stop all chip I/O so that the kernel's probe routines don't
1825 * get confused by errant DMAs when rebooting.

--- 12 unchanged lines hidden ---