CVS commit: src/sys/dev/audio

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 07:13:37 UTC 2020

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

Log Message:
Release memories on audiobellclose.
It's rest of the last commit.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 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.56 src/sys/dev/audio/audio.c:1.57
--- src/sys/dev/audio/audio.c:1.56	Sun Feb 23 07:17:01 2020
+++ src/sys/dev/audio/audio.c	Sat Feb 29 07:13:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.56 2020/02/23 07:17:01 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.57 2020/02/29 07:13:37 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.56 2020/02/23 07:17:01 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.57 2020/02/29 07:13:37 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -1956,6 +1956,11 @@ audiobellclose(audio_file_t *file)
 	error = audio_close(sc, file);
 
 	audio_file_exit(sc, _ref);
+
+	KASSERT(file->ptrack);
+	audio_track_destroy(file->ptrack);
+	KASSERT(file->rtrack == NULL);
+	kmem_free(file, sizeof(*file));
 	return error;
 }
 



CVS commit: src/sys/dev/pci

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 06:34:30 UTC 2020

Modified Files:
src/sys/dev/pci: auacer.c auich.c auixp.c

Log Message:
round_blocksize must return a multiple of the framesize
even if 6 channels mode.
I believe that keeping "good alignment" is just a wish, not constraint.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/pci/auacer.c
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pci/auixp.c

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

Modified files:

Index: src/sys/dev/pci/auacer.c
diff -u src/sys/dev/pci/auacer.c:1.38 src/sys/dev/pci/auacer.c:1.39
--- src/sys/dev/pci/auacer.c:1.38	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/auacer.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: auacer.c,v 1.39 2020/02/29 06:34:30 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.39 2020/02/29 06:34:30 isaki Exp $");
 
 #include 
 #include 
@@ -154,8 +154,6 @@ static int	auacer_query_format(void *, a
 static int	auacer_set_format(void *, int,
  const audio_params_t *, const audio_params_t *,
  audio_filter_reg_t *, audio_filter_reg_t *);
-static int	auacer_round_blocksize(void *, int, int,
-   const audio_params_t *);
 static int	auacer_halt_output(void *);
 static int	auacer_halt_input(void *);
 static int	auacer_getdev(void *, struct audio_device *);
@@ -188,7 +186,6 @@ static void auacer_reset(struct auacer_s
 static const struct audio_hw_if auacer_hw_if = {
 	.query_format		= auacer_query_format,
 	.set_format		= auacer_set_format,
-	.round_blocksize	= auacer_round_blocksize,
 	.halt_output		= auacer_halt_output,
 	.halt_input		= auacer_halt_input,
 	.getdev			= auacer_getdev,
@@ -562,14 +559,6 @@ auacer_set_format(void *v, int setmode,
 	return 0;
 }
 
-static int
-auacer_round_blocksize(void *v, int blk, int mode,
-const audio_params_t *param)
-{
-
-	return blk & ~0x3f;		/* keep good alignment */
-}
-
 static void
 auacer_halt(struct auacer_softc *sc, struct auacer_chan *chan)
 {

Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.158 src/sys/dev/pci/auich.c:1.159
--- src/sys/dev/pci/auich.c:1.158	Fri Dec  6 07:27:07 2019
+++ src/sys/dev/pci/auich.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auich.c,v 1.158 2019/12/06 07:27:07 maxv Exp $	*/
+/*	$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.158 2019/12/06 07:27:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.159 2020/02/29 06:34:30 isaki Exp $");
 
 #include 
 #include 
@@ -259,7 +259,6 @@ static int	auich_query_format(void *, st
 static int	auich_set_format(void *, int,
 		const audio_params_t *, const audio_params_t *,
 		audio_filter_reg_t *, audio_filter_reg_t *);
-static int	auich_round_blocksize(void *, int, int, const audio_params_t *);
 static void	auich_halt_pipe(struct auich_softc *, int);
 static int	auich_halt_output(void *);
 static int	auich_halt_input(void *);
@@ -304,7 +303,6 @@ static const struct audio_hw_if auich_hw
 	.close			= auich_close,
 	.query_format		= auich_query_format,
 	.set_format		= auich_set_format,
-	.round_blocksize	= auich_round_blocksize,
 	.halt_output		= auich_halt_output,
 	.halt_input		= auich_halt_input,
 	.getdev			= auich_getdev,
@@ -1053,17 +1051,6 @@ auich_set_format(void *v, int setmode,
 	return 0;
 }
 
-static int
-auich_round_blocksize(void *v, int blk, int mode,
-const audio_params_t *param)
-{
-
-	if (blk < 0x40)
-		return 0x40;		/* avoid 0 block size */
-
-	return blk & ~0x3f;		/* keep good alignment */
-}
-
 static void
 auich_halt_pipe(struct auich_softc *sc, int pipe)
 {

Index: src/sys/dev/pci/auixp.c
diff -u src/sys/dev/pci/auixp.c:1.48 src/sys/dev/pci/auixp.c:1.49
--- src/sys/dev/pci/auixp.c:1.48	Wed Oct 16 21:52:22 2019
+++ src/sys/dev/pci/auixp.c	Sat Feb 29 06:34:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auixp.c,v 1.48 2019/10/16 21:52:22 maya Exp $ */
+/* $NetBSD: auixp.c,v 1.49 2020/02/29 06:34:30 isaki Exp $ */
 
 /*
  * Copyright (c) 2004, 2005 Reinoud Zandijk 
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.48 2019/10/16 21:52:22 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.49 2020/02/29 06:34:30 isaki Exp $");
 
 #include 
 #include 
@@ -422,16 +422,13 @@ static int
 auixp_round_blocksize(void *hdl, int bs, int mode,
 const audio_params_t *param)
 {
-	uint32_t new_bs;
 
-	new_bs = bs;
-	/* Be conservative; align to 32 bytes and maximise it to 64 kb */
 	/* 256 kb possible */
-	if (new_bs > 

CVS commit: src/sys/dev/pci

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 06:25:33 UTC 2020

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

Log Message:
round_blocksize must return a multiple of the framesize.
It's not divisible when blk=GCSCAUDI_PRD_SIZE_MAX and channels=4.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/gcscaudio.c

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

Modified files:

Index: src/sys/dev/pci/gcscaudio.c
diff -u src/sys/dev/pci/gcscaudio.c:1.18 src/sys/dev/pci/gcscaudio.c:1.19
--- src/sys/dev/pci/gcscaudio.c:1.18	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/gcscaudio.c	Sat Feb 29 06:25:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: gcscaudio.c,v 1.18 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: gcscaudio.c,v 1.19 2020/02/29 06:25:33 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 SHIMIZU Ryo 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.18 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.19 2020/02/29 06:25:33 isaki Exp $");
 
 #include 
 #include 
@@ -549,9 +549,10 @@ static int
 gcscaudio_round_blocksize(void *arg, int blk, int mode,
   const audio_params_t *param)
 {
-	blk &= -4;
+
 	if (blk > GCSCAUDIO_PRD_SIZE_MAX)
 		blk = GCSCAUDIO_PRD_SIZE_MAX;
+	blk = rounddown(blk, param->channels * param->precision / NBBY);
 
 	return blk;
 }



CVS commit: src/sys/dev/sbus

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 06:06:29 UTC 2020

Modified Files:
src/sys/dev/sbus: dbri.c

Log Message:
round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sbus/dbri.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/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.41 src/sys/dev/sbus/dbri.c:1.42
--- src/sys/dev/sbus/dbri.c:1.41	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/sbus/dbri.c	Sat Feb 29 06:06:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $	*/
 
 /*
  * Copyright (C) 1997 Rudolf Koenig (rfkoe...@immd4.informatik.uni-erlangen.de)
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.42 2020/02/29 06:06:29 isaki Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -1636,8 +1636,8 @@ dbri_round_blocksize(void *hdl, int bs, 
 			const audio_params_t *param)
 {
 
-	if (bs > 0x1fff)
-		return 0x1fff;
+	if (bs > 0x1ffc)
+		return 0x1ffc;
 	return bs;
 }
 



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

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 06:03:55 UTC 2020

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

Log Message:
round_blocksize must return a multiple of the framesize.
aucc(4) supports 3 channels mode.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amiga/dev/aucc.c

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

Modified files:

Index: src/sys/arch/amiga/dev/aucc.c
diff -u src/sys/arch/amiga/dev/aucc.c:1.47 src/sys/arch/amiga/dev/aucc.c:1.48
--- src/sys/arch/amiga/dev/aucc.c:1.47	Sat Sep  7 11:57:08 2019
+++ src/sys/arch/amiga/dev/aucc.c	Sat Feb 29 06:03:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: aucc.c,v 1.47 2019/09/07 11:57:08 rin Exp $ */
+/*	$NetBSD: aucc.c,v 1.48 2020/02/29 06:03:55 isaki Exp $ */
 
 /*
  * Copyright (c) 1999 Bernardo Innocenti
@@ -46,7 +46,7 @@
 #if NAUCC > 0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.47 2019/09/07 11:57:08 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.48 2020/02/29 06:03:55 isaki Exp $");
 
 #include 
 #include 
@@ -404,8 +404,11 @@ aucc_round_blocksize(void *addr, int blk
 		 int mode, const audio_params_t *param)
 {
 
-	/* round up to even size */
-	return blk > AUDIO_BUF_SIZE ? AUDIO_BUF_SIZE : blk;
+	if (blk > AUDIO_BUF_SIZE)
+		blk = AUDIO_BUF_SIZE;
+
+	blk = rounddown(blk, param->channels * param->precision / NBBY);
+	return blk;
 }
 
 int



CVS commit: src/sys

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 05:51:11 UTC 2020

Modified Files:
src/sys/arch/amiga/dev: toccata.c
src/sys/arch/arm/rockchip: rk_i2s.c
src/sys/arch/arm/sunxi: sunxi_codec.c sunxi_i2s.c
src/sys/arch/evbarm/mini2440: audio_mini2440.c
src/sys/arch/prep/isa: paud_isa.c
src/sys/dev/ic: ad1848.c ad1848var.h interwave.c interwavevar.h pl041.c
src/sys/dev/isa: gus.c wss.c ym.c
src/sys/dev/isapnp: gus_isapnp.c
src/sys/dev/pci: autri.c cmpci.c yds.c

Log Message:
Remove rounding by 4 bytes on round_blocksize().
For drivers which supports only 16bit * 2channels sampling,
rounding by 4 bytes no longer meaningful.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amiga/dev/toccata.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/rockchip/rk_i2s.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sunxi_codec.c \
src/sys/arch/arm/sunxi/sunxi_i2s.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/mini2440/audio_mini2440.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/prep/isa/paud_isa.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/ad1848.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ad1848var.h \
src/sys/dev/ic/interwavevar.h
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/interwave.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/pl041.c
cvs rdiff -u -r1.117 -r1.118 src/sys/dev/isa/gus.c
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/isa/wss.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/isa/ym.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/isapnp/gus_isapnp.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/pci/autri.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/pci/cmpci.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/yds.c

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

Modified files:

Index: src/sys/arch/amiga/dev/toccata.c
diff -u src/sys/arch/amiga/dev/toccata.c:1.20 src/sys/arch/amiga/dev/toccata.c:1.21
--- src/sys/arch/amiga/dev/toccata.c:1.20	Sat Jun  8 08:02:36 2019
+++ src/sys/arch/amiga/dev/toccata.c	Sat Feb 29 05:51:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: toccata.c,v 1.20 2019/06/08 08:02:36 isaki Exp $ */
+/* $NetBSD: toccata.c,v 1.21 2020/02/29 05:51:10 isaki Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.20 2019/06/08 08:02:36 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.21 2020/02/29 05:51:10 isaki Exp $");
 
 #include 
 #include 
@@ -415,11 +415,10 @@ int
 toccata_round_blocksize(void *addr, int blk,
 			int mode, const audio_params_t *param)
 {
-	int ret;
 
-	ret = blk > 512 ? 512 : (blk & -4);
-
-	return ret;
+	if (blk > 512)
+		blk = 512;
+	return blk;
 }
 
 size_t

Index: src/sys/arch/arm/rockchip/rk_i2s.c
diff -u src/sys/arch/arm/rockchip/rk_i2s.c:1.2 src/sys/arch/arm/rockchip/rk_i2s.c:1.3
--- src/sys/arch/arm/rockchip/rk_i2s.c:1.2	Sat Jan  4 13:54:04 2020
+++ src/sys/arch/arm/rockchip/rk_i2s.c	Sat Feb 29 05:51:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk_i2s.c,v 1.2 2020/01/04 13:54:04 jmcneill Exp $ */
+/* $NetBSD: rk_i2s.c,v 1.3 2020/02/29 05:51:10 isaki Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.2 2020/01/04 13:54:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rk_i2s.c,v 1.3 2020/02/29 05:51:10 isaki Exp $");
 
 #include 
 #include 
@@ -231,16 +231,6 @@ rk_i2s_get_props(void *priv)
 	AUDIO_PROP_FULLDUPLEX;
 }
 
-static int
-rk_i2s_round_blocksize(void *priv, int bs, int mode,
-const audio_params_t *params)
-{
-	bs &= ~3;
-	if (bs == 0)
-		bs = 4;
-	return bs;
-}
-
 static void *
 rk_i2s_allocm(void *priv, int dir, size_t size)
 {
@@ -360,7 +350,6 @@ static const struct audio_hw_if rk_i2s_h
 	.query_format = rk_i2s_query_format,
 	.set_format = rk_i2s_set_format,
 	.get_props = rk_i2s_get_props,
-	.round_blocksize = rk_i2s_round_blocksize,
 	.allocm = rk_i2s_allocm,
 	.freem = rk_i2s_freem,
 	.trigger_output = rk_i2s_trigger_output,

Index: src/sys/arch/arm/sunxi/sunxi_codec.c
diff -u src/sys/arch/arm/sunxi/sunxi_codec.c:1.7 src/sys/arch/arm/sunxi/sunxi_codec.c:1.8
--- src/sys/arch/arm/sunxi/sunxi_codec.c:1.7	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/arm/sunxi/sunxi_codec.c	Sat Feb 29 05:51:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_codec.c,v 1.7 2019/06/08 08:02:37 isaki Exp $ */
+/* $NetBSD: sunxi_codec.c,v 1.8 2020/02/29 05:51:10 isaki Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.7 2019/06/08 08:02:37 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_codec.c,v 1.8 2020/02/29 05:51:10 isaki Exp $");
 
 #include 
 #include 
@@ -261,16 +261,6 @@ sunxi_codec_get_props(void *priv)
 }
 
 static int
-sunxi_codec_round_blocksize(void *priv, int bs, int mode,
-const audio_params_t *params)
-{
-	bs &= ~3;
-	if (bs == 0)
-		bs = 4;

CVS commit: src/share/man/man9

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Feb 29 05:39:03 UTC 2020

Modified Files:
src/share/man/man9: audio.9

Log Message:
Describe about (existing) constraints on round_blocksize().


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/share/man/man9/audio.9

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

Modified files:

Index: src/share/man/man9/audio.9
diff -u src/share/man/man9/audio.9:1.57 src/share/man/man9/audio.9:1.58
--- src/share/man/man9/audio.9:1.57	Sun Feb 23 04:02:45 2020
+++ src/share/man/man9/audio.9	Sat Feb 29 05:39:03 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.9,v 1.57 2020/02/23 04:02:45 isaki Exp $
+.\"	$NetBSD: audio.9,v 1.58 2020/02/29 05:39:03 isaki Exp $
 .\"
 .\" Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -344,8 +344,12 @@ or
 and
 .Va param ,
 encoding parameters for the hardware.
+.Va bs
+passed is always non-zero and a multiple of the frame size represented by
+param->channels * param->precision / 8.
 It should return a block size, possibly changed according to the needs
 of the hardware driver.
+The return value also must be non-zero and a multiple of the frame size.
 It is called in the Attach or Closed phases.
 .It Dv int commit_settings(void *hdl)
 optional, is called after all calls to



CVS commit: src/sys/dev/usb

2020-02-28 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Feb 29 04:27:53 UTC 2020

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

Log Message:
add comments to show the RX filter intent


To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/sys/dev/usb/if_axe.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_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.125 src/sys/dev/usb/if_axe.c:1.126
--- src/sys/dev/usb/if_axe.c:1.125	Sat Feb 29 04:02:06 2020
+++ src/sys/dev/usb/if_axe.c	Sat Feb 29 04:27:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.125 2020/02/29 04:02:06 nisimura Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.126 2020/02/29 04:27:53 nisimura Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.125 2020/02/29 04:02:06 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.126 2020/02/29 04:27:53 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -475,15 +475,15 @@ axe_setiff_locked(struct usbnet *un)
 	}
 	ETHER_UNLOCK(ec);
 
-	rxmode |= AXE_RXCMD_MULTICAST;
+	rxmode |= AXE_RXCMD_MULTICAST;	/* activate mcast hash filter */
 	axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, hashtbl);
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 	return;
 
  allmulti:
 	if (ifp->if_flags & IFF_PROMISC)
-		rxmode |= AXE_RXCMD_PROMISC;
-	rxmode |= AXE_RXCMD_ALLMULTI;
+		rxmode |= AXE_RXCMD_PROMISC; /* run promisc. mode */
+	rxmode |= AXE_RXCMD_ALLMULTI;	/* accept all mcast frames */
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 }
 



CVS commit: src/doc

2020-02-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 29 04:27:01 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
ld.elf_so(1): Implement DT_GNU_HASH


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

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2653 src/doc/CHANGES:1.2654
--- src/doc/CHANGES:1.2653	Thu Feb 27 00:29:17 2020
+++ src/doc/CHANGES	Sat Feb 29 04:27:01 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2653 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2654 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -147,3 +147,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	genet(4): Add support for Broadcom GENETv5 ethernet controllers, found
 		in the Raspberry Pi 4. [jmcneill 20200222]
 	OpenSSH: Import 8.2. [christos 20200226]
+	ld.elf_so(1): Implement DT_GNU_HASH [kamil 20200229]



CVS commit: src/libexec/ld.elf_so

2020-02-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 29 04:24:34 UTC 2020

Modified Files:
src/libexec/ld.elf_so: headers.c reloc.c rtld.h symbol.c

Log Message:
Implement DT_GNU_HASH

DT_GNU_HASH serves the same purpose as DT_HASH, however it is a distinct
and faster apprach implemented and designed in the GNU toolchain in 2006.

DT_GNU_HASH is preferred whenever available.

Original GNU benchmarks claim 50% faster dynamic linking time.
https://www.sourceware.org/ml/binutils/2006-06/msg00418.html

Code based on FreeBSD and OpenBSD, both were based on DragonFlyBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/libexec/ld.elf_so/headers.c
cvs rdiff -u -r1.115 -r1.116 src/libexec/ld.elf_so/reloc.c
cvs rdiff -u -r1.137 -r1.138 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.71 -r1.72 src/libexec/ld.elf_so/symbol.c

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

Modified files:

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.65 src/libexec/ld.elf_so/headers.c:1.66
--- src/libexec/ld.elf_so/headers.c:1.65	Sun Dec 30 11:55:15 2018
+++ src/libexec/ld.elf_so/headers.c	Sat Feb 29 04:24:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.65 2018/12/30 11:55:15 martin Exp $	 */
+/*	$NetBSD: headers.c,v 1.66 2020/02/29 04:24:33 kamil Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: headers.c,v 1.65 2018/12/30 11:55:15 martin Exp $");
+__RCSID("$NetBSD: headers.c,v 1.66 2020/02/29 04:24:33 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -166,26 +166,87 @@ _rtld_digest_dynamic(const char *execnam
 
 		case DT_HASH:
 			{
+uint32_t nbuckets, nchains;
 const Elf_Symindx *hashtab = (const Elf_Symindx *)
 (obj->relocbase + dynp->d_un.d_ptr);
 
 if (hashtab[0] > UINT32_MAX)
-	obj->nbuckets = UINT32_MAX;
+	nbuckets = UINT32_MAX;
 else
-	obj->nbuckets = hashtab[0];
-obj->nchains = hashtab[1];
+	nbuckets = hashtab[0];
+obj->nbuckets = nbuckets;
+obj->nchains = (nchains = hashtab[1]);
 obj->buckets = hashtab + 2;
 obj->chains = obj->buckets + obj->nbuckets;
+
+/* Validity check */
+if (!obj->buckets || !nbuckets || !nchains)
+	continue;
+
+obj->sysv_hash = true;
+
+/*
+ * Should really be in _rtld_relocate_objects,
+ * but _rtld_symlook_obj might be used before.
+ */
+fast_divide32_prepare(obj->nbuckets,
+>nbuckets_m,
+>nbuckets_s1,
+>nbuckets_s2);
+			}
+			break;
+
+		case DT_GNU_HASH:
+			{
+uint32_t nmaskwords;
+uint32_t nbuckets, symndx;
+int bloom_size32;
+bool nmw_power2;
+const Elf_Symindx *hashtab = (const Elf_Symindx *)
+(obj->relocbase + dynp->d_un.d_ptr);
+
+if (hashtab[0] > UINT32_MAX)
+	nbuckets = UINT32_MAX;
+else
+	nbuckets = hashtab[0];
+obj->nbuckets_gnu = nbuckets;
+
+nmaskwords = hashtab[2];
+bloom_size32 = nmaskwords * (ELFSIZE / 32);
+
+obj->buckets_gnu = hashtab + 4 + bloom_size32;
+
+nmw_power2 = powerof2(nmaskwords);
+
+/* Validity check */
+if (!nmw_power2 || !nbuckets || !obj->buckets_gnu)
+	continue;
+
+obj->gnu_hash = true;
+
+obj->mask_bm_gnu = nmaskwords - 1;
+obj->symndx_gnu = (symndx = hashtab[1]);
+obj->shift2_gnu = hashtab[3];
+obj->bloom_gnu = (const Elf_Addr *)(hashtab + 4);
+obj->chains_gnu = obj->buckets_gnu + nbuckets - symndx;
+
 /*
  * Should really be in _rtld_relocate_objects,
  * but _rtld_symlook_obj might be used before.
  */
-if (obj->nbuckets) {
-	fast_divide32_prepare(obj->nbuckets,
-	>nbuckets_m,
-	>nbuckets_s1,
-	>nbuckets_s2);
-}
+fast_divide32_prepare(nbuckets,
+>nbuckets_m_gnu,
+>nbuckets_s1_gnu,
+>nbuckets_s2_gnu);
+
+dbg(("found GNU Hash: buckets=%p "
+ "nbuckets=%lu chains=%p nchains=%u "
+ "bloom=%p mask_bm=%u shift2=%u "
+ "symndx=%u",
+obj->buckets_gnu, obj->nbuckets_gnu,
+obj->chains_gnu, obj->nchains_gnu,
+obj->bloom_gnu, obj->mask_bm_gnu,
+obj->shift2_gnu, obj->symndx_gnu));
 			}
 			break;
 
@@ -352,6 +413,26 @@ _rtld_digest_dynamic(const char *execnam
 			obj->relalim = obj->pltrela;
 	}
 
+	/* If the ELF Hash is present, "nchains" is the same in both hashes. */
+	if (!obj->sysv_hash && obj->gnu_hash) {
+		uint_fast32_t i, nbucket, symndx;
+
+		/* Otherwise, count the entries from the GNU Hash chain. */
+		nbucket = obj->nbuckets_gnu;
+		symndx = obj->symndx_gnu;
+
+		for (i = 0; i < nbucket; i++) {
+			Elf_Word bkt = obj->buckets_gnu[i];
+			if (bkt == 0)
+continue;
+			const uint32_t *hashval = >chains_gnu[bkt];
+			do {
+symndx++;
+			} while ((*hashval++ & 1U) == 0);
+		}
+		obj->nchains_gnu = (uint32_t)symndx;
+	}
+
 #ifdef RTLD_LOADER
 	if (init != 0)
 		obj->init = (Elf_Addr) 

CVS commit: src/libexec/ld.elf_so

2020-02-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 29 04:23:05 UTC 2020

Modified Files:
src/libexec/ld.elf_so: reloc.c rtld.c rtld.h symbol.c

Log Message:
Implement and integrate GNU Hashing function

Define Elf_Hash struct that contains ELF/SYSV and GNU hash checksum.
Implement _rtld_gnu_hash() for DT_GNU_HASH.
Adapt existing code to compute all Elf_Hash types, instead of only
the ELF/SYSV one.
Rename _rtld_elf_hash() to _rtld_sysv_hash() to match the GNU toolchain
terminology.

_rtld_gnu_hash() uses Dan Bernstein's string hash function posted eons ago
on comp.lang.c.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/libexec/ld.elf_so/reloc.c
cvs rdiff -u -r1.201 -r1.202 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.136 -r1.137 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.70 -r1.71 src/libexec/ld.elf_so/symbol.c

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

Modified files:

Index: src/libexec/ld.elf_so/reloc.c
diff -u src/libexec/ld.elf_so/reloc.c:1.114 src/libexec/ld.elf_so/reloc.c:1.115
--- src/libexec/ld.elf_so/reloc.c:1.114	Sun Dec 30 01:48:37 2018
+++ src/libexec/ld.elf_so/reloc.c	Sat Feb 29 04:23:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: reloc.c,v 1.114 2018/12/30 01:48:37 christos Exp $	 */
+/*	$NetBSD: reloc.c,v 1.115 2020/02/29 04:23:05 kamil Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -39,7 +39,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: reloc.c,v 1.114 2018/12/30 01:48:37 christos Exp $");
+__RCSID("$NetBSD: reloc.c,v 1.115 2020/02/29 04:23:05 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -67,12 +67,15 @@ _rtld_do_copy_relocation(const Obj_Entry
 	void   *dstaddr = (void *)(dstobj->relocbase + rela->r_offset);
 	const Elf_Sym  *dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info);
 	const char *name = dstobj->strtab + dstsym->st_name;
-	unsigned long   hash = _rtld_elf_hash(name);
+	Elf_Hashhash;
 	size_t  size = dstsym->st_size;
 	const void *srcaddr;
 	const Elf_Sym  *srcsym = NULL;
 	Obj_Entry  *srcobj;
 
+	hash.sysv = _rtld_sysv_hash(name);
+	hash.gnu = _rtld_gnu_hash(name);
+
 	if (__predict_false(size == 0)) {
 #if defined(__powerpc__) && !defined(__LP64) /* PR port-macppc/47464 */
 		if (strcmp(name, "_SDA_BASE_") == 0
@@ -90,7 +93,7 @@ _rtld_do_copy_relocation(const Obj_Entry
 	}
 
 	for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next) {
-		srcsym = _rtld_symlook_obj(name, hash, srcobj, 0,
+		srcsym = _rtld_symlook_obj(name, , srcobj, 0,
 		_rtld_fetch_ventry(dstobj, ELF_R_SYM(rela->r_info)));
 		if (srcsym != NULL)
 			break;

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.201 src/libexec/ld.elf_so/rtld.c:1.202
--- src/libexec/ld.elf_so/rtld.c:1.201	Sun Dec  8 22:35:27 2019
+++ src/libexec/ld.elf_so/rtld.c	Sat Feb 29 04:23:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.201 2019/12/08 22:35:27 uwe Exp $	 */
+/*	$NetBSD: rtld.c,v 1.202 2020/02/29 04:23:05 kamil Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.201 2019/12/08 22:35:27 uwe Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.202 2020/02/29 04:23:05 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -1098,16 +1098,17 @@ dlopen(const char *name, int mode)
 void *
 _rtld_objmain_sym(const char *name)
 {
-	unsigned long hash;
+	Elf_Hash hash;
 	const Elf_Sym *def;
 	const Obj_Entry *obj;
 	DoneList donelist;
 
-	hash = _rtld_elf_hash(name);
+	hash.sysv = _rtld_sysv_hash(name);
+	hash.gnu = _rtld_gnu_hash(name);
 	obj = _rtld_objmain;
 	_rtld_donelist_init();
 
-	def = _rtld_symlook_list(name, hash, &_rtld_list_main, , 0,
+	def = _rtld_symlook_list(name, , &_rtld_list_main, , 0,
 	NULL, );
 
 	if (def != NULL)
@@ -1142,7 +1143,7 @@ static void *
 do_dlsym(void *handle, const char *name, const Ver_Entry *ventry, void *retaddr)
 {
 	const Obj_Entry *obj;
-	unsigned long hash;
+	Elf_Hash hash;
 	const Elf_Sym *def;
 	const Obj_Entry *defobj;
 	DoneList donelist;
@@ -1153,7 +1154,8 @@ do_dlsym(void *handle, const char *name,
 
 	lookup_mutex_enter();
 
-	hash = _rtld_elf_hash(name);
+	hash.sysv = _rtld_sysv_hash(name);
+	hash.gnu = _rtld_gnu_hash(name);
 	def = NULL;
 	defobj = NULL;
 
@@ -1170,7 +1172,7 @@ do_dlsym(void *handle, const char *name,
 
 		switch ((intptr_t)handle) {
 		case (intptr_t)NULL:	 /* Just the caller's shared object. */
-			def = _rtld_symlook_obj(name, hash, obj, flags, ventry);
+			def = _rtld_symlook_obj(name, , obj, flags, ventry);
 			defobj = obj;
 			break;
 
@@ -1180,7 +1182,7 @@ do_dlsym(void *handle, const char *name,
 
 		case (intptr_t)RTLD_SELF:	/* Caller included */
 			for (; obj; obj = obj->next) {
-if ((def = _rtld_symlook_obj(name, hash, obj,
+if ((def = _rtld_symlook_obj(name, , obj,
 flags, ventry)) != NULL) {
 	defobj = obj;
 	break;
@@ -1194,7 +1196,7 @@ do_dlsym(void *handle, const 

CVS commit: src/libexec/ld.elf_so

2020-02-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Feb 29 04:21:42 UTC 2020

Modified Files:
src/libexec/ld.elf_so: symbol.c

Log Message:
Separate matched symbol functionality out of _rtld_symlook_obj()

Simplifies the code and it will allow to use the matched symbol
functionality by other users.


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/libexec/ld.elf_so/symbol.c

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

Modified files:

Index: src/libexec/ld.elf_so/symbol.c
diff -u src/libexec/ld.elf_so/symbol.c:1.69 src/libexec/ld.elf_so/symbol.c:1.70
--- src/libexec/ld.elf_so/symbol.c:1.69	Wed Aug  9 18:44:32 2017
+++ src/libexec/ld.elf_so/symbol.c	Sat Feb 29 04:21:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $	 */
+/*	$NetBSD: symbol.c,v 1.70 2020/02/29 04:21:42 kamil Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: symbol.c,v 1.69 2017/08/09 18:44:32 joerg Exp $");
+__RCSID("$NetBSD: symbol.c,v 1.70 2020/02/29 04:21:42 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -193,6 +193,119 @@ _rtld_symlook_needed(const char *name, u
 	return def;
 }
 
+static bool
+_rtld_symlook_obj_matched_symbol(const char *name,
+const Obj_Entry *obj, u_int flags, const Ver_Entry *ventry,
+unsigned long symnum, const Elf_Sym **vsymp, int *vcount)
+{
+	const Elf_Sym  *symp;
+	const char *strp;
+	Elf_Half verndx;
+
+	symp = obj->symtab + symnum;
+	strp = obj->strtab + symp->st_name;
+	rdbg(("check \"%s\" vs \"%s\" in %s", name, strp, obj->path));
+	if (name[1] != strp[1] || strcmp(name, strp))
+		return false;
+#if defined(__mips__) || defined(__vax__)
+	if (symp->st_shndx == SHN_UNDEF)
+		continue;
+#else
+	/*
+	 * XXX DANGER WILL ROBINSON!
+	 * If we have a function pointer in the executable's
+	 * data section, it points to the executable's PLT
+	 * slot, and there is NO relocation emitted.  To make
+	 * the function pointer comparable to function pointers
+	 * in shared libraries, we must resolve data references
+	 * in the libraries to point to PLT slots in the
+	 * executable, if they exist.
+	 */
+	if (symp->st_shndx == SHN_UNDEF &&
+	((flags & SYMLOOK_IN_PLT) ||
+	symp->st_value == 0 ||
+	ELF_ST_TYPE(symp->st_info) != STT_FUNC))
+		return false;
+#endif
+
+	if (ventry == NULL) {
+		if (obj->versyms != NULL) {
+			verndx = VER_NDX(obj->versyms[symnum].vs_vers);
+			if (verndx > obj->vertabnum) {
+_rtld_error("%s: symbol %s references "
+"wrong version %d", obj->path,
+>strtab[symnum], verndx);
+return false;
+			}
+
+			/*
+			 * If we are not called from dlsym (i.e. this
+			 * is a normal relocation from unversioned
+			 * binary), accept the symbol immediately
+			 * if it happens to have first version after
+			 * this shared object became versioned.
+			 * Otherwise, if symbol is versioned and not
+			 * hidden, remember it. If it is the only
+			 * symbol with this name exported by the shared
+			 * object, it will be returned as a match at the
+			 * end of the function. If symbol is global
+			 * (verndx < 2) accept it unconditionally.
+			 */
+			if (!(flags & SYMLOOK_DLSYM) &&
+			verndx == VER_NDX_GIVEN) {
+*vsymp = symp;
+return true;
+			} else if (verndx >= VER_NDX_GIVEN) {
+if (!(obj->versyms[symnum].vs_vers & VER_NDX_HIDDEN)) {
+	if (*vsymp == NULL)
+		*vsymp = symp;
+	(*vcount)++;
+}
+return false;
+			}
+		}
+		*vsymp = symp;
+		return true;
+	} else {
+		if (obj->versyms == NULL) {
+			if (_rtld_object_match_name(obj, ventry->name)){
+_rtld_error("%s: object %s should "
+"provide version %s for symbol %s",
+_rtld_objself.path, obj->path,
+ventry->name, >strtab[symnum]);
+return false;
+			}
+		} else {
+			verndx = VER_NDX(obj->versyms[symnum].vs_vers);
+			if (verndx > obj->vertabnum) {
+_rtld_error("%s: symbol %s references "
+"wrong version %d", obj->path,
+>strtab[symnum], verndx);
+return false;
+			}
+			if (obj->vertab[verndx].hash != ventry->hash ||
+			strcmp(obj->vertab[verndx].name, ventry->name)) {
+/*
+* Version does not match. Look if this
+* is a global symbol and if it is not
+* hidden. If global symbol (verndx < 2)
+* is available, use it. Do not return
+* symbol if we are called by dlvsym,
+* because dlvsym looks for a specific
+* version and default one is not what
+* dlvsym wants.
+*/
+if ((flags & SYMLOOK_DLSYM) ||
+(obj->versyms[symnum].vs_vers & VER_NDX_HIDDEN) ||
+(verndx >= VER_NDX_GIVEN))
+	return false;
+			}
+		}
+		*vsymp = symp;
+		return true;
+	}
+}
+
 /*
  * Search the symbol table of a single shared object for a symbol of
  * the given name.  Returns a pointer to the symbol, or NULL if no
@@ -207,115 +320,17 @@ _rtld_symlook_obj(const char *name, unsi
 

CVS commit: src/sys/dev/usb

2020-02-28 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Feb 29 04:02:06 UTC 2020

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

Log Message:
make sure to accept bcast frame all the time


To generate a diff of this commit:
cvs rdiff -u -r1.124 -r1.125 src/sys/dev/usb/if_axe.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_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.124 src/sys/dev/usb/if_axe.c:1.125
--- src/sys/dev/usb/if_axe.c:1.124	Sat Feb 29 02:51:14 2020
+++ src/sys/dev/usb/if_axe.c	Sat Feb 29 04:02:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.124 2020/02/29 02:51:14 nisimura Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.125 2020/02/29 04:02:06 nisimura Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.124 2020/02/29 02:51:14 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.125 2020/02/29 04:02:06 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1288,7 +1288,7 @@ axe_init_locked(struct ifnet *ifp)
 		ax88772b_mfb_table[AX88772B_MFB_16K].byte_cnt, NULL);
 	}
 	/* Enable receiver, set RX mode */
-	rxmode = (AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
+	rxmode = (AXE_RXCMD_BROADCAST | AXE_RXCMD_MULTICAST | AXE_RXCMD_ENABLE);
 	if (AXE_IS_178_FAMILY(un)) {
 		if (un->un_flags & AX772B) {
 			/*



CVS commit: src/sys/dev/usb

2020-02-28 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Sat Feb 29 02:51:14 UTC 2020

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

Log Message:
iron out receive filter multicast/promisc logic


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/dev/usb/if_axe.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_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.123 src/sys/dev/usb/if_axe.c:1.124
--- src/sys/dev/usb/if_axe.c:1.123	Mon Feb 24 12:38:57 2020
+++ src/sys/dev/usb/if_axe.c	Sat Feb 29 02:51:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.123 2020/02/24 12:38:57 rin Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.124 2020/02/29 02:51:14 nisimura Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.123 2020/02/24 12:38:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.124 2020/02/29 02:51:14 nisimura Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -450,17 +450,13 @@ axe_setiff_locked(struct usbnet *un)
 	rxmode = le16toh(rxmode);
 
 	rxmode &=
-	~(AXE_RXCMD_ALLMULTI | AXE_RXCMD_PROMISC |
-	AXE_RXCMD_BROADCAST | AXE_RXCMD_MULTICAST);
+	~(AXE_RXCMD_ALLMULTI | AXE_RXCMD_PROMISC | AXE_RXCMD_MULTICAST);
 
-	rxmode |=
-	(ifp->if_flags & IFF_BROADCAST) ? AXE_RXCMD_BROADCAST : 0;
-
-	if (ifp->if_flags & (IFF_ALLMULTI | IFF_PROMISC)) {
-		if (ifp->if_flags & IFF_PROMISC)
-			rxmode |= AXE_RXCMD_PROMISC;
+	if (ifp->if_flags & IFF_PROMISC) {
+		ifp->if_flags |= IFF_ALLMULTI;
 		goto allmulti;
 	}
+	ifp->if_flags &= ~IFF_ALLMULTI;
 
 	/* Now program new ones */
 	ETHER_LOCK(ec);
@@ -469,6 +465,7 @@ axe_setiff_locked(struct usbnet *un)
 		if (memcmp(enm->enm_addrlo, enm->enm_addrhi,
 		ETHER_ADDR_LEN) != 0) {
 			ETHER_UNLOCK(ec);
+			ifp->if_flags |= IFF_ALLMULTI;
 			goto allmulti;
 		}
 
@@ -477,15 +474,15 @@ axe_setiff_locked(struct usbnet *un)
 		ETHER_NEXT_MULTI(step, enm);
 	}
 	ETHER_UNLOCK(ec);
-	ifp->if_flags &= ~IFF_ALLMULTI;
-	rxmode |= AXE_RXCMD_MULTICAST;
 
+	rxmode |= AXE_RXCMD_MULTICAST;
 	axe_cmd(sc, AXE_CMD_WRITE_MCAST, 0, 0, hashtbl);
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 	return;
 
  allmulti:
-	ifp->if_flags |= IFF_ALLMULTI;
+	if (ifp->if_flags & IFF_PROMISC)
+		rxmode |= AXE_RXCMD_PROMISC;
 	rxmode |= AXE_RXCMD_ALLMULTI;
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 }
@@ -1323,19 +1320,11 @@ axe_init_locked(struct ifnet *ifp)
 		rxmode |= AXE_172_RXCMD_UNICAST;
 	}
 
-
-	/* If we want promiscuous mode, set the allframes bit. */
-	if (ifp->if_flags & IFF_PROMISC)
-		rxmode |= AXE_RXCMD_PROMISC;
-
-	if (ifp->if_flags & IFF_BROADCAST)
-		rxmode |= AXE_RXCMD_BROADCAST;
-
 	DPRINTF("rxmode %#jx", rxmode, 0, 0, 0);
 
 	axe_cmd(sc, AXE_CMD_RXCTL_WRITE, 0, rxmode, NULL);
 
-	/* Load the multicast filter. */
+	/* Accept multicast frame or run promisc. */
 	axe_setiff_locked(un);
 
 	usbnet_unlock_mii_un_locked(un);



CVS commit: src/sys/arch/powerpc/oea

2020-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 28 22:14:10 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
do what FreeBSD does and OF_quiesce() only on PowerMac11,2 and 12,1


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.46 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.47
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.46	Fri Feb 28 22:09:34 2020
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Feb 28 22:14:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.46 2020/02/28 22:09:34 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.47 2020/02/28 22:14:10 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.46 2020/02/28 22:09:34 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.47 2020/02/28 22:14:10 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -175,8 +175,8 @@ ofwoea_initppc(u_int startkernel, u_int 
 		model_init();
 	}
 
-	if (strncmp(model_name, "PowerMac11,", 11) == 0 ||
-	strncmp(model_name, "PowerMac7,", 10) == 0)
+	if (strncmp(model_name, "PowerMac11,2", 12) == 0 ||
+	strncmp(model_name, "PowerMac12,1", 12) == 0)
 		OF_quiesce();
 
 	/* switch CPUs to full speed */



CVS commit: src/sys/arch/powerpc/oea

2020-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 28 22:09:35 UTC 2020

Modified Files:
src/sys/arch/powerpc/oea: ofwoea_machdep.c

Log Message:
switch PowerMac7,* CPUs to full speed via OF
if we do this later we hang


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/powerpc/oea/ofwoea_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/powerpc/oea/ofwoea_machdep.c
diff -u src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.45 src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.46
--- src/sys/arch/powerpc/oea/ofwoea_machdep.c:1.45	Sun Jul 15 05:16:44 2018
+++ src/sys/arch/powerpc/oea/ofwoea_machdep.c	Fri Feb 28 22:09:34 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.45 2018/07/15 05:16:44 maxv Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.46 2020/02/28 22:09:34 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.45 2018/07/15 05:16:44 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.46 2020/02/28 22:09:34 macallan Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -176,9 +176,17 @@ ofwoea_initppc(u_int startkernel, u_int 
 	}
 
 	if (strncmp(model_name, "PowerMac11,", 11) == 0 ||
-	strncmp(model_name, "PowerMac7,", 10) == 0) 
+	strncmp(model_name, "PowerMac7,", 10) == 0)
 		OF_quiesce();
 
+	/* switch CPUs to full speed */
+	if  (strncmp(model_name, "PowerMac7,", 10) == 0) {
+		int clock_ih = OF_open("/u3/i2c/i2c-hwclock");
+		if (clock_ih != 0) {
+			OF_call_method_1("slew-high", clock_ih, 0);
+		}
+	}
+
 	/* Initialize bus_space */
 	ofwoea_bus_space_init();
 



CVS commit: src/crypto/external/bsd/openssh/dist

2020-02-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Fri Feb 28 17:50:29 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/dist: version.h

Log Message:
Remove unreferenced SSH_RELEASE


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/crypto/external/bsd/openssh/dist/version.h

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/version.h
diff -u src/crypto/external/bsd/openssh/dist/version.h:1.31 src/crypto/external/bsd/openssh/dist/version.h:1.32
--- src/crypto/external/bsd/openssh/dist/version.h:1.31	Thu Feb 27 00:27:44 2020
+++ src/crypto/external/bsd/openssh/dist/version.h	Fri Feb 28 17:50:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: version.h,v 1.31 2020/02/27 00:27:44 christos Exp $	*/
+/*	$NetBSD: version.h,v 1.32 2020/02/28 17:50:29 kim Exp $	*/
 /* $OpenBSD: version.h,v 1.86 2020/02/14 00:39:20 djm Exp $ */
 
 #define __OPENSSH_VERSION	"OpenSSH_8.2"
@@ -10,4 +10,3 @@
  * used for bug compatibility operation.  present NetBSD SSH version as comment
  */
 #define SSH_VERSION	__OPENSSH_VERSION " " __NETBSDSSH_VERSION SSH_HPN SSH_LPK
-#define SSH_RELEASE SSH_VERSION SSH_HPN SSH_LPK



CVS commit: src/crypto/external/bsd/openssh/dist

2020-02-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Fri Feb 28 17:27:34 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/dist: readconf.c

Log Message:
Fix duplicate entries in the keywords list.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/crypto/external/bsd/openssh/dist/readconf.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/readconf.c
diff -u src/crypto/external/bsd/openssh/dist/readconf.c:1.29 src/crypto/external/bsd/openssh/dist/readconf.c:1.30
--- src/crypto/external/bsd/openssh/dist/readconf.c:1.29	Thu Feb 27 00:24:40 2020
+++ src/crypto/external/bsd/openssh/dist/readconf.c	Fri Feb 28 17:27:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: readconf.c,v 1.29 2020/02/27 00:24:40 christos Exp $	*/
+/*	$NetBSD: readconf.c,v 1.30 2020/02/28 17:27:34 kim Exp $	*/
 /* $OpenBSD: readconf.c,v 1.326 2020/02/06 22:46:31 djm Exp $ */
 /*
  * Author: Tatu Ylonen 
@@ -14,7 +14,7 @@
  */
 
 #include "includes.h"
-__RCSID("$NetBSD: readconf.c,v 1.29 2020/02/27 00:24:40 christos Exp $");
+__RCSID("$NetBSD: readconf.c,v 1.30 2020/02/28 17:27:34 kim Exp $");
 #include 
 #include 
 #include 
@@ -196,9 +196,25 @@ static struct {
 	{ "useprivilegedport", oDeprecated },
 
 	/* Unsupported options */
+#ifdef AFS
+	{ "afstokenpassing", oAFSTokenPassing },
+#else
 	{ "afstokenpassing", oUnsupported },
+#endif
+#if defined(KRB4) || defined(KRB5)
+	{ "kerberosauthentication", oKerberosAuthentication },
+#else
 	{ "kerberosauthentication", oUnsupported },
+#endif
+#if defined(AFS) || defined(KRB5)
+	{ "kerberostgtpassing", oKerberosTgtPassing },
+	{ "kerberos5tgtpassing", oKerberosTgtPassing },		/* alias */
+	{ "kerberos4tgtpassing", oKerberosTgtPassing },		/* alias */
+#else
 	{ "kerberostgtpassing", oUnsupported },
+	{ "kerberos5tgtpassing", oUnsupported },
+	{ "kerberos4tgtpassing", oUnsupported },
+#endif
 	{ "rsaauthentication", oUnsupported },
 	{ "rhostsrsaauthentication", oUnsupported },
 	{ "compressionlevel", oUnsupported },
@@ -235,17 +251,6 @@ static struct {
 	{ "challengeresponseauthentication", oChallengeResponseAuthentication },
 	{ "skeyauthentication", oChallengeResponseAuthentication }, /* alias */
 	{ "tisauthentication", oChallengeResponseAuthentication },  /* alias */
-#if defined(KRB4) || defined(KRB5)
-	{ "kerberosauthentication", oKerberosAuthentication },
-#endif
-#if defined(AFS) || defined(KRB5)
-	{ "kerberostgtpassing", oKerberosTgtPassing },
-	{ "kerberos5tgtpassing", oKerberosTgtPassing },		/* alias */
-	{ "kerberos4tgtpassing", oKerberosTgtPassing },		/* alias */
-#endif
-#ifdef AFS
-	{ "afstokenpassing", oAFSTokenPassing },
-#endif
 #if defined(GSSAPI)
 	{ "gssapiauthentication", oGssAuthentication },
 	{ "gssapidelegatecredentials", oGssDelegateCreds },



CVS commit: src/sys/dev/pci

2020-02-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 28 14:57:55 UTC 2020

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

Log Message:
 Replace bnx_ifmedia_upd() in bnx_init() with mii_ifmedia_change() for future
locking changes.


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

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

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.93 src/sys/dev/pci/if_bnx.c:1.94
--- src/sys/dev/pci/if_bnx.c:1.93	Fri Feb 28 14:20:06 2020
+++ src/sys/dev/pci/if_bnx.c	Fri Feb 28 14:57:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.93 2020/02/28 14:20:06 msaitoh Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.94 2020/02/28 14:57:55 msaitoh Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.93 2020/02/28 14:20:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.94 2020/02/28 14:57:55 msaitoh Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -5061,7 +5061,7 @@ bnx_init(struct ifnet *ifp)
 	/* Enable host interrupts. */
 	bnx_enable_intr(sc);
 
-	bnx_ifmedia_upd(ifp);
+	mii_ifmedia_change(>bnx_mii);
 
 	SET(ifp->if_flags, IFF_RUNNING);
 	CLR(ifp->if_flags, IFF_OACTIVE);



CVS commit: src/sys/dev/pci

2020-02-28 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Feb 28 14:20:06 UTC 2020

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

Log Message:
 Replace bnx_ifmedia_upd() in bnx_mgmt_init() with mii_ifmedia_change() for
future locking changes. Suggested by thorpej@.

 XXX Need more work for bnx_ifmedia_upd() itself.


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

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

Modified files:

Index: src/sys/dev/pci/if_bnx.c
diff -u src/sys/dev/pci/if_bnx.c:1.92 src/sys/dev/pci/if_bnx.c:1.93
--- src/sys/dev/pci/if_bnx.c:1.92	Fri Feb  7 00:04:28 2020
+++ src/sys/dev/pci/if_bnx.c	Fri Feb 28 14:20:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bnx.c,v 1.92 2020/02/07 00:04:28 thorpej Exp $	*/
+/*	$NetBSD: if_bnx.c,v 1.93 2020/02/28 14:20:06 msaitoh Exp $	*/
 /*	$OpenBSD: if_bnx.c,v 1.101 2013/03/28 17:21:44 brad Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
 #if 0
 __FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
 #endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.92 2020/02/07 00:04:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.93 2020/02/28 14:20:06 msaitoh Exp $");
 
 /*
  * The following controllers are supported by this driver:
@@ -5100,7 +5100,7 @@ bnx_mgmt_init(struct bnx_softc *sc)
 	REG_RD(sc, BNX_MISC_ENABLE_SET_BITS);
 	DELAY(20);
 
-	bnx_ifmedia_upd(ifp);
+	mii_ifmedia_change(>bnx_mii);
 
 bnx_mgmt_init_exit:
 	DBPRINT(sc, BNX_VERBOSE_RESET, "Exiting %s()\n", __func__);



CVS commit: src/sys/dev/pci

2020-02-28 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Feb 28 13:31:03 UTC 2020

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

Log Message:
Drop 512 bytes limit on auvia_round_blocksize().
This fixes attach on 6 channels device.
PR kern/55017.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/pci/auvia.c

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

Modified files:

Index: src/sys/dev/pci/auvia.c
diff -u src/sys/dev/pci/auvia.c:1.84 src/sys/dev/pci/auvia.c:1.85
--- src/sys/dev/pci/auvia.c:1.84	Sat Jun  8 08:02:38 2019
+++ src/sys/dev/pci/auvia.c	Fri Feb 28 13:31:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auvia.c,v 1.84 2019/06/08 08:02:38 isaki Exp $	*/
+/*	$NetBSD: auvia.c,v 1.85 2020/02/28 13:31:03 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.84 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.85 2020/02/28 13:31:03 isaki Exp $");
 
 #include 
 #include 
@@ -749,8 +749,7 @@ auvia_round_blocksize(void *addr, int bl
 	if (sc->sc_flags & AUVIA_FLAGS_VT8233 && blk < 288)
 		blk = 288;
 
-	/* Avoid too many dma_ops. */
-	return uimin((blk & -32), AUVIA_MINBLKSZ);
+	return (blk & -32);
 }
 
 static int



CVS commit: src/sys/dev/i2c

2020-02-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Feb 28 13:18:25 UTC 2020

Modified Files:
src/sys/dev/i2c: dstemp.c

Log Message:
- document the config register
- do some setup and send a start command
- mark the sensor as invalid if readings are out of range
now this works properly on my PCI-X G5


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/dstemp.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/i2c/dstemp.c
diff -u src/sys/dev/i2c/dstemp.c:1.4 src/sys/dev/i2c/dstemp.c:1.5
--- src/sys/dev/i2c/dstemp.c:1.4	Tue Jun 26 06:03:57 2018
+++ src/sys/dev/i2c/dstemp.c	Fri Feb 28 13:18:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dstemp.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $ */
+/* $NetBSD: dstemp.c,v 1.5 2020/02/28 13:18:25 macallan Exp $ */
 
 /*-
  * Copyright (c) 2018 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.4 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.5 2020/02/28 13:18:25 macallan Exp $");
 
 #include 
 #include 
@@ -55,6 +55,18 @@ __KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1
 #define DSTEMP_TLOW		0xa2	/* low threshold, 2 bytes */
 #define DSTEMP_CONFIG		0xac	/* 1 byte */
 
+#define DSTEMP_1SHOT		0x01
+#define DSTEMP_POL		0x02	/* Tout polarity, 1 - active high */
+#define DSTEMP_8BIT		0x00
+#define DSTEMP_10BIT		0x04
+#define DSTEMP_11BIT		0x08
+#define DSTEMP_12BIT		0x0c
+#define DSTEMP_RES_MASK		0x0c
+#define DSTEMP_NVB		0x10	/* EEPROM busy */
+#define DSTEMP_TLF		0x20	/* temperature low flag */
+#define DSTEMP_THF		0x40	/* temperature high flag */
+#define DSTEMP_DONE		0x80
+
 struct dstemp_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -68,6 +80,7 @@ static int	dstemp_match(device_t, cfdata
 static void	dstemp_attach(device_t, device_t, void *);
 
 static void	dstemp_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+static void	dstemp_init(struct dstemp_softc *);
 
 CFATTACH_DECL_NEW(dstemp, sizeof(struct dstemp_softc),
 dstemp_match, dstemp_attach, NULL, NULL);
@@ -106,6 +119,8 @@ dstemp_attach(device_t parent, device_t 
 	aprint_naive("\n");
 	aprint_normal(": DS1361\n");
 
+	dstemp_init(sc);
+
 	sc->sc_sme = sysmon_envsys_create();
 	sc->sc_sme->sme_name = device_xname(self);
 	sc->sc_sme->sme_cookie = sc;
@@ -128,6 +143,29 @@ dstemp_attach(device_t parent, device_t 
 }
 
 static void
+dstemp_init(struct dstemp_softc *sc)
+{
+	int error;
+	uint8_t cmd[2], data;
+
+	iic_acquire_bus(sc->sc_i2c, 0);
+	cmd[0] = DSTEMP_CONFIG;
+	data = 0;
+	error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
+	sc->sc_addr, cmd, 1, , 1, 0);
+	/* we don't want to change the POL bit, so preserve it */
+	cmd[1] = (data & DSTEMP_POL) | DSTEMP_12BIT;
+	error |= iic_exec(sc->sc_i2c, I2C_OP_WRITE_WITH_STOP,
+	sc->sc_addr, cmd, 2, NULL, 0, 0);
+	/* ... and start converting */
+	cmd[0] = DSTEMP_CMD_START;
+	error |= iic_exec(sc->sc_i2c, I2C_OP_WRITE_WITH_STOP,
+	sc->sc_addr, cmd, 1, NULL, 0, 0);
+	if (error) aprint_error_dev(sc->sc_dev, "chip initialization failed\n");
+	iic_release_bus(sc->sc_i2c, 0);
+}
+
+static void
 dstemp_sensors_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
 {
 	struct dstemp_softc *sc = sme->sme_cookie;
@@ -145,8 +183,11 @@ dstemp_sensors_refresh(struct sysmon_env
 		edata->state = ENVSYS_SINVALID;
 	} else {
 		edata->value_cur =
-		((uint64_t)(data>>4) * 62500) +
+		((uint64_t)(be16toh(data) >> 4) * 62500) +
 		+ 27315;
-		edata->state = ENVSYS_SVALID;
+		if (edata->value_cur > (27315 + 12000)) {
+			edata->state = ENVSYS_SINVALID;
+		} else
+			edata->state = ENVSYS_SVALID;
 	}
 }



CVS commit: src/distrib/evbarm/instkernel/sshramdisk

2020-02-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Feb 28 13:00:51 UTC 2020

Modified Files:
src/distrib/evbarm/instkernel/sshramdisk: Makefile list

Log Message:
Deal with sshkey_sign. I am going to fix this properly at some point, but
it needs coordination from upstream (Patrick Welche)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/distrib/evbarm/instkernel/sshramdisk/Makefile
cvs rdiff -u -r1.2 -r1.3 src/distrib/evbarm/instkernel/sshramdisk/list

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

Modified files:

Index: src/distrib/evbarm/instkernel/sshramdisk/Makefile
diff -u src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.21 src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.22
--- src/distrib/evbarm/instkernel/sshramdisk/Makefile:1.21	Tue Jan 21 09:58:58 2020
+++ src/distrib/evbarm/instkernel/sshramdisk/Makefile	Fri Feb 28 08:00:51 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.21 2020/01/21 14:58:58 mlelstv Exp $
+#	$NetBSD: Makefile,v 1.22 2020/02/28 13:00:51 christos Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -31,10 +31,18 @@ IMAGEDEPENDS=	${CRUNCHBIN} \
 		${DISTRIBDIR}/common/services
 IMAGEPREBUILD=	${TOOL_PAX} ${PAX_TIMESTAMP} -rw -pp ${DESTDIR}/libdata/firmware ${WORKDIR}
 
+.PATH:	${NETBSDSRCDIR}/crypto/external/bsd/openssh/dist
+liboverride.o: ssh-sk-client.o
+	${_MKTARGET_LINK}
+	${LD} -r -o ${.TARGET} ${.ALLSRC}
+
+CLEANFILES+=	liboverride.o ssh-sk-client.o
+
+
 # Use stubs to eliminate some large stuff from libc
 HACKSRC=	${DISTRIBDIR}/utils/libhack
 .include	"${HACKSRC}/Makefile.inc"
-${CRUNCHBIN}:	libhack.o
+${CRUNCHBIN}:	libhack.o liboverride.o
 
 USE_PAM := no
 USE_YP := no

Index: src/distrib/evbarm/instkernel/sshramdisk/list
diff -u src/distrib/evbarm/instkernel/sshramdisk/list:1.2 src/distrib/evbarm/instkernel/sshramdisk/list:1.3
--- src/distrib/evbarm/instkernel/sshramdisk/list:1.2	Wed Aug 14 08:08:27 2019
+++ src/distrib/evbarm/instkernel/sshramdisk/list	Fri Feb 28 08:00:51 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.2 2019/08/14 12:08:27 martin Exp $
+#	$NetBSD: list,v 1.3 2020/02/28 13:00:51 christos Exp $
 
 SRCDIRS	bin sbin external/bsd/less/bin crypto/external/bsd/openssh/bin/sshd usr.bin usr.sbin
 
@@ -69,7 +69,7 @@ SPECIAL	umount		srcdir	distrib/utils/x_u
 SPECIAL sshd		srcdir	crypto/external/bsd/openssh/bin/sshd
 SPECIAL sshd		keepsymbols allow_severity deny_severity
 
-LIBS	libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop-lssh -lcrypto -lwrap
+LIBS	libhack.o liboverride.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop-lssh -lcrypto -lwrap
 
 # init invokes the shell as -sh
 ARGVLN	sh -sh



CVS commit: src/sys/fs/hfs

2020-02-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Feb 28 11:27:38 UTC 2020

Modified Files:
src/sys/fs/hfs: hfs_vfsops.c

Log Message:
Avoid undefined behavior in left shift semantics

hfs_vfsops.c:477:19, left shift of 1 by 31 places cannot be represented in type 
'int'


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/fs/hfs/hfs_vfsops.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/fs/hfs/hfs_vfsops.c
diff -u src/sys/fs/hfs/hfs_vfsops.c:1.36 src/sys/fs/hfs/hfs_vfsops.c:1.37
--- src/sys/fs/hfs/hfs_vfsops.c:1.36	Fri Jan 17 20:08:07 2020
+++ src/sys/fs/hfs/hfs_vfsops.c	Fri Feb 28 11:27:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hfs_vfsops.c,v 1.36 2020/01/17 20:08:07 ad Exp $	*/
+/*	$NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2007 The NetBSD Foundation, Inc.
@@ -99,7 +99,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.36 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hfs_vfsops.c,v 1.37 2020/02/28 11:27:38 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -474,7 +474,7 @@ hfs_statvfs(struct mount *mp, struct sta
 	sbp->f_bavail = vh->free_blocks; /* blocks free for non superuser */
 	sbp->f_bresvd = 0;
 	sbp->f_files =  vh->file_count; /* total files */
-	sbp->f_ffree = (1<<31) - vh->file_count; /* free file nodes */
+	sbp->f_ffree = (1U<<31) - vh->file_count; /* free file nodes */
 	copy_statvfs_info(sbp, mp);
 
 	return 0;



CVS commit: src/crypto/external/bsd/openssh/dist

2020-02-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Fri Feb 28 10:59:58 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/dist: sshd_config

Log Message:
Cleanup

- Match the case of the UsePAM keyword used in the manual page and code,
  to aid case-sensitive grep etc.
- Remove references to obsole UseLogin and UsePrivilegeSeparation keywords.
- Whitespace police


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/crypto/external/bsd/openssh/dist/sshd_config

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/sshd_config
diff -u src/crypto/external/bsd/openssh/dist/sshd_config:1.23 src/crypto/external/bsd/openssh/dist/sshd_config:1.24
--- src/crypto/external/bsd/openssh/dist/sshd_config:1.23	Sun Aug 26 07:46:37 2018
+++ src/crypto/external/bsd/openssh/dist/sshd_config	Fri Feb 28 10:59:58 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: sshd_config,v 1.23 2018/08/26 07:46:37 christos Exp $
+#	$NetBSD: sshd_config,v 1.24 2020/02/28 10:59:58 kim Exp $
 #	$OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $
 
 # This is the sshd server system-wide configuration file.  See
@@ -53,7 +53,7 @@ AuthorizedKeysFile	.ssh/authorized_keys
 # Don't read the user's ~/.rhosts and ~/.shosts files
 #IgnoreRhosts yes
 
-# To disable password authentication, set this and UsePam to no
+# To disable password authentication, set this and UsePAM to no
 #PasswordAuthentication yes
 #PermitEmptyPasswords no
 
@@ -72,9 +72,7 @@ AuthorizedKeysFile	.ssh/authorized_keys
 #PrintMotd yes
 #PrintLastLog yes
 #TCPKeepAlive yes
-#UseLogin no
-#UsePrivilegeSeparation sandbox
-UsePam yes
+UsePAM yes
 #PermitUserEnvironment no
 #Compression delayed
 #ClientAliveInterval 0
@@ -121,7 +119,6 @@ Subsystem	sftp	/usr/libexec/sftp-server
 # buffer size for hpn to non-hpn connections
 #HPNBufferSize 2048
 
-
 # Example of overriding settings on a per-user basis
 #Match User anoncvs
 #	X11Forwarding no



CVS commit: src/crypto/external/bsd/openssh/dist

2020-02-28 Thread Kimmo Suominen
Module Name:src
Committed By:   kim
Date:   Fri Feb 28 10:41:49 UTC 2020

Modified Files:
src/crypto/external/bsd/openssh/dist: ssh_config

Log Message:
Move NetBSD.org-specific entry above the match-all entry

The first matching entry that sets an option "wins." Therefore more
specific matches should be provided before the "Host *" entry that
matches everything. This way options set in the more specific entry will
not be accidentally made ineffective by the match-all entry.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/crypto/external/bsd/openssh/dist/ssh_config

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/ssh_config
diff -u src/crypto/external/bsd/openssh/dist/ssh_config:1.12 src/crypto/external/bsd/openssh/dist/ssh_config:1.13
--- src/crypto/external/bsd/openssh/dist/ssh_config:1.12	Sat Apr 20 17:16:40 2019
+++ src/crypto/external/bsd/openssh/dist/ssh_config	Fri Feb 28 10:41:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: ssh_config,v 1.12 2019/04/20 17:16:40 christos Exp $
+#	$NetBSD: ssh_config,v 1.13 2020/02/28 10:41:48 kim Exp $
 #	$OpenBSD: ssh_config,v 1.34 2019/02/04 02:39:42 dtucker Exp $
 
 # This is the ssh client system-wide configuration file.  See
@@ -18,6 +18,10 @@
 # list of available options, their meanings and defaults, please see the
 # ssh_config(5) man page.
 
+# NetBSD.org DNS provides SSHFP records - use them when possible
+Host *.netbsd.org *.NetBSD.org
+VerifyHostKeyDNS ask
+
 # Host *
 #   ForwardAgent no
 #   ForwardX11 no
@@ -45,7 +49,3 @@
 
 # If you use xorg from pkgsrc then uncomment the following line.
 #   XAuthLocation /usr/pkg/bin/xauth
-
-# NetBSD.org DNS provides SSHFP records - use them when possible
-Host *.netbsd.org *.NetBSD.org
-VerifyHostKeyDNS ask