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

2019-06-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Jun 27 05:55:40 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: if_sriov.c ix_txrx.c ixgbe.c ixgbe.h ixgbe_api.c
ixgbe_api.h ixgbe_common.c ixgbe_common.h ixgbe_mbx.c ixgbe_mbx.h
ixgbe_netmap.c ixgbe_type.h

Log Message:
Sync with FreeBSD ix-3.3.8 part 1. No functional change in this part:
 - Move ixgbe_toggle_txdctl() to ixgbe_common.c and modify a bit.
   No functional change because this function is currently used for SR-IOV
   and it's not used in NetBSD.
 - Some modification to match the latest netmap API.
 - Modify ixgbe_hic_unlocked(). No functional change because neither
   IXGBE_HOST_INTERFACE_APPLY_UPDATE_CMD(0x38) nor
   IXGBE_HOST_INTERFACE_SHADOW_RAM_READ_CMD(0x31) are used.
 - Add ixgbe_clear_mbx(). No functional change because this function is not
   used yet.
 - Add some not-yet-used register definitions.
 - Whitespace fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/ixgbe/if_sriov.c
cvs rdiff -u -r1.52 -r1.53 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/ixgbe/ixgbe.h
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/pci/ixgbe/ixgbe_api.c \
src/sys/dev/pci/ixgbe/ixgbe_common.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/ixgbe/ixgbe_api.h
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/ixgbe/ixgbe_common.h \
src/sys/dev/pci/ixgbe/ixgbe_mbx.h
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/ixgbe/ixgbe_mbx.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/ixgbe/ixgbe_netmap.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/ixgbe/ixgbe_type.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/pci/ixgbe/if_sriov.c
diff -u src/sys/dev/pci/ixgbe/if_sriov.c:1.5 src/sys/dev/pci/ixgbe/if_sriov.c:1.6
--- src/sys/dev/pci/ixgbe/if_sriov.c:1.5	Thu Dec  6 13:25:02 2018
+++ src/sys/dev/pci/ixgbe/if_sriov.c	Thu Jun 27 05:55:40 2019
@@ -264,50 +264,6 @@ ixgbe_clear_vfmbmem(struct ixgbe_hw *hw,
 } /* ixgbe_clear_vfmbmem */
 
 
-static void
-ixgbe_toggle_txdctl(struct ixgbe_hw *hw, struct ixgbe_vf *vf)
-{
-	uint32_t vf_index, offset, reg;
-	uint8_t  queue_count, i;
-
-	IXGBE_CORE_LOCK_ASSERT(adapter);
-
-	vf_index = IXGBE_VF_INDEX(vf->pool);
-
-	/* Determine number of queues by checking
-	 * number of virtual functions */
-	reg = IXGBE_READ_REG(hw, IXGBE_GCR_EXT);
-	switch (reg & IXGBE_GCR_EXT_VT_MODE_MASK) {
-	case IXGBE_GCR_EXT_VT_MODE_64:
-		queue_count = 2;
-		break;
-	case IXGBE_GCR_EXT_VT_MODE_32:
-		queue_count = 4;
-		break;
-	default:
-		return;
-	}
-
-	/* Toggle queues */
-	for (i = 0; i < queue_count; ++i) {
-		/* Calculate offset of current queue */
-		offset = queue_count * vf_index + i;
-
-		/* Enable queue */
-		reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset));
-		reg |= IXGBE_TXDCTL_ENABLE;
-		IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg);
-		IXGBE_WRITE_FLUSH(hw);
-
-		/* Disable queue */
-		reg = IXGBE_READ_REG(hw, IXGBE_PVFTXDCTL(offset));
-		reg &= ~IXGBE_TXDCTL_ENABLE;
-		IXGBE_WRITE_REG(hw, IXGBE_PVFTXDCTL(offset), reg);
-		IXGBE_WRITE_FLUSH(hw);
-	}
-} /* ixgbe_toggle_txdctl */
-
-
 static boolean_t
 ixgbe_vf_frame_size_compatible(struct adapter *adapter, struct ixgbe_vf *vf)
 {
@@ -364,7 +320,7 @@ ixgbe_process_vf_reset(struct adapter *a
 
 	ixgbe_clear_rar(>hw, vf->rar_index);
 	ixgbe_clear_vfmbmem(>hw, vf);
-	ixgbe_toggle_txdctl(>hw, vf);
+	ixgbe_toggle_txdctl(>hw, IXGBE_VF_INDEX(vf->pool));
 
 	vf->api_ver = IXGBE_API_VER_UNKNOWN;
 } /* ixgbe_process_vf_reset */

Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.52 src/sys/dev/pci/ixgbe/ix_txrx.c:1.53
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.52	Fri Feb 22 06:49:15 2019
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Thu Jun 27 05:55:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.52 2019/02/22 06:49:15 msaitoh Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.53 2019/06/27 05:55:40 msaitoh Exp $ */
 
 /**
 
@@ -694,7 +694,7 @@ ixgbe_setup_transmit_ring(struct tx_ring
 		 * netmap_idx_n2k() handles wraparounds properly.
 		 */
 		if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) && slot) {
-			int si = netmap_idx_n2k(>tx_rings[txr->me], i);
+			int si = netmap_idx_n2k(na->tx_rings[txr->me], i);
 			netmap_load_map(na, txr->txtag,
 			txbuf->map, NMB(na, slot + si));
 		}
@@ -1105,7 +1105,7 @@ ixgbe_txeof(struct tx_ring *txr)
 	if ((adapter->feat_en & IXGBE_FEATURE_NETMAP) &&
 	(adapter->ifp->if_capenable & IFCAP_NETMAP)) {
 		struct netmap_adapter *na = NA(adapter->ifp);
-		struct netmap_kring *kring = >tx_rings[txr->me];
+		struct netmap_kring *kring = na->tx_rings[txr->me];
 		txd = txr->tx_base;
 		bus_dmamap_sync(txr->txdma.dma_tag, txr->txdma.dma_map,
 		BUS_DMASYNC_POSTREAD);
@@ -1123,9 +1123,8 @@ ixgbe_txeof(struct tx_ring *txr)
 		 * - the 

CVS commit: src/sys/compat/sys

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:44:54 UTC 2019

Modified Files:
src/sys/compat/sys: rnd.h

Log Message:
This actually needs the netbsd32 stuff present since the struct for the
32 bit syscall has a netbsd32_voidp... This header is used also for
compat/common, so just revert (helped us to fix a bug though :-)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/rnd.h

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



CVS commit: src/sys/compat/sys

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:44:54 UTC 2019

Modified Files:
src/sys/compat/sys: rnd.h

Log Message:
This actually needs the netbsd32 stuff present since the struct for the
32 bit syscall has a netbsd32_voidp... This header is used also for
compat/common, so just revert (helped us to fix a bug though :-)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/rnd.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/compat/sys/rnd.h
diff -u src/sys/compat/sys/rnd.h:1.6 src/sys/compat/sys/rnd.h:1.7
--- src/sys/compat/sys/rnd.h:1.6	Wed Jun 26 21:58:49 2019
+++ src/sys/compat/sys/rnd.h	Wed Jun 26 22:44:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd.h,v 1.6 2019/06/27 01:58:49 christos Exp $	*/
+/*	$NetBSD: rnd.h,v 1.7 2019/06/27 02:44:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997,2011 The NetBSD Foundation, Inc.
@@ -33,9 +33,18 @@
 #ifndef _COMPAT_SYS_RND_H_
 #define	_COMPAT_SYS_RND_H_
 
+#if defined(_KERNEL_OPT)
+#include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
+#endif
+
 #include 
 #include 
 
+#ifdef COMPAT_NETBSD32
+#include 
+#endif /* COMPAT_NETBSD32 */
+
 #include 
 
 /*
@@ -57,7 +66,7 @@ typedef struct {
 	void		*unused_state;	/* was: internal state */
 } rndsource50_t;
 
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
 typedef struct {
 	char		name[16];	/* device name */
 	uint32_t	unused_time;	/* was: last time recorded */
@@ -68,7 +77,7 @@ typedef struct {
 	uint32_t	flags;		/* flags */
 	netbsd32_voidp	unused_state;	/* was: internal state */
 } rndsource50_32_t;
-#endif /* _LP64 */
+#endif /* COMPAT_NETBSD32 */
 
 /*
  * NetBSD-5 defined RND_MAXSTATCOUNT as 10.  We define RND_MAXSTATCOUNT50
@@ -88,13 +97,13 @@ typedef struct {
 	rndsource50_t source[RND_MAXSTATCOUNT50];
 } rndstat50_t;
 
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
 typedef struct {
 	uint32_t	start;
 	uint32_t	count;
 	rndsource50_32_t source[RND_MAXSTATCOUNT50];
 } rndstat50_32_t;
-#endif /* _LP64 */
+#endif /* COMPAT_NETBSD32 */
 
 /*
  * return information on a specific source by name
@@ -104,12 +113,12 @@ typedef struct {
 	rndsource50_t source;
 } rndstat_name50_t;
 
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
 typedef struct {
 	char		name[16];
 	rndsource50_32_t source;
 } rndstat_name50_32_t;
-#endif /* _LP64 */
+#endif /* COMPAT_NETBSD32 */
 
 /*
  * NetBSD-5 defined RND_POOLWORDS as 128.  In NetBSD-6, the value
@@ -134,9 +143,9 @@ int compat32_50_rnd_ioctl(struct file *,
 #define	RNDGETSRCNUM50		_IOWR('R', 102, rndstat50_t)
 #define	RNDGETSRCNAME50		_IOWR('R', 103, rndstat_name50_t)
 
-#ifdef _LP64
+#ifdef COMPAT_NETBSD32
 #define	RNDGETSRCNUM50_32	_IOWR('R', 102, rndstat50_32_t)
 #define	RNDGETSRCNAME50_32	_IOWR('R', 103, rndstat_name50_32_t)
-#endif
+#endif /* COMPAT_NETBSD32 */
 
 #endif /* !_COMPAT_SYS_RND_H_ */



CVS commit: src/sys/compat/netbsd32

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:36:27 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_rndpseudo_50.c

Log Message:
Include the right stuff so compat_netbsd32_50 compiles.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.38 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.39
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.38	Tue Jun 18 18:34:25 2019
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Wed Jun 26 22:36:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.38 2019/06/18 22:34:25 kamil Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,10 +36,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.38 2019/06/18 22:34:25 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
+#include "opt_compat_netbsd32.h"
 #include "opt_ntp.h"
 #include "opt_quota.h"
 #endif

Index: src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c
diff -u src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.2 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.3
--- src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c:1.2	Sat Jan 26 21:08:40 2019
+++ src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c	Wed Jun 26 22:36:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_rndpseudo_50.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_rndpseudo_50.c,v 1.3 2019/06/27 02:36:27 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_rndpseudo_50.c,v 1.2 2019/01/27 02:08:40 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_rndpseudo_50.c,v 1.3 2019/06/27 02:36:27 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_rnd
 #include 
 
 #include 
+
+#include 
 #include 
 
 /*



CVS commit: src/sys/compat/netbsd32

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:36:27 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_rndpseudo_50.c

Log Message:
Include the right stuff so compat_netbsd32_50 compiles.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_rndpseudo_50.c

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



CVS commit: src/sys/arch/amd64/amd64

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:00:31 UTC 2019

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

Log Message:
Although this is correct, I will let maxv commit it. Still waiting.


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 src/sys/arch/amd64/amd64/machdep.c

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



CVS commit: src/sys/arch/amd64/amd64

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 02:00:31 UTC 2019

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

Log Message:
Although this is correct, I will let maxv commit it. Still waiting.


To generate a diff of this commit:
cvs rdiff -u -r1.333 -r1.334 src/sys/arch/amd64/amd64/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/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.333 src/sys/arch/amd64/amd64/machdep.c:1.334
--- src/sys/arch/amd64/amd64/machdep.c:1.333	Wed Jun 26 21:59:30 2019
+++ src/sys/arch/amd64/amd64/machdep.c	Wed Jun 26 22:00:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.333 2019/06/27 01:59:30 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.334 2019/06/27 02:00:30 christos Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.333 2019/06/27 01:59:30 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.334 2019/06/27 02:00:30 christos Exp $");
 
 #include "opt_modular.h"
 #include "opt_user_ldt.h"
@@ -2095,50 +2095,44 @@ cpu_setmcontext(struct lwp *l, const mco
 int
 cpu_mcontext_validate(struct lwp *l, const mcontext_t *mcp)
 {
-	struct proc *p = l->l_proc;
+	struct proc *p __diagused = l->l_proc;
 	struct trapframe *tf = l->l_md.md_regs;
 	const __greg_t *gr;
 	uint16_t sel;
-	const bool pk32 = (p->p_flag & PK_32) != 0;
 
+	KASSERT((p->p_flag & PK_32) == 0);
 	gr = mcp->__gregs;
 
 	if (((gr[_REG_RFLAGS] ^ tf->tf_rflags) & PSL_USERSTATIC) != 0)
 		return EINVAL;
-#define VUD(sel) (pk32 ? VALID_USER_DSEL32(sel) : VALID_USER_DSEL(sel))
-#define VUF(sel) (pk32 ? (VALID_USER_DSEL32(sel) || VALID_USER_FSEL32(sel)) \
-: VALID_USER_DSEL(sel))
-#define VUG(sel) (pk32 ? (VALID_USER_DSEL32(sel) || VALID_USER_GSEL32(sel)) \
-: VALID_USER_DSEL(sel))
-#define VUC(sel) (pk32 ? VALID_USER_CSEL32(sel) : VALID_USER_CSEL(sel))
 
 	sel = gr[_REG_ES] & 0x;
-	if (sel != 0 && !VUD(sel))
+	if (sel != 0 && !VALID_USER_DSEL(sel))
 		return EINVAL;
 
 	sel = gr[_REG_FS] & 0x;
-	if (sel != 0 && !VUF(sel))
+	if (sel != 0 && !VALID_USER_DSEL(sel))
 		return EINVAL;
 
 	sel = gr[_REG_GS] & 0x;
-	if (sel != 0 && !VUG(sel))
+	if (sel != 0 && !VALID_USER_DSEL(sel))
 		return EINVAL;
 
 	sel = gr[_REG_DS] & 0x;
-	if (!VUD(sel))
+	if (!VALID_USER_DSEL(sel))
 		return EINVAL;
 
 #ifndef XENPV
 	sel = gr[_REG_SS] & 0x;
-	if (!VUD(sel))
+	if (!VALID_USER_DSEL(sel))
 		return EINVAL;
 
 	sel = gr[_REG_CS] & 0x;
-	if (!VUC(sel))
+	if (!VALID_USER_CSEL(sel))
 		return EINVAL;
 #endif
 
-	if (gr[_REG_RIP] >= (pk32 ? VM_MAXUSER_ADDRESS32 : VM_MAXUSER_ADDRESS))
+	if (gr[_REG_RIP] >= VM_MAXUSER_ADDRESS)
 		return EINVAL;
 
 	return 0;



CVS commit: src/sys/arch/amd64/amd64

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 01:59:30 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: machdep.c process_machdep.c

Log Message:
don't cast void *


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/amd64/amd64/process_machdep.c

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



CVS commit: src/sys/compat/sys

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 01:58:49 UTC 2019

Modified Files:
src/sys/compat/sys: rnd.h siginfo.h sigtypes.h ttycom.h ucontext.h

Log Message:
Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/rnd.h \
src/sys/compat/sys/siginfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/sys/sigtypes.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/ttycom.h
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/ucontext.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/compat/sys/rnd.h
diff -u src/sys/compat/sys/rnd.h:1.5 src/sys/compat/sys/rnd.h:1.6
--- src/sys/compat/sys/rnd.h:1.5	Sat Jan 26 21:08:41 2019
+++ src/sys/compat/sys/rnd.h	Wed Jun 26 21:58:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rnd.h,v 1.5 2019/01/27 02:08:41 pgoyette Exp $	*/
+/*	$NetBSD: rnd.h,v 1.6 2019/06/27 01:58:49 christos Exp $	*/
 
 /*-
  * Copyright (c) 1997,2011 The NetBSD Foundation, Inc.
@@ -33,18 +33,9 @@
 #ifndef _COMPAT_SYS_RND_H_
 #define	_COMPAT_SYS_RND_H_
 
-#if defined(_KERNEL_OPT)
-#include "opt_compat_netbsd.h"
-#include "opt_compat_netbsd32.h"
-#endif
-
 #include 
 #include 
 
-#ifdef COMPAT_NETBSD32
-#include 
-#endif /* COMPAT_NETBSD32 */
-
 #include 
 
 /*
@@ -66,7 +57,7 @@ typedef struct {
 	void		*unused_state;	/* was: internal state */
 } rndsource50_t;
 
-#ifdef COMPAT_NETBSD32
+#ifdef _LP64
 typedef struct {
 	char		name[16];	/* device name */
 	uint32_t	unused_time;	/* was: last time recorded */
@@ -77,7 +68,7 @@ typedef struct {
 	uint32_t	flags;		/* flags */
 	netbsd32_voidp	unused_state;	/* was: internal state */
 } rndsource50_32_t;
-#endif /* COMPAT_NETBSD32 */
+#endif /* _LP64 */
 
 /*
  * NetBSD-5 defined RND_MAXSTATCOUNT as 10.  We define RND_MAXSTATCOUNT50
@@ -97,13 +88,13 @@ typedef struct {
 	rndsource50_t source[RND_MAXSTATCOUNT50];
 } rndstat50_t;
 
-#ifdef COMPAT_NETBSD32
+#ifdef _LP64
 typedef struct {
 	uint32_t	start;
 	uint32_t	count;
 	rndsource50_32_t source[RND_MAXSTATCOUNT50];
 } rndstat50_32_t;
-#endif /* COMPAT_NETBSD32 */
+#endif /* _LP64 */
 
 /*
  * return information on a specific source by name
@@ -113,12 +104,12 @@ typedef struct {
 	rndsource50_t source;
 } rndstat_name50_t;
 
-#ifdef COMPAT_NETBSD32
+#ifdef _LP64
 typedef struct {
 	char		name[16];
 	rndsource50_32_t source;
 } rndstat_name50_32_t;
-#endif /* COMPAT_NETBSD32 */
+#endif /* _LP64 */
 
 /*
  * NetBSD-5 defined RND_POOLWORDS as 128.  In NetBSD-6, the value
@@ -143,9 +134,9 @@ int compat32_50_rnd_ioctl(struct file *,
 #define	RNDGETSRCNUM50		_IOWR('R', 102, rndstat50_t)
 #define	RNDGETSRCNAME50		_IOWR('R', 103, rndstat_name50_t)
 
-#ifdef COMPAT_NETBSD32
+#ifdef _LP64
 #define	RNDGETSRCNUM50_32	_IOWR('R', 102, rndstat50_32_t)
 #define	RNDGETSRCNAME50_32	_IOWR('R', 103, rndstat_name50_32_t)
-#endif /* COMPAT_NETBSD32 */
+#endif
 
 #endif /* !_COMPAT_SYS_RND_H_ */
Index: src/sys/compat/sys/siginfo.h
diff -u src/sys/compat/sys/siginfo.h:1.5 src/sys/compat/sys/siginfo.h:1.6
--- src/sys/compat/sys/siginfo.h:1.5	Wed Jun 19 12:14:07 2019
+++ src/sys/compat/sys/siginfo.h	Wed Jun 26 21:58:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: siginfo.h,v 1.5 2019/06/19 16:14:07 maya Exp $	 */
+/*	$NetBSD: siginfo.h,v 1.6 2019/06/27 01:58:49 christos Exp $	 */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,11 +32,7 @@
 #ifndef	_COMPAT_SYS_SIGINFO_H_
 #define	_COMPAT_SYS_SIGINFO_H_
 
-#if defined(_KERNEL_OPT)
-#include "opt_compat_netbsd32.h"
-#endif
-
-#if defined(COMPAT_NETBSD32) && defined(_KERNEL)
+#if defined(_LP64) && defined(_KERNEL)
 
 typedef union sigval32 {
 	int sival_int;
@@ -87,6 +83,6 @@ typedef union siginfo32 {
 	struct __ksiginfo32 _info;
 } siginfo32_t;
 
-#endif /* COMPAT_NETBSD32 && _KERNEL */
+#endif /* _LP64 && _KERNEL */
 
 #endif /* !_COMPAT_SYS_SIGINFO_H_ */

Index: src/sys/compat/sys/sigtypes.h
diff -u src/sys/compat/sys/sigtypes.h:1.2 src/sys/compat/sys/sigtypes.h:1.3
--- src/sys/compat/sys/sigtypes.h:1.2	Sun Dec 11 07:20:29 2005
+++ src/sys/compat/sys/sigtypes.h	Wed Jun 26 21:58:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sigtypes.h,v 1.2 2005/12/11 12:20:29 christos Exp $	*/
+/*	$NetBSD: sigtypes.h,v 1.3 2019/06/27 01:58:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -39,10 +39,6 @@
 #ifndef	_COMPAT_SYS_SIGTYPES_H_
 #define	_COMPAT_SYS_SIGTYPES_H_
 
-#if defined(_KERNEL_OPT)
-#include "opt_compat_netbsd32.h"
-#endif
-
 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
 defined(_NETBSD_SOURCE)
 
@@ -67,7 +63,7 @@ struct sigaltstack13 {
 
 #endif	/* _POSIX_C_SOURCE || _XOPEN_SOURCE || ... */
 
-#if 

CVS commit: src/sys/compat/sys

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jun 27 01:58:49 UTC 2019

Modified Files:
src/sys/compat/sys: rnd.h siginfo.h sigtypes.h ttycom.h ucontext.h

Log Message:
Always include the 32 bit structure and definitions on _LP64 regardless
of compat32 being on or off, because we want the headers to work when
compiling modular kernels. Of course the 32 bit structs do not make sense
on platforms that don't have 32 bit modes (alpha), but we don't have
a define for that and it does not hurt.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/compat/sys/rnd.h \
src/sys/compat/sys/siginfo.h
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/sys/sigtypes.h
cvs rdiff -u -r1.4 -r1.5 src/sys/compat/sys/ttycom.h
cvs rdiff -u -r1.6 -r1.7 src/sys/compat/sys/ucontext.h

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



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

2019-06-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun 26 23:10:42 UTC 2019

Modified Files:
src/sys/arch/arm/cortex: gicv3.h

Log Message:
Remove unused field


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/gicv3.h

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



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

2019-06-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun 26 23:10:42 UTC 2019

Modified Files:
src/sys/arch/arm/cortex: gicv3.h

Log Message:
Remove unused field


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/cortex/gicv3.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/arch/arm/cortex/gicv3.h
diff -u src/sys/arch/arm/cortex/gicv3.h:1.5 src/sys/arch/arm/cortex/gicv3.h:1.6
--- src/sys/arch/arm/cortex/gicv3.h:1.5	Mon Jun 17 10:15:08 2019
+++ src/sys/arch/arm/cortex/gicv3.h	Wed Jun 26 23:10:42 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.h,v 1.5 2019/06/17 10:15:08 jmcneill Exp $ */
+/* $NetBSD: gicv3.h,v 1.6 2019/06/26 23:10:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -60,9 +60,6 @@ struct gicv3_softc {
 	bus_space_handle_t	*sc_bsh_r;	/* GICR */
 	u_int			sc_bsh_r_count;
 
-	u_int			sc_flags;
-#define	GICV3_F_SECURE		0x01
-
 	u_int			sc_priority_shift;
 	u_int			sc_pmr_shift;
 



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

2019-06-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun 26 23:00:10 UTC 2019

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

Log Message:
Change how we detect secure vs non-secure access.

Write 0xff to ICC_PMR_EL1 and read back how many bits are implemented,
then do the same with a GICD_IPRIORITYR priority value field.

If the values differ, assume we have a shifted view of IPRIORITYR.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/cortex/gicv3.c

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



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

2019-06-26 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jun 26 23:00:10 UTC 2019

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

Log Message:
Change how we detect secure vs non-secure access.

Write 0xff to ICC_PMR_EL1 and read back how many bits are implemented,
then do the same with a GICD_IPRIORITYR priority value field.

If the values differ, assume we have a shifted view of IPRIORITYR.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/cortex/gicv3.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.c
diff -u src/sys/arch/arm/cortex/gicv3.c:1.18 src/sys/arch/arm/cortex/gicv3.c:1.19
--- src/sys/arch/arm/cortex/gicv3.c:1.18	Mon Jun 17 10:15:08 2019
+++ src/sys/arch/arm/cortex/gicv3.c	Wed Jun 26 23:00:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3.c,v 1.18 2019/06/17 10:15:08 jmcneill Exp $ */
+/* $NetBSD: gicv3.c,v 1.19 2019/06/26 23:00:09 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.18 2019/06/17 10:15:08 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3.c,v 1.19 2019/06/26 23:00:09 jmcneill Exp $");
 
 #include 
 #include 
@@ -249,9 +249,7 @@ gicv3_dist_enable(struct gicv3_softc *sc
 		;
 
 	/* Enable Affinity routing and G1NS interrupts */
-	gicd_ctrl = GICD_CTRL_EnableGrp1A | GICD_CTRL_Enable | GICD_CTRL_ARE_NS;
-	if (ISSET(sc->sc_flags, GICV3_F_SECURE))
-		gicd_ctrl = (gicd_ctrl & ~GICD_CTRL_EnableGrp1A) << 1;
+	gicd_ctrl = GICD_CTRL_EnableGrp1A | GICD_CTRL_ARE_NS;
 	gicd_write_4(sc, GICD_CTRL, gicd_ctrl);
 }
 
@@ -713,6 +711,28 @@ gicv3_irq_handler(void *frame)
 		pic_set_priority(ci, oldipl);
 }
 
+static int
+gicv3_detect_pmr_bits(struct gicv3_softc *sc)
+{
+	const uint32_t opmr = icc_pmr_read();
+	icc_pmr_write(0xff);
+	const uint32_t npmr = icc_pmr_read();
+	icc_pmr_write(opmr);
+
+	return NBBY - (ffs(npmr) - 1);
+}
+
+static int
+gicv3_detect_ipriority_bits(struct gicv3_softc *sc)
+{
+	const uint32_t oipriorityr = gicd_read_4(sc, GICD_IPRIORITYRn(8));
+	gicd_write_4(sc, GICD_IPRIORITYRn(8), oipriorityr | 0xff);
+	const uint32_t nipriorityr = gicd_read_4(sc, GICD_IPRIORITYRn(8));
+	gicd_write_4(sc, GICD_IPRIORITYRn(8), oipriorityr);
+
+	return NBBY - (ffs(nipriorityr & 0xff) - 1);
+}
+
 int
 gicv3_init(struct gicv3_softc *sc)
 {
@@ -728,27 +748,21 @@ gicv3_init(struct gicv3_softc *sc)
 		sc->sc_irouter[n] = UINT64_MAX;
 
 	sc->sc_priority_shift = 4;
-	const uint32_t oldnsacr = gicd_read_4(sc, GICD_NSACRn(2));
-	gicd_write_4(sc, GICD_NSACRn(2), oldnsacr ^ 0x);
-	if (gicd_read_4(sc, GICD_NSACRn(2)) != oldnsacr) {
-		gicd_write_4(sc, GICD_NSACRn(2), oldnsacr);
-		sc->sc_priority_shift--;
-		SET(sc->sc_flags, GICV3_F_SECURE);
-	}
-	aprint_verbose_dev(sc->sc_dev, "access is %ssecure\n",
-	ISSET(sc->sc_flags, GICV3_F_SECURE) ? "" : "in");
-
 	sc->sc_pmr_shift = 4;
+
 	if ((gicd_ctrl & GICD_CTRL_DS) == 0) {
-		const uint32_t icc_ctlr = icc_ctlr_read();
-		const u_int nbits = __SHIFTOUT(icc_ctlr, ICC_CTLR_EL1_PRIbits) + 1;
-		const u_int oldpmr = icc_pmr_read();
-		icc_pmr_write(0xff);
-		const u_int pmr = icc_pmr_read();
-		icc_pmr_write(oldpmr);
-		if (nbits == 8 - (ffs(pmr) - 1))
-			sc->sc_pmr_shift--;
+		const int pmr_bits = gicv3_detect_pmr_bits(sc);
+		const int ipriority_bits = gicv3_detect_ipriority_bits(sc);
+
+		if (ipriority_bits != pmr_bits)
+			--sc->sc_priority_shift;
+
+		aprint_verbose_dev(sc->sc_dev, "%d pmr bits, %d ipriority bits\n",
+		pmr_bits, ipriority_bits);
+	} else {
+		aprint_verbose_dev(sc->sc_dev, "security disabled\n");
 	}
+
 	aprint_verbose_dev(sc->sc_dev, "priority shift %d, pmr shift %d\n",
 	sc->sc_priority_shift, sc->sc_pmr_shift);
 



CVS commit: src/sys/dev/usb

2019-06-26 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Jun 26 22:58:59 UTC 2019

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

Log Message:
Fix typos

Some were found by OpenBSD.


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

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



CVS commit: src/sys/dev/usb

2019-06-26 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Jun 26 22:58:59 UTC 2019

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

Log Message:
Fix typos

Some were found by OpenBSD.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.8 src/sys/dev/usb/if_umb.c:1.9
--- src/sys/dev/usb/if_umb.c:1.8	Sun Jan 27 02:08:42 2019
+++ src/sys/dev/usb/if_umb.c	Wed Jun 26 22:58:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $ */
+/*	$NetBSD: if_umb.c,v 1.9 2019/06/26 22:58:58 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.8 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.9 2019/06/26 22:58:58 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1243,7 +1243,7 @@ umb_decode_response(struct umb_softc *sc
 		umb_command_done(sc, response, len);
 		break;
 	default:
-		DPRINTF("%s: discard messsage %s\n", DEVNAM(sc),
+		DPRINTF("%s: discard message %s\n", DEVNAM(sc),
 		umb_request2str(type));
 		break;
 	}
@@ -1257,19 +1257,19 @@ umb_handle_indicate_status_msg(struct um
 	uint32_t cid;
 
 	if (len < sizeof(*m)) {
-		DPRINTF("%s: discard short %s messsage\n", DEVNAM(sc),
+		DPRINTF("%s: discard short %s message\n", DEVNAM(sc),
 		umb_request2str(le32toh(m->hdr.type)));
 		return;
 	}
 	if (memcmp(m->devid, umb_uuid_basic_connect, sizeof(m->devid))) {
-		DPRINTF("%s: discard %s messsage for other UUID '%s'\n",
+		DPRINTF("%s: discard %s message for other UUID '%s'\n",
 		DEVNAM(sc), umb_request2str(le32toh(m->hdr.type)),
 		umb_uuid2str(m->devid));
 		return;
 	}
 	infolen = le32toh(m->infolen);
 	if (len < sizeof(*m) + infolen) {
-		DPRINTF("%s: discard truncated %s messsage (want %d, got %d)\n",
+		DPRINTF("%s: discard truncated %s message (want %d, got %d)\n",
 		DEVNAM(sc), umb_request2str(le32toh(m->hdr.type)),
 		(int)sizeof(*m) + infolen, len);
 		return;
@@ -1703,7 +1703,7 @@ umb_decode_ip_configuration(struct umb_s
 	s = splnet();
 
 	/*
-	 * IPv4 configuation
+	 * IPv4 configuration
 	 */
 	avail = le32toh(ic->ipv4_available);
 	if (avail & MBIM_IPCONF_HAS_ADDRINFO) {
@@ -2381,7 +2381,7 @@ umb_command_done(struct umb_softc *sc, v
 	int	 qmimsg = 0;
 
 	if (len < sizeof(*cmd)) {
-		DPRINTF("%s: discard short %s messsage\n", DEVNAM(sc),
+		DPRINTF("%s: discard short %s message\n", DEVNAM(sc),
 		umb_request2str(le32toh(cmd->hdr.type)));
 		return;
 	}
@@ -2389,7 +2389,7 @@ umb_command_done(struct umb_softc *sc, v
 	if (memcmp(cmd->devid, umb_uuid_basic_connect, sizeof(cmd->devid))) {
 		if (memcmp(cmd->devid, umb_uuid_qmi_mbim,
 		sizeof(cmd->devid))) {
-			DPRINTF("%s: discard %s messsage for other UUID '%s'\n",
+			DPRINTF("%s: discard %s message for other UUID '%s'\n",
 			DEVNAM(sc), umb_request2str(le32toh(cmd->hdr.type)),
 			umb_uuid2str(cmd->devid));
 			return;
@@ -2418,7 +2418,7 @@ umb_command_done(struct umb_softc *sc, v
 
 	infolen = le32toh(cmd->infolen);
 	if (len < sizeof(*cmd) + infolen) {
-		DPRINTF("%s: discard truncated %s messsage (want %d, got %d)\n",
+		DPRINTF("%s: discard truncated %s message (want %d, got %d)\n",
 		DEVNAM(sc), umb_cid2str(cid),
 		(int)sizeof(*cmd) + infolen, len);
 		return;
@@ -2639,7 +2639,7 @@ umb_intr(struct usbd_xfer *xfer, void *p
 		DEVNAM(sc));
 		break;
 	default:
-		DPRINTF("%s: unexpected notifiation (0x%02x)\n",
+		DPRINTF("%s: unexpected notification (0x%02x)\n",
 		DEVNAM(sc), sc->sc_intr_msg.bNotification);
 		break;
 	}



Re: CVS commit: src/sys/kern

2019-06-26 Thread Kamil Rytarowski
On 26.06.2019 23:21, Christos Zoulas wrote:
> In article <20190626202859.b5ccef...@cvs.netbsd.org>,
> Maxime Villard  wrote:
>> -=-=-=-=-=-
>>
>> Module Name: src
>> Committed By:maxv
>> Date:Wed Jun 26 20:28:59 UTC 2019
>>
>> Modified Files:
>>  src/sys/kern: kern_exec.c
>>
>> Log Message:
>> Remove useless debugging messages which achieved nothing but hiding bugs.
> 
> I apologize for adding debugging code that made the code too complicated
> for you to understand and caused you to wrongly accuse me for forgetting
> to handle another error condition. Fortunately, you saw fit to remove this
> debugging code as you have done in the past. Eventually there will be no
> debugging code in the tree, because the code will be bug free and "obvious".
> 
> christos
> 

I have no opinion on debug messages, but could we implement fexecve()
please, as we keep patching these code paths now?

We have got already a reserved syscall and ATF tests in tree.



signature.asc
Description: OpenPGP digital signature


CVS commit: src/tests/lib/libcurses

2019-06-26 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 26 22:18:44 UTC 2019

Modified Files:
src/tests/lib/libcurses: t_curses.sh

Log Message:
Enable beep test, return is correct.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/t_curses.sh

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



CVS commit: src/tests/lib/libcurses

2019-06-26 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Wed Jun 26 22:18:44 UTC 2019

Modified Files:
src/tests/lib/libcurses: t_curses.sh

Log Message:
Enable beep test, return is correct.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/libcurses/t_curses.sh

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

Modified files:

Index: src/tests/lib/libcurses/t_curses.sh
diff -u src/tests/lib/libcurses/t_curses.sh:1.14 src/tests/lib/libcurses/t_curses.sh:1.15
--- src/tests/lib/libcurses/t_curses.sh:1.14	Tue Jun 25 22:19:29 2019
+++ src/tests/lib/libcurses/t_curses.sh	Wed Jun 26 22:18:44 2019
@@ -754,7 +754,7 @@ atf_init_test_cases()
 	atf_add_test_case can_change_color
 	atf_add_test_case assume_default_colors
 	atf_add_test_case attributes
-#	atf_add_test_case beep  # comment out for now - return is wrong
+	atf_add_test_case beep
 	atf_add_test_case background
 	atf_add_test_case cbreak
 	atf_add_test_case chgat



CVS commit: src/sys/arch/sandpoint/stand/altboot

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 22:04:12 UTC 2019

Modified Files:
src/sys/arch/sandpoint/stand/altboot: main.c

Log Message:
make this compile again


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sandpoint/stand/altboot/main.c

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



Re: CVS commit: src/sys/kern

2019-06-26 Thread Christos Zoulas
In article <20190626202859.b5ccef...@cvs.netbsd.org>,
Maxime Villard  wrote:
>-=-=-=-=-=-
>
>Module Name:   src
>Committed By:  maxv
>Date:  Wed Jun 26 20:28:59 UTC 2019
>
>Modified Files:
>   src/sys/kern: kern_exec.c
>
>Log Message:
>Remove useless debugging messages which achieved nothing but hiding bugs.

I apologize for adding debugging code that made the code too complicated
for you to understand and caused you to wrongly accuse me for forgetting
to handle another error condition. Fortunately, you saw fit to remove this
debugging code as you have done in the past. Eventually there will be no
debugging code in the tree, because the code will be bug free and "obvious".

christos



re: CVS commit: src/sys/kern

2019-06-26 Thread matthew green
"Maxime Villard" writes:
> Module Name:  src
> Committed By: maxv
> Date: Wed Jun 26 20:28:59 UTC 2019
> 
> Modified Files:
>   src/sys/kern: kern_exec.c
> 
> Log Message:
> Remove useless debugging messages which achieved nothing but hiding bugs.

considering the author of these changes just was in this
code, why did you go against policy and simply revert
their changes instead of opening a discussion?

please un-revert and start a discussion.

what you think of as "useless" here is debateable.

thanks.


.mrg.


Re: CVS commit: src/sys/kern

2019-06-26 Thread Christos Zoulas
On Jun 26, 10:30pm, m...@m00nbsd.net (Maxime Villard) wrote:
-- Subject: Re: CVS commit: src/sys/kern

| Le 25/06/2019 à 23:32, Christos Zoulas a écrit :
| > Module Name:src
| > Committed By:   christos
| > Date:   Tue Jun 25 21:32:58 UTC 2019
| > 
| > Modified Files:
| > src/sys/kern: kern_exec.c
| > 
| > Log Message:
| > Fail if getcwd fails. Pointed out by maxv@
| > 
| > 
| > To generate a diff of this commit:
| > cvs rdiff -u -r1.471 -r1.472 src/sys/kern/kern_exec.c
| > 
| > Please note that diffs are not public domain; they are subject to the
| > copyright notices on the relevant files.
| 
| You still left one error condition unhandled. Is this intentional, or did
| you just forget that one too?

I don't see it.

christos


Re: CVS commit: src/sys/kern

2019-06-26 Thread Maxime Villard

Le 25/06/2019 à 23:32, Christos Zoulas a écrit :

Module Name:src
Committed By:   christos
Date:   Tue Jun 25 21:32:58 UTC 2019

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

Log Message:
Fail if getcwd fails. Pointed out by maxv@


To generate a diff of this commit:
cvs rdiff -u -r1.471 -r1.472 src/sys/kern/kern_exec.c

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


You still left one error condition unhandled. Is this intentional, or did
you just forget that one too?


CVS commit: src/sys/kern

2019-06-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jun 26 20:28:59 UTC 2019

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

Log Message:
Remove useless debugging messages which achieved nothing but hiding bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.473 -r1.474 src/sys/kern/kern_exec.c

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

Modified files:

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.473 src/sys/kern/kern_exec.c:1.474
--- src/sys/kern/kern_exec.c:1.473	Wed Jun 26 00:30:39 2019
+++ src/sys/kern/kern_exec.c	Wed Jun 26 20:28:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.473 2019/06/26 00:30:39 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.474 2019/06/26 20:28:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.473 2019/06/26 00:30:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.474 2019/06/26 20:28:59 maxv Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -629,10 +629,8 @@ exec_makepathbuf(struct lwp *l, const ch
 	} else {
 		error = copyinstr(upath, path, MAXPATHLEN, );
 	}
-	if (error) {
-		DPRINTF(("%s: copyin path @%p %d\n", __func__, upath, error));
+	if (error)
 		goto err;
-	}
 
 	if (path[0] == '/') {
 		if (offs)
@@ -653,11 +651,8 @@ exec_makepathbuf(struct lwp *l, const ch
 	GETCWD_CHECK_ACCESS, l);
 	rw_exit(>cwdi_lock);
 
-	if (error) {
-		DPRINTF(("%s: getcwd_common path %s %d\n", __func__, path,
-		error));
+	if (error)
 		goto err;
-	}
 	tlen = path + MAXPATHLEN - bp;
 
 	memmove(path, bp, tlen);



CVS commit: src/sys/kern

2019-06-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Wed Jun 26 20:28:59 UTC 2019

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

Log Message:
Remove useless debugging messages which achieved nothing but hiding bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.473 -r1.474 src/sys/kern/kern_exec.c

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



CVS commit: src/doc

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:50:22 UTC 2019

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-7.2.3


To generate a diff of this commit:
cvs rdiff -u -r1.1630 -r1.1631 src/doc/3RDPARTY
cvs rdiff -u -r1.2549 -r1.2550 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1630 src/doc/3RDPARTY:1.1631
--- src/doc/3RDPARTY:1.1630	Sat Jun 22 22:49:18 2019
+++ src/doc/3RDPARTY	Wed Jun 26 17:50:22 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1630 2019/06/22 22:49:18 sevan Exp $
+#	$NetBSD: 3RDPARTY,v 1.1631 2019/06/26 17:50:22 roy Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	7.2.2
-Current Vers:	7.2.2
+Version:	7.2.3
+Current Vers:	7.2.3
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2019-04-26
+Date:		2019-06-26
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2549 src/doc/CHANGES:1.2550
--- src/doc/CHANGES:1.2549	Tue Jun 25 05:04:35 2019
+++ src/doc/CHANGES	Wed Jun 26 17:50:22 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2549 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2550 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -395,3 +395,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	OpenSSL: Imported 1.1.1c. [christos 20190609]
 	gpt(8): added uuid subcommand to generate new UUIDS.
 		[jnemeth 20190624]
+	dhcpcd(8): Import dhcpcd-7.2.3 [roy 20190626]



CVS commit: src/doc

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:50:22 UTC 2019

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note import of dhcpcd-7.2.3


To generate a diff of this commit:
cvs rdiff -u -r1.1630 -r1.1631 src/doc/3RDPARTY
cvs rdiff -u -r1.2549 -r1.2550 src/doc/CHANGES

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/dist

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:47:47 UTC 2019

Modified Files:
src/external/bsd/dhcpcd/dist/hooks: 30-hostname
src/external/bsd/dhcpcd/dist/src: dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/30-hostname
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c \
src/external/bsd/dhcpcd/dist/src/if-bsd.c
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.c

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

Modified files:

Index: src/external/bsd/dhcpcd/dist/hooks/30-hostname
diff -u src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.2 src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.3
--- src/external/bsd/dhcpcd/dist/hooks/30-hostname:1.2	Sat Sep 22 13:17:46 2018
+++ src/external/bsd/dhcpcd/dist/hooks/30-hostname	Wed Jun 26 17:47:47 2019
@@ -80,7 +80,7 @@ need_hostname()
 	set_hostname_vars
 
 	if [ -n "$old_fqdn" ]; then
-		if ${hfqdn} || ! ${hsort}; then
+		if ${hfqdn} || ! ${hshort}; then
 			[ "$hostname" = "$old_fqdn" ]
 		else
 			[ "$hostname" = "${old_fqdn%%.*}" ]

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.7 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.8
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.7	Sat May  4 09:42:15 2019
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Wed Jun 26 17:47:47 2019
@@ -3783,6 +3783,8 @@ dhcp6_start(struct interface *ifp, enum 
 			/* No DHCPv6 config, no existing state
 			 * so nothing to do. */
 			return 0;
+		case DH6S_INFORM:
+			break;
 		default:
 			init_state = DH6S_INIT;
 			break;
@@ -3935,21 +3937,6 @@ dhcp6_free(struct interface *ifp)
 }
 
 void
-dhcp6_dropnondelegates(struct interface *ifp)
-{
-
-#ifndef SMALL
-	if (dhcp6_hasprefixdelegation(ifp))
-		return;
-#endif
-	if (D6_CSTATE(ifp) == NULL)
-		return;
-
-	loginfox("%s: dropping DHCPv6 due to no valid routers", ifp->name);
-	dhcp6_drop(ifp, "EXPIRE6");
-}
-
-void
 dhcp6_abort(struct interface *ifp)
 {
 	struct dhcp6_state *state;
Index: src/external/bsd/dhcpcd/dist/src/if-bsd.c
diff -u src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.7 src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.8
--- src/external/bsd/dhcpcd/dist/src/if-bsd.c:1.7	Sat May  4 09:42:15 2019
+++ src/external/bsd/dhcpcd/dist/src/if-bsd.c	Wed Jun 26 17:47:47 2019
@@ -1063,7 +1063,7 @@ if_rtm(struct dhcpcd_ctx *ctx, const str
 		return 0;
 
 	if (if_copyrt(ctx, , rtm) == -1)
-		return -1;
+		return errno == ENOTSUP ? 0 : -1;
 
 #ifdef INET6
 	/*
@@ -1305,7 +1305,8 @@ if_dispatch(struct dhcpcd_ctx *ctx, cons
 		return if_ifa(ctx, (const void *)rtm);
 #ifdef RTM_DESYNC
 	case RTM_DESYNC:
-		return dhcpcd_linkoverflow(ctx);
+		dhcpcd_linkoverflow(ctx);
+		return 0;
 #endif
 	}
 
@@ -1325,7 +1326,9 @@ if_handlelink(struct dhcpcd_ctx *ctx)
 		return -1;
 	if (len == 0)
 		return 0;
-	if (len < rtm.hdr.rtm_msglen) {
+	if ((size_t)len < offsetof(struct rt_msghdr, rtm_index) ||
+	len < rtm.hdr.rtm_msglen)
+	{
 		errno = EINVAL;
 		return -1;
 	}

Index: src/external/bsd/dhcpcd/dist/src/dhcpcd.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.19 src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.20
--- src/external/bsd/dhcpcd/dist/src/dhcpcd.c:1.19	Sat May  4 09:42:15 2019
+++ src/external/bsd/dhcpcd/dist/src/dhcpcd.c	Wed Jun 26 17:47:47 2019
@@ -1081,8 +1081,7 @@ dhcpcd_handlelink(void *arg)
 			dhcpcd_linkoverflow(ctx);
 			return;
 		}
-		if (errno != ENOTSUP)
-			logerr(__func__);
+		logerr(__func__);
 	}
 }
 

Index: src/external/bsd/dhcpcd/dist/src/ipv6nd.c
diff -u src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.6 src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.7
--- src/external/bsd/dhcpcd/dist/src/ipv6nd.c:1.6	Fri Apr 26 14:34:10 2019
+++ src/external/bsd/dhcpcd/dist/src/ipv6nd.c	Wed Jun 26 17:47:47 2019
@@ -382,9 +382,6 @@ ipv6nd_sendrsprobe(void *arg)
 	else {
 		logwarnx("%s: no IPv6 Routers available", ifp->name);
 		ipv6nd_drop(ifp);
-#ifdef DHCP6
-		dhcp6_dropnondelegates(ifp);
-#endif
 	}
 }
 
@@ -1525,9 +1522,6 @@ ipv6nd_expirera(void *arg)
 	struct timespec now, lt, expire, next;
 	bool expired, valid, validone;
 	struct ipv6_addr *ia;
-#ifdef DHCP6
-	bool anyvalid = false;
-#endif
 
 	ifp = arg;
 	clock_gettime(CLOCK_MONOTONIC, );
@@ -1603,10 +1597,6 @@ ipv6nd_expirera(void *arg)
 		 * as well punt it. */
 		if (!valid && !validone)
 			ipv6nd_free_ra(rap);
-#ifdef DHCP6
-		else
-			anyvalid = true;
-#endif
 	}
 
 	if (timespecisset())
@@ -1616,12 +1606,6 @@ ipv6nd_expirera(void *arg)
 		rt_build(ifp->ctx, AF_INET6);
 		script_runreason(ifp, "ROUTERADVERT");
 	}
-
-#ifdef DHCP6
-	/* No valid routers? Kill any DHCPv6. */
-	if (!anyvalid)
-		dhcp6_dropnondelegates(ifp);
-#endif
 }
 
 void



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

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:47:47 UTC 2019

Modified Files:
src/external/bsd/dhcpcd/dist/hooks: 30-hostname
src/external/bsd/dhcpcd/dist/src: dhcp6.c dhcpcd.c if-bsd.c ipv6nd.c

Log Message:
Sync


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/dhcpcd/dist/hooks/30-hostname
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c \
src/external/bsd/dhcpcd/dist/src/if-bsd.c
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/dhcpcd/dist/src/dhcpcd.c
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.c

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



CVS import: src/external/bsd/dhcpcd/dist

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:46:10 UTC 2019

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv7794

Log Message:
Import dhcpcd-7.2.3 with the following changes:
  *  BSD: Check RTM lengths incase of kernel issues
  *  DHCP6: Don't stop even when last router goes away
  *  DHCP6: Fix inform from RA
  *  hostname: Fix short hostname check

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-7-2-3a

U src/external/bsd/dhcpcd/dist/.gitignore
U src/external/bsd/dhcpcd/dist/BUILDING.md
U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/Makefile
U src/external/bsd/dhcpcd/dist/Makefile.inc
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/config-null.mk
U src/external/bsd/dhcpcd/dist/configure
U src/external/bsd/dhcpcd/dist/iconfig.mk
U src/external/bsd/dhcpcd/dist/compat/_strtoi.h
U src/external/bsd/dhcpcd/dist/compat/arc4random.c
U src/external/bsd/dhcpcd/dist/compat/arc4random.h
U src/external/bsd/dhcpcd/dist/compat/bitops.h
U src/external/bsd/dhcpcd/dist/compat/queue.h
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.h
U src/external/bsd/dhcpcd/dist/compat/consttime_memequal.h
U src/external/bsd/dhcpcd/dist/compat/dprintf.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.h
U src/external/bsd/dhcpcd/dist/compat/endian.h
U src/external/bsd/dhcpcd/dist/compat/pidfile.c
U src/external/bsd/dhcpcd/dist/compat/pidfile.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.c
U src/external/bsd/dhcpcd/dist/compat/reallocarray.h
U src/external/bsd/dhcpcd/dist/compat/strlcpy.c
U src/external/bsd/dhcpcd/dist/compat/strlcpy.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.c
U src/external/bsd/dhcpcd/dist/compat/strtou.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.h
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.c
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.h
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.c
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.h
U src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/GNUmakefile
U src/external/bsd/dhcpcd/dist/src/Makefile
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.c
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/dev.c
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/src/genembedc
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/if-linux-wext.c
U src/external/bsd/dhcpcd/dist/src/genembedh
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/if-linux.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/if-sun.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6.h
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/dev/Makefile
U src/external/bsd/dhcpcd/dist/src/dev/udev.c
U 

CVS import: src/external/bsd/dhcpcd/dist

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 17:46:10 UTC 2019

Update of /cvsroot/src/external/bsd/dhcpcd/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv7794

Log Message:
Import dhcpcd-7.2.3 with the following changes:
  *  BSD: Check RTM lengths incase of kernel issues
  *  DHCP6: Don't stop even when last router goes away
  *  DHCP6: Fix inform from RA
  *  hostname: Fix short hostname check

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-7-2-3a

U src/external/bsd/dhcpcd/dist/.gitignore
U src/external/bsd/dhcpcd/dist/BUILDING.md
U src/external/bsd/dhcpcd/dist/LICENSE
U src/external/bsd/dhcpcd/dist/Makefile
U src/external/bsd/dhcpcd/dist/Makefile.inc
U src/external/bsd/dhcpcd/dist/README.md
U src/external/bsd/dhcpcd/dist/config-null.mk
U src/external/bsd/dhcpcd/dist/configure
U src/external/bsd/dhcpcd/dist/iconfig.mk
U src/external/bsd/dhcpcd/dist/compat/_strtoi.h
U src/external/bsd/dhcpcd/dist/compat/arc4random.c
U src/external/bsd/dhcpcd/dist/compat/arc4random.h
U src/external/bsd/dhcpcd/dist/compat/bitops.h
U src/external/bsd/dhcpcd/dist/compat/queue.h
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.c
U src/external/bsd/dhcpcd/dist/compat/arc4random_uniform.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.h
U src/external/bsd/dhcpcd/dist/compat/consttime_memequal.h
U src/external/bsd/dhcpcd/dist/compat/dprintf.c
U src/external/bsd/dhcpcd/dist/compat/dprintf.h
U src/external/bsd/dhcpcd/dist/compat/endian.h
U src/external/bsd/dhcpcd/dist/compat/pidfile.c
U src/external/bsd/dhcpcd/dist/compat/pidfile.h
U src/external/bsd/dhcpcd/dist/compat/reallocarray.c
U src/external/bsd/dhcpcd/dist/compat/reallocarray.h
U src/external/bsd/dhcpcd/dist/compat/strlcpy.c
U src/external/bsd/dhcpcd/dist/compat/strlcpy.h
U src/external/bsd/dhcpcd/dist/compat/strtoi.c
U src/external/bsd/dhcpcd/dist/compat/strtou.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.c
U src/external/bsd/dhcpcd/dist/compat/crypt/hmac.h
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.c
U src/external/bsd/dhcpcd/dist/compat/crypt/md5.h
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.c
U src/external/bsd/dhcpcd/dist/compat/crypt/sha256.h
U src/external/bsd/dhcpcd/dist/src/dhcp.c
U src/external/bsd/dhcpcd/dist/src/GNUmakefile
U src/external/bsd/dhcpcd/dist/src/Makefile
U src/external/bsd/dhcpcd/dist/src/arp.c
U src/external/bsd/dhcpcd/dist/src/arp.h
U src/external/bsd/dhcpcd/dist/src/auth.c
U src/external/bsd/dhcpcd/dist/src/auth.h
U src/external/bsd/dhcpcd/dist/src/bpf.c
U src/external/bsd/dhcpcd/dist/src/bpf.h
U src/external/bsd/dhcpcd/dist/src/common.c
U src/external/bsd/dhcpcd/dist/src/common.h
U src/external/bsd/dhcpcd/dist/src/control.c
U src/external/bsd/dhcpcd/dist/src/control.h
U src/external/bsd/dhcpcd/dist/src/defs.h
U src/external/bsd/dhcpcd/dist/src/dev.c
U src/external/bsd/dhcpcd/dist/src/dev.h
U src/external/bsd/dhcpcd/dist/src/dhcp-common.c
U src/external/bsd/dhcpcd/dist/src/dhcp-common.h
U src/external/bsd/dhcpcd/dist/src/dhcp.h
C src/external/bsd/dhcpcd/dist/src/dhcp6.c
U src/external/bsd/dhcpcd/dist/src/dhcp6.h
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf.5.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd.8.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions-small.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-definitions.conf
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.c.in
U src/external/bsd/dhcpcd/dist/src/dhcpcd-embedded.h.in
C src/external/bsd/dhcpcd/dist/src/dhcpcd.c
U src/external/bsd/dhcpcd/dist/src/dhcpcd.conf
U src/external/bsd/dhcpcd/dist/src/genembedc
U src/external/bsd/dhcpcd/dist/src/dhcpcd.h
U src/external/bsd/dhcpcd/dist/src/duid.c
U src/external/bsd/dhcpcd/dist/src/duid.h
U src/external/bsd/dhcpcd/dist/src/eloop.c
U src/external/bsd/dhcpcd/dist/src/eloop.h
U src/external/bsd/dhcpcd/dist/src/if-linux-wext.c
U src/external/bsd/dhcpcd/dist/src/genembedh
C src/external/bsd/dhcpcd/dist/src/if-bsd.c
U src/external/bsd/dhcpcd/dist/src/if-linux.c
U src/external/bsd/dhcpcd/dist/src/if-options.c
U src/external/bsd/dhcpcd/dist/src/if-options.h
U src/external/bsd/dhcpcd/dist/src/if-sun.c
U src/external/bsd/dhcpcd/dist/src/if.c
U src/external/bsd/dhcpcd/dist/src/if.h
U src/external/bsd/dhcpcd/dist/src/ipv4.c
U src/external/bsd/dhcpcd/dist/src/ipv4.h
U src/external/bsd/dhcpcd/dist/src/ipv4ll.c
U src/external/bsd/dhcpcd/dist/src/ipv4ll.h
U src/external/bsd/dhcpcd/dist/src/ipv6.c
U src/external/bsd/dhcpcd/dist/src/ipv6.h
C src/external/bsd/dhcpcd/dist/src/ipv6nd.c
U src/external/bsd/dhcpcd/dist/src/ipv6nd.h
U src/external/bsd/dhcpcd/dist/src/logerr.c
U src/external/bsd/dhcpcd/dist/src/logerr.h
U src/external/bsd/dhcpcd/dist/src/route.c
U src/external/bsd/dhcpcd/dist/src/route.h
U src/external/bsd/dhcpcd/dist/src/sa.c
U src/external/bsd/dhcpcd/dist/src/sa.h
U src/external/bsd/dhcpcd/dist/src/script.c
U src/external/bsd/dhcpcd/dist/src/script.h
U src/external/bsd/dhcpcd/dist/src/dev/Makefile
U src/external/bsd/dhcpcd/dist/src/dev/udev.c
U 

CVS commit: [phil-wifi] src/sys/dev/usb

2019-06-26 Thread Phil Nelson
Module Name:src
Committed By:   phil
Date:   Wed Jun 26 16:51:29 UTC 2019

Modified Files:
src/sys/dev/usb [phil-wifi]: if_urtwn.c

Log Message:
Remove extra if_register() call.
Move temporary call to vap_create() to end of attach to make sure
attach works when vap_create() will not be called as part of attach.


To generate a diff of this commit:
cvs rdiff -u -r1.59.2.7 -r1.59.2.8 src/sys/dev/usb/if_urtwn.c

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



CVS commit: [phil-wifi] src/sys/dev/usb

2019-06-26 Thread Phil Nelson
Module Name:src
Committed By:   phil
Date:   Wed Jun 26 16:51:29 UTC 2019

Modified Files:
src/sys/dev/usb [phil-wifi]: if_urtwn.c

Log Message:
Remove extra if_register() call.
Move temporary call to vap_create() to end of attach to make sure
attach works when vap_create() will not be called as part of attach.


To generate a diff of this commit:
cvs rdiff -u -r1.59.2.7 -r1.59.2.8 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.7 src/sys/dev/usb/if_urtwn.c:1.59.2.8
--- src/sys/dev/usb/if_urtwn.c:1.59.2.7	Mon Jun 10 22:07:34 2019
+++ src/sys/dev/usb/if_urtwn.c	Wed Jun 26 16:51:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.59.2.7 2019/06/10 22:07:34 christos Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.59.2.8 2019/06/26 16:51:29 phil Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.7 2019/06/10 22:07:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.8 2019/06/26 16:51:29 phil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -529,8 +529,8 @@ urtwn_attach(device_t parent, device_t s
 #else
 	urtwn_getradiocaps(ic, IEEE80211_CHAN_MAX, >ic_nchans, 
 	ic->ic_channels);
-#endif	
-
+#endif
+	/* XXX issues here ...  Figure out proper attach and vap creation */
 	ieee80211_ifattach(ic);
 
 	/* override default methods NNN Need more here? */
@@ -547,29 +547,6 @@ urtwn_attach(device_t parent, device_t s
 	ic->ic_raw_xmit = urtwn_raw_xmit;
 	ic->ic_getradiocaps = urtwn_getradiocaps;
 	
-
-	/* How should this get called the first time?  Not here? */
-	// uint8_t bssid[IEEE80211_ADDR_LEN] = {0};
-
-	struct ieee80211vap *vap =
-	urtwn_vap_create(ic, device_xname(sc->sc_dev),
-	device_unit(sc->sc_dev), IEEE80211_M_STA,
-	IEEE80211_CLONE_MACADDR, ic->ic_macaddr, ic->ic_macaddr);
-
-	if (vap == NULL) {
-		/* Didn't work ... now what! */
-		printf ("NNN vap_create didn't work ...\n");
-		ieee80211_ifdetach(ic);
-		goto fail;
-	}
-
-	/* Debug all! NNN */
-	// vap->iv_debug = IEEE80211_MSG_ANY;
-
-	bpf_attach2(vap->iv_ifp, DLT_IEEE802_11_RADIO,
-	sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN,
-	>sc_drvbpf);
-
 	sc->sc_rxtap_len = sizeof(sc->sc_rxtapu);
 	sc->sc_rxtap.wr_ihdr.it_len = htole16(sc->sc_rxtap_len);
 	sc->sc_rxtap.wr_ihdr.it_present = htole32(URTWN_RX_RADIOTAP_PRESENT);
@@ -578,10 +555,6 @@ urtwn_attach(device_t parent, device_t s
 	sc->sc_txtap.wt_ihdr.it_len = htole16(sc->sc_txtap_len);
 	sc->sc_txtap.wt_ihdr.it_present = htole32(URTWN_TX_RADIOTAP_PRESENT);
 
-	struct ifnet *ifp = vap->iv_ifp;
-	ifp->if_percpuq = if_percpuq_create(ifp);
-	if_register(ifp);
-
 	ieee80211_announce(ic);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
@@ -590,6 +563,21 @@ urtwn_attach(device_t parent, device_t s
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
 	SET(sc->sc_flags, URTWN_FLAG_ATTACHED);
+
+	/* Should be called via an IOCTL.  Temp call here for now. */
+
+	struct ieee80211vap *vap =
+	urtwn_vap_create(ic, device_xname(sc->sc_dev),
+	device_unit(sc->sc_dev), IEEE80211_M_STA,
+	IEEE80211_CLONE_MACADDR, ic->ic_macaddr, ic->ic_macaddr);
+
+	if (vap == NULL) {
+		/* Didn't work ... now what! */
+		printf ("NNN vap_create didn't work ...\n");
+		ieee80211_ifdetach(ic);
+		goto fail;
+	}
+	
 	return;
 
  fail:
@@ -3403,6 +3391,7 @@ urtwn_vap_create(struct ieee80211com *ic
 	vap->iv_reset = urtwn_reset;
 
 	ifp = vap->iv_ifp;
+if_initialize(ifp);
 	ifp->if_init = urtwn_init;
 	ifp->if_ioctl = urtwn_ioctl;
 	ifp->if_start = urtwn_start;
@@ -3411,6 +3400,8 @@ urtwn_vap_create(struct ieee80211com *ic
 	// IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 
+	ifp->if_percpuq = if_percpuq_create(ifp);
+
 	/* Override state transition machine. */
 	/* NNN --- many possible newstate machines ... issue! */
 	sc->sc_newstate = vap->iv_newstate;
@@ -3421,6 +3412,11 @@ urtwn_vap_create(struct ieee80211com *ic
 	ieee80211_media_status, macaddr);
 	ic->ic_opmode = opmode;
 
+	/* Attach the packet filter */
+	bpf_attach2(vap->iv_ifp, DLT_IEEE802_11_RADIO,
+	sizeof(struct ieee80211_frame) + IEEE80211_RADIOTAP_HDRLEN,
+	>sc_drvbpf);
+
 	return vap;
 }
 
@@ -3610,7 +3606,7 @@ urtwn_raw_xmit(struct ieee80211_node *ni
 
 	DPRINTFN(DBG_FN, ("%s: %s\n",device_xname(sc->sc_dev), __func__));
 
-	KASSERT(vap != NULL);  // NNN need these?
+	KASSERT(vap != NULL);   /*  NNN need these? */
 	KASSERT(ic != NULL);
 	KASSERT(sc != NULL);
 	KASSERT(m != NULL);
@@ -3628,8 +3624,8 @@ urtwn_raw_xmit(struct ieee80211_node *ni
 
 	error = urtwn_tx(sc, m, ni, data);
 	if (error != 0) {
-			printf("ERROR3\n");
-			vap->iv_ifp->if_oerrors++;
+		printf("ERROR3\n");
+	

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

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 15:31:17 UTC 2019

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

Log Message:
Conform to RFC 3128 by dropping TCP fragments with offset = 1.
In addition to dropping these fragments, add a DTrace probe to allow
for more detailed monitoring and diagnosis if required.
>From FreeBSD r349399, reported vy Cy Schubert


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/ipf/netinet/fil.c

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

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.27 src/sys/external/bsd/ipf/netinet/fil.c:1.28
--- src/sys/external/bsd/ipf/netinet/fil.c:1.27	Wed Jun 26 11:26:57 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c	Wed Jun 26 11:31:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.27 2019/06/26 15:26:57 christos Exp $	*/
+/*	$NetBSD: fil.c,v 1.28 2019/06/26 15:31:17 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.27 2019/06/26 15:26:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.28 2019/06/26 15:31:17 christos Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -1721,6 +1721,10 @@ ipf_pr_ipv4hdr(fr_info_t *fin)
 	 * calculate the byte offset that it represents.
 	 */
 	off &= IP_MF|IP_OFFMASK;
+	if (off == 1 && p == IPPROTO_TCP) {
+		fin->fin_flx |= FI_SHORT;	/* RFC 3128 */
+		DT1(ipf_fi_tcp_frag_off_1, fr_info_t *, fin);
+	}
 	if (off != 0) {
 		int morefrag = off & IP_MF;
 



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

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 15:31:17 UTC 2019

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

Log Message:
Conform to RFC 3128 by dropping TCP fragments with offset = 1.
In addition to dropping these fragments, add a DTrace probe to allow
for more detailed monitoring and diagnosis if required.
>From FreeBSD r349399, reported vy Cy Schubert


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/external/bsd/ipf/netinet/fil.c

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



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

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 15:26:58 UTC 2019

Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c ip_fil.h

Log Message:
Remove fd_local, it is not used, from FreeBSD r349401, reported by Cy Schubert


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/ipf/netinet/ip_fil.h

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



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

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 15:26:58 UTC 2019

Modified Files:
src/sys/external/bsd/ipf/netinet: fil.c ip_fil.h

Log Message:
Remove fd_local, it is not used, from FreeBSD r349401, reported by Cy Schubert


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/external/bsd/ipf/netinet/fil.c
cvs rdiff -u -r1.6 -r1.7 src/sys/external/bsd/ipf/netinet/ip_fil.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/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.26 src/sys/external/bsd/ipf/netinet/fil.c:1.27
--- src/sys/external/bsd/ipf/netinet/fil.c:1.26	Wed Jun 26 11:21:52 2019
+++ src/sys/external/bsd/ipf/netinet/fil.c	Wed Jun 26 11:26:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.26 2019/06/26 15:21:52 christos Exp $	*/
+/*	$NetBSD: fil.c,v 1.27 2019/06/26 15:26:57 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -141,7 +141,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.26 2019/06/26 15:21:52 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.27 2019/06/26 15:26:57 christos Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -7282,11 +7282,6 @@ ipf_resolvedest(ipf_main_softc_t *softc,
 			}
 		} else {
 			ifp = GETIFP(base + fdp->fd_name, v);
-			if (ifp == NULL)
-ifp = (void *)-1;
-			if ((ifp != NULL) && (ifp != (void *)-1))
-fdp->fd_local = ipf_deliverlocal(softc, v, ifp,
- >fd_ip6);
 		}
 	}
 	fdp->fd_ptr = ifp;

Index: src/sys/external/bsd/ipf/netinet/ip_fil.h
diff -u src/sys/external/bsd/ipf/netinet/ip_fil.h:1.6 src/sys/external/bsd/ipf/netinet/ip_fil.h:1.7
--- src/sys/external/bsd/ipf/netinet/ip_fil.h:1.6	Sun Jun  3 06:37:23 2018
+++ src/sys/external/bsd/ipf/netinet/ip_fil.h	Wed Jun 26 11:26:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_fil.h,v 1.6 2018/06/03 10:37:23 maxv Exp $	*/
+/*	$NetBSD: ip_fil.h,v 1.7 2019/06/26 15:26:57 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -576,7 +576,6 @@ typedef	struct	frdest	{
 	addrfamily_t	fd_addr;
 	fr_dtypes_t	fd_type;
 	int		fd_name;
-	int		fd_local;
 } frdest_t;
 
 #define	fd_ip6	fd_addr.adf_addr



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

2019-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jun 26 15:21:52 UTC 2019

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

Log Message:
Remove redundant off != 0 check, from FreeBSD r349400, reported by Cy Schubert


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/external/bsd/ipf/netinet/fil.c

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



CVS commit: src/lib/libc/sys

2019-06-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun 26 13:31:48 UTC 2019

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

Log Message:
Use Vt for variable types. New sentence, new line. Add a missing ')'.
Add/remove some articles or other missing words.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/libc/sys/ptrace.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/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.75 src/lib/libc/sys/ptrace.2:1.76
--- src/lib/libc/sys/ptrace.2:1.75	Wed Jun 26 12:30:12 2019
+++ src/lib/libc/sys/ptrace.2	Wed Jun 26 13:31:48 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ptrace.2,v 1.75 2019/06/26 12:30:12 mgorny Exp $
+.\"	$NetBSD: ptrace.2,v 1.76 2019/06/26 13:31:48 wiz Exp $
 .\"
 .\" This file is in the public domain.
 .Dd June 26, 2019
@@ -193,7 +193,7 @@ This call does not stop the process neit
 to parent.
 .It Dv PT_READ_I , Dv PT_READ_D
 These requests read a single
-.Li int
+.Vt int
 of data from the traced process' address space.
 Traditionally,
 .Fn ptrace
@@ -295,7 +295,7 @@ This request is a more general interface
 and
 .Dv PT_WRITE_I .
 The I/O request is encoded in a
-.Dq Li "struct ptrace_io_desc"
+.Vt struct ptrace_io_desc
 defined as:
 .Bd -literal -offset indent
 struct ptrace_io_desc {
@@ -350,9 +350,7 @@ field in the I/O descriptor will be upda
 bytes transferred.
 If the requested I/O could not be successfully performed,
 .Fn ptrace
-will return
-.Li \-1
-and set
+will return \-1 and set
 .Va errno .
 .Pp
 This interface returns success for partial and cancelled byte transfers.
@@ -381,7 +379,7 @@ argument.
 The
 .Fa addr
 argument should contain a
-.Dq Li "struct ptrace_lwpinfo"
+.Vt struct ptrace_lwpinfo
 defined as:
 .Bd -literal -offset indent
 struct ptrace_lwpinfo {
@@ -415,7 +413,7 @@ Possible values are:
 The
 .Fa data
 argument should contain
-.Dq Li "sizeof(struct ptrace_lwpinfo)" .
+.Dq Li sizeof(struct ptrace_lwpinfo) .
 .It Dv PT_SYSCALL
 Stops a process before and after executing each system call.
 Otherwise this operation is the same as
@@ -433,7 +431,7 @@ shall be used.
 This request can be used to specify which events in the traced process
 should be reported to the tracing process.
 These events are specified in a
-.Dq Li "struct ptrace_event"
+.Vt struct ptrace_event
 defined as:
 .Bd -literal -offset indent
 typedef struct ptrace_event {
@@ -509,7 +507,7 @@ argument should be set to
 This request can be used to determine which events in the traced
 process will be reported.
 The information is read into the
-.Dq Li struct ptrace_event
+.Vt struct ptrace_event
 pointed to by
 .Fa addr .
 The
@@ -520,7 +518,7 @@ argument should be set to
 This request reads the state information associated with the event
 that stopped the traced process.
 The information is reported in a
-.Dq Li "struct ptrace_state"
+.Vt struct ptrace_state
 defined as:
 .Bd -literal -offset indent
 typedef struct ptrace_state {
@@ -538,7 +536,7 @@ argument should be set to
 .It Dv PT_SET_SIGINFO
 This request can be used to specify signal information emitted to tracee.
 This signal information is specified in
-.Dq Li "struct ptrace_siginfo"
+.Vt struct ptrace_siginfo
 defined as:
 .Bd -literal -offset indentq
 typedef struct ptrace_siginfo {
@@ -578,7 +576,7 @@ see
 .Xr siginfo 2
 .Pc .
 The information is read into the
-.Dq Li struct ptrace_siginfo
+.Vt struct ptrace_siginfo
 pointed to by
 .Fa addr .
 The
@@ -639,7 +637,7 @@ This request will turn on single steppin
 This request will turn off single stepping of the specified process.
 .It Dv PT_GETREGS
 This request reads the traced process' machine registers into the
-.Dq Li "struct reg"
+.Vt struct reg
 (defined in
 .In machine/reg.h )
 pointed to by
@@ -653,7 +651,7 @@ If zero is supplied, the first thread of
 This request is the converse of
 .Dv PT_GETREGS ;
 it loads the traced process' machine registers from the
-.Dq Li "struct reg"
+.Vt struct reg
 (defined in
 .In machine/reg.h )
 pointed to by
@@ -666,7 +664,7 @@ If zero is supplied, the first thread of
 .It Dv PT_GETFPREGS
 This request reads the traced process' floating-point registers into
 the
-.Dq Li "struct fpreg"
+.Vt struct fpreg
 (defined in
 .In machine/reg.h )
 pointed to by
@@ -680,7 +678,7 @@ If zero is supplied, the first thread of
 This request is the converse of
 .Dv PT_GETFPREGS ;
 it loads the traced process' floating-point registers from the
-.Dq Li "struct fpreg"
+.Vt struct fpreg
 (defined in
 .In machine/reg.h )
 pointed to by
@@ -693,7 +691,7 @@ If zero is supplied, the first thread of
 .It Dv PT_GETDBREGS
 This request reads the traced process' debug registers into
 the
-.Dq Li "struct dbreg"
+.Vt struct dbreg
 (defined in
 .In machine/reg.h )
 pointed to by
@@ -707,7 +705,7 @@ If zero is supplied, the first thread of
 This request is the converse of
 .Dv PT_GETDBREGS ;
 it loads the traced process' debug 

CVS commit: src/lib/libc/sys

2019-06-26 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Jun 26 13:31:48 UTC 2019

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

Log Message:
Use Vt for variable types. New sentence, new line. Add a missing ')'.
Add/remove some articles or other missing words.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/lib/libc/sys/ptrace.2

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



CVS commit: src

2019-06-26 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Wed Jun 26 12:30:13 UTC 2019

Modified Files:
src/lib/libc/sys: ptrace.2
src/sys/arch/amd64/amd64: netbsd32_machdep.c process_machdep.c
src/sys/arch/amd64/include: netbsd32_machdep.h ptrace.h
src/sys/arch/i386/i386: process_machdep.c
src/sys/arch/i386/include: ptrace.h
src/sys/arch/x86/include: cpu_extended_state.h fpu.h
src/sys/arch/x86/x86: fpu.c
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Implement PT_GETXSTATE and PT_SETXSTATE

Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE,
that provide access to the extended (and extensible) set of FPU
registers on amd64 and i386.  At the moment, this covers AVX (YMM)
and AVX-512 (ZMM, opmask) registers.  It can be easily extended
to cover further register types without breaking backwards
compatibility.

PT_GETXSTATE issues the XSAVE instruction with all kernel-supported
extended components enabled.  The data is copied into 'struct xstate'
(which -- unlike the XSAVE area itself -- has stable format
and offsets).

PT_SETXSTATE issues the XRSTOR instruction to restore the register
values from user-provided 'struct xstate'.  The function replaces only
the specific XSAVE components that are listed in 'xs_rfbm' field,
making it possible to issue partial updates.

Both syscalls take a 'struct iovec' pointer rather than a direct
argument.  This requires the caller to explicitly specify the buffer
size.  As a result, existing code will continue to work correctly
when the structure is extended (performing partial reads/updates).


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/lib/libc/sys/ptrace.2
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/process_machdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/include/netbsd32_machdep.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/cpu_extended_state.h \
src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.128 -r1.129 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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



CVS commit: src

2019-06-26 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Wed Jun 26 12:30:13 UTC 2019

Modified Files:
src/lib/libc/sys: ptrace.2
src/sys/arch/amd64/amd64: netbsd32_machdep.c process_machdep.c
src/sys/arch/amd64/include: netbsd32_machdep.h ptrace.h
src/sys/arch/i386/i386: process_machdep.c
src/sys/arch/i386/include: ptrace.h
src/sys/arch/x86/include: cpu_extended_state.h fpu.h
src/sys/arch/x86/x86: fpu.c
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Implement PT_GETXSTATE and PT_SETXSTATE

Introduce two new ptrace() requests: PT_GETXSTATE and PT_SETXSTATE,
that provide access to the extended (and extensible) set of FPU
registers on amd64 and i386.  At the moment, this covers AVX (YMM)
and AVX-512 (ZMM, opmask) registers.  It can be easily extended
to cover further register types without breaking backwards
compatibility.

PT_GETXSTATE issues the XSAVE instruction with all kernel-supported
extended components enabled.  The data is copied into 'struct xstate'
(which -- unlike the XSAVE area itself -- has stable format
and offsets).

PT_SETXSTATE issues the XRSTOR instruction to restore the register
values from user-provided 'struct xstate'.  The function replaces only
the specific XSAVE components that are listed in 'xs_rfbm' field,
making it possible to issue partial updates.

Both syscalls take a 'struct iovec' pointer rather than a direct
argument.  This requires the caller to explicitly specify the buffer
size.  As a result, existing code will continue to work correctly
when the structure is extended (performing partial reads/updates).


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/lib/libc/sys/ptrace.2
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/amd64/amd64/process_machdep.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/include/netbsd32_machdep.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/i386/i386/process_machdep.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/cpu_extended_state.h \
src/sys/arch/x86/include/fpu.h
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/x86/x86/fpu.c
cvs rdiff -u -r1.128 -r1.129 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.15 -r1.16 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/lib/libc/sys/ptrace.2
diff -u src/lib/libc/sys/ptrace.2:1.74 src/lib/libc/sys/ptrace.2:1.75
--- src/lib/libc/sys/ptrace.2:1.74	Wed Jun 12 12:33:42 2019
+++ src/lib/libc/sys/ptrace.2	Wed Jun 26 12:30:12 2019
@@ -1,7 +1,7 @@
-.\"	$NetBSD: ptrace.2,v 1.74 2019/06/12 12:33:42 wiz Exp $
+.\"	$NetBSD: ptrace.2,v 1.75 2019/06/26 12:30:12 mgorny Exp $
 .\"
 .\" This file is in the public domain.
-.Dd June 12, 2019
+.Dd June 26, 2019
 .Dt PTRACE 2
 .Os
 .Sh NAME
@@ -771,6 +771,69 @@ The
 argument contains the LWP ID of the thread whose registers are to
 be written.
 If zero is supplied, the first thread of the process is written.
+.It Dv PT_GETXSTATE
+This request reads the traced process' FPU extended state into
+the
+.Dq Li "struct xstate"
+(defined in
+.In machine/cpu_extended_state.h ) .
+.Fa addr
+should be a pointer to
+.Dq Li "struct iovec"
+(defined in
+.In sys/uio.h )
+specifying the pointer to the aforementioned struct as
+.Fa iov_base
+and its size as
+.Fa iov_len .
+The
+.Fa data
+argument contains the LWP ID of the thread whose registers are to
+be read.
+If zero is supplied, the first thread of the process is read.
+The struct will be filled up to the specified
+.Fa iov_len .
+The caller needs to check
+.Fa xs_rfbm
+bitmap in order to determine which fields were provided by the CPU,
+and may check
+.Fa xs_xstate_bv
+to determine which component states were changed from the initial state.
+.It Dv PT_SETXSTATE
+This request is the converse of
+.Dv PT_GETXSTATE ;
+it loads the traced process' extended FPU state from the
+.Dq Li "struct xstate"
+(defined in
+.In machine/cpu_extended_state.h ) .
+.Fa addr
+should be a pointer to
+.Dq Li "struct iovec"
+(defined in
+.In sys/uio.h )
+specifying the pointer to the aforementioned struct as
+.Fa iov_base
+and its size as
+.Fa iov_len .
+The
+.Fa data
+argument contains the LWP ID of the thread whose registers are to
+be written.
+If zero is supplied, the first thread of the process is written.
+The
+.Fa xs_rfbm
+field of the supplied xstate specifies which state components are to
+be updated.  Other components (fields) will be ignored.  The
+.Fa xs_xstate_bv
+specifies whether component state should be set to provided values
+(when 1) or reset to unitialized (when 0).  The request
+will fail if
+.Fa xs_xstate_bv
+is not a subset of
+.Fa xs_rfbm ,
+or any of the specified components is not supported by the CPU or 

CVS commit: src/sys/arch/x86

2019-06-26 Thread Michał Górny
Module Name:src
Committed By:   mgorny
Date:   Wed Jun 26 12:29:01 UTC 2019

Modified Files:
src/sys/arch/x86/include: cpu.h specialreg.h
src/sys/arch/x86/x86: identcpu.c

Log Message:
Fetch XSAVE area component offsets and sizes when initializing x86 CPU

Introduce two new arrays, x86_xsave_offsets and x86_xsave_sizes,
and initialize them with XSAVE area component offsets and sizes queried
via CPUID.  This will be needed to implement getters and setters for
additional register types.

While at it, add XSAVE_* constants corresponding to specific XSAVE
components.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.147 -r1.148 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/x86/x86/identcpu.c

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



CVS commit: src/sys/dev/pad

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 12:21:40 UTC 2019

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

Log Message:
Fix return value.  fo_poll expects revents, not errno.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pad/pad.c

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

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.62 src/sys/dev/pad/pad.c:1.63
--- src/sys/dev/pad/pad.c:1.62	Wed Jun 26 11:53:15 2019
+++ src/sys/dev/pad/pad.c	Wed Jun 26 12:21:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.62 2019/06/26 11:53:15 isaki Exp $ */
+/* $NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.62 2019/06/26 11:53:15 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.63 2019/06/26 12:21:40 isaki Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.62
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -453,7 +454,7 @@ static int
 fops_pad_poll(struct file *fp, int events)
 {
 
-	return ENODEV;
+	return POLLERR;
 }
 
 static int



CVS commit: src/sys/dev/pad

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 12:21:40 UTC 2019

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

Log Message:
Fix return value.  fo_poll expects revents, not errno.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/pad/pad.c

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



CVS commit: src/sys/dev/pad

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 11:53:15 UTC 2019

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
Style fixes.  No functional changes intended.
- Rename some functions for consistency.
- Rearrange some functions for readability.
- Unify to struct pad_softc.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pad/padvar.h

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



CVS commit: src/sys/dev/pad

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 11:53:15 UTC 2019

Modified Files:
src/sys/dev/pad: pad.c padvar.h

Log Message:
Style fixes.  No functional changes intended.
- Rename some functions for consistency.
- Rearrange some functions for readability.
- Unify to struct pad_softc.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pad/pad.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pad/padvar.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/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.61 src/sys/dev/pad/pad.c:1.62
--- src/sys/dev/pad/pad.c:1.61	Wed Jun 19 12:52:41 2019
+++ src/sys/dev/pad/pad.c	Wed Jun 26 11:53:15 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.61 2019/06/19 12:52:41 isaki Exp $ */
+/* $NetBSD: pad.c,v 1.62 2019/06/26 11:53:15 isaki Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.61 2019/06/19 12:52:41 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.62 2019/06/26 11:53:15 isaki Exp $");
 
 #include 
 #include 
@@ -93,9 +93,9 @@ static int	pad_set_format(void *, int,
 		const audio_params_t *, const audio_params_t *,
 		audio_filter_reg_t *, audio_filter_reg_t *);
 static int	pad_start_output(void *, void *, int,
-void (*)(void *), void *);
+		void (*)(void *), void *);
 static int	pad_start_input(void *, void *, int,
-   void (*)(void *), void *);
+		void (*)(void *), void *);
 static int	pad_halt_output(void *);
 static int	pad_halt_input(void *);
 static int	pad_getdev(void *, struct audio_device *);
@@ -108,32 +108,35 @@ static void	pad_get_locks(void *, kmutex
 static void	pad_done_output(void *);
 static void	pad_swvol_codec(audio_filter_arg_t *);
 
-static int pad_close(struct pad_softc *);
-static int pad_read(struct pad_softc *, off_t *, struct uio *, kauth_cred_t, int);
-
-static int fops_pad_close(struct file *);
-static int fops_pad_read(struct file *, off_t *, struct uio *, kauth_cred_t, int);
-static int pad_write(struct file *, off_t *, struct uio *, kauth_cred_t, int);
-static int pad_ioctl(struct file *, u_long, void *);
-static int pad_kqfilter(struct file *, struct knote *);
-static int pad_poll(struct file *, int);
-static int pad_stat(struct file *, struct stat *);
-static int pad_mmap(struct file *, off_t *, size_t, int, int *, int *,
-			   struct uvm_object **, int *);
+static int	pad_close(struct pad_softc *);
+static int	pad_read(struct pad_softc *, off_t *, struct uio *,
+		kauth_cred_t, int);
+
+static int	fops_pad_close(struct file *);
+static int	fops_pad_read(struct file *, off_t *, struct uio *,
+		kauth_cred_t, int);
+static int	fops_pad_write(struct file *, off_t *, struct uio *,
+		kauth_cred_t, int);
+static int	fops_pad_ioctl(struct file *, u_long, void *);
+static int	fops_pad_kqfilter(struct file *, struct knote *);
+static int	fops_pad_poll(struct file *, int);
+static int	fops_pad_stat(struct file *, struct stat *);
+static int	fops_pad_mmap(struct file *, off_t *, size_t, int, int *, int *,
+		struct uvm_object **, int *);
 
 static const struct audio_hw_if pad_hw_if = {
-	.query_format = pad_query_format,
-	.set_format = pad_set_format,
-	.start_output = pad_start_output,
-	.start_input = pad_start_input,
-	.halt_output = pad_halt_output,
-	.halt_input = pad_halt_input,
-	.getdev = pad_getdev,
-	.set_port = pad_set_port,
-	.get_port = pad_get_port,
-	.query_devinfo = pad_query_devinfo,
-	.get_props = pad_get_props,
-	.get_locks = pad_get_locks,
+	.query_format	= pad_query_format,
+	.set_format	= pad_set_format,
+	.start_output	= pad_start_output,
+	.start_input	= pad_start_input,
+	.halt_output	= pad_halt_output,
+	.halt_input	= pad_halt_input,
+	.getdev		= pad_getdev,
+	.set_port	= pad_set_port,
+	.get_port	= pad_get_port,
+	.query_devinfo	= pad_query_devinfo,
+	.get_props	= pad_get_props,
+	.get_locks	= pad_get_locks,
 };
 
 #define PAD_NFORMATS	1
@@ -152,43 +155,44 @@ static const struct audio_format pad_for
 
 extern void	padattach(int);
 
-static int	pad_add_block(pad_softc_t *, uint8_t *, int);
-static int	pad_get_block(pad_softc_t *, pad_block_t *, int);
+static int	pad_add_block(struct pad_softc *, uint8_t *, int);
+static int	pad_get_block(struct pad_softc *, pad_block_t *, int);
 
-dev_type_open(pad_open);
+dev_type_open(cdev_pad_open);
 dev_type_close(cdev_pad_close);
 dev_type_read(cdev_pad_read);
 
 const struct cdevsw pad_cdevsw = {
-	.d_open = pad_open,
-	.d_close = cdev_pad_close,
-	.d_read = cdev_pad_read,
-	.d_write = nowrite,
-	.d_ioctl = noioctl,
-	.d_stop = nostop,
-	.d_tty = notty,
-	.d_poll = nopoll,
-	.d_mmap = nommap,
-	.d_kqfilter = nokqfilter,
-	.d_discard = nodiscard,
-	.d_flag = D_OTHER | D_MPSAFE,
+	.d_open		= cdev_pad_open,
+	.d_close	= cdev_pad_close,
+	.d_read		= cdev_pad_read,
+	.d_write	= nowrite,
+	.d_ioctl	= noioctl,
+	.d_stop		= 

CVS import: src/external/cddl/osnet/dist

2019-06-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 26 11:47:55 UTC 2019

Update of /cvsroot/src/external/cddl/osnet/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv8829

Log Message:
import new CDDL dtrace and ZFS code from FreeBSD svn r315983

Add files missing from the initial import.

Status:

Vendor Tag: FreeBSD
Release Tags:   CDDL-FreeBSD-r315983

C src/external/cddl/osnet/dist/OPENSOLARIS.LICENSE
C src/external/cddl/osnet/dist/cmd/zdb/zdb.8
C src/external/cddl/osnet/dist/cmd/zfs/zfs.8
C src/external/cddl/osnet/dist/cmd/zpool/zpool-features.7
C src/external/cddl/osnet/dist/cmd/zpool/zpool.8
C src/external/cddl/osnet/dist/head/libintl.h
C src/external/cddl/osnet/dist/head/stdio_ext.h
C src/external/cddl/osnet/dist/head/thread.h
N src/external/cddl/osnet/dist/head/atomic.h
N src/external/cddl/osnet/dist/head/synch.h
C src/external/cddl/osnet/dist/lib/libzpool/common/sys/zfs_context.h
C src/external/cddl/osnet/dist/uts/common/Makefile.files
C src/external/cddl/osnet/dist/uts/common/os/fm.c
C src/external/cddl/osnet/dist/uts/common/os/callb.c
C src/external/cddl/osnet/dist/uts/common/sys/vnode.h
C src/external/cddl/osnet/dist/uts/common/sys/sysmacros.h
C src/external/cddl/osnet/dist/uts/common/sys/procset.h
C src/external/cddl/osnet/dist/uts/common/sys/extdirent.h
C src/external/cddl/osnet/dist/uts/common/sys/isa_defs.h
N src/external/cddl/osnet/dist/uts/common/sys/asm_linkage.h

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

cvs checkout -jFreeBSD:yesterday -jFreeBSD src/external/cddl/osnet/dist



CVS import: src/external/cddl/osnet/dist

2019-06-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Jun 26 11:47:55 UTC 2019

Update of /cvsroot/src/external/cddl/osnet/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv8829

Log Message:
import new CDDL dtrace and ZFS code from FreeBSD svn r315983

Add files missing from the initial import.

Status:

Vendor Tag: FreeBSD
Release Tags:   CDDL-FreeBSD-r315983

C src/external/cddl/osnet/dist/OPENSOLARIS.LICENSE
C src/external/cddl/osnet/dist/cmd/zdb/zdb.8
C src/external/cddl/osnet/dist/cmd/zfs/zfs.8
C src/external/cddl/osnet/dist/cmd/zpool/zpool-features.7
C src/external/cddl/osnet/dist/cmd/zpool/zpool.8
C src/external/cddl/osnet/dist/head/libintl.h
C src/external/cddl/osnet/dist/head/stdio_ext.h
C src/external/cddl/osnet/dist/head/thread.h
N src/external/cddl/osnet/dist/head/atomic.h
N src/external/cddl/osnet/dist/head/synch.h
C src/external/cddl/osnet/dist/lib/libzpool/common/sys/zfs_context.h
C src/external/cddl/osnet/dist/uts/common/Makefile.files
C src/external/cddl/osnet/dist/uts/common/os/fm.c
C src/external/cddl/osnet/dist/uts/common/os/callb.c
C src/external/cddl/osnet/dist/uts/common/sys/vnode.h
C src/external/cddl/osnet/dist/uts/common/sys/sysmacros.h
C src/external/cddl/osnet/dist/uts/common/sys/procset.h
C src/external/cddl/osnet/dist/uts/common/sys/extdirent.h
C src/external/cddl/osnet/dist/uts/common/sys/isa_defs.h
N src/external/cddl/osnet/dist/uts/common/sys/asm_linkage.h

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

cvs checkout -jFreeBSD:yesterday -jFreeBSD src/external/cddl/osnet/dist



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

2019-06-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Jun 26 10:20:06 UTC 2019

Modified Files:
src/sys/arch/x86/pci: msipic.c

Log Message:
Fix updating "Multiple Message Enable" field for MSI multiple vectors. Pointed 
out by jmcneill@n.o, thanks.

I tested ahcisata for MSI single vector regression.


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

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



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

2019-06-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Jun 26 10:20:06 UTC 2019

Modified Files:
src/sys/arch/x86/pci: msipic.c

Log Message:
Fix updating "Multiple Message Enable" field for MSI multiple vectors. Pointed 
out by jmcneill@n.o, thanks.

I tested ahcisata for MSI single vector regression.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/pci/msipic.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/pci/msipic.c
diff -u src/sys/arch/x86/pci/msipic.c:1.16 src/sys/arch/x86/pci/msipic.c:1.17
--- src/sys/arch/x86/pci/msipic.c:1.16	Tue Jun 18 10:06:49 2019
+++ src/sys/arch/x86/pci/msipic.c	Wed Jun 26 10:20:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $	*/
+/*	$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.16 2019/06/18 10:06:49 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $");
 
 #include "opt_intrdebug.h"
 
@@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -754,6 +755,25 @@ msipic_set_msi_vectors(struct pic *msi_p
 
 	KASSERT(msipic_is_msi_pic(msi_pic));
 
+	if (msi_pic->pic_type == PIC_MSI) {
+		pci_chipset_tag_t pc;
+		struct pci_attach_args *pa;
+		pcitag_t tag;
+		int off, err __diagused;
+		pcireg_t ctl;
+
+		pc = NULL;
+		pa = _pic->pic_msipic->mp_pa;
+		tag = pa->pa_tag;
+		err = pci_get_capability(pc, tag, PCI_CAP_MSI, , NULL);
+		KASSERT(err != 0);
+
+		ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL);
+		ctl &= ~PCI_MSI_CTL_MME_MASK;
+		ctl |= __SHIFTIN(ilog2(count), PCI_MSI_CTL_MME_MASK);
+		pci_conf_write(pc, tag, off + PCI_MSI_CTL, ctl);
+	}
+
 	msi_pic->pic_msipic->mp_veccnt = count;
 	return 0;
 }



CVS import: src/external/bsd/dhcpcd

2019-06-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Wed Jun 26 09:59:13 UTC 2019

Update of /cvsroot/src/external/bsd/dhcpcd
In directory ivanova.netbsd.org:/tmp/cvs-serv14328

Log Message:
Import dhcpcd-7.2.3 with the following changes:
  *  BSD: Check RTM lengths incase of kernel issues
  *  DHCP6: Don't stop even when last router goes away
  *  DHCP6: Fix inform from RA
  *  hostname: Fix short hostname check

Status:

Vendor Tag: roy
Release Tags:   dhcpcd-7-2-3

N src/external/bsd/dhcpcd/.gitignore
N src/external/bsd/dhcpcd/BUILDING.md
N src/external/bsd/dhcpcd/LICENSE
C src/external/bsd/dhcpcd/Makefile
C src/external/bsd/dhcpcd/Makefile.inc
N src/external/bsd/dhcpcd/README.md
N src/external/bsd/dhcpcd/config-null.mk
N src/external/bsd/dhcpcd/configure
N src/external/bsd/dhcpcd/iconfig.mk
N src/external/bsd/dhcpcd/compat/_strtoi.h
N src/external/bsd/dhcpcd/compat/arc4random.c
N src/external/bsd/dhcpcd/compat/arc4random.h
N src/external/bsd/dhcpcd/compat/bitops.h
N src/external/bsd/dhcpcd/compat/queue.h
N src/external/bsd/dhcpcd/compat/arc4random_uniform.c
N src/external/bsd/dhcpcd/compat/arc4random_uniform.h
N src/external/bsd/dhcpcd/compat/strtoi.h
N src/external/bsd/dhcpcd/compat/consttime_memequal.h
N src/external/bsd/dhcpcd/compat/dprintf.c
N src/external/bsd/dhcpcd/compat/dprintf.h
N src/external/bsd/dhcpcd/compat/endian.h
N src/external/bsd/dhcpcd/compat/pidfile.c
N src/external/bsd/dhcpcd/compat/pidfile.h
N src/external/bsd/dhcpcd/compat/reallocarray.c
N src/external/bsd/dhcpcd/compat/reallocarray.h
N src/external/bsd/dhcpcd/compat/strlcpy.c
N src/external/bsd/dhcpcd/compat/strlcpy.h
N src/external/bsd/dhcpcd/compat/strtoi.c
N src/external/bsd/dhcpcd/compat/strtou.c
N src/external/bsd/dhcpcd/compat/crypt/hmac.c
N src/external/bsd/dhcpcd/compat/crypt/hmac.h
N src/external/bsd/dhcpcd/compat/crypt/md5.c
N src/external/bsd/dhcpcd/compat/crypt/md5.h
N src/external/bsd/dhcpcd/compat/crypt/sha256.c
N src/external/bsd/dhcpcd/compat/crypt/sha256.h
N src/external/bsd/dhcpcd/src/dhcp.c
N src/external/bsd/dhcpcd/src/GNUmakefile
N src/external/bsd/dhcpcd/src/Makefile
N src/external/bsd/dhcpcd/src/arp.c
N src/external/bsd/dhcpcd/src/arp.h
N src/external/bsd/dhcpcd/src/auth.c
N src/external/bsd/dhcpcd/src/auth.h
N src/external/bsd/dhcpcd/src/bpf.c
N src/external/bsd/dhcpcd/src/bpf.h
N src/external/bsd/dhcpcd/src/common.c
N src/external/bsd/dhcpcd/src/common.h
N src/external/bsd/dhcpcd/src/control.c
N src/external/bsd/dhcpcd/src/control.h
N src/external/bsd/dhcpcd/src/defs.h
N src/external/bsd/dhcpcd/src/dev.c
N src/external/bsd/dhcpcd/src/dev.h
N src/external/bsd/dhcpcd/src/dhcp-common.c
N src/external/bsd/dhcpcd/src/dhcp-common.h
N src/external/bsd/dhcpcd/src/dhcp.h
N src/external/bsd/dhcpcd/src/dhcp6.c
N src/external/bsd/dhcpcd/src/dhcp6.h
N src/external/bsd/dhcpcd/src/dhcpcd.conf.5.in
N src/external/bsd/dhcpcd/src/dhcpcd.8.in
N src/external/bsd/dhcpcd/src/dhcpcd-definitions-small.conf
N src/external/bsd/dhcpcd/src/dhcpcd-definitions.conf
N src/external/bsd/dhcpcd/src/dhcpcd-embedded.c.in
N src/external/bsd/dhcpcd/src/dhcpcd-embedded.h.in
N src/external/bsd/dhcpcd/src/dhcpcd.c
N src/external/bsd/dhcpcd/src/dhcpcd.conf
N src/external/bsd/dhcpcd/src/genembedc
N src/external/bsd/dhcpcd/src/dhcpcd.h
N src/external/bsd/dhcpcd/src/duid.c
N src/external/bsd/dhcpcd/src/duid.h
N src/external/bsd/dhcpcd/src/eloop.c
N src/external/bsd/dhcpcd/src/eloop.h
N src/external/bsd/dhcpcd/src/if-linux-wext.c
N src/external/bsd/dhcpcd/src/genembedh
N src/external/bsd/dhcpcd/src/if-bsd.c
N src/external/bsd/dhcpcd/src/if-linux.c
N src/external/bsd/dhcpcd/src/if-options.c
N src/external/bsd/dhcpcd/src/if-options.h
N src/external/bsd/dhcpcd/src/if-sun.c
N src/external/bsd/dhcpcd/src/if.c
N src/external/bsd/dhcpcd/src/if.h
N src/external/bsd/dhcpcd/src/ipv4.c
N src/external/bsd/dhcpcd/src/ipv4.h
N src/external/bsd/dhcpcd/src/ipv4ll.c
N src/external/bsd/dhcpcd/src/ipv4ll.h
N src/external/bsd/dhcpcd/src/ipv6.c
N src/external/bsd/dhcpcd/src/ipv6.h
N src/external/bsd/dhcpcd/src/ipv6nd.c
N src/external/bsd/dhcpcd/src/ipv6nd.h
N src/external/bsd/dhcpcd/src/logerr.c
N src/external/bsd/dhcpcd/src/logerr.h
N src/external/bsd/dhcpcd/src/route.c
N src/external/bsd/dhcpcd/src/route.h
N src/external/bsd/dhcpcd/src/sa.c
N src/external/bsd/dhcpcd/src/sa.h
N src/external/bsd/dhcpcd/src/script.c
N src/external/bsd/dhcpcd/src/script.h
N src/external/bsd/dhcpcd/src/dev/Makefile
N src/external/bsd/dhcpcd/src/dev/udev.c
N src/external/bsd/dhcpcd/hooks/15-timezone
N src/external/bsd/dhcpcd/hooks/01-test
N src/external/bsd/dhcpcd/hooks/02-dump
N src/external/bsd/dhcpcd/hooks/dhcpcd-run-hooks.8.in
N src/external/bsd/dhcpcd/hooks/10-wpa_supplicant
N src/external/bsd/dhcpcd/hooks/20-resolv.conf
N src/external/bsd/dhcpcd/hooks/29-lookup-hostname
N src/external/bsd/dhcpcd/hooks/30-hostname
N src/external/bsd/dhcpcd/hooks/50-dhcpcd-compat
N src/external/bsd/dhcpcd/hooks/50-ntp.conf
N src/external/bsd/dhcpcd/hooks/50-yp.conf
N 

Re: CVS commit: src/tests/lib/libcurses

2019-06-26 Thread Roy Marples

On 25/06/2019 23:19, Brett Lymn wrote:

Module Name:src
Committed By:   blymn
Date:   Tue Jun 25 22:19:29 UTC 2019

Modified Files:
src/tests/lib/libcurses: t_curses.sh
src/tests/lib/libcurses/tests: mvscanw

Log Message:
Fixed mvscanw test but leave disabled for the moment, the return for
mvscanw is incorrect in libcurses, we need a major lib version bump
to correct it.


Can we do this before -9?

Roy


CVS commit: src/sys/dev/audio

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 07:47:25 UTC 2019

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

Log Message:
Improve debug message and remove duplicated one.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.21 src/sys/dev/audio/audio.c:1.22
--- src/sys/dev/audio/audio.c:1.21	Wed Jun 26 06:57:45 2019
+++ src/sys/dev/audio/audio.c	Wed Jun 26 07:47:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.21 2019/06/26 06:57:45 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.22 2019/06/26 07:47:25 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.21 2019/06/26 06:57:45 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.22 2019/06/26 07:47:25 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1858,8 +1858,9 @@ audio_open(dev_t dev, struct audio_softc
 	KASSERT(mutex_owned(sc->sc_lock));
 	KASSERT(sc->sc_exlock);
 
-	TRACE(1, "%sflags=0x%x po=%d ro=%d",
+	TRACE(1, "%sdev=%s flags=0x%x po=%d ro=%d",
 	(audiodebug >= 3) ? "start " : "",
+	ISDEVSOUND(dev) ? "sound" : "audio",
 	flags, sc->sc_popens, sc->sc_ropens);
 
 	af = kmem_zalloc(sizeof(audio_file_t), KM_SLEEP);
@@ -2236,8 +2237,6 @@ audio_read(struct audio_softc *sc, struc
 		return EBADF;
 	}
 
-	TRACET(3, track, "resid=%zd", uio->uio_resid);
-
 	usrbuf = >usrbuf;
 	input = track->input;
 



CVS commit: src/sys/dev/audio

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 07:47:25 UTC 2019

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

Log Message:
Improve debug message and remove duplicated one.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/audio/audio.c

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



CVS commit: src

2019-06-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 26 07:33:19 UTC 2019

Modified Files:
src/distrib/pmax/ramdisk: Makefile
src/sys/arch/pmax/conf: RAMDISK

Log Message:
Bump ramdisk slightly (non MKREPRO builds with long paths fail otherwise)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/distrib/pmax/ramdisk/Makefile
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/pmax/conf/RAMDISK

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

Modified files:

Index: src/distrib/pmax/ramdisk/Makefile
diff -u src/distrib/pmax/ramdisk/Makefile:1.51 src/distrib/pmax/ramdisk/Makefile:1.52
--- src/distrib/pmax/ramdisk/Makefile:1.51	Wed Apr  3 11:29:39 2019
+++ src/distrib/pmax/ramdisk/Makefile	Wed Jun 26 07:33:19 2019
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile,v 1.51 2019/04/03 11:29:39 christos Exp $
+#	$NetBSD: Makefile,v 1.52 2019/06/26 07:33:19 martin Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
 IMAGETAR=	diskimage.tgz
-IMAGESIZE=	4100k
+IMAGESIZE=	4200k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1

Index: src/sys/arch/pmax/conf/RAMDISK
diff -u src/sys/arch/pmax/conf/RAMDISK:1.17 src/sys/arch/pmax/conf/RAMDISK:1.18
--- src/sys/arch/pmax/conf/RAMDISK:1.17	Wed Apr  3 11:30:28 2019
+++ src/sys/arch/pmax/conf/RAMDISK	Wed Jun 26 07:33:19 2019
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.17 2019/04/03 11:30:28 christos Exp $
+# 	$NetBSD: RAMDISK,v 1.18 2019/06/26 07:33:19 martin Exp $
 #
 # Install kernel with ramdisk added.
 # The ramdisk is be too big to netboot directly via ECOFF on some machines,
@@ -13,7 +13,7 @@ include	"arch/pmax/conf/INSTALL"
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# force root on memory disk
 options 	MEMORY_DISK_SERVER=0	# no userspace memory disk support
-options 	MEMORY_DISK_ROOT_SIZE=8200	# size of memory disk, in blocks (4100kB)
+options 	MEMORY_DISK_ROOT_SIZE=8400	# size of memory disk, in blocks (4200kB)
 #options 	MEMORY_DISK_ROOT_SIZE=2880	# 1.44M, same as a floppy
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 



CVS commit: src

2019-06-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jun 26 07:33:19 UTC 2019

Modified Files:
src/distrib/pmax/ramdisk: Makefile
src/sys/arch/pmax/conf: RAMDISK

Log Message:
Bump ramdisk slightly (non MKREPRO builds with long paths fail otherwise)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/distrib/pmax/ramdisk/Makefile
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/pmax/conf/RAMDISK

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



CVS commit: src/sys/dev/audio

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 06:57:45 UTC 2019

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

Log Message:
Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible.  It may improve timbre.
  If it cannot represent a sine wave, it falls back to a triangular
  wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
  Now audiobellopen() initializes playback parameters other than
  sample_rate, and new audiobellsetrate() sets sample_rate.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio/audiobell.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/audio/audiodef.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio/audiovar.h

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



CVS commit: src/sys/dev/audio

2019-06-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Jun 26 06:57:45 UTC 2019

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

Log Message:
Improve audiobell (and interfaces with audio).
- Generate pseudo sine wave if possible.  It may improve timbre.
  If it cannot represent a sine wave, it falls back to a triangular
  wave or a rectangular wave.
- Volume adjustment.
- Calculate playback frequency based on mixer frequency.
  Now audiobellopen() initializes playback parameters other than
  sample_rate, and new audiobellsetrate() sets sample_rate.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/audio/audiobell.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/audio/audiodef.h
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/audio/audiovar.h

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.20 src/sys/dev/audio/audio.c:1.21
--- src/sys/dev/audio/audio.c:1.20	Tue Jun 25 13:07:48 2019
+++ src/sys/dev/audio/audio.c	Wed Jun 26 06:57:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.20 2019/06/25 13:07:48 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.21 2019/06/26 06:57:45 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.20 2019/06/25 13:07:48 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.21 2019/06/26 06:57:45 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -458,28 +458,6 @@ audio_track_bufstat(audio_track_t *track
 #define SPECIFIED(x)	((x) != ~0)
 #define SPECIFIED_CH(x)	((x) != (u_char)~0)
 
-/*
- * AUDIO_SCALEDOWN()
- * This macro should be used for audio wave data only.
- *
- * The arithmetic shift right (ASR) (in other words, floor()) is good for
- * this purpose, and will be faster than division on the most platform.
- * The division (in other words, truncate()) is not so bad alternate for
- * this purpose, and will be fast enough.
- * (Using ASR is 1.9 times faster than division on my amd64, and 1.3 times
- * faster on my m68k.  -- isaki 201801.)
- *
- * However, the right shift operator ('>>') for negative integer is
- * "implementation defined" behavior in C (note that it's not "undefined"
- * behavior).  So only if implementation defines '>>' as ASR, we use it.
- */
-#if defined(__GNUC__)
-/* gcc defines '>>' as ASR. */
-#define AUDIO_SCALEDOWN(value, bits)	((value) >> (bits))
-#else
-#define AUDIO_SCALEDOWN(value, bits)	((value) / (1 << (bits)))
-#endif
-
 /* Device timeout in msec */
 #define AUDIO_TIMEOUT	(3000)
 
@@ -539,7 +517,7 @@ static void filt_audioread_detach(struct
 static int  filt_audioread_event(struct knote *, long);
 
 static int audio_open(dev_t, struct audio_softc *, int, int, struct lwp *,
-	struct audiobell_arg *);
+	audio_file_t **);
 static int audio_close(struct audio_softc *, audio_file_t *);
 static int audio_read(struct audio_softc *, struct uio *, int, audio_file_t *);
 static int audio_write(struct audio_softc *, struct uio *, int, audio_file_t *);
@@ -1782,14 +1760,11 @@ audiommap(struct file *fp, off_t *offp, 
 
 /*
  * Open for audiobell.
- * sample_rate, encoding, precision and channels in arg are in-parameter
- * and indicates input encoding.
- * Stores allocated file to arg->file.
- * Stores blocksize to arg->blocksize.
+ * It stores allocated file to *filep.
  * If successful returns 0, otherwise errno.
  */
 int
-audiobellopen(dev_t dev, struct audiobell_arg *arg)
+audiobellopen(dev_t dev, audio_file_t **filep)
 {
 	struct audio_softc *sc;
 	int error;
@@ -1804,7 +1779,7 @@ audiobellopen(dev_t dev, struct audiobel
 		return error;
 
 	device_active(sc->sc_dev, DVA_SYSTEM);
-	error = audio_open(dev, sc, FWRITE, 0, curlwp, arg);
+	error = audio_open(dev, sc, FWRITE, 0, curlwp, filep);
 
 	audio_exit_exclusive(sc);
 	return error;
@@ -1830,6 +1805,28 @@ audiobellclose(audio_file_t *file)
 	return error;
 }
 
+/* Set sample rate for audiobell */
+int
+audiobellsetrate(audio_file_t *file, u_int sample_rate)
+{
+	struct audio_softc *sc;
+	struct audio_info ai;
+	int error;
+
+	sc = file->sc;
+
+	AUDIO_INITINFO();
+	ai.play.sample_rate = sample_rate;
+
+	error = audio_enter_exclusive(sc);
+	if (error)
+		return error;
+	error = audio_file_setinfo(sc, file, );
+	audio_exit_exclusive(sc);
+
+	return error;
+}
+
 /* Playback for audiobell */
 int
 audiobellwrite(audio_file_t *file, struct uio *uio)
@@ -1848,7 +1845,7 @@ audiobellwrite(audio_file_t *file, struc
  */
 int
 audio_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
-	struct lwp *l, struct audiobell_arg *bell)
+	struct lwp *l, audio_file_t **bellfile)
 {
 	struct audio_info ai;
 	struct file *fp;
@@ -1912,11 +1909,12 @@ audio_open(dev_t dev, struct audio_softc
 
 	/* Set parameters */
 	AUDIO_INITINFO();
-	if (bell) {
-		ai.play.sample_rate