svn commit: r226696 - head/sys/dev/dc

2011-10-24 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 24 17:09:22 2011
New Revision: 226696
URL: http://svn.freebsd.org/changeset/base/226696

Log:
  Add missing bus_dmamap_sync() in setup frame transmit.
  
  MFC after:3 days

Modified:
  head/sys/dev/dc/if_dc.c

Modified: head/sys/dev/dc/if_dc.c
==
--- head/sys/dev/dc/if_dc.c Mon Oct 24 17:05:59 2011(r226695)
+++ head/sys/dev/dc/if_dc.c Mon Oct 24 17:09:22 2011(r226696)
@@ -1136,6 +1136,8 @@ dc_setfilt_21143(struct dc_softc *sc)
sp[41] = DC_SP_MAC(eaddr[2]);
 
sframe->dc_status = htole32(DC_TXSTAT_OWN);
+   bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD |
+   BUS_DMASYNC_PREWRITE);
bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE);
CSR_WRITE_4(sc, DC_TXSTART, 0x);
 
@@ -1342,6 +1344,8 @@ dc_setfilt_xircom(struct dc_softc *sc)
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_TX_ON);
DC_SETBIT(sc, DC_NETCFG, DC_NETCFG_RX_ON);
sframe->dc_status = htole32(DC_TXSTAT_OWN);
+   bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_PREREAD |
+   BUS_DMASYNC_PREWRITE);
bus_dmamap_sync(sc->dc_stag, sc->dc_smap, BUS_DMASYNC_PREWRITE);
CSR_WRITE_4(sc, DC_TXSTART, 0x);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r226695 - head/sys/dev/dc

2011-10-24 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 24 17:05:59 2011
New Revision: 226695
URL: http://svn.freebsd.org/changeset/base/226695

Log:
  Fix a regression introduced in r218832. For TX status check, driver
  should use a TX list DMA tag.
  
  MFC after:3 days

Modified:
  head/sys/dev/dc/if_dc.c

Modified: head/sys/dev/dc/if_dc.c
==
--- head/sys/dev/dc/if_dc.c Mon Oct 24 15:50:23 2011(r226694)
+++ head/sys/dev/dc/if_dc.c Mon Oct 24 17:05:59 2011(r226695)
@@ -2970,7 +2970,7 @@ dc_txeof(struct dc_softc *sc)
 * Go through our tx list and free mbufs for those
 * frames that have been transmitted.
 */
-   bus_dmamap_sync(sc->dc_rx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_POSTREAD |
+   bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap, BUS_DMASYNC_POSTREAD |
BUS_DMASYNC_POSTWRITE);
setup = 0;
for (idx = sc->dc_cdata.dc_tx_cons; idx != sc->dc_cdata.dc_tx_prod;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r226481 - head/sys/dev/et

2011-10-17 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 17 20:03:38 2011
New Revision: 226481
URL: http://svn.freebsd.org/changeset/base/226481

Log:
  Make sure to report media change status to caller. Previously it
  always reported success.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==
--- head/sys/dev/et/if_et.c Mon Oct 17 19:58:34 2011(r226480)
+++ head/sys/dev/et/if_et.c Mon Oct 17 20:03:38 2011(r226481)
@@ -518,9 +518,7 @@ et_ifmedia_upd_locked(struct ifnet *ifp)
 
LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
PHY_RESET(miisc);
-   mii_mediachg(mii);
-
-   return (0);
+   return (mii_mediachg(mii));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r226480 - head/sys/dev/et

2011-10-17 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 17 19:58:34 2011
New Revision: 226480
URL: http://svn.freebsd.org/changeset/base/226480

Log:
  Add missing driver lock in media status handler.

Modified:
  head/sys/dev/et/if_et.c

Modified: head/sys/dev/et/if_et.c
==
--- head/sys/dev/et/if_et.c Mon Oct 17 19:51:38 2011(r226479)
+++ head/sys/dev/et/if_et.c Mon Oct 17 19:58:34 2011(r226480)
@@ -542,9 +542,11 @@ et_ifmedia_sts(struct ifnet *ifp, struct
struct et_softc *sc = ifp->if_softc;
struct mii_data *mii = device_get_softc(sc->sc_miibus);
 
+   ET_LOCK(sc);
mii_pollstat(mii);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   ET_UNLOCK(sc);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r226479 - head/sys/dev/usb/net

2011-10-17 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 17 19:51:38 2011
New Revision: 226479
URL: http://svn.freebsd.org/changeset/base/226479

Log:
  Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
  Because driver is accessing a common MII structure in
  mii_pollstat(), updating user supplied structure should be done
  before dropping a driver lock.
  
  Reported by:  Karim (fodillemlinkarimi <> gmail dot com)

Modified:
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_mos.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c

Modified: head/sys/dev/usb/net/if_aue.c
==
--- head/sys/dev/usb/net/if_aue.c   Mon Oct 17 19:49:00 2011
(r226478)
+++ head/sys/dev/usb/net/if_aue.c   Mon Oct 17 19:51:38 2011
(r226479)
@@ -1032,9 +1032,9 @@ aue_ifmedia_sts(struct ifnet *ifp, struc
 
AUE_LOCK(sc);
mii_pollstat(mii);
-   AUE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   AUE_UNLOCK(sc);
 }
 
 /*

Modified: head/sys/dev/usb/net/if_axe.c
==
--- head/sys/dev/usb/net/if_axe.c   Mon Oct 17 19:49:00 2011
(r226478)
+++ head/sys/dev/usb/net/if_axe.c   Mon Oct 17 19:51:38 2011
(r226479)
@@ -452,9 +452,9 @@ axe_ifmedia_sts(struct ifnet *ifp, struc
 
AXE_LOCK(sc);
mii_pollstat(mii);
-   AXE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   AXE_UNLOCK(sc);
 }
 
 static void

Modified: head/sys/dev/usb/net/if_mos.c
==
--- head/sys/dev/usb/net/if_mos.c   Mon Oct 17 19:49:00 2011
(r226478)
+++ head/sys/dev/usb/net/if_mos.c   Mon Oct 17 19:51:38 2011
(r226479)
@@ -551,10 +551,10 @@ mos_ifmedia_sts(struct ifnet *ifp, struc
 
MOS_LOCK(sc);
mii_pollstat(mii);
-   MOS_UNLOCK(sc);
 
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   MOS_UNLOCK(sc);
 }
 
 static void

Modified: head/sys/dev/usb/net/if_rue.c
==
--- head/sys/dev/usb/net/if_rue.c   Mon Oct 17 19:49:00 2011
(r226478)
+++ head/sys/dev/usb/net/if_rue.c   Mon Oct 17 19:51:38 2011
(r226479)
@@ -889,9 +889,9 @@ rue_ifmedia_sts(struct ifnet *ifp, struc
 
RUE_LOCK(sc);
mii_pollstat(mii);
-   RUE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   RUE_UNLOCK(sc);
 }
 
 static void

Modified: head/sys/dev/usb/net/if_udav.c
==
--- head/sys/dev/usb/net/if_udav.c  Mon Oct 17 19:49:00 2011
(r226478)
+++ head/sys/dev/usb/net/if_udav.c  Mon Oct 17 19:51:38 2011
(r226479)
@@ -751,9 +751,9 @@ udav_ifmedia_status(struct ifnet *ifp, s
 
UDAV_LOCK(sc);
mii_pollstat(mii);
-   UDAV_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   UDAV_UNLOCK(sc);
 }
 
 static void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r226478 - in head/sys: dev/age dev/alc dev/ale dev/lge dev/msk dev/nfe dev/nge dev/nve dev/re dev/sge dev/sis dev/vge dev/vr dev/vte mips/atheros mips/idt pci

2011-10-17 Thread Pyun YongHyeon
Author: yongari
Date: Mon Oct 17 19:49:00 2011
New Revision: 226478
URL: http://svn.freebsd.org/changeset/base/226478

Log:
  Close a race where SIOCGIFMEDIA ioctl get inconsistent link status.
  Because driver is accessing a common MII structure in
  mii_pollstat(), updating user supplied structure should be done
  before dropping a driver lock.
  
  Reported by:  Karim (fodillemlinkarimi <> gmail dot com)

Modified:
  head/sys/dev/age/if_age.c
  head/sys/dev/alc/if_alc.c
  head/sys/dev/ale/if_ale.c
  head/sys/dev/lge/if_lge.c
  head/sys/dev/msk/if_msk.c
  head/sys/dev/nfe/if_nfe.c
  head/sys/dev/nge/if_nge.c
  head/sys/dev/nve/if_nve.c
  head/sys/dev/re/if_re.c
  head/sys/dev/sge/if_sge.c
  head/sys/dev/sis/if_sis.c
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vr/if_vr.c
  head/sys/dev/vte/if_vte.c
  head/sys/mips/atheros/if_arge.c
  head/sys/mips/idt/if_kr.c
  head/sys/pci/if_rl.c

Modified: head/sys/dev/age/if_age.c
==
--- head/sys/dev/age/if_age.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/age/if_age.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -282,9 +282,9 @@ age_mediastatus(struct ifnet *ifp, struc
mii = device_get_softc(sc->age_miibus);
 
mii_pollstat(mii);
-   AGE_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+   AGE_UNLOCK(sc);
 }
 
 /*

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/alc/if_alc.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -349,9 +349,9 @@ alc_mediastatus(struct ifnet *ifp, struc
mii = device_get_softc(sc->alc_miibus);
 
mii_pollstat(mii);
-   ALC_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+   ALC_UNLOCK(sc);
 }
 
 static int

Modified: head/sys/dev/ale/if_ale.c
==
--- head/sys/dev/ale/if_ale.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/ale/if_ale.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -270,9 +270,9 @@ ale_mediastatus(struct ifnet *ifp, struc
mii = device_get_softc(sc->ale_miibus);
 
mii_pollstat(mii);
-   ALE_UNLOCK(sc);
ifmr->ifm_status = mii->mii_media_status;
ifmr->ifm_active = mii->mii_media_active;
+   ALE_UNLOCK(sc);
 }
 
 static int

Modified: head/sys/dev/lge/if_lge.c
==
--- head/sys/dev/lge/if_lge.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/lge/if_lge.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -1430,9 +1430,9 @@ lge_ifmedia_sts(ifp, ifmr)
LGE_LOCK(sc);
mii = device_get_softc(sc->lge_miibus);
mii_pollstat(mii);
-   LGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   LGE_UNLOCK(sc);
 
return;
 }

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/msk/if_msk.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -995,9 +995,9 @@ msk_mediastatus(struct ifnet *ifp, struc
mii = device_get_softc(sc_if->msk_miibus);
 
mii_pollstat(mii);
-   MSK_IF_UNLOCK(sc_if);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   MSK_IF_UNLOCK(sc_if);
 }
 
 static int

Modified: head/sys/dev/nfe/if_nfe.c
==
--- head/sys/dev/nfe/if_nfe.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/nfe/if_nfe.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -2952,10 +2952,10 @@ nfe_ifmedia_sts(struct ifnet *ifp, struc
NFE_LOCK(sc);
mii = device_get_softc(sc->nfe_miibus);
mii_pollstat(mii);
-   NFE_UNLOCK(sc);
 
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   NFE_UNLOCK(sc);
 }
 
 

Modified: head/sys/dev/nge/if_nge.c
==
--- head/sys/dev/nge/if_nge.c   Mon Oct 17 19:40:26 2011(r226477)
+++ head/sys/dev/nge/if_nge.c   Mon Oct 17 19:49:00 2011(r226478)
@@ -2417,9 +2417,9 @@ nge_mediastatus(struct ifnet *ifp, struc
NGE_LOCK(sc);
mii = device_get_softc(sc->nge_miibus);
mii_pollstat(mii);
-   NGE_UNLOCK(sc);
ifmr->ifm_active = mii->mii_media_active;
ifmr->ifm_status = mii->mii_media_status;
+   NGE_UNLOCK(sc);
 }
 
 static int

Modified: head/sys/dev/nve/if_nve.c
=

svn commit: r226123 - head/sys/dev/bce

2011-10-07 Thread Pyun YongHyeon
Author: yongari
Date: Sat Oct  8 00:00:54 2011
New Revision: 226123
URL: http://svn.freebsd.org/changeset/base/226123

Log:
  BCE_MISC_ID register of BCM5716 returns the same id of BCM5709 so
  remove explicit checks for BCM5716.
  The BCM5709 and BCM5716 chips are virtually indistinguishable by
  software except for the PCI device ID.  The two chips differ in
  that BCM5709 supports TCP/IP and iSCSI offload in Windows while
  the BCM5716 doesn't.
  While I'm here remove now unused definition of BCE_CHIP_NUM_5716
  and BCE_CHIP_ID_5716_C0.
  
  Reported by:  sbruno
  Reviewed by:  davidch
  Tested by:davidch

Modified:
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcereg.h

Modified: head/sys/dev/bce/if_bce.c
==
--- head/sys/dev/bce/if_bce.c   Fri Oct  7 23:43:51 2011(r226122)
+++ head/sys/dev/bce/if_bce.c   Sat Oct  8 00:00:54 2011(r226123)
@@ -1112,8 +1112,7 @@ bce_attach(device_t dev)
DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI "
"interrupt.\n", __FUNCTION__);
sc->bce_flags |= BCE_USING_MSI_FLAG;
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716))
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709)
sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG;
sc->bce_irq_rid = 1;
sc->bce_intr = bce_intr;
@@ -1730,8 +1729,7 @@ bce_ctx_rd(struct bce_softc *sc, u32 cid
 
offset = ctx_offset + cid_addr;
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
 
REG_WR(sc, BCE_CTX_CTX_CTRL, (offset | 
BCE_CTX_CTX_CTRL_READ_REQ));
 
@@ -1783,8 +1781,7 @@ bce_ctx_wr(struct bce_softc *sc, u32 cid
BCE_PRINTF("%s(): Invalid CID address: 0x%08X.\n",
__FUNCTION__, cid_addr));
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
 
REG_WR(sc, BCE_CTX_CTX_DATA, ctx_val);
REG_WR(sc, BCE_CTX_CTX_CTRL, (offset | 
BCE_CTX_CTX_CTRL_WRITE_REQ));
@@ -2469,8 +2466,7 @@ bce_init_nvram(struct bce_softc *sc)
 
DBENTER(BCE_VERBOSE_NVRAM);
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
sc->bce_flash_info = &flash_5709;
goto bce_init_nvram_get_flash_size;
}
@@ -3224,8 +3220,7 @@ bce_dma_free(struct bce_softc *sc)
 
 
/* Free, unmap and destroy all context memory pages. */
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
for (i = 0; i < sc->ctx_pages; i++ ) {
if (sc->ctx_block[i] != NULL) {
bus_dmamem_free(
@@ -3564,8 +3559,7 @@ bce_dma_alloc(device_t dev)
__FUNCTION__, (uintmax_t) sc->stats_block_paddr);
 
/* BCM5709 uses host memory as cache for context memory. */
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
sc->ctx_pages = 0x2000 / BCM_PAGE_SIZE;
if (sc->ctx_pages == 0)
sc->ctx_pages = 1;
@@ -4206,8 +4200,7 @@ bce_init_rxp_cpu(struct bce_softc *sc)
cpu_reg.spad_base = BCE_RXP_SCRATCH;
cpu_reg.mips_view_base = 0x800;
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
fw.ver_major = bce_RXP_b09FwReleaseMajor;
fw.ver_minor = bce_RXP_b09FwReleaseMinor;
fw.ver_fix = bce_RXP_b09FwReleaseFix;
@@ -4305,8 +4298,7 @@ bce_init_txp_cpu(struct bce_softc *sc)
cpu_reg.spad_base = BCE_TXP_SCRATCH;
cpu_reg.mips_view_base = 0x800;
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) {
fw.ver_major = bce_TXP_b09FwReleaseMajor;
fw.ver_minor = bce_TXP_b09FwReleaseMinor;
fw.ver_fix = bce_TXP_b09FwReleaseFix;
@@ -4403,8 +4395,7 @@ bce_init_tpat_cpu(struct bce_softc *sc)
cpu_reg.spad_base = BCE_TPAT_SCRATCH;
cpu_reg.mips_view_base = 0x800;
 
-   if ((BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5709) ||
-   (BCE_CHIP_NUM(sc) == BCE_CHIP_NUM_5716)) {
+   if (BCE_CHIP

svn commit: r225595 - stable/7/sys/dev/vge

2011-09-15 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep 15 17:22:38 2011
New Revision: 225595
URL: http://svn.freebsd.org/changeset/base/225595

Log:
  MFC r225440:
vge(4) hardwares poll media status and generates an interrupt
whenever the link state is changed.  Using software based polling
for media status tracking is known to cause MII access failure
under certain conditions once link is established so vge(4) used to
rely on link status change interrupt.
However DEVICE_POLLING completely disables generation of all kind
of interrupts on vge(4) such that this resulted in not detecting
link state change event.  This means vge(4) does not correctly
detect established/lost link with DEVICE_POLLING.  Losing the
interrupt made vge(4) not to send any packets to peer since vge(4)
does not try to send any packets when there is no established link.
  
Work around the issue by generating link state change interrupt
with DEVICE_POLLING.
  
PR: kern/160442

Modified:
  stable/7/sys/dev/vge/if_vge.c
  stable/7/sys/dev/vge/if_vgereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/vge/if_vge.c
==
--- stable/7/sys/dev/vge/if_vge.c   Thu Sep 15 17:20:20 2011
(r225594)
+++ stable/7/sys/dev/vge/if_vge.c   Thu Sep 15 17:22:38 2011
(r225595)
@@ -1753,6 +1753,10 @@ vge_intr(void *arg)
 
 #ifdef DEVICE_POLLING
if  (ifp->if_capenable & IFCAP_POLLING) {
+   status = CSR_READ_4(sc, VGE_ISR);
+   CSR_WRITE_4(sc, VGE_ISR, status);
+   if (status != 0x && (status & VGE_ISR_LINKSTS) != 0)
+   vge_link_statchg(sc);
VGE_UNLOCK(sc);
return;
}
@@ -2110,11 +2114,10 @@ vge_init_locked(struct vge_softc *sc)
 
 #ifdef DEVICE_POLLING
/*
-* Disable interrupts if we are polling.
+* Disable interrupts except link state change if we are polling.
 */
if (ifp->if_capenable & IFCAP_POLLING) {
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
} else  /* otherwise ... */
 #endif
{
@@ -2122,9 +2125,9 @@ vge_init_locked(struct vge_softc *sc)
 * Enable interrupts.
 */
CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS);
-   CSR_WRITE_4(sc, VGE_ISR, 0x);
-   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
}
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
 
sc->vge_flags &= ~VGE_FLAG_LINK;
mii_mediachg(mii);
@@ -2281,8 +2284,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm
return (error);
VGE_LOCK(sc);
/* Disable interrupts */
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
ifp->if_capenable |= IFCAP_POLLING;
VGE_UNLOCK(sc);
} else {

Modified: stable/7/sys/dev/vge/if_vgereg.h
==
--- stable/7/sys/dev/vge/if_vgereg.hThu Sep 15 17:20:20 2011
(r225594)
+++ stable/7/sys/dev/vge/if_vgereg.hThu Sep 15 17:22:38 2011
(r225595)
@@ -302,6 +302,8 @@
 VGE_ISR_LINKSTS|VGE_ISR_RXNODESC|  \
 VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL)
 
+#define VGE_INTRS_POLLING  (VGE_ISR_PHYINT|VGE_ISR_LINKSTS)
+
 /* Interrupt mask register */
 
 #define VGE_IMR_RXOK_HIPRIO0x0001 /* hi prio RX int */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225594 - stable/8/sys/dev/vge

2011-09-15 Thread Pyun YongHyeon
Author: yongari
Date: Thu Sep 15 17:20:20 2011
New Revision: 225594
URL: http://svn.freebsd.org/changeset/base/225594

Log:
  MFC r225440:
vge(4) hardwares poll media status and generates an interrupt
whenever the link state is changed.  Using software based polling
for media status tracking is known to cause MII access failure
under certain conditions once link is established so vge(4) used to
rely on link status change interrupt.
However DEVICE_POLLING completely disables generation of all kind
of interrupts on vge(4) such that this resulted in not detecting
link state change event.  This means vge(4) does not correctly
detect established/lost link with DEVICE_POLLING.  Losing the
interrupt made vge(4) not to send any packets to peer since vge(4)
does not try to send any packets when there is no established link.
  
Work around the issue by generating link state change interrupt
with DEVICE_POLLING.
  
PR: kern/160442

Modified:
  stable/8/sys/dev/vge/if_vge.c
  stable/8/sys/dev/vge/if_vgereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/vge/if_vge.c
==
--- stable/8/sys/dev/vge/if_vge.c   Thu Sep 15 17:11:03 2011
(r225593)
+++ stable/8/sys/dev/vge/if_vge.c   Thu Sep 15 17:20:20 2011
(r225594)
@@ -1752,6 +1752,10 @@ vge_intr(void *arg)
 
 #ifdef DEVICE_POLLING
if  (ifp->if_capenable & IFCAP_POLLING) {
+   status = CSR_READ_4(sc, VGE_ISR);
+   CSR_WRITE_4(sc, VGE_ISR, status);
+   if (status != 0x && (status & VGE_ISR_LINKSTS) != 0)
+   vge_link_statchg(sc);
VGE_UNLOCK(sc);
return;
}
@@ -2109,11 +2113,10 @@ vge_init_locked(struct vge_softc *sc)
 
 #ifdef DEVICE_POLLING
/*
-* Disable interrupts if we are polling.
+* Disable interrupts except link state change if we are polling.
 */
if (ifp->if_capenable & IFCAP_POLLING) {
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
} else  /* otherwise ... */
 #endif
{
@@ -2121,9 +2124,9 @@ vge_init_locked(struct vge_softc *sc)
 * Enable interrupts.
 */
CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS);
-   CSR_WRITE_4(sc, VGE_ISR, 0x);
-   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
}
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
 
sc->vge_flags &= ~VGE_FLAG_LINK;
mii_mediachg(mii);
@@ -2280,8 +2283,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm
return (error);
VGE_LOCK(sc);
/* Disable interrupts */
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
ifp->if_capenable |= IFCAP_POLLING;
VGE_UNLOCK(sc);
} else {

Modified: stable/8/sys/dev/vge/if_vgereg.h
==
--- stable/8/sys/dev/vge/if_vgereg.hThu Sep 15 17:11:03 2011
(r225593)
+++ stable/8/sys/dev/vge/if_vgereg.hThu Sep 15 17:20:20 2011
(r225594)
@@ -302,6 +302,8 @@
 VGE_ISR_LINKSTS|VGE_ISR_RXNODESC|  \
 VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL)
 
+#define VGE_INTRS_POLLING  (VGE_ISR_PHYINT|VGE_ISR_LINKSTS)
+
 /* Interrupt mask register */
 
 #define VGE_IMR_RXOK_HIPRIO0x0001 /* hi prio RX int */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225440 - head/sys/dev/vge

2011-09-07 Thread Pyun YongHyeon
Author: yongari
Date: Wed Sep  7 16:57:43 2011
New Revision: 225440
URL: http://svn.freebsd.org/changeset/base/225440

Log:
  vge(4) hardwares poll media status and generates an interrupt
  whenever the link state is changed.  Using software based polling
  for media status tracking is known to cause MII access failure
  under certain conditions once link is established so vge(4) used to
  rely on link status change interrupt.
  However DEVICE_POLLING completely disables generation of all kind
  of interrupts on vge(4) such that this resulted in not detecting
  link state change event.  This means vge(4) does not correctly
  detect established/lost link with DEVICE_POLLING.  Losing the
  interrupt made vge(4) not to send any packets to peer since vge(4)
  does not try to send any packets when there is no established link.
  
  Work around the issue by generating link state change interrupt
  with DEVICE_POLLING.
  
  PR:   kern/160442
  Approved by:  re (kib)

Modified:
  head/sys/dev/vge/if_vge.c
  head/sys/dev/vge/if_vgereg.h

Modified: head/sys/dev/vge/if_vge.c
==
--- head/sys/dev/vge/if_vge.c   Wed Sep  7 14:37:51 2011(r225439)
+++ head/sys/dev/vge/if_vge.c   Wed Sep  7 16:57:43 2011(r225440)
@@ -1752,6 +1752,10 @@ vge_intr(void *arg)
 
 #ifdef DEVICE_POLLING
if  (ifp->if_capenable & IFCAP_POLLING) {
+   status = CSR_READ_4(sc, VGE_ISR);
+   CSR_WRITE_4(sc, VGE_ISR, status);
+   if (status != 0x && (status & VGE_ISR_LINKSTS) != 0)
+   vge_link_statchg(sc);
VGE_UNLOCK(sc);
return;
}
@@ -2109,11 +2113,10 @@ vge_init_locked(struct vge_softc *sc)
 
 #ifdef DEVICE_POLLING
/*
-* Disable interrupts if we are polling.
+* Disable interrupts except link state change if we are polling.
 */
if (ifp->if_capenable & IFCAP_POLLING) {
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
} else  /* otherwise ... */
 #endif
{
@@ -2121,9 +2124,9 @@ vge_init_locked(struct vge_softc *sc)
 * Enable interrupts.
 */
CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS);
-   CSR_WRITE_4(sc, VGE_ISR, 0x);
-   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
}
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
 
sc->vge_flags &= ~VGE_FLAG_LINK;
mii_mediachg(mii);
@@ -2280,8 +2283,9 @@ vge_ioctl(struct ifnet *ifp, u_long comm
return (error);
VGE_LOCK(sc);
/* Disable interrupts */
-   CSR_WRITE_4(sc, VGE_IMR, 0);
-   CSR_WRITE_1(sc, VGE_CRC3, VGE_CR3_INT_GMSK);
+   CSR_WRITE_4(sc, VGE_IMR, VGE_INTRS_POLLING);
+   CSR_WRITE_4(sc, VGE_ISR, 0x);
+   CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
ifp->if_capenable |= IFCAP_POLLING;
VGE_UNLOCK(sc);
} else {

Modified: head/sys/dev/vge/if_vgereg.h
==
--- head/sys/dev/vge/if_vgereg.hWed Sep  7 14:37:51 2011
(r225439)
+++ head/sys/dev/vge/if_vgereg.hWed Sep  7 16:57:43 2011
(r225440)
@@ -302,6 +302,8 @@
 VGE_ISR_LINKSTS|VGE_ISR_RXNODESC|  \
 VGE_ISR_RXDMA_STALL|VGE_ISR_TXDMA_STALL)
 
+#define VGE_INTRS_POLLING  (VGE_ISR_PHYINT|VGE_ISR_LINKSTS)
+
 /* Interrupt mask register */
 
 #define VGE_IMR_RXOK_HIPRIO0x0001 /* hi prio RX int */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225269 - stable/7/sys/dev/alc

2011-08-30 Thread Pyun YongHyeon
Author: yongari
Date: Tue Aug 30 17:21:55 2011
New Revision: 225269
URL: http://svn.freebsd.org/changeset/base/225269

Log:
  MFC r225088:
Disable PHY hibernation until I get more detailed hibernation
programming secret.  The PHY would go into sleep state when it
detects no established link and it will re-establish link when the
cable is plugged in.  Previously it failed to re-establish link
when the cable is plugged in such that it required to manually down
and up the interface again to make it work.  This came from
incorrectly programmed hibernation parameters.  According to
Atheros, each PHY chip requires different configuration for
hibernation and different vendor has different settings for the
same chip.
Disabling hibernation may consume more power but establishing link
looks more important than saving power.
Special thanks to Atheros for giving me instructions that disable
hibernation.
  
PR: kern/148772

Modified:
  stable/7/sys/dev/alc/if_alc.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/alc/if_alc.c
==
--- stable/7/sys/dev/alc/if_alc.c   Tue Aug 30 17:20:34 2011
(r225268)
+++ stable/7/sys/dev/alc/if_alc.c   Tue Aug 30 17:21:55 2011
(r225269)
@@ -534,13 +534,11 @@ alc_phy_reset(struct alc_softc *sc)
uint16_t data;
 
/* Reset magic from Linux. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | GPHY_CFG_SEL_ANA_RESET);
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
 
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
@@ -625,6 +623,23 @@ alc_phy_reset(struct alc_softc *sc)
alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr,
ALC_MII_DBG_DATA, data);
DELAY(1000);
+
+   /* Disable hibernation. */
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x0029);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
+
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x000B);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
 }
 
 static void
@@ -650,8 +665,7 @@ alc_phy_down(struct alc_softc *sc)
break;
default:
/* Force PHY down. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ |
GPHY_CFG_PWDOWN_HW);
DELAY(1000);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225268 - stable/8/sys/dev/alc

2011-08-30 Thread Pyun YongHyeon
Author: yongari
Date: Tue Aug 30 17:20:34 2011
New Revision: 225268
URL: http://svn.freebsd.org/changeset/base/225268

Log:
  MFC r225088:
Disable PHY hibernation until I get more detailed hibernation
programming secret.  The PHY would go into sleep state when it
detects no established link and it will re-establish link when the
cable is plugged in.  Previously it failed to re-establish link
when the cable is plugged in such that it required to manually down
and up the interface again to make it work.  This came from
incorrectly programmed hibernation parameters.  According to
Atheros, each PHY chip requires different configuration for
hibernation and different vendor has different settings for the
same chip.
Disabling hibernation may consume more power but establishing link
looks more important than saving power.
Special thanks to Atheros for giving me instructions that disable
hibernation.
  
PR: kern/148772

Modified:
  stable/8/sys/dev/alc/if_alc.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/alc/if_alc.c
==
--- stable/8/sys/dev/alc/if_alc.c   Tue Aug 30 16:52:25 2011
(r225267)
+++ stable/8/sys/dev/alc/if_alc.c   Tue Aug 30 17:20:34 2011
(r225268)
@@ -534,13 +534,11 @@ alc_phy_reset(struct alc_softc *sc)
uint16_t data;
 
/* Reset magic from Linux. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | GPHY_CFG_SEL_ANA_RESET);
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
 
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
@@ -625,6 +623,23 @@ alc_phy_reset(struct alc_softc *sc)
alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr,
ALC_MII_DBG_DATA, data);
DELAY(1000);
+
+   /* Disable hibernation. */
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x0029);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
+
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x000B);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
 }
 
 static void
@@ -650,8 +665,7 @@ alc_phy_down(struct alc_softc *sc)
break;
default:
/* Force PHY down. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ |
GPHY_CFG_PWDOWN_HW);
DELAY(1000);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r225088 - head/sys/dev/alc

2011-08-22 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 22 20:33:05 2011
New Revision: 225088
URL: http://svn.freebsd.org/changeset/base/225088

Log:
  Disable PHY hibernation until I get more detailed hibernation
  programming secret.  The PHY would go into sleep state when it
  detects no established link and it will re-establish link when the
  cable is plugged in.  Previously it failed to re-establish link
  when the cable is plugged in such that it required to manually down
  and up the interface again to make it work.  This came from
  incorrectly programmed hibernation parameters.  According to
  Atheros, each PHY chip requires different configuration for
  hibernation and different vendor has different settings for the
  same chip.
  Disabling hibernation may consume more power but establishing link
  looks more important than saving power.
  Special thanks to Atheros for giving me instructions that disable
  hibernation.
  
  MFC after:1 week
  Approved by:  re (kib)

Modified:
  head/sys/dev/alc/if_alc.c

Modified: head/sys/dev/alc/if_alc.c
==
--- head/sys/dev/alc/if_alc.c   Mon Aug 22 20:25:55 2011(r225087)
+++ head/sys/dev/alc/if_alc.c   Mon Aug 22 20:33:05 2011(r225088)
@@ -532,13 +532,11 @@ alc_phy_reset(struct alc_softc *sc)
uint16_t data;
 
/* Reset magic from Linux. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE | GPHY_CFG_SEL_ANA_RESET);
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
 
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET);
CSR_READ_2(sc, ALC_GPHY_CFG);
DELAY(10 * 1000);
@@ -623,6 +621,23 @@ alc_phy_reset(struct alc_softc *sc)
alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr,
ALC_MII_DBG_DATA, data);
DELAY(1000);
+
+   /* Disable hibernation. */
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x0029);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
+
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_ADDR,
+   0x000B);
+   data = alc_miibus_readreg(sc->alc_dev, sc->alc_phyaddr,
+   ALC_MII_DBG_DATA);
+   data &= ~0x8000;
+   alc_miibus_writereg(sc->alc_dev, sc->alc_phyaddr, ALC_MII_DBG_DATA,
+   data);
 }
 
 static void
@@ -648,8 +663,7 @@ alc_phy_down(struct alc_softc *sc)
break;
default:
/* Force PHY down. */
-   CSR_WRITE_2(sc, ALC_GPHY_CFG,
-   GPHY_CFG_EXT_RESET | GPHY_CFG_HIB_EN | GPHY_CFG_HIB_PULSE |
+   CSR_WRITE_2(sc, ALC_GPHY_CFG, GPHY_CFG_EXT_RESET |
GPHY_CFG_SEL_ANA_RESET | GPHY_CFG_PHY_IDDQ |
GPHY_CFG_PWDOWN_HW);
DELAY(1000);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224892 - in stable/7/sys: dev/re pci

2011-08-15 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 15 17:10:23 2011
New Revision: 224892
URL: http://svn.freebsd.org/changeset/base/224892

Log:
  MFC r224506:
Add new device id of D-Link DGE-530T Rev. C controller.  DGE-503T
Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C
controller is re-branded RealTek 8169 controller.
  
PR: kern/159116

Modified:
  stable/7/sys/dev/re/if_re.c
  stable/7/sys/pci/if_rlreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/re/if_re.c
==
--- stable/7/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011(r224891)
+++ stable/7/sys/dev/re/if_re.c Mon Aug 15 17:10:23 2011(r224892)
@@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe
 static struct rl_type re_devs[] = {
{ DLINK_VENDORID, DLINK_DEVICEID_528T, 0,
"D-Link DGE-528(T) Gigabit Ethernet Adapter" },
+   { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0,
+   "D-Link DGE-530(T) Gigabit Ethernet Adapter" },
{ RT_VENDORID, RT_DEVICEID_8139, 0,
"RealTek 8139C+ 10/100BaseTX" },
{ RT_VENDORID, RT_DEVICEID_8101E, 0,

Modified: stable/7/sys/pci/if_rlreg.h
==
--- stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011(r224891)
+++ stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:10:23 2011(r224892)
@@ -1042,6 +1042,7 @@ struct rl_softc {
  * D-Link DFE-5280T device ID
  */
 #defineDLINK_DEVICEID_528T 0x4300
+#defineDLINK_DEVICEID_530T_REVC0x4302
 
 /*
  * D-Link DFE-690TXD device ID
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224891 - in stable/8/sys: dev/re pci

2011-08-15 Thread Pyun YongHyeon
Author: yongari
Date: Mon Aug 15 17:08:54 2011
New Revision: 224891
URL: http://svn.freebsd.org/changeset/base/224891

Log:
  MFC r224506:
Add new device id of D-Link DGE-530T Rev. C controller.  DGE-503T
Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C
controller is re-branded RealTek 8169 controller.
  
PR: kern/159116

Modified:
  stable/8/sys/dev/re/if_re.c
  stable/8/sys/pci/if_rlreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/re/if_re.c
==
--- stable/8/sys/dev/re/if_re.c Mon Aug 15 16:06:28 2011(r224890)
+++ stable/8/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011(r224891)
@@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe
 static struct rl_type re_devs[] = {
{ DLINK_VENDORID, DLINK_DEVICEID_528T, 0,
"D-Link DGE-528(T) Gigabit Ethernet Adapter" },
+   { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0,
+   "D-Link DGE-530(T) Gigabit Ethernet Adapter" },
{ RT_VENDORID, RT_DEVICEID_8139, 0,
"RealTek 8139C+ 10/100BaseTX" },
{ RT_VENDORID, RT_DEVICEID_8101E, 0,

Modified: stable/8/sys/pci/if_rlreg.h
==
--- stable/8/sys/pci/if_rlreg.h Mon Aug 15 16:06:28 2011(r224890)
+++ stable/8/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011(r224891)
@@ -1042,6 +1042,7 @@ struct rl_softc {
  * D-Link DFE-5280T device ID
  */
 #defineDLINK_DEVICEID_528T 0x4300
+#defineDLINK_DEVICEID_530T_REVC0x4302
 
 /*
  * D-Link DFE-690TXD device ID
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224506 - in head/sys: dev/re pci

2011-07-29 Thread Pyun YongHyeon
Author: yongari
Date: Sat Jul 30 01:06:12 2011
New Revision: 224506
URL: http://svn.freebsd.org/changeset/base/224506

Log:
  Add new device id of D-Link DGE-530T Rev. C controller.  DGE-503T
  Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C
  controller is re-branded RealTek 8169 controller.
  
  PR:   kern/159116
  Approved by:  re (kib)

Modified:
  head/sys/dev/re/if_re.c
  head/sys/pci/if_rlreg.h

Modified: head/sys/dev/re/if_re.c
==
--- head/sys/dev/re/if_re.c Sat Jul 30 00:52:13 2011(r224505)
+++ head/sys/dev/re/if_re.c Sat Jul 30 01:06:12 2011(r224506)
@@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe
 static struct rl_type re_devs[] = {
{ DLINK_VENDORID, DLINK_DEVICEID_528T, 0,
"D-Link DGE-528(T) Gigabit Ethernet Adapter" },
+   { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0,
+   "D-Link DGE-530(T) Gigabit Ethernet Adapter" },
{ RT_VENDORID, RT_DEVICEID_8139, 0,
"RealTek 8139C+ 10/100BaseTX" },
{ RT_VENDORID, RT_DEVICEID_8101E, 0,

Modified: head/sys/pci/if_rlreg.h
==
--- head/sys/pci/if_rlreg.h Sat Jul 30 00:52:13 2011(r224505)
+++ head/sys/pci/if_rlreg.h Sat Jul 30 01:06:12 2011(r224506)
@@ -1042,6 +1042,7 @@ struct rl_softc {
  * D-Link DFE-5280T device ID
  */
 #defineDLINK_DEVICEID_528T 0x4300
+#defineDLINK_DEVICEID_530T_REVC0x4302
 
 /*
  * D-Link DFE-690TXD device ID
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224402 - stable/7/sys/dev/gem

2011-07-25 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jul 25 20:13:35 2011
New Revision: 224402
URL: http://svn.freebsd.org/changeset/base/224402

Log:
  MFC r224157:
Revert r222135 by allowing controller reinitialization.  Due to
unknown reason Apple UniNorth2 gem(4) device required manual
interface down/up operation after r222135.  Even though this is not
correct thing and I don't like to revert it but it would be better
than breaking gem(4) on PPC.  This should be revisited.
  
PR: kern/157405

Modified:
  stable/7/sys/dev/gem/if_gem.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/gem/if_gem.c
==
--- stable/7/sys/dev/gem/if_gem.c   Mon Jul 25 20:12:31 2011
(r224401)
+++ stable/7/sys/dev/gem/if_gem.c   Mon Jul 25 20:13:35 2011
(r224402)
@@ -947,8 +947,10 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+#ifdef notyet
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
return;
+#endif
 
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224401 - stable/8/sys/dev/gem

2011-07-25 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jul 25 20:12:31 2011
New Revision: 224401
URL: http://svn.freebsd.org/changeset/base/224401

Log:
  MFC r224157:
Revert r222135 by allowing controller reinitialization.  Due to
unknown reason Apple UniNorth2 gem(4) device required manual
interface down/up operation after r222135.  Even though this is not
correct thing and I don't like to revert it but it would be better
than breaking gem(4) on PPC.  This should be revisited.
  
PR: kern/157405

Modified:
  stable/8/sys/dev/gem/if_gem.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/geom/label/   (props changed)

Modified: stable/8/sys/dev/gem/if_gem.c
==
--- stable/8/sys/dev/gem/if_gem.c   Mon Jul 25 20:10:01 2011
(r224400)
+++ stable/8/sys/dev/gem/if_gem.c   Mon Jul 25 20:12:31 2011
(r224401)
@@ -947,8 +947,10 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+#ifdef notyet
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
return;
+#endif
 
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224399 - stable/8/share/man/man4

2011-07-25 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jul 25 20:09:09 2011
New Revision: 224399
URL: http://svn.freebsd.org/changeset/base/224399

Log:
  MFC r224023,224060:
Document AX88772B and AX88760. AX88760 is treated as AX88772A in
driver.
Mention all ASIX USB controllers that are supported by axe(4).
Reword media types and explicly mention AX88178 is the only
controller that supports gigabit link.
While I'm here use shorten model instead of showing all controller
model numbers.

Modified:
  stable/8/share/man/man4/axe.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/axe.4
==
--- stable/8/share/man/man4/axe.4   Mon Jul 25 20:06:18 2011
(r224398)
+++ stable/8/share/man/man4/axe.4   Mon Jul 25 20:09:09 2011
(r224399)
@@ -30,12 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 16, 2011
+.Dd July 14, 2011
 .Dt AXE 4
 .Os
 .Sh NAME
 .Nm axe
-.Nd "ASIX Electronics AX88172/178/772 USB Ethernet driver"
+.Nd "ASIX Electronics AX88x7x/760 USB Ethernet driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -59,12 +59,14 @@ if_axe_load="YES"
 The
 .Nm
 driver provides support for USB Ethernet adapters based on the ASIX
-Electronics AX88172, AX88178 and AX88772 USB 2.0 chipsets.
+Electronics AX88172, AX88178, AX88772, AX88772A, AX88772B and AX88760
+USB 2.0 chipsets.
 .Pp
-The AX88172 and AX88178 are USB 2.0 devices that contain a 10/100
+The AX88172, AX88772, AX88772A, AX88772B and AX88760 contain a 10/100
 Ethernet MAC with MII interface and are designed to work with both
 Ethernet and HomePNA transceivers.
-The AX88772 will additionally support 10/100/1000 MACs.
+The AX88178 has a 10/100/1000 Ethernet MAC with GMII/RGMII interface
+for interfacing with Gigabit Ethernet PHY.
 .Pp
 These devices will operate with
 both USB 1.x and USB 2.0 controllers, however performance with 1.x
@@ -85,43 +87,48 @@ driver supports the following media type
 .It Cm autoselect
 Enable autoselection of the media type and options.
 The user can manually override
-the autoselected mode by adding media options to the
-.Pa /etc/rc.conf
-file.
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
 .It Cm 10baseT/UTP
 Set 10Mbps operation.
 The
+.Xr ifconfig 8
 .Cm mediaopt
-option can also be used to enable
-.Cm full-duplex
-operation.
-Not specifying
+option can also be used to select either
 .Cm full-duplex
-implies
+or
 .Cm half-duplex
-mode.
+modes.
 .It Cm 100baseTX
 Set 100Mbps (Fast Ethernet) operation.
 The
+.Xr ifconfig 8
 .Cm mediaopt
-option can also be used to enable
+option can also be used to select either
 .Cm full-duplex
-operation.
-Not specifying
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseT
+Set 1000Mbps (Gigabit Ethernet) operation (AX88178 only).
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
 .Cm full-duplex
-implies
+or
 .Cm half-duplex
-mode.
+modes.
 .El
 .Pp
 The
 .Nm
 driver supports the following media options:
-.Bl -tag -width ".Cm 10baseT/UTP"
+.Bl -tag -width ".Cm full-duplex"
 .It Cm full-duplex
 Force full duplex operation.
-The interface will operate in
-half duplex mode if this media option is not specified.
+.It Cm half-duplex
+Force half duplex operation.
 .El
 .Pp
 For more information on configuring this device, see
@@ -129,8 +136,8 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver supports ASIX Electronics AX88172/AX88178/AX88772 based USB Ethernet
-adapters including:
+driver supports ASIX Electronics 
AX88172/AX88178/AX88772/AX88772A/AX88772B/AX88760
+based USB Ethernet adapters including:
 .Pp
 AX88172:
 .Bl -bullet -compact
@@ -139,6 +146,8 @@ AboCom UF200
 .It
 Acer Communications EP1427X2
 .It
+ASIX AX88172
+.It
 ATen UC210T
 .It
 Billionton SnapPort
@@ -167,6 +176,8 @@ System TALKS Inc.\& SGC-X2UL
 AX88178:
 .Bl -bullet -compact
 .It
+ASIX AX88178
+.It
 Belkin F5D5055
 .It
 Logitec LAN-GTJ/U2A
@@ -181,9 +192,9 @@ Sitecom Europe LN-028
 AX88772:
 .Bl -bullet -compact
 .It
-Buffalo (Melco Inc.) LUA3-U2-ATX
+ASIX AX88772
 .It
-Cisco-Linksys USB200Mv2
+Buffalo (Melco Inc.) LUA3-U2-ATX
 .It
 D-Link DUBE100B1
 .It
@@ -191,6 +202,26 @@ Planex UE-200TX-G
 .It
 Planex UE-200TX-G2
 .El
+.Pp
+AX88772A:
+.Bl -bullet -compact
+.It
+ASIX AX88772A
+.It
+Cisco-Linksys USB200Mv2
+.El
+.Pp
+AX88772B:
+.Bl -bullet -compact
+.It
+ASIX AX88772B
+.El
+.Pp
+AX88760:
+.Bl -bullet -compact
+.It
+ASIX AX88760
+.El
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "axe%d: watchdog timeout"
@@ -209,7 +240,7 @@ The driver failed to allocate an mbuf fo
 .Xr rgephy 4 ,
 .Xr ifconfig 8
 .Rs
-.%T "ASIX AX88172 AX88178 and AX88772 data sheets"
+.%T "ASIX AX88x7x and AX88760 data sheets"
 .%O http://www.asix.com.tw
 .Re
 .Sh HISTORY
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsu

svn commit: r224398 - in stable/8/sys/dev/usb: . net

2011-07-25 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jul 25 20:06:18 2011
New Revision: 224398
URL: http://svn.freebsd.org/changeset/base/224398

Log:
  MFC r224020:
Add initial support for AX88772B USB Fast Ethernet. AX88772B
supports IPv4/IPv6 checksum offloading and VLAN tag insertion/
stripping as well as WOL.  Because uether does not provide a way
to announce driver specific offload capabilities to upper stack,
checksum offloading support needs more work and will be done in
future.
Special thanks to ASIX for donating sample hardware.
  
H/W donated by: ASIX Electronics
Reviewed by:hselasky

Modified:
  stable/8/sys/dev/usb/net/if_axe.c
  stable/8/sys/dev/usb/net/if_axereg.h
  stable/8/sys/dev/usb/usbdevs
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/geom/label/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Mon Jul 25 19:13:51 2011
(r224397)
+++ stable/8/sys/dev/usb/net/if_axe.c   Mon Jul 25 20:06:18 2011
(r224398)
@@ -142,6 +142,7 @@ static const STRUCT_USB_HOST_ID axe_devs
AXE_DEV(ASIX, AX88178, AXE_FLAG_178),
AXE_DEV(ASIX, AX88772, AXE_FLAG_772),
AXE_DEV(ASIX, AX88772A, AXE_FLAG_772A),
+   AXE_DEV(ASIX, AX88772B, AXE_FLAG_772B),
AXE_DEV(ATEN, UC210T, 0),
AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178),
AXE_DEV(BILLIONTON, USB2AR, 0),
@@ -190,7 +191,9 @@ static void axe_ifmedia_sts(struct ifnet
 static int axe_cmd(struct axe_softc *, int, int, int, void *);
 static voidaxe_ax88178_init(struct axe_softc *);
 static voidaxe_ax88772_init(struct axe_softc *);
+static voidaxe_ax88772_phywake(struct axe_softc *);
 static voidaxe_ax88772a_init(struct axe_softc *);
+static voidaxe_ax88772b_init(struct axe_softc *);
 static int axe_get_phyno(struct axe_softc *, int);
 
 static const struct usb_config axe_config[AXE_N_TRANSFER] = {
@@ -217,6 +220,17 @@ static const struct usb_config axe_confi
},
 };
 
+static const struct ax88772b_mfb ax88772b_mfb_table[] = {
+   { 0x8000, 0x8001, 2048 },
+   { 0x8100, 0x8147, 4096},
+   { 0x8200, 0x81EB, 6144},
+   { 0x8300, 0x83D7, 8192},
+   { 0x8400, 0x851E, 16384},
+   { 0x8500, 0x8666, 20480},
+   { 0x8600, 0x87AE, 24576},
+   { 0x8700, 0x8A3D, 32768}
+};
+
 static device_method_t axe_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, axe_probe),
@@ -671,16 +685,11 @@ axe_ax88772_init(struct axe_softc *sc)
 }
 
 static void
-axe_ax88772a_init(struct axe_softc *sc)
+axe_ax88772_phywake(struct axe_softc *sc)
 {
struct usb_ether *ue;
-   uint16_t eeprom;
 
ue = &sc->sc_ue;
-   axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom);
-   eeprom = le16toh(eeprom);
-   /* Reload EEPROM. */
-   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
if (sc->sc_phyno == AXE_772_PHY_NO_EPHY) {
/* Manually select internal(embedded) PHY - MAC mode. */
axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, AXE_SW_PHY_SELECT_SS_ENB |
@@ -706,6 +715,55 @@ axe_ax88772a_init(struct axe_softc *sc)
uether_pause(&sc->sc_ue, hz / 32);
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPRL, NULL);
uether_pause(&sc->sc_ue, hz / 32);
+}
+
+static void
+axe_ax88772a_init(struct axe_softc *sc)
+{
+   struct usb_ether *ue;
+
+   ue = &sc->sc_ue;
+   /* Reload EEPROM. */
+   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
+   axe_ax88772_phywake(sc);
+   /* Stop MAC. */
+   axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
+}
+
+static void
+axe_ax88772b_init(struct axe_softc *sc)
+{
+   struct usb_ether *ue;
+   uint16_t eeprom;
+   uint8_t *eaddr;
+   int i;
+
+   ue = &sc->sc_ue;
+   /* Reload EEPROM. */
+   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
+   /*
+* Save PHY power saving configuration(high byte) and
+* clear EEPROM checksum value(low byte).
+*/
+   axe_cmd(sc, AXE_CMD_SROM_READ, 0, AXE_EEPROM_772B_PHY_PWRCFG, &eeprom);
+   sc->sc_pwrcfg = le16toh(eeprom) & 0xFF00;
+
+   /*
+* Auto-loaded default station address from internal ROM is
+* 00:00:00:00:00:00 such that an explicit access to EEPROM
+* is required to get real station address.
+*/
+   eaddr = ue->ue_eaddr;
+   for (i = 0; i < ETHER_ADDR_LEN / 2; i++) {
+   axe_cmd(sc, AXE_CMD_SROM_READ, 0, AXE_EEPROM_772B_NODE_ID + i,
+   &eeprom);
+   eeprom = le16toh(eeprom);
+   *eaddr++ = (uint8_t)(eeprom & 0xFF);
+   *eaddr++ = 

svn commit: r224157 - head/sys/dev/gem

2011-07-17 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jul 17 21:54:51 2011
New Revision: 224157
URL: http://svn.freebsd.org/changeset/base/224157

Log:
  Revert r222135 by allowing controller reinitialization.  Due to
  unknown reason Apple UniNorth2 gem(4) device required manual
  interface down/up operation after r222135.  Even though this is not
  correct thing and I don't like to revert it but it would be better
  than breaking gem(4) on PPC.  This should be revisited.
  
  PR:   kern/157405

Modified:
  head/sys/dev/gem/if_gem.c

Modified: head/sys/dev/gem/if_gem.c
==
--- head/sys/dev/gem/if_gem.c   Sun Jul 17 21:53:42 2011(r224156)
+++ head/sys/dev/gem/if_gem.c   Sun Jul 17 21:54:51 2011(r224157)
@@ -947,8 +947,10 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+#ifdef notyet
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
return;
+#endif
 
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224023 - head/share/man/man4

2011-07-14 Thread Pyun YongHyeon
Author: yongari
Date: Thu Jul 14 17:34:59 2011
New Revision: 224023
URL: http://svn.freebsd.org/changeset/base/224023

Log:
  Document AX88772B and AX88760. AX88760 is treated as AX88772A in
  driver.
  Mention all ASIX USB controllers that are supported by axe(4).
  Reword media types and explicly mention AX88178 is the only
  controller that supports gigabit link.
  While I'm here use shorten model instead of showing all controller
  model numbers.

Modified:
  head/share/man/man4/axe.4

Modified: head/share/man/man4/axe.4
==
--- head/share/man/man4/axe.4   Thu Jul 14 17:34:56 2011(r224022)
+++ head/share/man/man4/axe.4   Thu Jul 14 17:34:59 2011(r224023)
@@ -30,12 +30,12 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 16, 2011
+.Dd July 14, 2011
 .Dt AXE 4
 .Os
 .Sh NAME
 .Nm axe
-.Nd "ASIX Electronics AX88172/178/772 USB Ethernet driver"
+.Nd "ASIX Electronics AX88x7x/760 USB Ethernet driver"
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -59,12 +59,14 @@ if_axe_load="YES"
 The
 .Nm
 driver provides support for USB Ethernet adapters based on the ASIX
-Electronics AX88172, AX88178 and AX88772 USB 2.0 chipsets.
+Electronics AX88172, AX88178, AX88772, AX88772A, AX88772B and AX88760
+USB 2.0 chipsets.
 .Pp
-The AX88172 and AX88178 are USB 2.0 devices that contain a 10/100
+The AX88172, AX88772, AX88772A, AX88772B and AX88760 contain a 10/100
 Ethernet MAC with MII interface and are designed to work with both
 Ethernet and HomePNA transceivers.
-The AX88772 will additionally support 10/100/1000 MACs.
+The AX88178 has a 10/100/1000 Ethernet MAC with GMII/RGMII interface
+for interfacing with Gigabit Ethernet PHY.
 .Pp
 These devices will operate with
 both USB 1.x and USB 2.0 controllers, however performance with 1.x
@@ -85,43 +87,48 @@ driver supports the following media type
 .It Cm autoselect
 Enable autoselection of the media type and options.
 The user can manually override
-the autoselected mode by adding media options to the
-.Pa /etc/rc.conf
-file.
+the autoselected mode by adding media options to
+.Xr rc.conf 5 .
 .It Cm 10baseT/UTP
 Set 10Mbps operation.
 The
+.Xr ifconfig 8
 .Cm mediaopt
-option can also be used to enable
-.Cm full-duplex
-operation.
-Not specifying
+option can also be used to select either
 .Cm full-duplex
-implies
+or
 .Cm half-duplex
-mode.
+modes.
 .It Cm 100baseTX
 Set 100Mbps (Fast Ethernet) operation.
 The
+.Xr ifconfig 8
 .Cm mediaopt
-option can also be used to enable
+option can also be used to select either
 .Cm full-duplex
-operation.
-Not specifying
+or
+.Cm half-duplex
+modes.
+.It Cm 1000baseT
+Set 1000Mbps (Gigabit Ethernet) operation (AX88178 only).
+The
+.Xr ifconfig 8
+.Cm mediaopt
+option can also be used to select either
 .Cm full-duplex
-implies
+or
 .Cm half-duplex
-mode.
+modes.
 .El
 .Pp
 The
 .Nm
 driver supports the following media options:
-.Bl -tag -width ".Cm 10baseT/UTP"
+.Bl -tag -width ".Cm full-duplex"
 .It Cm full-duplex
 Force full duplex operation.
-The interface will operate in
-half duplex mode if this media option is not specified.
+.It Cm half-duplex
+Force half duplex operation.
 .El
 .Pp
 For more information on configuring this device, see
@@ -129,8 +136,8 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver supports ASIX Electronics AX88172/AX88178/AX88772 based USB Ethernet
-adapters including:
+driver supports ASIX Electronics 
AX88172/AX88178/AX88772/AX88772A/AX88772B/AX88760
+based USB Ethernet adapters including:
 .Pp
 AX88172:
 .Bl -bullet -compact
@@ -139,6 +146,8 @@ AboCom UF200
 .It
 Acer Communications EP1427X2
 .It
+ASIX AX88172
+.It
 ATen UC210T
 .It
 Billionton SnapPort
@@ -167,6 +176,8 @@ System TALKS Inc.\& SGC-X2UL
 AX88178:
 .Bl -bullet -compact
 .It
+ASIX AX88178
+.It
 Belkin F5D5055
 .It
 Logitec LAN-GTJ/U2A
@@ -181,9 +192,9 @@ Sitecom Europe LN-028
 AX88772:
 .Bl -bullet -compact
 .It
-Buffalo (Melco Inc.) LUA3-U2-ATX
+ASIX AX88772
 .It
-Cisco-Linksys USB200Mv2
+Buffalo (Melco Inc.) LUA3-U2-ATX
 .It
 D-Link DUBE100B1
 .It
@@ -191,6 +202,27 @@ Planex UE-200TX-G
 .It
 Planex UE-200TX-G2
 .El
+.Pp
+AX88772A:
+.Bl -bullet -compact
+.It
+ASIX AX88772A
+.It
+Cisco-Linksys USB200Mv2
+.El
+.Pp
+AX88772B:
+.Bl -bullet -compact
+.It
+ASIX AX88772B
+.El
+.Pp
+AX88760:
+.Bl -bullet -compact
+.It
+ASIX AX88760
+.El
+.It
 .Sh DIAGNOSTICS
 .Bl -diag
 .It "axe%d: watchdog timeout"
@@ -209,7 +241,7 @@ The driver failed to allocate an mbuf fo
 .Xr rgephy 4 ,
 .Xr ifconfig 8
 .Rs
-.%T "ASIX AX88172 AX88178 and AX88772 data sheets"
+.%T "ASIX AX88x7x and AX88760 data sheets"
 .%U http://www.asix.com.tw
 .Re
 .Sh HISTORY
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r224020 - in head/sys/dev/usb: . net

2011-07-14 Thread Pyun YongHyeon
Author: yongari
Date: Thu Jul 14 17:19:00 2011
New Revision: 224020
URL: http://svn.freebsd.org/changeset/base/224020

Log:
  Add initial support for AX88772B USB Fast Ethernet. AX88772B
  supports IPv4/IPv6 checksum offloading and VLAN tag insertion/
  stripping as well as WOL.  Because uether does not provide a way
  to announce driver specific offload capabilities to upper stack,
  checksum offloading support needs more work and will be done in
  future.
  Special thanks to ASIX for donating sample hardware.
  
  H/W donated by:   ASIX Electronics
  Reviewed by:  hselasky

Modified:
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_axereg.h
  head/sys/dev/usb/usbdevs

Modified: head/sys/dev/usb/net/if_axe.c
==
--- head/sys/dev/usb/net/if_axe.c   Thu Jul 14 15:35:43 2011
(r224019)
+++ head/sys/dev/usb/net/if_axe.c   Thu Jul 14 17:19:00 2011
(r224020)
@@ -142,6 +142,7 @@ static const STRUCT_USB_HOST_ID axe_devs
AXE_DEV(ASIX, AX88178, AXE_FLAG_178),
AXE_DEV(ASIX, AX88772, AXE_FLAG_772),
AXE_DEV(ASIX, AX88772A, AXE_FLAG_772A),
+   AXE_DEV(ASIX, AX88772B, AXE_FLAG_772B),
AXE_DEV(ATEN, UC210T, 0),
AXE_DEV(BELKIN, F5D5055, AXE_FLAG_178),
AXE_DEV(BILLIONTON, USB2AR, 0),
@@ -190,7 +191,9 @@ static void axe_ifmedia_sts(struct ifnet
 static int axe_cmd(struct axe_softc *, int, int, int, void *);
 static voidaxe_ax88178_init(struct axe_softc *);
 static voidaxe_ax88772_init(struct axe_softc *);
+static voidaxe_ax88772_phywake(struct axe_softc *);
 static voidaxe_ax88772a_init(struct axe_softc *);
+static voidaxe_ax88772b_init(struct axe_softc *);
 static int axe_get_phyno(struct axe_softc *, int);
 
 static const struct usb_config axe_config[AXE_N_TRANSFER] = {
@@ -217,6 +220,17 @@ static const struct usb_config axe_confi
},
 };
 
+static const struct ax88772b_mfb ax88772b_mfb_table[] = {
+   { 0x8000, 0x8001, 2048 },
+   { 0x8100, 0x8147, 4096},
+   { 0x8200, 0x81EB, 6144},
+   { 0x8300, 0x83D7, 8192},
+   { 0x8400, 0x851E, 16384},
+   { 0x8500, 0x8666, 20480},
+   { 0x8600, 0x87AE, 24576},
+   { 0x8700, 0x8A3D, 32768}
+};
+
 static device_method_t axe_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, axe_probe),
@@ -669,16 +683,11 @@ axe_ax88772_init(struct axe_softc *sc)
 }
 
 static void
-axe_ax88772a_init(struct axe_softc *sc)
+axe_ax88772_phywake(struct axe_softc *sc)
 {
struct usb_ether *ue;
-   uint16_t eeprom;
 
ue = &sc->sc_ue;
-   axe_cmd(sc, AXE_CMD_SROM_READ, 0, 0x0017, &eeprom);
-   eeprom = le16toh(eeprom);
-   /* Reload EEPROM. */
-   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
if (sc->sc_phyno == AXE_772_PHY_NO_EPHY) {
/* Manually select internal(embedded) PHY - MAC mode. */
axe_cmd(sc, AXE_CMD_SW_PHY_SELECT, 0, AXE_SW_PHY_SELECT_SS_ENB |
@@ -704,6 +713,55 @@ axe_ax88772a_init(struct axe_softc *sc)
uether_pause(&sc->sc_ue, hz / 32);
axe_cmd(sc, AXE_CMD_SW_RESET_REG, 0, AXE_SW_RESET_IPRL, NULL);
uether_pause(&sc->sc_ue, hz / 32);
+}
+
+static void
+axe_ax88772a_init(struct axe_softc *sc)
+{
+   struct usb_ether *ue;
+
+   ue = &sc->sc_ue;
+   /* Reload EEPROM. */
+   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
+   axe_ax88772_phywake(sc);
+   /* Stop MAC. */
+   axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
+}
+
+static void
+axe_ax88772b_init(struct axe_softc *sc)
+{
+   struct usb_ether *ue;
+   uint16_t eeprom;
+   uint8_t *eaddr;
+   int i;
+
+   ue = &sc->sc_ue;
+   /* Reload EEPROM. */
+   AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM, hz / 32);
+   /*
+* Save PHY power saving configuration(high byte) and
+* clear EEPROM checksum value(low byte).
+*/
+   axe_cmd(sc, AXE_CMD_SROM_READ, 0, AXE_EEPROM_772B_PHY_PWRCFG, &eeprom);
+   sc->sc_pwrcfg = le16toh(eeprom) & 0xFF00;
+
+   /*
+* Auto-loaded default station address from internal ROM is
+* 00:00:00:00:00:00 such that an explicit access to EEPROM
+* is required to get real station address.
+*/
+   eaddr = ue->ue_eaddr;
+   for (i = 0; i < ETHER_ADDR_LEN / 2; i++) {
+   axe_cmd(sc, AXE_CMD_SROM_READ, 0, AXE_EEPROM_772B_NODE_ID + i,
+   &eeprom);
+   eeprom = le16toh(eeprom);
+   *eaddr++ = (uint8_t)(eeprom & 0xFF);
+   *eaddr++ = (uint8_t)((eeprom >> 8) & 0xFF);
+   }
+   /* Wakeup PHY. */
+   axe_ax88772_phywake(sc);
+   /* Stop MAC. */
axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, 0, NULL);
 }
 
@@ -732,6 +790,8 @@ axe_reset(struct axe_softc *sc)
axe_ax88772_init(sc);
else if (sc->sc_flags & AXE_FLAG_772A)
axe_ax88772a_init(sc);
+   el

svn commit: r223916 - stable/7/share/man/man4

2011-07-10 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jul 10 22:09:53 2011
New Revision: 223916
URL: http://svn.freebsd.org/changeset/base/223916

Log:
  MFC r223683:
Document two known hardware errata which requires manual link
configuration.
  
Submitted by:   Aries Lee (arieslee <> jmicron com)

Modified:
  stable/7/share/man/man4/jme.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/jme.4
==
--- stable/7/share/man/man4/jme.4   Sun Jul 10 22:09:34 2011
(r223915)
+++ stable/7/share/man/man4/jme.4   Sun Jul 10 22:09:53 2011
(r223916)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2010
+.Dd June 29, 2011
 .Dt JME 4
 .Os
 .Sh NAME
@@ -178,3 +178,17 @@ address once station address is reprogra
 It is highly recommended not to reprogram station address and
 it is responsibility of administrator to store original station
 address into a safe place when station address should be changed.
+.Pp
+There are two known 1000baseT link establishment issues with JMC25x.
+If the full mask revision number of JMC25x controller is less than
+or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient
+Ethernet feature,  the controller would not be able to establish a
+1000baseT link.
+Also if the length of cable is longer than 120 meters, controller
+can not establish a 1000baseT link.
+The known workaround for the issue is to force manual link
+configuration with 100baseTX instead of relying on auto-negotiation.
+The full mask revision number of controller could be checked with
+verbose kernel boot option.
+Use lower nibble of chip revision number to get full mask revision of
+the controller. 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223915 - stable/8/share/man/man4

2011-07-10 Thread Pyun YongHyeon
Author: yongari
Date: Sun Jul 10 22:09:34 2011
New Revision: 223915
URL: http://svn.freebsd.org/changeset/base/223915

Log:
  MFC r223683:
Document two known hardware errata which requires manual link
configuration.
  
Submitted by:   Aries Lee (arieslee <> jmicron com)

Modified:
  stable/8/share/man/man4/jme.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/jme.4
==
--- stable/8/share/man/man4/jme.4   Sun Jul 10 20:49:13 2011
(r223914)
+++ stable/8/share/man/man4/jme.4   Sun Jul 10 22:09:34 2011
(r223915)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2010
+.Dd June 29, 2011
 .Dt JME 4
 .Os
 .Sh NAME
@@ -178,3 +178,17 @@ address once station address is reprogra
 It is highly recommended not to reprogram station address and
 it is responsibility of administrator to store original station
 address into a safe place when station address should be changed.
+.Pp
+There are two known 1000baseT link establishment issues with JMC25x.
+If the full mask revision number of JMC25x controller is less than
+or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient
+Ethernet feature,  the controller would not be able to establish a
+1000baseT link.
+Also if the length of cable is longer than 120 meters, controller
+can not establish a 1000baseT link.
+The known workaround for the issue is to force manual link
+configuration with 100baseTX instead of relying on auto-negotiation.
+The full mask revision number of controller could be checked with
+verbose kernel boot option.
+Use lower nibble of chip revision number to get full mask revision of
+the controller. 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223810 - stable/7/sys/dev/fxp

2011-07-05 Thread Pyun YongHyeon
Author: yongari
Date: Tue Jul  5 23:31:40 2011
New Revision: 223810
URL: http://svn.freebsd.org/changeset/base/223810

Log:
  MFC r223610:
Enable CPUSaver D102 E-step microcode loading for 82551 revision
0x10.

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==
--- stable/7/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:30:14 2011
(r223809)
+++ stable/7/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:31:40 2011
(r223810)
@@ -3036,6 +3036,8 @@ static const struct ucode {
 #endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
+   { FXP_REV_82551_10, UCODE(fxp_ucode_d102e),
+   D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223809 - stable/8/sys/dev/fxp

2011-07-05 Thread Pyun YongHyeon
Author: yongari
Date: Tue Jul  5 23:30:14 2011
New Revision: 223809
URL: http://svn.freebsd.org/changeset/base/223809

Log:
  MFC r223610:
Enable CPUSaver D102 E-step microcode loading for 82551 revision
0x10.

Modified:
  stable/8/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/fxp/if_fxp.c
==
--- stable/8/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:18:28 2011
(r223808)
+++ stable/8/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:30:14 2011
(r223809)
@@ -3043,6 +3043,8 @@ static const struct ucode {
 #endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
+   { FXP_REV_82551_10, UCODE(fxp_ucode_d102e),
+   D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223808 - stable/7/sys/dev/fxp

2011-07-05 Thread Pyun YongHyeon
Author: yongari
Date: Tue Jul  5 23:18:28 2011
New Revision: 223808
URL: http://svn.freebsd.org/changeset/base/223808

Log:
  MFC r223608:
Disable microcode loading for 82550 and 82550C controllers. Loading
the microcode caused SCB timeouts. Linux driver does not allow
microcode loading for these controllers and jfv also confirmed that
there is no need to do and it shouldn't.
  
PR: kern/103332
Additional confirmation from:   jfv

Modified:
  stable/7/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/fxp/if_fxp.c
==
--- stable/7/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:17:27 2011
(r223807)
+++ stable/7/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:18:28 2011
(r223808)
@@ -3007,8 +3007,10 @@ static uint32_t fxp_ucode_d101a[] = D101
 static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE;
+#ifdef notyet
 static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
+#endif
 static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
 
 #define UCODE(x)   x, sizeof(x)/sizeof(uint32_t)
@@ -3026,10 +3028,12 @@ static const struct ucode {
D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82559S_A, UCODE(fxp_ucode_d101s),
D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD },
+#ifdef notyet
{ FXP_REV_82550, UCODE(fxp_ucode_d102),
D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82550_C, UCODE(fxp_ucode_d102c),
D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD },
+#endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223807 - stable/8/sys/dev/fxp

2011-07-05 Thread Pyun YongHyeon
Author: yongari
Date: Tue Jul  5 23:17:27 2011
New Revision: 223807
URL: http://svn.freebsd.org/changeset/base/223807

Log:
  MFC r223608:
Disable microcode loading for 82550 and 82550C controllers. Loading
the microcode caused SCB timeouts. Linux driver does not allow
microcode loading for these controllers and jfv also confirmed that
there is no need to do and it shouldn't.
  
PR: kern/103332
Additional confirmation from:   jfv

Modified:
  stable/8/sys/dev/fxp/if_fxp.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/fxp/if_fxp.c
==
--- stable/8/sys/dev/fxp/if_fxp.c   Tue Jul  5 20:05:06 2011
(r223806)
+++ stable/8/sys/dev/fxp/if_fxp.c   Tue Jul  5 23:17:27 2011
(r223807)
@@ -3014,8 +3014,10 @@ static uint32_t fxp_ucode_d101a[] = D101
 static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE;
+#ifdef notyet
 static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
+#endif
 static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
 
 #define UCODE(x)   x, sizeof(x)/sizeof(uint32_t)
@@ -3033,10 +3035,12 @@ static const struct ucode {
D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82559S_A, UCODE(fxp_ucode_d101s),
D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD },
+#ifdef notyet
{ FXP_REV_82550, UCODE(fxp_ucode_d102),
D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82550_C, UCODE(fxp_ucode_d102c),
D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD },
+#endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223683 - head/share/man/man4

2011-06-29 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 29 17:32:52 2011
New Revision: 223683
URL: http://svn.freebsd.org/changeset/base/223683

Log:
  Document two known hardware errata which requires manual link
  configuration.
  
  Submitted by: Aries Lee (arieslee <> jmicron com)

Modified:
  head/share/man/man4/jme.4

Modified: head/share/man/man4/jme.4
==
--- head/share/man/man4/jme.4   Wed Jun 29 17:20:10 2011(r223682)
+++ head/share/man/man4/jme.4   Wed Jun 29 17:32:52 2011(r223683)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 20, 2010
+.Dd June 29, 2011
 .Dt JME 4
 .Os
 .Sh NAME
@@ -178,3 +178,17 @@ address once station address is reprogra
 It is highly recommended not to reprogram station address and
 it is responsibility of administrator to store original station
 address into a safe place when station address should be changed.
+.Pp
+There are two known 1000baseT link establishment issues with JMC25x.
+If the full mask revision number of JMC25x controller is less than
+or equal to 4 and link partner enabled IEEE 802.3az Energy Efficient
+Ethernet feature,  the controller would not be able to establish a
+1000baseT link.
+Also if the length of cable is longer than 120 meters, controller
+can not establish a 1000baseT link.
+The known workaround for the issue is to force manual link
+configuration with 100baseTX instead of relying on auto-negotiation.
+The full mask revision number of controller could be checked with
+verbose kernel boot option.
+Use lower nibble of chip revision number to get full mask revision of
+the controller. 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223682 - stable/7/sys/dev/vr

2011-06-29 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 29 17:20:10 2011
New Revision: 223682
URL: http://svn.freebsd.org/changeset/base/223682

Log:
  MFC r223405:
Remove link state change callback handler.  There is no need to
register both status change and link state change callbacks.
Implement checking valid link in state change callback and poll
active link state in vr_tick().  This allows immediate detection of
lost link as well as protecting driver from frequent link flips during
link renegotiation.  taskq implementation was removed because driver
now needs to poll link state in vr_tick().
While I'm here do not report current link state if interface is not
running.
  
Tested by:  n_hibma

Modified:
  stable/7/sys/dev/vr/if_vr.c
  stable/7/sys/dev/vr/if_vrreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/vr/if_vr.c
==
--- stable/7/sys/dev/vr/if_vr.c Wed Jun 29 17:18:33 2011(r223681)
+++ stable/7/sys/dev/vr/if_vr.c Wed Jun 29 17:20:10 2011(r223682)
@@ -185,7 +185,6 @@ static int vr_miibus_readreg(device_t, i
 static int vr_miibus_writereg(device_t, int, int, int);
 static void vr_miibus_statchg(device_t);
 
-static void vr_link_task(void *, int);
 static void vr_cam_mask(struct vr_softc *, uint32_t, int);
 static int vr_cam_data(struct vr_softc *, int, int, uint8_t *);
 static void vr_set_filter(struct vr_softc *);
@@ -226,7 +225,6 @@ static device_method_t vr_methods[] = {
DEVMETHOD(miibus_readreg,   vr_miibus_readreg),
DEVMETHOD(miibus_writereg,  vr_miibus_writereg),
DEVMETHOD(miibus_statchg,   vr_miibus_statchg),
-   DEVMETHOD(miibus_linkchg,   vr_miibus_statchg),
 
{ NULL, NULL }
 };
@@ -290,22 +288,13 @@ vr_miibus_writereg(device_t dev, int phy
return (0);
 }
 
-static void
-vr_miibus_statchg(device_t dev)
-{
-   struct vr_softc *sc;
-
-   sc = device_get_softc(dev);
-   taskqueue_enqueue(taskqueue_swi, &sc->vr_link_task);
-}
-
 /*
  * In order to fiddle with the
  * 'full-duplex' and '100Mbps' bits in the netconfig register, we
  * first have to put the transmit and/or receive logic in the idle state.
  */
 static void
-vr_link_task(void *arg, int pending)
+vr_miibus_statchg(device_t dev)
 {
struct vr_softc *sc;
struct mii_data *mii;
@@ -313,22 +302,25 @@ vr_link_task(void *arg, int pending)
int lfdx, mfdx;
uint8_t cr0, cr1, fc;
 
-   sc = (struct vr_softc *)arg;
-
-   VR_LOCK(sc);
+   sc = device_get_softc(dev);
mii = device_get_softc(sc->vr_miibus);
ifp = sc->vr_ifp;
if (mii == NULL || ifp == NULL ||
-   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-   VR_UNLOCK(sc);
+   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
-   }
 
-   if (mii->mii_media_status & IFM_ACTIVE) {
-   if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
+   sc->vr_link = 0;
+   if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+   (IFM_ACTIVE | IFM_AVALID)) {
+   switch (IFM_SUBTYPE(mii->mii_media_active)) {
+   case IFM_10_T:
+   case IFM_100_TX:
sc->vr_link = 1;
-   } else
-   sc->vr_link = 0;
+   break;
+   default:
+   break;
+   }
+   }
 
if (sc->vr_link != 0) {
cr0 = CSR_READ_1(sc, VR_CR0);
@@ -384,11 +376,8 @@ vr_link_task(void *arg, int pending)
"%s: Tx/Rx shutdown error -- resetting\n",
__func__);
sc->vr_flags |= VR_F_RESTART;
-   VR_UNLOCK(sc);
-   return;
}
}
-   VR_UNLOCK(sc);
 }
 
 
@@ -621,7 +610,6 @@ vr_attach(device_t dev)
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
callout_init_mtx(&sc->vr_stat_callout, &sc->vr_mtx, 0);
-   TASK_INIT(&sc->vr_link_task, 0, vr_link_task, sc);
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
@@ -841,7 +829,6 @@ vr_detach(device_t dev)
vr_stop(sc);
VR_UNLOCK(sc);
callout_drain(&sc->vr_stat_callout);
-   taskqueue_drain(taskqueue_swi, &sc->vr_link_task);
ether_ifdetach(ifp);
}
if (sc->vr_miibus)
@@ -1556,6 +1543,8 @@ vr_tick(void *xsc)
 
mii = device_get_softc(sc->vr_miibus);
mii_tick(mii

svn commit: r223681 - stable/8/sys/dev/vr

2011-06-29 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 29 17:18:33 2011
New Revision: 223681
URL: http://svn.freebsd.org/changeset/base/223681

Log:
  MFC r223405:
Remove link state change callback handler.  There is no need to
register both status change and link state change callbacks.
Implement checking valid link in state change callback and poll
active link state in vr_tick().  This allows immediate detection of
lost link as well as protecting driver from frequent link flips during
link renegotiation.  taskq implementation was removed because driver
now needs to poll link state in vr_tick().
While I'm here do not report current link state if interface is not
running.
  
Tested by:  n_hibma

Modified:
  stable/8/sys/dev/vr/if_vr.c
  stable/8/sys/dev/vr/if_vrreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/vr/if_vr.c
==
--- stable/8/sys/dev/vr/if_vr.c Wed Jun 29 16:58:27 2011(r223680)
+++ stable/8/sys/dev/vr/if_vr.c Wed Jun 29 17:18:33 2011(r223681)
@@ -185,7 +185,6 @@ static int vr_miibus_readreg(device_t, i
 static int vr_miibus_writereg(device_t, int, int, int);
 static void vr_miibus_statchg(device_t);
 
-static void vr_link_task(void *, int);
 static void vr_cam_mask(struct vr_softc *, uint32_t, int);
 static int vr_cam_data(struct vr_softc *, int, int, uint8_t *);
 static void vr_set_filter(struct vr_softc *);
@@ -226,7 +225,6 @@ static device_method_t vr_methods[] = {
DEVMETHOD(miibus_readreg,   vr_miibus_readreg),
DEVMETHOD(miibus_writereg,  vr_miibus_writereg),
DEVMETHOD(miibus_statchg,   vr_miibus_statchg),
-   DEVMETHOD(miibus_linkchg,   vr_miibus_statchg),
 
{ NULL, NULL }
 };
@@ -290,22 +288,13 @@ vr_miibus_writereg(device_t dev, int phy
return (0);
 }
 
-static void
-vr_miibus_statchg(device_t dev)
-{
-   struct vr_softc *sc;
-
-   sc = device_get_softc(dev);
-   taskqueue_enqueue(taskqueue_swi, &sc->vr_link_task);
-}
-
 /*
  * In order to fiddle with the
  * 'full-duplex' and '100Mbps' bits in the netconfig register, we
  * first have to put the transmit and/or receive logic in the idle state.
  */
 static void
-vr_link_task(void *arg, int pending)
+vr_miibus_statchg(device_t dev)
 {
struct vr_softc *sc;
struct mii_data *mii;
@@ -313,22 +302,25 @@ vr_link_task(void *arg, int pending)
int lfdx, mfdx;
uint8_t cr0, cr1, fc;
 
-   sc = (struct vr_softc *)arg;
-
-   VR_LOCK(sc);
+   sc = device_get_softc(dev);
mii = device_get_softc(sc->vr_miibus);
ifp = sc->vr_ifp;
if (mii == NULL || ifp == NULL ||
-   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-   VR_UNLOCK(sc);
+   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
-   }
 
-   if (mii->mii_media_status & IFM_ACTIVE) {
-   if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
+   sc->vr_link = 0;
+   if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+   (IFM_ACTIVE | IFM_AVALID)) {
+   switch (IFM_SUBTYPE(mii->mii_media_active)) {
+   case IFM_10_T:
+   case IFM_100_TX:
sc->vr_link = 1;
-   } else
-   sc->vr_link = 0;
+   break;
+   default:
+   break;
+   }
+   }
 
if (sc->vr_link != 0) {
cr0 = CSR_READ_1(sc, VR_CR0);
@@ -384,11 +376,8 @@ vr_link_task(void *arg, int pending)
"%s: Tx/Rx shutdown error -- resetting\n",
__func__);
sc->vr_flags |= VR_F_RESTART;
-   VR_UNLOCK(sc);
-   return;
}
}
-   VR_UNLOCK(sc);
 }
 
 
@@ -621,7 +610,6 @@ vr_attach(device_t dev)
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
callout_init_mtx(&sc->vr_stat_callout, &sc->vr_mtx, 0);
-   TASK_INIT(&sc->vr_link_task, 0, vr_link_task, sc);
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
@@ -841,7 +829,6 @@ vr_detach(device_t dev)
vr_stop(sc);
VR_UNLOCK(sc);
callout_drain(&sc->vr_stat_callout);
-   taskqueue_drain(taskqueue_swi, &sc->vr_link_task);
ether_ifdetach(ifp);
}
if (sc->vr_miibus)
@@ -1559,6 +1546,8 @@ vr_tick(void *xsc)
 
mii = d

svn commit: r223610 - head/sys/dev/fxp

2011-06-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jun 27 21:37:38 2011
New Revision: 223610
URL: http://svn.freebsd.org/changeset/base/223610

Log:
  Enable CPUSaver D102 E-step microcode loading for 82551 revision
  0x10.

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Mon Jun 27 21:30:04 2011(r223609)
+++ head/sys/dev/fxp/if_fxp.c   Mon Jun 27 21:37:38 2011(r223610)
@@ -3041,6 +3041,8 @@ static const struct ucode {
 #endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
+   { FXP_REV_82551_10, UCODE(fxp_ucode_d102e),
+   D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
 };
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223608 - head/sys/dev/fxp

2011-06-27 Thread Pyun YongHyeon
Author: yongari
Date: Mon Jun 27 21:27:12 2011
New Revision: 223608
URL: http://svn.freebsd.org/changeset/base/223608

Log:
  Disable microcode loading for 82550 and 82550C controllers. Loading
  the microcode caused SCB timeouts. Linux driver does not allow
  microcode loading for these controllers and jfv also confirmed that
  there is no need to do and it shouldn't.
  
  PR:   kern/103332
  Additional confirmation from: jfv
  MFC after:1 week

Modified:
  head/sys/dev/fxp/if_fxp.c

Modified: head/sys/dev/fxp/if_fxp.c
==
--- head/sys/dev/fxp/if_fxp.c   Mon Jun 27 21:14:25 2011(r223607)
+++ head/sys/dev/fxp/if_fxp.c   Mon Jun 27 21:27:12 2011(r223608)
@@ -3012,8 +3012,10 @@ static uint32_t fxp_ucode_d101a[] = D101
 static uint32_t fxp_ucode_d101b0[] = D101_B0_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101ma[] = D101M_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d101s[] = D101S_RCVBUNDLE_UCODE;
+#ifdef notyet
 static uint32_t fxp_ucode_d102[] = D102_B_RCVBUNDLE_UCODE;
 static uint32_t fxp_ucode_d102c[] = D102_C_RCVBUNDLE_UCODE;
+#endif
 static uint32_t fxp_ucode_d102e[] = D102_E_RCVBUNDLE_UCODE;
 
 #define UCODE(x)   x, sizeof(x)/sizeof(uint32_t)
@@ -3031,10 +3033,12 @@ static const struct ucode {
D101M_CPUSAVER_DWORD, D101M_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82559S_A, UCODE(fxp_ucode_d101s),
D101S_CPUSAVER_DWORD, D101S_CPUSAVER_BUNDLE_MAX_DWORD },
+#ifdef notyet
{ FXP_REV_82550, UCODE(fxp_ucode_d102),
D102_B_CPUSAVER_DWORD, D102_B_CPUSAVER_BUNDLE_MAX_DWORD },
{ FXP_REV_82550_C, UCODE(fxp_ucode_d102c),
D102_C_CPUSAVER_DWORD, D102_C_CPUSAVER_BUNDLE_MAX_DWORD },
+#endif
{ FXP_REV_82551_F, UCODE(fxp_ucode_d102e),
D102_E_CPUSAVER_DWORD, D102_E_CPUSAVER_BUNDLE_MAX_DWORD },
{ 0, NULL, 0, 0, 0 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223405 - head/sys/dev/vr

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 02:18:45 2011
New Revision: 223405
URL: http://svn.freebsd.org/changeset/base/223405

Log:
  Remove link state change callback handler.  There is no need to
  register both status change and link state change callbacks.
  Implement checking valid link in state change callback and poll
  active link state in vr_tick().  This allows immediate detection of
  lost link as well as protecting driver from frequent link flips during
  link renegotiation.  taskq implementation was removed because driver
  now needs to poll link state in vr_tick().
  While I'm here do not report current link state if interface is not
  running.
  
  Tested by:n_hibma
  MFC after:1 week

Modified:
  head/sys/dev/vr/if_vr.c
  head/sys/dev/vr/if_vrreg.h

Modified: head/sys/dev/vr/if_vr.c
==
--- head/sys/dev/vr/if_vr.c Wed Jun 22 02:11:42 2011(r223404)
+++ head/sys/dev/vr/if_vr.c Wed Jun 22 02:18:45 2011(r223405)
@@ -185,7 +185,6 @@ static int vr_miibus_readreg(device_t, i
 static int vr_miibus_writereg(device_t, int, int, int);
 static void vr_miibus_statchg(device_t);
 
-static void vr_link_task(void *, int);
 static void vr_cam_mask(struct vr_softc *, uint32_t, int);
 static int vr_cam_data(struct vr_softc *, int, int, uint8_t *);
 static void vr_set_filter(struct vr_softc *);
@@ -226,7 +225,6 @@ static device_method_t vr_methods[] = {
DEVMETHOD(miibus_readreg,   vr_miibus_readreg),
DEVMETHOD(miibus_writereg,  vr_miibus_writereg),
DEVMETHOD(miibus_statchg,   vr_miibus_statchg),
-   DEVMETHOD(miibus_linkchg,   vr_miibus_statchg),
 
{ NULL, NULL }
 };
@@ -290,22 +288,13 @@ vr_miibus_writereg(device_t dev, int phy
return (0);
 }
 
-static void
-vr_miibus_statchg(device_t dev)
-{
-   struct vr_softc *sc;
-
-   sc = device_get_softc(dev);
-   taskqueue_enqueue(taskqueue_swi, &sc->vr_link_task);
-}
-
 /*
  * In order to fiddle with the
  * 'full-duplex' and '100Mbps' bits in the netconfig register, we
  * first have to put the transmit and/or receive logic in the idle state.
  */
 static void
-vr_link_task(void *arg, int pending)
+vr_miibus_statchg(device_t dev)
 {
struct vr_softc *sc;
struct mii_data *mii;
@@ -313,22 +302,25 @@ vr_link_task(void *arg, int pending)
int lfdx, mfdx;
uint8_t cr0, cr1, fc;
 
-   sc = (struct vr_softc *)arg;
-
-   VR_LOCK(sc);
+   sc = device_get_softc(dev);
mii = device_get_softc(sc->vr_miibus);
ifp = sc->vr_ifp;
if (mii == NULL || ifp == NULL ||
-   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
-   VR_UNLOCK(sc);
+   (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
return;
-   }
 
-   if (mii->mii_media_status & IFM_ACTIVE) {
-   if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
+   sc->vr_link = 0;
+   if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) ==
+   (IFM_ACTIVE | IFM_AVALID)) {
+   switch (IFM_SUBTYPE(mii->mii_media_active)) {
+   case IFM_10_T:
+   case IFM_100_TX:
sc->vr_link = 1;
-   } else
-   sc->vr_link = 0;
+   break;
+   default:
+   break;
+   }
+   }
 
if (sc->vr_link != 0) {
cr0 = CSR_READ_1(sc, VR_CR0);
@@ -384,11 +376,8 @@ vr_link_task(void *arg, int pending)
"%s: Tx/Rx shutdown error -- resetting\n",
__func__);
sc->vr_flags |= VR_F_RESTART;
-   VR_UNLOCK(sc);
-   return;
}
}
-   VR_UNLOCK(sc);
 }
 
 
@@ -621,7 +610,6 @@ vr_attach(device_t dev)
mtx_init(&sc->vr_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
MTX_DEF);
callout_init_mtx(&sc->vr_stat_callout, &sc->vr_mtx, 0);
-   TASK_INIT(&sc->vr_link_task, 0, vr_link_task, sc);
SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
OID_AUTO, "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
@@ -841,7 +829,6 @@ vr_detach(device_t dev)
vr_stop(sc);
VR_UNLOCK(sc);
callout_drain(&sc->vr_stat_callout);
-   taskqueue_drain(taskqueue_swi, &sc->vr_link_task);
ether_ifdetach(ifp);
}
if (sc->vr_miibus)
@@ -1559,6 +1546,8 @@ vr_tick(void *xsc)
 
mii = device_get_softc(sc->vr_miibus);
mii_tick(mii);
+   if (sc->vr_link == 0)
+   vr_miibus_statchg(sc->vr_dev);
vr_watchdog(sc);
callout_reset(&sc->vr_stat_callout, hz, vr_tick, sc);
 }
@@ -2161,6 +2150,10 @@ vr_ifmedia_sts(struct ifnet *ifp, struct
 

svn commit: r223403 - stable/7/share/man/man4

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:57:45 2011
New Revision: 223403
URL: http://svn.freebsd.org/changeset/base/223403

Log:
  MFC r32:
Add 88E8075 Yukon Supreme to the list of supported hardware list.

Modified:
  stable/7/share/man/man4/msk.4
Directory Properties:
  stable/7/share/man/man4/   (props changed)

Modified: stable/7/share/man/man4/msk.4
==
--- stable/7/share/man/man4/msk.4   Wed Jun 22 01:57:31 2011
(r223402)
+++ stable/7/share/man/man4/msk.4   Wed Jun 22 01:57:45 2011
(r223403)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 23, 2010
+.Dd May 23, 2011
 .Dt MSK 4
 .Os
 .Sh NAME
@@ -195,6 +195,8 @@ Marvell Yukon 88E8071 Gigabit Ethernet
 .It
 Marvell Yukon 88E8072 Gigabit Ethernet
 .It
+Marvell Yukon 88E8075 Gigabit Ethernet
+.It
 SysKonnect SK-9Sxx Gigabit Ethernet
 .It
 SysKonnect SK-9Exx Gigabit Ethernet
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223402 - stable/8/share/man/man4

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:57:31 2011
New Revision: 223402
URL: http://svn.freebsd.org/changeset/base/223402

Log:
  MFC r32:
Add 88E8075 Yukon Supreme to the list of supported hardware list.

Modified:
  stable/8/share/man/man4/msk.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/msk.4
==
--- stable/8/share/man/man4/msk.4   Wed Jun 22 01:55:47 2011
(r223401)
+++ stable/8/share/man/man4/msk.4   Wed Jun 22 01:57:31 2011
(r223402)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 23, 2010
+.Dd May 23, 2011
 .Dt MSK 4
 .Os
 .Sh NAME
@@ -195,6 +195,8 @@ Marvell Yukon 88E8071 Gigabit Ethernet
 .It
 Marvell Yukon 88E8072 Gigabit Ethernet
 .It
+Marvell Yukon 88E8075 Gigabit Ethernet
+.It
 SysKonnect SK-9Sxx Gigabit Ethernet
 .It
 SysKonnect SK-9Exx Gigabit Ethernet
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223401 - stable/7/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:55:47 2011
New Revision: 223401
URL: http://svn.freebsd.org/changeset/base/223401

Log:
  MFC r69:
style(9)

Modified:
  stable/7/sys/dev/msk/if_msk.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/msk/if_msk.c
==
--- stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:54:49 2011
(r223400)
+++ stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:55:47 2011
(r223401)
@@ -1018,7 +1018,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm
if (ifr->ifr_mtu > MSK_JUMBO_MTU || ifr->ifr_mtu < ETHERMIN)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu) {
-   if (ifr->ifr_mtu > ETHERMTU) {
+   if (ifr->ifr_mtu > ETHERMTU) {
if ((sc_if->msk_flags & MSK_FLAG_JUMBO) == 0) {
error = EINVAL;
MSK_IF_UNLOCK(sc_if);
@@ -1638,7 +1638,7 @@ msk_attach(device_t dev)
 * this workaround does not work so disable checksum offload
 * for VLAN interface.
 */
-   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
+   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
/*
 * Enable Rx checksum offloading for VLAN taggedd frames
 * if controller support new descriptor format.
@@ -1923,7 +1923,8 @@ mskc_attach(device_t dev)
error = ENXIO;
goto fail;
}
-   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK | 
M_ZERO);
+   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK |
+   M_ZERO);
if (mmd == NULL) {
device_printf(dev, "failed to allocate memory for "
"ivars of PORT_B\n");
@@ -1932,9 +1933,9 @@ mskc_attach(device_t dev)
}
mmd->port = MSK_PORT_B;
mmd->pmd = sc->msk_pmd;
-   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
+   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
mmd->mii_flags |= MIIF_HAVEFIBER;
-   if (sc->msk_pmd == 'P')
+   if (sc->msk_pmd == 'P')
mmd->mii_flags |= MIIF_HAVEFIBER | MIIF_MACPRIV0;
device_set_ivars(sc->msk_devs[MSK_PORT_B], mmd);
}
@@ -3742,10 +3743,10 @@ msk_init_locked(struct msk_if_softc *sc_
ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM);
}
 
-   /* GMAC Control reset. */
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
+   /* GMAC Control reset. */
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
@@ -3855,13 +3856,13 @@ msk_init_locked(struct msk_if_softc *sc_
msk_set_tx_stfwd(sc_if);
}
 
-   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
-   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
-   /* Disable dynamic watermark - from Linux. */
-   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
-   reg &= ~0x03;
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
-   }
+   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
+   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
+   /* Disable dynamic watermark - from Linux. */
+   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
+   reg &= ~0x03;
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
+   }
 
/*
 * Disable Force Sync bit and Alloc bit in Tx RAM interface
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223400 - stable/8/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:54:49 2011
New Revision: 223400
URL: http://svn.freebsd.org/changeset/base/223400

Log:
  MFC r69:
style(9)

Modified:
  stable/8/sys/dev/msk/if_msk.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==
--- stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 01:48:41 2011
(r223399)
+++ stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 01:54:49 2011
(r223400)
@@ -1018,7 +1018,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm
if (ifr->ifr_mtu > MSK_JUMBO_MTU || ifr->ifr_mtu < ETHERMIN)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu) {
-   if (ifr->ifr_mtu > ETHERMTU) {
+   if (ifr->ifr_mtu > ETHERMTU) {
if ((sc_if->msk_flags & MSK_FLAG_JUMBO) == 0) {
error = EINVAL;
MSK_IF_UNLOCK(sc_if);
@@ -1638,7 +1638,7 @@ msk_attach(device_t dev)
 * this workaround does not work so disable checksum offload
 * for VLAN interface.
 */
-   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
+   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
/*
 * Enable Rx checksum offloading for VLAN tagged frames
 * if controller support new descriptor format.
@@ -1923,7 +1923,8 @@ mskc_attach(device_t dev)
error = ENXIO;
goto fail;
}
-   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK | 
M_ZERO);
+   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK |
+   M_ZERO);
if (mmd == NULL) {
device_printf(dev, "failed to allocate memory for "
"ivars of PORT_B\n");
@@ -1932,9 +1933,9 @@ mskc_attach(device_t dev)
}
mmd->port = MSK_PORT_B;
mmd->pmd = sc->msk_pmd;
-   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
+   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
mmd->mii_flags |= MIIF_HAVEFIBER;
-   if (sc->msk_pmd == 'P')
+   if (sc->msk_pmd == 'P')
mmd->mii_flags |= MIIF_HAVEFIBER | MIIF_MACPRIV0;
device_set_ivars(sc->msk_devs[MSK_PORT_B], mmd);
}
@@ -3742,10 +3743,10 @@ msk_init_locked(struct msk_if_softc *sc_
ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM);
}
 
-   /* GMAC Control reset. */
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
+   /* GMAC Control reset. */
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
@@ -3855,13 +3856,13 @@ msk_init_locked(struct msk_if_softc *sc_
msk_set_tx_stfwd(sc_if);
}
 
-   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
-   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
-   /* Disable dynamic watermark - from Linux. */
-   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
-   reg &= ~0x03;
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
-   }
+   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
+   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
+   /* Disable dynamic watermark - from Linux. */
+   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
+   reg &= ~0x03;
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
+   }
 
/*
 * Disable Force Sync bit and Alloc bit in Tx RAM interface
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223399 - stable/7/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:48:41 2011
New Revision: 223399
URL: http://svn.freebsd.org/changeset/base/223399

Log:
  MFC r30:
Add initial support for Marvell 88E8055/88E8075 Yukon Supreme.

Modified:
  stable/7/sys/dev/msk/if_msk.c
  stable/7/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/msk/if_msk.c
==
--- stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:47:23 2011
(r223398)
+++ stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:48:41 2011
(r223399)
@@ -221,6 +221,10 @@ static struct msk_product {
"Marvell Yukon 88E8071 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_436C,
"Marvell Yukon 88E8072 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_436D,
+   "Marvell Yukon 88E8055 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_4370,
+   "Marvell Yukon 88E8075 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4380,
"Marvell Yukon 88E8057 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4381,
@@ -1369,11 +1373,16 @@ mskc_reset(struct msk_softc *sc)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
}
+
+   if (sc->msk_hw_id == CHIP_ID_YUKON_SUPR &&
+   sc->msk_hw_rev > CHIP_REV_YU_SU_B0)
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, PCI_CLK_MACSEC_DIS);
if (sc->msk_hw_id == CHIP_ID_YUKON_OPT && sc->msk_hw_rev == 0) {
/* Disable PCIe PHY powerdown(reg 0x80, bit7). */
CSR_WRITE_4(sc, Y2_PEX_PHY_DATA, (0x0080 << 16) | 0x0080);
@@ -1724,7 +1733,6 @@ mskc_attach(device_t dev)
/* Bail out if chip is not recognized. */
if (sc->msk_hw_id < CHIP_ID_YUKON_XL ||
sc->msk_hw_id > CHIP_ID_YUKON_OPT ||
-   sc->msk_hw_id == CHIP_ID_YUKON_SUPR ||
sc->msk_hw_id == CHIP_ID_YUKON_UNKNOWN) {
device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n",
sc->msk_hw_id, sc->msk_hw_rev);
@@ -1831,6 +1839,11 @@ mskc_attach(device_t dev)
sc->msk_clock = 156;/* 156 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
break;
+   case CHIP_ID_YUKON_SUPR:
+   sc->msk_clock = 125;/* 125 MHz */
+   sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 |
+   MSK_FLAG_AUTOTX_CSUM;
+   break;
case CHIP_ID_YUKON_UL_2:
sc->msk_clock = 125;/* 125 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
@@ -3733,7 +3746,8 @@ msk_init_locked(struct msk_if_softc *sc_
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
@@ -3928,7 +3942,8 @@ msk_init_locked(struct msk_if_softc *sc_
msk_stop(sc_if);
return;
}
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
/* Disable flushing of non-ASF packets. */
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T),
GMF_RX_MACSEC_FLUSH_OFF);

Modified: stable/7/sys/dev/msk/if_mskreg.h
==
--- stable/7/sys/dev/msk/if_mskreg.hWed Jun 22 01:47:23 2011
(r223398)
+++ stable/7/sys/dev/msk/if_mskreg.hWed Jun 22 01:48:41 2011
(r223399)
@@ -144,6 +144,8 @@
 #define DEVICEID_MRVL_436A 0x436A
 #define DEVICEID_MRVL_436B 0x436B
 #define DEVICEID_MRVL_436C 0x436C
+#define DEVICEID_MRVL_436D 0x436D
+#define DEVICEID_MRVL_4370 0x4370
 #define DEVICEID_MRVL_4380 0x4380
 #define DEVICEID_MRVL_4381 0x4381
 
@@ -321,6 +323,9 @@

svn commit: r223398 - stable/8/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:47:23 2011
New Revision: 223398
URL: http://svn.freebsd.org/changeset/base/223398

Log:
  MFC r30:
Add initial support for Marvell 88E8055/88E8075 Yukon Supreme.

Modified:
  stable/8/sys/dev/msk/if_msk.c
  stable/8/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==
--- stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 01:44:09 2011
(r223397)
+++ stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 01:47:23 2011
(r223398)
@@ -221,6 +221,10 @@ static struct msk_product {
"Marvell Yukon 88E8071 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_436C,
"Marvell Yukon 88E8072 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_436D,
+   "Marvell Yukon 88E8055 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_4370,
+   "Marvell Yukon 88E8075 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4380,
"Marvell Yukon 88E8057 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4381,
@@ -1369,11 +1373,16 @@ mskc_reset(struct msk_softc *sc)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
}
+
+   if (sc->msk_hw_id == CHIP_ID_YUKON_SUPR &&
+   sc->msk_hw_rev > CHIP_REV_YU_SU_B0)
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, PCI_CLK_MACSEC_DIS);
if (sc->msk_hw_id == CHIP_ID_YUKON_OPT && sc->msk_hw_rev == 0) {
/* Disable PCIe PHY powerdown(reg 0x80, bit7). */
CSR_WRITE_4(sc, Y2_PEX_PHY_DATA, (0x0080 << 16) | 0x0080);
@@ -1724,7 +1733,6 @@ mskc_attach(device_t dev)
/* Bail out if chip is not recognized. */
if (sc->msk_hw_id < CHIP_ID_YUKON_XL ||
sc->msk_hw_id > CHIP_ID_YUKON_OPT ||
-   sc->msk_hw_id == CHIP_ID_YUKON_SUPR ||
sc->msk_hw_id == CHIP_ID_YUKON_UNKNOWN) {
device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n",
sc->msk_hw_id, sc->msk_hw_rev);
@@ -1831,6 +1839,11 @@ mskc_attach(device_t dev)
sc->msk_clock = 156;/* 156 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
break;
+   case CHIP_ID_YUKON_SUPR:
+   sc->msk_clock = 125;/* 125 MHz */
+   sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 |
+   MSK_FLAG_AUTOTX_CSUM;
+   break;
case CHIP_ID_YUKON_UL_2:
sc->msk_clock = 125;/* 125 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
@@ -3733,7 +3746,8 @@ msk_init_locked(struct msk_if_softc *sc_
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
@@ -3928,7 +3942,8 @@ msk_init_locked(struct msk_if_softc *sc_
msk_stop(sc_if);
return;
}
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
/* Disable flushing of non-ASF packets. */
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T),
GMF_RX_MACSEC_FLUSH_OFF);

Modified: stable/8/sys/dev/msk/if_mskreg.h
==
--- stable/8/sys/dev/msk/if_mskreg.hWed Jun 22 01:44:09 2011
(r223397)
+++ stable/8/sys/dev/msk/if_mskreg.hWed Jun 22 01:47:23 2011
(r223398)
@@ -144,6 +144,8 @@
 #define DEVICEID_MRVL_436A 0x436A
 #define DEVICEID_MRVL_436B 0x436B
 #define DEVICEID_MRVL_436C 0x436C
+#define DEVICEID_MRVL_436D 0x436D
+#define DEVICEID_MRVL_4370 0x4370
 #define DEVICEID_MRVL_4380 0x4380
 #define

svn commit: r223397 - stable/7/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:44:09 2011
New Revision: 223397
URL: http://svn.freebsd.org/changeset/base/223397

Log:
  MFC r19,21,23,26-27,31,222516:
Merge all relevant changes from HEAD to fix long standing
instability issues of msk(4).  To get desired effect of this
merge, cold restarting is required because incorrectly programmed
registers are not reset to default value.
PR: kern/114631, kern/116853, kern/139093, kern/144206,
kern/147824, kern/151169, kern/154591, kern/155636,
kern/156493
  
  r19:
Do not blindly clear entire GPHY control register. It seems some
bits of the register is used for other purposes such that clearing
these bits resulted in unexpected results such as corrupted RX
frames or missing LE status updates.  For old controllers like
Yukon EC it had no effect but it caused all kind of troubles on
Yukon Supreme.
This change shall improve stability of controllers like Yukon
Ultra, Ultra2, Extreme, Optima and Supreme.
  
  r21:
Rework store and forward configuration of TX MAC FIFO. Basically it
enables store and forward mode except for jumbo frame on Yukon
Ultra.
  
  r23:
Do not configure RAM registers for controllers that do not have
them.  These registers are defined only for Yukon XL, Yukon EC and
Yukon FE.
  
  r26:
Make sure to enable all clocks before accessing registers.
Releasing PHY from power down/COMA is done after enabling all
clocks. While I'm here remove unnecessary controller reset.
  
  r27:
Do not touch ASF related register for controllers that do not have
these registers. Also disable Watchdog of ASF microcontroller.
  
  r31:
When MTU is changed, check whether driver should be reinitialized or
not.  If reinitialized is required, clear driver running flag.
  
  r222516:
Correctly check MAC running status before disabling TX/RX MACs.

Modified:
  stable/7/sys/dev/msk/if_msk.c
  stable/7/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/msk/if_msk.c
==
--- stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:42:52 2011
(r223396)
+++ stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 01:44:09 2011
(r223397)
@@ -562,7 +562,7 @@ msk_miibus_statchg(device_t dev)
msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
/* Disable Rx/Tx MAC. */
gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
-   if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) {
+   if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) {
gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
/* Read again to ensure writing. */
@@ -1030,7 +1030,10 @@ msk_ioctl(struct ifnet *ifp, u_long comm
}
}
ifp->if_mtu = ifr->ifr_mtu;
-   msk_init_locked(sc_if);
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   msk_init_locked(sc_if);
+   }
}
MSK_IF_UNLOCK(sc_if);
break;
@@ -1212,37 +1215,30 @@ msk_phy_power(struct msk_softc *sc, int 
 */
CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
 
-   val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
-   val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
+   our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
+   our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
/* Deassert Low Power for 1st PHY. */
-   val |= PCI_Y2_PHY1_COMA;
+   our |= PCI_Y2_PHY1_COMA;
if (sc->msk_num_port > 1)
-   val |= PCI_Y2_PHY2_COMA;
+   our |= PCI_Y2_PHY2_COMA;
}
}
-   /* Release PHY from PowerDown/COMA mode. */
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
-   switch (sc->msk_hw_id) {
-   case CHIP_ID_YUKON_EC_U:
-   case CHIP_ID_YUKON_EX:
-   case CHIP_ID_YUKON_FE_P:
-   case CHIP_ID_YUKON_UL_2:
-   case CHIP_ID_YUKON_OPT:
-   CSR_WRITE_2(sc, B0_CTST, Y2_HW

svn commit: r223396 - stable/8/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 01:42:52 2011
New Revision: 223396
URL: http://svn.freebsd.org/changeset/base/223396

Log:
  MFC r19,21,23,26-27,31,222516:
Merge all relevant changes from HEAD to fix long standing
instability issues of msk(4).  To get desired effect of this
merge, cold restarting is required because incorrectly programmed
registers are not reset to default value.
PR: kern/114631, kern/116853, kern/139093, kern/144206,
kern/147824, kern/151169, kern/154591, kern/155636,
kern/156493
  
  r19:
Do not blindly clear entire GPHY control register. It seems some
bits of the register is used for other purposes such that clearing
these bits resulted in unexpected results such as corrupted RX
frames or missing LE status updates.  For old controllers like
Yukon EC it had no effect but it caused all kind of troubles on
Yukon Supreme.
This change shall improve stability of controllers like Yukon
Ultra, Ultra2, Extreme, Optima and Supreme.
  
  r21:
Rework store and forward configuration of TX MAC FIFO. Basically it
enables store and forward mode except for jumbo frame on Yukon
Ultra.
  
  r23:
Do not configure RAM registers for controllers that do not have
them.  These registers are defined only for Yukon XL, Yukon EC and
Yukon FE.
  
  r26:
Make sure to enable all clocks before accessing registers.
Releasing PHY from power down/COMA is done after enabling all
clocks. While I'm here remove unnecessary controller reset.
  
  r27:
Do not touch ASF related register for controllers that do not have
these registers. Also disable Watchdog of ASF microcontroller.
  
  r31:
When MTU is changed, check whether driver should be reinitialized or
not.  If reinitialized is required, clear driver running flag.
  
  r222516:
Correctly check MAC running status before disabling TX/RX MACs.

Modified:
  stable/8/sys/dev/msk/if_msk.c
  stable/8/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==
--- stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 00:49:24 2011
(r223395)
+++ stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 01:42:52 2011
(r223396)
@@ -562,7 +562,7 @@ msk_miibus_statchg(device_t dev)
msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
/* Disable Rx/Tx MAC. */
gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
-   if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) {
+   if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) {
gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
/* Read again to ensure writing. */
@@ -1030,7 +1030,10 @@ msk_ioctl(struct ifnet *ifp, u_long comm
}
}
ifp->if_mtu = ifr->ifr_mtu;
-   msk_init_locked(sc_if);
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   msk_init_locked(sc_if);
+   }
}
MSK_IF_UNLOCK(sc_if);
break;
@@ -1212,37 +1215,30 @@ msk_phy_power(struct msk_softc *sc, int 
 */
CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
 
-   val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
-   val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
+   our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
+   our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
/* Deassert Low Power for 1st PHY. */
-   val |= PCI_Y2_PHY1_COMA;
+   our |= PCI_Y2_PHY1_COMA;
if (sc->msk_num_port > 1)
-   val |= PCI_Y2_PHY2_COMA;
+   our |= PCI_Y2_PHY2_COMA;
}
}
-   /* Release PHY from PowerDown/COMA mode. */
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
-   switch (sc->msk_hw_id) {
-   case CHIP_ID_YUKON_EC_U:
-   case CHIP_ID_YUKON_EX:
-   case CHIP_ID_YUKON_FE_P:
-   case CHIP_ID_YUKON_UL_2:
-   case CHIP_ID_YUKON_OPT:
- 

svn commit: r223395 - stable/7/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:49:24 2011
New Revision: 223395
URL: http://svn.freebsd.org/changeset/base/223395

Log:
  MFC r205091,216860:
  r205091:
Implement Rx checksum offloading for Yukon EC, Yukon Ultra,
Yukon FE and Yukon Ultra2. These controllers provide very simple
checksum computation mechanism and it requires additional pseudo
header checksum computation in upper stack. Even though I couldn't
see much performance difference with/without Rx checksum offloading
it may help notebook based controllers.
  
Actually controller can compute two checksum value by giving
different starting position of checksum computation on received
frame. However, for long time, Marvell's checksum offloading engine
have been known to have several silicon bugs so don't blindly trust
computed partial checksum value. Instead, compute partial checksum
twice by giving the same checksum computation position and compare
the result. If the value is different it's clear indication of
hardware bug. This configuration lose IP checksum offloading
capability but I think it's better to take safe route.
Note, Rx checksum offloading for Yukon XL was still disabled due to
known silicon bug.
  
  r216860:
Fix endianness bug introduced in r205091.
After controller updates control word in a RX LE, driver converts
it to host byte order. The checksum value in the control word is
stored in big endian form by controller. r205091 didn't account for
the host byte order conversion such that the checksum value was
incorrectly interpreted on big endian architectures which in turn
made all TCP/UDP frames dropped. Make RX checksum offload work
on any architectures by swapping the checksum value.
  
Reported by:Sreekanth M. ( kanthms <> netlogicmicro dot com )
Tested by:  Sreekanth M. ( kanthms <> netlogicmicro dot com )

Modified:
  stable/7/sys/dev/msk/if_msk.c
  stable/7/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/msk/if_msk.c
==
--- stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 00:48:13 2011
(r223394)
+++ stable/7/sys/dev/msk/if_msk.c   Wed Jun 22 00:49:24 2011
(r223395)
@@ -270,6 +270,7 @@ static void msk_intr_hwerr(struct msk_so
 #ifndef __NO_STRICT_ALIGNMENT
 static __inline void msk_fixup_rx(struct mbuf *);
 #endif
+static __inline void msk_rxcsum(struct msk_if_softc *, uint32_t, struct mbuf 
*);
 static void msk_rxeof(struct msk_if_softc *, uint32_t, uint32_t, int);
 static void msk_jumbo_rxeof(struct msk_if_softc *, uint32_t, uint32_t, int);
 static void msk_txeof(struct msk_if_softc *, int);
@@ -294,6 +295,7 @@ static int msk_txrx_dma_alloc(struct msk
 static int msk_rx_dma_jalloc(struct msk_if_softc *);
 static void msk_txrx_dma_free(struct msk_if_softc *);
 static void msk_rx_dma_jfree(struct msk_if_softc *);
+static int msk_rx_fill(struct msk_if_softc *, int);
 static int msk_init_rx_ring(struct msk_if_softc *);
 static int msk_init_jumbo_rx_ring(struct msk_if_softc *);
 static void msk_init_tx_ring(struct msk_if_softc *);
@@ -642,6 +644,54 @@ msk_setvlan(struct msk_if_softc *sc_if, 
 }
 
 static int
+msk_rx_fill(struct msk_if_softc *sc_if, int jumbo)
+{
+   uint16_t idx;
+   int i;
+
+   if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 &&
+   (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+   /* Wait until controller executes OP_TCPSTART command. */
+   for (i = 10; i > 0; i--) {
+   DELAY(10);
+   idx = CSR_READ_2(sc_if->msk_softc,
+   Y2_PREF_Q_ADDR(sc_if->msk_rxq,
+   PREF_UNIT_GET_IDX_REG));
+   if (idx != 0)
+   break;
+   }
+   if (i == 0) {
+   device_printf(sc_if->msk_if_dev,
+   "prefetch unit stuck?\n");
+   return (ETIMEDOUT);
+   }
+   /*
+* Fill consumed LE with free buffer. This can be done
+* in Rx handler but we don't want to add special code
+* in fast handler.
+*/
+   if (jumbo > 0) {
+   if (msk_jumbo_newbuf(sc_if, 0) != 0)
+   return (ENOBUFS);
+   bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
+   sc_if->msk_cdata.msk_jumbo_rx_ring_map,
+   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+   } else {
+   if (msk_newbuf(sc_if, 0) != 0)
+   r

svn commit: r223394 - stable/8/sys/dev/msk

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:48:13 2011
New Revision: 223394
URL: http://svn.freebsd.org/changeset/base/223394

Log:
  MFC r205091,216860:
  r205091:
Implement Rx checksum offloading for Yukon EC, Yukon Ultra,
Yukon FE and Yukon Ultra2. These controllers provide very simple
checksum computation mechanism and it requires additional pseudo
header checksum computation in upper stack. Even though I couldn't
see much performance difference with/without Rx checksum offloading
it may help notebook based controllers.
  
Actually controller can compute two checksum value by giving
different starting position of checksum computation on received
frame. However, for long time, Marvell's checksum offloading engine
have been known to have several silicon bugs so don't blindly trust
computed partial checksum value. Instead, compute partial checksum
twice by giving the same checksum computation position and compare
the result. If the value is different it's clear indication of
hardware bug. This configuration lose IP checksum offloading
capability but I think it's better to take safe route.
Note, Rx checksum offloading for Yukon XL was still disabled due to
known silicon bug.
  
  r216860:
Fix endianness bug introduced in r205091.
After controller updates control word in a RX LE, driver converts
it to host byte order. The checksum value in the control word is
stored in big endian form by controller. r205091 didn't account for
the host byte order conversion such that the checksum value was
incorrectly interpreted on big endian architectures which in turn
made all TCP/UDP frames dropped. Make RX checksum offload work
on any architectures by swapping the checksum value.
  
Reported by:Sreekanth M. ( kanthms <> netlogicmicro dot com )
Tested by:  Sreekanth M. ( kanthms <> netlogicmicro dot com )

Modified:
  stable/8/sys/dev/msk/if_msk.c
  stable/8/sys/dev/msk/if_mskreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/msk/if_msk.c
==
--- stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 00:39:36 2011
(r223393)
+++ stable/8/sys/dev/msk/if_msk.c   Wed Jun 22 00:48:13 2011
(r223394)
@@ -270,6 +270,7 @@ static void msk_intr_hwerr(struct msk_so
 #ifndef __NO_STRICT_ALIGNMENT
 static __inline void msk_fixup_rx(struct mbuf *);
 #endif
+static __inline void msk_rxcsum(struct msk_if_softc *, uint32_t, struct mbuf 
*);
 static void msk_rxeof(struct msk_if_softc *, uint32_t, uint32_t, int);
 static void msk_jumbo_rxeof(struct msk_if_softc *, uint32_t, uint32_t, int);
 static void msk_txeof(struct msk_if_softc *, int);
@@ -294,6 +295,7 @@ static int msk_txrx_dma_alloc(struct msk
 static int msk_rx_dma_jalloc(struct msk_if_softc *);
 static void msk_txrx_dma_free(struct msk_if_softc *);
 static void msk_rx_dma_jfree(struct msk_if_softc *);
+static int msk_rx_fill(struct msk_if_softc *, int);
 static int msk_init_rx_ring(struct msk_if_softc *);
 static int msk_init_jumbo_rx_ring(struct msk_if_softc *);
 static void msk_init_tx_ring(struct msk_if_softc *);
@@ -642,6 +644,54 @@ msk_setvlan(struct msk_if_softc *sc_if, 
 }
 
 static int
+msk_rx_fill(struct msk_if_softc *sc_if, int jumbo)
+{
+   uint16_t idx;
+   int i;
+
+   if ((sc_if->msk_flags & MSK_FLAG_DESCV2) == 0 &&
+   (sc_if->msk_ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+   /* Wait until controller executes OP_TCPSTART command. */
+   for (i = 10; i > 0; i--) {
+   DELAY(10);
+   idx = CSR_READ_2(sc_if->msk_softc,
+   Y2_PREF_Q_ADDR(sc_if->msk_rxq,
+   PREF_UNIT_GET_IDX_REG));
+   if (idx != 0)
+   break;
+   }
+   if (i == 0) {
+   device_printf(sc_if->msk_if_dev,
+   "prefetch unit stuck?\n");
+   return (ETIMEDOUT);
+   }
+   /*
+* Fill consumed LE with free buffer. This can be done
+* in Rx handler but we don't want to add special code
+* in fast handler.
+*/
+   if (jumbo > 0) {
+   if (msk_jumbo_newbuf(sc_if, 0) != 0)
+   return (ENOBUFS);
+   bus_dmamap_sync(sc_if->msk_cdata.msk_jumbo_rx_ring_tag,
+   sc_if->msk_cdata.msk_jumbo_rx_ring_map,
+   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+   } else {
+   if (msk_newb

svn commit: r223393 - stable/7/sys/dev/nfe

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:39:36 2011
New Revision: 223393
URL: http://svn.freebsd.org/changeset/base/223393

Log:
  MFC r222542:
If driver is not running, disable interrupts and do not try to
process received frames.  Previously it was possible to handle RX
interrupts even if controller is not fully initialized. This
resulted in non-working driver after system is up and running.
  
Reported by:hselasky
Tested by:  hselasky

Modified:
  stable/7/sys/dev/nfe/if_nfe.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/nfe/if_nfe.c
==
--- stable/7/sys/dev/nfe/if_nfe.c   Wed Jun 22 00:38:25 2011
(r223392)
+++ stable/7/sys/dev/nfe/if_nfe.c   Wed Jun 22 00:39:36 2011
(r223393)
@@ -1888,7 +1888,7 @@ nfe_int_task(void *arg, int pending)
 
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
NFE_UNLOCK(sc);
-   nfe_enable_intr(sc);
+   nfe_disable_intr(sc);
return;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223392 - stable/8/sys/dev/nfe

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:38:25 2011
New Revision: 223392
URL: http://svn.freebsd.org/changeset/base/223392

Log:
  MFC r222542:
If driver is not running, disable interrupts and do not try to
process received frames.  Previously it was possible to handle RX
interrupts even if controller is not fully initialized. This
resulted in non-working driver after system is up and running.
  
Reported by:hselasky
Tested by:  hselasky

Modified:
  stable/8/sys/dev/nfe/if_nfe.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/nfe/if_nfe.c
==
--- stable/8/sys/dev/nfe/if_nfe.c   Wed Jun 22 00:35:42 2011
(r223391)
+++ stable/8/sys/dev/nfe/if_nfe.c   Wed Jun 22 00:38:25 2011
(r223392)
@@ -1889,7 +1889,7 @@ nfe_int_task(void *arg, int pending)
 
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
NFE_UNLOCK(sc);
-   nfe_enable_intr(sc);
+   nfe_disable_intr(sc);
return;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223391 - stable/8/sys/dev/usb/net

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:35:42 2011
New Revision: 223391
URL: http://svn.freebsd.org/changeset/base/223391

Log:
  MFC r222581:
Poke correct GPIO pins for newer axe(4) controllers with Marvell
PHY. Newer models seem to use different LED mode that requires
enabling both GPIO1 and GPIO2.

Modified:
  stable/8/sys/dev/usb/net/if_axe.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/usb/net/if_axe.c
==
--- stable/8/sys/dev/usb/net/if_axe.c   Wed Jun 22 00:22:26 2011
(r223390)
+++ stable/8/sys/dev/usb/net/if_axe.c   Wed Jun 22 00:35:42 2011
(r223391)
@@ -517,7 +517,7 @@ static void
 axe_ax88178_init(struct axe_softc *sc)
 {
struct usb_ether *ue;
-   int gpio0, phymode;
+   int gpio0, ledmode, phymode;
uint16_t eeprom, val;
 
ue = &sc->sc_ue;
@@ -531,9 +531,11 @@ axe_ax88178_init(struct axe_softc *sc)
if (eeprom == 0x) {
phymode = AXE_PHY_MODE_MARVELL;
gpio0 = 1;
+   ledmode = 0;
} else {
phymode = eeprom & 0x7f;
gpio0 = (eeprom & 0x80) ? 0 : 1;
+   ledmode = eeprom >> 8;
}
 
if (bootverbose)
@@ -551,9 +553,22 @@ axe_ax88178_init(struct axe_softc *sc)
AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2_EN, hz / 4);
AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2 | AXE_GPIO2_EN,
hz / 32);
-   } else
+   } else {
AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 |
-   AXE_GPIO1_EN, hz / 32);
+   AXE_GPIO1_EN, hz / 3);
+   if (ledmode == 1) {
+   AXE_GPIO_WRITE(AXE_GPIO1_EN, hz / 3);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN,
+   hz / 3);
+   } else {
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2 | AXE_GPIO2_EN, hz / 32);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2_EN, hz / 4);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2 | AXE_GPIO2_EN, hz / 32);
+   }
+   }
break;
case AXE_PHY_MODE_CICADA:
case AXE_PHY_MODE_CICADA_V2:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223390 - stable/7/sys/dev/bge

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:22:26 2011
New Revision: 223390
URL: http://svn.freebsd.org/changeset/base/223390

Log:
  MFC r221974:
Correctly disable jumbo frame support for BCM5719 A0.

Modified:
  stable/7/sys/dev/bge/if_bge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Wed Jun 22 00:21:19 2011
(r223389)
+++ stable/7/sys/dev/bge/if_bge.c   Wed Jun 22 00:22:26 2011
(r223390)
@@ -2836,7 +2836,7 @@ bge_attach(device_t dev)
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 &&
sc->bge_chipid == BGE_CHIPID_BCM5719_A0) {
/* Jumbo frame on BCM5719 A0 does not work. */
-   sc->bge_flags &= ~BGE_FLAG_JUMBO_FRAME;
+   sc->bge_flags &= ~BGE_FLAG_JUMBO;
}
break;
case BGE_ASICREV_BCM5755:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223389 - stable/8/sys/dev/bge

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:21:19 2011
New Revision: 223389
URL: http://svn.freebsd.org/changeset/base/223389

Log:
  MFC r221974:
Correctly disable jumbo frame support for BCM5719 A0.

Modified:
  stable/8/sys/dev/bge/if_bge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Wed Jun 22 00:17:48 2011
(r223388)
+++ stable/8/sys/dev/bge/if_bge.c   Wed Jun 22 00:21:19 2011
(r223389)
@@ -2836,7 +2836,7 @@ bge_attach(device_t dev)
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 &&
sc->bge_chipid == BGE_CHIPID_BCM5719_A0) {
/* Jumbo frame on BCM5719 A0 does not work. */
-   sc->bge_flags &= ~BGE_FLAG_JUMBO_FRAME;
+   sc->bge_flags &= ~BGE_FLAG_JUMBO;
}
break;
case BGE_ASICREV_BCM5755:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r223388 - stable/7/sys/dev/bge

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:17:48 2011
New Revision: 223388
URL: http://svn.freebsd.org/changeset/base/223388

Log:
  MFC r221818:
Add initial BCM5719 support. TSO and jumbo frame was intentionally
disabled for BCM5719 A0 revision due to known hardware errata.
Many thanks to Broadcom for continuing support of FreeBSD.
  
Submitted by:   Geans Pin at Broadcom

Modified:
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Wed Jun 22 00:16:40 2011
(r223387)
+++ stable/7/sys/dev/bge/if_bge.c   Wed Jun 22 00:17:48 2011
(r223388)
@@ -171,6 +171,7 @@ static const struct bge_type {
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5715S },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5717 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5718 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM5719 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5720 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5721 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5722 },
@@ -299,6 +300,7 @@ static const struct bge_revision {
{ BGE_CHIPID_BCM5715_A3,"BCM5715 A3" },
{ BGE_CHIPID_BCM5717_A0,"BCM5717 A0" },
{ BGE_CHIPID_BCM5717_B0,"BCM5717 B0" },
+   { BGE_CHIPID_BCM5719_A0,"BCM5719 A0" },
{ BGE_CHIPID_BCM5755_A0,"BCM5755 A0" },
{ BGE_CHIPID_BCM5755_A1,"BCM5755 A1" },
{ BGE_CHIPID_BCM5755_A2,"BCM5755 A2" },
@@ -346,6 +348,7 @@ static const struct bge_revision const b
{ BGE_ASICREV_BCM57765, "unknown BCM57765" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
{ BGE_ASICREV_BCM5717,  "unknown BCM5717" },
+   { BGE_ASICREV_BCM5719,  "unknown BCM5719" },
 
{ 0, NULL }
 };
@@ -1481,6 +1484,14 @@ bge_chipinit(struct bge_softc *sc)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT;
if (sc->bge_chipid == BGE_CHIPID_BCM57765_A0)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_CRDRDR_RDMA_MRRS_MSK;
+   /*
+* Enable HW workaround for controllers that misinterpret
+* a status tag update and leave interrupts permanently
+* disabled.
+*/
+   if (sc->bge_asicrev != BGE_ASICREV_BCM5717 &&
+   sc->bge_asicrev != BGE_ASICREV_BCM57765)
+   dma_rw_ctl |= BGE_PCIDMARWCTL_TAGGED_STATUS_WA;
}
pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4);
 
@@ -1537,7 +1548,7 @@ bge_blockinit(struct bge_softc *sc)
struct bge_rcb *rcb;
bus_size_t vrcb;
bge_hostaddr taddr;
-   uint32_t val;
+   uint32_t dmactl, val;
int i, limit;
 
/*
@@ -1594,8 +1605,16 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   val = BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN;
+   /*
+* Change the arbitration algorithm of TXMBUF read request to
+* round-robin instead of priority based for BCM5719.  When
+* TXFIFO is almost empty, RDMA will hold its request until
+* TXFIFO is not almost empty.
+*/
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
+   val |= BGE_BMANMODE_NO_TX_UNDERRUN;
+   CSR_WRITE_4(sc, BGE_BMAN_MODE, val);
 
/* Poll for buffer manager start indication */
for (i = 0; i < BGE_TIMEOUT; i++) {
@@ -1692,7 +1711,8 @@ bge_blockinit(struct bge_softc *sc)
rcb->bge_maxlen_flags =
BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0);
}
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717;
else
rcb->bge_nicaddr = BGE_STD_RX_RINGS;
@@ -1724,7 +1744,8 @@ bge_blockinit(struct bge_softc *sc)
BUS_DMASYNC_PREREAD);
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED);
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717;
else
  

svn commit: r223387 - stable/8/sys/dev/bge

2011-06-21 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun 22 00:16:40 2011
New Revision: 223387
URL: http://svn.freebsd.org/changeset/base/223387

Log:
  MFC r221818:
Add initial BCM5719 support. TSO and jumbo frame was intentionally
disabled for BCM5719 A0 revision due to known hardware errata.
Many thanks to Broadcom for continuing support of FreeBSD.
  
Submitted by:   Geans Pin at Broadcom

Modified:
  stable/8/sys/dev/bge/if_bge.c
  stable/8/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Tue Jun 21 22:45:31 2011
(r223386)
+++ stable/8/sys/dev/bge/if_bge.c   Wed Jun 22 00:16:40 2011
(r223387)
@@ -171,6 +171,7 @@ static const struct bge_type {
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5715S },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5717 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5718 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM5719 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5720 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5721 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5722 },
@@ -299,6 +300,7 @@ static const struct bge_revision {
{ BGE_CHIPID_BCM5715_A3,"BCM5715 A3" },
{ BGE_CHIPID_BCM5717_A0,"BCM5717 A0" },
{ BGE_CHIPID_BCM5717_B0,"BCM5717 B0" },
+   { BGE_CHIPID_BCM5719_A0,"BCM5719 A0" },
{ BGE_CHIPID_BCM5755_A0,"BCM5755 A0" },
{ BGE_CHIPID_BCM5755_A1,"BCM5755 A1" },
{ BGE_CHIPID_BCM5755_A2,"BCM5755 A2" },
@@ -346,6 +348,7 @@ static const struct bge_revision const b
{ BGE_ASICREV_BCM57765, "unknown BCM57765" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
{ BGE_ASICREV_BCM5717,  "unknown BCM5717" },
+   { BGE_ASICREV_BCM5719,  "unknown BCM5719" },
 
{ 0, NULL }
 };
@@ -1481,6 +1484,14 @@ bge_chipinit(struct bge_softc *sc)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT;
if (sc->bge_chipid == BGE_CHIPID_BCM57765_A0)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_CRDRDR_RDMA_MRRS_MSK;
+   /*
+* Enable HW workaround for controllers that misinterpret
+* a status tag update and leave interrupts permanently
+* disabled.
+*/
+   if (sc->bge_asicrev != BGE_ASICREV_BCM5717 &&
+   sc->bge_asicrev != BGE_ASICREV_BCM57765)
+   dma_rw_ctl |= BGE_PCIDMARWCTL_TAGGED_STATUS_WA;
}
pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4);
 
@@ -1537,7 +1548,7 @@ bge_blockinit(struct bge_softc *sc)
struct bge_rcb *rcb;
bus_size_t vrcb;
bge_hostaddr taddr;
-   uint32_t val;
+   uint32_t dmactl, val;
int i, limit;
 
/*
@@ -1594,8 +1605,16 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   val = BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN;
+   /*
+* Change the arbitration algorithm of TXMBUF read request to
+* round-robin instead of priority based for BCM5719.  When
+* TXFIFO is almost empty, RDMA will hold its request until
+* TXFIFO is not almost empty.
+*/
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
+   val |= BGE_BMANMODE_NO_TX_UNDERRUN;
+   CSR_WRITE_4(sc, BGE_BMAN_MODE, val);
 
/* Poll for buffer manager start indication */
for (i = 0; i < BGE_TIMEOUT; i++) {
@@ -1692,7 +1711,8 @@ bge_blockinit(struct bge_softc *sc)
rcb->bge_maxlen_flags =
BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0);
}
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717;
else
rcb->bge_nicaddr = BGE_STD_RX_RINGS;
@@ -1724,7 +1744,8 @@ bge_blockinit(struct bge_softc *sc)
BUS_DMASYNC_PREREAD);
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED);
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_JUMB

svn commit: r222581 - head/sys/dev/usb/net

2011-06-01 Thread Pyun YongHyeon
Author: yongari
Date: Wed Jun  1 18:42:44 2011
New Revision: 222581
URL: http://svn.freebsd.org/changeset/base/222581

Log:
  Poke correct GPIO pins for newer axe(4) controllers with Marvell
  PHY. Newer models seem to use different LED mode that requires
  enabling both GPIO1 and GPIO2.
  
  Tested by:marcel

Modified:
  head/sys/dev/usb/net/if_axe.c

Modified: head/sys/dev/usb/net/if_axe.c
==
--- head/sys/dev/usb/net/if_axe.c   Wed Jun  1 18:27:13 2011
(r222580)
+++ head/sys/dev/usb/net/if_axe.c   Wed Jun  1 18:42:44 2011
(r222581)
@@ -514,7 +514,7 @@ static void
 axe_ax88178_init(struct axe_softc *sc)
 {
struct usb_ether *ue;
-   int gpio0, phymode;
+   int gpio0, ledmode, phymode;
uint16_t eeprom, val;
 
ue = &sc->sc_ue;
@@ -528,9 +528,11 @@ axe_ax88178_init(struct axe_softc *sc)
if (eeprom == 0x) {
phymode = AXE_PHY_MODE_MARVELL;
gpio0 = 1;
+   ledmode = 0;
} else {
phymode = eeprom & 0x7f;
gpio0 = (eeprom & 0x80) ? 0 : 1;
+   ledmode = eeprom >> 8;
}
 
if (bootverbose)
@@ -548,9 +550,22 @@ axe_ax88178_init(struct axe_softc *sc)
AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2_EN, hz / 4);
AXE_GPIO_WRITE(AXE_GPIO0_EN | AXE_GPIO2 | AXE_GPIO2_EN,
hz / 32);
-   } else
+   } else {
AXE_GPIO_WRITE(AXE_GPIO_RELOAD_EEPROM | AXE_GPIO1 |
-   AXE_GPIO1_EN, hz / 32);
+   AXE_GPIO1_EN, hz / 3);
+   if (ledmode == 1) {
+   AXE_GPIO_WRITE(AXE_GPIO1_EN, hz / 3);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN,
+   hz / 3);
+   } else {
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2 | AXE_GPIO2_EN, hz / 32);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2_EN, hz / 4);
+   AXE_GPIO_WRITE(AXE_GPIO1 | AXE_GPIO1_EN |
+   AXE_GPIO2 | AXE_GPIO2_EN, hz / 32);
+   }
+   }
break;
case AXE_PHY_MODE_CICADA:
case AXE_PHY_MODE_CICADA_V2:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222542 - head/sys/dev/nfe

2011-05-31 Thread Pyun YongHyeon
Author: yongari
Date: Tue May 31 18:45:15 2011
New Revision: 222542
URL: http://svn.freebsd.org/changeset/base/222542

Log:
  If driver is not running, disable interrupts and do not try to
  process received frames.  Previously it was possible to handle RX
  interrupts even if controller is not fully initialized. This
  resulted in non-working driver after system is up and running.
  
  Reported by:  hselasky
  Tested by:hselasky

Modified:
  head/sys/dev/nfe/if_nfe.c

Modified: head/sys/dev/nfe/if_nfe.c
==
--- head/sys/dev/nfe/if_nfe.c   Tue May 31 18:27:18 2011(r222541)
+++ head/sys/dev/nfe/if_nfe.c   Tue May 31 18:45:15 2011(r222542)
@@ -1889,7 +1889,7 @@ nfe_int_task(void *arg, int pending)
 
if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) {
NFE_UNLOCK(sc);
-   nfe_enable_intr(sc);
+   nfe_disable_intr(sc);
return;
}
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222516 - head/sys/dev/msk

2011-05-30 Thread Pyun YongHyeon
Author: yongari
Date: Tue May 31 01:30:58 2011
New Revision: 222516
URL: http://svn.freebsd.org/changeset/base/222516

Log:
  Correctly check MAC running status before disabling TX/RX MACs.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Tue May 31 00:25:52 2011(r222515)
+++ head/sys/dev/msk/if_msk.c   Tue May 31 01:30:58 2011(r222516)
@@ -566,7 +566,7 @@ msk_miibus_statchg(device_t dev)
msk_phy_writereg(sc_if, PHY_ADDR_MARV, PHY_MARV_INT_MASK, 0);
/* Disable Rx/Tx MAC. */
gmac = GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
-   if ((GM_GPCR_RX_ENA | GM_GPCR_TX_ENA) != 0) {
+   if ((gmac & (GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)) != 0) {
gmac &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA);
GMAC_WRITE_2(sc, sc_if->msk_port, GM_GP_CTRL, gmac);
/* Read again to ensure writing. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222388 - stable/7/sys/pci

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 21:45:21 2011
New Revision: 222388
URL: http://svn.freebsd.org/changeset/base/222388

Log:
  MFC r221565-221568,221579:
  r221565:
Reuse the TX descriptor(DPD) if xl_encap() failed instead of just
picking the next available one. This may explain why xl(4) sees TX
underrun error with no queued frame. I hope this addresses a long
standing xl(4) watchdog timeout issue as well.
  
Obtained from:OpenBSD
  
  r221566,221579:
Rename xl_stats_update() callout handler to xl_tick() and move MII
tick driving logic to xl_tick(). Now xl_tick() handles MII tick as
well as periodic updating of statistics.
This change removes a hack used in interrupt handler where it
wanted to update statistics without driving MII tick.
  
  r221567:
Rearm watchdog timer if driver kick controller to recover from TX
underrun error.
While here, prepend 0x to status code to show TX status is hex
number.
  
  r221568:
XL_DMACTL is 32bit register, use 32bit write macro.
While I'm here add more bits for the register.

Modified:
  stable/7/sys/pci/if_xl.c
  stable/7/sys/pci/if_xlreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/pci/if_xl.c
==
--- stable/7/sys/pci/if_xl.cFri May 27 21:43:35 2011(r222387)
+++ stable/7/sys/pci/if_xl.cFri May 27 21:45:21 2011(r222388)
@@ -228,8 +228,8 @@ static int xl_attach(device_t);
 static int xl_detach(device_t);
 
 static int xl_newbuf(struct xl_softc *, struct xl_chain_onefrag *);
-static void xl_stats_update(void *);
-static void xl_stats_update_locked(struct xl_softc *);
+static void xl_tick(void *);
+static void xl_stats_update(struct xl_softc *);
 static int xl_encap(struct xl_softc *, struct xl_chain *, struct mbuf **);
 static int xl_rxeof(struct xl_softc *);
 static void xl_rxeof_task(void *, int);
@@ -1335,7 +1335,7 @@ xl_attach(device_t dev)
}
 
sc->xl_unit = unit;
-   callout_init_mtx(&sc->xl_stat_callout, &sc->xl_mtx, 0);
+   callout_init_mtx(&sc->xl_tick_callout, &sc->xl_mtx, 0);
TASK_INIT(&sc->xl_task, 0, xl_rxeof_task, sc);
 
/*
@@ -1700,7 +1700,7 @@ xl_detach(device_t dev)
xl_stop(sc);
XL_UNLOCK(sc);
taskqueue_drain(taskqueue_swi, &sc->xl_task);
-   callout_drain(&sc->xl_stat_callout);
+   callout_drain(&sc->xl_tick_callout);
ether_ifdetach(ifp);
}
if (sc->xl_miibus)
@@ -2212,7 +2212,7 @@ xl_txeoc(struct xl_softc *sc)
txstat & XL_TXSTATUS_JABBER ||
txstat & XL_TXSTATUS_RECLAIM) {
device_printf(sc->xl_dev,
-   "transmission error: %x\n", txstat);
+   "transmission error: 0x%02x\n", txstat);
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
xl_wait(sc);
if (sc->xl_type == XL_TYPE_905B) {
@@ -2225,11 +2225,14 @@ xl_txeoc(struct xl_softc *sc)
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
c->xl_phys);
CSR_WRITE_1(sc, XL_DOWN_POLL, 64);
+   sc->xl_wdog_timer = 5;
}
} else {
-   if (sc->xl_cdata.xl_tx_head != NULL)
+   if (sc->xl_cdata.xl_tx_head != NULL) {
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
sc->xl_cdata.xl_tx_head->xl_phys);
+   sc->xl_wdog_timer = 5;
+   }
}
/*
 * Remember to set this for the
@@ -2312,11 +2315,8 @@ xl_intr(void *arg)
break;
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_update_locked(sc);
-   sc->xl_stats_no_timeout = 0;
-   }
+   if (status & XL_STAT_STATSOFLOW)
+   xl_stats_update(sc);
}
 
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
@@ -2381,48 +2381,45 @@ xl_poll_locked(struct ifnet *ifp, enum p
xl_init_locked(sc);
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_update_locked(sc);
-   sc->xl_st

svn commit: r222387 - stable/8/sys/dev/xl

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 21:43:35 2011
New Revision: 222387
URL: http://svn.freebsd.org/changeset/base/222387

Log:
  MFC r221565-221568,221579:
  r221565:
Reuse the TX descriptor(DPD) if xl_encap() failed instead of just
picking the next available one. This may explain why xl(4) sees TX
underrun error with no queued frame. I hope this addresses a long
standing xl(4) watchdog timeout issue as well.
  
Obtained from:OpenBSD
  
  r221566,221579:
Rename xl_stats_update() callout handler to xl_tick() and move MII
tick driving logic to xl_tick(). Now xl_tick() handles MII tick as
well as periodic updating of statistics.
This change removes a hack used in interrupt handler where it
wanted to update statistics without driving MII tick.
  
  r221567:
Rearm watchdog timer if driver kick controller to recover from TX
underrun error.
While here, prepend 0x to status code to show TX status is hex
number.
  
  r221568:
XL_DMACTL is 32bit register, use 32bit write macro.
While I'm here add more bits for the register.

Modified:
  stable/8/sys/dev/xl/if_xl.c
  stable/8/sys/dev/xl/if_xlreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/xl/if_xl.c
==
--- stable/8/sys/dev/xl/if_xl.c Fri May 27 20:53:07 2011(r222386)
+++ stable/8/sys/dev/xl/if_xl.c Fri May 27 21:43:35 2011(r222387)
@@ -225,8 +225,8 @@ static int xl_attach(device_t);
 static int xl_detach(device_t);
 
 static int xl_newbuf(struct xl_softc *, struct xl_chain_onefrag *);
-static void xl_stats_update(void *);
-static void xl_stats_update_locked(struct xl_softc *);
+static void xl_tick(void *);
+static void xl_stats_update(struct xl_softc *);
 static int xl_encap(struct xl_softc *, struct xl_chain *, struct mbuf **);
 static int xl_rxeof(struct xl_softc *);
 static void xl_rxeof_task(void *, int);
@@ -1330,7 +1330,7 @@ xl_attach(device_t dev)
goto fail;
}
 
-   callout_init_mtx(&sc->xl_stat_callout, &sc->xl_mtx, 0);
+   callout_init_mtx(&sc->xl_tick_callout, &sc->xl_mtx, 0);
TASK_INIT(&sc->xl_task, 0, xl_rxeof_task, sc);
 
/*
@@ -1695,7 +1695,7 @@ xl_detach(device_t dev)
xl_stop(sc);
XL_UNLOCK(sc);
taskqueue_drain(taskqueue_swi, &sc->xl_task);
-   callout_drain(&sc->xl_stat_callout);
+   callout_drain(&sc->xl_tick_callout);
ether_ifdetach(ifp);
}
if (sc->xl_miibus)
@@ -2207,7 +2207,7 @@ xl_txeoc(struct xl_softc *sc)
txstat & XL_TXSTATUS_JABBER ||
txstat & XL_TXSTATUS_RECLAIM) {
device_printf(sc->xl_dev,
-   "transmission error: %x\n", txstat);
+   "transmission error: 0x%02x\n", txstat);
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
xl_wait(sc);
if (sc->xl_type == XL_TYPE_905B) {
@@ -2220,11 +2220,14 @@ xl_txeoc(struct xl_softc *sc)
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
c->xl_phys);
CSR_WRITE_1(sc, XL_DOWN_POLL, 64);
+   sc->xl_wdog_timer = 5;
}
} else {
-   if (sc->xl_cdata.xl_tx_head != NULL)
+   if (sc->xl_cdata.xl_tx_head != NULL) {
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
sc->xl_cdata.xl_tx_head->xl_phys);
+   sc->xl_wdog_timer = 5;
+   }
}
/*
 * Remember to set this for the
@@ -2307,11 +2310,8 @@ xl_intr(void *arg)
break;
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_update_locked(sc);
-   sc->xl_stats_no_timeout = 0;
-   }
+   if (status & XL_STAT_STATSOFLOW)
+   xl_stats_update(sc);
}
 
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
@@ -2379,49 +2379,46 @@ xl_poll_locked(struct ifnet *ifp, enum p
xl_init_locked(sc);
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_

svn commit: r222385 - stable/7/sys/pci

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 20:34:23 2011
New Revision: 222385
URL: http://svn.freebsd.org/changeset/base/222385

Log:
  MFC r221563-221564:
  r221563:
Terminate interrupt handler if driver detect it's not running.
Also add check for driver running state before trying to send
frames. While I'm here, use for loop.
  
  r221564:
Change xl_rxeof() a bit to return the number of processed frames in
RX descriptor ring. Previously it returned the number of frames
that were successfully passed to upper stack which in turn means it
ignored frames that were discarded due to errors. The number of
processed frames in RX descriptor ring is used to detect whether
driver is out of sync with controller's current descriptor pointer.
Returning number of processed frames reduces unnecessary (probably
wrong) re-synchronization.
  
While here, remove unnecessary local variable initialization.

Modified:
  stable/7/sys/pci/if_xl.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/pci/if_xl.c
==
--- stable/7/sys/pci/if_xl.cFri May 27 20:33:26 2011(r222384)
+++ stable/7/sys/pci/if_xl.cFri May 27 20:34:23 2011(r222385)
@@ -231,7 +231,7 @@ static int xl_newbuf(struct xl_softc *, 
 static void xl_stats_update(void *);
 static void xl_stats_update_locked(struct xl_softc *);
 static int xl_encap(struct xl_softc *, struct xl_chain *, struct mbuf **);
-static void xl_rxeof(struct xl_softc *);
+static int xl_rxeof(struct xl_softc *);
 static void xl_rxeof_task(void *, int);
 static int xl_rx_resync(struct xl_softc *);
 static void xl_txeof(struct xl_softc *);
@@ -1943,13 +1943,14 @@ xl_rx_resync(struct xl_softc *sc)
  * A frame has been uploaded: pass the resulting mbuf chain up to
  * the higher level protocols.
  */
-static void
+static int
 xl_rxeof(struct xl_softc *sc)
 {
struct mbuf *m;
struct ifnet*ifp = sc->xl_ifp;
struct xl_chain_onefrag *cur_rx;
-   int total_len = 0;
+   int total_len;
+   int rx_npkts = 0;
u_int32_t   rxstat;
 
XL_LOCK_ASSERT(sc);
@@ -1967,6 +1968,7 @@ again:
cur_rx = sc->xl_cdata.xl_rx_head;
sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
total_len = rxstat & XL_RXSTAT_LENMASK;
+   rx_npkts++;
 
/*
 * Since we have told the chip to allow large frames,
@@ -2058,7 +2060,7 @@ again:
 * packet up the network stack.
 */
if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
-   return;
+   return (rx_npkts);
}
 
/*
@@ -2082,6 +2084,7 @@ again:
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_UP_UNSTALL);
goto again;
}
+   return (rx_npkts);
 }
 
 /*
@@ -2275,17 +2278,17 @@ xl_intr(void *arg)
}
 #endif
 
-   while ((status = CSR_READ_2(sc, XL_STATUS)) & XL_INTRS &&
-   status != 0x) {
+   for (;;) {
+   status = CSR_READ_2(sc, XL_STATUS);
+   if ((status & XL_INTRS) == 0 || status == 0x)
+   break;
CSR_WRITE_2(sc, XL_COMMAND,
XL_CMD_INTR_ACK|(status & XL_INTRS));
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   break;
 
if (status & XL_STAT_UP_COMPLETE) {
-   int curpkts;
-
-   curpkts = ifp->if_ipackets;
-   xl_rxeof(sc);
-   if (curpkts == ifp->if_ipackets) {
+   if (xl_rxeof(sc) == 0) {
while (xl_rx_resync(sc))
xl_rxeof(sc);
}
@@ -2306,6 +2309,7 @@ xl_intr(void *arg)
if (status & XL_STAT_ADFAIL) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
xl_init_locked(sc);
+   break;
}
 
if (status & XL_STAT_STATSOFLOW) {
@@ -2315,7 +2319,8 @@ xl_intr(void *arg)
}
}
 
-   if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+   if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
+   ifp->if_drv_flags & IFF_DRV_RUNNING) {
if (sc->xl_type == XL_TYPE_905B)
xl_start_90xB_locked(ifp);
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222384 - stable/8/sys/dev/xl

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 20:33:26 2011
New Revision: 222384
URL: http://svn.freebsd.org/changeset/base/222384

Log:
  MFC r221563-221564:
  r221563:
Terminate interrupt handler if driver detect it's not running.
Also add check for driver running state before trying to send
frames. While I'm here, use for loop.
  
  r221564:
Change xl_rxeof() a bit to return the number of processed frames in
RX descriptor ring. Previously it returned the number of frames
that were successfully passed to upper stack which in turn means it
ignored frames that were discarded due to errors. The number of
processed frames in RX descriptor ring is used to detect whether
driver is out of sync with controller's current descriptor pointer.
Returning number of processed frames reduces unnecessary (probably
wrong) re-synchronization.
  
While here, remove unnecessary local variable initialization.

Modified:
  stable/8/sys/dev/xl/if_xl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/xl/if_xl.c
==
--- stable/8/sys/dev/xl/if_xl.c Fri May 27 20:22:19 2011(r222383)
+++ stable/8/sys/dev/xl/if_xl.c Fri May 27 20:33:26 2011(r222384)
@@ -1944,7 +1944,7 @@ xl_rxeof(struct xl_softc *sc)
struct mbuf *m;
struct ifnet*ifp = sc->xl_ifp;
struct xl_chain_onefrag *cur_rx;
-   int total_len = 0;
+   int total_len;
int rx_npkts = 0;
u_int32_t   rxstat;
 
@@ -1963,6 +1963,7 @@ again:
cur_rx = sc->xl_cdata.xl_rx_head;
sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
total_len = rxstat & XL_RXSTAT_LENMASK;
+   rx_npkts++;
 
/*
 * Since we have told the chip to allow large frames,
@@ -2047,7 +2048,6 @@ again:
XL_UNLOCK(sc);
(*ifp->if_input)(ifp, m);
XL_LOCK(sc);
-   rx_npkts++;
 
/*
 * If we are running from the taskqueue, the interface
@@ -2273,17 +2273,17 @@ xl_intr(void *arg)
}
 #endif
 
-   while ((status = CSR_READ_2(sc, XL_STATUS)) & XL_INTRS &&
-   status != 0x) {
+   for (;;) {
+   status = CSR_READ_2(sc, XL_STATUS);
+   if ((status & XL_INTRS) == 0 || status == 0x)
+   break;
CSR_WRITE_2(sc, XL_COMMAND,
XL_CMD_INTR_ACK|(status & XL_INTRS));
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+   break;
 
if (status & XL_STAT_UP_COMPLETE) {
-   int curpkts;
-
-   curpkts = ifp->if_ipackets;
-   xl_rxeof(sc);
-   if (curpkts == ifp->if_ipackets) {
+   if (xl_rxeof(sc) == 0) {
while (xl_rx_resync(sc))
xl_rxeof(sc);
}
@@ -2304,6 +2304,7 @@ xl_intr(void *arg)
if (status & XL_STAT_ADFAIL) {
ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
xl_init_locked(sc);
+   break;
}
 
if (status & XL_STAT_STATSOFLOW) {
@@ -2313,7 +2314,8 @@ xl_intr(void *arg)
}
}
 
-   if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+   if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
+   ifp->if_drv_flags & IFF_DRV_RUNNING) {
if (sc->xl_type == XL_TYPE_905B)
xl_start_90xB_locked(ifp);
else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222383 - stable/7/sys/pci

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 20:22:19 2011
New Revision: 222383
URL: http://svn.freebsd.org/changeset/base/222383

Log:
  MFC r221557-221558,221560-221561,221571:
  r221557:
Remove unnecessary htole32/le32toh dance.
  
  r221571:
Remove unneeded use of variable status.
  
  r221558:
Set status word once instead of twice. For 3C90xB/3C90xC, frame
length of status word is ignored. While here move bus_dmamap_sync()
up where DMA map is loaded.
  
  r221560:
Call bus_dmamap_sync() only after TX DPD update.
  
  r221561:
Updating status word should be the last operation of UPD structure
renewal.  Disable instruction reordering by adding volatile to
xl_list_onefrag structure.

Modified:
  stable/7/sys/pci/if_xl.c
  stable/7/sys/pci/if_xlreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/pci/if_xl.c
==
--- stable/7/sys/pci/if_xl.cFri May 27 20:21:12 2011(r222382)
+++ stable/7/sys/pci/if_xl.cFri May 27 20:22:19 2011(r222383)
@@ -1909,8 +1909,8 @@ xl_newbuf(struct xl_softc *sc, struct xl
sc->xl_tmpmap = map;
c->xl_mbuf = m_new;
c->xl_ptr->xl_frag.xl_len = htole32(m_new->m_len | XL_LAST_FRAG);
-   c->xl_ptr->xl_status = 0;
c->xl_ptr->xl_frag.xl_addr = htole32(segs->ds_addr);
+   c->xl_ptr->xl_status = 0;
bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREREAD);
return (0);
 }
@@ -2505,6 +2505,7 @@ xl_encap(struct xl_softc *sc, struct xl_
*m_head = NULL;
return (EIO);
}
+   bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
 
total_len = 0;
for (i = 0; i < nseg; i++) {
@@ -2516,10 +2517,7 @@ xl_encap(struct xl_softc *sc, struct xl_
htole32(sc->xl_cdata.xl_tx_segs[i].ds_len);
total_len += sc->xl_cdata.xl_tx_segs[i].ds_len;
}
-   c->xl_ptr->xl_frag[nseg - 1].xl_len =
-   htole32(sc->xl_cdata.xl_tx_segs[nseg - 1].ds_len | XL_LAST_FRAG);
-   c->xl_ptr->xl_status = htole32(total_len);
-   c->xl_ptr->xl_next = 0;
+   c->xl_ptr->xl_frag[nseg - 1].xl_len |= htole32(XL_LAST_FRAG);
 
if (sc->xl_type == XL_TYPE_905B) {
status = XL_TXSTAT_RND_DEFEAT;
@@ -2534,11 +2532,12 @@ xl_encap(struct xl_softc *sc, struct xl_
status |= XL_TXSTAT_UDPCKSUM;
}
 #endif
-   c->xl_ptr->xl_status = htole32(status);
-   }
+   } else
+   status = total_len;
+   c->xl_ptr->xl_status = htole32(status);
+   c->xl_ptr->xl_next = 0;
 
c->xl_mbuf = *m_head;
-   bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
return (0);
 }
 
@@ -2570,7 +2569,6 @@ xl_start_locked(struct ifnet *ifp)
struct xl_softc *sc = ifp->if_softc;
struct mbuf *m_head = NULL;
struct xl_chain *prev = NULL, *cur_tx = NULL, *start_tx;
-   u_int32_t   status;
int error;
 
XL_LOCK_ASSERT(sc);
@@ -2642,10 +2640,7 @@ xl_start_locked(struct ifnet *ifp)
 * get an interrupt once for the whole chain rather than
 * once for each packet.
 */
-   cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
-   XL_TXSTAT_DL_INTR);
-   bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
-   BUS_DMASYNC_PREWRITE);
+   cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
 
/*
 * Queue the packets. If the TX channel is clear, update
@@ -2658,14 +2653,15 @@ xl_start_locked(struct ifnet *ifp)
sc->xl_cdata.xl_tx_tail->xl_next = start_tx;
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next =
htole32(start_tx->xl_phys);
-   status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status;
-   sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status =
-   htole32(le32toh(status) & ~XL_TXSTAT_DL_INTR);
+   sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &=
+   htole32(~XL_TXSTAT_DL_INTR);
sc->xl_cdata.xl_tx_tail = cur_tx;
} else {
sc->xl_cdata.xl_tx_head = start_tx;
sc->xl_cdata.xl_tx_tail = cur_tx;
}
+   bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
+   BUS_DMASYNC_PREWRITE);
if (!CSR_READ_4(sc, XL_DOWNLIST_PTR))
CSR_WRITE_4(sc, XL_DOWNLIST_PTR, start_tx->xl_phys);
 
@@ -2764,14 +2760,13 @@ xl_start_90xB_locked(struct ifnet *ifp)
 * get an interrupt once for the whole chain rather than
 * once for each packet.
 */
-   cur_tx-

svn commit: r222382 - stable/8/sys/dev/xl

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 20:21:12 2011
New Revision: 222382
URL: http://svn.freebsd.org/changeset/base/222382

Log:
  MFC r221557-221558,221560-221561,221571:
  r221557:
Remove unnecessary htole32/le32toh dance.
  
  r221571:
Remove unneeded use of variable status.
  
  r221558:
Set status word once instead of twice. For 3C90xB/3C90xC, frame
length of status word is ignored. While here move bus_dmamap_sync()
up where DMA map is loaded.
  
  r221560:
Call bus_dmamap_sync() only after TX DPD update.
  
  r221561:
Updating status word should be the last operation of UPD structure
renewal.  Disable instruction reordering by adding volatile to
xl_list_onefrag structure.

Modified:
  stable/8/sys/dev/xl/if_xl.c
  stable/8/sys/dev/xl/if_xlreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/xl/if_xl.c
==
--- stable/8/sys/dev/xl/if_xl.c Fri May 27 20:01:46 2011(r222381)
+++ stable/8/sys/dev/xl/if_xl.c Fri May 27 20:21:12 2011(r222382)
@@ -1904,8 +1904,8 @@ xl_newbuf(struct xl_softc *sc, struct xl
sc->xl_tmpmap = map;
c->xl_mbuf = m_new;
c->xl_ptr->xl_frag.xl_len = htole32(m_new->m_len | XL_LAST_FRAG);
-   c->xl_ptr->xl_status = 0;
c->xl_ptr->xl_frag.xl_addr = htole32(segs->ds_addr);
+   c->xl_ptr->xl_status = 0;
bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREREAD);
return (0);
 }
@@ -2507,6 +2507,7 @@ xl_encap(struct xl_softc *sc, struct xl_
*m_head = NULL;
return (EIO);
}
+   bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
 
total_len = 0;
for (i = 0; i < nseg; i++) {
@@ -2518,10 +2519,7 @@ xl_encap(struct xl_softc *sc, struct xl_
htole32(sc->xl_cdata.xl_tx_segs[i].ds_len);
total_len += sc->xl_cdata.xl_tx_segs[i].ds_len;
}
-   c->xl_ptr->xl_frag[nseg - 1].xl_len =
-   htole32(sc->xl_cdata.xl_tx_segs[nseg - 1].ds_len | XL_LAST_FRAG);
-   c->xl_ptr->xl_status = htole32(total_len);
-   c->xl_ptr->xl_next = 0;
+   c->xl_ptr->xl_frag[nseg - 1].xl_len |= htole32(XL_LAST_FRAG);
 
if (sc->xl_type == XL_TYPE_905B) {
status = XL_TXSTAT_RND_DEFEAT;
@@ -2536,11 +2534,12 @@ xl_encap(struct xl_softc *sc, struct xl_
status |= XL_TXSTAT_UDPCKSUM;
}
 #endif
-   c->xl_ptr->xl_status = htole32(status);
-   }
+   } else
+   status = total_len;
+   c->xl_ptr->xl_status = htole32(status);
+   c->xl_ptr->xl_next = 0;
 
c->xl_mbuf = *m_head;
-   bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
return (0);
 }
 
@@ -2572,7 +2571,6 @@ xl_start_locked(struct ifnet *ifp)
struct xl_softc *sc = ifp->if_softc;
struct mbuf *m_head = NULL;
struct xl_chain *prev = NULL, *cur_tx = NULL, *start_tx;
-   u_int32_t   status;
int error;
 
XL_LOCK_ASSERT(sc);
@@ -2644,10 +2642,7 @@ xl_start_locked(struct ifnet *ifp)
 * get an interrupt once for the whole chain rather than
 * once for each packet.
 */
-   cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
-   XL_TXSTAT_DL_INTR);
-   bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
-   BUS_DMASYNC_PREWRITE);
+   cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
 
/*
 * Queue the packets. If the TX channel is clear, update
@@ -2660,14 +2655,15 @@ xl_start_locked(struct ifnet *ifp)
sc->xl_cdata.xl_tx_tail->xl_next = start_tx;
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next =
htole32(start_tx->xl_phys);
-   status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status;
-   sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status =
-   htole32(le32toh(status) & ~XL_TXSTAT_DL_INTR);
+   sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &=
+   htole32(~XL_TXSTAT_DL_INTR);
sc->xl_cdata.xl_tx_tail = cur_tx;
} else {
sc->xl_cdata.xl_tx_head = start_tx;
sc->xl_cdata.xl_tx_tail = cur_tx;
}
+   bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
+   BUS_DMASYNC_PREWRITE);
if (!CSR_READ_4(sc, XL_DOWNLIST_PTR))
CSR_WRITE_4(sc, XL_DOWNLIST_PTR, start_tx->xl_phys);
 
@@ -2766,14 +2762,13 @@ xl_start_90xB_locked(struct ifnet *ifp)
 * get an interrupt once for the whole chain rather than

svn commit: r222378 - stable/7/sys/pci

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 19:27:17 2011
New Revision: 222378
URL: http://svn.freebsd.org/changeset/base/222378

Log:
  MFC r221555:
Rewrite RX filter logic and provide controller specific filter
handler for 3C90x and 3C90xB/C respectively.  This simplifies ioctl
handler as well as enhancing readability.
While I'm here don't reprogram multicast filter when driver is not
running.

Modified:
  stable/7/sys/pci/if_xl.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/pci/if_xl.c
==
--- stable/7/sys/pci/if_xl.cFri May 27 19:26:12 2011(r222377)
+++ stable/7/sys/pci/if_xl.cFri May 27 19:27:17 2011(r222378)
@@ -266,10 +266,11 @@ static void xl_mii_send(struct xl_softc 
 static int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *);
 static int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *);
 
+static void xl_rxfilter(struct xl_softc *);
+static void xl_rxfilter_90x(struct xl_softc *);
+static void xl_rxfilter_90xB(struct xl_softc *);
 static void xl_setcfg(struct xl_softc *);
 static void xl_setmode(struct xl_softc *, int);
-static void xl_setmulti(struct xl_softc *);
-static void xl_setmulti_hash(struct xl_softc *);
 static void xl_reset(struct xl_softc *);
 static int xl_list_rx_init(struct xl_softc *);
 static int xl_list_tx_init(struct xl_softc *);
@@ -705,101 +706,133 @@ xl_read_eeprom(struct xl_softc *sc, cadd
return (err ? 1 : 0);
 }
 
+static void
+xl_rxfilter(struct xl_softc *sc)
+{
+
+   if (sc->xl_type == XL_TYPE_905B)
+   xl_rxfilter_90xB(sc);
+   else
+   xl_rxfilter_90x(sc);
+}
+
 /*
  * NICs older than the 3c905B have only one multicast option, which
  * is to enable reception of all multicast frames.
  */
 static void
-xl_setmulti(struct xl_softc *sc)
+xl_rxfilter_90x(struct xl_softc *sc)
 {
-   struct ifnet*ifp = sc->xl_ifp;
+   struct ifnet*ifp;
struct ifmultiaddr  *ifma;
u_int8_trxfilt;
-   int mcnt = 0;
 
XL_LOCK_ASSERT(sc);
 
+   ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+   rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+   XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL);
 
-   if (ifp->if_flags & IFF_ALLMULTI) {
-   rxfilt |= XL_RXFILTER_ALLMULTI;
-   CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
-   return;
-   }
-
-   IF_ADDR_LOCK(ifp);
-   TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
-   mcnt++;
-   IF_ADDR_UNLOCK(ifp);
+   /* Set the individual bit to receive frames for this host only. */
+   rxfilt |= XL_RXFILTER_INDIVIDUAL;
+   /* Set capture broadcast bit to capture broadcast frames. */
+   if (ifp->if_flags & IFF_BROADCAST)
+   rxfilt |= XL_RXFILTER_BROADCAST;
 
-   if (mcnt)
-   rxfilt |= XL_RXFILTER_ALLMULTI;
-   else
-   rxfilt &= ~XL_RXFILTER_ALLMULTI;
+   /* If we want promiscuous mode, set the allframes bit. */
+   if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) {
+   if (ifp->if_flags & IFF_PROMISC)
+   rxfilt |= XL_RXFILTER_ALLFRAMES;
+   if (ifp->if_flags & IFF_ALLMULTI)
+   rxfilt |= XL_RXFILTER_ALLMULTI;
+   } else {
+   IF_ADDR_LOCK(ifp);
+   TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+   if (ifma->ifma_addr->sa_family != AF_LINK)
+   continue;
+   rxfilt |= XL_RXFILTER_ALLMULTI;
+   break;
+   }
+   IF_ADDR_UNLOCK(ifp);
+   }
 
-   CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
+   CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT);
+   XL_SEL_WIN(7);
 }
 
 /*
  * 3c905B adapters have a hash filter that we can program.
  */
 static void
-xl_setmulti_hash(struct xl_softc *sc)
+xl_rxfilter_90xB(struct xl_softc *sc)
 {
-   struct ifnet*ifp = sc->xl_ifp;
-   int h = 0, i;
+   struct ifnet*ifp;
struct ifmultiaddr  *ifma;
+   int i, mcnt;
+   u_int16_t   h;
u_int8_trxfilt;
-   int mcnt = 0;
 
XL_LOCK_ASSERT(sc);
 
+   ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+   rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+   XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL |
+   XL_RXFILTER_MULTIHASH);
 
- 

svn commit: r222377 - stable/8/sys/dev/xl

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 19:26:12 2011
New Revision: 222377
URL: http://svn.freebsd.org/changeset/base/222377

Log:
  MFC r221555:
Rewrite RX filter logic and provide controller specific filter
handler for 3C90x and 3C90xB/C respectively.  This simplifies ioctl
handler as well as enhancing readability.
While I'm here don't reprogram multicast filter when driver is not
running.

Modified:
  stable/8/sys/dev/xl/if_xl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/xl/if_xl.c
==
--- stable/8/sys/dev/xl/if_xl.c Fri May 27 19:06:03 2011(r222376)
+++ stable/8/sys/dev/xl/if_xl.c Fri May 27 19:26:12 2011(r222377)
@@ -263,10 +263,11 @@ static void xl_mii_send(struct xl_softc 
 static int xl_mii_readreg(struct xl_softc *, struct xl_mii_frame *);
 static int xl_mii_writereg(struct xl_softc *, struct xl_mii_frame *);
 
+static void xl_rxfilter(struct xl_softc *);
+static void xl_rxfilter_90x(struct xl_softc *);
+static void xl_rxfilter_90xB(struct xl_softc *);
 static void xl_setcfg(struct xl_softc *);
 static void xl_setmode(struct xl_softc *, int);
-static void xl_setmulti(struct xl_softc *);
-static void xl_setmulti_hash(struct xl_softc *);
 static void xl_reset(struct xl_softc *);
 static int xl_list_rx_init(struct xl_softc *);
 static int xl_list_tx_init(struct xl_softc *);
@@ -701,101 +702,133 @@ xl_read_eeprom(struct xl_softc *sc, cadd
return (err ? 1 : 0);
 }
 
+static void
+xl_rxfilter(struct xl_softc *sc)
+{
+
+   if (sc->xl_type == XL_TYPE_905B)
+   xl_rxfilter_90xB(sc);
+   else
+   xl_rxfilter_90x(sc);
+}
+
 /*
  * NICs older than the 3c905B have only one multicast option, which
  * is to enable reception of all multicast frames.
  */
 static void
-xl_setmulti(struct xl_softc *sc)
+xl_rxfilter_90x(struct xl_softc *sc)
 {
-   struct ifnet*ifp = sc->xl_ifp;
+   struct ifnet*ifp;
struct ifmultiaddr  *ifma;
u_int8_trxfilt;
-   int mcnt = 0;
 
XL_LOCK_ASSERT(sc);
 
+   ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+   rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+   XL_RXFILTER_BROADCAST | XL_RXFILTER_INDIVIDUAL);
 
-   if (ifp->if_flags & IFF_ALLMULTI) {
-   rxfilt |= XL_RXFILTER_ALLMULTI;
-   CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
-   return;
-   }
-
-   if_maddr_rlock(ifp);
-   TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link)
-   mcnt++;
-   if_maddr_runlock(ifp);
+   /* Set the individual bit to receive frames for this host only. */
+   rxfilt |= XL_RXFILTER_INDIVIDUAL;
+   /* Set capture broadcast bit to capture broadcast frames. */
+   if (ifp->if_flags & IFF_BROADCAST)
+   rxfilt |= XL_RXFILTER_BROADCAST;
 
-   if (mcnt)
-   rxfilt |= XL_RXFILTER_ALLMULTI;
-   else
-   rxfilt &= ~XL_RXFILTER_ALLMULTI;
+   /* If we want promiscuous mode, set the allframes bit. */
+   if (ifp->if_flags & (IFF_PROMISC | IFF_ALLMULTI)) {
+   if (ifp->if_flags & IFF_PROMISC)
+   rxfilt |= XL_RXFILTER_ALLFRAMES;
+   if (ifp->if_flags & IFF_ALLMULTI)
+   rxfilt |= XL_RXFILTER_ALLMULTI;
+   } else {
+   if_maddr_rlock(ifp);
+   TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) {
+   if (ifma->ifma_addr->sa_family != AF_LINK)
+   continue;
+   rxfilt |= XL_RXFILTER_ALLMULTI;
+   break;
+   }
+   if_maddr_runlock(ifp);
+   }
 
-   CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt);
+   CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT);
+   XL_SEL_WIN(7);
 }
 
 /*
  * 3c905B adapters have a hash filter that we can program.
  */
 static void
-xl_setmulti_hash(struct xl_softc *sc)
+xl_rxfilter_90xB(struct xl_softc *sc)
 {
-   struct ifnet*ifp = sc->xl_ifp;
-   int h = 0, i;
+   struct ifnet*ifp;
struct ifmultiaddr  *ifma;
+   int i, mcnt;
+   u_int16_t   h;
u_int8_trxfilt;
-   int mcnt = 0;
 
XL_LOCK_ASSERT(sc);
 
+   ifp = sc->xl_ifp;
+
XL_SEL_WIN(5);
rxfilt = CSR_READ_1(sc, XL_W5_RX_FILTER);
+   rxfilt &= ~(XL_RXFILTER_ALLFRAMES | XL_RXFILTER_ALLMULTI |
+   XL_RXFILTER_BROADCAST | XL_

svn commit: r222375 - in stable/7/sys/dev: alc ale

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 19:05:01 2011
New Revision: 222375
URL: http://svn.freebsd.org/changeset/base/222375

Log:
  MFC r222107:
Fix typo.
  
Submitted by:   brad at OpenBSD

Modified:
  stable/7/sys/dev/alc/if_alcreg.h
  stable/7/sys/dev/ale/if_alereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/alc/if_alcreg.h
==
--- stable/7/sys/dev/alc/if_alcreg.hFri May 27 19:03:42 2011
(r222374)
+++ stable/7/sys/dev/alc/if_alcreg.hFri May 27 19:05:01 2011
(r222375)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */

Modified: stable/7/sys/dev/ale/if_alereg.h
==
--- stable/7/sys/dev/ale/if_alereg.hFri May 27 19:03:42 2011
(r222374)
+++ stable/7/sys/dev/ale/if_alereg.hFri May 27 19:05:01 2011
(r222375)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222374 - in stable/8/sys/dev: alc ale

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 19:03:42 2011
New Revision: 222374
URL: http://svn.freebsd.org/changeset/base/222374

Log:
  MFC r222107:
Fix typo.
  
Submitted by:   brad at OpenBSD

Modified:
  stable/8/sys/dev/alc/if_alcreg.h
  stable/8/sys/dev/ale/if_alereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/alc/if_alcreg.h
==
--- stable/8/sys/dev/alc/if_alcreg.hFri May 27 19:02:37 2011
(r222373)
+++ stable/8/sys/dev/alc/if_alcreg.hFri May 27 19:03:42 2011
(r222374)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */

Modified: stable/8/sys/dev/ale/if_alereg.h
==
--- stable/8/sys/dev/ale/if_alereg.hFri May 27 19:02:37 2011
(r222373)
+++ stable/8/sys/dev/ale/if_alereg.hFri May 27 19:03:42 2011
(r222374)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222372 - stable/7/sys/dev/gem

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:59:24 2011
New Revision: 222372
URL: http://svn.freebsd.org/changeset/base/222372

Log:
  MFC r222135:
Remove unnecessary controller reinitialization by checking
IFF_DRV_RUNNING flag.  Previously running dhclient or adding alias
addresses reinitialized controller and it resulted in unnecessary
link flips.

Modified:
  stable/7/sys/dev/gem/if_gem.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/gem/if_gem.c
==
--- stable/7/sys/dev/gem/if_gem.c   Fri May 27 18:58:08 2011
(r222371)
+++ stable/7/sys/dev/gem/if_gem.c   Fri May 27 18:59:24 2011
(r222372)
@@ -739,8 +739,10 @@ gem_reset_rxdma(struct gem_softc *sc)
 {
int i;
 
-   if (gem_reset_rx(sc) != 0)
+   if (gem_reset_rx(sc) != 0) {
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
return (gem_init_locked(sc));
+   }
for (i = 0; i < GEM_NRXDESC; i++)
if (sc->sc_rxsoft[i].rxs_mbuf != NULL)
GEM_UPDATE_RXDESC(sc, i);
@@ -924,6 +926,9 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   return;
+
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
__func__);
@@ -1762,6 +1767,7 @@ gem_intr(void *v)
if ((status2 &
(GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) {
sc->sc_ifp->if_oerrors++;
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
}
}
@@ -1814,6 +1820,7 @@ gem_watchdog(struct gem_softc *sc)
++ifp->if_oerrors;
 
/* Try to get more packets going. */
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
gem_start_locked(ifp);
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222371 - stable/8/sys/dev/gem

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:58:08 2011
New Revision: 222371
URL: http://svn.freebsd.org/changeset/base/222371

Log:
  MFC r222135:
Remove unnecessary controller reinitialization by checking
IFF_DRV_RUNNING flag.  Previously running dhclient or adding alias
addresses reinitialized controller and it resulted in unnecessary
link flips.

Modified:
  stable/8/sys/dev/gem/if_gem.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/gem/if_gem.c
==
--- stable/8/sys/dev/gem/if_gem.c   Fri May 27 18:47:48 2011
(r222370)
+++ stable/8/sys/dev/gem/if_gem.c   Fri May 27 18:58:08 2011
(r222371)
@@ -739,8 +739,10 @@ gem_reset_rxdma(struct gem_softc *sc)
 {
int i;
 
-   if (gem_reset_rx(sc) != 0)
+   if (gem_reset_rx(sc) != 0) {
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
return (gem_init_locked(sc));
+   }
for (i = 0; i < GEM_NRXDESC; i++)
if (sc->sc_rxsoft[i].rxs_mbuf != NULL)
GEM_UPDATE_RXDESC(sc, i);
@@ -924,6 +926,9 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   return;
+
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
__func__);
@@ -1762,6 +1767,7 @@ gem_intr(void *v)
if ((status2 &
(GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) {
sc->sc_ifp->if_oerrors++;
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
}
}
@@ -1814,6 +1820,7 @@ gem_watchdog(struct gem_softc *sc)
++ifp->if_oerrors;
 
/* Try to get more packets going. */
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
gem_start_locked(ifp);
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222370 - stable/7/sys/dev/bge

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:47:48 2011
New Revision: 222370
URL: http://svn.freebsd.org/changeset/base/222370

Log:
  MFC r221712:
Since r117657, bge(4) does not enable buffer manager for BCM5705 or
newer controllers.  However, all data sheet I have access has no
indication that buffer manager should not be touched on these
controllers.  It seems the buffer manager always runs on BCM5705 or
newer controllers. Some controller(e.g. BCM5719) needs other buffer
manager configuration so driver should enable buffer manager for
all controllers.  Both Linux and OpenBSD/NetBSD use the same
approach.
This change polls enable bit of block to know whether specified
block was really stopped as well as enabling buffer manager for all
controllers in driver initialization.
  
Obtained from:  NetBSD

Modified:
  stable/7/sys/dev/bge/if_bge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Fri May 27 18:46:24 2011
(r222369)
+++ stable/7/sys/dev/bge/if_bge.c   Fri May 27 18:47:48 2011
(r222370)
@@ -403,6 +403,7 @@ static void bge_start(struct ifnet *);
 static int bge_ioctl(struct ifnet *, u_long, caddr_t);
 static void bge_init_locked(struct bge_softc *);
 static void bge_init(void *);
+static void bge_stop_block(struct bge_softc *, bus_size_t, uint32_t);
 static void bge_stop(struct bge_softc *);
 static void bge_watchdog(struct bge_softc *);
 static int bge_shutdown(device_t);
@@ -1593,22 +1594,19 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   if (!(BGE_IS_5705_PLUS(sc))) {
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   CSR_WRITE_4(sc, BGE_BMAN_MODE,
+   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
 
-   /* Poll for buffer manager start indication */
-   for (i = 0; i < BGE_TIMEOUT; i++) {
-   DELAY(10);
-   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
-   break;
-   }
+   /* Poll for buffer manager start indication */
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   DELAY(10);
+   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
+   break;
+   }
 
-   if (i == BGE_TIMEOUT) {
-   device_printf(sc->bge_dev,
-   "buffer manager failed to start\n");
-   return (ENXIO);
-   }
+   if (i == BGE_TIMEOUT) {
+   device_printf(sc->bge_dev, "buffer manager failed to start\n");
+   return (ENXIO);
}
 
/* Enable flow-through queues */
@@ -5133,6 +5131,20 @@ bge_watchdog(struct bge_softc *sc)
ifp->if_oerrors++;
 }
 
+static void
+bge_stop_block(struct bge_softc *sc, bus_size_t reg, uint32_t bit)
+{
+   int i;
+
+   BGE_CLRBIT(sc, reg, bit);
+
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   if ((CSR_READ_4(sc, reg) & bit) == 0)
+   return;
+   DELAY(100);
+}
+}
+
 /*
  * Stop the adapter and free any mbufs allocated to the
  * RX and TX lists.
@@ -5161,35 +5173,36 @@ bge_stop(struct bge_softc *sc)
/*
 * Disable all of the receiver blocks.
 */
-   BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
-   if (!(BGE_IS_5705_PLUS(sc)))
-   BGE_CLRBIT(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
+   if (BGE_IS_5700_FAMILY(sc))
+   bge_stop_block(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
 
/*
 * Disable all of the transmit blocks.
 */
-   BGE_CLRBIT(sc, BGE_SRS_MODE, BGE_SRSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SBDI_MODE, BGE_SBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDMA_MODE, BGE_RDMAMODE_EN

svn commit: r222369 - stable/8/sys/dev/bge

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:46:24 2011
New Revision: 222369
URL: http://svn.freebsd.org/changeset/base/222369

Log:
  MFC r221712:
Since r117657, bge(4) does not enable buffer manager for BCM5705 or
newer controllers.  However, all data sheet I have access has no
indication that buffer manager should not be touched on these
controllers.  It seems the buffer manager always runs on BCM5705 or
newer controllers. Some controller(e.g. BCM5719) needs other buffer
manager configuration so driver should enable buffer manager for
all controllers.  Both Linux and OpenBSD/NetBSD use the same
approach.
This change polls enable bit of block to know whether specified
block was really stopped as well as enabling buffer manager for all
controllers in driver initialization.
  
Obtained from:  NetBSD

Modified:
  stable/8/sys/dev/bge/if_bge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Fri May 27 18:40:31 2011
(r222368)
+++ stable/8/sys/dev/bge/if_bge.c   Fri May 27 18:46:24 2011
(r222369)
@@ -403,6 +403,7 @@ static void bge_start(struct ifnet *);
 static int bge_ioctl(struct ifnet *, u_long, caddr_t);
 static void bge_init_locked(struct bge_softc *);
 static void bge_init(void *);
+static void bge_stop_block(struct bge_softc *, bus_size_t, uint32_t);
 static void bge_stop(struct bge_softc *);
 static void bge_watchdog(struct bge_softc *);
 static int bge_shutdown(device_t);
@@ -1593,22 +1594,19 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   if (!(BGE_IS_5705_PLUS(sc))) {
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   CSR_WRITE_4(sc, BGE_BMAN_MODE,
+   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
 
-   /* Poll for buffer manager start indication */
-   for (i = 0; i < BGE_TIMEOUT; i++) {
-   DELAY(10);
-   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
-   break;
-   }
+   /* Poll for buffer manager start indication */
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   DELAY(10);
+   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
+   break;
+   }
 
-   if (i == BGE_TIMEOUT) {
-   device_printf(sc->bge_dev,
-   "buffer manager failed to start\n");
-   return (ENXIO);
-   }
+   if (i == BGE_TIMEOUT) {
+   device_printf(sc->bge_dev, "buffer manager failed to start\n");
+   return (ENXIO);
}
 
/* Enable flow-through queues */
@@ -5137,6 +5135,20 @@ bge_watchdog(struct bge_softc *sc)
ifp->if_oerrors++;
 }
 
+static void
+bge_stop_block(struct bge_softc *sc, bus_size_t reg, uint32_t bit)
+{
+   int i;
+
+   BGE_CLRBIT(sc, reg, bit);
+
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   if ((CSR_READ_4(sc, reg) & bit) == 0)
+   return;
+   DELAY(100);
+}
+}
+
 /*
  * Stop the adapter and free any mbufs allocated to the
  * RX and TX lists.
@@ -5165,35 +5177,36 @@ bge_stop(struct bge_softc *sc)
/*
 * Disable all of the receiver blocks.
 */
-   BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
-   if (!(BGE_IS_5705_PLUS(sc)))
-   BGE_CLRBIT(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
+   if (BGE_IS_5700_FAMILY(sc))
+   bge_stop_block(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
 
/*
 * Disable all of the transmit blocks.
 */
-   BGE_CLRBIT(sc, BGE_SRS_MODE, BGE_SRSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SBDI_MODE, BGE_SBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE);
-

svn commit: r222368 - stable/7/sys/dev/vge

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:40:31 2011
New Revision: 222368
URL: http://svn.freebsd.org/changeset/base/222368

Log:
  MFC r222142:
Datasheet says vge(4) controllers support DAC but it seems that's
not true on old PCI based controllers.  DAC configuration is read
from EEPROM in device reset phase and driver can override DAC
configuration.  However I guess there is an undocumented reason why
EEPROM configuration does not enable DAC so do not blindly override
DAC configuration.  Recent PCIe based controllers are supposed to
support 64bit DMA so allow 64bit DMA only on PCIe based controllers.
  
PR: kern/157184

Modified:
  stable/7/sys/dev/vge/if_vge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/vge/if_vge.c
==
--- stable/7/sys/dev/vge/if_vge.c   Fri May 27 18:39:18 2011
(r222367)
+++ stable/7/sys/dev/vge/if_vge.c   Fri May 27 18:40:31 2011
(r222368)
@@ -688,7 +688,18 @@ vge_dma_alloc(struct vge_softc *sc)
bus_addr_t lowaddr, tx_ring_end, rx_ring_end;
int error, i;
 
-   lowaddr = BUS_SPACE_MAXADDR;
+   /*
+* It seems old PCI controllers do not support DAC.  DAC
+* configuration can be enabled by accessing VGE_CHIPCFG3
+* register but honor EEPROM configuration instead of
+* blindly overriding DAC configuration.  PCIe based
+* controllers are supposed to support 64bit DMA so enable
+* 64bit DMA on these controllers.
+*/
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = BUS_SPACE_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
 
 again:
/* Create parent ring tag. */
@@ -805,10 +816,14 @@ again:
goto again;
}
 
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = VGE_BUF_DMA_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
/* Create parent buffer tag. */
error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */
1, 0,   /* algnmnt, boundary */
-   VGE_BUF_DMA_MAXADDR,/* lowaddr */
+   lowaddr,/* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222367 - stable/8/sys/dev/vge

2011-05-27 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 27 18:39:18 2011
New Revision: 222367
URL: http://svn.freebsd.org/changeset/base/222367

Log:
  MFC r222142:
Datasheet says vge(4) controllers support DAC but it seems that's
not true on old PCI based controllers.  DAC configuration is read
from EEPROM in device reset phase and driver can override DAC
configuration.  However I guess there is an undocumented reason why
EEPROM configuration does not enable DAC so do not blindly override
DAC configuration.  Recent PCIe based controllers are supposed to
support 64bit DMA so allow 64bit DMA only on PCIe based controllers.
  
PR: kern/157184

Modified:
  stable/8/sys/dev/vge/if_vge.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/vge/if_vge.c
==
--- stable/8/sys/dev/vge/if_vge.c   Fri May 27 17:47:19 2011
(r222366)
+++ stable/8/sys/dev/vge/if_vge.c   Fri May 27 18:39:18 2011
(r222367)
@@ -685,7 +685,18 @@ vge_dma_alloc(struct vge_softc *sc)
bus_addr_t lowaddr, tx_ring_end, rx_ring_end;
int error, i;
 
-   lowaddr = BUS_SPACE_MAXADDR;
+   /*
+* It seems old PCI controllers do not support DAC.  DAC
+* configuration can be enabled by accessing VGE_CHIPCFG3
+* register but honor EEPROM configuration instead of
+* blindly overriding DAC configuration.  PCIe based
+* controllers are supposed to support 64bit DMA so enable
+* 64bit DMA on these controllers.
+*/
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = BUS_SPACE_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
 
 again:
/* Create parent ring tag. */
@@ -802,10 +813,14 @@ again:
goto again;
}
 
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = VGE_BUF_DMA_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
/* Create parent buffer tag. */
error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */
1, 0,   /* algnmnt, boundary */
-   VGE_BUF_DMA_MAXADDR,/* lowaddr */
+   lowaddr,/* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222269 - head/sys/dev/msk

2011-05-24 Thread Pyun YongHyeon
Author: yongari
Date: Tue May 24 20:39:07 2011
New Revision: 69
URL: http://svn.freebsd.org/changeset/base/69

Log:
  style(9)

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Tue May 24 20:10:12 2011(r68)
+++ head/sys/dev/msk/if_msk.c   Tue May 24 20:39:07 2011(r69)
@@ -1018,7 +1018,7 @@ msk_ioctl(struct ifnet *ifp, u_long comm
if (ifr->ifr_mtu > MSK_JUMBO_MTU || ifr->ifr_mtu < ETHERMIN)
error = EINVAL;
else if (ifp->if_mtu != ifr->ifr_mtu) {
-   if (ifr->ifr_mtu > ETHERMTU) {
+   if (ifr->ifr_mtu > ETHERMTU) {
if ((sc_if->msk_flags & MSK_FLAG_JUMBO) == 0) {
error = EINVAL;
MSK_IF_UNLOCK(sc_if);
@@ -1636,7 +1636,7 @@ msk_attach(device_t dev)
 * this workaround does not work so disable checksum offload
 * for VLAN interface.
 */
-   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
+   ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO;
/*
 * Enable Rx checksum offloading for VLAN tagged frames
 * if controller support new descriptor format.
@@ -1921,7 +1921,8 @@ mskc_attach(device_t dev)
error = ENXIO;
goto fail;
}
-   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK | 
M_ZERO);
+   mmd = malloc(sizeof(struct msk_mii_data), M_DEVBUF, M_WAITOK |
+   M_ZERO);
if (mmd == NULL) {
device_printf(dev, "failed to allocate memory for "
"ivars of PORT_B\n");
@@ -1930,9 +1931,9 @@ mskc_attach(device_t dev)
}
mmd->port = MSK_PORT_B;
mmd->pmd = sc->msk_pmd;
-   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
+   if (sc->msk_pmd == 'L' || sc->msk_pmd == 'S')
mmd->mii_flags |= MIIF_HAVEFIBER;
-   if (sc->msk_pmd == 'P')
+   if (sc->msk_pmd == 'P')
mmd->mii_flags |= MIIF_HAVEFIBER | MIIF_MACPRIV0;
device_set_ivars(sc->msk_devs[MSK_PORT_B], mmd);
}
@@ -3741,10 +3742,10 @@ msk_init_locked(struct msk_if_softc *sc_
ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_TXCSUM);
}
 
-   /* GMAC Control reset. */
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
+   /* GMAC Control reset. */
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
@@ -3854,13 +3855,13 @@ msk_init_locked(struct msk_if_softc *sc_
msk_set_tx_stfwd(sc_if);
}
 
-   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
-   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
-   /* Disable dynamic watermark - from Linux. */
-   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
-   reg &= ~0x03;
-   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
-   }
+   if (sc->msk_hw_id == CHIP_ID_YUKON_FE_P &&
+   sc->msk_hw_rev == CHIP_REV_YU_FE_P_A0) {
+   /* Disable dynamic watermark - from Linux. */
+   reg = CSR_READ_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA));
+   reg &= ~0x03;
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_EA), reg);
+   }
 
/*
 * Disable Force Sync bit and Alloc bit in Tx RAM interface
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222232 - head/share/man/man4

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 22:02:15 2011
New Revision: 32
URL: http://svn.freebsd.org/changeset/base/32

Log:
  Add 88E8075 Yukon Supreme to the list of supported hardware list.

Modified:
  head/share/man/man4/msk.4

Modified: head/share/man/man4/msk.4
==
--- head/share/man/man4/msk.4   Mon May 23 21:56:04 2011(r31)
+++ head/share/man/man4/msk.4   Mon May 23 22:02:15 2011(r32)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 23, 2010
+.Dd May 23, 2011
 .Dt MSK 4
 .Os
 .Sh NAME
@@ -195,6 +195,8 @@ Marvell Yukon 88E8071 Gigabit Ethernet
 .It
 Marvell Yukon 88E8072 Gigabit Ethernet
 .It
+Marvell Yukon 88E8075 Gigabit Ethernet
+.It
 SysKonnect SK-9Sxx Gigabit Ethernet
 .It
 SysKonnect SK-9Exx Gigabit Ethernet
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222231 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 21:56:04 2011
New Revision: 31
URL: http://svn.freebsd.org/changeset/base/31

Log:
  When MTU is changed, check whether driver should be reinitialized or
  not.  If reinitialized is required, clear driver running flag.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 21:51:47 2011(r30)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 21:56:04 2011(r31)
@@ -1034,7 +1034,10 @@ msk_ioctl(struct ifnet *ifp, u_long comm
}
}
ifp->if_mtu = ifr->ifr_mtu;
-   msk_init_locked(sc_if);
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+   msk_init_locked(sc_if);
+   }
}
MSK_IF_UNLOCK(sc_if);
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222230 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 21:51:47 2011
New Revision: 30
URL: http://svn.freebsd.org/changeset/base/30

Log:
  Add initial support for Marvell 88E8055/88E8075 Yukon Supreme.

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/dev/msk/if_mskreg.h

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 21:32:45 2011(r29)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 21:51:47 2011(r30)
@@ -221,6 +221,10 @@ static struct msk_product {
"Marvell Yukon 88E8071 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_436C,
"Marvell Yukon 88E8072 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_436D,
+   "Marvell Yukon 88E8055 Gigabit Ethernet" },
+   { VENDORID_MARVELL, DEVICEID_MRVL_4370,
+   "Marvell Yukon 88E8075 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4380,
"Marvell Yukon 88E8057 Gigabit Ethernet" },
{ VENDORID_MARVELL, DEVICEID_MRVL_4381,
@@ -1366,11 +1370,16 @@ mskc_reset(struct msk_softc *sc)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
}
+
+   if (sc->msk_hw_id == CHIP_ID_YUKON_SUPR &&
+   sc->msk_hw_rev > CHIP_REV_YU_SU_B0)
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, PCI_CLK_MACSEC_DIS);
if (sc->msk_hw_id == CHIP_ID_YUKON_OPT && sc->msk_hw_rev == 0) {
/* Disable PCIe PHY powerdown(reg 0x80, bit7). */
CSR_WRITE_4(sc, Y2_PEX_PHY_DATA, (0x0080 << 16) | 0x0080);
@@ -1719,7 +1728,6 @@ mskc_attach(device_t dev)
/* Bail out if chip is not recognized. */
if (sc->msk_hw_id < CHIP_ID_YUKON_XL ||
sc->msk_hw_id > CHIP_ID_YUKON_OPT ||
-   sc->msk_hw_id == CHIP_ID_YUKON_SUPR ||
sc->msk_hw_id == CHIP_ID_YUKON_UNKNOWN) {
device_printf(dev, "unknown device: id=0x%02x, rev=0x%02x\n",
sc->msk_hw_id, sc->msk_hw_rev);
@@ -1826,6 +1834,11 @@ mskc_attach(device_t dev)
sc->msk_clock = 156;/* 156 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
break;
+   case CHIP_ID_YUKON_SUPR:
+   sc->msk_clock = 125;/* 125 MHz */
+   sc->msk_pflags |= MSK_FLAG_JUMBO | MSK_FLAG_DESCV2 |
+   MSK_FLAG_AUTOTX_CSUM;
+   break;
case CHIP_ID_YUKON_UL_2:
sc->msk_clock = 125;/* 125 MHz */
sc->msk_pflags |= MSK_FLAG_JUMBO;
@@ -3729,7 +3742,8 @@ msk_init_locked(struct msk_if_softc *sc_
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_RST_CLR);
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL), GMC_F_LOOPB_OFF);
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX)
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR)
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, GMAC_CTRL),
GMC_BYP_MACSECRX_ON | GMC_BYP_MACSECTX_ON |
GMC_BYP_RETR_ON);
@@ -3924,7 +3938,8 @@ msk_init_locked(struct msk_if_softc *sc_
msk_stop(sc_if);
return;
}
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
/* Disable flushing of non-ASF packets. */
CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, RX_GMF_CTRL_T),
GMF_RX_MACSEC_FLUSH_OFF);

Modified: head/sys/dev/msk/if_mskreg.h
==
--- head/sys/dev/msk/if_mskreg.hMon May 23 21:32:45 2011
(r29)
+++ head/sys/dev/msk/if_mskreg.hMon May 23 21:51:47 2011
(r30)
@@ -144,6 +144,8 @@
 #define DEVICEID_MRVL_436A 0x436A
 #define DEVICEID_MRVL_436B 0x436B
 #define DEVICEID_MRVL_436C 0x436C
+#define DEVICEID_MRVL_436D 0x436D
+#define DEVICEID_MRVL_4370 0x4370
 #define DEVICEID_MRVL_4380 0x4380
 #define DEVICEID_MRVL_4381 0x4381
 
@@ -321,6 +323,9 @@
 #define PCI_OS_SPD_X1002   /* PCI-X 100MHz Bus */
 #define PCI_OS_SPD_X1333   /* PCI-X 133MHz Bus */
 
+/* PCI_OUR_REG_3   32 bit  Our Register 3 (Yukon-ECU only) */
+#definePCI_CLK_MACSEC_DIS  BIT_17  /* D

svn commit: r222227 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 21:11:46 2011
New Revision: 27
URL: http://svn.freebsd.org/changeset/base/27

Log:
  Do not touch ASF related register for controllers that do not have
  these registers. Also disable Watchdog of ASF microcontroller.

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/dev/msk/if_mskreg.h

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 21:00:56 2011(r26)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 21:11:46 2011(r27)
@@ -1296,23 +1296,30 @@ mskc_reset(struct msk_softc *sc)
int i, initram;
 
/* Disable ASF. */
-   if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
-   status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
-   /* Clear AHB bridge & microcontroller reset. */
-   status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
-   Y2_ASF_HCU_CCSR_CPU_RST_MODE);
-   /* Clear ASF microcontroller state. */
-   status &= ~ Y2_ASF_HCU_CCSR_UC_STATE_MSK;
-   CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
-   } else
-   CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
-   CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
-
-   /*
-* Since we disabled ASF, S/W reset is required for Power Management.
-*/
-   CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
-   CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
+   if (sc->msk_hw_id >= CHIP_ID_YUKON_XL &&
+   sc->msk_hw_id <= CHIP_ID_YUKON_SUPR) {
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id == CHIP_ID_YUKON_SUPR) {
+   CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
+   status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
+   /* Clear AHB bridge & microcontroller reset. */
+   status &= ~(Y2_ASF_HCU_CCSR_AHB_RST |
+   Y2_ASF_HCU_CCSR_CPU_RST_MODE);
+   /* Clear ASF microcontroller state. */
+   status &= ~Y2_ASF_HCU_CCSR_UC_STATE_MSK;
+   status &= ~Y2_ASF_HCU_CCSR_CPU_CLK_DIVIDE_MSK;
+   CSR_WRITE_2(sc, B28_Y2_ASF_HCU_CCSR, status);
+   CSR_WRITE_4(sc, B28_Y2_CPU_WDOG, 0);
+   } else
+   CSR_WRITE_1(sc, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
+   CSR_WRITE_2(sc, B0_CTST, Y2_ASF_DISABLE);
+   /*
+* Since we disabled ASF, S/W reset is required for
+* Power Management.
+*/
+   CSR_WRITE_2(sc, B0_CTST, CS_RST_SET);
+   CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
+   }
 
/* Clear all error bits in the PCI status register. */
status = pci_read_config(sc->msk_dev, PCIR_STATUS, 2);

Modified: head/sys/dev/msk/if_mskreg.h
==
--- head/sys/dev/msk/if_mskreg.hMon May 23 21:00:56 2011
(r26)
+++ head/sys/dev/msk/if_mskreg.hMon May 23 21:11:46 2011
(r27)
@@ -677,6 +677,7 @@
 /* ASF Subsystem Registers (Yukon-2 only) */
 #define B28_Y2_SMB_CONFIG  0x0e40  /* 32 bit ASF SMBus Config Register */
 #define B28_Y2_SMB_CSD_REG 0x0e44  /* 32 bit ASF SMB Control/Status/Data */
+#define B28_Y2_CPU_WDOG0x0e48  /* 32 bit Watchdog Register */
 #define B28_Y2_ASF_IRQ_V_BASE  0x0e60  /* 32 bit ASF IRQ Vector Base */
 #define B28_Y2_ASF_STAT_CMD0x0e68  /* 32 bit ASF Status and Command Reg */
 #define B28_Y2_ASF_HCU_CCSR0x0e68  /* 32 bit ASF HCU CCSR (Yukon EX) */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222226 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 21:00:56 2011
New Revision: 26
URL: http://svn.freebsd.org/changeset/base/26

Log:
  Make sure to enable all clocks before accessing registers.
  Releasing PHY from power down/COMA is done after enabling all
  clocks. While I'm here remove unnecessary controller reset.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 21:00:37 2011(r25)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 21:00:56 2011(r26)
@@ -1212,37 +1212,30 @@ msk_phy_power(struct msk_softc *sc, int 
 */
CSR_WRITE_1(sc, B2_Y2_CLK_GATE, val);
 
-   val = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
-   val &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
+   our = CSR_PCI_READ_4(sc, PCI_OUR_REG_1);
+   our &= ~(PCI_Y2_PHY1_POWD | PCI_Y2_PHY2_POWD);
if (sc->msk_hw_id == CHIP_ID_YUKON_XL) {
if (sc->msk_hw_rev > CHIP_REV_YU_XL_A1) {
/* Deassert Low Power for 1st PHY. */
-   val |= PCI_Y2_PHY1_COMA;
+   our |= PCI_Y2_PHY1_COMA;
if (sc->msk_num_port > 1)
-   val |= PCI_Y2_PHY2_COMA;
+   our |= PCI_Y2_PHY2_COMA;
}
}
-   /* Release PHY from PowerDown/COMA mode. */
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, val);
-   switch (sc->msk_hw_id) {
-   case CHIP_ID_YUKON_EC_U:
-   case CHIP_ID_YUKON_EX:
-   case CHIP_ID_YUKON_FE_P:
-   case CHIP_ID_YUKON_UL_2:
-   case CHIP_ID_YUKON_OPT:
-   CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_OFF);
-
-   /* Enable all clocks. */
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
-   our = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
-   our &= (PCI_FORCE_ASPM_REQUEST|PCI_ASPM_GPHY_LINK_DOWN|
-   PCI_ASPM_INT_FIFO_EMPTY|PCI_ASPM_CLKRUN_REQUEST);
+   if (sc->msk_hw_id == CHIP_ID_YUKON_EC_U ||
+   sc->msk_hw_id == CHIP_ID_YUKON_EX ||
+   sc->msk_hw_id >= CHIP_ID_YUKON_FE_P) {
+   val = CSR_PCI_READ_4(sc, PCI_OUR_REG_4);
+   val &= (PCI_FORCE_ASPM_REQUEST |
+   PCI_ASPM_GPHY_LINK_DOWN | PCI_ASPM_INT_FIFO_EMPTY |
+   PCI_ASPM_CLKRUN_REQUEST);
/* Set all bits to 0 except bits 15..12. */
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, our);
-   our = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
-   our &= PCI_CTL_TIM_VMAIN_AV_MSK;
-   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, our);
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_4, val);
+   val = CSR_PCI_READ_4(sc, PCI_OUR_REG_5);
+   val &= PCI_CTL_TIM_VMAIN_AV_MSK;
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_5, val);
CSR_PCI_WRITE_4(sc, PCI_CFG_REG_1, 0);
+   CSR_WRITE_2(sc, B0_CTST, Y2_HW_WOL_ON);
/*
 * Disable status race, workaround for
 * Yukon EC Ultra & Yukon EX.
@@ -1251,10 +1244,10 @@ msk_phy_power(struct msk_softc *sc, int 
val |= GLB_GPIO_STAT_RACE_DIS;
CSR_WRITE_4(sc, B2_GP_IO, val);
CSR_READ_4(sc, B2_GP_IO);
-   break;
-   default:
-   break;
}
+   /* Release PHY from PowerDown/COMA mode. */
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_1, our);
+
for (i = 0; i < sc->msk_num_port; i++) {
CSR_WRITE_2(sc, MR_ADDR(i, GMAC_LINK_CTRL),
GMLC_RST_SET);
@@ -1302,8 +1295,6 @@ mskc_reset(struct msk_softc *sc)
uint32_t val;
int i, initram;
 
-   CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
-
/* Disable ASF. */
if (sc->msk_hw_id == CHIP_ID_YUKON_EX) {
status = CSR_READ_2(sc, B28_Y2_ASF_HCU_CCSR);
@@ -1712,6 +1703,9 @@ mskc_attach(device_t dev)
}
}
 
+   /* Enable all clocks before accessing any registers. */
+   CSR_PCI_WRITE_4(sc, PCI_OUR_REG_3, 0);
+
CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
sc->msk_hw_id = CSR_READ_1(sc, B2_CHIP_ID);
sc->msk_hw_rev = (CSR_READ_1(sc, B2_MAC_CFG) >> 4) & 0x0f;
@@ -1752,9 +1746,6 @@ mskc_attach(device_t dev)
resource_int_value(device_get_name(dev), device_get_unit(dev),
"int_holdoff", &sc->msk_int_holdoff

svn commit: r222223 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 20:18:09 2011
New Revision: 23
URL: http://svn.freebsd.org/changeset/base/23

Log:
  Do not configure RAM registers for controllers that do not have
  them.  These registers are defined only for Yukon XL, Yukon EC and
  Yukon FE.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 20:12:36 2011(r22)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 20:18:09 2011(r23)
@@ -1300,7 +1300,7 @@ mskc_reset(struct msk_softc *sc)
bus_addr_t addr;
uint16_t status;
uint32_t val;
-   int i;
+   int i, initram;
 
CSR_WRITE_2(sc, B0_CTST, CS_RST_CLR);
 
@@ -1396,8 +1396,14 @@ mskc_reset(struct msk_softc *sc)
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_STOP);
CSR_WRITE_1(sc, GMAC_TI_ST_CTRL, GMT_ST_CLR_IRQ);
 
+   initram = 0;
+   if (sc->msk_hw_id == CHIP_ID_YUKON_XL ||
+   sc->msk_hw_id == CHIP_ID_YUKON_EC ||
+   sc->msk_hw_id == CHIP_ID_YUKON_FE)
+   initram++;
+
/* Configure timeout values. */
-   for (i = 0; i < sc->msk_num_port; i++) {
+   for (i = 0; initram > 0 && i < sc->msk_num_port; i++) {
CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_SET);
CSR_WRITE_2(sc, SELECT_RAM_BUFFER(i, B3_RI_CTRL), RI_RST_CLR);
CSR_WRITE_1(sc, SELECT_RAM_BUFFER(i, B3_RI_WTO_R1),
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222221 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 20:09:32 2011
New Revision: 21
URL: http://svn.freebsd.org/changeset/base/21

Log:
  Rework store and forward configuration of TX MAC FIFO. Basically it
  enables store and forward mode except for jumbo frame on Yukon
  Ultra.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 19:59:01 2011(r20)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 20:09:32 2011(r21)
@@ -3654,37 +3654,24 @@ msk_set_tx_stfwd(struct msk_if_softc *sc
 
ifp = sc_if->msk_ifp;
sc = sc_if->msk_softc;
-   switch (sc->msk_hw_id) {
-   case CHIP_ID_YUKON_EX:
-   if (sc->msk_hw_rev == CHIP_REV_YU_EX_A0)
-   goto yukon_ex_workaround;
-   if (ifp->if_mtu > ETHERMTU)
-   CSR_WRITE_4(sc,
-   MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
-   TX_JUMBO_ENA | TX_STFW_ENA);
-   else
-   CSR_WRITE_4(sc,
-   MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
-   TX_JUMBO_DIS | TX_STFW_ENA);
-   break;
-   default:
-yukon_ex_workaround:
+   if ((sc->msk_hw_id == CHIP_ID_YUKON_EX &&
+   sc->msk_hw_rev != CHIP_REV_YU_EX_A0) ||
+   sc->msk_hw_id >= CHIP_ID_YUKON_SUPR) {
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+   TX_STFW_ENA);
+   } else {
if (ifp->if_mtu > ETHERMTU) {
/* Set Tx GMAC FIFO Almost Empty Threshold. */
CSR_WRITE_4(sc,
MR_ADDR(sc_if->msk_port, TX_GMF_AE_THR),
MSK_ECU_JUMBO_WM << 16 | MSK_ECU_AE_THR);
/* Disable Store & Forward mode for Tx. */
-   CSR_WRITE_4(sc,
-   MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
-   TX_JUMBO_ENA | TX_STFW_DIS);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+   TX_STFW_DIS);
} else {
-   /* Enable Store & Forward mode for Tx. */
-   CSR_WRITE_4(sc,
-   MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
-   TX_JUMBO_DIS | TX_STFW_ENA);
+   CSR_WRITE_4(sc, MR_ADDR(sc_if->msk_port, TX_GMF_CTRL_T),
+   TX_STFW_ENA);
}
-   break;
}
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222219 - head/sys/dev/msk

2011-05-23 Thread Pyun YongHyeon
Author: yongari
Date: Mon May 23 19:58:08 2011
New Revision: 19
URL: http://svn.freebsd.org/changeset/base/19

Log:
  Do not blindly clear entire GPHY control register. It seems some
  bits of the register is used for other purposes such that clearing
  these bits resulted in unexpected results such as corrupted RX
  frames or missing LE status updates.  For old controllers like
  Yukon EC it had no effect but it caused all kind of troubles on
  Yukon Supreme.
  This change shall improve stability of controllers like Yukon
  Ultra, Ultra2, Extreme, Optima and Supreme.

Modified:
  head/sys/dev/msk/if_msk.c

Modified: head/sys/dev/msk/if_msk.c
==
--- head/sys/dev/msk/if_msk.c   Mon May 23 19:57:12 2011(r18)
+++ head/sys/dev/msk/if_msk.c   Mon May 23 19:58:08 2011(r19)
@@ -1362,8 +1362,8 @@ mskc_reset(struct msk_softc *sc)
/* Reset GPHY/GMAC Control */
for (i = 0; i < sc->msk_num_port; i++) {
/* GPHY Control reset. */
-   CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
-   CSR_WRITE_4(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
+   CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_SET);
+   CSR_WRITE_1(sc, MR_ADDR(i, GPHY_CTRL), GPC_RST_CLR);
/* GMAC Control reset. */
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_SET);
CSR_WRITE_4(sc, MR_ADDR(i, GMAC_CTRL), GMC_RST_CLR);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222155 - stable/8/sys/net

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Sat May 21 00:38:43 2011
New Revision: 222155
URL: http://svn.freebsd.org/changeset/base/222155

Log:
  MFC r221548,221552:
  r221548:
Do not increment collision counter if transmit have failed.
Transmission error in tun(4) is queueing error(i.e. ENOBUFS) and it
has nothing to do with collision.
  r221552:
Fix white space nits and style

Modified:
  stable/8/sys/net/if_tun.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/net/if_tun.c
==
--- stable/8/sys/net/if_tun.c   Fri May 20 22:55:18 2011(r222154)
+++ stable/8/sys/net/if_tun.c   Sat May 21 00:38:43 2011(r222155)
@@ -228,8 +228,8 @@ tunclone(void *arg, struct ucred *cred, 
i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0);
if (i) {
if (append_unit) {
-   namelen = snprintf(devname, sizeof(devname), "%s%d", 
name,
-   u);
+   namelen = snprintf(devname, sizeof(devname), "%s%d",
+   name, u);
name = devname;
}
/* No preexisting struct cdev *, create one */
@@ -577,11 +577,8 @@ tunifioctl(struct ifnet *ifp, u_long cmd
  * tunoutput - queue packets from higher level ready to put out.
  */
 static int
-tunoutput(
-   struct ifnet *ifp,
-   struct mbuf *m0,
-   struct sockaddr *dst,
-   struct route *ro)
+tunoutput(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
+struct route *ro)
 {
struct tun_softc *tp = ifp->if_softc;
u_short cached_tun_flags;
@@ -661,10 +658,8 @@ tunoutput(
}
 
error = (ifp->if_transmit)(ifp, m0);
-   if (error) {
-   ifp->if_collisions++;
+   if (error)
return (ENOBUFS);
-   }
ifp->if_opackets++;
return (0);
 }
@@ -673,7 +668,8 @@ tunoutput(
  * the cdevsw interface is now pretty minimal.
  */
 static int
-tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread 
*td)
+tunioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag,
+struct thread *td)
 {
int error;
struct tun_softc *tp = dev->si_drv1;
@@ -995,7 +991,7 @@ tunkqfilter(struct cdev *dev, struct kno
ifp->if_xname, dev2unit(dev));
kn->kn_fop = &tun_write_filterops;
break;
-   
+
default:
TUNDEBUG(ifp, "%s kqfilter: invalid filter, minor = %#x\n",
ifp->if_xname, dev2unit(dev));
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222147 - in stable/7/sys/dev: bge mii

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 20:31:36 2011
New Revision: 222147
URL: http://svn.freebsd.org/changeset/base/222147

Log:
  MFC r221468:
Enable Ethernet@WireSpeed for BCM5718/BCM57765 family. While I'm
here inverse meaning of PHY flag as Ethernet@WireSpeed is enabled
for most PHYs.

Modified:
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
  stable/7/sys/dev/mii/brgphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Fri May 20 20:29:50 2011
(r222146)
+++ stable/7/sys/dev/bge/if_bge.c   Fri May 20 20:31:36 2011
(r222147)
@@ -2769,12 +2769,12 @@ bge_attach(device_t dev)
 * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the
 * 5705 A0 and A1 chips.
 */
-   if (sc->bge_asicrev != BGE_ASICREV_BCM5700 &&
-   sc->bge_asicrev != BGE_ASICREV_BCM5906 &&
-   sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
-   sc->bge_chipid != BGE_CHIPID_BCM5705_A1 &&
-   !BGE_IS_5717_PLUS(sc))
-   sc->bge_phy_flags |= BGE_PHY_WIRESPEED;
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5700 ||
+   (sc->bge_asicrev == BGE_ASICREV_BCM5705 &&
+   (sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
+   sc->bge_chipid != BGE_CHIPID_BCM5705_A1)) ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5906)
+   sc->bge_phy_flags |= BGE_PHY_NO_WIRESPEED;
 
if (bge_has_eaddr(sc))
sc->bge_flags |= BGE_FLAG_EADDR;

Modified: stable/7/sys/dev/bge/if_bgereg.h
==
--- stable/7/sys/dev/bge/if_bgereg.hFri May 20 20:29:50 2011
(r222146)
+++ stable/7/sys/dev/bge/if_bgereg.hFri May 20 20:31:36 2011
(r222147)
@@ -2783,7 +2783,7 @@ struct bge_softc {
 #defineBGE_FLAG_RX_ALIGNBUG0x0400
 #defineBGE_FLAG_SHORT_DMA_BUG  0x0800
uint32_tbge_phy_flags;
-#defineBGE_PHY_WIRESPEED   0x0001
+#defineBGE_PHY_NO_WIRESPEED0x0001
 #defineBGE_PHY_ADC_BUG 0x0002
 #defineBGE_PHY_5704_A0_BUG 0x0004
 #defineBGE_PHY_JITTER_BUG  0x0008

Modified: stable/7/sys/dev/mii/brgphy.c
==
--- stable/7/sys/dev/mii/brgphy.c   Fri May 20 20:29:50 2011
(r222146)
+++ stable/7/sys/dev/mii/brgphy.c   Fri May 20 20:31:36 2011
(r222147)
@@ -970,7 +970,7 @@ brgphy_reset(struct mii_softc *sc)
 
brgphy_jumbo_settings(sc, ifp->if_mtu);
 
-   if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED)
+   if ((bge_sc->bge_phy_flags & BGE_PHY_NO_WIRESPEED) == 0)
brgphy_ethernet_wirespeed(sc);
 
/* Enable Link LED on Dell boxes */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222146 - in stable/8/sys/dev: bge mii

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 20:29:50 2011
New Revision: 222146
URL: http://svn.freebsd.org/changeset/base/222146

Log:
  MFC r221468:
Enable Ethernet@WireSpeed for BCM5718/BCM57765 family. While I'm
here inverse meaning of PHY flag as Ethernet@WireSpeed is enabled
for most PHYs.

Modified:
  stable/8/sys/dev/bge/if_bge.c
  stable/8/sys/dev/bge/if_bgereg.h
  stable/8/sys/dev/mii/brgphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Fri May 20 20:27:25 2011
(r222145)
+++ stable/8/sys/dev/bge/if_bge.c   Fri May 20 20:29:50 2011
(r222146)
@@ -2769,12 +2769,12 @@ bge_attach(device_t dev)
 * Don't enable Ethernet@WireSpeed for the 5700, 5906, or the
 * 5705 A0 and A1 chips.
 */
-   if (sc->bge_asicrev != BGE_ASICREV_BCM5700 &&
-   sc->bge_asicrev != BGE_ASICREV_BCM5906 &&
-   sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
-   sc->bge_chipid != BGE_CHIPID_BCM5705_A1 &&
-   !BGE_IS_5717_PLUS(sc))
-   sc->bge_phy_flags |= BGE_PHY_WIRESPEED;
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5700 ||
+   (sc->bge_asicrev == BGE_ASICREV_BCM5705 &&
+   (sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
+   sc->bge_chipid != BGE_CHIPID_BCM5705_A1)) ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5906)
+   sc->bge_phy_flags |= BGE_PHY_NO_WIRESPEED;
 
if (bge_has_eaddr(sc))
sc->bge_flags |= BGE_FLAG_EADDR;

Modified: stable/8/sys/dev/bge/if_bgereg.h
==
--- stable/8/sys/dev/bge/if_bgereg.hFri May 20 20:27:25 2011
(r222145)
+++ stable/8/sys/dev/bge/if_bgereg.hFri May 20 20:29:50 2011
(r222146)
@@ -2783,7 +2783,7 @@ struct bge_softc {
 #defineBGE_FLAG_RX_ALIGNBUG0x0400
 #defineBGE_FLAG_SHORT_DMA_BUG  0x0800
uint32_tbge_phy_flags;
-#defineBGE_PHY_WIRESPEED   0x0001
+#defineBGE_PHY_NO_WIRESPEED0x0001
 #defineBGE_PHY_ADC_BUG 0x0002
 #defineBGE_PHY_5704_A0_BUG 0x0004
 #defineBGE_PHY_JITTER_BUG  0x0008

Modified: stable/8/sys/dev/mii/brgphy.c
==
--- stable/8/sys/dev/mii/brgphy.c   Fri May 20 20:27:25 2011
(r222145)
+++ stable/8/sys/dev/mii/brgphy.c   Fri May 20 20:29:50 2011
(r222146)
@@ -970,7 +970,7 @@ brgphy_reset(struct mii_softc *sc)
 
brgphy_jumbo_settings(sc, ifp->if_mtu);
 
-   if (bge_sc->bge_phy_flags & BGE_PHY_WIRESPEED)
+   if ((bge_sc->bge_phy_flags & BGE_PHY_NO_WIRESPEED) == 0)
brgphy_ethernet_wirespeed(sc);
 
/* Enable Link LED on Dell boxes */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222145 - stable/7/sys/dev/bge

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 20:27:25 2011
New Revision: 222145
URL: http://svn.freebsd.org/changeset/base/222145

Log:
  MFC r221445:
Add initial BCM57765 family support. The BCM57765 family seems to
have similar hardware features of BCM5718 family except the number
of receive return ring is 4. The BCM57765 family is known to
support IEEE 802.3az EEE(Energy Efficient Ethernet) but this change
does not include EEE support code. I hope EEE is implemented in
near future.
This change will support BCM57761, BCM57765, BCM57781, BCM57785,
BCM57791 and BCM57795. All hardware offloading features are
supported and suspend/resume also should work.
Many thanks to Broadcom for continuing support of FreeBSD.
  
Tested by:  Paul Thornton (prt <> prt dot org)
HW donated by:  Broadcom

Modified:
  stable/7/sys/dev/bge/if_bge.c
  stable/7/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/bge/if_bge.c
==
--- stable/7/sys/dev/bge/if_bge.c   Fri May 20 20:26:16 2011
(r222144)
+++ stable/7/sys/dev/bge/if_bge.c   Fri May 20 20:27:25 2011
(r222145)
@@ -214,9 +214,15 @@ static const struct bge_type {
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5906 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5906M },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57760 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57761 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57765 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57780 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57781 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57785 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57788 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57790 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57791 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57795 },
 
{ SK_VENDORID,  SK_DEVICEID_ALTIMA },
 
@@ -307,6 +313,8 @@ static const struct bge_revision {
{ BGE_CHIPID_BCM5787_A2,"BCM5754/5787 A2" },
{ BGE_CHIPID_BCM5906_A1,"BCM5906 A1" },
{ BGE_CHIPID_BCM5906_A2,"BCM5906 A2" },
+   { BGE_CHIPID_BCM57765_A0,   "BCM57765 A0" },
+   { BGE_CHIPID_BCM57765_B0,   "BCM57765 B0" },
{ BGE_CHIPID_BCM57780_A0,   "BCM57780 A0" },
{ BGE_CHIPID_BCM57780_A1,   "BCM57780 A1" },
 
@@ -335,6 +343,7 @@ static const struct bge_revision const b
/* 5754 and 5787 share the same ASIC ID */
{ BGE_ASICREV_BCM5787,  "unknown BCM5754/5787" },
{ BGE_ASICREV_BCM5906,  "unknown BCM5906" },
+   { BGE_ASICREV_BCM57765, "unknown BCM57765" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
{ BGE_ASICREV_BCM5717,  "unknown BCM5717" },
 
@@ -1467,8 +1476,11 @@ bge_chipinit(struct bge_softc *sc)
if (sc->bge_asicrev == BGE_ASICREV_BCM5703 ||
sc->bge_asicrev == BGE_ASICREV_BCM5704)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA;
-   if (BGE_IS_5717_PLUS(sc))
+   if (BGE_IS_5717_PLUS(sc)) {
dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT;
+   if (sc->bge_chipid == BGE_CHIPID_BCM57765_A0)
+   dma_rw_ctl &= ~BGE_PCIDMARWCTL_CRDRDR_RDMA_MRRS_MSK;
+   }
pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4);
 
/*
@@ -1552,7 +1564,8 @@ bge_blockinit(struct bge_softc *sc)
}
 
/* Configure mbuf pool watermarks */
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717) {
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM57765) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
if (sc->bge_ifp->if_mtu > ETHERMTU) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e);
@@ -1819,7 +1832,8 @@ bge_blockinit(struct bge_softc *sc)
limit = 16;
} else if (!BGE_IS_5705_PLUS(sc))
limit = BGE_RX_RINGS_MAX;
-   else if (sc->bge_asicrev == BGE_ASICREV_BCM5755)
+   else if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM57765)
limit = 4;
else
limit = 1;
@@ -2180,6 +2194,15 @@ bge_probe(device_t dev)
id = pci_read_config(dev,
BGE_PCI_GEN2_PRODID_ASICREV, 4);
break;
+   case BCOM_DEVICEID_BCM57761:
+   case BCOM_DEVICEID_BCM57765:
+   case BCOM_DEVICEID_BCM5778

svn commit: r222144 - stable/8/sys/dev/bge

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 20:26:16 2011
New Revision: 222144
URL: http://svn.freebsd.org/changeset/base/222144

Log:
  MFC r221445:
Add initial BCM57765 family support. The BCM57765 family seems to
have similar hardware features of BCM5718 family except the number
of receive return ring is 4. The BCM57765 family is known to
support IEEE 802.3az EEE(Energy Efficient Ethernet) but this change
does not include EEE support code. I hope EEE is implemented in
near future.
This change will support BCM57761, BCM57765, BCM57781, BCM57785,
BCM57791 and BCM57795. All hardware offloading features are
supported and suspend/resume also should work.
Many thanks to Broadcom for continuing support of FreeBSD.
  
Tested by:  Paul Thornton (prt <> prt dot org)
HW donated by:  Broadcom

Modified:
  stable/8/sys/dev/bge/if_bge.c
  stable/8/sys/dev/bge/if_bgereg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/bge/if_bge.c
==
--- stable/8/sys/dev/bge/if_bge.c   Fri May 20 19:12:20 2011
(r222143)
+++ stable/8/sys/dev/bge/if_bge.c   Fri May 20 20:26:16 2011
(r222144)
@@ -214,9 +214,15 @@ static const struct bge_type {
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5906 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5906M },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57760 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57761 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57765 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57780 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57781 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57785 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57788 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM57790 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57791 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM57795 },
 
{ SK_VENDORID,  SK_DEVICEID_ALTIMA },
 
@@ -307,6 +313,8 @@ static const struct bge_revision {
{ BGE_CHIPID_BCM5787_A2,"BCM5754/5787 A2" },
{ BGE_CHIPID_BCM5906_A1,"BCM5906 A1" },
{ BGE_CHIPID_BCM5906_A2,"BCM5906 A2" },
+   { BGE_CHIPID_BCM57765_A0,   "BCM57765 A0" },
+   { BGE_CHIPID_BCM57765_B0,   "BCM57765 B0" },
{ BGE_CHIPID_BCM57780_A0,   "BCM57780 A0" },
{ BGE_CHIPID_BCM57780_A1,   "BCM57780 A1" },
 
@@ -335,6 +343,7 @@ static const struct bge_revision const b
/* 5754 and 5787 share the same ASIC ID */
{ BGE_ASICREV_BCM5787,  "unknown BCM5754/5787" },
{ BGE_ASICREV_BCM5906,  "unknown BCM5906" },
+   { BGE_ASICREV_BCM57765, "unknown BCM57765" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
{ BGE_ASICREV_BCM5717,  "unknown BCM5717" },
 
@@ -1467,8 +1476,11 @@ bge_chipinit(struct bge_softc *sc)
if (sc->bge_asicrev == BGE_ASICREV_BCM5703 ||
sc->bge_asicrev == BGE_ASICREV_BCM5704)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_MINDMA;
-   if (BGE_IS_5717_PLUS(sc))
+   if (BGE_IS_5717_PLUS(sc)) {
dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT;
+   if (sc->bge_chipid == BGE_CHIPID_BCM57765_A0)
+   dma_rw_ctl &= ~BGE_PCIDMARWCTL_CRDRDR_RDMA_MRRS_MSK;
+   }
pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4);
 
/*
@@ -1552,7 +1564,8 @@ bge_blockinit(struct bge_softc *sc)
}
 
/* Configure mbuf pool watermarks */
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717) {
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM57765) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
if (sc->bge_ifp->if_mtu > ETHERMTU) {
CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x7e);
@@ -1819,7 +1832,8 @@ bge_blockinit(struct bge_softc *sc)
limit = 16;
} else if (!BGE_IS_5705_PLUS(sc))
limit = BGE_RX_RINGS_MAX;
-   else if (sc->bge_asicrev == BGE_ASICREV_BCM5755)
+   else if (sc->bge_asicrev == BGE_ASICREV_BCM5755 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM57765)
limit = 4;
else
limit = 1;
@@ -2180,6 +2194,15 @@ bge_probe(device_t dev)
id = pci_read_config(dev,
BGE_PCI_GEN2_PRODID_ASICREV, 4);
break;
+   case BCOM_DEVICEID_BCM57761:
+   case BCOM_DEVICEID_BCM57765:
+ 

svn commit: r222142 - head/sys/dev/vge

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 18:27:13 2011
New Revision: 222142
URL: http://svn.freebsd.org/changeset/base/222142

Log:
  Datasheet says vge(4) controllers support DAC but it seems that's
  not true on old PCI based controllers.  DAC configuration is read
  from EEPROM in device reset phase and driver can override DAC
  configuration.  However I guess there is an undocumented reason why
  EEPROM configuration does not enable DAC so do not blindly override
  DAC configuration.  Recent PCIe based controllers are supposed to
  support 64bit DMA so allow 64bit DMA only on PCIe based controllers.
  
  PR:   kern/157184
  MFC after:1 week

Modified:
  head/sys/dev/vge/if_vge.c

Modified: head/sys/dev/vge/if_vge.c
==
--- head/sys/dev/vge/if_vge.c   Fri May 20 17:43:38 2011(r222141)
+++ head/sys/dev/vge/if_vge.c   Fri May 20 18:27:13 2011(r222142)
@@ -685,7 +685,18 @@ vge_dma_alloc(struct vge_softc *sc)
bus_addr_t lowaddr, tx_ring_end, rx_ring_end;
int error, i;
 
-   lowaddr = BUS_SPACE_MAXADDR;
+   /*
+* It seems old PCI controllers do not support DAC.  DAC
+* configuration can be enabled by accessing VGE_CHIPCFG3
+* register but honor EEPROM configuration instead of
+* blindly overriding DAC configuration.  PCIe based
+* controllers are supposed to support 64bit DMA so enable
+* 64bit DMA on these controllers.
+*/
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = BUS_SPACE_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
 
 again:
/* Create parent ring tag. */
@@ -802,10 +813,14 @@ again:
goto again;
}
 
+   if ((sc->vge_flags & VGE_FLAG_PCIE) != 0)
+   lowaddr = VGE_BUF_DMA_MAXADDR;
+   else
+   lowaddr = BUS_SPACE_MAXADDR_32BIT;
/* Create parent buffer tag. */
error = bus_dma_tag_create(bus_get_dma_tag(sc->vge_dev),/* parent */
1, 0,   /* algnmnt, boundary */
-   VGE_BUF_DMA_MAXADDR,/* lowaddr */
+   lowaddr,/* lowaddr */
BUS_SPACE_MAXADDR,  /* highaddr */
NULL, NULL, /* filter, filterarg */
BUS_SPACE_MAXSIZE_32BIT,/* maxsize */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222135 - head/sys/dev/gem

2011-05-20 Thread Pyun YongHyeon
Author: yongari
Date: Fri May 20 17:01:22 2011
New Revision: 222135
URL: http://svn.freebsd.org/changeset/base/222135

Log:
  Remove unnecessary controller reinitialization by checking
  IFF_DRV_RUNNING flag.  Previously running dhclient or adding alias
  addresses reinitialized controller and it resulted in unnecessary
  link flips.
  
  Reviewed by:  marius

Modified:
  head/sys/dev/gem/if_gem.c

Modified: head/sys/dev/gem/if_gem.c
==
--- head/sys/dev/gem/if_gem.c   Fri May 20 16:03:36 2011(r222134)
+++ head/sys/dev/gem/if_gem.c   Fri May 20 17:01:22 2011(r222135)
@@ -739,8 +739,10 @@ gem_reset_rxdma(struct gem_softc *sc)
 {
int i;
 
-   if (gem_reset_rx(sc) != 0)
+   if (gem_reset_rx(sc) != 0) {
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
return (gem_init_locked(sc));
+   }
for (i = 0; i < GEM_NRXDESC; i++)
if (sc->sc_rxsoft[i].rxs_mbuf != NULL)
GEM_UPDATE_RXDESC(sc, i);
@@ -924,6 +926,9 @@ gem_init_locked(struct gem_softc *sc)
 
GEM_LOCK_ASSERT(sc, MA_OWNED);
 
+   if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+   return;
+
 #ifdef GEM_DEBUG
CTR2(KTR_GEM, "%s: %s: calling stop", device_get_name(sc->sc_dev),
__func__);
@@ -1762,6 +1767,7 @@ gem_intr(void *v)
if ((status2 &
(GEM_MAC_TX_UNDERRUN | GEM_MAC_TX_PKT_TOO_LONG)) != 0) {
sc->sc_ifp->if_oerrors++;
+   sc->sc_ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
}
}
@@ -1814,6 +1820,7 @@ gem_watchdog(struct gem_softc *sc)
++ifp->if_oerrors;
 
/* Try to get more packets going. */
+   ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
gem_init_locked(sc);
gem_start_locked(ifp);
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222107 - in head/sys/dev: alc ale

2011-05-19 Thread Pyun YongHyeon
Author: yongari
Date: Thu May 19 23:13:08 2011
New Revision: 222107
URL: http://svn.freebsd.org/changeset/base/222107

Log:
  Fix typo.
  
  Submitted by: brad at OpenBSD

Modified:
  head/sys/dev/alc/if_alcreg.h
  head/sys/dev/ale/if_alereg.h

Modified: head/sys/dev/alc/if_alcreg.h
==
--- head/sys/dev/alc/if_alcreg.hThu May 19 22:55:37 2011
(r222106)
+++ head/sys/dev/alc/if_alcreg.hThu May 19 23:13:08 2011
(r222107)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */

Modified: head/sys/dev/ale/if_alereg.h
==
--- head/sys/dev/ale/if_alereg.hThu May 19 22:55:37 2011
(r222106)
+++ head/sys/dev/ale/if_alereg.hThu May 19 23:13:08 2011
(r222107)
@@ -17,12 +17,12 @@
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMATES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMATE.
+ * SUCH DAMAGE.
  *
  * $FreeBSD$
  */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222099 - stable/7/sys/dev/mii

2011-05-19 Thread Pyun YongHyeon
Author: yongari
Date: Thu May 19 17:20:13 2011
New Revision: 222099
URL: http://svn.freebsd.org/changeset/base/222099

Log:
  MFC r221817:
Explicitly clear 1000baseT control register for F1 PHY used in
AR8132 FastEthernet controller. The PHY has no ability to
establish a gigabit link. Previously only link parters which
support down-shifting was able to establish link.
This change should fix a long standing link establishment issue of
AR8132.
  
PR: kern/156935

Modified:
  stable/7/sys/dev/mii/atphy.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/mii/atphy.c
==
--- stable/7/sys/dev/mii/atphy.cThu May 19 17:18:13 2011
(r222098)
+++ stable/7/sys/dev/mii/atphy.cThu May 19 17:20:13 2011
(r222099)
@@ -384,6 +384,7 @@ atphy_anar(struct ifmedia_entry *ife)
 static int
 atphy_setmedia(struct mii_softc *sc, int media)
 {
+   struct atphy_softc *asc;
uint16_t anar;
 
anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
@@ -396,6 +397,20 @@ atphy_setmedia(struct mii_softc *sc, int
 (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
PHY_WRITE(sc, MII_100T2CR, GTCR_ADV_1000TFDX |
GTCR_ADV_1000THDX);
+   else {
+   /*
+* AR8132 has 10/100 PHY and the PHY uses the same
+* model number of F1 gigabit PHY.  The PHY has no
+* ability to establish gigabit link so explicitly
+* disable 1000baseT configuration for the PHY.
+* Otherwise, there is a case that atphy(4) could
+* not establish a link against gigabit link partner
+* unless the link partner supports down-shifting.
+*/
+   asc = (struct atphy_softc *)sc;
+   if (asc->mii_model == MII_MODEL_ATHEROS_F1)
+   PHY_WRITE(sc, MII_100T2CR, 0);
+   }
PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
 
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r222098 - stable/8/sys/dev/mii

2011-05-19 Thread Pyun YongHyeon
Author: yongari
Date: Thu May 19 17:18:13 2011
New Revision: 222098
URL: http://svn.freebsd.org/changeset/base/222098

Log:
  MFC r221817:
Explicitly clear 1000baseT control register for F1 PHY used in
AR8132 FastEthernet controller. The PHY has no ability to
establish a gigabit link. Previously only link parters which
support down-shifting was able to establish link.
This change should fix a long standing link establishment issue of
AR8132.
  
PR: kern/156935

Modified:
  stable/8/sys/dev/mii/atphy.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/mii/atphy.c
==
--- stable/8/sys/dev/mii/atphy.cThu May 19 15:18:35 2011
(r222097)
+++ stable/8/sys/dev/mii/atphy.cThu May 19 17:18:13 2011
(r222098)
@@ -384,6 +384,7 @@ atphy_anar(struct ifmedia_entry *ife)
 static int
 atphy_setmedia(struct mii_softc *sc, int media)
 {
+   struct atphy_softc *asc;
uint16_t anar;
 
anar = BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA;
@@ -396,6 +397,20 @@ atphy_setmedia(struct mii_softc *sc, int
 (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
PHY_WRITE(sc, MII_100T2CR, GTCR_ADV_1000TFDX |
GTCR_ADV_1000THDX);
+   else {
+   /*
+* AR8132 has 10/100 PHY and the PHY uses the same
+* model number of F1 gigabit PHY.  The PHY has no
+* ability to establish gigabit link so explicitly
+* disable 1000baseT configuration for the PHY.
+* Otherwise, there is a case that atphy(4) could
+* not establish a link against gigabit link partner
+* unless the link partner supports down-shifting.
+*/
+   asc = (struct atphy_softc *)sc;
+   if (asc->mii_model == MII_MODEL_ATHEROS_F1)
+   PHY_WRITE(sc, MII_100T2CR, 0);
+   }
PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
 
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221974 - head/sys/dev/bge

2011-05-15 Thread Pyun YongHyeon
Author: yongari
Date: Sun May 15 21:44:51 2011
New Revision: 221974
URL: http://svn.freebsd.org/changeset/base/221974

Log:
  Correctly disable jumbo frame support for BCM5719 A0.

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Sun May 15 20:52:43 2011(r221973)
+++ head/sys/dev/bge/if_bge.c   Sun May 15 21:44:51 2011(r221974)
@@ -2836,7 +2836,7 @@ bge_attach(device_t dev)
if (sc->bge_asicrev == BGE_ASICREV_BCM5719 &&
sc->bge_chipid == BGE_CHIPID_BCM5719_A0) {
/* Jumbo frame on BCM5719 A0 does not work. */
-   sc->bge_flags &= ~BGE_FLAG_JUMBO_FRAME;
+   sc->bge_flags &= ~BGE_FLAG_JUMBO;
}
break;
case BGE_ASICREV_BCM5755:
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221818 - head/sys/dev/bge

2011-05-12 Thread Pyun YongHyeon
Author: yongari
Date: Thu May 12 17:15:57 2011
New Revision: 221818
URL: http://svn.freebsd.org/changeset/base/221818

Log:
  Add initial BCM5719 support. TSO and jumbo frame was intentionally
  disabled for BCM5719 A0 revision due to known hardware errata.
  Many thanks to Broadcom for continuing support of FreeBSD.
  
  Submitted by: Geans Pin at Broadcom

Modified:
  head/sys/dev/bge/if_bge.c
  head/sys/dev/bge/if_bgereg.h

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Thu May 12 17:11:31 2011(r221817)
+++ head/sys/dev/bge/if_bge.c   Thu May 12 17:15:57 2011(r221818)
@@ -171,6 +171,7 @@ static const struct bge_type {
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5715S },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5717 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5718 },
+   { BCOM_VENDORID,BCOM_DEVICEID_BCM5719 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5720 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5721 },
{ BCOM_VENDORID,BCOM_DEVICEID_BCM5722 },
@@ -299,6 +300,7 @@ static const struct bge_revision {
{ BGE_CHIPID_BCM5715_A3,"BCM5715 A3" },
{ BGE_CHIPID_BCM5717_A0,"BCM5717 A0" },
{ BGE_CHIPID_BCM5717_B0,"BCM5717 B0" },
+   { BGE_CHIPID_BCM5719_A0,"BCM5719 A0" },
{ BGE_CHIPID_BCM5755_A0,"BCM5755 A0" },
{ BGE_CHIPID_BCM5755_A1,"BCM5755 A1" },
{ BGE_CHIPID_BCM5755_A2,"BCM5755 A2" },
@@ -346,6 +348,7 @@ static const struct bge_revision const b
{ BGE_ASICREV_BCM57765, "unknown BCM57765" },
{ BGE_ASICREV_BCM57780, "unknown BCM57780" },
{ BGE_ASICREV_BCM5717,  "unknown BCM5717" },
+   { BGE_ASICREV_BCM5719,  "unknown BCM5719" },
 
{ 0, NULL }
 };
@@ -1481,6 +1484,14 @@ bge_chipinit(struct bge_softc *sc)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_DIS_CACHE_ALIGNMENT;
if (sc->bge_chipid == BGE_CHIPID_BCM57765_A0)
dma_rw_ctl &= ~BGE_PCIDMARWCTL_CRDRDR_RDMA_MRRS_MSK;
+   /*
+* Enable HW workaround for controllers that misinterpret
+* a status tag update and leave interrupts permanently
+* disabled.
+*/
+   if (sc->bge_asicrev != BGE_ASICREV_BCM5717 &&
+   sc->bge_asicrev != BGE_ASICREV_BCM57765)
+   dma_rw_ctl |= BGE_PCIDMARWCTL_TAGGED_STATUS_WA;
}
pci_write_config(sc->bge_dev, BGE_PCI_DMA_RW_CTL, dma_rw_ctl, 4);
 
@@ -1537,7 +1548,7 @@ bge_blockinit(struct bge_softc *sc)
struct bge_rcb *rcb;
bus_size_t vrcb;
bge_hostaddr taddr;
-   uint32_t val;
+   uint32_t dmactl, val;
int i, limit;
 
/*
@@ -1594,8 +1605,16 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   val = BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN;
+   /*
+* Change the arbitration algorithm of TXMBUF read request to
+* round-robin instead of priority based for BCM5719.  When
+* TXFIFO is almost empty, RDMA will hold its request until
+* TXFIFO is not almost empty.
+*/
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5719)
+   val |= BGE_BMANMODE_NO_TX_UNDERRUN;
+   CSR_WRITE_4(sc, BGE_BMAN_MODE, val);
 
/* Poll for buffer manager start indication */
for (i = 0; i < BGE_TIMEOUT; i++) {
@@ -1692,7 +1711,8 @@ bge_blockinit(struct bge_softc *sc)
rcb->bge_maxlen_flags =
BGE_RCB_MAXLEN_FLAGS(BGE_MAX_FRAMELEN, 0);
}
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_STD_RX_RINGS_5717;
else
rcb->bge_nicaddr = BGE_STD_RX_RINGS;
@@ -1724,7 +1744,8 @@ bge_blockinit(struct bge_softc *sc)
BUS_DMASYNC_PREREAD);
rcb->bge_maxlen_flags = BGE_RCB_MAXLEN_FLAGS(0,
BGE_RCB_FLAG_USE_EXT_RX_BD | BGE_RCB_FLAG_RING_DISABLED);
-   if (sc->bge_asicrev == BGE_ASICREV_BCM5717)
+   if (sc->bge_asicrev == BGE_ASICREV_BCM5717 ||
+   sc->bge_asicrev == BGE_ASICREV_BCM5719)
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS_5717;
else
rcb->bge_nicaddr = BGE_JUMBO_RX_RINGS;
@@ -1812,7 +1833,8 @@ bge_blockinit(struct bge_softc *sc)
BGE_HOSTADDR(taddr, sc->bge_ldata.bge_tx_ring_paddr);
RCB_WRITE_4(sc, vrcb, bge_hostaddr.bge_addr_hi, taddr.bge_addr_hi);
RCB_WRITE_4(sc, vrc

svn commit: r221817 - head/sys/dev/mii

2011-05-12 Thread Pyun YongHyeon
Author: yongari
Date: Thu May 12 17:11:31 2011
New Revision: 221817
URL: http://svn.freebsd.org/changeset/base/221817

Log:
  Explicitly clear 1000baseT control register for F1 PHY used in
  AR8132 FastEthernet controller. The PHY has no ability to
  establish a gigabit link. Previously only link parters which
  support down-shifting was able to establish link.
  This change should fix a long standing link establishment issue of
  AR8132.
  
  PR:   kern/156935
  MFC after:1 week

Modified:
  head/sys/dev/mii/atphy.c

Modified: head/sys/dev/mii/atphy.c
==
--- head/sys/dev/mii/atphy.cThu May 12 17:02:56 2011(r221816)
+++ head/sys/dev/mii/atphy.cThu May 12 17:11:31 2011(r221817)
@@ -359,6 +359,18 @@ atphy_setmedia(struct mii_softc *sc, int
 (EXTSR_1000TFDX | EXTSR_1000THDX)) != 0)
PHY_WRITE(sc, MII_100T2CR, GTCR_ADV_1000TFDX |
GTCR_ADV_1000THDX);
+   else if (sc->mii_mpd_model == MII_MODEL_xxATHEROS_F1) {
+   /*
+* AR8132 has 10/100 PHY and the PHY uses the same
+* model number of F1 gigabit PHY.  The PHY has no
+* ability to establish gigabit link so explicitly
+* disable 1000baseT configuration for the PHY.
+* Otherwise, there is a case that atphy(4) could
+* not establish a link against gigabit link partner
+* unless the link partner supports down-shifting.
+*/
+   PHY_WRITE(sc, MII_100T2CR, 0);
+   }
PHY_WRITE(sc, MII_BMCR, BMCR_RESET | BMCR_AUTOEN | BMCR_STARTNEG);
 
return (EJUSTRETURN);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221713 - head/sys/dev/mii

2011-05-09 Thread Pyun YongHyeon
Author: yongari
Date: Mon May  9 20:20:43 2011
New Revision: 221713
URL: http://svn.freebsd.org/changeset/base/221713

Log:
  Recognize BCM5719C PHY.
  
  Submitted by: Geans Pin at Broadcom

Modified:
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/miidevs

Modified: head/sys/dev/mii/brgphy.c
==
--- head/sys/dev/mii/brgphy.c   Mon May  9 20:10:46 2011(r221712)
+++ head/sys/dev/mii/brgphy.c   Mon May  9 20:20:43 2011(r221713)
@@ -140,6 +140,7 @@ static const struct mii_phydesc brgphys[
MII_PHY_DESC(BROADCOM2, BCM5761),
MII_PHY_DESC(BROADCOM2, BCM5784),
MII_PHY_DESC(BROADCOM3, BCM5717C),
+   MII_PHY_DESC(BROADCOM3, BCM5719C),
MII_PHY_DESC(BROADCOM3, BCM57765),
MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906),
MII_PHY_END

Modified: head/sys/dev/mii/miidevs
==
--- head/sys/dev/mii/miidevsMon May  9 20:10:46 2011(r221712)
+++ head/sys/dev/mii/miidevsMon May  9 20:20:43 2011(r221713)
@@ -177,6 +177,7 @@ model BROADCOM2 BCM5709C0x003c BCM5709 
 model BROADCOM2 BCM57610x003d BCM5761 10/100/1000baseT PHY
 model BROADCOM2 BCM5709S   0x003f BCM5709S 1000/2500baseSX PHY
 model BROADCOM3 BCM5717C   0x0020 BCM5717C 1000BASE-T media interface
+model BROADCOM3 BCM5719C   0x0022 BCM5719C 1000BASE-T media interface
 model BROADCOM3 BCM57765   0x0024 BCM57765 1000BASE-T media interface
 model xxBROADCOM_ALT1 BCM5906  0x0004 BCM5906 10/100baseTX media interface
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221712 - head/sys/dev/bge

2011-05-09 Thread Pyun YongHyeon
Author: yongari
Date: Mon May  9 20:10:46 2011
New Revision: 221712
URL: http://svn.freebsd.org/changeset/base/221712

Log:
  Since r117657, bge(4) does not enable buffer manager for BCM5705 or
  newer controllers.  However, all data sheet I have access has no
  indication that buffer manager should not be touched on these
  controllers.  It seems the buffer manager always runs on BCM5705 or
  newer controllers. Some controller(e.g. BCM5719) needs other buffer
  manager configuration so driver should enable buffer manager for
  all controllers.  Both Linux and OpenBSD/NetBSD use the same
  approach.
  This change polls enable bit of block to know whether specified
  block was really stopped as well as enabling buffer manager for all
  controllers in driver initialization.
  
  Obtained from:NetBSD

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==
--- head/sys/dev/bge/if_bge.c   Mon May  9 19:40:36 2011(r221711)
+++ head/sys/dev/bge/if_bge.c   Mon May  9 20:10:46 2011(r221712)
@@ -403,6 +403,7 @@ static void bge_start(struct ifnet *);
 static int bge_ioctl(struct ifnet *, u_long, caddr_t);
 static void bge_init_locked(struct bge_softc *);
 static void bge_init(void *);
+static void bge_stop_block(struct bge_softc *, bus_size_t, uint32_t);
 static void bge_stop(struct bge_softc *);
 static void bge_watchdog(struct bge_softc *);
 static int bge_shutdown(device_t);
@@ -1593,22 +1594,19 @@ bge_blockinit(struct bge_softc *sc)
CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_HIWAT, 10);
 
/* Enable buffer manager */
-   if (!(BGE_IS_5705_PLUS(sc))) {
-   CSR_WRITE_4(sc, BGE_BMAN_MODE,
-   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
+   CSR_WRITE_4(sc, BGE_BMAN_MODE,
+   BGE_BMANMODE_ENABLE | BGE_BMANMODE_LOMBUF_ATTN);
 
-   /* Poll for buffer manager start indication */
-   for (i = 0; i < BGE_TIMEOUT; i++) {
-   DELAY(10);
-   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
-   break;
-   }
+   /* Poll for buffer manager start indication */
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   DELAY(10);
+   if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
+   break;
+   }
 
-   if (i == BGE_TIMEOUT) {
-   device_printf(sc->bge_dev,
-   "buffer manager failed to start\n");
-   return (ENXIO);
-   }
+   if (i == BGE_TIMEOUT) {
+   device_printf(sc->bge_dev, "buffer manager failed to start\n");
+   return (ENXIO);
}
 
/* Enable flow-through queues */
@@ -5136,6 +5134,20 @@ bge_watchdog(struct bge_softc *sc)
ifp->if_oerrors++;
 }
 
+static void
+bge_stop_block(struct bge_softc *sc, bus_size_t reg, uint32_t bit)
+{
+   int i;
+
+   BGE_CLRBIT(sc, reg, bit);
+
+   for (i = 0; i < BGE_TIMEOUT; i++) {
+   if ((CSR_READ_4(sc, reg) & bit) == 0)
+   return;
+   DELAY(100);
+}
+}
+
 /*
  * Stop the adapter and free any mbufs allocated to the
  * RX and TX lists.
@@ -5164,35 +5176,36 @@ bge_stop(struct bge_softc *sc)
/*
 * Disable all of the receiver blocks.
 */
-   BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
-   if (!(BGE_IS_5705_PLUS(sc)))
-   BGE_CLRBIT(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RX_MODE, BGE_RXMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RXLP_MODE, BGE_RXLPMODE_ENABLE);
+   if (BGE_IS_5700_FAMILY(sc))
+   bge_stop_block(sc, BGE_RXLS_MODE, BGE_RXLSMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDBDI_MODE, BGE_RBDIMODE_ENABLE);
+   bge_stop_block(sc, BGE_RDC_MODE, BGE_RDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_RBDC_MODE, BGE_RBDCMODE_ENABLE);
 
/*
 * Disable all of the transmit blocks.
 */
-   BGE_CLRBIT(sc, BGE_SRS_MODE, BGE_SRSMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SBDI_MODE, BGE_SBDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SDI_MODE, BGE_SDIMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_RDMA_MODE, BGE_RDMAMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SDC_MODE, BGE_SDCMODE_ENABLE);
-   if (!(BGE_IS_5705_PLUS(sc)))
-   BGE_CLRBIT(sc, BGE_DMAC_MODE, BGE_DMACMODE_ENABLE);
-   BGE_CLRBIT(sc, BGE_SBDC_MODE, BGE_SBDCMODE_ENABLE);
+   bge_stop_block(sc, BGE_SRS_MODE, BGE_S

svn commit: r221579 - head/sys/dev/xl

2011-05-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat May  7 04:40:44 2011
New Revision: 221579
URL: http://svn.freebsd.org/changeset/base/221579

Log:
  Fix build.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Sat May  7 03:58:27 2011(r221578)
+++ head/sys/dev/xl/if_xl.c Sat May  7 04:40:44 2011(r221579)
@@ -2380,7 +2380,7 @@ xl_poll_locked(struct ifnet *ifp, enum p
}
 
if (status & XL_STAT_STATSOFLOW)
-   xl_stats_update_locked(sc);
+   xl_stats_update(sc);
}
}
return (rx_npkts);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221571 - head/sys/dev/xl

2011-05-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat May  7 02:19:46 2011
New Revision: 221571
URL: http://svn.freebsd.org/changeset/base/221571

Log:
  Remove unneeded use of variable status. This should have been done
  in r221557.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Sat May  7 02:00:35 2011(r221570)
+++ head/sys/dev/xl/if_xl.c Sat May  7 02:19:46 2011(r221571)
@@ -2564,7 +2564,6 @@ xl_start_locked(struct ifnet *ifp)
struct mbuf *m_head;
struct xl_chain *prev = NULL, *cur_tx = NULL, *start_tx;
struct xl_chain *prev_tx;
-   u_int32_t   status;
int error;
 
XL_LOCK_ASSERT(sc);
@@ -2651,7 +2650,6 @@ xl_start_locked(struct ifnet *ifp)
sc->xl_cdata.xl_tx_tail->xl_next = start_tx;
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next =
htole32(start_tx->xl_phys);
-   status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status;
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &=
htole32(~XL_TXSTAT_DL_INTR);
sc->xl_cdata.xl_tx_tail = cur_tx;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221568 - head/sys/dev/xl

2011-05-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat May  7 00:25:12 2011
New Revision: 221568
URL: http://svn.freebsd.org/changeset/base/221568

Log:
  XL_DMACTL is 32bit register, use 32bit write macro.
  While I'm here add more bits for the register.

Modified:
  head/sys/dev/xl/if_xl.c
  head/sys/dev/xl/if_xlreg.h

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Sat May  7 00:18:58 2011(r221567)
+++ head/sys/dev/xl/if_xl.c Sat May  7 00:25:12 2011(r221568)
@@ -2969,7 +2969,7 @@ xl_init_locked(struct xl_softc *sc)
 
/* Set the RX early threshold */
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_THRESH|(XL_PACKET_SIZE >>2));
-   CSR_WRITE_2(sc, XL_DMACTL, XL_DMACTL_UP_RX_EARLY);
+   CSR_WRITE_4(sc, XL_DMACTL, XL_DMACTL_UP_RX_EARLY);
 
/* Enable receiver and transmitter. */
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_ENABLE);

Modified: head/sys/dev/xl/if_xlreg.h
==
--- head/sys/dev/xl/if_xlreg.h  Sat May  7 00:18:58 2011(r221567)
+++ head/sys/dev/xl/if_xlreg.h  Sat May  7 00:25:12 2011(r221568)
@@ -124,6 +124,11 @@
 #define XL_DMACTL_DOWN_INPROG  0x0080
 #define XL_DMACTL_COUNTER_SPEED0x0100
 #define XL_DMACTL_DOWNDOWN_MODE0x0200
+#define XL_DMACTL_UP_ALTSEQ_DIS0x0001  /* 
3c90xB/3c90xC */
+#define XL_DMACTL_DOWN_ALTSEQ_DIS  0x0002  /* 3c90xC only */
+#define XL_DMACTL_DEFEAT_MWI   0x0010  /* 3c90xB/3c90xC */
+#define XL_DMACTL_DEFEAT_MRL   0x0010  /* 3c90xB/3c90xC */
+#define XL_DMACTL_UP_OVERRUN_DISC_DIS  0x0020  /* 3c90xB/3c90xC */
 #define XL_DMACTL_TARGET_ABORT 0x4000
 #define XL_DMACTL_MASTER_ABORT 0x8000
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221567 - head/sys/dev/xl

2011-05-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat May  7 00:18:58 2011
New Revision: 221567
URL: http://svn.freebsd.org/changeset/base/221567

Log:
  Rearm watchdog timer if driver kick controller to recover from TX
  underrun error.
  While here, prepend 0x to status code to show TX status is hex
  number.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Sat May  7 00:06:02 2011(r221566)
+++ head/sys/dev/xl/if_xl.c Sat May  7 00:18:58 2011(r221567)
@@ -2207,7 +2207,7 @@ xl_txeoc(struct xl_softc *sc)
txstat & XL_TXSTATUS_JABBER ||
txstat & XL_TXSTATUS_RECLAIM) {
device_printf(sc->xl_dev,
-   "transmission error: %x\n", txstat);
+   "transmission error: 0x%02x\n", txstat);
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_TX_RESET);
xl_wait(sc);
if (sc->xl_type == XL_TYPE_905B) {
@@ -2220,11 +2220,14 @@ xl_txeoc(struct xl_softc *sc)
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
c->xl_phys);
CSR_WRITE_1(sc, XL_DOWN_POLL, 64);
+   sc->xl_wdog_timer = 5;
}
} else {
-   if (sc->xl_cdata.xl_tx_head != NULL)
+   if (sc->xl_cdata.xl_tx_head != NULL) {
CSR_WRITE_4(sc, XL_DOWNLIST_PTR,
sc->xl_cdata.xl_tx_head->xl_phys);
+   sc->xl_wdog_timer = 5;
+   }
}
/*
 * Remember to set this for the
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r221566 - head/sys/dev/xl

2011-05-06 Thread Pyun YongHyeon
Author: yongari
Date: Sat May  7 00:06:02 2011
New Revision: 221566
URL: http://svn.freebsd.org/changeset/base/221566

Log:
  Rename xl_stats_update() callout handler to xl_tick() and move MII
  tick driving logic to xl_tick(). Now xl_tick() handles MII tick as
  well as periodic updating of statistics.
  This change removes a hack used in interrupt handler where it
  wanted to update statistics without driving MII tick.

Modified:
  head/sys/dev/xl/if_xl.c
  head/sys/dev/xl/if_xlreg.h

Modified: head/sys/dev/xl/if_xl.c
==
--- head/sys/dev/xl/if_xl.c Fri May  6 23:49:10 2011(r221565)
+++ head/sys/dev/xl/if_xl.c Sat May  7 00:06:02 2011(r221566)
@@ -225,8 +225,8 @@ static int xl_attach(device_t);
 static int xl_detach(device_t);
 
 static int xl_newbuf(struct xl_softc *, struct xl_chain_onefrag *);
-static void xl_stats_update(void *);
-static void xl_stats_update_locked(struct xl_softc *);
+static void xl_tick(void *);
+static void xl_stats_update(struct xl_softc *);
 static int xl_encap(struct xl_softc *, struct xl_chain *, struct mbuf **);
 static int xl_rxeof(struct xl_softc *);
 static void xl_rxeof_task(void *, int);
@@ -1330,7 +1330,7 @@ xl_attach(device_t dev)
goto fail;
}
 
-   callout_init_mtx(&sc->xl_stat_callout, &sc->xl_mtx, 0);
+   callout_init_mtx(&sc->xl_tick_callout, &sc->xl_mtx, 0);
TASK_INIT(&sc->xl_task, 0, xl_rxeof_task, sc);
 
/*
@@ -1695,7 +1695,7 @@ xl_detach(device_t dev)
xl_stop(sc);
XL_UNLOCK(sc);
taskqueue_drain(taskqueue_swi, &sc->xl_task);
-   callout_drain(&sc->xl_stat_callout);
+   callout_drain(&sc->xl_tick_callout);
ether_ifdetach(ifp);
}
if (sc->xl_miibus)
@@ -2307,11 +2307,8 @@ xl_intr(void *arg)
break;
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_update_locked(sc);
-   sc->xl_stats_no_timeout = 0;
-   }
+   if (status & XL_STAT_STATSOFLOW)
+   xl_stats_update(sc);
}
 
if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
@@ -2379,49 +2376,46 @@ xl_poll_locked(struct ifnet *ifp, enum p
xl_init_locked(sc);
}
 
-   if (status & XL_STAT_STATSOFLOW) {
-   sc->xl_stats_no_timeout = 1;
+   if (status & XL_STAT_STATSOFLOW)
xl_stats_update_locked(sc);
-   sc->xl_stats_no_timeout = 0;
-   }
}
}
return (rx_npkts);
 }
 #endif /* DEVICE_POLLING */
 
-/*
- * XXX: This is an entry point for callout which needs to take the lock.
- */
 static void
-xl_stats_update(void *xsc)
+xl_tick(void *xsc)
 {
struct xl_softc *sc = xsc;
+   struct mii_data *mii;
 
XL_LOCK_ASSERT(sc);
 
+   if (sc->xl_miibus != NULL) {
+   mii = device_get_softc(sc->xl_miibus);
+   mii_tick(mii);
+   }
+
+   xl_stats_update(sc);
if (xl_watchdog(sc) == EJUSTRETURN)
return;
 
-   xl_stats_update_locked(sc);
+   callout_reset(&sc->xl_tick_callout, hz, xl_tick, sc);
 }
 
 static void
-xl_stats_update_locked(struct xl_softc *sc)
+xl_stats_update(struct xl_softc *sc)
 {
struct ifnet*ifp = sc->xl_ifp;
struct xl_stats xl_stats;
u_int8_t*p;
int i;
-   struct mii_data *mii = NULL;
 
XL_LOCK_ASSERT(sc);
 
bzero((char *)&xl_stats, sizeof(struct xl_stats));
 
-   if (sc->xl_miibus != NULL)
-   mii = device_get_softc(sc->xl_miibus);
-
p = (u_int8_t *)&xl_stats;
 
/* Read all the stats registers. */
@@ -2443,14 +2437,7 @@ xl_stats_update_locked(struct xl_softc *
 */
XL_SEL_WIN(4);
CSR_READ_1(sc, XL_W4_BADSSD);
-
-   if ((mii != NULL) && (!sc->xl_stats_no_timeout))
-   mii_tick(mii);
-
XL_SEL_WIN(7);
-
-   if (!sc->xl_stats_no_timeout)
-   callout_reset(&sc->xl_stat_callout, hz, xl_stats_update, sc);
 }
 
 /*
@@ -2957,9 +2944,7 @@ xl_init_locked(struct xl_softc *sc)
 
/* Clear out the stats counters. */
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_DISABLE);
-   sc->xl_stats_no_timeout = 1;
-   xl_stats_update_locked(sc);
-   sc->xl_stats_no_timeout = 0;
+   xl_stats_update(sc);
XL_SEL_WIN(4);
CSR_WRITE_2(sc, XL_W4_NET_DIAG, XL_NETDIAG_UPPER_BYTES_ENABLE);
CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_STATS_ENABLE);
@@ -3000,7 +2985,7 @@ xl_init_locked(struct xl_softc *sc)
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
   

<    2   3   4   5   6   7   8   9   10   11   >