CVS commit: src/sys/dev/audio

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Feb 23 07:17:01 UTC 2020

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

Log Message:
Prevent a race between audiodetach and fileops methods using psref(9).
Fix PR kern/54427.
Thank you so much riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/audio/audiodef.h
cvs rdiff -u -r1.7 -r1.8 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/audio.c
diff -u src/sys/dev/audio/audio.c:1.55 src/sys/dev/audio/audio.c:1.56
--- src/sys/dev/audio/audio.c:1.55	Sun Feb 23 04:24:56 2020
+++ src/sys/dev/audio/audio.c	Sun Feb 23 07:17:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.55 2020/02/23 04:24:56 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.56 2020/02/23 07:17:01 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.55 2020/02/23 04:24:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.56 2020/02/23 07:17:01 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -499,6 +499,8 @@ static void audio_softintr_wr(void *);
 
 static int  audio_enter_exclusive(struct audio_softc *);
 static void audio_exit_exclusive(struct audio_softc *);
+static struct audio_softc *audio_file_enter(audio_file_t *, struct psref *);
+static void audio_file_exit(struct audio_softc *, struct psref *);
 static int audio_track_waitio(struct audio_softc *, audio_track_t *);
 
 static int audioclose(struct file *);
@@ -519,6 +521,7 @@ static int  filt_audioread_event(struct 
 static int audio_open(dev_t, struct audio_softc *, int, int, struct lwp *,
 	audio_file_t **);
 static int audio_close(struct audio_softc *, audio_file_t *);
+static int audio_unlink(struct audio_softc *, audio_file_t *);
 static int audio_read(struct audio_softc *, struct uio *, int, audio_file_t *);
 static int audio_write(struct audio_softc *, struct uio *, int, audio_file_t *);
 static void audio_file_clear(struct audio_softc *, audio_file_t *);
@@ -530,7 +533,6 @@ static int audio_mmap(struct audio_softc
 	struct uvm_object **, int *, audio_file_t *);
 
 static int audioctl_open(dev_t, struct audio_softc *, int, int, struct lwp *);
-static int audioctl_close(struct audio_softc *, audio_file_t *);
 
 static void audio_pintr(void *);
 static void audio_rintr(void *);
@@ -810,6 +812,8 @@ static const struct portname otable[] = 
 	{ 0, 0 }
 };
 
+static struct psref_class *audio_psref_class __read_mostly;
+
 CFATTACH_DECL3_NEW(audio, sizeof(struct audio_softc),
 audiomatch, audioattach, audiodetach, audioactivate, audiorescan,
 audiochilddet, DVF_DETACH_SHUTDOWN);
@@ -998,6 +1002,9 @@ audioattach(device_t parent, device_t se
 		goto bad;
 	}
 
+	sc->sc_psz = pserialize_create();
+	psref_target_init(>sc_psref, audio_psref_class);
+
 	selinit(>sc_wsel);
 	selinit(>sc_rsel);
 
@@ -1255,7 +1262,7 @@ static int
 audiodetach(device_t self, int flags)
 {
 	struct audio_softc *sc;
-	int maj, mn;
+	struct audio_file *file;
 	int error;
 
 	sc = device_private(self);
@@ -1270,6 +1277,9 @@ audiodetach(device_t self, int flags)
 	if (error)
 		return error;
 
+	/* delete sysctl nodes */
+	sysctl_teardown(>sc_log);
+
 	mutex_enter(sc->sc_lock);
 	sc->sc_dying = true;
 	cv_broadcast(>sc_exlockcv);
@@ -1277,23 +1287,36 @@ audiodetach(device_t self, int flags)
 		cv_broadcast(>sc_pmixer->outcv);
 	if (sc->sc_rmixer)
 		cv_broadcast(>sc_rmixer->outcv);
-	mutex_exit(sc->sc_lock);
 
-	/* delete sysctl nodes */
-	sysctl_teardown(>sc_log);
+	/* Prevent new users */
+	SLIST_FOREACH(file, >sc_files, entry) {
+		atomic_store_relaxed(>dying, true);
+	}
+
+	/*
+	 * Wait for existing users to drain.
+	 * - pserialize_perform waits for all pserialize_read sections on
+	 *   all CPUs; after this, no more new psref_acquire can happen.
+	 * - psref_target_destroy waits for all extant acquired psrefs to
+	 *   be psref_released.
+	 */
+	pserialize_perform(sc->sc_psz);
+	mutex_exit(sc->sc_lock);
+	psref_target_destroy(>sc_psref, audio_psref_class);
 
-	/* locate the major number */
-	maj = cdevsw_lookup_major(_cdevsw);
+	/*
+	 * We are now guaranteed that there are no calls to audio fileops
+	 * that hold sc, and any new calls with files that were for sc will
+	 * fail.  Thus, we now have exclusive access to the softc.
+	 */
 
 	/*
-	 * Nuke the vnodes for any open instances (calls close).
-	 * Will wait until any activity on the device nodes has ceased.
+	 * Nuke all open instances.
+	 * Here, we no longer need any locks to traverse sc_files.
 	 */
-	mn = device_unit(self);
-	vdevgone(maj, mn | SOUND_DEVICE,mn | SOUND_DEVICE, VCHR);
-	vdevgone(maj, mn | AUDIO_DEVICE,mn | AUDIO_DEVICE, VCHR);
-	vdevgone(maj, mn | AUDIOCTL_DEVICE, mn | AUDIOCTL_DEVICE, VCHR);
-	vdevgone(maj, mn | 

CVS commit: xsrc/external/mit

2020-02-22 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Feb 23 06:33:20 UTC 2020

Modified Files:
xsrc/external/mit/xf86-video-amdgpu/include: config.h
xsrc/external/mit/xf86-video-ati-kms/dist/src: radeon_kms.c
xsrc/external/mit/xf86-video-ati-kms/include: config.h
xsrc/external/mit/xf86-video-geode/dist/src: gx_driver.c
xsrc/external/mit/xf86-video-s3/dist: compile
xsrc/external/mit/xf86-video-s3/dist/src: s3.h s3_bios.c s3_driver.c
Removed Files:
xsrc/external/mit/xf86-video-s3/dist: README

Log Message:
merge xf86-video-ati 19.1.0, xf86-video-amdgpu 19.1.0,
xf86-video-geode 2.11.20, and xf86-video-s3 0.7.0.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-amdgpu/include/config.h
cvs rdiff -u -r1.8 -r1.9 \
xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c
cvs rdiff -u -r1.10 -r1.11 \
xsrc/external/mit/xf86-video-ati-kms/include/config.h
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/xf86-video-geode/dist/src/gx_driver.c
cvs rdiff -u -r1.1.1.1 -r0 xsrc/external/mit/xf86-video-s3/dist/README
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xf86-video-s3/dist/compile
cvs rdiff -u -r1.7 -r1.8 xsrc/external/mit/xf86-video-s3/dist/src/s3.h
cvs rdiff -u -r1.3 -r1.4 xsrc/external/mit/xf86-video-s3/dist/src/s3_bios.c
cvs rdiff -u -r1.5 -r1.6 xsrc/external/mit/xf86-video-s3/dist/src/s3_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-amdgpu/include/config.h
diff -u xsrc/external/mit/xf86-video-amdgpu/include/config.h:1.9 xsrc/external/mit/xf86-video-amdgpu/include/config.h:1.10
--- xsrc/external/mit/xf86-video-amdgpu/include/config.h:1.9	Sat Jun  1 06:39:38 2019
+++ xsrc/external/mit/xf86-video-amdgpu/include/config.h	Sun Feb 23 06:33:19 2020
@@ -88,7 +88,7 @@
 #define PACKAGE_NAME "xf86-video-amdgpu"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "xf86-video-amdgpu 19.0.1"
+#define PACKAGE_STRING "xf86-video-amdgpu 19.1.0"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "xf86-video-amdgpu"
@@ -97,16 +97,16 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "19.0.1"
+#define PACKAGE_VERSION "19.1.0"
 
 /* Major version of this package */
 #define PACKAGE_VERSION_MAJOR 19
 
 /* Minor version of this package */
-#define PACKAGE_VERSION_MINOR 0
+#define PACKAGE_VERSION_MINOR 1
 
 /* Patch version of this package */
-#define PACKAGE_VERSION_PATCHLEVEL 1
+#define PACKAGE_VERSION_PATCHLEVEL 0
 
 /* Define to 1 if you have the ANSI C header files. */
 #define STDC_HEADERS 1
@@ -118,7 +118,7 @@
 #define USE_SYS_ENDIAN_H 1
 
 /* Version number of package */
-#define VERSION "19.0.1"
+#define VERSION "19.1.0"
 
 /* Enable large inode numbers on Mac OS X 10.5.  */
 #ifndef _DARWIN_USE_64_BIT_INODE

Index: xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c
diff -u xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c:1.8 xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c:1.9
--- xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c:1.8	Sat Jun  1 07:25:41 2019
+++ xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_kms.c	Sun Feb 23 06:33:19 2020
@@ -1917,19 +1917,15 @@ Bool RADEONPreInit_KMS(ScrnInfoPtr pScrn
 
 if (!pScrn->is_gpu) {
 	if (info->dri2.pKernelDRMVersion->version_minor >= 8) {
-	Bool sw_cursor = xf86ReturnOptValBool(info->Options,
-		  OPTION_SW_CURSOR, FALSE);
-
 	info->allowPageFlip = xf86ReturnOptValBool(info->Options,
 		   OPTION_PAGE_FLIP, TRUE);
 
-	if (sw_cursor || info->shadow_primary) {
+	if (info->shadow_primary) {
 		xf86DrvMsg(pScrn->scrnIndex,
 			   info->allowPageFlip ? X_WARNING : X_DEFAULT,
 			   "KMS Pageflipping: disabled%s\n",
 			   info->allowPageFlip ?
-			   (sw_cursor ? " because of SWcursor" :
-			" because of ShadowPrimary") : "");
+			   " because of ShadowPrimary" : "");
 		info->allowPageFlip = FALSE;
 	} else {
 		xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -2606,16 +2602,25 @@ CARD32 cleanup_black_fb(OsTimerPtr timer
 }
 
 static void
-pixmap_unref_fb(void *value, XID id, void *cdata)
+pixmap_unref_fb(PixmapPtr pixmap)
 {
-PixmapPtr pixmap = value;
-RADEONEntPtr pRADEONEnt = cdata;
+ScrnInfoPtr scrn = xf86ScreenToScrn(pixmap->drawable.pScreen);
 struct drmmode_fb **fb_ptr = radeon_pixmap_get_fb_ptr(pixmap);
+RADEONEntPtr pRADEONEnt = RADEONEntPriv(scrn);
 
 if (fb_ptr)
 	drmmode_fb_reference(pRADEONEnt->fd, fb_ptr, NULL);
 }
 
+static void
+client_pixmap_unref_fb(void *value, XID id, void *pScreen)
+{
+PixmapPtr pixmap = value;
+
+if (pixmap->drawable.pScreen == pScreen)
+	pixmap_unref_fb(pixmap);
+}
+
 void RADEONLeaveVT_KMS(ScrnInfoPtr pScrn)
 {
 RADEONInfoPtr  info  = RADEONPTR(pScrn);
@@ -2633,6 +2638,12 @@ 

CVS import: xsrc/external/mit/xf86-video-s3/dist

2020-02-22 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Feb 23 06:17:17 UTC 2020

Update of /cvsroot/xsrc/external/mit/xf86-video-s3/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv6757

Log Message:
initial import of xf86-video-s3-0.7.0

Status:

Vendor Tag: xorg
Release Tags:   xf86-video-s3-0-7-0

C xsrc/external/mit/xf86-video-s3/dist/aclocal.m4
C xsrc/external/mit/xf86-video-s3/dist/config.h.in
C xsrc/external/mit/xf86-video-s3/dist/missing
C xsrc/external/mit/xf86-video-s3/dist/config.sub
C xsrc/external/mit/xf86-video-s3/dist/Makefile.in
U xsrc/external/mit/xf86-video-s3/dist/INSTALL
U xsrc/external/mit/xf86-video-s3/dist/Makefile.am
C xsrc/external/mit/xf86-video-s3/dist/ltmain.sh
C xsrc/external/mit/xf86-video-s3/dist/depcomp
C xsrc/external/mit/xf86-video-s3/dist/compile
U xsrc/external/mit/xf86-video-s3/dist/ChangeLog
U xsrc/external/mit/xf86-video-s3/dist/configure.ac
C xsrc/external/mit/xf86-video-s3/dist/configure
C xsrc/external/mit/xf86-video-s3/dist/install-sh
N xsrc/external/mit/xf86-video-s3/dist/README.md
U xsrc/external/mit/xf86-video-s3/dist/COPYING
C xsrc/external/mit/xf86-video-s3/dist/config.guess
U xsrc/external/mit/xf86-video-s3/dist/src/s3_Trio64DAC.c
U xsrc/external/mit/xf86-video-s3/dist/src/compat-api.h
C xsrc/external/mit/xf86-video-s3/dist/src/Makefile.in
U xsrc/external/mit/xf86-video-s3/dist/src/s3_dga.c
U xsrc/external/mit/xf86-video-s3/dist/src/newmmio.h
C xsrc/external/mit/xf86-video-s3/dist/src/s3_driver.c
U xsrc/external/mit/xf86-video-s3/dist/src/Makefile.am
C xsrc/external/mit/xf86-video-s3/dist/src/s3_bios.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_cursor.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_accel.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_shadow.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_video.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_IBMRGB.c
U xsrc/external/mit/xf86-video-s3/dist/src/s3_reg.h
U xsrc/external/mit/xf86-video-s3/dist/src/s3_pcirename.h
U xsrc/external/mit/xf86-video-s3/dist/src/s3_Ti.c
C xsrc/external/mit/xf86-video-s3/dist/src/s3.h
U xsrc/external/mit/xf86-video-s3/dist/man/Makefile.in
U xsrc/external/mit/xf86-video-s3/dist/man/Makefile.am
U xsrc/external/mit/xf86-video-s3/dist/man/s3.man

15 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jxorg:yesterday -jxorg 
xsrc/external/mit/xf86-video-s3/dist



CVS import: xsrc/external/mit/xf86-video-ati-kms/dist

2020-02-22 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Feb 23 06:17:10 UTC 2020

Update of /cvsroot/xsrc/external/mit/xf86-video-ati-kms/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv2729

Log Message:
initial import of xf86-video-ati-19.1.0

Status:

Vendor Tag: xorg
Release Tags:   xf86-video-ati-19-1-0

U xsrc/external/mit/xf86-video-ati-kms/dist/ChangeLog
U xsrc/external/mit/xf86-video-ati-kms/dist/missing
U xsrc/external/mit/xf86-video-ati-kms/dist/COPYING
U xsrc/external/mit/xf86-video-ati-kms/dist/README.md
U xsrc/external/mit/xf86-video-ati-kms/dist/ltmain.sh
U xsrc/external/mit/xf86-video-ati-kms/dist/Makefile.in
U xsrc/external/mit/xf86-video-ati-kms/dist/install-sh
U xsrc/external/mit/xf86-video-ati-kms/dist/configure.ac
U xsrc/external/mit/xf86-video-ati-kms/dist/config.h.in
U xsrc/external/mit/xf86-video-ati-kms/dist/config.sub
U xsrc/external/mit/xf86-video-ati-kms/dist/compile
U xsrc/external/mit/xf86-video-ati-kms/dist/configure
U xsrc/external/mit/xf86-video-ati-kms/dist/config.guess
U xsrc/external/mit/xf86-video-ati-kms/dist/aclocal.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/depcomp
U xsrc/external/mit/xf86-video-ati-kms/dist/INSTALL
U xsrc/external/mit/xf86-video-ati-kms/dist/Makefile.am
U xsrc/external/mit/xf86-video-ati-kms/dist/conf/10-radeon.conf
U xsrc/external/mit/xf86-video-ati-kms/dist/conf/Makefile.in
U xsrc/external/mit/xf86-video-ati-kms/dist/conf/Makefile.am
U xsrc/external/mit/xf86-video-ati-kms/dist/m4/libtool.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/m4/ltversion.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/m4/ltsugar.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/m4/ltoptions.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/m4/lt~obsolete.m4
U xsrc/external/mit/xf86-video-ati-kms/dist/man/ati.man
U xsrc/external/mit/xf86-video-ati-kms/dist/man/Makefile.in
U xsrc/external/mit/xf86-video-ati-kms/dist/man/radeon.man
U xsrc/external/mit/xf86-video-ati-kms/dist/man/Makefile.am
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_bo_helper.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_shader.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_pci_chipset_gen.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_video.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/compat-api.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_dri2.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_exa.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/drmmode_display.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_shader.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/cayman_accel.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_exa_render.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_reg.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_state.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_reg_r6xx.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_accel.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_exa_shared.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_shader.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_sync.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_reg_r7xx.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/atipcirename.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_exa.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/atipciids.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_drm_queue.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_exa.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_textured_videofuncs.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_misc.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/ati_pciids_gen.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/cayman_shader.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_textured_videofuncs.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor_wrappers.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/ati.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_accel.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/Makefile.in
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_chipinfo_gen.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_pci_device_match_gen.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/simple_list.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_chipset_gen.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/bicubic_table.py
U xsrc/external/mit/xf86-video-ati-kms/dist/src/bicubic_table.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_glamor.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/ati.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/evergreen_reg_auto.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r600_reg.h
U xsrc/external/mit/xf86-video-ati-kms/dist/src/r6xx_accel.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/atimodule.c
U xsrc/external/mit/xf86-video-ati-kms/dist/src/radeon_dri3.c
U 

CVS import: xsrc/external/mit/xf86-video-amdgpu/dist

2020-02-22 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Feb 23 06:17:07 UTC 2020

Update of /cvsroot/xsrc/external/mit/xf86-video-amdgpu/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv16043

Log Message:
initial import of xf86-video-amdgpu-19.1.0

Status:

Vendor Tag: xorg
Release Tags:   xf86-video-amdgpu-19-1-0

U xsrc/external/mit/xf86-video-amdgpu/dist/ChangeLog
U xsrc/external/mit/xf86-video-amdgpu/dist/missing
U xsrc/external/mit/xf86-video-amdgpu/dist/COPYING
U xsrc/external/mit/xf86-video-amdgpu/dist/README.md
U xsrc/external/mit/xf86-video-amdgpu/dist/ltmain.sh
U xsrc/external/mit/xf86-video-amdgpu/dist/Makefile.in
U xsrc/external/mit/xf86-video-amdgpu/dist/install-sh
U xsrc/external/mit/xf86-video-amdgpu/dist/configure.ac
U xsrc/external/mit/xf86-video-amdgpu/dist/config.h.in
U xsrc/external/mit/xf86-video-amdgpu/dist/config.sub
U xsrc/external/mit/xf86-video-amdgpu/dist/compile
U xsrc/external/mit/xf86-video-amdgpu/dist/configure
U xsrc/external/mit/xf86-video-amdgpu/dist/config.guess
U xsrc/external/mit/xf86-video-amdgpu/dist/aclocal.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/depcomp
U xsrc/external/mit/xf86-video-amdgpu/dist/INSTALL
U xsrc/external/mit/xf86-video-amdgpu/dist/Makefile.am
U xsrc/external/mit/xf86-video-amdgpu/dist/conf/Makefile.in
U xsrc/external/mit/xf86-video-amdgpu/dist/conf/10-amdgpu.conf
U xsrc/external/mit/xf86-video-amdgpu/dist/conf/Makefile.am
U xsrc/external/mit/xf86-video-amdgpu/dist/m4/libtool.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/m4/ltversion.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/m4/ltsugar.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/m4/ltoptions.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/m4/lt~obsolete.m4
U xsrc/external/mit/xf86-video-amdgpu/dist/man/amdgpu.man
U xsrc/external/mit/xf86-video-amdgpu/dist/man/Makefile.in
U xsrc/external/mit/xf86-video-amdgpu/dist/man/Makefile.am
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_glamor.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_version.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/compat-api.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_video.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_kms.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_bo_helper.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_probe.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_glamor_wrappers.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_dri2.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_misc.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_video.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_probe.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_present.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/Makefile.in
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_bo_helper.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_dri3.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_drm_queue.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/simple_list.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_drv.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_pixmap.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_dri2.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_glamor.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_pixmap.h
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_sync.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/drmmode_display.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/amdgpu_drm_queue.c
U xsrc/external/mit/xf86-video-amdgpu/dist/src/Makefile.am

No conflicts created by this import



CVS import: xsrc/external/mit/xf86-video-geode/dist

2020-02-22 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Feb 23 06:17:13 UTC 2020

Update of /cvsroot/xsrc/external/mit/xf86-video-geode/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv23599

Log Message:
initial import of xf86-video-geode-2.11.20

Status:

Vendor Tag: xorg
Release Tags:   xf86-video-geode-2-11-20

U xsrc/external/mit/xf86-video-geode/dist/NEWS
U xsrc/external/mit/xf86-video-geode/dist/COPYING
U xsrc/external/mit/xf86-video-geode/dist/Makefile.in
U xsrc/external/mit/xf86-video-geode/dist/Makefile.am
U xsrc/external/mit/xf86-video-geode/dist/config.h.in
U xsrc/external/mit/xf86-video-geode/dist/README
U xsrc/external/mit/xf86-video-geode/dist/INSTALL
U xsrc/external/mit/xf86-video-geode/dist/configure.ac
U xsrc/external/mit/xf86-video-geode/dist/configure
U xsrc/external/mit/xf86-video-geode/dist/TODO
U xsrc/external/mit/xf86-video-geode/dist/autogen.sh
U xsrc/external/mit/xf86-video-geode/dist/ChangeLog
U xsrc/external/mit/xf86-video-geode/dist/aclocal.m4
U xsrc/external/mit/xf86-video-geode/dist/build-aux/config.guess
U xsrc/external/mit/xf86-video-geode/dist/build-aux/depcomp
U xsrc/external/mit/xf86-video-geode/dist/build-aux/compile
U xsrc/external/mit/xf86-video-geode/dist/build-aux/install-sh
U xsrc/external/mit/xf86-video-geode/dist/build-aux/missing
U xsrc/external/mit/xf86-video-geode/dist/build-aux/ltmain.sh
U xsrc/external/mit/xf86-video-geode/dist/build-aux/config.sub
U xsrc/external/mit/xf86-video-geode/dist/m4/ltoptions.m4
U xsrc/external/mit/xf86-video-geode/dist/m4/ltversion.m4
U xsrc/external/mit/xf86-video-geode/dist/m4/libtool.m4
U xsrc/external/mit/xf86-video-geode/dist/m4/ltsugar.m4
U xsrc/external/mit/xf86-video-geode/dist/m4/lt~obsolete.m4
U xsrc/external/mit/xf86-video-geode/dist/src/lx_cursor.c
U xsrc/external/mit/xf86-video-geode/dist/src/gx_accel.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_common.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_ddc.c
U xsrc/external/mit/xf86-video-geode/dist/src/cimarron.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_msr.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_vga.c
U xsrc/external/mit/xf86-video-geode/dist/src/compat-api.h
U xsrc/external/mit/xf86-video-geode/dist/src/lx_display.c
U xsrc/external/mit/xf86-video-geode/dist/src/z4l.c
U xsrc/external/mit/xf86-video-geode/dist/src/Makefile.in
U xsrc/external/mit/xf86-video-geode/dist/src/geode_driver.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_blend.h
U xsrc/external/mit/xf86-video-geode/dist/src/Makefile.am
U xsrc/external/mit/xf86-video-geode/dist/src/gx_vga.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_video.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_memory.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_fourcc.h
U xsrc/external/mit/xf86-video-geode/dist/src/geode_pcirename.h
U xsrc/external/mit/xf86-video-geode/dist/src/lx_panel.c
U xsrc/external/mit/xf86-video-geode/dist/src/durango.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode_dcon.c
U xsrc/external/mit/xf86-video-geode/dist/src/gx_regacc.c
U xsrc/external/mit/xf86-video-geode/dist/src/gx_rotate.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_output.c
U xsrc/external/mit/xf86-video-geode/dist/src/geode.h
C xsrc/external/mit/xf86-video-geode/dist/src/gx_driver.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_driver.c
U xsrc/external/mit/xf86-video-geode/dist/src/cim_dev.h
U xsrc/external/mit/xf86-video-geode/dist/src/gx_video.c
U xsrc/external/mit/xf86-video-geode/dist/src/gx_randr.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel.c
U xsrc/external/mit/xf86-video-geode/dist/src/gx_cursor.c
U xsrc/external/mit/xf86-video-geode/dist/src/lx_exa.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/readme.txt
U xsrc/external/mit/xf86-video-geode/dist/src/panel/pnl_init.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/pnl_defs.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/dora9211.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/dora9211.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/cen9211.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/panel.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/pnl_bios.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/cen9211.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/platform.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/gx2_9211.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/92xx.h
U xsrc/external/mit/xf86-video-geode/dist/src/panel/drac9210.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/panel.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/gx2_9211.c
U xsrc/external/mit/xf86-video-geode/dist/src/panel/drac9210.h
U xsrc/external/mit/xf86-video-geode/dist/src/gfx/gfx_disp.c
U xsrc/external/mit/xf86-video-geode/dist/src/gfx/vip_1200.c
U xsrc/external/mit/xf86-video-geode/dist/src/gfx/gfx_rtns.h
U xsrc/external/mit/xf86-video-geode/dist/src/gfx/gfx_regs.h
U xsrc/external/mit/xf86-video-geode/dist/src/gfx/gfx_i2c.c
U 

CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 23 06:15:27 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Teach device nodes on zfs to handle fsync by calling spec_fsync too.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.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/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.60 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.61
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.60	Sun Feb 23 05:50:25 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Feb 23 06:15:27 2020
@@ -5509,6 +5509,19 @@ zfs_netbsd_fsync(void *v)
 }
 
 static int
+zfs_spec_fsync(void *v)
+{
+	struct vop_fsync_args *ap = v;
+	int error;
+
+	error = spec_fsync(v);
+	if (error)
+		return error;
+
+	return (zfs_fsync(ap->a_vp, ap->a_flags, ap->a_cred, NULL));
+}
+
+static int
 zfs_netbsd_getattr(void *v)
 {
 	struct vop_getattr_args *ap = v;
@@ -6355,7 +6368,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _poll_desc,		spec_poll },
 	{ _kqfilter_desc,		spec_kqfilter },
 	{ _revoke_desc,		spec_revoke },
-	{ _fsync_desc,		zfs_netbsd_fsync },
+	{ _fsync_desc,		zfs_spec_fsync },
 	{ _remove_desc,		spec_remove },
 	{ _link_desc,		spec_link },
 	{ _lock_desc,		zfs_netbsd_lock },



CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs

2020-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Feb 23 05:50:25 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vnops.c

Log Message:
Teach zfs spec nodes to VOP_BWRITE too.

Fixes hang on writing to, e.g., ffs mounted on a device node that
lives on zfs.

XXX pullup


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.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/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.59 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.60
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c:1.59	Wed Feb 19 05:52:52 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c	Sun Feb 23 05:50:25 2020
@@ -6376,6 +6376,7 @@ const struct vnodeopv_entry_desc zfs_spe
 	{ _islocked_desc,		zfs_netbsd_islocked },
 	{ _advlock_desc,		spec_advlock },
 	{ _strategy_desc,		spec_strategy },
+	{ _bwrite_desc,		spec_bwrite },
 	{ _print_desc,		zfs_netbsd_print },
 	{ _fcntl_desc,		zfs_netbsd_fcntl },
 	{ NULL, NULL }



CVS commit: src/distrib/common

2020-02-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Feb 23 05:15:54 UTC 2020

Modified Files:
src/distrib/common: list.zfsroot mtree.zfsroot zfsroot.rc

Log Message:
zfs: Allow modules to be loaded once in the ZFS chroot

Rather than copying the needed modules from FFS to the ramdisk,
load then directly from FFS instead.

This way, we can symlink ramdisk stand into /altroot and let nature take
it's course like loading firmware.

Set shell exit on error rather than using chained commands.
zpool import seems to SIGBUS randomly on amd64 and if we didn't do the
former then zpool would hang the init. Now at least we exit to the shell.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/common/list.zfsroot \
src/distrib/common/mtree.zfsroot src/distrib/common/zfsroot.rc

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

Modified files:

Index: src/distrib/common/list.zfsroot
diff -u src/distrib/common/list.zfsroot:1.1 src/distrib/common/list.zfsroot:1.2
--- src/distrib/common/list.zfsroot:1.1	Sat Feb 22 09:53:47 2020
+++ src/distrib/common/list.zfsroot	Sun Feb 23 05:15:54 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: list.zfsroot,v 1.1 2020/02/22 09:53:47 roy Exp $
+#	$NetBSD: list.zfsroot,v 1.2 2020/02/23 05:15:54 roy Exp $
 #
 # list file (c.f. parselist.awk) for ZFS on root.
 #
@@ -12,6 +12,11 @@ ARGVLN	zfs mount_zfs
 # We need sysctl to set init.root=/altroot
 PROG	sbin/sysctl
 
+# We need modload as we cannot build CDDL modules in the kernel
+PROG	sbin/modload
+PROG	sbin/modunload
+PROG	sbin/modstat
+
 LIBS	-lnvpair
 LIBS	-luutil
 LIBS	-lzfs
@@ -25,5 +30,6 @@ LIBS	-lzfs_core
 
 COPY	${NETBSDSRCDIR}/distrib/common/zfsroot.rc etc/rc
 
-# Make firmware images available.
+# Make modules and firmware images available
+SYMLINK	altroot/stand stand
 SYMLINK	altroot/libdata libdata
Index: src/distrib/common/mtree.zfsroot
diff -u src/distrib/common/mtree.zfsroot:1.1 src/distrib/common/mtree.zfsroot:1.2
--- src/distrib/common/mtree.zfsroot:1.1	Sat Feb 22 09:53:47 2020
+++ src/distrib/common/mtree.zfsroot	Sun Feb 23 05:15:54 2020
@@ -1,8 +1,7 @@
-#	$NetBSD: mtree.zfsroot,v 1.1 2020/02/22 09:53:47 roy Exp $
+#	$NetBSD: mtree.zfsroot,v 1.2 2020/02/23 05:15:54 roy Exp $
 
 .
 ./altroot
 ./etc
 ./etc/zfs
 ./rpool
-./stand
Index: src/distrib/common/zfsroot.rc
diff -u src/distrib/common/zfsroot.rc:1.1 src/distrib/common/zfsroot.rc:1.2
--- src/distrib/common/zfsroot.rc:1.1	Sat Feb 22 09:53:47 2020
+++ src/distrib/common/zfsroot.rc	Sun Feb 23 05:15:54 2020
@@ -1,7 +1,11 @@
 #/bin/sh
 #
-#	$NetBSD: zfsroot.rc,v 1.1 2020/02/22 09:53:47 roy Exp $
-#	ZFS on Root boot strapper
+#	$NetBSD: zfsroot.rc,v 1.2 2020/02/23 05:15:54 roy Exp $
+
+echo "Starting root on ZFS boot strapper"
+
+# Abort on any error
+set -e
 
 # Configurable - define the ZFS root pool and ROOT.
 # XXX Can these be set in boot.cfg?
@@ -10,7 +14,7 @@ rpool=rpool
 rroot=ROOT
 
 # Assumption - the boot device is named boot.
-# Could use dk0, wd0a, etc instead.
+# Could use /dev/dk0, /dev/wd0a, etc instead.
 # XXX Can be exposed by sysctl kern.boot_device?
 bootdev="NAME=boot"
 
@@ -19,46 +23,33 @@ export HOME=/
 export PATH=/sbin:/bin:/usr/sbin:/usr/bin
 umask 022
 
-echo
-echo "Starting ZFS on root boot strapper"
-
 # Avoid having the solaris and zfs modules in ramdisk directly.
 # Means we don't need to update the ramdisk with the kernel modules
 # or load them from boot.cfg so it's less pain for the user.
 #bootdev="$(/sbin/sysctl -n kern.boot_device)"
 modpath="$(/sbin/sysctl -n kern.module.path)"
-modmnt=/mnt
-echo "Copying needed kernel modules from $bootdev:$modpath"
-case "$bootdev" in
-*=*|"/"*)	;;
-*)		bootdev="/dev/$bootdev";;
-esac
-/sbin/mount -o ro "$bootdev" "$modmnt"
-/sbin/mount -t tmpfs none /stand
+echo "Loading needed kernel modules from $bootdev:$modpath"
+/sbin/mount -o ro "$bootdev" /mnt
 for m in solaris zfs; do
-	p="$modpath/$m"
-	if [ ! -e "$modmnt/$p/$m.kmod" ]; then
-		echo "$modmnt/$p/$m.kmod not found!" >&2
-		continue
-	fi
-	echo "	$m.kmod"
-	/bin/mkdir -p "$p"
-	/bin/cp "$modmnt/$p/$m.kmod" "$p"
+	/sbin/modload "/mnt/$modpath/$m/$m.kmod"
 done
-# zpool list will load the needed modules, then we can dispose of the mounts.
-/sbin/zpool list >/dev/null 2>&1
-/sbin/umount /stand
-/sbin/umount "$modmnt"
-echo
-
-echo "Importing $rpool, mounting and pivoting"
-# If we can mount the ZFS root partition to /altroot
-# then chroot to it and start /etc/rc
-if /sbin/zpool import -f -N "$rpool" && \
-   /sbin/mount -t zfs "$rpool/$rroot" /altroot; then
-	# This ensures that mountall mounts all ZFS mounts set to automount.
-	if [ ! -e /altroot/etc/zfs/zpool.cache ]; then
-		echo >/altroot/etc/zfs/zpool.cache
-	fi
-	/sbin/sysctl -w init.root=/altroot
+/sbin/umount /mnt
+
+# FIXME XXX Sometimes zpool import gets SIGBUS
+# Ensure that we are in a writable directory to try and capture a coredump
+# Not that we actually get a coredump 
+cd /tmp
+
+echo 

CVS commit: src/sys/arch/sparc64/sparc64

2020-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Feb 23 05:14:29 UTC 2020

Modified Files:
src/sys/arch/sparc64/sparc64: autoconf.c

Log Message:
add location info to sd instances if we know which drive bay they live in
Sun Fire v210 only for now, others should be easy to add


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/arch/sparc64/sparc64/autoconf.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/sparc64/sparc64/autoconf.c
diff -u src/sys/arch/sparc64/sparc64/autoconf.c:1.216 src/sys/arch/sparc64/sparc64/autoconf.c:1.217
--- src/sys/arch/sparc64/sparc64/autoconf.c:1.216	Sun Feb  2 06:38:23 2020
+++ src/sys/arch/sparc64/sparc64/autoconf.c	Sun Feb 23 05:14:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $ */
+/*	$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.216 2020/02/02 06:38:23 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.217 2020/02/23 05:14:29 macallan Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1088,6 +1088,28 @@ add_gpio_props_v210(device_t dev, void *
 	}
 }
 
+static void
+add_drivebay_props_v210(device_t dev, int ofnode, void *aux)
+{
+	struct scsipibus_attach_args *sa = aux;
+	int target = sa->sa_periph->periph_target;
+	char path[256]= "";
+
+	OF_package_to_path(ofnode, path, sizeof(path));
+
+	/* see if we're on the onboard controller's 1st channel */
+	if (strcmp(path, "/pci@1c,60/scsi@2") != 0)
+		return;
+	/* yes, yes we are */
+	if ( target < 2) {
+		prop_dictionary_t dict = device_properties(dev);
+		char name[16];
+
+		snprintf(name, sizeof(name), "bay%d", target);		
+		prop_dictionary_set_cstring(dict, "location", name);
+	}
+}
+
 /*
  * Called back during autoconfiguration for each device found
  */
@@ -1163,6 +1185,12 @@ device_register(device_t dev, void *aux)
 		ofnode = device_ofnode(device_parent(busdev));
 		dev_bi_unit_drive_match(dev, ofnode, periph->periph_target + off,
 		0, periph->periph_lun);
+		if (device_is_a(busdev, "scsibus")) {
+			/* see if we're in a known SCA drivebay */
+			if (strcmp(machine_model, "SUNW,Sun-Fire-V210") == 0) {
+add_drivebay_props_v210(dev, ofnode, aux);
+			}
+		}
 		return;
 	} else if (device_is_a(dev, "wd")) {
 		struct ata_device *adev = aux;



CVS commit: src/sys/dev/audio

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Feb 23 04:24:56 UTC 2020

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

Log Message:
Improve error handling around audio_hw_probe().
It was difficult to return multiple errors.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 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.54 src/sys/dev/audio/audio.c:1.55
--- src/sys/dev/audio/audio.c:1.54	Sun Feb 23 04:02:46 2020
+++ src/sys/dev/audio/audio.c	Sun Feb 23 04:24:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.54 2020/02/23 04:02:46 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.55 2020/02/23 04:24:56 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.54 2020/02/23 04:02:46 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.55 2020/02/23 04:24:56 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -558,9 +558,7 @@ static int audio_mixers_init(struct audi
 	const audio_format2_t *, const audio_format2_t *,
 	const audio_filter_reg_t *, const audio_filter_reg_t *);
 static int audio_select_freq(const struct audio_format *);
-static int audio_hw_probe(struct audio_softc *, int, int *,
-	audio_format2_t *, audio_format2_t *);
-static int audio_hw_probe_fmt(struct audio_softc *, audio_format2_t *, int);
+static int audio_hw_probe(struct audio_softc *, audio_format2_t *, int);
 static int audio_hw_validate_format(struct audio_softc *, int,
 	const audio_format2_t *);
 static int audio_mixers_set_format(struct audio_softc *,
@@ -940,21 +938,46 @@ audioattach(device_t parent, device_t se
 	memset(, 0, sizeof(rhwfmt));
 	memset(, 0, sizeof(pfil));
 	memset(, 0, sizeof(rfil));
-	mutex_enter(sc->sc_lock);
-	error = audio_hw_probe(sc, has_indep, , , );
-	if (error) {
-		mutex_exit(sc->sc_lock);
-		aprint_error_dev(self, "audio_hw_probe failed, "
-		"error = %d\n", error);
-		goto bad;
-	}
-	if (mode == 0) {
-		mutex_exit(sc->sc_lock);
-		aprint_error_dev(self, "audio_hw_probe failed, no mode\n");
-		goto bad;
+	if (has_indep) {
+		int perror, rerror;
+
+		/* On independent devices, probe separately. */
+		perror = audio_hw_probe(sc, , AUMODE_PLAY);
+		rerror = audio_hw_probe(sc, , AUMODE_RECORD);
+		if (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);
+		}
+		if (rerror) {
+			mode &= ~AUMODE_RECORD;
+			aprint_error_dev(self, "audio_hw_probe failed with "
+			"%d, capture disabled\n", rerror);
+		}
+	} else {
+		/*
+		 * On non independent devices or uni-directional devices,
+		 * probe once (simultaneously).
+		 */
+		audio_format2_t *fmt = has_playback ?  : 
+		error = audio_hw_probe(sc, fmt, mode);
+		if (error) {
+			aprint_error_dev(self, "audio_hw_probe failed, "
+			"error = %d\n", error);
+			goto bad;
+		}
+		if (has_playback && has_capture)
+			rhwfmt = phwfmt;
 	}
+
 	/* Init hardware. */
 	/* hw_probe() also validates [pr]hwfmt.  */
+	mutex_enter(sc->sc_lock);
 	error = audio_hw_set_format(sc, mode, , , , );
 	if (error) {
 		mutex_exit(sc->sc_lock);
@@ -6045,68 +6068,13 @@ audio_select_freq(const struct audio_for
 }
 
 /*
- * Probe playback and/or recording format (depending on *modep).
- * *modep is an in-out parameter.  It indicates the direction to configure
- * as an argument, and the direction configured is written back as out
- * parameter.
- * If successful, probed hardware format is stored into *phwfmt, *rhwfmt
- * depending on *modep, and return 0.  Otherwise it returns errno.
- * Must be called with sc_lock held.
- */
-static int
-audio_hw_probe(struct audio_softc *sc, int is_indep, int *modep,
-	audio_format2_t *phwfmt, audio_format2_t *rhwfmt)
-{
-	audio_format2_t fmt;
-	int mode;
-	int error = 0;
-
-	KASSERT(mutex_owned(sc->sc_lock));
-
-	mode = *modep;
-	KASSERTMSG((mode & (AUMODE_PLAY | AUMODE_RECORD)) != 0, "mode=0x%x", mode);
-
-	if (is_indep) {
-		int errorp = 0, errorr = 0;
-
-		/* On independent devices, probe separately. */
-		if ((mode & AUMODE_PLAY) != 0) {
-			errorp = audio_hw_probe_fmt(sc, phwfmt, AUMODE_PLAY);
-			if (errorp)
-mode &= ~AUMODE_PLAY;
-		}
-		if ((mode & AUMODE_RECORD) != 0) {
-			errorr = audio_hw_probe_fmt(sc, rhwfmt, AUMODE_RECORD);
-			if (errorr)
-mode &= ~AUMODE_RECORD;
-		}
-
-		/* Return error if both play and record probes failed. */
-		if (errorp && errorr)
-			error = errorp;
-	} else {
-		/* On non independent devices, probe simultaneously. */
-		error = audio_hw_probe_fmt(sc, , mode);
-		if (error) {
-			mode = 0;
-		} else {
-			*phwfmt = fmt;
-			*rhwfmt = fmt;
-		}
-	}
-
-	*modep = 

CVS commit: src

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Feb 23 04:02:46 UTC 2020

Modified Files:
src/share/man/man9: audio.9
src/sys/arch/arm/iomd: vidcaudio.c
src/sys/arch/dreamcast/dev/g2: aica.c
src/sys/arch/hpcmips/vr: vraiu.c
src/sys/dev/audio: audio.c
src/sys/dev/ic: pl041.c
src/sys/dev/pad: pad.c

Log Message:
Make start_input/halt_input optional if the driver has no recording,
make start_output/halt_output optional if the driver has no playback.
And remove such never called functions.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/share/man/man9/audio.9
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/arm/iomd/vidcaudio.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/g2/aica.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hpcmips/vr/vraiu.c
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/pl041.c
cvs rdiff -u -r1.64 -r1.65 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/share/man/man9/audio.9
diff -u src/share/man/man9/audio.9:1.56 src/share/man/man9/audio.9:1.57
--- src/share/man/man9/audio.9:1.56	Wed Jun 12 13:53:25 2019
+++ src/share/man/man9/audio.9	Sun Feb 23 04:02:45 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.56 2019/06/12 13:53:25 wiz Exp $
+.\"	$NetBSD: audio.9,v 1.57 2020/02/23 04:02:45 isaki Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -395,6 +395,7 @@ Calling
 will normally initiate another call to
 .Va start_output .
 Return 0 on success, otherwise an error code.
+This field is optional only if the driver doesn't support playback.
 It is called in the Opened phase.
 .It Dv int start_input(void *hdl, void *block, int blksize,
 .Dv "void (*intr)(void*), void *intrarg)"
@@ -415,18 +416,21 @@ Calling
 will normally initiate another call to
 .Va start_input .
 Return 0 on success, otherwise an error code.
+This field is optional only if the driver doesn't support recording.
 It is called in the Opened phase.
 .It Dv int halt_output(void *hdl)
 is called to abort the output transfer (started by
 .Va start_output )
 in progress.
 Return 0 on success, otherwise an error code.
+This field is optional only if the driver doesn't support playback.
 It is called in the Opened phase.
 .It Dv int halt_input(void *hdl)
 is called to abort the input transfer (started by
 .Va start_input )
 in progress.
 Return 0 on success, otherwise an error code.
+This field is optional only if the driver doesn't support recording,
 It is called in the Opened phase.
 .It Dv int speaker_ctl(void *hdl, int on)
 optional, is called when a half duplex device changes between

Index: src/sys/arch/arm/iomd/vidcaudio.c
diff -u src/sys/arch/arm/iomd/vidcaudio.c:1.59 src/sys/arch/arm/iomd/vidcaudio.c:1.60
--- src/sys/arch/arm/iomd/vidcaudio.c:1.59	Sat Jun  8 08:02:36 2019
+++ src/sys/arch/arm/iomd/vidcaudio.c	Sun Feb 23 04:02:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vidcaudio.c,v 1.59 2019/06/08 08:02:36 isaki Exp $	*/
+/*	$NetBSD: vidcaudio.c,v 1.60 2020/02/23 04:02:45 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson
@@ -65,7 +65,7 @@
 
 #include 	/* proc.h */
 
-__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.59 2019/06/08 08:02:36 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.60 2020/02/23 04:02:45 isaki Exp $");
 
 #include 
 #include/* autoconfig functions */
@@ -148,10 +148,7 @@ static intvidcaudio_set_format(void 
 static intvidcaudio_round_blocksize(void *, int, int, const audio_params_t *);
 static intvidcaudio_trigger_output(void *, void *, void *, int,
 void (*)(void *), void *, const audio_params_t *);
-static intvidcaudio_trigger_input(void *, void *, void *, int,
-void (*)(void *), void *, const audio_params_t *);
 static intvidcaudio_halt_output(void *);
-static intvidcaudio_halt_input(void *);
 static intvidcaudio_getdev(void *, struct audio_device *);
 static intvidcaudio_set_port(void *, mixer_ctrl_t *);
 static intvidcaudio_get_port(void *, mixer_ctrl_t *);
@@ -171,14 +168,12 @@ static const struct audio_hw_if vidcaudi
 	.set_format		= vidcaudio_set_format,
 	.round_blocksize	= vidcaudio_round_blocksize,
 	.halt_output		= vidcaudio_halt_output,
-	.halt_input		= vidcaudio_halt_input,
 	.getdev			= vidcaudio_getdev,
 	.set_port		= vidcaudio_set_port,
 	.get_port		= vidcaudio_get_port,
 	.query_devinfo		= vidcaudio_query_devinfo,
 	.get_props		= vidcaudio_get_props,
 	.trigger_output		= vidcaudio_trigger_output,
-	.trigger_input		= vidcaudio_trigger_input,
 	.get_locks		= vidcaudio_get_locks,
 };
 
@@ -427,14 +422,6 @@ vidcaudio_trigger_output(void *addr, voi
 }
 
 static int
-vidcaudio_trigger_input(void *addr, void *start, void *end, int blksize,
-void (*intr)(void *), void *arg, const audio_params_t *params)
-{
-
-	return ENODEV;
-}
-
-static int

CVS commit: src/doc

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Feb 23 02:37:53 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
Note genet(4) addition


To generate a diff of this commit:
cvs rdiff -u -r1.2651 -r1.2652 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2651 src/doc/CHANGES:1.2652
--- src/doc/CHANGES:1.2651	Thu Feb 20 15:04:53 2020
+++ src/doc/CHANGES	Sun Feb 23 02:37:53 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2651 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2652 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -144,3 +144,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	realpath(1): Ported from FreeBSD. [kamil 20200202]
 	kernel: Remove azalia(4). [jmcneill 20200209]
 	awk(1): Import 20200218 [christos 20200218]
+	genet(4): Add support for Broadcom GENETv5 ethernet controllers, found
+		in the Raspberry Pi 4. [jmcneill 20200222]



CVS commit: src/external/gpl3/gdb/dist/gdb

2020-02-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 23 02:06:01 UTC 2020

Modified Files:
src/external/gpl3/gdb/dist/gdb: sparc64-tdep.c

Log Message:
Use C++ syntax for defining types, not C one.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.8 -r1.2 src/external/gpl3/gdb/dist/gdb/sparc64-tdep.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/gpl3/gdb/dist/gdb/sparc64-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/sparc64-tdep.c:1.1.1.8 src/external/gpl3/gdb/dist/gdb/sparc64-tdep.c:1.2
--- src/external/gpl3/gdb/dist/gdb/sparc64-tdep.c:1.1.1.8	Sun May 26 20:59:21 2019
+++ src/external/gpl3/gdb/dist/gdb/sparc64-tdep.c	Sun Feb 23 02:06:01 2020
@@ -86,7 +86,7 @@
 static struct cmd_list_element *sparc64adilist = NULL;
 
 /* ADI stat settings.  */
-typedef struct
+struct adi_stat_t
 {
   /* The ADI block size.  */
   unsigned long blksize;
@@ -108,7 +108,7 @@ typedef struct
   /* ADI is available.  */
   bool is_avail = false;
 
-} adi_stat_t;
+};
 
 /* Per-process ADI stat info.  */
 



CVS commit: src/external/mit/xorg/lib

2020-02-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 23 02:03:19 UTC 2020

Modified Files:
src/external/mit/xorg/lib: libmesa.mk

Log Message:
Don't hard-code LLVM version, extract it from external/apache2/llvm.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/external/mit/xorg/lib/libmesa.mk

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/xorg/lib/libmesa.mk
diff -u src/external/mit/xorg/lib/libmesa.mk:1.10 src/external/mit/xorg/lib/libmesa.mk:1.11
--- src/external/mit/xorg/lib/libmesa.mk:1.10	Fri Jan 31 20:58:18 2020
+++ src/external/mit/xorg/lib/libmesa.mk	Sun Feb 23 02:03:19 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: libmesa.mk,v 1.10 2020/01/31 20:58:18 jmcneill Exp $
+#	$NetBSD: libmesa.mk,v 1.11 2020/02/23 02:03:19 joerg Exp $
 #
 # Consumer of this Makefile should set MESA_SRC_MODULES.
 
@@ -533,8 +533,10 @@ CPPFLAGS+=	\
 	-DHAVE_MINCORE
 
 .if ${MKLLVMRT} != "no"
+LLVM_VERSION!=		cd ${NETBSDSRCDIR}/external/apache2/llvm && ${MAKE} -V LLVM_VERSION
+HAVE_LLVM_VERSION!=	expr ${LLVM_VERSION:R:R} \* 256 + ${LLVM_VERSION:R:E} \* 16
 CPPFLAGS+=	\
-	-DHAVE_LLVM=0x0900
+	-DHAVE_LLVM=${HAVE_LLVM_VERSION}
 CXXFLAGS+=	-fno-rtti
 .endif
 



CVS commit: src/external/mit/xorg/lib/libglapi

2020-02-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 23 02:02:33 UTC 2020

Modified Files:
src/external/mit/xorg/lib/libglapi: Makefile

Log Message:
Doesn't need or use HAVE_LLVM.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/mit/xorg/lib/libglapi/Makefile

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/xorg/lib/libglapi/Makefile
diff -u src/external/mit/xorg/lib/libglapi/Makefile:1.6 src/external/mit/xorg/lib/libglapi/Makefile:1.7
--- src/external/mit/xorg/lib/libglapi/Makefile:1.6	Fri Jan 31 20:58:18 2020
+++ src/external/mit/xorg/lib/libglapi/Makefile	Sun Feb 23 02:02:32 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.6 2020/01/31 20:58:18 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.7 2020/02/23 02:02:32 joerg Exp $
 
 .include 
 
@@ -73,7 +73,6 @@ CPPFLAGS+=	\
 	-DHAVE_DRM_PLATFORM \
 	-DENABLE_SHADER_CACHE \
 	-DHAVE_MINCORE \
-	-DHAVE_LLVM=0x0900 \
 	-DMESA_LLVM_VERSION_PATCH=0 \
 	-I. \
 	-DSTDC_HEADERS=1 \



CVS commit: src/external/apache2/llvm/lib

2020-02-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Feb 23 02:01:17 UTC 2020

Modified Files:
src/external/apache2/llvm/lib: Makefile

Log Message:
Fix harmless syntax error.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/apache2/llvm/lib/Makefile

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

Modified files:

Index: src/external/apache2/llvm/lib/Makefile
diff -u src/external/apache2/llvm/lib/Makefile:1.1 src/external/apache2/llvm/lib/Makefile:1.2
--- src/external/apache2/llvm/lib/Makefile:1.1	Mon Nov 11 22:45:02 2019
+++ src/external/apache2/llvm/lib/Makefile	Sun Feb 23 02:01:17 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2019/11/11 22:45:02 joerg Exp $
+# $NetBSD: Makefile,v 1.2 2020/02/23 02:01:17 joerg Exp $
 
 .include 
 
@@ -116,7 +116,7 @@ SUBDIR+= \
 	libLLVMRuntimeDyld
 .endif
 
-.if ${NO_LLVM_DEVELOPER:Uno} == "no" && ${LLVM_DEVELOPER:U} == "yes
+.if ${NO_LLVM_DEVELOPER:Uno} == "no" && ${LLVM_DEVELOPER:U} == "yes"
 SUBDIR+= \
 	libLLVMDebugInfoPDB \
 	libLLVMDebugInfoPDBNative \



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

2020-02-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Feb 23 01:53:03 UTC 2020

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

Log Message:
no need to call config_init_mi() in rumpdev any more - rump_init() now calls
config_init(), and the sysctl shouldn't be needed

PR kern/55004


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/rump/librump/rumpdev/rump_dev.c:1.28
--- src/sys/rump/librump/rumpdev/rump_dev.c:1.27	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpdev/rump_dev.c	Sun Feb 23 01:53:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_dev.c,v 1.27 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.27 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $");
 
 #include 
 #include 
@@ -49,7 +49,6 @@ RUMP_COMPONENT(RUMP__FACTION_DEV)
 	KERNEL_LOCK(1, curlwp);
 
 	rump_mainbus_init();
-	config_init_mi();
 
 	rump_component_init(RUMP_COMPONENT_DEV);
 



CVS commit: src/sbin/modstat

2020-02-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Feb 23 00:14:31 UTC 2020

Modified Files:
src/sbin/modstat: modstat.8

Log Message:
Fix date.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sbin/modstat/modstat.8

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

Modified files:

Index: src/sbin/modstat/modstat.8
diff -u src/sbin/modstat/modstat.8:1.27 src/sbin/modstat/modstat.8:1.28
--- src/sbin/modstat/modstat.8:1.27	Sat Feb 22 14:26:18 2020
+++ src/sbin/modstat/modstat.8	Sun Feb 23 00:14:31 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: modstat.8,v 1.27 2020/02/22 14:26:18 pgoyette Exp $
+.\" $NetBSD: modstat.8,v 1.28 2020/02/23 00:14:31 wiz Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <>
 .\"
-.Dd Februaru 22, 2020
+.Dd February 22, 2020
 .Dt MODSTAT 8
 .Os
 .Sh NAME



CVS commit: src/doc

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 23:40:06 UTC 2020

Modified Files:
src/doc: 3RDPARTY

Log Message:
bsd-family-tree


To generate a diff of this commit:
cvs rdiff -u -r1.1691 -r1.1692 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1691 src/doc/3RDPARTY:1.1692
--- src/doc/3RDPARTY:1.1691	Tue Feb 18 21:14:16 2020
+++ src/doc/3RDPARTY	Sat Feb 22 23:40:05 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1691 2020/02/18 21:14:16 christos Exp $
+#	$NetBSD: 3RDPARTY,v 1.1692 2020/02/22 23:40:05 sevan Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -195,12 +195,12 @@ Todo[4]: Re-entrant functions of net/*
 Todo[5]: Reconcile the doc directory.
 
 Package:	bsd-family-tree
-Version:	355063
-Current Vers:	355063
+Version:	358254
+Current Vers:	358254
 Maintainer:	The FreeBSD Project
 Archive Site:	https://svnweb.freebsd.org/base/head/share/misc/bsd-family-tree
 Home Page:	https://svnweb.freebsd.org/base/head/share/misc/bsd-family-tree
-Date:		2019-12-23
+Date:		2020-02-22
 Mailing List:
 Responsible:
 License:	BSD (2-clause) (see http://www.freebsd.org/cgi/cvsweb.cgi/src/COPYRIGHT)



CVS commit: src/share/misc

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 23:38:04 UTC 2020

Modified Files:
src/share/misc: bsd-family-tree

Log Message:
Sync with FreeBSD r358254


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/share/misc/bsd-family-tree

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

Modified files:

Index: src/share/misc/bsd-family-tree
diff -u src/share/misc/bsd-family-tree:1.77 src/share/misc/bsd-family-tree:1.78
--- src/share/misc/bsd-family-tree:1.77	Mon Dec 23 23:11:01 2019
+++ src/share/misc/bsd-family-tree	Sat Feb 22 23:38:04 2020
@@ -388,11 +388,11 @@ FreeBSD 5.2   |  |  
  ||   |  |   | |  |DragonFly 5.2.2
  | FreeBSD|  |   | *--NetBSD  ||
  |   11.2 |  |   | 7.2||
- || macOS|   | |  ||
- || 10.14|   | |  OpenBSD 6.4  |
- ||   |  |   | |  ||
- ||   |  |   | |  |DragonFly 5.4.0
- *--FreeBSD   |   |  |   | v  ||
+ || macOS|   |||
+ || 10.14|   |OpenBSD 6.4  |
+ ||   |  |   |||
+ ||   |  |   ||DragonFly 5.4.0
+ *--FreeBSD   |   |  |   |||
  |   12.0 |   |  |   ||DragonFly 5.4.1
  | |  |   |  |   |OpenBSD 6.5  |
  | |  |   |  |   |||
@@ -405,7 +405,8 @@ FreeBSD 5.2   |  |  
  |  FreeBSD   |  |OpenBSD 6.6  |
  |   12.1   macOS|||
  | |   10.15.1   ||DragonFly 5.6.2
- | v  |  |||
+ | |  |  *--NetBSD||
+ | v  |  |   9.0  ||
  ||  |||
 FreeBSD 13 -current   |  NetBSD -current   OpenBSD -currentDragonFly -current
  ||  |||
@@ -798,6 +799,7 @@ OpenBSD 6.6		2019-10-17 [OBD]
 macOS 10.15		2019-10-07 [APL]
 macOS 10.15.1		2019-10-29 [APL] (security/critical release)
 FreeBSD 12.1		2019-11-04 [FBD]
+NetBSD 9.0 		2020-02-15 [NBD]
 
 Bibliography
 
@@ -862,5 +864,5 @@ Steven M. Schultz for providing 2.8BSD, 
 Copyright (c) 1997-2012 Wolfram Schneider 
 URL: https://svnweb.freebsd.org/base/head/share/misc/bsd-family-tree
 
-$FreeBSD: head/share/misc/bsd-family-tree 355063 2019-11-24 19:16:57Z eadler $
-$NetBSD: bsd-family-tree,v 1.77 2019/12/23 23:11:01 sevan Exp $
+$FreeBSD: head/share/misc/bsd-family-tree 358254 2020-02-22 23:36:10Z sevan $
+$NetBSD: bsd-family-tree,v 1.78 2020/02/22 23:38:04 sevan Exp $



CVS commit: src/usr.bin/calendar/calendars

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 23:17:59 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Ken Kesey


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.40 src/usr.bin/calendar/calendars/calendar.birthday:1.41
--- src/usr.bin/calendar/calendars/calendar.birthday:1.40	Sat Feb 22 19:25:25 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Feb 22 23:17:59 2020
@@ -216,6 +216,7 @@
 09/13	Walter Reed born, 1851
 09/15	Agatha Christie born in Torquay, England, 1890
 09/16	Allen Funt born in Brooklyn, NY, 1914
+09/17	Kenneth Elton Kesey was born in La Junta, Colorado, 1935
 09/18	Greta Garbo born, 1905
 09/20	Upton (Beall) Sinclair born, 1878
 09/21	H.G. (Herbert George) Wells born in Bromley, England, 1866
@@ -258,6 +259,7 @@
 11/05	Roy Rogers born, 1912
 11/08	Aaron Hillel Swartz was born in Highland Park, Illinois, 1986
 11/09	Carl Sagan born, 1934
+11/10	Kenneth Elton Kesey died in Eugene, Oregon, 2001
 11/10	Martin Luther born in Eisleben, Germany, 1483
 11/10	Soviet President Leonid Brezhnev dies at age 75, 1982
 11/11	Kurt Vonnegut, Jr, born in Indianapolis, 1922



CVS commit: src/include

2020-02-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Feb 22 22:47:35 UTC 2020

Modified Files:
src/include: math.h

Log Message:
Correct C99 / C++11 feature testing. Document remaining missing symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/include/math.h

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

Modified files:

Index: src/include/math.h
diff -u src/include/math.h:1.65 src/include/math.h:1.66
--- src/include/math.h:1.65	Sun Jun 24 23:55:29 2018
+++ src/include/math.h	Sat Feb 22 22:47:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: math.h,v 1.65 2018/06/24 23:55:29 christos Exp $	*/
+/*	$NetBSD: math.h,v 1.66 2020/02/22 22:47:35 joerg Exp $	*/
 
 /*
  * 
@@ -21,6 +21,16 @@
 #include 
 #include 
 
+/*
+ * Missing for C99 support:
+ * - MATH_ERRNO
+ * - MATH_ERREXCEPT
+ * - FP_FAST_FMA
+ * - FP_FAST_FMAF
+ * - FP_FAST_FMAL
+ * - math_errhandling
+ */
+
 union __float_u {
 	unsigned char __dummy[sizeof(float)];
 	float __val;
@@ -40,7 +50,14 @@ union __long_double_u {
 	   or __long_double_u */
 #include 			/* for INT_{MIN,MAX} */
 
-#if ((_POSIX_C_SOURCE - 0) >= 200809L || defined(_NETBSD_SOURCE))
+#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+!defined(_XOPEN_SOURCE)) || ((_POSIX_C_SOURCE - 0) >= 200809L || \
+ defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+ (__cplusplus - 0) >= 201103L || defined(_NETBSD_SOURCE))
+#define __MATH_C99_FEATURES
+#endif
+
+#ifdef __MATH_C99_FEATURES
 #  if defined(__FLT_EVAL_METHOD__) && (__FLT_EVAL_METHOD__ - 0) == 0
 typedef double double_t;
 typedef float float_t;
@@ -83,12 +100,8 @@ extern const union __double_u __infinity
 /*
  * ISO C99
  */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
-!defined(_XOPEN_SOURCE) || \
-((__STDC_VERSION__ - 0) >= 199901L) || \
-((_POSIX_C_SOURCE - 0) >= 200112L) || \
-((_XOPEN_SOURCE  - 0) >= 600) || \
-defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#if defined(__MATH_C99_FEATURES) || \
+(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE  - 0) >= 600
 /* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
 #if __GNUC_PREREQ__(3, 3)
 #define	HUGE_VALF	__builtin_huge_valf()
@@ -133,7 +146,7 @@ extern const union __float_u __nanf;
 #define	FP_ILOGB0	INT_MIN
 #define	FP_ILOGBNAN	INT_MAX
 
-#endif /* !_ANSI_SOURCE && ... */
+#endif /* C99 || _XOPEN_SOURCE >= 600 */
 
 /*
  * XOPEN/SVID
@@ -238,16 +251,18 @@ double	fabs(double);
 double	floor(double);
 double	fmod(double, double);
 
-#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#if defined(__MATH_C99_FEATURES) || defined(_XOPEN_SOURCE)
 double	erf(double);
 double	erfc(double);
-double	gamma(double);
 double	hypot(double, double);
+#endif
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
 int	finite(double);
+double	gamma(double);
 double	j0(double);
 double	j1(double);
 double	jn(int, double);
-double	lgamma(double);
 double	y0(double);
 double	y1(double);
 double	yn(int, double);
@@ -260,12 +275,7 @@ double	scalb(double, double);
 /*
  * ISO C99
  */
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
-!defined(_XOPEN_SOURCE) || \
-((__STDC_VERSION__ - 0) >= 199901L) || \
-((_POSIX_C_SOURCE - 0) >= 200809L) || \
-((_XOPEN_SOURCE  - 0) >= 500) || \
-defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#if defined(__MATH_C99_FEATURES) || (_XOPEN_SOURCE - 0) >= 500
 double	acosh(double);
 double	asinh(double);
 double	atanh(double);
@@ -279,12 +289,8 @@ double	remainder(double, double);
 double	rint(double);
 #endif
 
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
-!defined(_XOPEN_SOURCE) || \
-((__STDC_VERSION__ - 0) >= 199901L) || \
-((_POSIX_C_SOURCE - 0) >= 200112L) || \
-((_XOPEN_SOURCE  - 0) >= 600) || \
-defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#if defined(__MATH_C99_FEATURES) || (_XOPEN_SOURCE - 0) >= 600 || \
+(_POSIX_C_SOURCE - 0) >= 200112L
 /* 7.12.3.1 int fpclassify(real-floating x) */
 #define	fpclassify(__x)	__fpmacro_unary_floating(fpclassify, __x)
 
@@ -331,6 +337,8 @@ long double	sinhl(long double);
 long double	tanhl(long double);
 
 /* 7.12.6 exp / log */
+double	scalbn(double, int);
+double	scalbln(double, long);
 
 float	expf(float);
 float	exp2f(float);
@@ -378,6 +386,7 @@ long double	sqrtl(long double);
 
 /* 7.12.8 error / gamma */
 
+double	lgamma(double);
 double	tgamma(double);
 float	erff(float);
 float	erfcf(float);
@@ -436,6 +445,7 @@ long double	remquol(long double, long do
 
 /* 7.12.11 manipulation */
 
+double	copysign(double, double);
 double	nan(const char *);
 double	nearbyint(double);
 double	nexttoward(double, long double);
@@ -474,11 +484,7 @@ long double fminl(long double, long doub
 
 #endif /* !_ANSI_SOURCE && ... */
 
-#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) || \
-!defined(_XOPEN_SOURCE) || \
-

CVS commit: src/sys/ufs/lfs

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 22:20:47 UTC 2020

Modified Files:
src/sys/ufs/lfs: lfs_segment.c

Log Message:
Make LFS/rump play nice with aiodoned removal.

PR kern/55004 (Hundreds of file system tests now fail on real hardware)


To generate a diff of this commit:
cvs rdiff -u -r1.282 -r1.283 src/sys/ufs/lfs/lfs_segment.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/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.282 src/sys/ufs/lfs/lfs_segment.c:1.283
--- src/sys/ufs/lfs/lfs_segment.c:1.282	Tue Feb 18 20:23:17 2020
+++ src/sys/ufs/lfs/lfs_segment.c	Sat Feb 22 22:20:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.282 2020/02/18 20:23:17 chs Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.283 2020/02/22 22:20:47 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.282 2020/02/18 20:23:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.283 2020/02/22 22:20:47 ad Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -2513,7 +2513,7 @@ lfs_free_aiodone(struct buf *bp)
 	fs = bp->b_private;
 	ASSERT_NO_SEGLOCK(fs);
 	lfs_freebuf(fs, bp);
-	KERNEL_UNLOCK_LAST(curlwp);
+	KERNEL_UNLOCK_ONE(curlwp);
 }
 
 static void
@@ -2531,7 +2531,7 @@ lfs_super_aiodone(struct buf *bp)
 	wakeup(>lfs_sbactive);
 	mutex_exit(_lock);
 	lfs_freebuf(fs, bp);
-	KERNEL_UNLOCK_LAST(curlwp);
+	KERNEL_UNLOCK_ONE(curlwp);
 }
 
 static void
@@ -2664,7 +2664,7 @@ lfs_cluster_aiodone(struct buf *bp)
 		wakeup(>lfs_iocount);
 	mutex_exit(_lock);
 
-	KERNEL_UNLOCK_LAST(curlwp);
+	KERNEL_UNLOCK_ONE(curlwp);
 
 	pool_put(>lfs_bpppool, cl->bpp);
 	cl->bpp = NULL;



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

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 22:09:07 UTC 2020

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_mbox.c bcm2835_mbox_acpi.c

Log Message:
RPi4 UEFI firmware 1.1 reports the wrong IRQ for the VC mailbox. Use
polling mode for now until this is sorted out.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/broadcom/bcm2835_mbox.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.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/broadcom/bcm2835_mbox.c
diff -u src/sys/arch/arm/broadcom/bcm2835_mbox.c:1.14 src/sys/arch/arm/broadcom/bcm2835_mbox.c:1.15
--- src/sys/arch/arm/broadcom/bcm2835_mbox.c:1.14	Mon Dec 30 18:43:38 2019
+++ src/sys/arch/arm/broadcom/bcm2835_mbox.c	Sat Feb 22 22:09:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_mbox.c,v 1.14 2019/12/30 18:43:38 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_mbox.c,v 1.15 2020/02/22 22:09:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox.c,v 1.14 2019/12/30 18:43:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox.c,v 1.15 2020/02/22 22:09:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -97,8 +97,9 @@ bcmmbox_attach(struct bcm2835mbox_softc 
 		cv_init(>sc_chan[i], "bcmmbox");
 
 	/* enable mbox interrupt */
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_MBOX_CFG,
-	BCM2835_MBOX_CFG_DATAIRQEN);
+	if (sc->sc_intrh != NULL)
+		bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_MBOX_CFG,
+		BCM2835_MBOX_CFG_DATAIRQEN);
 
 	baa.baa_dmat = sc->sc_dmat;
 	sc->sc_platdev = config_found_ia(sc->sc_dev, "bcmmboxbus", , NULL);
@@ -130,7 +131,7 @@ bcmmbox_read(uint8_t chan, uint32_t *dat
 
 	mutex_enter(>sc_intr_lock);
 	while (BCM2835_MBOX_CHAN(sc->sc_mbox[chan]) == 0) {
-		if (cold)
+		if (cold || sc->sc_intrh == NULL)
 			bcmmbox_intr1(sc, 0);
 		else
 			cv_wait(>sc_chan[chan], >sc_intr_lock);

Index: src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.c
diff -u src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.c:1.1 src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.c:1.1	Mon Dec 30 18:43:38 2019
+++ src/sys/arch/arm/broadcom/bcm2835_mbox_acpi.c	Sat Feb 22 22:09:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_mbox_acpi.c,v 1.1 2019/12/30 18:43:38 jmcneill Exp $	*/
+/*	$NetBSD: bcm2835_mbox_acpi.c,v 1.2 2020/02/22 22:09:07 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox_acpi.c,v 1.1 2019/12/30 18:43:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_mbox_acpi.c,v 1.2 2020/02/22 22:09:07 jmcneill Exp $");
 
 #include 
 #include 
@@ -103,12 +103,14 @@ bcmmbox_acpi_attach(device_t parent, dev
 		return;
 	}
 
+#if notyet
 	sc->sc_intrh = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
 	IPL_VM, false, bcmmbox_intr, sc, device_xname(self));
 	if (sc->sc_intrh == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt\n");
 		return;
 	}
+#endif
 
 	bcmmbox_attach(sc);
 }



CVS commit: src/lib/libc/stdio

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 22:02:46 UTC 2020

Modified Files:
src/lib/libc/stdio: fread.c

Log Message:
Avoid undefined behavior in fread(3)

On the first call to fread(3), just after fopen(3) the internal buffers
are empty. This means that _r and _p (among others) are zeroed.

Passing NULL to the 2nd argument of memcpy(3) for the zero length is
undefined. Calling _p += 0 triggers LLVM UBSan (NULL pointer arithmetic).
Calling _p += 0, p += 0 and resid -= 0 has no effect.

Replace the "fp->_r = 0;" logic with a short circuit jump to __srefill()
that sets _r internally and refills the FILE buffers.

No functional change from an end user point of view, except skipping a few
dummy operations on the first call, for a FILE pointer, to fread(3).


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/lib/libc/stdio/fread.c

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

Modified files:

Index: src/lib/libc/stdio/fread.c
diff -u src/lib/libc/stdio/fread.c:1.22 src/lib/libc/stdio/fread.c:1.23
--- src/lib/libc/stdio/fread.c:1.22	Thu Mar 15 18:22:30 2012
+++ src/lib/libc/stdio/fread.c	Sat Feb 22 22:02:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fread.c,v 1.22 2012/03/15 18:22:30 christos Exp $	*/
+/*	$NetBSD: fread.c,v 1.23 2020/02/22 22:02:46 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)fread.c	8.2 (Berkeley) 12/11/93";
 #else
-__RCSID("$NetBSD: fread.c,v 1.22 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: fread.c,v 1.23 2020/02/22 22:02:46 kamil Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -68,16 +68,21 @@ fread(void *buf, size_t size, size_t cou
 	_DIAGASSERT(buf != NULL);
 
 	FLOCKFILE(fp);
-	if (fp->_r < 0)
-		fp->_r = 0;
 	total = resid;
 	p = buf;
+
+	if (fp->_r <= 0) {
+		/* Nothing to read on enter, refill the buffers. */
+		goto refill;
+	}
+
 	while (resid > (size_t)(r = fp->_r)) {
 		(void)memcpy(p, fp->_p, (size_t)r);
 		fp->_p += r;
 		/* fp->_r = 0 ... done in __srefill */
 		p += r;
 		resid -= r;
+refill:
 		if (__srefill(fp)) {
 			/* no more input: return partial result */
 			FUNLOCKFILE(fp);



CVS commit: src/sys/kern

2020-02-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Feb 22 21:59:31 UTC 2020

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

Log Message:
check for errors from proc_vmspace_getref().


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/subr_copy.c

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

Modified files:

Index: src/sys/kern/subr_copy.c
diff -u src/sys/kern/subr_copy.c:1.11 src/sys/kern/subr_copy.c:1.12
--- src/sys/kern/subr_copy.c:1.11	Sun Apr  7 16:27:41 2019
+++ src/sys/kern/subr_copy.c	Sat Feb 22 21:59:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_copy.c,v 1.11 2019/04/07 16:27:41 thorpej Exp $	*/
+/*	$NetBSD: subr_copy.c,v 1.12 2020/02/22 21:59:30 chs Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008, 2019
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.11 2019/04/07 16:27:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.12 2020/02/22 21:59:30 chs Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 #define	__UCAS_PRIVATE
@@ -321,13 +321,14 @@ copyin_pid(pid_t pid, const void *uaddr,
 		return ESRCH;
 	}
 	mutex_enter(p->p_lock);
-	proc_vmspace_getref(p, );
+	error = proc_vmspace_getref(p, );
 	mutex_exit(p->p_lock);
 	mutex_exit(proc_lock);
 
-	error = copyin_vmspace(vm, uaddr, kaddr, len);
-
-	uvmspace_free(vm);
+	if (error == 0) {
+		error = copyin_vmspace(vm, uaddr, kaddr, len);
+		uvmspace_free(vm);
+	}
 	return error;
 }
 



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

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:45:35 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: rump.c

Log Message:
rump_init(): need to call config_init() now.

PR kern/55004 (Hundreds of file system tests now fail on real hardware)


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 src/sys/rump/librump/rumpkern/rump.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/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.341 src/sys/rump/librump/rumpkern/rump.c:1.342
--- src/sys/rump/librump/rumpkern/rump.c:1.341	Tue Feb 18 20:23:17 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Feb 22 21:45:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $	*/
+/*	$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -411,6 +411,7 @@ rump_init(void)
 	procinit_sysctl();
 	time_init();
 	time_init2();
+	config_init();
 
 	/* start page baroness */
 	if (rump_threads) {



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

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:44:51 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: locks.c locks_up.c

Log Message:
rump rw_lock_op


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/rump/librump/rumpkern/locks.c
cvs rdiff -u -r1.10 -r1.11 src/sys/rump/librump/rumpkern/locks_up.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/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.80 src/sys/rump/librump/rumpkern/locks.c:1.81
--- src/sys/rump/librump/rumpkern/locks.c:1.80	Mon Feb  5 05:00:48 2018
+++ src/sys/rump/librump/rumpkern/locks.c	Sat Feb 22 21:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.81 2020/02/22 21:44:51 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.81 2020/02/22 21:44:51 ad Exp $");
 
 #include 
 #include 
@@ -358,6 +358,13 @@ rw_lock_held(krwlock_t *rw)
 	return rw_read_held(rw) || rw_write_held(rw);
 }
 
+krw_t
+rw_lock_op(krwlock_t *rw)
+{
+
+	return rw_write_held(rw) ? RW_WRITER : RW_READER;
+}
+
 /* curriculum vitaes */
 
 #define RUMPCV(cv) (*(struct rumpuser_cv **)(cv))

Index: src/sys/rump/librump/rumpkern/locks_up.c
diff -u src/sys/rump/librump/rumpkern/locks_up.c:1.10 src/sys/rump/librump/rumpkern/locks_up.c:1.11
--- src/sys/rump/librump/rumpkern/locks_up.c:1.10	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpkern/locks_up.c	Sat Feb 22 21:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks_up.c,v 1.10 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: locks_up.c,v 1.11 2020/02/22 21:44:51 ad Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.10 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.11 2020/02/22 21:44:51 ad Exp $");
 
 #include 
 #include 
@@ -317,6 +317,12 @@ rw_lock_held(krwlock_t *rw)
 	return uprw->uprw_owner || uprw->uprw_readers;
 }
 
+krw_t
+rw_lock_op(krwlock_t *rw)
+{
+
+	return rw_write_held(rw) ? RW_WRITER : RW_READER;
+}
 
 /*
  * Condvars are almost the same as in the MP case except that we



CVS commit: src

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:24:45 UTC 2020

Modified Files:
src/distrib/sets/lists/comp: mi
src/share/man/man9: rwlock.9
src/sys/kern: kern_rwlock.c
src/sys/sys: rwlock.h

Log Message:
Add rw_lock_op(): return either RW_READER or RW_WRITER for a lock that is
known to be held by the caller.  Panic if the lock is not held.


To generate a diff of this commit:
cvs rdiff -u -r1.2310 -r1.2311 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.19 -r1.20 src/share/man/man9/rwlock.9
cvs rdiff -u -r1.64 -r1.65 src/sys/kern/kern_rwlock.c
cvs rdiff -u -r1.15 -r1.16 src/sys/sys/rwlock.h

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2310 src/distrib/sets/lists/comp/mi:1.2311
--- src/distrib/sets/lists/comp/mi:1.2310	Fri Feb  7 18:48:58 2020
+++ src/distrib/sets/lists/comp/mi	Sat Feb 22 21:24:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2310 2020/02/07 18:48:58 kamil Exp $
+#	$NetBSD: mi,v 1.2311 2020/02/22 21:24:44 ad Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -11792,6 +11792,7 @@
 ./usr/share/man/cat9/rw_exit.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/rw_init.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/rw_lock_held.0		comp-sys-catman		.cat
+./usr/share/man/cat9/rw_lock_op.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/rw_read_held.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/rw_tryenter.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/rw_tryupgrade.0		comp-sys-catman		.cat
@@ -19710,6 +19711,7 @@
 ./usr/share/man/html9/rw_exit.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rw_init.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rw_lock_held.html		comp-sys-htmlman	html
+./usr/share/man/html9/rw_lock_op.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rw_read_held.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rw_tryenter.html		comp-sys-htmlman	html
 ./usr/share/man/html9/rw_tryupgrade.html	comp-sys-htmlman	html
@@ -27811,6 +27813,7 @@
 ./usr/share/man/man9/rw_exit.9			comp-sys-man		.man
 ./usr/share/man/man9/rw_init.9			comp-sys-man		.man
 ./usr/share/man/man9/rw_lock_held.9		comp-sys-man		.man
+./usr/share/man/man9/rw_lock_op.9		comp-sys-man		.man
 ./usr/share/man/man9/rw_read_held.9		comp-sys-man		.man
 ./usr/share/man/man9/rw_tryenter.9		comp-sys-man		.man
 ./usr/share/man/man9/rw_tryupgrade.9		comp-sys-man		.man

Index: src/share/man/man9/rwlock.9
diff -u src/share/man/man9/rwlock.9:1.19 src/share/man/man9/rwlock.9:1.20
--- src/share/man/man9/rwlock.9:1.19	Mon Dec 10 20:12:36 2018
+++ src/share/man/man9/rwlock.9	Sat Feb 22 21:24:45 2020
@@ -1,6 +1,6 @@
-.\"	$NetBSD: rwlock.9,v 1.19 2018/12/10 20:12:36 jdolecek Exp $
+.\"	$NetBSD: rwlock.9,v 1.20 2020/02/22 21:24:45 ad Exp $
 .\"
-.\" Copyright (c) 2006, 2007, 2009 The NetBSD Foundation, Inc.
+.\" Copyright (c) 2006, 2007, 2009, 2020 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 10, 2018
+.Dd February 22, 2020
 .Dt RWLOCK 9
 .Os
 .Sh NAME
@@ -41,7 +41,8 @@
 .Nm rw_downgrade ,
 .Nm rw_read_held ,
 .Nm rw_write_held ,
-.Nm rw_lock_held
+.Nm rw_lock_held ,
+.Nm rw_lock_op
 .Nd reader / writer lock primitives
 .Sh SYNOPSIS
 .In sys/rwlock.h
@@ -65,6 +66,8 @@
 .Fn rw_write_held "krwlock_t *rw"
 .Ft int
 .Fn rw_lock_held "krwlock_t *rw"
+.Ft krw_t
+.Fn rw_lock_op "krwlock_t *rw"
 .Pp
 .Cd "options DIAGNOSTIC"
 .Cd "options LOCKDEBUG"
@@ -130,8 +133,7 @@ If
 is specified as the argument to
 .Fa op ,
 acquire a read lock.
-If the lock is write held, the caller will block and not return until the
-hold is acquired.
+The caller may block and will not return until the hold is acquired.
 Callers must not recursively acquire read locks.
 .Pp
 If
@@ -172,6 +174,7 @@ Downgrade a lock from a write hold to a 
 Return non-zero if write lock is held by current lwp.
 Otherwise, return zero.
 .It Fn rw_read_held "rw"
+.Pp
 Returns non-zero if read lock is held by any lwp.
 Otherwise, return zero.
 .It Fn rw_lock_held "rw"
@@ -179,19 +182,28 @@ Otherwise, return zero.
 Returns non-zero if either read or write lock is held by any lwp.
 Otherwise, return zero.
 .Pp
-Functions
 .Fn rw_write_held ,
 .Fn rw_read_held ,
 and
 .Fn rw_lock_held
-must never be used to make locking decisions at run time:
-they are provided only for diagnostic purposes.
-They are also not atomic, hence they should only be used to assert
-that lock is held.
-The only exception is
+should not generally be used to make locking decisions at run time:
+they are provided for diagnostic purposes, for example making
+assertions.
+.Pp
+Negative assertions 

CVS commit: src/sys/kern

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:07:46 UTC 2020

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

Log Message:
exit1(): remove from the radix tree before setting zombie status, as
radix_tree_remove_node() can block on locks when freeing.

Reported-by: syzbot+02bf066c30f812b14...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.283 -r1.284 src/sys/kern/kern_exit.c

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

Modified files:

Index: src/sys/kern/kern_exit.c
diff -u src/sys/kern/kern_exit.c:1.283 src/sys/kern/kern_exit.c:1.284
--- src/sys/kern/kern_exit.c:1.283	Sat Feb 15 18:12:15 2020
+++ src/sys/kern/kern_exit.c	Sat Feb 22 21:07:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exit.c,v 1.283 2020/02/15 18:12:15 ad Exp $	*/
+/*	$NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.283 2020/02/15 18:12:15 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.284 2020/02/22 21:07:46 ad Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -551,6 +551,11 @@ exit1(struct lwp *l, int exitcode, int s
 	pcu_discard_all(l);
 
 	mutex_enter(p->p_lock);
+	/* Don't bother with p_treelock as no other LWPs remain. */
+	l2 = radix_tree_remove_node(>p_lwptree, (uint64_t)(l->l_lid - 1));
+	KASSERT(l2 == l);
+	KASSERT(radix_tree_empty_tree_p(>p_lwptree));
+	radix_tree_fini_tree(>p_lwptree);
 	/* Free the linux lwp id */
 	if ((l->l_pflag & LP_PIDLID) != 0 && l->l_lid != p->p_pid)
 		proc_free_pid(l->l_lid);
@@ -566,11 +571,6 @@ exit1(struct lwp *l, int exitcode, int s
 	p->p_nrlwps--;
 	p->p_nzlwps++;
 	p->p_ndlwps = 0;
-	/* Don't bother with p_treelock as no other LWPs remain. */
-	l2 = radix_tree_remove_node(>p_lwptree, (uint64_t)(l->l_lid - 1));
-	KASSERT(l2 == l);
-	KASSERT(radix_tree_empty_tree_p(>p_lwptree));
-	radix_tree_fini_tree(>p_lwptree);
 	mutex_exit(p->p_lock);
 
 	/*



CVS commit: src/sys/arch/alpha/alpha

2020-02-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb 22 20:29:16 UTC 2020

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

Log Message:
Fix a couple of printf formats in debug messages.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 src/sys/arch/alpha/alpha/machdep.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.358 src/sys/arch/alpha/alpha/machdep.c:1.359
--- src/sys/arch/alpha/alpha/machdep.c:1.358	Sat Feb 22 17:33:42 2020
+++ src/sys/arch/alpha/alpha/machdep.c	Sat Feb 22 20:29:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $ */
+/* $NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.359 2020/02/22 20:29:15 thorpej Exp $");
 
 #include 
 #include 
@@ -457,7 +457,7 @@ nobootinfo:
 	}
 
 #if 0
-	printf("Memory cluster count: %d\n", mddtp->mddt_cluster_cnt);
+	printf("Memory cluster count: %" PRIu64 "\n", mddtp->mddt_cluster_cnt);
 #endif
 
 	for (i = 0; i < mddtp->mddt_cluster_cnt; i++) {
@@ -601,7 +601,7 @@ nobootinfo:
 	maxmem = physmem;
 #if 0
 	printf("totalphysmem = %d\n", totalphysmem);
-	printf("physmem = %d\n", physmem);
+	printf("physmem = %lu\n", physmem);
 	printf("resvmem = %d\n", resvmem);
 	printf("unusedmem = %d\n", unusedmem);
 	printf("unknownmem = %d\n", unknownmem);



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

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 20:12:40 UTC 2020

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

Log Message:
add relaxed atomics, ok ad@ riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/x86_tlb.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_tlb.c
diff -u src/sys/arch/x86/x86/x86_tlb.c:1.15 src/sys/arch/x86/x86/x86_tlb.c:1.16
--- src/sys/arch/x86/x86/x86_tlb.c:1.15	Wed Jan 15 13:22:03 2020
+++ src/sys/arch/x86/x86/x86_tlb.c	Sat Feb 22 20:12:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_tlb.c,v 1.15 2020/01/15 13:22:03 ad Exp $	*/
+/*	$NetBSD: x86_tlb.c,v 1.16 2020/02/22 20:12:40 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008-2020 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.15 2020/01/15 13:22:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_tlb.c,v 1.16 2020/02/22 20:12:40 maxv Exp $");
 
 #include 
 #include 
@@ -90,7 +90,7 @@ typedef struct {
 #define	TP_GET_COUNT(tp)	((tp)->tp_store[TP_COUNT] & PAGE_MASK)
 #define	TP_GET_USERPMAP(tp)	((tp)->tp_store[TP_USERPMAP] & 1)
 #define	TP_GET_GLOBAL(tp)	((tp)->tp_store[TP_GLOBAL] & 1)
-#define	TP_GET_DONE(tp)		((tp)->tp_store[TP_DONE] & 1)
+#define	TP_GET_DONE(tp)		(atomic_load_relaxed(&(tp)->tp_store[TP_DONE]) & 1)
 #define	TP_GET_VA(tp, i)	((tp)->tp_store[(i)] & ~PAGE_MASK)
 
 #define	TP_INC_COUNT(tp)	((tp)->tp_store[TP_COUNT]++)
@@ -99,7 +99,7 @@ typedef struct {
 
 #define	TP_SET_USERPMAP(tp)	((tp)->tp_store[TP_USERPMAP] |= 1)
 #define	TP_SET_GLOBAL(tp)	((tp)->tp_store[TP_GLOBAL] |= 1)
-#define	TP_SET_DONE(tp)		((tp)->tp_store[TP_DONE] |= 1)
+#define	TP_SET_DONE(tp)		atomic_store_relaxed(&(tp)->tp_store[TP_DONE], 1)
 
 #define	TP_CLEAR(tp)		memset(__UNVOLATILE(tp), 0, sizeof(*(tp)));
 
@@ -409,7 +409,7 @@ pmap_tlb_shootnow(void)
 	KASSERT(TP_GET_DONE(ts) == 0);
 	while (atomic_cas_ptr(_tlb_packet, NULL,
 	__UNVOLATILE(ts)) != NULL) {
-		KASSERT(pmap_tlb_packet != ts);
+		KASSERT(atomic_load_relaxed(_tlb_packet) != ts);
 		/*
 		 * Don't bother with exponentional backoff, as the pointer
 		 * is in a dedicated cache line and only updated twice per
@@ -419,7 +419,7 @@ pmap_tlb_shootnow(void)
 		splx(s);
 		do {
 			x86_pause();
-		} while (pmap_tlb_packet != NULL);
+		} while (atomic_load_relaxed(_tlb_packet) != NULL);
 		s = splvm();
 
 		/*
@@ -509,7 +509,7 @@ pmap_tlb_intr(void)
 	 * seemingly active.
 	 */
 	if (atomic_dec_uint_nv(_tlb_pendcount) == 0) {
-		pmap_tlb_packet = NULL;
+		atomic_store_relaxed(_tlb_packet, NULL);
 		__insn_barrier();
 		TP_SET_DONE(source);
 	}



CVS commit: src/sys/kern

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 20:08:39 UTC 2020

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

Log Message:
Be less strict: when copyinstr() returns ENAMETOOLONG, it does initialize
the buffer, so mark it as such.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_msan.c

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

Modified files:

Index: src/sys/kern/subr_msan.c
diff -u src/sys/kern/subr_msan.c:1.7 src/sys/kern/subr_msan.c:1.8
--- src/sys/kern/subr_msan.c:1.7	Fri Jan 31 08:26:10 2020
+++ src/sys/kern/subr_msan.c	Sat Feb 22 20:08:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $	*/
+/*	$NetBSD: subr_msan.c,v 1.8 2020/02/22 20:08:39 maxv Exp $	*/
 
 /*
  * Copyright (c) 2019-2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.7 2020/01/31 08:26:10 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_msan.c,v 1.8 2020/02/22 20:08:39 maxv Exp $");
 
 #include 
 #include 
@@ -885,7 +885,7 @@ kmsan_copyinstr(const void *uaddr, void 
 	kmsan_check_arg(sizeof(uaddr) + sizeof(kaddr) +
 	sizeof(len) + sizeof(done), "copyinstr():args");
 	ret = copyinstr(uaddr, kaddr, len, &_done);
-	if (ret == 0)
+	if (ret == 0 || ret == ENAMETOOLONG)
 		kmsan_shadow_fill(kaddr, KMSAN_STATE_INITED, _done);
 	if (done != NULL) {
 		*done = _done;



CVS commit: src/tests/modules

2020-02-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Feb 22 19:54:35 UTC 2020

Modified Files:
src/tests/modules: t_modctl.c
src/tests/modules/k_helper: k_helper.c

Log Message:
Update the t_modctl test to ensure that static evcnts are added.

While here, remove the explicit call to sysctl_setup() routine,
since the module infrastructure already invokes such routines
automatically.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/modules/t_modctl.c
cvs rdiff -u -r1.6 -r1.7 src/tests/modules/k_helper/k_helper.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/modules/t_modctl.c
diff -u src/tests/modules/t_modctl.c:1.15 src/tests/modules/t_modctl.c:1.16
--- src/tests/modules/t_modctl.c:1.15	Sat Feb 22 00:24:15 2020
+++ src/tests/modules/t_modctl.c	Sat Feb 22 19:54:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_modctl.c,v 1.15 2020/02/22 00:24:15 kamil Exp $	*/
+/*	$NetBSD: t_modctl.c,v 1.16 2020/02/22 19:54:34 pgoyette Exp $	*/
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.15 2020/02/22 00:24:15 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v 1.16 2020/02/22 19:54:34 pgoyette Exp $");
 
 #include 
 #include 
@@ -39,18 +39,20 @@ __KERNEL_RCSID(0, "$NetBSD: t_modctl.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
 #include 
 
-enum presence_check { both_checks, stat_check, sysctl_check };
+enum presence_check { all_checks, stat_check, sysctl_check, evcnt_check };
 
 static void	check_permission(void);
 static bool	get_modstat_info(const char *, modstat_t *);
 static bool	get_sysctl(const char *, void *buf, const size_t);
 static bool	k_helper_is_present_stat(void);
 static bool	k_helper_is_present_sysctl(void);
+static bool	k_helper_is_present_evcnt(void);
 static bool	k_helper_is_present(enum presence_check);
 static int	load(prop_dictionary_t, bool, const char *, ...);
 static int	unload(const char *, bool);
@@ -173,6 +175,56 @@ k_helper_is_present_sysctl(void)
 
 /*
  * Returns a boolean indicating if the k_helper module was loaded
+ * successfully.  This implementation uses the module's evcnt
+ * to do the check.
+ */
+static bool
+k_helper_is_present_evcnt(void)
+{
+	const int mib[4] = {CTL_KERN, KERN_EVCNT, EVCNT_TYPE_ANY,
+	KERN_EVCNT_COUNT_ANY };
+	int error;
+	size_t newlen, buflen = 0;
+	void *buf0, *buf = NULL;
+	const struct evcnt_sysctl *evs, *last_evs;
+
+	for (;;) {
+		if (buflen)
+			buf = malloc(buflen);
+		error = sysctl(mib, __arraycount(mib), buf, , NULL, 0);
+		if (error) {
+			if (buf)
+free(buf);
+			return false;
+		}
+		if (newlen <= buflen) {
+			buflen = newlen;
+			break;
+		}
+		if (buf)
+			free(buf);
+		buflen = newlen;
+	}
+	evs = buf0 = buf;
+	last_evs = (void *)((char *)buf + buflen);
+	buflen /= sizeof(uint64_t);
+	while (evs < last_evs
+	&& buflen >= sizeof(*evs)/sizeof(uint64_t)
+	&& buflen >= evs->ev_len) {
+		if ( strncmp(evs->ev_strings, "k_helper", evs->ev_grouplen)
+		== 0) {
+			free(buf);
+			return true;
+		}
+		buflen -= evs->ev_len;
+		evs = (const void *)((const uint64_t *)evs + evs->ev_len);
+	}
+	free(buf);
+	return false;
+}
+
+/*
+ * Returns a boolean indicating if the k_helper module was loaded
  * successfully.  The 'how' parameter specifies the implementation to
  * use to do the check.
  */
@@ -182,9 +234,10 @@ k_helper_is_present(enum presence_check 
 	bool found;
 
 	switch (how) {
-	case both_checks:
+	case all_checks:
 		found = k_helper_is_present_stat();
 		ATF_CHECK(k_helper_is_present_sysctl() == found);
+		ATF_CHECK(k_helper_is_present_evcnt() == found);
 		break;
 
 	case stat_check:
@@ -195,6 +248,10 @@ k_helper_is_present(enum presence_check 
 		found = k_helper_is_present_sysctl();
 		break;
 
+	case evcnt_check:
+		found = k_helper_is_present_evcnt();
+		break;
+
 	default:
 		found = false;
 		assert(found);
@@ -435,11 +492,11 @@ ATF_TC_HEAD(cmd_stat, tc)
 }
 ATF_TC_BODY(cmd_stat, tc)
 {
-	ATF_CHECK(!k_helper_is_present(both_checks));
+	ATF_CHECK(!k_helper_is_present(all_checks));
 
 	load(NULL, true, "%s/k_helper/k_helper.kmod",
 	atf_tc_get_config_var(tc, "srcdir"));
-	ATF_CHECK(k_helper_is_present(both_checks));
+	ATF_CHECK(k_helper_is_present(all_checks));
 	{
 		modstat_t ms;
 		ATF_CHECK(get_modstat_info("k_helper", ));
@@ -450,7 +507,7 @@ ATF_TC_BODY(cmd_stat, tc)
 	}
 	unload("k_helper", true);
 
-	ATF_CHECK(!k_helper_is_present(both_checks));
+	ATF_CHECK(!k_helper_is_present(all_checks));
 }
 ATF_TC_CLEANUP(cmd_stat, tc)
 {

Index: src/tests/modules/k_helper/k_helper.c
diff -u src/tests/modules/k_helper/k_helper.c:1.6 src/tests/modules/k_helper/k_helper.c:1.7
--- src/tests/modules/k_helper/k_helper.c:1.6	Sun Jun  3 10:59:44 2012
+++ src/tests/modules/k_helper/k_helper.c	Sat Feb 22 19:54:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: 

CVS commit: src/sys/kern

2020-02-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Feb 22 19:51:57 UTC 2020

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

Log Message:
Teach module infrastructure to attach any static evcnts that might be
defined in a module, similar to the automatic invocation of sysctl(9)
setup functions.  As requested by riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/kern/kern_module.c

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

Modified files:

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.146 src/sys/kern/kern_module.c:1.147
--- src/sys/kern/kern_module.c:1.146	Wed Jan 22 22:39:27 2020
+++ src/sys/kern/kern_module.c	Sat Feb 22 19:51:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.146 2020/01/22 22:39:27 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.147 2020/02/22 19:51:57 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.146 2020/01/22 22:39:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.147 2020/02/22 19:51:57 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_module.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -983,8 +984,72 @@ module_load_sysctl(module_t *mod)
 			ls_funcp++;
 		}
 	}
-	else
-		error = 0;	/* no setup funcs registered */
+}
+
+/*
+ * module_load_evcnt
+ *
+ * Check to see if a non-builtin module has any static evcnt's defined;
+ * if so, attach them.
+ */
+
+static void
+module_load_evcnt(module_t *mod)
+{
+	struct evcnt * const *ls_evp;
+	void *ls_start;
+	size_t ls_size, count;
+	int error;
+
+	/*
+	 * Built-in modules' static evcnt stuff will be handled
+	 * automatically as part of general kernel initialization
+	 */
+	if (mod->mod_source == MODULE_SOURCE_KERNEL)
+		return;
+
+	error = kobj_find_section(mod->mod_kobj, "link_set_evcnts",
+	_start, _size);
+	if (error == 0) {
+		count = ls_size / sizeof(*ls_evp);
+		ls_evp = ls_start;
+		while (count--) {
+			evcnt_attach_static(*ls_evp++);
+		}
+	}
+}
+
+/*
+ * module_unload_evcnt
+ *
+ * Check to see if a non-builtin module has any static evcnt's defined;
+ * if so, detach them.
+ */
+
+static void
+module_unload_evcnt(module_t *mod)
+{
+	struct evcnt * const *ls_evp;
+	void *ls_start;
+	size_t ls_size, count;
+	int error;
+
+	/*
+	 * Built-in modules' static evcnt stuff will be handled
+	 * automatically as part of general kernel initialization
+	 */
+	if (mod->mod_source == MODULE_SOURCE_KERNEL)
+		return;
+
+	error = kobj_find_section(mod->mod_kobj, "link_set_evcnts",
+	_start, _size);
+	if (error == 0) {
+		count = ls_size / sizeof(*ls_evp);
+		ls_evp = (void *)((char *)ls_start + ls_size);
+		while (count--) {
+			evcnt_detach(*--ls_evp);
+		}
+	}
 }
 
 /*
@@ -1307,6 +1372,7 @@ module_do_load(const char *name, bool is
 	}
 
 	module_load_sysctl(mod);	/* Set-up module's sysctl if any */
+	module_load_evcnt(mod);		/* Attach any static evcnt needed */
 
 	/*
 	 * Good, the module loaded successfully.  Put it onto the
@@ -1395,10 +1461,12 @@ module_do_unload(const char *name, bool 
 	if (mod->mod_sysctllog) {
 		sysctl_teardown(>mod_sysctllog);
 	}
+	module_unload_evcnt(mod);
 	error = (*mod->mod_info->mi_modcmd)(MODULE_CMD_FINI, NULL);
 	module_active = prev_active;
 	if (error != 0) {
 		module_load_sysctl(mod);	/* re-enable sysctl stuff */
+		module_load_evcnt(mod);		/* and reenable evcnts */
 		module_print("cannot unload module `%s' error=%d", name,
 		error);
 		return error;



CVS commit: src/sys

2020-02-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Feb 22 19:49:11 UTC 2020

Modified Files:
src/sys/arch/arm/arm: fiq.c
src/sys/arch/x86/acpi: acpi_wakeup.c
src/sys/arch/x86/include: bus_private.h
src/sys/dev/audio: audio.c

Log Message:
remove some unnecessary includes of internal UVM headers.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/arm/fiq.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/acpi/acpi_wakeup.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/x86/include/bus_private.h
cvs rdiff -u -r1.52 -r1.53 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/arch/arm/arm/fiq.c
diff -u src/sys/arch/arm/arm/fiq.c:1.8 src/sys/arch/arm/arm/fiq.c:1.9
--- src/sys/arch/arm/arm/fiq.c:1.8	Wed Jan 24 09:04:44 2018
+++ src/sys/arch/arm/arm/fiq.c	Sat Feb 22 19:49:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: fiq.c,v 1.8 2018/01/24 09:04:44 skrll Exp $	*/
+/*	$NetBSD: fiq.c,v 1.9 2020/02/22 19:49:11 chs Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.8 2018/01/24 09:04:44 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.9 2020/02/22 19:49:11 chs Exp $");
 
 #include 
 #include 
@@ -44,8 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: fiq.c,v 1.8 
 #include 
 #include 
 
-#include 
-
 TAILQ_HEAD(, fiqhandler) fiqhandler_stack =
 TAILQ_HEAD_INITIALIZER(fiqhandler_stack);
 

Index: src/sys/arch/x86/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.51 src/sys/arch/x86/acpi/acpi_wakeup.c:1.52
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.51	Sat Oct 12 06:31:03 2019
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Sat Feb 22 19:49:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.51 2019/10/12 06:31:03 maxv Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.52 2020/02/22 19:49:11 chs Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2011 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.51 2019/10/12 06:31:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.52 2020/02/22 19:49:11 chs Exp $");
 
 #include 
 #include 
@@ -70,7 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.
 #include 
 
 #include 
-#include 
 
 #ifdef __i386__
 #include "opt_mtrr.h"

Index: src/sys/arch/x86/include/bus_private.h
diff -u src/sys/arch/x86/include/bus_private.h:1.14 src/sys/arch/x86/include/bus_private.h:1.15
--- src/sys/arch/x86/include/bus_private.h:1.14	Thu Sep  1 15:10:31 2011
+++ src/sys/arch/x86/include/bus_private.h	Sat Feb 22 19:49:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_private.h,v 1.14 2011/09/01 15:10:31 christos Exp $	*/
+/*	$NetBSD: bus_private.h,v 1.15 2020/02/22 19:49:11 chs Exp $	*/
 /*	NetBSD: bus.h,v 1.8 2005/03/09 19:04:46 matt Exp	*/
 
 /*-
@@ -128,7 +128,7 @@ struct x86_bus_dma_cookie {
 #endif /* _BUS_PMAP_ENTER */
 
 #if !defined(_BUS_VIRT_TO_BUS)
-#include 
+#include 
 
 static __inline bus_addr_t _bus_virt_to_bus(struct pmap *, vaddr_t);
 #define	_BUS_VIRT_TO_BUS(pm, va) _bus_virt_to_bus((pm), (va))

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.52 src/sys/dev/audio/audio.c:1.53
--- src/sys/dev/audio/audio.c:1.52	Sat Feb 22 08:15:09 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 22 19:49:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.53 2020/02/22 19:49:11 chs Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.53 2020/02/22 19:49:11 chs Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -188,7 +188,7 @@ __KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.
 
 #include 
 
-#include 
+#include 
 
 #include "ioconf.h"
 



CVS commit: src/sys

2020-02-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Feb 22 19:46:49 UTC 2020

Modified Files:
src/sys/arch/xen/xen: privcmd.c
src/sys/external/bsd/drm2/dist/drm/i915: i915_gem.c
src/sys/external/bsd/drm2/drm: drm_gem_cma_helper.c
src/sys/uvm: uvm_device.c

Log Message:
do not wait for memory in pgo_fault methods, just return ENOMEM
and let the uvm_fault code wait if it is appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.59 -r1.60 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c
cvs rdiff -u -r1.67 -r1.68 src/sys/uvm/uvm_device.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/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.51 src/sys/arch/xen/xen/privcmd.c:1.52
--- src/sys/arch/xen/xen/privcmd.c:1.51	Thu Jun 22 22:36:50 2017
+++ src/sys/arch/xen/xen/privcmd.c	Sat Feb 22 19:46:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.51 2017/06/22 22:36:50 chs Exp $ */
+/* $NetBSD: privcmd.c,v 1.52 2020/02/22 19:46:48 chs Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.51 2017/06/22 22:36:50 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.52 2020/02/22 19:46:48 chs Exp $");
 
 #include 
 #include 
@@ -502,7 +502,6 @@ privpgop_fault(struct uvm_faultinfo *ufi
 		PMAP_CANFAIL | ufi->entry->protection,
 		pobj->domid);
 		if (error == ENOMEM) {
-			error = ERESTART;
 			break;
 		}
 		if (error) {
@@ -513,10 +512,6 @@ privpgop_fault(struct uvm_faultinfo *ufi
 	}
 	pmap_update(ufi->orig_map->pmap);
 	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
-
-	if (error == ERESTART) {
-		uvm_wait("privpgop_fault");
-	}
 	return error;
 }
 

Index: src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.59 src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.60
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c:1.59	Fri Feb 14 14:34:58 2020
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_gem.c	Sat Feb 22 19:46:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem.c,v 1.59 2020/02/14 14:34:58 maya Exp $	*/
+/*	$NetBSD: i915_gem.c,v 1.60 2020/02/22 19:46:48 chs Exp $	*/
 
 /*
  * Copyright © 2008-2015 Intel Corporation
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem.c,v 1.59 2020/02/14 14:34:58 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem.c,v 1.60 2020/02/22 19:46:48 chs Exp $");
 
 #ifdef __NetBSD__
 #if 0/* XXX uvmhist option?  */
@@ -2052,8 +2052,6 @@ unlock:
 out:
 	mutex_enter(uobj->vmobjlock);
 	uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
-	if (ret == -ERESTART)
-		uvm_wait("i915flt");
 
 	/*
 	 * Remap EINTR to success, so that we return to userland.
@@ -2087,7 +2085,7 @@ i915_udv_fault(struct uvm_faultinfo *ufi
 	off_t curr_offset;
 	paddr_t paddr;
 	u_int mmapflags;
-	int lcv, retval;
+	int lcv;
 	vm_prot_t mapprot;
 	UVMHIST_FUNC("i915_udv_fault"); UVMHIST_CALLED(maphist);
 	UVMHIST_LOG(maphist,"  flags=%jd", flags,0,0,0);
@@ -2119,7 +2117,6 @@ i915_udv_fault(struct uvm_faultinfo *ufi
 	 * loop over the page range entering in as needed
 	 */
 
-	retval = 0;
 	for (lcv = 0 ; lcv < npages ; lcv++, curr_offset += PAGE_SIZE,
 	curr_va += PAGE_SIZE) {
 		if ((flags & PGO_ALLPAGES) == 0 && lcv != centeridx)
@@ -2147,12 +2144,12 @@ i915_udv_fault(struct uvm_faultinfo *ufi
 			 * XXX case.
 			 */
 			pmap_update(ufi->orig_map->pmap);	/* sync what we have so far */
-			return (ERESTART);
+			return ENOMEM;
 		}
 	}
 
 	pmap_update(ufi->orig_map->pmap);
-	return (retval);
+	return 0;
 }
 #else
 /**

Index: src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c
diff -u src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.9 src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.10
--- src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c:1.9	Tue Nov  5 23:29:28 2019
+++ src/sys/external/bsd/drm2/drm/drm_gem_cma_helper.c	Sat Feb 22 19:46:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: drm_gem_cma_helper.c,v 1.9 2019/11/05 23:29:28 jmcneill Exp $ */
+/* $NetBSD: drm_gem_cma_helper.c,v 1.10 2020/02/22 19:46:48 chs Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.9 2019/11/05 23:29:28 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_gem_cma_helper.c,v 1.10 2020/02/22 19:46:48 chs Exp $");
 
 #include 
 #include 
@@ -246,8 +246,7 @@ drm_gem_cma_fault(struct uvm_faultinfo *
 		PMAP_CANFAIL | mapprot | mmapflags) != 0) {
 			pmap_update(ufi->orig_map->pmap);
 			uvmfault_unlockall(ufi, ufi->entry->aref.ar_amap, uobj);
-			uvm_wait("drm_gem_cma_fault");
-			return ERESTART;
+			return ENOMEM;
 		}
 	}
 

Index: src/sys/uvm/uvm_device.c

CVS commit: src/tests/lib/libc/sys

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 19:44:07 UTC 2020

Modified Files:
src/tests/lib/libc/sys: Makefile t_ptrace_wait.c t_ptrace_wait.h

Log Message:
Disable t_ptrace_wait* tests for MKSANITIZER/MKLIBCSANITIZER

A subset of tests is not compatible with the sanitizers.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.164 -r1.165 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.21 -r1.22 src/tests/lib/libc/sys/t_ptrace_wait.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/lib/libc/sys/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.57 src/tests/lib/libc/sys/Makefile:1.58
--- src/tests/lib/libc/sys/Makefile:1.57	Sun Jun 30 21:20:04 2019
+++ src/tests/lib/libc/sys/Makefile	Sat Feb 22 19:44:07 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.57 2019/06/30 21:20:04 mgorny Exp $
+# $NetBSD: Makefile,v 1.58 2020/02/22 19:44:07 kamil Exp $
 
 MKMAN=	no
 
@@ -110,6 +110,15 @@ CPPFLAGS.t_ptrace_waitid.c	+= -D_KERNTYP
 CPPFLAGS.t_ptrace_waitpid.c	+= -D_KERNTYPES -D__TEST_FENV
 CPPFLAGS.t_ucontext.c		+= -D_KERNTYPES
 
+.if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes"
+CPPFLAGS.t_ptrace_wait.c	+= -DENABLE_TESTS
+CPPFLAGS.t_ptrace_wait3.c	+= -DENABLE_TESTS
+CPPFLAGS.t_ptrace_wait4.c	+= -DENABLE_TESTS
+CPPFLAGS.t_ptrace_wait6.c	+= -DENABLE_TESTS
+CPPFLAGS.t_ptrace_waitid.c	+= -DENABLE_TESTS
+CPPFLAGS.t_ptrace_waitpid.c	+= -DENABLE_TESTS
+.endif
+
 FILES=		truncate_test.root_owned
 FILESBUILD=	yes
 FILESDIR_truncate_test.root_owned=	${TESTSDIR}

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.164 src/tests/lib/libc/sys/t_ptrace_wait.c:1.165
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.164	Thu Feb 20 22:38:54 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Sat Feb 22 19:44:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.164 2020/02/20 22:38:54 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.165 2020/02/22 19:44:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.164 2020/02/20 22:38:54 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.165 2020/02/22 19:44:07 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -76,6 +76,8 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.16
 
 #include 
 
+#ifdef ENABLE_TESTS
+
 /* Assumptions in the kernel code that must be kept. */
 static_assert(sizeof(((struct ptrace_state *)0)->pe_report_event) ==
 sizeof(((siginfo_t *)0)->si_pe_report_event),
@@ -9016,11 +9018,29 @@ THREAD_CONCURRENT_TEST(thread_concurrent
 #include "t_ptrace_i386_wait.h"
 #include "t_ptrace_x86_wait.h"
 
+/// 
+
+#else
+ATF_TC(dummy);
+ATF_TC_HEAD(dummy, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "A dummy test");
+}
+
+ATF_TC_BODY(dummy, tc)
+{
+
+	// Dummy, skipped
+	// The ATF framework requires at least a single defined test.
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 	setvbuf(stdout, NULL, _IONBF, 0);
 	setvbuf(stderr, NULL, _IONBF, 0);
 
+#ifdef ENABLE_TESTS
 	ATF_TP_ADD_TC(tp, traceme_raise1);
 	ATF_TP_ADD_TC(tp, traceme_raise2);
 	ATF_TP_ADD_TC(tp, traceme_raise3);
@@ -9620,5 +9640,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TCS_PTRACE_WAIT_I386();
 	ATF_TP_ADD_TCS_PTRACE_WAIT_X86();
 
+#else
+	ATF_TP_ADD_TC(tp, dummy);
+#endif
+
 	return atf_no_error();
 }

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.21 src/tests/lib/libc/sys/t_ptrace_wait.h:1.22
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.21	Thu Feb 13 13:38:44 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Sat Feb 22 19:44:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.21 2020/02/13 13:38:44 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.22 2020/02/22 19:44:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -606,11 +606,6 @@ trigger_trap(void)
 #endif
 }
 
-#if defined(__clang__)
-__attribute__((no_sanitize("undefined")))
-#else
-__attribute__((no_sanitize_undefined))
-#endif
 static void __used
 trigger_segv(void)
 {
@@ -647,11 +642,6 @@ are_fpu_exceptions_supported(void)
 	return true;
 }
 
-#if defined(__clang__)
-__attribute__((no_sanitize("undefined")))
-#else
-__attribute__((no_sanitize_undefined))
-#endif
 static void __used
 trigger_fpe(void)
 {



CVS commit: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 19:37:31 UTC 2020

Modified Files:
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm:
vchiq_netbsd_acpi.c

Log Message:
build fix


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c

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

Modified files:

Index: src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c
diff -u src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.1 src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.2
--- src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c:1.1	Tue Dec 31 01:00:23 2019
+++ src/sys/external/bsd/vchiq/dist/interface/vchiq_arm/vchiq_netbsd_acpi.c	Sat Feb 22 19:37:31 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $ */
+/* $NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.1 2019/12/31 01:00:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vchiq_netbsd_acpi.c,v 1.2 2020/02/22 19:37:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -105,7 +105,7 @@ vchiq_acpi_attach(device_t parent, devic
 		return;
 	}
 
-	if (bus_space_map(sc->sc_iot, mem->ar_base, mem->ar_size, 0,
+	if (bus_space_map(sc->sc_iot, mem->ar_base, mem->ar_length, 0,
 	>sc_ioh) != 0) {
 		aprint_error_dev(sc->sc_dev, "unable to map device\n");
 		return;



CVS commit: src/usr.bin/calendar/calendars

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 19:25:25 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Ivan Sutherland's birthday


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.39 src/usr.bin/calendar/calendars/calendar.birthday:1.40
--- src/usr.bin/calendar/calendars/calendar.birthday:1.39	Sat Feb 22 19:23:09 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Feb 22 19:25:25 2020
@@ -142,6 +142,7 @@
 05/12	Florence Nightingale born in Florence, Italy, 1820
 05/13	Arthur S. Sullivan born, 1842
 05/15	Mike Oldfield born in Essex, England, 1953
+05/16	Ivan Edward Sutherland was born in Hastings, Nebraska, 1938
 05/19	Ho Chi Minh born, 1890
 05/21	Plato (Aristocles) born in Athens(?), 427 BC
 05/27	Hubert H. Humphrey born, 1911



CVS commit: src/usr.bin/calendar/calendars

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 19:23:09 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Bert Sutherland
https://twitter.com/ComputerHistory/status/1230200277141250050


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.38 src/usr.bin/calendar/calendars/calendar.birthday:1.39
--- src/usr.bin/calendar/calendars/calendar.birthday:1.38	Sat Feb 22 19:21:40 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Feb 22 19:23:09 2020
@@ -63,6 +63,7 @@
 02/17	Marion Anderson born, 1902
 02/17	T. J. Watson, Sr. born, 1874
 02/18	Ernst Mach born, 1838, philosopher & optics pioneer
+02/18	William Robert "Bert" Sutherland died in Mountain View, California, 2020
 02/19	Nicolas Copernicus born in Thorn, Poland, 1473
 02/20	Ludwig Boltzmann born, 1838, atomic physics pioneer
 02/21	Alexis De Rochon born, 1838, developed the spyglass
@@ -134,6 +135,7 @@
 05/02	Dr. Benjamin Spock born, 1903
 05/09	Pinza died, 1957
 05/10	Fred Astaire (Frederick Austerlitz) born in Omaha, Nebraska, 1899
+05/10	William Robert "Bert" Sutherland was born in Hastings, Nebraska, 1936
 05/11	Douglas Adams died, 2001
 05/11	Johnny Appleseed born, 1768
 05/11	Richard Philips Feynman was born is Queens, New York, 1918



CVS commit: src/usr.bin/calendar/calendars

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 19:21:41 UTC 2020

Modified Files:
src/usr.bin/calendar/calendars: calendar.birthday

Log Message:
Add Larry Tesler
https://www.nytimes.com/2020/02/20/technology/lawrence-tesler-dead.html


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.bin/calendar/calendars/calendar.birthday

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/calendar/calendars/calendar.birthday
diff -u src/usr.bin/calendar/calendars/calendar.birthday:1.37 src/usr.bin/calendar/calendars/calendar.birthday:1.38
--- src/usr.bin/calendar/calendars/calendar.birthday:1.37	Thu Jan 30 23:46:21 2020
+++ src/usr.bin/calendar/calendars/calendar.birthday	Sat Feb 22 19:21:40 2020
@@ -57,6 +57,7 @@
 02/15	Galileo Galilei born in Pisa, Italy, 1564
 02/15	Richard Philips Feynman died in Los Angeles, California, 1988
 02/15	Susan B. Anthony born, 1820
+02/16	Lawrence Gordon Tesler died in Portola Valley, California, 2020
 02/16	Pierre Bouguer born, 1698, founder of photometry
 02/17	Frederick Eugene Ives born, 1856, pioneer of halftone
 02/17	Marion Anderson born, 1902
@@ -122,6 +123,7 @@
 04/15	Leonardo da Vinci born, 1452
 04/16	Charles (Charlie) Chaplin (Sir) born in London, 1889
 04/22	Immanuel Kant born, 1724
+04/24	Lawrence Gordon Tesler was born in The Bronx, New York City, 1945
 04/27	Louis Victor de Broglie born, 1774, physicist
 04/28	James Monroe born, 1758
 04/29	Jules Henri Poincare born, 1854, founder of topology



CVS commit: src/tests/lib/libc/gen

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 19:14:57 UTC 2020

Modified Files:
src/tests/lib/libc/gen: Makefile

Log Message:
Update t_siginfo.c build rules

Add logic for MKSANITIZER/MKLIBCSANITIZER checks.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/tests/lib/libc/gen/Makefile

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

Modified files:

Index: src/tests/lib/libc/gen/Makefile
diff -u src/tests/lib/libc/gen/Makefile:1.53 src/tests/lib/libc/gen/Makefile:1.54
--- src/tests/lib/libc/gen/Makefile:1.53	Fri Apr 26 19:17:05 2019
+++ src/tests/lib/libc/gen/Makefile	Sat Feb 22 19:14:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.53 2019/04/26 19:17:05 maya Exp $
+# $NetBSD: Makefile,v 1.54 2020/02/22 19:14:57 kamil Exp $
 
 .include 
 
@@ -39,6 +39,10 @@ TESTS_C+=	t_time
 TESTS_C+=	t_ttyname
 TESTS_C+=	t_vis
 
+.if ${MKSANITIZER:Uno} != "yes" && ${MKLIBCSANITIZER:Uno} != "yes"
+COPTS.t_siginfo.c+=	-DENABLE_TESTS
+.endif
+
 CPPFLAGS.t_siginfo.c+=-D__TEST_FENV
 COPTS.t_fpsetround.c+=${${ACTIVE_CC} == "gcc":? -frounding-math :}
 



CVS commit: src/tests/lib/libc/gen

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 19:09:51 UTC 2020

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c

Log Message:
Disable the t_siginfo test under MKSANITIZER / MKLIBCSANITIZER

Signal crash events are incompatible with sanitizers.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/tests/lib/libc/gen/t_siginfo.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/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.38 src/tests/lib/libc/gen/t_siginfo.c:1.39
--- src/tests/lib/libc/gen/t_siginfo.c:1.38	Fri Feb 21 22:25:50 2020
+++ src/tests/lib/libc/gen/t_siginfo.c	Sat Feb 22 19:09:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.38 2020/02/21 22:25:50 kamil Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.39 2020/02/22 19:09:51 kamil Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@
 
 #include "isqemu.h"
 
+#ifdef ENABLE_TESTS
 /* for sigbus */
 volatile char *addr;
 
@@ -361,18 +362,6 @@ ATF_TC_HEAD(sigfpe_int, tc)
 	"for integer div-by-zero (PR port-i386/43655)");
 }
 
-#if defined(__clang__)
-__attribute__((no_sanitize("undefined")))
-#else   
-__attribute__((no_sanitize_undefined))
-#endif
-static long int
-sigfpe_int_division(long int a, long int b)
-{
-
-	return a / b;
-}
-
 ATF_TC_BODY(sigfpe_int, tc)
 {
 	struct sigaction sa;
@@ -391,7 +380,7 @@ ATF_TC_BODY(sigfpe_int, tc)
 #elif defined(_FLOAT_IEEE754)
 		fpsetmask(FP_X_INV|FP_X_DZ|FP_X_OFL|FP_X_UFL|FP_X_IMP);
 #endif
-		printf("%ld\n", sigfpe_int_division(1, l));
+		printf("%ld\n", 1 / l);
 	}
 	if (intdiv_signalled == 0)
 		atf_tc_fail("FPE signal handler was not invoked");
@@ -508,9 +497,25 @@ ATF_TC_BODY(sigbus_adraln, tc)
 	atf_tc_fail("Test did not fault as expected");
 }
 
+#else
+ATF_TC(dummy);
+ATF_TC_HEAD(dummy, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "A dummy test");
+}
+
+ATF_TC_BODY(dummy, tc)
+{
+
+	// Dummy, skipped
+	// The ATF framework requires at least a single defined test.
+}
+#endif
+
 ATF_TP_ADD_TCS(tp)
 {
 
+#ifdef ENABLE_TESTS
 	ATF_TP_ADD_TC(tp, sigalarm);
 	ATF_TP_ADD_TC(tp, sigchild_normal);
 	ATF_TP_ADD_TC(tp, sigchild_dump);
@@ -519,6 +524,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, sigfpe_int);
 	ATF_TP_ADD_TC(tp, sigsegv);
 	ATF_TP_ADD_TC(tp, sigbus_adraln);
+#else
+	ATF_TP_ADD_TC(tp, dummy);
+#endif
 
 	return atf_no_error();
 }



CVS commit: src/games/fortune/datfiles

2020-02-22 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat Feb 22 19:03:04 UTC 2020

Modified Files:
src/games/fortune/datfiles: fortunes

Log Message:
Andrew Weatherall's tattoo and a track on A Pox On The Pioneers album.
https://pbs.twimg.com/media/ERAuddhU4AAFv3w?format=jpg=orig
Story:
https://www.dummymag.com/features/andrew-weatherall-interview-it-s-bollocks-it-s-discos-tell-me-tales-of-the/


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/games/fortune/datfiles/fortunes

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

Modified files:

Index: src/games/fortune/datfiles/fortunes
diff -u src/games/fortune/datfiles/fortunes:1.87 src/games/fortune/datfiles/fortunes:1.88
--- src/games/fortune/datfiles/fortunes:1.87	Sun Feb 16 23:14:19 2020
+++ src/games/fortune/datfiles/fortunes	Sat Feb 22 19:03:04 2020
@@ -16292,3 +16292,5 @@ I wonder why I wonder!
 %
 Fanfare, n.:
 The food available for consumption at a con.
+%
+Fail we may, sail we must



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

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 18:57:50 UTC 2020

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

Log Message:
Add brgphy


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.139 src/sys/arch/evbarm/conf/GENERIC64:1.140
--- src/sys/arch/evbarm/conf/GENERIC64:1.139	Sat Feb 22 02:28:06 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Sat Feb 22 18:57:50 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.139 2020/02/22 02:28:06 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.140 2020/02/22 18:57:50 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -337,6 +337,7 @@ wm*		at pci? dev ? function ?	# Intel Gi
 
 # MII/PHY support
 atphy*		at mii? phy ?		# Attansic/Atheros PHYs
+brgphy*		at mii? phy ?		# Broadcom BCM5400-family PHYs
 exphy* 		at mii? phy ?		# 3Com internal PHYs
 gentbi* 	at mii? phy ?		# Generic Ten-Bit 1000BASE-[CLS]X PHYs
 glxtphy*	at mii? phy ?		# Level One LXT-1000 PHYs



CVS commit: src/sys/dev/mii

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 18:57:31 UTC 2020

Modified Files:
src/sys/dev/mii: brgphy.c

Log Message:
Match BCM54213PE


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/mii/brgphy.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/mii/brgphy.c
diff -u src/sys/dev/mii/brgphy.c:1.86 src/sys/dev/mii/brgphy.c:1.87
--- src/sys/dev/mii/brgphy.c:1.86	Wed Nov 27 10:19:20 2019
+++ src/sys/dev/mii/brgphy.c	Sat Feb 22 18:57:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphy.c,v 1.86 2019/11/27 10:19:20 msaitoh Exp $	*/
+/*	$NetBSD: brgphy.c,v 1.87 2020/02/22 18:57:31 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.86 2019/11/27 10:19:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: brgphy.c,v 1.87 2020/02/22 18:57:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -178,6 +178,7 @@ static const struct mii_phydesc brgphys[
 	MII_PHY_DESC(BROADCOM3, BCM5720C),
 	MII_PHY_DESC(BROADCOM3, BCM57765),
 	MII_PHY_DESC(BROADCOM3, BCM57780),
+	MII_PHY_DESC(BROADCOM4, BCM54213PE),
 	MII_PHY_DESC(BROADCOM4, BCM5725C),
 	MII_PHY_DESC(xxBROADCOM_ALT1, BCM5906),
 	MII_PHY_END,



CVS commit: src/sys/dev/mii

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 18:57:09 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/mii/miidevs_data.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/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.160 src/sys/dev/mii/miidevs.h:1.161
--- src/sys/dev/mii/miidevs.h:1.160	Wed Feb  5 06:38:36 2020
+++ src/sys/dev/mii/miidevs.h	Sat Feb 22 18:57:09 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.160 2020/02/05 06:38:36 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.161 2020/02/22 18:57:09 jmcneill Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp
+ *	NetBSD: miidevs,v 1.163 2020/02/22 18:56:57 jmcneill Exp
  */
 
 /*-
@@ -302,6 +302,8 @@
 #define	MII_STR_BROADCOM3_BCM53125	"BCM53125 1000BASE-T switch"
 #define	MII_MODEL_BROADCOM3_BCM5720C	0x0036
 #define	MII_STR_BROADCOM3_BCM5720C	"BCM5720C 1000BASE-T media interface"
+#define	MII_MODEL_BROADCOM4_BCM54213PE	0x000a
+#define	MII_STR_BROADCOM4_BCM54213PE	"BCM54213PE 1000BASE-T media interface"
 #define	MII_MODEL_BROADCOM4_BCM5725C	0x0038
 #define	MII_STR_BROADCOM4_BCM5725C	"BCM5725C 1000BASE-T media interface"
 #define	MII_MODEL_xxBROADCOM_ALT1_BCM5906	0x0004

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.148 src/sys/dev/mii/miidevs_data.h:1.149
--- src/sys/dev/mii/miidevs_data.h:1.148	Wed Feb  5 06:38:36 2020
+++ src/sys/dev/mii/miidevs_data.h	Sat Feb 22 18:57:09 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.148 2020/02/05 06:38:36 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.149 2020/02/22 18:57:09 jmcneill Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp
+ *	NetBSD: miidevs,v 1.163 2020/02/22 18:56:57 jmcneill Exp
  */
 
 /*-
@@ -118,6 +118,7 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM57765, MII_STR_BROADCOM3_BCM57765 },
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM53125, MII_STR_BROADCOM3_BCM53125 },
  { MII_OUI_BROADCOM3, MII_MODEL_BROADCOM3_BCM5720C, MII_STR_BROADCOM3_BCM5720C },
+ { MII_OUI_BROADCOM4, MII_MODEL_BROADCOM4_BCM54213PE, MII_STR_BROADCOM4_BCM54213PE },
  { MII_OUI_BROADCOM4, MII_MODEL_BROADCOM4_BCM5725C, MII_STR_BROADCOM4_BCM5725C },
  { MII_OUI_xxBROADCOM_ALT1, MII_MODEL_xxBROADCOM_ALT1_BCM5906, MII_STR_xxBROADCOM_ALT1_BCM5906 },
  { MII_OUI_xxCICADA, MII_MODEL_xxCICADA_CIS8201, MII_STR_xxCICADA_CIS8201 },



CVS commit: src/sys/dev/mii

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 18:56:57 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
Add BCM54213PE


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.162 src/sys/dev/mii/miidevs:1.163
--- src/sys/dev/mii/miidevs:1.162	Wed Feb  5 06:38:20 2020
+++ src/sys/dev/mii/miidevs	Sat Feb 22 18:56:57 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.162 2020/02/05 06:38:20 msaitoh Exp $
+$NetBSD: miidevs,v 1.163 2020/02/22 18:56:57 jmcneill Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -219,6 +219,7 @@ model BROADCOM3 BCM5719C	0x0022 BCM5719C
 model BROADCOM3 BCM57765	0x0024 BCM57765 1000BASE-T media interface
 model BROADCOM3 BCM53125	0x0032 BCM53125 1000BASE-T switch
 model BROADCOM3 BCM5720C	0x0036 BCM5720C 1000BASE-T media interface
+model BROADCOM4 BCM54213PE	0x000a BCM54213PE 1000BASE-T media interface
 model BROADCOM4 BCM5725C	0x0038 BCM5725C 1000BASE-T media interface
 model xxBROADCOM_ALT1 BCM5906	0x0004 BCM5906 10/100baseTX media interface
 



CVS commit: src/sys/arch/alpha/alpha

2020-02-22 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Feb 22 17:33:42 UTC 2020

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

Log Message:
Make it clear that the pfn argument to alpha_init() is no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/alpha/alpha/machdep.c

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

Modified files:

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.357 src/sys/arch/alpha/alpha/machdep.c:1.358
--- src/sys/arch/alpha/alpha/machdep.c:1.357	Tue Dec 31 13:07:09 2019
+++ src/sys/arch/alpha/alpha/machdep.c	Sat Feb 22 17:33:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.357 2019/12/31 13:07:09 ad Exp $ */
+/* $NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2019 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.357 2019/12/31 13:07:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.358 2020/02/22 17:33:42 thorpej Exp $");
 
 #include 
 #include 
@@ -216,8 +216,9 @@ const pcu_ops_t * const pcu_ops_md_defs[
 };
 
 void
-alpha_init(u_long pfn, u_long ptb, u_long bim, u_long bip, u_long biv)
-	/* pfn:		 first free PFN number */
+alpha_init(u_long xxx_pfn __unused, u_long ptb, u_long bim, u_long bip,
+u_long biv)
+	/* pfn:		 first free PFN number (no longer used) */
 	/* ptb:		 PFN of current level 1 page table */
 	/* bim:		 bootinfo magic */
 	/* bip:		 bootinfo pointer */



CVS commit: src/common/lib/libc/stdlib

2020-02-22 Thread Santhosh Raju
Module Name:src
Committed By:   fox
Date:   Sat Feb 22 14:47:29 UTC 2020

Modified Files:
src/common/lib/libc/stdlib: random.c

Log Message:
common/lib/libc/stdlib: Fix possible signed integer overflow.

common/lib/libc/stdlib/random.c:482:6 can result in signed integer overflow.

This bug was reported by UBSan runs.

The change has been tested using the following program to generate random 
numbers
in both the old and the new library and can be used to verify the correctness 
of the
library after the change.

#include 
#include 

#define COUNT 1000 * 1000

int
main(void)
{
int i;
FILE *fp = fopen("numbers.txt", "w");

srandom(0xdeadbeef);

for(i = 0; i < COUNT; i++) {
fprintf(fp, "%ld\n", random());
}

fclose(fp);

return 0;
}

Reviewed by: riastradh@ , kamil@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/stdlib/random.c

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

Modified files:

Index: src/common/lib/libc/stdlib/random.c
diff -u src/common/lib/libc/stdlib/random.c:1.5 src/common/lib/libc/stdlib/random.c:1.6
--- src/common/lib/libc/stdlib/random.c:1.5	Mon Feb  8 05:27:24 2016
+++ src/common/lib/libc/stdlib/random.c	Sat Feb 22 14:47:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: random.c,v 1.5 2016/02/08 05:27:24 dholland Exp $	*/
+/*	$NetBSD: random.c,v 1.6 2020/02/22 14:47:29 fox Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -35,7 +35,7 @@
 #if 0
 static char sccsid[] = "@(#)random.c	8.2 (Berkeley) 5/19/95";
 #else
-__RCSID("$NetBSD: random.c,v 1.5 2016/02/08 05:27:24 dholland Exp $");
+__RCSID("$NetBSD: random.c,v 1.6 2020/02/22 14:47:29 fox Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -189,7 +189,7 @@ static const int seps[MAX_TYPES] =	{ SEP
  */
 
 /* LINTED */
-static int randtbl[DEG_3 + 1] = {
+static uint32_t randtbl[DEG_3 + 1] = {
 	TYPE_3,
 #ifdef USE_BETTER_RANDOM
 	0x991539b1, 0x16a5bce3, 0x6774a4cd,
@@ -232,8 +232,8 @@ static int randtbl[DEG_3 + 1] = {
  * in the initialization of randtbl) because the state table pointer is set
  * to point to randtbl[1] (as explained below).
  */
-static int *fptr = [SEP_3 + 1];
-static int *rptr = [1];
+static uint32_t *fptr = [SEP_3 + 1];
+static uint32_t *rptr = [1];
 
 /*
  * The following things are the pointer to the state information table, the
@@ -245,11 +245,11 @@ static int *rptr = [1];
  * this is more efficient than indexing every time to find the address of
  * the last element to see if the front and rear pointers have wrapped.
  */
-static int *state = [1];
+static uint32_t *state = [1];
 static int rand_type = TYPE_3;
 static int rand_deg = DEG_3;
 static int rand_sep = SEP_3;
-static int *end_ptr = [DEG_3 + 1];
+static uint32_t *end_ptr = [DEG_3 + 1];
 
 /*
  * srandom:
@@ -340,17 +340,17 @@ initstate(
 	size_t n)			/* # bytes of state info */
 {
 	void *ostate = (void *)([-1]);
-	int *int_arg_state;
+	uint32_t *int_arg_state;
 
 	_DIAGASSERT(arg_state != NULL);
 
-	int_arg_state = (int *)(void *)arg_state;
+	int_arg_state = (uint32_t *)(void *)arg_state;
 
 	mutex_lock(_mutex);
 	if (rand_type == TYPE_0)
 		state[-1] = rand_type;
 	else
-		state[-1] = MAX_TYPES * (int)(rptr - state) + rand_type;
+		state[-1] = MAX_TYPES * (uint32_t)(rptr - state) + rand_type;
 	if (n < BREAK_0) {
 		mutex_unlock(_mutex);
 		return (NULL);
@@ -375,13 +375,13 @@ initstate(
 		rand_deg = DEG_4;
 		rand_sep = SEP_4;
 	}
-	state = (int *) (int_arg_state + 1); /* first location */
+	state = (uint32_t *) (int_arg_state + 1); /* first location */
 	end_ptr = [rand_deg];	/* must set end_ptr before srandom */
 	srandom_unlocked(seed);
 	if (rand_type == TYPE_0)
 		int_arg_state[0] = rand_type;
 	else
-		int_arg_state[0] = MAX_TYPES * (int)(rptr - state) + rand_type;
+		int_arg_state[0] = MAX_TYPES * (uint32_t)(rptr - state) + rand_type;
 	mutex_unlock(_mutex);
 	return((char *)ostate);
 }
@@ -408,22 +408,22 @@ initstate(
 char *
 setstate(char *arg_state)		/* pointer to state array */
 {
-	int *new_state;
-	int type;
-	int rear;
+	uint32_t *new_state;
+	uint32_t type;
+	uint32_t rear;
 	void *ostate = (void *)([-1]);
 
 	_DIAGASSERT(arg_state != NULL);
 
-	new_state = (int *)(void *)arg_state;
-	type = (int)(new_state[0] % MAX_TYPES);
-	rear = (int)(new_state[0] / MAX_TYPES);
+	new_state = (uint32_t *)(void *)arg_state;
+	type = (uint32_t)(new_state[0] % MAX_TYPES);
+	rear = (uint32_t)(new_state[0] / MAX_TYPES);
 
 	mutex_lock(_mutex);
 	if (rand_type == TYPE_0)
 		state[-1] = rand_type;
 	else
-		state[-1] = MAX_TYPES * (int)(rptr - state) + rand_type;
+		state[-1] = MAX_TYPES * (uint32_t)(rptr - state) + rand_type;
 	switch(type) {
 	case TYPE_0:
 	case TYPE_1:
@@ -438,7 +438,7 @@ setstate(char *arg_state)		/* pointer to
 		mutex_unlock(_mutex);
 		return (NULL);
 	}
-	state = (int *) (new_state + 1);
+	state = (uint32_t *) (new_state + 1);
 	if (rand_type != 

CVS commit: src/sbin/modstat

2020-02-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Feb 22 14:26:18 UTC 2020

Modified Files:
src/sbin/modstat: modstat.8

Log Message:
Clarify that the -k option only provides the address of the module's
text segment.  The addresses of any other segments are not available.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sbin/modstat/modstat.8

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

Modified files:

Index: src/sbin/modstat/modstat.8
diff -u src/sbin/modstat/modstat.8:1.26 src/sbin/modstat/modstat.8:1.27
--- src/sbin/modstat/modstat.8:1.26	Sat Dec  7 12:35:27 2019
+++ src/sbin/modstat/modstat.8	Sat Feb 22 14:26:18 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: modstat.8,v 1.26 2019/12/07 12:35:27 wiz Exp $
+.\" $NetBSD: modstat.8,v 1.27 2020/02/22 14:26:18 pgoyette Exp $
 .\"
 .\" Copyright (c) 1993 Christopher G. Demetriou
 .\" All rights reserved.
@@ -32,7 +32,7 @@
 .\"
 .\" <>
 .\"
-.Dd December 5, 2019
+.Dd Februaru 22, 2020
 .Dt MODSTAT 8
 .Os
 .Sh NAME
@@ -64,7 +64,7 @@ take into consideration the sysctl
 .It Fl e
 Tells you whether or not you may load a module at the moment.
 .It Fl k
-Display the module's kernel address (disabled by default).
+Display the kernel address of the module's text segment (disabled by default).
 .It Fl n Ar name
 Display the status of only the module with this name.
 Please note that



CVS commit: src/lib/libc/stdlib

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 14:07:57 UTC 2020

Modified Files:
src/lib/libc/stdlib: _rand48.c

Log Message:
Avoid undefined behavior in the rand48(3) implementation

Instead of implicid promotion to signed int,
explicitly cast the arguments to unsigned int.

_rand48.c:53:27, signed integer overflow:
58989 * 58970 cannot be represented in type 'int'

_rand48.c:53:38, signed integer overflow:
-2093025904 + -1496809120 cannot be represented in type 'int'

_rand48.c:53:57, signed integer overflow:
57068 * 42787 cannot be represented in type 'int'

New and old code produce the same code as tested with:

#include 
#include 

#define COUNT 1000 * 1000

int
main(void)
{
FILE *fp;
int i;

fp = fopen("numbers.txt", "w+");
if (!fp)
abort();

for(i = 0; i < COUNT; i++) {
fprintf(fp, "%f\n", drand48());
fprintf(fp, "%ld\n", lrand48());
fprintf(fp, "%ld\n", mrand48());
}

fclose(fp);

return 0;
}


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/stdlib/_rand48.c

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

Modified files:

Index: src/lib/libc/stdlib/_rand48.c
diff -u src/lib/libc/stdlib/_rand48.c:1.8 src/lib/libc/stdlib/_rand48.c:1.9
--- src/lib/libc/stdlib/_rand48.c:1.8	Sat Feb 22 11:24:47 2020
+++ src/lib/libc/stdlib/_rand48.c	Sat Feb 22 14:07:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $	*/
+/*	$NetBSD: _rand48.c,v 1.9 2020/02/22 14:07:57 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Martin Birgmeier
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $");
+__RCSID("$NetBSD: _rand48.c,v 1.9 2020/02/22 14:07:57 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -50,7 +50,9 @@ __dorand48(unsigned short xseed[3])
 	accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
 	temp[1] = (unsigned short) accu;	/* middle 16 bits */
 	accu >>= sizeof(unsigned short) * 8;
-	accu += __rand48_mult[0] * xseed[2] + __rand48_mult[1] * xseed[1] + __rand48_mult[2] * xseed[0];
+	accu += (unsigned int) __rand48_mult[0] * (unsigned int) xseed[2];
+	accu += (unsigned int) __rand48_mult[1] * (unsigned int) xseed[1];
+	accu += (unsigned int) __rand48_mult[2] * (unsigned int) xseed[0];
 	xseed[0] = temp[0];
 	xseed[1] = temp[1];
 	xseed[2] = (unsigned short) accu;



CVS commit: src/lib/libc/sys

2020-02-22 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Feb 22 14:06:05 UTC 2020

Modified Files:
src/lib/libc/sys: modctl.2

Log Message:
Remove vestigial remnant of an earlier modification to the module
implementation.  There currently is no such thing as a module's
"alias".


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libc/sys/modctl.2

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

Modified files:

Index: src/lib/libc/sys/modctl.2
diff -u src/lib/libc/sys/modctl.2:1.17 src/lib/libc/sys/modctl.2:1.18
--- src/lib/libc/sys/modctl.2:1.17	Fri Dec  6 21:45:14 2019
+++ src/lib/libc/sys/modctl.2	Sat Feb 22 14:06:05 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: modctl.2,v 1.17 2019/12/06 21:45:14 pgoyette Exp $
+.\"	$NetBSD: modctl.2,v 1.18 2020/02/22 14:06:05 pgoyette Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 5, 2019
+.Dd February 22, 2020
 .Dt MODCTL 2
 .Os
 .Sh NAME
@@ -77,7 +77,7 @@ pointing to a suitable block of memory.
 The kernel will fill this block with
 .Bl -bullet 
 .It
-a count of the number of modules loaded (including aliases),
+a count of the number of modules loaded,
 .It
 an array of
 .Em modstat_t



CVS commit: src/sys/dev/ic

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 13:41:41 UTC 2020

Modified Files:
src/sys/dev/ic: bcmgenet.c bcmgenetreg.h

Log Message:
Add support for hardware rx filters.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/bcmgenet.c \
src/sys/dev/ic/bcmgenetreg.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/ic/bcmgenet.c
diff -u src/sys/dev/ic/bcmgenet.c:1.1 src/sys/dev/ic/bcmgenet.c:1.2
--- src/sys/dev/ic/bcmgenet.c:1.1	Sat Feb 22 00:28:35 2020
+++ src/sys/dev/ic/bcmgenet.c	Sat Feb 22 13:41:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenet.c,v 1.1 2020/02/22 00:28:35 jmcneill Exp $ */
+/* $NetBSD: bcmgenet.c,v 1.2 2020/02/22 13:41:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -34,7 +34,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.1 2020/02/22 00:28:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.2 2020/02/22 13:41:40 jmcneill Exp $");
 
 #include 
 #include 
@@ -80,6 +80,7 @@ CTASSERT(MCLBYTES == 2048);
 #define	TX_DESC_COUNT		GENET_DMA_DESC_COUNT
 #define	RX_DESC_COUNT		GENET_DMA_DESC_COUNT
 #define	MII_BUSY_RETRY		1000
+#define	GENET_MAX_MDF_FILTER	17
 
 #define	GENET_LOCK(sc)		mutex_enter(&(sc)->sc_lock)
 #define	GENET_UNLOCK(sc)	mutex_exit(&(sc)->sc_lock)
@@ -323,19 +324,65 @@ genet_tick(void *softc)
 }
 
 static void
+genet_setup_rxfilter_mdf(struct genet_softc *sc, u_int n, const uint8_t *ea)
+{
+	uint32_t addr0 = (ea[0] << 8) | ea[1];
+	uint32_t addr1 = (ea[2] << 24) | (ea[3] << 16) | (ea[4] << 8) | ea[5];
+
+	WR4(sc, GENET_UMAC_MDF_ADDR0(n), addr0);
+	WR4(sc, GENET_UMAC_MDF_ADDR1(n), addr1);
+}
+
+static void
 genet_setup_rxfilter(struct genet_softc *sc)
 {
-	uint32_t val;
+	struct ethercom *ec = >sc_ec;
+	struct ifnet *ifp = >ec_if;
+	struct ether_multistep step;
+	struct ether_multi *enm;
+	uint32_t cmd, mdf_ctrl;
+	u_int n;
 
 	GENET_ASSERT_LOCKED(sc);
 
-	/* Enable promiscuous mode */
-	val = RD4(sc, GENET_UMAC_CMD);
-	val |= GENET_UMAC_CMD_PROMISC;
-	WR4(sc, GENET_UMAC_CMD, val);
+	ETHER_LOCK(ec);
+
+	cmd = RD4(sc, GENET_UMAC_CMD);
+
+	/*
+	 * Count the required number of hardware filters. We need one
+	 * for each multicast address, plus one for our own address and
+	 * the broadcast address.
+	 */
+	ETHER_FIRST_MULTI(step, ec, enm);
+	for (n = 2; enm != NULL; n++)
+		ETHER_NEXT_MULTI(step, enm);
+
+	if (n > GENET_MAX_MDF_FILTER)
+		ifp->if_flags |= IFF_ALLMULTI;
+	else
+		ifp->if_flags &= ~IFF_ALLMULTI;
+
+	if ((ifp->if_flags & (IFF_PROMISC|IFF_ALLMULTI)) != 0) {
+		cmd |= GENET_UMAC_CMD_PROMISC;
+		mdf_ctrl = 0;
+	} else {
+		cmd &= ~GENET_UMAC_CMD_PROMISC;
+		genet_setup_rxfilter_mdf(sc, 0, ifp->if_broadcastaddr);
+		genet_setup_rxfilter_mdf(sc, 1, CLLADDR(ifp->if_sadl));
+		ETHER_FIRST_MULTI(step, ec, enm);
+		for (n = 2; enm != NULL; n++) {
+			genet_setup_rxfilter_mdf(sc, n, enm->enm_addrlo);
+			ETHER_NEXT_MULTI(step, enm);
+		}
+		mdf_ctrl = __BITS(GENET_MAX_MDF_FILTER - 1,
+  GENET_MAX_MDF_FILTER - n);
+	}
+
+	WR4(sc, GENET_UMAC_CMD, cmd);
+	WR4(sc, GENET_UMAC_MDF_CTRL, mdf_ctrl);
 
-	/* Disable filters */
-	WR4(sc, GENET_UMAC_MDF_CTRL, 0);
+	ETHER_UNLOCK(ec);
 }
 
 static int
@@ -465,10 +512,10 @@ genet_init_locked(struct genet_softc *sc
 		GENET_SYS_PORT_MODE_EXT_GPHY);
 
 	/* Write hardware address */
-	val = enaddr[0] | (enaddr[1] << 8) | (enaddr[2] << 16) |
-	(enaddr[3] << 24);
+	val = enaddr[3] | (enaddr[2] << 8) | (enaddr[1] << 16) |
+	(enaddr[0] << 24);
 	WR4(sc, GENET_UMAC_MAC0, val);
-	val = enaddr[4] | (enaddr[5] << 8);
+	val = enaddr[5] | (enaddr[4] << 8);
 	WR4(sc, GENET_UMAC_MAC1, val);
 
 	/* Setup RX filter */
Index: src/sys/dev/ic/bcmgenetreg.h
diff -u src/sys/dev/ic/bcmgenetreg.h:1.1 src/sys/dev/ic/bcmgenetreg.h:1.2
--- src/sys/dev/ic/bcmgenetreg.h:1.1	Sat Feb 22 00:28:35 2020
+++ src/sys/dev/ic/bcmgenetreg.h	Sat Feb 22 13:41:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bcmgenetreg.h,v 1.1 2020/02/22 00:28:35 jmcneill Exp $ */
+/* $NetBSD: bcmgenetreg.h,v 1.2 2020/02/22 13:41:41 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2020 Jared McNeill 
@@ -85,6 +85,8 @@
 #define	 GENET_MDIO_PMD			__BITS(25,21)
 #define	 GENET_MDIO_REG			__BITS(20,16)
 #define	GENET_UMAC_MDF_CTRL		0xe50
+#define	GENET_UMAC_MDF_ADDR0(n)		(0xe54 + (n) * 0x8)
+#define	GENET_UMAC_MDF_ADDR1(n)		(0xe58 + (n) * 0x8)
 
 #define	GENET_DMA_DESC_COUNT		256
 #define	GENET_DMA_DESC_SIZE		12



CVS commit: src/lib/libc/stdlib

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 13:20:21 UTC 2020

Modified Files:
src/lib/libc/stdlib: rand48.3

Log Message:
Reorder words to fix grammar

Noted by 


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/stdlib/rand48.3

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

Modified files:

Index: src/lib/libc/stdlib/rand48.3
diff -u src/lib/libc/stdlib/rand48.3:1.12 src/lib/libc/stdlib/rand48.3:1.13
--- src/lib/libc/stdlib/rand48.3:1.12	Sat Feb 22 11:56:13 2020
+++ src/lib/libc/stdlib/rand48.3	Sat Feb 22 13:20:21 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rand48.3,v 1.12 2020/02/22 11:56:13 kamil Exp $
+.\"	$NetBSD: rand48.3,v 1.13 2020/02/22 13:20:21 kamil Exp $
 .\"
 .\" Copyright (c) 1993 Martin Birgmeier
 .\" All rights reserved.
@@ -98,7 +98,7 @@ On the other hand,
 and
 .Fn jrand48
 use a user-supplied buffer to store the seed r(n), which consists
-of an array of unsigned 3 shorts, where the zeroth member holds the least
+of an array of 3 unsigned shorts, where the zeroth member holds the least
 significant bits.
 .Pp
 All functions share the same multiplicand and addend.



CVS commit: src/lib/libc/stdlib

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 11:56:14 UTC 2020

Modified Files:
src/lib/libc/stdlib: rand48.3

Log Message:
rand48: Document that short integers are unsigned


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libc/stdlib/rand48.3

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

Modified files:

Index: src/lib/libc/stdlib/rand48.3
diff -u src/lib/libc/stdlib/rand48.3:1.11 src/lib/libc/stdlib/rand48.3:1.12
--- src/lib/libc/stdlib/rand48.3:1.11	Fri Mar 31 11:43:54 2006
+++ src/lib/libc/stdlib/rand48.3	Sat Feb 22 11:56:13 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rand48.3,v 1.11 2006/03/31 11:43:54 drochner Exp $
+.\"	$NetBSD: rand48.3,v 1.12 2020/02/22 11:56:13 kamil Exp $
 .\"
 .\" Copyright (c) 1993 Martin Birgmeier
 .\" All rights reserved.
@@ -11,7 +11,7 @@
 .\" of any kind. I shall in no event be liable for anything that happens
 .\" to anyone/anything when using this software.
 .\"
-.Dd October 8, 1993
+.Dd February 22, 2020
 .Dt RAND48 3
 .Os
 .Sh NAME
@@ -98,7 +98,7 @@ On the other hand,
 and
 .Fn jrand48
 use a user-supplied buffer to store the seed r(n), which consists
-of an array of 3 shorts, where the zeroth member holds the least
+of an array of unsigned 3 shorts, where the zeroth member holds the least
 significant bits.
 .Pp
 All functions share the same multiplicand and addend.
@@ -120,12 +120,12 @@ also initializes the internal buffer r(n
 .Fn lrand48 ,
 and
 .Fn mrand48 ,
-but here all 48 bits of the seed can be specified in an array of 3 shorts,
+but here all 48 bits of the seed can be specified in an array of 3 unsigned shorts,
 where the zeroth member specifies the lowest bits.
 Again, the constant multiplicand and addend of the algorithm are
 reset to the default values given above.
 .Fn seed48
-returns a pointer to an array of 3 shorts which contains the old seed.
+returns a pointer to an array of 3 unsigned shorts which contains the old seed.
 This array is statically allocated, thus its contents are lost after
 each new call to
 .Fn seed48 .
@@ -145,7 +145,7 @@ and the seed used in
 .Fn lrand48 ,
 and
 .Fn mrand48 .
-An array of 7 shorts is passed as parameter; the first three shorts are
+An array of 7 unsigned shorts is passed as parameter; the first three shorts are
 used to initialize the seed; the second three are used to initialize the
 multiplicand; and the last short is used to initialize the addend.
 It is thus not possible to use values greater than 0x as the addend.



CVS commit: src/etc/rc.d

2020-02-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 22 11:55:43 UTC 2020

Modified Files:
src/etc/rc.d: amd dhcpcd

Log Message:
Revert unrelated changes to prior


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/etc/rc.d/amd
cvs rdiff -u -r1.6 -r1.7 src/etc/rc.d/dhcpcd

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

Modified files:

Index: src/etc/rc.d/amd
diff -u src/etc/rc.d/amd:1.16 src/etc/rc.d/amd:1.17
--- src/etc/rc.d/amd:1.16	Sat Feb 22 11:52:45 2020
+++ src/etc/rc.d/amd	Sat Feb 22 11:55:43 2020
@@ -1,12 +1,11 @@
 #!/bin/sh
 #
-# $NetBSD: amd,v 1.16 2020/02/22 11:52:45 roy Exp $
+# $NetBSD: amd,v 1.17 2020/02/22 11:55:43 roy Exp $
 #
 
 # PROVIDE: amd
-# REQUIRE: rpcbind mountall
+# REQUIRE: rpcbind mountall ypbind
 # BEFORE:  DAEMON
-# AFTER:   ypbind
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.6 src/etc/rc.d/dhcpcd:1.7
--- src/etc/rc.d/dhcpcd:1.6	Sat Feb 22 11:52:45 2020
+++ src/etc/rc.d/dhcpcd	Sat Feb 22 11:55:43 2020
@@ -1,11 +1,10 @@
 #!/bin/sh
 
-# $NetBSD: dhcpcd,v 1.6 2020/02/22 11:52:45 roy Exp $
+# $NetBSD: dhcpcd,v 1.7 2020/02/22 11:55:43 roy Exp $
 
 # PROVIDE: dhcpcd
 # REQUIRE: network mountcritlocal
 # BEFORE:  NETWORKING
-# KEYWORD: chrootdir
 
 $_rc_subr_loaded . /etc/rc.subr
 



CVS commit: src/etc/rc.d

2020-02-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 22 11:52:45 UTC 2020

Modified Files:
src/etc/rc.d: amd dhcpcd network

Log Message:
rc.d/network: improve wording of waiting for DAD to finish


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/etc/rc.d/amd
cvs rdiff -u -r1.5 -r1.6 src/etc/rc.d/dhcpcd
cvs rdiff -u -r1.76 -r1.77 src/etc/rc.d/network

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

Modified files:

Index: src/etc/rc.d/amd
diff -u src/etc/rc.d/amd:1.15 src/etc/rc.d/amd:1.16
--- src/etc/rc.d/amd:1.15	Mon Feb 25 22:12:42 2008
+++ src/etc/rc.d/amd	Sat Feb 22 11:52:45 2020
@@ -1,11 +1,12 @@
 #!/bin/sh
 #
-# $NetBSD: amd,v 1.15 2008/02/25 22:12:42 tron Exp $
+# $NetBSD: amd,v 1.16 2020/02/22 11:52:45 roy Exp $
 #
 
 # PROVIDE: amd
-# REQUIRE: rpcbind mountall ypbind
+# REQUIRE: rpcbind mountall
 # BEFORE:  DAEMON
+# AFTER:   ypbind
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.5 src/etc/rc.d/dhcpcd:1.6
--- src/etc/rc.d/dhcpcd:1.5	Thu Jan  7 22:03:00 2016
+++ src/etc/rc.d/dhcpcd	Sat Feb 22 11:52:45 2020
@@ -1,10 +1,11 @@
 #!/bin/sh
 
-# $NetBSD: dhcpcd,v 1.5 2016/01/07 22:03:00 roy Exp $
+# $NetBSD: dhcpcd,v 1.6 2020/02/22 11:52:45 roy Exp $
 
 # PROVIDE: dhcpcd
 # REQUIRE: network mountcritlocal
 # BEFORE:  NETWORKING
+# KEYWORD: chrootdir
 
 $_rc_subr_loaded . /etc/rc.subr
 

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.76 src/etc/rc.d/network:1.77
--- src/etc/rc.d/network:1.76	Tue Oct 23 09:25:33 2018
+++ src/etc/rc.d/network	Sat Feb 22 11:52:45 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.76 2018/10/23 09:25:33 mrg Exp $
+# $NetBSD: network,v 1.77 2020/02/22 11:52:45 roy Exp $
 #
 
 # PROVIDE: network
@@ -447,10 +447,9 @@ network_start_ipv6_autoconf()
 
 network_wait_dad()
 {
-	# Wait for the DAD flags to clear form all addresses.
+	# Wait for the DAD flags to clear from all addresses.
 	if [ -n "$ifconfig_wait_dad_flags" ]; then
-		echo 'Waiting for DAD to complete for' \
-		'statically configured addresses...'
+		echo "Waiting for duplicate address detection to finish..."
 		ifconfig $ifconfig_wait_dad_flags
 	fi
 }



CVS commit: src/lib/libc/stdlib

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 11:24:47 UTC 2020

Modified Files:
src/lib/libc/stdlib: _rand48.c

Log Message:
Improve readability of __dorand48()

Break long lines into shorter instructions per line.

No Functional Change.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libc/stdlib/_rand48.c

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

Modified files:

Index: src/lib/libc/stdlib/_rand48.c
diff -u src/lib/libc/stdlib/_rand48.c:1.7 src/lib/libc/stdlib/_rand48.c:1.8
--- src/lib/libc/stdlib/_rand48.c:1.7	Sun Jun 12 05:21:27 2005
+++ src/lib/libc/stdlib/_rand48.c	Sat Feb 22 11:24:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $	*/
+/*	$NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $	*/
 
 /*
  * Copyright (c) 1993 Martin Birgmeier
@@ -15,7 +15,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _rand48.c,v 1.7 2005/06/12 05:21:27 lukem Exp $");
+__RCSID("$NetBSD: _rand48.c,v 1.8 2020/02/22 11:24:47 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -42,12 +42,12 @@ __dorand48(unsigned short xseed[3])
 
 	_DIAGASSERT(xseed != NULL);
 
-	accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] +
-	 (unsigned long) __rand48_add;
+	accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0];
+	accu += (unsigned long) __rand48_add;
 	temp[0] = (unsigned short) accu;	/* lower 16 bits */
 	accu >>= sizeof(unsigned short) * 8;
-	accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1] +
-	 (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
+	accu += (unsigned long) __rand48_mult[0] * (unsigned long) xseed[1];
+	accu += (unsigned long) __rand48_mult[1] * (unsigned long) xseed[0];
 	temp[1] = (unsigned short) accu;	/* middle 16 bits */
 	accu >>= sizeof(unsigned short) * 8;
 	accu += __rand48_mult[0] * xseed[2] + __rand48_mult[1] * xseed[1] + __rand48_mult[2] * xseed[0];



CVS commit: src/sys/arch/i386/stand/efiboot

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 10:30:37 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
Remove check for bestmode==-1 (shouldn't happen)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.10 src/sys/arch/i386/stand/efiboot/eficons.c:1.11
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.10	Sat Feb 22 09:34:26 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Sat Feb 22 10:30:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.10 2020/02/22 09:34:26 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.11 2020/02/22 10:30:37 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -421,7 +421,7 @@ bi_framebuffer(void)
 	EFI_STATUS status;
 	EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info;
 	struct btinfo_framebuffer fb;
-	INT32 bestmode = -1;
+	INT32 bestmode;
 	UINTN sz;
 
 	if (efi_gop == NULL)
@@ -435,8 +435,6 @@ bi_framebuffer(void)
 		if (bestmode == -1)
 			bestmode = FALLBACK_GOP_MODE;
 	}
-	if (bestmode == -1)
-		goto nofb;
 
 	status = uefi_call_wrapper(efi_gop->SetMode, 2, efi_gop,
 	bestmode);



CVS commit: src/lib/libcrypt

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 10:29:17 UTC 2020

Modified Files:
src/lib/libcrypt: crypt.c

Log Message:
Avoid undefined behavior in left shift

crypt.c:772:11, left shift of 1363235140 by 1 places cannot be represented
in type 'int32_t' (aka 'int')


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/lib/libcrypt/crypt.c

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

Modified files:

Index: src/lib/libcrypt/crypt.c
diff -u src/lib/libcrypt/crypt.c:1.37 src/lib/libcrypt/crypt.c:1.38
--- src/lib/libcrypt/crypt.c:1.37	Sat Feb 22 10:22:32 2020
+++ src/lib/libcrypt/crypt.c	Sat Feb 22 10:29:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypt.c,v 1.37 2020/02/22 10:22:32 kamil Exp $	*/
+/*	$NetBSD: crypt.c,v 1.38 2020/02/22 10:29:17 kamil Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)crypt.c	8.1.1.1 (Berkeley) 8/18/93";
 #else
-__RCSID("$NetBSD: crypt.c,v 1.37 2020/02/22 10:22:32 kamil Exp $");
+__RCSID("$NetBSD: crypt.c,v 1.38 2020/02/22 10:29:17 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -769,9 +769,9 @@ des_cipher(const char *in, char *out, lo
 	LOADREG(R,R0,R1,L,L0,L1);
 	L0 &= 0xL;
 	L1 &= 0xL;
-	L0 = (L0 << 1) | L1;	/* L0 is the even-numbered input bits */
+	L0 = ((uint32_t)L0 << 1) | L1;	/* L0 is the even-numbered input bits */
 	R0 &= 0xL;
-	R1 = (R1 >> 1) & 0xL;
+	R1 = ((uint32_t)R1 >> 1) & 0xL;
 	L1 = R0 | R1;		/* L1 is the odd-numbered input bits */
 	STORE(L,L0,L1,B);
 	PERM3264(L,L0,L1,B.b,  (C_block *)IE3264);	/* even bits */



CVS commit: src/lib/libcrypt

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 10:22:32 UTC 2020

Modified Files:
src/lib/libcrypt: crypt.c

Log Message:
Avoid undefined behavior in bit shift operations

crypt.c:839:40, left shift of negative value -1197182952
crypt.c:840:40, left shift of negative value -264997776


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libcrypt/crypt.c

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

Modified files:

Index: src/lib/libcrypt/crypt.c
diff -u src/lib/libcrypt/crypt.c:1.36 src/lib/libcrypt/crypt.c:1.37
--- src/lib/libcrypt/crypt.c:1.36	Mon Oct 21 02:36:48 2019
+++ src/lib/libcrypt/crypt.c	Sat Feb 22 10:22:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypt.c,v 1.36 2019/10/21 02:36:48 jhigh Exp $	*/
+/*	$NetBSD: crypt.c,v 1.37 2020/02/22 10:22:32 kamil Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)crypt.c	8.1.1.1 (Berkeley) 8/18/93";
 #else
-__RCSID("$NetBSD: crypt.c,v 1.36 2019/10/21 02:36:48 jhigh Exp $");
+__RCSID("$NetBSD: crypt.c,v 1.37 2020/02/22 10:22:32 kamil Exp $");
 #endif
 #endif /* not lint */
 
@@ -836,8 +836,8 @@ des_cipher(const char *in, char *out, lo
 	}
 
 	/* store the encrypted (or decrypted) result */
-	L0 = ((L0 >> 3) & 0x0f0f0f0fL) | ((L1 << 1) & 0xf0f0f0f0L);
-	L1 = ((R0 >> 3) & 0x0f0f0f0fL) | ((R1 << 1) & 0xf0f0f0f0L);
+	L0 = (((uint32_t)L0 >> 3) & 0x0f0f0f0fL) | (((uint32_t)L1 << 1) & 0xf0f0f0f0L);
+	L1 = (((uint32_t)R0 >> 3) & 0x0f0f0f0fL) | (((uint32_t)R1 << 1) & 0xf0f0f0f0L);
 	STORE(L,L0,L1,B);
 	PERM6464(L,L0,L1,B.b, (C_block *)CF6464);
 #if defined(MUST_ALIGN)



CVS commit: src/lib/libc/stdlib

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 10:05:12 UTC 2020

Modified Files:
src/lib/libc/stdlib: _env.c

Log Message:
Avoid NULL pointer arithmetics on environ

_env.c:260:9, pointer expression with base 0 overflowed to 0
_env.c:260:9, load of null pointer of type 'char *'


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libc/stdlib/_env.c

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

Modified files:

Index: src/lib/libc/stdlib/_env.c
diff -u src/lib/libc/stdlib/_env.c:1.9 src/lib/libc/stdlib/_env.c:1.10
--- src/lib/libc/stdlib/_env.c:1.9	Tue Jan 20 18:31:25 2015
+++ src/lib/libc/stdlib/_env.c	Sat Feb 22 10:05:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: _env.c,v 1.9 2015/01/20 18:31:25 christos Exp $ */
+/*	$NetBSD: _env.c,v 1.10 2020/02/22 10:05:12 kamil Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: _env.c,v 1.9 2015/01/20 18:31:25 christos Exp $");
+__RCSID("$NetBSD: _env.c,v 1.10 2020/02/22 10:05:12 kamil Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -257,13 +257,15 @@ __getenvslot(const char *name, size_t l_
 
 	/* Search for an existing environment variable of the given name. */
 	num_entries = 0;
-	while (environ[num_entries] != NULL) {
-		if (strncmp(environ[num_entries], name, l_name) == 0 &&
-		environ[num_entries][l_name] == '=') {
-			/* We found a match. */
-			return num_entries;
+	if (environ != NULL) {
+		while (environ[num_entries] != NULL) {
+			if (strncmp(environ[num_entries], name, l_name) == 0 &&
+			environ[num_entries][l_name] == '=') {
+/* We found a match. */
+return num_entries;
+			}
+			num_entries ++;
 		}
-		num_entries ++;
 	}
 
 	/* No match found, return if we don't want to allocate a new slot. */



CVS commit: src/sbin/fsck_msdos

2020-02-22 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 22 09:59:22 UTC 2020

Modified Files:
src/sbin/fsck_msdos: boot.c

Log Message:
Avoid unportable shift construct

boot.c:150:29, left shift of 255 by 24 places cannot be represented in type 
'int'
boot.c:153:29, left shift of 255 by 24 places cannot be represented in type 
'int'


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sbin/fsck_msdos/boot.c

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

Modified files:

Index: src/sbin/fsck_msdos/boot.c
diff -u src/sbin/fsck_msdos/boot.c:1.22 src/sbin/fsck_msdos/boot.c:1.23
--- src/sbin/fsck_msdos/boot.c:1.22	Sat Jan 11 16:29:07 2020
+++ src/sbin/fsck_msdos/boot.c	Sat Feb 22 09:59:22 2020
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: boot.c,v 1.22 2020/01/11 16:29:07 christos Exp $");
+__RCSID("$NetBSD: boot.c,v 1.23 2020/02/22 09:59:22 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -81,8 +81,8 @@ readboot(int dosfs, struct bootblock *bo
 	boot->FATsmall = block[22] + (block[23] << 8);
 	boot->SecPerTrack = block[24] + (block[25] << 8);
 	boot->Heads = block[26] + (block[27] << 8);
-	boot->HiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + (block[31] << 24);
-	boot->HugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + (block[35] << 24);
+	boot->HiddenSecs = block[28] + (block[29] << 8) + (block[30] << 16) + ((uint32_t)block[31] << 24);
+	boot->HugeSectors = block[32] + (block[33] << 8) + (block[34] << 16) + ((uint32_t)block[35] << 24);
 
 	boot->FATsecs = boot->FATsmall;
 
@@ -90,7 +90,7 @@ readboot(int dosfs, struct bootblock *bo
 		boot->flags |= FAT32;
 	if (boot->flags & FAT32) {
 		boot->FATsecs = block[36] + (block[37] << 8)
-+ (block[38] << 16) + (block[39] << 24);
++ (block[38] << 16) + ((uint32_t)block[39] << 24);
 		if (block[40] & 0x80)
 			boot->ValidFat = block[40] & 0x0f;
 
@@ -102,7 +102,7 @@ readboot(int dosfs, struct bootblock *bo
 			return FSFATAL;
 		}
 		boot->RootCl = block[44] + (block[45] << 8)
-			   + (block[46] << 16) + (block[47] << 24);
+			   + (block[46] << 16) + ((uint32_t)block[47] << 24);
 		boot->FSInfo = block[48] + (block[49] << 8);
 		boot->Backup = block[50] + (block[51] << 8);
 
@@ -147,10 +147,10 @@ readboot(int dosfs, struct bootblock *bo
 		if (boot->FSInfo) {
 			boot->FSFree = fsinfo[0x1e8] + (fsinfo[0x1e9] << 8)
    + (fsinfo[0x1ea] << 16)
-   + (fsinfo[0x1eb] << 24);
+   + ((uint32_t)fsinfo[0x1eb] << 24);
 			boot->FSNext = fsinfo[0x1ec] + (fsinfo[0x1ed] << 8)
    + (fsinfo[0x1ee] << 16)
-   + (fsinfo[0x1ef] << 24);
+   + ((uint32_t)fsinfo[0x1ef] << 24);
 		}
 
 		if (lseek(dosfs, boot->Backup * boot->BytesPerSec, SEEK_SET)



CVS commit: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts

2020-02-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 22 09:54:27 UTC 2020

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts:
bcm2835-rpi-zero-w.dts

Log Message:
Define pinctrl-names for sdhci to fix it. From Harold Gutch and discussed
on port-arm.

http://mail-index.netbsd.org/port-arm/2020/02/13/msg006497.html


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts

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

Modified files:

Index: src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts
diff -u src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts:1.1.1.4 src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts:1.2
--- src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts:1.1.1.4	Fri Jan  3 14:33:09 2020
+++ src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi-zero-w.dts	Sat Feb 22 09:54:27 2020
@@ -112,6 +112,7 @@
  {
 	#address-cells = <1>;
 	#size-cells = <0>;
+	pinctrl-names = "default";
 	pinctrl-0 = <_gpio34 _gpio43>;
 	bus-width = <4>;
 	mmc-pwrseq = <_pwrseq>;



CVS commit: src/distrib

2020-02-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Feb 22 09:53:48 UTC 2020

Added Files:
src/distrib/amd64/ramdisks/ramdisk-zfsroot: Makefile list
src/distrib/common: list.zfsroot mtree.zfsroot zfsroot.rc

Log Message:
zfs: build a ramdisk on amd64 with enough to mount rpool/ROOT on /

Until we get ZFS integrated into our boot loader, this is the next best
thing. The idea is simple - have a small FFS partition with a kernel,
modules and this ramdisk. Once the ramdisk boots it will mount the FFS
partition read only, copy the needed ZFS modules to the ramdisk and then
unmount the partition. Then we import the ZFS root pool, mount the
ZFS root filesystem and then pivot to it.

Because the initial FFS partition is not mounted at this point, we
can mount it in /altroot so we can replace the kernel and modules with
newer ones so it's easily maintainable.

This ZFS boot strapper currently makes the following assumptions:
 * The device NAME=boot is the FFS with kernel, modules and this ramdisk.
 * The ZFS root pool and root filesystem are called rpool/ROOT.

A boot.cfg menu entry can then be added like so:
menu=Boot ZFS root:fs /ramdisk-zfsroot.fs;boot


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/amd64/ramdisks/ramdisk-zfsroot/Makefile \
src/distrib/amd64/ramdisks/ramdisk-zfsroot/list
cvs rdiff -u -r0 -r1.1 src/distrib/common/list.zfsroot \
src/distrib/common/mtree.zfsroot src/distrib/common/zfsroot.rc

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

Added files:

Index: src/distrib/amd64/ramdisks/ramdisk-zfsroot/Makefile
diff -u /dev/null src/distrib/amd64/ramdisks/ramdisk-zfsroot/Makefile:1.1
--- /dev/null	Sat Feb 22 09:53:48 2020
+++ src/distrib/amd64/ramdisks/ramdisk-zfsroot/Makefile	Sat Feb 22 09:53:47 2020
@@ -0,0 +1,17 @@
+#	$NetBSD: Makefile,v 1.1 2020/02/22 09:53:47 roy Exp $
+
+IMAGE=			ramdisk-zfsroot.fs
+IMAGESIZE=		5000k
+IMAGEDEPENDS=
+MAKEDEVTARGETS=		all
+CRUNCHENV=		INIT_CHROOT=1
+SMALLPROG_INET6=	1
+
+LISTS+=			${DISTRIBDIR}/common/list.zfsroot
+
+.include "${.CURDIR}/../common/Makefile.ramdisk"
+.include "${DISTRIBDIR}/common/Makefile.makedev"
+
+LISTS+=			${.CURDIR}/list
+
+MTREECONF+=		${DISTRIBDIR}/common/mtree.zfsroot
Index: src/distrib/amd64/ramdisks/ramdisk-zfsroot/list
diff -u /dev/null src/distrib/amd64/ramdisks/ramdisk-zfsroot/list:1.1
--- /dev/null	Sat Feb 22 09:53:48 2020
+++ src/distrib/amd64/ramdisks/ramdisk-zfsroot/list	Sat Feb 22 09:53:47 2020
@@ -0,0 +1,12 @@
+#	$NetBSD: list,v 1.1 2020/02/22 09:53:47 roy Exp $
+
+PROG	bin/sync
+
+PROG	sbin/fdisk
+PROG	sbin/gpt
+PROG	sbin/mbrlabel
+PROG	sbin/shutdown
+
+PROG	usr/bin/less	usr/bin/more
+
+PROG	usr/sbin/installboot

Index: src/distrib/common/list.zfsroot
diff -u /dev/null src/distrib/common/list.zfsroot:1.1
--- /dev/null	Sat Feb 22 09:53:48 2020
+++ src/distrib/common/list.zfsroot	Sat Feb 22 09:53:47 2020
@@ -0,0 +1,29 @@
+#	$NetBSD: list.zfsroot,v 1.1 2020/02/22 09:53:47 roy Exp $
+#
+# list file (c.f. parselist.awk) for ZFS on root.
+#
+
+SRCDIRS	external/cddl/osnet/sbin
+PROG	sbin/zfs
+PROG	sbin/zpool
+LINK	sbin/zfs sbin/mount_zfs
+ARGVLN	zfs mount_zfs
+
+# We need sysctl to set init.root=/altroot
+PROG	sbin/sysctl
+
+LIBS	-lnvpair
+LIBS	-luutil
+LIBS	-lzfs
+LIBS	-lavl
+LIBS	-lm
+LIBS	-lpthread
+LIBS	-lumem
+#LIBS	-lutil		# replaced by libhack
+LIBS	-lz
+LIBS	-lzfs_core
+
+COPY	${NETBSDSRCDIR}/distrib/common/zfsroot.rc etc/rc
+
+# Make firmware images available.
+SYMLINK	altroot/libdata libdata
Index: src/distrib/common/mtree.zfsroot
diff -u /dev/null src/distrib/common/mtree.zfsroot:1.1
--- /dev/null	Sat Feb 22 09:53:48 2020
+++ src/distrib/common/mtree.zfsroot	Sat Feb 22 09:53:47 2020
@@ -0,0 +1,8 @@
+#	$NetBSD: mtree.zfsroot,v 1.1 2020/02/22 09:53:47 roy Exp $
+
+.
+./altroot
+./etc
+./etc/zfs
+./rpool
+./stand
Index: src/distrib/common/zfsroot.rc
diff -u /dev/null src/distrib/common/zfsroot.rc:1.1
--- /dev/null	Sat Feb 22 09:53:48 2020
+++ src/distrib/common/zfsroot.rc	Sat Feb 22 09:53:47 2020
@@ -0,0 +1,64 @@
+#/bin/sh
+#
+#	$NetBSD: zfsroot.rc,v 1.1 2020/02/22 09:53:47 roy Exp $
+#	ZFS on Root boot strapper
+
+# Configurable - define the ZFS root pool and ROOT.
+# XXX Can these be set in boot.cfg?
+# Assumption - the root pool is set to legacy mount.
+rpool=rpool
+rroot=ROOT
+
+# Assumption - the boot device is named boot.
+# Could use dk0, wd0a, etc instead.
+# XXX Can be exposed by sysctl kern.boot_device?
+bootdev="NAME=boot"
+
+# Setup some stuff incase things go south and we drop to the shell
+export HOME=/
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+umask 022
+
+echo
+echo "Starting ZFS on root boot strapper"
+
+# Avoid having the solaris and zfs modules in ramdisk directly.
+# Means we don't need to update the ramdisk with the kernel modules
+# or load them from boot.cfg so it's less pain for the user.
+#bootdev="$(/sbin/sysctl -n kern.boot_device)"
+modpath="$(/sbin/sysctl -n 

CVS commit: xsrc/external/mit/MesaLib/dist/src/mapi

2020-02-22 Thread Tobias Nygren
Module Name:xsrc
Committed By:   tnn
Date:   Sat Feb 22 09:42:27 UTC 2020

Modified Files:
xsrc/external/mit/MesaLib/dist/src/mapi: entry_x86-64_tls.h
entry_x86_tls.h

Log Message:
mesa: sync w/ pkgsrc: don't assume the current gl dispatch table points
to noop if NULL, instead call the ENTRY_CURRENT_TABLE_GET function.

Additionally the previous i386 implementation probably never worked
because it looks like it used the wrong asm label when computing GOT ptr.
Likely relevant to PR port-i386/54782.

XXX pullup -9


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
cvs rdiff -u -r1.5 -r1.6 \
xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h

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

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.5
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h:1.4	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86-64_tls.h	Sat Feb 22 09:42:27 2020
@@ -32,24 +32,27 @@
 #endif
 
 __asm__(".text\n"
-".balign 32\n"
+".balign 64\n"
 "x86_64_entry_start:");
 
 #define STUB_ASM_ENTRY(func) \
".globl " func "\n"   \
".type " func ", @function\n" \
-   ".balign 32\n"\
+   ".balign 64\n"\
func ":"
 
 #ifndef __ILP32__
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
"movq %fs:(%rax), %r11\n\t"   \
"testq %r11, %r11\n\t"\
-   "cmoveq table_noop_array@GOTPCREL(%rip), %r11\n\t"\
-   "jmp *(8 * " slot ")(%r11)"
+   "je 1f\n\t"   \
+   "jmp *(8 * " slot ")(%r11)\n\t"   \
+   "1:\n\t"  \
+   "callq " ENTRY_CURRENT_TABLE_GET "@PLT\n\t"   \
+   "jmp *(8 * " slot ")(%rax)"
 #else
 #define STUB_ASM_CODE(slot)  \
"movq " ENTRY_CURRENT_TABLE "@GOTTPOFF(%rip), %rax\n\t"  \
@@ -86,7 +89,7 @@ x86_64_entry_start[] HIDDEN;
 mapi_func
 entry_get_public(int slot)
 {
-   return (mapi_func) (x86_64_entry_start + slot * 32);
+   return (mapi_func) (x86_64_entry_start + slot * 64);
 }
 
 void

Index: xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h
diff -u xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5 xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.6
--- xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h:1.5	Tue Apr  9 14:14:59 2019
+++ xsrc/external/mit/MesaLib/dist/src/mapi/entry_x86_tls.h	Sat Feb 22 09:42:27 2020
@@ -43,6 +43,20 @@ __asm__("x86_current_tls:\n\t"
 	"movl " ENTRY_CURRENT_TABLE "@GOTNTPOFF(%eax), %eax\n\t"
 	"ret");
 
+#if defined(__NetBSD__)
+__asm__("x86_current_table_helper:\n\t"
+	"movl %gs:(%eax), %eax\n\t"   \
+	"testl %eax, %eax\n\t"\
+	"je 1f\n\t"   \
+	"ret\n\t" \
+	"1:\n\t"  \
+	"call 2f\n\t" \
+	"2:\n\t"  \
+	"popl %eax\n\t"   \
+	"addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %eax\n\t" \
+	"jmp *" ENTRY_CURRENT_TABLE_GET "@GOT(%eax)");
+#endif
+
 #ifndef GLX_X86_READONLY_TEXT
 __asm__(".section wtext, \"awx\", @progbits");
 #endif /* GLX_X86_READONLY_TEXT */
@@ -56,20 +70,10 @@ __asm__(".balign 16\n"
".balign 16\n"\
func ":"
 
-#if defined(__NetBSD__) && defined(MAPI_MODE_GLAPI)
-extern const mapi_func table_noop_array[];
+#if defined(__NetBSD__)
 #define STUB_ASM_CODE(slot)  \
"call x86_current_tls\n\t"\
-   "movl %gs:(%eax), %eax\n\t"   \
-   "testl %eax, %eax\n\t"\
-   "je 1f\n\t"   \
-   "jmp *(4 * " slot ")(%eax)\n\t" \
-   "1:\n\t"  \
-   "call 2f\n"   \
-   "2:\n\t"  \
-   "popl %eax\n\t"   \
-   "addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %eax\n\t" \
-   "movl table_noop_array@GOT(%eax), %eax\n\t" \
+   "call x86_current_table_helper\n\t"\
"jmp *(4 * " slot ")(%eax)"
 #else
 #define STUB_ASM_CODE(slot)  \



CVS commit: src/sys/compat/common

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 09:42:20 UTC 2020

Modified Files:
src/sys/compat/common: uipc_syscalls_40.c

Log Message:
pass the address of the field, instead of relying on it being the first
field of the structure, no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/compat/common/uipc_syscalls_40.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/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.21 src/sys/compat/common/uipc_syscalls_40.c:1.22
--- src/sys/compat/common/uipc_syscalls_40.c:1.21	Thu Dec 12 02:15:42 2019
+++ src/sys/compat/common/uipc_syscalls_40.c	Sat Feb 22 09:42:20 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.21 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.22 2020/02/22 09:42:20 maxv Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.21 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.22 2020/02/22 09:42:20 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -119,7 +119,7 @@ compat_ifconf(u_long cmd, void *data)
 			} else {
 space -= sa->sa_len - sizeof(*sa);
 if (space >= sz) {
-	error = copyout(, ifrp,
+	error = copyout(_name, ifrp,
 	sizeof(ifr.ifr_name));
 	if (error == 0) {
 		error = copyout(sa,



CVS commit: src/sys/arch/i386/stand/efiboot

2020-02-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Feb 22 09:34:26 UTC 2020

Modified Files:
src/sys/arch/i386/stand/efiboot: eficons.c

Log Message:
If the default GOP mode is unavailable, fallback to the first mode defined.
PR# port-amd64/55000


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/stand/efiboot/eficons.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/i386/stand/efiboot/eficons.c
diff -u src/sys/arch/i386/stand/efiboot/eficons.c:1.9 src/sys/arch/i386/stand/efiboot/eficons.c:1.10
--- src/sys/arch/i386/stand/efiboot/eficons.c:1.9	Tue Feb 11 11:01:10 2020
+++ src/sys/arch/i386/stand/efiboot/eficons.c	Sat Feb 22 09:34:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eficons.c,v 1.9 2020/02/11 11:01:10 jmcneill Exp $	*/
+/*	$NetBSD: eficons.c,v 1.10 2020/02/22 09:34:26 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -37,6 +37,7 @@
 #ifndef DEFAULT_GOP_MODE
 #define DEFAULT_GOP_MODE	"1024x768"
 #endif
+#define FALLBACK_GOP_MODE	0
 
 extern struct x86_boot_params boot_params;
 
@@ -431,6 +432,8 @@ bi_framebuffer(void)
 	} else {
 		/* If a mode has not been selected, choose a default */
 		bestmode = efi_find_gop_mode(DEFAULT_GOP_MODE);
+		if (bestmode == -1)
+			bestmode = FALLBACK_GOP_MODE;
 	}
 	if (bestmode == -1)
 		goto nofb;



CVS commit: src/sys/net

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 09:30:42 UTC 2020

Modified Files:
src/sys/net: rtsock_shared.c

Log Message:
pass the address of the field, instead of relying on it being the first
field of the structure, no functional change


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/rtsock_shared.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/net/rtsock_shared.c
diff -u src/sys/net/rtsock_shared.c:1.14 src/sys/net/rtsock_shared.c:1.15
--- src/sys/net/rtsock_shared.c:1.14	Sun Feb  9 21:15:03 2020
+++ src/sys/net/rtsock_shared.c	Sat Feb 22 09:30:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_shared.c,v 1.14 2020/02/09 21:15:03 roy Exp $	*/
+/*	$NetBSD: rtsock_shared.c,v 1.15 2020/02/22 09:30:42 maxv Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.14 2020/02/09 21:15:03 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.15 2020/02/22 09:30:42 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -248,7 +248,7 @@ COMPATNAME(route_filter)(struct mbuf *m,
 		offsetof(struct sockaddr, sa_len) + sizeof(ss.ss_len))
 			return EINVAL;
 		m_copydata(m, sizeof(*rtm) + offsetof(struct sockaddr, sa_len),
-		sizeof(ss.ss_len), );
+		sizeof(ss.ss_len), _len);
 		if (m->m_pkthdr.len < sizeof(*rtm) + ss.ss_len)
 			return EINVAL;
 		/* Copy out the destination sockaddr */



CVS commit: src/sys/kern

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 09:24:05 UTC 2020

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

Log Message:
pass the address of the field, instead of relying on it being the first
field of the structure, no functional change, ok kamil


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/kern/sys_ptrace_common.c

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

Modified files:

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.77 src/sys/kern/sys_ptrace_common.c:1.78
--- src/sys/kern/sys_ptrace_common.c:1.77	Fri Jan  3 00:37:29 2020
+++ src/sys/kern/sys_ptrace_common.c	Sat Feb 22 09:24:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.77 2020/01/03 00:37:29 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.78 2020/02/22 09:24:05 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.77 2020/01/03 00:37:29 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.78 2020/02/22 09:24:05 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -804,7 +804,7 @@ ptrace_lwpstatus(struct proc *t, struct 
 		__func__, sizeof(lwpid_t), data, sizeof(pls)));
 		return EINVAL;
 	}
-	error = copyin(addr, , sizeof(lwpid_t));
+	error = copyin(addr, _lwpid, sizeof(lwpid_t));
 	if (error)
 		return error;
 



CVS commit: src/sys/kern

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 08:58:39 UTC 2020

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

Log Message:
Inline the block in the parent block, for clarity, and also to prevent a
false positive with kMSan.

Here, LLVM reorders the conditions and checks 'vattr' before 'error'. But
if 'error' is non-zero then 'vattr' is not initialized, and kMSan notices
the uninitialized memory read.


To generate a diff of this commit:
cvs rdiff -u -r1.540 -r1.541 src/sys/kern/vfs_syscalls.c

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

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.540 src/sys/kern/vfs_syscalls.c:1.541
--- src/sys/kern/vfs_syscalls.c:1.540	Fri Jan 17 20:08:09 2020
+++ src/sys/kern/vfs_syscalls.c	Sat Feb 22 08:58:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.540 2020/01/17 20:08:09 ad Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.541 2020/02/22 08:58:39 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.540 2020/01/17 20:08:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.541 2020/02/22 08:58:39 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -2286,10 +2286,12 @@ do_sys_mknodat(struct lwp *l, int fdat, 
 			error = EINVAL;
 			break;
 		}
+
+		if (error == 0 && optype == VOP_MKNOD_DESCOFFSET &&
+		vattr.va_rdev == VNOVAL)
+			error = EINVAL;
 	}
-	if (error == 0 && optype == VOP_MKNOD_DESCOFFSET
-	&& vattr.va_rdev == VNOVAL)
-		error = EINVAL;
+
 	if (!error) {
 		switch (optype) {
 		case VOP_WHITEOUT_DESCOFFSET:



CVS commit: src/sys/kern

2020-02-22 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 08:39:33 UTC 2020

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

Log Message:
Zero out 'tv', to prevent uninitialized bytes in its padding from leaking
to userland. Found by kMSan.

Reported-by: syzbot+8134380511a82c8f5...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.287 -r1.288 src/sys/kern/uipc_socket.c

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

Modified files:

Index: src/sys/kern/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.287 src/sys/kern/uipc_socket.c:1.288
--- src/sys/kern/uipc_socket.c:1.287	Fri Feb 21 00:26:22 2020
+++ src/sys/kern/uipc_socket.c	Sat Feb 22 08:39:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.287 2020/02/21 00:26:22 joerg Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.288 2020/02/22 08:39:33 maxv Exp $	*/
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.287 2020/02/21 00:26:22 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.288 2020/02/22 08:39:33 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1992,6 +1992,7 @@ sogetopt1(struct socket *so, struct sock
 		optval = (opt == SO_SNDTIMEO ?
 		 so->so_snd.sb_timeo : so->so_rcv.sb_timeo);
 
+		memset(, 0, sizeof(tv));
 		tv.tv_sec = optval / hz;
 		tv.tv_usec = (optval % hz) * tick;
 



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

2020-02-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Feb 22 08:22:10 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: bus_dma.c

Log Message:
Fix previous for _ARM32_NEED_BUS_DMA_BOUNCE


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/arch/arm/arm32/bus_dma.c

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

Modified files:

Index: src/sys/arch/arm/arm32/bus_dma.c
diff -u src/sys/arch/arm/arm32/bus_dma.c:1.119 src/sys/arch/arm/arm32/bus_dma.c:1.120
--- src/sys/arch/arm/arm32/bus_dma.c:1.119	Fri Feb 21 23:27:06 2020
+++ src/sys/arch/arm/arm32/bus_dma.c	Sat Feb 22 08:22:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.119 2020/02/21 23:27:06 maya Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.120 2020/02/22 08:22:09 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #include "opt_cputypes.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.119 2020/02/21 23:27:06 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.120 2020/02/22 08:22:09 skrll Exp $");
 
 #include 
 #include 
@@ -315,6 +315,7 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 {
 	struct arm32_bus_dmamap *map;
 	void *mapstore;
+	int error = 0;
 
 #ifdef DEBUG_DMA
 	printf("dmamap_create: t=%p size=%lx nseg=%x msegsz=%lx boundary=%lx"
@@ -357,7 +358,6 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_
 	struct arm32_bus_dma_cookie *cookie;
 	int cookieflags;
 	void *cookiestore;
-	int error;
 
 	cookieflags = 0;
 



CVS commit: src/sys/dev

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 22 08:15:09 UTC 2020

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

Log Message:
Make calling get_props() lockless.
get_props() of all MD drivers now can be called without sc_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.63 -r1.64 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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.51 src/sys/dev/audio/audio.c:1.52
--- src/sys/dev/audio/audio.c:1.51	Sat Feb 22 08:03:19 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 22 08:15:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -121,7 +121,7 @@
  *	allocm 			-	- +	(*1)
  *	freem 			-	- +	(*1)
  *	round_buffersize 	-	x
- *	get_props 		-	x	Called at attach time
+ *	get_props 		-	-	Called at attach time
  *	trigger_output 		x	x +
  *	trigger_input 		x	x +
  *	dev_ioctl 		-	x
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.52 2020/02/22 08:15:09 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -886,9 +886,7 @@ audioattach(device_t parent, device_t se
 	sc->sc_am_used = 0;
 	sc->sc_am = NULL;
 
-	mutex_enter(sc->sc_lock);
 	sc->sc_props = hw_if->get_props(sc->hw_hdl);
-	mutex_exit(sc->sc_lock);
 
 	/* MMAP is now supported by upper layer.  */
 	sc->sc_props |= AUDIO_PROP_MMAP;

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.63 src/sys/dev/pad/pad.c:1.64
--- src/sys/dev/pad/pad.c:1.63	Wed Jun 26 12:21:40 2019
+++ src/sys/dev/pad/pad.c	Sat Feb 22 08:15:09 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $ */
+/* $NetBSD: pad.c,v 1.64 2020/02/22 08:15:09 isaki Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.64 2020/02/22 08:15:09 isaki Exp $");
 
 #include 
 #include 
@@ -795,11 +795,6 @@ pad_query_devinfo(void *opaque, mixer_de
 static int
 pad_get_props(void *opaque)
 {
-	struct pad_softc *sc __diagused;
-
-	sc = (struct pad_softc *)opaque;
-
-	KASSERT(mutex_owned(>sc_lock));
 
 	return AUDIO_PROP_PLAYBACK;
 }



CVS commit: src/sys/dev/audio

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 22 08:03:19 UTC 2020

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

Log Message:
On audio_[pr]mixer_halt(), it's better to reset parameters in intr_lock.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 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.50 src/sys/dev/audio/audio.c:1.51
--- src/sys/dev/audio/audio.c:1.50	Sat Feb 22 08:01:59 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 22 08:03:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.50 2020/02/22 08:01:59 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.50 2020/02/22 08:01:59 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.51 2020/02/22 08:03:19 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5546,7 +5546,6 @@ audio_pmixer_halt(struct audio_softc *sc
 
 	mutex_enter(sc->sc_intr_lock);
 	error = sc->hw_if->halt_output(sc->hw_hdl);
-	mutex_exit(sc->sc_intr_lock);
 
 	/* Halts anyway even if some error has occurred. */
 	sc->sc_pbusy = false;
@@ -5554,6 +5553,7 @@ audio_pmixer_halt(struct audio_softc *sc
 	sc->sc_pmixer->hwbuf.used = 0;
 	sc->sc_pmixer->mixseq = 0;
 	sc->sc_pmixer->hwseq = 0;
+	mutex_exit(sc->sc_intr_lock);
 
 	return error;
 }
@@ -5576,7 +5576,6 @@ audio_rmixer_halt(struct audio_softc *sc
 
 	mutex_enter(sc->sc_intr_lock);
 	error = sc->hw_if->halt_input(sc->hw_hdl);
-	mutex_exit(sc->sc_intr_lock);
 
 	/* Halts anyway even if some error has occurred. */
 	sc->sc_rbusy = false;
@@ -5584,6 +5583,7 @@ audio_rmixer_halt(struct audio_softc *sc
 	sc->sc_rmixer->hwbuf.used = 0;
 	sc->sc_rmixer->mixseq = 0;
 	sc->sc_rmixer->hwseq = 0;
+	mutex_exit(sc->sc_intr_lock);
 
 	return error;
 }



CVS commit: src/sys/dev/audio

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 22 08:01:59 UTC 2020

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

Log Message:
Add KASSERTs.  audio_[pr]mixer_start() need exlock.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 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.49 src/sys/dev/audio/audio.c:1.50
--- src/sys/dev/audio/audio.c:1.49	Sat Feb 22 07:59:47 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 22 08:01:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.49 2020/02/22 07:59:47 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.50 2020/02/22 08:01:59 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.49 2020/02/22 07:59:47 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.50 2020/02/22 08:01:59 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4788,7 +4788,7 @@ audio_mixer_destroy(struct audio_softc *
 /*
  * Starts playback mixer.
  * Must be called only if sc_pbusy is false.
- * Must be called with sc_lock held.
+ * Must be called with sc_lock && sc_exlock held.
  * Must not be called from the interrupt context.
  */
 static void
@@ -4798,6 +4798,7 @@ audio_pmixer_start(struct audio_softc *s
 	int minimum;
 
 	KASSERT(mutex_owned(sc->sc_lock));
+	KASSERT(sc->sc_exlock);
 	KASSERT(sc->sc_pbusy == false);
 
 	mutex_enter(sc->sc_intr_lock);
@@ -5290,7 +5291,7 @@ audio_pintr(void *arg)
 /*
  * Starts record mixer.
  * Must be called only if sc_rbusy is false.
- * Must be called with sc_lock held.
+ * Must be called with sc_lock && sc_exlock held.
  * Must not be called from the interrupt context.
  */
 static void
@@ -5298,6 +5299,7 @@ audio_rmixer_start(struct audio_softc *s
 {
 
 	KASSERT(mutex_owned(sc->sc_lock));
+	KASSERT(sc->sc_exlock);
 	KASSERT(sc->sc_rbusy == false);
 
 	mutex_enter(sc->sc_intr_lock);



CVS commit: src/sys/dev/audio

2020-02-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 22 07:59:47 UTC 2020

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

Log Message:
Move #if DIAGNOSTIC..#endif to correct place.
It should ignore stray interrupts regardless of DIAGNOSTIC.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/dev/audio/audio.c:1.49
--- src/sys/dev/audio/audio.c:1.48	Sat Feb 22 07:09:18 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 22 07:59:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.48 2020/02/22 07:09:18 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.49 2020/02/22 07:59:47 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.48 2020/02/22 07:09:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.49 2020/02/22 07:59:47 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -5224,12 +5224,12 @@ audio_pintr(void *arg)
 
 	if (sc->sc_dying)
 		return;
-#if defined(DIAGNOSTIC)
 	if (sc->sc_pbusy == false) {
+#if defined(DIAGNOSTIC)
 		device_printf(sc->sc_dev, "stray interrupt\n");
+#endif
 		return;
 	}
-#endif
 
 	mixer = sc->sc_pmixer;
 	mixer->hw_complete_counter += mixer->frames_per_block;
@@ -5492,12 +5492,12 @@ audio_rintr(void *arg)
 
 	if (sc->sc_dying)
 		return;
-#if defined(DIAGNOSTIC)
 	if (sc->sc_rbusy == false) {
+#if defined(DIAGNOSTIC)
 		device_printf(sc->sc_dev, "stray interrupt\n");
+#endif
 		return;
 	}
-#endif
 
 	mixer = sc->sc_rmixer;
 	mixer->hw_complete_counter += mixer->frames_per_block;