CVS commit: src/sys/dev/pci

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sun Feb  7 04:58:17 UTC 2021

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

Log Message:
xhci_pci.c: reimplement XHCI_DISABLE_MSI and XHCI_DISABLE_MSIX


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/xhci_pci.c

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

Modified files:

Index: src/sys/dev/pci/xhci_pci.c
diff -u src/sys/dev/pci/xhci_pci.c:1.26 src/sys/dev/pci/xhci_pci.c:1.27
--- src/sys/dev/pci/xhci_pci.c:1.26	Wed Dec  9 14:21:09 2020
+++ src/sys/dev/pci/xhci_pci.c	Sun Feb  7 04:58:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $	*/
+/*	$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $	*/
 /*	OpenBSD: xhci_pci.c,v 1.4 2014/07/12 17:38:51 yuo Exp	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.26 2020/12/09 14:21:09 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.27 2021/02/07 04:58:17 dbj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_xhci_pci.h"
@@ -126,6 +126,7 @@ xhci_pci_attach(device_t parent, device_
 	char const *intrstr;
 	pcireg_t csr, memtype, usbrev;
 	uint32_t hccparams;
+	int counts[PCI_INTR_TYPE_SIZE];
 	char intrbuf[PCI_INTRSTR_LEN];
 	bus_addr_t memaddr;
 	int flags, msixoff;
@@ -211,8 +212,18 @@ xhci_pci_attach(device_t parent, device_
 	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
 		   csr | PCI_COMMAND_MASTER_ENABLE);
 
+	for (int i = 0; i < PCI_INTR_TYPE_SIZE; i++) {
+		counts[i] = 1;
+	}
+#ifdef XHCI_DISABLE_MSI
+	counts[PCI_INTR_TYPE_MSI] = 0;
+#endif
+#ifdef XHCI_DISABLE_MSIX
+	counts[PCI_INTR_TYPE_MSIX] = 0;
+#endif
+
 	/* Allocate and establish the interrupt. */
-	if (pci_intr_alloc(pa, >sc_pihp, NULL, 0)) {
+	if (pci_intr_alloc(pa, >sc_pihp, counts, 0)) {
 		aprint_error_dev(self, "can't allocate handler\n");
 		goto fail;
 	}



CVS commit: src

2021-02-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Feb  7 01:53:54 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib/libcurses/check_files: Makefile addch.chk addstr.chk
src/tests/lib/libcurses/tests: addch addnstr addstr waddnstr waddstr
Added Files:
src/tests/lib/libcurses/check_files: addnstr.chk waddstr.chk

Log Message:
libcurses: demonstrate bug in addch that doubles tab indentation

When adding "\t" via addch, win.curx advances by twice the spaces as
intended.  This bug was introduced somewhere between NetBSD 8.0 and 9.0.

Adding "\t" via addstr does not have this bug.

This bug causes the installation menu of sysinst to be have its menu
items indented by 16 characters instead of only 8.  This in turn
produces an ugly line break in the German translation.

The test framework for libcurses is not well integrated into ATF.
Whenever the expected output is longer than the actual output, or vice
versa, the test passes nevertheless.  This makes it necessary to
constantly look into atf-run.log to see whether the actual output is
indeed equal to the expected output, which is crucial, especially for
telling the difference between addstr and addnstr.

Reusing the .chk files for several tests is not a good idea either.  For
example, addstr and waddstr are supposed to produce the same result for
ASCII-only text, so it was tempting to use the same file.  But waddstr
seems to have a bug (maybe undefined behavior), at least waddstr returns
ERR in one case where it shouldn't.  This means that currently the
expected output (acknowledging the bug) must be different.

The "expected" test output in waddstr.chk looks completely broken, but
that's exactly what the test produces right now.


To generate a diff of this commit:
cvs rdiff -u -r1.1015 -r1.1016 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libcurses/check_files/Makefile
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/check_files/addch.chk
cvs rdiff -u -r0 -r1.1 src/tests/lib/libcurses/check_files/addnstr.chk \
src/tests/lib/libcurses/check_files/waddstr.chk
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/check_files/addstr.chk
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libcurses/tests/addch \
src/tests/lib/libcurses/tests/addnstr
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/tests/addstr \
src/tests/lib/libcurses/tests/waddnstr \
src/tests/lib/libcurses/tests/waddstr

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1015 src/distrib/sets/lists/tests/mi:1.1016
--- src/distrib/sets/lists/tests/mi:1.1015	Mon Feb  1 20:31:41 2021
+++ src/distrib/sets/lists/tests/mi	Sun Feb  7 01:53:54 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1015 2021/02/01 20:31:41 rillig Exp $
+# $NetBSD: mi,v 1.1016 2021/02/07 01:53:54 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3265,6 +3265,7 @@
 ./usr/tests/lib/libcurses/check_files/addchstr.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/addchstr2.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/addchstr3.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/addnstr.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/addnwstr1.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/addnwstr2.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/addstr.chk		tests-lib-tests		compattestfile,atf
@@ -3475,6 +3476,7 @@
 ./usr/tests/lib/libcurses/check_files/waddchstr.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/waddnwstr1.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/waddnwstr2.chk		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libcurses/check_files/waddstr.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/waddwstr1.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/waddwstr2.chk		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libcurses/check_files/waddwstr3.chk		tests-lib-tests		compattestfile,atf

Index: src/tests/lib/libcurses/check_files/Makefile
diff -u src/tests/lib/libcurses/check_files/Makefile:1.4 src/tests/lib/libcurses/check_files/Makefile:1.5
--- src/tests/lib/libcurses/check_files/Makefile:1.4	Sat Oct 24 14:21:25 2020
+++ src/tests/lib/libcurses/check_files/Makefile	Sun Feb  7 01:53:54 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/10/24 14:21:25 martin Exp $
+# $NetBSD: Makefile,v 1.5 2021/02/07 01:53:54 rillig Exp $
 
 NOMAN=		# defined
 
@@ -17,6 +17,7 @@ FILES+=		addch.chk
 FILES+=		addchstr.chk
 FILES+=		addchstr2.chk
 FILES+=		addchstr3.chk
+FILES+=		addnstr.chk
 FILES+=		addnwstr1.chk
 FILES+=		

CVS commit: src/doc

2021-02-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb  6 22:00:59 UTC 2021

Modified Files:
src/doc: TODO.clang

Log Message:
Drop acorn32 entry, fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/doc/TODO.clang

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

Modified files:

Index: src/doc/TODO.clang
diff -u src/doc/TODO.clang:1.23 src/doc/TODO.clang:1.24
--- src/doc/TODO.clang:1.23	Fri Aug  2 12:06:20 2019
+++ src/doc/TODO.clang	Sat Feb  6 22:00:59 2021
@@ -1,11 +1,8 @@
-$NetBSD: TODO.clang,v 1.23 2019/08/02 12:06:20 joerg Exp $
+$NetBSD: TODO.clang,v 1.24 2021/02/06 22:00:59 joerg Exp $
 
 Hacks for the clang integration
 ---
 
-src/sys/arch/acorn32/stand
-"-fno-integrated-as" is used for pre-unified ARM assembler.
-
 src/sys/arch/i386/stand
 "-no-integrated-as" is used to compensate
 for the incomplete explicit positioning support in LLVM MC.



CVS commit: src/sys/arch/acorn32/stand

2021-02-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb  6 21:45:38 UTC 2021

Modified Files:
src/sys/arch/acorn32/stand/boot32: Makefile start.S
src/sys/arch/acorn32/stand/nbfs: Makefile rmheader.S

Log Message:
Modernize acorn32 boot code to work directly with LLVM's assembler.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/acorn32/stand/boot32/Makefile
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/acorn32/stand/boot32/start.S
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/acorn32/stand/nbfs/Makefile \
src/sys/arch/acorn32/stand/nbfs/rmheader.S

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/acorn32/stand/boot32/Makefile
diff -u src/sys/arch/acorn32/stand/boot32/Makefile:1.6 src/sys/arch/acorn32/stand/boot32/Makefile:1.7
--- src/sys/arch/acorn32/stand/boot32/Makefile:1.6	Fri Aug  2 12:06:20 2019
+++ src/sys/arch/acorn32/stand/boot32/Makefile	Sat Feb  6 21:45:38 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2019/08/02 12:06:20 joerg Exp $
+#	$NetBSD: Makefile,v 1.7 2021/02/06 21:45:38 joerg Exp $
 
 PROG=		boot32
 PROGSOURCE=	rmheader.S rmvers.c srt0.S boot32.c start.S
@@ -17,6 +17,4 @@ rmvers.c: ${.CURDIR}/version
 
 CLEANFILES+=	rmvers.c
 
-AFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
-
 .include "../Makefile.buildboot"

Index: src/sys/arch/acorn32/stand/boot32/start.S
diff -u src/sys/arch/acorn32/stand/boot32/start.S:1.3 src/sys/arch/acorn32/stand/boot32/start.S:1.4
--- src/sys/arch/acorn32/stand/boot32/start.S:1.3	Sun Feb  3 14:59:16 2008
+++ src/sys/arch/acorn32/stand/boot32/start.S	Sat Feb  6 21:45:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: start.S,v 1.3 2008/02/03 14:59:16 chris Exp $	*/
+/*	$NetBSD: start.S,v 1.4 2021/02/06 21:45:38 joerg Exp $	*/
 
 /*
  * Copyright (c) 2002 Reinoud Zandijk
@@ -50,7 +50,7 @@ ENTRY(relocate_code)
 	 * determine processor architecture version. This is nessisary for the
 	 * correct coprocessor instruction.
 	 */
-	mrc	15, 0, r0, c0, c0, 0	/* read CPU id in r0			*/
+	mrc	p15, 0, r0, c0, c0, 0	/* read CPU id in r0			*/
 	mov	r3, r0			/* store in r3*/
 
 	/* assume its ARMv4 instruction set	*/
@@ -77,23 +77,23 @@ ENTRY(relocate_code)
 	/* flush ID cache			*/
 	mov	r0, #0
 	cmp	r14, #0
-	mcreq	15, 0, r0, c7, c0, 0	/* flush v3 ID cache			*/
-	mcrne	15, 0, r0, c7, c7, 0	/* flush v4 ID cache			*/
-	mcrne	15, 0, r0, c7, c10, 4	/* drain WB (v4)			*/
+	mcreq	p15, 0, r0, c7, c0, 0	/* flush v3 ID cache			*/
+	mcrne	p15, 0, r0, c7, c7, 0	/* flush v4 ID cache			*/
+	mcrne	p15, 0, r0, c7, c10, 4	/* drain WB (v4)			*/
 
 	/* flush TLB*/
-	mcr	15, 0, r0, c5, c0, 0	/* flush TLB for v3 and v4		*/
+	mcr	p15, 0, r0, c5, c0, 0	/* flush TLB for v3 and v4		*/
 
 	/* switch off MMU, IDcache and WB and branch to physical code space	*/
 	cmp	r14, #0
-	mrcne	15, 0, r0, c1, c0, 0	/* read processor control register if v4*/
+	mrcne	p15, 0, r0, c1, c0, 0	/* read processor control register if v4*/
 	bic	r0, r0, #0x3f		/* clear only known bits		*/
 	moveq	r0, #0			/* for v3 just set to zero		*/
 	orr	r0, r0, #CPU_CONTROL_LABT_ENABLE | CPU_CONTROL_32BD_ENABLE | CPU_CONTROL_32BP_ENABLE
 	mov	r13, r0			/* save this control value in r13	*/
 	cmp	r14, #0
-	mcr	15, 0, r0, c1, c0, 0	/* write control register!		*/
-/*1*/	mcrne	15, 0, r1, c7, c5, 0	/* write zero in ARMv4 MMU disable	*/
+	mcr	p15, 0, r0, c1, c0, 0	/* write control register!		*/
+/*1*/	mcrne	p15, 0, r1, c7, c5, 0	/* write zero in ARMv4 MMU disable	*/
 /*2*/	mov	pc, r9			/* branch to physical address		*/	
 	
 relocate_code_physical_restart:
@@ -132,25 +132,25 @@ loop_one_page:
 	/* flush ID cache			*/
 	mov	r0, #0
 	cmp	r14, #0
-	mcreq	15, 0, r0, c7, c0, 0	/* flush v3 ID cache			*/
-	mcrne	15, 0, r0, c7, c7, 0	/* flush v4 ID cache			*/
+	mcreq	p15, 0, r0, c7, c0, 0	/* flush v3 ID cache			*/
+	mcrne	p15, 0, r0, c7, c7, 0	/* flush v4 ID cache			*/
 
 	/* drain write buffer (v4)		*/
 	mov	r0, #0
 	cmp	r14, #0
-	mcrne	15, 0, r0, c7, c10, 4	/* drain WB (v4)			*/
+	mcrne	p15, 0, r0, c7, c10, 4	/* drain WB (v4)			*/
 
 	/* flush TLB*/
-	mcr	15, 0, r0, c5, c0, 0	/* flush TLB for v3 and v4		*/
+	mcr	p15, 0, r0, c5, c0, 0	/* flush TLB for v3 and v4		*/
 
 	/* set new TLB address			*/
 	mov	r0, r11
-	mcr	15, 0, r0, c2, c0, 0	/* write TLB address			*/
+	mcr	p15, 0, r0, c2, c0, 0	/* write TLB address			*/
 
 	/* Switch on MMU, IDCache and WB and keep on running on flat translated memory*/
 	orr	r0, r13, #CPU_CONTROL_LABT_ENABLE | CPU_CONTROL_32BD_ENABLE | CPU_CONTROL_32BP_ENABLE
 	orr	r0, r0,  #CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_DC_ENABLE   | CPU_CONTROL_MMU_ENABLE
-	mcr	15, 0, r0, c1, c0, 0	/* write register !!!			*/
+	mcr	p15, 0, r0, c1, c0, 0	/* write register !!!			*/
 	mov	r0, r0			/* 

CVS commit: src/usr.bin/make

2021-02-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Feb  6 21:40:14 UTC 2021

Modified Files:
src/usr.bin/make: var.c

Log Message:
make: sync comment for ApplyModifier_Assign with reality

In compat mode, empty shell commands are handled correctly since at
least 1993.

In jobs mode, empty shell commands are handled correctly since at least
job.c 1.93 from 2005-06-16.

The only place where empty shell commands led to problems was in
Cmd_Exec, but that has nothing to do with the example from the comment.
See var-op-shell.mk for more details.


To generate a diff of this commit:
cvs rdiff -u -r1.807 -r1.808 src/usr.bin/make/var.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/make/var.c
diff -u src/usr.bin/make/var.c:1.807 src/usr.bin/make/var.c:1.808
--- src/usr.bin/make/var.c:1.807	Fri Feb  5 05:42:39 2021
+++ src/usr.bin/make/var.c	Sat Feb  6 21:40:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.807 2021/02/05 05:42:39 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.808 2021/02/06 21:40:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
 #include "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.807 2021/02/05 05:42:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.808 2021/02/06 21:40:14 rillig Exp $");
 
 typedef enum VarFlags {
 	VAR_NONE	= 0,
@@ -3239,17 +3239,18 @@ ApplyModifier_IfElse(const char **pp, Ap
 }
 
 /*
- * The ::= modifiers actually assign a value to the variable.
- * Their main purpose is in supporting modifiers of .for loop
- * iterators and other obscure uses.  They always expand to
- * nothing.  In a target rule that would otherwise expand to an
- * empty line they can be preceded with @: to keep make happy.
- * Eg.
+ * The ::= modifiers are special in that they do not read the variable value
+ * but instead assign to that variable.  They always expand to an empty
+ * string.
+ *
+ * Their main purpose is in supporting .for loops that generate shell commands
+ * since an ordinary variable assignment at that point would terminate the
+ * dependency group for these targets.  For example:
  *
- * foo:	.USE
+ * list-targets: .USE
  * .for i in ${.TARGET} ${.TARGET:R}.gz
- *	@: ${t::=$i}
- *	@echo blah ${t:T}
+ *	@${t::=$i}
+ *	@echo 'The target is ${t:T}.'
  * .endfor
  *
  *	  ::=	Assigns  as the new value of variable.



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

2021-02-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Feb  6 21:24:20 UTC 2021

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

Log Message:
use __builtin_assume_aligned() on places where the memset() or memcpy()
parameters are known to be PAGE_SIZE-aligned, so compiler doesn't need
to emit atrocious alignment check code when inlining them

this particularly improves pmap_zero_page() and pmap_copy_page(),
which are now reduced to only 'rep stosq', and close to what a hand-written
assembly would do

Note: on CPUs supporting ERMS, 'rep stosb' would still be slightly faster, but
this is a solid stop-gap improvement

suggested by Mateusz Guzik in:
http://mail-index.netbsd.org/tech-kern/2020/07/19/msg026620.html


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.408 src/sys/arch/x86/x86/pmap.c:1.409
--- src/sys/arch/x86/x86/pmap.c:1.408	Mon Nov 30 17:06:02 2020
+++ src/sys/arch/x86/x86/pmap.c	Sat Feb  6 21:24:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.408 2020/11/30 17:06:02 bouyer Exp $	*/
+/*	$NetBSD: pmap.c,v 1.409 2021/02/06 21:24:19 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.408 2020/11/30 17:06:02 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.409 2021/02/06 21:24:19 jdolecek Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -339,6 +339,9 @@ paddr_t pmap_pa_end;   /* PA of last phy
 #define	PMAP_CHECK_PP(pp) \
 KASSERTMSG((pp)->pp_lock.mtx_ipl._ipl == IPL_VM, "bad pmap_page %p", pp)
 
+#define PAGE_ALIGNED(pp)	\
+	__builtin_assume_aligned((void *)(pp), PAGE_SIZE)
+
 /*
  * Other data structures
  */
@@ -1297,7 +1300,7 @@ pmap_bootstrap(vaddr_t kva_start)
 	xen_dummy_user_pgd = xen_dummy_page - KERNBASE;
 
 	/* Zero fill it, the less checks in Xen it requires the better */
-	memset((void *)(xen_dummy_user_pgd + KERNBASE), 0, PAGE_SIZE);
+	memset(PAGE_ALIGNED(xen_dummy_user_pgd + KERNBASE), 0, PAGE_SIZE);
 	/* Mark read-only */
 	HYPERVISOR_update_va_mapping(xen_dummy_user_pgd + KERNBASE,
 	pmap_pa2pte(xen_dummy_user_pgd) | PTE_P | pmap_pg_nx,
@@ -1542,7 +1545,7 @@ pmap_init_pcpu(void)
 		pa = pmap_bootstrap_palloc(1);
 		*pte = (pa & PTE_FRAME) | pteflags;
 		pmap_update_pg(tmpva);
-		memset((void *)tmpva, 0, PAGE_SIZE);
+		memset(PAGE_ALIGNED(tmpva), 0, PAGE_SIZE);
 
 		L4_BASE[L4e_idx+i] = pa | pteflags | PTE_A;
 	}
@@ -1556,7 +1559,7 @@ pmap_init_pcpu(void)
 		pa = pmap_bootstrap_palloc(1);
 		*pte = (pa & PTE_FRAME) | pteflags;
 		pmap_update_pg(tmpva);
-		memset((void *)tmpva, 0, PAGE_SIZE);
+		memset(PAGE_ALIGNED(tmpva), 0, PAGE_SIZE);
 
 		L3_BASE[L3e_idx+i] = pa | pteflags | PTE_A;
 	}
@@ -1571,7 +1574,7 @@ pmap_init_pcpu(void)
 		pa = pmap_bootstrap_palloc(1);
 		*pte = (pa & PTE_FRAME) | pteflags;
 		pmap_update_pg(tmpva);
-		memset((void *)tmpva, 0, PAGE_SIZE);
+		memset(PAGE_ALIGNED(tmpva), 0, PAGE_SIZE);
 
 		L2_BASE[L2e_idx+i] = pa | pteflags | PTE_A;
 	}
@@ -1663,7 +1666,7 @@ pmap_init_directmap(struct pmap *kpm)
 		pa = pmap_bootstrap_palloc(1);
 		*pte = (pa & PTE_FRAME) | pteflags;
 		pmap_update_pg(tmpva);
-		memset((void *)tmpva, 0, PAGE_SIZE);
+		memset(PAGE_ALIGNED(tmpva), 0, PAGE_SIZE);
 
 		L4_BASE[L4e_idx+i] = pa | pteflags | PTE_A;
 	}
@@ -1677,7 +1680,7 @@ pmap_init_directmap(struct pmap *kpm)
 		pa = pmap_bootstrap_palloc(1);
 		*pte = (pa & PTE_FRAME) | pteflags;
 		pmap_update_pg(tmpva);
-		memset((void *)tmpva, 0, PAGE_SIZE);
+		memset(PAGE_ALIGNED(tmpva), 0, PAGE_SIZE);
 
 		L3_BASE[L3e_idx+i] = pa | pteflags | PTE_A;
 	}
@@ -2627,7 +2630,7 @@ pmap_pdp_init(pd_entry_t *pdir)
 	int s;
 #endif
 
-	memset(pdir, 0, PDP_SIZE * PAGE_SIZE);
+	memset(PAGE_ALIGNED(pdir), 0, PDP_SIZE * PAGE_SIZE);
 
 	/*
 	 * NOTE: This is all done unlocked, but we will check afterwards
@@ -3805,7 +3808,7 @@ void
 pmap_zero_page(paddr_t pa)
 {
 #if defined(__HAVE_DIRECT_MAP)
-	memset((void *)PMAP_DIRECT_MAP(pa), 0, PAGE_SIZE);
+	memset(PAGE_ALIGNED(PMAP_DIRECT_MAP(pa)), 0, PAGE_SIZE);
 #else
 #if defined(XENPV)
 	if (XEN_VERSION_SUPPORTED(3, 4))
@@ -3829,7 +3832,7 @@ pmap_zero_page(paddr_t pa)
 	pmap_pte_flush();
 	pmap_update_pg(zerova);		/* flush TLB */
 
-	memset((void *)zerova, 0, PAGE_SIZE);
+	memset(PAGE_ALIGNED(zerova), 0, PAGE_SIZE);
 
 #if defined(DIAGNOSTIC) || defined(XENPV)
 	pmap_pte_set(zpte, 0);/* zap ! */
@@ -3847,7 +3850,7 @@ pmap_copy_page(paddr_t srcpa, paddr_t ds
 	vaddr_t srcva = PMAP_DIRECT_MAP(srcpa);
 	vaddr_t dstva = PMAP_DIRECT_MAP(dstpa);
 
-	memcpy((void *)dstva, (void *)srcva, PAGE_SIZE);
+	memcpy(PAGE_ALIGNED(dstva), PAGE_ALIGNED(srcva), PAGE_SIZE);
 #else
 #if defined(XENPV)
 	if (XEN_VERSION_SUPPORTED(3, 4)) {
@@ -3877,7 +3880,7 

CVS commit: src/sys/sys

2021-02-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Feb  6 21:08:51 UTC 2021

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

Log Message:
Expose devhandle_t to standalone programs (fixes sparc* build etc)


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/sys/device.h

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

Modified files:

Index: src/sys/sys/device.h
diff -u src/sys/sys/device.h:1.166 src/sys/sys/device.h:1.167
--- src/sys/sys/device.h:1.166	Fri Feb  5 12:03:35 2021
+++ src/sys/sys/device.h	Sat Feb  6 16:08:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.166 2021/02/05 17:03:35 thorpej Exp $ */
+/* $NetBSD: device.h,v 1.167 2021/02/06 21:08:51 christos Exp $ */
 
 /*
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -148,7 +148,33 @@ typedef struct cfdata *cfdata_t;
 typedef struct cfdriver *cfdriver_t;
 typedef struct cfattach *cfattach_t;
 
-#if defined(_KERNEL) || defined(_KMEMUSER)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_STANDALONE)
+/*
+ * devhandle_t --
+ *
+ *	This is an abstraction of the device handles used by ACPI,
+ *	OpenFirmware, and others, to support device enumeration and
+ *	device tree linkage.  A devhandle_t can be safely passed
+ *	by value.
+ */
+struct devhandle {
+	const struct devhandle_impl *	impl;
+	union {
+		/*
+		 * Storage for the device handle.  Which storage field
+		 * is used is at the sole discretion of the type
+		 * implementation.
+		 */
+		void *			pointer;
+		const void *		const_pointer;
+		uintptr_t		uintptr;
+		int			integer;
+	};
+};
+typedef struct devhandle devhandle_t;
+#endif
+
+#if defined(_KERNEL) || defined(_KMEMUSER) 
 struct device_compatible_entry {
 	union {
 		const char *compat;
@@ -182,29 +208,6 @@ struct device_garbage {
 	int		dg_ndevs;
 };
 
-/*
- * devhandle_t --
- *
- *	This is an abstraction of the device handles used by ACPI,
- *	OpenFirmware, and others, to support device enumeration and
- *	device tree linkage.  A devhandle_t can be safely passed
- *	by value.
- */
-struct devhandle {
-	const struct devhandle_impl *	impl;
-	union {
-		/*
-		 * Storage for the device handle.  Which storage field
-		 * is used is at the sole discretion of the type
-		 * implementation.
-		 */
-		void *			pointer;
-		const void *		const_pointer;
-		uintptr_t		uintptr;
-		int			integer;
-	};
-};
-typedef struct devhandle devhandle_t;
 
 typedef enum {
 	/* Used to represent invalid states. */



CVS commit: src/tests/lib/libcurses

2021-02-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Feb  6 20:09:43 UTC 2021

Modified Files:
src/tests/lib/libcurses: testframe.txt

Log Message:
libcurses: fix typos in introduction to the curses test framework


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/testframe.txt

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/libcurses/testframe.txt
diff -u src/tests/lib/libcurses/testframe.txt:1.5 src/tests/lib/libcurses/testframe.txt:1.6
--- src/tests/lib/libcurses/testframe.txt:1.5	Sat Oct 24 04:46:16 2020
+++ src/tests/lib/libcurses/testframe.txt	Sat Feb  6 20:09:43 2021
@@ -1,3 +1,4 @@
+$NetBSD: testframe.txt,v 1.6 2021/02/06 20:09:43 rillig Exp $
 
 CURSES TESTFRAME
 
@@ -7,9 +8,9 @@ CURSES TESTFRAME
 The curses library is a complex piece of software and, often, changes
 made to the library may introduce subtle bugs that are hidden by other
 actions so a visual check of the curses output may look correct in
-some circumstances and the bug only show itself after a certain
+some circumstances and the bug only shows itself after a certain
 sequence of actions.  To assist with validating that changes made to
-the curses library have no undesired effects an automated test is
+the curses library have no undesired effects, an automated test is
 needed to detect and highlight any changes in the curses application
 output stream.  The programmer can then analyse the output changes and
 either correct a bug or update the automated test to accept the new
@@ -246,17 +247,14 @@ there is one more special call called "d
 called wgetch(win) until there are no more characters in win.  The call
 assumes that the curses input is either in no delay or timed input
 mode otherwise the test will time out and fail.  This call can be used
-to clear any pending input when testing testing a timed read to
-prevent the input being used in a later test.
+to clear any pending input when testing a timed read, to prevent the
+input from being used in a later test.
 
 4. Slave
 
 The user has no direct interaction with the slave process.  The slave
-is forked off by the director communicates to the director over a set
-of pipes and a pseudo-tty connected to its standard i/o file
+is forked off by the director and communicates to the director over a
+set of pipes and a pseudo-tty connected to its standard i/o file
 descriptors.  The slave executes the passed curses calls and passes
 back return values to the director.  The slave automatically calls
-initscr() on start up.
-
-
-
+initscr() on startup.



CVS commit: src/lib/libcurses

2021-02-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Feb  6 19:41:14 UTC 2021

Modified Files:
src/lib/libcurses: addbytes.c

Log Message:
libcurses: fix spelling in comment


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/lib/libcurses/addbytes.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/addbytes.c
diff -u src/lib/libcurses/addbytes.c:1.52 src/lib/libcurses/addbytes.c:1.53
--- src/lib/libcurses/addbytes.c:1.52	Sun Jun  9 07:40:14 2019
+++ src/lib/libcurses/addbytes.c	Sat Feb  6 19:41:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: addbytes.c,v 1.52 2019/06/09 07:40:14 blymn Exp $	*/
+/*	$NetBSD: addbytes.c,v 1.53 2021/02/06 19:41:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)addbytes.c	8.4 (Berkeley) 5/4/94";
 #else
-__RCSID("$NetBSD: addbytes.c,v 1.52 2019/06/09 07:40:14 blymn Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.53 2021/02/06 19:41:14 rillig Exp $");
 #endif
 #endif/* not lint */
 
@@ -602,7 +602,7 @@ _cursesi_addwchar(WINDOW *win, __LINE **
 	} else {
 		win->curx = *x;
 
-		/* clear the remining of the current characer */
+		/* clear the remaining of the current character */
 		if (*x && *x < win->maxx) {
 			ex = sx + cw;
 			tp = >alines[*y]->line[ex];



CVS commit: src/tests/usr.bin/make

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 19:00:25 UTC 2021

Modified Files:
src/tests/usr.bin/make: t_make.sh

Log Message:
Run all make tests as unprileged user - makes checking permission issues
a lot easier.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/make/t_make.sh

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

Modified files:

Index: src/tests/usr.bin/make/t_make.sh
diff -u src/tests/usr.bin/make/t_make.sh:1.12 src/tests/usr.bin/make/t_make.sh:1.13
--- src/tests/usr.bin/make/t_make.sh:1.12	Tue Oct 20 20:36:53 2020
+++ src/tests/usr.bin/make/t_make.sh	Sat Feb  6 19:00:25 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_make.sh,v 1.12 2020/10/20 20:36:53 rillig Exp $
+# $NetBSD: t_make.sh,v 1.13 2021/02/06 19:00:25 martin Exp $
 #
 # Copyright (c) 2008, 2010, 2014 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -59,7 +59,8 @@ test_case()
 	eval "${atfname}_head() { \
 		if [ -n '${descr}' ]; then \
 		atf_set descr '${descr}'; \
-		fi \
+		fi; \
+		atf_set require.user unprivileged; \
 	}"
 	eval "${atfname}_body() { \
 		run_and_check '${atfname}' '${makename}'; \



CVS commit: src/usr.bin/make/unit-tests

2021-02-06 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Sat Feb  6 18:26:03 UTC 2021

Modified Files:
src/usr.bin/make/unit-tests: Makefile cmdline.exp cmdline.mk export.exp
objdir-writable.exp

Log Message:
Avoid test failures when more than one user run them.

Use a private  TMPDIR
a subdir of .OBJDIR if using it
otherwise /tmp/uid${.MAKE.UID}


To generate a diff of this commit:
cvs rdiff -u -r1.268 -r1.269 src/usr.bin/make/unit-tests/Makefile
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cmdline.exp \
src/usr.bin/make/unit-tests/objdir-writable.exp
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cmdline.mk
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/export.exp

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/make/unit-tests/Makefile
diff -u src/usr.bin/make/unit-tests/Makefile:1.268 src/usr.bin/make/unit-tests/Makefile:1.269
--- src/usr.bin/make/unit-tests/Makefile:1.268	Thu Feb  4 00:16:03 2021
+++ src/usr.bin/make/unit-tests/Makefile	Sat Feb  6 18:26:03 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.268 2021/02/04 00:16:03 rillig Exp $
+# $NetBSD: Makefile,v 1.269 2021/02/06 18:26:03 sjg Exp $
 #
 # Unit tests for make(1)
 #
@@ -31,6 +31,8 @@
 # src/tests/usr.bin/make/t_make.sh.
 #
 
+.MAIN: all
+
 # we use these below but we might be an older make
 .MAKE.OS?= ${uname -s:L:sh}
 .MAKE.UID?= ${id -u:L:sh}
@@ -441,16 +443,10 @@ TESTS+=		varquote
 #	escape-for-item.mk
 #	posix-*.mk (see posix.mk and posix1.mk)
 
-.if ${.OBJDIR} != ${.CURDIR}
-RO_OBJDIR:=	${.OBJDIR}/roobj
-.else
-RO_OBJDIR:=	${TMPDIR:U/tmp}/roobj
-.endif
 # Additional environment variables for some of the tests.
 # The base environment is -i PATH="$PATH".
 ENV.depsrc-optional+=   TZ=UTC
 ENV.envfirst=		FROM_ENV=value-from-env
-ENV.objdir-writable+=	RO_OBJDIR=${RO_OBJDIR}
 ENV.varmisc=		FROM_ENV=env
 ENV.varmisc+=		FROM_ENV_BEFORE=env
 ENV.varmisc+=		FROM_ENV_AFTER=env
@@ -486,7 +482,6 @@ SED_CMDS.job-output-long-lines= \
 	${:D marker should always be at the beginning of the line. } \
 	-e '/^aa*--- job-b ---$$/d' \
 	-e '/^bb*--- job-a ---$$/d'
-SED_CMDS.objdir-writable=	-e 's,${RO_OBJDIR},OBJDIR/roobj,g'
 SED_CMDS.opt-debug-graph1=	${STD_SED_CMDS.dg1}
 SED_CMDS.opt-debug-graph2=	${STD_SED_CMDS.dg2}
 SED_CMDS.opt-debug-graph3=	${STD_SED_CMDS.dg3}
@@ -593,8 +588,6 @@ STD_SED_CMDS.shell+=		-e 's,^${.SHELL:T}
 
 # End of the configuration helpers section.
 
-.MAIN: all
-
 UNIT_TESTS:=	${.PARSEDIR}
 .PATH: ${UNIT_TESTS}
 
@@ -623,7 +616,22 @@ LC_ALL=		C
 LANG=		C
 .export LANG LC_ALL
 
+
+# for many tests we need a TMPDIR that will not collide
+# with other users.
+.if ${.OBJDIR} != ${.CURDIR}
+# easy
+TMPDIR:=	${.OBJDIR}/tmp
+.else
+TMPDIR:=	${TMPDIR:U/tmp}/uid${.MAKE.UID}
+.endif
+# make sure it exists
+.if !exist(${TMPDIR})
+x!= echo; mkdir -p ${TMPDIR}
+.endif
+
 MAKE_TEST_ENV?=	MALLOC_OPTIONS="JA"	# for jemalloc
+MAKE_TEST_ENV+= TMPDIR=${TMPDIR}
 
 .if ${.MAKE.OS} == "NetBSD"
 LIMIT_RESOURCES?=	ulimit -v 20
@@ -657,6 +665,7 @@ _SED_CMDS+=	-e 's,${TEST_MAKE:T:S,.,\\.,
 _SED_CMDS+=	-e 's,^usage: ${TEST_MAKE:T:S,.,\\.,g} ,usage: make ,'
 # replace anything after 'stopped in' with unit-tests
 _SED_CMDS+=	-e '/stopped/s, /.*, unit-tests,'
+_SED_CMDS+=	-e 's,${TMPDIR},TMPDIR,g'
 # strip ${.CURDIR}/ from the output
 _SED_CMDS+=	-e 's,${.CURDIR:S,.,\\.,g}/,,g'
 _SED_CMDS+=	-e 's,${UNIT_TESTS:S,.,\\.,g}/,,g'

Index: src/usr.bin/make/unit-tests/cmdline.exp
diff -u src/usr.bin/make/unit-tests/cmdline.exp:1.1 src/usr.bin/make/unit-tests/cmdline.exp:1.2
--- src/usr.bin/make/unit-tests/cmdline.exp:1.1	Tue Jul 28 22:44:44 2020
+++ src/usr.bin/make/unit-tests/cmdline.exp	Sat Feb  6 18:26:03 2021
@@ -1,5 +1,5 @@
 makeobjdir-direct:
-show-objdir: /tmp/6a8899d2-d227-4b55-9b6b-f3c8eeb83fd5
+show-objdir: TMPDIR/6a8899d2-d227-4b55-9b6b-f3c8eeb83fd5
 makeobjdir-indirect:
-show-objdir: /tmp/a7b41170-53f8-4cc2-bc5c-e4c3dd93ec45/
+show-objdir: TMPDIR/a7b41170-53f8-4cc2-bc5c-e4c3dd93ec45/
 exit status 0
Index: src/usr.bin/make/unit-tests/objdir-writable.exp
diff -u src/usr.bin/make/unit-tests/objdir-writable.exp:1.1 src/usr.bin/make/unit-tests/objdir-writable.exp:1.2
--- src/usr.bin/make/unit-tests/objdir-writable.exp:1.1	Thu Nov 12 23:35:21 2020
+++ src/usr.bin/make/unit-tests/objdir-writable.exp	Sat Feb  6 18:26:03 2021
@@ -1,5 +1,5 @@
-make warning: OBJDIR/roobj: Permission denied.
+make warning: TMPDIR/roobj: Permission denied.
 /tmp
-OBJDIR/roobj
-OBJDIR/roobj
+TMPDIR/roobj
+TMPDIR/roobj
 exit status 0

Index: src/usr.bin/make/unit-tests/cmdline.mk
diff -u src/usr.bin/make/unit-tests/cmdline.mk:1.2 src/usr.bin/make/unit-tests/cmdline.mk:1.3
--- src/usr.bin/make/unit-tests/cmdline.mk:1.2	Sun Nov 15 14:07:53 2020
+++ src/usr.bin/make/unit-tests/cmdline.mk	Sat Feb  6 18:26:03 2021
@@ -1,8 +1,8 @@
-# $NetBSD: cmdline.mk,v 1.2 2020/11/15 14:07:53 rillig Exp $
+# $NetBSD: cmdline.mk,v 1.3 2021/02/06 18:26:03 sjg Exp $

CVS commit: src/tools

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Feb  6 16:14:55 UTC 2021

Modified Files:
src/tools: Makefile

Log Message:
tools: allow MKCROSSGDB to work when not building gcc


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/tools/Makefile

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

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.206 src/tools/Makefile:1.207
--- src/tools/Makefile:1.206	Tue Jul 28 21:38:15 2020
+++ src/tools/Makefile	Sat Feb  6 16:14:55 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.206 2020/07/28 21:38:15 uwe Exp $
+#	$NetBSD: Makefile,v 1.207 2021/02/06 16:14:55 dbj Exp $
 
 .include 
 .include 
@@ -25,26 +25,25 @@
 TOOLS_BUILDRUMP?=no
 
 .if ${TOOLCHAIN_MISSING} == "no"
-. if defined(HAVE_GCC) && ${HAVE_GCC} > 0
-TOOLCHAIN_BITS= gmake .WAIT
+. if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \
+ (defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no")
+TOOLCHAIN_BITS+= gmake .WAIT
 TOOLCHAIN_BITS+= gmp .WAIT
 TOOLCHAIN_BITS+= mpfr .WAIT
 TOOLCHAIN_BITS+= mpc .WAIT
 . endif
-.endif
 
-.if ${TOOLCHAIN_MISSING} == "no"
 TOOLCHAIN_BITS+= binutils .WAIT
-.endif
 
-.if defined(HAVE_GCC) && ${HAVE_GCC} > 0
-. if ${TOOLCHAIN_MISSING} == "no"
+. if defined(HAVE_GCC) && ${HAVE_GCC} > 0
 TOOLCHAIN_BITS+= gcc
-.  if ${MKCROSSGDB:Uno} != "no" || make(obj)
+. endif
+
+. if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no"
 TOOLCHAIN_BITS+= gdb
-.  endif
-TOOLCHAIN_BITS+= .WAIT
 . endif
+
+TOOLCHAIN_BITS+= .WAIT
 .endif
 
 .if defined(HAVE_PCC)



CVS commit: src/sys/dev/ofw

2021-02-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb  6 16:07:14 UTC 2021

Modified Files:
src/sys/dev/ofw: openfirm.h

Log Message:
Wrap some definite-only-in-kernel-environment prototypees in _KERNEL.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ofw/openfirm.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/ofw/openfirm.h
diff -u src/sys/dev/ofw/openfirm.h:1.45 src/sys/dev/ofw/openfirm.h:1.46
--- src/sys/dev/ofw/openfirm.h:1.45	Fri Feb  5 17:17:59 2021
+++ src/sys/dev/ofw/openfirm.h	Sat Feb  6 16:07:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.45 2021/02/05 17:17:59 thorpej Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.46 2021/02/06 16:07:13 thorpej Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -104,6 +104,7 @@ int	openfirmware(void *);
 /*
  * Functions and variables provided by machine-independent code.
  */
+#ifdef _KERNEL
 struct device_compatible_entry;
 
 devhandle_t	devhandle_from_of(int);
@@ -131,6 +132,7 @@ char	*of_get_mode_string(char *, int);
 
 void	of_enter_i2c_devs(prop_dictionary_t, int, size_t, int);
 void	of_enter_spi_devs(prop_dictionary_t, int, size_t);
+#endif /* _KERNEL */
 
 bool	of_hasprop(int, const char *);
 #define of_getprop_bool	of_hasprop



CVS commit: src/sys/conf

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Feb  6 16:03:31 UTC 2021

Modified Files:
src/sys/conf: files

Log Message:
defflag USBHIST_PRINT


To generate a diff of this commit:
cvs rdiff -u -r1.1278 -r1.1279 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.1278 src/sys/conf/files:1.1279
--- src/sys/conf/files:1.1278	Sat Jan 16 23:51:50 2021
+++ src/sys/conf/files	Sat Feb  6 16:03:31 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1278 2021/01/16 23:51:50 chs Exp $
+#	$NetBSD: files,v 1.1279 2021/02/06 16:03:31 dbj Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -235,6 +235,7 @@ file	kern/kern_history.c		kernhist
 #
 # top level usb debug defines
 defflag	opt_usb.h			USB_DEBUG: KERNHIST
+defflag	opt_usb.h			USBHIST_PRINT
 defparam opt_usb.h			USBHIST_SIZE
 
 #



CVS commit: src/sys/ddb

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Feb  6 16:03:26 UTC 2021

Modified Files:
src/sys/ddb: files.ddb

Log Message:
defparam DB_MAX_WIDTH


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/ddb/files.ddb

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

Modified files:

Index: src/sys/ddb/files.ddb
diff -u src/sys/ddb/files.ddb:1.12 src/sys/ddb/files.ddb:1.13
--- src/sys/ddb/files.ddb:1.12	Sun Mar  4 07:14:50 2018
+++ src/sys/ddb/files.ddb	Sat Feb  6 16:03:26 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ddb,v 1.12 2018/03/04 07:14:50 mlelstv Exp $
+#	$NetBSD: files.ddb,v 1.13 2021/02/06 16:03:26 dbj Exp $
 
 #
 # DDB options
@@ -6,7 +6,7 @@
 defflag opt_ddb.h		DDB DDB_VERBOSE_HELP
 defparam opt_ddbparam.h		DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE
 DDB_BREAK_CHAR DDB_KEYCODE DDB_PANICSTACKFRAMES
-DDB_COMMANDONENTER DB_MAX_LINE
+DDB_COMMANDONENTER DB_MAX_LINE DB_MAX_WIDTH
 
 define	ddb
 file	ddb/db_access.c			ddb | kgdb



CVS commit: src/distrib/amd64/cdroms

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Feb  6 16:02:43 UTC 2021

Modified Files:
src/distrib/amd64/cdroms: Makefile.cdrom
src/distrib/amd64/cdroms/bootcd-com: Makefile

Log Message:
distrib/amd64/cdroms: honor CDBOOTOPTIONS when installing EFI bootloader


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/amd64/cdroms/Makefile.cdrom
cvs rdiff -u -r1.6 -r1.7 src/distrib/amd64/cdroms/bootcd-com/Makefile

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

Modified files:

Index: src/distrib/amd64/cdroms/Makefile.cdrom
diff -u src/distrib/amd64/cdroms/Makefile.cdrom:1.23 src/distrib/amd64/cdroms/Makefile.cdrom:1.24
--- src/distrib/amd64/cdroms/Makefile.cdrom:1.23	Fri Feb 10 16:53:51 2017
+++ src/distrib/amd64/cdroms/Makefile.cdrom	Sat Feb  6 16:02:43 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.cdrom,v 1.23 2017/02/10 16:53:51 christos Exp $
+# $NetBSD: Makefile.cdrom,v 1.24 2021/02/06 16:02:43 dbj Exp $
 
 .include 
 .include 
@@ -27,6 +27,12 @@ ${EFIBOOTIMG}: ${DESTDIR}/usr/mdec/bootx
 	${RM} -rf efiboot/EFI/boot
 	${MKDIR} ${MKDIRPERM} efiboot/EFI/boot
 	${INSTALL} ${COPY} -m 0444 ${.ALLSRC} efiboot/EFI/boot/
+.if defined(CDBOOTOPTIONS)
+	${CHMOD} +w efiboot/EFI/boot/bootx64.efi efiboot/EFI/boot/bootia32.efi
+	${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} efiboot/EFI/boot/bootx64.efi
+	${TOOL_INSTALLBOOT} -m${MACHINE} -e ${CDBOOTOPTIONS} efiboot/EFI/boot/bootia32.efi
+	${CHMOD} -w efiboot/EFI/boot/bootx64.efi efiboot/EFI/boot/bootia32.efi
+.endif
 	${TOOL_MAKEFS} -M 1m -m 1m -B ${TARGET_ENDIANNESS} ${MAKEFS_TIMESTAMP} \
 		-t msdos -o F=12,c=1 ${EFIBOOTIMG} efiboot
 

Index: src/distrib/amd64/cdroms/bootcd-com/Makefile
diff -u src/distrib/amd64/cdroms/bootcd-com/Makefile:1.6 src/distrib/amd64/cdroms/bootcd-com/Makefile:1.7
--- src/distrib/amd64/cdroms/bootcd-com/Makefile:1.6	Wed May 15 13:47:41 2019
+++ src/distrib/amd64/cdroms/bootcd-com/Makefile	Sat Feb  6 16:02:43 2021
@@ -1,11 +1,12 @@
-#	$NetBSD: Makefile,v 1.6 2019/05/15 13:47:41 christos Exp $
+#	$NetBSD: Makefile,v 1.7 2021/02/06 16:02:43 dbj Exp $
 #
 
+# HP Proliant iLO serial console is on com1
+CDBOOTOPTIONS=	-o console=com0
+
 .include "${.CURDIR}/../Makefile.cdrom"
 
 CDBASE=		boot-com			# gives ${CDBASE}.iso
-# HP Proliant iLO serial console is on com1
-CDBOOTOPTIONS=	-o console=com0
 
 CDBUILDEXTRA+=	boot.cfg		# Add boot.cfg file
 CLEANFILES+=	boot.cfg



CVS commit: src/usr.bin/tsort

2021-02-06 Thread Darrin B. Jewell
Module Name:src
Committed By:   dbj
Date:   Sat Feb  6 16:02:16 UTC 2021

Modified Files:
src/usr.bin/tsort: tsort.c

Log Message:
tsort: fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.bin/tsort/tsort.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/tsort/tsort.c
diff -u src/usr.bin/tsort/tsort.c:1.25 src/usr.bin/tsort/tsort.c:1.26
--- src/usr.bin/tsort/tsort.c:1.25	Mon Aug 17 16:26:03 2020
+++ src/usr.bin/tsort/tsort.c	Sat Feb  6 16:02:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsort.c,v 1.25 2020/08/17 16:26:03 christos Exp $	*/
+/*	$NetBSD: tsort.c,v 1.26 2021/02/06 16:02:16 dbj Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)tsort.c	8.3 (Berkeley) 5/4/95";
 #endif
-__RCSID("$NetBSD: tsort.c,v 1.25 2020/08/17 16:26:03 christos Exp $");
+__RCSID("$NetBSD: tsort.c,v 1.26 2021/02/06 16:02:16 dbj Exp $");
 #endif /* not lint */
 
 #include 
@@ -71,7 +71,7 @@ __RCSID("$NetBSD: tsort.c,v 1.25 2020/08
  *
  *  Should be compatible with AT tsort HOWEVER the output is not identical
  *  (i.e. for most graphs there is more than one sorted order, and this tsort
- *  usually generates a different one then the AT tsort).  Also, cycle
+ *  usually generates a different one than the AT tsort).  Also, cycle
  *  reporting seems to be more accurate in this version (the AT tsort
  *  sometimes says a node is in a cycle when it isn't).
  *



CVS commit: [netbsd-9] src/doc

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 15:31:03 UTC 2021

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

Log Message:
Ticket #1199


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 src/doc/CHANGES-9.2

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.2
diff -u src/doc/CHANGES-9.2:1.1.2.39 src/doc/CHANGES-9.2:1.1.2.40
--- src/doc/CHANGES-9.2:1.1.2.39	Thu Feb  4 19:31:25 2021
+++ src/doc/CHANGES-9.2	Sat Feb  6 15:31:03 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.2,v 1.1.2.39 2021/02/04 19:31:25 martin Exp $
+# $NetBSD: CHANGES-9.2,v 1.1.2.40 2021/02/06 15:31:03 martin Exp $
 
 A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2
 release:
@@ -1483,3 +1483,9 @@ sys/dev/usb/usbdevs_data.h			(regen)
 	To avoid confusion use TP-Link's names for these variants.
 	[nia, ticket #1197]
 
+lib/libc/arch/mips/sys/cerror.S			1.20
+
+	MIPS n32/n64: fix __errno() calls from other libraries
+	(eg __posix_cerror() in libposix).
+	[simonb, ticket #1199]
+



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

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 15:30:14 UTC 2021

Modified Files:
src/lib/libc/arch/mips/sys [netbsd-9]: cerror.S

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1199):

lib/libc/arch/mips/sys/cerror.S: revision 1.20

For mips n32/n64 explicitly save the GP reg on the stack, and
restore it _after_ the call to __errno().  Fixes sending the
__errno() call off to nowhereland when this code is included
in another library (eg __posix_cerror() in libposix).  Failure
picked up by the ATF lib/libposix/posix1/t_rename test.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.28.1 src/lib/libc/arch/mips/sys/cerror.S

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

Modified files:

Index: src/lib/libc/arch/mips/sys/cerror.S
diff -u src/lib/libc/arch/mips/sys/cerror.S:1.19 src/lib/libc/arch/mips/sys/cerror.S:1.19.28.1
--- src/lib/libc/arch/mips/sys/cerror.S:1.19	Thu Sep 12 15:36:15 2013
+++ src/lib/libc/arch/mips/sys/cerror.S	Sat Feb  6 15:30:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.19 2013/09/12 15:36:15 joerg Exp $	*/
+/*	$NetBSD: cerror.S,v 1.19.28.1 2021/02/06 15:30:14 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 	RCSID("from: @(#)cerror.s	8.1 (Berkeley) 6/16/93")
 #else
-	RCSID("$NetBSD: cerror.S,v 1.19 2013/09/12 15:36:15 joerg Exp $")
+	RCSID("$NetBSD: cerror.S,v 1.19.28.1 2021/02/06 15:30:14 martin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -50,24 +50,33 @@
 	.globl	_C_LABEL(__errno)
 NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
 	.mask	0x8000, (CALLFRAME_RA - CALLFRAME_SIZ)
-	PIC_PROLOGUE(__cerror)
+	PIC_PROLOGUE(__cerror)		# saves caller gp in t3 (n32/n64)
 	PTR_SUBU	sp, CALLFRAME_SIZ
 	PTR_S		ra, CALLFRAME_RA(sp)
 	INT_S		v0, CALLFRAME_S0(sp)	# save errno value
+#if defined(__mips_n32) || defined(__mips_n64)
+	PTR_S		t3, CALLFRAME_GP(sp)	# save caller gp (in t3)
+#endif
 
 	SAVE_GP(CALLFRAME_GP)
 
 	PTR_LA		t9, _C_LABEL(__errno)	# locate address of errno
-	RESTORE_GP64# restore GP (from t3)
+
 	jalr		t9			# __errno()
 
+#if defined(__mips_n32) || defined(__mips_n64)
+	PTR_L		gp, CALLFRAME_GP(sp)	# restore caller gp
+#endif
 	INT_L		t0, CALLFRAME_S0(sp)
 	PTR_L		ra, CALLFRAME_RA(sp)
 	INT_S		t0, 0(v0)		# update errno value
 	PTR_ADDU	sp, CALLFRAME_SIZ
 	li		v0, -1
 	li		v1, -1
-	j		ra			# GP has been restored.
+
+	# Note we don't use PIC_RETURN() here as the GP is stored
+	# on the stack and not in the t3 reg (for the n32/n64 case).
+	j		ra
 END(__cerror)
 #else		
 	.globl	_C_LABEL(errno)



CVS commit: [netbsd-8] src/doc

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 15:29:14 UTC 2021

Modified Files:
src/doc [netbsd-8]: CHANGES-8.3

Log Message:
Tickets #1648 and #1649


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.67 -r1.1.2.68 src/doc/CHANGES-8.3

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-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.67 src/doc/CHANGES-8.3:1.1.2.68
--- src/doc/CHANGES-8.3:1.1.2.67	Fri Jan 29 18:19:21 2021
+++ src/doc/CHANGES-8.3	Sat Feb  6 15:29:14 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.67 2021/01/29 18:19:21 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.68 2021/02/06 15:29:14 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1532,3 +1532,19 @@ sys/dev/hyperv/vmbus.c1.12 (patch)
 	hvkbd(4), vmbus(4), hvn(4): don't wait forever.
 	[nonaka, ticket #1647]
 
+sys/conf/param.c1.69
+sys/kern/init_main.c1.533 (via patch)
+sys/sys/param.h	1.679
+
+	Set a better default for MAXFILES on larger RAM machines if not
+	otherwise specified the kernel config file.  Arbitary numbers are
+	20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or
+	more.
+	[simonb, ticket #1649]
+
+lib/libc/arch/mips/sys/cerror.S			1.20
+
+	MIPS n32/n64: fix __errno() calls from other libraries
+	(eg __posix_cerror() in libposix).
+	[simonb, ticket #1648]
+



CVS commit: [netbsd-8] src/lib/libc/arch/mips/sys

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 15:26:16 UTC 2021

Modified Files:
src/lib/libc/arch/mips/sys [netbsd-8]: cerror.S

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1648):

lib/libc/arch/mips/sys/cerror.S: revision 1.20

For mips n32/n64 explicitly save the GP reg on the stack, and
restore it _after_ the call to __errno().  Fixes sending the
__errno() call off to nowhereland when this code is included
in another library (eg __posix_cerror() in libposix).  Failure
picked up by the ATF lib/libposix/posix1/t_rename test.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.19.18.1 src/lib/libc/arch/mips/sys/cerror.S

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

Modified files:

Index: src/lib/libc/arch/mips/sys/cerror.S
diff -u src/lib/libc/arch/mips/sys/cerror.S:1.19 src/lib/libc/arch/mips/sys/cerror.S:1.19.18.1
--- src/lib/libc/arch/mips/sys/cerror.S:1.19	Thu Sep 12 15:36:15 2013
+++ src/lib/libc/arch/mips/sys/cerror.S	Sat Feb  6 15:26:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cerror.S,v 1.19 2013/09/12 15:36:15 joerg Exp $	*/
+/*	$NetBSD: cerror.S,v 1.19.18.1 2021/02/06 15:26:16 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 	RCSID("from: @(#)cerror.s	8.1 (Berkeley) 6/16/93")
 #else
-	RCSID("$NetBSD: cerror.S,v 1.19 2013/09/12 15:36:15 joerg Exp $")
+	RCSID("$NetBSD: cerror.S,v 1.19.18.1 2021/02/06 15:26:16 martin Exp $")
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -50,24 +50,33 @@
 	.globl	_C_LABEL(__errno)
 NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
 	.mask	0x8000, (CALLFRAME_RA - CALLFRAME_SIZ)
-	PIC_PROLOGUE(__cerror)
+	PIC_PROLOGUE(__cerror)		# saves caller gp in t3 (n32/n64)
 	PTR_SUBU	sp, CALLFRAME_SIZ
 	PTR_S		ra, CALLFRAME_RA(sp)
 	INT_S		v0, CALLFRAME_S0(sp)	# save errno value
+#if defined(__mips_n32) || defined(__mips_n64)
+	PTR_S		t3, CALLFRAME_GP(sp)	# save caller gp (in t3)
+#endif
 
 	SAVE_GP(CALLFRAME_GP)
 
 	PTR_LA		t9, _C_LABEL(__errno)	# locate address of errno
-	RESTORE_GP64# restore GP (from t3)
+
 	jalr		t9			# __errno()
 
+#if defined(__mips_n32) || defined(__mips_n64)
+	PTR_L		gp, CALLFRAME_GP(sp)	# restore caller gp
+#endif
 	INT_L		t0, CALLFRAME_S0(sp)
 	PTR_L		ra, CALLFRAME_RA(sp)
 	INT_S		t0, 0(v0)		# update errno value
 	PTR_ADDU	sp, CALLFRAME_SIZ
 	li		v0, -1
 	li		v1, -1
-	j		ra			# GP has been restored.
+
+	# Note we don't use PIC_RETURN() here as the GP is stored
+	# on the stack and not in the t3 reg (for the n32/n64 case).
+	j		ra
 END(__cerror)
 #else		
 	.globl	_C_LABEL(errno)



CVS commit: [netbsd-8] src/sys

2021-02-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  6 15:22:20 UTC 2021

Modified Files:
src/sys/conf [netbsd-8]: param.c
src/sys/kern [netbsd-8]: init_main.c
src/sys/sys [netbsd-8]: param.h

Log Message:
Pull up following revision(s) (requested by simonb in ticket #1649):

sys/sys/param.h: revision 1.679
sys/conf/param.c: revision 1.69
sys/kern/init_main.c: revision 1.533 (via patch)

Set a better default for MAXFILES on larger RAM machines if not
otherwise specified the kernel config file.  Arbitary numbers are
20,000 files for 16GB RAM or more and 10,000 files for 1GB RAM or
more.

TODO: Adjust this and other values totally dynamically.


To generate a diff of this commit:
cvs rdiff -u -r1.67.10.1 -r1.67.10.2 src/sys/conf/param.c
cvs rdiff -u -r1.490.6.1 -r1.490.6.2 src/sys/kern/init_main.c
cvs rdiff -u -r1.542.2.10 -r1.542.2.11 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/sys/conf/param.c
diff -u src/sys/conf/param.c:1.67.10.1 src/sys/conf/param.c:1.67.10.2
--- src/sys/conf/param.c:1.67.10.1	Wed Apr 10 07:39:31 2019
+++ src/sys/conf/param.c	Sat Feb  6 15:22:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.c,v 1.67.10.1 2019/04/10 07:39:31 martin Exp $	*/
+/*	$NetBSD: param.c,v 1.67.10.2 2021/02/06 15:22:19 martin Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1989 Regents of the University of California.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.67.10.1 2019/04/10 07:39:31 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: param.c,v 1.67.10.2 2021/02/06 15:22:19 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hz.h"
@@ -105,10 +105,6 @@ __KERNEL_RCSID(0, "$NetBSD: param.c,v 1.
 #define	HZ 100
 #endif
 
-#ifndef MAXFILES
-#define	MAXFILES	(3 * (NPROC + MAXUSERS) + 80)
-#endif
-
 #ifndef MAXEXEC
 #define	MAXEXEC		16
 #endif

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.490.6.1 src/sys/kern/init_main.c:1.490.6.2
--- src/sys/kern/init_main.c:1.490.6.1	Fri Jul 13 15:49:55 2018
+++ src/sys/kern/init_main.c	Sat Feb  6 15:22:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $	*/
+/*	$NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.1 2018/07/13 15:49:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.490.6.2 2021/02/06 15:22:19 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -447,7 +447,23 @@ main(void)
 	10, VNODE_KMEM_MAXPCT) / VNODE_COST;
 	if (usevnodes > desiredvnodes)
 		desiredvnodes = usevnodes;
-#endif
+#endif /* NVNODE_IMPLICIT */
+#ifdef MAXFILES_IMPLICIT
+	/*
+	 * If maximum number of files is not explicitly defined in
+	 * kernel config, adjust the number so that it is somewhat
+	 * more reasonable on machines with larger memory sizes.
+	 * Arbitary numbers are 20,000 files for 16GB RAM or more
+	 * and 10,000 files for 1GB RAM or more.
+	 *
+	 * XXXtodo: adjust this and other values totally dynamically
+	 */
+	if (ctob((uint64_t)physmem) >= 16ULL * 1024 * 1024 * 1024)
+		maxfiles = MAX(maxfiles, 2);
+	if (ctob((uint64_t)physmem) >= 1024 * 1024 * 1024)
+		maxfiles = MAX(maxfiles, 1);
+#endif /* MAXFILES_IMPLICIT */
+
 	vfsinit();
 	lf_init();
 

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.542.2.10 src/sys/sys/param.h:1.542.2.11
--- src/sys/sys/param.h:1.542.2.10	Tue Apr 14 15:50:28 2020
+++ src/sys/sys/param.h	Sat Feb  6 15:22:19 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.542.2.10 2020/04/14 15:50:28 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.542.2.11 2021/02/06 15:22:19 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -148,13 +148,17 @@
 #include 
 #include 
 #ifndef NPROC
-#define	NPROC	(20 + 16 * MAXUSERS)
+#define	NPROC			(20 + 16 * MAXUSERS)
+#endif
+#ifndef MAXFILES
+#define	MAXFILES		(3 * (NPROC + MAXUSERS) + 80)
+#define	MAXFILES_IMPLICIT
 #endif
 #ifndef NTEXT
-#define	NTEXT	(80 + NPROC / 8)		/* actually the object cache */
+#define	NTEXT			(80 + NPROC / 8) /* actually the object cache */
 #endif
 #ifndef NVNODE
-#define	NVNODE	(NPROC + NTEXT + 100)
+#define	NVNODE			(NPROC + NTEXT + 100)
 #define	NVNODE_IMPLICIT
 #endif
 #ifndef VNODE_KMEM_MAXPCT
@@ -163,7 +167,7 @@
 #ifndef BUFCACHE_VA_MAXPCT
 #define	BUFCACHE_VA_MAXPCT	20
 #endif
-#define	VNODE_COST	2048			/* assumed space in bytes */
+#define	VNODE_COST		2048		/* assumed space in bytes */
 #endif /* _KERNEL */
 
 /* Signals. */



CVS commit: src/lib/libcurses

2021-02-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Feb  6 13:58:09 UTC 2021

Modified Files:
src/lib/libcurses: curses_screen.3

Log Message:
libncurses: fix grammar in manual page


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/lib/libcurses/curses_screen.3

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/curses_screen.3
diff -u src/lib/libcurses/curses_screen.3:1.26 src/lib/libcurses/curses_screen.3:1.27
--- src/lib/libcurses/curses_screen.3:1.26	Thu Mar 12 11:38:28 2020
+++ src/lib/libcurses/curses_screen.3	Sat Feb  6 13:58:09 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: curses_screen.3,v 1.26 2020/03/12 11:38:28 roy Exp $
+.\"	$NetBSD: curses_screen.3,v 1.27 2021/02/06 13:58:09 rillig Exp $
 .\"
 .\" Copyright (c) 2002
 .\"	Brett Lymn (bl...@netbsd.org, brett_l...@yahoo.com.au)
@@ -295,7 +295,7 @@ The Curses package appeared in
 .Bx 4.0 .
 The
 .Fn resizeterm
-function is a
+function is an
 .Em ncurses
 extension to the Curses library and was added in
 .Nx 1.6 .
@@ -306,7 +306,7 @@ and
 .Fn set_tabsize
 functions are
 .Em ncurses
-extension to the Curses library and was added in
+extensions to the Curses library and were added in
 .Nx 8.0 .
 .Sh BUGS
 There is currently an issue with cursor movement in a 1 line sized window



CVS commit: src/share/man/man9

2021-02-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Feb  6 13:55:40 UTC 2021

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

Log Message:
Fix various typos, etc


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/share/man/man9/audio.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/audio.9
diff -u src/share/man/man9/audio.9:1.59 src/share/man/man9/audio.9:1.60
--- src/share/man/man9/audio.9:1.59	Sat Feb  6 06:15:13 2021
+++ src/share/man/man9/audio.9	Sat Feb  6 13:55:40 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.59 2021/02/06 06:15:13 isaki Exp $
+.\"	$NetBSD: audio.9,v 1.60 2021/02/06 13:55:40 nia Exp $
 .\"
 .\" Copyright (c) 1999, 2000 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 9, 2019
+.Dd February 2, 2021
 .Dt AUDIO 9
 .Os
 .Sh NAME
@@ -175,9 +175,9 @@ It should fill the
 .Vt audio_format_t
 structure according to given number
 .Va afp->index .
-If there is no format with given number, return
+If there is no format with the given number, return
 .Er EINVAL .
-It is called at any time.
+It can be called at any time.
 .Bd -literal
 typedef struct audio_format_query {
 	u_int	index;
@@ -185,8 +185,7 @@ typedef struct audio_format_query {
 } audio_format_query_t;
 .Ed
 .Pp
-It is also used to determine the default format.
-The upper layer chooses the most preferred one as default format by following:
+It is also used by the upper layer to determine the default format, as follows:
 .Bl -enum
 .It
 Higher priority is preferred (normally 0, the highest is 3, the lowest is 0).
@@ -197,19 +196,19 @@ is preferred if exists.
 .Dv AUDIO_ENCODING_SLINEAR_OE:16
 is preferred if exists.
 .It
-More channels is preferred.
+The format with more channels is preferred.
 .El
 .Pp
 If the driver supports
 .Dv SLINEAR_NE:16
 and the upper layer chooses it,
-the driver does not need to provide conversion function in
+the driver does not need to provide a conversion function in
 .Va set_format .
 Similarly, if the driver supports
 .Dv SLINEAR_OE:16
 and the upper layer chooses it,
-the driver does not need to provide a conversion function.
-Because the upper layer only supports conversion between
+the driver does not need to provide a conversion function,
+because the upper layer supports conversion between
 .Dv SLINEAR_NE:16
 and
 .Dv SLINEAR_OE:16
@@ -224,7 +223,7 @@ If the driver can not provide the conver
 set priority to \-1.
 It means that the hardware supports this format but the driver does not
 (e.g. AC3), and it will never be chosen.
-.It Dv int set_foramt(void *hdl, int setmode,
+.It Dv int set_format(void *hdl, int setmode,
 .Dv "const audio_params_t *play, const audio_params_t *rec,"
 .Dv "audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)"
 .Pp
@@ -242,8 +241,7 @@ The
 and
 .Va rec
 structures contain the encoding parameters that should be set to the hardware.
-If the driver has query_format interface,
-all parameters on
+If the driver has query_format, all parameters on
 .Va play
 and/or
 .Va rec
@@ -253,8 +251,7 @@ Therefore
 and/or
 .Va rec
 are always settable.
-If the driver does not have query_format interface,
-the driver has to validate the format.
+If the driver does not have query_format, the driver has to validate the format.
 If the hardware does not support
 .Dv AUDIO_ENCODING_SLINEAR_{NE,OE}:16 ,
 conversion information should be filled the
@@ -312,7 +309,7 @@ are guaranteed to be able to consecutive
 specified by
 .Va count.
 .Va codec
-must fill entire
+must fill the entirety of
 .Va dst .
 For example, let count = 100, srcfmt is { precision = 16, channels = 3 },
 dstfmt is { precision = 8, channels = 4 },
@@ -334,7 +331,7 @@ property the same value is passed in bot
 .Va play
 and
 .Va rec .
-Return 0 on success, otherwise an error code.
+Returns 0 on success, otherwise an error code.
 It is called in the Attach or Closed phases.
 .It Dv int round_blocksize(void *hdl, int bs, int mode,
 .Dv "const audio_params_t *param)"
@@ -365,7 +362,7 @@ are done.
 A hardware driver that needs to get the hardware in and out of command
 mode for each change can save all the changes during previous calls and
 do them all here.
-Return 0 on success, otherwise an error code.
+Returns 0 on success, otherwise an error code.
 It is called in the Attach or Closed phases.
 .It Dv int init_output(void *hdl, void *buffer, int size)
 optional, is called before any output starts, but when the total
@@ -383,7 +380,7 @@ of the input
 .Va buffer
 has been determined.
 It can be used to initialize looping DMA for hardware that needs that.
-Return 0 on success, otherwise an error code.
+Returns 0 on success, otherwise an error code.
 It is called in the Attach or Closed phases.
 .It Dv int start_output(void *hdl, void *block, int 

CVS commit: src/sys/kern

2021-02-06 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb  6 13:54:48 UTC 2021

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

Log Message:
Do not cast memcpy arguments when the intention is unaligned access.
The standard is pretty explicit that misaligned pointers is UB and LLVM
does exploit the promised alignment on SPARC, resulting in kernel
crashes during early boot.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/subr_kmem.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_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.81 src/sys/kern/subr_kmem.c:1.82
--- src/sys/kern/subr_kmem.c:1.81	Sun Jan 24 17:29:11 2021
+++ src/sys/kern/subr_kmem.c	Sat Feb  6 13:54:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.81 2021/01/24 17:29:11 thorpej Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.82 2021/02/06 13:54:48 joerg Exp $	*/
 
 /*
  * Copyright (c) 2009-2020 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.81 2021/01/24 17:29:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.82 2021/02/06 13:54:48 joerg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
@@ -505,7 +505,7 @@ kmem_tmpbuf_free(void *buf, size_t size,
 static void
 kmem_size_set(void *p, size_t sz)
 {
-	memcpy((size_t *)((uintptr_t)p + sz), , sizeof(size_t));
+	memcpy((char *)p + sz, , sizeof(size_t));
 }
 
 static void
@@ -513,13 +513,13 @@ kmem_size_check(void *p, size_t sz)
 {
 	size_t hsz;
 
-	memcpy(, (size_t *)((uintptr_t)p + sz), sizeof(size_t));
+	memcpy(, (char *)p + sz, sizeof(size_t));
 
 	if (hsz != sz) {
 		panic("kmem_free(%p, %zu) != allocated size %zu; overwrote?",
 		p, sz, hsz);
 	}
 
-	memset((size_t *)((uintptr_t)p + sz), 0xff, sizeof(size_t));
+	memset((char *)p + sz, 0xff, sizeof(size_t));
 }
 #endif /* defined(KMEM_SIZE) */



CVS commit: src/sys/dev/sbus

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 13:02:28 UTC 2021

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
Remove an extra mutex_spin_exit() in error path.
This is a part of rev 1.38.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/sbus/dbri.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/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.44 src/sys/dev/sbus/dbri.c:1.45
--- src/sys/dev/sbus/dbri.c:1.44	Sat Feb  6 09:15:11 2021
+++ src/sys/dev/sbus/dbri.c	Sat Feb  6 13:02:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $	*/
+/*	$NetBSD: dbri.c,v 1.45 2021/02/06 13:02:28 isaki Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.45 2021/02/06 13:02:28 isaki Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1065,7 +1065,6 @@ mmcodec_setcontrol(struct dbri_softc *sc
 		if (error == EINTR) {
 			DPRINTF("%s: interrupted\n", device_xname(sc->sc_dev));
 			ret = -1;
-			mutex_spin_exit(>sc_intr_lock);
 			goto fail;
 		}
 		bail++;



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:59:13 UTC 2021

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

Log Message:
Remove an extra mutex_spin_exit() in yds_resume().
This one has been moved to before yds_init() in rev 1.59.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/yds.c

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

Modified files:

Index: src/sys/dev/pci/yds.c
diff -u src/sys/dev/pci/yds.c:1.65 src/sys/dev/pci/yds.c:1.66
--- src/sys/dev/pci/yds.c:1.65	Sat Feb 29 05:51:11 2020
+++ src/sys/dev/pci/yds.c	Sat Feb  6 12:59:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: yds.c,v 1.65 2020/02/29 05:51:11 isaki Exp $	*/
+/*	$NetBSD: yds.c,v 1.66 2021/02/06 12:59:13 isaki Exp $	*/
 
 /*
  * Copyright (c) 2000, 2001 Kazuki Sakamoto and Minoura Makoto.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.65 2020/02/29 05:51:11 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: yds.c,v 1.66 2021/02/06 12:59:13 isaki Exp $");
 
 #include "mpu.h"
 
@@ -725,7 +725,6 @@ yds_resume(device_t dv, const pmf_qual_t
 
 	pci_conf_write(pc, tag, YDS_PCI_DSCTRL, sc->sc_dsctrl);
 	sc->sc_enabled = 1;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->sc_codec[0].codec_if->vtbl->restore_ports(sc->sc_codec[0].codec_if);
 	mutex_exit(>sc_lock);
 



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:55:34 UTC 2021

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

Log Message:
Add a missing mutex_spin_exit().


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/sv.c

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

Modified files:

Index: src/sys/dev/pci/sv.c
diff -u src/sys/dev/pci/sv.c:1.58 src/sys/dev/pci/sv.c:1.59
--- src/sys/dev/pci/sv.c:1.58	Sun Apr 19 08:18:19 2020
+++ src/sys/dev/pci/sv.c	Sat Feb  6 12:55:34 2021
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.58 2020/04/19 08:18:19 isaki Exp $ */
+/*  $NetBSD: sv.c,v 1.59 2021/02/06 12:55:34 isaki Exp $ */
 /*  $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
 
 /*
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.58 2020/04/19 08:18:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.59 2021/02/06 12:55:34 isaki Exp $");
 
 #include 
 #include 
@@ -1236,6 +1236,7 @@ sv_mixer_get_port(void *addr, mixer_ctrl
 			}
 		}
 
+		mutex_spin_exit(>sc_intr_lock);
 		return error;
 	}
 



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

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:53:37 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: pxa2x0_ac97.c

Log Message:
Fix "locking against myself".
halt_{input,output} will be called with sc_intr_lock held.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/xscale/pxa2x0_ac97.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/xscale/pxa2x0_ac97.c
diff -u src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.19 src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.20
--- src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.19	Sat Feb  6 07:16:54 2021
+++ src/sys/arch/arm/xscale/pxa2x0_ac97.c	Sat Feb  6 12:53:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_ac97.c,v 1.19 2021/02/06 07:16:54 isaki Exp $	*/
+/*	$NetBSD: pxa2x0_ac97.c,v 1.20 2021/02/06 12:53:36 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -724,14 +724,12 @@ acu_halt_output(void *arg)
 {
 	struct acu_softc *sc = arg;
 
-	mutex_spin_enter(>sc_intr_lock);
 	if (sc->sc_txdma) {
 		acu_reg_write(sc, AC97_POCR, 0);
 		acu_reg_write(sc, AC97_POSR, AC97_FIFOE);
 		pxa2x0_dmac_abort_xfer(sc->sc_txdma->ad_dx);
 		sc->sc_txdma = NULL;
 	}
-	mutex_spin_exit(>sc_intr_lock);
 	return (0);
 }
 
@@ -740,14 +738,12 @@ acu_halt_input(void *arg)
 {
 	struct acu_softc *sc = arg;
 
-	mutex_spin_enter(>sc_intr_lock);
 	if (sc->sc_rxdma) {
 		acu_reg_write(sc, AC97_PICR, 0);
 		acu_reg_write(sc, AC97_PISR, AC97_FIFOE);
 		pxa2x0_dmac_abort_xfer(sc->sc_rxdma->ad_dx);
 		sc->sc_rxdma = NULL;
 	}
-	mutex_spin_exit(>sc_intr_lock);
 	return (0);
 }
 



CVS commit: src/sys/arch/x68k/dev

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 12:50:04 UTC 2021

Modified Files:
src/sys/arch/x68k/dev: vs.c vsvar.h

Log Message:
Remove an unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x68k/dev/vsvar.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.53 src/sys/arch/x68k/dev/vs.c:1.54
--- src/sys/arch/x68k/dev/vs.c:1.53	Sat Feb  6 09:27:35 2021
+++ src/sys/arch/x68k/dev/vs.c	Sat Feb  6 12:50:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.53 2021/02/06 09:27:35 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.54 2021/02/06 12:50:04 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.53 2021/02/06 09:27:35 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.54 2021/02/06 12:50:04 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -212,7 +212,6 @@ vs_attach(device_t parent, device_t self
 	/* Initialize sc */
 	sc->sc_iot = iot;
 	sc->sc_ioh = ioh;
-	sc->sc_hw_if = _hw_if;
 	sc->sc_addr = (void *) ia->ia_addr;
 	sc->sc_dmas = NULL;
 	sc->sc_prev_vd = NULL;

Index: src/sys/arch/x68k/dev/vsvar.h
diff -u src/sys/arch/x68k/dev/vsvar.h:1.18 src/sys/arch/x68k/dev/vsvar.h:1.19
--- src/sys/arch/x68k/dev/vsvar.h:1.18	Sat Feb  6 09:27:35 2021
+++ src/sys/arch/x68k/dev/vsvar.h	Sat Feb  6 12:50:04 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vsvar.h,v 1.18 2021/02/06 09:27:35 isaki Exp $	*/
+/*	$NetBSD: vsvar.h,v 1.19 2021/02/06 12:50:04 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -99,8 +99,6 @@ struct vs_softc {
 		int rate;
 	} sc_current;
 
-	const struct audio_hw_if *sc_hw_if;
-
 	void (*sc_pintr)(void *);
 	void (*sc_rintr)(void *);
 	void *sc_parg;



CVS commit: src/usr.sbin/installboot

2021-02-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Feb  6 12:18:45 UTC 2021

Modified Files:
src/usr.sbin/installboot: installboot.8

Log Message:
Mention fdisk(8) and x86/mbr(8) in example for x86, for careless
people like me ;).

Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/usr.sbin/installboot/installboot.8

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/installboot/installboot.8
diff -u src/usr.sbin/installboot/installboot.8:1.99 src/usr.sbin/installboot/installboot.8:1.100
--- src/usr.sbin/installboot/installboot.8:1.99	Sat Jun  6 20:30:23 2020
+++ src/usr.sbin/installboot/installboot.8	Sat Feb  6 12:18:45 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: installboot.8,v 1.99 2020/06/06 20:30:23 wiz Exp $
+.\"	$NetBSD: installboot.8,v 1.100 2021/02/06 12:18:45 rin Exp $
 .\"
 .\" Copyright (c) 2002-2019 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 5, 2019
+.Dd February 6, 2021
 .Dt INSTALLBOOT 8
 .Os
 .Sh NAME
@@ -784,8 +784,17 @@ Install new boot blocks on an existing
 .Sy FFSv2
 mounted root file system on
 .Sq wd0 ,
-setting the timeout to five seconds, after copying a new secondary
-bootstrap:
+setting the timeout to five seconds, after installing an MBR bootcode and
+copying a new secondary bootstrap:
+.Dl Ic fdisk -c /usr/mdec/mbr /dev/rwd0d
+.Bd -ragged -offset indent-two -compact
+.Em Note :
+See
+.Xr fdisk 8
+and
+.Xr x86/mbr 8
+for more details.
+.Ed
 .Dl Ic cp /usr/mdec/boot /boot
 .Dl Ic installboot -v -o timeout=5 /dev/rwd0a /usr/mdec/bootxx_ffsv2
 .Bd -ragged -offset indent-two -compact
@@ -958,6 +967,7 @@ already present:
 .Xr disklabel 8 ,
 .Xr dumpfs 8 ,
 .Xr fdisk 8 ,
+.Xr x86/mbr 8 ,
 .Xr x86/pxeboot 8
 .
 .Sh HISTORY



CVS commit: src/share/man/man4

2021-02-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Feb  6 12:13:44 UTC 2021

Modified Files:
src/share/man/man4: pad.4

Log Message:
Explain the format of the raw PCM data users can read from a pad(4).

Since it's headerless this is important so the data can be interpreted
properly. Also, ordinary audio ioctls cannot be used on a pad and the
format can't be changed, so applications that attempt to automatically
determine the format of a device like audiorecord don't work.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/pad.4

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/man4/pad.4
diff -u src/share/man/man4/pad.4:1.9 src/share/man/man4/pad.4:1.10
--- src/share/man/man4/pad.4:1.9	Sat Feb  6 12:07:57 2021
+++ src/share/man/man4/pad.4	Sat Feb  6 12:13:44 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: pad.4,v 1.9 2021/02/06 12:07:57 nia Exp $
+.\" $NetBSD: pad.4,v 1.10 2021/02/06 12:13:44 nia Exp $
 .\"
 .\" Copyright (c) 2007 Jared D. McNeill 
 .\" All rights reserved.
@@ -39,6 +39,10 @@ is a pseudo-device driver which provides
 from consumers of an
 .Xr audio 4
 device to userland.
+.Pp
+The raw PCM data readable from
+.Pa /dev/padN
+is encoded in stereo little-endian 16-bit linear PCM at 44100 Hz.
 .Sh FILES
 The
 .Nm



CVS commit: src/share/man/man4

2021-02-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Feb  6 12:07:58 UTC 2021

Modified Files:
src/share/man/man4: pad.4

Log Message:
Slightly adjust wording.

It does seem to work with multiple applications concurrently writing to
the device in a quick test I did.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/pad.4

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/man4/pad.4
diff -u src/share/man/man4/pad.4:1.8 src/share/man/man4/pad.4:1.9
--- src/share/man/man4/pad.4:1.8	Sat Feb  6 12:01:57 2021
+++ src/share/man/man4/pad.4	Sat Feb  6 12:07:57 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: pad.4,v 1.8 2021/02/06 12:01:57 nia Exp $
+.\" $NetBSD: pad.4,v 1.9 2021/02/06 12:07:57 nia Exp $
 .\"
 .\" Copyright (c) 2007 Jared D. McNeill 
 .\" All rights reserved.
@@ -36,9 +36,9 @@
 .Sh DESCRIPTION
 .Nm
 is a pseudo-device driver which provides support for feeding back PCM data
-from a consumer of the
+from consumers of an
 .Xr audio 4
-API to userland.
+device to userland.
 .Sh FILES
 The
 .Nm



CVS commit: src/share/man/man4

2021-02-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Feb  6 12:01:58 UTC 2021

Modified Files:
src/share/man/man4: pad.4

Log Message:
Add another example of recording the output of an application.

Explain something that confused me.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/share/man/man4/pad.4

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/man4/pad.4
diff -u src/share/man/man4/pad.4:1.7 src/share/man/man4/pad.4:1.8
--- src/share/man/man4/pad.4:1.7	Sat Feb  6 11:58:10 2021
+++ src/share/man/man4/pad.4	Sat Feb  6 12:01:57 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: pad.4,v 1.7 2021/02/06 11:58:10 nia Exp $
+.\" $NetBSD: pad.4,v 1.8 2021/02/06 12:01:57 nia Exp $
 .\"
 .\" Copyright (c) 2007 Jared D. McNeill 
 .\" All rights reserved.
@@ -46,6 +46,10 @@ pseudo-device driver receives data from
 .Pa /dev/audioN
 and feeds the raw PCM output to
 .Pa /dev/padN .
+.Pa /dev/audioN
+is created once
+.Pa /dev/padN
+is opened.
 .Bl -item
 .It
 .Pa /dev/audioN
@@ -58,6 +62,12 @@ The following example streams an MP3 to 
 $ rtunes - < /dev/pad0 &
 $ mpg123 -a /dev/audio1 mozart.mp3
 .Ed
+.Pp
+Record the output of an application (in this case, audioplay):
+.Bd -literal -offset indent
+$ ffmpeg -f s16le -ar 44100 -ac 2 -i /dev/pad0 output.wav
+$ audioplay -d /dev/audio1 input.wav
+.Ed
 .Sh SEE ALSO
 .Xr audio 4
 .Sh HISTORY



CVS commit: src/share/man/man4

2021-02-06 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sat Feb  6 11:58:10 UTC 2021

Modified Files:
src/share/man/man4: pad.4

Log Message:
Use /dev/audioX rather than /dev/soundX in examples.

Avoids accidentally running into confusing behavior.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/share/man/man4/pad.4

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/man4/pad.4
diff -u src/share/man/man4/pad.4:1.6 src/share/man/man4/pad.4:1.7
--- src/share/man/man4/pad.4:1.6	Mon Jul  3 21:30:58 2017
+++ src/share/man/man4/pad.4	Sat Feb  6 11:58:10 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: pad.4,v 1.6 2017/07/03 21:30:58 wiz Exp $
+.\" $NetBSD: pad.4,v 1.7 2021/02/06 11:58:10 nia Exp $
 .\"
 .\" Copyright (c) 2007 Jared D. McNeill 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd November 11, 2007
+.Dd February 6, 2021
 .Dt PAD 4
 .Os
 .Sh NAME
@@ -43,12 +43,12 @@ API to userland.
 The
 .Nm
 pseudo-device driver receives data from
-.Pa /dev/soundN
+.Pa /dev/audioN
 and feeds the raw PCM output to
 .Pa /dev/padN .
 .Bl -item
 .It
-.Pa /dev/soundN
+.Pa /dev/audioN
 .It
 .Pa /dev/padN
 .El
@@ -56,7 +56,7 @@ and feeds the raw PCM output to
 The following example streams an MP3 to an Apple AirTunes compatible device:
 .Bd -literal -offset indent
 $ rtunes - < /dev/pad0 &
-$ mpg123 -a /dev/sound1 mozart.mp3
+$ mpg123 -a /dev/audio1 mozart.mp3
 .Ed
 .Sh SEE ALSO
 .Xr audio 4



CVS commit: src/sys/dev/pci

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:45:17 UTC 2021

Modified Files:
src/sys/dev/pci: auich.c auvia.c

Log Message:
Hold sc_intr_lock in open()/close().
vtbl->{lock,unlock} (in fact ac97_{lock,unlock}) don't seem to need
releasing an interrupt lock.
Confirmed on auich.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/auvia.c

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

Modified files:

Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.159 src/sys/dev/pci/auich.c:1.160
--- src/sys/dev/pci/auich.c:1.159	Sat Feb 29 06:34:30 2020
+++ src/sys/dev/pci/auich.c	Sat Feb  6 09:45:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $	*/
+/*	$NetBSD: auich.c,v 1.160 2021/02/06 09:45:17 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.160 2021/02/06 09:45:17 isaki Exp $");
 
 #include 
 #include 
@@ -930,9 +930,7 @@ auich_open(void *addr, int flags)
 	struct auich_softc *sc;
 
 	sc = (struct auich_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->lock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 	return 0;
 }
 
@@ -942,9 +940,7 @@ auich_close(void *addr)
 	struct auich_softc *sc;
 
 	sc = (struct auich_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->unlock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 }
 
 static int

Index: src/sys/dev/pci/auvia.c
diff -u src/sys/dev/pci/auvia.c:1.86 src/sys/dev/pci/auvia.c:1.87
--- src/sys/dev/pci/auvia.c:1.86	Sun Apr 19 08:18:19 2020
+++ src/sys/dev/pci/auvia.c	Sat Feb  6 09:45:17 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $	*/
+/*	$NetBSD: auvia.c,v 1.87 2021/02/06 09:45:17 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.87 2021/02/06 09:45:17 isaki Exp $");
 
 #include 
 #include 
@@ -614,9 +614,7 @@ auvia_open(void *addr, int flags)
 	struct auvia_softc *sc;
 
 	sc = (struct auvia_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->lock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 	return 0;
 }
 
@@ -626,9 +624,7 @@ auvia_close(void *addr)
 	struct auvia_softc *sc;
 
 	sc = (struct auvia_softc *)addr;
-	mutex_spin_exit(>sc_intr_lock);
 	sc->codec_if->vtbl->unlock(sc->codec_if);
-	mutex_spin_enter(>sc_intr_lock);
 }
 
 static int



CVS commit: src/sys/arch/x68k/dev

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:27:35 UTC 2021

Modified Files:
src/sys/arch/x68k/dev: vs.c vsvar.h

Log Message:
Remove sc_active flag.  sc_[pr]intr can be used instead of it.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/dev/vsvar.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.52 src/sys/arch/x68k/dev/vs.c:1.53
--- src/sys/arch/x68k/dev/vs.c:1.52	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/x68k/dev/vs.c	Sat Feb  6 09:27:35 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.52 2019/06/08 08:02:37 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.53 2021/02/06 09:27:35 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.52 2019/06/08 08:02:37 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.53 2021/02/06 09:27:35 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -72,8 +72,6 @@ static int  vs_dmaintr(void *);
 static int  vs_dmaerrintr(void *);
 
 /* MI audio layer interface */
-static int  vs_open(void *, int);
-static void vs_close(void *);
 static int  vs_query_format(void *, audio_format_query_t *);
 static int  vs_set_format(void *, int,
 	const audio_params_t *, const audio_params_t *,
@@ -108,8 +106,6 @@ CFATTACH_DECL_NEW(vs, sizeof(struct vs_s
 static int vs_attached;
 
 static const struct audio_hw_if vs_hw_if = {
-	.open			= vs_open,
-	.close			= vs_close,
 	.query_format		= vs_query_format,
 	.set_format		= vs_set_format,
 	.commit_settings	= vs_commit_settings,
@@ -220,7 +216,6 @@ vs_attach(device_t parent, device_t self
 	sc->sc_addr = (void *) ia->ia_addr;
 	sc->sc_dmas = NULL;
 	sc->sc_prev_vd = NULL;
-	sc->sc_active = 0;
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_VM);
 
@@ -286,27 +281,6 @@ vs_dmaerrintr(void *hdl)
  */
 
 static int
-vs_open(void *hdl, int flags)
-{
-	struct vs_softc *sc;
-
-	DPRINTF(1, ("vs_open: flags=%d\n", flags));
-	sc = hdl;
-	sc->sc_pintr = NULL;
-	sc->sc_rintr = NULL;
-	sc->sc_active = 0;
-
-	return 0;
-}
-
-static void
-vs_close(void *hdl)
-{
-
-	DPRINTF(1, ("vs_close\n"));
-}
-
-static int
 vs_query_format(void *hdl, audio_format_query_t *afp)
 {
 
@@ -398,9 +372,6 @@ vs_start_output(void *hdl, void *block, 
 	DPRINTF(2, ("%s: block=%p blksize=%d\n", __func__, block, blksize));
 	sc = hdl;
 
-	sc->sc_pintr = intr;
-	sc->sc_parg  = arg;
-
 	/* Find DMA buffer. */
 	for (vd = sc->sc_dmas; vd != NULL; vd = vd->vd_next) {
 		if (KVADDR(vd) <= block && block < KVADDR_END(vd)
@@ -424,11 +395,13 @@ vs_start_output(void *hdl, void *block, 
 	dmac_start_xfer_offset(chan->ch_softc, sc->sc_current.xfer,
 	(int)block - (int)KVADDR(vd), blksize);
 
-	if (sc->sc_active == 0) {
+	if (sc->sc_pintr == NULL) {
+		sc->sc_pintr = intr;
+		sc->sc_parg  = arg;
+
 		vs_set_panout(sc, VS_PANOUT_LR);
 		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
 			MSM6258_CMD, MSM6258_CMD_PLAY_START);
-		sc->sc_active = 1;
 	}
 
 	return 0;
@@ -445,9 +418,6 @@ vs_start_input(void *hdl, void *block, i
 	DPRINTF(2, ("%s: block=%p blksize=%d\n", __func__, block, blksize));
 	sc = hdl;
 
-	sc->sc_rintr = intr;
-	sc->sc_rarg  = arg;
-
 	/* Find DMA buffer. */
 	for (vd = sc->sc_dmas; vd != NULL; vd = vd->vd_next) {
 		if (KVADDR(vd) <= block && block < KVADDR_END(vd)
@@ -471,10 +441,12 @@ vs_start_input(void *hdl, void *block, i
 	dmac_start_xfer_offset(chan->ch_softc, sc->sc_current.xfer,
 	(int)block - (int)KVADDR(vd), blksize);
 
-	if (sc->sc_active == 0) {
+	if (sc->sc_rintr == NULL) {
+		sc->sc_rintr = intr;
+		sc->sc_rarg  = arg;
+
 		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
 			MSM6258_CMD, MSM6258_CMD_REC_START);
-		sc->sc_active = 1;
 	}
 
 	return 0;
@@ -487,13 +459,12 @@ vs_halt_output(void *hdl)
 
 	DPRINTF(1, ("vs_halt_output\n"));
 	sc = hdl;
-	if (sc->sc_active) {
-		/* stop ADPCM play */
-		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
-			MSM6258_CMD, MSM6258_CMD_STOP);
-		sc->sc_active = 0;
-	}
+
+	/* stop ADPCM play */
+	dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+	bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+	MSM6258_CMD, MSM6258_CMD_STOP);
+	sc->sc_pintr = NULL;
 
 	return 0;
 }
@@ -505,13 +476,12 @@ vs_halt_input(void *hdl)
 
 	DPRINTF(1, ("vs_halt_input\n"));
 	sc = hdl;
-	if (sc->sc_active) {
-		/* stop ADPCM recoding */
-		dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
-		bus_space_write_1(sc->sc_iot, sc->sc_ioh,
-			MSM6258_CMD, MSM6258_CMD_STOP);
-		sc->sc_active = 0;
-	}
+
+	/* stop ADPCM recoding */
+	dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
+	bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+	MSM6258_CMD, MSM6258_CMD_STOP);

CVS commit: src/sys/dev/sbus

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:15:11 UTC 2021

Modified Files:
src/sys/dev/sbus: dbri.c dbrivar.h

Log Message:
Remove something like counters.
- Counting {open,close} is done by the MI audio layer.
- trigger_* is not called again between trigger_* and halt_*.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/sbus/dbri.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sbus/dbrivar.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/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.43 src/sys/dev/sbus/dbri.c:1.44
--- src/sys/dev/sbus/dbri.c:1.43	Tue Aug 25 13:36:41 2020
+++ src/sys/dev/sbus/dbri.c	Sat Feb  6 09:15:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $	*/
+/*	$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.43 2020/08/25 13:36:41 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.44 2021/02/06 09:15:11 isaki Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -368,7 +368,6 @@ dbri_attach_sbus(device_t parent, device
 
 	sc->sc_locked = 0;
 	sc->sc_desc_used = 0;
-	sc->sc_refcount = 0;
 	sc->sc_playing = 0;
 	sc->sc_recording = 0;
 	sc->sc_init_done = 0;
@@ -1894,8 +1893,7 @@ dbri_trigger_output(void *hdl, void *sta
 	struct dbri_softc *sc = hdl;
 	unsigned long count, num;
 
-	if (sc->sc_playing)
-		return 0;
+	KASSERT(sc->sc_playing == 0);
 
 	count = (unsigned long)(((char *)end - (char *)start));
 	num = count / blksize;
@@ -1937,8 +1935,7 @@ dbri_trigger_input(void *hdl, void *star
 	struct dbri_softc *sc = hdl;
 	unsigned long count, num;
 
-	if (sc->sc_recording)
-		return 0;
+	KASSERT(sc->sc_recording == 0);
 
 	count = (unsigned long)(((char *)end - (char *)start));
 	num = count / blksize;
@@ -2051,14 +2048,9 @@ dbri_open(void *cookie, int flags)
 {
 	struct dbri_softc *sc = cookie;
 
-	DPRINTF("%s: %d\n", __func__, sc->sc_refcount);
-
-	if (sc->sc_refcount == 0) {
-		dbri_bring_up(sc);
-	}
-
-	sc->sc_refcount++;
+	DPRINTF("%s\n", __func__);
 
+	dbri_bring_up(sc);
 	return 0;
 }
 
@@ -2067,16 +2059,11 @@ dbri_close(void *cookie)
 {
 	struct dbri_softc *sc = cookie;
 
-	DPRINTF("%s: %d\n", __func__, sc->sc_refcount);
-
-	sc->sc_refcount--;
-	KASSERT(sc->sc_refcount >= 0);
-	if (sc->sc_refcount > 0)
-		return;
+	DPRINTF("%s\n", __func__);
+	KASSERT(sc->sc_playing == 0);
+	KASSERT(sc->sc_recording == 0);
 
 	dbri_set_power(sc, 0);
-	sc->sc_playing = 0;
-	sc->sc_recording = 0;
 }
 
 static bool
@@ -2097,7 +2084,7 @@ dbri_resume(device_t self, const pmf_qua
 
 	if (sc->sc_powerstate != 0)
 		return true;
-	aprint_verbose("resume: %d\n", sc->sc_refcount);
+	aprint_verbose("resume\n");
 	if (sc->sc_playing) {
 		volatile uint32_t *cmd;
 

Index: src/sys/dev/sbus/dbrivar.h
diff -u src/sys/dev/sbus/dbrivar.h:1.16 src/sys/dev/sbus/dbrivar.h:1.17
--- src/sys/dev/sbus/dbrivar.h:1.16	Wed May  8 13:40:19 2019
+++ src/sys/dev/sbus/dbrivar.h	Sat Feb  6 09:15:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbrivar.h,v 1.16 2019/05/08 13:40:19 isaki Exp $	*/
+/*	$NetBSD: dbrivar.h,v 1.17 2021/02/06 09:15:11 isaki Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -140,7 +140,6 @@ struct dbri_softc {
 
 	int		sc_waitseen;
 
-	int		sc_refcount;
 	int		sc_playing;
 	int		sc_recording;
 



CVS commit: src/sys/arch/dreamcast/dev/g2

2021-02-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb  6 09:14:03 UTC 2021

Modified Files:
src/sys/arch/dreamcast/dev/g2: aica.c

Log Message:
Remove sc_open flag.
Counting {open,close} is done by the MI audio layer.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/dreamcast/dev/g2/aica.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/dreamcast/dev/g2/aica.c
diff -u src/sys/arch/dreamcast/dev/g2/aica.c:1.28 src/sys/arch/dreamcast/dev/g2/aica.c:1.29
--- src/sys/arch/dreamcast/dev/g2/aica.c:1.28	Sun Feb 23 04:02:45 2020
+++ src/sys/arch/dreamcast/dev/g2/aica.c	Sat Feb  6 09:14:03 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $	*/
+/*	$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003 SHIMIZU Ryo 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.28 2020/02/23 04:02:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aica.c,v 1.29 2021/02/06 09:14:03 isaki Exp $");
 
 #include 
 #include 
@@ -63,7 +63,6 @@ struct aica_softc {
 	bus_space_handle_t	sc_aica_memh;
 
 	/* audio property */
-	int			sc_open;
 	int			sc_precision;
 	int			sc_channels;
 	int			sc_rate;
@@ -125,8 +124,6 @@ void aica_fillbuffer(struct aica_softc *
 int aica_intr(void *);
 
 /* for audio */
-int aica_open(void *, int);
-void aica_close(void *);
 int aica_query_format(void *, audio_format_query_t *);
 int aica_set_format(void *, int,
 const audio_params_t *, const audio_params_t *,
@@ -145,8 +142,6 @@ int aica_get_props(void *);
 void aica_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if aica_hw_if = {
-	.open			= aica_open,
-	.close			= aica_close,
 	.query_format		= aica_query_format,
 	.set_format		= aica_set_format,
 	.round_blocksize	= aica_round_blocksize,
@@ -389,31 +384,6 @@ aica_ch2p8write(struct aica_softc *sc, b
 }
 
 int
-aica_open(void *addr, int flags)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	if (sc->sc_open)
-		return EBUSY;
-
-	sc->sc_intr = NULL;
-	sc->sc_open = 1;
-
-	return 0;
-}
-
-void
-aica_close(void *addr)
-{
-	struct aica_softc *sc;
-
-	sc = addr;
-	sc->sc_open = 0;
-	sc->sc_intr = NULL;
-}
-
-int
 aica_query_format(void *addr, audio_format_query_t *afp)
 {
 
@@ -561,7 +531,7 @@ aica_intr(void *arg)
 	aica_fillbuffer(sc);
 
 	/* call audio interrupt handler (audio_pint()) */
-	if (sc->sc_open && sc->sc_intr != NULL) {
+	if (sc->sc_intr != NULL) {
 		(*(sc->sc_intr))(sc->sc_intr_arg);
 	}
 
@@ -610,6 +580,7 @@ aica_halt_output(void *addr)
 
 	sc = addr;
 	aica_command(sc, AICA_COMMAND_STOP);
+	sc->sc_intr = NULL;
 	return 0;
 }