CVS commit: src/sys/dev

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 04:26:29 UTC 2020

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

Log Message:
Missed a spot -- need  to use atomic_*.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/random.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/random.c
diff -u src/sys/dev/random.c:1.1 src/sys/dev/random.c:1.2
--- src/sys/dev/random.c:1.1	Thu Apr 30 03:28:18 2020
+++ src/sys/dev/random.c	Thu Apr 30 04:26:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.c,v 1.1 2020/04/30 03:28:18 riastradh Exp $	*/
+/*	$NetBSD: random.c,v 1.2 2020/04/30 04:26:29 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -47,10 +47,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.1 2020/04/30 03:28:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: random.c,v 1.2 2020/04/30 04:26:29 riastradh Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src

2020-04-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Apr 30 04:18:07 UTC 2020

Modified Files:
src/sys/uvm: uvm_map.c
src/tests/lib/libc/sys: t_futex_ops.c

Log Message:
- In uvm_voaddr_acquire(), take an extra hold on the anon lock obj.
- In uvm_voaddr_release(), if the anon ref count drops to 0, call
  uvm_anfree() rather than uvm_anon_release().  Unconditionally drop
  the anon lock, and release the extra hold on the anon lock obj.

Fixes a panic that occurs if the backing store for a futex backed by
an anon memory location is unmapped while a thread is waiting in the
futex.

Add a test case that reproduced the panic to verify that it's fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/sys/uvm/uvm_map.c
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_futex_ops.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.381 src/sys/uvm/uvm_map.c:1.382
--- src/sys/uvm/uvm_map.c:1.381	Sun Apr 19 08:59:53 2020
+++ src/sys/uvm/uvm_map.c	Thu Apr 30 04:18:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.381 2020/04/19 08:59:53 skrll Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.382 2020/04/30 04:18:07 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.381 2020/04/19 08:59:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.382 2020/04/30 04:18:07 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -4934,6 +4934,7 @@ uvm_voaddr_acquire(struct vm_map * const
 		if (anon) {
  found_anon:		KASSERT(anon->an_lock == entry->aref.ar_amap->am_lock);
 			anon->an_ref++;
+			rw_obj_hold(anon->an_lock);
 			KASSERT(anon->an_ref != 0);
 			voaddr->type = UVM_VOADDR_TYPE_ANON;
 			voaddr->anon = anon;
@@ -4987,16 +4988,16 @@ uvm_voaddr_release(struct uvm_voaddr * c
 	}
 	case UVM_VOADDR_TYPE_ANON: {
 		struct vm_anon * const anon = voaddr->anon;
+		krwlock_t *lock;
 
 		KASSERT(anon != NULL);
-		rw_enter(anon->an_lock, RW_WRITER);
+		rw_enter((lock = anon->an_lock), RW_WRITER);
 		KASSERT(anon->an_ref > 0);
-		anon->an_ref--;
-		if (anon->an_ref == 0) {
-			uvm_anon_release(anon);
-		} else {
-			rw_exit(anon->an_lock);
+		if (--anon->an_ref == 0) {
+			uvm_anfree(anon);
 		}
+		rw_exit(lock);
+		rw_obj_free(lock);
 		break;
 	}
 	default:

Index: src/tests/lib/libc/sys/t_futex_ops.c
diff -u src/tests/lib/libc/sys/t_futex_ops.c:1.2 src/tests/lib/libc/sys/t_futex_ops.c:1.3
--- src/tests/lib/libc/sys/t_futex_ops.c:1.2	Tue Apr 28 17:27:03 2020
+++ src/tests/lib/libc/sys/t_futex_ops.c	Thu Apr 30 04:18:07 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_futex_ops.c,v 1.2 2020/04/28 17:27:03 riastradh Exp $ */
+/* $NetBSD: t_futex_ops.c,v 1.3 2020/04/30 04:18:07 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2019, 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_futex_ops.c,v 1.2 2020/04/28 17:27:03 riastradh Exp $");
+__RCSID("$NetBSD: t_futex_ops.c,v 1.3 2020/04/30 04:18:07 thorpej Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __RCSID("$NetBSD: t_futex_ops.c,v 1.2 20
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -166,12 +167,15 @@ simple_test_waiter_lwp(void *arg)
 
 	d->threadid = _lwp_self();
 
+	membar_producer();
 	atomic_inc_uint(_running);
 	membar_sync();
 
 	if (__futex(d->futex_ptr, d->wait_op | d->op_flags,
 		d->block_val, NULL, NULL, 0, d->bitset) == -1) {
 		d->futex_error = errno;
+		membar_sync();
+		atomic_dec_uint(_running);
 		_lwp_exit();
 	} else {
 		d->futex_error = 0;
@@ -1262,6 +1266,74 @@ ATF_TC_BODY(futex_wait_timeout_deadline_
 
 /*/
 
+static void
+sig_noop(int sig __unused)
+{
+}
+
+static void (*old_act)(int) = SIG_DFL;
+
+static void
+do_futex_wait_evil_unmapped(int map_flags)
+{
+	int i;
+
+	create_bs(map_flags);
+
+	old_act = signal(SIGUSR1, sig_noop);
+	ATF_REQUIRE(old_act != SIG_ERR);
+
+	setup_lwp_context(_data[0], simple_test_waiter_lwp);
+	lwp_data[0].op_flags = 0;
+	lwp_data[0].futex_error = -1;
+	lwp_data[0].futex_ptr = _addr[0];
+	lwp_data[0].block_val = 0;
+	lwp_data[0].bitset = 0;
+	lwp_data[0].wait_op = FUTEX_WAIT;
+	ATF_REQUIRE(_lwp_create(_data[0].context, 0,
+_data[0].lwpid) == 0);
+
+	for (i = 0; i < 5; i++) {
+		membar_sync();
+		if (nlwps_running == 1)
+			break;
+		sleep(1);
+	}
+	membar_sync();
+	ATF_REQUIRE_EQ_MSG(nlwps_running, 1, "waiters failed to start");
+
+	/* Ensure it's blocked. */
+	ATF_REQUIRE(lwp_data[0].futex_error == -1);
+
+	/* Rudely unmap the backing store. */
+	cleanup_bs();
+
+	/* Signal the waiter so that it leaves the futex. */
+	ATF_REQUIRE(_lwp_kill(lwp_data[0].threadid, SIGUSR1) == 0);

CVS commit: src/sys/kern

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:42:23 UTC 2020

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

Log Message:
Accept both byte orders for random seed in the kernel.

The file format was defined with a machine-dependent 32-bit integer
field (the estimated number of bits of entropy in the process that
generated it).  Fortunately we have a checksum to verify the order.

This way you can use `rndctl -S' on a little-endian machine to
generate a seed when installing NetBSD on a big-endian machine, and
the kernel will accept it on boot.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/kern/kern_entropy.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_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.1 src/sys/kern/kern_entropy.c:1.2
--- src/sys/kern/kern_entropy.c:1.1	Thu Apr 30 03:28:18 2020
+++ src/sys/kern/kern_entropy.c	Thu Apr 30 03:42:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.1 2020/04/30 03:28:18 riastradh Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.2 2020/04/30 03:42:23 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.1 2020/04/30 03:28:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.2 2020/04/30 03:42:23 riastradh Exp $");
 
 #include 
 #include 
@@ -514,8 +514,6 @@ entropy_seed(rndsave_t *seed)
 	 * but ignore the entropy estimate -- the file may have been
 	 * incompletely written with garbage, which is harmless to add
 	 * but may not be as unpredictable as alleged.
-	 *
-	 * XXX There is a byte order dependency here...
 	 */
 	SHA1Init();
 	SHA1Update(, (const void *)>entropy, sizeof(seed->entropy));
@@ -526,9 +524,20 @@ entropy_seed(rndsave_t *seed)
 		printf("entropy: invalid seed checksum\n");
 		seed->entropy = 0;
 	}
-	explicit_memset(, 0, sizeof );
+	explicit_memset(, 0, sizeof ctx);
 	explicit_memset(digest, 0, sizeof digest);
 
+	/*
+	 * If the entropy is insensibly large, try byte-swapping.
+	 * Otherwise assume the file is corrupted and act as though it
+	 * has zero entropy.
+	 */
+	if (howmany(seed->entropy, NBBY) > sizeof(seed->data)) {
+		seed->entropy = bswap32(seed->entropy);
+		if (howmany(seed->entropy, NBBY) > sizeof(seed->data))
+			seed->entropy = 0;
+	}
+
 	/* Make sure the seed source is attached.  */
 	attach_seed_rndsource();
 



CVS commit: src/sys/dev/pci

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:41:31 UTC 2020

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

Log Message:
Revert "- rnd_add_*() call must be serialized. Unserialized accesses broke the"

It is no longer necessary to serialize calls to rnd_add_data, so we
can use the same rndsource for every queue.

This also reverts some unrelated changes that were mixed in:

1. WM_NRXDESC was made unsigned
2. The specific samples were changed.

(1) will be redone in a separate commit.  (2) was buggy (wrote `='
where `|=' was meant) and is not needed; it's fine to do rnd_add_data
in a thread or softint too, not just in a hard interrupt handler.


To generate a diff of this commit:
cvs rdiff -u -r1.674 -r1.675 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.674 src/sys/dev/pci/if_wm.c:1.675
--- src/sys/dev/pci/if_wm.c:1.674	Thu Apr  9 06:55:51 2020
+++ src/sys/dev/pci/if_wm.c	Thu Apr 30 03:41:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.674 2020/04/09 06:55:51 jdolecek Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.675 2020/04/30 03:41:31 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.674 2020/04/09 06:55:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.675 2020/04/30 03:41:31 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -239,7 +239,7 @@ static int wm_watchdog_timeout = WM_WATC
  * packet.  We allocate 256 receive descriptors, each with a 2k
  * buffer (MCLBYTES), which gives us room for 50 jumbo packets.
  */
-#define	WM_NRXDESC		256U
+#define	WM_NRXDESC		256
 #define	WM_NRXDESC_MASK		(WM_NRXDESC - 1)
 #define	WM_NEXTRX(x)		(((x) + 1) & WM_NRXDESC_MASK)
 #define	WM_PREVRX(x)		(((x) - 1) & WM_NRXDESC_MASK)
@@ -472,7 +472,6 @@ struct wm_queue {
 	bool wmq_txrx_use_workqueue;
 	struct work wmq_cookie;
 	void *wmq_si;
-	krndsource_t rnd_source;	/* random source */
 };
 
 struct wm_phyop {
@@ -608,6 +607,8 @@ struct wm_softc {
 
 	int sc_mchash_type;		/* multicast filter offset */
 
+	krndsource_t rnd_source;	/* random source */
+
 	struct if_percpuq *sc_ipq;	/* softint-based input queues */
 
 	kmutex_t *sc_core_lock;		/* lock for softc operations */
@@ -3041,6 +3042,8 @@ alloc_retry:
 	ether_ifattach(ifp, enaddr);
 	ether_set_ifflags_cb(>sc_ethercom, wm_ifflags_cb);
 	if_register(ifp);
+	rnd_attach_source(>rnd_source, xname, RND_TYPE_NET,
+	RND_FLAG_DEFAULT);
 
 #ifdef WM_EVENT_COUNTERS
 	/* Attach event counters. */
@@ -3101,6 +3104,8 @@ wm_detach(device_t self, int flags __unu
 	evcnt_detach(>sc_ev_rx_macctl);
 #endif /* WM_EVENT_COUNTERS */
 
+	rnd_detach_source(>rnd_source);
+
 	/* Tell the firmware about the release */
 	WM_CORE_LOCK(sc);
 	wm_release_manageability(sc);
@@ -6998,15 +7003,6 @@ wm_alloc_txrx_queues(struct wm_softc *sc
 	if (error)
 		goto fail_2;
 
-	for (i = 0; i < sc->sc_nqueues; i++) {
-		char rndname[16];
-
-		snprintf(rndname, sizeof(rndname), "%sTXRX%d",
-		device_xname(sc->sc_dev), i);
-		rnd_attach_source(>sc_queue[i].rnd_source, rndname,
-		RND_TYPE_NET, RND_FLAG_DEFAULT);
-	}
-
 	return 0;
 
  fail_2:
@@ -7042,9 +7038,6 @@ wm_free_txrx_queues(struct wm_softc *sc)
 {
 	int i;
 
-	for (i = 0; i < sc->sc_nqueues; i++)
-		rnd_detach_source(>sc_queue[i].rnd_source);
-
 	for (i = 0; i < sc->sc_nqueues; i++) {
 		struct wm_rxqueue *rxq = >sc_queue[i].wmq_rxq;
 
@@ -8720,6 +8713,9 @@ wm_txeof(struct wm_txqueue *txq, u_int l
 	DPRINTF(WM_DEBUG_TX,
 	("%s: TX: txsdirty -> %d\n", device_xname(sc->sc_dev), i));
 
+	if (count != 0)
+		rnd_add_uint32(>rnd_source, count);
+
 	/*
 	 * If there are no more pending transmissions, cancel the watchdog
 	 * timer.
@@ -9133,6 +9129,9 @@ wm_rxeof(struct wm_rxqueue *rxq, u_int l
 			break;
 	}
 
+	if (count != 0)
+		rnd_add_uint32(>rnd_source, count);
+
 	DPRINTF(WM_DEBUG_RX,
 	("%s: RX: rxptr -> %d\n", device_xname(sc->sc_dev), i));
 
@@ -9610,8 +9609,6 @@ wm_intr_legacy(void *arg)
 		 * So, we can call wm_rxeof() in interrupt context.
 		 */
 		wm_rxeof(rxq, UINT_MAX);
-		/* Fill lower bits with RX index. See below for the upper. */
-		rndval |= rxq->rxq_ptr & WM_NRXDESC_MASK;
 
 		mutex_exit(rxq->rxq_lock);
 		mutex_enter(txq->txq_lock);
@@ -9630,8 +9627,6 @@ wm_intr_legacy(void *arg)
 		}
 #endif
 		wm_txeof(txq, UINT_MAX);
-		/* Fill upper bits with TX index. See above for the lower. */
-		rndval = txq->txq_next * WM_NRXDESC;
 
 		mutex_exit(txq->txq_lock);
 		WM_CORE_LOCK(sc);
@@ -9658,7 +9653,7 @@ wm_intr_legacy(void *arg)
 		}
 	}
 
-	rnd_add_uint32(>sc_queue[0].rnd_source, rndval);
+	rnd_add_uint32(>rnd_source, rndval);
 
 	if (handled) {
 		/* Try to get more packets going. */
@@ -9716,7 +9711,6 @@ wm_txrxintr_msix(void *arg)
 	struct wm_softc *sc = txq->txq_sc;
 	u_int txlimit 

CVS commit: src/sys/dev/pci

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:42:11 UTC 2020

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

Log Message:
Make WM_NRXDESC unsigned.


To generate a diff of this commit:
cvs rdiff -u -r1.675 -r1.676 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.675 src/sys/dev/pci/if_wm.c:1.676
--- src/sys/dev/pci/if_wm.c:1.675	Thu Apr 30 03:41:31 2020
+++ src/sys/dev/pci/if_wm.c	Thu Apr 30 03:42:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.675 2020/04/30 03:41:31 riastradh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.676 2020/04/30 03:42:10 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.675 2020/04/30 03:41:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.676 2020/04/30 03:42:10 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -239,7 +239,7 @@ static int wm_watchdog_timeout = WM_WATC
  * packet.  We allocate 256 receive descriptors, each with a 2k
  * buffer (MCLBYTES), which gives us room for 50 jumbo packets.
  */
-#define	WM_NRXDESC		256
+#define	WM_NRXDESC		256U
 #define	WM_NRXDESC_MASK		(WM_NRXDESC - 1)
 #define	WM_NEXTRX(x)		(((x) + 1) & WM_NRXDESC_MASK)
 #define	WM_PREVRX(x)		(((x) - 1) & WM_NRXDESC_MASK)



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

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:41:20 UTC 2020

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

Log Message:
No need for a lock around rnd_add_data any more.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.16 src/sys/rump/librump/rumpkern/hyperentropy.c:1.17
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.16	Thu Apr 30 03:40:53 2020
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Thu Apr 30 03:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,18 +26,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $");
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
 
 #include 
 
-static kmutex_t rndsrc_lock;
 static krndsource_t rndsrc;
 
 static void
@@ -56,9 +54,7 @@ feedrandom(size_t bytes, void *cookie __
 		n += MIN(nread, bytes - n);
 	}
 	if (n) {
-		mutex_enter(_lock);
 		rnd_add_data_sync(, rnddata, n, NBBY*n);
-		mutex_exit(_lock);
 	}
 	kmem_intr_free(rnddata, bytes);
 }
@@ -67,8 +63,6 @@ void
 rump_hyperentropy_init(void)
 {
 
-	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
-
 	rndsource_setcb(, , NULL);
 	rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);



CVS commit: src/sys

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:40:54 UTC 2020

Modified Files:
src/sys/arch/arm/amlogic: meson_rng.c
src/sys/arch/arm/broadcom: bcm2835_rng.c
src/sys/arch/arm/nvidia: tegra124_car.c tegra210_car.c
src/sys/arch/arm/omap: am335x_trng.c
src/sys/arch/arm/sunxi: sun8i_crypto.c
src/sys/arch/arm/ti: ti_rng.c
src/sys/arch/mips/ingenic: ingenic_rng.c
src/sys/arch/x86/x86: cpu_rng.c
src/sys/dev/ic: amdccp.c rng200.c
src/sys/dev/pci: amdpm.c hifn7751.c ubsec.c viornd.c
src/sys/dev/usb: ualea.c
src/sys/rump/librump/rumpkern: hyperentropy.c
Removed Files:
src/sys/sys: rndpool.h

Log Message:
rnd_attach_source calls the callback itself now.

No need for every driver to explicitly call it to prime the pool.

Eliminate now-unused .


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson_rng.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/broadcom/bcm2835_rng.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/nvidia/tegra124_car.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/nvidia/tegra210_car.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/am335x_trng.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sun8i_crypto.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/ti/ti_rng.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/ingenic/ingenic_rng.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/x86/cpu_rng.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/amdccp.c src/sys/dev/ic/rng200.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/pci/amdpm.c
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/pci/ubsec.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/viornd.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/usb/ualea.c
cvs rdiff -u -r1.15 -r1.16 src/sys/rump/librump/rumpkern/hyperentropy.c
cvs rdiff -u -r1.4 -r0 src/sys/sys/rndpool.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/amlogic/meson_rng.c
diff -u src/sys/arch/arm/amlogic/meson_rng.c:1.2 src/sys/arch/arm/amlogic/meson_rng.c:1.3
--- src/sys/arch/arm/amlogic/meson_rng.c:1.2	Sun Apr 21 14:13:55 2019
+++ src/sys/arch/arm/amlogic/meson_rng.c	Thu Apr 30 03:40:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_rng.c,v 1.2 2019/04/21 14:13:55 jmcneill Exp $ */
+/* $NetBSD: meson_rng.c,v 1.3 2020/04/30 03:40:52 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.2 2019/04/21 14:13:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.3 2020/04/30 03:40:52 riastradh Exp $");
 
 #include 
 #include 
@@ -35,7 +35,6 @@ __KERNEL_RCSID(0, "$NetBSD: meson_rng.c,
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -107,8 +106,6 @@ meson_rng_attach(device_t parent, device
 	rndsource_setcb(>sc_rndsource, meson_rng_get, sc);
 	rnd_attach_source(>sc_rndsource, device_xname(self), RND_TYPE_RNG,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-
-	meson_rng_get(RND_POOLBITS / NBBY, sc);
 }
 
 static void

Index: src/sys/arch/arm/broadcom/bcm2835_rng.c
diff -u src/sys/arch/arm/broadcom/bcm2835_rng.c:1.13 src/sys/arch/arm/broadcom/bcm2835_rng.c:1.14
--- src/sys/arch/arm/broadcom/bcm2835_rng.c:1.13	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/arm/broadcom/bcm2835_rng.c	Thu Apr 30 03:40:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_rng.c,v 1.13 2017/12/10 21:38:26 skrll Exp $ */
+/*	$NetBSD: bcm2835_rng.c,v 1.14 2020/04/30 03:40:52 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,14 +30,13 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_rng.c,v 1.13 2017/12/10 21:38:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_rng.c,v 1.14 2020/04/30 03:40:52 riastradh Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -122,9 +121,6 @@ bcmrng_attach(device_t parent, device_t 
 	rndsource_setcb(>sc_rndsource, _get, sc);
 	rnd_attach_source(>sc_rndsource, device_xname(self), RND_TYPE_RNG,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-
-	/* get some initial entropy ASAP */
-	bcmrng_get(RND_POOLBITS / NBBY, sc);
 }
 
 static void

Index: src/sys/arch/arm/nvidia/tegra124_car.c
diff -u src/sys/arch/arm/nvidia/tegra124_car.c:1.19 src/sys/arch/arm/nvidia/tegra124_car.c:1.20
--- src/sys/arch/arm/nvidia/tegra124_car.c:1.19	Sun Oct 13 06:11:31 2019
+++ src/sys/arch/arm/nvidia/tegra124_car.c	Thu Apr 30 03:40:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra124_car.c,v 1.19 2019/10/13 06:11:31 skrll Exp $ */
+/* $NetBSD: tegra124_car.c,v 1.20 2020/04/30 03:40:52 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.19 2019/10/13 06:11:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.20 2020/04/30 03:40:52 

CVS commit: src/sys/net

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:29:55 UTC 2020

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

Log Message:
Convert ether_input from rnd_initial_entropy to entropy_epoch().


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/sys/net/if_ethersubr.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_ethersubr.c
diff -u src/sys/net/if_ethersubr.c:1.283 src/sys/net/if_ethersubr.c:1.284
--- src/sys/net/if_ethersubr.c:1.283	Sun Mar 15 23:14:41 2020
+++ src/sys/net/if_ethersubr.c	Thu Apr 30 03:29:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ethersubr.c,v 1.283 2020/03/15 23:14:41 thorpej Exp $	*/
+/*	$NetBSD: if_ethersubr.c,v 1.284 2020/04/30 03:29:55 riastradh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.283 2020/03/15 23:14:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.284 2020/04/30 03:29:55 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -85,7 +85,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_ethersubr
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -603,7 +603,8 @@ ether_input(struct ifnet *ifp, struct mb
 	etype = ntohs(eh->ether_type);
 	ehlen = sizeof(*eh);
 
-	if (__predict_false(earlypkts < 100 || !rnd_initial_entropy)) {
+	if (__predict_false(earlypkts < 100 ||
+		entropy_epoch() == (unsigned)-1)) {
 		rnd_add_data(NULL, eh, ehlen, 0);
 		earlypkts++;
 	}



CVS commit: src/sys/crypto/cprng_fast

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:29:35 UTC 2020

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c

Log Message:
Adapt cprng_fast to use entropy_epoch(), not rnd_initial_entropy.

This way it has an opportunity to be reseeded after boot.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/crypto/cprng_fast/cprng_fast.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/crypto/cprng_fast/cprng_fast.c
diff -u src/sys/crypto/cprng_fast/cprng_fast.c:1.13 src/sys/crypto/cprng_fast/cprng_fast.c:1.14
--- src/sys/crypto/cprng_fast/cprng_fast.c:1.13	Mon Apr 13 22:43:41 2015
+++ src/sys/crypto/cprng_fast/cprng_fast.c	Thu Apr 30 03:29:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng_fast.c,v 1.13 2015/04/13 22:43:41 riastradh Exp $	*/
+/*	$NetBSD: cprng_fast.c,v 1.14 2020/04/30 03:29:35 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,16 +30,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.13 2015/04/13 22:43:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.14 2020/04/30 03:29:35 riastradh Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
-#include 		/* rnd_initial_entropy */
 
 /* ChaCha core */
 
@@ -198,7 +198,7 @@ struct cprng_fast {
 	uint32_t 	buffer[crypto_core_OUTPUTWORDS];
 	uint32_t 	key[crypto_core_KEYWORDS];
 	uint32_t 	nonce[crypto_core_INPUTWORDS];
-	bool		have_initial;
+	unsigned	epoch;
 };
 
 __CTASSERT(sizeof ((struct cprng_fast *)0)->key == CPRNG_FAST_SEED_BYTES);
@@ -233,9 +233,9 @@ cprng_fast_init_cpu(void *p, void *arg _
 	struct cprng_fast *const cprng = p;
 	uint8_t seed[CPRNG_FAST_SEED_BYTES];
 
+	cprng->epoch = entropy_epoch();
 	cprng_strong(kern_cprng, seed, sizeof seed, 0);
 	cprng_fast_seed(cprng, seed);
-	cprng->have_initial = rnd_initial_entropy;
 	(void)explicit_memset(seed, 0, sizeof seed);
 }
 
@@ -248,7 +248,7 @@ cprng_fast_get(struct cprng_fast **cprng
 	*cprngp = cprng = percpu_getref(cprng_fast_percpu);
 	s = splvm();
 
-	if (__predict_false(!cprng->have_initial))
+	if (__predict_false(cprng->epoch != entropy_epoch()))
 		cprng_fast_schedule_reseed(cprng);
 
 	return s;
@@ -274,6 +274,7 @@ cprng_fast_schedule_reseed(struct cprng_
 static void
 cprng_fast_intr(void *cookie __unused)
 {
+	unsigned epoch = entropy_epoch();
 	struct cprng_fast *cprng;
 	uint8_t seed[CPRNG_FAST_SEED_BYTES];
 	int s;
@@ -283,7 +284,7 @@ cprng_fast_intr(void *cookie __unused)
 	cprng = percpu_getref(cprng_fast_percpu);
 	s = splvm();
 	cprng_fast_seed(cprng, seed);
-	cprng->have_initial = rnd_initial_entropy;
+	cprng->epoch = epoch;
 	splx(s);
 	percpu_putref(cprng_fast_percpu);
 



CVS commit: src/sys

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:30:11 UTC 2020

Modified Files:
src/sys/arch/x86/x86: cpu_rng.c
src/sys/compat/common: rndpseudo_50.c
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_rndpseudo_50.c
src/sys/netinet: sctp_pcb.c

Log Message:
Omit needless #include .


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/x86/cpu_rng.c
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/common/rndpseudo_50.c
cvs rdiff -u -r1.48 -r1.49 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
cvs rdiff -u -r1.20 -r1.21 src/sys/netinet/sctp_pcb.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/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.11 src/sys/arch/x86/x86/cpu_rng.c:1.12
--- src/sys/arch/x86/x86/cpu_rng.c:1.11	Thu Apr 30 03:29:20 2020
+++ src/sys/arch/x86/x86/cpu_rng.c	Thu Apr 30 03:30:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.11 2020/04/30 03:29:20 riastradh Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.12 2020/04/30 03:30:10 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -48,7 +48,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 

Index: src/sys/compat/common/rndpseudo_50.c
diff -u src/sys/compat/common/rndpseudo_50.c:1.6 src/sys/compat/common/rndpseudo_50.c:1.7
--- src/sys/compat/common/rndpseudo_50.c:1.6	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/rndpseudo_50.c	Thu Apr 30 03:30:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndpseudo_50.c,v 1.6 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: rndpseudo_50.c,v 1.7 2020/04/30 03:30:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.6 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rndpseudo_50.c,v 1.7 2020/04/30 03:30:10 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -38,8 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: rndpseudo_50
 
 #include 
 #include 
-
-#include 
 #include 
 #include 
 

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.48 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.49
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.48	Sun Mar 15 12:46:02 2020
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Thu Apr 30 03:30:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.48 2020/03/15 12:46:02 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.49 2020/04/30 03:30:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.48 2020/03/15 12:46:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.49 2020/04/30 03:30:10 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -62,7 +62,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_com
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 

Index: src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
diff -u src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.4 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.5
--- src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.4	Thu Sep 26 01:32:09 2019
+++ src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c	Thu Apr 30 03:30:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_rndpseudo_50.c,v 1.4 2019/09/26 01:32:09 christos Exp $	*/
+/*	$NetBSD: netbsd32_rndpseudo_50.c,v 1.5 2020/04/30 03:30:10 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_rndpseudo_50.c,v 1.4 2019/09/26 01:32:09 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_rndpseudo_50.c,v 1.5 2020/04/30 03:30:10 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -40,8 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_rnd
 #include 
 #include 
 
-#include 
-
 #include 
 #include 
 

Index: src/sys/netinet/sctp_pcb.c
diff -u src/sys/netinet/sctp_pcb.c:1.20 src/sys/netinet/sctp_pcb.c:1.21
--- src/sys/netinet/sctp_pcb.c:1.20	Sun Jan 19 20:51:13 2020
+++ src/sys/netinet/sctp_pcb.c	Thu Apr 30 03:30:10 2020
@@ -1,5 +1,5 @@
 /* $KAME: sctp_pcb.c,v 1.39 2005/06/16 18:29:25 jinmei Exp $ */
-/* $NetBSD: sctp_pcb.c,v 1.20 2020/01/19 20:51:13 riastradh Exp $ */
+/* $NetBSD: sctp_pcb.c,v 1.21 2020/04/30 03:30:10 riastradh Exp $ */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
@@ -33,7 +33,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.20 2020/01/19 20:51:13 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sctp_pcb.c,v 1.21 2020/04/30 03:30:10 riastradh Exp $");
 
 #ifdef 

CVS commit: src/sys/crypto/cprng_fast

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:29:45 UTC 2020

Modified Files:
src/sys/crypto/cprng_fast: cprng_fast.c

Log Message:
Count cprng_fast reseed events.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/crypto/cprng_fast/cprng_fast.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/crypto/cprng_fast/cprng_fast.c
diff -u src/sys/crypto/cprng_fast/cprng_fast.c:1.14 src/sys/crypto/cprng_fast/cprng_fast.c:1.15
--- src/sys/crypto/cprng_fast/cprng_fast.c:1.14	Thu Apr 30 03:29:35 2020
+++ src/sys/crypto/cprng_fast/cprng_fast.c	Thu Apr 30 03:29:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cprng_fast.c,v 1.14 2020/04/30 03:29:35 riastradh Exp $	*/
+/*	$NetBSD: cprng_fast.c,v 1.15 2020/04/30 03:29:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.14 2020/04/30 03:29:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cprng_fast.c,v 1.15 2020/04/30 03:29:45 riastradh Exp $");
 
 #include 
 #include 
@@ -38,7 +38,9 @@ __KERNEL_RCSID(0, "$NetBSD: cprng_fast.c
 #include 
 #include 
 #include 
+#include 
 #include 
+#include 
 #include 
 
 /* ChaCha core */
@@ -198,6 +200,7 @@ struct cprng_fast {
 	uint32_t 	buffer[crypto_core_OUTPUTWORDS];
 	uint32_t 	key[crypto_core_KEYWORDS];
 	uint32_t 	nonce[crypto_core_INPUTWORDS];
+	struct evcnt	*reseed_evcnt;
 	unsigned	epoch;
 };
 
@@ -221,14 +224,14 @@ cprng_fast_init(void)
 {
 
 	crypto_core_selftest();
-	cprng_fast_percpu = percpu_alloc(sizeof(struct cprng_fast));
-	percpu_foreach(cprng_fast_percpu, _fast_init_cpu, NULL);
+	cprng_fast_percpu = percpu_create(sizeof(struct cprng_fast),
+	cprng_fast_init_cpu, NULL, NULL);
 	cprng_fast_softint = softint_establish(SOFTINT_SERIAL|SOFTINT_MPSAFE,
 	_fast_intr, NULL);
 }
 
 static void
-cprng_fast_init_cpu(void *p, void *arg __unused, struct cpu_info *ci __unused)
+cprng_fast_init_cpu(void *p, void *arg __unused, struct cpu_info *ci)
 {
 	struct cprng_fast *const cprng = p;
 	uint8_t seed[CPRNG_FAST_SEED_BYTES];
@@ -237,6 +240,11 @@ cprng_fast_init_cpu(void *p, void *arg _
 	cprng_strong(kern_cprng, seed, sizeof seed, 0);
 	cprng_fast_seed(cprng, seed);
 	(void)explicit_memset(seed, 0, sizeof seed);
+
+	cprng->reseed_evcnt = kmem_alloc(sizeof(*cprng->reseed_evcnt),
+	KM_SLEEP);
+	evcnt_attach_dynamic(cprng->reseed_evcnt, EVCNT_TYPE_MISC, NULL,
+	ci->ci_cpuname, "cprng_fast reseed");
 }
 
 static inline int
@@ -285,6 +293,7 @@ cprng_fast_intr(void *cookie __unused)
 	s = splvm();
 	cprng_fast_seed(cprng, seed);
 	cprng->epoch = epoch;
+	cprng->reseed_evcnt->ev_count++;
 	splx(s);
 	percpu_putref(cprng_fast_percpu);
 



CVS commit: src/sys/arch

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:29:20 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: machdep.c
src/sys/arch/i386/i386: machdep.c
src/sys/arch/x86/include: cpu_rng.h
src/sys/arch/x86/x86: cpu_rng.c pmap.c

Log Message:
Simplify Intel RDRAND/RDSEED and VIA C3 RNG API.

Push it all into MD x86 code to keep it simpler, until we have other
examples on other CPUs.  Simplify RDSEED-to-RDRAND fallback.
Eliminate cpu_earlyrng in favour of just using entropy_extract, which
is available early now.


To generate a diff of this commit:
cvs rdiff -u -r1.349 -r1.350 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.827 -r1.828 src/sys/arch/i386/i386/machdep.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/include/cpu_rng.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/cpu_rng.c
cvs rdiff -u -r1.384 -r1.385 src/sys/arch/x86/x86/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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.349 src/sys/arch/amd64/amd64/machdep.c:1.350
--- src/sys/arch/amd64/amd64/machdep.c:1.349	Tue Apr 28 21:35:35 2020
+++ src/sys/arch/amd64/amd64/machdep.c	Thu Apr 30 03:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.349 2020/04/28 21:35:35 jmcneill Exp $	*/
+/*	$NetBSD: machdep.c,v 1.350 2020/04/30 03:29:19 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.349 2020/04/28 21:35:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.350 2020/04/30 03:29:19 riastradh Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -167,6 +167,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1682,6 +1683,7 @@ init_x86_64(paddr_t first_avail)
 	uvm_lwp_setuarea(, lwp0uarea);
 
 	cpu_probe(_info_primary);
+	cpu_rng_init();
 #ifdef SVS
 	svs_init();
 #endif

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.827 src/sys/arch/i386/i386/machdep.c:1.828
--- src/sys/arch/i386/i386/machdep.c:1.827	Sat Apr 25 15:26:17 2020
+++ src/sys/arch/i386/i386/machdep.c	Thu Apr 30 03:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.827 2020/04/25 15:26:17 bouyer Exp $	*/
+/*	$NetBSD: machdep.c,v 1.828 2020/04/30 03:29:19 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.827 2020/04/25 15:26:17 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.828 2020/04/30 03:29:19 riastradh Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -122,6 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1142,6 +1143,7 @@ init386(paddr_t first_avail)
 	uvm_lwp_setuarea(, lwp0uarea);
 
 	cpu_probe(_info_primary);
+	cpu_rng_init();
 	cpu_init_msrs(_info_primary, true);
 #ifndef XEN
 	cpu_speculation_init(_info_primary);

Index: src/sys/arch/x86/include/cpu_rng.h
diff -u src/sys/arch/x86/include/cpu_rng.h:1.2 src/sys/arch/x86/include/cpu_rng.h:1.3
--- src/sys/arch/x86/include/cpu_rng.h:1.2	Sat Jul 21 06:09:13 2018
+++ src/sys/arch/x86/include/cpu_rng.h	Thu Apr 30 03:29:19 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.h,v 1.2 2018/07/21 06:09:13 maxv Exp $ */
+/* $NetBSD: cpu_rng.h,v 1.3 2020/04/30 03:29:19 riastradh Exp $ */
 
 #ifndef _X86_CPU_RNG_H_
 #define _X86_CPU_RNG_H_
@@ -32,12 +32,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-
-typedef uint64_t cpu_rng_t;
-
-bool cpu_rng_init(void);
-size_t cpu_rng(cpu_rng_t *);
-void cpu_earlyrng(void *, size_t);
+void cpu_rng_init(void);
 
 #endif /* _X86_CPU_RNG_H_ */

Index: src/sys/arch/x86/x86/cpu_rng.c
diff -u src/sys/arch/x86/x86/cpu_rng.c:1.10 src/sys/arch/x86/x86/cpu_rng.c:1.11
--- src/sys/arch/x86/x86/cpu_rng.c:1.10	Fri Nov  1 15:01:27 2019
+++ src/sys/arch/x86/x86/cpu_rng.c	Thu Apr 30 03:29:20 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_rng.c,v 1.10 2019/11/01 15:01:27 taca Exp $ */
+/* $NetBSD: cpu_rng.c,v 1.11 2020/04/30 03:29:20 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -33,11 +33,24 @@
  * The VIA RNG code in this file is inspired by Jason Wright and
  * Theo de Raadt's OpenBSD version but has been rewritten in light of
  * comments from Henric Jungheim on the t...@openbsd.org mailing list.
+ *
+ * For reference on Intel RDRAND/RDSEED, see the Intel Digital Random
+ * Number Generator Software Implementation Guide (`Intel DRNG SIG'),
+ * Revision 2.1, October 17, 2018.
+ * https://software.intel.com/sites/default/files/managed/98/4a/DRNG_Software_Implementation_Guide_2.1.pdf
+ *
+ * For reference on AMD RDRAND/RDSEED, which are designed to be
+ * compatible with Intel RDRAND/RDSEED, see the 

CVS commit: src/sbin/rndctl

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:27:15 UTC 2020

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

Log Message:
Sort includes.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sbin/rndctl/rndctl.c

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

Modified files:

Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.32 src/sbin/rndctl/rndctl.c:1.33
--- src/sbin/rndctl/rndctl.c:1.32	Thu Apr 30 03:24:48 2020
+++ src/sbin/rndctl/rndctl.c	Thu Apr 30 03:27:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndctl.c,v 1.32 2020/04/30 03:24:48 riastradh Exp $	*/
+/*	$NetBSD: rndctl.c,v 1.33 2020/04/30 03:27:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997 Michael Graff.
@@ -28,30 +28,28 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include 
-#include 
-#include 
 
+#include 
 #ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.32 2020/04/30 03:24:48 riastradh Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.33 2020/04/30 03:27:15 riastradh Exp $");
 #endif
 
-
-#include 
-#include 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
+#include 
+#include 
 #include 
+#include 
+#include 
+#include 
 #include 
+#include 
 
 typedef struct {
 	const char *a_name;



CVS commit: src/sbin/rndctl

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:24:48 UTC 2020

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

Log Message:
Accept both byte orders for random seed in `rndctl -L'.

The file format was defined with a machine-dependent 32-bit integer
field (the estimated number of bits of entropy in the process that
generated it).  Take whichever byte order gives a number that is
reasonable, i.e. lower than the number of bits in the buffer.

Continue to have `rndctl -S' generate it in machine-dependent byte
order for now, so that if you roll back to an older rndctl(8) then
`rndctl -L' on the same machine will still be able to load it with
the right entropy estimate.  In a future revision, perhaps we can
change it to be little-endian.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sbin/rndctl/rndctl.c

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

Modified files:

Index: src/sbin/rndctl/rndctl.c
diff -u src/sbin/rndctl/rndctl.c:1.31 src/sbin/rndctl/rndctl.c:1.32
--- src/sbin/rndctl/rndctl.c:1.31	Fri Dec  6 14:43:18 2019
+++ src/sbin/rndctl/rndctl.c	Thu Apr 30 03:24:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rndctl.c,v 1.31 2019/12/06 14:43:18 riastradh Exp $	*/
+/*	$NetBSD: rndctl.c,v 1.32 2020/04/30 03:24:48 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 1997 Michael Graff.
@@ -33,13 +33,14 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: rndctl.c,v 1.31 2019/12/06 14:43:18 riastradh Exp $");
+__RCSID("$NetBSD: rndctl.c,v 1.32 2020/04/30 03:24:48 riastradh Exp $");
 #endif
 
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -192,9 +193,8 @@ do_save(const char *filename, const void
 	MIN(sizeof(rs.data), UINT32_MAX/NBBY)*NBBY);
 
 	/*
-	 * Compute the checksum on the 32-bit entropy count, in host
-	 * byte order (XXX this means it is not portable across
-	 * different-endian platforms!), followed by the seed data.
+	 * Compute the checksum on the 32-bit entropy count, followed
+	 * by the seed data.
 	 */
 	SHA1Init();
 	SHA1Update(, (const uint8_t *), sizeof(rs.entropy));
@@ -309,6 +309,17 @@ do_load(const char *filename)
 		rs.entropy = 0;
 	}
 
+	/*
+	 * If the entropy is insensibly large, try byte-swapping.
+	 * Otherwise assume the file is corrupted and act as though it
+	 * has zero entropy.
+	 */
+	if (howmany(rs.entropy, NBBY) > sizeof(rs.data)) {
+		rs.entropy = bswap32(rs.entropy);
+		if (howmany(rs.entropy, NBBY) > sizeof(rs.data))
+			rs.entropy = 0;
+	}
+
 	/* Format the ioctl request.  */
 	rd.len = MIN(sizeof(rd.data), sizeof(rs.data));
 	rd.entropy = rs.entropy;



CVS commit: src/sys/dev/usb

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:24:28 UTC 2020

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

Log Message:
Turn XXX comment into KASSERT.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/ualea.c

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

Modified files:

Index: src/sys/dev/usb/ualea.c
diff -u src/sys/dev/usb/ualea.c:1.9 src/sys/dev/usb/ualea.c:1.10
--- src/sys/dev/usb/ualea.c:1.9	Sun Jan 21 13:57:12 2018
+++ src/sys/dev/usb/ualea.c	Thu Apr 30 03:24:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ualea.c,v 1.9 2018/01/21 13:57:12 skrll Exp $	*/
+/*	$NetBSD: ualea.c,v 1.10 2020/04/30 03:24:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.9 2018/01/21 13:57:12 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ualea.c,v 1.10 2020/04/30 03:24:28 riastradh Exp $");
 
 #include 
 #include 
@@ -198,12 +198,9 @@ ualea_xfer(struct ualea_softc *sc)
 		return;
 
 	/* Issue xfer or complain if we can't.  */
-	/*
-	 * XXX Does USBD_NORMAL_COMPLETION (= 0) make sense here?  The
-	 * xfer can't complete synchronously because of the lock.
-	 */
 	status = usbd_transfer(sc->sc_xfer);
-	if (status && status != USBD_IN_PROGRESS) {
+	KASSERT(status != USBD_NORMAL_COMPLETION); /* asynchronous xfer */
+	if (status != USBD_IN_PROGRESS) {
 		aprint_error_dev(sc->sc_dev, "failed to issue xfer: %d\n",
 		status);
 		/* We failed -- let someone else have a go.  */



CVS commit: src/sys/dev/pci

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:24:15 UTC 2020

Modified Files:
src/sys/dev/pci: amdpm.c hifn7751.c ubsec.c

Log Message:
Don't attach rndsource until it's actually ready to run.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/pci/amdpm.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/hifn7751.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/ubsec.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/amdpm.c
diff -u src/sys/dev/pci/amdpm.c:1.39 src/sys/dev/pci/amdpm.c:1.40
--- src/sys/dev/pci/amdpm.c:1.39	Mon Apr 13 16:33:25 2015
+++ src/sys/dev/pci/amdpm.c	Thu Apr 30 03:24:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdpm.c,v 1.39 2015/04/13 16:33:25 riastradh Exp $	*/
+/*	$NetBSD: amdpm.c,v 1.40 2020/04/30 03:24:15 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.39 2015/04/13 16:33:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.40 2020/04/30 03:24:15 riastradh Exp $");
 
 #include "opt_amdpm.h"
 
@@ -191,11 +191,6 @@ amdpm_attach(device_t parent, device_t s
 			"random number generator enabled (apprx. %dms)\n",
 			i);
 			callout_init(>sc_rnd_ch, CALLOUT_MPSAFE);
-			rndsource_setcb(>sc_rnd_source,
-	amdpm_rnd_get, sc);
-			rnd_attach_source(>sc_rnd_source,
-			device_xname(self), RND_TYPE_RNG,
-			RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 #ifdef AMDPM_RND_COUNTERS
 			evcnt_attach_dynamic(>sc_rnd_hits, EVCNT_TYPE_MISC,
 			NULL, device_xname(self), "rnd hits");
@@ -207,6 +202,11 @@ amdpm_attach(device_t parent, device_t s
 "rnd data");
 			}
 #endif
+			rndsource_setcb(>sc_rnd_source,
+	amdpm_rnd_get, sc);
+			rnd_attach_source(>sc_rnd_source,
+			device_xname(self), RND_TYPE_RNG,
+			RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 			sc->sc_rnd_need = RND_POOLBITS / NBBY;
 			amdpm_rnd_callout(sc);
 		}

Index: src/sys/dev/pci/hifn7751.c
diff -u src/sys/dev/pci/hifn7751.c:1.65 src/sys/dev/pci/hifn7751.c:1.66
--- src/sys/dev/pci/hifn7751.c:1.65	Sat Feb 29 16:36:25 2020
+++ src/sys/dev/pci/hifn7751.c	Thu Apr 30 03:24:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hifn7751.c,v 1.65 2020/02/29 16:36:25 mlelstv Exp $	*/
+/*	$NetBSD: hifn7751.c,v 1.66 2020/04/30 03:24:15 riastradh Exp $	*/
 /*	$FreeBSD: hifn7751.c,v 1.5.2.7 2003/10/08 23:52:00 sam Exp $ */
 /*	$OpenBSD: hifn7751.c,v 1.140 2003/08/01 17:55:54 deraadt Exp $	*/
 
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.65 2020/02/29 16:36:25 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hifn7751.c,v 1.66 2020/04/30 03:24:15 riastradh Exp $");
 
 #include 
 #include 
@@ -595,13 +595,6 @@ hifn_init_pubrng(struct hifn_softc *sc)
 		 */
 		DELAY(4000);
 
-#ifdef __NetBSD__
-		rndsource_setcb(>sc_rnd_source, hifn_rng_get, sc);
-		rnd_attach_source(>sc_rnd_source, device_xname(sc->sc_dv),
-  RND_TYPE_RNG,
-  RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-#endif
-
 		if (hz >= 100)
 			sc->sc_rnghz = hz / 100;
 		else
@@ -611,6 +604,13 @@ hifn_init_pubrng(struct hifn_softc *sc)
 #else	/* !__OpenBSD__ */
 		callout_init(>sc_rngto, CALLOUT_MPSAFE);
 #endif	/* !__OpenBSD__ */
+
+#ifdef __NetBSD__
+		rndsource_setcb(>sc_rnd_source, hifn_rng_get, sc);
+		rnd_attach_source(>sc_rnd_source, device_xname(sc->sc_dv),
+  RND_TYPE_RNG,
+  RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
+#endif
 	}
 
 	/* Enable public key engine, if available */

Index: src/sys/dev/pci/ubsec.c
diff -u src/sys/dev/pci/ubsec.c:1.48 src/sys/dev/pci/ubsec.c:1.49
--- src/sys/dev/pci/ubsec.c:1.48	Mon Mar 16 21:20:09 2020
+++ src/sys/dev/pci/ubsec.c	Thu Apr 30 03:24:15 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ubsec.c,v 1.48 2020/03/16 21:20:09 pgoyette Exp $	*/
+/*	$NetBSD: ubsec.c,v 1.49 2020/04/30 03:24:15 riastradh Exp $	*/
 /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */
 /*	$OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$	*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.48 2020/03/16 21:20:09 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.49 2020/04/30 03:24:15 riastradh Exp $");
 
 #undef UBSEC_DEBUG
 
@@ -501,11 +501,6 @@ ubsec_attach(device_t parent, device_t s
 			ubsec_dma_free(sc, >sc_rng.rng_q.q_mcr);
 			goto skip_rng;
 		}
-
-		rndsource_setcb(>sc_rnd_source, ubsec_rng_get, sc);
-		rnd_attach_source(>sc_rnd_source, device_xname(sc->sc_dev),
-  RND_TYPE_RNG,
-  RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 		if (hz >= 100)
 			sc->sc_rnghz = hz / 100;
 		else
@@ -516,8 +511,15 @@ ubsec_attach(device_t parent, device_t s
 #else
 		callout_init(>sc_rngto, 0);
 		callout_setfunc(>sc_rngto, ubsec_rng, sc);
+#endif
+		rndsource_setcb(>sc_rnd_source, ubsec_rng_get, sc);
+		rnd_attach_source(>sc_rnd_source, device_xname(sc->sc_dev),
+  RND_TYPE_RNG,
+  

CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 30 01:52:09 UTC 2020

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

Log Message:
msk(4): rework rx descriptor loading to support multiple segments

This paves the way to replace the driver-internal jumbo frame rx buffer
with other recieve buffers (for example MCLGET/MEXTMALLOC) in the future.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/pci/if_msk.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_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.105 src/sys/dev/pci/if_msk.c:1.106
--- src/sys/dev/pci/if_msk.c:1.105	Wed Apr 29 20:03:52 2020
+++ src/sys/dev/pci/if_msk.c	Thu Apr 30 01:52:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.106 2020/04/30 01:52:08 jakllsch Exp $");
 
 #include 
 #include 
@@ -113,7 +113,7 @@ static int msk_init(struct ifnet *);
 static void msk_init_yukon(struct sk_if_softc *);
 static void msk_stop(struct ifnet *, int);
 static void msk_watchdog(struct ifnet *);
-static int msk_newbuf(struct sk_if_softc *, bus_dmamap_t);
+static int msk_newbuf(struct sk_if_softc *);
 static int msk_alloc_jumbo_mem(struct sk_if_softc *);
 static void *msk_jalloc(struct sk_if_softc *);
 static void msk_jfree(struct mbuf *, void *, size_t, void *);
@@ -472,13 +472,18 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 }
 
 static int
-msk_newbuf(struct sk_if_softc *sc_if, bus_dmamap_t dmamap)
+msk_newbuf(struct sk_if_softc *sc_if)
 {
+	struct sk_softc		*sc = sc_if->sk_softc;
 	struct mbuf		*m_new = NULL;
 	struct sk_chain		*c;
 	struct msk_rx_desc	*r;
 	void			*buf = NULL;
 	bus_addr_t		addr;
+	bus_dmamap_t		rxmap;
+	size_t			i;
+	uint32_t		rxidx, frag, cur, hiaddr, old_hiaddr, total;
+	uint32_t		entries = 0;
 
 	MGETHDR(m_new, M_DONTWAIT, MT_DATA);
 	if (m_new == NULL)
@@ -499,44 +504,99 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 
 	m_adj(m_new, ETHER_ALIGN);
 
-	addr = dmamap->dm_segs[0].ds_addr +
-		  ((vaddr_t)m_new->m_data -
-		   (vaddr_t)sc_if->sk_cdata.sk_jumbo_buf);
-
-	if (sc_if->sk_cdata.sk_rx_hiaddr != MSK_ADDR_HI(addr)) {
-		c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-		r = _if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
-		c->sk_mbuf = NULL;
-		r->sk_addr = htole32(MSK_ADDR_HI(addr));
-		r->sk_len = 0;
-		r->sk_ctl = 0;
-		r->sk_opcode = SK_Y2_BMUOPC_ADDR64 | SK_Y2_RXOPC_OWN;
-		sc_if->sk_cdata.sk_rx_hiaddr = MSK_ADDR_HI(addr);
+	rxidx = frag = cur = sc_if->sk_cdata.sk_rx_prod;
+	rxmap = sc_if->sk_cdata.sk_rx_chain[rxidx].sk_dmamap;
 
-		MSK_CDRXSYNC(sc_if, sc_if->sk_cdata.sk_rx_prod,
-		BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+	if (bus_dmamap_load_mbuf(sc->sc_dmatag, rxmap, m_new, BUS_DMA_NOWAIT)) {
+		DPRINTFN(2, ("msk_newbuf: dmamap_load failed\n"));
+		m_freem(m_new);
+		return ENOBUFS;
+	}
 
-		SK_INC(sc_if->sk_cdata.sk_rx_prod, MSK_RX_RING_CNT);
-		sc_if->sk_cdata.sk_rx_cnt++;
+	/* Count how many rx descriptors needed. */
+	hiaddr = sc_if->sk_cdata.sk_rx_hiaddr;
+	for (total = i = 0; i < rxmap->dm_nsegs; i++) {
+		if (hiaddr != MSK_ADDR_HI(rxmap->dm_segs[i].ds_addr)) {
+			hiaddr = MSK_ADDR_HI(rxmap->dm_segs[i].ds_addr);
+			total++;
+		}
+		total++;
+	}
 
-		DPRINTFN(10, ("%s: rx ADDR64: %#x\n",
-		sc_if->sk_ethercom.ec_if.if_xname,
-			(unsigned)MSK_ADDR_HI(addr)));
+	if (total > MSK_RX_RING_CNT - sc_if->sk_cdata.sk_rx_cnt - 1) {
+		DPRINTFN(2, ("msk_newbuf: too few descriptors free\n"));
+		bus_dmamap_unload(sc->sc_dmatag, rxmap);
+		m_freem(m_new);
+		return ENOBUFS;
 	}
 
-	c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-	r = _if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
-	c->sk_mbuf = m_new;
-	r->sk_addr = htole32(MSK_ADDR_LO(addr));
-	r->sk_len = htole16(SK_JLEN);
-	r->sk_ctl = 0;
-	r->sk_opcode = SK_Y2_RXOPC_PACKET | SK_Y2_RXOPC_OWN;
+	DPRINTFN(2, ("msk_newbuf: dm_nsegs=%d total desc=%u\n",
+	rxmap->dm_nsegs, total));
 
-	MSK_CDRXSYNC(sc_if, sc_if->sk_cdata.sk_rx_prod,
+	/* Sync the DMA map. */
+	bus_dmamap_sync(sc->sc_dmatag, rxmap, 0, rxmap->dm_mapsize,
+	BUS_DMASYNC_PREREAD);
+
+	old_hiaddr = sc_if->sk_cdata.sk_rx_hiaddr;
+	for (i = 0; i < rxmap->dm_nsegs; i++) {
+		addr = rxmap->dm_segs[i].ds_addr;
+		DPRINTFN(2, ("msk_newbuf: addr %llx\n",
+		(unsigned long long)addr));
+		hiaddr = MSK_ADDR_HI(addr);
+
+		if (sc_if->sk_cdata.sk_rx_hiaddr != hiaddr) {
+			c = _if->sk_cdata.sk_rx_chain[frag];
+			c->sk_mbuf = NULL;
+			r = _if->sk_rdata->sk_rx_ring[frag];
+			r->sk_addr = htole32(hiaddr);
+			r->sk_len = 0;
+			r->sk_ctl = 0;
+			if (i == 0)
+r->sk_opcode = 

CVS commit: src/sys/modules/examples

2020-04-29 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 30 00:48:10 UTC 2020

Modified Files:
src/sys/modules/examples: Makefile README
src/sys/modules/examples/ping: ping.c
Added Files:
src/sys/modules/examples/pollpal: Makefile cmd_pollpal.c pollpal.c

Log Message:
New kernel example module written by Ayushi Sharma


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/modules/examples/Makefile
cvs rdiff -u -r1.14 -r1.15 src/sys/modules/examples/README
cvs rdiff -u -r1.3 -r1.4 src/sys/modules/examples/ping/ping.c
cvs rdiff -u -r0 -r1.1 src/sys/modules/examples/pollpal/Makefile \
src/sys/modules/examples/pollpal/cmd_pollpal.c \
src/sys/modules/examples/pollpal/pollpal.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/examples/Makefile
diff -u src/sys/modules/examples/Makefile:1.10 src/sys/modules/examples/Makefile:1.11
--- src/sys/modules/examples/Makefile:1.10	Sat Apr  4 17:15:04 2020
+++ src/sys/modules/examples/Makefile	Wed Apr 29 20:48:10 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2020/04/04 21:15:04 kamil Exp $
+#	$NetBSD: Makefile,v 1.11 2020/04/30 00:48:10 christos Exp $
 
 .include 
 
@@ -12,6 +12,7 @@ SUBDIR+=	mapper			# Needs an additional 
 SUBDIR+=	panic_string		# Crashes the system
 SUBDIR+=	ping			# Needs an additional helper program
 SUBDIR+=	ping_block		# Needs an additional helper program
+SUBDIR+=	pollpal			# Needs an additional helper program
 SUBDIR+=	properties
 SUBDIR+=	readhappy
 SUBDIR+=	readhappy_mpsafe	# Contains an additional helper program

Index: src/sys/modules/examples/README
diff -u src/sys/modules/examples/README:1.14 src/sys/modules/examples/README:1.15
--- src/sys/modules/examples/README:1.14	Sat Apr  4 17:15:04 2020
+++ src/sys/modules/examples/README	Wed Apr 29 20:48:10 2020
@@ -1,4 +1,4 @@
-	$NetBSD: README,v 1.14 2020/04/04 21:15:04 kamil Exp $
+	$NetBSD: README,v 1.15 2020/04/30 00:48:10 christos Exp $
 
Kernel Developer's Manual
 
@@ -17,6 +17,7 @@ DESCRIPTION
  * ping- basic ioctl(9)
  * ping_block  - basic ioctl(9) with a block device
  * properties  - handle incoming properties during the module load
+ * pollpal - implementation of basic poll(9) using palindrome
  * readhappy   - basic implementation of read(9) with happy numbers
  * readhappy_mpsafe- demonstrates how to make a module MPSAFE
  * sysctl  - demonstrates adding a sysctl handle dynamically
@@ -82,5 +83,8 @@ HISTORY
  The current_time module first appeared in NetBSD 10.0 and was authored by
  Apurva Nandan.
 
+ The pollpall module first appeared in NetBSD 10.0 and was authored by
+ Ayushi Sharma.
+
 AUTHORS
  This document was written by Kamil Rytarowski.

Index: src/sys/modules/examples/ping/ping.c
diff -u src/sys/modules/examples/ping/ping.c:1.3 src/sys/modules/examples/ping/ping.c:1.4
--- src/sys/modules/examples/ping/ping.c:1.3	Wed Feb  5 09:10:46 2020
+++ src/sys/modules/examples/ping/ping.c	Wed Apr 29 20:48:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ping.c,v 1.3 2020/02/05 14:10:46 pgoyette Exp $	*/
+/*	$NetBSD: ping.c,v 1.4 2020/04/30 00:48:10 christos Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -27,13 +27,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.3 2020/02/05 14:10:46 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ping.c,v 1.4 2020/04/30 00:48:10 christos Exp $");
 
+#define DDB
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include "ping.h"
 
@@ -99,6 +101,7 @@ ping_ioctl(dev_t self __unused, u_long c
 	switch(cmd) {
 	case CMD_PING:
 		printf("ping: pong!\n");
+		Debugger();
 		return 0;
 	default:
 		return ENOTTY;

Added files:

Index: src/sys/modules/examples/pollpal/Makefile
diff -u /dev/null src/sys/modules/examples/pollpal/Makefile:1.1
--- /dev/null	Wed Apr 29 20:48:10 2020
+++ src/sys/modules/examples/pollpal/Makefile	Wed Apr 29 20:48:10 2020
@@ -0,0 +1,18 @@
+#   $NetBSD: Makefile,v 1.1 2020/04/30 00:48:10 christos Exp $
+
+.include "../Makefile.inc"
+
+#S?=	/usr/src/sys
+
+KMOD=   pollpal
+SRCS=   pollpal.c
+
+.include 
+
+# To make use of this module, you'll need to separately build the
+# cmd_pollpall program, with a Makefile similar to
+#
+#   MKMAN=  NO
+#   PROG=   cmd_pollpal
+#   .include 
+
Index: src/sys/modules/examples/pollpal/cmd_pollpal.c
diff -u /dev/null src/sys/modules/examples/pollpal/cmd_pollpal.c:1.1
--- /dev/null	Wed Apr 29 20:48:10 2020
+++ src/sys/modules/examples/pollpal/cmd_pollpal.c	Wed Apr 29 20:48:10 2020
@@ -0,0 +1,130 @@
+/*	$NetBSD: cmd_pollpal.c,v 1.1 2020/04/30 00:48:10 christos Exp $	*/
+
+/*-
+ * Copyright (c) 2020 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 

CVS commit: src/sys/dev/pci

2020-04-29 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Apr 30 00:32:16 UTC 2020

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

Log Message:
Sync with r1.3 from OpenBSD

"Use correct bit mask to promptly exit rge_set_phy_power() and
rge_exit_oob() timeout loops.

Spotted by CID 1491296 and 1491309."


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.9 src/sys/dev/pci/if_rge.c:1.10
--- src/sys/dev/pci/if_rge.c:1.9	Sat Feb 29 21:27:19 2020
+++ src/sys/dev/pci/if_rge.c	Thu Apr 30 00:32:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.9 2020/02/29 21:27:19 thorpej Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.10 2020/04/30 00:32:16 sevan Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.2 2020/01/02 09:00:45 kevlo Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.9 2020/02/29 21:27:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.10 2020/04/30 00:32:16 sevan Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -1448,7 +1448,7 @@ rge_set_phy_power(struct rge_softc *sc, 
 		rge_write_phy(sc, 0, MII_BMCR, BMCR_AUTOEN);
 
 		for (i = 0; i < RGE_TIMEOUT; i++) {
-			if ((rge_read_phy_ocp(sc, 0xa420) & 0x0080) == 3)
+			if ((rge_read_phy_ocp(sc, 0xa420) & 0x0007) == 3)
 break;
 			DELAY(1000);
 		}
@@ -1889,7 +1889,7 @@ rge_exit_oob(struct rge_softc *sc)
 
 	if (rge_read_mac_ocp(sc, 0xd42c) & 0x0100) {
 		for (i = 0; i < RGE_TIMEOUT; i++) {
-			if ((rge_read_phy_ocp(sc, 0xa420) & 0x0080) == 2)
+			if ((rge_read_phy_ocp(sc, 0xa420) & 0x0007) == 2)
 break;
 			DELAY(1000);
 		}



CVS commit: src

2020-04-29 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 29 23:15:22 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/usr.bin/make/unit-tests: Makefile
Added Files:
src/usr.bin/make/unit-tests: cond-late.exp cond-late.mk

Log Message:
usr.bin/make: add test case for lazy conditions


To generate a diff of this commit:
cvs rdiff -u -r1.837 -r1.838 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.54 -r1.55 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/cond-late.exp \
src/usr.bin/make/unit-tests/cond-late.mk

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.837 src/distrib/sets/lists/tests/mi:1.838
--- src/distrib/sets/lists/tests/mi:1.837	Sun Apr 26 18:53:32 2020
+++ src/distrib/sets/lists/tests/mi	Wed Apr 29 23:15:22 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.837 2020/04/26 18:53:32 thorpej Exp $
+# $NetBSD: mi,v 1.838 2020/04/29 23:15:22 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -4462,6 +4462,8 @@
 ./usr/tests/usr.bin/make/unit-tests/Makefile	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/comment.mk	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-late.exp	tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/make/unit-tests/cond-late.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond1.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond1.mk	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/make/unit-tests/cond2.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/usr.bin/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.54 src/usr.bin/make/unit-tests/Makefile:1.55
--- src/usr.bin/make/unit-tests/Makefile:1.54	Sat Nov 30 00:38:51 2019
+++ src/usr.bin/make/unit-tests/Makefile	Wed Apr 29 23:15:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.54 2019/11/30 00:38:51 rillig Exp $
+# $NetBSD: Makefile,v 1.55 2020/04/29 23:15:21 rillig Exp $
 #
 # Unit tests for make(1)
 # The main targets are:
@@ -22,6 +22,7 @@ UNIT_TESTS:= ${.PARSEDIR}
 # Keep the list sorted.
 TESTNAMES= \
 	comment \
+	cond-late \
 	cond1 \
 	cond2 \
 	error \

Added files:

Index: src/usr.bin/make/unit-tests/cond-late.exp
diff -u /dev/null src/usr.bin/make/unit-tests/cond-late.exp:1.1
--- /dev/null	Wed Apr 29 23:15:22 2020
+++ src/usr.bin/make/unit-tests/cond-late.exp	Wed Apr 29 23:15:21 2020
@@ -0,0 +1,2 @@
+yes
+no
Index: src/usr.bin/make/unit-tests/cond-late.mk
diff -u /dev/null src/usr.bin/make/unit-tests/cond-late.mk:1.1
--- /dev/null	Wed Apr 29 23:15:22 2020
+++ src/usr.bin/make/unit-tests/cond-late.mk	Wed Apr 29 23:15:21 2020
@@ -0,0 +1,23 @@
+# $NetBSD: cond-late.mk,v 1.1 2020/04/29 23:15:21 rillig Exp $
+#
+# Using the :? modifier, variable expressions can contain conditional
+# expressions that are evaluated late.  Any variables appearing in these
+# conditions are expanded before parsing the condition.  This is
+# different from many other places.
+#
+# Because of this, variables that are used in these lazy conditions
+# should not contain double-quotes, or the parser will probably fail.
+#
+# They should also not contain operators like == or <, since these are
+# actually interpreted as these operators. This is demonstrated below.
+#
+# If the order of evaluation were to change to first parse the condition
+# and then expand the variables, the output would change from the
+# current "yes no" to "yes yes", since both variables are non-empty.
+
+COND.true=	"yes" == "yes"
+COND.false=	"yes" != "yes"
+
+all:
+	@echo ${ ${COND.true} :?yes:no}
+	@echo ${ ${COND.false} :?yes:no}



CVS commit: src/share/misc

2020-04-29 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Wed Apr 29 22:17:38 UTC 2020

Modified Files:
src/share/misc: acronyms.comp

Log Message:
LSO   large send offload


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/share/misc/acronyms.comp

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

Modified files:

Index: src/share/misc/acronyms.comp
diff -u src/share/misc/acronyms.comp:1.301 src/share/misc/acronyms.comp:1.302
--- src/share/misc/acronyms.comp:1.301	Mon Apr 27 09:10:45 2020
+++ src/share/misc/acronyms.comp	Wed Apr 29 22:17:38 2020
@@ -1,4 +1,4 @@
-$NetBSD: acronyms.comp,v 1.301 2020/04/27 09:10:45 plunky Exp $
+$NetBSD: acronyms.comp,v 1.302 2020/04/29 22:17:38 rtr Exp $
 3WHS	three-way handshake
 8VSB	8-state vestigial side band modulation
 AA	anti-aliasing
@@ -882,6 +882,7 @@ LSL	load segment limit
 LSM	log structured merge
 LSN	Large Scale NAT
 LSN	log sequence number
+LSO	large send offload
 LSR	label switch router
 LTCC	low temperature co-fired ceramic
 LTO	linear tape-open



CVS commit: src/sys/arch/x86/x86

2020-04-29 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Apr 29 22:03:10 UTC 2020

Modified Files:
src/sys/arch/x86/x86: cpu.c

Log Message:
Back out HPET delay & TSC changes to rule them out as the cause for recent
hangs during boot etc.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/arch/x86/x86/cpu.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/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.187 src/sys/arch/x86/x86/cpu.c:1.188
--- src/sys/arch/x86/x86/cpu.c:1.187	Sat Apr 25 15:26:18 2020
+++ src/sys/arch/x86/x86/cpu.c	Wed Apr 29 22:03:09 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: cpu.c,v 1.187 2020/04/25 15:26:18 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.188 2020/04/29 22:03:09 ad Exp $	*/
 
 /*
- * Copyright (c) 2000-2020 NetBSD Foundation, Inc.
+ * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.187 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.188 2020/04/29 22:03:09 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -73,7 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18
 #include "lapic.h"
 #include "ioapic.h"
 #include "acpica.h"
-#include "hpet.h"
 
 #include 
 #include 
@@ -120,7 +119,6 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18
 #endif
 
 #include 
-#include 
 #include 
 #include 
 
@@ -204,8 +202,6 @@ static vaddr_t cmos_data_mapping;
 #endif
 struct cpu_info *cpu_starting;
 
-int (*cpu_nullop_ptr)(void *) = nullop;
-
 #ifdef MULTIPROCESSOR
 void		cpu_hatch(void *);
 static void	cpu_boot_secondary(struct cpu_info *ci);
@@ -437,11 +433,8 @@ cpu_attach(device_t parent, device_t sel
 	 * must be done to allow booting other processors.
 	 */
 	if (!again) {
-		/* Make sure DELAY() (likely i8254_delay()) is initialized. */
-		DELAY(1);
-
-		/* Basic init. */
 		atomic_or_32(>ci_flags, CPUF_PRESENT | CPUF_PRIMARY);
+		/* Basic init. */
 		cpu_intr_init(ci);
 		cpu_get_tsc_freq(ci);
 		cpu_init(ci);
@@ -458,6 +451,8 @@ cpu_attach(device_t parent, device_t sel
 lapic_calibrate_timer(ci);
 		}
 #endif
+		/* Make sure DELAY() is initialized. */
+		DELAY(1);
 		kcsan_cpu_init(ci);
 		again = true;
 	}
@@ -723,6 +718,7 @@ cpu_init(struct cpu_info *ci)
 
 	if (ci != _info_primary) {
 		/* Synchronize TSC */
+		wbinvd();
 		atomic_or_32(>ci_flags, CPUF_RUNNING);
 		tsc_sync_ap(ci);
 	} else {
@@ -738,14 +734,6 @@ cpu_boot_secondary_processors(void)
 	kcpuset_t *cpus;
 	u_long i;
 
-#if NHPET > 0
-	/* Use HPET delay, and re-calibrate TSC on boot CPU using HPET. */
-	if (hpet_delay_p() && x86_delay == i8254_delay) {
-		delay_func = x86_delay = hpet_delay;
-		cpu_get_tsc_freq(curcpu());
-	}
-#endif
-
 	/* Now that we know the number of CPUs, patch the text segment. */
 	x86_patch(false);
 
@@ -854,6 +842,7 @@ cpu_start_secondary(struct cpu_info *ci)
 		 */
 		psl = x86_read_psl();
 		x86_disable_intr();
+		wbinvd();
 		tsc_sync_bp(ci);
 		x86_write_psl(psl);
 	}
@@ -884,6 +873,7 @@ cpu_boot_secondary(struct cpu_info *ci)
 		drift = ci->ci_data.cpu_cc_skew;
 		psl = x86_read_psl();
 		x86_disable_intr();
+		wbinvd();
 		tsc_sync_bp(ci);
 		x86_write_psl(psl);
 		drift -= ci->ci_data.cpu_cc_skew;
@@ -929,6 +919,7 @@ cpu_hatch(void *v)
 	 * Synchronize the TSC for the first time. Note that interrupts are
 	 * off at this point.
 	 */
+	wbinvd();
 	atomic_or_32(>ci_flags, CPUF_PRESENT);
 	tsc_sync_ap(ci);
 
@@ -1319,8 +1310,7 @@ cpu_shutdown(device_t dv, int how)
 void
 cpu_get_tsc_freq(struct cpu_info *ci)
 {
-	uint64_t freq = 0, t0, t1;
-	int64_t overhead;
+	uint64_t freq = 0, last_tsc;
 
 	if (cpu_hascounter())
 		freq = cpu_tsc_freq_cpuid(ci);
@@ -1329,31 +1319,11 @@ cpu_get_tsc_freq(struct cpu_info *ci)
 		/* Use TSC frequency taken from CPUID. */
 		ci->ci_data.cpu_cc_freq = freq;
 	} else {
-		/*
-		 * Work out the approximate overhead involved below.
-		 * Discard the result of the first go around the loop.
-		 */
-		overhead = 0;		
-		for (int i = 0; i <= 8; i++) {
-			__insn_barrier();
-			t0 = cpu_counter_serializing();
-			(*cpu_nullop_ptr)(NULL);
-			t1 = cpu_counter_serializing();
-			__insn_barrier();
-			if (i > 0) {
-overhead += (t1 - t0);
-			}
-		}
-		overhead >>= 3;
-
-		/* Now warm up x86_delay() and do the calibration. */
-		x86_delay(1);
-		__insn_barrier();
-		t0 = cpu_counter_serializing();
+		/* Calibrate TSC frequency. */
+		last_tsc = cpu_counter_serializing();
 		x86_delay(10);
-		t1 = cpu_counter_serializing();
-		__insn_barrier();
-		ci->ci_data.cpu_cc_freq = (t1 - t0 - overhead) * 10;
+		ci->ci_data.cpu_cc_freq =
+		(cpu_counter_serializing() - last_tsc) * 10;
 	}
 }
 



CVS commit: src/games/fortune/unstr

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 21:00:42 UTC 2020

Modified Files:
src/games/fortune/unstr: unstr.c

Log Message:
unstr: Check that the input filename fits in the buffer.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/games/fortune/unstr/unstr.c

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

Modified files:

Index: src/games/fortune/unstr/unstr.c
diff -u src/games/fortune/unstr/unstr.c:1.14 src/games/fortune/unstr/unstr.c:1.15
--- src/games/fortune/unstr/unstr.c:1.14	Tue Jun 19 05:46:08 2012
+++ src/games/fortune/unstr/unstr.c	Wed Apr 29 21:00:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: unstr.c,v 1.14 2012/06/19 05:46:08 dholland Exp $	*/
+/*	$NetBSD: unstr.c,v 1.15 2020/04/29 21:00:42 nia Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)unstr.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: unstr.c,v 1.14 2012/06/19 05:46:08 dholland Exp $");
+__RCSID("$NetBSD: unstr.c,v 1.15 2020/04/29 21:00:42 nia Exp $");
 #endif
 #endif /* not lint */
 
@@ -114,7 +114,7 @@ main(int ac __unused, char **av)
 void
 getargs(char *av[])
 {
-	if (!*++av) {
+	if (!*++av || (strlen(*av) + sizeof(".dat")) > sizeof(Datafile)) {
 		(void) fprintf(stderr, "usage: unstr datafile\n");
 		exit(1);
 	}



CVS commit: src/games/fortune/strfile

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 20:45:05 UTC 2020

Modified Files:
src/games/fortune/strfile: strfile.c

Log Message:
strfile: Check that input/output filenames don't exceed the buffer size


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/games/fortune/strfile/strfile.c

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

Modified files:

Index: src/games/fortune/strfile/strfile.c
diff -u src/games/fortune/strfile/strfile.c:1.38 src/games/fortune/strfile/strfile.c:1.39
--- src/games/fortune/strfile/strfile.c:1.38	Thu Sep 19 00:34:00 2013
+++ src/games/fortune/strfile/strfile.c	Wed Apr 29 20:45:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strfile.c,v 1.38 2013/09/19 00:34:00 uwe Exp $	*/
+/*	$NetBSD: strfile.c,v 1.39 2020/04/29 20:45:05 nia Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)strfile.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: strfile.c,v 1.38 2013/09/19 00:34:00 uwe Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.39 2020/04/29 20:45:05 nia Exp $");
 #endif
 #endif /* not lint */
 #endif /* __NetBSD__ */
@@ -267,6 +267,7 @@ getargs(int argc, char **argv)
 	int	ch;
 	extern	int optind;
 	extern	char *optarg;
+	size_t	len;
 
 	while ((ch = getopt(argc, argv, "c:iorsx")) != -1)
 		switch(ch) {
@@ -300,14 +301,25 @@ getargs(int argc, char **argv)
 
 	if (*argv) {
 		Infile = *argv;
-		if (*++argv)
-			(void) strcpy(Outfile, *argv);
+		if (*++argv) {
+			len = strlen(*argv);
+			if (len >= sizeof(Outfile)) {
+puts("Bad output filename");
+usage();
+			}
+			(void) memcpy(Outfile, *argv, len + 1);
+		}
 	}
 	if (!Infile) {
 		puts("No input file name");
 		usage();
 	}
 	if (*Outfile == '\0') {
+		len = strlen(Infile) + sizeof(".dat");
+		if (len > sizeof(Outfile)) {
+			puts("Bad input filename");
+			usage();
+		}
 		(void) strcpy(Outfile, Infile);
 		(void) strcat(Outfile, ".dat");
 	}



CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 29 20:03:52 UTC 2020

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h

Log Message:
msk(4): Simply keep a ring of (tx) dmamaps, rather than a linked list


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/pci/if_mskvar.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/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.104 src/sys/dev/pci/if_msk.c:1.105
--- src/sys/dev/pci/if_msk.c:1.104	Wed Apr 29 18:52:03 2020
+++ src/sys/dev/pci/if_msk.c	Wed Apr 29 20:03:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.105 2020/04/29 20:03:52 jakllsch Exp $");
 
 #include 
 #include 
@@ -1099,7 +1099,6 @@ msk_attach(device_t parent, device_t sel
 	struct sk_softc *sc = device_private(parent);
 	struct skc_attach_args *sa = aux;
 	bus_dmamap_t dmamap;
-	struct sk_txmap_entry *entry;
 	struct ifnet *ifp;
 	struct mii_data * const mii = _if->sk_mii;
 	void *kva;
@@ -1177,7 +1176,6 @@ msk_attach(device_t parent, device_t sel
 		goto fail_3;
 	}
 
-	SIMPLEQ_INIT(_if->sk_txmap_head);
 	for (i = 0; i < MSK_TX_RING_CNT; i++) {
 		sc_if->sk_cdata.sk_tx_chain[i].sk_mbuf = NULL;
 
@@ -1188,9 +1186,7 @@ msk_attach(device_t parent, device_t sel
 			goto fail_3;
 		}
 
-		entry = malloc(sizeof(*entry), M_DEVBUF, M_WAITOK);
-		entry->dmamap = dmamap;
-		SIMPLEQ_INSERT_HEAD(_if->sk_txmap_head, entry, link);
+		sc_if->sk_cdata.sk_tx_chain[i].sk_dmamap = dmamap;
 	}
 
 	sc_if->sk_rdata = (struct msk_ring_data *)kva;
@@ -1294,18 +1290,17 @@ msk_detach(device_t self, int flags)
 {
 	struct sk_if_softc *sc_if = device_private(self);
 	struct sk_softc *sc = sc_if->sk_softc;
-	struct sk_txmap_entry *entry;
 	struct ifnet *ifp = _if->sk_ethercom.ec_if;
+	int i;
 
 	if (sc->sk_if[sc_if->sk_port] == NULL)
 		return 0;
 
 	msk_stop(ifp, 1);
 
-	while ((entry = SIMPLEQ_FIRST(_if->sk_txmap_head))) {
-		SIMPLEQ_REMOVE_HEAD(_if->sk_txmap_head, link);
-		bus_dmamap_destroy(sc->sc_dmatag, entry->dmamap);
-		free(entry, M_DEVBUF);
+	for (i = 0; i < MSK_TX_RING_CNT; i++) {
+		bus_dmamap_destroy(sc->sc_dmatag,
+		sc_if->sk_cdata.sk_tx_chain[i].sk_dmamap);
 	}
 
 	if (--sc->rnd_attached == 0)
@@ -1786,18 +1781,12 @@ msk_encap(struct sk_if_softc *sc_if, str
 	uint32_t		frag, cur, hiaddr, old_hiaddr, total;
 	uint32_t		entries = 0;
 	size_t			i;
-	struct sk_txmap_entry	*entry;
 	bus_dmamap_t		txmap;
 	bus_addr_t		addr;
 
 	DPRINTFN(2, ("msk_encap\n"));
 
-	entry = SIMPLEQ_FIRST(_if->sk_txmap_head);
-	if (entry == NULL) {
-		DPRINTFN(2, ("msk_encap: no txmap available\n"));
-		return ENOBUFS;
-	}
-	txmap = entry->dmamap;
+	txmap = sc_if->sk_cdata.sk_tx_chain[*txidx].sk_dmamap;
 
 	cur = frag = *txidx;
 
@@ -1880,10 +1869,11 @@ msk_encap(struct sk_if_softc *sc_if, str
 	}
 	KASSERTMSG(entries == total, "entries %u total %u", entries, total);
 
+	sc_if->sk_cdata.sk_tx_chain[*txidx].sk_dmamap =
+		sc_if->sk_cdata.sk_tx_chain[cur].sk_dmamap;
 	sc_if->sk_cdata.sk_tx_chain[cur].sk_mbuf = m_head;
-	SIMPLEQ_REMOVE_HEAD(_if->sk_txmap_head, link);
+	sc_if->sk_cdata.sk_tx_chain[cur].sk_dmamap = txmap;
 
-	sc_if->sk_cdata.sk_tx_map[cur] = entry;
 	sc_if->sk_rdata->sk_tx_ring[cur].sk_ctl |= SK_Y2_TXCTL_LASTFRAG;
 
 	/* Sync descriptors before handing to chip */
@@ -2087,7 +2077,7 @@ msk_txeof(struct sk_if_softc *sc_if)
 	struct msk_tx_desc	*cur_tx;
 	struct ifnet		*ifp = _if->sk_ethercom.ec_if;
 	uint32_t		idx, reg, sk_ctl;
-	struct sk_txmap_entry	*entry;
+	bus_dmamap_t		dmamap;
 
 	DPRINTFN(2, ("msk_txeof\n"));
 
@@ -2114,15 +2104,12 @@ msk_txeof(struct sk_if_softc *sc_if)
 		if (sk_ctl & SK_Y2_TXCTL_LASTFRAG)
 			if_statinc(ifp, if_opackets);
 		if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) {
-			entry = sc_if->sk_cdata.sk_tx_map[idx];
+			dmamap = sc_if->sk_cdata.sk_tx_chain[idx].sk_dmamap;
 
-			bus_dmamap_sync(sc->sc_dmatag, entry->dmamap, 0,
-			entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
+			bus_dmamap_sync(sc->sc_dmatag, dmamap, 0,
+			dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE);
 
-			bus_dmamap_unload(sc->sc_dmatag, entry->dmamap);
-			SIMPLEQ_INSERT_TAIL(_if->sk_txmap_head, entry,
-	  link);
-			sc_if->sk_cdata.sk_tx_map[idx] = NULL;
+			bus_dmamap_unload(sc->sc_dmatag, dmamap);
 			m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf);
 			sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL;
 		}
@@ -2611,7 +2598,7 @@ msk_stop(struct ifnet *ifp, int disable)
 {
 	struct sk_if_softc	*sc_if = ifp->if_softc;
 	struct sk_softc		*sc = 

CVS commit: src/sys/dev/pci

2020-04-29 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Apr 29 18:52:03 UTC 2020

Modified Files:
src/sys/dev/pci: if_msk.c if_mskvar.h

Log Message:
msk(4): don't keep array of pointers to each ring descriptor

With 512 descriptors each in 2 rings this saves 4KiB (LP32) or 8KiB (LP64)
per interface.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/if_msk.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/if_mskvar.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/pci/if_msk.c
diff -u src/sys/dev/pci/if_msk.c:1.103 src/sys/dev/pci/if_msk.c:1.104
--- src/sys/dev/pci/if_msk.c:1.103	Tue Apr 28 17:26:01 2020
+++ src/sys/dev/pci/if_msk.c	Wed Apr 29 18:52:03 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $ */
+/* $NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $ */
 /*	$OpenBSD: if_msk.c,v 1.79 2009/10/15 17:54:56 deraadt Exp $	*/
 
 /*
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.103 2020/04/28 17:26:01 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.104 2020/04/29 18:52:03 jakllsch Exp $");
 
 #include 
 #include 
@@ -418,14 +418,9 @@ msk_init_rx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = _if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_rx_desc	*r;
-	int			i;
 
 	memset(rd->sk_rx_ring, 0, sizeof(struct msk_rx_desc) * MSK_RX_RING_CNT);
 
-	for (i = 0; i < MSK_RX_RING_CNT; i++) {
-		cd->sk_rx_chain[i].sk_le = >sk_rx_ring[i];
-	}
-
 	sc_if->sk_cdata.sk_rx_prod = 0;
 	sc_if->sk_cdata.sk_rx_cons = 0;
 	sc_if->sk_cdata.sk_rx_cnt = 0;
@@ -453,14 +448,9 @@ msk_init_tx_ring(struct sk_if_softc *sc_
 	struct msk_chain_data	*cd = _if->sk_cdata;
 	struct msk_ring_data	*rd = sc_if->sk_rdata;
 	struct msk_tx_desc	*t;
-	int			i;
 
 	memset(rd->sk_tx_ring, 0, sizeof(struct msk_tx_desc) * MSK_TX_RING_CNT);
 
-	for (i = 0; i < MSK_TX_RING_CNT; i++) {
-		cd->sk_tx_chain[i].sk_le = >sk_tx_ring[i];
-	}
-
 	sc_if->sk_cdata.sk_tx_prod = 0;
 	sc_if->sk_cdata.sk_tx_cons = 0;
 	sc_if->sk_cdata.sk_tx_cnt = 0;
@@ -515,7 +505,7 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 
 	if (sc_if->sk_cdata.sk_rx_hiaddr != MSK_ADDR_HI(addr)) {
 		c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-		r = c->sk_le;
+		r = _if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
 		c->sk_mbuf = NULL;
 		r->sk_addr = htole32(MSK_ADDR_HI(addr));
 		r->sk_len = 0;
@@ -535,7 +525,7 @@ msk_newbuf(struct sk_if_softc *sc_if, bu
 	}
 
 	c = _if->sk_cdata.sk_rx_chain[sc_if->sk_cdata.sk_rx_prod];
-	r = c->sk_le;
+	r = _if->sk_rdata->sk_rx_ring[sc_if->sk_cdata.sk_rx_prod];
 	c->sk_mbuf = m_new;
 	r->sk_addr = htole32(MSK_ADDR_LO(addr));
 	r->sk_len = htole16(SK_JLEN);

Index: src/sys/dev/pci/if_mskvar.h
diff -u src/sys/dev/pci/if_mskvar.h:1.23 src/sys/dev/pci/if_mskvar.h:1.24
--- src/sys/dev/pci/if_mskvar.h:1.23	Sun Apr 26 16:14:14 2020
+++ src/sys/dev/pci/if_mskvar.h	Wed Apr 29 18:52:03 2020
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_mskvar.h,v 1.3 2006/12/28 16:34:42 kettenis Exp $	*/
-/*	$NetBSD: if_mskvar.h,v 1.23 2020/04/26 16:14:14 jakllsch Exp $	*/
+/*	$NetBSD: if_mskvar.h,v 1.24 2020/04/29 18:52:03 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -89,7 +89,6 @@ struct sk_jpool_entry {
 };
 
 struct sk_chain {
-	void			*sk_le;
 	struct mbuf		*sk_mbuf;
 };
 



CVS commit: [netbsd-9] src/doc

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:56:12 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #865 - #873


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.46 -r1.1.2.47 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.46 src/doc/CHANGES-9.1:1.1.2.47
--- src/doc/CHANGES-9.1:1.1.2.46	Tue Apr 28 18:13:49 2020
+++ src/doc/CHANGES-9.1	Wed Apr 29 13:56:12 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.46 2020/04/28 18:13:49 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.47 2020/04/29 13:56:12 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -2300,3 +2300,63 @@ share/misc/inter.phone1.32
 	Fix some polish entries.
 	[sevan, ticket #862]
 
+sys/dev/pckbport/synaptics.c			1.66
+
+	pms(4): synaptics: fix mouse lockup at X startup.
+	[jmcneill, ticket #865]
+
+sys/dev/acpi/acpi_ec.c1.82
+
+	kern/55206: fix alignment of buffer passed to the EC.
+	[jmcneill, ticket #866]
+
+sys/dev/acpi/acpi_display.c			1.17
+
+	acpi: display: remove unnecessary error prints in dmesg.
+	[jmcneill, ticket #867]
+
+sys/arch/amd64/amd64/machdep.c			1.349
+sys/arch/x86/x86/pmap.c1.384
+
+	amd64: speed up early console framebuffer.
+	[jmcneill, ticket #868]
+
+sys/dev/hdaudio/hdaudiodevs			1.4
+sys/dev/hdaudio/hdaudiodevs.h			(regen)
+sys/dev/hdaudio/hdaudiodevs_data.h		(regen)
+
+	Add Realtek ALC293.
+	[jmcneill, ticket #869]
+
+external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c 1.16
+
+	Fix zfs call to minphys.
+	[riastradh, ticket #870]
+
+external/cddl/osnet/sys/sys/cred.h		1.7
+sys/sys/kauth.h	1.84
+
+	Fix crash in zfs access control.
+	[riastradh, ticket #871]
+
+sys/dev/hdaudio/hdaudiodevs			1.5
+sys/dev/hdaudio/hdaudiodevs.h			(regen)
+sys/dev/hdaudio/hdaudiodevs_data.h		(regen)
+
+	hdaudiodevs: Add Realtek ALC292
+	[nia, ticket #872]
+
+sys/dev/usb/usbdevs1.782
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	usbdevs: more Intel Integrated Rate Matching Hub IDs.
+	[nia, ticket #873]
+
+sys/dev/usb/usbdevs1.782
+sys/dev/usb/usbdevs.h(regen)
+sys/dev/usb/usbdevs_data.h			(regen)
+
+	usbdevs: more Intel Integrated Rate Matching Hub IDs.
+	[nia, ticket #873]
+



CVS commit: [netbsd-9] src/sys/dev/usb

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:54:49 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs.h usbdevs_data.h

Log Message:
Regen for ticket #873


To generate a diff of this commit:
cvs rdiff -u -r1.760.4.5 -r1.760.4.6 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.760.4.5 src/sys/dev/usb/usbdevs.h:1.760.4.6
--- src/sys/dev/usb/usbdevs.h:1.760.4.5	Fri Apr 24 17:29:15 2020
+++ src/sys/dev/usb/usbdevs.h	Wed Apr 29 13:54:48 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.760.4.5 2020/04/24 17:29:15 martin Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.760.4.6 2020/04/29 13:54:48 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.5 2020/04/24 17:28:21 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp
  */
 
 /*-
@@ -1930,6 +1930,12 @@
 
 #define	USB_PRODUCT_INTEL2_RMH	0x0020		/* Rate Matching Hub */
 #define	USB_PRODUCT_INTEL2_RMH2	0x0024		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH3	0x8000		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH4	0x8001		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH5	0x8002		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH6	0x8008		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH7	0x8009		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH8	0x800a		/* Rate Matching Hub */
 #define	USB_PRODUCT_INTEL2_N_6235_BT	0x07da		/* Advanced-N 6235 Combo Bluetooth */
 
 /* Intersil products */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.760.4.5 src/sys/dev/usb/usbdevs_data.h:1.760.4.6
--- src/sys/dev/usb/usbdevs_data.h:1.760.4.5	Fri Apr 24 17:29:15 2020
+++ src/sys/dev/usb/usbdevs_data.h	Wed Apr 29 13:54:48 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.760.4.5 2020/04/24 17:29:15 martin Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.760.4.6 2020/04/29 13:54:48 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.770.4.5 2020/04/24 17:28:21 martin Exp
+ *	NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp
  */
 
 /*-
@@ -2502,6 +2502,18 @@ static const uint16_t usb_products[] = {
 	12007, 12012, 5842, 0,
 	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH2, 
 	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH3, 
+	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH4, 
+	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH5, 
+	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH6, 
+	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH7, 
+	12007, 12012, 5842, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH8, 
+	12007, 12012, 5842, 0,
 	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_N_6235_BT, 
 	12021, 12032, 12037, 4897, 0,
 	USB_VENDOR_INTERSIL, USB_PRODUCT_INTERSIL_PRISM_GT, 
@@ -5764,7 +5776,7 @@ static const char usb_words[] = { "." 
 	"120g\0" /* 1 refs @ 5828 */
 	"121g\0" /* 1 refs @ 5833 */
 	"Kbd\0" /* 3 refs @ 5838 */
-	"Hub\0" /* 30 refs @ 5842 */
+	"Hub\0" /* 36 refs @ 5842 */
 	"MacAlly\0" /* 1 refs @ 5846 */
 	"AU9814\0" /* 1 refs @ 5854 */
 	"MicroConnectors/StrongMan\0" /* 1 refs @ 5861 */
@@ -6581,8 +6593,8 @@ static const char usb_words[] = { "." 
 	"2011B\0" /* 1 refs @ 11990 */
 	"82930\0" /* 1 refs @ 11996 */
 	"test\0" /* 2 refs @ 12002 */
-	"Rate\0" /* 2 refs @ 12007 */
-	"Matching\0" /* 2 refs @ 12012 */
+	"Rate\0" /* 8 refs @ 12007 */
+	"Matching\0" /* 8 refs @ 12012 */
 	"Advanced-N\0" /* 1 refs @ 12021 */
 	"6235\0" /* 1 refs @ 12032 */
 	"Combo\0" /* 2 refs @ 12037 */



CVS commit: [netbsd-9] src/sys/dev/usb

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:53:51 UTC 2020

Modified Files:
src/sys/dev/usb [netbsd-9]: usbdevs

Log Message:
Pull up following revision(s) (requested by nia in ticket #873):

sys/dev/usb/usbdevs: revision 1.782

usbdevs: more Intel Integrated Rate Matching Hub IDs


To generate a diff of this commit:
cvs rdiff -u -r1.770.4.5 -r1.770.4.6 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.770.4.5 src/sys/dev/usb/usbdevs:1.770.4.6
--- src/sys/dev/usb/usbdevs:1.770.4.5	Fri Apr 24 17:28:21 2020
+++ src/sys/dev/usb/usbdevs	Wed Apr 29 13:53:51 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.770.4.5 2020/04/24 17:28:21 martin Exp $
+$NetBSD: usbdevs,v 1.770.4.6 2020/04/29 13:53:51 martin Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1923,6 +1923,12 @@ product INTEL TESTBOARD		0x9890	82930 te
 
 product INTEL2 RMH		0x0020	Rate Matching Hub
 product INTEL2 RMH2		0x0024	Rate Matching Hub
+product INTEL2 RMH3		0x8000	Rate Matching Hub
+product INTEL2 RMH4		0x8001	Rate Matching Hub
+product INTEL2 RMH5		0x8002	Rate Matching Hub
+product INTEL2 RMH6		0x8008	Rate Matching Hub
+product INTEL2 RMH7		0x8009	Rate Matching Hub
+product INTEL2 RMH8		0x800a	Rate Matching Hub
 product INTEL2 N_6235_BT	0x07da	Advanced-N 6235 Combo Bluetooth
 
 /* Intersil products */



CVS commit: [netbsd-9] src/sys/dev/hdaudio

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:51:09 UTC 2020

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdaudiodevs.h hdaudiodevs_data.h

Log Message:
Regen for ticket #872


To generate a diff of this commit:
cvs rdiff -u -r1.2.26.2 -r1.2.26.3 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.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/hdaudio/hdaudiodevs.h
diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.2 src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.3
--- src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.2	Wed Apr 29 13:43:42 2020
+++ src/sys/dev/hdaudio/hdaudiodevs.h	Wed Apr 29 13:51:09 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs.h,v 1.2.26.2 2020/04/29 13:43:42 martin Exp $	*/
+/*	$NetBSD: hdaudiodevs.h,v 1.2.26.3 2020/04/29 13:51:09 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp
+ *	NetBSD: hdaudiodevs,v 1.2.26.3 2020/04/29 13:50:38 martin Exp
  */
 
 /*
@@ -84,6 +84,7 @@
 #define	HDAUDIO_PRODUCT_REALTEK_ALC272	0x0272		/* ALC272 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC275	0x0275		/* ALC275 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC280	0x0280		/* ALC280 */
+#define	HDAUDIO_PRODUCT_REALTEK_ALC292	0x0292		/* ALC292 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC293	0x0293		/* ALC293 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC660_VD	0x0660		/* ALC660-VD */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC662	0x0662		/* ALC662 */
Index: src/sys/dev/hdaudio/hdaudiodevs_data.h
diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.2 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.3
--- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.2	Wed Apr 29 13:43:42 2020
+++ src/sys/dev/hdaudio/hdaudiodevs_data.h	Wed Apr 29 13:51:09 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs_data.h,v 1.2.26.2 2020/04/29 13:43:42 martin Exp $	*/
+/*	$NetBSD: hdaudiodevs_data.h,v 1.2.26.3 2020/04/29 13:51:09 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp
+ *	NetBSD: hdaudiodevs,v 1.2.26.3 2020/04/29 13:50:38 martin Exp
  */
 
 /*
@@ -102,322 +102,324 @@ static const uint16_t hdaudio_products[]
 	230, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC280, 
 	237, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC293, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC292, 
 	244, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC293, 
 	251, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	258, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC662, 
-	261, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	268, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	275, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
 	282, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
 	289, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	296, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC880, 
-	299, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	306, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	313, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
 	320, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
 	327, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
 	334, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
 	341, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
 	348, 0,
-	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
 	355, 0,
+	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709, 
-	355, 0,
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170A, 
-	355, 0,
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170B, 
-	355, 0,
+	362, 0,
 	

CVS commit: [netbsd-9] src/sys/dev/hdaudio

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:50:38 UTC 2020

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdaudiodevs

Log Message:
Pull up following revision(s) (requested by nia in ticket #872):

sys/dev/hdaudio/hdaudiodevs: revision 1.5

hdaudiodevs: Add Realtek ALC292


To generate a diff of this commit:
cvs rdiff -u -r1.2.26.2 -r1.2.26.3 src/sys/dev/hdaudio/hdaudiodevs

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/hdaudio/hdaudiodevs
diff -u src/sys/dev/hdaudio/hdaudiodevs:1.2.26.2 src/sys/dev/hdaudio/hdaudiodevs:1.2.26.3
--- src/sys/dev/hdaudio/hdaudiodevs:1.2.26.2	Wed Apr 29 13:42:21 2020
+++ src/sys/dev/hdaudio/hdaudiodevs	Wed Apr 29 13:50:38 2020
@@ -1,4 +1,4 @@
-$NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp $
+$NetBSD: hdaudiodevs,v 1.2.26.3 2020/04/29 13:50:38 martin Exp $
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -77,6 +77,7 @@ product	REALTEK		ALC270		0x0270	ALC270
 product	REALTEK		ALC272		0x0272	ALC272
 product	REALTEK		ALC275		0x0275	ALC275
 product	REALTEK		ALC280		0x0280	ALC280
+product	REALTEK		ALC292		0x0292	ALC292
 product	REALTEK		ALC293		0x0293	ALC293
 product	REALTEK		ALC660_VD	0x0660	ALC660-VD
 product	REALTEK		ALC662		0x0662	ALC662



CVS commit: [netbsd-9] src

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:47:52 UTC 2020

Modified Files:
src/external/cddl/osnet/sys/sys [netbsd-9]: cred.h
src/sys/sys [netbsd-9]: kauth.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #871):

external/cddl/osnet/sys/sys/cred.h: revision 1.7
sys/sys/kauth.h: revision 1.84

Fix crgetgroups shim.

- Don't use a static buffer for the result.
- kauth_cred_getgroups refuses to return more than the actual number
  of groups, so passing NGROUPS_MAX generally doesn't work.

To avoid patching zfs, just expose struct kauth_cred::cr_groups
directly, with __KAUTH_PRIVATE.  Unclear why the official API only
exposes it via memcpy or copyout anyway.

This makes unprivileged zfs operations work, by anyone with access to
/dev/zfs (which is conventionally mode 777, and which we should maybe
set it to by default; zfs has its own ACL system, zfs allow).


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.2.1 src/external/cddl/osnet/sys/sys/cred.h
cvs rdiff -u -r1.82 -r1.82.4.1 src/sys/sys/kauth.h

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

Modified files:

Index: src/external/cddl/osnet/sys/sys/cred.h
diff -u src/external/cddl/osnet/sys/sys/cred.h:1.6 src/external/cddl/osnet/sys/sys/cred.h:1.6.2.1
--- src/external/cddl/osnet/sys/sys/cred.h:1.6	Wed Feb  6 17:56:57 2019
+++ src/external/cddl/osnet/sys/sys/cred.h	Wed Apr 29 13:47:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cred.h,v 1.6 2019/02/06 17:56:57 christos Exp $	*/
+/*	$NetBSD: cred.h,v 1.6.2.1 2020/04/29 13:47:51 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 Pawel Jakub Dawidek 
@@ -31,6 +31,11 @@
 #ifndef _OPENSOLARIS_SYS_CRED_H_
 #define	_OPENSOLARIS_SYS_CRED_H_
 
+#ifdef _KERNEL
+/* Needed for access to cr_groups.  */
+#define	__KAUTH_PRIVATE
+#endif
+
 #include 
 #include 
 
@@ -57,22 +62,11 @@ extern kauth_cred_t	cred0;
 	kauth_cred_setegid(cr, g), \
 	kauth_cred_setsvuid(cr, u), \
 	kauth_cred_setsvgid(cr, g), 0)
+#define crgetgroups(cr)		((cr)->cr_groups)
 #define	crsetgroups(cr, gc, ga)	\
 kauth_cred_setgroups(cr, ga, gc, 0, UIO_SYSSPACE)
 #define crgetsid(cr, i) (NULL)
 
-static __inline gid_t *
-crgetgroups(cred_t *cr)
-{
-	static gid_t gids[NGROUPS_MAX];
-
-	memset(gids, 0, sizeof(gids));
-	if (kauth_cred_getgroups(cr, gids, NGROUPS_MAX, UIO_SYSSPACE) != 0) 
-		return NULL;
-	
-	return gids;
-}
-
 static __inline int
 groupmember(gid_t gid, cred_t *cr) 
 {

Index: src/sys/sys/kauth.h
diff -u src/sys/sys/kauth.h:1.82 src/sys/sys/kauth.h:1.82.4.1
--- src/sys/sys/kauth.h:1.82	Wed Apr 10 18:49:04 2019
+++ src/sys/sys/kauth.h	Wed Apr 29 13:47:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: kauth.h,v 1.82 2019/04/10 18:49:04 maxv Exp $ */
+/* $NetBSD: kauth.h,v 1.82.4.1 2020/04/29 13:47:51 martin Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Elad Efrat   
@@ -55,7 +55,11 @@ typedef int (*kauth_scope_callback_t)(ka
 typedef	struct kauth_key   *kauth_key_t;
 
 #ifdef __KAUTH_PRIVATE	/* For the debugger */
-/* 
+
+#include 
+#include 
+
+/*
  * Credentials.
  *
  * A subset of this structure is used in kvm(3) (src/lib/libkvm/kvm_proc.c)
@@ -84,6 +88,7 @@ struct kauth_cred {
 	gid_t cr_groups[NGROUPS];	/* group memberships */
 	specificdata_reference cr_sd;	/* specific data */
 };
+
 #endif
 
 /*



CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:45:38 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: vdev_disk.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #870):

external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c: revision 1.16

Set up more of a fake struct buf, for ldminphys.

Fixes:
arm64# zpool create rpool ld4
[ 198.4376097] panic: Trap: Data Abort (EL1): Translation Fault L1 with read 
access for 0178: pc c017acf4: opcode f940bc00: ldr x0, 
[x0,#376]
[ 198.4694793] fp c00073026660 ldminphys() at c017acf4 
netbsd:ldminphys+0x34
[ 198.4792624] fp c00073026680 vdev_disk_open.part.4() at c13d4c4c 
zfs:vdev_disk_open.part.4+0x37c
[ 198.4792624] fp c000730268d0 vdev_open() at c13d2530 
zfs:vdev_open+0x68
[ 198.4792624] fp c00073026920 vdev_open_children() at c13d2958 
zfs:vdev_open_children+0x40
[ 198.4792624] fp c00073026950 vdev_root_open() at c13dad48 
zfs:vdev_root_open+0x30

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.11.2.3 -r1.11.2.4 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.4
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c:1.11.2.3	Sat Mar 21 15:18:57 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/vdev_disk.c	Wed Apr 29 13:45:38 2020
@@ -228,7 +228,10 @@ vdev_disk_open(vdev_t *vd, uint64_t *psi
 		dvd->vd_maxphys = (pdk ? disk_maxphys(pdk) : MACHINE_MAXPHYS);
 	*/
 	{
-		struct buf buf = { .b_bcount = MAXPHYS };
+		struct buf buf = {
+			.b_dev = vp->v_rdev,
+			.b_bcount = MAXPHYS,
+		};
 		if (pdk && pdk->dk_driver && pdk->dk_driver->d_minphys)
 			(*pdk->dk_driver->d_minphys)();
 		dvd->vd_maxphys = buf.b_bcount;



CVS commit: [netbsd-9] src/sys/dev/hdaudio

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:43:42 UTC 2020

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdaudiodevs.h hdaudiodevs_data.h

Log Message:
Regen for ticket #869


To generate a diff of this commit:
cvs rdiff -u -r1.2.26.1 -r1.2.26.2 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.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/hdaudio/hdaudiodevs.h
diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.1 src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.2
--- src/sys/dev/hdaudio/hdaudiodevs.h:1.2.26.1	Mon Jan 27 07:10:17 2020
+++ src/sys/dev/hdaudio/hdaudiodevs.h	Wed Apr 29 13:43:42 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs.h,v 1.2.26.1 2020/01/27 07:10:17 martin Exp $	*/
+/*	$NetBSD: hdaudiodevs.h,v 1.2.26.2 2020/04/29 13:43:42 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.2.26.1 2020/01/27 07:09:31 martin Exp
+ *	NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp
  */
 
 /*
@@ -84,6 +84,7 @@
 #define	HDAUDIO_PRODUCT_REALTEK_ALC272	0x0272		/* ALC272 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC275	0x0275		/* ALC275 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC280	0x0280		/* ALC280 */
+#define	HDAUDIO_PRODUCT_REALTEK_ALC293	0x0293		/* ALC293 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC660_VD	0x0660		/* ALC660-VD */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC662	0x0662		/* ALC662 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC663	0x0663		/* ALC663 */
Index: src/sys/dev/hdaudio/hdaudiodevs_data.h
diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.1 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.2
--- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.2.26.1	Mon Jan 27 07:10:17 2020
+++ src/sys/dev/hdaudio/hdaudiodevs_data.h	Wed Apr 29 13:43:42 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs_data.h,v 1.2.26.1 2020/01/27 07:10:17 martin Exp $	*/
+/*	$NetBSD: hdaudiodevs_data.h,v 1.2.26.2 2020/04/29 13:43:42 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.2.26.1 2020/01/27 07:09:31 martin Exp
+ *	NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp
  */
 
 /*
@@ -102,320 +102,322 @@ static const uint16_t hdaudio_products[]
 	230, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC280, 
 	237, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC293, 
 	244, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	251, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC662, 
-	254, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	261, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	268, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
 	275, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
 	282, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	289, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC880, 
-	292, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	299, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	306, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
 	313, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
 	320, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
 	327, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
 	334, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
 	341, 0,
-	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
 	348, 0,
+	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	355, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709, 
-	348, 0,
+	355, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170A, 
-	348, 0,
+	355, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170B, 
-	348, 0,
+	355, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709_10CH_0, 
-	355, 362, 0,
+	362, 369, 0,
 	HDAUDIO_VENDOR_VIATECH, 

CVS commit: [netbsd-9] src/sys/dev/hdaudio

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:42:21 UTC 2020

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdaudiodevs

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #869):

sys/dev/hdaudio/hdaudiodevs: revision 1.4

Add Realtek ALC293


To generate a diff of this commit:
cvs rdiff -u -r1.2.26.1 -r1.2.26.2 src/sys/dev/hdaudio/hdaudiodevs

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/hdaudio/hdaudiodevs
diff -u src/sys/dev/hdaudio/hdaudiodevs:1.2.26.1 src/sys/dev/hdaudio/hdaudiodevs:1.2.26.2
--- src/sys/dev/hdaudio/hdaudiodevs:1.2.26.1	Mon Jan 27 07:09:31 2020
+++ src/sys/dev/hdaudio/hdaudiodevs	Wed Apr 29 13:42:21 2020
@@ -1,4 +1,4 @@
-$NetBSD: hdaudiodevs,v 1.2.26.1 2020/01/27 07:09:31 martin Exp $
+$NetBSD: hdaudiodevs,v 1.2.26.2 2020/04/29 13:42:21 martin Exp $
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -77,6 +77,7 @@ product	REALTEK		ALC270		0x0270	ALC270
 product	REALTEK		ALC272		0x0272	ALC272
 product	REALTEK		ALC275		0x0275	ALC275
 product	REALTEK		ALC280		0x0280	ALC280
+product	REALTEK		ALC293		0x0293	ALC293
 product	REALTEK		ALC660_VD	0x0660	ALC660-VD
 product	REALTEK		ALC662		0x0662	ALC662
 product	REALTEK		ALC663		0x0663	ALC663



CVS commit: [netbsd-9] src/sys/arch

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:39:23 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64 [netbsd-9]: machdep.c
src/sys/arch/x86/x86 [netbsd-9]: pmap.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #868):

sys/arch/x86/x86/pmap.c: revision 1.384
sys/arch/amd64/amd64/machdep.c: revision 1.349

Detect PAT on the boot processor before cpu0 attaches so the early genfb
attach code can map the framebuffer with write combining.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.335.2.1 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.334 -r1.334.2.1 src/sys/arch/x86/x86/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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.335 src/sys/arch/amd64/amd64/machdep.c:1.335.2.1
--- src/sys/arch/amd64/amd64/machdep.c:1.335	Wed Jul 24 16:36:47 2019
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Apr 29 13:39:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.335 2019/07/24 16:36:47 bouyer Exp $	*/
+/*	$NetBSD: machdep.c,v 1.335.2.1 2020/04/29 13:39:23 martin Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.335 2019/07/24 16:36:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.335.2.1 2020/04/29 13:39:23 martin Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -1714,6 +1714,8 @@ init_x86_64(paddr_t first_avail)
 	x86_bus_space_init();
 #endif
 
+	pat_init(_info_primary);
+
 	consinit();	/* XXX SHOULD NOT BE DONE HERE */
 
 	/*

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.334 src/sys/arch/x86/x86/pmap.c:1.334.2.1
--- src/sys/arch/x86/x86/pmap.c:1.334	Sat Jun  1 08:12:26 2019
+++ src/sys/arch/x86/x86/pmap.c	Wed Apr 29 13:39:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.334 2019/06/01 08:12:26 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.334.2.1 2020/04/29 13:39:23 martin Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334 2019/06/01 08:12:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.334.2.1 2020/04/29 13:39:23 martin Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -818,7 +818,6 @@ pat_init(struct cpu_info *ci)
 
 	wrmsr(MSR_CR_PAT, pat);
 	cpu_pat_enabled = true;
-	aprint_debug_dev(ci->ci_dev, "PAT enabled\n");
 }
 
 static pt_entry_t



CVS commit: [netbsd-9] src/sys/dev/acpi

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:36:57 UTC 2020

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_display.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #867):

sys/dev/acpi/acpi_display.c: revision 1.17

Demote "unknown output device" message from error to debug, and change
the wording to reflect what is really happening -- the display output is
not connected.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.16.1 src/sys/dev/acpi/acpi_display.c

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

Modified files:

Index: src/sys/dev/acpi/acpi_display.c
diff -u src/sys/dev/acpi/acpi_display.c:1.16 src/sys/dev/acpi/acpi_display.c:1.16.16.1
--- src/sys/dev/acpi/acpi_display.c:1.16	Thu Jun  1 02:45:09 2017
+++ src/sys/dev/acpi/acpi_display.c	Wed Apr 29 13:36:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_display.c,v 1.16 2017/06/01 02:45:09 chs Exp $	*/
+/*	$NetBSD: acpi_display.c,v 1.16.16.1 2020/04/29 13:36:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.16 2017/06/01 02:45:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_display.c,v 1.16.16.1 2020/04/29 13:36:57 martin Exp $");
 
 #include 
 #include 
@@ -1549,8 +1549,8 @@ acpidisp_vga_bind_outdevs(struct acpidis
 			}
 		}
 		if (i == oi->oi_dev_count)
-			aprint_error_dev(asc->sc_dev,
-			"unknown output device %s\n",
+			aprint_debug_dev(asc->sc_dev,
+			"output device %s not connected\n",
 			device_xname(osc->sc_dev));
 	}
 }



CVS commit: [netbsd-9] src/sys/dev/acpi

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:33:36 UTC 2020

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_ec.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #866):

sys/dev/acpi/acpi_ec.c: revision 1.82

kern/55206: acpibat reporting broken by acpi_ec.c r1.81

Assume byte instead of qword alignment of the buffer passed to the EC
space handler.


To generate a diff of this commit:
cvs rdiff -u -r1.75.20.2 -r1.75.20.3 src/sys/dev/acpi/acpi_ec.c

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

Modified files:

Index: src/sys/dev/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.75.20.2 src/sys/dev/acpi/acpi_ec.c:1.75.20.3
--- src/sys/dev/acpi/acpi_ec.c:1.75.20.2	Sun Apr 12 08:48:56 2020
+++ src/sys/dev/acpi/acpi_ec.c	Wed Apr 29 13:33:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.75.20.2 2020/04/12 08:48:56 martin Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.75.20.3 2020/04/29 13:33:35 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.75.20.2 2020/04/12 08:48:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.75.20.3 2020/04/29 13:33:35 martin Exp $");
 
 #include 
 #include 
@@ -659,32 +659,30 @@ acpiec_space_handler(uint32_t func, ACPI
 {
 	device_t dv;
 	ACPI_STATUS rv;
-	uint8_t addr, reg;
+	uint8_t addr, *buf;
 	unsigned int i;
 
-	if (paddr > 0xff || width % 8 != 0 || width > sizeof(ACPI_INTEGER)*8 ||
+	if (paddr > 0xff || width % 8 != 0 ||
 	value == NULL || arg == NULL || paddr + width / 8 > 0x100)
 		return AE_BAD_PARAMETER;
 
 	addr = paddr;
 	dv = arg;
+	buf = (uint8_t *)value;
 
 	rv = AE_OK;
 
 	switch (func) {
 	case ACPI_READ:
-		*value = 0;
-		for (i = 0; i < width; i += 8, ++addr) {
-			rv = acpiec_read(dv, addr, );
+		for (i = 0; i < width; i += 8, ++addr, ++buf) {
+			rv = acpiec_read(dv, addr, buf);
 			if (rv != AE_OK)
 break;
-			*value |= (ACPI_INTEGER)reg << i;
 		}
 		break;
 	case ACPI_WRITE:
-		for (i = 0; i < width; i += 8, ++addr) {
-			reg = (*value >> i) & 0xff;
-			rv = acpiec_write(dv, addr, reg);
+		for (i = 0; i < width; i += 8, ++addr, ++buf) {
+			rv = acpiec_write(dv, addr, *buf);
 			if (rv != AE_OK)
 break;
 		}



CVS commit: [netbsd-9] src/sys/dev/pckbport

2020-04-29 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Apr 29 13:25:42 UTC 2020

Modified Files:
src/sys/dev/pckbport [netbsd-9]: synaptics.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #865):

sys/dev/pckbport/synaptics.c: revision 1.66

pms_synaptics_enable: no need to send PMS_DEV_ENABLE here because
pms_enable does this for us. Seems to resolve issues with my trackpoint
not working immediately after starting X on ThinkPad X260.


To generate a diff of this commit:
cvs rdiff -u -r1.50.2.4 -r1.50.2.5 src/sys/dev/pckbport/synaptics.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.50.2.4 src/sys/dev/pckbport/synaptics.c:1.50.2.5
--- src/sys/dev/pckbport/synaptics.c:1.50.2.4	Tue Apr 28 16:22:15 2020
+++ src/sys/dev/pckbport/synaptics.c	Wed Apr 29 13:25:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.50.2.4 2020/04/28 16:22:15 martin Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.50.2.5 2020/04/29 13:25:42 martin Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.4 2020/04/28 16:22:15 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.50.2.5 2020/04/29 13:25:42 martin Exp $");
 
 #include 
 #include 
@@ -484,8 +484,6 @@ pms_synaptics_enable(void *vsc)
 	(sc->flags & SYN_FLAG_HAS_ADV_GESTURE_MODE))
 		synaptics_special_write(psc, SYNAPTICS_WRITE_DELUXE_3, 0x3); 
 
-	synaptics_poll_cmd(psc, PMS_DEV_ENABLE, 0);
-
 	sc->up_down = 0;
 	sc->prev_fingers = 0;
 	sc->gesture_start_x = sc->gesture_start_y = 0;



CVS commit: src/doc

2020-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 29 11:08:40 UTC 2020

Modified Files:
src/doc: HACKS

Log Message:
PR toolchain/54820
PR toolchain/54877

earmv7hf{,eb}: compile gdb/dwarf2expr.c with -O0 for GCC8

http://cvsweb.netbsd.org/bsdweb.cgi/src/external/gpl3/gdb/lib/libgdb/Makefile#rev1.22


To generate a diff of this commit:
cvs rdiff -u -r1.201 -r1.202 src/doc/HACKS

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

Modified files:

Index: src/doc/HACKS
diff -u src/doc/HACKS:1.201 src/doc/HACKS:1.202
--- src/doc/HACKS:1.201	Sun Apr 12 17:49:00 2020
+++ src/doc/HACKS	Wed Apr 29 11:08:40 2020
@@ -1,4 +1,4 @@
-# $NetBSD: HACKS,v 1.201 2020/04/12 17:49:00 leot Exp $
+# $NetBSD: HACKS,v 1.202 2020/04/29 11:08:40 rin Exp $
 #
 # This file is intended to document workarounds for currently unsolved
 # (mostly) compiler bugs.
@@ -975,3 +975,14 @@ descr	Disable optimization on tc.c, loge
 	/dist/llvm/include/llvm/CodeGen/MachineFrameInfo.h", line 495, \
 	function "__int64_t llvm::MachineFrameInfo::getObjectOffset(int) const"
 kcah
+
+port	earmv7hf*
+hack	compile gdb/dwarf2expr.c with -O0 for GCC8 (toolchain/54820 and 54877)
+cdate	Wed Apr 29 11:04:58 UTC 2020
+who	rin
+file	src/external/gpl3/gdb/lib/libgdb/Makefile: 1.22
+descr	GCC 8.4 miscompiles dwarf2expr.c with -O2 or -O1, which results in
+	crashes with 'gdb_exception_RETURN_MASK_ERROR'. Note that this occurs
+	only for earmv7hf{,eb} as far as I can see. Neither earmv6hf{,eb} nor
+	earmv7{,eb} (softfloat) are affected.
+kcah



CVS commit: src/external/gpl3/gdb/lib/libgdb

2020-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 29 11:04:58 UTC 2020

Modified Files:
src/external/gpl3/gdb/lib/libgdb: Makefile

Log Message:
PR toolchain/54820
PR toolchain/54877

GCC 8.4 miscompiles dwarf2expr.c with -O2 or -O1 for earmv7hf{,eb}, which
results in crashes described in the PRs. No upstream fixes up to now. So,
let us disable optimization for this file.

Note that this affects only earmv7hf{,eb} as far as I can see. Crashes do
not occur neither for earmv6hf{,eb} nor earmv7{,eb}.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/gpl3/gdb/lib/libgdb/Makefile

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

Modified files:

Index: src/external/gpl3/gdb/lib/libgdb/Makefile
diff -u src/external/gpl3/gdb/lib/libgdb/Makefile:1.21 src/external/gpl3/gdb/lib/libgdb/Makefile:1.22
--- src/external/gpl3/gdb/lib/libgdb/Makefile:1.21	Fri Jul 12 22:45:07 2019
+++ src/external/gpl3/gdb/lib/libgdb/Makefile	Wed Apr 29 11:04:58 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2019/07/12 22:45:07 christos Exp $
+#	$NetBSD: Makefile,v 1.22 2020/04/29 11:04:58 rin Exp $
 
 NOCTF=
 HOSTPROG_CXX=   1
@@ -58,6 +58,14 @@ ada-exp.c: ada-lex.c
 COPTS.dwarf2-frame.c+=-O1
 .endif
 
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 8 && ${ACTIVE_CC} == "gcc"
+.if !empty(MACHINE_ARCH:Mearmv7hf*)
+# GCC 8.4 miscompiles this with -O2 or -O1 for earmv7hf{,eb}.
+# Neither earmv6hf{,eb} nor earmv7{,eb} are affected.
+COPTS.dwarf2expr.c+=-O0
+.endif
+.endif
+
 # These are generated by implicit rules and are not easy to generate
 CLEANDIRFILES+= \
 	ada-exp.c ada-lex.c \



CVS commit: src/sbin/mount_qemufwcfg

2020-04-29 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Wed Apr 29 09:54:43 UTC 2020

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

Log Message:
Remove references to "special", as mount_qemufwcfg(8) does not
actually take such an argument.  Discussed with jmcneill.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/mount_qemufwcfg/mount_qemufwcfg.8

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

Modified files:

Index: src/sbin/mount_qemufwcfg/mount_qemufwcfg.8
diff -u src/sbin/mount_qemufwcfg/mount_qemufwcfg.8:1.2 src/sbin/mount_qemufwcfg/mount_qemufwcfg.8:1.3
--- src/sbin/mount_qemufwcfg/mount_qemufwcfg.8:1.2	Tue Nov 28 11:55:30 2017
+++ src/sbin/mount_qemufwcfg/mount_qemufwcfg.8	Wed Apr 29 09:54:43 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount_qemufwcfg.8,v 1.2 2017/11/28 11:55:30 wiz Exp $
+.\"	$NetBSD: mount_qemufwcfg.8,v 1.3 2020/04/29 09:54:43 gson Exp $
 .\"
 .\" Copyright (c) 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 28, 2017
+.Dd April 29, 2020
 .Dt MOUNT_QEMUFWCFG 8
 .Os
 .Sh NAME
@@ -38,18 +38,16 @@
 .Op Fl m Ar file-mode
 .Op Fl u Ar uid
 .Op Ar fuse-options
-.Ar special node
+.Ar node
 .Sh DESCRIPTION
 The
 .Nm
 command provides the QEMU fw_cfg configuration files in a file system
 tree at point
 .Ar node .
-Both
-.Ar special
-and
+The directory specified by
 .Ar node
-are converted to absolute paths before use.
+is converted to an absolute path before use.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds



CVS commit: src/sys/dev/usb

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 08:06:03 UTC 2020

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
usbdevs: regen


To generate a diff of this commit:
cvs rdiff -u -r1.771 -r1.772 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.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/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.771 src/sys/dev/usb/usbdevs.h:1.772
--- src/sys/dev/usb/usbdevs.h:1.771	Sun Apr 12 01:11:56 2020
+++ src/sys/dev/usb/usbdevs.h	Wed Apr 29 08:06:03 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.771 2020/04/12 01:11:56 simonb Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.772 2020/04/29 08:06:03 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.781 2020/04/12 01:10:54 simonb Exp
+ *	NetBSD: usbdevs,v 1.782 2020/04/29 08:05:10 nia Exp
  */
 
 /*-
@@ -1936,6 +1936,12 @@
 
 #define	USB_PRODUCT_INTEL2_RMH	0x0020		/* Rate Matching Hub */
 #define	USB_PRODUCT_INTEL2_RMH2	0x0024		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH3	0x8000		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH4	0x8001		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH5	0x8002		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH6	0x8008		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH7	0x8009		/* Rate Matching Hub */
+#define	USB_PRODUCT_INTEL2_RMH8	0x800a		/* Rate Matching Hub */
 #define	USB_PRODUCT_INTEL2_N_6235_BT	0x07da		/* Advanced-N 6235 Combo Bluetooth */
 
 /* Intersil products */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.771 src/sys/dev/usb/usbdevs_data.h:1.772
--- src/sys/dev/usb/usbdevs_data.h:1.771	Sun Apr 12 01:11:56 2020
+++ src/sys/dev/usb/usbdevs_data.h	Wed Apr 29 08:06:03 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.771 2020/04/12 01:11:56 simonb Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.772 2020/04/29 08:06:03 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.781 2020/04/12 01:10:54 simonb Exp
+ *	NetBSD: usbdevs,v 1.782 2020/04/29 08:05:10 nia Exp
  */
 
 /*-
@@ -2509,6 +2509,18 @@ static const uint16_t usb_products[] = {
 	12049, 12054, 5850, 0,
 	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH2, 
 	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH3, 
+	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH4, 
+	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH5, 
+	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH6, 
+	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH7, 
+	12049, 12054, 5850, 0,
+	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_RMH8, 
+	12049, 12054, 5850, 0,
 	USB_VENDOR_INTEL2, USB_PRODUCT_INTEL2_N_6235_BT, 
 	12063, 12074, 12079, 4905, 0,
 	USB_VENDOR_INTERSIL, USB_PRODUCT_INTERSIL_PRISM_GT, 
@@ -5782,7 +5794,7 @@ static const char usb_words[] = { "." 
 	"120g\0" /* 1 refs @ 5836 */
 	"121g\0" /* 1 refs @ 5841 */
 	"Kbd\0" /* 3 refs @ 5846 */
-	"Hub\0" /* 30 refs @ 5850 */
+	"Hub\0" /* 36 refs @ 5850 */
 	"MacAlly\0" /* 1 refs @ 5854 */
 	"AU9814\0" /* 1 refs @ 5862 */
 	"MicroConnectors/StrongMan\0" /* 1 refs @ 5869 */
@@ -6602,8 +6614,8 @@ static const char usb_words[] = { "." 
 	"2011B\0" /* 1 refs @ 12032 */
 	"82930\0" /* 1 refs @ 12038 */
 	"test\0" /* 2 refs @ 12044 */
-	"Rate\0" /* 2 refs @ 12049 */
-	"Matching\0" /* 2 refs @ 12054 */
+	"Rate\0" /* 8 refs @ 12049 */
+	"Matching\0" /* 8 refs @ 12054 */
 	"Advanced-N\0" /* 1 refs @ 12063 */
 	"6235\0" /* 1 refs @ 12074 */
 	"Combo\0" /* 2 refs @ 12079 */



CVS commit: src/sys/dev/usb

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 08:05:10 UTC 2020

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
usbdevs: more Intel Integrated Rate Matching Hub IDs


To generate a diff of this commit:
cvs rdiff -u -r1.781 -r1.782 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.781 src/sys/dev/usb/usbdevs:1.782
--- src/sys/dev/usb/usbdevs:1.781	Sun Apr 12 01:10:54 2020
+++ src/sys/dev/usb/usbdevs	Wed Apr 29 08:05:10 2020
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.781 2020/04/12 01:10:54 simonb Exp $
+$NetBSD: usbdevs,v 1.782 2020/04/29 08:05:10 nia Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1929,6 +1929,12 @@ product INTEL TESTBOARD		0x9890	82930 te
 
 product INTEL2 RMH		0x0020	Rate Matching Hub
 product INTEL2 RMH2		0x0024	Rate Matching Hub
+product INTEL2 RMH3		0x8000	Rate Matching Hub
+product INTEL2 RMH4		0x8001	Rate Matching Hub
+product INTEL2 RMH5		0x8002	Rate Matching Hub
+product INTEL2 RMH6		0x8008	Rate Matching Hub
+product INTEL2 RMH7		0x8009	Rate Matching Hub
+product INTEL2 RMH8		0x800a	Rate Matching Hub
 product INTEL2 N_6235_BT	0x07da	Advanced-N 6235 Combo Bluetooth
 
 /* Intersil products */



CVS commit: src/sys/dev/hdaudio

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 07:36:22 UTC 2020

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs.h hdaudiodevs_data.h

Log Message:
hdaudiodevs: regen


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hdaudio/hdaudiodevs.h \
src/sys/dev/hdaudio/hdaudiodevs_data.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/hdaudio/hdaudiodevs.h
diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.4 src/sys/dev/hdaudio/hdaudiodevs.h:1.5
--- src/sys/dev/hdaudio/hdaudiodevs.h:1.4	Tue Apr 28 21:48:20 2020
+++ src/sys/dev/hdaudio/hdaudiodevs.h	Wed Apr 29 07:36:22 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs.h,v 1.4 2020/04/28 21:48:20 jmcneill Exp $	*/
+/*	$NetBSD: hdaudiodevs.h,v 1.5 2020/04/29 07:36:22 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.4 2020/04/28 21:48:11 jmcneill Exp
+ *	NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp
  */
 
 /*
@@ -84,6 +84,7 @@
 #define	HDAUDIO_PRODUCT_REALTEK_ALC272	0x0272		/* ALC272 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC275	0x0275		/* ALC275 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC280	0x0280		/* ALC280 */
+#define	HDAUDIO_PRODUCT_REALTEK_ALC292	0x0292		/* ALC292 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC293	0x0293		/* ALC293 */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC660_VD	0x0660		/* ALC660-VD */
 #define	HDAUDIO_PRODUCT_REALTEK_ALC662	0x0662		/* ALC662 */
Index: src/sys/dev/hdaudio/hdaudiodevs_data.h
diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.4 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.5
--- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.4	Tue Apr 28 21:48:20 2020
+++ src/sys/dev/hdaudio/hdaudiodevs_data.h	Wed Apr 29 07:36:22 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: hdaudiodevs_data.h,v 1.4 2020/04/28 21:48:20 jmcneill Exp $	*/
+/*	$NetBSD: hdaudiodevs_data.h,v 1.5 2020/04/29 07:36:22 nia Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: hdaudiodevs,v 1.4 2020/04/28 21:48:11 jmcneill Exp
+ *	NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp
  */
 
 /*
@@ -102,322 +102,324 @@ static const uint16_t hdaudio_products[]
 	230, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC280, 
 	237, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC293, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC292, 
 	244, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC293, 
 	251, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC660_VD, 
+	258, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC662, 
-	261, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	268, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC663, 
 	275, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC670, 
 	282, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861, 
 	289, 0,
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC861_VD, 
+	296, 0,
 	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC880, 
-	299, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	306, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC882, 
 	313, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC883, 
 	320, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC885, 
 	327, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC887, 
 	334, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC888, 
 	341, 0,
-	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC889, 
 	348, 0,
-	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	HDAUDIO_VENDOR_REALTEK, HDAUDIO_PRODUCT_REALTEK_ALC892, 
 	355, 0,
+	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1708, 
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709, 
-	355, 0,
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170A, 
-	355, 0,
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT170B, 
-	355, 0,
+	362, 0,
 	HDAUDIO_VENDOR_VIATECH, HDAUDIO_PRODUCT_VIATECH_VT1709_10CH_0, 
-	362, 369, 0,
+	369, 376, 0,
 	

CVS commit: src/sys/dev/hdaudio

2020-04-29 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Wed Apr 29 07:24:53 UTC 2020

Modified Files:
src/sys/dev/hdaudio: hdaudiodevs

Log Message:
hdaudiodevs: Add Realtek ALC292


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hdaudio/hdaudiodevs

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/hdaudio/hdaudiodevs
diff -u src/sys/dev/hdaudio/hdaudiodevs:1.4 src/sys/dev/hdaudio/hdaudiodevs:1.5
--- src/sys/dev/hdaudio/hdaudiodevs:1.4	Tue Apr 28 21:48:11 2020
+++ src/sys/dev/hdaudio/hdaudiodevs	Wed Apr 29 07:24:53 2020
@@ -1,4 +1,4 @@
-$NetBSD: hdaudiodevs,v 1.4 2020/04/28 21:48:11 jmcneill Exp $
+$NetBSD: hdaudiodevs,v 1.5 2020/04/29 07:24:53 nia Exp $
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -77,6 +77,7 @@ product	REALTEK		ALC270		0x0270	ALC270
 product	REALTEK		ALC272		0x0272	ALC272
 product	REALTEK		ALC275		0x0275	ALC275
 product	REALTEK		ALC280		0x0280	ALC280
+product	REALTEK		ALC292		0x0292	ALC292
 product	REALTEK		ALC293		0x0293	ALC293
 product	REALTEK		ALC660_VD	0x0660	ALC660-VD
 product	REALTEK		ALC662		0x0662	ALC662



CVS commit: src/sys/miscfs/procfs

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Apr 29 07:18:24 UTC 2020

Modified Files:
src/sys/miscfs/procfs: procfs.h

Log Message:
Put forward declaration a little further forward to unbreak build.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/miscfs/procfs/procfs.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/miscfs/procfs/procfs.h
diff -u src/sys/miscfs/procfs/procfs.h:1.79 src/sys/miscfs/procfs/procfs.h:1.80
--- src/sys/miscfs/procfs/procfs.h:1.79	Wed Apr 29 01:56:54 2020
+++ src/sys/miscfs/procfs/procfs.h	Wed Apr 29 07:18:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs.h,v 1.79 2020/04/29 01:56:54 thorpej Exp $	*/
+/*	$NetBSD: procfs.h,v 1.80 2020/04/29 07:18:24 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -209,11 +209,12 @@ struct vfs_namemap {
 int vfs_getuserstr(struct uio *, char *, int *);
 const vfs_namemap_t *vfs_findname(const vfs_namemap_t *, const char *, int);
 
+struct mount;
+
 struct proc *procfs_proc_find(struct mount *, pid_t);
 bool procfs_use_linux_compat(struct mount *);
 int procfs_proc_lock(struct mount *, int, struct proc **, int);
 void procfs_proc_unlock(struct proc *);
-struct mount;
 int procfs_allocvp(struct mount *, struct vnode **, pid_t, pfstype, int);
 int procfs_donote(struct lwp *, struct proc *, struct pfsnode *,
 struct uio *);



CVS commit: src/distrib/arc/ramdisk

2020-04-29 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Apr 29 06:53:46 UTC 2020

Modified Files:
src/distrib/arc/ramdisk: Makefile

Log Message:
bump ramdisk size to 3200k for gcc 8.  yay!


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/distrib/arc/ramdisk/Makefile

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

Modified files:

Index: src/distrib/arc/ramdisk/Makefile
diff -u src/distrib/arc/ramdisk/Makefile:1.27 src/distrib/arc/ramdisk/Makefile:1.28
--- src/distrib/arc/ramdisk/Makefile:1.27	Sun Dec 29 18:26:16 2019
+++ src/distrib/arc/ramdisk/Makefile	Wed Apr 29 06:53:46 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.27 2019/12/29 18:26:16 christos Exp $
+#	$NetBSD: Makefile,v 1.28 2020/04/29 06:53:46 mrg Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	3060k
+IMAGESIZE=	3200k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1