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

2019-10-19 Thread Tom Ivar Helbekkmo
Tobias Nygren  writes:

> Yep, MSI works now. According to the PCI Express Base Specification,
> Revision 3.0, table 7-3, having the bus master bit set to 0 disables
> MSI. Asmedia chip seems to have a bug which makes DMA work regardless ...

Yup - it works just fine! Well done!  :)

ahcisata0: interrupting at irq 8192 (MSI vec 0)

-tih
-- 
Most people who graduate with CS degrees don't understand the significance
of Lisp.  Lisp is the most important idea in computer science.  --Alan Kay


CVS commit: src/lib/libnvmm

2019-10-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Oct 19 19:45:10 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Put back 'default', because llvm apparently doesn't realize that all cases
are covered in the switch.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libnvmm/libnvmm_x86.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/libnvmm/libnvmm_x86.c
diff -u src/lib/libnvmm/libnvmm_x86.c:1.34 src/lib/libnvmm/libnvmm_x86.c:1.35
--- src/lib/libnvmm/libnvmm_x86.c:1.34	Mon Oct 14 10:43:40 2019
+++ src/lib/libnvmm/libnvmm_x86.c	Sat Oct 19 19:45:10 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm_x86.c,v 1.34 2019/10/14 10:43:40 maxv Exp $	*/
+/*	$NetBSD: libnvmm_x86.c,v 1.35 2019/10/19 19:45:10 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -2240,6 +2240,7 @@ get_disp_type(struct x86_instr *instr)
 		}
 		return DISP_4;
 	case 0b11:	/* direct */
+	default:	/* llvm */
 		return DISP_NONE;
 	}
 }



CVS commit: src/lib/libnvmm

2019-10-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Oct 19 19:45:10 UTC 2019

Modified Files:
src/lib/libnvmm: libnvmm_x86.c

Log Message:
Put back 'default', because llvm apparently doesn't realize that all cases
are covered in the switch.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/lib/libnvmm/libnvmm_x86.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

2019-10-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 19 18:04:26 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c locore.S
src/sys/arch/aarch64/include: cpu.h param.h
src/sys/arch/arm/acpi: cpu_acpi.c
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/fdt: cpu_fdt.c
src/sys/arch/arm/include: cpu.h

Log Message:
Increase aarch64 MAXCPUS to 256.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/fdt/cpu_fdt.c
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/arm/include/cpu.h

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



CVS commit: src/sys/arch

2019-10-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct 19 18:04:26 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: cpu.c locore.S
src/sys/arch/aarch64/include: cpu.h param.h
src/sys/arch/arm/acpi: cpu_acpi.c
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/fdt: cpu_fdt.c
src/sys/arch/arm/include: cpu.h

Log Message:
Increase aarch64 MAXCPUS to 256.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/cpu.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/aarch64/aarch64/locore.S
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/aarch64/include/cpu.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/include/param.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/acpi/cpu_acpi.c
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/fdt/cpu_fdt.c
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/arm/include/cpu.h

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.22 src/sys/arch/aarch64/aarch64/cpu.c:1.23
--- src/sys/arch/aarch64/aarch64/cpu.c:1.22	Mon Oct 14 22:53:05 2019
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sat Oct 19 18:04:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.22 2019/10/14 22:53:05 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.23 2019/10/19 18:04:26 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.22 2019/10/14 22:53:05 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.23 2019/10/19 18:04:26 jmcneill Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -69,8 +69,9 @@ static void cpu_setup_sysctl(device_t, s
 #ifdef MULTIPROCESSOR
 uint64_t cpu_mpidr[MAXCPUS];
 
-volatile u_int arm_cpu_hatched __cacheline_aligned = 0;
-volatile uint32_t arm_cpu_mbox __cacheline_aligned = 0;
+volatile u_int aarch64_cpu_mbox[MAXCPUS] __cacheline_aligned = { 0 };
+#define CPU_MBOX_HATCHED	__BIT(0)
+#define	CPU_MBOX_START		__BIT(1)
 u_int arm_cpu_max = 1;
 
 static kmutex_t cpu_hatch_lock;
@@ -126,7 +127,7 @@ cpu_attach(device_t dv, cpuid_t id)
 		/* ci_id is stored by own cpus when hatching */
 
 		cpu_info[ncpu] = ci;
-		if ((arm_cpu_hatched & __BIT(unit)) == 0) {
+		if (cpu_hatched_p(unit) == 0) {
 			ci->ci_dev = dv;
 			dv->dv_private = ci;
 			ci->ci_index = -1;
@@ -499,27 +500,35 @@ cpu_setup_sysctl(device_t dv, struct cpu
 void
 cpu_boot_secondary_processors(void)
 {
+	u_int cpuno;
+
 	if ((boothowto & RB_MD1) != 0)
 		return;
 
 	mutex_init(&cpu_hatch_lock, MUTEX_DEFAULT, IPL_NONE);
 
-	VPRINTF("%s: writing mbox with %#x\n", __func__, arm_cpu_hatched);
+	VPRINTF("%s: starting secondary processors\n", __func__);
 
 	/* send mbox to have secondary processors do cpu_hatch() */
-	atomic_or_32(&arm_cpu_mbox, arm_cpu_hatched);
+	for (cpuno = 1; cpuno < ncpu; cpuno++) {
+		if (cpu_hatched_p(cpuno) == false)
+			continue;
+		atomic_or_uint(&aarch64_cpu_mbox[cpuno], CPU_MBOX_START);
+	}
 	__asm __volatile ("sev; sev; sev");
 
 	/* wait all cpus have done cpu_hatch() */
-	while (membar_consumer(), arm_cpu_mbox & arm_cpu_hatched) {
-		__asm __volatile ("wfe");
+	for (cpuno = 1; cpuno < ncpu; cpuno++) {
+		if (cpu_hatched_p(cpuno) == 0)
+			continue;
+		while (membar_consumer(), aarch64_cpu_mbox[cpuno] & CPU_MBOX_START) {
+			__asm __volatile ("wfe");
+		}
+		/* Add processor to kcpuset */
+		kcpuset_set(kcpuset_attached, cpuno);
 	}
 
 	VPRINTF("%s: secondary processors hatched\n", __func__);
-
-	/* add available processors to kcpuset */
-	uint32_t mbox = arm_cpu_hatched;
-	kcpuset_export_u32(kcpuset_attached, &mbox, sizeof(mbox));
 }
 
 void
@@ -549,12 +558,20 @@ cpu_hatch(struct cpu_info *ci)
 #endif
 
 	/*
-	 * clear my bit of arm_cpu_mbox to tell cpu_boot_secondary_processors().
+	 * clear my bit of aarch64_cpu_mbox to tell cpu_boot_secondary_processors().
 	 * there are cpu0,1,2,3, and if cpu2 is unresponsive,
 	 * ci_index are each cpu0=0, cpu1=1, cpu2=undef, cpu3=2.
 	 * therefore we have to use device_unit instead of ci_index for mbox.
 	 */
-	atomic_and_32(&arm_cpu_mbox, ~__BIT(device_unit(ci->ci_dev)));
+	const u_int cpuno = device_unit(ci->ci_dev);
+	atomic_and_uint(&aarch64_cpu_mbox[cpuno], ~(u_int)CPU_MBOX_START);
 	__asm __volatile ("sev; sev; sev");
 }
+
+bool
+cpu_hatched_p(u_int cpuindex)
+{
+	membar_consumer();
+	return (aarch64_cpu_mbox[cpuindex] & CPU_MBOX_HATCHED) != 0;
+}
 #endif /* MULTIPROCESSOR */

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.41 src/sys/arch/aarch64/aarch64/locore.S:1.42
--- src/sys/arch/aarch64/aarch64/locore.S:1.41	Sun Sep 29 08:33:20 2019
+++ src/sys/arch/aarch64/aarch64/locore.S	Sat Oct 19 18:04:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.41 2019/09/29 08:33:20 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.42 2019/10/19 18:04:26 jmcneill Exp $	*

CVS commit: src/crypto/external/bsd/heimdal/dist/kuser

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:55:51 UTC 2019

Modified Files:
src/crypto/external/bsd/heimdal/dist/kuser: kinit.c

Log Message:
- factor out common code
- use llabs because time_t can be long long.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/heimdal/dist/kuser/kinit.c

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



CVS commit: src/crypto/external/bsd/heimdal/dist/kuser

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:55:51 UTC 2019

Modified Files:
src/crypto/external/bsd/heimdal/dist/kuser: kinit.c

Log Message:
- factor out common code
- use llabs because time_t can be long long.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/heimdal/dist/kuser/kinit.c

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/kuser/kinit.c
diff -u src/crypto/external/bsd/heimdal/dist/kuser/kinit.c:1.2 src/crypto/external/bsd/heimdal/dist/kuser/kinit.c:1.3
--- src/crypto/external/bsd/heimdal/dist/kuser/kinit.c:1.2	Sat Jan 28 16:31:45 2017
+++ src/crypto/external/bsd/heimdal/dist/kuser/kinit.c	Sat Oct 19 11:55:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kinit.c,v 1.2 2017/01/28 21:31:45 christos Exp $	*/
+/*	$NetBSD: kinit.c,v 1.3 2019/10/19 15:55:50 christos Exp $	*/
 
 /*
  * Copyright (c) 1997-2007 Kungliga Tekniska Högskolan
@@ -711,18 +711,18 @@ get_new_tickets(krb5_context context,
 }
 
 if (ticket_life != 0) {
-	if (labs(cred.times.endtime - cred.times.starttime - ticket_life) > 30) {
+	krb5_deltat d = cred.times.endtime - cred.times.starttime;
+	if (llabs(d - ticket_life) > 30) {
 	char life[64];
-	unparse_time_approx(cred.times.endtime - cred.times.starttime,
-life, sizeof(life));
+	unparse_time_approx(d, life, sizeof(life));
 	krb5_warnx(context, N_("NOTICE: ticket lifetime is %s", ""), life);
 	}
 }
 if (renew_life) {
-	if (labs(cred.times.renew_till - cred.times.starttime - renew) > 30) {
+	krb5_deltat d = cred.times.renew_till - cred.times.starttime;
+	if (llabs(d - renew) > 30) {
 	char life[64];
-	unparse_time_approx(cred.times.renew_till - cred.times.starttime,
-life, sizeof(life));
+	unparse_time_approx(d, life, sizeof(life));
 	krb5_warnx(context,
 		   N_("NOTICE: ticket renewable lifetime is %s", ""),
 		   life);



CVS commit: src/sys/external/bsd/acpica/dist/common

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:48:48 UTC 2019

Modified Files:
src/sys/external/bsd/acpica/dist/common: dmtables.c

Log Message:
fix printf format (llvm)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/sys/external/bsd/acpica/dist/common/dmtables.c

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



CVS commit: src/sys/external/bsd/acpica/dist/common

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:48:48 UTC 2019

Modified Files:
src/sys/external/bsd/acpica/dist/common: dmtables.c

Log Message:
fix printf format (llvm)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 \
src/sys/external/bsd/acpica/dist/common/dmtables.c

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

Modified files:

Index: src/sys/external/bsd/acpica/dist/common/dmtables.c
diff -u src/sys/external/bsd/acpica/dist/common/dmtables.c:1.1.1.8 src/sys/external/bsd/acpica/dist/common/dmtables.c:1.2
--- src/sys/external/bsd/acpica/dist/common/dmtables.c:1.1.1.8	Tue Oct 15 12:07:21 2019
+++ src/sys/external/bsd/acpica/dist/common/dmtables.c	Sat Oct 19 11:48:48 2019
@@ -219,7 +219,7 @@ AdCreateTableHeader (
  * makes it easier to rename the disassembled ASL file if needed.
  */
 AcpiOsPrintf (
-"DefinitionBlock (\"\", \"%4.4s\", %hu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+"DefinitionBlock (\"\", \"%4.4s\", %hhu, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
 Table->Signature, Table->Revision,
 Table->OemId, Table->OemTableId, Table->OemRevision);
 }



CVS commit: src/usr.bin/indent

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:44:31 UTC 2019

Modified Files:
src/usr.bin/indent: indent.c indent.h io.c lexi.c parse.c

Log Message:
use stdarg, annotate function as __printflike and fix broken formats.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/indent/io.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/indent/parse.c

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



CVS commit: src/usr.bin/indent

2019-10-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct 19 15:44:31 UTC 2019

Modified Files:
src/usr.bin/indent: indent.c indent.h io.c lexi.c parse.c

Log Message:
use stdarg, annotate function as __printflike and fix broken formats.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.19 -r1.20 src/usr.bin/indent/io.c
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/lexi.c
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/indent/parse.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.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.25 src/usr.bin/indent/indent.c:1.26
--- src/usr.bin/indent/indent.c:1.25	Thu Apr  4 11:22:13 2019
+++ src/usr.bin/indent/indent.c	Sat Oct 19 11:44:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.25 2019/04/04 15:22:13 kamil Exp $	*/
+/*	$NetBSD: indent.c,v 1.26 2019/10/19 15:44:31 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 #include 
 #ifndef lint
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.25 2019/04/04 15:22:13 kamil Exp $");
+__RCSID("$NetBSD: indent.c,v 1.26 2019/10/19 15:44:31 christos Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -360,7 +360,7 @@ main(int argc, char **argv)
 			break;	/* we are at end of comment */
 		if (sc_end >= &save_com[sc_size]) {	/* check for temp buffer
 			 * overflow */
-			diag2(1, "Internal buffer overflow - Move big comment from right after if, while, or whatever");
+			diag(1, "Internal buffer overflow - Move big comment from right after if, while, or whatever");
 			fflush(output);
 			exit(1);
 		}
@@ -429,7 +429,7 @@ main(int argc, char **argv)
 			*sc_end++ = ' ';
 			if (opt.verbose) /* print error msg if the line was
 	 * not already broken */
-			diag2(0, "Line broken");
+			diag(0, "Line broken");
 		}
 		for (t_ptr = token; *t_ptr; ++t_ptr)
 			*sc_end++ = *t_ptr;
@@ -498,7 +498,7 @@ check_type:
 		|| s_com != e_com)	/* must dump end of line */
 		dump_line();
 	if (ps.tos > 1)	/* check for balanced braces */
-		diag2(1, "Stuff missing from end of file");
+		diag(1, "Stuff missing from end of file");
 
 	if (opt.verbose) {
 		printf("There were %d output lines and %d comments\n",
@@ -519,7 +519,7 @@ check_type:
 		(type_code != lbrace || !opt.btype_2)) {
 		/* we should force a broken line here */
 		if (opt.verbose)
-		diag2(0, "Line broken");
+		diag(0, "Line broken");
 		dump_line();
 		ps.want_blank = false;	/* dont insert blank at line start */
 		force_nl = false;
@@ -574,7 +574,7 @@ check_type:
 	case lparen:		/* got a '(' or '[' */
 	/* count parens to make Healy happy */
 	if (++ps.p_l_follow == nitems(ps.paren_indents)) {
-		diag3(0, "Reached internal limit of %d unclosed parens",
+		diag(0, "Reached internal limit of %zu unclosed parens",
 		nitems(ps.paren_indents));
 		ps.p_l_follow--;
 	}
@@ -625,7 +625,7 @@ check_type:
 	ps.not_cast_mask &= (1 << ps.p_l_follow) - 1;
 	if (--ps.p_l_follow < 0) {
 		ps.p_l_follow = 0;
-		diag3(0, "Extra %c", *token);
+		diag(0, "Extra %c", *token);
 	}
 	if (e_code == s_code)	/* if the paren starts the line */
 		ps.paren_level = ps.p_l_follow;	/* then indent it */
@@ -779,7 +779,7 @@ check_type:
 		 * stmt.  It is a bit complicated, because the semicolon might
 		 * be in a for stmt
 		 */
-		diag2(1, "Unbalanced parens");
+		diag(1, "Unbalanced parens");
 		ps.p_l_follow = 0;
 		if (sp_sw) {	/* this is a check for an if, while, etc. with
  * unbalanced parens */
@@ -828,7 +828,7 @@ check_type:
 
 	if (ps.p_l_follow > 0) {	/* check for preceding unbalanced
 	 * parens */
-		diag2(1, "Unbalanced parens");
+		diag(1, "Unbalanced parens");
 		ps.p_l_follow = 0;
 		if (sp_sw) {	/* check for unclosed if, for, etc. */
 		sp_sw = false;
@@ -843,7 +843,7 @@ check_type:
 		 * declaration or an init */
 		di_stack[ps.dec_nest] = dec_ind;
 		if (++ps.dec_nest == nitems(di_stack)) {
-		diag3(0, "Reached internal limit of %d struct levels",
+		diag(0, "Reached internal limit of %zu struct levels",
 			nitems(di_stack));
 		ps.dec_nest--;
 		}
@@ -876,7 +876,7 @@ check_type:
  * declarations */
 		parse(semicolon);
 	if (ps.p_l_follow) {/* check for unclosed if, for, else. */
-		diag2(1, "Unbalanced parens");
+		diag(1, "Unbalanced parens");
 		ps.p_l_follow = 0;
 		sp_sw = false;
 	}
@@ -885,7 +885,7 @@ check_type:
 	if (s_code != e_code && !ps.block_init) {	/* '}' must be first on
 			 * line */
 		if (opt.verbose)
-		diag2(0, "Line broken");
+		diag(0, "Line broken");
 		dump_line();
 	}
 	*e_code++ = '}';
@@ -928,7 +928,7 @@ check_t

CVS commit: src/sys/arch/zaurus/zaurus

2019-10-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 19 14:42:30 UTC 2019

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

Log Message:
Fix a build error with options VERBOSE_INIT_ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/zaurus/zaurus/machdep.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/zaurus/zaurus

2019-10-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 19 14:42:30 UTC 2019

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

Log Message:
Fix a build error with options VERBOSE_INIT_ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/zaurus/zaurus/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/zaurus/zaurus/machdep.c
diff -u src/sys/arch/zaurus/zaurus/machdep.c:1.42 src/sys/arch/zaurus/zaurus/machdep.c:1.43
--- src/sys/arch/zaurus/zaurus/machdep.c:1.42	Tue Jul 16 14:41:49 2019
+++ src/sys/arch/zaurus/zaurus/machdep.c	Sat Oct 19 14:42:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.42 2019/07/16 14:41:49 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.43 2019/10/19 14:42:30 tsutsui Exp $	*/
 /*	$OpenBSD: zaurus_machdep.c,v 1.25 2006/06/20 18:24:04 todd Exp $	*/
 
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.42 2019/07/16 14:41:49 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.43 2019/10/19 14:42:30 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -772,7 +772,7 @@ initarm(void *arg)
 
 #ifdef VERBOSE_INIT_ARM
 	/* Tell the user about the memory */
-	printf("physmemory: %d pages at 0x%08lx -> 0x%08lx\n", physmem,
+	printf("physmemory: %lu pages at 0x%08lx -> 0x%08lx\n", physmem,
 	physical_start, physical_end - 1);
 #endif
 



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

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 13:09:57 UTC 2019

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

Log Message:
evbarm: add dwcwdt(4) to GENERIC64


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.108 src/sys/arch/evbarm/conf/GENERIC64:1.109
--- src/sys/arch/evbarm/conf/GENERIC64:1.108	Tue Oct  1 10:08:05 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Oct 19 13:09:57 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.108 2019/10/01 10:08:05 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.109 2019/10/19 13:09:57 tnn Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -202,6 +202,7 @@ tegratimer*	at fdt?			# Timers
 
 # Watchdog
 bcmpmwdog*	at fdt?			# Broadcom BCM283x watchdog
+dwcwdt* 	at fdt?			# DesignWare watchdog
 mesongxwdt*	at fdt?			# Amlogic Meson GX watchdog
 sbsawdt*	at acpi?		# ARM SBSA-compliant watchdog
 sunxiwdt*	at fdt?			# Allwinner watchdog



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

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 13:09:57 UTC 2019

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

Log Message:
evbarm: add dwcwdt(4) to GENERIC64


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

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



CVS commit: src/sys/dev/fdt

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 13:08:52 UTC 2019

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

Log Message:
dwcwdt: make this work correctly

- sysmon_wdog.smw_period is seconds, not milliseconds
- tickle the watchdog before enabling it


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/dwcwdt_fdt.c

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

Modified files:

Index: src/sys/dev/fdt/dwcwdt_fdt.c
diff -u src/sys/dev/fdt/dwcwdt_fdt.c:1.3 src/sys/dev/fdt/dwcwdt_fdt.c:1.4
--- src/sys/dev/fdt/dwcwdt_fdt.c:1.3	Sun Oct 28 15:06:10 2018
+++ src/sys/dev/fdt/dwcwdt_fdt.c	Sat Oct 19 13:08:52 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dwcwdt_fdt.c,v 1.3 2018/10/28 15:06:10 aymeric Exp $ */
+/* $NetBSD: dwcwdt_fdt.c,v 1.4 2019/10/19 13:08:52 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwcwdt_fdt.c,v 1.3 2018/10/28 15:06:10 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwcwdt_fdt.c,v 1.4 2019/10/19 13:08:52 tnn Exp $");
 
 #include 
 #include 
@@ -111,8 +111,8 @@ dwcwdt_map_period(struct dwcwdt_softc *s
 
 	for (i = 0; i < __arraycount(wdt_torr); i++) {
 		const u_int ms = (u_int)uint64_t)wdt_torr[i] + 1) * 1000) / sc->sc_clkrate);
-		if (ms >= period) {
-			*aperiod = ms;
+		if (ms >= period * 1000) {
+			*aperiod = ms / 1000;
 			return i;
 		}
 	}
@@ -121,14 +121,28 @@ dwcwdt_map_period(struct dwcwdt_softc *s
 }
 
 static int
+dwcwdt_tickle(struct sysmon_wdog *smw)
+{
+	struct dwcwdt_softc * const sc = smw->smw_cookie;
+	const uint32_t crr =
+	__SHIFTIN(WDT_CRR_CNT_RESTART_MAGIC, WDT_CRR_CNT_RESTART);
+
+	WR4(sc, WDT_CRR, crr);
+
+	return 0;
+}
+
+static int
 dwcwdt_setmode(struct sysmon_wdog *smw)
 {
 	struct dwcwdt_softc * const sc = smw->smw_cookie;
 	uint32_t cr, torr;
 	int intv;
 
-	if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED)
+	if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
+		/* Watchdog can only be disarmed by a reset */
 		return EIO;
+	}
 
 	if (smw->smw_period == WDOG_PERIOD_DEFAULT)
 		smw->smw_period = DWCWDT_PERIOD_DEFAULT;
@@ -140,7 +154,7 @@ dwcwdt_setmode(struct sysmon_wdog *smw)
 
 	torr = __SHIFTIN(intv, WDT_TORR_TIMEOUT_PERIOD);
 	WR4(sc, WDT_TORR, torr);
-
+	dwcwdt_tickle(smw);
 	cr = RD4(sc, WDT_CR);
 	cr &= ~WDT_CR_RESP_MODE;
 	cr |= WDT_CR_WDT_EN;
@@ -150,18 +164,6 @@ dwcwdt_setmode(struct sysmon_wdog *smw)
 }
 
 static int
-dwcwdt_tickle(struct sysmon_wdog *smw)
-{
-	struct dwcwdt_softc * const sc = smw->smw_cookie;
-	const uint32_t crr =
-	__SHIFTIN(WDT_CRR_CNT_RESTART_MAGIC, WDT_CRR_CNT_RESTART);
-
-	WR4(sc, WDT_CRR, crr);
-
-	return 0;
-}
-
-static int
 dwcwdt_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct fdt_attach_args * const faa = aux;



CVS commit: src/sys/dev/fdt

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 13:08:52 UTC 2019

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

Log Message:
dwcwdt: make this work correctly

- sysmon_wdog.smw_period is seconds, not milliseconds
- tickle the watchdog before enabling it


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/dwcwdt_fdt.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/rockchip

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 12:55:21 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: rk3399_cru.c rk_cru.h

Log Message:
rk3399: add definition for the watchdog timer clock gate

The watchdog timer clock gate is a bit special because it's a secure
gate that can only be accessed from EL3. We still need a dummy gate
definition for it so that dwcwdt(4) can infer the frequency via the
parent clock. The gate is enabled by default by U-Boot.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_cru.h

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

Modified files:

Index: src/sys/arch/arm/rockchip/rk3399_cru.c
diff -u src/sys/arch/arm/rockchip/rk3399_cru.c:1.9 src/sys/arch/arm/rockchip/rk3399_cru.c:1.10
--- src/sys/arch/arm/rockchip/rk3399_cru.c:1.9	Sun Aug  4 17:09:07 2019
+++ src/sys/arch/arm/rockchip/rk3399_cru.c	Sat Oct 19 12:55:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3399_cru.c,v 1.9 2019/08/04 17:09:07 tnn Exp $ */
+/* $NetBSD: rk3399_cru.c,v 1.10 2019/10/19 12:55:21 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.9 2019/08/04 17:09:07 tnn Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3399_cru.c,v 1.10 2019/10/19 12:55:21 tnn Exp $");
 
 #include 
 #include 
@@ -804,6 +804,9 @@ static struct rk_cru_clk rk3399_cru_clks
 	RK_GATE(RK3399_PCLK_SPI4, "pclk_rkspi4", "pclk_perilp1", CLKGATE_CON(23), 13),
 	RK_GATE(RK3399_PCLK_SPI5, "pclk_rkspi5", "hclk_perilp1", CLKGATE_CON(34), 5),
 
+	/* Watchdog */
+	RK_SECURE_GATE(RK3399_PCLK_WDT, "pclk_wdt", "pclk_alive" /*, SECURE_CLKGATE_CON(3), 8 */),
+
 	/* PCIe */
 	RK_GATE(RK3399_ACLK_PERF_PCIE, "aclk_perf_pcie", "aclk_perihp", CLKGATE_CON(20), 2),
 	RK_GATE(RK3399_ACLK_PCIE, "aclk_pcie", "aclk_perihp", CLKGATE_CON(20), 10),

Index: src/sys/arch/arm/rockchip/rk_cru.h
diff -u src/sys/arch/arm/rockchip/rk_cru.h:1.4 src/sys/arch/arm/rockchip/rk_cru.h:1.5
--- src/sys/arch/arm/rockchip/rk_cru.h:1.4	Sat Sep  1 19:35:53 2018
+++ src/sys/arch/arm/rockchip/rk_cru.h	Sat Oct 19 12:55:21 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_cru.h,v 1.4 2018/09/01 19:35:53 jmcneill Exp $ */
+/* $NetBSD: rk_cru.h,v 1.5 2019/10/19 12:55:21 tnn Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -268,6 +268,15 @@ const char *rk_cru_gate_get_parent(struc
 		.get_parent = rk_cru_gate_get_parent,		\
 	}
 
+#define	RK_SECURE_GATE(_id, _name, _pname)			\
+	{			\
+		.id = (_id),	\
+		.type = RK_CRU_GATE,\
+		.base.name = (_name),\
+		.u.gate.parent = (_pname),			\
+		.get_parent = rk_cru_gate_get_parent,		\
+	}
+
 /* Mux clocks */
 
 struct rk_cru_mux {



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

2019-10-19 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Oct 19 12:55:21 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: rk3399_cru.c rk_cru.h

Log Message:
rk3399: add definition for the watchdog timer clock gate

The watchdog timer clock gate is a bit special because it's a secure
gate that can only be accessed from EL3. We still need a dummy gate
definition for it so that dwcwdt(4) can infer the frequency via the
parent clock. The gate is enabled by default by U-Boot.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk3399_cru.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_cru.h

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