CVS commit: src/sys/dev/marvell
Module Name:src Committed By: andvar Date: Fri Aug 13 21:04:44 UTC 2021 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: s/fame/frame in mvxpe_mib_def with assumption that it was not intentional typo. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.34 src/sys/dev/marvell/if_mvxpe.c:1.35 --- src/sys/dev/marvell/if_mvxpe.c:1.34 Mon Aug 2 12:56:24 2021 +++ src/sys/dev/marvell/if_mvxpe.c Fri Aug 13 21:04:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $"); #include "opt_multiprocessor.h" @@ -218,7 +218,7 @@ STATIC struct mvxpe_mib_def { "Frame Size 256 - 511"}, {MVXPE_MIB_RX_FRAME1023_OCT, 0, "rx_frame_512_1023", "Frame Size 512 - 1023", 0}, - {MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_fame_1024_max", + {MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_frame_1024_max", "Frame Size 1024 - Max", 0}, {MVXPE_MIB_TX_GOOD_OCT, 1, "tx_good_oct", "Good Octets Tx", 0},
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: riastradh Date: Sat Jul 25 22:37:48 UTC 2020 Modified Files: src/sys/dev/marvell: mvxpsec.c Log Message: Make this build with or without options IPSEC. Not really that useful without options IPSEC, but simply uncommenting mvxpsec in conf/ARMADAXP didn't build, and this change is trivial, so why not. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/mvxpsec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvxpsec.c diff -u src/sys/dev/marvell/mvxpsec.c:1.6 src/sys/dev/marvell/mvxpsec.c:1.7 --- src/sys/dev/marvell/mvxpsec.c:1.6 Sat Jul 25 22:37:16 2020 +++ src/sys/dev/marvell/mvxpsec.c Sat Jul 25 22:37:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mvxpsec.c,v 1.6 2020/07/25 22:37:16 riastradh Exp $ */ +/* $NetBSD: mvxpsec.c,v 1.7 2020/07/25 22:37:48 riastradh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -24,6 +24,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef _KERNEL_OPT +#include "opt_ipsec.h" +#endif + /* * Cryptographic Engine and Security Accelerator(MVXPSEC) */ @@ -63,7 +68,9 @@ #include #include +#if NIPSEC > 0 #include +#endif #include #include @@ -2513,6 +2520,7 @@ mvxpsec_packet_setmbuf(struct mvxpsec_pa } } if (pktlen > SRAM_PAYLOAD_SIZE) { +#if NIPSEC > 0 extern percpu_t *espstat_percpu; /* XXX: * layer violation. opencrypto knows our max packet size @@ -2520,6 +2528,7 @@ mvxpsec_packet_setmbuf(struct mvxpsec_pa */ _NET_STATINC(espstat_percpu, ESP_STAT_TOOBIG); +#endif log(LOG_ERR, "%s: ESP Packet too large: %zu [oct.] > %zu [oct.]\n", device_xname(sc->sc_dev), @@ -2562,6 +2571,7 @@ mvxpsec_packet_setuio(struct mvxpsec_pac struct mvxpsec_softc *sc = mv_s->sc; if (uio->uio_resid > SRAM_PAYLOAD_SIZE) { +#if NIPSEC > 0 extern percpu_t *espstat_percpu; /* XXX: * layer violation. opencrypto knows our max packet size @@ -2569,6 +2579,7 @@ mvxpsec_packet_setuio(struct mvxpsec_pac */ _NET_STATINC(espstat_percpu, ESP_STAT_TOOBIG); +#endif log(LOG_ERR, "%s: uio request too large: %zu [oct.] > %zu [oct.]\n", device_xname(sc->sc_dev),
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: riastradh Date: Sat Jul 25 22:37:16 UTC 2020 Modified Files: src/sys/dev/marvell: files.armada mvxpsec.c Log Message: Omit needless rijndael dependencies. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/files.armada \ src/sys/dev/marvell/mvxpsec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/files.armada diff -u src/sys/dev/marvell/files.armada:1.5 src/sys/dev/marvell/files.armada:1.6 --- src/sys/dev/marvell/files.armada:1.5 Wed Apr 22 09:15:40 2020 +++ src/sys/dev/marvell/files.armada Sat Jul 25 22:37:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: files.armada,v 1.5 2020/04/22 09:15:40 rin Exp $ +# $NetBSD: files.armada,v 1.6 2020/07/25 22:37:16 riastradh Exp $ # Configuration info for Marvell ARMADA integrated peripherals # ARMADA XP Buffer Manger @@ -10,5 +10,5 @@ device mvxpe: mvxpbm, ether, ifnet, arp, file dev/marvell/if_mvxpe.c mvxpe needs-flag # ARMADA XP Cryptographic Engines and Security Accelerator -device mvxpsec: opencrypto, rijndael +device mvxpsec: opencrypto file dev/marvell/mvxpsec.c mvxpsec needs-flag Index: src/sys/dev/marvell/mvxpsec.c diff -u src/sys/dev/marvell/mvxpsec.c:1.5 src/sys/dev/marvell/mvxpsec.c:1.6 --- src/sys/dev/marvell/mvxpsec.c:1.5 Fri Dec 27 09:41:51 2019 +++ src/sys/dev/marvell/mvxpsec.c Sat Jul 25 22:37:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mvxpsec.c,v 1.5 2019/12/27 09:41:51 msaitoh Exp $ */ +/* $NetBSD: mvxpsec.c,v 1.6 2020/07/25 22:37:16 riastradh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -53,8 +53,6 @@ #include -#include - #include #include
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: riastradh Date: Sun Jun 14 23:29:23 UTC 2020 Modified Files: src/sys/dev/marvell: mvcesa.c Log Message: mvcesa(4): Don't use prev msg's last block as IV for next msg in CBC. This violates the security contract of the CBC construction, which requires that the IV be unpredictable in advance; an adaptive adversary can exploit this to verify plaintext guesses. XXX Compile-tested only. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvcesa.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvcesa.c diff -u src/sys/dev/marvell/mvcesa.c:1.2 src/sys/dev/marvell/mvcesa.c:1.3 --- src/sys/dev/marvell/mvcesa.c:1.2 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/marvell/mvcesa.c Sun Jun 14 23:29:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.2 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $"); #include #include @@ -56,7 +56,6 @@ struct mvcesa_session { int ses_used; int ses_klen; - uint32_t ses_iv[4]; uint32_t ses_key[8]; uint32_t ses_hminner[5]; /* HMAC inner state */ @@ -236,9 +235,6 @@ mvcesa_newsession(void *arg, u_int32_t * return EINVAL; enc = 1; - cprng_fast(ses->ses_iv, - c->cri_alg == CRYPTO_AES_CBC ? 16 : 8); - /* Go ahead and compute key in CESA's byte order */ ses->ses_klen = c->cri_klen; memcpy(ses->ses_key, c->cri_key, c->cri_klen / 8); @@ -406,8 +402,10 @@ mvcesa_process(void *arg, struct cryptop dir = MVCESA_DESE_C_DIRECTION_ENC; if (crd->crd_flags & CRD_F_IV_EXPLICIT) iv = (uint32_t *)crd->crd_iv; -else - iv = ses->ses_iv; +else { + cprng_fast(ivbuf, sizeof(ivbuf)); + iv = ivbuf; +} if (!(crd->crd_flags & CRD_F_IV_PRESENT)) { if (m != NULL) m_copyback(m, crd->crd_inject, @@ -760,8 +758,5 @@ mvcesa_des_encdec(struct mvcesa_softc *s } } - if (dir == MVCESA_DESE_C_DIRECTION_ENC) - memcpy(ses->ses_iv, iv, sizeof(ses->ses_iv)); - return 0; }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: skrll Date: Wed Feb 5 08:34:48 UTC 2020 Modified Files: src/sys/dev/marvell: if_gfe.c if_mvxpe.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/dev/marvell/if_gfe.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_gfe.c diff -u src/sys/dev/marvell/if_gfe.c:1.55 src/sys/dev/marvell/if_gfe.c:1.56 --- src/sys/dev/marvell/if_gfe.c:1.55 Tue Feb 4 07:36:55 2020 +++ src/sys/dev/marvell/if_gfe.c Wed Feb 5 08:34:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $ */ +/* $NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.56 2020/02/05 08:34:48 skrll Exp $"); #include "opt_inet.h" @@ -906,7 +906,7 @@ gfe_rx_get(struct gfe_softc *sc, enum gf (buflen > sc->sc_max_frame_length)) { GE_DPRINTF(sc, ("!")); --rxq->rxq_active; - ifp->if_ipackets++; + if_statinc(ifp, if_ipackets); if_statinc(ifp, if_ierrors); goto give_it_back; } Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.32 src/sys/dev/marvell/if_mvxpe.c:1.33 --- src/sys/dev/marvell/if_mvxpe.c:1.32 Tue Feb 4 07:36:55 2020 +++ src/sys/dev/marvell/if_mvxpe.c Wed Feb 5 08:34:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.33 2020/02/05 08:34:48 skrll Exp $"); #include "opt_multiprocessor.h" @@ -3264,10 +3264,10 @@ mvxpe_update_mib(struct mvxpe_softc *sc) switch (mvxpe_mib_list[i].ext) { case MVXPE_MIBEXT_IF_OERRORS: - ifp->if_oerrors += val; + if_statadd(ifp, if_oerrors, val); break; case MVXPE_MIBEXT_IF_IERRORS: - ifp->if_ierrors += val; + if_statadd(ifp, if_ierrors, val); break; case MVXPE_MIBEXT_IF_COLLISIONS: if_statadd(ifp, if_collisions, val);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: skrll Date: Tue Feb 4 07:36:55 UTC 2020 Modified Files: src/sys/dev/marvell: if_gfe.c if_mvxpe.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/marvell/if_gfe.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_gfe.c diff -u src/sys/dev/marvell/if_gfe.c:1.54 src/sys/dev/marvell/if_gfe.c:1.55 --- src/sys/dev/marvell/if_gfe.c:1.54 Tue May 28 07:41:49 2019 +++ src/sys/dev/marvell/if_gfe.c Tue Feb 4 07:36:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $ */ +/* $NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.54 2019/05/28 07:41:49 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.55 2020/02/04 07:36:55 skrll Exp $"); #include "opt_inet.h" @@ -747,7 +747,7 @@ gfe_ifwatchdog(struct ifnet *ifp) GE_TXDPRESYNC(sc, txq, curtxdnum); } aprint_error("\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); (void) gfe_whack(sc, GE_WHACK_RESTART); GE_FUNC_EXIT(sc, ""); } @@ -907,7 +907,7 @@ gfe_rx_get(struct gfe_softc *sc, enum gf GE_DPRINTF(sc, ("!")); --rxq->rxq_active; ifp->if_ipackets++; - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); goto give_it_back; } @@ -1008,7 +1008,7 @@ gfe_rx_process(struct gfe_softc *sc, uin sc->sc_tickflags |= GE_TICK_RX_RESTART; callout_reset(&sc->sc_co, 1, gfe_tick, sc); } - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); GE_DPRINTF(sc, ("%s: rx queue %d filled at %u\n", device_xname(sc->sc_dev), rxprio, rxq->rxq_fi)); memset(masks, 0, sizeof(masks)); @@ -1249,9 +1249,9 @@ gfe_tx_enqueue(struct gfe_softc *sc, enu txq->txq_nactive--; /* statistics */ - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (cmdsts & TX_STS_ES) - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); GE_DPRINTF(sc, ("%%")); } @@ -1424,9 +1424,9 @@ gfe_tx_done(struct gfe_softc *sc, enum g txq->txq_inptr += roundup(pktlen, dcache_line_size); /* statistics */ - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (cmdsts & TX_STS_ES) - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); /* txd->ed_bufptr = 0; */ Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.31 src/sys/dev/marvell/if_mvxpe.c:1.32 --- src/sys/dev/marvell/if_mvxpe.c:1.31 Sat Dec 28 03:07:18 2019 +++ src/sys/dev/marvell/if_mvxpe.c Tue Feb 4 07:36:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.32 2020/02/04 07:36:55 skrll Exp $"); #include "opt_multiprocessor.h" @@ -1709,7 +1709,7 @@ mvxpe_start(struct ifnet *ifp) sc->sc_tx_ring[q].tx_queue_len); DPRINTIFNET(ifp, 1, "a packet is added to tx ring\n"); sc->sc_tx_pending++; - ifp->if_opackets++; + if_statinc(ifp, if_opackets); ifp->if_timer = 1; sc->sc_wdogsoft = 1; bpf_mtap(ifp, m, BPF_D_OUT); @@ -1937,7 +1937,7 @@ mvxpe_watchdog(struct ifnet *ifp) MVXPE_EVCNT_INCR(&sc->sc_ev.ev_drv_wdogsoft); } else { aprint_error_ifnet(ifp, "watchdog timeout\n"); -ifp->if_oerrors++; +if_statinc(ifp, if_oerrors); mvxpe_linkreset(sc); mvxpe_sc_unlock(sc); @@ -3270,7 +3270,7 @@ mvxpe_update_mib(struct mvxpe_softc *sc) ifp->if_ierrors += val; break; case MVXPE_MIBEXT_IF_COLLISIONS: - ifp->if_collisions += val; + if_statadd(ifp, if_collisions, val); break; default: break;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: skrll Date: Mon Feb 3 07:47:54 UTC 2020 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.58 src/sys/dev/marvell/if_mvgbe.c:1.59 --- src/sys/dev/marvell/if_mvgbe.c:1.58 Fri Sep 13 07:55:07 2019 +++ src/sys/dev/marvell/if_mvgbe.c Mon Feb 3 07:47:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $"); #include "opt_multiprocessor.h" @@ -1455,7 +1455,7 @@ mvgbe_watchdog(struct ifnet *ifp) } else { aprint_error_ifnet(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); mvgbe_init(ifp); } @@ -1998,15 +1998,15 @@ mvgbe_rxeof(struct mvgbe_softc *sc) int err = rxstat & MVGBE_RX_ERROR_CODE_MASK; if (err == MVGBE_RX_CRC_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_OVERRUN_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_MAX_FRAME_LEN_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_RESOURCE_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); #else - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); #endif mvgbe_newbuf(sc, cur, m, dmamap); continue; @@ -2059,7 +2059,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) aprint_error_ifnet(ifp, "no receive buffers available --" " packet dropped!\n"); -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); continue; } m = m0; @@ -2107,16 +2107,16 @@ mvgbe_txeof(struct mvgbe_softc *sc) break; } if (cur_tx->cmdsts & MVGBE_TX_LAST_DESC) - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (cur_tx->cmdsts & MVGBE_ERROR_SUMMARY) { int err = cur_tx->cmdsts & MVGBE_TX_ERROR_CODE_MASK; if (err == MVGBE_TX_LATE_COLLISION_ERROR) -ifp->if_collisions++; +if_statinc(ifp, if_collisions); if (err == MVGBE_TX_UNDERRUN_ERROR) -ifp->if_oerrors++; +if_statinc(ifp, if_oerrors); if (err == MVGBE_TX_EXCESSIVE_COLLISION_ERRO) -ifp->if_collisions++; +if_statinc(ifp, if_collisions); } if (cdata->mvgbe_tx_chain[idx].mvgbe_mbuf != NULL) { entry = cdata->mvgbe_tx_map[idx];
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: gutteridge Date: Sat Dec 28 03:07:18 UTC 2019 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Fix typos in messages. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.30 src/sys/dev/marvell/if_mvxpe.c:1.31 --- src/sys/dev/marvell/if_mvxpe.c:1.30 Tue Oct 15 00:13:53 2019 +++ src/sys/dev/marvell/if_mvxpe.c Sat Dec 28 03:07:18 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.30 2019/10/15 00:13:53 chs Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.30 2019/10/15 00:13:53 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.31 2019/12/28 03:07:18 gutteridge Exp $"); #include "opt_multiprocessor.h" @@ -558,11 +558,11 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s evcnt_attach_dynamic(&sc->sc_ev.ev_misc_srse, EVCNT_TYPE_INTR, NULL, device_xname(sc->sc_dev), "MISC SERDES sync error"); evcnt_attach_dynamic(&sc->sc_ev.ev_misc_txreq, EVCNT_TYPE_INTR, - NULL, device_xname(sc->sc_dev), "MISC Tx resource erorr"); + NULL, device_xname(sc->sc_dev), "MISC Tx resource error"); /* RxTx Interrupt */ evcnt_attach_dynamic(&sc->sc_ev.ev_rxtx_rreq, EVCNT_TYPE_INTR, - NULL, device_xname(sc->sc_dev), "RxTx Rx resource erorr"); + NULL, device_xname(sc->sc_dev), "RxTx Rx resource error"); evcnt_attach_dynamic(&sc->sc_ev.ev_rxtx_rpq, EVCNT_TYPE_INTR, NULL, device_xname(sc->sc_dev), "RxTx Rx packet"); evcnt_attach_dynamic(&sc->sc_ev.ev_rxtx_tbrq, EVCNT_TYPE_INTR, @@ -600,7 +600,7 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s evcnt_attach_dynamic(&sc->sc_ev.ev_txd_ur, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "Tx FIFO underrun counter"); evcnt_attach_dynamic(&sc->sc_ev.ev_txd_oth, EVCNT_TYPE_MISC, - NULL, device_xname(sc->sc_dev), "Tx unkonwn erorr counter"); + NULL, device_xname(sc->sc_dev), "Tx unknown error counter"); /* Status Registers */ evcnt_attach_dynamic(&sc->sc_ev.ev_reg_pdfc, EVCNT_TYPE_MISC, @@ -610,7 +610,7 @@ mvxpe_evcnt_attach(struct mvxpe_softc *s evcnt_attach_dynamic(&sc->sc_ev.ev_reg_txbadfcs, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "Tx bad FCS counter"); evcnt_attach_dynamic(&sc->sc_ev.ev_reg_txdropped, EVCNT_TYPE_MISC, - NULL, device_xname(sc->sc_dev), "Tx dorpped counter"); + NULL, device_xname(sc->sc_dev), "Tx dropped counter"); evcnt_attach_dynamic(&sc->sc_ev.ev_reg_lpic, EVCNT_TYPE_MISC, NULL, device_xname(sc->sc_dev), "LP_IDLE counter");
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Wed Apr 24 10:56:25 UTC 2019 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: This driver uses MII(4) and have hook SIOC[GS]IFMEDIA which just pass to ifmedia_ioctl(), the hook is not required because ether_ioctl has it (if_ethersubr.c rev. 1.160). This driver might require some additional fixes for SIOCSIFMTU and other ioctl()s. To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.22 src/sys/dev/marvell/if_mvxpe.c:1.23 --- src/sys/dev/marvell/if_mvxpe.c:1.22 Mon Mar 18 11:38:03 2019 +++ src/sys/dev/marvell/if_mvxpe.c Wed Apr 24 10:56:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.22 2019/03/18 11:38:03 msaitoh Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.23 2019/04/24 10:56:24 msaitoh Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.22 2019/03/18 11:38:03 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.23 2019/04/24 10:56:24 msaitoh Exp $"); #include "opt_multiprocessor.h" @@ -1727,18 +1727,9 @@ STATIC int mvxpe_ioctl(struct ifnet *ifp, u_long cmd, void *data) { struct mvxpe_softc *sc = ifp->if_softc; - struct ifreq *ifr = data; int error = 0; - int s; switch (cmd) { - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - DPRINTIFNET(ifp, 2, "mvxpe_ioctl MEDIA\n"); - s = splnet(); /* XXX: is there suitable mutex? */ - error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); - splx(s); - break; default: DPRINTIFNET(ifp, 2, "mvxpe_ioctl ETHER\n"); error = ether_ioctl(ifp, cmd, data);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: martin Date: Tue Dec 11 19:40:54 UTC 2018 Modified Files: src/sys/dev/marvell: com_mv.c Log Message: Remove stray ; to fix the build To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/com_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/com_mv.c diff -u src/sys/dev/marvell/com_mv.c:1.10 src/sys/dev/marvell/com_mv.c:1.11 --- src/sys/dev/marvell/com_mv.c:1.10 Tue Dec 11 06:34:00 2018 +++ src/sys/dev/marvell/com_mv.c Tue Dec 11 19:40:54 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $ */ +/* $NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $ */ /* * Copyright (c) 2007, 2010 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.10 2018/12/11 06:34:00 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com_mv.c,v 1.11 2018/12/11 19:40:54 martin Exp $"); #include #include @@ -55,7 +55,7 @@ CFATTACH_DECL_NEW(mvuart_mbus, sizeof(st static void mvuart_init_regs(struct com_regs *regs, bus_space_tag_t tag, - bus_space_handle_t hdl, bus_addr_t addr); + bus_space_handle_t hdl, bus_addr_t addr) { com_init_regs_stride(regs, tag, hdl, addr, 2);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: maxv Date: Mon May 7 09:41:10 UTC 2018 Modified Files: src/sys/dev/marvell: mvxpbm.c Log Message: Fix double-free, m_tag_delete_chain is already called by m_free. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpbm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvxpbm.c diff -u src/sys/dev/marvell/mvxpbm.c:1.1 src/sys/dev/marvell/mvxpbm.c:1.2 --- src/sys/dev/marvell/mvxpbm.c:1.1 Wed Jun 3 03:55:47 2015 +++ src/sys/dev/marvell/mvxpbm.c Mon May 7 09:41:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: mvxpbm.c,v 1.1 2015/06/03 03:55:47 hsuenaga Exp $ */ +/* $NetBSD: mvxpbm.c,v 1.2 2018/05/07 09:41:10 maxv Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: mvxpbm.c,v 1.1 2015/06/03 03:55:47 hsuenaga Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvxpbm.c,v 1.2 2018/05/07 09:41:10 maxv Exp $"); #include "opt_multiprocessor.h" @@ -322,8 +322,7 @@ mvxpbm_free_mbuf(struct mbuf *m, void *b KASSERT(arg != NULL); DPRINTFN(3, "free packet %p\n", m); - if (m->m_flags & M_PKTHDR) - m_tag_delete_chain((m), NULL); + chunk->m = NULL; s = splvm(); pool_cache_put(mb_cache, m);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Thu Nov 9 22:22:58 UTC 2017 Modified Files: src/sys/dev/marvell: mvxpsec.c Log Message: use PR_NOWAIT instead of 0 To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpsec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvxpsec.c diff -u src/sys/dev/marvell/mvxpsec.c:1.1 src/sys/dev/marvell/mvxpsec.c:1.2 --- src/sys/dev/marvell/mvxpsec.c:1.1 Wed Jun 3 00:20:02 2015 +++ src/sys/dev/marvell/mvxpsec.c Thu Nov 9 17:22:58 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mvxpsec.c,v 1.1 2015/06/03 04:20:02 hsuenaga Exp $ */ +/* $NetBSD: mvxpsec.c,v 1.2 2017/11/09 22:22:58 christos Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -1498,7 +1498,7 @@ mvxpsec_session_alloc(struct mvxpsec_sof { struct mvxpsec_session *mv_s; - mv_s = pool_cache_get(sc->sc_session_pool, 0); + mv_s = pool_cache_get(sc->sc_session_pool, PR_NOWAIT); if (mv_s == NULL) { log(LOG_ERR, "%s: cannot allocate memory\n", __func__); return NULL; @@ -1614,7 +1614,7 @@ mvxpsec_packet_alloc(struct mvxpsec_sess sc->sc_free_qlen--; } else { - mv_p = pool_cache_get(sc->sc_packet_pool, 0); + mv_p = pool_cache_get(sc->sc_packet_pool, PR_NOWAIT); if (mv_p == NULL) { log(LOG_ERR, "%s: cannot allocate memory\n", __func__);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: jakllsch Date: Fri Mar 3 16:52:08 UTC 2017 Modified Files: src/sys/dev/marvell: mvsdio.c Log Message: Add check during mvsdio_attach that CMD line is in idle state. If the CMD line is not in idle state, the interrupt handler routine will misbehave causing an endless interrupt handler loop. This would prevent the the kernel from getting to mountroot. On my Pogoplug POGO-V4-A3-01, this was caused by U-Boot routing com1's TX and RX signals to the SD card slot's CMD and DAT[0] lines respectively. We should probably grow Marvell SoC MPP (pinmux) configuration frobs. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvsdio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvsdio.c diff -u src/sys/dev/marvell/mvsdio.c:1.5 src/sys/dev/marvell/mvsdio.c:1.6 --- src/sys/dev/marvell/mvsdio.c:1.5 Sat Mar 15 13:33:48 2014 +++ src/sys/dev/marvell/mvsdio.c Fri Mar 3 16:52:08 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.6 2017/03/03 16:52:08 jakllsch Exp $"); #include "opt_mvsdio.h" @@ -157,6 +157,7 @@ mvsdio_attach(device_t parent, device_t struct marvell_attach_args *mva = aux; struct sdmmcbus_attach_args saa; uint32_t nis, eis; + uint32_t hps; aprint_naive("\n"); aprint_normal(": Marvell Secure Digital Input/Output Interface\n"); @@ -227,6 +228,13 @@ mvsdio_attach(device_t parent, device_t bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISE, eis); bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_EISIE, eis); + hps = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVSDIO_HPS16LSB); + if ((hps & HPS16LSB_CMDLEVEL) == 0) { + aprint_error_dev(sc->sc_dev, + "CMD line not idle, HPS 0x%x (bad MPP config?)\n", hps); + return; + } + /* * Attach the generic SD/MMC bus driver. (The bus driver must * not invoke any chipset functions before it is attached.)
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Mon Jan 9 14:06:35 UTC 2017 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: Add ATTR_AXI_DDR. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.10 src/sys/dev/marvell/marvellreg.h:1.11 --- src/sys/dev/marvell/marvellreg.h:1.10 Tue Oct 4 15:02:27 2016 +++ src/sys/dev/marvell/marvellreg.h Mon Jan 9 14:06:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.10 2016/10/04 15:02:27 kiyohara Exp $ */ +/* $NetBSD: marvellreg.h,v 1.11 2017/01/09 14:06:35 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -88,5 +88,6 @@ #define MARVELL_ATTR_SDRAM_CS2 0x0b #define MARVELL_ATTR_SDRAM_CS3 0x07 #endif +#define MARVELL_ATTR_AXI_DDR 0x00 #endif /* _DEV_MARVELL_MARVELLREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:44:26 UTC 2017 Modified Files: src/sys/dev/marvell: gtidmac.c Log Message: Support Marvell Dove. Use irq array. Dove's irqs not sequencial. And remove debug printf(). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/gtidmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmac.c diff -u src/sys/dev/marvell/gtidmac.c:1.12 src/sys/dev/marvell/gtidmac.c:1.13 --- src/sys/dev/marvell/gtidmac.c:1.12 Sat Jan 7 14:36:51 2017 +++ src/sys/dev/marvell/gtidmac.c Sat Jan 7 14:44:26 2017 @@ -1,6 +1,6 @@ -/* $NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $ */ +/* $NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $ */ /* - * Copyright (c) 2008, 2012 KIYOHARA Takashi + * Copyright (c) 2008, 2012, 2016 KIYOHARA Takashi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.13 2017/01/07 14:44:26 kiyohara Exp $"); #include #include @@ -276,24 +276,30 @@ static const struct dmover_algdesc mvxor }, }; +static int orion_88f5182_xore_irqs[] = { 30, 31 }; +static int kirkwood_xore_irqs[] = { 5, 6, 7, 8 }; +static int dove_xore_irqs[] = { 39, 40, 42, 43 }; +static int armadaxp_xore_irqs0[] = { 51, 52 }; +static int armadaxp_xore_irqs1[] = { 94, 95 }; + static struct { int model; int idmac_nchan; int idmac_irq; int xore_nchan; - int xore_irq; + int *xore_irqs; } channels[] = { /* * Marvell System Controllers: * need irqs in attach_args. */ - { MARVELL_DISCOVERY, 8, -1, 0, -1 }, - { MARVELL_DISCOVERY_II, 8, -1, 0, -1 }, - { MARVELL_DISCOVERY_III, 8, -1, 0, -1 }, + { MARVELL_DISCOVERY, 8, -1, 0, NULL }, + { MARVELL_DISCOVERY_II, 8, -1, 0, NULL }, + { MARVELL_DISCOVERY_III, 8, -1, 0, NULL }, #if 0 - { MARVELL_DISCOVERY_LT, 4, -1, 2, -1 }, - { MARVELL_DISCOVERY_V, 4, -1, 2, -1 }, - { MARVELL_DISCOVERY_VI, 4, -1, 2, -1 }, + { MARVELL_DISCOVERY_LT, 4, -1, 2, NULL }, + { MARVELL_DISCOVERY_V, 4, -1, 2, NULL }, + { MARVELL_DISCOVERY_VI, 4, -1, 2, NULL }, #endif /* @@ -301,28 +307,29 @@ static struct { * No need irqs in attach_args. We always connecting to interrupt-pin * statically. */ - { MARVELL_ORION_1_88F1181, 4, 24, 0, -1 }, - { MARVELL_ORION_2_88F1281, 4, 24, 0, -1 }, - { MARVELL_ORION_1_88F5082, 4, 24, 0, -1 }, - { MARVELL_ORION_1_88F5180N, 4, 24, 0, -1 }, - { MARVELL_ORION_1_88F5181, 4, 24, 0, -1 }, - { MARVELL_ORION_1_88F5182, 4, 24, 2, 30 }, - { MARVELL_ORION_2_88F5281, 4, 24, 0, -1 }, - { MARVELL_ORION_1_88W8660, 4, 24, 0, -1 }, - { MARVELL_KIRKWOOD_88F6180, 0, -1, 4, 5 }, - { MARVELL_KIRKWOOD_88F6192, 0, -1, 4, 5 }, - { MARVELL_KIRKWOOD_88F6281, 0, -1, 4, 5 }, - { MARVELL_KIRKWOOD_88F6282, 0, -1, 4, 5 }, - { MARVELL_ARMADAXP_MV78130, 4, 33, 2, 51 }, - { MARVELL_ARMADAXP_MV78130, 0, -1, 2, 94 }, - { MARVELL_ARMADAXP_MV78160, 4, 33, 2, 51 }, - { MARVELL_ARMADAXP_MV78160, 0, -1, 2, 94 }, - { MARVELL_ARMADAXP_MV78230, 4, 33, 2, 51 }, - { MARVELL_ARMADAXP_MV78230, 0, -1, 2, 94 }, - { MARVELL_ARMADAXP_MV78260, 4, 33, 2, 51 }, - { MARVELL_ARMADAXP_MV78260, 0, -1, 2, 94 }, - { MARVELL_ARMADAXP_MV78460, 4, 33, 2, 51 }, - { MARVELL_ARMADAXP_MV78460, 0, -1, 2, 94 }, + { MARVELL_ORION_1_88F1181, 4, 24, 0, NULL }, + { MARVELL_ORION_2_88F1281, 4, 24, 0, NULL }, + { MARVELL_ORION_1_88F5082, 4, 24, 0, NULL }, + { MARVELL_ORION_1_88F5180N, 4, 24, 0, NULL }, + { MARVELL_ORION_1_88F5181, 4, 24, 0, NULL }, + { MARVELL_ORION_1_88F5182, 4, 24, 2, orion_88f5182_xore_irqs }, + { MARVELL_ORION_2_88F5281, 4, 24, 0, NULL }, + { MARVELL_ORION_1_88W8660, 4, 24, 0, NULL }, + { MARVELL_KIRKWOOD_88F6180, 0, -1, 4, kirkwood_xore_irqs }, + { MARVELL_KIRKWOOD_88F6192, 0, -1, 4, kirkwood_xore_irqs }, + { MARVELL_KIRKWOOD_88F6281, 0, -1, 4, kirkwood_xore_irqs }, + { MARVELL_KIRKWOOD_88F6282, 0, -1, 4, kirkwood_xore_irqs }, + { MARVELL_DOVE_88AP510, 0, -1, 4, dove_xore_irqs }, + { MARVELL_ARMADAXP_MV78130, 4, 33, 2, armadaxp_xore_irqs0 }, + { MARVELL_ARMADAXP_MV78130, 0, -1, 2, armadaxp_xore_irqs1 }, + { MARVELL_ARMADAXP_MV78160, 4, 33, 2, armadaxp_xore_irqs0 }, + { MARVELL_ARMADAXP_MV78160, 0, -1, 2, armadaxp_xore_irqs1 }, + { MARVELL_ARMADAXP_MV78230, 4, 33, 2, armadaxp_xore_irqs0 }, + { MARVELL_ARMADAXP_MV78230, 0, -1, 2, armadaxp_xore_irqs1 }, + { MARVELL_ARMADAXP_MV78260, 4, 33, 2, armadaxp_xore_irqs0 }, + { MARVELL_ARMADAXP_MV78260, 0, -1, 2, armadaxp_xore_irqs1 }, + { MARVELL_ARMADAXP_MV78460, 4, 33, 2, armadaxp_xore_irqs0 }, + { MARVELL_ARMADAXP_MV78460, 0, -1, 2, armadaxp_xore_irqs1 }, }; struct gtidmac_winacctbl *gtidmac_winacctbl; @@ -364,7 +371,7 @@ gtidmac_attach(device_t parent, device_t struct gtidmac_softc *sc = devi
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:36:51 UTC 2017 Modified Files: src/sys/dev/marvell: gtidmac.c gtidmacvar.h Log Message: Remove unused function. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/gtidmac.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmac.c diff -u src/sys/dev/marvell/gtidmac.c:1.11 src/sys/dev/marvell/gtidmac.c:1.12 --- src/sys/dev/marvell/gtidmac.c:1.11 Sat Mar 15 13:33:48 2014 +++ src/sys/dev/marvell/gtidmac.c Sat Jan 7 14:36:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $ */ /* * Copyright (c) 2008, 2012 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.11 2014/03/15 13:33:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.12 2017/01/07 14:36:51 kiyohara Exp $"); #include #include @@ -926,13 +926,6 @@ gtidmac_dmmap_unload(struct gtidmac_soft } -void * -gtidmac_tag_get(void) -{ - - return gtidmac_softc; -} - /* * IDMAC functions */ Index: src/sys/dev/marvell/gtidmacvar.h diff -u src/sys/dev/marvell/gtidmacvar.h:1.2 src/sys/dev/marvell/gtidmacvar.h:1.3 --- src/sys/dev/marvell/gtidmacvar.h:1.2 Sat Mar 15 13:33:48 2014 +++ src/sys/dev/marvell/gtidmacvar.h Sat Jan 7 14:36:51 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gtidmacvar.h,v 1.2 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: gtidmacvar.h,v 1.3 2017/01/07 14:36:51 kiyohara Exp $ */ /* * Copyright (c) 2008, 2009 KIYOHARA Takashi * All rights reserved. @@ -48,8 +48,6 @@ struct gtidmac_winacctbl { extern struct gtidmac_winacctbl *gtidmac_winacctbl; extern struct gtidmac_winacctbl *mvxore_winacctbl; -void *gtidmac_tag_get(void); - int gtidmac_chan_alloc(void *, bus_dmamap_t **, bus_dmamap_t **, void *); void gtidmac_chan_free(void *, int); int gtidmac_setup(void *, int, int, bus_dmamap_t *, bus_dmamap_t *, bus_size_t);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:32:33 UTC 2017 Modified Files: src/sys/dev/marvell: gtidmacreg.h Log Message: Fix macro MVXORE_CHAN2BASE(). The XORE has 2 channels per port. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gtidmacreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmacreg.h diff -u src/sys/dev/marvell/gtidmacreg.h:1.3 src/sys/dev/marvell/gtidmacreg.h:1.4 --- src/sys/dev/marvell/gtidmacreg.h:1.3 Mon Jul 23 06:09:47 2012 +++ src/sys/dev/marvell/gtidmacreg.h Sat Jan 7 14:32:32 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gtidmacreg.h,v 1.3 2012/07/23 06:09:47 kiyohara Exp $ */ +/* $NetBSD: gtidmacreg.h,v 1.4 2017/01/07 14:32:32 kiyohara Exp $ */ /* * Copyright (c) 2008, 2009 KIYOHARA Takashi * All rights reserved. @@ -51,7 +51,7 @@ #define MVXORE_PORT2BASE(sc, p) \ (((sc)->sc_gtidmac_nchan == 0 && (p) == 0) ? -0x100 : 0x000) #define MVXORE_CHAN2BASE(sc, c) \ -(MVXORE_PORT2BASE(sc, (c) & 0x4) + (((c) & 0x3) << 2)) +(MVXORE_PORT2BASE(sc, (c) & 0xe) + (((c) & 0x1) << 2)) /* IDMA Descriptor Register Map */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:26:37 UTC 2017 Modified Files: src/sys/dev/marvell: marvellvar.h Log Message: Add tags for AXI_CS[01]. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellvar.h diff -u src/sys/dev/marvell/marvellvar.h:1.5 src/sys/dev/marvell/marvellvar.h:1.6 --- src/sys/dev/marvell/marvellvar.h:1.5 Sat Mar 15 11:47:43 2014 +++ src/sys/dev/marvell/marvellvar.h Sat Jan 7 14:26:37 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellvar.h,v 1.5 2014/03/15 11:47:43 kiyohara Exp $ */ +/* $NetBSD: marvellvar.h,v 1.6 2017/01/07 14:26:37 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -34,6 +34,9 @@ enum marvell_tags { MARVELL_TAG_SDRAM_CS2, MARVELL_TAG_SDRAM_CS3, + MARVELL_TAG_AXI_CS0, /* Advanced eXtensible Interface */ + MARVELL_TAG_AXI_CS1, /* Advanced eXtensible Interface */ + MARVELL_TAG_DDR3_CS0, MARVELL_TAG_DDR3_CS1, MARVELL_TAG_DDR3_CS2,
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:24:27 UTC 2017 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvsata_mv.c Log Message: Support Marvell Dove. To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvsata_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.47 src/sys/dev/marvell/if_mvgbe.c:1.48 --- src/sys/dev/marvell/if_mvgbe.c:1.47 Thu Dec 15 09:28:05 2016 +++ src/sys/dev/marvell/if_mvgbe.c Sat Jan 7 14:24:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.47 2016/12/15 09:28:05 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.48 2017/01/07 14:24:27 kiyohara Exp $"); #include "opt_multiprocessor.h" @@ -367,6 +367,8 @@ struct mvgbe_port { { MARVELL_MV78XX0_MV78200, 2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, { MARVELL_MV78XX0_MV78200, 3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_DOVE_88AP510, 0, 1, { 29 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_ARMADAXP_MV78130, 0, 1, { 66 }, FLAGS_HAS_PV }, { MARVELL_ARMADAXP_MV78130, 1, 1, { 70 }, FLAGS_HAS_PV }, { MARVELL_ARMADAXP_MV78130, 2, 1, { 74 }, FLAGS_HAS_PV }, Index: src/sys/dev/marvell/mvsata_mv.c diff -u src/sys/dev/marvell/mvsata_mv.c:1.7 src/sys/dev/marvell/mvsata_mv.c:1.8 --- src/sys/dev/marvell/mvsata_mv.c:1.7 Sat Mar 15 13:33:48 2014 +++ src/sys/dev/marvell/mvsata_mv.c Sat Jan 7 14:24:27 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.7 2014/03/15 13:33:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.8 2017/01/07 14:24:27 kiyohara Exp $"); #include #include @@ -99,6 +99,9 @@ struct mvsata_product mvsata_products[] { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 1, 2, gen2e, 0 }, { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 1, 2, gen2e, 0 }, + /* Dove */ + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88AP510, 1, 1, gen2e, 0 }, + /* Armada XP */ { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78130, 1, 2, gen2e, 0 }, { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78160, 1, 2, gen2e, 0 },
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jan 7 14:19:45 UTC 2017 Modified Files: src/sys/dev/marvell: mvspireg.h Log Message: Change MVSPI_SIZE to 0x80 instead of 0x50. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvspireg.h diff -u src/sys/dev/marvell/mvspireg.h:1.2 src/sys/dev/marvell/mvspireg.h:1.3 --- src/sys/dev/marvell/mvspireg.h:1.2 Mon May 13 15:47:18 2013 +++ src/sys/dev/marvell/mvspireg.h Sat Jan 7 14:19:45 2017 @@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI #ifndef _MVSPIREG_H_ #define _MVSPIREG_H_ -#define MVSPI_SIZE 0x50 /* Size of MVSPI */ +#define MVSPI_SIZE 0x80 /* Size of MVSPI */ /* Definition of registers */ #define MVSPI_CTRL_REG 0x00 /* MVSPI Control Register */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Mon Oct 10 14:23:35 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: The bus_dmamap_sync(PREREAD) is unnecessary for sent mbuf. Moreover bus_dmamap_sync(POSTWRITE), before unload. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.13 src/sys/dev/marvell/if_mvxpe.c:1.14 --- src/sys/dev/marvell/if_mvxpe.c:1.13 Fri Jun 10 13:27:14 2016 +++ src/sys/dev/marvell/if_mvxpe.c Mon Oct 10 14:23:35 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.13 2016/06/10 13:27:14 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.14 2016/10/10 14:23:35 kiyohara Exp $"); #include "opt_multiprocessor.h" @@ -1141,6 +1141,7 @@ mvxpe_ring_flush_queue(struct mvxpe_soft { struct mvxpe_rx_ring *rx = MVXPE_RX_RING(sc, q); struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q); + struct mbuf *m; int i; KASSERT_RX_MTX(sc, q); @@ -1157,11 +1158,15 @@ mvxpe_ring_flush_queue(struct mvxpe_soft /* Tx handle */ for (i = 0; i < MVXPE_TX_RING_CNT; i++) { - if (MVXPE_TX_MBUF(sc, q, i) == NULL) + m = MVXPE_TX_MBUF(sc, q, i); + if (m == NULL) continue; - bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i)); - m_freem(MVXPE_TX_MBUF(sc, q, i)); MVXPE_TX_MBUF(sc, q, i) = NULL; + bus_dmamap_sync(sc->sc_dmat, + MVXPE_TX_MAP(sc, q, i), 0, m->m_pkthdr.len, + BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, i)); + m_freem(m); } tx->tx_dma = tx->tx_cpu = 0; tx->tx_used = 0; @@ -2141,7 +2146,7 @@ mvxpe_tx_queue(struct mvxpe_softc *sc, s MVXPE_TX_MBUF(sc, q, tx->tx_cpu) = m; bus_dmamap_sync(sc->sc_dmat, MVXPE_TX_MAP(sc, q, tx->tx_cpu), 0, m->m_pkthdr.len, - BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREWRITE); /* load to tx descriptors */ start = tx->tx_cpu; @@ -2302,6 +2307,7 @@ mvxpe_tx_queue_complete(struct mvxpe_sof { struct mvxpe_tx_ring *tx = MVXPE_TX_RING(sc, q); struct mvxpe_tx_desc *t; + struct mbuf *m; uint32_t ptxs, ptxsu, ndesc; int i; @@ -2342,12 +2348,16 @@ mvxpe_tx_queue_complete(struct mvxpe_sof } error = 1; } - if (MVXPE_TX_MBUF(sc, q, tx->tx_dma) != NULL) { + m = MVXPE_TX_MBUF(sc, q, tx->tx_dma); + if (m != NULL) { KASSERT((t->command & MVXPE_TX_CMD_F) != 0); + MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL; + bus_dmamap_sync(sc->sc_dmat, + MVXPE_TX_MAP(sc, q, tx->tx_dma), 0, m->m_pkthdr.len, + BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_dmat, MVXPE_TX_MAP(sc, q, tx->tx_dma)); - m_freem(MVXPE_TX_MBUF(sc, q, tx->tx_dma)); - MVXPE_TX_MBUF(sc, q, tx->tx_dma) = NULL; + m_freem(m); sc->sc_tx_pending--; } else
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Oct 9 14:50:54 UTC 2016 Modified Files: src/sys/dev/marvell: gt.c Log Message: PR/51540: Henning Petersen: replace , with ; To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/marvell/gt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gt.c diff -u src/sys/dev/marvell/gt.c:1.27 src/sys/dev/marvell/gt.c:1.28 --- src/sys/dev/marvell/gt.c:1.27 Sat Jul 11 06:32:46 2015 +++ src/sys/dev/marvell/gt.c Sun Oct 9 10:50:54 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: gt.c,v 1.27 2015/07/11 10:32:46 kamil Exp $ */ +/* $NetBSD: gt.c,v 1.28 2016/10/09 14:50:54 christos Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.27 2015/07/11 10:32:46 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gt.c,v 1.28 2016/10/09 14:50:54 christos Exp $"); #include "opt_marvell.h" #include "gtmpsc.h" @@ -807,7 +807,7 @@ gt_watchdog_init(struct gt_softc *gt) gt_write(gt, GT_WDOG_Config, GT_WDOG_Config_Ctl1a|GT_WDOG_Preset_DFLT); gt_write(gt, GT_WDOG_Config, GT_WDOG_Config_Ctl1b|GT_WDOG_Preset_DFLT); - r = gt_read(gt, GT_WDOG_Config), + r = gt_read(gt, GT_WDOG_Config); aprint_normal(" status %#x,%#x: %s\n", r, gt_read(gt, GT_WDOG_Value), ((r & GT_WDOG_Config_Enb) != 0) ? "enabled" : "botch");
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Oct 9 14:49:51 UTC 2016 Modified Files: src/sys/dev/marvell: mvspi.c Log Message: PR/51540: Henning Petersen: replace , with ; To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvspi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvspi.c diff -u src/sys/dev/marvell/mvspi.c:1.3 src/sys/dev/marvell/mvspi.c:1.4 --- src/sys/dev/marvell/mvspi.c:1.3 Sun Dec 13 13:35:26 2015 +++ src/sys/dev/marvell/mvspi.c Sun Oct 9 10:49:51 2016 @@ -130,7 +130,7 @@ mvspi_attach(struct device *parent, stru ctl &= MVSPI_DIRHS_MASK; ctl &= MVSPI_1BYTE_MASK; - PUTREG(sc, MVSPI_INTCONF_REG, ctl), + PUTREG(sc, MVSPI_INTCONF_REG, ctl); /* * Initialize SPI controller.
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Tue Oct 4 15:02:27 UTC 2016 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: Add 88AP510. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.9 src/sys/dev/marvell/marvellreg.h:1.10 --- src/sys/dev/marvell/marvellreg.h:1.9 Wed Jun 3 04:00:06 2015 +++ src/sys/dev/marvell/marvellreg.h Tue Oct 4 15:02:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.9 2015/06/03 04:00:06 hsuenaga Exp $ */ +/* $NetBSD: marvellreg.h,v 1.10 2016/10/04 15:02:27 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -59,6 +59,8 @@ #define MARVELL_MV78XX0_MV78100 PCI_PRODUCT_MARVELL_MV78100 #define MARVELL_MV78XX0_MV78200 PCI_PRODUCT_MARVELL_MV78200 +#define MARVELL_DOVE_88AP510 PCI_PRODUCT_MARVELL_88AP510 + #define MARVELL_ARMADAXP_MV78130 PCI_PRODUCT_MARVELL_MV78130 #define MARVELL_ARMADAXP_MV78160 PCI_PRODUCT_MARVELL_MV78160 #define MARVELL_ARMADAXP_MV78230 PCI_PRODUCT_MARVELL_MV78230
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 08:44:22 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Pass all unicast addresses if it is promisc mode. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.43 src/sys/dev/marvell/if_mvgbe.c:1.44 --- src/sys/dev/marvell/if_mvgbe.c:1.43 Tue Feb 9 12:53:17 2016 +++ src/sys/dev/marvell/if_mvgbe.c Sat Feb 13 08:44:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.44 2016/02/13 08:44:22 hikaru Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.44 2016/02/13 08:44:22 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -2238,8 +2238,19 @@ set: MVGBE_WRITE(sc, MVGBE_PXC, pxc); /* Set Destination Address Filter Unicast Table */ - i = sc->sc_enaddr[5] & 0xf; /* last nibble */ - dfut[i>>2] = MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS); + if (ifp->if_flags & IFF_PROMISC) { + /* pass all unicast addresses */ + for (i = 0; i < MVGBE_NDFUT; i++) { + dfut[i] = + MVGBE_DF(0, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) | + MVGBE_DF(1, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) | + MVGBE_DF(2, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS) | + MVGBE_DF(3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS); + } + } else { + i = sc->sc_enaddr[5] & 0xf; /* last nibble */ + dfut[i>>2] = MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS); + } MVGBE_WRITE_FILTER(sc, MVGBE_DFUT, dfut, MVGBE_NDFUT); /* Set Destination Address Filter Multicast Tables */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 08:05:07 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c if_mvxpevar.h Log Message: Make all packets are enqueued into queue 0. queue 7 is not default, it is caused by the filter tables. The fields are including queue number, not bitfields. So MVXPE_DF_QUEUE_ALL (b111) means queue 7. And also, pass all unicast addresses if it is promisc mode. MVXPE_PXC_UPM is working in almost cases, but this change is needed for some cases; bridging frames through inter units, using products have consecutive MAC addresses. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/if_mvxpe.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.11 src/sys/dev/marvell/if_mvxpe.c:1.12 --- src/sys/dev/marvell/if_mvxpe.c:1.11 Sat Feb 13 06:44:22 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 08:05:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.12 2016/02/13 08:05:06 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -924,6 +924,13 @@ mvxpe_initreg(struct ifnet *ifp) /* Port MAC Control set 4 is not used */ + /* Port Configuration */ + /* Use queue 0 only */ + reg = MVXPE_READ(sc, MVXPE_PXC); + reg &= ~(MVXPE_PXC_RXQ_MASK | MVXPE_PXC_RXQARP_MASK | + MVXPE_PXC_TCPQ_MASK | MVXPE_PXC_UDPQ_MASK | MVXPE_PXC_BPDUQ_MASK); + MVXPE_WRITE(sc, MVXPE_PXC, reg); + /* Port Configuration Extended: enable Tx CRC generation */ reg = MVXPE_READ(sc, MVXPE_PXCX); reg &= ~MVXPE_PXCX_TXCRCDIS; @@ -2717,11 +2724,11 @@ mvxpe_filter_setup(struct mvxpe_softc *s if (memcmp(enm->enm_addrlo, special, 5) == 0) { i = enm->enm_addrlo[5]; dfsmt[i>>2] |= - MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS); + MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS); } else { i = mvxpe_crc8(enm->enm_addrlo, ETHER_ADDR_LEN); dfomt[i>>2] |= - MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS); + MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS); } ETHER_NEXT_MULTI(step, enm); @@ -2732,10 +2739,10 @@ allmulti: if (ifp->if_flags & (IFF_ALLMULTI|IFF_PROMISC)) { for (i = 0; i < MVXPE_NDFSMT; i++) { dfsmt[i] = dfomt[i] = - MVXPE_DF(0, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) | - MVXPE_DF(1, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) | - MVXPE_DF(2, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS) | - MVXPE_DF(3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS); + MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS); } } @@ -2752,8 +2759,20 @@ set: MVXPE_WRITE(sc, MVXPE_PXC, pxc); /* Set Destination Address Filter Unicast Table */ - i = sc->sc_enaddr[5] & 0xf; /* last nibble */ - dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE_ALL | MVXPE_DF_PASS); + if (ifp->if_flags & IFF_PROMISC) { + /* pass all unicast addresses */ + for (i = 0; i < MVXPE_NDFUT; i++) { + dfut[i] = + MVXPE_DF(0, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(1, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(2, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS) | + MVXPE_DF(3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS); + } + } + else { + i = sc->sc_enaddr[5] & 0xf; /* last nibble */ + dfut[i>>2] = MVXPE_DF(i&3, MVXPE_DF_QUEUE(0) | MVXPE_DF_PASS); + } MVXPE_WRITE_REGION(sc, MVXPE_DFUT(0), dfut, MVXPE_NDFUT); /* Set Destination Address Filter Multicast Tables */ Index: src/sys/dev/marvell/if_mvxpevar.h diff -u src/sys/dev/marvell/if_mvxpevar.h:1.2 src/sys/dev/marvell/if_mvxpevar.h:1.3 --- src/sys/dev/marvell/if_mvxpevar.h:1.2 Wed Jun 3 03:55:47 2015 +++ src/sys/dev/marvell/if_mvxpevar.h Sat Feb 13 08:05:06 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpevar.h,v 1.2 2015/06/03 03:55:47 hsuenaga Exp $ */ +/* $NetBSD: if_mvxpevar.h,v 1.3 2016/02/13 08:05:06 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -40,18 +40,17 @@ * Default limit of queue length * * queue 0 is lowest priority and queue 7 is highest priority. - * IP packet is received on queue 7 by default. * * XXX: packet classifier is not implement yet */ -#define MVXPE_RX_QUEUE_LIMIT_0 8 +#define MVXPE_RX_QUEUE_LIMIT_0 IFQ_MAXLEN #define MVXPE_RX_QUEUE_LIMIT_1 8 #define MVXPE_RX_QUEUE_LIMIT_2 8 #define MVXPE_RX_QUE
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 06:44:22 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Fix typo in sysctls. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.10 src/sys/dev/marvell/if_mvxpe.c:1.11 --- src/sys/dev/marvell/if_mvxpe.c:1.10 Sat Feb 13 06:33:21 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 06:44:22 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.11 2016/02/13 06:44:22 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -3058,7 +3058,7 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc /* hw.mvxpe.debug */ if (sysctl_createv(&sc->sc_mvxpe_clog, 0, NULL, &node, CTLFLAG_READWRITE, CTLTYPE_INT, "debug", - SYSCTL_DESCR("mvgbe device driver debug control"), + SYSCTL_DESCR("mvxpe device driver debug control"), NULL, 0, &mvxpe_debug, 0, CTL_HW, mvxpe_root_num, CTL_CREATE, CTL_EOL) != 0) { aprint_normal_dev(sc->sc_dev, "couldn't create sysctl node\n"); @@ -3101,10 +3101,10 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc #ifdef SYSCTL_INCLUDE_DESCR #define MVXPE_SYSCTL_DESCR(num) "configuration parameters for queue " # num static const char *sysctl_queue_descrs[] = { - MVXPE_SYSCTL_DESC(0), MVXPE_SYSCTL_DESC(1), - MVXPE_SYSCTL_DESC(2), MVXPE_SYSCTL_DESC(3), - MVXPE_SYSCTL_DESC(4), MVXPE_SYSCTL_DESC(5), - MVXPE_SYSCTL_DESC(6), MVXPE_SYSCTL_DESC(7), + MVXPE_SYSCTL_DESCR(0), MVXPE_SYSCTL_DESCR(1), + MVXPE_SYSCTL_DESCR(2), MVXPE_SYSCTL_DESCR(3), + MVXPE_SYSCTL_DESCR(4), MVXPE_SYSCTL_DESCR(5), + MVXPE_SYSCTL_DESCR(6), MVXPE_SYSCTL_DESCR(7), }; #undef MVXPE_SYSCTL_DESCR #endif /* SYSCTL_INCLUDE_DESCR */ @@ -3181,7 +3181,7 @@ sysctl_mvxpe_init(struct mvxpe_softc *sc /* hw.mvxpe.mvxpe[unit].clear_mib */ if (sysctl_createv(&sc->sc_mvxpe_clog, 0, NULL, &node, CTLFLAG_READWRITE, CTLTYPE_INT, "clear_mib", - SYSCTL_DESCR("mvgbe device driver debug control"), + SYSCTL_DESCR("mvxpe device driver debug control"), sysctl_clear_mib, 0, (void *)sc, 0, CTL_HW, mvxpe_root_num, mvxpe_nodenum, CTL_CREATE, CTL_EOL) != 0) {
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 06:33:21 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c if_mvxpereg.h Log Message: Count up if_{opackets,oerrors,ierrors,collisions}. And also "MAC Transmit Error" is tx error, not rx. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/if_mvxpe.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/if_mvxpereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.9 src/sys/dev/marvell/if_mvxpe.c:1.10 --- src/sys/dev/marvell/if_mvxpe.c:1.9 Sat Feb 13 06:12:46 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 06:33:21 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.10 2016/02/13 06:33:21 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -189,67 +189,71 @@ STATIC struct mvxpe_mib_def { int reg64; const char *sysctl_name; const char *desc; + int ext; +#define MVXPE_MIBEXT_IF_OERRORS 1 +#define MVXPE_MIBEXT_IF_IERRORS 2 +#define MVXPE_MIBEXT_IF_COLLISIONS 3 } mvxpe_mib_list[] = { {MVXPE_MIB_RX_GOOD_OCT, 1, "rx_good_oct", - "Good Octets Rx"}, + "Good Octets Rx", 0}, {MVXPE_MIB_RX_BAD_OCT, 0, "rx_bad_oct", - "Bad Octets Rx"}, - {MVXPE_MIB_RX_MAC_TRNS_ERR, 0, "rx_mac_err", - "MAC Transmit Error"}, + "Bad Octets Rx", 0}, + {MVXPE_MIB_TX_MAC_TRNS_ERR, 0, "tx_mac_err", + "MAC Transmit Error", MVXPE_MIBEXT_IF_OERRORS}, {MVXPE_MIB_RX_GOOD_FRAME, 0, "rx_good_frame", - "Good Frames Rx"}, + "Good Frames Rx", 0}, {MVXPE_MIB_RX_BAD_FRAME, 0, "rx_bad_frame", - "Bad Frames Rx"}, + "Bad Frames Rx", 0}, {MVXPE_MIB_RX_BCAST_FRAME, 0, "rx_bcast_frame", - "Broadcast Frames Rx"}, + "Broadcast Frames Rx", 0}, {MVXPE_MIB_RX_MCAST_FRAME, 0, "rx_mcast_frame", - "Multicast Frames Rx"}, + "Multicast Frames Rx", 0}, {MVXPE_MIB_RX_FRAME64_OCT, 0, "rx_frame_1_64", - "Frame Size1 - 64"}, + "Frame Size1 - 64", 0}, {MVXPE_MIB_RX_FRAME127_OCT, 0, "rx_frame_65_127", - "Frame Size 65 - 127"}, + "Frame Size 65 - 127", 0}, {MVXPE_MIB_RX_FRAME255_OCT, 0, "rx_frame_128_255", - "Frame Size 128 - 255"}, + "Frame Size 128 - 255", 0}, {MVXPE_MIB_RX_FRAME511_OCT, 0, "rx_frame_256_511", "Frame Size 256 - 511"}, {MVXPE_MIB_RX_FRAME1023_OCT, 0, "rx_frame_512_1023", - "Frame Size 512 - 1023"}, + "Frame Size 512 - 1023", 0}, {MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_fame_1024_max", - "Frame Size 1024 - Max"}, + "Frame Size 1024 - Max", 0}, {MVXPE_MIB_TX_GOOD_OCT, 1, "tx_good_oct", - "Good Octets Tx"}, + "Good Octets Tx", 0}, {MVXPE_MIB_TX_GOOD_FRAME, 0, "tx_good_frame", - "Good Frames Tx"}, + "Good Frames Tx", 0}, {MVXPE_MIB_TX_EXCES_COL, 0, "tx_exces_collision", - "Excessive Collision"}, + "Excessive Collision", MVXPE_MIBEXT_IF_OERRORS}, {MVXPE_MIB_TX_MCAST_FRAME, 0, "tx_mcast_frame", "Multicast Frames Tx"}, {MVXPE_MIB_TX_BCAST_FRAME, 0, "tx_bcast_frame", "Broadcast Frames Tx"}, {MVXPE_MIB_TX_MAC_CTL_ERR, 0, "tx_mac_err", - "Unknown MAC Control"}, + "Unknown MAC Control", 0}, {MVXPE_MIB_FC_SENT, 0, "fc_tx", - "Flow Control Tx"}, + "Flow Control Tx", 0}, {MVXPE_MIB_FC_GOOD, 0, "fc_rx_good", - "Good Flow Control Rx"}, + "Good Flow Control Rx", 0}, {MVXPE_MIB_FC_BAD, 0, "fc_rx_bad", - "Bad Flow Control Rx"}, + "Bad Flow Control Rx", 0}, {MVXPE_MIB_PKT_UNDERSIZE, 0, "pkt_undersize", - "Undersized Packets Rx"}, + "Undersized Packets Rx", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_PKT_FRAGMENT, 0, "pkt_fragment", - "Fragmented Packets Rx"}, + "Fragmented Packets Rx", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_PKT_OVERSIZE, 0, "pkt_oversize", - "Oversized Packets Rx"}, + "Oversized Packets Rx", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_PKT_JABBER, 0, "pkt_jabber", - "Jabber Packets Rx"}, + "Jabber Packets Rx", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_MAC_RX_ERR, 0, "mac_rx_err", - "MAC Rx Errors"}, + "MAC Rx Errors", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_MAC_CRC_ERR, 0, "mac_crc_err", - "MAC CRC Errors"}, + "MAC CRC Errors", MVXPE_MIBEXT_IF_IERRORS}, {MVXPE_MIB_MAC_COL, 0, "mac_collision", - "MAC Collision"}, + "MAC Collision", MVXPE_MIBEXT_IF_COLLISIONS}, {MVXPE_MIB_MAC_LATE_COL, 0, "mac_late_collision", - "MAC Late Collision"}, + "MAC Late Collision", MVXPE_MIBEXT_IF_OERRORS}, }; /* @@ -1690,6 +1694,7 @@ mvxpe_start
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 06:12:46 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Style. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.8 src/sys/dev/marvell/if_mvxpe.c:1.9 --- src/sys/dev/marvell/if_mvxpe.c:1.8 Sat Feb 13 06:02:31 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 06:12:46 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.9 2016/02/13 06:12:46 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -2622,7 +2622,7 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp, if (r->status & MVXPE_RX_L3_IP) { csum_flags |= M_CSUM_IPv4 & ifp->if_csum_flags_rx; if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0 && - (csum_flags & M_CSUM_IPv4)) { + (csum_flags & M_CSUM_IPv4) != 0) { csum_flags |= M_CSUM_IPv4_BAD; goto finish; } @@ -2654,7 +2654,7 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp, break; } if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0 && (csum_flags & - (M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6))) + (M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6)) != 0) csum_flags |= M_CSUM_TCP_UDP_BAD; finish: m0->m_pkthdr.csum_flags = csum_flags;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 06:02:31 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Preserve rx csum bad flags. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.7 src/sys/dev/marvell/if_mvxpe.c:1.8 --- src/sys/dev/marvell/if_mvxpe.c:1.7 Sat Feb 13 05:47:38 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 06:02:31 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.8 2016/02/13 06:02:31 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -2620,8 +2620,9 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp, /* L3 */ if (r->status & MVXPE_RX_L3_IP) { - csum_flags |= M_CSUM_IPv4; - if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0) { + csum_flags |= M_CSUM_IPv4 & ifp->if_csum_flags_rx; + if ((r->status & MVXPE_RX_IP_HEADER_OK) == 0 && + (csum_flags & M_CSUM_IPv4)) { csum_flags |= M_CSUM_IPv4_BAD; goto finish; } @@ -2638,26 +2639,25 @@ mvxpe_rx_set_csumflag(struct ifnet *ifp, switch (r->status & MVXPE_RX_L4_MASK) { case MVXPE_RX_L4_TCP: if (r->status & MVXPE_RX_L3_IP) - csum_flags |= M_CSUM_TCPv4; + csum_flags |= M_CSUM_TCPv4 & ifp->if_csum_flags_rx; else - csum_flags |= M_CSUM_TCPv6; - if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0) - csum_flags |= M_CSUM_TCP_UDP_BAD; + csum_flags |= M_CSUM_TCPv6 & ifp->if_csum_flags_rx; break; case MVXPE_RX_L4_UDP: if (r->status & MVXPE_RX_L3_IP) - csum_flags |= M_CSUM_UDPv4; + csum_flags |= M_CSUM_UDPv4 & ifp->if_csum_flags_rx; else - csum_flags |= M_CSUM_UDPv6; - if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0) - csum_flags |= M_CSUM_TCP_UDP_BAD; + csum_flags |= M_CSUM_UDPv6 & ifp->if_csum_flags_rx; break; case MVXPE_RX_L4_OTH: default: break; } + if ((r->status & MVXPE_RX_L4_CHECKSUM_OK) == 0 && (csum_flags & + (M_CSUM_TCPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv4 | M_CSUM_UDPv6))) + csum_flags |= M_CSUM_TCP_UDP_BAD; finish: - m0->m_pkthdr.csum_flags |= (csum_flags & ifp->if_csum_flags_rx); + m0->m_pkthdr.csum_flags = csum_flags; } /*
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 05:47:39 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Fix mitake, disable SERDES error interrupts again. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.6 src/sys/dev/marvell/if_mvxpe.c:1.7 --- src/sys/dev/marvell/if_mvxpe.c:1.6 Sat Feb 13 05:44:01 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 05:47:38 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.7 2016/02/13 05:47:38 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -1378,8 +1378,6 @@ mvxpe_enable_intr(struct mvxpe_softc *sc reg |= MVXPE_PMI_RXCRCERROR; reg |= MVXPE_PMI_RXLARGEPACKET; reg |= MVXPE_PMI_TXUNDRN; - reg |= MVXPE_PMI_PRBSERROR; - reg |= MVXPE_PMI_SRSE; #if 0 /* * The device may raise false interrupts for SERDES even if the device
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 05:44:01 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Don't use RXTX intr that is excess and requires another IRQ handler, and disable SERDES error interrupts. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.5 src/sys/dev/marvell/if_mvxpe.c:1.6 --- src/sys/dev/marvell/if_mvxpe.c:1.5 Sat Feb 13 05:21:11 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 05:44:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.6 2016/02/13 05:44:01 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -1277,11 +1277,6 @@ mvxpe_rx_queue_enable(struct ifnet *ifp, reg = MVXPE_PRXITTH_RITT(rx->rx_queue_th_time); MVXPE_WRITE(sc, MVXPE_PRXITTH(q), reg); - /* Unmask RXTX Intr. */ - reg = MVXPE_READ(sc, MVXPE_PRXTXIM); - reg |= MVXPE_PRXTXI_RREQ(q); /* Rx resource error */ - MVXPE_WRITE(sc, MVXPE_PRXTXIM, reg); - /* Unmask RXTX_TH Intr. */ reg = MVXPE_READ(sc, MVXPE_PRXTXTIM); reg |= MVXPE_PRXTXTI_RBICTAPQ(q); /* Rx Buffer Interrupt Coalese */ @@ -1385,14 +1380,20 @@ mvxpe_enable_intr(struct mvxpe_softc *sc reg |= MVXPE_PMI_TXUNDRN; reg |= MVXPE_PMI_PRBSERROR; reg |= MVXPE_PMI_SRSE; +#if 0 + /* + * The device may raise false interrupts for SERDES even if the device + * is not configured to use SERDES connection. + */ + reg |= MVXPE_PMI_PRBSERROR; + reg |= MVXPE_PMI_SRSE; +#else + reg &= ~MVXPE_PMI_PRBSERROR; + reg &= ~MVXPE_PMI_SRSE; +#endif reg |= MVXPE_PMI_TREQ_MASK; MVXPE_WRITE(sc, MVXPE_PMIM, reg); - /* Enable RXTX Intr. (via RXTX_TH Summary bit) */ - reg = MVXPE_READ(sc, MVXPE_PRXTXIM); - reg |= MVXPE_PRXTXI_RREQ_MASK; /* Rx resource error */ - MVXPE_WRITE(sc, MVXPE_PRXTXIM, reg); - /* Enable Summary Bit to check all interrupt cause. */ reg = MVXPE_READ(sc, MVXPE_PRXTXTIM); reg |= MVXPE_PRXTXTI_PMISCICSUMMARY;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 05:21:11 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Correct bus_dmamap_sync operaion. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.4 src/sys/dev/marvell/if_mvxpe.c:1.5 --- src/sys/dev/marvell/if_mvxpe.c:1.4 Sat Feb 13 03:33:02 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 05:21:11 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.5 2016/02/13 05:21:11 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -2130,7 +2130,7 @@ mvxpe_tx_queue(struct mvxpe_softc *sc, s MVXPE_TX_MBUF(sc, q, tx->tx_cpu) = m; bus_dmamap_sync(sc->sc_dmat, MVXPE_TX_MAP(sc, q, tx->tx_cpu), 0, m->m_pkthdr.len, - BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREWRITE); + BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); /* load to tx descriptors */ start = tx->tx_cpu;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Sat Feb 13 03:33:02 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: Correct locks and missing breaks. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/if_mvxpe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.3 src/sys/dev/marvell/if_mvxpe.c:1.4 --- src/sys/dev/marvell/if_mvxpe.c:1.3 Tue Feb 9 08:32:11 2016 +++ src/sys/dev/marvell/if_mvxpe.c Sat Feb 13 03:33:02 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.3 2016/02/09 08:32:11 ozaki-r Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.3 2016/02/09 08:32:11 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.4 2016/02/13 03:33:02 hikaru Exp $"); #include "opt_multiprocessor.h" @@ -850,7 +850,6 @@ mvxpe_initreg(struct ifnet *ifp) aprint_error_ifnet(ifp, "initialization failed: cannot initialize queue\n"); mvxpe_rx_unlockq(sc, q); - mvxpe_tx_unlockq(sc, q); return ENOBUFS; } mvxpe_rx_unlockq(sc, q); @@ -859,7 +858,6 @@ mvxpe_initreg(struct ifnet *ifp) if (mvxpe_tx_queue_init(ifp, q) != 0) { aprint_error_ifnet(ifp, "initialization failed: cannot initialize queue\n"); - mvxpe_rx_unlockq(sc, q); mvxpe_tx_unlockq(sc, q); return ENOBUFS; } @@ -1421,8 +1419,10 @@ mvxpe_rxtxth_intr(void *arg) mvxpe_sc_lock(sc); ic = MVXPE_READ(sc, MVXPE_PRXTXTIC); - if (ic == 0) + if (ic == 0) { + mvxpe_sc_unlock(sc); return 0; + } MVXPE_WRITE(sc, MVXPE_PRXTXTIC, ~ic); datum = datum ^ ic; @@ -1441,8 +1441,10 @@ mvxpe_rxtxth_intr(void *arg) DPRINTIFNET(ifp, 2, "PTXTXTIC: +PRXTXICSUMMARY\n"); mvxpe_rxtx_intr(sc); } - if (!(ifp->if_flags & IFF_RUNNING)) + if (!(ifp->if_flags & IFF_RUNNING)) { + mvxpe_sc_unlock(sc); return 1; + } /* RxTxTH interrupt */ queues = MVXPE_PRXTXTI_GET_RBICTAPQ(ic); @@ -2316,12 +2318,16 @@ mvxpe_tx_queue_complete(struct mvxpe_sof switch (t->flags & MVXPE_TX_F_EC_MASK) { case MVXPE_TX_F_EC_LC: MVXPE_EVCNT_INCR(&sc->sc_ev.ev_txd_lc); +break; case MVXPE_TX_F_EC_UR: MVXPE_EVCNT_INCR(&sc->sc_ev.ev_txd_ur); +break; case MVXPE_TX_F_EC_RL: MVXPE_EVCNT_INCR(&sc->sc_ev.ev_txd_rl); +break; default: MVXPE_EVCNT_INCR(&sc->sc_ev.ev_txd_oth); +break; } error = 1; }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hikaru Date: Fri Feb 12 09:24:15 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvxpereg.h Log Message: Fix the bitmask of MVXPE_PMACC0_FRAMESIZELIMIT. It did no harm. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/if_mvxpereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvxpereg.h diff -u src/sys/dev/marvell/if_mvxpereg.h:1.2 src/sys/dev/marvell/if_mvxpereg.h:1.3 --- src/sys/dev/marvell/if_mvxpereg.h:1.2 Wed Jun 3 03:55:47 2015 +++ src/sys/dev/marvell/if_mvxpereg.h Fri Feb 12 09:24:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpereg.h,v 1.2 2015/06/03 03:55:47 hsuenaga Exp $ */ +/* $NetBSD: if_mvxpereg.h,v 1.3 2016/02/12 09:24:15 hikaru Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -608,7 +608,7 @@ /* Port MAC Control 0 (MVXPE_PMACC0) */ #define MVXPE_PMACC0_PORTEN (1 << 0) #define MVXPE_PMACC0_PORTTYPE (1 << 1) -#define MVXPE_PMACC0_FRAMESIZELIMIT(x) x) >> 1) & 0x7ffc) << 2) +#define MVXPE_PMACC0_FRAMESIZELIMIT(x) x) >> 1) & 0x1fff) << 2) #define MVXPE_PMACC0_MUSTSET (1 << 15) /* Port MAC Control 1 (MVXPE_PMACC1) */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Tue Feb 9 12:53:17 UTC 2016 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add more #warning message 'Please use mvxpe instead of this'. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.42 src/sys/dev/marvell/if_mvgbe.c:1.43 --- src/sys/dev/marvell/if_mvgbe.c:1.42 Tue Feb 9 08:32:11 2016 +++ src/sys/dev/marvell/if_mvgbe.c Tue Feb 9 12:53:17 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.42 2016/02/09 08:32:11 ozaki-r Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,12 +25,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.42 2016/02/09 08:32:11 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.43 2016/02/09 12:53:17 kiyohara Exp $"); #include "opt_multiprocessor.h" #if defined MULTIPROCESSOR -#warning Queue Management Method 'Counters' not support yet +#warning Queue Management Method 'Counters' not support. Please use mvxpe instead of this. #endif #include
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: joerg Date: Fri Jan 15 12:09:15 UTC 2016 Modified Files: src/sys/dev/marvell: gtbrgreg.h gtmpscreg.h gtsdmareg.h Log Message: Switch to generic __BIT/__BITS macro, which doesn't depend on left-shifting negative values. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtbrgreg.h cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/gtmpscreg.h cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/gtsdmareg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtbrgreg.h diff -u src/sys/dev/marvell/gtbrgreg.h:1.2 src/sys/dev/marvell/gtbrgreg.h:1.3 --- src/sys/dev/marvell/gtbrgreg.h:1.2 Wed Apr 28 13:51:56 2010 +++ src/sys/dev/marvell/gtbrgreg.h Fri Jan 15 12:09:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: gtbrgreg.h,v 1.2 2010/04/28 13:51:56 kiyohara Exp $ */ +/* $NetBSD: gtbrgreg.h,v 1.3 2016/01/15 12:09:15 joerg Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -46,13 +46,6 @@ #ifndef _GTBRGREG_H #define _GTBRGREG_H -#ifndef BIT -#define BIT(bitno) (1U << (bitno)) -#endif -#ifndef BITS -#define BITS(hi, lo)((~((~0) << ((hi) + 1))) & ((~0) << (lo))) -#endif - #define GTBRG_NCHAN 3 /* Number of MPSC channels */ /*** @@ -71,10 +64,10 @@ /* * BRG Configuration Register bits */ -#define BRG_BCR_CDV BITS(15,0) /* Count Down Value */ -#define BRG_BCR_EN BIT(16) /* Enable BRG */ -#define BRG_BCR_RST BIT(17) /* Reset BRG */ -#define BRG_BCR_CLKS_MASK BITS(22,18) /* Clock Source */ +#define BRG_BCR_CDV __BITS(15,0) /* Count Down Value */ +#define BRG_BCR_EN __BIT(16) /* Enable BRG */ +#define BRG_BCR_RST __BIT(17) /* Reset BRG */ +#define BRG_BCR_CLKS_MASK __BITS(22,18) /* Clock Source */ #define BRG_BCR_CLKS_BCLKIN (0 << 18) /* from MPP */ #define BRG_BCR_CLKS_SCLK0 (2 << 18) /* from S0 port */ #define BRG_BCR_CLKS_TSCLK0 (3 << 18) /* from S0 port */ @@ -82,18 +75,18 @@ #define BRG_BCR_CLKS_TSCLK1 (7 << 18) /* from S1 port */ #define BRG_BCR_CLKS_TCLK (8 << 18) /* "Tclk" ??? */ /* all other values resvd. */ -#define BRG_BCR_RES BITS(31,23) +#define BRG_BCR_RES __BITS(31,23) /* * BRG Baud Tuning Register bits */ -#define BRG_BTR_CUV BITS(15,0) /* Count Up Value */ -#define BRG_BTR_RES BITS(31,16) +#define BRG_BTR_CUV __BITS(15,0) /* Count Up Value */ +#define BRG_BTR_RES __BITS(31,16) /* * BRG Cause and Mask interrupt Register bits */ -#define BRG_INTR_BTR0 BIT(0) /* Baud Tuning 0 irpt. */ -#define BRG_INTR_BTR1 BIT(1) /* Baud Tuning 1 irpt. */ -#define BRG_INTR_BTR2 BIT(2) /* Baud Tuning 2 irpt. */ -#define BRG_INTR_RES BITS(31,3) +#define BRG_INTR_BTR0 __BIT(0) /* Baud Tuning 0 irpt. */ +#define BRG_INTR_BTR1 __BIT(1) /* Baud Tuning 1 irpt. */ +#define BRG_INTR_BTR2 __BIT(2) /* Baud Tuning 2 irpt. */ +#define BRG_INTR_RES __BITS(31,3) #endif /* _GTBRGREG_H */ Index: src/sys/dev/marvell/gtmpscreg.h diff -u src/sys/dev/marvell/gtmpscreg.h:1.4 src/sys/dev/marvell/gtmpscreg.h:1.5 --- src/sys/dev/marvell/gtmpscreg.h:1.4 Wed Apr 28 13:51:56 2010 +++ src/sys/dev/marvell/gtmpscreg.h Fri Jan 15 12:09:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: gtmpscreg.h,v 1.4 2010/04/28 13:51:56 kiyohara Exp $ */ +/* $NetBSD: gtmpscreg.h,v 1.5 2016/01/15 12:09:15 joerg Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -46,13 +46,6 @@ #ifndef _GTMPSCREG_H #define _GTMPSCREG_H -#ifndef BIT -#define BIT(bitno) (1U << (bitno)) -#endif -#ifndef BITS -#define BITS(hi, lo) ((~((~0) << ((hi) + 1))) & ((~0) << (lo))) -#endif - #define GTMPSC_BASE(u) (MPSC0_BASE + ((u) << 12)) #define GTMPSC_SIZE 0x1000 @@ -86,11 +79,11 @@ #define GTMPSC_MRR_PORT0 0 /* serial port #0 */ #define GTMPSC_MRR_NONE 7 /* unconnected */ /* all other "routes" resvd. */ -#define GTMPSC_MRR_MR0_MASK BITS(2,0) /* routing mask for MPSC0 */ -#define GTMPSC_MRR_RESa BITS(5,3) -#define GTMPSC_MRR_MR1_MASK BITS(8,6) /* routing mask for MPSC1 */ -#define GTMPSC_MRR_RESb BITS(30,9) -#define GTMPSC_MRRE_DSC BIT(31) /* "Don't Stop Clock" */ +#define GTMPSC_MRR_MR0_MASK __BITS(2,0) /* routing mask for MPSC0 */ +#define GTMPSC_MRR_RESa __BITS(5,3) +#define GTMPSC_MRR_MR1_MASK __BITS(8,6) /* routing mask for MPSC1 */ +#define GTMPSC_MRR_RESb __BITS(30,9) +#define GTMPSC_MRRE_DSC __BIT(31) /* "Don't Stop Clock" */ #define GTMPSC_MRR_RES (GTMPSC_MRR_RESa|GTMPSC_MRR_RESb) /* * MPSC Clock Routing Register bits @@ -106,92 +99,92 @@ #define GTMPSC_CRR(u, v) ((v) << GTMPSC_CRR_SHIFT(u)) #define GTMPSC_CRR_SHIFT(u) ((u) * 8) #define GTMPSC_CRR_MASK 0xf -#define GTMPSC_CRR_RESa BITS(7,4) -#define GTMPSC_CRR_RESb BITS(31,12) +#define GTMPSC_CRR_RESa __BITS(7,4) +#define GTMPSC_CRR_RESb __BITS(31,12) #define GTMPSC_CRR_RES (GTMPSC_CRR_RESa|GTMPSC_CRR_RESb) /*
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Dec 13 18:35:26 UTC 2015 Modified Files: src/sys/dev/marvell: mvspi.c Log Message: PR/50533: David Binderman: Fix incorrect logic To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/mvspi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvspi.c diff -u src/sys/dev/marvell/mvspi.c:1.2 src/sys/dev/marvell/mvspi.c:1.3 --- src/sys/dev/marvell/mvspi.c:1.2 Mon May 6 19:09:34 2013 +++ src/sys/dev/marvell/mvspi.c Sun Dec 13 13:35:26 2015 @@ -265,7 +265,7 @@ mvspi_assert(struct mvspi_softc *sc) { int ctl; - if (sc->sc_transfer->st_slave < 0 && sc->sc_transfer->st_slave > 7) { + if (sc->sc_transfer->st_slave < 0 || sc->sc_transfer->st_slave > 7) { printf("%s ERROR: Slave number %d not valid!\n", __func__, sc->sc_transfer->st_slave); return; } else
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: nonaka Date: Fri Nov 27 00:08:43 UTC 2015 Modified Files: src/sys/dev/marvell: mvpex.c Log Message: Use device name instead of fixed string "mvpex" for evcnt group. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/marvell/mvpex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.15 src/sys/dev/marvell/mvpex.c:1.16 --- src/sys/dev/marvell/mvpex.c:1.15 Fri Oct 2 05:22:52 2015 +++ src/sys/dev/marvell/mvpex.c Fri Nov 27 00:08:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.15 2015/10/02 05:22:52 msaitoh Exp $ */ +/* $NetBSD: mvpex.c,v 1.16 2015/11/27 00:08:43 nonaka Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.15 2015/10/02 05:22:52 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.16 2015/11/27 00:08:43 nonaka Exp $"); #include "opt_pci.h" #include "pci.h" @@ -680,8 +680,8 @@ mvpex_intr_establish(void *v, pci_intr_h pexih->ih_type = ipl; pexih->ih_intrtab = intrtab; mvpex_intr_string(v, pin, pexih->ih_evname, sizeof(pexih->ih_evname)); - evcnt_attach_dynamic(&pexih->ih_evcnt, EVCNT_TYPE_INTR, NULL, "mvpex", - pexih->ih_evname); + evcnt_attach_dynamic(&pexih->ih_evcnt, EVCNT_TYPE_INTR, NULL, + device_xname(sc->sc_dev), pexih->ih_evname); s = splhigh();
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Aug 8 14:35:06 UTC 2015 Modified Files: src/sys/dev/marvell: mvpexreg.h Log Message: Fix calculate to address for window register. Thanks knakahara@. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvpexreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpexreg.h diff -u src/sys/dev/marvell/mvpexreg.h:1.1 src/sys/dev/marvell/mvpexreg.h:1.2 --- src/sys/dev/marvell/mvpexreg.h:1.1 Tue Jul 13 11:16:02 2010 +++ src/sys/dev/marvell/mvpexreg.h Sat Aug 8 14:35:06 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpexreg.h,v 1.1 2010/07/13 11:16:02 kiyohara Exp $ */ +/* $NetBSD: mvpexreg.h,v 1.2 2015/08/08 14:35:06 kiyohara Exp $ */ /* * Copyright (c) 2008, 2009 KIYOHARA Takashi * All rights reserved. @@ -72,8 +72,8 @@ #define MVPEX_I_PEXLINKFAIL (1 << 23) /* Link Failure */ #define MVPEX_I_PIN(p) (1 << (((p) - 1) + 24)) /* PCI Express Address Window Control Registers */ -#define MVPEX_NWINDOW 6 -#define MVPEX_W_OFFSET(w) ((w < 4) ? ((w) << 4) : ((w - 4) << 5) + 0x60) +#define MVPEX_NWINDOW 6 /* Window 4 and 5 has Remap (High) Register */ +#define MVPEX_W_OFFSET(w) ((w < 4) ? ((w) << 4) : ((w - 4) << 5) + 0x40) #define MVPEX_WC(x) (0x1820 + MVPEX_W_OFFSET(x)) /* Win Ctrl */ #define MVPEX_WC_WINEN (1 << 0) #define MVPEX_WC_BARMAP_BAR1 (0 << 1)
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: knakahara Date: Tue Jul 28 01:57:55 UTC 2015 Modified Files: src/sys/dev/marvell: mvpex.c Log Message: fix: panic at doing "vmstat -ev" after a PCIe device detached. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/mvpex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.13 src/sys/dev/marvell/mvpex.c:1.14 --- src/sys/dev/marvell/mvpex.c:1.13 Wed Jun 24 10:00:37 2015 +++ src/sys/dev/marvell/mvpex.c Tue Jul 28 01:57:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.13 2015/06/24 10:00:37 knakahara Exp $ */ +/* $NetBSD: mvpex.c,v 1.14 2015/07/28 01:57:55 knakahara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.13 2015/06/24 10:00:37 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.14 2015/07/28 01:57:55 knakahara Exp $"); #include "opt_pci.h" #include "pci.h" @@ -703,6 +703,8 @@ mvpex_intr_disestablish(void *v, void *i uint32_t mask; int s; + evcnt_detach(&pexih->ih_evcnt); + intrtab = pexih->ih_intrtab; s = splhigh();
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: knakahara Date: Wed Jun 24 10:00:37 UTC 2015 Modified Files: src/sys/dev/marvell: mvpex.c mvpexvar.h Log Message: fix: pexih->ih_evcnt->ev_name pointed stack address wrongly. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/mvpex.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvpexvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.12 src/sys/dev/marvell/mvpex.c:1.13 --- src/sys/dev/marvell/mvpex.c:1.12 Sun Mar 30 23:25:20 2014 +++ src/sys/dev/marvell/mvpex.c Wed Jun 24 10:00:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.12 2014/03/30 23:25:20 christos Exp $ */ +/* $NetBSD: mvpex.c,v 1.13 2015/06/24 10:00:37 knakahara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.12 2014/03/30 23:25:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.13 2015/06/24 10:00:37 knakahara Exp $"); #include "opt_pci.h" #include "pci.h" @@ -660,7 +660,6 @@ mvpex_intr_establish(void *v, pci_intr_h struct mvpex_intrhand *pexih; uint32_t mask; int ih = pin - 1, s; - char buf[PCI_INTRSTR_LEN]; intrtab = &sc->sc_intrtab[ih]; @@ -674,8 +673,9 @@ mvpex_intr_establish(void *v, pci_intr_h pexih->ih_arg = intrarg; pexih->ih_type = ipl; pexih->ih_intrtab = intrtab; + mvpex_intr_string(v, pin, pexih->ih_evname, sizeof(pexih->ih_evname)); evcnt_attach_dynamic(&pexih->ih_evcnt, EVCNT_TYPE_INTR, NULL, "mvpex", - mvpex_intr_string(v, pin, buf, sizeof(buf))); + pexih->ih_evname); s = splhigh(); Index: src/sys/dev/marvell/mvpexvar.h diff -u src/sys/dev/marvell/mvpexvar.h:1.5 src/sys/dev/marvell/mvpexvar.h:1.6 --- src/sys/dev/marvell/mvpexvar.h:1.5 Sun Mar 30 01:17:51 2014 +++ src/sys/dev/marvell/mvpexvar.h Wed Jun 24 10:00:37 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpexvar.h,v 1.5 2014/03/30 01:17:51 christos Exp $ */ +/* $NetBSD: mvpexvar.h,v 1.6 2015/06/24 10:00:37 knakahara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -38,6 +38,7 @@ struct mvpex_intrhand { void *ih_intrtab; + char ih_evname[PCI_INTRSTR_LEN]; struct evcnt ih_evcnt; };
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: hsuenaga Date: Wed Jun 3 04:00:06 UTC 2015 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: reduce magic numbers. SDRAM address space attribute register has cache coherency control bits. this bit is important for AURORA_IO_CACHE_COHERENCY. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.8 src/sys/dev/marvell/marvellreg.h:1.9 --- src/sys/dev/marvell/marvellreg.h:1.8 Sat Mar 15 10:40:39 2014 +++ src/sys/dev/marvell/marvellreg.h Wed Jun 3 04:00:06 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.8 2014/03/15 10:40:39 kiyohara Exp $ */ +/* $NetBSD: marvellreg.h,v 1.9 2015/06/03 04:00:06 hsuenaga Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -73,11 +73,13 @@ #define MARVELL_DISCOVERY_REVB 0x20 #define MARVELL_ATTR_MASK 0xff +#define MARVELL_ATTR_SDRAM_CFU_SHARE 0x10 /* shared and snoop enabled.*/ +#define MARVELL_ATTR_SDRAM_CFU_L2_DEP 0x20 /* enable L2 deposit */ #ifdef AURORA_IO_CACHE_COHERENCY -#define MARVELL_ATTR_SDRAM_CS0 0x1e -#define MARVELL_ATTR_SDRAM_CS1 0x1d -#define MARVELL_ATTR_SDRAM_CS2 0x1b -#define MARVELL_ATTR_SDRAM_CS3 0x17 +#define MARVELL_ATTR_SDRAM_CS0 (0x0e | MARVELL_ATTR_SDRAM_CFU_SHARE) +#define MARVELL_ATTR_SDRAM_CS1 (0x0d | MARVELL_ATTR_SDRAM_CFU_SHARE) +#define MARVELL_ATTR_SDRAM_CS2 (0x0b | MARVELL_ATTR_SDRAM_CFU_SHARE) +#define MARVELL_ATTR_SDRAM_CS3 (0x07 | MARVELL_ATTR_SDRAM_CFU_SHARE) #else #define MARVELL_ATTR_SDRAM_CS0 0x0e #define MARVELL_ATTR_SDRAM_CS1 0x0d
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: joerg Date: Sun Jan 11 22:59:57 UTC 2015 Modified Files: src/sys/dev/marvell: if_gfe.c Log Message: sizeof doesn't evaluate the expression, so increment of rxd doesn't happen. Move it out. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/sys/dev/marvell/if_gfe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_gfe.c diff -u src/sys/dev/marvell/if_gfe.c:1.43 src/sys/dev/marvell/if_gfe.c:1.44 --- src/sys/dev/marvell/if_gfe.c:1.43 Sun Sep 21 17:00:35 2014 +++ src/sys/dev/marvell/if_gfe.c Sun Jan 11 22:59:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfe.c,v 1.43 2014/09/21 17:00:35 christos Exp $ */ +/* $NetBSD: if_gfe.c,v 1.44 2015/01/11 22:59:57 joerg Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.43 2014/09/21 17:00:35 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.44 2015/01/11 22:59:57 joerg Exp $"); #include "opt_inet.h" @@ -816,7 +816,7 @@ gfe_rx_rxqinit(struct gfe_softc *sc, enu ds = rxq->rxq_buf_mem.gdm_map->dm_segs; nxtaddr = rxq->rxq_desc_busaddr + sizeof(*rxd); for (idx = 0, rxd = rxq->rxq_descs; idx < GE_RXDESC_MAX; - idx++, nxtaddr += sizeof(*(++rxd))) { + idx++, rxd++, nxtaddr += sizeof(*rxd)) { rxd->ed_lencnt = htogt32(GE_RXBUF_SIZE << 16); rxd->ed_cmdsts = htogt32(RX_CMD_F|RX_CMD_L|RX_CMD_O|RX_CMD_EI); rxd->ed_bufptr = htogt32(ds->ds_addr + boff);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Sep 21 17:00:36 UTC 2014 Modified Files: src/sys/dev/marvell: if_gfe.c Log Message: this is not python (add braces) To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/dev/marvell/if_gfe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_gfe.c diff -u src/sys/dev/marvell/if_gfe.c:1.42 src/sys/dev/marvell/if_gfe.c:1.43 --- src/sys/dev/marvell/if_gfe.c:1.42 Sun Aug 10 12:44:35 2014 +++ src/sys/dev/marvell/if_gfe.c Sun Sep 21 13:00:35 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_gfe.c,v 1.42 2014/08/10 16:44:35 tls Exp $ */ +/* $NetBSD: if_gfe.c,v 1.43 2014/09/21 17:00:35 christos Exp $ */ /* * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.42 2014/08/10 16:44:35 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.43 2014/09/21 17:00:35 christos Exp $"); #include "opt_inet.h" @@ -2018,9 +2018,10 @@ gfe_hash_fill(struct gfe_softc *sc) error = gfe_hash_entry_op(sc, GE_HASH_ADD, GE_RXPRIO_HI, CLLADDR(sc->sc_ec.ec_if.if_sadl)); - if (error) + if (error) { GE_FUNC_EXIT(sc, "!"); return error; + } sc->sc_flags &= ~GE_ALLMULTI; if ((sc->sc_ec.ec_if.if_flags & IFF_PROMISC) == 0)
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Mar 30 23:25:20 UTC 2014 Modified Files: src/sys/dev/marvell: mvpex.c Log Message: provide a buffer for pci_intr_string() To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/mvpex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.11 src/sys/dev/marvell/mvpex.c:1.12 --- src/sys/dev/marvell/mvpex.c:1.11 Sun Mar 30 18:39:29 2014 +++ src/sys/dev/marvell/mvpex.c Sun Mar 30 19:25:20 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.11 2014/03/30 22:39:29 htodd Exp $ */ +/* $NetBSD: mvpex.c,v 1.12 2014/03/30 23:25:20 christos Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.11 2014/03/30 22:39:29 htodd Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.12 2014/03/30 23:25:20 christos Exp $"); #include "opt_pci.h" #include "pci.h" @@ -660,6 +660,7 @@ mvpex_intr_establish(void *v, pci_intr_h struct mvpex_intrhand *pexih; uint32_t mask; int ih = pin - 1, s; + char buf[PCI_INTRSTR_LEN]; intrtab = &sc->sc_intrtab[ih]; @@ -674,7 +675,7 @@ mvpex_intr_establish(void *v, pci_intr_h pexih->ih_type = ipl; pexih->ih_intrtab = intrtab; evcnt_attach_dynamic(&pexih->ih_evcnt, EVCNT_TYPE_INTR, NULL, "mvpex", - mvpex_intr_string(v, pin)); + mvpex_intr_string(v, pin, buf, sizeof(buf))); s = splhigh();
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: htodd Date: Sun Mar 30 22:39:29 UTC 2014 Modified Files: src/sys/dev/marvell: mvpex.c Log Message: Fix typo. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/mvpex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.10 src/sys/dev/marvell/mvpex.c:1.11 --- src/sys/dev/marvell/mvpex.c:1.10 Sun Mar 30 01:17:51 2014 +++ src/sys/dev/marvell/mvpex.c Sun Mar 30 22:39:29 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.10 2014/03/30 01:17:51 christos Exp $ */ +/* $NetBSD: mvpex.c,v 1.11 2014/03/30 22:39:29 htodd Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.10 2014/03/30 01:17:51 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.11 2014/03/30 22:39:29 htodd Exp $"); #include "opt_pci.h" #include "pci.h" @@ -620,7 +620,7 @@ mvpex_intr_map(const struct pci_attach_a /* ARGSUSED */ const char * -mvpex_intr_string(void *v, pci_intr_handle_t pin, char *buf size_t len) +mvpex_intr_string(void *v, pci_intr_handle_t pin, char *buf, size_t len) { switch (pin) { case PCI_INTERRUPT_PIN_A:
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Mar 30 01:17:51 UTC 2014 Modified Files: src/sys/dev/marvell: mvpex.c mvpexvar.h Log Message: catch up with pci_intr_string changes To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/mvpex.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/mvpexvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.9 src/sys/dev/marvell/mvpex.c:1.10 --- src/sys/dev/marvell/mvpex.c:1.9 Sat Mar 15 09:33:48 2014 +++ src/sys/dev/marvell/mvpex.c Sat Mar 29 21:17:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.9 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: mvpex.c,v 1.10 2014/03/30 01:17:51 christos Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.9 2014/03/15 13:33:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.10 2014/03/30 01:17:51 christos Exp $"); #include "opt_pci.h" #include "pci.h" @@ -620,10 +620,8 @@ mvpex_intr_map(const struct pci_attach_a /* ARGSUSED */ const char * -mvpex_intr_string(void *v, pci_intr_handle_t pin) +mvpex_intr_string(void *v, pci_intr_handle_t pin, char *buf size_t len) { - static char intrstr[32]; - switch (pin) { case PCI_INTERRUPT_PIN_A: case PCI_INTERRUPT_PIN_B: @@ -634,10 +632,9 @@ mvpex_intr_string(void *v, pci_intr_hand default: return NULL; } - snprintf(intrstr, sizeof(intrstr), "interrupt pin INT%c#", - (char)('A' - 1 + pin)); + snprintf(buf, len, "interrupt pin INT%c#", (char)('A' - 1 + pin)); - return intrstr; + return buf; } /* ARGSUSED */ Index: src/sys/dev/marvell/mvpexvar.h diff -u src/sys/dev/marvell/mvpexvar.h:1.4 src/sys/dev/marvell/mvpexvar.h:1.5 --- src/sys/dev/marvell/mvpexvar.h:1.4 Sat Mar 15 09:33:48 2014 +++ src/sys/dev/marvell/mvpexvar.h Sat Mar 29 21:17:51 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpexvar.h,v 1.4 2014/03/15 13:33:48 kiyohara Exp $ */ +/* $NetBSD: mvpexvar.h,v 1.5 2014/03/30 01:17:51 christos Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -70,7 +70,7 @@ void mvpex_conf_write(void *, pcitag_t, int mvpex_conf_hook(void *, int, int, int, pcireg_t); void mvpex_conf_interrupt(void *, int, int, int, int, int *); int mvpex_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); -const char *mvpex_intr_string(void *, pci_intr_handle_t); +const char *mvpex_intr_string(void *, pci_intr_handle_t, char *, size_t); const struct evcnt *mvpex_intr_evcnt(void *, pci_intr_handle_t); void *mvpex_intr_establish(void *, pci_intr_handle_t, int, int (*)(void *), void *);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Mar 15 13:33:48 UTC 2014 Modified Files: src/sys/dev/marvell: ehci_mv.c gtidmac.c gtidmacvar.h if_mvgbe.c mvpex.c mvpexvar.h mvsata_mv.c mvsdio.c Log Message: Support Armada 370 and DDR3 tags. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/ehci_mv.c \ src/sys/dev/marvell/mvsdio.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/gtidmac.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/gtidmacvar.h cvs rdiff -u -r1.37 -r1.38 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/mvpex.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvpexvar.h cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/mvsata_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/ehci_mv.c diff -u src/sys/dev/marvell/ehci_mv.c:1.4 src/sys/dev/marvell/ehci_mv.c:1.5 --- src/sys/dev/marvell/ehci_mv.c:1.4 Sun Sep 8 04:10:23 2013 +++ src/sys/dev/marvell/ehci_mv.c Sat Mar 15 13:33:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci_mv.c,v 1.4 2013/09/08 04:10:23 kiyohara Exp $ */ +/* $NetBSD: ehci_mv.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.4 2013/09/08 04:10:23 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $"); #include #include @@ -164,8 +164,8 @@ struct mvusb_softc { static int mvusb_match(device_t, cfdata_t, void *); static void mvusb_attach(device_t, device_t, void *); -static void mvusb_init(struct mvusb_softc *); -static void mvusb_wininit(struct mvusb_softc *); +static void mvusb_init(struct mvusb_softc *, enum marvell_tags *); +static void mvusb_wininit(struct mvusb_softc *, enum marvell_tags *); static void mvusb_vendor_init(struct ehci_softc *); static int mvusb_vendor_port_status(struct ehci_softc *, uint32_t, int); @@ -216,7 +216,7 @@ mvusb_attach(device_t parent, device_t s aprint_error_dev(self, "can't map registers\n"); return; } - mvusb_init(sc); + mvusb_init(sc, mva->mva_tags); /* Map I/O registers for ehci */ sc->sc.sc_size = MARVELL_USB_EHCI_SIZE; @@ -254,7 +254,7 @@ mvusb_attach(device_t parent, device_t s } static void -mvusb_init(struct mvusb_softc *sc) +mvusb_init(struct mvusb_softc *sc, enum marvell_tags *tags) { uint32_t reg; int opr_offs; @@ -357,24 +357,16 @@ mvusb_init(struct mvusb_softc *sc) reg); } - mvusb_wininit(sc); + mvusb_wininit(sc, tags); } static void -mvusb_wininit(struct mvusb_softc *sc) +mvusb_wininit(struct mvusb_softc *sc, enum marvell_tags *tags) { device_t pdev = device_parent(sc->sc.sc_dev); uint64_t base; uint32_t size; int window, target, attr, rv, i; - static int tags[] = { - MARVELL_TAG_SDRAM_CS0, - MARVELL_TAG_SDRAM_CS1, - MARVELL_TAG_SDRAM_CS2, - MARVELL_TAG_SDRAM_CS3, - - MARVELL_TAG_UNDEFINED, - }; for (window = 0, i = 0; tags[i] != MARVELL_TAG_UNDEFINED && window < MARVELL_USB_NWINDOW; Index: src/sys/dev/marvell/mvsdio.c diff -u src/sys/dev/marvell/mvsdio.c:1.4 src/sys/dev/marvell/mvsdio.c:1.5 --- src/sys/dev/marvell/mvsdio.c:1.4 Sun Feb 13 06:43:51 2011 +++ src/sys/dev/marvell/mvsdio.c Sat Mar 15 13:33:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsdio.c,v 1.4 2011/02/13 06:43:51 nonaka Exp $ */ +/* $NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $ */ /* * Copyright (c) 2010 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.4 2011/02/13 06:43:51 nonaka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsdio.c,v 1.5 2014/03/15 13:33:48 kiyohara Exp $"); #include "opt_mvsdio.h" @@ -92,7 +92,7 @@ static void mvsdio_exec_command(sdmmc_ch static void mvsdio_card_enable_intr(sdmmc_chipset_handle_t, int); static void mvsdio_card_intr_ack(sdmmc_chipset_handle_t); -static void mvsdio_wininit(struct mvsdio_softc *); +static void mvsdio_wininit(struct mvsdio_softc *, enum marvell_tags *); static struct sdmmc_chip_functions mvsdio_chip_functions = { /* host controller reset */ @@ -178,7 +178,7 @@ mvsdio_attach(device_t parent, device_t marvell_intr_establish(mva->mva_irq, IPL_SDMMC, mvsdio_intr, sc); - mvsdio_wininit(sc); + mvsdio_wininit(sc, mva->mva_tags); #if BYTE_ORDER == LITTLE_ENDIAN bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVSDIO_HC, HC_BIGENDIAN); @@ -683,19 +683,11 @@ mvsdio_card_intr_ack(sdmmc_chipset_handl static void -mvsdio_wininit(struct mvsdio_softc *sc) +mvsdio_wininit(struct mvsdio_softc *sc, enum marvell_tags *tags) { uint64_t base; uint32_t size; int window, target, attr, rv, i; - static int tags[] = { - MARVELL_TAG_SDRAM_CS0, - MARVELL_TAG_SDRAM_CS1, - MARVELL_TAG_SDRAM_CS2, - MARVELL_TAG_SDRAM_CS3, - - MARVELL_TAG_UNDEFINED, - }; for
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Mar 15 11:47:43 UTC 2014 Modified Files: src/sys/dev/marvell: marvellvar.h Log Message: Add tags to marvell_attach_args. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/marvellvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellvar.h diff -u src/sys/dev/marvell/marvellvar.h:1.4 src/sys/dev/marvell/marvellvar.h:1.5 --- src/sys/dev/marvell/marvellvar.h:1.4 Mon Feb 17 04:52:44 2014 +++ src/sys/dev/marvell/marvellvar.h Sat Mar 15 11:47:43 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellvar.h,v 1.4 2014/02/17 04:52:44 kiyohara Exp $ */ +/* $NetBSD: marvellvar.h,v 1.5 2014/03/15 11:47:43 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -59,6 +59,7 @@ struct marvell_attach_args { bus_size_t mva_size; bus_dma_tag_t mva_dmat; int mva_irq; + enum marvell_tags *mva_tags; }; #include "locators.h"
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Mar 15 10:40:39 UTC 2014 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: Add some Armada 370 IDs. And fix comment-out-ed ID for Discovery VI. (from Marvell USP) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.7 src/sys/dev/marvell/marvellreg.h:1.8 --- src/sys/dev/marvell/marvellreg.h:1.7 Wed May 1 12:23:24 2013 +++ src/sys/dev/marvell/marvellreg.h Sat Mar 15 10:40:39 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.7 2013/05/01 12:23:24 rkujawa Exp $ */ +/* $NetBSD: marvellreg.h,v 1.8 2014/03/15 10:40:39 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -36,7 +36,7 @@ #if 0 #define MARVELL_DISCOVERY_LT /* : 0x */ #define MARVELL_DISCOVERY_V /* : 0x6450 ? */ -#define MARVELL_DISCOVERY_VI /* : 0x6490 ? */ +#define MARVELL_DISCOVERY_VI /* : 0x6460 ? */ #endif #define MARVELL_ORION_1_88F1181 PCI_PRODUCT_MARVELL_88F1181 @@ -65,6 +65,10 @@ #define MARVELL_ARMADAXP_MV78260 PCI_PRODUCT_MARVELL_MV78260 #define MARVELL_ARMADAXP_MV78460 PCI_PRODUCT_MARVELL_MV78460 +#define MARVELL_ARMADA370_MV6707 PCI_PRODUCT_MARVELL_MV6707 +#define MARVELL_ARMADA370_MV6710 PCI_PRODUCT_MARVELL_MV6710 +#define MARVELL_ARMADA370_MV6W11 PCI_PRODUCT_MARVELL_MV6W11 + #define MARVELL_DISCOVERY_REVA 0x10 #define MARVELL_DISCOVERY_REVB 0x20
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Mon Feb 17 04:52:44 UTC 2014 Modified Files: src/sys/dev/marvell: marvellvar.h Log Message: Add MARVELL_TAG_DDR3_CS[0-3] for latest SoC. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/marvellvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellvar.h diff -u src/sys/dev/marvell/marvellvar.h:1.3 src/sys/dev/marvell/marvellvar.h:1.4 --- src/sys/dev/marvell/marvellvar.h:1.3 Tue Jul 20 11:37:39 2010 +++ src/sys/dev/marvell/marvellvar.h Mon Feb 17 04:52:44 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellvar.h,v 1.3 2010/07/20 11:37:39 kiyohara Exp $ */ +/* $NetBSD: marvellvar.h,v 1.4 2014/02/17 04:52:44 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -34,6 +34,11 @@ enum marvell_tags { MARVELL_TAG_SDRAM_CS2, MARVELL_TAG_SDRAM_CS3, + MARVELL_TAG_DDR3_CS0, + MARVELL_TAG_DDR3_CS1, + MARVELL_TAG_DDR3_CS2, + MARVELL_TAG_DDR3_CS3, + MARVELL_TAG_MAX, MARVELL_TAG_UNDEFINED = -1,
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Mon Feb 3 05:56:23 UTC 2014 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Carefully set IFF_OACTIVE in mvgbe_start(). Even if mvgbe_encap() returns other than 0, the TX ring might not full. Check whether the TX ring has one or more packets. If the ring is empty, dont' set IFF_OACTIVE because an TX complete interrupt never occur and IFF_OACTIVE flags is left. The interface's timer isn't reset, so a device timeout desn't occur. Fixes a bug that IFF_OACTIVE flag is left on heavy load. Part of PR#48568. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.35 src/sys/dev/marvell/if_mvgbe.c:1.36 --- src/sys/dev/marvell/if_mvgbe.c:1.35 Mon Dec 23 02:23:25 2013 +++ src/sys/dev/marvell/if_mvgbe.c Mon Feb 3 05:56:23 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.36 2014/02/03 05:56:23 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.36 2014/02/03 05:56:23 msaitoh Exp $"); #include "opt_multiprocessor.h" @@ -1059,7 +1059,8 @@ mvgbe_start(struct ifnet *ifp) * for the NIC to drain the ring. */ if (mvgbe_encap(sc, m_head, &idx)) { - ifp->if_flags |= IFF_OACTIVE; + if (sc->sc_cdata.mvgbe_tx_cnt > 0) +ifp->if_flags |= IFF_OACTIVE; break; }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Mon Dec 23 02:23:25 UTC 2013 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvgbereg.h Log Message: Support Basic Mode for Armada XP. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvgbereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.34 src/sys/dev/marvell/if_mvgbe.c:1.35 --- src/sys/dev/marvell/if_mvgbe.c:1.34 Fri Dec 28 08:16:53 2012 +++ src/sys/dev/marvell/if_mvgbe.c Mon Dec 23 02:23:25 2013 @@ -1,6 +1,6 @@ -/* $NetBSD: if_mvgbe.c,v 1.34 2012/12/28 08:16:53 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $ */ /* - * Copyright (c) 2007, 2008 KIYOHARA Takashi + * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -25,7 +25,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.34 2012/12/28 08:16:53 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.35 2013/12/23 02:23:25 kiyohara Exp $"); + +#include "opt_multiprocessor.h" + +#if defined MULTIPROCESSOR +#warning Queue Management Method 'Counters' not support yet +#endif #include #include @@ -80,6 +86,10 @@ int mvgbe_debug = MVGBE_DEBUG; #define MVGBE_WRITE_FILTER(sc, reg, val, c) \ bus_space_write_region_4((sc)->sc_iot, (sc)->sc_dafh, (reg), (val), (c)) +#define MVGBE_LINKUP_READ(sc) \ +bus_space_read_4((sc)->sc_iot, (sc)->sc_linkup.ioh, 0) +#define MVGBE_IS_LINKUP(sc) (MVGBE_LINKUP_READ(sc) & (sc)->sc_linkup.bit) + #define MVGBE_TX_RING_CNT 256 #define MVGBE_TX_RING_MSK (MVGBE_TX_RING_CNT - 1) #define MVGBE_TX_RING_NEXT(x) (((x) + 1) & MVGBE_TX_RING_MSK) @@ -208,6 +218,7 @@ struct mvgbec_softc { struct mvgbe_softc { device_t sc_dev; int sc_port; + uint32_t sc_version; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -232,6 +243,12 @@ struct mvgbe_softc { LIST_HEAD(__mvgbe_jinusehead, mvgbe_jpool_entry) sc_jinuse_listhead; SIMPLEQ_HEAD(__mvgbe_txmaphead, mvgbe_txmap_entry) sc_txmap_head; + struct { + bus_space_handle_t ioh; + uint32_t bit; + } sc_linkup; + uint32_t sc_cmdsts_opts; + krndsource_t sc_rnd_source; struct sysctllog *mvgbe_clog; #ifdef MVGBE_EVENT_COUNTERS @@ -318,6 +335,7 @@ struct mvgbe_port { #define FLAGS_FIX_MTU (1 << 1) #define FLAGS_IPG1 (1 << 2) #define FLAGS_IPG2 (1 << 3) +#define FLAGS_HAS_PV (1 << 4) /* Has Port Version Register */ } mvgbe_ports[] = { { MARVELL_DISCOVERY_II, 0, 3, { 32, 33, 34 }, 0 }, { MARVELL_DISCOVERY_III, 0, 3, { 32, 33, 34 }, 0 }, @@ -348,6 +366,25 @@ struct mvgbe_port { { MARVELL_MV78XX0_MV78200, 1, 1, { 44 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, { MARVELL_MV78XX0_MV78200, 2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, { MARVELL_MV78XX0_MV78200, 3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + + { MARVELL_ARMADAXP_MV78130, 0, 1, { 66 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78130, 1, 1, { 70 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78130, 2, 1, { 74 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78160, 0, 1, { 66 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78160, 1, 1, { 70 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78160, 2, 1, { 74 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78160, 3, 1, { 78 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78230, 0, 1, { 66 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78230, 1, 1, { 70 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78230, 2, 1, { 74 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78260, 0, 1, { 66 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78260, 1, 1, { 70 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78260, 2, 1, { 74 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78260, 3, 1, { 78 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78460, 0, 1, { 66 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78460, 1, 1, { 70 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78460, 2, 1, { 74 }, FLAGS_HAS_PV }, + { MARVELL_ARMADAXP_MV78460, 3, 1, { 78 }, FLAGS_HAS_PV }, }; @@ -654,6 +691,7 @@ mvgbe_match(device_t parent, cfdata_t ma static void mvgbe_attach(device_t parent, device_t self, void *aux) { + struct mvgbec_softc *csc = device_private(parent); struct mvgbe_softc *sc = device_private(self); struct marvell_attach_args *mva = aux; struct mvgbe_txmap_entry *entry; @@ -687,6 +725,33 @@ mvgbe_attach(device_t parent, device_t s } sc->sc_dmat = mva->mva_dmat; + if (csc->sc_flags & FLAGS_HAS_PV) { + /* GbE port has Port Version register. */ + sc->sc_version = MVGBE_READ(sc, MVGBE_PV); + aprint_normal_dev(self, "Port Version 0x%x\n", sc->sc_version); + } + + if (sc->sc_version >= 0x10) { + /* + * Armada XP + */ + + if (bus_space_subregion(mva->mva_iot, mva->mva_ioh, + MVGBE_PS0, sizeof(uint32_t), &sc->sc_linkup.ioh)) { + aprint_err
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: mrg Date: Wed Nov 6 06:20:12 UTC 2013 Modified Files: src/sys/dev/marvell: gtpci.c Log Message: move some variables inside their #ifdef use. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/marvell/gtpci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtpci.c diff -u src/sys/dev/marvell/gtpci.c:1.30 src/sys/dev/marvell/gtpci.c:1.31 --- src/sys/dev/marvell/gtpci.c:1.30 Fri Sep 7 04:25:37 2012 +++ src/sys/dev/marvell/gtpci.c Wed Nov 6 06:20:12 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gtpci.c,v 1.30 2012/09/07 04:25:37 matt Exp $ */ +/* $NetBSD: gtpci.c,v 1.31 2013/11/06 06:20:12 mrg Exp $ */ /* * Copyright (c) 2008, 2009 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.30 2012/09/07 04:25:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.31 2013/11/06 06:20:12 mrg Exp $"); #include "opt_pci.h" #include "pci.h" @@ -314,12 +314,9 @@ gtpci_barinit(struct gtpci_softc *sc) }; device_t pdev = device_parent(sc->sc_dev); uint64_t base; - uint32_t p2pc, size, bare; - int map, bus, dev, rv; + uint32_t size, bare; + int map, rv; - p2pc = GTPCI_READ(sc, GTPCI_P2PC); - bus = GTPCI_P2PC_BUSNUMBER(p2pc); - dev = GTPCI_P2PC_DEVNUM(p2pc); bare = GTPCI_BARE_ALLDISABLE; for (map = 0; maps[map].tag != MARVELL_TAG_UNDEFINED; map++) { @@ -337,6 +334,9 @@ gtpci_barinit(struct gtpci_softc *sc) if (maps[map].func != -1) { pcitag_t tag; pcireg_t reg; + int dev = GTPCI_P2PC_DEVNUM(p2pc); + int bus = GTPCI_P2PC_BUSNUMBER(p2pc); + uint32_t p2pc = GTPCI_READ(sc, GTPCI_P2PC); tag = gtpci_make_tag(NULL, bus, dev, maps[map].func); reg = gtpci_conf_read(sc, tag, maps[map].balow);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Sep 28 05:39:06 UTC 2013 Modified Files: src/sys/dev/marvell: gtidmac.c Log Message: Add ARMADAXP IDs. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/gtidmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmac.c diff -u src/sys/dev/marvell/gtidmac.c:1.9 src/sys/dev/marvell/gtidmac.c:1.10 --- src/sys/dev/marvell/gtidmac.c:1.9 Mon Sep 10 13:36:40 2012 +++ src/sys/dev/marvell/gtidmac.c Sat Sep 28 05:39:06 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gtidmac.c,v 1.9 2012/09/10 13:36:40 msaitoh Exp $ */ +/* $NetBSD: gtidmac.c,v 1.10 2013/09/28 05:39:06 kiyohara Exp $ */ /* * Copyright (c) 2008, 2012 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.9 2012/09/10 13:36:40 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.10 2013/09/28 05:39:06 kiyohara Exp $"); #include #include @@ -313,6 +313,16 @@ static struct { { MARVELL_KIRKWOOD_88F6192, 0, -1, 4, 5 }, { MARVELL_KIRKWOOD_88F6281, 0, -1, 4, 5 }, { MARVELL_KIRKWOOD_88F6282, 0, -1, 4, 5 }, + { MARVELL_ARMADAXP_MV78130, 4, 33, 2, 51 }, + { MARVELL_ARMADAXP_MV78130, 0, -1, 2, 94 }, + { MARVELL_ARMADAXP_MV78160, 4, 33, 2, 51 }, + { MARVELL_ARMADAXP_MV78160, 0, -1, 2, 94 }, + { MARVELL_ARMADAXP_MV78230, 4, 33, 2, 51 }, + { MARVELL_ARMADAXP_MV78230, 0, -1, 2, 94 }, + { MARVELL_ARMADAXP_MV78260, 4, 33, 2, 51 }, + { MARVELL_ARMADAXP_MV78260, 0, -1, 2, 94 }, + { MARVELL_ARMADAXP_MV78460, 4, 33, 2, 51 }, + { MARVELL_ARMADAXP_MV78460, 0, -1, 2, 94 }, }; CFATTACH_DECL_NEW(gtidmac_gt, sizeof(struct gtidmac_softc), @@ -326,16 +336,20 @@ static int gtidmac_match(device_t parent, struct cfdata *match, void *aux) { struct marvell_attach_args *mva = aux; - int i; + int unit, i; if (strcmp(mva->mva_name, match->cf_name) != 0) return 0; if (mva->mva_offset == MVA_OFFSET_DEFAULT) return 0; + unit = 0; for (i = 0; i < __arraycount(channels); i++) if (mva->mva_model == channels[i].model) { - mva->mva_size = GTIDMAC_SIZE; - return 1; + if (mva->mva_unit == unit) { +mva->mva_size = GTIDMAC_SIZE; +return 1; + } + unit++; } return 0; } @@ -348,11 +362,15 @@ gtidmac_attach(device_t parent, device_t struct marvell_attach_args *mva = aux; prop_dictionary_t dict = device_properties(self); uint32_t idmac_irq, xore_irq, dmb_speed; - int idmac_nchan, xore_nchan, nsegs, i, j, n; + int unit, idmac_nchan, xore_nchan, nsegs, i, j, n; + unit = 0; for (i = 0; i < __arraycount(channels); i++) - if (mva->mva_model == channels[i].model) - break; + if (mva->mva_model == channels[i].model) { + if (mva->mva_unit == unit) +break; + unit++; + } idmac_nchan = channels[i].idmac_nchan; idmac_irq = channels[i].idmac_irq; if (idmac_nchan != 0) {
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Sep 28 05:37:31 UTC 2013 Modified Files: src/sys/dev/marvell: mvsata_mv.c Log Message: Add ARMADAXP MV78{13,16,23,26}0. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvsata_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvsata_mv.c diff -u src/sys/dev/marvell/mvsata_mv.c:1.5 src/sys/dev/marvell/mvsata_mv.c:1.6 --- src/sys/dev/marvell/mvsata_mv.c:1.5 Wed May 1 12:19:49 2013 +++ src/sys/dev/marvell/mvsata_mv.c Sat Sep 28 05:37:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata_mv.c,v 1.5 2013/05/01 12:19:49 rkujawa Exp $ */ +/* $NetBSD: mvsata_mv.c,v 1.6 2013/09/28 05:37:31 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.5 2013/05/01 12:19:49 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.6 2013/09/28 05:37:31 kiyohara Exp $"); #include #include @@ -100,6 +100,10 @@ struct mvsata_product mvsata_products[] { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 1, 2, gen2e, 0 }, /* Armada XP */ + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78130, 1, 2, gen2e, 0 }, + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78160, 1, 2, gen2e, 0 }, + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78230, 1, 2, gen2e, 0 }, + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78260, 1, 2, gen2e, 0 }, { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78460, 1, 2, gen2e, 0 }, };
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sun Sep 8 04:10:23 UTC 2013 Modified Files: src/sys/dev/marvell: ehci_mv.c Log Message: Fix size of EHCI register space. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/ehci_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/ehci_mv.c diff -u src/sys/dev/marvell/ehci_mv.c:1.3 src/sys/dev/marvell/ehci_mv.c:1.4 --- src/sys/dev/marvell/ehci_mv.c:1.3 Wed May 1 12:30:02 2013 +++ src/sys/dev/marvell/ehci_mv.c Sun Sep 8 04:10:23 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci_mv.c,v 1.3 2013/05/01 12:30:02 rkujawa Exp $ */ +/* $NetBSD: ehci_mv.c,v 1.4 2013/09/08 04:10:23 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.3 2013/05/01 12:30:02 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.4 2013/09/08 04:10:23 kiyohara Exp $"); #include #include @@ -55,7 +55,7 @@ extern int ehcidebug; #endif -#define MARVELL_USB_SIZE 0x2000 +#define MARVELL_USB_SIZE 0x1000 #define MARVELL_USB_NWINDOW 4 @@ -70,7 +70,7 @@ extern int ehcidebug; /* ehci generic registers */ #define MARVELL_USB_EHCI_BASE 0x100 -#define MARVELL_USB_EHCI_SIZE 0x1000 +#define MARVELL_USB_EHCI_SIZE 0x100 /* ehci vendor extension registers */ #define MARVELL_USB_EHCI_PS_PSPD 0x0c00 /* Port speed */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: matt Date: Thu Sep 5 22:28:57 UTC 2013 Modified Files: src/sys/dev/marvell: gttwsi.c Log Message: Make sc_started bool and true/false instead of 1/0 To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/gttwsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.9 src/sys/dev/marvell/gttwsi.c:1.10 --- src/sys/dev/marvell/gttwsi.c:1.9 Sat Aug 3 07:39:31 2013 +++ src/sys/dev/marvell/gttwsi.c Thu Sep 5 22:28:57 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $ */ +/* $NetBSD: gttwsi.c,v 1.10 2013/09/05 22:28:57 matt Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.10 2013/09/05 22:28:57 matt Exp $"); #include "locators.h" #include @@ -90,7 +90,7 @@ struct gttwsi_softc { device_t sc_dev; bus_space_tag_t sc_bust; bus_space_handle_t sc_bush; - uint8_t sc_started; + bool sc_started; struct i2c_controller sc_i2c; kmutex_t sc_buslock; kmutex_t sc_mtx; @@ -188,7 +188,7 @@ gttwsi_attach(device_t parent, device_t mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_BIO); cv_init(&sc->sc_cv, "gttwsi"); - sc->sc_started = 0; + sc->sc_started = false; sc->sc_i2c.ic_cookie = sc; sc->sc_i2c.ic_acquire_bus = gttwsi_acquire_bus; sc->sc_i2c.ic_release_bus = gttwsi_release_bus; @@ -259,7 +259,7 @@ gttwsi_send_start(void *v, int flags) expect = STAT_RSCT; else expect = STAT_SCT; - sc->sc_started = 1; + sc->sc_started = true; return gttwsi_wait(sc, CONTROL_START, expect, flags); } @@ -269,7 +269,7 @@ gttwsi_send_stop(void *v, int flags) struct gttwsi_softc *sc = v; int retry = TWSI_RETRY_COUNT; - sc->sc_started = 0; + sc->sc_started = false; /* Interrupt is not generated for STAT_NRS. */ WREG(sc, TWSI_CONTROL, CONTROL_STOP | CONTROL_TWSIEN);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Aug 3 07:39:31 UTC 2013 Modified Files: src/sys/dev/marvell: gttwsi.c gttwsireg.h Log Message: Issue the STOP-bit if needed. And remove #ifdef ARMADAXP. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/gttwsi.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/gttwsireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.8 src/sys/dev/marvell/gttwsi.c:1.9 --- src/sys/dev/marvell/gttwsi.c:1.8 Mon May 13 15:47:18 2013 +++ src/sys/dev/marvell/gttwsi.c Sat Aug 3 07:39:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $ */ +/* $NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.9 2013/08/03 07:39:31 kiyohara Exp $"); #include "locators.h" #include @@ -341,13 +341,8 @@ gttwsi_read_byte(void *v, uint8_t *valp, error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags); if (!error) *valp = RREG(sc, TWSI_DATA); - if (flags & I2C_F_LAST) { -#if defined(ARMADAXP) + if ((flags & (I2C_F_LAST | I2C_F_STOP)) == (I2C_F_LAST | I2C_F_STOP)) error = gttwsi_send_stop(sc, flags); -#else - WREG(sc, TWSI_CONTROL, 0); -#endif - } return error; } @@ -355,13 +350,13 @@ static int gttwsi_write_byte(void *v, uint8_t val, int flags) { struct gttwsi_softc *sc = v; + int error; WREG(sc, TWSI_DATA, val); -#if defined(ARMADAXP) - if (flags & I2C_F_LAST) + error = gttwsi_wait(sc, 0, STAT_MTDB_AR, flags); + if (flags & I2C_F_STOP) gttwsi_send_stop(sc, flags); -#endif - return gttwsi_wait(sc, 0, STAT_MTDB_AR, flags); + return error; } static int @@ -399,19 +394,5 @@ gttwsi_wait(struct gttwsi_softc *sc, uin "unexpected status 0x%x: expect 0x%x\n", status, expect); return EIO; } - -#ifndef ARMADAXP - if (flags & I2C_F_STOP) - switch (expect) { - case STAT_SCT: - case STAT_RSCT: - case STAT_MRRD_AT: - case STAT_ARBT_AR: - break; - default: - error = gttwsi_send_stop(sc, flags); - } -#endif - return error; } Index: src/sys/dev/marvell/gttwsireg.h diff -u src/sys/dev/marvell/gttwsireg.h:1.3 src/sys/dev/marvell/gttwsireg.h:1.4 --- src/sys/dev/marvell/gttwsireg.h:1.3 Wed May 1 12:25:31 2013 +++ src/sys/dev/marvell/gttwsireg.h Sat Aug 3 07:39:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsireg.h,v 1.3 2013/05/01 12:25:31 rkujawa Exp $ */ +/* $NetBSD: gttwsireg.h,v 1.4 2013/08/03 07:39:31 kiyohara Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. @@ -74,12 +74,7 @@ #define TWSI_RETRY_COUNT 1000 /* retry loop count */ #define TWSI_RETRY_DELAY 1 /* retry delay */ #define TWSI_STAT_DELAY 1 /* poll status delay */ -#ifdef ARMADAXP -#define TWSI_READ_DELAY 15 /* read delay */ -#define TWSI_WRITE_DELAY 15 /* write delay */ -#else #define TWSI_READ_DELAY 2 /* read delay */ #define TWSI_WRITE_DELAY 2 /* write delay */ -#endif /* ARMADAXP */ #endif /* _GTTWSIREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Mon May 13 15:47:19 UTC 2013 Modified Files: src/sys/dev/marvell: gttwsi.c mvspireg.h Log Message: There is no opt_mvsoc.h; the #ifdef ARMADAXP should be changed to some inherited device property. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/gttwsi.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvspireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.7 src/sys/dev/marvell/gttwsi.c:1.8 --- src/sys/dev/marvell/gttwsi.c:1.7 Wed May 1 08:25:31 2013 +++ src/sys/dev/marvell/gttwsi.c Mon May 13 11:47:18 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $ */ +/* $NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.8 2013/05/13 15:47:18 christos Exp $"); #include "locators.h" #include @@ -86,8 +86,6 @@ __KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1 #include #include -#include "opt_mvsoc.h" - struct gttwsi_softc { device_t sc_dev; bus_space_tag_t sc_bust; Index: src/sys/dev/marvell/mvspireg.h diff -u src/sys/dev/marvell/mvspireg.h:1.1 src/sys/dev/marvell/mvspireg.h:1.2 --- src/sys/dev/marvell/mvspireg.h:1.1 Wed May 1 08:17:17 2013 +++ src/sys/dev/marvell/mvspireg.h Mon May 13 11:47:18 2013 @@ -35,8 +35,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBI ***/ -#include "opt_mvsoc.h" - #ifndef _MVSPIREG_H_ #define _MVSPIREG_H_
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: khorben Date: Mon May 6 23:09:34 UTC 2013 Modified Files: src/sys/dev/marvell: mvspi.c Log Message: Removed an unused variable. "go ahead" rkujawa@ To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvspi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvspi.c diff -u src/sys/dev/marvell/mvspi.c:1.1 src/sys/dev/marvell/mvspi.c:1.2 --- src/sys/dev/marvell/mvspi.c:1.1 Wed May 1 12:17:17 2013 +++ src/sys/dev/marvell/mvspi.c Mon May 6 23:09:34 2013 @@ -249,9 +249,7 @@ int mvspi_transfer(void *cookie, struct spi_transfer *st) { struct mvspi_softc *sc = cookie; - int s, er; - - er = 0; + int s; s = splbio(); spi_transq_enqueue(&sc->sc_transq, st);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:30:02 UTC 2013 Modified Files: src/sys/dev/marvell: ehci_mv.c Log Message: Support Marvell Armada XP. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/ehci_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/ehci_mv.c diff -u src/sys/dev/marvell/ehci_mv.c:1.2 src/sys/dev/marvell/ehci_mv.c:1.3 --- src/sys/dev/marvell/ehci_mv.c:1.2 Sat Oct 16 05:29:29 2010 +++ src/sys/dev/marvell/ehci_mv.c Wed May 1 12:30:02 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci_mv.c,v 1.2 2010/10/16 05:29:29 kiyohara Exp $ */ +/* $NetBSD: ehci_mv.c,v 1.3 2013/05/01 12:30:02 rkujawa Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.2 2010/10/16 05:29:29 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci_mv.c,v 1.3 2013/05/01 12:30:02 rkujawa Exp $"); #include #include @@ -290,59 +290,72 @@ mvusb_init(struct mvusb_softc *sc) bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_IPGR, reg); } + if (!(sc->sc_model == MARVELL_ARMADAXP_MV78460)) { + reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PCR); + reg &= ~MARVELL_USB_PCR_BGVSEL_MASK; + reg |= MARVELL_USB_PCR_BGVSEL_CONNECT_ANAGRP; + bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PCR, reg); + + reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, + MARVELL_USB_PTCR); + if (sc->sc_model == MARVELL_ORION_1_88F5181 && sc->sc_rev <= 1) + /* For OrionI A1/A0 rev: bit[21]=0 (TXDATA_BLOCK_EN=0) */ + reg &= ~(1 << 21); + else + reg |= (1 << 21); + /* bit[13]=1, (REG_EXT_RCAL_EN=1) */ + reg |= (1 << 13); + /* bits[6:3]=8 (IMP_CAL=8) */ + reg &= ~(0xf << 3); + reg |= (8 << 3); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PTCR, + reg); - reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PCR); - reg &= ~MARVELL_USB_PCR_BGVSEL_MASK; - reg |= MARVELL_USB_PCR_BGVSEL_CONNECT_ANAGRP; - bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PCR, reg); - - reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PTCR); - if (sc->sc_model == MARVELL_ORION_1_88F5181 && sc->sc_rev <= 1) - /* For OrionI A1/A0 rev: bit[21]=0 (TXDATA_BLOCK_EN=0) */ + reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, + MARVELL_USB_PRCR); + /* bits[8:9] - (DISCON_THRESHOLD ) */ + /* + * Orion1-A0/A1/B0=11, Orion2-A0=10, + * Orion1-B1 and Orion2-B0 later=00 + */ + reg &= ~(3 << 8); + if (sc->sc_model == MARVELL_ORION_1_88F5181 && sc->sc_rev <= 2) + reg |= (3 << 8); + else if (sc->sc_model == MARVELL_ORION_2_88F5281 && + sc->sc_rev == 0) + reg |= (2 << 8); + /* bit[21]=0 (CDR_FASTLOCK_EN=0) */ reg &= ~(1 << 21); - else - reg |= (1 << 21); - /* bit[13]=1, (REG_EXT_RCAL_EN=1) */ - reg |= (1 << 13); - /* bits[6:3]=8 (IMP_CAL=8) */ - reg &= ~(0xf << 3); - reg |= (8 << 3); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PTCR, reg); - - reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PRCR); - /* bits[8:9] - (DISCON_THRESHOLD ) */ - /* Orion1-A0/A1/B0=11, Orion2-A0=10, Orion1-B1 and Orion2-B0 later=00 */ - reg &= ~(3 << 8); - if (sc->sc_model == MARVELL_ORION_1_88F5181 && sc->sc_rev <= 2) - reg |= (3 << 8); - else if (sc->sc_model == MARVELL_ORION_2_88F5281 && sc->sc_rev == 0) - reg |= (2 << 8); - /* bit[21]=0 (CDR_FASTLOCK_EN=0) */ - reg &= ~(1 << 21); - /* bits[27:26]=0 (EDGE_DET_SEL=0) */ - reg &= ~(3 << 26); - /* bits[31:30]=3 (RXDATA_BLOCK_LENGHT=3) */ - reg |= (3 << 30); - /* bits[7:4]=1 (SQ_THRESH=1) */ - reg &= ~(0xf << 4); - reg |= (1 << 4); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PRCR, reg); - - reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PIVREFFCR); - /* bits[1:0]=2 (PLLVDD12=2)*/ - reg &= ~(3 << 0); - reg |= (2 << 0); - /* bits[5:4]=3 (RXVDD=3) */ - reg &= ~(3 << 4); - reg |= (3 << 4); - /* bit[19] (Reserved) */ - reg &= ~(1 << 19); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PIVREFFCR, reg); - - reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PTGCR); - /* bit[15]=0 (REG_FIFO_SQ_RST=0) */ - reg &= ~(1 << 15); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PTGCR, reg); + /* bits[27:26]=0 (EDGE_DET_SEL=0) */ + reg &= ~(3 << 26); + /* bits[31:30]=3 (RXDATA_BLOCK_LENGHT=3) */ + reg |= (3 << 30); + /* bits[7:4]=1 (SQ_THRESH=1) */ + reg &= ~(0xf << 4); + reg |= (1 << 4); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, MARVELL_USB_PRCR, + reg); + + reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, + MARVELL_USB_PIVREFFCR); + /* bits[1:0]=2 (PLLVDD12=2)*/ + reg &= ~(3 << 0); + reg |= (2 << 0); + /* bits[5:4]=3 (RXVDD=3) */ + reg &= ~(3 << 4); + reg |= (3 << 4); + /* bit[19] (Reserved) */ + reg &= ~(1 << 19); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, + MA
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:25:31 UTC 2013 Modified Files: src/sys/dev/marvell: gttwsi.c gttwsireg.h Log Message: TWSI controller on Armada XP is a bit different. Support that. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/gttwsi.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gttwsireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.6 src/sys/dev/marvell/gttwsi.c:1.7 --- src/sys/dev/marvell/gttwsi.c:1.6 Sat Jul 21 04:21:14 2012 +++ src/sys/dev/marvell/gttwsi.c Wed May 1 12:25:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $ */ +/* $NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.7 2013/05/01 12:25:31 rkujawa Exp $"); #include "locators.h" #include @@ -86,6 +86,8 @@ __KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1 #include #include +#include "opt_mvsoc.h" + struct gttwsi_softc { device_t sc_dev; bus_space_tag_t sc_bust; @@ -341,8 +343,13 @@ gttwsi_read_byte(void *v, uint8_t *valp, error = gttwsi_wait(sc, CONTROL_ACK, STAT_MRRD_AT, flags); if (!error) *valp = RREG(sc, TWSI_DATA); - if (flags & I2C_F_LAST) + if (flags & I2C_F_LAST) { +#if defined(ARMADAXP) + error = gttwsi_send_stop(sc, flags); +#else WREG(sc, TWSI_CONTROL, 0); +#endif + } return error; } @@ -352,6 +359,10 @@ gttwsi_write_byte(void *v, uint8_t val, struct gttwsi_softc *sc = v; WREG(sc, TWSI_DATA, val); +#if defined(ARMADAXP) + if (flags & I2C_F_LAST) + gttwsi_send_stop(sc, flags); +#endif return gttwsi_wait(sc, 0, STAT_MTDB_AR, flags); } @@ -391,6 +402,7 @@ gttwsi_wait(struct gttwsi_softc *sc, uin return EIO; } +#ifndef ARMADAXP if (flags & I2C_F_STOP) switch (expect) { case STAT_SCT: @@ -401,6 +413,7 @@ gttwsi_wait(struct gttwsi_softc *sc, uin default: error = gttwsi_send_stop(sc, flags); } +#endif return error; } Index: src/sys/dev/marvell/gttwsireg.h diff -u src/sys/dev/marvell/gttwsireg.h:1.2 src/sys/dev/marvell/gttwsireg.h:1.3 --- src/sys/dev/marvell/gttwsireg.h:1.2 Sat Jul 21 04:23:16 2012 +++ src/sys/dev/marvell/gttwsireg.h Wed May 1 12:25:31 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsireg.h,v 1.2 2012/07/21 04:23:16 kiyohara Exp $ */ +/* $NetBSD: gttwsireg.h,v 1.3 2013/05/01 12:25:31 rkujawa Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. @@ -74,7 +74,12 @@ #define TWSI_RETRY_COUNT 1000 /* retry loop count */ #define TWSI_RETRY_DELAY 1 /* retry delay */ #define TWSI_STAT_DELAY 1 /* poll status delay */ +#ifdef ARMADAXP +#define TWSI_READ_DELAY 15 /* read delay */ +#define TWSI_WRITE_DELAY 15 /* write delay */ +#else #define TWSI_READ_DELAY 2 /* read delay */ #define TWSI_WRITE_DELAY 2 /* write delay */ +#endif /* ARMADAXP */ #endif /* _GTTWSIREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:23:24 UTC 2013 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: Add IDs for Marvell Armada XP and ATTR_SDRAM registers used with IO cache coherency. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.6 src/sys/dev/marvell/marvellreg.h:1.7 --- src/sys/dev/marvell/marvellreg.h:1.6 Thu Jul 12 09:39:53 2012 +++ src/sys/dev/marvell/marvellreg.h Wed May 1 12:23:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.6 2012/07/12 09:39:53 kiyohara Exp $ */ +/* $NetBSD: marvellreg.h,v 1.7 2013/05/01 12:23:24 rkujawa Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -59,14 +59,26 @@ #define MARVELL_MV78XX0_MV78100 PCI_PRODUCT_MARVELL_MV78100 #define MARVELL_MV78XX0_MV78200 PCI_PRODUCT_MARVELL_MV78200 +#define MARVELL_ARMADAXP_MV78130 PCI_PRODUCT_MARVELL_MV78130 +#define MARVELL_ARMADAXP_MV78160 PCI_PRODUCT_MARVELL_MV78160 +#define MARVELL_ARMADAXP_MV78230 PCI_PRODUCT_MARVELL_MV78230 +#define MARVELL_ARMADAXP_MV78260 PCI_PRODUCT_MARVELL_MV78260 +#define MARVELL_ARMADAXP_MV78460 PCI_PRODUCT_MARVELL_MV78460 + #define MARVELL_DISCOVERY_REVA 0x10 #define MARVELL_DISCOVERY_REVB 0x20 - #define MARVELL_ATTR_MASK 0xff +#ifdef AURORA_IO_CACHE_COHERENCY +#define MARVELL_ATTR_SDRAM_CS0 0x1e +#define MARVELL_ATTR_SDRAM_CS1 0x1d +#define MARVELL_ATTR_SDRAM_CS2 0x1b +#define MARVELL_ATTR_SDRAM_CS3 0x17 +#else #define MARVELL_ATTR_SDRAM_CS0 0x0e #define MARVELL_ATTR_SDRAM_CS1 0x0d #define MARVELL_ATTR_SDRAM_CS2 0x0b #define MARVELL_ATTR_SDRAM_CS3 0x07 +#endif #endif /* _DEV_MARVELL_MARVELLREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:21:47 UTC 2013 Modified Files: src/sys/dev/marvell: mvpex.c Log Message: Avoid configuring root complex on MV78460. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvpex.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvpex.c diff -u src/sys/dev/marvell/mvpex.c:1.7 src/sys/dev/marvell/mvpex.c:1.8 --- src/sys/dev/marvell/mvpex.c:1.7 Fri Sep 7 04:25:37 2012 +++ src/sys/dev/marvell/mvpex.c Wed May 1 12:21:47 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mvpex.c,v 1.7 2012/09/07 04:25:37 matt Exp $ */ +/* $NetBSD: mvpex.c,v 1.8 2013/05/01 12:21:47 rkujawa Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.7 2012/09/07 04:25:37 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvpex.c,v 1.8 2013/05/01 12:21:47 rkujawa Exp $"); #include "opt_pci.h" #include "pci.h" @@ -592,6 +592,14 @@ mvpex_conf_hook(void *v, int bus, int de if (bus == 0 && dev == 0) /* don't configure GT */ return 0; + /* + * Do not configure PCI Express root complex on MV78460 - avoid + * setting up IO and memory windows. + * XXX: should also avoid that other Aramadas. + */ + else if ((dev == 0) && (PCI_PRODUCT(id) == MARVELL_ARMADAXP_MV78460)) + return 0; + return PCI_CONF_DEFAULT; }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:19:49 UTC 2013 Modified Files: src/sys/dev/marvell: mvsata_mv.c Log Message: Support SATA on Marvell Armada XP. Obtained from Marvell, Semihalf. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/mvsata_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvsata_mv.c diff -u src/sys/dev/marvell/mvsata_mv.c:1.4 src/sys/dev/marvell/mvsata_mv.c:1.5 --- src/sys/dev/marvell/mvsata_mv.c:1.4 Wed Jul 18 09:18:30 2012 +++ src/sys/dev/marvell/mvsata_mv.c Wed May 1 12:19:49 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata_mv.c,v 1.4 2012/07/18 09:18:30 kiyohara Exp $ */ +/* $NetBSD: mvsata_mv.c,v 1.5 2013/05/01 12:19:49 rkujawa Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.4 2012/07/18 09:18:30 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.5 2013/05/01 12:19:49 rkujawa Exp $"); #include #include @@ -98,6 +98,9 @@ struct mvsata_product mvsata_products[] /* Discovery Innovation */ { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 1, 2, gen2e, 0 }, { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78200, 1, 2, gen2e, 0 }, + + /* Armada XP */ + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78460, 1, 2, gen2e, 0 }, };
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rkujawa Date: Wed May 1 12:17:17 UTC 2013 Added Files: src/sys/dev/marvell: mvspi.c mvspireg.h Log Message: Add support for Marvell's SPI controller as found on Armada XP. Obtained from Semihalf. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/dev/marvell/mvspi.c \ src/sys/dev/marvell/mvspireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/dev/marvell/mvspi.c diff -u /dev/null src/sys/dev/marvell/mvspi.c:1.1 --- /dev/null Wed May 1 12:17:17 2013 +++ src/sys/dev/marvell/mvspi.c Wed May 1 12:17:17 2013 @@ -0,0 +1,368 @@ +/*** +Copyright (C) Marvell International Ltd. and its affiliates + +Developed by Semihalf + + +Marvell BSD License + +If you received this File from Marvell, you may opt to use, redistribute and/or +modify this File under the following licensing terms. +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +* Neither the name of Marvell nor the names of its contributors may be +used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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 DAMAGE. + +***/ + +/* + * Transfer mechanism extracted from arspi.c corresponding with the lines + * 254-262 in this file. + */ + +#include +#include + +#include + +#include +#include + +#include "locators.h" + +extern uint32_t mvTclk; + +struct mvspi_softc { + struct device sc_dev; + struct spi_controller sc_spi; + void *sc_ih; + bool sc_interrupts; + + struct spi_transfer *sc_transfer; + struct spi_chunk *sc_wchunk; /* For partial writes */ + struct spi_transq sc_transq; + bus_space_tag_t sc_st; + bus_space_handle_t sc_sh; + bus_size_t sc_size; +}; + +int mvspi_match(struct device *, struct cfdata *, void *); +void mvspi_attach(struct device *, struct device *, void *); +/* SPI service routines */ +int mvspi_configure(void *, int, int, int); +int mvspi_transfer(void *, struct spi_transfer *); +/* Internal support */ +void mvspi_sched(struct mvspi_softc *); +void mvspi_assert(struct mvspi_softc *sc); +void mvspi_deassert(struct mvspi_softc *sc); + +#define GETREG(sc, x) \ + bus_space_read_4(sc->sc_st, sc->sc_sh, x) +#define PUTREG(sc, x, v)\ + bus_space_write_4(sc->sc_st, sc->sc_sh, x, v) + +/* Attach structure */ +CFATTACH_DECL_NEW(mvspi_mbus, sizeof(struct mvspi_softc), +mvspi_match, mvspi_attach, NULL, NULL); + +int +mvspi_match(struct device *parent, struct cfdata *cf, void *aux) +{ + struct marvell_attach_args *mva = aux; + + if (strcmp(mva->mva_name, cf->cf_name) != 0) + return 0; + if (mva->mva_offset == MVA_OFFSET_DEFAULT || + mva->mva_irq == MVA_IRQ_DEFAULT) + return 0; + + mva->mva_size = MVSPI_SIZE; + return 1; +} + +void +mvspi_attach(struct device *parent, struct device *self, void *aux) +{ + struct mvspi_softc *sc = device_private(self); + struct marvell_attach_args *mva = aux; + struct spibus_attach_args sba; + int ctl; + + aprint_normal(": Marvell SPI controller\n"); + + /* + * Map registers. + */ + sc->sc_st = mva->mva_iot; + sc->sc_size = mva->mva_size; + + if (bus_space_subregion(sc->sc_st, mva->mva_ioh, mva->mva_offset, + mva->mva_size, &sc->sc_sh)) { + aprint_error_dev(self, "Cannot map registers\n"); + return; + } + + /* + * Initialize hardware. + */ + ctl = GETREG(sc, MVSPI_INTCONF_REG); + + ctl &= MVSPI_DIRHS_MASK; + ctl &= MVSPI_1BYTE_MASK; + + PUTREG(sc, MVSPI_INTCONF_REG, ctl), + + /* + * Initialize SPI c
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Fri Dec 28 08:16:53 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Fix a bug that a multicast filter entry is incorrectly overrode on some cases. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.33 src/sys/dev/marvell/if_mvgbe.c:1.34 --- src/sys/dev/marvell/if_mvgbe.c:1.33 Thu Dec 20 10:01:28 2012 +++ src/sys/dev/marvell/if_mvgbe.c Fri Dec 28 08:16:53 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.33 2012/12/20 10:01:28 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.34 2012/12/28 08:16:53 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.33 2012/12/20 10:01:28 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.34 2012/12/28 08:16:53 msaitoh Exp $"); #include #include @@ -2059,11 +2059,11 @@ mvgbe_filter_setup(struct mvgbe_softc *s /* chip handles some IPv4 multicast specially */ if (memcmp(enm->enm_addrlo, special, 5) == 0) { i = enm->enm_addrlo[5]; - dfsmt[i>>2] = + dfsmt[i>>2] |= MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS); } else { i = mvgbe_crc8(enm->enm_addrlo, ETHER_ADDR_LEN); - dfomt[i>>2] = + dfomt[i>>2] |= MVGBE_DF(i&3, MVGBE_DF_QUEUE(0) | MVGBE_DF_PASS); }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Dec 20 10:01:28 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Check wheter an MII PHY is really connected or not. This change privents panic if MII PHY port is not used. To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.32 src/sys/dev/marvell/if_mvgbe.c:1.33 --- src/sys/dev/marvell/if_mvgbe.c:1.32 Fri Nov 9 09:04:19 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Dec 20 10:01:28 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.32 2012/11/09 09:04:19 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.33 2012/12/20 10:01:28 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.32 2012/11/09 09:04:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.33 2012/12/20 10:01:28 msaitoh Exp $"); #include #include @@ -429,7 +429,9 @@ mvgbec_attach(device_t parent, device_t if (child) { port = device_private(child); mii = LIST_FIRST(&port->sc_mii.mii_phys); -phyaddr |= MVGBE_PHYADDR_PHYAD(j, mii->mii_phy); +if (mii != NULL) + phyaddr |= MVGBE_PHYADDR_PHYAD(j, + mii->mii_phy); } } break;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Fri Nov 9 09:04:20 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add MVGBE_EVENT_COUNTERS for debugging. Count rxoverrrun and wdogsoft. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.31 src/sys/dev/marvell/if_mvgbe.c:1.32 --- src/sys/dev/marvell/if_mvgbe.c:1.31 Thu Nov 8 15:39:29 2012 +++ src/sys/dev/marvell/if_mvgbe.c Fri Nov 9 09:04:19 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.31 2012/11/08 15:39:29 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.32 2012/11/09 09:04:19 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.31 2012/11/08 15:39:29 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.32 2012/11/09 09:04:19 msaitoh Exp $"); #include #include @@ -33,6 +33,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v #include #include #include +#include #include #include #include @@ -145,6 +146,14 @@ do { \ #define MVGBE_IPGINTTX_DEFAULT 768 #define MVGBE_IPGINTRX_DEFAULT 768 +#ifdef MVGBE_EVENT_COUNTERS +#define MVGBE_EVCNT_INCR(ev) (ev)->ev_count++ +#define MVGBE_EVCNT_ADD(ev, val) (ev)->ev_count += (val) +#else +#define MVGBE_EVCNT_INCR(ev) /* nothing */ +#define MVGBE_EVCNT_ADD(ev, val) /* nothing */ +#endif + struct mvgbe_jpool_entry { int slot; LIST_ENTRY(mvgbe_jpool_entry) jpool_entries; @@ -225,6 +234,10 @@ struct mvgbe_softc { krndsource_t sc_rnd_source; struct sysctllog *mvgbe_clog; +#ifdef MVGBE_EVENT_COUNTERS + struct evcnt sc_ev_rxoverrun; + struct evcnt sc_ev_wdogsoft; +#endif }; @@ -807,6 +820,13 @@ mvgbe_attach(device_t parent, device_t s ether_set_ifflags_cb(&sc->sc_ethercom, mvgbe_ifflags_cb); sysctl_mvgbe_init(sc); +#ifdef MVGBE_EVENT_COUNTERS + /* Attach event counters. */ + evcnt_attach_dynamic(&sc->sc_ev_rxoverrun, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "rxoverrrun"); + evcnt_attach_dynamic(&sc->sc_ev_wdogsoft, EVCNT_TYPE_MISC, + NULL, device_xname(sc->sc_dev), "wdogsoft"); +#endif rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); @@ -883,6 +903,7 @@ mvgbe_tick(void *arg) s = splnet(); mii_tick(mii); /* Need more work */ + MVGBE_EVCNT_ADD(&sc->sc_ev_rxoverrun, MVGBE_READ(sc, MVGBE_POFC)); splx(s); callout_schedule(&sc->sc_tick_ch, hz); @@ -1286,6 +1307,7 @@ mvgbe_watchdog(struct ifnet *ifp) MVGBE_WRITE(sc, MVGBE_TQC, MVGBE_TQC_ENQ); ifp->if_timer = 5; sc->sc_wdogsoft = 0; + MVGBE_EVCNT_INCR(&sc->sc_ev_wdogsoft); } else { aprint_error_ifnet(ifp, "watchdog timeout\n");
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Nov 8 15:39:30 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvgbereg.h Log Message: Fix a bug that MVGBE_JLEN is miscalculated. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/mvgbereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.30 src/sys/dev/marvell/if_mvgbe.c:1.31 --- src/sys/dev/marvell/if_mvgbe.c:1.30 Thu Nov 8 14:37:47 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Nov 8 15:39:29 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.30 2012/11/08 14:37:47 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.31 2012/11/08 15:39:29 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.30 2012/11/08 14:37:47 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.31 2012/11/08 15:39:29 msaitoh Exp $"); #include #include @@ -93,7 +93,8 @@ CTASSERT(MVGBE_RX_RING_CNT > 1 && MVGBE_ #define MVGBE_JSLOTS 384 /* */ #define MVGBE_JLEN \ -((MVGBE_MRU + MVGBE_RXBUF_ALIGN) & ~MVGBE_RXBUF_MASK) +((MVGBE_MRU + MVGBE_HWHEADER_SIZE + MVGBE_RXBUF_ALIGN - 1) & \ +~MVGBE_RXBUF_MASK) #define MVGBE_NTXSEG 30 #define MVGBE_JPAGESZ PAGE_SIZE #define MVGBE_RESID \ Index: src/sys/dev/marvell/mvgbereg.h diff -u src/sys/dev/marvell/mvgbereg.h:1.6 src/sys/dev/marvell/mvgbereg.h:1.7 --- src/sys/dev/marvell/mvgbereg.h:1.6 Tue Oct 16 19:49:41 2012 +++ src/sys/dev/marvell/mvgbereg.h Thu Nov 8 15:39:30 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvgbereg.h,v 1.6 2012/10/16 19:49:41 msaitoh Exp $ */ +/* $NetBSD: mvgbereg.h,v 1.7 2012/11/08 15:39:30 msaitoh Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -348,7 +348,7 @@ */ #define MVGBE_MRU 9022 -#define MVGBE_RXBUF_ALIGN 8 +#define MVGBE_RXBUF_ALIGN 32 /* Cache line size */ #define MVGBE_RXBUF_MASK (MVGBE_RXBUF_ALIGN - 1) #define MVGBE_HWHEADER_SIZE 2
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Nov 8 14:37:47 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: When an interrput is link change, notify link change to mii layer using mii_pollstat(). To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.29 src/sys/dev/marvell/if_mvgbe.c:1.30 --- src/sys/dev/marvell/if_mvgbe.c:1.29 Thu Nov 8 14:32:01 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Nov 8 14:37:47 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.29 2012/11/08 14:32:01 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.30 2012/11/08 14:37:47 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.29 2012/11/08 14:32:01 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.30 2012/11/08 14:37:47 msaitoh Exp $"); #include #include @@ -922,6 +922,9 @@ mvgbe_intr(void *arg) MVGBE_WRITE(sc, MVGBE_RQC, MVGBE_RQC_DISQ(0)); MVGBE_WRITE(sc, MVGBE_TQC, MVGBE_TQC_DISQ); } + + /* Notify link change event to mii layer */ + mii_pollstat(&sc->sc_mii); } if (ic & (MVGBE_IC_RXBUF | MVGBE_IC_RXERROR))
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Nov 8 14:32:02 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Don't use M_HASFCS flag. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.28 src/sys/dev/marvell/if_mvgbe.c:1.29 --- src/sys/dev/marvell/if_mvgbe.c:1.28 Thu Nov 1 02:46:41 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Nov 8 14:32:01 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.28 2012/11/01 02:46:41 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.29 2012/11/08 14:32:01 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.28 2012/11/01 02:46:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.29 2012/11/08 14:32:01 msaitoh Exp $"); #include #include @@ -1823,7 +1823,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) m = cdata->mvgbe_rx_chain[idx].mvgbe_mbuf; cdata->mvgbe_rx_chain[idx].mvgbe_mbuf = NULL; - total_len = cur_rx->bytecnt; + total_len = cur_rx->bytecnt - ETHER_CRC_LEN; rxstat = cur_rx->cmdsts; bufsize = cur_rx->bufsize; @@ -1908,7 +1908,6 @@ mvgbe_rxeof(struct mvgbe_softc *sc) /* Skip on first 2byte (HW header) */ m_adj(m, MVGBE_HWHEADER_SIZE); - m->m_flags |= M_HASFCS; ifp->if_ipackets++;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Nov 1 02:46:41 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: No functional change. - Change style a bit. - use "csc" for the variable name of struct mvgbec_softc in mvgbec_attach() for consistency. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.27 src/sys/dev/marvell/if_mvgbe.c:1.28 --- src/sys/dev/marvell/if_mvgbe.c:1.27 Fri Oct 26 21:03:26 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Nov 1 02:46:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.28 2012/11/01 02:46:41 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.28 2012/11/01 02:46:41 msaitoh Exp $"); #include #include @@ -92,7 +92,8 @@ CTASSERT(MVGBE_RX_RING_CNT > 1 && MVGBE_ (MVGBE_RX_RING_CNT + 1) % MVGBE_RX_RING_CNT); #define MVGBE_JSLOTS 384 /* */ -#define MVGBE_JLEN ((MVGBE_MRU + MVGBE_RXBUF_ALIGN)&~MVGBE_RXBUF_MASK) +#define MVGBE_JLEN \ +((MVGBE_MRU + MVGBE_RXBUF_ALIGN) & ~MVGBE_RXBUF_MASK) #define MVGBE_NTXSEG 30 #define MVGBE_JPAGESZ PAGE_SIZE #define MVGBE_RESID \ @@ -274,8 +275,10 @@ static void mvgbe_filter_setup(struct mv #ifdef MVGBE_DEBUG static void mvgbe_dump_txdesc(struct mvgbe_tx_desc *, int); #endif -static int mvgbe_ipginttx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int); -static int mvgbe_ipgintrx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int); +static int mvgbe_ipginttx(struct mvgbec_softc *, struct mvgbe_softc *, +unsigned int); +static int mvgbe_ipgintrx(struct mvgbec_softc *, struct mvgbe_softc *, +unsigned int); static void sysctl_mvgbe_init(struct mvgbe_softc *); static int mvgbe_sysctl_ipginttx(SYSCTLFN_PROTO); static int mvgbe_sysctl_ipgintrx(SYSCTLFN_PROTO); @@ -358,7 +361,7 @@ mvgbec_match(device_t parent, cfdata_t m static void mvgbec_attach(device_t parent, device_t self, void *aux) { - struct mvgbec_softc *sc = device_private(self); + struct mvgbec_softc *csc = device_private(self); struct marvell_attach_args *mva = aux, gbea; struct mvgbe_softc *port; struct mii_softc *mii; @@ -369,10 +372,10 @@ mvgbec_attach(device_t parent, device_t aprint_naive("\n"); aprint_normal(": Marvell Gigabit Ethernet Controller\n"); - sc->sc_dev = self; - sc->sc_iot = mva->mva_iot; + csc->sc_dev = self; + csc->sc_iot = mva->mva_iot; if (bus_space_subregion(mva->mva_iot, mva->mva_ioh, mva->mva_offset, - mva->mva_size, &sc->sc_ioh)) { + mva->mva_size, &csc->sc_ioh)) { aprint_error_dev(self, "Cannot map registers\n"); return; } @@ -381,15 +384,15 @@ mvgbec_attach(device_t parent, device_t mvgbec0 = self; phyaddr = 0; - MVGBE_WRITE(sc, MVGBE_PHYADDR, phyaddr); + MVGBE_WRITE(csc, MVGBE_PHYADDR, phyaddr); - mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NET); + mutex_init(&csc->sc_mtx, MUTEX_DEFAULT, IPL_NET); /* Disable and clear Gigabit Ethernet Unit interrupts */ - MVGBE_WRITE(sc, MVGBE_EUIM, 0); - MVGBE_WRITE(sc, MVGBE_EUIC, 0); + MVGBE_WRITE(csc, MVGBE_EUIM, 0); + MVGBE_WRITE(csc, MVGBE_EUIC, 0); - mvgbec_wininit(sc); + mvgbec_wininit(csc); memset(&gbea, 0, sizeof(gbea)); for (i = 0; i < __arraycount(mvgbe_ports); i++) { @@ -397,17 +400,17 @@ mvgbec_attach(device_t parent, device_t mvgbe_ports[i].unit != mva->mva_unit) continue; - sc->sc_flags = mvgbe_ports[i].flags; + csc->sc_flags = mvgbe_ports[i].flags; for (j = 0; j < mvgbe_ports[i].ports; j++) { gbea.mva_name = "mvgbe"; gbea.mva_model = mva->mva_model; - gbea.mva_iot = sc->sc_iot; - gbea.mva_ioh = sc->sc_ioh; + gbea.mva_iot = csc->sc_iot; + gbea.mva_ioh = csc->sc_ioh; gbea.mva_unit = j; gbea.mva_dmat = mva->mva_dmat; gbea.mva_irq = mvgbe_ports[i].irqs[j]; - child = config_found_sm_loc(sc->sc_dev, "mvgbec", NULL, + child = config_found_sm_loc(csc->sc_dev, "mvgbec", NULL, &gbea, mvgbec_print, mvgbec_search); if (child) { port = device_private(child); @@ -417,7 +420,7 @@ mvgbec_attach(device_t parent, device_t } break; } - MVGBE_WRITE(sc, MVGBE_PHYADDR, phyaddr); + MVGBE_WRITE(csc, MVGBE_PHYADDR, phyaddr); } static int
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Fri Oct 26 21:03:26 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add missing mii_tick() call. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.26 src/sys/dev/marvell/if_mvgbe.c:1.27 --- src/sys/dev/marvell/if_mvgbe.c:1.26 Wed Oct 17 18:12:59 2012 +++ src/sys/dev/marvell/if_mvgbe.c Fri Oct 26 21:03:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,13 +25,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.27 2012/10/26 21:03:26 msaitoh Exp $"); #include #include +#include #include #include #include +#include #include #include #include @@ -198,13 +200,15 @@ struct mvgbe_softc { bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; - bus_space_handle_t sc_dafh; /* dest address filter handle */ + bus_space_handle_t sc_dafh; /* dest address filter handle */ bus_dma_tag_t sc_dmat; struct ethercom sc_ethercom; struct mii_data sc_mii; u_int8_t sc_enaddr[ETHER_ADDR_LEN]; /* station addr */ + callout_t sc_tick_ch; /* tick callout */ + struct mvgbe_chain_data sc_cdata; struct mvgbe_ring_data *sc_rdata; bus_dmamap_t sc_ring_map; @@ -242,6 +246,7 @@ static void mvgbec_wininit(struct mvgbec static int mvgbe_match(device_t, struct cfdata *, void *); static void mvgbe_attach(device_t, device_t, void *); +static void mvgbe_tick(void *); static int mvgbe_intr(void *); static void mvgbe_start(struct ifnet *); @@ -646,6 +651,8 @@ mvgbe_attach(device_t parent, device_t s sc->sc_dev = self; sc->sc_port = mva->mva_unit; sc->sc_iot = mva->mva_iot; + callout_init(&sc->sc_tick_ch, 0); + callout_setfunc(&sc->sc_tick_ch, mvgbe_tick, sc); if (bus_space_subregion(mva->mva_iot, mva->mva_ioh, MVGBE_PORTR_BASE + mva->mva_unit * MVGBE_PORTR_SIZE, MVGBE_PORTR_SIZE, &sc->sc_ioh)) { @@ -862,6 +869,21 @@ mvgbe_ipgintrx(struct mvgbec_softc *csc, return 0; } +static void +mvgbe_tick(void *arg) +{ + struct mvgbe_softc *sc = arg; + struct mii_data *mii = &sc->sc_mii; + int s; + + s = splnet(); + mii_tick(mii); + /* Need more work */ + splx(s); + + callout_schedule(&sc->sc_tick_ch, hz); +} + static int mvgbe_intr(void *arg) { @@ -1119,6 +1141,8 @@ mvgbe_init(struct ifnet *ifp) MVGBE_ICE_TXERR | MVGBE_ICE_LINKCHG); + callout_schedule(&sc->sc_tick_ch, hz); + ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; @@ -1137,6 +1161,8 @@ mvgbe_stop(struct ifnet *ifp, int disabl DPRINTFN(2, ("mvgbe_stop\n")); + callout_stop(&sc->sc_tick_ch); + /* Stop Rx port activity. Check port Rx activity. */ reg = MVGBE_READ(sc, MVGBE_RQC); if (reg & MVGBE_RQC_ENQ_MASK)
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Wed Oct 17 18:13:00 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Fix a bug that kernel panics when the system get a packet while calling mvgbe_stop (via ifconfig down). To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.25 src/sys/dev/marvell/if_mvgbe.c:1.26 --- src/sys/dev/marvell/if_mvgbe.c:1.25 Tue Oct 16 19:49:41 2012 +++ src/sys/dev/marvell/if_mvgbe.c Wed Oct 17 18:12:59 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.26 2012/10/17 18:12:59 msaitoh Exp $"); #include #include @@ -885,6 +885,9 @@ mvgbe_intr(void *arg) claimed = 1; + if (!(ifp->if_flags & IFF_RUNNING)) + break; + if (ice & MVGBE_ICE_LINKCHG) { if (MVGBE_READ(sc, MVGBE_PS) & MVGBE_PS_LINKUP) { /* Enable port RX and TX. */ @@ -1127,6 +1130,7 @@ static void mvgbe_stop(struct ifnet *ifp, int disable) { struct mvgbe_softc *sc = ifp->if_softc; + struct mvgbec_softc *csc = device_private(device_parent(sc->sc_dev)); struct mvgbe_chain_data *cdata = &sc->sc_cdata; uint32_t reg; int i, cnt; @@ -1199,7 +1203,16 @@ mvgbe_stop(struct ifnet *ifp, int disabl reg = MVGBE_READ(sc, MVGBE_PSC); MVGBE_WRITE(sc, MVGBE_PSC, reg & ~MVGBE_PSC_PORTEN); - /* Disable interrupts */ + /* + * Disable and clear interrupts + * 0) controller interrupt + * 1) port interrupt cause + * 2) port interrupt mask + */ + MVGBE_WRITE(csc, MVGBE_EUIM, 0); + MVGBE_WRITE(csc, MVGBE_EUIC, 0); + MVGBE_WRITE(sc, MVGBE_IC, 0); + MVGBE_WRITE(sc, MVGBE_ICE, 0); MVGBE_WRITE(sc, MVGBE_PIM, 0); MVGBE_WRITE(sc, MVGBE_PEIM, 0);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Tue Oct 16 19:49:41 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvgbereg.h Log Message: Add code to modify interrupt coalescing with sysctl. - both TX side an RX side. - different setting for each port - TX side is hw.mvgbe.mvgbe*.ipginttx - RX side is hw.mvgbe.mvgbe*.ipgintrx - The default value is 768. - The lowest value is 0 - For highest value, 0x3777 is used for V1, and 0x is used for V2. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvgbereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.24 src/sys/dev/marvell/if_mvgbe.c:1.25 --- src/sys/dev/marvell/if_mvgbe.c:1.24 Sun Oct 14 19:17:08 2012 +++ src/sys/dev/marvell/if_mvgbe.c Tue Oct 16 19:49:41 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $"); #include #include @@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v #include #include #include +#include #include #include @@ -137,6 +138,8 @@ do { \ MVGBE_CDRXOFF((x)), sizeof(struct mvgbe_rx_desc), (ops)); \ } while (/*CONSTCOND*/0) +#define MVGBE_IPGINTTX_DEFAULT 768 +#define MVGBE_IPGINTRX_DEFAULT 768 struct mvgbe_jpool_entry { int slot; @@ -206,7 +209,8 @@ struct mvgbe_softc { struct mvgbe_ring_data *sc_rdata; bus_dmamap_t sc_ring_map; int sc_if_flags; - int sc_ipg_rx; + unsigned int sc_ipginttx; + unsigned int sc_ipgintrx; int sc_wdogsoft; LIST_HEAD(__mvgbe_jfreehead, mvgbe_jpool_entry) sc_jfree_listhead; @@ -214,6 +218,7 @@ struct mvgbe_softc { SIMPLEQ_HEAD(__mvgbe_txmaphead, mvgbe_txmap_entry) sc_txmap_head; krndsource_t sc_rnd_source; + struct sysctllog *mvgbe_clog; }; @@ -264,7 +269,11 @@ static void mvgbe_filter_setup(struct mv #ifdef MVGBE_DEBUG static void mvgbe_dump_txdesc(struct mvgbe_tx_desc *, int); #endif -static uint32_t mvgbe_ipg_rx(struct mvgbec_softc *, struct mvgbe_softc *); +static int mvgbe_ipginttx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int); +static int mvgbe_ipgintrx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int); +static void sysctl_mvgbe_init(struct mvgbe_softc *); +static int mvgbe_sysctl_ipginttx(SYSCTLFN_PROTO); +static int mvgbe_sysctl_ipgintrx(SYSCTLFN_PROTO); CFATTACH_DECL_NEW(mvgbec_gt, sizeof(struct mvgbec_softc), mvgbec_match, mvgbec_attach, NULL, NULL); @@ -275,6 +284,7 @@ CFATTACH_DECL_NEW(mvgbe, sizeof(struct m mvgbe_match, mvgbe_attach, NULL, NULL); device_t mvgbec0 = NULL; +static int mvgbe_root_num; struct mvgbe_port { int model; @@ -785,6 +795,7 @@ mvgbe_attach(device_t parent, device_t s ether_ifattach(ifp, sc->sc_enaddr); ether_set_ifflags_cb(&sc->sc_ethercom, mvgbe_ifflags_cb); + sysctl_mvgbe_init(sc); rnd_attach_source(&sc->sc_rnd_source, device_xname(sc->sc_dev), RND_TYPE_NET, 0); @@ -805,17 +816,50 @@ fail1: return; } -static uint32_t -mvgbe_ipg_rx(struct mvgbec_softc *csc, struct mvgbe_softc *sc) +static int +mvgbe_ipginttx(struct mvgbec_softc *csc, struct mvgbe_softc *sc, +unsigned int ipginttx) { + uint32_t reg; + reg = MVGBE_READ(sc, MVGBE_PTFUT); - if (csc->sc_flags & FLAGS_IPG2) - return (((sc->sc_ipg_rx & 0x8000) << 10) | - ((sc->sc_ipg_rx & 0x7fff) << 7)); - else if (csc->sc_flags & FLAGS_IPG1) - return ((sc->sc_ipg_rx & 0x3fff) << 8); - else - return 0; + if (csc->sc_flags & FLAGS_IPG2) { + if (ipginttx > MVGBE_PTFUT_IPGINTTX_V2_MAX) + return -1; + reg &= ~MVGBE_PTFUT_IPGINTTX_V2_MASK; + reg |= MVGBE_PTFUT_IPGINTTX_V2(ipginttx); + } else if (csc->sc_flags & FLAGS_IPG1) { + if (ipginttx > MVGBE_PTFUT_IPGINTTX_V1_MAX) + return -1; + reg &= ~MVGBE_PTFUT_IPGINTTX_V1_MASK; + reg |= MVGBE_PTFUT_IPGINTTX_V1(ipginttx); + } + MVGBE_WRITE(sc, MVGBE_PTFUT, reg); + + return 0; +} + +static int +mvgbe_ipgintrx(struct mvgbec_softc *csc, struct mvgbe_softc *sc, +unsigned int ipgintrx) +{ + uint32_t reg; + reg = MVGBE_READ(sc, MVGBE_SDC); + + if (csc->sc_flags & FLAGS_IPG2) { + if (ipgintrx > MVGBE_SDC_IPGINTRX_V2_MAX) + return -1; + reg &= ~MVGBE_SDC_IPGINTRX_V2_MASK; + reg |= MVGBE_SDC_IPGINTRX_V2(ipgintrx); + } else if (csc->sc_flags & FLAGS_IPG1) { + if (ipgintrx > MVGBE_SDC_IPGINTRX_V1_MAX) + return -1; + reg &= ~MVGBE_SDC_IPGINTRX_V1_MASK; + reg |= MVGBE_SDC_IPGINTRX_V1(ipgintrx); + } + MVGBE_WRITE(sc, MVGBE_SDC, reg); + + return
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Sun Oct 14 19:17:08 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add Interrupt Coalescing setting by Robert Swindells. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.23 src/sys/dev/marvell/if_mvgbe.c:1.24 --- src/sys/dev/marvell/if_mvgbe.c:1.23 Fri Oct 12 10:38:06 2012 +++ src/sys/dev/marvell/if_mvgbe.c Sun Oct 14 19:17:08 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $"); #include #include @@ -206,6 +206,7 @@ struct mvgbe_softc { struct mvgbe_ring_data *sc_rdata; bus_dmamap_t sc_ring_map; int sc_if_flags; + int sc_ipg_rx; int sc_wdogsoft; LIST_HEAD(__mvgbe_jfreehead, mvgbe_jpool_entry) sc_jfree_listhead; @@ -263,6 +264,7 @@ static void mvgbe_filter_setup(struct mv #ifdef MVGBE_DEBUG static void mvgbe_dump_txdesc(struct mvgbe_tx_desc *, int); #endif +static uint32_t mvgbe_ipg_rx(struct mvgbec_softc *, struct mvgbe_softc *); CFATTACH_DECL_NEW(mvgbec_gt, sizeof(struct mvgbec_softc), mvgbec_match, mvgbec_attach, NULL, NULL); @@ -282,6 +284,8 @@ struct mvgbe_port { int flags; #define FLAGS_FIX_TQTB (1 << 0) #define FLAGS_FIX_MTU (1 << 1) +#define FLAGS_IPG1 (1 << 2) +#define FLAGS_IPG2 (1 << 3) } mvgbe_ports[] = { { MARVELL_DISCOVERY_II, 0, 3, { 32, 33, 34 }, 0 }, { MARVELL_DISCOVERY_III, 0, 3, { 32, 33, 34 }, 0 }, @@ -292,26 +296,26 @@ struct mvgbe_port { #endif { MARVELL_ORION_1_88F5082, 0, 1, { 21 }, FLAGS_FIX_MTU }, { MARVELL_ORION_1_88F5180N, 0, 1, { 21 }, FLAGS_FIX_MTU }, - { MARVELL_ORION_1_88F5181, 0, 1, { 21 }, FLAGS_FIX_MTU }, - { MARVELL_ORION_1_88F5182, 0, 1, { 21 }, FLAGS_FIX_MTU }, - { MARVELL_ORION_2_88F5281, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88F5181, 0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 }, + { MARVELL_ORION_1_88F5182, 0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 }, + { MARVELL_ORION_2_88F5281, 0, 1, { 21 }, FLAGS_FIX_MTU | FLAGS_IPG1 }, { MARVELL_ORION_1_88F6082, 0, 1, { 21 }, FLAGS_FIX_MTU }, { MARVELL_ORION_1_88W8660, 0, 1, { 21 }, FLAGS_FIX_MTU }, - { MARVELL_KIRKWOOD_88F6180, 0, 1, { 11 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6192, 0, 1, { 11 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6192, 1, 1, { 15 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6281, 0, 1, { 11 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6281, 1, 1, { 15 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6282, 0, 1, { 11 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6282, 1, 1, { 15 }, FLAGS_FIX_TQTB }, - - { MARVELL_MV78XX0_MV78100, 0, 1, { 40 }, FLAGS_FIX_TQTB }, - { MARVELL_MV78XX0_MV78100, 1, 1, { 44 }, FLAGS_FIX_TQTB }, - { MARVELL_MV78XX0_MV78200, 0, 1, { 40 }, FLAGS_FIX_TQTB }, - { MARVELL_MV78XX0_MV78200, 1, 1, { 44 }, FLAGS_FIX_TQTB }, - { MARVELL_MV78XX0_MV78200, 2, 1, { 48 }, FLAGS_FIX_TQTB }, - { MARVELL_MV78XX0_MV78200, 3, 1, { 52 }, FLAGS_FIX_TQTB }, + { MARVELL_KIRKWOOD_88F6180, 0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6192, 0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6192, 1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6281, 0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6281, 1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6282, 0, 1, { 11 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_KIRKWOOD_88F6282, 1, 1, { 15 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + + { MARVELL_MV78XX0_MV78100, 0, 1, { 40 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_MV78XX0_MV78100, 1, 1, { 44 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_MV78XX0_MV78200, 0, 1, { 40 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_MV78XX0_MV78200, 1, 1, { 44 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_MV78XX0_MV78200, 2, 1, { 48 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, + { MARVELL_MV78XX0_MV78200, 3, 1, { 52 }, FLAGS_FIX_TQTB | FLAGS_IPG2 }, }; @@ -801,6 +805,18 @@ fail1: return; } +static uint32_t +mvgbe_ipg_rx(struct mvgbec_softc *csc, struct mvgbe_softc *sc) +{ + + if (csc->sc_flags & FLAGS_IPG2) + return (((sc->sc_ipg_rx & 0x8000) << 10) | + ((sc->sc_ipg_rx & 0x7fff) << 7)); + else if (csc->sc_flags & FLAGS_IPG1) + return ((sc->sc_ipg_rx & 0x3fff) << 8); + else + return 0; +} static int mvgbe_intr(void *arg) @@ -974,6 +990,8 @@ mvgbe_init(struct ifnet *ifp) return ENOBUFS; } + if ((csc->sc_flags & FL
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Fri Oct 12 10:38:06 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvgbereg.h Log Message: - The MVGBE_RX_MAX_FRAME_LEN_ERROR bit is used to check whether a packet is fragmented or not, so define new MVGBE_RX_IP_FRAGMENT with the same value and use it. - Remove the checking whether a packet length is lower than 72 octet. This check is not used in Linux and FreeBSD. Tested with me (for Kirkwood) and Kiyohara (for DiscoveryII). To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/marvell/mvgbereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.22 src/sys/dev/marvell/if_mvgbe.c:1.23 --- src/sys/dev/marvell/if_mvgbe.c:1.22 Thu Oct 4 14:21:00 2012 +++ src/sys/dev/marvell/if_mvgbe.c Fri Oct 12 10:38:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.23 2012/10/12 10:38:06 msaitoh Exp $"); #include #include @@ -1741,9 +1741,6 @@ mvgbe_rxeof(struct mvgbe_softc *sc) continue; } - if (total_len <= MVGBE_RX_CSUM_MIN_BYTE) /* XXX documented? */ - goto sw_csum; - if (rxstat & MVGBE_RX_IP_FRAME_TYPE) { int flgs = 0; @@ -1751,8 +1748,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) flgs |= M_CSUM_IPv4; if (!(rxstat & MVGBE_RX_IP_HEADER_OK)) flgs |= M_CSUM_IPv4_BAD; - else if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR) - == 0) { + else if ((bufsize & MVGBE_RX_IP_FRAGMENT) == 0) { /* * Check TCPv4/UDPv4 checksum for * non-fragmented packet only. @@ -1775,7 +1771,6 @@ mvgbe_rxeof(struct mvgbe_softc *sc) } m->m_pkthdr.csum_flags = flgs; } -sw_csum: /* * Try to allocate a new jumbo buffer. If that Index: src/sys/dev/marvell/mvgbereg.h diff -u src/sys/dev/marvell/mvgbereg.h:1.4 src/sys/dev/marvell/mvgbereg.h:1.5 --- src/sys/dev/marvell/mvgbereg.h:1.4 Thu Oct 4 14:21:00 2012 +++ src/sys/dev/marvell/mvgbereg.h Fri Oct 12 10:38:06 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvgbereg.h,v 1.4 2012/10/04 14:21:00 msaitoh Exp $ */ +/* $NetBSD: mvgbereg.h,v 1.5 2012/10/12 10:38:06 msaitoh Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -431,4 +431,6 @@ struct mvgbe_rx_desc { #define MVGBE_RX_ENABLE_INTERRUPT (1 << 29) #define MVGBE_RX_L4_CHECKSUM_OK (1 << 30) +#define MVGBE_RX_IP_FRAGMENT (1 << 2) + #endif /* _MVGEREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Oct 4 14:21:00 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c mvgbereg.h Log Message: Fix udpcsum-rx bug on fragmented case this time. - Fix the usage of a local variable for csum_flags. - It seemd that sometimes MVGBE_RX_L4_CHECKSUM_OK bit were set to 0 even if the checksum is correct and the packet was not fragmented. So we don't set M_CSUM_TCP_UDP_BAD even if csum bit is 0. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/marvell/if_mvgbe.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvgbereg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.21 src/sys/dev/marvell/if_mvgbe.c:1.22 --- src/sys/dev/marvell/if_mvgbe.c:1.21 Tue Oct 2 15:22:46 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Oct 4 14:21:00 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.22 2012/10/04 14:21:00 msaitoh Exp $"); #include #include @@ -1748,26 +1748,31 @@ mvgbe_rxeof(struct mvgbe_softc *sc) int flgs = 0; /* Check IPv4 header checksum */ - m->m_pkthdr.csum_flags |= M_CSUM_IPv4; + flgs |= M_CSUM_IPv4; if (!(rxstat & MVGBE_RX_IP_HEADER_OK)) flgs |= M_CSUM_IPv4_BAD; - - /* Check TCPv4/UDPv4 checksum */ - if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR) == 0) { -/* Not fragmented */ - -if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == -MVGBE_RX_L4_TYPE_TCP) + else if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR) + == 0) { +/* + * Check TCPv4/UDPv4 checksum for + * non-fragmented packet only. + * + * It seemd that sometimes + * MVGBE_RX_L4_CHECKSUM_OK bit was set to 0 + * even if the checksum is correct and the + * packet was not fragmented. So we don't set + * M_CSUM_TCP_UDP_BAD even if csum bit is 0. + */ + +if (((rxstat & MVGBE_RX_L4_TYPE_MASK) == + MVGBE_RX_L4_TYPE_TCP) && +((rxstat & MVGBE_RX_L4_CHECKSUM_OK) != 0)) flgs |= M_CSUM_TCPv4; -else if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == -MVGBE_RX_L4_TYPE_UDP) +else if (((rxstat & MVGBE_RX_L4_TYPE_MASK) == + MVGBE_RX_L4_TYPE_UDP) && +((rxstat & MVGBE_RX_L4_CHECKSUM_OK) != 0)) flgs |= M_CSUM_UDPv4; - -if (((flgs & (M_CSUM_TCPv4|M_CSUM_UDPv4)) != 0) -&& !(rxstat & MVGBE_RX_L4_CHECKSUM)) - flgs |= M_CSUM_TCP_UDP_BAD; } - m->m_pkthdr.csum_flags = flgs; } sw_csum: Index: src/sys/dev/marvell/mvgbereg.h diff -u src/sys/dev/marvell/mvgbereg.h:1.3 src/sys/dev/marvell/mvgbereg.h:1.4 --- src/sys/dev/marvell/mvgbereg.h:1.3 Tue Feb 1 23:40:12 2011 +++ src/sys/dev/marvell/mvgbereg.h Thu Oct 4 14:21:00 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvgbereg.h,v 1.3 2011/02/01 23:40:12 jakllsch Exp $ */ +/* $NetBSD: mvgbereg.h,v 1.4 2012/10/04 14:21:00 msaitoh Exp $ */ /* * Copyright (c) 2007 KIYOHARA Takashi * All rights reserved. @@ -429,6 +429,6 @@ struct mvgbe_rx_desc { #define MVGBE_RX_FIRST_DESC (1 << 27) #define MVGBE_RX_UNKNOWN_DA (1 << 28) #define MVGBE_RX_ENABLE_INTERRUPT (1 << 29) -#define MVGBE_RX_L4_CHECKSUM (1 << 30) +#define MVGBE_RX_L4_CHECKSUM_OK (1 << 30) #endif /* _MVGEREG_H_ */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Tue Oct 2 15:22:46 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: - Fix a bug that a fragmented packet is marked as bad checksum. It causes a real bug when HW checksum offload function is used. It was easy to reproduce with NFS UDP mount. - Fix a potential bug that a packet other than TCP and UDP is marked as bad checksum. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.20 src/sys/dev/marvell/if_mvgbe.c:1.21 --- src/sys/dev/marvell/if_mvgbe.c:1.20 Fri Sep 21 00:26:15 2012 +++ src/sys/dev/marvell/if_mvgbe.c Tue Oct 2 15:22:46 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.20 2012/09/21 00:26:15 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.20 2012/09/21 00:26:15 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.21 2012/10/02 15:22:46 msaitoh Exp $"); #include #include @@ -1676,6 +1676,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) struct mbuf *m; bus_dmamap_t dmamap; uint32_t rxstat; + uint16_t bufsize; int idx, cur, total_len; idx = sc->sc_cdata.mvgbe_rx_prod; @@ -1715,6 +1716,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) cdata->mvgbe_rx_chain[idx].mvgbe_mbuf = NULL; total_len = cur_rx->bytecnt; rxstat = cur_rx->cmdsts; + bufsize = cur_rx->bufsize; cdata->mvgbe_rx_map[idx] = NULL; @@ -1743,20 +1745,30 @@ mvgbe_rxeof(struct mvgbe_softc *sc) goto sw_csum; if (rxstat & MVGBE_RX_IP_FRAME_TYPE) { + int flgs = 0; + /* Check IPv4 header checksum */ m->m_pkthdr.csum_flags |= M_CSUM_IPv4; if (!(rxstat & MVGBE_RX_IP_HEADER_OK)) -m->m_pkthdr.csum_flags |= -M_CSUM_IPv4_BAD; +flgs |= M_CSUM_IPv4_BAD; + /* Check TCPv4/UDPv4 checksum */ - if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == - MVGBE_RX_L4_TYPE_TCP) -m->m_pkthdr.csum_flags |= M_CSUM_TCPv4; - else if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == - MVGBE_RX_L4_TYPE_UDP) -m->m_pkthdr.csum_flags |= M_CSUM_UDPv4; - if (!(rxstat & MVGBE_RX_L4_CHECKSUM)) -m->m_pkthdr.csum_flags |= M_CSUM_TCP_UDP_BAD; + if ((bufsize & MVGBE_RX_MAX_FRAME_LEN_ERROR) == 0) { +/* Not fragmented */ + +if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == +MVGBE_RX_L4_TYPE_TCP) + flgs |= M_CSUM_TCPv4; +else if ((rxstat & MVGBE_RX_L4_TYPE_MASK) == +MVGBE_RX_L4_TYPE_UDP) + flgs |= M_CSUM_UDPv4; + +if (((flgs & (M_CSUM_TCPv4|M_CSUM_UDPv4)) != 0) +&& !(rxstat & MVGBE_RX_L4_CHECKSUM)) + flgs |= M_CSUM_TCP_UDP_BAD; + } + + m->m_pkthdr.csum_flags = flgs; } sw_csum:
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Fri Sep 21 00:26:15 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Fix device timeout problem. - Change the synching order of descriptors. First, sync descriptors except first and then sync the first descriptor. - To recover from an race condition, reduce the if_timer from 5 to 1 and when timeout occur write MVGBE_TQC_ENQ bit again. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.19 src/sys/dev/marvell/if_mvgbe.c:1.20 --- src/sys/dev/marvell/if_mvgbe.c:1.19 Thu Sep 6 03:45:02 2012 +++ src/sys/dev/marvell/if_mvgbe.c Fri Sep 21 00:26:15 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.19 2012/09/06 03:45:02 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.20 2012/09/21 00:26:15 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.19 2012/09/06 03:45:02 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.20 2012/09/21 00:26:15 msaitoh Exp $"); #include #include @@ -206,6 +206,7 @@ struct mvgbe_softc { struct mvgbe_ring_data *sc_rdata; bus_dmamap_t sc_ring_map; int sc_if_flags; + int sc_wdogsoft; LIST_HEAD(__mvgbe_jfreehead, mvgbe_jpool_entry) sc_jfree_listhead; LIST_HEAD(__mvgbe_jinusehead, mvgbe_jpool_entry) sc_jinuse_listhead; @@ -903,7 +904,8 @@ mvgbe_start(struct ifnet *ifp) /* * Set a timeout in case the chip goes out to lunch. */ - ifp->if_timer = 5; + ifp->if_timer = 1; + sc->sc_wdogsoft = 1; } } @@ -1162,11 +1164,22 @@ mvgbe_watchdog(struct ifnet *ifp) */ mvgbe_txeof(sc); if (sc->sc_cdata.mvgbe_tx_cnt != 0) { - aprint_error_ifnet(ifp, "watchdog timeout\n"); + if (sc->sc_wdogsoft) { + /* + * There is race condition between CPU and DMA + * engine. When DMA engine encounters queue end, + * it clears MVGBE_TQC_ENQ bit. + */ + MVGBE_WRITE(sc, MVGBE_TQC, MVGBE_TQC_ENQ); + ifp->if_timer = 5; + sc->sc_wdogsoft = 0; + } else { + aprint_error_ifnet(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + ifp->if_oerrors++; - mvgbe_init(ifp); + mvgbe_init(ifp); + } } } @@ -1589,7 +1602,8 @@ do_defrag: f = &sc->sc_rdata->mvgbe_tx_ring[current]; f->bufptr = txseg[i].ds_addr; f->bytecnt = txseg[i].ds_len; - f->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA; + if (i != 0) + f->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA; last = current; current = MVGBE_TX_RING_NEXT(current); } @@ -1610,7 +1624,6 @@ do_defrag: } if (txmap->dm_nsegs == 1) f->cmdsts = cmdsts | - MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_TX_GENERATE_CRC | MVGBE_TX_ENABLE_INTERRUPT | MVGBE_TX_ZERO_PADDING | @@ -1619,7 +1632,6 @@ do_defrag: else { f = &sc->sc_rdata->mvgbe_tx_ring[first]; f->cmdsts = cmdsts | - MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_TX_GENERATE_CRC | MVGBE_TX_FIRST_DESC; @@ -1629,14 +1641,22 @@ do_defrag: MVGBE_TX_ENABLE_INTERRUPT | MVGBE_TX_ZERO_PADDING | MVGBE_TX_LAST_DESC; + + /* Sync descriptors except first */ + MVGBE_CDTXSYNC(sc, + (MVGBE_TX_RING_CNT - 1 == *txidx) ? 0 : (*txidx) + 1, + txmap->dm_nsegs - 1, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); } sc->sc_cdata.mvgbe_tx_chain[last].mvgbe_mbuf = m_head; SIMPLEQ_REMOVE_HEAD(&sc->sc_txmap_head, link); sc->sc_cdata.mvgbe_tx_map[last] = entry; - /* Sync descriptors before handing to chip */ - MVGBE_CDTXSYNC(sc, *txidx, txmap->dm_nsegs, + /* Finally, sync first descriptor */ + sc->sc_rdata->mvgbe_tx_ring[first].cmdsts |= + MVGBE_BUFFER_OWNED_BY_DMA; + MVGBE_CDTXSYNC(sc, *txidx, 1, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->sc_cdata.mvgbe_tx_cnt += i;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Mon Sep 10 13:36:40 UTC 2012 Modified Files: src/sys/dev/marvell: gtidmac.c Log Message: Add "static". To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/gtidmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmac.c diff -u src/sys/dev/marvell/gtidmac.c:1.8 src/sys/dev/marvell/gtidmac.c:1.9 --- src/sys/dev/marvell/gtidmac.c:1.8 Mon Jul 23 06:09:47 2012 +++ src/sys/dev/marvell/gtidmac.c Mon Sep 10 13:36:40 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: gtidmac.c,v 1.8 2012/07/23 06:09:47 kiyohara Exp $ */ +/* $NetBSD: gtidmac.c,v 1.9 2012/09/10 13:36:40 msaitoh Exp $ */ /* * Copyright (c) 2008, 2012 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.8 2012/07/23 06:09:47 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.9 2012/09/10 13:36:40 msaitoh Exp $"); #include #include @@ -155,9 +155,9 @@ static void gtidmac_process(struct dmove static void gtidmac_dmover_run(struct dmover_backend *); static void gtidmac_dmover_done(void *, int, bus_dmamap_t *, bus_dmamap_t *, int); -__inline int gtidmac_dmmap_load(struct gtidmac_softc *, bus_dmamap_t, +static __inline int gtidmac_dmmap_load(struct gtidmac_softc *, bus_dmamap_t, dmover_buffer_type, dmover_buffer *, int); -__inline void gtidmac_dmmap_unload(struct gtidmac_softc *, bus_dmamap_t, int); +static __inline void gtidmac_dmmap_unload(struct gtidmac_softc *, bus_dmamap_t, int); static uint32_t gtidmac_finish(void *, int, int); static uint32_t mvxore_finish(void *, int, int); @@ -857,7 +857,7 @@ gtidmac_dmover_done(void *object, int ch gtidmac_dmover_run(dmb); } -__inline int +static __inline int gtidmac_dmmap_load(struct gtidmac_softc *sc, bus_dmamap_t dmamap, dmover_buffer_type dmbuf_type, dmover_buffer *dmbuf, int read) @@ -894,7 +894,7 @@ gtidmac_dmmap_load(struct gtidmac_softc return error; } -__inline void +static __inline void gtidmac_dmmap_unload(struct gtidmac_softc *sc, bus_dmamap_t dmamap, int read) {
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: msaitoh Date: Thu Sep 6 03:45:02 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add missing bus_dmamap_sync() for the RX buffer. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.18 src/sys/dev/marvell/if_mvgbe.c:1.19 --- src/sys/dev/marvell/if_mvgbe.c:1.18 Sun Jul 22 14:32:59 2012 +++ src/sys/dev/marvell/if_mvgbe.c Thu Sep 6 03:45:02 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.18 2012/07/22 14:32:59 matt Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.19 2012/09/06 03:45:02 msaitoh Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.18 2012/07/22 14:32:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.19 2012/09/06 03:45:02 msaitoh Exp $"); #include #include @@ -1293,6 +1293,7 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int struct mvgbe_chain *c; struct mvgbe_rx_desc *r; int align; + vaddr_t offset; if (m == NULL) { void *buf = NULL; @@ -1335,11 +1336,15 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int c = &sc->sc_cdata.mvgbe_rx_chain[i]; r = c->mvgbe_desc; c->mvgbe_mbuf = m_new; - r->bufptr = dmamap->dm_segs[0].ds_addr + - (((vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf)); + offset = (vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf; + r->bufptr = dmamap->dm_segs[0].ds_addr + offset; r->bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK; r->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT; + /* Invalidate RX buffer */ + bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize, + BUS_DMASYNC_PREREAD); + MVGBE_CDRXSYNC(sc, i, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); return 0;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Fri Jul 27 03:00:01 UTC 2012 Modified Files: src/sys/dev/marvell: files.discovery Added Files: src/sys/dev/marvell: mvcesa.c mvcesareg.h Log Message: Add Marvell CESA(Cryptographic Engines and Security Accelerator) module driver. But support only PIO-mode now. Also AES-CBC not supported. Don't know how to process to AES CBC in PIO-mode. I haven't found IV registers. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/dev/marvell/files.discovery cvs rdiff -u -r0 -r1.1 src/sys/dev/marvell/mvcesa.c \ src/sys/dev/marvell/mvcesareg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/files.discovery diff -u src/sys/dev/marvell/files.discovery:1.18 src/sys/dev/marvell/files.discovery:1.19 --- src/sys/dev/marvell/files.discovery:1.18 Sat Oct 2 05:53:37 2010 +++ src/sys/dev/marvell/files.discovery Fri Jul 27 03:00:01 2012 @@ -1,4 +1,4 @@ -# $NetBSD: files.discovery,v 1.18 2010/10/02 05:53:37 kiyohara Exp $ +# $NetBSD: files.discovery,v 1.19 2012/07/27 03:00:01 kiyohara Exp $ # # Config file and device description for machine-independent support for # the Marvell (formerly Galileo Technology) Discovery system controllers. @@ -72,9 +72,9 @@ attach ehci at gt with mvusb_gt file dev/marvell/ehci_mv.c mvusb_gt | mvusb_mbus # Cryptographic Engines and Security Accelerator -#device mvcesa: opencrypto -#file dev/marvell/mvcesa.c mvcesa -#attach mvcesa at gt with mvcesa_gt +device mvcesa: opencrypto +file dev/marvell/mvcesa.c mvcesa +attach mvcesa at gt with mvcesa_gt # Two-Wire Serial Interface device gttwsi: i2cbus Added files: Index: src/sys/dev/marvell/mvcesa.c diff -u /dev/null src/sys/dev/marvell/mvcesa.c:1.1 --- /dev/null Fri Jul 27 03:00:02 2012 +++ src/sys/dev/marvell/mvcesa.c Fri Jul 27 03:00:01 2012 @@ -0,0 +1,767 @@ +/* $NetBSD: mvcesa.c,v 1.1 2012/07/27 03:00:01 kiyohara Exp $ */ +/* + * Copyright (c) 2008 KIYOHARA Takashi + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 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 DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.1 2012/07/27 03:00:01 kiyohara Exp $"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include "locators.h" + +#define MVCESA_SESSION(sid) ((sid) & 0x0fff) +#define MVCESA_SID(crd, sesn) (((crd) << 28) | ((sesn) & 0x0fff)) + + +struct mvcesa_session { + int ses_used; + + int ses_klen; + uint32_t ses_iv[4]; + uint32_t ses_key[8]; + + uint32_t ses_hminner[5]; /* HMAC inner state */ + uint32_t ses_hmouter[5]; /* HMAC outer state */ +}; + +struct mvcesa_softc { + device_t sc_dev; + + bus_space_tag_t sc_iot; + bus_space_handle_t sc_ioh; + bus_dma_tag_t sc_dmat; + + int sc_cid; + int sc_nsessions; + struct mvcesa_session *sc_sessions; +}; + +static int mvcesa_match(device_t, cfdata_t, void *); +static void mvcesa_attach(device_t, device_t, void *); + +static int mvcesa_intr(void *); + +static int mvcesa_newsession(void *, u_int32_t *, struct cryptoini *); +static int mvcesa_freesession(void *, u_int64_t); +static int mvcesa_process(void *, struct cryptop *, int); + +static int mvcesa_authentication(struct mvcesa_softc *, struct mvcesa_session *, + uint32_t, uint32_t *, uint32_t *, uint64_t, + int, int, char *, struct mbuf *, struct uio *); +static int mvcesa_des_encdec(struct mvcesa_softc *, struct mvcesa_session *, + uint32_t, uint32_t, uint32_t, uint32_t *, int, int, + char *, struct mbuf *, struct uio *); + + +CFATTACH_DECL_NEW(mvcesa_gt, sizeof(struct mvcesa_softc), +mvcesa_m
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Mon Jul 23 06:09:48 UTC 2012 Modified Files: src/sys/dev/marvell: gtidmac.c gtidmacreg.h Log Message: Support Kirkwoods. Kirkwoods has 4ch for XORE and not has IDMAC. tested on OpenBlockS A6 with ch0 only. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/gtidmac.c cvs rdiff -u -r1.2 -r1.3 src/sys/dev/marvell/gtidmacreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gtidmac.c diff -u src/sys/dev/marvell/gtidmac.c:1.7 src/sys/dev/marvell/gtidmac.c:1.8 --- src/sys/dev/marvell/gtidmac.c:1.7 Mon Jan 30 23:31:28 2012 +++ src/sys/dev/marvell/gtidmac.c Mon Jul 23 06:09:47 2012 @@ -1,6 +1,6 @@ -/* $NetBSD: gtidmac.c,v 1.7 2012/01/30 23:31:28 matt Exp $ */ +/* $NetBSD: gtidmac.c,v 1.8 2012/07/23 06:09:47 kiyohara Exp $ */ /* - * Copyright (c) 2008 KIYOHARA Takashi + * Copyright (c) 2008, 2012 KIYOHARA Takashi * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.7 2012/01/30 23:31:28 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.8 2012/07/23 06:09:47 kiyohara Exp $"); #include #include @@ -147,7 +147,9 @@ static int gtidmac_match(device_t, struc static void gtidmac_attach(device_t, device_t, void *); static int gtidmac_intr(void *); -static int mvxore_intr(void *); +static int mvxore_port0_intr(void *); +static int mvxore_port1_intr(void *); +static int mvxore_intr(struct gtidmac_softc *, int); static void gtidmac_process(struct dmover_backend *); static void gtidmac_dmover_run(struct dmover_backend *); @@ -163,6 +165,9 @@ static uint32_t mvxore_finish(void *, in static void gtidmac_wininit(struct gtidmac_softc *); static void mvxore_wininit(struct gtidmac_softc *); +static int gtidmac_buffer_setup(struct gtidmac_softc *); +static int mvxore_buffer_setup(struct gtidmac_softc *); + #ifdef GTIDMAC_DEBUG static void gtidmac_dump_idmacreg(struct gtidmac_softc *, int); static void gtidmac_dump_idmacdesc(struct gtidmac_softc *, @@ -271,6 +276,45 @@ static const struct dmover_algdesc mvxor }, }; +static struct { + int model; + int idmac_nchan; + int idmac_irq; + int xore_nchan; + int xore_irq; +} channels[] = { + /* + * Marvell System Controllers: + * need irqs in attach_args. + */ + { MARVELL_DISCOVERY, 8, -1, 0, -1 }, + { MARVELL_DISCOVERY_II, 8, -1, 0, -1 }, + { MARVELL_DISCOVERY_III, 8, -1, 0, -1 }, +#if 0 + { MARVELL_DISCOVERY_LT, 4, -1, 2, -1 }, + { MARVELL_DISCOVERY_V, 4, -1, 2, -1 }, + { MARVELL_DISCOVERY_VI, 4, -1, 2, -1 }, +#endif + + /* + * Marvell System on Chips: + * No need irqs in attach_args. We always connecting to interrupt-pin + * statically. + */ + { MARVELL_ORION_1_88F1181, 4, 24, 0, -1 }, + { MARVELL_ORION_2_88F1281, 4, 24, 0, -1 }, + { MARVELL_ORION_1_88F5082, 4, 24, 0, -1 }, + { MARVELL_ORION_1_88F5180N, 4, 24, 0, -1 }, + { MARVELL_ORION_1_88F5181, 4, 24, 0, -1 }, + { MARVELL_ORION_1_88F5182, 4, 24, 2, 30 }, + { MARVELL_ORION_2_88F5281, 4, 24, 0, -1 }, + { MARVELL_ORION_1_88W8660, 4, 24, 0, -1 }, + { MARVELL_KIRKWOOD_88F6180, 0, -1, 4, 5 }, + { MARVELL_KIRKWOOD_88F6192, 0, -1, 4, 5 }, + { MARVELL_KIRKWOOD_88F6281, 0, -1, 4, 5 }, + { MARVELL_KIRKWOOD_88F6282, 0, -1, 4, 5 }, +}; + CFATTACH_DECL_NEW(gtidmac_gt, sizeof(struct gtidmac_softc), gtidmac_match, gtidmac_attach, NULL, NULL); CFATTACH_DECL_NEW(gtidmac_mbus, sizeof(struct gtidmac_softc), @@ -282,15 +326,18 @@ static int gtidmac_match(device_t parent, struct cfdata *match, void *aux) { struct marvell_attach_args *mva = aux; + int i; if (strcmp(mva->mva_name, match->cf_name) != 0) return 0; - if (mva->mva_offset == MVA_OFFSET_DEFAULT || - mva->mva_irq == MVA_IRQ_DEFAULT) + if (mva->mva_offset == MVA_OFFSET_DEFAULT) return 0; - - mva->mva_size = GTIDMAC_SIZE; - return 1; + for (i = 0; i < __arraycount(channels); i++) + if (mva->mva_model == channels[i].model) { + mva->mva_size = GTIDMAC_SIZE; + return 1; + } + return 0; } /* ARGSUSED */ @@ -299,51 +346,51 @@ gtidmac_attach(device_t parent, device_t { struct gtidmac_softc *sc = device_private(self); struct marvell_attach_args *mva = aux; - bus_dma_segment_t segs, segs_xore; - struct gtidmac_dma_desc *dd; prop_dictionary_t dict = device_properties(self); - uint32_t mask, dmb_speed, xore_irq; - int idmac_nchan, xore_nchan, nsegs, nsegs_xore, i, j, k, n; - - xore_irq = 0; - idmac_nchan = 8; - xore_nchan = 0; - switch (mva->mva_model) { - case MARVELL_DISCOVERY: - case MARVELL_DISCOVERY_II: - case MARVELL_DISCOVERY_III: - break; + uint32_t idmac_irq, xore_irq, dmb_speed; + int idmac_nchan, xore_nchan, nsegs, i, j, n; - case MARVELL_ORION_1_88F1181: - case MARVELL_ORION_1_88F5082: - case MARVELL_ORION_1_88F5180N: - case MARVELL_ORION_1_88F5181: - case MARVELL_ORION_1
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jul 21 04:23:16 UTC 2012 Modified Files: src/sys/dev/marvell: gttwsireg.h Log Message: TWSI size is 0x100. Not 0x1000. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/gttwsireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsireg.h diff -u src/sys/dev/marvell/gttwsireg.h:1.1 src/sys/dev/marvell/gttwsireg.h:1.2 --- src/sys/dev/marvell/gttwsireg.h:1.1 Wed Apr 28 13:51:56 2010 +++ src/sys/dev/marvell/gttwsireg.h Sat Jul 21 04:23:16 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsireg.h,v 1.1 2010/04/28 13:51:56 kiyohara Exp $ */ +/* $NetBSD: gttwsireg.h,v 1.2 2012/07/21 04:23:16 kiyohara Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. @@ -27,7 +27,7 @@ #ifndef _GTTWSIREG_H_ #define _GTTWSIREG_H_ -#define GTTWSI_SIZE 0x1000 +#define GTTWSI_SIZE 0x100 #define TWSI_SLAVEADDR 0x00 #define TWSI_EXTEND_SLAVEADDR 0x10
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Sat Jul 21 04:21:14 UTC 2012 Modified Files: src/sys/dev/marvell: gttwsi.c Log Message: Don't send a stop bit immediately after start bit transmission. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/gttwsi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/gttwsi.c diff -u src/sys/dev/marvell/gttwsi.c:1.5 src/sys/dev/marvell/gttwsi.c:1.6 --- src/sys/dev/marvell/gttwsi.c:1.5 Sun Oct 10 04:49:48 2010 +++ src/sys/dev/marvell/gttwsi.c Sat Jul 21 04:21:14 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi.c,v 1.5 2010/10/10 04:49:48 kiyohara Exp $ */ +/* $NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.5 2010/10/10 04:49:48 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi.c,v 1.6 2012/07/21 04:21:14 kiyohara Exp $"); #include "locators.h" #include @@ -391,9 +391,16 @@ gttwsi_wait(struct gttwsi_softc *sc, uin return EIO; } - if ((flags & I2C_F_STOP) && expect != STAT_RSCT && - expect != STAT_MRRD_AT && expect != STAT_ARBT_AR) - error = gttwsi_send_stop(sc, flags); + if (flags & I2C_F_STOP) + switch (expect) { + case STAT_SCT: + case STAT_RSCT: + case STAT_MRRD_AT: + case STAT_ARBT_AR: + break; + default: + error = gttwsi_send_stop(sc, flags); + } return error; }
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Wed Jul 18 09:21:37 UTC 2012 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add 88F6282. tested only OpenBlockS A6. Also fix irq 11 to 15. irq of 2nd NIC is 15. Remove white-space. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.16 src/sys/dev/marvell/if_mvgbe.c:1.17 --- src/sys/dev/marvell/if_mvgbe.c:1.16 Thu Feb 2 19:43:04 2012 +++ src/sys/dev/marvell/if_mvgbe.c Wed Jul 18 09:21:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.17 2012/07/18 09:21:37 kiyohara Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.16 2012/02/02 19:43:04 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.17 2012/07/18 09:21:37 kiyohara Exp $"); #include #include @@ -299,9 +299,11 @@ struct mvgbe_port { { MARVELL_KIRKWOOD_88F6180, 0, 1, { 11 }, FLAGS_FIX_TQTB }, { MARVELL_KIRKWOOD_88F6192, 0, 1, { 11 }, FLAGS_FIX_TQTB }, - { MARVELL_KIRKWOOD_88F6192, 1, 1, { 14 }, FLAGS_FIX_TQTB }, + { MARVELL_KIRKWOOD_88F6192, 1, 1, { 15 }, FLAGS_FIX_TQTB }, { MARVELL_KIRKWOOD_88F6281, 0, 1, { 11 }, FLAGS_FIX_TQTB }, { MARVELL_KIRKWOOD_88F6281, 1, 1, { 15 }, FLAGS_FIX_TQTB }, + { MARVELL_KIRKWOOD_88F6282, 0, 1, { 11 }, FLAGS_FIX_TQTB }, + { MARVELL_KIRKWOOD_88F6282, 1, 1, { 15 }, FLAGS_FIX_TQTB }, { MARVELL_MV78XX0_MV78100, 0, 1, { 40 }, FLAGS_FIX_TQTB }, { MARVELL_MV78XX0_MV78100, 1, 1, { 44 }, FLAGS_FIX_TQTB }, @@ -357,7 +359,7 @@ mvgbec_attach(device_t parent, device_t if (mvgbec0 == NULL) mvgbec0 = self; - + phyaddr = 0; MVGBE_WRITE(sc, MVGBE_PHYADDR, phyaddr);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Wed Jul 18 09:18:30 UTC 2012 Modified Files: src/sys/dev/marvell: mvsata_mv.c Log Message: Add 88F6282. tested only OpenBlockS A6. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvsata_mv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/mvsata_mv.c diff -u src/sys/dev/marvell/mvsata_mv.c:1.3 src/sys/dev/marvell/mvsata_mv.c:1.4 --- src/sys/dev/marvell/mvsata_mv.c:1.3 Sat Oct 30 05:46:12 2010 +++ src/sys/dev/marvell/mvsata_mv.c Wed Jul 18 09:18:30 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mvsata_mv.c,v 1.3 2010/10/30 05:46:12 kiyohara Exp $ */ +/* $NetBSD: mvsata_mv.c,v 1.4 2012/07/18 09:18:30 kiyohara Exp $ */ /* * Copyright (c) 2008 KIYOHARA Takashi * All rights reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.3 2010/10/30 05:46:12 kiyohara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mvsata_mv.c,v 1.4 2012/07/18 09:18:30 kiyohara Exp $"); #include #include @@ -93,6 +93,7 @@ struct mvsata_product mvsata_products[] /* Kirkwood */ { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6192, 1, 2, gen2e, 0 }, { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6281, 1, 2, gen2e, 0 }, + { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_88F6282, 1, 2, gen2e, 0 }, /* Discovery Innovation */ { PCI_VENDOR_MARVELL, PCI_PRODUCT_MARVELL_MV78100, 1, 2, gen2e, 0 },
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: kiyohara Date: Thu Jul 12 09:39:53 UTC 2012 Modified Files: src/sys/dev/marvell: marvellreg.h Log Message: Add 88f6282. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/marvellreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/marvellreg.h diff -u src/sys/dev/marvell/marvellreg.h:1.5 src/sys/dev/marvell/marvellreg.h:1.6 --- src/sys/dev/marvell/marvellreg.h:1.5 Tue Jul 20 12:01:33 2010 +++ src/sys/dev/marvell/marvellreg.h Thu Jul 12 09:39:53 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: marvellreg.h,v 1.5 2010/07/20 12:01:33 kiyohara Exp $ */ +/* $NetBSD: marvellreg.h,v 1.6 2012/07/12 09:39:53 kiyohara Exp $ */ /* * Copyright (c) 2009 KIYOHARA Takashi * All rights reserved. @@ -54,6 +54,7 @@ #define MARVELL_KIRKWOOD_88F6180 PCI_PRODUCT_MARVELL_88F6180 #define MARVELL_KIRKWOOD_88F6192 PCI_PRODUCT_MARVELL_88F6192 #define MARVELL_KIRKWOOD_88F6281 PCI_PRODUCT_MARVELL_88F6281 +#define MARVELL_KIRKWOOD_88F6282 PCI_PRODUCT_MARVELL_88F6282 #define MARVELL_MV78XX0_MV78100 PCI_PRODUCT_MARVELL_MV78100 #define MARVELL_MV78XX0_MV78200 PCI_PRODUCT_MARVELL_MV78200
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: jakllsch Date: Sat Nov 19 17:01:38 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Add workaround for infrequently encountered DMA engine limitation. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.13 src/sys/dev/marvell/if_mvgbe.c:1.14 --- src/sys/dev/marvell/if_mvgbe.c:1.13 Tue Sep 6 19:38:23 2011 +++ src/sys/dev/marvell/if_mvgbe.c Sat Nov 19 17:01:38 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.13 2011/09/06 19:38:23 rjs Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.14 2011/11/19 17:01:38 jakllsch Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.13 2011/09/06 19:38:23 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.14 2011/11/19 17:01:38 jakllsch Exp $"); #include "rnd.h" @@ -1517,6 +1517,7 @@ mvgbe_encap(struct mvgbe_softc *sc, stru bus_dmamap_t txmap; uint32_t first, current, last, cmdsts = 0; int m_csumflags, i; + bool needs_defrag = false; DPRINTFN(3, ("mvgbe_encap\n")); @@ -1535,6 +1536,16 @@ mvgbe_encap(struct mvgbe_softc *sc, stru */ m_csumflags = m_head->m_pkthdr.csum_flags; +do_defrag: + if (__predict_false(needs_defrag == true)) { + /* A small unaligned segment was detected. */ + struct mbuf *m_new; + m_new = m_defrag(m_head, M_DONTWAIT); + if (m_new == NULL) + return EFBIG; + m_head = m_new; + } + /* * Start packing the mbufs in this chain into * the fragment pointers. Stop when we run out @@ -1545,6 +1556,25 @@ mvgbe_encap(struct mvgbe_softc *sc, stru return ENOBUFS; } + txseg = txmap->dm_segs; + + if (__predict_true(needs_defrag == false)) { + /* + * Detect rarely encountered DMA limitation. + */ + for (i = 0; i < txmap->dm_nsegs; i++) { + if (((txseg[i].ds_addr & 7) != 0) && + (txseg[i].ds_len <= 8) && + (txseg[i].ds_len >= 1) + ) { +txseg = NULL; +bus_dmamap_unload(sc->sc_dmat, txmap); +needs_defrag = true; +goto do_defrag; + } + } + } + /* Sync the DMA map. */ bus_dmamap_sync(sc->sc_dmat, txmap, 0, txmap->dm_mapsize, BUS_DMASYNC_PREWRITE); @@ -1556,7 +1586,6 @@ mvgbe_encap(struct mvgbe_softc *sc, stru return ENOBUFS; } - txseg = txmap->dm_segs; DPRINTFN(2, ("mvgbe_encap: dm_nsegs=%d\n", txmap->dm_nsegs));
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rjs Date: Tue Sep 6 19:38:23 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Only zero MVGBE_MTU on Orion platforms. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.12 src/sys/dev/marvell/if_mvgbe.c:1.13 --- src/sys/dev/marvell/if_mvgbe.c:1.12 Thu Sep 1 14:46:23 2011 +++ src/sys/dev/marvell/if_mvgbe.c Tue Sep 6 19:38:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.12 2011/09/01 14:46:23 jakllsch Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.13 2011/09/06 19:38:23 rjs Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.12 2011/09/01 14:46:23 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.13 2011/09/06 19:38:23 rjs Exp $"); #include "rnd.h" @@ -190,7 +190,7 @@ kmutex_t sc_mtx; - int sc_fix_tqtb; + int sc_flags; }; struct mvgbe_softc { @@ -286,6 +286,7 @@ int irqs[3]; int flags; #define FLAGS_FIX_TQTB (1 << 0) +#define FLAGS_FIX_MTU (1 << 1) } mvgbe_ports[] = { { MARVELL_DISCOVERY_II, 0, 3, { 32, 33, 34 }, 0 }, { MARVELL_DISCOVERY_III, 0, 3, { 32, 33, 34 }, 0 }, @@ -294,13 +295,13 @@ { MARVELL_DISCOVERY_V, 0, ?, { }, 0 }, { MARVELL_DISCOVERY_VI, 0, ?, { }, 0 }, #endif - { MARVELL_ORION_1_88F5082, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_1_88F5180N, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_1_88F5181, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_1_88F5182, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_2_88F5281, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_1_88F6082, 0, 1, { 21 }, 0 }, - { MARVELL_ORION_1_88W8660, 0, 1, { 21 }, 0 }, + { MARVELL_ORION_1_88F5082, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88F5180N, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88F5181, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88F5182, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_2_88F5281, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88F6082, 0, 1, { 21 }, FLAGS_FIX_MTU }, + { MARVELL_ORION_1_88W8660, 0, 1, { 21 }, FLAGS_FIX_MTU }, { MARVELL_KIRKWOOD_88F6180, 0, 1, { 11 }, FLAGS_FIX_TQTB }, { MARVELL_KIRKWOOD_88F6192, 0, 1, { 11 }, FLAGS_FIX_TQTB }, @@ -380,7 +381,7 @@ mvgbe_ports[i].unit != mva->mva_unit) continue; - sc->sc_fix_tqtb = mvgbe_ports[i].flags & FLAGS_FIX_TQTB; + sc->sc_flags = mvgbe_ports[i].flags; for (j = 0; j < mvgbe_ports[i].ports; j++) { gbea.mva_name = "mvgbe"; @@ -980,7 +981,8 @@ return ENOBUFS; } - MVGBE_WRITE(sc, MVGBE_MTU, 0); /* hw reset value is wrong */ + if (csc->sc_flags & FLAGS_FIX_MTU) + MVGBE_WRITE(sc, MVGBE_MTU, 0); /* hw reset value is wrong */ MVGBE_WRITE(sc, MVGBE_PSC, MVGBE_PSC_ANFC | /* Enable Auto-Neg Flow Ctrl */ MVGBE_PSC_RESERVED | /* Must be set to 1 */ @@ -996,7 +998,7 @@ MVGBE_WRITE(sc, MVGBE_CRDP(0), MVGBE_RX_RING_ADDR(sc, 0)); MVGBE_WRITE(sc, MVGBE_TCQDP, MVGBE_TX_RING_ADDR(sc, 0)); - if (csc->sc_fix_tqtb) { + if (csc->sc_flags & FLAGS_FIX_TQTB) { /* * Queue 0 (offset 0x72700) must be programmed to 0x3fff. * And offset 0x72704 must be programmed to 0x03ff.
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: jakllsch Date: Thu Sep 1 14:46:23 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: We occasionally will try to set up the multicast filter in a context that kmem(9) is unusable (such as transmit timeout). Thus, put the filter table on the stack instead, all 528 bytes of it. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.11 src/sys/dev/marvell/if_mvgbe.c:1.12 --- src/sys/dev/marvell/if_mvgbe.c:1.11 Thu Sep 1 14:39:03 2011 +++ src/sys/dev/marvell/if_mvgbe.c Thu Sep 1 14:46:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.12 2011/09/01 14:46:23 jakllsch Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.12 2011/09/01 14:46:23 jakllsch Exp $"); #include "rnd.h" @@ -1842,14 +1842,14 @@ struct ifnet *ifp= &sc->sc_ethercom.ec_if; struct ether_multi *enm; struct ether_multistep step; - uint32_t *dfut, *dfsmt, *dfomt; + uint32_t dfut[MVGBE_NDFUT], dfsmt[MVGBE_NDFSMT], dfomt[MVGBE_NDFOMT]; uint32_t pxc; int i; const uint8_t special[ETHER_ADDR_LEN] = {0x01,0x00,0x5e,0x00,0x00,0x00}; - dfut = kmem_zalloc(sizeof(*dfut) * MVGBE_NDFUT, KM_SLEEP); - dfsmt = kmem_zalloc(sizeof(*dfsmt) * MVGBE_NDFSMT, KM_SLEEP); - dfomt = kmem_zalloc(sizeof(*dfomt) * MVGBE_NDFOMT, KM_SLEEP); + memset(dfut, 0, sizeof(dfut)); + memset(dfsmt, 0, sizeof(dfsmt)); + memset(dfomt, 0, sizeof(dfomt)); if (ifp->if_flags & (IFF_ALLMULTI|IFF_PROMISC)) { goto allmulti; @@ -1907,10 +1907,6 @@ /* Set Destination Address Filter Multicast Tables */ MVGBE_WRITE_FILTER(sc, MVGBE_DFSMT, dfsmt, MVGBE_NDFSMT); MVGBE_WRITE_FILTER(sc, MVGBE_DFOMT, dfomt, MVGBE_NDFOMT); - - kmem_free(dfut, sizeof(dfut[0]) * MVGBE_NDFUT); - kmem_free(dfsmt, sizeof(dfsmt[0]) * MVGBE_NDFSMT); - kmem_free(dfomt, sizeof(dfsmt[0]) * MVGBE_NDFOMT); } #ifdef MVGBE_DEBUG
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: jakllsch Date: Thu Sep 1 14:39:04 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Initialize MVGBE_MTU to 0, as suggested by the Orion databook. If the platform firmware did not initialize this to 0 for us, we were unable to transmit frames. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.10 src/sys/dev/marvell/if_mvgbe.c:1.11 --- src/sys/dev/marvell/if_mvgbe.c:1.10 Sat Jul 30 19:06:57 2011 +++ src/sys/dev/marvell/if_mvgbe.c Thu Sep 1 14:39:03 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.11 2011/09/01 14:39:03 jakllsch Exp $"); #include "rnd.h" @@ -980,6 +980,7 @@ return ENOBUFS; } + MVGBE_WRITE(sc, MVGBE_MTU, 0); /* hw reset value is wrong */ MVGBE_WRITE(sc, MVGBE_PSC, MVGBE_PSC_ANFC | /* Enable Auto-Neg Flow Ctrl */ MVGBE_PSC_RESERVED | /* Must be set to 1 */
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: rjs Date: Sat Jul 30 19:06:58 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Use new style BPF calls. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.9 src/sys/dev/marvell/if_mvgbe.c:1.10 --- src/sys/dev/marvell/if_mvgbe.c:1.9 Thu Jul 28 15:36:47 2011 +++ src/sys/dev/marvell/if_mvgbe.c Sat Jul 30 19:06:57 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.10 2011/07/30 19:06:57 rjs Exp $"); #include "rnd.h" @@ -898,8 +898,7 @@ * If there's a BPF listener, bounce a copy of this frame * to him. */ - if (ifp->if_bpf) - bpf_ops->bpf_mtap(ifp->if_bpf, m_head); + bpf_mtap(ifp, m_head); } if (pkts == 0) return; @@ -1744,8 +1743,7 @@ ifp->if_ipackets++; - if (ifp->if_bpf) - bpf_ops->bpf_mtap(ifp->if_bpf, m); + bpf_mtap(ifp, m); /* pass it on. */ (*ifp->if_input)(ifp, m);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: matt Date: Thu Jul 28 15:36:47 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Use cfdata_t To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.8 src/sys/dev/marvell/if_mvgbe.c:1.9 --- src/sys/dev/marvell/if_mvgbe.c:1.8 Mon Mar 7 13:58:32 2011 +++ src/sys/dev/marvell/if_mvgbe.c Thu Jul 28 15:36:47 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.8 2011/03/07 13:58:32 christos Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.8 2011/03/07 13:58:32 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.9 2011/07/28 15:36:47 matt Exp $"); #include "rnd.h" @@ -319,7 +319,7 @@ /* ARGSUSED */ static int -mvgbec_match(device_t parent, struct cfdata *match, void *aux) +mvgbec_match(device_t parent, cfdata_t match, void *aux) { struct marvell_attach_args *mva = aux; int i; @@ -598,7 +598,7 @@ /* ARGSUSED */ static int -mvgbe_match(device_t parent, struct cfdata *match, void *aux) +mvgbe_match(device_t parent, cfdata_t match, void *aux) { struct marvell_attach_args *mva = aux; uint32_t pbase, maddrh, maddrl;
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Mon Mar 7 13:58:32 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: fix typo, and use the parent to determine the offset. From Dave Mills To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.7 src/sys/dev/marvell/if_mvgbe.c:1.8 --- src/sys/dev/marvell/if_mvgbe.c:1.7 Sun Mar 6 12:00:16 2011 +++ src/sys/dev/marvell/if_mvgbe.c Mon Mar 7 08:58:32 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.7 2011/03/06 17:00:16 christos Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.8 2011/03/07 13:58:32 christos Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.7 2011/03/06 17:00:16 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.8 2011/03/07 13:58:32 christos Exp $"); #include "rnd.h" @@ -619,7 +619,6 @@ mvgbe_attach(device_t parent, device_t self, void *aux) { struct mvgbe_softc *sc = device_private(self); - struct mvgbec_softc *csc = device_private(parent); struct marvell_attach_args *mva = aux; struct mvgbe_txmap_entry *entry; struct ifnet *ifp; @@ -767,7 +766,7 @@ ifmedia_init(&sc->sc_mii.mii_media, 0, mvgbe_mediachange, mvgbe_mediastatus); mii_attach(self, &sc->sc_mii, 0x, - parent == mvgebc0 ? 0 : 1, MII_OFFSET_ANY, 0); + MII_PHY_ANY, parent == mvgbec0 ? 0 : 1, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { aprint_error_dev(self, "no PHY found!\n"); ifmedia_add(&sc->sc_mii.mii_media,
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: christos Date: Sun Mar 6 17:00:16 UTC 2011 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: don't abuse cf_unit, requested by phone. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/marvell/if_mvgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/marvell/if_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.6 src/sys/dev/marvell/if_mvgbe.c:1.7 --- src/sys/dev/marvell/if_mvgbe.c:1.6 Sat Mar 5 13:28:13 2011 +++ src/sys/dev/marvell/if_mvgbe.c Sun Mar 6 12:00:16 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.6 2011/03/05 18:28:13 christos Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.7 2011/03/06 17:00:16 christos Exp $ */ /* * Copyright (c) 2007, 2008 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.6 2011/03/05 18:28:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.7 2011/03/06 17:00:16 christos Exp $"); #include "rnd.h" @@ -184,7 +184,6 @@ struct mvgbec_softc { device_t sc_dev; - int sc_unit; bus_space_tag_t sc_iot; bus_space_handle_t sc_ioh; @@ -355,16 +354,14 @@ sc->sc_dev = self; sc->sc_iot = mva->mva_iot; - sc->sc_unit = mva->mva_unit; if (bus_space_subregion(mva->mva_iot, mva->mva_ioh, mva->mva_offset, mva->mva_size, &sc->sc_ioh)) { aprint_error_dev(self, "Cannot map registers\n"); return; } - if (sc->sc_unit == 0) { + if (mvgbec0 == NULL) mvgbec0 = self; - } phyaddr = 0; MVGBE_WRITE(sc, MVGBE_PHYADDR, phyaddr); @@ -770,7 +767,7 @@ ifmedia_init(&sc->sc_mii.mii_media, 0, mvgbe_mediachange, mvgbe_mediastatus); mii_attach(self, &sc->sc_mii, 0x, - csc->sc_unit, MII_OFFSET_ANY, 0); + parent == mvgebc0 ? 0 : 1, MII_OFFSET_ANY, 0); if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) { aprint_error_dev(self, "no PHY found!\n"); ifmedia_add(&sc->sc_mii.mii_media,