if_msk.c (192726) | if_msk.c (192727) |
---|---|
1/****************************************************************************** 2 * 3 * Name : sky2.c 4 * Project: Gigabit Ethernet Driver for FreeBSD 5.x/6.x 5 * Version: $Revision: 1.23 $ 6 * Date : $Date: 2005/12/22 09:04:11 $ 7 * Purpose: Main driver source file 8 * --- 85 unchanged lines hidden (view full) --- 94 95/* 96 * Device driver for the Marvell Yukon II Ethernet controller. 97 * Due to lack of documentation, this driver is based on the code from 98 * sk(4) and Marvell's myk(4) driver for FreeBSD 5.x. 99 */ 100 101#include <sys/cdefs.h> | 1/****************************************************************************** 2 * 3 * Name : sky2.c 4 * Project: Gigabit Ethernet Driver for FreeBSD 5.x/6.x 5 * Version: $Revision: 1.23 $ 6 * Date : $Date: 2005/12/22 09:04:11 $ 7 * Purpose: Main driver source file 8 * --- 85 unchanged lines hidden (view full) --- 94 95/* 96 * Device driver for the Marvell Yukon II Ethernet controller. 97 * Due to lack of documentation, this driver is based on the code from 98 * sk(4) and Marvell's myk(4) driver for FreeBSD 5.x. 99 */ 100 101#include <sys/cdefs.h> |
102__FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 192726 2009-05-25 06:09:18Z yongari $"); | 102__FBSDID("$FreeBSD: head/sys/dev/msk/if_msk.c 192727 2009-05-25 06:19:36Z yongari $"); |
103 104#include <sys/param.h> 105#include <sys/systm.h> 106#include <sys/bus.h> 107#include <sys/endian.h> 108#include <sys/mbuf.h> 109#include <sys/malloc.h> 110#include <sys/kernel.h> --- 359 unchanged lines hidden (view full) --- 470 MSK_IF_LOCK_ASSERT(sc_if); 471 472 mii = device_get_softc(sc_if->msk_miibus); 473 ifp = sc_if->msk_ifp; 474 if (mii == NULL || ifp == NULL || 475 (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) 476 return; 477 | 103 104#include <sys/param.h> 105#include <sys/systm.h> 106#include <sys/bus.h> 107#include <sys/endian.h> 108#include <sys/mbuf.h> 109#include <sys/malloc.h> 110#include <sys/kernel.h> --- 359 unchanged lines hidden (view full) --- 470 MSK_IF_LOCK_ASSERT(sc_if); 471 472 mii = device_get_softc(sc_if->msk_miibus); 473 ifp = sc_if->msk_ifp; 474 if (mii == NULL || ifp == NULL || 475 (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) 476 return; 477 |
478 if (mii->mii_media_status & IFM_ACTIVE) { 479 if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) | 478 sc_if->msk_flags &= ~MSK_FLAG_LINK; 479 if ((mii->mii_media_status & (IFM_AVALID | IFM_ACTIVE)) == 480 (IFM_AVALID | IFM_ACTIVE)) { 481 switch (IFM_SUBTYPE(mii->mii_media_active)) { 482 case IFM_10_T: 483 case IFM_100_TX: |
480 sc_if->msk_flags |= MSK_FLAG_LINK; | 484 sc_if->msk_flags |= MSK_FLAG_LINK; |
481 } else 482 sc_if->msk_flags &= ~MSK_FLAG_LINK; | 485 break; 486 case IFM_1000_T: 487 case IFM_1000_SX: 488 case IFM_1000_LX: 489 case IFM_1000_CX: 490 if ((sc_if->msk_flags & MSK_FLAG_FASTETHER) == 0) 491 sc_if->msk_flags |= MSK_FLAG_LINK; 492 break; 493 default: 494 break; 495 } 496 } |
483 484 if ((sc_if->msk_flags & MSK_FLAG_LINK) != 0) { 485 /* Enable Tx FIFO Underrun. */ 486 CSR_WRITE_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_MSK), 487 GM_IS_TX_FF_UR | GM_IS_RX_FF_OR); 488 /* 489 * Because mii(4) notify msk(4) that it detected link status 490 * change, there is no need to enable automatic --- 42 unchanged lines hidden (view full) --- 533 } else { 534 /* 535 * Link state changed to down. 536 * Disable PHY interrupts. 537 */ 538 msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0); 539 /* Disable Rx/Tx MAC. */ 540 gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); | 497 498 if ((sc_if->msk_flags & MSK_FLAG_LINK) != 0) { 499 /* Enable Tx FIFO Underrun. */ 500 CSR_WRITE_1(sc, MR_ADDR(sc_if->msk_port, GMAC_IRQ_MSK), 501 GM_IS_TX_FF_UR | GM_IS_RX_FF_OR); 502 /* 503 * Because mii(4) notify msk(4) that it detected link status 504 * change, there is no need to enable automatic --- 42 unchanged lines hidden (view full) --- 547 } else { 548 /* 549 * Link state changed to down. 550 * Disable PHY interrupts. 551 */ 552 msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0); 553 /* Disable Rx/Tx MAC. */ 554 gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); |
541 gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); 542 GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); 543 /* Read again to ensure writing. */ 544 GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); | 555 if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) { 556 gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); 557 GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac); 558 /* Read again to ensure writing. */ 559 GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL); 560 } |
545 } 546} 547 548static void 549msk_rxfilter(struct msk_if_softc *sc_if) 550{ 551 struct msk_softc *sc; 552 struct ifnet *ifp; --- 3696 unchanged lines hidden --- | 561 } 562} 563 564static void 565msk_rxfilter(struct msk_if_softc *sc_if) 566{ 567 struct msk_softc *sc; 568 struct ifnet *ifp; --- 3696 unchanged lines hidden --- |