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

2017-08-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  5 05:22:55 UTC 2017

Modified Files:
src/sys/arch/x68k/dev: vs.c

Log Message:
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x68k/dev/vs.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.41 src/sys/arch/x68k/dev/vs.c:1.42
--- src/sys/arch/x68k/dev/vs.c:1.41	Mon Jul 31 14:53:08 2017
+++ src/sys/arch/x68k/dev/vs.c	Sat Aug  5 05:22:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.41 2017/07/31 14:53:08 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.42 2017/08/05 05:22:55 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.41 2017/07/31 14:53:08 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.42 2017/08/05 05:22:55 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -56,7 +56,6 @@ __KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.41 
 
 #include 
 
-//#define VS_USE_PREC8 /* for debugging */
 #ifdef VS_DEBUG
 #define DPRINTF(y,x)	if (vs_debug >= (y)) printf x
 static int vs_debug;
@@ -330,15 +329,16 @@ vs_query_encoding(void *hdl, struct audi
 	DPRINTF(1, ("vs_query_encoding\n"));
 
 	if (fp->index == 0) {
-#if defined(VS_USE_PREC8)
 		strcpy(fp->name, AudioEslinear);
 		fp->encoding = AUDIO_ENCODING_SLINEAR;
 		fp->precision = 8;
-#else
+		fp->flags = 0;
+		return 0;
+	}
+	if (fp->index == 1) {
 		strcpy(fp->name, AudioEslinear_be);
 		fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
 		fp->precision = 16;
-#endif
 		fp->flags = 0;
 		return 0;
 	}
@@ -379,6 +379,8 @@ vs_set_params(void *hdl, int setmode, in
 	stream_filter_list_t *pfil, stream_filter_list_t *rfil)
 {
 	struct vs_softc *sc;
+	stream_filter_factory_t *pconv;
+	stream_filter_factory_t *rconv;
 	int rate;
 
 	sc = hdl;
@@ -400,11 +402,14 @@ vs_set_params(void *hdl, int setmode, in
 		return EINVAL;
 	}
 
-#if defined(VS_USE_PREC8)
-	if (play->precision != 8 || play->encoding != AUDIO_ENCODING_SLINEAR) {
-#else
-	if (play->precision != 16 || play->encoding != AUDIO_ENCODING_SLINEAR_BE) {
-#endif
+	if (play->precision == 8 && play->encoding == AUDIO_ENCODING_SLINEAR) {
+		pconv = msm6258_linear8_to_adpcm;
+		rconv = msm6258_adpcm_to_linear8;
+	} else if (play->precision == 16 &&
+	   play->encoding == AUDIO_ENCODING_SLINEAR_BE) {
+		pconv = msm6258_slinear16_to_adpcm;
+		rconv = msm6258_adpcm_to_slinear16;
+	} else {
 		DPRINTF(1, ("prec/enc not matched\n"));
 		return EINVAL;
 	}
@@ -419,22 +424,14 @@ vs_set_params(void *hdl, int setmode, in
 		play->encoding = AUDIO_ENCODING_ADPCM;
 		play->validbits = 4;
 		play->precision = 4;
-#if defined(VS_USE_PREC8)
-		pfil->append(pfil, msm6258_linear8_to_adpcm, play);
-#else
-		pfil->append(pfil, msm6258_slinear16_to_adpcm, play);
-#endif
+		pfil->append(pfil, pconv, play);
 	}
 	if ((setmode & AUMODE_RECORD) != 0) {
 		rfil->append(rfil, null_filter, rec);
 		rec->encoding = AUDIO_ENCODING_ADPCM;
 		rec->validbits = 4;
 		rec->precision = 4;
-#if defined(VS_USE_PREC8)
-		rfil->append(rfil, msm6258_adpcm_to_linear8, rec);
-#else
-		rfil->append(rfil, msm6258_adpcm_to_slinear16, rec);
-#endif
+		rfil->append(rfil, rconv, rec);
 	}
 
 	DPRINTF(1, ("accepted\n"));



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

2017-08-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  5 05:22:55 UTC 2017

Modified Files:
src/sys/arch/x68k/dev: vs.c

Log Message:
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x68k/dev/vs.c

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



CVS commit: [netbsd-8] src/doc

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:12:46 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
175-178, 180-187


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 src/doc/CHANGES-8.0

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



CVS commit: [netbsd-8] src/doc

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:12:46 UTC 2017

Modified Files:
src/doc [netbsd-8]: CHANGES-8.0

Log Message:
175-178, 180-187


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.34 -r1.1.2.35 src/doc/CHANGES-8.0

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-8.0
diff -u src/doc/CHANGES-8.0:1.1.2.34 src/doc/CHANGES-8.0:1.1.2.35
--- src/doc/CHANGES-8.0:1.1.2.34	Tue Aug  1 23:41:13 2017
+++ src/doc/CHANGES-8.0	Sat Aug  5 05:12:46 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.0,v 1.1.2.34 2017/08/01 23:41:13 snj Exp $
+# $NetBSD: CHANGES-8.0,v 1.1.2.35 2017/08/05 05:12:46 snj Exp $
 
 A complete list of changes from the initial NetBSD 8.0 branch on 2017-06-04
 until the 8.0 release:
@@ -4990,3 +4990,103 @@ sys/arch/evbmips/conf/CI20			1.23
 	CI20: don't set NEED_MDSETIMAGE when we don't enable the md_root.
 	[mrg, ticket #174]
 
+sys/dev/pci/ixgbe/ix_txrx.c		1.25-1.27
+sys/dev/pci/ixgbe/ixgbe.c		1.91-1.95
+sys/dev/pci/ixgbe/ixgbe_type.h		1.23-1.25
+sys/dev/pci/ixgbe/ixgbe_api.c		1.16
+
+	sync ixg(4) up to ixgbe.c rev. 1.95:
+	- Increase total number of RX buffers on multiqueue.
+	- Fix the partial chain check in ixgbe_rx_discard(). This bug was
+	  added in ixgbe.c rev. 1.33.
+	- Fix a double free in ixgbe_rxeof().
+	- Print verbose output in ixgbe_update_link_status() correctly on 5Gbps
+	  and 2.5Gbps (NBASE-T) for X550T[12] and newer.
+	- Change hw.ixgN.ts to hw.ixgN.thermal_test. Same as FreeBSD.
+	- Fix a bug that ifconfig ixgN media 1000baseT and 10Gbase-T advertised
+	  additional unwanted speeds.
+	- Print PHY ID.
+	- Remove unused variable.
+	[msaitoh, ticket #175]
+
+usr.sbin/makemandb/apropos.c			1.23
+
+	Make the 'no results found' message sound less harsh.
+	[jmcneill, ticket #176]
+
+sys/dev/pcmcia/aic_pcmcia.c			1.44
+
+	Make aic @ pcmcia work.
+	[christos, ticket #177]
+
+sys/opencrypto/crypto.c1.92-1.100
+sys/opencrypto/cryptodev.h			1.38-1.39
+sys/opencrypto/ocryptodev.c			1.9-1.11
+sys/opencrypto/ocryptodev.c			1.9
+sys/opencrypto/xform.c1.29
+sys/opencrypto/xform.h1.20
+
+	opencrypto:
+	- use pool_cache(9) instead of pool(9) as they can be called
+	  concurrently.
+	- use kmem_alloc KPI instead of malloc KPI.
+	- pack crypto_drivers variables to struct and add cacheline_aligned
+	  qualifier.
+	- refactor: remove glue macros for FreeBSD code.
+	- Avoid another userland-controlled integer overflow.
+	- Avert userland-controlled integer overflow.
+	- Don't disclose uninitialized 32-bit word if cryptodev_session fails.
+	- update locking notes of opencrypto(9)
+	- divide crp_ret_{,k}q by CPU to avoid reordering.
+	- make crp_{,k}q percpu to scale crypto_dispatch().
+	- fix panic when using encryption devices attached earlier than
+	  ipi_sysinit().
+	- make cryptoret() context softint to balance dequeuing
+	  crypto_ret_q with enqueuing it.
+	- Apply C99-style struct initialization to enc_xform, auth_hash and
+	  comp_algo
+	- KNF
+	[knakahara, ticket #178]
+
+sys/arch/newsmips/apbus/if_sn.c			1.39
+
+	Avoid memory leak in sonic_get.
+	[spz, ticket #180]
+
+sys/arch/mac68k/nubus/if_netdock_nubus.c	1.26
+
+	Avoid memory leak in netdock_get.
+	[spz, ticket #181]
+
+sys/dev/pci/if_ipw.c1.65
+
+	Fix double free in ipw_dma_alloc()
+	[spz, ticket #182]
+
+sys/dev/pci/if_et.c1.15
+
+	Missing mbuf cluster allocation error checking in et_newbuf()
+	[spz, ticket #183]
+
+sys/dev/ic/i82596.c1.37
+
+	potential double free in iee_init()/iee_stop()
+	[spz, ticket #184]
+
+sys/dev/ic/dp83932.c1.41
+
+	Plug mbuf leak on MCLGET failure in sonic_rxintr.
+	[spz, ticket #185]
+
+sys/dev/ic/dm9000.c1.12
+
+	Missing mbuf cluster allocation error checking in
+	dme_alloc_receive_buffer()
+	[spz, ticket #186]
+
+sys/dev/ic/bwi.c1.32
+
+	wrong error checking in bwi_newbuf() can cause an mbuf to declare
+	an mbuf length that is too big
+	[spz, ticket #187]
+



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:06:48 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: bwi.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #187):
sys/dev/ic/bwi.c: revision 1.32
Check for M_EXT in m->m_flags, whether m is NULL, after MCLGET.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.6.1 src/sys/dev/ic/bwi.c

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



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 05:06:48 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: bwi.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #187):
sys/dev/ic/bwi.c: revision 1.32
Check for M_EXT in m->m_flags, whether m is NULL, after MCLGET.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.31.6.1 src/sys/dev/ic/bwi.c

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

Modified files:

Index: src/sys/dev/ic/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.31 src/sys/dev/ic/bwi.c:1.31.6.1
--- src/sys/dev/ic/bwi.c:1.31	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/bwi.c	Sat Aug  5 05:06:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.31 2017/02/02 10:05:35 nonaka Exp $	*/
+/*	$NetBSD: bwi.c,v 1.31.6.1 2017/08/05 05:06:48 snj Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.31 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.31.6.1 2017/08/05 05:06:48 snj Exp $");
 
 #include 
 #include 
@@ -8328,7 +8328,7 @@ bwi_newbuf(struct bwi_softc *sc, int buf
 	if (m == NULL)
 		return (ENOBUFS);
 	MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
-	if (m == NULL) {
+	if ((m->m_flags & M_EXT) == 0) {
 		error = ENOBUFS;
 
 		/*



CVS commit: src/sys/dev/ic

2017-08-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  5 05:04:30 UTC 2017

Modified Files:
src/sys/dev/ic: msm6258.c

Log Message:
Fix typo. 266 -> 256.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/ic/msm6258.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/ic

2017-08-04 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  5 05:04:30 UTC 2017

Modified Files:
src/sys/dev/ic: msm6258.c

Log Message:
Fix typo. 266 -> 256.


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

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

Modified files:

Index: src/sys/dev/ic/msm6258.c
diff -u src/sys/dev/ic/msm6258.c:1.21 src/sys/dev/ic/msm6258.c:1.22
--- src/sys/dev/ic/msm6258.c:1.21	Wed Aug  2 10:10:10 2017
+++ src/sys/dev/ic/msm6258.c	Sat Aug  5 05:04:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msm6258.c,v 1.21 2017/08/02 10:10:10 isaki Exp $	*/
+/*	$NetBSD: msm6258.c,v 1.22 2017/08/05 05:04:30 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msm6258.c,v 1.21 2017/08/02 10:10:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msm6258.c,v 1.22 2017/08/05 05:04:30 isaki Exp $");
 
 #include 
 #include 
@@ -377,9 +377,9 @@ DEFINE_FILTER(msm6258_adpcm_to_linear8)
 			s = audio_stream_add_outp(this->src, s, 1);
 			s1 = adpcm2pcm_step(mc, a & 0x0f);
 			s2 = adpcm2pcm_step(mc, a >> 4);
-			d[0] = s1 / 266;
+			d[0] = s1 / 256;
 			d = audio_stream_add_inp(dst, d, 1);
-			d[0] = s2 / 266;
+			d[0] = s2 / 256;
 			d = audio_stream_add_inp(dst, d, 1);
 		}
 	} else if (enc_dst == AUDIO_ENCODING_ULINEAR_LE) {
@@ -390,9 +390,9 @@ DEFINE_FILTER(msm6258_adpcm_to_linear8)
 			s = audio_stream_add_outp(this->src, s, 1);
 			s1 = adpcm2pcm_step(mc, a & 0x0f);
 			s2 = adpcm2pcm_step(mc, a >> 4);
-			d[0] = (s1 / 266) ^ 0x80;
+			d[0] = (s1 / 256) ^ 0x80;
 			d = audio_stream_add_inp(dst, d, 1);
-			d[0] = (s2 / 266) ^ 0x80;
+			d[0] = (s2 / 256) ^ 0x80;
 			d = audio_stream_add_inp(dst, d, 1);
 		}
 	} else {



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:53:35 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dm9000.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #186):
sys/dev/ic/dm9000.c: revision 1.12
Check for MCLGET failure in dme_alloc_receive_buffer.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/dev/ic/dm9000.c

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



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:53:35 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dm9000.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #186):
sys/dev/ic/dm9000.c: revision 1.12
Check for MCLGET failure in dme_alloc_receive_buffer.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.11.8.1 src/sys/dev/ic/dm9000.c

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

Modified files:

Index: src/sys/dev/ic/dm9000.c
diff -u src/sys/dev/ic/dm9000.c:1.11 src/sys/dev/ic/dm9000.c:1.11.8.1
--- src/sys/dev/ic/dm9000.c:1.11	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/ic/dm9000.c	Sat Aug  5 04:53:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dm9000.c,v 1.11 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: dm9000.c,v 1.11.8.1 2017/08/05 04:53:34 snj Exp $	*/
 
 /*
  * Copyright (c) 2009 Paul Fleischer
@@ -1226,8 +1226,13 @@ dme_alloc_receive_buffer(struct ifnet *i
 		sizeof(struct ether_header);
 	/* All our frames have the CRC attached */
 	m->m_flags |= M_HASFCS;
-	if (m->m_pkthdr.len + pad > MHLEN )
+	if (m->m_pkthdr.len + pad > MHLEN) {
 		MCLGET(m, M_DONTWAIT);
+		if ((m->m_flags & M_EXT) == 0) {
+			m_freem(m);
+			return NULL;
+		}
+	}
 
 	m->m_data += pad;
 	m->m_len = frame_length + (frame_length % sc->sc_data_width);



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:45:30 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dp83932.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #185):
sys/dev/ic/dp83932.c: revision 1.41
Plug mbuf leak on MCLGET failure in sonic_rxintr.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/ic/dp83932.c

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

Modified files:

Index: src/sys/dev/ic/dp83932.c
diff -u src/sys/dev/ic/dp83932.c:1.40 src/sys/dev/ic/dp83932.c:1.40.2.1
--- src/sys/dev/ic/dp83932.c:1.40	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/dp83932.c	Sat Aug  5 04:45:30 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: dp83932.c,v 1.40.2.1 2017/08/05 04:45:30 snj Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.40 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dp83932.c,v 1.40.2.1 2017/08/05 04:45:30 snj Exp $");
 
 
 #include 
@@ -786,8 +786,10 @@ sonic_rxintr(struct sonic_softc *sc)
 goto dropit;
 			if (len > (MHLEN - 2)) {
 MCLGET(m, M_DONTWAIT);
-if ((m->m_flags & M_EXT) == 0)
+if ((m->m_flags & M_EXT) == 0) {
+	m_freem(m);
 	goto dropit;
+}
 			}
 			m->m_data += 2;
 			/*



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:45:30 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: dp83932.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #185):
sys/dev/ic/dp83932.c: revision 1.41
Plug mbuf leak on MCLGET failure in sonic_rxintr.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/ic/dp83932.c

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



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:39:29 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: i82596.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #184):
sys/dev/ic/i82596.c: revision 1.37
Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.
XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.6.1 src/sys/dev/ic/i82596.c

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



CVS commit: [netbsd-8] src/sys/dev/ic

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:39:29 UTC 2017

Modified Files:
src/sys/dev/ic [netbsd-8]: i82596.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #184):
sys/dev/ic/i82596.c: revision 1.37
Null out sc_rx_mbuf[i] after m_freem to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sc_tx_mbuf[i] after m_freem, out of paranoia.
XXX Not entirely clear to how tx mbufs are freed, but no way to test
this since it's ews4800mips- and hp700-only, so not keen to make any
more elaborate changes...


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.6.1 src/sys/dev/ic/i82596.c

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

Modified files:

Index: src/sys/dev/ic/i82596.c
diff -u src/sys/dev/ic/i82596.c:1.36 src/sys/dev/ic/i82596.c:1.36.6.1
--- src/sys/dev/ic/i82596.c:1.36	Mon Feb 20 07:43:29 2017
+++ src/sys/dev/ic/i82596.c	Sat Aug  5 04:39:29 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $ */
+/* $NetBSD: i82596.c,v 1.36.6.1 2017/08/05 04:39:29 snj Exp $ */
 
 /*
  * Copyright (c) 2003 Jochen Kunz.
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.36 2017/02/20 07:43:29 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.36.6.1 2017/08/05 04:39:29 snj Exp $");
 
 /* autoconfig and device stuff */
 #include 
@@ -753,6 +753,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't allocate mbuf\n",
 device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 t--;
 continue;
 			}
@@ -762,6 +763,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't allocate mbuf "
 "cluster\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 m_freem(m);
 t--;
 continue;
@@ -777,6 +779,7 @@ iee_start(struct ifnet *ifp)
 printf("%s: iee_start: can't load TX DMA map\n",
 device_xname(sc->sc_dev));
 m_freem(sc->sc_tx_mbuf[t]);
+sc->sc_tx_mbuf[t] = NULL;
 t--;
 continue;
 			}
@@ -926,6 +929,7 @@ iee_init(struct ifnet *ifp)
 printf("%s: iee_init: can't allocate mbuf"
 " cluster\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_rx_mbuf[r]);
+sc->sc_rx_mbuf[r] = NULL;
 err = 1;
 break;
 			}
@@ -939,6 +943,7 @@ iee_init(struct ifnet *ifp)
 printf("%s: iee_init: can't create RX "
 "DMA map\n", device_xname(sc->sc_dev));
 m_freem(sc->sc_rx_mbuf[r]);
+sc->sc_rx_mbuf[r] = NULL;
 err = 1;
 break;
 			}
@@ -948,6 +953,7 @@ iee_init(struct ifnet *ifp)
 			device_xname(sc->sc_dev));
 			bus_dmamap_destroy(sc->sc_dmat, sc->sc_rx_map[r]);
 			m_freem(sc->sc_rx_mbuf[r]);
+			sc->sc_rx_mbuf[r] = NULL;
 			err = 1;
 			break;
 		}



CVS commit: [netbsd-8] src/sys/dev/pci

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:36:57 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_et.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #183):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.8.1 src/sys/dev/pci/if_et.c

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



CVS commit: [netbsd-8] src/sys/dev/pci

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:36:57 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_et.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #183):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.8.1 src/sys/dev/pci/if_et.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_et.c
diff -u src/sys/dev/pci/if_et.c:1.14 src/sys/dev/pci/if_et.c:1.14.8.1
--- src/sys/dev/pci/if_et.c:1.14	Thu Dec 15 09:28:05 2016
+++ src/sys/dev/pci/if_et.c	Sat Aug  5 04:36:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.14 2016/12/15 09:28:05 ozaki-r Exp $	*/
+/*	$NetBSD: if_et.c,v 1.14.8.1 2017/08/05 04:36:56 snj Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14 2016/12/15 09:28:05 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.14.8.1 2017/08/05 04:36:56 snj Exp $");
 
 #include "opt_inet.h"
 #include "vlan.h"
@@ -2026,6 +2026,10 @@ et_newbuf(struct et_rxbuf_data *rbd, int
 		if (m == NULL)
 			return (ENOBUFS);
 		MCLGET(m, init ? M_WAITOK : M_DONTWAIT);
+		if ((m->m_flags & M_EXT) == 0) {
+			m_freem(m);
+			return (ENOBUFS);
+		}
 		len = MCLBYTES;
 	} else {
 		MGETHDR(m, init ? M_WAITOK : M_DONTWAIT, MT_DATA);



CVS commit: [netbsd-8] src/sys/dev/pci

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:35:21 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_ipw.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #182):
sys/dev/pci/if_ipw.c: revision 1.65
Null out sbuf->m on failure to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sbuf->map out of paranoia.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.64.2.1 src/sys/dev/pci/if_ipw.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_ipw.c
diff -u src/sys/dev/pci/if_ipw.c:1.64 src/sys/dev/pci/if_ipw.c:1.64.2.1
--- src/sys/dev/pci/if_ipw.c:1.64	Tue May 23 02:19:14 2017
+++ src/sys/dev/pci/if_ipw.c	Sat Aug  5 04:35:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipw.c,v 1.64 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: if_ipw.c,v 1.64.2.1 2017/08/05 04:35:21 snj Exp $	*/
 /*	FreeBSD: src/sys/dev/ipw/if_ipw.c,v 1.15 2005/11/13 17:17:40 damien Exp 	*/
 
 /*-
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.64 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipw.c,v 1.64.2.1 2017/08/05 04:35:21 snj Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2100 MiniPCI driver
@@ -607,6 +607,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		MCLGET(sbuf->m, M_DONTWAIT);
 		if (!(sbuf->m->m_flags & M_EXT)) {
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			aprint_error_dev(sc->sc_dev, "could not allocate rx mbuf cluster\n");
 			error = ENOMEM;
 			goto fail;
@@ -619,6 +620,7 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		if (error != 0) {
 			aprint_error_dev(sc->sc_dev, "could not create rxbuf dma map\n");
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			goto fail;
 		}
 
@@ -626,7 +628,9 @@ ipw_dma_alloc(struct ipw_softc *sc)
 		sbuf->m, BUS_DMA_READ | BUS_DMA_NOWAIT);
 		if (error != 0) {
 			bus_dmamap_destroy(sc->sc_dmat, sbuf->map);
+			sbuf->map = NULL;
 			m_freem(sbuf->m);
+			sbuf->m = NULL;
 			aprint_error_dev(sc->sc_dev, "could not map rxbuf dma memory\n");
 			goto fail;
 		}



CVS commit: [netbsd-8] src/sys/dev/pci

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:35:21 UTC 2017

Modified Files:
src/sys/dev/pci [netbsd-8]: if_ipw.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #182):
sys/dev/pci/if_ipw.c: revision 1.65
Null out sbuf->m on failure to avoid double-free later.
>From Ilja Van Sprundel.
Also null out sbuf->map out of paranoia.


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

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



CVS commit: [netbsd-8] src/sys/arch/mac68k/nubus

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:19:28 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-8]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #181):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/mac68k/nubus/if_netdock_nubus.c
diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.25 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.25.8.1
--- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.25	Thu Dec 15 09:28:03 2016
+++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c	Sat Aug  5 04:19:27 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_netdock_nubus.c,v 1.25 2016/12/15 09:28:03 ozaki-r Exp $	*/
+/*	$NetBSD: if_netdock_nubus.c,v 1.25.8.1 2017/08/05 04:19:27 snj Exp $	*/
 
 /*
  * Copyright (C) 2000,2002 Daishi Kato 
@@ -43,7 +43,7 @@
 /***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.25 2016/12/15 09:28:03 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.25.8.1 2017/08/05 04:19:27 snj Exp $");
 
 #include 
 #include 
@@ -802,6 +802,8 @@ netdock_get(struct netdock_softc *sc, in
 			if ((m->m_flags & M_EXT) == 0) {
 if (top)
 	m_freem(top);
+else
+	m_freem(m);
 return (NULL);
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-8] src/sys/arch/mac68k/nubus

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:19:28 UTC 2017

Modified Files:
src/sys/arch/mac68k/nubus [netbsd-8]: if_netdock_nubus.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #181):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.c

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



CVS commit: [netbsd-8] src/sys/arch/newsmips/apbus

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:17:03 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-8]: if_sn.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #180):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.6.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c
diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.38 src/sys/arch/newsmips/apbus/if_sn.c:1.38.6.1
--- src/sys/arch/newsmips/apbus/if_sn.c:1.38	Wed Feb 22 09:45:16 2017
+++ src/sys/arch/newsmips/apbus/if_sn.c	Sat Aug  5 04:17:03 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $	*/
+/*	$NetBSD: if_sn.c,v 1.38.6.1 2017/08/05 04:17:03 snj Exp $	*/
 
 /*
  * National Semiconductor  DP8393X SONIC Driver
@@ -16,7 +16,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.38 2017/02/22 09:45:16 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.38.6.1 2017/08/05 04:17:03 snj Exp $");
 
 #include "opt_inet.h"
 
@@ -1090,7 +1090,10 @@ sonic_get(struct sn_softc *sc, void *pkt
 		if (datalen >= MINCLSIZE) {
 			MCLGET(m, M_DONTWAIT);
 			if ((m->m_flags & M_EXT) == 0) {
-if (top) m_freem(top);
+if (top)
+	m_freem(top);
+else
+	m_freem(m);
 return 0;
 			}
 			len = MCLBYTES;



CVS commit: [netbsd-8] src/sys/arch/newsmips/apbus

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 04:17:03 UTC 2017

Modified Files:
src/sys/arch/newsmips/apbus [netbsd-8]: if_sn.c

Log Message:
Pull up following revision(s) (requested by spz in ticket #180):
sys/arch/newsmips/apbus/if_sn.c: revision 1.39
Avoid memory leak in sonic_get.
If this is the first time around, top is null and nothing else will
free m.
>From Ilja Van Sprundel.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.6.1 src/sys/arch/newsmips/apbus/if_sn.c

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



CVS commit: [netbsd-8] src/sys/opencrypto

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:59:21 UTC 2017

Modified Files:
src/sys/opencrypto [netbsd-8]: crypto.c cryptodev.h ocryptodev.c
xform.c xform.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #178):
sys/opencrypto/crypto.c: 1.92-1.100
sys/opencrypto/cryptodev.h: 1.38-1.39
sys/opencrypto/ocryptodev.c: 1.9-1.11
sys/opencrypto/xform.c: revision 1.29
sys/opencrypto/xform.h: revision 1.20
KNF
--
Apply C99-style struct initialization to enc_xform, auth_hash and comp_algo
--
make cryptoret() context softint to balance dequeuing crypto_ret_q with 
enqueuing it.
--
fix panic when using ecryption devices attached earlier than ipi_sysinit().
pointed out and tested by martin@n.o, thanks.
--
fix typo
--
make crp_{,k}q percpu to scale crypto_dispatch().
update locking note later.
--
divide crp_ret_{,k}q by CPU to avoid reordering.
update locking note later.
--
update locking notes of opencrypto(9)
--
Don't disclose uninitialized 32-bit word if cryptodev_session fails.
>From Ilja Van Sprundel.
--
Avert userland-controlled integer overflow.
>From Ilja Van Sprundel.
--
Avoid another userland-controlled integer overflow.
>From Ilja Van Sprundel.
--
refactor: remove glue macros for FreeBSD code.
--
pack crypto_drivers variables to struct and add cacheline_aligned qualifier.
--
use kmem_alloc KPI instead of malloc KPI.
--
use pool_cache(9) instead of pool(9) as they can be called concurrently.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.2 -r1.78.2.3 src/sys/opencrypto/crypto.c
cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/sys/opencrypto/cryptodev.h
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/opencrypto/ocryptodev.c
cvs rdiff -u -r1.28 -r1.28.48.1 src/sys/opencrypto/xform.c
cvs rdiff -u -r1.19 -r1.19.48.1 src/sys/opencrypto/xform.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/opencrypto/crypto.c
diff -u src/sys/opencrypto/crypto.c:1.78.2.2 src/sys/opencrypto/crypto.c:1.78.2.3
--- src/sys/opencrypto/crypto.c:1.78.2.2	Wed Jul  5 20:19:21 2017
+++ src/sys/opencrypto/crypto.c	Sat Aug  5 03:59:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: crypto.c,v 1.78.2.2 2017/07/05 20:19:21 snj Exp $ */
+/*	$NetBSD: crypto.c,v 1.78.2.3 2017/08/05 03:59:21 snj Exp $ */
 /*	$FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $	*/
 /*	$OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $	*/
 
@@ -53,12 +53,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.78.2.2 2017/07/05 20:19:21 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.78.2.3 2017/08/05 03:59:21 snj Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -67,6 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #if defined(_KERNEL_OPT)
 #include "opt_ocf.h"
@@ -75,96 +79,127 @@ __KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1
 #include 
 #include 			/* XXX for M_XDATA */
 
-static kmutex_t crypto_q_mtx;
-static kmutex_t crypto_ret_q_mtx;
-static kcondvar_t cryptoret_cv;
-
-/* below are kludges for residual code wrtitten to FreeBSD interfaces */
-  #define SWI_CRYPTO 17
-  #define register_swi(lvl, fn)  \
-  softint_establish(SOFTINT_NET|SOFTINT_MPSAFE, (void (*)(void *))fn, NULL)
-  #define unregister_swi(lvl, fn)  softint_disestablish(softintr_cookie)
-  #define setsoftcrypto(x)			\
-	do{	\
-		kpreempt_disable();		\
-		softint_schedule(x);		\
-		kpreempt_enable();		\
-	}while(0)
-
-int crypto_ret_q_check(struct cryptop *);
-
 /*
  * Crypto drivers register themselves by allocating a slot in the
  * crypto_drivers table with crypto_get_driverid() and then registering
  * each algorithm they support with crypto_register() and crypto_kregister().
  */
-static kmutex_t crypto_drv_mtx;
 /* Don't directly access crypto_drivers[i], use crypto_checkdriver(i). */
-static	struct cryptocap *crypto_drivers;
-static	int crypto_drivers_num;
-static	void *softintr_cookie;
-static	int crypto_exit_flag;
+static struct {
+	kmutex_t mtx;
+	int num;
+	struct cryptocap *list;
+} crypto_drv __cacheline_aligned;
+#define crypto_drv_mtx		(crypto_drv.mtx)
+#define crypto_drivers_num	(crypto_drv.num)
+#define crypto_drivers		(crypto_drv.list)
+
+static	void *crypto_q_si;
+static	void *crypto_ret_si;
 
 /*
  * There are two queues for crypto requests; one for symmetric (e.g.
  * cipher) operations and one for asymmetric (e.g. MOD) operations.
  * See below for how synchronization is handled.
  */
-static	TAILQ_HEAD(,cryptop) crp_q =		/* request queues */
-		TAILQ_HEAD_INITIALIZER(crp_q);
-static	TAILQ_HEAD(,cryptkop) crp_kq =
-		TAILQ_HEAD_INITIALIZER(crp_kq);
+TAILQ_HEAD(crypto_crp_q, cryptop);
+TAILQ_HEAD(crypto_crp_kq, cryptkop);
+struct crypto_crp_qs {
+	struct crypto_crp_q crp_q;
+	struct crypto_crp_kq crp_kq;
+};
+static 

CVS commit: [netbsd-8] src/sys/opencrypto

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:59:21 UTC 2017

Modified Files:
src/sys/opencrypto [netbsd-8]: crypto.c cryptodev.h ocryptodev.c
xform.c xform.h

Log Message:
Pull up following revision(s) (requested by knakahara in ticket #178):
sys/opencrypto/crypto.c: 1.92-1.100
sys/opencrypto/cryptodev.h: 1.38-1.39
sys/opencrypto/ocryptodev.c: 1.9-1.11
sys/opencrypto/xform.c: revision 1.29
sys/opencrypto/xform.h: revision 1.20
KNF
--
Apply C99-style struct initialization to enc_xform, auth_hash and comp_algo
--
make cryptoret() context softint to balance dequeuing crypto_ret_q with 
enqueuing it.
--
fix panic when using ecryption devices attached earlier than ipi_sysinit().
pointed out and tested by martin@n.o, thanks.
--
fix typo
--
make crp_{,k}q percpu to scale crypto_dispatch().
update locking note later.
--
divide crp_ret_{,k}q by CPU to avoid reordering.
update locking note later.
--
update locking notes of opencrypto(9)
--
Don't disclose uninitialized 32-bit word if cryptodev_session fails.
>From Ilja Van Sprundel.
--
Avert userland-controlled integer overflow.
>From Ilja Van Sprundel.
--
Avoid another userland-controlled integer overflow.
>From Ilja Van Sprundel.
--
refactor: remove glue macros for FreeBSD code.
--
pack crypto_drivers variables to struct and add cacheline_aligned qualifier.
--
use kmem_alloc KPI instead of malloc KPI.
--
use pool_cache(9) instead of pool(9) as they can be called concurrently.


To generate a diff of this commit:
cvs rdiff -u -r1.78.2.2 -r1.78.2.3 src/sys/opencrypto/crypto.c
cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/sys/opencrypto/cryptodev.h
cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/opencrypto/ocryptodev.c
cvs rdiff -u -r1.28 -r1.28.48.1 src/sys/opencrypto/xform.c
cvs rdiff -u -r1.19 -r1.19.48.1 src/sys/opencrypto/xform.h

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



CVS commit: [netbsd-8] src/sys/dev/pcmcia

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:52:57 UTC 2017

Modified Files:
src/sys/dev/pcmcia [netbsd-8]: aic_pcmcia.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #177):
sys/dev/pcmcia/aic_pcmcia.c: revision 1.44
>From bjoern johannesson, in netbsd-general... Reset the mask to 0, used to
be 0xa. Is it wrong in the cfe? Should this better be done via a quirk?


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.56.1 src/sys/dev/pcmcia/aic_pcmcia.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/pcmcia/aic_pcmcia.c
diff -u src/sys/dev/pcmcia/aic_pcmcia.c:1.43 src/sys/dev/pcmcia/aic_pcmcia.c:1.43.56.1
--- src/sys/dev/pcmcia/aic_pcmcia.c:1.43	Thu Nov 12 19:24:06 2009
+++ src/sys/dev/pcmcia/aic_pcmcia.c	Sat Aug  5 03:52:57 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $	*/
+/*	$NetBSD: aic_pcmcia.c,v 1.43.56.1 2017/08/05 03:52:57 snj Exp $	*/
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.43 2009/11/12 19:24:06 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic_pcmcia.c,v 1.43.56.1 2017/08/05 03:52:57 snj Exp $");
 
 #include 
 #include 
@@ -101,6 +101,8 @@ aic_pcmcia_validate_config(struct pcmcia
 	cfe->num_memspace != 0 ||
 	cfe->num_iospace != 1)
 		return (EINVAL);
+
+	cfe->iomask = 0;		/* XXX: wrong from cfe?, quirk? */
 	return (0);
 }
 



CVS commit: [netbsd-8] src/sys/dev/pcmcia

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:52:57 UTC 2017

Modified Files:
src/sys/dev/pcmcia [netbsd-8]: aic_pcmcia.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #177):
sys/dev/pcmcia/aic_pcmcia.c: revision 1.44
>From bjoern johannesson, in netbsd-general... Reset the mask to 0, used to
be 0xa. Is it wrong in the cfe? Should this better be done via a quirk?


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.56.1 src/sys/dev/pcmcia/aic_pcmcia.c

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



CVS commit: [netbsd-8] src/usr.sbin/makemandb

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:51:38 UTC 2017

Modified Files:
src/usr.sbin/makemandb [netbsd-8]: apropos.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #176):
usr.sbin/makemandb/apropos.c: revision 1.23
Make the 'no results found' message sound less harsh.
Changes "try using better keywords" to "try using different keywords".


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.2.1 src/usr.sbin/makemandb/apropos.c

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

Modified files:

Index: src/usr.sbin/makemandb/apropos.c
diff -u src/usr.sbin/makemandb/apropos.c:1.22 src/usr.sbin/makemandb/apropos.c:1.22.2.1
--- src/usr.sbin/makemandb/apropos.c:1.22	Mon May  1 05:28:00 2017
+++ src/usr.sbin/makemandb/apropos.c	Sat Aug  5 03:51:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos.c,v 1.22 2017/05/01 05:28:00 abhinav Exp $	*/
+/*	$NetBSD: apropos.c,v 1.22.2.1 2017/08/05 03:51:38 snj Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos.c,v 1.22 2017/05/01 05:28:00 abhinav Exp $");
+__RCSID("$NetBSD: apropos.c,v 1.22.2.1 2017/08/05 03:51:38 snj Exp $");
 
 #include 
 #include 
@@ -273,7 +273,7 @@ main(int argc, char *argv[])
 	if (cbdata.count == 0) {
 		warnx("No relevant results obtained.\n"
 		"Please make sure that you spelled all the terms correctly "
-		"or try using better keywords.");
+		"or try using different keywords.");
 	}
 	return 0;
 }



CVS commit: [netbsd-8] src/usr.sbin/makemandb

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:51:38 UTC 2017

Modified Files:
src/usr.sbin/makemandb [netbsd-8]: apropos.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #176):
usr.sbin/makemandb/apropos.c: revision 1.23
Make the 'no results found' message sound less harsh.
Changes "try using better keywords" to "try using different keywords".


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.22.2.1 src/usr.sbin/makemandb/apropos.c

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



CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:49:35 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_api.c
ixgbe_type.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #175):
sys/dev/pci/ixgbe/ix_txrx.c: 1.25-1.27
sys/dev/pci/ixgbe/ixgbe.c: 1.91-1.95
sys/dev/pci/ixgbe/ixgbe_type.h: 1.23-1.25
sys/dev/pci/ixgbe/ixgbe_api.c: 1.16
sync ixg(4) up to ixgbe.c rev. 1.95:
- Increase total number of RX buffers on multiqueue.
- Fix the partial chain check in ixgbe_rx_discard(). This bug was
  added in ixgbe.c rev. 1.33.
- Fix a double free in ixgbe_rxeof().
- Print verbose output in ixgbe_update_link_status() correctly on 5Gbps
  and 2.5Gbps (NBASE-T) for X550T[12] and newer.
- Change hw.ixgN.ts to hw.ixgN.thermal_test. Same as FreeBSD.
- Fix a bug that ifconfig ixgN media 1000baseT and 10Gbase-T advertised
  additional unwanted speeds.
- Print PHY ID.
- Remove unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.1 -r1.88.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.15 -r1.15.8.1 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.22 -r1.22.2.1 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.



CVS commit: [netbsd-8] src/sys/dev/pci/ixgbe

2017-08-04 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Aug  5 03:49:35 UTC 2017

Modified Files:
src/sys/dev/pci/ixgbe [netbsd-8]: ix_txrx.c ixgbe.c ixgbe_api.c
ixgbe_type.h

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #175):
sys/dev/pci/ixgbe/ix_txrx.c: 1.25-1.27
sys/dev/pci/ixgbe/ixgbe.c: 1.91-1.95
sys/dev/pci/ixgbe/ixgbe_type.h: 1.23-1.25
sys/dev/pci/ixgbe/ixgbe_api.c: 1.16
sync ixg(4) up to ixgbe.c rev. 1.95:
- Increase total number of RX buffers on multiqueue.
- Fix the partial chain check in ixgbe_rx_discard(). This bug was
  added in ixgbe.c rev. 1.33.
- Fix a double free in ixgbe_rxeof().
- Print verbose output in ixgbe_update_link_status() correctly on 5Gbps
  and 2.5Gbps (NBASE-T) for X550T[12] and newer.
- Change hw.ixgN.ts to hw.ixgN.thermal_test. Same as FreeBSD.
- Fix a bug that ifconfig ixgN media 1000baseT and 10Gbase-T advertised
  additional unwanted speeds.
- Print PHY ID.
- Remove unused variable.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/dev/pci/ixgbe/ix_txrx.c
cvs rdiff -u -r1.88.2.1 -r1.88.2.2 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.15 -r1.15.8.1 src/sys/dev/pci/ixgbe/ixgbe_api.c
cvs rdiff -u -r1.22 -r1.22.2.1 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/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.24 src/sys/dev/pci/ixgbe/ix_txrx.c:1.24.2.1
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.24	Thu May 18 08:25:37 2017
+++ src/sys/dev/pci/ixgbe/ix_txrx.c	Sat Aug  5 03:49:35 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/ix_txrx.c 301538 2016-06-07 04:51:50Z sephe $*/
-/*$NetBSD: ix_txrx.c,v 1.24 2017/05/18 08:25:37 msaitoh Exp $*/
+/*$NetBSD: ix_txrx.c,v 1.24.2.1 2017/08/05 03:49:35 snj Exp $*/
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
@@ -1446,21 +1446,10 @@ fail:
 
 static void 
 ixgbe_free_receive_ring(struct rx_ring *rxr)
-{ 
-	struct ixgbe_rx_buf   *rxbuf;
+{
 
 	for (int i = 0; i < rxr->num_desc; i++) {
-		rxbuf = >rx_buffers[i];
-		if (rxbuf->buf != NULL) {
-			bus_dmamap_sync(rxr->ptag->dt_dmat, rxbuf->pmap,
-			0, rxbuf->buf->m_pkthdr.len,
-			BUS_DMASYNC_POSTREAD);
-			ixgbe_dmamap_unload(rxr->ptag, rxbuf->pmap);
-			rxbuf->buf->m_flags |= M_PKTHDR;
-			m_freem(rxbuf->buf);
-			rxbuf->buf = NULL;
-			rxbuf->flags = 0;
-		}
+		ixgbe_rx_discard(rxr, i);
 	}
 }
 
@@ -1510,7 +1499,8 @@ ixgbe_setup_receive_ring(struct rx_ring 
 	 * or size of jumbo mbufs may have changed.
 	 */
 	ixgbe_jcl_reinit(>jcl_head, rxr->ptag->dt_dmat,
-	2 * adapter->num_rx_desc, adapter->rx_mbuf_sz);
+	(2 * adapter->num_rx_desc) * adapter->num_queues,
+	adapter->rx_mbuf_sz);
 
 	IXGBE_RX_LOCK(rxr);
 
@@ -1631,7 +1621,9 @@ fail:
 	 */
 	for (int i = 0; i < j; ++i) {
 		rxr = >rx_rings[i];
+		IXGBE_RX_LOCK(rxr);
 		ixgbe_free_receive_ring(rxr);
+		IXGBE_RX_UNLOCK(rxr);
 	}
 
 	return (ENOBUFS);
@@ -1685,15 +1677,7 @@ ixgbe_free_receive_buffers(struct rx_rin
 	if (rxr->rx_buffers != NULL) {
 		for (int i = 0; i < adapter->num_rx_desc; i++) {
 			rxbuf = >rx_buffers[i];
-			if (rxbuf->buf != NULL) {
-bus_dmamap_sync(rxr->ptag->dt_dmat,
-rxbuf->pmap, 0, rxbuf->buf->m_pkthdr.len,
-BUS_DMASYNC_POSTREAD);
-ixgbe_dmamap_unload(rxr->ptag, rxbuf->pmap);
-rxbuf->buf->m_flags |= M_PKTHDR;
-m_freem(rxbuf->buf);
-			}
-			rxbuf->buf = NULL;
+			ixgbe_rx_discard(rxr, i);
 			if (rxbuf->pmap != NULL) {
 ixgbe_dmamap_destroy(rxr->ptag, rxbuf->pmap);
 rxbuf->pmap = NULL;
@@ -1770,12 +1754,15 @@ ixgbe_rx_discard(struct rx_ring *rxr, in
 	** and mapping.
 	*/
 
-	if (rbuf->buf != NULL) {/* Partial chain ? */
-		rbuf->fmp->m_flags |= M_PKTHDR;
+	if (rbuf->fmp != NULL) {/* Partial chain ? */
+		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
+		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 		m_freem(rbuf->fmp);
 		rbuf->fmp = NULL;
 		rbuf->buf = NULL; /* rbuf->buf is part of fmp's chain */
 	} else if (rbuf->buf) {
+		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
+		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
 		m_free(rbuf->buf);
 		rbuf->buf = NULL;
 	}
@@ -1869,6 +1856,9 @@ ixgbe_rxeof(struct ix_queue *que)
 			goto next_desc;
 		}
 
+		bus_dmamap_sync(rxr->ptag->dt_dmat, rbuf->pmap, 0,
+		rbuf->buf->m_pkthdr.len, BUS_DMASYNC_POSTREAD);
+
 		/*
 		** On 82599 which supports a hardware
 		** LRO (called HW RSC), packets need

Index: src/sys/dev/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.1 src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.2
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.88.2.1	Tue Jul  4 14:57:19 2017
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Sat Aug  5 03:49:35 2017
@@ -59,7 +59,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 /*$FreeBSD: head/sys/dev/ixgbe/if_ix.c 302384 2016-07-07 03:39:18Z sbruno $*/

CVS commit: src/sys/dev/sbus

2017-08-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  4 23:54:46 UTC 2017

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

Log Message:
- store bitmap fonts in vram
- don't try to force buffer flushes
- avoid 64bit writes to vram
-> no more corruption of font bitmaps


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sbus/mgx.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/sbus

2017-08-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Aug  4 23:54:46 UTC 2017

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

Log Message:
- store bitmap fonts in vram
- don't try to force buffer flushes
- avoid 64bit writes to vram
-> no more corruption of font bitmaps


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/sbus/mgx.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/mgx.c
diff -u src/sys/dev/sbus/mgx.c:1.11 src/sys/dev/sbus/mgx.c:1.12
--- src/sys/dev/sbus/mgx.c:1.11	Sat Jul 29 03:32:00 2017
+++ src/sys/dev/sbus/mgx.c	Fri Aug  4 23:54:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $ */
+/*	$NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -29,7 +29,7 @@
 /* a console driver for the SSB 4096V-MGX graphics card */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.11 2017/07/29 03:32:00 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mgx.c,v 1.12 2017/08/04 23:54:46 macallan Exp $");
 
 #include 
 #include 
@@ -94,6 +94,7 @@ struct mgx_softc {
 	struct wsscreen_list sc_screenlist;
 	struct vcons_data vd;
 	glyphcache 	sc_gc;
+	uint8_t		sc_in[256];
 };
 
 static int	mgx_match(device_t, cfdata_t, void *);
@@ -110,7 +111,7 @@ static int	mgx_putcmap(struct mgx_softc 
 static int 	mgx_getcmap(struct mgx_softc *, struct wsdisplay_cmap *);
 static int	mgx_wait_engine(struct mgx_softc *);
 __unused static int	mgx_wait_host(struct mgx_softc *);
-static int	mgx_wait_fifo(struct mgx_softc *, unsigned int);
+/*static*/ int	mgx_wait_fifo(struct mgx_softc *, unsigned int);
 
 static void	mgx_bitblt(void *, int, int, int, int, int, int, int);
 static void 	mgx_rectfill(void *, int, int, int, int, long);
@@ -122,6 +123,7 @@ static void	mgx_copycols(void *, int, in
 static void	mgx_erasecols(void *, int, int, int, long);
 static void	mgx_copyrows(void *, int, int, int);
 static void	mgx_eraserows(void *, int, int, long);
+static void	mgx_adapt(struct vcons_screen *, void *);
 
 static int	mgx_do_cursor(struct mgx_softc *, struct wsdisplay_cursor *);
 static void	mgx_set_cursor(struct mgx_softc *);
@@ -237,7 +239,7 @@ mgx_attach(device_t parent, device_t sel
 	struct rasops_info *ri;
 	unsigned long defattr;
 	bus_space_handle_t bh;
-	int node = sa->sa_node;
+	int node = sa->sa_node, bsize;
 	int isconsole;
 
 	aprint_normal("\n");
@@ -267,7 +269,7 @@ mgx_attach(device_t parent, device_t sel
 		}
 		sc->sc_fbaddr = bus_space_vaddr(sa->sa_bustag, bh);
 	}
-		
+
 	if (sbus_bus_map(sa->sa_bustag,
 			 sa->sa_slot,
 			 sa->sa_reg[4].oa_base, 0x1000, 0,
@@ -318,8 +320,8 @@ mgx_attach(device_t parent, device_t sel
 
 	vcons_init(>vd, sc, >sc_defaultscreen_descr, _accessops);
 	sc->vd.init_screen = mgx_init_screen;
-	sc->vd.show_screen_cookie = >sc_gc;
-	sc->vd.show_screen_cb = glyphcache_adapt;
+	sc->vd.show_screen_cookie = sc;
+	sc->vd.show_screen_cb = mgx_adapt;
 
 	vcons_init_screen(>vd, >sc_console_screen, 1, );
 	sc->sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
@@ -340,9 +342,10 @@ mgx_attach(device_t parent, device_t sel
 	 * leave some room between visible screen and glyph cache for upload
 	 * buffers used by putchar_mono()
 	 */
+	bsize = (32 * 1024 * sc->sc_stride - 1) / sc->sc_stride;
 	glyphcache_init(>sc_gc,
-	sc->sc_height + 5,
-	(0x40 / sc->sc_stride) - sc->sc_height - 5,
+	sc->sc_height + bsize,
+	(0x40 / sc->sc_stride) - (sc->sc_height + bsize),
 	sc->sc_width,
 	ri->ri_font->fontwidth,
 	ri->ri_font->fontheight,
@@ -378,16 +381,6 @@ mgx_attach(device_t parent, device_t sel
 	fb->fb_type.fb_cmsize = 256;
 	fb->fb_type.fb_size = sc->sc_fbsize;
 	fb_attach(>sc_fb, isconsole);
-
-#if 0
-	{
-		uint32_t ap;
-		/* reads 0xfd21 */
-		mgx_write_4(sc, ATR_APERTURE, 0x); 
-		ap = mgx_read_4(sc, ATR_APERTURE);
-		printf("aperture: %08x\n", ap);
-	}
-#endif
 }
 
 static void
@@ -514,7 +507,7 @@ mgx_wait_host(struct mgx_softc *sc)
 	return i;
 }
 
-static int
+/*static inline*/ int
 mgx_wait_fifo(struct mgx_softc *sc, unsigned int nfifo)
 {
 	unsigned int i;
@@ -580,7 +573,7 @@ mgx_setup(struct mgx_softc *sc, int dept
 	sc->sc_stride = sc->sc_width * (depth >> 3);
 	stride = sc->sc_stride >> 3;
 #ifdef MGX_DEBUG
-	sc->sc_height = 600;
+	sc->sc_height -= 150;
 #endif
 
 	sc->sc_depth = depth;
@@ -628,24 +621,7 @@ mgx_setup(struct mgx_softc *sc, int dept
 	mgx_write_1(sc, ATR_CURSOR_ENABLE, 0);
 	sc->sc_cursor = (uint8_t *)sc->sc_fbaddr + sc->sc_fbsize - 1024;
 	memset(sc->sc_cursor, 0xf0, 1024);
-
-#ifdef MGX_DEBUG
-	int j;
-	mgx_write_vga(sc, SEQ_INDEX, 0x10);
-	mgx_write_vga(sc, SEQ_DATA, 0x12);
-	for (i = 0x10; i < 0x30; i += 16) {
-		printf("%02x:", i);
-		for (j = 0; j < 16; j++) {
-			mgx_write_vga(sc, SEQ_INDEX, i + j);
-			printf(" %02x", mgx_read_vga(sc, SEQ_DATA));
-		}
-		printf("\n");
-	}
-#if 0
-	

Re: CVS commit: src/sys/dev/hdaudio

2017-08-04 Thread Robert Elz
Date:Sat, 05 Aug 2017 04:29:33 +1000
From:matthew green 
Message-ID:  <3108.1501871...@splode.eterna.com.au>

  | we are talking about 7 lines that appear every time my monitor
  | goes out of power save.

That is strange, and suggests that the X server is somehow making
the system re-probe the audio - what is the HDMI source?   (Mine is
from the Intel integrated graphics in the CPU chip.)

I have even more lines, as I have added more debug to look and see why
things are failing, but the only place I can find it is in dmesg.boot,
the output from dmesg is filled with noise from the CD driver (from
attempting to read either an empty drive, or an audio, or blank (unwritten
yet) CD, and failing, and insisting on blathering about it ... now that is
spam that could be deleted ... it only happens when I do something CD related
of course, but over time, there's enough if it that there is nothing else
in the dmesg output - certainly no HDMI audio related messages, and the
monitor is going on and off all the time - though I do have the screen saver
disabled)

I also get USB mouse spam, if I do not have X running (that's rare enough
that it doesn't end up bothering me) but as long as the mouse is present,
and nothing is actually using it, every few minutes it seems to detatch and
reattach.

kre



CVS commit: src/share/mk

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 22:27:37 UTC 2017

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

Log Message:
switch bebox, cats, ibmnsw and prep to xorg-server 1.18.


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

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1012 src/share/mk/bsd.own.mk:1.1013
--- src/share/mk/bsd.own.mk:1.1012	Sun Jul 23 20:45:31 2017
+++ src/share/mk/bsd.own.mk	Fri Aug  4 22:27:37 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1012 2017/07/23 20:45:31 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.1013 2017/08/04 22:27:37 mrg Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1355,20 +1355,16 @@ X11SRCDIR.${_proto}proto?=		${X11SRCDIRM
 .if \
 ${MACHINE} == "alpha"	|| \
 ${MACHINE} == "amiga"	|| \
-${MACHINE} == "bebox"	|| \
-${MACHINE} == "cats"	|| \
 ${MACHINE} == "dreamcast"	|| \
 ${MACHINE} == "ews4800mips"	|| \
 ${MACHINE} == "hp300"	|| \
 ${MACHINE} == "hpcarm"	|| \
 ${MACHINE} == "hpcmips"	|| \
 ${MACHINE} == "hpcsh"	|| \
-${MACHINE} == "ibmnws"	|| \
 ${MACHINE} == "luna68k"	|| \
 ${MACHINE} == "mac68k"	|| \
 ${MACHINE} == "netwinder"	|| \
 ${MACHINE} == "newsmips"	|| \
-${MACHINE} == "prep"	|| \
 ${MACHINE} == "sgimips"	|| \
 ${MACHINE} == "vax"		|| \
 ${MACHINE} == "zaurus"



CVS commit: src/share/mk

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 22:27:37 UTC 2017

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

Log Message:
switch bebox, cats, ibmnsw and prep to xorg-server 1.18.


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

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



CVS commit: [perseant-stdc-iso10646] src

2017-08-04 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Fri Aug  4 21:43:11 UTC 2017

Modified Files:
src/distrib/sets/lists/base [perseant-stdc-iso10646]: mi
src/distrib/sets/lists/debug [perseant-stdc-iso10646]: mi
src/distrib/sets/lists/man [perseant-stdc-iso10646]: mi
src/lib/libc/citrus [perseant-stdc-iso10646]: citrus_ctype_template.h
src/lib/libc/locale [perseant-stdc-iso10646]: runetype_file.h
Added Files:
src/usr.bin/localedef [perseant-stdc-iso10646]: Makefile README
charmap.c collate.c ctype.c iso2022.c localedef localedef.1
localedef.c localedef.h messages.c mklocaledb.c mklocaledb.h
monetary.c numeric.c parser.c parser.h parser.y scanner.c time.c
wide.c

Log Message:
Add a version of localedef(1), taken from FreeBSD, which works with
NetBSD's binary format.  LC_CTYPE should be mostly compatible but is
still missing pieces; the LC_COLLATE format is in a similar situation,
since it makes different assumptions than UCA/DUCET.  The other, smaller,
LC_* types should all work, but have not been extensively tested.


To generate a diff of this commit:
cvs rdiff -u -r1.1158 -r1.1158.4.1 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.220.2.1 -r1.220.2.2 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1559 -r1.1559.2.1 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.36.22.2 -r1.36.22.3 \
src/lib/libc/citrus/citrus_ctype_template.h
cvs rdiff -u -r1.3 -r1.3.40.1 src/lib/libc/locale/runetype_file.h
cvs rdiff -u -r0 -r1.1.2.1 src/usr.bin/localedef/Makefile \
src/usr.bin/localedef/README src/usr.bin/localedef/charmap.c \
src/usr.bin/localedef/collate.c src/usr.bin/localedef/ctype.c \
src/usr.bin/localedef/iso2022.c src/usr.bin/localedef/localedef \
src/usr.bin/localedef/localedef.1 src/usr.bin/localedef/localedef.c \
src/usr.bin/localedef/localedef.h src/usr.bin/localedef/messages.c \
src/usr.bin/localedef/mklocaledb.c src/usr.bin/localedef/mklocaledb.h \
src/usr.bin/localedef/monetary.c src/usr.bin/localedef/numeric.c \
src/usr.bin/localedef/parser.c src/usr.bin/localedef/parser.h \
src/usr.bin/localedef/parser.y src/usr.bin/localedef/scanner.c \
src/usr.bin/localedef/time.c src/usr.bin/localedef/wide.c

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



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

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 21:27:34 UTC 2017

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

Log Message:
mark ark_drv as obsolete in xorg-server 1.18


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/xserver/md.cats

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

Modified files:

Index: src/distrib/sets/lists/xserver/md.cats
diff -u src/distrib/sets/lists/xserver/md.cats:1.56 src/distrib/sets/lists/xserver/md.cats:1.57
--- src/distrib/sets/lists/xserver/md.cats:1.56	Thu Jan  5 02:22:19 2017
+++ src/distrib/sets/lists/xserver/md.cats	Fri Aug  4 21:27:34 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.cats,v 1.56 2017/01/05 02:22:19 christos Exp $
+# $NetBSD: md.cats,v 1.57 2017/08/04 21:27:34 mrg Exp $
 ./usr/X11R7/bin/X	-unknown-	xorg
 ./usr/X11R7/bin/Xorg	-unknown-	xorg
 ./usr/X11R7/bin/cvt	-unknown-	xorg
@@ -15,8 +15,10 @@
 ./usr/X11R7/lib/modules/drivers/apm_drv.so		-unknown-	xorg,xorg_server_ver=118,obsolete
 ./usr/X11R7/lib/modules/drivers/apm_drv.so.1		-unknown-	xorg,xorg_server_ver=110
 ./usr/X11R7/lib/modules/drivers/apm_drv.so.1		-unknown-	xorg,xorg_server_ver=118,obsolete
-./usr/X11R7/lib/modules/drivers/ark_drv.so		-unknown-	xorg
-./usr/X11R7/lib/modules/drivers/ark_drv.so.0		-unknown-	xorg
+./usr/X11R7/lib/modules/drivers/ark_drv.so		-unknown-	xorg,xorg_server_ver=110
+./usr/X11R7/lib/modules/drivers/ark_drv.so		-unknown-	xorg,xorg_server_ver=118,obsolete
+./usr/X11R7/lib/modules/drivers/ark_drv.so.0		-unknown-	xorg,xorg_server_ver=110
+./usr/X11R7/lib/modules/drivers/ark_drv.so.0		-unknown-	xorg,xorg_server_ver=118,obsolete
 ./usr/X11R7/lib/modules/drivers/ast_drv.so		-unknown-	xorg
 ./usr/X11R7/lib/modules/drivers/ast_drv.so.1		-unknown-	xorg
 ./usr/X11R7/lib/modules/drivers/ati_drv.so		-unknown-	xorg



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

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 21:27:34 UTC 2017

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

Log Message:
mark ark_drv as obsolete in xorg-server 1.18


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/distrib/sets/lists/xserver/md.cats

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



Re: CVS commit: src/sys/arch

2017-08-04 Thread coypu
On Fri, Aug 04, 2017 at 12:26:01PM +0200, Maxime Villard wrote:
> We can; but this would be an executable page at a fixed location, and by
> definition it violates ASLR. Even more so if the page happens to contain
> instruction patterns suitable for all kinds of exploits...

linux seems to randomize their vDSO page location, so it's possible not
to violate ASLR


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

2017-08-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug  4 20:53:47 UTC 2017

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

Log Message:
prb_control need to add (or) PRB_CF_INTERRUPT_MASK for polled commands,
rather that set - the field may be nonzero for ATAPI or for protocol override


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.32 -r1.30.4.33 src/sys/dev/ic/siisata.c

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



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

2017-08-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug  4 20:53:47 UTC 2017

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

Log Message:
prb_control need to add (or) PRB_CF_INTERRUPT_MASK for polled commands,
rather that set - the field may be nonzero for ATAPI or for protocol override


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.32 -r1.30.4.33 src/sys/dev/ic/siisata.c

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

Modified files:

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.32 src/sys/dev/ic/siisata.c:1.30.4.33
--- src/sys/dev/ic/siisata.c:1.30.4.32	Fri Aug  4 20:49:24 2017
+++ src/sys/dev/ic/siisata.c	Fri Aug  4 20:53:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.32 2017/08/04 20:49:24 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.33 2017/08/04 20:53:46 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.32 2017/08/04 20:49:24 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.33 2017/08/04 20:53:46 jdolecek Exp $");
 
 #include 
 #include 
@@ -1039,7 +1039,7 @@ siisata_cmd_start(struct ata_channel *ch
 
 	if (xfer->c_flags & C_POLL) {
 		/* polled command, disable interrupts */
-		prb->prb_control = htole16(PRB_CF_INTERRUPT_MASK);
+		prb->prb_control |= htole16(PRB_CF_INTERRUPT_MASK);
 		siisata_disable_port_interrupt(chp);
 	}
 
@@ -1256,7 +1256,7 @@ siisata_bio_start(struct ata_channel *ch
 
 	if (xfer->c_flags & C_POLL) {
 		/* polled command, disable interrupts */
-		prb->prb_control = htole16(PRB_CF_INTERRUPT_MASK);
+		prb->prb_control |= htole16(PRB_CF_INTERRUPT_MASK);
 		siisata_disable_port_interrupt(chp);
 	}
 
@@ -1849,7 +1849,7 @@ siisata_atapi_start(struct ata_channel *
 
 	if (xfer->c_flags & C_POLL) {
 		/* polled command, disable interrupts */
-		prbp->prb_control = htole16(PRB_CF_INTERRUPT_MASK);
+		prbp->prb_control |= htole16(PRB_CF_INTERRUPT_MASK);
 		siisata_disable_port_interrupt(chp);
 	}
 



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

2017-08-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug  4 20:49:24 UTC 2017

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

Log Message:
restore part of what was removed in 1.30.4.30 - the success of command
needs to be driven by PSS so that it works also for polled commands, apparently
PR_PIS_CMDCMPL is not set in that case; now do error handling again only when
PSS_ATTENTION is set

this fixes timeout for polled commands like standby on shutdown,
and (ehm ehm), READ LOG EXT on NCQ error recovery


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.31 -r1.30.4.32 src/sys/dev/ic/siisata.c

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



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

2017-08-04 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Fri Aug  4 20:49:24 UTC 2017

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

Log Message:
restore part of what was removed in 1.30.4.30 - the success of command
needs to be driven by PSS so that it works also for polled commands, apparently
PR_PIS_CMDCMPL is not set in that case; now do error handling again only when
PSS_ATTENTION is set

this fixes timeout for polled commands like standby on shutdown,
and (ehm ehm), READ LOG EXT on NCQ error recovery


To generate a diff of this commit:
cvs rdiff -u -r1.30.4.31 -r1.30.4.32 src/sys/dev/ic/siisata.c

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

Modified files:

Index: src/sys/dev/ic/siisata.c
diff -u src/sys/dev/ic/siisata.c:1.30.4.31 src/sys/dev/ic/siisata.c:1.30.4.32
--- src/sys/dev/ic/siisata.c:1.30.4.31	Tue Aug  1 22:02:32 2017
+++ src/sys/dev/ic/siisata.c	Fri Aug  4 20:49:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: siisata.c,v 1.30.4.31 2017/08/01 22:02:32 jdolecek Exp $ */
+/* $NetBSD: siisata.c,v 1.30.4.32 2017/08/04 20:49:24 jdolecek Exp $ */
 
 /* from ahcisata_core.c */
 
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.31 2017/08/01 22:02:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siisata.c,v 1.30.4.32 2017/08/04 20:49:24 jdolecek Exp $");
 
 #include 
 #include 
@@ -262,9 +262,12 @@ siisata_init_port(struct siisata_softc *
 	schp = >sc_channels[port];
 	chp = (struct ata_channel *)schp;
 
-	/* come out of reset, 64-bit activation */
+	/*
+	 * Come out of reset. Disable no clearing of PR_PIS_CMDCMPL on read
+	 * of PR_PSS. Disable 32-bit PRB activation, we use 64-bit activation.
+	 */
 	PRWRITE(sc, PRX(chp->ch_channel, PRO_PCC),
-	PR_PC_32BA | PR_PC_PORT_RESET);
+	PR_PC_32BA | PR_PC_INCOR | PR_PC_PORT_RESET);
 	/* initialize port */
 	siisata_reinit_port(chp, -1);
 	/* enable CmdErrr+CmdCmpl interrupting */
@@ -478,22 +481,22 @@ siisata_intr_port(struct siisata_channel
 	uint32_t pss, pis, tfd = 0;
 	bool recover = false;
 
-	pis = PRREAD(sc, PRX(chp->ch_channel, PRO_PIS));
+	/* get slot status, clearing completion interrupt */
+	pss = PRREAD(sc, PRX(chp->ch_channel, PRO_PSS));
 
-	SIISATA_DEBUG_PRINT(("%s: %s port %d, pis 0x%x ",
-	SIISATANAME(sc), __func__, chp->ch_channel, pis),
+	SIISATA_DEBUG_PRINT(("%s: %s port %d, pss 0x%x ",
+	SIISATANAME(sc), __func__, chp->ch_channel, pss),
 	DEBUG_INTR);
 
-	if (pis & PR_PIS_CMDCMPL) {
-		/* get slot status, clearing completion interrupt */
-		pss = PRREAD(sc, PRX(chp->ch_channel, PRO_PSS));
-
-		SIISATA_DEBUG_PRINT(("pss 0x%x\n", pss), DEBUG_INTR);
-	} else {
-		/* commands will be killed after recovery */
-		pss = 0x;
+	if (__predict_true((pss & PR_PSS_ATTENTION) == 0)) {
+		SIISATA_DEBUG_PRINT(("no attention"), DEBUG_INTR);
+		goto process;
 	}
 
+	pis = PRREAD(sc, PRX(chp->ch_channel, PRO_PIS));
+
+	SIISATA_DEBUG_PRINT(("pis 0x%x\n", pss), DEBUG_INTR);
+
 	if (pis & PR_PIS_CMDERRR) {
 		uint32_t ec;
 
@@ -552,6 +555,7 @@ siisata_intr_port(struct siisata_channel
 	if (__predict_false(recover))
 		ata_channel_freeze(chp);
 
+process:
 	if (xfer != NULL) {
 		xfer->c_intr(chp, xfer, tfd);
 	} else {



CVS commit: src/sys/netinet

2017-08-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Aug  4 20:17:45 UTC 2017

Modified Files:
src/sys/netinet: in.c

Log Message:
Fix it's -> its in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/netinet/in.c

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



CVS commit: src/sys/netinet

2017-08-04 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Fri Aug  4 20:17:45 UTC 2017

Modified Files:
src/sys/netinet: in.c

Log Message:
Fix it's -> its in a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/netinet/in.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/netinet/in.c
diff -u src/sys/netinet/in.c:1.205 src/sys/netinet/in.c:1.206
--- src/sys/netinet/in.c:1.205	Thu Jun 22 09:53:24 2017
+++ src/sys/netinet/in.c	Fri Aug  4 20:17:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.205 2017/06/22 09:53:24 ozaki-r Exp $	*/
+/*	$NetBSD: in.c,v 1.206 2017/08/04 20:17:45 uwe Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.205 2017/06/22 09:53:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.206 2017/08/04 20:17:45 uwe Exp $");
 
 #include "arp.h"
 
@@ -1126,7 +1126,7 @@ in_ifinit(struct ifnet *ifp, struct in_i
 	s = splsoftnet();
 	error = if_addr_init(ifp, >ia_ifa, true);
 	splx(s);
-	/* Now clear the try tentative flag, it's job is done. */
+	/* Now clear the try tentative flag, its job is done. */
 	ia->ia4_flags &= ~IN_IFF_TRYTENTATIVE;
 	if (error != 0) {
 		ia->ia_addr = oldaddr;



re: CVS commit: src/sys/dev/hdaudio

2017-08-04 Thread matthew green
> We are talking about just 1 message at boot, compared with the rest of
> what is there, that is hardly "spam" - once one of the errors occurs, the

we are talking about 7 lines that appear every time my monitor
goes out of power save.  my dmesg is spammed and if my desktop
were to stay up long enough, fills it.

to be honest, the author of the code recommended i simply remove
all this code since it doesn't work.  i choose to allow someone
else to have a headstart fixing it.  it doesn't help or hurt the
use of hdmi audio on at least 4 systems i've tested.


.mrg.


CVS commit: src/doc

2017-08-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Aug  4 11:55:06 UTC 2017

Modified Files:
src/doc: TODO.modules

Log Message:
Add a note regarding the need for a common mechanism for defining and
building modules, whether built-in or separately-loadable.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/doc/TODO.modules

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

Modified files:

Index: src/doc/TODO.modules
diff -u src/doc/TODO.modules:1.11 src/doc/TODO.modules:1.12
--- src/doc/TODO.modules:1.11	Thu Jan 26 04:24:20 2017
+++ src/doc/TODO.modules	Fri Aug  4 11:55:06 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO.modules,v 1.11 2017/01/26 04:24:20 pgoyette Exp $ */
+/* $NetBSD: TODO.modules,v 1.12 2017/08/04 11:55:06 pgoyette Exp $ */
 
 Some notes on the limitations of our current (as of 7.99.35) module
 subsystem.  This list was triggered by an Email exchange between
@@ -135,3 +135,11 @@ christos and pgoyette.
 loader time, an alternate value for the os-release portion of the
 default module path,  i.e. /stand/$MACHINE/$ALT-RELEASE/modules/
 
+15. The existing config(5) framework provides an excellent mechanism
+for managing the content of kernels.  Unfortunately, this mechanism
+does not apply for modules, and instead we need to manually manage
+a list of files to include in the module, the set of compiler
+definitions with which to build those files, and also the set of
+other modules on which a module depends.  We really need a common
+mechanism to define and build modules, whether they are included as
+"built-in" modules or as separately-loadable modules.



CVS commit: src/doc

2017-08-04 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Fri Aug  4 11:55:06 UTC 2017

Modified Files:
src/doc: TODO.modules

Log Message:
Add a note regarding the need for a common mechanism for defining and
building modules, whether built-in or separately-loadable.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/doc/TODO.modules

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



Re: CVS commit: src/sys/arch

2017-08-04 Thread Maxime Villard

Le 03/08/2017 à 22:38, Joerg Sonnenberger a écrit :

On Thu, Aug 03, 2017 at 04:20:45PM +0200, Maxime Villard wrote:

I was more thinking in terms of a single page in kernel VA, not in user
VA. That would side step most of the issues with dynamic LDT or having
to patch up the default LDT on context switches. That said, the latter
wouldn't be that difficult either, given that we already do that for the
GDT.


Mmh, not sure what you mean. If you mean a page that is a kernel page (in the
sense of not having PG_u), then it's a privileged call gate, and we're back
on the first issue (being in kernel mode, with user segment registers, and
interrupts enabled). If you mean a page this a userland page (with PG_u), but
located in the kernel VA range, that's not a good idea: it all of a sudden
makes the map less consistent, and it is more complicated since the upper
levels of the page tree need to have PG_u too.


I was thinking of a page in the kernel VA range that is accessible for
userland. I thought we had some of those already for the comm page, but
I might be misremember.


Ok, so it was my second guess. As I said, I don't think it's a good idea if
we start mixing userland-kernel VAs. As far as I can tell, it is not already
the case - if it were, I would have probably tried to fix it, because it is
error-prone.


We can also put it at the top of the user VA
range of course, i.e. where the stack used to originate.


We can; but this would be an executable page at a fixed location, and by
definition it violates ASLR. Even more so if the page happens to contain
instruction patterns suitable for all kinds of exploits...

Maxime


CVS commit: src/sys

2017-08-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug  4 09:33:03 UTC 2017

Modified Files:
src/sys/arch/vax/conf: GENERIC VAX780
src/sys/compat/common: Makefile

Log Message:
typos


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/conf/GENERIC
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/vax/conf/VAX780
cvs rdiff -u -r1.60 -r1.61 src/sys/compat/common/Makefile

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



CVS commit: src/sys

2017-08-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug  4 09:33:03 UTC 2017

Modified Files:
src/sys/arch/vax/conf: GENERIC VAX780
src/sys/compat/common: Makefile

Log Message:
typos


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/arch/vax/conf/GENERIC
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/vax/conf/VAX780
cvs rdiff -u -r1.60 -r1.61 src/sys/compat/common/Makefile

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/vax/conf/GENERIC
diff -u src/sys/arch/vax/conf/GENERIC:1.200 src/sys/arch/vax/conf/GENERIC:1.201
--- src/sys/arch/vax/conf/GENERIC:1.200	Tue Dec 27 08:56:00 2016
+++ src/sys/arch/vax/conf/GENERIC	Fri Aug  4 09:33:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.200 2016/12/27 08:56:00 flxd Exp $
+# $NetBSD: GENERIC,v 1.201 2017/08/04 09:33:03 maxv Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@ include		"arch/vax/conf/std.vax"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.200 $"
+#ident 		"GENERIC-$Revision: 1.201 $"
 
 # Here are all different supported CPU types listed.
 #options 	VAX8800		# VAX 8500, 8530, 8550, 8700, 8800
@@ -149,7 +149,7 @@ options 	COMPAT_50	# NetBSD 5.0,
 options 	COMPAT_60	# NetBSD 6.0, and
 options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
 options 	COMPAT_ULTRIX
-options 	COMPAT_IBCS2	# DEC SVR.3 compatilibity
+options 	COMPAT_IBCS2	# DEC SVR.3 compatibility
 #options 	NO_INSN_EMULATE	# CPU does not lack some hardware instructions.
 options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 

Index: src/sys/arch/vax/conf/VAX780
diff -u src/sys/arch/vax/conf/VAX780:1.21 src/sys/arch/vax/conf/VAX780:1.22
--- src/sys/arch/vax/conf/VAX780:1.21	Tue Dec 27 08:56:00 2016
+++ src/sys/arch/vax/conf/VAX780	Fri Aug  4 09:33:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: VAX780,v 1.21 2016/12/27 08:56:00 flxd Exp $
+# $NetBSD: VAX780,v 1.22 2017/08/04 09:33:03 maxv Exp $
 #
 # 11/780,750,730 machine description file
 # 
@@ -131,7 +131,7 @@ options 	COMPAT_20	# NetBSD 2.0,
 options 	COMPAT_30	# NetBSD 3.0, and
 options 	COMPAT_40	# NetBSD 4.0 binary compatibility.
 options 	COMPAT_ULTRIX	# DEC Ultrix binary compatibility.
-#options 	COMPAT_IBCS2	# DEC SVR.3 compatilibity
+#options 	COMPAT_IBCS2	# DEC SVR.3 compatibility
 #options 	NO_INSN_EMULATE	# CPU does not lack some hardware instructions.
 options		COMPAT_BSDPTY	# /dev/[pt]ty?? ptys.
 

Index: src/sys/compat/common/Makefile
diff -u src/sys/compat/common/Makefile:1.60 src/sys/compat/common/Makefile:1.61
--- src/sys/compat/common/Makefile:1.60	Sat Nov  5 23:30:22 2016
+++ src/sys/compat/common/Makefile	Fri Aug  4 09:33:03 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.60 2016/11/05 23:30:22 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.61 2017/08/04 09:33:03 maxv Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -11,7 +11,7 @@ CPPFLAGS=	${COMPATCPPFLAGS} ${SKIP_AUTOD
 # Common compatibility code, used by all emulations
 SRCS=	compat_exec.c compat_util.c
 
-# Include compatability code common to libcompat and the compat module
+# Include compatibility code common to libcompat and the compat module
 
 .include "Makefile.sysio"
 .include "Makefile.sysv"



CVS commit: src/sys/arch

2017-08-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug  4 09:30:19 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
Revert my changes, and re-enable COMPAT_NOMID, COMPAT_09 and COMPAT_43.
Several compat options happen to be dependent on the compat_43_* functions,
the availability of which is (wrongfully) controlled with COMPAT_43. Same
for COMPAT_09.


To generate a diff of this commit:
cvs rdiff -u -r1.462 -r1.463 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1162 -r1.1163 src/sys/arch/i386/conf/GENERIC

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

Modified files:

Index: src/sys/arch/amd64/conf/GENERIC
diff -u src/sys/arch/amd64/conf/GENERIC:1.462 src/sys/arch/amd64/conf/GENERIC:1.463
--- src/sys/arch/amd64/conf/GENERIC:1.462	Fri Jul 28 16:10:28 2017
+++ src/sys/arch/amd64/conf/GENERIC	Fri Aug  4 09:30:19 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.462 2017/07/28 16:10:28 maxv Exp $
+# $NetBSD: GENERIC,v 1.463 2017/08/04 09:30:19 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.462 $"
+#ident		"GENERIC-$Revision: 1.463 $"
 
 maxusers	64		# estimated number of users
 
@@ -132,7 +132,7 @@ options 	COMPAT_40	# NetBSD 4.0,
 options 	COMPAT_50	# NetBSD 5.0,
 options 	COMPAT_60	# NetBSD 6.0, and
 options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
-#options 	COMPAT_43	# and 4.3BSD
+options 	COMPAT_43	# and 4.3BSD
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
 options 	COMPAT_OSSAUDIO

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1162 src/sys/arch/i386/conf/GENERIC:1.1163
--- src/sys/arch/i386/conf/GENERIC:1.1162	Mon Jul 31 15:43:33 2017
+++ src/sys/arch/i386/conf/GENERIC	Fri Aug  4 09:30:19 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1162 2017/07/31 15:43:33 maxv Exp $
+# $NetBSD: GENERIC,v 1.1163 2017/08/04 09:30:19 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1162 $"
+#ident		"GENERIC-$Revision: 1.1163 $"
 
 maxusers	64		# estimated number of users
 
@@ -124,8 +124,8 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 options 	KDTRACE_HOOKS	# kernel DTrace hooks
 
 # Compatibility options
-#options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
-#options 	COMPAT_09	# NetBSD 0.9,
+options 	COMPAT_NOMID	# NetBSD 0.8, 386BSD, and BSDI
+options 	COMPAT_09	# NetBSD 0.9,
 options 	COMPAT_10	# NetBSD 1.0,
 options 	COMPAT_11	# NetBSD 1.1,
 options 	COMPAT_12	# NetBSD 1.2 (and 386BSD and BSDI),
@@ -139,7 +139,7 @@ options 	COMPAT_40	# NetBSD 4.0,
 options 	COMPAT_50	# NetBSD 5.0,
 options 	COMPAT_60	# NetBSD 6.0, and
 options 	COMPAT_70	# NetBSD 7.0 binary compatibility.
-#options 	COMPAT_43	# 4.3BSD, 386BSD, and BSDI
+options 	COMPAT_43	# 4.3BSD, 386BSD, and BSDI
 #options 	COMPAT_386BSD_MBRPART # recognize old partition ID
 
 options 	COMPAT_OSSAUDIO	# OSS (Voxware) audio driver compatibility



CVS commit: src/sys/arch

2017-08-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Aug  4 09:30:19 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: GENERIC
src/sys/arch/i386/conf: GENERIC

Log Message:
Revert my changes, and re-enable COMPAT_NOMID, COMPAT_09 and COMPAT_43.
Several compat options happen to be dependent on the compat_43_* functions,
the availability of which is (wrongfully) controlled with COMPAT_43. Same
for COMPAT_09.


To generate a diff of this commit:
cvs rdiff -u -r1.462 -r1.463 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.1162 -r1.1163 src/sys/arch/i386/conf/GENERIC

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



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

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 08:45:39 UTC 2017

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

Log Message:
s3virge.4 is a .man not a html.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/xserver/md.bebox

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

Modified files:

Index: src/distrib/sets/lists/xserver/md.bebox
diff -u src/distrib/sets/lists/xserver/md.bebox:1.16 src/distrib/sets/lists/xserver/md.bebox:1.17
--- src/distrib/sets/lists/xserver/md.bebox:1.16	Thu Jan  5 02:22:19 2017
+++ src/distrib/sets/lists/xserver/md.bebox	Fri Aug  4 08:45:39 2017
@@ -1,4 +1,4 @@
-# $NetBSD: md.bebox,v 1.16 2017/01/05 02:22:19 christos Exp $
+# $NetBSD: md.bebox,v 1.17 2017/08/04 08:45:39 mrg Exp $
 ./usr/X11R7/bin/X	-unknown-	xorg
 ./usr/X11R7/bin/Xorg	-unknown-	xorg
 ./usr/X11R7/bin/cvt	-unknown-	xorg
@@ -133,7 +133,7 @@
 ./usr/X11R7/man/man4/mga.4-unknown-	.man,xorg
 ./usr/X11R7/man/man4/mousedrv.4-unknown-	.man,xorg
 ./usr/X11R7/man/man4/s3.4-unknown-	.man,xorg
-./usr/X11R7/man/man4/s3virge.4-unknown-	html,xorg
+./usr/X11R7/man/man4/s3virge.4-unknown-	.man,xorg
 ./usr/X11R7/man/man4/vga.4-unknown-	obsolete
 ./usr/X11R7/man/man4/ws.4-unknown-	.man,xorg
 ./usr/X11R7/man/man5/xorg.conf.5			-unknown-	.man,xorg



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

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 08:45:39 UTC 2017

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

Log Message:
s3virge.4 is a .man not a html.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/sets/lists/xserver/md.bebox

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



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

2017-08-04 Thread Maxime Villard

Le 04/08/2017 à 10:00, matthew green a écrit :

Maxime Villard writes:

Yes, I saw that too a few days later when moving the compat_freebsd files and
trying to do a modload. I went "what the hell is this", but didn't do anything.

What I could see, is that many of our compat options are at some point using
at least one compat_43_* function, even if they have nothing to do with 4.3BSD.

It appears that people just chose to use them, because they were convenient,
instead of re-writing them on purpose. The assumption was that the compat_43
functions would always be there; that's obviously a wrong assumption.

As a quick fix, I can revert my change. But that does not fix this mess; we
would have to either rename compat_43_* to compat_common_* and compile them by
default (ie, without depending on an #ifdef COMPAT_43), or we would have to
implement the functions in all of the compat options with proper names (eg
compat_43_sys_lseek -> freebsd_sys_lseek).


please revert your change (for now?).  thanks.


Alright, I'll do that for now.


Frankly, this is a huge mess.


i don't agree.

the setup comes from before modules and it allows code sharing
because the old 43 version matches other systems. so there's
a single implementation of this code for a large number of
consumers, and the name of it describes where it comes from.


Yes, but the fact that the availability of the compat_43_* functions depends
on #ifdef COMPAT_43, while they are just common functions used in a lot of
places, is wrong. And it has nothing to do with the modules, it was already
wrong before they were introduced (even if it used to be harmless).

As a third (and simpler) solution, we could make sure that these functions are
compiled regardless of COMPAT_43, without renaming them.

Maxime


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

2017-08-04 Thread matthew green
Maxime Villard writes:
> Yes, I saw that too a few days later when moving the compat_freebsd files and
> trying to do a modload. I went "what the hell is this", but didn't do 
> anything.
> 
> What I could see, is that many of our compat options are at some point using
> at least one compat_43_* function, even if they have nothing to do with 
> 4.3BSD.
> 
> It appears that people just chose to use them, because they were convenient,
> instead of re-writing them on purpose. The assumption was that the compat_43
> functions would always be there; that's obviously a wrong assumption.
> 
> As a quick fix, I can revert my change. But that does not fix this mess; we
> would have to either rename compat_43_* to compat_common_* and compile them by
> default (ie, without depending on an #ifdef COMPAT_43), or we would have to
> implement the functions in all of the compat options with proper names (eg
> compat_43_sys_lseek -> freebsd_sys_lseek).

please revert your change (for now?).  thanks.

> Frankly, this is a huge mess.

i don't agree.

the setup comes from before modules and it allows code sharing
because the old 43 version matches other systems.  so there's
a single implementation of this code for a large number of 
consumers, and the name of it describes where it comes from.
this is entirely as designed and desired.

normal kernels handle this fine within the config(5) framework.

that modules don't know how to do this properly yet is not the
existing code's problem -- that's just other of the issues that
modules have that are why they're not yet an acceptible way to
replace functionality.


.mrg.


Re: CVS commit: src/sys/ufs/lfs

2017-08-04 Thread coypu
> Log Message:
> fix buffer overflow/KASSERT when cookies are supplied
> lfs no longer uses the ffs-style struct direct, use the correct minimum
> size

For kicks, 'found by running COMPAT_LINUX', which does this (so does NFS).

LFS still comes with this warning that is very hard to miss:
WARNING: the log-structured file system is experimental
WARNING: it may cause system crashes and/or corrupt data
root file system type: lfs


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

2017-08-04 Thread Maxime Villard

Le 03/08/2017 à 23:32, co...@sdf.org a écrit :

On Fri, Jul 28, 2017 at 04:10:29PM +, Maxime Villard wrote:

Module Name:src
Committed By:   maxv
Date:   Fri Jul 28 16:10:29 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: GENERIC XEN3_DOM0 XEN3_DOMU

Log Message:
After a careful review, and all things considered, disable compat43 by
default on amd64. The use case is limited, the potential for damage too
high, and it is safer to run a BSD4.3 binary on i386 since the kernel does
not have to go through netbsd32 - which may not correctly reproduce i386.


To generate a diff of this commit:
cvs rdiff -u -r1.461 -r1.462 src/sys/arch/amd64/conf/GENERIC
cvs rdiff -u -r1.136 -r1.137 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/amd64/conf/XEN3_DOMU


This breaks running compat_linux as a kernel module:

Aug  4 00:19:19 loggy /netbsd: kobj_checksyms, 974: [compat_linux]: linker 
error: symbol `compat_43_sys_sethostname' not found
Aug  4 00:19:19 loggy /netbsd: kobj_checksyms, 974: [compat_linux]: linker 
error: symbol `compat_43_sys_lseek' not found
Aug  4 00:19:19 loggy /netbsd: WARNING: module error: unable to affix module 
`compat_linux', error 8

I believe paulg made PR kern/51597 for similar issues


Yes, I saw that too a few days later when moving the compat_freebsd files and
trying to do a modload. I went "what the hell is this", but didn't do anything.

What I could see, is that many of our compat options are at some point using
at least one compat_43_* function, even if they have nothing to do with 4.3BSD.

It appears that people just chose to use them, because they were convenient,
instead of re-writing them on purpose. The assumption was that the compat_43
functions would always be there; that's obviously a wrong assumption.

As a quick fix, I can revert my change. But that does not fix this mess; we
would have to either rename compat_43_* to compat_common_* and compile them by
default (ie, without depending on an #ifdef COMPAT_43), or we would have to
implement the functions in all of the compat options with proper names (eg
compat_43_sys_lseek -> freebsd_sys_lseek).

Frankly, this is a huge mess.

Maxime


CVS commit: src/sys/ufs/lfs

2017-08-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Aug  4 07:27:42 UTC 2017

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

Log Message:
fix buffer overflow/KASSERT when cookies are supplied
lfs no longer uses the ffs-style struct direct, use the correct minimum
size

from dholland
XXX more wrong


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/lfs/ulfs_vnops.c

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

Modified files:

Index: src/sys/ufs/lfs/ulfs_vnops.c
diff -u src/sys/ufs/lfs/ulfs_vnops.c:1.49 src/sys/ufs/lfs/ulfs_vnops.c:1.50
--- src/sys/ufs/lfs/ulfs_vnops.c:1.49	Sat Jun 10 05:29:36 2017
+++ src/sys/ufs/lfs/ulfs_vnops.c	Fri Aug  4 07:27:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulfs_vnops.c,v 1.49 2017/06/10 05:29:36 maya Exp $	*/
+/*	$NetBSD: ulfs_vnops.c,v 1.50 2017/08/04 07:27:42 maya Exp $	*/
 /*  from NetBSD: ufs_vnops.c,v 1.232 2016/05/19 18:32:03 riastradh Exp  */
 
 /*-
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.49 2017/06/10 05:29:36 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulfs_vnops.c,v 1.50 2017/08/04 07:27:42 maya Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_lfs.h"
@@ -826,7 +826,7 @@ ulfs_readdir(void *v)
 
 	off = uio->uio_offset;
 	if (ap->a_cookies) {
-		ccount = rcount / _DIRENT_RECLEN(ndp, 1);
+		ccount = rcount / LFS_DIRECTSIZ(fs, 1);
 		ccp = *(ap->a_cookies) = malloc(ccount * sizeof(*ccp),
 		M_TEMP, M_WAITOK);
 	} else {



CVS commit: src/sys/ufs/lfs

2017-08-04 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Aug  4 07:27:42 UTC 2017

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

Log Message:
fix buffer overflow/KASSERT when cookies are supplied
lfs no longer uses the ffs-style struct direct, use the correct minimum
size

from dholland
XXX more wrong


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/lfs/ulfs_vnops.c

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



CVS commit: src/usr.bin/gzip

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:27:08 UTC 2017

Modified Files:
src/usr.bin/gzip: gzip.1 gzip.c unbzip2.c unpack.c unxz.c

Log Message:
add SIGINFO support.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/gzip/gzip.1
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/gzip/gzip.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/gzip/unbzip2.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/gzip/unpack.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/gzip/unxz.c

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

Modified files:

Index: src/usr.bin/gzip/gzip.1
diff -u src/usr.bin/gzip/gzip.1:1.28 src/usr.bin/gzip/gzip.1:1.29
--- src/usr.bin/gzip/gzip.1:1.28	Sat Jun  3 21:28:48 2017
+++ src/usr.bin/gzip/gzip.1	Fri Aug  4 07:27:08 2017
@@ -1,6 +1,6 @@
-.\"	$NetBSD: gzip.1,v 1.28 2017/06/03 21:28:48 mrg Exp $
+.\"	$NetBSD: gzip.1,v 1.29 2017/08/04 07:27:08 mrg Exp $
 .\"
-.\" Copyright (c) 1997, 2003, 2004, 2008, 2009, 2015 Matthew R. Green
+.\" Copyright (c) 1997, 2003, 2004, 2008, 2009, 2015, 2017 Matthew R. Green
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -179,6 +179,13 @@ The
 utility exits 0 on success,
 1 on errors,
 and 2 if a warning occurs.
+.Sh SIGNALS
+.Nm
+responds to the following signals:
+.Bl -tag -width indent
+.It Dv SIGINFO
+Report progress to standard error.
+.El
 .Sh SEE ALSO
 .Xr bzip2 1 ,
 .Xr compress 1 ,
@@ -202,7 +209,7 @@ program for
 This manual documents
 .Nx
 .Nm
-version 20150113.
+version 20170803.
 .Sh AUTHORS
 This implementation of
 .Nm

Index: src/usr.bin/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.110 src/usr.bin/gzip/gzip.c:1.111
--- src/usr.bin/gzip/gzip.c:1.110	Sat Jun  3 21:28:48 2017
+++ src/usr.bin/gzip/gzip.c	Fri Aug  4 07:27:08 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: gzip.c,v 1.110 2017/06/03 21:28:48 mrg Exp $	*/
+/*	$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $	*/
 
 /*
- * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015
+ * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
  *Matthew R. Green
  * All rights reserved.
  *
@@ -30,8 +30,8 @@
 #include 
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
- 2009, 2010, 2011, 2015 Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.110 2017/06/03 21:28:48 mrg Exp $");
+ 2009, 2010, 2011, 2015, 2017 Matthew R. Green.  All rights reserved.");
+__RCSID("$NetBSD: gzip.c,v 1.111 2017/08/04 07:27:08 mrg Exp $");
 #endif /* not lint */
 
 /*
@@ -161,7 +161,7 @@ static suffixes_t suffixes[] = {
 #define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
 #define SUFFIX_MAXLEN	30
 
-static	const char	gzip_version[] = "NetBSD gzip 20150113";
+static	const char	gzip_version[] = "NetBSD gzip 20170803";
 
 static	int	cflag;			/* stdout mode */
 static	int	dflag;			/* decompress mode */
@@ -177,6 +177,7 @@ static	int	qflag;			/* quiet mode */
 static	int	rflag;			/* recursive mode */
 static	int	tflag;			/* test */
 static	int	vflag;			/* verbose mode */
+static	sig_atomic_t print_info = 0;
 #else
 #define		qflag	0
 #define		tflag	0
@@ -184,7 +185,7 @@ static	int	vflag;			/* verbose mode */
 
 static	int	exit_value = 0;		/* exit value */
 
-static	char	*infile;		/* name of file coming in */
+static	const char *infile;		/* name of file coming in */
 
 static	void	maybe_err(const char *fmt, ...) __printflike(1, 2) __dead;
 #if !defined(NO_BZIP2_SUPPORT) || !defined(NO_PACK_SUPPORT) ||	\
@@ -213,8 +214,20 @@ static	const suffixes_t *check_suffix(ch
 static	ssize_t	read_retry(int, void *, size_t);
 
 #ifdef SMALL
+#define infile_set(f,t) infile_set(f)
+#endif
+static	void	infile_set(const char *newinfile, off_t total);
+
+#ifdef SMALL
 #define unlink_input(f, sb) unlink(f)
+#define check_siginfo() /* nothing */
+#define setup_signals() /* nothing */
+#define infile_newdata(t) /* nothing */
 #else
+static	off_t	infile_total;		/* total expected to read/write */
+static	off_t	infile_current;		/* current read/write */
+
+static	void	check_siginfo(void);
 static	off_t	cat_fd(unsigned char *, size_t, off_t *, int fd);
 static	void	prepend_gzip(char *, int *, char ***);
 static	void	handle_dir(char *);
@@ -222,6 +235,9 @@ static	void	print_verbage(const char *, 
 static	void	print_test(const char *, int);
 static	void	copymodes(int fd, const struct stat *, const char *file);
 static	int	check_outfile(const char *outfile);
+static	void	setup_signals(void);
+static	void	infile_newdata(size_t newdata);
+static	void	infile_clear(void);
 #endif
 
 #ifndef NO_BZIP2_SUPPORT
@@ -285,7 +301,7 @@ main(int argc, char **argv)
 #endif
 	int ch;
 
-	/* XXX set up signals */
+	setup_signals();
 
 #ifndef SMALL
 	if ((gzip = getenv("GZIP")) != NULL)
@@ -559,7 +575,7 @@ gz_compress(int in, int out, off_t *gsiz
 		origname = "";
 	}
 
-	i = snprintf(outbufp, BUFLEN, "%c%c%c%c%c%c%c%c%c%c%s", 
+	

CVS commit: src/usr.bin/gzip

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:27:08 UTC 2017

Modified Files:
src/usr.bin/gzip: gzip.1 gzip.c unbzip2.c unpack.c unxz.c

Log Message:
add SIGINFO support.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/gzip/gzip.1
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/gzip/gzip.c
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/gzip/unbzip2.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/gzip/unpack.c
cvs rdiff -u -r1.6 -r1.7 src/usr.bin/gzip/unxz.c

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



CVS commit: src/sbin/fsdb

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:19:35 UTC 2017

Modified Files:
src/sbin/fsdb: fsdb.8 fsdb.c

Log Message:
add a "saveblks " command that saves the data blocks of the current
inode into named file.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsdb/fsdb.8
cvs rdiff -u -r1.49 -r1.50 src/sbin/fsdb/fsdb.c

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



CVS commit: src/sbin/fsdb

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:19:35 UTC 2017

Modified Files:
src/sbin/fsdb: fsdb.8 fsdb.c

Log Message:
add a "saveblks " command that saves the data blocks of the current
inode into named file.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sbin/fsdb/fsdb.8
cvs rdiff -u -r1.49 -r1.50 src/sbin/fsdb/fsdb.c

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

Modified files:

Index: src/sbin/fsdb/fsdb.8
diff -u src/sbin/fsdb/fsdb.8:1.24 src/sbin/fsdb/fsdb.8:1.25
--- src/sbin/fsdb/fsdb.8:1.24	Mon Jul  3 21:33:41 2017
+++ src/sbin/fsdb/fsdb.8	Fri Aug  4 07:19:35 2017
@@ -1,6 +1,6 @@
-.\"	$NetBSD: fsdb.8,v 1.24 2017/07/03 21:33:41 wiz Exp $
+.\"	$NetBSD: fsdb.8,v 1.25 2017/08/04 07:19:35 mrg Exp $
 .\"
-.\" Copyright (c) 1996 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1996, 2017 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd January 3, 2004
+.Dd August 3, 2017
 .Dt FSDB 8
 .Os
 .Sh NAME
@@ -136,6 +136,10 @@ Find the inode(s) owning the specified d
 Note that these are not absolute disk blocks numbers, but offsets from the
 start of the partition.
 .Pp
+.It Cm saveblks Ar filename
+Save the current inode's data into
+.Ar filename .
+.Pp
 .It Cm rm Ar name
 .It Cm del Ar name
 Remove the entry

Index: src/sbin/fsdb/fsdb.c
diff -u src/sbin/fsdb/fsdb.c:1.49 src/sbin/fsdb/fsdb.c:1.50
--- src/sbin/fsdb/fsdb.c:1.49	Thu Jul 28 08:24:58 2016
+++ src/sbin/fsdb/fsdb.c	Fri Aug  4 07:19:35 2017
@@ -1,7 +1,7 @@
-/*	$NetBSD: fsdb.c,v 1.49 2016/07/28 08:24:58 martin Exp $	*/
+/*	$NetBSD: fsdb.c,v 1.50 2017/08/04 07:19:35 mrg Exp $	*/
 
 /*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 2017 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -31,7 +31,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: fsdb.c,v 1.49 2016/07/28 08:24:58 martin Exp $");
+__RCSID("$NetBSD: fsdb.c,v 1.50 2017/08/04 07:19:35 mrg Exp $");
 #endif /* not lint */
 
 #include 
@@ -61,6 +61,13 @@ __RCSID("$NetBSD: fsdb.c,v 1.49 2016/07/
 #include "fsck.h"
 #include "extern.h"
 
+/* Used to keep state for "saveblks" command.  */
+struct wrinfo {
+	off_t size;
+	off_t written_size;
+	int fd;
+};
+
 __dead static void usage(void);
 static int cmdloop(void);
 static char *prompt(EditLine *);
@@ -69,12 +76,12 @@ static int dolookup(char *);
 static int chinumfunc(struct inodesc *);
 static int chnamefunc(struct inodesc *);
 static int dotime(char *, int32_t *, int32_t *);
-static void print_blks32(int32_t *buf, int size, uint64_t *blknum);
-static void print_blks64(int64_t *buf, int size, uint64_t *blknum);
+static void print_blks32(int32_t *buf, int size, uint64_t *blknum, struct wrinfo *wrp);
+static void print_blks64(int64_t *buf, int size, uint64_t *blknum, struct wrinfo *wrp);
 static void print_indirblks32(uint32_t blk, int ind_level,
-uint64_t *blknum);
+uint64_t *blknum, struct wrinfo *wrp);
 static void print_indirblks64(uint64_t blk, int ind_level,
-uint64_t *blknum);
+uint64_t *blknum, struct wrinfo *wrp);
 static int compare_blk32(uint32_t *, uint32_t);
 static int compare_blk64(uint64_t *, uint64_t);
 static int founddatablk(uint64_t);
@@ -191,6 +198,7 @@ static struct cmdtable cmds[] = {
 	{"linkcount", "Set link count to COUNT", 2, 2, linkcount},
 	{"ls", "List current inode as directory", 1, 1, ls},
 	{"blks", "List current inode's data blocks", 1, 1, blks},
+	{"saveblks", "Save current inode's data blocks", 2, 2, blks},
 	{"findblk", "Find inode owning disk block(s)", 2, 33, findblk},
 	{"rm", "Remove NAME from current inode directory", 2, 2, rm},
 	{"del", "Remove NAME from current inode directory", 2, 2, rm},
@@ -452,6 +460,18 @@ CMDFUNC(blks)
 {
 	uint64_t blkno = 0;
 	int i, type;
+	struct wrinfo wrinfo, *wrp = NULL;
+
+	if (strcmp(argv[0], "saveblks") == 0) {
+		wrinfo.fd = open(argv[1], O_WRONLY | O_TRUNC | O_CREAT, 0644);
+		if (wrinfo.fd == -1) {
+			warn("unable to create file %s", argv[1]);
+			return 0;
+		}
+		wrinfo.size = DIP(curinode, size);
+		wrinfo.written_size = 0;
+		wrp = 
+	}
 	if (!curinode) {
 		warnx("no current inode");
 		return 0;
@@ -471,18 +491,18 @@ CMDFUNC(blks)
 	}
 	printf("Direct blocks:\n");
 	if (is_ufs2)
-		print_blks64(curinode->dp2.di_db, UFS_NDADDR, );
+		print_blks64(curinode->dp2.di_db, UFS_NDADDR, , wrp);
 	else
-		print_blks32(curinode->dp1.di_db, UFS_NDADDR, );
+		print_blks32(curinode->dp1.di_db, UFS_NDADDR, , wrp);
 
 	if (is_ufs2) {
 		for (i = 0; i < UFS_NIADDR; i++)
 			print_indirblks64(iswap64(curinode->dp2.di_ib[i]), i,
-			);
+			, wrp);
 	} else {
 		for (i = 0; i < UFS_NIADDR; i++)
 			

re: CVS commit: src/sys/dev/hdaudio

2017-08-04 Thread matthew green
Robert Elz writes:
> Date:Fri, 4 Aug 2017 00:25:24 +
> From:"matthew green" 
> Message-ID:  <20170804002524.16ba1f...@cvs.netbsd.org>
> 
>   | put all the ELD debugging messages under #ifdef HDAFG_HDMI_DEBUG.
> 
> I am not sure that doing that with the ones that are hda_error() is
> the correct thing to do - if something is failing, getting an indication
> why, even when not debugging. seems like a good idea to me.

this code is not functional and only complains when it fails
to parse stuff, that probably is quite valid.  all it does is
whine, not actually do take any useful action.

ie, it's not useful and actively spams dmesg.  there's a
reasonable chance it is buggy -- it hasn't really been
tested properly or checked against the spec.

if someone wants to make this code work, then these could
be re-promoted, but for now they're garbage.


.mrg.


CVS commit: src/sys/kern

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:00:17 UTC 2017

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

Log Message:
normalise a BIOHIST log message


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/kern/vfs_bio.c

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



CVS commit: src/sys/kern

2017-08-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Aug  4 07:00:17 UTC 2017

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

Log Message:
normalise a BIOHIST log message


To generate a diff of this commit:
cvs rdiff -u -r1.274 -r1.275 src/sys/kern/vfs_bio.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/vfs_bio.c
diff -u src/sys/kern/vfs_bio.c:1.274 src/sys/kern/vfs_bio.c:1.275
--- src/sys/kern/vfs_bio.c:1.274	Thu Jun  8 01:23:01 2017
+++ src/sys/kern/vfs_bio.c	Fri Aug  4 07:00:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_bio.c,v 1.274 2017/06/08 01:23:01 chs Exp $	*/
+/*	$NetBSD: vfs_bio.c,v 1.275 2017/08/04 07:00:17 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -123,7 +123,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.274 2017/06/08 01:23:01 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.275 2017/08/04 07:00:17 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bufcache.h"
@@ -1543,7 +1543,7 @@ biowait(buf_t *bp)
 
 	mutex_enter(bp->b_objlock);
 
-	BIOHIST_CALLARGS(biohist, "bp=%p, oflags=0x%x, ret_addr %p",
+	BIOHIST_CALLARGS(biohist, "bp=%p, oflags=0x%x, ret_addr=%p",
 	bp, bp->b_oflags, __builtin_return_address(0), 0);
 
 	while (!ISSET(bp->b_oflags, BO_DONE | BO_DELWRI)) {



CVS commit: src/usr.sbin/acpitools/acpidump

2017-08-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Aug  4 06:30:36 UTC 2017

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c acpi_user.c acpidump.8
acpidump.c acpidump.h

Log Message:
Sync with FreeBSD's r321294:
 - Dump TCG ACPI spec table (TCPA) more.
 - Dump DMA Remapping Reporting table (DMAR).
 - Consistently cast ACPICA 64-bit integer types when we print them.
 - Display the 'Flags' field in the HPET Description Table.
 - Do not crash when RSDT/XSDT contains an empty entry.
 - Print 64-bit addresses clearly with leading zeros to avoid confusions.
 - Create temp file safely.
 - Add missing flags into FADT.
 - Print some new ACPI 5.1 MADT entries.
 - Use __arraycount().
 - Warn and exit loop on invalid subtable length.
 - Fix the type used to hold the value returned from getopt. On arm64 char is
   unsigned so will never be -1.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/acpitools/acpidump/acpi.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/acpitools/acpidump/acpi_user.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/acpitools/acpidump/acpidump.8
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/acpitools/acpidump/acpidump.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/acpitools/acpidump/acpidump.h

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

Modified files:

Index: src/usr.sbin/acpitools/acpidump/acpi.c
diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.15 src/usr.sbin/acpitools/acpidump/acpi.c:1.16
--- src/usr.sbin/acpitools/acpidump/acpi.c:1.15	Sat Feb 27 16:40:22 2016
+++ src/usr.sbin/acpitools/acpidump/acpi.c	Fri Aug  4 06:30:36 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.15 2016/02/27 16:40:22 christos Exp $ */
+/* $NetBSD: acpi.c,v 1.16 2017/08/04 06:30:36 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -26,11 +26,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$FreeBSD: src/usr.sbin/acpi/acpidump/acpi.c,v 1.37 2009/08/25 20:35:57 jhb Exp $
+ *	$FreeBSD: head/usr.sbin/acpi/acpidump/acpi.c 321299 2017-07-20 17:36:17Z emaste $
  */
 
 #include 
-__RCSID("$NetBSD: acpi.c,v 1.15 2016/02/27 16:40:22 christos Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.16 2017/08/04 06:30:36 msaitoh Exp $");
 
 #include 
 #include 
@@ -116,6 +116,71 @@ static void	acpi_walk_subtables(ACPI_TAB
 /* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */
 static int addr_size;
 
+/* Strings used in the TCPA table */
+static const char *tcpa_event_type_strings[] = {
+	"PREBOOT Certificate",
+	"POST Code",
+	"Unused",
+	"No Action",
+	"Separator",
+	"Action",
+	"Event Tag",
+	"S-CRTM Contents",
+	"S-CRTM Version",
+	"CPU Microcode",
+	"Platform Config Flags",
+	"Table of Devices",
+	"Compact Hash",
+	"IPL",
+	"IPL Partition Data",
+	"Non-Host Code",
+	"Non-Host Config",
+	"Non-Host Info"
+};
+
+static const char *TCPA_pcclient_strings[] = {
+	"",
+	"SMBIOS",
+	"BIS Certificate",
+	"POST BIOS ROM Strings",
+	"ESCD",
+	"CMOS",
+	"NVRAM",
+	"Option ROM Execute",
+	"Option ROM Configurateion",
+	"",
+	"Option ROM Microcode Update ",
+	"S-CRTM Version String",
+	"S-CRTM Contents",
+	"POST Contents",
+	"Table of Devices",
+};
+
+#define	PRINTFLAG_END()		printflag_end()
+
+static char pf_sep = '{';
+
+static void
+printflag_end(void)
+{
+
+	if (pf_sep != '{') {
+		printf("}");
+		pf_sep = '{';
+	}
+	printf("\n");
+}
+
+static void
+printflag(uint64_t var, uint64_t mask, const char *name)
+{
+
+	if (var & mask) {
+		printf("%c%s", pf_sep, name);
+		pf_sep = ',';
+	}
+}
+
 static void
 acpi_print_string(char *s, size_t length)
 {
@@ -136,12 +201,18 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas
 {
 	switch(gas->SpaceId) {
 	case ACPI_GAS_MEMORY:
-		printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
-		   gas->BitOffset, gas->BitWidth);
+		if (gas->BitWidth <= 32)
+			printf("0x%08x:%u[%u] (Memory)",
+			(u_int)gas->Address, gas->BitOffset,
+			gas->BitWidth);
+		else
+			printf("0x%016jx:%u[%u] (Memory)",
+			(uintmax_t)gas->Address, gas->BitOffset,
+			gas->BitWidth);
 		break;
 	case ACPI_GAS_IO:
-		printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
-		   gas->BitOffset, gas->BitWidth);
+		printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address,
+		gas->BitOffset, gas->BitWidth);
 		break;
 	case ACPI_GAS_PCI:
 		printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
@@ -162,7 +233,7 @@ acpi_print_gas(ACPI_GENERIC_ADDRESS *gas
 	case ACPI_GAS_DATATABLE:
 	case ACPI_GAS_FIXED:
 	default:
-		printf("0x%08lx (?)", (u_long)gas->Address);
+		printf("0x%016jx (?)", (uintmax_t)gas->Address);
 		break;
 	}
 }
@@ -720,6 +791,10 @@ acpi_walk_subtables(ACPI_TABLE_HEADER *t
 	end = (char *)table + table->Length;
 	while ((char *)subtable < end) {
 		printf("\n");
+		if (subtable->Length < sizeof(ACPI_SUBTABLE_HEADER)) {
+			warnx("invalid subtable length %u", subtable->Length);
+			return;
+		}
 		action(subtable);
 		subtable 

CVS commit: src/usr.sbin/acpitools/acpidump

2017-08-04 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Aug  4 06:30:36 UTC 2017

Modified Files:
src/usr.sbin/acpitools/acpidump: acpi.c acpi_user.c acpidump.8
acpidump.c acpidump.h

Log Message:
Sync with FreeBSD's r321294:
 - Dump TCG ACPI spec table (TCPA) more.
 - Dump DMA Remapping Reporting table (DMAR).
 - Consistently cast ACPICA 64-bit integer types when we print them.
 - Display the 'Flags' field in the HPET Description Table.
 - Do not crash when RSDT/XSDT contains an empty entry.
 - Print 64-bit addresses clearly with leading zeros to avoid confusions.
 - Create temp file safely.
 - Add missing flags into FADT.
 - Print some new ACPI 5.1 MADT entries.
 - Use __arraycount().
 - Warn and exit loop on invalid subtable length.
 - Fix the type used to hold the value returned from getopt. On arm64 char is
   unsigned so will never be -1.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/acpitools/acpidump/acpi.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/acpitools/acpidump/acpi_user.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/acpitools/acpidump/acpidump.8
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/acpitools/acpidump/acpidump.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/acpitools/acpidump/acpidump.h

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