CVS commit: src

2017-06-19 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Jun 20 01:17:13 UTC 2017

Modified Files:
src/distrib/sets/lists/comp: mi
src/sys/sys: Makefile
Removed Files:
src/sys/sys: user.h

Log Message:
Remove 

Proposed on the the tech-userlevel mailing list without strong objections.

This file no longer serves any purpose in any supported release branch.

There will be fallout in pkgsrc, please restrict inclusion  to
FreeBSD and DragonflyBSD.

I tried to iterate over packages in pkgsrc and there was little fallout,
however I don't have the full sources to scan every source code. I already
upstreamed to several projects removal of inclusion on NetBSD of
 (like Qt5).


To generate a diff of this commit:
cvs rdiff -u -r1.2140 -r1.2141 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.161 -r1.162 src/sys/sys/Makefile
cvs rdiff -u -r1.19 -r0 src/sys/sys/user.h

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/mi
diff -u src/distrib/sets/lists/comp/mi:1.2140 src/distrib/sets/lists/comp/mi:1.2141
--- src/distrib/sets/lists/comp/mi:1.2140	Tue Jun 13 06:39:09 2017
+++ src/distrib/sets/lists/comp/mi	Tue Jun 20 01:17:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2140 2017/06/13 06:39:09 nat Exp $
+#	$NetBSD: mi,v 1.2141 2017/06/20 01:17:13 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -2994,7 +2994,7 @@
 ./usr/include/sys/un.hcomp-c-include
 ./usr/include/sys/unistd.h			comp-c-include
 ./usr/include/sys/unpcb.h			comp-c-include
-./usr/include/sys/user.h			comp-c-include
+./usr/include/sys/user.h			comp-obsolete		obsolete
 ./usr/include/sys/utsname.h			comp-c-include
 ./usr/include/sys/uuid.h			comp-c-include
 ./usr/include/sys/vadvise.h			comp-c-include

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.161 src/sys/sys/Makefile:1.162
--- src/sys/sys/Makefile:1.161	Fri May 19 00:01:34 2017
+++ src/sys/sys/Makefile	Tue Jun 20 01:17:13 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.161 2017/05/19 00:01:34 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.162 2017/06/20 01:17:13 kamil Exp $
 
 .include 
 
@@ -43,7 +43,7 @@ INCS=	acct.h agpio.h aio.h ansi.h aout_m
 	tape.h termios.h time.h timeb.h timepps.h times.h timespec.h \
 	timex.h tls.h trace.h tree.h tty.h ttychars.h ttycom.h \
 	ttydefaults.h ttydev.h types.h \
-	ucontext.h ucred.h uio.h un.h unistd.h unpcb.h user.h utsname.h uuid.h \
+	ucontext.h ucred.h uio.h un.h unistd.h unpcb.h utsname.h uuid.h \
 	vadvise.h verified_exec.h videoio.h vmmeter.h vnode.h vnode_if.h \
 	wait.h wapbl.h wapbl_replay.h wdog.h xattr.h
 



CVS commit: src/sys/dev/pad

2017-06-19 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Mon Jun 19 23:54:00 UTC 2017

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

Log Message:
Use defines to specify pad audio format.  NFCI.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/pad/pad.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.36 src/sys/dev/pad/pad.c:1.37
--- src/sys/dev/pad/pad.c:1.36	Tue Jun  6 07:32:41 2017
+++ src/sys/dev/pad/pad.c	Mon Jun 19 23:54:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.36 2017/06/06 07:32:41 nat Exp $ */
+/* $NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.36 2017/06/06 07:32:41 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.37 2017/06/19 23:54:00 nat Exp $");
 
 #include 
 #include 
@@ -54,6 +54,11 @@ __KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.36
 
 #define PADUNIT(x)	minor(x)
 
+#define PADFREQ		44100
+#define PADCHAN		2
+#define PADPREC		16
+#define PADENC		AUDIO_ENCODING_SLINEAR_LE
+
 extern struct cfdriver pad_cd;
 
 typedef struct pad_block {
@@ -120,8 +125,8 @@ static const struct audio_hw_if pad_hw_i
 
 #define PAD_NFORMATS	1
 static const struct audio_format pad_formats[PAD_NFORMATS] = {
-	{ NULL, AUMODE_PLAY|AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16,
-	  2, AUFMT_STEREO, 1, { 44100 } },
+	{ NULL, AUMODE_PLAY|AUMODE_RECORD, PADENC, PADPREC, PADPREC,
+	  PADCHAN, AUFMT_STEREO, 1, { PADFREQ } },
 };
 
 extern void	padattach(int);
@@ -339,8 +344,8 @@ pad_close(dev_t dev, int flags, int fmt,
 	return 0;
 }
 
-#define PAD_BYTES_PER_SEC   (44100 * sizeof(int16_t) * 2)
-#define BYTESTOSLEEP 	(int64_t)(PAD_BLKSIZE)
+#define PAD_BYTES_PER_SEC   (PADFREQ * PADPREC / NBBY * PADCHAN)
+#define BYTESTOSLEEP	(int64_t)(PAD_BLKSIZE)
 #define TIMENEXTREAD	(int64_t)(BYTESTOSLEEP * 100 / PAD_BYTES_PER_SEC)
 
 int



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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 23:08:05 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_sysmmu.c

Log Message:
Fix dmesg


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/samsung/exynos_sysmmu.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/samsung/exynos_sysmmu.c
diff -u src/sys/arch/arm/samsung/exynos_sysmmu.c:1.1 src/sys/arch/arm/samsung/exynos_sysmmu.c:1.2
--- src/sys/arch/arm/samsung/exynos_sysmmu.c:1.1	Sun Jan  3 04:10:58 2016
+++ src/sys/arch/arm/samsung/exynos_sysmmu.c	Mon Jun 19 23:08:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $ */
+/*	$NetBSD: exynos_sysmmu.c,v 1.2 2017/06/19 23:08:05 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_sysmmu.c,v 1.1 2016/01/03 04:10:58 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_sysmmu.c,v 1.2 2017/06/19 23:08:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -102,6 +102,10 @@ exynos_sysmmu_attach(device_t parent, de
 		return;
 	}
 
+	aprint_normal(" @ 0x%08x: SYSMMU -  NOT IMPLEMENTED", (uint)addr);
+	aprint_naive("\n");
+	aprint_normal("\n");
+
 	if (!fdtbus_intr_str(faa->faa_phandle, 0, intrstr, sizeof(intrstr))) {
 		aprint_error_dev(self, "failed to decode interrupt\n");
 		return;
@@ -116,9 +120,6 @@ exynos_sysmmu_attach(device_t parent, de
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
-	aprint_normal(" @ 0x%08x: SYSMMU -  NOT IMPLEMENTED", (uint)addr);
-	aprint_naive("\n");
-	aprint_normal("\n");
 
 }
 



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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 22:03:50 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_dwcmmc.c

Log Message:
Update for new dwc_mmc driver


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos_dwcmmc.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/samsung/exynos_dwcmmc.c
diff -u src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.3 src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.4
--- src/sys/arch/arm/samsung/exynos_dwcmmc.c:1.3	Mon May 30 16:38:35 2016
+++ src/sys/arch/arm/samsung/exynos_dwcmmc.c	Mon Jun 19 22:03:50 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_dwcmmc.c,v 1.3 2016/05/30 16:38:35 dholland Exp $ */
+/* $NetBSD: exynos_dwcmmc.c,v 1.4 2017/06/19 22:03:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.3 2016/05/30 16:38:35 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_dwcmmc.c,v 1.4 2017/06/19 22:03:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -43,11 +43,18 @@ __KERNEL_RCSID(0, "$NetBSD: exynos_dwcmm
 #include 
 #include 
 
+#define	FIFO_REG	0x200
+#define	MPS_BEGIN	0x200
+#define	MPS_END		0x204
+#define	MPS_CTRL	0x20c
+#define	 MPS_CTRL_SECURE_WRITE		__BIT(6)
+#define	 MPS_CTRL_NON_SECURE_READ	__BIT(5)
+#define	 MPS_CTRL_NON_SECURE_WRITE	__BIT(4)
+#define	 MPS_CTRL_VALID			__BIT(0)
+
 static int	exynos_dwcmmc_match(device_t, cfdata_t, void *);
 static void	exynos_dwcmmc_attach(device_t, device_t, void *);
 
-static void	exynos_dwcmmc_attach_i(device_t);
-
 static int	exynos_dwcmmc_card_detect(struct dwc_mmc_softc *);
 
 struct exynos_dwcmmc_softc {
@@ -137,12 +144,13 @@ exynos_dwcmmc_attach(device_t parent, de
 
 	sc->sc_clock_freq = clk_get_rate(esc->sc_clk_ciu) / (ciu_div + 1);
 	sc->sc_fifo_depth = fifo_depth;
+	sc->sc_fifo_reg = FIFO_REG;
+	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
 
 	esc->sc_pin_cd = fdtbus_gpio_acquire(phandle, "cd-gpios",
 	GPIO_PIN_INPUT);
-	if (esc->sc_pin_cd) {
+	if (esc->sc_pin_cd)
 		sc->sc_card_detect = exynos_dwcmmc_card_detect;
-	}
 
 	aprint_naive("\n");
 	aprint_normal(": MHS (%u Hz)\n", sc->sc_clock_freq);
@@ -152,6 +160,9 @@ exynos_dwcmmc_attach(device_t parent, de
 		return;
 	}
 
+	if (dwc_mmc_init(sc) != 0)
+		return;
+
 	sc->sc_ih = fdtbus_intr_establish(phandle, 0, IPL_BIO, 0,
 	dwc_mmc_intr, sc);
 	if (sc->sc_ih == NULL) {
@@ -161,16 +172,15 @@ exynos_dwcmmc_attach(device_t parent, de
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
-	config_interrupts(self, exynos_dwcmmc_attach_i);
-}
-
-static void
-exynos_dwcmmc_attach_i(device_t self)
-{
-	struct exynos_dwcmmc_softc *esc = device_private(self);
-	struct dwc_mmc_softc *sc = >sc;
-
-	dwc_mmc_init(sc);
+	/* Disable encryption mode */
+	const char * compat_enc[] = { "samsung,exynos5420-dw-mshc-smu", NULL };
+	if (of_match_compatible(phandle, compat_enc)) {
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, MPS_BEGIN, 0);
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, MPS_END, ~0U);
+		bus_space_write_4(sc->sc_bst, sc->sc_bsh, MPS_CTRL,
+		MPS_CTRL_NON_SECURE_READ | MPS_CTRL_NON_SECURE_WRITE |
+		MPS_CTRL_SECURE_WRITE | MPS_CTRL_VALID);
+	}
 }
 
 static int



CVS commit: src/sys/dev/ic

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 22:03:02 UTC 2017

Modified Files:
src/sys/dev/ic: dwc_mmc.c dwc_mmc_reg.h dwc_mmc_var.h

Log Message:
More or less a rewrite of dwc_mmc, based on awin_mmc, adding DMA support.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/ic/dwc_mmc.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/dwc_mmc_reg.h \
src/sys/dev/ic/dwc_mmc_var.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/ic/dwc_mmc.c
diff -u src/sys/dev/ic/dwc_mmc.c:1.10 src/sys/dev/ic/dwc_mmc.c:1.11
--- src/sys/dev/ic/dwc_mmc.c:1.10	Sun Dec 27 18:35:29 2015
+++ src/sys/dev/ic/dwc_mmc.c	Mon Jun 19 22:03:02 2017
@@ -1,7 +1,7 @@
-/* $NetBSD: dwc_mmc.c,v 1.10 2015/12/27 18:35:29 jmcneill Exp $ */
+/* $NetBSD: dwc_mmc.c,v 1.11 2017/06/19 22:03:02 jmcneill Exp $ */
 
 /*-
- * Copyright (c) 2014 Jared D. McNeill 
+ * Copyright (c) 2014-2017 Jared McNeill 
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -26,10 +26,8 @@
  * SUCH DAMAGE.
  */
 
-#include "opt_dwc_mmc.h"
-
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.10 2015/12/27 18:35:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 1.11 2017/06/19 22:03:02 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +43,8 @@ __KERNEL_RCSID(0, "$NetBSD: dwc_mmc.c,v 
 #include 
 #include 
 
+#define DWC_MMC_NDESC		64
+
 static int	dwc_mmc_host_reset(sdmmc_chipset_handle_t);
 static uint32_t	dwc_mmc_host_ocr(sdmmc_chipset_handle_t);
 static int	dwc_mmc_host_maxblklen(sdmmc_chipset_handle_t);
@@ -55,25 +55,10 @@ static int	dwc_mmc_bus_clock(sdmmc_chips
 static int	dwc_mmc_bus_width(sdmmc_chipset_handle_t, int);
 static int	dwc_mmc_bus_rod(sdmmc_chipset_handle_t, int);
 static void	dwc_mmc_exec_command(sdmmc_chipset_handle_t,
- struct sdmmc_command *);
+  struct sdmmc_command *);
 static void	dwc_mmc_card_enable_intr(sdmmc_chipset_handle_t, int);
 static void	dwc_mmc_card_intr_ack(sdmmc_chipset_handle_t);
 
-static int	dwc_mmc_set_clock(struct dwc_mmc_softc *, u_int);
-static int	dwc_mmc_update_clock(struct dwc_mmc_softc *);
-static int	dwc_mmc_wait_rint(struct dwc_mmc_softc *, uint32_t, int);
-static int	dwc_mmc_pio_wait(struct dwc_mmc_softc *,
- struct sdmmc_command *);
-static int	dwc_mmc_pio_transfer(struct dwc_mmc_softc *,
- struct sdmmc_command *);
-
-#ifdef DWC_MMC_DEBUG
-static void	dwc_mmc_print_rint(struct dwc_mmc_softc *, const char *,
-   uint32_t);
-#endif
-
-void		dwc_mmc_dump_regs(int);
-
 static struct sdmmc_chip_functions dwc_mmc_chip_functions = {
 	.host_reset = dwc_mmc_host_reset,
 	.host_ocr = dwc_mmc_host_ocr,
@@ -89,23 +74,67 @@ static struct sdmmc_chip_functions dwc_m
 	.card_intr_ack = dwc_mmc_card_intr_ack,
 };
 
-#define MMC_WRITE(sc, reg, val) \
+#define MMC_WRITE(sc, reg, val)	\
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
 #define MMC_READ(sc, reg) \
 	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
 
-void
-dwc_mmc_init(struct dwc_mmc_softc *sc)
+static void
+dwc_mmc_dump_regs(struct dwc_mmc_softc *sc)
 {
-	struct sdmmcbus_attach_args saa;
+	device_printf(sc->sc_dev, "device registers:\n");
+	for (u_int off = 0x00; off < 0x100; off += 16) {
+		device_printf(sc->sc_dev, "xx%02x: %08x %08x %08x %08x\n",
+		off,
+		MMC_READ(sc, off + 0), MMC_READ(sc, off + 4),
+		MMC_READ(sc, off + 8), MMC_READ(sc, off + 12));
+	}
+}
 
-	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_BIO);
-	cv_init(>sc_intr_cv, "dwcmmcirq");
+static int
+dwc_mmc_idma_setup(struct dwc_mmc_softc *sc)
+{
+	int error;
+
+	sc->sc_idma_xferlen = 0x1000;
+
+	sc->sc_idma_ndesc = DWC_MMC_NDESC;
+	sc->sc_idma_size = sizeof(struct dwc_mmc_idma_desc) *
+	sc->sc_idma_ndesc;
+	error = bus_dmamem_alloc(sc->sc_dmat, sc->sc_idma_size, 8,
+	sc->sc_idma_size, sc->sc_idma_segs, 1,
+	>sc_idma_nsegs, BUS_DMA_WAITOK);
+	if (error)
+		return error;
+	error = bus_dmamem_map(sc->sc_dmat, sc->sc_idma_segs,
+	sc->sc_idma_nsegs, sc->sc_idma_size,
+	>sc_idma_desc, BUS_DMA_WAITOK);
+	if (error)
+		goto free;
+	error = bus_dmamap_create(sc->sc_dmat, sc->sc_idma_size, 1,
+	sc->sc_idma_size, 0, BUS_DMA_WAITOK, >sc_idma_map);
+	if (error)
+		goto unmap;
+	error = bus_dmamap_load(sc->sc_dmat, sc->sc_idma_map,
+	sc->sc_idma_desc, sc->sc_idma_size, NULL, BUS_DMA_WAITOK);
+	if (error)
+		goto destroy;
+	return 0;
 
-#ifdef DWC_MMC_DEBUG
-	const uint32_t verid = MMC_READ(sc, DWC_MMC_VERID_REG);
-	aprint_normal_dev(sc->sc_dev, "version 0x%04x\n", verid & 0x);
-#endif
+destroy:
+	bus_dmamap_destroy(sc->sc_dmat, sc->sc_idma_map);
+unmap:
+	bus_dmamem_unmap(sc->sc_dmat, sc->sc_idma_desc, sc->sc_idma_size);
+free:
+	bus_dmamem_free(sc->sc_dmat, sc->sc_idma_segs, sc->sc_idma_nsegs);
+	return error;
+}
+
+static void
+dwc_mmc_attach_i(device_t self)
+{
+	

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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 22:01:18 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: EXYNOS

Log Message:
Disable exyortc for now, it doesn't work.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/conf/EXYNOS

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/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.18 src/sys/arch/evbarm/conf/EXYNOS:1.19
--- src/sys/arch/evbarm/conf/EXYNOS:1.18	Sun Jun 18 15:57:16 2017
+++ src/sys/arch/evbarm/conf/EXYNOS	Mon Jun 19 22:01:18 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.18 2017/06/18 15:57:16 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.19 2017/06/19 22:01:18 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -74,7 +74,7 @@ exyoi2c*	at fdt?			# I2C
 iic*		at exyoi2c?
 
 # RTC
-exyortc*	at fdt?			# RTC
+#exyortc*	at fdt?			# RTC
 
 # SDMMC
 dwcmmc*		at fdt?			# SDMMC



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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 21:59:55 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos5422_clock.c

Log Message:
Fix PLL con0 register locations and add uart clocks


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos5422_clock.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/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.5 src/sys/arch/arm/samsung/exynos5422_clock.c:1.6
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.5	Sun Apr 16 15:52:43 2017
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Mon Jun 19 21:59:55 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.5 2017/04/16 15:52:43 jmcneill Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.5 2017/04/16 15:52:43 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.6 2017/06/19 21:59:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -277,13 +277,13 @@ static const struct clk_funcs exynos5422
 	.u = { .fixed = { .rate = (_rate) } }			\
 }
 
-#define CLK_PLL(_name, _parent, _base) {			\
+#define CLK_PLL(_name, _parent, _lock, _con0) {			\
 	.base = { .name = (_name) }, .type = EXYNOS_CLK_PLL,	\
 	.parent = (_parent),	\
 	.u = {			\
 		.pll = {	\
-			.con0_reg = (_base) + PLL_CON0_OFFSET,	\
-			.lock_reg = (_base) + PLL_LOCK_OFFSET,	\
+			.lock_reg = (_lock),			\
+			.con0_reg = (_con0),			\
 		}		\
 	}			\
 }
@@ -331,17 +331,32 @@ static const struct clk_funcs exynos5422
 	}			\
 }
 
-#define EXYNOS5422_APLL_BASE		0x0
-#define EXYNOS5422_CPLL_BASE		0x10020
-#define EXYNOS5422_DPLL_BASE		0x10030
-#define EXYNOS5422_EPLL_BASE		0x10040
-#define EXYNOS5422_RPLL_BASE		0x10050
-#define EXYNOS5422_IPLL_BASE		0x10060
-#define EXYNOS5422_SPLL_BASE		0x10070
-#define EXYNOS5422_VPLL_BASE		0x10080
-#define EXYNOS5422_MPLL_BASE		0x10090
-#define EXYNOS5422_BPLL_BASE		0x20010
-#define EXYNOS5422_KPLL_BASE		0x28000
+#define EXYNOS5422_APLL_LOCK		0x0
+#define EXYNOS5422_APLL_CON0		0x00100
+#define EXYNOS5422_CPLL_LOCK		0x10020
+#define EXYNOS5422_DPLL_LOCK		0x10030
+#define EXYNOS5422_EPLL_LOCK		0x10040
+#define EXYNOS5422_RPLL_LOCK		0x10050
+#define EXYNOS5422_IPLL_LOCK		0x10060
+#define EXYNOS5422_SPLL_LOCK		0x10070
+#define EXYNOS5422_VPLL_LOCK		0x10080
+#define EXYNOS5422_MPLL_LOCK		0x10090
+#define EXYNOS5422_CPLL_CON0		0x10120
+#define EXYNOS5422_DPLL_CON0		0x10128
+#define EXYNOS5422_EPLL_CON0		0x10130
+#define EXYNOS5422_EPLL_CON1		0x10134
+#define EXYNOS5422_EPLL_CON2		0x10138
+#define EXYNOS5422_RPLL_CON0		0x10140
+#define EXYNOS5422_RPLL_CON1		0x10144
+#define EXYNOS5422_RPLL_CON2		0x10148
+#define EXYNOS5422_IPLL_CON0		0x10150
+#define EXYNOS5422_SPLL_CON0		0x10160
+#define EXYNOS5422_VPLL_CON0		0x10170
+#define EXYNOS5422_MPLL_CON0		0x10180
+#define EXYNOS5422_BPLL_LOCK		0x20010
+#define EXYNOS5422_BPLL_CON0		0x20110
+#define EXYNOS5422_KPLL_LOCK		0x28000
+#define EXYNOS5422_KPLL_CON0		0x28100
 
 #define EXYNOS5422_SRC_CPU		0x00200
 #define EXYNOS5422_SRC_TOP0		0x10200
@@ -363,8 +378,10 @@ static const struct clk_funcs exynos5422
 #define EXYNOS5422_SRC_TOP12		0x10280
 
 #define EXYNOS5422_DIV_FSYS1		0x1054c
+#define EXYNOS5422_DIV_PERIC0		0x10558
 
 #define EXYNOS5422_GATE_TOP_SCLK_FSYS	0x10840
+#define EXYNOS5422_GATE_TOP_SCLK_PERIC	0x10850
 
 static const char *mout_cpll_p[] = { "fin_pll", "fout_cpll" };
 static const char *mout_dpll_p[] = { "fin_pll", "fout_dpll" };
@@ -380,17 +397,28 @@ static const char *mout_group2_p[] =
 static struct exynos_clk exynos5422_clocks[] = {
 	CLK_FIXED("fin_pll", EXYNOS_F_IN_FREQ),
 
-	CLK_PLL("fout_apll", "fin_pll", EXYNOS5422_APLL_BASE),
-	CLK_PLL("fout_cpll", "fin_pll", EXYNOS5422_CPLL_BASE),
-	CLK_PLL("fout_dpll", "fin_pll", EXYNOS5422_DPLL_BASE),
-	CLK_PLL("fout_epll", "fin_pll", EXYNOS5422_EPLL_BASE),
-	CLK_PLL("fout_rpll", "fin_pll", EXYNOS5422_RPLL_BASE),
-	CLK_PLL("fout_ipll", "fin_pll", EXYNOS5422_IPLL_BASE),
-	CLK_PLL("fout_spll", "fin_pll", EXYNOS5422_SPLL_BASE),
-	CLK_PLL("fout_vpll", "fin_pll", EXYNOS5422_VPLL_BASE),
-	CLK_PLL("fout_mpll", "fin_pll", EXYNOS5422_MPLL_BASE),
-	CLK_PLL("fout_bpll", "fin_pll", EXYNOS5422_BPLL_BASE),
-	CLK_PLL("fout_kpll", "fin_pll", EXYNOS5422_KPLL_BASE),
+	CLK_PLL("fout_apll", "fin_pll", EXYNOS5422_APLL_LOCK,
+	EXYNOS5422_APLL_CON0),
+	CLK_PLL("fout_cpll", "fin_pll", EXYNOS5422_CPLL_LOCK,
+	EXYNOS5422_CPLL_CON0),
+	CLK_PLL("fout_dpll", "fin_pll", EXYNOS5422_DPLL_LOCK,
+	EXYNOS5422_DPLL_CON0),
+	CLK_PLL("fout_epll", "fin_pll", EXYNOS5422_EPLL_LOCK,
+	EXYNOS5422_EPLL_CON0),
+	CLK_PLL("fout_rpll", "fin_pll", EXYNOS5422_RPLL_LOCK,
+	EXYNOS5422_RPLL_CON0),
+	

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

2017-06-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jun 19 21:58:13 UTC 2017

Modified Files:
src/sys/arch/arm/samsung: exynos_sscom.c

Log Message:
Get baud rate from sclk_uartN instead of uartN. Print IRQ number at attach.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_sscom.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/samsung/exynos_sscom.c
diff -u src/sys/arch/arm/samsung/exynos_sscom.c:1.9 src/sys/arch/arm/samsung/exynos_sscom.c:1.10
--- src/sys/arch/arm/samsung/exynos_sscom.c:1.9	Sat Jun 10 23:23:05 2017
+++ src/sys/arch/arm/samsung/exynos_sscom.c	Mon Jun 19 21:58:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_sscom.c,v 1.9 2017/06/10 23:23:05 jmcneill Exp $ */
+/*	$NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2014 Reinoud Zandijk
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.9 2017/06/10 23:23:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_sscom.c,v 1.10 2017/06/19 21:58:13 jmcneill Exp $");
 
 #include "opt_sscom.h"
 #include "opt_ddb.h"
@@ -155,6 +155,7 @@ sscom_attach(device_t parent, device_t s
 	bus_space_tag_t bst = faa->faa_bst;
 	bus_space_handle_t bsh;
 	struct clk *clk_uart, *clk_uart_baud0;
+	char intrstr[128];
 	bus_addr_t addr;
 	bus_size_t size;
 
@@ -169,13 +170,19 @@ sscom_attach(device_t parent, device_t s
 	}
 
 	clk_uart = fdtbus_clock_get(phandle, "uart");
+	if (clk_uart != NULL) {
+		if (clk_enable(clk_uart) != 0) {
+			aprint_error(": couldn't enable uart clock\n");
+			return;
+		}
+	}
 	clk_uart_baud0 = fdtbus_clock_get(phandle, "clk_uart_baud0");
-	if (clk_uart == NULL || clk_uart_baud0 == NULL) {
-		aprint_error(": couldn't get clocks\n");
+	if (clk_uart_baud0 == NULL) {
+		aprint_error(": couldn't get baud clock\n");
 		return;
 	}
-	if (clk_enable(clk_uart) != 0 || clk_enable(clk_uart_baud0) != 0) {
-		aprint_error(": couldn't enable clocks\n");
+	if (clk_enable(clk_uart_baud0) != 0) {
+		aprint_error(": couldn't enable baud clock\n");
 		return;
 	}
 
@@ -183,7 +190,7 @@ sscom_attach(device_t parent, device_t s
 	sc->sc_iot = bst = faa->faa_bst;
 	sc->sc_ioh = bsh;
 	sc->sc_unit = phandle;
-	sc->sc_frequency = clk_get_rate(clk_uart);
+	sc->sc_frequency = clk_get_rate(clk_uart_baud0);
 
 	sc->sc_change_txrx_interrupts = exynos_change_txrx_interrupts;
 	sc->sc_clear_interrupts = exynos_clear_interrupts;
@@ -197,11 +204,18 @@ sscom_attach(device_t parent, device_t s
 
 	aprint_normal("\n");
 
+	if (!fdtbus_intr_str(phandle, 0, intrstr, sizeof(intrstr))) {
+		aprint_error_dev(self, "failed to decode interrupt\n");
+		return;
+	}
+
 	void *ih = fdtbus_intr_establish(phandle, 0, IPL_SERIAL,
 	FDT_INTR_MPSAFE, sscomintr, sc);
 	if (ih == NULL)
 		aprint_error_dev(self, "failed to establish interrupt\n");
 
+	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
+
 	sscom_attach_subr(sc);
 
 }



CVS commit: [jdolecek-ncq] src/sys/dev

2017-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jun 19 21:00:00 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq ata.c atavar.h satapmp_subr.c
wd.c
src/sys/dev/ic [jdolecek-ncq]: ahcisata_core.c mvsata.c siisata.c wdc.c
src/sys/dev/scsipi [jdolecek-ncq]: atapi_wdc.c
src/sys/dev/usb [jdolecek-ncq]: umass_isdata.c

Log Message:
add ata_channel lock, use it to protect queue manipulation (only that for now);
add ata_channel_detach() to destroy the locks

change ata_get_xfer() so that it can wait for xfer, convert all on-stack
xfer code to use the blocking variant

fix siisata_reset_drive() to use polled reset and not try ata_activate_xfer(),
convert drive probe code also over from slot0 XXX to ata_get_xfer()

drive reset and PMP now works on siisata(4) too; changes tested also
on piixide(4), ahci(4), mvsata(4)


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.17 -r1.1.2.18 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.132.8.10 -r1.132.8.11 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.92.8.9 -r1.92.8.10 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.12.24.2 -r1.12.24.3 src/sys/dev/ata/satapmp_subr.c
cvs rdiff -u -r1.428.2.17 -r1.428.2.18 src/sys/dev/ata/wd.c
cvs rdiff -u -r1.57.6.13 -r1.57.6.14 src/sys/dev/ic/ahcisata_core.c
cvs rdiff -u -r1.35.6.11 -r1.35.6.12 src/sys/dev/ic/mvsata.c
cvs rdiff -u -r1.30.4.16 -r1.30.4.17 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.283.2.5 -r1.283.2.6 src/sys/dev/ic/wdc.c
cvs rdiff -u -r1.123.4.5 -r1.123.4.6 src/sys/dev/scsipi/atapi_wdc.c
cvs rdiff -u -r1.33.4.2 -r1.33.4.3 src/sys/dev/usb/umass_isdata.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/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.17 src/sys/dev/ata/TODO.ncq:1.1.2.18
--- src/sys/dev/ata/TODO.ncq:1.1.2.17	Sat Jun 17 19:24:26 2017
+++ src/sys/dev/ata/TODO.ncq	Mon Jun 19 21:00:00 2017
@@ -6,11 +6,11 @@ fix crashdump for mvsata - request times
 siisata - fix all new XXX and unmergable bits, fix PMP
 
 test crashdump with siisata
-
-reset channel and PMP doesn't work with siisata - siisata_reset_drive()
-uses ata_get_xfer() and this can clash on slot 0 with on-stack xfers
+- fails with recursive panic via pmap_kremove_local() regardless if
+  drive connected via PMP or direct
 
 test wd* at umass?, confirm the ata_channel kludge works
++ add detach code (channel detach, free queue)
 
 is ata_exec_xfer() + POLL safe wrt. more outstanding I/Os? why is it waiting
 until xfer is head of queue? also layer violation with the ata_xfer_free() call
@@ -30,6 +30,10 @@ drive rescaned after detach of non-NCQ d
   to have active or pending transfers (e.g. when non-NCQ device is attached
   while there is already NCQ device present)
 
+add mechanics to re-check queue when xfer is finished - needed on PMP
+and for IDE disks, when one drive uses up all available xfers nothing
+ever restarts queue for the other drives
+
 Other random notes (do outside the NCQ branch):
 -
 change wd(4) to use dk_open()

Index: src/sys/dev/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.132.8.10 src/sys/dev/ata/ata.c:1.132.8.11
--- src/sys/dev/ata/ata.c:1.132.8.10	Sat Jun 17 14:01:36 2017
+++ src/sys/dev/ata/ata.c	Mon Jun 19 21:00:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.132.8.10 2017/06/17 14:01:36 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.132.8.11 2017/06/19 21:00:00 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.10 2017/06/17 14:01:36 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.11 2017/06/19 21:00:00 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -129,6 +129,9 @@ static bool atabus_resume(device_t, cons
 static bool atabus_suspend(device_t, const pmf_qual_t *);
 static void atabusconfig_thread(void *);
 
+static void ata_xfer_init(struct ata_xfer *, bool);
+static void ata_xfer_destroy(struct ata_xfer *);
+
 /*
  * atabus_init:
  *
@@ -221,7 +224,7 @@ ata_queue_active_xfer_peek(struct ata_qu
 	return TAILQ_FIRST(>active_xfers);
 }
 
-void
+static void
 ata_xfer_init(struct ata_xfer *xfer, bool zero)
 {
 	if (zero)
@@ -230,7 +233,7 @@ ata_xfer_init(struct ata_xfer *xfer, boo
 	callout_init(>c_timo_callout, 0); 	/* XXX MPSAFE */
 }
 
-void
+static void
 ata_xfer_destroy(struct ata_xfer *xfer)
 {
 	callout_halt(>c_timo_callout, NULL);	/* XXX MPSAFE */
@@ -257,6 +260,8 @@ ata_queue_alloc(uint8_t openings)
 	chq->queue_openings = openings;
 	ata_queue_reset(chq);
 
+	cv_init(>queue_busy, "ataqbusy");
+
 	for (uint8_t i = 0; i < openings; i++)
 		ata_xfer_init(>queue_xfers[i], false);
 
@@ -283,6 +288,12 @@ ata_queue_free(struct ata_queue *chq)
 	free(chq, M_DEVBUF);
 }
 
+void
+ata_channel_init(struct ata_channel *chp)
+{
+	mutex_init(>ch_lock, MUTEX_DEFAULT, IPL_BIO);
+}
+
 /*
  * 

CVS commit: src/sys/dev/scsipi

2017-06-19 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Mon Jun 19 20:52:20 UTC 2017

Modified Files:
src/sys/dev/scsipi: scsipi_base.c

Log Message:
pass config_detach error to caller.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/dev/scsipi/scsipi_base.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/scsipi/scsipi_base.c
diff -u src/sys/dev/scsipi/scsipi_base.c:1.176 src/sys/dev/scsipi/scsipi_base.c:1.177
--- src/sys/dev/scsipi/scsipi_base.c:1.176	Sat Jun 17 22:35:50 2017
+++ src/sys/dev/scsipi/scsipi_base.c	Mon Jun 19 20:52:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: scsipi_base.c,v 1.176 2017/06/17 22:35:50 mlelstv Exp $	*/
+/*	$NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.176 2017/06/17 22:35:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.177 2017/06/19 20:52:20 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_scsi.h"
@@ -2403,7 +2403,7 @@ scsipi_target_detach(struct scsipi_chann
 	device_t tdev;
 	int ctarget, mintarget, maxtarget;
 	int clun, minlun, maxlun;
-	int error;
+	int error = 0;
 
 	if (target == -1) {
 		mintarget = 0;
@@ -2453,7 +2453,7 @@ scsipi_target_detach(struct scsipi_chann
 out:
 	KERNEL_UNLOCK_ONE(curlwp);
 
-	return 0;
+	return error;
 }
 
 /*



CVS commit: src/external/bsd

2017-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 19 20:12:34 UTC 2017

Modified Files:
src/external/bsd/elftosb/usr.sbin/elftosb: Makefile
src/external/bsd/mdocml/bin/mandoc: Makefile

Log Message:
Use -v to get the expanded variables.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/elftosb/usr.sbin/elftosb/Makefile
cvs rdiff -u -r1.11 -r1.12 src/external/bsd/mdocml/bin/mandoc/Makefile

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

Modified files:

Index: src/external/bsd/elftosb/usr.sbin/elftosb/Makefile
diff -u src/external/bsd/elftosb/usr.sbin/elftosb/Makefile:1.4 src/external/bsd/elftosb/usr.sbin/elftosb/Makefile:1.5
--- src/external/bsd/elftosb/usr.sbin/elftosb/Makefile:1.4	Wed May  1 23:56:39 2013
+++ src/external/bsd/elftosb/usr.sbin/elftosb/Makefile	Mon Jun 19 16:12:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2013/05/02 03:56:39 matt Exp $
+# $NetBSD: Makefile,v 1.5 2017/06/19 20:12:34 christos Exp $
 
 .include 
 .include 
@@ -19,7 +19,7 @@ SRCS=		BootImageGenerator.cpp \
 		elftosb_parser.tab.cpp
 
 .ifdef HOSTPROG
-SRCS.lib!=cd ${.PARSEDIR}/../../lib && ${MAKE} -V '$${SRCS}'
+SRCS.lib!=cd ${.PARSEDIR}/../../lib && ${MAKE} -v SRCS
 SRCS+=${SRCS.lib}
 .endif
 

Index: src/external/bsd/mdocml/bin/mandoc/Makefile
diff -u src/external/bsd/mdocml/bin/mandoc/Makefile:1.11 src/external/bsd/mdocml/bin/mandoc/Makefile:1.12
--- src/external/bsd/mdocml/bin/mandoc/Makefile:1.11	Fri Jul 15 15:40:42 2016
+++ src/external/bsd/mdocml/bin/mandoc/Makefile	Mon Jun 19 16:12:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2016/07/15 19:40:42 christos Exp $
+# $NetBSD: Makefile,v 1.12 2017/06/19 20:12:34 christos Exp $
 
 .include 
 
@@ -15,7 +15,7 @@ DPADD+= 	${MDOCMLLIB.mandoc} ${LIBZ}
 LDADD+= 	-L${MDOCMLOBJDIR.mandoc} -lmandoc -lz
 CPPFLAGS+=	-DUSE_WCHAR
 .else
-SRCS.libmandoc!=cd ${.PARSEDIR}/../../lib/libmandoc && ${MAKE} -V '$${SRCS}'
+SRCS.libmandoc!=cd ${.PARSEDIR}/../../lib/libmandoc && ${MAKE} -v SRCS
 
 SRCS+=		${SRCS.libmandoc} compat_strtonum.c compat_reallocarray.c
 .endif



CVS commit: src/etc

2017-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 19 20:10:18 UTC 2017

Modified Files:
src/etc: Makefile

Log Message:
use -v to get the expanded variable.


To generate a diff of this commit:
cvs rdiff -u -r1.430 -r1.431 src/etc/Makefile

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

Modified files:

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.430 src/etc/Makefile:1.431
--- src/etc/Makefile:1.430	Sat Jun 17 22:43:43 2017
+++ src/etc/Makefile	Mon Jun 19 16:10:18 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.430 2017/06/18 02:43:43 christos Exp $
+#	$NetBSD: Makefile,v 1.431 2017/06/19 20:10:18 christos Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -625,7 +625,7 @@ kernset-${configfile}: .PHONY build_kern
 			echo "echo $${kernels} | $${pax_cmd}"; \
 			( echo "/set uname=${BINOWN} gname=${BINGRP}"; \
 			echo ". type=dir optional"; \
-			dtblist=$$(${MAKE} -V DTB); \
+			dtblist=$$(${MAKE} -v DTB); \
 			for dtb in $${dtblist}; do \
 echo "./$${dtb} type=file"; \
 			done; \
@@ -652,7 +652,7 @@ releasekern-${configfile}: .PHONY build_
 	kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \
 	dest="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel"; \
 	cd $${kerndir} && {	\
-		dtblist=$$(${MAKE} -V DTB); \
+		dtblist=$$(${MAKE} -v DTB); \
 		for dtb in $${dtblist}; do \
 			[ ! -f $${dtb} ] && continue; \
 			dtb_gz="$${dest}/$${dtb}.gz"; \



CVS commit: src/usr.bin/make

2017-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 19 19:58:24 UTC 2017

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

Log Message:
Add -v variable that always expands variables; restore -V the way it was.


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/usr.bin/make/main.c
cvs rdiff -u -r1.266 -r1.267 src/usr.bin/make/make.1

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.271 src/usr.bin/make/main.c:1.272
--- src/usr.bin/make/main.c:1.271	Mon Jun 19 11:49:21 2017
+++ src/usr.bin/make/main.c	Mon Jun 19 15:58:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.272 2017/06/19 19:58:24 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -155,7 +155,9 @@ Boolean			deleteOnError;	/* .DELETE_ON_E
 
 static Boolean		noBuiltins;	/* -r flag */
 static Lst		makefiles;	/* ordered list of makefiles to read */
-static Boolean		printVars;	/* print value of one or more vars */
+static int		printVars;	/* -[vV] argument */
+#define COMPAT_VARS 1
+#define EXPAND_VARS 2
 static Lst		variables;	/* list of variables to print */
 int			maxJobs;	/* -j argument */
 static int		maxJobTokens;	/* -j argument */
@@ -408,7 +410,7 @@ MainParseArgs(int argc, char **argv)
 	Boolean inOption, dashDash = FALSE;
 	char found_path[MAXPATHLEN + 1];	/* for searching for sys.mk */
 
-#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstw"
+#define OPTFLAGS "BC:D:I:J:NST:V:WXd:ef:ij:km:nqrstv:w"
 /* Can't actually use getopt(3) because rescanning is not portable */
 
 	getopt_def = OPTFLAGS;
@@ -533,8 +535,9 @@ rearg:	
 			Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
 			break;
 		case 'V':
+		case 'v':
 			if (argvalue == NULL) goto noarg;
-			printVars = TRUE;
+			printVars = c == 'v' ? EXPAND_VARS : COMPAT_VARS;
 			(void)Lst_AtEnd(variables, argvalue);
 			Var_Append(MAKEFLAGS, "-V", VAR_GLOBAL);
 			Var_Append(MAKEFLAGS, argvalue, VAR_GLOBAL);
@@ -852,10 +855,12 @@ doPrintVars(void)
 	LstNode ln;
 	Boolean expandVars;
 
-	if (debugVflag)
+	if (printVars == EXPAND_VARS)
+		expandVars = TRUE;
+	else if (debugVflag)
 		expandVars = FALSE;
 	else
-		expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", TRUE);
+		expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
 
 	for (ln = Lst_First(variables); ln != NULL;
 	ln = Lst_Succ(ln)) {
@@ -1072,7 +1077,7 @@ main(int argc, char **argv)
 
 	create = Lst_Init(FALSE);
 	makefiles = Lst_Init(FALSE);
-	printVars = FALSE;
+	printVars = 0;
 	debugVflag = FALSE;
 	variables = Lst_Init(FALSE);
 	beSilent = FALSE;		/* Print commands as executed */
@@ -1917,7 +1922,8 @@ usage(void)
 "usage: %s [-BeikNnqrstWwX] \n\
 [-C directory] [-D variable] [-d flags] [-f makefile]\n\
 [-I directory] [-J private] [-j max_jobs] [-m directory] [-T file]\n\
-[-V variable] [variable=value] [target ...]\n", progname);
+[-V variable] [-v variable] [variable=value] [target ...]\n",
+	progname);
 	exit(2);
 }
 

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.266 src/usr.bin/make/make.1:1.267
--- src/usr.bin/make/make.1:1.266	Wed Feb  1 13:39:27 2017
+++ src/usr.bin/make/make.1	Mon Jun 19 15:58:24 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.266 2017/02/01 18:39:27 sjg Exp $
+.\"	$NetBSD: make.1,v 1.267 2017/06/19 19:58:24 christos Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd February 1, 2017
+.Dd June 19, 2017
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -48,6 +48,7 @@
 .Op Fl m Ar directory
 .Op Fl T Ar file
 .Op Fl V Ar variable
+.Op Fl v Ar variable
 .Op Ar variable=value
 .Op Ar target ...
 .Sh DESCRIPTION
@@ -348,6 +349,10 @@ If
 contains a
 .Ql \&$
 then the value will be expanded before printing.
+.It Fl v Ar variable
+Like 
+.Fl V
+but the variable is always expanded to its final value.
 .It Fl W
 Treat any warnings during makefile parsing as errors.
 .It Fl w



CVS commit: src/sys/kern

2017-06-19 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Jun 19 19:02:16 UTC 2017

Modified Files:
src/sys/kern: exec_subr.c

Log Message:
Revert for the moment, creates problems on i386.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/kern/exec_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/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.79 src/sys/kern/exec_subr.c:1.80
--- src/sys/kern/exec_subr.c:1.79	Mon Jun 19 15:53:16 2017
+++ src/sys/kern/exec_subr.c	Mon Jun 19 19:02:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.79 2017/06/19 15:53:16 joerg Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.80 2017/06/19 19:02:16 joerg Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.79 2017/06/19 15:53:16 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.80 2017/06/19 19:02:16 joerg Exp $");
 
 #include "opt_pax.h"
 
@@ -67,8 +67,6 @@ VMCMD_EVCNT_DECL(kills);
 #define DPRINTF(a)
 #endif
 
-uint32_t user_stack_guard_size = 1024 * 1024;
-
 /*
  * new_vmcmd():
  *	create a new vmcmd structure and fill in its fields based
@@ -442,17 +440,6 @@ exec_setup_stack(struct lwp *l, struct e
 	(uintmax_t)access_size, (uintmax_t)access_linear_min,
 	(uintmax_t)noaccess_size, (uintmax_t)noaccess_linear_min));
 
-	if (user_stack_guard_size > 0) {
-#ifdef __MACHINE_STACK_GROWS_UP
-		vsize_t guard_size = MIN(VM_MAXUSER_ADDRESS - epp->ep_maxsaddr, user_stack_guard_size);
-		if (guard_size > 0)
-			NEW_VMCMD(>ep_vmcmds, vmcmd_map_zero, guard_size,
-			epp->ep_maxsaddr, NULL, 0, VM_PROT_NONE);
-#else
-		NEW_VMCMD(>ep_vmcmds, vmcmd_map_zero, user_stack_guard_size,
-		epp->ep_maxsaddr - user_stack_guard_size, NULL, 0, VM_PROT_NONE);
-#endif
-	}
 	if (noaccess_size > 0 && noaccess_size <= MAXSSIZ) {
 		NEW_VMCMD2(>ep_vmcmds, vmcmd_map_zero, noaccess_size,
 		noaccess_linear_min, NULL, 0, VM_PROT_NONE, VMCMD_STACK);



CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-06-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jun 19 17:11:24 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: wd.c

Log Message:
ata subsystem needs more work before wd(4) could be MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.428.2.16 -r1.428.2.17 src/sys/dev/ata/wd.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/wd.c
diff -u src/sys/dev/ata/wd.c:1.428.2.16 src/sys/dev/ata/wd.c:1.428.2.17
--- src/sys/dev/ata/wd.c:1.428.2.16	Fri Jun 16 20:40:49 2017
+++ src/sys/dev/ata/wd.c	Mon Jun 19 17:11:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.428.2.16 2017/06/16 20:40:49 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.428.2.17 2017/06/19 17:11:24 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.16 2017/06/16 20:40:49 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.428.2.17 2017/06/19 17:11:24 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -150,7 +150,7 @@ const struct bdevsw wd_bdevsw = {
 	.d_dump = wddump,
 	.d_psize = wdsize,
 	.d_discard = wddiscard,
-	.d_flag = D_DISK | D_MPSAFE
+	.d_flag = D_DISK
 };
 
 const struct cdevsw wd_cdevsw = {
@@ -165,7 +165,7 @@ const struct cdevsw wd_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = nokqfilter,
 	.d_discard = wddiscard,
-	.d_flag = D_DISK | D_MPSAFE
+	.d_flag = D_DISK
 };
 
 /* #define WD_DUMP_NOT_TRUSTED if you just want to watch */
@@ -298,7 +298,7 @@ wdattach(device_t parent, device_t self,
 	wd->sc_dev = self;
 
 	ATADEBUG_PRINT(("wdattach\n"), DEBUG_FUNCS | DEBUG_PROBE);
-	callout_init(>sc_restart_ch, CALLOUT_MPSAFE);
+	callout_init(>sc_restart_ch, 0);
 	callout_setfunc(>sc_restart_ch, wdrestart, wd);
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_BIO);
 	bufq_alloc(>sc_q, BUFQ_DISK_DEFAULT_STRAT, BUFQ_SORT_RAWBLOCK);



CVS commit: src/sys/kern

2017-06-19 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Jun 19 15:53:16 UTC 2017

Modified Files:
src/sys/kern: exec_subr.c

Log Message:
Always include a 1MB guard area beyond the end of stack. While ASLR will
normally create a guard area as well, this provides a deterministic area
for all binaries.

Mitigates the rest of CVE-2017-1000374 and CVE-2017-1000375 from
Qualys.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/kern/exec_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/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.78 src/sys/kern/exec_subr.c:1.79
--- src/sys/kern/exec_subr.c:1.78	Sun May  7 22:54:54 2017
+++ src/sys/kern/exec_subr.c	Mon Jun 19 15:53:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.78 2017/05/07 22:54:54 christos Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.79 2017/06/19 15:53:16 joerg Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.78 2017/05/07 22:54:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_subr.c,v 1.79 2017/06/19 15:53:16 joerg Exp $");
 
 #include "opt_pax.h"
 
@@ -67,6 +67,8 @@ VMCMD_EVCNT_DECL(kills);
 #define DPRINTF(a)
 #endif
 
+uint32_t user_stack_guard_size = 1024 * 1024;
+
 /*
  * new_vmcmd():
  *	create a new vmcmd structure and fill in its fields based
@@ -440,6 +442,17 @@ exec_setup_stack(struct lwp *l, struct e
 	(uintmax_t)access_size, (uintmax_t)access_linear_min,
 	(uintmax_t)noaccess_size, (uintmax_t)noaccess_linear_min));
 
+	if (user_stack_guard_size > 0) {
+#ifdef __MACHINE_STACK_GROWS_UP
+		vsize_t guard_size = MIN(VM_MAXUSER_ADDRESS - epp->ep_maxsaddr, user_stack_guard_size);
+		if (guard_size > 0)
+			NEW_VMCMD(>ep_vmcmds, vmcmd_map_zero, guard_size,
+			epp->ep_maxsaddr, NULL, 0, VM_PROT_NONE);
+#else
+		NEW_VMCMD(>ep_vmcmds, vmcmd_map_zero, user_stack_guard_size,
+		epp->ep_maxsaddr - user_stack_guard_size, NULL, 0, VM_PROT_NONE);
+#endif
+	}
 	if (noaccess_size > 0 && noaccess_size <= MAXSSIZ) {
 		NEW_VMCMD2(>ep_vmcmds, vmcmd_map_zero, noaccess_size,
 		noaccess_linear_min, NULL, 0, VM_PROT_NONE, VMCMD_STACK);



CVS commit: src/usr.bin/make

2017-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 19 15:49:21 UTC 2017

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

Log Message:
make the code look like to 1.266


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

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.270 src/usr.bin/make/main.c:1.271
--- src/usr.bin/make/main.c:1.270	Mon Jun 19 10:59:06 2017
+++ src/usr.bin/make/main.c	Mon Jun 19 11:49:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.271 2017/06/19 15:49:21 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -862,10 +862,6 @@ doPrintVars(void)
 		char *var = (char *)Lst_Datum(ln);
 		char *value;
 		char *p1;
-		Boolean noExpand;
-
-		if ((noExpand = (*var == '\\'))) 
-			var++;
 		
 		if (strchr(var, '$')) {
 			value = p1 = Var_Subst(NULL, var, VAR_GLOBAL,
@@ -880,7 +876,7 @@ doPrintVars(void)
 			value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
 			VARF_WANTRES);
 		} else {
-			value = p1 = Var_Value(var, VAR_GLOBAL, );
+			value = Var_Value(var, VAR_GLOBAL, );
 		}
 		printf("%s\n", value ? value : "");
 		free(p1);



CVS commit: src/usr.bin/make

2017-06-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jun 19 14:59:06 UTC 2017

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

Log Message:
Remove previous variable expansion code; sjg had already added the code to
do it. Note that the manual page already documents this behavior and does
not need to change:

-dV -V VAR: prints the raw variable
-V VAR: prints the expanded variable


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

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

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.269 src/usr.bin/make/main.c:1.270
--- src/usr.bin/make/main.c:1.269	Sat Jun 17 15:59:28 2017
+++ src/usr.bin/make/main.c	Mon Jun 19 10:59:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.269 2017/06/17 19:59:28 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.269 2017/06/17 19:59:28 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.269 2017/06/17 19:59:28 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.270 2017/06/19 14:59:06 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -855,7 +855,7 @@ doPrintVars(void)
 	if (debugVflag)
 		expandVars = FALSE;
 	else
-		expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", FALSE);
+		expandVars = getBoolean(".MAKE.EXPAND_VARIABLES", TRUE);
 
 	for (ln = Lst_First(variables); ln != NULL;
 	ln = Lst_Succ(ln)) {
@@ -880,13 +880,7 @@ doPrintVars(void)
 			value = p1 = Var_Subst(NULL, tmp, VAR_GLOBAL,
 			VARF_WANTRES);
 		} else {
-			value = Var_Value(var, VAR_GLOBAL, );
-			if (!noExpand && value && *value == '$') {
-value = Var_Subst(NULL, value,
-VAR_GLOBAL, VARF_WANTRES);
-free(p1);
-p1 = value;
-			}
+			value = p1 = Var_Value(var, VAR_GLOBAL, );
 		}
 		printf("%s\n", value ? value : "");
 		free(p1);



CVS commit: src/sys/ufs/lfs

2017-06-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Jun 19 12:09:37 UTC 2017

Modified Files:
src/sys/ufs/lfs: lfs_subr.c

Log Message:
Ifdef out KDASSERT which fires on my machine.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/ufs/lfs/lfs_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/ufs/lfs/lfs_subr.c
diff -u src/sys/ufs/lfs/lfs_subr.c:1.94 src/sys/ufs/lfs/lfs_subr.c:1.95
--- src/sys/ufs/lfs/lfs_subr.c:1.94	Sat Jun 10 05:29:36 2017
+++ src/sys/ufs/lfs/lfs_subr.c	Mon Jun 19 12:09:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_subr.c,v 1.94 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: lfs_subr.c,v 1.95 2017/06/19 12:09:37 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.94 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_subr.c,v 1.95 2017/06/19 12:09:37 maya Exp $");
 
 #include 
 #include 
@@ -261,10 +261,12 @@ lfs_free(struct lfs *fs, void *p, int ty
 		}
 	}
 
+#ifdef notyet /* XXX this assert fires */
 	for (int i = 0; i < LFS_N_TOTAL; i++) {
 		KDASSERTMSG(fs->lfs_resblk[i].p == p,
 		"lfs_free: inconsistent reserved block");
 	}
+#endif
 
 	mutex_exit(_lock);
 



CVS commit: src/libexec/ld.elf_so

2017-06-19 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Jun 19 11:57:02 UTC 2017

Modified Files:
src/libexec/ld.elf_so: Makefile map_object.c rtld.h symbol.c
src/libexec/ld.elf_so/arch/aarch64: mdreloc.c
src/libexec/ld.elf_so/arch/alpha: alpha_reloc.c
src/libexec/ld.elf_so/arch/arm: mdreloc.c
src/libexec/ld.elf_so/arch/hppa: hppa_reloc.c
src/libexec/ld.elf_so/arch/i386: mdreloc.c
src/libexec/ld.elf_so/arch/m68k: mdreloc.c
src/libexec/ld.elf_so/arch/mips: mips_reloc.c
src/libexec/ld.elf_so/arch/or1k: mdreloc.c
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c
src/libexec/ld.elf_so/arch/riscv: mdreloc.c
src/libexec/ld.elf_so/arch/sh3: mdreloc.c
src/libexec/ld.elf_so/arch/sparc: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64: mdreloc.c
src/libexec/ld.elf_so/arch/vax: mdreloc.c
src/libexec/ld.elf_so/arch/x86_64: mdreloc.c

Log Message:
Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.

The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r1.57 -r1.58 src/libexec/ld.elf_so/map_object.c
cvs rdiff -u -r1.126 -r1.127 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.67 -r1.68 src/libexec/ld.elf_so/symbol.c
cvs rdiff -u -r1.2 -r1.3 src/libexec/ld.elf_so/arch/aarch64/mdreloc.c
cvs rdiff -u -r1.41 -r1.42 src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c
cvs rdiff -u -r1.38 -r1.39 src/libexec/ld.elf_so/arch/arm/mdreloc.c
cvs rdiff -u -r1.43 -r1.44 src/libexec/ld.elf_so/arch/hppa/hppa_reloc.c
cvs rdiff -u -r1.37 -r1.38 src/libexec/ld.elf_so/arch/i386/mdreloc.c
cvs rdiff -u -r1.31 -r1.32 src/libexec/ld.elf_so/arch/m68k/mdreloc.c
cvs rdiff -u -r1.65 -r1.66 src/libexec/ld.elf_so/arch/mips/mips_reloc.c
cvs rdiff -u -r1.1 -r1.2 src/libexec/ld.elf_so/arch/or1k/mdreloc.c
cvs rdiff -u -r1.53 -r1.54 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
cvs rdiff -u -r1.2 -r1.3 src/libexec/ld.elf_so/arch/riscv/mdreloc.c
cvs rdiff -u -r1.32 -r1.33 src/libexec/ld.elf_so/arch/sh3/mdreloc.c
cvs rdiff -u -r1.49 -r1.50 src/libexec/ld.elf_so/arch/sparc/mdreloc.c
cvs rdiff -u -r1.60 -r1.61 src/libexec/ld.elf_so/arch/sparc64/mdreloc.c
cvs rdiff -u -r1.31 -r1.32 src/libexec/ld.elf_so/arch/vax/mdreloc.c
cvs rdiff -u -r1.41 -r1.42 src/libexec/ld.elf_so/arch/x86_64/mdreloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/Makefile
diff -u src/libexec/ld.elf_so/Makefile:1.136 src/libexec/ld.elf_so/Makefile:1.137
--- src/libexec/ld.elf_so/Makefile:1.136	Thu Dec  1 14:29:15 2016
+++ src/libexec/ld.elf_so/Makefile	Mon Jun 19 11:57:01 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.136 2016/12/01 14:29:15 christos Exp $
+#	$NetBSD: Makefile,v 1.137 2017/06/19 11:57:01 joerg Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -97,7 +97,6 @@ CPPFLAGS+=	-I${.CURDIR} -I. -D_KERNTYPES
 CPPFLAGS+=	-DRTLD_LOADER
 CPPFLAGS+=	-DGNU_RELRO
 CPPFLAGS+=	-D_RTLD_SOURCE
-CPPFLAGS+=	-DCOMBRELOC
 #CPPFLAGS+=	-DDEBUG
 #CPPFLAGS+=	-DRTLD_DEBUG
 #CPPFLAGS+=	-DRTLD_DEBUG_RELOC

Index: src/libexec/ld.elf_so/map_object.c
diff -u src/libexec/ld.elf_so/map_object.c:1.57 src/libexec/ld.elf_so/map_object.c:1.58
--- src/libexec/ld.elf_so/map_object.c:1.57	Fri Mar 10 09:13:49 2017
+++ src/libexec/ld.elf_so/map_object.c	Mon Jun 19 11:57:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: map_object.c,v 1.57 2017/03/10 09:13:49 maya Exp $	 */
+/*	$NetBSD: map_object.c,v 1.58 2017/06/19 11:57:01 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -34,7 +34,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: map_object.c,v 1.57 2017/03/10 09:13:49 maya Exp $");
+__RCSID("$NetBSD: map_object.c,v 1.58 2017/06/19 11:57:01 joerg Exp $");
 #endif /* not lint */
 
 #include 
@@ -462,9 +462,6 @@ _rtld_obj_free(Obj_Entry *obj)
 	}
 	if (!obj->phdr_loaded)
 		xfree((void *)(uintptr_t)obj->phdr);
-#ifdef COMBRELOC
-	_rtld_combreloc_reset(obj);
-#endif
 	xfree(obj);
 }
 

Index: src/libexec/ld.elf_so/rtld.h
diff -u src/libexec/ld.elf_so/rtld.h:1.126 src/libexec/ld.elf_so/rtld.h:1.127
--- src/libexec/ld.elf_so/rtld.h:1.126	Wed Nov 30 19:43:32 2016
+++ src/libexec/ld.elf_so/rtld.h	Mon Jun 19 11:57:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.h,v 1.126 2016/11/30 19:43:32 christos Exp $	 */
+/*	$NetBSD: rtld.h,v 1.127 2017/06/19 

CVS commit: src/bin/sh

2017-06-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Jun 19 11:55:07 UTC 2017

Modified Files:
src/bin/sh: mknodenames.sh

Log Message:
It is amazing what nonsense appears to work sometimes... (all my nonsense too!)

Two bugs here, one benign because of the way the script is used.
The other hidden by NetBSD's sort being stable, and the data not really
requiring sorting at all...

So as it happens these fixes change nothing, but they are needed anyway.

(The contents of the generated file are only used in DEBUG shells, so
this is really even less important than it seems.)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/bin/sh/mknodenames.sh

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

Modified files:

Index: src/bin/sh/mknodenames.sh
diff -u src/bin/sh/mknodenames.sh:1.3 src/bin/sh/mknodenames.sh:1.4
--- src/bin/sh/mknodenames.sh:1.3	Sun Mar 27 14:34:46 2016
+++ src/bin/sh/mknodenames.sh	Mon Jun 19 11:55:07 2017
@@ -7,7 +7,7 @@ fi
 
 NODES=$1
 
-test -t 1 && -z "$2" && exec > nodenames.h
+test -t 1 && test -z "$2" && exec > nodenames.h
 
 echo "#ifdef DEBUG"
 echo '
@@ -28,7 +28,7 @@ echo
 echo '#ifdef DEFINE_NODENAMES'
 echo "STATIC const char * const NodeNames[${MAX} + 1] = {"
 
-grep '^#define' "$NODES" | sort -k2n | while read define name number opt_comment
+grep '^#define' "$NODES" | sort -k3n | while read define name number opt_comment
 do
 	: ${next:=0}
 	while [ "$number" -gt "$next" ]



CVS commit: src/sys/dev/pci

2017-06-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Jun 19 10:59:01 UTC 2017

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

Log Message:
 Set WMREG_KABGTXD not in wm_init_locked() but in wm_reset(). Same as other 
OSes.


To generate a diff of this commit:
cvs rdiff -u -r1.509 -r1.510 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.509 src/sys/dev/pci/if_wm.c:1.510
--- src/sys/dev/pci/if_wm.c:1.509	Mon Jun 12 03:03:22 2017
+++ src/sys/dev/pci/if_wm.c	Mon Jun 19 10:59:01 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.509 2017/06/12 03:03:22 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.510 2017/06/19 10:59:01 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.509 2017/06/12 03:03:22 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.510 2017/06/19 10:59:01 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -4335,6 +4335,15 @@ wm_reset(struct wm_softc *sc)
 			CSR_WRITE(sc, WMREG_EIAC_82574, 0);
 	}
 
+	if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9)
+	|| (sc->sc_type == WM_T_ICH10) || (sc->sc_type == WM_T_PCH)
+	|| (sc->sc_type == WM_T_PCH2) || (sc->sc_type == WM_T_PCH_LPT)
+	|| (sc->sc_type == WM_T_PCH_SPT)) {
+		reg = CSR_READ(sc, WMREG_KABGTXD);
+		reg |= KABGTXD_BGSQLBIAS;
+		CSR_WRITE(sc, WMREG_KABGTXD, reg);
+	}
+
 	/* reload sc_ctrl */
 	sc->sc_ctrl = CSR_READ(sc, WMREG_CTRL);
 
@@ -5363,15 +5372,6 @@ wm_init_locked(struct ifnet *ifp)
 	} else
 		CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
 
-	if ((sc->sc_type == WM_T_ICH8) || (sc->sc_type == WM_T_ICH9)
-	|| (sc->sc_type == WM_T_ICH10) || (sc->sc_type == WM_T_PCH)
-	|| (sc->sc_type == WM_T_PCH2) || (sc->sc_type == WM_T_PCH_LPT)
-	|| (sc->sc_type == WM_T_PCH_SPT)) {
-		reg = CSR_READ(sc, WMREG_KABGTXD);
-		reg |= KABGTXD_BGSQLBIAS;
-		CSR_WRITE(sc, WMREG_KABGTXD, reg);
-	}
-
 	/* Set up the inter-packet gap. */
 	CSR_WRITE(sc, WMREG_TIPG, sc->sc_tipg);
 



CVS commit: src/tests/net

2017-06-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 19 10:57:38 UTC 2017

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

Log Message:
Add missing declarations for cleanup


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/net/arp/t_arp.sh
cvs rdiff -u -r1.20 -r1.21 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/tests/net/arp/t_arp.sh
diff -u src/tests/net/arp/t_arp.sh:1.23 src/tests/net/arp/t_arp.sh:1.24
--- src/tests/net/arp/t_arp.sh:1.23	Fri Jun 16 04:41:02 2017
+++ src/tests/net/arp/t_arp.sh	Mon Jun 19 10:57:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_arp.sh,v 1.23 2017/06/16 04:41:02 ozaki-r Exp $
+#	$NetBSD: t_arp.sh,v 1.24 2017/06/19 10:57:37 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -598,6 +598,7 @@ arp_static_cleanup()
 	cleanup
 }
 
+atf_test_case arp_rtm cleanup
 arp_rtm_head()
 {
 

Index: src/tests/net/ndp/t_ndp.sh
diff -u src/tests/net/ndp/t_ndp.sh:1.20 src/tests/net/ndp/t_ndp.sh:1.21
--- src/tests/net/ndp/t_ndp.sh:1.20	Fri Jun 16 04:41:02 2017
+++ src/tests/net/ndp/t_ndp.sh	Mon Jun 19 10:57:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ndp.sh,v 1.20 2017/06/16 04:41:02 ozaki-r Exp $
+#	$NetBSD: t_ndp.sh,v 1.21 2017/06/19 10:57:37 ozaki-r Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -396,6 +396,7 @@ ndp_link_activation_cleanup()
 	cleanup
 }
 
+atf_test_case ndp_rtm cleanup
 ndp_rtm_head()
 {
 



CVS commit: src/share/man/man4

2017-06-19 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 19 10:07:29 UTC 2017

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

Log Message:
Replace "does support" with "supports" (more common English usage), and
replace an "either ... and" with "either ... or".


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/pxagpio.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/pxagpio.4
diff -u src/share/man/man4/pxagpio.4:1.2 src/share/man/man4/pxagpio.4:1.3
--- src/share/man/man4/pxagpio.4:1.2	Mon Jun 19 09:49:07 2017
+++ src/share/man/man4/pxagpio.4	Mon Jun 19 10:07:29 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: pxagpio.4,v 1.2 2017/06/19 09:49:07 wiz Exp $
+.\" $NetBSD: pxagpio.4,v 1.3 2017/06/19 10:07:29 pgoyette Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -41,12 +41,12 @@
 is an on-board GPIO controller found in XScale PXA250, PXA255, PXA270,
 PXA271, PXA272, and PXA273 processors manufactured by Intel and Marvell
 Technology.
-The driver does support 86 pins for PXA250 and 121 pins for PXA270
+The driver supports 86 pins for PXA250 or 121 pins for PXA270
 processor families.
 Access to the pins is provided by the
 .Xr gpio 4
 interface.
-The driver does support
+The driver supports
 .Dv GPIO_PIN_INPUT
 and
 .Dv GPIO_PIN_OUTPUT .



CVS commit: src/tests/net/ipsec

2017-06-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 19 10:05:04 UTC 2017

Modified Files:
src/tests/net/ipsec: t_ipsec_misc.sh

Log Message:
Add test cases of TCP/IPsec on an IPv4-mapped IPv6 address

It reproduces the same panic reported in PR kern/52304
(but not sure that its cause is also same).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/ipsec/t_ipsec_misc.sh

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

Modified files:

Index: src/tests/net/ipsec/t_ipsec_misc.sh
diff -u src/tests/net/ipsec/t_ipsec_misc.sh:1.6 src/tests/net/ipsec/t_ipsec_misc.sh:1.7
--- src/tests/net/ipsec/t_ipsec_misc.sh:1.6	Thu Jun  1 03:56:47 2017
+++ src/tests/net/ipsec/t_ipsec_misc.sh	Mon Jun 19 10:05:04 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_misc.sh,v 1.6 2017/06/01 03:56:47 ozaki-r Exp $
+#	$NetBSD: t_ipsec_misc.sh,v 1.7 2017/06/19 10:05:04 ozaki-r Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -313,22 +313,23 @@ prepare_file()
 
 test_tcp()
 {
-	local proto=$1
+	local local_proto=$1
 	local ip_local=$2
-	local ip_peer=$3
+	local peer_proto=$3
+	local ip_peer=$4
 	local port=1234
 	local file_send=./file.send
 	local file_recv=./file.recv
 	local opts=
 
-	if [ $proto = ipv4 ]; then
+	if [ $local_proto = ipv4 ]; then
 		opts="-N -w 3 -4"
 	else
 		opts="-N -w 3 -6"
 	fi
 
 	# Start nc server
-	start_nc_server $SOCK_PEER $port $file_recv $proto
+	start_nc_server $SOCK_PEER $port $file_recv $peer_proto
 
 	export RUMP_SERVER=$SOCK_LOCAL
 	# Send a file to the server
@@ -371,7 +372,7 @@ test_tcp_ipv4()
 
 	extract_new_packets $BUS > $outfile
 
-	test_tcp ipv4 $ip_local $ip_peer
+	test_tcp ipv4 $ip_local ipv4 $ip_peer
 
 	extract_new_packets $BUS > $outfile
 	$DEBUG && cat $outfile
@@ -415,7 +416,54 @@ test_tcp_ipv6()
 
 	extract_new_packets $BUS > $outfile
 
-	test_tcp ipv6 $ip_local $ip_peer
+	test_tcp ipv6 $ip_local ipv6 $ip_peer
+
+	extract_new_packets $BUS > $outfile
+	$DEBUG && cat $outfile
+
+	if [ $proto != none ]; then
+		atf_check -s exit:0 \
+		-o match:"$ip_local > $ip_peer: $proto_cap" \
+		cat $outfile
+		atf_check -s exit:0 \
+		-o match:"$ip_peer > $ip_local: $proto_cap" \
+		cat $outfile
+	fi
+}
+
+test_tcp_ipv4mappedipv6()
+{
+	local proto=$1
+	local algo=$2
+	local ip_local=10.0.0.1
+	local ip_peer=10.0.0.2
+	local ip6_peer=:::10.0.0.2
+	local algo_args="$(generate_algo_args $proto $algo)"
+	local proto_cap=$(echo $proto | tr 'a-z' 'A-Z')
+	local outfile=./out
+
+	rump_server_crypto_start $SOCK_LOCAL netipsec
+	rump_server_crypto_start $SOCK_PEER netipsec netinet6
+	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS
+	rump_server_add_iface $SOCK_PEER shmif0 $BUS
+
+	export RUMP_SERVER=$SOCK_LOCAL
+	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local/24
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	export RUMP_SERVER=$SOCK_PEER
+	atf_check -s exit:0 -o ignore rump.sysctl -w net.inet6.ip6.v6only=0
+	atf_check -s exit:0 rump.ifconfig shmif0 $ip_peer/24
+	atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip6_peer/96
+	atf_check -s exit:0 rump.ifconfig -w 10
+
+	if [ $proto != none ]; then
+		setup_sasp $proto "$algo_args" $ip_local $ip_peer 100
+	fi
+
+	extract_new_packets $BUS > $outfile
+
+	test_tcp ipv4 $ip_local ipv6 $ip_peer
 
 	extract_new_packets $BUS > $outfile
 	$DEBUG && cat $outfile
@@ -473,14 +521,17 @@ atf_init_test_cases()
 		add_test_lifetime ipv6 esp $algo
 		add_test_tcp ipv4 esp $algo
 		add_test_tcp ipv6 esp $algo
+		add_test_tcp ipv4mappedipv6 esp $algo
 	done
 	for algo in $AH_AUTHENTICATION_ALGORITHMS_MINIMUM; do
 		add_test_lifetime ipv4 ah $algo
 		add_test_lifetime ipv6 ah $algo
 		add_test_tcp ipv4 ah $algo
 		add_test_tcp ipv6 ah $algo
+		add_test_tcp ipv4mappedipv6 ah $algo
 	done
 
 	add_test_tcp ipv4 none
 	add_test_tcp ipv6 none
+	add_test_tcp ipv4mappedipv6 none
 }



CVS commit: src/sys/netinet

2017-06-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 19 10:04:23 UTC 2017

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

Log Message:
Fix KASSERT in tcp_input

inp can be NULL when receiving an IPv4 packet on an IPv4-mapped IPv6
address. In that case KASSERT(sotoinpcb(so) == inp) always fails.

Should fix PR kern/52304 (at least it fixes the same panic as the
report)


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/netinet/tcp_input.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/tcp_input.c
diff -u src/sys/netinet/tcp_input.c:1.357 src/sys/netinet/tcp_input.c:1.358
--- src/sys/netinet/tcp_input.c:1.357	Thu Apr 20 08:46:07 2017
+++ src/sys/netinet/tcp_input.c	Mon Jun 19 10:04:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.357 2017/04/20 08:46:07 ozaki-r Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.358 2017/06/19 10:04:23 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +148,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.357 2017/04/20 08:46:07 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.358 2017/06/19 10:04:23 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1835,7 +1835,13 @@ findpcb:
 	switch (af) {
 #ifdef INET
 	case AF_INET:
-		KASSERT(sotoinpcb(so) == inp);
+		/*
+		 * inp can be NULL when
+		 * receiving an IPv4 packet on
+		 * an IPv4-mapped IPv6 address.
+		 */
+		KASSERT(inp == NULL ||
+		sotoinpcb(so) == inp);
 		if (!ipsec4_in_reject(m, inp))
 			break;
 		IPSEC_STATINC(



CVS commit: src/share/man/man4

2017-06-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 19 09:49:07 UTC 2017

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

Log Message:
Add RCS Id. Use serial comma. Improve wording.
New sentence, new line.
Use more markup.
Remove xr to itself.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/pxagpio.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/pxagpio.4
diff -u src/share/man/man4/pxagpio.4:1.1 src/share/man/man4/pxagpio.4:1.2
--- src/share/man/man4/pxagpio.4:1.1	Fri Jun 16 22:39:34 2017
+++ src/share/man/man4/pxagpio.4	Mon Jun 19 09:49:07 2017
@@ -1,3 +1,4 @@
+.\" $NetBSD: pxagpio.4,v 1.2 2017/06/19 09:49:07 wiz Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -38,23 +39,27 @@
 .Sh DESCRIPTION
 .Nm
 is an on-board GPIO controller found in XScale PXA250, PXA255, PXA270,
-PXA271, PXA272 and PXA273 processors manufactured by Intel and Marvell
+PXA271, PXA272, and PXA273 processors manufactured by Intel and Marvell
 Technology.
-The driver does support either 86 pins for PXA250 and 121 pins for PXA270
-processor family.
+The driver does support 86 pins for PXA250 and 121 pins for PXA270
+processor families.
 Access to the pins is provided by the
 .Xr gpio 4
-interface. The driver does support GPIO_PIN_INPUT and GPIO_PIN_OUTPUT.
+interface.
+The driver does support
+.Dv GPIO_PIN_INPUT
+and
+.Dv GPIO_PIN_OUTPUT .
 GPIO pins being used in alternate configurations are not available
 for GPIO operations.
 .Sh SEE ALSO
-.Xr gpio 4 ,
-.Xr pxagpio 4
+.Xr gpio 4
 .Sh HISTORY
 The
 .Nm
 driver first appeared in
-.Nx 2.0 . GPIO attachment appeared in
+.Nx 2.0 .
+GPIO attachment appeared in
 .Nx 8.0 .
 .Sh AUTHORS
 .An -nosplit



CVS commit: src/sbin/route

2017-06-19 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Jun 19 09:46:33 UTC 2017

Modified Files:
src/sbin/route: route.8

Log Message:
Remove unnecessary Pp.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sbin/route/route.8

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

Modified files:

Index: src/sbin/route/route.8
diff -u src/sbin/route/route.8:1.57 src/sbin/route/route.8:1.58
--- src/sbin/route/route.8:1.57	Fri Jun 16 04:40:16 2017
+++ src/sbin/route/route.8	Mon Jun 19 09:46:33 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: route.8,v 1.57 2017/06/16 04:40:16 ozaki-r Exp $
+.\"	$NetBSD: route.8,v 1.58 2017/06/19 09:46:33 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -65,7 +65,6 @@ but a rich command language, enabling th
 any arbitrary request that could be delivered via the
 programmatic interface discussed in
 .Xr route 4 .
-.Pp
 .Bl -tag -width Ds
 .It Fl d
 Turn on debugging



CVS commit: src/tests/net

2017-06-19 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Jun 19 09:20:29 UTC 2017

Modified Files:
src/tests/net: net_common.sh

Log Message:
Do netstat -a for an appropriate protocol


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/net_common.sh

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

Modified files:

Index: src/tests/net/net_common.sh
diff -u src/tests/net/net_common.sh:1.18 src/tests/net/net_common.sh:1.19
--- src/tests/net/net_common.sh:1.18	Fri Jun  2 01:18:51 2017
+++ src/tests/net/net_common.sh	Mon Jun 19 09:20:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: net_common.sh,v 1.18 2017/06/02 01:18:51 ozaki-r Exp $
+#	$NetBSD: net_common.sh,v 1.19 2017/06/19 09:20:29 ozaki-r Exp $
 #
 # Copyright (c) 2016 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -157,7 +157,11 @@ start_nc_server()
 	pid=$!
 	echo $pid > $NC_PID
 
-	$DEBUG && rump.netstat -a -f inet
+	if [ $proto = ipv4 ]; then
+		$DEBUG && rump.netstat -a -f inet
+	else
+		$DEBUG && rump.netstat -a -f inet6
+	fi
 
 	export RUMP_SERVER=$backup