CVS commit: src/usr.bin/calendar/calendars

2017-07-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Jul  2 08:25:52 UTC 2017

Modified Files:
src/usr.bin/calendar/calendars: calendar.holiday

Log Message:
Only 35 years late.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/calendar/calendars/calendar.holiday

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/calendar/calendars/calendar.holiday
diff -u src/usr.bin/calendar/calendars/calendar.holiday:1.27 src/usr.bin/calendar/calendars/calendar.holiday:1.28
--- src/usr.bin/calendar/calendars/calendar.holiday:1.27	Tue Dec  6 04:54:00 2016
+++ src/usr.bin/calendar/calendars/calendar.holiday	Sun Jul  2 08:25:52 2017
@@ -217,7 +217,7 @@
 06/29	Independence Day in Seychelles
 06/29	Last Day of Ramadan* in Algeria, Oman
 06/30	Day of the Army in Guatemala
-07/01	Dominion Day in Canada
+07/01	Canada Day in Canada
 07/01	Freedom Day in Suriname
 07/01	Independence Day in Burundi
 07/01	National Day in Rwanda



CVS commit: src/usr.bin/calendar/calendars

2017-07-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Jul  2 08:25:52 UTC 2017

Modified Files:
src/usr.bin/calendar/calendars: calendar.holiday

Log Message:
Only 35 years late.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/calendar/calendars/calendar.holiday

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



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

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 09:02:51 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: gdt.c

Log Message:
Hide the computation in a macro.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/amd64/gdt.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/amd64/amd64/gdt.c
diff -u src/sys/arch/amd64/amd64/gdt.c:1.38 src/sys/arch/amd64/amd64/gdt.c:1.39
--- src/sys/arch/amd64/amd64/gdt.c:1.38	Sat Mar 25 15:05:16 2017
+++ src/sys/arch/amd64/amd64/gdt.c	Sun Jul  2 09:02:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.38 2017/03/25 15:05:16 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.39 2017/07/02 09:02:51 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.38 2017/03/25 15:05:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.39 2017/07/02 09:02:51 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -57,8 +57,10 @@ __KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.38
 #include 
 #endif
 
-#define NDYNSLOTS \
-	((MAXGDTSIZ - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
+#define NSLOTS(sz)	\
+	((sz - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
+
+#define NDYNSLOTS	NSLOTS(MAXGDTSIZ)
 
 typedef struct {
 	bool busy[NDYNSLOTS];
@@ -131,8 +133,7 @@ gdt_init(void)
 	/* Initialize the global values */
 	gdt_size = MINGDTSIZ;
 	memset(_bitmap.busy, 0, sizeof(gdt_bitmap.busy));
-	gdt_bitmap.nslots =
-	(gdt_size - DYNSEL_START) / sizeof(struct sys_segment_descriptor);
+	gdt_bitmap.nslots = NSLOTS(gdt_size);
 
 	old_gdt = gdtstore;
 
@@ -234,8 +235,7 @@ gdt_grow(void)
 	gdt_size *= 2;
 	if (gdt_size > MAXGDTSIZ)
 		gdt_size = MAXGDTSIZ;
-	gdt_bitmap.nslots =
-	(gdt_size - DYNSEL_START) / sizeof(struct sys_segment_descriptor);
+	gdt_bitmap.nslots = NSLOTS(gdt_size);
 
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		for (va = (vaddr_t)(ci->ci_gdt) + old_size;



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

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 09:02:51 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: gdt.c

Log Message:
Hide the computation in a macro.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/amd64/amd64/gdt.c

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



CVS commit: src/sys/arch/i386

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 09:02:06 UTC 2017

Modified Files:
src/sys/arch/i386/i386: gdt.c mptramp.S
src/sys/arch/i386/include: gdt.h

Log Message:
Define MINGDTSIZ/MAXGDTSIZ in bytes, not in number of slots; same as
amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/i386/mptramp.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/include/gdt.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/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.61 src/sys/arch/i386/i386/gdt.c:1.62
--- src/sys/arch/i386/i386/gdt.c:1.61	Sat Jun 17 09:32:53 2017
+++ src/sys/arch/i386/i386/gdt.c	Sun Jul  2 09:02:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.61 2017/06/17 09:32:53 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.61 2017/06/17 09:32:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -110,10 +110,10 @@ gdt_init(void)
 	vaddr_t va;
 	struct cpu_info *ci = _info_primary;
 
-	max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
-	min_len = MINGDTSIZ * sizeof(gdtstore[0]);
+	max_len = MAXGDTSIZ;
+	min_len = MINGDTSIZ;
 
-	gdt_size = MINGDTSIZ;
+	gdt_size = (MINGDTSIZ / sizeof(gdtstore[0]));
 	gdt_count = NGDT;
 	gdt_next = NGDT;
 	gdt_free = GNULL_SEL;
@@ -146,8 +146,8 @@ gdt_init(void)
 void
 gdt_alloc_cpu(struct cpu_info *ci)
 {
-	int max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
-	int min_len = MINGDTSIZ * sizeof(gdtstore[0]);
+	int max_len = MAXGDTSIZ;
+	int min_len = MINGDTSIZ;
 	struct vm_page *pg;
 	vaddr_t va;
 
@@ -180,7 +180,7 @@ gdt_init_cpu(struct cpu_info *ci)
 	struct region_descriptor region;
 	size_t max_len;
 
-	max_len = MAXGDTSIZ * sizeof(gdtstore[0]);
+	max_len = MAXGDTSIZ;
 	setregion(, ci->ci_gdt, max_len - 1);
 	lgdt();
 #else
@@ -273,7 +273,7 @@ gdt_get_slot(void)
 		if (gdt_next != gdt_count + offset)
 			panic("gdt_get_slot botch 1");
 		if (gdt_next - offset >= gdt_size) {
-			if (gdt_size >= MAXGDTSIZ)
+			if (gdt_size >= (MAXGDTSIZ / sizeof(gdtstore[0])))
 panic("gdt_get_slot botch 2");
 			gdt_grow();
 		}

Index: src/sys/arch/i386/i386/mptramp.S
diff -u src/sys/arch/i386/i386/mptramp.S:1.29 src/sys/arch/i386/i386/mptramp.S:1.30
--- src/sys/arch/i386/i386/mptramp.S:1.29	Sat May 14 08:34:00 2016
+++ src/sys/arch/i386/i386/mptramp.S	Sun Jul  2 09:02:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $	*/
+/*	$NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $	*/
 
 /*
  * Copyright (c) 2000, 2016 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.29 2016/05/14 08:34:00 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mptramp.S,v 1.30 2017/07/02 09:02:06 maxv Exp $");
 
 #include "opt_mpbios.h"		/* for MPDEBUG */
 
@@ -223,7 +223,7 @@ no_NOX:
 
 	/* %ecx points at our cpu_info structure. */
 
-	movw	$((MAXGDTSIZ*8) - 1), 6(%esp)	/* prepare segment descriptor */
+	movw	$(MAXGDTSIZ-1), 6(%esp)	/* prepare segment descriptor */
 	movl	CPU_INFO_GDT(%ecx), %eax	/* for our real gdt */
 	movl	%eax, 8(%esp)
 	lgdt	6(%esp)

Index: src/sys/arch/i386/include/gdt.h
diff -u src/sys/arch/i386/include/gdt.h:1.15 src/sys/arch/i386/include/gdt.h:1.16
--- src/sys/arch/i386/include/gdt.h:1.15	Wed Feb  8 10:08:26 2017
+++ src/sys/arch/i386/include/gdt.h	Sun Jul  2 09:02:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.h,v 1.15 2017/02/08 10:08:26 maxv Exp $	*/
+/*	$NetBSD: gdt.h,v 1.16 2017/07/02 09:02:06 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -44,5 +44,5 @@ void ldt_free(int);
 
 #endif /* LOCORE */
 
-#define	MINGDTSIZ	512
-#define	MAXGDTSIZ	8192
+#define	MINGDTSIZ	PAGE_SIZE
+#define	MAXGDTSIZ	65536



CVS commit: src/sys/arch/i386

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 09:02:06 UTC 2017

Modified Files:
src/sys/arch/i386/i386: gdt.c mptramp.S
src/sys/arch/i386/include: gdt.h

Log Message:
Define MINGDTSIZ/MAXGDTSIZ in bytes, not in number of slots; same as
amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/i386/i386/mptramp.S
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/i386/include/gdt.h

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



CVS commit: src/sys/arch

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 11:21:14 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: gdt.c
src/sys/arch/i386/i386: gdt.c

Log Message:
Put some ()s in the macro (kre).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/i386/i386/gdt.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/amd64/amd64/gdt.c
diff -u src/sys/arch/amd64/amd64/gdt.c:1.39 src/sys/arch/amd64/amd64/gdt.c:1.40
--- src/sys/arch/amd64/amd64/gdt.c:1.39	Sun Jul  2 09:02:51 2017
+++ src/sys/arch/amd64/amd64/gdt.c	Sun Jul  2 11:21:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.39 2017/07/02 09:02:51 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.40 2017/07/02 11:21:13 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.39 2017/07/02 09:02:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.40 2017/07/02 11:21:13 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -58,8 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.39
 #endif
 
 #define NSLOTS(sz)	\
-	((sz - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
-
+	(((sz) - DYNSEL_START) / sizeof(struct sys_segment_descriptor))
 #define NDYNSLOTS	NSLOTS(MAXGDTSIZ)
 
 typedef struct {
@@ -67,7 +66,7 @@ typedef struct {
 	size_t nslots;
 } gdt_bitmap_t;
 
-size_t gdt_size;			/* size of GDT in bytes */		
+size_t gdt_size;			/* size of GDT in bytes */	
 static gdt_bitmap_t gdt_bitmap;		/* bitmap of busy slots */
 
 #if defined(USER_LDT) || !defined(XEN)

Index: src/sys/arch/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.63 src/sys/arch/i386/i386/gdt.c:1.64
--- src/sys/arch/i386/i386/gdt.c:1.63	Sun Jul  2 11:16:50 2017
+++ src/sys/arch/i386/i386/gdt.c	Sun Jul  2 11:21:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.63 2017/07/02 11:16:50 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.64 2017/07/02 11:21:13 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.63 2017/07/02 11:16:50 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.64 2017/07/02 11:21:13 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -46,8 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.63
 #include 
 
 #define NSLOTS(sz)	\
-	((sz - DYNSEL_START) / sizeof(union descriptor))
-
+	(((sz) - DYNSEL_START) / sizeof(union descriptor))
 #define NDYNSLOTS	NSLOTS(MAXGDTSIZ)
 
 typedef struct {



CVS commit: [netbsd-8] src/sys/arch/arm/allwinner

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:08:29 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner [netbsd-8]: awin_can.c

Log Message:
Revert previous; wrong branch


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/arch/arm/allwinner/awin_can.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/allwinner/awin_can.c
diff -u src/sys/arch/arm/allwinner/awin_can.c:1.2.2.1 src/sys/arch/arm/allwinner/awin_can.c:1.2.2.2
--- src/sys/arch/arm/allwinner/awin_can.c:1.2.2.1	Sun Jul  2 15:07:13 2017
+++ src/sys/arch/arm/allwinner/awin_can.c	Sun Jul  2 15:08:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_can.c,v 1.2.2.1 2017/07/02 15:07:13 bouyer Exp $	*/
+/*	$NetBSD: awin_can.c,v 1.2.2.2 2017/07/02 15:08:29 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.2.2.1 2017/07/02 15:07:13 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.2.2.2 2017/07/02 15:08:29 bouyer Exp $");
 
 #include 
 #include 
@@ -239,14 +239,12 @@ awin_can_rx_intr(struct awin_can_softc *
 
 	if (dlc > CAN_MAX_DLC) {
 		ifp->if_ierrors++;
-		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 		
 	m = m_gethdr(M_NOWAIT, MT_HEADER);
 	if (m == NULL) {
 		ifp->if_ierrors++;
-		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 	cf = mtod(m, struct can_frame *);



CVS commit: [netbsd-8] src/sys/arch/arm/allwinner

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:08:29 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner [netbsd-8]: awin_can.c

Log Message:
Revert previous; wrong branch


To generate a diff of this commit:
cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/arch/arm/allwinner/awin_can.c

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



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

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:09:53 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner: awin_can.c

Log Message:
In the RX IRQ handler, release the receive buffer in the error paths.
Fix a hang I've been seeing under high traffic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/allwinner/awin_can.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/allwinner/awin_can.c
diff -u src/sys/arch/arm/allwinner/awin_can.c:1.2 src/sys/arch/arm/allwinner/awin_can.c:1.3
--- src/sys/arch/arm/allwinner/awin_can.c:1.2	Sat May 27 21:02:55 2017
+++ src/sys/arch/arm/allwinner/awin_can.c	Sun Jul  2 15:09:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_can.c,v 1.2 2017/05/27 21:02:55 bouyer Exp $	*/
+/*	$NetBSD: awin_can.c,v 1.3 2017/07/02 15:09:53 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.2 2017/05/27 21:02:55 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.3 2017/07/02 15:09:53 bouyer Exp $");
 
 #include 
 #include 
@@ -239,12 +239,14 @@ awin_can_rx_intr(struct awin_can_softc *
 
 	if (dlc > CAN_MAX_DLC) {
 		ifp->if_ierrors++;
+		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 		
 	m = m_gethdr(M_NOWAIT, MT_HEADER);
 	if (m == NULL) {
 		ifp->if_ierrors++;
+		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 	cf = mtod(m, struct can_frame *);



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

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:09:53 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner: awin_can.c

Log Message:
In the RX IRQ handler, release the receive buffer in the error paths.
Fix a hang I've been seeing under high traffic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/allwinner/awin_can.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 16:19:47 UTC 2017

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

Log Message:
Adjust to new pinctrl API


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_pinctrl.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 16:19:47 UTC 2017

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

Log Message:
Adjust to new pinctrl API


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/samsung/exynos_pinctrl.c

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.10 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.10	Thu Jun 22 06:42:38 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Sun Jul  2 16:19:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.10 2017/06/22 06:42:38 skrll Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,16 +55,15 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_pinct
 
 struct exynos_pinctrl_config {
 	int pc_phandle;
-	struct exynos_gpio_pin_cfg *pc_pincfg;
+	struct exynos_gpio_pin_cfg pc_pincfg;
 	struct exynos_pinctrl_softc *pc_sc;
 };
 
 static int exynos_pinctrl_match(device_t, cfdata_t, void *);
 static void exynos_pinctrl_attach(device_t, device_t, void *);
 
-static int  exynos_pinctrl_set_cfg(void *);
-static struct exynos_gpio_pin_cfg *
-exynos_parse_config(struct exynos_pinctrl_config *pc);
+static int  exynos_pinctrl_set_cfg(device_t, const void *, size_t);
+static void exynos_parse_config(int, struct exynos_gpio_pin_cfg *);
 
 static struct fdtbus_pinctrl_controller_func exynos_pinctrl_controller_func = {
 	.set_config = exynos_pinctrl_set_cfg
@@ -128,90 +127,59 @@ exynos_pinctrl_attach(device_t parent, d
 		}
 
 		if (is_pinctrl(child)) {
-			struct exynos_pinctrl_config *pc;
-			pc = kmem_alloc(sizeof(*pc), KM_SLEEP);
-			pc->pc_phandle = child;
-			pc->pc_sc = sc;
-			pc->pc_pincfg = exynos_parse_config(pc);
-			fdtbus_register_pinctrl_config(pc, child,
+			fdtbus_register_pinctrl_config(self, child,
 		   _pinctrl_controller_func);
 		}
 	}
 }
 
-static struct exynos_gpio_pin_cfg *
-exynos_parse_config(struct exynos_pinctrl_config *pc)
+static void
+exynos_parse_config(int phandle, struct exynos_gpio_pin_cfg *gc)
 {
-	struct exynos_gpio_pin_cfg *gc = kmem_zalloc(sizeof(*gc), KM_SLEEP);
-	int len;
-	int value;
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-function",
-			 , sizeof(value));
-	if (len > 0) {
-		gc->cfg = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-pud", ,
-			 sizeof());
-	if (len > 0) {
-		gc->pud = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-drv", ,
-			 sizeof());
-	if (len > 0) {
-		gc->drv = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-conpwd", ,
-			 sizeof());
-	if (len > 0) {
-		gc->conpwd = be32toh(value);
-	}
-
-	len = OF_getprop(pc->pc_phandle, "samsung,pin-pudpwd", ,
-			 sizeof());
-	if (len > 0) {
-		gc->pudpwd = be32toh(value);
-	}
-	return gc;
+	of_getprop_uint32(phandle, "samsung,pin-function", >cfg);
+	of_getprop_uint32(phandle, "samsung,pin-pud", >pud);
+	of_getprop_uint32(phandle, "samsung,pin-drv", >drv);
+	of_getprop_uint32(phandle, "samsung,pin-conpwd", >conpwd);
+	of_getprop_uint32(phandle, "samsung,pin-pudpwd", >pudpwd);
 }
 
 static int
 exynos_do_config(struct exynos_pinctrl_config *pc)
 {
-	struct exynos_gpio_pin_cfg *gc = pc->pc_pincfg;
+	struct exynos_gpio_pin_cfg *gc = >pc_pincfg;
 	struct exynos_gpio_bank *bank;
-	int len;
-	char result[20];
+	const char *pins;
 
-	if (gc == NULL) {
-		printf("%s: No configuration available\n", __func__);
+	int pins_len = OF_getproplen(pc->pc_phandle, "samsung,pins");
+	if (pins_len <= 0)
 		return -1;
-	}
 
-	len = OF_getprop(pc->pc_phandle, "samsung,pins", result,
-			 sizeof(result));
-	if (len <= 0) {
-		printf("%s: couldn't get pins. (%d)\n", __func__,
-			pc->pc_phandle);
-		return -1;
-	}
-
-	bank = exynos_gpio_bank_lookup([0]);
-	if (!bank) {
-		printf("%s: Couldn't get bank \"%s\".\n", __func__, result);
-		return -1;
+	for (pins = fdtbus_get_string(pc->pc_phandle, "samsung,pins");
+	 pins_len > 0;
+	 pins_len -= strlen(pins) + 1, pins += strlen(pins) + 1) {
+		bank = exynos_gpio_bank_lookup(pins);
+		if (bank == NULL) {
+			aprint_error_dev(pc->pc_sc->sc_dev,
+			"unknown pin name '%s'\n", pins);
+			continue;
+		}
+		exynos_gpio_pin_ctl_write(bank, gc);
 	}
 
-	exynos_gpio_pin_ctl_write(bank, gc);
 	return 0;
 }
 	
 static int
-exynos_pinctrl_set_cfg(void *cookie)
+exynos_pinctrl_set_cfg(device_t dev, const void *data, size_t len)
 {
-	struct exynos_pinctrl_config *pc = cookie;
-	return exynos_do_config(pc);
+	struct 

CVS commit: src/sys/dev/fdt

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 15:27:58 UTC 2017

Modified Files:
src/sys/dev/fdt: fdt_pinctrl.c fdt_subr.c fdtvar.h

Log Message:
Fix the pinctrl api to match the spec. A pinctrl config can have more
than one xref, and an xref may have specifier data associated with it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/fdt/fdtvar.h

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



CVS commit: src/sys/dev/fdt

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 15:27:58 UTC 2017

Modified Files:
src/sys/dev/fdt: fdt_pinctrl.c fdt_subr.c fdtvar.h

Log Message:
Fix the pinctrl api to match the spec. A pinctrl config can have more
than one xref, and an xref may have specifier data associated with it.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/fdt/fdtvar.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/fdt/fdt_pinctrl.c
diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.3 src/sys/dev/fdt/fdt_pinctrl.c:1.4
--- src/sys/dev/fdt/fdt_pinctrl.c:1.3	Tue Oct 11 13:04:57 2016
+++ src/sys/dev/fdt/fdt_pinctrl.c	Sun Jul  2 15:27:58 2017
@@ -1,6 +1,7 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.3 2016/10/11 13:04:57 maxv Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.4 2017/07/02 15:27:58 jmcneill Exp $ */
 
 /*-
+ * Copyright (c) 2017 Jared McNeill 
  * Copyright (c) 2015 Martin Fouts
  * All rights reserved.
  *
@@ -27,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.3 2016/10/11 13:04:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.4 2017/07/02 15:27:58 jmcneill Exp $");
 
 #include 
 #include 
@@ -37,8 +38,8 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.
 #include 
 
 struct fdtbus_pinctrl_controller {
+	device_t pc_dev;
 	int pc_phandle;
-	void *pc_cookie;
 	const struct fdtbus_pinctrl_controller_func *pc_funcs;
 
 	struct fdtbus_pinctrl_controller *pc_next;
@@ -47,13 +48,13 @@ struct fdtbus_pinctrl_controller {
 static struct fdtbus_pinctrl_controller *fdtbus_pc = NULL;
 
 int
-fdtbus_register_pinctrl_config(void *cookie, int phandle,
+fdtbus_register_pinctrl_config(device_t dev, int phandle,
 const struct fdtbus_pinctrl_controller_func *funcs)
 {
 	struct fdtbus_pinctrl_controller *pc;
 
 	pc = kmem_alloc(sizeof(*pc), KM_SLEEP);
-	pc->pc_cookie = cookie;
+	pc->pc_dev = dev;
 	pc->pc_phandle = phandle;
 	pc->pc_funcs = funcs;
 
@@ -78,57 +79,88 @@ fdtbus_pinctrl_lookup(int phandle)
 int
 fdtbus_pinctrl_set_config_index(int phandle, u_int index)
 {
-	char buf[80];
-	int len, handle;
 	struct fdtbus_pinctrl_controller *pc;
+	const u_int *pinctrl_data;
+	char buf[16];
+	u_int xref, pinctrl_cells;
+	int len, error;
+
+	snprintf(buf, sizeof(buf), "pinctrl-%u", index);
+
+	pinctrl_data = fdtbus_get_prop(phandle, buf, );
+	if (pinctrl_data == NULL)
+		return ENOENT;
+
+	while (len > 0) {
+		xref = fdtbus_get_phandle_from_native(be32toh(pinctrl_data[0]));
+		pc = fdtbus_pinctrl_lookup(xref);
+		if (pc == NULL)
+			return ENXIO;
+
+		if (of_getprop_uint32(OF_parent(xref), "#pinctrl-cells", _cells) != 0)
+			pinctrl_cells = 1;
+
+		error = pc->pc_funcs->set_config(pc->pc_dev, pinctrl_data, pinctrl_cells * 4);
+		if (error != 0)
+			return error;
 
-	snprintf(buf, 80, "pinctrl-%d", index);
-
-	len = OF_getprop(phandle, buf, (char *),
-sizeof(handle));
-	if (len != sizeof(int)) {
-		printf("%s: couldn't get %s.\n", __func__, buf);
-   return -1;
-   }
-
-	handle = fdtbus_get_phandle_from_native(be32toh(handle));
-
-	pc = fdtbus_pinctrl_lookup(handle);
-	if (!pc) {
-		printf("%s: Couldn't get handle %d for %s\n", __func__, handle,
-		   buf);
-		return -1;
+		pinctrl_data += pinctrl_cells;
+		len -= (pinctrl_cells * 4);
 	}
 
-	return pc->pc_funcs->set_config(pc->pc_cookie);
+	return 0;
 }
 
 int
 fdtbus_pinctrl_set_config(int phandle, const char *cfgname)
 {
-	int index = 0;
-	int len;
-	char *result;
-	char *next;
+	const char *pinctrl_names, *name;
+	int len, index;
 
-	len = OF_getproplen(phandle, "pinctrl-names");
-	if (len <= 0)
+	if ((len = OF_getproplen(phandle, "pinctrl-names")) < 0)
 		return -1;
-	result = kmem_zalloc(len, KM_SLEEP);
-	OF_getprop(phandle, "pinctrl-names", result, len);
 
-	next = result;
-	while (next - result < len) {
-		if (!strcmp(next, cfgname)) {
-			kmem_free(result, len);
+	pinctrl_names = fdtbus_get_string(phandle, "pinctrl-names");
+
+	for (name = pinctrl_names, index = 0; len > 0;
+	 name += strlen(name) + 1, index++) {
+		if (strcmp(name, cfgname) == 0)
 			return fdtbus_pinctrl_set_config_index(phandle, index);
-		}
-		index++;
-		while (*next)
-			next++;
-		next++;
 	}
 
-	kmem_free(result, len);
+	/* Not found */
 	return -1;
 }
+
+static void
+fdtbus_pinctrl_configure_node(int phandle)
+{
+	char buf[256];
+	int child, error;
+
+	for (child = OF_child(phandle); child; child = OF_peer(child)) {
+		if (!fdtbus_status_okay(child))
+			continue;
+
+		/* Configure child nodes */
+		fdtbus_pinctrl_configure_node(child);
+
+		/*
+		 * Set configuration 0 for this node. This may fail if the
+		 * pinctrl provider is missing; that's OK, we will re-configure
+		 * when that provider attaches.
+		 */
+		fdtbus_get_path(child, buf, sizeof(buf));
+		

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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 15:28:25 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun6i_a31_gpio.c sunxi_gpio.c sunxi_gpio.h

Log Message:
Enable sunxi pinctrl support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun6i_a31_gpio.c \
src/sys/arch/arm/sunxi/sunxi_gpio.c src/sys/arch/arm/sunxi/sunxi_gpio.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/sunxi/sun6i_a31_gpio.c
diff -u src/sys/arch/arm/sunxi/sun6i_a31_gpio.c:1.1 src/sys/arch/arm/sunxi/sun6i_a31_gpio.c:1.2
--- src/sys/arch/arm/sunxi/sun6i_a31_gpio.c:1.1	Sun Jul  2 13:36:46 2017
+++ src/sys/arch/arm/sunxi/sun6i_a31_gpio.c	Sun Jul  2 15:28:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun6i_a31_gpio.c,v 1.1 2017/07/02 13:36:46 jmcneill Exp $ */
+/* $NetBSD: sun6i_a31_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016 Emmanuel Vadot 
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sun6i_a31_gpio.c,v 1.1 2017/07/02 13:36:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun6i_a31_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $");
 
 #include 
 #include 
@@ -212,7 +212,33 @@ static const struct sunxi_gpio_pins a31_
 	{"PH30", 7, 30, {"gpio_in", "gpio_out", "nand1", NULL, NULL, NULL, NULL, NULL}},
 };
 
+static const struct sunxi_gpio_pins a31_r_pins[] = {
+	{"PL0",  0, 0,  {"gpio_in", "gpio_out", "s_twi", "s_p2wi", NULL, NULL, NULL, NULL}},
+	{"PL1",  0, 1,  {"gpio_in", "gpio_out", "s_twi", "s_p2wi", NULL, NULL, NULL, NULL}},
+	{"PL2",  0, 2,  {"gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, NULL, NULL}},
+	{"PL3",  0, 3,  {"gpio_in", "gpio_out", "s_uart", NULL, NULL, NULL, NULL, NULL}},
+	{"PL4",  0, 4,  {"gpio_in", "gpio_out", "s_ir", NULL, NULL, NULL, NULL, NULL}},
+	{"PL5",  0, 5,  {"gpio_in", "gpio_out", "pl_eint0", "s_jtag", NULL, NULL, NULL, NULL}, 2, 0},
+	{"PL6",  0, 6,  {"gpio_in", "gpio_out", "pl_eint1", "s_jtag", NULL, NULL, NULL, NULL}, 2, 1},
+	{"PL7",  0, 7,  {"gpio_in", "gpio_out", "pl_eint2", "s_jtag", NULL, NULL, NULL, NULL}, 2, 2},
+	{"PL8",  0, 8,  {"gpio_in", "gpio_out", "pl_eint3", "s_jtag", NULL, NULL, NULL, NULL}, 2, 3},
+
+	{"PM0",  1, 0,  {"gpio_in", "gpio_out", "pm_eint0", NULL, NULL, NULL, NULL, NULL}, 2, 0},
+	{"PM1",  1, 1,  {"gpio_in", "gpio_out", "pm_eint1", NULL, NULL, NULL, NULL, NULL}, 2, 1},
+	{"PM2",  1, 2,  {"gpio_in", "gpio_out", "pm_eint2", "1wire", NULL, NULL, NULL, NULL}, 2, 2},
+	{"PM3",  1, 3,  {"gpio_in", "gpio_out", "pm_eint3", NULL, NULL, NULL, NULL, NULL}, 2, 3},
+	{"PM4",  1, 4,  {"gpio_in", "gpio_out", "pm_eint4", NULL, NULL, NULL, NULL, NULL}, 2, 4},
+	{"PM5",  1, 5,  {"gpio_in", "gpio_out", "pm_eint5", NULL, NULL, NULL, NULL, NULL}, 2, 5},
+	{"PM6",  1, 6,  {"gpio_in", "gpio_out", "pm_eint6", NULL, NULL, NULL, NULL, NULL}, 2, 6},
+	{"PM7",  1, 7,  {"gpio_in", "gpio_out", "pm_eint7", "rtc", NULL, NULL, NULL, NULL}, 2, 7},
+};
+
 const struct sunxi_gpio_padconf sun6i_a31_padconf = {
 	.npins = __arraycount(a31_pins),
 	.pins = a31_pins,
 };
+
+const struct sunxi_gpio_padconf sun6i_a31_r_padconf = {
+	.npins = __arraycount(a31_r_pins),
+	.pins = a31_r_pins,
+};
Index: src/sys/arch/arm/sunxi/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.1 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.2
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.1	Sun Jul  2 13:36:46 2017
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Sun Jul  2 15:28:25 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.1 2017/07/02 13:36:46 jmcneill Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.1 2017/07/02 13:36:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $");
 
 #include 
 #include 
@@ -49,11 +49,17 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c
 #define  SUNXI_GPIO_CFG_PINMASK(pin)	(0x7 << (((pin) % 8) * 4))
 #define	SUNXI_GPIO_DATA(port)		(SUNXI_GPIO_PORT(port) + 0x10)
 #define	SUNXI_GPIO_DRV(port, pin)	(SUNXI_GPIO_PORT(port) + 0x14 + (0x4 * ((pin) / 16)))
+#define  SUNXI_GPIO_DRV_PINMASK(pin)	(0x3 << (((pin) % 16) * 4))
 #define	SUNXI_GPIO_PULL(port, pin)	(SUNXI_GPIO_PORT(port) + 0x1c + (0x4 * ((pin) / 16)))
+#define	 SUNXI_GPIO_PULL_DISABLE	0
+#define	 SUNXI_GPIO_PULL_UP		1
+#define	 SUNXI_GPIO_PULL_DOWN		2
+#define  SUNXI_GPIO_PULL_PINMASK(pin)	(0x3 << (((pin) % 16) * 4))
 
 static const struct of_compat_data compat_data[] = {
 #ifdef SOC_SUN6I_A31
 	{ "allwinner,sun6i-a31-pinctrl",	(uintptr_t)_a31_padconf },
+	{ "allwinner,sun6i-a31-r-pinctrl",	(uintptr_t)_a31_r_padconf },
 #endif
 #ifdef SOC_SUN8I_H3
 	{ "allwinner,sun8i-h3-pinctrl",		(uintptr_t)_h3_padconf },
@@ -102,6 +108,21 @@ sunxi_gpio_lookup(struct sunxi_gpio_soft
 	return NULL;

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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 15:28:25 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sun6i_a31_gpio.c sunxi_gpio.c sunxi_gpio.h

Log Message:
Enable sunxi pinctrl support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun6i_a31_gpio.c \
src/sys/arch/arm/sunxi/sunxi_gpio.c src/sys/arch/arm/sunxi/sunxi_gpio.h

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



CVS commit: src/lib/libpthread

2017-07-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jul  2 17:13:08 UTC 2017

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Do not look at environmental variables for suid/guid binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/lib/libpthread/pthread.c

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



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 10:52:35 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.vexpress

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/std.vexpress

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.vexpress
diff -u src/sys/arch/evbarm/conf/std.vexpress:1.4 src/sys/arch/evbarm/conf/std.vexpress:1.5
--- src/sys/arch/evbarm/conf/std.vexpress:1.4	Fri Jun  2 15:22:47 2017
+++ src/sys/arch/evbarm/conf/std.vexpress	Sun Jul  2 10:52:35 2017
@@ -1,4 +1,4 @@
-#   $NetBSD: std.vexpress,v 1.4 2017/06/02 15:22:47 jmcneill Exp $
+#   $NetBSD: std.vexpress,v 1.5 2017/07/02 10:52:35 skrll Exp $
 #
 # standard NetBSD/evbarm for VEXPRESS options
 
@@ -13,6 +13,7 @@ options 	MODULAR
 options 	MODULAR_DEFAULT_AUTOLOAD
 options 	ARM_HAS_VBAR
 options 	__HAVE_CPU_COUNTER
+options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
 options 	__HAVE_FAST_SOFTINTS# should be in types.h
 #options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 options 	TPIDRPRW_IS_CURCPU



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 10:52:35 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.vexpress

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/std.vexpress

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



CVS commit: [netbsd-8] src/sys/arch/arm/allwinner

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:07:13 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner [netbsd-8]: awin_can.c

Log Message:
In the RX IRQ handler, release the receive buffer in the error paths.
Fix a hang I've been seeing under high traffic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/arch/arm/allwinner/awin_can.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/allwinner/awin_can.c
diff -u src/sys/arch/arm/allwinner/awin_can.c:1.2 src/sys/arch/arm/allwinner/awin_can.c:1.2.2.1
--- src/sys/arch/arm/allwinner/awin_can.c:1.2	Sat May 27 21:02:55 2017
+++ src/sys/arch/arm/allwinner/awin_can.c	Sun Jul  2 15:07:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_can.c,v 1.2 2017/05/27 21:02:55 bouyer Exp $	*/
+/*	$NetBSD: awin_can.c,v 1.2.2.1 2017/07/02 15:07:13 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.2 2017/05/27 21:02:55 bouyer Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_can.c,v 1.2.2.1 2017/07/02 15:07:13 bouyer Exp $");
 
 #include 
 #include 
@@ -239,12 +239,14 @@ awin_can_rx_intr(struct awin_can_softc *
 
 	if (dlc > CAN_MAX_DLC) {
 		ifp->if_ierrors++;
+		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 		
 	m = m_gethdr(M_NOWAIT, MT_HEADER);
 	if (m == NULL) {
 		ifp->if_ierrors++;
+		awin_can_write(sc, AWIN_CAN_CMD_REG, AWIN_CAN_CMD_REL_RX_BUF);
 		return;
 	}
 	cf = mtod(m, struct can_frame *);



CVS commit: [netbsd-8] src/sys/arch/arm/allwinner

2017-07-02 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jul  2 15:07:13 UTC 2017

Modified Files:
src/sys/arch/arm/allwinner [netbsd-8]: awin_can.c

Log Message:
In the RX IRQ handler, release the receive buffer in the error paths.
Fix a hang I've been seeing under high traffic.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/arch/arm/allwinner/awin_can.c

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



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 10:12:45 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.beagle

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/std.beagle

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



CVS commit: src/lib/libpthread

2017-07-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jul  2 17:13:08 UTC 2017

Modified Files:
src/lib/libpthread: pthread.c

Log Message:
Do not look at environmental variables for suid/guid binaries.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/lib/libpthread/pthread.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/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.148 src/lib/libpthread/pthread.c:1.149
--- src/lib/libpthread/pthread.c:1.148	Sun Jul  2 16:41:32 2017
+++ src/lib/libpthread/pthread.c	Sun Jul  2 17:13:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.148 2017/07/02 16:41:32 joerg Exp $	*/
+/*	$NetBSD: pthread.c,v 1.149 2017/07/02 17:13:07 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.148 2017/07/02 16:41:32 joerg Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.149 2017/07/02 17:13:07 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -1386,6 +1386,9 @@ pthread__getenv(const char *name)
 	extern char **environ;
 	size_t l_name, offset;
 
+	if (issetugid())
+		return (NULL);
+
 	l_name = strlen(name);
 	for (offset = 0; environ[offset] != NULL; offset++) {
 		if (strncmp(name, environ[offset], l_name) == 0 &&



CVS commit: src/sys/arch/arm

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 16:16:44 UTC 2017

Modified Files:
src/sys/arch/arm/arm: syscall.c undefined.c
src/sys/arch/arm/arm32: arm32_boot.c arm32_machdep.c fault.c

Log Message:
Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/arm/arm/syscall.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/arm/arm/undefined.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/arm32/arm32_boot.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/arm/arm32/fault.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/arm/syscall.c
diff -u src/sys/arch/arm/arm/syscall.c:1.61 src/sys/arch/arm/arm/syscall.c:1.62
--- src/sys/arch/arm/arm/syscall.c:1.61	Sun Jul  2 16:06:42 2017
+++ src/sys/arch/arm/arm/syscall.c	Sun Jul  2 16:16:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.61 2017/07/02 16:06:42 skrll Exp $	*/
+/*	$NetBSD: syscall.c,v 1.62 2017/07/02 16:16:44 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.61 2017/07/02 16:06:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.62 2017/07/02 16:16:44 skrll Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ swi_handler(trapframe_t *tf)
 #endif
 	}
 
-	lwp_settrapframe(l, tf);
+	KASSERTMSG(tf == lwp_trapframe(l), "tf %p vs %p", tf, lwp_trapframe(l));
 
 #ifdef CPU_ARM7
 	/*

Index: src/sys/arch/arm/arm/undefined.c
diff -u src/sys/arch/arm/arm/undefined.c:1.59 src/sys/arch/arm/arm/undefined.c:1.60
--- src/sys/arch/arm/arm/undefined.c:1.59	Sat May  6 13:05:59 2017
+++ src/sys/arch/arm/arm/undefined.c	Sun Jul  2 16:16:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: undefined.c,v 1.59 2017/05/06 13:05:59 skrll Exp $	*/
+/*	$NetBSD: undefined.c,v 1.60 2017/07/02 16:16:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Ben Harris.
@@ -55,7 +55,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.59 2017/05/06 13:05:59 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: undefined.c,v 1.60 2017/07/02 16:16:44 skrll Exp $");
 
 #include 
 #include 
@@ -420,7 +420,8 @@ undefinedinstruction(trapframe_t *tf)
 		 * time of fault.
 		 */
 		fault_code = FAULT_USER;
-		lwp_settrapframe(l, tf);
+		KASSERTMSG(tf == lwp_trapframe(l), "tf %p vs %p", tf,
+		lwp_trapframe(l));
 	} else
 		fault_code = 0;
 

Index: src/sys/arch/arm/arm32/arm32_boot.c
diff -u src/sys/arch/arm/arm32/arm32_boot.c:1.18 src/sys/arch/arm/arm32/arm32_boot.c:1.19
--- src/sys/arch/arm/arm32/arm32_boot.c:1.18	Thu Dec 22 14:47:54 2016
+++ src/sys/arch/arm/arm32/arm32_boot.c	Sun Jul  2 16:16:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_boot.c,v 1.18 2016/12/22 14:47:54 cherry Exp $	*/
+/*	$NetBSD: arm32_boot.c,v 1.19 2017/07/02 16:16:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003, 2005  Genetec Corporation.  All rights reserved.
@@ -123,7 +123,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.18 2016/12/22 14:47:54 cherry Exp $");
+__KERNEL_RCSID(1, "$NetBSD: arm32_boot.c,v 1.19 2017/07/02 16:16:44 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -173,6 +173,27 @@ initarm_common(vaddr_t kvm_base, vsize_t
 	 */
 	uvm_lwp_setuarea(, kernelstack.pv_va);
 
+	struct lwp * const l = 
+	struct pcb * const pcb = lwp_getpcb(l);
+
+	/* Zero out the PCB. */
+ 	memset(pcb, 0, sizeof(*pcb));
+
+	pcb->pcb_ksp = uvm_lwp_getuarea(l) + USPACE_SVC_STACK_TOP;
+	pcb->pcb_ksp -= sizeof(struct trapframe);
+
+	struct trapframe * tf = (struct trapframe *)pcb->pcb_ksp;
+
+	/* Zero out the trapframe. */
+	memset(tf, 0, sizeof(*tf));
+	lwp_settrapframe(l, tf);
+
+#if defined(__ARMEB__)
+	tf->tf_spsr = PSR_USR32_MODE | (CPU_IS_ARMV7_P() ? PSR_E_BIT : 0);
+#else
+ 	tf->tf_spsr = PSR_USR32_MODE;
+#endif
+
 #ifdef VERBOSE_INIT_ARM
 	printf("bootstrap done.\n");
 #endif
@@ -313,7 +334,7 @@ initarm_common(vaddr_t kvm_base, vsize_t
 #endif
 
 	/* We return the new stack pointer address */
-	return kernelstack.pv_va + USPACE_SVC_STACK_TOP;
+	return pcb->pcb_ksp;
 }
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.113 src/sys/arch/arm/arm32/arm32_machdep.c:1.114
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.113	Sun Jul  2 16:06:42 2017
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Sun Jul  2 16:16:44 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.113 2017/07/02 16:06:42 skrll Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.114 2017/07/02 16:16:44 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.113 2017/07/02 16:06:42 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.114 2017/07/02 

CVS commit: src/sys/arch/i386

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 11:16:50 UTC 2017

Modified Files:
src/sys/arch/i386/i386: gdt.c
src/sys/arch/i386/include: segments.h

Log Message:
Use a bitmap-based allocator for i386, same as amd64. Several functions
are now identical - or nearly identical - on both sides. I couldn't test
this change on xen, because I'm having some unrelated issues with my VM
and I've spent enough time not understanding what's wrong with it.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/include/segments.h

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



CVS commit: src/sys/arch/i386

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 11:16:50 UTC 2017

Modified Files:
src/sys/arch/i386/i386: gdt.c
src/sys/arch/i386/include: segments.h

Log Message:
Use a bitmap-based allocator for i386, same as amd64. Several functions
are now identical - or nearly identical - on both sides. I couldn't test
this change on xen, because I'm having some unrelated issues with my VM
and I've spent enough time not understanding what's wrong with it.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/i386/i386/gdt.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/i386/include/segments.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/i386/i386/gdt.c
diff -u src/sys/arch/i386/i386/gdt.c:1.62 src/sys/arch/i386/i386/gdt.c:1.63
--- src/sys/arch/i386/i386/gdt.c:1.62	Sun Jul  2 09:02:06 2017
+++ src/sys/arch/i386/i386/gdt.c	Sun Jul  2 11:16:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $	*/
+/*	$NetBSD: gdt.c,v 1.63 2017/07/02 11:16:50 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.62 2017/07/02 09:02:06 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.63 2017/07/02 11:16:50 maxv Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -45,10 +45,18 @@ __KERNEL_RCSID(0, "$NetBSD: gdt.c,v 1.62
 
 #include 
 
-int gdt_size;	/* total number of GDT entries */
-int gdt_count;	/* number of GDT entries in use */
-int gdt_next;	/* next available slot for sweeping */
-int gdt_free;	/* next free slot; terminated with GNULL_SEL */
+#define NSLOTS(sz)	\
+	((sz - DYNSEL_START) / sizeof(union descriptor))
+
+#define NDYNSLOTS	NSLOTS(MAXGDTSIZ)
+
+typedef struct {
+	bool busy[NDYNSLOTS];
+	size_t nslots;
+} gdt_bitmap_t;
+
+size_t gdt_size;			/* size of GDT in bytes */	
+static gdt_bitmap_t gdt_bitmap;		/* bitmap of busy slots */
 
 #ifndef XEN
 static int ldt_count;	/* number of LDTs */
@@ -81,17 +89,20 @@ update_descriptor(union descriptor *tabl
  * Called on a newly-allocated GDT slot, so no race between CPUs.
  */
 static void
-setgdt(int sel, const void *base, size_t limit, int type, int dpl, int def32,
+setgdt(int slot, const void *base, size_t limit, int type, int dpl, int def32,
 int gran)
 {
-	struct segment_descriptor *sd = [sel].sd;
+	struct segment_descriptor *sd;
 	CPU_INFO_ITERATOR cii;
 	struct cpu_info *ci;
+	int idx;
 
+	idx = IDXSEL(GDYNSEL(slot, SEL_KPL));
+	sd = [idx].sd;
 	setsegment(sd, base, limit, type, dpl, def32, gran);
 	for (CPU_INFO_FOREACH(cii, ci)) {
 		if (ci->ci_gdt != NULL)
-			update_descriptor(>ci_gdt[sel],
+			update_descriptor(>ci_gdt[idx],
 			(union descriptor *)sd);
 	}
 }
@@ -104,24 +115,27 @@ setgdt(int sel, const void *base, size_t
 void
 gdt_init(void)
 {
-	size_t max_len, min_len;
 	union descriptor *old_gdt;
 	struct vm_page *pg;
 	vaddr_t va;
 	struct cpu_info *ci = _info_primary;
 
-	max_len = MAXGDTSIZ;
-	min_len = MINGDTSIZ;
-
-	gdt_size = (MINGDTSIZ / sizeof(gdtstore[0]));
-	gdt_count = NGDT;
-	gdt_next = NGDT;
-	gdt_free = GNULL_SEL;
+	/* Initialize the global values */
+	gdt_size = MINGDTSIZ;
+	memset(_bitmap.busy, 0, sizeof(gdt_bitmap.busy));
+	gdt_bitmap.nslots = NSLOTS(gdt_size);
 
 	old_gdt = gdtstore;
-	gdtstore = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
-	0, UVM_KMF_VAONLY);
-	for (va = (vaddr_t)gdtstore; va < (vaddr_t)gdtstore + min_len;
+
+	/* Allocate MAXGDTSIZ bytes of virtual memory. */
+	gdtstore = (union descriptor *)uvm_km_alloc(kernel_map, MAXGDTSIZ, 0,
+	UVM_KMF_VAONLY);
+
+	/*
+	 * Allocate only MINGDTSIZ bytes of physical memory. We will grow this
+	 * area in gdt_grow at run-time if needed.
+	 */
+	for (va = (vaddr_t)gdtstore; va < (vaddr_t)gdtstore + MINGDTSIZ;
 	va += PAGE_SIZE) {
 		pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO);
 		if (pg == NULL) {
@@ -131,6 +145,8 @@ gdt_init(void)
 		VM_PROT_READ | VM_PROT_WRITE, 0);
 	}
 	pmap_update(pmap_kernel());
+
+	/* Copy the initial bootstrap GDT into the new area. */
 	memcpy(gdtstore, old_gdt, NGDT * sizeof(gdtstore[0]));
 	ci->ci_gdt = gdtstore;
 	setsegment(>ci_gdt[GCPU_SEL].sd, ci,
@@ -153,6 +169,7 @@ gdt_alloc_cpu(struct cpu_info *ci)
 
 	ci->ci_gdt = (union descriptor *)uvm_km_alloc(kernel_map, max_len,
 	0, UVM_KMF_VAONLY);
+
 	for (va = (vaddr_t)ci->ci_gdt; va < (vaddr_t)ci->ci_gdt + min_len;
 	va += PAGE_SIZE) {
 		while ((pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_ZERO))
@@ -163,8 +180,10 @@ gdt_alloc_cpu(struct cpu_info *ci)
 		VM_PROT_READ | VM_PROT_WRITE, 0);
 	}
 	pmap_update(pmap_kernel());
+
 	memset(ci->ci_gdt, 0, min_len);
-	memcpy(ci->ci_gdt, gdtstore, gdt_count * sizeof(gdtstore[0]));
+	memcpy(ci->ci_gdt, gdtstore, gdt_size);
+
 	setsegment(>ci_gdt[GCPU_SEL].sd, ci,
 	sizeof(struct cpu_info) - 1, SDT_MEMRWA, SEL_KPL, 1, 0);
 }
@@ 

CVS commit: src/sys/arch

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 13:36:46 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi sun6i_a31_ccu.c sun8i_h3_ccu.c
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sun6i_a31_gpio.c sun8i_h3_gpio.c sunxi_gpio.c
sunxi_gpio.h

Log Message:
Add basic FDT GPIO support.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun6i_a31_ccu.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sun6i_a31_gpio.c \
src/sys/arch/arm/sunxi/sun8i_h3_gpio.c \
src/sys/arch/arm/sunxi/sunxi_gpio.c src/sys/arch/arm/sunxi/sunxi_gpio.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/SUNXI

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.7 src/sys/arch/arm/sunxi/files.sunxi:1.8
--- src/sys/arch/arm/sunxi/files.sunxi:1.7	Sun Jul  2 00:14:09 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Sun Jul  2 13:36:46 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.7 2017/07/02 00:14:09 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.8 2017/07/02 13:36:46 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -36,6 +36,13 @@ device	sun8ih3ccu: sunxi_ccu
 attach	sun8ih3ccu at fdt with sunxi_h3_ccu
 file	arch/arm/sunxi/sun8i_h3_ccu.c		sunxi_h3_ccu
 
+# GPIO
+device	sunxigpio: gpiobus
+attach	sunxigpio at fdt with sunxi_gpio
+file	arch/arm/sunxi/sunxi_gpio.c		sunxi_gpio
+file	arch/arm/sunxi/sun6i_a31_gpio.c		sunxi_gpio & soc_sun6i_a31
+file	arch/arm/sunxi/sun8i_h3_gpio.c		sunxi_gpio & soc_sun8i_h3
+
 # UART
 attach	com at fdt with sunxi_com
 file	arch/arm/sunxi/sunxi_com.c		sunxi_com needs-flag

Index: src/sys/arch/arm/sunxi/sun6i_a31_ccu.c
diff -u src/sys/arch/arm/sunxi/sun6i_a31_ccu.c:1.1 src/sys/arch/arm/sunxi/sun6i_a31_ccu.c:1.2
--- src/sys/arch/arm/sunxi/sun6i_a31_ccu.c:1.1	Sun Jul  2 00:14:09 2017
+++ src/sys/arch/arm/sunxi/sun6i_a31_ccu.c	Sun Jul  2 13:36:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun6i_a31_ccu.c,v 1.1 2017/07/02 00:14:09 jmcneill Exp $ */
+/* $NetBSD: sun6i_a31_ccu.c,v 1.2 2017/07/02 13:36:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun6i_a31_ccu.c,v 1.1 2017/07/02 00:14:09 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun6i_a31_ccu.c,v 1.2 2017/07/02 13:36:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -208,6 +208,9 @@ static struct sunxi_ccu_clk sun6i_a31_cc
 	SUNXI_CCU_GATE(A31_CLK_AHB1_OHCI2, "ahb1-ohci2", "ahb1",
 	AHB1_GATING_REG0, 31),
 
+	SUNXI_CCU_GATE(A31_CLK_APB1_PIO, "ahb1-pio", "apb1",
+	APB1_GATING_REG, 5),
+
 	SUNXI_CCU_GATE(A31_CLK_APB2_I2C0, "apb2-i2c0", "apb2",
 	APB2_GATING_REG, 0),
 	SUNXI_CCU_GATE(A31_CLK_APB2_I2C1, "apb2-i2c1", "apb2",

Index: src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
diff -u src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.5 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.6
--- src/sys/arch/arm/sunxi/sun8i_h3_ccu.c:1.5	Sat Jul  1 16:25:16 2017
+++ src/sys/arch/arm/sunxi/sun8i_h3_ccu.c	Sun Jul  2 13:36:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i_h3_ccu.c,v 1.5 2017/07/01 16:25:16 jmcneill Exp $ */
+/* $NetBSD: sun8i_h3_ccu.c,v 1.6 2017/07/02 13:36:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.5 2017/07/01 16:25:16 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu.c,v 1.6 2017/07/02 13:36:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun8i_h3_ccu
 #define	AHB1_APB1_CFG_REG	0x054
 #define	APB2_CFG_REG		0x058
 #define	BUS_CLK_GATING_REG0	0x060
+#define	BUS_CLK_GATING_REG2	0x068
 #define	BUS_CLK_GATING_REG3	0x06c
 #define	SDMMC0_CLK_REG		0x088
 #define	SDMMC1_CLK_REG		0x08c
@@ -133,6 +134,7 @@ static struct sunxi_ccu_reset sun8i_h3_c
 
 static const char *ahb1_parents[] = { "losc", "hosc", "axi", "pll_periph0" };
 static const char *ahb2_parents[] = { "ahb1", "pll_periph0" };
+static const char *apb1_parents[] = { "ahb1" };
 static const char *apb2_parents[] = { "losc", "hosc", "pll_periph0" };
 static const char *mod_parents[] = { "hosc", "pll_periph0", "pll_periph1" };
 
@@ -153,6 +155,7 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	__BITS(5,4),	/* div */
 	__BITS(13,12),	/* sel */
 	SUNXI_CCU_PREDIV_POWER_OF_TWO),
+
 	SUNXI_CCU_PREDIV(H3_CLK_AHB2, "ahb2", ahb2_parents,
 	APB2_CFG_REG,	/* reg */
 	0,			/* prediv */
@@ -161,6 +164,12 @@ static struct sunxi_ccu_clk sun8i_h3_ccu
 	__BITS(1,0),	/* sel */
 	SUNXI_CCU_PREDIV_DIVIDE_BY_TWO),
 
+	SUNXI_CCU_DIV(H3_CLK_APB1, "apb1", apb1_parents,
+	AHB1_APB1_CFG_REG,	/* reg */
+	__BITS(9,8),	

CVS commit: src/sys/arch

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 13:36:46 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi sun6i_a31_ccu.c sun8i_h3_ccu.c
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sun6i_a31_gpio.c sun8i_h3_gpio.c sunxi_gpio.c
sunxi_gpio.h

Log Message:
Add basic FDT GPIO support.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sun6i_a31_ccu.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sun6i_a31_gpio.c \
src/sys/arch/arm/sunxi/sun8i_h3_gpio.c \
src/sys/arch/arm/sunxi/sunxi_gpio.c src/sys/arch/arm/sunxi/sunxi_gpio.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sun8i_h3_ccu.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbarm/conf/SUNXI

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



CVS commit: src/sys/arch/arm

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 16:16:44 UTC 2017

Modified Files:
src/sys/arch/arm/arm: syscall.c undefined.c
src/sys/arch/arm/arm32: arm32_boot.c arm32_machdep.c fault.c

Log Message:
Consistency around the user trapframe for all LWPs and there's no need to
keep assigning it in kernel entry points.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/arm/arm/syscall.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/arm/arm/undefined.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/arm32/arm32_boot.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/arm/arm32/fault.c

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



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 10:12:45 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.beagle

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/std.beagle

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.beagle
diff -u src/sys/arch/evbarm/conf/std.beagle:1.13 src/sys/arch/evbarm/conf/std.beagle:1.14
--- src/sys/arch/evbarm/conf/std.beagle:1.13	Sun Aug 24 07:59:22 2014
+++ src/sys/arch/evbarm/conf/std.beagle	Sun Jul  2 10:12:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: std.beagle,v 1.13 2014/08/24 07:59:22 jnemeth Exp $
+#	$NetBSD: std.beagle,v 1.14 2017/07/02 10:12:44 skrll Exp $
 #
 # standard NetBSD/evbarm for BEAGLEBOARD options
 
@@ -12,6 +12,7 @@ include		"arch/evbarm/conf/files.beagle"
 options 	MODULAR
 options 	MODULAR_DEFAULT_AUTOLOAD
 options 	__HAVE_CPU_COUNTER
+options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
 options 	CORTEX_PMC
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	ARM_HAS_VBAR



CVS commit: src/sys/dev/pad

2017-07-02 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jul  2 13:32:51 UTC 2017

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

Log Message:
If a particular pad device is opened, ie pad1 then configure and use pad1
if it is not already configured.

This improves scriptability as you will know the particular pad(4) device
you have opened.

pad(4) devices still have a cloning interface if pad device (minor
number 254) is opened it will attach the next free device.  This action
can be repeated.

XXX update MAKEDEV scripts to make /dev/pad the cloning device.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.40 src/sys/dev/pad/pad.c:1.41
--- src/sys/dev/pad/pad.c:1.40	Sun Jul  2 05:59:27 2017
+++ src/sys/dev/pad/pad.c	Sun Jul  2 13:32:50 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.40 2017/07/02 05:59:27 nat Exp $ */
+/* $NetBSD: pad.c,v 1.41 2017/07/02 13:32:50 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.40 2017/07/02 05:59:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.41 2017/07/02 13:32:50 nat Exp $");
 
 #include 
 #include 
@@ -58,6 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.40
 #include 
 
 #define MAXDEVS		128
+#define PADCLONER	254
 #define PADUNIT(x)	minor(x)
 
 #define PADFREQ		44100
@@ -110,8 +111,11 @@ static stream_filter_t *pad_swvol_filter
 const audio_params_t *, const audio_params_t *);
 static void	pad_swvol_dtor(stream_filter_t *);
 
-static int pad_close(struct file *);
-static int pad_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
+static int pad_close(struct pad_softc *);
+static int pad_read(struct pad_softc *, off_t *, struct uio *, kauth_cred_t, int);
+
+static int fops_pad_close(struct file *);
+static int fops_pad_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
 static int pad_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
 static int pad_ioctl(struct file *, u_long, void *);
 static int pad_kqfilter(struct file *, struct knote *);
@@ -149,11 +153,13 @@ static int	pad_add_block(pad_softc_t *, 
 static int	pad_get_block(pad_softc_t *, pad_block_t *, int);
 
 dev_type_open(pad_open);
+dev_type_close(cdev_pad_close);
+dev_type_read(cdev_pad_read);
 
 const struct cdevsw pad_cdevsw = {
 	.d_open = pad_open,
-	.d_close = noclose,
-	.d_read = noread,
+	.d_close = cdev_pad_close,
+	.d_read = cdev_pad_read,
 	.d_write = nowrite,
 	.d_ioctl = noioctl,
 	.d_stop = nostop,
@@ -166,13 +172,13 @@ const struct cdevsw pad_cdevsw = {
 };
 
 const struct fileops pad_fileops = {
-	.fo_read = pad_read,
+	.fo_read = fops_pad_read,
 	.fo_write = pad_write,
 	.fo_ioctl = pad_ioctl,
 	.fo_fcntl = fnullop_fcntl,
 	.fo_stat = pad_stat,
 	.fo_poll = pad_poll,
-	.fo_close = pad_close,
+	.fo_close = fops_pad_close,
 	.fo_mmap = pad_mmap,
 	.fo_kqfilter = pad_kqfilter,
 	.fo_restart = fnullop_restart
@@ -308,7 +314,7 @@ pad_detach(device_t self, int flags)
 
 	auconv_delete_encodings(sc->sc_encodings);
 
-	return rc;
+	return 0;
 }
 
 int
@@ -320,12 +326,18 @@ pad_open(dev_t dev, int flags, int fmt, 
 	cfdata_t cf;
 	int error, fd, i;
 
-	for (i = 0; i < MAXDEVS; i++) {
-		if (device_lookup(_cd, i) == NULL)
-			break;
+	if (PADUNIT(dev) == PADCLONER) {
+		for (i = 0; i < MAXDEVS; i++) {
+			if (device_lookup(_cd, i) == NULL)
+break;
+		}
+		if (i == MAXDEVS)
+			return ENXIO;
+	} else {
+		if (PADUNIT(dev) >= MAXDEVS)
+			return ENXIO;
+		i = PADUNIT(dev);
 	}
-	if (i == MAXDEVS)
-		return ENXIO;
 
 	cf = kmem_alloc(sizeof(struct cfdata), KM_SLEEP);
 	cf->cf_name = pad_cd.cd_name;
@@ -333,18 +345,27 @@ pad_open(dev_t dev, int flags, int fmt, 
 	cf->cf_unit = i;
 	cf->cf_fstate = FSTATE_STAR;
 
-	paddev = config_attach_pseudo(cf);
+	if (device_lookup(_cd, minor(dev)) == NULL)
+		paddev = config_attach_pseudo(cf);
+	else
+		paddev = device_lookup(_cd, minor(dev));
+
 	sc = device_private(paddev);
-	sc->sc_dev = paddev;
-	sc->sc_dying = false;
+	if (sc == NULL)
+		return ENXIO;
 
 	if (sc->sc_open == 1)
 		return EBUSY;
 
-	error = fd_allocfile(, );
-	if (error) {
-		config_detach(sc->sc_dev, 0);
-		return error;
+	sc->sc_dev = paddev;
+	sc->sc_dying = false;
+
+	if (PADUNIT(dev) == PADCLONER) {
+		error = fd_allocfile(, );
+		if (error) {
+			config_detach(sc->sc_dev, 0);
+			return error;
+		}
 	}
 
 	if (auconv_create_encodings(pad_formats, PAD_NFORMATS,
@@ -366,28 +387,47 @@ pad_open(dev_t dev, int flags, int fmt, 
 	if (!pmf_device_register(sc->sc_dev, NULL, NULL))
 		aprint_error_dev(sc->sc_dev, "couldn't establish power handler\n");
 
-	error = fd_clone(fp, fd, flags, _fileops, sc);
-	KASSERT(error == EMOVEFD);
-	
+	if (PADUNIT(dev) == PADCLONER) {
+		error = fd_clone(fp, fd, flags, 

CVS commit: src/sys/dev/pad

2017-07-02 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jul  2 13:32:51 UTC 2017

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

Log Message:
If a particular pad device is opened, ie pad1 then configure and use pad1
if it is not already configured.

This improves scriptability as you will know the particular pad(4) device
you have opened.

pad(4) devices still have a cloning interface if pad device (minor
number 254) is opened it will attach the next free device.  This action
can be repeated.

XXX update MAKEDEV scripts to make /dev/pad the cloning device.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/arch/m68k/include

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:23 UTC 2017

Modified Files:
src/sys/arch/m68k/include: cpuframe.h

Log Message:
remove f_pad, conflicts with new  define.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/cpuframe.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/m68k/include/cpuframe.h
diff -u src/sys/arch/m68k/include/cpuframe.h:1.5 src/sys/arch/m68k/include/cpuframe.h:1.6
--- src/sys/arch/m68k/include/cpuframe.h:1.5	Tue Feb  8 15:20:16 2011
+++ src/sys/arch/m68k/include/cpuframe.h	Sun Jul  2 10:10:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuframe.h,v 1.5 2011/02/08 20:20:16 rmind Exp $	*/
+/*	$NetBSD: cpuframe.h,v 1.6 2017/07/02 14:10:23 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -128,7 +128,6 @@ struct frame {
 };
 
 #define	f_regs		F_t.tf_regs
-#define	f_pad		F_t.tf_pad
 #define	f_stackadj	F_t.tf_stackadj
 #define	f_sr		F_t.tf_sr
 #define	f_pc		F_t.tf_pc



CVS commit: src/sys/arch/m68k/include

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:23 UTC 2017

Modified Files:
src/sys/arch/m68k/include: cpuframe.h

Log Message:
remove f_pad, conflicts with new  define.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/m68k/include/cpuframe.h

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



CVS commit: src

2017-07-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jul  2 16:41:33 UTC 2017

Modified Files:
src/lib/libpthread: TODO pthread.c pthread_attr.c
pthread_attr_getguardsize.3 pthread_int.h
src/sys/kern: exec_subr.c
src/sys/uvm: uvm_meter.c uvm_param.h
src/tests/lib/libpthread: t_join.c

Log Message:
Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libpthread/TODO
cvs rdiff -u -r1.147 -r1.148 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libpthread/pthread_attr.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libpthread/pthread_attr_getguardsize.3
cvs rdiff -u -r1.93 -r1.94 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/exec_subr.c
cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.36 -r1.37 src/sys/uvm/uvm_param.h
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libpthread/t_join.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/libpthread/TODO
diff -u src/lib/libpthread/TODO:1.18 src/lib/libpthread/TODO:1.19
--- src/lib/libpthread/TODO:1.18	Wed Feb  8 03:44:41 2017
+++ src/lib/libpthread/TODO	Sun Jul  2 16:41:32 2017
@@ -1,13 +1,9 @@
-$NetBSD: TODO,v 1.18 2017/02/08 03:44:41 kamil Exp $
+$NetBSD: TODO,v 1.19 2017/07/02 16:41:32 joerg Exp $
 
 Interfaces/features to implement:
 
 - Realtime extensions: priority inheritance.
 
-- Allow threads to change their stack size.
-
-- Allow threads to modify the red zone size; cf. pthread_attr_setguardsize(3).
-
 - Keep a pool of dead LWPs so that we do not have take the full hit of
   _lwp_create() every time pthread_create() is called.
 

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.147 src/lib/libpthread/pthread.c:1.148
--- src/lib/libpthread/pthread.c:1.147	Fri May 29 16:05:13 2015
+++ src/lib/libpthread/pthread.c	Sun Jul  2 16:41:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.147 2015/05/29 16:05:13 christos Exp $	*/
+/*	$NetBSD: pthread.c,v 1.148 2017/07/02 16:41:32 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.147 2015/05/29 16:05:13 christos Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.148 2017/07/02 16:41:32 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -40,7 +40,9 @@ __RCSID("$NetBSD: pthread.c,v 1.147 2015
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -115,6 +117,7 @@ int pthread__dbg;	/* set by libpthread_d
  * stack pointer to thread data afterwards.
  */
 size_t	pthread__stacksize;
+size_t	pthread__guardsize;
 size_t	pthread__pagesize;
 static struct __pthread_st *pthread__main;
 static size_t __pthread_st_size;
@@ -164,6 +167,9 @@ pthread__init(void)
 	pthread_t first;
 	char *p;
 	int i;
+	int mib[2];
+	unsigned int value;
+	size_t len;
 	extern int __isthreaded;
 
 	/*
@@ -182,6 +188,14 @@ pthread__init(void)
 	pthread__pagesize = (size_t)sysconf(_SC_PAGESIZE);
 	pthread__concurrency = (int)sysconf(_SC_NPROCESSORS_CONF);
 
+	mib[0] = CTL_VM;
+	mib[1] = VM_THREAD_GUARD_SIZE;
+	len = sizeof(value);
+	if (sysctl(mib, __arraycount(mib), , , NULL, 0) == 0)
+		pthread__guardsize = value;
+	else
+		pthread__guardsize = pthread__pagesize;
+
 	/* Initialize locks first; they're needed elsewhere. */
 	pthread__lockprim_init();
 	for (i = 0; i < NHASHLOCK; i++) {
@@ -335,16 +349,19 @@ pthread__getstack(pthread_t newthread, c
 
 	if (attr != NULL) {
 		pthread_attr_getstack(attr, , );
+		pthread_attr_getguardsize(attr, );
 	} else {
 		stackbase = NULL;
 		stacksize = 0;
+		guardsize = pthread__guardsize;
 	}
 	if (stacksize == 0)
 		stacksize = pthread__stacksize;
 
 	if (newthread->pt_stack_allocated) {
 		if (stackbase == NULL &&
-		newthread->pt_stack.ss_size == stacksize)
+		newthread->pt_stack.ss_size == stacksize &&
+		newthread->pt_guardsize == guardsize)
 			return 0;
 		stackbase2 = newthread->pt_stack.ss_sp;
 #ifndef __MACHINE_STACK_GROWS_UP
@@ -362,14 +379,13 @@ pthread__getstack(pthread_t newthread, c
 
 	if (stackbase == NULL) {
 		stacksize = ((stacksize - 1) | (pthread__pagesize - 1)) + 1;
-		guardsize = pthread__pagesize;
+		guardsize = ((guardsize - 1) | (pthread__pagesize - 1)) + 1;
 		stackbase = mmap(NULL, stacksize + guardsize,
 		PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, (off_t)0);
 		if (stackbase == MAP_FAILED)
 			return ENOMEM;
 		allocated = true;
 	} else {
-		guardsize = 0;
 		allocated = false;
 	}
 #ifdef __MACHINE_STACK_GROWS_UP
@@ -1280,7 +1296,9 @@ pthread__initmainstack(void)
 {
 	struct rlimit slimit;
 	const AuxInfo *aux;
-	size_t 

CVS commit: src

2017-07-02 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Jul  2 16:41:33 UTC 2017

Modified Files:
src/lib/libpthread: TODO pthread.c pthread_attr.c
pthread_attr_getguardsize.3 pthread_int.h
src/sys/kern: exec_subr.c
src/sys/uvm: uvm_meter.c uvm_param.h
src/tests/lib/libpthread: t_join.c

Log Message:
Export the guard size of the main thread via vm.guard_size. Add a
complementary writable sysctl for the initial guard size of threads
created via pthread_create. Let the existing attribut accessors do the
right thing. Raise the default guard size for threads to 64KB.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/lib/libpthread/TODO
cvs rdiff -u -r1.147 -r1.148 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.16 -r1.17 src/lib/libpthread/pthread_attr.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libpthread/pthread_attr_getguardsize.3
cvs rdiff -u -r1.93 -r1.94 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/exec_subr.c
cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.36 -r1.37 src/sys/uvm/uvm_param.h
cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libpthread/t_join.c

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



CVS commit: src/sys/arch

2017-07-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Jul  2 11:21:14 UTC 2017

Modified Files:
src/sys/arch/amd64/amd64: gdt.c
src/sys/arch/i386/i386: gdt.c

Log Message:
Put some ()s in the macro (kre).


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/gdt.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/i386/i386/gdt.c

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



CVS commit: src/sys/arch/amiga/amiga

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:53 UTC 2017

Modified Files:
src/sys/arch/amiga/amiga: trap.c

Log Message:
remove the single use of f_pad...


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/amiga/amiga/trap.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/amiga/amiga/trap.c
diff -u src/sys/arch/amiga/amiga/trap.c:1.135 src/sys/arch/amiga/amiga/trap.c:1.136
--- src/sys/arch/amiga/amiga/trap.c:1.135	Wed Mar  4 14:56:24 2015
+++ src/sys/arch/amiga/amiga/trap.c	Sun Jul  2 10:10:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.135 2015/03/04 19:56:24 mlelstv Exp $	*/
+/*	$NetBSD: trap.c,v 1.136 2017/07/02 14:10:53 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.135 2015/03/04 19:56:24 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.136 2017/07/02 14:10:53 christos Exp $");
 
 #include 
 #include 
@@ -538,8 +538,8 @@ trap(struct frame *fp, int type, u_int c
 #endif
 #ifdef DEBUG
 	if (mmudebug & 2)
-	printf("trap: t %x c %x v %x pad %x adj %x sr %x pc %x fmt %x vc %x\n",
-	type, code, v, fp->f_pad, fp->f_stackadj, fp->f_sr,
+	printf("%s: t %x c %x v %x adj %x sr %x pc %x fmt %x vc %x\n",
+	__func__, type, code, v, fp->f_stackadj, fp->f_sr,
 	fp->f_pc, fp->f_format, fp->f_vector);
 #endif
 	switch (type) {



CVS commit: src/sys/arch/amiga/amiga

2017-07-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jul  2 14:10:53 UTC 2017

Modified Files:
src/sys/arch/amiga/amiga: trap.c

Log Message:
remove the single use of f_pad...


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/amiga/amiga/trap.c

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



CVS commit: src/sys/arch/arm

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 16:06:42 UTC 2017

Modified Files:
src/sys/arch/arm/arm: syscall.c
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/arm/arm/syscall.c
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/arm/arm32/arm32_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/arm/arm/syscall.c
diff -u src/sys/arch/arm/arm/syscall.c:1.60 src/sys/arch/arm/arm/syscall.c:1.61
--- src/sys/arch/arm/arm/syscall.c:1.60	Wed Aug 13 21:41:32 2014
+++ src/sys/arch/arm/arm/syscall.c	Sun Jul  2 16:06:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.60 2014/08/13 21:41:32 matt Exp $	*/
+/*	$NetBSD: syscall.c,v 1.61 2017/07/02 16:06:42 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.60 2014/08/13 21:41:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.61 2017/07/02 16:06:42 skrll Exp $");
 
 #include 
 #include 
@@ -103,7 +103,7 @@ swi_handler(trapframe_t *tf)
 	/*
 	 * Enable interrupts if they were enabled before the exception.
 	 * Since all syscalls *should* come from user mode it will always
-	 * be safe to enable them, but check anyway. 
+	 * be safe to enable them, but check anyway.
 	 */
 #ifdef acorn26
 	if ((tf->tf_r15 & R15_IRQ_DISABLE) == 0)
@@ -225,7 +225,7 @@ syscall(struct trapframe *tf, lwp_t *l, 
 		ksi.ksi_signo = SIGILL;
 		ksi.ksi_code = ILL_ILLTRP;
 #ifdef THUMB_CODE
-		if (tf->tf_spsr & PSR_T_bit) 
+		if (tf->tf_spsr & PSR_T_bit)
 			ksi.ksi_addr = (void *)(tf->tf_pc - THUMB_INSN_SIZE);
 		else
 #endif

Index: src/sys/arch/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.112 src/sys/arch/arm/arm32/arm32_machdep.c:1.113
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.112	Sat Jul 16 01:49:42 2016
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Sun Jul  2 16:06:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.112 2016/07/16 01:49:42 mrg Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.113 2017/07/02 16:06:42 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.112 2016/07/16 01:49:42 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.113 2017/07/02 16:06:42 skrll Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -251,7 +251,7 @@ bootsync(void)
 /*
  * void cpu_startup(void)
  *
- * Machine dependent startup code. 
+ * Machine dependent startup code.
  *
  */
 void



CVS commit: src/sys/arch/arm

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 16:06:42 UTC 2017

Modified Files:
src/sys/arch/arm/arm: syscall.c
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/arm/arm/syscall.c
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/arm/arm32/arm32_machdep.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:39:05 UTC 2017

Added Files:
src/sys/arch/evbarm/conf: SUNXI_INSTALL

Log Message:
Add SUNXI_INSTALL kernel.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/SUNXI_INSTALL

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

Added files:

Index: src/sys/arch/evbarm/conf/SUNXI_INSTALL
diff -u /dev/null src/sys/arch/evbarm/conf/SUNXI_INSTALL:1.1
--- /dev/null	Sun Jul  2 22:39:05 2017
+++ src/sys/arch/evbarm/conf/SUNXI_INSTALL	Sun Jul  2 22:39:05 2017
@@ -0,0 +1,10 @@
+#	$NetBSD: SUNXI_INSTALL,v 1.1 2017/07/02 22:39:05 jmcneill Exp $
+#
+#   SUNXI_INSTALL -- Allwinner SUNXI kernel with
+#	installation-sized ramdisk
+#
+
+include "arch/evbarm/conf/SUNXI"
+include "arch/evbarm/conf/INSTALL"
+
+options 	BOOTHOWTO=RB_SINGLE



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:39:05 UTC 2017

Added Files:
src/sys/arch/evbarm/conf: SUNXI_INSTALL

Log Message:
Add SUNXI_INSTALL kernel.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/SUNXI_INSTALL

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



CVS commit: src/sys/dev/ofw

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  3 00:47:34 UTC 2017

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
Add of_match_compat_data.

This routine searches an array of compat_data structures for a
matching "compatible" entry matching the supplied OFW node.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ofw/openfirm.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/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.29 src/sys/dev/ofw/ofw_subr.c:1.30
--- src/sys/dev/ofw/ofw_subr.c:1.29	Fri Jun 30 09:17:05 2017
+++ src/sys/dev/ofw/ofw_subr.c	Mon Jul  3 00:47:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.29 2017/06/30 09:17:05 jmcneill Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.30 2017/07/03 00:47:34 jmcneill Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.29 2017/06/30 09:17:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.30 2017/07/03 00:47:34 jmcneill Exp $");
 
 #include 
 #include 
@@ -186,6 +186,43 @@ of_match_compatible(int phandle, const c
 }
 
 /*
+ * int of_match_compat_data(phandle, compat_data)
+ *
+ * This routine searches an array of compat_data structures for a
+ * matching "compatible" entry matching the supplied OFW node.
+ *
+ * It should be used when determining whether a driver can drive
+ * a particular device.
+ *
+ * Arguments:
+ *	phandle		OFW phandle of device to be checked for
+ *			compatibility.
+ *	compat_data	Array of possible compat entry strings and
+ *			associated metadata. The last entry in the
+ *			list should have a "compat" of NULL to terminate
+ *			the list.
+ *
+ * Return Value:
+ *	0 if none of the strings are found in phandle's "compatibility"
+ *	property, or a positive number based on the reverse index of the
+ *	matching string in the phandle's "compatibility" property, plus 1.
+ *
+ * Side Effects:
+ *	None.
+ */
+int
+of_match_compat_data(int phandle, const struct of_compat_data *compat_data)
+{
+	for (; compat_data->compat != NULL; compat_data++) {
+		const char *compat[] = { compat_data->compat, NULL };
+		const int match = of_match_compatible(phandle, compat);
+		if (match)
+			return match;
+	}
+	return 0;
+}
+
+/*
  * const struct of_compat_data *of_search_compatible(phandle, compat_data)
  *
  * This routine searches an array of compat_data structures for a

Index: src/sys/dev/ofw/openfirm.h
diff -u src/sys/dev/ofw/openfirm.h:1.35 src/sys/dev/ofw/openfirm.h:1.36
--- src/sys/dev/ofw/openfirm.h:1.35	Fri Jun 30 09:17:05 2017
+++ src/sys/dev/ofw/openfirm.h	Mon Jul  3 00:47:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.35 2017/06/30 09:17:05 jmcneill Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.36 2017/07/03 00:47:34 jmcneill Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -110,6 +110,7 @@ int	openfirmware(void *);
  */
 int	of_compatible(int, const char * const *);
 int	of_match_compatible(int, const char * const *);
+int	of_match_compat_data(int, const struct of_compat_data *);
 const struct of_compat_data *
 	of_search_compatible(int, const struct of_compat_data *);
 int	of_decode_int(const unsigned char *);



CVS commit: src/sys/dev/ofw

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  3 00:47:34 UTC 2017

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
Add of_match_compat_data.

This routine searches an array of compat_data structures for a
matching "compatible" entry matching the supplied OFW node.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ofw/openfirm.h

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



CVS commit: src/sys/kern

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 02:12:47 UTC 2017

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

Log Message:
Add cv_timedwaitbt, cv_timedwaitbt_sig.

Takes struct bintime maximum delay, and decrements it in place so
that you can use it in a loop in case of spurious wakeup.

Discussed on tech-kern a couple years ago:

https://mail-index.netbsd.org/tech-kern/2015/03/23/msg018557.html

Added a parameter for expressing desired precision -- not currently
interpreted, but intended for a future tickless kernel with a choice
of high-resolution timers.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/kern_condvar.c

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



CVS commit: src/sys/kern

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 02:12:47 UTC 2017

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

Log Message:
Add cv_timedwaitbt, cv_timedwaitbt_sig.

Takes struct bintime maximum delay, and decrements it in place so
that you can use it in a loop in case of spurious wakeup.

Discussed on tech-kern a couple years ago:

https://mail-index.netbsd.org/tech-kern/2015/03/23/msg018557.html

Added a parameter for expressing desired precision -- not currently
interpreted, but intended for a future tickless kernel with a choice
of high-resolution timers.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/kern_condvar.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_condvar.c
diff -u src/sys/kern/kern_condvar.c:1.36 src/sys/kern/kern_condvar.c:1.37
--- src/sys/kern/kern_condvar.c:1.36	Thu Jun  8 01:09:52 2017
+++ src/sys/kern/kern_condvar.c	Mon Jul  3 02:12:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_condvar.c,v 1.36 2017/06/08 01:09:52 chs Exp $	*/
+/*	$NetBSD: kern_condvar.c,v 1.37 2017/07/03 02:12:47 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.36 2017/06/08 01:09:52 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.37 2017/07/03 02:12:47 riastradh Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_condvar
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Accessors for the private contents of the kcondvar_t data type.
@@ -319,6 +320,148 @@ cv_timedwait_sig(kcondvar_t *cv, kmutex_
 }
 
 /*
+ * Given a number of seconds, sec, and 2^64ths of a second, frac, we
+ * want a number of ticks for a timeout:
+ *
+ *	timo = hz*(sec + frac/2^64)
+ *	 = hz*sec + hz*frac/2^64
+ *	 = hz*sec + hz*(frachi*2^32 + fraclo)/2^64
+ *	 = hz*sec + hz*frachi/2^32 + hz*fraclo/2^64,
+ *
+ * where frachi is the high 32 bits of frac and fraclo is the
+ * low 32 bits.
+ *
+ * We assume hz < INT_MAX/2 < UINT32_MAX, so
+ *
+ *	hz*fraclo/2^64 < fraclo*2^32/2^64 <= 1,
+ *
+ * since fraclo < 2^32.
+ *
+ * We clamp the result at INT_MAX/2 for a timeout in ticks, since we
+ * can't represent timeouts higher than INT_MAX in cv_timedwait, and
+ * spurious wakeup is OK.  Moreover, we don't want to wrap around,
+ * because we compute end - start in ticks in order to compute the
+ * remaining timeout, and that difference cannot wrap around, so we use
+ * a timeout less than INT_MAX.  Using INT_MAX/2 provides plenty of
+ * margin for paranoia and will exceed most waits in practice by far.
+ */
+static unsigned
+bintime2timo(const struct bintime *bt)
+{
+
+	KASSERT(hz < INT_MAX/2);
+	CTASSERT(INT_MAX/2 < UINT32_MAX);
+	if (bt->sec > ((INT_MAX/2)/hz))
+		return INT_MAX/2;
+	if ((hz*(bt->frac >> 32) >> 32) > (INT_MAX/2 - hz*bt->sec))
+		return INT_MAX/2;
+
+	return hz*bt->sec + (hz*(bt->frac >> 32) >> 32);
+}
+
+/*
+ * timo is in units of ticks.  We want units of seconds and 2^64ths of
+ * a second.  We know hz = 1 sec/tick, and 2^64 = 1 sec/(2^64th of a
+ * second), from which we can conclude 2^64 / hz = 1 (2^64th of a
+ * second)/tick.  So for the fractional part, we compute
+ *
+ *	frac = rem * 2^64 / hz
+ *	 = ((rem * 2^32) / hz) * 2^32
+ *
+ * Using truncating integer division instead of real division will
+ * leave us with only about 32 bits of precision, which means about
+ * 1/4-nanosecond resolution, which is good enough for our purposes.
+ */
+static struct bintime
+timo2bintime(unsigned timo)
+{
+
+	return (struct bintime) {
+		.sec = timo / hz,
+		.frac = (((uint64_t)(timo % hz) << 32)/hz << 32),
+	};
+}
+
+/*
+ * cv_timedwaitbt:
+ *
+ *	Wait on a condition variable until awoken or the specified
+ *	timeout expires.  Returns zero if awoken normally or
+ *	EWOULDBLOCK if the timeout expires.
+ *
+ *	On entry, bt is a timeout in bintime.  cv_timedwaitbt subtracts
+ *	the time slept, so on exit, bt is the time remaining after
+ *	sleeping.  No infinite timeout; use cv_wait_sig instead.
+ *
+ *	epsilon is a requested maximum error in timeout (excluding
+ *	spurious wakeups).  Currently not used, will be used in the
+ *	future to choose between low- and high-resolution timers.
+ */
+int
+cv_timedwaitbt(kcondvar_t *cv, kmutex_t *mtx, struct bintime *bt,
+const struct bintime *epsilon __unused)
+{
+	struct bintime slept;
+	unsigned start, end;
+	int error;
+
+	/*
+	 * hardclock_ticks is technically int, but nothing special
+	 * happens instead of overflow, so we assume two's-complement
+	 * wraparound and just treat it as unsigned.
+	 */
+	start = hardclock_ticks;
+	error = cv_timedwait(cv, mtx, bintime2timo(bt));
+	end = hardclock_ticks;
+
+	slept = timo2bintime(end - start);
+	/* bt := bt - slept */
+	bintime_sub(bt, );
+
+	return error;
+}
+
+/*
+ * cv_timedwaitbt_sig:
+ *
+ *	

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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:27:45 UTC 2017

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

Log Message:
No need to explicitly set pinctrl config 0 now


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_i2c.c

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.12 src/sys/arch/arm/samsung/exynos_i2c.c:1.13
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.12	Sun Jun 11 00:54:26 2017
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Sun Jul  2 18:27:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.12 2017/06/11 00:54:26 jmcneill Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.13 2017/07/02 18:27:45 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.12 2017/06/11 00:54:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.13 2017/07/02 18:27:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -177,8 +177,6 @@ exynos_i2c_attach(device_t parent, devic
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 	
-	fdtbus_pinctrl_set_config_index(phandle, 0);
-
 	sc->sc_ic.ic_cookie = sc;
 	sc->sc_ic.ic_acquire_bus = exynos_i2c_acquire_bus;
 	sc->sc_ic.ic_release_bus = exynos_i2c_release_bus;



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:27:45 UTC 2017

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

Log Message:
No need to explicitly set pinctrl config 0 now


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos_i2c.c

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



CVS commit: src/sys/kern

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 00:53:33 UTC 2017

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

Log Message:
Nix trailing whitespace.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/kern/kern_event.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_event.c
diff -u src/sys/kern/kern_event.c:1.92 src/sys/kern/kern_event.c:1.93
--- src/sys/kern/kern_event.c:1.92	Sat Jul  1 20:08:56 2017
+++ src/sys/kern/kern_event.c	Mon Jul  3 00:53:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_event.c,v 1.92 2017/07/01 20:08:56 christos Exp $	*/
+/*	$NetBSD: kern_event.c,v 1.93 2017/07/03 00:53:33 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.92 2017/07/01 20:08:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.93 2017/07/03 00:53:33 riastradh Exp $");
 
 #include 
 #include 
@@ -141,7 +141,7 @@ extern const struct filterops sig_filtop
  * These should be listed in the numeric order of the EVFILT_* defines.
  * If filtops is NULL, the filter isn't implemented in NetBSD.
  * End of list is when name is NULL.
- * 
+ *
  * Note that 'refcnt' is meaningless for built-in filters.
  */
 struct kfilter {
@@ -1020,7 +1020,6 @@ kqueue_register(struct kqueue *kq, struc
 			KERNEL_UNLOCK_ONE(NULL);	/* XXXSMP */
 			if (error != 0) {
 #ifdef DIAGNOSTIC
-
 printf("%s: event type %d not supported for "
 "file type %d (error %d)\n", __func__,
 kn->kn_filter, kn->kn_obj ?
@@ -1181,7 +1180,7 @@ kqueue_scan(file_t *fp, size_t maxevents
 	} else {
 		/* no timeout, wait forever */
 		timeout = 0;
-	}	
+	}
 
 	memset(, 0, sizeof(morker));
 	marker = 
@@ -1614,7 +1613,7 @@ again:
 	mutex_spin_exit(>kq_lock);
 
 	mutex_exit(>fd_lock);
-	if (kn->kn_fop->f_isfd)		
+	if (kn->kn_fop->f_isfd)
 		fd_putfile(kn->kn_id);
 	atomic_dec_uint(>kn_kfilter->refcnt);
 	kmem_free(kn, sizeof(*kn));



CVS commit: src/sys/arch

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:06:45 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_rsb.c sunxi_rsb.h

Log Message:
Add P2WI/RSB driver, based on awin_p2wi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_rsb.c \
src/sys/arch/arm/sunxi/sunxi_rsb.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/SUNXI

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.8 src/sys/arch/arm/sunxi/files.sunxi:1.9
--- src/sys/arch/arm/sunxi/files.sunxi:1.8	Sun Jul  2 13:36:46 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Sun Jul  2 18:06:45 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.8 2017/07/02 13:36:46 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.9 2017/07/02 18:06:45 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -70,6 +70,11 @@ device	sunxitwi: i2cbus, i2cexec, mvi2c
 attach	sunxitwi at fdt with sunxi_twi
 file	arch/arm/sunxi/sunxi_twi.c		sunxi_twi
 
+# P2WI/RSB
+device	sunxirsb: i2cbus, i2cexec
+attach	sunxirsb at fdt with sunxi_rsb
+file	arch/arm/sunxi/sunxi_rsb.c		sunxi_rsb
+
 # RTC
 device	sunxirtc
 attach	sunxirtc at fdt with sunxi_rtc

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.9 src/sys/arch/evbarm/conf/SUNXI:1.10
--- src/sys/arch/evbarm/conf/SUNXI:1.9	Sun Jul  2 13:36:46 2017
+++ src/sys/arch/evbarm/conf/SUNXI	Sun Jul  2 18:06:45 2017
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.9 2017/07/02 13:36:46 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.10 2017/07/02 18:06:45 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -97,7 +97,8 @@ options 	COM_AWIN		# XXX this should be 
 # I2C
 sunxitwi*	at fdt?			# TWI
 options 	GTTWSI_ALLWINNER	# XXX this should be a driver flag
-iic*		at sunxitwi?
+sunxirsb*	at fdt?			# P2WI/RSB
+iic*		at i2cbus?
 
 # RTC
 sunxirtc*	at fdt?			# RTC

Added files:

Index: src/sys/arch/arm/sunxi/sunxi_rsb.c
diff -u /dev/null src/sys/arch/arm/sunxi/sunxi_rsb.c:1.1
--- /dev/null	Sun Jul  2 18:06:45 2017
+++ src/sys/arch/arm/sunxi/sunxi_rsb.c	Sun Jul  2 18:06:45 2017
@@ -0,0 +1,479 @@
+/* $NetBSD: sunxi_rsb.c,v 1.1 2017/07/02 18:06:45 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2014-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_rsb.c,v 1.1 2017/07/02 18:06:45 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+enum sunxi_rsb_type {
+	SUNXI_P2WI,
+	SUNXI_RSB,
+};
+
+static const struct of_compat_data compat_data[] = {
+	{ "allwinner,sun6i-a31-p2wi",	SUNXI_P2WI },
+	{ "allwinner,sun8i-a23-rsb",	SUNXI_RSB },
+	{ NULL }
+};
+
+#define RSB_ADDR_PMIC_PRIMARY	0x3a3
+#define RSB_ADDR_PMIC_SECONDARY	0x745
+#define RSB_ADDR_PERIPH_IC	0xe89
+
+/*
+ * Device address to Run-time address mappings.
+ *
+ * Run-time address (RTA) is an 8-bit value used to address the device during
+ * a read or write transaction. The following are valid RTAs:
+ *  0x17 0x2d 0x3a 0x4e 0x59 0x63 0x74 0x8b 0x9c 0xa6 0xb1 0xc5 0xd2 0xe8 0xff
+ *
+ * Allwinner uses RTA 0x2d for the primary PMIC, 0x3a for the secondary PMIC,
+ * and 0x4e for the peripheral IC (where applicable).
+ */
+static const struct {
+	uint16_taddr;
+	uint8_t rta;
+} rsb_rtamap[] = {
+	{ .addr = RSB_ADDR_PMIC_PRIMARY,	.rta = 0x2d },
+	{ .addr = 

CVS commit: src/sys/arch

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:06:45 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi
src/sys/arch/evbarm/conf: SUNXI
Added Files:
src/sys/arch/arm/sunxi: sunxi_rsb.c sunxi_rsb.h

Log Message:
Add P2WI/RSB driver, based on awin_p2wi.c.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sunxi/sunxi_rsb.c \
src/sys/arch/arm/sunxi/sunxi_rsb.h
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/conf/SUNXI

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:21:52 UTC 2017

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

Log Message:
Configure pin defaults at attach


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_pinctrl.c

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

Modified files:

Index: src/sys/arch/arm/samsung/exynos_pinctrl.c
diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.12
--- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.11	Sun Jul  2 16:19:46 2017
+++ src/sys/arch/arm/samsung/exynos_pinctrl.c	Sun Jul  2 18:21:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $ */
+/*	$NetBSD: exynos_pinctrl.c,v 1.12 2017/07/02 18:21:52 jmcneill Exp $ */
 
 /*-
 * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.11 2017/07/02 16:19:46 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.12 2017/07/02 18:21:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -131,6 +131,8 @@ exynos_pinctrl_attach(device_t parent, d
 		   _pinctrl_controller_func);
 		}
 	}
+
+	fdtbus_pinctrl_configure();
 }
 
 static void



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 18:22:29 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.exynos

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/std.exynos

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.exynos
diff -u src/sys/arch/evbarm/conf/std.exynos:1.3 src/sys/arch/evbarm/conf/std.exynos:1.4
--- src/sys/arch/evbarm/conf/std.exynos:1.3	Sun Jun 11 00:03:29 2017
+++ src/sys/arch/evbarm/conf/std.exynos	Sun Jul  2 18:22:29 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: std.exynos,v 1.3 2017/06/11 00:03:29 jmcneill Exp $
+#	$NetBSD: std.exynos,v 1.4 2017/07/02 18:22:29 skrll Exp $
 #
 
 machine	evbarm arm
@@ -15,6 +15,7 @@ options 	FDT# Flattened Device Tree 
 options 	MODULAR
 options 	MODULAR_DEFAULT_AUTOLOAD
 options 	__HAVE_CPU_COUNTER
+options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	ARM_HAS_VBAR
 #options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS



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

2017-07-02 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jul  2 18:22:29 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.exynos

Log Message:
Define __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/std.exynos

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:21:52 UTC 2017

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

Log Message:
Configure pin defaults at attach


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_pinctrl.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  3 00:51:44 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.sunxi

Log Message:
Add options __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/std.sunxi

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.sunxi
diff -u src/sys/arch/evbarm/conf/std.sunxi:1.1 src/sys/arch/evbarm/conf/std.sunxi:1.2
--- src/sys/arch/evbarm/conf/std.sunxi:1.1	Wed Jun 28 23:51:29 2017
+++ src/sys/arch/evbarm/conf/std.sunxi	Mon Jul  3 00:51:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: std.sunxi,v 1.1 2017/06/28 23:51:29 jmcneill Exp $
+#	$NetBSD: std.sunxi,v 1.2 2017/07/03 00:51:44 jmcneill Exp $
 #
 
 machine	evbarm arm
@@ -11,6 +11,7 @@ options 	MODULAR
 options 	MODULAR_DEFAULT_AUTOLOAD
 options 	__HAVE_CPU_COUNTER
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
+options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
 options 	ARM_HAS_VBAR
 #options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 #options 	PMAP_NEED_ALLOC_POOLPAGE



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Jul  3 00:51:44 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: std.sunxi

Log Message:
Add options __HAVE_CPU_UAREA_ALLOC_IDLELWP


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/std.sunxi

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



CVS commit: src/sys/kern

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 00:53:33 UTC 2017

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

Log Message:
Nix trailing whitespace.  No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/kern/kern_event.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 21:13:06 UTC 2017

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

Log Message:
Fix some register definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_gpio.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/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.3 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.3	Sun Jul  2 18:19:26 2017
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Sun Jul  2 21:13:06 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.3 2017/07/02 18:19:26 jmcneill Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.4 2017/07/02 21:13:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.3 2017/07/02 18:19:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.4 2017/07/02 21:13:06 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,17 +44,17 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c
 
 #include 
 
-#define	SUNXI_GPIO_PORT(port)		(0x20 * (port))
-#define SUNXI_GPIO_CFG(port, pin)	(SUNXI_GPIO_PORT(port) + (0x4 * ((pin) / 8)))
+#define	SUNXI_GPIO_PORT(port)		(0x24 * (port))
+#define SUNXI_GPIO_CFG(port, pin)	(SUNXI_GPIO_PORT(port) + 0x00 + (0x4 * ((pin) / 8)))
 #define  SUNXI_GPIO_CFG_PINMASK(pin)	(0x7 << (((pin) % 8) * 4))
 #define	SUNXI_GPIO_DATA(port)		(SUNXI_GPIO_PORT(port) + 0x10)
 #define	SUNXI_GPIO_DRV(port, pin)	(SUNXI_GPIO_PORT(port) + 0x14 + (0x4 * ((pin) / 16)))
-#define  SUNXI_GPIO_DRV_PINMASK(pin)	(0x3 << (((pin) % 16) * 4))
+#define  SUNXI_GPIO_DRV_PINMASK(pin)	(0x3 << (((pin) % 16) * 2))
 #define	SUNXI_GPIO_PULL(port, pin)	(SUNXI_GPIO_PORT(port) + 0x1c + (0x4 * ((pin) / 16)))
 #define	 SUNXI_GPIO_PULL_DISABLE	0
 #define	 SUNXI_GPIO_PULL_UP		1
 #define	 SUNXI_GPIO_PULL_DOWN		2
-#define  SUNXI_GPIO_PULL_PINMASK(pin)	(0x3 << (((pin) % 16) * 4))
+#define  SUNXI_GPIO_PULL_PINMASK(pin)	(0x3 << (((pin) % 16) * 2))
 
 static const struct of_compat_data compat_data[] = {
 #ifdef SOC_SUN6I_A31
@@ -140,6 +140,10 @@ sunxi_gpio_setfunc(struct sunxi_gpio_sof
 			cfg = GPIO_READ(sc, cfg_reg);
 			cfg &= ~cfg_mask;
 			cfg |= __SHIFTIN(n, cfg_mask);
+#ifdef SUNXI_GPIO_DEBUG
+			device_printf(sc->sc_dev, "P%c%02d cfg %08x -> %08x\n",
+			pin_def->port + 'A', pin_def->pin, GPIO_READ(sc, cfg_reg), cfg);
+#endif
 			GPIO_WRITE(sc, cfg_reg, cfg);
 			return 0;
 		}
@@ -169,6 +173,10 @@ sunxi_gpio_setpull(struct sunxi_gpio_sof
 		pull |= __SHIFTIN(SUNXI_GPIO_PULL_DOWN, pull_mask);
 	else
 		pull |= __SHIFTIN(SUNXI_GPIO_PULL_DISABLE, pull_mask);
+#ifdef SUNXI_GPIO_DEBUG
+	device_printf(sc->sc_dev, "P%c%02d pull %08x -> %08x\n",
+	pin_def->port + 'A', pin_def->pin, GPIO_READ(sc, pull_reg), pull);
+#endif
 	GPIO_WRITE(sc, pull_reg, pull);
 
 	return 0;
@@ -189,6 +197,10 @@ sunxi_gpio_setdrv(struct sunxi_gpio_soft
 	drv = GPIO_READ(sc, drv_reg);
 	drv &= ~drv_mask;
 	drv |= __SHIFTIN((drive_strength / 10) - 1, drv_mask);
+#ifdef SUNXI_GPIO_DEBUG
+	device_printf(sc->sc_dev, "P%c%02d drv %08x -> %08x\n",
+	pin_def->port + 'A', pin_def->pin, GPIO_READ(sc, drv_reg), drv);
+#endif
 	GPIO_WRITE(sc, drv_reg, drv);
 
 	return 0;
@@ -284,9 +296,6 @@ sunxi_gpio_write(device_t dev, void *pri
 	struct sunxi_gpio_pin *pin = priv;
 	const struct sunxi_gpio_pins *pin_def = pin->pin_def;
 	uint32_t data;
-#ifdef SUNXI_GPIO_DEBUG
-	uint32_t old_data;
-#endif
 
 	KASSERT(sc == pin->pin_sc);
 
@@ -298,17 +307,13 @@ sunxi_gpio_write(device_t dev, void *pri
 
 	/* XXX locking */
 	data = GPIO_READ(sc, data_reg);
-#ifdef SUNXI_GPIO_DEBUG
-	old_data = data;
-#endif
 	data &= ~data_mask;
 	data |= __SHIFTIN(val, data_mask);
-	GPIO_WRITE(sc, data_reg, data_mask);
-
 #ifdef SUNXI_GPIO_DEBUG
 	device_printf(dev, "P%c%02d wr %08x -> %08x\n",
-	pin_def->port + 'A', pin_def->pin, old_data, data);
+	pin_def->port + 'A', pin_def->pin, GPIO_READ(sc, data_reg), data);
 #endif
+	GPIO_WRITE(sc, data_reg, data_mask);
 }
 
 static struct fdtbus_gpio_controller_func sunxi_gpio_funcs = {



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 21:13:06 UTC 2017

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

Log Message:
Fix some register definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_gpio.c

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



CVS commit: src/etc/etc.evbarm

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:39:44 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Replace HUMMINGBIRD_A31 with the SUNXI kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/etc/etc.evbarm/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/etc/etc.evbarm/Makefile.inc
diff -u src/etc/etc.evbarm/Makefile.inc:1.84 src/etc/etc.evbarm/Makefile.inc:1.85
--- src/etc/etc.evbarm/Makefile.inc:1.84	Tue Jun 20 21:04:23 2017
+++ src/etc/etc.evbarm/Makefile.inc	Sun Jul  2 22:39:44 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.84 2017/06/20 21:04:23 skrll Exp $
+#	$NetBSD: Makefile.inc,v 1.85 2017/07/02 22:39:44 jmcneill Exp $
 #
 #	etc.evbarm/Makefile.inc -- evbarm-specific etc Makefile targets
 #
@@ -30,8 +30,6 @@ EVBARM_BOARDS.armv7+=		CUBIEBOARD
 EVBARM_BOARDS.armv7hf+=		CUBIEBOARD
 EVBARM_BOARDS.armv7+=		CUBIETRUCK
 EVBARM_BOARDS.armv7hf+=		CUBIETRUCK
-EVBARM_BOARDS.armv7+=		HUMMINGBIRD_A31
-EVBARM_BOARDS.armv7hf+=		HUMMINGBIRD_A31
 .else
 IMAGEENDIAN=	le
 # little endian boards
@@ -102,8 +100,6 @@ EVBARM_BOARDS.armv7+=		CUBOX
 EVBARM_BOARDS.armv7hf+= 	CUBOX
 EVBARM_BOARDS.armv7+=		CUBOX-I
 EVBARM_BOARDS.armv7hf+= 	CUBOX-I
-EVBARM_BOARDS.armv7+=		HUMMINGBIRD_A31
-EVBARM_BOARDS.armv7hf+=		HUMMINGBIRD_A31
 #EVBARM_BOARDS.armv7+=		IGEPV2
 EVBARM_BOARDS.armv7+=		IMX6UL-STARTER
 EVBARM_BOARDS.armv7hf+=		IMX6UL-STARTER
@@ -128,6 +124,8 @@ EVBARM_BOARDS.armv7+=		PANDABOARD
 EVBARM_BOARDS.armv7hf+= 	PANDABOARD
 EVBARM_BOARDS.armv7+=		RPI2
 EVBARM_BOARDS.armv7hf+=	 	RPI2
+EVBARM_BOARDS.armv7+=		SUNXI
+EVBARM_BOARDS.armv7hf+=		SUNXI
 .endif
 
 IMAGE.rel=	${RELEASEDIR}/${RELEASEMACHINEDIR}



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:41:30 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm

Log Message:
Rename JETSONTK1 to TEGRA, add SUNXI


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/README.evbarm
diff -u src/sys/arch/evbarm/conf/README.evbarm:1.14 src/sys/arch/evbarm/conf/README.evbarm:1.15
--- src/sys/arch/evbarm/conf/README.evbarm:1.14	Sat Jan  7 16:24:07 2017
+++ src/sys/arch/evbarm/conf/README.evbarm	Sun Jul  2 22:41:30 2017
@@ -1,4 +1,4 @@
-$NetBSD: README.evbarm,v 1.14 2017/01/07 16:24:07 kiyohara Exp $
+$NetBSD: README.evbarm,v 1.15 2017/07/02 22:41:30 jmcneill Exp $
 
 config		date		boards
 ---
@@ -31,7 +31,6 @@ IQ80310		2001/09/05	Intel IQ80310 eval b
 IQ80321		2002/03/27	Intel IQ321 eval board
 IXDP425		2003/04/08	Intel IXDP425/IXCDP1100 development platform
 IXM1200		2002/07/15	Intel IMX1200 eval board
-JETSONTK1	2015/05/29	NVIDIA Jetson TK1 development kit
 KOBO		2014/07/25	Kobo touch (eReaders)
 KUROBOX_PRO	2010/10/02	Kuroutoshikou KURO-BOX/PRO
 KURONAS_X4	2016/07/11	Kuroutoshikou KURO-NAS/x4
@@ -60,8 +59,10 @@ SMDK2410	2003/07/31	Samsung SMDK2410 S3C
 SMDK2800	2002/11/20	Samsung SMDK2800 S3C2800 eval board
 RPI		2012/07/26	Raspberry Pi
 RPI2		2015/03/04	Raspberry Pi 2
+SUNXI		2017/06/28	Allwinner family SoCs (FDT)
 TEAMASA_NPWR	2002/02/07	Team ASA Npwr IOP310 based server appliance
 TEAMASA_NPWR_FC	2003/12/24	Team ASA NPWR-FC i80321 server appliance
+TEGRA		2015/05/29	NVIDIA Tegra family SoCs (FDT)
 TISDP2420	2008/04/27	TI OMAP 2420 eval board
 TISDP2430	2008/04/27	TI OMAP 2430 eval board
 TOASTER		2005/08/14	NetBSD/toaster based on TS-7200



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:41:30 UTC 2017

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm

Log Message:
Rename JETSONTK1 to TEGRA, add SUNXI


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

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



CVS commit: src/etc/etc.evbarm

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 22:39:44 UTC 2017

Modified Files:
src/etc/etc.evbarm: Makefile.inc

Log Message:
Replace HUMMINGBIRD_A31 with the SUNXI kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/etc/etc.evbarm/Makefile.inc

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:19:26 UTC 2017

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

Log Message:
Fix typo in a compat string.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_gpio.c

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



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 18:19:26 UTC 2017

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

Log Message:
Fix typo in a compat string.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_gpio.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/sunxi_gpio.c
diff -u src/sys/arch/arm/sunxi/sunxi_gpio.c:1.2 src/sys/arch/arm/sunxi/sunxi_gpio.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_gpio.c:1.2	Sun Jul  2 15:28:25 2017
+++ src/sys/arch/arm/sunxi/sunxi_gpio.c	Sun Jul  2 18:19:26 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $ */
+/* $NetBSD: sunxi_gpio.c,v 1.3 2017/07/02 18:19:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.2 2017/07/02 15:28:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_gpio.c,v 1.3 2017/07/02 18:19:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -63,7 +63,7 @@ static const struct of_compat_data compa
 #endif
 #ifdef SOC_SUN8I_H3
 	{ "allwinner,sun8i-h3-pinctrl",		(uintptr_t)_h3_padconf },
-	{ "allwunner,sun8i-h3-r-pinctrl",	(uintptr_t)_h3_r_padconf },
+	{ "allwinner,sun8i-h3-r-pinctrl",	(uintptr_t)_h3_r_padconf },
 #endif
 	{ NULL }
 };



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 21:59:14 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Disallow sharing between MPSAFE and non-MPSAFE handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/gic_fdt.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/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.6 src/sys/arch/arm/fdt/gic_fdt.c:1.7
--- src/sys/arch/arm/fdt/gic_fdt.c:1.6	Thu Jun 29 20:54:28 2017
+++ src/sys/arch/arm/fdt/gic_fdt.c	Sun Jul  2 21:59:14 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.6 2017/06/29 20:54:28 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.7 2017/07/02 21:59:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.6 2017/06/29 20:54:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.7 2017/07/02 21:59:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -78,6 +78,7 @@ struct gic_fdt_irq {
 	int			intr_refcnt;
 	int			intr_ipl;
 	int			intr_level;
+	int			intr_mpsafe;
 	TAILQ_HEAD(, gic_fdt_irqhandler) intr_handlers;
 };
 
@@ -178,6 +179,8 @@ gic_fdt_establish(device_t dev, u_int *s
 	const u_int trig = be32toh(specifier[2]) & 0xf;
 	const u_int level = (trig & 0x3) ? IST_EDGE : IST_LEVEL;
 
+	const u_int mpsafe = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0;
+
 	firq = sc->sc_irq[irq];
 	if (firq == NULL) {
 		firq = kmem_alloc(sizeof(*firq), KM_SLEEP);
@@ -185,8 +188,9 @@ gic_fdt_establish(device_t dev, u_int *s
 		firq->intr_refcnt = 0;
 		firq->intr_ipl = ipl;
 		firq->intr_level = level;
+		firq->intr_mpsafe = mpsafe;
 		TAILQ_INIT(>intr_handlers);
-		firq->intr_ih = intr_establish(irq, ipl, level | IST_MPSAFE,
+		firq->intr_ih = intr_establish(irq, ipl, level | mpsafe,
 		gic_fdt_intr, firq);
 		if (firq->intr_ih == NULL) {
 			kmem_free(firq, sizeof(*firq));
@@ -203,6 +207,10 @@ gic_fdt_establish(device_t dev, u_int *s
 		device_printf(dev, "cannot share edge and level interrupts\n");
 		return NULL;
 	}
+	if (firq->intr_mpsafe != mpsafe) {
+		device_printf(dev, "cannot share between mpsafe/non-mpsafe\n");
+		return NULL;
+	}
 
 	firq->intr_refcnt++;
 
@@ -241,13 +249,8 @@ gic_fdt_intr(void *priv)
 	struct gic_fdt_irqhandler *firqh;
 	int handled = 0;
 
-	TAILQ_FOREACH(firqh, >intr_handlers, ih_next) {
-		if (!firqh->ih_mpsafe)
-			KERNEL_LOCK(1, curlwp);
+	TAILQ_FOREACH(firqh, >intr_handlers, ih_next)
 		handled += firqh->ih_fn(firqh->ih_arg);
-		if (!firqh->ih_mpsafe)
-			KERNEL_UNLOCK_ONE(curlwp);
-	}
 
 	return handled;
 }



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

2017-07-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Jul  2 21:59:14 UTC 2017

Modified Files:
src/sys/arch/arm/fdt: gic_fdt.c

Log Message:
Disallow sharing between MPSAFE and non-MPSAFE handlers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/gic_fdt.c

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



CVS commit: src/sys/sys

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 03:12:43 UTC 2017

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

Log Message:
Add new declarations of cv_timedwaitbt and cv_timedwaitbt_sig, too.

Helps to put all the files I meant to commit on the command line!

Noted by pgoyette, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/sys/condvar.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/condvar.h
diff -u src/sys/sys/condvar.h:1.13 src/sys/sys/condvar.h:1.14
--- src/sys/sys/condvar.h:1.13	Sat Apr  9 16:59:43 2016
+++ src/sys/sys/condvar.h	Mon Jul  3 03:12:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: condvar.h,v 1.13 2016/04/09 16:59:43 riastradh Exp $	*/
+/*	$NetBSD: condvar.h,v 1.14 2017/07/03 03:12:42 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@ typedef struct kcondvar {
 
 #ifdef _KERNEL
 
+struct bintime;
 struct kmutex;
 
 void	cv_init(kcondvar_t *, const char *);
@@ -47,6 +48,10 @@ void	cv_wait(kcondvar_t *, struct kmutex
 int	cv_wait_sig(kcondvar_t *, struct kmutex *);
 int	cv_timedwait(kcondvar_t *, struct kmutex *, int);
 int	cv_timedwait_sig(kcondvar_t *, struct kmutex *, int);
+int	cv_timedwaitbt(kcondvar_t *, struct kmutex *, struct bintime *,
+	const struct bintime *);
+int	cv_timedwaitbt_sig(kcondvar_t *, struct kmutex *, struct bintime *,
+	const struct bintime *);
 
 void	cv_signal(kcondvar_t *);
 void	cv_broadcast(kcondvar_t *);



CVS commit: src/sys/sys

2017-07-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jul  3 03:12:43 UTC 2017

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

Log Message:
Add new declarations of cv_timedwaitbt and cv_timedwaitbt_sig, too.

Helps to put all the files I meant to commit on the command line!

Noted by pgoyette, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/sys/condvar.h

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



CVS commit: src/sys/dev/pad

2017-07-02 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jul  2 05:59:27 UTC 2017

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

Log Message:
Return early from read if kpause is interrupted by a signal.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.39 src/sys/dev/pad/pad.c:1.40
--- src/sys/dev/pad/pad.c:1.39	Sat Jul  1 23:31:19 2017
+++ src/sys/dev/pad/pad.c	Sun Jul  2 05:59:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.39 2017/07/01 23:31:19 nat Exp $ */
+/* $NetBSD: pad.c,v 1.40 2017/07/02 05:59:27 nat Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.39 2017/07/01 23:31:19 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.40 2017/07/02 05:59:27 nat Exp $");
 
 #include 
 #include 
@@ -488,8 +488,12 @@ pad_read(struct file *fp, off_t *offp, s
 			wait_ticks = (hz * sc->sc_remainder) / 100;
 			if (wait_ticks > 0) {
 sc->sc_remainder -= wait_ticks * 100 / hz;
-kpause("padwait", TRUE, wait_ticks,
+err = kpause("padwait", TRUE, wait_ticks,
 >sc_lock);
+if (err != EWOULDBLOCK) {
+	mutex_exit(>sc_lock);
+	continue;
+}
 			}
 		}
 



CVS commit: src/sys/dev/pad

2017-07-02 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Jul  2 05:59:27 UTC 2017

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

Log Message:
Return early from read if kpause is interrupted by a signal.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pad/pad.c

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



CVS commit: src/games/fortune/datfiles

2017-07-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul  2 07:02:47 UTC 2017

Modified Files:
src/games/fortune/datfiles: fortunes2

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/games/fortune/datfiles/fortunes2

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

Modified files:

Index: src/games/fortune/datfiles/fortunes2
diff -u src/games/fortune/datfiles/fortunes2:1.58 src/games/fortune/datfiles/fortunes2:1.59
--- src/games/fortune/datfiles/fortunes2:1.58	Sun Aug 28 19:44:44 2016
+++ src/games/fortune/datfiles/fortunes2	Sun Jul  2 07:02:47 2017
@@ -25148,7 +25148,7 @@ If you want to be ruined, marry a rich w
 		-- Michelet
 %
 If you want to get rich from writing, write the sort of thing that's
-read by persons who move their lips when the're reading to themselves.
+read by persons who move their lips when they're reading to themselves.
 		-- Don Marquis
 %
 If you want to know how old a man is, ask his brother-in-law.



CVS commit: src/games/fortune/datfiles

2017-07-02 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sun Jul  2 07:02:47 UTC 2017

Modified Files:
src/games/fortune/datfiles: fortunes2

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/games/fortune/datfiles/fortunes2

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