CVS commit: src/sys/modules/sodium

2021-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 18 09:34:45 UTC 2021

Modified Files:
src/sys/modules/sodium: Makefile.sodmod

Log Message:
Don't define HAVE_TI_MODE if we don't have it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/sodium/Makefile.sodmod

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

Modified files:

Index: src/sys/modules/sodium/Makefile.sodmod
diff -u src/sys/modules/sodium/Makefile.sodmod:1.1 src/sys/modules/sodium/Makefile.sodmod:1.2
--- src/sys/modules/sodium/Makefile.sodmod:1.1	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/sodium/Makefile.sodmod	Wed Aug 18 05:34:45 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.sodmod,v 1.1 2021/08/17 17:29:20 christos Exp $
+#	$NetBSD: Makefile.sodmod,v 1.2 2021/08/18 09:34:45 christos Exp $
 
 SODIUMDIR=	${S}/external/isc/libsodium
 SODIUMSRCDIR=	${SODIUMDIR}/dist/src/libsodium
@@ -49,5 +49,8 @@ CWARNFLAGS+=	-Wno-shadow
 CWARNFLAGS+=	-Wno-unused-function
 CWARNFLAGS+=	-Wno-unused-variable
 
-CPPFLAGS+=	-DHAVE_TI_MODE -I${SODIUMDIR}/include 
+.if ${MACHINE_CPU} == "x86_64"
+CPPFLAGS+=	-DHAVE_TI_MODE
+.endif
+CPPFLAGS+=	-I${SODIUMDIR}/include 
 CPPFLAGS+=	-I${SODIUMDIR}/dist/src/libsodium/include/sodium



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

2021-08-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 18 09:18:09 UTC 2021

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

Log Message:
 It's time to add ixg(4) and ixv(4).


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.179 src/sys/arch/evbarm/conf/GENERIC64:1.180
--- src/sys/arch/evbarm/conf/GENERIC64:1.179	Sat Jun 26 09:29:14 2021
+++ src/sys/arch/evbarm/conf/GENERIC64	Wed Aug 18 09:18:09 2021
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.179 2021/06/26 09:29:14 nia Exp $
+#	$NetBSD: GENERIC64,v 1.180 2021/08/18 09:18:09 msaitoh Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -252,6 +252,8 @@ genet*		at fdt?
 #scx*		at fdt?
 aq*		at pci? dev ? function ?	# Aquantia AQC 10 gigabit
 ena*		at pci? dev ? function ?	# Amazon.com Elastic Network Adapter
+ixg*	at pci? dev ? function ?	# Intel 8259x 10 gigabit
+ixv*	at pci? dev ? function ?	# Intel 8259x 10G virtual function
 mcx*		at pci? dev ? function ?	# Mellanox 5th generation Ethernet
 mskc*		at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*		at mskc?



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

2021-08-18 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Aug 18 09:17:17 UTC 2021

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

Log Message:
 Refresh unrefreshed descriptors' buffers correctly.

- Update next_to_refresh at least before ixgbe_rx_unrefresed() to detect
  the unrefreshed status correctly in ixgbe_rxeof().
- next_to_refresh points to the previous entry of the first unrefreshed
  descriptor, so fix a loop variable to point to the correct one in
  ixgbe_refresh_mbufs().
- Without the above two fixes, RX ring may have some unrefreshed entries
  which have inconsistent state. On such state, "ifconfig down up" causes
  panic in bus_dmamap_sync() on aarch64.
- Tested on amd64 and aarch64. OK'd by knakahara.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/ixgbe/ix_txrx.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.81 src/sys/dev/pci/ixgbe/ix_txrx.c:1.82
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.81	Wed Jul  7 08:58:19 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Wed Aug 18 09:17:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1336,15 +1336,15 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 	struct adapter  *adapter = rxr->adapter;
 	struct ixgbe_rx_buf *rxbuf;
 	struct mbuf *mp;
-	int i, j, error;
+	int i, error;
 	boolrefreshed = false;
 
-	i = j = rxr->next_to_refresh;
-	/* Control the loop with one beyond */
-	if (++j == rxr->num_desc)
-		j = 0;
+	i = rxr->next_to_refresh;
+	/* next_to_refresh points to the previous one */
+	if (++i == rxr->num_desc)
+		i = 0;
 
-	while (j != limit) {
+	while (i != limit) {
 		rxbuf = >rx_buffers[i];
 		if (rxbuf->buf == NULL) {
 			mp = ixgbe_getjcl(>jcl_head, M_NOWAIT,
@@ -1387,11 +1387,10 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr,
 		}
 
 		refreshed = true;
-		/* Next is precalculated */
-		i = j;
+		/* next_to_refresh points to the previous one */
 		rxr->next_to_refresh = i;
-		if (++j == rxr->num_desc)
-			j = 0;
+		if (++i == rxr->num_desc)
+			i = 0;
 	}
 
 update:
@@ -2090,6 +2089,7 @@ next_desc:
 		/* Advance our pointers to the next descriptor. */
 		if (++i == rxr->num_desc)
 			i = 0;
+		rxr->next_to_check = i;
 
 		/* Now send to the stack or do LRO */
 		if (sendmp != NULL) {
@@ -2107,8 +2107,6 @@ next_desc:
 	if (ixgbe_rx_unrefreshed(rxr))
 		ixgbe_refresh_mbufs(rxr, i);
 
-	rxr->next_to_check = i;
-
 	IXGBE_RX_UNLOCK(rxr);
 
 #ifdef LRO



CVS commit: src/sys/modules

2021-08-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 18 09:07:07 UTC 2021

Modified Files:
src/sys/modules: Makefile
Added Files:
src/sys/modules/blake2s: Makefile
Removed Files:
src/sys/modules/blakes2s: Makefile

Log Message:
Fix broken name


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/blake2s/Makefile
cvs rdiff -u -r1.1 -r0 src/sys/modules/blakes2s/Makefile

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

Modified files:

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.253 src/sys/modules/Makefile:1.254
--- src/sys/modules/Makefile:1.253	Tue Aug 17 17:39:32 2021
+++ src/sys/modules/Makefile	Wed Aug 18 05:07:07 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.253 2021/08/17 21:39:32 kre Exp $
+#	$NetBSD: Makefile,v 1.254 2021/08/18 09:07:07 christos Exp $
 
 .include 
 
@@ -27,7 +27,7 @@ SUBDIR+=	adosfs
 SUBDIR+=	aio
 SUBDIR+=	audio
 SUBDIR+=	autofs
-SUBDIR+=	blakes2s
+SUBDIR+=	blake2s
 SUBDIR+=	blowfish
 SUBDIR+=	bpf
 SUBDIR+=	bpf_filter

Added files:

Index: src/sys/modules/blake2s/Makefile
diff -u /dev/null src/sys/modules/blake2s/Makefile:1.1
--- /dev/null	Wed Aug 18 05:07:07 2021
+++ src/sys/modules/blake2s/Makefile	Wed Aug 18 05:07:07 2021
@@ -0,0 +1,13 @@
+#	$NetBSD: Makefile,v 1.1 2021/08/18 09:07:07 christos Exp $
+
+.include "../Makefile.inc"
+
+KMOD=	blake2s
+
+BLAKE2SDIR=	$S/crypto/blake2
+CPPFLAGS+=	-I${BLAKE2SDIR}
+
+.PATH: ${BLAKE2SDIR}
+SRCS+=	blake2s.c
+
+.include 



CVS commit: src/sys/modules

2021-08-17 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Aug 17 21:39:32 UTC 2021

Modified Files:
src/sys/modules: Makefile

Log Message:
s/blake2s/blakes2s/ to match the directory that exists


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/modules/Makefile

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

Modified files:

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.252 src/sys/modules/Makefile:1.253
--- src/sys/modules/Makefile:1.252	Tue Aug 17 17:29:19 2021
+++ src/sys/modules/Makefile	Tue Aug 17 21:39:32 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.252 2021/08/17 17:29:19 christos Exp $
+#	$NetBSD: Makefile,v 1.253 2021/08/17 21:39:32 kre Exp $
 
 .include 
 
@@ -27,7 +27,7 @@ SUBDIR+=	adosfs
 SUBDIR+=	aio
 SUBDIR+=	audio
 SUBDIR+=	autofs
-SUBDIR+=	blake2s
+SUBDIR+=	blakes2s
 SUBDIR+=	blowfish
 SUBDIR+=	bpf
 SUBDIR+=	bpf_filter



CVS commit: src/sys/net

2021-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 17 17:31:13 UTC 2021

Modified Files:
src/sys/net: if_wg.c

Log Message:
Some signnes, casts, and constant sizes.
Add module dependencies.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/net/if_wg.c

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

Modified files:

Index: src/sys/net/if_wg.c
diff -u src/sys/net/if_wg.c:1.64 src/sys/net/if_wg.c:1.65
--- src/sys/net/if_wg.c:1.64	Tue Jun 15 20:21:19 2021
+++ src/sys/net/if_wg.c	Tue Aug 17 13:31:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wg.c,v 1.64 2021/06/16 00:21:19 riastradh Exp $	*/
+/*	$NetBSD: if_wg.c,v 1.65 2021/08/17 17:31:13 christos Exp $	*/
 
 /*
  * Copyright (C) Ryota Ozaki 
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.64 2021/06/16 00:21:19 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wg.c,v 1.65 2021/08/17 17:31:13 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_altq_enabled.h"
@@ -442,7 +442,7 @@ sliwin_update(struct sliwin *W, uint64_t
 	bit = S % SLIWIN_BPW;
 	if (W->B[word] & (1UL << bit))
 		return EAUTH;
-	W->B[word] |= 1UL << bit;
+	W->B[word] |= 1U << bit;
 
 	/* Accept!  */
 	return 0;
@@ -1009,7 +1009,7 @@ wg_algo_hmac(uint8_t out[], const size_t
 	uint8_t hmackey[HMAC_BLOCK_LEN] = {0};
 	uint8_t ipad[HMAC_BLOCK_LEN];
 	uint8_t opad[HMAC_BLOCK_LEN];
-	int i;
+	size_t i;
 	struct blake2s state;
 
 	KASSERT(outlen == WG_HASH_LEN);
@@ -1167,11 +1167,11 @@ wg_algo_tai64n(wg_timestamp_t timestamp)
 	/* FIXME strict TAI64N (https://cr.yp.to/libtai/tai64.html) */
 	getnanotime();
 	/* TAI64 label in external TAI64 format */
-	be32enc(timestamp, 0x4000UL + (ts.tv_sec >> 32));
+	be32enc(timestamp, 0x4000U + (uint32_t)(ts.tv_sec >> 32));
 	/* second beginning from 1970 TAI */
-	be32enc(timestamp + 4, ts.tv_sec & 0xU);
+	be32enc(timestamp + 4, (uint32_t)(ts.tv_sec & 0xU));
 	/* nanosecond in big-endian format */
-	be32enc(timestamp + 8, ts.tv_nsec);
+	be32enc(timestamp + 8, (uint32_t)ts.tv_nsec);
 }
 
 /*
@@ -1715,7 +1715,7 @@ wg_send_handshake_msg_init(struct wg_sof
 		if (wgp->wgp_handshake_start_time == 0)
 			wgp->wgp_handshake_start_time = time_uptime;
 		callout_schedule(>wgp_handshake_timeout_timer,
-		MIN(wg_rekey_timeout, INT_MAX/hz) * hz);
+		MIN(wg_rekey_timeout, (unsigned)(INT_MAX / hz)) * hz);
 	} else {
 		wg_put_session_index(wg, wgs);
 		/* Initiation failed; toss packet waiting for it if any.  */
@@ -2271,7 +2271,7 @@ wg_lookup_session_by_index(struct wg_sof
 static void
 wg_schedule_rekey_timer(struct wg_peer *wgp)
 {
-	int timeout = MIN(wg_rekey_after_time, INT_MAX/hz);
+	int timeout = MIN(wg_rekey_after_time, (unsigned)(INT_MAX / hz));
 
 	callout_schedule(>wgp_rekey_timer, timeout * hz);
 }
@@ -2308,7 +2308,7 @@ wg_need_to_send_init_message(struct wg_s
 }
 
 static void
-wg_schedule_peer_task(struct wg_peer *wgp, int task)
+wg_schedule_peer_task(struct wg_peer *wgp, unsigned int task)
 {
 
 	mutex_enter(wgp->wgp_intr_lock);
@@ -3082,7 +3082,7 @@ wg_peer_work(struct work *wk, void *cook
 {
 	struct wg_peer *wgp = container_of(wk, struct wg_peer, wgp_work);
 	struct wg_softc *wg = wgp->wgp_sc;
-	int tasks;
+	unsigned int tasks;
 
 	mutex_enter(wgp->wgp_intr_lock);
 	while ((tasks = wgp->wgp_tasks) != 0) {
@@ -4515,10 +4515,10 @@ wg_ioctl_get(struct wg_softc *wg, struct
 		const struct timespec *t = >wgp_last_handshake_time;
 
 		if (!prop_dictionary_set_uint64(prop_peer,
-			"last_handshake_time_sec", t->tv_sec))
+			"last_handshake_time_sec", (uint64_t)t->tv_sec))
 			goto next;
 		if (!prop_dictionary_set_uint32(prop_peer,
-			"last_handshake_time_nsec", t->tv_nsec))
+			"last_handshake_time_nsec", (uint32_t)t->tv_nsec))
 			goto next;
 
 		if (wgp->wgp_n_allowedips == 0)
@@ -5002,4 +5002,4 @@ rumpkern_wg_recv_peer(struct wg_softc *w
  */
 #include "if_module.h"
 
-IF_MODULE(MODULE_CLASS_DRIVER, wg, "")
+IF_MODULE(MODULE_CLASS_DRIVER, wg, "sodium,blake2s")



CVS commit: src/sys/external/isc/libsodium/src

2021-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 17 17:30:01 UTC 2021

Modified Files:
src/sys/external/isc/libsodium/src: glue.c

Log Message:
Add module glue


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/external/isc/libsodium/src/glue.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/external/isc/libsodium/src/glue.c
diff -u src/sys/external/isc/libsodium/src/glue.c:1.1 src/sys/external/isc/libsodium/src/glue.c:1.2
--- src/sys/external/isc/libsodium/src/glue.c:1.1	Thu Aug 20 17:20:16 2020
+++ src/sys/external/isc/libsodium/src/glue.c	Tue Aug 17 13:30:01 2021
@@ -1 +1,56 @@
+/*	$NetBSD: glue.c,v 1.2 2021/08/17 17:30:01 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: glue.c,v 1.2 2021/08/17 17:30:01 christos Exp $");
+
+#include 
+#include 
+#include 
+
 int libsodium_errno;
+
+MODULE(MODULE_CLASS_MISC, sodium, NULL);
+
+static int
+sodium_modcmd(modcmd_t cmd, void *arg)
+{
+
+	switch (cmd) {
+	case MODULE_CMD_INIT:
+		break;
+
+	case MODULE_CMD_FINI:
+		break;
+
+	default:
+		return ENOTTY;
+	}
+
+	return 0;
+}



CVS commit: src/sys/modules

2021-08-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 17 17:29:20 UTC 2021

Modified Files:
src/sys/modules: Makefile
Added Files:
src/sys/modules/blakes2s: Makefile
src/sys/modules/if_wg: Makefile wg.ioconf
src/sys/modules/sodium: Makefile Makefile.sodmod

Log Message:
modules for blake2s libsodium and if_wg


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/blakes2s/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/if_wg/Makefile \
src/sys/modules/if_wg/wg.ioconf
cvs rdiff -u -r0 -r1.1 src/sys/modules/sodium/Makefile \
src/sys/modules/sodium/Makefile.sodmod

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

Modified files:

Index: src/sys/modules/Makefile
diff -u src/sys/modules/Makefile:1.251 src/sys/modules/Makefile:1.252
--- src/sys/modules/Makefile:1.251	Mon Aug  9 16:49:10 2021
+++ src/sys/modules/Makefile	Tue Aug 17 13:29:19 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.251 2021/08/09 20:49:10 andvar Exp $
+#	$NetBSD: Makefile,v 1.252 2021/08/17 17:29:19 christos Exp $
 
 .include 
 
@@ -27,6 +27,7 @@ SUBDIR+=	adosfs
 SUBDIR+=	aio
 SUBDIR+=	audio
 SUBDIR+=	autofs
+SUBDIR+=	blake2s
 SUBDIR+=	blowfish
 SUBDIR+=	bpf
 SUBDIR+=	bpf_filter
@@ -100,6 +101,7 @@ SUBDIR+=	if_ure
 SUBDIR+=	if_url
 SUBDIR+=	if_urndis
 SUBDIR+=	if_vlan
+SUBDIR+=	if_wg
 SUBDIR+=	iic
 SUBDIR+=	ip_ecn
 SUBDIR+=	ipl
@@ -389,6 +391,8 @@ SUBDIR+=	cyclic
 SUBDIR+=	dtrace
 .endif
 
+SUBDIR+=sodium
+
 # we need solaris for the dtrace and zfs modules
 .if (${MKDTRACE} != "no" || ${MKZFS} != "no")
 SUBDIR+=solaris

Added files:

Index: src/sys/modules/blakes2s/Makefile
diff -u /dev/null src/sys/modules/blakes2s/Makefile:1.1
--- /dev/null	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/blakes2s/Makefile	Tue Aug 17 13:29:20 2021
@@ -0,0 +1,13 @@
+#	$NetBSD: Makefile,v 1.1 2021/08/17 17:29:20 christos Exp $
+
+.include "../Makefile.inc"
+
+KMOD=	blake2s
+
+BLAKE2SDIR=	$S/crypto/blake2
+CPPFLAGS+=	-I${BLAKE2SDIR}
+
+.PATH: ${BLAKE2SDIR}
+SRCS+=	blake2s.c
+
+.include 

Index: src/sys/modules/if_wg/Makefile
diff -u /dev/null src/sys/modules/if_wg/Makefile:1.1
--- /dev/null	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/if_wg/Makefile	Tue Aug 17 13:29:20 2021
@@ -0,0 +1,17 @@
+# $NetBSD: Makefile,v 1.1 2021/08/17 17:29:20 christos Exp $
+
+.include "../Makefile.inc"
+
+.PATH:  ${S}/net
+
+KMOD=		if_wg
+IOCONF=		wg.ioconf
+SRCS=		if_wg.c
+
+CPPFLAGS+=	-DINET
+CPPFLAGS+=	-DINET6
+CPPFLAGS+=	-DALTQ
+
+WARNS=		3
+
+.include 
Index: src/sys/modules/if_wg/wg.ioconf
diff -u /dev/null src/sys/modules/if_wg/wg.ioconf:1.1
--- /dev/null	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/if_wg/wg.ioconf	Tue Aug 17 13:29:20 2021
@@ -0,0 +1,7 @@
+#	$NetBSD: wg.ioconf,v 1.1 2021/08/17 17:29:20 christos Exp $
+
+ioconf		wg
+
+include		"conf/files"
+
+pseudo-device   wg

Index: src/sys/modules/sodium/Makefile
diff -u /dev/null src/sys/modules/sodium/Makefile:1.1
--- /dev/null	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/sodium/Makefile	Tue Aug 17 13:29:20 2021
@@ -0,0 +1,8 @@
+#	$NetBSD: Makefile,v 1.1 2021/08/17 17:29:20 christos Exp $
+
+.include "../Makefile.inc"
+
+KMOD=	sodium
+
+.include "Makefile.sodmod"
+.include 
Index: src/sys/modules/sodium/Makefile.sodmod
diff -u /dev/null src/sys/modules/sodium/Makefile.sodmod:1.1
--- /dev/null	Tue Aug 17 13:29:20 2021
+++ src/sys/modules/sodium/Makefile.sodmod	Tue Aug 17 13:29:20 2021
@@ -0,0 +1,53 @@
+#	$NetBSD: Makefile.sodmod,v 1.1 2021/08/17 17:29:20 christos Exp $
+
+SODIUMDIR=	${S}/external/isc/libsodium
+SODIUMSRCDIR=	${SODIUMDIR}/dist/src/libsodium
+
+.PATH:	${SODIUMDIR}/src
+SRCS+=	glue.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_scalarmult/curve25519/ref10
+SRCS+=	x25519_ref10.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_scalarmult/curve25519
+SRCS+=	scalarmult_curve25519.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_scalarmult
+SRCS+=	crypto_scalarmult.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_onetimeauth/poly1305/donna
+SRCS+=	poly1305_donna.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_onetimeauth/poly1305
+SRCS+=	onetimeauth_poly1305.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_onetimeauth
+SRCS+=	crypto_onetimeauth.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_stream/chacha20/ref
+SRCS+=	chacha20_ref.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_stream/chacha20
+SRCS+=	stream_chacha20.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_aead/xchacha20poly1305/sodium
+SRCS+=	aead_xchacha20poly1305.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_aead/chacha20poly1305/sodium
+SRCS+=	aead_chacha20poly1305.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_core/hchacha20
+SRCS+=	core_hchacha20.c
+
+.PATH:	${SODIUMSRCDIR}/crypto_core/ed25519/ref10
+SRCS+=	ed25519_ref10.c
+
+WARNS=		3
+
+CWARNFLAGS+=	-Wall
+CWARNFLAGS+=	-Wno-shadow
+CWARNFLAGS+=	-Wno-unused-function
+CWARNFLAGS+=	-Wno-unused-variable
+
+CPPFLAGS+=	-DHAVE_TI_MODE -I${SODIUMDIR}/include 
+CPPFLAGS+=	-I${SODIUMDIR}/dist/src/libsodium/include/sodium



CVS commit: src/sys/dev/pci

2021-08-17 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug 17 17:16:40 UTC 2021

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

Log Message:
s/Windw/Window/ in log message.


To generate a diff of this commit:
cvs rdiff -u -r1.227 -r1.228 src/sys/dev/pci/pci_subr.c

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.227 src/sys/dev/pci/pci_subr.c:1.228
--- src/sys/dev/pci/pci_subr.c:1.227	Mon Jul 12 04:41:14 2021
+++ src/sys/dev/pci/pci_subr.c	Tue Aug 17 17:16:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 andvar Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3539,7 +3539,7 @@ pci_conf_print_multicast_cap(const pcire
 	/* Endpoint Only */
 	n = PCIREG_SHIFTOUT(reg, PCI_MCAST_CAP_WINSIZEREQ);
 	if (n > 0)
-		printf("  Windw Size Requested: %d\n", 1 << (n - 1));
+		printf("  Window Size Requested: %d\n", 1 << (n - 1));
 
 	onoff("ECRC Regeneration Supported", reg, PCI_MCAST_CAP_ECRCREGEN);
 



CVS commit: src/sys/netinet6

2021-08-17 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Aug 17 09:43:21 UTC 2021

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

Log Message:
nd6: prevent ln from being freed while releasing held packets


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/netinet6/nd6.c

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

Modified files:

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.276 src/sys/netinet6/nd6.c:1.277
--- src/sys/netinet6/nd6.c:1.276	Mon Dec 28 20:19:50 2020
+++ src/sys/netinet6/nd6.c	Tue Aug 17 09:43:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.276 2020/12/28 20:19:50 nia Exp $	*/
+/*	$NetBSD: nd6.c,v 1.277 2021/08/17 09:43:21 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.276 2020/12/28 20:19:50 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.277 2021/08/17 09:43:21 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1305,6 +1305,7 @@ nd6_llinfo_release_pkts(struct llentry *
 
 	m_hold = ln->la_hold, ln->la_hold = NULL, ln->la_numheld = 0;
 
+	LLE_ADDREF(ln);
 	LLE_WUNLOCK(ln);
 	for (; m_hold != NULL; m_hold = m_hold_next) {
 		m_hold_next = m_hold->m_nextpkt;
@@ -1318,6 +1319,7 @@ nd6_llinfo_release_pkts(struct llentry *
 		ip6_if_output(ifp, ifp, m_hold, , NULL);
 	}
 	LLE_WLOCK(ln);
+	LLE_REMREF(ln);
 }
 
 /*



CVS commit: src/sys/sys

2021-08-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Aug 15 22:08:01 UTC 2021

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

Log Message:
Define a constant for the size of device_t::dv_xname, rather than just
using 16.


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/sys/device.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/device.h
diff -u src/sys/sys/device.h:1.173 src/sys/sys/device.h:1.174
--- src/sys/sys/device.h:1.173	Sat Aug  7 18:16:42 2021
+++ src/sys/sys/device.h	Sun Aug 15 22:08:01 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.173 2021/08/07 18:16:42 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.174 2021/08/15 22:08:01 thorpej Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -252,6 +252,9 @@ struct devhandle_impl {
 	const char *, devhandle_t *);
 };
 
+/* Max size of a device external name (including terminating NUL) */
+#define	DEVICE_XNAME_SIZE	16
+
 struct device {
 	devhandle_t	dv_handle;	/* this device's handle;
 	   new device_t's get INVALID */
@@ -262,7 +265,8 @@ struct device {
 	cfdriver_t	dv_cfdriver;	/* our cfdriver */
 	cfattach_t	dv_cfattach;	/* our cfattach */
 	int		dv_unit;	/* device unit number */
-	char		dv_xname[16];	/* external name (name + unit) */
+	/* external name (name + unit) */
+	char		dv_xname[DEVICE_XNAME_SIZE];
 	device_t	dv_parent;	/* pointer to parent device
 	   (NULL if pseudo- or root node) */
 	int		dv_depth;	/* number of parents until root */



CVS commit: src/sys/compat/common

2021-08-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Aug 15 07:57:46 UTC 2021

Modified Files:
src/sys/compat/common: vfs_syscalls_30.c vfs_syscalls_43.c
vfs_syscalls_50.c

Log Message:
- memset struct stat to avoid kernel memory disclosure of padded fields
  (thanks Trend Micro for the report)
- use do_fhstat
- consistency in argument order of compat functions


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/compat/common/vfs_syscalls_30.c
cvs rdiff -u -r1.66 -r1.67 src/sys/compat/common/vfs_syscalls_43.c
cvs rdiff -u -r1.25 -r1.26 src/sys/compat/common/vfs_syscalls_50.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/compat/common/vfs_syscalls_30.c
diff -u src/sys/compat/common/vfs_syscalls_30.c:1.41 src/sys/compat/common/vfs_syscalls_30.c:1.42
--- src/sys/compat/common/vfs_syscalls_30.c:1.41	Fri Jan 31 04:01:23 2020
+++ src/sys/compat/common/vfs_syscalls_30.c	Sun Aug 15 03:57:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $	*/
+/*	$NetBSD: vfs_syscalls_30.c,v 1.42 2021/08/15 07:57:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.41 2020/01/31 09:01:23 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls_30.c,v 1.42 2021/08/15 07:57:46 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -63,8 +63,6 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_syscalls
 #include 
 #include 
 
-static void cvtstat(struct stat13 *, const struct stat *);
-
 static const struct syscall_package vfs_syscalls_30_syscalls[] = {
 	{ SYS_compat_30___fhstat30, 0, (sy_call_t *)compat_30_sys___fhstat30 },
 	{ SYS_compat_30___fstat13, 0, (sy_call_t *)compat_30_sys___fstat13 },
@@ -85,6 +83,8 @@ static void
 cvtstat(struct stat13 *ost, const struct stat *st)
 {
 
+	/* Handle any padding. */
+	memset(ost, 0, sizeof(*ost));
 	ost->st_dev = st->st_dev;
 	ost->st_ino = (uint32_t)st->st_ino;
 	ost->st_mode = st->st_mode;
@@ -123,8 +123,7 @@ compat_30_sys___stat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 
@@ -148,8 +147,7 @@ compat_30_sys___lstat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, ub), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, ub), sizeof(osb));
 }
 
 /* ARGSUSED */
@@ -164,34 +162,12 @@ compat_30_sys_fhstat(struct lwp *l,
 	struct stat sb;
 	struct stat13 osb;
 	int error;
-	struct compat_30_fhandle fh;
-	struct mount *mp;
-	struct vnode *vp;
-
-	/*
-	 * Must be super user
-	 */
-	if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_FILEHANDLE,
-	0, NULL, NULL, NULL)))
-		return (error);
 
-	if ((error = copyin(SCARG(uap, fhp), , sizeof(fh))) != 0)
-		return (error);
-
-	if ((mp = vfs_getvfs(_fsid)) == NULL)
-		return (ESTALE);
-	if (mp->mnt_op->vfs_fhtovp == NULL)
-		return EOPNOTSUPP;
-	error = VFS_FHTOVP(mp, (struct fid*)_fid, LK_EXCLUSIVE, );
-	if (error != 0)
-		return (error);
-	error = vn_stat(vp, );
-	vput(vp);
+	error = do_fhstat(l, SCARG(uap, fhp), sizeof(*SCARG(uap, fhp)), );
 	if (error)
-		return (error);
+		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof(osb));
-	return (error);
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -214,8 +190,7 @@ compat_30_sys___fstat13(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap, sb), sizeof(osb));
 }
 
 /*
@@ -292,7 +267,7 @@ again:
 		bdp = (struct dirent *)inp;
 		reclen = bdp->d_reclen;
 		if (reclen & _DIRENT_ALIGN(bdp))
-			panic("netbsd30_getdents: bad reclen %d", reclen);
+			panic("%s: bad reclen %d", __func__, reclen);
 		if (cookie)
 			off = *cookie++; /* each entry points to the next */
 		else
@@ -396,9 +371,8 @@ compat_30_sys_getfh(struct lwp *l, const
 		error = EINVAL;
 	}
 	if (error)
-		return (error);
-	error = copyout(, SCARG(uap, fhp), sizeof(struct compat_30_fhandle));
-	return (error);
+		return error;
+	return copyout(, SCARG(uap, fhp), sizeof(fh));
 }
 
 /*
@@ -437,8 +411,7 @@ compat_30_sys___fhstat30(struct lwp *l,
 	if (error)
 		return error;
 	cvtstat(, );
-	error = copyout(, SCARG(uap_30, sb), sizeof (osb));
-	return error;
+	return copyout(, SCARG(uap_30, sb), sizeof(osb));
 }
 
 /* ARGSUSED */

Index: src/sys/compat/common/vfs_syscalls_43.c
diff -u src/sys/compat/common/vfs_syscalls_43.c:1.66 src/sys/compat/common/vfs_syscalls_43.c:1.67
--- src/sys/compat/common/vfs_syscalls_43.c:1.66	Wed Jun 24 06:28:16 2020
+++ src/sys/compat/common/vfs_syscalls_43.c	Sun Aug 15 03:57:46 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls_43.c,v 1.66 

CVS commit: src/sys/kern

2021-08-14 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Aug 14 21:17:11 UTC 2021

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

Log Message:
fix rumpkernel build failure


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/kern_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/kern/kern_clock.c
diff -u src/sys/kern/kern_clock.c:1.145 src/sys/kern/kern_clock.c:1.146
--- src/sys/kern/kern_clock.c:1.145	Sat Aug 14 17:51:20 2021
+++ src/sys/kern/kern_clock.c	Sat Aug 14 21:17:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_clock.c,v 1.145 2021/08/14 17:51:20 ryo Exp $	*/
+/*	$NetBSD: kern_clock.c,v 1.146 2021/08/14 21:17:11 ryo Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.145 2021/08/14 17:51:20 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_clock.c,v 1.146 2021/08/14 21:17:11 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dtrace.h"
@@ -457,7 +457,7 @@ statclock(struct clockframe *frame)
 		/*
 		 * Kernel statistics are just like addupc_intr, only easier.
 		 */
-#ifdef MULTIPROCESSOR
+#if defined(MULTIPROCESSOR) && !defined(_RUMPKERNEL)
 		g = curcpu()->ci_gmon;
 		if (g != NULL &&
 		profsrc == PROFSRC_CLOCK && g->state == GMON_PROF_ON) {



CVS commit: src/sys/opencrypto

2021-08-14 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Aug 14 20:43:05 UTC 2021

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

Log Message:
fix typo in CRK_ALGORITHM_MIN definition to match CRK_ALGORITHM_MAX one.
while here fix few typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/opencrypto/crypto.c
cvs rdiff -u -r1.41 -r1.42 src/sys/opencrypto/cryptodev.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.115 src/sys/opencrypto/crypto.c:1.116
--- src/sys/opencrypto/crypto.c:1.115	Mon Aug  9 19:57:58 2021
+++ src/sys/opencrypto/crypto.c	Sat Aug 14 20:43:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.115 2021/08/09 19:57:58 andvar Exp $ */
+/*	$NetBSD: crypto.c,v 1.116 2021/08/14 20:43:05 andvar Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.115 2021/08/09 19:57:58 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.116 2021/08/14 20:43:05 andvar Exp $");
 
 #include 
 #include 
@@ -1047,7 +1047,7 @@ crypto_kregister(u_int32_t driverid, int
 
 	cap = crypto_checkdriver_lock(driverid);
 	if (cap != NULL &&
-	(CRK_ALGORITM_MIN <= kalg && kalg <= CRK_ALGORITHM_MAX)) {
+	(CRK_ALGORITHM_MIN <= kalg && kalg <= CRK_ALGORITHM_MAX)) {
 		/*
 		 * XXX Do some performance testing to determine placing.
 		 * XXX We probably need an auxiliary data structure that

Index: src/sys/opencrypto/cryptodev.h
diff -u src/sys/opencrypto/cryptodev.h:1.41 src/sys/opencrypto/cryptodev.h:1.42
--- src/sys/opencrypto/cryptodev.h:1.41	Mon Aug  9 19:57:58 2021
+++ src/sys/opencrypto/cryptodev.h	Sat Aug 14 20:43:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cryptodev.h,v 1.41 2021/08/09 19:57:58 andvar Exp $ */
+/*	$NetBSD: cryptodev.h,v 1.42 2021/08/14 20:43:05 andvar Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/cryptodev.h,v 1.2.2.6 2003/07/02 17:04:50 sam Exp $	*/
 /*	$OpenBSD: cryptodev.h,v 1.33 2002/07/17 23:52:39 art Exp $	*/
 
@@ -325,7 +325,7 @@ struct cryptret {
 
 
 /* Asymmetric key operations */
-#define	CRK_ALGORITM_MIN	0
+#define	CRK_ALGORITHM_MIN	0
 #define CRK_MOD_EXP		0
 #define CRK_MOD_EXP_CRT		1
 #define CRK_DSA_SIGN		2
@@ -402,7 +402,7 @@ struct cryptostats {
 	 * accumulate statistics about how long it takes to process
 	 * crypto requests at various points during processing.
 	 */
-	struct cryptotstat cs_invoke;	/* crypto_dipsatch -> crypto_invoke */
+	struct cryptotstat cs_invoke;	/* crypto_dispatch -> crypto_invoke */
 	struct cryptotstat cs_done;	/* crypto_invoke -> crypto_done */
 	struct cryptotstat cs_cb;	/* crypto_done -> callback */
 	struct cryptotstat cs_finis;	/* callback -> callback return */
@@ -636,8 +636,8 @@ extern	int crypto_devallowsoft;	/* only 
 /*
  * initialize the crypto framework subsystem (not the pseudo-device).
  * This must be called very early in boot, so the framework is ready
- * to handle registration requests when crpto hardware is autoconfigured.
- * (This declaration doesnt really belong here but there's no header
+ * to handle registration requests when crypto hardware is autoconfigured.
+ * (This declaration doesn't really belong here but there's no header
  * for the raw framework.)
  */
 int	crypto_init(void);



CVS commit: src/sys/dev/marvell

2021-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug 13 21:04:44 UTC 2021

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

Log Message:
s/fame/frame in mvxpe_mib_def with assumption that it was not intentional typo.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvxpe.c

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

Modified files:

Index: src/sys/dev/marvell/if_mvxpe.c
diff -u src/sys/dev/marvell/if_mvxpe.c:1.34 src/sys/dev/marvell/if_mvxpe.c:1.35
--- src/sys/dev/marvell/if_mvxpe.c:1.34	Mon Aug  2 12:56:24 2021
+++ src/sys/dev/marvell/if_mvxpe.c	Fri Aug 13 21:04:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $	*/
+/*	$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -218,7 +218,7 @@ STATIC struct mvxpe_mib_def {
 	"Frame Size  256 -  511"},
 	{MVXPE_MIB_RX_FRAME1023_OCT, 0,	"rx_frame_512_1023",
 	"Frame Size  512 - 1023", 0},
-	{MVXPE_MIB_RX_FRAMEMAX_OCT, 0,	"rx_fame_1024_max",
+	{MVXPE_MIB_RX_FRAMEMAX_OCT, 0,	"rx_frame_1024_max",
 	"Frame Size 1024 -  Max", 0},
 	{MVXPE_MIB_TX_GOOD_OCT, 1,	"tx_good_oct",
 	"Good Octets Tx", 0},



CVS commit: src/sys

2021-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug 13 20:26:07 UTC 2021

Modified Files:
src/sys/arch/amd64/amd64: locore.S
src/sys/arch/i386/i386: locore.S
src/sys/dev/marvell: mvxpsec.c
src/sys/dev/pci: if_bnx.c

Log Message:
s/struture/structure/ s/structre/structure/


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/marvell/mvxpsec.c
cvs rdiff -u -r1.108 -r1.109 src/sys/dev/pci/if_bnx.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.210 src/sys/arch/amd64/amd64/locore.S:1.211
--- src/sys/arch/amd64/amd64/locore.S:1.210	Sun Jun 21 16:57:18 2020
+++ src/sys/arch/amd64/amd64/locore.S	Fri Aug 13 20:26:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.210 2020/06/21 16:57:18 bouyer Exp $	*/
+/*	$NetBSD: locore.S,v 1.211 2021/08/13 20:26:07 andvar Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -1050,7 +1050,7 @@ ENTRY(start_xen32)
 	movl	$RELOC(HYPERVISOR_shared_info_pa),%ebp
 	movl	%ebx,(%ebp)
 	movl	$0,4(%ebp)
-	/* XXX assume hvm_start_info+dependant struture fits in a single page */
+	/* XXX assume hvm_start_info+dependant structure fits in a single page */
 	addl	$PAGE_SIZE, %ebx
 	addl	$PGOFSET,%ebx
 	andl	$~PGOFSET,%ebx

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.185 src/sys/arch/i386/i386/locore.S:1.186
--- src/sys/arch/i386/i386/locore.S:1.185	Wed May 27 19:33:40 2020
+++ src/sys/arch/i386/i386/locore.S	Fri Aug 13 20:26:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.185 2020/05/27 19:33:40 ad Exp $	*/
+/*	$NetBSD: locore.S,v 1.186 2021/08/13 20:26:07 andvar Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -128,7 +128,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.185 2020/05/27 19:33:40 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.186 2021/08/13 20:26:07 andvar Exp $");
 
 #include "opt_copy_symtab.h"
 #include "opt_ddb.h"
@@ -1205,7 +1205,7 @@ ENTRY(start_xenpvh)
 	andl	$~PGOFSET,%ebx
 	movl	$RELOC(HYPERVISOR_shared_info_pa),%ebp
 	movl	%ebx,(%ebp)
-	/* XXX assume hvm_start_info+dependant struture fits in a single page */
+	/* XXX assume hvm_start_info+dependant structure fits in a single page */
 	addl	$PAGE_SIZE, %ebx
 	addl	$PGOFSET,%ebx
 	andl	$~PGOFSET,%ebx

Index: src/sys/dev/marvell/mvxpsec.c
diff -u src/sys/dev/marvell/mvxpsec.c:1.7 src/sys/dev/marvell/mvxpsec.c:1.8
--- src/sys/dev/marvell/mvxpsec.c:1.7	Sat Jul 25 22:37:48 2020
+++ src/sys/dev/marvell/mvxpsec.c	Fri Aug 13 20:26:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvxpsec.c,v 1.7 2020/07/25 22:37:48 riastradh Exp $	*/
+/*	$NetBSD: mvxpsec.c,v 1.8 2021/08/13 20:26:07 andvar Exp $	*/
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
  * All rights reserved.
@@ -1487,7 +1487,7 @@ mvxpsec_packet_dtor(void *arg, void *obj
 }
 
 /*
- * allocate new session struture.
+ * allocate new session structure.
  */
 STATIC struct mvxpsec_session *
 mvxpsec_session_alloc(struct mvxpsec_softc *sc)

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.108 src/sys/dev/pci/if_bnx.c:1.109
--- src/sys/dev/pci/if_bnx.c:1.108	Sun Feb 14 14:05:03 2021
+++ src/sys/dev/pci/if_bnx.c	Fri Aug 13 20:26:07 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.109 2021/08/13 20:26:07 andvar Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.108 2021/02/14 14:05:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.109 2021/08/13 20:26:07 andvar Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -2304,7 +2304,7 @@ bnx_init_media(struct bnx_softc *sc)
 //
 /* Free any DMA memory owned by the driver. */
 /*  */
-/* Scans through each data structre that requires DMA memory and frees  */
+/* Scans through each data structure that requires DMA memory and frees */
 /* the memory if allocated. */
 /*  */
 /* Returns: */



CVS commit: src/sys/arch/alpha/alpha

2021-08-13 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug 13 20:19:45 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
fix multiple typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.300 -r1.301 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.300 src/sys/arch/alpha/alpha/pmap.c:1.301
--- src/sys/arch/alpha/alpha/pmap.c:1.300	Sat Jul 31 14:51:25 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Fri Aug 13 20:19:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.301 2021/08/13 20:19:45 andvar Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -106,8 +106,8 @@
  *
  *	All user page table access is done via K0SEG.  Kernel
  *	page table access is done via the recursive Virtual Page
- *	Table becase kernel PT pages are pre-allocated and never
- *	freed, so no VPT fault handling is requiried.
+ *	Table because kernel PT pages are pre-allocated and never
+ *	freed, so no VPT fault handling is required.
  */
 
 /*
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.301 2021/08/13 20:19:45 andvar Exp $");
 
 #include 
 #include 
@@ -578,9 +578,9 @@ pmap_pvlist_free(struct pmap_pvlist * co
  * that includes room for 8 VAs, the pmap the VAs belong to, a bitmap of
  * CPUs to be notified, and a list for PT pages that are freed during
  * removal off mappings.  The number of valid addresses in the list as
- * well as flags are sqeezed into the lower bits of the first two VAs.
+ * well as flags are squeezed into the lower bits of the first two VAs.
  * Storage for this structure is allocated on the stack.  We need to be
- * careful to keep the size of this struture under control.
+ * careful to keep the size of this structure under control.
  *
  * When notifying remote CPUs, we acquire the tlb_lock (which also
  * blocks IPIs), record the pointer to our context structure, set a
@@ -589,9 +589,9 @@ pmap_pvlist_free(struct pmap_pvlist * co
  * any invalidations necessary on the local CPU.  Once that is done,
  * we then wait the the global context pointer to be cleared, which
  * will be done by the final remote CPU to complete their work. This
- * method reduces cache line contention during pocessing.
+ * method reduces cache line contention during processing.
  *
- * When removing mappings in user pmaps, this implemention frees page
+ * When removing mappings in user pmaps, this implementation frees page
  * table pages back to the VM system once they contain no valid mappings.
  * As we do this, we must ensure to invalidate TLB entries that the
  * CPU might hold for the respective recursive VPT mappings.  This must
@@ -1038,7 +1038,7 @@ pmap_tlb_shootnow(const struct pmap_tlb_
 
 	/*
 	 * Figure out who to notify.  If it's for the kernel or
-	 * multiple aaddress spaces, we notify everybody.  If
+	 * multiple address spaces, we notify everybody.  If
 	 * it's a single user pmap, then we try to acquire the
 	 * activation lock so we can get an accurate accounting
 	 * of who needs to be notified.  If we can't acquire
@@ -2094,7 +2094,7 @@ pmap_enter_tlb_shootdown(pmap_t const pm
  * pmap_enter_l2pt_delref:
  *
  *	Release a reference on an L2 PT page for pmap_enter().
- *	This is factored out separately becacause we expect it
+ *	This is factored out separately because we expect it
  *	to be a rare case.
  */
 static void __noinline
@@ -2105,7 +2105,7 @@ pmap_enter_l2pt_delref(pmap_t const pmap
 
 	/*
 	 * PALcode may have tried to service a TLB miss with
-	 * this L2 PTE, so we need to make sure we don't actully
+	 * this L2 PTE, so we need to make sure we don't actually
 	 * free the PT page untl we've shot down any TLB entries
 	 * for this VPT index.
 	 */
@@ -2122,7 +2122,7 @@ pmap_enter_l2pt_delref(pmap_t const pmap
  * pmap_enter_l3pt_delref:
  *
  *	Release a reference on an L3 PT page for pmap_enter().
- *	This is factored out separately becacause we expect it
+ *	This is factored out separately because we expect it
  *	to be a rare case.
  */
 static void __noinline
@@ -2133,8 +2133,8 @@ pmap_enter_l3pt_delref(pmap_t const pmap
 
 	/*
 	 * PALcode may have tried to service a TLB miss with
-	 * this PTE, so we need to make sure we don't actully
-	 * free the PT page untl we've shot down any TLB entries
+	 * this PTE, so we need to make sure we don't actually
+	 * free the PT page until we've shot down any TLB entries
 	 * for this VPT index.
 	 */
 
@@ -2256,7 +2256,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
 	 * new one immediately.
 	 */
 	if ((opte & PG_V) == 0) {
-		/* No TLB invalidatons needed for new mappings. */
+		/* No TLB 

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

2021-08-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Aug 13 11:40:43 UTC 2021

Modified Files:
src/sys/arch/arm/footbridge: footbridge.c footbridge_clock.c
footbridge_com.c footbridge_com_io.c footbridge_intr.h
footbridge_io.c footbridge_irqhandler.c footbridge_pci.c
src/sys/arch/arm/footbridge/isa: dsrtc.c isa_io.c isa_io_asm.S
isa_machdep.c

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/footbridge/footbridge.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/footbridge/footbridge_clock.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/footbridge/footbridge_com.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/footbridge/footbridge_com_io.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/footbridge/footbridge_intr.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/arm/footbridge/footbridge_io.c
cvs rdiff -u -r1.27 -r1.28 \
src/sys/arch/arm/footbridge/footbridge_irqhandler.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/footbridge/footbridge_pci.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/footbridge/isa/dsrtc.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/footbridge/isa/isa_io.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/footbridge/isa/isa_io_asm.S
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/arm/footbridge/isa/isa_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/footbridge/footbridge.c
diff -u src/sys/arch/arm/footbridge/footbridge.c:1.28 src/sys/arch/arm/footbridge/footbridge.c:1.29
--- src/sys/arch/arm/footbridge/footbridge.c:1.28	Sat Aug  7 16:18:43 2021
+++ src/sys/arch/arm/footbridge/footbridge.c	Fri Aug 13 11:40:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: footbridge.c,v 1.28 2021/08/07 16:18:43 thorpej Exp $	*/
+/*	$NetBSD: footbridge.c,v 1.29 2021/08/13 11:40:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997,1998 Mark Brinicombe.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.28 2021/08/07 16:18:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge.c,v 1.29 2021/08/13 11:40:43 skrll Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ __KERNEL_RCSID(0, "$NetBSD: footbridge.c
 #include 
 #include 
 #include 
- 
+
 /*
  * DC21285 'Footbridge' device
  *
@@ -126,8 +126,8 @@ footbridge_print(void *aux, const char *
  * int footbridge_match(device_t parent, cfdata_t cf, void *aux)
  *
  * Just return ok for this if it is device 0
- */ 
- 
+ */
+
 static int
 footbridge_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -141,7 +141,7 @@ footbridge_match(device_t parent, cfdata
  * void footbridge_attach(device_t parent, device_t dev, void *aux)
  *
  */
-  
+
 static void
 footbridge_attach(device_t parent, device_t self, void *aux)
 {
@@ -188,7 +188,7 @@ footbridge_attach(device_t parent, devic
 	"targ abt", footbridge_intr, sc);
 	sc->sc_parity_ih = footbridge_intr_claim(IRQ_PARITY, IPL_HIGH,
 	"parity", footbridge_intr, sc);
-	
+
 	/* Set up the PCI bus tags */
 	footbridge_create_io_bs_tag(_pci_io_bs_tag,
 	(void *)DC21285_PCI_IO_VBASE);
@@ -220,7 +220,7 @@ footbridge_attach(device_t parent, devic
 break;
 		mask--;
 		mask &= SDRAM_MASK_256MB;
-		
+
 		/*
 		 * configure the mask, the offset into SDRAM and the address
 		 * SDRAM is exposed on the PCI bus.
@@ -255,7 +255,7 @@ footbridge_attach(device_t parent, devic
 	fba.fba_fca.fca_tx_irq = IRQ_SERIAL_TX;
 	config_found(self, _fca, footbridge_print,
 	CFARGS(.iattr = "footbridge"));
-	
+
 	/* Setup fast SA110 cache clean area */
 #ifdef CPU_SA110
 	if (cputype == CPU_ID_SA110)

Index: src/sys/arch/arm/footbridge/footbridge_clock.c
diff -u src/sys/arch/arm/footbridge/footbridge_clock.c:1.26 src/sys/arch/arm/footbridge/footbridge_clock.c:1.27
--- src/sys/arch/arm/footbridge/footbridge_clock.c:1.26	Tue Jul 21 07:35:55 2009
+++ src/sys/arch/arm/footbridge/footbridge_clock.c	Fri Aug 13 11:40:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: footbridge_clock.c,v 1.26 2009/07/21 07:35:55 skrll Exp $	*/
+/*	$NetBSD: footbridge_clock.c,v 1.27 2021/08/13 11:40:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.26 2009/07/21 07:35:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: footbridge_clock.c,v 1.27 2021/08/13 11:40:43 skrll Exp $");
 
 /* Include header files */
 
@@ -88,8 +88,8 @@ CFATTACH_DECL_NEW(footbridge_clock, size
  * int clockmatch(device_t parent, cfdata_t cf, void *aux);
  *
  * Just return ok for this if it is device 0
- */ 
- 
+ */
+
 static int
 clockmatch(device_t parent, cfdata_t cf, void *aux)
 {
@@ -105,7 +105,7 @@ clockmatch(device_t parent, cfdata_t cf,
  * void clockattach(device_t parent, device_t self, void *aux)
  *
  */
-  
+
 static void
 clockattach(device_t parent, device_t self, void *aux)
 {
@@ -119,7 +119,7 @@ clockattach(device_t parent, device_t se
 	clock_sc = sc;
 
 	/* 

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

2021-08-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 12 20:13:54 UTC 2021

Modified Files:
src/sys/arch/amiga/amiga: cc.c cc.h

Log Message:
s/iterrupt sever/interrupt server/


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amiga/amiga/cc.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amiga/amiga/cc.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/amiga/amiga/cc.c
diff -u src/sys/arch/amiga/amiga/cc.c:1.27 src/sys/arch/amiga/amiga/cc.c:1.28
--- src/sys/arch/amiga/amiga/cc.c:1.27	Sun Aug 20 11:03:04 2017
+++ src/sys/arch/amiga/amiga/cc.c	Thu Aug 12 20:13:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cc.c,v 1.27 2017/08/20 11:03:04 maxv Exp $	*/
+/*	$NetBSD: cc.c,v 1.28 2021/08/12 20:13:54 andvar Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.27 2017/08/20 11:03:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.28 2021/08/12 20:13:54 andvar Exp $");
 
 #include 
 #include 
@@ -61,7 +61,7 @@ custom_chips_init(void)
 }
 
 /*
- * Vertical blank iterrupt sever chains.
+ * Vertical blank interrupt server chains.
  */
 LIST_HEAD(vbllist, vbl_node) vbl_list;
 

Index: src/sys/arch/amiga/amiga/cc.h
diff -u src/sys/arch/amiga/amiga/cc.h:1.18 src/sys/arch/amiga/amiga/cc.h:1.19
--- src/sys/arch/amiga/amiga/cc.h:1.18	Fri Jan  3 07:14:20 2014
+++ src/sys/arch/amiga/amiga/cc.h	Thu Aug 12 20:13:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cc.h,v 1.18 2014/01/03 07:14:20 mlelstv Exp $	*/
+/*	$NetBSD: cc.h,v 1.19 2021/08/12 20:13:54 andvar Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -71,7 +71,7 @@ struct audio_channel {
 #define AUCC_ALLDMAF (DMAF_AUD0|DMAF_AUD1|DMAF_AUD2|DMAF_AUD3)
 
 /*
- * Vertical blank iterrupt sever chains.
+ * Vertical blank interrupt server chains.
  */
 
 struct vbl_node {



CVS commit: src/sys

2021-08-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 12 19:53:18 UTC 2021

Modified Files:
src/sys/arch/atari/dev: grfabs_et.c
src/sys/dev/qbus: rf.c

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/atari/dev/grfabs_et.c
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/qbus/rf.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/atari/dev/grfabs_et.c
diff -u src/sys/arch/atari/dev/grfabs_et.c:1.35 src/sys/arch/atari/dev/grfabs_et.c:1.36
--- src/sys/arch/atari/dev/grfabs_et.c:1.35	Mon Sep  3 16:29:24 2018
+++ src/sys/arch/atari/dev/grfabs_et.c	Thu Aug 12 19:53:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grfabs_et.c,v 1.35 2018/09/03 16:29:24 riastradh Exp $	*/
+/*	$NetBSD: grfabs_et.c,v 1.36 2021/08/12 19:53:18 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grfabs_et.c,v 1.35 2018/09/03 16:29:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grfabs_et.c,v 1.36 2021/08/12 19:53:18 andvar Exp $");
 
 #include 
 #include 
@@ -165,7 +165,7 @@ struct grfabs_et_priv {
 
 /*
  * XXX: called from ite console init routine.
- * Initialize list of posible video modes.
+ * Initialize list of possible video modes.
  */
 void
 et_probe_video(MODES *modelp)

Index: src/sys/dev/qbus/rf.c
diff -u src/sys/dev/qbus/rf.c:1.36 src/sys/dev/qbus/rf.c:1.37
--- src/sys/dev/qbus/rf.c:1.36	Sat Aug  7 16:19:15 2021
+++ src/sys/dev/qbus/rf.c	Thu Aug 12 19:53:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf.c,v 1.36 2021/08/07 16:19:15 thorpej Exp $	*/
+/*	$NetBSD: rf.c,v 1.37 2021/08/12 19:53:18 andvar Exp $	*/
 /*
  * Copyright (c) 2002 Jochen Kunz.
  * All rights reserved.
@@ -36,7 +36,7 @@ TODO:
 */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.36 2021/08/07 16:19:15 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.37 2021/08/12 19:53:18 andvar Exp $");
 
 /* autoconfig stuff */
 #include 
@@ -70,7 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf.c,v 1.36 
 /* hz for above */
 #include 
 
-/* bitdefinitions for RX211 */
+/* bit definitions for RX211 */
 #include 
 
 
@@ -392,8 +392,8 @@ rfc_attach(device_t parent, device_t sel
 
 #ifndef RX02_PROBE
 	/*
-	 * Bouth disk drievs and the controller are one physical unit.
-	 * If we found the controller, there will be bouth disk drievs.
+	 * Both disk drives and the controller are one physical unit.
+	 * If we found the controller, there will be both disk drives.
 	 * So attach them.
 	 */
 	rfc_aa.dnum = 0;
@@ -406,7 +406,7 @@ rfc_attach(device_t parent, device_t sel
 	/*
 	 * There are clones of the DEC RX system with standard shugart
 	 * interface. In this case we can not be sure that there are
-	 * bouth disk drievs. So we want to do a detection of attached
+	 * both disk drives. So we want to do a detection of attached
 	 * drives. This is done by reading a sector from disk. This means
 	 * that there must be a formatted disk in the drive at boot time.
 	 * This is bad, but I did not find another way to detect the
@@ -472,7 +472,7 @@ rf_attach(device_t parent, device_t self
 	dl->d_typename[4] = '\0';
 	dl->d_secsize = DEV_BSIZE;		/* bytes per sector */
 	/*
-	 * Fill in some values to have a initialized data structure. Some
+	 * Fill in some values to have an initialized data structure. Some
 	 * values will be reset by rfopen() depending on the actual density.
 	 */
 	dl->d_nsectors = RX2_SECTORS;		/* sectors per track */
@@ -617,7 +617,7 @@ rfstrategy(struct buf *buf)
  * and start to process it if there is one.
  * If the bufferqueue is empty, look at the bufferqueue of the other drive
  * that is attached to this controller.
- * Start procesing the bufferqueue of the other drive if it isn't empty.
+ * Start processing the bufferqueue of the other drive if it isn't empty.
  * Return a pointer to the softc structure of the drive that is now
  * ready to process a buffer or NULL if there is no buffer in either queues.
  */
@@ -1011,9 +1011,9 @@ rfopen(dev_t dev, int oflags, int devtyp
 		 * Controller is idle and density is not detected.
 		 * Start a density probe by issuing a read sector command
 		 * and sleep until the density probe finished.
-		 * Due to this it is imposible to open unformatted media.
+		 * Due to this it is impossible to open unformatted media.
 		 * As the RX02/02 is not able to format its own media,
-		 * media must be purchased preformatted. fsck DEC makreting!
+		 * media must be purchased preformatted. fsck DEC marketing!
 		 */
 		RFS_SETCMD(rf_sc->sc_state, RFS_PROBING);
 		disk_busy(_sc->sc_disk);



CVS commit: src/sys/kern

2021-08-12 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Thu Aug 12 19:15:15 UTC 2021

Modified Files:
src/sys/kern: vnode_if.sh

Log Message:
s/beween/between/


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/kern/vnode_if.sh

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/vnode_if.sh
diff -u src/sys/kern/vnode_if.sh:1.70 src/sys/kern/vnode_if.sh:1.71
--- src/sys/kern/vnode_if.sh:1.70	Sat May 16 18:31:50 2020
+++ src/sys/kern/vnode_if.sh	Thu Aug 12 19:15:15 2021
@@ -29,7 +29,7 @@ copyright="\
  * SUCH DAMAGE.
  */
 "
-SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.70 2020/05/16 18:31:50 christos Exp $'
+SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.71 2021/08/12 19:15:15 andvar Exp $'
 
 # Script to produce VFS front-end sugar.
 #
@@ -86,7 +86,7 @@ fi
 # Input to this parser is pre-processed slightly by sed
 # so this awk parser doesn't have to work so hard.  The
 # changes done by the sed pre-processing step are:
-#	insert a space beween * and pointer name
+#	insert a space between * and pointer name
 #	replace semicolons with spaces
 #
 sed_prep='s:\*\([^\*/]\):\* \1:g



CVS commit: src/sys/ufs/chfs

2021-08-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Aug 11 05:17:48 UTC 2021

Modified Files:
src/sys/ufs/chfs: media.h

Log Message:
s/enrty/entry/


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/ufs/chfs/media.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/ufs/chfs/media.h
diff -u src/sys/ufs/chfs/media.h:1.2 src/sys/ufs/chfs/media.h:1.3
--- src/sys/ufs/chfs/media.h:1.2	Fri Oct 19 12:44:39 2012
+++ src/sys/ufs/chfs/media.h	Wed Aug 11 05:17:48 2021
@@ -46,7 +46,7 @@ typedef uint64_t le64;
 enum {
 	CHFS_NODETYPE_VNODE = 1,	/* vnode information */
 	CHFS_NODETYPE_DATA,			/* data node */
-	CHFS_NODETYPE_DIRENT,		/* directory enrty */
+	CHFS_NODETYPE_DIRENT,		/* directory entry */
 	CHFS_NODETYPE_PADDING,		/* padding node */
 };
 



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 17:12:31 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: files.cortex gic.c gicv3.c

Log Message:
Make gic_splfuncs optional and disable it by default until it has had
more testing.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/arm/cortex/gicv3.c

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

Modified files:

Index: src/sys/arch/arm/cortex/files.cortex
diff -u src/sys/arch/arm/cortex/files.cortex:1.15 src/sys/arch/arm/cortex/files.cortex:1.16
--- src/sys/arch/arm/cortex/files.cortex:1.15	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/files.cortex	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-# $NetBSD: files.cortex,v 1.15 2021/08/10 15:33:09 jmcneill Exp $
+# $NetBSD: files.cortex,v 1.16 2021/08/10 17:12:31 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h			NEON_IN_CKSUM
 
@@ -11,16 +11,16 @@ device	armperiph: mpcorebus
 attach	armperiph at mainbus
 file	arch/arm/cortex/armperiph.c		armperiph
 
-define	gic_splfuncs
+defflag	opt_gic.hGIC_SPLFUNCS
 file	arch/arm/cortex/gic_splfuncs.c		gic_splfuncs
 
 # ARM Generic Interrupt Controller (initially on Cortex-A9)
-device	armgic: pic, pic_splfuncs, gic_splfuncs
+device	armgic: pic, pic_splfuncs
 attach	armgic at mpcorebus
 file	arch/arm/cortex/gic.c			armgic
 
 # ARM Generic Interrupt Controller v3+
-device	gicvthree: pic, pic_splfuncs, gic_splfuncs
+device	gicvthree: pic, pic_splfuncs
 file	arch/arm/cortex/gicv3.c			gicvthree
 file	arch/arm/cortex/gicv3_its.c		gicvthree & pci & __have_pci_msi_msix
 

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.48 src/sys/arch/arm/cortex/gic.c:1.49
--- src/sys/arch/arm/cortex/gic.c:1.48	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/gic.c	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $	*/
+/*	$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,11 +30,12 @@
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
+#include "opt_gic.h"
 
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.49 2021/08/10 17:12:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,9 +51,12 @@ __KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48
 #include 
 
 #include 
-#include 
 #include 
 
+#ifdef GIC_SPLFUNCS
+#include 
+#endif
+
 void armgic_irq_handler(void *);
 
 #define	ARMGIC_SGI_IPIBASE	0
@@ -730,7 +734,9 @@ armgic_attach(device_t parent, device_t 
 	"%u SGIs\n",  priorities, sc->sc_gic_lines - ppis - sgis, ppis,
 	sgis);
 
+#ifdef GIC_SPLFUNCS
 	gic_spl_init();
+#endif
 }
 
 CFATTACH_DECL_NEW(armgic, 0,

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.45 src/sys/arch/arm/cortex/gicv3.c:1.46
--- src/sys/arch/arm/cortex/gicv3.c:1.45	Tue Aug 10 15:33:09 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Tue Aug 10 17:12:31 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.46 2021/08/10 17:12:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,11 +27,12 @@
  */
 
 #include "opt_multiprocessor.h"
+#include "opt_gic.h"
 
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.46 2021/08/10 17:12:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,7 +52,10 @@ __KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.
 
 #include 
 #include 
+
+#ifdef GIC_SPLFUNCS
 #include 
+#endif
 
 #define	PICTOSOFTC(pic)	\
 	((void *)((uintptr_t)(pic) - offsetof(struct gicv3_softc, sc_pic)))
@@ -952,7 +956,9 @@ gicv3_init(struct gicv3_softc *sc)
 #endif
 #endif
 
+#ifdef GIC_SPLFUNCS
 	gic_spl_init();
+#endif
 
 	return 0;
 }



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 16:52:43 UTC 2021

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

Log Message:
Enable DVFS


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.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-sopine-baseboard.dts
diff -u src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.4 src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.5
--- src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts:1.4	Wed Jun 30 06:24:02 2021
+++ src/sys/arch/arm/dts/sun50i-a64-sopine-baseboard.dts	Tue Aug 10 16:52:43 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.4 2021/06/30 06:24:02 skrll Exp $ */
+/* $NetBSD: sun50i-a64-sopine-baseboard.dts,v 1.5 2021/08/10 16:52:43 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -37,3 +37,15 @@
 	status = "okay";
 };
 
+ {
+cpu-supply = <_dcdc2>;
+operating-points = <
+/* kHzuV */
+1152000 130
+1104000 126
+1008000 120
+816000  108
+648000  104
+408000  100
+>;
+};



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:33:09 UTC 2021

Modified Files:
src/sys/arch/arm/cortex: files.cortex gic.c gicv3.c
Added Files:
src/sys/arch/arm/cortex: gic_splfuncs.c gic_splfuncs.h

Log Message:
Use custom spl funcs for GIC and avoid unnecessary pmr register accesses
in splx.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/cortex/files.cortex
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/arm/cortex/gic.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/cortex/gic_splfuncs.c \
src/sys/arch/arm/cortex/gic_splfuncs.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/cortex/gicv3.c

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

Modified files:

Index: src/sys/arch/arm/cortex/files.cortex
diff -u src/sys/arch/arm/cortex/files.cortex:1.14 src/sys/arch/arm/cortex/files.cortex:1.15
--- src/sys/arch/arm/cortex/files.cortex:1.14	Tue Sep 29 19:58:50 2020
+++ src/sys/arch/arm/cortex/files.cortex	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-# $NetBSD: files.cortex,v 1.14 2020/09/29 19:58:50 jmcneill Exp $
+# $NetBSD: files.cortex,v 1.15 2021/08/10 15:33:09 jmcneill Exp $
 
 defflag opt_cpu_in_cksum.h			NEON_IN_CKSUM
 
@@ -11,13 +11,16 @@ device	armperiph: mpcorebus
 attach	armperiph at mainbus
 file	arch/arm/cortex/armperiph.c		armperiph
 
+define	gic_splfuncs
+file	arch/arm/cortex/gic_splfuncs.c		gic_splfuncs
+
 # ARM Generic Interrupt Controller (initially on Cortex-A9)
-device	armgic: pic, pic_splfuncs
+device	armgic: pic, pic_splfuncs, gic_splfuncs
 attach	armgic at mpcorebus
 file	arch/arm/cortex/gic.c			armgic
 
 # ARM Generic Interrupt Controller v3+
-device	gicvthree: pic, pic_splfuncs
+device	gicvthree: pic, pic_splfuncs, gic_splfuncs
 file	arch/arm/cortex/gicv3.c			gicvthree
 file	arch/arm/cortex/gicv3_its.c		gicvthree & pci & __have_pci_msi_msix
 

Index: src/sys/arch/arm/cortex/gic.c
diff -u src/sys/arch/arm/cortex/gic.c:1.47 src/sys/arch/arm/cortex/gic.c:1.48
--- src/sys/arch/arm/cortex/gic.c:1.47	Sun Mar 28 09:11:38 2021
+++ src/sys/arch/arm/cortex/gic.c	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $	*/
+/*	$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.47 2021/03/28 09:11:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.48 2021/08/10 15:33:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,6 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.47
 #include 
 
 #include 
+#include 
 #include 
 
 void armgic_irq_handler(void *);
@@ -224,11 +225,10 @@ armgic_set_priority(struct pic_softc *pi
 	struct armgic_softc * const sc = PICTOSOFTC(pic);
 	struct cpu_info * const ci = curcpu();
 
-	const uint32_t priority = armgic_ipl_to_priority(ipl);
-	if (priority > ci->ci_hwpl) {
+	if (ipl < ci->ci_hwpl) {
 		/* Lowering priority mask */
-		ci->ci_hwpl = priority;
-		gicc_write(sc, GICC_PMR, priority);
+		ci->ci_hwpl = ipl;
+		gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ipl));
 	}
 }
 
@@ -327,10 +327,9 @@ armgic_irq_handler(void *tf)
 
 	ci->ci_data.cpu_nintr++;
 
-	const uint32_t priority = armgic_ipl_to_priority(old_ipl);
-	if (ci->ci_hwpl != priority) {
-		ci->ci_hwpl = priority;
-		gicc_write(sc, GICC_PMR, priority);
+	if (ci->ci_hwpl != old_ipl) {
+		ci->ci_hwpl = old_ipl;
+		gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(old_ipl));
 		if (old_ipl == IPL_HIGH) {
 			return;
 		}
@@ -545,7 +544,7 @@ armgic_cpu_init(struct pic_softc *pic, s
 			sc->sc_enabled_local);
 		}
 	}
-	ci->ci_hwpl = armgic_ipl_to_priority(ci->ci_cpl);
+	ci->ci_hwpl = ci->ci_cpl;
 	gicc_write(sc, GICC_PMR, armgic_ipl_to_priority(ci->ci_cpl));	// set PMR
 	gicc_write(sc, GICC_CTRL, GICC_CTRL_V1_Enable);	// enable interrupt
 	ENABLE_INTERRUPT();// allow IRQ exceptions
@@ -730,6 +729,8 @@ armgic_attach(device_t parent, device_t 
 	aprint_normal_dev(sc->sc_dev, "%u Priorities, %zu SPIs, %u PPIs, "
 	"%u SGIs\n",  priorities, sc->sc_gic_lines - ppis - sgis, ppis,
 	sgis);
+
+	gic_spl_init();
 }
 
 CFATTACH_DECL_NEW(armgic, 0,

Index: src/sys/arch/arm/cortex/gicv3.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.44 src/sys/arch/arm/cortex/gicv3.c:1.45
--- src/sys/arch/arm/cortex/gicv3.c:1.44	Sun Mar 28 11:13:24 2021
+++ src/sys/arch/arm/cortex/gicv3.c	Tue Aug 10 15:33:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.44 2021/03/28 11:13:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.45 2021/08/10 15:33:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -51,6 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: 

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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:31:55 UTC 2021

Modified Files:
src/sys/arch/arm/pic: pic_splfuncs.c picvar.h

Log Message:
arm: pic: allow overriding _splraise/_spllower/splx


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/pic/pic_splfuncs.c
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/arm/pic/picvar.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/pic/pic_splfuncs.c
diff -u src/sys/arch/arm/pic/pic_splfuncs.c:1.20 src/sys/arch/arm/pic/pic_splfuncs.c:1.21
--- src/sys/arch/arm/pic/pic_splfuncs.c:1.20	Sat Mar 27 12:15:09 2021
+++ src/sys/arch/arm/pic/pic_splfuncs.c	Tue Aug 10 15:31:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic_splfuncs.c,v 1.20 2021/03/27 12:15:09 jmcneill Exp $	*/
+/*	$NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.20 2021/03/27 12:15:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_splfuncs.c,v 1.21 2021/08/10 15:31:55 jmcneill Exp $");
 
 #define _INTR_PRIVATE
 #include 
@@ -46,9 +46,16 @@ __KERNEL_RCSID(0, "$NetBSD: pic_splfuncs
 
 #include 
 
+static int	pic_default_splraise(int);
+static int	pic_default_spllower(int);
+static void	pic_default_splx(int);
+
+int (*_splraise)(int) = pic_default_splraise;
+int (*_spllower)(int) = pic_default_spllower;
+void (*splx)(int) = pic_default_splx;
 
-int
-_splraise(int newipl)
+static int
+pic_default_splraise(int newipl)
 {
 	struct cpu_info * const ci = curcpu();
 	const int oldipl = ci->ci_cpl;
@@ -58,8 +65,9 @@ _splraise(int newipl)
 	}
 	return oldipl;
 }
-int
-_spllower(int newipl)
+
+static int
+pic_default_spllower(int newipl)
 {
 	struct cpu_info * const ci = curcpu();
 	const int oldipl = ci->ci_cpl;
@@ -76,8 +84,8 @@ _spllower(int newipl)
 	return oldipl;
 }
 
-void
-splx(int savedipl)
+static void
+pic_default_splx(int savedipl)
 {
 	struct cpu_info * const ci = curcpu();
 	KASSERT(savedipl < NIPL);

Index: src/sys/arch/arm/pic/picvar.h
diff -u src/sys/arch/arm/pic/picvar.h:1.34 src/sys/arch/arm/pic/picvar.h:1.35
--- src/sys/arch/arm/pic/picvar.h:1.34	Sat Mar 27 12:15:09 2021
+++ src/sys/arch/arm/pic/picvar.h	Tue Aug 10 15:31:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: picvar.h,v 1.34 2021/03/27 12:15:09 jmcneill Exp $	*/
+/*	$NetBSD: picvar.h,v 1.35 2021/08/10 15:31:55 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -40,9 +40,10 @@
 
 typedef uint32_t	intr_handle_t;		/* for ACPI */
 
-int	_splraise(int);
-int	_spllower(int);
-void	splx(int);
+extern int	(*_splraise)(int);
+extern int	(*_spllower)(int);
+extern void	(*splx)(int);
+
 const char *
 	intr_typename(int);
 



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

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:31:38 UTC 2021

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

Log Message:
Disable MSI if the linux,pcie-nomsi flag is present


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/acpi/acpipchb.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/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.27 src/sys/arch/arm/acpi/acpipchb.c:1.28
--- src/sys/arch/arm/acpi/acpipchb.c:1.27	Sat Aug  7 21:27:53 2021
+++ src/sys/arch/arm/acpi/acpipchb.c	Tue Aug 10 15:31:38 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.27 2021/08/07 21:27:53 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.27 2021/08/07 21:27:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $");
 
 #include 
 #include 
@@ -123,7 +123,7 @@ acpipchb_attach(device_t parent, device_
 	struct acpipchb_softc * const sc = device_private(self);
 	struct acpi_attach_args *aa = aux;
 	struct pcibus_attach_args pba;
-	ACPI_INTEGER seg;
+	ACPI_INTEGER seg, nomsi;
 	ACPI_STATUS rv;
 	uint16_t bus_start;
 
@@ -148,6 +148,11 @@ acpipchb_attach(device_t parent, device_
 		seg = 0;
 	}
 
+	if (ACPI_FAILURE(acpi_dsd_integer(sc->sc_handle, "linux,pcie-nomsi",
+	))) {
+		nomsi = 0;
+	}
+
 	aprint_naive("\n");
 	aprint_normal(": PCI Express Host Bridge\n");
 
@@ -156,6 +161,9 @@ acpipchb_attach(device_t parent, device_
 	memset(, 0, sizeof(pba));
 	pba.pba_flags = aa->aa_pciflags &
 			~(PCI_FLAGS_MEM_OKAY | PCI_FLAGS_IO_OKAY);
+	if (nomsi) {
+		pba.pba_flags &= ~(PCI_FLAGS_MSI_OKAY | PCI_FLAGS_MSIX_OKAY);
+	}
 	pba.pba_memt = 0;
 	pba.pba_iot = 0;
 	pba.pba_dmat = aa->aa_dmat;



CVS commit: src/sys/dev/ic

2021-08-10 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Aug 10 15:28:44 UTC 2021

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

Log Message:
Clear IFF_OACTIVE in genet_txintr (bug introduced in r1.8) and don't
sync DMA maps with size 0.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bcmgenet.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/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.9 src/sys/dev/ic/bcmgenet.c:1.10
--- src/sys/dev/ic/bcmgenet.c:1.9	Mon May  3 10:28:26 2021
+++ src/sys/dev/ic/bcmgenet.c	Tue Aug 10 15:28:44 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $");
 
 #include 
 #include 
@@ -726,9 +726,11 @@ genet_rxintr(struct genet_softc *sc, int
 		}
 
 		/* unload map before it gets loaded in setup_rxbuf */
-		bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
-		0, sc->sc_rx.buf_map[index].map->dm_mapsize,
-		BUS_DMASYNC_POSTREAD);
+		if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) {
+			bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map,
+			0, sc->sc_rx.buf_map[index].map->dm_mapsize,
+			BUS_DMASYNC_POSTREAD);
+		}
 		bus_dmamap_unload(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map);
 		sc->sc_rx.buf_map[index].mbuf = NULL;
 
@@ -778,15 +780,18 @@ genet_txintr(struct genet_softc *sc, int
 		bmap = >sc_tx.buf_map[i];
 		if (bmap->mbuf != NULL) {
 			/* XXX first segment already unloads */
-			bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
-			0, bmap->map->dm_mapsize,
-			BUS_DMASYNC_POSTWRITE);
+			if (bmap->map->dm_mapsize > 0) {
+bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map,
+0, bmap->map->dm_mapsize,
+BUS_DMASYNC_POSTWRITE);
+			}
 			bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map);
 			m_freem(bmap->mbuf);
 			bmap->mbuf = NULL;
 			++pkts;
 		}
 
+		ifp->if_flags &= ~IFF_OACTIVE;
 		i = TX_NEXT(i);
 		sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0x;
 	}



CVS commit: src/sys/arch/evbarm

2021-08-10 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Aug 10 06:47:49 UTC 2021

Modified Files:
src/sys/arch/evbarm/imx23_olinuxino: imx23_olinuxino_machdep.c
src/sys/arch/evbarm/include: bootconfig.h
src/sys/arch/evbarm/integrator: integrator_machdep.c

Log Message:
G/C unused flag


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/include/bootconfig.h
cvs rdiff -u -r1.79 -r1.80 \
src/sys/arch/evbarm/integrator/integrator_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/imx23_olinuxino/imx23_olinuxino_machdep.c
diff -u src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.11 src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.12
--- src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c:1.11	Sat Nov 28 14:02:30 2020
+++ src/sys/arch/evbarm/imx23_olinuxino/imx23_olinuxino_machdep.c	Tue Aug 10 06:47:48 2021
@@ -1,4 +1,4 @@
-/* $Id: imx23_olinuxino_machdep.c,v 1.11 2020/11/28 14:02:30 skrll Exp $ */
+/* $Id: imx23_olinuxino_machdep.c,v 1.12 2021/08/10 06:47:48 skrll Exp $ */
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -178,7 +178,7 @@ initarm(void *arg)
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = DRAM_BASE;
 	bootconfig.dram[0].pages = ram_size / PAGE_SIZE;
-	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA | BOOT_DRAM_PREFER;
+	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA;
 
 arm32_bootmem_init(bootconfig.dram[0].address, ram_size,
 ((vsize_t)_BASE_phys));

Index: src/sys/arch/evbarm/include/bootconfig.h
diff -u src/sys/arch/evbarm/include/bootconfig.h:1.10 src/sys/arch/evbarm/include/bootconfig.h:1.11
--- src/sys/arch/evbarm/include/bootconfig.h:1.10	Mon Jun 18 13:05:20 2018
+++ src/sys/arch/evbarm/include/bootconfig.h	Tue Aug 10 06:47:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bootconfig.h,v 1.10 2018/06/18 13:05:20 jmcneill Exp $	*/
+/*	$NetBSD: bootconfig.h,v 1.11 2021/08/10 06:47:48 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994 Mark Brinicombe.
@@ -51,7 +51,6 @@ typedef struct _PhysMem {
 	u_int pages;
 	u_int flags;
 #define BOOT_DRAM_CAN_DMA 1	/* Can DMA direct to this memory.  */
-#define BOOT_DRAM_PREFER  2	/* UVM should prefer this memory.  */
 } PhysMem;
 
 #ifndef	DRAM_BLOCKS

Index: src/sys/arch/evbarm/integrator/integrator_machdep.c
diff -u src/sys/arch/evbarm/integrator/integrator_machdep.c:1.79 src/sys/arch/evbarm/integrator/integrator_machdep.c:1.80
--- src/sys/arch/evbarm/integrator/integrator_machdep.c:1.79	Sat Apr 18 11:00:39 2020
+++ src/sys/arch/evbarm/integrator/integrator_machdep.c	Tue Aug 10 06:47:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: integrator_machdep.c,v 1.79 2020/04/18 11:00:39 skrll Exp $	*/
+/*	$NetBSD: integrator_machdep.c,v 1.80 2021/08/10 06:47:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001,2002 ARM Ltd
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: integrator_machdep.c,v 1.79 2020/04/18 11:00:39 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: integrator_machdep.c,v 1.80 2021/08/10 06:47:49 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_console.h"
@@ -371,7 +371,7 @@ initarm(void *arg)
 	bootconfig.dramblocks = 1;
 	bootconfig.dram[0].address = memstart;
 	bootconfig.dram[0].pages = memsize / PAGE_SIZE;
-	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA | BOOT_DRAM_PREFER;
+	bootconfig.dram[0].flags = BOOT_DRAM_CAN_DMA;
 
 	arm32_bootmem_init(bootconfig.dram[0].address,
 		bootconfig.dram[0].pages * PAGE_SIZE, (unsigned int) KERNEL_BASE_phys);



CVS commit: src/sys/netinet6

2021-08-10 Thread Frank Kardel
Module Name:src
Committed By:   kardel
Date:   Tue Aug 10 06:29:56 UTC 2021

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

Log Message:
PR kern/56348
MTU discovery fails with IPv6 sockets bound to IPv4 mapped address

pick up the IPv4 route for IPv4 mapped IPv6 address to get the correct
MTU and not any unrelated/inappropriate MTU from IPv6 routes. IPv4 mapped
IPv6 addresses are always handled by the IPv4 stack and MTU discovery
is solely handled with the IPv4 routing table.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/netinet6/in6_src.c

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

Modified files:

Index: src/sys/netinet6/in6_src.c
diff -u src/sys/netinet6/in6_src.c:1.87 src/sys/netinet6/in6_src.c:1.88
--- src/sys/netinet6/in6_src.c:1.87	Fri Aug 28 06:32:24 2020
+++ src/sys/netinet6/in6_src.c	Tue Aug 10 06:29:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_src.c,v 1.87 2020/08/28 06:32:24 ozaki-r Exp $	*/
+/*	$NetBSD: in6_src.c,v 1.88 2021/08/10 06:29:56 kardel Exp $	*/
 /*	$KAME: in6_src.c,v 1.159 2005/10/19 01:40:32 t-momose Exp $	*/
 
 /*
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.87 2020/08/28 06:32:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_src.c,v 1.88 2021/08/10 06:29:56 kardel Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -612,6 +612,7 @@ in6_selectroute(struct sockaddr_in6 *dst
 	struct rtentry *rt = NULL;
 	union {
 		struct sockaddr		dst;
+		struct sockaddr_in	dst4;
 		struct sockaddr_in6	dst6;
 	} u;
 
@@ -679,9 +680,17 @@ in6_selectroute(struct sockaddr_in6 *dst
 	 * Use a cached route if it exists and is valid, else try to allocate
 	 * a new one.  Note that we should check the address family of the
 	 * cached destination, in case of sharing the cache with IPv4.
+	 *
+	 * for V4 mapped addresses we want to pick up the v4 route
+	 * see PR kern/56348
 	 */
-	u.dst6 = *dstsock;
-	u.dst6.sin6_scope_id = 0;
+	if (IN6_IS_ADDR_V4MAPPED(>sin6_addr)) {
+		in6_sin6_2_sin(, dstsock);
+	} else {
+		u.dst6 = *dstsock;
+		u.dst6.sin6_scope_id = 0;
+	}
+
 	rt = rtcache_lookup1(*ro, , 1);
 
 	if (rt == NULL)



CVS commit: src/sys

2021-08-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Aug  9 21:20:50 UTC 2021

Modified Files:
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/x86: xen_intr.c
src/sys/dev/ic: athrate-sample.c

Log Message:
s/alway /always/


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/ic/athrate-sample.c

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.154 src/sys/arch/x86/x86/intr.c:1.155
--- src/sys/arch/x86/x86/intr.c:1.154	Fri Feb 19 05:34:37 2021
+++ src/sys/arch/x86/x86/intr.c	Mon Aug  9 21:20:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.154 2021/02/19 05:34:37 knakahara Exp $	*/
+/*	$NetBSD: intr.c,v 1.155 2021/08/09 21:20:50 andvar Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.154 2021/02/19 05:34:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.155 2021/08/09 21:20:50 andvar Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -317,7 +317,7 @@ intr_create_intrid(int legacy_irq, struc
 	}
 
 	/*
-	 * If the device is pci, "legacy_irq" is alway -1. Least 8 bit of "ih"
+	 * If the device is pci, "legacy_irq" is always -1. Least 8 bit of "ih"
 	 * is only used in intr_string() to show the irq number.
 	 * If the device is "legacy"(such as floppy), it should not use
 	 * intr_string().

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.28 src/sys/arch/xen/x86/xen_intr.c:1.29
--- src/sys/arch/xen/x86/xen_intr.c:1.28	Sat Aug  1 12:39:40 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Mon Aug  9 21:20:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.28 2020/08/01 12:39:40 jdolecek Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.29 2021/08/09 21:20:50 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.28 2020/08/01 12:39:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.29 2021/08/09 21:20:50 andvar Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_pci.h"
@@ -465,7 +465,7 @@ xen_intr_create_intrid(int legacy_irq, s
 	}
 
 	/*
-	 * If the device is pci, "legacy_irq" is alway -1. Least 8 bit of "ih"
+	 * If the device is pci, "legacy_irq" is always -1. Least 8 bit of "ih"
 	 * is only used in intr_string() to show the irq number.
 	 * If the device is "legacy"(such as floppy), it should not use
 	 * intr_string().

Index: src/sys/dev/ic/athrate-sample.c
diff -u src/sys/dev/ic/athrate-sample.c:1.20 src/sys/dev/ic/athrate-sample.c:1.21
--- src/sys/dev/ic/athrate-sample.c:1.20	Sun Nov 10 21:16:35 2019
+++ src/sys/dev/ic/athrate-sample.c	Mon Aug  9 21:20:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: athrate-sample.c,v 1.20 2019/11/10 21:16:35 chs Exp $ */
+/*	$NetBSD: athrate-sample.c,v 1.21 2021/08/09 21:20:50 andvar Exp $ */
 
 /*-
  * Copyright (c) 2005 John Bicket
@@ -41,7 +41,7 @@
 __FBSDID("$FreeBSD: src/sys/dev/ath/ath_rate/sample/sample.c,v 1.9 2005/07/22 16:50:17 sam Exp $");
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.20 2019/11/10 21:16:35 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athrate-sample.c,v 1.21 2021/08/09 21:20:50 andvar Exp $");
 #endif
 
 
@@ -372,7 +372,7 @@ ath_rate_setupxtxdesc(struct ath_softc *
 	int size_bin = 0;
 	int ndx = 0;
 
-	size_bin = size_to_bin(frame_size);	// TODO: it's correct that frame_size alway 0 ?
+	size_bin = size_to_bin(frame_size);	// TODO: it's correct that frame_size always 0 ?
 	ndx = sn->current_rate[size_bin]; /* retry at the current bit-rate */
 	
 	if (!sn->stats[size_bin][ndx].packets_acked) {



CVS commit: src/sys/arch

2021-08-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Aug  9 21:13:06 UTC 2021

Modified Files:
src/sys/arch/amiga/dev: grf_rh.c
src/sys/arch/mips/include: cpuregs.h
src/sys/arch/mvme68k/dev: zsvar.h

Log Message:
s/definitons/definitions/


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/amiga/dev/grf_rh.c
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/mips/include/cpuregs.h
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/mvme68k/dev/zsvar.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/amiga/dev/grf_rh.c
diff -u src/sys/arch/amiga/dev/grf_rh.c:1.59 src/sys/arch/amiga/dev/grf_rh.c:1.60
--- src/sys/arch/amiga/dev/grf_rh.c:1.59	Sat Aug  7 16:18:41 2021
+++ src/sys/arch/amiga/dev/grf_rh.c	Mon Aug  9 21:13:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: grf_rh.c,v 1.59 2021/08/07 16:18:41 thorpej Exp $ */
+/*	$NetBSD: grf_rh.c,v 1.60 2021/08/09 21:13:05 andvar Exp $ */
 
 /*
  * Copyright (c) 1994 Markus Wild
@@ -34,7 +34,7 @@
 #include "opt_retina.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.59 2021/08/07 16:18:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: grf_rh.c,v 1.60 2021/08/09 21:13:05 andvar Exp $");
 
 #include "grfrh.h"
 #include "ite.h"
@@ -1221,7 +1221,7 @@ unsigned char RZ3StdPalette[16*3] = {
  * Make sure your maximum width (MW) and height (MH) are even multiples of
  * the fonts' width and height.
  *
- * You may use definitons created by the old DefineMonitor, but you'll get
+ * You may use definitions created by the old DefineMonitor, but you'll get
  * better results with the new DefineMonitor supplied along with the Retin Z3.
 */
 

Index: src/sys/arch/mips/include/cpuregs.h
diff -u src/sys/arch/mips/include/cpuregs.h:1.111 src/sys/arch/mips/include/cpuregs.h:1.112
--- src/sys/arch/mips/include/cpuregs.h:1.111	Sat May 29 12:35:27 2021
+++ src/sys/arch/mips/include/cpuregs.h	Mon Aug  9 21:13:05 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuregs.h,v 1.111 2021/05/29 12:35:27 simonb Exp $	*/
+/*	$NetBSD: cpuregs.h,v 1.112 2021/08/09 21:13:05 andvar Exp $	*/
 
 /*
  * Copyright (c) 2009 Miodrag Vallat.
@@ -273,7 +273,7 @@
 #define	MIPS_SR_INT_ENA_PREV	MIPS1_SR_INT_ENA_PREV
 
 /*
- * R4000 status register bit definitons,
+ * R4000 status register bit definitions,
  * where different from r2000/r3000.
  */
 #define	MIPS3_SR_XX		0x8000

Index: src/sys/arch/mvme68k/dev/zsvar.h
diff -u src/sys/arch/mvme68k/dev/zsvar.h:1.12 src/sys/arch/mvme68k/dev/zsvar.h:1.13
--- src/sys/arch/mvme68k/dev/zsvar.h:1.12	Mon Apr 28 20:23:29 2008
+++ src/sys/arch/mvme68k/dev/zsvar.h	Mon Aug  9 21:13:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: zsvar.h,v 1.12 2008/04/28 20:23:29 martin Exp $	*/
+/*	$NetBSD: zsvar.h,v 1.13 2021/08/09 21:13:06 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 /*
- * Non-exported definitons common to the different attachment
+ * Non-exported definitions common to the different attachment
  * types for the SCC on the Motorola MVME series of computers.
  */
 



CVS commit: src/sys

2021-08-09 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Mon Aug  9 21:08:06 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: iommu.c locore.s pmap.c
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/dev/pci: if_dge.c
src/sys/lib/libunwind: DwarfParser.hpp

Log Message:
s/aligment/alignment/ + one more typo fix in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/sparc/sparc/iommu.c
cvs rdiff -u -r1.280 -r1.281 src/sys/arch/sparc/sparc/locore.s
cvs rdiff -u -r1.374 -r1.375 src/sys/arch/sparc/sparc/pmap.c
cvs rdiff -u -r1.299 -r1.300 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/pci/if_dge.c
cvs rdiff -u -r1.6 -r1.7 src/sys/lib/libunwind/DwarfParser.hpp

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/sparc/iommu.c
diff -u src/sys/arch/sparc/sparc/iommu.c:1.99 src/sys/arch/sparc/sparc/iommu.c:1.100
--- src/sys/arch/sparc/sparc/iommu.c:1.99	Sat Aug  7 16:19:05 2021
+++ src/sys/arch/sparc/sparc/iommu.c	Mon Aug  9 21:08:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.99 2021/08/07 16:19:05 thorpej Exp $ */
+/*	$NetBSD: iommu.c,v 1.100 2021/08/09 21:08:06 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.99 2021/08/07 16:19:05 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iommu.c,v 1.100 2021/08/09 21:08:06 andvar Exp $");
 
 #include "opt_sparc_arch.h"
 
@@ -763,7 +763,7 @@ iommu_dmamem_map(bus_dma_tag_t t, bus_dm
 	/*
 	 * In case the segment has already been loaded by
 	 * iommu_dmamap_load_raw(), find a region of kernel virtual
-	 * addresses that can accommodate our aligment requirements.
+	 * addresses that can accommodate our alignment requirements.
 	 */
 	va = _bus_dma_valloc_skewed(size, 0, align,
 segs[0].ds_addr & (align - 1));

Index: src/sys/arch/sparc/sparc/locore.s
diff -u src/sys/arch/sparc/sparc/locore.s:1.280 src/sys/arch/sparc/sparc/locore.s:1.281
--- src/sys/arch/sparc/sparc/locore.s:1.280	Sun Apr 25 21:59:38 2021
+++ src/sys/arch/sparc/sparc/locore.s	Mon Aug  9 21:08:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.280 2021/04/25 21:59:38 mrg Exp $	*/
+/*	$NetBSD: locore.s,v 1.281 2021/08/09 21:08:06 andvar Exp $	*/
 
 /*
  * Copyright (c) 1996 Paul Kranenburg
@@ -356,7 +356,7 @@ sun4_notsup:
 	_C_LABEL(kernel_text) = start		! for kvm_mkdb(8)
 _ASM_LABEL(start):
 /*
- * Put sun4 traptable first, since it needs the most stringent aligment (8192)
+ * Put sun4 traptable first, since it needs the most stringent alignment (8192)
  */
 #if defined(SUN4)
 trapbase_sun4:

Index: src/sys/arch/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.374 src/sys/arch/sparc/sparc/pmap.c:1.375
--- src/sys/arch/sparc/sparc/pmap.c:1.374	Sat Aug  7 19:23:03 2021
+++ src/sys/arch/sparc/sparc/pmap.c	Mon Aug  9 21:08:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $ */
+/*	$NetBSD: pmap.c,v 1.375 2021/08/09 21:08:06 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375 2021/08/09 21:08:06 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -310,7 +310,7 @@ struct mmuentry region_freelist, region_
 #endif
 /*
  * We use a double linked list looping through its static head (which
- * alway remains on the list), so we can remove any other member from
+ * always remains on the list), so we can remove any other member from
  * a list without knowing which list it is on.
  */
 static void inline
@@ -3636,7 +3636,7 @@ pmap_bootstrap4m(void *top)
 
 	/*
 	 * Allocate context table.
-	 * To keep supersparc happy, minimum aligment is on a 4K boundary.
+	 * To keep supersparc happy, minimum alignment is on a 4K boundary.
 	 */
 	ctxtblsize = uimax(ncontext,1024) * sizeof(int);
 	cpuinfo.ctx_tbl = (int *)roundup((u_int)p, ctxtblsize);

Index: src/sys/arch/sparc64/sparc64/machdep.c
diff -u src/sys/arch/sparc64/sparc64/machdep.c:1.299 src/sys/arch/sparc64/sparc64/machdep.c:1.300
--- src/sys/arch/sparc64/sparc64/machdep.c:1.299	Mon Jan  4 14:48:52 2021
+++ src/sys/arch/sparc64/sparc64/machdep.c	Mon Aug  9 21:08:06 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.299 2021/01/04 14:48:52 thorpej Exp $ */
+/*	$NetBSD: machdep.c,v 1.300 2021/08/09 21:08:06 andvar Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2019 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.299 2021/01/04 14:48:52 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.300 2021/08/09 21:08:06 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1461,7 +1461,7 @@ _bus_dmamem_map(bus_dma_tag_t t, bus_dma
 
 	/*
 	 * Find a region of kernel virtual addresses that can accommodate
-	 * 

CVS commit: src/sys/arch/macppc/dev

2021-08-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Aug  9 04:07:29 UTC 2021

Added Files:
src/sys/arch/macppc/dev: smuiic.c smuiicvar.h

Log Message:
Fix CVS eff-up.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.10 src/sys/arch/macppc/dev/smuiic.c
cvs rdiff -u -r0 -r1.3 src/sys/arch/macppc/dev/smuiicvar.h

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

Added files:

Index: src/sys/arch/macppc/dev/smuiic.c
diff -u /dev/null src/sys/arch/macppc/dev/smuiic.c:1.10
--- /dev/null	Mon Aug  9 04:07:29 2021
+++ src/sys/arch/macppc/dev/smuiic.c	Mon Aug  9 04:07:29 2021
@@ -0,0 +1,135 @@
+/*	$NetBSD: smuiic.c,v 1.10 2021/08/09 04:07:29 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2013 Phileas Fogg
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+struct smuiic_softc {
+	device_t sc_dev;
+	int sc_node;
+	struct i2c_controller *sc_i2c;
+};
+
+static int smuiic_match(device_t, struct cfdata *, void *);
+static void smuiic_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(smuiic, sizeof(struct smuiic_softc),
+smuiic_match, smuiic_attach, NULL, NULL);
+
+static int
+smuiic_match(device_t parent, struct cfdata *cf, void *aux)
+{
+	struct smu_iicbus_confargs *ca = aux;
+
+	if (strcmp(ca->ca_name, "i2c-bus") == 0)
+		return 5;
+	if (strcmp(ca->ca_name, "i2c") == 0)
+		return 5;
+	
+	return 0;
+}
+
+static void
+smuiic_attach(device_t parent, device_t self, void *aux)
+{
+	struct smu_iicbus_confargs *ca = aux;
+	struct smuiic_softc *sc = device_private(self);
+	struct i2cbus_attach_args iba;
+	prop_dictionary_t dict = device_properties(self);
+	int devs, devc;
+	uint32_t addr;
+	char compat[256];
+	prop_array_t cfg;
+	prop_dictionary_t dev;
+	prop_data_t data;
+	char name[32], descr[32], num[8];
+
+	sc->sc_dev = self;
+	sc->sc_node = ca->ca_node;
+	sc->sc_i2c = ca->ca_tag;
+	printf("\n");
+
+	cfg = prop_array_create();
+	prop_dictionary_set(dict, "i2c-child-devices", cfg);
+	prop_object_release(cfg);
+
+	/* look for i2c devices */
+	devs = OF_child(sc->sc_node);
+	while (devs != 0) {
+		if (OF_getprop(devs, "name", name, 256) <= 0)
+			goto skip;
+		if (OF_getprop(devs, "compatible",
+		compat, 256) <= 0)
+			goto skip;
+		if (OF_getprop(devs, "reg", , 4) <= 0)
+			goto skip;
+		addr = (addr & 0xff) >> 1;
+		dev = prop_dictionary_create();
+		prop_dictionary_set_string(dev, "name", name);
+		data = prop_data_create_copy(compat, strlen(compat)+1);
+		prop_dictionary_set(dev, "compatible", data);
+		prop_object_release(data);
+		prop_dictionary_set_uint32(dev, "addr", addr);
+		prop_dictionary_set_uint64(dev, "cookie", devs);
+		devc = OF_child(devs);
+		while (devc != 0) {
+			int reg;
+			if (OF_getprop(devc, "reg", , 4) < 4) goto nope;
+			if (OF_getprop(devc, "location", descr, 32) <= 0)
+goto nope;
+			printf("found '%s' at %02x\n", descr, reg);
+			snprintf(num, 7, "s%02x", reg);
+			prop_dictionary_set_string(dev, num, descr);
+		nope:
+			devc = OF_peer(devc);
+		}
+		prop_array_add(cfg, dev);
+		prop_object_release(dev);
+	skip:
+		devs = OF_peer(devs);
+	}
+
+	memset(, 0, sizeof(iba));
+	iba.iba_tag = sc->sc_i2c;
+
+	config_found(sc->sc_dev, , iicbus_print, CFARGS_NONE);
+}

Index: src/sys/arch/macppc/dev/smuiicvar.h
diff -u /dev/null src/sys/arch/macppc/dev/smuiicvar.h:1.3
--- /dev/null	Mon Aug  9 04:07:29 2021
+++ src/sys/arch/macppc/dev/smuiicvar.h	Mon Aug  9 04:07:29 2021
@@ -0,0 +1,38 @@
+/*-
+ * Copyright (c) 2013 Phileas Fogg
+ * All rights reserved.
+ *
+ * 

CVS commit: src/sys/dev/acpi

2021-08-08 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Aug  9 04:06:21 UTC 2021

Added Files:
src/sys/dev/acpi: acpi_i2c.h

Log Message:
Fix CVS eff-up.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4 src/sys/dev/acpi/acpi_i2c.h

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

Added files:

Index: src/sys/dev/acpi/acpi_i2c.h
diff -u /dev/null src/sys/dev/acpi/acpi_i2c.h:1.4
--- /dev/null	Mon Aug  9 04:06:21 2021
+++ src/sys/dev/acpi/acpi_i2c.h	Mon Aug  9 04:06:21 2021
@@ -0,0 +1,38 @@
+/* $NetBSD: acpi_i2c.h,v 1.4 2021/08/09 04:06:21 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2017 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Manuel Bouyer.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef _SYS_DEV_ACPI_ACPI_I2C_H
+#define _SYS_DEV_ACPI_ACPI_I2C_H
+#include 
+
+prop_array_t acpi_enter_i2c_devs(device_t, struct acpi_devnode *);
+#endif /*  _SYS_DEV_ACPI_ACPI_I2C_H */



CVS commit: src/sys/modules/lua

2021-08-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun Aug  8 22:26:32 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Fix LIST operations, found by strictly-aligned CPUs, i.e., ARMv5 and IBM403:
- Initialize LIST_HEAD.
- Use LIST_FOREACH_SAFE() where necessary.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.26 src/sys/modules/lua/lua.c:1.27
--- src/sys/modules/lua/lua.c:1.26	Sat Aug  7 04:19:31 2021
+++ src/sys/modules/lua/lua.c	Sun Aug  8 22:26:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.26 2021/08/07 04:19:31 rin Exp $ */
+/*	$NetBSD: lua.c,v 1.27 2021/08/08 22:26:32 rin Exp $ */
 
 /*
  * Copyright (c) 2011 - 2017 by Marc Balmer .
@@ -74,8 +74,10 @@ static bool	lua_bytecode_on = false;
 static int	lua_verbose;
 static int	lua_max_instr;
 
-static LIST_HEAD(, lua_state)	lua_states;
-static LIST_HEAD(, lua_module)	lua_modules;
+static LIST_HEAD(, lua_state)	lua_states =
+LIST_HEAD_INITIALIZER(lua_states);
+static LIST_HEAD(, lua_module)	lua_modules =
+LIST_HEAD_INITIALIZER(lua_modules);
 
 static int lua_match(device_t, cfdata_t, void *);
 static void lua_attach(device_t, device_t, void *);
@@ -723,7 +725,7 @@ kluaL_newstate(const char *name, const c
 void
 klua_close(klua_State *K)
 {
-	struct lua_state *s;
+	struct lua_state *s, *ns;
 	struct lua_softc *sc;
 	struct lua_module *m;
 	int error = 0;
@@ -747,7 +749,7 @@ klua_close(klua_State *K)
 	if (error)
 		return;		/* Nothing we can do... */
 
-	LIST_FOREACH(s, _states, lua_next)
+	LIST_FOREACH_SAFE(s, _states, lua_next, ns)
 		if (s->K == K) {
 			LIST_REMOVE(s, lua_next);
 			LIST_FOREACH(m, >lua_modules, mod_next)



CVS commit: src/sys/dev/raidframe

2021-08-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  8 21:45:53 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_parityscan.c

Log Message:
s/arry/array/


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_parityscan.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/raidframe/rf_parityscan.c
diff -u src/sys/dev/raidframe/rf_parityscan.c:1.37 src/sys/dev/raidframe/rf_parityscan.c:1.38
--- src/sys/dev/raidframe/rf_parityscan.c:1.37	Fri Jul 23 00:54:45 2021
+++ src/sys/dev/raidframe/rf_parityscan.c	Sun Aug  8 21:45:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $	*/
+/*	$NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $");
 
 #include 
 
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_paritysca
 
 /*
  *
- * walk through the entire arry and write new parity.  This works by
+ * walk through the entire array and write new parity.  This works by
  * creating two DAGs, one to read a stripe of data and one to write
  * new parity.  The first is executed, the data is xored together, and
  * then the second is executed.  To avoid constantly building and



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

2021-08-08 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sun Aug  8 20:57:09 UTC 2021

Modified Files:
src/sys/dev/pci/cxgb: cxgb_offload.c

Log Message:
s/propely/properly/


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/cxgb/cxgb_offload.c

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

Modified files:

Index: src/sys/dev/pci/cxgb/cxgb_offload.c
diff -u src/sys/dev/pci/cxgb/cxgb_offload.c:1.6 src/sys/dev/pci/cxgb/cxgb_offload.c:1.7
--- src/sys/dev/pci/cxgb/cxgb_offload.c:1.6	Fri Dec 27 09:22:20 2019
+++ src/sys/dev/pci/cxgb/cxgb_offload.c	Sun Aug  8 20:57:09 2021
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.6 2019/12/27 09:22:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.7 2021/08/08 20:57:09 andvar Exp $");
 
 #include 
 #include 
@@ -516,7 +516,7 @@ cxgb_insert_tid(struct toedev *tdev, str
 }
 
 /*
- * Populate a TID_RELEASE WR.  The mbuf must be already propely sized.
+ * Populate a TID_RELEASE WR.  The mbuf must be already properly sized.
  */
 static inline void
 mk_tid_release(struct mbuf *m, unsigned int tid)



CVS commit: src/sys/modules/examples

2021-08-08 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Aug  8 20:55:33 UTC 2021

Modified Files:
src/sys/modules/examples: Makefile

Log Message:
Add ddbping example module to SUBDIR list.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/modules/examples/Makefile

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

Modified files:

Index: src/sys/modules/examples/Makefile
diff -u src/sys/modules/examples/Makefile:1.11 src/sys/modules/examples/Makefile:1.12
--- src/sys/modules/examples/Makefile:1.11	Thu Apr 30 00:48:10 2020
+++ src/sys/modules/examples/Makefile	Sun Aug  8 20:55:33 2021
@@ -1,8 +1,9 @@
-#	$NetBSD: Makefile,v 1.11 2020/04/30 00:48:10 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2021/08/08 20:55:33 uwe Exp $
 
 .include 
 
 SUBDIR+=	current_time
+SUBDIR+=	ddbping
 SUBDIR+=	executor
 SUBDIR+=	fopsmapper		# Needs an additional helper program
 SUBDIR+=	hello



CVS commit: src/sys/arch

2021-08-08 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Aug  8 19:28:09 UTC 2021

Modified Files:
src/sys/arch/aarch64/include: cpu.h
src/sys/arch/arm/include: cpu.h
src/sys/arch/arm/pic: pic.c

Log Message:
Re-apply

Move 'struct pic_pending' from percpu to struct cpu_info. Saves a few
instructions in splx.

There is(/was) no need to use atomic operations on the percpu / cpu_info
members, so don't.

Finally removng the use of percpu should help avoid problems with "late"
attaching cpus.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/arm/include/cpu.h
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/arm/pic/pic.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/include/cpu.h
diff -u src/sys/arch/aarch64/include/cpu.h:1.36 src/sys/arch/aarch64/include/cpu.h:1.37
--- src/sys/arch/aarch64/include/cpu.h:1.36	Sat May 29 06:54:20 2021
+++ src/sys/arch/aarch64/include/cpu.h	Sun Aug  8 19:28:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.36 2021/05/29 06:54:20 skrll Exp $ */
+/* $NetBSD: cpu.h,v 1.37 2021/08/08 19:28:08 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -104,6 +104,9 @@ struct cpu_info {
 	int ci_hwpl;		/* current hardware priority */
 	volatile u_int ci_softints;
 	volatile u_int ci_intr_depth;
+	volatile uint32_t ci_blocked_pics;
+	volatile uint32_t ci_pending_pics;
+	volatile uint32_t ci_pending_ipls;
 
 	int ci_kfpu_spl;
 

Index: src/sys/arch/arm/include/cpu.h
diff -u src/sys/arch/arm/include/cpu.h:1.117 src/sys/arch/arm/include/cpu.h:1.118
--- src/sys/arch/arm/include/cpu.h:1.117	Sat Mar 27 12:15:08 2021
+++ src/sys/arch/arm/include/cpu.h	Sun Aug  8 19:28:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.117 2021/03/27 12:15:08 jmcneill Exp $	*/
+/*	$NetBSD: cpu.h,v 1.118 2021/08/08 19:28:08 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1996 Mark Brinicombe.
@@ -190,6 +190,9 @@ struct cpu_info {
 
 	volatile u_int	ci_intr_depth;	/* */
 	volatile u_int	ci_softints;
+	volatile uint32_t ci_blocked_pics;
+	volatile uint32_t ci_pending_pics;
+	volatile uint32_t ci_pending_ipls;
 
 	lwp_t *		ci_lastlwp;	/* last lwp */
 

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.70 src/sys/arch/arm/pic/pic.c:1.71
--- src/sys/arch/arm/pic/pic.c:1.70	Sat Mar 27 12:15:09 2021
+++ src/sys/arch/arm/pic/pic.c	Sun Aug  8 19:28:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.70 2021/03/27 12:15:09 jmcneill Exp $	*/
+/*	$NetBSD: pic.c,v 1.71 2021/08/08 19:28:08 skrll Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -33,7 +33,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.70 2021/03/27 12:15:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.71 2021/08/08 19:28:08 skrll Exp $");
 
 #include 
 #include 
@@ -65,37 +65,15 @@ __KERNEL_RCSID(0, "$NetBSD: pic.c,v 1.70
  * come from the same CPU.  In other words, interrupts from a single PIC will
  * not be distributed among multiple CPUs.
  */
-struct pic_pending {
-	volatile uint32_t blocked_pics;
-	volatile uint32_t pending_pics;
-	volatile uint32_t pending_ipls;
-};
 static uint32_t
 	pic_find_pending_irqs_by_ipl(struct pic_softc *, size_t, uint32_t, int);
 static struct pic_softc *
-	pic_list_find_pic_by_pending_ipl(struct pic_pending *, uint32_t);
+	pic_list_find_pic_by_pending_ipl(struct cpu_info *, uint32_t);
 static void
-	pic_deliver_irqs(struct pic_pending *, struct pic_softc *, int, void *);
+	pic_deliver_irqs(struct cpu_info *, struct pic_softc *, int, void *);
 static void
-	pic_list_deliver_irqs(struct pic_pending *, register_t, int, void *);
+	pic_list_deliver_irqs(struct cpu_info *, register_t, int, void *);
 
-#ifdef MULTIPROCESSOR
-percpu_t *pic_pending_percpu;
-static struct pic_pending *
-pic_pending_get(void)
-{
-	return percpu_getref(pic_pending_percpu);
-}
-static void
-pic_pending_put(struct pic_pending *pend)
-{
-	percpu_putref(pic_pending_percpu);
-}
-#else
-struct pic_pending pic_pending;
-#define	pic_pending_get()	(_pending)
-#define	pic_pending_put(pend)	__nothing
-#endif /* MULTIPROCESSOR */
 #endif /* __HAVE_PIC_PENDING_INTRS */
 
 struct pic_softc *pic_list[PIC_MAXPICS];
@@ -264,15 +242,14 @@ void
 pic_mark_pending_source(struct pic_softc *pic, struct intrsource *is)
 {
 	const uint32_t ipl_mask = __BIT(is->is_ipl);
+	struct cpu_info * const ci = curcpu();
 
 	atomic_or_32(>pic_pending_irqs[is->is_irq >> 5],
 	__BIT(is->is_irq & 0x1f));
 
 	atomic_or_32(>pic_pending_ipls, ipl_mask);
-	struct pic_pending *pend = pic_pending_get();
-	atomic_or_32(>pending_ipls, ipl_mask);
-	atomic_or_32(>pending_pics, __BIT(pic->pic_id));
-	pic_pending_put(pend);
+	ci->ci_pending_ipls |= ipl_mask;
+	ci->ci_pending_pics |= __BIT(pic->pic_id);
 }
 
 void
@@ -288,9 +265,10 @@ 

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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 18:55:12 UTC 2021

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

Log Message:
Adjust register base and size


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_com_acpi.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_com_acpi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_com_acpi.c:1.1 src/sys/arch/arm/broadcom/bcm2835_com_acpi.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_com_acpi.c:1.1	Sun Aug  8 18:43:21 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com_acpi.c	Sun Aug  8 18:55:12 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_com_acpi.c,v 1.1 2021/08/08 18:43:21 jmcneill Exp $ */
+/* $NetBSD: bcm2835_com_acpi.c,v 1.2 2021/08/08 18:55:12 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2021 Jared McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_com_acpi.c,v 1.1 2021/08/08 18:43:21 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com_acpi.c,v 1.2 2021/08/08 18:55:12 jmcneill Exp $");
 
 #include 
 #include 
@@ -100,8 +100,8 @@ bcmcom_acpi_attach(device_t parent, devi
 	}
 
 	iot = aa->aa_memt;
-	base = mem->ar_base;
-	size = mem->ar_length;
+	base = mem->ar_base + 0x40;
+	size = mem->ar_length - 0x40;
 
 	irq = acpi_res_irq(, 0);
 	if (irq == NULL) {



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 18:43:21 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: files.bcm2835
Added Files:
src/sys/arch/arm/broadcom: bcm2835_com_acpi.c

Log Message:
broadcom: ACPI: Add support for mini UART in ACPI mode.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/broadcom/bcm2835_com_acpi.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/arm/broadcom/files.bcm2835

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/files.bcm2835
diff -u src/sys/arch/arm/broadcom/files.bcm2835:1.41 src/sys/arch/arm/broadcom/files.bcm2835:1.42
--- src/sys/arch/arm/broadcom/files.bcm2835:1.41	Sun Aug  8 10:32:26 2021
+++ src/sys/arch/arm/broadcom/files.bcm2835	Sun Aug  8 18:43:21 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.bcm2835,v 1.41 2021/08/08 10:32:26 jmcneill Exp $
+#	$NetBSD: files.bcm2835,v 1.42 2021/08/08 18:43:21 jmcneill Exp $
 #
 # Configuration info for Broadcom BCM2835 ARM Peripherals
 #
@@ -60,6 +60,11 @@ file	arch/arm/broadcom/bcm2835_aux.c		bc
 attach	com at fdt with bcmcom
 file	arch/arm/broadcom/bcm2835_com.c		bcmcom
 
+ifdef acpinodebus
+attach	com at acpinodebus with bcmcom_acpi
+file	arch/arm/broadcom/bcm2835_com_acpi.c	bcmcom_acpi
+endif
+
 # External Mass Media Controller (BCM2835_EMMC_BASE)
 attach	sdhc at fdt with bcmemmc
 file	arch/arm/broadcom/bcm2835_emmc.c	bcmemmc

Added files:

Index: src/sys/arch/arm/broadcom/bcm2835_com_acpi.c
diff -u /dev/null src/sys/arch/arm/broadcom/bcm2835_com_acpi.c:1.1
--- /dev/null	Sun Aug  8 18:43:21 2021
+++ src/sys/arch/arm/broadcom/bcm2835_com_acpi.c	Sun Aug  8 18:43:21 2021
@@ -0,0 +1,168 @@
+/* $NetBSD: bcm2835_com_acpi.c,v 1.1 2021/08/08 18:43:21 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2021 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_com_acpi.c,v 1.1 2021/08/08 18:43:21 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+static int	bcmcom_acpi_match(device_t, cfdata_t , void *);
+static void	bcmcom_acpi_attach(device_t, device_t, void *);
+
+static u_int	bcmcom_acpi_get_clockrate(device_t);
+
+struct vcmbox_clockrate_request {
+	struct vcprop_buffer_hdr	vb_hdr;
+	struct vcprop_tag_clockrate	vbt_clockrate;
+	struct vcprop_tag end;
+} __packed;
+
+CFATTACH_DECL_NEW(bcmcom_acpi, sizeof(struct com_softc), bcmcom_acpi_match,
+bcmcom_acpi_attach, NULL, NULL);
+
+static const struct device_compatible_entry compat_data[] = {
+	{ .compat = "BCM2836",		.value = COM_TYPE_BCMAUXUART },
+	DEVICE_COMPAT_EOL
+};
+
+static int
+bcmcom_acpi_match(device_t parent, cfdata_t match, void *aux)
+{
+	struct acpi_attach_args *aa = aux;
+
+	return acpi_compatible_match(aa, compat_data);
+}
+
+static void
+bcmcom_acpi_attach(device_t parent, device_t self, void *aux)
+{
+	struct com_softc *sc = device_private(self);
+	struct acpi_attach_args *aa = aux;
+	const struct device_compatible_entry *dce;
+	struct acpi_resources res;
+	struct acpi_mem *mem;
+	struct acpi_irq *irq;
+	bus_space_tag_t iot;
+	bus_space_handle_t ioh;
+	bus_addr_t base;
+	bus_size_t size;
+	ACPI_STATUS rv;
+	void *ih;
+
+	sc->sc_dev = self;
+
+	rv = acpi_resource_parse(sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
+	, _resource_parse_ops_default);
+	if (ACPI_FAILURE(rv)) {
+		return;
+	}
+
+	mem = acpi_res_mem(, 0);
+	if (mem == NULL) {
+		aprint_error_dev(self, "couldn't find mem resource\n");
+		goto cleanup;
+	}
+
+	iot = aa->aa_memt;
+	base = mem->ar_base;
+	size = mem->ar_length;
+
+	irq = acpi_res_irq(, 0);
+	if (irq == NULL) {
+		aprint_error_dev(self, "couldn't find irq resource\n");
+	

CVS commit: src/sys/dev/sdmmc

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 16:23:37 UTC 2021

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.h

Log Message:
Fixup bwfm(4) register bit regarding SDIO device suspend/resume.

>From OpenBSD if_bwfm_sdio.h r1.3


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.h
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.h:1.2 src/sys/dev/sdmmc/if_bwfm_sdio.h:1.3
--- src/sys/dev/sdmmc/if_bwfm_sdio.h:1.2	Thu Oct  3 10:53:34 2019
+++ src/sys/dev/sdmmc/if_bwfm_sdio.h	Sun Aug  8 16:23:37 2021
@@ -79,7 +79,7 @@
 #define  BWFM_SDIO_FUNC1_WAKEUPCTRL_HTWAIT		(1 << 1)
 #define BWFM_SDIO_FUNC1_SLEEPCSR		0x1001F
 #define  BWFM_SDIO_FUNC1_SLEEPCSR_KSO		(1 << 0)
-#define  BWFM_SDIO_FUNC1_SLEEPCSR_DEVON		(1 << 2)
+#define  BWFM_SDIO_FUNC1_SLEEPCSR_DEVON		(1 << 1)
 
 #define BWFM_SDIO_SB_OFT_ADDR_PAGE		0x08000
 #define BWFM_SDIO_SB_OFT_ADDR_MASK		0x07FFF



CVS commit: src/sys/dev/fdt

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 15:23:42 UTC 2021

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

Log Message:
fdt: regulator: pre-allocate regulator handle

Workaround for PR# port-evbarm/54664


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_regulator.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_regulator.c
diff -u src/sys/dev/fdt/fdt_regulator.c:1.8 src/sys/dev/fdt/fdt_regulator.c:1.9
--- src/sys/dev/fdt/fdt_regulator.c:1.8	Mon May 27 23:18:33 2019
+++ src/sys/dev/fdt/fdt_regulator.c	Sun Aug  8 15:23:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $ */
+/* $NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $");
 
 #include 
 #include 
@@ -37,6 +37,9 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_regulato
 #include 
 #include 
 
+#define	REGULATOR_TO_RC(_reg)	\
+	container_of((_reg), struct fdtbus_regulator_controller, rc_reg)
+
 struct fdtbus_regulator_controller {
 	device_t rc_dev;
 	int rc_phandle;
@@ -44,6 +47,8 @@ struct fdtbus_regulator_controller {
 
 	u_int rc_enable_ramp_delay;
 
+	struct fdtbus_regulator rc_reg;	/* handle returned by acquire() */
+
 	LIST_ENTRY(fdtbus_regulator_controller) rc_next;
 };
 
@@ -60,6 +65,7 @@ fdtbus_register_regulator_controller(dev
 	rc->rc_dev = dev;
 	rc->rc_phandle = phandle;
 	rc->rc_funcs = funcs;
+	rc->rc_reg.reg_rc = rc;
 
 	of_getprop_uint32(phandle, "regulator-enable-ramp-delay", >rc_enable_ramp_delay);
 
@@ -85,7 +91,6 @@ struct fdtbus_regulator *
 fdtbus_regulator_acquire(int phandle, const char *prop)
 {
 	struct fdtbus_regulator_controller *rc;
-	struct fdtbus_regulator *reg;
 	int regulator_phandle;
 	int error;
 
@@ -105,26 +110,21 @@ fdtbus_regulator_acquire(int phandle, co
 		return NULL;
 	}
 
-	reg = kmem_alloc(sizeof(*reg), KM_SLEEP);
-	reg->reg_rc = rc;
-
-	return reg;
+	return >rc_reg;
 }
 
 void
 fdtbus_regulator_release(struct fdtbus_regulator *reg)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 
 	rc->rc_funcs->release(rc->rc_dev);
-
-	kmem_free(reg, sizeof(*reg));
 }
 
 int
 fdtbus_regulator_enable(struct fdtbus_regulator *reg)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 	int error;
 
 	error = rc->rc_funcs->enable(rc->rc_dev, true);
@@ -140,7 +140,7 @@ fdtbus_regulator_enable(struct fdtbus_re
 int
 fdtbus_regulator_disable(struct fdtbus_regulator *reg)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 
 	if (of_hasprop(rc->rc_phandle, "regulator-always-on"))
 		return EIO;
@@ -152,7 +152,7 @@ int
 fdtbus_regulator_set_voltage(struct fdtbus_regulator *reg, u_int min_uvol,
 u_int max_uvol)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 
 	if (rc->rc_funcs->set_voltage == NULL)
 		return EINVAL;
@@ -163,7 +163,7 @@ fdtbus_regulator_set_voltage(struct fdtb
 int
 fdtbus_regulator_get_voltage(struct fdtbus_regulator *reg, u_int *puvol)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 
 	if (rc->rc_funcs->get_voltage == NULL)
 		return EINVAL;
@@ -175,7 +175,7 @@ int
 fdtbus_regulator_supports_voltage(struct fdtbus_regulator *reg, u_int min_uvol,
 u_int max_uvol)
 {
-	struct fdtbus_regulator_controller *rc = reg->reg_rc;
+	struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg);
 	u_int uvol;
 
 	if (rc->rc_funcs->set_voltage == NULL)



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 13:43:09 UTC 2021

Modified Files:
src/sys/arch/arm/arm: smccc.c

Log Message:
fix armv7 build


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

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

Modified files:

Index: src/sys/arch/arm/arm/smccc.c
diff -u src/sys/arch/arm/arm/smccc.c:1.2 src/sys/arch/arm/arm/smccc.c:1.3
--- src/sys/arch/arm/arm/smccc.c:1.2	Sat Aug  7 21:21:49 2021
+++ src/sys/arch/arm/arm/smccc.c	Sun Aug  8 13:43:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: smccc.c,v 1.2 2021/08/07 21:21:49 jmcneill Exp $ */
+/* $NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.2 2021/08/07 21:21:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.3 2021/08/08 13:43:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -35,6 +35,12 @@ __KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.
 #include 
 #include 
 
+#if defined(__arm__)
+#define	SMCCC_ARCH_ATTRIBUTE  __attribute__ ((target("arch=armv7ve")))
+#else
+#define	SMCCC_ARCH_ATTRIBUTE
+#endif
+
 /* Minimum supported PSCI version for SMCCC discovery */
 #define	PSCI_VERSION_1_0	0x1
 
@@ -89,7 +95,7 @@ smccc_version(void)
  *
  *	Generic call interface for SMC/HVC calls.
  */
-int
+SMCCC_ARCH_ATTRIBUTE int
 smccc_call(uint32_t fid,
 register_t arg1, register_t arg2, register_t arg3, register_t arg4,
 register_t *res0, register_t *res1, register_t *res2, register_t *res3)



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 12:31:43 UTC 2021

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

Log Message:
Enable options PCI_SMCCC on 64-bit Arm.


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.generic64
diff -u src/sys/arch/evbarm/conf/std.generic64:1.13 src/sys/arch/evbarm/conf/std.generic64:1.14
--- src/sys/arch/evbarm/conf/std.generic64:1.13	Tue Sep  8 17:39:04 2020
+++ src/sys/arch/evbarm/conf/std.generic64	Sun Aug  8 12:31:42 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: std.generic64,v 1.13 2020/09/08 17:39:04 jakllsch Exp $
+#	$NetBSD: std.generic64,v 1.14 2021/08/08 12:31:42 jmcneill Exp $
 #
 #	generic NetBSD/evbarm64 with FDT support
 
@@ -19,6 +19,7 @@ options 	FPU_VFP
 options 	MODULAR
 options 	MODULAR_DEFAULT_AUTOLOAD
 options 	PCI_NETBSD_CONFIGURE
+options 	PCI_SMCCC		# Arm PCI Conf Access Firmware Interface
 options 	_ARM32_NEED_BUS_DMA_BOUNCE
 options 	__HAVE_GENERIC_CPU_INITCLOCKS
 options 	__HAVE_PCI_CONF_HOOK



CVS commit: src/sys/dev/pci

2021-08-08 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  8 12:17:37 UTC 2021

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

Log Message:
radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping

Makes the driver work on cia(4) based alpha machines, which can only
do dense access to linear mappings with prefetch. ok macallan@


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.c

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

Modified files:

Index: src/sys/dev/pci/radeonfb.c
diff -u src/sys/dev/pci/radeonfb.c:1.116 src/sys/dev/pci/radeonfb.c:1.117
--- src/sys/dev/pci/radeonfb.c:1.116	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/radeonfb.c	Sun Aug  8 12:17:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $ */
+/*	$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $");
 
 #include 
 #include 
@@ -799,7 +799,8 @@ radeonfb_attach(device_t parent, device_
 
 	sc->sc_memt = pa->pa_memt;
 	if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 		sc->sc_memsz = 0;
 		aprint_error("%s: Unable to map frame buffer\n", XNAME(sc));
 		goto error;
@@ -1098,7 +1099,8 @@ radeonfb_map(struct radeonfb_softc *sc)
 			return;
 		}
 		if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz,
-		BUS_SPACE_MAP_LINEAR, >sc_memh) != 0) {
+		BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE,
+		>sc_memh) != 0) {
 			sc->sc_memsz = 0;
 			aprint_error_dev(sc->sc_dev,
 			"Unable to map frame buffer\n");



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 12:09:52 UTC 2021

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

Log Message:
Install the shared PCI INTx interrupt handler at IPL_VM to workaround a
possible interrupt storm at boot. Need to revisit this.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/acpi/acpi_pci_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_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.19 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.20
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.19	Sat Aug  7 21:27:53 2021
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Sun Aug  8 12:09:52 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.19 2021/08/07 21:27:53 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.20 2021/08/08 12:09:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.19 2021/08/07 21:27:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.20 2021/08/08 12:09:52 jmcneill Exp $");
 
 #include 
 #include 
@@ -536,7 +536,7 @@ acpi_pci_md_intr_establish(void *v, pci_
 		pi->pi_pic.pic_ops = _pci_pic_ops;
 		pi->pi_irqbase = pic_add(>pi_pic, PIC_IRQBASE_ALLOC);
 		TAILQ_INSERT_TAIL(_pci_intrs, pi, pi_list);
-		pi->pi_ih = intr_establish_xname(irq, IPL_SCHED, IST_LEVEL | IST_MPSAFE,
+		pi->pi_ih = intr_establish_xname(irq, IPL_VM, IST_LEVEL | IST_MPSAFE,
 		pic_handle_intr, >pi_pic, device_xname(ap->ap_dev));
 	}
 	if (pi->pi_ih == NULL)



CVS commit: src/sys/dev/sdmmc

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 11:11:29 UTC 2021

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
Use SMBIOS system product instead of the string "netbsd,generic-acpi"
for firmware loading on ACPI systems.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.26 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.27
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.26	Mon Jun 21 03:17:59 2021
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sun Aug  8 11:11:29 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.26 2021/06/21 03:17:59 christos Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.27 2021/08/08 11:11:29 jmcneill Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -592,10 +592,17 @@ bwfm_fdt_find_phandle(device_t self, dev
 static const char *
 bwfm_fdt_get_model(void)
 {
+	const char *model;
 	int phandle;
 
 	phandle = OF_finddevice("/");
-	return fdtbus_get_string_index(phandle, "compatible", 0);
+	model = fdtbus_get_string_index(phandle, "compatible", 0);
+	if (model == NULL ||
+	(model != NULL && strcmp(model, "netbsd,generic-acpi") == 0)) {
+		model = pmf_get_platform("system-product");
+	}
+
+	return model;
 }
 
 static int



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 10:59:27 UTC 2021

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

Log Message:
disable DMA for now...


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c
diff -u src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c:1.1 src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c:1.2
--- src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c:1.1	Sun Aug  8 10:32:26 2021
+++ src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c	Sun Aug  8 10:59:27 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2838_emmc2_acpi.c,v 1.1 2021/08/08 10:32:26 jmcneill Exp $	*/
+/*	$NetBSD: bcm2838_emmc2_acpi.c,v 1.2 2021/08/08 10:59:27 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 2021 Jared McNeill 
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2838_emmc2_acpi.c,v 1.1 2021/08/08 10:32:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2838_emmc2_acpi.c,v 1.2 2021/08/08 10:59:27 jmcneill Exp $");
 
 #include 
 #include 
@@ -119,8 +119,10 @@ bcmemmc2_acpi_attach(device_t parent, de
 	 * disable UHS modes.
 	 */
 	sc->sc.sc_flags = SDHC_FLAG_32BIT_ACCESS |
+#if notyet
 			  SDHC_FLAG_USE_DMA |
 			  SDHC_FLAG_USE_ADMA2 |
+#endif
 			  SDHC_FLAG_NO_1_8_V;
 
 	sc->sc_ih = acpi_intr_establish(self,



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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 10:32:27 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: files.bcm2835
Added Files:
src/sys/arch/arm/broadcom: bcm2838_emmc2_acpi.c

Log Message:
bcm2838: Add ACPI support for the EMMC2 SDHCI controller.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/broadcom/files.bcm2835

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/files.bcm2835
diff -u src/sys/arch/arm/broadcom/files.bcm2835:1.40 src/sys/arch/arm/broadcom/files.bcm2835:1.41
--- src/sys/arch/arm/broadcom/files.bcm2835:1.40	Wed Mar 10 11:03:48 2021
+++ src/sys/arch/arm/broadcom/files.bcm2835	Sun Aug  8 10:32:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.bcm2835,v 1.40 2021/03/10 11:03:48 mlelstv Exp $
+#	$NetBSD: files.bcm2835,v 1.41 2021/08/08 10:32:26 jmcneill Exp $
 #
 # Configuration info for Broadcom BCM2835 ARM Peripherals
 #
@@ -67,6 +67,8 @@ file	arch/arm/broadcom/bcm2835_emmc.c	bc
 ifdef acpinodebus
 attach	sdhc at acpinodebus with bcmemmc_acpi
 file	arch/arm/broadcom/bcm2835_emmc_acpi.c	bcmemmc_acpi
+attach	sdhc at acpinodebus with bcmemmc2_acpi
+file	arch/arm/broadcom/bcm2838_emmc2_acpi.c	bcmemmc2_acpi
 endif
 
 # SD Host Controller (BCM2835_SDHOST_BASE)

Added files:

Index: src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c
diff -u /dev/null src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c:1.1
--- /dev/null	Sun Aug  8 10:32:27 2021
+++ src/sys/arch/arm/broadcom/bcm2838_emmc2_acpi.c	Sun Aug  8 10:32:26 2021
@@ -0,0 +1,164 @@
+/*	$NetBSD: bcm2838_emmc2_acpi.c,v 1.1 2021/08/08 10:32:26 jmcneill Exp $	*/
+
+/*
+ * Copyright (c) 2021 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: bcm2838_emmc2_acpi.c,v 1.1 2021/08/08 10:32:26 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define _COMPONENT	ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME	("bcmemmc2_acpi")
+
+static int	bcmemmc2_acpi_match(device_t, cfdata_t, void *);
+static void	bcmemmc2_acpi_attach(device_t, device_t, void *);
+static void	bcmemmc2_acpi_attach1(device_t);
+
+static const char * const compatible[] = {
+	"BRCME88C",
+	NULL
+};
+
+struct bcmemmc2_acpi_softc {
+	struct sdhc_softc sc;
+	bus_space_tag_t sc_memt;
+	bus_space_handle_t sc_memh;
+	bus_size_t sc_memsize;
+	void *sc_ih;
+	struct sdhc_host *sc_hosts[1];
+};
+
+CFATTACH_DECL_NEW(bcmemmc2_acpi, sizeof(struct bcmemmc2_acpi_softc),
+bcmemmc2_acpi_match, bcmemmc2_acpi_attach, NULL, NULL);
+
+static int
+bcmemmc2_acpi_match(device_t parent, cfdata_t match, void *opaque)
+{
+	struct acpi_attach_args *aa = opaque;
+
+	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
+		return 0;
+
+	return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+}
+
+static void
+bcmemmc2_acpi_attach(device_t parent, device_t self, void *opaque)
+{
+	struct bcmemmc2_acpi_softc *sc = device_private(self);
+	struct acpi_attach_args *aa = opaque;
+	struct acpi_resources res;
+	struct acpi_mem *mem;
+	struct acpi_irq *irq;
+	ACPI_STATUS rv;
+
+	sc->sc.sc_dev = self;
+	sc->sc.sc_dmat = aa->aa_dmat;
+	sc->sc.sc_host = sc->sc_hosts;
+	sc->sc_memt = aa->aa_memt;
+
+	rv = acpi_resource_parse(self, aa->aa_node->ad_handle, "_CRS",
+	, _resource_parse_ops_default);
+	if (ACPI_FAILURE(rv))
+		return;
+
+	mem = acpi_res_mem(, 0);
+	irq = acpi_res_irq(, 0);
+	if (mem == NULL || irq == NULL) {
+		aprint_error_dev(self, "incomplete resources\n");
+		goto cleanup;
+	}
+	if (mem->ar_length == 0) {
+		aprint_error_dev(self, "zero length memory resource\n");
+		goto 

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

2021-08-08 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Aug  8 10:28:26 UTC 2021

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

Log Message:
arm: ACPI: Add support for simple sharing of platform interrupts

Allow sharing of platform interrupts provided that the type, ipl, and
mpsafe-ness are the same.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/arch/arm/acpi/acpi_machdep.c:1.25
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.24	Sat Aug  7 18:40:45 2021
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Sun Aug  8 10:28:26 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.24 2021/08/07 18:40:45 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.25 2021/08/08 10:28:26 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.24 2021/08/07 18:40:45 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.25 2021/08/08 10:28:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -63,6 +63,27 @@ extern struct bus_space arm_generic_bs_t
 extern struct arm32_bus_dma_tag acpi_coherent_dma_tag;
 extern struct arm32_bus_dma_tag arm_generic_dma_tag;
 
+struct acpi_intrhandler {
+	int(*ah_fn)(void *);
+	void*ah_arg;
+	TAILQ_ENTRY(acpi_intrhandler)	ah_list;
+};
+
+struct acpi_intrvec {
+	intai_irq;
+	intai_ipl;
+	intai_type;
+	boolai_mpsafe;
+	intai_refcnt;
+	void*ai_arg;
+	void*ai_ih;
+	TAILQ_HEAD(, acpi_intrhandler)	ai_handlers;
+	TAILQ_ENTRY(acpi_intrvec)	ai_list;
+};
+
+static TAILQ_HEAD(, acpi_intrvec) acpi_intrvecs =
+TAILQ_HEAD_INITIALIZER(acpi_intrvecs);
+
 bus_dma_tag_t	arm_acpi_dma32_tag(struct acpi_softc *, struct acpi_devnode *);
 bus_dma_tag_t	arm_acpi_dma64_tag(struct acpi_softc *, struct acpi_devnode *);
 
@@ -256,28 +277,128 @@ acpi_md_OsDisableInterrupt(void)
 	cpsid(I32_bit);
 }
 
+static struct acpi_intrvec *
+acpi_md_intr_lookup(int irq)
+{
+	struct acpi_intrvec *ai;
+
+	TAILQ_FOREACH(ai, _intrvecs, ai_list) {
+		if (ai->ai_irq == irq) {
+			return ai;
+		}
+	}
+
+	return NULL;
+}
+
+static int
+acpi_md_intr(void *arg)
+{
+	struct acpi_intrvec *ai = arg;
+	struct acpi_intrhandler *ah;
+	int rv = 0;
+
+	TAILQ_FOREACH(ah, >ai_handlers, ah_list) {
+		rv += ah->ah_fn(ah->ah_arg);
+	}
+
+	return rv;
+}
+
 void *
 acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *), void *arg, bool mpsafe, const char *xname)
 {
-	return intr_establish_xname(irq, ipl, type | (mpsafe ? IST_MPSAFE : 0), handler, arg, xname);
+	struct acpi_intrvec *ai;
+	struct acpi_intrhandler *ah;
+
+	ai = acpi_md_intr_lookup(irq);
+	if (ai == NULL) {
+		ai = kmem_zalloc(sizeof(*ai), KM_SLEEP);
+		ai->ai_refcnt = 0;
+		ai->ai_irq = irq;
+		ai->ai_ipl = ipl;
+		ai->ai_type = type;
+		ai->ai_mpsafe = mpsafe;
+		ai->ai_arg = arg;
+		TAILQ_INIT(>ai_handlers);
+		if (arg == NULL) {
+			ai->ai_ih = intr_establish_xname(irq, ipl,
+			type | (mpsafe ? IST_MPSAFE : 0), handler, NULL,
+			xname);
+		} else {
+			ai->ai_ih = intr_establish_xname(irq, ipl,
+			type | (mpsafe ? IST_MPSAFE : 0), acpi_md_intr, ai,
+			xname);
+		}
+		if (ai->ai_ih == NULL) {
+			kmem_free(ai, sizeof(*ai));
+			return NULL;
+		}
+		TAILQ_INSERT_TAIL(_intrvecs, ai, ai_list);
+	} else {
+		if (ai->ai_arg == NULL) {
+			printf("ACPI: cannot share irq with NULL arg\n");
+			return NULL;
+		}
+		if (ai->ai_ipl != ipl) {
+			printf("ACPI: cannot share irq with different ipl\n");
+			return NULL;
+		}
+		if (ai->ai_type != type) {
+			printf("ACPI: cannot share edge and level interrupts\n");
+			return NULL;
+		}
+		if (ai->ai_mpsafe != mpsafe) {
+			printf("ACPI: cannot share between mpsafe/non-mpsafe\n");
+			return NULL;
+		}
+	}
+
+	ai->ai_refcnt++;
+
+	ah = kmem_zalloc(sizeof(*ah), KM_SLEEP);
+	ah->ah_fn = handler;
+	ah->ah_arg = arg;
+	TAILQ_INSERT_TAIL(>ai_handlers, ah, ah_list);
+
+	return ai->ai_ih;
 }
 
 void
-acpi_md_intr_mask(void *ih)
+acpi_md_intr_disestablish(void *ih)
 {
-	intr_mask(ih);
+	struct acpi_intrvec *ai;
+	struct acpi_intrhandler *ah;
+
+	TAILQ_FOREACH(ai, _intrvecs, ai_list) {
+		if (ai->ai_ih == ih) {
+			KASSERT(ai->ai_refcnt > 0);
+			if (ai->ai_refcnt > 1) {
+panic("%s: cannot disestablish shared irq", __func__);
+			}
+
+			TAILQ_REMOVE(_intrvecs, ai, ai_list);
+			ah = TAILQ_FIRST(>ai_handlers);
+			kmem_free(ah, sizeof(*ah));
+			intr_disestablish(ai->ai_ih);
+			kmem_free(ai, sizeof(*ai));
+			return;
+		}
+	}
+
+	panic("%s: interrupt not established", __func__);
 }
 
 void
-acpi_md_intr_unmask(void *ih)
+acpi_md_intr_mask(void *ih)
 {
-	intr_unmask(ih);
+	intr_mask(ih);
 }
 
 void
-acpi_md_intr_disestablish(void *ih)
+acpi_md_intr_unmask(void *ih)

CVS commit: src/sys/arch

2021-08-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Aug  8 00:53:39 UTC 2021

Modified Files:
src/sys/arch/macppc/include: types.h
src/sys/arch/sparc64/include: types.h

Log Message:
Define preprocessor symbols (__HAVE_OPENFIRMWARE_VARIANT_AAPL and
__HAVE_OPENFIRMWARE_VARIANT_SUNW) that lets generic OpenFirmware
code deal with differences / quirks among implementation variants.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/macppc/include/types.h
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/sparc64/include/types.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/macppc/include/types.h
diff -u src/sys/arch/macppc/include/types.h:1.14 src/sys/arch/macppc/include/types.h:1.15
--- src/sys/arch/macppc/include/types.h:1.14	Sun Jul 17 23:23:53 2011
+++ src/sys/arch/macppc/include/types.h	Sun Aug  8 00:53:39 2021
@@ -1,5 +1,6 @@
-/*	$NetBSD: types.h,v 1.14 2011/07/17 23:23:53 dyoung Exp $	*/
+/*	$NetBSD: types.h,v 1.15 2021/08/08 00:53:39 thorpej Exp $	*/
 
 #include 
 
 #define	__HAVE_NEW_STYLE_BUS_H
+#define	__HAVE_OPENFIRMWARE_VARIANT_AAPL

Index: src/sys/arch/sparc64/include/types.h
diff -u src/sys/arch/sparc64/include/types.h:1.28 src/sys/arch/sparc64/include/types.h:1.29
--- src/sys/arch/sparc64/include/types.h:1.28	Sat Apr  6 03:06:27 2019
+++ src/sys/arch/sparc64/include/types.h	Sun Aug  8 00:53:39 2021
@@ -1,4 +1,4 @@
-/*   $NetBSD: types.h,v 1.28 2019/04/06 03:06:27 thorpej Exp $*/
+/*   $NetBSD: types.h,v 1.29 2021/08/08 00:53:39 thorpej Exp $*/
 
 #ifndef _SPARC64_TYPES_H_
 #define	_SPARC64_TYPES_H_
@@ -11,5 +11,6 @@
 
 #define	__HAVE_COMPAT_NETBSD32
 #define	__HAVE_UCAS_FULL
+#define	__HAVE_OPENFIRMWARE_VARIANT_SUNW
 
 #endif



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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:27:53 UTC 2021

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c acpi_pci_machdep.h acpipchb.c
files.acpi
Added Files:
src/sys/arch/arm/acpi: acpi_pci_smccc.c

Log Message:
arm: acpi: Add support for SMCCC based PCI config access.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/acpi/acpi_pci_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/acpi/acpi_pci_machdep.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/acpi/acpi_pci_smccc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/acpi/acpipchb.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/acpi/files.acpi

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_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.18 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.19
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.18	Wed Jun 17 06:45:09 2020
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Sat Aug  7 21:27:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.18 2020/06/17 06:45:09 thorpej Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.19 2021/08/07 21:27:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018, 2020 The NetBSD Foundation, Inc.
@@ -29,10 +29,12 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "opt_pci.h"
+
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.18 2020/06/17 06:45:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.19 2021/08/07 21:27:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -60,6 +62,10 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_pci_mac
 #include 
 #include 
 
+#ifdef PCI_SMCCC
+#include 
+#endif
+
 #include 
 
 struct acpi_pci_prt {
@@ -94,7 +100,7 @@ struct acpi_pci_intr {
 static TAILQ_HEAD(, acpi_pci_intr) acpi_pci_intrs =
 TAILQ_HEAD_INITIALIZER(acpi_pci_intrs);
 
-static const struct acpi_pci_quirk acpi_pci_quirks[] = {
+static const struct acpi_pci_quirk acpi_pci_mcfg_quirks[] = {
 	/* OEM ID	OEM Table ID	Revision	Seg	Func */
 	{ "AMAZON",	"GRAVITON",	0,		-1,	acpi_pci_graviton_init },
 	{ "ARMLTD",	"ARMN1SDP",	0x20181101,	0,	acpi_pci_n1sdp_init },
@@ -102,6 +108,13 @@ static const struct acpi_pci_quirk acpi_
 	{ "NXP   ", "LX2160  ", 0,  -1,	acpi_pci_layerscape_gen4_init },
 };
 
+#ifdef PCI_SMCCC
+static const struct acpi_pci_quirk acpi_pci_smccc_quirk = {
+	.q_segment = -1,
+	.q_init = acpi_pci_smccc_init,
+};
+#endif
+
 pci_chipset_tag_t acpi_pci_md_get_chipset_tag(struct acpi_softc *, int, int);
 
 static void	acpi_pci_md_attach_hook(device_t, device_t,
@@ -554,11 +567,19 @@ acpi_pci_md_find_quirk(int seg)
 	u_int n;
 
 	rv = AcpiGetTable(ACPI_SIG_MCFG, 0, (ACPI_TABLE_HEADER **));
-	if (ACPI_FAILURE(rv))
+	if (ACPI_FAILURE(rv)) {
+#ifdef PCI_SMCCC
+		uint32_t ver = pci_smccc_version();
+		aprint_debug("%s: SMCCC version %#x\n", __func__, ver);
+		if (PCI_SMCCC_SUCCESS(ver)) {
+			return _pci_smccc_quirk;
+		}
+#endif
 		return NULL;
+	}
 
-	for (n = 0; n < __arraycount(acpi_pci_quirks); n++) {
-		const struct acpi_pci_quirk *q = _pci_quirks[n];
+	for (n = 0; n < __arraycount(acpi_pci_mcfg_quirks); n++) {
+		const struct acpi_pci_quirk *q = _pci_mcfg_quirks[n];
 		if (memcmp(q->q_oemid, mcfg->Header.OemId, ACPI_OEM_ID_SIZE) == 0 &&
 		memcmp(q->q_oemtableid, mcfg->Header.OemTableId, ACPI_OEM_TABLE_ID_SIZE) == 0 &&
 		q->q_oemrevision == mcfg->Header.OemRevision &&
@@ -589,6 +610,7 @@ acpi_pci_md_get_chipset_tag(struct acpi_
 		pct->pct_ap.ap_pc.pc_intr_v = >pct_ap;
 		pct->pct_ap.ap_seg = seg;
 		pct->pct_ap.ap_bus = bbn;
+		pct->pct_ap.ap_maxbus = -1;
 		pct->pct_ap.ap_bst = acpi_softc->sc_memt;
 
 		q = acpi_pci_md_find_quirk(seg);

Index: src/sys/arch/arm/acpi/acpi_pci_machdep.h
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.7 src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.8
--- src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.7	Sat Feb  1 13:26:43 2020
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.h	Sat Aug  7 21:27:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.h,v 1.7 2020/02/01 13:26:43 jmcneill Exp $ */
+/* $NetBSD: acpi_pci_machdep.h,v 1.8 2021/08/07 21:27:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -39,12 +39,15 @@ struct acpi_pci_context {
 	device_t ap_dev;
 	u_int ap_seg;
 	int ap_bus;
+	int ap_maxbus;
 	bus_space_tag_t ap_bst;
 	bus_space_handle_t ap_conf_bsh;
 	int (*ap_conf_read)(pci_chipset_tag_t, pcitag_t, int, pcireg_t *);
 	int (*ap_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
 	void *ap_conf_priv;
 	int ap_pciflags_clear;
+	u_int ap_flags;
+#define	ACPI_PCI_FLAG_NO_MCFG		__BIT(0)	/* ignore MCFG table */
 };
 
 struct acpi_pci_quirk {
@@ -57,6 +60,7 @@ struct acpi_pci_quirk {
 
 const struct acpi_pci_quirk *	acpi_pci_md_find_quirk(int);
 
+void	acpi_pci_smccc_init(struct acpi_pci_context *);
 void	

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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:24:56 UTC 2021

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

Log Message:
acpi: call smccc_probe() after PSCI init


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/acpi/acpi_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/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.27 src/sys/arch/arm/acpi/acpi_platform.c:1.28
--- src/sys/arch/arm/acpi/acpi_platform.c:1.27	Fri Aug  6 19:38:53 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Sat Aug  7 21:24:56 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.28 2021/08/07 21:24:56 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.28 2021/08/07 21:24:56 jmcneill Exp $");
 
 #include 
 #include 
@@ -253,6 +253,7 @@ acpi_platform_startup(void)
 			} else {
 psci_init(psci_call_smc);
 			}
+			smccc_probe();
 		}
 		acpi_table_unmap((ACPI_TABLE_HEADER *)fadt);
 	}



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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:23:37 UTC 2021

Modified Files:
src/sys/arch/arm/pci: files.pci
Added Files:
src/sys/arch/arm/pci: pci_smccc.c pci_smccc.h

Log Message:
arm: PCI: Add support for Arm PCI Config Space Access Firmware Interface

This adds basic support for the PCI Config Access interface defined in
Arm DEN0115.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/pci/files.pci
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/pci/pci_smccc.c \
src/sys/arch/arm/pci/pci_smccc.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/pci/files.pci
diff -u src/sys/arch/arm/pci/files.pci:1.1 src/sys/arch/arm/pci/files.pci:1.2
--- src/sys/arch/arm/pci/files.pci:1.1	Sun Oct 21 00:42:06 2018
+++ src/sys/arch/arm/pci/files.pci	Sat Aug  7 21:23:37 2021
@@ -1,4 +1,8 @@
-# $NetBSD: files.pci,v 1.1 2018/10/21 00:42:06 jmcneill Exp $
+# $NetBSD: files.pci,v 1.2 2021/08/07 21:23:37 jmcneill Exp $
 
 # PCI MSI/MSI-X support
 file	arch/arm/pci/pci_msi_machdep.c		pci & __have_pci_msi_msix
+
+# Arm PCI Configuration Space Access Firmware Interface (DEN0115)
+defflag	opt_pci.h	PCI_SMCCC
+file	arch/arm/pci/pci_smccc.c		pci_smccc

Added files:

Index: src/sys/arch/arm/pci/pci_smccc.c
diff -u /dev/null src/sys/arch/arm/pci/pci_smccc.c:1.1
--- /dev/null	Sat Aug  7 21:23:37 2021
+++ src/sys/arch/arm/pci/pci_smccc.c	Sat Aug  7 21:23:37 2021
@@ -0,0 +1,122 @@
+/* $NetBSD: pci_smccc.c,v 1.1 2021/08/07 21:23:37 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2021 Jared McNeill 
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: pci_smccc.c,v 1.1 2021/08/07 21:23:37 jmcneill Exp $");
+
+#include 
+#include 
+
+#include 
+#include 
+
+/* Minimum SMCCC version required for PCI_VERSION call. */
+#define	SMCCC_VERSION_1_1	0x10001
+
+/* PCI Configuration Space Access ABI functions */
+#define	PCI_VERSION		0x84000130
+#define	PCI_FEATURES		0x84000131
+#define	PCI_READ		0x84000132
+#define	PCI_WRITE		0x84000133
+#define	PCI_GET_SEG_INFO	0x84000134
+#define	 GET_SEG_INFO_BUS_START		__BITS(7,0)
+#define	 GET_SEG_INFO_BUS_END		__BITS(15,8)
+
+static int
+pci_smccc_call(uint32_t fid,
+register_t arg1, register_t arg2, register_t arg3, register_t arg4,
+register_t *res0, register_t *res1, register_t *res2, register_t *res3)
+{
+	static int smccc_ver;
+
+	if (smccc_ver == 0) {
+		smccc_ver = smccc_version();
+	}
+	if (smccc_ver < SMCCC_VERSION_1_1) {
+		return SMCCC_NOT_SUPPORTED;
+	}
+
+	return smccc_call(fid, arg1, arg2, arg3, arg4,
+			  res0, res1, res2, res3);
+}
+
+int
+pci_smccc_version(void)
+{
+	return pci_smccc_call(PCI_VERSION, 0, 0, 0, 0,
+			  NULL, NULL, NULL, NULL);
+}
+
+int
+pci_smccc_features(uint32_t fid)
+{
+	return pci_smccc_call(PCI_FEATURES, fid, 0, 0, 0,
+			  NULL, NULL, NULL, NULL);
+}
+
+int
+pci_smccc_read(uint32_t sbdf, uint32_t offset, uint32_t access_size,
+uint32_t *data)
+{
+	register_t value;
+	int status;
+
+	status = pci_smccc_call(PCI_READ, sbdf, offset, access_size, 0,
+NULL, , NULL, NULL);
+	if (status == SMCCC_SUCCESS) {
+		*data = value;
+	}
+
+	return status;
+}
+
+int
+pci_smccc_write(uint32_t sbdf, uint32_t offset, uint32_t access_size,
+uint32_t data)
+{
+	return pci_smccc_call(PCI_WRITE, sbdf, offset, access_size, data,
+			  NULL, NULL, NULL, NULL);
+}
+
+int
+pci_smccc_get_seg_info(uint16_t seg, uint8_t *bus_start, uint8_t *bus_end,
+uint16_t *next_seg)
+{
+	register_t res1, res2;
+	int status;
+
+	status = pci_smccc_call(PCI_GET_SEG_INFO, seg, 0, 0, 0,
+NULL, , , NULL);
+	if (status == SMCCC_SUCCESS) {
+		

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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:21:49 UTC 2021

Modified Files:
src/sys/arch/arm/arm: smccc.c smccc.h

Log Message:
arm: SMCCC: Add return values to smccc_call


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/smccc.c \
src/sys/arch/arm/arm/smccc.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/arm/smccc.c
diff -u src/sys/arch/arm/arm/smccc.c:1.1 src/sys/arch/arm/arm/smccc.c:1.2
--- src/sys/arch/arm/arm/smccc.c:1.1	Fri Aug  6 19:38:53 2021
+++ src/sys/arch/arm/arm/smccc.c	Sat Aug  7 21:21:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: smccc.c,v 1.1 2021/08/06 19:38:53 jmcneill Exp $ */
+/* $NetBSD: smccc.c,v 1.2 2021/08/07 21:21:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.1 2021/08/06 19:38:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.2 2021/08/07 21:21:49 jmcneill Exp $");
 
 #include 
 #include 
@@ -42,7 +42,10 @@ __KERNEL_RCSID(0, "$NetBSD: smccc.c,v 1.
 #define	SMCCC_VERSION		0x8000
 
 /* True if SMCCC is detected. */
-static bool	smccc_present;
+static bool			smccc_present;
+
+/* SMCCC conduit (SMC or HVC) */
+static enum psci_conduit	smccc_conduit = PSCI_CONDUIT_NONE;
 
 /*
  * smccc_probe --
@@ -58,6 +61,13 @@ smccc_probe(void)
 		}
 
 		smccc_present = psci_features(SMCCC_VERSION) == PSCI_SUCCESS;
+		if (smccc_present) {
+			smccc_conduit = psci_conduit();
+
+			aprint_debug("SMCCC: Version %#x (%s)\n",
+			smccc_version(),
+			smccc_conduit == PSCI_CONDUIT_SMC ? "SMC" : "HVC");
+		}
 	}
 	return smccc_present;
 }
@@ -70,7 +80,8 @@ smccc_probe(void)
 int
 smccc_version(void)
 {
-	return smccc_call(SMCCC_VERSION, 0, 0, 0);
+	return smccc_call(SMCCC_VERSION, 0, 0, 0, 0,
+			  NULL, NULL, NULL, NULL);
 }
 
 /*
@@ -79,11 +90,54 @@ smccc_version(void)
  *	Generic call interface for SMC/HVC calls.
  */
 int
-smccc_call(register_t fid, register_t arg1, register_t arg2, register_t arg3)
+smccc_call(uint32_t fid,
+register_t arg1, register_t arg2, register_t arg3, register_t arg4,
+register_t *res0, register_t *res1, register_t *res2, register_t *res3)
 {
+	register_t args[5] = { fid, arg1, arg2, arg3, arg4 };
+
+	register register_t r0 asm ("r0");
+	register register_t r1 asm ("r1");
+	register register_t r2 asm ("r2");
+	register register_t r3 asm ("r3");
+	register register_t r4 asm ("r4");
+
 	if (!smccc_present) {
 		return SMCCC_NOT_SUPPORTED;
 	}
 
-	return psci_call(fid, arg1, arg2, arg3);
+	KASSERT(smccc_conduit != PSCI_CONDUIT_NONE);
+
+	r0 = args[0];
+	r1 = args[1];
+	r2 = args[2];
+	r3 = args[3];
+	r4 = args[4];
+
+	if (smccc_conduit == PSCI_CONDUIT_SMC) {
+		asm volatile ("smc #0" :
+			  "=r" (r0), "=r" (r1), "=r" (r2), "=r" (r3) :
+			  "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4) :
+			  "memory");
+	} else {
+		asm volatile ("hvc #0" :
+			  "=r" (r0), "=r" (r1), "=r" (r2), "=r" (r3) :
+			  "r" (r0), "r" (r1), "r" (r2), "r" (r3), "r" (r4) :
+			  "memory");
+	}
+	
+	if (res0) {
+		*res0 = r0;
+	}
+	if (res1) {
+		*res1 = r1;
+	}
+	if (res2) {
+		*res2 = r2;
+	}
+	if (res3) {
+		*res3 = r3;
+	}
+
+	return r0;
 }
Index: src/sys/arch/arm/arm/smccc.h
diff -u src/sys/arch/arm/arm/smccc.h:1.1 src/sys/arch/arm/arm/smccc.h:1.2
--- src/sys/arch/arm/arm/smccc.h:1.1	Fri Aug  6 19:38:53 2021
+++ src/sys/arch/arm/arm/smccc.h	Sat Aug  7 21:21:49 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: smccc.h,v 1.1 2021/08/06 19:38:53 jmcneill Exp $ */
+/* $NetBSD: smccc.h,v 1.2 2021/08/07 21:21:49 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2021 Jared McNeill 
@@ -50,6 +50,7 @@ int	smccc_version(void);
 /*
  * Call an SMC/HVC service.
  */
-int	smccc_call(register_t, register_t, register_t, register_t);
+int	smccc_call(uint32_t, register_t, register_t, register_t, register_t,
+		   register_t *, register_t *, register_t *, register_t *);
 
 #endif /* _ARM_SMCCC_H */



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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:20:14 UTC 2021

Modified Files:
src/sys/arch/arm/arm: psci.c psci.h

Log Message:
arm: PSCI: Add a function to return the PSCI conduit.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/arm/psci.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/arm/psci.c
diff -u src/sys/arch/arm/arm/psci.c:1.6 src/sys/arch/arm/arm/psci.c:1.7
--- src/sys/arch/arm/arm/psci.c:1.6	Fri Aug  6 19:38:53 2021
+++ src/sys/arch/arm/arm/psci.c	Sat Aug  7 21:20:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $ */
+/* $NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.7 2021/08/07 21:20:14 jmcneill Exp $");
 
 #include 
 #include 
@@ -68,6 +68,18 @@ psci_call(register_t fid, register_t arg
 	return psci_call_fn(fid, arg1, arg2, arg3);
 }
 
+enum psci_conduit
+psci_conduit(void)
+{
+	if (psci_call_fn == psci_call_smc) {
+		return PSCI_CONDUIT_SMC;
+	} else if (psci_call_fn == psci_call_hvc) {
+		return PSCI_CONDUIT_HVC;
+	} else {
+		return PSCI_CONDUIT_NONE;
+	}
+}
+
 uint32_t
 psci_version(void)
 {

Index: src/sys/arch/arm/arm/psci.h
diff -u src/sys/arch/arm/arm/psci.h:1.3 src/sys/arch/arm/arm/psci.h:1.4
--- src/sys/arch/arm/arm/psci.h:1.3	Fri Aug  6 19:38:53 2021
+++ src/sys/arch/arm/arm/psci.h	Sat Aug  7 21:20:14 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.h,v 1.3 2021/08/06 19:38:53 jmcneill Exp $ */
+/* $NetBSD: psci.h,v 1.4 2021/08/07 21:20:14 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -42,6 +42,15 @@ enum psci_function {
 };
 
 /*
+ * Possible PSCI conduits.
+ */
+enum psci_conduit {
+	PSCI_CONDUIT_NONE,
+	PSCI_CONDUIT_SMC,
+	PSCI_CONDUIT_HVC,
+};
+
+/*
  * PSCI error codes
  */
 #define	PSCI_SUCCESS		0
@@ -71,6 +80,11 @@ void	psci_init(psci_fn);
 bool	psci_available(void);
 
 /*
+ * Return the PSCI conduit type.
+ */
+enum psci_conduit psci_conduit(void);
+
+/*
  * PSCI call methods, implemented in psci.S
  */
 int	psci_call_smc(register_t, register_t, register_t, register_t);



CVS commit: src/sys/dev/acpi

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 21:19:16 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_mcfg.c acpi_mcfg.h

Log Message:
acpi: expose acpimcfg_configure_bus_cb


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/acpi/acpi_mcfg.c
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_mcfg.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_mcfg.c
diff -u src/sys/dev/acpi/acpi_mcfg.c:1.23 src/sys/dev/acpi/acpi_mcfg.c:1.24
--- src/sys/dev/acpi/acpi_mcfg.c:1.23	Tue Jan 26 15:30:05 2021
+++ src/sys/dev/acpi/acpi_mcfg.c	Sat Aug  7 21:19:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_mcfg.c,v 1.23 2021/01/26 15:30:05 skrll Exp $	*/
+/*	$NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $	*/
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro 
@@ -28,7 +28,7 @@
 #include "opt_pci.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.23 2021/01/26 15:30:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $");
 
 #include 
 #include 
@@ -693,7 +693,7 @@ out:
 }
 
 #ifdef PCI_NETBSD_CONFIGURE
-static ACPI_STATUS
+ACPI_STATUS
 acpimcfg_configure_bus_cb(ACPI_RESOURCE *res, void *ctx)
 {
 	struct pciconf_resources *pcires = ctx;

Index: src/sys/dev/acpi/acpi_mcfg.h
diff -u src/sys/dev/acpi/acpi_mcfg.h:1.3 src/sys/dev/acpi/acpi_mcfg.h:1.4
--- src/sys/dev/acpi/acpi_mcfg.h:1.3	Sun Feb  2 16:31:25 2020
+++ src/sys/dev/acpi/acpi_mcfg.h	Sat Aug  7 21:19:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_mcfg.h,v 1.3 2020/02/02 16:31:25 jmcneill Exp $	*/
+/*	$NetBSD: acpi_mcfg.h,v 1.4 2021/08/07 21:19:15 jmcneill Exp $	*/
 
 /*-
  * Copyright (C) 2015 NONAKA Kimihiro 
@@ -33,6 +33,7 @@ void	acpimcfg_probe(struct acpi_softc *)
 int	acpimcfg_init(bus_space_tag_t, const struct acpimcfg_ops *);
 int	acpimcfg_map_bus(device_t, pci_chipset_tag_t, int);
 int	acpimcfg_configure_bus(device_t, pci_chipset_tag_t, ACPI_HANDLE, int, int);
+ACPI_STATUS acpimcfg_configure_bus_cb(ACPI_RESOURCE *, void *);
 
 int	acpimcfg_conf_read(pci_chipset_tag_t, pcitag_t, int, pcireg_t *);
 int	acpimcfg_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);



CVS commit: src/sys/sys

2021-08-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 19:44:39 UTC 2021

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

Log Message:
NetBSD 9.99.88 -- CFARG_* -> CFARGS()


To generate a diff of this commit:
cvs rdiff -u -r1.700 -r1.701 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.700 src/sys/sys/param.h:1.701
--- src/sys/sys/param.h:1.700	Thu Jul 22 04:46:29 2021
+++ src/sys/sys/param.h	Sat Aug  7 19:44:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.700 2021/07/22 04:46:29 skrll Exp $	*/
+/*	$NetBSD: param.h,v 1.701 2021/08/07 19:44:39 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999008700	/* NetBSD 9.99.87 */
+#define	__NetBSD_Version__	999008800	/* NetBSD 9.99.88 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/arch/sparc/sparc

2021-08-07 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sat Aug  7 19:23:03 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: pmap.c

Log Message:
sp_tlb_flush - consistent whitespace in inline asm.


To generate a diff of this commit:
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.373 src/sys/arch/sparc/sparc/pmap.c:1.374
--- src/sys/arch/sparc/sparc/pmap.c:1.373	Sun Jan 24 07:36:54 2021
+++ src/sys/arch/sparc/sparc/pmap.c	Sat Aug  7 19:23:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $ */
+/*	$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2021/01/24 07:36:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2021/08/07 19:23:03 uwe Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -663,13 +663,13 @@ sp_tlb_flush(int va, int ctx, int lvl)
 	opsr = getpsr();	/* KDASSERT(opsr & PSR_ET); */
 	__asm volatile ("wr %0, %1, %%psr"
 			:: "r"(opsr), "n"(PSR_ET) : "memory");
-	__asm volatile ("nop; nop;nop");
+	__asm volatile ("nop; nop; nop");
 
 	octx = getcontext4m();	/* save context */
 
 	/* Do the TLB flush in "ctx" */
 	setcontext4m(ctx);
-	__asm volatile("sta %%g0, [%0]%1" :: "r"(va), "n"(ASI_SRMMUFP));
+	__asm volatile ("sta %%g0, [%0]%1" :: "r"(va), "n"(ASI_SRMMUFP));
 
 	setcontext4m(octx);	/* restore context */
 	setpsr(opsr);		/* turn traps on again */



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

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 18:40:45 UTC 2021

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

Log Message:
acpi: DMA: Use acpi_resource_parse_any to parse _DMA resources

_DMA resources really should be marked ResourceProducer, so use
acpi_resource_parse_any to pick these up.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/sys/arch/arm/acpi/acpi_machdep.c:1.24
--- src/sys/arch/arm/acpi/acpi_machdep.c:1.23	Sat Aug  7 16:18:42 2021
+++ src/sys/arch/arm/acpi/acpi_machdep.c	Sat Aug  7 18:40:45 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.23 2021/08/07 16:18:42 thorpej Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.24 2021/08/07 18:40:45 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.23 2021/08/07 16:18:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.24 2021/08/07 18:40:45 jmcneill Exp $");
 
 #include 
 #include 
@@ -417,7 +417,7 @@ default_tag:
 		return;
 	}
 
-	rv = acpi_resource_parse(sc->sc_dev, module, "_DMA", ,
+	rv = acpi_resource_parse_any(sc->sc_dev, module, "_DMA", ,
 	_resource_parse_ops_quiet);
 	if (ACPI_FAILURE(rv)) {
 		aprint_error_dev(sc->sc_dev,



CVS commit: src/sys/dev/acpi

2021-08-07 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug  7 18:39:40 UTC 2021

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

Log Message:
acpi: Add acpi_resource_parse_any().

Like acpi_resource_parse(), but doesn't exclude "produced" resources.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/acpi/acpi_resource.c
cvs rdiff -u -r1.86 -r1.87 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.41 src/sys/dev/acpi/acpi_resource.c:1.42
--- src/sys/dev/acpi/acpi_resource.c:1.41	Tue Dec 31 17:26:04 2019
+++ src/sys/dev/acpi/acpi_resource.c	Sat Aug  7 18:39:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $	*/
+/*	$NetBSD: acpi_resource.c,v 1.42 2021/08/07 18:39:40 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.42 2021/08/07 18:39:40 jmcneill Exp $");
 
 #include 
 #include 
@@ -83,6 +83,7 @@ static ACPI_STATUS acpi_resource_parse_c
 
 struct resource_parse_callback_arg {
 	const struct acpi_resource_parse_ops *ops;
+	bool include_producer;
 	device_t dev;
 	void *context;
 };
@@ -247,7 +248,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 	case ACPI_RESOURCE_TYPE_ADDRESS32:
 		/* XXX Only fixed size supported for now */
 		if (res->Data.Address32.Address.AddressLength == 0 ||
-		res->Data.Address32.ProducerConsumer != ACPI_CONSUMER)
+		(!arg->include_producer &&
+		 res->Data.Address32.ProducerConsumer != ACPI_CONSUMER))
 			break;
 #define ADDRESS32_FIXED2(r)		\
 	((r)->Data.Address32.MinAddressFixed == ACPI_ADDRESS_FIXED &&	\
@@ -302,7 +304,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 #ifdef _LP64
 		/* XXX Only fixed size supported for now */
 		if (res->Data.Address64.Address.AddressLength == 0 ||
-		res->Data.Address64.ProducerConsumer != ACPI_CONSUMER)
+		(!arg->include_producer &&
+		 res->Data.Address64.ProducerConsumer != ACPI_CONSUMER))
 			break;
 #define ADDRESS64_FIXED2(r)		\
 	((r)->Data.Address64.MinAddressFixed == ACPI_ADDRESS_FIXED &&	\
@@ -357,7 +360,8 @@ acpi_resource_parse_callback(ACPI_RESOUR
 		break;
 
 	case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
-		if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) {
+		if (!arg->include_producer &&
+		res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) {
 			ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES,
 			"ignored ExtIRQ producer\n"));
 			break;
@@ -420,6 +424,7 @@ acpi_resource_parse(device_t dev, ACPI_H
 		cbarg.context = arg;
 	cbarg.ops = ops;
 	cbarg.dev = dev;
+	cbarg.include_producer = false;
 
 	rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback,
 	);
@@ -436,6 +441,45 @@ acpi_resource_parse(device_t dev, ACPI_H
 }
 
 /*
+ * acpi_resource_parse_any:
+ *
+ *	Parse a device node's resources and fill them in for the
+ *	client. Like acpi_resource_parse, but doesn't skip ResourceProducer
+ *	type resources.
+ */
+ACPI_STATUS
+acpi_resource_parse_any(device_t dev, ACPI_HANDLE handle, const char *path,
+void *arg, const struct acpi_resource_parse_ops *ops)
+{
+	struct resource_parse_callback_arg cbarg;
+	ACPI_STATUS rv;
+
+	ACPI_FUNCTION_TRACE(__func__);
+
+	if (ops->init)
+		(*ops->init)(dev, arg, );
+	else
+		cbarg.context = arg;
+	cbarg.ops = ops;
+	cbarg.dev = dev;
+	cbarg.include_producer = true;
+
+	rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback,
+	);
+	if (ACPI_FAILURE(rv)) {
+		aprint_error_dev(dev, "ACPI: unable to get %s resources: %s\n",
+		path, AcpiFormatException(rv));
+		return_ACPI_STATUS(rv);
+	}
+
+	if (ops->fini)
+		(*ops->fini)(dev, cbarg.context);
+
+	return_ACPI_STATUS(AE_OK);
+}
+
+
+/*
  * acpi_resource_print:
  *
  *	Print the resources assigned to a device.

Index: src/sys/dev/acpi/acpivar.h
diff -u src/sys/dev/acpi/acpivar.h:1.86 src/sys/dev/acpi/acpivar.h:1.87
--- src/sys/dev/acpi/acpivar.h:1.86	Wed May 12 23:22:33 2021
+++ src/sys/dev/acpi/acpivar.h	Sat Aug  7 18:39:40 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpivar.h,v 1.86 2021/05/12 23:22:33 thorpej Exp $	*/
+/*	$NetBSD: acpivar.h,v 1.87 2021/08/07 18:39:40 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -330,6 +330,8 @@ void		acpi_deregister_notify(struct acpi
 
 ACPI_STATUS	acpi_resource_parse(device_t, ACPI_HANDLE, const char *,
 		void *, const struct acpi_resource_parse_ops *);
+ACPI_STATUS	acpi_resource_parse_any(device_t, ACPI_HANDLE, const char *,
+		void *, const struct acpi_resource_parse_ops *);
 void		acpi_resource_print(device_t, struct acpi_resources *);
 void		acpi_resource_cleanup(struct acpi_resources *);
 



CVS commit: src/sys

2021-08-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 18:16:42 UTC 2021

Modified Files:
src/sys/kern: subr_device.c
src/sys/sys: device.h

Log Message:
Export devhandle_lookup_device_call().


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_device.c
cvs rdiff -u -r1.172 -r1.173 src/sys/sys/device.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/kern/subr_device.c
diff -u src/sys/kern/subr_device.c:1.7 src/sys/kern/subr_device.c:1.8
--- src/sys/kern/subr_device.c:1.7	Sat Feb  6 05:33:20 2021
+++ src/sys/kern/subr_device.c	Sat Aug  7 18:16:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_device.c,v 1.7 2021/02/06 05:33:20 thorpej Exp $	*/
+/*	$NetBSD: subr_device.c,v 1.8 2021/08/07 18:16:42 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2006, 2021 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.7 2021/02/06 05:33:20 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_device.c,v 1.8 2021/08/07 18:16:42 thorpej Exp $");
 
 #include 
 #include 
@@ -72,7 +72,7 @@ devhandle_type(devhandle_t handle)
 	return handle.impl->type;
 }
 
-static device_call_t
+device_call_t
 devhandle_lookup_device_call(devhandle_t handle, const char *name,
 devhandle_t *call_handlep)
 {

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.172 src/sys/sys/device.h:1.173
--- src/sys/sys/device.h:1.172	Sat Aug  7 16:19:18 2021
+++ src/sys/sys/device.h	Sat Aug  7 18:16:42 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.172 2021/08/07 16:19:18 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.173 2021/08/07 18:16:42 thorpej Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -671,6 +671,8 @@ bool		devhandle_is_valid(devhandle_t);
 void		devhandle_invalidate(devhandle_t *);
 devhandle_type_t devhandle_type(devhandle_t);
 
+device_call_t	devhandle_lookup_device_call(devhandle_t, const char *,
+		devhandle_t *);
 void		devhandle_impl_inherit(struct devhandle_impl *,
 		const struct devhandle_impl *);
 



CVS commit: src/sys

2021-08-07 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 16:19:18 UTC 2021

Modified Files:
src/sys/arch/acorn32/eb7500atx: rsbus.c
src/sys/arch/acorn32/mainbus: fd.c pioc.c
src/sys/arch/acorn32/podulebus: amps.c asc.c cosc.c csc.c podulebus.c
ptsc.c
src/sys/arch/algor/dev: bonito_mainbus.c mainbus.c vtpbc_mainbus.c
src/sys/arch/algor/pci: pcib.c
src/sys/arch/alpha/alpha: mainbus.c
src/sys/arch/alpha/jensenio: jensenio.c
src/sys/arch/alpha/mcbus: mcbus.c
src/sys/arch/alpha/pci: apecs.c cia.c dwlpx.c irongate.c lca.c mcpcia.c
sio.c tsc.c tsciic.c ttwoga.c
src/sys/arch/alpha/sableio: sableio.c
src/sys/arch/alpha/tc: tcasic.c
src/sys/arch/alpha/tlsb: gbus.c kftxx.c tlsb.c
src/sys/arch/amd64/amd64: amd64_mainbus.c
src/sys/arch/amiga/amiga: autoconf.c device.h
src/sys/arch/amiga/clockport: a1k2cp.c clockport.c gencp.c
src/sys/arch/amiga/dev: acafh.c afsc.c ahsc.c amidisplaycc.c atzsc.c
bppcsc.c cbiiisc.c drsc.c drsupio.c empsc.c fd.c gayle_pcmcia.c
grf.c grf_cc.c grf_cl.c grf_cv.c grf_cv3d.c grf_et.c grf_rh.c
grf_rt.c grf_ul.c gtsc.c gvpbus.c gvpio.c hyper.c ioblix_zbus.c
ivsc.c kbd.c mfc.c mgnsc.c mlhsc.c mntva.c ms.c otgsc.c p5bus.c
wesc.c wstsc.c xsh.c xsurf.c z3rambd.c zbus.c zssc.c
src/sys/arch/amiga/pci: cv3dpb.c em4k.c empb.c mppb.c p5pb.c
src/sys/arch/amigappc/amigappc: autoconf.c mainbus.c
src/sys/arch/arc/arc: mainbus.c
src/sys/arch/arc/dti: btl.c
src/sys/arch/arc/isa: isabus.c
src/sys/arch/arc/jazz: fd.c jazzio.c
src/sys/arch/arc/pci: necpb.c
src/sys/arch/arm/acpi: acpi_machdep.c acpipchb.c gic_acpi.c gtmr_acpi.c
src/sys/arch/arm/amlogic: meson_pinctrl.c meson_sdhc.c meson_sdio.c
mesongx_mmc.c
src/sys/arch/arm/at91: at91bus.c at91cf.c at91ohci.c at91pio.c
at91spi.c at91twi.c
src/sys/arch/arm/broadcom: bcm2835_bsc_acpi.c bcm2835_dwctwo.c
bcm2835_gpio.c bcm2835_mbox.c bcm2835_sdhost.c bcm2835_spi.c
bcm2838_pcie.c bcm53xx_cca.c bcm53xx_ccb.c bcm53xx_pax.c
bcm53xx_usb.c
src/sys/arch/arm/clps711x: clpslcd.c clpssoc.c
src/sys/arch/arm/cortex: armperiph.c
src/sys/arch/arm/ep93xx: epgpio.c epohci.c eppcic.c epsoc.c
src/sys/arch/arm/fdt: a9ptmr_fdt.c a9tmr_fdt.c a9wdt_fdt.c acpi_fdt.c
arm_fdt.c cpu_fdt.c gic_fdt.c gtmr_fdt.c l2cc_fdt.c pcihost_fdt.c
src/sys/arch/arm/footbridge: footbridge.c
src/sys/arch/arm/gemini: gemini_gmac.c gemini_gpio.c gemini_ipi.c
gemini_ipm.c gemini_lpc.c gemini_obio.c obio_ehci.c obio_lpchc.c
src/sys/arch/arm/imx: imx23_ahb.c imx23_apbh.c imx23_apbx.c
imx23_pinctrl.c imx23_ssp.c imx23_usb.c imx31_ahb.c imx31_aips.c
imx31_gpio.c imx51_axi.c imx51_ipuv3.c imx51_usb.c imx_pcic.c
imxgpio.c imxspi.c imxusb.c
src/sys/arch/arm/iomd: iomd.c iomdiic.c qms.c vidc20.c vidcvideo.c
src/sys/arch/arm/ixp12x0: ixp12x0.c ixpsip.c
src/sys/arch/arm/mainbus: mainbus.c
src/sys/arch/arm/marvell: mvsoc.c mvsocgpp.c
src/sys/arch/arm/mpcore: mpcore_axi.c mpcore_pmr.c
src/sys/arch/arm/nvidia: tegra210_xusbpad.c tegra_cec.c tegra_drm_fb.c
tegra_ehci.c tegra_gpio.c tegra_pcie.c tegra_xusb.c
src/sys/arch/arm/nxp: imx6_usb.c imxpcie.c
src/sys/arch/arm/omap: am335x_gpio.c obio_ohci.c omap2_gpio.c
omap2_gpmc.c omap2_l3i.c omap2_obio.c omap3_ehci.c omap3_i2c.c
omap_emifs.c omap_ocp.c omap_tipb.c omapfb.c omapl1x_ohci.c
omapl1x_tipb.c ti_iic.c tifb.c tiotg.c
src/sys/arch/arm/rockchip: rk3328_iomux.c rk3399_iomux.c rk_drm.c
rk_gpio.c rk_usb.c
src/sys/arch/arm/s3c2xx0: ohci_s3c24x0.c s3c2410.c s3c2410_extint.c
s3c2410_spi.c s3c2440.c s3c2440_extint.c s3c2440_i2s.c
s3c2440_sdi.c s3c2440_spi.c s3c2440_touch.c s3c2800.c s3c2800_pci.c
src/sys/arch/arm/sa11x0: sa.c sa11x0.c sa11x1_pcic.c
src/sys/arch/arm/samsung: exynos_ehci.c exynos_gpio.c exynos_ohci.c
mct.c
src/sys/arch/arm/sociox: sni_gpio.c sni_i2c.c
src/sys/arch/arm/sunxi: sun6i_spi.c sunxi_debe.c sunxi_drm.c
sunxi_gpio.c sunxi_mmc.c sunxi_ts.c
src/sys/arch/arm/ti: omap2_nand.c omap3_dss.c ti_ehci.c ti_gpio.c
ti_lcdc.c
src/sys/arch/arm/xilinx: zynq_usb.c
src/sys/arch/arm/xscale: becc.c i80312.c i80321.c iopi2c.c ixp425.c
ixp425_ixme.c ixp425_npe.c ixp425_sip.c pxa2x0.c pxa2x0_gpio.c
pxa2x0_mci.c pxa2x0_ohci.c pxa2x0_pcic.c
src/sys/arch/arm/zynq: zynq_axi.c zynq_usb.c
src/sys/arch/atari/atari: autoconf.c device.h
src/sys/arch/atari/dev: fd.c grf.c hdfd.c ite_cc.c ite_et.c kbd.c
   

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

2021-08-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  7 15:41:01 UTC 2021

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

Log Message:
sun8icrypto(4): Call crypto_unblock when a task completes.

Otherwise under load this would presumably just hang after returning
ERESTART to opencrypto.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/sunxi/sun8i_crypto.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sun8i_crypto.c
diff -u src/sys/arch/arm/sunxi/sun8i_crypto.c:1.25 src/sys/arch/arm/sunxi/sun8i_crypto.c:1.26
--- src/sys/arch/arm/sunxi/sun8i_crypto.c:1.25	Wed Apr 28 16:57:05 2021
+++ src/sys/arch/arm/sunxi/sun8i_crypto.c	Sat Aug  7 15:41:00 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $	*/
+/*	$NetBSD: sun8i_crypto.c,v 1.26 2021/08/07 15:41:00 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.25 2021/04/28 16:57:05 bad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sun8i_crypto.c,v 1.26 2021/08/07 15:41:00 riastradh Exp $");
 
 #include 
 #include 
@@ -211,7 +211,7 @@ static void	sun8i_crypto_timeout(void *)
 static int	sun8i_crypto_intr(void *);
 static void	sun8i_crypto_schedule_worker(struct sun8i_crypto_softc *);
 static void	sun8i_crypto_worker(struct work *, void *);
-static void	sun8i_crypto_chan_done(struct sun8i_crypto_softc *, unsigned,
+static bool	sun8i_crypto_chan_done(struct sun8i_crypto_softc *, unsigned,
 		int);
 
 static int	sun8i_crypto_allocbuf(struct sun8i_crypto_softc *, size_t,
@@ -1051,6 +1051,7 @@ sun8i_crypto_worker(struct work *wk, voi
 	struct sun8i_crypto_softc *sc = cookie;
 	uint32_t done, esr, esr_chan;
 	unsigned i, now;
+	bool unblock = false;
 	int error;
 
 	/*
@@ -1084,7 +1085,8 @@ sun8i_crypto_worker(struct work *wk, voi
 			if ((sc->sc_chan[i].cc_task != NULL) &&
 			((now - sc->sc_chan[i].cc_starttime) >=
 SUN8I_CRYPTO_TIMEOUT))
-sun8i_crypto_chan_done(sc, i, ETIMEDOUT);
+unblock |= sun8i_crypto_chan_done(sc, i,
+ETIMEDOUT);
 			continue;
 		}
 
@@ -1112,11 +1114,23 @@ sun8i_crypto_worker(struct work *wk, voi
 		 * Notify the task of completion.  May release the lock
 		 * to invoke a callback.
 		 */
-		sun8i_crypto_chan_done(sc, i, error);
+		unblock |= sun8i_crypto_chan_done(sc, i, error);
 	}
 
 	/* All one; release the lock one last time.  */
 	mutex_exit(>sc_lock);
+
+	/*
+	 * If we cleared any channels, it is time to allow opencrypto
+	 * to issue new operations.  Asymmetric operations (which we
+	 * don't support, at the moment, but we could) and symmetric
+	 * operations (which we do) use the same task channels, so we
+	 * unblock both kinds.
+	 */
+	if (unblock) {
+		crypto_unblock(sc->sc_opencrypto.co_driverid,
+		CRYPTO_SYMQ|CRYPTO_ASYMQ);
+	}
 }
 
 /*
@@ -1125,7 +1139,7 @@ sun8i_crypto_worker(struct work *wk, voi
  *	Notify the callback for the task on channel i, if there is one,
  *	of the specified error, or 0 for success.
  */
-static void
+static bool
 sun8i_crypto_chan_done(struct sun8i_crypto_softc *sc, unsigned i, int error)
 {
 	struct sun8i_crypto_task *task;
@@ -1140,7 +1154,8 @@ sun8i_crypto_chan_done(struct sun8i_cryp
 	if ((task = sc->sc_chan[i].cc_task) == NULL) {
 		device_printf(sc->sc_dev, "channel %u: no task but error=%d\n",
 		i, error);
-		return;
+		/* We did not clear a channel.  */
+		return false;
 	}
 	sc->sc_chan[i].cc_task = NULL;
 
@@ -1183,6 +1198,9 @@ sun8i_crypto_chan_done(struct sun8i_cryp
 	SDT_PROBE2(sdt, sun8i_crypto, task, done,  task, error);
 	(*task->ct_callback)(sc, task, task->ct_cookie, error);
 	mutex_enter(>sc_lock);
+
+	/* We cleared a channel.  */
+	return true;
 }
 
 /*
@@ -1811,7 +1829,7 @@ sun8i_crypto_register1(struct sun8i_cryp
  *	Called by opencrypto to allocate a new session.  We don't keep
  *	track of sessions, since there are no persistent keys in the
  *	hardware that we take advantage of, so this only validates the
- *	crypto operations and returns a zero session id.
+ *	crypto operations and returns a dummy session id of 1.
  */
 static int
 sun8i_crypto_newsession(void *cookie, uint32_t *sidp, struct cryptoini *cri)
@@ -1823,7 +1841,7 @@ sun8i_crypto_newsession(void *cookie, ui
 
 	/*
 	 * No variation of rounds is supported here.  (XXX Unused and
-	 * unimplemented in opencrypto(9) altogether?
+	 * unimplemented in opencrypto(9) altogether?)
 	 */
 	if (cri->cri_rnd)
 		return EINVAL;



CVS commit: src/sys/arch/macppc/dev

2021-08-07 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Aug  7 06:04:26 UTC 2021

Modified Files:
src/sys/arch/macppc/dev: pmu.c

Log Message:
pass sensor locations to i2c devices if we can find them
tested on 2nd gen Mini


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/macppc/dev/pmu.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/macppc/dev/pmu.c
diff -u src/sys/arch/macppc/dev/pmu.c:1.37 src/sys/arch/macppc/dev/pmu.c:1.38
--- src/sys/arch/macppc/dev/pmu.c:1.37	Sat Apr 24 23:36:41 2021
+++ src/sys/arch/macppc/dev/pmu.c	Sat Aug  7 06:04:26 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmu.c,v 1.37 2021/04/24 23:36:41 thorpej Exp $ */
+/*	$NetBSD: pmu.c,v 1.38 2021/08/07 06:04:26 macallan Exp $ */
 
 /*-
  * Copyright (c) 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.37 2021/04/24 23:36:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmu.c,v 1.38 2021/08/07 06:04:26 macallan Exp $");
 
 #include 
 #include 
@@ -340,7 +340,7 @@ pmu_attach(device_t parent, device_t sel
 			goto next;
 
 		if (strncmp(name, "pmu-i2c", 8) == 0) {
-			int devs;
+			int devs, sensors;
 			uint32_t addr;
 			char compat[256];
 			prop_array_t cfg;
@@ -372,6 +372,20 @@ pmu_attach(device_t parent, device_t sel
 prop_object_release(data);
 prop_dictionary_set_uint32(dev, "addr", addr);
 prop_dictionary_set_uint64(dev, "cookie", devs);
+sensors = OF_child(devs);
+while (sensors != 0) {
+	int reg;
+	char loc[64];
+	char pname[8];
+	if (OF_getprop(sensors, "reg", , 4) != 4)
+		goto nope;
+	if (OF_getprop(sensors, "location", loc, 63) <= 0)
+		goto nope;
+	snprintf(pname, 7, "s%02x", reg);
+	prop_dictionary_set_string(dev, pname, loc);
+nope:
+	sensors = OF_peer(sensors);
+}
 prop_array_add(cfg, dev);
 prop_object_release(dev);
 			skip:
@@ -818,7 +832,7 @@ pmu_poweroff(void)
 	if (pmu_send(sc, PMU_POWER_OFF, 4, cmd, 16, resp) >= 0)
 		while (1);
 }
-
+	
 void
 pmu_restart(void)
 {



CVS commit: src/sys/modules/lua

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  7 04:19:31 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Make sure that buffers allocated by lua_alloc() are aligned to 8-byte
boundaries as done by kmem_alloc(9).

Fix alignment faults on armv5te; GCC emits ldrd/strd instructions for
memory operands that are guaranteed to be aligned properly.

Drop unnecessary __packed attribute from alloc_header_t at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.25 src/sys/modules/lua/lua.c:1.26
--- src/sys/modules/lua/lua.c:1.25	Tue Jun 29 22:40:53 2021
+++ src/sys/modules/lua/lua.c	Sat Aug  7 04:19:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.25 2021/06/29 22:40:53 dholland Exp $ */
+/*	$NetBSD: lua.c,v 1.26 2021/08/07 04:19:31 rin Exp $ */
 
 /*
  * Copyright (c) 2011 - 2017 by Marc Balmer .
@@ -547,14 +547,18 @@ lua_require(lua_State *L)
 
 typedef struct {
 	size_t size;
-} __packed alloc_header_t;
+} alloc_header_t;
 
 static void *
 lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
 {
 	void *nptr = NULL;
 
-	const size_t hdr_size = sizeof(alloc_header_t);
+	/*
+	 * Make sure that buffers allocated by lua_alloc() are aligned to
+	 * 8-byte boundaries as done by kmem_alloc(9).
+	 */
+	const size_t hdr_size = roundup(sizeof(alloc_header_t), 8);
 	alloc_header_t *hdr = (alloc_header_t *) ((char *) ptr - hdr_size);
 
 	if (nsize == 0) { /* freeing */



CVS commit: src/sys/arch

2021-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  6 19:38:54 UTC 2021

Modified Files:
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/arm/acpi: acpi_platform.c
src/sys/arch/arm/arm: psci.c psci.h
src/sys/arch/arm/conf: files.arm
src/sys/arch/arm/fdt: psci_fdt.c
Added Files:
src/sys/arch/arm/arm: smccc.c smccc.h

Log Message:
Arm: Add support for SMC Calling Convention

Arm DEN0028 defines a calling mechanism used with Secure Monitor Call (SMC)
and Hypervisor Call (HVC) instructions. To discover SMCCC, we must:

 1) Find the PSCI conduit (either via ACPI FADT, or Device Tree)
 2) Use PSCI_VERSION to determine whether PSCI_FEATURES is supported
 3) Call PSCI_FEATURES with SMCCC_VERSION to determine the implementation
version.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/psci.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/arm/smccc.c \
src/sys/arch/arm/arm/smccc.h
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/fdt/psci_fdt.c

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

Modified files:

Index: src/sys/arch/aarch64/conf/files.aarch64
diff -u src/sys/arch/aarch64/conf/files.aarch64:1.31 src/sys/arch/aarch64/conf/files.aarch64:1.32
--- src/sys/arch/aarch64/conf/files.aarch64:1.31	Sat Jul 24 23:38:41 2021
+++ src/sys/arch/aarch64/conf/files.aarch64	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.aarch64,v 1.31 2021/07/24 23:38:41 jmcneill Exp $
+#	$NetBSD: files.aarch64,v 1.32 2021/08/06 19:38:53 jmcneill Exp $
 
 defflag opt_cpuoptions.h	AARCH64_ALIGNMENT_CHECK
 defflag opt_cpuoptions.h	AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -33,11 +33,15 @@ defparam opt_console.h		CONSPEED
 defparam opt_console.h		CONMODE
 defparam opt_console.h		CONADDR
 
-# Power State Coordination Interface (PSCI)
 # FP support
 file	arch/aarch64/aarch64/fpu.c
 
-device	psci
+# SMC Calling Convention
+define	smccc
+file	arch/arm/arm/smccc.c			smccc
+
+# Power State Coordination Interface (PSCI)
+device	psci: smccc
 file	arch/arm/arm/psci.c			psci
 file	arch/arm/arm/psci_arm.S			psci
 

Index: src/sys/arch/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.26 src/sys/arch/arm/acpi/acpi_platform.c:1.27
--- src/sys/arch/arm/acpi/acpi_platform.c:1.26	Wed May 12 23:22:32 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.26 2021/05/12 23:22:32 thorpej Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.26 2021/05/12 23:22:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_platfor
 
 #include 
 
+#include 
 #include 
 #include 
 

Index: src/sys/arch/arm/arm/psci.c
diff -u src/sys/arch/arm/arm/psci.c:1.5 src/sys/arch/arm/arm/psci.c:1.6
--- src/sys/arch/arm/arm/psci.c:1.5	Sat Jan 16 23:51:50 2021
+++ src/sys/arch/arm/arm/psci.c	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.c,v 1.5 2021/01/16 23:51:50 chs Exp $ */
+/* $NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.5 2021/01/16 23:51:50 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.5
 #else
 #define	PSCI_CPU_ON		0x8403
 #endif
+#define	PSCI_FEATURES		0x840a
 
 static psci_fn psci_call_fn;
 
@@ -53,9 +54,10 @@ static uint32_t psci_functions[PSCI_FUNC
 [PSCI_FUNC_SYSTEM_OFF] = PSCI_SYSTEM_OFF,
 	[PSCI_FUNC_SYSTEM_RESET] = PSCI_SYSTEM_RESET,
 	[PSCI_FUNC_CPU_ON] = PSCI_CPU_ON,
+	[PSCI_FUNC_FEATURES] = PSCI_FEATURES,
 };
 
-static int
+int
 psci_call(register_t fid, register_t arg1, register_t arg2, register_t arg3)
 {
 	KASSERT(psci_call_fn != NULL);
@@ -98,6 +100,15 @@ psci_system_reset(void)
 	psci_call(psci_functions[PSCI_FUNC_SYSTEM_RESET], 0, 0, 0);
 }
 
+int
+psci_features(uint32_t fid)
+{
+	if (psci_functions[PSCI_FUNC_FEATURES] == 0) {
+		return PSCI_NOT_SUPPORTED;
+	}
+	return psci_call(psci_functions[PSCI_FUNC_FEATURES], fid, 0, 0);
+}
+
 void
 psci_init(psci_fn fn)
 {

Index: src/sys/arch/arm/arm/psci.h
diff -u src/sys/arch/arm/arm/psci.h:1.2 src/sys/arch/arm/arm/psci.h:1.3
--- src/sys/arch/arm/arm/psci.h:1.2	Sat Oct 13 00:07:55 2018
+++ 

CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

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

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.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/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.19 src/sys/dev/ic/ssdfb.c:1.20
--- src/sys/dev/ic/ssdfb.c:1.19	Thu Aug  5 22:31:20 2021
+++ src/sys/dev/ic/ssdfb.c	Fri Aug  6 18:15:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.
 
 #include 
 #include 
+#ifdef pmap_is_modified
+#include 
+#endif
 
 #include 
 #include 



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

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 09:01:36 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_icu.c i80321var.h

Log Message:
Simplify i80321_intr_calculate_masks().

G/C unused members of struct intrq.

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/xscale/i80321_icu.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321var.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/xscale/i80321_icu.c
diff -u src/sys/arch/arm/xscale/i80321_icu.c:1.26 src/sys/arch/arm/xscale/i80321_icu.c:1.27
--- src/sys/arch/arm/xscale/i80321_icu.c:1.26	Fri Nov 20 18:49:45 2020
+++ src/sys/arch/arm/xscale/i80321_icu.c	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $	*/
+/*	$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -166,26 +166,22 @@ i80321_intr_calculate_masks(void)
 	struct intrhand *ih;
 	int irq, ipl;
 
-	/* First, figure out which IPLs each IRQ has. */
+	/* Disable all IRQs. */
+	for (irq = 0; irq < NIRQ; irq++)
+		i80321_disable_irq(irq);
+
+	/* Figure out which IRQs are used by each IPL. */
+	for (ipl = 0; ipl < NIPL; ipl++)
+		i80321_imask[ipl] = 0;
 	for (irq = 0; irq < NIRQ; irq++) {
-		int levels = 0;
 		iq = [irq];
-		i80321_disable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			levels |= (1U << ih->ih_ipl);
-		iq->iq_levels = levels;
+		TAILQ_FOREACH(ih, >iq_list, ih_list)
+			i80321_imask[ih->ih_ipl] |= (1U << irq);
 	}
 
-	/* Next, figure out which IRQs are used by each IPL. */
-	for (ipl = 0; ipl < NIPL; ipl++) {
-		int irqs = 0;
-		for (irq = 0; irq < NIRQ; irq++) {
-			if (intrq[irq].iq_levels & (1U << ipl))
-irqs |= (1U << irq);
-		}
-		i80321_imask[ipl] = irqs;
-	}
+	/* All IPLs block everything blocked by any lower IPL. */
+	for (ipl = 1; ipl < NIPL; ipl++)
+		i80321_imask[ipl] |= i80321_imask[ipl - 1];
 
 	KASSERT(i80321_imask[IPL_NONE] == 0);
 	KASSERT(i80321_imask[IPL_SOFTCLOCK] == 0);
@@ -193,38 +189,11 @@ i80321_intr_calculate_masks(void)
 	KASSERT(i80321_imask[IPL_SOFTNET] == 0);
 	KASSERT(i80321_imask[IPL_SOFTSERIAL] == 0);
 
-	/*
-	 * Enforce a hierarchy that gives "slow" device (or devices with
-	 * limited input buffer space/"real-time" requirements) a better
-	 * chance at not dropping data.
-	 */
-
-#if 0
-	/*
-	 * This assert might be useful, but only after some interrupts
-	 * are configured.  As it stands now, it will always fire early
-	 * in the initialization phase.  If it's useful enough to re-
-	 * enable, it should be conditionalized on something else like
-	 * having at least something in the levels/irqs above.
-	 */
-	KASSERT(i80321_imask[IPL_VM] != 0);
-#endif
-	i80321_imask[IPL_SCHED] |= i80321_imask[IPL_VM];
-	i80321_imask[IPL_HIGH] |= i80321_imask[IPL_SCHED];
-
-	/*
-	 * Now compute which IRQs must be blocked when servicing any
-	 * given IRQ.
-	 */
+	/* Enable IRQs in use. */
 	for (irq = 0; irq < NIRQ; irq++) {
-		int irqs = (1U << irq);
 		iq = [irq];
-		if (TAILQ_FIRST(>iq_list) != NULL)
+		if (!TAILQ_EMPTY(>iq_list))
 			i80321_enable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			irqs |= i80321_imask[ih->ih_ipl];
-		iq->iq_mask = irqs;
 	}
 }
 

Index: src/sys/arch/arm/xscale/i80321var.h
diff -u src/sys/arch/arm/xscale/i80321var.h:1.13 src/sys/arch/arm/xscale/i80321var.h:1.14
--- src/sys/arch/arm/xscale/i80321var.h:1.13	Sun Feb 12 16:31:01 2012
+++ src/sys/arch/arm/xscale/i80321var.h	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321var.h,v 1.13 2012/02/12 16:31:01 matt Exp $	*/
+/*	$NetBSD: i80321var.h,v 1.14 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -59,8 +59,6 @@ struct intrhand {
 struct intrq {
 	TAILQ_HEAD(, intrhand) iq_list;	/* handler list */
 	struct evcnt iq_ev;		/* event counter */
-	int iq_mask;			/* IRQs to mask while handling */
-	int iq_levels;			/* IPL_*'s this IRQ has */
 	int iq_ist;			/* share type */
 };
 



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

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 08:58:42 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_intr.h

Log Message:
Do *NOT* lower IPL in i80321_splraise().

Fix various strange crashes for DIAGNOSTIC kernel on evbarm/HDL_G,
including one worked around by if_wm.c rev 1.706:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c#rev1.706


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/i80321_intr.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/xscale/i80321_intr.h
diff -u src/sys/arch/arm/xscale/i80321_intr.h:1.12 src/sys/arch/arm/xscale/i80321_intr.h:1.13
--- src/sys/arch/arm/xscale/i80321_intr.h:1.12	Wed Jan 24 09:04:45 2018
+++ src/sys/arch/arm/xscale/i80321_intr.h	Fri Aug  6 08:58:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_intr.h,v 1.12 2018/01/24 09:04:45 skrll Exp $	*/
+/*	$NetBSD: i80321_intr.h,v 1.13 2021/08/06 08:58:42 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -95,10 +95,15 @@ static inline int __attribute__((__unuse
 i80321_splraise(int ipl)
 {
 	int old = curcpl();
-	set_curcpl(ipl);
 
-	/* Don't let the compiler re-order this code with subsequent code */
-	__insn_barrier();
+	if (ipl > old) {
+		set_curcpl(ipl);
+		/*
+		 * Don't let the compiler re-order this code with
+		 * subsequent code
+		 */
+		__insn_barrier();
+	}
 
 	return (old);
 }



CVS commit: src/sys/arch/news68k/news68k

2021-08-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Aug  6 05:53:50 UTC 2021

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
Fix mm_md_physacc() to allow only accesses to a region of RAMs.

Note on NetBSD/news68k RAMs reserved by the PROM (at the end of the RAM)
are not managed.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/news68k/news68k/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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.108 src/sys/arch/news68k/news68k/machdep.c:1.109
--- src/sys/arch/news68k/news68k/machdep.c:1.108	Thu Jun 11 19:20:44 2020
+++ src/sys/arch/news68k/news68k/machdep.c	Fri Aug  6 05:53:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.108 2020/06/11 19:20:44 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.109 2021/08/06 05:53:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.108 2020/06/11 19:20:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.109 2021/08/06 05:53:50 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -992,8 +992,17 @@ consinit(void)
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
+	paddr_t memend;
 
-	return (pa < lowram || pa >= 0xfffc) ? EFAULT : 0;
+	/*
+	 * news68k has one contiguous memory segment.
+	 */
+	memend = lowram + ctob(physmem);
+
+	if (lowram <= pa && pa < memend) 
+		return 0;
+
+	return EFAULT;
 }
 
 int



CVS commit: src/sys/arch/hp300/hp300

2021-08-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Aug  6 05:22:21 UTC 2021

Modified Files:
src/sys/arch/hp300/hp300: machdep.c

Log Message:
Add comments how mm_md_physacc() for hp300 works.

mm_md_physacc() for all other hp300 pmap based m68k ports that copied
hp300 implemantation should have been fixed properly.

XXX: no mm(9) man pages that describe MD implementation API definitions.


To generate a diff of this commit:
cvs rdiff -u -r1.234 -r1.235 src/sys/arch/hp300/hp300/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/hp300/hp300/machdep.c
diff -u src/sys/arch/hp300/hp300/machdep.c:1.234 src/sys/arch/hp300/hp300/machdep.c:1.235
--- src/sys/arch/hp300/hp300/machdep.c:1.234	Thu Jun 11 19:20:43 2020
+++ src/sys/arch/hp300/hp300/machdep.c	Fri Aug  6 05:22:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.234 2020/06/11 19:20:43 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.235 2021/08/06 05:22:21 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.234 2020/06/11 19:20:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.235 2021/08/06 05:22:21 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -1164,6 +1164,10 @@ int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
 
+	/*
+	 * On the hp300, physical RAM is always located at the end of
+	 * the physical address space, i.e. from 0x to lowram.
+	 */
 	return (pa < lowram || pa >= 0xfffc) ? EFAULT : 0;
 }
 



CVS commit: src/sys/arch/x68k/x68k

2021-08-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Aug  6 04:21:56 UTC 2021

Modified Files:
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Fix broken mm_md_physacc().
- Fix access to main memory and extended memory.
  This makes /dev/mem work again.
- Introduce kauth(9) to access unmanaged memory area.
  Now you can read/write the internal I/O space via /dev/mem when
  securelevel = -1.
Thanks ryo@, tsutsui@ for advices and reviews.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.205 src/sys/arch/x68k/x68k/machdep.c:1.206
--- src/sys/arch/x68k/x68k/machdep.c:1.205	Thu Feb 11 02:37:11 2021
+++ src/sys/arch/x68k/x68k/machdep.c	Fri Aug  6 04:21:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.206 2021/08/06 04:21:56 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.206 2021/08/06 04:21:56 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1252,15 +1252,28 @@ cpu_intr_p(void)
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
-	uvm_physseg_t i;
+	int i;
 
-	for (i = uvm_physseg_get_first(); uvm_physseg_valid_p(i); i = uvm_physseg_get_next(i)) {
-		if (uvm_physseg_valid_p(i) == false)
-			break;
+	/* Main memory */
+	if (phys_basemem_seg.start <= pa && pa < phys_basemem_seg.end)
+		return 0;
 
-		if (ctob(uvm_physseg_get_start(i)) <= pa &&
-		pa < ctob(uvm_physseg_get_end(i)))
+#ifdef EXTENDED_MEMORY
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		if (phys_extmem_seg[i].start == phys_extmem_seg[i].end)
+			continue;
+		if (phys_extmem_seg[i].start <= pa &&
+		pa < phys_extmem_seg[i].end) {
 			return 0;
+		}
 	}
+#endif
+
+	/* I/O space */
+	if (INTIOBASE <= pa && pa < INTIOTOP) {
+		return kauth_authorize_machdep(kauth_cred_get(),
+		KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL);
+	}
+
 	return EFAULT;
 }



CVS commit: src/sys/dev

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 22:31:20 UTC 2021

Modified Files:
src/sys/dev/i2c: ssdfb_i2c.c
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: revert rev 1.14

Can't run the worker thread MPSAFE with spi(4) yet because most controller
drivers still lack MP safety. Cause issues when using multiple displays.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/ssdfb_i2c.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/ssdfbvar.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/i2c/ssdfb_i2c.c
diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.10 src/sys/dev/i2c/ssdfb_i2c.c:1.11
--- src/sys/dev/i2c/ssdfb_i2c.c:1.10	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/i2c/ssdfb_i2c.c	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $");
 
 #include 
 #include 
@@ -112,6 +112,7 @@ ssdfb_i2c_attach(device_t parent, device
 	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
 		flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
 
+	flags |= SSDFB_ATTACH_FLAG_MPSAFE;
 	sc->sc.sc_dev = self;
 	sc->sc_i2c_tag = ia->ia_tag;
 	sc->sc_i2c_addr = ia->ia_addr;

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.18 src/sys/dev/ic/ssdfb.c:1.19
--- src/sys/dev/ic/ssdfb.c:1.18	Thu Aug  5 19:07:09 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,6 +268,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	int error = 0;
 	long defattr;
 	const struct ssdfb_product *p;
+	int kt_flags;
 
 	p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
 	if (p == NULL) {
@@ -393,11 +394,15 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	if (sc->sc_is_console)
 		ssdfb_set_usepoll(sc, true);
 
-	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(>sc_cond_mtx, MUTEX_DEFAULT,
+	ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO);
 	cv_init(>sc_cond, "ssdfb");
-	error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE,
-	NULL, ssdfb_thread, sc,  >sc_thread, "%s",
-	device_xname(sc->sc_dev));
+	kt_flags = KTHREAD_MUSTJOIN;
+	/* XXX spi(4) is not MPSAFE yet. */
+	if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE))
+		kt_flags |= KTHREAD_MPSAFE;
+	error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc,
+	>sc_thread, "%s", device_xname(sc->sc_dev));
 	if (error) {
 		cv_destroy(>sc_cond);
 		mutex_destroy(>sc_cond_mtx);

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.9 src/sys/dev/ic/ssdfbvar.h:1.10
--- src/sys/dev/ic/ssdfbvar.h:1.9	Thu Aug  5 19:07:09 2021
+++ src/sys/dev/ic/ssdfbvar.h	Thu Aug  5 22:31:20 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.9 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.10 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #define SSDFB_ATTACH_FLAG_UPSIDEDOWN		0x0100
 #define SSDFB_ATTACH_FLAG_INVERSE		0x0200
 #define SSDFB_ATTACH_FLAG_CONSOLE		0x0400
+#define SSDFB_ATTACH_FLAG_MPSAFE		0x0800
 
 /*
  * Fundamental commands



CVS commit: src/sys/dev/spi

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:17:22 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: fix some constant names. NFC because the same cmd code is used


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.8 src/sys/dev/spi/ssdfb_spi.c:1.9
--- src/sys/dev/spi/ssdfb_spi.c:1.8	Thu Aug  5 19:08:59 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug  5 19:17:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $");
 
 #include 
 #include 
@@ -410,7 +410,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return 0;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_SET_ROW_ADDRESS;
+	cmd = SSD1353_CMD_SET_ROW_ADDRESS;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;
@@ -427,7 +427,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return error;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_SET_COLUMN_ADDRESS;
+	cmd = SSD1353_CMD_SET_COLUMN_ADDRESS;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;
@@ -439,7 +439,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void *
 		return error;
 
 	ssdfb_spi_4wire_set_dc(sc, 0);
-	cmd = SSD1322_CMD_WRITE_RAM;
+	cmd = SSD1353_CMD_WRITE_RAM;
 	error = spi_send(sc->sc_sh, sizeof(cmd), );
 	if (error)
 		return error;



CVS commit: src/sys/dev/spi

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:08:59 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support SSD1353 at spi(4)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.7 src/sys/dev/spi/ssdfb_spi.c:1.8
--- src/sys/dev/spi/ssdfb_spi.c:1.7	Tue Aug  3 11:30:25 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Thu Aug  5 19:08:59 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $");
 
 #include 
 #include 
@@ -70,6 +70,8 @@ static int	ssdfb_spi_xfer_rect_3wire_ssd
 static int	ssdfb_spi_cmd_4wire(void *, uint8_t *, size_t, bool);
 static int	ssdfb_spi_xfer_rect_4wire_ssd1322(void *, uint8_t, uint8_t,
 		uint8_t, uint8_t, uint8_t *, size_t, bool);
+static int	ssdfb_spi_xfer_rect_4wire_ssd1353(void *, uint8_t, uint8_t,
+		uint8_t, uint8_t, uint8_t *, size_t, bool);
 
 static void	ssdfb_bitstream_init(struct bs_state *, uint8_t *);
 static void	ssdfb_bitstream_append(struct bs_state *, uint8_t, uint8_t);
@@ -84,6 +86,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru
 static const struct device_compatible_entry compat_data[] = {
 	{ .compat = "solomon,ssd1306",	.value = SSDFB_PRODUCT_SSD1306_GENERIC },
 	{ .compat = "solomon,ssd1322",	.value = SSDFB_PRODUCT_SSD1322_GENERIC },
+	{ .compat = "solomon,ssd1353",	.value = SSDFB_PRODUCT_SSD1353_GENERIC },
+	{ .compat = "dep160128a",	.value = SSDFB_PRODUCT_DEP_160128A_RGB },
 	DEVICE_COMPAT_EOL
 };
 
@@ -154,28 +158,32 @@ ssdfb_spi_attach(device_t parent, device
 	sc->sc_3wiremode = true;
 #endif
 
+	sc->sc.sc_cmd = sc->sc_3wiremode
+	? ssdfb_spi_cmd_3wire
+	: ssdfb_spi_cmd_4wire;
+
 	switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) {
 	case SSDFB_PRODUCT_SSD1322_GENERIC:
-		if (sc->sc_3wiremode) {
-			sc->sc.sc_transfer_rect =
-			ssdfb_spi_xfer_rect_3wire_ssd1322;
-		} else {
-			sc->sc.sc_transfer_rect =
-			ssdfb_spi_xfer_rect_4wire_ssd1322;
-		}
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? ssdfb_spi_xfer_rect_3wire_ssd1322
+		: ssdfb_spi_xfer_rect_4wire_ssd1322;
+		break;
+	case SSDFB_PRODUCT_SSD1353_GENERIC:
+	case SSDFB_PRODUCT_DEP_160128A_RGB:
+		sc->sc.sc_transfer_rect = sc->sc_3wiremode
+		? NULL /* not supported here */
+		: ssdfb_spi_xfer_rect_4wire_ssd1353;
 		break;
-	default:
-		panic("ssdfb_spi_attach: product not implemented");
 	}
-	if (sc->sc_3wiremode) {
-		sc->sc.sc_cmd = ssdfb_spi_cmd_3wire;
-	} else {
-		sc->sc.sc_cmd = ssdfb_spi_cmd_4wire;
+
+	if (!sc->sc.sc_transfer_rect) {
+		aprint_error(": sc_transfer_rect not implemented\n");
+		return;
 	}
 
 	ssdfb_attach(>sc, flags);
 
-	device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n",
+	aprint_normal_dev(self, "%d-wire SPI interface\n",
 	sc->sc_3wiremode == true ? 3 : 4);
 }
 
@@ -381,3 +389,79 @@ ssdfb_spi_xfer_rect_4wire_ssd1322(void *
 
 	return 0;
 }
+
+static int
+ssdfb_spi_xfer_rect_4wire_ssd1353(void *cookie, uint8_t fromcol, uint8_t tocol,
+uint8_t fromrow, uint8_t torow, uint8_t *p, size_t stride, bool usepoll)
+{
+	struct ssdfb_spi_softc *sc = (struct ssdfb_spi_softc *)cookie;
+	uint8_t row;
+	size_t rlen = (tocol + 1 - fromcol) * 3;
+	uint8_t bitstream[160 * 3];
+	uint8_t *dstp, *srcp, *endp;
+	int error;
+	uint8_t cmd;
+	uint8_t data[2];
+
+	/*
+	 * Unlike iic(4), there is no way to force spi(4) to use polling.
+	 */
+	if (usepoll && !cold)
+		return 0;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_SET_ROW_ADDRESS;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	data[0] = fromrow;
+	data[1] = torow;
+	if (sc->sc.sc_upsidedown) {
+		/* fix picture outside frame on 160x128 panel */
+		data[0] += 132 - sc->sc.sc_p->p_height;
+		data[1] += 132 - sc->sc.sc_p->p_height;
+	}
+	error = spi_send(sc->sc_sh, sizeof(data), data);
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_SET_COLUMN_ADDRESS;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	data[0] = fromcol;
+	data[1] = tocol;
+	error = spi_send(sc->sc_sh, sizeof(data), data);
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 0);
+	cmd = SSD1322_CMD_WRITE_RAM;
+	error = spi_send(sc->sc_sh, sizeof(cmd), );
+	if (error)
+		return error;
+
+	ssdfb_spi_4wire_set_dc(sc, 1);
+	KASSERT(rlen <= sizeof(bitstream));
+	for (row = fromrow; row <= torow; row++) {
+		/* downconvert each row from 

CVS commit: src/sys/dev/ic

2021-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 19:07:09 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: support the SSD1353 controller and the DEP 160128A(1)-RGB display

DEP 160128A is a 160x128 18-bit RGB OLED display module advertised as
having an 8-bit parallel I/O interface. The controller can however attach
serially via spi(4) by moving jumper resistors J1 and J2 to GND position.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/ssdfbvar.h

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

Modified files:

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.17 src/sys/dev/ic/ssdfb.c:1.18
--- src/sys/dev/ic/ssdfb.c:1.17	Thu Aug  5 00:16:36 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 19:07:09 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -75,6 +75,7 @@ static void	ssdfb_cursor(void *, int, in
 /* hardware interface */
 static int	ssdfb_init_ssd1306(struct ssdfb_softc *);
 static int	ssdfb_init_ssd1322(struct ssdfb_softc *);
+static int	ssdfb_init_ssd1353(struct ssdfb_softc *);
 static int	ssdfb_set_contrast(struct ssdfb_softc *, uint8_t, bool);
 static int	ssdfb_set_display_on(struct ssdfb_softc *, bool, bool);
 static int	ssdfb_set_mode(struct ssdfb_softc *, u_int);
@@ -89,6 +90,7 @@ static void	ssdfb_set_usepoll(struct ssd
 static int	ssdfb_sync(struct ssdfb_softc *, bool);
 static int	ssdfb_sync_ssd1306(struct ssdfb_softc *, bool);
 static int	ssdfb_sync_ssd1322(struct ssdfb_softc *, bool);
+static int	ssdfb_sync_ssd1353(struct ssdfb_softc *, bool);
 static uint64_t	ssdfb_transpose_block(uint8_t *, size_t);
 
 /* misc helpers */
@@ -104,7 +106,8 @@ static const char *ssdfb_controller_name
 	[SSDFB_CONTROLLER_UNKNOWN] =	"unknown",
 	[SSDFB_CONTROLLER_SSD1306] =	"Solomon Systech SSD1306",
 	[SSDFB_CONTROLLER_SH1106] =	"Sino Wealth SH1106",
-	[SSDFB_CONTROLLER_SSD1322] =	"Solomon Systech SSD1322"
+	[SSDFB_CONTROLLER_SSD1322] =	"Solomon Systech SSD1322",
+	[SSDFB_CONTROLLER_SSD1353] =	"Solomon Systech SSD1353"
 };
 
 /*
@@ -204,6 +207,44 @@ static const struct ssdfb_product ssdfb_
 		.p_multiplex_ratio =	0x3f,
 		.p_init =		ssdfb_init_ssd1322,
 		.p_sync =		ssdfb_sync_ssd1322
+	},
+	{
+		.p_product_id =		SSDFB_PRODUCT_SSD1353_GENERIC,
+		.p_controller_id =	SSDFB_CONTROLLER_SSD1353,
+		.p_name =		"generic",
+		.p_width =		160,
+		.p_height =		132,
+		.p_bits_per_pixel =	32,
+		.p_rgb = 		true,
+		.p_panel_shift =	0,
+		.p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN
+		| __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK),
+		.p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH,
+		.p_fosc =		SSD1353_DEFAULT_FREQUENCY,
+		.p_fosc_div =		SSD1353_DEFAULT_DIVIDER,
+		.p_default_contrast =	SSD1353_DEFAULT_CONTRAST_CONTROL,
+		.p_multiplex_ratio =	0x83,
+		.p_init =		ssdfb_init_ssd1353,
+		.p_sync =		ssdfb_sync_ssd1353
+	},
+	{
+		.p_product_id =		SSDFB_PRODUCT_DEP_160128A_RGB,
+		.p_controller_id =	SSDFB_CONTROLLER_SSD1353,
+		.p_name =		"Display Elektronik GmbH DEP 160128A(1)-RGB",
+		.p_width =		160,
+		.p_height =		128,
+		.p_bits_per_pixel =	32,
+		.p_rgb = 		true,
+		.p_panel_shift =	0,
+		.p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN
+		| __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK),
+		.p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH,
+		.p_fosc =		SSD1353_DEFAULT_FREQUENCY,
+		.p_fosc_div =		SSD1353_DEFAULT_DIVIDER,
+		.p_default_contrast =	SSD1353_DEFAULT_CONTRAST_CONTROL,
+		.p_multiplex_ratio =	0x83,
+		.p_init =		ssdfb_init_ssd1353,
+		.p_sync =		ssdfb_sync_ssd1353
 	}
 };
 
@@ -872,18 +913,148 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s
 }
 
 static int
+ssdfb_init_ssd1353(struct ssdfb_softc *sc)
+{
+	int error;
+	uint8_t cmd[3];
+	bool usepoll = true;
+	uint8_t remap;
+
+	/*
+	 * Enter sleep.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_COMMAND_LOCK, SSD1353_COMMAND_UNLOCK_MAGIC);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_RESET);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_DEACTIVATE_SCROLL);
+	if (error)
+		return error;
+	SSDFB_CMD1(SSD1353_CMD_SET_DISPLAY_OFF);
+	if (error)
+		return error;
+
+	/*
+	 * Start charge pumps.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_VCOMH, sc->sc_p->p_vcomh_deselect_level);
+	if (error)
+		return error;
+	SSDFB_CMD2(SSD1353_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL,
+	SSD1353_DEFAULT_PRE_CHARGE_VOLTAGE_LEVEL);
+	if (error)
+		return error;
+
+	/*
+	 * Configure timing characteristics.
+	 */
+	SSDFB_CMD2(SSD1353_CMD_SET_FRONT_CLOCK_DIVIDER,
+	   

CVS commit: src/sys/dev/ic

2021-08-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 00:16:36 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: prepare for supporting rgb color displays


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/ssdfbvar.h

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

Modified files:

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.16 src/sys/dev/ic/ssdfb.c:1.17
--- src/sys/dev/ic/ssdfb.c:1.16	Thu Aug  5 00:02:51 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 00:16:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,16 +268,35 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 		goto out;
 	}
 #ifdef SSDFB_USE_NATIVE_DEPTH
-	ri->ri_depth =	sc->sc_p->p_bits_per_pixel;
+	ri->ri_depth = sc->sc_p->p_bits_per_pixel;
 #else
-	ri->ri_depth =	8;
+	if (sc->sc_p->p_rgb && sc->sc_p->p_bits_per_pixel == 32) {
+		ri->ri_depth = sc->sc_p->p_bits_per_pixel;
+		ri->ri_rnum = 8;
+		ri->ri_gnum = 8;
+		ri->ri_bnum = 8;
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+		ri->ri_rpos = 0;
+		ri->ri_gpos = 8;
+		ri->ri_bpos = 16;
+#else
+		ri->ri_rpos = 24;
+		ri->ri_gpos = 16;
+		ri->ri_bpos = 8;
+#endif
+	} else {
+		ri->ri_depth = 8;
+	}
 #endif
 	ri->ri_font =	sc->sc_font;
 	ri->ri_width =	sc->sc_p->p_width;
 	ri->ri_height =	sc->sc_p->p_height;
 	ri->ri_stride =	ri->ri_width * ri->ri_depth / 8;
 	ri->ri_hw =	sc;
-	ri->ri_flg =	RI_FULLCLEAR | RI_FORCEMONO;
+	ri->ri_flg =	RI_FULLCLEAR;
+	if (!sc->sc_p->p_rgb) {
+		ri->ri_flg |= RI_FORCEMONO;
+	}
 	sc->sc_ri_bits_len = round_page(ri->ri_stride * ri->ri_height);
 	ri->ri_bits	= (u_char *)uvm_km_alloc(kernel_map, sc->sc_ri_bits_len,
 		 0, UVM_KMF_WIRED);
@@ -290,7 +309,9 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	if (error)
 		goto out;
 
-	ri->ri_caps &= ~WSSCREEN_WSCOLORS;
+	if (!sc->sc_p->p_rgb) {
+		ri->ri_caps &= ~WSSCREEN_WSCOLORS;
+	}
 
 	/*
 	 * Save original emul ops & insert our damage notification hooks.
@@ -425,8 +446,10 @@ ssdfb_ioctl(void *v, void *vs, u_long cm
 	case WSDISPLAYIO_GET_FBINFO:
 		fbi = (struct wsdisplayio_fbinfo *)data;
 		error = wsdisplayio_get_fbinfo(>sc_ri, fbi);
-		fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen;
-		/* fbi->fbi_pixeltype = WSFB_GREYSCALE */;
+		if (!sc->sc_p->p_rgb) {
+			fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen;
+			/* fbi->fbi_pixeltype = WSFB_GREYSCALE */;
+		}
 		return error;
 	case WSDISPLAYIO_LINEBYTES:
 		*(u_int *)data = sc->sc_ri.ri_stride;
@@ -483,6 +506,8 @@ ssdfb_ioctl(void *v, void *vs, u_long cm
 		return 0;
 #endif
 	case WSDISPLAYIO_GETCMAP:
+		if (sc->sc_p->p_rgb)
+			return ENOTSUP;
 		wc = (struct wsdisplay_cmap *)data;
 		if (wc->index >= cmaplen ||
 		wc->count > cmaplen - wc->index)
@@ -1117,9 +1142,9 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 	 * Transfer rasops bitmap into gddram shadow buffer while keeping track
 	 * of the bounding box of the dirty region we scribbled over.
 	 */
-	x1 = sc->sc_p->p_width;
+	x1 = width;
 	x2 = -1;
-	y1 = sc->sc_p->p_height;
+	y1 = height;
 	y2 = -1;
 	blockp = (uint16_t*)sc->sc_gddram;
 	for (y = 0; y < height; y++) {

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.7 src/sys/dev/ic/ssdfbvar.h:1.8
--- src/sys/dev/ic/ssdfbvar.h:1.7	Mon Aug  2 14:00:48 2021
+++ src/sys/dev/ic/ssdfbvar.h	Thu Aug  5 00:16:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.8 2021/08/05 00:16:36 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -235,6 +235,13 @@
 #define SSD1353_CMD_SET_SECOND_PRECHARGE_SPEED		0x8a
 	#define SSD1353_DEFAULT_SECOND_PRECHARGE_SPEED	2
 #define SSD1353_CMD_REMAP_COLOR_DEPTH			0xa0
+	#define SSD1353_REMAP_NO_INCREMENT		__BIT(0)
+	#define SSD1353_REMAP_SEG_DIRECTION		__BIT(1)
+	#define SSD1353_REMAP_RGB			__BIT(2)
+	#define SSD1353_REMAP_LR			__BIT(3)
+	#define SSD1353_REMAP_COM_DIRECTION		__BIT(4)
+	#define SSD1353_REMAP_SPLIT_ODD_EVEN		__BIT(5)
+	#define SSD1353_REMAP_PIXEL_FORMAT_MASK		__BITS(7, 6)
 #define SSD1353_CMD_SET_DISPLAY_START_LINE		SSD1322_CMD_SET_DISPLAY_START_LINE
 #define SSD1353_CMD_SET_DISPLAY_OFFSET			SSD1322_CMD_SET_DISPLAY_OFFSET
 #define SSD1353_CMD_SET_VERTICAL_SCROLL_AREA		SSDFB_CMD_SET_VERTICAL_SCROLL_AREA
@@ -305,6 +312,7 @@ struct ssdfb_product {
 	intp_width;
 	intp_height;
 	intp_bits_per_pixel;
+	boolp_rgb;
 	intp_panel_shift;
 	uint8_tp_fosc;
 	uint8_tp_fosc_div;



CVS commit: src/sys/dev/ic

2021-08-04 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Aug  5 00:02:51 UTC 2021

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

Log Message:
ssdfb: make it work on big-endian


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/ssdfb.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/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.15 src/sys/dev/ic/ssdfb.c:1.16
--- src/sys/dev/ic/ssdfb.c:1.15	Mon Aug  2 14:00:48 2021
+++ src/sys/dev/ic/ssdfb.c	Thu Aug  5 00:02:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -1126,24 +1126,27 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 		src = (uint16_t*)>ri_bits[y * ri->ri_stride];
 		src32 = (uint32_t*)src;
 		for (x = 0; x < width_in_blocks; x++) {
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-#  ifdef SSDFB_USE_NATIVE_DEPTH
+#ifdef SSDFB_USE_NATIVE_DEPTH
 			raw_block =
 			((*src << 12) & 0xf000) |
-			((*src << 4) & 0x0f00) |
-			((*src >> 4) & 0x00f0) |
+			((*src << 4)  & 0x0f00) |
+			((*src >> 4)  & 0x00f0) |
 			((*src >> 12) & 0x000f);
 			src++;
-#  else
+#else
 			raw_block =
+#  if _BYTE_ORDER == _LITTLE_ENDIAN
 			((*src32 <<  8) & 0x0f00) |
 			((*src32 <<  4) & 0xf000) |
 			((*src32 >> 16) & 0x000f) |
 			((*src32 >> 20) & 0x00f0);
+#  else
+			((*src32 >> 24) & 0x000f) |
+			((*src32 >> 12) & 0x00f0) |
+			((*src32  ) & 0x0f00) |
+			((*src32 << 12) & 0xf000);
 #  endif
 			src32++;
-#else
-#  error please add big endian host support here
 #endif
 			if (raw_block != *blockp) {
 *blockp = raw_block;
@@ -1159,7 +1162,6 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s
 			blockp++;
 		}
 	}
-
 	blockp = (uint16_t*)sc->sc_gddram;
 	if (x2 != -1)
 		return sc->sc_transfer_rect(sc->sc_cookie,



CVS commit: src/sys/dev/dkwedge

2021-08-04 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Wed Aug  4 21:44:42 UTC 2021

Modified Files:
src/sys/dev/dkwedge: dk.c

Log Message:
Swap and Dump uses DEV_BSIZE units. Translate from device sectors like
regular I/O (strategy).


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.105 src/sys/dev/dkwedge/dk.c:1.106
--- src/sys/dev/dkwedge/dk.c:1.105	Wed Jun  2 17:56:40 2021
+++ src/sys/dev/dkwedge/dk.c	Wed Aug  4 21:44:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $	*/
+/*	$NetBSD: dk.c,v 1.106 2021/08/04 21:44:41 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.106 2021/08/04 21:44:41 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1639,6 +1639,7 @@ static int
 dksize(dev_t dev)
 {
 	struct dkwedge_softc *sc = dkwedge_lookup(dev);
+	uint64_t p_size;
 	int rv = -1;
 
 	if (sc == NULL)
@@ -1651,12 +1652,13 @@ dksize(dev_t dev)
 
 	/* Our content type is static, no need to open the device. */
 
+	p_size   = sc->sc_size << sc->sc_parent->dk_blkshift;
 	if (strcmp(sc->sc_ptype, DKW_PTYPE_SWAP) == 0) {
 		/* Saturate if we are larger than INT_MAX. */
-		if (sc->sc_size > INT_MAX)
+		if (p_size > INT_MAX)
 			rv = INT_MAX;
 		else
-			rv = (int) sc->sc_size;
+			rv = (int) p_size;
 	}
 
 	mutex_exit(>sc_parent->dk_rawlock);
@@ -1675,6 +1677,7 @@ dkdump(dev_t dev, daddr_t blkno, void *v
 {
 	struct dkwedge_softc *sc = dkwedge_lookup(dev);
 	const struct bdevsw *bdev;
+	uint64_t p_size, p_offset;
 	int rv = 0;
 
 	if (sc == NULL)
@@ -1697,16 +1700,20 @@ dkdump(dev_t dev, daddr_t blkno, void *v
 		rv = EINVAL;
 		goto out;
 	}
-	if (blkno < 0 || blkno + size / DEV_BSIZE > sc->sc_size) {
+
+	p_offset = sc->sc_offset << sc->sc_parent->dk_blkshift;
+	p_size   = sc->sc_size << sc->sc_parent->dk_blkshift;
+
+	if (blkno < 0 || blkno + size / DEV_BSIZE > p_size) {
 		printf("%s: blkno (%" PRIu64 ") + size / DEV_BSIZE (%zu) > "
-		"sc->sc_size (%" PRIu64 ")\n", __func__, blkno,
-		size / DEV_BSIZE, sc->sc_size);
+		"p_size (%" PRIu64 ")\n", __func__, blkno,
+		size / DEV_BSIZE, p_size);
 		rv = EINVAL;
 		goto out;
 	}
 
 	bdev = bdevsw_lookup(sc->sc_pdev);
-	rv = (*bdev->d_dump)(sc->sc_pdev, blkno + sc->sc_offset, va, size);
+	rv = (*bdev->d_dump)(sc->sc_pdev, blkno + p_offset, va, size);
 
 out:
 	mutex_exit(>sc_parent->dk_rawlock);



CVS commit: src/sys/netinet

2021-08-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug  4 08:47:10 UTC 2021

Modified Files:
src/sys/netinet: tcp_usrreq.c

Log Message:
Get the value of the right variable (from RVP)


To generate a diff of this commit:
cvs rdiff -u -r1.229 -r1.230 src/sys/netinet/tcp_usrreq.c

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

Modified files:

Index: src/sys/netinet/tcp_usrreq.c
diff -u src/sys/netinet/tcp_usrreq.c:1.229 src/sys/netinet/tcp_usrreq.c:1.230
--- src/sys/netinet/tcp_usrreq.c:1.229	Mon Mar  8 13:17:27 2021
+++ src/sys/netinet/tcp_usrreq.c	Wed Aug  4 04:47:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $	*/
+/*	$NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.229 2021/03/08 18:17:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.230 2021/08/04 08:47:10 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -480,7 +480,7 @@ tcp_ctloutput(int op, struct socket *so,
 			optval = tp->t_keepcnt;
 			goto setval;
 		case TCP_KEEPINIT:
-			optval = tp->t_keepcnt;
+			optval = tp->t_keepinit;
 setval:			error = sockopt_set(sopt, , sizeof(optval));
 			break;
 		default:



CVS commit: src/sys

2021-08-03 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  3 23:12:14 UTC 2021

Modified Files:
src/sys/arch/mips/cavium: octeon_cpunode.c
src/sys/arch/powerpc/include/booke: spr.h
src/sys/arch/riscv/riscv: fpu.c locore.S
src/sys/arch/vax/include: ka48.h
src/sys/dev/i2c: ds1307.c
src/sys/sys: evcnt.h

Log Message:
Fix various typos in comments. Also add missing NetBSD RCS Id in some of these 
files.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/mips/cavium/octeon_cpunode.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/include/booke/spr.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/riscv/fpu.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/riscv/riscv/locore.S
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/vax/include/ka48.h
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/i2c/ds1307.c
cvs rdiff -u -r1.9 -r1.10 src/sys/sys/evcnt.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/mips/cavium/octeon_cpunode.c
diff -u src/sys/arch/mips/cavium/octeon_cpunode.c:1.19 src/sys/arch/mips/cavium/octeon_cpunode.c:1.20
--- src/sys/arch/mips/cavium/octeon_cpunode.c:1.19	Sat Apr 24 23:36:42 2021
+++ src/sys/arch/mips/cavium/octeon_cpunode.c	Tue Aug  3 23:12:14 2021
@@ -1,3 +1,5 @@
+/*  $NetBSD: octeon_cpunode.c,v 1.20 2021/08/03 23:12:14 andvar Exp $   */
+
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +31,7 @@
 #define __INTR_PRIVATE
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.19 2021/04/24 23:36:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon_cpunode.c,v 1.20 2021/08/03 23:12:14 andvar Exp $");
 
 #include "locators.h"
 #include "cpunode.h"
@@ -214,7 +216,7 @@ octeon_cpu_init(struct cpu_info *ci)
 	(*mips64r2_locore_vec.ljv_tlb_invalidate_all)();
 	mips3_cp0_wired_write(pmap_tlb0_info.ti_wired);
 
-	// First thing is setup the execption vectors for this cpu.
+	// First thing is setup the exception vectors for this cpu.
 	mips64r2_vector_init(_splsw);
 
 	// Next rewrite those exceptions to use this cpu's cpu_info.

Index: src/sys/arch/powerpc/include/booke/spr.h
diff -u src/sys/arch/powerpc/include/booke/spr.h:1.13 src/sys/arch/powerpc/include/booke/spr.h:1.14
--- src/sys/arch/powerpc/include/booke/spr.h:1.13	Sat Dec 27 12:36:48 2014
+++ src/sys/arch/powerpc/include/booke/spr.h	Tue Aug  3 23:12:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.13 2014/12/27 12:36:48 nonaka Exp $	*/
+/*	$NetBSD: spr.h,v 1.14 2021/08/03 23:12:14 andvar Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -280,7 +280,7 @@
 #define   TSR_ENW		  0x8000 /* Enable Next Watchdog (W1C) */
 #define   TSR_WIS		  0x4000 /* Watchdog Interrupt Status (W1C) */
 #define   TSR_WRS		  0x3000 /* Watchdog Reset Status (W1C) */
-#define   TSR_DIS		  0x0800 /* Decementer Interrupt Status (W1C) */
+#define   TSR_DIS		  0x0800 /* Decrementer Interrupt Status (W1C) */
 #define   TSR_FIS		  0x0400 /* Fixed-interval Interrupt Status (W1C) */
 #define	SPR_TCR			340	/* E... Timer Control Register */
 #define   TCR_WP		  0xc000 /* Watchdog Period */
@@ -290,7 +290,7 @@
 #define   TCR_WRC		  0x3000 /* Watchdog Timer Reset Control */
 #define   TCR_WRC_RESET		  0x2000
 #define   TCR_WIE		  0x0800 /* Watchdog Time Interrupt Enable */
-#define   TCR_DIE		  0x0400 /* Decremnter Interrupt Enable */
+#define   TCR_DIE		  0x0400 /* Decrementer Interrupt Enable */
 #define   TCR_FP		  0x0300 /* Fixed-interval Timer Period */
 #define	  TCR_FP_2_N(n)		  64 - (n)) & 0x30) << 20) | (((64 - (n)) & 0xf) << 13))
 #define	  TCR_FP_2_64		  0x
@@ -337,8 +337,8 @@
 #define  SPEFSCR_FDBZ		  0x0400 /* 21: Embedded Floating-Point Divide By Zero Error */
 #define  SPEFSCR_FUNF		  0x0200 /* 22: Embedded Floating-Point Underflow Error */
 #define  SPEFSCR_FOVF		  0x0100 /* 23: Embedded Floating-Point Overflow Error */
-#define  SPEFSCR_FINXE		  0x0040 /* 25: Embedded Floating-Point Inexact Execption Enable */
-#define  SPEFSCR_FINVE		  0x0020 /* 26: Embedded Floating-Point Invalid Operation/Input Error Execption Enable */
+#define  SPEFSCR_FINXE		  0x0040 /* 25: Embedded Floating-Point Inexact Exception Enable */
+#define  SPEFSCR_FINVE		  0x0020 /* 26: Embedded Floating-Point Invalid Operation/Input Error Exception Enable */
 #define  SPEFSCR_FDBZE		  0x0010 /* 27: Embedded Floating-Point Divide By Zero Exception Enable */
 #define  SPEFSCR_FUNFE		  0x0008 /* 28: Embedded Floating-Point Underflow Exception Enable */
 #define  SPEFSCR_FOVFE		  0x0004 /* 29: Embedded Floating-Point Overflow Exception Enable */
@@ -347,8 +347,8 @@
 #define  SPEFSCR_FRMC_UPWARD	  0x0002 /* Round toward +infinity */
 #define  SPEFSCR_FRMC_TOWARDZERO  0x0001 /* Round toward zero */
 #define  SPEFSCR_FRMC_TONEAREST	  

CVS commit: src/sys/kern

2021-08-03 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Aug  3 20:27:08 UTC 2021

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

Log Message:
in sbsavetimestamp(), initialize struct timeval to 0 with memset() so that
the implicit padding is initialized.  this avoids later copying uninitialized
memory out to user space.  detected by KMSAN.


To generate a diff of this commit:
cvs rdiff -u -r1.294 -r1.295 src/sys/kern/uipc_socket.c

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

Modified files:

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.294 src/sys/kern/uipc_socket.c:1.295
--- src/sys/kern/uipc_socket.c:1.294	Fri Dec 11 03:00:09 2020
+++ src/sys/kern/uipc_socket.c	Tue Aug  3 20:27:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.294 2020/12/11 03:00:09 thorpej Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.295 2021/08/03 20:27:08 chs Exp $	*/
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.294 2020/12/11 03:00:09 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.295 2021/08/03 20:27:08 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2432,6 +2432,7 @@ sbsavetimestamp(int opt, struct mbuf **m
 	struct timeval tv;
 	int error;
 
+	memset(, 0, sizeof(tv));
 	microtime();
 
 	MODULE_HOOK_CALL(uipc_socket_50_sbts_hook, (opt, ), enosys(), error);



CVS commit: src/sys/kern

2021-08-03 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Tue Aug  3 20:25:43 UTC 2021

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

Log Message:
initialize wc_unused to 0, to avoid writing uninitialized memory to disk.
detected by KMSAN.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/kern/vfs_wapbl.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_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.108 src/sys/kern/vfs_wapbl.c:1.109
--- src/sys/kern/vfs_wapbl.c:1.108	Sun Apr 12 17:02:52 2020
+++ src/sys/kern/vfs_wapbl.c	Tue Aug  3 20:25:43 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.108 2020/04/12 17:02:52 jdolecek Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.109 2021/08/03 20:25:43 chs Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.108 2020/04/12 17:02:52 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.109 2021/08/03 20:25:43 chs Exp $");
 
 #include 
 #include 
@@ -2559,6 +2559,7 @@ wapbl_write_blocks(struct wapbl *wl, off
 		wc->wc_type = WAPBL_WC_BLOCKS;
 		wc->wc_len = blocklen;
 		wc->wc_blkcount = 0;
+		wc->wc_unused = 0;
 		while (bp && (wc->wc_blkcount < wl->wl_brperjblock)) {
 			/*
 			 * Make sure all the physical block numbers are up to
@@ -2647,6 +2648,7 @@ wapbl_write_revocations(struct wapbl *wl
 		wc->wc_type = WAPBL_WC_REVOCATIONS;
 		wc->wc_len = blocklen;
 		wc->wc_blkcount = 0;
+		wc->wc_unused = 0;
 		while (wd && (wc->wc_blkcount < wl->wl_brperjblock)) {
 			wc->wc_blocks[wc->wc_blkcount].wc_daddr =
 			wd->wd_blkno;



CVS commit: src/sys/dev/spi

2021-08-03 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Tue Aug  3 11:30:26 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support having an optional reset pin


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.6 src/sys/dev/spi/ssdfb_spi.c:1.7
--- src/sys/dev/spi/ssdfb_spi.c:1.6	Sun Aug  1 14:56:18 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Tue Aug  3 11:30:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ struct ssdfb_spi_softc {
 	struct spi_handle	*sc_sh;
 #ifdef FDT
 	struct fdtbus_gpio_pin	*sc_gpio_dc;
+	struct fdtbus_gpio_pin	*sc_gpio_res;
 #endif
 	bool			sc_3wiremode;
 };
@@ -133,13 +134,22 @@ ssdfb_spi_attach(device_t parent, device
 	 * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO
 	 * pin for the command/data bit.
 	 */
-	sc->sc_3wiremode = true;
 #ifdef FDT
 	const int phandle = sa->sa_cookie;
-	sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
+	sc->sc_gpio_dc =
+	fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
 	if (!sc->sc_gpio_dc)
-		sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
+		sc->sc_gpio_dc =
+		fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
 	sc->sc_3wiremode = (sc->sc_gpio_dc == NULL);
+	sc->sc_gpio_res =
+	fdtbus_gpio_acquire(phandle, "res-gpio", GPIO_PIN_OUTPUT);
+	if (sc->sc_gpio_res) {
+		fdtbus_gpio_write_raw(sc->sc_gpio_res, 0);
+		DELAY(100);
+		fdtbus_gpio_write_raw(sc->sc_gpio_res, 1);
+		DELAY(100);
+	}
 #else
 	sc->sc_3wiremode = true;
 #endif



CVS commit: src/sys/dev/sdmmc

2021-08-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  3 07:54:39 UTC 2021

Modified Files:
src/sys/dev/sdmmc: sdmmc_mem.c

Log Message:
 Use unsigned to avoid undefined behavior in sdmmc_mem_sd_switch().
Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sdmmc/sdmmc_mem.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/sdmmc/sdmmc_mem.c
diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.73 src/sys/dev/sdmmc/sdmmc_mem.c:1.74
--- src/sys/dev/sdmmc/sdmmc_mem.c:1.73	Sun Jun 13 09:50:02 2021
+++ src/sys/dev/sdmmc/sdmmc_mem.c	Tue Aug  3 07:54:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $	*/
+/*	$NetBSD: sdmmc_mem.c,v 1.74 2021/08/03 07:54:39 msaitoh Exp $	*/
 /*	$OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
 /* Routines for SD/MMC memory cards. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.74 2021/08/03 07:54:39 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -1604,8 +1604,8 @@ sdmmc_mem_sd_switch(struct sdmmc_functio
 	cmd.c_datalen = statlen;
 	cmd.c_blklen = statlen;
 	cmd.c_opcode = SD_SEND_SWITCH_FUNC;
-	cmd.c_arg =
-	(!!mode << 31) | (function << gsft) | (0x00ff & ~(0xf << gsft));
+	cmd.c_arg = ((uint32_t)!!mode << 31) |
+	(function << gsft) | (0x00ff & ~(0xf << gsft));
 	cmd.c_flags = SCF_CMD_ADTC | SCF_CMD_READ | SCF_RSP_R1 | SCF_RSP_SPI_R1;
 	if (ISSET(sc->sc_caps, SMC_CAPS_DMA))
 		cmd.c_dmamap = sc->sc_dmap;



CVS commit: src/sys/dev/pci

2021-08-02 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Tue Aug  3 01:08:18 UTC 2021

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

Log Message:
Fix locking against myself reported by rin@n.o.

In some machine, INTx interrupts occurs for some reason while holding
txq_lock in softint context.
e.g. https://dmesgd.nycbug.org/index.cgi?do=view=6139

The panic message is the following.

[  50.1699480] panic: LOCKDEBUG: Mutex error: mutex_vector_enter,467: locking 
against myself
[  50.1800188] cpu0: Begin traceback...
[  50.1800188] 0xc7a29ac4: netbsd:db_panic+0xc
[  50.1900018] 0xc7a29adc: netbsd:vpanic+0x120
[  50.1999533] 0xc7a29af4: netbsd:aprint_debug
[  50.1999533] 0xc7a29b34: netbsd:lockdebug_abort1+0x18c
[  50.2099719] 0xc7a29b74: netbsd:lockdebug_wantlock+0x1e8
[  50.2199525] 0xc7a29bb4: netbsd:mutex_enter+0x288
[  50.2299642] 0xc7a29be4: netbsd:wm_intr_legacy+0x9c
[  50.2299642] 0xc7a29c2c: netbsd:i80321_intr_dispatch+0x138
[  50.2399631] 0xc7a29de4: netbsd:irq_entry+0x98
[  50.2499452] 0xc7a29e24: netbsd:entropy_enter+0x88
[  50.256] 0xc7a29e6c: netbsd:rnd_add_data_1+0x50
[  50.2699565] 0xc7a29ebc: netbsd:rnd_add_data+0x10c
[  50.2699565] 0xc7a29ed4: netbsd:rnd_add_uint32+0x28
[  50.2799524] 0xc7a29f1c: netbsd:wm_txeof+0x2c0
[  50.2899527] 0xc7a29f5c: netbsd:wm_handle_queue+0x44
[  50.3000257] 0xc7a29fac: netbsd:softint_thread+0x130
[  50.3100119] cpu0: End traceback...


To fix this panic, stop wm(4) interrupts before calling softint.
This behavior is similar to MSI-X polling mode.

Reviewed by msaitoh@n.o, tested by rin@n.o, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.705 -r1.706 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.705 src/sys/dev/pci/if_wm.c:1.706
--- src/sys/dev/pci/if_wm.c:1.705	Wed Jun 16 00:21:18 2021
+++ src/sys/dev/pci/if_wm.c	Tue Aug  3 01:08:18 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9774,6 +9774,20 @@ wm_sched_handle_queue(struct wm_softc *s
 		softint_schedule(wmq->wmq_si);
 }
 
+static inline void
+wm_legacy_intr_disable(struct wm_softc *sc)
+{
+
+	CSR_WRITE(sc, WMREG_IMC, 0xU);
+}
+
+static inline void
+wm_legacy_intr_enable(struct wm_softc *sc)
+{
+
+	CSR_WRITE(sc, WMREG_IMS, sc->sc_icr);
+}
+
 /*
  * wm_intr_legacy:
  *
@@ -9788,6 +9802,7 @@ wm_intr_legacy(void *arg)
 	struct wm_rxqueue *rxq = >wmq_rxq;
 	uint32_t icr, rndval = 0;
 	int handled = 0;
+	bool more = false;
 
 	while (1 /* CONSTCOND */) {
 		icr = CSR_READ(sc, WMREG_ICR);
@@ -9822,7 +9837,7 @@ wm_intr_legacy(void *arg)
 		 * as if_percpuq_enqueue() just call softint_schedule().
 		 * So, we can call wm_rxeof() in interrupt context.
 		 */
-		wm_rxeof(rxq, UINT_MAX);
+		more = wm_rxeof(rxq, UINT_MAX);
 
 		mutex_exit(rxq->rxq_lock);
 		mutex_enter(txq->txq_lock);
@@ -9840,7 +9855,7 @@ wm_intr_legacy(void *arg)
 			WM_Q_EVCNT_INCR(txq, txdw);
 		}
 #endif
-		wm_txeof(txq, UINT_MAX);
+		more |= wm_txeof(txq, UINT_MAX);
 
 		mutex_exit(txq->txq_lock);
 		WM_CORE_LOCK(sc);
@@ -9869,8 +9884,9 @@ wm_intr_legacy(void *arg)
 
 	rnd_add_uint32(>rnd_source, rndval);
 
-	if (handled) {
+	if (more) {
 		/* Try to get more packets going. */
+		wm_legacy_intr_disable(sc);
 		wmq->wmq_txrx_use_workqueue = sc->sc_txrx_use_workqueue;
 		wm_sched_handle_queue(sc, wmq);
 	}
@@ -9883,6 +9899,10 @@ wm_txrxintr_disable(struct wm_queue *wmq
 {
 	struct wm_softc *sc = wmq->wmq_txq.txq_sc;
 
+	if (__predict_false(!wm_is_using_msix(sc))) {
+		return wm_legacy_intr_disable(sc);
+	}
+
 	if (sc->sc_type == WM_T_82574)
 		CSR_WRITE(sc, WMREG_IMC,
 		ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id));
@@ -9900,6 +9920,10 @@ wm_txrxintr_enable(struct wm_queue *wmq)
 
 	wm_itrs_calculate(sc, wmq);
 
+	if (__predict_false(!wm_is_using_msix(sc))) {
+		return wm_legacy_intr_enable(sc);
+	}
+
 	/*
 	 * ICR_OTHER which is disabled in wm_linkintr_msix() is enabled here.
 	 * There is no need to care about which of RXQ(0) and RXQ(1) enable



CVS commit: src/sys/external/bsd/drm2/linux

2021-08-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  2 23:14:15 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_reservation.c

Log Message:
drm: Plug another fence leak.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
src/sys/external/bsd/drm2/linux/linux_reservation.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/external/bsd/drm2/linux/linux_reservation.c
diff -u src/sys/external/bsd/drm2/linux/linux_reservation.c:1.13 src/sys/external/bsd/drm2/linux/linux_reservation.c:1.14
--- src/sys/external/bsd/drm2/linux/linux_reservation.c:1.13	Mon Aug  2 20:20:54 2021
+++ src/sys/external/bsd/drm2/linux/linux_reservation.c	Mon Aug  2 23:14:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_reservation.c,v 1.13 2021/08/02 20:20:54 riastradh Exp $	*/
+/*	$NetBSD: linux_reservation.c,v 1.14 2021/08/02 23:14:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.13 2021/08/02 20:20:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.14 2021/08/02 23:14:15 riastradh Exp $");
 
 #include 
 #include 
@@ -1003,6 +1003,7 @@ top:
 		 * assume the event is not ready.
 		 */
 		if (!claimed || callback) {
+			fence_put(fence);
 			revents = 0;
 			break;
 		}



CVS commit: src/sys/dev/raidframe

2021-08-02 Thread Greg Oster
Module Name:src
Committed By:   oster
Date:   Mon Aug  2 22:37:29 UTC 2021

Modified Files:
src/sys/dev/raidframe: raidframevar.h rf_raid.h

Log Message:
Accidentally commited some other changes that weren't quite ready.  Add
these changes to fix the build.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/raidframevar.h
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_raid.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/raidframe/raidframevar.h
diff -u src/sys/dev/raidframe/raidframevar.h:1.21 src/sys/dev/raidframe/raidframevar.h:1.22
--- src/sys/dev/raidframe/raidframevar.h:1.21	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/raidframevar.h	Mon Aug  2 22:37:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: raidframevar.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */
+/*	$NetBSD: raidframevar.h,v 1.22 2021/08/02 22:37:29 oster Exp $ */
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -355,6 +355,7 @@ typedef RF_uint32 RF_ReconReqFlags_t;
 /* flags that can be put in the rf_recon_req structure */
 #define RF_FDFLAGS_NONE   0x0	/* just fail the disk */
 #define RF_FDFLAGS_RECON  0x1	/* fail and initiate recon */
+#define RF_FDFLAGS_RECON_FORCE  0x2	/* fail and initiate recon, ignoring errors */
 
 struct rf_recon_req {		/* used to tell the kernel to fail a disk */
 	RF_RowCol_t col;

Index: src/sys/dev/raidframe/rf_raid.h
diff -u src/sys/dev/raidframe/rf_raid.h:1.49 src/sys/dev/raidframe/rf_raid.h:1.50
--- src/sys/dev/raidframe/rf_raid.h:1.49	Fri Jul 23 00:54:45 2021
+++ src/sys/dev/raidframe/rf_raid.h	Mon Aug  2 22:37:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_raid.h,v 1.49 2021/07/23 00:54:45 oster Exp $	*/
+/*	$NetBSD: rf_raid.h,v 1.50 2021/08/02 22:37:29 oster Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -187,6 +187,7 @@ struct RF_Raid_s {
 	RF_HeadSepLimit_t headSepLimit;
 	int numFloatingReconBufs;
 	int reconInProgress;
+	int forceRecon;
 	rf_declare_cond2(waitForReconCond);	/* goes with raidPtr->mutex */
 	RF_RaidReconDesc_t *reconDesc;	/* reconstruction descriptor */
 	RF_ReconCtrl_t *reconControl;	/* reconstruction control structure



CVS commit: src/sys/external/bsd/drm2/linux

2021-08-02 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Aug  2 20:20:54 UTC 2021

Modified Files:
src/sys/external/bsd/drm2/linux: linux_reservation.c

Log Message:
drm: Release fence if we're about to return too.

Should fix another fence leak.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 \
src/sys/external/bsd/drm2/linux/linux_reservation.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/external/bsd/drm2/linux/linux_reservation.c
diff -u src/sys/external/bsd/drm2/linux/linux_reservation.c:1.12 src/sys/external/bsd/drm2/linux/linux_reservation.c:1.13
--- src/sys/external/bsd/drm2/linux/linux_reservation.c:1.12	Sun Jun 27 08:10:36 2021
+++ src/sys/external/bsd/drm2/linux/linux_reservation.c	Mon Aug  2 20:20:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_reservation.c,v 1.12 2021/06/27 08:10:36 riastradh Exp $	*/
+/*	$NetBSD: linux_reservation.c,v 1.13 2021/08/02 20:20:54 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.12 2021/06/27 08:10:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_reservation.c,v 1.13 2021/08/02 20:20:54 riastradh Exp $");
 
 #include 
 #include 
@@ -794,9 +794,9 @@ wait:
 	KASSERT(fence != NULL);
 	rcu_read_unlock();
 	ret = fence_wait_timeout(fence, intr, timeout);
+	fence_put(fence);
 	if (ret <= 0)
 		return ret;
-	fence_put(fence);
 	KASSERT(ret <= timeout);
 	timeout = ret;
 	goto top;



CVS commit: src/sys/dev/ic

2021-08-02 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  2 14:00:48 UTC 2021

Modified Files:
src/sys/dev/ic: ssdfb.c ssdfbvar.h

Log Message:
ssdfb: define SSD1353 command set

also adjust some SSD1322 command names


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/ssdfb.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/ssdfbvar.h

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

Modified files:

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.14 src/sys/dev/ic/ssdfb.c:1.15
--- src/sys/dev/ic/ssdfb.c:1.14	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/ic/ssdfb.c	Mon Aug  2 14:00:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -271,7 +271,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int
 	ri->ri_depth =	sc->sc_p->p_bits_per_pixel;
 #else
 	ri->ri_depth =	8;
-#endif	
+#endif
 	ri->ri_font =	sc->sc_font;
 	ri->ri_width =	sc->sc_p->p_width;
 	ri->ri_height =	sc->sc_p->p_height;
@@ -774,14 +774,14 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s
 	if (error)
 		return error;
 	SSDFB_CMD2(SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD,
-	SSD1322_DEFAULT_SECOND_PRECHARGE);
+	SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD);
 	if (error)
 		return error;
 
 	/*
 	 * Configure physical display panel layout.
 	 */
-	SSDFB_CMD2(SSD1322_CMD_SET_MUX_RATIO, sc->sc_p->p_multiplex_ratio);
+	SSDFB_CMD2(SSD1322_CMD_SET_MULTIPLEX_RATIO, sc->sc_p->p_multiplex_ratio);
 	if (error)
 		return error;
 	if (sc->sc_upsidedown)

Index: src/sys/dev/ic/ssdfbvar.h
diff -u src/sys/dev/ic/ssdfbvar.h:1.6 src/sys/dev/ic/ssdfbvar.h:1.7
--- src/sys/dev/ic/ssdfbvar.h:1.6	Fri Jul 30 13:44:09 2021
+++ src/sys/dev/ic/ssdfbvar.h	Mon Aug  2 14:00:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.6 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -154,13 +154,12 @@
 #define SSD1322_CMD_SET_DISPLAY_START_LINE		0xa1
 #define SSD1322_CMD_SET_DISPLAY_OFFSET			0xa2
 
-/* These are the same as SSDFB generic commands */
-#define SSD1322_CMD_ENTIRE_DISPLAY_OFF			0xa4
-#define SSD1322_CMD_ENTIRE_DISPLAY_ON			0xa5
-#define SSD1322_CMD_NORMAL_DISPLAY			0xa6
-#define SSD1322_CMD_INVERSE_DISPLAY			0xa7
-#define SSD1322_CMD_SET_SLEEP_MODE_ON			0xae
-#define SSD1322_CMD_SET_SLEEP_MODE_OFF			0xaf
+#define SSD1322_CMD_ENTIRE_DISPLAY_OFF			SSDFB_CMD_ENTIRE_DISPLAY_OFF
+#define SSD1322_CMD_ENTIRE_DISPLAY_ON			SSDFB_CMD_ENTIRE_DISPLAY_ON
+#define SSD1322_CMD_NORMAL_DISPLAY			SSDFB_CMD_SET_NORMAL_DISPLAY
+#define SSD1322_CMD_INVERSE_DISPLAY			SSDFB_CMD_SET_INVERSE_DISPLAY
+#define SSD1322_CMD_SET_SLEEP_MODE_ON			SSDFB_CMD_SET_DISPLAY_OFF
+#define SSD1322_CMD_SET_SLEEP_MODE_OFF			SSDFB_CMD_SET_DISPLAY_ON
 
 #define SSD1322_CMD_ENABLE_PARTIAL_DISPLAY		0xa8
 #define SSD1322_CMD_EXIT_PARTIAL_DISPLAY		0xa9
@@ -190,7 +189,7 @@
 	#define SSD1322_GPIO1_LOW			__BIT(3)
 	#define SSD1322_GPIO1_HIGH			__BITS(3, 2)
 #define SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD		0xb6
-	#define SSD1322_DEFAULT_SECOND_PRECHARGE	8
+	#define SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD	8
 #define SSD1322_CMD_SET_GRAY_SCALE_TABLE		0xb8
 #define SSD1322_CMD_SET_DEFAULT_GRAY_SCALE_TABLE	0xb9
 #define SSD1322_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL	0xbb
@@ -201,13 +200,73 @@
 	#define SSD1322_DEFAULT_CONTRAST_CURRENT	0x7f
 #define SSD1322_CMD_MASTER_CONTRAST_CURRENT_CONTROL	0xc7
 	#define SSD1322_DEFAULT_MASTER_CONTRAST_CURRENT_CONTROL	0xf
-#define SSD1322_CMD_SET_MUX_RATIO			0xca
+#define SSD1322_CMD_SET_MULTIPLEX_RATIO			0xca
 #define SSD1322_CMD_DISPLAY_ENHANCEMENT_B		0xd1
 	#define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC1	0xa2
 	#define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC2	0x20
 #define SSD1322_CMD_SET_COMMAND_LOCK			0xfd
 	#define SSD1322_COMMAND_UNLOCK_MAGIC		0x12
 	#define SSD1322_COMMAND_LOCK_MAGIC		0x16
+/* undocumented on this chip, but works in practice */
+#define SSD1322_CMD_NOP	SSDFB_CMD_NOP
+
+/*
+ * SSD1353 command set
+ */
+#define SSD1353_CMD_SET_COLUMN_ADDRESS			SSD1322_CMD_SET_COLUMN_ADDRESS
+#define SSD1353_CMD_DRAW_LINE0x21
+#define SSD1353_CMD_DRAW_RECTANGLE			0x22
+#define SSD1353_CMD_COPY0x23
+#define SSD1353_CMD_DIM	0x24
+#define SSD1353_CMD_CLEAR_WINDOW			0x25
+#define SSD1353_CMD_FILL_ENABLE0x26
+#define SSD1353_CMD_SCROLLING_SETUP			0x27
+#define SSD1353_CMD_DEACTIVATE_SCROLL			SSDFB_CMD_DEACTIVATE_SCROLL
+#define SSD1353_CMD_ACTIVATE_SCROLL			SSDFB_CMD_ACTIVATE_SCROLL
+#define SSD1353_CMD_WRITE_RAMSSD1322_CMD_WRITE_RAM
+#define SD1353_CMD_READ_RAMSSD1322_CMD_READ_RAM
+#define 

CVS commit: src/sys/dev/spi

2021-08-01 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sun Aug  1 14:56:18 UTC 2021

Modified Files:
src/sys/dev/spi: ssdfb_spi.c

Log Message:
ssdfb: support the 4-wire SPI interface


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/ssdfb_spi.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/spi/ssdfb_spi.c
diff -u src/sys/dev/spi/ssdfb_spi.c:1.5 src/sys/dev/spi/ssdfb_spi.c:1.6
--- src/sys/dev/spi/ssdfb_spi.c:1.5	Wed Jan 27 02:32:31 2021
+++ src/sys/dev/spi/ssdfb_spi.c	Sun Aug  1 14:56:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $ */
+/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $");
 
 #include 
 #include 
@@ -39,6 +39,10 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,
 #include 
 #include 
 #include 
+#include "opt_fdt.h"
+#ifdef FDT
+#include 
+#endif
 
 struct bs_state {
 	uint8_t	*base;
@@ -49,6 +53,9 @@ struct bs_state {
 struct ssdfb_spi_softc {
 	struct ssdfb_softc	sc;
 	struct spi_handle	*sc_sh;
+#ifdef FDT
+	struct fdtbus_gpio_pin	*sc_gpio_dc;
+#endif
 	bool			sc_3wiremode;
 };
 
@@ -74,7 +81,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru
 ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL);
 
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "solomon,ssd1322" },
+	{ .compat = "solomon,ssd1306",	.value = SSDFB_PRODUCT_SSD1306_GENERIC },
+	{ .compat = "solomon,ssd1322",	.value = SSDFB_PRODUCT_SSD1322_GENERIC },
 	DEVICE_COMPAT_EOL
 };
 
@@ -108,8 +116,14 @@ ssdfb_spi_attach(device_t parent, device
 	sc->sc.sc_dev = self;
 	sc->sc_sh = sa->sa_handle;
 	sc->sc.sc_cookie = (void *)sc;
-	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
-		flags |= SSDFB_PRODUCT_SSD1322_GENERIC;
+	if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) {
+		const struct device_compatible_entry *dce =
+			device_compatible_lookup(sa->sa_compat, sa->sa_ncompat, compat_data);
+		if (dce)
+			flags |= (int)dce->value;
+		else
+			flags |= SSDFB_PRODUCT_SSD1322_GENERIC;
+	}
 	/*
 	 * Note on interface modes.
 	 *
@@ -117,11 +131,18 @@ ssdfb_spi_attach(device_t parent, device
 	 * the bit that determines if the lower 8 bits are command or data.
 	 *
 	 * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO
-	 * pin for the command/data bit. But in other to allocate a GPIO pin
-	 * we need to use fdt, so only support 3 wire mode in this frontend,
-	 * at least for now.
+	 * pin for the command/data bit.
 	 */
 	sc->sc_3wiremode = true;
+#ifdef FDT
+	const int phandle = sa->sa_cookie;
+	sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT);
+	if (!sc->sc_gpio_dc)
+		sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT);
+	sc->sc_3wiremode = (sc->sc_gpio_dc == NULL);
+#else
+	sc->sc_3wiremode = true;
+#endif
 
 	switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) {
 	case SSDFB_PRODUCT_SSD1322_GENERIC:
@@ -141,7 +162,7 @@ ssdfb_spi_attach(device_t parent, device
 	} else {
 		sc->sc.sc_cmd = ssdfb_spi_cmd_4wire;
 	}
-	
+
 	ssdfb_attach(>sc, flags);
 
 	device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n",
@@ -264,8 +285,11 @@ ssdfb_bitstream_final(struct bs_state *s
 static void
 ssdfb_spi_4wire_set_dc(struct ssdfb_spi_softc *sc, int value)
 {
-	/* TODO: this should toggle an auxilliary GPIO pin */
+#ifdef FDT
+	fdtbus_gpio_write_raw(sc->sc_gpio_dc, value);
+#else
 	panic("ssdfb_spi_4wire_set_dc");
+#endif
 }
 
 static int



CVS commit: src/sys

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 20:29:37 UTC 2021

Modified Files:
src/sys/arch/hp300/dev: rd.c
src/sys/arch/m68k/fpsp: round.sa
src/sys/arch/mips/sibyte/include: sb1250_mac.h
src/sys/dev/gpib: rd.c
src/sys/dev/ic: cs89x0.c siisatareg.h
src/sys/dev/usb: umcs.h
src/sys/netinet: tcp_congctl.c tcp_input.c tcp_subr.c tcp_var.h
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
s/threshhold/threshold


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/hp300/dev/rd.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/m68k/fpsp/round.sa
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/sibyte/include/sb1250_mac.h
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/gpib/rd.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/ic/cs89x0.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/siisatareg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/usb/umcs.h
cvs rdiff -u -r1.27 -r1.28 src/sys/netinet/tcp_congctl.c
cvs rdiff -u -r1.428 -r1.429 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.288 -r1.289 src/sys/netinet/tcp_subr.c
cvs rdiff -u -r1.195 -r1.196 src/sys/netinet/tcp_var.h
cvs rdiff -u -r1.380 -r1.381 src/sys/ufs/lfs/lfs_vfsops.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/hp300/dev/rd.c
diff -u src/sys/arch/hp300/dev/rd.c:1.109 src/sys/arch/hp300/dev/rd.c:1.110
--- src/sys/arch/hp300/dev/rd.c:1.109	Sun Jul 11 13:00:52 2021
+++ src/sys/arch/hp300/dev/rd.c	Sat Jul 31 20:29:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.109 2021/07/11 13:00:52 tsutsui Exp $	*/
+/*	$NetBSD: rd.c,v 1.110 2021/07/31 20:29:36 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.109 2021/07/11 13:00:52 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.110 2021/07/31 20:29:36 andvar Exp $");
 
 #include "opt_useleds.h"
 
@@ -1238,7 +1238,7 @@ rderror(int unit)
 	}
 	/*
 	 * Only report error if we have reached the error reporting
-	 * threshhold.  By default, this will only report after the
+	 * threshold.  By default, this will only report after the
 	 * retry limit has been exceeded.
 	 */
 	if (sc->sc_errcnt < rderrthresh)

Index: src/sys/arch/m68k/fpsp/round.sa
diff -u src/sys/arch/m68k/fpsp/round.sa:1.3 src/sys/arch/m68k/fpsp/round.sa:1.4
--- src/sys/arch/m68k/fpsp/round.sa:1.3	Wed Oct 26 07:49:24 1994
+++ src/sys/arch/m68k/fpsp/round.sa	Sat Jul 31 20:29:37 2021
@@ -1,4 +1,4 @@
-*	$NetBSD: round.sa,v 1.3 1994/10/26 07:49:24 cgd Exp $
+*	$NetBSD: round.sa,v 1.4 2021/07/31 20:29:37 andvar Exp $
 
 *	MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
 *	M68000 Hi-Performance Microprocessor Division
@@ -507,7 +507,7 @@ no_inex:
 	rts
 
 *
-*	dnrm_lp --- normalize exponent/mantissa to specified threshhold
+*	dnrm_lp --- normalize exponent/mantissa to specified threshold
 *
 * Input:
 *	a0		points to the operand to be denormalized

Index: src/sys/arch/mips/sibyte/include/sb1250_mac.h
diff -u src/sys/arch/mips/sibyte/include/sb1250_mac.h:1.7 src/sys/arch/mips/sibyte/include/sb1250_mac.h:1.8
--- src/sys/arch/mips/sibyte/include/sb1250_mac.h:1.7	Tue May 28 08:59:34 2019
+++ src/sys/arch/mips/sibyte/include/sb1250_mac.h	Sat Jul 31 20:29:37 2021
@@ -228,7 +228,7 @@
 #define G_MAC_TXD_WEIGHT1(x)_SB_GETVALUE(x,S_MAC_TXD_WEIGHT1,M_MAC_TXD_WEIGHT1)
 
 /*
- * MAC Fifo Threshhold registers (Table 9-14)
+ * MAC Fifo Threshold registers (Table 9-14)
  * Register: MAC_THRSH_CFG_0
  * Register: MAC_THRSH_CFG_1
  * Register: MAC_THRSH_CFG_2

Index: src/sys/dev/gpib/rd.c
diff -u src/sys/dev/gpib/rd.c:1.43 src/sys/dev/gpib/rd.c:1.44
--- src/sys/dev/gpib/rd.c:1.43	Tue Sep 29 02:49:56 2020
+++ src/sys/dev/gpib/rd.c	Sat Jul 31 20:29:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rd.c,v 1.43 2020/09/29 02:49:56 msaitoh Exp $ */
+/*	$NetBSD: rd.c,v 1.44 2021/07/31 20:29:37 andvar Exp $ */
 
 /*-
  * Copyright (c) 1996-2003 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.43 2020/09/29 02:49:56 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.44 2021/07/31 20:29:37 andvar Exp $");
 
 #include 
 #include 
@@ -871,7 +871,7 @@ rderror(struct rd_softc *sc)
 	}
 	/*
 	 * Only report error if we have reached the error reporting
-	 * threshhold.  By default, this will only report after the
+	 * threshold.  By default, this will only report after the
 	 * retry limit has been exceeded.
 	 */
 	if (sc->sc_errcnt < rderrthresh)

Index: src/sys/dev/ic/cs89x0.c
diff -u src/sys/dev/ic/cs89x0.c:1.50 src/sys/dev/ic/cs89x0.c:1.51
--- src/sys/dev/ic/cs89x0.c:1.50	Sat Jul 24 21:31:37 2021
+++ src/sys/dev/ic/cs89x0.c	Sat Jul 31 20:29:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs89x0.c,v 1.50 2021/07/24 21:31:37 andvar Exp $	*/
+/*	$NetBSD: cs89x0.c,v 1.51 2021/07/31 20:29:37 andvar Exp $	*/
 
 /*
  * Copyright (c) 2004 Christopher Gilbert
@@ -212,7 +212,7 @@
 */
 

CVS commit: src/sys/arch/sparc/sparc

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 16:54:37 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
s/propective/prospective


To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/sys/arch/sparc/sparc/autoconf.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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.267 src/sys/arch/sparc/sparc/autoconf.c:1.268
--- src/sys/arch/sparc/sparc/autoconf.c:1.267	Sat Jul 31 10:07:22 2021
+++ src/sys/arch/sparc/sparc/autoconf.c	Sat Jul 31 16:54:37 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $ */
+/*	$NetBSD: autoconf.c,v 1.268 2021/07/31 16:54:37 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.268 2021/07/31 16:54:37 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -2009,7 +2009,7 @@ bootinfo_relocate(void *newloc)
 		(size_t)cp < (size_t)bootinfo + BOOTINFO_SIZE);
 
 	/*
-	 * Check propective gains.
+	 * Check prospective gains.
 	 */
 	if ((int)bootinfo - (int)newloc < bi_size)
 		/* Don't bother */



CVS commit: src/sys/arch/alpha/alpha

2021-07-31 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Jul 31 14:51:25 UTC 2021

Modified Files:
src/sys/arch/alpha/alpha: pmap.c

Log Message:
Fix a silly mistake (missing return) in the DEBUG case of the kernel pmap
case of pmap_extract().


To generate a diff of this commit:
cvs rdiff -u -r1.299 -r1.300 src/sys/arch/alpha/alpha/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/alpha/alpha/pmap.c
diff -u src/sys/arch/alpha/alpha/pmap.c:1.299 src/sys/arch/alpha/alpha/pmap.c:1.300
--- src/sys/arch/alpha/alpha/pmap.c:1.299	Mon Jul 19 16:31:19 2021
+++ src/sys/arch/alpha/alpha/pmap.c	Sat Jul 31 14:51:25 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.299 2021/07/19 16:31:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.300 2021/07/31 14:51:25 thorpej Exp $");
 
 #include 
 #include 
@@ -2587,6 +2587,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa
 printf("failed (kernel vtophys)\n");
 			}
 		}
+		return address_is_valid;
 #else
 		return vtophys_internal(va, pap);
 #endif



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

2021-07-31 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Jul 31 11:34:40 UTC 2021

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

Log Message:
sunxi_platform: declare UART FIFO sizes for SoCs we support


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/arm/sunxi/sunxi_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/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.44 src/sys/arch/arm/sunxi/sunxi_platform.c:1.45
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.44	Fri Jul 30 12:46:46 2021
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Sat Jul 31 11:34:40 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.45 2021/07/31 11:34:40 tnn Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_console.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.44 2021/07/30 12:46:46 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.45 2021/07/31 11:34:40 tnn Exp $");
 
 #include 
 #include 
@@ -241,11 +241,23 @@ sunxi_platform_device_register(device_t 
 
 	if (device_is_a(self, "com")) {
 		static const struct device_compatible_entry compat_data[] = {
-			{ .compat = "allwinner,sun7i-a20" },
+			{ .compat = "allwinner,sun4i-a10",	.value = 64 },
+			{ .compat = "allwinner,sun5i-a13",	.value = 64 },
+			{ .compat = "allwinner,sun6i-a31",	.value = 64 },
+			{ .compat = "allwinner,sun7i-a20",	.value = 64 },
+			{ .compat = "allwinner,sun8i-h2-plus",	.value = 64 },
+			{ .compat = "allwinner,sun8i-h3",	.value = 64 },
+			{ .compat = "allwinner,sun8i-a83t",	.value = 64 },
+			{ .compat = "allwinner,sun9i-a80",	.value = 64 },
+			{ .compat = "allwinner,sun50i-a64",	.value = 64 },
+			{ .compat = "allwinner,sun50i-h5",	.value = 64 },
+			{ .compat = "allwinner,sun50i-h6",	.value = 256 },
 			DEVICE_COMPAT_EOL
 		};
-		if (of_compatible_match(OF_finddevice("/"), compat_data))
-			prop_dictionary_set_uint(prop, "fifolen", 64);
+		const struct device_compatible_entry *dce =
+		of_compatible_lookup(OF_finddevice("/"), compat_data);
+		if (dce != NULL)
+			prop_dictionary_set_uint(prop, "fifolen", dce->value);
 	}
 }
 



CVS commit: src/sys/netinet6

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 10:12:04 UTC 2021

Modified Files:
src/sys/netinet6: in6.h

Log Message:
fix typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/netinet6/in6.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/netinet6/in6.h
diff -u src/sys/netinet6/in6.h:1.100 src/sys/netinet6/in6.h:1.101
--- src/sys/netinet6/in6.h:1.100	Tue Sep  8 14:12:57 2020
+++ src/sys/netinet6/in6.h	Sat Jul 31 10:12:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.h,v 1.100 2020/09/08 14:12:57 christos Exp $	*/
+/*	$NetBSD: in6.h,v 1.101 2021/07/31 10:12:04 andvar Exp $	*/
 /*	$KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $	*/
 
 /*
@@ -429,7 +429,7 @@ extern const struct in6_addr in6addr_lin
 #define IPV6_HOPLIMIT		47 /* int; send hop limit */
 #define IPV6_NEXTHOP		48 /* sockaddr; next hop addr */
 #define IPV6_HOPOPTS		49 /* ip6_hbh; send hop-by-hop option */
-#define IPV6_DSTOPTS		50 /* ip6_dest; send dst option befor rthdr */
+#define IPV6_DSTOPTS		50 /* ip6_dest; send dst option before rthdr */
 #define IPV6_RTHDR		51 /* ip6_rthdr; send routing header */
 
 #define IPV6_RECVTCLASS		57 /* bool; recv traffic class values */
@@ -440,7 +440,7 @@ extern const struct in6_addr in6addr_lin
 #define IPV6_TCLASS		61 /* int; send traffic class value */
 #define IPV6_DONTFRAG		62 /* bool; disable IPv6 fragmentation */
 #define IPV6_PREFER_TEMPADDR	63 /* int; prefer temporary address as
-* the sorce address */
+* the source address */
 #define IPV6_BINDANY		64 /* bool: allow bind to any address */
 /* to define items, should talk with KAME guys first, for *BSD compatibility */
 



CVS commit: src/sys/arch/sparc/sparc

2021-07-31 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Sat Jul 31 10:07:23 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: autoconf.c

Log Message:
fix typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.266 -r1.267 src/sys/arch/sparc/sparc/autoconf.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/sparc/sparc/autoconf.c
diff -u src/sys/arch/sparc/sparc/autoconf.c:1.266 src/sys/arch/sparc/sparc/autoconf.c:1.267
--- src/sys/arch/sparc/sparc/autoconf.c:1.266	Mon May 10 23:53:44 2021
+++ src/sys/arch/sparc/sparc/autoconf.c	Sat Jul 31 10:07:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.266 2021/05/10 23:53:44 thorpej Exp $ */
+/*	$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.266 2021/05/10 23:53:44 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.267 2021/07/31 10:07:22 andvar Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1114,7 +1114,7 @@ mainbus_attach(device_t parent, device_t
 		const char *const dev;
 #define BS_EARLY	1	/* attach device early */
 #define	BS_IGNORE	2	/* ignore root device */
-#define	BS_OPTIONAL	4	/* device not alwas present */
+#define	BS_OPTIONAL	4	/* device not always present */
 		unsigned int flags;
 	};
 



  1   2   3   4   5   6   7   8   9   10   >