Re: CVS commit: src/sys/kern

2018-06-30 Thread Robert Elz
Date:Sun, 1 Jul 2018 01:54:35 +
From:Taylor R Campbell 
Message-ID:  <20180701015435.93fa760...@jupiter.mumble.net>

  | Sorry about the breakage with xen_machdep.c that made finding this
  | tricky. 

No problem, for me it turned out to actually help ... I hadn't attempted to
boot an updated kernel since the last sh mods (a week or so ago) - for
the previous fix (module build) I could not test (my kernels do not allow
modules to be loaded) so I didn't bother trying ... just verified build 
success.Without that build breakage I wouldn't have known that
recent kernels were not booting until sometime in the future.

kre



Re: CVS commit: src/sys/kern

2018-06-30 Thread Taylor R Campbell
> Date: Sun, 01 Jul 2018 06:34:05 +0700
> From: Robert Elz 
> 
> Date:Sat, 30 Jun 2018 22:47:51 +
> From:"Taylor R Campbell" 
> Message-ID:  <20180630224751.777cdf...@cvs.netbsd.org>
> 
>   | Module Name:  src
>   | Committed By: riastradh
>   | Date: Sat Jun 30 22:47:51 UTC 2018
>   |
>   | Modified Files:
>   |   src/sys/kern: kern_ntptime.c kern_tc.c
> 
>   | Enables Xen to boot again.
> 
> It does indeed.  Thanks.

Sorry about the breakage with xen_machdep.c that made finding this
tricky.  Apparently I had compiled and booted a kernel from the wrong
tree.


Re: CVS commit: src/sys/kern

2018-06-30 Thread Robert Elz
Date:Sat, 30 Jun 2018 22:47:51 +
From:"Taylor R Campbell" 
Message-ID:  <20180630224751.777cdf...@cvs.netbsd.org>

  | Module Name:src
  | Committed By:   riastradh
  | Date:   Sat Jun 30 22:47:51 UTC 2018
  |
  | Modified Files:
  | src/sys/kern: kern_ntptime.c kern_tc.c

  | Enables Xen to boot again.

It does indeed.  Thanks.

kre



CVS commit: src/sys/kern

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 22:47:51 UTC 2018

Modified Files:
src/sys/kern: kern_ntptime.c kern_tc.c

Log Message:
Sprinkle cold conditionals to make tc_ticktock before inittimecounter.

Enables Xen to boot again.

XXX Maybe we should have a tc_ticktock_cold instead or something so we
don't have to reach this far into the call graph.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_ntptime.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_tc.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_ntptime.c
diff -u src/sys/kern/kern_ntptime.c:1.57 src/sys/kern/kern_ntptime.c:1.58
--- src/sys/kern/kern_ntptime.c:1.57	Mon Nov 23 23:45:44 2015
+++ src/sys/kern/kern_ntptime.c	Sat Jun 30 22:47:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $	*/
+/*	$NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_ntptime.c,v 1.59 2005/05/28 14:34:41 rwatson Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.57 2015/11/23 23:45:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ntptime.c,v 1.58 2018/06/30 22:47:51 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -418,7 +418,7 @@ ntp_update_second(int64_t *adjustment, t
 	int tickrate;
 	l_fp ftemp;		/* 32/64-bit temporary */
 
-	KASSERT(mutex_owned(_lock));
+	KASSERT(__predict_false(cold) || mutex_owned(_lock));
 
 #ifdef NTP
 

Index: src/sys/kern/kern_tc.c
diff -u src/sys/kern/kern_tc.c:1.49 src/sys/kern/kern_tc.c:1.50
--- src/sys/kern/kern_tc.c:1.49	Tue Feb 13 09:26:17 2018
+++ src/sys/kern/kern_tc.c	Sat Jun 30 22:47:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_tc.c,v 1.49 2018/02/13 09:26:17 maxv Exp $ */
+/* $NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
 
 #include 
 /* __FBSDID("$FreeBSD: src/sys/kern/kern_tc.c,v 1.166 2005/09/19 22:16:31 andre Exp $"); */
-__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.49 2018/02/13 09:26:17 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_tc.c,v 1.50 2018/06/30 22:47:51 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
@@ -572,7 +572,7 @@ tc_pick(void)
 {
 	struct timecounter *best, *tc;
 
-	KASSERT(mutex_owned(_lock));
+	KASSERT(__predict_false(cold) || mutex_owned(_lock));
 
 	for (best = tc = timecounters; tc != NULL; tc = tc->tc_next) {
 		if (tc->tc_quality > best->tc_quality)
@@ -731,7 +731,7 @@ tc_windup(void)
 	int i, s_update;
 	time_t t;
 
-	KASSERT(mutex_owned(_lock));
+	KASSERT(__predict_false(cold) || mutex_owned(_lock));
 
 	s_update = 0;
 
@@ -1308,7 +1308,8 @@ tc_ticktock(void)
 	if (++count < tc_tick)
 		return;
 	count = 0;
-	mutex_spin_enter(_lock);
+	if (__predict_true(!cold))
+		mutex_spin_enter(_lock);
 	if (timecounter_bad != 0) {
 		/* An existing timecounter has gone bad, pick a new one. */
 		(void)atomic_swap_uint(_bad, 0);
@@ -1317,7 +1318,8 @@ tc_ticktock(void)
 		}
 	}
 	tc_windup();
-	mutex_spin_exit(_lock);
+	if (__predict_true(!cold))
+		mutex_spin_exit(_lock);
 }
 
 void



CVS commit: src/sys/kern

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 22:47:51 UTC 2018

Modified Files:
src/sys/kern: kern_ntptime.c kern_tc.c

Log Message:
Sprinkle cold conditionals to make tc_ticktock before inittimecounter.

Enables Xen to boot again.

XXX Maybe we should have a tc_ticktock_cold instead or something so we
don't have to reach this far into the call graph.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_ntptime.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_tc.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/xen/xen

2018-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 30 20:53:30 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
Build fix bandaid.

This allows the builds including XEN to complete, but XEN kernels
built from these sources (at least, DomU) do not boot successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/xen_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/xen/xen

2018-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 30 20:53:30 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
Build fix bandaid.

This allows the builds including XEN to complete, but XEN kernels
built from these sources (at least, DomU) do not boot successfully.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/xen/xen_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/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.17 src/sys/arch/xen/xen/xen_machdep.c:1.18
--- src/sys/arch/xen/xen/xen_machdep.c:1.17	Sat Jun 30 14:55:13 2018
+++ src/sys/arch/xen/xen/xen_machdep.c	Sat Jun 30 20:53:30 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.18 2018/06/30 20:53:30 kre Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.18 2018/06/30 20:53:30 kre Exp $");
 
 #include "opt_xen.h"
 
@@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: xen_machdep.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -279,8 +280,8 @@ sysctl_xen_suspend(SYSCTLFN_ARGS)
 
 }
 
-static xcfunc_t xen_suspendclocks_xc;
-static xcfunc_t xen_resumeclocks_xc;
+static void xen_suspendclocks_xc(void *, void*);
+static void xen_resumeclocks_xc(void *, void*);
 
 /*
  * Last operations before suspending domain



CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 20:34:43 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_clock.c fdt_dai.c fdt_dma.c fdt_gpio.c fdt_i2c.c
fdt_intr.c fdt_mmc_pwrseq.c fdt_phy.c fdt_pinctrl.c fdt_power.c
fdt_pwm.c fdt_regulator.c fdt_reset.c

Log Message:
Use queue(3) API to manage lists. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_clock.c \
src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_dai.c src/sys/dev/fdt/fdt_i2c.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_dma.c \
src/sys/dev/fdt/fdt_mmc_pwrseq.c src/sys/dev/fdt/fdt_phy.c \
src/sys/dev/fdt/fdt_power.c src/sys/dev/fdt/fdt_pwm.c \
src/sys/dev/fdt/fdt_reset.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_gpio.c \
src/sys/dev/fdt/fdt_regulator.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/fdt/fdt_intr.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/fdt/fdt_clock.c
diff -u src/sys/dev/fdt/fdt_clock.c:1.4 src/sys/dev/fdt/fdt_clock.c:1.5
--- src/sys/dev/fdt/fdt_clock.c:1.4	Sat Jun 16 00:12:35 2018
+++ src/sys/dev/fdt/fdt_clock.c	Sat Jun 30 20:34:43 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_clock.c,v 1.4 2018/06/16 00:12:35 jmcneill Exp $ */
+/* $NetBSD: fdt_clock.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_clock.c,v 1.4 2018/06/16 00:12:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_clock.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -43,10 +44,11 @@ struct fdtbus_clock_controller {
 	int cc_phandle;
 	const struct fdtbus_clock_controller_func *cc_funcs;
 
-	struct fdtbus_clock_controller *cc_next;
+	LIST_ENTRY(fdtbus_clock_controller) cc_next;
 };
 
-static struct fdtbus_clock_controller *fdtbus_cc = NULL;
+static LIST_HEAD(, fdtbus_clock_controller) fdtbus_clock_controllers =
+LIST_HEAD_INITIALIZER(fdtbus_clock_controller);
 
 int
 fdtbus_register_clock_controller(device_t dev, int phandle,
@@ -59,8 +61,7 @@ fdtbus_register_clock_controller(device_
 	cc->cc_phandle = phandle;
 	cc->cc_funcs = funcs;
 
-	cc->cc_next = fdtbus_cc;
-	fdtbus_cc = cc;
+	LIST_INSERT_HEAD(_clock_controllers, cc, cc_next);
 
 	fdtbus_clock_assign(phandle);
 
@@ -72,10 +73,9 @@ fdtbus_get_clock_controller(int phandle)
 {
 	struct fdtbus_clock_controller *cc;
 
-	for (cc = fdtbus_cc; cc; cc = cc->cc_next) {
-		if (cc->cc_phandle == phandle) {
+	LIST_FOREACH(cc, _clock_controllers, cc_next) {
+		if (cc->cc_phandle == phandle)
 			return cc;
-		}
 	}
 
 	return NULL;
@@ -185,7 +185,7 @@ fdtbus_clock_byname(const char *clkname)
 	u_int len, resid, index, clock_cells;
 	const char *p;
 
-	for (cc = fdtbus_cc; cc; cc = cc->cc_next) {
+	LIST_FOREACH(cc, _clock_controllers, cc_next) {
 		if (!of_hasprop(cc->cc_phandle, "clock-output-names"))
 			continue;
 		p = fdtbus_get_prop(cc->cc_phandle, "clock-output-names", );
Index: src/sys/dev/fdt/fdt_pinctrl.c
diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.4 src/sys/dev/fdt/fdt_pinctrl.c:1.5
--- src/sys/dev/fdt/fdt_pinctrl.c:1.4	Sun Jul  2 15:27:58 2017
+++ src/sys/dev/fdt/fdt_pinctrl.c	Sat Jun 30 20:34:43 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.4 2017/07/02 15:27:58 jmcneill Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,11 +28,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.4 2017/07/02 15:27:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.5 2018/06/30 20:34:43 jmcneill Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -42,10 +43,11 @@ struct fdtbus_pinctrl_controller {
 	int pc_phandle;
 	const struct fdtbus_pinctrl_controller_func *pc_funcs;
 
-	struct fdtbus_pinctrl_controller *pc_next;
+	LIST_ENTRY(fdtbus_pinctrl_controller) pc_next;
 };
 
-static struct fdtbus_pinctrl_controller *fdtbus_pc = NULL;
+static LIST_HEAD(, fdtbus_pinctrl_controller) fdtbus_pinctrl_controllers =
+LIST_HEAD_INITIALIZER(fdtbus_pinctrl_controllers);
 
 int
 fdtbus_register_pinctrl_config(device_t dev, int phandle,
@@ -58,8 +60,7 @@ fdtbus_register_pinctrl_config(device_t 
 	pc->pc_phandle = phandle;
 	pc->pc_funcs = funcs;
 
-	pc->pc_next = fdtbus_pc;
-	fdtbus_pc = pc;
+	LIST_INSERT_HEAD(_pinctrl_controllers, pc, pc_next);
 
 	return 0;
 }
@@ -69,9 +70,10 @@ fdtbus_pinctrl_lookup(int phandle)
 {
 	struct fdtbus_pinctrl_controller *pc;
 
-	for (pc = fdtbus_pc; pc; pc = pc->pc_next)
+	LIST_FOREACH(pc, _pinctrl_controllers, pc_next) {
 		if (pc->pc_phandle == phandle)
 			return pc;
+	}
 
 	return NULL;
 }

Index: src/sys/dev/fdt/fdt_dai.c
diff -u src/sys/dev/fdt/fdt_dai.c:1.2 src/sys/dev/fdt/fdt_dai.c:1.3
--- src/sys/dev/fdt/fdt_dai.c:1.2	Sun Jun  3 

CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 20:34:43 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_clock.c fdt_dai.c fdt_dma.c fdt_gpio.c fdt_i2c.c
fdt_intr.c fdt_mmc_pwrseq.c fdt_phy.c fdt_pinctrl.c fdt_power.c
fdt_pwm.c fdt_regulator.c fdt_reset.c

Log Message:
Use queue(3) API to manage lists. NFCI.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fdt_clock.c \
src/sys/dev/fdt/fdt_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_dai.c src/sys/dev/fdt/fdt_i2c.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_dma.c \
src/sys/dev/fdt/fdt_mmc_pwrseq.c src/sys/dev/fdt/fdt_phy.c \
src/sys/dev/fdt/fdt_power.c src/sys/dev/fdt/fdt_pwm.c \
src/sys/dev/fdt/fdt_reset.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_gpio.c \
src/sys/dev/fdt/fdt_regulator.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/fdt/fdt_intr.c

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 20:16:56 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_syscon.c

Log Message:
Simplify list initialization


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_syscon.c

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 20:16:56 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_syscon.c

Log Message:
Simplify list initialization


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_syscon.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/fdt/fdt_syscon.c
diff -u src/sys/dev/fdt/fdt_syscon.c:1.2 src/sys/dev/fdt/fdt_syscon.c:1.3
--- src/sys/dev/fdt/fdt_syscon.c:1.2	Sat Jun 30 18:07:12 2018
+++ src/sys/dev/fdt/fdt_syscon.c	Sat Jun 30 20:16:56 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $ */
+/* $NetBSD: fdt_syscon.c,v 1.3 2018/06/30 20:16:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.3 2018/06/30 20:16:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -47,9 +47,8 @@ struct fdtbus_syscon {
 	LIST_ENTRY(fdtbus_syscon) sc_next;
 };
 
-LIST_HEAD(fdtbus_syscon_h, fdtbus_syscon);
-static struct fdtbus_syscon_h fdtbus_syscons =
-	LIST_HEAD_INITIALIZER(fdtbus_syscons);
+static LIST_HEAD(, fdtbus_syscon) fdtbus_syscons =
+LIST_HEAD_INITIALIZER(fdtbus_syscons);
 
 int
 fdtbus_register_syscon(device_t dev, int phandle,



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:27:10 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Rock64 needs more time for the PHY to reset. Add a delay.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip/rk_gmac.c
diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.5 src/sys/arch/arm/rockchip/rk_gmac.c:1.6
--- src/sys/arch/arm/rockchip/rk_gmac.c:1.5	Sat Jun 30 18:20:35 2018
+++ src/sys/arch/arm/rockchip/rk_gmac.c	Sat Jun 30 18:27:10 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.5 2018/06/30 18:20:35 jmcneill Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.6 2018/06/30 18:27:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.5 2018/06/30 18:20:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.6 2018/06/30 18:27:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -284,6 +284,9 @@ rk_gmac_attach(device_t parent, device_t
 	if (rk_gmac_reset(phandle) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
+	/* Rock64 seems to need more time for the reset to complete */
+	delay(10);
+
 #if notyet
 	if (of_hasprop(phandle, "snps,force_thresh_dma_mode"))
 		sc->sc_flags |= DWC_GMAC_FORCE_THRESH_DMA_MODE;



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:27:10 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Rock64 needs more time for the PHY to reset. Add a delay.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:20:35 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Use syscon API


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip/rk_gmac.c
diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.4 src/sys/arch/arm/rockchip/rk_gmac.c:1.5
--- src/sys/arch/arm/rockchip/rk_gmac.c:1.4	Sat Jun 30 16:28:14 2018
+++ src/sys/arch/arm/rockchip/rk_gmac.c	Sat Jun 30 18:20:35 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.4 2018/06/30 16:28:14 jmcneill Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.5 2018/06/30 18:20:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.4 2018/06/30 16:28:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.5 2018/06/30 18:20:35 jmcneill Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 
 #include 
 
 #include 
+#include 
 
 #define	RK3328_GRF_MAC_CON0	0x0900
 #define	 RK3328_GRF_MAC_CON0_RXDLY	__BITS(13,7)
@@ -73,7 +74,7 @@ static const char * compatible[] = {
 
 struct rk_gmac_softc {
 	struct dwc_gmac_softc	sc_base;
-	bus_space_handle_t	sc_grf_bsh;
+	struct syscon		*sc_syscon;
 };
 
 static int
@@ -119,23 +120,24 @@ rk3328_gmac_set_mode_rgmii(struct dwc_gm
 	struct rk_gmac_softc * const rk_sc = (struct rk_gmac_softc *)sc;
 	uint32_t write_mask, write_val;
 
+	syscon_lock(rk_sc->sc_syscon);
+
 	write_mask = (RK3328_GRF_MAC_CON1_MODE | RK3328_GRF_MAC_CON1_SEL) << 16;
 	write_val = __SHIFTIN(RK3328_GRF_MAC_CON1_SEL_RGMII, RK3328_GRF_MAC_CON1_SEL);
-	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1,
-	write_mask | write_val);
+	syscon_write_4(rk_sc->sc_syscon, RK3328_GRF_MAC_CON1, write_mask | write_val);
 
 #if notyet
 	write_mask = (RK3328_GRF_MAC_CON0_TXDLY | RK3328_GRF_MAC_CON0_RXDLY) << 16;
 	write_val = __SHIFTIN(tx_delay, RK3328_GRF_MAC_CON0_TXDLY) |
 		__SHIFTIN(rx_delay, RK3328_GRF_MAC_CON0_RXDLY);
-	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON0,
-	write_mask | write_val);
+	syscon_write_4(rk_sc->sc_syscon, RK3328_GRF_MAC_CON0, write_mask | write_val);
 
 	write_mask = (RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN) << 16;
 	write_val = RK3328_GRF_MAC_CON1_RXDLY_EN | RK3328_GRF_MAC_CON1_TXDLY_EN;
-	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1,
-	write_mask | write_val);
+	syscon_write_4(rk_sc->sc_syscon, RK3328_GRF_MAC_CON1, write_mask | write_val);
 #endif
+
+	syscon_unlock(rk_sc->sc_syscon);
 }
 
 static void
@@ -156,9 +158,11 @@ rk3328_gmac_set_speed_rgmii(struct dwc_g
 		break;
 	}
 
-	bus_space_write_4(sc->sc_bst, rk_sc->sc_grf_bsh, RK3328_GRF_MAC_CON1,
+	syscon_lock(rk_sc->sc_syscon);
+	syscon_write_4(rk_sc->sc_syscon, RK3328_GRF_MAC_CON1,
 	(RK3328_GRF_MAC_CON1_CLKSEL << 16) |
 	__SHIFTIN(RK3328_GRF_MAC_CON1_CLKSEL_125M, RK3328_GRF_MAC_CON1_CLKSEL));
+	syscon_unlock(rk_sc->sc_syscon);
 }
 
 static int
@@ -240,8 +244,8 @@ rk_gmac_attach(device_t parent, device_t
 	const int phandle = faa->faa_phandle;
 	const char *phy_mode;
 	char intrstr[128];
-	bus_addr_t addr, grf_addr;
-	bus_size_t size, grf_size;
+	bus_addr_t addr;
+	bus_size_t size;
 	u_int tx_delay, rx_delay;
 
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -249,17 +253,9 @@ rk_gmac_attach(device_t parent, device_t
 		return;
 	}
 
-	const int grf_phandle = fdtbus_get_phandle(phandle, "rockchip,grf");
-	if (grf_phandle == -1) {
-		aprint_error(": couldn't get grf phandle\n");
-		return;
-	}
-	if (fdtbus_get_reg(grf_phandle, 0, _addr, _size) != 0) {
-		aprint_error(": couldn't get grf registers\n");
-		return;
-	}
-	if (bus_space_map(faa->faa_bst, grf_addr, grf_size, 0, _sc->sc_grf_bsh) != 0) {
-		aprint_error(": couldn't map grf registers\n");
+	rk_sc->sc_syscon = fdtbus_syscon_acquire(phandle, "rockchip,grf");
+	if (rk_sc->sc_syscon == NULL) {
+		aprint_error(": couldn't get grf syscon\n");
 		return;
 	}
 



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:20:35 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Use syscon API


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:15:55 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_iomux.c

Log Message:
Use syscon API


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_iomux.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/rockchip/rk_iomux.c
diff -u src/sys/arch/arm/rockchip/rk_iomux.c:1.2 src/sys/arch/arm/rockchip/rk_iomux.c:1.3
--- src/sys/arch/arm/rockchip/rk_iomux.c:1.2	Sat Jun 16 23:13:29 2018
+++ src/sys/arch/arm/rockchip/rk_iomux.c	Sat Jun 30 18:15:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_iomux.c,v 1.2 2018/06/16 23:13:29 jmcneill Exp $ */
+/* $NetBSD: rk_iomux.c,v 1.3 2018/06/30 18:15:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_iomux.c,v 1.2 2018/06/16 23:13:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_iomux.c,v 1.3 2018/06/30 18:15:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: rk_iomux.c,v
 #include 
 
 #include 
+#include 
 
 #define	GRF_GPIO_P_REG(_bank, _idx)	(0x0100 + (_bank) * 0x10 + ((_idx) >> 3) * 4)
 #define	 GRF_GPIO_P_CTL(_idx)		(0x3 << (((_idx) & 7) * 2))
@@ -123,16 +124,19 @@ static const struct of_compat_data compa
 
 struct rk_iomux_softc {
 	device_t sc_dev;
-	bus_space_tag_t sc_bst;
-	bus_space_handle_t sc_bsh;
+	struct syscon *sc_syscon;
 
 	const struct rk_iomux_config *sc_conf;
 };
 
-#define RD4(sc, reg) 		\
-bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
-#define WR4(sc, reg, val) 	\
-bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+#define	LOCK(sc)		\
+	syscon_lock((sc)->sc_syscon)
+#define	UNLOCK(sc)		\
+	syscon_unlock((sc)->sc_syscon)
+#define	RD4(sc, reg) 		\
+	syscon_read_4((sc)->sc_syscon, (reg))
+#define	WR4(sc, reg, val) 	\
+	syscon_write_4((sc)->sc_syscon, (reg), (val))
 
 static int	rk_iomux_match(device_t, cfdata_t, void *);
 static void	rk_iomux_attach(device_t, device_t, void *);
@@ -250,7 +254,9 @@ rk_iomux_pinctrl_set_config(device_t dev
 		const u_int mux = be32toh(pins[2]);
 		const int cfg = fdtbus_get_phandle_from_native(be32toh(pins[3]));
 
+		LOCK(sc);
 		rk_iomux_config(sc, cfg, bank, idx, mux);
+		UNLOCK(sc);
 
 		pins_len -= 16;
 		pins += 4;
@@ -277,25 +283,12 @@ rk_iomux_attach(device_t parent, device_
 	struct rk_iomux_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	bus_addr_t addr;
-	bus_size_t size;
 	int child, sub;
 
-	const int grf_phandle = fdtbus_get_phandle(phandle, "rockchip,grf");
-	if (grf_phandle == -1) {
-		aprint_error(": couldn't get grf phandle\n");
-		return;
-	}
-
-	if (fdtbus_get_reg(grf_phandle, 0, , ) != 0) {
-		aprint_error(": couldn't get grf registers\n");
-		return;
-	}
-
 	sc->sc_dev = self;
-	sc->sc_bst = faa->faa_bst;
-	if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh) != 0) {
-		aprint_error(": couldn't map registers\n");
+	sc->sc_syscon = fdtbus_syscon_acquire(phandle, "rockchip,grf");
+	if (sc->sc_syscon == NULL) {
+		aprint_error(": couldn't acquire grf syscon\n");
 		return;
 	}
 	sc->sc_conf = (void *)of_search_compatible(phandle, compat_data)->data;



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:15:55 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_iomux.c

Log Message:
Use syscon API


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

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



Re: CVS commit: src/sys/dev/i2c

2018-06-30 Thread Jason Thorpe



> On Jun 30, 2018, at 10:50 AM, Frank Kardel  wrote:
> 
> Hi Jason !
> 
> It is not so odd as your comment suggests. The I2C address is stored in the 
> device EEPROM and perfectly survives a power off.

Ah! If the data sheet mentions this fact, I completely missed it.

I'm afraid I probably did break it, so let's figure out how to fix... can it be 
programmed to an arbitrary address, or are there a set of specific ones you can 
chose from?

> 
> All we need to be able to is to explicitly configure the device at a 
> different address. I hope this capability was not disabled with this check-in 
> as that would make my second sensor at 0x29 useless and prohibit multiple 
> sensors on a I2C bus.
> 
> For configuring the I2C address to a different value see the pkgsrc package 
> hytctl.
> 
> Thanks for re-working the attachment logic.
> 
> Frank
> 
> 
> On 06/16/18 23:24, Jason R Thorpe wrote:
>> Module Name: src
>> Committed By:thorpej
>> Date:Sat Jun 16 21:24:36 UTC 2018
>> 
>> Modified Files:
>>  src/sys/dev/i2c: hytp14.c
>> 
>> Log Message:
>> More cleanup to i2c autoconfiguration:
>> 
>> - Get all of the drivers onto the new match quality constants.
>> - Introduce a new helper function, iic_use_direct_match(), that has
>>   all of the logic for direct-config matching.  If it returns true,
>>   the driver returns the match result (which may be 0).  If it returns
>>   false, the driver does indirect-config matching.
>> - iic_compat_match() now returns a weighted match quality; matches to
>>   lower-indexed "compatible" device property are more-specific matches,
>>   and return a better match quality accordingly.
>> 
>> XXX This driver is an odd-ball with respect to the hardware device.
>> See comments in the match routine.  Unclear how best to handle it.
>> 
>> 
>> To generate a diff of this commit:
>> cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/hytp14.c
>> 
>> Please note that diffs are not public domain; they are subject to the
>> copyright notices on the relevant files.
>> 
> 

-- thorpej



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:07:32 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_usb.c

Log Message:
Use syscon API


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_usb.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/rockchip/rk_usb.c
diff -u src/sys/arch/arm/rockchip/rk_usb.c:1.2 src/sys/arch/arm/rockchip/rk_usb.c:1.3
--- src/sys/arch/arm/rockchip/rk_usb.c:1.2	Wed Jun 20 20:12:51 2018
+++ src/sys/arch/arm/rockchip/rk_usb.c	Sat Jun 30 18:07:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_usb.c,v 1.2 2018/06/20 20:12:51 jmcneill Exp $ */
+/* $NetBSD: rk_usb.c,v 1.3 2018/06/30 18:07:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_usb.c,v 1.2 2018/06/20 20:12:51 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_usb.c,v 1.3 2018/06/30 18:07:32 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,13 +41,14 @@ __KERNEL_RCSID(0, "$NetBSD: rk_usb.c,v 1
 #include 
 
 #include 
+#include 
 
 static int rk_usb_match(device_t, cfdata_t, void *);
 static void rk_usb_attach(device_t, device_t, void *);
 
-#define	CON0_REG	0x00
-#define	CON1_REG	0x04
-#define	CON2_REG	0x08
+#define	CON0_REG	0x100
+#define	CON1_REG	0x104
+#define	CON2_REG	0x108
 #define	 USBPHY_COMMONONN	__BIT(4)
 
 enum rk_usb_type {
@@ -61,24 +62,17 @@ static const struct of_compat_data compa
 
 struct rk_usb_clk {
 	struct clk		base;
-	bus_size_t		reg;
 };
 
 struct rk_usb_softc {
 	device_t		sc_dev;
-	bus_space_tag_t		sc_bst;
-	bus_space_handle_t	sc_bsh;
+	struct syscon		*sc_syscon;
 	enum rk_usb_type	sc_type;
 
 	struct clk_domain	sc_clkdom;
 	struct rk_usb_clk	sc_usbclk;
 };
 
-#define USB_READ(sc, reg)			\
-	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
-#define USB_WRITE(sc, reg, val)			\
-	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
-
 CFATTACH_DECL_NEW(rk_usb, sizeof(struct rk_usb_softc),
 	rk_usb_match, rk_usb_attach, NULL, NULL);
 
@@ -111,7 +105,10 @@ rk_usb_clk_enable(void *priv, struct clk
 
 	const uint32_t write_mask = USBPHY_COMMONONN << 16;
 	const uint32_t write_val = 0;
-	USB_WRITE(sc, CON2_REG, write_mask | write_val);
+
+	syscon_lock(sc->sc_syscon);
+	syscon_write_4(sc->sc_syscon, CON2_REG, write_mask | write_val);
+	syscon_unlock(sc->sc_syscon);
 
 	return 0;
 }
@@ -123,7 +120,10 @@ rk_usb_clk_disable(void *priv, struct cl
 
 	const uint32_t write_mask = USBPHY_COMMONONN << 16;
 	const uint32_t write_val = USBPHY_COMMONONN;
-	USB_WRITE(sc, CON2_REG, write_mask | write_val);
+
+	syscon_lock(sc->sc_syscon);
+	syscon_write_4(sc->sc_syscon, CON2_REG, write_mask | write_val);
+	syscon_unlock(sc->sc_syscon);
 
 	return 0;
 }
@@ -165,23 +165,13 @@ rk_usb_attach(device_t parent, device_t 
 	struct rk_usb_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
-	bus_addr_t grf_addr, phy_addr, phy_size;
 	int child;
 
 	sc->sc_dev = self;
-	sc->sc_bst = faa->faa_bst;
 	sc->sc_type = of_search_compatible(phandle, compat_data)->data;
-
-	if (fdtbus_get_reg(OF_parent(phandle), 0, _addr, NULL) != 0) {
-		aprint_error(": couldn't get grf registers\n");
-		return;
-	}
-	if (fdtbus_get_reg(phandle, 0, _addr, _size) != 0) {
-		aprint_error(": couldn't get phy registers\n");
-		return;
-	}
-	if (bus_space_map(sc->sc_bst, grf_addr + phy_addr, phy_size, 0, >sc_bsh) != 0) {
-		aprint_error(": couldn't map phy registers\n");
+	sc->sc_syscon = fdtbus_syscon_lookup(OF_parent(phandle));
+	if (sc->sc_syscon == NULL) {
+		aprint_error(": couldn't get grf syscon\n");
 		return;
 	}
 
@@ -252,7 +242,10 @@ rk_usbphy_otg_enable(device_t dev, void 
 
 	const uint32_t write_mask = 0x1ffU << 16;
 	const uint32_t write_val = enable ? 0 : 0x1d1;
-	USB_WRITE(usb_sc, CON0_REG, write_mask | write_val);
+
+	syscon_lock(usb_sc->sc_syscon);
+	syscon_write_4(usb_sc->sc_syscon, CON0_REG, write_mask | write_val);
+	syscon_unlock(usb_sc->sc_syscon);
 
 	return 0;
 }
@@ -264,7 +257,10 @@ rk_usbphy_host_enable(device_t dev, void
 
 	const uint32_t write_mask = 0x1ffU << 16;
 	const uint32_t write_val = enable ? 0 : 0x1d1;
-	USB_WRITE(usb_sc, CON1_REG, write_mask | write_val);
+
+	syscon_lock(usb_sc->sc_syscon);
+	syscon_write_4(usb_sc->sc_syscon, CON1_REG, write_mask | write_val);
+	syscon_unlock(usb_sc->sc_syscon);
 
 	return 0;
 }



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:07:32 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_usb.c

Log Message:
Use syscon API


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

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:07:12 UTC 2018

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

Log Message:
Add helper to lookup syscon by phandle


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_syscon.c
cvs rdiff -u -r1.36 -r1.37 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_syscon.c
diff -u src/sys/dev/fdt/fdt_syscon.c:1.1 src/sys/dev/fdt/fdt_syscon.c:1.2
--- src/sys/dev/fdt/fdt_syscon.c:1.1	Sat Jun 30 12:35:18 2018
+++ src/sys/dev/fdt/fdt_syscon.c	Sat Jun 30 18:07:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $ */
+/* $NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_syscon.c,v 1.2 2018/06/30 18:07:12 jmcneill Exp $");
 
 #include 
 #include 
@@ -96,3 +96,15 @@ fdtbus_syscon_acquire(int phandle, const
 
 	return sc->sc_syscon;
 }
+
+struct syscon *
+fdtbus_syscon_lookup(int phandle)
+{
+	struct fdtbus_syscon *sc;
+
+	sc = fdtbus_get_syscon(phandle);
+	if (sc == NULL)
+		return NULL;
+
+	return sc->sc_syscon;
+}

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.36 src/sys/dev/fdt/fdtvar.h:1.37
--- src/sys/dev/fdt/fdtvar.h:1.36	Sat Jun 30 16:22:56 2018
+++ src/sys/dev/fdt/fdtvar.h	Sat Jun 30 18:07:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.36 2018/06/30 16:22:56 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.37 2018/06/30 18:07:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -296,6 +296,7 @@ int		fdtbus_regulator_set_voltage(struct
 int		fdtbus_regulator_get_voltage(struct fdtbus_regulator *,
 		u_int *);
 struct syscon *	fdtbus_syscon_acquire(int, const char *);
+struct syscon *	fdtbus_syscon_lookup(int);
 
 struct fdtbus_dma *fdtbus_dma_get(int, const char *, void (*)(void *), void *);
 struct fdtbus_dma *fdtbus_dma_get_index(int, u_int, void (*)(void *),



CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 18:07:12 UTC 2018

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

Log Message:
Add helper to lookup syscon by phandle


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_syscon.c
cvs rdiff -u -r1.36 -r1.37 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/arch/arm/rockchip

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:54:08 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_cru.c rk_cru.h rk_cru_mux.c rk_cru_pll.c

Log Message:
Use syscon API.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_cru.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru.h \
src/sys/arch/arm/rockchip/rk_cru_mux.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_cru_pll.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/rockchip/rk_cru.c
diff -u src/sys/arch/arm/rockchip/rk_cru.c:1.3 src/sys/arch/arm/rockchip/rk_cru.c:1.4
--- src/sys/arch/arm/rockchip/rk_cru.c:1.3	Tue Jun 26 17:44:04 2018
+++ src/sys/arch/arm/rockchip/rk_cru.c	Sat Jun 30 17:54:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_cru.c,v 1.3 2018/06/26 17:44:04 jmcneill Exp $ */
+/* $NetBSD: rk_cru.c,v 1.4 2018/06/30 17:54:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -30,7 +30,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_cru.c,v 1.3 2018/06/26 17:44:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_cru.c,v 1.4 2018/06/30 17:54:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -300,19 +300,9 @@ rk_cru_attach(struct rk_cru_softc *sc)
 	int i;
 
 	if (of_hasprop(sc->sc_phandle, "rockchip,grf")) {
-		const int grf_phandle = fdtbus_get_phandle(sc->sc_phandle, "rockchip,grf");
-		if (grf_phandle == -1) {
-			aprint_error(": couldn't get grf phandle\n");
-			return ENXIO;
-		}
-
-		if (fdtbus_get_reg(grf_phandle, 0, , ) != 0) {
-			aprint_error(": couldn't get grf registers\n");
-			return ENXIO;
-		}
-
-		if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh_grf) != 0) {
-			aprint_error(": couldn't map registers\n");
+		sc->sc_grf = fdtbus_syscon_acquire(sc->sc_phandle, "rockchip,grf");
+		if (sc->sc_grf == NULL) {
+			aprint_error(": couldn't get grf syscon\n");
 			return ENXIO;
 		}
 	}

Index: src/sys/arch/arm/rockchip/rk_cru.h
diff -u src/sys/arch/arm/rockchip/rk_cru.h:1.1 src/sys/arch/arm/rockchip/rk_cru.h:1.2
--- src/sys/arch/arm/rockchip/rk_cru.h:1.1	Sat Jun 16 00:19:04 2018
+++ src/sys/arch/arm/rockchip/rk_cru.h	Sat Jun 30 17:54:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_cru.h,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */
+/* $NetBSD: rk_cru.h,v 1.2 2018/06/30 17:54:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -30,6 +30,7 @@
 #define _ARM_RK_CRU_H
 
 #include 
+#include 
 
 struct rk_cru_softc;
 struct rk_cru_clk;
@@ -293,7 +294,7 @@ struct rk_cru_softc {
 	int			sc_phandle;
 	bus_space_tag_t		sc_bst;
 	bus_space_handle_t	sc_bsh;
-	bus_space_handle_t	sc_bsh_grf;
+	struct syscon		*sc_grf;
 
 	struct clk_domain	sc_clkdom;
 
@@ -311,11 +312,6 @@ void	rk_cru_print(struct rk_cru_softc *)
 #define CRU_WRITE(sc, reg, val)	\
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
 
-#define	GRF_READ(sc, reg)	\
-	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh_grf, (reg))
-#define GRF_WRITE(sc, reg, val)	\
-	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh_grf, (reg), (val))
-
-#define	HAS_GRF(sc)	((sc)->sc_bsh_grf != 0)
+#define	HAS_GRF(sc)	((sc)->sc_grf != NULL)
 
 #endif /* _ARM_RK_CRU_H */
Index: src/sys/arch/arm/rockchip/rk_cru_mux.c
diff -u src/sys/arch/arm/rockchip/rk_cru_mux.c:1.1 src/sys/arch/arm/rockchip/rk_cru_mux.c:1.2
--- src/sys/arch/arm/rockchip/rk_cru_mux.c:1.1	Sat Jun 16 00:19:04 2018
+++ src/sys/arch/arm/rockchip/rk_cru_mux.c	Sat Jun 30 17:54:07 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_cru_mux.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */
+/* $NetBSD: rk_cru_mux.c,v 1.2 2018/06/30 17:54:07 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_cru_mux.c,v 1.1 2018/06/16 00:19:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_cru_mux.c,v 1.2 2018/06/30 17:54:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -42,13 +42,19 @@ rk_cru_mux_get_parent(struct rk_cru_soft
 {
 	struct rk_cru_mux *mux = >u.mux;
 	const bool mux_grf = (mux->flags & RK_MUX_GRF) != 0;
+	uint32_t val;
 
 	KASSERT(clk->type == RK_CRU_MUX);
 
-	if (mux_grf && !HAS_GRF(sc))
-		return NULL;
-
-	const uint32_t val = mux_grf ? GRF_READ(sc, mux->reg) : CRU_READ(sc, mux->reg);
+	if (mux_grf) {
+		if (!HAS_GRF(sc))
+			return NULL;
+		syscon_lock(sc->sc_grf);
+		val = syscon_read_4(sc->sc_grf, mux->reg);
+		syscon_unlock(sc->sc_grf);
+	} else {
+		val = CRU_READ(sc, mux->reg);
+	}
 	const u_int index = __SHIFTOUT(val, mux->mask);
 
 	return mux->parents[index];
@@ -71,9 +77,11 @@ rk_cru_mux_set_parent(struct rk_cru_soft
 			const uint32_t write_mask = mux->mask << 16;
 			const uint32_t write_val = __SHIFTIN(index, mux->mask);
 
-			if (mux_grf)
-GRF_WRITE(sc, mux->reg, write_mask | write_val);
-			else
+			if (mux_grf) {
+syscon_lock(sc->sc_grf);
+syscon_write_4(sc->sc_grf, mux->reg, write_mask | write_val);
+

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:54:08 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_cru.c rk_cru.h rk_cru_mux.c rk_cru_pll.c

Log Message:
Use syscon API.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_cru.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk_cru.h \
src/sys/arch/arm/rockchip/rk_cru_mux.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_cru_pll.c

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



Re: CVS commit: src/sys/dev/i2c

2018-06-30 Thread Frank Kardel

Hi Jason !

It is not so odd as your comment suggests. The I2C address is stored in 
the device EEPROM and perfectly survives a power off.


All we need to be able to is to explicitly configure the device at a 
different address. I hope this capability was not disabled with this 
check-in as that would make my second sensor at 0x29 useless and 
prohibit multiple sensors on a I2C bus.


For configuring the I2C address to a different value see the pkgsrc 
package hytctl.


Thanks for re-working the attachment logic.

Frank


On 06/16/18 23:24, Jason R Thorpe wrote:

Module Name:src
Committed By:   thorpej
Date:   Sat Jun 16 21:24:36 UTC 2018

Modified Files:
src/sys/dev/i2c: hytp14.c

Log Message:
More cleanup to i2c autoconfiguration:

- Get all of the drivers onto the new match quality constants.
- Introduce a new helper function, iic_use_direct_match(), that has
   all of the logic for direct-config matching.  If it returns true,
   the driver returns the match result (which may be 0).  If it returns
   false, the driver does indirect-config matching.
- iic_compat_match() now returns a weighted match quality; matches to
   lower-indexed "compatible" device property are more-specific matches,
   and return a better match quality accordingly.

XXX This driver is an odd-ball with respect to the hardware device.
See comments in the match routine.  Unclear how best to handle it.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/i2c/hytp14.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/cortex

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:30:37 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
ARM ARM refers to this as "ARM Generic Timer", so adjust printf at attach
to match.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/cortex/gtmr.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/cortex/gtmr.c
diff -u src/sys/arch/arm/cortex/gtmr.c:1.31 src/sys/arch/arm/cortex/gtmr.c:1.32
--- src/sys/arch/arm/cortex/gtmr.c:1.31	Sun Jun 24 19:04:30 2018
+++ src/sys/arch/arm/cortex/gtmr.c	Sat Jun 30 17:30:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gtmr.c,v 1.31 2018/06/24 19:04:30 ryo Exp $	*/
+/*	$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.31 2018/06/24 19:04:30 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr.c,v 1.32 2018/06/30 17:30:37 jmcneill Exp $");
 
 #include 
 #include 
@@ -152,7 +152,7 @@ gtmr_attach(device_t parent, device_t se
 	humanize_number(freqbuf, sizeof(freqbuf), sc->sc_freq, "Hz", 1000);
 
 	aprint_naive("\n");
-	aprint_normal(": ARMv7 Generic 64-bit Timer (%s)\n", freqbuf);
+	aprint_normal(": ARM Generic Timer (%s)\n", freqbuf);
 
 	/*
 	 * Enable the virtual counter to be accessed from usermode.



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:30:37 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gtmr.c

Log Message:
ARM ARM refers to this as "ARM Generic Timer", so adjust printf at attach
to match.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/cortex/gtmr.c

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:28:09 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
Store node path in device properties "fdt-path" property:

# drvctl -p ehci0 fdt-path
/soc/usb@5101000

While here, remove fdt_scan_bus (no longer required) and some debug printfs.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/fdtbus.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/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.21 src/sys/dev/fdt/fdtbus.c:1.22
--- src/sys/dev/fdt/fdtbus.c:1.21	Sat Jun 30 16:22:56 2018
+++ src/sys/dev/fdt/fdtbus.c	Sat Jun 30 17:28:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.21 2018/06/30 16:22:56 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.22 2018/06/30 17:28:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.21 2018/06/30 16:22:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.22 2018/06/30 17:28:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -71,7 +71,6 @@ struct fdt_softc {
 static int	fdt_match(device_t, cfdata_t, void *);
 static void	fdt_attach(device_t, device_t, void *);
 static int	fdt_scan_submatch(device_t, cfdata_t, const int *, void *);
-static void	fdt_scan_bus(device_t, const int);
 static void	fdt_scan(struct fdt_softc *, int);
 static void	fdt_add_node(struct fdt_node *);
 static u_int	fdt_get_order(int);
@@ -112,8 +111,7 @@ fdt_attach(device_t parent, device_t sel
 	struct fdt_softc *sc = device_private(self);
 	const struct fdt_attach_args *faa = aux;
 	const int phandle = faa->faa_phandle;
-	struct fdt_node *node;
-	const char *model;
+	const char *descr;
 	int pass;
 
 	sc->sc_dev = self;
@@ -121,34 +119,20 @@ fdt_attach(device_t parent, device_t sel
 	sc->sc_faa = *faa;
 
 	aprint_naive("\n");
-	model = fdtbus_get_string(phandle, "model");
-	if (model)
-		aprint_normal(": %s\n", model);
+
+	descr = fdtbus_get_string(phandle, "model");
+	if (descr)
+		aprint_normal(": %s\n", descr);
 	else
 		aprint_normal("\n");
 
 	/* Find all child nodes */
 	fdt_add_bus(self, phandle, >sc_faa);
 
-	/* Scan and attach all known busses in the tree. */
-	fdt_scan_bus(self, phandle);
-
 	/* Only the root bus should scan for devices */
 	if (OF_finddevice("/") != faa->faa_phandle)
 		return;
 
-	aprint_debug_dev(sc->sc_dev, "  order   phandle   buspath\n");
-	aprint_debug_dev(sc->sc_dev, "  =   ===   ===\n");
-	TAILQ_FOREACH(node, _nodes, n_nodes) {
-		char buf[FDT_MAX_PATH];
-		const char *path = buf;
-		if (!fdtbus_get_path(node->n_phandle, buf, sizeof(buf)))
-			path = node->n_name;
-		aprint_debug_dev(sc->sc_dev, "   %04x   0x%04x%s   %s\n",
-		node->n_order & 0x, node->n_phandle,
-		device_xname(node->n_bus), path);
-	}
-
 	/* Scan devices */
 	pass = 0;
 	fdt_need_rescan = false;
@@ -173,37 +157,6 @@ fdt_init_attach_args(const struct fdt_at
 	faa->faa_quiet = quiet;
 }
 
-static void
-fdt_scan_bus(device_t bus, const int phandle)
-{
-	struct fdt_node *node;
-	struct fdt_attach_args faa;
-	cfdata_t cf;
-
-	TAILQ_FOREACH(node, _nodes, n_nodes) {
-		if (node->n_bus != bus)
-			continue;
-		if (node->n_dev != NULL)
-			continue;
-
-		faa = node->n_faa;
-		faa.faa_quiet = true;
-
-		/*
-		 * Only attach busses to nodes where this driver is the best
-		 * match.
-		 */
-		cf = config_search_loc(NULL, node->n_bus, NULL, NULL, );
-		if (cf == NULL || strcmp(cf->cf_name, "fdt") != 0)
-			continue;
-
-		/*
-		 * Attach the bus.
-		 */
-		node->n_dev = config_found(node->n_bus, , fdtbus_print);
-	}
-}
-
 void
 fdt_add_bus(device_t bus, const int phandle, struct fdt_attach_args *faa)
 {
@@ -277,6 +230,8 @@ fdt_scan(struct fdt_softc *sc, int pass)
 		[FDTCF_PASS] = pass
 	};
 	bool quiet = pass != FDTCF_PASS_DEFAULT;
+	prop_dictionary_t dict;
+	char buf[FDT_MAX_PATH];
 
 	TAILQ_FOREACH(node, _nodes, n_nodes) {
 		if (node->n_dev != NULL)
@@ -298,6 +253,11 @@ fdt_scan(struct fdt_softc *sc, int pass)
 		 */
 		node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs,
 		, fdtbus_print, fdt_scan_submatch);
+		if (node->n_dev) {
+			dict = device_properties(node->n_dev);
+			if (fdtbus_get_path(node->n_phandle, buf, sizeof(buf)))
+prop_dictionary_set_cstring(dict, "fdt-path", buf);
+		}
 	}
 }
 



CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:28:09 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
Store node path in device properties "fdt-path" property:

# drvctl -p ehci0 fdt-path
/soc/usb@5101000

While here, remove fdt_scan_bus (no longer required) and some debug printfs.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/fdt/fdtbus.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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:15:01 UTC 2018

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

Log Message:
When cold, manually update timecounters before calling getnanouptime. Now
kernel printf timestamps are updated properly before interrupts are
enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/kern/subr_prf.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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 17:15:01 UTC 2018

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

Log Message:
When cold, manually update timecounters before calling getnanouptime. Now
kernel printf timestamps are updated properly before interrupts are
enabled.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/kern/subr_prf.c

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

Modified files:

Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.171 src/sys/kern/subr_prf.c:1.172
--- src/sys/kern/subr_prf.c:1.171	Sun Jun  3 15:26:03 2018
+++ src/sys/kern/subr_prf.c	Sat Jun 30 17:15:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.171 2018/06/03 15:26:03 jakllsch Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.171 2018/06/03 15:26:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.172 2018/06/30 17:15:01 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -68,6 +68,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -503,6 +504,9 @@ addtstamp(int flags, struct tty *tp)
 		log_ts_prec = prec;
 	}
 
+	if (cold)
+		tc_ticktock();
+
 	getnanouptime();
 
 	for (n = prec, fsec = ts.tv_nsec; n < 8; n++)



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:48:49 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT

Log Message:
Attach simplebus on pass 0


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/VIRT

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

Modified files:

Index: src/sys/arch/evbarm/conf/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.24 src/sys/arch/evbarm/conf/EXYNOS:1.25
--- src/sys/arch/evbarm/conf/EXYNOS:1.24	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/EXYNOS	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.24 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.25 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -38,7 +38,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # CPUs
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.3 src/sys/arch/evbarm/conf/GENERIC:1.4
--- src/sys/arch/evbarm/conf/GENERIC:1.3	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/GENERIC	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.3 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.4 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -54,7 +54,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # CPUs
 cpus*		at fdt? pass 0
Index: src/sys/arch/evbarm/conf/RPI64
diff -u src/sys/arch/evbarm/conf/RPI64:1.3 src/sys/arch/evbarm/conf/RPI64:1.4
--- src/sys/arch/evbarm/conf/RPI64:1.3	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/RPI64	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI64,v 1.3 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: RPI64,v 1.4 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	RPI64 - Raspberry Pi 3 and Pi 2 v1.2 in AARCH64 mode
 #
@@ -61,7 +61,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0 	at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # The CPU(s)
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.22 src/sys/arch/evbarm/conf/GENERIC64:1.23
--- src/sys/arch/evbarm/conf/GENERIC64:1.22	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.22 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.23 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -80,7 +80,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # CPUs
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.80 src/sys/arch/evbarm/conf/RPI:1.81
--- src/sys/arch/evbarm/conf/RPI:1.80	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/RPI	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.80 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: RPI,v 1.81 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -55,7 +55,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # The CPU(s)
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.77 src/sys/arch/evbarm/conf/SUNXI:1.78
--- src/sys/arch/evbarm/conf/SUNXI:1.77	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/SUNXI	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.77 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.78 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -168,7 +168,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-simplebus*	at fdt?
+simplebus*	at fdt? pass 0
 
 # CPUs
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/TEGRA
diff -u src/sys/arch/evbarm/conf/TEGRA:1.35 src/sys/arch/evbarm/conf/TEGRA:1.36
--- src/sys/arch/evbarm/conf/TEGRA:1.35	Sat Jun 30 16:30:35 2018
+++ src/sys/arch/evbarm/conf/TEGRA	Sat Jun 30 16:48:49 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: TEGRA,v 1.35 2018/06/30 16:30:35 jmcneill Exp $
+#	$NetBSD: TEGRA,v 1.36 2018/06/30 16:48:49 jmcneill Exp $
 #
 #	NVIDIA 

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:48:49 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT

Log Message:
Attach simplebus on pass 0


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/VIRT

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



CVS commit: src/sys

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:30:35 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT
src/sys/dev/fdt: cpus.c

Log Message:
cpus: use fdt_add_bus


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/VIRT
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/cpus.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/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.18 src/sys/arch/arm/fdt/files.fdt:1.19
--- src/sys/arch/arm/fdt/files.fdt:1.18	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/arm/fdt/files.fdt	Sat Jun 30 16:30:35 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.18 2018/06/30 16:22:56 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.19 2018/06/30 16:30:35 jmcneill Exp $
 
 include	"dev/pckbport/files.pckbport"
 
@@ -6,7 +6,7 @@ device	armfdt { }: bus_space_generic, fd
 attach	armfdt at root with arm_fdt
 file	arch/arm/fdt/arm_fdt.c			arm_fdt
 
-attach	cpu at cpus with cpu_fdt
+attach	cpu at fdt with cpu_fdt
 file	arch/arm/fdt/cpu_fdt.c			cpu_fdt
 
 device	cpufreqdt

Index: src/sys/arch/evbarm/conf/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.23 src/sys/arch/evbarm/conf/EXYNOS:1.24
--- src/sys/arch/evbarm/conf/EXYNOS:1.23	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/evbarm/conf/EXYNOS	Sat Jun 30 16:30:35 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.23 2018/06/30 16:22:56 jmcneill Exp $
+#	$NetBSD: EXYNOS,v 1.24 2018/06/30 16:30:35 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -42,7 +42,7 @@ simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0
-cpu*		at cpus?
+cpu*		at fdt? pass 0
 
 fclock*		at fdt? pass 4
 fregulator*	at fdt? pass 4

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.2 src/sys/arch/evbarm/conf/GENERIC:1.3
--- src/sys/arch/evbarm/conf/GENERIC:1.2	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/evbarm/conf/GENERIC	Sat Jun 30 16:30:35 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
+#	$NetBSD: GENERIC,v 1.3 2018/06/30 16:30:35 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -58,7 +58,7 @@ simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0
-cpu*		at cpus?
+cpu*		at fdt? pass 0
 
 # CPU frequency scaling
 cpufreqdt*	at cpu?
Index: src/sys/arch/evbarm/conf/RPI64
diff -u src/sys/arch/evbarm/conf/RPI64:1.2 src/sys/arch/evbarm/conf/RPI64:1.3
--- src/sys/arch/evbarm/conf/RPI64:1.2	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/evbarm/conf/RPI64	Sat Jun 30 16:30:35 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI64,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
+#	$NetBSD: RPI64,v 1.3 2018/06/30 16:30:35 jmcneill Exp $
 #
 #	RPI64 - Raspberry Pi 3 and Pi 2 v1.2 in AARCH64 mode
 #
@@ -65,7 +65,7 @@ simplebus*	at fdt?
 
 # The CPU(s)
 cpus*		at fdt? pass 0
-cpu*		at cpus?
+cpu*		at fdt? pass 0
 
 gtmr*		at fdt? pass 1		# ARM Generic Timer
 armgtmr0	at gtmr?

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.21 src/sys/arch/evbarm/conf/GENERIC64:1.22
--- src/sys/arch/evbarm/conf/GENERIC64:1.21	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Jun 30 16:30:35 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.21 2018/06/30 16:22:56 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.22 2018/06/30 16:30:35 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -84,7 +84,7 @@ simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0
-cpu*		at cpus?
+cpu*		at fdt? pass 0
 
 # CPU frequency scaling
 cpufreqdt*	at cpu?

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.79 src/sys/arch/evbarm/conf/RPI:1.80
--- src/sys/arch/evbarm/conf/RPI:1.79	Sat Jun 30 16:22:56 2018
+++ src/sys/arch/evbarm/conf/RPI	Sat Jun 30 16:30:35 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.79 2018/06/30 16:22:56 jmcneill Exp $
+#	$NetBSD: RPI,v 1.80 2018/06/30 16:30:35 jmcneill Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -59,7 +59,7 @@ simplebus*	at fdt?
 
 # The CPU(s)
 cpus*		at fdt? pass 0
-cpu*		at cpus?
+cpu*		at fdt? pass 0
 
 fclock*		at fdt? pass 0
 

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.76 src/sys/arch/evbarm/conf/SUNXI:1.77
--- src/sys/arch/evbarm/conf/SUNXI:1.76	Sat Jun 30 16:22:56 2018
+++ 

CVS commit: src/sys

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:30:35 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT
src/sys/dev/fdt: cpus.c

Log Message:
cpus: use fdt_add_bus


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/VIRT
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/cpus.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/rockchip

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:28:14 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Only install interrupt handler if dwc_gmac_attach succeeds.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:28:14 UTC 2018

Modified Files:
src/sys/arch/arm/rockchip: rk_gmac.c

Log Message:
Only install interrupt handler if dwc_gmac_attach succeeds.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/rockchip/rk_gmac.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/rockchip/rk_gmac.c
diff -u src/sys/arch/arm/rockchip/rk_gmac.c:1.3 src/sys/arch/arm/rockchip/rk_gmac.c:1.4
--- src/sys/arch/arm/rockchip/rk_gmac.c:1.3	Tue Jun 19 23:43:11 2018
+++ src/sys/arch/arm/rockchip/rk_gmac.c	Sat Jun 30 16:28:14 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_gmac.c,v 1.3 2018/06/19 23:43:11 jmcneill Exp $ */
+/* $NetBSD: rk_gmac.c,v 1.4 2018/06/30 16:28:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.3 2018/06/19 23:43:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_gmac.c,v 1.4 2018/06/30 16:28:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -311,13 +311,14 @@ rk_gmac_attach(device_t parent, device_t
 	aprint_naive("\n");
 	aprint_normal(": GMAC\n");
 
+	if (dwc_gmac_attach(sc, GMAC_MII_CLK_150_250M_DIV102) != 0)
+		return;
+
 	if (fdtbus_intr_establish(phandle, 0, IPL_NET, 0, rk_gmac_intr, sc) == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt on %s\n", intrstr);
 		return;
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
-
-	dwc_gmac_attach(sc, GMAC_MII_CLK_150_250M_DIV102);
 }
 
 CFATTACH_DECL_NEW(rk_gmac, sizeof(struct rk_gmac_softc),



CVS commit: src/sys/dev/ic

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:27:49 UTC 2018

Modified Files:
src/sys/dev/ic: dwc_gmac.c dwc_gmac_var.h

Log Message:
dwc_gmac_attach: return non-zero on failure


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_gmac_var.h

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

Modified files:

Index: src/sys/dev/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.50 src/sys/dev/ic/dwc_gmac.c:1.51
--- src/sys/dev/ic/dwc_gmac.c:1.50	Tue Jun 26 06:48:00 2018
+++ src/sys/dev/ic/dwc_gmac.c	Sat Jun 30 16:27:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.50 2018/06/26 06:48:00 msaitoh Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.51 2018/06/30 16:27:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.50 2018/06/26 06:48:00 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.51 2018/06/30 16:27:48 jmcneill Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -137,7 +137,7 @@ static void dwc_gmac_dump_ffilt(struct d
 #define DWCGMAC_MPSAFE	1
 #endif
 
-void
+int
 dwc_gmac_attach(struct dwc_gmac_softc *sc, uint32_t mii_clk)
 {
 	uint8_t enaddr[ETHER_ADDR_LEN];
@@ -189,7 +189,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	 * Init chip and do initial setup
 	 */
 	if (dwc_gmac_reset(sc) != 0)
-		return;	/* not much to cleanup, haven't attached yet */
+		return ENXIO;	/* not much to cleanup, haven't attached yet */
 	dwc_gmac_write_hwaddr(sc, enaddr);
 	aprint_normal_dev(sc->sc_dev, "Ethernet address: %s\n",
 	ether_sprintf(enaddr));
@@ -280,7 +280,8 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	GMAC_DEF_DMA_INT_MASK);
 	mutex_exit(sc->sc_lock);
 
-	return;
+	return 0;
+
 fail_2:
 	ifmedia_removeall(>mii_media);
 	mii_detach(mii, MII_PHY_ANY, MII_OFFSET_ANY);
@@ -292,6 +293,8 @@ fail:
 	dwc_gmac_free_tx_ring(sc, >sc_txq);
 	dwc_gmac_free_dma_rings(sc);
 	mutex_destroy(>sc_mdio_lock);
+
+	return ENXIO;
 }
 
 

Index: src/sys/dev/ic/dwc_gmac_var.h
diff -u src/sys/dev/ic/dwc_gmac_var.h:1.8 src/sys/dev/ic/dwc_gmac_var.h:1.9
--- src/sys/dev/ic/dwc_gmac_var.h:1.8	Sat Jun 16 00:15:00 2018
+++ src/sys/dev/ic/dwc_gmac_var.h	Sat Jun 30 16:27:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac_var.h,v 1.8 2018/06/16 00:15:00 jmcneill Exp $ */
+/* $NetBSD: dwc_gmac_var.h,v 1.9 2018/06/30 16:27:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -100,5 +100,5 @@ struct dwc_gmac_softc {
 	void (*sc_set_speed)(struct dwc_gmac_softc *, int);
 };
 
-void dwc_gmac_attach(struct dwc_gmac_softc*, uint32_t /*mii_clk*/);
+int dwc_gmac_attach(struct dwc_gmac_softc*, uint32_t /*mii_clk*/);
 int dwc_gmac_intr(struct dwc_gmac_softc*);



CVS commit: src/sys/dev/ic

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:27:49 UTC 2018

Modified Files:
src/sys/dev/ic: dwc_gmac.c dwc_gmac_var.h

Log Message:
dwc_gmac_attach: return non-zero on failure


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/dwc_gmac.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/dwc_gmac_var.h

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



CVS commit: src/sys

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:22:56 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT
src/sys/dev/fdt: fdtbus.c fdtvar.h files.fdt syscon.c

Log Message:
Allow nodes to attach child devices using the same sorting rules as used
by the simplebus driver.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/VIRT
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/syscon.c

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



CVS commit: src/sys

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 16:22:56 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: files.fdt
src/sys/arch/evbarm/conf: EXYNOS GENERIC GENERIC64 RPI RPI64 SUNXI
TEGRA TI VEXPRESS_A15 VIRT
src/sys/dev/fdt: fdtbus.c fdtvar.h files.fdt syscon.c

Log Message:
Allow nodes to attach child devices using the same sorting rules as used
by the simplebus driver.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/fdt/files.fdt
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/evbarm/conf/EXYNOS
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/GENERIC \
src/sys/arch/evbarm/conf/RPI64
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/evbarm/conf/RPI
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/evbarm/conf/SUNXI
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/TEGRA
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/TI
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/VEXPRESS_A15
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/VIRT
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/syscon.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/files.fdt
diff -u src/sys/arch/arm/fdt/files.fdt:1.17 src/sys/arch/arm/fdt/files.fdt:1.18
--- src/sys/arch/arm/fdt/files.fdt:1.17	Wed Jun 20 08:03:55 2018
+++ src/sys/arch/arm/fdt/files.fdt	Sat Jun 30 16:22:56 2018
@@ -1,8 +1,8 @@
-# $NetBSD: files.fdt,v 1.17 2018/06/20 08:03:55 hkenken Exp $
+# $NetBSD: files.fdt,v 1.18 2018/06/30 16:22:56 jmcneill Exp $
 
 include	"dev/pckbport/files.pckbport"
 
-device	armfdt { }: bus_space_generic, fdtbus
+device	armfdt { }: bus_space_generic, fdt
 attach	armfdt at root with arm_fdt
 file	arch/arm/fdt/arm_fdt.c			arm_fdt
 

Index: src/sys/arch/evbarm/conf/EXYNOS
diff -u src/sys/arch/evbarm/conf/EXYNOS:1.22 src/sys/arch/evbarm/conf/EXYNOS:1.23
--- src/sys/arch/evbarm/conf/EXYNOS:1.22	Tue Jun 20 20:20:02 2017
+++ src/sys/arch/evbarm/conf/EXYNOS	Sat Jun 30 16:22:56 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: EXYNOS,v 1.22 2017/06/20 20:20:02 skrll Exp $
+#	$NetBSD: EXYNOS,v 1.23 2018/06/30 16:22:56 jmcneill Exp $
 #
 #	Samsung Exynos SoC kernel
 #
@@ -38,7 +38,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-fdt*		at fdtbus?
+simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.1 src/sys/arch/evbarm/conf/GENERIC:1.2
--- src/sys/arch/evbarm/conf/GENERIC:1.1	Sun Apr  1 04:35:04 2018
+++ src/sys/arch/evbarm/conf/GENERIC	Sat Jun 30 16:22:56 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.1 2018/04/01 04:35:04 ryo Exp $
+#	$NetBSD: GENERIC,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -54,7 +54,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-fdt*		at fdtbus?
+simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0
Index: src/sys/arch/evbarm/conf/RPI64
diff -u src/sys/arch/evbarm/conf/RPI64:1.1 src/sys/arch/evbarm/conf/RPI64:1.2
--- src/sys/arch/evbarm/conf/RPI64:1.1	Sun Apr  1 04:35:04 2018
+++ src/sys/arch/evbarm/conf/RPI64	Sat Jun 30 16:22:56 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI64,v 1.1 2018/04/01 04:35:04 ryo Exp $
+#	$NetBSD: RPI64,v 1.2 2018/06/30 16:22:56 jmcneill Exp $
 #
 #	RPI64 - Raspberry Pi 3 and Pi 2 v1.2 in AARCH64 mode
 #
@@ -61,7 +61,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0 	at root
-fdt*		at fdtbus?
+simplebus*	at fdt?
 
 # The CPU(s)
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.20 src/sys/arch/evbarm/conf/GENERIC64:1.21
--- src/sys/arch/evbarm/conf/GENERIC64:1.20	Sat Jun 30 12:42:42 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Jun 30 16:22:56 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.20 2018/06/30 12:42:42 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.21 2018/06/30 16:22:56 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -80,7 +80,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-fdt*		at fdtbus?
+simplebus*	at fdt?
 
 # CPUs
 cpus*		at fdt? pass 0

Index: src/sys/arch/evbarm/conf/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.78 src/sys/arch/evbarm/conf/RPI:1.79
--- src/sys/arch/evbarm/conf/RPI:1.78	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/evbarm/conf/RPI	Sat Jun 30 16:22:56 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.78 2017/12/10 21:38:26 skrll Exp $
+#	$NetBSD: RPI,v 1.79 2018/06/30 16:22:56 jmcneill Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -55,7 +55,7 @@ config		netbsd		root on ? type ?
 
 # Device tree support
 armfdt0		at root
-fdt*		at fdtbus?
+simplebus*	at fdt?
 
 # The CPU(s)
 cpus*		at fdt? pass 0

Index: 

CVS commit: src/lib/libpuffs

2018-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 30 16:05:44 UTC 2018

Modified Files:
src/lib/libpuffs: puffs.c

Log Message:
use a switch.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/lib/libpuffs/puffs.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/libpuffs/puffs.c
diff -u src/lib/libpuffs/puffs.c:1.123 src/lib/libpuffs/puffs.c:1.124
--- src/lib/libpuffs/puffs.c:1.123	Thu Feb  8 04:05:17 2018
+++ src/lib/libpuffs/puffs.c	Sat Jun 30 12:05:44 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: puffs.c,v 1.123 2018/02/08 09:05:17 dholland Exp $	*/
+/*	$NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $	*/
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include 
 #if !defined(lint)
-__RCSID("$NetBSD: puffs.c,v 1.123 2018/02/08 09:05:17 dholland Exp $");
+__RCSID("$NetBSD: puffs.c,v 1.124 2018/06/30 16:05:44 christos Exp $");
 #endif /* !lint */
 
 #include 
@@ -904,21 +904,23 @@ puffs__theloop(struct puffs_cc *pcc)
 			}
 
 			what = 0;
-			if (curev->filter == EVFILT_READ) {
+			switch (curev->filter) {
+			case EVFILT_READ:
 puffs__framev_input(pu, pfctrl, fio);
 what |= PUFFS_FBIO_READ;
-			}
-
-			else if (curev->filter == EVFILT_WRITE) {
+break;
+			case EVFILT_WRITE:
 puffs__framev_output(pu, pfctrl, fio);
 what |= PUFFS_FBIO_WRITE;
-			}
-
-			else if (__predict_false(curev->filter==EVFILT_SIGNAL)){
+break;
+			case EVFILT_SIGNAL:
 if ((pu->pu_state & PU_DONEXIT) == 0) {
 	PU_SETSFLAG(pu, PU_DONEXIT);
 	puffs_exit(pu, 0);
 }
+break;
+			default:
+warn("unhandled filter %d", curev->filter);
 			}
 			if (what)
 puffs__framev_notify(fio, what);



CVS commit: src/lib/libpuffs

2018-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 30 16:05:44 UTC 2018

Modified Files:
src/lib/libpuffs: puffs.c

Log Message:
use a switch.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/lib/libpuffs/puffs.c

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



CVS commit: src/sys/net

2018-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 30 15:08:04 UTC 2018

Modified Files:
src/sys/net: if_arp.h

Log Message:
Provide an inline to return the data part of the arp packet instead of
open-coding it in multiple places.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_arp.h

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



CVS commit: src/sys/net

2018-06-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jun 30 15:08:04 UTC 2018

Modified Files:
src/sys/net: if_arp.h

Log Message:
Provide an inline to return the data part of the arp packet instead of
open-coding it in multiple places.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_arp.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/net/if_arp.h
diff -u src/sys/net/if_arp.h:1.32 src/sys/net/if_arp.h:1.33
--- src/sys/net/if_arp.h:1.32	Thu Apr 19 17:20:43 2018
+++ src/sys/net/if_arp.h	Sat Jun 30 11:08:04 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arp.h,v 1.32 2018/04/19 21:20:43 christos Exp $	*/
+/*	$NetBSD: if_arp.h,v 1.33 2018/06/30 15:08:04 christos Exp $	*/
 
 /*
  * Copyright (c) 1986, 1993
@@ -74,15 +74,21 @@ struct	arphdr {
 } __packed;
 
 static __inline uint8_t *
+ar_data(struct arphdr *ap)
+{
+	return (uint8_t *)(void *)(ap + 1);
+}
+
+static __inline uint8_t *
 ar_sha(struct arphdr *ap)
 {
-	return ((uint8_t *)(ap + 1)) + 0;
+	return ar_data(ap) + 0;
 }
 
 static __inline uint8_t *
 ar_spa(struct arphdr *ap)
 {
-	return ((uint8_t *)(ap + 1)) + ap->ar_hln;
+	return ar_data(ap) + ap->ar_hln;
 }
 
 static __inline uint8_t *
@@ -91,7 +97,7 @@ ar_tha(struct arphdr *ap)
 	if (ntohs(ap->ar_hrd) == ARPHRD_IEEE1394) {
 		return NULL;
 	} else {
-		return ((uint8_t *)(ap + 1)) + ap->ar_hln + ap->ar_pln;
+		return ar_data(ap) + ap->ar_hln + ap->ar_pln;
 	}
 }
 
@@ -99,10 +105,9 @@ static __inline uint8_t *
 ar_tpa(struct arphdr *ap)
 {
 	if (ntohs(ap->ar_hrd) == ARPHRD_IEEE1394) {
-		return ((uint8_t *)(ap + 1)) + ap->ar_hln + ap->ar_pln;
+		return ar_data(ap) + ap->ar_hln + ap->ar_pln;
 	} else {
-		return ((uint8_t *)(ap + 1)) + ap->ar_hln + ap->ar_pln +
-		ap->ar_hln;
+		return ar_data(ap) + ap->ar_hln + ap->ar_pln + ap->ar_hln;
 	}
 }
 



CVS commit: src/sys/arch/xen/xen

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:59:38 UTC 2018

Modified Files:
src/sys/arch/xen/xen: clock.c

Log Message:
Rearm the Xen timer on resume.

This just moves the timer-arming logic from xen_initclocks into
xen_resumeclocks so that it runs on resume too.

I hypothesize that this is necessary for Xen to resume.  Otherwise,
how could the one-shot timer possibly by rearmed?  On the other hand,
it is conceivable that something automatically rearms it.

This also reorders the initialization so that we establish a timer
interrupt handler first, and _then_ arm the timer.  If the order
matters, it is hard to imagine that the other way is correct:
conceivably, the interrupt could arrive before we've established the
handler, and then there's nothing to rearm it.

Whether this is _sufficient_ for Xen to resume, I don't know.
Symptoms recently reported in

look different from how I would expect this to manifest, which is as
a system wedged because there's no no hardclock activity.

ok cherry


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/clock.c

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

Modified files:

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.69 src/sys/arch/xen/xen/clock.c:1.70
--- src/sys/arch/xen/xen/clock.c:1.69	Sat Jun 30 14:21:19 2018
+++ src/sys/arch/xen/xen/clock.c	Sat Jun 30 14:59:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.69 2018/06/30 14:21:19 riastradh Exp $	*/
+/*	$NetBSD: clock.c,v 1.70 2018/06/30 14:59:38 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.69 2018/06/30 14:21:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.70 2018/06/30 14:59:38 riastradh Exp $");
 
 #include 
 #include 
@@ -740,8 +740,8 @@ xen_suspendclocks(struct cpu_info *ci)
 /*
  * xen_resumeclocks(ci)
  *
- *	Start handling the Xen timer event on the CPU of ci.  Caller
- *	must be running on and bound to ci's CPU.
+ *	Start handling the Xen timer event on the CPU of ci.  Arm the
+ *	Xen timer.  Caller must be running on and bound to ci's CPU.
  *
  *	Actually, caller must have kpreemption disabled, because that's
  *	easier to assert at the moment.
@@ -751,6 +751,7 @@ xen_resumeclocks(struct cpu_info *ci)
 {
 	char intr_xname[INTRDEVNAMEBUF];
 	int evtch;
+	int error;
 
 	KASSERT(ci == curcpu());
 	KASSERT(kpreempt_disabled());
@@ -772,6 +773,21 @@ xen_resumeclocks(struct cpu_info *ci)
 
 	aprint_verbose("Xen %s: using event channel %d\n", intr_xname, evtch);
 
+	/* Disarm the periodic timer on Xen>=3.1 which is allegedly buggy.  */
+	if (XEN_MAJOR(xen_version) > 3 || XEN_MINOR(xen_version) > 0) {
+		error = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
+		ci->ci_cpuid, NULL);
+		KASSERT(error == 0);
+	}
+
+	/* Pretend the last hardclock happened right now.  */
+	ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns();
+
+	/* Arm the one-shot timer.  */
+	error = HYPERVISOR_set_timer_op(ci->ci_xen_hardclock_systime_ns +
+	NS_PER_TICK);
+	KASSERT(error == 0);
+
 	/* We'd better not have switched CPUs.  */
 	KASSERT(ci == curcpu());
 }
@@ -848,7 +864,6 @@ void
 xen_initclocks(void)
 {
 	struct cpu_info *ci = curcpu();
-	int error;
 
 	/* If this is the primary CPU, do global initialization first.  */
 	if (ci == _info_primary) {
@@ -865,9 +880,6 @@ xen_initclocks(void)
 #endif
 	}
 
-	/* Pretend the last hardclock happened right now.  */
-	ci->ci_xen_hardclock_systime_ns = xen_vcputime_systime_ns();
-
 	/* Attach the event counters.  */
 	evcnt_attach_dynamic(>ci_xen_cpu_tsc_backwards_evcnt,
 	EVCNT_TYPE_INTR, NULL, device_xname(ci->ci_dev),
@@ -888,18 +900,6 @@ xen_initclocks(void)
 	EVCNT_TYPE_INTR, NULL, device_xname(ci->ci_dev),
 	"missed hardclock");
 
-	/* Disarm the periodic timer on Xen>=3.1 which is allegedly buggy.  */
-	if (XEN_MAJOR(xen_version) > 3 || XEN_MINOR(xen_version) > 0) {
-		error = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
-		ci->ci_cpuid, NULL);
-		KASSERT(error == 0);
-	}
-
-	/* Arm the timer.  */
-	error = HYPERVISOR_set_timer_op(ci->ci_xen_hardclock_systime_ns +
-	NS_PER_TICK);
-	KASSERT(error == 0);
-
 	/* Fire up the clocks.  */
 	xen_resumeclocks(ci);
 }



CVS commit: src/sys/arch/xen/xen

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:59:38 UTC 2018

Modified Files:
src/sys/arch/xen/xen: clock.c

Log Message:
Rearm the Xen timer on resume.

This just moves the timer-arming logic from xen_initclocks into
xen_resumeclocks so that it runs on resume too.

I hypothesize that this is necessary for Xen to resume.  Otherwise,
how could the one-shot timer possibly by rearmed?  On the other hand,
it is conceivable that something automatically rearms it.

This also reorders the initialization so that we establish a timer
interrupt handler first, and _then_ arm the timer.  If the order
matters, it is hard to imagine that the other way is correct:
conceivably, the interrupt could arrive before we've established the
handler, and then there's nothing to rearm it.

Whether this is _sufficient_ for Xen to resume, I don't know.
Symptoms recently reported in

look different from how I would expect this to manifest, which is as
a system wedged because there's no no hardclock activity.

ok cherry


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/xen/xen/clock.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/xen/xen

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:55:14 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
Use xcall to suspend/resume clocks on _all_ CPUs, not just current.

Compile-tested only -- kernel still runs but I haven't exercised this
code path.

By code inspection, this change or something like it is obviously
_necessary_ for Xen MP suspend/resume -- otherwise there's no logic
to suspend/resume the clocks on any CPU except the one that actually
triggers sysctl -w machdep.xen.suspend=1.

Whether this change is _sufficient_ for Xen MP suspend/resume to
work, I don't know.

ok cherry


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xen/xen_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/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.16 src/sys/arch/xen/xen/xen_machdep.c:1.17
--- src/sys/arch/xen/xen/xen_machdep.c:1.16	Sun Jun 24 20:28:58 2018
+++ src/sys/arch/xen/xen/xen_machdep.c	Sat Jun 30 14:55:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.16 2018/06/24 20:28:58 jdolecek Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.16 2018/06/24 20:28:58 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_machdep.c,v 1.17 2018/06/30 14:55:13 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -279,6 +279,9 @@ sysctl_xen_suspend(SYSCTLFN_ARGS)
 
 }
 
+static xcfunc_t xen_suspendclocks_xc;
+static xcfunc_t xen_resumeclocks_xc;
+
 /*
  * Last operations before suspending domain
  */
@@ -289,7 +292,7 @@ xen_prepare_suspend(void)
 	kpreempt_disable();
 
 	pmap_xen_suspend();
-	xen_suspendclocks(curcpu());
+	xc_wait(xc_broadcast(0, _suspendclocks_xc, NULL, NULL));
 
 	/*
 	 * save/restore code does not translate these MFNs to their
@@ -312,6 +315,15 @@ xen_prepare_suspend(void)
 
 }
 
+static void
+xen_suspendclocks_xc(void *a, void *b)
+{
+
+	kpreempt_disable();
+	xen_suspendclocks(curcpu());
+	kpreempt_enable();
+}
+
 /*
  * First operations before restoring domain context
  */
@@ -342,13 +354,22 @@ xen_prepare_resume(void)
 
 	xen_suspend_allow = false;
 
-	xen_resumeclocks(curcpu());
+	xc_wait(xc_broadcast(0, xen_resumeclocks_xc, NULL, NULL));
 
 	kpreempt_enable();
 
 }
 
 static void
+xen_resumeclocks_xc(void *a, void *b)
+{
+
+	kpreempt_disable();
+	xen_resumeclocks(curcpu());
+	kpreempt_enable();
+}
+
+static void
 xen_suspend_domain(void)
 {
 	paddr_t mfn;



CVS commit: src/sys/arch/xen/xen

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:55:14 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xen_machdep.c

Log Message:
Use xcall to suspend/resume clocks on _all_ CPUs, not just current.

Compile-tested only -- kernel still runs but I haven't exercised this
code path.

By code inspection, this change or something like it is obviously
_necessary_ for Xen MP suspend/resume -- otherwise there's no logic
to suspend/resume the clocks on any CPU except the one that actually
triggers sysctl -w machdep.xen.suspend=1.

Whether this change is _sufficient_ for Xen MP suspend/resume to
work, I don't know.

ok cherry


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xen/xen_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

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:21:20 UTC 2018

Modified Files:
src/sys/arch/x86/include: cpu.h
src/sys/arch/xen/xen: clock.c

Log Message:
Just use struct cpu_info members for the Xen clock state.

Silly to use percpu(9) for some things and struct cpu_info for
others.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/xen/xen/clock.c

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

Modified files:

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.93 src/sys/arch/x86/include/cpu.h:1.94
--- src/sys/arch/x86/include/cpu.h:1.93	Fri Jun 29 21:53:12 2018
+++ src/sys/arch/x86/include/cpu.h	Sat Jun 30 14:21:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.93 2018/06/29 21:53:12 riastradh Exp $	*/
+/*	$NetBSD: cpu.h,v 1.94 2018/06/30 14:21:19 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -253,6 +253,9 @@ struct cpu_info {
 	 */
 	uint64_t	ci_xen_systime_ns_skew;
 
+	/* Xen periodic timer interrupt handle.  */
+	struct intrhand	*ci_xen_timer_intrhand;
+
 	/* Event counters for various pathologies that might happen.  */
 	struct evcnt	ci_xen_cpu_tsc_backwards_evcnt;
 	struct evcnt	ci_xen_tsc_delta_negative_evcnt;

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.68 src/sys/arch/xen/xen/clock.c:1.69
--- src/sys/arch/xen/xen/clock.c:1.68	Fri Jun 29 21:53:12 2018
+++ src/sys/arch/xen/xen/clock.c	Sat Jun 30 14:21:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.68 2018/06/29 21:53:12 riastradh Exp $	*/
+/*	$NetBSD: clock.c,v 1.69 2018/06/30 14:21:19 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.68 2018/06/29 21:53:12 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.69 2018/06/30 14:21:19 riastradh Exp $");
 
 #include 
 #include 
@@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -111,11 +110,6 @@ static struct todr_chip_handle xen_todr_
 	.todr_settime = xen_rtc_set,
 };
 
-/*
- * xen timer interrupt handles -- per-CPU struct intrhand *
- */
-static struct percpu *xen_timer_ih_percpu __read_mostly;
-
 #ifdef DOM0OPS
 /*
  * xen timepush state:
@@ -724,22 +718,18 @@ xen_delay(unsigned n)
 void
 xen_suspendclocks(struct cpu_info *ci)
 {
-	struct intrhand **ihp, *ih;
 	int evtch;
 
 	KASSERT(ci == curcpu());
 	KASSERT(kpreempt_disabled());
+	KASSERT(ci->ci_xen_timer_intrhand != NULL);
 
 	evtch = unbind_virq_from_evtch(VIRQ_TIMER);
 	KASSERT(evtch != -1);
 
 	hypervisor_mask_event(evtch);
-	ihp = percpu_getref(xen_timer_ih_percpu);
-	ih = *ihp;
-	KASSERT(ih != NULL);
-	intr_disestablish(ih);
-	*ihp = NULL;
-	percpu_putref(xen_timer_ih_percpu);
+	intr_disestablish(ci->ci_xen_timer_intrhand);
+	ci->ci_xen_timer_intrhand = NULL;
 
 	aprint_verbose("Xen clock: removed event channel %d\n", evtch);
 
@@ -760,28 +750,23 @@ void
 xen_resumeclocks(struct cpu_info *ci)
 {
 	char intr_xname[INTRDEVNAMEBUF];
-	struct intrhand **ihp, *ih;
 	int evtch;
 
 	KASSERT(ci == curcpu());
 	KASSERT(kpreempt_disabled());
+	KASSERT(ci->ci_xen_timer_intrhand == NULL);
 
 	evtch = bind_virq_to_evtch(VIRQ_TIMER);
 	KASSERT(evtch != -1);
 
 	snprintf(intr_xname, sizeof(intr_xname), "%s clock",
 	device_xname(ci->ci_dev));
-
-	ihp = percpu_getref(xen_timer_ih_percpu);
-	KASSERT(*ihp == NULL);
 	/* XXX sketchy function pointer cast -- fix the API, please */
-	ih = intr_establish_xname(0, _pic, evtch, IST_LEVEL,
-	IPL_CLOCK, (int (*)(void *))xen_timer_handler, ci, true,
+	ci->ci_xen_timer_intrhand = intr_establish_xname(0, _pic, evtch,
+	IST_LEVEL, IPL_CLOCK, (int (*)(void *))xen_timer_handler, ci, true,
 	intr_xname);
-	if (ih == NULL)
+	if (ci->ci_xen_timer_intrhand == NULL)
 		panic("failed to establish timer interrupt handler");
-	*ihp = ih;
-	percpu_putref(xen_timer_ih_percpu);
 
 	hypervisor_enable_event(evtch);
 
@@ -867,10 +852,6 @@ xen_initclocks(void)
 
 	/* If this is the primary CPU, do global initialization first.  */
 	if (ci == _info_primary) {
-		/* Allocate the per-CPU interrupt handle array.  */
-		xen_timer_ih_percpu = percpu_alloc(sizeof(struct intrhand *));
-		KASSERT(xen_timer_ih_percpu != NULL);
-
 		/* Initialize the systemwide Xen timecounter.  */
 		tc_init(_timecounter);
 



CVS commit: src/sys/arch

2018-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Jun 30 14:21:20 UTC 2018

Modified Files:
src/sys/arch/x86/include: cpu.h
src/sys/arch/xen/xen: clock.c

Log Message:
Just use struct cpu_info members for the Xen clock state.

Silly to use percpu(9) for some things and struct cpu_info for
others.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/xen/xen/clock.c

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 13:44:51 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
When attaching child devices, consider the best match for all passes
instead of just the current pass. Fixes an issue where a driver with a
lower match number and early pass number will attach instead of a better
match on a later pass.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/fdtbus.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/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.19 src/sys/dev/fdt/fdtbus.c:1.20
--- src/sys/dev/fdt/fdtbus.c:1.19	Wed Jun 20 19:11:01 2018
+++ src/sys/dev/fdt/fdtbus.c	Sat Jun 30 13:44:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.19 2018/06/20 19:11:01 thorpej Exp $ */
+/* $NetBSD: fdtbus.c,v 1.20 2018/06/30 13:44:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.19 2018/06/20 19:11:01 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.20 2018/06/30 13:44:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -228,6 +228,34 @@ fdt_scan_submatch(device_t parent, cfdat
 	return config_stdsubmatch(parent, cf, locs, aux);
 }
 
+static cfdata_t
+fdt_scan_best(struct fdt_softc *sc, struct fdt_node *node)
+{
+	struct fdt_attach_args faa;
+	cfdata_t cf, best_cf;
+	int match, best_match;
+
+	best_cf = NULL;
+	best_match = 0;
+
+	for (int pass = 0; pass <= FDTCF_PASS_DEFAULT; pass++) {
+		const int locs[FDTCF_NLOCS] = {
+			[FDTCF_PASS] = pass
+		};
+		fdt_init_attach_args(sc, node, true, );
+		cf = config_search_loc(fdt_scan_submatch, node->n_bus, "fdt", locs, );
+		if (cf == NULL)
+			continue;
+		match = config_match(node->n_bus, cf, );
+		if (match > best_match) {
+			best_match = match;
+			best_cf = cf;
+		}
+	}
+
+	return best_cf;
+}
+
 static void
 fdt_scan(struct fdt_softc *sc, int pass)
 {
@@ -245,6 +273,15 @@ fdt_scan(struct fdt_softc *sc, int pass)
 		fdt_init_attach_args(sc, node, quiet, );
 
 		/*
+		 * Make sure we don't attach before a better match in a later pass.
+		 */
+		cfdata_t cf_best = fdt_scan_best(sc, node);
+		cfdata_t cf_pass =
+		config_search_loc(fdt_scan_submatch, node->n_bus, "fdt", locs, );
+		if (cf_best != cf_pass)
+			continue;
+
+		/*
 		 * Attach the device.
 		 */
 		node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs,



CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 13:44:51 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c

Log Message:
When attaching child devices, consider the best match for all passes
instead of just the current pass. Fixes an issue where a driver with a
lower match number and early pass number will attach instead of a better
match on a later pass.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/fdt/fdtbus.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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:42:42 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64 SUNXI

Log Message:
add syscon


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.74 -r1.75 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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.19 src/sys/arch/evbarm/conf/GENERIC64:1.20
--- src/sys/arch/evbarm/conf/GENERIC64:1.19	Wed Jun 27 16:38:40 2018
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Jun 30 12:42:42 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.19 2018/06/27 16:38:40 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.20 2018/06/30 12:42:42 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -100,6 +100,9 @@ gpiokeys*	at fdt?
 wskbd*		at gpiokeys? console ? mux 1
 gpioleds*	at fdt?
 
+# System Controller
+syscon*		at fdt? pass 1		# Generic System Controller
+
 # Timer
 gtmr*		at fdt? pass 1		# ARM Generic Timer
 armgtmr0	at gtmr?

Index: src/sys/arch/evbarm/conf/SUNXI
diff -u src/sys/arch/evbarm/conf/SUNXI:1.74 src/sys/arch/evbarm/conf/SUNXI:1.75
--- src/sys/arch/evbarm/conf/SUNXI:1.74	Wed Jun 27 16:38:11 2018
+++ src/sys/arch/evbarm/conf/SUNXI	Sat Jun 30 12:42:42 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: SUNXI,v 1.74 2018/06/27 16:38:11 jmcneill Exp $
+#	$NetBSD: SUNXI,v 1.75 2018/06/30 12:42:42 jmcneill Exp $
 #
 #	Allwinner sunxi family
 #
@@ -203,6 +203,9 @@ gpiokeys*	at fdt?
 wskbd*		at gpiokeys? console ? mux 1
 gpioleds*	at fdt?
 
+# System Controller
+syscon*		at fdt? pass 1		# Generic System Controller
+
 # SRAM controller
 sunxisramc*	at fdt? pass 4		# SRAM controller
 



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:42:42 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64 SUNXI

Log Message:
add syscon


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/conf/GENERIC64
cvs rdiff -u -r1.74 -r1.75 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/sunxi

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:36:13 UTC 2018

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

Log Message:
Use syscon API instead of mapping syscon registers ourselves.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/sunxi/sunxi_emac.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_emac.c
diff -u src/sys/arch/arm/sunxi/sunxi_emac.c:1.15 src/sys/arch/arm/sunxi/sunxi_emac.c:1.16
--- src/sys/arch/arm/sunxi/sunxi_emac.c:1.15	Tue Jun 26 06:47:58 2018
+++ src/sys/arch/arm/sunxi/sunxi_emac.c	Sat Jun 30 12:36:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_emac.c,v 1.15 2018/06/26 06:47:58 msaitoh Exp $ */
+/* $NetBSD: sunxi_emac.c,v 1.16 2018/06/30 12:36:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2016-2017 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "opt_net_mpsafe.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.15 2018/06/26 06:47:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c,v 1.16 2018/06/30 12:36:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_emac.c
 #include 
 
 #include 
+#include 
 
 #include 
 
@@ -167,12 +168,6 @@ struct sunxi_emac_rxring {
 	u_int			cur;
 };
 
-enum {
-	_RES_EMAC,
-	_RES_SYSCON,
-	_RES_NITEMS
-};
-
 struct sunxi_emac_softc {
 	device_t		dev;
 	int			phandle;
@@ -180,7 +175,7 @@ struct sunxi_emac_softc {
 	bus_space_tag_t		bst;
 	bus_dma_tag_t		dmat;
 
-	bus_space_handle_t	bsh[_RES_NITEMS];
+	bus_space_handle_t	bsh;
 	struct clk		*clk_ahb;
 	struct clk		*clk_ephy;
 	struct fdtbus_reset	*rst_ahb;
@@ -188,6 +183,8 @@ struct sunxi_emac_softc {
 	struct fdtbus_regulator	*reg_phy;
 	struct fdtbus_gpio_pin	*pin_reset;
 
+	struct syscon		*syscon;
+
 	int			phy_id;
 
 	kmutex_t		mtx;
@@ -202,14 +199,9 @@ struct sunxi_emac_softc {
 };
 
 #define	RD4(sc, reg)			\
-	bus_space_read_4((sc)->bst, (sc)->bsh[_RES_EMAC], (reg))
+	bus_space_read_4((sc)->bst, (sc)->bsh, (reg))
 #define	WR4(sc, reg, val)		\
-	bus_space_write_4((sc)->bst, (sc)->bsh[_RES_EMAC], (reg), (val))
-
-#define	SYSCONRD4(sc, reg)		\
-	bus_space_read_4((sc)->bst, (sc)->bsh[_RES_SYSCON], (reg))
-#define	SYSCONWR4(sc, reg, val)		\
-	bus_space_write_4((sc)->bst, (sc)->bsh[_RES_SYSCON], (reg), (val))
+	bus_space_write_4((sc)->bst, (sc)->bsh, (reg), (val))
 
 static int
 sunxi_emac_mii_readreg(device_t dev, int phy, int reg)
@@ -925,7 +917,8 @@ sunxi_emac_setup_phy(struct sunxi_emac_s
 
 	aprint_debug_dev(sc->dev, "PHY type: %s\n", phy_type);
 
-	reg = SYSCONRD4(sc, 0);
+	syscon_lock(sc->syscon);
+	reg = syscon_read_4(sc->syscon, EMAC_CLK_REG);
 
 	reg &= ~(EMAC_CLK_PIT | EMAC_CLK_SRC | EMAC_CLK_RMII_EN);
 	if (strcmp(phy_type, "rgmii") == 0)
@@ -972,7 +965,8 @@ sunxi_emac_setup_phy(struct sunxi_emac_s
 
 	aprint_debug_dev(sc->dev, "EMAC clock: 0x%08x\n", reg);
 
-	SYSCONWR4(sc, 0, reg);
+	syscon_write_4(sc->syscon, EMAC_CLK_REG, reg);
+	syscon_unlock(sc->syscon);
 
 	return 0;
 }
@@ -1298,26 +1292,12 @@ sunxi_emac_get_resources(struct sunxi_em
 	/* Map EMAC registers */
 	if (fdtbus_get_reg(phandle, 0, , ) != 0)
 		return ENXIO;
-	if (bus_space_map(sc->bst, addr, size, 0, >bsh[_RES_EMAC]) != 0)
+	if (bus_space_map(sc->bst, addr, size, 0, >bsh) != 0)
 		return ENXIO;
 
-	/* Map SYSCON registers */
-	if (of_hasprop(phandle, "syscon")) {
-		const int syscon_phandle = fdtbus_get_phandle(phandle,
-		"syscon");
-		if (syscon_phandle == -1)
-			return ENXIO;
-		if (fdtbus_get_reg(syscon_phandle, 0, , ) != 0)
-			return ENXIO;
-		if (size < EMAC_CLK_REG + 4)
-			return ENXIO;
-		addr += EMAC_CLK_REG;
-		size -= EMAC_CLK_REG;
-	} else {
-		if (fdtbus_get_reg(phandle, 1, , ) != 0)
-			return ENXIO;
-	}
-	if (bus_space_map(sc->bst, addr, size, 0, >bsh[_RES_SYSCON]) != 0)
+	/* Get SYSCON registers */
+	sc->syscon = fdtbus_syscon_acquire(phandle, "syscon");
+	if (sc->syscon == NULL)
 		return ENXIO;
 
 	/* The "ahb"/"stmmaceth" clock and reset is required */



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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:36:13 UTC 2018

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

Log Message:
Use syscon API instead of mapping syscon registers ourselves.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/sunxi/sunxi_emac.c

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:35:18 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtvar.h files.fdt
Added Files:
src/sys/dev/fdt: fdt_syscon.c syscon.c syscon.h

Log Message:
Add support for system controller nodes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_syscon.c src/sys/dev/fdt/syscon.c \
src/sys/dev/fdt/syscon.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/fdt/files.fdt

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:35:18 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtvar.h files.fdt
Added Files:
src/sys/dev/fdt: fdt_syscon.c syscon.c syscon.h

Log Message:
Add support for system controller nodes.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_syscon.c src/sys/dev/fdt/syscon.c \
src/sys/dev/fdt/syscon.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/fdt/files.fdt

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/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.34 src/sys/dev/fdt/fdtvar.h:1.35
--- src/sys/dev/fdt/fdtvar.h:1.34	Tue Jun 12 10:28:55 2018
+++ src/sys/dev/fdt/fdtvar.h	Sat Jun 30 12:35:18 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.34 2018/06/12 10:28:55 jmcneill Exp $ */
+/* $NetBSD: fdtvar.h,v 1.35 2018/06/30 12:35:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -210,6 +210,8 @@ struct fdtbus_mmc_pwrseq_func {
 	void	(*reset)(device_t);
 };
 
+struct syscon;
+
 struct fdt_console {
 	int	(*match)(int);
 	void	(*consinit)(struct fdt_attach_args *, u_int);
@@ -256,6 +258,7 @@ int		fdtbus_register_pwm_controller(devi
 		const struct fdtbus_pwm_controller_func *);
 int		fdtbus_register_mmc_pwrseq(device_t, int,
 		const struct fdtbus_mmc_pwrseq_func *);
+int		fdtbus_register_syscon(device_t, int, struct syscon *);
 
 void		fdtbus_set_decoderegprop(bool);
 
@@ -292,6 +295,7 @@ int		fdtbus_regulator_set_voltage(struct
 		u_int, u_int);
 int		fdtbus_regulator_get_voltage(struct fdtbus_regulator *,
 		u_int *);
+struct syscon *	fdtbus_syscon_acquire(int, const char *);
 
 struct fdtbus_dma *fdtbus_dma_get(int, const char *, void (*)(void *), void *);
 struct fdtbus_dma *fdtbus_dma_get_index(int, u_int, void (*)(void *),

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.33 src/sys/dev/fdt/files.fdt:1.34
--- src/sys/dev/fdt/files.fdt:1.33	Sat Jun 30 10:50:30 2018
+++ src/sys/dev/fdt/files.fdt	Sat Jun 30 12:35:18 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.33 2018/06/30 10:50:30 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.34 2018/06/30 12:35:18 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -59,6 +59,7 @@ file	dev/fdt/fdt_pwm.c			fdtbus
 file	dev/fdt/fdt_regulator.c			fdtbus
 file	dev/fdt/fdt_reset.c			fdtbus
 file	dev/fdt/fdt_rtc.c			fdtbus
+file	dev/fdt/fdt_syscon.c			fdtbus
 file	dev/fdt/fdt_pinctrl.c			fdtbus
 
 device	cpus { } : fdtbus
@@ -69,6 +70,10 @@ device	mmcpwrseq
 attach	mmcpwrseq at fdt
 file	dev/fdt/mmc_pwrseq_simple.c		mmcpwrseq
 
+device	syscon
+attach	syscon at fdt
+file	dev/fdt/syscon.c			syscon
+
 device	pwmbacklight
 attach	pwmbacklight at fdt
 file	dev/fdt/pwm_backlight.c			pwmbacklight

Added files:

Index: src/sys/dev/fdt/fdt_syscon.c
diff -u /dev/null src/sys/dev/fdt/fdt_syscon.c:1.1
--- /dev/null	Sat Jun 30 12:35:18 2018
+++ src/sys/dev/fdt/fdt_syscon.c	Sat Jun 30 12:35:18 2018
@@ -0,0 +1,98 @@
+/* $NetBSD: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 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: fdt_syscon.c,v 1.1 2018/06/30 12:35:18 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+struct syscon;
+
+struct fdtbus_syscon {
+	device_t sc_dev;
+	int sc_phandle;
+	struct syscon *sc_syscon;
+
+	LIST_ENTRY(fdtbus_syscon) sc_next;
+};
+
+LIST_HEAD(fdtbus_syscon_h, fdtbus_syscon);
+static struct fdtbus_syscon_h fdtbus_syscons =
+	LIST_HEAD_INITIALIZER(fdtbus_syscons);
+
+int

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

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:23:24 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun8i-a83t-bananapi-m3.dts sun8i-a83t.dtsi

Log Message:
No need to define our own emac node as this is in the upstream dts now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts \
src/sys/arch/arm/dts/sun8i-a83t.dtsi

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/dts

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 12:23:24 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun8i-a83t-bananapi-m3.dts sun8i-a83t.dtsi

Log Message:
No need to define our own emac node as this is in the upstream dts now.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts \
src/sys/arch/arm/dts/sun8i-a83t.dtsi

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/dts/sun8i-a83t-bananapi-m3.dts
diff -u src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts:1.1 src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts:1.2
--- src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts:1.1	Sat Oct 28 16:09:14 2017
+++ src/sys/arch/arm/dts/sun8i-a83t-bananapi-m3.dts	Sat Jun 30 12:23:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-a83t-bananapi-m3.dts,v 1.1 2017/10/28 16:09:14 jmcneill Exp $ */
+/* $NetBSD: sun8i-a83t-bananapi-m3.dts,v 1.2 2018/06/30 12:23:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,19 +28,3 @@
 
 #include "../../../external/gpl2/dts/dist/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts"
 #include "sun8i-a83t.dtsi"
-
- {
-	pinctrl-names = "default";
-	pinctrl-0 = <_pins_rgmii_a>;
-	phy-mode = "rgmii";
-	phy = <>;
-	status = "okay";
-
-	/* EMAC transmit/receive clock delay chain values for BPI-M3 */
-	tx-delay = <0x7>;
-	rx-delay = <0x7>;
-
-	phy1: ethernet-phy@1 {
-		reg = <1>;
-	};
-};
Index: src/sys/arch/arm/dts/sun8i-a83t.dtsi
diff -u src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.1 src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.2
--- src/sys/arch/arm/dts/sun8i-a83t.dtsi:1.1	Sat Oct 28 16:09:14 2017
+++ src/sys/arch/arm/dts/sun8i-a83t.dtsi	Sat Jun 30 12:23:24 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: sun8i-a83t.dtsi,v 1.1 2017/10/28 16:09:14 jmcneill Exp $ */
+/* $NetBSD: sun8i-a83t.dtsi,v 1.2 2018/06/30 12:23:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -39,30 +39,4 @@
 			status = "disabled";
 		};
 	};
-
-	soc {
-		emac: ethernet@1c3 {
-			compatible = "allwinner,sun8i-a83t-emac";
-			reg = <0x01c3 0x104>, <0x01c00030 0x4>;
-			reg-names = "emac", "syscon";
-			interrupts = ;
-			resets = < RST_BUS_EMAC>;
-			reset-names = "ahb";
-			clocks = < CLK_BUS_EMAC>;
-			clock-names = "ahb";
-			#address-cells = <1>;
-			#size-cells = <0>;
-			status = "disabled";
-		};
-	};
-};
-
- {
-	emac_pins_rgmii_a: emac_rgmii@0 {
-		pins = "PD2", "PD3", "PD4", "PD5", "PD6", "PD7",
-		   "PD11", "PD12", "PD13", "PD14",
-		   "PD18", "PD19", "PD20", "PD21", "PD22", "PD23";
-		function = "emac";
-		drive-strength = <40>;
-	};
 };



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:45:14 UTC 2018

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

Log Message:
Ticket #1550


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

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

Modified files:

Index: src/doc/CHANGES-6.0.7
diff -u src/doc/CHANGES-6.0.7:1.1.2.146 src/doc/CHANGES-6.0.7:1.1.2.147
--- src/doc/CHANGES-6.0.7:1.1.2.146	Thu Jun  7 18:07:26 2018
+++ src/doc/CHANGES-6.0.7	Sat Jun 30 11:45:14 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.7,v 1.1.2.146 2018/06/07 18:07:26 martin Exp $
+# $NetBSD: CHANGES-6.0.7,v 1.1.2.147 2018/06/30 11:45:14 martin Exp $
 
 A complete list of changes from the NetBSD 6.0.6 release to the NetBSD 6.0.7
 release:
@@ -15496,3 +15496,8 @@ sys/arch/sparc64/conf/NONPLUS(patch)
 	[maxv, ticket #1500]
 
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1550]
+



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:45:14 UTC 2018

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

Log Message:
Ticket #1550


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

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



CVS commit: [netbsd-6-0] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:44:32 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6-0]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.28.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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



CVS commit: [netbsd-6-0] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:44:32 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6-0]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.28.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.28.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sat Jun 30 11:44:32 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:43:53 UTC 2018

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

Log Message:
Ticket #1550


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

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



CVS commit: [netbsd-6-1] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:43:18 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6-1]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.32.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:43:53 UTC 2018

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

Log Message:
Ticket #1550


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

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

Modified files:

Index: src/doc/CHANGES-6.1.6
diff -u src/doc/CHANGES-6.1.6:1.1.2.144 src/doc/CHANGES-6.1.6:1.1.2.145
--- src/doc/CHANGES-6.1.6:1.1.2.144	Thu Jun  7 18:04:56 2018
+++ src/doc/CHANGES-6.1.6	Sat Jun 30 11:43:53 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.6,v 1.1.2.144 2018/06/07 18:04:56 martin Exp $
+# $NetBSD: CHANGES-6.1.6,v 1.1.2.145 2018/06/30 11:43:53 martin Exp $
 
 A complete list of changes from the NetBSD 6.1.5 release to the NetBSD 6.1.6
 release:
@@ -15170,3 +15170,8 @@ sys/arch/sparc64/conf/NONPLUS(patch)
 	Disable autoload of modules for svr4/svr4_32/ibcs2/freebsd.
 	[maxv, ticket #1500]
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1550]
+



CVS commit: [netbsd-6-1] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:43:18 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6-1]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.32.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.32.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sat Jun 30 11:43:18 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



CVS commit: [netbsd-6] src/doc

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:42:34 UTC 2018

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

Log Message:
Ticket #1550


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

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.341 src/doc/CHANGES-6.2:1.1.2.342
--- src/doc/CHANGES-6.2:1.1.2.341	Thu Jun  7 18:03:14 2018
+++ src/doc/CHANGES-6.2	Sat Jun 30 11:42:34 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.341 2018/06/07 18:03:14 martin Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.342 2018/06/30 11:42:34 martin Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -21281,3 +21281,8 @@ sys/arch/sparc64/conf/NONPLUS(patch)
 	[maxv, ticket #1500]
 
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1550]
+



CVS commit: [netbsd-6] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:41:58 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.26.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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



CVS commit: [netbsd-6] src/doc

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:42:34 UTC 2018

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

Log Message:
Ticket #1550


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

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



CVS commit: [netbsd-6] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:41:58 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-6]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1550:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.26.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.26.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sat Jun 30 11:41:58 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:37:26 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.107 -r1.1.2.108 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.107 src/doc/CHANGES-7.0.3:1.1.2.108
--- src/doc/CHANGES-7.0.3:1.1.2.107	Thu Jun 14 19:49:28 2018
+++ src/doc/CHANGES-7.0.3	Sat Jun 30 11:37:26 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.107 2018/06/14 19:49:28 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.108 2018/06/30 11:37:26 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5464,3 +5464,8 @@ share/i18n/esdb/ISO-8859/ISO-8859.alias	
 	Add more aliases for Hebrew and Arabic ISO-8859-... encodings.
 	[maya, ticket #1616]
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1618]
+



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:37:26 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.107 -r1.1.2.108 src/doc/CHANGES-7.0.3

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



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:36:29 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/doc/CHANGES-7.1.3

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



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

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:36:29 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.14 -r1.1.2.15 src/doc/CHANGES-7.1.3

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

Modified files:

Index: src/doc/CHANGES-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.14 src/doc/CHANGES-7.1.3:1.1.2.15
--- src/doc/CHANGES-7.1.3:1.1.2.14	Thu Jun 14 19:48:06 2018
+++ src/doc/CHANGES-7.1.3	Sat Jun 30 11:36:29 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.14 2018/06/14 19:48:06 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.15 2018/06/30 11:36:29 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -156,3 +156,8 @@ share/i18n/esdb/ISO-8859/ISO-8859.alias	
 	Add more aliases for Hebrew and Arabic ISO-8859-... encodings.
 	[maya, ticket #1616]
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1618]
+



CVS commit: [netbsd-7-1] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:35:28 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-7-1]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1618:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.40.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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



CVS commit: [netbsd-7-1] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:35:28 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-7-1]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1618:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.40.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.40.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sat Jun 30 11:35:28 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



CVS commit: [netbsd-7] src/doc

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:34:39 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.93 src/doc/CHANGES-7.2:1.1.2.94
--- src/doc/CHANGES-7.2:1.1.2.93	Sat Jun 23 10:44:47 2018
+++ src/doc/CHANGES-7.2	Sat Jun 30 11:34:39 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.93 2018/06/23 10:44:47 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.94 2018/06/30 11:34:39 martin Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -5551,3 +5551,8 @@ external/gpl3/gcc/dist/libstdc++-v3/incl
 	have broken ABI's and cabsl does not exist.
 	[maya, ticket #1617]
 
+xsrc/xfree/xc/programs/mkfontscale/ident.c	(apply patch)
+
+	Pass gzFile, not gzFile * to gzio functions.
+	[mrg, ticket #1618]
+



CVS commit: [netbsd-7] src/doc

2018-06-30 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Jun 30 11:34:39 UTC 2018

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

Log Message:
Ticket #1618


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-7.2

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



CVS commit: [netbsd-7] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:33:49 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-7]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1618:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.36.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.c

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

Modified files:

Index: xsrc/xfree/xc/programs/mkfontscale/ident.c
diff -u xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1 xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1.36.1
--- xsrc/xfree/xc/programs/mkfontscale/ident.c:1.1.1.1	Fri Mar  5 14:26:48 2004
+++ xsrc/xfree/xc/programs/mkfontscale/ident.c	Sat Jun 30 11:33:49 2018
@@ -213,7 +213,7 @@ pcfIdentify(gzFile f, char **name)
 #define NKEY 20
 
 static char*
-getKeyword(gzFile *f, int *eol)
+getKeyword(gzFile f, int *eol)
 {
 static char keyword[NKEY + 1];
 int c, i;
@@ -236,7 +236,7 @@ getKeyword(gzFile *f, int *eol)
 }
 
 static int
-bdfskip(gzFile *f)
+bdfskip(gzFile f)
 {
 int c;
 do {
@@ -248,7 +248,7 @@ bdfskip(gzFile *f)
 }
 
 static char *
-bdfend(gzFile *f)
+bdfend(gzFile f)
 {
 int c;
 char *buf = NULL;



CVS commit: [netbsd-7] xsrc/xfree/xc/programs/mkfontscale

2018-06-30 Thread Martin Husemann
Module Name:xsrc
Committed By:   martin
Date:   Sat Jun 30 11:33:49 UTC 2018

Modified Files:
xsrc/xfree/xc/programs/mkfontscale [netbsd-7]: ident.c

Log Message:
Apply patch, requested by mrg in ticket #1618:

xsrc/xfree/xc/programs/mkfontscale/ident.c  (patch)

Pass gzFile, not gzFile * to gzio functions.
Should fix PR toolchain/53415.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.36.1 \
xsrc/xfree/xc/programs/mkfontscale/ident.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

2018-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 30 11:10:54 UTC 2018

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

Log Message:
Fix module build.

Options SUIDSCRIPTS and FDSCRIPTS will be off for the module.
If one (or both) should be enabled, add it to CPPFLAGSin the module Makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/exec_script.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

2018-06-30 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sat Jun 30 11:10:54 UTC 2018

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

Log Message:
Fix module build.

Options SUIDSCRIPTS and FDSCRIPTS will be off for the module.
If one (or both) should be enabled, add it to CPPFLAGSin the module Makefile.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/exec_script.c

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

Modified files:

Index: src/sys/kern/exec_script.c
diff -u src/sys/kern/exec_script.c:1.76 src/sys/kern/exec_script.c:1.77
--- src/sys/kern/exec_script.c:1.76	Sat Jun 30 00:37:37 2018
+++ src/sys/kern/exec_script.c	Sat Jun 30 11:10:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_script.c,v 1.76 2018/06/30 00:37:37 christos Exp $	*/
+/*	$NetBSD: exec_script.c,v 1.77 2018/06/30 11:10:54 kre Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,9 +31,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.76 2018/06/30 00:37:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.77 2018/06/30 11:10:54 kre Exp $");
 
+#ifdef _KERNEL_OPT
 #include "opt_script.h"
+#endif
 
 #if defined(SETUIDSCRIPTS) && !defined(FDSCRIPTS)
 #define FDSCRIPTS		/* Need this for safe set-id scripts. */



CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 10:50:30 UTC 2018

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: dwcwdt_fdt.c

Log Message:
Add driver for DesignWare Watchdog Timer. Untested as I can't seem to find
the parent clock for this in the RK3328 documentation.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/dwcwdt_fdt.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/fdt/files.fdt

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/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.32 src/sys/dev/fdt/files.fdt:1.33
--- src/sys/dev/fdt/files.fdt:1.32	Sat Jun 16 00:19:04 2018
+++ src/sys/dev/fdt/files.fdt	Sat Jun 30 10:50:30 2018
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.32 2018/06/16 00:19:04 jmcneill Exp $
+# $NetBSD: files.fdt,v 1.33 2018/06/30 10:50:30 jmcneill Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -100,6 +100,11 @@ file	dev/fdt/dwc3_fdt.c			dwc3_fdt
 attach	dwcmmc at fdt with dwcmmc_fdt
 file	dev/fdt/dwcmmc_fdt.c			dwcmmc_fdt
 
+# Designware Watchdog Timer
+device	dwcwdt: sysmon_wdog
+attach	dwcwdt at fdt with dwcwdt_fdt
+file	dev/fdt/dwcwdt_fdt.c			dwcwdt_fdt
+
 # Virtio virtio,mmio
 attach	virtio at fdt with virtio_mmio_fdt:	virtio_mmio
 file	dev/fdt/virtio_mmio_fdt.c		virtio_mmio_fdt

Added files:

Index: src/sys/dev/fdt/dwcwdt_fdt.c
diff -u /dev/null src/sys/dev/fdt/dwcwdt_fdt.c:1.1
--- /dev/null	Sat Jun 30 10:50:30 2018
+++ src/sys/dev/fdt/dwcwdt_fdt.c	Sat Jun 30 10:50:30 2018
@@ -0,0 +1,225 @@
+/* $NetBSD: dwcwdt_fdt.c,v 1.1 2018/06/30 10:50:30 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2018 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: dwcwdt_fdt.c,v 1.1 2018/06/30 10:50:30 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	WDT_CR0x00
+#define	 WDT_CR_RST_PULSE_LENGTH	__BITS(4,2)
+#define	 WDT_CR_RESP_MODE		__BIT(1)
+#define	 WDT_CR_WDT_EN			__BIT(0)
+
+#define	WDT_TORR			0x04
+#define	 WDT_TORR_TIMEOUT_PERIOD	__BITS(3,0)
+
+#define	WDT_CCVR			0x08
+
+#define	WDT_CRR0x0c
+#define	 WDT_CRR_CNT_RESTART		__BITS(7,0)
+#define	  WDT_CRR_CNT_RESTART_MAGIC	0x76
+
+#define	WDT_STAT			0x10
+#define	 WDT_STAT_WDT_STATUS		__BIT(0)
+
+#define	WDT_EOI0x14
+#define	 WDT_EOI_WDT_INT_CLR		__BIT(0)
+
+static const uint8_t wdt_torr[] = {
+	0x,
+	0x0001,
+	0x0003,
+	0x0007,
+	0x000f,
+	0x001f,
+	0x003f,
+	0x007f,
+	0x00ff,
+	0x01ff,
+	0x03ff,
+	0x07ff,
+	0x0fff,
+	0x1fff,
+	0x3fff,
+	0x7fff,
+};
+
+#define	DWCWDT_PERIOD_DEFAULT		15
+
+static const char * const compatible[] = {
+	"snps,dw-wdt",
+	NULL
+};
+
+struct dwcwdt_softc {
+	device_t sc_dev;
+	bus_space_tag_t sc_bst;
+	bus_space_handle_t sc_bsh;
+	struct sysmon_wdog sc_smw;
+	u_int sc_clkrate;
+};
+
+#define RD4(sc, reg) \
+	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
+#define WR4(sc, reg, val) \
+	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
+
+static int
+dwcwdt_map_period(struct dwcwdt_softc *sc, u_int period,
+u_int *aperiod)
+{
+	int i;
+
+	if (period == 0)
+		return -1;
+
+	for (i = 0; i < __arraycount(wdt_torr); i++) {
+		const u_int ms = (u_int)uint64_t)wdt_torr[i] + 1) * 1000) / sc->sc_clkrate);
+		if (ms >= period) {
+			*aperiod = ms;
+			return i;
+		}
+	}
+
+	return -1;
+}
+
+static int
+dwcwdt_setmode(struct sysmon_wdog *smw)
+{
+	struct dwcwdt_softc * const sc = smw->smw_cookie;
+	uint32_t cr, torr;
+	int intv;
+
+	if ((smw->smw_mode & WDOG_MODE_MASK) 

CVS commit: src/sys/dev/fdt

2018-06-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Jun 30 10:50:30 UTC 2018

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: dwcwdt_fdt.c

Log Message:
Add driver for DesignWare Watchdog Timer. Untested as I can't seem to find
the parent clock for this in the RK3328 documentation.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/dwcwdt_fdt.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/fdt/files.fdt

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



Re: CVS commit: src/sbin/mount_cd9660

2018-06-30 Thread Sevan Janiyan



On 06/29/18 23:24, Izumi Tsutsui wrote:
> Nowadays it should be vndconfig(8)?
>  http://netbsd.gw.com/cgi-bin/man-cgi?vnconfig++NetBSD-current

Thanks for the heads up. It should now be fixed.


Sevan


CVS commit: src/sbin/mount_cd9660

2018-06-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jun 30 09:27:41 UTC 2018

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

Log Message:
vnconfig name is retained for backwards compatibility. Use vndconfig.

Heads up by 


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sbin/mount_cd9660/mount_cd9660.8

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

Modified files:

Index: src/sbin/mount_cd9660/mount_cd9660.8
diff -u src/sbin/mount_cd9660/mount_cd9660.8:1.30 src/sbin/mount_cd9660/mount_cd9660.8:1.31
--- src/sbin/mount_cd9660/mount_cd9660.8:1.30	Fri Jun 29 19:13:19 2018
+++ src/sbin/mount_cd9660/mount_cd9660.8	Sat Jun 30 09:27:41 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount_cd9660.8,v 1.30 2018/06/29 19:13:19 sevan Exp $
+.\" $NetBSD: mount_cd9660.8,v 1.31 2018/06/30 09:27:41 sevan Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -57,7 +57,7 @@
 .\"
 .\" @(#)mount_cd9660.8	8.3 (Berkeley) 3/27/94
 .\"
-.Dd June 29, 2018
+.Dd June 30, 2018
 .Dt MOUNT_CD9660 8
 .Os
 .Sh NAME
@@ -159,7 +159,7 @@ Same as
 .Xr fstab 5 ,
 .Xr mount 8 ,
 .Xr mscdlabel 8 ,
-.Xr vnconfig 8
+.Xr vndconfig 8
 .Sh HISTORY
 The
 .Nm



CVS commit: src/sbin/mount_cd9660

2018-06-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Jun 30 09:27:41 UTC 2018

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

Log Message:
vnconfig name is retained for backwards compatibility. Use vndconfig.

Heads up by 


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sbin/mount_cd9660/mount_cd9660.8

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