CVS commit: src/usr.sbin/cpuctl/arch

2019-05-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue May 21 05:29:21 UTC 2019

Modified Files:
src/usr.sbin/cpuctl/arch: cpuctl_i386.h i386-asm.S i386.c x86_64-asm.S

Log Message:
All MSRs can only be read at privilege level 0. The exact APIC ID cannot
be determined on some AMD CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/cpuctl_i386.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/cpuctl/arch/i386-asm.S \
src/usr.sbin/cpuctl/arch/x86_64-asm.S
cvs rdiff -u -r1.98 -r1.99 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/usr.sbin/cpuctl/arch/cpuctl_i386.h
diff -u src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.3 src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.4
--- src/usr.sbin/cpuctl/arch/cpuctl_i386.h:1.3	Fri May 10 16:42:57 2019
+++ src/usr.sbin/cpuctl/arch/cpuctl_i386.h	Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: cpuctl_i386.h,v 1.3 2019/05/10 16:42:57 mlelstv Exp $  */
+/*  $NetBSD: cpuctl_i386.h,v 1.4 2019/05/21 05:29:21 mlelstv Exp $  */
 
 /* Interfaces to code in i386-asm.S */
 
@@ -7,4 +7,3 @@
 void x86_cpuid2(uint32_t, uint32_t, uint32_t *);
 uint32_t x86_identify(void);
 uint32_t x86_xgetbv(void);
-uint64_t rdmsr(u_int);

Index: src/usr.sbin/cpuctl/arch/i386-asm.S
diff -u src/usr.sbin/cpuctl/arch/i386-asm.S:1.6 src/usr.sbin/cpuctl/arch/i386-asm.S:1.7
--- src/usr.sbin/cpuctl/arch/i386-asm.S:1.6	Sat May 11 12:24:42 2019
+++ src/usr.sbin/cpuctl/arch/i386-asm.S	Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386-asm.S,v 1.6 2019/05/11 12:24:42 mlelstv Exp $	*/
+/*	$NetBSD: i386-asm.S,v 1.7 2019/05/21 05:29:21 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2004, 2006, 2007 The NetBSD Foundation, Inc.
@@ -164,11 +164,3 @@ is486dlc:
 	movl	$CPU_486DLC,%eax
 	ret
 
-ENTRY(rdmsr)
-	movl	4(%esp), %ecx
-	pushl	%edi
-	movl	$OPTERON_MSR_PASSCODE, %edi
-	rdmsr
-	popl	%edi
-	ret
-END(rdmsr)
Index: src/usr.sbin/cpuctl/arch/x86_64-asm.S
diff -u src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.6 src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.7
--- src/usr.sbin/cpuctl/arch/x86_64-asm.S:1.6	Fri May 10 16:42:57 2019
+++ src/usr.sbin/cpuctl/arch/x86_64-asm.S	Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_64-asm.S,v 1.6 2019/05/10 16:42:57 mlelstv Exp $	*/
+/*	$NetBSD: x86_64-asm.S,v 1.7 2019/05/21 05:29:21 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -55,11 +55,3 @@ ENTRY(x86_identify)
 	movl	$-1,%eax
 	ret
 
-ENTRY(rdmsr)
-	movq	%rdi, %rcx
-	xorq	%rax, %rax
-	movl	$OPTERON_MSR_PASSCODE, %edi
-	rdmsr
-	shlq	$32, %rdx
-	orq	%rdx, %rax
-	ret

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.98 src/usr.sbin/cpuctl/arch/i386.c:1.99
--- src/usr.sbin/cpuctl/arch/i386.c:1.98	Sat May 11 17:21:07 2019
+++ src/usr.sbin/cpuctl/arch/i386.c	Tue May 21 05:29:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.98 2019/05/11 17:21:07 kre Exp $	*/
+/*	$NetBSD: i386.c,v 1.99 2019/05/21 05:29:21 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.98 2019/05/11 17:21:07 kre Exp $");
+__RCSID("$NetBSD: i386.c,v 1.99 2019/05/21 05:29:21 mlelstv Exp $");
 #endif /* not lint */
 
 #include 
@@ -1959,6 +1959,7 @@ identifycpu_cpuids_amd(struct cpu_info *
 	if (core_bits == 0)
 		core_bits = ilog2(core_max - 1) + 1;
 
+#if 0 /* MSRs need kernel mode */
 	if (cpu_family < 0x11) {
 		const uint64_t reg = rdmsr(MSR_NB_CFG);
 		if ((reg & NB_CFG_INITAPICCPUIDLO) == 0) {
@@ -1968,6 +1969,7 @@ identifycpu_cpuids_amd(struct cpu_info *
 (apic_id >> 5) | (node_id << 2);
 		}
 	}
+#endif
 
 	if (cpu_family == 0x17) {
 		x86_cpuid(0x801e, descs);



CVS commit: src/usr.sbin/cpuctl/arch

2019-05-20 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Tue May 21 05:29:21 UTC 2019

Modified Files:
src/usr.sbin/cpuctl/arch: cpuctl_i386.h i386-asm.S i386.c x86_64-asm.S

Log Message:
All MSRs can only be read at privilege level 0. The exact APIC ID cannot
be determined on some AMD CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/cpuctl/arch/cpuctl_i386.h
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/cpuctl/arch/i386-asm.S \
src/usr.sbin/cpuctl/arch/x86_64-asm.S
cvs rdiff -u -r1.98 -r1.99 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.



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:57:02 UTC 2019

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

Log Message:
put back line accidentally removed.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/kern/subr_prf.c

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



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:57:02 UTC 2019

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

Log Message:
put back line accidentally removed.


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/kern/subr_prf.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/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.180 src/sys/kern/subr_prf.c:1.181
--- src/sys/kern/subr_prf.c:1.180	Tue May 21 00:55:07 2019
+++ src/sys/kern/subr_prf.c	Tue May 21 00:57:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.180 2019/05/21 04:55:07 christos Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.181 2019/05/21 04:57:02 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.180 2019/05/21 04:55:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.181 2019/05/21 04:57:02 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -866,6 +866,7 @@ aprint_error_internal(const char *prefix
 
 	if (prefix)
 		kprintf_internal("%s: ", flags, NULL, NULL, prefix);
+	kprintf_internal("autoconfiguration error: ", TOLOG, NULL, NULL);
 	kprintf(fmt, flags, NULL, NULL, ap);
 
 	kprintf_unlock();



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:55:07 UTC 2019

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

Log Message:
undo the unintended part of the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/kern/subr_prf.c

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



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:55:07 UTC 2019

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

Log Message:
undo the unintended part of the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/kern/subr_prf.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/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.179 src/sys/kern/subr_prf.c:1.180
--- src/sys/kern/subr_prf.c:1.179	Tue May 21 00:53:52 2019
+++ src/sys/kern/subr_prf.c	Tue May 21 00:55:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.179 2019/05/21 04:53:52 christos Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.180 2019/05/21 04:55:07 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.179 2019/05/21 04:53:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.180 2019/05/21 04:55:07 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -106,7 +106,6 @@ static void	 putchar(int, int, struct tt
 extern	struct tty *constty;	/* pointer to console "window" tty */
 extern	int log_open;	/* subr_log: is /dev/klog open? */
 extern	krndsource_t	rnd_printf_source;
-extern int config_pending;
 const	char *panicstr; /* arg to first call to panic (used as a flag
 			   to indicate that panic has already been called). */
 struct cpu_info *paniccpu;	/* cpu that first paniced */
@@ -867,8 +866,6 @@ aprint_error_internal(const char *prefix
 
 	if (prefix)
 		kprintf_internal("%s: ", flags, NULL, NULL, prefix);
-	if (config_pending)
-		kprintf_internal("autoconfiguration error: ", TOLOG, NULL, NULL);
 	kprintf(fmt, flags, NULL, NULL, ap);
 
 	kprintf_unlock();



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:53:52 UTC 2019

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

Log Message:
va_copy list needs va_end; pointed out by kre@


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/kern/subr_prf.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/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.178 src/sys/kern/subr_prf.c:1.179
--- src/sys/kern/subr_prf.c:1.178	Mon May 20 20:57:54 2019
+++ src/sys/kern/subr_prf.c	Tue May 21 00:53:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.178 2019/05/21 00:57:54 kre Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.179 2019/05/21 04:53:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.178 2019/05/21 00:57:54 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.179 2019/05/21 04:53:52 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -106,6 +106,7 @@ static void	 putchar(int, int, struct tt
 extern	struct tty *constty;	/* pointer to console "window" tty */
 extern	int log_open;	/* subr_log: is /dev/klog open? */
 extern	krndsource_t	rnd_printf_source;
+extern int config_pending;
 const	char *panicstr; /* arg to first call to panic (used as a flag
 			   to indicate that panic has already been called). */
 struct cpu_info *paniccpu;	/* cpu that first paniced */
@@ -866,7 +867,8 @@ aprint_error_internal(const char *prefix
 
 	if (prefix)
 		kprintf_internal("%s: ", flags, NULL, NULL, prefix);
-	kprintf_internal("autoconfiguration error: ", TOLOG, NULL, NULL);
+	if (config_pending)
+		kprintf_internal("autoconfiguration error: ", TOLOG, NULL, NULL);
 	kprintf(fmt, flags, NULL, NULL, ap);
 
 	kprintf_unlock();
@@ -1189,9 +1191,10 @@ vasprintf(char **bf, const char *fmt, va
 	va_list cap;
 
 	va_copy(cap, ap);
-	retval = kprintf(fmt, TOBUFONLY, NULL, NULL, ap) + 1;
+	retval = kprintf(fmt, TOBUFONLY, NULL, NULL, cap) + 1;
+	va_end(cap);
 	*bf = kmem_alloc(retval, KM_SLEEP);
-	return vsnprintf(*bf, retval, fmt, cap);
+	return vsnprintf(*bf, retval, fmt, ap);
 }
 
 /*



CVS commit: src/sys/kern

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:53:52 UTC 2019

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

Log Message:
va_copy list needs va_end; pointed out by kre@


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/sys/kern/subr_prf.c

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



CVS commit: src/tests/kernel

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:09:46 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
add printf attribute


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/gen_t_subr_prf

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



CVS commit: src/tests/kernel

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:10:20 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
unexpand


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/kernel/gen_t_subr_prf

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



CVS commit: src/tests/kernel

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:09:46 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
add printf attribute


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/kernel/gen_t_subr_prf

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

Modified files:

Index: src/tests/kernel/gen_t_subr_prf
diff -u src/tests/kernel/gen_t_subr_prf:1.6 src/tests/kernel/gen_t_subr_prf:1.7
--- src/tests/kernel/gen_t_subr_prf:1.6	Mon May 20 23:46:45 2019
+++ src/tests/kernel/gen_t_subr_prf	Tue May 21 00:09:46 2019
@@ -122,9 +122,7 @@ ATF_TC_HEAD(vasprintf_print, tc)
 atf_tc_set_md_var(tc, "descr", "checks vasprintf works");
 }
 
-int vasp_helper(char **, const char *, ...);
-
-int
+static int __printflike(2, 3)
 vasp_helper(char **buf, const char *fmt, ...)
 {
 	va_list ap;



CVS commit: src/tests/kernel

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 21 04:10:20 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
unexpand


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/kernel/gen_t_subr_prf

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

Modified files:

Index: src/tests/kernel/gen_t_subr_prf
diff -u src/tests/kernel/gen_t_subr_prf:1.7 src/tests/kernel/gen_t_subr_prf:1.8
--- src/tests/kernel/gen_t_subr_prf:1.7	Tue May 21 00:09:46 2019
+++ src/tests/kernel/gen_t_subr_prf	Tue May 21 00:10:20 2019
@@ -23,7 +23,7 @@ cat << _EOF > $2
 #undef putchar
 #define putchar xputchar
 
-#define	kmem_alloc(n, f)	malloc(n)
+#define kmem_alloc(n, f)	malloc(n)
 
 static int putchar(char c, int foo, void *b)
 {
@@ -57,7 +57,7 @@ static void (*v_flush)(void) = empty;
 ATF_TC(snprintf_print);
 ATF_TC_HEAD(snprintf_print, tc)
 {
-atf_tc_set_md_var(tc, "descr", "checks snprintf print");
+	atf_tc_set_md_var(tc, "descr", "checks snprintf print");
 }
  
 ATF_TC_BODY(snprintf_print, tc)
@@ -74,7 +74,7 @@ ATF_TC_BODY(snprintf_print, tc)
 ATF_TC(snprintf_print_overflow);
 ATF_TC_HEAD(snprintf_print_overflow, tc)
 {
-atf_tc_set_md_var(tc, "descr", "checks snprintf print with overflow");
+	atf_tc_set_md_var(tc, "descr", "checks snprintf print with overflow");
 }
  
 ATF_TC_BODY(snprintf_print_overflow, tc)
@@ -91,7 +91,7 @@ ATF_TC_BODY(snprintf_print_overflow, tc)
 ATF_TC(snprintf_count);
 ATF_TC_HEAD(snprintf_count, tc)
 {
-atf_tc_set_md_var(tc, "descr", "checks snprintf count");
+	atf_tc_set_md_var(tc, "descr", "checks snprintf count");
 }
  
 ATF_TC_BODY(snprintf_count, tc)
@@ -105,7 +105,7 @@ ATF_TC_BODY(snprintf_count, tc)
 ATF_TC(snprintf_count_overflow);
 ATF_TC_HEAD(snprintf_count_overflow, tc)
 {
-atf_tc_set_md_var(tc, "descr", "checks snprintf count with overflow");
+	atf_tc_set_md_var(tc, "descr", "checks snprintf count with overflow");
 }
  
 ATF_TC_BODY(snprintf_count_overflow, tc)
@@ -119,7 +119,7 @@ ATF_TC_BODY(snprintf_count_overflow, tc)
 ATF_TC(vasprintf_print);
 ATF_TC_HEAD(vasprintf_print, tc)
 {
-atf_tc_set_md_var(tc, "descr", "checks vasprintf works");
+	atf_tc_set_md_var(tc, "descr", "checks vasprintf works");
 }
 
 static int __printflike(2, 3)
@@ -149,13 +149,13 @@ ATF_TC_BODY(vasprintf_print, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
-ATF_TP_ADD_TC(tp, snprintf_print);
-ATF_TP_ADD_TC(tp, snprintf_print_overflow);
-ATF_TP_ADD_TC(tp, snprintf_count);
-ATF_TP_ADD_TC(tp, snprintf_count_overflow);
+	ATF_TP_ADD_TC(tp, snprintf_print);
+	ATF_TP_ADD_TC(tp, snprintf_print_overflow);
+	ATF_TP_ADD_TC(tp, snprintf_count);
+	ATF_TP_ADD_TC(tp, snprintf_count_overflow);
 	ATF_TP_ADD_TC(tp, vasprintf_print);
 
-return atf_no_error();
+	return atf_no_error();
 }
 _EOF
 



Re: CVS commit: src/distrib/sets/lists/comp

2019-05-20 Thread Maxime Villard

Can we revert the whole thing now please?

RDMSR/WRMSR are privileged instructions, and cannot work in cpuctl. I
don't understand how adding RDMWR/WRMSR in cpuctl could have possibly
worked on any AMD configuration.

There is PR/54220, now.


Le 11/05/2019 à 15:32, Christos Zoulas a écrit :

Well, the code in cpuctl calls rdmsr() and the build was broken. Please fix it 
properly (and refrain from cursing on the lists while you are at it).

christos


On May 11, 2019, at 9:08 AM, Maxime Villard  wrote:

What the fuck are you all doing?

Last I heard, RDMSR/WRMSR are privileged instructions, not executable in
userland.


Le 11/05/2019 à 15:04, Christos Zoulas a écrit :

Module Name:src
Committed By:   christos
Date:   Sat May 11 13:04:40 UTC 2019
Modified Files:
src/distrib/sets/lists/comp: md.i386
Log Message:
Add cpufunc.h
To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/distrib/sets/lists/comp/md.i386
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Re: CVS commit: src/distrib/sets/lists/comp

2019-05-20 Thread Christos Zoulas
I was not the one who added it... I reverted my part.

christos

> On May 20, 2019, at 12:37 AM, Maxime Villard  wrote:
> 
> Can we revert the whole thing now please?
> 
> RDMSR/WRMSR are privileged instructions, and cannot work in cpuctl. I
> don't understand how adding RDMWR/WRMSR in cpuctl could have possibly
> worked on any AMD configuration.
> 
> There is PR/54220, now.
> 
> 
> Le 11/05/2019 à 15:32, Christos Zoulas a écrit :
>> Well, the code in cpuctl calls rdmsr() and the build was broken. Please fix 
>> it properly (and refrain from cursing on the lists while you are at it).
>> christos
>>> On May 11, 2019, at 9:08 AM, Maxime Villard  wrote:
>>> 
>>> What the fuck are you all doing?
>>> 
>>> Last I heard, RDMSR/WRMSR are privileged instructions, not executable in
>>> userland.
>>> 
>>> 
>>> Le 11/05/2019 à 15:04, Christos Zoulas a écrit :
 Module Name:   src
 Committed By:  christos
 Date:  Sat May 11 13:04:40 UTC 2019
 Modified Files:
src/distrib/sets/lists/comp: md.i386
 Log Message:
 Add cpufunc.h
 To generate a diff of this commit:
 cvs rdiff -u -r1.187 -r1.188 src/distrib/sets/lists/comp/md.i386
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


CVS commit: src/tests/kernel

2019-05-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue May 21 03:46:45 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
Make the t_subr_prf test build after changes to sys/kern/subr_prf.c
and while here add a simple test for the new kernel vasprintf().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/kernel/gen_t_subr_prf

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



CVS commit: src/tests/kernel

2019-05-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue May 21 03:46:45 UTC 2019

Modified Files:
src/tests/kernel: gen_t_subr_prf

Log Message:
Make the t_subr_prf test build after changes to sys/kern/subr_prf.c
and while here add a simple test for the new kernel vasprintf().


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/kernel/gen_t_subr_prf

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

Modified files:

Index: src/tests/kernel/gen_t_subr_prf
diff -u src/tests/kernel/gen_t_subr_prf:1.5 src/tests/kernel/gen_t_subr_prf:1.6
--- src/tests/kernel/gen_t_subr_prf:1.5	Sun Feb  3 10:48:47 2019
+++ src/tests/kernel/gen_t_subr_prf	Tue May 21 03:46:45 2019
@@ -6,6 +6,7 @@ cat << _EOF > $2
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -16,11 +17,14 @@ cat << _EOF > $2
 #undef vsnprintf
 #undef sprintf
 #undef vsprintf
+#undef vasprintf
 
 #define KPRINTF_BUFSIZE 1024
 #undef putchar
 #define putchar xputchar
 
+#define	kmem_alloc(n, f)	malloc(n)
+
 static int putchar(char c, int foo, void *b)
 {
 	return fputc(c, stderr);
@@ -112,12 +116,46 @@ ATF_TC_BODY(snprintf_count_overflow, tc)
 	ATF_CHECK_EQ(i, 16);
 }
 
+ATF_TC(vasprintf_print);
+ATF_TC_HEAD(vasprintf_print, tc)
+{
+atf_tc_set_md_var(tc, "descr", "checks vasprintf works");
+}
+
+int vasp_helper(char **, const char *, ...);
+
+int
+vasp_helper(char **buf, const char *fmt, ...)
+{
+	va_list ap;
+	int ret;
+
+	va_start(ap, fmt);
+	ret = vasprintf(buf, fmt, ap);
+	va_end(ap);
+	return ret;
+}
+
+ATF_TC_BODY(vasprintf_print, tc)
+{
+	int i;
+	char *buf;
+
+	buf = NULL;
+	i =  vasp_helper(&buf, "N=%d C=%c S=%s", 7, 'x', "abc");
+	ATF_CHECK_EQ(i, 13);
+	ATF_CHECK(buf != NULL);
+	ATF_CHECK_STREQ(buf, "N=7 C=x S=abc");
+	free(buf);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 ATF_TP_ADD_TC(tp, snprintf_print);
 ATF_TP_ADD_TC(tp, snprintf_print_overflow);
 ATF_TP_ADD_TC(tp, snprintf_count);
 ATF_TP_ADD_TC(tp, snprintf_count_overflow);
+	ATF_TP_ADD_TC(tp, vasprintf_print);
 
 return atf_no_error();
 }



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

2019-05-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May 21 03:42:52 UTC 2019

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts

Log Message:
it's called "snps,dis_u2_susphy_quirk" in both upstream and what
our drivers expect, not "snps,dis-u2-susphy-quirk".

unfortunately, my rock64 usb still seems to be non functional.

from jmcneill@.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/rk3328-rock64.dts

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

Modified files:

Index: src/sys/arch/arm/dts/rk3328-rock64.dts
diff -u src/sys/arch/arm/dts/rk3328-rock64.dts:1.1 src/sys/arch/arm/dts/rk3328-rock64.dts:1.2
--- src/sys/arch/arm/dts/rk3328-rock64.dts:1.1	Thu Jun 21 10:46:39 2018
+++ src/sys/arch/arm/dts/rk3328-rock64.dts	Tue May 21 03:42:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328-rock64.dts,v 1.1 2018/06/21 10:46:39 jmcneill Exp $ */
+/* $NetBSD: rk3328-rock64.dts,v 1.2 2019/05/21 03:42:52 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -34,5 +34,5 @@
 	snps,phyif-utmi-bits = <16>;
 	snps,dis-enblslpm-quirk;
 	snps,dis-u2-freeclk-exists-quirk;
-	snps,dis-u2-susphy-quirk;
+	snps,dis_u2_susphy_quirk;
 };



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

2019-05-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue May 21 03:42:52 UTC 2019

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts

Log Message:
it's called "snps,dis_u2_susphy_quirk" in both upstream and what
our drivers expect, not "snps,dis-u2-susphy-quirk".

unfortunately, my rock64 usb still seems to be non functional.

from jmcneill@.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/dts/rk3328-rock64.dts

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



Re: CVS commit: src/sys

2019-05-20 Thread Robert Elz
Date:Mon, 20 May 2019 16:35:45 -0400
From:"Christos Zoulas" 
Message-ID:  <20190520203545.b41f6f...@cvs.netbsd.org>

  | Add a simple vasprintf() implementation that uses 2 passes, one to compute
  | the length and a second to place the data. Requested by rmind@

Shouldn't there be a va_end(cap) in there?

For that the easy way would be to use cap for the kprintf() that
calculates the length, and then use ap for the one that fills in
the data, so that one can remain as "return kprintf();" and get
the func call optimised into a jump).

kre



CVS commit: src/sys/kern

2019-05-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue May 21 00:57:54 UTC 2019

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

Log Message:
Need  for kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/kern/subr_prf.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/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.177 src/sys/kern/subr_prf.c:1.178
--- src/sys/kern/subr_prf.c:1.177	Mon May 20 20:35:45 2019
+++ src/sys/kern/subr_prf.c	Tue May 21 00:57:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.177 2019/05/20 20:35:45 christos Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.178 2019/05/21 00:57:54 kre Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.177 2019/05/20 20:35:45 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.178 2019/05/21 00:57:54 kre Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -67,6 +67,7 @@ __KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 



CVS commit: src/sys/kern

2019-05-20 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue May 21 00:57:54 UTC 2019

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

Log Message:
Need  for kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/kern/subr_prf.c

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



CVS commit: src/lib/libcurses

2019-05-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon May 20 22:17:41 UTC 2019

Modified Files:
src/lib/libcurses: add_wch.c add_wchstr.c addbytes.c addch.c
addchnstr.c addnstr.c addwstr.c copywin.c cr_put.c curses_private.h
delch.c erase.c fileio.h get_wch.c get_wstr.c getch.c getstr.c
in_wch.c in_wchstr.c inch.c inchstr.c ins_wch.c ins_wstr.c insch.c
insstr.c instr.c inwstr.c line.c move.c newwin.c printw.c putchar.c
refresh.c scroll.c

Log Message:
Back out incorrect fix for PR 53617 and fix it in a different way.
Keep track of the cursor location, if getch is called without a refresh
and without pending updates (dirty windows) then move the cursor to the
correct location directly.  Doing this prevents unnecessary refreshes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/add_wch.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libcurses/add_wchstr.c \
src/lib/libcurses/addchnstr.c src/lib/libcurses/get_wstr.c \
src/lib/libcurses/in_wchstr.c src/lib/libcurses/inwstr.c
cvs rdiff -u -r1.50 -r1.51 src/lib/libcurses/addbytes.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libcurses/addch.c src/lib/libcurses/move.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libcurses/addnstr.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/addwstr.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libcurses/copywin.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libcurses/cr_put.c
cvs rdiff -u -r1.69 -r1.70 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/delch.c \
src/lib/libcurses/scroll.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/erase.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libcurses/fileio.h \
src/lib/libcurses/in_wch.c src/lib/libcurses/insstr.c \
src/lib/libcurses/instr.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.71 -r1.72 src/lib/libcurses/getch.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/getstr.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libcurses/inch.c \
src/lib/libcurses/ins_wch.c src/lib/libcurses/ins_wstr.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libcurses/inchstr.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/insch.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libcurses/line.c
cvs rdiff -u -r1.55 -r1.56 src/lib/libcurses/newwin.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/printw.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libcurses/putchar.c
cvs rdiff -u -r1.109 -r1.110 src/lib/libcurses/refresh.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/libcurses/add_wch.c
diff -u src/lib/libcurses/add_wch.c:1.7 src/lib/libcurses/add_wch.c:1.8
--- src/lib/libcurses/add_wch.c:1.7	Wed Apr 24 07:09:44 2019
+++ src/lib/libcurses/add_wch.c	Mon May 20 22:17:41 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wch.c,v 1.7 2019/04/24 07:09:44 blymn Exp $ */
+/*   $NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: add_wch.c,v 1.7 2019/04/24 07:09:44 blymn Exp $");
+__RCSID("$NetBSD: add_wch.c,v 1.8 2019/05/20 22:17:41 blymn Exp $");
 #endif /* not lint */
 
 #include 
@@ -76,7 +76,7 @@ mvadd_wch(int y, int x, const cchar_t *w
 int
 mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
 {
-	if (wmove(win, y, x) == ERR)
+	if (_cursesi_wmove(win, y, x, 0) == ERR)
 		return ERR;
 
 	return wadd_wch(win, wch);
@@ -92,11 +92,12 @@ mvwadd_wch(WINDOW *win, int y, int x, co
 int
 wadd_wch(WINDOW *win, const cchar_t *wch)
 {
-	int x = win->curx, y = win->cury;
+	int y = win->cury;
 	__LINE *lnp = NULL;
 
 #ifdef DEBUG
 	int i;
+	int x = win->curx;
 
 	for (i = 0; i < win->maxy; i++) {
 		assert(win->alines[i]->sentinel == SENTINEL_VALUE);
@@ -105,5 +106,5 @@ wadd_wch(WINDOW *win, const cchar_t *wch
 	win, x, y);
 #endif
 	lnp = win->alines[y];
-	return _cursesi_addwchar(win, &lnp, &y, &x, wch, 1);
+	return _cursesi_addwchar(win, &lnp, &(win->cury), &(win->curx), wch, 1);
 }

Index: src/lib/libcurses/add_wchstr.c
diff -u src/lib/libcurses/add_wchstr.c:1.6 src/lib/libcurses/add_wchstr.c:1.7
--- src/lib/libcurses/add_wchstr.c:1.6	Thu Nov 22 22:16:45 2018
+++ src/lib/libcurses/add_wchstr.c	Mon May 20 22:17:41 2019
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
+/*   $NetBSD: add_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.7 2019/05/20 22:17:41 blymn Exp $");
 #endif/* not lint */
 
 #include 
@@ -120,7 +120,7 @@ mvadd_wchnstr(int y, int x, const cchar_
 int
 mvwadd_wchnstr(WINDOW *win, int y, int x, const cchar_t *wchstr, int n)
 {
-	if (wmove(win, y, x) == ERR)
+	if (_cursesi_wmove(win, y, x, 0) == ERR)
 		return ERR;
 
 	return wadd_wchnstr(win, wchstr, n);
Index: src/l

CVS commit: src/lib/libcurses

2019-05-20 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon May 20 22:17:41 UTC 2019

Modified Files:
src/lib/libcurses: add_wch.c add_wchstr.c addbytes.c addch.c
addchnstr.c addnstr.c addwstr.c copywin.c cr_put.c curses_private.h
delch.c erase.c fileio.h get_wch.c get_wstr.c getch.c getstr.c
in_wch.c in_wchstr.c inch.c inchstr.c ins_wch.c ins_wstr.c insch.c
insstr.c instr.c inwstr.c line.c move.c newwin.c printw.c putchar.c
refresh.c scroll.c

Log Message:
Back out incorrect fix for PR 53617 and fix it in a different way.
Keep track of the cursor location, if getch is called without a refresh
and without pending updates (dirty windows) then move the cursor to the
correct location directly.  Doing this prevents unnecessary refreshes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/add_wch.c
cvs rdiff -u -r1.6 -r1.7 src/lib/libcurses/add_wchstr.c \
src/lib/libcurses/addchnstr.c src/lib/libcurses/get_wstr.c \
src/lib/libcurses/in_wchstr.c src/lib/libcurses/inwstr.c
cvs rdiff -u -r1.50 -r1.51 src/lib/libcurses/addbytes.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libcurses/addch.c src/lib/libcurses/move.c
cvs rdiff -u -r1.15 -r1.16 src/lib/libcurses/addnstr.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/addwstr.c
cvs rdiff -u -r1.17 -r1.18 src/lib/libcurses/copywin.c
cvs rdiff -u -r1.33 -r1.34 src/lib/libcurses/cr_put.c
cvs rdiff -u -r1.69 -r1.70 src/lib/libcurses/curses_private.h
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/delch.c \
src/lib/libcurses/scroll.c
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/erase.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libcurses/fileio.h \
src/lib/libcurses/in_wch.c src/lib/libcurses/insstr.c \
src/lib/libcurses/instr.c
cvs rdiff -u -r1.21 -r1.22 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.71 -r1.72 src/lib/libcurses/getch.c
cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/getstr.c
cvs rdiff -u -r1.12 -r1.13 src/lib/libcurses/inch.c \
src/lib/libcurses/ins_wch.c src/lib/libcurses/ins_wstr.c
cvs rdiff -u -r1.8 -r1.9 src/lib/libcurses/inchstr.c
cvs rdiff -u -r1.23 -r1.24 src/lib/libcurses/insch.c
cvs rdiff -u -r1.9 -r1.10 src/lib/libcurses/line.c
cvs rdiff -u -r1.55 -r1.56 src/lib/libcurses/newwin.c
cvs rdiff -u -r1.27 -r1.28 src/lib/libcurses/printw.c
cvs rdiff -u -r1.22 -r1.23 src/lib/libcurses/putchar.c
cvs rdiff -u -r1.109 -r1.110 src/lib/libcurses/refresh.c

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



CVS commit: src/sys

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 20:35:45 UTC 2019

Modified Files:
src/sys/kern: subr_prf.c
src/sys/sys: systm.h

Log Message:
Add a simple vasprintf() implementation that uses 2 passes, one to compute
the length and a second to place the data. Requested by rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/kern/subr_prf.c
cvs rdiff -u -r1.284 -r1.285 src/sys/sys/systm.h

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



CVS commit: src/sys

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 20:35:45 UTC 2019

Modified Files:
src/sys/kern: subr_prf.c
src/sys/sys: systm.h

Log Message:
Add a simple vasprintf() implementation that uses 2 passes, one to compute
the length and a second to place the data. Requested by rmind@


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/kern/subr_prf.c
cvs rdiff -u -r1.284 -r1.285 src/sys/sys/systm.h

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

Modified files:

Index: src/sys/kern/subr_prf.c
diff -u src/sys/kern/subr_prf.c:1.176 src/sys/kern/subr_prf.c:1.177
--- src/sys/kern/subr_prf.c:1.176	Mon Jan 14 14:21:54 2019
+++ src/sys/kern/subr_prf.c	Mon May 20 16:35:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $	*/
+/*	$NetBSD: subr_prf.c,v 1.177 2019/05/20 20:35:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1986, 1988, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.176 2019/01/14 19:21:54 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_prf.c,v 1.177 2019/05/20 20:35:45 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1181,6 +1181,18 @@ vsnprintf(char *bf, size_t size, const c
 	return retval;
 }
 
+int
+vasprintf(char **bf, const char *fmt, va_list ap)
+{
+	int retval;
+	va_list cap;
+
+	va_copy(cap, ap);
+	retval = kprintf(fmt, TOBUFONLY, NULL, NULL, ap) + 1;
+	*bf = kmem_alloc(retval, KM_SLEEP);
+	return vsnprintf(*bf, retval, fmt, cap);
+}
+
 /*
  * kprintf: scaled down version of printf(3).
  *

Index: src/sys/sys/systm.h
diff -u src/sys/sys/systm.h:1.284 src/sys/sys/systm.h:1.285
--- src/sys/sys/systm.h:1.284	Sat May  4 06:07:11 2019
+++ src/sys/sys/systm.h	Mon May 20 16:35:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: systm.h,v 1.284 2019/05/04 10:07:11 maxv Exp $	*/
+/*	$NetBSD: systm.h,v 1.285 2019/05/20 20:35:45 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -236,6 +236,8 @@ void	printf(const char *, ...) __printfl
 
 int	snprintf(char *, size_t, const char *, ...) __printflike(3, 4);
 
+int	vasprintf(char **, const char *, va_list) __printflike(2, 0);
+
 void	vprintf(const char *, va_list) __printflike(1, 0);
 
 int	vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0);



CVS commit: src/share/man/man9

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 20:25:09 UTC 2019

Modified Files:
src/share/man/man9: kprintf.9

Log Message:
document vasprintf


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/share/man/man9/kprintf.9

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

Modified files:

Index: src/share/man/man9/kprintf.9
diff -u src/share/man/man9/kprintf.9:1.37 src/share/man/man9/kprintf.9:1.38
--- src/share/man/man9/kprintf.9:1.37	Sun May 27 17:09:39 2018
+++ src/share/man/man9/kprintf.9	Mon May 20 16:25:09 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: kprintf.9,v 1.37 2018/05/27 21:09:39 maya Exp $
+.\" $NetBSD: kprintf.9,v 1.38 2019/05/20 20:25:09 christos Exp $
 .\"
 .\" Copyright (c) 1998, 2002, 2007, 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 27, 2018
+.Dd May 20, 2019
 .Dt KPRINTF 9
 .Os
 .Sh NAME
@@ -35,6 +35,7 @@
 .Nm printf ,
 .Nm printf_nolog ,
 .Nm snprintf ,
+.Nm vasrintf ,
 .Nm vprintf ,
 .Nm vsnprintf ,
 .Nm uprintf ,
@@ -69,6 +70,8 @@
 .Fn "printf_nolog" "const char *format" "..."
 .Ft int
 .Fn "snprintf" "char *buf" "size_t size" "const char *format" "..."
+.Ft int
+.Fn "vasprintf" "char **buf" "const char *format" "va_list ap"
 .Ft void
 .Fn "vprintf" "const char *format" "va_list ap"
 .Ft int
@@ -138,12 +141,19 @@ function is identical to
 .Fn printf ,
 except it does not send the data to the system log.
 The functions
-.Fn snprintf
+.Fn snprintf ,
+.Fn vasprintf
 and
 .Fn vsnprintf
 write output to a string buffer.
-These four functions work similarly to their user space counterparts,
+These five functions work similarly to their user space counterparts,
 and are not described in detail here.
+The
+.Fn vasprintf
+function allocates memory with
+.Xr kmem_alloc 9
+and it is the callers responsibility to free the returned string with
+.Cr kmem_free .
 .Pp
 The functions
 .Fn uprintf



CVS commit: src/share/man/man9

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 20:25:09 UTC 2019

Modified Files:
src/share/man/man9: kprintf.9

Log Message:
document vasprintf


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/share/man/man9/kprintf.9

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



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

2019-05-20 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon May 20 20:17:25 UTC 2019

Modified Files:
src/sys/arch/arm/altera: cycv_platform.c

Log Message:
make CPU 1 bootstrapping work even if the kernel is not loaded close to PA 0.

More precisely, we used "B cpu_mpstart", which worked for small addresses and
thus does not work in the EFI case.
It is now replaced by a "LDR PC, =cpu_mpstart", which works for arbitrary
addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/altera/cycv_platform.c

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



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

2019-05-20 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon May 20 20:17:25 UTC 2019

Modified Files:
src/sys/arch/arm/altera: cycv_platform.c

Log Message:
make CPU 1 bootstrapping work even if the kernel is not loaded close to PA 0.

More precisely, we used "B cpu_mpstart", which worked for small addresses and
thus does not work in the EFI case.
It is now replaced by a "LDR PC, =cpu_mpstart", which works for arbitrary
addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/altera/cycv_platform.c

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

Modified files:

Index: src/sys/arch/arm/altera/cycv_platform.c
diff -u src/sys/arch/arm/altera/cycv_platform.c:1.10 src/sys/arch/arm/altera/cycv_platform.c:1.11
--- src/sys/arch/arm/altera/cycv_platform.c:1.10	Thu Jan 31 13:06:10 2019
+++ src/sys/arch/arm/altera/cycv_platform.c	Mon May 20 20:17:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $ */
+/* $NetBSD: cycv_platform.c,v 1.11 2019/05/20 20:17:25 aymeric Exp $ */
 
 /* This file is in the public domain. */
 
@@ -7,7 +7,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.10 2019/01/31 13:06:10 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_platform.c,v 1.11 2019/05/20 20:17:25 aymeric Exp $");
 
 #define	_ARM32_BUS_DMA_PRIVATE
 #include 
@@ -92,18 +92,21 @@ cycv_mpstart(void)
 	bus_space_write_4(bst, bsh_scu, SCU_CTL,
 		bus_space_read_4(bst, bsh_scu, SCU_CTL) | SCU_CTL_SCU_ENA);
 
-	const uint32_t startfunc = (uint32_t) KERN_VTOPHYS((vaddr_t)cpu_mpstart);
+	const uint32_t startfunc =
+		(uint32_t) KERN_VTOPHYS((vaddr_t) cpu_mpstart);
 
 	/*
-	 * We place a "B cortex_mpstart" at address 0 in order to bootstrap
+	 * We place a "LDR PC, =cpu_mpstart" at address 0 in order to bootstrap
 	 * CPU 1. We can't use the similar feature of the Boot ROM because
-	 * it was unmapped by u-boot in favor of the SDRAM. Plus the dtb is
-	 * stored very low in RAM so we can't re-map the Boot ROM easily.
+	 * it was unmapped by u-boot in favor of the SDRAM.
 	 */
 	pmap_map_chunk(kernel_l1pt.pv_va, CYCV_SDRAM_VBASE, CYCV_SDRAM_BASE,
 		L1_S_SIZE, VM_PROT_READ|VM_PROT_WRITE, PMAP_NOCACHE);
-	*(volatile uint32_t *) CYCV_SDRAM_VBASE =
-	htole32(0xea00 | ((startfunc - 8 - 0x0) >> 2));
+
+	/* 0: LDR PC, [PC, #0x18] -> loads address at 0x20 into PC */
+	*(volatile uint32_t *) CYCV_SDRAM_VBASE = htole32(0xe59ff018);
+	*(volatile uint32_t *) (CYCV_SDRAM_VBASE + 0x20) = startfunc;
+
 	pmap_unmap_chunk(kernel_l1pt.pv_va, CYCV_SDRAM_VBASE, L1_S_SIZE);
 
 	bus_space_write_4(bst, bsh_rst, CYCV_RSTMGR_MPUMODRST,



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

2019-05-20 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon May 20 20:14:08 UTC 2019

Modified Files:
src/sys/arch/arm/altera: cycv_dwcmmc.c

Log Message:
use NULL instead of cycv_dwcmmc_card_detect() for sc_card_detect.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/altera/cycv_dwcmmc.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/altera/cycv_dwcmmc.c
diff -u src/sys/arch/arm/altera/cycv_dwcmmc.c:1.1 src/sys/arch/arm/altera/cycv_dwcmmc.c:1.2
--- src/sys/arch/arm/altera/cycv_dwcmmc.c:1.1	Wed Sep 19 17:31:38 2018
+++ src/sys/arch/arm/altera/cycv_dwcmmc.c	Mon May 20 20:14:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cycv_dwcmmc.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $ */
+/* $NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.1 2018/09/19 17:31:38 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.c,v 1.2 2019/05/20 20:14:08 aymeric Exp $");
 
 #include 
 #include 
@@ -47,8 +47,6 @@ __KERNEL_RCSID(0, "$NetBSD: cycv_dwcmmc.
 static int	cycv_dwcmmc_match(device_t, cfdata_t, void *);
 static void	cycv_dwcmmc_attach(device_t, device_t, void *);
 
-static int	cycv_dwcmmc_card_detect(struct dwc_mmc_softc *);
-
 struct cycv_dwcmmc_softc {
 	struct dwc_mmc_softc	sc;
 	struct clk		*sc_clk_biu;
@@ -130,7 +128,7 @@ cycv_dwcmmc_attach(device_t parent, devi
 	sc->sc_fifo_reg = FIFO_REG;
 	sc->sc_flags = DWC_MMC_F_USE_HOLD_REG | DWC_MMC_F_DMA;
 
-	sc->sc_card_detect = cycv_dwcmmc_card_detect;
+	sc->sc_card_detect = NULL;
 	sc->sc_write_protect = NULL;
 
 	aprint_naive("\n");
@@ -153,11 +151,3 @@ cycv_dwcmmc_attach(device_t parent, devi
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 }
-
-static int
-cycv_dwcmmc_card_detect(struct dwc_mmc_softc *sc)
-{
-	/* Card detection is broken on the nanosoc. Pretend it's present. */
-
-	return 0;
-}



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

2019-05-20 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Mon May 20 20:14:08 UTC 2019

Modified Files:
src/sys/arch/arm/altera: cycv_dwcmmc.c

Log Message:
use NULL instead of cycv_dwcmmc_card_detect() for sc_card_detect.


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

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



CVS commit: src/tools/m68k-elf2aout/sys

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 18:24:58 UTC 2019

Modified Files:
src/tools/m68k-elf2aout/sys: aout_mids.h exec_elf.h

Log Message:
sync with arm.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tools/m68k-elf2aout/sys/aout_mids.h
cvs rdiff -u -r1.2 -r1.3 src/tools/m68k-elf2aout/sys/exec_elf.h

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

Modified files:

Index: src/tools/m68k-elf2aout/sys/aout_mids.h
diff -u src/tools/m68k-elf2aout/sys/aout_mids.h:1.1 src/tools/m68k-elf2aout/sys/aout_mids.h:1.2
--- src/tools/m68k-elf2aout/sys/aout_mids.h:1.1	Sat Jul 16 11:52:02 2011
+++ src/tools/m68k-elf2aout/sys/aout_mids.h	Mon May 20 14:24:57 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: aout_mids.h,v 1.1 2011/07/16 15:52:02 tsutsui Exp $ */
+/* $NetBSD: aout_mids.h,v 1.2 2019/05/20 18:24:57 christos Exp $ */
 
 /*
  * Copyright (c) 2009, The NetBSD Foundation, Inc.
@@ -25,44 +25,56 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _SYS_MACHINE_IDS_H_
-#define _SYS_MACHINE_IDS_H_
-
+#ifndef _SYS_AOUT_MIDS_H_
+#define _SYS_AOUT_MIDS_H_
 
 /*
  * a_mid - keep sorted in numerical order for sanity's sake
  * ensure that: 0 < mid < 0x3ff
+ *
+ * NB: These are still being used in kernel core files.
  */
-#define	MID_ZERO	0	/* unknown - implementation dependent */
-#define	MID_SUN010	1	/* sun 68010/68020 binary */
-#define	MID_SUN020	2	/* sun 68020-only binary */
-#define	MID_PC386	100	/* 386 PC binary. (so quoth BFD) */
-#define	MID_HP200	200	/* hp200 (68010) BSD binary */
-#define	MID_I386	134	/* i386 BSD binary */
-#define	MID_M68K	135	/* m68k BSD binary with 8K page sizes */
-#define	MID_M68K4K	136	/* m68k BSD binary with 4K page sizes */
-#define	MID_NS32532	137	/* ns32532 */
-#define	MID_SPARC	138	/* sparc */
-#define	MID_PMAX	139	/* pmax */
-#define	MID_VAX1K	140	/* VAX 1K page size binaries */
-#define	MID_ALPHA	141	/* Alpha BSD binary */
-#define	MID_MIPS	142	/* big-endian MIPS */
-#define	MID_ARM6	143	/* ARM6 */
-#define	MID_M680002K	144	/* m68000 with 2K page sizes */
-#define	MID_SH3		145	/* SH3 */
-#define	MID_POWERPC	149	/* big-endian PowerPC */
-#define	MID_VAX		150	/* VAX */
-/* 151 - MIPS1 */
-/* 152 - MIPS2 */
-#define	MID_M88K	153	/* m88k BSD */
-#define	MID_HPPA	154	/* HP PARISC */
-#define	MID_SH5_64	155	/* LP64 SH5 */
-#define	MID_SPARC64	156	/* LP64 sparc */
-#define	MID_X86_64	157	/* AMD x86-64 */
-#define	MID_SH5_32	158	/* ILP32 SH5 */
-#define	MID_HP200	200	/* hp200 (68010) BSD binary */
-#define	MID_HP300	300	/* hp300 (68020+68881) BSD binary */
-#define	MID_HPUX	0x20C	/* hp200/300 HP-UX binary */
-#define	MID_HPUX800 0x20B   /* hp800 HP-UX binary */
+#define	MID_ZERO	0x000	/* unknown - implementation dependent */
+#define	MID_SUN010	0x001	/* sun 68010/68020 binary */
+#define	MID_SUN020	0x002	/* sun 68020-only binary */
+
+#define	MID_PC386	0x064	/* 386 PC binary. (so quoth BFD) */
+
+#define	MID_I386	0x086	/* i386 BSD binary */
+#define	MID_M68K	0x087	/* m68k BSD binary with 8K page sizes */
+#define	MID_M68K4K	0x088	/* m68k BSD binary with 4K page sizes */
+#define	MID_NS32532	0x089	/* ns32532 */
+#define	MID_SPARC	0x08a	/* sparc */
+#define	MID_PMAX	0x08b	/* pmax */
+#define	MID_VAX1K	0x08c	/* VAX 1K page size binaries */
+#define	MID_ALPHA	0x08d	/* Alpha BSD binary */
+#define	MID_MIPS	0x08e	/* big-endian MIPS */
+#define	MID_ARM6	0x08f	/* ARM6 */
+#define	MID_M680002K	0x090	/* m68000 with 2K page sizes */
+#define	MID_SH3		0x091	/* SH3 */
+
+#define	MID_POWERPC64	0x094	/* big-endian PowerPC 64 */
+#define	MID_POWERPC	0x095	/* big-endian PowerPC */
+#define	MID_VAX		0x096	/* VAX */
+#define	MID_MIPS1	0x097	/* MIPS1 */
+#define	MID_MIPS2	0x098	/* MIPS2 */
+#define	MID_M88K	0x099	/* m88k BSD */
+#define	MID_HPPA	0x09a	/* HP PARISC */
+#define	MID_SH5_64	0x09b	/* LP64 SH5 */
+#define	MID_SPARC64	0x09c	/* LP64 sparc */
+#define	MID_X86_64	0x09d	/* AMD x86-64 */
+#define	MID_SH5_32	0x09e	/* ILP32 SH5 */
+#define	MID_IA64	0x09f	/* Itanium */
+
+#define	MID_AARCH64	0x0b7	/* ARM AARCH64 */
+#define	MID_OR1K	0x0b8	/* OpenRISC 1000 */
+#define	MID_RISCV	0x0b9	/* Risc-V */
+
+#define	MID_HP200	0x0c8	/* hp200 (68010) BSD binary */
+
+#define	MID_HP300	0x12c	/* hp300 (68020+68881) BSD binary */
+
+#define	MID_HPUX800 0x20b   /* hp800 HP-UX binary */
+#define	MID_HPUX	0x20c	/* hp200/300 HP-UX binary */
 
-#endif /* _SYS_MACHINE_IDS_H_ */
+#endif /* _SYS_AOUT_MIDS_H_ */

Index: src/tools/m68k-elf2aout/sys/exec_elf.h
diff -u src/tools/m68k-elf2aout/sys/exec_elf.h:1.2 src/tools/m68k-elf2aout/sys/exec_elf.h:1.3
--- src/tools/m68k-elf2aout/sys/exec_elf.h:1.2	Fri Jan  3 11:50:54 2014
+++ src/tools/m68k-elf2aout/sys/exec_elf.h	Mon May 20 14:24:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.2 2014/01/03 16:50:54 dsl Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.3 2019/05/20 18:24:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Found

CVS commit: src/tools/m68k-elf2aout/sys

2019-05-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon May 20 18:24:58 UTC 2019

Modified Files:
src/tools/m68k-elf2aout/sys: aout_mids.h exec_elf.h

Log Message:
sync with arm.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tools/m68k-elf2aout/sys/aout_mids.h
cvs rdiff -u -r1.2 -r1.3 src/tools/m68k-elf2aout/sys/exec_elf.h

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



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 17:00:58 UTC 2019

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

Log Message:
Usee __BIT()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap.h

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

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.10 src/sys/uvm/pmap/pmap.h:1.11
--- src/sys/uvm/pmap/pmap.h:1.10	Mon May 20 16:58:49 2019
+++ src/sys/uvm/pmap/pmap.h	Mon May 20 17:00:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.10 2019/05/20 16:58:49 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.11 2019/05/20 17:00:57 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -130,7 +130,7 @@ struct pmap {
 	pmap_segtab_t *		pm_segtab;	/* pointers to pages of PTEs */
 	u_int			pm_count;	/* pmap reference count */
 	u_int			pm_flags;
-#define	PMAP_DEFERRED_ACTIVATE	0x0001
+#define	PMAP_DEFERRED_ACTIVATE	__BIT(0)
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vaddr_t			pm_minaddr;
 	vaddr_t			pm_maxaddr;



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 17:00:58 UTC 2019

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

Log Message:
Usee __BIT()


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/uvm/pmap/pmap.h

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



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 16:58:49 UTC 2019

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap.h

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



CVS commit: src/sys/uvm/pmap

2019-05-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon May 20 16:58:49 UTC 2019

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

Log Message:
Trailing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/pmap/pmap.h

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

Modified files:

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.9 src/sys/uvm/pmap/pmap.h:1.10
--- src/sys/uvm/pmap/pmap.h:1.9	Sat Jun 24 05:49:50 2017
+++ src/sys/uvm/pmap/pmap.h	Mon May 20 16:58:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.9 2017/06/24 05:49:50 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.10 2019/05/20 16:58:49 skrll Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -157,11 +157,11 @@ struct pmap_limits {
  */
 #ifdef MULTIPROCESSOR
 #define PMAP_SIZE	offsetof(struct pmap, pm_pai[PMAP_TLB_MAX])
-#else   
+#else
 #define PMAP_SIZE	sizeof(struct pmap)
-#endif  
+#endif
 
-/* 
+/*
  * The pools from which pmap structures and sub-structures are allocated.
  */
 extern struct pool pmap_pmap_pool;



CVS commit: src/sys/dev/fdt

2019-05-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 20 11:12:11 UTC 2019

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

Log Message:
Reduce the number of times we need to call driver match functions. Makes
a noticeable difference in boot time on an ODROID-XU4.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/fdt/fdtbus.c

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

Modified files:

Index: src/sys/dev/fdt/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.27 src/sys/dev/fdt/fdtbus.c:1.28
--- src/sys/dev/fdt/fdtbus.c:1.27	Mon Feb 25 19:28:36 2019
+++ src/sys/dev/fdt/fdtbus.c	Mon May 20 11:12:10 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.27 2019/02/25 19:28:36 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.28 2019/05/20 11:12:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.27 2019/02/25 19:28:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.28 2019/05/20 11:12:10 jmcneill Exp $");
 
 #include 
 #include 
@@ -52,6 +52,7 @@ struct fdt_node {
 	int		n_phandle;
 	const char	*n_name;
 	struct fdt_attach_args n_faa;
+	cfdata_t	n_cf;
 
 	u_int		n_order;
 
@@ -74,6 +75,7 @@ static int	fdt_rescan(device_t, const ch
 static void	fdt_childdet(device_t, device_t);
 
 static int	fdt_scan_submatch(device_t, cfdata_t, const int *, void *);
+static cfdata_t	fdt_scan_best(struct fdt_softc *, struct fdt_node *);
 static void	fdt_scan(struct fdt_softc *, int);
 static void	fdt_add_node(struct fdt_node *);
 static u_int	fdt_get_order(int);
@@ -143,14 +145,22 @@ static int
 fdt_rescan(device_t self, const char *ifattr, const int *locs)
 {
 	struct fdt_softc *sc = device_private(self);
+	struct fdt_node *node;
 	int pass;
 
+	TAILQ_FOREACH(node, &fdt_nodes, n_nodes)
+		node->n_cf = fdt_scan_best(sc, node);
+
 	pass = 0;
 	fdt_need_rescan = false;
 	do {
 		fdt_scan(sc, pass);
 		if (fdt_need_rescan == true) {
 			pass = 0;
+			TAILQ_FOREACH(node, &fdt_nodes, n_nodes) {
+if (node->n_dev == NULL)
+	node->n_cf = fdt_scan_best(sc, node);
+			}
 			fdt_need_rescan = false;
 		} else {
 			pass++;
@@ -280,7 +290,7 @@ fdt_scan(struct fdt_softc *sc, int pass)
 	char buf[FDT_MAX_PATH];
 
 	TAILQ_FOREACH(node, &fdt_nodes, n_nodes) {
-		if (node->n_dev != NULL)
+		if (node->n_dev != NULL || node->n_cf == NULL)
 			continue;
 
 		fdt_init_attach_args(&sc->sc_faa, node, quiet, &faa);
@@ -288,17 +298,16 @@ fdt_scan(struct fdt_softc *sc, int pass)
 		/*
 		 * Make sure we don't attach before a better match in a later pass.
 		 */
-		cfdata_t cf_best = fdt_scan_best(sc, node);
 		cfdata_t cf_pass =
 		config_search_loc(fdt_scan_submatch, node->n_bus, "fdt", locs, &faa);
-		if (cf_best != cf_pass)
+		if (node->n_cf != cf_pass)
 			continue;
 
 		/*
 		 * Attach the device.
 		 */
-		node->n_dev = config_found_sm_loc(node->n_bus, "fdt", locs,
-		&faa, fdtbus_print, fdt_scan_submatch);
+		node->n_dev = config_attach_loc(node->n_bus, cf_pass, locs,
+		&faa, fdtbus_print);
 		if (node->n_dev) {
 			dict = device_properties(node->n_dev);
 			if (fdtbus_get_path(node->n_phandle, buf, sizeof(buf)))



CVS commit: src/sys/dev/fdt

2019-05-20 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon May 20 11:12:11 UTC 2019

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

Log Message:
Reduce the number of times we need to call driver match functions. Makes
a noticeable difference in boot time on an ODROID-XU4.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/fdt/fdtbus.c

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



CVS commit: src/usr.sbin/puffs/mount_9p

2019-05-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon May 20 08:55:31 UTC 2019

Modified Files:
src/usr.sbin/puffs/mount_9p: ninepuffs.c

Log Message:
mount_9p: add missing -u option to the help message


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_9p/ninepuffs.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/ninepuffs.c
diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.25 src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.26
--- src/usr.sbin/puffs/mount_9p/ninepuffs.c:1.25	Fri May 17 08:48:04 2019
+++ src/usr.sbin/puffs/mount_9p/ninepuffs.c	Mon May 20 08:55:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ninepuffs.c,v 1.25 2019/05/17 08:48:04 ozaki-r Exp $	*/
+/*	$NetBSD: ninepuffs.c,v 1.26 2019/05/20 08:55:31 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ninepuffs.c,v 1.25 2019/05/17 08:48:04 ozaki-r Exp $");
+__RCSID("$NetBSD: ninepuffs.c,v 1.26 2019/05/20 08:55:31 ozaki-r Exp $");
 #endif /* !lint */
 
 #include 
@@ -58,7 +58,7 @@ __dead static void
 usage(void)
 {
 
-	fprintf(stderr, "usage: %s [-s] [-o mntopts] [-p port] "
+	fprintf(stderr, "usage: %s [-su] [-o mntopts] [-p port] "
 	"[user@]server[:path] mountpoint\n", getprogname());
 	exit(1);
 }



CVS commit: src/usr.sbin/puffs/mount_9p

2019-05-20 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon May 20 08:55:31 UTC 2019

Modified Files:
src/usr.sbin/puffs/mount_9p: ninepuffs.c

Log Message:
mount_9p: add missing -u option to the help message


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_9p/ninepuffs.c

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