CVS commit: src/sys/dev/pci

2016-02-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Feb 12 08:36:08 UTC 2016

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
add several NVIDIA geforce and NVS cards.


To generate a diff of this commit:
cvs rdiff -u -r1.1246 -r1.1247 src/sys/dev/pci/pcidevs

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/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1246 src/sys/dev/pci/pcidevs:1.1247
--- src/sys/dev/pci/pcidevs:1.1246	Mon Feb  1 08:27:17 2016
+++ src/sys/dev/pci/pcidevs	Fri Feb 12 08:36:08 2016
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1246 2016/02/01 08:27:17 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1247 2016/02/12 08:36:08 mrg Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -5133,6 +5133,22 @@ product NVIDIA	MCP79_AHCI_11	0x0abe	nFor
 product NVIDIA	MCP79_AHCI_12	0x0abf	nForce MCP79 AHCI Controller
 product NVIDIA	GEFORCE_210_HDA	0x0be3	GeForce 210 High Definition Audio Controller
 product NVIDIA	GF_GT640M	0x0fd2	GeForce GT 640M
+product NVIDIA	GT520		0x1040	GeForce GT 520
+product NVIDIA	GEFORCE_510	0x1042	GeForce 510
+product NVIDIA	GEFORCE_605	0x1048	GeForce 605
+product NVIDIA	GT620		0x1049	GeForce GT 620
+product NVIDIA	GT610		0x104a	GeForce GT 610
+product NVIDIA	GT520M		0x1050	GeForce GT 520M
+product NVIDIA	GT520MX		0x1051	GeForce GT 520MX
+product NVIDIA	GT520M2		0x1052	GeForce GT 520M
+product NVIDIA	GEFORCE_410M	0x1054	GeForce 410M
+product NVIDIA	GEFORCE_410M2	0x1055	GeForce 410M
+product NVIDIA	NVS_4200M	0x1056	GeForce NVS 4200M
+product NVIDIA	NVS_4200M2	0x1057	GeForce NVS 4200M
+product NVIDIA	GEFORCE_610M	0x1058	GeForce 610M
+product NVIDIA	GEFORCE_610M2	0x1059	GeForce 610M
+product NVIDIA	GEFORCE_610M3	0x1059	GeForce 610M
+product NVIDIA	GT610M		0x105A	GeForce GT 610M
 product NVIDIA	GF116		0x1244	GeForce GTX 550 Ti
 
 /* Nvidia & SGS-Thomson Microelectronics */



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
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: [netbsd-7] src/sys/arch/x86/x86

2016-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 12 10:55:35 UTC 2016

Modified Files:
src/sys/arch/x86/x86 [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1115):
sys/arch/x86/x86/pmap.c: patch
Use IPL_NONE for pserialized lock.  Assert sleepable.  (OOPS.)


To generate a diff of this commit:
cvs rdiff -u -r1.183.2.2 -r1.183.2.3 src/sys/arch/x86/x86/pmap.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/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.183.2.2 src/sys/arch/x86/x86/pmap.c:1.183.2.3
--- src/sys/arch/x86/x86/pmap.c:1.183.2.2	Thu Apr 23 07:31:16 2015
+++ src/sys/arch/x86/x86/pmap.c	Fri Feb 12 10:55:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.183.2.2 2015/04/23 07:31:16 snj Exp $	*/
+/*	$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.2 2015/04/23 07:31:16 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183.2.3 2016/02/12 10:55:35 snj Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -490,7 +490,7 @@ void
 pmap_pv_init(void)
 {
 
-	mutex_init(_unmanaged.lock, MUTEX_DEFAULT, IPL_VM);
+	mutex_init(_unmanaged.lock, MUTEX_DEFAULT, IPL_NONE);
 	pv_unmanaged.psz = pserialize_create();
 	pv_unmanaged.list = NULL;
 }
@@ -504,6 +504,9 @@ pmap_pv_track(paddr_t start, psize_t siz
 	KASSERT(start == trunc_page(start));
 	KASSERT(size == trunc_page(size));
 
+	/* We may sleep for allocation.  */
+	ASSERT_SLEEPABLE();
+
 	npages = size >> PAGE_SHIFT;
 	pvt = kmem_zalloc(offsetof(struct pv_track, pvt_pages[npages]),
 	KM_SLEEP);
@@ -526,6 +529,9 @@ pmap_pv_untrack(paddr_t start, psize_t s
 	KASSERT(start == trunc_page(start));
 	KASSERT(size == trunc_page(size));
 
+	/* We may sleep for pserialize_perform.  */
+	ASSERT_SLEEPABLE();
+
 	mutex_enter(_unmanaged.lock);
 	for (pvtp = _unmanaged.list;
 	 (pvt = *pvtp) != NULL;



CVS commit: [netbsd-7] src/doc

2016-02-12 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Fri Feb 12 10:56:48 UTC 2016

Modified Files:
src/doc [netbsd-7]: CHANGES-7.1

Log Message:
1115


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.55 -r1.1.2.56 src/doc/CHANGES-7.1

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

Modified files:

Index: src/doc/CHANGES-7.1
diff -u src/doc/CHANGES-7.1:1.1.2.55 src/doc/CHANGES-7.1:1.1.2.56
--- src/doc/CHANGES-7.1:1.1.2.55	Thu Feb 11 23:59:00 2016
+++ src/doc/CHANGES-7.1	Fri Feb 12 10:56:48 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.55 2016/02/11 23:59:00 snj Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.56 2016/02/12 10:56:48 snj Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -2034,3 +2034,8 @@ sys/external/bsd/drm2/dist/drm/nouveau/c
 	some machines.
 	[riastradh, ticket #1116]
 
+sys/arch/x86/x86/pmap.cpatch
+
+	Use IPL_NONE for pserialized lock.  Assert sleepable.
+	[riastradh, ticket #1115]
+



CVS commit: src/lib/libedit

2016-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 12 15:11:09 UTC 2016

Modified Files:
src/lib/libedit: read.c

Log Message:
>From Ingo Schwarze:

If CHARSET_IS_UTF8 is not set, read_char() is broken in a large
number of ways:

 1. The isascii(3) check can yield false positives.  If a string in
an arbitrary encoding contains a byte in the range 0..127,
that does not at all imply that it forms a character all by
itself, and even less that it represents the same character
as in ASCII.  Consequently, read_char() may return characters
the user never typed.
Even if the encoding is not state dependent, the assumption that
bytes in the range 0..127 represent ASCII characters is broken.
Consider UTF-16, for example.

 2. The reverse problem can also occur.  In an arbitrary encoding,
there is no guarantee that a character that can be represented
by ASCII is represented by a seven-bit byte, and even less by
the same byte as in ASCII.
Even for single-byte encodings, these assumptions are broken.
Consider the ISO 646 national variants, for example.
Consequently, the current code is insufficient to keep ASCII
characters working even for single-byte encodings.

 3. The condition "++cbp != 1" can never trigger (because initially,
cbp is 0, and the code can only go back up via the final goto,
which has another cbp = 0 right before it) and it has no effect
(because cbp isn't used afterwards).

 4. bytes = ct_mbtowc(cp, cbuf, cbp) is broken.  If this returns -1,
the code assumes that is can just call mbtowc(3) again for later
input bytes.  In some implementations, that may even be broken
for state-independent encodings, but trying again after mbtowc(3)
failure certainly produces completely erratic and meaningless
results in state-dependent encodings.

 5. The assignment "*cp = (Char)(unsigned char)cbuf[0]" is
completely bogus.  Even if the byte cbuf[0] represents a
character all by itself, which it usually will not, whether
or not the cast produces the desired result depends on the
internal representation of wchar_t in the C library, which
the application program can know nothing about.  Even for ASCII
in the C/POSIX locale, an ASCII character other than '\0' ==
L'\0' == 0 need not have the same numeric value as a char and
as a wchar_t.

To summarize, this code only works if all of the following
conditions hold:

 - The encoding is a single-byte encoding.
 - ASCII is a subset of the encoding.
 - The implementation of mbtowc(3) in the C library does not
   require re-initialization after encoding errors.
 - The implementation of wchar_t in the C library uses the
   same numerical values as ASCII.

Otherwise, it silently produces wrong results.

The simplest way to fix this is to just use the same code as for
UTF-8 (right above).  Of course, that causes functional changes
but that shouldn't matter since current behaviour is undefined.

The patch below provides the following improvements:

 - It works for all stateless single-byte encodings, no matter
   whether they are somehow related to ASCII, no matter how
   mb[r]towc(3) are internally implemented, and no matter how
   wchar_t is internally represented.
 - Instead of producing unpredictable and definitely wrong
   results for non-UTF-8 multibyte characters, it behaves in
   a well-defined way: It aborts input processing, sets errno,
   and returns failure.
   Note that short of providing full support for arbitrary locales,
   it is impossible to do better.  We cannot know whether a given
   unsupported locale is state-dependent, and for a state-dependent
   locale, it makes no sense to retry parsing after an encoding
   error, so the best we can do is abort processing for *any*
   unsupported multi-byte character.
 - Note that single-byte characters in arbitrary state-independent
   locales still work, even in locales that may potentially also
   contain multibyte characters, as long as those don't occur in
   input.  I'm not sure whether any such locales exist in practice...

Tested with UTF-8 and C/POSIX on OpenBSD.  Also tested that in the
C/POSIX locale, non-ASCII bytes get through unmangled.  You may
wish to test with ISO-LATIN on NetBSD if NetBSD supports that.


Also use a constant for meta to avoid warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/lib/libedit/read.c

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

Modified files:

Index: src/lib/libedit/read.c
diff -u src/lib/libedit/read.c:1.74 src/lib/libedit/read.c:1.75
--- src/lib/libedit/read.c:1.74	Thu Feb 11 14:21:04 2016
+++ src/lib/libedit/read.c	Fri Feb 12 10:11:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: read.c,v 1.74 2016/02/11 19:21:04 christos Exp $	*/
+/*	$NetBSD: read.c,v 1.75 2016/02/12 15:11:09 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 

CVS commit: src/lib/libedit

2016-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 12 17:23:21 UTC 2016

Modified Files:
src/lib/libedit: eln.c

Log Message:
Avoid c99 for now.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libedit/eln.c

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

Modified files:

Index: src/lib/libedit/eln.c
diff -u src/lib/libedit/eln.c:1.20 src/lib/libedit/eln.c:1.21
--- src/lib/libedit/eln.c:1.20	Fri Feb 12 10:36:08 2016
+++ src/lib/libedit/eln.c	Fri Feb 12 12:23:21 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eln.c,v 1.20 2016/02/12 15:36:08 christos Exp $	*/
+/*	$NetBSD: eln.c,v 1.21 2016/02/12 17:23:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.20 2016/02/12 15:36:08 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.21 2016/02/12 17:23:21 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include "histedit.h"
@@ -73,8 +73,10 @@ el_gets(EditLine *el, int *nread)
 
 	tmp = el_wgets(el, nread);
 	if (tmp != NULL) {
+	int i;
 	size_t nwread = 0;
-	for (int i = 0; i < *nread; i++)
+
+	for (i = 0; i < *nread; i++)
 		nwread += ct_enc_width(tmp[i]);
 	*nread = (int)nwread;
 	}



CVS commit: [nick-nhusb] src/sys/arch/arm/allwinner

2016-02-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 12 16:43:38 UTC 2016

Modified Files:
src/sys/arch/arm/allwinner [nick-nhusb]: awin_usb.c

Log Message:
Mark ehci_intr as IST_MPSAFE when establishing the interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.17.2.5 -r1.17.2.6 src/sys/arch/arm/allwinner/awin_usb.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/arch/arm/allwinner/awin_usb.c
diff -u src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.5 src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.6
--- src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.5	Fri Feb 12 16:27:42 2016
+++ src/sys/arch/arm/allwinner/awin_usb.c	Fri Feb 12 16:43:38 2016
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.17.2.5 2016/02/12 16:27:42 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.17.2.6 2016/02/12 16:43:38 skrll Exp $");
 
 #include 
 #include 
@@ -255,7 +255,7 @@ ehci_awinusb_attach(device_t parent, dev
 	}
 
 	usbsc->usbsc_ehci_ih = intr_establish(irq, IPL_VM,
-	IST_LEVEL, ehci_intr, sc);
+	IST_LEVEL | IST_MPSAFE, ehci_intr, sc);
 	if (usbsc->usbsc_ehci_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
 		 irq);



CVS commit: src/lib/libedit

2016-02-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 12 15:36:08 UTC 2016

Modified Files:
src/lib/libedit: el.h eln.c read.c

Log Message:
GC IGNORE_EXTCHARS and simplify code (Ingo Schwarze)


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libedit/el.h
cvs rdiff -u -r1.19 -r1.20 src/lib/libedit/eln.c
cvs rdiff -u -r1.75 -r1.76 src/lib/libedit/read.c

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

Modified files:

Index: src/lib/libedit/el.h
diff -u src/lib/libedit/el.h:1.25 src/lib/libedit/el.h:1.26
--- src/lib/libedit/el.h:1.25	Fri Jul 29 19:44:44 2011
+++ src/lib/libedit/el.h	Fri Feb 12 10:36:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: el.h,v 1.25 2011/07/29 23:44:44 christos Exp $	*/
+/*	$NetBSD: el.h,v 1.26 2016/02/12 15:36:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -58,7 +58,6 @@
 #define	EDIT_DISABLED	0x04
 #define	UNBUFFERED	0x08
 #define	CHARSET_IS_UTF8 0x10
-#define	IGNORE_EXTCHARS 0x20/* Ignore characters read > 0xff */
 #define	NARROW_HISTORY	0x40
 #define	NARROW_READ	0x80
 

Index: src/lib/libedit/eln.c
diff -u src/lib/libedit/eln.c:1.19 src/lib/libedit/eln.c:1.20
--- src/lib/libedit/eln.c:1.19	Mon May 18 11:07:04 2015
+++ src/lib/libedit/eln.c	Fri Feb 12 10:36:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eln.c,v 1.19 2015/05/18 15:07:04 christos Exp $	*/
+/*	$NetBSD: eln.c,v 1.20 2016/02/12 15:36:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.19 2015/05/18 15:07:04 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.20 2016/02/12 15:36:08 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include "histedit.h"
@@ -50,12 +50,7 @@ el_getc(EditLine *el, char *cp)
 	int num_read;
 	wchar_t wc = 0;
 
-	if (!(el->el_flags & CHARSET_IS_UTF8))
-		el->el_flags |= IGNORE_EXTCHARS;
 	num_read = el_wgetc (el, );
-	if (!(el->el_flags & CHARSET_IS_UTF8))
-		el->el_flags &= ~IGNORE_EXTCHARS;
-
 	if (num_read > 0)
 		*cp = (char)wc;
 	return num_read;
@@ -76,8 +71,6 @@ el_gets(EditLine *el, int *nread)
 {
 	const wchar_t *tmp;
 
-	if (!(el->el_flags & CHARSET_IS_UTF8))
-		el->el_flags |= IGNORE_EXTCHARS;
 	tmp = el_wgets(el, nread);
 	if (tmp != NULL) {
 	size_t nwread = 0;
@@ -85,8 +78,6 @@ el_gets(EditLine *el, int *nread)
 		nwread += ct_enc_width(tmp[i]);
 	*nread = (int)nwread;
 	}
-	if (!(el->el_flags & CHARSET_IS_UTF8))
-		el->el_flags &= ~IGNORE_EXTCHARS;
 	return ct_encode_string(tmp, >el_lgcyconv);
 }
 

Index: src/lib/libedit/read.c
diff -u src/lib/libedit/read.c:1.75 src/lib/libedit/read.c:1.76
--- src/lib/libedit/read.c:1.75	Fri Feb 12 10:11:09 2016
+++ src/lib/libedit/read.c	Fri Feb 12 10:36:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: read.c,v 1.75 2016/02/12 15:11:09 christos Exp $	*/
+/*	$NetBSD: read.c,v 1.76 2016/02/12 15:36:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)read.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: read.c,v 1.75 2016/02/12 15:11:09 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.76 2016/02/12 15:36:08 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -305,7 +305,6 @@ read_char(EditLine *el, Char *cp)
 	int tried = 0;
 	char cbuf[MB_LEN_MAX];
 	size_t cbp = 0;
-	int bytes = 0;
 	int save_errno = errno;
 
  again:
@@ -341,12 +340,11 @@ read_char(EditLine *el, Char *cp)
 #ifdef WIDECHAR
 	do {
 		mbstate_t mbs;
-		size_t rbytes;
 again_lastbyte:
 		++cbp;
 		/* This only works because UTF8 is stateless */
 		memset(, 0, sizeof(mbs));
-		switch (rbytes = ct_mbrtowc(cp, cbuf, cbp, )) {
+		switch (ct_mbrtowc(cp, cbuf, cbp, )) {
 		case (size_t)-1:
 			if (cbp > 1) {
 /*
@@ -377,20 +375,14 @@ again_lastbyte:
 			goto again;
 		default:
 			/* Valid character, process it. */
-			bytes = (int)rbytes;
 			break;
 		}
 	} while (/*CONSTCOND*/0);
 #else
-		*cp = (Char)(unsigned char)cbuf[0];
+	*cp = (Char)(unsigned char)cbuf[0];
 #endif
 
-	if ((el->el_flags & IGNORE_EXTCHARS) && bytes > 1) {
-		cbp = 0; /* skip this character */
-		goto again;
-	}
-
-	return (int)num_read;
+	return 1;
 }
 
 /* read_pop():



CVS commit: [nick-nhusb] src/sys/arch/arm/allwinner

2016-02-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 12 16:27:42 UTC 2016

Modified Files:
src/sys/arch/arm/allwinner [nick-nhusb]: awin_usb.c

Log Message:
Don't check ehci_init against USBD_NORMAL_COMPLETION as it returns int
and not usb_status_t


To generate a diff of this commit:
cvs rdiff -u -r1.17.2.4 -r1.17.2.5 src/sys/arch/arm/allwinner/awin_usb.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/arch/arm/allwinner/awin_usb.c
diff -u src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.4 src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.5
--- src/sys/arch/arm/allwinner/awin_usb.c:1.17.2.4	Mon Apr  6 15:17:51 2015
+++ src/sys/arch/arm/allwinner/awin_usb.c	Fri Feb 12 16:27:42 2016
@@ -34,7 +34,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.17.2.4 2015/04/06 15:17:51 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_usb.c,v 1.17.2.5 2016/02/12 16:27:42 skrll Exp $");
 
 #include 
 #include 
@@ -235,7 +235,7 @@ ehci_awinusb_attach(device_t parent, dev
 	aprint_normal(": EHCI USB controller\n");
 
 	int error = ehci_init(sc);
-	if (error != USBD_NORMAL_COMPLETION) {
+	if (error) {
 		aprint_error_dev(self, "init failed, error=%d\n", error);
 		return;
 	}



CVS commit: [nick-nhusb] src/sys/arch

2016-02-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 12 16:36:33 UTC 2016

Modified Files:
src/sys/arch/arm/broadcom [nick-nhusb]: bcm53xx_usb.c
src/sys/arch/i386/pci [nick-nhusb]: gcscehci.c

Log Message:
Don't check ehci_init against USBD_NORMAL_COMPLETION as it returns int
and not usb_status_t


To generate a diff of this commit:
cvs rdiff -u -r1.6.4.2 -r1.6.4.3 src/sys/arch/arm/broadcom/bcm53xx_usb.c
cvs rdiff -u -r1.11.2.3 -r1.11.2.4 src/sys/arch/i386/pci/gcscehci.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/arch/arm/broadcom/bcm53xx_usb.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.6.4.2 src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.6.4.3
--- src/sys/arch/arm/broadcom/bcm53xx_usb.c:1.6.4.2	Fri Dec  5 13:23:37 2014
+++ src/sys/arch/arm/broadcom/bcm53xx_usb.c	Fri Feb 12 16:36:32 2016
@@ -32,7 +32,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_usb.c,v 1.6.4.2 2014/12/05 13:23:37 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_usb.c,v 1.6.4.3 2016/02/12 16:36:32 skrll Exp $");
 
 #include 
 #include 
@@ -183,7 +183,7 @@ ehci_bcmusb_attach(device_t parent, devi
 	aprint_normal(": ECHI USB controller\n");
 
 	int error = ehci_init(sc);
-	if (error != USBD_NORMAL_COMPLETION) {
+	if (error) {
 		aprint_error_dev(self, "init failed, error=%d\n", error);
 		return;
 	}

Index: src/sys/arch/i386/pci/gcscehci.c
diff -u src/sys/arch/i386/pci/gcscehci.c:1.11.2.3 src/sys/arch/i386/pci/gcscehci.c:1.11.2.4
--- src/sys/arch/i386/pci/gcscehci.c:1.11.2.3	Fri Dec  5 13:23:37 2014
+++ src/sys/arch/i386/pci/gcscehci.c	Fri Feb 12 16:36:33 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscehci.c,v 1.11.2.3 2014/12/05 13:23:37 skrll Exp $ */
+/* $NetBSD: gcscehci.c,v 1.11.2.4 2016/02/12 16:36:33 skrll Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gcscehci.c,v 1.11.2.3 2014/12/05 13:23:37 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscehci.c,v 1.11.2.4 2016/02/12 16:36:33 skrll Exp $");
 
 #include 
 #include 
@@ -170,7 +170,7 @@ gcscehci_attach(device_t parent, device_
 	sc->sc.sc_ncomp = ncomp;
 
 	int err = ehci_init(>sc);
-	if (err != USBD_NORMAL_COMPLETION) {
+	if (err) {
 		aprint_error("%s: init failed, error=%d\n", devname, err);
 		return;
 	}



CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
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

2016-02-12 Thread Hikaru Abe
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_mvxpe_clog, 0, NULL, ,
 	CTLFLAG_READWRITE, CTLTYPE_INT, "debug",
-	SYSCTL_DESCR("mvgbe device driver debug control"),
+	SYSCTL_DESCR("mvxpe device driver debug control"),
 	NULL, 0, _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_mvxpe_clog, 0, NULL, ,
 	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

2016-02-12 Thread Hikaru Abe
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

2016-02-12 Thread Hikaru Abe
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 @@ 

CVS commit: src/sys/dev/marvell

2016-02-12 Thread Hikaru Abe
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

2016-02-12 Thread Hikaru Abe
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

2016-02-12 Thread Hikaru Abe
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

2016-02-12 Thread Hikaru Abe
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_ev.ev_txd_lc);
+break;
 			case MVXPE_TX_F_EC_UR:
 MVXPE_EVCNT_INCR(>sc_ev.ev_txd_ur);
+break;
 			case MVXPE_TX_F_EC_RL:
 MVXPE_EVCNT_INCR(>sc_ev.ev_txd_rl);
+break;
 			default:
 MVXPE_EVCNT_INCR(>sc_ev.ev_txd_oth);
+break;
 			}
 			error = 1;
 		}