CVS commit: src/usr.bin/make

2022-08-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 14 04:17:09 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
make.1: clean up formatting and grammar, be more accurate


To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/usr.bin/make/make.1

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



CVS commit: src/usr.bin/make

2022-08-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 14 04:17:09 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
make.1: clean up formatting and grammar, be more accurate


To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/usr.bin/make/make.1

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/make.1
diff -u src/usr.bin/make/make.1:1.316 src/usr.bin/make/make.1:1.317
--- src/usr.bin/make/make.1:1.316	Sun Aug 14 04:12:29 2022
+++ src/usr.bin/make/make.1	Sun Aug 14 04:17:09 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.316 2022/08/14 04:12:29 rillig Exp $
+.\"	$NetBSD: make.1,v 1.317 2022/08/14 04:17:09 rillig Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	from: @(#)make.1	8.4 (Berkeley) 3/19/94
 .\"
-.Dd July 12, 2022
+.Dd August 14, 2022
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -58,9 +58,9 @@ Its input is a list of specifications as
 and other files depend.
 If no
 .Fl f Ar makefile
-makefile option is given,
+option is given,
 .Nm
-will try to open
+tries to open
 .Sq Pa makefile
 then
 .Sq Pa Makefile
@@ -74,10 +74,11 @@ This manual page is intended as a refere
 For a more thorough description of
 .Nm
 and makefiles, please refer to
-.%T "PMake \- A Tutorial" .
+.%T "PMake \- A Tutorial"
+(from 1993).
 .Pp
 .Nm
-will prepend the contents of the
+prepends the contents of the
 .Va MAKEFLAGS
 environment variable to the command line arguments before parsing them.
 .Pp
@@ -116,8 +117,9 @@ debugging flag.
 The debugging output is always unbuffered; in addition, if debugging
 is enabled but debugging output is not directed to standard output,
 then the standard output is line buffered.
-.Ar Flags
-is one or more of the following:
+The available
+.Ar flags
+are:
 .Bl -tag -width Ds
 .It Ar A
 Print all possible debugging information;
@@ -152,7 +154,7 @@ standard output or standard error output
 .Ql \&+
 option has no effect).
 Otherwise, the output will be written to the named file.
-If the file name ends
+If the file name ends with
 .Ql .%d
 then the
 .Ql %d
@@ -218,7 +220,7 @@ option to print raw values of variables,
 set via
 .Va .MAKE.EXPAND_VARIABLES .
 .It Ar v
-Print debugging information about variable assignment.
+Print debugging information about variable assignment and expansion.
 .It Ar x
 Run shell commands with
 .Fl x
@@ -277,14 +279,16 @@ compatibility on.
 Continue processing after errors are encountered, but only on those targets
 that do not depend on the target whose creation caused the error.
 .It Fl m Ar directory
-Specify a directory in which to search for sys.mk and makefiles included
-via the
+Specify a directory in which to search for
+.Pa sys.mk
+and makefiles included via the
 .Li \&< Ns Ar file Ns Li \&> Ns -style
 include statement.
 The
 .Fl m
 option can be used multiple times to form a search path.
-This path will override the default system include path: /usr/share/mk.
+This path will override the default system include path
+.Pa /usr/share/mk .
 Furthermore the system include path will be appended to the search path used
 for
 .Li \*q Ns Ar file Ns Li \*q Ns -style
@@ -311,8 +315,9 @@ specification in the
 argument.
 If used, this feature allows
 .Nm
-to easily search in the current source tree for customized sys.mk files
-(e.g., by using
+to easily search in the current source tree for customized
+.Pa sys.mk
+files (e.g., by using
 .Qq \&.../mk/sys.mk
 as an argument).
 .It Fl n
@@ -326,7 +331,7 @@ actually execute any of them; useful for
 without descending into subdirectories.
 .It Fl q
 Do not execute any commands, but exit 0 if the specified targets are
-up-to-date and 1, otherwise.
+up-to-date, and 1 otherwise.
 .It Fl r
 Do not use the built-in rules specified in the system makefile.
 .It Fl S
@@ -380,8 +385,13 @@ debug mode can be used to see these at t
 substantial extraneous output.
 .It Fl v Ar variable
 Like
+.Fl V ,
+but all printed variables are always expanded to their complete value.
+The last occurrence of
 .Fl V
-but the variable is always expanded to its complete value.
+or
+.Fl v
+decides whether all variables are expanded or not.
 .It Fl W
 Treat any warnings during makefile parsing as errors.
 .It Fl w
@@ -389,8 +399,7 @@ Print entering and leaving directory mes
 .It Fl X
 Don't export variables passed on the command line to the environment
 individually.
-Variables passed on the command line are still exported
-via the
+Variables passed on the command line are still exported via the
 .Va MAKEFLAGS
 environment variable.
 This option may be useful on systems which have a small limit on the



CVS commit: src/usr.bin/make

2022-08-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 14 04:12:29 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
make.1: not every '-' is a flag


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/make.1

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/make.1
diff -u src/usr.bin/make/make.1:1.315 src/usr.bin/make/make.1:1.316
--- src/usr.bin/make/make.1:1.315	Tue Jul 12 23:47:00 2022
+++ src/usr.bin/make/make.1	Sun Aug 14 04:12:29 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.315 2022/07/12 23:47:00 rillig Exp $
+.\"	$NetBSD: make.1,v 1.316 2022/08/14 04:12:29 rillig Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -233,7 +233,7 @@ Specify a makefile to read instead of th
 If
 .Ar makefile
 is
-.Sq Fl ,
+.Ql \&- ,
 standard input is read.
 Multiple makefiles may be specified, and are read in the order specified.
 .It Fl I Ar directory
@@ -244,7 +244,7 @@ option) is automatically included as par
 .It Fl i
 Ignore non-zero exit of shell commands in the makefile.
 Equivalent to specifying
-.Sq Fl
+.Ql \&-
 before each command line in the makefile.
 .It Fl J Ar private
 This option should



CVS commit: src/usr.bin/make

2022-08-13 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Aug 14 04:12:29 UTC 2022

Modified Files:
src/usr.bin/make: make.1

Log Message:
make.1: not every '-' is a flag


To generate a diff of this commit:
cvs rdiff -u -r1.315 -r1.316 src/usr.bin/make/make.1

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



CVS commit: src/sys/dev/pci

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 21:51:33 UTC 2022

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

Log Message:
pciconf: Skip callbacks for reserved ranges if resource allocation fails.

In the event that a BAR write is ignored, no need to notify the callback
of any changes.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/pciconf.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/pciconf.c
diff -u src/sys/dev/pci/pciconf.c:1.53 src/sys/dev/pci/pciconf.c:1.54
--- src/sys/dev/pci/pciconf.c:1.53	Mon Aug 30 22:49:03 2021
+++ src/sys/dev/pci/pciconf.c	Sat Aug 13 21:51:33 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciconf.c,v 1.53 2021/08/30 22:49:03 jmcneill Exp $	*/
+/*	$NetBSD: pciconf.c,v 1.54 2022/08/13 21:51:33 jmcneill Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.53 2021/08/30 22:49:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.54 2022/08/13 21:51:33 jmcneill Exp $");
 
 #include "opt_pci.h"
 
@@ -1068,7 +1068,16 @@ setup_memwins(pciconf_bus_t *pb)
 		}
 
 		if (rsvd != NULL && rsvd->start != pm->address) {
-			rsvd->callback(rsvd->callback_arg, pm->address);
+			/*
+			 * Resource allocation will never reuse a reserved
+			 * address. Check to see if the BAR is still reserved
+			 * to cover the case where the new resource was not
+			 * applied. In this case, there is no need to notify
+			 * the device callback of a change.
+			 */
+			if (!pci_bar_is_reserved(pb, pd, pm->reg)) {
+rsvd->callback(rsvd->callback_arg, pm->address);
+			}
 		}
 	}
 	for (pm = pb->pcimemwin; pm < >pcimemwin[pb->nmemwin]; pm++) {



CVS commit: src/sys/dev/pci

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 21:51:33 UTC 2022

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

Log Message:
pciconf: Skip callbacks for reserved ranges if resource allocation fails.

In the event that a BAR write is ignored, no need to notify the callback
of any changes.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/pciconf.c

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



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 20:08:36 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Add "nopcimsi" boot option to force legacy INTx only mode.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/acpi/acpipchb.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/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.29 src/sys/arch/arm/acpi/acpipchb.c:1.30
--- src/sys/arch/arm/acpi/acpipchb.c:1.29	Sat Aug 13 16:44:11 2022
+++ src/sys/arch/arm/acpi/acpipchb.c	Sat Aug 13 20:08:36 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.29 2022/08/13 16:44:11 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.30 2022/08/13 20:08:36 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.29 2022/08/13 16:44:11 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.30 2022/08/13 20:08:36 jmcneill Exp $");
 
 #include 
 #include 
@@ -127,6 +127,7 @@ acpipchb_attach(device_t parent, device_
 	ACPI_INTEGER seg, nomsi;
 	ACPI_STATUS rv;
 	uint16_t bus_start;
+	int val;
 
 	sc->sc_dev = self;
 	sc->sc_memt = aa->aa_memt;
@@ -153,6 +154,10 @@ acpipchb_attach(device_t parent, device_
 	))) {
 		nomsi = 0;
 	}
+	if (get_bootconf_option(boot_args, "nopcimsi",
+BOOTOPT_TYPE_BOOLEAN, ) && val) {
+		nomsi = 1;
+	}
 
 	aprint_naive("\n");
 	aprint_normal(": PCI Express Host Bridge\n");



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 20:08:36 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
Add "nopcimsi" boot option to force legacy INTx only mode.


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

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



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 20:07:13 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c

Log Message:
arm: acpi: Improve legacy INTx support.

For devices on a bus with no direct _PRT, use the raw intr pin with the
parent bridge's slot number to derive a pin number that can be used to
lookup the pin -> irq mapping in the parent bus's _PRT.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/acpi/acpi_pci_machdep.c

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

Modified files:

Index: src/sys/arch/arm/acpi/acpi_pci_machdep.c
diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.21 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.22
--- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.21	Tue Dec 21 11:02:38 2021
+++ src/sys/arch/arm/acpi/acpi_pci_machdep.c	Sat Aug 13 20:07:13 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci_machdep.c,v 1.21 2021/12/21 11:02:38 skrll Exp $ */
+/* $NetBSD: acpi_pci_machdep.c,v 1.22 2022/08/13 20:07:13 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.21 2021/12/21 11:02:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.22 2022/08/13 20:07:13 jmcneill Exp $");
 
 #include 
 #include 
@@ -71,6 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_pci_mac
 struct acpi_pci_prt {
 	u_intprt_segment;
 	u_intprt_bus;
+	u_intprt_bridge_dev;
+	boolprt_derived;
 	ACPI_HANDLE			prt_handle;
 	TAILQ_ENTRY(acpi_pci_prt)	prt_list;
 };
@@ -210,6 +212,8 @@ acpi_pci_md_attach_hook(device_t parent,
 	struct acpi_devnode *ad;
 	ACPI_HANDLE handle;
 	int seg, bus, dev, func;
+	u_int bridge_dev = 0;
+	bool derived = false;
 
 	seg = ap->ap_seg;
 	handle = NULL;
@@ -225,10 +229,13 @@ acpi_pci_md_attach_hook(device_t parent,
 		if (ad != NULL) {
 			handle = ad->ad_handle;
 		} else {
-			/* No routes defined for this bus, copy from parent */
+			/* No routes defined for this bus, derive from parent */
 			TAILQ_FOREACH(prtp, _pci_irq_routes, prt_list)
-if (prtp->prt_bus == bus) {
+if (prtp->prt_bus == bus &&
+prtp->prt_segment == seg) {
 	handle = prtp->prt_handle;
+	bridge_dev = dev;
+	derived = true;
 	break;
 }
 		}
@@ -244,8 +251,10 @@ acpi_pci_md_attach_hook(device_t parent,
 	if (handle != NULL) {
 		prt = kmem_alloc(sizeof(*prt), KM_SLEEP);
 		prt->prt_bus = pba->pba_bus;
-		prt->prt_segment = ap->ap_seg;
+		prt->prt_segment = seg;
 		prt->prt_handle = handle;
+		prt->prt_bridge_dev = bridge_dev;
+		prt->prt_derived = derived;
 		TAILQ_INSERT_TAIL(_pci_irq_routes, prt, prt_list);
 	}
 
@@ -375,6 +384,7 @@ acpi_pci_md_intr_map(const struct pci_at
 	ACPI_HANDLE linksrc;
 	ACPI_BUFFER buf;
 	void *linkdev;
+	u_int pin;
 
 	if (pa->pa_intrpin == PCI_INTERRUPT_PIN_NONE)
 		return EINVAL;
@@ -386,6 +396,21 @@ acpi_pci_md_intr_map(const struct pci_at
 	if (ACPI_FAILURE(acpi_get(prt->prt_handle, , AcpiGetIrqRoutingTable)))
 		return EIO;
 
+	/*
+	 * For busses with no direct _PRT entry, derive the pin from the
+	 * parent bridge.
+	 */
+	if (prt->prt_derived) {
+		pin = (((pa->pa_rawintrpin + prt->prt_bridge_dev) - 1) % 4) + 1;
+	} else {
+		pin = pa->pa_intrpin;
+	}
+
+	aprint_debug("%s: bus=%u pin=%u pa_rawintrpin=%u pa_intrpin=%u "
+		 "pa_intrswiz=%u prt_bridge_dev=%u\n",
+   		 __func__, pa->pa_bus, pin, pa->pa_rawintrpin,
+		 pa->pa_intrpin, pa->pa_intrswiz, prt->prt_bridge_dev);
+
 	error = ENOENT;
 	for (char *p = buf.Pointer; ; p += tab->Length) {
 		tab = (ACPI_PCI_ROUTING_TABLE *)p;
@@ -393,7 +418,7 @@ acpi_pci_md_intr_map(const struct pci_at
 			break;
 
 		if (pa->pa_device == ACPI_HIWORD(tab->Address) &&
-		(pa->pa_intrpin - 1) == (tab->Pin & 3)) {
+		(pin - 1) == (tab->Pin & 3)) {
 			if (tab->Source[0] != 0) {
 if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, tab->Source, )))
 	goto done;



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 20:07:13 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpi_pci_machdep.c

Log Message:
arm: acpi: Improve legacy INTx support.

For devices on a bus with no direct _PRT, use the raw intr pin with the
parent bridge's slot number to derive a pin number that can be used to
lookup the pin -> irq mapping in the parent bus's _PRT.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/acpi/acpi_pci_machdep.c

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



CVS commit: src/tests/dev/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.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/dev/cgd/t_cgdconfig.sh
diff -u src/tests/dev/cgd/t_cgdconfig.sh:1.3 src/tests/dev/cgd/t_cgdconfig.sh:1.4
--- src/tests/dev/cgd/t_cgdconfig.sh:1.3	Fri Aug 12 10:49:17 2022
+++ src/tests/dev/cgd/t_cgdconfig.sh	Sat Aug 13 17:46:26 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_cgdconfig.sh,v 1.3 2022/08/12 10:49:17 riastradh Exp $
+#	$NetBSD: t_cgdconfig.sh,v 1.4 2022/08/13 17:46:26 hannken Exp $
 #
 # Copyright (c) 2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -53,7 +53,7 @@ storedkeys_head()
 }
 storedkeys_body()
 {
-	cat 

CVS commit: src/tests/dev/cgd

2022-08-13 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Aug 13 17:46:26 UTC 2022

Modified Files:
src/tests/dev/cgd: t_cgdconfig.sh

Log Message:
When run from py-anita/amd64 this test fails with:

  cgdconfig: getfsspecname failed: no match for `wd0e'

as the virtual machine has root on dk0, dk0 at wd0 and trying to
open wd0e fails.

This tests runs without a rump kernel and therefore should not
even try to open configured devices on the host.  Replace the
disks "wd0e" and "ld1e" with non-existant disks "dska" and "dskb".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/dev/cgd/t_cgdconfig.sh

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:31:32 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Omit unused sc_dmamap.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/virtio/viocon.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/virtio/viocon.c
diff -u src/sys/dev/virtio/viocon.c:1.4 src/sys/dev/virtio/viocon.c:1.5
--- src/sys/dev/virtio/viocon.c:1.4	Sat Aug 13 17:31:21 2022
+++ src/sys/dev/virtio/viocon.c	Sat Aug 13 17:31:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: viocon.c,v 1.4 2022/08/13 17:31:21 riastradh Exp $	*/
+/*	$NetBSD: viocon.c,v 1.5 2022/08/13 17:31:32 riastradh Exp $	*/
 /*	$OpenBSD: viocon.c,v 1.8 2021/11/05 11:38:29 mpi Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.4 2022/08/13 17:31:21 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.5 2022/08/13 17:31:32 riastradh Exp $");
 
 #include 
 #include 
@@ -129,8 +129,6 @@ struct viocon_softc {
 
 	unsigned int		 sc_max_ports;
 	struct viocon_port	**sc_ports;
-
-	bus_dmamap_t		 sc_dmamap;
 };
 
 int	viocon_match(struct device *, struct cfdata *, void *);



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:31:32 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Omit unused sc_dmamap.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/virtio/viocon.c

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:31:21 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix bus_dmamap_sync after tx: POSTWRITE, not POSTREAD.


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

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:31:21 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix bus_dmamap_sync after tx: POSTWRITE, not POSTREAD.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/virtio/viocon.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/virtio/viocon.c
diff -u src/sys/dev/virtio/viocon.c:1.3 src/sys/dev/virtio/viocon.c:1.4
--- src/sys/dev/virtio/viocon.c:1.3	Sat Aug 13 17:02:53 2022
+++ src/sys/dev/virtio/viocon.c	Sat Aug 13 17:31:21 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: viocon.c,v 1.3 2022/08/13 17:02:53 riastradh Exp $	*/
+/*	$NetBSD: viocon.c,v 1.4 2022/08/13 17:31:21 riastradh Exp $	*/
 /*	$OpenBSD: viocon.c,v 1.8 2021/11/05 11:38:29 mpi Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.3 2022/08/13 17:02:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.4 2022/08/13 17:31:21 riastradh Exp $");
 
 #include 
 #include 
@@ -332,7 +332,7 @@ viocon_tx_drain(struct viocon_port *vp, 
 	while (virtio_dequeue(vsc, vq, , ) == 0) {
 		bus_dmamap_sync(virtio_dmat(vsc), vp->vp_dmamap,
 		vp->vp_tx_buf - vp->vp_rx_buf + slot * BUFSIZE, BUFSIZE,
-		BUS_DMASYNC_POSTREAD);
+		BUS_DMASYNC_POSTWRITE);
 		virtio_dequeue_commit(vsc, vq, slot);
 		ndone++;
 	}



CVS commit: src/share/man/man9

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:06:55 UTC 2022

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

Log Message:
Remove Li without effect.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/share/man/man9/bus_space.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/bus_space.9
diff -u src/share/man/man9/bus_space.9:1.54 src/share/man/man9/bus_space.9:1.55
--- src/share/man/man9/bus_space.9:1.54	Fri Aug 12 13:24:37 2022
+++ src/share/man/man9/bus_space.9	Sat Aug 13 17:06:55 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: bus_space.9,v 1.54 2022/08/12 13:24:37 riastradh Exp $
+.\" $NetBSD: bus_space.9,v 1.55 2022/08/13 17:06:55 wiz Exp $
 .\"
 .\" Copyright (c) 1997 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -1369,7 +1369,7 @@ This functions similarly to
 but additionally orders bus space I/O which
 .Xr membar_ops 3
 may not.
-.It Dv "BUS_SPACE_BARRIER_READ" Li "|" Dv "BUS_SPACE_BARRIER_WRITE"
+.It Dv "BUS_SPACE_BARRIER_READ" | Dv "BUS_SPACE_BARRIER_WRITE"
 Guarantee that any program-prior bus space read, bus space write, or
 memory access via
 .Fn bus_space_vaddr



CVS commit: src/share/man/man9

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:06:55 UTC 2022

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

Log Message:
Remove Li without effect.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/share/man/man9/bus_space.9

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



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:06:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/man4.amiga/amidisplaycc.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/man4.amiga/amidisplaycc.4
diff -u src/share/man/man4/man4.amiga/amidisplaycc.4:1.15 src/share/man/man4/man4.amiga/amidisplaycc.4:1.16
--- src/share/man/man4/man4.amiga/amidisplaycc.4:1.15	Sat Aug 13 10:53:38 2022
+++ src/share/man/man4/man4.amiga/amidisplaycc.4	Sat Aug 13 17:06:38 2022
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.15 2022/08/13 10:53:38 jandberg Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.16 2022/08/13 17:06:38 wiz Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -87,7 +87,8 @@ utility runtime.
 .Ss X11
 The X11 server works using the
 .Xr wsfb 4
-driver. The driver supports 256 color and monochrome modes.
+driver.
+The driver supports 256 color and monochrome modes.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsdisplay 4 ,



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:06:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
New sentence, new line.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man4/man4.amiga/amidisplaycc.4

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:02:53 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix $NetBSD$ rcsid.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/virtio/viocon.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/virtio/viocon.c
diff -u src/sys/dev/virtio/viocon.c:1.2 src/sys/dev/virtio/viocon.c:1.3
--- src/sys/dev/virtio/viocon.c:1.2	Sat Aug 13 16:52:29 2022
+++ src/sys/dev/virtio/viocon.c	Sat Aug 13 17:02:53 2022
@@ -1,4 +1,4 @@
-/*	$NetSBD$	*/
+/*	$NetBSD: viocon.c,v 1.3 2022/08/13 17:02:53 riastradh Exp $	*/
 /*	$OpenBSD: viocon.c,v 1.8 2021/11/05 11:38:29 mpi Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.2 2022/08/13 16:52:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.3 2022/08/13 17:02:53 riastradh Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 17:02:53 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix $NetBSD$ rcsid.


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

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



CVS commit: src/share/man/man4

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:02:10 UTC 2022

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

Log Message:
Fix Dd argument.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/viocon.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/viocon.4
diff -u src/share/man/man4/viocon.4:1.1 src/share/man/man4/viocon.4:1.2
--- src/share/man/man4/viocon.4:1.1	Fri Aug 12 11:15:41 2022
+++ src/share/man/man4/viocon.4	Sat Aug 13 17:02:10 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: viocon.4,v 1.1 2022/08/12 11:15:41 riastradh Exp $
+.\"	$NetBSD: viocon.4,v 1.2 2022/08/13 17:02:10 wiz Exp $
 .\" $OpenBSD: viocon.4,v 1.3 2017/06/21 08:21:14 akfaew Exp $
 .\"
 .\" Copyright (c) 2015 Stefan Fritsch 
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: June 21 2017 $
+.Dd August 13, 2022
 .Dt VIOCON 4
 .Os
 .Sh NAME



CVS commit: src/share/man/man4

2022-08-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Aug 13 17:02:10 UTC 2022

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

Log Message:
Fix Dd argument.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/viocon.4

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



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:55:10 UTC 2022

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

Log Message:
aarch64: Add tpm driver to GENERIC64 kernel.


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.201 src/sys/arch/evbarm/conf/GENERIC64:1.202
--- src/sys/arch/evbarm/conf/GENERIC64:1.201	Tue May 10 08:09:57 2022
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Aug 13 16:55:10 2022
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.201 2022/05/10 08:09:57 skrll Exp $
+#	$NetBSD: GENERIC64,v 1.202 2022/08/13 16:55:10 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -372,13 +372,14 @@ tcagpio*	at iic?
 # Power Domain controllers
 applepmgr* 	at fdt? pass 0
 
-# Random number generators
+# Random number generators and security devices
 amdccp* 	at fdt?			# AMD Cryptograhic Coprocessor RNG
 amdccp* 	at acpi?
 bcmrng* 	at fdt?			# Broadcom BCM283x RNG
 mesonrng*	at fdt?			# Amlogic Meson RNG
-sun8icrypto* 	at fdt?			# Allwinner Crypto Engine
 rkv1crypto* 	at fdt?			# Rockchip Crypto v1
+sun8icrypto* 	at fdt?			# Allwinner Crypto Engine
+tpm*		at acpi?		# Trusted Platform Module
 
 # RTC
 plrtc*		at fdt?			# ARM PrimeCell RTC



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:55:10 UTC 2022

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

Log Message:
aarch64: Add tpm driver to GENERIC64 kernel.


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

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 16:52:29 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix tty device number.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/virtio/viocon.c

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



CVS commit: src/sys/dev/virtio

2022-08-13 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug 13 16:52:29 UTC 2022

Modified Files:
src/sys/dev/virtio: viocon.c

Log Message:
viocon(4): Fix tty device number.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/virtio/viocon.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/virtio/viocon.c
diff -u src/sys/dev/virtio/viocon.c:1.1 src/sys/dev/virtio/viocon.c:1.2
--- src/sys/dev/virtio/viocon.c:1.1	Fri Aug 12 11:15:42 2022
+++ src/sys/dev/virtio/viocon.c	Sat Aug 13 16:52:29 2022
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.1 2022/08/12 11:15:42 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: viocon.c,v 1.2 2022/08/13 16:52:29 riastradh Exp $");
 
 #include 
 #include 
@@ -93,6 +93,8 @@ struct virtio_console_control_resize {
 
 #define	BUFSIZE		128
 
+#define	VIOCONDEV(u,p)	makedev(cdevsw_lookup_major(_cdevsw),	  \
+			((u) << 4) | (p))
 #define VIOCONUNIT(x)	(minor(x) >> 4)
 #define VIOCONPORT(x)	(minor(x) & 0x0f)
 
@@ -307,7 +309,7 @@ viocon_port_create(struct viocon_softc *
 	tp->t_oproc = vioconstart;
 	tp->t_param = vioconparam;
 	tp->t_hwiflow = vioconhwiflow;
-	tp->t_dev = (device_unit(sc->sc_dev) << 4) | portidx;
+	tp->t_dev = VIOCONDEV(device_unit(sc->sc_dev), portidx);
 	vp->vp_tty = tp;
 	DPRINTF("%s: tty: %p\n", __func__, tp);
 



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:44:11 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
acpipchb: Add a kernel cmdline option to skip PCI resource assignment.

Passing "nopciconf" to the kernel will force acpipchb to skip PCI
resource assignment.


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

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



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:44:11 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpipchb.c

Log Message:
acpipchb: Add a kernel cmdline option to skip PCI resource assignment.

Passing "nopciconf" to the kernel will force acpipchb to skip PCI
resource assignment.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/acpi/acpipchb.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/acpi/acpipchb.c
diff -u src/sys/arch/arm/acpi/acpipchb.c:1.28 src/sys/arch/arm/acpi/acpipchb.c:1.29
--- src/sys/arch/arm/acpi/acpipchb.c:1.28	Tue Aug 10 15:31:38 2021
+++ src/sys/arch/arm/acpi/acpipchb.c	Sat Aug 13 16:44:11 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $ */
+/* $NetBSD: acpipchb.c,v 1.29 2022/08/13 16:44:11 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.28 2021/08/10 15:31:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.29 2022/08/13 16:44:11 jmcneill Exp $");
 
 #include 
 #include 
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -190,11 +191,15 @@ acpipchb_configure_bus(struct acpipchb_s
 	struct acpi_pci_context *ap = md_pc->pc_conf_v;
 	struct pciconf_resources *pcires;
 	ACPI_STATUS rv;
-	int error;
+	int error, val;
 
 	if (!acpi_pci_ignore_boot_config(sc->sc_handle)) {
 		return;
 	}
+	if (get_bootconf_option(boot_args, "nopciconf",
+BOOTOPT_TYPE_BOOLEAN, ) && val) {
+		return;
+	}
 
 	if ((ap->ap_flags & ACPI_PCI_FLAG_NO_MCFG) != 0) {
 		pcires = pciconf_resource_init();



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:01:35 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Process "ranges" property even when linux,pci-probe-only is set.

When the linux,pci-probe-only flag is set, we still need to process the
ranges property to determine whether or not to set PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_OKAY flags on the bus.


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

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

Modified files:

Index: src/sys/arch/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.27 src/sys/arch/arm/fdt/pcihost_fdt.c:1.28
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.27	Mon Sep  6 14:03:17 2021
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Sat Aug 13 16:01:34 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.27 2021/09/06 14:03:17 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.27 2021/09/06 14:03:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.28 2022/08/13 16:01:34 jmcneill Exp $");
 
 #include 
 
@@ -250,8 +250,6 @@ pcihost_config(struct pcihost_softc *sc)
 	const int chosen = OF_finddevice("/chosen");
 	if (chosen <= 0 || of_getprop_uint32(chosen, "linux,pci-probe-only", _only))
 		probe_only = 0;
-	if (probe_only)
-		return 0;
 
 	if (sc->sc_pci_ranges != NULL) {
 		ranges = sc->sc_pci_ranges;
@@ -350,8 +348,12 @@ pcihost_config(struct pcihost_softc *sc)
 		}
 	}
 
-	error = pci_configure_bus(>sc_pc, pcires, sc->sc_bus_min,
-	PCIHOST_CACHELINE_SIZE);
+	if (probe_only) {
+		error = 0;
+	} else {
+		error = pci_configure_bus(>sc_pc, pcires, sc->sc_bus_min,
+		PCIHOST_CACHELINE_SIZE);
+	}
 
 	pciconf_resource_fini(pcires);
 



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

2022-08-13 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Aug 13 16:01:35 UTC 2022

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Process "ranges" property even when linux,pci-probe-only is set.

When the linux,pci-probe-only flag is set, we still need to process the
ranges property to determine whether or not to set PCI_FLAGS_IO_OKAY and
PCI_FLAGS_MEM_OKAY flags on the bus.


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

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



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Aug 13 10:53:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update comment about X11 support


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/man4.amiga/amidisplaycc.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/man4.amiga/amidisplaycc.4
diff -u src/share/man/man4/man4.amiga/amidisplaycc.4:1.14 src/share/man/man4/man4.amiga/amidisplaycc.4:1.15
--- src/share/man/man4/man4.amiga/amidisplaycc.4:1.14	Sat Oct  9 08:25:33 2021
+++ src/share/man/man4/man4.amiga/amidisplaycc.4	Sat Aug 13 10:53:38 2022
@@ -22,7 +22,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: amidisplaycc.4,v 1.14 2021/10/09 08:25:33 jandberg Exp $
+.\" $NetBSD: amidisplaycc.4,v 1.15 2022/08/13 10:53:38 jandberg Exp $
 .Dd November 12, 2003
 .Dt AMIDISPLAYCC 4 amiga
 .Os
@@ -43,10 +43,6 @@ operate a text terminal with virtual scr
 It uses the Amiga abstract graphic driver (grfabs) functions for
 the low-level display management.
 .Pp
-The X11 server works in monochrome mode using the
-.Xr wsfb 4
-driver.
-.Pp
 It supports foreground and background color, and the hilite (bold),
 underline, and reverse text attributes.
 .Ss Virtual terminals and screen types
@@ -88,6 +84,10 @@ Fonts can be compiled into the kernel by
 in the configuration file, or loaded with the
 .Xr wsfontload 8
 utility runtime.
+.Ss X11
+The X11 server works using the
+.Xr wsfb 4
+driver. The driver supports 256 color and monochrome modes.
 .Sh SEE ALSO
 .Xr wscons 4 ,
 .Xr wsdisplay 4 ,



CVS commit: src/share/man/man4/man4.amiga

2022-08-13 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Sat Aug 13 10:53:38 UTC 2022

Modified Files:
src/share/man/man4/man4.amiga: amidisplaycc.4

Log Message:
Update comment about X11 support


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/man4.amiga/amidisplaycc.4

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



CVS commit: src/sys/arch/macppc/macppc

2022-08-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 13 09:34:47 UTC 2022

Modified Files:
src/sys/arch/macppc/macppc: disksubr.c

Log Message:
Do not try to create a fake MBR disklabel from the PMBR of a GPT disk.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/macppc/macppc/disksubr.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/macppc/macppc/disksubr.c
diff -u src/sys/arch/macppc/macppc/disksubr.c:1.49 src/sys/arch/macppc/macppc/disksubr.c:1.50
--- src/sys/arch/macppc/macppc/disksubr.c:1.49	Fri Mar 14 21:59:41 2014
+++ src/sys/arch/macppc/macppc/disksubr.c	Sat Aug 13 09:34:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.49 2014/03/14 21:59:41 mrg Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.50 2022/08/13 09:34:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -106,7 +106,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.49 2014/03/14 21:59:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.50 2022/08/13 09:34:47 martin Exp $");
 
 #include 
 #include 
@@ -497,6 +497,8 @@ read_dos_label(dev_t dev, void (*strat)(
 	bsdp = NULL;
 	for (i = 0; i < MBR_PART_COUNT; i++, dp++) {
 		switch (dp->mbrp_type) {
+		case MBR_PTYPE_PMBR:
+			goto done;	/* do not fake anything for GPT disks */
 		case MBR_PTYPE_NETBSD:
 			bsdp = dp;
 			break;



CVS commit: src/sys/arch/macppc/macppc

2022-08-13 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Aug 13 09:34:47 UTC 2022

Modified Files:
src/sys/arch/macppc/macppc: disksubr.c

Log Message:
Do not try to create a fake MBR disklabel from the PMBR of a GPT disk.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/macppc/macppc/disksubr.c

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



CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:22:41 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Add two tests for AUDIO_SETINFO after mmap.
These tests affect only standalone test, not atf.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.26 src/tests/dev/audio/audiotest.c:1.27
--- src/tests/dev/audio/audiotest.c:1.26	Sat Aug 13 07:19:15 2022
+++ src/tests/dev/audio/audiotest.c	Sat Aug 13 07:22:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.27 2022/08/13 07:22:40 isaki Exp $");
 
 #include 
 #include 
@@ -5870,6 +5870,102 @@ DEF(AUDIO_SETINFO_gain_balance)
 	XP_SYS_EQ(0, r);
 }
 
+/*
+ * Changing track formats after mmap should fail.
+ */
+DEF(AUDIO_SETINFO_mmap_enc)
+{
+	struct audio_info ai;
+	void *ptr;
+	int fd;
+	int r;
+
+	TEST("AUDIO_SETINFO_mmap");
+
+#if !defined(NO_RUMP)
+	if (use_rump) {
+		XP_SKIP("rump doesn't support mmap");
+		return;
+	}
+#endif
+
+	fd = OPEN(devaudio, O_WRONLY);
+	REQUIRED_SYS_OK(fd);
+
+	ptr = MMAP(NULL, 1, PROT_WRITE, MAP_FILE, fd, 0);
+	XP_SYS_PTR(0, ptr);
+
+	/*
+	 * SETINFO after mmap should fail.
+	 * NetBSD9 changes errno.
+	 */
+	AUDIO_INITINFO();
+	ai.play.channels = 2;
+	r = IOCTL(fd, AUDIO_SETINFO, , "channels=2");
+	if (netbsd < 9) {
+		XP_SYS_NG(EINVAL, r);
+	} else {
+		XP_SYS_NG(EIO, r);
+	}
+
+	r = CLOSE(fd);
+	XP_SYS_EQ(0, r);
+
+	reset_after_mmap();
+}
+
+/*
+ * Even after mmap, changing pause should succeed.
+ */
+DEF(AUDIO_SETINFO_mmap_pause)
+{
+	struct audio_info ai;
+	void *ptr;
+	int fd;
+	int r;
+
+	TEST("AUDIO_SETINFO_mmap");
+
+#if !defined(NO_RUMP)
+	if (use_rump) {
+		XP_SKIP("rump doesn't support mmap");
+		return;
+	}
+#endif
+
+	fd = OPEN(devaudio, O_WRONLY);
+	REQUIRED_SYS_OK(fd);
+
+	ptr = MMAP(NULL, 1, PROT_WRITE, MAP_FILE, fd, 0);
+	XP_SYS_PTR(0, ptr);
+
+	/* SETINFO after mmap should fail */
+	AUDIO_INITINFO();
+	ai.play.pause = 1;
+	r = IOCTL(fd, AUDIO_SETINFO, , "set pause");
+	XP_SYS_EQ(0, r);
+
+	AUDIO_INITINFO();
+	r = IOCTL(fd, AUDIO_GETBUFINFO, , "get pause");
+	XP_SYS_EQ(0, r);
+
+	XP_EQ(1, ai.play.pause);
+
+	/*
+	 * Unpause before close.  Unless, subsequent audioplay(1) which use
+	 * /dev/sound by default will pause...
+	 */
+	AUDIO_INITINFO();
+	ai.play.pause = 0;
+	r = IOCTL(fd, AUDIO_SETINFO, , "reset pause");
+	XP_SYS_EQ(0, r);
+
+	r = CLOSE(fd);
+	XP_SYS_EQ(0, r);
+
+	reset_after_mmap();
+}
+
 #define NENC	(AUDIO_ENCODING_AC3 + 1)
 #define NPREC	(5)
 /*
@@ -7221,6 +7317,8 @@ struct testentry testtable[] = {
 	ENT(AUDIO_SETINFO_pause_RDWR_3),
 	ENT(AUDIO_SETINFO_gain),
 	ENT(AUDIO_SETINFO_gain_balance),
+/**/	ENT(AUDIO_SETINFO_mmap_enc),	// XXX rump doesn't support mmap
+/**/	ENT(AUDIO_SETINFO_mmap_pause),	// XXX rump doesn't support mmap
 	ENT(AUDIO_GETENC_range),
 	ENT(AUDIO_GETENC_error),
 	ENT(AUDIO_ERROR_RDONLY),



CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:22:41 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Add two tests for AUDIO_SETINFO after mmap.
These tests affect only standalone test, not atf.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/dev/audio/audiotest.c

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



CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:19:16 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Fix typo in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/dev/audio/audiotest.c

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



CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:19:16 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Fix typo in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.25 src/tests/dev/audio/audiotest.c:1.26
--- src/tests/dev/audio/audiotest.c:1.25	Sat Aug 13 07:14:40 2022
+++ src/tests/dev/audio/audiotest.c	Sat Aug 13 07:19:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.26 2022/08/13 07:19:15 isaki Exp $");
 
 #include 
 #include 
@@ -7106,29 +7106,29 @@ struct testentry testtable[] = {
 	ENT(drain_incomplete),
 	ENT(drain_pause),
 	ENT(drain_onrec),
-/**/	ENT(mmap_mode_RDONLY_NONE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDONLY_READ),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDONLY_WRITE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDONLY_READWRITE),// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_WRONLY_NONE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_WRONLY_READ),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_WRONLY_WRITE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_WRONLY_READWRITE),// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDWR_NONE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDWR_READ),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDWR_WRITE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_mode_RDWR_READWRITE),	// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_0),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_1),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_2),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_3),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_4),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_5),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_6),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_7),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_len_8),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_twice),		// XXX rump doesn't supprot mmap
-/**/	ENT(mmap_multi),		// XXX rump doesn't supprot mmap
+/**/	ENT(mmap_mode_RDONLY_NONE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDONLY_READ),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDONLY_WRITE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDONLY_READWRITE),// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_WRONLY_NONE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_WRONLY_READ),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_WRONLY_WRITE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_WRONLY_READWRITE),// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDWR_NONE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDWR_READ),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDWR_WRITE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_mode_RDWR_READWRITE),	// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_0),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_1),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_2),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_3),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_4),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_5),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_6),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_7),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_len_8),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_twice),		// XXX rump doesn't support mmap
+/**/	ENT(mmap_multi),		// XXX rump doesn't support mmap
 	ENT(poll_mode_RDONLY_IN),
 	ENT(poll_mode_RDONLY_OUT),
 	ENT(poll_mode_RDONLY_INOUT),



CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:14:40 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Separate mmap_len test by parameters.
This change affects only standalone test, not atf.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/dev/audio/audiotest.c

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

Modified files:

Index: src/tests/dev/audio/audiotest.c
diff -u src/tests/dev/audio/audiotest.c:1.24 src/tests/dev/audio/audiotest.c:1.25
--- src/tests/dev/audio/audiotest.c:1.24	Sun Aug  7 10:12:19 2022
+++ src/tests/dev/audio/audiotest.c	Sat Aug 13 07:14:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.24 2022/08/07 10:12:19 andvar Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.25 2022/08/13 07:14:40 isaki Exp $");
 
 #include 
 #include 
@@ -1382,6 +1382,7 @@ void test_open_multiuser(bool);
 void test_rdwr_fallback(int, bool, bool);
 void test_rdwr_two(int, int);
 void test_mmap_mode(int, int);
+void test_mmap_len(size_t, off_t, int);
 void test_poll_mode(int, int, int);
 void test_poll_in_open(const char *);
 void test_kqueue_mode(int, int, int);
@@ -2688,20 +2689,25 @@ DEF(mmap_mode_RDWR_READWRITE)	{ test_mma
 
 /*
  * Check mmap()'s length and offset.
+ *
+ * Actual len and offset cannot be determined before open.  So that,
+ * pass pre-defined constant as argument, and convert it after open.
  */
-DEF(mmap_len)
+#define LS	(100)	/* lsize */
+#define LS1	(101)	/* lsize + 1 */
+void
+test_mmap_len(size_t len, off_t offset, int exp)
 {
 	struct audio_info ai;
 	int fd;
 	int r;
-	size_t len;
-	off_t offset;
+	size_t plen;
 	void *ptr;
 	int bufsize;
 	int pagesize;
 	int lsize;
 
-	TEST("mmap_len");
+	TEST("mmap_len(%zd, %jd, %d)", len, offset, exp);
 	if ((props & AUDIO_PROP_MMAP) == 0) {
 		XP_SKIP("This test is only for mmap-able device");
 		return;
@@ -2713,8 +2719,8 @@ DEF(mmap_len)
 	}
 #endif
 
-	len = sizeof(pagesize);
-	r = SYSCTLBYNAME("hw.pagesize", , , NULL, 0);
+	plen = sizeof(pagesize);
+	r = SYSCTLBYNAME("hw.pagesize", , , NULL, 0);
 	REQUIRED_SYS_EQ(0, r);
 
 	fd = OPEN(devaudio, O_WRONLY);
@@ -2730,49 +2736,32 @@ DEF(mmap_len)
 	 * I'm not sure.
 	 */
 	lsize = roundup2(bufsize, pagesize);
-	struct {
-		size_t len;
-		off_t offset;
-		int exp;
-	} table[] = {
-		/* len offset	expected */
-
-		{ 0,	0,	0 },		/* len is 0  */
-		{ 1,	0,	0 },		/* len is smaller than lsize */
-		{ lsize, 0,	0 },		/* len is the same as lsize */
-		{ lsize + 1, 0,	EOVERFLOW },	/* len is larger */
-
-		{ 0, -1,	EINVAL },	/* offset is negative */
-		{ 0, lsize,	0 },		/* pointless param but ok */
-		{ 0, lsize + 1,	EOVERFLOW },	/* exceed */
-		{ 1, lsize,	EOVERFLOW },	/* exceed */
 
-		/*
-		 * When you treat offset as 32bit, offset will be 0
-		 * and thus it incorrectly succeeds.
-		 */
-		{ lsize,	1ULL<<32,	EOVERFLOW },
-	};
+	/* Here, lsize can be assigned */
+	if (len == LS) {
+		len = lsize;
+	} else if (len == LS1) {
+		len = lsize + 1;
+	}
+	if (offset == LS) {
+		offset = lsize;
+	} else if (offset == LS1) {
+		offset = lsize + 1;
+	}
 
-	for (int i = 0; i < (int)__arraycount(table); i++) {
-		len = table[i].len;
-		offset = table[i].offset;
-		int exp = table[i].exp;
-
-		ptr = MMAP(NULL, len, PROT_WRITE, MAP_FILE, fd, offset);
-		if (exp == 0) {
-			XP_SYS_PTR(0, ptr);
-		} else {
-			/* NetBSD8 introduces EOVERFLOW */
-			if (netbsd < 8 && exp == EOVERFLOW)
-exp = EINVAL;
-			XP_SYS_PTR(exp, ptr);
-		}
+	ptr = MMAP(NULL, len, PROT_WRITE, MAP_FILE, fd, offset);
+	if (exp == 0) {
+		XP_SYS_PTR(0, ptr);
+	} else {
+		/* NetBSD8 introduces EOVERFLOW */
+		if (netbsd < 8 && exp == EOVERFLOW)
+			exp = EINVAL;
+		XP_SYS_PTR(exp, ptr);
+	}
 
-		if (ptr != MAP_FAILED) {
-			r = MUNMAP(ptr, len);
-			XP_SYS_EQ(0, r);
-		}
+	if (ptr != MAP_FAILED) {
+		r = MUNMAP(ptr, len);
+		XP_SYS_EQ(0, r);
 	}
 
 	r = CLOSE(fd);
@@ -2780,6 +2769,21 @@ DEF(mmap_len)
 
 	reset_after_mmap();
 }
+#define f(l, o, e)	test_mmap_len(l, o, e)
+DEF(mmap_len_0)	{ f(0,   0,   0); }		/* len is 0 */
+DEF(mmap_len_1)	{ f(1,   0,   0); }		/* len is smaller than lsize */
+DEF(mmap_len_2)	{ f(LS,  0,   0); }		/* len is the same as lsize */
+DEF(mmap_len_3)	{ f(LS1, 0,   EOVERFLOW); }	/* len is larger */
+DEF(mmap_len_4)	{ f(0,   -1,  EINVAL); }	/* offset is negative */
+DEF(mmap_len_5)	{ f(0,   LS,  0); }		/* pointless param but ok */
+DEF(mmap_len_6)	{ f(0,   LS1, EOVERFLOW); }	/* exceed */
+DEF(mmap_len_7)	{ f(1,   LS,  EOVERFLOW); }	/* exceed */
+/*
+ * When you treat the offset as 32bit, offset will be 0 and thus it
+ * incorrectly succeeds.
+ */
+DEF(mmap_len_8)	{ f(LS, 1ULL << 32, EOVERFLOW); }
+#undef f
 
 /*
  * mmap() the 

CVS commit: src/tests/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 07:14:40 UTC 2022

Modified Files:
src/tests/dev/audio: audiotest.c

Log Message:
audiotest: Separate mmap_len test by parameters.
This change affects only standalone test, not atf.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/tests/dev/audio/audiotest.c

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



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

2022-08-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 13 06:59:56 UTC 2022

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

Log Message:
Fix an inverted KASSERTMSG test from the #ifdef DIAGNOSTIC panic -> KASSERT
conversion.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/x86/x86/bus_dma.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/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.87 src/sys/arch/x86/x86/bus_dma.c:1.88
--- src/sys/arch/x86/x86/bus_dma.c:1.87	Fri Aug 12 15:01:26 2022
+++ src/sys/arch/x86/x86/bus_dma.c	Sat Aug 13 06:59:56 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.87 2022/08/12 15:01:26 riastradh Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.88 2022/08/13 06:59:56 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007, 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.87 2022/08/12 15:01:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.88 2022/08/13 06:59:56 skrll Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -1198,7 +1198,7 @@ _bus_dmamem_unmap(bus_dma_tag_t t, void 
 	pt_entry_t *pte, opte;
 	vaddr_t va, sva, eva;
 
-	KASSERTMSG((uintptr_t)kva & PGOFSET, "kva=%p", kva);
+	KASSERTMSG(((uintptr_t)kva & PGOFSET) == 0, "kva=%p", kva);
 
 	size = round_page(size);
 	sva = (vaddr_t)kva;



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

2022-08-13 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Aug 13 06:59:56 UTC 2022

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

Log Message:
Fix an inverted KASSERTMSG test from the #ifdef DIAGNOSTIC panic -> KASSERT
conversion.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/x86/x86/bus_dma.c

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



CVS commit: src/sys/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 06:47:41 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio: Rework about usrbuf allocation.
- Allocate the usrbuf from kmem(9) instead of uvm(9).  The usrbuf has used
  uvm(9), in case mmap(2) might be issued later.  However, despite the most
  apps don't use mmap(2), allocating (and reallocating) uvm(9) every time
  would be expensive.  In addition, uvm(9) for recording usrbuf was totally
  pointless now.
- For playback, the usrbuf memory will be allocated in pages.  Because the
  usrbuf for playback is mostly near 64KB for backward compatibility.
  This will reduce reallocation especially from the initial ulaw to the most
  commonly used format like slinear16/2ch/48kHz.
- When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to
  uvm(9).
- Prohibit changing playback format once mmap(2) is called.
  It follows netbsd-7.
- For recording, the usrbuf memory will be allocated in the requested size
  every time as before.  Because the usrbuf for recording is only one block
  and is enough small to the page in the most case.
Inspired by PR kern/56947.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/audio/audiodef.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.134 src/sys/dev/audio/audio.c:1.135
--- src/sys/dev/audio/audio.c:1.134	Wed Jul  6 01:12:45 2022
+++ src/sys/dev/audio/audio.c	Sat Aug 13 06:47:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.134 2022/07/06 01:12:45 riastradh Exp $	*/
+/*	$NetBSD: audio.c,v 1.135 2022/08/13 06:47:41 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.134 2022/07/06 01:12:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.135 2022/08/13 06:47:41 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -234,7 +234,7 @@ __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.
 
 /*
  * 0: No debug logs
- * 1: action changes like open/close/set_format...
+ * 1: action changes like open/close/set_format/mmap...
  * 2: + normal operations like read/write/ioctl...
  * 3: + TRACEs except interrupt
  * 4: + TRACEs including interrupt
@@ -645,7 +645,6 @@ static void audio_print_format2(const ch
 #endif
 
 static void *audio_realloc(void *, size_t);
-static int audio_realloc_usrbuf(audio_track_t *, int);
 static void audio_free_usrbuf(audio_track_t *);
 
 static audio_track_t *audio_track_create(struct audio_softc *,
@@ -3559,10 +3558,13 @@ audio_mmap(struct audio_softc *sc, off_t
 	audio_file_t *file)
 {
 	audio_track_t *track;
+	struct uvm_object *uobj;
+	vaddr_t vstart;
 	vsize_t vsize;
 	int error;
 
-	TRACEF(2, file, "off=%lld, prot=%d", (long long)(*offp), prot);
+	TRACEF(1, file, "off=%jd, len=%ju, prot=%d",
+	(intmax_t)(*offp), (uintmax_t)len, prot);
 
 	KASSERT(len > 0);
 
@@ -3595,36 +3597,69 @@ audio_mmap(struct audio_softc *sc, off_t
 	if (track == NULL)
 		return EACCES;
 
+	/* XXX TODO: what happens when mmap twice. */
+	if (track->mmapped)
+		return EIO;
+
+	/* Create a uvm anonymous object */
 	vsize = roundup2(MAX(track->usrbuf.capacity, PAGE_SIZE), PAGE_SIZE);
-	if (len > vsize)
-		return EOVERFLOW;
-	if (*offp > (uint)(vsize - len))
+	if (*offp + len > vsize)
 		return EOVERFLOW;
+	uobj = uao_create(vsize, 0);
 
-	/* XXX TODO: what happens when mmap twice. */
-	if (!track->mmapped) {
-		track->mmapped = true;
+	/* Map it into the kernel virtual address space */
+	vstart = 0;
+	error = uvm_map(kernel_map, , vsize, uobj, 0, 0,
+	UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW, UVM_INH_NONE,
+	UVM_ADV_RANDOM, 0));
+	if (error) {
+		device_printf(sc->sc_dev, "uvm_map failed: errno=%d\n", error);
+		uao_detach(uobj);	/* release reference */
+		return error;
+	}
 
-		if (!track->is_pause) {
-			error = audio_exlock_mutex_enter(sc);
-			if (error)
-return error;
-			if (sc->sc_pbusy == false)
-audio_pmixer_start(sc, true);
-			audio_exlock_mutex_exit(sc);
-		}
-		/* XXX mmapping record buffer is not supported */
+	error = uvm_map_pageable(kernel_map, vstart, vstart + vsize,
+	false, 0);
+	if (error) {
+		device_printf(sc->sc_dev, "uvm_map_pageable failed: errno=%d\n",
+		error);
+		goto abort;
 	}
 
-	/* get ringbuffer */
-	*uobjp = track->uobj;
+	error = audio_exlock_mutex_enter(sc);
+	if (error)
+		goto abort;
+
+	/*
+	 * mmap() will start playing immediately.  XXX Maybe we lack API...
+	 * If no one has played yet, start pmixer here.
+	 */
+	if (sc->sc_pbusy == false)
+		audio_pmixer_start(sc, true);
+	audio_exlock_mutex_exit(sc);
+
+	/* Finally, replace the usrbuf from kmem to uvm. */
+	audio_track_lock_enter(track);
+	kmem_free(track->usrbuf.mem, track->usrbuf_allocsize);
+	track->usrbuf.mem 

CVS commit: src/sys/dev/audio

2022-08-13 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug 13 06:47:41 UTC 2022

Modified Files:
src/sys/dev/audio: audio.c audiodef.h

Log Message:
audio: Rework about usrbuf allocation.
- Allocate the usrbuf from kmem(9) instead of uvm(9).  The usrbuf has used
  uvm(9), in case mmap(2) might be issued later.  However, despite the most
  apps don't use mmap(2), allocating (and reallocating) uvm(9) every time
  would be expensive.  In addition, uvm(9) for recording usrbuf was totally
  pointless now.
- For playback, the usrbuf memory will be allocated in pages.  Because the
  usrbuf for playback is mostly near 64KB for backward compatibility.
  This will reduce reallocation especially from the initial ulaw to the most
  commonly used format like slinear16/2ch/48kHz.
- When mmap(2) is called, it will replace the playback usrbuf from kmem(9) to
  uvm(9).
- Prohibit changing playback format once mmap(2) is called.
  It follows netbsd-7.
- For recording, the usrbuf memory will be allocated in the requested size
  every time as before.  Because the usrbuf for recording is only one block
  and is enough small to the page in the most case.
Inspired by PR kern/56947.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/audio/audiodef.h

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