CVS commit: src/sys/dev/audio

2021-01-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jan 15 05:34:49 UTC 2021

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

Log Message:
Improve error messages.
- prefix MD device name if it's considered to be related to the MD driver.
- revise some messages.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 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.87 src/sys/dev/audio/audio.c:1.88
--- src/sys/dev/audio/audio.c:1.87	Fri Jan 15 04:09:28 2021
+++ src/sys/dev/audio/audio.c	Fri Jan 15 05:34:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.87 2021/01/15 04:09:28 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.88 2021/01/15 05:34:49 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.87 2021/01/15 04:09:28 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.88 2021/01/15 05:34:49 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -515,6 +515,8 @@ static void audio_mixer_restore(struct a
 static void audio_softintr_rd(void *);
 static void audio_softintr_wr(void *);
 
+static void audio_printf(struct audio_softc *, const char *, ...)
+	__printflike(2, 3);
 static int audio_exlock_mutex_enter(struct audio_softc *);
 static void audio_exlock_mutex_exit(struct audio_softc *);
 static int audio_exlock_enter(struct audio_softc *);
@@ -972,19 +974,20 @@ audioattach(device_t parent, device_t se
 		perror = audio_hw_probe(sc, &phwfmt, AUMODE_PLAY);
 		rerror = audio_hw_probe(sc, &rhwfmt, AUMODE_RECORD);
 		if (perror && rerror) {
-			aprint_error_dev(self, "audio_hw_probe failed, "
-			"perror = %d, rerror = %d\n", perror, rerror);
+			aprint_error_dev(self,
+			"audio_hw_probe failed: perror=%d, rerror=%d\n",
+			perror, rerror);
 			goto bad;
 		}
 		if (perror) {
 			mode &= ~AUMODE_PLAY;
-			aprint_error_dev(self, "audio_hw_probe failed with "
-			"%d, playback disabled\n", perror);
+			aprint_error_dev(self, "audio_hw_probe failed: "
+			"errno=%d, playback disabled\n", perror);
 		}
 		if (rerror) {
 			mode &= ~AUMODE_RECORD;
-			aprint_error_dev(self, "audio_hw_probe failed with "
-			"%d, capture disabled\n", rerror);
+			aprint_error_dev(self, "audio_hw_probe failed: "
+			"errno=%d, capture disabled\n", rerror);
 		}
 	} else {
 		/*
@@ -994,8 +997,8 @@ audioattach(device_t parent, device_t se
 		audio_format2_t *fmt = has_playback ? &phwfmt : &rhwfmt;
 		error = audio_hw_probe(sc, fmt, mode);
 		if (error) {
-			aprint_error_dev(self, "audio_hw_probe failed, "
-			"error = %d\n", error);
+			aprint_error_dev(self,
+			"audio_hw_probe failed: errno=%d\n", error);
 			goto bad;
 		}
 		if (has_playback && has_capture)
@@ -1006,8 +1009,8 @@ audioattach(device_t parent, device_t se
 	/* hw_probe() also validates [pr]hwfmt.  */
 	error = audio_hw_set_format(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
 	if (error) {
-		aprint_error_dev(self, "audio_hw_set_format failed, "
-		"error = %d\n", error);
+		aprint_error_dev(self,
+		"audio_hw_set_format failed: errno=%d\n", error);
 		goto bad;
 	}
 
@@ -1017,8 +1020,8 @@ audioattach(device_t parent, device_t se
 	 */
 	error = audio_mixers_init(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
 	if (sc->sc_pmixer == NULL && sc->sc_rmixer == NULL) {
-		aprint_error_dev(self, "audio_mixers_init failed, "
-		"error = %d\n", error);
+		aprint_error_dev(self,
+		"audio_mixers_init failed: errno=%d\n", error);
 		goto bad;
 	}
 
@@ -1436,6 +1439,22 @@ audio_attach_mi(const struct audio_hw_if
 }
 
 /*
+ * audio_printf() outputs fmt... with the audio device name and MD device
+ * name prefixed.  If the message is considered to be related to the MD
+ * driver, use this one instead of device_printf().
+ */
+static void
+audio_printf(struct audio_softc *sc, const char *fmt, ...)
+{
+	va_list ap;
+
+	printf("%s(%s): ", device_xname(sc->sc_dev), device_xname(sc->hw_dev));
+	va_start(ap, fmt);
+	vprintf(fmt, ap);
+	va_end(ap);
+}
+
+/*
  * Enter critical section and also keep sc_lock.
  * If successful, returns 0 with sc_lock held.  Otherwise returns errno.
  * Must be called without sc_lock held.
@@ -1581,7 +1600,7 @@ audio_track_waitio(struct audio_softc *s
 	if (error) {
 		TRACET(2, track, "cv_timedwait_sig failed %d", error);
 		if (error == EWOULDBLOCK)
-			device_printf(sc->sc_dev, "device timeout\n");
+			audio_printf(sc, "device timeout\n");
 	} else {
 		TRACET(3, track, "wakeup");
 	}
@@ -2424,8 +2443,8 @@ audio_unlink(struct audio_softc *sc, aud
 		/* XXX what should I do on error? */
 		if (error == EWOULDBLOCK) {
 			mutex_exit(sc->sc_lock);
-			device_printf(sc->sc_dev,
-			"%s: cv_timedwait_sig failed %d\n",
+			audio_printf(sc,
+			"%s: cv_timedwait_sig failed: errno=%d\n",
 			__func__, error);
 		

CVS commit: src/sys/dev/audio

2021-01-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Jan 15 04:09:28 UTC 2021

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

Log Message:
Change (harmless) zero-length debug messages.
sys/modules is compiled with -Wzero-length-format and this
makes sys/modules compilable even if AUDIO_DEBUG is defined.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 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.86 src/sys/dev/audio/audio.c:1.87
--- src/sys/dev/audio/audio.c:1.86	Sat Dec 19 01:18:58 2020
+++ src/sys/dev/audio/audio.c	Fri Jan 15 04:09:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.86 2020/12/19 01:18:58 thorpej Exp $	*/
+/*	$NetBSD: audio.c,v 1.87 2021/01/15 04:09:28 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.86 2020/12/19 01:18:58 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.87 2021/01/15 04:09:28 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -3140,7 +3140,7 @@ filt_audioread_detach(struct knote *kn)
 
 	file = kn->kn_hook;
 	sc = file->sc;
-	TRACEF(3, file, "");
+	TRACEF(3, file, "called");
 
 	mutex_enter(sc->sc_lock);
 	selremove_knote(&sc->sc_rsel, kn);
@@ -3187,7 +3187,7 @@ filt_audiowrite_detach(struct knote *kn)
 
 	file = kn->kn_hook;
 	sc = file->sc;
-	TRACEF(3, file, "");
+	TRACEF(3, file, "called");
 
 	mutex_enter(sc->sc_lock);
 	selremove_knote(&sc->sc_wsel, kn);
@@ -3344,7 +3344,7 @@ audioctl_open(dev_t dev, struct audio_so
 
 	KASSERT(sc->sc_exlock);
 
-	TRACE(1, "");
+	TRACE(1, "called");
 
 	error = fd_allocfile(&fp, &fd);
 	if (error)
@@ -5856,7 +5856,7 @@ audio_pmixer_halt(struct audio_softc *sc
 {
 	int error;
 
-	TRACE(2, "");
+	TRACE(2, "called");
 	KASSERT(mutex_owned(sc->sc_lock));
 	KASSERT(sc->sc_exlock);
 
@@ -5886,7 +5886,7 @@ audio_rmixer_halt(struct audio_softc *sc
 {
 	int error;
 
-	TRACE(2, "");
+	TRACE(2, "called");
 	KASSERT(mutex_owned(sc->sc_lock));
 	KASSERT(sc->sc_exlock);
 
@@ -8069,7 +8069,7 @@ mixer_close(struct audio_softc *sc, audi
 	error = audio_exlock_enter(sc);
 	if (error)
 		return error;
-	TRACE(1, "");
+	TRACE(1, "called");
 	mixer_async_remove(sc, curproc->p_pid);
 	audio_exlock_exit(sc);
 



CVS commit: src/sys/compat/netbsd32

2021-01-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Fri Jan 15 03:51:41 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_netbsd.c

Log Message:
Remove unused LIMITCHECK() macro (now contained in netbsd32_rlimit.c).


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/compat/netbsd32/netbsd32_netbsd.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/compat/netbsd32/netbsd32_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.230 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.231
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.230	Sat Oct 10 00:00:54 2020
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Fri Jan 15 03:51:41 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.230 2020/10/10 00:00:54 rin Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.231 2021/01/15 03:51:41 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.230 2020/10/10 00:00:54 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.231 2021/01/15 03:51:41 simonb Exp $");
 
 /*
  * below are all the standard NetBSD system calls, in the 32bit
@@ -109,8 +109,6 @@ void netbsd32_syscall_intern(struct proc
 void syscall(void);
 #endif
 
-#define LIMITCHECK(a, b) ((a) != RLIM_INFINITY && (a) > (b))
-
 #ifdef MODULAR
 #include 
 #endif



CVS commit: src/sys

2021-01-14 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Jan 15 00:38:23 UTC 2021

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c bcm2835_intr.c
src/sys/arch/arm/fdt: gic_fdt.c gicv3_fdt.c
src/sys/arch/arm/nvidia: tegra_lic.c
src/sys/arch/arm/nxp: imx6_gpc.c imx7_gpc.c imx_gpio.c
src/sys/arch/arm/rockchip: rk3399_pcie.c
src/sys/arch/arm/samsung: exynos_combiner.c
src/sys/arch/arm/sunxi: sunxi_gpio.c sunxi_intc.c sunxi_nmi.c
src/sys/arch/arm/ti: ti_gpio.c ti_omapintc.c
src/sys/arch/mips/cavium/dev: octeon_cib.c octeon_intc.c
src/sys/dev/fdt: fdt_intr.c fdtvar.h

Log Message:
Add 'const char *xname' arg to fdtbus_interrupt_controller_func .establish


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/broadcom/bcm2835_intr.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/fdt/gic_fdt.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/fdt/gicv3_fdt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/nvidia/tegra_lic.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nxp/imx6_gpc.c \
src/sys/arch/arm/nxp/imx7_gpc.c src/sys/arch/arm/nxp/imx_gpio.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/rockchip/rk3399_pcie.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/arm/samsung/exynos_combiner.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/sunxi/sunxi_gpio.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_intc.c \
src/sys/arch/arm/sunxi/sunxi_nmi.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/ti/ti_gpio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/ti/ti_omapintc.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mips/cavium/dev/octeon_cib.c \
src/sys/arch/mips/cavium/dev/octeon_intc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/fdt/fdt_intr.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/fdt/fdtvar.h

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.16 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.17
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.16	Sat Oct 12 09:46:18 2019
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Fri Jan 15 00:38:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.16 2019/10/12 09:46:18 mlelstv Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.17 2021/01/15 00:38:22 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.16 2019/10/12 09:46:18 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.17 2021/01/15 00:38:22 jmcneill Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -150,7 +150,7 @@ static struct fdtbus_gpio_controller_fun
 };
 
 static void *	bcmgpio_fdt_intr_establish(device_t, u_int *, int, int,
-		int (*func)(void *), void *);
+		int (*func)(void *), void *, const char *);
 static void	bcmgpio_fdt_intr_disestablish(device_t, void *);
 static bool	bcmgpio_fdt_intrstr(device_t, u_int *, char *, size_t);
 
@@ -567,7 +567,7 @@ bcmgpio_intr_disable(struct bcmgpio_soft
 
 static void *
 bcmgpio_fdt_intr_establish(device_t dev, u_int *specifier, int ipl, int flags,
-int (*func)(void *), void *arg)
+int (*func)(void *), void *arg, const char *xname)
 {
 	struct bcmgpio_softc * const sc = device_private(dev);
 	int eint_flags = (flags & FDT_INTR_MPSAFE) ? BCMGPIO_INTR_MPSAFE : 0;

Index: src/sys/arch/arm/broadcom/bcm2835_intr.c
diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.33 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.34
--- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.33	Wed Dec 16 19:49:04 2020
+++ src/sys/arch/arm/broadcom/bcm2835_intr.c	Fri Jan 15 00:38:22 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_intr.c,v 1.33 2020/12/16 19:49:04 christos Exp $	*/
+/*	$NetBSD: bcm2835_intr.c,v 1.34 2021/01/15 00:38:22 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.33 2020/12/16 19:49:04 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.34 2021/01/15 00:38:22 jmcneill Exp $");
 
 #define _INTR_PRIVATE
 
@@ -83,7 +83,7 @@ static void bcm2836mp_send_ipi(struct pi
 
 static int bcm2835_icu_fdt_decode_irq(u_int *);
 static void *bcm2835_icu_fdt_establish(device_t, u_int *, int, int,
-int (*)(void *), void *);
+int (*)(void *), void *, const char *);
 static void bcm2835_icu_fdt_disestablish(device_t, void *);
 static bool bcm2835_icu_fdt_intrstr(device_t, u_int *, char *, size_t);
 
@@ -91,7 +91,7 @@ static int bcm2835_icu_intr(void *);
 
 static int bcm2836mp_icu_fdt_decode_irq(u_int *);
 static void *bcm2836mp_icu_fdt_establish(device_t, u_int *, int, int,
-int (*)(void *), void *);
+int (*)(void *), void *, const char *);
 static void bcm2836mp_icu_fdt_disestablish(device_t, void *);
 static 

CVS commit: src/share/man/man5

2021-01-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jan 14 23:32:12 UTC 2021

Modified Files:
src/share/man/man5: mk.conf.5

Log Message:
Initial attempt at documenting the KERNEL_DIR option.

XXX EXPERIMENTAL, Work-In-Progress ! XXX


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/share/man/man5/mk.conf.5

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/man5/mk.conf.5
diff -u src/share/man/man5/mk.conf.5:1.83 src/share/man/man5/mk.conf.5:1.84
--- src/share/man/man5/mk.conf.5:1.83	Tue Nov 10 21:47:49 2020
+++ src/share/man/man5/mk.conf.5	Thu Jan 14 23:32:12 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mk.conf.5,v 1.83 2020/11/10 21:47:49 kamil Exp $
+.\"	$NetBSD: mk.conf.5,v 1.84 2021/01/14 23:32:12 pgoyette Exp $
 .\"
 .\"  Copyright (c) 1999-2003 The NetBSD Foundation, Inc.
 .\"  All rights reserved.
@@ -182,6 +182,37 @@ unless run in
 .Sq expert
 mode
 .
+.It Sy KERNEL_DIR (EXPERIMENTAL)
+.YorN
+Indicates if a top-level directory
+.Sy /netbsd/
+is created.
+If
+.Dq yes ,
+the directory will contain a kernel file
+.Pa /netbsd/kernel
+and a corresponding modules directory
+.Pa /netbsd/modules/ .
+System bootstrap procedures will be modified to search for the kernel
+and modules in the
+.Pa /netbsd/
+directory.
+This is intended to simplify system upgrade and rollback procedures by
+keeping the kernel and its associated modules together in one place.
+.Pp
+If
+.Dq no ,
+the kernel file will be stored in
+.Pa /netbsd
+and the modules will be stored within the
+.Pa /stand/${ARCH}/
+directory hierarchy.
+.Pp
+The
+.Sy KERNEL_DIR
+option is a work-in-progress, and is highly experimental.
+It is also subject to change without notice.
+.DFLTn
 .It Sy MAKEVERBOSE
 Level of verbosity of status messages.
 Supported values:



CVS commit: src/sys/compat/netbsd32

2021-01-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jan 14 23:30:50 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c

Log Message:
Remove some blank lines to group the VND and FSS ioctls together.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.116 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.117
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.116	Thu Jan 14 08:22:51 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Thu Jan 14 23:30:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.117 2021/01/14 23:30:50 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -1522,22 +1522,17 @@ netbsd32_ioctl(struct lwp *l,
 
 	case FSSIOCSET32:	/* XXX FSSIOCSET50 not yet handled */
 		IOCTL_STRUCT_CONV_TO(FSSIOCSET, fss_set);
-
 	case FSSIOCGET32:	/* XXX FSSIOCGET50 not yet handled */
 		IOCTL_STRUCT_CONV_TO(FSSIOCGET, fss_get);
 
 	case VNDIOCSET32:
 		IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl);
-
 	case VNDIOCCLR32:
 		IOCTL_STRUCT_CONV_TO(VNDIOCCLR, vnd_ioctl);
-
 	case VNDIOCGET32:
 		IOCTL_STRUCT_CONV_TO(VNDIOCGET, vnd_user);
-
 	case VNDIOCSET5032:
 		IOCTL_STRUCT_CONV_TO(VNDIOCSET50, vnd_ioctl50);
-
 	case VNDIOCCLR5032:
 		IOCTL_STRUCT_CONV_TO(VNDIOCCLR50, vnd_ioctl50);
 



CVS commit: src

2021-01-14 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Jan 14 22:18:14 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
Added Files:
src/tests/usr.bin/xlint/lint1: msg_330.c msg_330.exp msg_331.c
msg_331.exp msg_332.c msg_332.exp msg_333.c msg_333.exp msg_334.c
msg_334.exp msg_335.c msg_335.exp msg_336.c msg_336.exp msg_337.c
msg_337.exp

Log Message:
lint: add tests for newly added messages for strict bool mode


To generate a diff of this commit:
cvs rdiff -u -r1.1010 -r1.1011 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.28 -r1.29 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/msg_330.c \
src/tests/usr.bin/xlint/lint1/msg_330.exp \
src/tests/usr.bin/xlint/lint1/msg_331.c \
src/tests/usr.bin/xlint/lint1/msg_331.exp \
src/tests/usr.bin/xlint/lint1/msg_332.c \
src/tests/usr.bin/xlint/lint1/msg_332.exp \
src/tests/usr.bin/xlint/lint1/msg_333.c \
src/tests/usr.bin/xlint/lint1/msg_333.exp \
src/tests/usr.bin/xlint/lint1/msg_334.c \
src/tests/usr.bin/xlint/lint1/msg_334.exp \
src/tests/usr.bin/xlint/lint1/msg_335.c \
src/tests/usr.bin/xlint/lint1/msg_335.exp \
src/tests/usr.bin/xlint/lint1/msg_336.c \
src/tests/usr.bin/xlint/lint1/msg_336.exp \
src/tests/usr.bin/xlint/lint1/msg_337.c \
src/tests/usr.bin/xlint/lint1/msg_337.exp
cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/t_integration.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.1010 src/distrib/sets/lists/tests/mi:1.1011
--- src/distrib/sets/lists/tests/mi:1.1010	Sun Jan 10 18:06:38 2021
+++ src/distrib/sets/lists/tests/mi	Thu Jan 14 22:18:13 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1010 2021/01/10 18:06:38 rillig Exp $
+# $NetBSD: mi,v 1.1011 2021/01/14 22:18:13 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -6481,6 +6481,22 @@
 ./usr/tests/usr.bin/xlint/lint1/msg_328.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_329.c			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/msg_329.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_330.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_330.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_331.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_331.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_332.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_332.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_333.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_333.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_334.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_334.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_335.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_335.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_336.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_336.exp			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_337.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/msg_337.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/t_integration			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztesttests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztest/Atffile			tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.28 src/tests/usr.bin/xlint/lint1/Makefile:1.29
--- src/tests/usr.bin/xlint/lint1/Makefile:1.28	Sun Jan 10 18:06:38 2021
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Jan 14 22:18:14 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.28 2021/01/10 18:06:38 rillig Exp $
+# $NetBSD: Makefile,v 1.29 2021/01/14 22:18:14 rillig Exp $
 
 NOMAN=		# defined
 
@@ -89,7 +89,7 @@ FILES+=		d_type_question_colon.c
 FILES+=		d_typefun.c
 FILES+=		d_typename_as_var.c
 FILES+=		d_zero_sized_arrays.c
-FILES+=		${:U0 ${:U:range=329}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@}
+FILES+=		${:U0 ${:U:range=337}:C,^.$,0&,:C,^..$,0&,:@msg@msg_${msg}.c msg_${msg}.exp@}
 
 # Note: only works for adding tests.
 # To remove a test, the $$mi file must be edited manually.

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.25 s

CVS commit: src/distrib/sets/lists/debug

2021-01-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jan 14 19:11:48 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Update sets lists to accomodate KERNEL_DIR.  When both KERNEL_DIR and
MKDEBUG are defined, we create an empty $DESTDIR/usr/libdata/debug/netbsd/
directory.

Should fix ``build.sh release'' issue reported in kern/55923

XXX Since nothing ever seems to populate this directory, perhaps we should
XXX simply prevent its creation?  If we do create it, should its creation
XXX perhaps be conditioned on MKKDEBUG rather than MKDEBUG?

XXX There is still another problem with ``build.sh install-image'' but I
XXX open a new PR for that.


To generate a diff of this commit:
cvs rdiff -u -r1.347 -r1.348 src/distrib/sets/lists/debug/mi

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.347 src/distrib/sets/lists/debug/mi:1.348
--- src/distrib/sets/lists/debug/mi:1.347	Thu Jan 14 19:07:03 2021
+++ src/distrib/sets/lists/debug/mi	Thu Jan 14 19:11:48 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.347 2021/01/14 19:07:03 pgoyette Exp $
+# $NetBSD: mi,v 1.348 2021/01/14 19:11:48 pgoyette Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile



CVS commit: src/distrib/sets/lists/debug

2021-01-14 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Jan 14 19:07:03 UTC 2021

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
/home/paul/XXX.txt


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.347 src/distrib/sets/lists/debug/mi

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.346 src/distrib/sets/lists/debug/mi:1.347
--- src/distrib/sets/lists/debug/mi:1.346	Sat Jan  2 03:41:06 2021
+++ src/distrib/sets/lists/debug/mi	Thu Jan 14 19:07:03 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.346 2021/01/02 03:41:06 nat Exp $
+# $NetBSD: mi,v 1.347 2021/01/14 19:07:03 pgoyette Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -320,6 +320,7 @@
 ./usr/libdata/debug/bin/tar.debug		comp-util-debug		debug,bsdtar
 ./usr/libdata/debug/bin/test.debug		comp-util-debug		debug
 ./usr/libdata/debug/libexec/lfs_cleanerd.debug	comp-sysutil-debug	debug
+./usr/libdata/debug/netbsd			comp-sysutil-debug	debug,kernel_dir
 ./usr/libdata/debug/sbin/amrctl.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/apmlabel.debug		comp-sysutil-debug	debug
 ./usr/libdata/debug/sbin/atactl.debug		comp-sysutil-debug	debug



CVS commit: src/sys/dev/acpi

2021-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 14 14:38:22 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_usb.c

Log Message:
Use acpi_dsm() in acpi_usb_post_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_usb.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/acpi/acpi_usb.c
diff -u src/sys/dev/acpi/acpi_usb.c:1.1 src/sys/dev/acpi/acpi_usb.c:1.2
--- src/sys/dev/acpi/acpi_usb.c:1.1	Fri Oct 26 23:33:38 2018
+++ src/sys/dev/acpi/acpi_usb.c	Thu Jan 14 14:38:22 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_usb.c,v 1.1 2018/10/26 23:33:38 jmcneill Exp $ */
+/* $NetBSD: acpi_usb.c,v 1.2 2021/01/14 14:38:22 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_usb.c,v 1.1 2018/10/26 23:33:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_usb.c,v 1.2 2021/01/14 14:38:22 thorpej Exp $");
 
 #include 
 
@@ -53,9 +53,6 @@ static UINT8 ehci_acpi_dsm_uuid[ACPI_UUI
 void
 acpi_usb_post_reset(ACPI_HANDLE handle)
 {
-	ACPI_OBJECT_LIST objs;
-	ACPI_OBJECT obj[4];
-	ACPI_HANDLE method;
 
 	/*
 	 * Invoke the _DSM control method for post-reset processing function
@@ -64,21 +61,5 @@ acpi_usb_post_reset(ACPI_HANDLE handle)
 	 * device into host mode.
 	 */
 
-	objs.Count = 4;
-	objs.Pointer = obj;
-	obj[0].Type = ACPI_TYPE_BUFFER;
-	obj[0].Buffer.Length = ACPI_UUID_LENGTH;
-	obj[0].Buffer.Pointer = ehci_acpi_dsm_uuid;
-	obj[1].Type = ACPI_TYPE_INTEGER;
-	obj[1].Integer.Value = 0;	/* Revision ID = 0 */
-	obj[2].Type = ACPI_TYPE_INTEGER;
-	obj[2].Integer.Value = 1;	/* Function index = 1 */
-	obj[3].Type = ACPI_TYPE_PACKAGE;
-	obj[3].Package.Count = 0;	/* Empty package (not used) */
-	obj[3].Package.Elements = NULL;
-
-	if (ACPI_FAILURE(AcpiGetHandle(handle, "_DSM", &method)))
-		return;
-
-	(void)AcpiEvaluateObject(method, NULL, &objs, NULL);
+	(void)acpi_dsm(handle, ehci_acpi_dsm_uuid, 0, 1, NULL, NULL);
 }



CVS commit: src/sys/dev/acpi

2021-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 14 14:37:17 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_pci.c

Log Message:
In acpi_pci_ignore_boot_config(), use acpi_dsm() and add some comments
describing the (somewhat confusing) semantics of the _DSM method used
here.


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

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

Modified files:

Index: src/sys/dev/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.29 src/sys/dev/acpi/acpi_pci.c:1.30
--- src/sys/dev/acpi/acpi_pci.c:1.29	Fri May  8 14:42:38 2020
+++ src/sys/dev/acpi/acpi_pci.c	Thu Jan 14 14:37:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.29 2020/05/08 14:42:38 jmcneill Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.30 2021/01/14 14:37:17 thorpej Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.29 2020/05/08 14:42:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.30 2021/01/14 14:37:17 thorpej Exp $");
 
 #include 
 #include 
@@ -495,44 +495,50 @@ acpi_pcidev_find_dev(struct acpi_devnode
 ACPI_INTEGER
 acpi_pci_ignore_boot_config(ACPI_HANDLE handle)
 {
-	ACPI_OBJECT_LIST objs;
-	ACPI_OBJECT obj[4], *pobj;
-	ACPI_BUFFER buf;
+	ACPI_OBJECT *pobj = NULL;
 	ACPI_INTEGER ret;
 
-	objs.Count = 4;
-	objs.Pointer = obj;
-	obj[0].Type = ACPI_TYPE_BUFFER;
-	obj[0].Buffer.Length = ACPI_UUID_LENGTH;
-	obj[0].Buffer.Pointer = acpi_pci_dsm_uuid;
-	obj[1].Type = ACPI_TYPE_INTEGER;
-	obj[1].Integer.Value = 1;
-	obj[2].Type = ACPI_TYPE_INTEGER;
-	obj[2].Integer.Value = 5;
-	obj[3].Type = ACPI_TYPE_PACKAGE;
-	obj[3].Package.Count = 0;
-	obj[3].Package.Elements = NULL;
-
-	buf.Pointer = NULL;
-	buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+	/*
+	 * This one is a little confusing, but the result of
+	 * evaluating _DSM #5 is:
+	 *
+	 * 0: The operating system may not ignore the boot configuration
+	 *of PCI resources.
+	 *
+	 * 1: The operating system may ignore the boot configuration of
+	 *PCI resources, and reconfigure or rebalance these resources
+	 *in the hierarchy as required.
+	 */
 
-	if (ACPI_FAILURE(AcpiEvaluateObject(handle, "_DSM", &objs, &buf)) || buf.Pointer == NULL)
+	if (ACPI_FAILURE(acpi_dsm(handle, acpi_pci_dsm_uuid,
+  1, 5, NULL, &pobj))) {
+		/*
+		 * In the absence of _DSM #5, we may assume that the
+		 * boot config can be ignored.
+		 */
 		return 1;
+	}
 
+	/*
+	 * ...and we default to "may ignore" in the event that the
+	 * method returns nonsense.
+	 */
 	ret = 1;
 
-	pobj = buf.Pointer;
-	switch (pobj->Type) {
-	case ACPI_TYPE_INTEGER:
-		ret = pobj->Integer.Value;
-		break;
-	case ACPI_TYPE_PACKAGE:
-		if (pobj->Package.Count == 1 && pobj->Package.Elements[0].Type == ACPI_TYPE_INTEGER)
-			ret = pobj->Package.Elements[0].Integer.Value;
-		break;
-	}
+	if (pobj != NULL) {
+		switch (pobj->Type) {
+		case ACPI_TYPE_INTEGER:
+			ret = pobj->Integer.Value;
+			break;
 
-	ACPI_FREE(buf.Pointer);
+		case ACPI_TYPE_PACKAGE:
+			if (pobj->Package.Count == 1 &&
+			pobj->Package.Elements[0].Type == ACPI_TYPE_INTEGER)
+ret = pobj->Package.Elements[0].Integer.Value;
+			break;
+		}
+		ACPI_FREE(pobj);
+	}
 
 	return ret;
 }



CVS commit: src/sys/dev/acpi

2021-01-14 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Jan 14 14:35:53 UTC 2021

Modified Files:
src/sys/dev/acpi: acpi_util.c acpi_util.h

Log Message:
- Add a new routine, acpi_pack_compat_list(), that packs the _HID
  and _CID device ID strings into an OpenFirmware-like string list,
  analogous to how the "compatible" property is represented in
  OpenFirmware and the Device Tree specifications.
- Add generic routines for evaluating Device Specific Methods (_DSM).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/acpi_util.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/acpi/acpi_util.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/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.19 src/sys/dev/acpi/acpi_util.c:1.20
--- src/sys/dev/acpi/acpi_util.c:1.19	Fri Oct 23 10:59:37 2020
+++ src/sys/dev/acpi/acpi_util.c	Thu Jan 14 14:35:53 2021
@@ -1,7 +1,7 @@
-/*	$NetBSD: acpi_util.c,v 1.19 2020/10/23 10:59:37 jmcneill Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.20 2021/01/14 14:35:53 thorpej Exp $ */
 
 /*-
- * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
+ * Copyright (c) 2003, 2007, 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.19 2020/10/23 10:59:37 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.20 2021/01/14 14:35:53 thorpej Exp $");
 
 #include 
 #include 
@@ -306,6 +306,59 @@ acpi_name(ACPI_HANDLE handle)
 }
 
 /*
+ * Pack _HID and _CID ID strings into an OpenFirmware-like
+ * string list.
+ */
+char *
+acpi_pack_compat_list(ACPI_DEVICE_INFO *ad, size_t *sizep)
+{
+	KASSERT(sizep != NULL);
+
+	char *strlist, *cp;
+	size_t len = 0;
+	uint32_t i;
+
+	/*
+	 * First calculate the total size required.
+	 * N.B. PNP Device ID length includes terminating NUL.
+	 */
+	if ((ad->Valid & ACPI_VALID_HID) != 0) {
+		len += ad->HardwareId.Length;
+	}
+
+	if ((ad->Valid & ACPI_VALID_CID) != 0) {
+		for (i = 0; i < ad->CompatibleIdList.Count; i++) {
+			len += ad->CompatibleIdList.Ids[i].Length;
+		}
+	}
+
+	*sizep = len;
+	if (len == 0) {
+		return NULL;
+	}
+
+	cp = strlist = kmem_alloc(len, KM_SLEEP);
+
+	if ((ad->Valid & ACPI_VALID_HID) != 0) {
+		memcpy(cp, ad->HardwareId.String, ad->HardwareId.Length);
+		cp += ad->HardwareId.Length;
+	}
+
+	if ((ad->Valid & ACPI_VALID_CID) != 0) {
+		for (i = 0; i < ad->CompatibleIdList.Count; i++) {
+			memcpy(cp, ad->CompatibleIdList.Ids[i].String,
+			ad->CompatibleIdList.Ids[i].Length);
+			cp += ad->CompatibleIdList.Ids[i].Length;
+		}
+	}
+
+	KASSERT((size_t)(cp - strlist) == len);
+
+	return strlist;
+}
+
+
+/*
  * Match given IDs against _HID and _CIDs.
  */
 int
@@ -636,7 +689,7 @@ acpi_intr_string(void *c, char *buf, siz
 }
 
 /*
- * USB Device-Specific Data (_DSD) support
+ * Device-Specific Data (_DSD) support
  */
 
 static UINT8 acpi_dsd_uuid[ACPI_UUID_LENGTH] = {
@@ -728,3 +781,86 @@ acpi_dsd_string(ACPI_HANDLE handle, cons
 		ACPI_FREE(buf.Pointer);
 	return rv;
 }
+
+/*
+ * Device Specific Method (_DSM) support
+ */
+
+ACPI_STATUS
+acpi_dsm_typed(ACPI_HANDLE handle, uint8_t *uuid, ACPI_INTEGER rev,
+ACPI_INTEGER func, const ACPI_OBJECT *arg3, ACPI_OBJECT_TYPE return_type,
+ACPI_OBJECT **return_obj)
+{
+	ACPI_OBJECT_LIST arg;
+	ACPI_OBJECT obj[4];
+	ACPI_BUFFER buf;
+	ACPI_STATUS status;
+
+	arg.Count = 4;
+	arg.Pointer = obj;
+
+	obj[0].Type = ACPI_TYPE_BUFFER;
+	obj[0].Buffer.Length = ACPI_UUID_LENGTH;
+	obj[0].Buffer.Pointer = uuid;
+
+	obj[1].Type = ACPI_TYPE_INTEGER;
+	obj[1].Integer.Value = rev;
+
+	obj[2].Type = ACPI_TYPE_INTEGER;
+	obj[2].Integer.Value = func;
+
+	if (arg3 != NULL) {
+		obj[3] = *arg3;
+	} else {
+		obj[3].Type = ACPI_TYPE_PACKAGE;
+		obj[3].Package.Count = 0;
+		obj[3].Package.Elements = NULL;
+	}
+
+	buf.Pointer = NULL;
+	buf.Length = ACPI_ALLOCATE_BUFFER;
+
+	if (return_obj == NULL && return_type == ACPI_TYPE_ANY) {
+		status = AcpiEvaluateObject(handle, "_DSM", &arg, NULL);
+	} else {
+		*return_obj = NULL;
+		status = AcpiEvaluateObjectTyped(handle, "_DSM", &arg, &buf,
+		return_type);
+	}
+	if (ACPI_FAILURE(status)) {
+		return status;
+	}
+	if (return_obj != NULL) {
+		*return_obj = buf.Pointer;
+	} else if (buf.Pointer != NULL) {
+		ACPI_FREE(buf.Pointer);
+	}
+	return AE_OK;
+}
+
+ACPI_STATUS
+acpi_dsm_integer(ACPI_HANDLE handle, uint8_t *uuid, ACPI_INTEGER rev,
+ACPI_INTEGER func, const ACPI_OBJECT *arg3, ACPI_INTEGER *ret)
+{
+	ACPI_OBJECT *obj;
+	ACPI_STATUS status;
+
+	status = acpi_dsm_typed(handle, uuid, rev, func, arg3,
+	ACPI_TYPE_INTEGER, &obj);
+	if (ACPI_FAILURE(status)) {
+		return status;
+	}
+
+	*ret = obj->Integer.Value;
+	ACPI_FREE(obj);
+
+	return AE_OK;
+}
+
+ACPI_STATUS
+acpi_dsm(ACPI_HANDLE handle, uint8_t *uuid, ACPI_INTEGER rev,
+ACPI_INTEGER func, c

CVS commit: src/sys/compat/netbsd32

2021-01-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jan 14 08:22:51 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Handle the KFILTER_BYFILTER and KFILTER_BYNAME ioctls for compat32.
Passes "atf kernel/kqueue/t_ioctl".


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.75 -r1.76 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.115 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.116
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.115	Thu Jan 14 08:00:45 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Thu Jan 14 08:22:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.116 2021/01/14 08:22:51 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -244,6 +244,16 @@ netbsd32_to_sioc_sg_req(struct netbsd32_
 }
 
 static inline void
+netbsd32_to_kfilter_mapping(struct netbsd32_kfilter_mapping *s32p,
+struct kfilter_mapping *p, u_long cmd)
+{
+
+	p->name = (char *)NETBSD32PTR64(s32p->name);
+	p->len = s32p->len;
+	p->filter = s32p->filter;
+}
+
+static inline void
 netbsd32_to_atareq(struct netbsd32_atareq *s32p, struct atareq *p, u_long cmd)
 {
 
@@ -755,6 +765,16 @@ netbsd32_from_sioc_sg_req(struct sioc_sg
 }
 
 static inline void
+netbsd32_from_kfilter_mapping(struct kfilter_mapping *p,
+struct netbsd32_kfilter_mapping *s32p, u_long cmd)
+{
+
+	NETBSD32PTR32(s32p->name, p->name);
+	s32p->len = p->len;
+	s32p->filter = p->filter;
+}
+
+static inline void
 netbsd32_from_atareq(struct atareq *p,
 struct netbsd32_atareq *s32p, u_long cmd)
 {
@@ -1369,6 +1389,11 @@ netbsd32_ioctl(struct lwp *l,
 		IOCTL_STRUCT_CONV_TO(DIOCWFORMAT, format_op);
 #endif
 
+	case KFILTER_BYFILTER32:
+		IOCTL_STRUCT_CONV_TO(KFILTER_BYFILTER, kfilter_mapping);
+	case KFILTER_BYNAME32:
+		IOCTL_STRUCT_CONV_TO(KFILTER_BYNAME, kfilter_mapping);
+
 	case ATAIOCCOMMAND32:
 		IOCTL_STRUCT_CONV_TO(ATAIOCCOMMAND, atareq);
 

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.75 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.76
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.75	Thu Jan 14 08:00:45 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Thu Jan 14 08:22:51 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.75 2021/01/14 08:00:45 simonb Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.76 2021/01/14 08:22:51 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -89,6 +89,19 @@ struct netbsd32_format_op {
 #define DIOCWFORMAT32	_IOWR('d', 106, struct netbsd32_format_op)
 #endif
 
+/* from  */
+
+struct netbsd32_kfilter_mapping {
+	netbsd32_charp	name;		/* name to lookup or return */
+	netbsd32_size_t	len;		/* length of name */
+	uint32_t	filter;		/* filter to lookup or return */
+};
+
+/* map filter to name (max size len) */
+#define KFILTER_BYFILTER32	_IOWR('k', 0, struct netbsd32_kfilter_mapping)
+/* map name to filter (len ignored) */
+#define KFILTER_BYNAME32	_IOWR('k', 1, struct netbsd32_kfilter_mapping)
+
 /* from  */
 struct netbsd32_atareq {
 	netbsd32_u_long		flags;



CVS commit: src/sys/compat/netbsd32

2021-01-14 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Jan 14 08:00:45 UTC 2021

Modified Files:
src/sys/compat/netbsd32: netbsd32.h netbsd32_ioctl.c netbsd32_ioctl.h

Log Message:
Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -u -r1.114 -r1.115 src/sys/compat/netbsd32/netbsd32_ioctl.c
cvs rdiff -u -r1.74 -r1.75 src/sys/compat/netbsd32/netbsd32_ioctl.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/compat/netbsd32/netbsd32.h
diff -u src/sys/compat/netbsd32/netbsd32.h:1.134 src/sys/compat/netbsd32/netbsd32.h:1.135
--- src/sys/compat/netbsd32/netbsd32.h:1.134	Sun Nov  1 18:51:02 2020
+++ src/sys/compat/netbsd32/netbsd32.h	Thu Jan 14 08:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32.h,v 1.134 2020/11/01 18:51:02 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32.h,v 1.135 2021/01/14 08:00:45 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2015 Matthew R. Green
@@ -203,6 +203,7 @@ typedef netbsd32_pointer_t netbsd32_semi
 typedef netbsd32_uint64 netbsd32_dev_t;
 typedef netbsd32_int64 netbsd32_off_t;
 typedef netbsd32_uint64 netbsd32_ino_t;
+typedef netbsd32_int64 netbsd32_blkcnt_t;
 
 /* from  */
 typedef netbsd32_pointer_t netbsd32_posix_spawn_file_actionsp;

Index: src/sys/compat/netbsd32/netbsd32_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.114 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.115
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.114	Tue Jul 21 05:33:51 2020
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Thu Jan 14 08:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.114 2020/07/21 05:33:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.115 2021/01/14 08:00:45 simonb Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -93,6 +93,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_ioc
 #include 
 #include 
 
+#include 
 #include 
 
 /* convert to/from different structures */
@@ -261,6 +262,30 @@ netbsd32_to_atareq(struct netbsd32_atare
 }
 
 static inline void
+netbsd32_to_fss_set(struct netbsd32_fss_set *s32p, struct fss_set *p,
+u_long cmd)
+{
+
+	p->fss_mount = (char *)NETBSD32PTR64(s32p->fss_mount);
+	p->fss_bstore = (char *)NETBSD32PTR64(s32p->fss_bstore);
+	p->fss_csize = s32p->fss_csize;
+	p->fss_flags = s32p->fss_flags;
+}
+
+static inline void
+netbsd32_to_fss_get(struct netbsd32_fss_get *s32p, struct fss_get *p,
+u_long cmd)
+{
+
+	memcpy(p->fsg_mount, s32p->fsg_mount, MNAMELEN);
+	netbsd32_to_timeval(&s32p->fsg_time, &p->fsg_time);
+	p->fsg_csize = s32p->fsg_csize;
+	p->fsg_mount_size = s32p->fsg_mount_size;
+	p->fsg_bs_size = s32p->fsg_bs_size;
+
+}
+
+static inline void
 netbsd32_to_vnd_ioctl(struct netbsd32_vnd_ioctl *s32p,
 struct vnd_ioctl *p, u_long cmd)
 {
@@ -749,6 +774,30 @@ netbsd32_from_atareq(struct atareq *p,
 }
 
 static inline void
+netbsd32_from_fss_set(struct fss_set *p, struct netbsd32_fss_set *s32p,
+u_long cmd)
+{
+
+	NETBSD32PTR32(s32p->fss_mount, p->fss_mount);
+	NETBSD32PTR32(s32p->fss_bstore, p->fss_bstore);
+	s32p->fss_csize = p->fss_csize;
+	s32p->fss_flags = p->fss_flags;
+}
+
+static inline void
+netbsd32_from_fss_get(struct fss_get *p, struct netbsd32_fss_get *s32p,
+u_long cmd)
+{
+
+	memcpy(s32p->fsg_mount, p->fsg_mount, MNAMELEN);
+	netbsd32_from_timeval(&p->fsg_time, &s32p->fsg_time);
+	s32p->fsg_csize = p->fsg_csize;
+	s32p->fsg_mount_size = p->fsg_mount_size;
+	s32p->fsg_bs_size = p->fsg_bs_size;
+
+}
+
+static inline void
 netbsd32_from_vnd_ioctl(struct vnd_ioctl *p,
 struct netbsd32_vnd_ioctl *s32p, u_long cmd)
 {
@@ -1446,6 +1495,12 @@ netbsd32_ioctl(struct lwp *l,
 	case SIOCGETSGCNT32:
 		IOCTL_STRUCT_CONV_TO(SIOCGETSGCNT, sioc_sg_req);
 
+	case FSSIOCSET32:	/* XXX FSSIOCSET50 not yet handled */
+		IOCTL_STRUCT_CONV_TO(FSSIOCSET, fss_set);
+
+	case FSSIOCGET32:	/* XXX FSSIOCGET50 not yet handled */
+		IOCTL_STRUCT_CONV_TO(FSSIOCGET, fss_get);
+
 	case VNDIOCSET32:
 		IOCTL_STRUCT_CONV_TO(VNDIOCSET, vnd_ioctl);
 

Index: src/sys/compat/netbsd32/netbsd32_ioctl.h
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.h:1.74 src/sys/compat/netbsd32/netbsd32_ioctl.h:1.75
--- src/sys/compat/netbsd32/netbsd32_ioctl.h:1.74	Thu Jan 14 02:43:04 2021
+++ src/sys/compat/netbsd32/netbsd32_ioctl.h	Thu Jan 14 08:00:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.h,v 1.74 2021/01/14 02:43:04 simonb Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.h,v 1.75 2021/01/14 08:00:45 simonb Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -477,6 +477,26 @@ struct n