CVS commit: src/sys/dev/marvell

2024-06-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jun 12 20:03:56 UTC 2024

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
MVXORE_XEXCDPR and MVXORE_XEXBCR macros expect two params now, thus adjust
params accordingly, needed in order to fix GTIDMAC_DEBUG build option.

Unfortunately, there few more macros in gtidmac_dump_xorereg() like
MVXORE_XETMCR, MVXORE_XETMIVR, MVXORE_XETMCVR, MVXORE_XEIVRH, MVXORE_XEIVRL
which also expect two params, but second one doesn't seem to be a channel,
thus I am leaving it unfixed for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sys/dev/marvell/gtidmac.c:1.21
--- src/sys/dev/marvell/gtidmac.c:1.20	Fri Feb  2 22:33:42 2024
+++ src/sys/dev/marvell/gtidmac.c	Wed Jun 12 20:03:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtidmac.c,v 1.20 2024/02/02 22:33:42 andvar Exp $	*/
+/*	$NetBSD: gtidmac.c,v 1.21 2024/06/12 20:03:56 andvar Exp $	*/
 /*
  * Copyright (c) 2008, 2012, 2016 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.20 2024/02/02 22:33:42 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtidmac.c,v 1.21 2024/06/12 20:03:56 andvar Exp $");
 
 #include 
 #include 
@@ -2010,10 +2010,10 @@ gtidmac_dump_xorereg(struct gtidmac_soft
 		MVXORE_XEXNDPR(sc, chan)));
 		printf("  CurrentDescPtr  : 0x%08x\n",
 		bus_space_read_4(sc->sc_iot, sc->sc_ioh,
-		MVXORE_XEXCDPR(chan)));
+		MVXORE_XEXCDPR(sc, chan)));
 	}
 	printf("  ByteCnt : 0x%08x\n",
-	bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVXORE_XEXBCR(chan)));
+	bus_space_read_4(sc->sc_iot, sc->sc_ioh, MVXORE_XEXBCR(sc, chan)));
 
 	if (opmode == MVXORE_XEXCR_OM_ECC ||
 	opmode == MVXORE_XEXCR_OM_MEMINIT) {



CVS commit: src/sys/dev/marvell

2024-06-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jun 12 20:03:56 UTC 2024

Modified Files:
src/sys/dev/marvell: gtidmac.c

Log Message:
MVXORE_XEXCDPR and MVXORE_XEXBCR macros expect two params now, thus adjust
params accordingly, needed in order to fix GTIDMAC_DEBUG build option.

Unfortunately, there few more macros in gtidmac_dump_xorereg() like
MVXORE_XETMCR, MVXORE_XETMIVR, MVXORE_XETMCVR, MVXORE_XEIVRH, MVXORE_XEIVRL
which also expect two params, but second one doesn't seem to be a channel,
thus I am leaving it unfixed for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.



CVS commit: src/sys/dev/marvell

2024-06-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jun 12 09:51:27 UTC 2024

Modified Files:
src/sys/dev/marvell: gtmpsc.c

Log Message:
Make gtmpsc_intr_rx/tx always static __inline to fix DEBUG enabled build.
Currently code depends on STATIC macro which is defined as empty with DEBUG
option, thus build fails since tx method uses static inline gt_sdma_imask().

Also add missing __inline for gtmpsc_intr_rx() definition.

Fix EV64260 kernel config when DEBUG is enabled.
Fix discussed with mrg@ in irc.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/marvell/gtmpsc.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/gtmpsc.c
diff -u src/sys/dev/marvell/gtmpsc.c:1.48 src/sys/dev/marvell/gtmpsc.c:1.49
--- src/sys/dev/marvell/gtmpsc.c:1.48	Wed Nov  2 20:38:22 2022
+++ src/sys/dev/marvell/gtmpsc.c	Wed Jun 12 09:51:27 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmpsc.c,v 1.48 2022/11/02 20:38:22 andvar Exp $	*/
+/*	$NetBSD: gtmpsc.c,v 1.49 2024/06/12 09:51:27 andvar Exp $	*/
 /*
  * Copyright (c) 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.48 2022/11/02 20:38:22 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmpsc.c,v 1.49 2024/06/12 09:51:27 andvar Exp $");
 
 #include "opt_kgdb.h"
 
@@ -118,8 +118,8 @@ STATIC int  gtmpscparam(struct tty *, st
 STATIC void gtmpsc_shutdownhook(void *);
 
 STATIC uint32_t cflag2mpcr(tcflag_t);
-STATIC __inline void gtmpsc_intr_rx(struct gtmpsc_softc *);
-STATIC __inline void gtmpsc_intr_tx(struct gtmpsc_softc *);
+static __inline void gtmpsc_intr_rx(struct gtmpsc_softc *);
+static __inline void gtmpsc_intr_tx(struct gtmpsc_softc *);
 STATIC void gtmpsc_write(struct gtmpsc_softc *);
 STATIC void gtmpsc_txflush(gtmpsc_softc_t *);
 STATIC void gtmpsc_rxdesc_init(struct gtmpsc_softc *);
@@ -879,7 +879,7 @@ cflag2mpcr(tcflag_t cflag)
 	return mpcr;
 }
 
-STATIC void
+static __inline void
 gtmpsc_intr_rx(struct gtmpsc_softc *sc)
 {
 	gtmpsc_pollrx_t *vrxp;
@@ -943,7 +943,7 @@ gtmpsc_intr_rx(struct gtmpsc_softc *sc)
 	}
 }
 
-STATIC __inline void
+static __inline void
 gtmpsc_intr_tx(struct gtmpsc_softc *sc)
 {
 	gtmpsc_polltx_t *vtxp;



CVS commit: src/sys/dev/marvell

2024-06-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jun 12 09:51:27 UTC 2024

Modified Files:
src/sys/dev/marvell: gtmpsc.c

Log Message:
Make gtmpsc_intr_rx/tx always static __inline to fix DEBUG enabled build.
Currently code depends on STATIC macro which is defined as empty with DEBUG
option, thus build fails since tx method uses static inline gt_sdma_imask().

Also add missing __inline for gtmpsc_intr_rx() definition.

Fix EV64260 kernel config when DEBUG is enabled.
Fix discussed with mrg@ in irc.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/marvell/gtmpsc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/dev/marvell

2023-05-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun May 28 08:01:46 UTC 2023

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
s/sessoin/session/ in warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.18 src/sys/dev/marvell/mvxpsec.c:1.19
--- src/sys/dev/marvell/mvxpsec.c:1.18	Sat Dec 31 21:15:20 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sun May 28 08:01:46 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.18 2022/12/31 21:15:20 andvar Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.19 2023/05/28 08:01:46 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2010,7 +2010,7 @@ fail:
 	if (mv_s)
 		mvxpsec_session_dealloc(mv_s);
 	log(LOG_WARNING,
-	"%s: Failed to add H/W crypto sessoin (id:%u): err=%d\n",
+	"%s: Failed to add H/W crypto session (id:%u): err=%d\n",
 	   __func__, session, err);
 
 	mutex_exit(>sc_session_mtx);



CVS commit: src/sys/dev/marvell

2023-05-28 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun May 28 08:01:46 UTC 2023

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
s/sessoin/session/ in warning message.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 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.



CVS commit: src/sys/dev/marvell

2022-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 31 21:15:20 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.17 src/sys/dev/marvell/mvxpsec.c:1.18
--- src/sys/dev/marvell/mvxpsec.c:1.17	Fri Jul  8 07:02:47 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sat Dec 31 21:15:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.17 2022/07/08 07:02:47 skrll Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.18 2022/12/31 21:15:20 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -442,7 +442,7 @@ mvxpsec_attach(device_t parent, device_t
 	pool_cache_setlowat(sc->sc_session_pool, MVXPSEC_MAX_SESSIONS / 2);
 	sc->sc_last_session = NULL;
 
-	/* Pakcet */
+	/* Packet */
 	sc->sc_packet_pool =
 	pool_cache_init(sizeof(struct mvxpsec_session), 0, 0, 0,
 	"mvxpsec_pktpl", NULL, IPL_NET,
@@ -1025,7 +1025,7 @@ mvxpsec_dma_sync_packet(struct mvxpsec_s
 /*
  * Initialize MVXPSEC Internal SRAM
  *
- * - must be called after DMA initizlization.
+ * - must be called after DMA initialization.
  * - make VM mapping for SRAM area on MBus.
  */
 STATIC int
@@ -1312,7 +1312,7 @@ mvxpsec_intr_cnt(struct mvxpsec_softc *s
  * Setup MVXPSEC header structure.
  *
  * the header contains descriptor of security accelerator,
- * key material of chiphers, iv of ciphers and macs, ...
+ * key material of ciphers, iv of ciphers and macs, ...
  *
  * the header is transferred to MVXPSEC Internal SRAM by TDMA,
  * and parsed by MVXPSEC H/W.



CVS commit: src/sys/dev/marvell

2022-12-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Dec 31 21:15:20 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 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.



CVS commit: src/sys/dev/marvell

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:45:45 UTC 2022

Modified Files:
src/sys/dev/marvell: gtpci.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.



CVS commit: src/sys/dev/marvell

2022-09-25 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Sep 25 18:45:45 UTC 2022

Modified Files:
src/sys/dev/marvell: gtpci.c

Log Message:
Remove unnecessary include of .


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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.37 src/sys/dev/marvell/gtpci.c:1.38
--- src/sys/dev/marvell/gtpci.c:1.37	Thu Jul 21 10:09:21 2022
+++ src/sys/dev/marvell/gtpci.c	Sun Sep 25 18:45:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtpci.c,v 1.37 2022/07/21 10:09:21 andvar Exp $	*/
+/*	$NetBSD: gtpci.c,v 1.38 2022/09/25 18:45:45 thorpej Exp $	*/
 /*
  * Copyright (c) 2008, 2009 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.37 2022/07/21 10:09:21 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.38 2022/09/25 18:45:45 thorpej Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -35,7 +35,6 @@ __KERNEL_RCSID(0, "$NetBSD: gtpci.c,v 1.
 #include 
 #include 
 #include 
-#include 
 
 #include 
 



CVS commit: src/sys/dev/marvell

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:04:07 UTC 2022

Modified Files:
src/sys/dev/marvell: if_gfe.c

Log Message:
gfe_ifstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 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.59 src/sys/dev/marvell/if_gfe.c:1.60
--- src/sys/dev/marvell/if_gfe.c:1.59	Sat Aug  7 16:19:13 2021
+++ src/sys/dev/marvell/if_gfe.c	Sat Aug 20 19:04:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gfe.c,v 1.59 2021/08/07 16:19:13 thorpej Exp $	*/
+/*	$NetBSD: if_gfe.c,v 1.60 2022/08/20 19:04:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.59 2021/08/07 16:19:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.60 2022/08/20 19:04:07 thorpej Exp $");
 
 #include "opt_inet.h"
 
@@ -691,7 +691,7 @@ gfe_ifstart(struct ifnet *ifp)
 	}
 
 	for (;;) {
-		IF_DEQUEUE(>if_snd, m);
+		IF_POLL(>if_snd, m);
 		if (m == NULL) {
 			ifp->if_flags &= ~IFF_OACTIVE;
 			GE_FUNC_EXIT(sc, "");
@@ -704,6 +704,8 @@ gfe_ifstart(struct ifnet *ifp)
 		if (IF_QFULL(>sc_txq[GE_TXPRIO_HI].txq_pendq))
 			break;
 
+		IF_DEQUEUE(>if_snd, m);
+
 		/*
 		 * Try to enqueue a mbuf to the device. If that fails, we
 		 * can always try to map the next mbuf.
@@ -718,7 +720,6 @@ gfe_ifstart(struct ifnet *ifp)
 	/*
 	 * Attempt to queue the mbuf for send failed.
 	 */
-	IF_PREPEND(>if_snd, m);
 	ifp->if_flags |= IFF_OACTIVE;
 	GE_FUNC_EXIT(sc, "%%");
 }



CVS commit: src/sys/dev/marvell

2022-08-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug 20 19:04:07 UTC 2022

Modified Files:
src/sys/dev/marvell: if_gfe.c

Log Message:
gfe_ifstart(): Replace "IF_DEQUEUE() -> IF_PREPEND() on failure" with
"IF_POLL() -> IF_DEQUEUE() on success".


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 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.



CVS commit: src/sys/dev/marvell

2022-06-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun  1 15:40:15 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Fix missing change to freesession return type.

Not sure how this didn't get committed before -- it was supposed to be
part of this change:

https://mail-index.netbsd.org/source-changes/2022/05/22/msg138764.html


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.



CVS commit: src/sys/dev/marvell

2022-06-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jun  1 15:40:15 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Fix missing change to freesession return type.

Not sure how this didn't get committed before -- it was supposed to be
part of this change:

https://mail-index.netbsd.org/source-changes/2022/05/22/msg138764.html


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 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.15 src/sys/dev/marvell/mvxpsec.c:1.16
--- src/sys/dev/marvell/mvxpsec.c:1.15	Sun May 22 11:38:51 2022
+++ src/sys/dev/marvell/mvxpsec.c	Wed Jun  1 15:40:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.15 2022/05/22 11:38:51 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.16 2022/06/01 15:40:15 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2020,7 +2020,7 @@ fail:
 /*
  * remove opencrypto session
  */
-int
+void
 mvxpsec_freesession(void *arg, uint64_t tid)
 {
 	struct mvxpsec_softc *sc = arg;
@@ -2056,8 +2056,6 @@ mvxpsec_freesession(void *arg, uint64_t 
 	crypto_unblock(sc->sc_cid, CRYPTO_SYMQ|CRYPTO_ASYMQ);
 
 	MVXPSEC_EVCNT_INCR(sc, session_free);
-
-	return 0;
 }
 
 /*



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:51 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.14 src/sys/dev/marvell/mvxpsec.c:1.15
--- src/sys/dev/marvell/mvxpsec.c:1.14	Tue Apr 12 21:05:37 2022
+++ src/sys/dev/marvell/mvxpsec.c	Sun May 22 11:38:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.14 2022/04/12 21:05:37 andvar Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.15 2022/05/22 11:38:51 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -2029,21 +2029,13 @@ mvxpsec_freesession(void *arg, uint64_t 
 	uint32_t sid = ((uint32_t)tid) & 0x;
 
 	session = MVXPSEC_SESSION(sid);
-	if (session < 0 || session >= MVXPSEC_MAX_SESSIONS) {
-		log(LOG_ERR, "%s: invalid session (id:%u)\n",
-		__func__, session);
-		return EINVAL;
-	}
+	KASSERTMSG(session >= 0, "session=%d", session);
+	KASSERTMSG(session < MVXPSEC_MAX_SESSIONS, "session=%d max=%d",
+	session, MVXPSEC_MAX_SESSIONS);
 
 	mutex_enter(>sc_session_mtx);
-	if ( (mv_s = sc->sc_sessions[session]) == NULL) {
-		mutex_exit(>sc_session_mtx);
-#ifdef DEBUG
-		log(LOG_DEBUG, "%s: session %d already inactivated\n",
-		__func__, session);
-#endif
-		return ENOENT;
-	}
+	mv_s = sc->sc_sessions[session];
+	KASSERT(mv_s != NULL);
 	MVXPSEC_PRINTF(MVXPSEC_DEBUG_OPENCRYPTO,
 	"%s: inactivate session %d\n", __func__, session);
 



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:51 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 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.



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:26 UTC 2022

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.



CVS commit: src/sys/dev/marvell

2022-05-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun May 22 11:38:26 UTC 2022

Modified Files:
src/sys/dev/marvell: mvcesa.c

Log Message:
mvcesa(4): Prune dead branches.  Assert session id validity.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 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.4 src/sys/dev/marvell/mvcesa.c:1.5
--- src/sys/dev/marvell/mvcesa.c:1.4	Sun Dec  5 02:41:44 2021
+++ src/sys/dev/marvell/mvcesa.c	Sun May 22 11:38:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.5 2022/05/22 11:38:26 riastradh Exp $");
 
 #include 
 #include 
@@ -332,11 +332,10 @@ mvcesa_freesession(void *arg, u_int64_t 
 	int session;
 	uint32_t sid = ((uint32_t)tid) & 0x;
 
-	KASSERT(sc != NULL /*, ("mvcesa_freesession: null softc")*/);
-
 	session = MVCESA_SESSION(sid);
-	if (session >= sc->sc_nsessions)
-		return EINVAL;
+	KASSERTMSG(session >= 0, "session=%d", session);
+	KASSERTMSG(session < sc->sc_nsessions, "session=%d nsessions=%d",
+	session, sc->sc_nsessions);
 
 	memset(>sc_sessions[session], 0, sizeof(sc->sc_sessions[session]));
 	return (0);
@@ -345,7 +344,7 @@ mvcesa_freesession(void *arg, u_int64_t 
 static int
 mvcesa_process(void *arg, struct cryptop *crp, int hint)
 {
-	struct mvcesa_softc *sc = (struct mvcesa_softc *)arg;
+	struct mvcesa_softc *sc = arg;
 	struct mvcesa_session *ses;
 	struct cryptodesc *crd;
 	struct mbuf *m = NULL;
@@ -353,20 +352,9 @@ mvcesa_process(void *arg, struct cryptop
 	int session;
 	char *buf = NULL;
 
-	KASSERT(sc != NULL /*, ("mvcesa_process: null softc")*/);
-
-	if (crp == NULL)
-		return EINVAL;
-	if (crp->crp_callback == NULL || sc == NULL) {
-		crp->crp_etype = EINVAL;
-		goto done;
-	}
-
 	session = MVCESA_SESSION(crp->crp_sid);
-	if (session >= sc->sc_nsessions) {
-		crp->crp_etype = ENOENT;
-		goto done;
-	}
+	KASSERTMSG(session < sc->sc_nsessions, "session=%d nsessions=%d",
+	session, sc->sc_nsessions);
 	ses = >sc_sessions[session];
 
 	if (crp->crp_flags & CRYPTO_F_IMBUF)



Re: CVS commit: src/sys/dev/marvell

2022-05-22 Thread Rin Okuyama

On 2022/05/21 19:27, Rin Okuyama wrote:

Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/marvell/if_mvgbe.c


s/load/unload/ here. Thanks riastradh@ for pointing out.

rin


CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:33:05 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Correct byte-order for bufsize field of RX descriptor.

XXX
This bug affected only armeb. Unfortunately, the systems including
armel still lock up eventually with NFS root on mvgbe(4)...


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.65 src/sys/dev/marvell/if_mvgbe.c:1.66
--- src/sys/dev/marvell/if_mvgbe.c:1.65	Sat May 21 10:27:30 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:33:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin 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.65 2022/05/21 10:27:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.66 2022/05/21 10:33:05 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1587,6 +1587,7 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	struct mvgbe_rx_desc *r;
 	int align;
 	vaddr_t offset;
+	uint16_t bufsize;
 
 	if (m == NULL) {
 		void *buf = NULL;
@@ -1631,12 +1632,13 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	c->mvgbe_mbuf = m_new;
 	offset = (vaddr_t)m_new->m_data - (vaddr_t)sc->sc_cdata.mvgbe_jumbo_buf;
 	r->bufptr = H2MVGBE32(dmamap->dm_segs[0].ds_addr + offset);
-	r->bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+	bufsize = MVGBE_JLEN & ~MVGBE_RXBUF_MASK;
+	r->bufsize = H2MVGBE16(bufsize);
 	r->cmdsts =
 	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT);
 
 	/* Invalidate RX buffer */
-	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize,
+	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, bufsize,
 	BUS_DMASYNC_PREREAD);
 
 	MVGBE_CDRXSYNC(sc, i, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -1991,7 +1993,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 = MVGBE2H16(cur_rx->bytecnt) - ETHER_CRC_LEN;
-		bufsize = cur_rx->bufsize;
+		bufsize = MVGBE2H16(cur_rx->bufsize);
 
 		cdata->mvgbe_rx_map[idx] = NULL;
 



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:33:05 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Correct byte-order for bufsize field of RX descriptor.

XXX
This bug affected only armeb. Unfortunately, the systems including
armel still lock up eventually with NFS root on mvgbe(4)...


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 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.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.64 src/sys/dev/marvell/if_mvgbe.c:1.65
--- src/sys/dev/marvell/if_mvgbe.c:1.64	Sat May 21 10:24:50 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:27:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin 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.64 2022/05/21 10:24:50 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.65 2022/05/21 10:27:30 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -2127,13 +2127,14 @@ mvgbe_txeof(struct mvgbe_softc *sc)
 		if (cdata->mvgbe_tx_chain[idx].mvgbe_mbuf != NULL) {
 			entry = cdata->mvgbe_tx_map[idx];
 
-			m_freem(cdata->mvgbe_tx_chain[idx].mvgbe_mbuf);
-			cdata->mvgbe_tx_chain[idx].mvgbe_mbuf = NULL;
-
 			bus_dmamap_sync(sc->sc_dmat, entry->dmamap, 0,
 			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
 			bus_dmamap_unload(sc->sc_dmat, entry->dmamap);
+
+			m_freem(cdata->mvgbe_tx_chain[idx].mvgbe_mbuf);
+			cdata->mvgbe_tx_chain[idx].mvgbe_mbuf = NULL;
+
 			SIMPLEQ_INSERT_TAIL(>sc_txmap_head, entry, link);
 			cdata->mvgbe_tx_map[idx] = NULL;
 		}



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:27:30 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
m_freem() *after* bus_dmamap_sync() and bus_dmamap_load() for
that mbuf. This is mandatory for some archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 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.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:24:50 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Add DPRINTF() to catch failure of m_defrag() in mvgbe_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.63 src/sys/dev/marvell/if_mvgbe.c:1.64
--- src/sys/dev/marvell/if_mvgbe.c:1.63	Sat May 21 10:22:27 2022
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:24:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin 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.63 2022/05/21 10:22:27 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.64 2022/05/21 10:24:50 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1825,8 +1825,10 @@ do_defrag:
 		/* A small unaligned segment was detected. */
 		struct mbuf *m_new;
 		m_new = m_defrag(m_head, M_DONTWAIT);
-		if (m_new == NULL)
+		if (m_new == NULL) {
+			DPRINTFN(2, ("mvgbe_encap: defrag failed\n"));
 			return EFBIG;
+		}
 		m_head = m_new;
 	}
 



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:24:50 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Add DPRINTF() to catch failure of m_defrag() in mvgbe_encap().


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 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.



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:22:27 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Raise threshold of debug level to 3 for DPRINTF() in non-error path of
mvgbe_encap(). Without this change, debug level 2 is almost unusable...


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.62 src/sys/dev/marvell/if_mvgbe.c:1.63
--- src/sys/dev/marvell/if_mvgbe.c:1.62	Mon Aug 30 00:08:28 2021
+++ src/sys/dev/marvell/if_mvgbe.c	Sat May 21 10:22:27 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin 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.62 2021/08/30 00:08:28 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.63 2022/05/21 10:22:27 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1871,7 +1871,7 @@ do_defrag:
 	}
 
 
-	DPRINTFN(2, ("mvgbe_encap: dm_nsegs=%d\n", txmap->dm_nsegs));
+	DPRINTFN(3, ("mvgbe_encap: dm_nsegs=%d\n", txmap->dm_nsegs));
 
 	for (i = 0; i < txmap->dm_nsegs; i++) {
 		f = >sc_rdata->mvgbe_tx_ring[current];



CVS commit: src/sys/dev/marvell

2022-05-21 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 21 10:22:27 UTC 2022

Modified Files:
src/sys/dev/marvell: if_mvgbe.c

Log Message:
Raise threshold of debug level to 3 for DPRINTF() in non-error path of
mvgbe_encap(). Without this change, debug level 2 is almost unusable...


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 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.



CVS commit: src/sys/dev/marvell

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:09 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.11 src/sys/dev/marvell/mvxpsec.c:1.12
--- src/sys/dev/marvell/mvxpsec.c:1.11	Sat Mar 12 15:32:32 2022
+++ src/sys/dev/marvell/mvxpsec.c	Wed Apr  6 22:48:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.11 2022/03/12 15:32:32 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.12 2022/04/06 22:48:09 riastradh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -401,7 +401,7 @@ mvxpsec_attach(device_t parent, device_t
 	/* INTR */
 	MVXPSEC_WRITE(sc, MVXPSEC_INT_MASK, MVXPSEC_DEFAULT_INT);
 	MVXPSEC_WRITE(sc, MV_TDMA_ERR_MASK, MVXPSEC_DEFAULT_ERR);
-	sc->sc_done_ih = 
+	sc->sc_done_ih =
 	marvell_intr_establish(mva->mva_irq, IPL_NET, mvxpsec_intr, sc);
 	/* XXX: sould pass error IRQ using mva */
 	sc->sc_error_ih = marvell_intr_establish(MVXPSEC_ERR_INT(sc),
@@ -434,7 +434,7 @@ mvxpsec_attach(device_t parent, device_t
 	MVXPSEC_WRITE(sc, MV_ACC_COMMAND, MV_ACC_COMMAND_STOP);
 
 	/* Session */
-	sc->sc_session_pool = 
+	sc->sc_session_pool =
 	pool_cache_init(sizeof(struct mvxpsec_session), 0, 0, 0,
 	"mvxpsecpl", NULL, IPL_NET,
 	mvxpsec_session_ctor, mvxpsec_session_dtor, sc);
@@ -577,7 +577,7 @@ mvxpsec_timer(void *aux)
 #ifdef MVXPSEC_DEBUG
 	mvxpsec_dump_reg(sc);
 #endif
-	
+
 	s = splnet();
 	/* stop security accelerator */
 	MVXPSEC_WRITE(sc, MV_ACC_COMMAND, MV_ACC_COMMAND_STOP);
@@ -771,7 +771,6 @@ mvxpsec_dma_setup(struct mvxpsec_descrip
 #ifdef MVXPSEC_DEBUG
 	mvxpsec_dump_dmaq(dh);
 #endif
-
 }
 
 /*
@@ -889,7 +888,7 @@ mvxpsec_dma_copy_packet(struct mvxpsec_s
 	 *   ||
 	 *   vv
 	 *   ++...
-	 *   |IV  |DATA
+	 *   |IV  |DATA
 	 *   ++...
 	 */
 	pkt_off = 0;
@@ -909,7 +908,7 @@ mvxpsec_dma_copy_packet(struct mvxpsec_s
 	if (__predict_false(err))
 		return err;
 
-	/* 
+	/*
 	 * make DMA descriptors to copy session header: DRAM -> SRAM
 	 * we can reuse session header on SRAM if session is not changed.
 	 */
@@ -1268,7 +1267,7 @@ STATIC uint32_t
 mvxpsec_eintr_ack(struct mvxpsec_softc *sc)
 {
 	uint32_t reg;
- 
+
 	reg  = MVXPSEC_READ(sc, MV_TDMA_ERR_CAUSE);
 	reg &= MVXPSEC_DEFAULT_ERR;
 	MVXPSEC_WRITE(sc, MV_TDMA_ERR_CAUSE, ~reg);
@@ -1445,7 +1444,7 @@ mvxpsec_packet_ctor(void *arg, void *obj
 		log(LOG_ERR, "%s: cannot create DMA map\n", __func__);
 		goto fail;
 	}
-	if (bus_dmamap_load(sc->sc_dmat, mv_p->pkt_header_map, 
+	if (bus_dmamap_load(sc->sc_dmat, mv_p->pkt_header_map,
 	_p->pkt_header, sizeof(mv_p->pkt_header),
 	NULL, BUS_DMA_NOWAIT)) {
 		log(LOG_ERR, "%s: cannot load header\n", __func__);
@@ -1533,7 +1532,7 @@ mvxpsec_session_ref(struct mvxpsec_sessi
 
 	refs = atomic_inc_32_nv(_s->refs);
 	if (refs == 1) {
-		/* 
+		/*
 		 * a session with refs == 0 is
 		 * already invalidated. revert it.
 		 * XXX: use CAS ?
@@ -1543,7 +1542,7 @@ mvxpsec_session_ref(struct mvxpsec_sessi
 		"%s: session is already invalidated.\n", __func__);
 		return -1;
 	}
-	
+
 	return 0;
 }
 
@@ -2128,7 +2127,7 @@ mvxpsec_dispatch(void *arg, struct crypt
 	err = mvxpsec_packet_setcrp(mv_p, crp);
 	if (__predict_false(err))
 		goto fail;
-	
+
 	/*
 	 * Setup DMA descriptor chains
 	 */
@@ -2660,7 +2659,7 @@ STATIC int
 mvxpsec_packet_write_iv(struct mvxpsec_packet *mv_p, void *iv, int ivlen)
 {
 	uint8_t ivbuf[16];
-	
+
 	KASSERT(ivlen == 8 || ivlen == 16);
 
 	if (iv == NULL) {
@@ -2924,7 +2923,7 @@ static uint8_t AES_SBOX[256] = {
	  7,  18, 128, 226, 235,  39, 178, 117,   9, 131,  44,  26,  27, 110,
 	 90, 160,  82,  59, 214, 179,  41, 227,  47, 132,  83, 209,   0, 237,
	 32, 252, 177,  91, 106, 203, 190,  57,  74,  76,  88, 207, 208, 239,
-	170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168, 
+	170, 251,  67,  77,  51, 133,  69, 249,   2, 127,  80,  60, 159, 168,
 	 81, 163,  64, 143, 146, 157,  56, 245, 188, 182, 218,  33,  16, 255,
 	243, 210, 205,  12,  19, 236,  95, 151,  68,  23, 196, 167, 126,  61,
	100,  93,  25, 115,  96, 129,  79, 220,  34,  42, 144, 136,  70, 238,
@@ -2938,7 +2937,7 @@ static uint8_t AES_SBOX[256] = {
 	176,  84, 187,  22
 };
 
-static uint32_t AES_RCON[30] = { 
+static uint32_t AES_RCON[30] = {
 	0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8,
	0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4,
	0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91
@@ -2946,11 +2945,11 @@ static uint32_t AES_RCON[30] = { 
 
 STATIC int
 mv_aes_ksched(uint8_t k[4][MAXKC], int keyBits,
-uint8_t 

CVS commit: src/sys/dev/marvell

2022-04-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr  6 22:48:09 UTC 2022

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
mvxpsec(4): Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 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.



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 07:57:38 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/sumary/summary/


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.36 src/sys/dev/marvell/if_mvxpe.c:1.37
--- src/sys/dev/marvell/if_mvxpe.c:1.36	Fri Sep 17 08:13:06 2021
+++ src/sys/dev/marvell/if_mvxpe.c	Sun Dec  5 07:57:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.36 2021/09/17 08:13:06 andvar Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 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.36 2021/09/17 08:13:06 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.37 2021/12/05 07:57:38 msaitoh Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1600,15 +1600,15 @@ mvxpe_rxtx_intr(void *arg)
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_tbrq);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PRXTXTHICSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PRXTXTHIC Sumary\n");
+			DPRINTIFNET(ifp, 1, "PRXTXTHIC Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_rxtxth);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PTXERRORSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PTXERROR Sumary\n");
+			DPRINTIFNET(ifp, 1, "PTXERROR Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_txerr);
 		}
 		if (prxtxic & MVXPE_PRXTXI_PMISCICSUMMARY) {
-			DPRINTIFNET(ifp, 1, "PMISCIC Sumary\n");
+			DPRINTIFNET(ifp, 1, "PMISCIC Summary\n");
 			MVXPE_EVCNT_INCR(>sc_ev.ev_rxtx_misc);
 		}
 	}



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 07:57:38 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpe.c

Log Message:
s/sumary/summary/


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 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.



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 02:41:44 UTC 2021

Modified Files:
src/sys/dev/marvell: mvcesa.c mvcesareg.h

Log Message:
s/decript/decrypt/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvcesa.c
cvs rdiff -u -r1.2 -r1.3 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/mvcesa.c
diff -u src/sys/dev/marvell/mvcesa.c:1.3 src/sys/dev/marvell/mvcesa.c:1.4
--- src/sys/dev/marvell/mvcesa.c:1.3	Sun Jun 14 23:29:23 2020
+++ src/sys/dev/marvell/mvcesa.c	Sun Dec  5 02:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $	*/
+/*	$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.3 2020/06/14 23:29:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvcesa.c,v 1.4 2021/12/05 02:41:44 msaitoh Exp $");
 
 #include 
 #include 
@@ -716,7 +716,7 @@ mvcesa_des_encdec(struct mvcesa_softc *s
 		}
 
 		/*
-		 * Encryption/Decription calculation time is 9 cycles in DES
+		 * Encryption/Decryption calculation time is 9 cycles in DES
 		 * mode and 25 cycles in 3DES mode.
 		 */
 		bus_space_write_4(sc->sc_iot, sc->sc_ioh, MVCESA_DESE_DBL,

Index: src/sys/dev/marvell/mvcesareg.h
diff -u src/sys/dev/marvell/mvcesareg.h:1.2 src/sys/dev/marvell/mvcesareg.h:1.3
--- src/sys/dev/marvell/mvcesareg.h:1.2	Sat Sep 28 05:46:51 2013
+++ src/sys/dev/marvell/mvcesareg.h	Sun Dec  5 02:41:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvcesareg.h,v 1.2 2013/09/28 05:46:51 kiyohara Exp $	*/
+/*	$NetBSD: mvcesareg.h,v 1.3 2021/12/05 02:41:44 msaitoh Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -80,7 +80,7 @@
 #define MVCESA_SHA1MD5I_AC_IVBYTESWAP		(1 << 4)
 #define MVCESA_SHA1MD5I_AC_TERMINATION		(1 << 31)
 
-/* AES Encryption/Decription Interface Registers */
+/* AES Encryption/Decryption Interface Registers */
 #define MVCESA_AES_ENCRYPTION	0xd80
 #define MVCESA_AES_DECRYPTION	0xdc0
 #define MVCESA_AES_DIOC_OFF	  0x20	/* Data In/Out Column */



CVS commit: src/sys/dev/marvell

2021-12-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Sun Dec  5 02:41:44 UTC 2021

Modified Files:
src/sys/dev/marvell: mvcesa.c mvcesareg.h

Log Message:
s/decript/decrypt/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/mvcesa.c
cvs rdiff -u -r1.2 -r1.3 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.



CVS commit: src/sys/dev/marvell

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 15:55:35 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
s/Erorr/Error/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.6 src/sys/dev/marvell/if_mvxpereg.h:1.7
--- src/sys/dev/marvell/if_mvxpereg.h:1.6	Tue Aug 17 22:00:31 2021
+++ src/sys/dev/marvell/if_mvxpereg.h	Wed Nov 10 15:55:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpereg.h,v 1.6 2021/08/17 22:00:31 andvar Exp $	*/
+/*	$NetBSD: if_mvxpereg.h,v 1.7 2021/11/10 15:55:35 msaitoh Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -225,8 +225,8 @@
 /* SGMII PHY Registers */
 #define MVXPE_PPLLC		0x2e04	/* Power and PLL Control */
 #define MVXPE_TESTC0		0x2e54	/* PHY Test Control 0 */
-#define MVXPE_TESTPRBSEC0	0x2e7c	/* PHY Test PRBS Erorr Counter 0 */
-#define MVXPE_TESTPRBSEC1	0x2e80	/* PHY Test PRBS Erorr Counter 1 */
+#define MVXPE_TESTPRBSEC0	0x2e7c	/* PHY Test PRBS Error Counter 0 */
+#define MVXPE_TESTPRBSEC1	0x2e80	/* PHY Test PRBS Error Counter 1 */
 #define MVXPE_TESTOOB0		0x2e84	/* PHY Test OOB 0 */
 #define MVXPE_DLE		0x2e8c	/* Digital Loopback Enable */
 #define MVXPE_RCS		0x2f18	/* Reference Clock Select */



CVS commit: src/sys/dev/marvell

2021-11-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Nov 10 15:55:35 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvxpereg.h

Log Message:
s/Erorr/Error/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 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.



CVS commit: src/sys/dev/marvell

2021-08-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 30 00:08:28 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add ARMEB support to mvgbe(4).

For ARMEB, peripheral is configured to little-endian mode, even if
CPU itself is in big-endian mode. Therefore, we need to configure
the device to little-endian mode, and byte-swap descriptor fields
(unlike the case of powerpc).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.8 -r1.9 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.61 src/sys/dev/marvell/if_mvgbe.c:1.62
--- src/sys/dev/marvell/if_mvgbe.c:1.61	Sat Aug  7 16:19:13 2021
+++ src/sys/dev/marvell/if_mvgbe.c	Mon Aug 30 00:08:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.61 2021/08/07 16:19:13 thorpej Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin 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.61 2021/08/07 16:19:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.62 2021/08/30 00:08:28 rin Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -1254,7 +1254,7 @@ mvgbe_init(struct ifnet *ifp)
 	/* Set SDC register except IPGINT bits */
 	MVGBE_WRITE(sc, MVGBE_SDC,
 	MVGBE_SDC_RXBSZ_16_64BITWORDS |
-#if BYTE_ORDER == LITTLE_ENDIAN
+#ifndef MVGBE_BIG_ENDIAN
 	MVGBE_SDC_BLMR |	/* Big/Little Endian Receive Mode: No swap */
 	MVGBE_SDC_BLMT |	/* Big/Little Endian Transmit Mode: No swap */
 #endif
@@ -1517,12 +1517,12 @@ mvgbe_init_rx_ring(struct mvgbe_softc *s
 			cd->mvgbe_rx_chain[i].mvgbe_next =
 			>mvgbe_rx_chain[0];
 			rd->mvgbe_rx_ring[i].nextdescptr =
-			MVGBE_RX_RING_ADDR(sc, 0);
+			H2MVGBE32(MVGBE_RX_RING_ADDR(sc, 0));
 		} else {
 			cd->mvgbe_rx_chain[i].mvgbe_next =
 			>mvgbe_rx_chain[i + 1];
 			rd->mvgbe_rx_ring[i].nextdescptr =
-			MVGBE_RX_RING_ADDR(sc, i + 1);
+			H2MVGBE32(MVGBE_RX_RING_ADDR(sc, i + 1));
 		}
 	}
 
@@ -1557,14 +1557,15 @@ mvgbe_init_tx_ring(struct mvgbe_softc *s
 			cd->mvgbe_tx_chain[i].mvgbe_next =
 			>mvgbe_tx_chain[0];
 			rd->mvgbe_tx_ring[i].nextdescptr =
-			MVGBE_TX_RING_ADDR(sc, 0);
+			H2MVGBE32(MVGBE_TX_RING_ADDR(sc, 0));
 		} else {
 			cd->mvgbe_tx_chain[i].mvgbe_next =
 			>mvgbe_tx_chain[i + 1];
 			rd->mvgbe_tx_ring[i].nextdescptr =
-			MVGBE_TX_RING_ADDR(sc, i + 1);
+			H2MVGBE32(MVGBE_TX_RING_ADDR(sc, i + 1));
 		}
-		rd->mvgbe_tx_ring[i].cmdsts = MVGBE_BUFFER_OWNED_BY_HOST;
+		rd->mvgbe_tx_ring[i].cmdsts =
+		H2MVGBE32(MVGBE_BUFFER_OWNED_BY_HOST);
 	}
 
 	sc->sc_cdata.mvgbe_tx_prod = 0;
@@ -1629,9 +1630,10 @@ mvgbe_newbuf(struct mvgbe_softc *sc, int
 	r = c->mvgbe_desc;
 	c->mvgbe_mbuf = m_new;
 	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->bufptr = H2MVGBE32(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;
+	r->cmdsts =
+	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA | MVGBE_RX_ENABLE_INTERRUPT);
 
 	/* Invalidate RX buffer */
 	bus_dmamap_sync(sc->sc_dmat, dmamap, offset, r->bufsize,
@@ -1873,10 +1875,10 @@ do_defrag:
 
 	for (i = 0; i < txmap->dm_nsegs; i++) {
 		f = >sc_rdata->mvgbe_tx_ring[current];
-		f->bufptr = txseg[i].ds_addr;
-		f->bytecnt = txseg[i].ds_len;
+		f->bufptr = H2MVGBE32(txseg[i].ds_addr);
+		f->bytecnt = H2MVGBE16(txseg[i].ds_len);
 		if (i != 0)
-			f->cmdsts = MVGBE_BUFFER_OWNED_BY_DMA;
+			f->cmdsts = H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA);
 		last = current;
 		current = MVGBE_TX_RING_NEXT(current);
 	}
@@ -1897,21 +1899,21 @@ do_defrag:
 		MVGBE_TX_IP_HEADER_LEN(iphdr_unitlen);	/* unit is 4B */
 	}
 	if (txmap->dm_nsegs == 1)
-		f->cmdsts = cmdsts		|
+		f->cmdsts = H2MVGBE32(cmdsts	|
 		MVGBE_TX_ENABLE_INTERRUPT	|
 		MVGBE_TX_ZERO_PADDING	|
 		MVGBE_TX_FIRST_DESC		|
-		MVGBE_TX_LAST_DESC;
+		MVGBE_TX_LAST_DESC);
 	else {
 		f = >sc_rdata->mvgbe_tx_ring[first];
-		f->cmdsts = cmdsts | MVGBE_TX_FIRST_DESC;
+		f->cmdsts = H2MVGBE32(cmdsts | MVGBE_TX_FIRST_DESC);
 
 		f = >sc_rdata->mvgbe_tx_ring[last];
-		f->cmdsts =
+		f->cmdsts = H2MVGBE32(
 		MVGBE_BUFFER_OWNED_BY_DMA	|
 		MVGBE_TX_ENABLE_INTERRUPT	|
 		MVGBE_TX_ZERO_PADDING	|
-		MVGBE_TX_LAST_DESC;
+		MVGBE_TX_LAST_DESC);
 
 		/* Sync descriptors except first */
 		MVGBE_CDTXSYNC(sc,
@@ -1926,7 +1928,7 @@ do_defrag:
 
 	/* Finally, sync first descriptor */
 	sc->sc_rdata->mvgbe_tx_ring[first].cmdsts |=
-	MVGBE_BUFFER_OWNED_BY_DMA;
+	H2MVGBE32(MVGBE_BUFFER_OWNED_BY_DMA);
 	MVGBE_CDTXSYNC(sc, *txidx, 

CVS commit: src/sys/dev/marvell

2021-08-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Aug 30 00:08:28 UTC 2021

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add ARMEB support to mvgbe(4).

For ARMEB, peripheral is configured to little-endian mode, even if
CPU itself is in big-endian mode. Therefore, we need to configure
the device to little-endian mode, and byte-swap descriptor fields
(unlike the case of powerpc).


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.8 -r1.9 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.



CVS commit: src/sys/dev/marvell

2019-10-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Oct  1 17:35:09 UTC 2019

Modified Files:
src/sys/dev/marvell: files.armada if_mvxpe.c

Log Message:
make this compile again:
 - remove unused config attributes
 - rename a local variable to avoid a name conflict


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/files.armada
cvs rdiff -u -r1.28 -r1.29 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.



CVS commit: src/sys/dev/marvell

2019-10-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Oct  1 17:35:09 UTC 2019

Modified Files:
src/sys/dev/marvell: files.armada if_mvxpe.c

Log Message:
make this compile again:
 - remove unused config attributes
 - rename a local variable to avoid a name conflict


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/marvell/files.armada
cvs rdiff -u -r1.28 -r1.29 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/files.armada
diff -u src/sys/dev/marvell/files.armada:1.3 src/sys/dev/marvell/files.armada:1.4
--- src/sys/dev/marvell/files.armada:1.3	Wed Jun  3 04:20:02 2015
+++ src/sys/dev/marvell/files.armada	Tue Oct  1 17:35:09 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.armada,v 1.3 2015/06/03 04:20:02 hsuenaga Exp $
+#	$NetBSD: files.armada,v 1.4 2019/10/01 17:35:09 chs Exp $
 # Configuration info for Marvell ARMADA integrated peripherals
 
 # ARMADA XP Buffer Manger
@@ -6,11 +6,9 @@ device	mvxpbm { [port = -1 ], [irq = -1]
 file	dev/marvell/mvxpbm.c
 
 # ARMADA XP Gigabit Ethernet Controller Interface
-define	mvxpe { [port = -1 ], [irq = -1] }
 device	mvxpe: mvxpbm, ether, ifnet, arp, mii
 file	dev/marvell/if_mvxpe.c			mvxpe		needs-flag
 
 # ARMADA XP Cryptographic Engines and Security Accelerator
-define	mvxpsec { [port = -1 ], [irq = -1] }
 device	mvxpsec: opencrypto
 file	dev/marvell/mvxpsec.c			mvxpsec		needs-flag

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.28 src/sys/dev/marvell/if_mvxpe.c:1.29
--- src/sys/dev/marvell/if_mvxpe.c:1.28	Fri Sep 13 07:55:07 2019
+++ src/sys/dev/marvell/if_mvxpe.c	Tue Oct  1 17:35:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.28 2019/09/13 07:55:07 msaitoh Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.29 2019/10/01 17:35:09 chs 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.28 2019/09/13 07:55:07 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.29 2019/10/01 17:35:09 chs Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -286,7 +286,7 @@ STATIC void
 mvxpe_attach(device_t parent, device_t self, void *aux)
 {
 	struct mvxpe_softc *sc = device_private(self);
-	struct mii_softc *mii;
+	struct mii_softc *child;
 	struct ifnet *ifp = >sc_ethercom.ec_if;
 	struct mii_data * const mii = >sc_mii;
 	struct marvell_attach_args *mva = aux;
@@ -485,14 +485,14 @@ mvxpe_attach(device_t parent, device_t s
 	 * but some boards may not.
 	 */
 	mii_attach(self, mii, 0x, MII_PHY_ANY, sc->sc_dev->dv_unit, 0);
-	mii = LIST_FIRST(>mii_phys);
-	if (mii == NULL) {
+	child = LIST_FIRST(>mii_phys);
+	if (child == NULL) {
 		aprint_error_dev(self, "no PHY found!\n");
 		ifmedia_add(>mii_media, IFM_ETHER | IFM_MANUAL, 0, NULL);
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_MANUAL);
 	} else {
 		ifmedia_set(>mii_media, IFM_ETHER | IFM_AUTO);
-		phyaddr = MVXPE_PHYADDR_PHYAD(mii->mii_phy);
+		phyaddr = MVXPE_PHYADDR_PHYAD(child->mii_phy);
 		MVXPE_WRITE(sc, MVXPE_PHYADDR, phyaddr);
 		DPRINTSC(sc, 1, "PHYADDR: %#x\n", MVXPE_READ(sc, MVXPE_PHYADDR));
 	}



Re: CVS commit: src/sys/dev/marvell

2013-08-04 Thread Radoslaw Kujawa
Hi.

On 3 Aug 2013, at 9:39 AM, KIYOHARA Takashi kiyoh...@netbsd.org wrote:

 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.

Did you actually test this on Armada?

-- 
Best regards,
Radoslaw Kujawa



Re: CVS commit: src/sys/dev/marvell

2013-08-03 Thread KIYOHARA Takashi
Hi!

From: Radoslaw Kujawa radoslaw.kuj...@c0ff33.net
Date: Sat, 3 Aug 2013 09:46:08 +0200

 On 3 Aug 2013, at 9:39 AM, KIYOHARA Takashi kiyoh...@netbsd.org wrote:
 
  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.
 
 Did you actually test this on Armada?

Yes, I do.
I tested on my OpenBlocks AX3.
Also described STOP-bit on document for Kirkwood.

Thanks,
--
kiyohara


Re: CVS commit: src/sys/dev/marvell

2011-03-06 Thread Jonathan A. Kollasch
On Sun, Mar 06, 2011 at 12:00:16PM -0500, Christos Zoulas wrote:
 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

This doesn't compile.

Also, it prevents detection of my:
mvgbec0 at mvsoc0 unit 0 offset 0x7-0x73fff: Marvell Gigabit Ethernet 
Controller
mvgbe0 at mvgbec0 port 0 irq 21
mvgbe0: Ethernet address 00:0a:e4:88:fa:88
makphy0 at mvgbe0 phy 8: Marvell 88E1116 Gigabit PHY, rev. 1
makphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 
1000baseT-FDX, auto

Note it's address is 8, not 0 or 1.


re: CVS commit: src/sys/dev/marvell

2011-03-05 Thread matthew green

 Module Name:  src
 Committed By: christos
 Date: Sat Mar  5 18:28:13 UTC 2011
 
 Modified Files:
   src/sys/dev/marvell: if_mvgbe.c
 
 Log Message:
 From Dave Mills: It would appear that the two PHYs can only be
 accessed from the registers of controller0 (mvgbec0) hence why both
 PHYs are being detected on controller0. I have made the assumption
 that PHY0 = controller0 (mvgbec0), PHY1 = controller1(mvgbec1)
 and developed a patch accordingly. Also the irq is 15 for controller1
 not 14.

this patch introduced cf_unit abuse.  please re-work it.


.mrg.


CVS commit: src/sys/dev/marvell

2010-02-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 25 23:34:54 UTC 2010

Modified Files:
src/sys/dev/marvell: gt.c

Log Message:
Adapt to powerpc/spr.h breakup.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.



CVS commit: src/sys/dev/marvell

2010-02-25 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Feb 25 23:34:54 UTC 2010

Modified Files:
src/sys/dev/marvell: gt.c

Log Message:
Adapt to powerpc/spr.h breakup.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/dev/marvell/gt.c:1.22
--- src/sys/dev/marvell/gt.c:1.21	Tue May 12 14:30:25 2009
+++ src/sys/dev/marvell/gt.c	Thu Feb 25 23:34:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gt.c,v 1.21 2009/05/12 14:30:25 cegger Exp $	*/
+/*	$NetBSD: gt.c,v 1.22 2010/02/25 23:34:54 matt Exp $	*/
 
 /*
  * Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gt.c,v 1.21 2009/05/12 14:30:25 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: gt.c,v 1.22 2010/02/25 23:34:54 matt Exp $);
 
 #include opt_marvell.h
 #include locators.h
@@ -60,6 +60,7 @@
 
 #include powerpc/spr.h
 #include powerpc/oea/hid.h
+#include powerpc/oea/spr.h
 
 #include dev/marvell/gtreg.h
 #include dev/marvell/gtintrreg.h