CVS commit: src/sys/dev/wscons

2017-06-12 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 13 05:49:48 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c

Log Message:
Implement missing ioctls for the default bell.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/wscons/wsbell.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/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.7 src/sys/dev/wscons/wsbell.c:1.8
--- src/sys/dev/wscons/wsbell.c:1.7	Tue Jun 13 00:54:37 2017
+++ src/sys/dev/wscons/wsbell.c	Tue Jun 13 05:49:48 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $ */
+/* $NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.8 2017/06/13 05:49:48 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -345,6 +346,8 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 		 int flag, struct lwp *l)
 {
 	struct wskbd_bell_data *ubdp, *kbdp;
+	int error;
+
 	if (sc->sc_dying == true)
 		return (EIO);
 
@@ -356,16 +359,31 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 		if ((flag & FWRITE) == 0)
 			return (EACCES);
 		kbdp = >sc_bell_data;
+setbell:
 		ubdp = (struct wskbd_bell_data *)data;
 		SETBELL(kbdp, ubdp, kbdp);
 		return (0);
 
 	case WSKBDIO_GETBELL:
 		kbdp = >sc_bell_data;
+getbell:
 		ubdp = (struct wskbd_bell_data *)data;
 		SETBELL(ubdp, kbdp, kbdp);
 		return (0);
 
+	case WSKBDIO_SETDEFAULTBELL:
+		if ((error = kauth_authorize_device(l->l_cred,
+		KAUTH_DEVICE_WSCONS_KEYBOARD_BELL, NULL, NULL,
+		NULL, NULL)) != 0)
+			return (error);
+		kbdp = _default_bell_data;
+		goto setbell;
+
+
+	case WSKBDIO_GETDEFAULTBELL:
+		kbdp = _default_bell_data;
+		goto getbell;
+
 	case WSKBDIO_BELL:
 		if ((flag & FWRITE) == 0)
 			return (EACCES);



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 13 00:54:37 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c wsbellvar.h

Log Message:
Change sc_dying from u_char to bool.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wscons/wsbell.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/wscons/wsbellvar.h

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

Modified files:

Index: src/sys/dev/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.6 src/sys/dev/wscons/wsbell.c:1.7
--- src/sys/dev/wscons/wsbell.c:1.6	Tue Jun 13 00:49:05 2017
+++ src/sys/dev/wscons/wsbell.c	Tue Jun 13 00:54:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $ */
+/* $NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.7 2017/06/13 00:54:37 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -220,6 +220,7 @@ wsbell_attach(device_t parent, device_t 
 	sc->sc_base.me_dv = self;
 	sc->sc_accesscookie = ap->accesscookie;
 
+	sc->sc_dying = false;
 	sc->sc_spkr = device_unit(parent);
 	sc->sc_bell_data = wskbd_default_bell_data;
 #if NWSMUX > 0
@@ -256,7 +257,7 @@ wsbell_activate(device_t self, enum deva
 	struct wsbell_softc *sc = device_private(self);
 
 	if (act == DVACT_DEACTIVATE)
-		sc->sc_dying = 1;
+		sc->sc_dying = true;
 	return (0);
 }
 
@@ -305,7 +306,7 @@ wsbell_detach(device_t self, int flags)
 	vdevgone(maj, mn, mn, VCHR);
 
 	mutex_enter(>sc_bellock);
-	sc->sc_dying = 1;
+	sc->sc_dying = true;
 
 	cv_broadcast(>sc_bellcv);
 	mutex_exit(>sc_bellock);
@@ -344,7 +345,7 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 		 int flag, struct lwp *l)
 {
 	struct wskbd_bell_data *ubdp, *kbdp;
-	if (sc->sc_dying)
+	if (sc->sc_dying == true)
 		return (EIO);
 
 	/*
@@ -400,7 +401,7 @@ bell_thread(void *arg)
 		mutex_enter(>sc_bellock);
 		cv_wait_sig(>sc_bellcv, >sc_bellock);
 		
-		if (sc->sc_dying) {
+		if (sc->sc_dying == true) {
 			mutex_exit(>sc_bellock);
 			kthread_exit(0);
 		}

Index: src/sys/dev/wscons/wsbellvar.h
diff -u src/sys/dev/wscons/wsbellvar.h:1.2 src/sys/dev/wscons/wsbellvar.h:1.3
--- src/sys/dev/wscons/wsbellvar.h:1.2	Tue Jun 13 00:49:05 2017
+++ src/sys/dev/wscons/wsbellvar.h	Tue Jun 13 00:54:37 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbellvar.h,v 1.2 2017/06/13 00:49:05 nat Exp $ */
+/* $NetBSD: wsbellvar.h,v 1.3 2017/06/13 00:54:37 nat Exp $ */
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
  * All rights reserved.
@@ -45,7 +45,7 @@ struct wsbell_softc {
 	void		*sc_accesscookie;
 
 	int		sc_refcnt;
-	u_char		sc_dying;	/* device is being detached */
+	bool		sc_dying;	/* device is being detached */
 
 	lwp_t		*sc_bellthread;
 	kmutex_t	sc_bellock;



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 13 00:49:05 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c wsbellvar.h

Log Message:
Remove dying ftom vb_args and use sc_dying instead.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/wscons/wsbell.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsbellvar.h

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

Modified files:

Index: src/sys/dev/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.5 src/sys/dev/wscons/wsbell.c:1.6
--- src/sys/dev/wscons/wsbell.c:1.5	Tue Jun 13 00:42:27 2017
+++ src/sys/dev/wscons/wsbell.c	Tue Jun 13 00:49:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $ */
+/* $NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.6 2017/06/13 00:49:05 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -305,7 +305,7 @@ wsbell_detach(device_t self, int flags)
 	vdevgone(maj, mn, mn, VCHR);
 
 	mutex_enter(>sc_bellock);
-	sc->sc_bell_args.dying = true;
+	sc->sc_dying = 1;
 
 	cv_broadcast(>sc_bellcv);
 	mutex_exit(>sc_bellock);
@@ -400,7 +400,7 @@ bell_thread(void *arg)
 		mutex_enter(>sc_bellock);
 		cv_wait_sig(>sc_bellcv, >sc_bellock);
 		
-		if (vb->dying == true) {
+		if (sc->sc_dying) {
 			mutex_exit(>sc_bellock);
 			kthread_exit(0);
 		}
@@ -423,7 +423,6 @@ spkr_audio_play(struct wsbell_softc *sc,
 {
 
 	mutex_enter(>sc_bellock);
-	sc->sc_bell_args.dying = false;
 	sc->sc_bell_args.pitch = pitch;
 	sc->sc_bell_args.period = period / 5;
 	sc->sc_bell_args.volume = volume;

Index: src/sys/dev/wscons/wsbellvar.h
diff -u src/sys/dev/wscons/wsbellvar.h:1.1 src/sys/dev/wscons/wsbellvar.h:1.2
--- src/sys/dev/wscons/wsbellvar.h:1.1	Sun Jun 11 03:55:56 2017
+++ src/sys/dev/wscons/wsbellvar.h	Tue Jun 13 00:49:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbellvar.h,v 1.1 2017/06/11 03:55:56 nat Exp $ */
+/* $NetBSD: wsbellvar.h,v 1.2 2017/06/13 00:49:05 nat Exp $ */
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
  * All rights reserved.
@@ -35,7 +35,6 @@ struct vbell_args {
 	u_int pitch;
 	u_int period;
 	u_int volume;
-	bool dying;
 };
 
 struct wsbell_softc {



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Tue Jun 13 00:42:27 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c wsbelldata.h wskbd.c

Log Message:
Move duplicate definition of SETBELL macro into wsbelldata.h.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/wscons/wsbell.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/wscons/wsbelldata.h
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/wscons/wskbd.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/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.4 src/sys/dev/wscons/wsbell.c:1.5
--- src/sys/dev/wscons/wsbell.c:1.4	Mon Jun 12 07:12:49 2017
+++ src/sys/dev/wscons/wsbell.c	Tue Jun 13 00:42:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $ */
+/* $NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.5 2017/06/13 00:42:27 nat Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
@@ -351,17 +351,6 @@ wsbell_do_ioctl(struct wsbell_softc *sc,
 	 * Try the wsbell specific ioctls.
 	 */
 	switch (cmd) {
-#define	SETBELL(dstp, srcp, dfltp)	\
-do {\
-	(dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ?		\
-	(srcp)->pitch : (dfltp)->pitch;\
-	(dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ?	\
-	(srcp)->period : (dfltp)->period;\
-	(dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ?	\
-	(srcp)->volume : (dfltp)->volume;\
-	(dstp)->which = WSKBD_BELL_DOALL;\
-} while (0)
-
 	case WSKBDIO_SETBELL:
 		if ((flag & FWRITE) == 0)
 			return (EACCES);

Index: src/sys/dev/wscons/wsbelldata.h
diff -u src/sys/dev/wscons/wsbelldata.h:1.1 src/sys/dev/wscons/wsbelldata.h:1.2
--- src/sys/dev/wscons/wsbelldata.h:1.1	Sun Jun 11 03:38:12 2017
+++ src/sys/dev/wscons/wsbelldata.h	Tue Jun 13 00:42:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbelldata.h,v 1.1 2017/06/11 03:38:12 nat Exp $ */
+/* $NetBSD: wsbelldata.h,v 1.2 2017/06/13 00:42:27 nat Exp $ */
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
  * All rights reserved.
@@ -35,6 +35,17 @@
 #define	WSKBD_DEFAULT_BELL_VOLUME	50	/* 50% volume */
 #endif
 
+#define	SETBELL(dstp, srcp, dfltp)	\
+do {\
+	(dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ?		\
+	(srcp)->pitch : (dfltp)->pitch;\
+	(dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ?	\
+	(srcp)->period : (dfltp)->period;\
+	(dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ?	\
+	(srcp)->volume : (dfltp)->volume;\
+	(dstp)->which = WSKBD_BELL_DOALL;\
+} while (0)
+
 static struct wskbd_bell_data wskbd_default_bell_data = {
 	WSKBD_BELL_DOALL,
 	WSKBD_DEFAULT_BELL_PITCH,

Index: src/sys/dev/wscons/wskbd.c
diff -u src/sys/dev/wscons/wskbd.c:1.139 src/sys/dev/wscons/wskbd.c:1.140
--- src/sys/dev/wscons/wskbd.c:1.139	Sun Jun 11 03:38:12 2017
+++ src/sys/dev/wscons/wskbd.c	Tue Jun 13 00:42:27 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $ */
+/* $NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $ */
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -105,7 +105,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.139 2017/06/11 03:38:12 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.140 2017/06/13 00:42:27 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1059,17 +1059,6 @@ wskbd_displayioctl(device_t dev, u_long 
 	int len, error;
 
 	switch (cmd) {
-#define	SETBELL(dstp, srcp, dfltp)	\
-do {\
-	(dstp)->pitch = ((srcp)->which & WSKBD_BELL_DOPITCH) ?		\
-	(srcp)->pitch : (dfltp)->pitch;\
-	(dstp)->period = ((srcp)->which & WSKBD_BELL_DOPERIOD) ?	\
-	(srcp)->period : (dfltp)->period;\
-	(dstp)->volume = ((srcp)->which & WSKBD_BELL_DOVOLUME) ?	\
-	(srcp)->volume : (dfltp)->volume;\
-	(dstp)->which = WSKBD_BELL_DOALL;\
-} while (0)
-
 	case WSKBDIO_BELL:
 		if ((flag & FWRITE) == 0)
 			return (EACCES);



CVS commit: src/external/bsd/dhcpcd/sbin

2017-06-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Tue Jun 13 00:28:10 UTC 2017

Added Files:
src/external/bsd/dhcpcd/sbin: Makefile.inc

Log Message:
Restore Makefile.inc so dhcpcd is installed correctly as pointed out by kre@.
This reverts my prior commit.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.5 src/external/bsd/dhcpcd/sbin/Makefile.inc

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

Added files:

Index: src/external/bsd/dhcpcd/sbin/Makefile.inc
diff -u /dev/null src/external/bsd/dhcpcd/sbin/Makefile.inc:1.5
--- /dev/null	Tue Jun 13 00:28:10 2017
+++ src/external/bsd/dhcpcd/sbin/Makefile.inc	Tue Jun 13 00:28:10 2017
@@ -0,0 +1,10 @@
+# $NetBSD: Makefile.inc,v 1.5 2017/06/13 00:28:10 roy Exp $
+
+.include 		# for MKDYNAMICROOT definition
+
+WARNS?=		5
+BINDIR=		/sbin
+
+.if (${MKDYNAMICROOT} == "no")
+LDSTATIC?=	-static
+.endif



CVS commit: [jdolecek-ncq] src/sys/dev

2017-06-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Tue Jun 13 00:02:19 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq
src/sys/dev/ic [jdolecek-ncq]: siisata.c siisatavar.h

Log Message:
Add NCQ support to siisata(4).

There are still issues that need to be address before I consider this
mergable.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/dev/ata/TODO.ncq
cvs rdiff -u -r1.30.4.14 -r1.30.4.15 src/sys/dev/ic/siisata.c
cvs rdiff -u -r1.6 -r1.6.48.1 src/sys/dev/ic/siisatavar.h

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

Modified files:

Index: src/sys/dev/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.13 src/sys/dev/ata/TODO.ncq:1.1.2.14
--- src/sys/dev/ata/TODO.ncq:1.1.2.13	Mon Jun 12 23:25:06 2017
+++ src/sys/dev/ata/TODO.ncq	Tue Jun 13 00:02:19 2017
@@ -3,7 +3,7 @@ Bugs
 
 test crashdump with ahci
 
-siisata - fix all 'XXX slot' -- jakllsch has this done but uncommited
+siisata - fix all new XXX and unmergable bits
 
 test crashdump with siisata
 

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.14 src/sys/dev/ic/siisata.c:1.30.4.15
--- src/sys/dev/ic/siisata.c:1.30.4.14	Mon Apr 24 21:19:21 2017
+++ src/sys/dev/ic/siisata.c	Tue Jun 13 00:02:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.14 2017/04/24 21:19:21 jakllsch Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.15 2017/06/13 00:02:19 jakllsch Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.14 2017/04/24 21:19:21 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.15 2017/06/13 00:02:19 jakllsch Exp $");
 
 #include 
 #include 
@@ -148,7 +148,7 @@ void siisata_killpending(struct ata_driv
 
 void siisata_cmd_start(struct ata_channel *, struct ata_xfer *);
 int siisata_cmd_complete(struct ata_channel *, struct ata_xfer *, int);
-void siisata_cmd_done(struct ata_channel *, struct ata_xfer *, int);
+void siisata_cmd_done(struct ata_channel *, struct ata_xfer *);
 void siisata_cmd_kill_xfer(struct ata_channel *, struct ata_xfer *, int);
 
 void siisata_bio_start(struct ata_channel *, struct ata_xfer *);
@@ -209,7 +209,7 @@ siisata_attach(struct siisata_softc *sc)
 	SIISATA_DEBUG_PRINT(("%s: %s: GR_GC: 0x%08x\n",
 	SIISATANAME(sc), __func__, GRREAD(sc, GR_GC)), DEBUG_FUNCS);
 
-	sc->sc_atac.atac_cap = ATAC_CAP_DMA | ATAC_CAP_UDMA;
+	sc->sc_atac.atac_cap = ATAC_CAP_DMA | ATAC_CAP_UDMA | ATAC_CAP_NCQ;
 	sc->sc_atac.atac_pio_cap = 4;
 	sc->sc_atac.atac_dma_cap = 2;
 	sc->sc_atac.atac_udma_cap = 6;
@@ -246,10 +246,7 @@ siisata_enable_port_interrupt(struct ata
 {
 	struct siisata_softc *sc = (struct siisata_softc *)chp->ch_atac;
 
-	/* clear any interrupts */
-	(void)PRREAD(sc, PRX(chp->ch_channel, PRO_PSS));
-	PRWRITE(sc, PRX(chp->ch_channel, PRO_PIS), 0x);
-	/* and enable CmdErrr+CmdCmpl interrupting */
+	/* enable CmdErrr+CmdCmpl interrupting */
 	PRWRITE(sc, PRX(chp->ch_channel, PRO_PIES),
 	PR_PIS_CMDERRR | PR_PIS_CMDCMPL);
 }
@@ -263,9 +260,12 @@ siisata_init_port(struct siisata_softc *
 	schp = >sc_channels[port];
 	chp = (struct ata_channel *)schp;
 
-	/* come out of reset, 64-bit activation */
+	/*
+	 * Come out of reset. Disable no clearing of PR_PIS_CMDCMPL on read
+	 * of PR_PSS. Disable 32-bit PRB activation, we use 64-bit activation.
+	 */
 	PRWRITE(sc, PRX(chp->ch_channel, PRO_PCC),
-	PR_PC_32BA | PR_PC_PORT_RESET);
+	PR_PC_32BA | PR_PC_INCOR | PR_PC_PORT_RESET);
 	/* initialize port */
 	siisata_reinit_port(chp);
 	/* enable CmdErrr+CmdCmpl interrupting */
@@ -473,53 +473,71 @@ siisata_intr_port(struct siisata_channel
 	struct siisata_softc *sc;
 	struct ata_channel *chp;
 	struct ata_xfer *xfer;
-	int slot;
+	u_int slot;
 	uint32_t pss, pis;
 	uint32_t prbfis;
 
 	sc = (struct siisata_softc *)schp->ata_channel.ch_atac;
 	chp = >ata_channel;
-	xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, 0); /* XXX slot */
-	slot = SIISATA_NON_NCQ_SLOT;
+
+	/* get slot status, clearing completion interrupt (PR_PIS_CMDCMPL) */
+	pss = PRREAD(sc, PRX(chp->ch_channel, PRO_PSS));
+	SIISATA_DEBUG_PRINT(("%s: %s port %d, pss 0x%x\n",
+	SIISATANAME(sc), __func__, chp->ch_channel, pss), DEBUG_INTR);
+
+	for (slot = 0; slot < SIISATA_MAX_SLOTS; slot++) {
+		if (((schp->sch_active_slots >> slot) & 1) == 0)
+			/* there's nothing executing here, skip */
+			continue;
+		if (((pss >> slot) & 1) != 0)
+			/* execution is incomplete or unsuccessful, skip for now */
+			continue;
+		xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, slot);
+		if (xfer->c_intr == NULL) {
+			wakeup(schp);
+			continue;
+		}
+		KASSERT(xfer != NULL);
+		KASSERT(xfer->c_intr != NULL);
+		xfer->c_intr(chp, xfer, 0);
+	}
+	/* if no errors, we're done now */
+	if ((pss & PR_PSS_ATTENTION) == 0) {
+		pis = PRREAD(sc, PRX(chp->ch_channel, PRO_PIS));
+		pis &= 0x;
+		if (pis) {
+			PRWRITE(sc, 

CVS commit: [jdolecek-ncq] src/sys/dev/ic

2017-06-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jun 12 23:51:41 UTC 2017

Modified Files:
src/sys/dev/ic [jdolecek-ncq]: siisatareg.h

Log Message:
Macro argument parentheses paranoia.
Annotate another register initialism.


To generate a diff of this commit:
cvs rdiff -u -r1.7.42.1 -r1.7.42.2 src/sys/dev/ic/siisatareg.h

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

Modified files:

Index: src/sys/dev/ic/siisatareg.h
diff -u src/sys/dev/ic/siisatareg.h:1.7.42.1 src/sys/dev/ic/siisatareg.h:1.7.42.2
--- src/sys/dev/ic/siisatareg.h:1.7.42.1	Mon Apr 24 13:05:26 2017
+++ src/sys/dev/ic/siisatareg.h	Mon Jun 12 23:51:40 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisatareg.h,v 1.7.42.1 2017/04/24 13:05:26 jakllsch Exp $ */
+/* $NetBSD: siisatareg.h,v 1.7.42.2 2017/06/12 23:51:40 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2010, 2011 Jonathan A. Kollasch.
@@ -181,9 +181,9 @@ struct siisata_prb {
 #define PRO_PPHYC	0x1050		/* phy config */
 #define PRO_PSS		0x1800		/* port slot status */
 /* technically this is a shadow of the CAR */
-#define PRO_CAR		0x1c00
+#define PRO_CAR		0x1c00		/* command activation register */
 
-#define PRO_CARX(p,s) (PRX(p, PRO_CAR) + s * sizeof(uint64_t))
+#define PRO_CARX(p,s) (PRX(p, PRO_CAR) + (s) * sizeof(uint64_t))
 
 #define PRO_PCR		0x1e04		/* port context register */
 #define PRO_SCONTROL	0x1f00		/* SControl */



CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-06-12 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Jun 12 23:25:06 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq

Log Message:
Add a few more NCQ branch action items.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.12 src/sys/dev/ata/TODO.ncq:1.1.2.13
--- src/sys/dev/ata/TODO.ncq:1.1.2.12	Mon Jun 12 21:53:19 2017
+++ src/sys/dev/ata/TODO.ncq	Mon Jun 12 23:25:06 2017
@@ -3,13 +3,27 @@ Bugs
 
 test crashdump with ahci
 
-siisata - fix all 'XXX slot' 
+siisata - fix all 'XXX slot' -- jakllsch has this done but uncommited
+
+test crashdump with siisata
 
 test wd* at umass?, confirm the ata_channel kludge works
 
 is ata_exec_xfer() + POLL safe wrt. more outstanding I/Os? why is it waiting
 until xfer is head of queue? also layer violation with the ata_xfer_free() call
 
+further test port multipliers (currently appears to not work)
+
+test device error handling (currently appears to not work well, at least in NCQ case)
+
+do proper NCQ error recovery (currently not even really attempted)
+
+maybe do device error handling in not-interrupt-context (maybe this should be
+done on a mpata branch?)
+
+atabus(4) queue depth can only shrink, causing NCQ to not be available if NCQ
+drive rescaned after detach of non-NCQ drive
+
 Other random notes (do outside the NCQ branch):
 -
 add nibble to control number of tags (1==disable NCQ)?



CVS commit: [jdolecek-ncq] src/sys/dev/ata

2017-06-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jun 12 21:53:19 UTC 2017

Modified Files:
src/sys/dev/ata [jdolecek-ncq]: TODO.ncq

Log Message:
update notes


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.1.2.11 src/sys/dev/ata/TODO.ncq:1.1.2.12
--- src/sys/dev/ata/TODO.ncq:1.1.2.11	Mon Apr 24 22:20:23 2017
+++ src/sys/dev/ata/TODO.ncq	Mon Jun 12 21:53:19 2017
@@ -1,24 +1,31 @@
 Bugs
 
 
-mvsata, siisata - fix all 'XXX slot' 
+test crashdump with ahci
+
+siisata - fix all 'XXX slot' 
 
 test wd* at umass?, confirm the ata_channel kludge works
 
 is ata_exec_xfer() + POLL safe wrt. more outstanding I/Os? why is it waiting
 until xfer is head of queue? also layer violation with the ata_xfer_free() call
 
-Other random notes (maybe do outside the NCQ branch):
+Other random notes (do outside the NCQ branch):
 -
+add nibble to control number of tags (1==disable NCQ)?
+
 add support for the NCQ TRIM if supported by device?
 
 protect more of wddone() with mutex?
 
-refactor mvsata to reuse (more of) ata_wdc.c? duplicates e.g. mode selection
-logic
-
 implement DIOCGCACHE/DIOCCACHESYNC for ld@ataraid? just passthrough, like ccd
 
-MSI/MSI-X support for AHCI
+MSI/MSI-X support for AHCI and mvsata(4)
+
+mvsata - constify mvsata_pci_products and move pci-specific code to
+the pci attach code
+
+mvsata(4) 64-bit DMA
+- at least with AHA1430SA does not really work, crash in mvsata_intr() on boot
 
 malloc(M_CANFAIL) actually doesn't do anything



CVS commit: [jdolecek-ncq] src/sys/dev/ic

2017-06-12 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Jun 12 21:38:50 UTC 2017

Modified Files:
src/sys/dev/ic [jdolecek-ncq]: mvsata.c

Log Message:
add support for NCQ on Gen IIe hardware

mvsata_quetag_get()/put() pairs adjusted to work also for non-DMA code paths,
i.e. during probe; replaced wdcintr() call with local routine which uses
currently active command tag, rather than assuming always tag 0 on that
code path

~55MB/s -> ~80MB/s sequential read using fio(1) on a test HDD, quite nice


To generate a diff of this commit:
cvs rdiff -u -r1.35.6.8 -r1.35.6.9 src/sys/dev/ic/mvsata.c

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

Modified files:

Index: src/sys/dev/ic/mvsata.c
diff -u src/sys/dev/ic/mvsata.c:1.35.6.8 src/sys/dev/ic/mvsata.c:1.35.6.9
--- src/sys/dev/ic/mvsata.c:1.35.6.8	Sat Jun 10 13:25:51 2017
+++ src/sys/dev/ic/mvsata.c	Mon Jun 12 21:38:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsata.c,v 1.35.6.8 2017/06/10 13:25:51 jdolecek Exp $	*/
+/*	$NetBSD: mvsata.c,v 1.35.6.9 2017/06/12 21:38:50 jdolecek Exp $	*/
 /*
  * Copyright (c) 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.8 2017/06/10 13:25:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsata.c,v 1.35.6.9 2017/06/12 21:38:50 jdolecek Exp $");
 
 #include "opt_mvsata.h"
 
@@ -159,6 +159,8 @@ static void mvsata_bdma_start(struct mvs
 #endif
 #endif
 
+static int mvsata_nondma_handle(struct mvsata_port *);
+
 static int mvsata_port_init(struct mvsata_hc *, int);
 static int mvsata_wdc_reg_init(struct mvsata_port *, struct wdc_regs *);
 #ifndef MVSATA_WITHOUTDMA
@@ -289,6 +291,7 @@ mvsata_attach(struct mvsata_softc *sc, s
 		_fix_phy = mvsata_fix_phy_gen2;
 #ifndef MVSATA_WITHOUTDMA
 		edma_setup_crqb = mvsata_edma_setup_crqb_gen2e;
+		sc->sc_wdcdev.sc_atac.atac_cap |= ATAC_CAP_NCQ;
 #endif
 		break;
 	}
@@ -401,6 +404,7 @@ mvsata_intr(struct mvsata_hc *mvhc)
 	if (cause & SATAHC_IC_SAINTCOAL)
 		MVSATA_HC_WRITE_4(mvhc, SATAHC_IC, ~SATAHC_IC_SAINTCOAL);
 	cause &= ~SATAHC_IC_SAINTCOAL;
+
 	for (port = 0; port < sc->sc_port; port++) {
 		mvport = mvhc->hc_ports[port];
 
@@ -413,7 +417,7 @@ mvsata_intr(struct mvsata_hc *mvhc)
 		}
 
 		if (cause & SATAHC_IC_SADEVINTERRUPT(port)) {
-			wdcintr(>port_ata_channel);
+			(void) mvsata_nondma_handle(mvport);
 			MVSATA_HC_WRITE_4(mvhc, SATAHC_IC,
 			~SATAHC_IC_SADEVINTERRUPT(port));
 			handled = 1;
@@ -423,6 +427,35 @@ mvsata_intr(struct mvsata_hc *mvhc)
 	return handled;
 }
 
+static int
+mvsata_nondma_handle(struct mvsata_port *mvport)
+{
+	struct ata_channel *chp = >port_ata_channel;
+	struct ata_xfer *xfer;
+	int ret, quetag;
+
+	/*
+	 * The chip doesn't support several pending non-DMA commands,
+	 * and the ata middle layer never issues several non-NCQ commands,
+	 * so there must be exactly one active command at this moment.
+	 */
+	for (quetag = 0; quetag < MVSATA_EDMAQ_LEN; quetag++) {
+		if ((mvport->port_quetagidx & __BIT(quetag)) == 0)
+			continue;
+
+		break;
+	}
+	KASSERT(quetag < MVSATA_EDMAQ_LEN);
+
+	xfer = ata_queue_hwslot_to_xfer(chp->ch_queue, quetag);
+	chp->ch_flags &= ~ATACH_IRQ_WAIT;
+	KASSERT(xfer->c_intr != NULL);
+	ret = xfer->c_intr(chp, xfer, 1);
+	if (ret == 0) /* irq was not for us, still waiting for irq */
+		chp->ch_flags |= ATACH_IRQ_WAIT;
+	return (ret);
+}
+
 int
 mvsata_error(struct mvsata_port *mvport)
 {
@@ -528,6 +561,7 @@ static int
 mvsata_bio(struct ata_drive_datas *drvp, struct ata_xfer *xfer)
 {
 	struct ata_channel *chp = drvp->chnl_softc;
+	struct mvsata_port *mvport = (struct mvsata_port *)chp;
 	struct atac_softc *atac = chp->ch_atac;
 	struct ata_bio *ata_bio = >c_bio;
 
@@ -535,6 +569,8 @@ mvsata_bio(struct ata_drive_datas *drvp,
 	", bcount=%ld\n", device_xname(atac->atac_dev), chp->ch_channel,
 	drvp->drive, ata_bio->blkno, ata_bio->bcount));
 
+	mvsata_quetag_get(mvport, xfer->c_slot);
+
 	if (atac->atac_cap & ATAC_CAP_NOIRQ)
 		ata_bio->flags |= ATA_POLL;
 	if (ata_bio->flags & ATA_POLL)
@@ -636,9 +672,7 @@ static int
 mvsata_exec_command(struct ata_drive_datas *drvp, struct ata_xfer *xfer)
 {
 	struct ata_channel *chp = drvp->chnl_softc;
-#ifdef MVSATA_DEBUG
 	struct mvsata_port *mvport = (struct mvsata_port *)chp;
-#endif
 	struct ata_command *ata_c = >c_ata_c;
 	int rv, s;
 
@@ -649,6 +683,8 @@ mvsata_exec_command(struct ata_drive_dat
 	drvp->drive, ata_c->bcount, ata_c->r_lba, ata_c->r_count,
 	ata_c->r_features, ata_c->r_device, ata_c->r_command));
 
+	mvsata_quetag_get(mvport, xfer->c_slot);
+
 	if (ata_c->flags & AT_POLL)
 		xfer->c_flags |= C_POLL;
 	if (ata_c->flags & AT_WAIT)
@@ -747,8 +783,9 @@ mvsata_atapi_scsipi_request(struct scsip
 	struct scsipi_xfer *sc_xfer;
 	struct mvsata_softc *sc = device_private(adapt->adapt_dev);
 	struct atac_softc *atac = >sc_wdcdev.sc_atac;
+	struct ata_channel *chp = atac->atac_channels[chan->chan_channel];
 	

CVS commit: src/sys/kern

2017-06-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 12 21:08:34 UTC 2017

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

Log Message:
Add heading comment for private localcount_adjust subroutine.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/subr_localcount.c

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

Modified files:

Index: src/sys/kern/subr_localcount.c
diff -u src/sys/kern/subr_localcount.c:1.5 src/sys/kern/subr_localcount.c:1.6
--- src/sys/kern/subr_localcount.c:1.5	Mon Jun 12 21:07:14 2017
+++ src/sys/kern/subr_localcount.c	Mon Jun 12 21:08:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_localcount.c,v 1.5 2017/06/12 21:07:14 riastradh Exp $	*/
+/*	$NetBSD: subr_localcount.c,v 1.6 2017/06/12 21:08:34 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.5 2017/06/12 21:07:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.6 2017/06/12 21:08:34 riastradh Exp $");
 
 #include 
 #include 
@@ -167,6 +167,12 @@ localcount_xc(void *cookie0, void *cooki
 	mutex_exit(interlock);
 }
 
+/*
+ * localcount_adjust(lc, delta)
+ *
+ *	Add delta -- positive or negative -- to the local CPU's count
+ *	for lc.
+ */
 static void
 localcount_adjust(struct localcount *lc, int delta)
 {



CVS commit: src/sys/kern

2017-06-12 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 12 21:07:14 UTC 2017

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

Log Message:
Move forward declaration to top of file.

Keep header comment above localcount_init adjoined to it.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/subr_localcount.c

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

Modified files:

Index: src/sys/kern/subr_localcount.c
diff -u src/sys/kern/subr_localcount.c:1.4 src/sys/kern/subr_localcount.c:1.5
--- src/sys/kern/subr_localcount.c:1.4	Fri Jun  2 00:32:12 2017
+++ src/sys/kern/subr_localcount.c	Mon Jun 12 21:07:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $	*/
+/*	$NetBSD: subr_localcount.c,v 1.5 2017/06/12 21:07:14 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.4 2017/06/02 00:32:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_localcount.c,v 1.5 2017/06/12 21:07:14 riastradh Exp $");
 
 #include 
 #include 
@@ -55,6 +55,8 @@ __KERNEL_RCSID(0, "$NetBSD: subr_localco
 #include 
 #include 
 
+static void localcount_xc(void *, void *);
+
 /*
  * localcount_init(lc)
  *
@@ -64,8 +66,6 @@ __KERNEL_RCSID(0, "$NetBSD: subr_localco
  *	The caller must call localcount_drain and then localcount_fini
  *	when done with lc.
  */
-static void localcount_xc(void *, void *);
-
 void
 localcount_init(struct localcount *lc)
 {



CVS commit: src/sys/ufs/lfs

2017-06-12 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Jun 12 15:02:32 UTC 2017

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

Log Message:
Use continue to denote the no-op loop to match netbsd style
newline for extra clarity.


To generate a diff of this commit:
cvs rdiff -u -r1.270 -r1.271 src/sys/ufs/lfs/lfs_segment.c

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

Modified files:

Index: src/sys/ufs/lfs/lfs_segment.c
diff -u src/sys/ufs/lfs/lfs_segment.c:1.270 src/sys/ufs/lfs/lfs_segment.c:1.271
--- src/sys/ufs/lfs/lfs_segment.c:1.270	Sat Jun 10 05:29:36 2017
+++ src/sys/ufs/lfs/lfs_segment.c	Mon Jun 12 15:02:32 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_segment.c,v 1.270 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.270 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.271 2017/06/12 15:02:32 maya Exp $");
 
 #ifdef DEBUG
 # define vndebug(vp, str) do {		\
@@ -1381,7 +1381,8 @@ loop:
 	for (bp = LIST_FIRST(>v_dirtyblkhd);
 	 bp && LIST_NEXT(bp, b_vnbufs) != NULL;
 	 bp = LIST_NEXT(bp, b_vnbufs))
-		/* nothing */;
+		continue;
+
 	for (; bp && bp != BEG_OF_LIST; bp = nbp) {
 		nbp = BACK_BUF(bp);
 #else /* LFS_NO_BACKBUF_HACK */



CVS commit: src/lib/libc/sys

2017-06-12 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Jun 12 14:59:04 UTC 2017

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

Log Message:
Fix typo
Insert Pp after a list to add vertical space before the next paragraph
Remove Pp before Bl at two places


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/lib/libc/sys/mmap.2

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

Modified files:

Index: src/lib/libc/sys/mmap.2
diff -u src/lib/libc/sys/mmap.2:1.50 src/lib/libc/sys/mmap.2:1.51
--- src/lib/libc/sys/mmap.2:1.50	Sun May 14 12:29:10 2017
+++ src/lib/libc/sys/mmap.2	Mon Jun 12 14:59:04 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mmap.2,v 1.50 2017/05/14 12:29:10 wiz Exp $
+.\"	$NetBSD: mmap.2,v 1.51 2017/06/12 14:59:04 abhinav Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -76,7 +76,6 @@ The protections (region accessibility) a
 argument by
 .Em OR Ns 'ing
 the following values:
-.Pp
 .Bl -tag -width PROT_WRITEXX -offset indent
 .It Dv PROT_EXEC
 Pages may be executed.
@@ -87,13 +86,14 @@ Pages may be written.
 .It Dv PROT_NONE
 Placeholder when requesting no access permission.
 .El
+.Pp
 As a
 .Nx
 extension,
 .Dv PROT_MPROTECT
 can be used to request additional permissions for later use with
 .Fn mprotect 2 .
-This is necessary for switching pages between writeable and executable
+This is necessary for switching pages between writable and executable
 when PAX mprotect restrictions are in place.
 .Pp
 .Bf -symbolic
@@ -124,7 +124,6 @@ Sharing, mapping type and options are sp
 argument by
 .Em OR Ns 'ing
 the following values:
-.Pp
 .Bl -tag -width MAP_HASSEMAPHOREXX -offset indent
 .It Dv MAP_ALIGNED(n)
 Request that the allocation be aligned to the given boundary.



CVS commit: src/external/bsd/dhcpcd/sbin

2017-06-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jun 12 14:52:02 UTC 2017

Removed Files:
src/external/bsd/dhcpcd/sbin: Makefile.inc

Log Message:
This Makefile fragment is no longer used.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r0 src/external/bsd/dhcpcd/sbin/Makefile.inc

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



CVS commit: src/external/bsd/dhcpcd

2017-06-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Jun 12 14:50:38 UTC 2017

Modified Files:
src/external/bsd/dhcpcd: Makefile.inc

Log Message:
Replace @DATADIR@ with /usr/share/examples as pointed by plunky@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/external/bsd/dhcpcd/Makefile.inc

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

Modified files:

Index: src/external/bsd/dhcpcd/Makefile.inc
diff -u src/external/bsd/dhcpcd/Makefile.inc:1.1 src/external/bsd/dhcpcd/Makefile.inc:1.2
--- src/external/bsd/dhcpcd/Makefile.inc:1.1	Fri Mar 31 21:02:08 2017
+++ src/external/bsd/dhcpcd/Makefile.inc	Mon Jun 12 14:50:38 2017
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile.inc,v 1.1 2017/03/31 21:02:08 roy Exp $
+# $NetBSD: Makefile.inc,v 1.2 2017/06/12 14:50:38 roy Exp $
 
 SRCDIR=		${NETBSDSRCDIR}/external/bsd/dhcpcd
 DIST=		${SRCDIR}/dist
 
 SED_SYS=	-e 's:@SYSCONFDIR@:/etc:g' \
+		-e 's:@DATADIR@:/usr/share/examples:g' \
 		-e 's:@DBDIR@:/var/db:g' \
 		-e 's:@LIBDIR@:/lib:g' \
 		-e 's:@RUNDIR@:/var/run:g' \



CVS commit: src/doc

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 11:05:22 UTC 2017

Modified Files:
src/doc: CHANGES

Log Message:
Note addition of wsbell(4)


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2289 src/doc/CHANGES:1.2290
--- src/doc/CHANGES:1.2289	Mon Jun  5 19:17:59 2017
+++ src/doc/CHANGES	Mon Jun 12 11:05:21 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2289 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2290 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -25,3 +25,5 @@
 
 Changes from NetBSD 8.0 to NetBSD 9.0:
 	byacc: update to 20170430 [christos 20170605]
+	wsbell(4): added console bell support for all speaker devices, not
+		only those attached at pcppi [nat 20170612]



CVS commit: src/sys/dev/pci

2017-06-12 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Mon Jun 12 10:59:47 UTC 2017

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

Log Message:
Deal with broken BIOSes that leave PCI interrupts disabled.

Thanks to nick@


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/ehci_pci.c

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

Modified files:

Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.64 src/sys/dev/pci/ehci_pci.c:1.65
--- src/sys/dev/pci/ehci_pci.c:1.64	Thu Oct 13 20:05:06 2016
+++ src/sys/dev/pci/ehci_pci.c	Mon Jun 12 10:59:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $");
 
 #include 
 #include 
@@ -161,10 +161,14 @@ ehci_pci_attach(device_t parent, device_
 		break;
 	}
 
+	pcireg_t intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
+	int pin = PCI_INTERRUPT_PIN(intr);
+
 	/* Enable the device. */
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
-	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
-		   csr | PCI_COMMAND_MASTER_ENABLE);
+	csr |= PCI_COMMAND_MASTER_ENABLE;
+	csr &= ~(pin ? PCI_COMMAND_INTERRUPT_DISABLE : 0);
+	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr);
 
 	/* Map and establish the interrupt. */
 	if (pci_intr_map(pa, )) {



CVS commit: src/sys/dev/hpc

2017-06-12 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Mon Jun 12 09:23:39 UTC 2017

Modified Files:
src/sys/dev/hpc: hpckbd.c

Log Message:
Restore wscons keymaps feature on hpcarm

hpc ports need to alter keydesc data at runtime in order to load
alternate keymaps. But since keydesc is const initialized data, it
is mapped read only and the operation should fail.

It seems older compiler failed to enforce the read-only mapping and
this is why it used to work, but on recent NetBSD releases, the
feature is broken.

We fix it by duplicating the keydesc data once into a malloc'ed area
that can be modified.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/hpc/hpckbd.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/hpc/hpckbd.c
diff -u src/sys/dev/hpc/hpckbd.c:1.30 src/sys/dev/hpc/hpckbd.c:1.31
--- src/sys/dev/hpc/hpckbd.c:1.30	Sat Oct 27 17:18:17 2012
+++ src/sys/dev/hpc/hpckbd.c	Mon Jun 12 09:23:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $ */
+/*	$NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $ */
 
 /*-
  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
@@ -30,11 +30,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.30 2012/10/27 17:18:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpckbd.c,v 1.31 2017/06/12 09:23:39 manu Exp $");
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -264,22 +265,30 @@ hpckbd_keymap_setup(struct hpckbd_core *
 		const keysym_t *map, int mapsize)
 {
 	int i;
-	struct wscons_keydesc *desc;
+	const struct wscons_keydesc *desc;
+	static struct wscons_keydesc *ndesc = NULL;
 
-	/* fix keydesc table */
 	/* 
-	 * XXX The way this is done is really wrong.  The __UNCONST()
-	 * is a hint as to what is wrong.  This actually ends up modifying
-	 * initialized data which is marked "const".
-	 * The reason we get away with it here is apparently that text
-	 * and read-only data gets mapped read/write on the platforms
-	 * using this code.
+	 * fix keydesc table. Since it is const data, we must 
+	 * copy it once before changingg it.
 	 */
-	desc = (struct wscons_keydesc *)__UNCONST(hpckbd_keymapdata.keydesc);
+
+	if (ndesc == NULL) {
+		size_t sz;
+
+		for (sz = 0; hpckbd_keymapdata.keydesc[sz].name != 0; sz++);
+
+		ndesc = malloc(sz * sizeof(*ndesc), M_DEVBUF, M_WAITOK);
+		memcpy(ndesc, hpckbd_keymapdata.keydesc, sz * sizeof(*ndesc));
+
+		hpckbd_keymapdata.keydesc = ndesc;
+	}
+
+	desc = hpckbd_keymapdata.keydesc;
 	for (i = 0; desc[i].name != 0; i++) {
 		if ((desc[i].name & KB_MACHDEP) && desc[i].map == NULL) {
-			desc[i].map = map;
-			desc[i].map_size = mapsize;
+			ndesc[i].map = map;
+			ndesc[i].map_size = mapsize;
 		}
 	}
 



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 08:19:22 UTC 2017

Modified Files:
src/sys/dev/wscons: wsmux.c

Log Message:
There is no longer a NWSBELL (since nothing depends on it), so there's no
need to #include wsbell.h (which is where it used to be defined, as a
result of a needs-flag in files.wscons).

Remove the #include


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/wscons/wsmux.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/wscons/wsmux.c
diff -u src/sys/dev/wscons/wsmux.c:1.62 src/sys/dev/wscons/wsmux.c:1.63
--- src/sys/dev/wscons/wsmux.c:1.62	Sun Jun 11 03:55:56 2017
+++ src/sys/dev/wscons/wsmux.c	Mon Jun 12 08:19:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsmux.c,v 1.62 2017/06/11 03:55:56 nat Exp $	*/
+/*	$NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.62 2017/06/11 03:55:56 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.63 2017/06/12 08:19:22 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -48,7 +48,6 @@ __KERNEL_RCSID(0, "$NetBSD: wsmux.c,v 1.
 #include "wsmux.h"
 #include "wskbd.h"
 #include "wsmouse.h"
-#include "wsbell.h"
 
 #include 
 #include 



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 07:12:49 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c

Log Message:
Revert previous - it's no longer needed since data structure sizes no
longer depend on which wscons child devices exist


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/wscons/wsbell.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/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.3 src/sys/dev/wscons/wsbell.c:1.4
--- src/sys/dev/wscons/wsbell.c:1.3	Mon Jun 12 06:59:19 2017
+++ src/sys/dev/wscons/wsbell.c	Mon Jun 12 07:12:49 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $ */
+/* $NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,11 +107,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.4 2017/06/12 07:12:49 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
-#include "wsdisplay.h"
 #endif
 
 #include 



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 07:10:07 UTC 2017

Modified Files:
src/sys/dev/wscons: wsmuxvar.h

Log Message:
Always include declarations/definitions for NWSMUX and NWSDISPLAY even
if they aren't needed.  This enables us to have structures of a fixed
size regardless of which child devices are configured, which enables
better modularization.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/wscons/wsmuxvar.h

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

Modified files:

Index: src/sys/dev/wscons/wsmuxvar.h
diff -u src/sys/dev/wscons/wsmuxvar.h:1.16 src/sys/dev/wscons/wsmuxvar.h:1.17
--- src/sys/dev/wscons/wsmuxvar.h:1.16	Sun Jun 11 03:55:56 2017
+++ src/sys/dev/wscons/wsmuxvar.h	Mon Jun 12 07:10:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: wsmuxvar.h,v 1.16 2017/06/11 03:55:56 nat Exp $	*/
+/*	$NetBSD: wsmuxvar.h,v 1.17 2017/06/12 07:10:07 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -37,13 +37,9 @@ struct wsevsrc {
 	const struct wssrcops *me_ops;	/* method pointers */
 	struct wseventvar me_evar;	/* wseventvar opened directly */
 	struct wseventvar *me_evp;	/* our wseventvar when open */
-#if NWSDISPLAY > 0
 	device_t me_dispdv;   /* our display if part of one */
-#endif
-#if NWSMUX > 0
 	struct wsmux_softc *me_parent;	/* parent mux device */
 	TAILQ_ENTRY(wsevsrc) me_next;	/* sibling pointers */
-#endif
 };
 
 /*
@@ -70,7 +66,6 @@ struct wssrcops {
 #define wsevsrc_set_display(me, arg) \
 	((me)->me_ops->dsetdisplay((me)->me_dv, arg))
 
-#if NWSMUX > 0
 struct wsmux_softc {
 	struct wsevsrc sc_base;
 	struct proc *sc_p;		/* open proc */
@@ -90,5 +85,3 @@ int	wsmux_set_display(struct wsmux_softc
 int	wskbd_add_mux(int, struct wsmux_softc *);
 int	wsmouse_add_mux(int, struct wsmux_softc *);
 int	wsbell_add_mux(int, struct wsmux_softc *);
-
-#endif /* NWSMUX > 0 */



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 07:06:45 UTC 2017

Modified Files:
src/sys/dev/wscons: files.wscons

Log Message:
Nothing needs the NWSBELL flag, so don't bother creating it


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/wscons/files.wscons

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/wscons/files.wscons
diff -u src/sys/dev/wscons/files.wscons:1.51 src/sys/dev/wscons/files.wscons:1.52
--- src/sys/dev/wscons/files.wscons:1.51	Sun Jun 11 03:55:56 2017
+++ src/sys/dev/wscons/files.wscons	Mon Jun 12 07:06:45 2017
@@ -1,4 +1,4 @@
-# $NetBSD: files.wscons,v 1.51 2017/06/11 03:55:56 nat Exp $
+# $NetBSD: files.wscons,v 1.52 2017/06/12 07:06:45 pgoyette Exp $
 
 #
 # "Workstation Console" glue; attaches frame buffer to emulator & keyboard,
@@ -60,7 +60,7 @@ file	dev/wscons/wsevent.c		wsdisplay | w
 file	dev/wscons/wskbd.c		wskbd			needs-flag
 file	dev/wscons/wskbdutil.c		wskbd			needs-flag
 file	dev/wscons/wsmouse.c		wsmouse			needs-flag
-file	dev/wscons/wsbell.c		wsbell			needs-flag
+file	dev/wscons/wsbell.c		wsbell
 
 # rcons bit-depth options
 include "dev/rcons/files.rcons"



CVS commit: src/sys/dev/wscons

2017-06-12 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jun 12 06:59:19 UTC 2017

Modified Files:
src/sys/dev/wscons: wsbell.c

Log Message:
For now, #include wsdisplay.h to get the definition of NWSDISPLAY

The symbol is currently used to conditionally include members of a
data structure, so without this include there could be different
structure definitions, with different sizes, and data corruption is
likely.

XXX For cleaner modularization, all of the needs-flag entries in
XXX wscons should be removed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/wscons/wsbell.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/wscons/wsbell.c
diff -u src/sys/dev/wscons/wsbell.c:1.2 src/sys/dev/wscons/wsbell.c:1.3
--- src/sys/dev/wscons/wsbell.c:1.2	Sun Jun 11 22:14:55 2017
+++ src/sys/dev/wscons/wsbell.c	Mon Jun 12 06:59:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $ */
+/* $NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2017 Nathanial Sloss 
@@ -107,10 +107,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.2 2017/06/11 22:14:55 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsbell.c,v 1.3 2017/06/12 06:59:19 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "wsmux.h"
+#include "wsdisplay.h"
 #endif
 
 #include