CVS commit: src/sys/dev/pci

2016-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 05:12:57 UTC 2016

Modified Files:
src/sys/dev/pci: pci_subr.c pcireg.h

Log Message:
Add Precision Time Management (PTM) ECN.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/pci/pci_subr.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/pcireg.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/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.146 src/sys/dev/pci/pci_subr.c:1.147
--- src/sys/dev/pci/pci_subr.c:1.146	Wed Nov 18 04:24:02 2015
+++ src/sys/dev/pci/pci_subr.c	Wed May 11 05:12:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.146 2015/11/18 04:24:02 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.147 2016/05/11 05:12:57 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.146 2015/11/18 04:24:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.147 2016/05/11 05:12:57 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3233,7 +3233,52 @@ pci_conf_print_l1pm_cap(const pcireg_t *
 		printf("%dus\n", val * scale);
 }
 
-/* XXX pci_conf_print_ptm_cap */
+static void
+pci_conf_print_ptm_cap(const pcireg_t *regs, int capoff, int extcapoff)
+{
+	pcireg_t reg;
+	uint32_t val;
+
+	printf("\n  Precision Time Management\n");
+
+	reg = regs[o2i(extcapoff + PCI_PTM_CAP)];
+	printf("PTM Capability register: 0x%08x\n", reg);
+	onoff("PTM Requester Capable", reg, PCI_PTM_CAP_REQ);
+	onoff("PTM Responder Capable", reg, PCI_PTM_CAP_RESP);
+	onoff("PTM Root Capable", reg, PCI_PTM_CAP_ROOT);
+	printf("  Local Clock Granularity: ");
+	val = __SHIFTOUT(reg, PCI_PTM_CAP_LCLCLKGRNL);
+	switch (val) {
+	case 0:
+		printf("Not implemented\n");
+		break;
+	case 0x:
+		printf("> 254ns\n");
+		break;
+	default:
+		printf("%uns\n", val);
+		break;
+	}
+
+	reg = regs[o2i(extcapoff + PCI_PTM_CTL)];
+	printf("PTM Control register: 0x%08x\n", reg);
+	onoff("PTM Enable", reg, PCI_PTM_CTL_EN);
+	onoff("Root Select", reg, PCI_PTM_CTL_ROOTSEL);
+	printf("  Effective Granularity: ");
+	val = __SHIFTOUT(reg, PCI_PTM_CTL_EFCTGRNL);
+	switch (val) {
+	case 0:
+		printf("Unknown\n");
+		break;
+	case 0x:
+		printf("> 254ns\n");
+		break;
+	default:
+		printf("%uns\n", val);
+		break;
+	}
+}
+
 /* XXX pci_conf_print_mpcie_cap */
 /* XXX pci_conf_print_frsq_cap */
 /* XXX pci_conf_print_rtr_cap */
@@ -3311,7 +3356,7 @@ static struct {
 	{ PCI_EXTCAP_L1PM,	"L1 PM Substates",
 	  pci_conf_print_l1pm_cap },
 	{ PCI_EXTCAP_PTM,	"Precision Time Management",
-	  NULL },
+	  pci_conf_print_ptm_cap },
 	{ PCI_EXTCAP_MPCIE,	"M-PCIe",
 	  NULL },
 	{ PCI_EXTCAP_FRSQ,	"Function Reading Status Queueing",

Index: src/sys/dev/pci/pcireg.h
diff -u src/sys/dev/pci/pcireg.h:1.112 src/sys/dev/pci/pcireg.h:1.113
--- src/sys/dev/pci/pcireg.h:1.112	Wed Nov 18 04:24:02 2015
+++ src/sys/dev/pci/pcireg.h	Wed May 11 05:12:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcireg.h,v 1.112 2015/11/18 04:24:02 msaitoh Exp $	*/
+/*	$NetBSD: pcireg.h,v 1.113 2016/05/11 05:12:57 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1995, 1996, 1999, 2000
@@ -1890,4 +1890,38 @@ struct pci_rom {
 #define	PCI_L1PM_CTL2_TPOSCALE	__BITS(1, 0)	/* T_POWER_ON Scale */
 #define	PCI_L1PM_CTL2_TPOVAL	__BITS(7, 3)	/* T_POWER_ON Value */
 
+/*
+ * Extended capability ID: 0x001f
+ * Precision Time Management
+ */
+#define	PCI_PTM_CAP	0x04	/* Capabilities Register */
+#define	PCI_PTM_CAP_REQ		__BIT(0)	/* PTM Requester Capable */
+#define	PCI_PTM_CAP_RESP	__BIT(1)	/* PTM Responder Capable */
+#define	PCI_PTM_CAP_ROOT	__BIT(2)	/* PTM Root Capable */
+#define	PCI_PTM_CAP_LCLCLKGRNL	__BITS(15, 8)	/* Local Clock Granularity */
+#define	PCI_PTM_CTL	0x08	/* Control Register */
+#define	PCI_PTM_CTL_EN		__BIT(0)	/* PTM Enable */
+#define	PCI_PTM_CTL_ROOTSEL	__BIT(1)	/* Root Select */
+#define	PCI_PTM_CTL_EFCTGRNL	__BITS(15, 8)	/* Effective Granularity */
+
+/*
+ * Extended capability ID: 0x0020
+ * M-PCIe
+ */
+
+/*
+ * Extended capability ID: 0x0021
+ * Function Reading Status Queueing
+ */
+
+/*
+ * Extended capability ID: 0x0022
+ * Readiness Time Reporting
+ */
+
+/*
+ * Extended capability ID: 0x0023
+ * Designated Vendor-Specific
+ */
+
 #endif /* _DEV_PCI_PCIREG_H_ */



CVS commit: src/sys/dev/pci

2016-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 04:37:09 UTC 2016

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

Log Message:
Fix compile error on some archs (e.g. i386).


To generate a diff of this commit:
cvs rdiff -u -r1.396 -r1.397 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.396 src/sys/dev/pci/if_wm.c:1.397
--- src/sys/dev/pci/if_wm.c:1.396	Wed May 11 03:46:06 2016
+++ src/sys/dev/pci/if_wm.c	Wed May 11 04:37:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.396 2016/05/11 03:46:06 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.397 2016/05/11 04:37:09 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.396 2016/05/11 03:46:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.397 2016/05/11 04:37:09 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5173,8 +5173,8 @@ wm_stop_locked(struct ifnet *ifp, int di
 			preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
 			WM_PCI_DESCRING_STATUS);
 			reg = CSR_READ(sc, WMREG_TDLEN(0));
-			printf("XXX RST: FLUSH = %lu, len = %u\n",
-			preg & DESCRING_STATUS_FLUSH_REQ, reg);
+			printf("XXX RST: FLUSH = %08x, len = %u\n",
+			(uint32_t)(preg & DESCRING_STATUS_FLUSH_REQ), reg);
 			if (((preg & DESCRING_STATUS_FLUSH_REQ) != 0)
 			&& (reg != 0)) {
 /* TX */



CVS commit: src/sys/dev/pci

2016-05-10 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed May 11 03:46:06 UTC 2016

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

Log Message:
Interrupt handlers read wm_rxqueue or wm_txqueue, so they must be freed after
disestablishing interrupt handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.395 -r1.396 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.395 src/sys/dev/pci/if_wm.c:1.396
--- src/sys/dev/pci/if_wm.c:1.395	Wed May 11 02:23:50 2016
+++ src/sys/dev/pci/if_wm.c	Wed May 11 03:46:06 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.395 2016/05/11 02:23:50 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.396 2016/05/11 03:46:06 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.395 2016/05/11 02:23:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.396 2016/05/11 03:46:06 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2616,8 +2616,6 @@ wm_detach(device_t self, int flags __unu
 	}
 	/* Must unlock here */
 
-	wm_free_txrx_queues(sc);
-
 	/* Disestablish the interrupt handler */
 	for (i = 0; i < sc->sc_nintrs; i++) {
 		if (sc->sc_ihs[i] != NULL) {
@@ -2627,6 +2625,8 @@ wm_detach(device_t self, int flags __unu
 	}
 	pci_intr_release(sc->sc_pc, sc->sc_intrs, sc->sc_nintrs);
 
+	wm_free_txrx_queues(sc);
+
 	/* Unmap the registers */
 	if (sc->sc_ss) {
 		bus_space_unmap(sc->sc_st, sc->sc_sh, sc->sc_ss);



CVS commit: src/sys/lib/libkern

2016-05-10 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Wed May 11 03:17:22 UTC 2016

Modified Files:
src/sys/lib/libkern: libkern.h

Log Message:
provide const versions of container_of macros.

discussed with riastradh@ by email


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/sys/lib/libkern/libkern.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/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.122 src/sys/lib/libkern/libkern.h:1.123
--- src/sys/lib/libkern/libkern.h:1.122	Mon May  2 19:18:29 2016
+++ src/sys/lib/libkern/libkern.h	Wed May 11 03:17:22 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.122 2016/05/02 19:18:29 christos Exp $	*/
+/*	$NetBSD: libkern.h,v 1.123 2016/05/11 03:17:22 rtr Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -337,15 +337,22 @@ tolower(int ch)
  */
 #ifdef __COVERITY__
 #define __validate_container_of(PTR, TYPE, FIELD) 0
+#define __validate_const_container_of(PTR, TYPE, FIELD) 0
 #else
 #define __validate_container_of(PTR, TYPE, FIELD)			\
 (0 * sizeof((PTR) - &((TYPE *)(((char *)(PTR)) -			\
 offsetof(TYPE, FIELD)))->FIELD))
+#define __validate_const_container_of(PTR, TYPE, FIELD)			\
+(0 * sizeof((PTR) - &((const TYPE *)(((const char *)(PTR)) -	\
+offsetof(TYPE, FIELD)))->FIELD))
 #endif
 
 #define	container_of(PTR, TYPE, FIELD)	\
 ((TYPE *)(((char *)(PTR)) - offsetof(TYPE, FIELD))			\
 	+ __validate_container_of(PTR, TYPE, FIELD))
+#define	const_container_of(PTR, TYPE, FIELD)\
+((const TYPE *)(((const char *)(PTR)) - offsetof(TYPE, FIELD))	\
+	+ __validate_const_container_of(PTR, TYPE, FIELD))
 
 #define	MTPRNG_RLEN		624
 struct mtprng_state {



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine

2016-05-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 11 02:28:34 UTC 2016

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device:
nouveau_engine_device_base.c
src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo:
nouveau_engine_fifo_base.c

Log Message:
Use bus_space_subregion to get fifo channels out of mmio registers.

Evidently it is not enough to just map them separately.  Ran out of
time to investigate why, last time I poked at this and confirmed this
change works.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
cvs rdiff -u -r1.4 -r1.5 \

src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_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/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.10 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.11
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c:1.10	Wed Apr 13 08:50:51 2016
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/device/nouveau_engine_device_base.c	Wed May 11 02:28:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_device_base.c,v 1.10 2016/04/13 08:50:51 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_device_base.c,v 1.11 2016/05/11 02:28:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.10 2016/04/13 08:50:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_device_base.c,v 1.11 2016/05/11 02:28:33 riastradh Exp $");
 
 #include 
 #include 
@@ -297,12 +297,6 @@ nouveau_devobj_ctor(struct nouveau_objec
 #ifdef __NetBSD__
 	if (!(args->disable & NV_DEVICE_DISABLE_MMIO) &&
 	!nv_subdev(device)->mmiosz) {
-		/*
-		 * Map only through PRAMIN -- don't map the command
-		 * FIFO MMIO regions, which start at NV_FIFO_OFFSET =
-		 * 0x80 and are mapped separately.
-		 */
-		mmio_size = MIN(mmio_size, 0x80);
 		/* XXX errno NetBSD->Linux */
 		ret = -bus_space_map(mmiot, mmio_base, mmio_size, 0, );
 		if (ret) {

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.4 src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c:1.4	Wed Feb 10 17:10:47 2016
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/core/engine/fifo/nouveau_engine_fifo_base.c	Wed May 11 02:28:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_engine_fifo_base.c,v 1.4 2016/02/10 17:10:47 riastradh Exp $	*/
+/*	$NetBSD: nouveau_engine_fifo_base.c,v 1.5 2016/05/11 02:28:33 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.4 2016/02/10 17:10:47 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_engine_fifo_base.c,v 1.5 2016/05/11 02:28:33 riastradh Exp $");
 
 #include 
 #include 
@@ -92,13 +92,68 @@ nouveau_fifo_channel_create_(struct nouv
 
 	/* map fifo control registers */
 #ifdef __NetBSD__
-	chan->bst = nv_device_resource_tag(device, bar);
-	/* XXX errno NetBSD->Linux */
-	ret = -bus_space_map(chan->bst, nv_device_resource_start(device, bar) +
-	addr + (chan->chid * size), size, 0, >bsh);
-	if (ret)
-		return ret;
-	chan->mapped = true;
+	if (bar == 0) {
+		/*
+		 * We already map BAR 0 in the engine device base, so
+		 * grab a subregion of that.
+		 */
+		bus_space_tag_t mmiot = nv_subdev(device)->mmiot;
+		bus_space_handle_t mmioh = nv_subdev(device)->mmioh;
+		bus_size_t mmiosz = nv_subdev(device)->mmiosz;
+
+		/* Check whether it lies inside the region.  */
+		if (mmiosz < addr ||
+		mmiosz - addr < chan->chid*size ||
+		mmiosz - addr - chan->chid*size < size) {
+			ret = EIO;
+			nv_error(priv, "fifo channel out of range:"
+			" addr 0x%"PRIxMAX
+			" chid 0x%"PRIxMAX" size 0x%"PRIxMAX
+			" mmiosz 0x%"PRIxMAX"\n",
+			(uintmax_t)addr,
+			(uintmax_t)chan->chid, (uintmax_t)size,
+			(uintmax_t)mmiosz);
+			return ret;
+		}
+
+		/* Grab a subregion.  */
+		/* XXX errno NetBSD->Linux */
+		ret = -bus_space_subregion(mmiot, mmioh,
+		(addr + chan->chid*size), size, >bsh);
+		if (ret) {
+			nv_error(priv, "bus_space_subregion failed: %d\n",
+			ret);
+			return ret;
+		}
+
+		/* Success!  No need to unmap a subregion.  */
+		chan->mapped = false;
+		chan->bst = mmiot;
+	} else {
+		chan->bst = 

CVS commit: src/sys/dev/pci

2016-05-10 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed May 11 02:23:50 UTC 2016

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

Log Message:
Do I219 TX DMA workaround only when TDLEN(0) != 0


To generate a diff of this commit:
cvs rdiff -u -r1.394 -r1.395 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.394 src/sys/dev/pci/if_wm.c:1.395
--- src/sys/dev/pci/if_wm.c:1.394	Fri May  6 10:56:04 2016
+++ src/sys/dev/pci/if_wm.c	Wed May 11 02:23:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.394 2016/05/06 10:56:04 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.395 2016/05/11 02:23:50 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.394 2016/05/06 10:56:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.395 2016/05/11 02:23:50 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -5172,7 +5172,11 @@ wm_stop_locked(struct ifnet *ifp, int di
 
 			preg = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
 			WM_PCI_DESCRING_STATUS);
-			if (preg & DESCRING_STATUS_FLUSH_REQ) {
+			reg = CSR_READ(sc, WMREG_TDLEN(0));
+			printf("XXX RST: FLUSH = %lu, len = %u\n",
+			preg & DESCRING_STATUS_FLUSH_REQ, reg);
+			if (((preg & DESCRING_STATUS_FLUSH_REQ) != 0)
+			&& (reg != 0)) {
 /* TX */
 printf("XXX need TX flush (reg = %08x)\n",
 preg);



CVS commit: src/sys/kern

2016-05-10 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed May 11 02:18:27 UTC 2016

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

Log Message:
Fix builds of ALL kernels that define DEBUG_EXEC


To generate a diff of this commit:
cvs rdiff -u -r1.428 -r1.429 src/sys/kern/kern_exec.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/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.428 src/sys/kern/kern_exec.c:1.429
--- src/sys/kern/kern_exec.c:1.428	Sun May  8 20:00:21 2016
+++ src/sys/kern/kern_exec.c	Wed May 11 02:18:27 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.428 2016/05/08 20:00:21 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.429 2016/05/11 02:18:27 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.428 2016/05/08 20:00:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.429 2016/05/11 02:18:27 ozaki-r Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -133,7 +133,7 @@ static int copyinargstrs(struct execve_d
 execve_fetch_element_t, char **, size_t *, void (*)(const void *, size_t));
 static int exec_sigcode_map(struct proc *, const struct emul *);
 
-#ifdef DEBUG
+#if defined(DEBUG) && !defined(DEBUG_EXEC)
 #define DEBUG_EXEC
 #endif
 #ifdef DEBUG_EXEC



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

2016-05-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 11 02:09:10 UTC 2016

Modified Files:
src/sys/arch/i386/conf: ALL

Log Message:
Enable nouveau in i386/ALL.  Omit incorrect option NV_DEBUG.

NV_DEBUG does not appear except as a macro function in nouveau, which
is broken by defining it on the command line.

>From coypu.


To generate a diff of this commit:
cvs rdiff -u -r1.397 -r1.398 src/sys/arch/i386/conf/ALL

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/ALL
diff -u src/sys/arch/i386/conf/ALL:1.397 src/sys/arch/i386/conf/ALL:1.398
--- src/sys/arch/i386/conf/ALL:1.397	Sun Oct 25 22:48:23 2015
+++ src/sys/arch/i386/conf/ALL	Wed May 11 02:09:10 2016
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.397 2015/10/25 22:48:23 khorben Exp $
+# $NetBSD: ALL,v 1.398 2016/05/11 02:09:10 riastradh Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.397 $"
+#ident 		"ALL-$Revision: 1.398 $"
 
 maxusers	64		# estimated number of users
 
@@ -610,8 +610,8 @@ intelfb* 	at intelfbbus?
 radeon* 	at pci? dev ? function ?
 radeondrmkmsfb* at radeonfbbus?
 
-#nouveau*	at pci? dev ? function ?
-#nouveaufb*	at nouveaufbbus
+nouveau*	at pci? dev ? function ?
+nouveaufb*	at nouveaufbbus?
 
 # DRMUMS drivers
 viadrmums* 	at drm?
@@ -2253,7 +2253,6 @@ options NOTDEF_DEBUG
 options NOT_DEBUG
 options NSIODEBUG
 options NTFS_DEBUG
-options NV_DEBUG
 options OBOE_DEBUG
 options OFW_DEBUG
 options OHCI_DEBUG



CVS commit: src/usr.bin/make

2016-05-10 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Tue May 10 23:45:45 UTC 2016

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

Log Message:
Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/usr.bin/make/make.1
cvs rdiff -u -r1.55 -r1.56 src/usr.bin/make/meta.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/make.1
diff -u src/usr.bin/make/make.1:1.256 src/usr.bin/make/make.1:1.257
--- src/usr.bin/make/make.1:1.256	Wed Mar 16 00:19:01 2016
+++ src/usr.bin/make/make.1	Tue May 10 23:45:45 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.256 2016/03/16 00:19:01 sjg Exp $
+.\"	$NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg 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 19, 2016
+.Dd May 10, 2016
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -913,6 +913,9 @@ Provides a list of path prefixes that sh
 because the contents are expected to change over time.
 The default list includes:
 .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
+.It Va .MAKE.META.IGNORE_PATTERNS
+Provides a list of patterns to match against pathnames.
+Ignore any that match.
 .It Va .MAKE.META.PREFIX
 Defines the message printed for each meta file updated in "meta verbose" mode.
 The default value is:

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.55 src/usr.bin/make/meta.c:1.56
--- src/usr.bin/make/meta.c:1.55	Tue May 10 00:02:31 2016
+++ src/usr.bin/make/meta.c	Tue May 10 23:45:45 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.55 2016/05/10 00:02:31 sjg Exp $ */
+/*  $NetBSD: meta.c,v 1.56 2016/05/10 23:45:45 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -62,6 +62,9 @@ static char *metaIgnorePathsStr;	/* stri
 #ifndef MAKE_META_IGNORE_PATHS
 #define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
 #endif
+#ifndef MAKE_META_IGNORE_PATTERNS
+#define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS"
+#endif
 
 Boolean useMeta = FALSE;
 static Boolean useFilemon = FALSE;
@@ -69,6 +72,7 @@ static Boolean writeMeta = FALSE;
 static Boolean metaEnv = FALSE;		/* don't save env unless asked */
 static Boolean metaVerbose = FALSE;
 static Boolean metaIgnoreCMDs = FALSE;	/* ignore CMDs in .meta files */
+static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */
 static Boolean metaCurdirOk = FALSE;	/* write .meta in .CURDIR Ok? */
 static Boolean metaSilent = FALSE;	/* if we have a .meta be SILENT */
 
@@ -616,6 +620,15 @@ meta_mode_init(const char *make_mode)
 if (metaIgnorePathsStr) {
 	str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
 }
+
+/*
+ * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}
+ */
+cp = NULL;
+if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, )) {
+	metaIgnorePatterns = TRUE;
+	free(cp);
+}
 }
 
 /*
@@ -1210,11 +1223,30 @@ meta_oodate(GNode *gn, Boolean oodate)
 			if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
 #ifdef DEBUG_META_MODE
 			if (DEBUG(META))
-fprintf(debug_file, "meta_oodate: ignoring: %s\n",
+fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
+	p);
+#endif
+			break;
+			}
+		}
+
+		if (metaIgnorePatterns) {
+			char *pm;
+
+			snprintf(fname1, sizeof(fname1),
+ "${%s:@m@${%s:L:M$m}@}",
+ MAKE_META_IGNORE_PATTERNS, p);
+			pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
+			if (*pm) {
+#ifdef DEBUG_META_MODE
+			if (DEBUG(META))
+fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n",
 	p);
 #endif
+			free(pm);
 			break;
 			}
+			free(pm);
 		}
 
 		/*



CVS commit: [netbsd-6] src/doc

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:17:59 UTC 2016

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
1376, 1381


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.248 -r1.1.2.249 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.248 src/doc/CHANGES-6.2:1.1.2.249
--- src/doc/CHANGES-6.2:1.1.2.248	Sun May  8 22:06:34 2016
+++ src/doc/CHANGES-6.2	Tue May 10 23:17:59 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.248 2016/05/08 22:06:34 snj Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.249 2016/05/10 23:17:59 snj Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -14265,3 +14265,14 @@ external/bsd/ntp/bin/ntpd/ntp_parser.h		
 	Update ntp to 4.2.8p7.
 	[spz, ticket #1380]
 
+sys/dev/usb/uslsa.c1.19
+
+	Improve support for CP2104.
+	[riastradh, ticket #1381]
+
+sys/miscfs/specfs/spec_vnops.c			1.161, 1.162 via patch
+
+	Avoid a race with spec_revoke when extracting v_rdev.
+	Fixes PR kern/50467.
+	[hannken, ticket #1376]
+



CVS commit: [netbsd-6-0] src/doc

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:18:17 UTC 2016

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.7

Log Message:
1376


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.66 -r1.1.2.67 src/doc/CHANGES-6.0.7

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-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.66 src/doc/CHANGES-6.0.7:1.1.2.67
--- src/doc/CHANGES-6.0.7:1.1.2.66	Sun May  8 21:54:42 2016
+++ src/doc/CHANGES-6.0.7	Tue May 10 23:18:17 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.66 2016/05/08 21:54:42 snj Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.67 2016/05/10 23:18:17 snj Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -8542,3 +8542,9 @@ external/bsd/ntp/bin/ntpd/ntp_parser.h		
 	Update ntp to 4.2.8p7.
 	[spz, ticket #1380]
 
+sys/miscfs/specfs/spec_vnops.c			1.161, 1.162 via patch
+
+	Avoid a race with spec_revoke when extracting v_rdev.
+	Fixes PR kern/50467.
+	[hannken, ticket #1376]
+



CVS commit: [netbsd-6-1] src/doc

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:18:37 UTC 2016

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.6

Log Message:
1376


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-6.1.6

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-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.64 src/doc/CHANGES-6.1.6:1.1.2.65
--- src/doc/CHANGES-6.1.6:1.1.2.64	Sun May  8 21:59:43 2016
+++ src/doc/CHANGES-6.1.6	Tue May 10 23:18:37 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.64 2016/05/08 21:59:43 snj Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.65 2016/05/10 23:18:37 snj Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -8262,3 +8262,9 @@ external/bsd/ntp/bin/ntpd/ntp_parser.h		
 	Update ntp to 4.2.8p7.
 	[spz, ticket #1380]
 
+sys/miscfs/specfs/spec_vnops.c			1.161, 1.162 via patch
+
+	Avoid a race with spec_revoke when extracting v_rdev.
+	Fixes PR kern/50467.
+	[hannken, ticket #1376]
+



CVS commit: [netbsd-6-0] src/sys/miscfs/specfs

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:15:05 UTC 2016

Modified Files:
src/sys/miscfs/specfs [netbsd-6-0]: spec_vnops.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1376):
sys/miscfs/specfs/spec_vnops.c: revisions 1.161, 1.162 via patch
Whhen spec_strategy() extracts v_rdev take care to avoid a
race with spec_revoke.
Fixes PR kern/50467 Panic from disconnecting phone while reading its contents
--
Avoid a race with spec_revoke for the assertion too.
Final fix for PR kern/50467 Panic from disconnecting phone while reading
its contents


To generate a diff of this commit:
cvs rdiff -u -r1.134.8.1 -r1.134.8.1.4.1 src/sys/miscfs/specfs/spec_vnops.c

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

Modified files:

Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1 src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1.4.1
--- src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1	Mon May  7 03:01:14 2012
+++ src/sys/miscfs/specfs/spec_vnops.c	Tue May 10 23:15:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.134.8.1.4.1 2016/05/10 23:15:05 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.1.4.1 2016/05/10 23:15:05 snj Exp $");
 
 #include 
 #include 
@@ -886,25 +886,44 @@ spec_strategy(void *v)
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct buf *bp = ap->a_bp;
+	dev_t dev;
 	int error;
 
-	KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+	dev = NODEV;
 
-	error = 0;
-	bp->b_dev = vp->v_rdev;
+	/*
+	 * Extract all the info we need from the vnode, taking care to
+	 * avoid a race with VOP_REVOKE().
+	 */
 
-	if (!(bp->b_flags & B_READ))
-		error = fscow_run(bp, false);
+	mutex_enter(vp->v_interlock);
+	if ((vp->v_iflag & VI_XLOCK) == 0 && vp->v_specnode != NULL) {
+		KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+		dev = vp->v_rdev;
+	}
+	mutex_exit(vp->v_interlock);
 
-	if (error) {
-		bp->b_error = error;
-		biodone(bp);
-		return (error);
+	if (dev == NODEV) {
+		error = ENXIO;
+		goto out;
 	}
+	bp->b_dev = dev;
 
+	if (!(bp->b_flags & B_READ)) {
+		error = fscow_run(bp, false);
+		if (error)
+			goto out;
+	}
 	bdev_strategy(bp);
 
-	return (0);
+	return 0;
+
+out:
+	bp->b_error = error;
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
+
+	return error;
 }
 
 int



CVS commit: [netbsd-6-1] src/sys/miscfs/specfs

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:14:45 UTC 2016

Modified Files:
src/sys/miscfs/specfs [netbsd-6-1]: spec_vnops.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1376):
sys/miscfs/specfs/spec_vnops.c: revisions 1.161, 1.162 via patch
Whhen spec_strategy() extracts v_rdev take care to avoid a
race with spec_revoke.
Fixes PR kern/50467 Panic from disconnecting phone while reading its contents
--
Avoid a race with spec_revoke for the assertion too.
Final fix for PR kern/50467 Panic from disconnecting phone while reading
its contents


To generate a diff of this commit:
cvs rdiff -u -r1.134.8.1 -r1.134.8.1.6.1 src/sys/miscfs/specfs/spec_vnops.c

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

Modified files:

Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1 src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1.6.1
--- src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1	Mon May  7 03:01:14 2012
+++ src/sys/miscfs/specfs/spec_vnops.c	Tue May 10 23:14:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.134.8.1.6.1 2016/05/10 23:14:45 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.1.6.1 2016/05/10 23:14:45 snj Exp $");
 
 #include 
 #include 
@@ -886,25 +886,44 @@ spec_strategy(void *v)
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct buf *bp = ap->a_bp;
+	dev_t dev;
 	int error;
 
-	KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+	dev = NODEV;
 
-	error = 0;
-	bp->b_dev = vp->v_rdev;
+	/*
+	 * Extract all the info we need from the vnode, taking care to
+	 * avoid a race with VOP_REVOKE().
+	 */
 
-	if (!(bp->b_flags & B_READ))
-		error = fscow_run(bp, false);
+	mutex_enter(vp->v_interlock);
+	if ((vp->v_iflag & VI_XLOCK) == 0 && vp->v_specnode != NULL) {
+		KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+		dev = vp->v_rdev;
+	}
+	mutex_exit(vp->v_interlock);
 
-	if (error) {
-		bp->b_error = error;
-		biodone(bp);
-		return (error);
+	if (dev == NODEV) {
+		error = ENXIO;
+		goto out;
 	}
+	bp->b_dev = dev;
 
+	if (!(bp->b_flags & B_READ)) {
+		error = fscow_run(bp, false);
+		if (error)
+			goto out;
+	}
 	bdev_strategy(bp);
 
-	return (0);
+	return 0;
+
+out:
+	bp->b_error = error;
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
+
+	return error;
 }
 
 int



CVS commit: [netbsd-6] src/sys/miscfs/specfs

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:14:32 UTC 2016

Modified Files:
src/sys/miscfs/specfs [netbsd-6]: spec_vnops.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1376):
sys/miscfs/specfs/spec_vnops.c: revisions 1.161, 1.162 via patch
Whhen spec_strategy() extracts v_rdev take care to avoid a
race with spec_revoke.
Fixes PR kern/50467 Panic from disconnecting phone while reading its contents
--
Avoid a race with spec_revoke for the assertion too.
Final fix for PR kern/50467 Panic from disconnecting phone while reading
its contents


To generate a diff of this commit:
cvs rdiff -u -r1.134.8.1 -r1.134.8.2 src/sys/miscfs/specfs/spec_vnops.c

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

Modified files:

Index: src/sys/miscfs/specfs/spec_vnops.c
diff -u src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1 src/sys/miscfs/specfs/spec_vnops.c:1.134.8.2
--- src/sys/miscfs/specfs/spec_vnops.c:1.134.8.1	Mon May  7 03:01:14 2012
+++ src/sys/miscfs/specfs/spec_vnops.c	Tue May 10 23:14:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $	*/
+/*	$NetBSD: spec_vnops.c,v 1.134.8.2 2016/05/10 23:14:32 snj Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.1 2012/05/07 03:01:14 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spec_vnops.c,v 1.134.8.2 2016/05/10 23:14:32 snj Exp $");
 
 #include 
 #include 
@@ -886,25 +886,44 @@ spec_strategy(void *v)
 	} */ *ap = v;
 	struct vnode *vp = ap->a_vp;
 	struct buf *bp = ap->a_bp;
+	dev_t dev;
 	int error;
 
-	KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+	dev = NODEV;
 
-	error = 0;
-	bp->b_dev = vp->v_rdev;
+	/*
+	 * Extract all the info we need from the vnode, taking care to
+	 * avoid a race with VOP_REVOKE().
+	 */
 
-	if (!(bp->b_flags & B_READ))
-		error = fscow_run(bp, false);
+	mutex_enter(vp->v_interlock);
+	if ((vp->v_iflag & VI_XLOCK) == 0 && vp->v_specnode != NULL) {
+		KASSERT(vp == vp->v_specnode->sn_dev->sd_bdevvp);
+		dev = vp->v_rdev;
+	}
+	mutex_exit(vp->v_interlock);
 
-	if (error) {
-		bp->b_error = error;
-		biodone(bp);
-		return (error);
+	if (dev == NODEV) {
+		error = ENXIO;
+		goto out;
 	}
+	bp->b_dev = dev;
 
+	if (!(bp->b_flags & B_READ)) {
+		error = fscow_run(bp, false);
+		if (error)
+			goto out;
+	}
 	bdev_strategy(bp);
 
-	return (0);
+	return 0;
+
+out:
+	bp->b_error = error;
+	bp->b_resid = bp->b_bcount;
+	biodone(bp);
+
+	return error;
 }
 
 int



CVS commit: [netbsd-6] src/sys/dev/usb

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 23:10:59 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-6]: uslsa.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1381):
sys/dev/usb/uslsa.c: revision 1.19
Improve support for the CP2104. This particular device has a higher maximum
baud rate and thus the SLSA_R_SET_BAUDDIV sets the wrong rate.
Changed to code to use the SLSA_R_SET_BAUDRATE command and providing a
fallback for the old SLSA_R_SET_BAUDDIV command if the device doesn't
recognize the command. Unknown yet if the CP2101 has this command or not.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/dev/usb/uslsa.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/usb/uslsa.c
diff -u src/sys/dev/usb/uslsa.c:1.18 src/sys/dev/usb/uslsa.c:1.18.2.1
--- src/sys/dev/usb/uslsa.c:1.18	Sat Jan 14 21:15:48 2012
+++ src/sys/dev/usb/uslsa.c	Tue May 10 23:10:59 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: uslsa.c,v 1.18 2012/01/14 21:15:48 jakllsch Exp $ */
+/* $NetBSD: uslsa.c,v 1.18.2.1 2016/05/10 23:10:59 snj Exp $ */
 
 /* from ugensa.c */
 
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.18 2012/01/14 21:15:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.18.2.1 2016/05/10 23:10:59 snj Exp $");
 
 #include 
 #include 
@@ -388,8 +388,11 @@ static int
 uslsa_param(void *vsc, int portno, struct termios *t)
 {
 	struct uslsa_softc *sc;
-	int ret;
+	usb_device_request_t req;
+	usbd_status status;
 	uint16_t value;
+	uint32_t baud;
+	int ret;
 
 	sc = vsc;
 
@@ -399,12 +402,27 @@ uslsa_param(void *vsc, int portno, struc
 		return EIO;
 	}
 
-	value = SLSA_RV_BAUDDIV(t->c_ospeed);
+	req.bmRequestType = UT_WRITE_VENDOR_INTERFACE;
+	req.bRequest = SLSA_R_SET_BAUDRATE;
+	USETW(req.wValue, 0);
+	USETW(req.wIndex, sc->sc_ifnum);
+	USETW(req.wLength, 4);
 
-	if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) != 0) {
-		device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n",
-		   __func__);
-		return ret;
+	baud = t->c_ospeed;
+	status = usbd_do_request(sc->sc_udev, , );
+	if (status != USBD_NORMAL_COMPLETION) {
+		/* fallback method for devices that don't know SET_BAUDRATE */
+		/* hope we calculate it right */
+		device_printf(sc->sc_dev, "%s: set baudrate %d, failed %s,"
+" using set bauddiv\n",
+		__func__, baud, usbd_errstr(status));
+
+		value = SLSA_RV_BAUDDIV(t->c_ospeed);
+		if ((ret = uslsa_request_set(sc, SLSA_R_SET_BAUDDIV, value)) != 0) {
+			device_printf(sc->sc_dev, "%s: SET_BAUDDIV failed\n",
+			   __func__);
+			return ret;
+		}
 	}
 
 	value = 0;



CVS commit: src/sys/dev/ic

2016-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 21:15:54 UTC 2016

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

Log Message:
Remove comment about splusb and replace with KASSERT(mutex_owned())


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/ic/sl811hs.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/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.59 src/sys/dev/ic/sl811hs.c:1.60
--- src/sys/dev/ic/sl811hs.c:1.59	Tue May 10 21:13:48 2016
+++ src/sys/dev/ic/sl811hs.c	Tue May 10 21:15:54 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.60 2016/05/10 21:15:54 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -1296,6 +1296,8 @@ slhci_abort(struct usbd_xfer *xfer)
 	struct slhci_softc *sc;
 	struct slhci_pipe *spipe;
 
+	KASSERT(mutex_owned(>sc_lock));
+
 	spipe = SLHCI_PIPE2SPIPE(xfer->ux_pipe);
 
 	if (spipe == NULL)
@@ -1312,7 +1314,6 @@ slhci_abort(struct usbd_xfer *xfer)
 
 callback:
 	xfer->ux_status = USBD_CANCELLED;
-	/* Abort happens at IPL_USB. */
 	usb_transfer_complete(xfer);
 }
 



CVS commit: src/sys/dev/ic

2016-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 21:13:48 UTC 2016

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

Log Message:
More debug


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/ic/sl811hs.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/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.58 src/sys/dev/ic/sl811hs.c:1.59
--- src/sys/dev/ic/sl811hs.c:1.58	Sun May  8 07:48:24 2016
+++ src/sys/dev/ic/sl811hs.c	Tue May 10 21:13:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $	*/
+/*	$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $	*/
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.58 2016/05/08 07:48:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.59 2016/05/10 21:13:48 skrll Exp $");
 
 #include "opt_slhci.h"
 
@@ -1398,6 +1398,7 @@ slhci_mem_use(struct usbd_bus *bus, int 
 void
 slhci_reset_entry(void *arg)
 {
+	SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
 	struct slhci_softc *sc = arg;
 
 	mutex_enter(>sc_intr_lock);
@@ -2492,12 +2493,14 @@ slhci_callback_schedule(struct slhci_sof
 static void
 slhci_do_callback_schedule(struct slhci_softc *sc)
 {
+	SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
 	struct slhci_transfers *t;
 
 	t = >sc_transfers;
 
 	KASSERT(mutex_owned(>sc_intr_lock));
 
+	DLOG(D_MSG, "flags %#x", t->flags, 0, 0, 0);
 	if (!(t->flags & F_CALLBACK)) {
 		t->flags |= F_CALLBACK;
 		softint_schedule(sc->sc_cb_softintr);



CVS commit: src/sys/rump/dev/lib/libpci

2016-05-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue May 10 19:38:29 UTC 2016

Modified Files:
src/sys/rump/dev/lib/libpci: Makefile

Log Message:
Avoid '.' in variable names which are expected to be passed to
this Makefile via the env.

That character is strictly speaking not allowed by POSIX in an exported
variable name, and at least dash >= 0.58 refuses to export such variables.

Furthermore, since the individual CFLAGS/CPPFLAGS/etc. variables
are not comprehensive enough for all cases (e.g. HURD), just
support the .includable version from now on, i.e.
RUMPCOMP_MAKEFILEINC_rumpdev_pci.

curious failure mode debugged by Martin Lucina


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/rump/dev/lib/libpci/Makefile

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

Modified files:

Index: src/sys/rump/dev/lib/libpci/Makefile
diff -u src/sys/rump/dev/lib/libpci/Makefile:1.10 src/sys/rump/dev/lib/libpci/Makefile:1.11
--- src/sys/rump/dev/lib/libpci/Makefile:1.10	Tue Jan 26 23:12:15 2016
+++ src/sys/rump/dev/lib/libpci/Makefile	Tue May 10 19:38:29 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2016/01/26 23:12:15 pooka Exp $
+#	$NetBSD: Makefile,v 1.11 2016/05/10 19:38:29 pooka Exp $
 #
 
 RUMPTOP= ${TOPRUMP}
@@ -28,23 +28,36 @@ SRCS+=	pci_at_mainbus.c
 .error RUMP_PCI_IOSPACE defined in Makefile.  Use userfeatures.h instead.
 .endif
 
+RUMPCOMP_USER_CPPFLAGS:=-I${.PARSEDIR}
+
+# current state-of-the-art interface (remains to be seen if it's "good enuf")
+.ifdef RUMPCOMP_MAKEFILEINC_rumpdev_pci
+.include "${RUMPCOMP_MAKEFILEINC_rumpdev_pci}"
+.endif
+
+# old-style ("compat") interfaces.  will go away some day or year.
+# why?  the "protocol" requires passing variables via the env, and
+# the names include dots which POSIX does not, strictly speaking,
+# allow in env names.  There is at least one shell (dash >= 0.58)
+# which refuses to pass variables with dots.
+.if defined(RUMPCOMP_USER_SRCS.rumpdev_pci) \
+|| defined(RUMPCOMP_MAKEFILEINC.rumpdev_pci)
+.warning Use new style RUMPCOMP_MAKEFILEINC_rumpdev_pci
+.endif
+.ifdef RUMPCOMP_USER_PATH.rumpdev_pci
 .PATH:			${RUMPCOMP_USER_PATH.rumpdev_pci}
 RUMPCOMP_USER_SRCS=	${RUMPCOMP_USER_SRCS.rumpdev_pci}
-MYDIR:=			${.PARSEDIR}
-RUMPCOMP_USER_CPPFLAGS=	-I${MYDIR}
 RUMPCOMP_USER_CPPFLAGS+=${RUMPCOMP_USER_CPPFLAGS.rumpdev_pci}
 RUMPCOMP_USER_CFLAGS=	${RUMPCOMP_USER_CFLAGS.rumpdev_pci}
-
 CPPFLAGS+=		${RUMPCOMP_CPPFLAGS.rumpdev_pci}
-
-# XXX: messy
-.undef RUMPKERN_ONLY
-
+.endif
 .ifdef RUMPCOMP_MAKEFILEINC.rumpdev_pci
-.warning RUMPCOMP_MAKEFILEINC interface is unstable and may change
 .include "${RUMPCOMP_MAKEFILEINC.rumpdev_pci}"
 .endif
 
+# XXX: messy
+.undef RUMPKERN_ONLY
+
 .include "${RUMPTOP}/Makefile.rump"
 .include 
 .include 



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

2016-05-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue May 10 19:35:08 UTC 2016

Modified Files:
src/sys/arch/sparc64/doc: TODO

Log Message:
Update TODO: sun4v interrupts works (mostly) + note issue with mpt(4) on sun4v 
systems


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/doc/TODO

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

Modified files:

Index: src/sys/arch/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.15 src/sys/arch/sparc64/doc/TODO:1.16
--- src/sys/arch/sparc64/doc/TODO:1.15	Sun May  1 19:41:01 2016
+++ src/sys/arch/sparc64/doc/TODO	Tue May 10 19:35:08 2016
@@ -1,4 +1,4 @@
- /* $NetBSD: TODO,v 1.15 2016/05/01 19:41:01 palle Exp $ */
+ /* $NetBSD: TODO,v 1.16 2016/05/10 19:35:08 palle Exp $ */
 
 Things to be done:
 
@@ -25,4 +25,5 @@ sun4v:
 - ci_tsb_desc->td_ctxidx: -1 or 1?
 - MP support - currently bypassed in pmap_bootstrap() for sun4v
 - vpci.c/vpcivar.h: cleanup FIXMEs
-- interrups not handled properly
\ No newline at end of file
+- interrups not handled properly (com at ebus only...)
+- mpt(4) complains: mpt0: Phy 0: Link Status Unknown
\ No newline at end of file



CVS commit: src/doc

2016-05-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May 10 19:32:47 UTC 2016

Modified Files:
src/doc: HACKS

Log Message:
move the ufs_lookup hack to the global section and update it to current
reality.  add a section for the crt hacks.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.166 src/doc/HACKS:1.167
--- src/doc/HACKS:1.166	Wed May  4 22:42:40 2016
+++ src/doc/HACKS	Tue May 10 19:32:47 2016
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.166 2016/05/04 22:42:40 christos Exp $
+# $NetBSD: HACKS,v 1.167 2016/05/10 19:32:47 mrg Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -27,6 +27,20 @@
 #
 # this is a comment.
 
+hack	gcc-5.3 miscompiles crt* leading to ctor/dtor related crashes
+mdate	10 May 2016
+who	mrg martin
+file	lib/csu/common/Makefile.inc : 1.26, 1.27, 1.31
+descr
+	GCC assumes non-constant data is constant and assumes that it
+	can generate direct calls out of the ctor/dtor space, which
+	generally breaks their usage.  On SPARC, an explicit call to
+	0 is generated as "clr %g1; call %g1", for example.
+
+	Compiling with -O1 fixes this problem.
+pr	51121
+kcah
+
 hack	gcc-5.3 optimizes memset+malloc -> calloc inside calloc
 mdate	4 May 2016
 who	christos
@@ -36,6 +50,16 @@ descr
 	-fno-builtin-malloc
 kcah
 
+hack	turn off tree-vrp for parts of ufs_lookup.c
+mdate	28 April 2016
+who	mrg christos
+file	src/sys/ufs/ufs/ufs_lookup.c : 1.144
+pr	51094
+descr
+	with -ftree-vrp enabled in ufs_lookup.c sometimes bad dir
+	panicks are see.
+hcah
+
 hack	netstat ieee1394 address printing.
 mdate	14 Nov 2000
 who	matt
@@ -792,14 +816,6 @@ port	x86
 		out which option is causing this.
 	hcah
 
-	hack	turn off -ftree-vrp for ufs_lookup.c
-	who	mrg
-	file	src/sys/arch/amd64/conf/Makefile.amd64 : 1.54
-	descr
-		with -ftree-vrp enabled in ufs_lookup.c sometimes bad dir
-		panicks are see.  see PR 51094.
-	hcah
-
 port	powerpc
 
 	hack	avoid using __builtin_return_address(0) because it fails in



CVS commit: src/sys/arch/sparc64

2016-05-10 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Tue May 10 19:24:00 UTC 2016

Modified Files:
src/sys/arch/sparc64/dev: fhc.c psycho.c pyro.c sbus.c schizo.c vpci.c
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: genassym.cf intr.c locore.s

Log Message:
sun4v: make device interrupts work. Introduce a new intrhand_alloc() function 
for allocation of interrupt handlers and adapt to this. Parts from OpenBSD. ok 
martin@


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/sparc64/dev/fhc.c
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/pyro.c
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/sparc64/dev/sbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/sparc64/dev/schizo.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sparc64/dev/vpci.c
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/sparc64/sparc64/intr.c
cvs rdiff -u -r1.390 -r1.391 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/sys/arch/sparc64/dev/fhc.c
diff -u src/sys/arch/sparc64/dev/fhc.c:1.3 src/sys/arch/sparc64/dev/fhc.c:1.4
--- src/sys/arch/sparc64/dev/fhc.c:1.3	Sun Mar 18 05:26:58 2012
+++ src/sys/arch/sparc64/dev/fhc.c	Tue May 10 19:23:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: fhc.c,v 1.3 2012/03/18 05:26:58 mrg Exp $	*/
+/*	$NetBSD: fhc.c,v 1.4 2016/05/10 19:23:59 palle Exp $	*/
 /*	$OpenBSD: fhc.c,v 1.17 2010/11/11 17:58:23 miod Exp $	*/
 
 /*
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.3 2012/03/18 05:26:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fhc.c,v 1.4 2016/05/10 19:23:59 palle Exp $");
 
 #include 
 #include 
@@ -251,10 +251,7 @@ fhc_intr_establish(bus_space_tag_t t, in
 	vec = ((sc->sc_ign << INTMAP_IGN_SHIFT) & INTMAP_IGN) |
 	INTINO(ihandle);
 
-	ih = (struct intrhand *)
-		malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
-	if (ih == NULL)
-		return (NULL);
+	ih = intrhand_alloc();
 
 	ih->ih_ivec = ihandle;
 

Index: src/sys/arch/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.123 src/sys/arch/sparc64/dev/psycho.c:1.124
--- src/sys/arch/sparc64/dev/psycho.c:1.123	Fri Nov 27 00:36:58 2015
+++ src/sys/arch/sparc64/dev/psycho.c	Tue May 10 19:23:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.123 2015/11/27 00:36:58 mrg Exp $	*/
+/*	$NetBSD: psycho.c,v 1.124 2016/05/10 19:23:59 palle Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.123 2015/11/27 00:36:58 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psycho.c,v 1.124 2016/05/10 19:23:59 palle Exp $");
 
 #include "opt_ddb.h"
 
@@ -707,8 +707,7 @@ psycho_set_intr(struct psycho_softc *sc,
 {
 	struct intrhand *ih;
 
-	ih = (struct intrhand *)malloc(sizeof(struct intrhand),
-		M_DEVBUF, M_NOWAIT);
+	ih = intrhand_alloc();
 	ih->ih_arg = sc;
 	ih->ih_map = mapper;
 	ih->ih_clr = clearer;
@@ -1273,9 +1272,7 @@ psycho_intr_establish(bus_space_tag_t t,
 	int ino;
 	long vec = INTVEC(ihandle);
 
-	ih = malloc(sizeof(struct intrhand), M_DEVBUF, M_NOWAIT);
-	if (ih == NULL)
-		return (NULL);
+	ih = intrhand_alloc();
 
 	ih->ih_ivec = ihandle;
 

Index: src/sys/arch/sparc64/dev/pyro.c
diff -u src/sys/arch/sparc64/dev/pyro.c:1.16 src/sys/arch/sparc64/dev/pyro.c:1.17
--- src/sys/arch/sparc64/dev/pyro.c:1.16	Fri Oct  2 05:22:52 2015
+++ src/sys/arch/sparc64/dev/pyro.c	Tue May 10 19:23:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pyro.c,v 1.16 2015/10/02 05:22:52 msaitoh Exp $	*/
+/*	$NetBSD: pyro.c,v 1.17 2016/05/10 19:23:59 palle Exp $	*/
 /*	from: $OpenBSD: pyro.c,v 1.20 2010/12/05 15:15:14 kettenis Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.16 2015/10/02 05:22:52 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.17 2016/05/10 19:23:59 palle Exp $");
 
 #include 
 #include 
@@ -580,9 +580,7 @@ pyro_intr_establish(bus_space_tag_t t, i
 
 	ino |= INTVEC(ihandle);
 
-	ih = malloc(sizeof *ih, M_DEVBUF, M_NOWAIT);
-	if (ih == NULL)
-		return (NULL);
+	ih = intrhand_alloc();
 
 	/* Register the map and clear intr registers */
 	ih->ih_map = intrmapptr;

Index: src/sys/arch/sparc64/dev/sbus.c
diff -u src/sys/arch/sparc64/dev/sbus.c:1.93 src/sys/arch/sparc64/dev/sbus.c:1.94
--- src/sys/arch/sparc64/dev/sbus.c:1.93	Mon Jan 30 04:25:15 2012
+++ src/sys/arch/sparc64/dev/sbus.c	Tue May 10 19:23:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbus.c,v 1.93 2012/01/30 04:25:15 mrg Exp $ */
+/*	$NetBSD: sbus.c,v 1.94 2016/05/10 19:23:59 palle Exp $ */
 
 /*
  * Copyright (c) 1999-2002 Eduardo Horvath
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.93 2012/01/30 04:25:15 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbus.c,v 1.94 2016/05/10 

CVS commit: [netbsd-7] src/doc

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 19:04:37 UTC 2016

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

Log Message:
amend 1163


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

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

Modified files:

Index: src/doc/CHANGES-7.1
diff -u src/doc/CHANGES-7.1:1.1.2.84 src/doc/CHANGES-7.1:1.1.2.85
--- src/doc/CHANGES-7.1:1.1.2.84	Mon May  9 19:50:05 2016
+++ src/doc/CHANGES-7.1	Tue May 10 19:04:36 2016
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1,v 1.1.2.84 2016/05/09 19:50:05 snj Exp $
+# $NetBSD: CHANGES-7.1,v 1.1.2.85 2016/05/10 19:04:36 snj Exp $
 
 A complete list of changes from the NetBSD 7.0 release to the NetBSD 7.1
 release:
@@ -4230,7 +4230,7 @@ sys/rump/librump/rumpkern/rump.c		1.329
 	[joerg, ticket #1162]
 
 sys/fs/tmpfs/tmpfs_vfsops.c			1.66, 1.67
-sys/fs/tmpfs/tmpfs_vnops.c			1.124
+sys/fs/tmpfs/tmpfs_vnops.c			1.124, 1.125
 
 	Only recheck size/node limits on update mounts if they
 	actually have been specified.



CVS commit: [netbsd-7] src/sys/fs/tmpfs

2016-05-10 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 10 19:04:15 UTC 2016

Modified Files:
src/sys/fs/tmpfs [netbsd-7]: tmpfs_vnops.c

Log Message:
Pull up following revision(s) (requested by joerg in ticket #1163):
sys/fs/tmpfs/tmpfs_vnops.c: revision 1.125
do not access uninitialized variables in KASSERTs - fixes build


To generate a diff of this commit:
cvs rdiff -u -r1.120.2.2 -r1.120.2.3 src/sys/fs/tmpfs/tmpfs_vnops.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/fs/tmpfs/tmpfs_vnops.c
diff -u src/sys/fs/tmpfs/tmpfs_vnops.c:1.120.2.2 src/sys/fs/tmpfs/tmpfs_vnops.c:1.120.2.3
--- src/sys/fs/tmpfs/tmpfs_vnops.c:1.120.2.2	Mon May  9 19:45:00 2016
+++ src/sys/fs/tmpfs/tmpfs_vnops.c	Tue May 10 19:04:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_vnops.c,v 1.120.2.2 2016/05/09 19:45:00 snj Exp $	*/
+/*	$NetBSD: tmpfs_vnops.c,v 1.120.2.3 2016/05/10 19:04:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.120.2.2 2016/05/09 19:45:00 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_vnops.c,v 1.120.2.3 2016/05/10 19:04:15 snj Exp $");
 
 #include 
 #include 
@@ -589,14 +589,14 @@ tmpfs_write(void *v)
 
 	KASSERT(VOP_ISLOCKED(vp));
 
+	node = VP_TO_TMPFS_NODE(vp);
+	oldsize = node->tn_size;
+
 	if ((vp->v_mount->mnt_flag & MNT_RDONLY) != 0) {
 		error = EROFS;
 		goto out;
 	}
 
-	node = VP_TO_TMPFS_NODE(vp);
-	oldsize = node->tn_size;
-
 	if (uio->uio_offset < 0 || vp->v_type != VREG) {
 		error = EINVAL;
 		goto out;



CVS commit: src/sys/fs/udf

2016-05-10 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue May 10 15:23:39 UTC 2016

Modified Files:
src/sys/fs/udf: udf.h udf_subr.c

Log Message:
Rework VAT searching on recordable media. It is now a lot more resilliant to
errors and it allows for VAT searching on crashed writeouts.

While here, make sure the node pointer is always initialised in
udf_get_node().


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/fs/udf/udf.h
cvs rdiff -u -r1.136 -r1.137 src/sys/fs/udf/udf_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/fs/udf/udf.h
diff -u src/sys/fs/udf/udf.h:1.50 src/sys/fs/udf/udf.h:1.51
--- src/sys/fs/udf/udf.h:1.50	Mon Aug 24 08:31:56 2015
+++ src/sys/fs/udf/udf.h	Tue May 10 15:23:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.h,v 1.50 2015/08/24 08:31:56 hannken Exp $ */
+/* $NetBSD: udf.h,v 1.51 2016/05/10 15:23:39 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -417,11 +417,12 @@ struct udf_node {
 #define	IN_SYNCED		0x0200	/* node is being used by sync */
 #define	IN_CALLBACK_ULK		0x0400	/* node will be unlocked by callback */
 #define	IN_NODE_REBUILD		0x0800	/* node is rebuild */
+#define IN_NO_DELETE		0x1000	/* node is not to be deleted */
 
 
 #define IN_FLAGBITS \
 	"\10\1IN_ACCESS\2IN_CHANGE\3IN_UPDATE\4IN_MODIFY\5IN_MODIFIED" \
 	"\6IN_ACCESSED\7IN_RENAME\10IN_DELETED\11IN_LOCKED\12IN_SYNCED" \
-	"\13IN_CALLBACK_ULK\14IN_NODE_REBUILD"
+	"\13IN_CALLBACK_ULK\14IN_NODE_REBUILD\15IN_NO_DELETE"
 
 #endif /* !_FS_UDF_UDF_H_ */

Index: src/sys/fs/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.136 src/sys/fs/udf/udf_subr.c:1.137
--- src/sys/fs/udf/udf_subr.c:1.136	Wed Jan 27 00:06:49 2016
+++ src/sys/fs/udf/udf_subr.c	Tue May 10 15:23:39 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.136 2016/01/27 00:06:49 reinoud Exp $ */
+/* $NetBSD: udf_subr.c,v 1.137 2016/05/10 15:23:39 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.136 2016/01/27 00:06:49 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.137 2016/05/10 15:23:39 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -946,7 +946,7 @@ udf_read_anchors(struct udf_mount *ump)
 
 	/* VATs are only recorded on sequential media, but initialise */
 	ump->first_possible_vat_location = track_start + 2;
-	ump->last_possible_vat_location  = track_end + last_track.packet_size;
+	ump->last_possible_vat_location  = track_end;
 
 	return ok;
 }
@@ -2995,6 +2995,10 @@ udf_check_for_vat(struct udf_node *vat_n
 	ump->logvol_integrity->integrity_type = udf_rw32(UDF_INTEGRITY_CLOSED);
 	ump->logvol_integrity->time   = *mtime;
 
+	/* if we're updating, free old allocated space */
+	if (ump->vat_table)
+		free(ump->vat_table, M_UDFVOLD);
+
 	ump->vat_table_len = vat_length;
 	ump->vat_table_alloc_len = vat_table_alloc_len;
 	ump->vat_table   = vat_table;
@@ -3017,49 +3021,70 @@ out:
 static int
 udf_search_vat(struct udf_mount *ump, union udf_pmap *mapping)
 {
-	struct udf_node *vat_node;
+	struct udf_node *vat_node, *accepted_vat_node;
 	struct long_ad	 icb_loc;
-	uint32_t early_vat_loc, vat_loc;
+	uint32_t early_vat_loc, late_vat_loc, vat_loc;
 	int error;
 
 	/* mapping info not needed */
 	mapping = mapping;
 
-	vat_loc = ump->last_possible_vat_location;
-	early_vat_loc = vat_loc - 256;	/* 8 blocks of 32 sectors */
-
-	DPRINTF(VOLUMES, ("1) last possible %d, early_vat_loc %d \n",
-		vat_loc, early_vat_loc));
-	early_vat_loc = MAX(early_vat_loc, ump->first_possible_vat_location);
-
-	DPRINTF(VOLUMES, ("2) last possible %d, early_vat_loc %d \n",
-		vat_loc, early_vat_loc));
-
-	/* start looking from the end of the range */
+	DPRINTF(VOLUMES, ("Searching VAT\n"));
+	
+	/*
+	 * Start reading forward in blocks from the first possible vat
+	 * location. If not found in this block, start again a bit before
+	 * until we get a hit.
+	 */
+	late_vat_loc = ump->last_possible_vat_location;
+	early_vat_loc = MAX(late_vat_loc - 64, ump->first_possible_vat_location);
+ 
+	DPRINTF(VOLUMES, ("\tfull range %d to %d\n", early_vat_loc, late_vat_loc));
+	accepted_vat_node = NULL;
 	do {
-		DPRINTF(VOLUMES, ("Checking for VAT at sector %d\n", vat_loc));
-		icb_loc.loc.part_num = udf_rw16(UDF_VTOP_RAWPART);
-		icb_loc.loc.lb_num   = udf_rw32(vat_loc);
+		vat_loc = early_vat_loc;
+		DPRINTF(VOLUMES, ("\tchecking range %d to %d\n",
+			early_vat_loc, late_vat_loc));
+		do {
+			DPRINTF(VOLUMES, ("\t\tChecking for VAT at sector %d\n",
+vat_loc));
+			icb_loc.loc.part_num = udf_rw16(UDF_VTOP_RAWPART);
+			icb_loc.loc.lb_num   = udf_rw32(vat_loc);
 
-		error = udf_get_node(ump, _loc, _node);
-		if (!error) {
-			error = udf_check_for_vat(vat_node);
-			DPRINTFIF(VOLUMES, !error,
-("VAT accepted at %d\n", vat_loc));
-			if (!error)
-break;
-		}
-		if (vat_node) {
-			vput(vat_node->vnode);
-			

CVS commit: src/bin/sh

2016-05-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue May 10 15:14:30 UTC 2016

Modified Files:
src/bin/sh: eval.c

Log Message:
PR bin/48875 - minor correction (well, not so minor) - commands in loops
must be assumed to have something following, even if the loop itself doesn't,
so redirected fd's around func calls need to be saved.   Should fix etcupdate


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/bin/sh/eval.c

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/eval.c
diff -u src/bin/sh/eval.c:1.125 src/bin/sh/eval.c:1.126
--- src/bin/sh/eval.c:1.125	Mon May  9 21:03:10 2016
+++ src/bin/sh/eval.c	Tue May 10 15:14:30 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.125 2016/05/09 21:03:10 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.126 2016/05/10 15:14:30 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.125 2016/05/09 21:03:10 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.126 2016/05/10 15:14:30 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -380,7 +380,7 @@ skipping:	  if (evalskip == SKIPCONT && 
 			if (exitstatus == 0)
 break;
 		}
-		evaltree(n->nbinary.ch2, flags & (EV_TESTED | EV_MORE));
+		evaltree(n->nbinary.ch2, (flags & EV_TESTED) | EV_MORE);
 		status = exitstatus;
 		if (evalskip)
 			goto skipping;



CVS commit: src/sys/dev/usb

2016-05-10 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue May 10 15:14:03 UTC 2016

Modified Files:
src/sys/dev/usb: ohci.c uhci.c xhci.c

Log Message:
sprinkle _KERNEL_OPT


To generate a diff of this commit:
cvs rdiff -u -r1.262 -r1.263 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.272 -r1.273 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/usb/xhci.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/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.262 src/sys/dev/usb/ohci.c:1.263
--- src/sys/dev/usb/ohci.c:1.262	Mon May  9 21:52:43 2016
+++ src/sys/dev/usb/ohci.c	Tue May 10 15:14:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.262 2016/05/09 21:52:43 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.263 2016/05/10 15:14:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,9 +41,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.262 2016/05/09 21:52:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.263 2016/05/10 15:14:03 pooka Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_usb.h"
+#endif
 
 #include 
 

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.272 src/sys/dev/usb/uhci.c:1.273
--- src/sys/dev/usb/uhci.c:1.272	Fri May  6 20:12:54 2016
+++ src/sys/dev/usb/uhci.c	Tue May 10 15:14:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.272 2016/05/06 20:12:54 christos Exp $	*/
+/*	$NetBSD: uhci.c,v 1.273 2016/05/10 15:14:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,9 +42,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.272 2016/05/06 20:12:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.273 2016/05/10 15:14:03 pooka Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_usb.h"
+#endif
 
 #include 
 

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.45 src/sys/dev/usb/xhci.c:1.46
--- src/sys/dev/usb/xhci.c:1.45	Sat May  7 08:11:49 2016
+++ src/sys/dev/usb/xhci.c	Tue May 10 15:14:03 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.45 2016/05/07 08:11:49 skrll Exp $	*/
+/*	$NetBSD: xhci.c,v 1.46 2016/05/10 15:14:03 pooka Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,9 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.45 2016/05/07 08:11:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.46 2016/05/10 15:14:03 pooka Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_usb.h"
+#endif
 
 #include 
 #include 



CVS commit: src/sys/dev/usb

2016-05-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 10 10:40:33 UTC 2016

Modified Files:
src/sys/dev/usb: ucom.c

Log Message:
Fixup ucom_cleanup to not forget our pipe handles.

Simplify ucomreadcb by dealing with the USBD_CANCELLED separately and
not taking sc_lock.  We can't hold sc_lock while aborting now.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/usb/ucom.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/usb/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.111 src/sys/dev/usb/ucom.c:1.112
--- src/sys/dev/usb/ucom.c:1.111	Sat Apr 23 10:15:32 2016
+++ src/sys/dev/usb/ucom.c	Tue May 10 10:40:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.111 2016/04/23 10:15:32 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.112 2016/05/10 10:40:33 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.111 2016/04/23 10:15:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.112 2016/05/10 10:40:33 skrll Exp $");
 
 #include 
 #include 
@@ -1396,25 +1396,25 @@ ucomreadcb(struct usbd_xfer *xfer, void 
 
 	UCOMHIST_FUNC(); UCOMHIST_CALLED();
 
-	mutex_enter(>sc_lock);
-	ub = SIMPLEQ_FIRST(>sc_ibuff_empty);
-	SIMPLEQ_REMOVE_HEAD(>sc_ibuff_empty, ub_link);
+	if (status == USBD_CANCELLED)
+		return;
 
-	if (status == USBD_CANCELLED || status == USBD_IOERROR ||
+	mutex_enter(>sc_lock);
+	if (status == USBD_IOERROR ||
 	sc->sc_dying) {
 		DPRINTF("dying", 0, 0, 0, 0);
-		ub->ub_index = ub->ub_len = 0;
 		/* Send something to wake upper layer */
-		if (status != USBD_CANCELLED) {
-			(tp->t_linesw->l_rint)('\n', tp);
-			mutex_spin_enter(_lock);	/* XXX */
-			ttwakeup(tp);
-			mutex_spin_exit(_lock);	/* XXX */
-		}
+		(tp->t_linesw->l_rint)('\n', tp);
+		mutex_spin_enter(_lock);	/* XXX */
+		ttwakeup(tp);
+		mutex_spin_exit(_lock);	/* XXX */
 		mutex_exit(>sc_lock);
 		return;
 	}
 
+	ub = SIMPLEQ_FIRST(>sc_ibuff_empty);
+	SIMPLEQ_REMOVE_HEAD(>sc_ibuff_empty, ub_link);
+
 	if (status == USBD_STALLED) {
 		usbd_clear_endpoint_stall_async(sc->sc_bulkin_pipe);
 		ucomsubmitread(sc, ub);
@@ -1474,18 +1474,10 @@ ucom_cleanup(struct ucom_softc *sc)
 
 	ucom_shutdown(sc);
 	if (sc->sc_bulkin_pipe != NULL) {
-		struct usbd_pipe *bulkin_pipe = sc->sc_bulkin_pipe;
-		sc->sc_bulkin_pipe = NULL;
-		mutex_exit(>sc_lock);
-		usbd_abort_pipe(bulkin_pipe);
-		mutex_enter(>sc_lock);
+		usbd_abort_pipe(sc->sc_bulkin_pipe);
 	}
 	if (sc->sc_bulkout_pipe != NULL) {
-		struct usbd_pipe *bulkout_pipe = sc->sc_bulkout_pipe;
-		sc->sc_bulkout_pipe = NULL;
-		mutex_exit(>sc_lock);
-		usbd_abort_pipe(bulkout_pipe);
-		mutex_enter(>sc_lock);
+		usbd_abort_pipe(sc->sc_bulkout_pipe);
 	}
 }
 



CVS commit: src/lib/csu/common

2016-05-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 10 10:23:09 UTC 2016

Modified Files:
src/lib/csu/common: Makefile.inc

Log Message:
We need the -O1 hack (for gcc 5.3) for crtbegin.c as well.
Works around PR toolchain/51121.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/lib/csu/common/Makefile.inc

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

Modified files:

Index: src/lib/csu/common/Makefile.inc
diff -u src/lib/csu/common/Makefile.inc:1.30 src/lib/csu/common/Makefile.inc:1.31
--- src/lib/csu/common/Makefile.inc:1.30	Sun May  1 07:25:46 2016
+++ src/lib/csu/common/Makefile.inc	Tue May 10 10:23:09 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.30 2016/05/01 07:25:46 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.31 2016/05/10 10:23:09 martin Exp $
 
 .include 
 
@@ -23,6 +23,7 @@ CFLAGS.crtbegin.c+= -fPIE
  !exists(${ARCHDIR}/crtbegin.S)
 CFLAGS.crt0-common.c+=	-O1
 CFLAGS.crtbeginS.c+=	-O1
+CFLAGS.crtbegin.c+=	-O1
 . endif
 .endif
 



CVS commit: [netbsd-7] src/lib/libc/stdlib

2016-05-10 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 10 09:10:11 UTC 2016

Modified Files:
src/lib/libc/stdlib [netbsd-7]: jemalloc.c

Log Message:
Fix merge botch for #1161


To generate a diff of this commit:
cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/lib/libc/stdlib/jemalloc.c

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

Modified files:

Index: src/lib/libc/stdlib/jemalloc.c
diff -u src/lib/libc/stdlib/jemalloc.c:1.34.2.2 src/lib/libc/stdlib/jemalloc.c:1.34.2.3
--- src/lib/libc/stdlib/jemalloc.c:1.34.2.2	Mon May  9 19:34:50 2016
+++ src/lib/libc/stdlib/jemalloc.c	Tue May 10 09:10:11 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: jemalloc.c,v 1.34.2.2 2016/05/09 19:34:50 snj Exp $	*/
+/*	$NetBSD: jemalloc.c,v 1.34.2.3 2016/05/10 09:10:11 martin Exp $	*/
 
 /*-
  * Copyright (C) 2006,2007 Jason Evans .
@@ -118,7 +118,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/lib/libc/stdlib/malloc.c,v 1.147 2007/06/15 22:00:16 jasone Exp $"); */ 
-__RCSID("$NetBSD: jemalloc.c,v 1.34.2.2 2016/05/09 19:34:50 snj Exp $");
+__RCSID("$NetBSD: jemalloc.c,v 1.34.2.3 2016/05/10 09:10:11 martin Exp $");
 
 #ifdef __FreeBSD__
 #include "libc_private.h"
@@ -1651,6 +1651,11 @@ arena_chunk_comp(arena_chunk_t *a, arena
 	assert(a != NULL);
 	assert(b != NULL);
 
+	if (a->max_frun_npages < b->max_frun_npages)
+		return -1;
+	if (a->max_frun_npages > b->max_frun_npages)
+		return 1;
+
 	if ((uintptr_t)a < (uintptr_t)b)
 		return (-1);
 	else if (a == b)
@@ -1671,11 +1676,6 @@ arena_run_comp(arena_run_t *a, arena_run
 	assert(a != NULL);
 	assert(b != NULL);
 
-	if (a->max_frun_npages < b->max_frun_npages)
-		return -1;
-	if (a->max_frun_npages > b->max_frun_npages)
-		return 1;
-
 	if ((uintptr_t)a < (uintptr_t)b)
 		return (-1);
 	else if (a == b)



CVS commit: src/sbin/atactl

2016-05-10 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May 10 08:08:59 UTC 2016

Modified Files:
src/sbin/atactl: atactl.c

Log Message:
update the micron smart codes for 247/248 to match data i found in
micron's "TN-FD-33: M510DC SSD SMART Implementation Introduction"
document.

these two values can be used to calculate the write amplication
factor:

   WAF = ( A247 + A248 ) / A247


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sbin/atactl/atactl.c

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

Modified files:

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.75 src/sbin/atactl/atactl.c:1.76
--- src/sbin/atactl/atactl.c:1.75	Mon Sep 21 06:05:00 2015
+++ src/sbin/atactl/atactl.c	Tue May 10 08:08:59 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: atactl.c,v 1.75 2015/09/21 06:05:00 mrg Exp $	*/
+/*	$NetBSD: atactl.c,v 1.76 2016/05/10 08:08:59 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.75 2015/09/21 06:05:00 mrg Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.76 2016/05/10 08:08:59 mrg Exp $");
 #endif
 
 
@@ -333,8 +333,8 @@ static const struct {
 	{ 241,		"Total LBAs Written", NULL },
 	{ 242,		"Total LBAs Read", NULL },
 	{ 246,		"Total Host Sector Writes", NULL },
-	{ 247,		"Contact Factory (Micron)", NULL },
-	{ 248,		"Contact Factory (Micron)", NULL },
+	{ 247,		"Host Program NAND Pages Count", NULL },
+	{ 248,		"FTL Program Pages Count ", NULL },
 	{ 250,		"Read error retry rate", NULL },
 	{ 254,		"Free Fall Sensor", NULL },
 	{   0,		"Unknown", NULL },