CVS commit: src/sys/dev/onewire

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

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Make owtemp reliable for me:

- Don't do the calculation if there is a CRC error.
- If we get any kind of error during a refresh, retry up to three times.
- Add event counters to report what's going on.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/onewire/owtemp.c

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



CVS commit: src/sys/dev/onewire

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

Modified Files:
src/sys/dev/onewire: owtemp.c

Log Message:
Make owtemp reliable for me:

- Don't do the calculation if there is a CRC error.
- If we get any kind of error during a refresh, retry up to three times.
- Add event counters to report what's going on.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/onewire/owtemp.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/onewire/owtemp.c
diff -u src/sys/dev/onewire/owtemp.c:1.18 src/sys/dev/onewire/owtemp.c:1.19
--- src/sys/dev/onewire/owtemp.c:1.18	Fri Oct 25 16:25:14 2019
+++ src/sys/dev/onewire/owtemp.c	Sat Nov 30 23:06:52 2019
@@ -1,6 +1,35 @@
-/*	$NetBSD: owtemp.c,v 1.18 2019/10/25 16:25:14 martin Exp $	*/
+/*	$NetBSD: owtemp.c,v 1.19 2019/11/30 23:06:52 ad Exp $	*/
 /*	$OpenBSD: owtemp.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 /*
  * Copyright (c) 2006 Alexander Yurchenko 
  *
@@ -22,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.18 2019/10/25 16:25:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: owtemp.c,v 1.19 2019/11/30 23:06:52 ad Exp $");
 
 #include 
 #include 
@@ -51,14 +80,20 @@ struct owtemp_softc {
 	uint32_t			(*sc_owtemp_decode)(const uint8_t *);
 
 	intsc_dying;
+
+	struct evcnt			sc_ev_update;
+	struct evcnt			sc_ev_rsterr;
+	struct evcnt			sc_ev_crcerr;
 };
 
 static int	owtemp_match(device_t, cfdata_t, void *);
 static void	owtemp_attach(device_t, device_t, void *);
 static int	owtemp_detach(device_t, int);
 static int	owtemp_activate(device_t, enum devact);
-
-static void	owtemp_update(void *);
+static bool	owtemp_update(struct owtemp_softc *sc, uint32_t *temp);
+static void	owtemp_refresh(struct sysmon_envsys *, envsys_data_t *);
+static uint32_t	owtemp_decode_ds18b20(const uint8_t *);
+static uint32_t	owtemp_decode_ds1920(const uint8_t *);
 
 CFATTACH_DECL_NEW(owtemp, sizeof(struct owtemp_softc),
 	owtemp_match, owtemp_attach, owtemp_detach, owtemp_activate);
@@ -71,10 +106,7 @@ static const struct onewire_matchfam owt
 	{ ONEWIRE_FAMILY_DS1822 },
 };
 
-static void	owtemp_refresh(struct sysmon_envsys *, envsys_data_t *);
-
-static uint32_t	owtemp_decode_ds18b20(const uint8_t *);
-static uint32_t	owtemp_decode_ds1920(const uint8_t *);
+int	owtemp_retries = 3;
 
 static int
 owtemp_match(device_t parent, cfdata_t match, void *aux)
@@ -110,6 +142,13 @@ owtemp_attach(device_t parent, device_t 
 		break;
 	}
 
+	evcnt_attach_dynamic(>sc_ev_update, EVCNT_TYPE_MISC, NULL,
+	   device_xname(self), "update");
+	evcnt_attach_dynamic(>sc_ev_rsterr, EVCNT_TYPE_MISC, NULL,
+	   device_xname(self), "reset error");
+	evcnt_attach_dynamic(>sc_ev_crcerr, EVCNT_TYPE_MISC, NULL,
+	   device_xname(self), "crc error");
+
 	sc->sc_sme = sysmon_envsys_create();
 
 	/* Initialize sensor */
@@ -144,6 +183,9 @@ owtemp_detach(device_t self, int flags)
 	struct owtemp_softc *sc = device_private(self);
 
 	sysmon_envsys_unregister(sc->sc_sme);
+	evcnt_detach(>sc_ev_rsterr);
+	evcnt_detach(>sc_ev_update);
+	evcnt_detach(>sc_ev_crcerr);
 
 	return 0;
 }
@@ -162,18 +204,12 @@ owtemp_activate(device_t self, enum deva
 	}
 }
 
-static void
-owtemp_update(void *arg)
+static bool
+owtemp_update(struct owtemp_softc *sc, uint32_t *temp)
 {
-	struct owtemp_softc *sc = arg;
 	u_int8_t data[9];
 
-	onewire_lock(sc->sc_onewire);
-	

CVS commit: src/sys/dev

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 23:04:12 UTC 2019

Modified Files:
src/sys/dev/gpio: gpioow.c
src/sys/dev/onewire: onewire.c onewire_bitbang.c onewirevar.h

Log Message:
onewire:

- Re-do the signalling to be a little more forgiving and efficient.
- If bus reset fails during probe, try a second time.
- Spread out kernel threads for many busses to avoid thundering herd effect.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/gpio/gpioow.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/onewire/onewire.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/onewire/onewire_bitbang.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/onewire/onewirevar.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/gpio/gpioow.c
diff -u src/sys/dev/gpio/gpioow.c:1.15 src/sys/dev/gpio/gpioow.c:1.16
--- src/sys/dev/gpio/gpioow.c:1.15	Sat Oct 28 04:53:56 2017
+++ src/sys/dev/gpio/gpioow.c	Sat Nov 30 23:04:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gpioow.c,v 1.15 2017/10/28 04:53:56 riastradh Exp $ */
+/* $NetBSD: gpioow.c,v 1.16 2019/11/30 23:04:12 ad Exp $ */
 /*	$OpenBSD: gpioow.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.15 2017/10/28 04:53:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gpioow.c,v 1.16 2019/11/30 23:04:12 ad Exp $");
 
 /*
  * 1-Wire bus bit-banging through GPIO pin.
@@ -57,7 +57,8 @@ int	gpioow_detach(device_t, int);
 int	gpioow_activate(device_t, enum devact);
 
 int	gpioow_ow_reset(void *);
-int	gpioow_ow_bit(void *, int);
+int	gpioow_ow_read_bit(void *);
+void	gpioow_ow_write_bit(void *, int);
 
 void	gpioow_bb_rx(void *);
 void	gpioow_bb_tx(void *);
@@ -143,7 +144,8 @@ gpioow_attach(device_t parent, device_t 
 	/* Attach 1-Wire bus */
 	sc->sc_ow_bus.bus_cookie = sc;
 	sc->sc_ow_bus.bus_reset = gpioow_ow_reset;
-	sc->sc_ow_bus.bus_bit = gpioow_ow_bit;
+	sc->sc_ow_bus.bus_read_bit = gpioow_ow_read_bit;
+	sc->sc_ow_bus.bus_write_bit = gpioow_ow_write_bit;
 
 	memset(, 0, sizeof(oba));
 	oba.oba_bus = >sc_ow_bus;
@@ -193,9 +195,15 @@ gpioow_ow_reset(void *arg)
 }
 
 int
-gpioow_ow_bit(void *arg, int value)
+gpioow_ow_read_bit(void *arg)
 {
-	return (onewire_bb_bit(_bbops, arg, value));
+	return (onewire_bb_read_bit(_bbops, arg));
+}
+
+void
+gpioow_ow_write_bit(void *arg, int value)
+{
+	onewire_bb_write_bit(_bbops, arg, value);
 }
 
 void

Index: src/sys/dev/onewire/onewire.c
diff -u src/sys/dev/onewire/onewire.c:1.17 src/sys/dev/onewire/onewire.c:1.18
--- src/sys/dev/onewire/onewire.c:1.17	Fri Oct 25 16:25:14 2019
+++ src/sys/dev/onewire/onewire.c	Sat Nov 30 23:04:12 2019
@@ -1,6 +1,35 @@
-/*	$NetBSD: onewire.c,v 1.17 2019/10/25 16:25:14 martin Exp $	*/
+/*	$NetBSD: onewire.c,v 1.18 2019/11/30 23:04:12 ad Exp $	*/
 /*	$OpenBSD: onewire.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
+/*-
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 /*
  * Copyright (c) 2006 Alexander Yurchenko 
  *
@@ -18,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.17 2019/10/25 16:25:14 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.18 2019/11/30 23:04:12 ad Exp $");
 
 /*
  * 1-Wire bus driver.
@@ -202,14 +231,25 @@ onewire_reset(void *arg)
 }
 
 int
-onewire_bit(void *arg, int value)
+onewire_read_bit(void *arg)
 {
 	struct onewire_softc *sc = arg;
 	struct onewire_bus *bus = sc->sc_bus;
 
 	KASSERT(mutex_owned(>sc_lock));
 
-	return 

CVS commit: src/sys/dev

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 23:04:12 UTC 2019

Modified Files:
src/sys/dev/gpio: gpioow.c
src/sys/dev/onewire: onewire.c onewire_bitbang.c onewirevar.h

Log Message:
onewire:

- Re-do the signalling to be a little more forgiving and efficient.
- If bus reset fails during probe, try a second time.
- Spread out kernel threads for many busses to avoid thundering herd effect.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/gpio/gpioow.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/onewire/onewire.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/onewire/onewire_bitbang.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/onewire/onewirevar.h

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



CVS commit: src/external/gpl3/binutils/dist/bfd

2019-11-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 30 22:50:11 UTC 2019

Modified Files:
src/external/gpl3/binutils/dist/bfd: elf.c

Log Message:
Fix 'nm /dev/ksyms' (noticed by ryo).

Since binutils 2.15, nm(1) cannot be used for character devices.
We worked around this by a local patch:

http://cvsweb.netbsd.org/bsdweb.cgi/src/gnu/dist/binutils/binutils/Attic/bucomm.c?r1=1.1.1.2=0#rev1.2

With recent update of binutils, 'nm /dev/ksyms' got broken again.
This is due to a consistency check involving file size reported by
stat(2), which is always zero for character devices. So, skip this
check if file size is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/binutils/dist/bfd/elf.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/gpl3/binutils/dist/bfd/elf.c
diff -u src/external/gpl3/binutils/dist/bfd/elf.c:1.13 src/external/gpl3/binutils/dist/bfd/elf.c:1.14
--- src/external/gpl3/binutils/dist/bfd/elf.c:1.13	Wed Nov  7 01:13:52 2018
+++ src/external/gpl3/binutils/dist/bfd/elf.c	Sat Nov 30 22:50:11 2019
@@ -298,7 +298,8 @@ bfd_elf_get_str_section (bfd *abfd, unsi
   /* Allocate and clear an extra byte at the end, to prevent crashes
 	 in case the string table is not terminated.  */
   if (shstrtabsize + 1 <= 1
-	  || shstrtabsize > bfd_get_file_size (abfd)
+	  || (bfd_get_file_size (abfd) > 0 /* not a character device */
+		&& shstrtabsize > bfd_get_file_size (abfd))
 	  || bfd_seek (abfd, offset, SEEK_SET) != 0
 	  || (shstrtab = (bfd_byte *) bfd_alloc (abfd, shstrtabsize + 1)) == NULL)
 	shstrtab = NULL;



CVS commit: src/external/gpl3/binutils/dist/bfd

2019-11-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Nov 30 22:50:11 UTC 2019

Modified Files:
src/external/gpl3/binutils/dist/bfd: elf.c

Log Message:
Fix 'nm /dev/ksyms' (noticed by ryo).

Since binutils 2.15, nm(1) cannot be used for character devices.
We worked around this by a local patch:

http://cvsweb.netbsd.org/bsdweb.cgi/src/gnu/dist/binutils/binutils/Attic/bucomm.c?r1=1.1.1.2=0#rev1.2

With recent update of binutils, 'nm /dev/ksyms' got broken again.
This is due to a consistency check involving file size reported by
stat(2), which is always zero for character devices. So, skip this
check if file size is zero.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/binutils/dist/bfd/elf.c

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



Re: CVS commit: src/sys/kern

2019-11-30 Thread Rin Okuyama

On 2019/11/30 23:35, Andrew Doran wrote:

Hmm, it works fine on amd64 and looks OK but me, but I have backed it out
for the time being.


Thanks! Also thank you for working on this area!

rin


CVS commit: src/sys/kern

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

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

Log Message:
VOP_UNLOCK + vrele -> vput


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/tty_ptm.c

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



CVS commit: src/sys/kern

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

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

Log Message:
VOP_UNLOCK + vrele -> vput


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/kern/tty_ptm.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/tty_ptm.c
diff -u src/sys/kern/tty_ptm.c:1.40 src/sys/kern/tty_ptm.c:1.41
--- src/sys/kern/tty_ptm.c:1.40	Fri Mar  1 11:06:57 2019
+++ src/sys/kern/tty_ptm.c	Sat Nov 30 20:45:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_ptm.c,v 1.40 2019/03/01 11:06:57 pgoyette Exp $	*/
+/*	$NetBSD: tty_ptm.c,v 1.41 2019/11/30 20:45:49 ad Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.40 2019/03/01 11:06:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_ptm.c,v 1.41 2019/11/30 20:45:49 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -234,8 +234,7 @@ pty_grant_slave(struct lwp *l, dev_t dev
 		error = VOP_SETATTR(vp, , lwp0.l_cred);
 		if (error) {
 			DPRINTF(("setattr %d\n", error));
-			VOP_UNLOCK(vp);
-			vrele(vp);
+			vput(vp);
 			return error;
 		}
 	}



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:49:03 UTC 2019

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

Log Message:
Avoid false sharing: only update spc_curpriority if value has changed.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/sys/userret.h

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

Modified files:

Index: src/sys/sys/userret.h
diff -u src/sys/sys/userret.h:1.30 src/sys/sys/userret.h:1.31
--- src/sys/sys/userret.h:1.30	Fri Nov 22 23:38:15 2019
+++ src/sys/sys/userret.h	Sat Nov 30 17:49:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.30 2019/11/22 23:38:15 ad Exp $	*/
+/*	$NetBSD: userret.h,v 1.31 2019/11/30 17:49:03 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2003, 2006, 2008, 2019 The NetBSD Foundation, Inc.
@@ -100,14 +100,20 @@ mi_userret(struct lwp *l)
 		KPREEMPT_DISABLE(l);
 		ci = l->l_cpu;
 	}
-	l->l_kpriority = false;
 	/*
 	 * lwp_eprio() is too involved to use here unlocked.  At this point
 	 * it only matters for PTHREAD_PRIO_PROTECT; setting a too low value
 	 * is OK because the scheduler will find out the true value if we
 	 * end up in mi_switch().
+	 *
+	 * This is being called on every syscall and trap, and remote CPUs
+	 * regularly look at ci_schedstate.  Keep the cache line in the
+	 * SHARED state by only updating spc_curpriority if it has changed.
 	 */
-	ci->ci_schedstate.spc_curpriority = l->l_priority;
+	l->l_kpriority = false;
+	if (ci->ci_schedstate.spc_curpriority != l->l_priority) {
+		ci->ci_schedstate.spc_curpriority = l->l_priority;
+	}
 	KPREEMPT_ENABLE(l);
 
 	LOCKDEBUG_BARRIER(NULL, 0);



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:49:03 UTC 2019

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

Log Message:
Avoid false sharing: only update spc_curpriority if value has changed.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/sys/userret.h

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



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:46:27 UTC 2019

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

Log Message:
Mark spc_curpriority volatile.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/sys/sched.h

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



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:46:27 UTC 2019

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

Log Message:
Mark spc_curpriority volatile.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/sys/sched.h

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

Modified files:

Index: src/sys/sys/sched.h
diff -u src/sys/sys/sched.h:1.77 src/sys/sys/sched.h:1.78
--- src/sys/sys/sched.h:1.77	Sat Nov 23 19:42:52 2019
+++ src/sys/sys/sched.h	Sat Nov 30 17:46:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched.h,v 1.77 2019/11/23 19:42:52 ad Exp $	*/
+/*	$NetBSD: sched.h,v 1.78 2019/11/30 17:46:27 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2007, 2008, 2019
@@ -154,16 +154,13 @@ __END_DECLS
  * c:	cpu_lock
  */
 struct schedstate_percpu {
-	/* First set of data is likely to be accessed by other CPUs. */
 	kmutex_t	*spc_mutex;	/* (: lock on below, runnable LWPs */
 	kmutex_t	*spc_lwplock;	/* (: general purpose lock for LWPs */
 	struct lwp	*spc_migrating;	/* (: migrating LWP */
-	pri_t		spc_curpriority;/* m: usrpri of curlwp */
+	volatile pri_t	spc_curpriority;/* m: usrpri of curlwp */
 	pri_t		spc_maxpriority;/* m: highest priority queued */
 	psetid_t	spc_psid;	/* c: processor-set ID */
 	time_t		spc_lastmod;	/* c: time of last cpu state change */
-
-	/* For the most part, this set of data is CPU-private. */
 	void		*spc_sched_info;/* (: scheduler-specific structure */
 	volatile int	spc_flags;	/* s: flags; see below */
 	u_int		spc_schedticks;	/* s: ticks for schedclock() */



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:45:54 UTC 2019

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

Log Message:
Mark the context switch counters volatile (because preemption).


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/sys/lwp.h

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

Modified files:

Index: src/sys/sys/lwp.h
diff -u src/sys/sys/lwp.h:1.190 src/sys/sys/lwp.h:1.191
--- src/sys/sys/lwp.h:1.190	Sat Nov 23 19:42:52 2019
+++ src/sys/sys/lwp.h	Sat Nov 30 17:45:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: lwp.h,v 1.190 2019/11/23 19:42:52 ad Exp $	*/
+/*	$NetBSD: lwp.h,v 1.191 2019/11/30 17:45:54 ad Exp $	*/
 
 /*
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019
@@ -112,8 +112,8 @@ struct lwp {
 	pri_t		l_auxprio;	/* l: max(inherit,protect) priority */
 	int		l_protectdepth;	/* l: for PTHREAD_PRIO_PROTECT */
 	SLIST_HEAD(, turnstile) l_pi_lenders; /* l: ts lending us priority */
-	uint64_t	l_ncsw;		/* l: total context switches */
-	uint64_t	l_nivcsw;	/* l: involuntary context switches */
+	volatile uint64_t l_ncsw;	/* l: total context switches */
+	volatile uint64_t l_nivcsw;	/* l: involuntary context switches */
 	u_int		l_cpticks;	/* (: Ticks of CPU time */
 	fixpt_t		l_pctcpu;	/* p: %cpu during l_swtime */
 	fixpt_t		l_estcpu;	/* l: cpu time for SCHED_4BSD */



CVS commit: src/sys/sys

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 17:45:54 UTC 2019

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

Log Message:
Mark the context switch counters volatile (because preemption).


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/sys/lwp.h

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



CVS commit: src/sys/arch/ia64/ia64

2019-11-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Nov 30 16:23:46 UTC 2019

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

Log Message:
Need  for atomic_inc_64.

Emptying out  had the side effect of removing an
implied #include .


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/ia64/ia64/pmap.c

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



CVS commit: src/sys/arch/ia64/ia64

2019-11-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Nov 30 16:23:46 UTC 2019

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

Log Message:
Need  for atomic_inc_64.

Emptying out  had the side effect of removing an
implied #include .


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/ia64/ia64/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/ia64/ia64/pmap.c
diff -u src/sys/arch/ia64/ia64/pmap.c:1.38 src/sys/arch/ia64/ia64/pmap.c:1.39
--- src/sys/arch/ia64/ia64/pmap.c:1.38	Thu May  9 15:48:55 2019
+++ src/sys/arch/ia64/ia64/pmap.c	Sat Nov 30 16:23:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.38 2019/05/09 15:48:55 scole Exp $ */
+/* $NetBSD: pmap.c,v 1.39 2019/11/30 16:23:46 riastradh Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -81,9 +81,10 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2019/05/09 15:48:55 scole Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2019/11/30 16:23:46 riastradh Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/arch/sh3

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 15:53:36 UTC 2019

Modified Files:
src/sys/arch/sh3/include: userret.h
src/sys/arch/sh3/sh3: exception.c

Log Message:
Revert previous.  Looks like it requires a more extensive fix.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/userret.h
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/sh3/exception.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/sh3/include/userret.h
diff -u src/sys/arch/sh3/include/userret.h:1.15 src/sys/arch/sh3/include/userret.h:1.16
--- src/sys/arch/sh3/include/userret.h:1.15	Fri Nov 29 18:27:32 2019
+++ src/sys/arch/sh3/include/userret.h	Sat Nov 30 15:53:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: userret.h,v 1.15 2019/11/29 18:27:32 ad Exp $	*/
+/*	$NetBSD: userret.h,v 1.16 2019/11/30 15:53:36 ad Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -52,16 +52,7 @@ userret(struct lwp *l)
 {
 
 	/* Invoke MI userret code */
-	do {
-		//curcpu()->ci_data.cpu_nast++;
-		l->l_md.md_astpending = 0;
-		mi_userret(l);
-	} while (l->l_md.md_astpending);
-
-	if (l->l_pflag & LP_OWEUPC) {
-		l->l_pflag &= ~LP_OWEUPC;
-		ADDUPROF(l);
-	}
+	mi_userret(l);
 
 #ifdef PTRACE_HOOKS
 	/* Check if lwp is being PT_STEP'ed */

Index: src/sys/arch/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.69 src/sys/arch/sh3/sh3/exception.c:1.70
--- src/sys/arch/sh3/sh3/exception.c:1.69	Fri Nov 29 18:27:33 2019
+++ src/sys/arch/sh3/sh3/exception.c	Sat Nov 30 15:53:36 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $	*/
+/*	$NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -471,5 +471,15 @@ ast(struct lwp *l, struct trapframe *tf)
 	KDASSERT(l != NULL);
 	KDASSERT(l->l_md.md_regs == tf);
 
-	userret(l);
+	while (l->l_md.md_astpending) {
+		//curcpu()->ci_data.cpu_nast++;
+		l->l_md.md_astpending = 0;
+
+		if (l->l_pflag & LP_OWEUPC) {
+			l->l_pflag &= ~LP_OWEUPC;
+			ADDUPROF(l);
+		}
+
+		userret(l);
+	}
 }



CVS commit: src/sys/arch/sh3

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 15:53:36 UTC 2019

Modified Files:
src/sys/arch/sh3/include: userret.h
src/sys/arch/sh3/sh3: exception.c

Log Message:
Revert previous.  Looks like it requires a more extensive fix.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/userret.h
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/sh3/exception.c

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



CVS commit: src/sys/sys

2019-11-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Nov 30 15:34:07 UTC 2019

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

Log Message:
Nix vestigial references to MUTEX_GIVE and MUTEX_RECEIVE in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/sys/mutex.h

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

Modified files:

Index: src/sys/sys/mutex.h
diff -u src/sys/sys/mutex.h:1.22 src/sys/sys/mutex.h:1.23
--- src/sys/sys/mutex.h:1.22	Sat Sep 16 23:25:35 2017
+++ src/sys/sys/mutex.h	Sat Nov 30 15:34:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.22 2017/09/16 23:25:35 christos Exp $	*/
+/*	$NetBSD: mutex.h,v 1.23 2019/11/30 15:34:07 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -63,13 +63,6 @@
  *		[additionally:]
  *		volatile integer	mtx_id
  *
- *	MUTEX_RECEIVE(mtx)
- *		Post a load fence after acquiring the mutex, if necessary.
- *
- *	MUTEX_GIVE(mtx)
- *		Post a load/store fence after releasing the mutex, if
- *		necessary.
- *
  * 	MUTEX_CAS(ptr, old, new)
  *		Perform an atomic "compare and swap" operation and
  *		evaluate to true or false according to the success



CVS commit: src/sys/sys

2019-11-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Nov 30 15:34:07 UTC 2019

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

Log Message:
Nix vestigial references to MUTEX_GIVE and MUTEX_RECEIVE in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/sys/mutex.h

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



Re: CVS commit: src/sys/kern

2019-11-30 Thread Andrew Doran
Hi,

On Sat, Nov 30, 2019 at 04:52:38PM +0900, Rin Okuyama wrote:
> On 2019/11/30 5:50, Andrew Doran wrote:
> > Module Name:src
> > Committed By:   ad
> > Date:   Fri Nov 29 20:50:54 UTC 2019
> > 
> > Modified Files:
> > src/sys/kern: kern_rwlock.c
> > 
> > Log Message:
> > A couple more tweaks to avoid reading the lock word.
> > 
> > 
> > To generate a diff of this commit:
> > cvs rdiff -u -r1.56 -r1.57 src/sys/kern/kern_rwlock.c
> > 
> > Please note that diffs are not public domain; they are subject to the
> > copyright notices on the relevant files.
> 
> Hi,
> 
> After this commit, GENERIC64 kernel on evbarm-aarch64 does no longer
> boot multiuser anymore with rwlock related panics:
> 
>   panic: kernel diagnostic assertion "vm_map_locked_p(map)" failed: file 
> "../../../../uvm/uvm_map.c", line 1315
> 
> or
> 
>   panic: kernel diagnostic assertion "rw_write_held(>lock)" failed: 
> file "../../../../uvm/uvm_map.c", line 701
> 
> By reverting kern_rwlock.c to rev 1.56, panics disappear as far as
> I can see.

Hmm, it works fine on amd64 and looks OK but me, but I have backed it out
for the time being.

Thank you,
Andrew


CVS commit: src/sys/kern

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 14:21:16 UTC 2019

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

Log Message:
Back out previous.  It works on amd64 under stress test but not
evbarm-aarch64 for some reason.  Will revisit.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_rwlock.c

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



CVS commit: src/sys/kern

2019-11-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Nov 30 14:21:16 UTC 2019

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

Log Message:
Back out previous.  It works on amd64 under stress test but not
evbarm-aarch64 for some reason.  Will revisit.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/kern/kern_rwlock.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_rwlock.c
diff -u src/sys/kern/kern_rwlock.c:1.57 src/sys/kern/kern_rwlock.c:1.58
--- src/sys/kern/kern_rwlock.c:1.57	Fri Nov 29 20:50:54 2019
+++ src/sys/kern/kern_rwlock.c	Sat Nov 30 14:21:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_rwlock.c,v 1.57 2019/11/29 20:50:54 ad Exp $	*/
+/*	$NetBSD: kern_rwlock.c,v 1.58 2019/11/30 14:21:16 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.57 2019/11/29 20:50:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.58 2019/11/30 14:21:16 ad Exp $");
 
 #define	__RWLOCK_PRIVATE
 
@@ -417,11 +417,10 @@ rw_vector_enter(krwlock_t *rw, const krw
 		 * No need for a memory barrier because of context switch.
 		 * If not handed the lock, then spin again.
 		 */
-		if (op == RW_READER)
+		if (op == RW_READER || (rw->rw_owner & RW_THREAD) == curthread)
 			break;
+
 		owner = rw->rw_owner;
-		if ((owner & RW_THREAD) == curthread)
-			break;
 	}
 	KPREEMPT_ENABLE(curlwp);
 
@@ -477,13 +476,14 @@ rw_vector_exit(krwlock_t *rw)
 	 * lock would become unowned.
 	 */
 	RW_MEMBAR_EXIT();
-	for (;; owner = next) {
+	for (;;) {
 		newown = (owner - decr);
 		if ((newown & (RW_THREAD | RW_HAS_WAITERS)) == RW_HAS_WAITERS)
 			break;
 		next = rw_cas(rw, owner, newown);
 		if (__predict_true(next == owner))
 			return;
+		owner = next;
 	}
 
 	/*
@@ -568,15 +568,15 @@ rw_vector_tryenter(krwlock_t *rw, const 
 		need_wait = RW_WRITE_LOCKED | RW_THREAD;
 	}
 
-	for (owner = 0;; owner = next) {
+	for (owner = rw->rw_owner;; owner = next) {
+		if (__predict_false((owner & need_wait) != 0))
+			return 0;
 		next = rw_cas(rw, owner, owner + incr);
 		if (__predict_true(next == owner)) {
 			/* Got it! */
 			RW_MEMBAR_ENTER();
 			break;
 		}
-		if (__predict_false((owner & need_wait) != 0))
-			return 0;
 	}
 
 	RW_WANTLOCK(rw, op);



CVS commit: src/sys/stand/efiboot

2019-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 30 13:02:18 UTC 2019

Modified Files:
src/sys/stand/efiboot: Makefile.efiboot efiacpi.c version
Added Files:
src/sys/stand/efiboot: smbios.c smbios.h

Log Message:
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/efiacpi.c
cvs rdiff -u -r0 -r1.1 src/sys/stand/efiboot/smbios.c \
src/sys/stand/efiboot/smbios.h
cvs rdiff -u -r1.12 -r1.13 src/sys/stand/efiboot/version

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



CVS commit: src/sys/stand/efiboot

2019-11-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Nov 30 13:02:18 UTC 2019

Modified Files:
src/sys/stand/efiboot: Makefile.efiboot efiacpi.c version
Added Files:
src/sys/stand/efiboot: smbios.c smbios.h

Log Message:
Use SMBIOS system vendor and product strings to create a "model" string
for the root node in the fabricated ACPI device tree, when possible.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/efiacpi.c
cvs rdiff -u -r0 -r1.1 src/sys/stand/efiboot/smbios.c \
src/sys/stand/efiboot/smbios.h
cvs rdiff -u -r1.12 -r1.13 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.8 src/sys/stand/efiboot/Makefile.efiboot:1.9
--- src/sys/stand/efiboot/Makefile.efiboot:1.8	Sun Jul 21 17:01:39 2019
+++ src/sys/stand/efiboot/Makefile.efiboot	Sat Nov 30 13:02:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.8 2019/07/21 17:01:39 rin Exp $
+# $NetBSD: Makefile.efiboot,v 1.9 2019/11/30 13:02:18 jmcneill Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -22,7 +22,7 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 .PATH: ${EFIDIR}/gnuefi
 SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
 SOURCES+=	boot.c conf.c console.c dev_net.c devopen.c exec.c panic.c prompt.c
-SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c efiacpi.c
+SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c efiacpi.c smbios.c
 
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist

Index: src/sys/stand/efiboot/efiacpi.c
diff -u src/sys/stand/efiboot/efiacpi.c:1.4 src/sys/stand/efiboot/efiacpi.c:1.5
--- src/sys/stand/efiboot/efiacpi.c:1.4	Thu Aug  1 13:11:16 2019
+++ src/sys/stand/efiboot/efiacpi.c	Sat Nov 30 13:02:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.c,v 1.4 2019/08/01 13:11:16 jmcneill Exp $ */
+/* $NetBSD: efiacpi.c,v 1.5 2019/11/30 13:02:18 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,6 +32,7 @@
 #include "efiboot.h"
 #include "efiacpi.h"
 #include "efifdt.h"
+#include "smbios.h"
 
 #include 
 
@@ -77,6 +78,39 @@ efi_acpi_show(void)
 	printf("\n");
 }
 
+static char model_buf[128];
+
+static const char *
+efi_acpi_get_model(void)
+{
+	struct smbtable smbios;
+	struct smbios_sys *psys;
+	const char *s;
+	char *buf;
+
+	memset(model_buf, 0, sizeof(model_buf));
+
+	if (smbios3_table != NULL) {
+		smbios_init(smbios3_table);
+
+		buf = model_buf;
+		smbios.cookie = 0;
+		if (smbios_find_table(SMBIOS_TYPE_SYSTEM, )) {
+			psys = smbios.tblhdr;
+			if ((s = smbios_get_string(, psys->vendor, buf, 64)) != NULL) {
+buf += strlen(s);
+*buf++ = ' ';
+			}
+			smbios_get_string(, psys->product, buf, 64);
+		}
+	}
+
+	if (model_buf[0] == '\0')
+		strcpy(model_buf, "ACPI");
+
+	return model_buf;
+}
+
 int
 efi_acpi_create_fdt(void)
 {
@@ -94,8 +128,10 @@ efi_acpi_create_fdt(void)
 	if (error)
 		return EIO;
 
+	const char *model = efi_acpi_get_model();
+
 	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "compatible", "netbsd,generic-acpi");
-	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", "ACPI");
+	fdt_setprop_string(fdt, fdt_path_offset(fdt, "/"), "model", model);
 	fdt_setprop_cell(fdt, fdt_path_offset(fdt, "/"), "#address-cells", 2);
 	fdt_setprop_cell(fdt, fdt_path_offset(fdt, "/"), "#size-cells", 2);
 

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.12 src/sys/stand/efiboot/version:1.13
--- src/sys/stand/efiboot/version:1.12	Thu Aug  1 13:11:16 2019
+++ src/sys/stand/efiboot/version	Sat Nov 30 13:02:18 2019
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.12 2019/08/01 13:11:16 jmcneill Exp $
+$NetBSD: version,v 1.13 2019/11/30 13:02:18 jmcneill Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -16,3 +16,4 @@ is taken as the current.
 1.9:	Add support for efiboot.plist and loading device tree overlays.
 1.10:	Add support for EFI GOP framebuffers in ACPI mode.
 1.11:	Add full UEFI memory map to /chosen node.
+1.12:	Derive ACPI model string from SMBIOS.

Added files:

Index: src/sys/stand/efiboot/smbios.c
diff -u /dev/null src/sys/stand/efiboot/smbios.c:1.1
--- /dev/null	Sat Nov 30 13:02:18 2019
+++ src/sys/stand/efiboot/smbios.c	Sat Nov 30 13:02:18 2019
@@ -0,0 +1,190 @@
+/*	$NetBSD: smbios.c,v 1.1 2019/11/30 13:02:18 jmcneill Exp $	*/
+
+/*
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research 

CVS commit: src/usr.bin/calendar/calendars

2019-11-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Nov 30 12:04:13 UTC 2019

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday calendar.computer
calendar.music

Log Message:
Sort


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/calendar/calendars/calendar.birthday
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/calendar/calendars/calendar.computer
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/calendar/calendars/calendar.music

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



CVS commit: src/usr.bin/calendar/calendars

2019-11-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Nov 30 12:04:13 UTC 2019

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday calendar.computer
calendar.music

Log Message:
Sort


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/calendar/calendars/calendar.birthday
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/calendar/calendars/calendar.computer
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/calendar/calendars/calendar.music

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

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.34 src/usr.bin/calendar/calendars/calendar.birthday:1.35
--- src/usr.bin/calendar/calendars/calendar.birthday:1.34	Sat Nov 30 11:42:54 2019
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Nov 30 12:04:13 2019
@@ -1,7 +1,7 @@
 01/01	Grace Brewster Murray Hopper died in Arlington, Virginia, 1992
+01/01	Heinz Zemanek born in Vienna, Austria, 1920
 01/01	J.D. Salinger born, 1919
 01/01	Paul Revere born in Boston, 1735
-01/01	Heinz Zemanek born in Vienna, Austria, 1920
 01/02	Isaac Asimov born in Petrovichi, Russian SFSR (now Russia), 1920
 01/04	George Washington Carver born in Missouri, 1864
 01/04	Jakob Grimm born, 1785
@@ -9,8 +9,8 @@
 01/05	DeWitt B. Brace born, 1859, inventor of spectrophotometer
 01/08	Stephen Hawking born in Oxford, England, 1942
 01/10	Ethan Allen born, 1738
-01/11	Alexander Hamilton born in Nevis, British West Indies, 1757?
 01/11	Aaron Hillel Swartz died in Brooklyn, New York, 2013
+01/11	Alexander Hamilton born in Nevis, British West Indies, 1757?
 01/12	"Long" John Baldry born in London, 1941
 01/13	Horatio Alger born, 1834
 01/13	Sophie Tucker born, 1884
@@ -22,8 +22,8 @@
 01/19	Robert Edward Lee born in Stratford Estate, Virginia, 1807
 01/20	Buzz Aldrin born, 1930
 01/20	George Burns born, 1898
-01/21	Vladimir Lenin died, 1924
 01/21	Thomas Jonathan "Stonewall" Jackson born in Clarksburg, VA, 1824
+01/21	Vladimir Lenin died, 1924
 01/22	Sir Francis Bacon born, 1561
 01/23	Ernst Abbe born, 1840, formulated diffraction theory
 01/23	Humphrey Bogart born in New York City, 1899
@@ -65,8 +65,8 @@
 02/22	George Washington born, 1732
 02/22	Pierre Jules Cesar Janssen born, 1838, found hydrogen in the sun
 02/23	W.E.B. DuBois born, 1868
-02/24	Winslow Homer born, 1836
 02/24	Steven Paul Jobs was born in San Francisco, California, 1955
+02/24	Winslow Homer born, 1836
 02/25	George Harrison born in Liverpool, England, 1943
 02/25	Renoir born, 1841
 02/26	Dominique Francois Jean Arago born, 1786;
@@ -80,17 +80,17 @@
 03/07	Sir John Frederick William Herschel born, 1792, astronomer
 03/08	Alvan Clark born, 1804, astronomer & lens manufacturer
 03/08	Howard Aiken born, 1900
+03/11	Douglas Adams born, 1952
 03/11	Robert Treat Paine born, 1737
 03/11	Vannevar Bush born, 1890
-03/11	Douglas Adams born, 1952
 03/12	Gustav Robert Kirchhoff born, 1824, physicist
 03/14	Albert Einstein born, 1879
 03/14	Casey Jones born, 1864
 03/14	Giovanni Virginia Schiaparelli born, 1835, astronomer;
 		named Mars "canals"
 03/14	Jean Baptiste Joseph Fourier born, 1768, mathematician & physicist
-03/15	Julius Caesar assassinated by Brutus; Ides of March, 44 BC
 03/15	J.J. Robert's Birthday in Liberia
+03/15	Julius Caesar assassinated by Brutus; Ides of March, 44 BC
 03/16	George Clymer born, 1739
 03/16	James Madison born, 1751
 03/23	Thomas Kelly, Father of the Lunar module, died, 2002
@@ -100,9 +100,9 @@
 03/27	Wilhelm Conrad Roentgen born, 1845, discoverer of X-rays
 03/28	Pierre Simon de Laplace born, 1749, mathematician & astronomer
 03/30	Francisco Jose de Goya born, 1746
+03/30	Queen Elizabeth, the Queen Mother, died at the age of 101, 2002
 03/30	Sean O'Casey born, 1880
 03/30	Vincent Van Gogh born, 1853
-03/30	Queen Elizabeth, the Queen Mother, died at the age of 101, 2002
 03/31	Rene Descartes born, 1596, mathematician & philosopher
 04/01	Alan Jay Perlis was born in Pittsburgh, Pennsylvania, 1922
 04/03	Washington Irving born, 1783
@@ -129,8 +129,8 @@
 05/02	Dr. Benjamin Spock born, 1903
 05/09	Pinza died, 1957
 05/10	Fred Astaire (Frederick Austerlitz) born in Omaha, Nebraska, 1899
-05/11	Johnny Appleseed born, 1768
 05/11	Douglas Adams died, 2001
+05/11	Johnny Appleseed born, 1768
 05/11	Richard Philips Feynman was born is Queens, New York, 1918
 05/12	Florence Nightingale born in Florence, Italy, 1820
 05/13	Arthur S. Sullivan born, 1842
@@ -147,8 +147,8 @@
 06/01	Marilyn Monroe born, 1928
 06/03	Henry James born, 1811
 06/07	(Eugene Henri) Paul Gaugin born, 1848
-06/07	George Bryan "Beau" Brummel born, 1778
 06/07	Alan Mathison Turing died, 1954
+06/07	George Bryan "Beau" Brummel born, 1778
 06/08	Frank Lloyd Wright born in Richland Center, Wisconsin, 1869
 06/11	Alexander the Great dies (323 BC)
 06/15	Edward (Edvard Hagerup) Grieg born in Bergen, Norway, 1843
@@ 

CVS commit: src/usr.bin/calendar/calendars

2019-11-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Nov 30 11:42:55 UTC 2019

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Grace Hopper and Richard Feynman


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/calendar/calendars/calendar.birthday

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

Modified files:

Index: src/usr.bin/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.33 src/usr.bin/calendar/calendars/calendar.birthday:1.34
--- src/usr.bin/calendar/calendars/calendar.birthday:1.33	Thu Nov 28 23:49:13 2019
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Nov 30 11:42:54 2019
@@ -1,3 +1,4 @@
+01/01	Grace Brewster Murray Hopper died in Arlington, Virginia, 1992
 01/01	J.D. Salinger born, 1919
 01/01	Paul Revere born in Boston, 1735
 01/01	Heinz Zemanek born in Vienna, Austria, 1920
@@ -51,6 +52,7 @@
 02/12	Abraham Lincoln born, 1809
 02/12	Charles Darwin born in Shrewsbury, England, 1809
 02/15	Galileo Galilei born in Pisa, Italy, 1564
+02/15	Richard Philips Feynman died in Los Angeles, California, 1988
 02/15	Susan B. Anthony born, 1820
 02/16	Pierre Bouguer born, 1698, founder of photometry
 02/17	Frederick Eugene Ives born, 1856, pioneer of halftone
@@ -129,6 +131,7 @@
 05/10	Fred Astaire (Frederick Austerlitz) born in Omaha, Nebraska, 1899
 05/11	Johnny Appleseed born, 1768
 05/11	Douglas Adams died, 2001
+05/11	Richard Philips Feynman was born is Queens, New York, 1918
 05/12	Florence Nightingale born in Florence, Italy, 1820
 05/13	Arthur S. Sullivan born, 1842
 05/15	Mike Oldfield born in Essex, England, 1953
@@ -264,6 +267,7 @@
 12/05	Walt (Walter Elias) Disney born in Chicago, 1901
 12/08	Horace (Quintus Horatius Flaccus) born in Venosa (Italy), 65 BC
 12/08	James (Grover) Thurber born in Columbus, Ohio, 1894
+12/09	Grace Brewster Murray Hopper was born in New York City, 1906
 12/09	Danny Cohen born in Haifa, Israel, 1937
 12/10	Emily Dickinson born, 1830
 12/12	E.G. Robinson born, 1893



CVS commit: src/usr.bin/calendar/calendars

2019-11-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Nov 30 11:42:55 UTC 2019

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Grace Hopper and Richard Feynman


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/calendar/calendars/calendar.birthday

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