CVS commit: src/lib/libpthread

2020-04-14 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Apr 14 23:35:07 UTC 2020

Modified Files:
src/lib/libpthread: pthread.c pthread_cond.c

Log Message:
Drop most of the logic associated with pthread__started.

The pthread_cond logic is a questionable optimisation at best and the
post-fork logic is plainly broken.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/lib/libpthread/pthread.c
cvs rdiff -u -r1.67 -r1.68 src/lib/libpthread/pthread_cond.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.167 src/lib/libpthread/pthread.c:1.168
--- src/lib/libpthread/pthread.c:1.167	Sun Feb 16 17:45:11 2020
+++ src/lib/libpthread/pthread.c	Tue Apr 14 23:35:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.167 2020/02/16 17:45:11 kamil Exp $	*/
+/*	$NetBSD: pthread.c,v 1.168 2020/04/14 23:35:07 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread.c,v 1.167 2020/02/16 17:45:11 kamil Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.168 2020/04/14 23:35:07 joerg Exp $");
 
 #define	__EXPOSE_STACK	1
 
@@ -84,8 +84,6 @@ static void	pthread__scrubthread(pthread
 static void	pthread__initmain(pthread_t *);
 static void	pthread__fork_callback(void);
 static void	pthread__reap(pthread_t);
-static void	pthread__child_callback(void);
-static void	pthread__start(void);
 
 void	pthread__init(void);
 
@@ -274,36 +272,6 @@ pthread__fork_callback(void)
 	self->pt_lid = _lwp_self();
 }
 
-static void
-pthread__child_callback(void)
-{
-
-	/*
-	 * Clean up data structures that a forked child process might
-	 * trip over. Note that if threads have been created (causing
-	 * this handler to be registered) the standards say that the
-	 * child will trigger undefined behavior if it makes any
-	 * pthread_* calls (or any other calls that aren't
-	 * async-signal-safe), so we don't really have to clean up
-	 * much. Anything that permits some pthread_* calls to work is
-	 * merely being polite.
-	 */
-	pthread__started = 0;
-}
-
-static void
-pthread__start(void)
-{
-
-	/*
-	 * Per-process timers are cleared by fork(); despite the
-	 * various restrictions on fork() and threads, it's legal to
-	 * fork() before creating any threads.
-	 */
-	pthread_atfork(NULL, NULL, pthread__child_callback);
-}
-
-
 /* General-purpose thread data structure sanitization. */
 /* ARGSUSED */
 static void
@@ -424,15 +392,6 @@ pthread_create(pthread_t *thread, const 
 		return __libc_thr_create_stub(thread, attr, startfunc, arg);
 	}
 
-	/*
-	 * It's okay to check this without a lock because there can
-	 * only be one thread before it becomes true.
-	 */
-	if (pthread__started == 0) {
-		pthread__start();
-		pthread__started = 1;
-	}
-
 	if (attr == NULL)
 		nattr = pthread_default_attr;
 	else if (attr->pta_magic == PT_ATTR_MAGIC)
@@ -440,6 +399,8 @@ pthread_create(pthread_t *thread, const 
 	else
 		return EINVAL;
 
+	pthread__started = 1;
+
 	/* Fetch misc. attributes from the attr structure. */
 	name = NULL;
 	if ((p = nattr.pta_private) != NULL)

Index: src/lib/libpthread/pthread_cond.c
diff -u src/lib/libpthread/pthread_cond.c:1.67 src/lib/libpthread/pthread_cond.c:1.68
--- src/lib/libpthread/pthread_cond.c:1.67	Wed Jan 29 15:07:46 2020
+++ src/lib/libpthread/pthread_cond.c	Tue Apr 14 23:35:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_cond.c,v 1.67 2020/01/29 15:07:46 kamil Exp $	*/
+/*	$NetBSD: pthread_cond.c,v 1.68 2020/04/14 23:35:07 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_cond.c,v 1.67 2020/01/29 15:07:46 kamil Exp $");
+__RCSID("$NetBSD: pthread_cond.c,v 1.68 2020/04/14 23:35:07 joerg Exp $");
 
 #include 
 #include 
@@ -59,11 +59,6 @@ __RCSID("$NetBSD: pthread_cond.c,v 1.67 
 
 int	_sys___nanosleep50(const struct timespec *, struct timespec *);
 
-extern int pthread__started;
-
-static int pthread_cond_wait_nothread(pthread_t, pthread_mutex_t *,
-pthread_cond_t *, const struct timespec *);
-
 int	_pthread_cond_has_waiters_np(pthread_cond_t *);
 
 __weak_alias(pthread_cond_has_waiters_np,_pthread_cond_has_waiters_np)
@@ -149,10 +144,6 @@ pthread_cond_timedwait(pthread_cond_t *c
 
 	self = pthread__self();
 
-	/* Just hang out for a while if threads aren't running yet. */
-	if (__predict_false(pthread__started == 0)) {
-		return pthread_cond_wait_nothread(self, mutex, cond, abstime);
-	}
 	if (__predict_false(self->pt_cancel)) {
 		pthread__cancelled();
 	}
@@ -431,38 +422,3 @@ pthread_condattr_setpshared(pthread_cond
 	return EINVAL;
 }
 #endif
-
-/* Utility routine to hang out for a while if threads haven't started yet. */
-static int
-pthread_cond_wait_nothread(pthread_t self, pthread_mutex_t *mutex,
-pthread_cond_t *cond, const struct timespec *abstime)

CVS commit: src/sys/kern

2020-04-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Apr 14 22:42:18 UTC 2020

Modified Files:
src/sys/kern: kern_exec.c kern_fork.c

Log Message:
Set p_oppid always, not just when a parent is traced

PR kern/55151 by Martin Husemann


To generate a diff of this commit:
cvs rdiff -u -r1.495 -r1.496 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.221 -r1.222 src/sys/kern/kern_fork.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_exec.c
diff -u src/sys/kern/kern_exec.c:1.495 src/sys/kern/kern_exec.c:1.496
--- src/sys/kern/kern_exec.c:1.495	Mon Apr  6 08:20:05 2020
+++ src/sys/kern/kern_exec.c	Tue Apr 14 22:42:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.496 2020/04/14 22:42:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.496 2020/04/14 22:42:18 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2658,10 +2658,10 @@ do_posix_spawn(struct lwp *l1, pid_t *pi
 	p2->p_exitsig = SIGCHLD;	/* signal for parent on exit */
 
 	if ((p1->p_slflag & (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) ==
-	(PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) {
+	(PSL_TRACEPOSIX_SPAWN|PSL_TRACED))
 		proc_changeparent(p2, p1->p_pptr);
-		p2->p_oppid = p1->p_pid;
-	}
+
+	p2->p_oppid = p1->p_pid;  /* Remember the original parent id. */
 
 	LIST_INSERT_AFTER(p1, p2, p_pglist);
 	LIST_INSERT_HEAD(, p2, p_list);

Index: src/sys/kern/kern_fork.c
diff -u src/sys/kern/kern_fork.c:1.221 src/sys/kern/kern_fork.c:1.222
--- src/sys/kern/kern_fork.c:1.221	Mon Apr  6 08:20:05 2020
+++ src/sys/kern/kern_fork.c	Tue Apr 14 22:42:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $	*/
+/*	$NetBSD: kern_fork.c,v 1.222 2020/04/14 22:42:18 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008, 2019
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.222 2020/04/14 22:42:18 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -511,10 +511,10 @@ fork1(struct lwp *l1, int flags, int exi
 	/*
 	 * Trace fork(2) and vfork(2)-like events on demand in a debugger.
 	 */
-	if (tracefork(p1, flags) || tracevfork(p1, flags)) {
+	if (tracefork(p1, flags) || tracevfork(p1, flags))
 		proc_changeparent(p2, p1->p_pptr);
-		p2->p_oppid = p1->p_pid;
-	}
+
+	p2->p_oppid = p1->p_pid; /* Remember the original parent id. */
 
 	LIST_INSERT_AFTER(p1, p2, p_pglist);
 	LIST_INSERT_HEAD(, p2, p_list);



CVS commit: src/tests/lib/libc/sys

2020-04-14 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Apr 14 22:37:25 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Add timeout to syscall_signal_on_sce that hangs from time to time


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.169 src/tests/lib/libc/sys/t_ptrace_wait.c:1.170
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.169	Sat Mar  7 14:53:14 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Tue Apr 14 22:37:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.169 2020/03/07 14:53:14 christos Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.170 2020/04/14 22:37:24 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.169 2020/03/07 14:53:14 christos Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.170 2020/04/14 22:37:24 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -7579,6 +7579,7 @@ syscall_body(const char *op)
 ATF_TC(name);\
 ATF_TC_HEAD(name, tc)			\
 {	\
+	atf_tc_set_md_var(tc, "timeout", "15");\
 	atf_tc_set_md_var(tc, "descr",	\
 	"Verify that getpid(2) can be traced with PT_SYSCALL %s",	\
 	   #op );			\



CVS commit: [netbsd-8] src/sys/dev/mii

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 18:11:35 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-8]: miidevs.h miidevs_data.h

Log Message:
Regen for ticket #1529


To generate a diff of this commit:
cvs rdiff -u -r1.128.6.8 -r1.128.6.9 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.116.6.8 -r1.116.6.9 src/sys/dev/mii/miidevs_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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.128.6.8 src/sys/dev/mii/miidevs.h:1.128.6.9
--- src/sys/dev/mii/miidevs.h:1.128.6.8	Mon Nov 25 15:57:49 2019
+++ src/sys/dev/mii/miidevs.h	Tue Apr 14 18:11:35 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.128.6.8 2019/11/25 15:57:49 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.128.6.9 2020/04/14 18:11:35 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.125.6.8 2019/11/25 15:57:23 martin Exp
+ *	NetBSD: miidevs,v 1.125.6.9 2020/04/14 17:57:17 martin Exp
  */
 
 /*-
@@ -60,10 +60,12 @@
 #define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
 #define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
+#define	MII_OUI_QUAKE	0x000897	/* Quake Technologies */
 #define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
 #define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
 #define	MII_OUI_NETAS	0x0009c3	/* Netas */
 #define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
+#define	MII_OUI_AELUROS	0x000b25	/* Aeluros */
 #define	MII_OUI_RALINK	0x000c43	/* Ralink Technology */
 #define	MII_OUI_ASIX	0x000ec6	/* ASIX */
 #define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
@@ -71,13 +73,11 @@
 #define	MII_OUI_ALTIMA	0x0010a9	/* Altima Communications */
 #define	MII_OUI_ENABLESEMI	0x0010dd	/* Enable Semiconductor */
 #define	MII_OUI_SUNPLUS	0x001105	/* Sunplus Technology */
-#define	MII_OUI_ATHEROS	0x001374	/* Atheros */
 #define	MII_OUI_TERANETICS	0x0014a6	/* Teranetics */
 #define	MII_OUI_RALINK2	0x0017a5	/* Ralink Technology */
 #define	MII_OUI_AQUANTIA	0x0017b6	/* Aquantia Corporation */
 #define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
 #define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
-#define	MII_OUI_VIA	0x004063	/* VIA Technologies */
 #define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
 #define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
 #define	MII_OUI_AMLOGIC	0x006051	/* Amlogic */
@@ -89,7 +89,6 @@
 #define	MII_OUI_TSC	0x00c039	/* TDK Semiconductor */
 #define	MII_OUI_MYSON	0x00c0b4	/* Myson Technology */
 #define	MII_OUI_ATTANSIC	0x00c82e	/* Attansic Technology */
-#define	MII_OUI_RDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_JMICRON	0x00d831	/* JMicron */
 #define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
 #define	MII_OUI_SIS	0x00e006	/* Silicon Integrated Systems */
@@ -104,6 +103,7 @@
 /* Unregistered or wrong OUI */
 #define	MII_OUI_yyREALTEK	0x04	/* Realtek */
 #define	MII_OUI_yyAMD	0x58	/* Advanced Micro Devices */
+#define	MII_OUI_xxVIA	0x0002c6	/* VIA Technologies */
 #define	MII_OUI_xxMYSON	0x00032d	/* Myson Technology */
 #define	MII_OUI_xxTSC	0x00039c	/* TDK Semiconductor */
 #define	MII_OUI_xxASIX	0x000674	/* Asix Semiconductor */
@@ -122,6 +122,7 @@
 #define	MII_OUI_xxVITESSE	0x008083	/* Vitesse Semiconductor */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f	/* Cicada Semiconductor */
+#define	MII_OUI_xxRDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_xxNATSEMI	0x1000e8	/* National Semiconductor */
 #define	MII_OUI_xxLEVEL1	0x782000	/* Level 1 */
 #define	MII_OUI_xxXAQTI	0xace000	/* XaQti Corp. */
@@ -133,8 +134,10 @@
 /*
  * Agere PHYs
  */
-#define	MII_MODEL_AGERE_ET1011	0x0004
-#define	MII_STR_AGERE_ET1011	"Agere ET1011 10/100/1000baseT PHY"
+#define	MII_MODEL_AGERE_ET1011	0x0001
+#define	MII_STR_AGERE_ET1011	"ET1011 10/100/1000baseT PHY"
+#define	MII_MODEL_AGERE_ET1011C	0x0004
+#define	MII_STR_AGERE_ET1011C	"ET1011C 10/100/1000baseT PHY"
 
 /* Asix semiconductor PHYs */
 #define	MII_MODEL_xxASIX_AX88X9X	0x0031
@@ -166,13 +169,7 @@
 #define	MII_MODEL_xxAMLOGIC_GXL	0x
 #define	MII_STR_xxAMLOGIC_GXL	"Meson GXL internal PHY"
 
-/* Atheros PHYs */
-#define	MII_MODEL_ATHEROS_F1	0x0001
-#define	MII_STR_ATHEROS_F1	"F1 10/100/1000 PHY"
-#define	MII_MODEL_ATHEROS_F2	0x0002
-#define	MII_STR_ATHEROS_F2	"F2 10/100 PHY"
-
-/* Attansic PHYs */
+/* Attansic/Atheros PHYs */
 #define	MII_MODEL_ATTANSIC_L1	0x0001
 #define	MII_STR_ATTANSIC_L1	"L1 10/100/1000 PHY"
 #define	MII_MODEL_ATTANSIC_L2	0x0002
@@ -300,6 +297,8 @@
 #define	MII_STR_BROADCOM3_BCM53125	"BCM53125 1000BASE-T switch"
 #define	MII_MODEL_BROADCOM3_BCM5720C	0x0036
 #define	MII_STR_BROADCOM3_BCM5720C	"BCM5720C 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM4_BCM54213PE	0x000a
+#define	MII_STR_BROADCOM4_BCM54213PE	"BCM54213PE 1000BASE-T media interface"
 

CVS commit: [netbsd-8] src/sys/dev/mii

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:57:17 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-8]: atphy.c brgphy.c etphy.c miidevs rdcphy.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1529:

sys/dev/mii/miidevs 1.154, 1.162-1.167
sys/dev/mii/atphy.c 1.28 via patch
sys/dev/mii/brgphy.c1.87 via patch
sys/dev/mii/etphy.c 1.5, 1.6 via patch
sys/dev/mii/rdcphy.c1.6, 1.8 via patch

- Add support Broadcom BCM54213PE and some new RDC devices.
- Rename RDC to xxRDC.
- Use xxVIA instead of VIA.
- etphy(4):
  - Rename ET1011 to ET1011C and add ET1011 support.
  - Use mii_phy_flowstatus() to reflect flow status from negotiated
result.
- Use static.
- KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/sys/dev/mii/atphy.c
cvs rdiff -u -r1.76.20.2 -r1.76.20.3 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/mii/etphy.c \
src/sys/dev/mii/rdcphy.c
cvs rdiff -u -r1.125.6.8 -r1.125.6.9 src/sys/dev/mii/miidevs

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/mii/atphy.c
diff -u src/sys/dev/mii/atphy.c:1.18.8.1 src/sys/dev/mii/atphy.c:1.18.8.2
--- src/sys/dev/mii/atphy.c:1.18.8.1	Thu Nov 21 14:06:16 2019
+++ src/sys/dev/mii/atphy.c	Tue Apr 14 17:57:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atphy.c,v 1.18.8.1 2019/11/21 14:06:16 martin Exp $ */
+/*	$NetBSD: atphy.c,v 1.18.8.2 2020/04/14 17:57:17 martin Exp $ */
 /*	$OpenBSD: atphy.c,v 1.1 2008/09/25 20:47:16 brad Exp $	*/
 
 /*-
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.18.8.1 2019/11/21 14:06:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atphy.c,v 1.18.8.2 2020/04/14 17:57:17 martin Exp $");
 
 #include 
 #include 
@@ -91,8 +91,6 @@ const struct mii_phy_funcs atphy_funcs =
 };
 
 static const struct mii_phydesc atphys[] = {
-	{ MII_OUI_ATHEROS,	MII_MODEL_ATHEROS_F1,
-	  MII_STR_ATHEROS_F1 },
 	{ MII_OUI_ATTANSIC,	MII_MODEL_ATTANSIC_L1,
 	  MII_STR_ATTANSIC_L1 },
 	{ MII_OUI_ATTANSIC,	MII_MODEL_ATTANSIC_L2,

Index: src/sys/dev/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.76.20.2 src/sys/dev/mii/brgphy.c:1.76.20.3
--- src/sys/dev/mii/brgphy.c:1.76.20.2	Mon May 13 12:40:13 2019
+++ src/sys/dev/mii/brgphy.c	Tue Apr 14 17:57:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.76.20.2 2019/05/13 12:40:13 martin Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.76.20.3 2020/04/14 17:57:17 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.76.20.2 2019/05/13 12:40:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.76.20.3 2020/04/14 17:57:17 martin Exp $");
 
 #include 
 #include 
@@ -246,6 +246,9 @@ static const struct mii_phydesc brgphys[
 	{ MII_OUI_BROADCOM3,		MII_MODEL_BROADCOM3_BCM57780,
 	  MII_STR_BROADCOM3_BCM57780 },
 
+	{ MII_OUI_BROADCOM4,		MII_MODEL_BROADCOM4_BCM54213PE,
+	  MII_STR_BROADCOM4_BCM54213PE },
+
 	{ MII_OUI_BROADCOM4,		MII_MODEL_BROADCOM4_BCM5725C,
 	  MII_STR_BROADCOM4_BCM5725C },
 

Index: src/sys/dev/mii/etphy.c
diff -u src/sys/dev/mii/etphy.c:1.1 src/sys/dev/mii/etphy.c:1.1.54.1
--- src/sys/dev/mii/etphy.c:1.1	Sat Nov 13 00:47:24 2010
+++ src/sys/dev/mii/etphy.c	Tue Apr 14 17:57:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: etphy.c,v 1.1 2010/11/13 00:47:24 jnemeth Exp $	*/
+/*	$NetBSD: etphy.c,v 1.1.54.1 2020/04/14 17:57:17 martin Exp $	*/
 /*	$OpenBSD: etphy.c,v 1.4 2008/04/02 20:12:58 brad Exp $	*/
 
 /*
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.1 2010/11/13 00:47:24 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.1.54.1 2020/04/14 17:57:17 martin Exp $");
 
 #include 
 #include 
@@ -77,19 +77,21 @@ __KERNEL_RCSID(0, "$NetBSD: etphy.c,v 1.
 #define ETPHY_SR_FDX		0x0080
 
 
-int	etphy_service(struct mii_softc *, struct mii_data *, int);
-void	etphy_attach(device_t, device_t, void *);
-int	etphy_match(device_t, cfdata_t, void *);
-void	etphy_reset(struct mii_softc *);
-void	etphy_status(struct mii_softc *);
+static int	etphy_service(struct mii_softc *, struct mii_data *, int);
+static void	etphy_attach(device_t, device_t, void *);
+static int	etphy_match(device_t, cfdata_t, void *);
+static void	etphy_reset(struct mii_softc *);
+static void	etphy_status(struct mii_softc *);
 
-const struct mii_phy_funcs etphy_funcs = {
+static const struct mii_phy_funcs etphy_funcs = {
 	etphy_service, etphy_status, etphy_reset,
 };
 
 static const struct mii_phydesc etphys[] = {
 	{ MII_OUI_AGERE,	MII_MODEL_AGERE_ET1011,
 	  MII_STR_AGERE_ET1011 },
+	{ MII_OUI_AGERE,	MII_MODEL_AGERE_ET1011C,
+	  MII_STR_AGERE_ET1011C },
 	{ 0,			0,
 	  NULL },
 };
@@ -135,7 +137,7 @@ static const 

CVS commit: [netbsd-8] src/sys/dev/ic

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:39:28 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-8]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1528):

sys/dev/ic/spdmemvar.h: revision 1.15
sys/dev/ic/spdmemvar.h: revision 1.16
sys/dev/ic/spdmem.c: revision 1.31
sys/dev/ic/spdmem.c: revision 1.32
sys/dev/ic/spdmem.c: revision 1.33
sys/dev/ic/spdmem.c: revision 1.34
sys/dev/ic/spdmem.c: revision 1.35

Fix spelling of symeti^Hric

  Print DDR3's row and column correctly.

KNF. No functional change.

- Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
   makes PC3- value more correctly on newer DDR3.

Calculate DDR3's tRAS correctly.

  Fix unused area size found by pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.24.6.2 -r1.24.6.3 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13.6.1 -r1.13.6.2 src/sys/dev/ic/spdmemvar.h

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.24.6.2 src/sys/dev/ic/spdmem.c:1.24.6.3
--- src/sys/dev/ic/spdmem.c:1.24.6.2	Thu Jan  3 11:23:54 2019
+++ src/sys/dev/ic/spdmem.c	Tue Apr 14 17:39:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $ */
+/* $NetBSD: spdmem.c,v 1.24.6.3 2020/04/14 17:39:28 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.2 2019/01/03 11:23:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.24.6.3 2020/04/14 17:39:28 martin Exp $");
 
 #include 
 #include 
@@ -340,12 +340,12 @@ spdmem_common_attach(struct spdmem_softc
 	device_xname(self), NULL, NULL, 0, NULL, 0,
 	CTL_HW, CTL_CREATE, CTL_EOL);
 	if (node != NULL && spd_len != 0)
-sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
-0,
-CTLTYPE_STRUCT, "spd_data",
+		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
+		0,
+		CTLTYPE_STRUCT, "spd_data",
 		SYSCTL_DESCR("raw spd data"), NULL,
-0, s, spd_len,
-CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
+		0, s, spd_len,
+		CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	/*
 	 * Decode and print key SPD contents
@@ -411,7 +411,7 @@ spdmem_common_attach(struct spdmem_softc
 			strlcat(sc->sc_type, " NVDIMM hybrid",
 			SPDMEM_TYPE_MAXLEN);
 	}
-	
+
 	if (node != NULL)
 		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
 		0,
@@ -615,7 +615,7 @@ decode_sdram(const struct sysctlnode *no
 		freq = 0;
 	switch (freq) {
 		/*
-		 * Must check cycle time since some PC-133 DIMMs 
+		 * Must check cycle time since some PC-133 DIMMs
 		 * actually report PC-100
 		 */
 	case 100:
@@ -756,6 +756,30 @@ print_part(const char *part, size_t pnsi
 	aprint_normal(": %.*s\n", (int)(p - part), part);
 }
 
+static u_int
+ddr3_value_pico(struct spdmem *s, uint8_t txx_mtb, uint8_t txx_ftb)
+{
+	u_int mtb, ftb; /* in picoseconds */
+	intmax_t signed_txx_ftb;
+	u_int val;
+
+	mtb = (u_int)s->sm_ddr3.ddr3_mtb_dividend * 1000 /
+	s->sm_ddr3.ddr3_mtb_divisor;
+	ftb = (u_int)s->sm_ddr3.ddr3_ftb_dividend * 1000 /
+	s->sm_ddr3.ddr3_ftb_divisor;
+
+	/* tXX_ftb is signed value */
+	signed_txx_ftb = (int8_t)txx_ftb;
+	val = txx_mtb * mtb +
+	((txx_ftb > 127) ? signed_txx_ftb : txx_ftb) * ftb / 1000;
+
+	return val;
+}
+
+#define __DDR3_VALUE_PICO(s, field)\
+	ddr3_value_pico(s, s->sm_ddr3.ddr3_##field##_mtb,	\
+	s->sm_ddr3.ddr3_##field##_ftb)
+
 static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
@@ -786,10 +810,7 @@ decode_ddr3(const struct sysctlnode *nod
 		(s->sm_ddr3.ddr3_chipwidth + 2);
 	dimm_size = (1 << dimm_size) * (s->sm_ddr3.ddr3_physbanks + 1);
 
-	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend + 
-			(s->sm_ddr3.ddr3_mtb_divisor / 2)) /
-		 s->sm_ddr3.ddr3_mtb_divisor;
-	cycle_time *= s->sm_ddr3.ddr3_tCKmin;
+	cycle_time = __DDR3_VALUE_PICO(s, tCKmin);
 	bits = 1 << (s->sm_ddr3.ddr3_datawidth + 3);
 	decode_size_speed(self, node, dimm_size, cycle_time, 2, bits, FALSE,
 			  "PC3", 0);
@@ -797,17 +818,21 @@ decode_ddr3(const struct sysctlnode *nod
 	aprint_verbose_dev(self,
 	"%d rows, %d cols, %d log. banks, %d phys. banks, "
 	"%d.%03dns cycle time\n",
-	s->sm_ddr3.ddr3_rows + 9, s->sm_ddr3.ddr3_cols + 12,
+	s->sm_ddr3.ddr3_rows + 12, s->sm_ddr3.ddr3_cols + 9,
 	1 << (s->sm_ddr3.ddr3_logbanks + 3),
 	s->sm_ddr3.ddr3_physbanks + 1,
 	cycle_time/1000, cycle_time % 1000);
 
-#define	__DDR3_CYCLES(field) (s->sm_ddr3.field / s->sm_ddr3.ddr3_tCKmin)
+#define	__DDR3_CYCLES(val)		\
+	((val / cycle_time) + ((val % cycle_time) ? 1 : 0))
 
-	

CVS commit: [netbsd-9] src/doc

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:30:43 UTC 2020

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

Log Message:
Tickets #831 - #834


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 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.34 src/doc/CHANGES-9.1:1.1.2.35
--- src/doc/CHANGES-9.1:1.1.2.34	Sun Apr 12 17:34:34 2020
+++ src/doc/CHANGES-9.1	Tue Apr 14 17:30:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.34 2020/04/12 17:34:34 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.35 2020/04/14 17:30:43 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -898,3 +898,44 @@ doc/3RDPARTY	(apply patch)
 
 	Update to dhcpcd-8.1.8 which fixes a compile issue.
 	[roy, ticket #830]
+
+sys/dev/mii/miidevs1.162-1.165, 1.167
+sys/dev/mii/brgphy.c1.87
+sys/dev/mii/rdcphy.c1.6, 1.8
+sys/dev/mii/miidevs.hregen
+sys/dev/mii/miidevs_data.h			regen
+
+	- Add support Broadcom BCM54213PE.
+	- Add support some new RDC devices. From Andrius V.
+	- Rename RDC to xxRDC.
+	- Use xxVIA instead of VIA.
+	[msaitoh, ticket #831]
+
+sys/dev/ic/spdmem.c1.32-1.35
+sys/dev/ic/spdmemvar.h1.15,1.16
+
+	- Print DDR3's row and column correctly.
+	- Use fine timebase parameters for time calculation on DDR3. This
+	  change makes PC3- value more precisely on newer DDR3.
+	- Calculate DDR3's tRAS correctly.
+	[msaitoh, ticket #832]
+
+sys/arch/x86/include/specialreg.h		1.159-1.161
+sys/arch/x86/x86/procfs_machdep.c		1.35,1.36
+sys/arch/x86/x86/tsc.c1.40
+usr.sbin/cpuctl/arch/i386.c			1.109,1.110
+
+	- Print Fast Short Rep Mov(fsrm), AVX512_VP2INTERSECT, SERIALIZE and
+	  TSXLDTRK.
+	- Rename CPUID Fn8000_0007 %edx bit 8 from "TSC" to "ITSC"
+	  (Invariant TSC) to avoid confusion.
+	- Print CPUID 0x8007 %edx on both Intel and AMD.
+	- Remove ci_max_ext_cpuid from usr.sbin/cpuctl/arch/i386.c because it's
+	  the same as ci_cpuid_extlevel.
+	[msaitoh, ticket #833]
+
+sys/netinet6/nd6_rtr.c1.148
+
+	PR kern/55091, PR bin/54997: fix default route selection.
+	[kim, ticket #834]
+



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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:26:22 UTC 2020

Modified Files:
src/sys/netinet6 [netbsd-9]: nd6_rtr.c

Log Message:
Pull up following revision(s) (requested by kim in ticket #834):

sys/netinet6/nd6_rtr.c: revision 1.148

Fix default route selection

The primary issue was that in revision 1.79 a check was added in the
nd6_defrouter_select() search loop to ignore the entry if RA processing
is enabled on its interface.  In practice this results in all entries
being ignored.

This fix reverses the condition, so that an entry is ignored when RA
processing is NOT enabled on its interface.  Further, the entry is
only ignored for being selected as the default router.  The currently
installed router must be identified regardless of the (current) status
of its interface, so that we can delete the route before installing a
new one.

I also added error logging when adding or deleting a route fails. This
should help the administrator (or kernel developer) in noticing possible
problems.

Finally, if deleting a route fails, the corresponding default route
entry no longer has its "installed" flag cleared, so that deletion will
be retried.  At a minimum, this will cause repeated messages about the
failed deletion as opposed to only getting repeated messages about the
installation of a new default route failing.

Fixes PR kern/55091 and also PR bin/54997 as far as the behaviour
observed with ndp(8).


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.145.2.1 src/sys/netinet6/nd6_rtr.c

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

Modified files:

Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.145 src/sys/netinet6/nd6_rtr.c:1.145.2.1
--- src/sys/netinet6/nd6_rtr.c:1.145	Mon Apr 29 11:57:22 2019
+++ src/sys/netinet6/nd6_rtr.c	Tue Apr 14 17:26:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_rtr.c,v 1.145 2019/04/29 11:57:22 roy Exp $	*/
+/*	$NetBSD: nd6_rtr.c,v 1.145.2.1 2020/04/14 17:26:22 martin Exp $	*/
 /*	$KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.145 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.145.2.1 2020/04/14 17:26:22 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -487,6 +487,11 @@ defrouter_addreq(struct nd_defrouter *ne
 	if (error == 0) {
 		nd6_numroutes++;
 		newdr->installed = 1;
+	} else {
+		char ip6buf[INET6_ADDRSTRLEN];
+		log(LOG_ERR, "defrouter_addreq: "
+		"error %d adding default router %s on %s\n",
+		error, IN6_PRINT(ip6buf, >rtaddr), newdr->ifp->if_xname);
 	}
 #ifndef NET_MPSAFE
 	splx(s);
@@ -596,10 +601,15 @@ defrouter_delreq(struct nd_defrouter *dr
 
 	error = rtrequest_newmsg(RTM_DELETE, , , ,
 	RTF_GATEWAY);
-	if (error == 0)
+	if (error == 0) {
 		nd6_numroutes--;
-
-	dr->installed = 0;
+		dr->installed = 0;
+	} else {
+		char ip6buf[INET6_ADDRSTRLEN];
+		log(LOG_ERR, "defrouter_delreq: "
+		"error %d deleting default router %s on %s\n",
+		error, IN6_PRINT(ip6buf, >rtaddr), dr->ifp->if_xname);
+	}
 }
 
 /*
@@ -675,14 +685,6 @@ nd6_defrouter_select(void)
 	 * the ordering rule of the list described in defrtrlist_update().
 	 */
 	ND_DEFROUTER_LIST_FOREACH(dr) {
-		ndi = ND_IFINFO(dr->ifp);
-		if (nd6_accepts_rtadv(ndi))
-			continue;
-
-		if (selected_dr == NULL &&
-		nd6_is_llinfo_probreach(dr))
-			selected_dr = dr;
-
 		if (dr->installed && !installed_dr)
 			installed_dr = dr;
 		else if (dr->installed && installed_dr) {
@@ -690,6 +692,14 @@ nd6_defrouter_select(void)
 			log(LOG_ERR, "nd6_defrouter_select: more than one router"
 			" is installed\n");
 		}
+
+		ndi = ND_IFINFO(dr->ifp);
+		if (!nd6_accepts_rtadv(ndi))
+			continue;
+
+		if (selected_dr == NULL &&
+		nd6_is_llinfo_probreach(dr))
+			selected_dr = dr;
 	}
 	/*
 	 * If none of the default routers was found to be reachable,



CVS commit: [netbsd-9] src

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:15:02 UTC 2020

Modified Files:
src/sys/arch/x86/include [netbsd-9]: specialreg.h
src/sys/arch/x86/x86 [netbsd-9]: procfs_machdep.c tsc.c
src/usr.sbin/cpuctl/arch [netbsd-9]: i386.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #833):

usr.sbin/cpuctl/arch/i386.c: revision 1.109
sys/arch/x86/include/specialreg.h: revision 1.159
usr.sbin/cpuctl/arch/i386.c: revision 1.110
sys/arch/x86/include/specialreg.h: revision 1.160
sys/arch/x86/include/specialreg.h: revision 1.161
sys/arch/x86/x86/tsc.c: revision 1.40
sys/arch/x86/x86/procfs_machdep.c: revision 1.35
sys/arch/x86/x86/procfs_machdep.c: revision 1.36

  Add Fast Short Rep Mov(fsrm).

Add AVX512_VP2INTERSECT, SERIALIZE and TSXLDTRK(TSX suspend load addr tracking)

  CPUID Fn0001 %edx bit 8 is printed as "TSC", so rename CPUID Fn8000_0007
%edx bit 8 from "TSC" to "ITSC" (Invariant TSC) to avoid confusion.

  Rename CPUID_APM_TSC to CPUID_APM_ITSC. No functional change.

  Remove ci_max_ext_cpuid because it's the same as ci_cpuid_extlevel.

  Print CPUID 0x8007 %edx on both Intel and AMD.


To generate a diff of this commit:
cvs rdiff -u -r1.150.2.5 -r1.150.2.6 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.33.2.1 -r1.33.2.2 src/sys/arch/x86/x86/procfs_machdep.c
cvs rdiff -u -r1.37 -r1.37.8.1 src/sys/arch/x86/x86/tsc.c
cvs rdiff -u -r1.104.2.4 -r1.104.2.5 src/usr.sbin/cpuctl/arch/i386.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/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.150.2.5 src/sys/arch/x86/include/specialreg.h:1.150.2.6
--- src/sys/arch/x86/include/specialreg.h:1.150.2.5	Tue Nov 19 13:15:57 2019
+++ src/sys/arch/x86/include/specialreg.h	Tue Apr 14 17:15:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.150.2.5 2019/11/19 13:15:57 martin Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.150.2.6 2020/04/14 17:15:02 martin Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -475,9 +475,12 @@
 #define CPUID_SEF_AVX512_4VNNIW	__BIT(2)
 #define CPUID_SEF_AVX512_4FMAPS	__BIT(3)
 #define CPUID_SEF_FSREP_MOV	__BIT(4)  /* Fast Short REP MOV */
+#define CPUID_SEF_AVX512_VP2INTERSECT __BIT(8)
 #define CPUID_SEF_MD_CLEAR	__BIT(10)
 #define CPUID_SEF_TSX_FORCE_ABORT __BIT(13) /* MSR_TSX_FORCE_ABORT bit 0 */
+#define CPUID_SEF_SERIALIZE	__BIT(14)
 #define CPUID_SEF_HYBRID	__BIT(15) /* Hybrid part */
+#define CPUID_SEF_TSXLDTRK	__BIT(16) /* TSX suspend load addr tracking */
 #define CPUID_SEF_CET_IBT	__BIT(20) /* CET Indirect Branch Tracking */
 #define CPUID_SEF_IBRS		__BIT(26) /* IBRS / IBPB Speculation Control */
 #define CPUID_SEF_STIBP		__BIT(27) /* STIBP Speculation Control */
@@ -489,8 +492,9 @@
 #define CPUID_SEF_FLAGS2	"\20" \
 "\3" "AVX512_4VNNIW" "\4" "AVX512_4FMAPS" \
 	"\5" "FSREP_MOV"		\
-"\13" "MD_CLEAR"			\
-			"\16" "TSX_FORCE_ABORT"		"\20" "HYBRID"	\
+	"\11" "VP2INTERSECT"	"\13" "MD_CLEAR"			\
+			"\16TSX_FORCE_ABORT" "\17SERIALIZE" "\20HYBRID"	\
+	"\21" "TSXLDTRK"		\
 	"\25" "CET_IBT"			\
 	"\33" "IBRS"	"\34" "STIBP"	\
 	"\35" "L1D_FLUSH" "\36" "ARCH_CAP" "\37CORE_CAP"	"\40" "SSBD"
@@ -693,8 +697,10 @@
 	"\35" "L2IPERFC" "\36" "MWAITX"	"\37" "B30"	"\40" "B31"
 
 /*
- * AMD Advanced Power Management
+ * Advanced Power Management
  * CPUID Fn8000_0007 %edx
+ *
+ * Only ITSC is for both Intel and AMD. Others are only for AMD.
  */
 #define CPUID_APM_TS	0x0001	/* Temperature Sensor */
 #define CPUID_APM_FID	0x0002	/* Frequency ID control */
@@ -704,7 +710,7 @@
 #define CPUID_APM_STC	0x0020	/* Software thermal control (STC) */
 #define CPUID_APM_100	0x0040	/* 100MHz multiplier control */
 #define CPUID_APM_HWP	0x0080	/* HW P-State control */
-#define CPUID_APM_TSC	0x0100	/* TSC invariant */
+#define CPUID_APM_ITSC	0x0100	/* invariant TSC */
 #define CPUID_APM_CPB	0x0200	/* Core performance boost */
 #define CPUID_APM_EFF	0x0400	/* Effective Frequency (read-only) */
 #define CPUID_APM_PROCFI 0x0800	/* Proc Feedback Interface */
@@ -715,7 +721,7 @@
 #define CPUID_APM_FLAGS		"\20"	  \
 	"\1" "TS"	"\2" "FID"	"\3" "VID"	"\4" "TTP"	  \
 	"\5" "HTC"	"\6" "STC"	"\7" "100"	"\10" "HWP"	  \
-	"\11" "TSC"	"\12" "CPB"	"\13" "EffFreq"	"\14" "PROCFI"	  \
+	"\11" "ITSC"	"\12" "CPB"	"\13" "EffFreq"	"\14" "PROCFI"	  \
 	"\15" "PROCPR"	"\16" "CONNSTBY" "\17" "RAPL"
 
 /*

Index: src/sys/arch/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.1 src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.2
--- src/sys/arch/x86/x86/procfs_machdep.c:1.33.2.1	Thu Oct 17 18:56:25 2019
+++ src/sys/arch/x86/x86/procfs_machdep.c	Tue Apr 14 17:15:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.33.2.1 2019/10/17 18:56:25 

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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 17:02:28 UTC 2020

Modified Files:
src/sys/dev/ic [netbsd-9]: spdmem.c spdmemvar.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #832):

sys/dev/ic/spdmemvar.h: revision 1.15
sys/dev/ic/spdmemvar.h: revision 1.16
sys/dev/ic/spdmem.c: revision 1.32
sys/dev/ic/spdmem.c: revision 1.33
sys/dev/ic/spdmem.c: revision 1.34
sys/dev/ic/spdmem.c: revision 1.35

  Print DDR3's row and column correctly.

KNF. No functional change.

- Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
   makes PC3- value more correctly on newer DDR3.

Calculate DDR3's tRAS correctly.

  Fix unused area size found by pgoyette@.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.4.1 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.14 -r1.14.4.1 src/sys/dev/ic/spdmemvar.h

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

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.31 src/sys/dev/ic/spdmem.c:1.31.4.1
--- src/sys/dev/ic/spdmem.c:1.31	Sun Apr  7 01:39:12 2019
+++ src/sys/dev/ic/spdmem.c	Tue Apr 14 17:02:28 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.31 2019/04/07 01:39:12 pgoyette Exp $ */
+/* $NetBSD: spdmem.c,v 1.31.4.1 2020/04/14 17:02:28 martin Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.31 2019/04/07 01:39:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.31.4.1 2020/04/14 17:02:28 martin Exp $");
 
 #include 
 #include 
@@ -340,12 +340,12 @@ spdmem_common_attach(struct spdmem_softc
 	device_xname(self), NULL, NULL, 0, NULL, 0,
 	CTL_HW, CTL_CREATE, CTL_EOL);
 	if (node != NULL && spd_len != 0)
-sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
-0,
-CTLTYPE_STRUCT, "spd_data",
+		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
+		0,
+		CTLTYPE_STRUCT, "spd_data",
 		SYSCTL_DESCR("raw spd data"), NULL,
-0, s, spd_len,
-CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
+		0, s, spd_len,
+		CTL_HW, node->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	/*
 	 * Decode and print key SPD contents
@@ -411,7 +411,7 @@ spdmem_common_attach(struct spdmem_softc
 			strlcat(sc->sc_type, " NVDIMM hybrid",
 			SPDMEM_TYPE_MAXLEN);
 	}
-	
+
 	if (node != NULL)
 		sysctl_createv(>sc_sysctl_log, 0, NULL, NULL,
 		0,
@@ -615,7 +615,7 @@ decode_sdram(const struct sysctlnode *no
 		freq = 0;
 	switch (freq) {
 		/*
-		 * Must check cycle time since some PC-133 DIMMs 
+		 * Must check cycle time since some PC-133 DIMMs
 		 * actually report PC-100
 		 */
 	case 100:
@@ -756,6 +756,30 @@ print_part(const char *part, size_t pnsi
 	aprint_normal(": %.*s\n", (int)(p - part), part);
 }
 
+static u_int
+ddr3_value_pico(struct spdmem *s, uint8_t txx_mtb, uint8_t txx_ftb)
+{
+	u_int mtb, ftb; /* in picoseconds */
+	intmax_t signed_txx_ftb;
+	u_int val;
+
+	mtb = (u_int)s->sm_ddr3.ddr3_mtb_dividend * 1000 /
+	s->sm_ddr3.ddr3_mtb_divisor;
+	ftb = (u_int)s->sm_ddr3.ddr3_ftb_dividend * 1000 /
+	s->sm_ddr3.ddr3_ftb_divisor;
+
+	/* tXX_ftb is signed value */
+	signed_txx_ftb = (int8_t)txx_ftb;
+	val = txx_mtb * mtb +
+	((txx_ftb > 127) ? signed_txx_ftb : txx_ftb) * ftb / 1000;
+
+	return val;
+}
+
+#define __DDR3_VALUE_PICO(s, field)\
+	ddr3_value_pico(s, s->sm_ddr3.ddr3_##field##_mtb,	\
+	s->sm_ddr3.ddr3_##field##_ftb)
+
 static void
 decode_ddr3(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
@@ -786,10 +810,7 @@ decode_ddr3(const struct sysctlnode *nod
 		(s->sm_ddr3.ddr3_chipwidth + 2);
 	dimm_size = (1 << dimm_size) * (s->sm_ddr3.ddr3_physbanks + 1);
 
-	cycle_time = (1000 * s->sm_ddr3.ddr3_mtb_dividend + 
-			(s->sm_ddr3.ddr3_mtb_divisor / 2)) /
-		 s->sm_ddr3.ddr3_mtb_divisor;
-	cycle_time *= s->sm_ddr3.ddr3_tCKmin;
+	cycle_time = __DDR3_VALUE_PICO(s, tCKmin);
 	bits = 1 << (s->sm_ddr3.ddr3_datawidth + 3);
 	decode_size_speed(self, node, dimm_size, cycle_time, 2, bits, FALSE,
 			  "PC3", 0);
@@ -797,17 +818,21 @@ decode_ddr3(const struct sysctlnode *nod
 	aprint_verbose_dev(self,
 	"%d rows, %d cols, %d log. banks, %d phys. banks, "
 	"%d.%03dns cycle time\n",
-	s->sm_ddr3.ddr3_rows + 9, s->sm_ddr3.ddr3_cols + 12,
+	s->sm_ddr3.ddr3_rows + 12, s->sm_ddr3.ddr3_cols + 9,
 	1 << (s->sm_ddr3.ddr3_logbanks + 3),
 	s->sm_ddr3.ddr3_physbanks + 1,
 	cycle_time/1000, cycle_time % 1000);
 
-#define	__DDR3_CYCLES(field) (s->sm_ddr3.field / s->sm_ddr3.ddr3_tCKmin)
+#define	__DDR3_CYCLES(val)		\
+	((val / cycle_time) + ((val % cycle_time) ? 1 : 0))
 
-	aprint_verbose_dev(self, LATENCY, __DDR3_CYCLES(ddr3_tAAmin),
-		__DDR3_CYCLES(ddr3_tRCDmin), 

CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Apr 14 16:53:57 UTC 2020

Modified Files:
src/sys/arch/x86/x86 [bouyer-xenpvh]: patch.c
src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen

Log Message:
Always patch spllower with cx8_spllower; it works fine for Xen now
Include x86/x86/patch.c is !xenpv
While there, defopt XENPV


To generate a diff of this commit:
cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/arch/x86/x86/patch.c
cvs rdiff -u -r1.180.2.1 -r1.180.2.2 src/sys/arch/xen/conf/files.xen

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/patch.c
diff -u src/sys/arch/x86/x86/patch.c:1.37.6.1 src/sys/arch/x86/x86/patch.c:1.37.6.2
--- src/sys/arch/x86/x86/patch.c:1.37.6.1	Fri Apr 10 14:37:54 2020
+++ src/sys/arch/x86/x86/patch.c	Tue Apr 14 16:53:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $	*/
+/*	$NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.1 2020/04/10 14:37:54 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: patch.c,v 1.37.6.2 2020/04/14 16:53:57 bouyer Exp $");
 
 #include "opt_lockdebug.h"
 #ifdef i386
@@ -250,8 +250,7 @@ x86_patch(bool early)
 #endif	/* i386 */
 
 #if !defined(SPLDEBUG)
-	if (!early && (cpu_feature[0] & CPUID_CX8) != 0 &&
-	!vm_guest_is_xenpv()) {
+	if (!early && (cpu_feature[0] & CPUID_CX8) != 0) {
 		/* Faster splx(), mutex_spin_exit(). */
 		patchfunc(
 		cx8_spllower, cx8_spllower_end,

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.180.2.1 src/sys/arch/xen/conf/files.xen:1.180.2.2
--- src/sys/arch/xen/conf/files.xen:1.180.2.1	Sat Apr 11 18:26:07 2020
+++ src/sys/arch/xen/conf/files.xen	Tue Apr 14 16:53:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.180.2.1 2020/04/11 18:26:07 bouyer Exp $
+#	$NetBSD: files.xen,v 1.180.2.2 2020/04/14 16:53:57 bouyer Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -150,6 +150,7 @@ file	arch/x86/x86/idt.c		machdep
 file	arch/x86/x86/intr.c		machdep & xenpvhvm
 file	arch/x86/x86/x86_softintr.c	machdep
 file	arch/x86/x86/ipi.c		xenpvhvm
+file 	arch/x86/x86/patch.c		machdep & ! xenpv
 file	arch/x86/x86/pmap.c		machdep
 file	arch/x86/x86/x86_tlb.c		machdep
 file	arch/x86/x86/procfs_machdep.c	procfs
@@ -390,7 +391,7 @@ endif
 include	"dev/pcmcia/files.pcmcia"
 
 # Domain-0 operations
-defflag	opt_xen.h			DOM0OPS
+defflag	opt_xen.h			DOM0OPS XENPV
 file	arch/xen/xen/privcmd.c		dom0ops
 file 	arch/xen/x86/xen_shm_machdep.c	dom0ops
 file	arch/x86/pci/pci_machdep.c	(xenpvhvm | hypervisor) & pci & ( dom0ops | xenpvhvm )



CVS commit: [bouyer-xenpvh] src/sys/arch/xen/x86

2020-04-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Apr 14 16:52:36 UTC 2020

Modified Files:
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c

Log Message:
Remove spllower alias, xen_spllower is gone


To generate a diff of this commit:
cvs rdiff -u -r1.21.2.3 -r1.21.2.4 src/sys/arch/xen/x86/xen_intr.c

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

Modified files:

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.21.2.3 src/sys/arch/xen/x86/xen_intr.c:1.21.2.4
--- src/sys/arch/xen/x86/xen_intr.c:1.21.2.3	Sun Apr 12 19:53:37 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Tue Apr 14 16:52:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.3 2020/04/12 19:53:37 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21.2.4 2020/04/14 16:52:35 bouyer Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -495,7 +495,6 @@ xen_intr_create_intrid(int legacy_irq, s
 }
 
 #if !defined(XENPVHVM)
-__strong_alias(spllower, xen_spllower);
 __strong_alias(x86_read_psl, xen_read_psl);
 __strong_alias(x86_write_psl, xen_write_psl);
 



CVS commit: [bouyer-xenpvh] src/common/lib/libc/arch/i386/atomic

2020-04-14 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Apr 14 16:51:13 UTC 2020

Modified Files:
src/common/lib/libc/arch/i386/atomic [bouyer-xenpvh]: atomic.S

Log Message:
Force _atomic_cas_cx8 only for XENPV; x86_patch works fine for (PV)HVM


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.23.8.1 src/common/lib/libc/arch/i386/atomic/atomic.S

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

Modified files:

Index: src/common/lib/libc/arch/i386/atomic/atomic.S
diff -u src/common/lib/libc/arch/i386/atomic/atomic.S:1.23 src/common/lib/libc/arch/i386/atomic/atomic.S:1.23.8.1
--- src/common/lib/libc/arch/i386/atomic/atomic.S:1.23	Wed Jul 18 13:39:36 2018
+++ src/common/lib/libc/arch/i386/atomic/atomic.S	Tue Apr 14 16:51:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.S,v 1.23 2018/07/18 13:39:36 bouyer Exp $	*/
+/*	$NetBSD: atomic.S,v 1.23.8.1 2020/04/14 16:51:13 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -197,7 +197,7 @@ END(_membar_sync)
 ENDLABEL(membar_sync_end)
 
 #if defined(__HAVE_ATOMIC64_OPS) || defined(_KERNEL)
-#ifdef XEN
+#ifdef XENPV
 STRONG_ALIAS(_atomic_cas_64,_atomic_cas_cx8)
 #else
 ENTRY(_atomic_cas_64)



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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 16:44:10 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-9]: miidevs.h miidevs_data.h

Log Message:
Regen for ticket #831


To generate a diff of this commit:
cvs rdiff -u -r1.151.2.6 -r1.151.2.7 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.139.2.6 -r1.139.2.7 src/sys/dev/mii/miidevs_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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.151.2.6 src/sys/dev/mii/miidevs.h:1.151.2.7
--- src/sys/dev/mii/miidevs.h:1.151.2.6	Thu Mar 19 19:23:14 2020
+++ src/sys/dev/mii/miidevs.h	Tue Apr 14 16:44:10 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.151.2.6 2020/03/19 19:23:14 martin Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.151.2.7 2020/04/14 16:44:10 martin Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.153.2.5 2020/03/19 19:21:37 martin Exp
+ *	NetBSD: miidevs,v 1.153.2.6 2020/04/14 16:43:12 martin Exp
  */
 
 /*-
@@ -60,10 +60,12 @@
 #define	MII_OUI_TRIDIUM	0x0001f0	/* Tridium */
 #define	MII_OUI_DATATRACK	0x0002c6	/* Data Track Technology */
 #define	MII_OUI_AGERE	0x00053d	/* Agere */
+#define	MII_OUI_QUAKE	0x000897	/* Quake Technologies */
 #define	MII_OUI_BANKSPEED	0x0006b8	/* Bankspeed Pty */
 #define	MII_OUI_NETEXCELL	0x0008bb	/* NetExcell */
 #define	MII_OUI_NETAS	0x0009c3	/* Netas */
 #define	MII_OUI_BROADCOM2	0x000af7	/* Broadcom Corporation */
+#define	MII_OUI_AELUROS	0x000b25	/* Aeluros */
 #define	MII_OUI_RALINK	0x000c43	/* Ralink Technology */
 #define	MII_OUI_ASIX	0x000ec6	/* ASIX */
 #define	MII_OUI_BROADCOM	0x001018	/* Broadcom Corporation */
@@ -76,7 +78,6 @@
 #define	MII_OUI_AQUANTIA	0x0017b6	/* Aquantia Corporation */
 #define	MII_OUI_BROADCOM3	0x001be9	/* Broadcom Corporation */
 #define	MII_OUI_LEVEL1	0x00207b	/* Level 1 */
-#define	MII_OUI_VIA	0x004063	/* VIA Technologies */
 #define	MII_OUI_MARVELL	0x005043	/* Marvell Semiconductor */
 #define	MII_OUI_QUALSEMI	0x006051	/* Quality Semiconductor */
 #define	MII_OUI_AMLOGIC	0x006051	/* Amlogic */
@@ -88,7 +89,6 @@
 #define	MII_OUI_TSC	0x00c039	/* TDK Semiconductor */
 #define	MII_OUI_MYSON	0x00c0b4	/* Myson Technology */
 #define	MII_OUI_ATTANSIC	0x00c82e	/* Attansic Technology */
-#define	MII_OUI_RDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_JMICRON	0x00d831	/* JMicron */
 #define	MII_OUI_PMCSIERRA	0x00e004	/* PMC-Sierra */
 #define	MII_OUI_SIS	0x00e006	/* Silicon Integrated Systems */
@@ -103,6 +103,7 @@
 /* Unregistered or wrong OUI */
 #define	MII_OUI_yyREALTEK	0x04	/* Realtek */
 #define	MII_OUI_yyAMD	0x58	/* Advanced Micro Devices */
+#define	MII_OUI_xxVIA	0x0002c6	/* VIA Technologies */
 #define	MII_OUI_xxMYSON	0x00032d	/* Myson Technology */
 #define	MII_OUI_xxTSC	0x00039c	/* TDK Semiconductor */
 #define	MII_OUI_xxASIX	0x000674	/* Asix Semiconductor */
@@ -121,6 +122,7 @@
 #define	MII_OUI_xxVITESSE	0x008083	/* Vitesse Semiconductor */
 #define	MII_OUI_xxPMCSIERRA2	0x009057	/* PMC-Sierra */
 #define	MII_OUI_xxCICADA	0x00c08f	/* Cicada Semiconductor */
+#define	MII_OUI_xxRDC	0x00d02d	/* RDC Semiconductor */
 #define	MII_OUI_xxNATSEMI	0x1000e8	/* National Semiconductor */
 #define	MII_OUI_xxLEVEL1	0x782000	/* Level 1 */
 #define	MII_OUI_xxXAQTI	0xace000	/* XaQti Corp. */
@@ -295,6 +297,8 @@
 #define	MII_STR_BROADCOM3_BCM53125	"BCM53125 1000BASE-T switch"
 #define	MII_MODEL_BROADCOM3_BCM5720C	0x0036
 #define	MII_STR_BROADCOM3_BCM5720C	"BCM5720C 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM4_BCM54213PE	0x000a
+#define	MII_STR_BROADCOM4_BCM54213PE	"BCM54213PE 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM4_BCM5725C	0x0038
 #define	MII_STR_BROADCOM4_BCM5725C	"BCM5725C 1000BASE-T media interface"
 #define	MII_MODEL_xxBROADCOM_ALT1_BCM5906	0x0004
@@ -548,8 +552,12 @@
 #define	MII_STR_xxQUALSEMI_QS6612	"QS6612 10/100 media interface"
 
 /* RDC Semiconductor PHYs */
-#define	MII_MODEL_RDC_R6040	0x0003
-#define	MII_STR_RDC_R6040	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040	0x0003
+#define	MII_STR_xxRDC_R6040	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_2	0x0005
+#define	MII_STR_xxRDC_R6040_2	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_3	0x0006
+#define	MII_STR_xxRDC_R6040_3	"R6040 10/100 media interface"
 
 /* RealTek PHYs */
 #define	MII_MODEL_xxREALTEK_RTL8169S	0x0011
@@ -593,6 +601,10 @@
 #define	MII_MODEL_SMSC_LAN8742	0x0013
 #define	MII_STR_SMSC_LAN8742	"SMSC LAN8742 10/100 media interface"
 
+/* Teranetics PHY */
+#define	MII_MODEL_TERANETICS_TN1010	0x0001
+#define	MII_STR_TERANETICS_TN1010	"Teranetics TN1010 10GBase-T PHY"
+
 /* Texas Instruments PHYs */
 #define	MII_MODEL_TI_TLAN10T	0x0001
 #define	MII_STR_TI_TLAN10T	"ThunderLAN 10BASE-T media interface"
@@ -608,10 +620,10 @@
 #define	MII_STR_xxTSC_78Q2121	"78Q2121 100BASE-TX media interface"
 
 /* VIA 

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

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 16:43:12 UTC 2020

Modified Files:
src/sys/dev/mii [netbsd-9]: brgphy.c miidevs rdcphy.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #831):

sys/dev/mii/rdcphy.c: revision 1.6
sys/dev/mii/rdcphy.c: revision 1.8
sys/dev/mii/miidevs: revision 1.162
sys/dev/mii/miidevs: revision 1.163
sys/dev/mii/miidevs: revision 1.164
sys/dev/mii/miidevs: revision 1.165
sys/dev/mii/miidevs: revision 1.167
sys/dev/mii/brgphy.c: revision 1.87

  Change the OUI macro name of RDC to xxRDC. 0x00d02d is non-bitreverse value
of official 0x000bb4. From Andrius V.
RDC -> xxRDC. No functional change.

Add BCM54213PE

Match BCM54213PE

  Use xxVIA instead of VIA.
0x004063 is VIA's official OUI but VT6103 use 0x0002c6.
0x0002c6 is non-bitreversed value of 0x004063. Reported by Andrius V.

- Add Quake Technologies and Aeluros' OUI
- Add Teranetics TN1010 10GBase-T PHY
  Add two new RDC PHYs from Andrius V.
  Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.84.4.1 src/sys/dev/mii/brgphy.c
cvs rdiff -u -r1.153.2.5 -r1.153.2.6 src/sys/dev/mii/miidevs
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/dev/mii/rdcphy.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/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.84 src/sys/dev/mii/brgphy.c:1.84.4.1
--- src/sys/dev/mii/brgphy.c:1.84	Thu Apr 11 08:50:20 2019
+++ src/sys/dev/mii/brgphy.c	Tue Apr 14 16:43:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.84 2019/04/11 08:50:20 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.84.4.1 2020/04/14 16:43:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.84 2019/04/11 08:50:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.84.4.1 2020/04/14 16:43:12 martin Exp $");
 
 #include 
 #include 
@@ -178,6 +178,7 @@ static const struct mii_phydesc brgphys[
 	MII_PHY_DESC(BROADCOM3, BCM5720C),
 	MII_PHY_DESC(BROADCOM3, BCM57765),
 	MII_PHY_DESC(BROADCOM3, BCM57780),
+	MII_PHY_DESC(BROADCOM4, BCM54213PE),
 	MII_PHY_DESC(BROADCOM4, BCM5725C),
 	MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906),
 	MII_PHY_END,

Index: src/sys/dev/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.153.2.5 src/sys/dev/mii/miidevs:1.153.2.6
--- src/sys/dev/mii/miidevs:1.153.2.5	Thu Mar 19 19:21:37 2020
+++ src/sys/dev/mii/miidevs	Tue Apr 14 16:43:12 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.153.2.5 2020/03/19 19:21:37 martin Exp $
+$NetBSD: miidevs,v 1.153.2.6 2020/04/14 16:43:12 martin Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -53,10 +53,12 @@ oui AMD0x1a	Advanced Micro Devic
 oui TRIDIUM			0x0001f0	Tridium
 oui DATATRACK			0x0002c6	Data Track Technology
 oui AGERE			0x00053d	Agere
+oui QUAKE			0x000897	Quake Technologies
 oui BANKSPEED			0x0006b8	Bankspeed Pty
 oui NETEXCELL			0x0008bb	NetExcell
 oui NETAS			0x0009c3	Netas
 oui BROADCOM2			0x000af7	Broadcom Corporation
+oui AELUROS			0x000b25	Aeluros
 oui RALINK			0x000c43	Ralink Technology
 oui ASIX			0x000ec6	ASIX
 oui BROADCOM			0x001018	Broadcom Corporation
@@ -69,7 +71,6 @@ oui RALINK2			0x0017a5	Ralink Technology
 oui AQUANTIA			0x0017b6	Aquantia Corporation
 oui BROADCOM3			0x001be9	Broadcom Corporation
 oui LEVEL1			0x00207b	Level 1
-oui VIA0x004063	VIA Technologies
 oui MARVELL			0x005043	Marvell Semiconductor
 oui QUALSEMI			0x006051	Quality Semiconductor
 oui AMLOGIC			0x006051	Amlogic
@@ -81,7 +82,6 @@ oui INTEL			0x00aa00	Intel
 oui TSC0x00c039	TDK Semiconductor
 oui MYSON			0x00c0b4	Myson Technology
 oui ATTANSIC			0x00c82e	Attansic Technology
-oui RDC0x00d02d	RDC Semiconductor
 oui JMICRON			0x00d831	JMicron
 oui PMCSIERRA			0x00e004	PMC-Sierra
 oui SIS0x00e006	Silicon Integrated Systems
@@ -96,6 +96,7 @@ oui RENESAS			0x749050	Renesas
 /* Unregistered or wrong OUI */
 oui yyREALTEK			0x04	Realtek
 oui yyAMD			0x58	Advanced Micro Devices
+oui xxVIA			0x0002c6	VIA Technologies
 oui xxMYSON			0x00032d	Myson Technology
 oui xxTSC			0x00039c	TDK Semiconductor
 oui xxASIX			0x000674	Asix Semiconductor
@@ -114,6 +115,7 @@ oui yyASIX			0x007063	Asix Semiconductor
 oui xxVITESSE			0x008083	Vitesse Semiconductor
 oui xxPMCSIERRA2		0x009057	PMC-Sierra
 oui xxCICADA			0x00c08f	Cicada Semiconductor
+oui xxRDC			0x00d02d	RDC Semiconductor
 oui xxNATSEMI			0x1000e8	National Semiconductor
 oui xxLEVEL1			0x782000	Level 1
 oui xxXAQTI			0xace000	XaQti Corp.
@@ -214,6 +216,7 @@ model BROADCOM3 BCM5719C	0x0022 BCM5719C
 model BROADCOM3 BCM57765	0x0024 BCM57765 1000BASE-T media interface
 model BROADCOM3 BCM53125	0x0032 BCM53125 1000BASE-T switch
 model BROADCOM3 BCM5720C	0x0036 BCM5720C 1000BASE-T media interface
+model BROADCOM4 BCM54213PE	0x000a 

CVS commit: [netbsd-8] src

2020-04-14 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr 14 15:50:28 UTC 2020

Modified Files:
src/external/gpl2/groff/tmac [netbsd-8]: mdoc.local
src/sys/sys [netbsd-8]: param.h
Added Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Welcome to 8.2_STABLE


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/doc/CHANGES-8.3
cvs rdiff -u -r1.2.4.6 -r1.2.4.7 src/external/gpl2/groff/tmac/mdoc.local
cvs rdiff -u -r1.542.2.9 -r1.542.2.10 src/sys/sys/param.h

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

Modified files:

Index: src/external/gpl2/groff/tmac/mdoc.local
diff -u src/external/gpl2/groff/tmac/mdoc.local:1.2.4.6 src/external/gpl2/groff/tmac/mdoc.local:1.2.4.7
--- src/external/gpl2/groff/tmac/mdoc.local:1.2.4.6	Tue Mar 31 05:08:39 2020
+++ src/external/gpl2/groff/tmac/mdoc.local	Tue Apr 14 15:50:27 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.2.4.6 2020/03/31 05:08:39 martin Exp $
+.\" $NetBSD: mdoc.local,v 1.2.4.7 2020/04/14 15:50:27 martin Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~8.2
+.ds doc-operating-system NetBSD\~8.2_STABLE
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~8.2
+.ds doc-default-operating-system NetBSD\~8.2_STABLE
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.542.2.9 src/sys/sys/param.h:1.542.2.10
--- src/sys/sys/param.h:1.542.2.9	Tue Mar 31 05:08:39 2020
+++ src/sys/sys/param.h	Tue Apr 14 15:50:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.542.2.9 2020/03/31 05:08:39 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.542.2.10 2020/04/14 15:50:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	80200	/* NetBSD 8.2 */
+#define	__NetBSD_Version__	80200	/* NetBSD 8.2_STABLE */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)

Added files:

Index: src/doc/CHANGES-8.3
diff -u /dev/null src/doc/CHANGES-8.3:1.1.2.1
--- /dev/null	Tue Apr 14 15:50:28 2020
+++ src/doc/CHANGES-8.3	Tue Apr 14 15:50:28 2020
@@ -0,0 +1,11 @@
+# $NetBSD: CHANGES-8.3,v 1.1.2.1 2020/04/14 15:50:28 martin Exp $
+
+A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
+release:
+
+external/gpl2/groff/tmac/mdoc.local		patched by hand
+sys/sys/param.h	patched by hand
+
+	Welcome to 8.2_STABLE.
+	[snj]
+



CVS commit: src/sys/dev/onewire

2020-04-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Apr 14 15:36:02 UTC 2020

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

Log Message:
Only include opt_xxx.h headers when _KERNEL_OPT is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/onewire/onewire.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/onewire.c
diff -u src/sys/dev/onewire/onewire.c:1.19 src/sys/dev/onewire/onewire.c:1.20
--- src/sys/dev/onewire/onewire.c:1.19	Tue Apr 14 13:36:51 2020
+++ src/sys/dev/onewire/onewire.c	Tue Apr 14 15:36:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: onewire.c,v 1.19 2020/04/14 13:36:51 macallan Exp $	*/
+/*	$NetBSD: onewire.c,v 1.20 2020/04/14 15:36:02 kre Exp $	*/
 /*	$OpenBSD: onewire.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*-
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.19 2020/04/14 13:36:51 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.20 2020/04/14 15:36:02 kre Exp $");
 
 /*
  * 1-Wire bus driver.
@@ -64,7 +64,9 @@ __KERNEL_RCSID(0, "$NetBSD: onewire.c,v 
 #include 
 #include 
 
+#ifdef _KERNEL_OPT
 #include "opt_onewire.h"
+#endif
 
 #include 
 #include 



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 15:16:07 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
fix KASSERT() in xbd_map_align()


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.112 src/sys/arch/xen/xen/xbd_xenbus.c:1.113
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.112	Tue Apr 14 14:06:24 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 15:16:06 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.112 2020/04/14 14:06:24 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.113 2020/04/14 15:16:06 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.112 2020/04/14 14:06:24 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.113 2020/04/14 15:16:06 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -1132,7 +1132,7 @@ xbd_map_align(struct xbd_xenbus_softc *s
 	}
 	sc->sc_unalign_free = false;
 
-	KASSERT(req->req_bp->b_bcount < MAXPHYS);
+	KASSERT(req->req_bp->b_bcount <= MAXPHYS);
 	req->req_data = (void *)sc->sc_unalign_buffer;
 	if ((req->req_bp->b_flags & B_READ) == 0)
 		memcpy(req->req_data, req->req_bp->b_data,



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 14:06:24 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
rearrange slightly to do proper b_resid accounting, to prepare for partial
transfers


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.111 src/sys/arch/xen/xen/xbd_xenbus.c:1.112
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.111	Tue Apr 14 13:10:43 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 14:06:24 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.111 2020/04/14 13:10:43 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.112 2020/04/14 14:06:24 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.111 2020/04/14 13:10:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.112 2020/04/14 14:06:24 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -745,6 +745,23 @@ again:
 			continue;
 		}
 
+		bp = xbdreq->req_bp;
+		KASSERT(bp != NULL && bp->b_data != NULL);
+		DPRINTF(("%s(%p): b_bcount = %ld\n", __func__,
+		bp, (long)bp->b_bcount));
+
+		if (rep->status != BLKIF_RSP_OKAY) {
+			bp->b_error = EIO;
+			bp->b_resid = bp->b_bcount;
+		} else {
+			KASSERTMSG(xbdreq->req_dmamap->dm_mapsize <=
+			bp->b_resid, "mapsize %d > b_resid %d",
+			(int)xbdreq->req_dmamap->dm_mapsize,
+			(int)bp->b_resid);
+			bp->b_resid -= xbdreq->req_dmamap->dm_mapsize;
+			KASSERT(bp->b_resid == 0);
+		}
+
 		for (seg = 0; seg < xbdreq->req_dmamap->dm_nsegs; seg++) {
 			/*
 			 * We are not allowing persistent mappings, so
@@ -757,21 +774,10 @@ again:
 
 		bus_dmamap_unload(sc->sc_xbusd->xbusd_dmat, xbdreq->req_dmamap);
 
-		bp = xbdreq->req_bp;
-		KASSERT(bp != NULL && bp->b_data != NULL);
-		DPRINTF(("%s(%p): b_bcount = %ld\n", __func__,
-		bp, (long)bp->b_bcount));
-
 		if (__predict_false(bp->b_data != xbdreq->req_data))
 			xbd_unmap_align(sc, xbdreq, true);
 		xbdreq->req_bp = xbdreq->req_data = NULL;
 
-		/* b_resid was set in dk_start, only override on error */
-		if (rep->status != BLKIF_RSP_OKAY) {
-			bp->b_error = EIO;
-			bp->b_resid = bp->b_bcount;
-		}
-
 		dk_done(>sc_dksc, bp);
 
 		SLIST_INSERT_HEAD(>sc_xbdreq_head, xbdreq, req_next);
@@ -1067,7 +1073,7 @@ xbd_diskstart(device_t self, struct buf 
 	req->sector_number = bp->b_rawblkno;
 	req->handle = sc->sc_handle;
 
-	bp->b_resid = 0;
+	bp->b_resid = bp->b_bcount;
 	for (seg = 0; seg < xbdreq->req_dmamap->dm_nsegs; seg++) {
 		bus_dma_segment_t *dmaseg = >req_dmamap->dm_segs[seg];
 



CVS commit: src/sys/gdbscripts

2020-04-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 14 13:58:12 UTC 2020

Added Files:
src/sys/gdbscripts: dmesg

Log Message:
Add dmesg functionality.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/gdbscripts/dmesg

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

Added files:

Index: src/sys/gdbscripts/dmesg
diff -u /dev/null src/sys/gdbscripts/dmesg:1.1
--- /dev/null	Tue Apr 14 09:58:12 2020
+++ src/sys/gdbscripts/dmesg	Tue Apr 14 09:58:11 2020
@@ -0,0 +1,47 @@
+#	$NetBSD: dmesg,v 1.1 2020/04/14 13:58:11 christos Exp $
+
+define dmesg
+	set $mbp = msgbufp
+	set $bufdata = &$mbp->msg_bufc[0]
+	set $print = $mbp->msg_bufs
+	set $newl = 0
+	set $skip = 0
+	set $i = -1 
+	set $p = $bufdata + $mbp->msg_bufx - 1
+
+	while ($i < $mbp->msg_bufs)
+		set $i = $i + 1
+		set $p = $p + 1
+		if ($p == $bufdata + $mbp->msg_bufs)
+			set $p = $bufdata
+		end
+		if ($i < $mbp->msg_bufs - $print)
+			loop_continue
+		end
+		set $c = $p[0]
+		# Skip syslog sequences
+		if ($skip)
+			if ($c == '>')
+set $newl = 0
+set $skip = 0
+			end
+			loop_continue
+		end
+		if ($newl && $c == '<')
+			set $skip = 1
+			loop_continue
+		end
+		if ($c == '\0')
+			loop_continue
+		end
+		set $newl = $c == '\n'
+		printf "%c", $c
+	end
+	if (!$newl)
+		printf "\n"
+	end
+end
+
+document dmesg
+print the message buffer
+end



CVS commit: src/sys/dev/onewire

2020-04-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 14 13:36:51 UTC 2020

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

Log Message:
defflag ONEWIRE_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/onewire/files.onewire
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/onewire/onewire.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/files.onewire
diff -u src/sys/dev/onewire/files.onewire:1.4 src/sys/dev/onewire/files.onewire:1.5
--- src/sys/dev/onewire/files.onewire:1.4	Tue Apr 14 13:35:24 2020
+++ src/sys/dev/onewire/files.onewire	Tue Apr 14 13:36:51 2020
@@ -1,6 +1,7 @@
-# $NetBSD: files.onewire,v 1.4 2020/04/14 13:35:24 macallan Exp $
+# $NetBSD: files.onewire,v 1.5 2020/04/14 13:36:51 macallan Exp $
 
 define	onewire {}
+defflag opt_onewire.h	ONEWIRE_DEBUG
 
 device	onewire: onewire
 attach	onewire at onewirebus

Index: src/sys/dev/onewire/onewire.c
diff -u src/sys/dev/onewire/onewire.c:1.18 src/sys/dev/onewire/onewire.c:1.19
--- src/sys/dev/onewire/onewire.c:1.18	Sat Nov 30 23:04:12 2019
+++ src/sys/dev/onewire/onewire.c	Tue Apr 14 13:36:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: onewire.c,v 1.18 2019/11/30 23:04:12 ad Exp $	*/
+/*	$NetBSD: onewire.c,v 1.19 2020/04/14 13:36:51 macallan Exp $	*/
 /*	$OpenBSD: onewire.c,v 1.1 2006/03/04 16:27:03 grange Exp $	*/
 
 /*-
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.18 2019/11/30 23:04:12 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: onewire.c,v 1.19 2020/04/14 13:36:51 macallan Exp $");
 
 /*
  * 1-Wire bus driver.
@@ -64,6 +64,8 @@ __KERNEL_RCSID(0, "$NetBSD: onewire.c,v 
 #include 
 #include 
 
+#include "opt_onewire.h"
+
 #include 
 #include 
 



CVS commit: src/sys/dev/onewire

2020-04-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 14 13:35:24 UTC 2020

Modified Files:
src/sys/dev/onewire: files.onewire
Added Files:
src/sys/dev/onewire: oweeprom.c

Log Message:
add 'driver' for DS2430A EEPROMs which simply dumps the chip's contents and
status register


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/onewire/files.onewire
cvs rdiff -u -r0 -r1.1 src/sys/dev/onewire/oweeprom.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/files.onewire
diff -u src/sys/dev/onewire/files.onewire:1.3 src/sys/dev/onewire/files.onewire:1.4
--- src/sys/dev/onewire/files.onewire:1.3	Fri Apr 14 18:38:50 2006
+++ src/sys/dev/onewire/files.onewire	Tue Apr 14 13:35:24 2020
@@ -1,4 +1,4 @@
-# $NetBSD: files.onewire,v 1.3 2006/04/14 18:38:50 riz Exp $
+# $NetBSD: files.onewire,v 1.4 2020/04/14 13:35:24 macallan Exp $
 
 define	onewire {}
 
@@ -13,3 +13,8 @@ file	dev/onewire/onewire_bitbang.c	onewi
 device	owtemp: sysmon_envsys
 attach	owtemp at onewire
 file	dev/onewire/owtemp.c		owtemp
+
+# 256bit EEPROM
+device 	oweeprom
+attach 	oweeprom at onewire
+file 	dev/onewire/oweeprom.c		oweeprom

Added files:

Index: src/sys/dev/onewire/oweeprom.c
diff -u /dev/null src/sys/dev/onewire/oweeprom.c:1.1
--- /dev/null	Tue Apr 14 13:35:24 2020
+++ src/sys/dev/onewire/oweeprom.c	Tue Apr 14 13:35:24 2020
@@ -0,0 +1,141 @@
+/*	$NetBSD: oweeprom.c,v 1.1 2020/04/14 13:35:24 macallan Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Michael Lorenz.
+ *
+ * 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.
+ */
+
+/*
+ * 1-Wire EEPROM family type device driver.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: oweeprom.c,v 1.1 2020/04/14 13:35:24 macallan Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define EEPROM_CMD_WRITE_SCRATCHPAD	0x0f
+#define EEPROM_CMD_READ_SCRATCHPAD	0xaa
+#define EEPROM_CMD_COPY_SCRATCHPAD	0x55
+#define EEPROM_CMD_READ_MEMORY		0xf0
+#define EEPROM_CMD_WRITE_APPREG		0x99
+#define EEPROM_CMD_READ_STATUS		0x66
+#define EEPROM_CMD_READ_APPREG		0xc3
+#define EEPROM_CMD_COPY_LOCK_APPREG	0x5a
+
+struct oweeprom_softc {
+	device_t			sc_dev;
+	void*sc_onewire;
+	u_int64_t			sc_rom;
+};
+
+static int	oweeprom_match(device_t, cfdata_t, void *);
+static void	oweeprom_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(oweeprom, sizeof(struct oweeprom_softc),
+	oweeprom_match, oweeprom_attach, NULL, NULL);
+
+static const struct onewire_matchfam oweeprom_fams[] = {
+	{ ONEWIRE_FAMILY_DS2430 },
+};
+
+static int
+oweeprom_match(device_t parent, cfdata_t match, void *aux)
+{
+	return (onewire_matchbyfam(aux, oweeprom_fams,
+	__arraycount(oweeprom_fams)));
+}
+
+static void
+oweeprom_attach(device_t parent, device_t self, void *aux)
+{
+	struct oweeprom_softc *sc = device_private(self);
+	struct onewire_attach_args *oa = aux;
+	int i, j;
+	uint8_t data[32];
+
+	aprint_naive("\n");
+
+	sc->sc_dev = self;
+	sc->sc_onewire = oa->oa_onewire;
+	sc->sc_rom = oa->oa_rom;
+
+	aprint_normal("\n");
+
+	onewire_lock(sc->sc_onewire);
+	if (onewire_reset(sc->sc_onewire) != 0) {
+		printf("reset failrd\n");
+		return;
+	}
+
+	onewire_matchrom(sc->sc_onewire, sc->sc_rom);
+	onewire_write_byte(sc->sc_onewire, EEPROM_CMD_READ_MEMORY);
+	onewire_write_byte(sc->sc_onewire, 0);
+	onewire_read_block(sc->sc_onewire, data, 32);
+	printf("EEPROM\n");
+	for (i = 0; i < 32; i += 8) {
+		printf("%02x:", i);
+		for (j = 0; j < 8; j++)
+			

CVS commit: src/sys/dev/onewire

2020-04-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 14 13:32:26 UTC 2020

Modified Files:
src/sys/dev/onewire: onewiredevs

Log Message:
add family 0x14 for DS2430A EEPROMs


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/onewire/onewiredevs

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/onewiredevs
diff -u src/sys/dev/onewire/onewiredevs:1.2 src/sys/dev/onewire/onewiredevs:1.3
--- src/sys/dev/onewire/onewiredevs:1.2	Wed Jan 21 14:27:58 2009
+++ src/sys/dev/onewire/onewiredevs	Tue Apr 14 13:32:26 2020
@@ -1,4 +1,4 @@
-$NetBSD: onewiredevs,v 1.2 2009/01/21 14:27:58 jnemeth Exp $
+$NetBSD: onewiredevs,v 1.3 2020/04/14 13:32:26 macallan Exp $
 /* $OpenBSD: onewiredevs,v 1.1 2006/03/04 16:27:03 grange Exp $ */
 
 /*
@@ -35,5 +35,6 @@ family	DS1982		0x09	1kb EPROM
 family	DS1995		0x0a	16kb NVRAM
 family	DS1996		0x0c	64kb NVRAM
 family	DS1920		0x10	Temperature
+family	DS2430		0x14	256bit EEPROM
 family	DS1822		0x22	Temperature
 family	DS18B20		0x28	Temperature



CVS commit: src/sys/dev/onewire

2020-04-14 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Apr 14 13:32:56 UTC 2020

Modified Files:
src/sys/dev/onewire: onewiredevs.h onewiredevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/onewire/onewiredevs.h \
src/sys/dev/onewire/onewiredevs_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/onewire/onewiredevs.h
diff -u src/sys/dev/onewire/onewiredevs.h:1.2 src/sys/dev/onewire/onewiredevs.h:1.3
--- src/sys/dev/onewire/onewiredevs.h:1.2	Fri Apr  7 18:56:37 2006
+++ src/sys/dev/onewire/onewiredevs.h	Tue Apr 14 13:32:56 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: onewiredevs.h,v 1.2 2006/04/07 18:56:37 riz Exp $	*/
+/*	$NetBSD: onewiredevs.h,v 1.3 2020/04/14 13:32:56 macallan Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * Generated from:
- *	NetBSD: onewiredevs,v 1.1 2006/04/07 18:55:22 riz Exp 
+ *	NetBSD: onewiredevs,v 1.2 2009/01/21 14:27:58 jnemeth Exp 
  */
 
 #define ONEWIRE_FAMILY_DS1990	0x01
@@ -16,5 +16,6 @@
 #define ONEWIRE_FAMILY_DS1995	0x0a
 #define ONEWIRE_FAMILY_DS1996	0x0c
 #define ONEWIRE_FAMILY_DS1920	0x10
+#define ONEWIRE_FAMILY_DS2430	0x14
 #define ONEWIRE_FAMILY_DS1822	0x22
 #define ONEWIRE_FAMILY_DS18B20	0x28
Index: src/sys/dev/onewire/onewiredevs_data.h
diff -u src/sys/dev/onewire/onewiredevs_data.h:1.2 src/sys/dev/onewire/onewiredevs_data.h:1.3
--- src/sys/dev/onewire/onewiredevs_data.h:1.2	Fri Apr  7 18:56:37 2006
+++ src/sys/dev/onewire/onewiredevs_data.h	Tue Apr 14 13:32:56 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: onewiredevs_data.h,v 1.2 2006/04/07 18:56:37 riz Exp $	*/
+/*	$NetBSD: onewiredevs_data.h,v 1.3 2020/04/14 13:32:56 macallan Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * Generated from:
- *	NetBSD: onewiredevs,v 1.1 2006/04/07 18:55:22 riz Exp 
+ *	NetBSD: onewiredevs,v 1.2 2009/01/21 14:27:58 jnemeth Exp 
  */
 
 static const struct onewire_family onewire_famtab[] = {
@@ -17,6 +17,7 @@ static const struct onewire_family onewi
 	{ ONEWIRE_FAMILY_DS1995, "16kb NVRAM" },
 	{ ONEWIRE_FAMILY_DS1996, "64kb NVRAM" },
 	{ ONEWIRE_FAMILY_DS1920, "Temperature" },
+	{ ONEWIRE_FAMILY_DS2430, "256bit EEPROM" },
 	{ ONEWIRE_FAMILY_DS1822, "Temperature" },
 	{ ONEWIRE_FAMILY_DS18B20, "Temperature" },
 	{ 0, NULL }



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 13:10:43 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
use single pre-allocated buffer for unaligned I/O - it's rare and not
performance critical path, it's more important to ensure it will succeed
eventually; also return EAGAIN rather than ENOMEM, so the I/O will be
retried by dk_start() when previous I/O finishes

fix yet another leak on the xengnt_grant_access() fail path in
xbd_diskstart() - this time the unalign buffer


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.110 src/sys/arch/xen/xen/xbd_xenbus.c:1.111
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.110	Tue Apr 14 13:02:40 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 13:10:43 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.110 2020/04/14 13:02:40 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.111 2020/04/14 13:10:43 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.110 2020/04/14 13:02:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.111 2020/04/14 13:10:43 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -137,6 +137,9 @@ struct xbd_xenbus_softc {
 	struct xbd_req sc_reqs[XBD_RING_SIZE];
 	SLIST_HEAD(,xbd_req) sc_xbdreq_head; /* list of free requests */
 
+	vmem_addr_t sc_unalign_buffer;
+	bool sc_unalign_free;
+
 	int sc_backend_status; /* our status with backend */
 #define BLKIF_STATE_DISCONNECTED 0
 #define BLKIF_STATE_CONNECTED1
@@ -159,6 +162,8 @@ struct xbd_xenbus_softc {
 #define BLKIF_FEATURE_BITS		\
 	"\20\1CACHE-FLUSH\2BARRIER\3PERSISTENT"
 	struct evcnt sc_cnt_map_unalign;
+	struct evcnt sc_cnt_unalign_busy;
+	struct evcnt sc_cnt_queue_full;
 };
 
 #if 0
@@ -180,8 +185,8 @@ static void xbd_iosize(device_t, int *);
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
-static int  xbd_map_align(struct xbd_req *);
-static void xbd_unmap_align(struct xbd_req *);
+static int  xbd_map_align(struct xbd_xenbus_softc *, struct xbd_req *);
+static void xbd_unmap_align(struct xbd_xenbus_softc *, struct xbd_req *, bool);
 
 static void xbdminphys(struct buf *);
 
@@ -297,6 +302,10 @@ xbd_xenbus_attach(device_t parent, devic
 
 	evcnt_attach_dynamic(>sc_cnt_map_unalign, EVCNT_TYPE_MISC,
 	NULL, device_xname(self), "map unaligned");
+	evcnt_attach_dynamic(>sc_cnt_unalign_busy, EVCNT_TYPE_MISC,
+	NULL, device_xname(self), "map unaligned");
+	evcnt_attach_dynamic(>sc_cnt_queue_full, EVCNT_TYPE_MISC,
+	NULL, device_xname(self), "queue full");
 
 	for (i = 0; i < XBD_RING_SIZE; i++) {
 		if (bus_dmamap_create(sc->sc_xbusd->xbusd_dmat,
@@ -308,6 +317,13 @@ xbd_xenbus_attach(device_t parent, devic
 		}
 	}
 
+	if (uvm_km_kmem_alloc(kmem_va_arena,
+	MAXPHYS, VM_SLEEP | VM_INSTANTFIT, >sc_unalign_buffer) != 0) {
+		aprint_error_dev(self, "can't alloc align buffer\n");
+		return;
+	}
+	sc->sc_unalign_free = true;
+
 	/* resume shared structures and tell backend that we are ready */
 	if (xbd_xenbus_resume(self, PMF_Q_NONE) == false) {
 		uvm_km_free(kernel_map, (vaddr_t)ring, PAGE_SIZE,
@@ -407,9 +423,16 @@ xbd_xenbus_detach(device_t dev, int flag
 		}
 	}
 
+	if (sc->sc_unalign_buffer != 0) {
+		uvm_km_kmem_free(kmem_va_arena, sc->sc_unalign_buffer, MAXPHYS);
+		sc->sc_unalign_buffer = 0;
+	}
+
 	mutex_destroy(>sc_lock);
 
 	evcnt_detach(>sc_cnt_map_unalign);
+	evcnt_detach(>sc_cnt_unalign_busy);
+	evcnt_detach(>sc_cnt_queue_full);
 
 	pmf_device_deregister(dev);
 
@@ -740,7 +763,7 @@ again:
 		bp, (long)bp->b_bcount));
 
 		if (__predict_false(bp->b_data != xbdreq->req_data))
-			xbd_unmap_align(xbdreq);
+			xbd_unmap_align(sc, xbdreq, true);
 		xbdreq->req_bp = xbdreq->req_data = NULL;
 
 		/* b_resid was set in dk_start, only override on error */
@@ -1005,6 +1028,7 @@ xbd_diskstart(device_t self, struct buf 
 
 	xbdreq = SLIST_FIRST(>sc_xbdreq_head);
 	if (__predict_false(xbdreq == NULL)) {
+		sc->sc_cnt_queue_full.ev_count++;
 		DPRINTF(("xbd_diskstart: no req\n"));
 		error = EAGAIN;
 		goto out;
@@ -1018,7 +1042,7 @@ xbd_diskstart(device_t self, struct buf 
 
 		sc->sc_cnt_map_unalign.ev_count++;
 
-		if (__predict_false(xbd_map_align(xbdreq) != 0)) {
+		if (__predict_false(xbd_map_align(sc, xbdreq) != 0)) {
 			DPRINTF(("xbd_diskstart: no align\n"));
 			error = EAGAIN;
 			goto out;
@@ -1028,7 +1052,7 @@ xbd_diskstart(device_t self, struct buf 
 	if (__predict_false(bus_dmamap_load(sc->sc_xbusd->xbusd_dmat,
 	xbdreq->req_dmamap, xbdreq->req_data, bp->b_bcount, NULL,
 	BUS_DMA_NOWAIT) != 0)) {
-		printf("%s: %s: xengnt_grant_access failed",
+		printf("%s: 

CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 13:02:40 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
add forgotten mutex_exit() in detach, which caused panic in uvm_unmap1()
due to held spin lock


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.109 src/sys/arch/xen/xen/xbd_xenbus.c:1.110
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.109	Tue Apr 14 09:27:28 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 13:02:40 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.110 2020/04/14 13:02:40 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.110 2020/04/14 13:02:40 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -393,6 +393,7 @@ xbd_xenbus_detach(device_t dev, int flag
 	mutex_enter(>sc_lock);
 	while (xengnt_status(sc->sc_ring_gntref))
 		cv_timedwait(>sc_detach_cv, >sc_lock, hz/2);
+	mutex_exit(>sc_lock);
 
 	xengnt_revoke_access(sc->sc_ring_gntref);
 	uvm_km_free(kernel_map, (vaddr_t)sc->sc_ring.sring,



CVS commit: src/sys/fs/udf

2020-04-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 14 12:47:44 UTC 2020

Modified Files:
src/sys/fs/udf: udf_vfsops.c

Log Message:
Move comment related to the sysctl_createv() in SYSCTL_SETUP() from the old
place to the new place too.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/fs/udf/udf_vfsops.c

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

Modified files:

Index: src/sys/fs/udf/udf_vfsops.c
diff -u src/sys/fs/udf/udf_vfsops.c:1.79 src/sys/fs/udf/udf_vfsops.c:1.80
--- src/sys/fs/udf/udf_vfsops.c:1.79	Mon Apr 13 19:23:18 2020
+++ src/sys/fs/udf/udf_vfsops.c	Tue Apr 14 12:47:44 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vfsops.c,v 1.79 2020/04/13 19:23:18 ad Exp $ */
+/* $NetBSD: udf_vfsops.c,v 1.80 2020/04/14 12:47:44 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.79 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vfsops.c,v 1.80 2020/04/14 12:47:44 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -167,6 +167,11 @@ udf_done(void)
  */
 #define UDF_VERBOSE_SYSCTLOPT1
 
+/*
+ * XXX the "24" below could be dynamic, thereby eliminating one
+ * more instance of the "number to vfs" mapping problem, but
+ * "24" is the order as taken from sys/mount.h
+ */
 SYSCTL_SETUP(udf_sysctl_setup, "udf sysctl")
 {
 	const struct sysctlnode *node;
@@ -197,11 +202,6 @@ udf_modcmd(modcmd_t cmd, void *arg)
 		error = vfs_attach(_vfsops);
 		if (error != 0)
 			break;
-		/*
-		 * XXX the "24" below could be dynamic, thereby eliminating one
-		 * more instance of the "number to vfs" mapping problem, but
-		 * "24" is the order as taken from sys/mount.h
-		 */
 		break;
 	case MODULE_CMD_FINI:
 		error = vfs_detach(_vfsops);



CVS commit: src/distrib/common

2020-04-14 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Apr 14 12:14:59 UTC 2020

Modified Files:
src/distrib/common: zfsroot.rc

Log Message:
We solves the zpool SIGBUS issue by building a threaded libhack.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/distrib/common/zfsroot.rc

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

Modified files:

Index: src/distrib/common/zfsroot.rc
diff -u src/distrib/common/zfsroot.rc:1.4 src/distrib/common/zfsroot.rc:1.5
--- src/distrib/common/zfsroot.rc:1.4	Tue Feb 25 20:05:10 2020
+++ src/distrib/common/zfsroot.rc	Tue Apr 14 12:14:59 2020
@@ -1,6 +1,6 @@
 #/bin/sh
 #
-#	$NetBSD: zfsroot.rc,v 1.4 2020/02/25 20:05:10 roy Exp $
+#	$NetBSD: zfsroot.rc,v 1.5 2020/04/14 12:14:59 roy Exp $
 
 # Assumption - boot.cfg loads this ramdisk.
 # Assumption - The needed kernel modules: solaris and zfs; are either on this
@@ -19,11 +19,6 @@ export HOME=/
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 umask 022
 
-# FIXME XXX Sometimes zpool import gets SIGBUS
-# Ensure that we are in a writable directory to try and capture a coredump
-# Not that we actually get a coredump 
-cd /tmp
-
 echo "Importing $rpool"
 /sbin/zpool import -f -N "$rpool"
 



CVS commit: src/sys/fs/udf

2020-04-14 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 14 11:45:43 UTC 2020

Modified Files:
src/sys/fs/udf: udf_vnops.c

Log Message:
fix debug print flag


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/fs/udf/udf_vnops.c

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

Modified files:

Index: src/sys/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.110 src/sys/fs/udf/udf_vnops.c:1.111
--- src/sys/fs/udf/udf_vnops.c:1.110	Mon Apr 13 19:23:18 2020
+++ src/sys/fs/udf/udf_vnops.c	Tue Apr 14 11:45:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.110 2020/04/13 19:23:18 ad Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.111 2020/04/14 11:45:42 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.110 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.111 2020/04/14 11:45:42 reinoud Exp $");
 #endif /* not lint */
 
 
@@ -1992,7 +1992,7 @@ udf_rmdir(void *v)
 	struct udf_mount *ump = dir_node->ump;
 	int error, isempty;
 
-	DPRINTF(NOTIMPL, ("udf_rmdir '%s' called\n", cnp->cn_nameptr));
+	DPRINTF(CALL, ("udf_rmdir '%s' called\n", cnp->cn_nameptr));
 
 	/* don't allow '.' to be deleted */
 	if (dir_node == udf_node) {



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 09:27:28 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
provide d_iosize hook to cap the xfer size used for dumps


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.108 src/sys/arch/xen/xen/xbd_xenbus.c:1.109
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.108	Tue Apr 14 08:21:59 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 09:27:28 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.109 2020/04/14 09:27:28 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -176,6 +176,7 @@ static bool xbd_xenbus_resume(device_t, 
 
 static int  xbd_handler(void *);
 static int  xbd_diskstart(device_t, struct buf *);
+static void xbd_iosize(device_t, int *);
 static void xbd_backend_changed(void *, XenbusState);
 static void xbd_connect(struct xbd_xenbus_softc *);
 
@@ -231,6 +232,7 @@ static struct dkdriver xbddkdriver = {
 	.d_open = xbdopen,
 	.d_close = xbdclose,
 	.d_diskstart = xbd_diskstart,
+	.d_iosize = xbd_iosize,
 };
 
 static int
@@ -775,6 +777,17 @@ xbdminphys(struct buf *bp)
 	minphys(bp);
 }
 
+static void
+xbd_iosize(device_t dev, int *maxxfer)
+{
+	/*
+	 * Always restrict dumps to XBD_MAX_XFER to avoid indirect segments,
+	 * so that it uses as little memory as possible. 
+	 */
+	if (*maxxfer > XBD_MAX_XFER)
+		*maxxfer = XBD_MAX_XFER;
+}
+
 int
 xbdopen(dev_t dev, int flags, int fmt, struct lwp *l)
 {



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 08:22:00 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbd_xenbus.c

Log Message:
if grant fails also revoke the grants for previous segments, fixes
grant leak on grant error


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/xen/xen/xbd_xenbus.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/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.107 src/sys/arch/xen/xen/xbd_xenbus.c:1.108
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.107	Mon Apr 13 20:09:13 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Tue Apr 14 08:21:59 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.107 2020/04/13 20:09:13 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.107 2020/04/13 20:09:13 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.108 2020/04/14 08:21:59 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -1049,6 +1049,12 @@ xbd_diskstart(device_t self, struct buf 
 		>req_gntref[seg]))) {
 			printf("%s: %s: xengnt_grant_access failed",
 			device_xname(sc->sc_dksc.sc_dev), __func__);
+			if (seg > 0) {
+for (; --seg >= 0; ) {
+	xengnt_revoke_access(
+	xbdreq->req_gntref[seg]);
+}
+			}
 			bus_dmamap_unload(sc->sc_xbusd->xbusd_dmat,
 			xbdreq->req_dmamap);
 			SLIST_INSERT_HEAD(>sc_xbdreq_head, xbdreq,



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

2020-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 14 08:06:54 UTC 2020

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

Log Message:
Provide a "mach cpuinfo" which displays some struct cpuinfo fields for
a/all CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/arm32/db_machdep.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_machdep.c
diff -u src/sys/arch/arm/arm32/db_machdep.c:1.29 src/sys/arch/arm/arm32/db_machdep.c:1.30
--- src/sys/arch/arm/arm32/db_machdep.c:1.29	Tue Apr 14 08:00:47 2020
+++ src/sys/arch/arm/arm32/db_machdep.c	Tue Apr 14 08:06:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.29 2020/04/14 08:00:47 skrll Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.30 2020/04/14 08:06:53 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.29 2020/04/14 08:00:47 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.30 2020/04/14 08:06:53 skrll Exp $");
 
 #include 
 #include 
@@ -59,6 +59,8 @@ __KERNEL_RCSID(0, "$NetBSD: db_machdep.c
 #ifdef _KERNEL
 static long nil;
 
+void db_md_cpuinfo_cmd(db_expr_t, bool, db_expr_t, const char *);
+
 int db_access_und_sp(const struct db_variable *, db_expr_t *, int);
 int db_access_abt_sp(const struct db_variable *, db_expr_t *, int);
 int db_access_irq_sp(const struct db_variable *, db_expr_t *, int);
@@ -115,6 +117,10 @@ const struct db_command db_machine_comma
 			"switch to a different cpu",
 		 	NULL,NULL) },
 #endif /* MULTIPROCESSOR */
+	{ DDB_ADD_CMD("cpuinfo", db_md_cpuinfo_cmd,	0,
+			"Displays the cpuinfo",
+		NULL, NULL)
+	},
 	{ DDB_ADD_CMD("fault",	db_show_fault_cmd,	0,
 			"Displays the fault registers",
 		 	NULL,NULL) },
@@ -470,4 +476,68 @@ db_switch_cpu_cmd(db_expr_t addr, bool h
 	db_continue_cmd(0, false, 0, "");
 }
 #endif
+
+static void
+show_cpuinfo(struct cpu_info *kci)
+{
+	struct cpu_info cpuinfobuf;
+	cpuid_t cpuid;
+	int i;
+
+	db_read_bytes((db_addr_t)kci, sizeof(cpuinfobuf), (char *));
+
+	struct cpu_info *ci = 
+	cpuid = ci->ci_cpuid;
+	db_printf("cpu_info=%p, cpu_name=%s\n", kci, ci->ci_cpuname);
+	db_printf("%p cpu[%lu].ci_cpuid= %lu\n",
+	>ci_cpuid, cpuid, ci->ci_cpuid);
+	db_printf("%p cpu[%lu].ci_curlwp   = %p\n",
+	>ci_curlwp, cpuid, ci->ci_curlwp);
+	for (i = 0; i < SOFTINT_COUNT; i++) {
+		db_printf("%p cpu[%lu].ci_softlwps[%d]  = %p\n",
+		>ci_softlwps[i], cpuid, i, ci->ci_softlwps[i]);
+	}
+	db_printf("%p cpu[%lu].ci_lastintr = %" PRIu64 "\n",
+	>ci_lastintr, cpuid, ci->ci_lastintr);
+	db_printf("%p cpu[%lu].ci_want_resched = %d\n",
+	>ci_want_resched, cpuid, ci->ci_want_resched);
+	db_printf("%p cpu[%lu].ci_cpl  = %d\n",
+	>ci_cpl, cpuid, ci->ci_cpl);
+	db_printf("%p cpu[%lu].ci_softints = 0x%08x\n",
+	>ci_softints, cpuid, ci->ci_softints);
+	db_printf("%p cpu[%lu].ci_astpending   = 0x%08x\n",
+	>ci_astpending, cpuid, ci->ci_astpending);
+	db_printf("%p cpu[%lu].ci_intr_depth   = %u\n",
+	>ci_intr_depth, cpuid, ci->ci_intr_depth);
+
+}
+
+void
+db_md_cpuinfo_cmd(db_expr_t addr, bool have_addr, db_expr_t count,
+const char *modif)
+{
+#ifdef MULTIPROCESSOR
+	CPU_INFO_ITERATOR cii;
+	struct cpu_info *ci;
+	bool showall = false;
+
+	if (modif != NULL) {
+		for (; *modif != '\0'; modif++) {
+			switch (*modif) {
+			case 'a':
+showall = true;
+break;
+			}
+		}
+	}
+
+	if (showall) {
+		for (CPU_INFO_FOREACH(cii, ci)) {
+			show_cpuinfo(ci);
+		}
+	} else
+#endif /* MULTIPROCESSOR */
+		show_cpuinfo(curcpu());
+}
+
 #endif /* _KERNEL */



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

2020-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 14 08:00:47 UTC 2020

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

Log Message:
Remove unused ARM32_DB_COMMANDS


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/arm32/db_machdep.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_machdep.c
diff -u src/sys/arch/arm/arm32/db_machdep.c:1.28 src/sys/arch/arm/arm32/db_machdep.c:1.29
--- src/sys/arch/arm/arm32/db_machdep.c:1.28	Tue Apr 14 07:59:43 2020
+++ src/sys/arch/arm/arm32/db_machdep.c	Tue Apr 14 08:00:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.28 2020/04/14 07:59:43 skrll Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.29 2020/04/14 08:00:47 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.28 2020/04/14 07:59:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.29 2020/04/14 08:00:47 skrll Exp $");
 
 #include 
 #include 
@@ -131,9 +131,6 @@ const struct db_command db_machine_comma
 #endif
 #endif /* _KERNEL */
 
-#ifdef ARM32_DB_COMMANDS
-	ARM32_DB_COMMANDS,
-#endif
 	{ DDB_ADD_CMD(NULL, NULL,   0,NULL,NULL,NULL) }
 };
 



CVS commit: src/doc

2020-04-14 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Apr 14 08:00:23 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Fix typo, expand description slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.2673 -r1.2674 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2673 src/doc/CHANGES:1.2674
--- src/doc/CHANGES:1.2673	Tue Apr 14 07:31:39 2020
+++ src/doc/CHANGES	Tue Apr 14 08:00:22 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2673 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2674 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -169,11 +169,11 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	xen: remove legacy rx-flip support from xennet(4) and xvif(4)
 		[jdolecek 20200405]
 	OpenSSL: Imported 1.1.1f. [christos 20200405]
-	xennet(4): Make it MP-safe [jdolecek 20200406]
+	xennet(4): Make the driver MP-safe [jdolecek 20200406]
 	aarch64: Add support for Pointer Authentication (PAC).
 		[maxv 20200412]
 	aarch64: Add support for Branch Target Identification (BTI).
 		[maxv 20200413]
 	umass(4): Removed obsolete ISD-ATA support [jdolecek 202000413]
 	dhcpcd(8): Import version 9.0.1 [roy 20200413]
-	xbd(40: Make it MP-safe [jdolecek 20200413]
+	xbd(4): Make the driver MP-safe [jdolecek 20200413]



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

2020-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 14 07:59:43 UTC 2020

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

Log Message:
Sort db_commands.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/arm32/db_machdep.c

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

Modified files:

Index: src/sys/arch/arm/arm32/db_machdep.c
diff -u src/sys/arch/arm/arm32/db_machdep.c:1.27 src/sys/arch/arm/arm32/db_machdep.c:1.28
--- src/sys/arch/arm/arm32/db_machdep.c:1.27	Wed Mar 25 06:17:23 2020
+++ src/sys/arch/arm/arm32/db_machdep.c	Tue Apr 14 07:59:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.27 2020/03/25 06:17:23 skrll Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.28 2020/04/14 07:59:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Mark Brinicombe
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.27 2020/03/25 06:17:23 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.28 2020/04/14 07:59:43 skrll Exp $");
 
 #include 
 #include 
@@ -109,24 +109,26 @@ const struct db_variable db_regs[] = {
 const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
 const struct db_command db_machine_command_table[] = {
+#ifdef _KERNEL
+#if defined(MULTIPROCESSOR)
+	{ DDB_ADD_CMD("cpu",	db_switch_cpu_cmd,	0,
+			"switch to a different cpu",
+		 	NULL,NULL) },
+#endif /* MULTIPROCESSOR */
+	{ DDB_ADD_CMD("fault",	db_show_fault_cmd,	0,
+			"Displays the fault registers",
+		 	NULL,NULL) },
+#endif
 	{ DDB_ADD_CMD("frame",	db_show_frame_cmd,	0,
 			"Displays the contents of a trapframe",
 			"[address]",
 			"   address:\taddress of trapfame to display")},
 #ifdef _KERNEL
-	{ DDB_ADD_CMD("fault",	db_show_fault_cmd,	0,
-			"Displays the fault registers",
-		 	NULL,NULL) },
 #if defined(CPU_CORTEXA5) || defined(CPU_CORTEXA7)
 	{ DDB_ADD_CMD("tlb",	db_show_tlb_cmd,	0,
 			"Displays the TLB",
 		 	NULL,NULL) },
 #endif
-#if defined(MULTIPROCESSOR)
-	{ DDB_ADD_CMD("cpu",	db_switch_cpu_cmd,	0,
-			"switch to a different cpu",
-		 	NULL,NULL) },
-#endif
 #endif /* _KERNEL */
 
 #ifdef ARM32_DB_COMMANDS



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 07:41:05 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xengnt.c

Log Message:
DRY - use pages for sizeof() for the frame allocations, so it get's allocated
the correct size without repeating the type


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/xen/xen/xengnt.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/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.34 src/sys/arch/xen/xen/xengnt.c:1.35
--- src/sys/arch/xen/xen/xengnt.c:1.34	Tue Apr 14 07:38:12 2020
+++ src/sys/arch/xen/xen/xengnt.c	Tue Apr 14 07:41:05 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $  */
+/*  $NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.35 2020/04/14 07:41:05 jdolecek Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ xengnt_map_status(void)
 
 	KASSERT(mutex_owned(_lock));
 
-	sz = gnt_status_frames * sizeof(uint64_t);
+	sz = gnt_status_frames * sizeof(*pages);
 	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;
@@ -247,7 +247,7 @@ xengnt_more_entries(void)
 	if (gnt_nr_grant_frames == gnt_max_grant_frames)
 		return ENOMEM;
 
-	sz = nframes_new * sizeof(u_long);
+	sz = nframes_new * sizeof(*pages);
 	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;



CVS commit: src/sys/arch/xen/xen

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 07:38:12 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xengnt.c

Log Message:
actually fix also the allocated memory size for the getstatus frames on i386


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/xen/xen/xengnt.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/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.33 src/sys/arch/xen/xen/xengnt.c:1.34
--- src/sys/arch/xen/xen/xengnt.c:1.33	Fri Apr 10 21:03:20 2020
+++ src/sys/arch/xen/xen/xengnt.c	Tue Apr 14 07:38:12 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xengnt.c,v 1.33 2020/04/10 21:03:20 jdolecek Exp $  */
+/*  $NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.33 2020/04/10 21:03:20 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.34 2020/04/14 07:38:12 jdolecek Exp $");
 
 #include 
 #include 
@@ -191,7 +191,7 @@ xengnt_map_status(void)
 
 	KASSERT(mutex_owned(_lock));
 
-	sz = gnt_status_frames * sizeof(u_long);
+	sz = gnt_status_frames * sizeof(uint64_t);
 	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;



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

2020-04-14 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr 14 07:31:52 UTC 2020

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

Log Message:
Fix a comment.  From ad@


To generate a diff of this commit:
cvs rdiff -u -r1.403 -r1.404 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.403 src/sys/arch/arm/arm32/pmap.c:1.404
--- src/sys/arch/arm/arm32/pmap.c:1.403	Mon Apr 13 00:27:16 2020
+++ src/sys/arch/arm/arm32/pmap.c	Tue Apr 14 07:31:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.403 2020/04/13 00:27:16 chs Exp $	*/
+/*	$NetBSD: pmap.c,v 1.404 2020/04/14 07:31:52 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -198,7 +198,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.403 2020/04/13 00:27:16 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.404 2020/04/14 07:31:52 skrll Exp $");
 
 #include 
 #include 
@@ -2966,7 +2966,7 @@ pmap_page_remove(struct vm_page_md *md, 
 		pmap_acquire_page_lock(md);
 #ifdef MULTIPROCESSOR
 		/*
-		 * Restart of the beginning of the list.
+		 * Restart at the beginning of the list.
 		 */
 		pvp = _FIRST(>pvh_list);
 #endif



CVS commit: src/doc

2020-04-14 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr 14 07:31:39 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
note MP-safe work for xennet(4) and xbd(4)


To generate a diff of this commit:
cvs rdiff -u -r1.2672 -r1.2673 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.2672 src/doc/CHANGES:1.2673
--- src/doc/CHANGES:1.2672	Mon Apr 13 15:48:55 2020
+++ src/doc/CHANGES	Tue Apr 14 07:31:39 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2672 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2673 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -169,9 +169,11 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	xen: remove legacy rx-flip support from xennet(4) and xvif(4)
 		[jdolecek 20200405]
 	OpenSSL: Imported 1.1.1f. [christos 20200405]
+	xennet(4): Make it MP-safe [jdolecek 20200406]
 	aarch64: Add support for Pointer Authentication (PAC).
 		[maxv 20200412]
 	aarch64: Add support for Branch Target Identification (BTI).
 		[maxv 20200413]
 	umass(4): Removed obsolete ISD-ATA support [jdolecek 202000413]
 	dhcpcd(8): Import version 9.0.1 [roy 20200413]
+	xbd(40: Make it MP-safe [jdolecek 20200413]