CVS commit: src/share/man/man5

2017-03-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 26 23:49:28 UTC 2017

Modified Files:
src/share/man/man5: core.5

Log Message:
Update core(5) with current reality

Note cpi_siglwp addition in NetBSD-2.0 and retaining the procinfo ver. 1.

Note ELF_NOTE_NETBSD_CORE_AUXV (2) addition in NetBSD-8.0.

Update the HISTORY section.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/share/man/man5/core.5

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

Modified files:

Index: src/share/man/man5/core.5
diff -u src/share/man/man5/core.5:1.28 src/share/man/man5/core.5:1.29
--- src/share/man/man5/core.5:1.28	Mon Oct 27 16:21:59 2014
+++ src/share/man/man5/core.5	Sun Mar 26 23:49:28 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: core.5,v 1.28 2014/10/27 16:21:59 wiz Exp $
+.\"	$NetBSD: core.5,v 1.29 2017/03/26 23:49:28 kamil Exp $
 .\"
 .\" Copyright (c) 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -56,7 +56,7 @@
 .\"
 .\" @(#)core.5	8.3 (Berkeley) 12/11/93
 .\"
-.Dd July 8, 2002
+.Dd March 27, 2017
 .Dt CORE 5
 .Os
 .Sh NAME
@@ -165,6 +165,7 @@ struct netbsd_elfcore_procinfo {
 uint32_t cpi_nlwps;/* number of LWPs */
 int8_t   cpi_name[32]; /* copy of p->p_comm */
 /* Add version 2 fields below here. */
+int32_t cpi_siglwp; /* LWP target of killing signal */
 };
 .Ed
 .Pp
@@ -225,8 +226,16 @@ Number of kernel-visible execution conte
 .It cpi_name
 Process name, copied from the p_comm field of
 .Fa struct proc .
+.It cpi_siglwp
+LWP target of killing signal.
 .El
 .Pp
+The second note with name
+.Dq NetBSD-CORE
+is a note type of
+ELF_NOTE_NETBSD_CORE_AUXV (2),
+and contains an array of AuxInfo structures.
+.Pp
 The note section also contains additional notes for each
 kernel-visible execution context of the process (LWP).
 These notes have names of the form
@@ -387,6 +396,20 @@ ELF core file format was introduced in
 In releases previous to
 .Nx 1.6 ,
 ELF program images produced a.out-format core files.
+.Pp
+The
+.Dv cpi_siglwp
+member of the
+.Dv netbsd_elfcore_procinfo
+structure first appeared in
+.Nx 2.0 .
+However it retained the procinfo version 1,
+stored in
+.Dv cpi_version .
+.Pp
+.Dv ELF_NOTE_NETBSD_CORE_AUXV
+was added in
+.Nx 8.0 .
 .Sh BUGS
 There is no standard location or name for the
 CPU-dependent data structure stored in the



CVS commit: src/usr.bin/gcore

2017-03-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 26 22:00:04 UTC 2017

Modified Files:
src/usr.bin/gcore: gcore.1

Log Message:
Remove the BUGS section from gcore(1) - issues are no longer relevant

gcore(1) uses internally ptrace(2). PT_DUMPCORE is restricted to stopped
processes, therefore the bug about inconsistend core is no longer true.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.bin/gcore/gcore.1

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

Modified files:

Index: src/usr.bin/gcore/gcore.1
diff -u src/usr.bin/gcore/gcore.1:1.15 src/usr.bin/gcore/gcore.1:1.16
--- src/usr.bin/gcore/gcore.1:1.15	Tue Jan 21 02:53:30 2014
+++ src/usr.bin/gcore/gcore.1	Sun Mar 26 22:00:04 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: gcore.1,v 1.15 2014/01/21 02:53:30 reed Exp $
+.\" $NetBSD: gcore.1,v 1.16 2017/03/26 22:00:04 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd January 9, 2005
+.Dd March 26, 2017
 .Dt GCORE 1
 .Os
 .Sh NAME
@@ -72,6 +72,3 @@ disappeared in
 .Nx 1.2 ,
 and reappeared in
 .Nx 2.0 .
-.Sh BUGS
-The process is not stopped while the core file is generated, so it might
-not be consistent.



CVS commit: [netbsd-7-1] src/usr.bin/gcore

2017-03-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 26 21:06:25 UTC 2017

Modified Files:
src/usr.bin/gcore [netbsd-7-1]: gcore.1

Log Message:
Revert previous - wrong branch


To generate a diff of this commit:
cvs rdiff -u -r1.15.14.1 -r1.15.14.2 src/usr.bin/gcore/gcore.1

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

Modified files:

Index: src/usr.bin/gcore/gcore.1
diff -u src/usr.bin/gcore/gcore.1:1.15.14.1 src/usr.bin/gcore/gcore.1:1.15.14.2
--- src/usr.bin/gcore/gcore.1:1.15.14.1	Sun Mar 26 20:30:45 2017
+++ src/usr.bin/gcore/gcore.1	Sun Mar 26 21:06:25 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: gcore.1,v 1.15.14.1 2017/03/26 20:30:45 kamil Exp $
+.\" $NetBSD: gcore.1,v 1.15.14.2 2017/03/26 21:06:25 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd March 26, 2017
+.Dd January 9, 2005
 .Dt GCORE 1
 .Os
 .Sh NAME
@@ -72,3 +72,6 @@ disappeared in
 .Nx 1.2 ,
 and reappeared in
 .Nx 2.0 .
+.Sh BUGS
+The process is not stopped while the core file is generated, so it might
+not be consistent.



CVS commit: [netbsd-7-1] src/usr.bin/gcore

2017-03-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Mar 26 20:30:45 UTC 2017

Modified Files:
src/usr.bin/gcore [netbsd-7-1]: gcore.1

Log Message:
Remove the BUGS section from gcore(1) - issues are no longer relevant

gcore(1) uses internally ptrace(2). PT_DUMPCORE is restricted to stopped
processes, therefore the bug about inconsistend core is no longer true.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.15.14.1 src/usr.bin/gcore/gcore.1

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

Modified files:

Index: src/usr.bin/gcore/gcore.1
diff -u src/usr.bin/gcore/gcore.1:1.15 src/usr.bin/gcore/gcore.1:1.15.14.1
--- src/usr.bin/gcore/gcore.1:1.15	Tue Jan 21 02:53:30 2014
+++ src/usr.bin/gcore/gcore.1	Sun Mar 26 20:30:45 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: gcore.1,v 1.15 2014/01/21 02:53:30 reed Exp $
+.\" $NetBSD: gcore.1,v 1.15.14.1 2017/03/26 20:30:45 kamil Exp $
 .\"
 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd January 9, 2005
+.Dd March 26, 2017
 .Dt GCORE 1
 .Os
 .Sh NAME
@@ -72,6 +72,3 @@ disappeared in
 .Nx 1.2 ,
 and reappeared in
 .Nx 2.0 .
-.Sh BUGS
-The process is not stopped while the core file is generated, so it might
-not be consistent.



CVS commit: src/sys/arch/sparc64/dev

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 18:38:34 UTC 2017

Modified Files:
src/sys/arch/sparc64/dev: schizo.c

Log Message:
Reorder attach slightly to avoid unintialized use of OF nodes.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/sparc64/dev/schizo.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/sparc64/dev/schizo.c
diff -u src/sys/arch/sparc64/dev/schizo.c:1.37 src/sys/arch/sparc64/dev/schizo.c:1.38
--- src/sys/arch/sparc64/dev/schizo.c:1.37	Thu Nov 10 06:44:35 2016
+++ src/sys/arch/sparc64/dev/schizo.c	Sun Mar 26 18:38:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: schizo.c,v 1.37 2016/11/10 06:44:35 macallan Exp $	*/
+/*	$NetBSD: schizo.c,v 1.38 2017/03/26 18:38:33 martin Exp $	*/
 /*	$OpenBSD: schizo.c,v 1.55 2008/08/18 20:29:37 brad Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.37 2016/11/10 06:44:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: schizo.c,v 1.38 2017/03/26 18:38:33 martin Exp $");
 
 #include 
 #include 
@@ -157,13 +157,13 @@ schizo_attach(device_t parent, device_t 
 	if (strcmp(str, "pci108e,a801") == 0)
 		sc->sc_tomatillo = 1;
 
-	sc->sc_ver = prom_getpropint(sc->sc_node, "version#", 0);
-
 	sc->sc_dev = self;
 	sc->sc_node = ma->ma_node;
 	sc->sc_dmat = ma->ma_dmatag;
 	sc->sc_bustag = ma->ma_bustag;
 
+	sc->sc_ver = prom_getpropint(sc->sc_node, "version#", 0);
+
 	if (bus_space_map(sc->sc_bustag, ma->ma_reg[1].ur_paddr - 0x1UL,
 	sizeof(struct schizo_regs), 0,
 	>sc_ctrlh)) {



CVS commit: src/etc

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 18:31:53 UTC 2017

Modified Files:
src/etc/etc.sparc: MAKEDEV.conf
src/etc/etc.sparc64: MAKEDEV.conf

Log Message:
Add ld(4) nodes


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/etc/etc.sparc/MAKEDEV.conf
cvs rdiff -u -r1.16 -r1.17 src/etc/etc.sparc64/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.sparc/MAKEDEV.conf
diff -u src/etc/etc.sparc/MAKEDEV.conf:1.16 src/etc/etc.sparc/MAKEDEV.conf:1.17
--- src/etc/etc.sparc/MAKEDEV.conf:1.16	Thu Dec  8 11:31:14 2016
+++ src/etc/etc.sparc/MAKEDEV.conf	Sun Mar 26 18:31:52 2017
@@ -1,9 +1,10 @@
-# $NetBSD: MAKEDEV.conf,v 1.16 2016/12/08 11:31:14 nat Exp $
+# $NetBSD: MAKEDEV.conf,v 1.17 2017/03/26 18:31:52 martin Exp $
 
 all_md)
 	makedev std_sparc ttya ttyb ttyc ttyd ttyC00 ttyC01
 	makedev sd0 sd1 sd2 sd3 sd4 xd0 xd1 xd2 xd3 xy0 xy1 xy2 xy3
 	makedev wd0 wd1 wd2 wd3 cd0 st0 st1 fd0
+	makedev ld0 ld1 ld2 ld3
 	makedev audio speaker
 	makedev bpp
 	makedev bwtwo0 cgthree0 cgsix0 tcx0

Index: src/etc/etc.sparc64/MAKEDEV.conf
diff -u src/etc/etc.sparc64/MAKEDEV.conf:1.16 src/etc/etc.sparc64/MAKEDEV.conf:1.17
--- src/etc/etc.sparc64/MAKEDEV.conf:1.16	Thu Dec  8 11:31:15 2016
+++ src/etc/etc.sparc64/MAKEDEV.conf	Sun Mar 26 18:31:52 2017
@@ -1,10 +1,11 @@
-# $NetBSD: MAKEDEV.conf,v 1.16 2016/12/08 11:31:15 nat Exp $
+# $NetBSD: MAKEDEV.conf,v 1.17 2017/03/26 18:31:52 martin Exp $
 
 all_md)
 	makedev std_sparc64 ttya ttyb ttyc ttyd ttyC00 ttyC01
 	makedev ttyh0 ttyh1 ttyh2 ttyh3
 	makedev sd0 sd1 sd2 sd3 sd4 ss0 ch0 uk0 uk1
 	makedev wd0 wd1 wd2 wd3 cd0 st0 st1 fd0
+	makedev ld0 ld1 ld2 ld3
 	makedev audio speaker
 	makedev lpa0 lpa1 lpa2
 	makedev bpp lpt0 lpt1 lpt2



CVS commit: src/tests/fs/union

2017-03-26 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Mar 26 18:26:05 UTC 2017

Modified Files:
src/tests/fs/union: t_pr.c

Log Message:
Add failing test cases for PRs kern/2423, kern/3645, kern/4597


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/fs/union/t_pr.c

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

Modified files:

Index: src/tests/fs/union/t_pr.c
diff -u src/tests/fs/union/t_pr.c:1.9 src/tests/fs/union/t_pr.c:1.10
--- src/tests/fs/union/t_pr.c:1.9	Fri Jan 13 21:30:40 2017
+++ src/tests/fs/union/t_pr.c	Sun Mar 26 18:26:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pr.c,v 1.9 2017/01/13 21:30:40 christos Exp $	*/
+/*	$NetBSD: t_pr.c,v 1.10 2017/03/26 18:26:05 maya Exp $	*/
 
 #include 
 #include 
@@ -53,6 +53,109 @@ ATF_TC_BODY(multilayer, tc)
 	rump_sys_mount(MOUNT_UNION, "/Tunion", 0,,sizeof(unionargs));
 }
 
+ATF_TC(multilayer2);
+ATF_TC_HEAD(multilayer2, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "mount_union twice then unmount");
+}
+
+ATF_TC_BODY(multilayer2, tc)
+{
+	struct union_args unionargs;
+
+	rump_init();
+
+	if (rump_sys_mkdir("/Tunion", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp1");
+	if (rump_sys_mkdir("/Tunion2", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp2");
+	if (rump_sys_mkdir("/Tunion2/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir A");
+	if (rump_sys_mkdir("/Tunion2/B", 0777) == -1)
+		atf_tc_fail_errno("mkdir B");
+
+	unionargs.target = __UNCONST("/Tunion2/A");
+	unionargs.mntflags = UNMNT_ABOVE;
+
+	if (rump_sys_mount(MOUNT_UNION, "/Tunion", 0,
+	, sizeof(unionargs)) == -1)
+		atf_tc_fail_errno("union mount");
+	if (rump_sys_mkdir("/Tunion2/A/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir A/A");
+
+	unionargs.target = __UNCONST("/Tunion2/A/A");
+	unionargs.mntflags = UNMNT_ABOVE;
+
+	rump_sys_mount(MOUNT_UNION, "/Tunion", 0,,sizeof(unionargs));
+
+	rump_sys_unmount("/Tunion/A", 0);
+}
+
+ATF_TC(cyclic);
+ATF_TC_HEAD(cyclic, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "cyclic mount_union");
+}
+
+ATF_TC_BODY(cyclic, tc)
+{
+	struct union_args unionargs;
+
+	rump_init();
+
+	if (rump_sys_mkdir("/Tunion", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp1");
+	if (rump_sys_mkdir("/Tunion/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp2");
+
+	unionargs.target = __UNCONST("/Tunion/A");
+	unionargs.mntflags = UNMNT_ABOVE;
+
+	if (rump_sys_mount(MOUNT_UNION, "/Tunion/A", 0,
+	, sizeof(unionargs)) == -1)
+		atf_tc_fail_errno("union mount");
+
+	if (rump_sys_mkdir("/Tunion/A/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir failed");
+}
+
+ATF_TC(cyclic2);
+ATF_TC_HEAD(cyclic2, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "cyclic mount_union");
+}
+
+ATF_TC_BODY(cyclic2, tc)
+{
+	struct union_args unionargs;
+
+	rump_init();
+
+	if (rump_sys_mkdir("/Tunion", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp1");
+	if (rump_sys_mkdir("/Tunion/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp2");
+	if (rump_sys_mkdir("/Tunion/B", 0777) == -1)
+		atf_tc_fail_errno("mkdir mp3");
+
+	unionargs.target = __UNCONST("/Tunion/A");
+	unionargs.mntflags = UNMNT_ABOVE;
+
+	if (rump_sys_mount(MOUNT_UNION, "/Tunion/B", 0,
+	, sizeof(unionargs)) == -1)
+		atf_tc_fail_errno("union mount");
+
+	unionargs.target = __UNCONST("/Tunion/B");
+	unionargs.mntflags = UNMNT_ABOVE;
+
+	if (rump_sys_mount(MOUNT_UNION, "/Tunion/A", 0,
+	, sizeof(unionargs)) == -1)
+		atf_tc_fail_errno("union mount2");
+
+	if (rump_sys_mkdir("/Tunion/A/A", 0777) == -1)
+		atf_tc_fail_errno("mkdir failed");
+}
+
 ATF_TC(devnull1);
 ATF_TC_HEAD(devnull1, tc)
 {
@@ -123,6 +226,9 @@ ATF_TC_BODY(devnull2, tc)
 ATF_TP_ADD_TCS(tp)
 {
 	ATF_TP_ADD_TC(tp, multilayer);
+	ATF_TP_ADD_TC(tp, multilayer2);
+	ATF_TP_ADD_TC(tp, cyclic);
+	ATF_TP_ADD_TC(tp, cyclic2);
 	ATF_TP_ADD_TC(tp, devnull1);
 	ATF_TP_ADD_TC(tp, devnull2);
 



CVS commit: src/usr.bin/make

2017-03-26 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sun Mar 26 17:16:04 UTC 2017

Modified Files:
src/usr.bin/make: main.c

Log Message:
When we change .OBJDIR we should delete any cached realpath results
for relative paths.

Reviewed by: christos


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/usr.bin/make/main.c

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.258 src/usr.bin/make/main.c:1.259
--- src/usr.bin/make/main.c:1.258	Sat Mar 11 23:59:02 2017
+++ src/usr.bin/make/main.c	Sun Mar 26 17:16:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.258 2017/03/11 23:59:02 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.259 2017/03/26 17:16:03 sjg Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -722,6 +722,7 @@ Main_SetObjdir(const char *fmt, ...)
 			Var_Set(".OBJDIR", objdir, VAR_GLOBAL, 0);
 			setenv("PWD", objdir, 1);
 			Dir_InitDot();
+			cached_realpath(".OBJDIR", NULL); /* purge */
 			rc = TRUE;
 			if (enterFlag && strcmp(objdir, curdir) != 0)
 enterFlagObj = TRUE;
@@ -1889,7 +1890,23 @@ cached_realpath(const char *pathname, ch
 	cache->flags = INTERNAL;
 #endif
 }
-
+if (resolved == NULL && strcmp(pathname, ".OBJDIR") == 0) {
+	/* purge any relative paths */
+	Hash_Entry *he, *nhe;
+	Hash_Search hs;
+
+	he = Hash_EnumFirst(>context, );
+	while (he) {
+	nhe = Hash_EnumNext();
+	if (he->name[0] != '/') {
+		if (DEBUG(DIR))
+		fprintf(stderr, "cached_realpath: purging %s\n", he->name);
+		Hash_DeleteEntry(>context, he);
+	}
+	he = nhe;
+	}
+	return NULL;
+}
 if ((rp = Var_Value(pathname, cache, )) != NULL) {
 	/* a hit */
 	strncpy(resolved, rp, MAXPATHLEN);



CVS commit: src/sys/dev/pci

2017-03-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Mar 26 16:53:36 UTC 2017

Modified Files:
src/sys/dev/pci: virtio.c

Log Message:
fix pasto for nbo_bus_space_write_4() - value needs to be uint32_t


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/pci/virtio.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/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.25 src/sys/dev/pci/virtio.c:1.26
--- src/sys/dev/pci/virtio.c:1.25	Sun Mar 26 13:51:45 2017
+++ src/sys/dev/pci/virtio.c	Sun Mar 26 16:53:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.25 2017/03/26 13:51:45 martin Exp $	*/
+/*	$NetBSD: virtio.c,v 1.26 2017/03/26 16:53:36 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.25 2017/03/26 13:51:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.26 2017/03/26 16:53:36 jdolecek Exp $");
 
 #include 
 #include 
@@ -95,7 +95,7 @@ nbo_bus_space_write_2(bus_space_tag_t sp
 
 static void
 nbo_bus_space_write_4(bus_space_tag_t space, bus_space_handle_t handle,
-	bus_size_t offset, uint16_t value)
+	bus_size_t offset, uint32_t value)
 {
 	bus_space_write_4(space, handle, offset, htole32(value));
 }



CVS commit: [netbsd-7] src/doc

2017-03-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 26 16:11:59 UTC 2017

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

Log Message:
137[59]


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/doc/CHANGES-7.2

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.2
diff -u src/doc/CHANGES-7.2:1.1.2.4 src/doc/CHANGES-7.2:1.1.2.5
--- src/doc/CHANGES-7.2:1.1.2.4	Sat Mar 25 16:58:10 2017
+++ src/doc/CHANGES-7.2	Sun Mar 26 16:11:59 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.4 2017/03/25 16:58:10 snj Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.5 2017/03/26 16:11:59 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -220,3 +220,19 @@ sys/arch/i386/i386/trap.c			1.287
 	Handle #SS faults on iret properly.
 	[maxv, ticket #1391]
 
+sys/arch/amd64/include/param.h			1.20
+sys/arch/i386/include/param.h			1.80
+sys/arch/x86/x86/bus_space.c			1.39
+
+	Increase max io mem on amd64.
+	[maya, ticket #1375]
+
+sys/arch/xen/xen/if_xennet_xenbus.c		1.70 via patch
+
+	Try to be smarter in the rx path: if the packet is small enough
+	copy the data to the mbuf's data area instead of allocating a
+	new page from the pool.
+	While there fix a struct xennet_rxreq leak if xennet_checksum_fill()
+	fails with ENOMEM.
+	[bouyer, ticket #1379]
+



CVS commit: [netbsd-7] src/sys/arch/xen/xen

2017-03-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 26 16:08:12 UTC 2017

Modified Files:
src/sys/arch/xen/xen [netbsd-7]: if_xennet_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #1379):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.70 via patch
Try to be smarted in the rx path: if the packet is small enough copy the
data to the mbuf's data area instead of allocating a new page from the pool.
While there fix a struct xennet_rxreq leak if xennet_checksum_fill()
fails with ENOMEM.


To generate a diff of this commit:
cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/arch/xen/xen/if_xennet_xenbus.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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.2
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.63.2.1	Sun Mar  6 18:52:06 2016
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Sun Mar 26 16:08:12 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.1 2016/03/06 18:52:06 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.63.2.2 2017/03/26 16:08:12 snj Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -1073,26 +1073,35 @@ again:
 		MCLAIM(m, >sc_ethercom.ec_rx_mowner);
 
 		m->m_pkthdr.rcvif = ifp;
-		req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
-		if_xennetrxbuf_cache, PR_NOWAIT, >rxreq_pa);
-		if (__predict_false(req->rxreq_va == 0)) {
-			printf("%s: rx no buf\n", ifp->if_xname);
-			ifp->if_ierrors++;
-			req->rxreq_va = va;
-			req->rxreq_pa = pa;
-			xennet_rx_free_req(req);
-			m_freem(m);
-			continue;
+		if (rx->status <= MHLEN) {
+			/* small packet; copy to mbuf data area */
+			m_copyback(m, 0, rx->status, pktp);
+			KASSERT(m->m_pkthdr.len == rx->status);
+			KASSERT(m->m_len == rx->status);
+		} else {
+			/* large packet; attach buffer to mbuf */
+			req->rxreq_va = (vaddr_t)pool_cache_get_paddr(
+			if_xennetrxbuf_cache, PR_NOWAIT, >rxreq_pa);
+			if (__predict_false(req->rxreq_va == 0)) {
+printf("%s: rx no buf\n", ifp->if_xname);
+ifp->if_ierrors++;
+req->rxreq_va = va;
+req->rxreq_pa = pa;
+xennet_rx_free_req(req);
+m_freem(m);
+continue;
+			}
+			m->m_len = m->m_pkthdr.len = rx->status;
+			MEXTADD(m, pktp, rx->status,
+			M_DEVBUF, xennet_rx_mbuf_free, NULL);
+			m->m_ext.ext_paddr = pa;
+			m->m_flags |= M_EXT_RW; /* we own the buffer */
 		}
-		m->m_len = m->m_pkthdr.len = rx->status;
-		MEXTADD(m, pktp, rx->status,
-		M_DEVBUF, xennet_rx_mbuf_free, NULL);
-		m->m_flags |= M_EXT_RW; /* we own the buffer */
-		m->m_ext.ext_paddr = pa;
 		if ((rx->flags & NETRXF_csum_blank) != 0) {
 			xennet_checksum_fill();
 			if (m == NULL) {
 ifp->if_ierrors++;
+xennet_rx_free_req(req);
 continue;
 			}
 		}



CVS commit: [netbsd-7] src/sys/arch

2017-03-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Mar 26 16:05:41 UTC 2017

Modified Files:
src/sys/arch/amd64/include [netbsd-7]: param.h
src/sys/arch/i386/include [netbsd-7]: param.h
src/sys/arch/x86/x86 [netbsd-7]: bus_space.c

Log Message:
Pull up following revision(s) (requested by maya in ticket #1375):
sys/arch/amd64/include/param.h: revision 1.20
sys/arch/i386/include/param.h: revision 1.80
sys/arch/x86/x86/bus_space.c: revision 1.39
increase max io mem on amd64. some devices need it.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.77 -r1.77.14.1 src/sys/arch/i386/include/param.h
cvs rdiff -u -r1.38 -r1.38.22.1 src/sys/arch/x86/x86/bus_space.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/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.18 src/sys/arch/amd64/include/param.h:1.18.14.1
--- src/sys/arch/amd64/include/param.h:1.18	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/amd64/include/param.h	Sun Mar 26 16:05:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.18 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: param.h,v 1.18.14.1 2017/03/26 16:05:40 snj Exp $	*/
 
 #ifdef __x86_64__
 
@@ -27,6 +27,8 @@
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
 #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
 
+#define	MAXIOMEM	0x
+
 /*
  * XXXfvdl change this (after bootstrap) to take # of bits from
  * config info into account.

Index: src/sys/arch/i386/include/param.h
diff -u src/sys/arch/i386/include/param.h:1.77 src/sys/arch/i386/include/param.h:1.77.14.1
--- src/sys/arch/i386/include/param.h:1.77	Fri Apr 20 22:23:24 2012
+++ src/sys/arch/i386/include/param.h	Sun Mar 26 16:05:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.77 2012/04/20 22:23:24 rmind Exp $	*/
+/*	$NetBSD: param.h,v 1.77.14.1 2017/03/26 16:05:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -65,6 +65,8 @@
 #define	PGOFSET		(NBPG-1)	/* byte offset into page */
 #define	NPTEPG		(NBPG/(sizeof (pt_entry_t)))
 
+#define	MAXIOMEM	0x
+
 #if defined(_KERNEL_OPT)
 #include "opt_kernbase.h"
 #endif /* defined(_KERNEL_OPT) */

Index: src/sys/arch/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.38 src/sys/arch/x86/x86/bus_space.c:1.38.22.1
--- src/sys/arch/x86/x86/bus_space.c:1.38	Fri Jan 27 18:53:07 2012
+++ src/sys/arch/x86/x86/bus_space.c	Sun Mar 26 16:05:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.38 2012/01/27 18:53:07 para Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.38.22.1 2017/03/26 16:05:41 snj Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.38 2012/01/27 18:53:07 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_space.c,v 1.38.22.1 2017/03/26 16:05:41 snj Exp $");
 
 #include 
 #include 
@@ -129,7 +129,7 @@ x86_bus_space_init(void)
 	ioport_ex = extent_create("ioport", 0x0, 0x,
 	(void *)ioport_ex_storage, sizeof(ioport_ex_storage),
 	EX_NOCOALESCE|EX_NOWAIT);
-	iomem_ex = extent_create("iomem", 0x0, 0x,
+	iomem_ex = extent_create("iomem", 0x0, MAXIOMEM,
 	(void *)iomem_ex_storage, sizeof(iomem_ex_storage),
 	EX_NOCOALESCE|EX_NOWAIT);
 



CVS commit: src/sys/arch

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 13:57:53 UTC 2017

Modified Files:
src/sys/arch/sparc/conf: majors.sparc
src/sys/arch/sparc64/conf: majors.sparc64

Log Message:
Assign majors for ld(4)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/sparc/conf/majors.sparc
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/sparc64/conf/majors.sparc64

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/sparc/conf/majors.sparc
diff -u src/sys/arch/sparc/conf/majors.sparc:1.34 src/sys/arch/sparc/conf/majors.sparc:1.35
--- src/sys/arch/sparc/conf/majors.sparc:1.34	Thu Apr 23 23:22:52 2015
+++ src/sys/arch/sparc/conf/majors.sparc	Sun Mar 26 13:57:53 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.sparc,v 1.34 2015/04/23 23:22:52 pgoyette Exp $
+#	$NetBSD: majors.sparc,v 1.35 2017/03/26 13:57:53 martin Exp $
 #
 # Device majors for sparc
 #
@@ -121,3 +121,8 @@ device-major	joy		char 137		joy
 # Majors up to 143 are reserved for machine-dependent drivers.
 # New machine-independent driver majors are assigned in 
 # sys/conf/majors.
+
+# ld has (eroneously) been assigned a MD major on some ports, this one
+# is from the (mostly unused) sys/conf/majors.storage
+device-major	ld		char 303 block	303	ld
+

Index: src/sys/arch/sparc64/conf/majors.sparc64
diff -u src/sys/arch/sparc64/conf/majors.sparc64:1.33 src/sys/arch/sparc64/conf/majors.sparc64:1.34
--- src/sys/arch/sparc64/conf/majors.sparc64:1.33	Thu Apr 23 23:22:52 2015
+++ src/sys/arch/sparc64/conf/majors.sparc64	Sun Mar 26 13:57:53 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: majors.sparc64,v 1.33 2015/04/23 23:22:52 pgoyette Exp $
+#	$NetBSD: majors.sparc64,v 1.34 2017/03/26 13:57:53 martin Exp $
 #
 # Device majors for sparc64
 #
@@ -118,3 +118,7 @@ device-major	joy		char 137		joy
 # Majors up to 143 are reserved for machine-dependent drivers.
 # New machine-independent driver majors are assigned in 
 # sys/conf/majors.
+
+# ld has (eroneously) been assigned a MD major on some ports, this one
+# is from the (mostly unused) sys/conf/majors.storage
+device-major	ld		char 303 block	303	ld



CVS commit: src/sys/dev/pci

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 13:51:45 UTC 2017

Modified Files:
src/sys/dev/pci: virtio.c

Log Message:
Duh, remove accidently left over debug printfs


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/virtio.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/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.24 src/sys/dev/pci/virtio.c:1.25
--- src/sys/dev/pci/virtio.c:1.24	Sun Mar 26 12:36:43 2017
+++ src/sys/dev/pci/virtio.c	Sun Mar 26 13:51:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.24 2017/03/26 12:36:43 martin Exp $	*/
+/*	$NetBSD: virtio.c,v 1.25 2017/03/26 13:51:45 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.24 2017/03/26 12:36:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.25 2017/03/26 13:51:45 martin Exp $");
 
 #include 
 #include 
@@ -844,8 +844,6 @@ virtio_init_vq(struct virtio_softc *sc, 
 	if (vq->vq_indirect != NULL) {
 		struct vring_desc *vd;
 
-printf("vq_size: %d, vq_maxnsegs: %d\n", vq_size, vq->vq_maxnsegs);
-
 		for (i = 0; i < vq_size; i++) {
 			vd = vq->vq_indirect;
 			vd += vq->vq_maxnsegs * i;
@@ -917,8 +915,6 @@ virtio_alloc_vq(struct virtio_softc *sc,
 	else
 		allocsize3 = 0;
 	allocsize = allocsize1 + allocsize2 + allocsize3;
-printf("virtio: allocsize1: %d, allocsize2: %d, allocsize3: %d\n",
-   allocsize1, allocsize2, allocsize3);
 
 	/* alloc and map the memory */
 	r = bus_dmamem_alloc(sc->sc_dmat, allocsize, VIRTIO_PAGE_SIZE, 0,
@@ -973,8 +969,6 @@ printf("virtio: allocsize1: %d, allocsiz
 		vq->vq_indirectoffset = allocsize1 + allocsize2;
 		vq->vq_indirect = (void*)(((char*)vq->vq_desc)
 	  + vq->vq_indirectoffset);
-printf("virtio: vq_indirectoffset: %d, vq_indirect: %p\n",
-vq->vq_indirectoffset, vq->vq_indirect);
 	}
 	vq->vq_bytesize = allocsize;
 	vq->vq_maxsegsize = maxsegsize;



CVS commit: src/sys/arch/sparc64/sparc64

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 12:59:29 UTC 2017

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
Simplify boot device detection for ld @ virtio


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.210 src/sys/arch/sparc64/sparc64/autoconf.c:1.211
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.210	Sun Mar 26 10:36:46 2017
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Mar 26 12:59:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.210 2017/03/26 10:36:46 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.211 2017/03/26 12:59:29 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.210 2017/03/26 10:36:46 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.211 2017/03/26 12:59:29 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -97,7 +97,6 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -932,12 +931,6 @@ device_register(device_t dev, void *aux)
 		struct pci_attach_args *pa = aux;
 
 		ofnode = PCITAG_NODE(pa->pa_tag);
-	} else if (device_is_a(busdev, "virtio")) {
-		struct virtio_softc *va = aux;
-		struct pci_attach_args *pa = virtio_pci_attach_args(va);
-
-		if (pa)
-			ofnode = PCITAG_NODE(pa->pa_tag);
 	} else if (device_is_a(busdev, "sbus") || device_is_a(busdev, "dma")
 	|| device_is_a(busdev, "ledma")) {
 		struct sbus_attach_args *sa = aux;
@@ -988,6 +981,8 @@ device_register(device_t dev, void *aux)
 		dev_path_drive_match(dev, ofnode, adev->adev_channel*2+
 		adev->adev_drv_data->drive, 0, 0);
 		return;
+	} else if (device_is_a(dev, "ld")) {
+		ofnode = device_ofnode(busdev);
 	} else if (device_is_a(dev, "vdsk")) {
 		struct cbus_attach_args *ca = aux;
 		ofnode = ca->ca_node;



CVS commit: src/sys/arch/sparc64/dev

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 12:51:42 UTC 2017

Modified Files:
src/sys/arch/sparc64/dev: psycho.c

Log Message:
Do not call OF_getprop on our node blindly - for the "pcons" hack we may
be called with all zeroed attach args.


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/sparc64/dev/psycho.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/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.125 src/sys/arch/sparc64/dev/psycho.c:1.126
--- src/sys/arch/sparc64/dev/psycho.c:1.125	Fri Mar 24 01:14:26 2017
+++ src/sys/arch/sparc64/dev/psycho.c	Sun Mar 26 12:51:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $	*/
+/*	$NetBSD: psycho.c,v 1.126 2017/03/26 12:51:42 martin Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.125 2017/03/24 01:14:26 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.126 2017/03/26 12:51:42 martin Exp $");
 
 #include "opt_ddb.h"
 
@@ -228,9 +228,13 @@ static	int
 psycho_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
-	char *model = prom_getpropstring(ma->ma_node, "model");
+	char *model;
 	int i;
 
+	if (ma->ma_node == 0)
+		return 0;	/* no OF node, can't be us */
+
+	model = prom_getpropstring(ma->ma_node, "model");
 	/* match on a name of "pci" and a sabre or a psycho */
 	if (strcmp(ma->ma_name, ROM_PCI_NAME) == 0) {
 		for (i=0; psycho_names[i].p_name; i++)



CVS commit: src/sys/arch/sparc/sparc

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 12:38:24 UTC 2017

Modified Files:
src/sys/arch/sparc/sparc: openfirm.c

Log Message:
Add KASSERTs to catch access to NULL OF nodes early


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/sparc/sparc/openfirm.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/sparc/sparc/openfirm.c
diff -u src/sys/arch/sparc/sparc/openfirm.c:1.22 src/sys/arch/sparc/sparc/openfirm.c:1.23
--- src/sys/arch/sparc/sparc/openfirm.c:1.22	Thu Apr  7 19:46:39 2016
+++ src/sys/arch/sparc/sparc/openfirm.c	Sun Mar 26 12:38:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $	*/
+/*	$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.22 2016/04/07 19:46:39 palle Exp $");
+__KERNEL_RCSID(0, "$NetBSD: openfirm.c,v 1.23 2017/03/26 12:38:24 martin Exp $");
 
 #include 
 #include 
@@ -166,6 +166,7 @@ OF_getproplen(int handle, const char *pr
 		cell_t size;
 	} args;
 
+	KASSERT(handle != 0);
 	args.name = ADR2CELL("getproplen");
 	args.nargs = 2;
 	args.nreturns = 1;
@@ -190,6 +191,7 @@ OF_getprop(int handle, const char *prop,
 		cell_t size;
 	} args;
 
+	KASSERT(handle != 0);
 	if (buflen > NBPG)
 		return -1;
 	args.name = ADR2CELL("getprop");



CVS commit: src/sys/dev/pci

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 12:36:43 UTC 2017

Modified Files:
src/sys/dev/pci: virtio.c virtiovar.h

Log Message:
Backout previous, no need for these accessor in MD code


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/virtiovar.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/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.23 src/sys/dev/pci/virtio.c:1.24
--- src/sys/dev/pci/virtio.c:1.23	Sun Mar 26 10:36:10 2017
+++ src/sys/dev/pci/virtio.c	Sun Mar 26 12:36:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.23 2017/03/26 10:36:10 martin Exp $	*/
+/*	$NetBSD: virtio.c,v 1.24 2017/03/26 12:36:43 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.23 2017/03/26 10:36:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.24 2017/03/26 12:36:43 martin Exp $");
 
 #include 
 #include 
@@ -1467,13 +1467,6 @@ virtio_features(struct virtio_softc *sc)
 	return sc->sc_features;
 }
 
-struct pci_attach_args *
-virtio_pci_attach_args(struct virtio_softc *sc)
-{
-	return >sc_pa;
-}
-
-
 MODULE(MODULE_CLASS_DRIVER, virtio, "pci");
  
 #ifdef _MODULE

Index: src/sys/dev/pci/virtiovar.h
diff -u src/sys/dev/pci/virtiovar.h:1.8 src/sys/dev/pci/virtiovar.h:1.9
--- src/sys/dev/pci/virtiovar.h:1.8	Sun Mar 26 10:36:10 2017
+++ src/sys/dev/pci/virtiovar.h	Sun Mar 26 12:36:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtiovar.h,v 1.8 2017/03/26 10:36:10 martin Exp $	*/
+/*	$NetBSD: virtiovar.h,v 1.9 2017/03/26 12:36:43 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -213,6 +213,5 @@ bus_dma_tag_t	virtio_dmat(struct virtio_
 device_t	virtio_child(struct virtio_softc *);
 int		virtio_intrhand(struct virtio_softc *);
 uint32_t	virtio_features(struct virtio_softc *);
-struct pci_attach_args *virtio_pci_attach_args(struct virtio_softc *);
 
 #endif /* _DEV_PCI_VIRTIOVAR_H_ */



CVS commit: src/sys/arch/sparc64/sparc64

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 10:36:46 UTC 2017

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
Use new accessor to get the PCI attach args from a virtio device.


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.209 src/sys/arch/sparc64/sparc64/autoconf.c:1.210
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.209	Sat Mar 25 13:08:38 2017
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Mar 26 10:36:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.209 2017/03/25 13:08:38 martin Exp $ */
+/*	$NetBSD: autoconf.c,v 1.210 2017/03/26 10:36:46 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.209 2017/03/25 13:08:38 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.210 2017/03/26 10:36:46 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -934,8 +934,10 @@ device_register(device_t dev, void *aux)
 		ofnode = PCITAG_NODE(pa->pa_tag);
 	} else if (device_is_a(busdev, "virtio")) {
 		struct virtio_softc *va = aux;
+		struct pci_attach_args *pa = virtio_pci_attach_args(va);
 
-		ofnode = PCITAG_NODE(va->sc_pa.pa_tag);
+		if (pa)
+			ofnode = PCITAG_NODE(pa->pa_tag);
 	} else if (device_is_a(busdev, "sbus") || device_is_a(busdev, "dma")
 	|| device_is_a(busdev, "ledma")) {
 		struct sbus_attach_args *sa = aux;



CVS commit: src/sys/dev/pci

2017-03-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Mar 26 10:36:11 UTC 2017

Modified Files:
src/sys/dev/pci: virtio.c virtiovar.h

Log Message:
Provide an accessor for the pci attach args of a virtio device (if
available - future non-pci attachments may return NULL).
Sparc64 MD code needs this to match the OF node of the virtio device
for boot device recognition.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/virtio.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/virtiovar.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/pci/virtio.c
diff -u src/sys/dev/pci/virtio.c:1.22 src/sys/dev/pci/virtio.c:1.23
--- src/sys/dev/pci/virtio.c:1.22	Sat Mar 25 18:02:06 2017
+++ src/sys/dev/pci/virtio.c	Sun Mar 26 10:36:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtio.c,v 1.22 2017/03/25 18:02:06 jdolecek Exp $	*/
+/*	$NetBSD: virtio.c,v 1.23 2017/03/26 10:36:10 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.22 2017/03/25 18:02:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio.c,v 1.23 2017/03/26 10:36:10 martin Exp $");
 
 #include 
 #include 
@@ -844,11 +844,14 @@ virtio_init_vq(struct virtio_softc *sc, 
 	if (vq->vq_indirect != NULL) {
 		struct vring_desc *vd;
 
+printf("vq_size: %d, vq_maxnsegs: %d\n", vq_size, vq->vq_maxnsegs);
+
 		for (i = 0; i < vq_size; i++) {
 			vd = vq->vq_indirect;
 			vd += vq->vq_maxnsegs * i;
-			for (j = 0; j < vq->vq_maxnsegs-1; j++)
+			for (j = 0; j < vq->vq_maxnsegs-1; j++) {
 vd[j].next = j + 1;
+			}
 		}
 	}
 
@@ -914,6 +917,8 @@ virtio_alloc_vq(struct virtio_softc *sc,
 	else
 		allocsize3 = 0;
 	allocsize = allocsize1 + allocsize2 + allocsize3;
+printf("virtio: allocsize1: %d, allocsize2: %d, allocsize3: %d\n",
+   allocsize1, allocsize2, allocsize3);
 
 	/* alloc and map the memory */
 	r = bus_dmamem_alloc(sc->sc_dmat, allocsize, VIRTIO_PAGE_SIZE, 0,
@@ -968,6 +973,8 @@ virtio_alloc_vq(struct virtio_softc *sc,
 		vq->vq_indirectoffset = allocsize1 + allocsize2;
 		vq->vq_indirect = (void*)(((char*)vq->vq_desc)
 	  + vq->vq_indirectoffset);
+printf("virtio: vq_indirectoffset: %d, vq_indirect: %p\n",
+vq->vq_indirectoffset, vq->vq_indirect);
 	}
 	vq->vq_bytesize = allocsize;
 	vq->vq_maxsegsize = maxsegsize;
@@ -1460,6 +1467,13 @@ virtio_features(struct virtio_softc *sc)
 	return sc->sc_features;
 }
 
+struct pci_attach_args *
+virtio_pci_attach_args(struct virtio_softc *sc)
+{
+	return >sc_pa;
+}
+
+
 MODULE(MODULE_CLASS_DRIVER, virtio, "pci");
  
 #ifdef _MODULE

Index: src/sys/dev/pci/virtiovar.h
diff -u src/sys/dev/pci/virtiovar.h:1.7 src/sys/dev/pci/virtiovar.h:1.8
--- src/sys/dev/pci/virtiovar.h:1.7	Sat Mar 25 18:02:06 2017
+++ src/sys/dev/pci/virtiovar.h	Sun Mar 26 10:36:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: virtiovar.h,v 1.7 2017/03/25 18:02:06 jdolecek Exp $	*/
+/*	$NetBSD: virtiovar.h,v 1.8 2017/03/26 10:36:10 martin Exp $	*/
 
 /*
  * Copyright (c) 2010 Minoura Makoto.
@@ -213,5 +213,6 @@ bus_dma_tag_t	virtio_dmat(struct virtio_
 device_t	virtio_child(struct virtio_softc *);
 int		virtio_intrhand(struct virtio_softc *);
 uint32_t	virtio_features(struct virtio_softc *);
+struct pci_attach_args *virtio_pci_attach_args(struct virtio_softc *);
 
 #endif /* _DEV_PCI_VIRTIOVAR_H_ */