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

2019-11-23 Thread Herbert J. Skuhra
On Sat, 23 Nov 2019 19:53:05 +0100, "Jared D. McNeill" wrote:
> 
> Module Name:  src
> Committed By: jmcneill
> Date: Sat Nov 23 18:53:05 UTC 2019
> 
> Modified Files:
>   src/sys/dev/fdt: fdt_port.c
> 
> Log Message:
> Use fdtbus_get_reg to read "reg" property

Hi,

this change breaks the build (of earmv7hf) on FreeBSD:

/usr/home/herbert/source/netbsd/current/src/sys/dev/fdt/fdt_port.c: In function 
'fdt_ports_register':
/usr/home/herbert/source/netbsd/current/src/sys/dev/fdt/fdt_port.c:299:32: 
error: passing argument 3 of
 'fdtbus_get_reg' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
if (fdtbus_get_reg(child, 0, , NULL) != 0) {
^~~
In file included from 
/usr/home/herbert/source/netbsd/current/src/sys/dev/fdt/fdt_port.c:49:
/usr/home/herbert/source/netbsd/current/src/sys/dev/fdt/fdtvar.h:303:33: note: 
expected 'bus_addr_t *'
{aka 'long unsigned int *'} but argument is of type 'uint64_t *' {aka 'long 
long unsigned int *'}
 int  fdtbus_get_reg(int, u_int, bus_addr_t *, bus_size_t *);
  ^~~~

--
Herbert


CVS commit: src/sys/arch/aarch64

2019-11-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 24 04:08:36 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: exec_machdep.c netbsd32_machdep.c trap.c
src/sys/arch/aarch64/include: netbsd32_machdep.h param.h proc.h

Log Message:
PR port-arm/54702

Add support for earmv6hf binaries on COMPAT_NETBSD32 for aarch64:

- Emulate ARMv6 instructions with cache operations register (c7), that
  are deprecated since ARMv7, and disabled on ARMv8 with LP64 kernel.

- ep_machine_arch (default: earmv7hf) is copied from executables, as we
  do for mips64. "uname -p" reports earmv6hf if compiled for earmv6hf;
  configure scripts etc can determine the appropriate architecture.

Many thanks to ryo@ for helping me to add support of Thumb-mode,
as well as providing exhaustive test cases:

  https://github.com/ryo/mcr_test/

We've confirmed:

- Emulation works in Thumb-mode.
- T32 16-bit length illegal instruction results in SIGILL, even if
  it is located nearby a boundary b/w mapped and unmapped pages.
- T32 32-bit instruction results in SIGSEGV if it is located across
  a boundary b/w mapped and unmapped pages.

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/exec_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/trap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/include/netbsd32_machdep.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/proc.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/exec_machdep.c
diff -u src/sys/arch/aarch64/aarch64/exec_machdep.c:1.4 src/sys/arch/aarch64/aarch64/exec_machdep.c:1.5
--- src/sys/arch/aarch64/aarch64/exec_machdep.c:1.4	Wed Nov 28 08:12:15 2018
+++ src/sys/arch/aarch64/aarch64/exec_machdep.c	Sun Nov 24 04:08:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: exec_machdep.c,v 1.4 2018/11/28 08:12:15 ryo Exp $ */
+/* $NetBSD: exec_machdep.c,v 1.5 2019/11/24 04:08:36 rin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: exec_machdep.c,v 1.4 2018/11/28 08:12:15 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exec_machdep.c,v 1.5 2019/11/24 04:08:36 rin Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_compat_netbsd32.h"
@@ -83,6 +83,13 @@ aarch64_netbsd_elf32_probe(struct lwp *l
 	ID_AA64PFR0_EL1_EL0_64_32)
 		return ENOEXEC;
 
+	/*
+	 * Copy (if any) the machine_arch of the executable to the proc.
+	 */
+	if (epp->ep_machine_arch[0] != 0)
+		strlcpy(l->l_proc->p_md.md_march32, epp->ep_machine_arch,
+		sizeof(l->l_proc->p_md.md_march32));
+
 	return 0;
 }
 #endif

Index: src/sys/arch/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.8 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.9
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.8	Wed Nov 20 19:37:51 2019
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Sun Nov 24 04:08:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.8 2019/11/20 19:37:51 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.9 2019/11/24 04:08:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.8 2019/11/20 19:37:51 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.9 2019/11/24 04:08:36 rin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -55,11 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mac
 #include 
 
 const char machine32[] = MACHINE;
-#ifdef __AARCH64EB__
-const char machine_arch32[] = "earmv7hfeb";
-#else
-const char machine_arch32[] = "earmv7hf";
-#endif
+const char machine_arch32[] = MACHINE32_ARCH;
 
 void
 netbsd32_setregs(struct lwp *l, struct exec_package *pack, vaddr_t stack)

Index: src/sys/arch/aarch64/aarch64/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.20 src/sys/arch/aarch64/aarch64/trap.c:1.21
--- src/sys/arch/aarch64/aarch64/trap.c:1.20	Thu Nov 21 19:23:58 2019
+++ src/sys/arch/aarch64/aarch64/trap.c	Sun Nov 24 04:08:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.20 2019/11/21 19:23:58 ad Exp $ */
+/* $NetBSD: trap.c,v 1.21 2019/11/24 04:08:36 rin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.20 2019/11/21 19:23:58 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.21 2019/11/24 04:08:36 rin Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -321,6 +321,103 @@ interrupt(struct trapframe *tf)
 	cpu_dosoftints();
 }
 
+#ifdef COMPAT_NETBSD32
+
+/*
+ * 32-bit length Thumb instruction. See ARMv7 DDI0406A A6.3.
+ */
+#define THUMB_32BIT(hi) (((hi) & 0xe000) == 0xe000 && 

CVS commit: src/sys/arch/aarch64

2019-11-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Nov 24 04:08:36 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: exec_machdep.c netbsd32_machdep.c trap.c
src/sys/arch/aarch64/include: netbsd32_machdep.h param.h proc.h

Log Message:
PR port-arm/54702

Add support for earmv6hf binaries on COMPAT_NETBSD32 for aarch64:

- Emulate ARMv6 instructions with cache operations register (c7), that
  are deprecated since ARMv7, and disabled on ARMv8 with LP64 kernel.

- ep_machine_arch (default: earmv7hf) is copied from executables, as we
  do for mips64. "uname -p" reports earmv6hf if compiled for earmv6hf;
  configure scripts etc can determine the appropriate architecture.

Many thanks to ryo@ for helping me to add support of Thumb-mode,
as well as providing exhaustive test cases:

  https://github.com/ryo/mcr_test/

We've confirmed:

- Emulation works in Thumb-mode.
- T32 16-bit length illegal instruction results in SIGILL, even if
  it is located nearby a boundary b/w mapped and unmapped pages.
- T32 32-bit instruction results in SIGSEGV if it is located across
  a boundary b/w mapped and unmapped pages.

XXX
pullup to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/aarch64/exec_machdep.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/aarch64/aarch64/trap.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/include/netbsd32_machdep.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/proc.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/dts

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 24 02:06:16 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-pinebook.dts

Log Message:
Enable HDMI and HDMI audio


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts

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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Nov 24 02:06:16 UTC 2019

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-pinebook.dts

Log Message:
Enable HDMI and HDMI audio


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts

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/sun50i-a64-pinebook.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.16 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.17
--- src/sys/arch/arm/dts/sun50i-a64-pinebook.dts:1.16	Thu Jun  6 23:19:45 2019
+++ src/sys/arch/arm/dts/sun50i-a64-pinebook.dts	Sun Nov 24 02:06:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-pinebook.dts,v 1.16 2019/06/06 23:19:45 jmcneill Exp $ */
+/* $NetBSD: sun50i-a64-pinebook.dts,v 1.17 2019/11/24 02:06:16 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017-2019 Jared McNeill 
@@ -54,6 +54,17 @@
 	sound_spdif {
 		status = "disabled";
 	};
+
+	hdmi-connector {
+		compatible = "hdmi-connector";
+		type = "c";
+
+		port {
+			hdmi_con_in: endpoint {
+remote-endpoint = <_out_con>;
+			};
+		};
+	};
 };
 
  {
@@ -151,3 +162,28 @@
 		};
 	};
 };
+
+_dldo1 {
+	regulator-min-microvolt = <330>;
+	regulator-max-microvolt = <330>;
+	regulator-name = "vcc-hdmi";
+};
+
+ {
+	hvcc-supply = <_dldo1>;
+	status = "okay";
+};
+
+_out {
+	hdmi_out_con: endpoint {
+		remote-endpoint = <_con_in>;
+	};
+};
+
+ {
+	status = "okay";
+};
+
+_hdmi {
+	status = "okay";
+};



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 23:47:57 UTC 2019

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

Log Message:
Do not assume the cursor pitch is the same as the primary fb


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_mixer.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_mixer.c
diff -u src/sys/arch/arm/sunxi/sunxi_mixer.c:1.9 src/sys/arch/arm/sunxi/sunxi_mixer.c:1.10
--- src/sys/arch/arm/sunxi/sunxi_mixer.c:1.9	Sat Nov 23 21:40:57 2019
+++ src/sys/arch/arm/sunxi/sunxi_mixer.c	Sat Nov 23 23:47:57 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mixer.c,v 1.9 2019/11/23 21:40:57 jmcneill Exp $ */
+/* $NetBSD: sunxi_mixer.c,v 1.10 2019/11/23 23:47:57 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.9 2019/11/23 21:40:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.10 2019/11/23 23:47:57 jmcneill Exp $");
 
 #include 
 #include 
@@ -373,7 +373,7 @@ sunxi_mixer_cursor_set(struct drm_crtc *
 	/* Set UI overlay offset */
 	OVL_UI_WRITE(sc, 1, OVL_UI_COOR(0), offset);
 	/* Set UI overlay line size */
-	OVL_UI_WRITE(sc, 1, OVL_UI_PITCH(0), crtc->primary->fb->pitches[0]);
+	OVL_UI_WRITE(sc, 1, OVL_UI_PITCH(0), width * 4);
 	/* Set UI overlay window size */
 	OVL_UI_WRITE(sc, 1, OVL_UI_SIZE, crtc_size);
 



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 23:47:57 UTC 2019

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

Log Message:
Do not assume the cursor pitch is the same as the primary fb


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_mixer.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 22:46:53 UTC 2019

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

Log Message:
Set video PLLs to 297MHz


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 22:46:53 UTC 2019

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

Log Message:
Set video PLLs to 297MHz


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.18 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.19
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.18	Sat Nov 23 18:57:36 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Sat Nov 23 22:46:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.18 2019/11/23 18:57:36 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.19 2019/11/23 22:46:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.18 2019/11/23 18:57:36 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.19 2019/11/23 22:46:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -622,9 +622,15 @@ sun50i_a64_ccu_attach(device_t parent, d
 	clk_set_parent(>sc_clks[A64_CLK_DE].base, >sc_clks[A64_CLK_PLL_DE].base);
 	clk_set_rate(>sc_clks[A64_CLK_PLL_DE].base, 42000);
 
+	/* Set video PLLs to 297 MHz */
+	clk_set_rate(>sc_clks[A64_CLK_PLL_VIDEO0].base, 29700);
+	clk_set_rate(>sc_clks[A64_CLK_PLL_VIDEO1].base, 29700);
+
 	/* Set TCON1 parent to PLL_VIDEO1(1X) */
 	clk_set_parent(>sc_clks[A64_CLK_TCON1].base, >sc_clks[A64_CLK_PLL_VIDEO1].base);
-	clk_set_rate(>sc_clks[A64_CLK_PLL_VIDEO1].base, 29700);
+
+	/* Set HDMI parent to PLL_VIDEO1(1X) */
+	clk_set_parent(>sc_clks[A64_CLK_HDMI].base, >sc_clks[A64_CLK_PLL_VIDEO1].base);
 
 	sunxi_ccu_print(sc);
 }



CVS commit: src/sys/kern

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 22:35:08 UTC 2019

Modified Files:
src/sys/kern: kern_runq.c sched_4bsd.c

Log Message:
Pull in sys/atomic.h.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/kern/kern_runq.c
cvs rdiff -u -r1.36 -r1.37 src/sys/kern/sched_4bsd.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_runq.c
diff -u src/sys/kern/kern_runq.c:1.48 src/sys/kern/kern_runq.c:1.49
--- src/sys/kern/kern_runq.c:1.48	Sat Nov 23 19:42:52 2019
+++ src/sys/kern/kern_runq.c	Sat Nov 23 22:35:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_runq.c,v 1.48 2019/11/23 19:42:52 ad Exp $	*/
+/*	$NetBSD: kern_runq.c,v 1.49 2019/11/23 22:35:08 ad Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.48 2019/11/23 19:42:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_runq.c,v 1.49 2019/11/23 22:35:08 ad Exp $");
 
 #include "opt_dtrace.h"
 
@@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_runq.c,
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Priority related definitions.

Index: src/sys/kern/sched_4bsd.c
diff -u src/sys/kern/sched_4bsd.c:1.36 src/sys/kern/sched_4bsd.c:1.37
--- src/sys/kern/sched_4bsd.c:1.36	Sat Nov 23 19:42:52 2019
+++ src/sys/kern/sched_4bsd.c	Sat Nov 23 22:35:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched_4bsd.c,v 1.36 2019/11/23 19:42:52 ad Exp $	*/
+/*	$NetBSD: sched_4bsd.c,v 1.37 2019/11/23 22:35:08 ad Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2019
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sched_4bsd.c,v 1.36 2019/11/23 19:42:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sched_4bsd.c,v 1.37 2019/11/23 22:35:08 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -85,6 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: sched_4bsd.c
 #include 
 #include 
 #include 
+#include 
 
 static void updatepri(struct lwp *);
 static void resetpriority(struct lwp *);



CVS commit: src/sys/kern

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 22:35:08 UTC 2019

Modified Files:
src/sys/kern: kern_runq.c sched_4bsd.c

Log Message:
Pull in sys/atomic.h.


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

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 21:40:58 UTC 2019

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

Log Message:
Support non-zero fb start pixels.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/sunxi_mixer.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_mixer.c
diff -u src/sys/arch/arm/sunxi/sunxi_mixer.c:1.8 src/sys/arch/arm/sunxi/sunxi_mixer.c:1.9
--- src/sys/arch/arm/sunxi/sunxi_mixer.c:1.8	Sat Nov 23 20:24:12 2019
+++ src/sys/arch/arm/sunxi/sunxi_mixer.c	Sat Nov 23 21:40:57 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mixer.c,v 1.8 2019/11/23 20:24:12 jmcneill Exp $ */
+/* $NetBSD: sunxi_mixer.c,v 1.9 2019/11/23 21:40:57 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.8 2019/11/23 20:24:12 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.9 2019/11/23 21:40:57 jmcneill Exp $");
 
 #include 
 #include 
@@ -252,6 +252,9 @@ sunxi_mixer_mode_do_set_base(struct drm_
 
 	uint64_t paddr = (uint64_t)sfb->obj->dmamap->dm_segs[0].ds_addr;
 
+	paddr += y * sfb->base.pitches[0];
+	paddr += x * drm_format_plane_cpp(sfb->base.pixel_format, 0);
+
 	uint32_t haddr = (paddr >> 32) & OVL_UI_TOP_HADD_LAYER0;
 	uint32_t laddr = paddr & 0x;
 
@@ -461,7 +464,6 @@ sunxi_mixer_mode_set(struct drm_crtc *cr
 
 	const uint32_t size = ((adjusted_mode->vdisplay - 1) << 16) |
 			  (adjusted_mode->hdisplay - 1);
-	const uint32_t offset = (y << 16) | x;
 
 	/* Set global size */
 	GLB_WRITE(sc, GLB_SIZE, size);
@@ -474,7 +476,7 @@ sunxi_mixer_mode_set(struct drm_crtc *cr
 	/* Set blender 0 input size */
 	BLD_WRITE(sc, BLD_CH_ISIZE(0), size);
 	/* Set blender 0 offset */
-	BLD_WRITE(sc, BLD_CH_OFFSET(0), offset);
+	BLD_WRITE(sc, BLD_CH_OFFSET(0), 0);
 	/* Route channel 1 to pipe 0 */
 	val = BLD_READ(sc, BLD_CH_RTCTL);
 	val &= ~BLD_CH_RTCTL_P0;
@@ -493,7 +495,7 @@ sunxi_mixer_mode_set(struct drm_crtc *cr
 	/* Set UI overlay layer size */
 	OVL_UI_WRITE(sc, 0, OVL_UI_MBSIZE(0), size);
 	/* Set UI overlay offset */
-	OVL_UI_WRITE(sc, 0, OVL_UI_COOR(0), offset);
+	OVL_UI_WRITE(sc, 0, OVL_UI_COOR(0), 0);
 	/* Set UI overlay window size */
 	OVL_UI_WRITE(sc, 0, OVL_UI_SIZE, size);
 



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 21:40:58 UTC 2019

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

Log Message:
Support non-zero fb start pixels.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/sunxi/sunxi_mixer.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 21:30:41 UTC 2019

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

Log Message:
Set pre-divider M to 0 in fractional mode, as noted in user manual. Spotted by 
jak.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_ccu_fractional.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_ccu_fractional.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.5 src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.6
--- src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.5	Sat Nov 23 18:52:09 2019
+++ src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c	Sat Nov 23 21:30:41 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_fractional.c,v 1.5 2019/11/23 18:52:09 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_fractional.c,v 1.6 2019/11/23 21:30:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_fractional.c,v 1.5 2019/11/23 18:52:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_fractional.c,v 1.6 2019/11/23 21:30:41 jmcneill Exp $");
 
 #include 
 #include 
@@ -137,6 +137,7 @@ sunxi_ccu_fractional_set_rate(struct sun
 
 	for (i = 0; i < __arraycount(fractional->frac); i++) {
 		if (fractional->frac[i] == new_rate) {
+			val &= ~fractional->prediv;
 			val &= ~fractional->div_en;
 			val &= ~fractional->frac_sel;
 			val |= __SHIFTIN(i, fractional->frac_sel);



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 21:30:41 UTC 2019

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

Log Message:
Set pre-divider M to 0 in fractional mode, as noted in user manual. Spotted by 
jak.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c

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



CVS commit: src/regress/sys/kern/nameibench

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 20:37:49 UTC 2019

Modified Files:
src/regress/sys/kern/nameibench: nameibench.c

Log Message:
Redo previous differently.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/regress/sys/kern/nameibench/nameibench.c

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

Modified files:

Index: src/regress/sys/kern/nameibench/nameibench.c
diff -u src/regress/sys/kern/nameibench/nameibench.c:1.2 src/regress/sys/kern/nameibench/nameibench.c:1.3
--- src/regress/sys/kern/nameibench/nameibench.c:1.2	Sat Nov 23 20:37:05 2019
+++ src/regress/sys/kern/nameibench/nameibench.c	Sat Nov 23 20:37:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nameibench.c,v 1.2 2019/11/23 20:37:05 ad Exp $	*/
+/*	$NetBSD: nameibench.c,v 1.3 2019/11/23 20:37:49 ad Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -51,8 +51,8 @@ const int primes[] = {
 };
 
 char	**sa;
-int	sasize;
-int	sacnt;
+u_int	sasize;
+u_int	sacnt;
 struct	timespec sts;
 struct	timespec ets;
 pthread_barrier_t	barrier;
@@ -103,7 +103,7 @@ makelist(void)
 static void
 lookups(int idx)
 {
-	int p, c;
+	u_int p, c;
 
 	for (c = 0, p = 0; !stop; c++) {
 		p += primes[idx];



CVS commit: src/regress/sys/kern/nameibench

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 20:37:49 UTC 2019

Modified Files:
src/regress/sys/kern/nameibench: nameibench.c

Log Message:
Redo previous differently.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/regress/sys/kern/nameibench/nameibench.c

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



CVS commit: src/regress/sys/kern/nameibench

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 20:37:05 UTC 2019

Modified Files:
src/regress/sys/kern/nameibench: nameibench.c

Log Message:
Fix compiler warning.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/regress/sys/kern/nameibench/nameibench.c

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



CVS commit: src/regress/sys/kern/nameibench

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 20:37:05 UTC 2019

Modified Files:
src/regress/sys/kern/nameibench: nameibench.c

Log Message:
Fix compiler warning.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/regress/sys/kern/nameibench/nameibench.c

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

Modified files:

Index: src/regress/sys/kern/nameibench/nameibench.c
diff -u src/regress/sys/kern/nameibench/nameibench.c:1.1 src/regress/sys/kern/nameibench/nameibench.c:1.2
--- src/regress/sys/kern/nameibench/nameibench.c:1.1	Thu Jan 29 21:24:19 2009
+++ src/regress/sys/kern/nameibench/nameibench.c	Sat Nov 23 20:37:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nameibench.c,v 1.1 2009/01/29 21:24:19 ad Exp $	*/
+/*	$NetBSD: nameibench.c,v 1.2 2019/11/23 20:37:05 ad Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -103,7 +103,7 @@ makelist(void)
 static void
 lookups(int idx)
 {
-	unsigned int p, c;
+	int p, c;
 
 	for (c = 0, p = 0; !stop; c++) {
 		p += primes[idx];



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:28:04 UTC 2019

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

Log Message:
Use actual hw mode, not proposed mode.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_lcdc.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_lcdc.c
diff -u src/sys/arch/arm/sunxi/sunxi_lcdc.c:1.6 src/sys/arch/arm/sunxi/sunxi_lcdc.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_lcdc.c:1.6	Sat Jul  6 00:23:38 2019
+++ src/sys/arch/arm/sunxi/sunxi_lcdc.c	Sat Nov 23 20:28:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_lcdc.c,v 1.6 2019/07/06 00:23:38 jmcneill Exp $ */
+/* $NetBSD: sunxi_lcdc.c,v 1.7 2019/11/23 20:28:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_lcdc.c,v 1.6 2019/07/06 00:23:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_lcdc.c,v 1.7 2019/11/23 20:28:04 jmcneill Exp $");
 
 #include 
 #include 
@@ -81,7 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_lcdc.c
 #define	TCON1_CTL_REG		0x090
 #define	 TCON1_CTL_TCON1_EN			__BIT(31)
 #define	 TCON1_CTL_START_DELAY			__BITS(8,4)
-#define	 TCON1_CTL_TCON1_SRC_SEL		__BIT(1)
+#define	 TCON1_CTL_TCON1_SRC_SEL		__BITS(1,0)
 #define	TCON1_BASIC0_REG	0x094
 #define	TCON1_BASIC1_REG	0x098
 #define	TCON1_BASIC2_REG	0x09c
@@ -185,6 +185,7 @@ sunxi_lcdc_tcon0_prepare(struct drm_enco
 
 	val = TCON_READ(sc, TCON_GCTL_REG);
 	val |= TCON_GCTL_TCON_EN;
+	val &= ~TCON_GCTL_IO_MAP_SEL;
 	TCON_WRITE(sc, TCON_GCTL_REG, val);
 
 	TCON_WRITE(sc, TCON0_IO_TRI_REG, 0);
@@ -215,20 +216,20 @@ sunxi_lcdc_tcon0_commit(struct drm_encod
 	int error;
 
 	const u_int interlace_p = (mode->flags & DRM_MODE_FLAG_INTERLACE) != 0;
-	const u_int hspw = mode->hsync_end - mode->hsync_start;
-	const u_int hbp = mode->htotal - mode->hsync_start;
-	const u_int vspw = mode->vsync_end - mode->vsync_start;
-	const u_int vbp = mode->vtotal - mode->vsync_start;
-	const u_int vblank_len = (mode->vtotal - mode->vdisplay) >> interlace_p;
+	const u_int hspw = mode->crtc_hsync_end - mode->crtc_hsync_start;
+	const u_int hbp = mode->crtc_htotal - mode->crtc_hsync_start;
+	const u_int vspw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	const u_int vbp = mode->crtc_vtotal - mode->crtc_vsync_start;
+	const u_int vblank_len = (mode->crtc_vtotal - mode->crtc_vdisplay) >> interlace_p;
 	const u_int start_delay = uimin(vblank_len, 30);
 
 	val = TCON0_CTL_TCON0_EN |
 	  __SHIFTIN(start_delay, TCON0_CTL_START_DELAY);
 	TCON_WRITE(sc, TCON0_CTL_REG, val);
 
-	TCON_WRITE(sc, TCON0_BASIC0_REG, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
-	TCON_WRITE(sc, TCON0_BASIC1_REG, ((mode->htotal - 1) << 16) | (hbp - 1));
-	TCON_WRITE(sc, TCON0_BASIC2_REG, ((mode->vtotal * 2) << 16) | (vbp - 1));
+	TCON_WRITE(sc, TCON0_BASIC0_REG, ((mode->crtc_hdisplay - 1) << 16) | (mode->crtc_vdisplay - 1));
+	TCON_WRITE(sc, TCON0_BASIC1_REG, ((mode->crtc_htotal - 1) << 16) | (hbp - 1));
+	TCON_WRITE(sc, TCON0_BASIC2_REG, ((mode->crtc_vtotal * 2) << 16) | (vbp - 1));
 	TCON_WRITE(sc, TCON0_BASIC3_REG, ((hspw - 1) << 16) | (vspw - 1));
 
 	val = TCON_READ(sc, TCON0_IO_POL_REG);
@@ -268,24 +269,22 @@ sunxi_lcdc_tcon1_commit(struct drm_encod
 	int error;
 
 	const u_int interlace_p = (mode->flags & DRM_MODE_FLAG_INTERLACE) != 0;
-	const u_int hspw = mode->hsync_end - mode->hsync_start;
-	const u_int hbp = mode->htotal - mode->hsync_start;
-	const u_int vspw = mode->vsync_end - mode->vsync_start;
-	const u_int vbp = mode->vtotal - mode->vsync_start;
-	const u_int vblank_len =
-	((mode->vtotal << interlace_p) >> 1) - mode->vdisplay - 2;
-	const u_int start_delay =
-	vblank_len >= 32 ? 30 : vblank_len - 2;
+	const u_int hspw = mode->crtc_hsync_end - mode->crtc_hsync_start;
+	const u_int hbp = mode->crtc_htotal - mode->crtc_hsync_start;
+	const u_int vspw = mode->crtc_vsync_end - mode->crtc_vsync_start;
+	const u_int vbp = mode->crtc_vtotal - mode->crtc_vsync_start;
+	const u_int vblank_len = ((mode->crtc_vtotal - mode->crtc_vdisplay) >> interlace_p) - 2;
+	const u_int start_delay = uimin(vblank_len, 30);
 
 	val = TCON1_CTL_TCON1_EN |
 	  __SHIFTIN(start_delay, TCON1_CTL_START_DELAY);
 	TCON_WRITE(sc, TCON1_CTL_REG, val);
 
-	TCON_WRITE(sc, TCON1_BASIC0_REG, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
-	TCON_WRITE(sc, TCON1_BASIC1_REG, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
-	TCON_WRITE(sc, TCON1_BASIC2_REG, ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
-	TCON_WRITE(sc, TCON1_BASIC3_REG, ((mode->htotal - 1) << 16) | (hbp - 1));
-	TCON_WRITE(sc, TCON1_BASIC4_REG, ((mode->vtotal * 2) << 16) | (vbp - 1));
+	TCON_WRITE(sc, TCON1_BASIC0_REG, ((mode->crtc_hdisplay - 1) << 16) | (mode->crtc_vdisplay - 1));
+	TCON_WRITE(sc, TCON1_BASIC1_REG, ((mode->crtc_hdisplay - 1) << 16) | 

CVS commit: src/sys/dev/ic

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:27:39 UTC 2019

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

Log Message:
Use actual hw mode, not proposed mode.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/dw_hdmi.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:28:04 UTC 2019

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

Log Message:
Use actual hw mode, not proposed mode.


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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:27:39 UTC 2019

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

Log Message:
Use actual hw mode, not proposed mode.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/dw_hdmi.c

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

Modified files:

Index: src/sys/dev/ic/dw_hdmi.c
diff -u src/sys/dev/ic/dw_hdmi.c:1.5 src/sys/dev/ic/dw_hdmi.c:1.6
--- src/sys/dev/ic/dw_hdmi.c:1.5	Sat Nov 23 12:28:44 2019
+++ src/sys/dev/ic/dw_hdmi.c	Sat Nov 23 20:27:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.5 2019/11/23 12:28:44 jmcneill Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.6 2019/11/23 20:27:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.5 2019/11/23 12:28:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.6 2019/11/23 20:27:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -429,14 +429,14 @@ dwhdmi_fc_init(struct dwhdmi_softc *sc, 
 	uint8_t val;
 
 	const uint8_t vic = drm_match_cea_mode(mode);
-	const uint16_t inhactiv = mode->hdisplay;
-	const uint16_t inhblank = mode->htotal - mode->hdisplay;
-	const uint16_t invactiv = mode->vdisplay;
-	const uint8_t invblank = mode->vtotal - mode->vdisplay;
-	const uint16_t hsyncindelay = mode->hsync_start - mode->hdisplay;
-	const uint16_t hsyncinwidth = mode->hsync_end - mode->hsync_start;
-	const uint8_t vsyncindelay = mode->vsync_start - mode->vdisplay;
-	const uint8_t vsyncinwidth = mode->vsync_end - mode->vsync_start;
+	const uint16_t inhactiv = mode->crtc_hdisplay;
+	const uint16_t inhblank = mode->crtc_htotal - mode->crtc_hdisplay;
+	const uint16_t invactiv = mode->crtc_vdisplay;
+	const uint8_t invblank = mode->crtc_vtotal - mode->crtc_vdisplay;
+	const uint16_t hsyncindelay = mode->crtc_hsync_start - mode->crtc_hdisplay;
+	const uint16_t hsyncinwidth = mode->crtc_hsync_end - mode->crtc_hsync_start;
+	const uint8_t vsyncindelay = mode->crtc_vsync_start - mode->crtc_vdisplay;
+	const uint8_t vsyncinwidth = mode->crtc_vsync_end - mode->crtc_vsync_start;
 
 	/* Input video configuration for frame composer */
 	val = HDMI_FC_INVIDCONF_DE_IN_POLARITY;



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:24:12 UTC 2019

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

Log Message:
Do not assume that an fb's pitch is width * 4 bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sunxi_mixer.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 20:24:12 UTC 2019

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

Log Message:
Do not assume that an fb's pitch is width * 4 bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sunxi_mixer.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_mixer.c
diff -u src/sys/arch/arm/sunxi/sunxi_mixer.c:1.7 src/sys/arch/arm/sunxi/sunxi_mixer.c:1.8
--- src/sys/arch/arm/sunxi/sunxi_mixer.c:1.7	Sat Feb 16 16:20:50 2019
+++ src/sys/arch/arm/sunxi/sunxi_mixer.c	Sat Nov 23 20:24:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mixer.c,v 1.7 2019/02/16 16:20:50 jmcneill Exp $ */
+/* $NetBSD: sunxi_mixer.c,v 1.8 2019/11/23 20:24:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.7 2019/02/16 16:20:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.8 2019/11/23 20:24:12 jmcneill Exp $");
 
 #include 
 #include 
@@ -255,6 +255,9 @@ sunxi_mixer_mode_do_set_base(struct drm_
 	uint32_t haddr = (paddr >> 32) & OVL_UI_TOP_HADD_LAYER0;
 	uint32_t laddr = paddr & 0x;
 
+	/* Set UI overlay line size */
+	OVL_UI_WRITE(sc, 0, OVL_UI_PITCH(0), sfb->base.pitches[0]);
+
 	/* Framebuffer start address */
 	val = OVL_UI_READ(sc, 0, OVL_UI_TOP_HADD);
 	val &= ~OVL_UI_TOP_HADD_LAYER0;
@@ -367,7 +370,7 @@ sunxi_mixer_cursor_set(struct drm_crtc *
 	/* Set UI overlay offset */
 	OVL_UI_WRITE(sc, 1, OVL_UI_COOR(0), offset);
 	/* Set UI overlay line size */
-	OVL_UI_WRITE(sc, 1, OVL_UI_PITCH(0), width * 4);
+	OVL_UI_WRITE(sc, 1, OVL_UI_PITCH(0), crtc->primary->fb->pitches[0]);
 	/* Set UI overlay window size */
 	OVL_UI_WRITE(sc, 1, OVL_UI_SIZE, crtc_size);
 
@@ -491,8 +494,6 @@ sunxi_mixer_mode_set(struct drm_crtc *cr
 	OVL_UI_WRITE(sc, 0, OVL_UI_MBSIZE(0), size);
 	/* Set UI overlay offset */
 	OVL_UI_WRITE(sc, 0, OVL_UI_COOR(0), offset);
-	/* Set UI overlay line size */
-	OVL_UI_WRITE(sc, 0, OVL_UI_PITCH(0), adjusted_mode->hdisplay * 4);
 	/* Set UI overlay window size */
 	OVL_UI_WRITE(sc, 0, OVL_UI_SIZE, size);
 



CVS commit: src/share/man/man9

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 19:46:38 UTC 2019

Modified Files:
src/share/man/man9: cpu_need_resched.9

Log Message:
Update to match recent changes.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man9/cpu_need_resched.9

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

Modified files:

Index: src/share/man/man9/cpu_need_resched.9
diff -u src/share/man/man9/cpu_need_resched.9:1.9 src/share/man/man9/cpu_need_resched.9:1.10
--- src/share/man/man9/cpu_need_resched.9:1.9	Mon Oct 24 07:30:29 2011
+++ src/share/man/man9/cpu_need_resched.9	Sat Nov 23 19:46:38 2019
@@ -1,10 +1,10 @@
-.\" $NetBSD: cpu_need_resched.9,v 1.9 2011/10/24 07:30:29 yamt Exp $
+.\" $NetBSD: cpu_need_resched.9,v 1.10 2019/11/23 19:46:38 ad Exp $
 .\"
-.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2002, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Gregory McGarry.
+.\" by Gregory McGarry, and Andrew Doran.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 31, 2010
+.Dd November 17, 2019
 .Dt CPU_NEED_RESCHED 9
 .Os
 .Sh NAME
@@ -36,19 +36,26 @@
 .Sh SYNOPSIS
 .In sys/cpu.h
 .Ft void
-.Fn cpu_need_resched "struct cpu_info *ci" "int flags"
+.Fn cpu_need_resched "struct cpu_info *ci" "struct lwp *l" "int flags"
 .Sh DESCRIPTION
 The
 .Fn cpu_need_resched
 function is the machine-independent interface for the scheduler to
 notify machine-dependent code that a context switch from the current
-LWP, on the cpu
+LWP
+.Fa l ,
+on the cpu
 .Fa ci ,
 is required.
 This event may occur if a higher priority LWP appears on the run
 queue or if the current LWP has exceeded its time slice.
+.Fa l
+is the last LWP observed running on the CPU.
+It may no longer be running, as
+.Fn cpu_need_resched
+can be called without holding scheduler locks.
 .Pp
-If
+If the
 .Dv RESCHED_KPREEMPT
 flag is specified in
 .Fa flags
@@ -57,20 +64,35 @@ and
 C pre-processor macro is defined in
 .In machine/intr.h ,
 machine-dependent code should make a context switch happen as soon as possible
-even if the cpu is running the kernel code.
+even if the CPU is running in kernel mode.
+If the
+.Dv RESCHED_KPREEMPT
+flag is not specified, then
+.Dv RESCHED_UPREEMPT
+is specified instead.
+.Pp
+If the
+.Dv RESCHED_IDLE
+flag is specified in
+.Fa flags ,
+the last thread observed running on the CPU was the idle LWP.
 .Pp
 If
-.Dv RESCHED_IMMED
+.Dv RESCHED_REMOTE
 flag is specified in
 .Fa flags ,
-machine-dependent code should make a context switch happen as soon as possible.
-In that case, for example, if
+the request is not for the current CPU.
+The opposite also holds true.
+If
 .Fa ci
 is not the current processor,
 .Fn cpu_need_resched
 typically issues an inter processor call to the processor to make it
 notice the need of a context switch as soon as possible.
 .Pp
+.Fn cpu_need_resched
+is always called with kernel preemption disabled.
+.Pp
 Typically, the
 .Fn cpu_need_resched
 function will perform the following operations:
@@ -84,7 +106,10 @@ Post an asynchronous software trap
 .Pq Tn AST .
 .It
 Send an inter processor interrupt to wake up
-.Xr cpu_idle 9 .
+.Xr cpu_idle 9
+and/or force an user process across the user/kernel boundary, thus making a
+trip through
+.Fn userret .
 .El
 .Sh SEE ALSO
 .Xr sched_4bsd 9 ,



CVS commit: src/sys

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 19:42:52 UTC 2019

Modified Files:
src/sys/compat/linux/common: linux_sched.c
src/sys/kern: kern_exec.c kern_fork.c kern_idle.c kern_kthread.c
kern_lwp.c kern_runq.c kern_sleepq.c kern_softint.c kern_synch.c
sched_4bsd.c sys_aio.c sys_lwp.c
src/sys/rump/librump/rumpkern: scheduler.c
src/sys/sys: cpu.h lwp.h sched.h

Log Message:
Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
  sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.483 -r1.484 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/kern_idle.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/kern_kthread.c
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/kern_runq.c
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_softint.c
cvs rdiff -u -r1.325 -r1.326 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/sched_4bsd.c
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/sys_aio.c
cvs rdiff -u -r1.70 -r1.71 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/librump/rumpkern/scheduler.c
cvs rdiff -u -r1.43 -r1.44 src/sys/sys/cpu.h
cvs rdiff -u -r1.189 -r1.190 src/sys/sys/lwp.h
cvs rdiff -u -r1.76 -r1.77 src/sys/sys/sched.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/compat/linux/common/linux_sched.c
diff -u src/sys/compat/linux/common/linux_sched.c:1.72 src/sys/compat/linux/common/linux_sched.c:1.73
--- src/sys/compat/linux/common/linux_sched.c:1.72	Thu Oct  3 22:16:53 2019
+++ src/sys/compat/linux/common/linux_sched.c	Sat Nov 23 19:42:52 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: linux_sched.c,v 1.72 2019/10/03 22:16:53 kamil Exp $	*/
+/*	$NetBSD: linux_sched.c,v 1.73 2019/11/23 19:42:52 ad Exp $	*/
 
 /*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.72 2019/10/03 22:16:53 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.73 2019/11/23 19:42:52 ad Exp $");
 
 #include 
 #include 
@@ -180,7 +180,6 @@ linux_clone_nptl(struct lwp *l, const st
 	struct lwp *l2;
 	struct linux_emuldata *led;
 	void *parent_tidptr, *tls, *child_tidptr;
-	struct schedstate_percpu *spc;
 	vaddr_t uaddr;
 	lwpid_t lid;
 	int flags, tnprocs, error;
@@ -248,31 +247,8 @@ linux_clone_nptl(struct lwp *l, const st
 		}
 	}
 
-	/*
-	 * Set the new LWP running, unless the process is stopping,
-	 * then the LWP is created stopped.
-	 */
-	mutex_enter(p->p_lock);
-	lwp_lock(l2);
-	spc = >l_cpu->ci_schedstate;
-	if ((l->l_flag & (LW_WREBOOT | LW_DBGSUSPEND | LW_WSUSPEND | LW_WEXIT)) == 0) {
-		if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) {
-			KASSERT(l2->l_wchan == NULL);
-			l2->l_stat = LSSTOP;
-			p->p_nrlwps--;
-			lwp_unlock_to(l2, spc->spc_lwplock);
-		} else {
-			KASSERT(lwp_locked(l2, spc->spc_mutex));
-			l2->l_stat = LSRUN;
-			sched_enqueue(l2, false);
-			lwp_unlock(l2);
-		}
-	} else {
-		l2->l_stat = LSSUSPENDED;
-		p->p_nrlwps--;
-		lwp_unlock_to(l2, spc->spc_lwplock);
-	}
-	mutex_exit(p->p_lock);
+	/* Set the new LWP running. */
+	lwp_start(l2, 0);
 
 	retval[0] = lid;
 	retval[1] = 0;

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.483 src/sys/kern/kern_exec.c:1.484
--- src/sys/kern/kern_exec.c:1.483	Sat Oct 12 10:55:23 2019
+++ src/sys/kern/kern_exec.c	Sat Nov 23 19:42:52 2019
@@ -1,9 +1,12 @@
-/*	$NetBSD: kern_exec.c,v 1.483 2019/10/12 10:55:23 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.484 2019/11/23 19:42:52 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
@@ -59,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.483 2019/10/12 10:55:23 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.484 2019/11/23 19:42:52 ad Exp $");
 
 #include "opt_exec.h"
 

CVS commit: src/sys

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 19:42:52 UTC 2019

Modified Files:
src/sys/compat/linux/common: linux_sched.c
src/sys/kern: kern_exec.c kern_fork.c kern_idle.c kern_kthread.c
kern_lwp.c kern_runq.c kern_sleepq.c kern_softint.c kern_synch.c
sched_4bsd.c sys_aio.c sys_lwp.c
src/sys/rump/librump/rumpkern: scheduler.c
src/sys/sys: cpu.h lwp.h sched.h

Log Message:
Minor scheduler cleanup:

- Adapt to cpu_need_resched() changes. Avoid lost & duplicate IPIs and ASTs.
  sched_resched_cpu() and sched_resched_lwp() contain the logic for this.
- Changes for LSIDL to make the locking scheme match the intended design.
- Reduce lock contention and false sharing further.
- Numerous small bugfixes, including some corrections for SCHED_FIFO/RT.
- Use setrunnable() in more places, and merge cut & pasted code.


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.483 -r1.484 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.215 -r1.216 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.25 -r1.26 src/sys/kern/kern_idle.c
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/kern_kthread.c
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/kern_runq.c
cvs rdiff -u -r1.52 -r1.53 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.49 -r1.50 src/sys/kern/kern_softint.c
cvs rdiff -u -r1.325 -r1.326 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/sched_4bsd.c
cvs rdiff -u -r1.44 -r1.45 src/sys/kern/sys_aio.c
cvs rdiff -u -r1.70 -r1.71 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/librump/rumpkern/scheduler.c
cvs rdiff -u -r1.43 -r1.44 src/sys/sys/cpu.h
cvs rdiff -u -r1.189 -r1.190 src/sys/sys/lwp.h
cvs rdiff -u -r1.76 -r1.77 src/sys/sys/sched.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

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 19:40:38 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/arm/arm: arm_machdep.c
src/sys/arch/arm/arm32: genassym.cf
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/include: cpu.h
src/sys/arch/hppa/hppa: hppa_machdep.c
src/sys/arch/ia64/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mips/mips: cpu_subr.c ipifuncs.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/news68k/include: cpu.h
src/sys/arch/next68k/include: cpu.h
src/sys/arch/powerpc/booke: e500_intr.c
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/include/booke: intr.h
src/sys/arch/powerpc/powerpc: genassym.cf powerpc_machdep.c
src/sys/arch/riscv/riscv: genassym.cf riscv_machdep.c
src/sys/arch/sh3/include: cpu.h
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: genassym.cf machdep.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/include: cpu.h
src/sys/arch/vax/include: cpu.h
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x86/include: cpu.h intrdefs.h
src/sys/arch/x86/x86: cpu.c ipi.c x86_machdep.c
src/sys/arch/xen/include: intrdefs.h
src/sys/arch/xen/x86: cpu.c xen_ipi.c

Log Message:
cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.354 -r1.355 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/arm/arm_machdep.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/arm/arm32/genassym.cf
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/hppa/hppa/hppa_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ia64/include/cpu.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/ipifuncs.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/include/booke/intr.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/powerpc/genassym.cf
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/powerpc/powerpc/powerpc_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/genassym.cf \
src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/sh3/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/vax/include/cpu.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/ipi.c
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/include/intrdefs.h
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/x86/xen_ipi.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/aarch64/aarch64/cpu_machdep.c
diff -u src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.7 src/sys/arch/aarch64/aarch64/cpu_machdep.c:1.8
--- 

CVS commit: src/sys/arch

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 19:40:38 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu_machdep.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/amiga/include: cpu.h
src/sys/arch/arm/arm: arm_machdep.c
src/sys/arch/arm/arm32: genassym.cf
src/sys/arch/atari/include: cpu.h
src/sys/arch/cesfic/include: cpu.h
src/sys/arch/evbcf/include: cpu.h
src/sys/arch/hp300/include: cpu.h
src/sys/arch/hppa/hppa: hppa_machdep.c
src/sys/arch/ia64/include: cpu.h
src/sys/arch/luna68k/include: cpu.h
src/sys/arch/mac68k/include: cpu.h
src/sys/arch/mips/mips: cpu_subr.c ipifuncs.c
src/sys/arch/mvme68k/include: cpu.h
src/sys/arch/news68k/include: cpu.h
src/sys/arch/next68k/include: cpu.h
src/sys/arch/powerpc/booke: e500_intr.c
src/sys/arch/powerpc/include: cpu.h
src/sys/arch/powerpc/include/booke: intr.h
src/sys/arch/powerpc/powerpc: genassym.cf powerpc_machdep.c
src/sys/arch/riscv/riscv: genassym.cf riscv_machdep.c
src/sys/arch/sh3/include: cpu.h
src/sys/arch/sparc/include: cpu.h
src/sys/arch/sparc64/include: cpu.h
src/sys/arch/sparc64/sparc64: genassym.cf machdep.c
src/sys/arch/sun68k/include: cpu.h
src/sys/arch/usermode/dev: cpu.c
src/sys/arch/usermode/include: cpu.h
src/sys/arch/vax/include: cpu.h
src/sys/arch/x68k/include: cpu.h
src/sys/arch/x86/include: cpu.h intrdefs.h
src/sys/arch/x86/x86: cpu.c ipi.c x86_machdep.c
src/sys/arch/xen/include: intrdefs.h
src/sys/arch/xen/x86: cpu.c xen_ipi.c

Log Message:
cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/aarch64/cpu_machdep.c
cvs rdiff -u -r1.354 -r1.355 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/amiga/include/cpu.h
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/arm/arm_machdep.c
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/arm/arm32/genassym.cf
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/atari/include/cpu.h
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/cesfic/include/cpu.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbcf/include/cpu.h
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/hp300/include/cpu.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/hppa/hppa/hppa_machdep.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/ia64/include/cpu.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/luna68k/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/mac68k/include/cpu.h
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/ipifuncs.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/mvme68k/include/cpu.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/news68k/include/cpu.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/next68k/include/cpu.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/include/booke/intr.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/powerpc/genassym.cf
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/powerpc/powerpc/powerpc_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/genassym.cf \
src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/sh3/include/cpu.h
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc/include/cpu.h
cvs rdiff -u -r1.126 -r1.127 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sun68k/include/cpu.h
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/include/cpu.h
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/vax/include/cpu.h
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x68k/include/cpu.h
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/x86/x86/ipi.c
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/x86/x86/x86_machdep.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/include/intrdefs.h
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/x86/xen_ipi.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:57:36 UTC 2019

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

Log Message:
Set TCON1 parent to PLL_VIDEO1(1X)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.17 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.18
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.17	Sat Nov 23 12:29:20 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Sat Nov 23 18:57:36 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.17 2019/11/23 12:29:20 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.18 2019/11/23 18:57:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.17 2019/11/23 12:29:20 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.18 2019/11/23 18:57:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -622,5 +622,9 @@ sun50i_a64_ccu_attach(device_t parent, d
 	clk_set_parent(>sc_clks[A64_CLK_DE].base, >sc_clks[A64_CLK_PLL_DE].base);
 	clk_set_rate(>sc_clks[A64_CLK_PLL_DE].base, 42000);
 
+	/* Set TCON1 parent to PLL_VIDEO1(1X) */
+	clk_set_parent(>sc_clks[A64_CLK_TCON1].base, >sc_clks[A64_CLK_PLL_VIDEO1].base);
+	clk_set_rate(>sc_clks[A64_CLK_PLL_VIDEO1].base, 29700);
+
 	sunxi_ccu_print(sc);
 }



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:57:36 UTC 2019

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

Log Message:
Set TCON1 parent to PLL_VIDEO1(1X)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:55:08 UTC 2019

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

Log Message:
Set pixel clock on mode set


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/sunxi/sunxi_dwhdmi.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_dwhdmi.c
diff -u src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.6 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.7
--- src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.6	Sat Nov 23 12:30:45 2019
+++ src/sys/arch/arm/sunxi/sunxi_dwhdmi.c	Sat Nov 23 18:55:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_dwhdmi.c,v 1.6 2019/11/23 12:30:45 jmcneill Exp $ */
+/* $NetBSD: sunxi_dwhdmi.c,v 1.7 2019/11/23 18:55:08 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_dwhdmi.c,v 1.6 2019/11/23 12:30:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_dwhdmi.c,v 1.7 2019/11/23 18:55:08 jmcneill Exp $");
 
 #include 
 #include 
@@ -62,6 +62,7 @@ struct sunxi_dwhdmi_softc {
 	int			sc_phandle;
 	struct fdtbus_phy	*sc_phy;
 	struct fdtbus_regulator	*sc_regulator;
+	struct clk		*sc_clk;
 
 	struct fdt_device_ports	sc_ports;
 	struct drm_display_mode	sc_curmode;
@@ -186,6 +187,15 @@ sunxi_dwhdmi_mode_set(struct dwhdmi_soft
 struct drm_display_mode *adjusted_mode)
 {
 	struct sunxi_dwhdmi_softc * const sc = to_sunxi_dwhdmi_softc(dsc);
+	int error;
+
+	if (sc->sc_clk != NULL) {
+		error = clk_set_rate(sc->sc_clk, adjusted_mode->clock * 1000);
+		if (error != 0)
+			device_printf(sc->sc_base.sc_dev,
+			"couldn't set pixel clock to %u Hz: %d\n",
+			adjusted_mode->clock * 1000, error);
+	}
 
 	sc->sc_curmode = *adjusted_mode;
 }
@@ -229,12 +239,6 @@ sunxi_dwhdmi_attach(device_t parent, dev
 		return;
 	}
 
-	rst = fdtbus_reset_get(phandle, "ctrl");
-	if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
-		aprint_error(": couldn't de-assert reset\n");
-		return;
-	}
-
 	clk_iahb = fdtbus_clock_get(phandle, "iahb");
 	if (clk_iahb == NULL || clk_enable(clk_iahb) != 0) {
 		aprint_error(": couldn't enable iahb clock\n");
@@ -267,6 +271,7 @@ sunxi_dwhdmi_attach(device_t parent, dev
 	sc->sc_base.sc_scl_hcnt = 0xd8;
 	sc->sc_base.sc_scl_lcnt = 0xfe;
 	sc->sc_phandle = faa->faa_phandle;
+	sc->sc_clk = clk_tmds;
 
 	aprint_naive("\n");
 	aprint_normal(": HDMI TX\n");
@@ -281,6 +286,12 @@ sunxi_dwhdmi_attach(device_t parent, dev
 		return;
 	}
 
+	rst = fdtbus_reset_get(phandle, "ctrl");
+	if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
+		aprint_error_dev(self, "couldn't de-assert reset\n");
+		return;
+	}
+
 	sunxi_hdmiphy_init(sc->sc_phy);
 
 	if (dwhdmi_attach(>sc_base) != 0) {



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:55:08 UTC 2019

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

Log Message:
Set pixel clock on mode set


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

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:54:26 UTC 2019

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

Log Message:
Need to initialize the PHY before HPD sense and DDC will work


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_hdmiphy.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_hdmiphy.c
diff -u src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.3 src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.4
--- src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.3	Sat Nov 23 12:30:45 2019
+++ src/sys/arch/arm/sunxi/sunxi_hdmiphy.c	Sat Nov 23 18:54:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_hdmiphy.c,v 1.3 2019/11/23 12:30:45 jmcneill Exp $ */
+/* $NetBSD: sunxi_hdmiphy.c,v 1.4 2019/11/23 18:54:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.3 2019/11/23 12:30:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.4 2019/11/23 18:54:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -128,6 +128,7 @@ struct sunxi_hdmiphy_softc {
 
 	const struct sunxi_hdmiphy_data *sc_data;
 
+	struct fdtbus_reset	*sc_rst;
 	struct clk		*sc_clk_bus;
 	struct clk		*sc_clk_mod;
 	struct clk		*sc_clk_pll0;
@@ -173,14 +174,6 @@ sunxi_hdmiphy_release(device_t dev, void
 static int
 sunxi_hdmiphy_enable(device_t dev, void *priv, bool enable)
 {
-	struct sunxi_hdmiphy_softc * const sc = priv;
-
-	if (enable) {
-		sc->sc_data->init(sc);
-	} else {
-		sc->sc_data->config(sc, 0);
-	}
-
 	return 0;
 }
 
@@ -421,11 +414,10 @@ sunxi_hdmiphy_attach(device_t parent, de
 	}
 
 	rst = fdtbus_reset_get(phandle, "phy");
-	if (rst == NULL || fdtbus_reset_deassert(rst) != 0) {
-		aprint_error(": couldn't de-assert reset\n");
+	if (rst == NULL) {
+		aprint_error(": couldn't get reset\n");
 		return;
 	}
-
 	clk_bus = fdtbus_clock_get(phandle, "bus");
 	clk_mod = fdtbus_clock_get(phandle, "mod");
 	clk_pll0 = fdtbus_clock_get(phandle, "pll-0");
@@ -441,6 +433,7 @@ sunxi_hdmiphy_attach(device_t parent, de
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
+	sc->sc_rst = rst;
 	sc->sc_clk_bus = clk_bus;
 	sc->sc_clk_mod = clk_mod;
 	sc->sc_clk_pll0 = clk_pll0;
@@ -461,6 +454,10 @@ sunxi_hdmiphy_init(struct fdtbus_phy *ph
 	clk_enable(sc->sc_clk_mod);
 	clk_enable(sc->sc_clk_pll0);
 
+	fdtbus_reset_deassert(sc->sc_rst);
+
+	sc->sc_data->init(sc);
+
 	PHY_WRITE(sc, READ_EN, READ_EN_MAGIC);
 	PHY_WRITE(sc, UNSCRAMBLE, UNSCRAMBLE_MAGIC);
 



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:54:26 UTC 2019

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

Log Message:
Need to initialize the PHY before HPD sense and DDC will work


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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:53:05 UTC 2019

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

Log Message:
Use fdtbus_get_reg to read "reg" property


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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:53:05 UTC 2019

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

Log Message:
Use fdtbus_get_reg to read "reg" property


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_port.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_port.c
diff -u src/sys/dev/fdt/fdt_port.c:1.2 src/sys/dev/fdt/fdt_port.c:1.3
--- src/sys/dev/fdt/fdt_port.c:1.2	Wed Jan 30 01:24:00 2019
+++ src/sys/dev/fdt/fdt_port.c	Sat Nov 23 18:53:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdt_port.c,v 1.2 2019/01/30 01:24:00 jmcneill Exp $	*/
+/*	$NetBSD: fdt_port.c,v 1.3 2019/11/23 18:53:05 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.2 2019/01/30 01:24:00 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: fdt_port.c,v 1.3 2019/11/23 18:53:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -296,7 +296,7 @@ again:
 		}
 		if (strcmp(buf, "port") != 0)
 			continue;
-		if (fdtbus_get_reg64(child, 0, , NULL) != 0) {
+		if (fdtbus_get_reg(child, 0, , NULL) != 0) {
 			if (ports->dp_nports > 1)
 aprint_error_dev(self,
 "%s: missing reg property",



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:52:09 UTC 2019

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

Log Message:
Honour SUNXI_CCU_FRACTIONAL_SET_ENABLE in fractional mode


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sunxi/sunxi_ccu_fractional.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_ccu_fractional.c
diff -u src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.4 src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.5
--- src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c:1.4	Wed Jan 30 01:24:00 2019
+++ src/sys/arch/arm/sunxi/sunxi_ccu_fractional.c	Sat Nov 23 18:52:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_ccu_fractional.c,v 1.4 2019/01/30 01:24:00 jmcneill Exp $ */
+/* $NetBSD: sunxi_ccu_fractional.c,v 1.5 2019/11/23 18:52:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_fractional.c,v 1.4 2019/01/30 01:24:00 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_ccu_fractional.c,v 1.5 2019/11/23 18:52:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -140,6 +140,8 @@ sunxi_ccu_fractional_set_rate(struct sun
 			val &= ~fractional->div_en;
 			val &= ~fractional->frac_sel;
 			val |= __SHIFTIN(i, fractional->frac_sel);
+			if (fractional->flags & SUNXI_CCU_FRACTIONAL_SET_ENABLE)
+val |= fractional->enable;
 			CCU_WRITE(sc, fractional->reg, val);
 			return 0;
 		}



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 18:52:09 UTC 2019

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

Log Message:
Honour SUNXI_CCU_FRACTIONAL_SET_ENABLE in fractional mode


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

2019-11-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 23 18:03:57 UTC 2019

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
"rv" is only used on some boards and only with options DIAGNOSTIC.
So move the declaration into the proper #ifdef block.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/evbarm/beagle/beagle_machdep.c

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

Modified files:

Index: src/sys/arch/evbarm/beagle/beagle_machdep.c
diff -u src/sys/arch/evbarm/beagle/beagle_machdep.c:1.79 src/sys/arch/evbarm/beagle/beagle_machdep.c:1.80
--- src/sys/arch/evbarm/beagle/beagle_machdep.c:1.79	Fri Nov 22 14:30:58 2019
+++ src/sys/arch/evbarm/beagle/beagle_machdep.c	Sat Nov 23 18:03:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: beagle_machdep.c,v 1.79 2019/11/22 14:30:58 martin Exp $ */
+/*	$NetBSD: beagle_machdep.c,v 1.80 2019/11/23 18:03:57 martin Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.79 2019/11/22 14:30:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.80 2019/11/23 18:03:57 martin Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -1075,7 +1075,6 @@ void
 beagle_device_register(device_t self, void *aux)
 {
 	prop_dictionary_t dict = device_properties(self);
-	int rv __diagused;
 
 	if (device_is_a(self, "armperiph")
 	&& device_is_a(device_parent(self), "mainbus")) {
@@ -1170,6 +1169,7 @@ beagle_device_register(device_t self, vo
 		prop_dictionary_set_int16(dict, "port2-gpio", -1);
 #endif
 #if defined(OMAP_5430)
+		int rv __diagused;
 		bus_space_tag_t iot = _bs_tag;
 		bus_space_handle_t ioh;
 		omap2_gpio_ctl(80, GPIO_PIN_OUTPUT);



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

2019-11-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Nov 23 18:03:57 UTC 2019

Modified Files:
src/sys/arch/evbarm/beagle: beagle_machdep.c

Log Message:
"rv" is only used on some boards and only with options DIAGNOSTIC.
So move the declaration into the proper #ifdef block.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/evbarm/beagle/beagle_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/dev

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 17:32:10 UTC 2019

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

Log Message:
- Increase the default number of buffers, and scale it by ncpu.
- Stop tracing when the device is closed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/lockstat.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/lockstat.c
diff -u src/sys/dev/lockstat.c:1.25 src/sys/dev/lockstat.c:1.26
--- src/sys/dev/lockstat.c:1.25	Thu Jun  1 02:45:09 2017
+++ src/sys/dev/lockstat.c	Sat Nov 23 17:32:10 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: lockstat.c,v 1.25 2017/06/01 02:45:09 chs Exp $	*/
+/*	$NetBSD: lockstat.c,v 1.26 2019/11/23 17:32:10 ad Exp $	*/
 
 /*-
- * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2007, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -37,10 +37,11 @@
  * Only one thread can hold the device at a time, providing a global lock.
  *
  * XXX Timings for contention on sleep locks are currently incorrect.
+ * XXX Convert this to use timecounters!
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.25 2017/06/01 02:45:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lockstat.c,v 1.26 2019/11/23 17:32:10 ad Exp $");
 
 #include 
 #include 
@@ -71,7 +72,7 @@ __KERNEL_RCSID(0, "$NetBSD: lockstat.c,v
 #endif
 
 #define	LOCKSTAT_MINBUFS	1000
-#define	LOCKSTAT_DEFBUFS	1
+#define	LOCKSTAT_DEFBUFS	2
 #define	LOCKSTAT_MAXBUFS	100
 
 #define	LOCKSTAT_HASH_SIZE	128
@@ -453,6 +454,10 @@ lockstat_close(dev_t dev, int flag, int 
 {
 
 	lockstat_lwp = NULL;
+	if (lockstat_dev_enabled) {
+		lockstat_stop(NULL);
+		lockstat_free();
+	}
 	__cpu_simple_unlock(_lock);
 	return 0;
 }
@@ -490,9 +495,10 @@ lockstat_ioctl(dev_t dev, u_long cmd, vo
 		/*
 		 * Sanitize the arguments passed in and set up filtering.
 		 */
-		if (le->le_nbufs == 0)
-			le->le_nbufs = LOCKSTAT_DEFBUFS;
-		else if (le->le_nbufs > LOCKSTAT_MAXBUFS ||
+		if (le->le_nbufs == 0) {
+			le->le_nbufs = MIN(LOCKSTAT_DEFBUFS * ncpu,
+			LOCKSTAT_MAXBUFS);
+		} else if (le->le_nbufs > LOCKSTAT_MAXBUFS ||
 		le->le_nbufs < LOCKSTAT_MINBUFS) {
 			error = EINVAL;
 			break;



CVS commit: src/sys/dev

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 17:32:10 UTC 2019

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

Log Message:
- Increase the default number of buffers, and scale it by ncpu.
- Stop tracing when the device is closed.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/lockstat.c

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 17:13:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h autofs_vnops.c

Log Message:
autofs: Remove unused autofs_node::an_vnode_lock

Unlike FreeBSD and DragonFlyBSD, this is unused in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs.h
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_vnops.c

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

Modified files:

Index: src/sys/fs/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.3 src/sys/fs/autofs/autofs.h:1.4
--- src/sys/fs/autofs/autofs.h:1.3	Sat Nov 23 08:00:59 2019
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 17:13:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.3 2019/11/23 08:00:59 tkusumi Exp $	*/
+/*	$NetBSD: autofs.h,v 1.4 2019/11/23 17:13:46 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -111,7 +111,6 @@ struct autofs_node {
 	autofs_node)		an_children;
 	struct autofs_mount		*an_mount;
 	struct vnode			*an_vnode;
-	kmutex_t			an_vnode_lock;
 	boolan_cached;
 	boolan_wildcards;
 	struct callout			an_callout;

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.2 src/sys/fs/autofs/autofs_vnops.c:1.3
--- src/sys/fs/autofs/autofs_vnops.c:1.2	Sat Nov 23 15:17:46 2019
+++ src/sys/fs/autofs/autofs_vnops.c	Sat Nov 23 17:13:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.3 2019/11/23 17:13:46 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -578,10 +578,8 @@ autofs_reclaim(void *v)
 	 * We do not free autofs_node here; instead we are
 	 * destroying them in autofs_node_delete().
 	 */
-	mutex_enter(>an_vnode_lock);
 	anp->an_vnode = NULL;
 	vp->v_data = NULL;
-	mutex_exit(>an_vnode_lock);
 
 	return 0;
 }
@@ -629,7 +627,6 @@ autofs_node_new(struct autofs_node *pare
 	anp->an_name = autofs_strndup(name, namelen, KM_SLEEP);
 	anp->an_ino = amp->am_last_ino++;
 	callout_init(>an_callout, 0);
-	mutex_init(>an_vnode_lock, MUTEX_DEFAULT, IPL_NONE);
 	getnanotime(>an_ctime);
 	anp->an_parent = parent;
 	anp->an_mount = amp;
@@ -681,7 +678,6 @@ autofs_node_delete(struct autofs_node *a
 	if (anp->an_parent)
 		RB_REMOVE(autofs_node_tree, >an_parent->an_children, anp);
 
-	mutex_destroy(>an_vnode_lock);
 	kmem_strfree(anp->an_name);
 	pool_put(_node_pool, anp);
 }



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 17:13:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h autofs_vnops.c

Log Message:
autofs: Remove unused autofs_node::an_vnode_lock

Unlike FreeBSD and DragonFlyBSD, this is unused in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/fs/autofs/autofs.h
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_vnops.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/sparc/include

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 16:50:39 UTC 2019

Modified Files:
src/sys/arch/sparc/include: userret.h

Log Message:
Looks like sparc clears want_ast with interrupts enabled, so check+clear it
and call mi_userret() in a loop.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/include/userret.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/sparc/include

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 16:50:39 UTC 2019

Modified Files:
src/sys/arch/sparc/include: userret.h

Log Message:
Looks like sparc clears want_ast with interrupts enabled, so check+clear it
and call mi_userret() in a loop.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc/include/userret.h

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

Modified files:

Index: src/sys/arch/sparc/include/userret.h
diff -u src/sys/arch/sparc/include/userret.h:1.9 src/sys/arch/sparc/include/userret.h:1.10
--- src/sys/arch/sparc/include/userret.h:1.9	Thu Nov 21 19:24:01 2019
+++ src/sys/arch/sparc/include/userret.h	Sat Nov 23 16:50:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.9 2019/11/21 19:24:01 ad Exp $ */
+/*	$NetBSD: userret.h,v 1.10 2019/11/23 16:50:39 ad Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -62,11 +62,10 @@ static __inline void
 userret(struct lwp *l, int pc, u_quad_t oticks)
 {
 	struct proc *p = l->l_proc;
-	
-	mi_userret(l);
 
-	if (cpuinfo.ci_want_ast) {
+	while (cpuinfo.ci_want_ast) {
 		cpuinfo.ci_want_ast = 0;
+		mi_userret(l);
 		if (l->l_pflag & LP_OWEUPC) {
 			l->l_pflag &= ~LP_OWEUPC;
 			ADDUPROF(l);



CVS commit: src/sys/arch

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 16:36:39 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: lock_stubs.S
src/sys/arch/i386/i386: lock_stubs.S

Log Message:
For this case during build.sh:

rw_enter(lock, RW_READ);

Having instrumented it, it turns out that >99.5% of the time the lock is
completely unknowned.  Make this assumption in the assembly stub for
rw_enter(), and avoid the initial read of the lock word.  Where there are
existing read holds, we'll do an additional CMPXCHG but should already have
the cache line in the EXCLUSIVE state.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/i386/i386/lock_stubs.S

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

Modified files:

Index: src/sys/arch/amd64/amd64/lock_stubs.S
diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.33 src/sys/arch/amd64/amd64/lock_stubs.S:1.34
--- src/sys/arch/amd64/amd64/lock_stubs.S:1.33	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/amd64/lock_stubs.S	Sat Nov 23 16:36:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock_stubs.S,v 1.33 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.34 2019/11/23 16:36:38 ad Exp $	*/
 
 /*
  * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -191,13 +191,15 @@ END(mutex_spin_exit)
  * Acquire one hold on a RW lock.
  */
 ENTRY(rw_enter)
-	cmpl	$RW_READER, %esi
+	xorl	%eax, %eax
+	testl	%esi, %esi	/* RW_READER = 0 */
 	jne	2f
 
 	/*
-	 * Reader: this is the most common case.
+	 * Reader, and no existing readers on the lock: this is a most
+	 * common case.  Instead of reading from the lock word, use cmpxchg
+	 * and get the cache line into the EXCLUSIVE state to begin with.
 	 */
-	movq	(%rdi), %rax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	3f
@@ -213,7 +215,6 @@ ENTRY(rw_enter)
 	 * Writer: if the compare-and-set fails, don't bother retrying.
 	 */
 2:	movq	CPUVAR(CURLWP), %rcx
-	xorq	%rax, %rax
 	orq	$RW_WRITE_LOCKED, %rcx
 	LOCK
 	cmpxchgq %rcx, (%rdi)
@@ -268,13 +269,15 @@ END(rw_exit)
  * Try to acquire one hold on a RW lock.
  */
 ENTRY(rw_tryenter)
-	cmpl	$RW_READER, %esi
+	xorl	%eax, %eax
+	testl	%esi, %esi	/* RW_READER = 0 */
 	jne	2f
 
 	/*
-	 * Reader: this is the most common case.
+	 * Reader, and no existing readers on the lock: this is a most
+	 * common case.  Instead of reading from the lock word, use cmpxchg
+	 * and get the cache line into the EXCLUSIVE state to begin with.
 	 */
-	movq	(%rdi), %rax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	4f
@@ -291,7 +294,6 @@ ENTRY(rw_tryenter)
 	 * Writer: if the compare-and-set fails, don't bother retrying.
 	 */
 2:	movq	CPUVAR(CURLWP), %rcx
-	xorq	%rax, %rax
 	orq	$RW_WRITE_LOCKED, %rcx
 	LOCK
 	cmpxchgq %rcx, (%rdi)

Index: src/sys/arch/i386/i386/lock_stubs.S
diff -u src/sys/arch/i386/i386/lock_stubs.S:1.30 src/sys/arch/i386/i386/lock_stubs.S:1.31
--- src/sys/arch/i386/i386/lock_stubs.S:1.30	Mon Feb 11 14:59:32 2019
+++ src/sys/arch/i386/i386/lock_stubs.S	Sat Nov 23 16:36:38 2019
@@ -1,7 +1,7 @@
-/*	$NetBSD: lock_stubs.S,v 1.30 2019/02/11 14:59:32 cherry Exp $	*/
+/*	$NetBSD: lock_stubs.S,v 1.31 2019/11/23 16:36:38 ad Exp $	*/
 
 /*-
- * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
+ * Copyright (c) 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.30 2019/02/11 14:59:32 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lock_stubs.S,v 1.31 2019/11/23 16:36:38 ad Exp $");
 
 #include "opt_lockdebug.h"
 
@@ -104,13 +104,15 @@ END(mutex_exit)
  */
 ENTRY(rw_enter)
 	movl	4(%esp), %edx
+	xorl	%eax, %eax
 	cmpl	$RW_READER, 8(%esp)
 	jne	2f
 
 	/*
-	 * Reader
+	 * Reader, and no existing readers on the lock: this is a most
+	 * common case.  Instead of reading from the lock word, use cmpxchg
+	 * and get the cache line into the EXCLUSIVE state to begin with.
 	 */
-	movl	(%edx), %eax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	3f
@@ -125,7 +127,7 @@ ENTRY(rw_enter)
 	/*
 	 * Writer
 	 */
-2:	xorl	%eax, %eax
+2:
 	movl	%fs:CPU_INFO_CURLWP(%eax), %ecx
 	orl	$RW_WRITE_LOCKED, %ecx
 	LOCK(3)
@@ -186,13 +188,15 @@ END(rw_exit)
  */
 ENTRY(rw_tryenter)
 	movl	4(%esp), %edx
+	xorl	%eax, %eax
 	cmpl	$RW_READER, 8(%esp)
 	jne	2f
 
 	/*
-	 * Reader
+	 * Reader, and no existing readers on the lock: this is a most
+	 * common case.  Instead of reading from the lock word, use cmpxchg
+	 * and get the cache line into the EXCLUSIVE state to begin with.
 	 */
-	movl	(%edx), %eax
 0:
 	testb	$(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al
 	jnz	4f
@@ -209,7 +213,6 @@ ENTRY(rw_tryenter)
 	 * Writer
 	 */
 2:
-	xorl	%eax, %eax
 	movl	%fs:CPU_INFO_CURLWP(%eax), %ecx
 	orl	$RW_WRITE_LOCKED, 

CVS commit: src/sys/arch

2019-11-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 23 16:36:39 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: lock_stubs.S
src/sys/arch/i386/i386: lock_stubs.S

Log Message:
For this case during build.sh:

rw_enter(lock, RW_READ);

Having instrumented it, it turns out that >99.5% of the time the lock is
completely unknowned.  Make this assumption in the assembly stub for
rw_enter(), and avoid the initial read of the lock word.  Where there are
existing read holds, we'll do an additional CMPXCHG but should already have
the cache line in the EXCLUSIVE state.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/i386/i386/lock_stubs.S

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_vnops.c

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 15:17:46 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_vfsops.c autofs_vnops.c

Log Message:
autofs: Don't calculate dirent reclen twice

Taken-from: DragonFlyBSD


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/fs/autofs/autofs_vfsops.c
cvs rdiff -u -r1.1 -r1.2 src/sys/fs/autofs/autofs_vnops.c

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

Modified files:

Index: src/sys/fs/autofs/autofs_vfsops.c
diff -u src/sys/fs/autofs/autofs_vfsops.c:1.6 src/sys/fs/autofs/autofs_vfsops.c:1.7
--- src/sys/fs/autofs/autofs_vfsops.c:1.6	Sat Nov 16 09:22:00 2019
+++ src/sys/fs/autofs/autofs_vfsops.c	Sat Nov 23 15:17:46 2019
@@ -33,7 +33,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.6 2019/11/16 09:22:00 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vfsops.c,v 1.7 2019/11/23 15:17:46 tkusumi Exp $");
 
 
 #include "autofs.h"
@@ -74,6 +74,7 @@ autofs_init(void)
 static void
 autofs_done(void)
 {
+
 	KASSERT(autofs_softc);
 	KASSERT(!autofs_softc->sc_dev_opened);
 

Index: src/sys/fs/autofs/autofs_vnops.c
diff -u src/sys/fs/autofs/autofs_vnops.c:1.1 src/sys/fs/autofs/autofs_vnops.c:1.2
--- src/sys/fs/autofs/autofs_vnops.c:1.1	Tue Jan  9 03:31:14 2018
+++ src/sys/fs/autofs/autofs_vnops.c	Sat Nov 23 15:17:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $	*/
+/*	$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $	*/
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
  * Copyright (c) 2016 The DragonFly Project
@@ -34,7 +34,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.1 2018/01/09 03:31:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autofs_vnops.c,v 1.2 2019/11/23 15:17:46 tkusumi Exp $");
 
 #include "autofs.h"
 
@@ -413,8 +413,7 @@ autofs_print(void *v)
 }
 
 static int
-autofs_readdir_one(struct uio *uio, const char *name, ino_t ino,
-size_t *reclenp)
+autofs_readdir_one(struct uio *uio, const char *name, ino_t ino)
 {
 	struct dirent dirent;
 
@@ -424,9 +423,6 @@ autofs_readdir_one(struct uio *uio, cons
 	dirent.d_namlen = strlen(dirent.d_name);
 	dirent.d_reclen = _DIRENT_SIZE();
 
-	if (reclenp)
-		*reclenp = dirent.d_reclen;
-
 	if (!uio)
 		return 0;
 
@@ -439,11 +435,12 @@ autofs_readdir_one(struct uio *uio, cons
 static size_t
 autofs_dirent_reclen(const char *name)
 {
-	size_t reclen;
+	struct dirent dirent;
 
-	(void)autofs_readdir_one(NULL, name, -1, );
+	strlcpy(dirent.d_name, name, sizeof(dirent.d_name));
+	dirent.d_namlen = strlen(dirent.d_name);
 
-	return reclen;
+	return _DIRENT_SIZE();
 }
 
 static int
@@ -463,7 +460,7 @@ autofs_readdir(void *v)
 	struct autofs_mount *amp = VFSTOAUTOFS(vp->v_mount);
 	struct autofs_node *anp = VTOI(vp);
 	struct autofs_node *child;
-	size_t reclen, reclens;
+	size_t reclens;
 	int error;
 
 	if (vp->v_type != VDIR)
@@ -496,7 +493,7 @@ autofs_readdir(void *v)
 	 * Write out the directory entry for ".".
 	 */
 	if (uio->uio_offset == 0) {
-		error = autofs_readdir_one(uio, ".", anp->an_ino, );
+		error = autofs_readdir_one(uio, ".", anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -509,8 +506,7 @@ autofs_readdir(void *v)
 		if (uio->uio_offset != reclens)
 			return EINVAL;
 		error = autofs_readdir_one(uio, "..",
-		(anp->an_parent ? anp->an_parent->an_ino : anp->an_ino),
-		);
+		anp->an_parent ? anp->an_parent->an_ino : anp->an_ino);
 		if (error)
 			goto out;
 	}
@@ -538,9 +534,8 @@ autofs_readdir(void *v)
 			return EINVAL;
 		}
 
-		error = autofs_readdir_one(uio, child->an_name,
-		child->an_ino, );
-		reclens += reclen;
+		error = autofs_readdir_one(uio, child->an_name, child->an_ino);
+		reclens += autofs_dirent_reclen(child->an_name);
 		if (error) {
 			mutex_exit(>am_lock);
 			goto out;
@@ -562,7 +557,7 @@ out:
 	/*
 	 * Don't return an error if we managed to copy out some entries.
 	 */
-	if (uio->uio_resid < reclen)
+	if (uio->uio_resid < initial_resid)
 		return 0;
 
 	return error;



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 12:30:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_dwhdmi.c sunxi_hdmiphy.c sunxi_hdmiphy.h

Log Message:
HDMI PHY and TX share the same clocks. Do not enable clocks until both
reset resources have been deasserted. Explicitly set DDC clock dividers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_hdmiphy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_hdmiphy.h

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
diff -u src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.5 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.6
--- src/sys/arch/arm/sunxi/sunxi_dwhdmi.c:1.5	Fri Nov 22 19:48:58 2019
+++ src/sys/arch/arm/sunxi/sunxi_dwhdmi.c	Sat Nov 23 12:30:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_dwhdmi.c,v 1.5 2019/11/22 19:48:58 jmcneill Exp $ */
+/* $NetBSD: sunxi_dwhdmi.c,v 1.6 2019/11/23 12:30:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_dwhdmi.c,v 1.5 2019/11/22 19:48:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_dwhdmi.c,v 1.6 2019/11/23 12:30:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -101,13 +101,6 @@ sunxi_dwhdmi_ep_activate(device_t dev, s
 	if (encoder == NULL)
 		return EINVAL;
 
-	sc->sc_phy = fdtbus_phy_get(sc->sc_phandle, "hdmi-phy");
-	if (sc->sc_phy == NULL) {
-		device_printf(dev, "couldn't find hdmi-phy\n");
-		return ENXIO;
-	}
-
-	sc->sc_regulator = fdtbus_regulator_acquire(sc->sc_phandle, "hvcc-supply");
 	if (sc->sc_regulator != NULL) {
 		error = fdtbus_regulator_enable(sc->sc_regulator);
 		if (error != 0) {
@@ -271,11 +264,25 @@ sunxi_dwhdmi_attach(device_t parent, dev
 	sc->sc_base.sc_enable = sunxi_dwhdmi_enable;
 	sc->sc_base.sc_disable = sunxi_dwhdmi_disable;
 	sc->sc_base.sc_mode_set = sunxi_dwhdmi_mode_set;
+	sc->sc_base.sc_scl_hcnt = 0xd8;
+	sc->sc_base.sc_scl_lcnt = 0xfe;
 	sc->sc_phandle = faa->faa_phandle;
 
 	aprint_naive("\n");
 	aprint_normal(": HDMI TX\n");
 
+	sc->sc_regulator = fdtbus_regulator_acquire(sc->sc_phandle, "hvcc-supply");
+
+	sc->sc_phy = fdtbus_phy_get(sc->sc_phandle, "hdmi-phy");
+	if (sc->sc_phy == NULL)
+		sc->sc_phy = fdtbus_phy_get(sc->sc_phandle, "phy");
+	if (sc->sc_phy == NULL) {
+		device_printf(self, "couldn't find PHY\n");
+		return;
+	}
+
+	sunxi_hdmiphy_init(sc->sc_phy);
+
 	if (dwhdmi_attach(>sc_base) != 0) {
 		aprint_error_dev(self, "failed to attach driver\n");
 		return;

Index: src/sys/arch/arm/sunxi/sunxi_hdmiphy.c
diff -u src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.2 src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_hdmiphy.c:1.2	Thu Jan 31 01:49:28 2019
+++ src/sys/arch/arm/sunxi/sunxi_hdmiphy.c	Sat Nov 23 12:30:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_hdmiphy.c,v 1.2 2019/01/31 01:49:28 jmcneill Exp $ */
+/* $NetBSD: sunxi_hdmiphy.c,v 1.3 2019/11/23 12:30:45 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.2 2019/01/31 01:49:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_hdmiphy.c,v 1.3 2019/11/23 12:30:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -128,6 +128,8 @@ struct sunxi_hdmiphy_softc {
 
 	const struct sunxi_hdmiphy_data *sc_data;
 
+	struct clk		*sc_clk_bus;
+	struct clk		*sc_clk_mod;
 	struct clk		*sc_clk_pll0;
 
 	u_int			sc_rcalib;
@@ -425,20 +427,10 @@ sunxi_hdmiphy_attach(device_t parent, de
 	}
 
 	clk_bus = fdtbus_clock_get(phandle, "bus");
-	if (clk_bus == NULL || clk_enable(clk_bus) != 0) {
-		aprint_error(": couldn't enable bus clock\n");
-		return;
-	}
-
 	clk_mod = fdtbus_clock_get(phandle, "mod");
-	if (clk_mod == NULL || clk_enable(clk_mod) != 0) {
-		aprint_error(": couldn't enable mod clock\n");
-		return;
-	}
-
 	clk_pll0 = fdtbus_clock_get(phandle, "pll-0");
-	if (clk_pll0 == NULL || clk_enable(clk_pll0) != 0) {
-		aprint_error(": couldn't enable pll-0 clock\n");
+	if (clk_bus == NULL || clk_mod == NULL || clk_pll0 == NULL) {
+		aprint_error(": couldn't get clocks\n");
 		return;
 	}
 
@@ -449,12 +441,25 @@ sunxi_hdmiphy_attach(device_t parent, de
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
+	sc->sc_clk_bus = clk_bus;
+	sc->sc_clk_mod = clk_mod;
 	sc->sc_clk_pll0 = clk_pll0;
 
 	aprint_naive("\n");
 	aprint_normal(": HDMI PHY\n");
 
 	fdtbus_register_phy_controller(self, phandle, _hdmiphy_funcs);
+}
+
+void
+sunxi_hdmiphy_init(struct fdtbus_phy *phy)
+{
+	device_t dev = fdtbus_phy_device(phy);
+	struct sunxi_hdmiphy_softc * const sc = device_private(dev);
+
+	clk_enable(sc->sc_clk_bus);
+	clk_enable(sc->sc_clk_mod);
+	clk_enable(sc->sc_clk_pll0);
 
 	PHY_WRITE(sc, READ_EN, READ_EN_MAGIC);
 	PHY_WRITE(sc, UNSCRAMBLE, UNSCRAMBLE_MAGIC);

Index: 

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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 12:30:45 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sunxi_dwhdmi.c sunxi_hdmiphy.c sunxi_hdmiphy.h

Log Message:
HDMI PHY and TX share the same clocks. Do not enable clocks until both
reset resources have been deasserted. Explicitly set DDC clock dividers.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_dwhdmi.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_hdmiphy.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_hdmiphy.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/sunxi

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 12:29:20 UTC 2019

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

Log Message:
Add TCON0 clock


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

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



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

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 12:29:20 UTC 2019

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

Log Message:
Add TCON0 clock


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

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun50i_a64_ccu.c
diff -u src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.16 src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.17
--- src/sys/arch/arm/sunxi/sun50i_a64_ccu.c:1.16	Fri Nov 22 19:46:38 2019
+++ src/sys/arch/arm/sunxi/sun50i_a64_ccu.c	Sat Nov 23 12:29:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i_a64_ccu.c,v 1.16 2019/11/22 19:46:38 jmcneill Exp $ */
+/* $NetBSD: sun50i_a64_ccu.c,v 1.17 2019/11/23 12:29:20 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.16 2019/11/22 19:46:38 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun50i_a64_ccu.c,v 1.17 2019/11/23 12:29:20 jmcneill Exp $");
 
 #include 
 #include 
@@ -69,6 +69,7 @@ __KERNEL_RCSID(1, "$NetBSD: sun50i_a64_c
 #define	DRAM_CFG_REG		0x0f4
 #define	MBUS_RST_REG		0x0fc
 #define	DE_CLK_REG		0x104
+#define	TCON0_CLK_REG		0x118
 #define	TCON1_CLK_REG		0x11c
 #define	AC_DIG_CLK_REG		0x140
 #define	HDMI_CLK_REG		0x150
@@ -161,6 +162,7 @@ static const char *de_parents[] = { "pll
 static const char *hdmi_parents[] = { "pll_video0", "pll_video1" };
 static const char *i2s_parents[] = { "pll_audio_8x", "pll_audio_4x", "pll_audio_2x", "pll_audio" };
 static const char *spi_parents[] = { "hosc", "pll_periph0", "pll_periph1", NULL };
+static const char *tcon0_parents[] = { "pll_mipi", NULL, "pll_video0_2x", NULL };
 static const char *tcon1_parents[] = { "pll_video0", NULL, "pll_video1", NULL };
 static const char *gpu_parents[] = { "pll_gpu" };
 
@@ -459,6 +461,13 @@ static struct sunxi_ccu_clk sun50i_a64_c
 	__BIT(31),		/* enable */
 	SUNXI_CCU_NM_POWER_OF_TWO|SUNXI_CCU_NM_ROUND_DOWN),
 
+	SUNXI_CCU_DIV_GATE(A64_CLK_TCON0, "tcon0", tcon0_parents,
+	TCON0_CLK_REG,	/* reg */
+	0,			/* div */
+	__BITS(26,24),	/* sel */
+	__BIT(31),		/* enable */
+	0),
+
 	SUNXI_CCU_DIV_GATE(A64_CLK_TCON1, "tcon1", tcon1_parents,
 	TCON1_CLK_REG,	/* reg */
 	__BITS(3,0),	/* div */



CVS commit: src/sys/dev/ic

2019-11-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 23 12:28:44 UTC 2019

Modified Files:
src/sys/dev/ic: dw_hdmi.c dw_hdmi.h

Log Message:
Allow bus glue to setup DDC clocks


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/dw_hdmi.c src/sys/dev/ic/dw_hdmi.h

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.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/fs/autofs/autofs_mount.h
diff -u src/sys/fs/autofs/autofs_mount.h:1.2 src/sys/fs/autofs/autofs_mount.h:1.3
--- src/sys/fs/autofs/autofs_mount.h:1.2	Sun Jan 14 22:43:18 2018
+++ src/sys/fs/autofs/autofs_mount.h	Sat Nov 23 08:30:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs_mount.h,v 1.2 2018/01/14 22:43:18 christos Exp $	*/
+/*	$NetBSD: autofs_mount.h,v 1.3 2019/11/23 08:30:39 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 
 /*
  * Arguments to mount autofs filesystem.
- * This structure should only be used by automount(8).
  */
 struct autofs_args {
 	char	*from;



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:30:39 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs_mount.h

Log Message:
autofs: Fix a comment on autofs_args

mount_autofs(8) also uses this.
mount_autofs(8) was added by NetBSD as an optional command (not needed to use 
autofs).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs_mount.h

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.h

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



CVS commit: src/sys/fs/autofs

2019-11-23 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Sat Nov 23 08:00:59 UTC 2019

Modified Files:
src/sys/fs/autofs: autofs.h

Log Message:
autofs: u_int -> unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/fs/autofs/autofs.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/fs/autofs/autofs.h
diff -u src/sys/fs/autofs/autofs.h:1.2 src/sys/fs/autofs/autofs.h:1.3
--- src/sys/fs/autofs/autofs.h:1.2	Sat Nov 23 07:38:03 2019
+++ src/sys/fs/autofs/autofs.h	Sat Nov 23 08:00:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: autofs.h,v 1.2 2019/11/23 07:38:03 tkusumi Exp $	*/
+/*	$NetBSD: autofs.h,v 1.3 2019/11/23 08:00:59 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -145,7 +145,7 @@ struct autofs_request {
 	charar_key[AUTOFS_MAXPATHLEN];
 	charar_options[AUTOFS_MAXPATHLEN];
 	struct callout			ar_callout;
-	volatile u_int			ar_refcount;
+	volatile unsigned int		ar_refcount;
 };
 
 struct autofs_softc {