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

2021-05-26 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu May 27 04:55:34 UTC 2021

Modified Files:
src/distrib/sets/lists/xserver: md.sparc

Log Message:
Restore the pnozz Xorg driver, now that it has EXA support.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/distrib/sets/lists/xserver/md.sparc

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/xserver/md.sparc
diff -u src/distrib/sets/lists/xserver/md.sparc:1.74 src/distrib/sets/lists/xserver/md.sparc:1.75
--- src/distrib/sets/lists/xserver/md.sparc:1.74	Tue Nov 10 21:47:41 2020
+++ src/distrib/sets/lists/xserver/md.sparc	Thu May 27 04:55:34 2021
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc,v 1.74 2020/11/10 21:47:41 kamil Exp $
+# $NetBSD: md.sparc,v 1.75 2021/05/27 04:55:34 jdc Exp $
 ./usr/X11R7/bin/X	xserver-xorg-server-bin	xorg
 ./usr/X11R7/bin/Xorg	xserver-xorg-server-bin	xorg
 ./usr/X11R7/bin/cvt	xserver-xorg-server-bin	xorg
@@ -39,10 +39,8 @@
 ./usr/X11R7/lib/modules/drivers/mga_drv.so.2		xserver-xf86-video-mga-drivers	xorg
 ./usr/X11R7/lib/modules/drivers/mouse_drv.so		xserver-xf86-input-mouse-drivers	xorg
 ./usr/X11R7/lib/modules/drivers/mouse_drv.so.1		xserver-xf86-input-mouse-drivers	xorg
-./usr/X11R7/lib/modules/drivers/pnozz_drv.so		-unknown-	xorg,xorg_server_ver=110
-./usr/X11R7/lib/modules/drivers/pnozz_drv.so		xserver-obsolete	xorg,xorg_server_ver=120,obsolete
-./usr/X11R7/lib/modules/drivers/pnozz_drv.so.0		-unknown-	xorg,xorg_server_ver=110
-./usr/X11R7/lib/modules/drivers/pnozz_drv.so.0		xserver-obsolete	xorg,xorg_server_ver=120,obsolete
+./usr/X11R7/lib/modules/drivers/pnozz_drv.so		xserver-xf86-video-pnozz-drivers	xorg
+./usr/X11R7/lib/modules/drivers/pnozz_drv.so.0		xserver-xf86-video-pnozz-drivers	xorg
 ./usr/X11R7/lib/modules/drivers/r128_drv.so		xserver-xf86-video-r128-drivers	xorg
 ./usr/X11R7/lib/modules/drivers/r128_drv.so.6		xserver-xf86-video-r128-drivers	xorg
 ./usr/X11R7/lib/modules/drivers/radeon_drv.so		xserver-xf86-video-radeon-kms-drivers	xorg
@@ -192,8 +190,7 @@
 ./usr/X11R7/man/cat4/kbd.0xserver-xf86-input-keyboard-catman	.cat,xorg
 ./usr/X11R7/man/cat4/mga.0xserver-xf86-video-mga-catman	.cat,xorg
 ./usr/X11R7/man/cat4/mousedrv.0xserver-xf86-input-mouse-catman	.cat,xorg
-./usr/X11R7/man/cat4/pnozz.0-unknown-	.cat,xorg,xorg_server_ver=110
-./usr/X11R7/man/cat4/pnozz.0xserver-obsolete	.cat,xorg,xorg_server_ver=120,obsolete
+./usr/X11R7/man/cat4/pnozz.0xserver-xf86-video-pnozz-drivers	.cat,xorg
 ./usr/X11R7/man/cat4/r128.0xserver-xf86-video-r128-catman	.cat,xorg
 ./usr/X11R7/man/cat4/radeon.0xserver-xf86-video-radeon-kms-catman	.cat,xorg
 ./usr/X11R7/man/cat4/suncg14.0xserver-xf86-video-suncg14-catman	.cat,xorg
@@ -218,8 +215,7 @@
 ./usr/X11R7/man/html4/kbd.htmlxserver-xf86-input-keyboard-htmlman	html,xorg
 ./usr/X11R7/man/html4/mga.htmlxserver-xf86-video-mga-htmlman	html,xorg
 ./usr/X11R7/man/html4/mousedrv.html			xserver-xf86-input-mouse-htmlman	html,xorg
-./usr/X11R7/man/html4/pnozz.html			-unknown-	html,xorg,xorg_server_ver=110
-./usr/X11R7/man/html4/pnozz.html			xserver-obsolete	html,xorg,xorg_server_ver=120,obsolete
+./usr/X11R7/man/html4/pnozz.html			xserver-xf86-video-pnozz-drivers	html
 ./usr/X11R7/man/html4/r128.htmlxserver-xf86-video-r128-htmlman	html,xorg
 ./usr/X11R7/man/html4/radeon.html			xserver-xf86-video-radeon-kms-htmlman	html,xorg
 ./usr/X11R7/man/html4/suncg14.html			xserver-xf86-video-suncg14-htmlman	html,xorg
@@ -244,8 +240,7 @@
 ./usr/X11R7/man/man4/kbd.4xserver-xf86-input-keyboard-man	.man,xorg
 ./usr/X11R7/man/man4/mga.4xserver-xf86-video-mga-man	.man,xorg
 ./usr/X11R7/man/man4/mousedrv.4xserver-xf86-input-mouse-man	.man,xorg
-./usr/X11R7/man/man4/pnozz.4-unknown-	.man,xorg,xorg_server_ver=110
-./usr/X11R7/man/man4/pnozz.4xserver-obsolete	.man,xorg,xorg_server_ver=120,obsolete
+./usr/X11R7/man/man4/pnozz.4xserver-xf86-video-pnozz-drivers	.man,xorg
 ./usr/X11R7/man/man4/r128.4xserver-xf86-video-r128-man	.man,xorg
 ./usr/X11R7/man/man4/radeon.4xserver-xf86-video-radeon-kms-man	.man,xorg
 ./usr/X11R7/man/man4/suncg14.4xserver-xf86-video-suncg14-man	.man,xorg



CVS commit: src/external/mit/xorg/server/drivers

2021-05-26 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu May 27 04:54:21 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers: Makefile

Log Message:
Restore the build of the pnozz driver on sparc, now that it has EXA support.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/external/mit/xorg/server/drivers/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/server/drivers/Makefile
diff -u src/external/mit/xorg/server/drivers/Makefile:1.101 src/external/mit/xorg/server/drivers/Makefile:1.102
--- src/external/mit/xorg/server/drivers/Makefile:1.101	Sun Mar  7 10:42:27 2021
+++ src/external/mit/xorg/server/drivers/Makefile	Thu May 27 04:54:21 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.101 2021/03/07 10:42:27 rin Exp $
+#	$NetBSD: Makefile,v 1.102 2021/05/27 04:54:21 jdc Exp $
 
 .include 
 
@@ -335,6 +335,7 @@ SUBDIR+= \
 
 .if ${MACHINE} == "sparc"
 SUBDIR+= \
+	xf86-video-pnozz \
 	xf86-video-suncg14 \
 	xf86-video-suntcx
 



CVS commit: src/external/mit/xorg/server/drivers/xf86-video-pnozz

2021-05-26 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Thu May 27 04:53:44 UTC 2021

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-pnozz: Makefile

Log Message:
Update the pnozz files list for EXA support.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 \
src/external/mit/xorg/server/drivers/xf86-video-pnozz/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/server/drivers/xf86-video-pnozz/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile:1.1 src/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile:1.2
--- src/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile:1.1	Wed Aug 26 22:30:46 2009
+++ src/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile	Thu May 27 04:53:44 2021
@@ -1,12 +1,16 @@
-#	$NetBSD: Makefile,v 1.1 2009/08/26 22:30:46 macallan Exp $
+#	$NetBSD: Makefile,v 1.2 2021/05/27 04:53:44 jdc Exp $
 
 DRIVER=		xf86-video-pnozz
 DRIVER_NAME=	pnozz_drv
 
-SRCS=		pnozz_driver.c pnozz_cursor.c pnozz_accel.c
+SRCS=		pnozz_driver.c pnozz_cursor.c pnozz_accel.c pnozz_exa.c
 
 CPPFLAGS+=	${X11FLAGS.DRI}
 
 MAN=		pnozz.4
 
 .include "../Makefile.xf86-driver"
+
+# XXX
+COPTS.pnozz_accel.c+=	${${ACTIVE_CC} == "gcc":? -Wno-error=discarded-qualifiers :}
+COPTS.pnozz_accel.c+=	${${ACTIVE_CC} == "clang":? -Wno-error=incompatible-pointer-types-discards-qualifiers :}



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

2021-05-26 Thread Julian Coleman
Module Name:xsrc
Committed By:   jdc
Date:   Thu May 27 04:48:10 UTC 2021

Modified Files:
xsrc/external/mit/xf86-video-pnozz/dist/src: pnozz.h pnozz_accel.c
pnozz_cursor.c pnozz_driver.c
Added Files:
xsrc/external/mit/xf86-video-pnozz/dist/src: compat-api.h pnozz_exa.c

Log Message:
Add support for EXA, so that the pnozz driver works again with Xorg.
Note, that only minimal acceleration is currently supported.

Thanks to macallan for the pointers to get this working.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
xsrc/external/mit/xf86-video-pnozz/dist/src/compat-api.h \
xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_exa.c
cvs rdiff -u -r1.1 -r1.2 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h
cvs rdiff -u -r1.2 -r1.3 \
xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c \
xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_cursor.c
cvs rdiff -u -r1.6 -r1.7 \
xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_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-pnozz/dist/src/pnozz.h
diff -u xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h:1.1 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h:1.2
--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h:1.1	Wed Aug 26 22:28:26 2009
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz.h	Thu May 27 04:48:10 2021
@@ -20,7 +20,7 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-/* $NetBSD: pnozz.h,v 1.1 2009/08/26 22:28:26 macallan Exp $ */
+/* $NetBSD: pnozz.h,v 1.2 2021/05/27 04:48:10 jdc Exp $ */
 
 #ifndef PNOZZ_H
 #define PNOZZ_H
@@ -29,10 +29,14 @@
 #include "xf86_OSproc.h"
 #include "xf86RamDac.h"
 #include 
+#include 
 #include "gcstruct.h"
 #include "pnozz_regs.h"
 #include "xf86sbusBus.h"
+#ifdef HAVE_XAA_H
 #include "xaa.h"
+#endif
+#include "exa.h"
 
 typedef struct {
 	unsigned int fg, bg;			/* FG/BG colors for stipple */
@@ -53,19 +57,29 @@ typedef struct {
 	int		width;
 	int		height, scanlinesize, maxheight;
 	int		depthshift;
+	int		vidmem;
 
 	sbusDevicePtr	psdp;
+	struct fbcursor Cursor;
 	Bool		HWCursor;
 	Bool		NoAccel;
+	Bool		useXAA;
 	CloseScreenProcPtr CloseScreen;
 	
 	xf86CursorInfoPtr CursorInfoRec;
-	struct fbcursor Cursor;
+	unsigned int	CursorXY;
+	int		CursorBg, CursorFg;
+	Bool		CursorEnabled;
+	unsigned int	cursmask[32];	/* cursor mask bits */
+	unsigned int	cursbits[32];	/* what to show where mask enabled */
 	unsigned char pal[9];
 	
 	OptionInfoPtr	Options;
-	XAAInfoRecPtr	pXAA;
+	ExaDriverPtr	pExa;
+	int		srcoff;
+#ifdef HAVE_XAA_H
 	unsigned char	*buffers[2];
+#endif
 	/*
 	 * XXX this is enough for everything a SPARCbook could do on it's
 	 * internal display but not necessarily for an external one
@@ -114,7 +128,9 @@ unsigned char pnozz_read_dac_ctl_reg(Pno
 void pnozz_write_dac_cmap_reg(PnozzPtr, int, unsigned int);
 
 int PnozzAccelInit(ScrnInfoPtr);
+Bool PnozzDGAInit(ScreenPtr);
+int PnozzEXAInit(ScreenPtr);
 void PnozzHideCursor(ScrnInfoPtr);
 void PnozzShowCursor(ScrnInfoPtr);
 
-#endif /* CG6_H */
+#endif /* PNOZZ_H */

Index: xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c
diff -u xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c:1.2 xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c:1.3
--- xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c:1.2	Wed May 25 14:15:26 2011
+++ xsrc/external/mit/xf86-video-pnozz/dist/src/pnozz_accel.c	Thu May 27 04:48:10 2021
@@ -20,15 +20,15 @@
  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
-/* $NetBSD: pnozz_accel.c,v 1.2 2011/05/25 14:15:26 christos Exp $ */
+/* $NetBSD: pnozz_accel.c,v 1.3 2021/05/27 04:48:10 jdc Exp $ */
 
-#include 
-#include 
-#include 
-#include 
-#include 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 
 #include "pnozz.h"
+#include "pnozz_regs.h"
+#include "dgaproc.h"
 
 static CARD32 PnozzCopyROP[] = {
 	/*GXclear*/		0,
@@ -68,6 +68,31 @@ static CARD32 PnozzDrawROP[] = {
 	/*GXset*/		ROP_PAT
 };
 
+/* DGA stuff */
+
+static Bool Pnozz_OpenFramebuffer(ScrnInfoPtr pScrn, char **,
+unsigned char **mem, int *, int *, int *);
+static Bool Pnozz_SetMode(ScrnInfoPtr, DGAModePtr);
+static void Pnozz_SetViewport(ScrnInfoPtr, int, int, int);
+static int Pnozz_GetViewport(ScrnInfoPtr);
+static void Pnozz_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
+static void Pnozz_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
+
+static void PnozzSync(ScrnInfoPtr);
+
+static DGAFunctionRec Pnozz_DGAFuncs = {
+Pnozz_OpenFramebuffer,
+NULL,
+Pnozz_SetMode,
+Pnozz_SetViewport,
+Pnozz_GetViewport,
+PnozzSync,
+Pnozz_FillRect,
+

CVS commit: src/sys/arch/mips/cavium/dev

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 03:23:29 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Move the send queue checking to a new function, and also call this
in the rx interrupt path.  Measureable improvement on a NFS "create
small files" test.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/dev/if_cnmac.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/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.26
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25	Thu May 27 01:43:32 2021
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 03:23:29 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.26 2021/05/27 03:23:29 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -122,6 +122,7 @@ static inline void cnmac_send_queue_flus
 static inline void cnmac_send_queue_flush_fetch(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush(struct cnmac_softc *);
 static inline void cnmac_send_queue_flush_sync(struct cnmac_softc *);
+static void cnmac_send_queue_check_and_flush(struct cnmac_softc *);
 static inline int cnmac_send_queue_is_full(struct cnmac_softc *);
 static inline void cnmac_send_queue_add(struct cnmac_softc *, struct mbuf *,
 uint64_t *);
@@ -604,6 +605,23 @@ cnmac_send_queue_is_full(struct cnmac_so
 	return 0;
 }
 
+static void
+cnmac_send_queue_check_and_flush(struct cnmac_softc *sc)
+{
+	int s;
+
+	/* XXX XXX XXX */
+	s = splnet();
+	if (sc->sc_soft_req_cnt > 0) {
+		cnmac_send_queue_flush_prefetch(sc);
+		cnmac_send_queue_flush_fetch(sc);
+		cnmac_send_queue_flush(sc);
+		cnmac_send_queue_flush_sync(sc);
+	}
+	splx(s);
+	/* XXX XXX XXX */
+}
+
 /*
  * (Ab)use m_nextpkt and m_paddr to maintain mbuf chain and pointer to gather
  * buffer.  Other mbuf members may be used by m_freem(), so don't touch them!
@@ -1299,6 +1317,8 @@ cnmac_intr(void *arg)
 		}
 
 		(void)cnmac_recv(sc, work);
+
+		cnmac_send_queue_check_and_flush(sc);
 	}
 
 	_POW_WR8(sc->sc_pow, POW_WQ_INT_OFFSET, wqmask);
@@ -1326,21 +1346,11 @@ cnmac_tick_free(void *arg)
 {
 	struct cnmac_softc *sc = arg;
 	int timo;
-	int s;
 
-	s = splnet();
-	/* XXX XXX XXX */
-	if (sc->sc_soft_req_cnt > 0) {
-		cnmac_send_queue_flush_prefetch(sc);
-		cnmac_send_queue_flush_fetch(sc);
-		cnmac_send_queue_flush(sc);
-		cnmac_send_queue_flush_sync(sc);
-	}
-	/* XXX XXX XXX */
+	cnmac_send_queue_check_and_flush(sc);
 
 	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(>sc_tick_free_ch, timo);
-	splx(s);
 }
 
 /*



CVS commit: src/sys/arch/mips/cavium/dev

2021-05-26 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu May 27 01:43:32 UTC 2021

Modified Files:
src/sys/arch/mips/cavium/dev: if_cnmac.c

Log Message:
Schedule the send cleanup function for next tick in cnmac_start().  In
the send cleanup function, schedule for the next tick instead of waiting
for HZ ticks if there are still send requests outstanding.  Greatly
increases NFS throughput, perhaps other types of network traffic.

Use callout_setfunc() after callout_init() instead of callout_reset().


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/mips/cavium/dev/if_cnmac.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/mips/cavium/dev/if_cnmac.c
diff -u src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24 src/sys/arch/mips/cavium/dev/if_cnmac.c:1.25
--- src/sys/arch/mips/cavium/dev/if_cnmac.c:1.24	Tue Jun 23 05:17:13 2020
+++ src/sys/arch/mips/cavium/dev/if_cnmac.c	Thu May 27 01:43:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $	*/
+/*	$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.24 2020/06/23 05:17:13 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cnmac.c,v 1.25 2021/05/27 01:43:32 simonb Exp $");
 
 /*
  * If no free send buffer is available, free all the sent buffers and bail out.
@@ -278,7 +278,10 @@ cnmac_attach(device_t parent, device_t s
 	octgmx_stats_init(sc->sc_gmx_port);
 
 	callout_init(>sc_tick_misc_ch, 0);
+	callout_setfunc(>sc_tick_misc_ch, cnmac_tick_misc, sc);
+
 	callout_init(>sc_tick_free_ch, 0);
+	callout_setfunc(>sc_tick_free_ch, cnmac_tick_free, sc);
 
 	const int dv_unit = device_unit(self);
 	octfau_op_init(>sc_fau_done,
@@ -998,6 +1001,7 @@ cnmac_start(struct ifnet *ifp)
 			if (wdc > 0)
 octpko_op_doorbell_write(sc->sc_port,
 sc->sc_port, wdc);
+			callout_schedule(>sc_tick_free_ch, 1);
 			return;
 		}
 		/* XXX XXX XXX */
@@ -1031,6 +1035,7 @@ cnmac_start(struct ifnet *ifp)
 
 last:
 	cnmac_send_queue_flush_fetch(sc);
+	callout_schedule(>sc_tick_free_ch, 1);
 }
 
 static void
@@ -1073,8 +1078,8 @@ cnmac_init(struct ifnet *ifp)
 
 	octgmx_set_filter(sc->sc_gmx_port);
 
-	callout_reset(>sc_tick_misc_ch, hz, cnmac_tick_misc, sc);
-	callout_reset(>sc_tick_free_ch, hz, cnmac_tick_free, sc);
+	callout_schedule(>sc_tick_misc_ch, hz);
+	callout_schedule(>sc_tick_free_ch, hz);
 
 	SET(ifp->if_flags, IFF_RUNNING);
 	CLR(ifp->if_flags, IFF_OACTIVE);
@@ -1097,7 +1102,6 @@ cnmac_stop(struct ifnet *ifp, int disabl
 	/* Mark the interface as down and cancel the watchdog timer. */
 	CLR(ifp->if_flags, IFF_RUNNING | IFF_OACTIVE);
 	ifp->if_timer = 0;
-
 }
 
 /*  misc */
@@ -1334,13 +1338,8 @@ cnmac_tick_free(void *arg)
 	}
 	/* XXX XXX XXX */
 
-	/* XXX XXX XXX */
-	/* ??? */
-	timo = hz - (100 * sc->sc_ext_callback_cnt);
-	if (timo < 10)
-		 timo = 10;
+	timo = (sc->sc_ext_callback_cnt > 0) ? 1 : hz;
 	callout_schedule(>sc_tick_free_ch, timo);
-	/* XXX XXX XXX */
 	splx(s);
 }
 



CVS commit: src/doc

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 22:54:45 UTC 2021

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new isc-dhcp


To generate a diff of this commit:
cvs rdiff -u -r1.1801 -r1.1802 src/doc/3RDPARTY
cvs rdiff -u -r1.2808 -r1.2809 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.1801 src/doc/3RDPARTY:1.1802
--- src/doc/3RDPARTY:1.1801	Sun May  2 04:18:38 2021
+++ src/doc/3RDPARTY	Wed May 26 18:54:45 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1801 2021/05/02 08:18:38 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.1802 2021/05/26 22:54:45 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -335,12 +335,12 @@ distribution into the netbsd format.  Th
 src/lib/libc/db/db2netbsd.
 
 Package:	dhcp
-Version:	4.4.2
-Current Vers:	4.4.2
+Version:	4.4.2-P1
+Current Vers:	4.4.2-P1
 Maintainer:	mellon
 Archive Site:	ftp://ftp.isc.org/isc/dhcp/
 Home Page:	http://www.isc.org/software/dhcp/
-Date:		2020-08-03
+Date:		2021-05-26
 Mailing List:	dhcp-ser...@isc.org
 Mailing List:	dhcp-cli...@isc.org
 Mailing List:	dhcp-annou...@isc.org

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2808 src/doc/CHANGES:1.2809
--- src/doc/CHANGES:1.2808	Wed May 19 12:06:13 2021
+++ src/doc/CHANGES	Wed May 26 18:54:45 2021
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2808 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2809 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -375,3 +375,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	wskbd(4): Added German Neo 2 layout. [nia 20210511]
 	spiflash(4): Add support for Rockchip RK3328. [mrg 20210514]
 	lagg(4): Added a link-aggregation interface. [yamaguchi 20210517]
+	dhcp: Import version 4.4.2-P1. [christos 20210526]



CVS commit: src/external/mpl/dhcp/dist

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 22:52:32 UTC 2021

Modified Files:
src/external/mpl/dhcp/dist/client: dhclient.c
src/external/mpl/dhcp/dist/common: parse.c
src/external/mpl/dhcp/dist/common/tests: option_unittest.c
src/external/mpl/dhcp/dist/relay: dhcrelay.c
src/external/mpl/dhcp/dist/relay/tests: relay_unittests.c
src/external/mpl/dhcp/dist/server: dhcpd.c

Log Message:
merge local changes between dhcp-4.4.2 and dhcp-4.4.2-P1


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/client/dhclient.c
cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/common/parse.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/mpl/dhcp/dist/common/tests/option_unittest.c
cvs rdiff -u -r1.4 -r1.5 src/external/mpl/dhcp/dist/relay/dhcrelay.c
cvs rdiff -u -r1.2 -r1.3 \
src/external/mpl/dhcp/dist/relay/tests/relay_unittests.c
cvs rdiff -u -r1.3 -r1.4 src/external/mpl/dhcp/dist/server/dhcpd.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/mpl/dhcp/dist/client/dhclient.c
diff -u src/external/mpl/dhcp/dist/client/dhclient.c:1.3 src/external/mpl/dhcp/dist/client/dhclient.c:1.4
--- src/external/mpl/dhcp/dist/client/dhclient.c:1.3	Mon Aug  3 17:10:56 2020
+++ src/external/mpl/dhcp/dist/client/dhclient.c	Wed May 26 18:52:31 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $	*/
+/*	$NetBSD: dhclient.c,v 1.4 2021/05/26 22:52:31 christos Exp $	*/
 
 /* dhclient.c
 
DHCP Client. */
 
 /*
- * Copyright (c) 2004-2020 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2021 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -33,7 +33,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.4 2021/05/26 22:52:31 christos Exp $");
 
 #include "dhcpd.h"
 #include 
@@ -84,7 +84,7 @@ int decline_wait_time = 10; /* Default t
 #define ASSERT_STATE(state_is, state_shouldbe) {}
 
 #ifndef UNIT_TEST
-static const char copyright[] = "Copyright 2004-2020 Internet Systems Consortium.";
+static const char copyright[] = "Copyright 2004-2021 Internet Systems Consortium.";
 static const char arr [] = "All rights reserved.";
 static const char message [] = "Internet Systems Consortium DHCP Client";
 static const char url [] = "For info, please visit https://www.isc.org/software/dhcp/;;
@@ -241,7 +241,7 @@ add_interfaces(char **ifaces, int niface
  */
 
 #include 
-__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.4 2021/05/26 22:52:31 christos Exp $");
 
 #if defined(DHCPv6) && defined(DHCP4o6)
 static void dhcp4o6_poll(void *dummy);
@@ -1230,7 +1230,7 @@ int find_subnet (struct subnet **sp,
  */
 
 #include 
-__RCSID("$NetBSD: dhclient.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
+__RCSID("$NetBSD: dhclient.c,v 1.4 2021/05/26 22:52:31 christos Exp $");
 
 void state_reboot (cpp)
 	void *cpp;

Index: src/external/mpl/dhcp/dist/common/parse.c
diff -u src/external/mpl/dhcp/dist/common/parse.c:1.3 src/external/mpl/dhcp/dist/common/parse.c:1.4
--- src/external/mpl/dhcp/dist/common/parse.c:1.3	Mon Aug  3 17:10:56 2020
+++ src/external/mpl/dhcp/dist/common/parse.c	Wed May 26 18:52:31 2021
@@ -1,11 +1,11 @@
-/*	$NetBSD: parse.c,v 1.3 2020/08/03 21:10:56 christos Exp $	*/
+/*	$NetBSD: parse.c,v 1.4 2021/05/26 22:52:31 christos Exp $	*/
 
 /* parse.c
 
Common parser code for dhcpd and dhclient. */
 
 /*
- * Copyright (c) 2004-2019 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2021 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
@@ -29,7 +29,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: parse.c,v 1.3 2020/08/03 21:10:56 christos Exp $");
+__RCSID("$NetBSD: parse.c,v 1.4 2021/05/26 22:52:31 christos Exp $");
 
 #include "dhcpd.h"
 #include 
@@ -5561,13 +5561,14 @@ int parse_X (cfile, buf, max)
 skip_to_semi (cfile);
 return 0;
 			}
-			convert_num (cfile,  [len], val, 16, 8);
-			if (len++ > max) {
+			if (len >= max) {
 parse_warn (cfile,
 	"hexadecimal constant too long.");
 skip_to_semi (cfile);
 return 0;
 			}
+			convert_num (cfile,  [len], val, 16, 8);
+			len++;
 			token = peek_token (, (unsigned *)0, cfile);
 			if (token == COLON)
 token = next_token (,

Index: src/external/mpl/dhcp/dist/common/tests/option_unittest.c
diff -u src/external/mpl/dhcp/dist/common/tests/option_unittest.c:1.2 src/external/mpl/dhcp/dist/common/tests/option_unittest.c:1.3
--- src/external/mpl/dhcp/dist/common/tests/option_unittest.c:1.2	Sat Apr  7 18:37:29 

CVS import: src/external/mpl/dhcp/dist

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 22:48:53 UTC 2021

Update of /cvsroot/src/external/mpl/dhcp/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv13052

Log Message:
Import dhcp-4.4.2-P1:
 ! Corrected a buffer overwrite possible when parsing hexadecimal
   literals with more than 1024 octets. Reported by Jon Franklin from Dell,
   and also by Pawel Wieczorkiewicz from Amazon Web Services.
   [Gitlab #182]
   CVE: CVE-2021-25217

Status:

Vendor Tag: ISC
Release Tags:   DHCP4_4_2_P1

U src/external/mpl/dhcp/dist/Makefile.am
U src/external/mpl/dhcp/dist/configure
U src/external/mpl/dhcp/dist/configure.ac
U src/external/mpl/dhcp/dist/aclocal.m4
U src/external/mpl/dhcp/dist/Makefile.in
U src/external/mpl/dhcp/dist/README
U src/external/mpl/dhcp/dist/compile
U src/external/mpl/dhcp/dist/config.guess
U src/external/mpl/dhcp/dist/config.sub
U src/external/mpl/dhcp/dist/depcomp
U src/external/mpl/dhcp/dist/install-sh
U src/external/mpl/dhcp/dist/missing
U src/external/mpl/dhcp/dist/RELNOTES
U src/external/mpl/dhcp/dist/LICENSE
U src/external/mpl/dhcp/dist/configure.ac+lt
U src/external/mpl/dhcp/dist/config+lt
U src/external/mpl/dhcp/dist/CONTRIBUTING.md
U src/external/mpl/dhcp/dist/bind/Makefile.in
U src/external/mpl/dhcp/dist/bind/bind.tar.gz
U src/external/mpl/dhcp/dist/bind/version.tmp
U src/external/mpl/dhcp/dist/client/Makefile.am
U src/external/mpl/dhcp/dist/client/dhclient.conf.example
U src/external/mpl/dhcp/dist/client/Makefile.in
U src/external/mpl/dhcp/dist/client/client_tables.c
U src/external/mpl/dhcp/dist/client/clparse.c
C src/external/mpl/dhcp/dist/client/dhclient.c
U src/external/mpl/dhcp/dist/client/dhc6.c
U src/external/mpl/dhcp/dist/client/dhclient.8
U src/external/mpl/dhcp/dist/client/dhclient-script.8
U src/external/mpl/dhcp/dist/client/dhclient.conf.5
U src/external/mpl/dhcp/dist/client/dhclient.leases.5
U src/external/mpl/dhcp/dist/client/tests/Atffile
U src/external/mpl/dhcp/dist/client/tests/Kyuafile
U src/external/mpl/dhcp/dist/client/tests/Makefile.am
U src/external/mpl/dhcp/dist/client/tests/Makefile.in
U src/external/mpl/dhcp/dist/client/tests/duid_unittest.c
U src/external/mpl/dhcp/dist/client/tests/duid0_test.txt
U src/external/mpl/dhcp/dist/client/tests/duid1_test.txt
U src/external/mpl/dhcp/dist/client/tests/duid2_test.txt
U src/external/mpl/dhcp/dist/client/tests/duid3_test.txt
U src/external/mpl/dhcp/dist/client/scripts/bsdos
U src/external/mpl/dhcp/dist/client/scripts/freebsd
U src/external/mpl/dhcp/dist/client/scripts/linux
U src/external/mpl/dhcp/dist/client/scripts/macos
U src/external/mpl/dhcp/dist/client/scripts/netbsd
U src/external/mpl/dhcp/dist/client/scripts/nextstep
U src/external/mpl/dhcp/dist/client/scripts/openbsd
U src/external/mpl/dhcp/dist/client/scripts/solaris
U src/external/mpl/dhcp/dist/client/scripts/openwrt
U src/external/mpl/dhcp/dist/common/Makefile.am
U src/external/mpl/dhcp/dist/common/Makefile.am.in
U src/external/mpl/dhcp/dist/common/Makefile.in
U src/external/mpl/dhcp/dist/common/alloc.c
U src/external/mpl/dhcp/dist/common/bpf.c
U src/external/mpl/dhcp/dist/common/comapi.c
U src/external/mpl/dhcp/dist/common/conflex.c
U src/external/mpl/dhcp/dist/common/ctrace.c
U src/external/mpl/dhcp/dist/common/dhcp4o6.c
U src/external/mpl/dhcp/dist/common/discover.c
U src/external/mpl/dhcp/dist/common/dispatch.c
U src/external/mpl/dhcp/dist/common/dlpi.c
U src/external/mpl/dhcp/dist/common/dns.c
U src/external/mpl/dhcp/dist/common/ethernet.c
U src/external/mpl/dhcp/dist/common/execute.c
U src/external/mpl/dhcp/dist/common/fddi.c
U src/external/mpl/dhcp/dist/common/icmp.c
U src/external/mpl/dhcp/dist/common/inet.c
U src/external/mpl/dhcp/dist/common/lpf.c
U src/external/mpl/dhcp/dist/common/memory.c
U src/external/mpl/dhcp/dist/common/nit.c
U src/external/mpl/dhcp/dist/common/ns_name.c
U src/external/mpl/dhcp/dist/common/options.c
U src/external/mpl/dhcp/dist/common/packet.c
C src/external/mpl/dhcp/dist/common/parse.c
U src/external/mpl/dhcp/dist/common/print.c
U src/external/mpl/dhcp/dist/common/raw.c
U src/external/mpl/dhcp/dist/common/resolv.c
U src/external/mpl/dhcp/dist/common/socket.c
U src/external/mpl/dhcp/dist/common/tables.c
U src/external/mpl/dhcp/dist/common/tr.c
U src/external/mpl/dhcp/dist/common/tree.c
U src/external/mpl/dhcp/dist/common/upf.c
U src/external/mpl/dhcp/dist/common/dhcp-eval.5
U src/external/mpl/dhcp/dist/common/dhcp-options.5
U src/external/mpl/dhcp/dist/common/tests/Atffile
U src/external/mpl/dhcp/dist/common/tests/Kyuafile
U src/external/mpl/dhcp/dist/common/tests/Makefile.am
U src/external/mpl/dhcp/dist/common/tests/Makefile.in
U src/external/mpl/dhcp/dist/common/tests/test_alloc.c
U src/external/mpl/dhcp/dist/common/tests/dns_unittest.c
U src/external/mpl/dhcp/dist/common/tests/domain_name_test.c
U src/external/mpl/dhcp/dist/common/tests/misc_unittest.c
U src/external/mpl/dhcp/dist/common/tests/ns_name_test.c
C src/external/mpl/dhcp/dist/common/tests/option_unittest.c
U 

CVS commit: src/sys/dev/usb

2021-05-26 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed May 26 22:37:21 UTC 2021

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

Log Message:
xhci: Fix logic in waiting for command queue access.

_Either_ an existing command in progress, _or_ an existing suspend in
progress that is not done by us, should block us; the logic I wrote
previously erroneously blocked only if both conditions happened at
the same time.

Should fix issue reported by Andrius V in the PR kern/56050 followup
discussion.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/usb/xhci.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/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.140 src/sys/dev/usb/xhci.c:1.141
--- src/sys/dev/usb/xhci.c:1.140	Sun May 23 21:12:28 2021
+++ src/sys/dev/usb/xhci.c	Wed May 26 22:37:21 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.140 2021/05/23 21:12:28 riastradh Exp $	*/
+/*	$NetBSD: xhci.c,v 1.141 2021/05/26 22:37:21 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.140 2021/05/23 21:12:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.141 2021/05/26 22:37:21 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -3194,9 +3194,8 @@ xhci_do_command_locked(struct xhci_softc
 	KASSERTMSG(!cpu_intr_p() && !cpu_softintr_p(), "called from intr ctx");
 	KASSERT(mutex_owned(>sc_lock));
 
-	while (sc->sc_command_addr != 0 &&
-	sc->sc_suspender != NULL &&
-	sc->sc_suspender != curlwp)
+	while (sc->sc_command_addr != 0 ||
+	(sc->sc_suspender != NULL && sc->sc_suspender != curlwp))
 		cv_wait(>sc_cmdbusy_cv, >sc_lock);
 
 	/*



CVS commit: src

2021-05-26 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Wed May 26 22:26:16 UTC 2021

Modified Files:
src: README.md

Log Message:
suggest libera.chat instead


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/README.md

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

Modified files:

Index: src/README.md
diff -u src/README.md:1.6 src/README.md:1.7
--- src/README.md:1.6	Wed Mar 17 15:26:20 2021
+++ src/README.md	Wed May 26 22:26:16 2021
@@ -35,7 +35,7 @@ Troubleshooting
 - Send bugs and patches [via web form](https://www.NetBSD.org/cgi-bin/sendpr.cgi?gndb=netbsd).
 - Subscribe to the [mailing lists](https://www.NetBSD.org/mailinglists/).
   The [netbsd-users](https://www.NetBSD.org/mailinglists/#netbsd-users) list is a good choice for many problems; watch [current-users](https://www.NetBSD.org/mailinglists/#current-users) if you follow the bleeding edge of NetBSD-current.
-- Join the community IRC channel [#netbsd @ freenode](https://webchat.freenode.net/?channels=#netbsd).
+- Join the community IRC channel [#netbsd @ libera.chat](https://kiwiirc.com/nextclient/irc.libera.chat/netbsd).
 
 Latest sources
 --



CVS commit: src

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 21:58:58 UTC 2021

Modified Files:
src: build.sh

Log Message:
handle different flavors of date(1)


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

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.350 src/build.sh:1.351
--- src/build.sh:1.350	Mon May 17 13:12:12 2021
+++ src/build.sh	Wed May 26 17:58:58 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.350 2021/05/17 17:12:12 christos Exp $
+#	$NetBSD: build.sh,v 1.351 2021/05/26 21:58:58 christos Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1973,7 +1973,7 @@ createmakewrapper()
 	eval cat < /dev/null) || date -u -d "@$1"
+}
+
 setup_mkrepro()
 {
 	if [ ${MKREPRO-no} != "yes" ]; then
@@ -2350,7 +2355,7 @@ setup_mkrepro()
 	done
 
 	[ "${MKREPRO_TIMESTAMP}" != "0" ] || bomb "Failed to compute timestamp"
-	statusmsg2 "MKREPRO_TIMESTAMP" "$(TZ=UTC date -r ${MKREPRO_TIMESTAMP})"
+	statusmsg2 "MKREPRO_TIMESTAMP" "$(repro_date "${MKREPRO_TIMESTAMP}")"
 	export MKREPRO MKREPRO_TIMESTAMP
 }
 



CVS commit: src/etc

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 20:22:28 UTC 2021

Modified Files:
src/etc: Makefile

Log Message:
use the date tool


To generate a diff of this commit:
cvs rdiff -u -r1.449 -r1.450 src/etc/Makefile

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

Modified files:

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.449 src/etc/Makefile:1.450
--- src/etc/Makefile:1.449	Tue Dec 29 11:46:44 2020
+++ src/etc/Makefile	Wed May 26 16:22:28 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.449 2020/12/29 16:46:44 martin Exp $
+#	$NetBSD: Makefile,v 1.450 2021/05/26 20:22:28 christos Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -77,7 +77,7 @@ PAX_TIMESTAMP=
 BUILD_DATE!=	date -u
 .else
 PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
-BUILD_DATE!=	date -u -r "${MKREPRO_TIMESTAMP}"
+BUILD_DATE!=	${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}"
 .endif
 
 # MD Makefile.inc may append MD targets to BIN[123].  Make sure all



CVS commit: src/bin/sh

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 20:21:52 UTC 2021

Modified Files:
src/bin/sh: Makefile

Log Message:
Use the date tool


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/bin/sh/Makefile

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

Modified files:

Index: src/bin/sh/Makefile
diff -u src/bin/sh/Makefile:1.115 src/bin/sh/Makefile:1.116
--- src/bin/sh/Makefile:1.115	Sun Oct 28 14:13:47 2018
+++ src/bin/sh/Makefile	Wed May 26 16:21:52 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.115 2018/10/28 18:13:47 kre Exp $
+#	$NetBSD: Makefile,v 1.116 2021/05/26 20:21:52 christos Exp $
 #	@(#)Makefile	8.4 (Berkeley) 5/5/95
 
 .include 
@@ -33,7 +33,7 @@ CPPFLAGS+= -DUSE_LRAND48
 
 # Reproducible build parameters ... export into sh for NETBSD_SHELL setting
 .if ${MKREPRO_TIMESTAMP:Uno} != "no"
-BUILD_DATE!=	date -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
+BUILD_DATE!=	${TOOL_DATE} -u -r "${MKREPRO_TIMESTAMP}" "+%Y%m%d%H%M%S"
 # These are (should be) equivalent, but the 2nd is easier to understand
 #CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:C/([^0]0?)(00)*$/\1/}Z"'
 CPPFLAGS+= -DBUILD_DATE='"${BUILD_DATE:S/00$//:S/00$//:S/00$//}Z"'



CVS commit: src/share/mk

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 20:21:25 UTC 2021

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Add date as a tool


To generate a diff of this commit:
cvs rdiff -u -r1.1247 -r1.1248 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1247 src/share/mk/bsd.own.mk:1.1248
--- src/share/mk/bsd.own.mk:1.1247	Thu May  6 09:23:36 2021
+++ src/share/mk/bsd.own.mk	Wed May 26 16:21:25 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1247 2021/05/06 13:23:36 rin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1248 2021/05/26 20:21:25 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -423,6 +423,7 @@ MKDEPCXX=	CC=${CXX:Q} ${TOOLDIR}/bin/${_
 PAXCTL=		${TOOLDIR}/bin/${_TOOL_PREFIX}paxctl
 TSORT=		${TOOLDIR}/bin/${_TOOL_PREFIX}tsort -q
 YACC=		${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
+YACC=		${TOOLDIR}/bin/${_TOOL_PREFIX}yacc
 
 TOOL_AMIGAAOUT2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-aout2bb
 TOOL_AMIGAELF2BB=	${TOOLDIR}/bin/${_TOOL_PREFIX}amiga-elf2bb
@@ -440,6 +441,7 @@ TOOL_CTAGS=		${TOOLDIR}/bin/${_TOOL_PREF
 TOOL_CTFCONVERT=	${TOOLDIR}/bin/${_TOOL_PREFIX}ctfconvert
 TOOL_CTFMERGE=		${TOOLDIR}/bin/${_TOOL_PREFIX}ctfmerge
 TOOL_CVSLATEST=		${TOOLDIR}/bin/${_TOOL_PREFIX}cvslatest
+TOOL_DATE=		${TOOLDIR}/bin/${_TOOL_PREFIX}date
 TOOL_DB=		${TOOLDIR}/bin/${_TOOL_PREFIX}db
 TOOL_DISKLABEL=		${TOOLDIR}/bin/${_TOOL_PREFIX}disklabel
 TOOL_DTC=		${TOOLDIR}/bin/${_TOOL_PREFIX}dtc
@@ -562,6 +564,7 @@ TOOL_CTAGS=		ctags
 TOOL_CTFCONVERT=	ctfconvert
 TOOL_CTFMERGE=		ctfmerge
 TOOL_CVSLATEST=		cvslatest
+TOOL_DATE=		date
 TOOL_DB=		db
 TOOL_DISKLABEL=		disklabel
 TOOL_DTC=		dtc



CVS commit: src/bin/date

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 20:19:51 UTC 2021

Modified Files:
src/bin/date: Makefile date.c

Log Message:
tool changes


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/bin/date/Makefile
cvs rdiff -u -r1.61 -r1.62 src/bin/date/date.c

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

Modified files:

Index: src/bin/date/Makefile
diff -u src/bin/date/Makefile:1.15 src/bin/date/Makefile:1.16
--- src/bin/date/Makefile:1.15	Sun Aug 14 06:53:16 2011
+++ src/bin/date/Makefile	Wed May 26 16:19:51 2021
@@ -1,10 +1,15 @@
-#	$NetBSD: Makefile,v 1.15 2011/08/14 10:53:16 christos Exp $
+#	$NetBSD: Makefile,v 1.16 2021/05/26 20:19:51 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
+.include 
+
 PROG=	date
-SRCS=	date.c netdate.c
+SRCS=	date.c
+.if !defined(HOSTPROG)
+SRCS+=	netdate.c
 DPADD+=	${LIBUTIL}
 LDADD+=	-lutil
+.endif
 CPPFLAGS+=-I${.CURDIR}
 
 COPTS.date.c = -Wno-format-nonliteral

Index: src/bin/date/date.c
diff -u src/bin/date/date.c:1.61 src/bin/date/date.c:1.62
--- src/bin/date/date.c:1.61	Mon Sep  1 17:42:21 2014
+++ src/bin/date/date.c	Wed May 26 16:19:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: date.c,v 1.61 2014/09/01 21:42:21 dholland Exp $ */
+/* $NetBSD: date.c,v 1.62 2021/05/26 20:19:51 christos Exp $ */
 
 /*
  * Copyright (c) 1985, 1987, 1988, 1993
@@ -29,6 +29,10 @@
  * SUCH DAMAGE.
  */
 
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
 #include 
 #ifndef lint
 __COPYRIGHT(
@@ -40,7 +44,7 @@ __COPYRIGHT(
 #if 0
 static char sccsid[] = "@(#)date.c	8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: date.c,v 1.61 2014/09/01 21:42:21 dholland Exp $");
+__RCSID("$NetBSD: date.c,v 1.62 2021/05/26 20:19:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -90,6 +94,7 @@ main(int argc, char *argv[])
 			nflag = 1;
 			break;
 		case 'd':
+#ifndef HAVE_NBTOOL_CONFIG_H
 			rflag = 1;
 			tval = parsedate(optarg, NULL, NULL);
 			if (tval == -1) {
@@ -97,6 +102,10 @@ main(int argc, char *argv[])
 "%s: Unrecognized date format", optarg);
 			}
 			break;
+#else
+			errx(EXIT_FAILURE,
+			"-d not supported in the tool version");
+#endif
 		case 'j':		/* don't set time */
 			jflag = 1;
 			break;
@@ -330,6 +339,7 @@ setthetime(const char *p)
 	}
 
 	/* set the time */
+#ifndef HAVE_NBTOOL_CONFIG_H
 	if (nflag || netsettime(new_time)) {
 		logwtmp("|", "date", "");
 		if (aflag) {
@@ -346,6 +356,9 @@ setthetime(const char *p)
 		}
 		logwtmp("{", "date", "");
 	}
+#else
+	errx(EXIT_FAILURE, "Can't set the time in the tools version");
+#endif
 
 	if ((p = getlogin()) == NULL)
 		p = "???";



CVS commit: src/tools

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 20:19:15 UTC 2021

Modified Files:
src/tools: Makefile
Added Files:
src/tools/date: Makefile

Log Message:
Add a date tool


To generate a diff of this commit:
cvs rdiff -u -r1.209 -r1.210 src/tools/Makefile
cvs rdiff -u -r0 -r1.1 src/tools/date/Makefile

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

Modified files:

Index: src/tools/Makefile
diff -u src/tools/Makefile:1.209 src/tools/Makefile:1.210
--- src/tools/Makefile:1.209	Thu May  6 09:23:36 2021
+++ src/tools/Makefile	Wed May 26 16:19:15 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.209 2021/05/06 13:23:36 rin Exp $
+#	$NetBSD: Makefile,v 1.210 2021/05/26 20:19:15 christos Exp $
 
 .include 
 .include 
@@ -91,7 +91,7 @@ dependall-binstall: dependall-compat
 # Dependencies in SUBDIR below ordered to maximize parallel ability.
 # See above for special treatment for host-mkdep, compat, and binstall.
 #
-SUBDIR=	host-mkdep compat binstall \
+SUBDIR=	host-mkdep compat binstall date \
 	.WAIT mktemp .WAIT sed .WAIT genassym
 .if ${TOOLS_BUILDRUMP} == "no"
 SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \

Added files:

Index: src/tools/date/Makefile
diff -u /dev/null src/tools/date/Makefile:1.1
--- /dev/null	Wed May 26 16:19:15 2021
+++ src/tools/date/Makefile	Wed May 26 16:19:15 2021
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile,v 1.1 2021/05/26 20:19:15 christos Exp $
+
+HOSTPROGNAME=	${_TOOL_PREFIX}date
+HOST_SRCDIR=	bin/date
+
+.include "${.CURDIR}/../Makefile.host"



CVS commit: src/sys/external/bsd/ipf/netinet

2021-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May 26 14:48:02 UTC 2021

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_nat.c

Log Message:
Fix ip_nat memory leak and use-after-free, wrong element freed (Cy Schubert)
https://cgit.freebsd.org/src/commit/?id=323a4e2c4e285e6f8eee8db3fe2cb74


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/external/bsd/ipf/netinet/ip_nat.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/ipf/netinet/ip_nat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.c:1.23 src/sys/external/bsd/ipf/netinet/ip_nat.c:1.24
--- src/sys/external/bsd/ipf/netinet/ip_nat.c:1.23	Sat Aug  1 02:50:42 2020
+++ src/sys/external/bsd/ipf/netinet/ip_nat.c	Wed May 26 10:48:02 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.23 2020/08/01 06:50:42 maxv Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.24 2021/05/26 14:48:02 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -112,7 +112,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.23 2020/08/01 06:50:42 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.24 2021/05/26 14:48:02 christos Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -6178,7 +6178,7 @@ ipf_nat_rule_deref(ipf_main_softc_t *sof
 
 	if (n->in_tqehead[0] != NULL) {
 		if (ipf_deletetimeoutqueue(n->in_tqehead[0]) == 0) {
-			ipf_freetimeoutqueue(softc, n->in_tqehead[1]);
+			ipf_freetimeoutqueue(softc, n->in_tqehead[0]);
 		}
 	}
 



CVS commit: src/sys/stand/efiboot

2021-05-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed May 26 09:42:36 UTC 2021

Modified Files:
src/sys/stand/efiboot: efiblock.c version

Log Message:
add basic raidframe support to efiboot.

if raid disklabel or gpt is found, add this partition with
the offset/size adjusted by RF_PROTECTED_SECTORS.  note

don't le32toh() the disklabel.  if it was wrong-endian, then
getdisklabel() will have swapped it.

ok jmcneill thorpej.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/stand/efiboot/efiblock.c
cvs rdiff -u -r1.23 -r1.24 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/efiblock.c
diff -u src/sys/stand/efiboot/efiblock.c:1.10 src/sys/stand/efiboot/efiblock.c:1.11
--- src/sys/stand/efiboot/efiblock.c:1.10	Sat Nov 28 15:24:05 2020
+++ src/sys/stand/efiboot/efiblock.c	Wed May 26 09:42:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.10 2020/11/28 15:24:05 jmcneill Exp $ */
+/* $NetBSD: efiblock.c,v 1.11 2021/05/26 09:42:36 mrg Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -38,6 +38,13 @@
 #include "efiboot.h"
 #include "efiblock.h"
 
+/*
+ * The raidframe support is basic.  Ideally, it should be expanded to
+ * consider raid volumes a first-class citizen like the x86 efiboot does,
+ * but for now, we simply assume each RAID is potentially bootable.
+ */
+#define	RF_PROTECTED_SECTORS	64	/* XXX refer to <.../rf_optnames.h> */
+
 static EFI_HANDLE *efi_block;
 static UINTN efi_nblock;
 static struct efi_block_part *efi_block_booted = NULL;
@@ -217,6 +224,10 @@ efi_block_find_partitions_disklabel(stru
 		case FS_MSDOS:
 		case FS_BSDLFS:
 			break;
+		case FS_RAID:
+			p->p_size -= RF_PROTECTED_SECTORS;
+			p->p_offset += RF_PROTECTED_SECTORS;
+			break;
 		default:
 			continue;
 		}
@@ -225,7 +236,7 @@ efi_block_find_partitions_disklabel(stru
 		bpart->index = n;
 		bpart->bdev = bdev;
 		bpart->type = EFI_BLOCK_PART_DISKLABEL;
-		bpart->disklabel.secsize = le32toh(d.d_secsize);
+		bpart->disklabel.secsize = d.d_secsize;
 		bpart->disklabel.part = *p;
 		efi_block_generate_hash_mbr(bpart, mbr);
 		TAILQ_INSERT_TAIL(>partitions, bpart, entries);
@@ -310,6 +321,10 @@ efi_block_find_partitions_gpt_entry(stru
 	bpart->type = EFI_BLOCK_PART_GPT;
 	bpart->gpt.fstype = fstype;
 	bpart->gpt.ent = *ent;
+	if (fstype == FS_RAID) {
+		bpart->gpt.ent.ent_lba_start += RF_PROTECTED_SECTORS;
+		bpart->gpt.ent.ent_lba_end -= RF_PROTECTED_SECTORS;
+	}
 	memcpy(bpart->hash, ent->ent_guid, sizeof(bpart->hash));
 	TAILQ_INSERT_TAIL(>partitions, bpart, entries);
 
@@ -436,7 +451,7 @@ efi_block_probe(void)
 	fstype = FS_ISO9660;
 	break;
 }
-if (fstype == FS_BSDFFS || fstype == FS_ISO9660) {
+if (fstype == FS_BSDFFS || fstype == FS_ISO9660 || fstype == FS_RAID) {
 	char devname[9];
 	snprintf(devname, sizeof(devname), "hd%u%c", bdev->index, bpart->index + 'a');
 	set_default_device(devname);

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.23 src/sys/stand/efiboot/version:1.24
--- src/sys/stand/efiboot/version:1.23	Fri May 21 21:53:15 2021
+++ src/sys/stand/efiboot/version	Wed May 26 09:42:36 2021
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.23 2021/05/21 21:53:15 jmcneill Exp $
+$NetBSD: version,v 1.24 2021/05/26 09:42:36 mrg Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -27,3 +27,4 @@ is taken as the current.
 2.4:	Add ISO9660 support.
 2.5:	Recognize the EFI system partion as fstype MSDOS.
 2.6:	Disable ACPI support when booting big endian kernels.
+2.7:	Add basic support for booting from RAID1 volumes.



CVS commit: src/sbin/raidctl

2021-05-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed May 26 08:23:18 UTC 2021

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

Log Message:
update the list of platforms supporting loading kernels from raid.
expand the HISTORY section to include notable RF moments in netbsd.
bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sbin/raidctl/raidctl.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/raidctl/raidctl.8
diff -u src/sbin/raidctl/raidctl.8:1.74 src/sbin/raidctl/raidctl.8:1.75
--- src/sbin/raidctl/raidctl.8:1.74	Thu Jan 18 00:32:49 2018
+++ src/sbin/raidctl/raidctl.8	Wed May 26 08:23:18 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: raidctl.8,v 1.74 2018/01/18 00:32:49 mrg Exp $
+.\" $NetBSD: raidctl.8,v 1.75 2021/05/26 08:23:18 mrg Exp $
 .\"
 .\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\" any improvements or extensions that they make and grant Carnegie the
 .\" rights to redistribute these changes.
 .\"
-.Dd January 6, 2016
+.Dd May 26, 2021
 .Dt RAIDCTL 8
 .Os
 .Sh NAME
@@ -166,7 +166,8 @@ All components of the set must be of typ
 .Dv RAID
 in the disklabel.
 Note that only certain architectures
-.Pq currently alpha, amd64, i386, pmax, sandpoint, sparc, sparc64, and vax
+.Pq currently arc, alpha, amd64, bebox, cobalt, emips, i386, landisk,
+ofppc, pmax, sandpoint, sgimips, sparc, sparc64, and vax
 support booting a kernel directly from a RAID set.
 Please note that
 .Ic forceroot
@@ -502,6 +503,12 @@ the RAIDframe documentation discussed in
 .Sx HISTORY
 section.
 .Pp
+Since
+.Nx 10
+RAIDframe has been been capable of autoconfiguration of components
+originally configured on opposite endian systems.  The current label
+endianness will be retained.
+.Pp
 See
 .Sx EXAMPLES
 for a more complete configuration file example.
@@ -1563,6 +1570,26 @@ for RAID Systems", by William V. Courtri
 Holland, LeAnn Neal Reilly, and Jim Zelenka, and published by the
 Parallel Data Laboratory of Carnegie Mellon University.
 .Pp
+RAIDframe was ported to
+.Nx
+by Greg Oster in 1998, who has maintained it since.
+In 1999, component labels, spares, automatic rebuilding of parity, and
+autoconfiguration of volumes were added.
+In 2000, root on RAID support was added (initially, with no support for
+loading kernels from RAID volumes, which has been added to many ports since.)
+In 2009, support for parity bimap was added, reducing parity resync time
+after a crash.
+In 2010, support for larger the 2TiB and non-512 sector devices was added.
+In 2018, support for 32-bit userland compatibility was added.
+In 2021, support for autoconfiguration from other-endian raid sets was added.
+.Pp
+Support for loading kernels from RAID 1 partitions was added for the
+alpha, pmax and vax ports in 2000, the the sgimips port in 2001,
+the x86 ports in 2003, the arc port in 2005, the landisk, sparc, and
+sparc64 ports in 2006, the cobalt port in 2007, the ofppc port in 2008,
+the bebox port in 2010, the emips port in 2011, and the sandpoint port
+in 2012.
+.Pp
 The
 .Nm
 command first appeared as a program in CMU's RAIDframe v1.1 distribution.



CVS commit: src/usr.bin/patch

2021-05-26 Thread Chris Pinnock
Module Name:src
Committed By:   cjep
Date:   Wed May 26 07:57:05 UTC 2021

Modified Files:
src/usr.bin/patch: inp.c

Log Message:
correct indentation. spotted by Roland.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.bin/patch/inp.c

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/patch/inp.c
diff -u src/usr.bin/patch/inp.c:1.27 src/usr.bin/patch/inp.c:1.28
--- src/usr.bin/patch/inp.c:1.27	Tue May 25 11:25:59 2021
+++ src/usr.bin/patch/inp.c	Wed May 26 07:57:05 2021
@@ -1,7 +1,7 @@
 /*
  * $OpenBSD: inp.c,v 1.34 2006/03/11 19:41:30 otto Exp $
  * $DragonFly: src/usr.bin/patch/inp.c,v 1.6 2007/09/29 23:11:10 swildner Exp $
- * $NetBSD: inp.c,v 1.27 2021/05/25 11:25:59 cjep Exp $
+ * $NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $
  */
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: inp.c,v 1.27 2021/05/25 11:25:59 cjep Exp $");
+__RCSID("$NetBSD: inp.c,v 1.28 2021/05/26 07:57:05 cjep Exp $");
 
 #include 
 #include 
@@ -194,10 +194,10 @@ plan_a(const char *filename)
  		filebase = basename(tmp_filename1);
  		filedir = dirname(tmp_filename2);
 
-	lbufsz = INITLINELEN;
-	if ((lbuf = malloc(bufsz)) == NULL)
-		pfatal("allocating line buffer");
-	lbuf[0] = '\0';
+		lbufsz = INITLINELEN;
+		if ((lbuf = malloc(bufsz)) == NULL)
+			pfatal("allocating line buffer");
+		lbuf[0] = '\0';
  
 #define try(f, a1, a2, a3) \
 	(snprintf(lbuf, lbufsz, f, a1, a2, a3), stat(lbuf, ) == 0)



CVS commit: src/sys/dev/raidframe

2021-05-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed May 26 06:11:50 UTC 2021

Modified Files:
src/sys/dev/raidframe: rf_compat80.c rf_driver.c rf_netbsdkintf.c

Log Message:
support different endian raidframe component label.

there are two on-disk formats in use in raidframe:
- the component label
- the parity map

the parity map is a bitmap implemented as bytes, so it has no
endian issue.  the component label is the problem, as most of
the fields are 32 bit.  this change only supports version 2 of
raidframe (active since the year 2000.)

as component labels are read and used before a raidPtr for the
raid set has been created, there is no obvious storage for the
swapped indicator, so the in-core version remains the on-disk
version, while the rest of in-core label is swapped.

in raidread_component_label() and raidwrite_component_label(),
check if the swapped version, and if so, call new rf_swap_label()
and ensure that the in-core label is native-byte order.  for the
write method, an on-stack copy is modified before writing, so
that the in-core version remains valid.  (this stack usage is
below other stack usage in similar functions here.)

adjust the label ioctls RAIDFRAME_GET_COMPONENT_LABEL and
RAIDFRAME_GET_COMPONENT_LABEL80 to return the byte-swapped
version so that eg, raidctl -s reports the right version.

when performing final configuration of a raidset, report if a
label swapped, and also complain if there are differently swapped
versions on the other components.

tested on arm64, sparc64 and amd64
ok @oster


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/raidframe/rf_compat80.c
cvs rdiff -u -r1.136 -r1.137 src/sys/dev/raidframe/rf_driver.c
cvs rdiff -u -r1.393 -r1.394 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_compat80.c
diff -u src/sys/dev/raidframe/rf_compat80.c:1.14 src/sys/dev/raidframe/rf_compat80.c:1.15
--- src/sys/dev/raidframe/rf_compat80.c:1.14	Thu Dec 12 02:15:43 2019
+++ src/sys/dev/raidframe/rf_compat80.c	Wed May 26 06:11:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_compat80.c,v 1.14 2019/12/12 02:15:43 pgoyette Exp $	*/
+/*	$NetBSD: rf_compat80.c,v 1.15 2021/05/26 06:11:50 mrg Exp $	*/
 
 /*
  * Copyright (c) 2017 Matthew R. Green
@@ -215,6 +215,10 @@ rf_get_component_label80(RF_Raid_t *raid
 	}
 
 	rf_get_component_label(raidPtr, clabel);
+	/* Fix-up for userland. */
+	if (clabel->version == bswap32(RF_COMPONENT_LABEL_VERSION))
+		clabel->version = RF_COMPONENT_LABEL_VERSION;
+
 	retcode = copyout(clabel, *clabel_ptr, sizeof(**clabel_ptr));
 	RF_Free(clabel, sizeof(*clabel));
 

Index: src/sys/dev/raidframe/rf_driver.c
diff -u src/sys/dev/raidframe/rf_driver.c:1.136 src/sys/dev/raidframe/rf_driver.c:1.137
--- src/sys/dev/raidframe/rf_driver.c:1.136	Thu Oct 10 03:43:59 2019
+++ src/sys/dev/raidframe/rf_driver.c	Wed May 26 06:11:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_driver.c,v 1.136 2019/10/10 03:43:59 christos Exp $	*/
+/*	$NetBSD: rf_driver.c,v 1.137 2021/05/26 06:11:50 mrg Exp $	*/
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -66,7 +66,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.136 2019/10/10 03:43:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.137 2021/05/26 06:11:50 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_raid_diagnostic.h"
@@ -300,6 +300,8 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf
 {
 	RF_RowCol_t col;
 	int rc;
+	bool swapped = false;
+	bool first = true;
 
 	rf_lock_mutex2(configureMutex);
 	configureCount++;
@@ -430,10 +432,21 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf
 	printf("raid%d: Components:", raidPtr->raidid);
 
 	for (col = 0; col < raidPtr->numCol; col++) {
+		RF_ComponentLabel_t *clabel;
+		bool compswapped;
+
 		printf(" %s", raidPtr->Disks[col].devname);
 		if (RF_DEAD_DISK(raidPtr->Disks[col].status)) {
 			printf("[**FAILED**]");
 		}
+		clabel = raidget_component_label(raidPtr, col);
+		compswapped = clabel->version ==
+			  bswap32(RF_COMPONENT_LABEL_VERSION);
+		if (first)
+			swapped = compswapped;
+		else if (swapped != compswapped)
+			printf("raid%d: Component %d has different endian "
+			   "than first component.", raidPtr->raidid, col);
 	}
 	printf("\n");
 	printf("raid%d: Total Sectors: %" PRIu64 " (%" PRIu64 " MB)\n",
@@ -441,6 +454,9 @@ rf_Configure(RF_Raid_t *raidPtr, RF_Conf
 	   raidPtr->totalSectors,
 	   (raidPtr->totalSectors / 1024 *
 (1 << raidPtr->logBytesPerSector) / 1024));
+	if (swapped)
+		printf("raid%d: Using swapped-endian component labels.\n",
+		raidPtr->raidid);
 
 	return (0);
 }

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.393 src/sys/dev/raidframe/rf_netbsdkintf.c:1.394
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.393	Mon May 24 07:43:15 2021
+++