if_my.c (148654) | if_my.c (148887) |
---|---|
1/*- 2 * Written by: yen_cw@myson.com.tw 3 * Copyright (c) 2002 Myson Technology Inc. 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 * Myson fast ethernet PCI NIC driver, available at: http://www.myson.com.tw/ 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Written by: yen_cw@myson.com.tw 3 * Copyright (c) 2002 Myson Technology Inc. 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 * Myson fast ethernet PCI NIC driver, available at: http://www.myson.com.tw/ 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/my/if_my.c 148654 2005-08-03 00:18:35Z rwatson $"); | 31__FBSDID("$FreeBSD: head/sys/dev/my/if_my.c 148887 2005-08-09 10:20:02Z rwatson $"); |
32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/sockio.h> 36#include <sys/mbuf.h> 37#include <sys/malloc.h> 38#include <sys/kernel.h> 39#include <sys/socket.h> --- 1277 unchanged lines hidden (view full) --- 1317my_txeoc(struct my_softc * sc) 1318{ 1319 struct ifnet *ifp; 1320 1321 MY_LOCK(sc); 1322 ifp = sc->my_ifp; 1323 ifp->if_timer = 0; 1324 if (sc->my_cdata.my_tx_head == NULL) { | 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/sockio.h> 36#include <sys/mbuf.h> 37#include <sys/malloc.h> 38#include <sys/kernel.h> 39#include <sys/socket.h> --- 1277 unchanged lines hidden (view full) --- 1317my_txeoc(struct my_softc * sc) 1318{ 1319 struct ifnet *ifp; 1320 1321 MY_LOCK(sc); 1322 ifp = sc->my_ifp; 1323 ifp->if_timer = 0; 1324 if (sc->my_cdata.my_tx_head == NULL) { |
1325 ifp->if_flags &= ~IFF_OACTIVE; | 1325 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
1326 sc->my_cdata.my_tx_tail = NULL; 1327 if (sc->my_want_auto) 1328 my_autoneg_mii(sc, MY_FLAG_SCHEDDELAY, 1); 1329 } else { 1330 if (MY_TXOWN(sc->my_cdata.my_tx_head) == MY_UNSENT) { 1331 MY_TXOWN(sc->my_cdata.my_tx_head) = MY_OWNByNIC; 1332 ifp->if_timer = 5; 1333 CSR_WRITE_4(sc, MY_TXPDR, 0xFFFFFFFF); --- 141 unchanged lines hidden (view full) --- 1475 sc->my_tx_pend = 1; 1476 MY_UNLOCK(sc); 1477 return; 1478 } 1479 /* 1480 * Check for an available queue slot. If there are none, punt. 1481 */ 1482 if (sc->my_cdata.my_tx_free->my_mbuf != NULL) { | 1326 sc->my_cdata.my_tx_tail = NULL; 1327 if (sc->my_want_auto) 1328 my_autoneg_mii(sc, MY_FLAG_SCHEDDELAY, 1); 1329 } else { 1330 if (MY_TXOWN(sc->my_cdata.my_tx_head) == MY_UNSENT) { 1331 MY_TXOWN(sc->my_cdata.my_tx_head) = MY_OWNByNIC; 1332 ifp->if_timer = 5; 1333 CSR_WRITE_4(sc, MY_TXPDR, 0xFFFFFFFF); --- 141 unchanged lines hidden (view full) --- 1475 sc->my_tx_pend = 1; 1476 MY_UNLOCK(sc); 1477 return; 1478 } 1479 /* 1480 * Check for an available queue slot. If there are none, punt. 1481 */ 1482 if (sc->my_cdata.my_tx_free->my_mbuf != NULL) { |
1483 ifp->if_flags |= IFF_OACTIVE; | 1483 ifp->if_drv_flags |= IFF_DRV_OACTIVE; |
1484 MY_UNLOCK(sc); 1485 return; 1486 } 1487 start_tx = sc->my_cdata.my_tx_free; 1488 while (sc->my_cdata.my_tx_free->my_mbuf == NULL) { 1489 IF_DEQUEUE(&ifp->if_snd, m_head); 1490 if (m_head == NULL) 1491 break; --- 130 unchanged lines hidden (view full) --- 1622 MY_SETBIT(sc, MY_TCRRCR, MY_RE); 1623 MY_CLRBIT(sc, MY_TCRRCR, MY_TE); 1624 CSR_WRITE_4(sc, MY_TXLBA, vtophys(&sc->my_ldata->my_tx_list[0])); 1625 MY_SETBIT(sc, MY_TCRRCR, MY_TE); 1626 1627 /* Restore state of BMCR */ 1628 if (sc->my_pinfo != NULL) 1629 my_phy_writereg(sc, PHY_BMCR, phy_bmcr); | 1484 MY_UNLOCK(sc); 1485 return; 1486 } 1487 start_tx = sc->my_cdata.my_tx_free; 1488 while (sc->my_cdata.my_tx_free->my_mbuf == NULL) { 1489 IF_DEQUEUE(&ifp->if_snd, m_head); 1490 if (m_head == NULL) 1491 break; --- 130 unchanged lines hidden (view full) --- 1622 MY_SETBIT(sc, MY_TCRRCR, MY_RE); 1623 MY_CLRBIT(sc, MY_TCRRCR, MY_TE); 1624 CSR_WRITE_4(sc, MY_TXLBA, vtophys(&sc->my_ldata->my_tx_list[0])); 1625 MY_SETBIT(sc, MY_TCRRCR, MY_TE); 1626 1627 /* Restore state of BMCR */ 1628 if (sc->my_pinfo != NULL) 1629 my_phy_writereg(sc, PHY_BMCR, phy_bmcr); |
1630 ifp->if_flags |= IFF_RUNNING; 1631 ifp->if_flags &= ~IFF_OACTIVE; | 1630 ifp->if_drv_flags |= IFF_DRV_RUNNING; 1631 ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; |
1632 (void)splx(s); 1633 MY_UNLOCK(sc); 1634 return; 1635} 1636 1637/* 1638 * Set media options. 1639 */ --- 88 unchanged lines hidden (view full) --- 1728 int s, error = 0; 1729 1730 s = splimp(); 1731 MY_LOCK(sc); 1732 switch (command) { 1733 case SIOCSIFFLAGS: 1734 if (ifp->if_flags & IFF_UP) 1735 my_init(sc); | 1632 (void)splx(s); 1633 MY_UNLOCK(sc); 1634 return; 1635} 1636 1637/* 1638 * Set media options. 1639 */ --- 88 unchanged lines hidden (view full) --- 1728 int s, error = 0; 1729 1730 s = splimp(); 1731 MY_LOCK(sc); 1732 switch (command) { 1733 case SIOCSIFFLAGS: 1734 if (ifp->if_flags & IFF_UP) 1735 my_init(sc); |
1736 else if (ifp->if_flags & IFF_RUNNING) | 1736 else if (ifp->if_drv_flags & IFF_DRV_RUNNING) |
1737 my_stop(sc); 1738 error = 0; 1739 break; 1740 case SIOCADDMULTI: 1741 case SIOCDELMULTI: 1742 my_setmulti(sc); 1743 error = 0; 1744 break; --- 72 unchanged lines hidden (view full) --- 1817 for (i = 0; i < MY_TX_LIST_CNT; i++) { 1818 if (sc->my_cdata.my_tx_chain[i].my_mbuf != NULL) { 1819 m_freem(sc->my_cdata.my_tx_chain[i].my_mbuf); 1820 sc->my_cdata.my_tx_chain[i].my_mbuf = NULL; 1821 } 1822 } 1823 bzero((char *)&sc->my_ldata->my_tx_list, 1824 sizeof(sc->my_ldata->my_tx_list)); | 1737 my_stop(sc); 1738 error = 0; 1739 break; 1740 case SIOCADDMULTI: 1741 case SIOCDELMULTI: 1742 my_setmulti(sc); 1743 error = 0; 1744 break; --- 72 unchanged lines hidden (view full) --- 1817 for (i = 0; i < MY_TX_LIST_CNT; i++) { 1818 if (sc->my_cdata.my_tx_chain[i].my_mbuf != NULL) { 1819 m_freem(sc->my_cdata.my_tx_chain[i].my_mbuf); 1820 sc->my_cdata.my_tx_chain[i].my_mbuf = NULL; 1821 } 1822 } 1823 bzero((char *)&sc->my_ldata->my_tx_list, 1824 sizeof(sc->my_ldata->my_tx_list)); |
1825 ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); | 1825 ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); |
1826 MY_UNLOCK(sc); 1827 return; 1828} 1829 1830/* 1831 * Stop all chip I/O so that the kernel's probe routines don't get confused 1832 * by errant DMAs when rebooting. 1833 */ 1834static void 1835my_shutdown(device_t dev) 1836{ 1837 struct my_softc *sc; 1838 1839 sc = device_get_softc(dev); 1840 my_stop(sc); 1841 return; 1842} | 1826 MY_UNLOCK(sc); 1827 return; 1828} 1829 1830/* 1831 * Stop all chip I/O so that the kernel's probe routines don't get confused 1832 * by errant DMAs when rebooting. 1833 */ 1834static void 1835my_shutdown(device_t dev) 1836{ 1837 struct my_softc *sc; 1838 1839 sc = device_get_softc(dev); 1840 my_stop(sc); 1841 return; 1842} |