CVS commit: src/sys/netinet6

2017-11-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov 10 07:27:57 UTC 2017

Modified Files:
src/sys/netinet6: in6_ifattach.c

Log Message:
Use psref instead of pserialize because that code is sleepable


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/netinet6/in6_ifattach.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/netinet6/in6_ifattach.c
diff -u src/sys/netinet6/in6_ifattach.c:1.112 src/sys/netinet6/in6_ifattach.c:1.113
--- src/sys/netinet6/in6_ifattach.c:1.112	Thu Feb 23 07:57:10 2017
+++ src/sys/netinet6/in6_ifattach.c	Fri Nov 10 07:27:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_ifattach.c,v 1.112 2017/02/23 07:57:10 ozaki-r Exp $	*/
+/*	$NetBSD: in6_ifattach.c,v 1.113 2017/11/10 07:27:57 ozaki-r Exp $	*/
 /*	$KAME: in6_ifattach.c,v 1.124 2001/07/18 08:32:51 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.112 2017/02/23 07:57:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_ifattach.c,v 1.113 2017/11/10 07:27:57 ozaki-r Exp $");
 
 #include 
 #include 
@@ -787,13 +787,15 @@ in6_ifattach(struct ifnet *ifp, struct i
 	 */
 	if (!(ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) &&
 	ND_IFINFO(ifp)->flags & ND6_IFF_AUTO_LINKLOCAL) {
-		int s = pserialize_read_enter();
-		ia = in6ifa_ifpforlinklocal(ifp, 0);
+		int bound = curlwp_bind();
+		struct psref psref;
+		ia = in6ifa_ifpforlinklocal_psref(ifp, 0, );
 		if (ia == NULL && in6_ifattach_linklocal(ifp, altifp) != 0) {
 			printf("%s: cannot assign link-local address\n",
 			ifp->if_xname);
 		}
-		pserialize_read_exit(s);
+		ia6_release(ia, );
+		curlwp_bindx(bound);
 	}
 }
 



CVS commit: src/sys/netinet6

2017-11-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov 10 07:25:39 UTC 2017

Modified Files:
src/sys/netinet6: nd6.c

Log Message:
Use psref instead of pserialize because that code is sleepable


To generate a diff of this commit:
cvs rdiff -u -r1.237 -r1.238 src/sys/netinet6/nd6.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/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.237 src/sys/netinet6/nd6.c:1.238
--- src/sys/netinet6/nd6.c:1.237	Fri Nov 10 07:24:28 2017
+++ src/sys/netinet6/nd6.c	Fri Nov 10 07:25:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.237 2017/11/10 07:24:28 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.237 2017/11/10 07:24:28 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.238 2017/11/10 07:25:39 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -1446,7 +1446,7 @@ nd6_rtrequest(int req, struct rtentry *r
 
 	switch (req) {
 	case RTM_ADD: {
-		int s;
+		struct psref psref;
 
 		RT_DPRINTF("rt_getkey(rt) = %p\n", rt_getkey(rt));
 		/*
@@ -1554,9 +1554,8 @@ nd6_rtrequest(int req, struct rtentry *r
 		 * check if rt_getkey(rt) is an address assigned
 		 * to the interface.
 		 */
-		s = pserialize_read_enter();
-		ifa = (struct ifaddr *)in6ifa_ifpwithaddr(ifp,
-		(rt_getkey(rt))->sin6_addr);
+		ifa = (struct ifaddr *)in6ifa_ifpwithaddr_psref(ifp,
+		(rt_getkey(rt))->sin6_addr, );
 		if (ifa != NULL) {
 			if (nd6_useloopback) {
 rt->rt_ifp = lo0ifp;	/* XXX */
@@ -1593,7 +1592,7 @@ nd6_rtrequest(int req, struct rtentry *r
 			}
 		}
 	out:
-		pserialize_read_exit(s);
+		ifa_release(ifa, );
 		/*
 		 * If we have too many cache entries, initiate immediate
 		 * purging for some entries.



CVS commit: src/sys

2017-11-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov 10 07:24:28 UTC 2017

Modified Files:
src/sys/net: if_llatbl.c if_llatbl.h
src/sys/netinet: if_arp.c in.c
src/sys/netinet6: in6.c nd6.c

Log Message:
Fix a deadlock between a route update and lltable

It happens because rtalloc1 is called from lltable with holding
IF_AFDATA_WLOCK.

If a route update is in action, rtalloc1 would wait for its completion with
holding IF_AFDATA_WLOCK. At the same moment, a softint (e.g., arpintr) may try
to take IF_AFDATA_WLOCK and get stuck on it. Unfortunately the stuck softint
prevents the route update from progressing because the route update calls
psref_target_destroy that needs the softint to complete.

A resource allocation graph of the senario looks like this:
route update =(psref_target_destroy)=> softint => IF_AFDATA_WLOCK
=(rt_update_wait)=> route update

Fix the deadlock by pulling rtalloc1 out of the lltable codes inside
IF_AFDATA_WLOCK.

Note that the deadlock happens only if NET_MPSAFE is enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net/if_llatbl.h
cvs rdiff -u -r1.253 -r1.254 src/sys/netinet/if_arp.c
cvs rdiff -u -r1.208 -r1.209 src/sys/netinet/in.c
cvs rdiff -u -r1.249 -r1.250 src/sys/netinet6/in6.c
cvs rdiff -u -r1.236 -r1.237 src/sys/netinet6/nd6.c

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

Modified files:

Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.21 src/sys/net/if_llatbl.c:1.22
--- src/sys/net/if_llatbl.c:1.21	Wed Jun 28 04:14:53 2017
+++ src/sys/net/if_llatbl.c	Fri Nov 10 07:24:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.c,v 1.21 2017/06/28 04:14:53 ozaki-r Exp $	*/
+/*	$NetBSD: if_llatbl.c,v 1.22 2017/11/10 07:24:28 ozaki-r Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -386,7 +386,7 @@ llentry_alloc(struct ifnet *ifp, struct 
 	(ifp->if_flags & IFF_NOARP) == 0) {
 #endif
 		IF_AFDATA_WLOCK(ifp);
-		la = lla_create(lt, 0, (struct sockaddr *)dst);
+		la = lla_create(lt, 0, (struct sockaddr *)dst, NULL /* XXX */);
 		IF_AFDATA_WUNLOCK(ifp);
 	}
 
@@ -656,7 +656,12 @@ lla_rt_output(const u_char rtm_type, con
 	error = 0;
 
 	switch (rtm_type) {
-	case RTM_ADD:
+	case RTM_ADD: {
+		struct rtentry *rt;
+
+		/* Never call rtalloc1 with IF_AFDATA_WLOCK */
+		rt = rtalloc1(dst, 0);
+
 		/* Add static LLE */
 		IF_AFDATA_WLOCK(ifp);
 		lle = lla_lookup(llt, 0, dst);
@@ -666,15 +671,19 @@ lla_rt_output(const u_char rtm_type, con
 		(lle->la_flags & LLE_STATIC || lle->la_expire == 0)) {
 			LLE_RUNLOCK(lle);
 			IF_AFDATA_WUNLOCK(ifp);
+			if (rt != NULL)
+rt_unref(rt);
 			error = EEXIST;
 			goto out;
 		}
 		if (lle != NULL)
 			LLE_RUNLOCK(lle);
 
-		lle = lla_create(llt, 0, dst);
+		lle = lla_create(llt, 0, dst, rt);
 		if (lle == NULL) {
 			IF_AFDATA_WUNLOCK(ifp);
+			if (rt != NULL)
+rt_unref(rt);
 			error = ENOMEM;
 			goto out;
 		}
@@ -703,6 +712,8 @@ lla_rt_output(const u_char rtm_type, con
 		laflags = lle->la_flags;
 		LLE_WUNLOCK(lle);
 		IF_AFDATA_WUNLOCK(ifp);
+		if (rt != NULL)
+			rt_unref(rt);
 #if defined(INET) && NARP > 0
 		/* gratuitous ARP */
 		if ((laflags & LLE_PUB) && dst->sa_family == AF_INET) {
@@ -721,8 +732,8 @@ lla_rt_output(const u_char rtm_type, con
 #else
 		(void)laflags;
 #endif
-
 		break;
+	}
 
 	case RTM_DELETE:
 		IF_AFDATA_WLOCK(ifp);

Index: src/sys/net/if_llatbl.h
diff -u src/sys/net/if_llatbl.h:1.12 src/sys/net/if_llatbl.h:1.13
--- src/sys/net/if_llatbl.h:1.12	Fri Jun 23 05:46:10 2017
+++ src/sys/net/if_llatbl.h	Fri Nov 10 07:24:28 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_llatbl.h,v 1.12 2017/06/23 05:46:10 ozaki-r Exp $	*/
+/*	$NetBSD: if_llatbl.h,v 1.13 2017/11/10 07:24:28 ozaki-r Exp $	*/
 /*
  * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
  * Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -190,7 +190,7 @@ struct llentry {
 typedef	struct llentry *(llt_lookup_t)(struct lltable *, u_int flags,
 const struct sockaddr *l3addr);
 typedef	struct llentry *(llt_create_t)(struct lltable *, u_int flags,
-const struct sockaddr *l3addr);
+const struct sockaddr *l3addr, const struct rtentry *);
 typedef	int (llt_delete_t)(struct lltable *, u_int flags,
 const struct sockaddr *l3addr);
 typedef void (llt_prefix_free_t)(struct lltable *,
@@ -297,10 +297,11 @@ lla_lookup(struct lltable *llt, u_int fl
 }
 
 static __inline struct llentry *
-lla_create(struct lltable *llt, u_int flags, const struct sockaddr *l3addr)
+lla_create(struct lltable *llt, u_int flags, const struct sockaddr *l3addr,
+const struct rtentry *rt)
 {
 
-	return (llt->llt_create(llt, flags, l3addr));
+	return (llt->llt_create(llt, flags, l3addr, rt));
 }
 
 static __inline int

Index: src/sys/netinet/if_arp.c

CVS commit: src/sys

2017-11-09 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Nov 10 07:15:32 UTC 2017

Modified Files:
src/sys/netinet: in.c
src/sys/netinet6: in6.c

Log Message:
Remove redundant KASSERTMSG

The function is static, has just one caller and the caller does the same check.


To generate a diff of this commit:
cvs rdiff -u -r1.207 -r1.208 src/sys/netinet/in.c
cvs rdiff -u -r1.248 -r1.249 src/sys/netinet6/in6.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/in.c
diff -u src/sys/netinet/in.c:1.207 src/sys/netinet/in.c:1.208
--- src/sys/netinet/in.c:1.207	Thu Aug 10 04:31:58 2017
+++ src/sys/netinet/in.c	Fri Nov 10 07:15:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.207 2017/08/10 04:31:58 ryo Exp $	*/
+/*	$NetBSD: in.c,v 1.208 2017/11/10 07:15:32 ozaki-r Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.207 2017/08/10 04:31:58 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.208 2017/11/10 07:15:32 ozaki-r Exp $");
 
 #include "arp.h"
 
@@ -1980,9 +1980,6 @@ in_lltable_rtcheck(struct ifnet *ifp, u_
 	struct rtentry *rt;
 	int error = EINVAL;
 
-	KASSERTMSG(l3addr->sa_family == AF_INET,
-	"sin_family %d", l3addr->sa_family);
-
 	rt = rtalloc1(l3addr, 0);
 	if (rt == NULL)
 		return error;

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.248 src/sys/netinet6/in6.c:1.249
--- src/sys/netinet6/in6.c:1.248	Thu Jun 22 09:53:25 2017
+++ src/sys/netinet6/in6.c	Fri Nov 10 07:15:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.248 2017/06/22 09:53:25 ozaki-r Exp $	*/
+/*	$NetBSD: in6.c,v 1.249 2017/11/10 07:15:32 ozaki-r Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.248 2017/06/22 09:53:25 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.249 2017/11/10 07:15:32 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2465,9 +2465,6 @@ in6_lltable_rtcheck(struct ifnet *ifp,
 	struct rtentry *rt;
 	char ip6buf[INET6_ADDRSTRLEN];
 
-	KASSERTMSG(l3addr->sa_family == AF_INET6,
-	"sin_family %d", l3addr->sa_family);
-
 	rt = rtalloc1(l3addr, 0);
 	if (rt == NULL || (rt->rt_flags & RTF_GATEWAY) || rt->rt_ifp != ifp) {
 		int s;



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

2017-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Nov 10 00:09:23 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
Added Files:
src/sys/arch/arm/sunxi: sunxi_nand.c

Log Message:
Allwinner NAND Flash Controller driver. Work in progress.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_nand.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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.37 src/sys/arch/arm/sunxi/files.sunxi:1.38
--- src/sys/arch/arm/sunxi/files.sunxi:1.37	Mon Oct 23 11:06:31 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Fri Nov 10 00:09:23 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.37 2017/10/23 11:06:31 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.38 2017/11/10 00:09:23 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -222,6 +222,11 @@ device	sunxisramc
 attach	sunxisramc at fdt with sunxi_sramc
 file	arch/arm/sunxi/sunxi_sramc.c		sunxi_sramc
 
+# NAND Flash Controller
+device	sunxinand: nandbus
+attach	sunxinand at fdt with sunxi_nand
+file	arch/arm/sunxi/sunxi_nand.c		sunxi_nand
+
 # SOC parameters
 defflag	opt_soc.h			SOC_SUNXI
 defflag	opt_soc.h			SOC_SUN4I: SOC_SUNXI

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_nand.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_nand.c:1.1
--- /dev/null	Fri Nov 10 00:09:23 2017
+++ src/sys/arch/arm/sunxi/sunxi_nand.c	Fri Nov 10 00:09:23 2017
@@ -0,0 +1,596 @@
+/* $NetBSD: sunxi_nand.c,v 1.1 2017/11/10 00:09:23 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: sunxi_nand.c,v 1.1 2017/11/10 00:09:23 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#define	NDFC_CTL		0x00
+#define	 NDFC_CTL_CE_SEL		__BITS(27,24)
+#define	 NDFC_CTL_PAGE_SIZE		__BITS(11,8)
+#define	 NDFC_CTL_RB_SEL		__BITS(4,3)
+#define	 NDFC_CTL_BUS_WIDTH		__BIT(2)
+#define	 NDFC_CTL_RESET			__BIT(1)
+#define	 NDFC_CTL_EN			__BIT(0)
+#define	NDFC_ST			0x04
+#define	 NDFC_ST_RB_STATE(n)		__BIT(8 + (n))
+#define	 NDFC_ST_CMD_FIFO_STATUS	__BIT(3)
+#define	 NDFC_ST_CMD_INT_FLAG		__BIT(1)
+#define	NDFC_INT		0x08
+#define	NDFC_TIMING_CTL		0x0c
+#define	NDFC_TIMING_CFG		0x10
+#define	NDFC_ADDR_LOW		0x14
+#define	NDFC_ADDR_HIGH		0x18
+#define	NDFC_BLOCK_NUM		0x1c
+#define	NDFC_CNT		0x20
+#define	 NDFC_CNT_DATA_CNT		__BITS(9,0)
+#define	NDFC_CMD		0x24
+#define	 NDFC_CMD_DATA_METHOD		__BIT(26)
+#define	 NDFC_CMD_SEND_FIRST_CMD	__BIT(22)
+#define	 NDFC_CMD_DATA_TRANS		__BIT(21)
+#define	 NDFC_CMD_ACCESS_DIR		__BIT(20)
+#define	 NDFC_CMD_SEND_ADR		__BIT(19)
+#define	 NDFC_CMD_ADR_NUM		__BITS(18,16)
+#define	NDFC_RCMD_SET		0x28
+#define	NDFC_WCMD_SET		0x2c
+#define	NDFC_IO_DATA		0x30
+#define	NDFC_ECC_CTL		0x34
+#define	NDFC_ECC_ST		0x38
+#define	NDFC_EFR		0x3c
+#define	NDFC_ERR_CNT0		0x40
+#define	NDFC_ERR_CNT1		0x44
+#define	NDFC_USER_DATA(n)	(0x50 + 4 * (n))
+#define	NDFC_EFNAND_STA		0x90
+#define	NDFC_SPARE_AREA		0xa0
+#define	NDFC_PAT_ID		0xa4
+#define	NDFC_RDATA_STA_CTL	0xa8
+#define	NDFC_RDATA_STA_0	0xac
+#define	NDFC_RDATA_STA_1	0xb0
+#define	NDFC_MDMA_ADDR		0xc0
+#define	NDFC_MDMA_CNT		0xc4
+#define	NDFC_RAM0_BASE		0x400
+#define	NDFC_RAM1_BASE		0x800
+
+#define	NDFC_RAM_SIZE		1024
+
+static const char * compatible[] = {
+	"allwinner,sun4i-a10-nand",
+	NULL
+};
+
+struct sunxi_nand_softc;
+
+enum sunxi_nand_eccmode {
+	ECC_MODE_UNKNOWN,
+	ECC_MODE_HW,
+	

CVS commit: src/sys/dev/acpi

2017-11-09 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Thu Nov  9 23:51:54 UTC 2017

Modified Files:
src/sys/dev/acpi: valz_acpi.c

Log Message:
Do not emit a meaningless message when lid open/close from valz(4)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/valz_acpi.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/acpi/valz_acpi.c
diff -u src/sys/dev/acpi/valz_acpi.c:1.7 src/sys/dev/acpi/valz_acpi.c:1.8
--- src/sys/dev/acpi/valz_acpi.c:1.7	Mon Oct  5 15:57:50 2015
+++ src/sys/dev/acpi/valz_acpi.c	Thu Nov  9 23:51:54 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: valz_acpi.c,v 1.7 2015/10/05 15:57:50 christos Exp $	*/
+/*	$NetBSD: valz_acpi.c,v 1.8 2017/11/09 23:51:54 ryoon Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: valz_acpi.c,v 1.7 2015/10/05 15:57:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: valz_acpi.c,v 1.8 2017/11/09 23:51:54 ryoon Exp $");
 
 #include 
 #include 
@@ -336,7 +336,7 @@ valz_acpi_notify_handler(ACPI_HANDLE han
 		break;
 
 	default:
-		aprint_error_dev(sc->sc_dev,
+		aprint_debug_dev(sc->sc_dev,
 		"unknown notify 0x%02X\n", notify);
 		break;
 	}



CVS commit: src/sys/kern

2017-11-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  9 23:20:12 UTC 2017

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

Log Message:
Assert KM_SLEEP xor KM_NOSLEEP in all kmem allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/subr_kmem.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/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.64 src/sys/kern/subr_kmem.c:1.65
--- src/sys/kern/subr_kmem.c:1.64	Tue Nov  7 18:35:57 2017
+++ src/sys/kern/subr_kmem.c	Thu Nov  9 23:20:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.64 2017/11/07 18:35:57 christos Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.65 2017/11/09 23:20:12 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.64 2017/11/07 18:35:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.65 2017/11/09 23:20:12 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
@@ -260,6 +260,9 @@ kmem_intr_alloc(size_t requested_size, k
 
 	KASSERT(requested_size > 0);
 
+	KASSERT((kmflags & KM_SLEEP) || (kmflags & KM_NOSLEEP));
+	KASSERT(!(kmflags & KM_SLEEP) || !(kmflags & KM_NOSLEEP));
+
 #ifdef KMEM_GUARD
 	if (kmem_guard_enabled) {
 		return kmem_guard_alloc(_guard, requested_size,



CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:52:27 UTC 2017

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

Log Message:
Add assertions that either PR_WAITOK or PR_NOWAIT are set.


To generate a diff of this commit:
cvs rdiff -u -r1.214 -r1.215 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.214 src/sys/kern/subr_pool.c:1.215
--- src/sys/kern/subr_pool.c:1.214	Thu Nov  9 14:34:17 2017
+++ src/sys/kern/subr_pool.c	Thu Nov  9 17:52:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.214 2017/11/09 19:34:17 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.215 2017/11/09 22:52:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.214 2017/11/09 19:34:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.215 2017/11/09 22:52:26 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -751,6 +751,7 @@ pool_get(struct pool *pp, int flags)
 	struct pool_item_header *ph;
 	void *v;
 
+	KASSERT(!(flags & PR_NOWAIT) != !(flags & PR_WAITOK));
 	KASSERTMSG((pp->pr_itemsperpage != 0),
 	"%s: [%s] pr_itemsperpage is zero, "
 	"pool not initialized?", __func__, pp->pr_wchan);
@@ -2230,6 +2231,7 @@ pool_cache_get_paddr(pool_cache_t pc, in
 	void *object;
 	int s;
 
+	KASSERT(!(flags & PR_NOWAIT) != !(flags & PR_WAITOK));
 	KASSERTMSG((!cpu_intr_p() && !cpu_softintr_p()) ||
 	(pc->pc_pool.pr_ipl != IPL_NONE || cold || panicstr != NULL),
 	"%s: [%s] is IPL_NONE, but called from interrupt context",



CVS commit: src/sys/sys

2017-11-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  9 22:34:07 UTC 2017

Modified Files:
src/sys/sys: mbuf.h

Log Message:
panic ex nihilo -- PR_NOWAITing for zerot


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/sys/mbuf.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/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.171 src/sys/sys/mbuf.h:1.172
--- src/sys/sys/mbuf.h:1.171	Tue Sep 26 07:42:06 2017
+++ src/sys/sys/mbuf.h	Thu Nov  9 22:34:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.171 2017/09/26 07:42:06 knakahara Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.172 2017/11/09 22:34:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -516,7 +516,7 @@ do {	\
 do {	\
 	(m)->m_ext_storage.ext_buf = (char *)\
 	pool_cache_get_paddr((pool_cache),\
-		(how) == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : 0,		\
+		(how) == M_WAIT ? (PR_WAITOK|PR_LIMITFAIL) : PR_NOWAIT,	\
 		&(m)->m_ext_storage.ext_paddr);\
 	if ((m)->m_ext_storage.ext_buf != NULL) {			\
 		MCLINITREFERENCE(m);	\



CVS commit: src/sys/dev/marvell

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:22:58 UTC 2017

Modified Files:
src/sys/dev/marvell: mvxpsec.c

Log Message:
use PR_NOWAIT instead of 0


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/marvell/mvxpsec.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/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.1 src/sys/dev/marvell/mvxpsec.c:1.2
--- src/sys/dev/marvell/mvxpsec.c:1.1	Wed Jun  3 00:20:02 2015
+++ src/sys/dev/marvell/mvxpsec.c	Thu Nov  9 17:22:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.1 2015/06/03 04:20:02 hsuenaga Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.2 2017/11/09 22:22:58 christos Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -1498,7 +1498,7 @@ mvxpsec_session_alloc(struct mvxpsec_sof
 {
 	struct mvxpsec_session *mv_s;
 
-	mv_s = pool_cache_get(sc->sc_session_pool, 0);
+	mv_s = pool_cache_get(sc->sc_session_pool, PR_NOWAIT);
 	if (mv_s == NULL) {
 		log(LOG_ERR, "%s: cannot allocate memory\n", __func__);
 		return NULL;
@@ -1614,7 +1614,7 @@ mvxpsec_packet_alloc(struct mvxpsec_sess
 		sc->sc_free_qlen--;
 	}
 	else {
-		mv_p = pool_cache_get(sc->sc_packet_pool, 0);
+		mv_p = pool_cache_get(sc->sc_packet_pool, PR_NOWAIT);
 		if (mv_p == NULL) {
 			log(LOG_ERR, "%s: cannot allocate memory\n",
 			__func__);



CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:21:27 UTC 2017

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

Log Message:
Don't use 0 for PR_NOWAIT


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.172 src/sys/kern/uipc_mbuf.c:1.173
--- src/sys/kern/uipc_mbuf.c:1.172	Fri Mar 31 01:44:05 2017
+++ src/sys/kern/uipc_mbuf.c	Thu Nov  9 17:21:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.172 2017/03/31 05:44:05 msaitoh Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.173 2017/11/09 22:21:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.172 2017/03/31 05:44:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.173 2017/11/09 22:21:27 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -589,7 +589,7 @@ m_get(int nowait, int type)
 	KASSERT(type != MT_FREE);
 
 	m = pool_cache_get(mb_cache,
-	nowait == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : 0);
+	nowait == M_WAIT ? PR_WAITOK|PR_LIMITFAIL : PR_NOWAIT);
 	if (m == NULL)
 		return NULL;
 



CVS commit: src/sys/opencrypto

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:20:26 UTC 2017

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

Log Message:
use PR_NOWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/opencrypto/crypto.c

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

Modified files:

Index: src/sys/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.101 src/sys/opencrypto/crypto.c:1.102
--- src/sys/opencrypto/crypto.c:1.101	Thu Sep 21 23:04:06 2017
+++ src/sys/opencrypto/crypto.c	Thu Nov  9 17:20:25 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.101 2017/09/22 03:04:06 knakahara Exp $ */
+/*	$NetBSD: crypto.c,v 1.102 2017/11/09 22:20:25 christos Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.101 2017/09/22 03:04:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.102 2017/11/09 22:20:25 christos Exp $");
 
 #include 
 #include 
@@ -1655,14 +1655,14 @@ crypto_getreq(int num)
 	}
 	crypto_put_crp_ret_qs(curcpu());
 
-	crp = pool_cache_get(cryptop_cache, 0);
+	crp = pool_cache_get(cryptop_cache, PR_NOWAIT);
 	if (crp == NULL) {
 		return NULL;
 	}
 	memset(crp, 0, sizeof(struct cryptop));
 
 	while (num--) {
-		crd = pool_cache_get(cryptodesc_cache, 0);
+		crd = pool_cache_get(cryptodesc_cache, PR_NOWAIT);
 		if (crd == NULL) {
 			crypto_freereq(crp);
 			return NULL;



CVS commit: src/sys/ufs/chfs

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 22:16:39 UTC 2017

Modified Files:
src/sys/ufs/chfs: chfs_malloc.c

Log Message:
use PR_WAITOK everywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/ufs/chfs/chfs_malloc.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/chfs/chfs_malloc.c
diff -u src/sys/ufs/chfs/chfs_malloc.c:1.4 src/sys/ufs/chfs/chfs_malloc.c:1.5
--- src/sys/ufs/chfs/chfs_malloc.c:1.4	Fri Oct 19 08:44:39 2012
+++ src/sys/ufs/chfs/chfs_malloc.c	Thu Nov  9 17:16:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: chfs_malloc.c,v 1.4 2012/10/19 12:44:39 ttoth Exp $	*/
+/*	$NetBSD: chfs_malloc.c,v 1.5 2017/11/09 22:16:38 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -314,7 +314,7 @@ struct chfs_flash_vnode*
 chfs_alloc_flash_vnode(void)
 {
 	struct chfs_flash_vnode *ret;
-	ret = pool_cache_get(chfs_flash_vnode_cache, 0);
+	ret = pool_cache_get(chfs_flash_vnode_cache, PR_WAITOK);
 	return ret;
 }
 
@@ -330,7 +330,7 @@ struct chfs_flash_dirent_node*
 chfs_alloc_flash_dirent(void)
 {
 	struct chfs_flash_dirent_node *ret;
-	ret = pool_cache_get(chfs_flash_dirent_cache, 0);
+	ret = pool_cache_get(chfs_flash_dirent_cache, PR_WAITOK);
 	return ret;
 }
 
@@ -346,7 +346,7 @@ struct chfs_flash_data_node*
 chfs_alloc_flash_dnode(void)
 {
 	struct chfs_flash_data_node *ret;
-	ret = pool_cache_get(chfs_flash_dnode_cache, 0);
+	ret = pool_cache_get(chfs_flash_dnode_cache, PR_WAITOK);
 	return ret;
 }
 
@@ -362,7 +362,7 @@ struct chfs_node_frag*
 chfs_alloc_node_frag(void)
 {
 	struct chfs_node_frag *ret;
-	ret = pool_cache_get(chfs_node_frag_cache, 0);
+	ret = pool_cache_get(chfs_node_frag_cache, PR_WAITOK);
 	return ret;
 }
 
@@ -378,7 +378,7 @@ struct chfs_tmp_dnode *
 chfs_alloc_tmp_dnode(void)
 {
 	struct chfs_tmp_dnode *ret;
-	ret = pool_cache_get(chfs_tmp_dnode_cache, 0);
+	ret = pool_cache_get(chfs_tmp_dnode_cache, PR_WAITOK);
 	ret->next = NULL;
 	return ret;
 }
@@ -395,7 +395,7 @@ struct chfs_tmp_dnode_info *
 chfs_alloc_tmp_dnode_info(void)
 {
 	struct chfs_tmp_dnode_info *ret;
-	ret = pool_cache_get(chfs_tmp_dnode_info_cache, 0);
+	ret = pool_cache_get(chfs_tmp_dnode_info_cache, PR_WAITOK);
 	ret->tmpnode = NULL;
 	return ret;
 }



CVS commit: src/sys/dev/dtv

2017-11-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Nov  9 22:16:35 UTC 2017

Modified Files:
src/sys/dev/dtv: dtv_scatter.c

Log Message:
Guess pool_cache_get(pc, 0) means PR_WAITOK here.

Earlier on in the same context we use kmem_alloc(sz, KM_SLEEP).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/dtv/dtv_scatter.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/dtv/dtv_scatter.c
diff -u src/sys/dev/dtv/dtv_scatter.c:1.3 src/sys/dev/dtv/dtv_scatter.c:1.4
--- src/sys/dev/dtv/dtv_scatter.c:1.3	Thu Jun  1 02:45:10 2017
+++ src/sys/dev/dtv/dtv_scatter.c	Thu Nov  9 22:16:34 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_scatter.c,v 1.3 2017/06/01 02:45:10 chs Exp $ */
+/* $NetBSD: dtv_scatter.c,v 1.4 2017/11/09 22:16:34 riastradh Exp $ */
 
 /*
  * Copyright (c) 2008 Patrick Mahoney 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtv_scatter.c,v 1.3 2017/06/01 02:45:10 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_scatter.c,v 1.4 2017/11/09 22:16:34 riastradh Exp $");
 
 #include 
 #include 
@@ -101,7 +101,7 @@ dtv_scatter_buf_set_size(struct dtv_scat
 		sb->sb_page_ary[i] = old_ary[i];
 	/* allocate any new pages */
 	for (; i < npages; ++i) {
-		sb->sb_page_ary[i] = pool_cache_get(sb->sb_pool, 0);
+		sb->sb_page_ary[i] = pool_cache_get(sb->sb_pool, PR_WAITOK);
 		/* TODO: does pool_cache_get return NULL on
 		 * ENOMEM?  If so, we need to release or note
 		 * the pages with did allocate



CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 21:57:06 UTC 2017

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

Log Message:
don't pass 0 to the pool flags


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/kern/subr_extent.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/subr_extent.c
diff -u src/sys/kern/subr_extent.c:1.85 src/sys/kern/subr_extent.c:1.86
--- src/sys/kern/subr_extent.c:1.85	Mon Sep 18 09:22:56 2017
+++ src/sys/kern/subr_extent.c	Thu Nov  9 16:57:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_extent.c,v 1.85 2017/09/18 13:22:56 jakllsch Exp $	*/
+/*	$NetBSD: subr_extent.c,v 1.86 2017/11/09 21:57:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1998, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_extent.c,v 1.85 2017/09/18 13:22:56 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_extent.c,v 1.86 2017/11/09 21:57:06 christos Exp $");
 
 #ifdef _KERNEL
 #ifdef _KERNEL_OPT
@@ -175,7 +175,7 @@ extent_alloc_region_descriptor(struct ex
 	}
 
  alloc:
-	rp = pool_get(, (flags & EX_WAITOK) ? PR_WAITOK : 0);
+	rp = pool_get(, (flags & EX_WAITOK) ? PR_WAITOK : PR_NOWAIT);
 
 	if (rp != NULL)
 		rp->er_flags = ER_ALLOC;



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

2017-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov  9 21:52:33 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun5i_a13_ccu.c

Log Message:
add NAND module clock


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sun5i_a13_ccu.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/sunxi/sun5i_a13_ccu.c
diff -u src/sys/arch/arm/sunxi/sun5i_a13_ccu.c:1.4 src/sys/arch/arm/sunxi/sun5i_a13_ccu.c:1.5
--- src/sys/arch/arm/sunxi/sun5i_a13_ccu.c:1.4	Mon Nov  6 21:03:58 2017
+++ src/sys/arch/arm/sunxi/sun5i_a13_ccu.c	Thu Nov  9 21:52:32 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun5i_a13_ccu.c,v 1.4 2017/11/06 21:03:58 jmcneill Exp $ */
+/* $NetBSD: sun5i_a13_ccu.c,v 1.5 2017/11/09 21:52:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun5i_a13_ccu.c,v 1.4 2017/11/06 21:03:58 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun5i_a13_ccu.c,v 1.5 2017/11/09 21:52:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun5i_a13_cc
 #define	AHB_GATING_REG1		0x064
 #define	APB0_GATING_REG		0x068
 #define	APB1_GATING_REG		0x06c
+#define	NAND_SCLK_CFG_REG	0x080
 #define	SD0_SCLK_CFG_REG0x088
 #define	SD1_SCLK_CFG_REG0x08c
 #define	SD2_SCLK_CFG_REG0x090
@@ -199,6 +200,14 @@ static struct sunxi_ccu_clk sun5i_a13_cc
 	__BIT(31),			/* enable */
 	SUNXI_CCU_NM_POWER_OF_TWO),
 
+	SUNXI_CCU_NM(A13_CLK_NAND, "nand", mod_parents,
+	NAND_SCLK_CFG_REG,		/* reg */
+	__BITS(17,16),		/* n */
+	__BITS(3,0),		/* m */
+	__BITS(25,24),		/* sel */
+	__BIT(31),			/* enable */
+	SUNXI_CCU_NM_POWER_OF_TWO),
+
 	/* AHB_GATING_REG0. Missing: SS, EMAC, TS, GPS */
 	SUNXI_CCU_GATE(A13_CLK_AHB_OTG, "ahb-otg", "ahb",
 	AHB_GATING_REG0, 0),



CVS commit: src/sys/dev/nand

2017-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov  9 21:50:15 UTC 2017

Modified Files:
src/sys/dev/nand: files.nand nand.c nand.h
Added Files:
src/sys/dev/nand: nand_toshiba.c

Log Message:
Add support for decoding legacy Toshiba TC58NVG2S0H NAND chip params.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/nand/files.nand
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/nand/nand.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/nand/nand.h
cvs rdiff -u -r0 -r1.1 src/sys/dev/nand/nand_toshiba.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/nand/files.nand
diff -u src/sys/dev/nand/files.nand:1.5 src/sys/dev/nand/files.nand:1.6
--- src/sys/dev/nand/files.nand:1.5	Wed Oct 31 18:58:08 2012
+++ src/sys/dev/nand/files.nand	Thu Nov  9 21:50:15 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.nand,v 1.5 2012/10/31 18:58:08 riz Exp $
+# $NetBSD: files.nand,v 1.6 2017/11/09 21:50:15 jmcneill Exp $
 
 define	nandbus	{ }
 
@@ -10,6 +10,7 @@ file	dev/nand/nand_bbt.c	nand
 file	dev/nand/nand_crc.c	nand
 file	dev/nand/nand_micron.c	nand
 file	dev/nand/nand_samsung.c	nand
+file	dev/nand/nand_toshiba.c	nand
 
 defpseudodev	nandemulator: nandbus
 file	dev/nand/nandemulator.c	nandemulator

Index: src/sys/dev/nand/nand.c
diff -u src/sys/dev/nand/nand.c:1.25 src/sys/dev/nand/nand.c:1.26
--- src/sys/dev/nand/nand.c:1.25	Tue Oct  4 14:47:18 2016
+++ src/sys/dev/nand/nand.c	Thu Nov  9 21:50:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nand.c,v 1.25 2016/10/04 14:47:18 kiyohara Exp $	*/
+/*	$NetBSD: nand.c,v 1.26 2017/11/09 21:50:15 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -34,7 +34,7 @@
 /* Common driver for NAND chips implementing the ONFI 2.2 specification */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.25 2016/10/04 14:47:18 kiyohara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.26 2017/11/09 21:50:15 jmcneill Exp $");
 
 #include "locators.h"
 
@@ -88,7 +88,6 @@ struct flash_interface nand_flash_if = {
 	.submit = nand_flash_submit
 };
 
-#ifdef NAND_VERBOSE
 const struct nand_manufacturer nand_mfrs[] = {
 	{ NAND_MFR_AMD,		"AMD" },
 	{ NAND_MFR_FUJITSU,	"Fujitsu" },
@@ -116,7 +115,6 @@ nand_midtoname(int id)
 
 	return nand_mfrs[i].name;
 }
-#endif
 
 /* ARGSUSED */
 int
@@ -335,6 +333,8 @@ nand_fill_chip_structure_legacy(device_t
 		return nand_read_parameters_micron(self, chip);
 	case NAND_MFR_SAMSUNG:
 		return nand_read_parameters_samsung(self, chip);
+	case NAND_MFR_TOSHIBA:
+		return nand_read_parameters_toshiba(self, chip);
 	default:
 		return 1;
 	}
@@ -368,6 +368,12 @@ nand_scan_media(device_t self, struct na
 	nand_read_1(self, _signature[3]);
 	nand_select(self, false);
 
+#ifdef NAND_DEBUG
+	device_printf(self, "signature: %02x %02x %02x %02x\n",
+	onfi_signature[0], onfi_signature[1],
+	onfi_signature[2], onfi_signature[3]);
+#endif
+
 	if (onfi_signature[0] != 'O' || onfi_signature[1] != 'N' ||
 	onfi_signature[2] != 'F' || onfi_signature[3] != 'I') {
 		chip->nc_isonfi = false;
@@ -395,13 +401,11 @@ nand_scan_media(device_t self, struct na
 		}
 	}
 
-#ifdef NAND_VERBOSE
 	aprint_normal_dev(self,
 	"manufacturer id: 0x%.2x (%s), device id: 0x%.2x\n",
 	chip->nc_manf_id,
 	nand_midtoname(chip->nc_manf_id),
 	chip->nc_dev_id);
-#endif
 
 	aprint_normal_dev(self,
 	"page size: %" PRIu32 " bytes, spare size: %" PRIu32 " bytes, "

Index: src/sys/dev/nand/nand.h
diff -u src/sys/dev/nand/nand.h:1.16 src/sys/dev/nand/nand.h:1.17
--- src/sys/dev/nand/nand.h:1.16	Sat Nov  3 12:12:48 2012
+++ src/sys/dev/nand/nand.h	Thu Nov  9 21:50:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nand.h,v 1.16 2012/11/03 12:12:48 ahoka Exp $	*/
+/*	$NetBSD: nand.h,v 1.17 2017/11/09 21:50:15 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -428,6 +428,7 @@ extern const struct nand_manufacturer na
  */
 int nand_read_parameters_micron(device_t, struct nand_chip *);
 int nand_read_parameters_samsung(device_t, struct nand_chip *);
+int nand_read_parameters_toshiba(device_t, struct nand_chip *);
 
 /* debug inlines */
 

Added files:

Index: src/sys/dev/nand/nand_toshiba.c
diff -u /dev/null src/sys/dev/nand/nand_toshiba.c:1.1
--- /dev/null	Thu Nov  9 21:50:15 2017
+++ src/sys/dev/nand/nand_toshiba.c	Thu Nov  9 21:50:15 2017
@@ -0,0 +1,155 @@
+/*	$NetBSD: nand_toshiba.c,v 1.1 2017/11/09 21:50:15 jmcneill Exp $	*/
+
+/*-
+ * Copyright (c) 2012-2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Adam Hoka.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. 

CVS commit: src/sys/dev/nand

2017-11-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov  9 21:45:24 UTC 2017

Modified Files:
src/sys/dev/nand: nand_samsung.c

Log Message:
ul is not 64-bit on all platforms, use ull when calculating planesize


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/nand/nand_samsung.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/nand/nand_samsung.c
diff -u src/sys/dev/nand/nand_samsung.c:1.9 src/sys/dev/nand/nand_samsung.c:1.10
--- src/sys/dev/nand/nand_samsung.c:1.9	Sat Nov  3 12:12:48 2012
+++ src/sys/dev/nand/nand_samsung.c	Thu Nov  9 21:45:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nand_samsung.c,v 1.9 2012/11/03 12:12:48 ahoka Exp $	*/
+/*	$NetBSD: nand_samsung.c,v 1.10 2017/11/09 21:45:24 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nand_samsung.c,v 1.9 2012/11/03 12:12:48 ahoka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nand_samsung.c,v 1.10 2017/11/09 21:45:24 jmcneill Exp $");
 
 #include "nand.h"
 #include "onfi.h"
@@ -181,13 +181,13 @@ nand_read_parameters_samsung(device_t se
 			planesize = 1024 * 1024 * 1024 / 8;
 			break;
 		case 0x5:
-			planesize = 2ul * 1024 * 1024 * 1024 / 8;
+			planesize = 2ull * 1024 * 1024 * 1024 / 8;
 			break;
 		case 0x6:
-			planesize = 4ul * 1024 * 1024 * 1024 / 8;
+			planesize = 4ull * 1024 * 1024 * 1024 / 8;
 			break;
 		case 0x7:
-			planesize = 8ul * 1024 * 1024 * 1024 / 8;
+			planesize = 8ull * 1024 * 1024 * 1024 / 8;
 			break;
 		default:
 			KASSERTMSG(false, "ID Data parsing bug detected!");



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

2017-11-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  9 21:39:48 UTC 2017

Modified Files:
src/sys/arch/evbarm/rpi: vcprop_subr.c

Log Message:
Trailing whitespcae


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/rpi/vcprop_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/arch/evbarm/rpi/vcprop_subr.c
diff -u src/sys/arch/evbarm/rpi/vcprop_subr.c:1.2 src/sys/arch/evbarm/rpi/vcprop_subr.c:1.3
--- src/sys/arch/evbarm/rpi/vcprop_subr.c:1.2	Fri Oct  3 17:57:48 2014
+++ src/sys/arch/evbarm/rpi/vcprop_subr.c	Thu Nov  9 21:39:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vcprop_subr.c,v 1.2 2014/10/03 17:57:48 skrll Exp $	*/
+/*	$NetBSD: vcprop_subr.c,v 1.3 2017/11/09 21:39:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 2014 Michael Lorenz
@@ -28,7 +28,7 @@
 /*
  * Mailbox property interface wrapper functions
  */
- 
+
 #include 
 #include 
 #include 
@@ -347,7 +347,7 @@ rpi_fb_initcursor(bus_addr_t pixels, int
 {
 	int error;
 	uint32_t res;
-	
+
 
 	struct __aligned(16) {
 		struct vcprop_buffer_hdr	vb_hdr;



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

2017-11-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  9 21:38:48 UTC 2017

Modified Files:
src/sys/arch/evbarm/fdt: fdt_machdep.c

Log Message:
trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/fdt/fdt_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.14 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.15
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.14	Sun Sep 10 23:03:06 2017
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Thu Nov  9 21:38:48 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.14 2017/09/10 23:03:06 jmcneill Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.15 2017/11/09 21:38:48 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.14 2017/09/10 23:03:06 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.15 2017/11/09 21:38:48 skrll Exp $");
 
 #include "opt_machdep.h"
 #include "opt_ddb.h"
@@ -234,7 +234,7 @@ fdt_build_bootconfig(uint64_t mem_addr, 
 	struct extent_region *er;
 	uint64_t addr, size;
 	int index, error;
- 
+
 	fdt_memory_ext = extent_create("FDT Memory", mem_addr, max_addr,
 	fdt_memory_ext_storage, sizeof(fdt_memory_ext_storage), EX_EARLY);
 
@@ -428,7 +428,7 @@ initarm(void *arg)
 #ifndef PMAP_NEED_ALLOC_POOLPAGE
 	if (memory_size > KERNEL_VM_BASE - KERNEL_BASE) {
 		DPRINTF("%s: dropping RAM size from %luMB to %uMB\n",
-		__func__, (unsigned long) (memory_size >> 20), 
+		__func__, (unsigned long) (memory_size >> 20),
 		(KERNEL_VM_BASE - KERNEL_BASE) >> 20);
 		memory_size = KERNEL_VM_BASE - KERNEL_BASE;
 	}



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

2017-11-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  9 21:38:25 UTC 2017

Modified Files:
src/sys/arch/arm/cortex: gtmr_var.h

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/cortex/gtmr_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/arch/arm/cortex/gtmr_var.h
diff -u src/sys/arch/arm/cortex/gtmr_var.h:1.7 src/sys/arch/arm/cortex/gtmr_var.h:1.8
--- src/sys/arch/arm/cortex/gtmr_var.h:1.7	Thu Aug 24 13:06:23 2017
+++ src/sys/arch/arm/cortex/gtmr_var.h	Thu Nov  9 21:38:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_var.h,v 1.7 2017/08/24 13:06:23 jmcneill Exp $ */
+/* $NetBSD: gtmr_var.h,v 1.8 2017/11/09 21:38:25 skrll Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -53,7 +53,7 @@ void	gtmr_delay(unsigned int n);
 void	gtmr_bootdelay(unsigned int n);
 #ifdef __HAVE_GENERIC_CPU_INITCLOCKS
 void	gtmr_cpu_initclocks(void);
-#else 
+#else
 #define gtmr_cpu_initclocks	cpu_initclocks
 #endif
 #endif



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

2017-11-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  9 21:37:52 UTC 2017

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c bcm2835_space.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/broadcom/bcm2835_space.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.4 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.5
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.4	Thu Sep 21 19:28:14 2017
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Thu Nov  9 21:37:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.4 2017/09/21 19:28:14 skrll Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.5 2017/11/09 21:37:52 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.4 2017/09/21 19:28:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.5 2017/11/09 21:37:52 skrll Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -107,12 +107,12 @@ bcmgpio_attach(device_t parent, device_t
 	u_int func;
 	int error;
 #endif
-	
+
 	sc->sc_dev = self;
-	
+
 #if NGPIO > 0
 	if (device_unit(sc->sc_dev) > 1) {
-		aprint_naive(" NO GPIO\n");	
+		aprint_naive(" NO GPIO\n");
 		aprint_normal(": NO GPIO\n");
 		return;
 	} else if (device_unit(sc->sc_dev) == 1) {
@@ -122,8 +122,8 @@ bcmgpio_attach(device_t parent, device_t
 		maxpin = 31;
 		minpin = 0;
 	}
-	
-	aprint_naive("\n");	
+
+	aprint_naive("\n");
 	aprint_normal(": GPIO [%d...%d]\n", minpin, maxpin);
 
 	sc->sc_iot = aaa->aaa_iot;
@@ -137,13 +137,13 @@ bcmgpio_attach(device_t parent, device_t
 
 	for (pin = minpin; pin <= maxpin; pin++) {
 	int epin = pin - minpin;
-	
+
 	sc->sc_gpio_pins[epin].pin_num = epin;
 		/*
 		 * find out pins still available for GPIO
 		 */
 		func = bcm2835gpio_function_read(pin);
-		
+
 		if (func == BCM2835_GPIO_IN ||
 		func == BCM2835_GPIO_OUT) {
 	sc->sc_gpio_pins[epin].pin_caps = GPIO_PIN_INPUT |
@@ -160,13 +160,13 @@ bcmgpio_attach(device_t parent, device_t
   			DPRINTF(1, ("%s: skip pin %d - func = 0x%x\n", device_xname(sc->sc_dev), pin, func));
 		}
 	}
-	
+
 	/* create controller tag */
 	sc->sc_gpio_gc.gp_cookie = sc;
 	sc->sc_gpio_gc.gp_pin_read = bcm2835gpio_gpio_pin_read;
 	sc->sc_gpio_gc.gp_pin_write = bcm2835gpio_gpio_pin_write;
 	sc->sc_gpio_gc.gp_pin_ctl = bcm2835gpio_gpio_pin_ctl;
-	
+
 	gba.gba_gc = >sc_gpio_gc;
 	gba.gba_pins = sc->sc_gpio_pins;
 	gba.gba_npins = maxpin - minpin + 1;
@@ -190,7 +190,7 @@ bcm2835gpio_gpio_pin_read(void *arg, int
 	if (device_unit(sc->sc_dev) > 1) {
 		return 0;
 	}
-	
+
 	val = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
 		BCM2835_GPIO_GPLEV(epin / BCM2835_GPIO_GPLEV_PINS_PER_REGISTER));
 
@@ -198,7 +198,7 @@ bcm2835gpio_gpio_pin_read(void *arg, int
 		GPIO_PIN_HIGH : GPIO_PIN_LOW;
 
 	DPRINTF(2, ("%s: gpio_read pin %d->%d\n", device_xname(sc->sc_dev), epin, (res == GPIO_PIN_HIGH)));
-	
+
 	return res;
 }
 
@@ -208,17 +208,17 @@ bcm2835gpio_gpio_pin_write(void *arg, in
 	struct bcmgpio_softc *sc = arg;
 	int epin = pin + device_unit(sc->sc_dev) * 32;
 	bus_size_t reg;
-	
+
 	if (device_unit(sc->sc_dev) > 1) {
 		return;
 	}
-	
+
 	if (value == GPIO_PIN_HIGH) {
 		reg = BCM2835_GPIO_GPSET(epin / BCM2835_GPIO_GPSET_PINS_PER_REGISTER);
 	} else {
 		reg = BCM2835_GPIO_GPCLR(epin / BCM2835_GPIO_GPCLR_PINS_PER_REGISTER);
 	}
-	
+
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,
 		reg, 1 << (epin % BCM2835_GPIO_GPSET_PINS_PER_REGISTER));
 	DPRINTF(2, ("%s: gpio_write pin %d<-%d\n", device_xname(sc->sc_dev), epin, (value == GPIO_PIN_HIGH)));
@@ -230,11 +230,11 @@ bcm2835gpio_gpio_pin_ctl(void *arg, int 
 	struct bcmgpio_softc *sc = arg;
 	uint32_t cmd;
 	int epin = pin + device_unit(sc->sc_dev) * 32;
-	
+
 	if (device_unit(sc->sc_dev) > 1) {
 		return;
 	}
-	
+
 	DPRINTF(2, ("%s: gpio_ctl pin %d flags 0x%x\n", device_xname(sc->sc_dev), epin, flags));
 
 	if (flags & (GPIO_PIN_OUTPUT|GPIO_PIN_INPUT)) {
@@ -264,7 +264,7 @@ bcm2835gpio_gpio_pin_ctl(void *arg, int 
 	delay(1); /* wait 150 cycles */
 	/* reset control signal and clock */
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,
-		BCM2835_GPIO_GPPUD, BCM2835_GPIO_GPPUD_PULLOFF);	
+		BCM2835_GPIO_GPPUD, BCM2835_GPIO_GPPUD_PULLOFF);
 	bus_space_write_4(sc->sc_iot, sc->sc_ioh,
 		BCM2835_GPIO_GPPUDCLK(device_unit(sc->sc_dev)),
 		0);

Index: src/sys/arch/arm/broadcom/bcm2835_space.c
diff -u src/sys/arch/arm/broadcom/bcm2835_space.c:1.10 src/sys/arch/arm/broadcom/bcm2835_space.c:1.11
--- src/sys/arch/arm/broadcom/bcm2835_space.c:1.10	Tue Feb  2 13:55:50 2016
+++ src/sys/arch/arm/broadcom/bcm2835_space.c	Thu Nov  9 21:37:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_space.c,v 1.10 2016/02/02 13:55:50 skrll 

CVS commit: src/distrib/utils/embedded/conf

2017-11-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov  9 21:36:46 UTC 2017

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf rpi.conf

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.30 -r1.31 src/distrib/utils/embedded/conf/rpi.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.18 src/distrib/utils/embedded/conf/armv7.conf:1.19
--- src/distrib/utils/embedded/conf/armv7.conf:1.18	Sun Oct  8 00:15:13 2017
+++ src/distrib/utils/embedded/conf/armv7.conf	Thu Nov  9 21:36:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.18 2017/10/08 00:15:13 jmcneill Exp $
+# $NetBSD: armv7.conf,v 1.19 2017/11/09 21:36:46 skrll Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -62,7 +62,7 @@ EOF
 
 		cat > ${mnt}/boot/config.txt << EOF
 # UART settings, see https://www.raspberrypi.org/documentation/configuration/uart.md
-enable_uart=1
+enable_uart=1
 force_turbo=0
 EOF
 

Index: src/distrib/utils/embedded/conf/rpi.conf
diff -u src/distrib/utils/embedded/conf/rpi.conf:1.30 src/distrib/utils/embedded/conf/rpi.conf:1.31
--- src/distrib/utils/embedded/conf/rpi.conf:1.30	Mon Jul 31 16:34:22 2017
+++ src/distrib/utils/embedded/conf/rpi.conf	Thu Nov  9 21:36:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: rpi.conf,v 1.30 2017/07/31 16:34:22 jmcneill Exp $
+# $NetBSD: rpi.conf,v 1.31 2017/11/09 21:36:46 skrll Exp $
 # Raspberry Pi customization script used by mkimage
 #
 
@@ -49,7 +49,7 @@ populate() {
 
 	cat > ${mnt}/boot/cmdline.txt << EOF
 root=ld0a console=fb
-#fb=1280x1024		# to select a mode, otherwise try EDID 
+#fb=1280x1024		# to select a mode, otherwise try EDID
 #fb=disable		# to disable fb completely
 EOF
 



CVS commit: src

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 20:30:02 UTC 2017

Modified Files:
src/lib/libc/stdio: fdopen.c flags.c fopen.c freopen.c
src/lib/libc/sys: open.2
src/sys/kern: vfs_vnops.c
src/sys/sys: fcntl.h

Log Message:
Add O_REGULAR to enforce opening of only regular files
(like we have O_DIRECTORY for directories).
This is better than open(, O_NONBLOCK), fstat()+S_ISREG() because opening
devices can have side effects.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/stdio/fdopen.c
cvs rdiff -u -r1.18 -r1.19 src/lib/libc/stdio/flags.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libc/stdio/fopen.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/stdio/freopen.c
cvs rdiff -u -r1.57 -r1.58 src/lib/libc/sys/open.2
cvs rdiff -u -r1.195 -r1.196 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.48 -r1.49 src/sys/sys/fcntl.h

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/stdio/fdopen.c
diff -u src/lib/libc/stdio/fdopen.c:1.17 src/lib/libc/stdio/fdopen.c:1.18
--- src/lib/libc/stdio/fdopen.c:1.17	Tue Jan 10 12:00:58 2017
+++ src/lib/libc/stdio/fdopen.c	Thu Nov  9 15:30:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdopen.c,v 1.17 2017/01/10 17:00:58 christos Exp $	*/
+/*	$NetBSD: fdopen.c,v 1.18 2017/11/09 20:30:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fdopen.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fdopen.c,v 1.17 2017/01/10 17:00:58 christos Exp $");
+__RCSID("$NetBSD: fdopen.c,v 1.18 2017/11/09 20:30:02 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -92,7 +92,7 @@ fdopen(int fd, const char *mode)
 		return NULL;
 	}
 
-	if (oflags & O_NONBLOCK) {
+	if (oflags & O_REGULAR) {
 		struct stat st;
 		if (fstat(fd, ) == -1) {
 			return NULL;

Index: src/lib/libc/stdio/flags.c
diff -u src/lib/libc/stdio/flags.c:1.18 src/lib/libc/stdio/flags.c:1.19
--- src/lib/libc/stdio/flags.c:1.18	Fri Nov  3 22:49:55 2017
+++ src/lib/libc/stdio/flags.c	Thu Nov  9 15:30:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: flags.c,v 1.18 2017/11/04 02:49:55 christos Exp $	*/
+/*	$NetBSD: flags.c,v 1.19 2017/11/09 20:30:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)flags.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: flags.c,v 1.18 2017/11/04 02:49:55 christos Exp $");
+__RCSID("$NetBSD: flags.c,v 1.19 2017/11/09 20:30:02 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -105,7 +105,7 @@ __sflags(const char *mode, int *optr)
 			o |= O_CLOEXEC;
 			break;
 		case 'f':
-			o |= O_NONBLOCK;
+			o |= O_REGULAR;
 			break;
 		case 'l':
 			o |= O_NOFOLLOW;

Index: src/lib/libc/stdio/fopen.c
diff -u src/lib/libc/stdio/fopen.c:1.16 src/lib/libc/stdio/fopen.c:1.17
--- src/lib/libc/stdio/fopen.c:1.16	Sat Nov  4 03:26:35 2017
+++ src/lib/libc/stdio/fopen.c	Thu Nov  9 15:30:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: fopen.c,v 1.16 2017/11/04 07:26:35 kre Exp $	*/
+/*	$NetBSD: fopen.c,v 1.17 2017/11/09 20:30:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fopen.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: fopen.c,v 1.16 2017/11/04 07:26:35 kre Exp $");
+__RCSID("$NetBSD: fopen.c,v 1.17 2017/11/09 20:30:02 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,20 +66,6 @@ fopen(const char *file, const char *mode
 		return NULL;
 	if ((f = open(file, oflags, DEFFILEMODE)) < 0)
 		goto release;
-	if (oflags & O_NONBLOCK) {
-		struct stat st;
-		if (fstat(f, ) == -1) {
-			int sverrno = errno;
-			(void)close(f);
-			errno = sverrno;
-			goto release;
-		}
-		if (!S_ISREG(st.st_mode)) {
-			(void)close(f);
-			errno = EFTYPE;
-			goto release;
-		}
-	}
 	/*
 	 * File descriptors are a full int, but _file is only a short.
 	 * If we get a valid file descriptor that is greater or equal to

Index: src/lib/libc/stdio/freopen.c
diff -u src/lib/libc/stdio/freopen.c:1.19 src/lib/libc/stdio/freopen.c:1.20
--- src/lib/libc/stdio/freopen.c:1.19	Tue Mar 27 11:05:42 2012
+++ src/lib/libc/stdio/freopen.c	Thu Nov  9 15:30:02 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: freopen.c,v 1.19 2012/03/27 15:05:42 christos Exp $	*/
+/*	$NetBSD: freopen.c,v 1.20 2017/11/09 20:30:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)freopen.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: freopen.c,v 1.19 2012/03/27 15:05:42 christos Exp $");
+__RCSID("$NetBSD: freopen.c,v 1.20 2017/11/09 20:30:02 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -141,21 +141,6 @@ freopen(const char *file, const char *mo
 		return NULL;
 	}
 
-	if (oflags & O_NONBLOCK) {
-		struct stat st;
-		if (fstat(f, ) == -1) {
-			sverrno = errno;
-			(void)close(f);
-			errno = sverrno;
-			return NULL;
-		}
-		if 

CVS commit: src/usr.bin/mail

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 20:27:50 UTC 2017

Modified Files:
src/usr.bin/mail: cmd2.c cmd3.c collect.c edit.c fio.c lex.c list.c
mime_attach.c mime_child.c mime_detach.c names.c quit.c send.c
support.c

Log Message:
Only open regular files.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/mail/cmd2.c
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/mail/cmd3.c src/usr.bin/mail/lex.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/mail/collect.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/mail/edit.c src/usr.bin/mail/quit.c
cvs rdiff -u -r1.42 -r1.43 src/usr.bin/mail/fio.c
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/mail/list.c
cvs rdiff -u -r1.18 -r1.19 src/usr.bin/mail/mime_attach.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/mail/mime_child.c \
src/usr.bin/mail/mime_detach.c
cvs rdiff -u -r1.32 -r1.33 src/usr.bin/mail/names.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/mail/send.c
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/mail/support.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/mail/cmd2.c
diff -u src/usr.bin/mail/cmd2.c:1.25 src/usr.bin/mail/cmd2.c:1.26
--- src/usr.bin/mail/cmd2.c:1.25	Sun Apr 29 19:50:22 2012
+++ src/usr.bin/mail/cmd2.c	Thu Nov  9 15:27:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $	*/
+/*	$NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cmd2.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: cmd2.c,v 1.25 2012/04/29 23:50:22 christos Exp $");
+__RCSID("$NetBSD: cmd2.c,v 1.26 2017/11/09 20:27:50 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -230,7 +230,7 @@ save1(char str[], int markmsg, const cha
 		disp = "[Appended]";
 	else
 		disp = "[New file]";
-	if ((obuf = Fopen(fn, "ae")) == NULL) {
+	if ((obuf = Fopen(fn, "aef")) == NULL) {
 		warn(NULL);
 		return 1;
 	}

Index: src/usr.bin/mail/cmd3.c
diff -u src/usr.bin/mail/cmd3.c:1.43 src/usr.bin/mail/cmd3.c:1.44
--- src/usr.bin/mail/cmd3.c:1.43	Tue Dec 16 14:30:24 2014
+++ src/usr.bin/mail/cmd3.c	Thu Nov  9 15:27:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $	*/
+/*	$NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)cmd3.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: cmd3.c,v 1.43 2014/12/16 19:30:24 christos Exp $");
+__RCSID("$NetBSD: cmd3.c,v 1.44 2017/11/09 20:27:50 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -501,7 +501,7 @@ bounce_one(int msgno, const char **smarg
 	(void)snprintf(mailtempname, sizeof(mailtempname),
 	"%s/mail.RsXX", tmpdir);
 	if ((fd = mkstemp(mailtempname)) == -1 ||
-	(obuf = Fdopen(fd, "we+")) == NULL) {
+	(obuf = Fdopen(fd, "wef+")) == NULL) {
 		if (fd != -1)
 			(void)close(fd);
 		warn("%s", mailtempname);
Index: src/usr.bin/mail/lex.c
diff -u src/usr.bin/mail/lex.c:1.43 src/usr.bin/mail/lex.c:1.44
--- src/usr.bin/mail/lex.c:1.43	Wed Feb 20 09:38:13 2013
+++ src/usr.bin/mail/lex.c	Thu Nov  9 15:27:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $	*/
+/*	$NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)lex.c	8.2 (Berkeley) 4/20/95";
 #else
-__RCSID("$NetBSD: lex.c,v 1.43 2013/02/20 14:38:13 christos Exp $");
+__RCSID("$NetBSD: lex.c,v 1.44 2017/11/09 20:27:50 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -214,7 +214,7 @@ setfile(const char *name)
 	if ((name = expand(name)) == NULL)
 		return -1;
 
-	if ((ibuf = Fopen(name, "re")) == NULL) {
+	if ((ibuf = Fopen(name, "ref")) == NULL) {
 		if (!isedit && errno == ENOENT)
 			goto nomail;
 		warn("Can't open `%s'", name);
@@ -278,9 +278,9 @@ setfile(const char *name)
 	(void)snprintf(tempname, sizeof(tempname),
 	"%s/mail.RxXX", tmpdir);
 	if ((fd = mkstemp(tempname)) == -1 ||
-	(otf = fdopen(fd, "we")) == NULL)
+	(otf = fdopen(fd, "wef")) == NULL)
 		err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname);
-	if ((itf = fopen(tempname, "re")) == NULL)
+	if ((itf = fopen(tempname, "ref")) == NULL)
 		err(EXIT_FAILURE, "Can't create tmp file `%s'", tempname);
 	(void)rm(tempname);
 	setptr(ibuf, (off_t)0);
@@ -317,7 +317,7 @@ incfile(void)
 
 	omsgCount = get_abs_msgCount();
 
-	ibuf = Fopen(mailname, "re");
+	ibuf = Fopen(mailname, "ref");
 	if (ibuf == NULL)
 		return -1;
 	sig_check();
@@ -1121,7 +1121,7 @@ load(const char *name)
 {
 	FILE *in, *oldin;
 
-	if ((in = Fopen(name, "re")) == NULL)
+	if ((in = Fopen(name, "ref")) == NULL)
 		return;
 	oldin = input;
 	input = in;

Index: src/usr.bin/mail/collect.c
diff -u src/usr.bin/mail/collect.c:1.48 src/usr.bin/mail/collect.c:1.49
--- 

CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 19:34:17 UTC 2017

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

Log Message:
Handle the ERESTART case from pool_grow()


To generate a diff of this commit:
cvs rdiff -u -r1.213 -r1.214 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.213 src/sys/kern/subr_pool.c:1.214
--- src/sys/kern/subr_pool.c:1.213	Thu Nov  9 10:53:40 2017
+++ src/sys/kern/subr_pool.c	Thu Nov  9 14:34:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.214 2017/11/09 19:34:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.214 2017/11/09 19:34:17 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1128,6 +1128,8 @@ pool_prime(struct pool *pp, int n)
 	while (newpages-- > 0) {
 		error = pool_grow(pp, PR_NOWAIT);
 		if (error) {
+			if (error == ERESTART)
+continue;
 			break;
 		}
 		pp->pr_minpages++;
@@ -1240,6 +1242,8 @@ pool_catchup(struct pool *pp)
 	while (POOL_NEEDS_CATCHUP(pp)) {
 		error = pool_grow(pp, PR_NOWAIT);
 		if (error) {
+			if (error == ERESTART)
+continue;
 			break;
 		}
 	}



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov  9 15:56:56 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: elf.c prekern.h

Log Message:
Define utility functions as inlines in prekern.h.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/stand/prekern/elf.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/prekern.h

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.8 src/sys/arch/amd64/stand/prekern/elf.c:1.9
--- src/sys/arch/amd64/stand/prekern/elf.c:1.8	Thu Nov  9 15:24:39 2017
+++ src/sys/arch/amd64/stand/prekern/elf.c	Thu Nov  9 15:56:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.c,v 1.8 2017/11/09 15:24:39 maxv Exp $	*/
+/*	$NetBSD: elf.c,v 1.9 2017/11/09 15:56:56 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -49,29 +49,6 @@ extern paddr_t kernpa_start, kernpa_end;
 static struct elfinfo eif;
 static const char entrypoint[] = "start_prekern";
 
-/* XXX */
-static int
-memcmp(const char *a, const char *b, size_t c)
-{
-	size_t i;
-	for (i = 0; i < c; i++) {
-		if (a[i] != b[i])
-			return 1;
-	}
-	return 0;
-}
-static int
-strcmp(char *a, char *b)
-{
-	size_t i;
-	for (i = 0; a[i] != '\0'; i++) {
-		if (a[i] != b[i])
-			return 1;
-	}
-	return 0;
-}
-
-
 static int
 elf_check_header()
 {

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.5 src/sys/arch/amd64/stand/prekern/prekern.h:1.6
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.5	Thu Nov  9 15:24:39 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Thu Nov  9 15:56:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.5 2017/11/09 15:24:39 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.6 2017/11/09 15:56:56 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -69,6 +69,28 @@ memset(void *dst, char c, size_t sz)
 	}
 }
 
+static inline int
+memcmp(const char *a, const char *b, size_t c)
+{
+	size_t i;
+	for (i = 0; i < c; i++) {
+		if (a[i] != b[i])
+			return 1;
+	}
+	return 0;
+}
+
+static inline int
+strcmp(char *a, char *b)
+{
+	size_t i;
+	for (i = 0; a[i] != '\0'; i++) {
+		if (a[i] != b[i])
+			return 1;
+	}
+	return 0;
+}
+
 /* -- */
 
 struct bootspace {



CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 15:53:40 UTC 2017

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

Log Message:
make the KASSERTMSG/panic strings consistent as '%s: [%s], __func__, wchan'


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.212 src/sys/kern/subr_pool.c:1.213
--- src/sys/kern/subr_pool.c:1.212	Thu Nov  9 10:40:23 2017
+++ src/sys/kern/subr_pool.c	Thu Nov  9 10:53:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.213 2017/11/09 15:53:40 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -487,7 +487,7 @@ pool_init(struct pool *pp, size_t size, 
 	 */
 	TAILQ_FOREACH(pp1, _head, pr_poollist) {
 		if (pp == pp1)
-			panic("pool_init: pool %s already initialised",
+			panic("%s: [%s] already initialised", __func__,
 			wchan);
 	}
 	if (__predict_true(!cold))
@@ -528,8 +528,8 @@ pool_init(struct pool *pp, size_t size, 
 
 	prsize = roundup(prsize, align);
 	KASSERTMSG((prsize <= palloc->pa_pagesz),
-	"pool_init: pool item size (%zu) larger than page size (%u)",
-	prsize, palloc->pa_pagesz);
+	"%s: [%s] pool item size (%zu) larger than page size (%u)",
+	__func__, wchan, prsize, palloc->pa_pagesz);
 
 	/*
 	 * Initialize the pool structure.
@@ -612,7 +612,8 @@ pool_init(struct pool *pp, size_t size, 
 			 * if you see this panic, consider to tweak
 			 * PHPOOL_MAX and PHPOOL_FREELIST_NELEM.
 			 */
-			panic("%s: too large itemsperpage(%d) for PR_NOTOUCH",
+			panic("%s: [%s] too large itemsperpage(%d) for "
+			"PR_NOTOUCH", __func__,
 			pp->pr_wchan, pp->pr_itemsperpage);
 		}
 		pp->pr_phpool = [idx];
@@ -700,7 +701,7 @@ pool_destroy(struct pool *pp)
 
 	KASSERT(pp->pr_cache == NULL);
 	KASSERTMSG((pp->pr_nout == 0),
-	"pool_destroy: pool busy: still out: %u", pp->pr_nout);
+	"%s: pool busy: still out: %u", __func__, pp->pr_nout);
 	KASSERT(LIST_EMPTY(>pr_fullpages));
 	KASSERT(LIST_EMPTY(>pr_partpages));
 
@@ -722,7 +723,7 @@ pool_set_drain_hook(struct pool *pp, voi
 
 	/* XXX no locking -- must be used just after pool_init() */
 	KASSERTMSG((pp->pr_drain_hook == NULL),
-	"pool_set_drain_hook(%s): already set", pp->pr_wchan);
+	"%s: [%s] already set", __func__, pp->pr_wchan);
 	pp->pr_drain_hook = fn;
 	pp->pr_drain_hook_arg = arg;
 }
@@ -733,7 +734,7 @@ pool_alloc_item_header(struct pool *pp, 
 	struct pool_item_header *ph;
 
 	if ((pp->pr_roflags & PR_PHINPAGE) != 0)
-		ph = (struct pool_item_header *) ((char *)storage + pp->pr_phoffset);
+		ph = (void *)((char *)storage + pp->pr_phoffset);
 	else
 		ph = pool_get(pp->pr_phpool, flags);
 
@@ -751,12 +752,12 @@ pool_get(struct pool *pp, int flags)
 	void *v;
 
 	KASSERTMSG((pp->pr_itemsperpage != 0),
-	"pool_get: pool '%s': pr_itemsperpage is zero, "
-	"pool not initialized?", pp->pr_wchan);
+	"%s: [%s] pr_itemsperpage is zero, "
+	"pool not initialized?", __func__, pp->pr_wchan);
 	KASSERTMSG((!(cpu_intr_p() || cpu_softintr_p())
 		|| pp->pr_ipl != IPL_NONE || cold || panicstr != NULL),
-	"pool '%s' is IPL_NONE, but called from interrupt context",
-	pp->pr_wchan);
+	"%s: [%s] is IPL_NONE, but called from interrupt context",
+	__func__, pp->pr_wchan);
 	if (flags & PR_WAITOK) {
 		ASSERT_SLEEPABLE();
 	}
@@ -769,7 +770,7 @@ pool_get(struct pool *pp, int flags)
 	 * the pool.
 	 */
 	KASSERTMSG((pp->pr_nout <= pp->pr_hardlimit),
-	"pool_get: %s: crossed hard limit", pp->pr_wchan);
+	"%s: %s: crossed hard limit", __func__, pp->pr_wchan);
 	if (__predict_false(pp->pr_nout == pp->pr_hardlimit)) {
 		if (pp->pr_drain_hook != NULL) {
 			/*
@@ -821,9 +822,8 @@ pool_get(struct pool *pp, int flags)
 		int error;
 
 		KASSERTMSG((pp->pr_nitems == 0),
-		"pool_get: nitems inconsistent"
-		": %s: curpage NULL, nitems %u",
-		pp->pr_wchan, pp->pr_nitems);
+		"%s: [%s] curpage NULL, inconsistent nitems %u",
+		__func__, pp->pr_wchan, pp->pr_nitems);
 
 		/*
 		 * Call the back-end page allocator for more memory.
@@ -860,21 +860,20 @@ pool_get(struct pool *pp, int flags)
 	}
 	if (pp->pr_roflags & PR_NOTOUCH) {
 		KASSERTMSG((ph->ph_nmissing < pp->pr_itemsperpage),
-		"pool_get: %s: page empty", pp->pr_wchan);
+		"%s: %s: page empty", __func__, pp->pr_wchan);
 		v = pr_item_notouch_get(pp, ph);
 	} else {
 		v = pi = LIST_FIRST(>ph_itemlist);
 		if (__predict_false(v == NULL)) {
 			

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

2017-11-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov  9 15:46:48 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: Makefile.amd64
Added Files:
src/sys/arch/amd64/conf: kern.ldscript.kaslr

Log Message:
Use another ld script for kaslr kernels, in which there are no alignment
directives. They don't matter since the bootloader overwrites them.

But, normally we still need to make sure .data.read_mostly is aligned.
Unfortunately I couldn't find any way to force sh_addralign to be 64, so
I'm leaving the alignment there as a useless reminder.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amd64/conf/Makefile.amd64
cvs rdiff -u -r0 -r1.1 src/sys/arch/amd64/conf/kern.ldscript.kaslr

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

Modified files:

Index: src/sys/arch/amd64/conf/Makefile.amd64
diff -u src/sys/arch/amd64/conf/Makefile.amd64:1.60 src/sys/arch/amd64/conf/Makefile.amd64:1.61
--- src/sys/arch/amd64/conf/Makefile.amd64:1.60	Wed Nov  1 09:31:24 2017
+++ src/sys/arch/amd64/conf/Makefile.amd64	Thu Nov  9 15:46:48 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.amd64,v 1.60 2017/11/01 09:31:24 maxv Exp $
+#	$NetBSD: Makefile.amd64,v 1.61 2017/11/09 15:46:48 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -63,11 +63,12 @@ KERN_AS=	library
 TEXTADDR?=	0x8020
 .if defined(KASLR)
 EXTRA_LINKFLAGS=	-z max-page-size=0x20 -r -d
+KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript.kaslr
 .else
 EXTRA_LINKFLAGS=	-z max-page-size=0x20
+KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript
 .endif
 LINKFLAGS_NORMAL=	-X
-KERNLDSCRIPT?= ${AMD64}/conf/kern.ldscript
 
 ##
 ## (6) port specific target dependencies

Added files:

Index: src/sys/arch/amd64/conf/kern.ldscript.kaslr
diff -u /dev/null src/sys/arch/amd64/conf/kern.ldscript.kaslr:1.1
--- /dev/null	Thu Nov  9 15:46:48 2017
+++ src/sys/arch/amd64/conf/kern.ldscript.kaslr	Thu Nov  9 15:46:48 2017
@@ -0,0 +1,62 @@
+/*	$NetBSD: kern.ldscript.kaslr,v 1.1 2017/11/09 15:46:48 maxv Exp $	*/
+
+#include "assym.h"
+
+ENTRY(_start)
+SECTIONS
+{
+	.text :
+	{
+		*(.text)
+		*(.text.*)
+		*(.stub)
+	} =0xCC
+	_etext = . ;
+	PROVIDE (etext = .) ;
+
+	__rodata_start = . ;
+	.rodata :
+	{
+		*(.rodata)
+		*(.rodata.*)
+	}
+
+	__data_start = . ;
+	.data :
+	{
+		*(.data)
+	}
+
+	. = ALIGN(COHERENCY_UNIT);
+	.data.cacheline_aligned :
+	{
+		*(.data.cacheline_aligned)
+	}
+	. = ALIGN(COHERENCY_UNIT);
+	.data.read_mostly :
+	{
+		*(.data.read_mostly)
+	}
+	. = ALIGN(COHERENCY_UNIT);
+
+	_edata = . ;
+	PROVIDE (edata = .) ;
+	__bss_start = . ;
+	.bss :
+	{
+		*(.bss)
+		*(.bss.*)
+		*(COMMON)
+	}
+
+	/* End of the kernel image */
+	__kernel_end = . ;
+
+	_end = . ;
+	PROVIDE (end = .) ;
+	.note.netbsd.ident :
+	{
+		KEEP(*(.note.netbsd.ident));
+	}
+}
+



CVS commit: src/sys/kern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 15:40:23 UTC 2017

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

Log Message:
Since pr_lock is now used to wait for two things now (PR_GROWING and
PR_WANTED) we need to loop for the condition we wanted.


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/subr_pool.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/subr_pool.c
diff -u src/sys/kern/subr_pool.c:1.211 src/sys/kern/subr_pool.c:1.212
--- src/sys/kern/subr_pool.c:1.211	Mon Nov  6 13:41:22 2017
+++ src/sys/kern/subr_pool.c	Thu Nov  9 10:40:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_pool.c,v 1.211 2017/11/06 18:41:22 riastradh Exp $	*/
+/*	$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008, 2010, 2014, 2015
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.211 2017/11/06 18:41:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_pool.c,v 1.212 2017/11/09 15:40:23 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -790,7 +790,9 @@ pool_get(struct pool *pp, int flags)
 			 * it be?
 			 */
 			pp->pr_flags |= PR_WANTED;
-			cv_wait(>pr_cv, >pr_lock);
+			do {
+cv_wait(>pr_cv, >pr_lock);
+			} while (pp->pr_flags & PR_WANTED);
 			goto startover;
 		}
 



CVS commit: src/sys/arch/amd64/stand/prekern

2017-11-09 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Nov  9 15:24:39 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: elf.c mm.c prekern.h

Log Message:
Fill in the page padding. Only .text is pre-filled by the ld script, but
this will change in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amd64/stand/prekern/elf.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/prekern.h

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.7 src/sys/arch/amd64/stand/prekern/elf.c:1.8
--- src/sys/arch/amd64/stand/prekern/elf.c:1.7	Sun Nov  5 16:26:15 2017
+++ src/sys/arch/amd64/stand/prekern/elf.c	Thu Nov  9 15:24:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.c,v 1.7 2017/11/05 16:26:15 maxv Exp $	*/
+/*	$NetBSD: elf.c,v 1.8 2017/11/09 15:24:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -345,7 +345,7 @@ elf_get_text(paddr_t *pa, size_t *sz)
 	ASSERT(minpa % PAGE_SIZE == 0);
 
 	*pa = minpa;
-	*sz = roundup(maxpa - minpa, PAGE_SIZE);
+	*sz = maxpa - minpa;
 }
 
 void
@@ -392,7 +392,7 @@ elf_get_rodata(paddr_t *pa, size_t *sz)
 	ASSERT(minpa % PAGE_SIZE == 0);
 
 	*pa = minpa;
-	*sz = roundup(maxpa - minpa, PAGE_SIZE);
+	*sz = maxpa - minpa;
 }
 
 void
@@ -439,7 +439,7 @@ elf_get_data(paddr_t *pa, size_t *sz)
 	ASSERT(minpa % PAGE_SIZE == 0);
 
 	*pa = minpa;
-	*sz = roundup(maxpa - minpa, PAGE_SIZE);
+	*sz = maxpa - minpa;
 }
 
 void

Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.8 src/sys/arch/amd64/stand/prekern/mm.c:1.9
--- src/sys/arch/amd64/stand/prekern/mm.c:1.8	Sun Nov  5 16:26:15 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Thu Nov  9 15:24:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.8 2017/11/05 16:26:15 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.9 2017/11/09 15:24:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -30,6 +30,10 @@
 
 #include "prekern.h"
 
+#define PAD_TEXT	0xCC
+#define PAD_RODATA	0x00
+#define PAD_DATA	0x00
+
 static const pt_entry_t protection_codes[3] = {
 	[MM_PROT_READ] = PG_RO | PG_NX,
 	[MM_PROT_WRITE] = PG_RW | PG_NX,
@@ -275,14 +279,15 @@ mm_randva_kregion(size_t size)
 static void
 mm_map_segments()
 {
-	size_t i, npages, size;
+	size_t i, npages, size, elfsz;
 	vaddr_t randva;
 	paddr_t pa;
 
 	/*
 	 * Kernel text segment.
 	 */
-	elf_get_text(, );
+	elf_get_text(, );
+	size = roundup(elfsz, PAGE_SIZE);
 	randva = mm_randva_kregion(size);
 	npages = size / PAGE_SIZE;
 
@@ -293,6 +298,9 @@ mm_map_segments()
 	}
 	elf_build_text(randva, pa);
 
+	/* Fill in the padding */
+	memset((void *)(randva + elfsz), PAD_TEXT, size - elfsz);
+
 	/* Register the values in bootspace */
 	bootspace.text.va = randva;
 	bootspace.text.pa = pa;
@@ -301,7 +309,8 @@ mm_map_segments()
 	/*
 	 * Kernel rodata segment.
 	 */
-	elf_get_rodata(, );
+	elf_get_rodata(, );
+	size = roundup(elfsz, PAGE_SIZE);
 	randva = mm_randva_kregion(size);
 	npages = size / PAGE_SIZE;
 
@@ -312,6 +321,9 @@ mm_map_segments()
 	}
 	elf_build_rodata(randva, pa);
 
+	/* Fill in the padding */
+	memset((void *)(randva + elfsz), PAD_RODATA, size - elfsz);
+
 	/* Register the values in bootspace */
 	bootspace.rodata.va = randva;
 	bootspace.rodata.pa = pa;
@@ -320,7 +332,8 @@ mm_map_segments()
 	/*
 	 * Kernel data segment.
 	 */
-	elf_get_data(, );
+	elf_get_data(, );
+	size = roundup(elfsz, PAGE_SIZE);
 	randva = mm_randva_kregion(size);
 	npages = size / PAGE_SIZE;
 
@@ -331,6 +344,9 @@ mm_map_segments()
 	}
 	elf_build_data(randva, pa);
 
+	/* Fill in the padding */
+	memset((void *)(randva + elfsz), PAD_DATA, size - elfsz);
+
 	/* Register the values in bootspace */
 	bootspace.data.va = randva;
 	bootspace.data.pa = pa;

Index: src/sys/arch/amd64/stand/prekern/prekern.h
diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.4 src/sys/arch/amd64/stand/prekern/prekern.h:1.5
--- src/sys/arch/amd64/stand/prekern/prekern.h:1.4	Sun Nov  5 16:26:15 2017
+++ src/sys/arch/amd64/stand/prekern/prekern.h	Thu Nov  9 15:24:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: prekern.h,v 1.4 2017/11/05 16:26:15 maxv Exp $	*/
+/*	$NetBSD: prekern.h,v 1.5 2017/11/09 15:24:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -41,7 +41,6 @@
 #define MM_PROT_EXECUTE	0x02
 
 #define ASSERT(a) if (!(a)) fatal("ASSERT");
-#define memset(d, v, l) __builtin_memset(d, v, l)
 #define memcpy(d, v, l) __builtin_memcpy(d, v, l)
 typedef uint64_t paddr_t;
 typedef uint64_t vaddr_t;
@@ -60,6 +59,18 @@ typedef uint64_t pte_prot_t;
 
 /* -- */
 
+static inline void
+memset(void *dst, char c, size_t sz)
+{
+	char *bdst = 

CVS commit: src/external/bsd/nvi/usr.bin/recover

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 15:03:01 UTC 2017

Modified Files:
src/external/bsd/nvi/usr.bin/recover: virecover

Log Message:
Don't get stuck reading named pipes; only try to read plain files in
order to send mail.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/nvi/usr.bin/recover/virecover

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/nvi/usr.bin/recover/virecover
diff -u src/external/bsd/nvi/usr.bin/recover/virecover:1.3 src/external/bsd/nvi/usr.bin/recover/virecover:1.4
--- src/external/bsd/nvi/usr.bin/recover/virecover:1.3	Sat Nov  4 03:04:01 2017
+++ src/external/bsd/nvi/usr.bin/recover/virecover	Thu Nov  9 10:03:01 2017
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#	$NetBSD: virecover,v 1.3 2017/11/04 07:04:01 kre Exp $
+#	$NetBSD: virecover,v 1.4 2017/11/09 15:03:01 christos Exp $
 #
 #	@(#)recover.in	8.8 (Berkeley) 10/10/96
 #
@@ -17,13 +17,13 @@ for i in $RECDIR/vi.*; do
 	esac
 
 	# Only test files that are readable.
-	if ! [ -f "$i" ] || ! [ -r "$i" ]; then
+	if [ ! -f "$i" ] || [ ! -r "$i" ]; then
 		continue
 	fi
 
 	# Unmodified nvi editor backup files either have the
 	# execute bit set or are zero length.  Delete them.
-	if [ -x "$i" ] || ! [ -s "$i" ]; then
+	if [ -x "$i" ] || [ ! -s "$i" ]; then
 		rm -f "$i"
 	fi
 done
@@ -36,8 +36,8 @@ for i in $RECDIR/recover.*; do
 	$RECDIR/recover.\*) continue;;
 	esac
 
-	# Only test files that are readable.
-	if ! [ -r "$i" ]; then
+	# Only test plain files that are readable.
+	if [ ! -f "$i" ] || [ ! -r "$i" ]; then
 		continue
 	fi
 



CVS commit: src/sys/rump/librump/rumpkern

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 12:46:55 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: emul.c

Log Message:
added booted_method


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/rump/librump/rumpkern/emul.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/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.182 src/sys/rump/librump/rumpkern/emul.c:1.183
--- src/sys/rump/librump/rumpkern/emul.c:1.182	Sun Jun  4 04:05:42 2017
+++ src/sys/rump/librump/rumpkern/emul.c	Thu Nov  9 07:46:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.182 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: emul.c,v 1.183 2017/11/09 12:46:55 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.182 2017/06/04 08:05:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.183 2017/11/09 12:46:55 christos Exp $");
 
 #include 
 #include 
@@ -84,6 +84,7 @@ int mem_no = 2;
 device_t booted_device;
 device_t booted_wedge;
 int booted_partition;
+const char *booted_method;
 
 /* XXX: unused */
 kmutex_t tty_lock;



CVS commit: src/sys/dev/usb

2017-11-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov  9 10:03:47 UTC 2017

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

Log Message:
 Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang
(Errata).

XXX pullup-[78]


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.75 src/sys/dev/usb/xhci.c:1.76
--- src/sys/dev/usb/xhci.c:1.75	Sat Oct 28 00:37:13 2017
+++ src/sys/dev/usb/xhci.c	Thu Nov  9 10:03:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.75 2017/10/28 00:37:13 pgoyette Exp $	*/
+/*	$NetBSD: xhci.c,v 1.76 2017/11/09 10:03:46 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.75 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.76 2017/11/09 10:03:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -689,10 +689,14 @@ xhci_hc_reset(struct xhci_softc * const 
 	usbcmd = XHCI_CMD_HCRST;
 	xhci_op_write_4(sc, XHCI_USBCMD, usbcmd);
 	for (i = 0; i < XHCI_WAIT_HCRST; i++) {
+		/*
+		 * Wait 1ms first. Existing Intel xHCI requies 1ms delay to
+		 * prevent system hang (Errata).
+		 */
+		usb_delay_ms(>sc_bus, 1);
 		usbcmd = xhci_op_read_4(sc, XHCI_USBCMD);
 		if ((usbcmd & XHCI_CMD_HCRST) == 0)
 			break;
-		usb_delay_ms(>sc_bus, 1);
 	}
 	if (i >= XHCI_WAIT_HCRST) {
 		aprint_error_dev(sc->sc_dev, "host controller reset timeout\n");



CVS commit: src/sys/dev/pci/ixgbe

2017-11-09 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov  9 09:33:28 UTC 2017

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

Log Message:
 On device which has SFP(+) cage and a module is inserted, hw->phy.id is not
MII PHY id but SFF 8024 ID. So checking hw->phy.id with 0 doesn't work.
Print PHY ID only for copper PHY.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/ixgbe/ixgbe.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/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.109 src/sys/dev/pci/ixgbe/ixgbe.c:1.110
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.109	Thu Nov  2 08:41:15 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Nov  9 09:33:28 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.109 2017/11/02 08:41:15 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.110 2017/11/09 09:33:28 msaitoh Exp $ */
 
 /**
 
@@ -1069,7 +1069,11 @@ ixgbe_attach(device_t parent, device_t d
 		break;
 	}
 
-	if (hw->phy.id != 0) {
+	/*
+	 *  Print PHY ID only for copper PHY. On device which has SFP(+) cage
+	 * and a module is inserted, phy.id is not MII PHY id but SFF 8024 ID.
+	 */
+	if (hw->phy.media_type == ixgbe_media_type_copper) {
 		uint16_t id1, id2;
 		int oui, model, rev;
 		const char *descr;



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2017-11-09 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Nov  9 08:34:50 UTC 2017

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: pfkey.c

Log Message:
fix typo. (does not affect actual operation, but confuses reader...)

The function is called when racoon receives SADB_X_MIGRATE pfkey message,
however the message is not used now. It was compatible code for KAME.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/pfkey.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.59 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.60
--- src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.59	Thu Nov 29 15:31:25 2012
+++ src/crypto/dist/ipsec-tools/src/racoon/pfkey.c	Thu Nov  9 08:34:50 2017
@@ -1,6 +1,6 @@
-/*	$NetBSD: pfkey.c,v 1.59 2012/11/29 15:31:25 vanhu Exp $	*/
+/*	$NetBSD: pfkey.c,v 1.60 2017/11/09 08:34:50 knakahara Exp $	*/
 
-/* $Id: pfkey.c,v 1.59 2012/11/29 15:31:25 vanhu Exp $ */
+/* $Id: pfkey.c,v 1.60 2017/11/09 08:34:50 knakahara Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -3177,8 +3177,8 @@ migrate_ph2_one_isr(spid, isr_cur, xisr_
 
 	/* Then, verify reqid if necessary */
 	if (isr_cur->saidx.reqid &&
-	(xisr_old->sadb_x_ipsecrequest_reqid != IPSEC_LEVEL_UNIQUE ||
-	 xisr_new->sadb_x_ipsecrequest_reqid != IPSEC_LEVEL_UNIQUE ||
+	(xisr_old->sadb_x_ipsecrequest_level != IPSEC_LEVEL_UNIQUE ||
+	 xisr_new->sadb_x_ipsecrequest_level != IPSEC_LEVEL_UNIQUE ||
 	 isr_cur->saidx.reqid != xisr_old->sadb_x_ipsecrequest_reqid ||
 	 isr_cur->saidx.reqid != xisr_new->sadb_x_ipsecrequest_reqid))
 		return -1;