CVS commit: src/sbin/wsconsctl

2018-11-22 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Nov 23 06:31:57 UTC 2018

Modified Files:
src/sbin/wsconsctl: keyboard.c util.c wsconsctl.c wsconsctl.h

Log Message:
When merging entries with the keyboard map, print only the resulting changes.

While here, replace bcopy with standad memcpy.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sbin/wsconsctl/keyboard.c
cvs rdiff -u -r1.31 -r1.32 src/sbin/wsconsctl/util.c
cvs rdiff -u -r1.18 -r1.19 src/sbin/wsconsctl/wsconsctl.c
cvs rdiff -u -r1.12 -r1.13 src/sbin/wsconsctl/wsconsctl.h

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

Modified files:

Index: src/sbin/wsconsctl/keyboard.c
diff -u src/sbin/wsconsctl/keyboard.c:1.9 src/sbin/wsconsctl/keyboard.c:1.10
--- src/sbin/wsconsctl/keyboard.c:1.9	Mon Apr 28 20:23:09 2008
+++ src/sbin/wsconsctl/keyboard.c	Fri Nov 23 06:31:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyboard.c,v 1.9 2008/04/28 20:23:09 martin Exp $ */
+/*	$NetBSD: keyboard.c,v 1.10 2018/11/23 06:31:57 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "wsconsctl.h"
 
@@ -48,6 +49,9 @@ static struct wskbd_bell_data dfbell;
 static struct wscons_keymap mapdata[KS_NUMKEYCODES];
 struct wskbd_map_data kbmap = /* used in map_parse.y and in util.c */
 { KS_NUMKEYCODES, mapdata };
+static struct wscons_keymap oldmapdata[KS_NUMKEYCODES];
+static struct wskbd_map_data oldkbmap =
+{ KS_NUMKEYCODES, oldmapdata };
 static struct wskbd_keyrepeat_data repeat;
 static struct wskbd_keyrepeat_data dfrepeat;
 static struct wskbd_scroll_data scroll;
@@ -79,6 +83,29 @@ struct field keyboard_field_tab[] = {
 int keyboard_field_tab_len = sizeof(keyboard_field_tab) /
 	sizeof(keyboard_field_tab[0]);
 
+static void
+diff_kmap(struct wskbd_map_data *omap, struct wskbd_map_data *nmap)
+{
+	unsigned int u;
+	struct wscons_keymap *op, *np;
+
+	for (u = 0; u < nmap->maplen; u++) {
+		op = omap->map + u;
+		np = nmap->map + u;
+		if (op->command == np->command &&
+		op->group1[0] == np->group1[0] &&
+		op->group1[1] == np->group1[1] &&
+		op->group2[0] == np->group2[0] &&
+		op->group2[1] == np->group2[1]) {
+			np->command = KS_voidSymbol;
+			np->group1[0] = KS_voidSymbol;
+			np->group1[1] = KS_voidSymbol;
+			np->group2[0] = KS_voidSymbol;
+			np->group2[1] = KS_voidSymbol;
+		}
+	}
+}
+
 void
 keyboard_get_values(int fd)
 {
@@ -112,6 +139,7 @@ keyboard_get_values(int fd)
 		kbmap.maplen = KS_NUMKEYCODES;
 		if (ioctl(fd, WSKBDIO_GETMAP, ) < 0)
 			err(EXIT_FAILURE, "WSKBDIO_GETMAP");
+		memcpy(oldmapdata, mapdata, sizeof(oldmapdata));
 	}
 
 	repeat.which = 0;
@@ -200,7 +228,11 @@ keyboard_put_values(int fd)
 	if (field_by_value()->flags & FLG_SET) {
 		if (ioctl(fd, WSKBDIO_SETMAP, ) < 0)
 			err(EXIT_FAILURE, "WSKBDIO_SETMAP");
-		pr_field(field_by_value(), " -> ");
+		if (field_by_value()->flags & FLG_MODIFIED) {
+			diff_kmap(, );
+			pr_field(field_by_value(), " +> ");
+		} else
+			pr_field(field_by_value(), " -> ");
 	}
 
 	repeat.which = 0;

Index: src/sbin/wsconsctl/util.c
diff -u src/sbin/wsconsctl/util.c:1.31 src/sbin/wsconsctl/util.c:1.32
--- src/sbin/wsconsctl/util.c:1.31	Mon Dec 24 01:20:12 2012
+++ src/sbin/wsconsctl/util.c	Fri Nov 23 06:31:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.31 2012/12/24 01:20:12 khorben Exp $ */
+/*	$NetBSD: util.c,v 1.32 2018/11/23 06:31:57 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1998, 2006, 2012 The NetBSD Foundation, Inc.
@@ -420,7 +420,7 @@ rd_field(struct field *f, char *val, int
 			}
 		}
 		kbmap.maplen = newkbmap.maplen;
-		bcopy(newkbmap.map, kbmap.map,
+		memcpy(kbmap.map, newkbmap.map,
 		kbmap.maplen * sizeof(struct wscons_keymap));
 		break;
 	case FMT_COLOR:

Index: src/sbin/wsconsctl/wsconsctl.c
diff -u src/sbin/wsconsctl/wsconsctl.c:1.18 src/sbin/wsconsctl/wsconsctl.c:1.19
--- src/sbin/wsconsctl/wsconsctl.c:1.18	Mon Aug 25 00:14:46 2008
+++ src/sbin/wsconsctl/wsconsctl.c	Fri Nov 23 06:31:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsconsctl.c,v 1.18 2008/08/25 00:14:46 dholland Exp $ */
+/*	$NetBSD: wsconsctl.c,v 1.19 2018/11/23 06:31:57 mlelstv Exp $ */
 
 /*-
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -207,8 +207,10 @@ main(int argc, char **argv)
 }
 rd_field(f, p, do_merge);
 f->flags |= FLG_SET;
+if (do_merge)
+	f->flags |= FLG_MODIFIED;
 (*putval)(fd);
-f->flags &= ~FLG_SET;
+f->flags &= ~(FLG_SET | FLG_MODIFIED);
 			}
 		} else {
 			for (i = 0; i < argc; i++) {

Index: src/sbin/wsconsctl/wsconsctl.h
diff -u src/sbin/wsconsctl/wsconsctl.h:1.12 src/sbin/wsconsctl/wsconsctl.h:1.13
--- src/sbin/wsconsctl/wsconsctl.h:1.12	Mon Dec 24 01:20:44 2012
+++ src/sbin/wsconsctl/wsconsctl.h	Fri Nov 23 06:31:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsconsctl.h,v 1.12 2012/12/24 01:20:44 khorben Exp $ */
+/*	$NetBSD: wsconsctl.h,v 1.13 2018/11/23 

CVS commit: src/lib/libcurses

2018-11-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Nov 22 23:37:31 UTC 2018

Modified Files:
src/lib/libcurses: attributes.c

Log Message:
Drop a few redundant casts of a variable to its own type.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libcurses/attributes.c

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

Modified files:

Index: src/lib/libcurses/attributes.c
diff -u src/lib/libcurses/attributes.c:1.25 src/lib/libcurses/attributes.c:1.26
--- src/lib/libcurses/attributes.c:1.25	Thu Nov 22 23:29:09 2018
+++ src/lib/libcurses/attributes.c	Thu Nov 22 23:37:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: attributes.c,v 1.25 2018/11/22 23:29:09 uwe Exp $	*/
+/*	$NetBSD: attributes.c,v 1.26 2018/11/22 23:37:31 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: attributes.c,v 1.25 2018/11/22 23:29:09 uwe Exp $");
+__RCSID("$NetBSD: attributes.c,v 1.26 2018/11/22 23:37:31 uwe Exp $");
 #endif/* not lint */
 
 #include "curses.h"
@@ -199,8 +199,8 @@ wattr_on(WINDOW *win, attr_t attr, void 
 	if (attr & __UNDERSCORE && t_enter_underline_mode(t) != NULL &&
 	t_exit_underline_mode(t) != NULL)
 		wunderscore(win);
-	if ((attr_t) attr & __COLOR)
-		__wcolor_set(win, (attr_t) attr);
+	if (attr & __COLOR)
+		__wcolor_set(win, attr);
 	return OK;
 }
 
@@ -253,7 +253,7 @@ wattr_off(WINDOW *win, attr_t attr, void
 		wstandend(win);
 	if (attr & __UNDERSCORE)
 		wunderend(win);
-	if ((attr_t) attr & __COLOR) {
+	if (attr & __COLOR) {
 		if (max_colors != 0)
 			win->wattr &= ~__COLOR;
 	}



CVS commit: src/lib/libcurses

2018-11-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Nov 22 23:29:09 UTC 2018

Modified Files:
src/lib/libcurses: attributes.c

Log Message:
Move getattrs() and wcolor_set() so that they are with their peers and
so that wide and non-wide functions are in the same order.  While here,
make __wcolor_set() static.  No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/lib/libcurses/attributes.c

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

Modified files:

Index: src/lib/libcurses/attributes.c
diff -u src/lib/libcurses/attributes.c:1.24 src/lib/libcurses/attributes.c:1.25
--- src/lib/libcurses/attributes.c:1.24	Mon Oct 29 01:27:39 2018
+++ src/lib/libcurses/attributes.c	Thu Nov 22 23:29:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: attributes.c,v 1.24 2018/10/29 01:27:39 uwe Exp $	*/
+/*	$NetBSD: attributes.c,v 1.25 2018/11/22 23:29:09 uwe Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -31,13 +31,13 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: attributes.c,v 1.24 2018/10/29 01:27:39 uwe Exp $");
+__RCSID("$NetBSD: attributes.c,v 1.25 2018/11/22 23:29:09 uwe Exp $");
 #endif/* not lint */
 
 #include "curses.h"
 #include "curses_private.h"
 
-void __wcolor_set(WINDOW *, attr_t);
+static void __wcolor_set(WINDOW *, attr_t);
 
 #ifndef _CURSES_USE_MACROS
 /*
@@ -282,6 +282,34 @@ wattr_set(WINDOW *win, attr_t attr, shor
 }
 
 /*
+ * wcolor_set --
+ *	Set color pair on window
+ */
+/* ARGSUSED */
+int
+wcolor_set(WINDOW *win, short pair, void *opt)
+{
+#ifdef DEBUG
+	__CTRACE(__CTRACE_COLOR, "wolor_set: win %p, pair %d\n", win, pair);
+#endif
+	__wcolor_set(win, (attr_t) COLOR_PAIR(pair));
+	return OK;
+}
+
+/*
+ * getattrs --
+ *	Get window attributes.
+ */
+chtype
+getattrs(WINDOW *win)
+{
+#ifdef DEBUG
+	__CTRACE(__CTRACE_ATTR, "getattrs: win %p\n", win);
+#endif
+	return((chtype) win->wattr);
+}
+
+/*
  * wattron --
  *	Test and set attributes.
  */
@@ -324,34 +352,6 @@ wattrset(WINDOW *win, int attr)
 }
 
 /*
- * wcolor_set --
- *	Set color pair on window
- */
-/* ARGSUSED */
-int
-wcolor_set(WINDOW *win, short pair, void *opt)
-{
-#ifdef DEBUG
-	__CTRACE(__CTRACE_COLOR, "wolor_set: win %p, pair %d\n", win, pair);
-#endif
-	__wcolor_set(win, (attr_t) COLOR_PAIR(pair));
-	return OK;
-}
-
-/*
- * getattrs --
- *	Get window attributes.
- */
-chtype
-getattrs(WINDOW *win)
-{
-#ifdef DEBUG
-	__CTRACE(__CTRACE_ATTR, "getattrs: win %p\n", win);
-#endif
-	return((chtype) win->wattr);
-}
-
-/*
  * termattrs --
  *	Get terminal attributes
  */
@@ -444,7 +444,7 @@ term_attrs(void)
  * __wcolor_set --
  * Set color attribute on window
  */
-void
+static void
 __wcolor_set(WINDOW *win, attr_t attr)
 {
 	const TERMINAL *t = win->screen->term;



CVS commit: src/lib/libcurses

2018-11-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Nov 22 22:16:45 UTC 2018

Modified Files:
src/lib/libcurses: add_wch.c add_wchstr.c addwstr.c cchar.c
echo_wchar.c get_wch.c get_wstr.c in_wch.c in_wchstr.c ins_wch.c
ins_wstr.c inwstr.c

Log Message:
Drop HAVE_WCHAR ifdefs from code that is not even compiled with !HAVE_WCHAR.

We still try to mainain the ability to build our curses with
!HAVE_WCHAR, but it doesn't make sense to provide stubs for new wide
API functions that just error out when !HAVE_WCHAR.  Any code that
only uses old API (and can work with !HAVE_WCHAR curses) doesn't use
those new functions.  The code that uses new API obviosly cannot work
when all the new API is stubbed out.

So the plan is to drop the stubs.  This commit does that for files
that are not even compiled with !HAVE_WCHAR (not only those stubs are
useless, they were not even there to begin with).

Same object code is generated for the normal HAVE_WCHAR case.  Nothing
is even recompiled for !HAVE_WCHAR.

Ok by blymn@ jdc@ roy@


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libcurses/add_wch.c \
src/lib/libcurses/add_wchstr.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libcurses/addwstr.c
cvs rdiff -u -r1.10 -r1.11 src/lib/libcurses/cchar.c
cvs rdiff -u -r1.2 -r1.3 src/lib/libcurses/echo_wchar.c
cvs rdiff -u -r1.19 -r1.20 src/lib/libcurses/get_wch.c
cvs rdiff -u -r1.4 -r1.5 src/lib/libcurses/get_wstr.c \
src/lib/libcurses/in_wch.c src/lib/libcurses/in_wchstr.c \
src/lib/libcurses/inwstr.c
cvs rdiff -u -r1.11 -r1.12 src/lib/libcurses/ins_wch.c \
src/lib/libcurses/ins_wstr.c

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

Modified files:

Index: src/lib/libcurses/add_wch.c
diff -u src/lib/libcurses/add_wch.c:1.5 src/lib/libcurses/add_wch.c:1.6
--- src/lib/libcurses/add_wch.c:1.5	Thu Jan  7 07:36:35 2016
+++ src/lib/libcurses/add_wch.c	Thu Nov 22 22:16:45 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wch.c,v 1.5 2016/01/07 07:36:35 jdc Exp $ */
+/*   $NetBSD: add_wch.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: add_wch.c,v 1.5 2016/01/07 07:36:35 jdc Exp $");
+__RCSID("$NetBSD: add_wch.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
 #endif /* not lint */
 
 #include 
@@ -54,11 +54,7 @@ __RCSID("$NetBSD: add_wch.c,v 1.5 2016/0
 int
 add_wch(const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return wadd_wch(stdscr, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -69,11 +65,7 @@ add_wch(const cchar_t *wch)
 int
 mvadd_wch(int y, int x, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return mvwadd_wch(stdscr, y, x, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -84,14 +76,10 @@ mvadd_wch(int y, int x, const cchar_t *w
 int
 mvwadd_wch(WINDOW *win, int y, int x, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	if (wmove(win, y, x) == ERR)
 		return ERR;
 
 	return wadd_wch(win, wch);
-#endif /* HAVE_WCHAR */
 }
 
 
@@ -104,9 +92,6 @@ mvwadd_wch(WINDOW *win, int y, int x, co
 int
 wadd_wch(WINDOW *win, const cchar_t *wch)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	int x = win->curx, y = win->cury;
 	__LINE *lnp = NULL;
 
@@ -120,5 +105,4 @@ wadd_wch(WINDOW *win, const cchar_t *wch
 #endif
 	lnp = win->alines[y];
 	return _cursesi_addwchar(win, , , , wch, 1);
-#endif /* HAVE_WCHAR */
 }
Index: src/lib/libcurses/add_wchstr.c
diff -u src/lib/libcurses/add_wchstr.c:1.5 src/lib/libcurses/add_wchstr.c:1.6
--- src/lib/libcurses/add_wchstr.c:1.5	Sat Oct 22 21:55:06 2016
+++ src/lib/libcurses/add_wchstr.c	Thu Nov 22 22:16:45 2018
@@ -1,4 +1,4 @@
-/*   $NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $ */
+/*   $NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $ */
 
 /*
  * Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.6 2018/11/22 22:16:45 uwe Exp $");
 #endif/* not lint */
 
 #include 
@@ -51,11 +51,7 @@ __RCSID("$NetBSD: add_wchstr.c,v 1.5 201
 int
 add_wchstr(const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return wadd_wchnstr(stdscr, wchstr, -1);
-#endif
 }
 
 
@@ -66,11 +62,7 @@ add_wchstr(const cchar_t *wchstr)
 int
 wadd_wchstr(WINDOW *win, const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return wadd_wchnstr(win, wchstr, -1);
-#endif
 }
 
 
@@ -82,11 +74,7 @@ wadd_wchstr(WINDOW *win, const cchar_t *
 int
 add_wchnstr(const cchar_t *wchstr, int n)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return wadd_wchnstr(stdscr, wchstr, n);
-#endif
 }
 
 
@@ -97,11 +85,7 @@ add_wchnstr(const cchar_t *wchstr, int n
 int
 mvadd_wchstr(int y, int x, const cchar_t *wchstr)
 {
-#ifndef HAVE_WCHAR
-	return ERR;
-#else
 	return mvwadd_wchnstr(stdscr, y, x, wchstr, 

CVS commit: src/lib/libcurses

2018-11-22 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Nov 22 22:00:49 UTC 2018

Modified Files:
src/lib/libcurses: Makefile

Log Message:
We need insstr.c for !HAVE_WCHAR too.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/lib/libcurses/Makefile

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/Makefile
diff -u src/lib/libcurses/Makefile:1.89 src/lib/libcurses/Makefile:1.90
--- src/lib/libcurses/Makefile:1.89	Mon Nov 19 01:08:22 2018
+++ src/lib/libcurses/Makefile	Thu Nov 22 22:00:49 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.89 2018/11/19 01:08:22 uwe Exp $
+#	$NetBSD: Makefile,v 1.90 2018/11/22 22:00:49 uwe Exp $
 #	@(#)Makefile	8.2 (Berkeley) 1/2/94
 
 .include 
@@ -20,7 +20,8 @@ SRCS=	acs.c addbytes.c addch.c addchnstr
 	curses.c delch.c deleteln.c delwin.c echochar.c erase.c fileio.c \
 	flushok.c fullname.c getch.c getstr.c getyx.c id_subwins.c idlok.c \
 	idcok.c immedok.c inch.c inchstr.c initscr.c insch.c insdelln.c \
-	insertln.c instr.c keypad.c keyname.c leaveok.c line.c meta.c move.c \
+	insertln.c insstr.c instr.c keypad.c keyname.c leaveok.c line.c \
+	meta.c move.c \
 	mvwin.c newwin.c nodelay.c notimeout.c overlay.c overwrite.c pause.c \
 	printw.c putchar.c refresh.c resize.c ripoffline.c scanw.c screen.c \
 	scroll.c scrollok.c setterm.c slk.c standout.c syncok.c timeout.c \
@@ -45,7 +46,7 @@ LIBDPLIBS+=	terminfo	${.CURDIR}/../libte
 .if !defined(DISABLE_WCHAR)
 CPPFLAGS+=-DHAVE_WCHAR
 SRCS+= cchar.c add_wch.c add_wchstr.c addwstr.c echo_wchar.c ins_wch.c \
-	insstr.c ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c \
+	ins_wstr.c get_wch.c get_wstr.c in_wch.c in_wchstr.c \
 	inwstr.c
 .else
 CPPFLAGS+=-DDISABLE_WCHAR



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

2018-11-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 22 21:28:21 UTC 2018

Modified Files:
src/sys/arch/arm/arm32: cpuswitch.S

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/arm/arm32/cpuswitch.S

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

Modified files:

Index: src/sys/arch/arm/arm32/cpuswitch.S
diff -u src/sys/arch/arm/arm32/cpuswitch.S:1.92 src/sys/arch/arm/arm32/cpuswitch.S:1.93
--- src/sys/arch/arm/arm32/cpuswitch.S:1.92	Sat Jul  1 15:30:41 2017
+++ src/sys/arch/arm/arm32/cpuswitch.S	Thu Nov 22 21:28:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpuswitch.S,v 1.92 2017/07/01 15:30:41 skrll Exp $	*/
+/*	$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -87,7 +87,7 @@
 #include 
 #include 
 
-	RCSID("$NetBSD: cpuswitch.S,v 1.92 2017/07/01 15:30:41 skrll Exp $")
+	RCSID("$NetBSD: cpuswitch.S,v 1.93 2018/11/22 21:28:21 skrll Exp $")
 
 /* LINTSTUB: include  */
 
@@ -386,7 +386,7 @@ ENTRY_NP(softint_switch)
 
 #ifdef _ARM_ARCH_6
 	/*
-	 * Save user read/write thread/process id register in cause it was
+	 * Save user read/write thread/process id register in case it was
 	 * set in userland.
 	 */
 	mrc	p15, 0, r0, c13, c0, 2



CVS commit: src/distrib/utils/embedded

2018-11-22 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Thu Nov 22 21:11:37 UTC 2018

Modified Files:
src/distrib/utils/embedded/conf: armv7.conf
src/distrib/utils/embedded/files: armv7_boot.cmd

Log Message:
Make armv7.img boot on the DE0 Nano SoC. Requires u-boot from -current pkgsrc.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/distrib/utils/embedded/conf/armv7.conf
cvs rdiff -u -r1.8 -r1.9 src/distrib/utils/embedded/files/armv7_boot.cmd

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

Modified files:

Index: src/distrib/utils/embedded/conf/armv7.conf
diff -u src/distrib/utils/embedded/conf/armv7.conf:1.26 src/distrib/utils/embedded/conf/armv7.conf:1.27
--- src/distrib/utils/embedded/conf/armv7.conf:1.26	Thu Nov  1 11:05:24 2018
+++ src/distrib/utils/embedded/conf/armv7.conf	Thu Nov 22 21:11:37 2018
@@ -1,4 +1,4 @@
-# $NetBSD: armv7.conf,v 1.26 2018/11/01 11:05:24 skrll Exp $
+# $NetBSD: armv7.conf,v 1.27 2018/11/22 21:11:37 aymeric Exp $
 # ARMv7 customization script used by mkimage
 #
 board=armv7
@@ -7,7 +7,7 @@ resize=true
 
 . ${DIR}/conf/evbarm.conf
 
-# exynos, sunxi, tegra
+# altera, exynos, sunxi, tegra
 kernels_generic="GENERIC"
 # non-FDTised / special kernels
 kernels_amlogic="ODROID-C1"
@@ -90,6 +90,10 @@ EOF
 	>> "$tmp/selected_sets"
 }
 
+populate_altera() {
+	:
+}
+
 populate_amlogic() {
 	odroidc1_kernelimg=netbsd-ODROID-C1.ub
 
@@ -153,6 +157,7 @@ populate() {
 	done
 
 	# board specific configuration
+	populate_altera
 	populate_amlogic
 	populate_beagle
 	populate_rpi

Index: src/distrib/utils/embedded/files/armv7_boot.cmd
diff -u src/distrib/utils/embedded/files/armv7_boot.cmd:1.8 src/distrib/utils/embedded/files/armv7_boot.cmd:1.9
--- src/distrib/utils/embedded/files/armv7_boot.cmd:1.8	Thu Nov  1 11:05:24 2018
+++ src/distrib/utils/embedded/files/armv7_boot.cmd	Thu Nov 22 21:11:37 2018
@@ -3,6 +3,13 @@ if test "${board}" = "am335x" ; then
 	setenv mmcpart 0:1
 	setenv bootargs root=ld0a
 fi
+if test "${board}" = "de0-nano-soc" ; then
+	setenv kernel netbsd-GENERIC.ub
+	setenv bootargs 'root=ld0a'
+	setenv mmcpart 0:1
+	setenv use_fdt 1
+	setenv fdtfile socfpga_cyclone5_de0_sockit.dtb
+fi
 if test "${soc}" = "exynos" ; then
 	setenv kernel netbsd-GENERIC.ub
 	setenv bootargs 'root=ld1a'



CVS commit: src/sys/arch

2018-11-22 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Thu Nov 22 21:08:19 UTC 2018

Modified Files:
src/sys/arch/arm/altera: files.altera
src/sys/arch/arm/cortex: a9tmr.c
src/sys/arch/evbarm/conf: GENERIC files.generic
Removed Files:
src/sys/arch/evbarm/conf: NANOSOC

Log Message:
Switch the DE0 Nano SoC to the GENERIC kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/altera/files.altera
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/cortex/a9tmr.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/GENERIC
cvs rdiff -u -r1.4 -r0 src/sys/arch/evbarm/conf/NANOSOC
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/files.generic

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

Modified files:

Index: src/sys/arch/arm/altera/files.altera
diff -u src/sys/arch/arm/altera/files.altera:1.1 src/sys/arch/arm/altera/files.altera:1.2
--- src/sys/arch/arm/altera/files.altera:1.1	Wed Sep 19 17:31:38 2018
+++ src/sys/arch/arm/altera/files.altera	Thu Nov 22 21:08:19 2018
@@ -1,17 +1,8 @@
-#	$NetBSD: files.altera,v 1.1 2018/09/19 17:31:38 aymeric Exp $
+#	$NetBSD: files.altera,v 1.2 2018/11/22 21:08:19 aymeric Exp $
 #
 # Configuration for Altera SoC
 #
 
-file 	arch/arm/arm32/arm32_boot.c
-file 	arch/arm/arm32/arm32_kvminit.c
-file 	arch/arm/arm32/arm32_reboot.c
-file 	arch/arm/arm32/irq_dispatch.S
-
-file 	arch/arm/arm32/armv7_generic_space.c
-file 	arch/arm/arm/arm_generic_dma.c
-file 	arch/arm/arm/bus_space_a4x.S
-
 file 	arch/arm/altera/cycv_platform.c
 
 device 	cycvfdt : bus_space_generic, fdtbus

Index: src/sys/arch/arm/cortex/a9tmr.c
diff -u src/sys/arch/arm/cortex/a9tmr.c:1.18 src/sys/arch/arm/cortex/a9tmr.c:1.19
--- src/sys/arch/arm/cortex/a9tmr.c:1.18	Sun Oct 28 21:08:13 2018
+++ src/sys/arch/arm/cortex/a9tmr.c	Thu Nov 22 21:08:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9tmr.c,v 1.18 2018/10/28 21:08:13 aymeric Exp $	*/
+/*	$NetBSD: a9tmr.c,v 1.19 2018/11/22 21:08:19 aymeric Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.18 2018/10/28 21:08:13 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: a9tmr.c,v 1.19 2018/11/22 21:08:19 aymeric Exp $");
 
 #include 
 #include 
@@ -362,10 +362,15 @@ a9tmr_intr(void *arg)
 	return 1;
 }
 
+/* XXX This conflicts with gtmr, hence the temporary weak alias kludge */
+#if 1
+void a9tmr_setstatclockrate(int);
 void
-setstatclockrate(int newhz)
+a9tmr_setstatclockrate(int newhz)
 {
 }
+__weak_alias(setstatclockrate, a9tmr_setstatclockrate);
+#endif
 
 static u_int
 a9tmr_get_timecount(struct timecounter *tc)

Index: src/sys/arch/evbarm/conf/GENERIC
diff -u src/sys/arch/evbarm/conf/GENERIC:1.13 src/sys/arch/evbarm/conf/GENERIC:1.14
--- src/sys/arch/evbarm/conf/GENERIC:1.13	Mon Nov  5 07:41:46 2018
+++ src/sys/arch/evbarm/conf/GENERIC	Thu Nov 22 21:08:19 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC,v 1.13 2018/11/05 07:41:46 skrll Exp $
+#	$NetBSD: GENERIC,v 1.14 2018/11/22 21:08:19 aymeric Exp $
 #
 #	GENERIC ARM (aarch32) kernel
 #
@@ -14,7 +14,7 @@ include	"arch/evbarm/conf/GENERIC.common
 #
 makeoptions	DTSARCH="arm aarch64"
 makeoptions	DTSGNUARCH="arm arm64"
-makeoptions	DTSSUBDIR="allwinner broadcom nvidia rockchip"
+makeoptions	DTSSUBDIR="allwinner broadcom nvidia rockchip socfpga"
 makeoptions	DTS="
 	bcm2836-rpi-2-b.dts
 	bcm2837-rpi-3-b.dts
@@ -29,6 +29,8 @@ makeoptions	DTS="
 	exynos5422-odroidxu3.dts
 	exynos5422-odroidxu4.dts
 
+	socfpga_cyclone5_de0_sockit.dts
+
 	sun4i-a10-a1000.dts
 	sun4i-a10-ba10-tvbox.dts
 	sun4i-a10-chuwi-v7-cw0825.dts
@@ -208,6 +210,7 @@ pseudo-device 	openfirm	# /dev/openfirm
 #options 	EARLYCONS=exynos, CONSADDR=0x12c2
 
 #options 	EARLYCONS=bcm2837, CONSADDR=0x3f215040
+#options 	EARLYCONS=cycv, CONSADDR=0xffc02000
 #options 	EARLYCONS=rk3328, CONSADDR=0xff13
 #options 	EARLYCONS=sunxi, CONSADDR=0x01c28000
 
@@ -239,6 +242,8 @@ cpufreqdt*	at cpu?
 psci*		at fdt?
 
 # Clock and reset controllers
+cycvclkmgr* 	at fdt? pass 1		# Cyclone V clock manager
+cycvrstmgr* 	at fdt? pass 0		# Cyclone V reset manager
 exy5410clk*	at fdt? pass 3		# Exynos5410 clock controller
 exy5422clk*	at fdt? pass 3		# Exynos5422 clock controller
 sun4ia10ccu*	at fdt? pass 2		# Allwinner A10/A20 CCU
@@ -277,6 +282,8 @@ sunxisramc* at fdt? pass 4  
 syscon*		at fdt? pass 1		# Generic System Controller
 
 # Timer
+a9tmr* 		at fdt? pass 2		# ARM Cortex A5/A9 Timer
+arma9tmr* 	at a9tmr?
 gtmr*		at fdt? pass 1		# ARM Generic Timer
 armgtmr0	at gtmr?
 mct*		at fdt? pass 2		# Exynos Multi Core Timer (MCT)
@@ -285,6 +292,7 @@ sunxitimer* at fdt? 
 tegratimer*	at fdt?			# Timers
 
 # Watchdog
+dwcwdt* 	at fdt?			# DesignWare watchdog
 sunxiwdt*	at fdt?			# Allwinner watchdog
 watchdog*	at fdt?			# Broadcom BCM283x watchdog
 
@@ -297,6 +305,10 @@ tegralic*	at fdt? pass 1		# NVIDIA Tegra
 sunxiintc*	at fdt? pass 1		# 

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

2018-11-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Nov 22 20:47:38 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gicv3_its.c

Log Message:
use correct interrupt index

fixes intrctl list

from jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/cortex/gicv3_its.c

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

Modified files:

Index: src/sys/arch/arm/cortex/gicv3_its.c
diff -u src/sys/arch/arm/cortex/gicv3_its.c:1.4 src/sys/arch/arm/cortex/gicv3_its.c:1.5
--- src/sys/arch/arm/cortex/gicv3_its.c:1.4	Wed Nov 21 11:44:26 2018
+++ src/sys/arch/arm/cortex/gicv3_its.c	Thu Nov 22 20:47:37 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_its.c,v 1.4 2018/11/21 11:44:26 jmcneill Exp $ */
+/* $NetBSD: gicv3_its.c,v 1.5 2018/11/22 20:47:37 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #define _INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.4 2018/11/21 11:44:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_its.c,v 1.5 2018/11/22 20:47:37 jakllsch Exp $");
 
 #include 
 #include 
@@ -693,7 +693,7 @@ gicv3_its_get_affinity(void *priv, size_
 	struct cpu_info *ci;
 
 	kcpuset_zero(affinity);
-	ci = its->its_targets[irq - its->its_pic->pic_irqbase];
+	ci = its->its_targets[irq];
 	if (ci)
 		kcpuset_set(affinity, cpu_index(ci));
 }
@@ -709,7 +709,7 @@ gicv3_its_set_affinity(void *priv, size_
 	if (set != 1)
 		return EINVAL;
 
-	pa = its->its_pa[irq - its->its_pic->pic_irqbase];
+	pa = its->its_pa[irq];
 	if (pa == NULL)
 		return EINVAL;
 
@@ -719,7 +719,7 @@ gicv3_its_set_affinity(void *priv, size_
 	gits_command_movi(its, devid, devid, cpu_index(ci));
 	gits_command_sync(its, its->its_rdbase[cpu_index(ci)]);
 
-	its->its_targets[irq - its->its_pic->pic_irqbase] = ci;
+	its->its_targets[irq] = ci;
 
 	return 0;
 }



CVS commit: src/lib/libpthread/arch/arm

2018-11-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 22 20:38:59 UTC 2018

Modified Files:
src/lib/libpthread/arch/arm: pthread_md.h

Log Message:
G/C __APCS_26__ support


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libpthread/arch/arm/pthread_md.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/libpthread/arch/arm/pthread_md.h
diff -u src/lib/libpthread/arch/arm/pthread_md.h:1.10 src/lib/libpthread/arch/arm/pthread_md.h:1.11
--- src/lib/libpthread/arch/arm/pthread_md.h:1.10	Mon Jul 17 20:24:07 2017
+++ src/lib/libpthread/arch/arm/pthread_md.h	Thu Nov 22 20:38:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_md.h,v 1.10 2017/07/17 20:24:07 skrll Exp $	*/
+/*	$NetBSD: pthread_md.h,v 1.11 2018/11/22 20:38:59 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -66,15 +66,8 @@ pthread__sp(void)
  * Set initial, sane values for registers whose values aren't just
  * "don't care".
  */
-#ifdef __APCS_26__
-#define _INITCONTEXT_U_MD(ucp)		\
-/* Set R15_MODE_USR in the PC */	\
-	(ucp)->uc_mcontext.__gregs[_REG_PC] =\
-	 ((ucp)->uc_mcontext.__gregs[_REG_PC] & 0x3fc) | 0x0;
-#else
 /* Set CPSR to PSR_USR32_MODE (0x10) from arm/armreg.h */
 #define _INITCONTEXT_U_MD(ucp)		\
 	(ucp)->uc_mcontext.__gregs[_REG_CPSR] = 0x10;
-#endif
 
 #endif /* _LIB_PTHREAD_ARM_MD_H */



CVS commit: src/libexec/httpd

2018-11-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Nov 22 18:42:06 UTC 2018

Modified Files:
src/libexec/httpd: cgi-bozo.c

Log Message:
add an assert() check on array bounds.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/libexec/httpd/cgi-bozo.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/httpd/cgi-bozo.c
diff -u src/libexec/httpd/cgi-bozo.c:1.42 src/libexec/httpd/cgi-bozo.c:1.43
--- src/libexec/httpd/cgi-bozo.c:1.42	Thu Nov 22 08:54:08 2018
+++ src/libexec/httpd/cgi-bozo.c	Thu Nov 22 18:42:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgi-bozo.c,v 1.42 2018/11/22 08:54:08 mrg Exp $	*/
+/*	$NetBSD: cgi-bozo.c,v 1.43 2018/11/22 18:42:06 mrg Exp $	*/
 
 /*	$eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -45,6 +45,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -380,6 +381,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	const char *type, *clen, *info, *cgihandler;
 	char	*query, *s, *t, *path, *env, *command, *file, *url;
 	char	**envp, **curenvp, **argv, **search_string_argv = NULL;
+	char	**lastenvp;
 	char	*uri;
 	size_t	i, len, search_string_argc = 0;
 	ssize_t rbytes;
@@ -506,6 +508,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 	for (ix = 0; ix < envpsize; ix++)
 		envp[ix] = NULL;
 	curenvp = envp;
+	lastenvp = envp + envpsize;
 
 	SIMPLEQ_FOREACH(headp, >hr_headers, h_next) {
 		const char *s2;
@@ -587,6 +590,7 @@ bozo_process_cgi(bozo_httpreq_t *request
 strerror(errno));
 
 	*curenvp = 0;
+	assert(lastenvp > curenvp);
 
 	/*
 	 * We create 2 procs: one to become the CGI, one read from



CVS commit: src/libexec/httpd

2018-11-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Nov 22 18:21:59 UTC 2018

Modified Files:
src/libexec/httpd: main.c

Log Message:
alpha sort the option switch.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/libexec/httpd/main.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/httpd/main.c
diff -u src/libexec/httpd/main.c:1.19 src/libexec/httpd/main.c:1.20
--- src/libexec/httpd/main.c:1.19	Thu Nov 22 08:54:08 2018
+++ src/libexec/httpd/main.c	Thu Nov 22 18:21:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.19 2018/11/22 08:54:08 mrg Exp $	*/
+/*	$NetBSD: main.c,v 1.20 2018/11/22 18:21:59 mrg Exp $	*/
 
 /*	$eterna: main.c,v 1.6 2011/11/18 09:21:15 mrg Exp $	*/
 /* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp 	*/
@@ -163,92 +163,53 @@ main(int argc, char **argv)
 	"C:EGHI:L:M:P:S:T:U:VXZ:bc:defhi:np:st:uv:x:z:")) != -1) {
 		switch (c) {
 
-		case 'L':
-			if (!have_lua)
-bozoerr(, 1, "Lua support not enabled");
-
-			/* make sure there's two argument */
-			if (argc - optind < 1)
-usage(, progname);
-			bozo_add_lua_map(, optarg, argv[optind]);
-			optind++;
-			break;
-		case 'M':
-			if (!have_dynamic_content)
-bozoerr(, 1,
-"dynamic mime content support not enabled");
+		case 'b':
+			if (!have_daemon_mode)
+ no_daemon_mode:
+bozoerr(, 1, "Daemon mode not enabled");
 
-			/* make sure there're four arguments */
-			if (argc - optind < 3)
-usage(, progname);
-			bozo_add_content_map_mime(, optarg, argv[optind],
-			argv[optind+1], argv[optind+2]);
-			optind += 3;
+			/*
+			 * test suite support - undocumented
+			 * background == 2 (aka, -b -b) means to
+			 * only process 1 per kid
+			 */
+			val = bozo_get_pref(, "background") == NULL ?
+			"1" : "2";
+			bozo_set_pref(, , "background", val);
 			break;
 
-		case 'n':
-			bozo_set_pref(, , "numeric", "true");
-			break;
+		case 'c':
+			if (!have_cgibin)
+bozoerr(, 1, "CGI not enabled");
 
-		case 's':
-			bozo_set_pref(, , "log to stderr", "true");
+			bozo_cgi_setbin(, optarg);
 			break;
 
-		case 'S':
-			bozo_set_pref(, , "server software",
-  optarg);
-			break;
-		case 'Z':
-			if (!have_ssl)
- no_ssl:
-bozoerr(, 1, "ssl support not enabled");
+		case 'C':
+			if (!have_dynamic_content && !have_cgibin)
+bozoerr(, 1,
+"dynamic CGI handler support not enabled");
 
 			/* make sure there's two arguments */
 			if (argc - optind < 1)
 usage(, progname);
-			bozo_ssl_set_opts(, optarg, argv[optind++]);
-			break;
-
-		case 'z':
-			if (!have_ssl)
-goto no_ssl;
-
-			bozo_ssl_set_ciphers(, optarg);
-			break;
-
-		case 'U':
-			bozo_set_pref(, , "username", optarg);
-			break;
-
-		case 'V':
-			bozo_set_pref(, , "unknown slash", "true");
-			break;
-
-		case 'v':
-			bozo_set_pref(, , "virtual base", optarg);
-			break;
-
-		case 'x':
-			bozo_set_pref(, , "index.html", optarg);
+			bozo_add_content_map_cgi(, optarg,
+	argv[optind++]);
 			break;
 
-		case 'I':
-			bozo_set_pref(, , "port number", optarg);
+		case 'd':
+			if (!have_debug)
+bozowarn(, "Debugging not enabled");
+			httpd.debug++;
 			break;
 
-		case 'b':
-			if (!have_daemon_mode)
- no_daemon_mode:
-bozoerr(, 1, "Daemon mode not enabled");
+		case 'E':
+			if (have_user &&
+			have_cgibin)
+bozoerr(, 1, "CGI not enabled");
 
-			/*
-			 * test suite support - undocumented
-			 * background == 2 (aka, -b -b) means to
-			 * only process 1 per kid
-			 */
-			val = bozo_get_pref(, "background") == NULL ?
-			"1" : "2";
-			bozo_set_pref(, , "background", val);
+			bozo_set_pref(, , "enable user cgibin",
+  "true");
 			break;
 
 		case 'e':
@@ -266,11 +227,58 @@ main(int argc, char **argv)
 			bozo_set_pref(, , "foreground", "true");
 			break;
 
+		case 'G':
+			{
+char	version[128];
+
+bozo_get_version(version, sizeof(version));
+printf("bozohttpd version %s\n", version);
+			}
+			return 0;
+
+		case 'H':
+			if (!have_dirindex)
+ no_dirindex_support:
+bozoerr(, 1,
+	"directory indexing not enabled");
+
+			bozo_set_pref(, , "hide dots", "true");
+			break;
+
+		case 'I':
+			bozo_set_pref(, , "port number", optarg);
+			break;
+
 		case 'i':
 			if (!have_daemon_mode)
 goto no_daemon_mode;
 
-			bozo_set_pref(, , "bind address", optarg);
+		case 'L':
+			if (!have_lua)
+bozoerr(, 1, "Lua support not enabled");
+
+			/* make sure there's two argument */
+			if (argc - optind < 1)
+usage(, progname);
+			bozo_add_lua_map(, optarg, argv[optind]);
+			optind++;
+			break;
+
+		case 'M':
+			if (!have_dynamic_content)
+bozoerr(, 1,
+"dynamic mime content support not enabled");
+
+			/* make sure there're four arguments */
+			if (argc - optind < 3)
+usage(, progname);
+			bozo_add_content_map_mime(, optarg, argv[optind],
+			argv[optind+1], argv[optind+2]);
+			optind += 

CVS commit: src/sys/dev

2018-11-22 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Nov 22 15:09:46 UTC 2018

Modified Files:
src/sys/dev/mii: inbmphyreg.h
src/sys/dev/pci: if_wm.c

Log Message:
- Add wm_k1_workaround_lv() from FreeBSD. It's PCH2 specifc:
Workaround to set the K1 beacon duration for 82579 parts in 10Mbps.
Disable K1 for 1000 and 100 speeds.
- Make wm_link_stall_workaround_hv() and move an 82578 specific code into it.
  Don't apply the workaround if BMCR_LOOP bit is set. Same as FreeBSD.
- Add comment. Modify comment.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/mii/inbmphyreg.h
cvs rdiff -u -r1.600 -r1.601 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/mii/inbmphyreg.h
diff -u src/sys/dev/mii/inbmphyreg.h:1.11 src/sys/dev/mii/inbmphyreg.h:1.12
--- src/sys/dev/mii/inbmphyreg.h:1.11	Fri Nov  2 03:22:19 2018
+++ src/sys/dev/mii/inbmphyreg.h	Thu Nov 22 15:09:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: inbmphyreg.h,v 1.11 2018/11/02 03:22:19 msaitoh Exp $	*/
+/*	$NetBSD: inbmphyreg.h,v 1.12 2018/11/22 15:09:45 msaitoh Exp $	*/
 /***
 Copyright (c) 2001-2005, Intel Corporation 
 All rights reserved.
@@ -74,6 +74,13 @@ POSSIBILITY OF SUCH DAMAGE.
 #define BME1000_PSCR_DOWNSHIFT_COUNTER_MASK 0x7000
 #define BME1000_PSCR_DOWNSHIFT_COUNTER_SHIFT12
 
+/* BM PHY Copper Specific Status */
+#define BM_CS_STATUS		BME1000_REG(0, 17)
+#define BM_CS_STATUS_LINK_UP	0x0400
+#define BM_CS_STATUS_RESOLVED	0x0800
+#define BM_CS_STATUS_SPEED_MASK	0xC000
+#define BM_CS_STATUS_SPEED_1000	0x8000
+
 #define BME1000_PHY_PAGE_SELECT	BME1000_REG(0, 22) /* Page Select */
 
 #define BME1000_BIAS_SETTING	29
@@ -91,6 +98,14 @@ POSSIBILITY OF SUCH DAMAGE.
 #define HV_OEM_BITS_A1KDIS	(1 << 6)
 #define HV_OEM_BITS_ANEGNOW	(1 << 10)
 
+/* 82577 Mobile Phy Status Register */
+#define HV_M_STATUS		BME1000_REG(0, 26)
+#define HV_M_STATUS_AUTONEG_COMPLETE 0x1000
+#define HV_M_STATUS_SPEED_MASK	0x0300
+#define HV_M_STATUS_SPEED_1000	0x0200
+#define HV_M_STATUS_SPEED_100	0x0100
+#define HV_M_STATUS_LINK_UP	0x0040
+
 #define HV_LED_CONFIG		BME1000_REG(0, 30)
 
 #define	HV_KMRN_MODE_CTRL	BME1000_REG(BM_PORT_CTRL_PAGE, 16)

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.600 src/sys/dev/pci/if_wm.c:1.601
--- src/sys/dev/pci/if_wm.c:1.600	Tue Nov 20 04:04:42 2018
+++ src/sys/dev/pci/if_wm.c	Thu Nov 22 15:09:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.600 2018/11/20 04:04:42 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.601 2018/11/22 15:09:46 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.600 2018/11/20 04:04:42 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.601 2018/11/22 15:09:46 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -974,6 +974,8 @@ static void	wm_hv_phy_workaround_ich8lan
 static void	wm_lv_phy_workaround_ich8lan(struct wm_softc *);
 static int	wm_k1_workaround_lpt_lp(struct wm_softc *, bool);
 static int	wm_k1_gig_workaround_hv(struct wm_softc *, int);
+static int	wm_k1_workaround_lv(struct wm_softc *);
+static int	wm_link_stall_workaround_hv(struct wm_softc *);
 static void	wm_set_mdio_slow_mode_hv(struct wm_softc *);
 static void	wm_configure_k1_ich8lan(struct wm_softc *, int);
 static void	wm_reset_init_script_82575(struct wm_softc *);
@@ -8850,23 +8852,6 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
 			((sc->sc_mii.mii_media_status & IFM_ACTIVE) != 0));
 		}
 
-		if ((sc->sc_phytype == WMPHY_82578)
-		&& (IFM_SUBTYPE(sc->sc_mii.mii_media_active)
-			== IFM_1000_T)) {
-
-			if ((sc->sc_mii.mii_media_status & IFM_ACTIVE) != 0) {
-delay(200*1000); /* XXX too big */
-
-/* Link stall fix for link up */
-wm_gmii_hv_writereg(sc->sc_dev, 1,
-HV_MUX_DATA_CTRL,
-HV_MUX_DATA_CTRL_GEN_TO_MAC
-| HV_MUX_DATA_CTRL_FORCE_SPEED);
-wm_gmii_hv_writereg(sc->sc_dev, 1,
-HV_MUX_DATA_CTRL,
-HV_MUX_DATA_CTRL_GEN_TO_MAC);
-			}
-		}
 		/*
 		 * I217 Packet Loss issue:
 		 * ensure that FEXTNVM4 Beacon Duration is set correctly
@@ -8906,6 +8891,21 @@ wm_linkintr_gmii(struct wm_softc *sc, ui
 reg &= ~FEXTNVM6_K1_OFF_ENABLE;
 			CSR_WRITE(sc, WMREG_FEXTNVM6, reg);
 		}
+
+		if (!link)
+			return;
+
+		switch (sc->sc_type) {
+		case WM_T_PCH2:
+			wm_k1_workaround_lv(sc);
+			/* FALLTHROUGH */
+		case WM_T_PCH:
+			if (sc->sc_phytype == WMPHY_82578)
+wm_link_stall_workaround_hv(sc);
+			break;
+		default:
+			break;
+		}
 	} else if (icr & ICR_RXSEQ) {
 		DPRINTF(WM_DEBUG_LINK, ("%s: LINK Receive sequence error\n",
 			device_xname(sc->sc_dev)));
@@ -14528,7 +14528,16 @@ out:
 	return;
 }
 
-/* WOL from S5 stops working */
+/*
+ *  wm_gig_downshift_workaround_ich8lan - WoL from 

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

2018-11-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Nov 22 15:06:00 UTC 2018

Modified Files:
src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
Apply MADT interrupt source overrides to interrupts established via
acpi_md_intr_establish.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/acpi/acpi_machdep.c

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

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.20 src/sys/arch/x86/acpi/acpi_machdep.c:1.21
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.20	Fri Nov 16 23:03:55 2018
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Thu Nov 22 15:06:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.21 2018/11/22 15:06:00 jmcneill Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.21 2018/11/22 15:06:00 jmcneill Exp $");
 
 #include 
 #include 
@@ -151,19 +151,40 @@ acpi_md_OsInstallInterruptHandler(uint32
 const char *xname)
 {
 	void *ih;
+
+	ih = acpi_md_intr_establish(InterruptNumber, IPL_TTY, IST_LEVEL,
+	(int (*)(void *))ServiceRoutine, Context, false, xname);
+	if (ih == NULL)
+		return AE_NO_MEMORY;
+
+	*cookiep = ih;
+
+	return AE_OK;
+}
+
+void
+acpi_md_OsRemoveInterruptHandler(void *cookie)
+{
+	intr_disestablish(cookie);
+}
+
+void *
+acpi_md_intr_establish(uint32_t InterruptNumber, int ipl, int type,
+int (*handler)(void *), void *arg, bool mpsafe, const char *xname)
+{
+	void *ih;
 	struct pic *pic;
 #if NIOAPIC > 0
 	struct ioapic_softc *sc;
 	struct acpi_md_override ovr;
 	struct mp_intr_map tmpmap, *mip, **mipp = NULL;
 #endif
-	int irq, pin, type, redir, mpflags;
+	int irq, pin, redir, mpflags;
 
 	/*
 	 * ACPI interrupts default to level-triggered active-low.
 	 */
 
-	type = IST_LEVEL;
 	mpflags = (MPS_INTTR_LEVEL << 2) | MPS_INTPO_ACTLO;
 	redir = IOAPIC_REDLO_LEVEL | IOAPIC_REDLO_ACTLO;
 
@@ -239,11 +260,8 @@ acpi_md_OsInstallInterruptHandler(uint32
 		irq = pin = (int)InterruptNumber;
 	}
 
-	/*
-	 * XXX probably, IPL_BIO is enough.
-	 */
-	ih = intr_establish_xname(irq, pic, pin, type, IPL_TTY,
-	(int (*)(void *)) ServiceRoutine, Context, false, xname);
+	ih = intr_establish_xname(irq, pic, pin, type, ipl,
+	handler, arg, mpsafe, xname);
 
 #if NIOAPIC > 0
 	if (mipp) {
@@ -251,33 +269,7 @@ acpi_md_OsInstallInterruptHandler(uint32
 	}
 #endif
 
-	if (ih == NULL)
-		return AE_NO_MEMORY;
-
-	*cookiep = ih;
-
-	return AE_OK;
-}
-
-void
-acpi_md_OsRemoveInterruptHandler(void *cookie)
-{
-	intr_disestablish(cookie);
-}
-
-void *
-acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *),
-void *arg, bool mpsafe, const char *xname)
-{
-	struct pic *pic;
-	int pin;
-
-	pic = intr_findpic(irq);
-	if (pic == NULL)
-		return NULL;
-	pin = irq - pic->pic_vecbase;
-
-	return intr_establish_xname(irq, pic, pin, type, ipl, handler, arg, mpsafe, xname);
+	return ih;
 }
 
 void



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

2018-11-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Nov 22 13:47:37 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: std.tegra

Log Message:
build fix until someone is brave enough to remove this kernel


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/conf/std.tegra

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

Modified files:

Index: src/sys/arch/evbarm/conf/std.tegra
diff -u src/sys/arch/evbarm/conf/std.tegra:1.20 src/sys/arch/evbarm/conf/std.tegra:1.21
--- src/sys/arch/evbarm/conf/std.tegra:1.20	Thu Oct 18 09:01:54 2018
+++ src/sys/arch/evbarm/conf/std.tegra	Thu Nov 22 13:47:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: std.tegra,v 1.20 2018/10/18 09:01:54 skrll Exp $
+#	$NetBSD: std.tegra,v 1.21 2018/11/22 13:47:37 skrll Exp $
 #
 
 machine		evbarm arm
@@ -25,6 +25,7 @@ options 	__HAVE_GENERIC_START
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 #options 	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
 options 	__HAVE_PCI_CONF_HOOK
+options 	__HAVE_PCI_MSI_MSIX
 
 makeoptions 	BOARDMKFRAG="${THISARM}/conf/mk.tegra"
 makeoptions 	BOARDTYPE="tegra"



CVS commit: src/libexec/httpd

2018-11-22 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Nov 22 08:54:08 UTC 2018

Modified Files:
src/libexec/httpd: auth-bozo.c bozohttpd.c bozohttpd.h cgi-bozo.c
daemon-bozo.c dir-index-bozo.c main.c ssl-bozo.c tilde-luzah-bozo.c

Log Message:
many clean ups:
- keep a list of special files and their human names
- remove (void) casts on bozo_http_error()
- fix a few more misuses of bozo_http_error()
- rename check_mapping() to check_remap() and perform some CSE
- switch away from ``%s'' to '%s'
- remove a bunch of #ifdef using new have_feature defines


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/libexec/httpd/auth-bozo.c
cvs rdiff -u -r1.92 -r1.93 src/libexec/httpd/bozohttpd.c
cvs rdiff -u -r1.55 -r1.56 src/libexec/httpd/bozohttpd.h
cvs rdiff -u -r1.41 -r1.42 src/libexec/httpd/cgi-bozo.c
cvs rdiff -u -r1.18 -r1.19 src/libexec/httpd/daemon-bozo.c \
src/libexec/httpd/main.c
cvs rdiff -u -r1.27 -r1.28 src/libexec/httpd/dir-index-bozo.c
cvs rdiff -u -r1.24 -r1.25 src/libexec/httpd/ssl-bozo.c
cvs rdiff -u -r1.15 -r1.16 src/libexec/httpd/tilde-luzah-bozo.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/httpd/auth-bozo.c
diff -u src/libexec/httpd/auth-bozo.c:1.21 src/libexec/httpd/auth-bozo.c:1.22
--- src/libexec/httpd/auth-bozo.c:1.21	Wed Nov 21 09:37:02 2018
+++ src/libexec/httpd/auth-bozo.c	Thu Nov 22 08:54:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: auth-bozo.c,v 1.21 2018/11/21 09:37:02 mrg Exp $	*/
+/*	$NetBSD: auth-bozo.c,v 1.22 2018/11/22 08:54:08 mrg Exp $	*/
 
 /*	$eterna: auth-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -117,6 +117,7 @@ bozo_auth_init(bozo_httpreq_t *request)
 {
 	request->hr_authuser = NULL;
 	request->hr_authpass = NULL;
+	request->hr_authrealm = NULL;
 }
 
 void

Index: src/libexec/httpd/bozohttpd.c
diff -u src/libexec/httpd/bozohttpd.c:1.92 src/libexec/httpd/bozohttpd.c:1.93
--- src/libexec/httpd/bozohttpd.c:1.92	Wed Nov 21 17:39:19 2018
+++ src/libexec/httpd/bozohttpd.c	Thu Nov 22 08:54:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.c,v 1.92 2018/11/21 17:39:19 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.c,v 1.93 2018/11/22 08:54:08 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
 
@@ -109,7 +109,7 @@
 #define INDEX_HTML		"index.html"
 #endif
 #ifndef SERVER_SOFTWARE
-#define SERVER_SOFTWARE		"bozohttpd/20181121"
+#define SERVER_SOFTWARE		"bozohttpd/20181122"
 #endif
 
 #ifndef PUBLIC_HTML
@@ -169,6 +169,21 @@
 #define LOG_FTP LOG_DAEMON
 #endif
 
+/*
+ * List of special file that we should never serve.
+ */
+struct {
+	const char *file;
+	const char *name;
+} specials[] = {
+	{ DIRECT_ACCESS_FILE, "rejected direct access request" },
+	{ REDIRECT_FILE,  "rejected redirect request" },
+	{ ABSREDIRECT_FILE,   "rejected absredirect request" },
+	{ REMAP_FILE, "rejected remap request" },
+	{ AUTH_FILE,  "rejected authfile request" },
+	{ NULL,   NULL },
+};
+
 volatile sig_atomic_t	timeout_hit;
 
 /*
@@ -680,8 +695,7 @@ bozo_read_request(bozohttpd_t *httpd)
 	sigaction(SIGALRM, , NULL);
 
 	if (clock_gettime(CLOCK_MONOTONIC, ) != 0) {
-		(void)bozo_http_error(httpd, 500, NULL,
-			"clock_gettime failed");
+		bozo_http_error(httpd, 500, NULL, "clock_gettime failed");
 		goto cleanup;
 	}
 
@@ -690,8 +704,7 @@ bozo_read_request(bozohttpd_t *httpd)
 		alarm(0);
 
 		if (clock_gettime(CLOCK_MONOTONIC, ) != 0) {
-			(void)bozo_http_error(httpd, 500, NULL,
-"clock_gettime failed");
+			bozo_http_error(httpd, 500, NULL, "clock_gettime failed");
 			goto cleanup;
 		}
 		/*
@@ -711,16 +724,14 @@ bozo_read_request(bozohttpd_t *httpd)
 			timeout_hit = 1;
 
 		if (timeout_hit) {
-			(void)bozo_http_error(httpd, 408, NULL,
-	"request timed out");
+			bozo_http_error(httpd, 408, NULL, "request timed out");
 			goto cleanup;
 		}
 		line++;
 
 		if (line == 1) {
 			if (len < 1) {
-(void)bozo_http_error(httpd, 404, NULL,
-		"null method");
+bozo_http_error(httpd, 404, NULL, "null method");
 goto cleanup;
 			}
 			bozowarn(httpd,
@@ -734,13 +745,11 @@ bozo_read_request(bozohttpd_t *httpd)
 			request->hr_file = file;
 			request->hr_query = query;
 			if (method == NULL) {
-(void)bozo_http_error(httpd, 404, NULL,
-		"null method");
+bozo_http_error(httpd, 404, NULL, "null method");
 goto cleanup;
 			}
 			if (file == NULL) {
-(void)bozo_http_error(httpd, 404, NULL,
-		"null file");
+bozo_http_error(httpd, 404, NULL, "null file");
 goto cleanup;
 			}
 
@@ -768,12 +777,10 @@ bozo_read_request(bozohttpd_t *httpd)
 break;
 
 			val = bozostrnsep(, ":", );
-			debug((httpd, DEBUG_EXPLODING,
-			&q

CVS commit: src/lib/libc/arch/aarch64/sys

2018-11-22 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Nov 22 08:30:58 UTC 2018

Modified Files:
src/lib/libc/arch/aarch64/sys: __clone.S

Log Message:
fix condition code. x1==0 is parent.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/arch/aarch64/sys/__clone.S

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

Modified files:

Index: src/lib/libc/arch/aarch64/sys/__clone.S
diff -u src/lib/libc/arch/aarch64/sys/__clone.S:1.1 src/lib/libc/arch/aarch64/sys/__clone.S:1.2
--- src/lib/libc/arch/aarch64/sys/__clone.S:1.1	Sun Aug 10 05:47:37 2014
+++ src/lib/libc/arch/aarch64/sys/__clone.S	Thu Nov 22 08:30:58 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: __clone.S,v 1.1 2014/08/10 05:47:37 matt Exp $ */
+/* $NetBSD: __clone.S,v 1.2 2018/11/22 08:30:58 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@ ENTRY(__clone)
 	 * x0 == pid of child in parent, x0 == pid of parent in child.
 	 */
 	/* if this is the parent then just return the pid */
-	cbnz	x1, 1f
+	cbz	x1, 1f
 
 	/*
 	 * This is the child