CVS commit: src/sys/conf

2019-12-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jan  1 06:14:29 UTC 2020

Modified Files:
src/sys/conf: copyright

Log Message:
Welcome to 2020.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/conf/copyright

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

Modified files:

Index: src/sys/conf/copyright
diff -u src/sys/conf/copyright:1.17 src/sys/conf/copyright:1.18
--- src/sys/conf/copyright:1.17	Tue Jan  1 01:52:40 2019
+++ src/sys/conf/copyright	Wed Jan  1 06:14:29 2020
@@ -1,5 +1,5 @@
 Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
-2018, 2019 The NetBSD Foundation, Inc.  All rights reserved.
+2018, 2019, 2020 The NetBSD Foundation, Inc.  All rights reserved.
 Copyright (c) 1982, 1986, 1989, 1991, 1993
 The Regents of the University of California.  All rights reserved.



CVS commit: src/sys/uvm

2019-12-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Jan  1 01:18:34 UTC 2020

Modified Files:
src/sys/uvm: uvm_pdpolicy_clock.c

Log Message:
explicitely include sys/atomic.h for atomic operations.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/uvm/uvm_pdpolicy_clock.c

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

Modified files:

Index: src/sys/uvm/uvm_pdpolicy_clock.c
diff -u src/sys/uvm/uvm_pdpolicy_clock.c:1.28 src/sys/uvm/uvm_pdpolicy_clock.c:1.29
--- src/sys/uvm/uvm_pdpolicy_clock.c:1.28	Tue Dec 31 22:42:51 2019
+++ src/sys/uvm/uvm_pdpolicy_clock.c	Wed Jan  1 01:18:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.28 2019/12/31 22:42:51 ad Exp $	*/
+/*	$NetBSD: uvm_pdpolicy_clock.c,v 1.29 2020/01/01 01:18:34 mlelstv Exp $	*/
 /*	NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $	*/
 
 /*-
@@ -98,13 +98,14 @@
 #else /* defined(PDSIM) */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.28 2019/12/31 22:42:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.29 2020/01/01 01:18:34 mlelstv Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 



CVS commit: src/sys/dev/i2c

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan  1 00:38:31 UTC 2020

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

Log Message:
Add clk provider


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/rkpmic.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/i2c/rkpmic.c
diff -u src/sys/dev/i2c/rkpmic.c:1.5 src/sys/dev/i2c/rkpmic.c:1.6
--- src/sys/dev/i2c/rkpmic.c:1.5	Wed Sep 18 15:12:37 2019
+++ src/sys/dev/i2c/rkpmic.c	Wed Jan  1 00:38:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rkpmic.c,v 1.5 2019/09/18 15:12:37 tnn Exp $ */
+/* $NetBSD: rkpmic.c,v 1.6 2020/01/01 00:38:30 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rkpmic.c,v 1.5 2019/09/18 15:12:37 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rkpmic.c,v 1.6 2020/01/01 00:38:30 jmcneill Exp $");
 
 #include 
 #include 
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: rkpmic.c,v 1
 
 #include 
 
+#include 
+
 #include 
 
 #define	SECONDS_REG		0x00
@@ -67,6 +69,9 @@ __KERNEL_RCSID(0, "$NetBSD: rkpmic.c,v 1
 #define	CHIP_NAME_REG		0x17
 #define	CHIP_VER_REG		0x18
 
+#define	CLK32OUT_REG		0x20
+#define	CLK32OUT_CLKOUT2_EN	__BIT(0)
+
 struct rkpmic_ctrl {
 	const char *	name;
 	uint8_t		enable_reg;
@@ -187,6 +192,12 @@ static const struct rkpmic_config rk808_
 	.nctrl = __arraycount(rk808_ctrls),
 };
 
+struct rkpmic_softc;
+
+struct rkpmic_clk {
+	struct clk	base;
+};
+
 struct rkpmic_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -194,6 +205,8 @@ struct rkpmic_softc {
 	int		sc_phandle;
 	struct todr_chip_handle sc_todr;
 	struct rkpmic_config *sc_conf;
+	struct clk_domain sc_clkdom;
+	struct rkpmic_clk sc_clk[2];
 };
 
 struct rkreg_softc {
@@ -316,6 +329,87 @@ rkpmic_todr_gettime(todr_chip_handle_t c
 	return 0;
 }
 
+static struct clk *
+rkpmic_clk_decode(device_t dev, int cc_phandle, const void *data, size_t len)
+{
+	struct rkpmic_softc * const sc = device_private(dev);
+
+	if (len != 4)
+		return NULL;
+
+	const u_int id = be32dec(data);
+	if (id >= __arraycount(sc->sc_clk))
+		return NULL;
+
+	return >sc_clk[id].base;
+}
+
+static const struct fdtbus_clock_controller_func rkpmic_clk_fdt_funcs = {
+	.decode = rkpmic_clk_decode
+};
+
+static struct clk *
+rkpmic_clk_get(void *priv, const char *name)
+{
+	struct rkpmic_softc * const sc = priv;
+	u_int n;
+
+	for (n = 0; n < __arraycount(sc->sc_clk); n++) {
+		if (strcmp(name, sc->sc_clk[n].base.name) == 0)
+			return >sc_clk[n].base;
+	}
+
+	return NULL;
+}
+
+static u_int
+rkpmic_clk_get_rate(void *priv, struct clk *clk)
+{
+	return 32768;
+}
+
+static int
+rkpmic_clk_enable(void *priv, struct clk *clk)
+{
+	struct rkpmic_softc * const sc = priv;
+	uint8_t val;
+
+	if (clk != >sc_clk[1].base)
+		return 0;
+
+	I2C_LOCK(sc);
+	val = I2C_READ(sc, CLK32OUT_REG);
+	val |= CLK32OUT_CLKOUT2_EN;
+	I2C_WRITE(sc, CLK32OUT_REG, val);
+	I2C_UNLOCK(sc);
+
+	return 0;
+}
+
+static int
+rkpmic_clk_disable(void *priv, struct clk *clk)
+{
+	struct rkpmic_softc * const sc = priv;
+	uint8_t val;
+
+	if (clk != >sc_clk[1].base)
+		return EIO;
+
+	I2C_LOCK(sc);
+	val = I2C_READ(sc, CLK32OUT_REG);
+	val &= ~CLK32OUT_CLKOUT2_EN;
+	I2C_WRITE(sc, CLK32OUT_REG, val);
+	I2C_UNLOCK(sc);
+
+	return 0;
+}
+
+static const struct clk_funcs rkpmic_clk_funcs = {
+	.get = rkpmic_clk_get,
+	.get_rate = rkpmic_clk_get_rate,
+	.enable = rkpmic_clk_enable,
+	.disable = rkpmic_clk_disable,
+};
 
 static int
 rkpmic_match(device_t parent, cfdata_t match, void *aux)
@@ -367,6 +461,21 @@ rkpmic_attach(device_t parent, device_t 
 
 	fdtbus_todr_attach(self, sc->sc_phandle, >sc_todr);
 
+	sc->sc_clkdom.name = device_xname(self);
+	sc->sc_clkdom.funcs = _clk_funcs;
+	sc->sc_clkdom.priv = sc;
+
+	sc->sc_clk[0].base.domain = >sc_clkdom;
+	sc->sc_clk[0].base.name = "xin32k";
+	clk_attach(>sc_clk[0].base);
+
+	sc->sc_clk[1].base.domain = >sc_clkdom;
+	sc->sc_clk[1].base.name = "clkout2";
+	clk_attach(>sc_clk[1].base);
+
+	fdtbus_register_clock_controller(self, sc->sc_phandle,
+	_clk_fdt_funcs);
+
 	regulators = of_find_firstchild_byname(sc->sc_phandle, "regulators");
 	if (regulators < 0)
 		return;



CVS commit: src/sbin/dmesg

2019-12-31 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jan  1 00:24:52 UTC 2020

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

Log Message:
Make recent change build for SMALL builds as well as normal ones.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sbin/dmesg/dmesg.c

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

Modified files:

Index: src/sbin/dmesg/dmesg.c
diff -u src/sbin/dmesg/dmesg.c:1.44 src/sbin/dmesg/dmesg.c:1.45
--- src/sbin/dmesg/dmesg.c:1.44	Tue Dec 31 19:58:56 2019
+++ src/sbin/dmesg/dmesg.c	Wed Jan  1 00:24:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmesg.c,v 1.44 2019/12/31 19:58:56 tsutsui Exp $	*/
+/*	$NetBSD: dmesg.c,v 1.45 2020/01/01 00:24:52 kre Exp $	*/
 /*-
  * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -38,7 +38,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)dmesg.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: dmesg.c,v 1.44 2019/12/31 19:58:56 tsutsui Exp $");
+__RCSID("$NetBSD: dmesg.c,v 1.45 2020/01/01 00:24:52 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -377,8 +377,12 @@ main(int argc, char *argv[])
 continue;
 #endif
 			case ' ':
+#ifndef SMALL
 if (!tstamp && postts) {
 	postts = false;
+#else
+if (!tstamp) {
+#endif
 	continue;
 }
 /*FALLTHROUGH*/



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

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 23:32:05 UTC 2019

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

Log Message:
Fix rump.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.179 src/sys/rump/librump/rumpkern/vm.c:1.180
--- src/sys/rump/librump/rumpkern/vm.c:1.179	Tue Dec 31 13:07:13 2019
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Dec 31 23:32:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.179 2019/12/31 13:07:13 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.179 2019/12/31 13:07:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $");
 
 #include 
 #include 
@@ -416,6 +416,41 @@ uvm_availmem(void)
 	return uvmexp.free;
 }
 
+void
+uvm_pagelock(struct vm_page *pg)
+{
+
+	mutex_enter(>interlock);
+}
+
+void
+uvm_pagelock2(struct vm_page *pg1, struct vm_page *pg2)
+{
+
+	if (pg1 < pg2) {
+		mutex_enter(>interlock);
+		mutex_enter(>interlock);
+	} else {
+		mutex_enter(>interlock);
+		mutex_enter(>interlock);
+	}
+}
+
+void
+uvm_pageunlock(struct vm_page *pg)
+{
+
+	mutex_exit(>interlock);
+}
+
+void
+uvm_pageunlock2(struct vm_page *pg1, struct vm_page *pg2)
+{
+
+	mutex_exit(>interlock);
+	mutex_exit(>interlock);
+}
+
 /* where's your schmonz now? */
 #define PUNLIMIT(a)	\
 p->p_rlimit[a].rlim_cur = p->p_rlimit[a].rlim_max = RLIM_INFINITY;



CVS commit: src/sys

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 22:42:51 UTC 2019

Modified Files:
src/sys/kern: kern_idle.c
src/sys/miscfs/genfs: genfs_io.c
src/sys/ufs/lfs: lfs_pages.c lfs_vfsops.c ulfs_inode.c
src/sys/ufs/ufs: ufs_inode.c
src/sys/uvm: uvm.h uvm_anon.c uvm_aobj.c uvm_bio.c uvm_extern.h
uvm_fault.c uvm_glue.c uvm_loan.c uvm_map.c uvm_object.c uvm_page.c
uvm_page.h uvm_pager.c uvm_pdaemon.c uvm_pdpolicy.h
uvm_pdpolicy_clock.c uvm_pdpolicy_clockpro.c

Log Message:
- Add and use wrapper functions that take and acquire page interlocks, and pairs
  of page interlocks.  Require that the page interlock be held over calls to
  uvm_pageactivate(), uvm_pagewire() and similar.

- Solve the concurrency problem with page replacement state.  Rather than
  updating the global state synchronously, set an intended state on
  individual pages (active, inactive, enqueued, dequeued) while holding the
  page interlock.  After the interlock is released put the pages on a 128
  entry per-CPU queue for their state changes to be made real in batch.
  This results in in a ~400 fold decrease in contention on my test system.
  Proposed on tech-kern but modified to use the page interlock rather than
  atomics to synchronise as it's much easier to maintain that way, and
  cheaper.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/kern/kern_idle.c
cvs rdiff -u -r1.82 -r1.83 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.18 -r1.19 src/sys/ufs/lfs/lfs_pages.c
cvs rdiff -u -r1.366 -r1.367 src/sys/ufs/lfs/lfs_vfsops.c
cvs rdiff -u -r1.22 -r1.23 src/sys/ufs/lfs/ulfs_inode.c
cvs rdiff -u -r1.106 -r1.107 src/sys/ufs/ufs/ufs_inode.c
cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/uvm.h
cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/uvm_anon.c
cvs rdiff -u -r1.132 -r1.133 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.101 -r1.102 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.217 -r1.218 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.213 -r1.214 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.174 -r1.175 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.92 -r1.93 src/sys/uvm/uvm_loan.c src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.368 -r1.369 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.18 -r1.19 src/sys/uvm/uvm_object.c
cvs rdiff -u -r1.219 -r1.220 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.118 -r1.119 src/sys/uvm/uvm_pager.c
cvs rdiff -u -r1.121 -r1.122 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.5 -r1.6 src/sys/uvm/uvm_pdpolicy.h
cvs rdiff -u -r1.27 -r1.28 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.21 -r1.22 src/sys/uvm/uvm_pdpolicy_clockpro.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_idle.c
diff -u src/sys/kern/kern_idle.c:1.28 src/sys/kern/kern_idle.c:1.29
--- src/sys/kern/kern_idle.c:1.28	Fri Dec  6 21:36:10 2019
+++ src/sys/kern/kern_idle.c	Tue Dec 31 22:42:51 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_idle.c,v 1.28 2019/12/06 21:36:10 ad Exp $	*/
+/*	$NetBSD: kern_idle.c,v 1.29 2019/12/31 22:42:51 ad Exp $	*/
 
 /*-
  * Copyright (c)2002, 2006, 2007 YAMAMOTO Takashi,
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.28 2019/12/06 21:36:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.29 2019/12/31 22:42:51 ad Exp $");
 
 #include 
 #include 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_idle.c,
 #include 
 #include 
 
-#include 	/* uvm_pageidlezero */
+#include 	/* uvm_idle */
 #include 
 
 void
@@ -81,7 +81,7 @@ idle_loop(void *dummy)
 		sched_idle();
 		if (!sched_curcpu_runnable_p()) {
 			if ((spc->spc_flags & SPCF_OFFLINE) == 0) {
-uvm_pageidlezero();
+uvm_idle();
 			}
 			if (!sched_curcpu_runnable_p()) {
 cpu_idle();

Index: src/sys/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.82 src/sys/miscfs/genfs/genfs_io.c:1.83
--- src/sys/miscfs/genfs/genfs_io.c:1.82	Tue Dec 31 12:40:27 2019
+++ src/sys/miscfs/genfs/genfs_io.c	Tue Dec 31 22:42:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.82 2019/12/31 12:40:27 ad Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.83 2019/12/31 22:42:50 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.82 2019/12/31 12:40:27 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.83 2019/12/31 22:42:50 ad Exp $");
 
 #include 
 #include 
@@ -491,7 +491,9 @@ out:
 uvm_pagefree(pg);
 continue;
 			}
+			uvm_pagelock(pg);
 			uvm_pageenqueue(pg);
+			uvm_pageunlock(pg);
 			pg->flags &= ~(PG_WANTED|PG_BUSY|PG_FAKE);
 			UVM_PAGE_OWN(pg, NULL);
 		}
@@ -1164,14 +1166,18 @@ retry:
 			if (tpg->offset < startoff || tpg->offset >= endoff)
 continue;
 			if (flags & PGO_DEACTIVATE && tpg->wire_count == 0) {
+uvm_pagelock(tpg);
 uvm_pagedeactivate(tpg);
+uvm_pageunlock(tpg);
 			} else if (flags & PGO_FREE) {
 pmap_page_protect(tpg, VM_PROT_NONE);
 if (tpg->flags & 

CVS commit: src/sys/sys

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 21:35:25 UTC 2019

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

Log Message:
NetBSD 9.99.32 - struct vm_page changed


To generate a diff of this commit:
cvs rdiff -u -r1.632 -r1.633 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.632 src/sys/sys/param.h:1.633
--- src/sys/sys/param.h:1.632	Fri Dec 27 12:53:40 2019
+++ src/sys/sys/param.h	Tue Dec 31 21:35:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.632 2019/12/27 12:53:40 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.633 2019/12/31 21:35:25 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999003100	/* NetBSD 9.99.31 */
+#define	__NetBSD_Version__	999003200	/* NetBSD 9.99.32 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/dev/fdt

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 20:47:05 UTC 2019

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

Log Message:
Remove a stupid printf


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/fdt/fdt_intr.c

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

Modified files:

Index: src/sys/dev/fdt/fdt_intr.c
diff -u src/sys/dev/fdt/fdt_intr.c:1.23 src/sys/dev/fdt/fdt_intr.c:1.24
--- src/sys/dev/fdt/fdt_intr.c:1.23	Sat Nov 16 21:53:38 2019
+++ src/sys/dev/fdt/fdt_intr.c	Tue Dec 31 20:47:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.23 2019/11/16 21:53:38 mlelstv Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.24 2019/12/31 20:47:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.23 2019/11/16 21:53:38 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.24 2019/12/31 20:47:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -138,10 +138,8 @@ fdtbus_intr_establish(int phandle, u_int
 	int ihandle;
 
 	specifier = get_specifier_by_index(phandle, index, );
-	if (specifier == NULL) {
-		printf("%s: handle not found %u@%x\n",__func__,index,phandle);
+	if (specifier == NULL)
 		return NULL;
-	}
 
 	return fdtbus_intr_establish_raw(ihandle, specifier, ipl,
 	flags, func, arg);



CVS commit: src/sbin/dmesg

2019-12-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Dec 31 19:58:56 UTC 2019

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

Log Message:
Fix dmesg(8) to preserve leading whitespaces of kernel messages.

Closes PR/54729.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sbin/dmesg/dmesg.c

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

Modified files:

Index: src/sbin/dmesg/dmesg.c
diff -u src/sbin/dmesg/dmesg.c:1.43 src/sbin/dmesg/dmesg.c:1.44
--- src/sbin/dmesg/dmesg.c:1.43	Tue Jun  4 11:59:05 2019
+++ src/sbin/dmesg/dmesg.c	Tue Dec 31 19:58:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dmesg.c,v 1.43 2019/06/04 11:59:05 kre Exp $	*/
+/*	$NetBSD: dmesg.c,v 1.44 2019/12/31 19:58:56 tsutsui Exp $	*/
 /*-
  * Copyright (c) 1991, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -38,7 +38,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)dmesg.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: dmesg.c,v 1.43 2019/06/04 11:59:05 kre Exp $");
+__RCSID("$NetBSD: dmesg.c,v 1.44 2019/12/31 19:58:56 tsutsui Exp $");
 #endif
 #endif /* not lint */
 
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
 	long nsec, fsec;
 	int scale;
 	int deltas, quiet, humantime;
-	bool frac;
+	bool frac, postts;
 
 	static const int bmib[] = { CTL_KERN, KERN_BOOTTIME };
 	size = sizeof(boottime);
@@ -262,6 +262,7 @@ main(int argc, char *argv[])
 	 */
 #ifndef SMALL
 	frac = false;
+	postts = false;
 	scale = 0;
 #endif
 	for (tstamp = 0, newl = 1, log = i = 0, p = bufdata + cur.msg_bufx;
@@ -310,6 +311,7 @@ main(int argc, char *argv[])
 ADDC(ch);
 ADDC('\0');
 tstamp = 0;
+postts = true;
 sec = fsec = 0;
 switch (sscanf(tbuf, "[%jd.%ld]", , )){
 case EOF:
@@ -375,8 +377,10 @@ main(int argc, char *argv[])
 continue;
 #endif
 			case ' ':
-if (!tstamp)
+if (!tstamp && postts) {
+	postts = false;
 	continue;
+}
 /*FALLTHROUGH*/
 			default:
 #ifndef SMALL



CVS commit: src/sys/dev/usb

2019-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 31 18:11:18 UTC 2019

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

Log Message:
Remove a stray '


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.267 src/sys/dev/usb/ehci.c:1.268
--- src/sys/dev/usb/ehci.c:1.267	Thu Jun 13 17:20:25 2019
+++ src/sys/dev/usb/ehci.c	Tue Dec 31 18:11:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.267 2019/06/13 17:20:25 maxv Exp $ */
+/*	$NetBSD: ehci.c,v 1.268 2019/12/31 18:11:18 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.267 2019/06/13 17:20:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.268 2019/12/31 18:11:18 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2609,7 +2609,7 @@ ehci_roothub_ctrl(struct usbd_bus *bus, 
  * for RB_SINGLE, but the same basic issue exists.
  *
  * The way ehci hand-off works, the companion controller does not get the
- * device until after its' initial bus explore, so the reference dropped
+ * device until after its initial bus explore, so the reference dropped
  * after the first explore is not enough.  5 seconds should be enough,
  * and EHCI_DISOWN_DELAY_SECONDS can be set to another value.
  *



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

2019-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 31 18:09:21 UTC 2019

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Improve a comment


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/sys/arch/arm/arm32/pmap.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/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.374 src/sys/arch/arm/arm32/pmap.c:1.375
--- src/sys/arch/arm/arm32/pmap.c:1.374	Wed Sep 25 16:37:54 2019
+++ src/sys/arch/arm/arm32/pmap.c	Tue Dec 31 18:09:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.374 2019/09/25 16:37:54 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.375 2019/12/31 18:09:21 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
 #include 
 #endif
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2019/09/25 16:37:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375 2019/12/31 18:09:21 skrll Exp $");
 
 //#define PMAP_DEBUG
 #ifdef PMAP_DEBUG
@@ -3633,8 +3633,8 @@ pmap_kremove_pg(struct vm_page *pg, vadd
 	KASSERT(PV_IS_KENTRY_P(pv->pv_flags));
 
 	/*
-	 * If we are removing a writeable mapping to a cached exec page,
-	 * if it's the last mapping then clear it execness other sync
+	 * We are removing a writeable mapping to a cached exec page, if
+	 * it's the last mapping then clear its execness otherwise sync
 	 * the page to the icache.
 	 */
 	if ((md->pvh_attrs & (PVF_NC|PVF_EXEC)) == PVF_EXEC



CVS commit: src/sys/uvm

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 17:56:16 UTC 2019

Modified Files:
src/sys/uvm: uvm_page.h

Log Message:
struct vm_page: cluster fields most heavily used by the page allocator and
uvmpdpol at the start of the structure, so that while under global lock we
need only touch one cache line for each vm_page.  There is still the problem
of vm_page not being aligned, but this seems to drop lock wait time for
(a modified) uvmpdpol and the allocator by 20-30% in a quick test.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_page.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/uvm/uvm_page.h
diff -u src/sys/uvm/uvm_page.h:1.91 src/sys/uvm/uvm_page.h:1.92
--- src/sys/uvm/uvm_page.h:1.91	Tue Dec 31 12:40:27 2019
+++ src/sys/uvm/uvm_page.h	Tue Dec 31 17:56:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.h,v 1.91 2019/12/31 12:40:27 ad Exp $	*/
+/*	$NetBSD: uvm_page.h,v 1.92 2019/12/31 17:56:16 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -142,6 +142,13 @@
  * - uvm_pagefree: owned by a uvm_object/vm_anon -> free
  * - uvm_pglistalloc: free -> allocated by uvm_pglistalloc
  * - uvm_pglistfree: allocated by uvm_pglistalloc -> free
+ *
+ * On the ordering of fields:
+ *
+ * The fields most heavily used by the page allocator and uvmpdpol are
+ * clustered together at the start of the structure, so that while under
+ * global lock it's more likely that only one cache line for each page need
+ * be touched.
  */
 
 struct vm_page {
@@ -151,16 +158,16 @@ struct vm_page {
 		LIST_ENTRY(vm_page) list;	/* f: global free page queue */
 	} pageq;
 	TAILQ_ENTRY(vm_page)	pdqueue;	/* p: pagedaemon queue */
-	struct vm_anon		*uanon;		/* o,i: anon */
-	struct uvm_object	*uobject;	/* o,i: object */
-	voff_t			offset;		/* o: offset into object */
+	kmutex_t		interlock;	/* s: lock on identity */
+	uint32_t		pqflags;	/* i: pagedaemon flags */
 	uint16_t		flags;		/* o: object flags */
 	uint16_t		spare;		/*  : spare for now */
-	uint32_t		pqflags;	/* p: pagedaemon flags */
+	paddr_t			phys_addr;	/* o: physical address of pg */
 	uint32_t		loan_count;	/* o,i: num. active loans */
 	uint32_t		wire_count;	/* o,i: wired down map refs */
-	paddr_t			phys_addr;	/* o: physical address of pg */
-	kmutex_t		interlock;	/* s: lock on identity */
+	struct vm_anon		*uanon;		/* o,i: anon */
+	struct uvm_object	*uobject;	/* o,i: object */
+	voff_t			offset;		/* o: offset into object */
 
 #ifdef __HAVE_VM_PAGE_MD
 	struct vm_page_md	mdpage;		/* ?: pmap-specific data */



CVS commit: src/sys

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 17:26:04 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpi_machdep.c
src/sys/dev/acpi: acpi_resource.c acpivar.h

Log Message:
Rely on 32/64-bit overflow to calculate translation offsets. Store this
as a separate ar_xbase field in acpi_mem instead of having separate
ar_offset and ar_decode fields.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/acpi/acpi_machdep.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/acpi/acpi_resource.c
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/acpi/acpivar.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/acpi/acpi_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_machdep.c:1.17 src/sys/arch/arm/acpi/acpi_machdep.c:1.18
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.17	Tue Dec 31 13:54:22 2019
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Tue Dec 31 17:26:04 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.17 2019/12/31 13:54:22 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.18 2019/12/31 17:26:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.17 2019/12/31 13:54:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.18 2019/12/31 17:26:04 jmcneill Exp $");
 
 #include 
 #include 
@@ -438,20 +438,17 @@ default_tag:
 	for (n = 0; n < res.ar_nmem; n++) {
 		mem = acpi_res_mem(, n);
 		dmat->_ranges[n].dr_busbase = mem->ar_base;
-		dmat->_ranges[n].dr_sysbase = mem->ar_base;
-		if (mem->ar_decode == ACPI_POS_DECODE)
-		 	dmat->_ranges[n].dr_sysbase += mem->ar_offset;
-		else
-			dmat->_ranges[n].dr_sysbase -= mem->ar_offset;
+		dmat->_ranges[n].dr_sysbase = mem->ar_xbase;
 		dmat->_ranges[n].dr_len = mem->ar_length;
 		dmat->_ranges[n].dr_flags = flags;
 
 		aprint_debug_dev(sc->sc_dev,
-		"%s: DMA sysbase %#lx busbase %#lx len %#lx%s\n",
+		"%s: DMA sys %#lx-%#lx bus %#lx-%#lx%s\n",
 		acpi_name(ad->ad_handle),
 		dmat->_ranges[n].dr_sysbase,
+		dmat->_ranges[n].dr_sysbase + dmat->_ranges[n].dr_len - 1,
 		dmat->_ranges[n].dr_busbase,
-		dmat->_ranges[n].dr_len,
+		dmat->_ranges[n].dr_busbase + dmat->_ranges[n].dr_len - 1,
 		flags ? " (coherent)" : "");
 	}
 

Index: src/sys/dev/acpi/acpi_resource.c
diff -u src/sys/dev/acpi/acpi_resource.c:1.40 src/sys/dev/acpi/acpi_resource.c:1.41
--- src/sys/dev/acpi/acpi_resource.c:1.40	Tue Dec 31 13:39:15 2019
+++ src/sys/dev/acpi/acpi_resource.c	Tue Dec 31 17:26:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_resource.c,v 1.40 2019/12/31 13:39:15 jmcneill Exp $	*/
+/*	$NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.40 2019/12/31 13:39:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $");
 
 #include 
 #include 
@@ -148,7 +148,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 			(*ops->memory)(arg->dev, arg->context,
 			res->Data.FixedMemory32.Address,
 			res->Data.FixedMemory32.AddressLength,
-			0, 0);
+			res->Data.FixedMemory32.Address);
 		break;
 
 	case ACPI_RESOURCE_TYPE_MEMORY32:
@@ -162,7 +162,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 (*ops->memory)(arg->dev, arg->context,
 res->Data.Memory32.Minimum,
 res->Data.Memory32.AddressLength,
-0, 0);
+res->Data.Memory32.Minimum);
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
 	 "Memory32 0x%x-0x%x/%u\n",
@@ -189,7 +189,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 (*ops->memory)(arg->dev, arg->context,
 res->Data.Memory24.Minimum,
 res->Data.Memory24.AddressLength,
-0, 0);
+res->Data.Memory24.Minimum);
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
 	 "Memory24 0x%x-0x%x/%u\n",
@@ -259,8 +259,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 	(*ops->memory)(arg->dev, arg->context,
 	res->Data.Address32.Address.Minimum,
 	res->Data.Address32.Address.AddressLength,
-	res->Data.Address32.Address.TranslationOffset,
-	res->Data.Address32.Decode);
+	res->Data.Address32.Address.Minimum +
+	res->Data.Address32.Address.TranslationOffset);
 			} else {
 if (ops->memrange)
 	(*ops->memrange)(arg->dev, arg->context,
@@ -314,8 +314,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 	(*ops->memory)(arg->dev, arg->context,
 	res->Data.Address64.Address.Minimum,
 	res->Data.Address64.Address.AddressLength,
-	res->Data.Address64.Address.TranslationOffset,
-	res->Data.Address64.Decode);
+	res->Data.Address64.Address.Minimum +
+	res->Data.Address64.Address.TranslationOffset);
 			} else {
 

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

2019-12-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Dec 31 15:07:22 UTC 2019

Modified Files:
src/sys/arch/amd64/conf: MODULAR

Log Message:
Update to not include COMPAT_90


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/amd64/conf/MODULAR

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

Modified files:

Index: src/sys/arch/amd64/conf/MODULAR
diff -u src/sys/arch/amd64/conf/MODULAR:1.12 src/sys/arch/amd64/conf/MODULAR:1.13
--- src/sys/arch/amd64/conf/MODULAR:1.12	Mon Jun 17 03:31:57 2019
+++ src/sys/arch/amd64/conf/MODULAR	Tue Dec 31 15:07:22 2019
@@ -1,4 +1,4 @@
-# $NetBSD: MODULAR,v 1.12 2019/06/17 03:31:57 christos Exp $
+# $NetBSD: MODULAR,v 1.13 2019/12/31 15:07:22 pgoyette Exp $
 #
 # Try to exclude all the drivers in GENERIC that have been modularized
 # XXX: incomplete
@@ -22,8 +22,9 @@ options 	MODULAR_DEFAULT_AUTOLOAD
 -no options 	COMPAT_40	# NetBSD 4.0,
 -no options 	COMPAT_50	# NetBSD 5.0,
 -no options 	COMPAT_60	# NetBSD 6.0,
--no options 	COMPAT_70	# NetBSD 7.0, and
--no options 	COMPAT_80	# NetBSD 8.0 binary compatibility.
+-no options 	COMPAT_70	# NetBSD 7.0,
+-no options 	COMPAT_80	# NetBSD 8.0, and
+-no options 	COMPAT_90	# NetBSD 9.0 binary compatibility.
 -no options 	COMPAT_43	# and 4.3BSD
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 



CVS commit: src/external/cddl/osnet/sys/kern

2019-12-31 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Dec 31 14:51:29 UTC 2019

Modified Files:
src/external/cddl/osnet/sys/kern: misc.c

Log Message:
Another rename from uvm_free() --> uvm_availmem()


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/sys/kern/misc.c

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

Modified files:

Index: src/external/cddl/osnet/sys/kern/misc.c
diff -u src/external/cddl/osnet/sys/kern/misc.c:1.6 src/external/cddl/osnet/sys/kern/misc.c:1.7
--- src/external/cddl/osnet/sys/kern/misc.c:1.6	Sat Dec 21 13:00:20 2019
+++ src/external/cddl/osnet/sys/kern/misc.c	Tue Dec 31 14:51:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.6 2019/12/21 13:00:20 ad Exp $	*/
+/*	$NetBSD: misc.c,v 1.7 2019/12/31 14:51:29 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@ kmem_reap(void)
 	int bufcnt;
 	struct pool *pp;
 	
-	bufcnt = uvmexp.freetarg - uvm_free();
+	bufcnt = uvmexp.freetarg - uvm_availmem();
 	if (bufcnt < 0)
 		bufcnt = 0;
 



CVS commit: src/sys/dev/i2c

2019-12-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 31 14:27:50 UTC 2019

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

Log Message:
Fix mis-placed parentheses.  PR kern/54813.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/nxt2k.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/i2c/nxt2k.c
diff -u src/sys/dev/i2c/nxt2k.c:1.6 src/sys/dev/i2c/nxt2k.c:1.7
--- src/sys/dev/i2c/nxt2k.c:1.6	Mon Dec 23 19:00:59 2019
+++ src/sys/dev/i2c/nxt2k.c	Tue Dec 31 14:27:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: nxt2k.c,v 1.6 2019/12/23 19:00:59 thorpej Exp $ */
+/* $NetBSD: nxt2k.c,v 1.7 2019/12/31 14:27:50 thorpej Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nxt2k.c,v 1.6 2019/12/23 19:00:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nxt2k.c,v 1.7 2019/12/31 14:27:50 thorpej Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ nxt2k_writedata(struct nxt2k *nxt, uint8
 
 	KASSERT((len + 1) <= 384);
 
-	if ((error = iic_acquire_bus(nxt->tag, 0) != 0))
+	if ((error = iic_acquire_bus(nxt->tag, 0)) != 0)
 		return error;
 
 	buffer[0] = reg;
@@ -93,7 +93,7 @@ nxt2k_readdata(struct nxt2k *nxt, uint8_
 {
 	int error;
 
-	if ((error = iic_acquire_bus(nxt->tag, 0) != 0))
+	if ((error = iic_acquire_bus(nxt->tag, 0)) != 0)
 		return error;
 
 	error = iic_exec(nxt->tag, I2C_OP_READ_WITH_STOP, nxt->addr,



CVS commit: src/sys/dev/i2c

2019-12-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 31 14:25:33 UTC 2019

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

Log Message:
Fix mis-placed parentheses.  PR kern/54812.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/cx24227.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/i2c/cx24227.c
diff -u src/sys/dev/i2c/cx24227.c:1.10 src/sys/dev/i2c/cx24227.c:1.11
--- src/sys/dev/i2c/cx24227.c:1.10	Mon Dec 23 18:09:05 2019
+++ src/sys/dev/i2c/cx24227.c	Tue Dec 31 14:25:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cx24227.c,v 1.10 2019/12/23 18:09:05 thorpej Exp $ */
+/* $NetBSD: cx24227.c,v 1.11 2019/12/31 14:25:33 thorpej Exp $ */
 
 /*
  * Copyright (c) 2008, 2011 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.10 2019/12/23 18:09:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cx24227.c,v 1.11 2019/12/31 14:25:33 thorpej Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@ cx24227_writereg(struct cx24227 *sc, uin
 	int error;
 	uint8_t r[3];
 
-	if ((error = iic_acquire_bus(sc->tag, 0) != 0))
+	if ((error = iic_acquire_bus(sc->tag, 0)) != 0)
 		return error;
 
 	r[0] = reg;
@@ -130,7 +130,7 @@ cx24227_readreg(struct cx24227 *sc, uint
 
 	*data = 0x;
 
-	if ((error = iic_acquire_bus(sc->tag, 0) != 0))
+	if ((error = iic_acquire_bus(sc->tag, 0)) != 0)
 		return error;
 
 	error = iic_exec(sc->tag, I2C_OP_READ_WITH_STOP, sc->addr,



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

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 13:54:22 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpi_machdep.c

Log Message:
Create bus_dma tags for each device node based on _CCA and _DMA properties
found by walking up the device node tree. These tags encode range
restrictions, address translations, and whether or not the device is
cache coherent.


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

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_machdep.c:1.16 src/sys/arch/arm/acpi/acpi_machdep.c:1.17
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.16	Tue Dec 31 11:42:46 2019
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Tue Dec 31 13:54:22 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.16 2019/12/31 11:42:46 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.17 2019/12/31 13:54:22 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,13 +32,14 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.16 2019/12/31 11:42:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.17 2019/12/31 13:54:22 jmcneill Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -372,88 +373,123 @@ static const char * const module_hid[] =
 	NULL
 };
 
-static bus_dma_tag_t
-arm_acpi_dma_tag_subregion(struct acpi_softc *sc, bus_dma_tag_t dmat,
-ACPI_HANDLE handle)
+static ACPI_HANDLE
+arm_acpi_dma_module(struct acpi_softc *sc, struct acpi_devnode *ad)
+{
+	ACPI_HANDLE tmp;
+	ACPI_STATUS rv;
+
+	/*
+	 * Search up the tree for a module device with a _DMA method.
+	 */
+	for (; ad != NULL; ad = ad->ad_parent) {
+		if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
+			continue;
+		if (!acpi_match_hid(ad->ad_devinfo, module_hid))
+			continue;
+		rv = AcpiGetHandle(ad->ad_handle, "_DMA", );
+		if (ACPI_SUCCESS(rv))
+			return ad->ad_handle;
+	}
+
+	return NULL;
+}
+
+static void
+arm_acpi_dma_init_ranges(struct acpi_softc *sc, struct acpi_devnode *ad,
+struct arm32_bus_dma_tag *dmat, uint32_t flags)
 {
 	struct acpi_resources res;
 	struct acpi_mem *mem;
-	bus_dma_tag_t newtag;
+	ACPI_HANDLE module;
 	ACPI_STATUS rv;
-	int error;
+	int n;
 
-	rv = acpi_resource_parse(sc->sc_dev, handle, "_DMA", ,
-	_resource_parse_ops_quiet);
-	if (ACPI_FAILURE(rv))
-		return dmat;	/* no translation required */
+	module = arm_acpi_dma_module(sc, ad->ad_parent);
+	if (module == NULL) {
+default_tag:
+		/* No translation required */
+		dmat->_nranges = 1;
+		dmat->_ranges = kmem_zalloc(sizeof(*dmat->_ranges), KM_SLEEP);
+		dmat->_ranges[0].dr_sysbase = 0;
+		dmat->_ranges[0].dr_busbase = 0;
+		dmat->_ranges[0].dr_len = UINTPTR_MAX;
+		dmat->_ranges[0].dr_flags = flags;
+		return;
+	}
 
-	mem = acpi_res_mem(, 0);
-	if (mem == NULL)
-		goto done;
-
-	aprint_debug_dev(sc->sc_dev, "_DMA range %#lx-%#lx\n",
-	mem->ar_base, mem->ar_base + mem->ar_length - 1);
-
-	error = bus_dmatag_subregion(dmat,
-	mem->ar_base, mem->ar_base + mem->ar_length - 1,
-	, BUS_DMA_WAITOK);
-	if (error != 0) {
+	rv = acpi_resource_parse(sc->sc_dev, module, "_DMA", ,
+	_resource_parse_ops_quiet);
+	if (ACPI_FAILURE(rv)) {
 		aprint_error_dev(sc->sc_dev,
-		"_DMA subregion failed: %d\n", error);
-		goto done;
+		"failed to parse _DMA on %s: %s\n",
+		acpi_name(module), AcpiFormatException(rv));
+		goto default_tag;
+	}
+	if (res.ar_nmem == 0) {
+		acpi_resource_cleanup();
+		goto default_tag;
 	}
-	dmat = newtag;
 
-done:
-	acpi_resource_cleanup();
+	dmat->_nranges = res.ar_nmem;
+	dmat->_ranges = kmem_zalloc(sizeof(*dmat->_ranges) * res.ar_nmem,
+	KM_SLEEP);
+
+	for (n = 0; n < res.ar_nmem; n++) {
+		mem = acpi_res_mem(, n);
+		dmat->_ranges[n].dr_busbase = mem->ar_base;
+		dmat->_ranges[n].dr_sysbase = mem->ar_base;
+		if (mem->ar_decode == ACPI_POS_DECODE)
+		 	dmat->_ranges[n].dr_sysbase += mem->ar_offset;
+		else
+			dmat->_ranges[n].dr_sysbase -= mem->ar_offset;
+		dmat->_ranges[n].dr_len = mem->ar_length;
+		dmat->_ranges[n].dr_flags = flags;
+
+		aprint_debug_dev(sc->sc_dev,
+		"%s: DMA sysbase %#lx busbase %#lx len %#lx%s\n",
+		acpi_name(ad->ad_handle),
+		dmat->_ranges[n].dr_sysbase,
+		dmat->_ranges[n].dr_busbase,
+		dmat->_ranges[n].dr_len,
+		flags ? " (coherent)" : "");
+	}
 
-	return dmat;
+	acpi_resource_cleanup();
 }
 
-static ACPI_HANDLE
-arm_acpi_dma_module(struct acpi_softc *sc, struct acpi_devnode *ad)
+static uint32_t
+arm_acpi_dma_flags(struct acpi_softc *sc, struct acpi_devnode *ad)
 {
-	ACPI_HANDLE tmp;
+	ACPI_INTEGER cca = 1;	/* default cache coherent */
 	ACPI_STATUS rv;
 
-	/*
-	 * Search up the tree for a module device with a _DMA method.
-	 */
 	for (; ad != NULL; ad = ad->ad_parent) {
 		if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
 			

CVS commit: src/sys/dev/acpi

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 13:39:15 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_resource.c acpivar.h

Log Message:
Include device decoding type in acpi_mem resources


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/acpi/acpi_resource.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/acpi/acpivar.h

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

Modified files:

Index: src/sys/dev/acpi/acpi_resource.c
diff -u src/sys/dev/acpi/acpi_resource.c:1.39 src/sys/dev/acpi/acpi_resource.c:1.40
--- src/sys/dev/acpi/acpi_resource.c:1.39	Tue Dec 31 12:27:50 2019
+++ src/sys/dev/acpi/acpi_resource.c	Tue Dec 31 13:39:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_resource.c,v 1.39 2019/12/31 12:27:50 jmcneill Exp $	*/
+/*	$NetBSD: acpi_resource.c,v 1.40 2019/12/31 13:39:15 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.39 2019/12/31 12:27:50 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.40 2019/12/31 13:39:15 jmcneill Exp $");
 
 #include 
 #include 
@@ -148,7 +148,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 			(*ops->memory)(arg->dev, arg->context,
 			res->Data.FixedMemory32.Address,
 			res->Data.FixedMemory32.AddressLength,
-			0);
+			0, 0);
 		break;
 
 	case ACPI_RESOURCE_TYPE_MEMORY32:
@@ -162,7 +162,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 (*ops->memory)(arg->dev, arg->context,
 res->Data.Memory32.Minimum,
 res->Data.Memory32.AddressLength,
-0);
+0, 0);
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
 	 "Memory32 0x%x-0x%x/%u\n",
@@ -189,7 +189,7 @@ acpi_resource_parse_callback(ACPI_RESOUR
 (*ops->memory)(arg->dev, arg->context,
 res->Data.Memory24.Minimum,
 res->Data.Memory24.AddressLength,
-0);
+0, 0);
 		} else {
 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
 	 "Memory24 0x%x-0x%x/%u\n",
@@ -259,7 +259,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 	(*ops->memory)(arg->dev, arg->context,
 	res->Data.Address32.Address.Minimum,
 	res->Data.Address32.Address.AddressLength,
-	res->Data.Address32.Address.TranslationOffset);
+	res->Data.Address32.Address.TranslationOffset,
+	res->Data.Address32.Decode);
 			} else {
 if (ops->memrange)
 	(*ops->memrange)(arg->dev, arg->context,
@@ -313,7 +314,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 	(*ops->memory)(arg->dev, arg->context,
 	res->Data.Address64.Address.Minimum,
 	res->Data.Address64.Address.AddressLength,
-	res->Data.Address64.Address.TranslationOffset);
+	res->Data.Address64.Address.TranslationOffset,
+	res->Data.Address64.Decode);
 			} else {
 if (ops->memrange)
 	(*ops->memrange)(arg->dev, arg->context,
@@ -652,7 +654,7 @@ static void	acpi_res_parse_iorange(devic
 		uint32_t, uint32_t, uint32_t);
 
 static void	acpi_res_parse_memory(device_t, void *, uint64_t,
-		uint64_t, uint64_t);
+		uint64_t, uint64_t, uint8_t);
 static void	acpi_res_parse_memrange(device_t, void *, uint64_t,
 		uint64_t, uint64_t, uint64_t);
 
@@ -802,7 +804,7 @@ acpi_res_parse_iorange(device_t dev, voi
 
 static void
 acpi_res_parse_memory(device_t dev, void *context, uint64_t base,
-uint64_t length, uint64_t offset)
+uint64_t length, uint64_t offset, uint8_t decode)
 {
 	struct acpi_resources *res = context;
 	struct acpi_mem *ar;
@@ -819,6 +821,7 @@ acpi_res_parse_memory(device_t dev, void
 	ar->ar_base = base;
 	ar->ar_length = length;
 	ar->ar_offset = offset;
+	ar->ar_decode = decode;
 
 	SIMPLEQ_INSERT_TAIL(>ar_mem, ar, ar_list);
 }

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.79 src/sys/dev/acpi/acpivar.h:1.80
--- src/sys/dev/acpi/acpivar.h:1.79	Tue Dec 31 12:27:50 2019
+++ src/sys/dev/acpi/acpivar.h	Tue Dec 31 13:39:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.79 2019/12/31 12:27:50 jmcneill Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.80 2019/12/31 13:39:15 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -227,6 +227,7 @@ struct acpi_mem {
 	bus_addr_t	ar_base;
 	bus_size_t	ar_length;
 	bus_addr_t	ar_offset;
+	uint8_t		ar_decode;
 };
 
 struct acpi_memrange {
@@ -285,7 +286,8 @@ struct acpi_resource_parse_ops {
 	void	(*iorange)(device_t, void *, uint32_t, uint32_t,
 		uint32_t, uint32_t);
 
-	void	(*memory)(device_t, void *, uint64_t, uint64_t, uint64_t);
+	void	(*memory)(device_t, void *, uint64_t, uint64_t,
+		uint64_t, uint8_t);
 	void	(*memrange)(device_t, void *, uint64_t, uint64_t,
 		uint64_t, uint64_t);
 



CVS commit: src

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 13:07:14 UTC 2019

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: arc.c
src/sys/arch/alpha/alpha: machdep.c
src/sys/arch/atari/atari: machdep.c
src/sys/arch/cesfic/cesfic: machdep.c
src/sys/arch/emips/emips: machdep.c
src/sys/arch/evbppc/explora: machdep.c
src/sys/arch/evbppc/virtex: machdep.c
src/sys/arch/evbppc/walnut: machdep.c
src/sys/arch/ews4800mips/ews4800mips: machdep.c
src/sys/arch/hp300/hp300: machdep.c
src/sys/arch/hppa/hppa: machdep.c
src/sys/arch/luna68k/luna68k: machdep.c
src/sys/arch/mac68k/mac68k: machdep.c
src/sys/arch/mips/mips: cpu_subr.c
src/sys/arch/mvme68k/mvme68k: machdep.c
src/sys/arch/news68k/news68k: machdep.c
src/sys/arch/next68k/next68k: machdep.c
src/sys/arch/powerpc/booke: booke_machdep.c
src/sys/arch/powerpc/ibm4xx: ibm4xx_machdep.c
src/sys/arch/powerpc/oea: oea_machdep.c
src/sys/arch/riscv/riscv: riscv_machdep.c
src/sys/arch/sgimips/sgimips: machdep.c
src/sys/arch/sh3/sh3: sh3_machdep.c
src/sys/arch/sparc/sparc: machdep.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/arch/sun2/sun2: machdep.c
src/sys/arch/sun3/sun3: machdep.c
src/sys/arch/sun3/sun3x: machdep.c
src/sys/arch/vax/vax: machdep.c
src/sys/arch/x68k/x68k: machdep.c
src/sys/compat/linux/common: linux_misc.c
src/sys/compat/linux32/common: linux32_sysinfo.c
src/sys/dev: ccd.c
src/sys/fs/tmpfs: tmpfs_mem.c
src/sys/kern: init_main.c kern_module.c kern_proc.c vfs_bio.c
src/sys/miscfs/procfs: procfs_linux.c
src/sys/rump/librump/rumpkern: vm.c
src/sys/ufs/chfs: chfs_subr.c
src/sys/ufs/lfs: lfs_bio.c
src/sys/uvm: uvm_extern.h uvm_glue.c uvm_meter.c uvm_page.c
uvm_pdaemon.c uvm_pdpolicy_clock.c uvm_pglist.c uvm_stat.c

Log Message:
Rename uvm_free() -> uvm_availmem().


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/arc.c
cvs rdiff -u -r1.356 -r1.357 src/sys/arch/alpha/alpha/machdep.c
cvs rdiff -u -r1.181 -r1.182 src/sys/arch/atari/atari/machdep.c
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/cesfic/cesfic/machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/emips/emips/machdep.c
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/evbppc/explora/machdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/evbppc/virtex/machdep.c
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbppc/walnut/machdep.c
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/ews4800mips/ews4800mips/machdep.c
cvs rdiff -u -r1.231 -r1.232 src/sys/arch/hp300/hp300/machdep.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/hppa/hppa/machdep.c
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/luna68k/luna68k/machdep.c
cvs rdiff -u -r1.356 -r1.357 src/sys/arch/mac68k/mac68k/machdep.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.156 -r1.157 src/sys/arch/mvme68k/mvme68k/machdep.c
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/news68k/news68k/machdep.c
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/next68k/next68k/machdep.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/powerpc/booke/booke_machdep.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/powerpc/ibm4xx/ibm4xx_machdep.c
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/powerpc/oea/oea_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.148 -r1.149 src/sys/arch/sgimips/sgimips/machdep.c
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/sh3/sh3/sh3_machdep.c
cvs rdiff -u -r1.332 -r1.333 src/sys/arch/sparc/sparc/machdep.c
cvs rdiff -u -r1.296 -r1.297 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/sun2/sun2/machdep.c
cvs rdiff -u -r1.210 -r1.211 src/sys/arch/sun3/sun3/machdep.c
cvs rdiff -u -r1.137 -r1.138 src/sys/arch/sun3/sun3x/machdep.c
cvs rdiff -u -r1.194 -r1.195 src/sys/arch/vax/vax/machdep.c
cvs rdiff -u -r1.201 -r1.202 src/sys/arch/x68k/x68k/machdep.c
cvs rdiff -u -r1.246 -r1.247 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/compat/linux32/common/linux32_sysinfo.c
cvs rdiff -u -r1.182 -r1.183 src/sys/dev/ccd.c
cvs rdiff -u -r1.11 -r1.12 src/sys/fs/tmpfs/tmpfs_mem.c
cvs rdiff -u -r1.513 -r1.514 src/sys/kern/init_main.c
cvs rdiff -u -r1.142 -r1.143 src/sys/kern/kern_module.c
cvs rdiff -u -r1.238 -r1.239 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.285 -r1.286 src/sys/kern/vfs_bio.c
cvs rdiff -u -r1.78 -r1.79 src/sys/miscfs/procfs/procfs_linux.c
cvs rdiff -u -r1.178 -r1.179 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.10 -r1.11 src/sys/ufs/chfs/chfs_subr.c
cvs rdiff -u -r1.143 -r1.144 src/sys/ufs/lfs/lfs_bio.c
cvs rdiff -u -r1.216 -r1.217 src/sys/uvm/uvm_extern.h
cvs rdiff -u -r1.173 -r1.174 src/sys/uvm/uvm_glue.c
cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/uvm_meter.c
cvs rdiff -u -r1.218 -r1.219 

CVS commit: src/sys

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 12:40:27 UTC 2019

Modified Files:
src/sys/arch/hppa/hppa: pmap.c
src/sys/arch/x86/x86: pmap.c
src/sys/miscfs/genfs: genfs_io.c
src/sys/rump/librump/rumpkern: vm.c
src/sys/uvm: uvm_page.c uvm_page.h uvm_pdaemon.c uvm_pdpolicy_clock.c
uvm_pdpolicy_clockpro.c

Log Message:
Rename uvm_page_locked_p() -> uvm_page_owner_locked_p()


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/hppa/hppa/pmap.c
cvs rdiff -u -r1.348 -r1.349 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.81 -r1.82 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.177 -r1.178 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.217 -r1.218 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.119 -r1.120 src/sys/uvm/uvm_pdaemon.c
cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/uvm_pdpolicy_clock.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/uvm_pdpolicy_clockpro.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/hppa/hppa/pmap.c
diff -u src/sys/arch/hppa/hppa/pmap.c:1.101 src/sys/arch/hppa/hppa/pmap.c:1.102
--- src/sys/arch/hppa/hppa/pmap.c:1.101	Sun Dec 15 21:11:34 2019
+++ src/sys/arch/hppa/hppa/pmap.c	Tue Dec 31 12:40:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.101 2019/12/15 21:11:34 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.102 2019/12/31 12:40:27 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.101 2019/12/15 21:11:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.102 2019/12/31 12:40:27 ad Exp $");
 
 #include "opt_cputype.h"
 
@@ -579,7 +579,7 @@ pmap_pv_enter(struct vm_page *pg, struct
 	DPRINTF(PDB_FOLLOW|PDB_PV, ("%s(%p, %p, %p, 0x%lx, %p, 0x%x)\n",
 	__func__, pg, pve, pm, va, pdep, flags));
 
-	KASSERT(pm == pmap_kernel() || uvm_page_locked_p(pg));
+	KASSERT(pm == pmap_kernel() || uvm_page_owner_locked_p(pg));
 
 	pve->pv_pmap = pm;
 	pve->pv_va = va | flags;
@@ -594,7 +594,7 @@ pmap_pv_remove(struct vm_page *pg, pmap_
 	struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
 	struct pv_entry **pve, *pv;
 
-	KASSERT(pmap == pmap_kernel() || uvm_page_locked_p(pg));
+	KASSERT(pmap == pmap_kernel() || uvm_page_owner_locked_p(pg));
 
 	for (pv = *(pve = >pvh_list);
 	pv; pv = *(pve = &(*pve)->pv_next)) {

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.348 src/sys/arch/x86/x86/pmap.c:1.349
--- src/sys/arch/x86/x86/pmap.c:1.348	Sun Dec 22 15:15:20 2019
+++ src/sys/arch/x86/x86/pmap.c	Tue Dec 31 12:40:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.348 2019/12/22 15:15:20 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.349 2019/12/31 12:40:27 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.348 2019/12/22 15:15:20 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.349 2019/12/31 12:40:27 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -3530,7 +3530,7 @@ pmap_remove_pte(struct pmap *pmap, struc
 	}
 
 	if ((pg = PHYS_TO_VM_PAGE(pmap_pte2pa(opte))) != NULL) {
-		KASSERT(uvm_page_locked_p(pg));
+		KASSERT(uvm_page_owner_locked_p(pg));
 		pp = VM_PAGE_TO_PP(pg);
 	} else if ((pp = pmap_pv_tracked(pmap_pte2pa(opte))) == NULL) {
 		paddr_t pa = pmap_pte2pa(opte);
@@ -3868,7 +3868,7 @@ pmap_page_remove(struct vm_page *pg)
 	struct pmap_page *pp;
 	paddr_t pa;
 
-	KASSERT(uvm_page_locked_p(pg));
+	KASSERT(uvm_page_owner_locked_p(pg));
 
 	pp = VM_PAGE_TO_PP(pg);
 	pa = VM_PAGE_TO_PHYS(pg);
@@ -3909,7 +3909,7 @@ pmap_test_attrs(struct vm_page *pg, unsi
 	u_int result;
 	paddr_t pa;
 
-	KASSERT(uvm_page_locked_p(pg));
+	KASSERT(uvm_page_owner_locked_p(pg));
 
 	pp = VM_PAGE_TO_PP(pg);
 	if ((pp->pp_attrs & testbits) != 0) {
@@ -3982,7 +3982,7 @@ pmap_clear_attrs(struct vm_page *pg, uns
 	struct pmap_page *pp;
 	paddr_t pa;
 
-	KASSERT(uvm_page_locked_p(pg));
+	KASSERT(uvm_page_owner_locked_p(pg));
 
 	pp = VM_PAGE_TO_PP(pg);
 	pa = VM_PAGE_TO_PHYS(pg);
@@ -4374,7 +4374,7 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t
 	 */
 	if ((~opte & (PTE_P | PTE_PVLIST)) == 0) {
 		if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) {
-			KASSERT(uvm_page_locked_p(old_pg));
+			KASSERT(uvm_page_owner_locked_p(old_pg));
 			old_pp = VM_PAGE_TO_PP(old_pg);
 		} else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) {
 			panic("%s: PTE_PVLIST with pv-untracked page"
@@ -5271,7 +5271,7 @@ pmap_ept_enter(struct pmap *pmap, vaddr_
 	 */
 	if ((~opte & (EPT_R | EPT_PVLIST)) == 0) {
 		if ((old_pg = PHYS_TO_VM_PAGE(oldpa)) != NULL) {
-			KASSERT(uvm_page_locked_p(old_pg));
+			KASSERT(uvm_page_owner_locked_p(old_pg));
 			old_pp = VM_PAGE_TO_PP(old_pg);
 		} else if ((old_pp = pmap_pv_tracked(oldpa)) == NULL) {
 			panic("%s: EPT_PVLIST with 

CVS commit: src/sys/dev/acpi

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 12:27:50 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi.c acpi_resource.c acpivar.h

Log Message:
Fetch bus_dma tags when acpi devnodes are created. They do not change
and this allows MD code to create more complex tags without being
concerned with the tag being destroyed later. While here, capture
translations offsets for address32/address64 resources.


To generate a diff of this commit:
cvs rdiff -u -r1.281 -r1.282 src/sys/dev/acpi/acpi.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/acpi/acpi_resource.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/acpi/acpivar.h

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

Modified files:

Index: src/sys/dev/acpi/acpi.c
diff -u src/sys/dev/acpi/acpi.c:1.281 src/sys/dev/acpi/acpi.c:1.282
--- src/sys/dev/acpi/acpi.c:1.281	Mon Dec 30 19:52:11 2019
+++ src/sys/dev/acpi/acpi.c	Tue Dec 31 12:27:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.281 2019/12/30 19:52:11 jmcneill Exp $	*/
+/*	$NetBSD: acpi.c,v 1.282 2019/12/31 12:27:50 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.281 2019/12/30 19:52:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.282 2019/12/31 12:27:50 jmcneill Exp $");
 
 #include "pci.h"
 #include "opt_acpi.h"
@@ -200,6 +200,7 @@ static bool		acpi_resume(device_t, const
 
 static void		acpi_build_tree(struct acpi_softc *);
 static void		acpi_config_tree(struct acpi_softc *);
+static void		acpi_config_dma(struct acpi_softc *);
 static ACPI_STATUS	acpi_make_devnode(ACPI_HANDLE, uint32_t,
 	  void *, void **);
 static ACPI_STATUS	acpi_make_devnode_post(ACPI_HANDLE, uint32_t,
@@ -687,6 +688,10 @@ acpi_build_tree(struct acpi_softc *sc)
 static void
 acpi_config_tree(struct acpi_softc *sc)
 {
+	/*
+	 * Assign bus_dma resources
+	 */
+	acpi_config_dma(sc);
 
 	/*
 	 * Configure all everything found "at acpi?".
@@ -707,6 +712,24 @@ acpi_config_tree(struct acpi_softc *sc)
 	(void)config_defer(sc->sc_dev, acpi_rescan_capabilities);
 }
 
+static void
+acpi_config_dma(struct acpi_softc *sc)
+{
+	struct acpi_devnode *ad;
+
+	SIMPLEQ_FOREACH(ad, >ad_head, ad_list) {
+
+		if (ad->ad_device != NULL)
+			continue;
+
+		if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
+			continue;
+
+		ad->ad_dmat = acpi_get_dma_tag(sc, ad);
+		ad->ad_dmat64 = acpi_get_dma64_tag(sc, ad);
+	}
+}
+
 static ACPI_STATUS
 acpi_make_devnode(ACPI_HANDLE handle, uint32_t level,
 void *context, void **status)
@@ -895,18 +918,11 @@ acpi_rescan_early(struct acpi_softc *sc)
 		aa.aa_pc = sc->sc_pc;
 		aa.aa_pciflags = sc->sc_pciflags;
 		aa.aa_ic = sc->sc_ic;
-		aa.aa_dmat = acpi_get_dma_tag(sc, ad);
-		aa.aa_dmat64 = acpi_get_dma64_tag(sc, ad);
+		aa.aa_dmat = ad->ad_dmat;
+		aa.aa_dmat64 = ad->ad_dmat64;
 
 		ad->ad_device = config_found_ia(sc->sc_dev,
 		"acpinodebus", , acpi_print);
-
-		if (ad->ad_device == NULL) {
-			if (aa.aa_dmat != NULL)
-bus_dmatag_destroy(aa.aa_dmat);
-			if (aa.aa_dmat64 != NULL)
-bus_dmatag_destroy(aa.aa_dmat64);
-		}
 	}
 }
 
@@ -964,18 +980,11 @@ acpi_rescan_nodes(struct acpi_softc *sc)
 		aa.aa_pc = sc->sc_pc;
 		aa.aa_pciflags = sc->sc_pciflags;
 		aa.aa_ic = sc->sc_ic;
-		aa.aa_dmat = acpi_get_dma_tag(sc, ad);
-		aa.aa_dmat64 = acpi_get_dma64_tag(sc, ad);
+		aa.aa_dmat = ad->ad_dmat;
+		aa.aa_dmat64 = ad->ad_dmat64;
 
 		ad->ad_device = config_found_ia(sc->sc_dev,
 		"acpinodebus", , acpi_print);
-
-		if (ad->ad_device == NULL) {
-			if (aa.aa_dmat != NULL)
-bus_dmatag_destroy(aa.aa_dmat);
-			if (aa.aa_dmat64 != NULL)
-bus_dmatag_destroy(aa.aa_dmat64);
-		}
 	}
 }
 

Index: src/sys/dev/acpi/acpi_resource.c
diff -u src/sys/dev/acpi/acpi_resource.c:1.38 src/sys/dev/acpi/acpi_resource.c:1.39
--- src/sys/dev/acpi/acpi_resource.c:1.38	Thu Oct 25 10:38:57 2018
+++ src/sys/dev/acpi/acpi_resource.c	Tue Dec 31 12:27:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_resource.c,v 1.38 2018/10/25 10:38:57 jmcneill Exp $	*/
+/*	$NetBSD: acpi_resource.c,v 1.39 2019/12/31 12:27:50 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.38 2018/10/25 10:38:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.39 2019/12/31 12:27:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -147,7 +147,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 		if (ops->memory)
 			(*ops->memory)(arg->dev, arg->context,
 			res->Data.FixedMemory32.Address,
-			res->Data.FixedMemory32.AddressLength);
+			res->Data.FixedMemory32.AddressLength,
+			0);
 		break;
 
 	case ACPI_RESOURCE_TYPE_MEMORY32:
@@ -160,7 +161,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 			if (ops->memory)
 (*ops->memory)(arg->dev, arg->context,
 res->Data.Memory32.Minimum,
-res->Data.Memory32.AddressLength);
+  

CVS commit: src/sys/kern

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 11:49:08 UTC 2019

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

Log Message:
sys_fchdir: use LK_SHARED.


To generate a diff of this commit:
cvs rdiff -u -r1.538 -r1.539 src/sys/kern/vfs_syscalls.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/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.538 src/sys/kern/vfs_syscalls.c:1.539
--- src/sys/kern/vfs_syscalls.c:1.538	Sun Dec 22 19:47:34 2019
+++ src/sys/kern/vfs_syscalls.c	Tue Dec 31 11:49:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.538 2019/12/22 19:47:34 ad Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.539 2019/12/31 11:49:08 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.538 2019/12/22 19:47:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.539 2019/12/31 11:49:08 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -1344,7 +1344,7 @@ sys_fchdir(struct lwp *l, const struct s
 	vp = fp->f_vnode;
 
 	vref(vp);
-	vn_lock(vp,  LK_EXCLUSIVE | LK_RETRY);
+	vn_lock(vp, LK_SHARED | LK_RETRY);
 	if (vp->v_type != VDIR)
 		error = ENOTDIR;
 	else



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

2019-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Dec 31 11:42:46 UTC 2019

Modified Files:
src/sys/arch/arm/acpi: acpi_machdep.c

Log Message:
The DMA restrictions may not be defined in the direct parent of a device,
so search up the tree for a module device.


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

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_machdep.c:1.15 src/sys/arch/arm/acpi/acpi_machdep.c:1.16
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.15	Mon Dec 30 19:50:29 2019
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Tue Dec 31 11:42:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.15 2019/12/30 19:50:29 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.16 2019/12/31 11:42:46 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.15 2019/12/30 19:50:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.16 2019/12/31 11:42:46 jmcneill Exp $");
 
 #include 
 #include 
@@ -410,9 +410,32 @@ done:
 	return dmat;
 }
 
+static ACPI_HANDLE
+arm_acpi_dma_module(struct acpi_softc *sc, struct acpi_devnode *ad)
+{
+	ACPI_HANDLE tmp;
+	ACPI_STATUS rv;
+
+	/*
+	 * Search up the tree for a module device with a _DMA method.
+	 */
+	for (; ad != NULL; ad = ad->ad_parent) {
+		if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
+			continue;
+		if (!acpi_match_hid(ad->ad_devinfo, module_hid))
+			continue;
+		rv = AcpiGetHandle(ad->ad_handle, "_DMA", );
+		if (ACPI_SUCCESS(rv))
+			return ad->ad_handle;
+	}
+
+	return NULL;
+}
+
 bus_dma_tag_t
 arm_acpi_dma_tag(struct acpi_softc *sc, struct acpi_devnode *ad)
 {
+	ACPI_HANDLE module;
 	ACPI_INTEGER cca;
 	bus_dma_tag_t dmat;
 
@@ -425,14 +448,12 @@ arm_acpi_dma_tag(struct acpi_softc *sc, 
 		dmat = _generic_dma_tag;
 
 	/*
-	 * If the parent device is a bus, it may define valid DMA ranges
+	 * If a parent device is a bus, it may define valid DMA ranges
 	 * and translations for child nodes.
 	 */
-	if (ad->ad_parent != NULL &&
-	acpi_match_hid(ad->ad_parent->ad_devinfo, module_hid)) {
-		dmat = arm_acpi_dma_tag_subregion(sc, dmat,
-		ad->ad_parent->ad_handle);
-	}
+	module = arm_acpi_dma_module(sc, ad);
+	if (module != NULL)
+		dmat = arm_acpi_dma_tag_subregion(sc, dmat, module);
 
 	return dmat;
 }



CVS commit: src/sys/dev/dm

2019-12-31 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Tue Dec 31 10:30:30 UTC 2019

Modified Files:
src/sys/dev/dm: dm_dev.c dm_table.c

Log Message:
dm: Remove unnecessary inlining

These two don't really need to be inlined.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/dm/dm_dev.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/dm/dm_table.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/dm/dm_dev.c
diff -u src/sys/dev/dm/dm_dev.c:1.16 src/sys/dev/dm/dm_dev.c:1.17
--- src/sys/dev/dm/dm_dev.c:1.16	Sun Dec 15 14:39:42 2019
+++ src/sys/dev/dm/dm_dev.c	Tue Dec 31 10:30:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $  */
+/*$NetBSD: dm_dev.c,v 1.17 2019/12/31 10:30:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.16 2019/12/15 14:39:42 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_dev.c,v 1.17 2019/12/31 10:30:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -51,7 +51,7 @@ static struct dm_dev_head dm_dev_list = 
 static kmutex_t dm_dev_mutex;
 
 /* dm_dev_mutex must be holdby caller before using disable_dev. */
-__inline static void
+static void
 disable_dev(dm_dev_t *dmv)
 {
 

Index: src/sys/dev/dm/dm_table.c
diff -u src/sys/dev/dm/dm_table.c:1.18 src/sys/dev/dm/dm_table.c:1.19
--- src/sys/dev/dm/dm_table.c:1.18	Sun Dec 22 13:16:09 2019
+++ src/sys/dev/dm/dm_table.c	Tue Dec 31 10:30:30 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $  */
+/*$NetBSD: dm_table.c,v 1.19 2019/12/31 10:30:30 tkusumi Exp $  */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.19 2019/12/31 10:30:30 tkusumi Exp $");
 
 #include 
 #include 
@@ -181,7 +181,7 @@ dm_table_destroy(dm_table_head_t *head, 
 /*
  * Return length of active table in device.
  */
-static inline uint64_t
+static uint64_t
 dm_table_size_impl(dm_table_head_t *head, int table)
 {
 	dm_table_t *tbl;



CVS commit: src/sys/dev/acpi

2019-12-31 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue Dec 31 09:10:15 UTC 2019

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

Log Message:
Free buffers only when allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_util.c

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

Modified files:

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.17 src/sys/dev/acpi/acpi_util.c:1.18
--- src/sys/dev/acpi/acpi_util.c:1.17	Sun Dec 29 13:45:11 2019
+++ src/sys/dev/acpi/acpi_util.c	Tue Dec 31 09:10:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.17 2019/12/29 13:45:11 jmcneill Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.17 2019/12/29 13:45:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.18 2019/12/31 09:10:15 mlelstv Exp $");
 
 #include 
 #include 
@@ -694,7 +694,8 @@ acpi_dsd_integer(ACPI_HANDLE handle, con
 	if (ACPI_SUCCESS(rv))
 		*val = propval->Integer.Value;
 
-	ACPI_FREE(buf.Pointer);
+	if (buf.Pointer != NULL)
+		ACPI_FREE(buf.Pointer);
 	return rv;
 }
 
@@ -712,6 +713,7 @@ acpi_dsd_string(ACPI_HANDLE handle, cons
 	if (ACPI_SUCCESS(rv))
 		*val = kmem_strdup(propval->String.Pointer, KM_SLEEP);
 
-	ACPI_FREE(buf.Pointer);
+	if (buf.Pointer != NULL)
+		ACPI_FREE(buf.Pointer);
 	return rv;
 }



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

2019-12-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Dec 31 08:01:19 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Add another cache invalidation before reading memory for firmware query
results.


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

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.31 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.32
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.31	Mon Dec 30 16:19:27 2019
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Tue Dec 31 08:01:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.31 2019/12/30 16:19:27 skrll Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.32 2019/12/31 08:01:19 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.31 2019/12/30 16:19:27 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.32 2019/12/31 08:01:19 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -671,6 +671,13 @@ bcm283x_uartinit(bus_space_tag_t iot, bu
 
 	bcm2835_mbox_read(iot, ioh, BCMMBOX_CHANARM2VC, );
 
+	/*
+	 * RPI4 has Cortex A72 processors which do speculation, so
+	 * we need to invalidate the cache for an updates done by
+	 * the firmware
+	 */
+	cpu_dcache_inv_range((vaddr_t)_uart, sizeof(vb_uart));
+
 	if (vcprop_tag_success_p(_uart.vbt_uartclockrate.tag))
 		uart_clk = vb_uart.vbt_uartclockrate.rate;
 	if (vcprop_tag_success_p(_uart.vbt_vpuclockrate.tag))