CVS commit: src/sys

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 13:52:24 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c
src/sys/uvm: uvm_device.c

Log Message:
kern: Work around spurious -Wtype-limits warnings.

This useless garbage warning is apparently designed to make it
painful to write portable safe arithmetic and I think we ought to
just disable it.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.77 -r1.78 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.



CVS commit: src/sys

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 13:52:24 UTC 2022

Modified Files:
src/sys/kern: vfs_vnops.c
src/sys/uvm: uvm_device.c

Log Message:
kern: Work around spurious -Wtype-limits warnings.

This useless garbage warning is apparently designed to make it
painful to write portable safe arithmetic and I think we ought to
just disable it.


To generate a diff of this commit:
cvs rdiff -u -r1.232 -r1.233 src/sys/kern/vfs_vnops.c
cvs rdiff -u -r1.77 -r1.78 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/kern/vfs_vnops.c
diff -u src/sys/kern/vfs_vnops.c:1.232 src/sys/kern/vfs_vnops.c:1.233
--- src/sys/kern/vfs_vnops.c:1.232	Wed Jul  6 01:15:32 2022
+++ src/sys/kern/vfs_vnops.c	Wed Jul  6 13:52:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnops.c,v 1.232 2022/07/06 01:15:32 riastradh Exp $	*/
+/*	$NetBSD: vfs_vnops.c,v 1.233 2022/07/06 13:52:24 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.232 2022/07/06 01:15:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.233 2022/07/06 13:52:24 riastradh Exp $");
 
 #include "veriexec.h"
 
@@ -930,8 +930,12 @@ vn_mmap(struct file *fp, off_t *offp, si
 	if (vp->v_type != VCHR && off < 0) {
 		return EINVAL;
 	}
-	if (vp->v_type != VCHR &&
-	(size > __type_max(off_t) || off > __type_max(off_t) - size)) {
+#if SIZE_MAX > UINT32_MAX	/* XXX -Wtype-limits */
+	if (vp->v_type != VCHR && size > __type_max(off_t)) {
+		return EOVERFLOW;
+	}
+#endif
+	if (vp->v_type != VCHR && off > __type_max(off_t) - size) {
 		/* no offset wrapping */
 		return EOVERFLOW;
 	}

Index: src/sys/uvm/uvm_device.c
diff -u src/sys/uvm/uvm_device.c:1.77 src/sys/uvm/uvm_device.c:1.78
--- src/sys/uvm/uvm_device.c:1.77	Wed Jul  6 01:16:36 2022
+++ src/sys/uvm/uvm_device.c	Wed Jul  6 13:52:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_device.c,v 1.77 2022/07/06 01:16:36 riastradh Exp $	*/
+/*	$NetBSD: uvm_device.c,v 1.78 2022/07/06 13:52:24 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.77 2022/07/06 01:16:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_device.c,v 1.78 2022/07/06 13:52:24 riastradh Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -139,8 +139,10 @@ udv_attach(dev_t device, vm_prot_t acces
 	if ((cdev->d_flag & D_NEGOFFSAFE) == 0 && off != UVM_UNKNOWN_OFFSET) {
 		if (off < 0)
 			return NULL;
+#if SIZE_MAX > UINT32_MAX	/* XXX -Wtype-limits */
 		if (size > __type_max(voff_t))
 			return NULL;
+#endif
 		if (off > __type_max(voff_t) - size)
 			return NULL;
 	}



CVS commit: src/sys/dev/ic

2022-07-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jul  6 15:41:47 UTC 2022

Modified Files:
src/sys/dev/ic: i82596.c

Log Message:
s/ponters/pointers/


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/i82596.c

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



CVS commit: src/sys/dev/ic

2022-07-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jul  6 15:41:47 UTC 2022

Modified Files:
src/sys/dev/ic: i82596.c

Log Message:
s/ponters/pointers/


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/ic/i82596.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/ic/i82596.c
diff -u src/sys/dev/ic/i82596.c:1.46 src/sys/dev/ic/i82596.c:1.47
--- src/sys/dev/ic/i82596.c:1.46	Sun May 29 10:43:46 2022
+++ src/sys/dev/ic/i82596.c	Wed Jul  6 15:41:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.46 2022/05/29 10:43:46 rin Exp $ */
+/* $NetBSD: i82596.c,v 1.47 2022/07/06 15:41:47 andvar Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.46 2022/05/29 10:43:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.47 2022/07/06 15:41:47 andvar Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -132,7 +132,7 @@ static void iee_cb_setup(struct iee_soft
  * Rev B and C chips support big endian byte ordering for 32 bit entities,
  * and this new feature is enabled by IEE_SYSBUS_BE in the sysbus byte.
  *
- * With the IEE_SYSBUS_BE feature, all 32 bit address ponters are
+ * With the IEE_SYSBUS_BE feature, all 32 bit address pointers are
  * treated as true 32 bit entities but the SCB absolute address and
  * statistical counters are still treated as two 16 bit big endian entities,
  * so we have to always swap high and low words for these entities.



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

2022-07-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Wed Jul  6 14:34:13 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Return display depth correctly from WSDISPLAYIO_GET_FBINFO.
(previous workaround to always return 1 no longer needed with latest wsfb)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amiga/dev/amidisplaycc.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/amiga/dev/amidisplaycc.c
diff -u src/sys/arch/amiga/dev/amidisplaycc.c:1.39 src/sys/arch/amiga/dev/amidisplaycc.c:1.40
--- src/sys/arch/amiga/dev/amidisplaycc.c:1.39	Sun Feb  6 10:05:56 2022
+++ src/sys/arch/amiga/dev/amidisplaycc.c	Wed Jul  6 14:34:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $ */
+/*	$NetBSD: amidisplaycc.c,v 1.40 2022/07/06 14:34:13 jandberg Exp $ */
 
 /*-
  * Copyright (c) 2000 Jukka Andberg.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.39 2022/02/06 10:05:56 jandberg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amidisplaycc.c,v 1.40 2022/07/06 14:34:13 jandberg Exp $");
 
 /*
  * wscons interface to amiga custom chips. Contains the necessary functions
@@ -1112,14 +1112,13 @@ amidisplaycc_getfbinfo(struct amidisplay
 	bm = adp->gfxview->bitmap;
 	KASSERT(bm);
 
-	/* Depth 1 since current X wsfb driver doesn't support multiple bitplanes */
 	memset(fbinfo, 0, sizeof(*fbinfo));
-	fbinfo->fbi_fbsize = bm->bytes_per_row * bm->rows;
+	fbinfo->fbi_fbsize = bm->bytes_per_row * bm->rows * adp->gfxdepth;
 	fbinfo->fbi_fboffset = 0;
 	fbinfo->fbi_width = bm->bytes_per_row * 8;
 	fbinfo->fbi_height = bm->rows;
 	fbinfo->fbi_stride = bm->bytes_per_row;
-	fbinfo->fbi_bitsperpixel = 1;
+	fbinfo->fbi_bitsperpixel = adp->gfxdepth;
 	fbinfo->fbi_pixeltype = WSFB_CI;
 	fbinfo->fbi_flags = 0;
 	fbinfo->fbi_subtype.fbi_cmapinfo.cmap_entries = 1 << adp->gfxdepth;



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

2022-07-06 Thread Jukka Andberg
Module Name:src
Committed By:   jandberg
Date:   Wed Jul  6 14:34:13 UTC 2022

Modified Files:
src/sys/arch/amiga/dev: amidisplaycc.c

Log Message:
Return display depth correctly from WSDISPLAYIO_GET_FBINFO.
(previous workaround to always return 1 no longer needed with latest wsfb)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amiga/dev/amidisplaycc.c

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



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

2022-07-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  6 15:24:58 UTC 2022

Modified Files:
src/distrib/sets/lists/dtb: ad.aarch64eb

Log Message:
Tegra TX2 dtb files are build for big endian aarch64 too.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/dtb/ad.aarch64eb

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



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

2022-07-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  6 15:24:58 UTC 2022

Modified Files:
src/distrib/sets/lists/dtb: ad.aarch64eb

Log Message:
Tegra TX2 dtb files are build for big endian aarch64 too.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/dtb/ad.aarch64eb

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/dtb/ad.aarch64eb
diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.8 src/distrib/sets/lists/dtb/ad.aarch64eb:1.9
--- src/distrib/sets/lists/dtb/ad.aarch64eb:1.8	Fri Nov 12 21:55:46 2021
+++ src/distrib/sets/lists/dtb/ad.aarch64eb	Wed Jul  6 15:24:58 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64eb,v 1.8 2021/11/12 21:55:46 jmcneill Exp $
+# $NetBSD: ad.aarch64eb,v 1.9 2022/07/06 15:24:58 martin Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -146,6 +146,8 @@
 ./boot/dtb/freescale/imx8qxp-colibri-eval-v3.dtb dtb-base-boot  dtb
 ./boot/dtb/freescale/imx8qxp-mek.dtb dtb-base-boot  dtb
 ./boot/dtb/nvidiadtb-base-boot  dtb
+./boot/dtb/nvidia/tegra186-p2771-.dtbdtb-base-boot  dtb
+./boot/dtb/nvidia/tegra186-p3509-+p3636-0001.dtb dtb-base-boot  dtb
 ./boot/dtb/nvidia/tegra210-p2371-.dtbdtb-base-boot  dtb
 ./boot/dtb/nvidia/tegra210-p2371-2180.dtbdtb-base-boot  dtb
 ./boot/dtb/nvidia/tegra210-p2571.dtb dtb-base-boot  dtb



CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2022-07-06 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Wed Jul  6 14:27:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
Add support for 8bpp with Amiga native graphics.

Conversion to bitplane format is done in shadowfb update proc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.37 -r1.38 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c

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



CVS commit: xsrc/external/mit/xf86-video-wsfb/dist/src

2022-07-06 Thread Jukka Andberg
Module Name:xsrc
Committed By:   jandberg
Date:   Wed Jul  6 14:27:50 UTC 2022

Modified Files:
xsrc/external/mit/xf86-video-wsfb/dist/src: wsfb.h wsfb_driver.c

Log Message:
Add support for 8bpp with Amiga native graphics.

Conversion to bitplane format is done in shadowfb update proc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h
cvs rdiff -u -r1.37 -r1.38 \
xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_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-wsfb/dist/src/wsfb.h
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.7
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h:1.6	Tue Aug 16 06:28:25 2016
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb.h	Wed Jul  6 14:27:50 2022
@@ -63,6 +63,7 @@ typedef struct {
 	Bool			shadowFB;
 	Bool			HWCursor;
 	Bool			useSwap32;
+	Bool			planarAfb;
 	CloseScreenProcPtr	CloseScreen;
 	CreateScreenResourcesProcPtr CreateScreenResources;
 	void(*PointerMoved)(SCRN_ARG_TYPE, int, int);

Index: xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c
diff -u xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37 xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.38
--- xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c:1.37	Mon Dec 30 18:27:50 2019
+++ xsrc/external/mit/xf86-video-wsfb/dist/src/wsfb_driver.c	Wed Jul  6 14:27:50 2022
@@ -121,6 +121,8 @@ static Bool WsfbScreenInit(SCREEN_INIT_A
 static Bool WsfbCloseScreen(CLOSE_SCREEN_ARGS_DECL);
 static void *WsfbWindowLinear(ScreenPtr, CARD32, CARD32, int, CARD32 *,
 			  void *);
+static void *WsfbWindowAfb(ScreenPtr, CARD32, CARD32, int, CARD32 *,
+			  void *);
 static void WsfbPointerMoved(SCRN_ARG_TYPE, int, int);
 static Bool WsfbEnterVT(VT_FUNC_ARGS_DECL);
 static void WsfbLeaveVT(VT_FUNC_ARGS_DECL);
@@ -211,6 +213,7 @@ static const char *shadowSymbols[] = {
 	"shadowUpdatePackedWeak",
 	"shadowUpdateRotatePacked",
 	"shadowUpdateRotatePackedWeak",
+	"shadowUpdateAfb8",
 	NULL
 };
 
@@ -444,6 +447,13 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		return FALSE;
 	}
 
+	if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, ) == -1) {
+		xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
+			   "ioctl WSDISPLAY_GTYPE: %s\n",
+			   strerror(errno));
+		wstype = WSDISPLAY_TYPE_UNKNOWN;
+	}
+
 	if (ioctl(fPtr->fd, WSDISPLAYIO_GET_FBINFO, >fbi) != 0) {
 		struct wsdisplay_fbinfo info;
 		struct wsdisplayio_fbinfo *fbi = >fbi;
@@ -457,12 +467,6 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
    strerror(errno));
 			return FALSE;
 		}
-		if (ioctl(fPtr->fd, WSDISPLAYIO_GTYPE, ) == -1) {
-			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
-   "ioctl WSDISPLAY_GTYPE: %s\n",
-   strerror(errno));
-			return FALSE;
-		}
 		if (ioctl(fPtr->fd, WSDISPLAYIO_LINEBYTES, ) == -1) {
 			xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
    "ioctl WSDISPLAYIO_LINEBYTES: %s\n",
@@ -573,6 +577,25 @@ WsfbPreInit(ScrnInfoPtr pScrn, int flags
 		bitsperpixel = 1;
 	}
 #endif
+#if defined(__NetBSD__) && defined(WSDISPLAY_TYPE_AMIGACC)
+	if (wstype == WSDISPLAY_TYPE_AMIGACC)
+	{
+		/*
+		 * Video memory is organized in bitplanes.
+		 * 8bpp or 1bpp supported in this driver.
+		 * With 8bpp conversion to bitplane format
+		 * is done in shadow update proc.
+		 * With 1bpp no conversion needed.
+		 */
+		if (bitsperpixel == 8) {
+			fPtr->planarAfb = TRUE;
+		} else {
+			default_depth = 1;
+			bitsperpixel = 1;
+		}
+	}
+#endif
+
 	if (!xf86SetDepthBpp(pScrn, default_depth, default_depth,
 		bitsperpixel,
 		bitsperpixel >= 24 ? Support24bppFb|Support32bppFb : 0))
@@ -826,6 +849,7 @@ WsfbCreateScreenResources(ScreenPtr pScr
 	PixmapPtr pPixmap;
 	Bool ret;
 	void (*shadowproc)(ScreenPtr, shadowBufPtr);
+	ShadowWindowProc windowproc = WsfbWindowLinear;
 
 	pScreen->CreateScreenResources = fPtr->CreateScreenResources;
 	ret = pScreen->CreateScreenResources(pScreen);
@@ -841,11 +865,14 @@ WsfbCreateScreenResources(ScreenPtr pScr
 		shadowproc = WsfbShadowUpdateSwap32;
 	} else if (fPtr->rotate) {
 		shadowproc = shadowUpdateRotatePacked;
+	} else if (fPtr->planarAfb) {
+		shadowproc = shadowUpdateAfb8;
+		windowproc = WsfbWindowAfb;
 	} else
 		shadowproc = shadowUpdatePacked;
 	
 	if (!shadowAdd(pScreen, pPixmap, shadowproc,
-		WsfbWindowLinear, fPtr->rotate, NULL)) {
+		windowproc, fPtr->rotate, NULL)) {
 		return FALSE;
 	}
 	return TRUE;
@@ -987,6 +1014,9 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 			 */
 			len = pScrn->virtualX * pScrn->virtualY *
 			(pScrn->bitsPerPixel >> 3);
+		} else if (fPtr->planarAfb) {
+			/* always 8bpp */
+			len = pScrn->virtualX * pScrn->virtualY;
 		} else {
 			len = fPtr->fbi.fbi_stride * pScrn->virtualY;
 		}
@@ -1006,6 +1036,8 @@ WsfbScreenInit(SCREEN_INIT_ARGS_DECL)
 	 */
 	if (fPtr->rotate) {
 		

CVS commit: src/sys/dev/usb

2022-07-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul  6 15:24:14 UTC 2022

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

Log Message:
Add missing brace.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uplcom.c

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



CVS commit: src/sys/dev/usb

2022-07-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jul  6 15:24:14 UTC 2022

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

Log Message:
Add missing brace.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/usb/uplcom.c

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

Modified files:

Index: src/sys/dev/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.93 src/sys/dev/usb/uplcom.c:1.94
--- src/sys/dev/usb/uplcom.c:1.93	Wed Jul  6 06:25:24 2022
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 15:24:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.94 2022/07/06 15:24:14 hannken Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.94 2022/07/06 15:24:14 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -335,7 +335,7 @@ uplcom_attach(device_t parent, device_t 
 	/* print the chip type */
 	if (sc->sc_type == UPLCOM_TYPE_HXN) {
 		DPRINTF("chiptype HXN", 0, 0, 0, 0);
-	else if (sc->sc_type == UPLCOM_TYPE_HX) {
+	} else if (sc->sc_type == UPLCOM_TYPE_HX) {
 		DPRINTF("chiptype HX", 0, 0, 0, 0);
 	} else {
 		DPRINTF("chiptype 0", 0, 0, 0, 0);



CVS commit: src/sys/dev/nvmm

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 13:10:49 UTC 2022

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

Log Message:
nvmm(4): Fix typo in previous.

Didn't trip over this in my test build because nvmm is a module,
oops.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/nvmm/nvmm.c

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



CVS commit: src/sys/dev/nvmm

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 13:10:49 UTC 2022

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

Log Message:
nvmm(4): Fix typo in previous.

Didn't trip over this in my test build because nvmm is a module,
oops.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/nvmm/nvmm.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/nvmm/nvmm.c
diff -u src/sys/dev/nvmm/nvmm.c:1.44 src/sys/dev/nvmm/nvmm.c:1.45
--- src/sys/dev/nvmm/nvmm.c:1.44	Wed Jul  6 01:12:45 2022
+++ src/sys/dev/nvmm/nvmm.c	Wed Jul  6 13:10:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm.c,v 1.44 2022/07/06 01:12:45 riastradh Exp $	*/
+/*	$NetBSD: nvmm.c,v 1.45 2022/07/06 13:10:49 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2018-2020 Maxime Villard, m00nbsd.net
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.44 2022/07/06 01:12:45 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm.c,v 1.45 2022/07/06 13:10:49 riastradh Exp $");
 
 #include 
 #include 
@@ -1099,7 +1099,7 @@ nvmm_mmap(file_t *fp, off_t *offp, size_
 	nvmm_cpuid_t cpuid;
 	int error;
 
-	KASESRT(size > 0);
+	KASSERT(size > 0);
 
 	if (prot & PROT_EXEC)
 		return EACCES;



CVS commit: src

2022-07-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jul  6 12:33:42 UTC 2022

Modified Files:
src/lib/libcurses/PSD.doc: ex2.c
src/lib/libperfuse: ops.c
src/sys/arch/vax/vsa: lcg.c
src/sys/dev/pci/qat: qatvar.h
src/sys/dev/wscons: wscons_raster.h

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/PSD.doc/ex2.c
cvs rdiff -u -r1.90 -r1.91 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/vax/vsa/lcg.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/qat/qatvar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/wscons/wscons_raster.h

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



CVS commit: src

2022-07-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Wed Jul  6 12:33:42 UTC 2022

Modified Files:
src/lib/libcurses/PSD.doc: ex2.c
src/lib/libperfuse: ops.c
src/sys/arch/vax/vsa: lcg.c
src/sys/dev/pci/qat: qatvar.h
src/sys/dev/wscons: wscons_raster.h

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libcurses/PSD.doc/ex2.c
cvs rdiff -u -r1.90 -r1.91 src/lib/libperfuse/ops.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/vax/vsa/lcg.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/qat/qatvar.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/wscons/wscons_raster.h

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

Modified files:

Index: src/lib/libcurses/PSD.doc/ex2.c
diff -u src/lib/libcurses/PSD.doc/ex2.c:1.7 src/lib/libcurses/PSD.doc/ex2.c:1.8
--- src/lib/libcurses/PSD.doc/ex2.c:1.7	Thu Aug  7 16:44:27 2003
+++ src/lib/libcurses/PSD.doc/ex2.c	Wed Jul  6 12:33:41 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ex2.c,v 1.7 2003/08/07 16:44:27 agc Exp $
+.\"	$NetBSD: ex2.c,v 1.8 2022/07/06 12:33:41 andvar Exp $
 .\"
 .\" Copyright (c) 1992, 1993
 .\"	 The Regents of the University of California.  All rights reserved.
@@ -91,7 +91,7 @@ main()
 	 * 'b' - move cursor one position to the left.
 	 * 'n' - move cursor one line down.
 	 * 'p' - move cursor one line up.
-	 * 'h' - home cusor.
+	 * 'h' - home cursor.
 	 * 'l' - force refresh.
 	 * 'r' - simulate a carriage return.
 	 *

Index: src/lib/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.90 src/lib/libperfuse/ops.c:1.91
--- src/lib/libperfuse/ops.c:1.90	Tue Apr 12 21:05:36 2022
+++ src/lib/libperfuse/ops.c	Wed Jul  6 12:33:41 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.90 2022/04/12 21:05:36 andvar Exp $ */
+/*  $NetBSD: ops.c,v 1.91 2022/07/06 12:33:41 andvar Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -616,7 +616,7 @@ fuse_to_dirent(struct puffs_usermount *p
 		 * struct fuse_dirent is bigger than struct dirent,
 		 * so we should always use fd_len and never reallocate
 		 * later. 
-		 * If we have to reallocate,try to double the buffer
+		 * If we have to reallocate, try to double the buffer
 		 * each time so that we do not have to do it too often.
 		 */
 		if (written + reclen > dents_len) {
@@ -1857,7 +1857,7 @@ perfuse_node_setattr_ttl(struct puffs_us
 	/*
 	 * If only atime is changed, discard the operation: it
 	 * happens after read, and in that case the filesystem 
-	 * already updaed atime. NB: utimes() also change mtime.
+	 * already updated atime. NB: utimes() also change mtime.
 	 */
 	if (fsi->valid == FUSE_FATTR_ATIME)
 		fsi->valid &= ~FUSE_FATTR_ATIME;
@@ -2503,7 +2503,7 @@ perfuse_node_readdir(struct puffs_usermo
 		pnd->pnd_fd_cookie = 0;
 
 	/*
-	 * Do we already have the data bufered?
+	 * Do we already have the data buffered?
 	 */
 	if (pnd->pnd_dirent != NULL)
 		goto out;
@@ -2717,7 +2717,7 @@ perfuse_node_reclaim2(struct puffs_userm
 	/*
 	 * The kernel tells us how many lookups it made, which allows
 	 * us to detect that we have an uncompleted lookup and that the
-	 * node should not dispear.
+	 * node should not disappear.
 	 */
 	pnd->pnd_puffs_nlookup -= nlookup;
 	if (pnd->pnd_puffs_nlookup > 0)

Index: src/sys/arch/vax/vsa/lcg.c
diff -u src/sys/arch/vax/vsa/lcg.c:1.9 src/sys/arch/vax/vsa/lcg.c:1.10
--- src/sys/arch/vax/vsa/lcg.c:1.9	Sat Feb 12 17:09:43 2022
+++ src/sys/arch/vax/vsa/lcg.c	Wed Jul  6 12:33:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: lcg.c,v 1.9 2022/02/12 17:09:43 riastradh Exp $ */
+/*	$NetBSD: lcg.c,v 1.10 2022/07/06 12:33:41 andvar Exp $ */
 /*
  * LCG accelerated framebuffer driver
  * Copyright (c) 2003, 2004 Blaz Antonic
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.9 2022/02/12 17:09:43 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lcg.c,v 1.10 2022/07/06 12:33:41 andvar Exp $");
 
 #define LCG_NO_ACCEL
 
@@ -1256,7 +1256,7 @@ lcg_init_common(struct device *self, str
 	 *  1 1 video enable
 	 *  0 1 refresh clock enable
 	 */
-	/* prepare video_config reg for LUT relaod */
+	/* prepare video_config reg for LUT reload */
 	video_conf
 		 = (3 << 30) /* vertical state */
 		 | (3 << 28) /* horizontal state */
@@ -1272,7 +1272,7 @@ lcg_init_common(struct device *self, str
 		 | (1 << 12) /* enable horizontal sync */
 		 | (1 << 10) /* video clock select */
 		 | (1 << 6) /* video refresh select */
-		 | (1 << 4) /* read curosr output */
+		 | (1 << 4) /* read cursor output */
 		 | (1 << 3) /* LUT load enable */
 		 | (0 << 2) /* cursor enable */
 		 | (1 << 1) /* video enable */

Index: src/sys/dev/pci/qat/qatvar.h
diff -u src/sys/dev/pci/qat/qatvar.h:1.2 src/sys/dev/pci/qat/qatvar.h:1.3
--- src/sys/dev/pci/qat/qatvar.h:1.2	Sat Mar 14 18:08:39 2020
+++ src/sys/dev/pci/qat/qatvar.h	Wed Jul  6 12:33:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: qatvar.h,v 1.2 2020/03/14 18:08:39 ad Exp $	

CVS commit: src/sys/dev/pci

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:32:50 UTC 2022

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

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_vmx.c

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



CVS commit: src/sys/dev/pci

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:32:50 UTC 2022

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

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_vmx.c

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

Modified files:

Index: src/sys/dev/pci/if_vmx.c
diff -u src/sys/dev/pci/if_vmx.c:1.8 src/sys/dev/pci/if_vmx.c:1.9
--- src/sys/dev/pci/if_vmx.c:1.8	Tue May 24 02:22:47 2022
+++ src/sys/dev/pci/if_vmx.c	Wed Jul  6 06:32:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $	*/
+/*	$NetBSD: if_vmx.c,v 1.9 2022/07/06 06:32:50 msaitoh Exp $	*/
 /*	$OpenBSD: if_vmx.c,v 1.16 2014/01/22 06:04:17 brad Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.8 2022/05/24 02:22:47 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_vmx.c,v 1.9 2022/07/06 06:32:50 msaitoh Exp $");
 
 #include 
 #include 
@@ -2522,14 +2522,14 @@ vmxnet3_legacy_intr(void *xsc)
 	if (sc->vmx_ds->event != 0)
 		vmxnet3_evintr(sc);
 
-	VMXNET3_RXQ_LOCK(rxq);
-	rxmore = vmxnet3_rxq_eof(rxq, rxlimit);
-	VMXNET3_RXQ_UNLOCK(rxq);
-
 	VMXNET3_TXQ_LOCK(txq);
 	txmore = vmxnet3_txq_eof(txq, txlimit);
 	VMXNET3_TXQ_UNLOCK(txq);
 
+	VMXNET3_RXQ_LOCK(rxq);
+	rxmore = vmxnet3_rxq_eof(rxq, rxlimit);
+	VMXNET3_RXQ_UNLOCK(rxq);
+
 	if (txmore || rxmore)
 		vmxnet3_sched_handle_queue(sc, vmxq);
 	else {



CVS commit: src/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:00:40 UTC 2022

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

Log Message:
Add support for HXN variants from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/usb/uplcom.c

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



CVS commit: src/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:00:40 UTC 2022

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

Log Message:
Add support for HXN variants from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/usb/uplcom.c

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

Modified files:

Index: src/sys/dev/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.91 src/sys/dev/usb/uplcom.c:1.92
--- src/sys/dev/usb/uplcom.c:1.91	Sat Aug  7 16:19:17 2021
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 06:00:40 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.91 2021/08/07 16:19:17 thorpej Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.91 2021/08/07 16:19:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -112,15 +112,21 @@ fail:
 #define	UPLCOM_IFACE_INDEX	0
 #define	UPLCOM_SECOND_IFACE_INDEX	1
 
-#define	UPLCOM_SET_REQUEST	0x01
-#define	UPLCOM_SET_CRTSCTS_0	0x41
-#define	UPLCOM_SET_CRTSCTS_HX	0x61
-
-#define	UPLCOM_N_SERIAL_CTS	0x80
+#define	UPLCOM_SET_REQUEST		0x01
+#define	UPLCOM_SET_CRTSCTS_0		0x41
+#define	UPLCOM_SET_CRTSCTS_HX		0x61
+
+#define	UPLCOM_N_SERIAL_CTS		0x80
+
+#define UPLCOM_HXN_SET_REQUEST		0x80
+#define UPLCOM_HXN_SET_CRTSCTS_REG	0x0A
+#define UPLCOM_HXN_SET_CRTSCTS		0xFA
+#define UPLCOM_HX_STATUS_REG		0x8080
 
 enum  pl2303_type {
 	UPLCOM_TYPE_0,	/* we use this for all non-HX variants */
 	UPLCOM_TYPE_HX,
+	UPLCOM_TYPE_HXN,
 };
 
 struct	uplcom_softc {
@@ -233,6 +239,13 @@ static const struct usb_devno uplcom_dev
 	{ USB_VENDOR_COREGA, USB_PRODUCT_COREGA_CGUSBRS232R },
 	/* Sharp CE-175TU (USB to Zaurus option port 15 adapter) */
 	{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_CE175TU },
+	/* Various */
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GB },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GC },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GE },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GL },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GS },
+	{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2303GT },
 };
 #define uplcom_lookup(v, p) usb_lookup(uplcom_devs, v, p)
 
@@ -263,9 +276,11 @@ uplcom_attach(device_t parent, device_t 
 	usb_config_descriptor_t *cdesc;
 	usb_interface_descriptor_t *id;
 	usb_endpoint_descriptor_t *ed;
+	usb_device_request_t req;
 	char *devinfop;
 	const char *devname = device_xname(self);
 	usbd_status err;
+	uint8_t val;
 	int i;
 	struct ucom_attach_args ucaa;
 
@@ -301,12 +316,27 @@ uplcom_attach(device_t parent, device_t 
 	/* determine chip type */
 	ddesc = usbd_get_device_descriptor(dev);
 	if (ddesc->bDeviceClass != UDCLASS_COMM &&
-	ddesc->bMaxPacketSize == 0x40)
+	ddesc->bMaxPacketSize == 0x40) {
 		sc->sc_type = UPLCOM_TYPE_HX;
+	}
+
+	if (sc->sc_type == UPLCOM_TYPE_HX) {
+		req.bmRequestType = UT_READ_VENDOR_DEVICE;
+		req.bRequest = UPLCOM_SET_REQUEST;
+		USETW(req.wValue, UPLCOM_HX_STATUS_REG);
+		USETW(req.wIndex, sc->sc_iface_number);
+		USETW(req.wLength, 1);
+
+		err = usbd_do_request(sc->sc_udev, , );
+		if (err)
+			sc->sc_type = UPLCOM_TYPE_HXN;
+	}
 
 #ifdef UPLCOM_DEBUG
 	/* print the chip type */
-	if (sc->sc_type == UPLCOM_TYPE_HX) {
+	if (sc->sc_type == UPLCOM_TYPE_HXN) {
+		DPRINTF("chiptype HXN", 0, 0, 0, 0);
+	else if (sc->sc_type == UPLCOM_TYPE_HX) {
 		DPRINTF("chiptype HX", 0, 0, 0, 0);
 	} else {
 		DPRINTF("chiptype 0", 0, 0, 0, 0);
@@ -521,6 +551,9 @@ uplcom_reset(struct uplcom_softc *sc)
 	usb_device_request_t req;
 	usbd_status err;
 
+	if (sc->sc_type == UPLCOM_TYPE_HXN)
+		return 0;
+
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
 	req.bRequest = UPLCOM_SET_REQUEST;
 	USETW(req.wValue, 0);
@@ -693,9 +726,17 @@ uplcom_set_crtscts(struct uplcom_softc *
 	UPLCOMHIST_FUNC(); UPLCOMHIST_CALLED();
 
 	req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
-	req.bRequest = UPLCOM_SET_REQUEST;
-	USETW(req.wValue, 0);
-	if (sc->sc_type == UPLCOM_TYPE_HX)
+	if (sc->sc_type == UPLCOM_TYPE_HXN) {
+		req.bRequest = UPLCOM_HXN_SET_REQUEST;
+		USETW(req.wValue, UPLCOM_HXN_SET_CRTSCTS_REG);
+	} else {
+		req.bRequest = UPLCOM_SET_REQUEST;
+		USETW(req.wValue, 0);
+	}
+
+	if (sc->sc_type == UPLCOM_TYPE_HXN)
+		USETW(req.wIndex, UPLCOM_HXN_SET_CRTSCTS);
+	else if (sc->sc_type == UPLCOM_TYPE_HX)
 		USETW(req.wIndex, UPLCOM_SET_CRTSCTS_HX);
 	else
 		USETW(req.wIndex, UPLCOM_SET_CRTSCTS_0);



CVS commit: src/sys/dev/pci/ixgbe

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:31:47 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The legacy
interrupt function and MSI-X function call rxeof first, then rxeof.
For the workqueue function. rxeof is called first. Modify it to match with
other two.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.182 -r1.183 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: src/sys/dev/pci/ixgbe

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:31:47 UTC 2022

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The legacy
interrupt function and MSI-X function call rxeof first, then rxeof.
For the workqueue function. rxeof is called first. Modify it to match with
other two.


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.182 -r1.183 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.322 src/sys/dev/pci/ixgbe/ixgbe.c:1.323
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.322	Sat Jun 18 08:20:56 2022
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Wed Jul  6 06:31:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.322 2022/06/18 08:20:56 skrll Exp $ */
+/* $NetBSD: ixgbe.c,v 1.323 2022/07/06 06:31:47 msaitoh Exp $ */
 
 /**
 
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.322 2022/06/18 08:20:56 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.323 2022/07/06 06:31:47 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -6662,9 +6662,8 @@ ixgbe_handle_que(void *context)
 	IXGBE_EVC_ADD(>handleq, 1);
 
 	if (ifp->if_flags & IFF_RUNNING) {
-		more = ixgbe_rxeof(que);
 		IXGBE_TX_LOCK(txr);
-		more |= ixgbe_txeof(txr);
+		more = ixgbe_txeof(txr);
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
 			if (!ixgbe_mq_ring_empty(ifp, txr->txr_interq))
 ixgbe_mq_start_locked(ifp, txr);
@@ -6674,6 +6673,7 @@ ixgbe_handle_que(void *context)
 		&& (!ixgbe_legacy_ring_empty(ifp, NULL)))
 			ixgbe_legacy_start_locked(ifp, txr);
 		IXGBE_TX_UNLOCK(txr);
+		more |= ixgbe_rxeof(que);
 	}
 
 	if (more) {

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.182 src/sys/dev/pci/ixgbe/ixv.c:1.183
--- src/sys/dev/pci/ixgbe/ixv.c:1.182	Thu Jun  2 01:57:27 2022
+++ src/sys/dev/pci/ixgbe/ixv.c	Wed Jul  6 06:31:47 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: ixv.c,v 1.182 2022/06/02 01:57:27 msaitoh Exp $ */
+/* $NetBSD: ixv.c,v 1.183 2022/07/06 06:31:47 msaitoh Exp $ */
 
 /**
 
@@ -35,7 +35,7 @@
 /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.182 2022/06/02 01:57:27 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.183 2022/07/06 06:31:47 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -3296,9 +3296,8 @@ ixv_handle_que(void *context)
 	IXGBE_EVC_ADD(>handleq, 1);
 
 	if (ifp->if_flags & IFF_RUNNING) {
-		more = ixgbe_rxeof(que);
 		IXGBE_TX_LOCK(txr);
-		more |= ixgbe_txeof(txr);
+		more = ixgbe_txeof(txr);
 		if (!(adapter->feat_en & IXGBE_FEATURE_LEGACY_TX))
 			if (!ixgbe_mq_ring_empty(ifp, txr->txr_interq))
 ixgbe_mq_start_locked(ifp, txr);
@@ -3308,6 +3307,7 @@ ixv_handle_que(void *context)
 		&& (!ixgbe_legacy_ring_empty(ifp, NULL)))
 			ixgbe_legacy_start_locked(ifp, txr);
 		IXGBE_TX_UNLOCK(txr);
+		more |= ixgbe_rxeof(que);
 		if (more) {
 			IXGBE_EVC_ADD(>req, 1);
 			if (adapter->txrx_use_workqueue) {



CVS commit: src/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:25:24 UTC 2022

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

Log Message:
Cosmetic changes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/uplcom.c

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

Modified files:

Index: src/sys/dev/usb/uplcom.c
diff -u src/sys/dev/usb/uplcom.c:1.92 src/sys/dev/usb/uplcom.c:1.93
--- src/sys/dev/usb/uplcom.c:1.92	Wed Jul  6 06:00:40 2022
+++ src/sys/dev/usb/uplcom.c	Wed Jul  6 06:25:24 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $	*/
+/*	$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.92 2022/07/06 06:00:40 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.93 2022/07/06 06:25:24 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -115,13 +115,13 @@ fail:
 #define	UPLCOM_SET_REQUEST		0x01
 #define	UPLCOM_SET_CRTSCTS_0		0x41
 #define	UPLCOM_SET_CRTSCTS_HX		0x61
+#define UPLCOM_HX_STATUS_REG		0x8080
 
 #define	UPLCOM_N_SERIAL_CTS		0x80
 
 #define UPLCOM_HXN_SET_REQUEST		0x80
 #define UPLCOM_HXN_SET_CRTSCTS_REG	0x0A
 #define UPLCOM_HXN_SET_CRTSCTS		0xFA
-#define UPLCOM_HX_STATUS_REG		0x8080
 
 enum  pl2303_type {
 	UPLCOM_TYPE_0,	/* we use this for all non-HX variants */
@@ -316,9 +316,8 @@ uplcom_attach(device_t parent, device_t 
 	/* determine chip type */
 	ddesc = usbd_get_device_descriptor(dev);
 	if (ddesc->bDeviceClass != UDCLASS_COMM &&
-	ddesc->bMaxPacketSize == 0x40) {
+	ddesc->bMaxPacketSize == 0x40)
 		sc->sc_type = UPLCOM_TYPE_HX;
-	}
 
 	if (sc->sc_type == UPLCOM_TYPE_HX) {
 		req.bmRequestType = UT_READ_VENDOR_DEVICE;



CVS commit: src/sys/dev/usb

2022-07-06 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Wed Jul  6 06:25:24 UTC 2022

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

Log Message:
Cosmetic changes.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/usb/uplcom.c

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



CVS commit: src/sys/dev/pci

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:33:49 UTC 2022

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

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/pci/if_wm.c

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



CVS commit: src/sys/dev/pci

2022-07-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jul  6 06:33:49 UTC 2022

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

Log Message:
Call txeof first, then rxeof for the consistency.

 There are three functions where the txeof and rxeof are called. The MSI-X
interrupt function and the workqueue function call rxeof first, then rxeof.
For legacy interrupt. rxeof is called first. Modify it to match with other
two.


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/sys/dev/pci/if_wm.c

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

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.737 src/sys/dev/pci/if_wm.c:1.738
--- src/sys/dev/pci/if_wm.c:1.737	Wed Jul  6 05:49:46 2022
+++ src/sys/dev/pci/if_wm.c	Wed Jul  6 06:33:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.737 2022/07/06 05:49:46 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.738 2022/07/06 06:33:49 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.737 2022/07/06 05:49:46 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.738 2022/07/06 06:33:49 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -9946,6 +9946,29 @@ wm_intr_legacy(void *arg)
 	if (rndval == 0)
 		rndval = icr;
 
+	mutex_enter(txq->txq_lock);
+
+	if (txq->txq_stopping) {
+		mutex_exit(txq->txq_lock);
+		return 1;
+	}
+
+#if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS)
+	if (icr & ICR_TXDW) {
+		DPRINTF(sc, WM_DEBUG_TX,
+		("%s: TX: got TXDW interrupt\n",
+			device_xname(sc->sc_dev)));
+		WM_Q_EVCNT_INCR(txq, txdw);
+	}
+#endif
+	if (txlimit > 0) {
+		more |= wm_txeof(txq, txlimit);
+		if (!IF_IS_EMPTY(>if_snd))
+			more = true;
+	} else
+		more = true;
+	mutex_exit(txq->txq_lock);
+
 	mutex_enter(rxq->rxq_lock);
 
 	if (rxq->rxq_stopping) {
@@ -9974,28 +9997,6 @@ wm_intr_legacy(void *arg)
 
 	mutex_exit(rxq->rxq_lock);
 
-	mutex_enter(txq->txq_lock);
-
-	if (txq->txq_stopping) {
-		mutex_exit(txq->txq_lock);
-		return 1;
-	}
-
-#if defined(WM_DEBUG) || defined(WM_EVENT_COUNTERS)
-	if (icr & ICR_TXDW) {
-		DPRINTF(sc, WM_DEBUG_TX,
-		("%s: TX: got TXDW interrupt\n",
-			device_xname(sc->sc_dev)));
-		WM_Q_EVCNT_INCR(txq, txdw);
-	}
-#endif
-	if (txlimit > 0) {
-		more |= wm_txeof(txq, txlimit);
-		if (!IF_IS_EMPTY(>if_snd))
-			more = true;
-	} else
-		more = true;
-	mutex_exit(txq->txq_lock);
 	WM_CORE_LOCK(sc);
 
 	if (sc->sc_core_stopping) {



CVS commit: src/sys/net

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 08:06:59 UTC 2022

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

Log Message:
net/if_ppp.c: Sprinkle KNF.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/net/if_ppp.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/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.167 src/sys/net/if_ppp.c:1.168
--- src/sys/net/if_ppp.c:1.167	Wed Jan 29 04:28:27 2020
+++ src/sys/net/if_ppp.c	Wed Jul  6 08:06:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.168 2022/07/06 08:06:59 riastradh Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.167 2020/01/29 04:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.168 2022/07/06 08:06:59 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -323,7 +323,7 @@ ppp_create(const char *name, int unit)
 	sc->sc_fastq.ifq_maxlen = IFQ_MAXLEN;
 	sc->sc_rawq.ifq_maxlen = IFQ_MAXLEN;
 	/* Ratio of 1:2 packets between the regular and the fast queue */
-	sc->sc_maxfastq = 2;	
+	sc->sc_maxfastq = 2;
 	IFQ_SET_READY(>sc_if.if_snd);
 	if_attach(>sc_if);
 	if_alloc_sadl(>sc_if);
@@ -384,7 +384,7 @@ pppalloc(pid_t pid)
 	if (sc->sc_si == NULL) {
 		printf("%s: unable to establish softintr\n",
 		sc->sc_if.if_xname);
-		return (NULL);
+		return NULL;
 	}
 	sc->sc_flags = 0;
 	sc->sc_mru = PPP_MRU;
@@ -514,14 +514,14 @@ pppioctl(struct ppp_softc *sc, u_long cm
 		if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE,
 			KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, >sc_if,
 			KAUTH_ARG(cmd), NULL) != 0)
-			return (EPERM);
+			return EPERM;
 		break;
 	case PPPIOCXFERUNIT:
 		/* XXX: Why is this privileged?! */
 		if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE,
 			KAUTH_REQ_NETWORK_INTERFACE_GETPRIV, >sc_if,
 			KAUTH_ARG(cmd), NULL) != 0)
-			return (EPERM);
+			return EPERM;
 		break;
 	default:
 		break;
@@ -593,22 +593,22 @@ pppioctl(struct ppp_softc *sc, u_long cm
 
 #ifdef PPP_COMPRESS
 	case PPPIOCSCOMPRESS:
-		odp = (struct ppp_option_data *) data;
+		odp = (struct ppp_option_data *)data;
 		nb = odp->length;
 		if (nb > sizeof(ccp_option))
 			nb = sizeof(ccp_option);
 		if ((error = copyin(odp->ptr, ccp_option, nb)) != 0)
-			return (error);
+			return error;
 		/* preliminary check on the length byte */
 		if (ccp_option[1] < 2)
-			return (EINVAL);
+			return EINVAL;
 		cp = ppp_get_compressor(ccp_option[0]);
 		if (cp == NULL) {
 			if (sc->sc_flags & SC_DEBUG)
 printf("%s: no compressor for [%x %x %x], %x\n",
 sc->sc_if.if_xname, ccp_option[0],
 ccp_option[1], ccp_option[2], nb);
-			return (EINVAL);	/* no handler found */
+			return EINVAL;	/* no handler found */
 		}
 		/*
 		 * Found a handler for the protocol - try to allocate
@@ -650,12 +650,12 @@ pppioctl(struct ppp_softc *sc, u_long cm
 			sc->sc_flags &= ~SC_DECOMP_RUN;
 			splx(s);
 		}
-		return (error);
+		return error;
 #endif /* PPP_COMPRESS */
 
 	case PPPIOCGNPMODE:
 	case PPPIOCSNPMODE:
-		npi = (struct npioctl *) data;
+		npi = (struct npioctl *)data;
 		switch (npi->protocol) {
 		case PPP_IP:
 			npx = NP_IP;
@@ -699,7 +699,7 @@ pppioctl(struct ppp_softc *sc, u_long cm
 	case PPPIOCSOPASS:
 	case PPPIOCSIACTIVE:
 	case PPPIOCSOACTIVE:
-		nbp = (struct bpf_program *) data;
+		nbp = (struct bpf_program *)data;
 		if ((unsigned) nbp->bf_len > BPF_MAXINSNS)
 			return EINVAL;
 		newcodelen = nbp->bf_len * sizeof(struct bpf_insn);
@@ -735,7 +735,7 @@ pppioctl(struct ppp_softc *sc, u_long cm
 			break;
 		default:
 			free(newcode, M_DEVBUF);
-			return (EPASSTHROUGH);
+			return EPASSTHROUGH;
 		}
 		oldcode = bp->bf_insns;
 		s = splnet();
@@ -748,9 +748,9 @@ pppioctl(struct ppp_softc *sc, u_long cm
 #endif /* PPP_FILTER */
 
 	default:
-		return (EPASSTHROUGH);
+		return EPASSTHROUGH;
 	}
-	return (0);
+	return 0;
 }
 
 /*
@@ -817,7 +817,7 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
 		break;
 
 	case SIOCGPPPSTATS:
-		psp = &((struct ifpppstatsreq *) data)->stats;
+		psp = &((struct ifpppstatsreq *)data)->stats;
 		memset(psp, 0, sizeof(*psp));
 		psp->p = sc->sc_stats;
 #if defined(VJC) && !defined(SL_NO_STATS)
@@ -836,7 +836,7 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
 
 #ifdef PPP_COMPRESS
 	case SIOCGPPPCSTATS:
-		pcp = &((struct ifpppcstatsreq *) data)->stats;
+		pcp = &((struct ifpppcstatsreq *)data)->stats;
 		memset(pcp, 0, sizeof(*pcp));
 		if (sc->sc_xc_state != NULL)
 			(*sc->sc_xcomp->comp_stat)(sc->sc_xc_state, >c);
@@ -851,7 +851,7 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
 		break;
 	}
 	splx(s);
-	return (error);
+	return error;
 }
 
 /*
@@ -873,8 +873,10 @@ pppoutput(struct ifnet *ifp, struct mbuf
 	enum NPmode mode;
 	int len;
 
-	if 

CVS commit: src/sys/net

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 08:07:23 UTC 2022

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

Log Message:
net/if_ppp.c: Avoid user-controlled overrun in PPPIOCSCOMPRESS.

Reported-by: syzbot+2c7bda7dc2b6c0d4f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_ppp.c

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



CVS commit: src/sys/net

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 08:07:23 UTC 2022

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

Log Message:
net/if_ppp.c: Avoid user-controlled overrun in PPPIOCSCOMPRESS.

Reported-by: syzbot+2c7bda7dc2b6c0d4f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/net/if_ppp.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/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.168 src/sys/net/if_ppp.c:1.169
--- src/sys/net/if_ppp.c:1.168	Wed Jul  6 08:06:59 2022
+++ src/sys/net/if_ppp.c	Wed Jul  6 08:07:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.168 2022/07/06 08:06:59 riastradh Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.169 2022/07/06 08:07:23 riastradh Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.168 2022/07/06 08:06:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.169 2022/07/06 08:07:23 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -597,6 +597,8 @@ pppioctl(struct ppp_softc *sc, u_long cm
 		nb = odp->length;
 		if (nb > sizeof(ccp_option))
 			nb = sizeof(ccp_option);
+		if (nb < 3)
+			return EINVAL;
 		if ((error = copyin(odp->ptr, ccp_option, nb)) != 0)
 			return error;
 		/* preliminary check on the length byte */



CVS commit: src/sys/net

2022-07-06 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  6 08:06:59 UTC 2022

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

Log Message:
net/if_ppp.c: Sprinkle KNF.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/net/if_ppp.c

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



CVS commit: src/libexec/ld.elf_so/arch/powerpc

2022-07-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  6 17:35:20 UTC 2022

Modified Files:
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Fix copy & pasto: DTPREL relocations do not need to allocate a static
TLS index. Patch from joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c
diff -u src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.61 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.62
--- src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c:1.61	Sun May 24 02:33:11 2020
+++ src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	Wed Jul  6 17:35:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppc_reloc.c,v 1.61 2020/05/24 02:33:11 macallan Exp $	*/
+/*	$NetBSD: ppc_reloc.c,v 1.62 2022/07/06 17:35:20 martin Exp $	*/
 
 /*-
  * Copyright (C) 1998	Tsubai Masanari
@@ -30,7 +30,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: ppc_reloc.c,v 1.61 2020/05/24 02:33:11 macallan Exp $");
+__RCSID("$NetBSD: ppc_reloc.c,v 1.62 2022/07/06 17:35:20 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -313,9 +313,6 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
 			break;
 
 		case R_TYPE(DTPREL):
-			if (!defobj->tls_done && _rtld_tls_offset_allocate(obj))
-return -1;
-
 			*where = (Elf_Addr)(def->st_value + rela->r_addend
 			- TLS_DTV_OFFSET);
 			rdbg(("DTPREL32 %s in %s --> %p in %s",



CVS commit: src/libexec/ld.elf_so/arch/powerpc

2022-07-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jul  6 17:35:20 UTC 2022

Modified Files:
src/libexec/ld.elf_so/arch/powerpc: ppc_reloc.c

Log Message:
Fix copy & pasto: DTPREL relocations do not need to allocate a static
TLS index. Patch from joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/libexec/ld.elf_so/arch/powerpc/ppc_reloc.c

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



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

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 21:13:13 UTC 2022

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

Log Message:
tests/lint: add test for 'assignment in conditional context'


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_159.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_159.c
diff -u src/tests/usr.bin/xlint/lint1/msg_159.c:1.3 src/tests/usr.bin/xlint/lint1/msg_159.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_159.c:1.3	Thu Jun 16 16:58:36 2022
+++ src/tests/usr.bin/xlint/lint1/msg_159.c	Wed Jul  6 21:13:13 2022
@@ -1,8 +1,41 @@
-/*	$NetBSD: msg_159.c,v 1.3 2022/06/16 16:58:36 rillig Exp $	*/
+/*	$NetBSD: msg_159.c,v 1.4 2022/07/06 21:13:13 rillig Exp $	*/
 # 3 "msg_159.c"
 
 // Test for message: assignment in conditional context [159]
 
-/* expect+1: error: syntax error ':' [249] */
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+const char *
+example(int a, int b)
+{
+
+	if (a == b)
+		return "comparison, not parenthesized";
+
+	if ((a == b))
+		return "comparison, parenthesized";
+
+	if (
+# 20 "msg_159.c" 3 4
+	(a == b)
+# 22 "msg_159.c"
+	)
+		return "comparison, parenthesized, from system header";
+
+	/* expect+1: warning: assignment in conditional context [159] */
+	if (a = b)
+		return "assignment, not parenthesized";
+
+	/*
+	 * XXX: GCC has the convention that an assignment that is
+	 * parenthesized is intended as an assignment.
+	 */
+	/* expect+1: warning: assignment in conditional context [159] */
+	if ((a = b))
+		return "assignment, parenthesized";
+
+	if ((a = b) != 0)
+		return "explicit comparison after assignment";
+
+	return "other";
+}



CVS commit: src

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 22:26:31 UTC 2022

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

Log Message:
lint: do not warn about 'may lose accuracy' in safe cases of '%'

The possible values of the expression 'a % b' for unsigned integers lie
between 0 and (b - 1).  For signed integers, it's more complicated, so
ignore them for now.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.471 -r1.472 src/usr.bin/xlint/lint1/tree.c

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



CVS commit: src

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 22:26:31 UTC 2022

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

Log Message:
lint: do not warn about 'may lose accuracy' in safe cases of '%'

The possible values of the expression 'a % b' for unsigned integers lie
between 0 and (b - 1).  For signed integers, it's more complicated, so
ignore them for now.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/usr.bin/xlint/lint1/msg_132.c
cvs rdiff -u -r1.471 -r1.472 src/usr.bin/xlint/lint1/tree.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.22 src/tests/usr.bin/xlint/lint1/msg_132.c:1.23
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.22	Wed Jul  6 21:59:06 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Wed Jul  6 22:26:31 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.22 2022/07/06 21:59:06 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.23 2022/07/06 22:26:31 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -290,18 +290,22 @@ void
 test_ic_mod(void)
 {
 	/* The result is between 0 and 254. */
-	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
 	u8 = u64 % u8;
 
+	/* The result is between 0 and 255. */
+	u8 = u64 % 256;
+
+	/* The result is between 0 and 256. */
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
+	u8 = u64 % 257;
+
 	/* The result is between 0 and 1000. */
 	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
 	u8 = u64 % 1000;
-	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned short' may lose accuracy [132] */
-	u16 = u64 % 1000;
 	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int:9' may lose accuracy [132] */
 	bits.u9 = u64 % 1000;
-	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int:10' may lose accuracy [132] */
 	bits.u10 = u64 % 1000;
+	u16 = u64 % 1000;
 
 	/*
 	 * For signed division, if the result of 'a / b' is not representable
@@ -309,8 +313,19 @@ test_ic_mod(void)
 	 * '(a / b) * a + a % b == a'.
 	 *
 	 * If the result of 'a / b' is not representable exactly, the result
-	 * of 'a % b' is not defined.
+	 * of 'a % b' is not defined.  Due to this uncertainty, lint does not
+	 * narrow down the range for signed modulo expressions.
 	 *
 	 * C90 6.3.5, C99 6.5.5.
 	 */
+
+	/* expect+1: warning: conversion from 'int' to 'signed char' may lose accuracy [132] */
+	s8 = s16 % s8;
+
+	/*
+	 * The result is always 0, it's a theoretical edge case though, so
+	 * lint doesn't care to implement this.
+	 */
+	/* expect+1: warning: conversion from 'long long' to 'signed char' may lose accuracy [132] */
+	s8 = s64 % 1;
 }

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.471 src/usr.bin/xlint/lint1/tree.c:1.472
--- src/usr.bin/xlint/lint1/tree.c:1.471	Tue Jul  5 22:50:41 2022
+++ src/usr.bin/xlint/lint1/tree.c	Wed Jul  6 22:26:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.471 2022/07/05 22:50:41 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.472 2022/07/06 22:26:30 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: tree.c,v 1.471 2022/07/05 22:50:41 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.472 2022/07/06 22:26:30 rillig Exp $");
 #endif
 
 #include 
@@ -104,6 +104,18 @@ static	void	check_precedence_confusion(t
 
 extern sig_atomic_t fpe;
 
+static uint64_t
+u64_fill_right(uint64_t x)
+{
+	x |= x >> 1;
+	x |= x >> 2;
+	x |= x >> 4;
+	x |= x >> 8;
+	x |= x >> 16;
+	x |= x >> 32;
+	return x;
+}
+
 static bool
 ic_maybe_signed(const type_t *tp, const integer_constraints *ic)
 {
@@ -200,6 +212,23 @@ ic_bitor(integer_constraints a, integer_
 }
 
 static integer_constraints
+ic_mod(const type_t *tp, integer_constraints a, integer_constraints b)
+{
+	integer_constraints c;
+
+	if (ic_maybe_signed(tp, ) || ic_maybe_signed(tp, ))
+		return ic_any(tp);
+
+	c.smin = INT64_MIN;
+	c.smax = INT64_MAX;
+	c.umin = 0;
+	c.umax = b.umax - 1;
+	c.bset = 0;
+	c.bclr = ~u64_fill_right(c.umax);
+	return c;
+}
+
+static integer_constraints
 ic_shl(const type_t *tp, integer_constraints a, integer_constraints b)
 {
 	integer_constraints c;
@@ -264,6 +293,10 @@ ic_expr(const tnode_t *tn)
 			return ic_any(tn->tn_type);
 		lc = ic_expr(tn->tn_left);
 		return ic_cvt(tn->tn_type, tn->tn_left->tn_type, lc);
+	case MOD:
+		lc = ic_expr(before_conversion(tn->tn_left));
+		rc = ic_expr(before_conversion(tn->tn_right));
+		return ic_mod(tn->tn_type, lc, rc);
 	case SHL:
 		lc = ic_expr(tn->tn_left);
 		rc = ic_expr(tn->tn_right);



Re: CVS commit: src/external/historical/nawk/bin

2022-07-06 Thread Christos Zoulas
In article ,
Valery Ushakov   wrote:
>On Tue, Jul 05, 2022 at 20:20:09 -, Christos Zoulas wrote:
>
>> In article <20220705184003.aa082f...@cvs.netbsd.org>,
>> Valeriy E. Ushakov  wrote:
>> >-=-=-=-=-=-
>> >
>> >Module Name:src
>> >Committed By:   uwe
>> >Date:   Tue Jul  5 18:40:03 UTC 2022
>> >
>> >Modified Files:
>> >src/external/historical/nawk/bin: awk.1
>> >
>> >Log Message:
>> >awk(1): consistent Capitalization.
>> 
>> Thanks uwe! Are you planning to upstream all these changes?
>
>This is our mdocified bin/awk.1, upstream is dist/awk.1 that is
>-man-old, so I'm not sure how to proceed.  Also most of the changes I
>made are strictly mdoc related.  POSIX has quite a bit more elaborate
>awk man page that spells out many details, importing some more of that
>might be good but it's somewhat heavy, prescriptive prose and requires
>some editing for better readibility, IMHO - not something I feel
>qualified to do.

Ok thanks. I will check with upstream on replacing theirs with ours.

christos



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

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 21:13:13 UTC 2022

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

Log Message:
tests/lint: add test for 'assignment in conditional context'


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_159.c

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



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

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 21:59:07 UTC 2022

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

Log Message:
tests/lint: test 'may lose accuracy' for '%'

For unsigned integers, the possible range of the result can be narrowed
down by looking at the right operand of the '%'.  Right now, lint
doesn't do this though.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/msg_132.c

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



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

2022-07-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Jul  6 21:59:07 UTC 2022

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

Log Message:
tests/lint: test 'may lose accuracy' for '%'

For unsigned integers, the possible range of the result can be narrowed
down by looking at the right operand of the '%'.  Right now, lint
doesn't do this though.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/msg_132.c

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

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_132.c
diff -u src/tests/usr.bin/xlint/lint1/msg_132.c:1.21 src/tests/usr.bin/xlint/lint1/msg_132.c:1.22
--- src/tests/usr.bin/xlint/lint1/msg_132.c:1.21	Sun Jul  3 14:35:54 2022
+++ src/tests/usr.bin/xlint/lint1/msg_132.c	Wed Jul  6 21:59:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_132.c,v 1.21 2022/07/03 14:35:54 rillig Exp $	*/
+/*	$NetBSD: msg_132.c,v 1.22 2022/07/06 21:59:06 rillig Exp $	*/
 # 3 "msg_132.c"
 
 // Test for message: conversion from '%s' to '%s' may lose accuracy [132]
@@ -22,6 +22,7 @@ typedef signed short s16_t;
 typedef signed int s32_t;
 typedef signed long long s64_t;
 
+
 u8_t u8;
 u16_t u16;
 u32_t u32;
@@ -32,6 +33,23 @@ s16_t s16;
 s32_t s32;
 s64_t s64;
 
+struct bit_fields {
+	unsigned u1:1;
+	unsigned u2:2;
+	unsigned u3:3;
+	unsigned u4:4;
+	unsigned u5:5;
+	unsigned u6:6;
+	unsigned u7:7;
+	unsigned u8:8;
+	unsigned u9:9;
+	unsigned u10:10;
+	unsigned u11:11;
+	unsigned u12:12;
+	unsigned u32:32;
+} bits;
+
+
 void
 unsigned_to_unsigned(void)
 {
@@ -223,26 +241,27 @@ test_ic_shr(u64_t x)
 	return x;
 }
 
-
-struct bit_fields {
-	unsigned bits_32: 32;
-	unsigned bits_5: 5;
-	unsigned bits_3: 3;
-};
-
 unsigned char
-test_bit_fields(struct bit_fields s, unsigned long long m)
+test_bit_fields(unsigned long long m)
 {
 	/* expect+1: warning: conversion from 'unsigned long long:32' to 'unsigned int:3' may lose accuracy [132] */
-	s.bits_3 = s.bits_32 & m;
+	bits.u3 = bits.u32 & m;
 
-	s.bits_5 = s.bits_3 & m;
-	s.bits_32 = s.bits_5 & m;
+	bits.u5 = bits.u3 & m;
+	bits.u32 = bits.u5 & m;
 
 	/* expect+1: warning: conversion from 'unsigned long long:32' to 'unsigned char' may lose accuracy [132] */
-	return s.bits_32 & m;
+	return bits.u32 & m;
 }
 
+/*
+ * Traditional C has an extra rule that the right-hand operand of a bit shift
+ * operator is converted to 'int'.  Before tree.c 1.467 from 2022-07-02, this
+ * conversion was implemented as a CVT node, which means a cast, not an
+ * implicit conversion.  Changing the CVT to NOOP would have caused a wrong
+ * warning 'may lose accuracy' in language levels other than traditional C.
+ */
+
 u64_t
 u64_shl(u64_t lhs, u64_t rhs)
 {
@@ -266,3 +285,32 @@ s64_shr(s64_t lhs, s64_t rhs)
 {
 	return lhs >> rhs;
 }
+
+void
+test_ic_mod(void)
+{
+	/* The result is between 0 and 254. */
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
+	u8 = u64 % u8;
+
+	/* The result is between 0 and 1000. */
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned char' may lose accuracy [132] */
+	u8 = u64 % 1000;
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned short' may lose accuracy [132] */
+	u16 = u64 % 1000;
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int:9' may lose accuracy [132] */
+	bits.u9 = u64 % 1000;
+	/* expect+1: warning: conversion from 'unsigned long long' to 'unsigned int:10' may lose accuracy [132] */
+	bits.u10 = u64 % 1000;
+
+	/*
+	 * For signed division, if the result of 'a / b' is not representable
+	 * exactly, the result of 'a % b' is defined such that
+	 * '(a / b) * a + a % b == a'.
+	 *
+	 * If the result of 'a / b' is not representable exactly, the result
+	 * of 'a % b' is not defined.
+	 *
+	 * C90 6.3.5, C99 6.5.5.
+	 */
+}



re: CVS commit: src/external/historical/nawk/bin

2022-07-06 Thread matthew green
Christos Zoulas writes:
> In article <20220705184003.aa082f...@cvs.netbsd.org>,
> Valeriy E. Ushakov  wrote:
> >-=-=-=-=-=-
> >
> >Module Name: src
> >Committed By:uwe
> >Date:Tue Jul  5 18:40:03 UTC 2022
> >
> >Modified Files:
> > src/external/historical/nawk/bin: awk.1
> >
> >Log Message:
> >awk(1): consistent Capitalization.
> >
>
> Thanks uwe! Are you planning to upstream all these changes?

this version is our mandoc.  the upstream version is
old mdoc macros and you're the source of the original
non-dist/ awk.1 :-)

revision 1.1
date: 2010-08-26 07:57:16 -0700;  author: christos;  state: Exp;
awk glue

(there's no vendor branch for this file etc.)


.mrg.