CVS commit: src/sys/arch/arm

2023-04-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 24 05:16:01 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3328_cru.c rk_v1crypto.c
Added Files:
src/sys/arch/arm/dts: rk3328-crypto.dtsi rk3328-rock64.dts

Log Message:
enable rkv1crypto on rock64.

this comes from upstream d1152bc533c941f7e267bf53d344cee510ea2808.

(i tried to make this be in rk3328.dtsi so all rk3328 boards would
benefit, but it doesn't work, and this is the only one have to test.)

adjust rkv1crypto to support a per-platform clocks setup.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/rk3328-crypto.dtsi
cvs rdiff -u -r0 -r1.8 src/sys/arch/arm/dts/rk3328-rock64.dts
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk3328_cru.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/rockchip/rk_v1crypto.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

2023-04-23 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr 24 05:16:01 UTC 2023

Modified Files:
src/sys/arch/arm/rockchip: rk3328_cru.c rk_v1crypto.c
Added Files:
src/sys/arch/arm/dts: rk3328-crypto.dtsi rk3328-rock64.dts

Log Message:
enable rkv1crypto on rock64.

this comes from upstream d1152bc533c941f7e267bf53d344cee510ea2808.

(i tried to make this be in rk3328.dtsi so all rk3328 boards would
benefit, but it doesn't work, and this is the only one have to test.)

adjust rkv1crypto to support a per-platform clocks setup.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/dts/rk3328-crypto.dtsi
cvs rdiff -u -r0 -r1.8 src/sys/arch/arm/dts/rk3328-rock64.dts
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/rockchip/rk3328_cru.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/rockchip/rk_v1crypto.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/rockchip/rk3328_cru.c
diff -u src/sys/arch/arm/rockchip/rk3328_cru.c:1.9 src/sys/arch/arm/rockchip/rk3328_cru.c:1.10
--- src/sys/arch/arm/rockchip/rk3328_cru.c:1.9	Fri Nov 12 22:02:08 2021
+++ src/sys/arch/arm/rockchip/rk3328_cru.c	Mon Apr 24 05:16:01 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328_cru.c,v 1.9 2021/11/12 22:02:08 jmcneill Exp $ */
+/* $NetBSD: rk3328_cru.c,v 1.10 2023/04/24 05:16:01 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.9 2021/11/12 22:02:08 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.10 2023/04/24 05:16:01 mrg Exp $");
 
 #include 
 #include 
@@ -357,6 +357,13 @@ static struct rk_cru_clk rk3328_cru_clks
 		 CLKGATE_CON(2),	/* gate_reg */
 		 __BIT(6),		/* gate_mask */
 		 0),
+	RK_COMPOSITE(RK3328_SCLK_CRYPTO, "clk_crypto", mux_2plls_parents,
+		 CLKSEL_CON(20),	/* muxdiv_reg */
+		 __BIT(7),		/* mux_mask */
+		 __BITS(4,0),	/* div_mask */
+		 CLKGATE_CON(2),	/* gate_reg */
+		 __BIT(4),		/* gate_mask */
+		 0),
 
 	RK_DIV(0, "clk_24m", "xin24m", CLKSEL_CON(2), __BITS(12,8), 0),
 
@@ -464,6 +471,8 @@ static struct rk_cru_clk rk3328_cru_clks
 	RK_GATE(RK3328_HCLK_I2S1_8CH, "hclk_i2s1", "hclk_bus_pre", CLKGATE_CON(15), 4),
 	RK_GATE(RK3328_HCLK_I2S2_2CH, "hclk_i2s2", "hclk_bus_pre", CLKGATE_CON(15), 5),
 	RK_GATE(RK3328_HCLK_SPDIF_8CH, "hclk_spdif", "hclk_bus_pre", CLKGATE_CON(15), 6),
+	RK_GATE(RK3328_HCLK_CRYPTO_MST, "hclk_crypto_mst", "hclk_bus_pre", CLKGATE_CON(15), 7),
+	RK_GATE(RK3328_HCLK_CRYPTO_SLV, "hclk_crypto_slv", "hclk_bus_pre", CLKGATE_CON(15), 8),
 	RK_COMPOSITE(RK3328_SCLK_I2S1_OUT, "i2s1_out", mux_i2s1out_parents,
 		 CLKSEL_CON(8),	/* muxdiv_reg */
 		 __BIT(12),		/* mux_mask */

Index: src/sys/arch/arm/rockchip/rk_v1crypto.c
diff -u src/sys/arch/arm/rockchip/rk_v1crypto.c:1.10 src/sys/arch/arm/rockchip/rk_v1crypto.c:1.11
--- src/sys/arch/arm/rockchip/rk_v1crypto.c:1.10	Fri May 13 09:49:44 2022
+++ src/sys/arch/arm/rockchip/rk_v1crypto.c	Mon Apr 24 05:16:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rk_v1crypto.c,v 1.10 2022/05/13 09:49:44 riastradh Exp $	*/
+/*	$NetBSD: rk_v1crypto.c,v 1.11 2023/04/24 05:16:01 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.10 2022/05/13 09:49:44 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk_v1crypto.c,v 1.11 2023/04/24 05:16:01 mrg Exp $");
 
 #include 
 
@@ -98,8 +98,24 @@ RKC_CTRL(struct rk_v1crypto_softc *sc, u
 CFATTACH_DECL_NEW(rk_v1crypto, sizeof(struct rk_v1crypto_softc),
 rk_v1crypto_match, rk_v1crypto_attach, NULL, NULL);
 
+struct rk_v1crypto_data {
+	int num_clks;
+	const char *const clks[];
+};
+
+static const struct rk_v1crypto_data rk3288_crypto_data = {
+	.num_clks = 4,
+	.clks = {"aclk", "hclk", "sclk", "apb_pclk"},
+};
+
+static const struct rk_v1crypto_data rk3328_crypto_data = {
+	.num_clks = 3,
+	.clks = {"hclk_master", "hclk_slave", "sclk"},
+};
+
 static const struct device_compatible_entry compat_data[] = {
-	{ .compat = "rockchip,rk3288-crypto" },
+	{ .compat = "rockchip,rk3288-crypto", .data = _crypto_data },
+	{ .compat = "rockchip,rk3328-crypto", .data = _crypto_data },
 	DEVICE_COMPAT_EOL
 };
 
@@ -114,7 +130,6 @@ rk_v1crypto_match(device_t parent, cfdat
 static void
 rk_v1crypto_attach(device_t parent, device_t self, void *aux)
 {
-	static const char *const clks[] = {"aclk", "hclk", "sclk", "apb_pclk"};
 	struct rk_v1crypto_softc *const sc = device_private(self);
 	const struct fdt_attach_args *const faa = aux;
 	bus_addr_t addr;
@@ -123,6 +138,9 @@ rk_v1crypto_attach(device_t parent, devi
 	struct fdtbus_reset *rst;
 	unsigned i;
 	uint32_t ctrl;
+	const struct rk_v1crypto_data *config =
+	of_compatible_lookup(phandle, compat_data)->data;
+	const char *const *clks = config->clks;
 
 	fdtbus_clock_assign(phandle);
 
@@ -141,7 +159,7 @@ rk_v1crypto_attach(device_t 

CVS commit: src/usr.bin/rump_allserver

2023-04-23 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Apr 24 00:07:04 UTC 2023

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

Log Message:
rump_allserver(1): fix markup, clarify

Reorder text for the -d option to hopefully make it easier to follow.
Clarify that the "disklabel" keyword takes partion letter (from RTFS).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/rump_allserver/rump_allserver.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/rump_allserver/rump_allserver.1
diff -u src/usr.bin/rump_allserver/rump_allserver.1:1.23 src/usr.bin/rump_allserver/rump_allserver.1:1.24
--- src/usr.bin/rump_allserver/rump_allserver.1:1.23	Thu Nov  5 14:02:07 2015
+++ src/usr.bin/rump_allserver/rump_allserver.1	Mon Apr 24 00:07:04 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rump_allserver.1,v 1.23 2015/11/05 14:02:07 wiz Exp $
+.\"	$NetBSD: rump_allserver.1,v 1.24 2023/04/24 00:07:04 uwe Exp $
 .\"
 .\" Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\"
@@ -23,7 +23,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 15, 2014
+.Dd April 24, 2023
 .Dt RUMP_SERVER 1
 .Os
 .Sh NAME
@@ -61,7 +61,7 @@ provides all rump kernel components whic
 system was built.
 At execution time it is possible to load components from the command
 line as described in the options section.
-.Bl -tag -width indent
+.Bl -tag -width Fl
 .It Fl c Ar ncpu
 Configure
 .Ar ncpu
@@ -75,76 +75,91 @@ maps a host file in the rump kernel fs n
 The string
 .Ar drivespec
 must be of comma-separated
-.Dq name=value
+.Sm off
+.Ar name\^ Li = Ar value
+.Sm on
 format and must contain the following tokens:
-.Bl -tag -width hostpath1234
-.It Ar key
+.
+.Bl -tag -width Ic -offset indent
+.
+.It Ic key
 Block device path in rump kernel namespace.
 This must be specified according to the rules for a key in
 .Xr rump_etfs 3 .
-.It Ar hostpath
+.
+.It Ic hostpath
 Host file used for storage.
 If the file does not exist, it will be created.
-.It Ar size
-Size of the mapping.
-Similar to
-.Xr dd 1 ,
-this argument accepts a suffix as the multiplier for the number.
-The special value
-.Dq host
-indicates that the current size of
-.Ar hostpath
-will be used.
-In this case it is assumed that
-.Ar hostpath
-exists and is a regular file.
-.It OR
-.It Ar disklabel
-Use a disklabel partition identifier to specify the offset and size
-of the mapping.
-.Ar hostpath
-must contain an existing and valid disklabel within the first 64k.
 .El
+.
 .Pp
-The following are optional:
-.Bl -tag -width hostpath1234
-.It Ar offset
-Offset of the mapping.
-The window into
-.Ar hostpath
-therefore is
-.Fa [ offset , offset+size ] .
-In case this parameter is not given, the default value 0 is used.
-.It Ar type
 The type of file that
-.Ar key
-is exposed as within the rump kernel.
-The possibilities are
-.Dq blk ,
-.Dq chr ,
+.Ic key
+is exposed as within the rump kernel is specified with:
+.
+.Bl -tag -width Ic -offset indent
+.It Ic type
+Possible values are
+.Ql blk ,
+.Ql chr ,
 and
-.Dq reg
+.Ql reg
 for block device, character device and regular file, respectively.
-The default is a block device.
+The default is a block device
+.Pq Ql blk .
 .Pp
-Note: the contents of block devices are cached in the rump kernel's
+.Sy Note :
+the contents of block devices are cached in the rump kernel's
 buffer cache.
 To avoid cache incoherency, it is advisable not to access a file
 through the host namespace while it is mapped as a block device in
 a rump kernel.
 .El
+.
+.Pp
+For block and character devices the
+.Bq Va offset Ns \&,\~ Ns Va offset Ns + Ns Va size
+region of the file must be specified with:
+.
+.Bl -tag -width Ic -offset indent
+.
+.It Ic disklabel
+Use a disklabel partition letter to specify the offset and size
+of the mapping.
+.Ic hostpath
+must contain a valid disklabel within the first 64k.
+.
+.It Ic offset
+Offset of the mapping.
+The default is 0.
+.
+.It Ic size
+Size of the mapping.
+Similar to
+.Xr dd 1 ,
+this argument accepts a suffix as the multiplier for the number.
+The special value
+.Ql host
+indicates that the current size of
+.Ic hostpath
+will be used.
+In this case it is assumed that
+.Ic hostpath
+exists and is a regular file.
+.El
+.
 .Pp
 In case
-.Ar hostpath
+.Ic hostpath
 does not exist, it will be created as a regular file with mode
 0644 (plus any restrictions placed by umask).
 In case
-.Ar hostpath
+.Ic hostpath
 is a regular file and is not large enough to accommodate the
 specified size, it will be extended to the specified size.
 .It Fl l Ar library
 Call
-.Fn dlopen
+.Xr dlopen 3
 on library before initializing the rump kernel.
 In case
 .Ar library
@@ -163,13 +178,13 @@ error due to missing components.
 To test a configuration, run
 .Nm
 with
-.Ev LD_BIND_NOW=1
-(see examples).
+.Ev LD_BIND_NOW Ns Li \&=1
+.Pq see Sx 

CVS commit: src/usr.bin/rump_allserver

2023-04-23 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Mon Apr 24 00:07:04 UTC 2023

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

Log Message:
rump_allserver(1): fix markup, clarify

Reorder text for the -d option to hopefully make it easier to follow.
Clarify that the "disklabel" keyword takes partion letter (from RTFS).


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/rump_allserver/rump_allserver.1

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



CVS commit: src/external/mit/lua/dist/src

2023-04-23 Thread Nikita
Module Name:src
Committed By:   nikita
Date:   Sun Apr 23 20:52:39 UTC 2023

Modified Files:
src/external/mit/lua/dist/src: lstrlib.c

Log Message:
lua: fix ftb in lstrlib.c for clang

(error: enumeration values 'Knumber' and 'Kdouble' not handled in switch 
[-Werror,-Wswitch])


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/mit/lua/dist/src/lstrlib.c

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



CVS commit: src/external/mit/lua/dist/src

2023-04-23 Thread Nikita
Module Name:src
Committed By:   nikita
Date:   Sun Apr 23 20:52:39 UTC 2023

Modified Files:
src/external/mit/lua/dist/src: lstrlib.c

Log Message:
lua: fix ftb in lstrlib.c for clang

(error: enumeration values 'Knumber' and 'Kdouble' not handled in switch 
[-Werror,-Wswitch])


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/mit/lua/dist/src/lstrlib.c

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

Modified files:

Index: src/external/mit/lua/dist/src/lstrlib.c
diff -u src/external/mit/lua/dist/src/lstrlib.c:1.19 src/external/mit/lua/dist/src/lstrlib.c:1.20
--- src/external/mit/lua/dist/src/lstrlib.c:1.19	Sun Apr 16 20:46:17 2023
+++ src/external/mit/lua/dist/src/lstrlib.c	Sun Apr 23 20:52:39 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: lstrlib.c,v 1.19 2023/04/16 20:46:17 nikita Exp $	*/
+/*	$NetBSD: lstrlib.c,v 1.20 2023/04/23 20:52:39 nikita Exp $	*/
 
 /*
 ** Id: lstrlib.c 
@@ -1446,9 +1446,9 @@ typedef enum KOption {
   Kuint,	/* unsigned integers */
 #ifndef _KERNEL
   Kfloat,	/* single-precision floating-point numbers */
-#endif /* _KERNEL */
   Knumber,	/* Lua "native" floating-point numbers */
   Kdouble,	/* double-precision floating-point numbers */
+#endif /* _KERNEL */
   Kchar,	/* fixed-length strings */
   Kstring,	/* strings with prefixed length */
   Kzstr,	/* zero-terminated strings */
@@ -1520,8 +1520,8 @@ static KOption getoption (Header *h, con
 case 'T': *size = sizeof(size_t); return Kuint;
 #ifndef _KERNEL
 case 'f': *size = sizeof(float); return Kfloat;
-#endif /* _KERNEL */
 case 'd': *size = sizeof(double); return Kdouble;
+#endif
 #ifndef _KERNEL
 case 'n': *size = sizeof(lua_Number); return Knumber;
 #else /* _KERNEL */



CVS commit: src/tests/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 16:49:38 UTC 2023

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

Log Message:
Allow 24bit support.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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.28 src/tests/dev/audio/audiotest.c:1.29
--- src/tests/dev/audio/audiotest.c:1.28	Mon Feb 13 22:24:06 2023
+++ src/tests/dev/audio/audiotest.c	Sun Apr 23 16:49:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $	*/
+/*	$NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $	*/
 
 /*
  * Copyright (C) 2019 Tetsuya Isaki. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: audiotest.c,v 1.28 2023/02/13 22:24:06 andvar Exp $");
+__RCSID("$NetBSD: audiotest.c,v 1.29 2023/04/23 16:49:38 mlelstv Exp $");
 
 #include 
 #include 
@@ -53,6 +53,9 @@ __RCSID("$NetBSD: audiotest.c,v 1.28 202
 #include 
 #endif
 
+/* this internal driver option is not exported to userland */
+#define AUDIO_SUPPORT_LINEAR24
+
 #if !defined(AUDIO_ENCODING_SLINEAR_NE)
 #if BYTE_ORDER == LITTLE_ENDIAN
 #define AUDIO_ENCODING_SLINEAR_NE AUDIO_ENCODING_SLINEAR_LE



CVS commit: src/tests/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 16:49:38 UTC 2023

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

Log Message:
Allow 24bit support.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 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/libexec/ld.elf_so

2023-04-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 23 11:53:00 UTC 2023

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
dlopen(3): Read _rtld_objtail under the lock.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.212 src/libexec/ld.elf_so/rtld.c:1.213
--- src/libexec/ld.elf_so/rtld.c:1.212	Tue Sep 13 10:18:58 2022
+++ src/libexec/ld.elf_so/rtld.c	Sun Apr 23 11:53:00 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.212 2022/09/13 10:18:58 riastradh Exp $	 */
+/*	$NetBSD: rtld.c,v 1.213 2023/04/23 11:53:00 riastradh Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.212 2022/09/13 10:18:58 riastradh Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.213 2023/04/23 11:53:00 riastradh Exp $");
 #endif /* not lint */
 
 #include 
@@ -1026,7 +1026,7 @@ __strong_alias(__dlopen,dlopen)
 void *
 dlopen(const char *name, int mode)
 {
-	Obj_Entry **old_obj_tail = _rtld_objtail;
+	Obj_Entry **old_obj_tail;
 	Obj_Entry *obj = NULL;
 	int flags = _RTLD_DLOPEN;
 	bool nodelete;
@@ -1038,6 +1038,8 @@ dlopen(const char *name, int mode)
 
 	_rtld_exclusive_enter();
 
+	old_obj_tail = _rtld_objtail;
+
 	flags |= (mode & RTLD_GLOBAL) ? _RTLD_GLOBAL : 0;
 	flags |= (mode & RTLD_NOLOAD) ? _RTLD_NOLOAD : 0;
 



CVS commit: src/libexec/ld.elf_so

2023-04-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 23 11:53:00 UTC 2023

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
dlopen(3): Read _rtld_objtail under the lock.

XXX pullup-8
XXX pullup-9
XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/libexec/ld.elf_so/rtld.c

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



CVS commit: src/tests/usr.bin/xlint/lint1

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 11:52:43 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_135.c

Log Message:
tests/lint: add rationale for not warning about alignment problems


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_135.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/usr.bin/xlint/lint1/msg_135.c
diff -u src/tests/usr.bin/xlint/lint1/msg_135.c:1.14 src/tests/usr.bin/xlint/lint1/msg_135.c:1.15
--- src/tests/usr.bin/xlint/lint1/msg_135.c:1.14	Sat Apr 22 20:54:28 2023
+++ src/tests/usr.bin/xlint/lint1/msg_135.c	Sun Apr 23 11:52:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_135.c,v 1.14 2023/04/22 20:54:28 rillig Exp $	*/
+/*	$NetBSD: msg_135.c,v 1.15 2023/04/23 11:52:43 rillig Exp $	*/
 # 3 "msg_135.c"
 
 // Test for message: converting '%s' to '%s' increases alignment from %u to %u [135]
@@ -77,13 +77,21 @@ plain_char_to_unsigned_type(char *cp)
 
 /*
  * Converting a pointer with a low alignment requirement to a union that
- * includes other types with higher alignment requirements is safe.  While
- * accessing any other member of the union might trigger an alignment
- * violation, such an access would invoke undefined behavior anyway.
+ * includes other types with higher alignment requirements is considered safe.
+ * While accessing any other member of the union might trigger an alignment
+ * violation, such an access is not likely from an application point of view,
+ * as it would access undefined memory and thus invoke undefined behavior.
  *
  * A practical case for this pattern are tagged unions, in which the first
  * member of the struct determines how the remaining members are interpreted.
  * See sbin/newfs_udf, function udf_validate_tag_and_crc_sums for an example.
+ *
+ * C99 6.2.5p26 defines the representation and alignment of types, stating
+ * that pointers to union types need not have the same representation and
+ * alignment as pointers to other types.
+ *
+ * C99 6.7.2.1p14 and C23 6.7.2.1p18 both state that a "pointer to a union
+ * object [...] points to each of its members [...], and vice versa".
  */
 double
 cast_to_union(void)



CVS commit: src/tests/usr.bin/xlint/lint1

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 11:52:43 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: msg_135.c

Log Message:
tests/lint: add rationale for not warning about alignment problems


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/msg_135.c

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



Re: CVS commit: src/external/mit/lua/dist/src

2023-04-23 Thread Alexander Nasonov
Nikita wrote:
> Module Name:  src
> Committed By: nikita
> Date: Mon Apr 17 21:17:58 UTC 2023
> 
> Modified Files:
>   src/external/mit/lua/dist/src: ldump.c lundump.c
> 
> Log Message:
> lua: apply upstream bugfix for "Loading a corrupted binary file can segfault."

Unless it's a security bugfix for a release branch, I don't feel that
all those bugfixes should be applied to -current individually, it's
ok to wait for Lua 5.4.5 release and import it.

Alex


CVS commit: src

2023-04-23 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Apr 23 09:54:15 UTC 2023

Modified Files:
src: build.sh

Log Message:
build.sh: drop -lrumpdev hack introduced in previous

The existing trick in sys/rump/librump/rumpdev/rump_dev.c was not
updated after the renames in the kernel.  kudos to riastradh.

PR kern/56599


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.367 src/build.sh:1.368
--- src/build.sh:1.367	Sun Apr 23 02:01:33 2023
+++ src/build.sh	Sun Apr 23 09:54:15 2023
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.367 2023/04/23 02:01:33 uwe Exp $
+#	$NetBSD: build.sh,v 1.368 2023/04/23 09:54:15 uwe Exp $
 #
 # Copyright (c) 2001-2022 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -2010,7 +2010,7 @@ createmakewrapper()
 	eval cat < net_net
 #vfs -> fifo
-#dev -> vfs
 
 # -lrumpvfs -> $LRUMPVFS for now
 LRUMPVFS="-lrumpvfs -lrumpvfs_nofifofs"
 
-# -lrumpdev -> $LRUMPDEV
-# XXX: this may hide problems with other rump libraries that are not
-# supposed to depend on vfs but accidentally do
-LRUMPDEV="-lrumpdev $LRUMPVFS"
-
 RUMP_LIBSETS="
 	-lrump,
 -lrumpvfs
 --no-whole-archive -lrumpvfs_nofifofs -lrump,
-	-lrumpdev
---no-whole-archive $LRUMPVFS -lrump,
 	-lrumpkern_tty
 --no-whole-archive $LRUMPVFS -lrump,
 	-lrumpfs_tmpfs
 --no-whole-archive $LRUMPVFS -lrump,
 	-lrumpfs_ffs -lrumpfs_msdos
---no-whole-archive $LRUMPVFS -lrumpdev_disk $LRUMPDEV -lrump,
+--no-whole-archive $LRUMPVFS -lrumpdev_disk -lrumpdev -lrump,
 	-lrumpnet_virtif -lrumpnet_netinet -lrumpnet_net -lrumpnet
 	--no-whole-archive -lrump,
 	-lrumpfs_nfs
@@ -2289,7 +2281,7 @@ RUMP_LIBSETS="
 	-lrumpnet_sockin -lrumpnet_virtif -lrumpnet_netinet
 --start-group -lrumpnet_net -lrumpnet --end-group -lrump,
 	-lrumpdev_cgd -lrumpdev_raidframe -lrumpdev_rnd -lrumpdev_dm
---no-whole-archive $LRUMPVFS -lrumpdev_disk $LRUMPDEV -lrumpkern_crypto -lrump
+--no-whole-archive $LRUMPVFS -lrumpdev_disk -lrumpdev -lrumpkern_crypto -lrump
 "
 
 dorump()



CVS commit: src

2023-04-23 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Apr 23 09:54:15 UTC 2023

Modified Files:
src: build.sh

Log Message:
build.sh: drop -lrumpdev hack introduced in previous

The existing trick in sys/rump/librump/rumpdev/rump_dev.c was not
updated after the renames in the kernel.  kudos to riastradh.

PR kern/56599


To generate a diff of this commit:
cvs rdiff -u -r1.367 -r1.368 src/build.sh

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



CVS commit: src

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 09:04:44 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: t_usage.sh
src/usr.bin/xlint/lint1: err.c externs1.h

Log Message:
lint: be strict when parsing command line for excluded message IDs

Previously, lint accepted -X '1, 2, 3', while the manual page lists the
IDs without spaces.

On 32-bit platforms, lint accepted -X -4294967295, and on 64-bit
platforms, it accepted the corresponding larger numbers.

The code for parsing message IDs and query IDs conceptually does the
same, but the implementations differed for no reason.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/externs1.h

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/xlint/lint1/t_usage.sh
diff -u src/tests/usr.bin/xlint/lint1/t_usage.sh:1.1 src/tests/usr.bin/xlint/lint1/t_usage.sh:1.2
--- src/tests/usr.bin/xlint/lint1/t_usage.sh:1.1	Sun Apr 23 08:47:27 2023
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sun Apr 23 09:04:44 2023
@@ -1,4 +1,4 @@
-# $NetBSD: t_usage.sh,v 1.1 2023/04/23 08:47:27 rillig Exp $
+# $NetBSD: t_usage.sh,v 1.2 2023/04/23 09:04:44 rillig Exp $
 #
 # Copyright (c) 2023 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -48,29 +48,35 @@ suppress_messages_body()
 	# Larger than the largest known message.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid error message id '353'\n" \
+	-e "inline:lint1: invalid message ID '353'\n" \
 	"$lint1" -X 353 code.c /dev/null
 
-	# XXX: Whitespace should not be allowed before a message ID.
+	# Whitespace is not allowed before a message ID.
 	atf_check \
+	-s 'exit:1' \
+	-e "inline:lint1: invalid message ID ' 1'\n" \
 	"$lint1" -X ' 1' code.c /dev/null
 
 	# Whitespace is not allowed after a message ID.
 	atf_check \
 	-s 'exit:1' \
-	-e "inline:lint1: invalid error message id '1 '\n" \
+	-e "inline:lint1: invalid message ID '1 '\n" \
 	"$lint1" -X '1 ' code.c /dev/null
 
 	# Multiple message IDs can be comma-separated.
 	atf_check \
 	"$lint1" -X '1,2,3,4' code.c /dev/null
 
-	# XXX: Whitespace should not be allowed after a comma.
+	# Whitespace is not allowed after a comma.
 	atf_check \
+	-s 'exit:1' \
+	-e "inline:lint1: invalid message ID ' 2'\n" \
 	"$lint1" -X '1, 2, 3, 4' code.c /dev/null
 
-	# XXX: Trailing commas should not be allowed.
+	# Trailing commas are not allowed.
 	atf_check \
+	-s 'exit:1' \
+	-e "inline:lint1: invalid message ID ''\n" \
 	"$lint1" -X '1,,,' code.c /dev/null
 }
 

Index: src/usr.bin/xlint/lint1/err.c
diff -u src/usr.bin/xlint/lint1/err.c:1.193 src/usr.bin/xlint/lint1/err.c:1.194
--- src/usr.bin/xlint/lint1/err.c:1.193	Sat Apr 15 11:34:45 2023
+++ src/usr.bin/xlint/lint1/err.c	Sun Apr 23 09:04:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: err.c,v 1.193 2023/04/15 11:34:45 rillig Exp $	*/
+/*	$NetBSD: err.c,v 1.194 2023/04/23 09:04:44 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: err.c,v 1.193 2023/04/15 11:34:45 rillig Exp $");
+__RCSID("$NetBSD: err.c,v 1.194 2023/04/23 09:04:44 rillig Exp $");
 #endif
 
 #include 
@@ -419,18 +419,23 @@ static struct include_level {
 } *includes;
 
 void
-suppress_messages(char *ids)
+suppress_messages(const char *p)
 {
-	char *ptr, *end;
-	unsigned long id;
+	char *end;
+
+	for (; ch_isdigit(*p); p = end + 1) {
+		unsigned long id = strtoul(p, , 10);
+		if ((*end != '\0' && *end != ',') ||
+		id >= sizeof(msgs) / sizeof(msgs[0]) ||
+		msgs[id][0] == '\0')
+			break;
 
-	for (ptr = strtok(ids, ","); ptr != NULL; ptr = strtok(NULL, ",")) {
-		id = strtoul(ptr, , 10);
-		if (*end != '\0' || ptr == end ||
-		id >= sizeof(msgs) / sizeof(msgs[0]))
-			errx(1, "invalid error message id '%s'", ptr);
 		is_suppressed[id] = true;
+
+		if (*end == '\0')
+			return;
 	}
+	errx(1, "invalid message ID '%.*s'", (int)(strcspn(p, ",")), p);
 }
 
 void
@@ -722,24 +727,22 @@ void
 }
 
 void
-enable_queries(const char *arg)
+enable_queries(const char *p)
 {
+	char *end;
 
-	for (const char *s = arg;;) {
-		const char *e = s + strcspn(s, ",");
-
-		char *end;
-		unsigned long id = strtoul(s, , 10);
-		if (!(ch_isdigit(s[0]) && end == e &&
-		  id < sizeof(queries) / sizeof(queries[0]) &&
-		  queries[id][0] != '\0'))
-			errx(1, "invalid query ID '%.*s'", (int)(e - s), s);
+	for (; ch_isdigit(*p); p = end + 1) {
+		unsigned long id = strtoul(p, , 10);
+		if ((*end != '\0' && *end != ',') ||
+		id >= sizeof(queries) / sizeof(queries[0]) ||
+		queries[id][0] == '\0')
+			break;
 
 		any_query_enabled = true;
 		is_query_enabled[id] = true;
 
-		if (*e == '\0')
-			break;
-		s = e + 1;

CVS commit: src

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 09:04:44 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: t_usage.sh
src/usr.bin/xlint/lint1: err.c externs1.h

Log Message:
lint: be strict when parsing command line for excluded message IDs

Previously, lint accepted -X '1, 2, 3', while the manual page lists the
IDs without spaces.

On 32-bit platforms, lint accepted -X -4294967295, and on 64-bit
platforms, it accepted the corresponding larger numbers.

The code for parsing message IDs and query IDs conceptually does the
same, but the implementations differed for no reason.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/t_usage.sh
cvs rdiff -u -r1.193 -r1.194 src/usr.bin/xlint/lint1/err.c
cvs rdiff -u -r1.176 -r1.177 src/usr.bin/xlint/lint1/externs1.h

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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:53:08 UTC 2023

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

Log Message:
print stage formats with AUDIO_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.142 src/sys/dev/audio/audio.c:1.143
--- src/sys/dev/audio/audio.c:1.142	Sun Apr 23 08:38:53 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 08:53:08 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.142 2023/04/23 08:38:53 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.143 2023/04/23 08:53:08 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.142 2023/04/23 08:38:53 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.143 2023/04/23 08:53:08 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4764,25 +4764,35 @@ audio_track_set_format(audio_track_t *tr
 		if ((error = audio_track_init_freq(track, _dst)) != 0)
 			goto error;
 	}
-#if 0
-	/* debug */
-	if (track->freq.filter) {
-		audio_print_format2("freq src", >freq.srcbuf.fmt);
-		audio_print_format2("freq dst", >freq.dst->fmt);
-	}
-	if (track->chmix.filter) {
-		audio_print_format2("chmix src", >chmix.srcbuf.fmt);
-		audio_print_format2("chmix dst", >chmix.dst->fmt);
-	}
-	if (track->chvol.filter) {
-		audio_print_format2("chvol src", >chvol.srcbuf.fmt);
-		audio_print_format2("chvol dst", >chvol.dst->fmt);
-	}
-	if (track->codec.filter) {
-		audio_print_format2("codec src", >codec.srcbuf.fmt);
-		audio_print_format2("codec dst", >codec.dst->fmt);
+
+#if defined(AUDIO_DEBUG)
+	if (audiodebug >= 3) {
+		if (track->freq.filter) {
+			audio_print_format2("freq src",
+			>freq.srcbuf.fmt);
+			audio_print_format2("freq dst",
+			>freq.dst->fmt);
+		}
+		if (track->chmix.filter) {
+			audio_print_format2("chmix src",
+			>chmix.srcbuf.fmt);
+			audio_print_format2("chmix dst",
+			>chmix.dst->fmt);
+		}
+		if (track->chvol.filter) {
+			audio_print_format2("chvol src",
+			>chvol.srcbuf.fmt);
+			audio_print_format2("chvol dst",
+			>chvol.dst->fmt);
+		}
+		if (track->codec.filter) {
+			audio_print_format2("codec src",
+			>codec.srcbuf.fmt);
+			audio_print_format2("codec dst",
+			>codec.dst->fmt);
+		}
 	}
-#endif
+#endif /* AUDIO_DEBUG */
 
 	/* Stage input buffer */
 	track->input = last_dst;



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:53:08 UTC 2023

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

Log Message:
print stage formats with AUDIO_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/dev/audio/audio.c

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



CVS commit: src

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 08:47:27 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: t_usage.sh

Log Message:
tests/lint: test command line parsing for message and query IDs

The parsing methods differ but shouldn't.


To generate a diff of this commit:
cvs rdiff -u -r1.1257 -r1.1258 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.140 -r1.141 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/t_usage.sh

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.1257 src/distrib/sets/lists/tests/mi:1.1258
--- src/distrib/sets/lists/tests/mi:1.1257	Fri Apr 21 21:50:05 2023
+++ src/distrib/sets/lists/tests/mi	Sun Apr 23 08:47:27 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1257 2023/04/21 21:50:05 gutteridge Exp $
+# $NetBSD: mi,v 1.1258 2023/04/23 08:47:27 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7384,6 +7384,7 @@
 ./usr/tests/usr.bin/xlint/lint1/stmt_if.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/stmt_if.exp			tests-obsolete		obsolete,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/t_usagetests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/Atffile			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/Kyuafile		tests-usr.bin-tests	compattestfile,atf,kyua

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.140 src/tests/usr.bin/xlint/lint1/Makefile:1.141
--- src/tests/usr.bin/xlint/lint1/Makefile:1.140	Sun Feb  5 17:23:01 2023
+++ src/tests/usr.bin/xlint/lint1/Makefile	Sun Apr 23 08:47:27 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.140 2023/02/05 17:23:01 rillig Exp $
+# $NetBSD: Makefile,v 1.141 2023/04/23 08:47:27 rillig Exp $
 
 NOMAN=		# defined
 
@@ -8,7 +8,7 @@ ARCHSUBDIR!=	cd ${NETBSDSRCDIR}/usr.bin/
 
 TESTSDIR=	${TESTSBASE}/usr.bin/xlint/lint1
 
-TESTS_SH=	t_integration
+TESTS_SH=	t_integration t_usage
 TESTS_SH_SRC_t_integration=	archsubdir.sh t_integration.sh
 CLEANFILES+=	archsubdir.sh
 CLEANFILES+=	*.exp

Added files:

Index: src/tests/usr.bin/xlint/lint1/t_usage.sh
diff -u /dev/null src/tests/usr.bin/xlint/lint1/t_usage.sh:1.1
--- /dev/null	Sun Apr 23 08:47:27 2023
+++ src/tests/usr.bin/xlint/lint1/t_usage.sh	Sun Apr 23 08:47:27 2023
@@ -0,0 +1,135 @@
+# $NetBSD: t_usage.sh,v 1.1 2023/04/23 08:47:27 rillig Exp $
+#
+# Copyright (c) 2023 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+: "${lint1:=/usr/libexec/lint1}"
+
+
+suppress_messages_head()
+{
+	:
+}
+
+suppress_messages_body()
+{
+	printf 'typedef int dummy;\n' > code.c
+
+	# Message IDs are 0-based.
+	atf_check \
+	"$lint1" -X 0 code.c /dev/null
+
+	# The largest known message.
+	atf_check \
+	"$lint1" -X 352 code.c /dev/null
+
+	# Larger than the largest known message.
+	atf_check \
+	-s 'exit:1' \
+	-e "inline:lint1: invalid error message id '353'\n" \
+	"$lint1" -X 353 code.c /dev/null
+
+	# XXX: Whitespace should not be allowed before a message ID.
+	atf_check \
+	"$lint1" -X ' 1' code.c /dev/null
+
+	# Whitespace is not allowed after a message ID.
+	atf_check \
+	-s 'exit:1' \
+	-e "inline:lint1: invalid error message id '1 '\n" \
+	

CVS commit: src

2023-04-23 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sun Apr 23 08:47:27 UTC 2023

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile
Added Files:
src/tests/usr.bin/xlint/lint1: t_usage.sh

Log Message:
tests/lint: test command line parsing for message and query IDs

The parsing methods differ but shouldn't.


To generate a diff of this commit:
cvs rdiff -u -r1.1257 -r1.1258 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.140 -r1.141 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/t_usage.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/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:38:53 UTC 2023

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

Log Message:
Be a little bit more informative on device timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.141 src/sys/dev/audio/audio.c:1.142
--- src/sys/dev/audio/audio.c:1.141	Sun Apr 23 08:26:05 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 08:38:53 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.141 2023/04/23 08:26:05 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.142 2023/04/23 08:38:53 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.141 2023/04/23 08:26:05 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.142 2023/04/23 08:38:53 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -571,7 +571,8 @@ static void audio_exlock_exit(struct aud
 static struct audio_softc *audio_sc_acquire_fromfile(audio_file_t *,
 	struct psref *);
 static void audio_sc_release(struct audio_softc *, struct psref *);
-static int audio_track_waitio(struct audio_softc *, audio_track_t *);
+static int audio_track_waitio(struct audio_softc *, audio_track_t *,
+	const char *mess);
 
 static int audioclose(struct file *);
 static int audioread(struct file *, off_t *, struct uio *, kauth_cred_t, int);
@@ -1692,7 +1693,8 @@ audio_sc_release(struct audio_softc *sc,
  * Must be called with sc_lock held.
  */
 static int
-audio_track_waitio(struct audio_softc *sc, audio_track_t *track)
+audio_track_waitio(struct audio_softc *sc, audio_track_t *track,
+const char *mess)
 {
 	int error;
 
@@ -1714,8 +1716,15 @@ audio_track_waitio(struct audio_softc *s
 	}
 	if (error) {
 		TRACET(2, track, "cv_timedwait_sig failed %d", error);
-		if (error == EWOULDBLOCK)
-			audio_printf(sc, "device timeout\n");
+		if (error == EWOULDBLOCK) {
+			audio_ring_t *usrbuf = >usrbuf;
+			audio_ring_t *outbuf = >outbuf;
+			audio_printf(sc,
+			"%s: device timeout, seq=%d, usrbuf=%d/H%d, outbuf=%d/%d\n",
+			mess, (int)track->seq,
+			usrbuf->used, track->usrbuf_usedhigh,
+			outbuf->used, outbuf->capacity);
+		}
 	} else {
 		TRACET(3, track, "wakeup");
 	}
@@ -2837,7 +2846,7 @@ audio_read(struct audio_softc *sc, struc
 			}
 
 			TRACET(3, track, "sleep");
-			error = audio_track_waitio(sc, track);
+			error = audio_track_waitio(sc, track, "audio_read");
 			if (error) {
 mutex_exit(sc->sc_lock);
 return error;
@@ -2964,7 +2973,7 @@ audio_write(struct audio_softc *sc, stru
 
 			TRACET(3, track, "sleep usrbuf=%d/H%d",
 			usrbuf->used, track->usrbuf_usedhigh);
-			error = audio_track_waitio(sc, track);
+			error = audio_track_waitio(sc, track, "audio_write");
 			if (error) {
 mutex_exit(sc->sc_lock);
 goto abort;
@@ -6418,7 +6427,7 @@ audio_track_drain(struct audio_softc *sc
 			break;
 
 		TRACET(3, track, "sleep");
-		error = audio_track_waitio(sc, track);
+		error = audio_track_waitio(sc, track, "audio_drain");
 		if (error)
 			return error;
 



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:38:53 UTC 2023

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

Log Message:
Be a little bit more informative on device timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/dev/audio/audio.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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:26:05 UTC 2023

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

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.140 src/sys/dev/audio/audio.c:1.141
--- src/sys/dev/audio/audio.c:1.140	Sun Apr 23 08:05:36 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 08:26:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.140 2023/04/23 08:05:36 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.141 2023/04/23 08:26:05 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.140 2023/04/23 08:05:36 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.141 2023/04/23 08:26:05 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1186,7 +1186,7 @@ bad:
 	return;
 }
 
- /*
+/*
  * Identify audio backend device for drvctl.
  */
 static int
@@ -6071,7 +6071,7 @@ audio_rmixer_process(struct audio_softc 
 		tmpsrc.mem = mixer->mixsample;
 		tmpsrc.head = 0;
 		tmpsrc.used = 0;
- 
+
 		/* ad-hoc codec */
 		codecarg.srcfmt = >hwbuf.fmt;
 		codecarg.dstfmt = >mixfmt;
@@ -6098,7 +6098,7 @@ audio_rmixer_process(struct audio_softc 
 			TRACE(4, "unsupported hw format");
 			return;
 		}
- 
+
 		codecarg.src = auring_headptr(>hwbuf);
 		codecarg.dst = auring_tailptr();
 		codecarg.count = count;
@@ -6108,9 +6108,8 @@ audio_rmixer_process(struct audio_softc 
 
 	auring_take(>hwbuf, count);
 	auring_push(mixersrc, count);
- 
+
 	TRACE(4, "distribute");
- 
 
 	/* Distribute to all tracks. */
 	SLIST_FOREACH(f, >sc_files, entry) {



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:26:05 UTC 2023

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

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/audio/audio.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/pad

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:21:12 UTC 2023

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

Log Message:
No longer use AUDIO_INTERNAL_BITS but rely on passed audio format.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pad/pad.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.80 src/sys/dev/pad/pad.c:1.81
--- src/sys/dev/pad/pad.c:1.80	Mon Apr 10 15:04:49 2023
+++ src/sys/dev/pad/pad.c	Sun Apr 23 08:21:11 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.80 2023/04/10 15:04:49 mlelstv Exp $ */
+/* $NetBSD: pad.c,v 1.81 2023/04/23 08:21:11 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.80 2023/04/10 15:04:49 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.81 2023/04/23 08:21:11 mlelstv Exp $");
 
 #include 
 #include 
@@ -744,24 +744,40 @@ static void
 pad_swvol_codec(audio_filter_arg_t *arg)
 {
 	struct pad_softc *sc = arg->context;
-	const aint_t *src;
+	const uint8_t *src;
 	uint8_t *dst;
 	u_int sample_count;
 	u_int i;
+	u_int bits;
 
 	src = arg->src;
 	dst = arg->dst;
 	sample_count = arg->count * arg->srcfmt->channels;
+	bits = arg->srcfmt->precision;
+
 	for (i = 0; i < sample_count; i++) {
-		aint2_t v = (aint2_t)(*src++);
+		int32_t v;
+
+		switch (howmany(bits, NBBY)) {
+		case 2: /* AUDIO_INTERNAL_BITS == 16 */
+			v = *(const int16_t *)src;
+			src += sizeof(int16_t);
+			break;
+		case 4: /* AUDIO_INTERNAL_BITS == 32 */
+			v = *(const int32_t *)src;
+			src += sizeof(int32_t);
+			break;
+		default:
+			v = 0;
+			break;
+		}
+
 		v = v * sc->sc_swvol / 255;
 
-		CTASSERT(PADPREC <= AUDIO_INTERNAL_BITS * 2);
-#if PADPREC > AUDIO_INTERNAL_BITS
-		v = v << (PADPREC - AUDIO_INTERNAL_BITS);
-#elif PADPREC < AUDIO_INTERNAL_BITS
-		v = v >> (AUDIO_INTERNAL_BITS - PADPREC);
-#endif
+		if (PADPREC > bits)
+			v = v << (PADPREC - bits);
+		else if (PADPREC < bits)
+			v = v >> (bits - PADPREC);
 
 		/* AUDIO_ENCODING_SLINEAR_LE */
 #if PADPREC > 0



CVS commit: src/sys/dev/pad

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:21:12 UTC 2023

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

Log Message:
No longer use AUDIO_INTERNAL_BITS but rely on passed audio format.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pad/pad.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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:06:05 UTC 2023

Modified Files:
src/sys/dev/audio: audiovar.h

Log Message:
Enable 24bit support by default.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/audio/audiovar.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/audiovar.h
diff -u src/sys/dev/audio/audiovar.h:1.12 src/sys/dev/audio/audiovar.h:1.13
--- src/sys/dev/audio/audiovar.h:1.12	Fri May 29 03:09:14 2020
+++ src/sys/dev/audio/audiovar.h	Sun Apr 23 08:06:05 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audiovar.h,v 1.12 2020/05/29 03:09:14 isaki Exp $	*/
+/*	$NetBSD: audiovar.h,v 1.13 2023/04/23 08:06:05 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -79,7 +79,7 @@
 /*
  * Whether supports [US]LINEAR24/24 as userland format.
  */
-/* #define AUDIO_SUPPORT_LINEAR24 */
+#define AUDIO_SUPPORT_LINEAR24
 
 /*
  * Frequency range.



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:06:05 UTC 2023

Modified Files:
src/sys/dev/audio: audiovar.h

Log Message:
Enable 24bit support by default.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/audio/audiovar.h

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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:05:37 UTC 2023

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

Log Message:
Add 24bit/32bit hardware support.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.139 src/sys/dev/audio/audio.c:1.140
--- src/sys/dev/audio/audio.c:1.139	Sun Apr 23 06:30:58 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 08:05:36 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.139 2023/04/23 06:30:58 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.140 2023/04/23 08:05:36 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.139 2023/04/23 06:30:58 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.140 2023/04/23 08:05:36 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -697,6 +697,8 @@ static int au_get_monitor_gain(struct au
 static int audio_get_port(struct audio_softc *, mixer_ctrl_t *);
 static int audio_set_port(struct audio_softc *, mixer_ctrl_t *);
 
+void audio_mixsample_to_linear(audio_filter_arg_t *);
+
 static __inline struct audio_params
 format2_to_params(const audio_format2_t *f2)
 {
@@ -5377,8 +5379,15 @@ audio_mixer_init(struct audio_softc *sc,
 		len = mixer->frames_per_block * mixer->mixfmt.channels *
 		mixer->mixfmt.stride / NBBY;
 		mixer->mixsample = audio_realloc(mixer->mixsample, len);
-	} else {
-		/* No mixing buffer for recording */
+	} else if (reg->codec == NULL) {
+		/*
+		 * Recording requires an input conversion buffer
+		 * unless the hardware provides a codec itself
+		 */
+		mixer->mixfmt = mixer->track_fmt;
+		len = mixer->frames_per_block * mixer->mixfmt.channels *
+		mixer->mixfmt.stride / NBBY;
+		mixer->mixsample = audio_realloc(mixer->mixsample, len);
 	}
 
 	if (reg->codec) {
@@ -5647,31 +5656,32 @@ audio_pmixer_process(struct audio_softc 
 	 * The rest is the hardware part.
 	 */
 
+	m = mixer->mixsample;
+
 	if (mixer->codec) {
-		h = auring_tailptr_aint(>codecbuf);
-	} else {
-		h = auring_tailptr_aint(>hwbuf);
-	}
+		TRACE(4, "codec count=%d", frame_count);
 
-	m = mixer->mixsample;
-	if (!mixer->codec && mixer->swap_endian) {
-		for (i = 0; i < sample_count; i++) {
-			*h++ = bswap16(*m++);
-		}
-	} else {
-		for (i = 0; i < sample_count; i++) {
+		h = auring_tailptr_aint(>codecbuf);
+		for (i=0; icodec) {
+		/* Hardware driver's codec */
 		auring_push(>codecbuf, frame_count);
 		mixer->codecarg.src = auring_headptr(>codecbuf);
 		mixer->codecarg.dst = auring_tailptr(>hwbuf);
 		mixer->codecarg.count = frame_count;
 		mixer->codec(>codecarg);
 		auring_take(>codecbuf, mixer->codecarg.count);
+	} else {
+		TRACE(4, "direct count=%d", frame_count);
+
+		/* Direct conversion to linear output */
+		mixer->codecarg.src = m;
+		mixer->codecarg.dst = auring_tailptr(>hwbuf);
+		mixer->codecarg.count = frame_count;
+		mixer->codecarg.srcfmt = >mixfmt;
+		mixer->codecarg.dstfmt = >hwbuf.fmt;
+		audio_mixsample_to_linear(>codecarg);
 	}
 
 	auring_push(>hwbuf, frame_count);
@@ -6024,11 +6034,12 @@ audio_rmixer_process(struct audio_softc 
 {
 	audio_trackmixer_t *mixer;
 	audio_ring_t *mixersrc;
+	audio_ring_t tmpsrc;
+	audio_filter_t codec;
+	audio_filter_arg_t codecarg;
 	audio_file_t *f;
-	aint_t *p;
 	int count;
 	int bytes;
-	int i;
 
 	mixer = sc->sc_rmixer;
 
@@ -6046,25 +6057,61 @@ audio_rmixer_process(struct audio_softc 
 
 	/* Hardware driver's codec */
 	if (mixer->codec) {
+		TRACE(4, "codec count=%d", count);
 		mixer->codecarg.src = auring_headptr(>hwbuf);
 		mixer->codecarg.dst = auring_tailptr(>codecbuf);
 		mixer->codecarg.count = count;
 		mixer->codec(>codecarg);
-		auring_take(>hwbuf, mixer->codecarg.count);
-		auring_push(>codecbuf, mixer->codecarg.count);
 		mixersrc = >codecbuf;
 	} else {
-		mixersrc = >hwbuf;
-	}
-
-	if (!mixer->codec && mixer->swap_endian) {
-		/* inplace conversion */
-		p = auring_headptr_aint(mixersrc);
-		for (i = 0; i < count * mixer->track_fmt.channels; i++, p++) {
-			*p = bswap16(*p);
+		TRACE(4, "direct count=%d", count);
+		/* temporary ring using mixsample buffer */
+		tmpsrc.fmt = mixer->mixfmt;
+		tmpsrc.capacity = mixer->frames_per_block;
+		tmpsrc.mem = mixer->mixsample;
+		tmpsrc.head = 0;
+		tmpsrc.used = 0;
+ 
+		/* ad-hoc codec */
+		codecarg.srcfmt = >hwbuf.fmt;
+		codecarg.dstfmt = >mixfmt;
+		codec = NULL;
+		if (audio_format2_is_linear(codecarg.srcfmt)) {
+			switch (codecarg.srcfmt->stride) {
+			case 8:
+codec = audio_linear8_to_internal;
+break;
+			case 16:
+codec = audio_linear16_to_internal;
+break;
+#if defined(AUDIO_SUPPORT_LINEAR24)
+			case 24:
+codec = audio_linear24_to_internal;
+break;
+#endif
+			case 32:
+codec = audio_linear32_to_internal;
+break;
+			

CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 08:05:37 UTC 2023

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

Log Message:
Add 24bit/32bit hardware support.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/audio/audio.c

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



CVS commit: src/sys/rump/librump/rumpdev

2023-04-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 23 07:03:30 UTC 2023

Modified Files:
src/sys/rump/librump/rumpdev: rump_dev.c

Log Message:
rumpdev: Catch up to buf_syncwait -> vfs_syncwait rename.

Do similarly with a do_sys_sync weak stub so we can drop the rumpvfs
dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/rump/librump/rumpdev/rump_dev.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/rump/librump/rumpdev/rump_dev.c
diff -u src/sys/rump/librump/rumpdev/rump_dev.c:1.28 src/sys/rump/librump/rumpdev/rump_dev.c:1.29
--- src/sys/rump/librump/rumpdev/rump_dev.c:1.28	Sun Feb 23 01:53:03 2020
+++ src/sys/rump/librump/rumpdev/rump_dev.c	Sun Apr 23 07:03:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $	*/
+/*	$NetBSD: rump_dev.c,v 1.29 2023/04/23 07:03:30 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.29 2023/04/23 07:03:30 riastradh Exp $");
 
 #include 
 #include 
@@ -34,9 +34,21 @@ __KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v
 #include 
 #include 
 
-int nocomponent(void);
-int nocomponent() {return 0;}
-__weak_alias(buf_syncwait,nocomponent);
+int rumpdev_do_sys_sync_stub(struct lwp *);
+int
+rumpdev_do_sys_sync_stub(struct lwp *l)
+{
+	return 0;
+}
+__weak_alias(do_sys_sync,rumpdev_do_sys_sync_stub);
+
+int rumpdev_vfs_syncwait_stub(void);
+int
+rumpdev_vfs_syncwait_stub(void)
+{
+	return 0;
+}
+__weak_alias(vfs_syncwait,rumpdev_vfs_syncwait_stub);
 
 const char *rootspec = "rump0a"; /* usually comes from config */
 



CVS commit: src/sys/rump/librump/rumpdev

2023-04-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 23 07:03:30 UTC 2023

Modified Files:
src/sys/rump/librump/rumpdev: rump_dev.c

Log Message:
rumpdev: Catch up to buf_syncwait -> vfs_syncwait rename.

Do similarly with a do_sys_sync weak stub so we can drop the rumpvfs
dependency.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/rump/librump/rumpdev/rump_dev.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/luna68k

2023-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 23 06:58:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: spc.c
src/sys/arch/luna68k/luna68k: mainbus.c

Log Message:
Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in .

Tested on both LUNA and LUNA-II.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/spc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/luna68k/luna68k/mainbus.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/luna68k/dev/spc.c
diff -u src/sys/arch/luna68k/dev/spc.c:1.10 src/sys/arch/luna68k/dev/spc.c:1.11
--- src/sys/arch/luna68k/dev/spc.c:1.10	Tue Jan 22 15:44:25 2013
+++ src/sys/arch/luna68k/dev/spc.c	Sun Apr 23 06:57:59 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $ */
+/* $NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.11 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: spc.c,v 1.10
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -66,11 +67,17 @@ spc_mainbus_match(device_t parent, cfdat
 
 	if (strcmp(ma->ma_name, spc_cd.cd_name))
 		return 0;
-#if 0
-	if (badaddr((void *)ma->ma_addr, 4))
+
+	/*
+	 * LUNA-I doesn't have the secondary SCSI.
+	 * However we cannot check it by badaddr() at the address range
+	 * of the secondary SCSI on LUNA-II because the address bus lines
+	 * are not fully decoded on LUNA-I and the primary SCSI registers
+	 * are also accessible at the seconadary address range.
+	 */
+	if (machtype == LUNA_I && ma->ma_addr != SCSI_ADDR)
 		return 0;
-	/* Experiments proved 2nd SPC address does NOT make a buserror. */
-#endif
+
 	return 1;
 }
 

Index: src/sys/arch/luna68k/luna68k/mainbus.c
diff -u src/sys/arch/luna68k/luna68k/mainbus.c:1.20 src/sys/arch/luna68k/luna68k/mainbus.c:1.21
--- src/sys/arch/luna68k/luna68k/mainbus.c:1.20	Thu Apr 13 11:44:10 2023
+++ src/sys/arch/luna68k/luna68k/mainbus.c	Sun Apr 23 06:57:59 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $ */
+/* $NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.20 2023/04/13 11:44:10 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.21 2023/04/23 06:57:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -39,26 +39,17 @@ __KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 
 
 #include 
 #include 
+#include 
 
 static const struct mainbus_attach_args luna_devs[] = {
-	{ "clock",  0x4500, -1 },	/* Mostek TimeKeeper */
-	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
-	{ "le", 0xf100, 3 },	/* Am7990 */
-	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
-	{ "fb", 0xc110, -1 },	/* BrookTree RAMDAC */
-	{ "spc",0xe100, 2 },	/* MB89352 */
-};
-
-static const struct mainbus_attach_args luna2_devs[] = {
-	{ "clock",  0x4500, -1 },	/* Dallas TimeKeeper */
-	{ "lcd",0x4d00, -1 },	/* Sharp LM16X212 LCD module */
-	{ "le", 0xf100, 3 },	/* Am7990 */
-	{ "sio",0x5100, 6 },	/* uPD7201A */
-	{ "xpbus",  0x7100, -1 },	/* HD647180XP */
-	{ "fb", 0xc110, -1 },	/* BrookTree RAMDAC */
-	{ "spc",0xe100, 2 },	/* internal MB89352 */
-	{ "spc",0xe140, 2 },	/* external MB89352 */
+	{ "clock",  NVRAM_ADDR, -1 },	/* Mostek/Dallas TimeKeeper */
+	{ "lcd",OBIO_PIO1A, -1 },	/* Sharp LM16X212 LCD module */
+	{ "le", LANCE_ADDR, 3 },	/* Am7990 */
+	{ "sio",OBIO_SIO, 6 },	/* uPD7201A */
+	{ "xpbus",  TRI_PORT_RAM, -1 },	/* HD647180XP */
+	{ "fb", BMAP_PALLET2, -1 },	/* BrookTree RAMDAC */
+	{ "spc",SCSI_ADDR, 2 },	/* internal MB89352 */
+	{ "spc",SCSI_2_ADDR, 2 },	/* external MB89352 (on LUNA-II) */
 };
 
 static void mainbus_attach(device_t, device_t, void *);
@@ -87,13 +78,9 @@ mainbus_attach(device_t parent, device_t
 	const struct mainbus_attach_args *devs;
 	struct mainbus_attach_args ma;
 
-	if (machtype == LUNA_II) {
-		devs = luna2_devs;
-		ndevs = __arraycount(luna2_devs);
-	} else {
-		devs = luna_devs;
-		ndevs = __arraycount(luna_devs);
-	}
+	devs = luna_devs;
+	ndevs = __arraycount(luna_devs);
+
 	aprint_normal("\n");
 	for (i = 0; i < ndevs; i++) {
 		ma = devs[i];



CVS commit: src/sys/arch/luna68k

2023-04-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Apr 23 06:58:00 UTC 2023

Modified Files:
src/sys/arch/luna68k/dev: spc.c
src/sys/arch/luna68k/luna68k: mainbus.c

Log Message:
Explicitly check machine type (LUNA-II) on secondary spc(4) probe.

So that individual mainbus_attach_args for both LUNA and LUNA-II
are no longer necessary.
While here, use proper address macro in .

Tested on both LUNA and LUNA-II.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/spc.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/luna68k/luna68k/mainbus.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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:30:58 UTC 2023

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

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/audio/audio.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

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:30:58 UTC 2023

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

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.138 src/sys/dev/audio/audio.c:1.139
--- src/sys/dev/audio/audio.c:1.138	Sun Apr 23 06:28:34 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 06:30:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.139 2023/04/23 06:30:58 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.139 2023/04/23 06:30:58 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1190,19 +1190,19 @@ bad:
 static int
 audio_properties(struct audio_softc *sc)
 {
-   prop_dictionary_t dict = device_properties(sc->sc_dev);
-   audio_device_t adev;
-   int error;
-
-   error = sc->hw_if->getdev(sc->hw_hdl, );
-   if (error)
-	   return error;
-
-   prop_dictionary_set_string(dict, "name", adev.name);
-   prop_dictionary_set_string(dict, "version", adev.version);
-   prop_dictionary_set_string(dict, "config", adev.config);
+	prop_dictionary_t dict = device_properties(sc->sc_dev);
+	audio_device_t adev;
+	int error;
+
+	error = sc->hw_if->getdev(sc->hw_hdl, );
+	if (error)
+		return error;
+
+	prop_dictionary_set_string(dict, "name", adev.name);
+	prop_dictionary_set_string(dict, "version", adev.version);
+	prop_dictionary_set_string(dict, "config", adev.config);
 
-   return 0;
+	return 0;
 }
 
 /*



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:28:34 UTC 2023

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

Log Message:
Make audio_device information available to drvctl and devpubd.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.137 src/sys/dev/audio/audio.c:1.138
--- src/sys/dev/audio/audio.c:1.137	Mon Apr 17 20:33:45 2023
+++ src/sys/dev/audio/audio.c	Sun Apr 23 06:28:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $	*/
+/*	$NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -181,7 +181,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.137 2023/04/17 20:33:45 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.138 2023/04/23 06:28:34 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -561,6 +561,7 @@ static void audio_mixer_restore(struct a
 static void audio_softintr_rd(void *);
 static void audio_softintr_wr(void *);
 
+static int audio_properties(struct audio_softc *);
 static void audio_printf(struct audio_softc *, const char *, ...)
 	__printflike(2, 3);
 static int audio_exlock_mutex_enter(struct audio_softc *);
@@ -1063,6 +1064,10 @@ audioattach(device_t parent, device_t se
 			rhwfmt = phwfmt;
 	}
 
+	/* Make device id available */
+	if (audio_properties(sc))
+		aprint_error_dev(self, "audio_properties failed\n");
+
 	/* Init hardware. */
 	/* hw_probe() also validates [pr]hwfmt.  */
 	error = audio_hw_set_format(sc, mode, , , , );
@@ -1179,6 +1184,27 @@ bad:
 	return;
 }
 
+ /*
+ * Identify audio backend device for drvctl.
+ */
+static int
+audio_properties(struct audio_softc *sc)
+{
+   prop_dictionary_t dict = device_properties(sc->sc_dev);
+   audio_device_t adev;
+   int error;
+
+   error = sc->hw_if->getdev(sc->hw_hdl, );
+   if (error)
+	   return error;
+
+   prop_dictionary_set_string(dict, "name", adev.name);
+   prop_dictionary_set_string(dict, "version", adev.version);
+   prop_dictionary_set_string(dict, "config", adev.config);
+
+   return 0;
+}
+
 /*
  * Initialize hardware mixer.
  * This function is called from audioattach().



CVS commit: src/sys/dev/audio

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:28:34 UTC 2023

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

Log Message:
Make audio_device information available to drvctl and devpubd.


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/audio/audio.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/usb

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:13:35 UTC 2023

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Weed out duplicate sample rates and add comment about UAC2 clocks.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/dev/usb/uaudio.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/usb/uaudio.c
diff -u src/sys/dev/usb/uaudio.c:1.179 src/sys/dev/usb/uaudio.c:1.180
--- src/sys/dev/usb/uaudio.c:1.179	Sun Apr 16 19:26:20 2023
+++ src/sys/dev/usb/uaudio.c	Sun Apr 23 06:13:35 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $	*/
+/*	$NetBSD: uaudio.c,v 1.180 2023/04/23 06:13:35 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.179 2023/04/16 19:26:20 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.180 2023/04/23 06:13:35 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -2479,9 +2479,20 @@ Static u_int
 uaudio_get_rates(struct uaudio_softc *sc, int mode, u_int *freqs, u_int len)
 {
 	struct mixerctl *mc;
-	u_int n, freq, start, end, step;
-	int j, k, count;
+	u_int freq, start, end, step;
+	u_int i, n;
+	u_int k, count;
+	int j;
 
+	/*
+	 * With UAC2 the sample rate isn't part of the data format,
+	 * instead, you have separate clock sources that may be
+	 * assigned to individual terminals (inputs, outputs).
+	 *
+	 * For audio(4) we only distinguish between input and output
+	 * formats and collect the unique rates from all possible clock
+	 * sources.
+	 */
 	n = 0;
 	for (j = 0; j < sc->sc_nratectls; ++j) {
 
@@ -2499,6 +2510,18 @@ uaudio_get_rates(struct uaudio_softc *sc
 			end   = (u_int) mc->ranges[k].maxval;
 			step  = (u_int) mc->ranges[k].resval;
 			for (freq = start; freq <= end; freq += step) {
+/* remove duplicates */
+for (i = 0; i < n; ++i) {
+	if (freqs[i] == freq)
+		break;
+}
+if (i < n) {
+	if (step == 0)
+		break;
+	continue;
+}
+
+/* store or count */
 if (len != 0) {
 	if (n >= len)
 		goto done;



CVS commit: src/sys/dev/usb

2023-04-23 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 23 06:13:35 UTC 2023

Modified Files:
src/sys/dev/usb: uaudio.c

Log Message:
Weed out duplicate sample rates and add comment about UAC2 clocks.


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

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