CVS commit: src/sys/net

2017-03-09 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar 10 07:35:58 UTC 2017

Modified Files:
src/sys/net: pfil.c

Log Message:
need to membar_producer() *before* switching.

pointed out by riastradh@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/net/pfil.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/net/pfil.c
diff -u src/sys/net/pfil.c:1.34 src/sys/net/pfil.c:1.35
--- src/sys/net/pfil.c:1.34	Mon Jan 23 02:32:54 2017
+++ src/sys/net/pfil.c	Fri Mar 10 07:35:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfil.c,v 1.34 2017/01/23 02:32:54 ozaki-r Exp $	*/
+/*	$NetBSD: pfil.c,v 1.35 2017/03/10 07:35:58 ryo Exp $	*/
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius 
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.34 2017/01/23 02:32:54 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.35 2017/03/10 07:35:58 ryo Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -232,8 +232,8 @@ pfil_list_add(pfil_listset_t *phlistset,
 	pfh->pfil_arg  = arg;
 
 	/* switch from oldlist to newlist */
-	phlistset->active = newlist;
 	membar_producer();
+	phlistset->active = newlist;
 #ifdef NET_MPSAFE
 	pserialize_perform(pfil_psz);
 #endif



CVS commit: src/distrib/notes/common

2017-03-09 Thread Guilherme Salazar
Module Name:src
Committed By:   salazar
Date:   Fri Mar 10 04:13:43 UTC 2017

Modified Files:
src/distrib/notes/common: main

Log Message:
add my name to distrib/notes/common/main


To generate a diff of this commit:
cvs rdiff -u -r1.533 -r1.534 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.533 src/distrib/notes/common/main:1.534
--- src/distrib/notes/common/main:1.533	Wed Nov  9 08:18:56 2016
+++ src/distrib/notes/common/main	Fri Mar 10 04:13:43 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: main,v 1.533 2016/11/09 08:18:56 rin Exp $
+.\"	$NetBSD: main,v 1.534 2017/03/10 04:13:43 salazar Exp $
 .\"
 .\" Copyright (c) 1999-2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1363,6 +1363,7 @@ If you're one of them, and would like to
 .It Ta David Sainty Ta Mt dsai...@netbsd.org
 .It Ta SAITOH Masanobu Ta Mt msai...@netbsd.org
 .It Ta Kazuki Sakamoto Ta Mt sakam...@netbsd.org
+.It Ta Guilherme Salazar Ta Mt sala...@netbsd.org
 .It Ta Curt Sampson Ta Mt c...@netbsd.org
 .It Ta Wilfredo Sanchez Ta Mt wsanc...@netbsd.org
 .It Ta Ty Sarna Ta Mt tsa...@netbsd.org



CVS commit: src/sys/net/npf

2017-03-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 10 02:21:37 UTC 2017

Modified Files:
src/sys/net/npf: npf_tableset.c

Log Message:
fix MIN/MAX confusion.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/net/npf/npf_tableset.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/net/npf/npf_tableset.c
diff -u src/sys/net/npf/npf_tableset.c:1.26 src/sys/net/npf/npf_tableset.c:1.27
--- src/sys/net/npf/npf_tableset.c:1.26	Mon Jan  2 16:49:51 2017
+++ src/sys/net/npf/npf_tableset.c	Thu Mar  9 21:21:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: npf_tableset.c,v 1.26 2017/01/02 21:49:51 rmind Exp $	*/
+/*	$NetBSD: npf_tableset.c,v 1.27 2017/03/10 02:21:37 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009-2016 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.26 2017/01/02 21:49:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_tableset.c,v 1.27 2017/03/10 02:21:37 christos Exp $");
 
 #include 
 #include 
@@ -369,7 +369,7 @@ npf_table_create(const char *name, u_int
 		LIST_INIT(>t_list);
 		break;
 	case NPF_TABLE_HASH:
-		size = MIN(size, 128);
+		size = MAX(size, 128);
 		t->t_hashl = hashinit(size, HASH_LIST, true, >t_hashmask);
 		if (t->t_hashl == NULL) {
 			goto out;



CVS commit: src/sys/dev/ofw

2017-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 10 00:26:43 UTC 2017

Modified Files:
src/sys/dev/ofw: ofbus.c

Log Message:
attach display devices first so we see more kernel output on shark


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ofw/ofbus.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/ofw/ofbus.c
diff -u src/sys/dev/ofw/ofbus.c:1.25 src/sys/dev/ofw/ofbus.c:1.26
--- src/sys/dev/ofw/ofbus.c:1.25	Fri Jun  3 07:39:30 2011
+++ src/sys/dev/ofw/ofbus.c	Fri Mar 10 00:26:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofbus.c,v 1.25 2011/06/03 07:39:30 matt Exp $	*/
+/*	$NetBSD: ofbus.c,v 1.26 2017/03/10 00:26:43 macallan Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofbus.c,v 1.25 2011/06/03 07:39:30 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofbus.c,v 1.26 2017/03/10 00:26:43 macallan Exp $");
 
 #include 
 #include 
@@ -76,7 +76,7 @@ ofbus_attach(device_t parent, device_t d
 {
 	struct ofbus_attach_args *oba = aux;
 	struct ofbus_attach_args oba2;
-	char name[64];
+	char name[64], type[64];
 	int child, units;
 
 	printf("\n");
@@ -95,9 +95,15 @@ ofbus_attach(device_t parent, device_t d
 			units = 2;
 	}
 
+	/* attach displays first */
 	for (child = OF_child(oba->oba_phandle); child != 0;
 	 child = OF_peer(child)) {
 		oba2.oba_busname = "ofw";
+		type[0] = 0;
+		if (OF_getprop(child, "device_type", type, sizeof(type)) <= 0)
+			continue;
+		if (strncmp(type, "display", sizeof(type)) != 0)
+			continue;
 		of_packagename(child, name, sizeof name);
 		oba2.oba_phandle = child;
 		for (oba2.oba_unit = 0; oba2.oba_unit < units;
@@ -113,4 +119,30 @@ ofbus_attach(device_t parent, device_t d
 			config_found(dev, , ofbus_print);
 		}
 	}
+
+	/* now the rest */
+	for (child = OF_child(oba->oba_phandle); child != 0;
+	 child = OF_peer(child)) {
+		oba2.oba_busname = "ofw";
+		type[0] = 0;
+		if (OF_getprop(child, "device_type", type, sizeof(type)) > 0) {
+			if (strncmp(type, "display", sizeof(type)) == 0)
+continue;
+		}
+		of_packagename(child, name, sizeof name);
+		oba2.oba_phandle = child;
+		for (oba2.oba_unit = 0; oba2.oba_unit < units;
+		 oba2.oba_unit++) {
+			if (units > 1) {
+snprintf(oba2.oba_ofname,
+sizeof(oba2.oba_ofname), "%s@%d", name,
+oba2.oba_unit);
+			} else {
+strlcpy(oba2.oba_ofname, name,
+sizeof(oba2.oba_ofname));
+			}
+			config_found(dev, , ofbus_print);
+		}
+	}
+
 }



CVS commit: src/sys/arch/shark/ofw

2017-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 10 00:22:01 UTC 2017

Modified Files:
src/sys/arch/shark/ofw: vlpci.c

Log Message:
- provide access to PCI memory space
- pass a DMA tag. Won't work but at least we don't crash anymore
TODO:
- magic number reduction. Seriously.
- figure out why DMA doesn't work

with this cards that don't need DMA or more than 1MB of MMIO space should work


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/shark/ofw/vlpci.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/shark/ofw/vlpci.c
diff -u src/sys/arch/shark/ofw/vlpci.c:1.4 src/sys/arch/shark/ofw/vlpci.c:1.5
--- src/sys/arch/shark/ofw/vlpci.c:1.4	Mon Feb 27 18:30:42 2017
+++ src/sys/arch/shark/ofw/vlpci.c	Fri Mar 10 00:22:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vlpci.c,v 1.4 2017/02/27 18:30:42 jakllsch Exp $	*/
+/*	$NetBSD: vlpci.c,v 1.5 2017/03/10 00:22:01 macallan Exp $	*/
 
 /*
  * Copyright (c) 2017 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.4 2017/02/27 18:30:42 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.5 2017/03/10 00:22:01 macallan Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -37,6 +37,10 @@ __KERNEL_RCSID(0, "$NetBSD: vlpci.c,v 1.
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 
@@ -84,6 +88,10 @@ CFATTACH_DECL_NEW(vlpci, sizeof(struct v
 
 static const char * const compat_strings[] = { "via,vt82c505", NULL };
 
+vaddr_t vlpci_mem_vaddr = 0;
+paddr_t vlpci_mem_paddr;
+struct bus_space vlpci_memt;
+
 static void
 regwrite_1(struct vlpci_softc * const sc, uint8_t off, uint8_t val)
 {
@@ -93,6 +101,54 @@ regwrite_1(struct vlpci_softc * const sc
 	mutex_spin_exit(>sc_lock);
 }
 
+static uint8_t
+regread_1(struct vlpci_softc * const sc, uint8_t off)
+{
+	uint8_t reg;
+
+	mutex_spin_enter(>sc_lock);
+	bus_space_write_1(_io_bs_tag, sc->sc_reg_ioh, 0, off);
+	reg = bus_space_read_1(_io_bs_tag, sc->sc_reg_ioh, 1);
+	mutex_spin_exit(>sc_lock);
+	return reg;
+}
+
+static void
+vlpci_dump_window(struct vlpci_softc *sc, int num)
+{
+	int regaddr = 0x87 + 3 * num;
+	uint32_t addr, size;
+	uint8_t attr;
+
+	addr = regread_1(sc, regaddr) << 24;
+	addr |= regread_1(sc, regaddr + 1) << 16;
+	attr = regread_1(sc, regaddr + 2);
+	size = 0x0001 << ((attr & 0x1c) >> 2);
+	printf("memory window #%d at %08x size %08x flags %x\n", num, addr, size, attr);
+}
+
+static int
+vlpci_map(void *t, bus_addr_t bpa, bus_size_t size, int cacheable, bus_space_handle_t *bshp)
+{
+	*bshp = vlpci_mem_vaddr - 0x0200 + bpa;
+printf("%s: %08lx -> %08lx\n", __func__, bpa, *bshp);
+	return(0);
+}
+
+static paddr_t
+vlpci_mmap(void *cookie, bus_addr_t addr, off_t off, int prot,
+int flags)
+{
+	paddr_t ret;
+
+	ret = vlpci_mem_paddr + addr + off;
+
+	if (flags & BUS_SPACE_MAP_PREFETCHABLE) {
+		return (arm_btop(ret) | ARM32_MMAP_WRITECOMBINE);
+	} else
+		return arm_btop(ret);	
+}
+
 static int
 vlpci_match(device_t parent, struct cfdata *match, void *aux)
 {
@@ -131,11 +187,51 @@ vlpci_attach(device_t parent, device_t s
 	/* Enable VLB/PCI bridge */
 	regwrite_1(sc, 0x96, 0x18); /* enable LOCAL#, compatible mode */
 	regwrite_1(sc, 0x93, 0x60); /* IOCHCK# on IOCHCK#/NMI */
-	regwrite_1(sc, 0x86, 2<<5); /* invert all INTx to IRQ */
+	regwrite_1(sc, 0x86, 0x61); /* invert all INTx to IRQ */
 	regwrite_1(sc, 0x97, 0x00); /* don't do per-INTx conversions */
 	regwrite_1(sc, 0x91, 0xbb); /* enable INT[AB] to IRQ 10 */
 	regwrite_1(sc, 0x90, 0xbb); /* enable INT[CD] to IRQ 10 */
+	/*
+	 * XXX
+	 * set memory size to 255MB, so the bridge knows which cycles go to RAM
+	 * shark's RAM is in the upper half of the lower 256MB, part of the
+	 * lower half is occupied by the graphics chip
+	 * ... or that's the theory. OF puts PCI BARS at 0x0200 which
+	 * overlaps with when we do this and pci memory access doesn't work.
+	 */
+	regwrite_1(sc, 0x81, 0x1);
+
+	regwrite_1(sc, 0x82, 0x08); /* PCI dynamic acceleration decoding enable */
+	regwrite_1(sc, 0x83, 0x08); 
+	printf("reg 0x83 %02x\n", regread_1(sc, 0x83));
+
+#if 1
+	/* program window #0 to 0x0800 */
+	regwrite_1(sc, 0x87, 0x08);
+	regwrite_1(sc, 0x88, 0x00);
+	regwrite_1(sc, 0x89, 0x38);	/* VL, unbuffered, 4MB */
+#else
+	regwrite_1(sc, 0x87, 0x00);
+	regwrite_1(sc, 0x88, 0x00);
+	regwrite_1(sc, 0x89, 0x00);
+#endif
 
+	vlpci_mem_paddr = 0x0200;	/* get from OF! */
+	
+	/*
+	 * we map in 1MB at 0x0200, so program window #1 accordingly
+	 */
+	regwrite_1(sc, 0x8a, vlpci_mem_paddr >> 24);
+	regwrite_1(sc, 0x8b, (vlpci_mem_paddr >> 16) & 0xff);
+	regwrite_1(sc, 0x8c, 0x90);	/* PCI, unbuffered, 1MB */
+
+	/* now map in some of the memory space */
+	printf("vlpci_mem_vaddr %08lx\n", vlpci_mem_vaddr);
+	memcpy(_memt, _io_bs_tag, sizeof(struct bus_space));
+	vlpci_memt.bs_cookie = (void *)vlpci_mem_vaddr;
+	

CVS commit: src/sys/arch/shark/shark

2017-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 10 00:13:08 UTC 2017

Modified Files:
src/sys/arch/shark/shark: shark_machdep.c

Log Message:
if we have vlpci, map in 1MB worth of PCI memory space


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/shark/shark/shark_machdep.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/shark/shark/shark_machdep.c
diff -u src/sys/arch/shark/shark/shark_machdep.c:1.42 src/sys/arch/shark/shark/shark_machdep.c:1.43
--- src/sys/arch/shark/shark/shark_machdep.c:1.42	Thu Jul  7 06:55:38 2016
+++ src/sys/arch/shark/shark/shark_machdep.c	Fri Mar 10 00:13:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: shark_machdep.c,v 1.42 2016/07/07 06:55:38 msaitoh Exp $	*/
+/*	$NetBSD: shark_machdep.c,v 1.43 2017/03/10 00:13:08 macallan Exp $	*/
 
 /*
  * Copyright 1997
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.42 2016/07/07 06:55:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: shark_machdep.c,v 1.43 2017/03/10 00:13:08 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -79,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: shark_machde
 #include 
 
 #include "isadma.h"
+#include "vlpci.h"
 
 #include "wd.h"
 #include "cd.h"
@@ -139,6 +140,10 @@ int ofw_handleticks = 0;	/* set to TRUE 
 extern unsigned int sa1_cache_clean_addr;
 extern unsigned int sa1_cache_clean_size;
 
+#if NVLPCI > 0
+extern vaddr_t vlpci_mem_vaddr;
+#endif
+
 CFATTACH_DECL_NEW(ofbus_root, 0,
 ofbus_match, ofbus_attach, NULL, NULL);
 
@@ -224,6 +229,10 @@ initarm(void *arg)
 	/* XXX - this should be done in the isa-bus attach routine! -JJK */
 	isa_mem_virtaddr = ofw_map(isa_mem_physaddr, L1_S_SIZE, 0);
 	isa_io_virtaddr  = ofw_map(isa_io_physaddr,  L1_S_SIZE, 0);
+#if NVLPCI > 0
+	/* XXX should get address from OF */
+	vlpci_mem_vaddr  = ofw_map(0x0200,  0x0010, 0);
+#endif
 
 	/* Set-up the ISA system: must be done before consinit */
 	isa_init(isa_io_virtaddr, isa_mem_virtaddr);



CVS commit: src/sys/arch/shark/conf

2017-03-09 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Mar 10 00:09:13 UTC 2017

Modified Files:
src/sys/arch/shark/conf: files.shark

Log Message:
include files.usb, vlpci needs-flag


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/shark/conf/files.shark

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/shark/conf/files.shark
diff -u src/sys/arch/shark/conf/files.shark:1.19 src/sys/arch/shark/conf/files.shark:1.20
--- src/sys/arch/shark/conf/files.shark:1.19	Fri Feb 17 18:07:51 2017
+++ src/sys/arch/shark/conf/files.shark	Fri Mar 10 00:09:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.shark,v 1.19 2017/02/17 18:07:51 jakllsch Exp $
+#	$NetBSD: files.shark,v 1.20 2017/03/10 00:09:13 macallan Exp $
 #
 # First try for arm-specific configuration info
 #
@@ -22,6 +22,7 @@ define todservice {}
 #
 include "dev/i2o/files.i2o"
 include "dev/pci/files.pci"
+include "dev/usb/files.usb"
 
 #
 # ISA and mixed ISA+EISA or ISA+PCI drivers
@@ -138,7 +139,7 @@ file	arch/shark/ofw/chipsfb_ofbus.c		chi
 
 # ofbus VLB Host to PCI Bridge (VIA VT82C505)
 device	vlpci: pcibus
-file	arch/shark/ofw/vlpci.c			vlpci
+file	arch/shark/ofw/vlpci.c			vlpci needs-flag
 attach	vlpci at ofbus
 
 # Smart Card Reader



CVS commit: [netbsd-7] src/doc

2017-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 16:28:13 UTC 2017

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

Log Message:
amend 1371


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.161 -r1.1.2.162 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.161 src/doc/CHANGES-7.1:1.1.2.162
--- src/doc/CHANGES-7.1:1.1.2.161	Thu Mar  9 06:33:12 2017
+++ src/doc/CHANGES-7.1	Thu Mar  9 16:28:13 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.161 2017/03/09 06:33:12 snj Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.162 2017/03/09 16:28:13 snj Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -8954,6 +8954,8 @@ sys/dev/pci/ixgbe/ixgbe.c			1.60
 	[msaitoh, ticket #1370]
 
 sys/dev/mii/miidevs1.125
+sys/dev/mii/miidevs.hregen
+sys/dev/mii/miidevs_data.h			regen
 
 	Add some Intel devices.
 	[msaitoh, ticket #1371]



CVS commit: [netbsd-7] src/sys/dev/mii

2017-03-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Mar  9 16:27:32 UTC 2017

Modified Files:
src/sys/dev/mii [netbsd-7]: miidevs.h miidevs_data.h

Log Message:
regen for ticket 1371


To generate a diff of this commit:
cvs rdiff -u -r1.123.2.2 -r1.123.2.3 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.111.2.2 -r1.111.2.3 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.123.2.2 src/sys/dev/mii/miidevs.h:1.123.2.3
--- src/sys/dev/mii/miidevs.h:1.123.2.2	Fri Dec  9 05:23:58 2016
+++ src/sys/dev/mii/miidevs.h	Thu Mar  9 16:27:32 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.123.2.2 2016/12/09 05:23:58 snj Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.123.2.3 2017/03/09 16:27:32 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
+ *	NetBSD: miidevs,v 1.120.2.3 2017/03/09 06:26:04 snj Exp
  */
 
 /*-
@@ -322,6 +322,8 @@
 #define	MII_STR_yyINTEL_I82562ET	"i82562ET 10/100 media interface"
 #define	MII_MODEL_yyINTEL_I82553	0x0035
 #define	MII_STR_yyINTEL_I82553	"i82553 10/100 media interface"
+#define	MII_MODEL_yyINTEL_IGP01E1000	0x0038
+#define	MII_STR_yyINTEL_IGP01E1000	"Intel IGP01E1000 Gigabit PHY"
 #define	MII_MODEL_yyINTEL_I82566	0x0039
 #define	MII_STR_yyINTEL_I82566	"i82566 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I82577	0x0005
@@ -330,13 +332,17 @@
 #define	MII_STR_INTEL_I82579	"i82579 10/100/1000 media interface"
 #define	MII_MODEL_INTEL_I217	0x000a
 #define	MII_STR_INTEL_I217	"i217 10/100/1000 media interface"
+#define	MII_MODEL_INTEL_I82580	0x003a
+#define	MII_STR_INTEL_I82580	"82580 10/100/1000 media interface"
+#define	MII_MODEL_INTEL_I350	0x003b
+#define	MII_STR_INTEL_I350	"I350 10/100/1000 media interface"
 #define	MII_MODEL_xxMARVELL_I210	0x
 #define	MII_STR_xxMARVELL_I210	"I210 10/100/1000 media interface"
 #define	MII_MODEL_xxMARVELL_I82563	0x000a
 #define	MII_STR_xxMARVELL_I82563	"i82563 10/100/1000 media interface"
+#define	MII_MODEL_ATHEROS_I82578	0x0004
+#define	MII_STR_ATHEROS_I82578	"Intel 82578 10/100/1000 media interface"
 
-#define	MII_MODEL_yyINTEL_IGP01E1000	0x0038
-#define	MII_STR_yyINTEL_IGP01E1000	"Intel IGP01E1000 Gigabit PHY"
 
 /* JMicron PHYs */
 #define	MII_MODEL_JMICRON_JMC250	0x0021
@@ -385,8 +391,12 @@
 #define	MII_STR_xxMARVELL_E1145	"Marvell 88E1145 Quad Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E6060	0x0010
 #define	MII_STR_xxMARVELL_E6060	"Marvell 88E6060 6-Port 10/100 Fast Ethernet Switch"
+#define	MII_MODEL_xxMARVELL_I347	0x001c
+#define	MII_STR_xxMARVELL_I347	"Intel I347-AT4 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1512	0x001d
 #define	MII_STR_xxMARVELL_E1512	"Marvell 88E1512 Gigabit PHY"
+#define	MII_MODEL_xxMARVELL_E1340M	0x001f
+#define	MII_STR_xxMARVELL_E1340M	"Marvell 88E1340 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1116	0x0021
 #define	MII_STR_xxMARVELL_E1116	"Marvell 88E1116 Gigabit PHY"
 #define	MII_MODEL_xxMARVELL_E1118	0x0022

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.111.2.2 src/sys/dev/mii/miidevs_data.h:1.111.2.3
--- src/sys/dev/mii/miidevs_data.h:1.111.2.2	Fri Dec  9 05:23:58 2016
+++ src/sys/dev/mii/miidevs_data.h	Thu Mar  9 16:27:32 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.111.2.2 2016/12/09 05:23:58 snj Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.111.2.3 2017/03/09 16:27:32 snj Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.120.2.2 2016/12/09 05:23:31 snj Exp
+ *	NetBSD: miidevs,v 1.120.2.3 2017/03/09 06:26:04 snj Exp
  */
 
 /*-
@@ -125,13 +125,16 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82562EM, MII_STR_yyINTEL_I82562EM },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82562ET, MII_STR_yyINTEL_I82562ET },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82553, MII_STR_yyINTEL_I82553 },
+ { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_IGP01E1000, MII_STR_yyINTEL_IGP01E1000 },
  { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_I82566, MII_STR_yyINTEL_I82566 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82577, MII_STR_INTEL_I82577 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I82579, MII_STR_INTEL_I82579 },
  { MII_OUI_INTEL, MII_MODEL_INTEL_I217, MII_STR_INTEL_I217 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_I82580, MII_STR_INTEL_I82580 },
+ { MII_OUI_INTEL, MII_MODEL_INTEL_I350, MII_STR_INTEL_I350 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I210, MII_STR_xxMARVELL_I210 },
  { MII_OUI_xxMARVELL, MII_MODEL_xxMARVELL_I82563, MII_STR_xxMARVELL_I82563 },
- { MII_OUI_yyINTEL, MII_MODEL_yyINTEL_IGP01E1000, MII_STR_yyINTEL_IGP01E1000 },
+ { MII_OUI_ATHEROS, MII_MODEL_ATHEROS_I82578, MII_STR_ATHEROS_I82578 },
  { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC250, MII_STR_JMICRON_JMC250 },
  { MII_OUI_JMICRON, MII_MODEL_JMICRON_JMC260, MII_STR_JMICRON_JMC260 

CVS commit: src

2017-03-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Mar  9 14:05:59 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: md.luna68k
src/etc/etc.luna68k: MAKEDEV.conf
src/sys/arch/luna68k/conf: GENERIC INSTALL files.luna68k majors.luna68k
src/sys/arch/luna68k/dev: lcd.c
src/sys/arch/luna68k/include: Makefile
src/sys/arch/luna68k/luna68k: machdep.c mainbus.c
Added Files:
src/sys/arch/luna68k/include: lcd.h

Log Message:
Add a driver for LUNA's front panel LCD.  Ported from OpenBSD/luna88k.

Reviewed by enami@.  Tested by Naruaki Etomi and me.

A 68k LUNA with this driver will be demonstrated at AsiaBSDCon NetBSD booth
by Etomi-san, with LUNA-88K2 running OpenBSD/luna88k by Kenji Aoyama.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/sets/lists/comp/md.luna68k
cvs rdiff -u -r1.10 -r1.11 src/etc/etc.luna68k/MAKEDEV.conf
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/luna68k/conf/GENERIC
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/luna68k/conf/INSTALL
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/luna68k/conf/files.luna68k
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/luna68k/conf/majors.luna68k
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/luna68k/dev/lcd.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/luna68k/include/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/arch/luna68k/include/lcd.h
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/luna68k/luna68k/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/luna68k/luna68k/mainbus.c

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

Modified files:

Index: src/distrib/sets/lists/comp/md.luna68k
diff -u src/distrib/sets/lists/comp/md.luna68k:1.21 src/distrib/sets/lists/comp/md.luna68k:1.22
--- src/distrib/sets/lists/comp/md.luna68k:1.21	Sat Dec  3 17:38:02 2016
+++ src/distrib/sets/lists/comp/md.luna68k	Thu Mar  9 14:05:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.luna68k,v 1.21 2016/12/03 17:38:02 tsutsui Exp $
+# $NetBSD: md.luna68k,v 1.22 2017/03/09 14:05:58 tsutsui Exp $
 ./usr/include/ieeefp.hcomp-c-include
 ./usr/include/luna68kcomp-c-include
 ./usr/include/luna68k/_G_config.h		comp-obsolete		obsolete
@@ -27,6 +27,7 @@
 ./usr/include/luna68k/int_types.h		comp-c-include
 ./usr/include/luna68k/intr.h			comp-c-include
 ./usr/include/luna68k/kcore.h			comp-c-include
+./usr/include/luna68k/lcd.h			comp-c-include
 ./usr/include/luna68k/limits.h			comp-c-include
 ./usr/include/luna68k/lock.h			comp-c-include
 ./usr/include/luna68k/math.h			comp-c-include

Index: src/etc/etc.luna68k/MAKEDEV.conf
diff -u src/etc/etc.luna68k/MAKEDEV.conf:1.10 src/etc/etc.luna68k/MAKEDEV.conf:1.11
--- src/etc/etc.luna68k/MAKEDEV.conf:1.10	Thu Feb 16 13:13:39 2017
+++ src/etc/etc.luna68k/MAKEDEV.conf	Thu Mar  9 14:05:58 2017
@@ -1,10 +1,10 @@
-# $NetBSD: MAKEDEV.conf,v 1.10 2017/02/16 13:13:39 tsutsui Exp $
+# $NetBSD: MAKEDEV.conf,v 1.11 2017/03/09 14:05:58 tsutsui Exp $
 
 all_md)
 	makedev ttya sd0 sd1 sd2 sd3 cd0 cd1 st0 st1
 	makedev wscons
 	makedev scsibus0 scsibus1
-	makedev xp
+	makedev xp lcd
 	;;
 
 tty[ab])
@@ -26,3 +26,8 @@ xp)
 	major=40; minor=0; mode=0644
 	mkdev xp c $major $minor $mode
 	;;
+
+lcd)
+	major=41; minor=0; mode=0644
+	mkdev lcd c $major $minor $mode
+	;;

Index: src/sys/arch/luna68k/conf/GENERIC
diff -u src/sys/arch/luna68k/conf/GENERIC:1.120 src/sys/arch/luna68k/conf/GENERIC:1.121
--- src/sys/arch/luna68k/conf/GENERIC:1.120	Sat Dec  3 17:38:02 2016
+++ src/sys/arch/luna68k/conf/GENERIC	Thu Mar  9 14:05:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.120 2016/12/03 17:38:02 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.121 2017/03/09 14:05:58 tsutsui Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/luna68k/conf/std.luna68k"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.120 $"
+#ident 		"GENERIC-$Revision: 1.121 $"
 
 makeoptions	COPTS="-O2 -fno-reorder-blocks"	# see share/mk/sys.mk
 
@@ -151,6 +151,9 @@ mainbus0 at root
 
 clock0	at mainbus0
 
+# LCD on front panel
+lcd0	at mainbus0
+
 # uPD7201 SIO
 sio0	at mainbus0
 siotty0	at sio0			# ttya

Index: src/sys/arch/luna68k/conf/INSTALL
diff -u src/sys/arch/luna68k/conf/INSTALL:1.20 src/sys/arch/luna68k/conf/INSTALL:1.21
--- src/sys/arch/luna68k/conf/INSTALL:1.20	Sun Sep 18 14:20:23 2016
+++ src/sys/arch/luna68k/conf/INSTALL	Thu Mar  9 14:05:58 2017
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.20 2016/09/18 14:20:23 christos Exp $
+# $NetBSD: INSTALL,v 1.21 2017/03/09 14:05:58 tsutsui Exp $
 #
 # config for installation ramdisk kernel
 # 
@@ -130,6 +130,9 @@ mainbus0 at root
 
 clock0	at mainbus0
 
+# LCD on front panel
+lcd0	at mainbus0
+
 # uPD7201 SIO
 sio0	at mainbus0
 siotty0	at sio0			# ttya

Index: src/sys/arch/luna68k/conf/files.luna68k
diff -u src/sys/arch/luna68k/conf/files.luna68k:1.25 src/sys/arch/luna68k/conf/files.luna68k:1.26
--- src/sys/arch/luna68k/conf/files.luna68k:1.25	Sat Dec  3 17:38:02 2016
+++ 

CVS commit: src/share/man/man4

2017-03-09 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Mar  9 11:39:43 UTC 2017

Modified Files:
src/share/man/man4: options.4

Log Message:
Bump date for previous. Use American spelling.


To generate a diff of this commit:
cvs rdiff -u -r1.464 -r1.465 src/share/man/man4/options.4

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/man4/options.4
diff -u src/share/man/man4/options.4:1.464 src/share/man/man4/options.4:1.465
--- src/share/man/man4/options.4:1.464	Thu Mar  9 00:17:32 2017
+++ src/share/man/man4/options.4	Thu Mar  9 11:39:43 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.464 2017/03/09 00:17:32 chs Exp $
+.\"	$NetBSD: options.4,v 1.465 2017/03/09 11:39:43 wiz Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd February 19, 2017
+.Dd March 9, 2017
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -636,7 +636,7 @@ These checks are very expensive and can 
 multi-processor machines by a factor of three.
 .It Cd options KDTRACE_HOOKS
 Adds hooks for the DTrace tracing facility, which allows users to
-analyse many aspects of system and application behavior.
+analyze many aspects of system and application behavior.
 See
 .Xr dtrace 1
 for details.



CVS commit: src/lib/libc/gen

2017-03-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Mar  9 11:39:41 UTC 2017

Modified Files:
src/lib/libc/gen: extattr.c

Log Message:
Remove redundant null check before free. it is safe to free(NULL)
While here, clear up odd whitespace issue. NFC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libc/gen/extattr.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/libc/gen/extattr.c
diff -u src/lib/libc/gen/extattr.c:1.4 src/lib/libc/gen/extattr.c:1.5
--- src/lib/libc/gen/extattr.c:1.4	Tue Mar 13 21:13:34 2012
+++ src/lib/libc/gen/extattr.c	Thu Mar  9 11:39:41 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: extattr.c,v 1.4 2012/03/13 21:13:34 christos Exp $	*/
+/*	$NetBSD: extattr.c,v 1.5 2017/03/09 11:39:41 maya Exp $	*/
 
 /*-
  * Copyright (c) 2001 Robert N. M. Watson
@@ -32,7 +32,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: extattr.c,v 1.4 2012/03/13 21:13:34 christos Exp $");
+__RCSID("$NetBSD: extattr.c,v 1.5 2017/03/09 11:39:41 maya Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -150,7 +150,7 @@ extattr_copy_fd(int from_fd, int to_fd, 
 		}
 
 		if ((vlen = extattr_get_fd(from_fd, namespace, aname,
-  aval, (size_t)vlen)) == -1)
+	   aval, (size_t)vlen)) == -1)
 			goto out;
 	
 		if (extattr_set_fd(to_fd, namespace, aname,
@@ -160,12 +160,9 @@ extattr_copy_fd(int from_fd, int to_fd, 
 
 	error = 0;
 out:
-	if (aval != NULL)
-		free(aval);
-	
-	if (alist != NULL)
-		free(alist);
-	
+	free(aval);
+	free(alist);
+
 	return error;
 }
 
@@ -222,7 +219,8 @@ extattr_copy_file(const char *from, cons
 			maxvlen = vlen;
 		}
 
-		if ((vlen = extattr_get_file(from, namespace, aname,			 aval, (size_t)vlen)) == -1)
+		if ((vlen = extattr_get_file(from, namespace, aname,
+		aval, (size_t)vlen)) == -1)
 			goto out;
 	
 		if (extattr_set_file(to, namespace, aname,
@@ -232,12 +230,9 @@ extattr_copy_file(const char *from, cons
 
 	error = 0;
 out:
-	if (aval != NULL)
-		free(aval);
-	
-	if (alist != NULL)
-		free(alist);
-	
+	free(aval);
+	free(alist);
+
 	return error;
 }
 
@@ -305,12 +300,9 @@ extattr_copy_link(const char *from, cons
 
 	error = 0;
 out:
-	if (aval != NULL)
-		free(aval);
-	
-	if (alist != NULL)
-		free(alist);
-	
+	free(aval);
+	free(alist);
+
 	return error;
 }
 



CVS commit: src/sys/miscfs/genfs

2017-03-09 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Thu Mar  9 10:10:02 UTC 2017

Modified Files:
src/sys/miscfs/genfs: genfs_io.c

Log Message:
Protect genfs_do_putpages() against vnodes disappearing during
a forced mount update from read-write to read-only.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/miscfs/genfs/genfs_io.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.64 src/sys/miscfs/genfs/genfs_io.c:1.65
--- src/sys/miscfs/genfs/genfs_io.c:1.64	Wed Mar  1 10:47:26 2017
+++ src/sys/miscfs/genfs/genfs_io.c	Thu Mar  9 10:10:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.64 2017/03/01 10:47:26 hannken Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.65 2017/03/09 10:10:02 hannken Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.64 2017/03/01 10:47:26 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.65 2017/03/09 10:10:02 hannken Exp $");
 
 #include 
 #include 
@@ -842,11 +842,11 @@ genfs_do_putpages(struct vnode *vp, off_
 	bool pagedaemon = curlwp == uvm.pagedaemon_lwp;
 	struct lwp * const l = curlwp ? curlwp : 
 	struct genfs_node * const gp = VTOG(vp);
+	struct mount *trans_mp;
 	int flags;
 	int dirtygen;
 	bool modified;
-	bool need_wapbl;
-	bool has_trans;
+	bool holds_wapbl;
 	bool cleanall;
 	bool onworklst;
 
@@ -859,9 +859,8 @@ genfs_do_putpages(struct vnode *vp, off_
 	UVMHIST_LOG(ubchist, "vp %p pages %d off 0x%x len 0x%x",
 	vp, uobj->uo_npages, startoff, endoff - startoff);
 
-	has_trans = false;
-	need_wapbl = (!pagedaemon && vp->v_mount && vp->v_mount->mnt_wapbl &&
-	(origflags & PGO_JOURNALLOCKED) == 0);
+	trans_mp = NULL;
+	holds_wapbl = false;
 
 retry:
 	modified = false;
@@ -874,10 +873,10 @@ retry:
 			if (LIST_FIRST(>v_dirtyblkhd) == NULL)
 vn_syncer_remove_from_worklist(vp);
 		}
-		if (has_trans) {
-			if (need_wapbl)
-WAPBL_END(vp->v_mount);
-			fstrans_done(vp->v_mount);
+		if (trans_mp) {
+			if (holds_wapbl)
+WAPBL_END(trans_mp);
+			fstrans_done(trans_mp);
 		}
 		mutex_exit(slock);
 		return (0);
@@ -887,24 +886,41 @@ retry:
 	 * the vnode has pages, set up to process the request.
 	 */
 
-	if (!has_trans && (flags & PGO_CLEANIT) != 0) {
-		mutex_exit(slock);
+	if (trans_mp == NULL && (flags & PGO_CLEANIT) != 0) {
 		if (pagedaemon) {
-			error = fstrans_start_nowait(vp->v_mount, FSTRANS_LAZY);
-			if (error)
-return error;
-		} else
-			fstrans_start(vp->v_mount, FSTRANS_LAZY);
-		if (need_wapbl) {
-			error = WAPBL_BEGIN(vp->v_mount);
+			/* Pagedaemon must not sleep here. */
+			trans_mp = vp->v_mount;
+			error = fstrans_start_nowait(trans_mp, FSTRANS_LAZY);
 			if (error) {
-fstrans_done(vp->v_mount);
+mutex_exit(slock);
 return error;
 			}
+		} else {
+			/*
+			 * Cannot use vdeadcheck() here as this operation
+			 * usually gets used from VOP_RECLAIM().  Test for
+			 * change of v_mount instead and retry on change.
+			 */
+			mutex_exit(slock);
+			trans_mp = vp->v_mount;
+			fstrans_start(trans_mp, FSTRANS_LAZY);
+			if (vp->v_mount != trans_mp) {
+fstrans_done(trans_mp);
+trans_mp = NULL;
+			} else {
+holds_wapbl = (trans_mp->mnt_wapbl &&
+(origflags & PGO_JOURNALLOCKED) == 0);
+if (holds_wapbl) {
+	error = WAPBL_BEGIN(trans_mp);
+	if (error) {
+		fstrans_done(trans_mp);
+		return error;
+	}
+}
+			}
+			mutex_enter(slock);
+			goto retry;
 		}
-		has_trans = true;
-		mutex_enter(slock);
-		goto retry;
 	}
 
 	error = 0;
@@ -1277,10 +1293,10 @@ skip_scan:
 		goto retry;
 	}
 
-	if (has_trans) {
-		if (need_wapbl)
-			WAPBL_END(vp->v_mount);
-		fstrans_done(vp->v_mount);
+	if (trans_mp) {
+		if (holds_wapbl)
+			WAPBL_END(trans_mp);
+		fstrans_done(trans_mp);
 	}
 
 	return (error);



CVS commit: src/sys/net

2017-03-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Mar  9 09:57:36 UTC 2017

Modified Files:
src/sys/net: if.c

Log Message:
ifp->if_transmit() must free mbuf even if error occurred.

Add missing m_freem(m) to if_nulltransmit().
Below ifp->if_transmit() implementations are already added m_freem(m) properly.
- wm(4)
- ixg(4)
- ixv(4)
- pppoe(4)
- gif(4)
- l2tp(4)

pointed out by ozaki-r@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.382 -r1.383 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.382 src/sys/net/if.c:1.383
--- src/sys/net/if.c:1.382	Tue Mar  7 01:32:03 2017
+++ src/sys/net/if.c	Thu Mar  9 09:57:36 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.382 2017/03/07 01:32:03 ozaki-r Exp $	*/
+/*	$NetBSD: if.c,v 1.383 2017/03/09 09:57:36 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.382 2017/03/07 01:32:03 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.383 2017/03/09 09:57:36 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -379,6 +379,7 @@ int
 if_nulltransmit(struct ifnet *ifp, struct mbuf *m)
 {
 
+	m_freem(m);
 	return ENXIO;
 }
 
@@ -3260,9 +3261,11 @@ if_transmit_lock(struct ifnet *ifp, stru
 	} else {
 		KERNEL_UNLOCK_ONE(NULL);
 		error = (*ifp->if_transmit)(ifp, m);
+		/* mbuf is alredy freed */
 	}
 #else /* !ALTQ */
 	error = (*ifp->if_transmit)(ifp, m);
+	/* mbuf is alredy freed */
 #endif /* !ALTQ */
 
 	return error;



CVS commit: src/sys/netinet

2017-03-09 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Mar  9 08:41:56 UTC 2017

Modified Files:
src/sys/netinet: if_arp.c

Log Message:
Only check target address collision if the sender address is the null
address (ie a DAD probe) or our matching address is either TENTATIVE
or DUPLICATED.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/netinet/if_arp.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/netinet/if_arp.c
diff -u src/sys/netinet/if_arp.c:1.244 src/sys/netinet/if_arp.c:1.245
--- src/sys/netinet/if_arp.c:1.244	Fri Feb 24 13:42:18 2017
+++ src/sys/netinet/if_arp.c	Thu Mar  9 08:41:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.c,v 1.244 2017/02/24 13:42:18 roy Exp $	*/
+/*	$NetBSD: if_arp.c,v 1.245 2017/03/09 08:41:56 roy Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.244 2017/02/24 13:42:18 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arp.c,v 1.245 2017/03/09 08:41:56 roy Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1163,11 +1163,19 @@ in_arpinput(struct mbuf *m)
 		goto out;
 	}
 
-	/* DAD check, RFC 5227 */
+	/*
+	 * DAD check, RFC 5227.
+	 * Collision on sender address is always a duplicate.
+	 * Collision on target address is only a duplicate IF
+	 * the sender address is the null host (ie a DAD probe) AND
+	 * our address is in the TENTATIVE state.
+	 * DUPLICATED state is also checked so that processing stops here
+	 * and an error can be logged.
+	 */
 	if (do_dad &&
 	(in_hosteq(isaddr, myaddr) ||
 	(in_nullhost(isaddr) && in_hosteq(itaddr, myaddr)
-	&& ISSET(m->m_flags, M_BCAST /* Allow Unicast Poll, RFC 1122 */
+	&& ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED
 	{
 		arp_dad_duplicated((struct ifaddr *)ia,
 		lla_snprintf(llabuf, ar_sha(ah), ah->ar_hln));



CVS commit: src/sys/external/bsd/drm2

2017-03-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Mar  9 08:27:18 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/dist/drm/ttm: ttm_tt.c
src/sys/external/bsd/drm2/ttm: ttm_agp_backend.c ttm_bus_dma.c

Log Message:
Clarify ttm state transitions tt_unpopulated<->tt_unbound<->tt_bound.
Assert it, too, and don't handle other cases.

We can add the assertion to ttm_agp_tt_unpopulate because it is called by
{nouveau,radeon}_ttm_tt_unpopulate, which is generically called
ttm_tt_unpopulate.

And the sole caller to ttm_tt_unpopulate (ttm_tt_destroy) only does so if the
state is unbound. the other caller is in a !NetBSD block.

We can add the assertion to ttm_agp_tt_populate and avoid handling the
!unpopulated case because the sole callers are {nouveau,radeon}_ttm_tt_populate
both of which return early in the !unpopulated case.

We can change the assertion on ttm_tt_wire because it is solely called by
ttm_bus_dma_populate, which already asserts that it is the unpopulated case.

from riastradh


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.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/external/bsd/drm2/dist/drm/ttm/ttm_tt.c
diff -u src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.8 src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.9
--- src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c:1.8	Sat Dec 24 15:46:50 2016
+++ src/sys/external/bsd/drm2/dist/drm/ttm/ttm_tt.c	Thu Mar  9 08:27:18 2017
@@ -360,9 +360,9 @@ EXPORT_SYMBOL(ttm_tt_bind);
  * ttm_tt_wire(ttm)
  *
  *	Wire the uvm pages of ttm and fill the ttm page array.  ttm
- *	must be unpopulated or unbound, and must be marked swapped.
- *	This does not change either state -- the caller is expected to
- *	include it among other operations for such a state transition.
+ *	must be unpopulated, and must be marked swapped.  This does not
+ *	change either state -- the caller is expected to include it
+ *	among other operations for such a state transition.
  */
 int
 ttm_tt_wire(struct ttm_tt *ttm)
@@ -372,9 +372,8 @@ ttm_tt_wire(struct ttm_tt *ttm)
 	unsigned i;
 	int error;
 
-	KASSERTMSG((ttm->state == tt_unpopulated || ttm->state == tt_unbound),
-	"ttm_tt %p must be unpopulated or unbound for wiring,"
-	" but state=%d",
+	KASSERTMSG((ttm->state == tt_unpopulated),
+	"ttm_tt %p must be unpopulated for wiring, but state=%d",
 	ttm, (int)ttm->state);
 	KASSERT(ISSET(ttm->page_flags, TTM_PAGE_FLAG_SWAPPED));
 	KASSERT(uobj != NULL);

Index: src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.5 src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.6
--- src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c:1.5	Sat Oct 17 21:05:57 2015
+++ src/sys/external/bsd/drm2/ttm/ttm_agp_backend.c	Thu Mar  9 08:27:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_agp_backend.c,v 1.5 2015/10/17 21:05:57 jmcneill Exp $	*/
+/*	$NetBSD: ttm_agp_backend.c,v 1.6 2017/03/09 08:27:18 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.5 2015/10/17 21:05:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_agp_backend.c,v 1.6 2017/03/09 08:27:18 maya Exp $");
 
 #include 
 #include 
@@ -78,9 +78,9 @@ int
 ttm_agp_tt_populate(struct ttm_tt *ttm)
 {
 
-	if (ttm->state != tt_unpopulated)
-		return 0;
-
+	KASSERTMSG((ttm->state == tt_unpopulated),
+	"ttm_agp_tt_populate: ttm %p state is not tt_unpopulated: %d",
+	ttm, (int)ttm->state);
 	return ttm_bus_dma_populate(container_of(ttm, struct ttm_dma_tt, ttm));
 }
 
@@ -88,6 +88,9 @@ void
 ttm_agp_tt_unpopulate(struct ttm_tt *ttm)
 {
 
+	KASSERTMSG((ttm->state == tt_unbound),
+	"ttm_agp_tt_unpopulate: ttm %p state is not tt_unbound: %d",
+	ttm, (int)ttm->state);
 	ttm_bus_dma_unpopulate(container_of(ttm, struct ttm_dma_tt, ttm));
 }
 

Index: src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.6 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.7
--- src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.6	Thu Mar  9 08:05:21 2017
+++ src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c	Thu Mar  9 08:27:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $	*/
+/*	$NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $");
 
 #include 
 
@@ -47,8 +47,8 @@ __KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.
  *	its DMA map.  The wiring and loading 

CVS commit: src/sys/external/bsd/drm2/ttm

2017-03-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Thu Mar  9 08:05:21 UTC 2017

Modified Files:
src/sys/external/bsd/drm2/ttm: ttm_bus_dma.c

Log Message:
oops, copied the code from the wrong diff. ... unbreak the build, still
doing the same thing.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.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/external/bsd/drm2/ttm/ttm_bus_dma.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.5 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.6
--- src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.5	Thu Mar  9 07:55:23 2017
+++ src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c	Thu Mar  9 08:05:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bus_dma.c,v 1.5 2017/03/09 07:55:23 maya Exp $	*/
+/*	$NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.5 2017/03/09 07:55:23 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.6 2017/03/09 08:05:21 maya Exp $");
 
 #include 
 
@@ -86,9 +86,9 @@ ttm_bus_dma_populate(struct ttm_dma_tt *
 
 fail2: __unused
 	bus_dmamap_unload(ttm_dma->ttm.bdev->dmat, ttm_dma->dma_address);
-fail1:	KASSERT(ttm->state == tt_unbound);
+fail1:	KASSERT(ttm_dma->ttm.state == tt_unbound);
 	ttm_tt_unwire(_dma->ttm);
-	ttm->state = tt_unpopulated;
+	ttm_dma->ttm.state = tt_unpopulated;
 fail0:	KASSERT(ret);
 	return ret;
 }