CVS commit: src/sys/dev/pci

2017-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 25 16:07:48 UTC 2017

Modified Files:
src/sys/dev/pci: yds.c ydsvar.h

Log Message:
PR/52331: ydc driver: sleep-under-spin-mutex bugs in yds_allocmem
Don't hold the spin interrupt mutex while calling yds_init from resume.
Instead use a flag to short-circuit the interrupt while disabled.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/yds.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/ydsvar.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/yds.c
diff -u src/sys/dev/pci/yds.c:1.58 src/sys/dev/pci/yds.c:1.59
--- src/sys/dev/pci/yds.c:1.58	Wed May 31 22:45:11 2017
+++ src/sys/dev/pci/yds.c	Sun Jun 25 12:07:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.58 2017/06/01 02:45:11 chs Exp $	*/
+/*	$NetBSD: yds.c,v 1.59 2017/06/25 16:07:48 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.58 2017/06/01 02:45:11 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.59 2017/06/25 16:07:48 christos Exp $");
 
 #include "mpu.h"
 
@@ -688,6 +688,7 @@ yds_suspend(device_t dv, const pmf_qual_
 
 	mutex_enter(>sc_lock);
 	mutex_spin_enter(>sc_intr_lock);
+	sc->sc_enabled = 0;
 	sc->sc_dsctrl = pci_conf_read(pc, tag, YDS_PCI_DSCTRL);
 	sc->sc_legacy = pci_conf_read(pc, tag, YDS_PCI_LEGACY);
 	sc->sc_ba[0] = pci_conf_read(pc, tag, YDS_PCI_FM_BA);
@@ -718,14 +719,15 @@ yds_resume(device_t dv, const pmf_qual_t
 		PCI_COMMAND_MASTER_ENABLE);
 	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg);
 	reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+	mutex_spin_exit(>sc_intr_lock);
 	if (yds_init(sc)) {
 		aprint_error_dev(dv, "reinitialize failed\n");
-		mutex_spin_exit(>sc_intr_lock);
 		mutex_exit(>sc_lock);
 		return false;
 	}
 
 	pci_conf_write(pc, tag, YDS_PCI_DSCTRL, sc->sc_dsctrl);
+	sc->sc_enabled = 1;
 	mutex_spin_exit(>sc_intr_lock);
 	sc->sc_codec[0].codec_if->vtbl->restore_ports(sc->sc_codec[0].codec_if);
 	mutex_exit(>sc_lock);
@@ -785,6 +787,7 @@ yds_attach(device_t parent, device_t sel
 	}
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
+	sc->sc_enabled = 0;
 	sc->sc_dmatag = pa->pa_dmat;
 	sc->sc_pc = pc;
 	sc->sc_pcitag = pa->pa_tag;
@@ -940,6 +943,10 @@ detected:
 
 	if (!pmf_device_register(self, yds_suspend, yds_resume))
 		aprint_error_dev(self, "couldn't establish power handler\n");
+
+	mutex_spin_enter(>sc_intr_lock);
+	sc->sc_enabled = 1;
+	mutex_spin_exit(>sc_intr_lock);
 }
 
 static int
@@ -1046,6 +1053,10 @@ yds_intr(void *p)
 	u_int status;
 
 	mutex_spin_enter(>sc_intr_lock);
+	if (!sc->sc_enabled) {
+		mutex_spin_exit(>sc_intr_lock);
+		return 0;
+	}
 
 	status = YREAD4(sc, YDS_STATUS);
 	DPRINTFN(1, ("yds_intr: status=%08x\n", status));

Index: src/sys/dev/pci/ydsvar.h
diff -u src/sys/dev/pci/ydsvar.h:1.11 src/sys/dev/pci/ydsvar.h:1.12
--- src/sys/dev/pci/ydsvar.h:1.11	Wed Nov 23 18:07:36 2011
+++ src/sys/dev/pci/ydsvar.h	Sun Jun 25 12:07:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ydsvar.h,v 1.11 2011/11/23 23:07:36 jmcneill Exp $	*/
+/*	$NetBSD: ydsvar.h,v 1.12 2017/06/25 16:07:48 christos Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -66,6 +66,7 @@ struct yds_softc {
 	bus_space_handle_t	memh;
 	bus_dma_tag_t		sc_dmatag;	/* DMA tag */
 	u_int			sc_flags;
+	int			sc_enabled;
 
 	struct yds_codec_softc	sc_codec[2];	/* Primary/Secondary AC97 */
 



CVS commit: src/sys/dev/pci

2017-06-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 25 15:56:32 UTC 2017

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

Log Message:
PR/52330: Jia-Ju Bai: mpii driver: a sleep-in-interrupt bug in mpii_intr
Since the enclosing routime mpii_event_raid already calls malloc with
M_NOWAIT, fix the cache routine to do the same. While there check the
result of the cache routine and change some error prints to aprint.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/mpii.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/mpii.c
diff -u src/sys/dev/pci/mpii.c:1.8 src/sys/dev/pci/mpii.c:1.9
--- src/sys/dev/pci/mpii.c:1.8	Mon May  2 15:18:29 2016
+++ src/sys/dev/pci/mpii.c	Sun Jun 25 11:56:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: mpii.c,v 1.8 2016/05/02 19:18:29 christos Exp $ */
+/* $NetBSD: mpii.c,v 1.9 2017/06/25 15:56:32 christos Exp $ */
 /*	OpenBSD: mpii.c,v 1.51 2012/04/11 13:29:14 naddy Exp 	*/
 /*
  * Copyright (c) 2010 Mike Belopuhov 
@@ -20,7 +20,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.8 2016/05/02 19:18:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpii.c,v 1.9 2017/06/25 15:56:32 christos Exp $");
 
 #include "bio.h"
 
@@ -3434,26 +3434,34 @@ mpii_event_raid(struct mpii_softc *sc, s
 			case MPII_EVT_IR_CFG_ELEMENT_RC_VOLUME_CREATED:
 if (mpii_find_dev(sc,
 le16toh(ce->vol_dev_handle))) {
-	printf("%s: device %#x is already "
-	"configured\n", DEVNAME(sc),
+	aprint_error_dev(sc->sc_dev,
+	"device %#x is already "
+	"configured\n",
 	le16toh(ce->vol_dev_handle));
 	break;
 }
 dev = malloc(sizeof(*dev), M_DEVBUF,
 M_NOWAIT | M_ZERO);
 if (!dev) {
-	printf("%s: failed to allocate a "
-	"device structure\n", DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev,
+	"can't allocate device structure\n");
 	break;
 }
 SET(dev->flags, MPII_DF_VOLUME);
 dev->slot = sc->sc_vd_id_low;
 dev->dev_handle = le16toh(ce->vol_dev_handle);
 if (mpii_insert_dev(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't insert device structure\n");
+	free(dev, M_DEVBUF);
+	break;
+}
+if (mpii_cache_enable(sc, dev)) {
+	aprint_error_dev(sc->sc_dev,
+	"can't enable device cache\n");
 	free(dev, M_DEVBUF);
 	break;
 }
-mpii_cache_enable(sc, dev);
 sc->sc_vd_count++;
 break;
 			case MPII_EVT_IR_CFG_ELEMENT_RC_REMOVED:
@@ -3515,15 +3523,15 @@ mpii_event_sas(struct mpii_softc *sc, st
 		switch (pe->phy_status & MPII_EVENT_SAS_TOPO_PS_RC_MASK) {
 		case MPII_EVENT_SAS_TOPO_PS_RC_ADDED:
 			if (mpii_find_dev(sc, le16toh(pe->dev_handle))) {
-printf("%s: device %#x is already "
-"configured\n", DEVNAME(sc),
+aprint_error_dev(sc->sc_dev,
+"device %#x is already configured\n",
 le16toh(pe->dev_handle));
 break;
 			}
 			dev = malloc(sizeof(*dev), M_DEVBUF, M_NOWAIT | M_ZERO);
 			if (!dev) {
-printf("%s: failed to allocate a "
-"device structure\n", DEVNAME(sc));
+aprint_error_dev(sc->sc_dev, "can't allocate "
+"device structure\n");
 break;
 			}
 			dev->slot = sc->sc_pd_id_start + tcl->start_phy_num + i;
@@ -3534,6 +3542,8 @@ mpii_event_sas(struct mpii_softc *sc, st
 			dev->enclosure = le16toh(tcl->enclosure_handle);
 			dev->expander = le16toh(tcl->expander_handle);
 			if (mpii_insert_dev(sc, dev)) {
+aprint_error_dev(sc->sc_dev, "can't insert "
+"device structure\n");
 free(dev, M_DEVBUF);
 break;
 			}
@@ -3550,9 +3560,9 @@ mpii_event_sas(struct mpii_softc *sc, st
 DVACT_DEACTIVATE);
 if (scsi_task(mpii_event_defer, sc,
 dev, 0) != 0)
-	printf("%s: unable to run device "
-	"detachment routine\n",
-	DEVNAME(sc));
+	aprint_error_dev(sc->sc_dev, 
+	"unable to run device "
+	"detachment routine\n");
 			}
 #else
 			mpii_event_defer(sc, dev);
@@ -4979,7 +4989,7 @@ mpii_cache_enable(struct mpii_softc *sc,
 		return (EINVAL);
 
 	pagelen = hdr.page_length * 4;
-	vpg = malloc(pagelen, M_TEMP, M_WAITOK | M_CANFAIL | M_ZERO);
+	vpg = malloc(pagelen, M_TEMP, M_NOWAIT | M_ZERO);
 	if (vpg == NULL)
 		return (ENOMEM);
 



CVS commit: [netbsd-8] src

2017-06-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jun 25 06:22:57 UTC 2017

Modified Files:
src/share/man/man4 [netbsd-8]: siisata.4
src/sys/dev/pci [netbsd-8]: pcidevs siisata_pci.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #55):
share/man/man4/siisata.4: revision 1.6
sys/dev/pci/pcidevs: revision 1.1291
sys/dev/pci/siisata_pci.c: revision 1.15
add entry for Adaptec 1220SA
--
match Adaptec 1220SA; that card actually uses Silicon Image 3132, and works
well with the siisata(4) driver
--
add Adaptec 1220SA


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.18.1 src/share/man/man4/siisata.4
cvs rdiff -u -r1.1289 -r1.1289.2.1 src/sys/dev/pci/pcidevs
cvs rdiff -u -r1.14 -r1.14.10.1 src/sys/dev/pci/siisata_pci.c

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/siisata.4
diff -u src/share/man/man4/siisata.4:1.5 src/share/man/man4/siisata.4:1.5.18.1
--- src/share/man/man4/siisata.4:1.5	Tue Mar 18 18:20:39 2014
+++ src/share/man/man4/siisata.4	Sun Jun 25 06:22:57 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: siisata.4,v 1.5 2014/03/18 18:20:39 riastradh Exp $
+.\" $NetBSD: siisata.4,v 1.5.18.1 2017/06/25 06:22:57 snj Exp $
 .\"
 .\" Copyright (c) 2007, 2008 Jonathan A. Kollasch. All rights reserved.
 .\"
@@ -22,7 +22,7 @@
 .\" INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 19, 2009
+.Dd June 17, 2017
 .Dt SIISATA 4
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@ driver:
 .Bl -tag -width Ds -offset indent -compact
 .It Silicon Image SiI3124 4-port PCI/PCI-X
 .It Silicon Image SiI3132 2-port PCI-Express x1
+.It Adaptec 1220SA (SiI3132 chip)
 .It Silicon Image SiI3531 1-port PCI-Express x1
 .El
 .Sh SEE ALSO

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1289 src/sys/dev/pci/pcidevs:1.1289.2.1
--- src/sys/dev/pci/pcidevs:1.1289	Tue May 23 07:12:56 2017
+++ src/sys/dev/pci/pcidevs	Sun Jun 25 06:22:57 2017
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1289 2017/05/23 07:12:56 nonaka Exp $
+$NetBSD: pcidevs,v 1.1289.2.1 2017/06/25 06:22:57 snj Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1955,6 +1955,7 @@ product CIRRUS CS4281		0x6005	CS4281 Cry
 
 /* Adaptec's AAR-1210SA serial ATA RAID controller uses the CMDTECH chip */
 product CMDTECH AAR_1210SA	0x0240	AAR-1210SA SATA RAID Controller
+product CMDTECH AAR_1220SA	0x0242	AAR-1220SA SATA RAID Controller
 /* CMD Technology products -- info gleaned from their web site */
 product CMDTECH 640		0x0640	PCI0640
 /* No data on the CMD Tech. web site for the following as of Mar. 3 '98 */

Index: src/sys/dev/pci/siisata_pci.c
diff -u src/sys/dev/pci/siisata_pci.c:1.14 src/sys/dev/pci/siisata_pci.c:1.14.10.1
--- src/sys/dev/pci/siisata_pci.c:1.14	Thu Jul 14 04:19:27 2016
+++ src/sys/dev/pci/siisata_pci.c	Sun Jun 25 06:22:57 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.14 2016/07/14 04:19:27 msaitoh Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.14.10.1 2017/06/25 06:22:57 snj Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.14 2016/07/14 04:19:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.14.10.1 2017/06/25 06:22:57 snj Exp $");
 
 #include 
 #include 
@@ -97,6 +97,12 @@ static const struct siisata_pci_board si
 	},
 	{
 		.spb_vend = PCI_VENDOR_CMDTECH,
+		.spb_prod = PCI_PRODUCT_CMDTECH_AAR_1220SA,
+		.spb_port = 2,
+		.spb_chip = 3132,
+	},
+	{
+		.spb_vend = PCI_VENDOR_CMDTECH,
 		.spb_prod = PCI_PRODUCT_CMDTECH_3531,
 		.spb_port = 1,
 		.spb_chip = 3531,



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

2017-06-25 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jun 25 10:06:27 UTC 2017

Modified Files:
src/sys/arch/cats/conf: GENERIC

Log Message:
Comment out a bunch of thing so that a GENERIC kernel boots on my cats
with cyclone firmware


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/arch/cats/conf/GENERIC

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/cats/conf/GENERIC
diff -u src/sys/arch/cats/conf/GENERIC:1.161 src/sys/arch/cats/conf/GENERIC:1.162
--- src/sys/arch/cats/conf/GENERIC:1.161	Tue Dec 13 20:42:16 2016
+++ src/sys/arch/cats/conf/GENERIC	Sun Jun 25 10:06:27 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.161 2016/12/13 20:42:16 christos Exp $
+# $NetBSD: GENERIC,v 1.162 2017/06/25 10:06:27 skrll Exp $
 #
 # GENERIC machine description file
 # 
@@ -53,22 +53,22 @@ makeoptions	CPUFLAGS="-march=armv4 -mtun
 # File systems
 
 file-system	FFS		# UFS
-file-system	LFS		# log-structured file system
+#file-system	LFS		# log-structured file system
 file-system	MFS		# memory file system
 file-system	NFS		# Network file system
-file-system 	ADOSFS		# AmigaDOS-compatible file system
-file-system 	EXT2FS		# second extended file system (linux)
+#file-system 	ADOSFS		# AmigaDOS-compatible file system
+#file-system 	EXT2FS		# second extended file system (linux)
 file-system	CD9660		# ISO 9660 + Rock Ridge file system
 file-system	MSDOSFS		# MS-DOS file system
 file-system	FDESC		# /dev/fd
 file-system	KERNFS		# /kern
 file-system	NULLFS		# loopback file system
-file-system 	OVERLAY		# overlay filesystem
+#file-system 	OVERLAY		# overlay filesystem
 file-system	PUFFS		# Userspace file systems (e.g. ntfs-3g & sshfs)
 file-system	PROCFS		# /proc
 file-system	UMAPFS		# NULLFS + uid and gid remapping
 file-system	UNION		# union file system
-file-system	CODA		# Coda File System; also needs vcode (below)
+#file-system	CODA		# Coda File System; also needs vcode (below)
 file-system	PTYFS		# /dev/pts/N support
 file-system	TMPFS		# Efficient memory file-system
 #file-system	UDF		# experimental - OSTA UDF CD/DVD file-system
@@ -92,7 +92,7 @@ options 	INET6		# IPV6
 #options 	IPSEC_DEBUG	# debug for IP security
 #options 	MROUTING	# IP multicast routing
 #options 	PIM		# Protocol Independent Multicast
-options 	NETATALK	# AppleTalk networking
+#options 	NETATALK	# AppleTalk networking
 options 	PPP_BSDCOMP	# BSD-Compress compression support for PPP
 options 	PPP_DEFLATE	# Deflate compression support for PPP
 options 	PPP_FILTER	# Active filter support for PPP (requires bpf)
@@ -154,7 +154,7 @@ options 	SYSVSHM		# System V-like memory
 
 # Miscellaneous kernel options
 options 	KTRACE		# system call tracing, a la ktrace(1)
-options 	IRQSTATS	# manage IRQ statistics
+#options 	IRQSTATS	# manage IRQ statistics
 options 	SCSIVERBOSE	# Verbose SCSI errors
 options 	PCIVERBOSE	# Verbose PCI descriptions
 options 	MIIVERBOSE	# verbose PHY autoconfig messages
@@ -221,8 +221,8 @@ ppb*	at pci? dev ? function ?	# PCI-PCI 
 # Cryptographic Devices
 
 # PCI cryptographic devices
-hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
-ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
+#hifn*	at pci? dev ? function ?	# Hifn 7755/7811/795x
+#ubsec*	at pci? dev ? function ?	# Broadcom 5501/5601/580x/582x
 
 
 # PCI serial interfaces
@@ -233,29 +233,29 @@ ubsec*	at pci? dev ? function ?	# Broadc
 #lpt*	at puc? port ?			# || ports on "universal" comm boards
 
 # PCI SCSI Controllers and Buses
-adv*	at pci? dev ? function ?	# AdvanSys 1200[A,B], ULTRA SCSI
-scsibus* at adv?
+#adv*	at pci? dev ? function ?	# AdvanSys 1200[A,B], ULTRA SCSI
+#scsibus* at adv?
 #adw*	at pci? dev ? function ?	# AdvanSys 9xxUW SCSI
 #scsibus* at adw?
-ahc*	at pci? dev ? function ?	# Adaptec [23]94x, aic78x0 SCSI controllers
-scsibus* at ahc?
+#ahc*	at pci? dev ? function ?	# Adaptec [23]94x, aic78x0 SCSI controllers
+#scsibus* at ahc?
 #bha*	at pci? dev ? function ?	# BusLogic 9xx SCSI
 #scsibus* at bha?
-iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
-scsibus* at iha?
+#iha*	at pci? dev ? function ?	# Initio INIC-940/950 SCSI
+#scsibus* at iha?
 #isp*	at pci? dev ? function ?	# Qlogic ISP 10x0 SCSI controllers
 #scsibus* at isp?
-pcscp*	at pci? dev ? function ?	# AMD 53c974 PCscsi-PCI SCSI
-scsibus* at pcscp?
-siop*	at pci? dev ? function ?	# NCR 53c8xx SCSI
-scsibus* at siop?
-esiop*	at pci? dev ? function ?	# NCR 53c875 SCSI and newer
-scsibus* at esiop?
+#pcscp*	at pci? dev ? function ?	# AMD 53c974 PCscsi-PCI SCSI
+#scsibus* at pcscp?
+#siop*	at pci? dev ? function ?	# NCR 53c8xx SCSI
+#scsibus* at siop?
+#esiop*	at pci? dev ? function ?	# NCR 53c875 SCSI and newer
+#scsibus* at esiop?
 
 # SCSI devices
-sd*	at scsibus? target ? lun ?	# SCSI disk drives
-st*	at scsibus? target ? lun ?	# SCSI tape drives
-cd*	at scsibus? target ? lun ?	# SCSI CD-ROM drives
+#sd*	at scsibus? target ? lun ?	# SCSI disk 

CVS commit: src/sys/dev/sbus

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:02:59 UTC 2017

Modified Files:
src/sys/dev/sbus: be.c

Log Message:
spl leak, found by Mootja a long time ago


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/sbus/be.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/sbus/be.c
diff -u src/sys/dev/sbus/be.c:1.85 src/sys/dev/sbus/be.c:1.86
--- src/sys/dev/sbus/be.c:1.85	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/sbus/be.c	Sun Jun 25 12:02:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: be.c,v 1.85 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: be.c,v 1.86 2017/06/25 12:02:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.85 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.86 2017/06/25 12:02:59 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -1119,6 +1119,7 @@ beinit(struct ifnet *ifp)
 
 	callout_reset(>sc_tick_ch, hz, be_tick, sc);
 
+	splx(s);
 	return 0;
 out:
 	splx(s);



CVS commit: src/sys/dev/pcmcia

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:25:02 UTC 2017

Modified Files:
src/sys/dev/pcmcia: if_malo_pcmcia.c

Log Message:
two spl leaks, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pcmcia/if_malo_pcmcia.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/pcmcia/if_malo_pcmcia.c
diff -u src/sys/dev/pcmcia/if_malo_pcmcia.c:1.13 src/sys/dev/pcmcia/if_malo_pcmcia.c:1.14
--- src/sys/dev/pcmcia/if_malo_pcmcia.c:1.13	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/pcmcia/if_malo_pcmcia.c	Sun Jun 25 12:25:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_malo_pcmcia.c,v 1.13 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: if_malo_pcmcia.c,v 1.14 2017/06/25 12:25:02 maxv Exp $	*/
 /*  $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.13 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.14 2017/06/25 12:25:02 maxv Exp $");
 
 #ifdef _MODULE
 #include 
@@ -242,6 +242,7 @@ malo_pcmcia_activate(device_t dev, devac
 		if_deactivate(ifp);
 		break;
 	default:
+		splx(s);
 		return EOPNOTSUPP;
 	}
 	splx(s);
@@ -1983,6 +1984,7 @@ cmalo_cmd_response(struct malo_softc *sc
 	if (psize > MALO_CMD_BUFFER_SIZE) {
 		aprint_error_dev(sc->sc_dev,
 		"command response too large: %dbyte\n", psize);
+		splx(s);
 		return EIO;
 	}
 



CVS commit: src/sys/dev/ieee1394

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:39:27 UTC 2017

Modified Files:
src/sys/dev/ieee1394: fwdev.c

Log Message:
memory leak, found by Mootja; it seems that we should check the return
value of 'fw_bindadd' in several other places, but whatever


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/ieee1394/fwdev.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/ieee1394/fwdev.c
diff -u src/sys/dev/ieee1394/fwdev.c:1.31 src/sys/dev/ieee1394/fwdev.c:1.32
--- src/sys/dev/ieee1394/fwdev.c:1.31	Sun Nov 20 22:47:39 2016
+++ src/sys/dev/ieee1394/fwdev.c	Sun Jun 25 12:39:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $	*/
+/*	$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $	*/
 /*-
  * Copyright (c) 2003 Hidetoshi Shimokawa
  * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.31 2016/11/20 22:47:39 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fwdev.c,v 1.32 2017/06/25 12:39:27 maxv Exp $");
 
 #include 
 #include 
@@ -614,6 +614,8 @@ out:
 			/* XXX */
 			PAGE_SIZE, PAGE_SIZE, 5, fc, (void *)fwb, fw_hand);
 			STAILQ_INSERT_TAIL(>binds, fwb, chlist);
+		} else {
+			free(fwb, M_FW);
 		}
 		break;
 



CVS commit: src/sys/dev

2017-06-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jun 25 09:42:40 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Don't start playback or recording on the hw ring only stream ring buffers.


To generate a diff of this commit:
cvs rdiff -u -r1.364 -r1.365 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.364 src/sys/dev/audio.c:1.365
--- src/sys/dev/audio.c:1.364	Sun Jun 25 02:47:28 2017
+++ src/sys/dev/audio.c	Sun Jun 25 09:42:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.364 2017/06/25 02:47:28 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.365 2017/06/25 09:42:40 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.364 2017/06/25 02:47:28 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.365 2017/06/25 09:42:40 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3485,6 +3485,7 @@ int
 audiostartr(struct audio_softc *sc, struct virtual_channel *vc)
 {
 
+	struct audio_chan *chan;
 	int error;
 
 	KASSERT(mutex_owned(sc->sc_lock));
@@ -3493,8 +3494,11 @@ audiostartr(struct audio_softc *sc, stru
 		 vc->sc_mrr.s.start, audio_stream_get_used(>sc_mrr.s),
 		 vc->sc_mrr.usedhigh, vc->sc_mrr.mmapped));
 
+	chan = SIMPLEQ_FIRST(>sc_audiochan);
 	if (!audio_can_capture(sc))
 		return EINVAL;
+	if (vc == chan->vc)
+		return 0;
 
 	error = 0;
 	if (sc->sc_rec_started == false) {
@@ -3525,6 +3529,8 @@ audiostartp(struct audio_softc *sc, stru
 
 	if (!audio_can_playback(sc))
 		return EINVAL;
+	if (vc == chan->vc)
+		return 0;
 
 	if (!vc->sc_mpr.mmapped && used < vc->sc_mpr.blksize) {
 		cv_broadcast(>sc_wchan);



CVS commit: src/sys/arch/x86/x86

2017-06-25 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jun 25 12:42:40 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Page tables are not writable under Xen, so we can't memcpy() to them.
Rewite to do the copy using pmap_pte_set() in the Xen case.


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 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.252 src/sys/arch/x86/x86/pmap.c:1.253
--- src/sys/arch/x86/x86/pmap.c:1.252	Fri Jun 23 23:40:00 2017
+++ src/sys/arch/x86/x86/pmap.c	Sun Jun 25 12:42:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.252 2017/06/23 23:40:00 jdolecek Exp $	*/
+/*	$NetBSD: pmap.c,v 1.253 2017/06/25 12:42:40 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.252 2017/06/23 23:40:00 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.253 2017/06/25 12:42:40 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4399,8 +4399,8 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	struct pmap *cpm;
 #if !defined(XEN) || !defined(__x86_64__)
 	struct pmap *pm;
-#endif
 	long old;
+#endif
 	int s, i;
 	long needed_kptp[PTP_LEVELS], target_nptp;
 	bool invalidate = false;
@@ -4415,7 +4415,9 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	}
 
 	maxkvaddr = x86_round_pdr(maxkvaddr);
+#if !defined(XEN) || !defined(__x86_64__)
 	old = nkptp[PTP_LEVELS - 1];
+#endif
 
 	/* Initialize needed_kptp. */
 	for (i = PTP_LEVELS - 1; i >= 1; i--) {
@@ -4428,12 +4430,17 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		needed_kptp[i] = target_nptp - nkptp[i];
 	}
 
+#if defined(XEN) && defined(__x86_64__)
+	/* only pmap_kernel() has kernel entries */
+	cpm = kpm;
+#else
 	/* Get the current pmap */
 	if (__predict_true(cpu_info_primary.ci_flags & CPUF_PRESENT)) {
 		cpm = curcpu()->ci_pmap;
 	} else {
 		cpm = kpm;
 	}
+#endif
 
 	pmap_alloc_level(cpm, pmap_maxkvaddr, needed_kptp);
 
@@ -4441,22 +4448,23 @@ pmap_growkernel(vaddr_t maxkvaddr)
 	 * If the number of top level entries changed, update all pmaps.
 	 */
 	if (needed_kptp[PTP_LEVELS - 1] != 0) {
-		size_t newpdes;
-		newpdes = nkptp[PTP_LEVELS - 1] - old;
-
-		if (cpm != kpm) {
-			memcpy(>pm_pdir[PDIR_SLOT_KERN + old],
-			>pm_pdir[PDIR_SLOT_KERN + old],
-			newpdes * sizeof(pd_entry_t));
-		}
-
 #ifdef XEN
 #ifdef __x86_64__
 		/* nothing, kernel entries are never entered in user pmap */
 #else /* __x86_64__ */
+		int pdkidx;
+		if (cpm != kpm) {
+			for (pdkidx = PDIR_SLOT_KERN + old;
+			pdkidx < PDIR_SLOT_KERN + nkptp[PTP_LEVELS - 1];
+			pdkidx++) {
+pmap_pte_set(>pm_pdir[pdkidx],
+cpm->pm_pdir[pdkidx]);
+			}
+			pmap_pte_flush();
+		}
+
 		mutex_enter(_lock);
 		LIST_FOREACH(pm, , pm_list) {
-			int pdkidx;
 			for (pdkidx = PDIR_SLOT_KERN + old;
 			pdkidx < PDIR_SLOT_KERN + nkptp[PTP_LEVELS - 1];
 			pdkidx++) {
@@ -4468,6 +4476,14 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		mutex_exit(_lock);
 #endif /* __x86_64__ */
 #else /* XEN */
+		size_t newpdes;
+		newpdes = nkptp[PTP_LEVELS - 1] - old;
+		if (cpm != kpm) {
+			memcpy(>pm_pdir[PDIR_SLOT_KERN + old],
+			>pm_pdir[PDIR_SLOT_KERN + old],
+			newpdes * sizeof(pd_entry_t));
+		}
+
 		mutex_enter(_lock);
 		LIST_FOREACH(pm, , pm_list) {
 			memcpy(>pm_pdir[PDIR_SLOT_KERN + old],



CVS commit: src/sys/arch/ia64/stand/ia64/ski

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:04:37 UTC 2017

Modified Files:
src/sys/arch/ia64/stand/ia64/ski: devicename.c

Log Message:
uninitialized variable, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/ia64/stand/ia64/ski/devicename.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/ia64/stand/ia64/ski/devicename.c
diff -u src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.8 src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.9
--- src/sys/arch/ia64/stand/ia64/ski/devicename.c:1.8	Mon Aug 15 09:06:39 2016
+++ src/sys/arch/ia64/stand/ia64/ski/devicename.c	Sun Jun 25 12:04:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: devicename.c,v 1.8 2016/08/15 09:06:39 maxv Exp $	*/
+/*	$NetBSD: devicename.c,v 1.9 2017/06/25 12:04:37 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1998 Michael Smith 
@@ -236,8 +236,7 @@ ski_fmtdev(void *vdev)
 		break;
 
 	case DEVT_NET:
-		/* XXX XXX XXX: Yay, 'len' is not initialized here */
-		snprintf(buf, buflen - len, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
+		snprintf(buf, buflen, "%s%d:", dev->d_dev->dv_name, dev->d_kind.netif.unit);
 		break;
 	}
 	return(buf);



CVS commit: src/sys/arch/acorn32/podulebus

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:07:23 UTC 2017

Modified Files:
src/sys/arch/acorn32/podulebus: if_ie.c

Log Message:
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/acorn32/podulebus/if_ie.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/acorn32/podulebus/if_ie.c
diff -u src/sys/arch/acorn32/podulebus/if_ie.c:1.39 src/sys/arch/acorn32/podulebus/if_ie.c:1.40
--- src/sys/arch/acorn32/podulebus/if_ie.c:1.39	Wed Feb 22 09:45:15 2017
+++ src/sys/arch/acorn32/podulebus/if_ie.c	Sun Jun 25 12:07:23 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.39 2017/02/22 09:45:15 nonaka Exp $ */
+/* $NetBSD: if_ie.c,v 1.40 2017/06/25 12:07:23 maxv Exp $ */
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.39 2017/02/22 09:45:15 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ie.c,v 1.40 2017/06/25 12:07:23 maxv Exp $");
 
 #define IGNORE_ETHER1_IDROM_CHECKSUM
 
@@ -616,7 +616,7 @@ ieioctl(struct ifnet *ifp, unsigned long
 
 	case SIOCSIFFLAGS:
 	if ((error = ifioctl_common(ifp, cmd, data)) != 0)
-		return error;
+		break;
 	sc->promisc = ifp->if_flags & ( IFF_PROMISC | IFF_ALLMULTI );
 
 	if ( IZCLR(ifp,IFF_UP) && IZSET(ifp,IFF_RUNNING) )



CVS commit: src/sys/dev/hpc

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:21:00 UTC 2017

Modified Files:
src/sys/dev/hpc: hpcapm.c

Log Message:
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/hpc/hpcapm.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/hpc/hpcapm.c
diff -u src/sys/dev/hpc/hpcapm.c:1.20 src/sys/dev/hpc/hpcapm.c:1.21
--- src/sys/dev/hpc/hpcapm.c:1.20	Sat Nov  9 21:31:56 2013
+++ src/sys/dev/hpc/hpcapm.c	Sun Jun 25 12:21:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $	*/
+/*	$NetBSD: hpcapm.c,v 1.21 2017/06/25 12:21:00 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000 Takemura Shin
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.20 2013/11/09 21:31:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpcapm.c,v 1.21 2017/06/25 12:21:00 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcapm.h"
@@ -415,6 +415,8 @@ hpcapm_get_event(void *scx, u_int *event
 sc->power_state = APM_SYS_READY;
 			} else
 *event_info = 0;
+			splx(s);
+
 			return (0);
 		}
 	}



CVS commit: src/sys/arch/arm/gemini

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:44:04 UTC 2017

Modified Files:
src/sys/arch/arm/gemini: if_gpn.c

Log Message:
NULL deref, found by Mootja; not sure how to fix it, so just add a big XXX


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/gemini/if_gpn.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/gemini/if_gpn.c
diff -u src/sys/arch/arm/gemini/if_gpn.c:1.7 src/sys/arch/arm/gemini/if_gpn.c:1.8
--- src/sys/arch/arm/gemini/if_gpn.c:1.7	Thu Dec 15 09:28:02 2016
+++ src/sys/arch/arm/gemini/if_gpn.c	Sun Jun 25 12:44:04 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gpn.c,v 1.7 2016/12/15 09:28:02 ozaki-r Exp $ */
+/* $NetBSD: if_gpn.c,v 1.8 2017/06/25 12:44:04 maxv Exp $ */
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include "opt_gemini.h"
 
-__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.7 2016/12/15 09:28:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gpn.c,v 1.8 2017/06/25 12:44:04 maxv Exp $");
 
 #include 
 #include 
@@ -471,7 +471,12 @@ gpn_ifstart(struct ifnet *ifp)
 			ifp->if_obytes += m->m_len;
 		}
 		ifp->if_opackets++;
+
+		/*
+		 * XXX XXX 'last_gd' could be NULL
+		 */
 		last_gd->gd_subtype |= GPN_EOF;
+
 		sc->sc_txactive++;
 		sc->sc_free--;
 		gemini_ipm_produce(last_gd, 1);



CVS commit: src/sys/arch/bebox/stand/boot

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:15:04 UTC 2017

Modified Files:
src/sys/arch/bebox/stand/boot: siop.c

Log Message:
uninitialized var, found by Mootja; don't know which value to put, so add
a big XXX


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/bebox/stand/boot/siop.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/bebox/stand/boot/siop.c
diff -u src/sys/arch/bebox/stand/boot/siop.c:1.5 src/sys/arch/bebox/stand/boot/siop.c:1.6
--- src/sys/arch/bebox/stand/boot/siop.c:1.5	Fri Dec 12 15:57:30 2014
+++ src/sys/arch/bebox/stand/boot/siop.c	Sun Jun 25 12:15:04 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: siop.c,v 1.5 2014/12/12 15:57:30 phx Exp $	*/
+/*	$NetBSD: siop.c,v 1.6 2017/06/25 12:15:04 maxv Exp $	*/
 /*
  * Copyright (c) 2010 KIYOHARA Takashi
  * All rights reserved.
@@ -993,6 +993,7 @@ scsi_interpret_sense(struct siop_adapter
 			error = 0;
 			break;
 		case SKEY_ABORTED_COMMAND:
+			/* XXX XXX initialize 'error' */
 			break;
 		case SKEY_VOLUME_OVERFLOW:
 			error = ENOSPC;



CVS commit: [netbsd-8] src/sys/dev/pci

2017-06-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jun 25 06:29:25 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: mvsata_pci.c siisata_pci.c

Log Message:
Pull up following revision(s) (requested by jdolecek in ticket #56):
sys/dev/pci/mvsata_pci.c: revision 1.9
sys/dev/pci/siisata_pci.c: revision 1.16
switch to pci_intr_establish_xname()


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.22.1 src/sys/dev/pci/mvsata_pci.c
cvs rdiff -u -r1.14.10.1 -r1.14.10.2 src/sys/dev/pci/siisata_pci.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/mvsata_pci.c
diff -u src/sys/dev/pci/mvsata_pci.c:1.8 src/sys/dev/pci/mvsata_pci.c:1.8.22.1
--- src/sys/dev/pci/mvsata_pci.c:1.8	Sat Mar 29 19:28:25 2014
+++ src/sys/dev/pci/mvsata_pci.c	Sun Jun 25 06:29:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata_pci.c,v 1.8 2014/03/29 19:28:25 christos Exp $	*/
+/*	$NetBSD: mvsata_pci.c,v 1.8.22.1 2017/06/25 06:29:25 snj Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.8 2014/03/29 19:28:25 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata_pci.c,v 1.8.22.1 2017/06/25 06:29:25 snj Exp $");
 
 #include 
 #include 
@@ -194,8 +194,8 @@ mvsata_pci_attach(device_t parent, devic
 		return;
 	}
 	intrstr = pci_intr_string(psc->psc_pc, intrhandle, intrbuf, sizeof(intrbuf));
-	psc->psc_ih = pci_intr_establish(psc->psc_pc, intrhandle, IPL_BIO,
-	mvsata_pci_intr, sc);
+	psc->psc_ih = pci_intr_establish_xname(psc->psc_pc, intrhandle, IPL_BIO,
+	mvsata_pci_intr, sc, device_xname(self));
 	if (psc->psc_ih == NULL) {
 		aprint_error_dev(self, "couldn't establish interrupt\n");
 		return;

Index: src/sys/dev/pci/siisata_pci.c
diff -u src/sys/dev/pci/siisata_pci.c:1.14.10.1 src/sys/dev/pci/siisata_pci.c:1.14.10.2
--- src/sys/dev/pci/siisata_pci.c:1.14.10.1	Sun Jun 25 06:22:57 2017
+++ src/sys/dev/pci/siisata_pci.c	Sun Jun 25 06:29:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata_pci.c,v 1.14.10.1 2017/06/25 06:22:57 snj Exp $ */
+/* $NetBSD: siisata_pci.c,v 1.14.10.2 2017/06/25 06:29:25 snj Exp $ */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.14.10.1 2017/06/25 06:22:57 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata_pci.c,v 1.14.10.2 2017/06/25 06:29:25 snj Exp $");
 
 #include 
 #include 
@@ -217,8 +217,8 @@ siisata_pci_attach(device_t parent, devi
 	}
 	intrstr = pci_intr_string(pa->pa_pc, intrhandle, intrbuf,
 	sizeof(intrbuf));
-	psc->sc_ih = pci_intr_establish(pa->pa_pc, intrhandle,
-	IPL_BIO, siisata_intr, sc);
+	psc->sc_ih = pci_intr_establish_xname(pa->pa_pc, intrhandle,
+	IPL_BIO, siisata_intr, sc, device_xname(self));
 	if (psc->sc_ih == NULL) {
 		bus_space_unmap(sc->sc_grt, sc->sc_grh, grsize);
 		bus_space_unmap(sc->sc_prt, sc->sc_prh, prsize);



CVS commit: [netbsd-8] src/sys/net

2017-06-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jun 25 06:31:58 UTC 2017

Modified Files:
src/sys/net [netbsd-8]: route.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #57):
sys/net/route.c: revision 1.195
Fix locking in rtalloc1 (affected only if NET_MPSAFE)


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.194.6.1 src/sys/net/route.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/route.c
diff -u src/sys/net/route.c:1.194 src/sys/net/route.c:1.194.6.1
--- src/sys/net/route.c:1.194	Fri Mar 24 03:45:02 2017
+++ src/sys/net/route.c	Sun Jun 25 06:31:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.194 2017/03/24 03:45:02 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.194.6.1 2017/06/25 06:31:58 snj Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194 2017/03/24 03:45:02 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.194.6.1 2017/06/25 06:31:58 snj Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -280,7 +280,7 @@ static void rtcache_invalidate(struct do
 static void rt_ref(struct rtentry *);
 
 static struct rtentry *
-rtalloc1_locked(const struct sockaddr *, int, bool);
+rtalloc1_locked(const struct sockaddr *, int, bool, bool);
 static struct rtentry *
 rtcache_validate_locked(struct route *);
 static void rtcache_free_locked(struct route *);
@@ -557,7 +557,8 @@ dump_rt(const struct rtentry *rt)
  * will be incremented. The caller has to rtfree it by itself.
  */
 struct rtentry *
-rtalloc1_locked(const struct sockaddr *dst, int report, bool wait_ok)
+rtalloc1_locked(const struct sockaddr *dst, int report, bool wait_ok,
+bool wlock)
 {
 	rtbl_t *rtbl;
 	struct rtentry *rt;
@@ -599,6 +600,10 @@ retry:
 
 		if (need_lock)
 			RTCACHE_WLOCK();
+		if (wlock)
+			RT_WLOCK();
+		else
+			RT_RLOCK();
 		goto retry;
 	}
 #endif /* NET_MPSAFE */
@@ -627,7 +632,7 @@ rtalloc1(const struct sockaddr *dst, int
 	struct rtentry *rt;
 
 	RT_RLOCK();
-	rt = rtalloc1_locked(dst, report, true);
+	rt = rtalloc1_locked(dst, report, true, false);
 	RT_UNLOCK();
 
 	return rt;
@@ -1026,7 +1031,7 @@ ifa_ifwithroute_psref(int flags, const s
 
 		/* XXX we cannot call rtalloc1 if holding the rt lock */
 		if (RT_LOCKED())
-			rt = rtalloc1_locked(gateway, 0, true);
+			rt = rtalloc1_locked(gateway, 0, true, true);
 		else
 			rt = rtalloc1(gateway, 0);
 		if (rt == NULL)
@@ -1387,7 +1392,7 @@ rt_setgate(struct rtentry *rt, const str
 
 		/* XXX we cannot call rtalloc1 if holding the rt lock */
 		if (RT_LOCKED())
-			gwrt = rtalloc1_locked(gate, 1, false);
+			gwrt = rtalloc1_locked(gate, 1, false, true);
 		else
 			gwrt = rtalloc1(gate, 1);
 		/*



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

2017-06-25 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Jun 25 06:26:40 UTC 2017

Modified Files:
src/sys/arch/x68k/dev: vs.c vsvar.h

Log Message:
Avoid panic when the device is closed when not playing.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x68k/dev/vsvar.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/arch/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.37 src/sys/arch/x68k/dev/vs.c:1.38
--- src/sys/arch/x68k/dev/vs.c:1.37	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x68k/dev/vs.c	Sun Jun 25 06:26:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.37 2017/06/01 02:45:08 chs Exp $	*/
+/*	$NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.37 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.38 2017/06/25 06:26:40 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -232,6 +232,7 @@ vs_attach(device_t parent, device_t self
 	sc->sc_hw_if = _hw_if;
 	sc->sc_addr = (void *) ia->ia_addr;
 	sc->sc_dmas = NULL;
+	sc->sc_active = 0;
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
 
@@ -542,6 +543,7 @@ vs_trigger_output(void *hdl, void *start
 	dmac_load_xfer(chan->ch_softc, xf);
 	dmac_start_xfer_offset(chan->ch_softc, xf, 0, sc->sc_current.blksize);
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 2);
+	sc->sc_active = 1;
 
 	return 0;
 }
@@ -589,6 +591,7 @@ vs_trigger_input(void *hdl, void *start,
 	dmac_load_xfer(chan->ch_softc, xf);
 	dmac_start_xfer_offset(chan->ch_softc, xf, 0, sc->sc_current.blksize);
 	bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 4);
+	sc->sc_active = 1;
 
 	return 0;
 }
@@ -600,9 +603,12 @@ vs_halt_output(void *hdl)
 
 	DPRINTF(1, ("vs_halt_output\n"));
 	sc = hdl;
-	/* stop ADPCM play */
-	dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+	if (sc->sc_active) {
+		/* stop ADPCM play */
+		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+		sc->sc_active = 0;
+	}
 
 	return 0;
 }
@@ -614,9 +620,12 @@ vs_halt_input(void *hdl)
 
 	DPRINTF(1, ("vs_halt_input\n"));
 	sc = hdl;
-	/* stop ADPCM recoding */
-	dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-	bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+	if (sc->sc_active) {
+		/* stop ADPCM recoding */
+		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+		bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+		sc->sc_active = 0;
+	}
 
 	return 0;
 }

Index: src/sys/arch/x68k/dev/vsvar.h
diff -u src/sys/arch/x68k/dev/vsvar.h:1.11 src/sys/arch/x68k/dev/vsvar.h:1.12
--- src/sys/arch/x68k/dev/vsvar.h:1.11	Wed Nov 23 23:07:30 2011
+++ src/sys/arch/x68k/dev/vsvar.h	Sun Jun 25 06:26:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsvar.h,v 1.11 2011/11/23 23:07:30 jmcneill Exp $	*/
+/*	$NetBSD: vsvar.h,v 1.12 2017/06/25 06:26:40 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -94,6 +94,7 @@ struct vs_softc {
 		int bufsize, blksize;
 		int dmap;
 	} sc_current;
+	int sc_active;
 
 	const struct audio_hw_if *sc_hw_if;
 



CVS commit: src/sys/dev

2017-06-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jun 25 10:28:23 UTC 2017

Modified Files:
src/sys/dev: audio.c

Log Message:
Don't autoconfig for 24 bits precision.  It does not work as yet.


To generate a diff of this commit:
cvs rdiff -u -r1.365 -r1.366 src/sys/dev/audio.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/audio.c
diff -u src/sys/dev/audio.c:1.365 src/sys/dev/audio.c:1.366
--- src/sys/dev/audio.c:1.365	Sun Jun 25 09:42:40 2017
+++ src/sys/dev/audio.c	Sun Jun 25 10:28:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.365 2017/06/25 09:42:40 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.366 2017/06/25 10:28:22 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss 
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.365 2017/06/25 09:42:40 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.366 2017/06/25 10:28:22 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -447,7 +447,7 @@ const struct audio_params audio_default 
 	.channels = 1,
 };
 
-int auto_config_precision[] = { 32, 24, 16, 8 };
+int auto_config_precision[] = { 32, 16, 8 };
 int auto_config_channels[] = { 32, 24, 16, 8, 6, 4, 2, 1};
 int auto_config_freq[] = { 48000, 44100, 96000, 192000, 32000,
 			   22050, 16000, 11025, 8000, 4000 };



CVS commit: src/sys/dev/ic

2017-06-25 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jun 25 09:40:17 UTC 2017

Modified Files:
src/sys/dev/ic: am7930.c

Log Message:
Set hw parameters for linear to ulaw filters.

Tested by flxd@.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/ic/am7930.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/ic/am7930.c
diff -u src/sys/dev/ic/am7930.c:1.54 src/sys/dev/ic/am7930.c:1.55
--- src/sys/dev/ic/am7930.c:1.54	Sun Jun 25 02:09:47 2017
+++ src/sys/dev/ic/am7930.c	Sun Jun 25 09:40:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: am7930.c,v 1.54 2017/06/25 02:09:47 nat Exp $	*/
+/*	$NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $	*/
 
 /*
  * Copyright (c) 1995 Rolf Grossmann
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.54 2017/06/25 02:09:47 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: am7930.c,v 1.55 2017/06/25 09:40:17 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -242,6 +242,12 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(pfil, sc->sc_glue->output_conv, );
 		}
+		if (p->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *p;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			pfil->append(pfil, linear8_to_mulaw, );
+		}
+
 	}
 	if ((usemode & AUMODE_RECORD) == AUMODE_RECORD) {
 		if (r->sample_rate < 7500 || r->sample_rate > 8500 ||
@@ -257,14 +263,11 @@ am7930_set_params(void *addr, int setmod
 			hw.precision *= sc->sc_glue->factor;
 			pfil->append(rfil, sc->sc_glue->input_conv, );
 		}
-	}
-
-	if (p->encoding == AUDIO_ENCODING_SLINEAR ||
-	r->encoding == AUDIO_ENCODING_SLINEAR) {
-		hw.encoding = AUDIO_ENCODING_ULAW;
-		pfil->req_size = rfil->req_size = 0;
-		rfil->append(rfil, mulaw_to_linear8, );
-		pfil->append(pfil, linear8_to_mulaw, );
+		if (r->encoding == AUDIO_ENCODING_SLINEAR) {
+			hw = *r;
+			hw.encoding = AUDIO_ENCODING_ULAW;
+			rfil->append(rfil, mulaw_to_linear8, );
+		}
 	}
 
 	return 0;



CVS commit: src/sys/arch/arm/imx

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:11:30 UTC 2017

Modified Files:
src/sys/arch/arm/imx: imx51_ipuv3.c

Log Message:
memory leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/imx51_ipuv3.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/imx/imx51_ipuv3.c
diff -u src/sys/arch/arm/imx/imx51_ipuv3.c:1.4 src/sys/arch/arm/imx/imx51_ipuv3.c:1.5
--- src/sys/arch/arm/imx/imx51_ipuv3.c:1.4	Mon Dec 21 04:26:28 2015
+++ src/sys/arch/arm/imx/imx51_ipuv3.c	Sun Jun 25 12:11:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $	*/
+/*	$NetBSD: imx51_ipuv3.c,v 1.5 2017/06/25 12:11:30 maxv Exp $	*/
 
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.5 2017/06/25 12:11:30 maxv Exp $");
 
 #include "opt_imx51_ipuv3.h"
 
@@ -949,6 +949,7 @@ imx51_ipuv3_new_screen(struct imx51_ipuv
 		aprint_error_dev(sc->dev,
 		"failed to allocate %u bytes of video memory: %d\n",
 		scr->stride * height, error);
+		free(scr, M_DEVBUF);
 		return error;
 	}
 



CVS commit: src/sys/dev/ata

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:29:32 UTC 2017

Modified Files:
src/sys/dev/ata: ata_raid_subr.c

Log Message:
dumb instruction


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ata/ata_raid_subr.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/ata/ata_raid_subr.c
diff -u src/sys/dev/ata/ata_raid_subr.c:1.2 src/sys/dev/ata/ata_raid_subr.c:1.3
--- src/sys/dev/ata/ata_raid_subr.c:1.2	Thu Jun 24 13:03:08 2010
+++ src/sys/dev/ata/ata_raid_subr.c	Sun Jun 25 12:29:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ata_raid_subr.c,v 1.2 2010/06/24 13:03:08 hannken Exp $ */
+/* $NetBSD: ata_raid_subr.c,v 1.3 2017/06/25 12:29:32 maxv Exp $ */
 
 /*-
  * Copyright (c) 2008 Juan Romero Pardines.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata_raid_subr.c,v 1.2 2010/06/24 13:03:08 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata_raid_subr.c,v 1.3 2017/06/25 12:29:32 maxv Exp $");
 
 #include 
 #include 
@@ -72,7 +72,6 @@ ata_raid_disk_vnode_find(struct ataraid_
 			return adv->adv_vnode;
 	}
 
-	adv = NULL;
 	adv = kmem_zalloc(sizeof(struct ataraid_disk_vnode), KM_SLEEP);
 
 	bmajor = devsw_name2blk(device_xname(adi->adi_dev), NULL, 0);



CVS commit: src/sys/dev/ppbus

2017-06-25 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jun 25 12:27:13 UTC 2017

Modified Files:
src/sys/dev/ppbus: if_plip.c

Log Message:
spl leak, found by Mootja


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/ppbus/if_plip.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/ppbus/if_plip.c
diff -u src/sys/dev/ppbus/if_plip.c:1.27 src/sys/dev/ppbus/if_plip.c:1.28
--- src/sys/dev/ppbus/if_plip.c:1.27	Sun May  8 03:11:33 2016
+++ src/sys/dev/ppbus/if_plip.c	Sun Jun 25 12:27:13 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_plip.c,v 1.27 2016/05/08 03:11:33 christos Exp $ */
+/* $NetBSD: if_plip.c,v 1.28 2017/06/25 12:27:13 maxv Exp $ */
 
 /*-
  * Copyright (c) 1997 Poul-Henning Kamp
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.27 2016/05/08 03:11:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_plip.c,v 1.28 2017/06/25 12:27:13 maxv Exp $");
 
 /*
  * Parallel port TCP/IP interfaces added.  I looked at the driver from
@@ -445,6 +445,7 @@ lpioctl(struct ifnet *ifp, u_long cmd, v
 		case AF_INET:
 			break;
 		default:
+			splx(s);
 			return EAFNOSUPPORT;
 		}
 		break;



CVS commit: src/sys/arch/x86/x86

2017-06-25 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jun 25 22:16:46 UTC 2017

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Xen/i386PAE is special, in that top-level entries are not in per-pmap
tables but per-CPU pages. pmap_alloc_level() takes care of making new
entries actives when the kernel pmap is updated, so always use pmap_kernel()
is this case too.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 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.253 src/sys/arch/x86/x86/pmap.c:1.254
--- src/sys/arch/x86/x86/pmap.c:1.253	Sun Jun 25 12:42:40 2017
+++ src/sys/arch/x86/x86/pmap.c	Sun Jun 25 22:16:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.253 2017/06/25 12:42:40 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.254 2017/06/25 22:16:46 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.253 2017/06/25 12:42:40 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.254 2017/06/25 22:16:46 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -4430,8 +4430,8 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		needed_kptp[i] = target_nptp - nkptp[i];
 	}
 
-#if defined(XEN) && defined(__x86_64__)
-	/* only pmap_kernel() has kernel entries */
+#if defined(XEN) && (defined(__x86_64__) || defined(PAE))
+	/* only pmap_kernel(), or the per-cpu map, has kernel entries */
 	cpm = kpm;
 #else
 	/* Get the current pmap */
@@ -4453,6 +4453,11 @@ pmap_growkernel(vaddr_t maxkvaddr)
 		/* nothing, kernel entries are never entered in user pmap */
 #else /* __x86_64__ */
 		int pdkidx;
+#ifndef PAE
+		/*
+		 * for PAE this is not needed, because pmap_alloc_level()
+		 * already did update the per-CPU tables
+		 */
 		if (cpm != kpm) {
 			for (pdkidx = PDIR_SLOT_KERN + old;
 			pdkidx < PDIR_SLOT_KERN + nkptp[PTP_LEVELS - 1];
@@ -4462,6 +4467,7 @@ pmap_growkernel(vaddr_t maxkvaddr)
 			}
 			pmap_pte_flush();
 		}
+#endif /* !PAE */
 
 		mutex_enter(_lock);
 		LIST_FOREACH(pm, , pm_list) {



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

2017-06-25 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jun 25 20:22:32 UTC 2017

Modified Files:
src/sys/arch/i386/conf: kern.ldscript.Xen

Log Message:
Restore alignement of _end to rev 1.12: this is where the Xen loader
puts the symbol table and should not be changed (maybe we should change
this symbol name).
keep kernel_end PAGE-aligned.
Makes ddb work again on Xen/i386


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/i386/conf/kern.ldscript.Xen

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/i386/conf/kern.ldscript.Xen
diff -u src/sys/arch/i386/conf/kern.ldscript.Xen:1.13 src/sys/arch/i386/conf/kern.ldscript.Xen:1.14
--- src/sys/arch/i386/conf/kern.ldscript.Xen:1.13	Tue Aug  2 14:03:34 2016
+++ src/sys/arch/i386/conf/kern.ldscript.Xen	Sun Jun 25 20:22:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern.ldscript.Xen,v 1.13 2016/08/02 14:03:34 maxv Exp $	*/
+/*	$NetBSD: kern.ldscript.Xen,v 1.14 2017/06/25 20:22:32 bouyer Exp $	*/
 
 #include "assym.h"
 
@@ -54,14 +54,15 @@ SECTIONS
 		*(COMMON)
 		. = ALIGN(32 / 8);
 	}
+	. = ALIGN(32 / 8);
+	_end = . ;
+	PROVIDE (end = .) ;
 
 	. = ALIGN(__PAGE_SIZE);
 
 	/* End of the kernel image */
 	__kernel_end = . ;
 
-	_end = . ;
-	PROVIDE (end = .) ;
 	.note.netbsd.ident :
 	{
 		KEEP(*(.note.netbsd.ident));



CVS commit: [netbsd-8] src/doc

2017-06-25 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sun Jun 25 06:34:38 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
55-57


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.12 src/doc/CHANGES-8.0:1.1.2.13
--- src/doc/CHANGES-8.0:1.1.2.12	Thu Jun 22 05:38:03 2017
+++ src/doc/CHANGES-8.0	Sun Jun 25 06:34:38 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.12 2017/06/22 05:38:03 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.13 2017/06/25 06:34:38 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -1412,3 +1412,23 @@ sys/opencrypto/cryptodev.h			1.35, 1.36
 	Fix opencrypto locking.
 	[christos/knakahara, ticket #37]
 
+share/man/man4/siisata.4			1.6
+sys/dev/pci/pcidevs1.1291
+sys/dev/pci/pcidevs.hregen
+sys/dev/pci/pcidevs_data.h			regen
+sys/dev/pci/siisata_pci.c			1.15
+
+	siisata(4): Add Adaptec 1220SA support.
+	[jdolecek, ticket #55]
+
+sys/dev/pci/mvsata_pci.c			1.9
+sys/dev/pci/siisata_pci.c			1.16
+
+	switch to pci_intr_establish_xname()
+	[jdolecek, ticket #56]
+
+sys/net/route.c	1.195
+
+	Fix locking in rtalloc1 (affected only if NET_MPSAFE)
+	[ozaki-r, ticket #57]
+



CVS commit: src/sys/dev/pci

2017-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 26 04:18:14 UTC 2017

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

Log Message:
 Add missing "else" in wm_nvm_release().


To generate a diff of this commit:
cvs rdiff -u -r1.515 -r1.516 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.515 src/sys/dev/pci/if_wm.c:1.516
--- src/sys/dev/pci/if_wm.c:1.515	Mon Jun 26 04:15:06 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 26 04:18:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.516 2017/06/26 04:18:14 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.516 2017/06/26 04:18:14 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -12079,7 +12079,7 @@ wm_nvm_release(struct wm_softc *sc)
 		wm_put_nvm_ich8lan(sc);
 	} else if (sc->sc_flags & WM_F_LOCK_EXTCNF)
 		wm_put_swfwhw_semaphore(sc);
-	if (sc->sc_flags & WM_F_LOCK_SWFW)
+	else if (sc->sc_flags & WM_F_LOCK_SWFW)
 		wm_put_swfw_semaphore(sc, SWFW_EEP_SM);
 	else if (sc->sc_flags & WM_F_LOCK_SWSM)
 		wm_put_swsm_semaphore(sc);



CVS commit: src/sys/opencrypto

2017-06-25 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jun 26 05:34:49 UTC 2017

Modified Files:
src/sys/opencrypto: crypto.c

Log Message:
simplify mutex_enter/exit(crypto_q_mtx), and fix missing exit.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/opencrypto/crypto.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.90 src/sys/opencrypto/crypto.c:1.91
--- src/sys/opencrypto/crypto.c:1.90	Thu Jun 15 12:45:10 2017
+++ src/sys/opencrypto/crypto.c	Mon Jun 26 05:34:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.90 2017/06/15 12:45:10 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.91 2017/06/26 05:34:48 knakahara Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.90 2017/06/15 12:45:10 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.91 2017/06/26 05:34:48 knakahara Exp $");
 
 #include 
 #include 
@@ -1117,8 +1117,8 @@ crypto_dispatch(struct cryptop *crp)
 		 * to other drivers in cryptointr() later.
 		 */
 		TAILQ_INSERT_TAIL(_q, crp, crp_next);
-		mutex_exit(_q_mtx);
-		return 0;
+		result = 0;
+		goto out;
 	}
 
 	if (cap->cc_qblocked != 0) {
@@ -1128,8 +1128,8 @@ crypto_dispatch(struct cryptop *crp)
 		 * it unblocks and the swi thread gets kicked.
 		 */
 		TAILQ_INSERT_TAIL(_q, crp, crp_next);
-		mutex_exit(_q_mtx);
-		return 0;
+		result = 0;
+		goto out;
 	}
 
 	/*
@@ -1159,6 +1159,7 @@ crypto_dispatch(struct cryptop *crp)
 		result = 0;
 	}
 
+out:
 	mutex_exit(_q_mtx);
 	return result;
 }
@@ -1186,8 +1187,8 @@ crypto_kdispatch(struct cryptkop *krp)
 	 */
 	if (cap == NULL) {
 		TAILQ_INSERT_TAIL(_kq, krp, krp_next);
-		mutex_exit(_q_mtx);
-		return 0;
+		result = 0;
+		goto out;
 	}
 
 	if (cap->cc_kqblocked != 0) {
@@ -1197,8 +1198,8 @@ crypto_kdispatch(struct cryptkop *krp)
 		 * it unblocks and the swi thread gets kicked.
 		 */
 		TAILQ_INSERT_TAIL(_kq, krp, krp_next);
-		mutex_exit(_q_mtx);
-		return 0;
+		result = 0;
+		goto out;
 	}
 
 	crypto_driver_unlock(cap);
@@ -1214,7 +1215,6 @@ crypto_kdispatch(struct cryptkop *krp)
 		crypto_driver_unlock(cap);
 		TAILQ_INSERT_HEAD(_kq, krp, krp_next);
 		cryptostats.cs_kblocks++;
-		mutex_exit(_q_mtx);
 
 		/*
 		 * The krp is enqueued to crp_kq, that is,
@@ -1224,6 +1224,8 @@ crypto_kdispatch(struct cryptkop *krp)
 		result = 0;
 	}
 
+out:
+	mutex_exit(_q_mtx);
 	return result;
 }
 



CVS commit: src/sys/dev/pci

2017-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 26 04:15:06 UTC 2017

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

Log Message:
- Flush every MTA write. Same as Linux.
- Move the location of calling wm_set_filter. Same as some other OSes.
- Add CSR_WRITE_FLUSH() after writing WMREG_CTRL in wm_gmii_mediachange().


To generate a diff of this commit:
cvs rdiff -u -r1.514 -r1.515 src/sys/dev/pci/if_wm.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.514 src/sys/dev/pci/if_wm.c:1.515
--- src/sys/dev/pci/if_wm.c:1.514	Mon Jun 26 04:09:02 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 26 04:15:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.515 2017/06/26 04:15:06 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3386,8 +3386,10 @@ wm_set_filter(struct wm_softc *sc)
 	else
 		size = WM_MC_TABSIZE;
 	/* Clear out the multicast table. */
-	for (i = 0; i < size; i++)
+	for (i = 0; i < size; i++) {
 		CSR_WRITE(sc, mta_reg + (i << 2), 0);
+		CSR_WRITE_FLUSH(sc);
+	}
 
 	ETHER_LOCK(ec);
 	ETHER_FIRST_MULTI(step, ec, enm);
@@ -3429,9 +3431,13 @@ wm_set_filter(struct wm_softc *sc)
 			 */
 			bit = CSR_READ(sc, mta_reg + ((reg - 1) << 2));
 			CSR_WRITE(sc, mta_reg + (reg << 2), hash);
+			CSR_WRITE_FLUSH(sc);
 			CSR_WRITE(sc, mta_reg + ((reg - 1) << 2), bit);
-		} else
+			CSR_WRITE_FLUSH(sc);
+		} else {
 			CSR_WRITE(sc, mta_reg + (reg << 2), hash);
+			CSR_WRITE_FLUSH(sc);
+		}
 
 		ETHER_NEXT_MULTI(step, enm);
 	}
@@ -5524,9 +5530,6 @@ wm_init_locked(struct ifnet *ifp)
 		} else panic("wm_init: i82542 requires MCLBYTES = 2048");
 	}
 
-	/* Set the receive filter. */
-	wm_set_filter(sc);
-
 	/* Enable ECC */
 	switch (sc->sc_type) {
 	case WM_T_82571:
@@ -5561,6 +5564,9 @@ wm_init_locked(struct ifnet *ifp)
 		}
 	}
 
+	/* Set the receive filter. */
+	wm_set_filter(sc);
+
 	wm_turnon(sc);
 
 	/* Start the one second link check clock. */
@@ -9442,6 +9448,7 @@ wm_gmii_mediachange(struct ifnet *ifp)
 		}
 	}
 	CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+	CSR_WRITE_FLUSH(sc);
 	if (sc->sc_type <= WM_T_82543)
 		wm_gmii_reset(sc);
 



CVS commit: src/sys/dev/pci

2017-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 26 04:22:47 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
- Make new wm_phy_post_reset() and use this function at all location after
  reseting phy.
- Move the location of calling wm_get_hw_control. Same as Linux.
- Add I219 specific wokaround for legacy interrupt. From OpenBSD.
- Move the location of calling wm_lplu_d0_disable().
- Fix latency calculation in wm_platform_pm_pch_lpt().
- Set OBFF water mark and enable OBFF on PCH_LPT and newer.


To generate a diff of this commit:
cvs rdiff -u -r1.516 -r1.517 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/pci/if_wmreg.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.516 src/sys/dev/pci/if_wm.c:1.517
--- src/sys/dev/pci/if_wm.c:1.516	Mon Jun 26 04:18:14 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 26 04:22:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.516 2017/06/26 04:18:14 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.517 2017/06/26 04:22:46 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.516 2017/06/26 04:18:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.517 2017/06/26 04:22:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -679,6 +679,7 @@ static void	wm_set_pcie_completion_timeo
 static void	wm_get_auto_rd_done(struct wm_softc *);
 static void	wm_lan_init_done(struct wm_softc *);
 static void	wm_get_cfg_done(struct wm_softc *);
+static void	wm_phy_post_reset(struct wm_softc *);
 static void	wm_initialize_hardware_bits(struct wm_softc *);
 static uint32_t	wm_rxpbs_adjust_82580(uint32_t);
 static void	wm_reset_phy(struct wm_softc *);
@@ -930,6 +931,7 @@ static bool	wm_phy_is_accessible_pchlan(
 static void	wm_toggle_lanphypc_pch_lpt(struct wm_softc *);
 static int	wm_platform_pm_pch_lpt(struct wm_softc *, bool);
 static void	wm_pll_workaround_i210(struct wm_softc *);
+static void	wm_legacy_irq_quirk_spt(struct wm_softc *);
 
 CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
 wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
@@ -3659,6 +3661,47 @@ wm_get_cfg_done(struct wm_softc *sc)
 	}
 }
 
+void
+wm_phy_post_reset(struct wm_softc *sc)
+{
+	uint32_t reg;
+
+	/* This function is only for ICH8 and newer. */
+	if (sc->sc_type < WM_T_ICH8)
+		return;
+
+	if (wm_phy_resetisblocked(sc)) {
+		/* XXX */
+		device_printf(sc->sc_dev, " PHY is blocked\n");
+		return;
+	}
+
+	/* Allow time for h/w to get to quiescent state after reset */
+	delay(10*1000);
+
+	/* Perform any necessary post-reset workarounds */
+	if (sc->sc_type == WM_T_PCH)
+		wm_hv_phy_workaround_ich8lan(sc);
+	if (sc->sc_type == WM_T_PCH2)
+		wm_lv_phy_workaround_ich8lan(sc);
+
+	/* Clear the host wakeup bit after lcd reset */
+	if (sc->sc_type >= WM_T_PCH) {
+		reg = wm_gmii_hv_readreg(sc->sc_dev, 2,
+		BM_PORT_GEN_CFG);
+		reg &= ~BM_WUC_HOST_WU_BIT;
+		wm_gmii_hv_writereg(sc->sc_dev, 2,
+		BM_PORT_GEN_CFG, reg);
+	}
+
+	/*
+	 * XXX Configure the LCD with th extended configuration region
+	 * in NVM
+	 */
+
+	/* Configure the LCD with the OEM bits in NVM */
+}
+
 /* Init hardware bits */
 void
 wm_initialize_hardware_bits(struct wm_softc *sc)
@@ -3938,6 +3981,7 @@ wm_reset_phy(struct wm_softc *sc)
 	sc->phy.release(sc);
 
 	wm_get_cfg_done(sc);
+	wm_phy_post_reset(sc);
 }
 
 static void
@@ -4371,6 +4415,9 @@ wm_reset(struct wm_softc *sc)
 		break;
 	}
 
+	if (phy_reset != 0)
+		wm_phy_post_reset(sc);
+
 	if ((sc->sc_type == WM_T_82580)
 	|| (sc->sc_type == WM_T_I350) || (sc->sc_type == WM_T_I354)) {
 		/* clear global device reset status bit */
@@ -4403,15 +4450,6 @@ wm_reset(struct wm_softc *sc)
 	if ((sc->sc_type >= WM_T_I350) && (sc->sc_type <= WM_T_I211))
 		wm_set_eee_i350(sc);
 
-	/* Clear the host wakeup bit after lcd reset */
-	if (sc->sc_type >= WM_T_PCH) {
-		reg = wm_gmii_hv_readreg(sc->sc_dev, 2,
-		BM_PORT_GEN_CFG);
-		reg &= ~BM_WUC_HOST_WU_BIT;
-		wm_gmii_hv_writereg(sc->sc_dev, 2,
-		BM_PORT_GEN_CFG, reg);
-	}
-
 	/*
 	 * For PCH, this write will make sure that any noise will be detected
 	 * as a CRC error and be dropped rather than show up as a bad packet
@@ -5091,6 +5129,10 @@ wm_init_locked(struct ifnet *ifp)
 	ifp->if_collisions += CSR_READ(sc, WMREG_COLC);
 	ifp->if_ierrors += CSR_READ(sc, WMREG_RXERRC);
 
+	/* AMT based hardware can now take control from firmware */
+	if ((sc->sc_flags & WM_F_HAS_AMT) != 0)
+		wm_get_hw_control(sc);
+
 	/* PCH_SPT hardware workaround */
 	if (sc->sc_type == WM_T_PCH_SPT)
 		wm_flush_desc_rings(sc);
@@ -5098,9 +5140,9 @@ wm_init_locked(struct ifnet *ifp)
 	/* Reset the chip to a known state. */
 	wm_reset(sc);
 
-	/* AMT based hardware can now take control from firmware */
-	if 

CVS commit: src/sys/dev/pci

2017-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 26 04:09:02 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
- Fix wm_set_ral():
 - Fix a bug that a RAL was written at incorrect address when the index number
   is more than 16 on 82544 and newer.
 - The layout of RAL on PCH* are different from others.
- Remove wrong comment.


To generate a diff of this commit:
cvs rdiff -u -r1.513 -r1.514 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/pci/if_wmreg.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.513 src/sys/dev/pci/if_wm.c:1.514
--- src/sys/dev/pci/if_wm.c:1.513	Mon Jun 26 04:03:34 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 26 04:09:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.513 2017/06/26 04:03:34 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.513 2017/06/26 04:03:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.514 2017/06/26 04:09:02 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -3206,7 +3206,9 @@ wm_read_mac_addr(struct wm_softc *sc, ui
 static void
 wm_set_ral(struct wm_softc *sc, const uint8_t *enaddr, int idx)
 {
-	uint32_t ral_lo, ral_hi;
+	uint32_t ral_lo, ral_hi, addrl, addrh;
+	uint32_t wlock_mac;
+	int rv;
 
 	if (enaddr != NULL) {
 		ral_lo = enaddr[0] | (enaddr[1] << 8) | (enaddr[2] << 16) |
@@ -3218,14 +3220,54 @@ wm_set_ral(struct wm_softc *sc, const ui
 		ral_hi = 0;
 	}
 
-	if (sc->sc_type >= WM_T_82544) {
-		CSR_WRITE(sc, WMREG_RAL_LO(WMREG_CORDOVA_RAL_BASE, idx),
-		ral_lo);
-		CSR_WRITE(sc, WMREG_RAL_HI(WMREG_CORDOVA_RAL_BASE, idx),
-		ral_hi);
-	} else {
-		CSR_WRITE(sc, WMREG_RAL_LO(WMREG_RAL_BASE, idx), ral_lo);
-		CSR_WRITE(sc, WMREG_RAL_HI(WMREG_RAL_BASE, idx), ral_hi);
+	switch (sc->sc_type) {
+	case WM_T_82542_2_0:
+	case WM_T_82542_2_1:
+	case WM_T_82543:
+		CSR_WRITE(sc, WMREG_RAL(idx), ral_lo);
+		CSR_WRITE_FLUSH(sc);
+		CSR_WRITE(sc, WMREG_RAH(idx), ral_hi);
+		CSR_WRITE_FLUSH(sc);
+		break;
+	case WM_T_PCH2:
+	case WM_T_PCH_LPT:
+	case WM_T_PCH_SPT:
+		if (idx == 0) {
+			CSR_WRITE(sc, WMREG_CORDOVA_RAL(idx), ral_lo);
+			CSR_WRITE_FLUSH(sc);
+			CSR_WRITE(sc, WMREG_CORDOVA_RAH(idx), ral_hi);
+			CSR_WRITE_FLUSH(sc);
+			return;
+		}
+		if (sc->sc_type != WM_T_PCH2) {
+			wlock_mac = __SHIFTOUT(CSR_READ(sc, WMREG_FWSM),
+			FWSM_WLOCK_MAC);
+			addrl = WMREG_SHRAL(idx - 1);
+			addrh = WMREG_SHRAH(idx - 1);
+		} else {
+			wlock_mac = 0;
+			addrl = WMREG_PCH_LPT_SHRAL(idx - 1);
+			addrh = WMREG_PCH_LPT_SHRAH(idx - 1);
+		}
+		
+		if ((wlock_mac == 0) || (idx <= wlock_mac)) {
+			rv = wm_get_swflag_ich8lan(sc);
+			if (rv != 0)
+return;
+			CSR_WRITE(sc, addrl, ral_lo);
+			CSR_WRITE_FLUSH(sc);
+			CSR_WRITE(sc, addrh, ral_hi);
+			CSR_WRITE_FLUSH(sc);
+			wm_put_swflag_ich8lan(sc);
+		}
+
+		break;
+	default:
+		CSR_WRITE(sc, WMREG_CORDOVA_RAL(idx), ral_lo);
+		CSR_WRITE_FLUSH(sc);
+		CSR_WRITE(sc, WMREG_CORDOVA_RAH(idx), ral_hi);
+		CSR_WRITE_FLUSH(sc);
+		break;
 	}
 }
 

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.98 src/sys/dev/pci/if_wmreg.h:1.99
--- src/sys/dev/pci/if_wmreg.h:1.98	Tue Feb 28 09:55:47 2017
+++ src/sys/dev/pci/if_wmreg.h	Mon Jun 26 04:09:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.98 2017/02/28 09:55:47 knakahara Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.99 2017/06/26 04:09:02 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -636,8 +636,15 @@ struct livengood_tcpip_ctxdesc {
 #define FEXTNVM3_PHY_CFG_COUNTER_MASK	__BITS(27, 26)
 #define FEXTNVM3_PHY_CFG_COUNTER_50MS	__BIT(27)
 
-#define	WMREG_RAL_BASE	0x0040	/* Receive Address List */
-#define	WMREG_CORDOVA_RAL_BASE 0x5400
+#define	WMREG_RAL(x)		(0x0040	+ ((x) * 8)) /* Receive Address List */
+#define	WMREG_RAH(x)		(WMREG_RAL(x) + 4)
+#define	WMREG_CORDOVA_RAL(x)	(((x) <= 15) ? (0x5400 + ((x) * 8)) : \
+	(0x54e0 + (((x) - 16) * 8)))
+#define	WMREG_CORDOVA_RAH(x)	(WMREG_CORDOVA_RAL(x) + 4)
+#define	WMREG_SHRAL(x)		(0x5438 + ((x) * 8))
+#define	WMREG_SHRAH(x)		(WMREG_PCH_LPT_SHRAL(x) + 4)
+#define	WMREG_PCH_LPT_SHRAL(x)	(0x5408 + ((x) * 8))
+#define	WMREG_PCH_LPT_SHRAH(x)	(WMREG_PCH_LPT_SHRAL(x) + 4)
 #define	WMREG_RAL_LO(b, x) ((b) + ((x) << 3))
 #define	WMREG_RAL_HI(b, x) (WMREG_RAL_LO(b, x) + 4)
 	/*
@@ -1276,7 +1283,7 @@ struct livengood_tcpip_ctxdesc {
 #define	MNG_ICH_IAMT_MODE	0x2	/* PT mode? */
 #define	MNG_IAMT_MODE		0x3
 #define FWSM_RSPCIPHY		__BIT(6)  /* Reset PHY on PCI reset */
-#define FWSM_WLOCK_MAC		__BITS(7, 9)  /* Reset PHY on PCI reset */
+#define FWSM_WLOCK_MAC		__BITS(7, 9)
 #define FWSM_ULP_CFG_DONE	__BIT(10)
 #define FWSM_FW_VALID		__BIT(15) /* FW established a valid mode */
 

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

2017-06-25 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Mon Jun 26 03:15:16 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: BCM5301X BCM56340 BEAGLEBOARDXM BEAGLEBONE
GEMINI GEMINI_MASTER GEMINI_SLAVE GOLDENGATE N900 PANDABOARD

Log Message:
Add a heading to describe the class of device axe(4) is.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/conf/BCM5301X
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbarm/conf/BCM56340
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/BEAGLEBOARDXM \
src/sys/arch/evbarm/conf/N900
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/evbarm/conf/BEAGLEBONE
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/GEMINI \
src/sys/arch/evbarm/conf/GEMINI_MASTER
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/GEMINI_SLAVE
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/GOLDENGATE
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/PANDABOARD

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/evbarm/conf/BCM5301X
diff -u src/sys/arch/evbarm/conf/BCM5301X:1.26 src/sys/arch/evbarm/conf/BCM5301X:1.27
--- src/sys/arch/evbarm/conf/BCM5301X:1.26	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbarm/conf/BCM5301X	Mon Jun 26 03:15:16 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BCM5301X,v 1.26 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: BCM5301X,v 1.27 2017/06/26 03:15:16 sevan Exp $
 #
 #	BCM5301X -- Broadcom BCM5301X Eval Board Kernel
 #
@@ -265,6 +265,7 @@ scsibus*	at scsi?
 sd*		at scsibus? target ? lun ?
 #wd*		at umass?
 
+# USB Ethernet adapters
 axe*		at uhub? port ? configuration ? interface ?
 
 # Hardware clocking and power management

Index: src/sys/arch/evbarm/conf/BCM56340
diff -u src/sys/arch/evbarm/conf/BCM56340:1.11 src/sys/arch/evbarm/conf/BCM56340:1.12
--- src/sys/arch/evbarm/conf/BCM56340:1.11	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbarm/conf/BCM56340	Mon Jun 26 03:15:16 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BCM56340,v 1.11 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: BCM56340,v 1.12 2017/06/26 03:15:16 sevan Exp $
 #
 #	BCM5301X -- Broadcom BCM5301X Eval Board Kernel
 #
@@ -265,6 +265,7 @@ scsibus*	at scsi?
 sd*		at scsibus? target ? lun ?
 #wd*		at umass?
 
+# USB Ethernet adapters
 axe*		at uhub? port ? configuration ? interface ?
 
 # Hardware clocking and power management

Index: src/sys/arch/evbarm/conf/BEAGLEBOARDXM
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.23 src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.24
--- src/sys/arch/evbarm/conf/BEAGLEBOARDXM:1.23	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbarm/conf/BEAGLEBOARDXM	Mon Jun 26 03:15:16 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARDXM,v 1.23 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: BEAGLEBOARDXM,v 1.24 2017/06/26 03:15:16 sevan Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -264,6 +264,7 @@ prcm*		at obio1 addr 0x48306000 size 0x2
 #wskbd*		at ukbd?
 #wsmouse*	at ums?
 
+# USB Ethernet adapters
 #axe*		at uhub? port ? configuration ? interface ?
 
 # Hardware clocking and power management
Index: src/sys/arch/evbarm/conf/N900
diff -u src/sys/arch/evbarm/conf/N900:1.23 src/sys/arch/evbarm/conf/N900:1.24
--- src/sys/arch/evbarm/conf/N900:1.23	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbarm/conf/N900	Mon Jun 26 03:15:16 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: N900,v 1.23 2017/02/19 07:47:00 rin Exp $
+#	$NetBSD: N900,v 1.24 2017/06/26 03:15:16 sevan Exp $
 #
 #	N900 -- Nokia N900 Kernel
 #
@@ -312,6 +312,7 @@ prcm*		at obio1 addr 0x48306000 size 0x2
 #wskbd*		at ukbd?
 #wsmouse*	at ums?
 
+# USB Ethernet adapters
 #axe*		at uhub? port ? configuration ? interface ?
 
 # Hardware clocking and power management

Index: src/sys/arch/evbarm/conf/BEAGLEBONE
diff -u src/sys/arch/evbarm/conf/BEAGLEBONE:1.42 src/sys/arch/evbarm/conf/BEAGLEBONE:1.43
--- src/sys/arch/evbarm/conf/BEAGLEBONE:1.42	Tue May  9 01:57:04 2017
+++ src/sys/arch/evbarm/conf/BEAGLEBONE	Mon Jun 26 03:15:16 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBONE,v 1.42 2017/05/09 01:57:04 sevan Exp $
+#	$NetBSD: BEAGLEBONE,v 1.43 2017/06/26 03:15:16 sevan Exp $
 #
 #	BEAGLEBONE -- TI AM335x board Kernel
 #
@@ -211,6 +211,7 @@ scsibus*	at scsi?
 # SCSI devices
 sd*		at scsibus? target ? lun ?  # SCSI disk drives
 
+# USB Ethernet adapters
 axe*		at uhub? port ? configuration ? interface ?
 
 # Ethernet

Index: src/sys/arch/evbarm/conf/GEMINI
diff -u src/sys/arch/evbarm/conf/GEMINI:1.33 src/sys/arch/evbarm/conf/GEMINI:1.34
--- src/sys/arch/evbarm/conf/GEMINI:1.33	Sun Feb 19 07:47:00 2017
+++ src/sys/arch/evbarm/conf/GEMINI	Mon Jun 26 03:15:16 2017
@@ -200,10 +200,12 @@ ehci1	at obio? addr 0x6900 size 0x40
 usb* at ehci?
 uhub* at usb?
 uhub* at uhub? port ?
-axe* at uhub?
 umass* at uhub? port ? configuration ? interface ?
 wd* at umass?
 
+# USB Ethernet adapters
+axe* at uhub?
+
 # PCI
 pci0	at obio? bus ?
 options PCI_NETBSD_CONFIGURE		# set up the PCI bus
Index: 

CVS commit: src

2017-06-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 26 03:13:40 UTC 2017

Modified Files:
src/sys/net: rtsock.c
src/tests/net/arp: t_arp.sh
src/tests/net/ndp: t_ndp.sh
src/usr.sbin/arp: arp.c
src/usr.sbin/ndp: ndp.c

Log Message:
Fix usage of routing messages on arp -d and ndp -d

It didn't work as we expected; we should set RTA_GATEWAY not
RTA_IFP on RTM_GET to return an if_index and the kernel should
use it on RTM_DELETE.


To generate a diff of this commit:
cvs rdiff -u -r1.219 -r1.220 src/sys/net/rtsock.c
cvs rdiff -u -r1.27 -r1.28 src/tests/net/arp/t_arp.sh
cvs rdiff -u -r1.24 -r1.25 src/tests/net/ndp/t_ndp.sh
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/arp/arp.c
cvs rdiff -u -r1.48 -r1.49 src/usr.sbin/ndp/ndp.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/rtsock.c
diff -u src/sys/net/rtsock.c:1.219 src/sys/net/rtsock.c:1.220
--- src/sys/net/rtsock.c:1.219	Fri Jun 23 05:46:10 2017
+++ src/sys/net/rtsock.c	Mon Jun 26 03:13:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.219 2017/06/23 05:46:10 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.219 2017/06/23 05:46:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -856,8 +856,10 @@ COMPATNAME(route_output)(struct mbuf *m,
 		if (info.rti_info[RTAX_GATEWAY] &&
 		(info.rti_info[RTAX_GATEWAY]->sa_family == AF_LINK) &&
 		(rtm->rtm_flags & RTF_LLDATA) != 0) {
+			const struct sockaddr_dl *sdlp =
+			satocsdl(info.rti_info[RTAX_GATEWAY]);
 			error = lla_rt_output(rtm->rtm_type, rtm->rtm_flags,
-			rtm->rtm_rmx.rmx_expire, , 0);
+			rtm->rtm_rmx.rmx_expire, , sdlp->sdl_index);
 			break;
 		}
 #endif /* INET */

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.27 src/tests/net/arp/t_arp.sh:1.28
--- src/tests/net/arp/t_arp.sh:1.27	Thu Jun 22 10:06:33 2017
+++ src/tests/net/arp/t_arp.sh	Mon Jun 26 03:13:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.27 2017/06/22 10:06:33 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.28 2017/06/26 03:13:40 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -647,15 +647,15 @@ arp_rtm_body()
 
 	str="RTM_GET.+"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
-	str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+	str="$IP4DST $macaddr_dst"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 	str="RTM_DELETE.+"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str="$IP4DST $macaddr_dst $macaddr_src $IP4SRC"
+	str="$IP4DST $macaddr_dst"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 
 	rump_server_destroy_ifaces

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.24 src/tests/net/ndp/t_ndp.sh:1.25
--- src/tests/net/ndp/t_ndp.sh:1.24	Thu Jun 22 10:06:34 2017
+++ src/tests/net/ndp/t_ndp.sh	Mon Jun 26 03:13:40 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.24 2017/06/22 10:06:34 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.25 2017/06/26 03:13:40 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -446,15 +446,15 @@ ndp_rtm_body()
 
 	str="RTM_GET.+"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
-	str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
+	str="$IP6DST $macaddr_dst"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_GET $file
 	str="RTM_DELETE.+"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
-	str="$IP6DST $macaddr_dst $macaddr_src $IP6SRC"
+	str="$IP6DST $macaddr_dst"
 	atf_check -s exit:0 -o match:"$str" grep -A 3 RTM_DELETE $file
 
 	rump_server_destroy_ifaces

Index: src/usr.sbin/arp/arp.c
diff -u src/usr.sbin/arp/arp.c:1.56 src/usr.sbin/arp/arp.c:1.57
--- src/usr.sbin/arp/arp.c:1.56	Tue Jun  6 19:59:10 2017
+++ src/usr.sbin/arp/arp.c	Mon Jun 26 03:13:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: arp.c,v 1.56 2017/06/06 19:59:10 ryo Exp $ */
+/*	$NetBSD: arp.c,v 1.57 2017/06/26 03:13:40 ozaki-r Exp $ */
 
 /*
  * Copyright (c) 1984, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1984, 19
 #if 0
 static char sccsid[] = "@(#)arp.c	8.3 (Berkeley) 4/28/95";
 

CVS commit: src

2017-06-25 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 26 03:16:28 UTC 2017

Modified Files:
src/sys/net: rtsock.c
src/tests/net/arp: t_arp.sh
src/tests/net/ndp: t_ndp.sh

Log Message:
Improve backward compatibility of (fake) routing messages on adding an ARP/NDP 
entry

A message originally included only DST and GATEWAY. Restore it.


To generate a diff of this commit:
cvs rdiff -u -r1.220 -r1.221 src/sys/net/rtsock.c
cvs rdiff -u -r1.28 -r1.29 src/tests/net/arp/t_arp.sh
cvs rdiff -u -r1.25 -r1.26 src/tests/net/ndp/t_ndp.sh

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/rtsock.c
diff -u src/sys/net/rtsock.c:1.220 src/sys/net/rtsock.c:1.221
--- src/sys/net/rtsock.c:1.220	Mon Jun 26 03:13:40 2017
+++ src/sys/net/rtsock.c	Mon Jun 26 03:16:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.221 2017/06/26 03:16:28 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.220 2017/06/26 03:13:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.221 2017/06/26 03:16:28 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1670,8 +1670,6 @@ rt_clonedmsg(const struct sockaddr *dst,
 	sockaddr_dl_init(, sizeof(u.ss), ifp->if_index, ifp->if_type,
 	NULL, namelen, NULL, addrlen);
 	info.rti_info[RTAX_GATEWAY] = 
-	info.rti_info[RTAX_IFP] = rt->rt_ifp->if_dl->ifa_addr;
-	info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
 
 	rt_missmsg(RTM_ADD, , flags, 0);
 #undef RTF_LLINFO

Index: src/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.28 src/tests/net/arp/t_arp.sh:1.29
--- src/tests/net/arp/t_arp.sh:1.28	Mon Jun 26 03:13:40 2017
+++ src/tests/net/arp/t_arp.sh	Mon Jun 26 03:16:28 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.28 2017/06/26 03:13:40 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.29 2017/06/26 03:16:28 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -632,9 +632,9 @@ arp_rtm_body()
 
 	str="RTM_ADD.+"
 	atf_check -s exit:0 -o match:"$str" cat $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" cat $file
-	str="$IP4DST link#2 $macaddr_src $IP4SRC"
+	str="$IP4DST link#2"
 	atf_check -s exit:0 -o match:"$str" cat $file
 
 	# Test arp -d and resulting routing messages (RTM_GET and RTM_DELETE)

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.25 src/tests/net/ndp/t_ndp.sh:1.26
--- src/tests/net/ndp/t_ndp.sh:1.25	Mon Jun 26 03:13:40 2017
+++ src/tests/net/ndp/t_ndp.sh	Mon Jun 26 03:16:28 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.25 2017/06/26 03:13:40 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.26 2017/06/26 03:16:28 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -431,9 +431,9 @@ ndp_rtm_body()
 
 	str="RTM_ADD.+"
 	atf_check -s exit:0 -o match:"$str" cat $file
-	str=""
+	str=""
 	atf_check -s exit:0 -o match:"$str" cat $file
-	str="$IP6DST link#2 $macaddr_src $IP6SRC"
+	str="$IP6DST link#2"
 	atf_check -s exit:0 -o match:"$str" cat $file
 
 	# Test ndp -d and resulting routing messages (RTM_GET and RTM_DELETE)



CVS commit: src/sys/dev/pci

2017-06-25 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 26 04:03:34 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmvar.h

Log Message:
 Print sc_flags with snprintb().


To generate a diff of this commit:
cvs rdiff -u -r1.512 -r1.513 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/pci/if_wmvar.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/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.512 src/sys/dev/pci/if_wm.c:1.513
--- src/sys/dev/pci/if_wm.c:1.512	Fri Jun 23 06:10:31 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 26 04:03:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.512 2017/06/23 06:10:31 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.513 2017/06/26 04:03:34 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.512 2017/06/23 06:10:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.513 2017/06/26 04:03:34 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1674,6 +1674,7 @@ wm_attach(device_t parent, device_t self
 	prop_data_t ea;
 	prop_number_t pn;
 	uint8_t enaddr[ETHER_ADDR_LEN];
+	char buf[256];
 	uint16_t cfg1, cfg2, swdpin, nvmword;
 	pcireg_t preg, memtype;
 	uint16_t eeprom_data, apme_mask;
@@ -2377,10 +2378,6 @@ alloc_retry:
 	/* Check for WM_F_WOL flag after the setting of the EEPROM stuff */
 	if ((eeprom_data & apme_mask) != 0)
 		sc->sc_flags |= WM_F_WOL;
-#ifdef WM_DEBUG
-	if ((sc->sc_flags & WM_F_WOL) != 0)
-		printf("WOL\n");
-#endif
 
 	if ((sc->sc_type == WM_T_82575) || (sc->sc_type == WM_T_82576)) {
 		/* Check NVM for autonegotiation */
@@ -2574,6 +2571,8 @@ alloc_retry:
 		}
 		wm_gmii_mediainit(sc, wmp->wmp_product);
 	}
+	snprintb(buf, sizeof(buf), WM_FLAGS, sc->sc_flags);
+	aprint_verbose_dev(sc->sc_dev, "%s\n", buf);
 
 	ifp = >sc_ethercom.ec_if;
 	xname = device_xname(sc->sc_dev);
@@ -13054,18 +13053,6 @@ wm_get_wakeup(struct wm_softc *sc)
 	if (wm_enable_mng_pass_thru(sc) != 0)
 		sc->sc_flags |= WM_F_HAS_MANAGE;
 
-#ifdef WM_DEBUG
-	printf("\n");
-	if ((sc->sc_flags & WM_F_HAS_AMT) != 0)
-		printf("HAS_AMT,");
-	if ((sc->sc_flags & WM_F_ARC_SUBSYS_VALID) != 0)
-		printf("ARC_SUBSYS_VALID,");
-	if ((sc->sc_flags & WM_F_ASF_FIRMWARE_PRES) != 0)
-		printf("ASF_FIRMWARE_PRES,");
-	if ((sc->sc_flags & WM_F_HAS_MANAGE) != 0)
-		printf("HAS_MANAGE,");
-	printf("\n");
-#endif
 	/*
 	 * Note that the WOL flags is set after the resetting of the eeprom
 	 * stuff

Index: src/sys/dev/pci/if_wmvar.h
diff -u src/sys/dev/pci/if_wmvar.h:1.33 src/sys/dev/pci/if_wmvar.h:1.34
--- src/sys/dev/pci/if_wmvar.h:1.33	Wed Feb  1 08:56:41 2017
+++ src/sys/dev/pci/if_wmvar.h	Mon Jun 26 04:03:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmvar.h,v 1.33 2017/02/01 08:56:41 msaitoh Exp $	*/
+/*	$NetBSD: if_wmvar.h,v 1.34 2017/06/26 04:03:34 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -100,6 +100,15 @@
 #define	WM_F_PCS_DIS_AUTONEGO	0x0200 /* PCS Disable Autonego */
 #define	WM_F_PLL_WA_I210	0x0400 /* I21[01] PLL workaround */
 
+#define WM_FLAGS "\20" \
+	"\1" "HAS_MII"	"\2" "EECD"	"\3" "SWSM"	"\4" "SWFW"	\
+	"\5" "EXTCNF"	"\6" "EERDEEWR"	"\7" "SPI"	"\10" "FLASH"	\
+	"\11" "FLASH_HW" "\12" "INVALID" "\13" "IOH_VALID" "\14" "BUS64" \
+	"\15" "PCIX"	"\16" "CSA"	"\17" "PCIE"	"\20" "SGMII"	\
+	"\21" "NEWQUEUE" "\22" "ASF_FIRM" "\23" "ARC_SUBSYS" "\24" "AMT" \
+	"\25" "MANAGE"	"\26" "WOL"	"\27" "EEE"	"\30" "ATTACHED" \
+	"\31" "INVM"	"\32" "PCS_DIS_AUTONEGO" "\33" "PLLWA"
+
 /*
  * Variations of Intel gigabit Ethernet controller:
  *