CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:35:29 UTC 2019

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

Log Message:
appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/i2c/ds1307.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/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:35:29 UTC 2019

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

Log Message:
appease -Werror=stack-protector by avoiding variable sized arrays
Now this builds and works on sparc64


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/i2c/ds1307.c

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

Modified files:

Index: src/sys/dev/i2c/ds1307.c
diff -u src/sys/dev/i2c/ds1307.c:1.32 src/sys/dev/i2c/ds1307.c:1.33
--- src/sys/dev/i2c/ds1307.c:1.32	Sun Sep 29 05:28:21 2019
+++ src/sys/dev/i2c/ds1307.c	Sun Sep 29 05:35:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $	*/
+/*	$NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.33 2019/09/29 05:35:29 macallan Exp $");
 
 #include 
 #include 
@@ -775,8 +775,9 @@ static int
 dsrtc_clock_write_timeval(struct dsrtc_softc *sc, time_t t)
 {
 	const struct dsrtc_model * const dm = >sc_model;
-	size_t buflen = dm->dm_rtc_size + 2; 
-	uint8_t buf[buflen];
+	size_t buflen = dm->dm_rtc_size + 2;
+	/* XXX: the biggest dm_rtc_size we have now is 7, so we should be ok */ 
+	uint8_t buf[16];
 	int error;
 
 	KASSERT((dm->dm_flags & DSRTC_FLAG_CLOCK_HOLD) == 0);



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:28:21 UTC 2019

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

Log Message:
add another matchstring for the ds1307 found in Sun Fire V210 ( and probably
V240 )


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/ds1307.c

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

Modified files:

Index: src/sys/dev/i2c/ds1307.c
diff -u src/sys/dev/i2c/ds1307.c:1.31 src/sys/dev/i2c/ds1307.c:1.32
--- src/sys/dev/i2c/ds1307.c:1.31	Thu Dec 20 21:36:53 2018
+++ src/sys/dev/i2c/ds1307.c	Sun Sep 29 05:28:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ds1307.c,v 1.31 2018/12/20 21:36:53 macallan Exp $	*/
+/*	$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.31 2018/12/20 21:36:53 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ds1307.c,v 1.32 2019/09/29 05:28:21 macallan Exp $");
 
 #include 
 #include 
@@ -159,6 +159,7 @@ static const struct dsrtc_model mcp7940_
 static const struct device_compatible_entry compat_data[] = {
 	{ "dallas,ds1307",		(uintptr_t)_model },
 	{ "maxim,ds1307",		(uintptr_t)_model },
+	{ "i2c-ds1307",			(uintptr_t)_model },
 
 	{ "dallas,ds1339",		(uintptr_t)_model },
 	{ "maxim,ds1339",		(uintptr_t)_model },



CVS commit: src/sys/dev/i2c

2019-09-28 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Sep 29 05:28:21 UTC 2019

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

Log Message:
add another matchstring for the ds1307 found in Sun Fire V210 ( and probably
V240 )


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/i2c/ds1307.c

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



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:49:59 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - don't hide local static variable in the middle of other
local variable definitions.  While here, get rid of the alignment of
variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/ddb/db_command.c

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



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:49:59 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - don't hide local static variable in the middle of other
local variable definitions.  While here, get rid of the alignment of
variable names.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.163 src/sys/ddb/db_command.c:1.164
--- src/sys/ddb/db_command.c:1.163	Sun Sep 29 02:42:12 2019
+++ src/sys/ddb/db_command.c	Sun Sep 29 02:49:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.163 2019/09/29 02:42:12 uwe Exp $	*/
+/*	$NetBSD: db_command.c,v 1.164 2019/09/29 02:49:59 uwe Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.163 2019/09/29 02:42:12 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.164 2019/09/29 02:49:59 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -820,13 +820,13 @@ db_read_command(void)
 static void
 db_command(const struct db_command **last_cmdp)
 {
-	const struct db_command *command;
 	static db_expr_t last_count = 0;
-	db_expr_t	addr, count;
-	bool		have_addr;
-	char		modif[TOK_STRING_SIZE];
 
-	int			t;
+	int t;
+	const struct db_command *command;
+	db_expr_t addr, count;
+	bool have_addr;
+	char modif[TOK_STRING_SIZE];
 
 	command = NULL;
 	have_addr = false;



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:42:12 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.162 src/sys/ddb/db_command.c:1.163
--- src/sys/ddb/db_command.c:1.162	Sun Sep 29 02:35:39 2019
+++ src/sys/ddb/db_command.c	Sun Sep 29 02:42:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.162 2019/09/29 02:35:39 uwe Exp $	*/
+/*	$NetBSD: db_command.c,v 1.163 2019/09/29 02:42:12 uwe Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.162 2019/09/29 02:35:39 uwe Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.163 2019/09/29 02:42:12 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -823,12 +823,13 @@ db_command(const struct db_command **las
 	const struct db_command *command;
 	static db_expr_t last_count = 0;
 	db_expr_t	addr, count;
+	bool		have_addr;
 	char		modif[TOK_STRING_SIZE];
-	
+
 	int			t;
-	bool		have_addr = false;
 
 	command = NULL;
+	have_addr = false;
 	count = -1;
 
 	t = db_read_token();
@@ -851,7 +852,6 @@ db_command(const struct db_command **las
 			}
 		} else
 			count = last_count;
-		have_addr = false;
 		modif[0] = '\0';
 		db_skip_to_eol();
 
@@ -898,7 +898,6 @@ db_command(const struct db_command **las
 have_addr = true;
 			} else {
 addr = (db_expr_t) db_dot;
-have_addr = false;
 			}
 
 			t = db_read_token();



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:42:12 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - make setting have_addr more clear.
Don't set it to false that it's already initialized to.


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/ddb/db_command.c

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



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:35:39 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - make sure count is always initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/ddb/db_command.c

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



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:35:39 UTC 2019

Modified Files:
src/sys/ddb: db_command.c

Log Message:
db_command - make sure count is always initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/ddb/db_command.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/ddb/db_command.c
diff -u src/sys/ddb/db_command.c:1.161 src/sys/ddb/db_command.c:1.162
--- src/sys/ddb/db_command.c:1.161	Sun Sep 22 12:57:34 2019
+++ src/sys/ddb/db_command.c	Sun Sep 29 02:35:39 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_command.c,v 1.161 2019/09/22 12:57:34 mrg Exp $	*/
+/*	$NetBSD: db_command.c,v 1.162 2019/09/29 02:35:39 uwe Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.161 2019/09/22 12:57:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.162 2019/09/29 02:35:39 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -829,7 +829,8 @@ db_command(const struct db_command **las
 	bool		have_addr = false;
 
 	command = NULL;
-	
+	count = -1;
+
 	t = db_read_token();
 	if ((t == tEOL) || (t == tCOMMA)) {
 		/*
@@ -909,7 +910,6 @@ db_command(const struct db_command **las
 }
 			} else {
 db_unread_token(t);
-count = -1;
 			}
 			if ((command->flag & CS_MORE) == 0) {
 db_skip_to_eol();



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:00:22 UTC 2019

Modified Files:
src/sys/ddb: db_input.c db_lex.c

Log Message:
Print db> prompt in db_read_line(), not db_readline().

The former is what DDB repl calls.  The latter performs the actual
input so let other code use it without the unwanted db> prompt.  It's
already used by ACPI (and AcpiOsWaitCommandReady supplies its own
prompt).  I also use it for my uncommitted Forth scripting for DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/ddb/db_input.c
cvs rdiff -u -r1.22 -r1.23 src/sys/ddb/db_lex.c

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



CVS commit: src/sys/ddb

2019-09-28 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Sun Sep 29 02:00:22 UTC 2019

Modified Files:
src/sys/ddb: db_input.c db_lex.c

Log Message:
Print db> prompt in db_read_line(), not db_readline().

The former is what DDB repl calls.  The latter performs the actual
input so let other code use it without the unwanted db> prompt.  It's
already used by ACPI (and AcpiOsWaitCommandReady supplies its own
prompt).  I also use it for my uncommitted Forth scripting for DDB.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/ddb/db_input.c
cvs rdiff -u -r1.22 -r1.23 src/sys/ddb/db_lex.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/ddb/db_input.c
diff -u src/sys/ddb/db_input.c:1.26 src/sys/ddb/db_input.c:1.27
--- src/sys/ddb/db_input.c:1.26	Tue Aug 31 07:48:23 2010
+++ src/sys/ddb/db_input.c	Sun Sep 29 02:00:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $	*/
+/*	$NetBSD: db_input.c,v 1.27 2019/09/29 02:00:22 uwe Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_input.c,v 1.27 2019/09/29 02:00:22 uwe Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddbparam.h"
@@ -38,7 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_input.c,v
 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -352,11 +351,6 @@ int
 db_readline(char *lstart, int lsize)
 {
 
-# ifdef MULTIPROCESSOR
-	db_printf("db{%ld}> ", (long)cpu_number());
-# else
-	db_printf("db> ");
-# endif
 	db_force_whitespace();	/* synch output position */
 
 	db_lbuf_start = lstart;

Index: src/sys/ddb/db_lex.c
diff -u src/sys/ddb/db_lex.c:1.22 src/sys/ddb/db_lex.c:1.23
--- src/sys/ddb/db_lex.c:1.22	Thu May 26 15:34:14 2011
+++ src/sys/ddb/db_lex.c	Sun Sep 29 02:00:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_lex.c,v 1.22 2011/05/26 15:34:14 joerg Exp $	*/
+/*	$NetBSD: db_lex.c,v 1.23 2019/09/29 02:00:22 uwe Exp $	*/
 
 /*
  * Mach Operating System
@@ -34,10 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.22 2011/05/26 15:34:14 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_lex.c,v 1.23 2019/09/29 02:00:22 uwe Exp $");
 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -61,6 +62,11 @@ db_read_line(void)
 {
 	int	i;
 
+#ifdef MULTIPROCESSOR
+	db_printf("db{%ld}> ", (long)cpu_number());
+#else
+	db_printf("db> ");
+#endif
 	i = db_readline(db_line, sizeof(db_line));
 	if (i == 0)
 		return (0);	/* EOI */



CVS commit: src/doc

2019-09-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 29 00:57:12 UTC 2019

Modified Files:
src/doc: TODO.modules

Log Message:
Another issue, as identified on IRC/ICB


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

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



CVS commit: src/doc

2019-09-28 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep 29 00:57:12 UTC 2019

Modified Files:
src/doc: TODO.modules

Log Message:
Another issue, as identified on IRC/ICB


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/doc/TODO.modules:1.20
--- src/doc/TODO.modules:1.19	Wed Feb 20 04:32:51 2019
+++ src/doc/TODO.modules	Sun Sep 29 00:57:11 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO.modules,v 1.19 2019/02/20 04:32:51 pgoyette Exp $ */
+/* $NetBSD: TODO.modules,v 1.20 2019/09/29 00:57:11 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
@@ -219,3 +219,12 @@ christos and pgoyette.
 detail, but I have to wonder how code that compiles cleanly in a
 normal kernel has these issues when compiled in a module, when both
 are done with WARNS=5).
+
+23. The current process of "load all the emulation/exec modules in case
+one of them might handle the image currently being exec'd" isn't
+really cool.  (See sys/kern/kern_exec.c?)  It ends up auto-loading
+a whole bunch of modules, involving file-system access, just to have
+most of the modules getting unloaded a few seconds later.  We don't
+have any way to identify which module is needed for which image (ie,
+we can't determine that an image needs compat_linux vs some other
+module).



CVS commit: src/sys/stand/efiboot

2019-09-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 00:52:26 UTC 2019

Modified Files:
src/sys/stand/efiboot: prompt.c

Log Message:
Increase MI efiboot bootprompt() input buffer from 80 bytes to LINE_MAX.

This allows you to load a kernel from a build directory deep in some file
system after you accidentally boot an old kernel with a new userland and
are otherwise unable to get yourself back to a matching kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/prompt.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/stand/efiboot/prompt.c
diff -u src/sys/stand/efiboot/prompt.c:1.4 src/sys/stand/efiboot/prompt.c:1.5
--- src/sys/stand/efiboot/prompt.c:1.4	Wed Oct 31 23:49:34 2018
+++ src/sys/stand/efiboot/prompt.c	Sun Sep 29 00:52:26 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: prompt.c,v 1.4 2018/10/31 23:49:34 jmcneill Exp $	*/
+/*	$NetBSD: prompt.c,v 1.5 2019/09/29 00:52:26 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997
@@ -40,6 +40,7 @@
 #include "efiboot.h"
 
 #include 
+#include 
 
 #define	POLL_FREQ	10
 
@@ -136,7 +137,7 @@ docommand(char *arg)
 __dead void
 bootprompt(void)
 {
-	char input[80];
+	char input[LINE_MAX];
 
 	for (;;) {
 		char *c = input;



CVS commit: src/sys/stand/efiboot

2019-09-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Sep 29 00:52:26 UTC 2019

Modified Files:
src/sys/stand/efiboot: prompt.c

Log Message:
Increase MI efiboot bootprompt() input buffer from 80 bytes to LINE_MAX.

This allows you to load a kernel from a build directory deep in some file
system after you accidentally boot an old kernel with a new userland and
are otherwise unable to get yourself back to a matching kernel.


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

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



CVS commit: src/sys/external/bsd/common/include/linux

2019-09-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 00:10:02 UTC 2019

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h

Log Message:
fix another sign compare warning:

cast 'int ret' to size_t when comparing against another size_t
and 'ret' has known to be 0 or positive.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/common/include/linux/kernel.h

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

Modified files:

Index: src/sys/external/bsd/common/include/linux/kernel.h
diff -u src/sys/external/bsd/common/include/linux/kernel.h:1.21 src/sys/external/bsd/common/include/linux/kernel.h:1.22
--- src/sys/external/bsd/common/include/linux/kernel.h:1.21	Mon Aug 27 14:48:07 2018
+++ src/sys/external/bsd/common/include/linux/kernel.h	Sun Sep 29 00:10:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernel.h,v 1.21 2018/08/27 14:48:07 riastradh Exp $	*/
+/*	$NetBSD: kernel.h,v 1.22 2019/09/29 00:10:02 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -165,7 +165,7 @@ vscnprintf(char *buf, size_t size, const
 		return ret;
 	if (__predict_false(size == 0))
 		return 0;
-	if (__predict_false(size <= ret))
+	if (__predict_false(size <= (size_t)ret))
 		return (size - 1);
 
 	return ret;



CVS commit: src/sys/external/bsd/common/include/linux

2019-09-28 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Sep 29 00:10:02 UTC 2019

Modified Files:
src/sys/external/bsd/common/include/linux: kernel.h

Log Message:
fix another sign compare warning:

cast 'int ret' to size_t when comparing against another size_t
and 'ret' has known to be 0 or positive.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/external/bsd/common/include/linux/kernel.h

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



CVS commit: src/sbin/fsck

2019-09-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Sep 28 18:03:19 UTC 2019

Modified Files:
src/sbin/fsck: partutil.c

Log Message:
initialize disc_dict to NULL.

otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck/partutil.c

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



CVS commit: src/sbin/fsck

2019-09-28 Thread Christoph Badura
Module Name:src
Committed By:   bad
Date:   Sat Sep 28 18:03:19 UTC 2019

Modified Files:
src/sbin/fsck: partutil.c

Log Message:
initialize disc_dict to NULL.

otherwise, if DIOCGDISKINFO returns an error != ENXIO getdiskinfo() later
tries to prop_object_release() stack garbage.

found by rumpctrl tests using clang-7.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/fsck/partutil.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/fsck/partutil.c
diff -u src/sbin/fsck/partutil.c:1.16 src/sbin/fsck/partutil.c:1.17
--- src/sbin/fsck/partutil.c:1.16	Sun Aug 18 11:08:56 2019
+++ src/sbin/fsck/partutil.c	Sat Sep 28 18:03:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: partutil.c,v 1.16 2019/08/18 11:08:56 martin Exp $	*/
+/*	$NetBSD: partutil.c,v 1.17 2019/09/28 18:03:18 bad Exp $	*/
 
 /*-
  * Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: partutil.c,v 1.16 2019/08/18 11:08:56 martin Exp $");
+__RCSID("$NetBSD: partutil.c,v 1.17 2019/09/28 18:03:18 bad Exp $");
 
 #include 
 #include 
@@ -108,6 +108,7 @@ getdiskinfo(const char *s, int fd, const
 	}
 
 	/* Get disk description dictionary */
+	disk_dict = NULL;
 	error = prop_dictionary_recv_ioctl(fd, DIOCGDISKINFO, _dict);
 
 	/* fail quickly if the device does not exist at all */



CVS commit: src/sys/dev/pci

2019-09-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep 28 16:22:45 UTC 2019

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

Log Message:
len -> m_len


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.3 src/sys/dev/pci/if_mcx.c:1.4
--- src/sys/dev/pci/if_mcx.c:1.3	Sat Sep 28 16:20:43 2019
+++ src/sys/dev/pci/if_mcx.c	Sat Sep 28 16:22:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.3 2019/09/28 16:20:43 tnn Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.4 2019/09/28 16:22:45 tnn Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -5629,7 +5629,7 @@ mcx_rx_fill_slots(struct mcx_softc *sc, 
 		bus_dmamap_sync(sc->sc_dmat, ms->ms_map, 0, ms->ms_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 		ms->ms_m = m;
 
-		rqe[slot].rqe_byte_count = htobe32(m->len);
+		rqe[slot].rqe_byte_count = htobe32(m->m_len);
 		rqe[slot].rqe_addr = htobe64(ms->ms_map->dm_segs[0].ds_addr);
 		rqe[slot].rqe_lkey = htobe32(sc->sc_lkey);
 



CVS commit: src/sys/dev/pci

2019-09-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep 28 16:22:45 UTC 2019

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

Log Message:
len -> m_len


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_mcx.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/pci

2019-09-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep 28 16:20:43 UTC 2019

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

Log Message:
mcx(4): fix rx mbuf DMA overrun

pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_mcx.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/pci

2019-09-28 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Sat Sep 28 16:20:43 UTC 2019

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

Log Message:
mcx(4): fix rx mbuf DMA overrun

pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/pci/if_mcx.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_mcx.c
diff -u src/sys/dev/pci/if_mcx.c:1.2 src/sys/dev/pci/if_mcx.c:1.3
--- src/sys/dev/pci/if_mcx.c:1.2	Tue Sep 24 14:39:38 2019
+++ src/sys/dev/pci/if_mcx.c	Sat Sep 28 16:20:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mcx.c,v 1.2 2019/09/24 14:39:38 msaitoh Exp $ */
+/*	$NetBSD: if_mcx.c,v 1.3 2019/09/28 16:20:43 tnn Exp $ */
 /*	$OpenBSD: if_mcx.c,v 1.33 2019/09/12 04:23:59 jmatthew Exp $ */
 
 /*
@@ -5620,15 +5620,16 @@ mcx_rx_fill_slots(struct mcx_softc *sc, 
 #endif
 
 		m->m_data += ETHER_ALIGN;
-		m->m_len = m->m_pkthdr.len = bufsize;
+		m->m_len = m->m_pkthdr.len = m->m_ext.ext_size - ETHER_ALIGN;
 		if (bus_dmamap_load_mbuf(sc->sc_dmat, ms->ms_map, m,
 		BUS_DMA_NOWAIT) != 0) {
 			m_freem(m);
 			break;
 		}
+		bus_dmamap_sync(sc->sc_dmat, ms->ms_map, 0, ms->ms_map->dm_mapsize, BUS_DMASYNC_PREREAD);
 		ms->ms_m = m;
 
-		rqe[slot].rqe_byte_count = htobe32(bufsize);
+		rqe[slot].rqe_byte_count = htobe32(m->len);
 		rqe[slot].rqe_addr = htobe64(ms->ms_map->dm_segs[0].ds_addr);
 		rqe[slot].rqe_lkey = htobe32(sc->sc_lkey);
 



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2019-09-28 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Sep 28 16:14:52 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_lrc.c intel_ringbuffer.c

Log Message:
initialize a local variable to avoid a gcc warning with
certain optimization options.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c:1.9 src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c:1.9	Mon Aug 27 15:09:35 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c	Sat Sep 28 16:14:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_lrc.c,v 1.9 2018/08/27 15:09:35 riastradh Exp $	*/
+/*	$NetBSD: intel_lrc.c,v 1.10 2019/09/28 16:14:52 chs Exp $	*/
 
 /*
  * Copyright © 2014 Intel Corporation
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_lrc.c,v 1.9 2018/08/27 15:09:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_lrc.c,v 1.10 2019/09/28 16:14:52 chs Exp $");
 
 #include 
 #include 
@@ -684,6 +684,8 @@ static int logical_ring_wait_for_space(s
 	unsigned space;
 	int ret;
 
+	space = 0; /* XXX gcc -Wuninitialized */
+
 	if (intel_ring_space(ringbuf) >= bytes)
 		return 0;
 
Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.9 src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c:1.9	Thu Sep 13 08:25:55 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.c	Sat Sep 28 16:14:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_ringbuffer.c,v 1.9 2018/09/13 08:25:55 mrg Exp $	*/
+/*	$NetBSD: intel_ringbuffer.c,v 1.10 2019/09/28 16:14:52 chs Exp $	*/
 
 /*
  * Copyright © 2008-2010 Intel Corporation
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_ringbuffer.c,v 1.9 2018/09/13 08:25:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_ringbuffer.c,v 1.10 2019/09/28 16:14:52 chs Exp $");
 
 #include 
 #include 
@@ -2323,6 +2323,8 @@ static int ring_wait_for_space(struct in
 	unsigned space;
 	int ret;
 
+	space = 0; /* XXX gcc -Wuninitialized */
+
 	if (intel_ring_space(ringbuf) >= n)
 		return 0;
 



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2019-09-28 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Sep 28 16:14:52 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_lrc.c intel_ringbuffer.c

Log Message:
initialize a local variable to avoid a gcc warning with
certain optimization options.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/external/bsd/drm2/dist/drm/i915/intel_lrc.c \
src/sys/external/bsd/drm2/dist/drm/i915/intel_ringbuffer.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

2019-09-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 28 16:02:12 UTC 2019

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

Log Message:
mbstat_conver_to_user_cb -> mbstat_convert_to_user_cb


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.233 src/sys/kern/uipc_mbuf.c:1.234
--- src/sys/kern/uipc_mbuf.c:1.233	Wed Sep 18 16:18:12 2019
+++ src/sys/kern/uipc_mbuf.c	Sat Sep 28 16:02:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.233 2019/09/18 16:18:12 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.234 2019/09/28 16:02:12 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.233 2019/09/18 16:18:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.234 2019/09/28 16:02:12 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -402,7 +402,7 @@ mbstat_type_add(int type, int diff)
 }
 
 static void
-mbstat_conver_to_user_cb(void *v1, void *v2, struct cpu_info *ci)
+mbstat_convert_to_user_cb(void *v1, void *v2, struct cpu_info *ci)
 {
 	struct mbstat_cpu *mbsc = v1;
 	struct mbstat *mbs = v2;
@@ -419,7 +419,7 @@ mbstat_convert_to_user(struct mbstat *mb
 
 	memset(mbs, 0, sizeof(*mbs));
 	mbs->m_drain = mbstat.m_drain;
-	percpu_foreach(mbstat_percpu, mbstat_conver_to_user_cb, mbs);
+	percpu_foreach(mbstat_percpu, mbstat_convert_to_user_cb, mbs);
 }
 
 static int



CVS commit: src/sys/kern

2019-09-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Sep 28 16:02:12 UTC 2019

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

Log Message:
mbstat_conver_to_user_cb -> mbstat_convert_to_user_cb


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/uipc_mbuf.c

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



CVS commit: src/sys/modules/compat_netbsd32

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:15:09 UTC 2019

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
Disable NETBSD32_DRMKMS by not using it, but keep compiling it.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/modules/compat_netbsd32/Makefile

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



CVS commit: src/sys/compat/netbsd32

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:15:34 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_drm.c

Log Message:
fix sign-compare.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/netbsd32/netbsd32_drm.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_drm.c
diff -u src/sys/compat/netbsd32/netbsd32_drm.c:1.3 src/sys/compat/netbsd32/netbsd32_drm.c:1.4
--- src/sys/compat/netbsd32/netbsd32_drm.c:1.3	Tue Aug 20 10:26:05 2019
+++ src/sys/compat/netbsd32/netbsd32_drm.c	Sat Sep 28 11:15:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_drm.c,v 1.3 2019/08/20 14:26:05 christos Exp $ */
+/*	$NetBSD: netbsd32_drm.c,v 1.4 2019/09/28 15:15:34 christos Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_drm.c,v 1.3 2019/08/20 14:26:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_drm.c,v 1.4 2019/09/28 15:15:34 christos Exp $");
 
 #include 
 #include 
@@ -345,7 +345,7 @@ compat_drm_getstats(struct file *file, v
 	if (error)
 		return error;
 
-	for (int i = 0; i < st64.count; ++i) {
+	for (size_t i = 0; i < st64.count; ++i) {
 		st32.data[i].value = st64.data[i].value;
 		st32.data[i].type = st64.data[i].type;
 	}



CVS commit: src/sys/compat/netbsd32

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:15:34 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_drm.c

Log Message:
fix sign-compare.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/compat/netbsd32/netbsd32_drm.c

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



CVS commit: src/sys/modules/compat_netbsd32

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:15:09 UTC 2019

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
Disable NETBSD32_DRMKMS by not using it, but keep compiling it.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/modules/compat_netbsd32/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/modules/compat_netbsd32/Makefile
diff -u src/sys/modules/compat_netbsd32/Makefile:1.28 src/sys/modules/compat_netbsd32/Makefile:1.29
--- src/sys/modules/compat_netbsd32/Makefile:1.28	Wed Sep 25 22:01:02 2019
+++ src/sys/modules/compat_netbsd32/Makefile	Sat Sep 28 11:15:09 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.28 2019/09/26 02:01:02 christos Exp $
+#	$NetBSD: Makefile,v 1.29 2019/09/28 15:15:09 christos Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
@@ -6,7 +6,7 @@
 KMOD=	compat_netbsd32
 
 .if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-#NETBSD32_DRMKMS?=yes
+NETBSD32_DRMKMS?=yes
 .endif
 
 CPPFLAGS+=	-DCOMPAT_NETBSD32
@@ -16,7 +16,8 @@ CPPFLAGS+=	-DKTRACE -DMODULAR -DQUOTA
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/external/bsd/libnv/dist
 
 .if ${NETBSD32_DRMKMS:Uno} == "yes"
-CPPFLAGS+=	-DNETBSD32_DRMKMS
+# disable for now
+#CPPFLAGS+=	-DNETBSD32_DRMKMS
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/external/bsd/common/include
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/external/bsd/drm2/include
 CPPFLAGS+=	-I${NETBSDSRCDIR}/sys/external/bsd/drm2/dist



CVS commit: src/sys/external/bsd/drm2/include/linux

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:13:08 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/linux: sched.h

Log Message:
fixed signed compare.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/sched.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/linux/sched.h
diff -u src/sys/external/bsd/drm2/include/linux/sched.h:1.12 src/sys/external/bsd/drm2/include/linux/sched.h:1.13
--- src/sys/external/bsd/drm2/include/linux/sched.h:1.12	Mon Oct 22 23:56:47 2018
+++ src/sys/external/bsd/drm2/include/linux/sched.h	Sat Sep 28 11:13:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sched.h,v 1.12 2018/10/23 03:56:47 riastradh Exp $	*/
+/*	$NetBSD: sched.h,v 1.13 2019/09/28 15:13:08 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -62,7 +62,8 @@ schedule_timeout_uninterruptible(long ti
 	if (cold) {
 		unsigned us;
 		if (hz <= 1000) {
-			unsigned ms = hztoms(MIN(timeout, mstohz(INT_MAX)));
+			unsigned ms = hztoms(MIN((unsigned long)timeout,
+			mstohz(INT_MAX)));
 			us = MIN(ms, INT_MAX/1000)*1000;
 		} else if (hz <= 100) {
 			us = MIN(timeout, (INT_MAX/100)/hz)*hz*100;



CVS commit: src/sys/external/bsd/drm2/include/linux

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:13:08 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/linux: sched.h

Log Message:
fixed signed compare.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/include/linux/sched.h

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



CVS commit: src/sys/arch

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:11:53 UTC 2019

Modified Files:
src/sys/arch/amd64/include: param.h
src/sys/arch/sparc64/include: param.h

Log Message:
remove local version of mstohz() now that  provides it.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sparc64/include/param.h

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



CVS commit: src/sys/arch

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:11:53 UTC 2019

Modified Files:
src/sys/arch/amd64/include: param.h
src/sys/arch/sparc64/include: param.h

Log Message:
remove local version of mstohz() now that  provides it.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/sparc64/include/param.h

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

Modified files:

Index: src/sys/arch/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.31 src/sys/arch/amd64/include/param.h:1.32
--- src/sys/arch/amd64/include/param.h:1.31	Tue Aug 20 08:33:04 2019
+++ src/sys/arch/amd64/include/param.h	Sat Sep 28 11:11:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.31 2019/08/20 12:33:04 riastradh Exp $	*/
+/*	$NetBSD: param.h,v 1.32 2019/09/28 15:11:53 christos Exp $	*/
 
 #ifdef __x86_64__
 
@@ -126,8 +126,6 @@
 #define btop(x)x86_btop(x)
 #define ptob(x)x86_ptob(x)
 
-#define mstohz(ms) ((ms + 0UL) * hz / 1000)
-
 #else	/*	__x86_64__	*/
 
 #include 

Index: src/sys/arch/sparc64/include/param.h
diff -u src/sys/arch/sparc64/include/param.h:1.60 src/sys/arch/sparc64/include/param.h:1.61
--- src/sys/arch/sparc64/include/param.h:1.60	Wed May 15 12:59:10 2019
+++ src/sys/arch/sparc64/include/param.h	Sat Sep 28 11:11:53 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.60 2019/05/15 16:59:10 christos Exp $ */
+/*	$NetBSD: param.h,v 1.61 2019/09/28 15:11:53 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -229,11 +229,6 @@ extern void	delay(unsigned int);
 #define	DELAY(n)	delay(n)
 #endif /* __HIDE_DELAY */
 
-#ifdef	__arch64__
-/* If we're using a 64-bit kernel use 64-bit math */
-#define mstohz(ms) ((ms + 0UL) * hz / 1000)
-#endif
-
 /* Keep this a const so compiler optimization is done */
 extern const int cputyp;
 



CVS commit: src/share/man/man9

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:11:20 UTC 2019

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

Log Message:
document that mstohz take and return unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/mstohz.9

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



CVS commit: src/sys/sys

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:10:58 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
For 32 bit the mstohz and hztoms functions evaluate their parameter multiple
times. This is inefficient for cases like:
unsigned ms = hztoms(MIN(timeout, mstohz(INT_MAX)));
Make them inline functions; also provide the 64 bit versions for them here
so all the LP64 machines can use them (before only amd64 and sparc64
specialized mstohz).
Make them both return unsigned int.


To generate a diff of this commit:
cvs rdiff -u -r1.614 -r1.615 src/sys/sys/param.h

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



CVS commit: src/sys/sys

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:10:58 UTC 2019

Modified Files:
src/sys/sys: param.h

Log Message:
For 32 bit the mstohz and hztoms functions evaluate their parameter multiple
times. This is inefficient for cases like:
unsigned ms = hztoms(MIN(timeout, mstohz(INT_MAX)));
Make them inline functions; also provide the 64 bit versions for them here
so all the LP64 machines can use them (before only amd64 and sparc64
specialized mstohz).
Make them both return unsigned int.


To generate a diff of this commit:
cvs rdiff -u -r1.614 -r1.615 src/sys/sys/param.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/sys/param.h
diff -u src/sys/sys/param.h:1.614 src/sys/sys/param.h:1.615
--- src/sys/sys/param.h:1.614	Thu Sep 26 20:32:03 2019
+++ src/sys/sys/param.h	Sat Sep 28 11:10:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.614 2019/09/27 00:32:03 pgoyette Exp $	*/
+/*	$NetBSD: param.h,v 1.615 2019/09/28 15:10:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -486,23 +486,36 @@
 #endif
 
 #ifdef _KERNEL
+extern int hz;
 /*
  * macro to convert from milliseconds to hz without integer overflow
- * Default version using only 32bits arithmetics.
- * 64bit port can define 64bit version in their 
- * 0x2 is safe for hz < 2
+ * The 32 bit version uses only 32bit arithmetic; 0x2 is safe for hz < 2
+ * the 64 bit version does the computation directly.
  */
 #ifndef mstohz
-#define mstohz(ms) \
-	(__predict_false((ms) >= 0x2) ? \
-	((ms +0u) / 1000u) * hz : \
-	((ms +0u) * hz) / 1000u)
+# ifdef _LP64
+#  define mstohz(ms) ((unsigned int)((ms + 0ul) * hz / 1000ul))
+# else
+static __inline unsigned int
+mstohz(unsigned int ms)
+{
+	return __predict_false(ms >= 0x2u) ?
+	(ms / 1000u) * hz : (ms * hz) / 1000u;
+}
+# endif
 #endif
+
 #ifndef hztoms
-#define hztoms(t) \
-	(__predict_false((t) >= 0x2) ? \
-	((t +0u) / hz) * 1000u : \
-	((t +0u) * 1000u) / hz)
+# ifdef _LP64
+#  define hztoms(t) ((unsigned int)(((t) + 0ul) * 1000ul / hz))
+# else
+static __inline unsigned int
+hztoms(unsigned int t)
+{
+	return __predict_false(t >= 0x2u) ?
+	(t / hz) * 1000u : (t * 1000u) / hz;
+}
+# endif
 #endif
 
 #define	hz2bintime(t)	(ms2bintime(hztoms(t)))



CVS commit: src/share/man/man9

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 15:11:20 UTC 2019

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

Log Message:
document that mstohz take and return unsigned int


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/mstohz.9

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

Modified files:

Index: src/share/man/man9/mstohz.9
diff -u src/share/man/man9/mstohz.9:1.11 src/share/man/man9/mstohz.9:1.12
--- src/share/man/man9/mstohz.9:1.11	Thu Oct 20 06:36:42 2011
+++ src/share/man/man9/mstohz.9	Sat Sep 28 11:11:19 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mstohz.9,v 1.11 2011/10/20 10:36:42 wiz Exp $
+.\"	$NetBSD: mstohz.9,v 1.12 2019/09/28 15:11:19 christos Exp $
 .\"
 .\" Copyright (c) 2002 Manuel Bouyer.
 .\"
@@ -24,7 +24,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"
-.Dd October 20, 2011
+.Dd September 28, 2019
 .Dt MSTOHZ 9
 .Os
 .Sh NAME
@@ -33,10 +33,10 @@
 .Nd convert between milliseconds and system clock ticks
 .Sh SYNOPSIS
 .In sys/param.h
-.Ft int
-.Fn mstohz "int ms"
-.Ft int
-.Fn hztoms "int hz"
+.Ft unsigned int
+.Fn mstohz "unsigned int ms"
+.Ft unsigned int
+.Fn hztoms "unsigned int hz"
 .Sh DESCRIPTION
 The
 .Fn mstohz



CVS commit: [netbsd-9] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:40:34 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #263, #264 and #265


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-9.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-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.65 src/doc/CHANGES-9.0:1.1.2.66
--- src/doc/CHANGES-9.0:1.1.2.65	Sat Sep 28 07:43:34 2019
+++ src/doc/CHANGES-9.0	Sat Sep 28 12:40:33 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.65 2019/09/28 07:43:34 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.66 2019/09/28 12:40:33 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4149,3 +4149,22 @@ usr.bin/audiocfg/main.c1.10,1.11
 	Revert to using a single descriptor for "audiocfg test" as before.
 	[isaki, ticket #262]
 
+sys/arch/arm/nvidia/tegra210_pinmux.c		1.2
+sys/arch/arm/nvidia/tegra_pinmux.c		1.3
+sys/arch/arm/nvidia/tegra_pinmux.h		1.2
+
+	Update tegra*_pinmux to support all bindings (pins and pin groups).
+	[skrll, ticket #263]
+
+external/gpl3/binutils.old/*			remove whole subtree
+external/gpl3/gdb.old/*remove whole subtree
+crypto/external/bsd/openssl.old/*		remove whole subtree
+
+	Remove unused sub trees.
+	[skrll, ticket #264]
+
+sys/dev/acpi/acpi_i2c.c1.5
+
+	PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call.
+	[bouyer, ticket #265]
+



CVS commit: [netbsd-9] src/sys/dev/acpi

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:39:23 UTC 2019

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_i2c.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #265):

sys/dev/acpi/acpi_i2c.c: revision 1.5

joshua stein, PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call

The last argument to the _DSM call has to be ACPI_TYPE_PACKAGE, as defined in in
clude/acpredef.h for _DSM.

Avoids an ACPI warning at boot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.8.1 src/sys/dev/acpi/acpi_i2c.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/acpi/acpi_i2c.c
diff -u src/sys/dev/acpi/acpi_i2c.c:1.4 src/sys/dev/acpi/acpi_i2c.c:1.4.8.1
--- src/sys/dev/acpi/acpi_i2c.c:1.4	Sat May  5 17:16:23 2018
+++ src/sys/dev/acpi/acpi_i2c.c	Sat Sep 28 12:39:23 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $ */
+/* $NetBSD: acpi_i2c.c,v 1.4.8.1 2019/09/28 12:39:23 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.4.8.1 2019/09/28 12:39:23 martin Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ acpi_enter_i2c_hid(struct acpi_devnode *
 	obj[2].Type = ACPI_TYPE_INTEGER;
 	obj[2].Integer.Value = 1;
 
-	obj[3].Type = ACPI_TYPE_ANY;
+	obj[3].Type = ACPI_TYPE_PACKAGE;
 	obj[3].Buffer.Length = 0;
 
 	buf.Pointer = NULL;



CVS commit: [netbsd-9] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:40:34 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #263, #264 and #265


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.65 -r1.1.2.66 src/doc/CHANGES-9.0

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



CVS commit: [netbsd-9] src/sys/dev/acpi

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:39:23 UTC 2019

Modified Files:
src/sys/dev/acpi [netbsd-9]: acpi_i2c.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #265):

sys/dev/acpi/acpi_i2c.c: revision 1.5

joshua stein, PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call

The last argument to the _DSM call has to be ACPI_TYPE_PACKAGE, as defined in in
clude/acpredef.h for _DSM.

Avoids an ACPI warning at boot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.8.1 src/sys/dev/acpi/acpi_i2c.c

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



CVS commit: src/sys/external/bsd/drm2/include/linux

2019-09-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Sep 28 12:34:56 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/linux: atomic.h

Log Message:
Fix signed/unsigned comparison


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/external/bsd/drm2/include/linux/atomic.h

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



CVS commit: [netbsd-9] src/sys/arch/arm/nvidia

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:21:29 UTC 2019

Modified Files:
src/sys/arch/arm/nvidia [netbsd-9]: tegra210_pinmux.c tegra_pinmux.c
tegra_pinmux.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #263):

sys/arch/arm/nvidia/tegra_pinmux.h: revision 1.2
sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.3
sys/arch/arm/nvidia/tegra210_pinmux.c: revision 1.2

Update tegra_pinmux to support all bindings (pins and pin groups)
Update tegra210_pinmux.c with all defined pins and groups.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.10.1 src/sys/arch/arm/nvidia/tegra210_pinmux.c \
src/sys/arch/arm/nvidia/tegra_pinmux.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/arm/nvidia/tegra_pinmux.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra210_pinmux.c
diff -u src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.1 src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.1.10.1
--- src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.1	Fri Sep 22 14:36:22 2017
+++ src/sys/arch/arm/nvidia/tegra210_pinmux.c	Sat Sep 28 12:21:29 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra210_pinmux.c,v 1.1 2017/09/22 14:36:22 jmcneill Exp $ */
+/* $NetBSD: tegra210_pinmux.c,v 1.1.10.1 2019/09/28 12:21:29 martin Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra210_pinmux.c,v 1.1 2017/09/22 14:36:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_pinmux.c,v 1.1.10.1 2019/09/28 12:21:29 martin Exp $");
 
 #include 
 #include 
@@ -36,171 +36,222 @@ __KERNEL_RCSID(0, "$NetBSD: tegra210_pin
 
 #include 
 
+#define TEGRA_PIN(n, r, f1, f2, f3, f4)	\
+	{\
+		.tpp_name = n,		\
+		.tpp_reg = (r),		\
+		.tpp_type = TEGRA_PINMUX,\
+		.tpp_functions = {	\
+			f1, f2, f3, f4	\
+		}			\
+	}
+
+#define TEGRA_PINGROUP(n, r, drvdn_m, drvup_m, slwrr_m, slwrf_m)	\
+	{\
+		.tpp_name = "drive_" n,	\
+		.tpp_reg = (r) - 0x8d4,	\
+		.tpp_type = TEGRA_PADCTRL,\
+		.tpp_dg = {		\
+			.drvdn_mask = drvdn_m,\
+			.drvup_mask = drvup_m,\
+			.slwrr_mask = slwrr_m,\
+			.slwrf_mask = slwrf_m\
+		}			\
+	}
+
+// 9.15 Pinmux registers
 static const struct tegra_pinmux_pins tegra210_pins[] = {
-	{ "sdmmc1_clk_pm0",		0x00, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_cmd_pm1",		0x04, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat3_pm2",		0x08, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat2_pm3",		0x0c, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat1_pm4",		0x10, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat0_pm5",		0x14, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_clk_pp0",		0x1c, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_cmd_pp1",		0x20, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat0_pp5",		0x24, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat1_pp4",		0x28, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat2_pp3",		0x2c, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat3_pp2",		0x30, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l0_rst_n_pa0",		0x38, { "pe0", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l0_clkreq_n_pa1",	0x3c, { "pe0", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_wake_n_pa2",		0x40, { "pe", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l1_rst_n_pa3",		0x44, { "pe1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l1_clkreq_n_pa4",	0x48, { "pe1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sata_led_active_pa5",	0x4c, { "sata", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_mosi_pc0",		0x50, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_miso_pc1",		0x54, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_sck_pc2",		0x58, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_cs0_pc3",		0x5c, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_cs1_pc4",		0x60, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi2_mosi_pb4",		0x64, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_miso_pb5",		0x68, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_sck_pb6",		0x6c, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_cs0_pb7",		0x70, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_cs1_pdd0",		0x74, { "spi2", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_mosi_pc7",		0x78, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_miso_pd0",		0x7c, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_sck_pc5",		0x80, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_cs0_pc6",		0x84, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_sck_pee0",		0x88, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_cs_n_pee1",		0x8c, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io0_pee2",		0x90, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io1_pee3",		0x94, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io2_pee4",		0x98, { 

CVS commit: [netbsd-9] src/sys/arch/arm/nvidia

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 12:21:29 UTC 2019

Modified Files:
src/sys/arch/arm/nvidia [netbsd-9]: tegra210_pinmux.c tegra_pinmux.c
tegra_pinmux.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #263):

sys/arch/arm/nvidia/tegra_pinmux.h: revision 1.2
sys/arch/arm/nvidia/tegra_pinmux.c: revision 1.3
sys/arch/arm/nvidia/tegra210_pinmux.c: revision 1.2

Update tegra_pinmux to support all bindings (pins and pin groups)
Update tegra210_pinmux.c with all defined pins and groups.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.10.1 src/sys/arch/arm/nvidia/tegra210_pinmux.c \
src/sys/arch/arm/nvidia/tegra_pinmux.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/arch/arm/nvidia/tegra_pinmux.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/acpi

2019-09-28 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep 28 11:24:10 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_i2c.c

Log Message:
joshua stein, PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call

The last argument to the _DSM call has to be ACPI_TYPE_PACKAGE, as defined in in
clude/acpredef.h for _DSM.

Avoids an ACPI warning at boot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_i2c.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/acpi/acpi_i2c.c
diff -u src/sys/dev/acpi/acpi_i2c.c:1.4 src/sys/dev/acpi/acpi_i2c.c:1.5
--- src/sys/dev/acpi/acpi_i2c.c:1.4	Sat May  5 17:16:23 2018
+++ src/sys/dev/acpi/acpi_i2c.c	Sat Sep 28 11:24:10 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $ */
+/* $NetBSD: acpi_i2c.c,v 1.5 2019/09/28 11:24:10 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.4 2018/05/05 17:16:23 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_i2c.c,v 1.5 2019/09/28 11:24:10 bouyer Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ acpi_enter_i2c_hid(struct acpi_devnode *
 	obj[2].Type = ACPI_TYPE_INTEGER;
 	obj[2].Integer.Value = 1;
 
-	obj[3].Type = ACPI_TYPE_ANY;
+	obj[3].Type = ACPI_TYPE_PACKAGE;
 	obj[3].Buffer.Length = 0;
 
 	buf.Pointer = NULL;



CVS commit: src/sys/dev/acpi

2019-09-28 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sat Sep 28 11:24:10 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_i2c.c

Log Message:
joshua stein, PR kern/54493: acpi_i2c uses incorrect arguments for _DSM call

The last argument to the _DSM call has to be ACPI_TYPE_PACKAGE, as defined in in
clude/acpredef.h for _DSM.

Avoids an ACPI warning at boot.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_i2c.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/pci

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 10:47:09 UTC 2019

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

Log Message:
Fix typo, remove debug printf.


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

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

Modified files:

Index: src/sys/dev/pci/sdhc_pci.c
diff -u src/sys/dev/pci/sdhc_pci.c:1.14 src/sys/dev/pci/sdhc_pci.c:1.15
--- src/sys/dev/pci/sdhc_pci.c:1.14	Thu Apr 27 10:01:54 2017
+++ src/sys/dev/pci/sdhc_pci.c	Sat Sep 28 10:47:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdhc_pci.c,v 1.14 2017/04/27 10:01:54 msaitoh Exp $	*/
+/*	$NetBSD: sdhc_pci.c,v 1.15 2019/09/28 10:47:09 mlelstv Exp $	*/
 /*	$OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.14 2017/04/27 10:01:54 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.15 2019/09/28 10:47:09 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -436,12 +436,11 @@ sdhc_pci_quirk_ricoh_lower_freq_hack(str
 
 	/*
 	 * Some SD/MMC cards don't work with the default base
-	 * clock frequency of 200MHz.  Lower it to 50Hz.
+	 * clock frequency of 200MHz.  Lower it to 50MHz.
 	 */
 	sdhc_pci_conf_write(pa, SDHC_PCI_BASE_FREQ_KEY, 0x01);
 	sdhc_pci_conf_write(pa, SDHC_PCI_BASE_FREQ, 50);
 	sdhc_pci_conf_write(pa, SDHC_PCI_BASE_FREQ_KEY, 0x00);
-printf("quirked\n");
 }
 
 static void



CVS commit: src/sys/dev/pci

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 10:47:09 UTC 2019

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

Log Message:
Fix typo, remove debug printf.


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

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



CVS commit: src/sys/compat/netbsd32

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 08:21:08 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_socket.c

Log Message:
signed/unsigned comparison.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/netbsd32_socket.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_socket.c
diff -u src/sys/compat/netbsd32/netbsd32_socket.c:1.52 src/sys/compat/netbsd32/netbsd32_socket.c:1.53
--- src/sys/compat/netbsd32/netbsd32_socket.c:1.52	Fri Sep 27 08:17:11 2019
+++ src/sys/compat/netbsd32/netbsd32_socket.c	Sat Sep 28 08:21:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_socket.c,v 1.52 2019/09/27 08:17:11 mlelstv Exp $	*/
+/*	$NetBSD: netbsd32_socket.c,v 1.53 2019/09/28 08:21:08 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.52 2019/09/27 08:17:11 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_socket.c,v 1.53 2019/09/28 08:21:08 mlelstv Exp $");
 
 #include 
 #include 
@@ -418,7 +418,7 @@ copyin32_msg_control(struct lwp *l, stru
 			size_t nclen;
 
 			nclen = cidx + cspace;
-			if (nclen >= PAGE_SIZE) {
+			if (nclen >= (size_t)PAGE_SIZE) {
 error = EINVAL;
 goto failure;
 			}



CVS commit: src/sys/compat/netbsd32

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 08:21:08 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_socket.c

Log Message:
signed/unsigned comparison.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/compat/netbsd32/netbsd32_socket.c

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



CVS commit: [netbsd-7-0] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:52:18 UTC 2019

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.151 -r1.1.2.152 src/doc/CHANGES-7.0.3

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-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.151 src/doc/CHANGES-7.0.3:1.1.2.152
--- src/doc/CHANGES-7.0.3:1.1.2.151	Tue Sep 17 18:10:00 2019
+++ src/doc/CHANGES-7.0.3	Sat Sep 28 07:52:18 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.151 2019/09/17 18:10:00 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.152 2019/09/28 07:52:18 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5896,3 +5896,12 @@ sys/netinet6/ip6_input.c			1.209 (patch)
 	m_pullup() when needed.
 	[bouyer, ticket #1708]
 
+sys/netbt/hci.h	1.46
+sys/netbt/hci_event.c1.26
+
+	When encrypted connections are configured, verify that the encryption
+	key length has a minimum size when the adaptor supports that.
+	This addresses the 'Key Negotiation of Bluetooth' attack,
+	CVE-2019-9506.
+	[plunky, ticket #1709]
+



CVS commit: [netbsd-7-0] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:52:18 UTC 2019

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.151 -r1.1.2.152 src/doc/CHANGES-7.0.3

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



CVS commit: [netbsd-7-0] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:58 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7-0]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.32.1 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.39 src/sys/netbt/hci.h:1.39.6.1
--- src/sys/netbt/hci.h:1.39	Tue Jul  1 05:49:18 2014
+++ src/sys/netbt/hci.h	Sat Sep 28 07:51:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $	*/
+/*	$NetBSD: hci.h,v 1.39.6.1 2019/09/28 07:51:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $
+ * $Id: hci.h,v 1.39.6.1 2019/09/28 07:51:57 martin Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1786,6 +1786,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.23 src/sys/netbt/hci_event.c:1.23.32.1
--- src/sys/netbt/hci_event.c:1.23	Wed Jul 27 10:25:09 2011
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:51:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.23.32.1 2019/09/28 07:51:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23.32.1 2019/09/28 07:51:57 martin Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -351,6 +352,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -618,10 +623,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -772,17 +778,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < sizeof(ep))

CVS commit: [netbsd-7-0] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:58 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7-0]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.6.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.32.1 src/sys/netbt/hci_event.c

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



CVS commit: [netbsd-7-1] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:32 UTC 2019

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-7.1.3

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



CVS commit: [netbsd-7-1] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:32 UTC 2019

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-7.1.3

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-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.58 src/doc/CHANGES-7.1.3:1.1.2.59
--- src/doc/CHANGES-7.1.3:1.1.2.58	Tue Sep 17 18:08:59 2019
+++ src/doc/CHANGES-7.1.3	Sat Sep 28 07:51:31 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.58 2019/09/17 18:08:59 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.59 2019/09/28 07:51:31 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -588,3 +588,12 @@ sys/netinet6/ip6_input.c			1.209 (patch)
 	m_pullup() when needed.
 	[bouyer, ticket #1708]
 
+sys/netbt/hci.h	1.46
+sys/netbt/hci_event.c1.26
+
+	When encrypted connections are configured, verify that the encryption
+	key length has a minimum size when the adaptor supports that.
+	This addresses the 'Key Negotiation of Bluetooth' attack,
+	CVE-2019-9506.
+	[plunky, ticket #1709]
+



CVS commit: [netbsd-7-1] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:11 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7-1]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.10.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.36.1 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.39 src/sys/netbt/hci.h:1.39.10.1
--- src/sys/netbt/hci.h:1.39	Tue Jul  1 05:49:18 2014
+++ src/sys/netbt/hci.h	Sat Sep 28 07:51:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $	*/
+/*	$NetBSD: hci.h,v 1.39.10.1 2019/09/28 07:51:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $
+ * $Id: hci.h,v 1.39.10.1 2019/09/28 07:51:11 martin Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1786,6 +1786,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.23 src/sys/netbt/hci_event.c:1.23.36.1
--- src/sys/netbt/hci_event.c:1.23	Wed Jul 27 10:25:09 2011
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:51:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.23.36.1 2019/09/28 07:51:11 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23.36.1 2019/09/28 07:51:11 martin Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -351,6 +352,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -618,10 +623,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -772,17 +778,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < 

CVS commit: [netbsd-7-1] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:51:11 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7-1]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.10.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.36.1 src/sys/netbt/hci_event.c

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



CVS commit: [netbsd-7] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:50:46 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.62 -r1.1.2.63 src/doc/CHANGES-7.3

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-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.62 src/doc/CHANGES-7.3:1.1.2.63
--- src/doc/CHANGES-7.3:1.1.2.62	Tue Sep 17 18:07:54 2019
+++ src/doc/CHANGES-7.3	Sat Sep 28 07:50:46 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.62 2019/09/17 18:07:54 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.63 2019/09/28 07:50:46 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -683,3 +683,12 @@ sys/netinet6/ip6_input.c			1.209 (patch)
 	m_pullup() when needed.
 	[bouyer, ticket #1708]
 
+sys/netbt/hci.h	1.46
+sys/netbt/hci_event.c1.26
+
+	When encrypted connections are configured, verify that the encryption
+	key length has a minimum size when the adaptor supports that.
+	This addresses the 'Key Negotiation of Bluetooth' attack,
+	CVE-2019-9506.
+	[plunky, ticket #1709]
+



CVS commit: [netbsd-7] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:50:23 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/netbt/hci_event.c

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



CVS commit: [netbsd-7] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:50:46 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1709


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.62 -r1.1.2.63 src/doc/CHANGES-7.3

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



CVS commit: [netbsd-7] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:50:23 UTC 2019

Modified Files:
src/sys/netbt [netbsd-7]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1709):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.23 -r1.23.28.1 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.39 src/sys/netbt/hci.h:1.39.2.1
--- src/sys/netbt/hci.h:1.39	Tue Jul  1 05:49:18 2014
+++ src/sys/netbt/hci.h	Sat Sep 28 07:50:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $	*/
+/*	$NetBSD: hci.h,v 1.39.2.1 2019/09/28 07:50:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.39 2014/07/01 05:49:18 rtr Exp $
+ * $Id: hci.h,v 1.39.2.1 2019/09/28 07:50:23 martin Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1786,6 +1786,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.23 src/sys/netbt/hci_event.c:1.23.28.1
--- src/sys/netbt/hci_event.c:1.23	Wed Jul 27 10:25:09 2011
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:50:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.23.28.1 2019/09/28 07:50:23 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23 2011/07/27 10:25:09 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.23.28.1 2019/09/28 07:50:23 martin Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -351,6 +352,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -618,10 +623,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -772,17 +778,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < sizeof(ep))
@@ 

CVS commit: [netbsd-8] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:48:30 UTC 2019

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

Log Message:
Tickets #1394 and #1395


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.45 -r1.1.2.46 src/doc/CHANGES-8.2

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.2
diff -u src/doc/CHANGES-8.2:1.1.2.45 src/doc/CHANGES-8.2:1.1.2.46
--- src/doc/CHANGES-8.2:1.1.2.45	Fri Sep 27 09:49:45 2019
+++ src/doc/CHANGES-8.2	Sat Sep 28 07:48:30 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.45 2019/09/27 09:49:45 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.46 2019/09/28 07:48:30 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1211,3 +1211,17 @@ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c		1
 	Fix off by one in sbc encoder.
 	[nat, ticket #1393]
 
+external/mit/expat/lib/libexpat/Makefile	1.3,1.4
+
+	More portable way to extract PACKAGE_VERSION.
+	[maya, ticket #1394]
+
+sys/netbt/hci.h	1.46
+sys/netbt/hci_event.c1.26
+
+	When encrypted connections are configured, verify that the encryption
+	key length has a minimum size when the adaptor supports that.
+	This addresses the 'Key Negotiation of Bluetooth' attack,
+	CVE-2019-9506.
+	[plunky, ticket #1395]
+



CVS commit: [netbsd-8] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:48:30 UTC 2019

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

Log Message:
Tickets #1394 and #1395


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.45 -r1.1.2.46 src/doc/CHANGES-8.2

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

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:47:07 UTC 2019

Modified Files:
src/sys/netbt [netbsd-8]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1395):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.6.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.24 -r1.24.10.1 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.43 src/sys/netbt/hci.h:1.43.6.1
--- src/sys/netbt/hci.h:1.43	Sat Jan 28 19:19:41 2017
+++ src/sys/netbt/hci.h	Sat Sep 28 07:47:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.43 2017/01/28 19:19:41 jakllsch Exp $	*/
+/*	$NetBSD: hci.h,v 1.43.6.1 2019/09/28 07:47:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.43 2017/01/28 19:19:41 jakllsch Exp $
+ * $Id: hci.h,v 1.43.6.1 2019/09/28 07:47:07 martin Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1811,6 +1811,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.24 src/sys/netbt/hci_event.c:1.24.10.1
--- src/sys/netbt/hci_event.c:1.24	Sat Nov 28 09:04:34 2015
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:47:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.24 2015/11/28 09:04:34 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.24.10.1 2019/09/28 07:47:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.24 2015/11/28 09:04:34 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.24.10.1 2019/09/28 07:47:07 martin Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -351,6 +352,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -618,10 +623,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -772,17 +778,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < 

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

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:47:07 UTC 2019

Modified Files:
src/sys/netbt [netbsd-8]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #1395):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.43.6.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.24 -r1.24.10.1 src/sys/netbt/hci_event.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/external/mit/expat/lib/libexpat

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:45:25 UTC 2019

Modified Files:
src/external/mit/expat/lib/libexpat [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #1394):

external/mit/expat/lib/libexpat/Makefile: revision 1.3
external/mit/expat/lib/libexpat/Makefile: revision 1.4

Now that expat_config.h uses a header that is OS-specific, using the HOST_CC
breaks for some setups which lack it (netbsd<8, possibly other things).

Use the compiler targetting netbsd that uses netbsd headers to figure out
PACKAGE_VERSION to avoid this problem.

Unless we add --sysroot, the netbsd src tree headers won't be used.
Do so, so we don't rely on the build machine to have  for
this macro check.

Using ${CPPFLAGS} rather than my own encoding of --sysroot, since it
already includes it.

Tested by agc, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/external/mit/expat/lib/libexpat/Makefile

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

Modified files:

Index: src/external/mit/expat/lib/libexpat/Makefile
diff -u src/external/mit/expat/lib/libexpat/Makefile:1.2 src/external/mit/expat/lib/libexpat/Makefile:1.2.8.1
--- src/external/mit/expat/lib/libexpat/Makefile:1.2	Sat May 14 14:39:39 2016
+++ src/external/mit/expat/lib/libexpat/Makefile	Sat Sep 28 07:45:25 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2016/05/14 14:39:39 spz Exp $
+#	$NetBSD: Makefile,v 1.2.8.1 2019/09/28 07:45:25 martin Exp $
 
 .include 
 
@@ -36,7 +36,7 @@ dependall: all
 
 expat.pc: expat_config.h expat.pc.in
 	@(V=$$( (echo '#include '; echo PACKAGE_VERSION) | \
-	${HOST_CC} -E -I${.CURDIR} - | tail -1 | tr -d '"') && \
+	${CC} ${CPPFLAGS} -E -I${.CURDIR} - | tail -1 | tr -d '"') && \
 	${TOOL_SED} -e s/@VERSION@/$$V/ < ${.CURDIR}/expat.pc.in \
 	> ${.TARGET})
 



CVS commit: [netbsd-8] src/external/mit/expat/lib/libexpat

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:45:25 UTC 2019

Modified Files:
src/external/mit/expat/lib/libexpat [netbsd-8]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #1394):

external/mit/expat/lib/libexpat/Makefile: revision 1.3
external/mit/expat/lib/libexpat/Makefile: revision 1.4

Now that expat_config.h uses a header that is OS-specific, using the HOST_CC
breaks for some setups which lack it (netbsd<8, possibly other things).

Use the compiler targetting netbsd that uses netbsd headers to figure out
PACKAGE_VERSION to avoid this problem.

Unless we add --sysroot, the netbsd src tree headers won't be used.
Do so, so we don't rely on the build machine to have  for
this macro check.

Using ${CPPFLAGS} rather than my own encoding of --sysroot, since it
already includes it.

Tested by agc, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.8.1 src/external/mit/expat/lib/libexpat/Makefile

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



CVS commit: [netbsd-9] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:43:34 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #256 - #262


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-9.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-9.0
diff -u src/doc/CHANGES-9.0:1.1.2.64 src/doc/CHANGES-9.0:1.1.2.65
--- src/doc/CHANGES-9.0:1.1.2.64	Fri Sep 27 15:31:38 2019
+++ src/doc/CHANGES-9.0	Sat Sep 28 07:43:34 2019
@@ -1,5 +1,5 @@
 
-# $NetBSD: CHANGES-9.0,v 1.1.2.64 2019/09/27 15:31:38 martin Exp $
+# $NetBSD: CHANGES-9.0,v 1.1.2.65 2019/09/28 07:43:34 martin Exp $
 
 A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30
 until the 9.0 release:
@@ -4105,3 +4105,47 @@ usr.sbin/bta2dpd/bta2dpd/sbc_encode.c		1
 	Fix off by one in sbc encoder.
 	[nat, ticket #254]
 
+sys/dev/fdt/fdt_pinctrl.c			1.9
+
+	Don't assume pinctrl-0 is the default configuration.
+	[jmcneill, ticket #256]
+
+sys/stand/efiboot/efiblock.c			1.7
+
+	Use roundup2() instead of open coding it.
+	Fixes disk access and booting in bootaa64.efi on machines with no
+	memory below 4GiB.
+	[jakllsch, ticket #257]
+
+usr.bin/audiocfg/main.c1.9
+
+	Fix assertion of "audiocfg list " when n is an illegal index.
+	[isaki, ticket #258]
+
+external/mit/expat/lib/libexpat/Makefile	1.3,1.4
+
+	More portable way to extract PACKAGE_VERSION.
+	[maya, ticket #259]
+
+sys/netbt/hci.h	1.46
+sys/netbt/hci_event.c1.26
+
+	When encrypted connections are configured, verify that the encryption
+	key length has a minimum size when the adaptor supports that.
+	This addresses the 'Key Negotiation of Bluetooth' attack,
+	CVE-2019-9506.
+	[plunky, ticket #260]
+
+usr.bin/audiocfg/audiocfg.1			1.6
+
+	Fix markup.  Index of list command is optional.
+	[isaki, ticket #261]
+
+usr.bin/audiocfg/audiodev.c			1.8,1.9
+usr.bin/audiocfg/audiodev.h			1.6,1.7
+usr.bin/audiocfg/main.c1.10,1.11
+
+	Rename some members in adev for clarity.
+	Revert to using a single descriptor for "audiocfg test" as before.
+	[isaki, ticket #262]
+



CVS commit: [netbsd-9] src/doc

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:43:34 UTC 2019

Modified Files:
src/doc [netbsd-9]: CHANGES-9.0

Log Message:
Tickets #256 - #262


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.64 -r1.1.2.65 src/doc/CHANGES-9.0

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



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:42:47 UTC 2019

Modified Files:
src/sys/arch/arm/nvidia: tegra210_pinmux.c tegra_pinmux.c
tegra_pinmux.h

Log Message:
Update tegra_pinmux to support all bindings (pins and pin groups)

Update tegra210_pinmux.c with all defined pins and groups.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nvidia/tegra210_pinmux.c \
src/sys/arch/arm/nvidia/tegra_pinmux.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nvidia/tegra_pinmux.c

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



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:42:47 UTC 2019

Modified Files:
src/sys/arch/arm/nvidia: tegra210_pinmux.c tegra_pinmux.c
tegra_pinmux.h

Log Message:
Update tegra_pinmux to support all bindings (pins and pin groups)

Update tegra210_pinmux.c with all defined pins and groups.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/nvidia/tegra210_pinmux.c \
src/sys/arch/arm/nvidia/tegra_pinmux.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/nvidia/tegra_pinmux.c

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

Modified files:

Index: src/sys/arch/arm/nvidia/tegra210_pinmux.c
diff -u src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.1 src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.2
--- src/sys/arch/arm/nvidia/tegra210_pinmux.c:1.1	Fri Sep 22 14:36:22 2017
+++ src/sys/arch/arm/nvidia/tegra210_pinmux.c	Sat Sep 28 07:42:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra210_pinmux.c,v 1.1 2017/09/22 14:36:22 jmcneill Exp $ */
+/* $NetBSD: tegra210_pinmux.c,v 1.2 2019/09/28 07:42:47 skrll Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra210_pinmux.c,v 1.1 2017/09/22 14:36:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra210_pinmux.c,v 1.2 2019/09/28 07:42:47 skrll Exp $");
 
 #include 
 #include 
@@ -36,171 +36,222 @@ __KERNEL_RCSID(0, "$NetBSD: tegra210_pin
 
 #include 
 
+#define TEGRA_PIN(n, r, f1, f2, f3, f4)	\
+	{\
+		.tpp_name = n,		\
+		.tpp_reg = (r),		\
+		.tpp_type = TEGRA_PINMUX,\
+		.tpp_functions = {	\
+			f1, f2, f3, f4	\
+		}			\
+	}
+
+#define TEGRA_PINGROUP(n, r, drvdn_m, drvup_m, slwrr_m, slwrf_m)	\
+	{\
+		.tpp_name = "drive_" n,	\
+		.tpp_reg = (r) - 0x8d4,	\
+		.tpp_type = TEGRA_PADCTRL,\
+		.tpp_dg = {		\
+			.drvdn_mask = drvdn_m,\
+			.drvup_mask = drvup_m,\
+			.slwrr_mask = slwrr_m,\
+			.slwrf_mask = slwrf_m\
+		}			\
+	}
+
+// 9.15 Pinmux registers
 static const struct tegra_pinmux_pins tegra210_pins[] = {
-	{ "sdmmc1_clk_pm0",		0x00, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_cmd_pm1",		0x04, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat3_pm2",		0x08, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat2_pm3",		0x0c, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat1_pm4",		0x10, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc1_dat0_pm5",		0x14, { "sdmmc1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_clk_pp0",		0x1c, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_cmd_pp1",		0x20, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat0_pp5",		0x24, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat1_pp4",		0x28, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat2_pp3",		0x2c, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sdmmc3_dat3_pp2",		0x30, { "sdmmc3", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l0_rst_n_pa0",		0x38, { "pe0", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l0_clkreq_n_pa1",	0x3c, { "pe0", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_wake_n_pa2",		0x40, { "pe", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l1_rst_n_pa3",		0x44, { "pe1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "pex_l1_clkreq_n_pa4",	0x48, { "pe1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "sata_led_active_pa5",	0x4c, { "sata", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_mosi_pc0",		0x50, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_miso_pc1",		0x54, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_sck_pc2",		0x58, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_cs0_pc3",		0x5c, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi1_cs1_pc4",		0x60, { "spi1", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi2_mosi_pb4",		0x64, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_miso_pb5",		0x68, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_sck_pb6",		0x6c, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_cs0_pb7",		0x70, { "spi2", "dtv", "rsvd2", "rsvd3" } },
-	{ "spi2_cs1_pdd0",		0x74, { "spi2", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_mosi_pc7",		0x78, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_miso_pd0",		0x7c, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_sck_pc5",		0x80, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "spi4_cs0_pc6",		0x84, { "spi4", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_sck_pee0",		0x88, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_cs_n_pee1",		0x8c, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io0_pee2",		0x90, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io1_pee3",		0x94, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io2_pee4",		0x98, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "qspi_io3_pee5",		0x9c, { "qspi", "rsvd1", "rsvd2", "rsvd3" } },
-	{ "dmic1_clk_pe0",		0xa4, { "dmic1", "i2s3", "rsvd2", "rsvd3" } },
-	{ "dmic1_dat_pe1",		0xa8, { "dmic1", "i2s3", "rsvd2", "rsvd3" } },
-	{ "dmic2_clk_pe2",		0xac, { "dmic2", 

CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:41:18 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiodev.c audiodev.h main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #262):

usr.bin/audiocfg/main.c: revision 1.10
usr.bin/audiocfg/main.c: revision 1.11
usr.bin/audiocfg/audiodev.c: revision 1.8
usr.bin/audiocfg/audiodev.h: revision 1.6
usr.bin/audiocfg/audiodev.c: revision 1.9
usr.bin/audiocfg/audiodev.h: revision 1.7

Rename some members in adev for clarity.  No functional changes intended.

Revert to use single descriptor for "audiocfg test" as before.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.5 -r1.5.2.1 src/usr.bin/audiocfg/audiodev.h
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/usr.bin/audiocfg/main.c

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



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:41:18 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiodev.c audiodev.h main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #262):

usr.bin/audiocfg/main.c: revision 1.10
usr.bin/audiocfg/main.c: revision 1.11
usr.bin/audiocfg/audiodev.c: revision 1.8
usr.bin/audiocfg/audiodev.h: revision 1.6
usr.bin/audiocfg/audiodev.c: revision 1.9
usr.bin/audiocfg/audiodev.h: revision 1.7

Rename some members in adev for clarity.  No functional changes intended.

Revert to use single descriptor for "audiocfg test" as before.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/usr.bin/audiocfg/audiodev.c
cvs rdiff -u -r1.5 -r1.5.2.1 src/usr.bin/audiocfg/audiodev.h
cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/audiodev.c
diff -u src/usr.bin/audiocfg/audiodev.c:1.7 src/usr.bin/audiocfg/audiodev.c:1.7.2.1
--- src/usr.bin/audiocfg/audiodev.c:1.7	Wed May  8 14:36:12 2019
+++ src/usr.bin/audiocfg/audiodev.c	Sat Sep 28 07:41:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodev.c,v 1.7 2019/05/08 14:36:12 isaki Exp $ */
+/* $NetBSD: audiodev.c,v 1.7.2.1 2019/09/28 07:41:18 martin Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -43,6 +43,9 @@
 #include "drvctl.h"
 #include "dtmf.h"
 
+static int audiodev_test_chmask(struct audiodev *, unsigned int,
+	audio_info_t *);
+
 static TAILQ_HEAD(audiodevhead, audiodev) audiodevlist =
 TAILQ_HEAD_INITIALIZER(audiodevlist);
 
@@ -63,26 +66,26 @@ audiodev_getinfo(struct audiodev *adev)
 	if (stat(_PATH_AUDIOCTL, ) != -1 && st.st_rdev == adev->dev)
 		adev->defaultdev = true;
 
-	adev->fd = open(adev->ctlpath, O_RDONLY);
-	if (adev->fd == -1) {
+	adev->ctlfd = open(adev->ctlpath, O_RDONLY);
+	if (adev->ctlfd == -1) {
 			return -1;
 	}
-	if (ioctl(adev->fd, AUDIO_GETDEV, >audio_device) == -1) {
-		close(adev->fd);
+	if (ioctl(adev->ctlfd, AUDIO_GETDEV, >audio_device) == -1) {
+		close(adev->ctlfd);
 		return -1;
 	}
 
 	for (i = 0; ;i++) {
 		memset(, 0, sizeof(query));
 		query.index = i;
-		if (ioctl(adev->fd, AUDIO_QUERYFORMAT, ) == -1) {
+		if (ioctl(adev->ctlfd, AUDIO_QUERYFORMAT, ) == -1) {
 			if (errno == ENODEV) {
 /* QUERYFORMAT not supported. */
 break;
 			}
 			if (errno == EINVAL)
 break;
-			close(adev->fd);
+			close(adev->ctlfd);
 			return -1;
 		}
 
@@ -91,8 +94,8 @@ audiodev_getinfo(struct audiodev *adev)
 		TAILQ_INSERT_TAIL(>formats, f, next);
 	}
 
-	if (ioctl(adev->fd, AUDIO_GETFORMAT, >info) == -1) {
-		close(adev->fd);
+	if (ioctl(adev->ctlfd, AUDIO_GETFORMAT, >hwinfo) == -1) {
+		close(adev->ctlfd);
 		return -1;
 	}
 
@@ -158,8 +161,8 @@ audiodev_refresh(void)
 
 	while (!TAILQ_EMPTY()) {
 		adev = TAILQ_FIRST();
-		if (adev->fd != -1)
-			close(adev->fd);
+		if (adev->ctlfd != -1)
+			close(adev->ctlfd);
 		TAILQ_REMOVE(, adev, next);
 		free(adev);
 	}
@@ -250,12 +253,12 @@ int
 audiodev_set_param(struct audiodev *adev, int mode,
 	const char *encname, unsigned int prec, unsigned int ch, unsigned int freq)
 {
-	struct audio_info ai;
+	audio_info_t ai;
 	int setmode;
 	u_int enc;
 
 	setmode = 0;
-	ai = adev->info;
+	ai = adev->hwinfo;
 
 	for (enc = 0; enc < encoding_max; enc++) {
 		if (strcmp(encname, encoding_names[enc]) == 0)
@@ -290,7 +293,7 @@ audiodev_set_param(struct audiodev *adev
 	ai.mode = setmode;
 	printf("setting %s to %s:%u, %uch, %uHz\n",
 	adev->xname, encname, prec, ch, freq);
-	if (ioctl(adev->fd, AUDIO_SETFORMAT, ) == -1) {
+	if (ioctl(adev->ctlfd, AUDIO_SETFORMAT, ) == -1) {
 		perror("ioctl AUDIO_SETFORMAT");
 		return -1;
 	}
@@ -298,40 +301,64 @@ audiodev_set_param(struct audiodev *adev
 }
 
 int
-audiodev_test(struct audiodev *adev, unsigned int chanmask)
+audiodev_test(struct audiodev *adev)
 {
 	audio_info_t info;
-	int16_t *buf;
-	size_t buflen;
-	off_t off;
-	int fd;
-	int rv = -1;
+	unsigned int i;
+	int rv;
 
-	fd = open(adev->path, O_WRONLY);
-	if (fd == -1) {
+	rv = -1;
+
+	adev->fd = open(adev->path, O_WRONLY);
+	if (adev->fd == -1) {
 		perror("open");
 		return -1;
 	}
 
 	AUDIO_INITINFO();
 	info.play.sample_rate = AUDIODEV_SAMPLE_RATE;
-	info.play.channels = adev->info.play.channels;
+	info.play.channels = adev->hwinfo.play.channels;
 	info.play.precision = 16;
 	info.play.encoding = AUDIO_ENCODING_SLINEAR_LE;
 	info.mode = AUMODE_PLAY;
-	if (ioctl(fd, AUDIO_SETINFO, ) == -1) {
+	if (ioctl(adev->fd, AUDIO_SETINFO, ) == -1) {
 		perror("ioctl AUDIO_SETINFO");
-		goto abort;
+		goto done;
 	}
-	if (ioctl(fd, AUDIO_GETINFO, ) == -1) {
+	if (ioctl(adev->fd, AUDIO_GETINFO, ) == -1) {
 		perror("ioctl AUDIO_GETINFO");
-		goto abort;
+		goto done;
 	}
 
-	dtmf_new(, , info.play.sample_rate, 2,
-	adev->info.play.channels, chanmask, 350.0, 440.0);

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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:39:30 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Fix build on SOC_BCM2835 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/broadcom/bcm283x_platform.c

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



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:39:30 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Fix build on SOC_BCM2835 kernels


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/broadcom/bcm283x_platform.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.25 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.26
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.25	Fri Sep 27 12:58:54 2019
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Sat Sep 28 07:39:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.25 2019/09/27 12:58:54 skrll Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.26 2019/09/28 07:39:30 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.25 2019/09/27 12:58:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.26 2019/09/28 07:39:30 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -322,7 +322,6 @@ bcm2836_platform_devmap(void)
 
 	return devmap;
 }
-#endif
 
 static const struct pmap_devmap *
 bcm2838_platform_devmap(void)
@@ -342,6 +341,8 @@ bcm2838_platform_devmap(void)
 
 	return devmap;
 }
+#endif
+
 /*
  * Macros to translate between physical and virtual for a subset of the
  * kernel address space.  *Not* for general use.



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:34:50 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiocfg.1

Log Message:
Pull up following revision(s) (requested by isaki in ticket #261):

usr.bin/audiocfg/audiocfg.1: revision 1.6

Fix markup.  index of list command is optional.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/usr.bin/audiocfg/audiocfg.1

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



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:34:50 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: audiocfg.1

Log Message:
Pull up following revision(s) (requested by isaki in ticket #261):

usr.bin/audiocfg/audiocfg.1: revision 1.6

Fix markup.  index of list command is optional.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/usr.bin/audiocfg/audiocfg.1

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/audiocfg/audiocfg.1
diff -u src/usr.bin/audiocfg/audiocfg.1:1.5 src/usr.bin/audiocfg/audiocfg.1:1.5.2.1
--- src/usr.bin/audiocfg/audiocfg.1:1.5	Thu May  9 09:34:58 2019
+++ src/usr.bin/audiocfg/audiocfg.1	Sat Sep 28 07:34:50 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audiocfg.1,v 1.5 2019/05/09 09:34:58 wiz Exp $
+.\"	$NetBSD: audiocfg.1,v 1.5.2.1 2019/09/28 07:34:50 martin Exp $
 .\"
 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -36,6 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Cm list
+.Op Ar index
 .Nm
 .Cm default
 .Ar index



CVS commit: [netbsd-9] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:32:03 UTC 2019

Modified Files:
src/sys/netbt [netbsd-9]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #260):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.4.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/netbt/hci_event.c

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



CVS commit: [netbsd-9] src/sys/netbt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:32:03 UTC 2019

Modified Files:
src/sys/netbt [netbsd-9]: hci.h hci_event.c

Log Message:
Pull up following revision(s) (requested by plunky in ticket #260):

sys/netbt/hci_event.c: revision 1.26
sys/netbt/hci.h: revision 1.46

When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506
https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.45.4.1 src/sys/netbt/hci.h
cvs rdiff -u -r1.25 -r1.25.4.1 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.45 src/sys/netbt/hci.h:1.45.4.1
--- src/sys/netbt/hci.h:1.45	Wed Jul 25 19:09:38 2018
+++ src/sys/netbt/hci.h	Sat Sep 28 07:32:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.45 2018/07/25 19:09:38 kamil Exp $	*/
+/*	$NetBSD: hci.h,v 1.45.4.1 2019/09/28 07:32:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.45 2018/07/25 19:09:38 kamil Exp $
+ * $Id: hci.h,v 1.45.4.1 2019/09/28 07:32:02 martin Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1812,6 +1812,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.25 src/sys/netbt/hci_event.c:1.25.4.1
--- src/sys/netbt/hci_event.c:1.25	Tue Aug 21 14:59:13 2018
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:32:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.25.4.1 2019/09/28 07:32:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.25.4.1 2019/09/28 07:32:02 martin Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -353,6 +354,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -623,10 +628,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -777,17 +783,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < sizeof(ep))
@@ 

CVS commit: [netbsd-9] src/external/mit/expat/lib/libexpat

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:29:15 UTC 2019

Modified Files:
src/external/mit/expat/lib/libexpat [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #259):

external/mit/expat/lib/libexpat/Makefile: revision 1.3
external/mit/expat/lib/libexpat/Makefile: revision 1.4

Now that expat_config.h uses a header that is OS-specific, using the HOST_CC
breaks for some setups which lack it (netbsd<8, possibly other things).
Use the compiler targetting netbsd that uses netbsd headers to figure out
PACKAGE_VERSION to avoid this problem.

Unless we add --sysroot, the netbsd src tree headers won't be used.

Do so, so we don't rely on the build machine to have  for
this macro check.

Using ${CPPFLAGS} rather than my own encoding of --sysroot, since it
already includes it.

Tested by agc, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.18.1 src/external/mit/expat/lib/libexpat/Makefile

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



CVS commit: [netbsd-9] src/external/mit/expat/lib/libexpat

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:29:15 UTC 2019

Modified Files:
src/external/mit/expat/lib/libexpat [netbsd-9]: Makefile

Log Message:
Pull up following revision(s) (requested by maya in ticket #259):

external/mit/expat/lib/libexpat/Makefile: revision 1.3
external/mit/expat/lib/libexpat/Makefile: revision 1.4

Now that expat_config.h uses a header that is OS-specific, using the HOST_CC
breaks for some setups which lack it (netbsd<8, possibly other things).
Use the compiler targetting netbsd that uses netbsd headers to figure out
PACKAGE_VERSION to avoid this problem.

Unless we add --sysroot, the netbsd src tree headers won't be used.

Do so, so we don't rely on the build machine to have  for
this macro check.

Using ${CPPFLAGS} rather than my own encoding of --sysroot, since it
already includes it.

Tested by agc, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.18.1 src/external/mit/expat/lib/libexpat/Makefile

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

Modified files:

Index: src/external/mit/expat/lib/libexpat/Makefile
diff -u src/external/mit/expat/lib/libexpat/Makefile:1.2 src/external/mit/expat/lib/libexpat/Makefile:1.2.18.1
--- src/external/mit/expat/lib/libexpat/Makefile:1.2	Sat May 14 14:39:39 2016
+++ src/external/mit/expat/lib/libexpat/Makefile	Sat Sep 28 07:29:15 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.2 2016/05/14 14:39:39 spz Exp $
+#	$NetBSD: Makefile,v 1.2.18.1 2019/09/28 07:29:15 martin Exp $
 
 .include 
 
@@ -36,7 +36,7 @@ dependall: all
 
 expat.pc: expat_config.h expat.pc.in
 	@(V=$$( (echo '#include '; echo PACKAGE_VERSION) | \
-	${HOST_CC} -E -I${.CURDIR} - | tail -1 | tr -d '"') && \
+	${CC} ${CPPFLAGS} -E -I${.CURDIR} - | tail -1 | tr -d '"') && \
 	${TOOL_SED} -e s/@VERSION@/$$V/ < ${.CURDIR}/expat.pc.in \
 	> ${.TARGET})
 



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:25:53 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #258):

usr.bin/audiocfg/main.c: revision 1.9

Fix assertion of "audiocfg list " when n is an illegal index.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.2.1 src/usr.bin/audiocfg/main.c

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

Modified files:

Index: src/usr.bin/audiocfg/main.c
diff -u src/usr.bin/audiocfg/main.c:1.8 src/usr.bin/audiocfg/main.c:1.8.2.1
--- src/usr.bin/audiocfg/main.c:1.8	Wed May  8 14:36:12 2019
+++ src/usr.bin/audiocfg/main.c	Sat Sep 28 07:25:53 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.8 2019/05/08 14:36:12 isaki Exp $ */
+/* $NetBSD: main.c,v 1.8.2.1 2019/09/28 07:25:53 martin Exp $ */
 
 /*
  * Copyright (c) 2010 Jared D. McNeill 
@@ -164,7 +164,12 @@ main(int argc, char *argv[])
 		if (errno)
 			usage(argv[0]);
 			/* NOTREACHED */
-		print_audiodev(audiodev_get(i), i);
+		adev = audiodev_get(i);
+		if (adev == NULL) {
+			fprintf(stderr, "no such device\n");
+			return EXIT_FAILURE;
+		}
+		print_audiodev(adev, i);
 	} else if (strcmp(argv[1], "default") == 0 && argc == 3) {
 		if (*argv[2] < '0' || *argv[2] > '9')
 			usage(argv[0]);



CVS commit: [netbsd-9] src/usr.bin/audiocfg

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:25:53 UTC 2019

Modified Files:
src/usr.bin/audiocfg [netbsd-9]: main.c

Log Message:
Pull up following revision(s) (requested by isaki in ticket #258):

usr.bin/audiocfg/main.c: revision 1.9

Fix assertion of "audiocfg list " when n is an illegal index.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.2.1 src/usr.bin/audiocfg/main.c

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



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

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 07:24:52 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c bcm2835_gpioreg.h

Log Message:
Handle BCM2838 (bcm2711) SoC pecularities.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm2835_gpioreg.h

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



CVS commit: [netbsd-9] src/sys/stand/efiboot

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:24:29 UTC 2019

Modified Files:
src/sys/stand/efiboot [netbsd-9]: efiblock.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #257):

sys/stand/efiboot/efiblock.c: revision 1.7

Use roundup2() instead of open coding something almost the same that
truncates 64-bit quantities.

Fixes disk access and booting in bootaa64.efi on SoftIron OverDrive 1000
(which does not have any memory below 4GiB).


To generate a diff of this commit:
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/stand/efiboot/efiblock.c

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



CVS commit: [netbsd-9] src/sys/stand/efiboot

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:24:29 UTC 2019

Modified Files:
src/sys/stand/efiboot [netbsd-9]: efiblock.c

Log Message:
Pull up following revision(s) (requested by jakllsch in ticket #257):

sys/stand/efiboot/efiblock.c: revision 1.7

Use roundup2() instead of open coding something almost the same that
truncates 64-bit quantities.

Fixes disk access and booting in bootaa64.efi on SoftIron OverDrive 1000
(which does not have any memory below 4GiB).


To generate a diff of this commit:
cvs rdiff -u -r1.5.6.1 -r1.5.6.2 src/sys/stand/efiboot/efiblock.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/stand/efiboot/efiblock.c
diff -u src/sys/stand/efiboot/efiblock.c:1.5.6.1 src/sys/stand/efiboot/efiblock.c:1.5.6.2
--- src/sys/stand/efiboot/efiblock.c:1.5.6.1	Sun Sep 22 12:37:39 2019
+++ src/sys/stand/efiboot/efiblock.c	Sat Sep 28 07:24:29 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: efiblock.c,v 1.5.6.1 2019/09/22 12:37:39 martin Exp $ */
+/* $NetBSD: efiblock.c,v 1.5.6.2 2019/09/28 07:24:29 martin Exp $ */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -108,8 +108,8 @@ efi_block_allocate_device_buffer(struct 
 		*buf_start = buf = AllocatePool(size);
 	else {
 		buf = AllocatePool(size + bdev->bio->Media->IoAlign - 1);
-		*buf_start = (buf == NULL) ? NULL : (void *)(((intptr_t)buf +
-			bdev->bio->Media->IoAlign - 1) & ~(bdev->bio->Media->IoAlign - 1));
+		*buf_start = (buf == NULL) ? NULL :
+		(void *)roundup2((intptr_t)buf, bdev->bio->Media->IoAlign);
 	}
 
 	return buf;



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

2019-09-28 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Sep 28 07:24:52 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_gpio.c bcm2835_gpioreg.h

Log Message:
Handle BCM2838 (bcm2711) SoC pecularities.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/broadcom/bcm2835_gpio.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/broadcom/bcm2835_gpioreg.h

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_gpio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.12 src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.13
--- src/sys/arch/arm/broadcom/bcm2835_gpio.c:1.12	Fri May 10 08:28:50 2019
+++ src/sys/arch/arm/broadcom/bcm2835_gpio.c	Sat Sep 28 07:24:52 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $	*/
+/*	$NetBSD: bcm2835_gpio.c,v 1.13 2019/09/28 07:24:52 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2013, 2014, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.12 2019/05/10 08:28:50 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_gpio.c,v 1.13 2019/09/28 07:24:52 mlelstv Exp $");
 
 /*
  * Driver for BCM2835 GPIO
@@ -65,7 +65,9 @@ int bcm2835gpiodebug = 3;
 #define DPRINTF(l, x)
 #endif
 
-#define	BCMGPIO_MAXPINS	54
+#define BCM2835_GPIO_MAXPINS 54
+#define BCM2838_GPIO_MAXPINS 58
+#define	BCMGPIO_MAXPINS	BCM2838_GPIO_MAXPINS
 
 struct bcmgpio_eint {
 	 int			(*eint_func)(void *);
@@ -101,6 +103,9 @@ struct bcmgpio_softc {
 
 	/* For interrupt support. */
 	struct bcmgpio_bank	sc_banks[BCMGPIO_NBANKS];
+
+	bool			sc_is2835;	/* for pullup on 2711 */
+	u_int			sc_maxpins;
 };
 
 struct bcmgpio_pin {
@@ -216,7 +221,7 @@ bcm283x_pinctrl_set_config(device_t dev,
 	for (int i = 0; i < npins; i++) {
 		const u_int pin = be32toh(pins[i]);
 
-		if (pin > BCMGPIO_MAXPINS)
+		if (pin > sc->sc_maxpins)
 			continue;
 		if (pull) {
 			const int value = be32toh(pull[npull == 1 ? 0 : i]);
@@ -254,6 +259,7 @@ bcmgpio_attach(device_t parent, device_t
 	int error;
 	int pin;
 	int bank;
+	uint32_t reg;
 
 	const int phandle = faa->faa_phandle;
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
@@ -263,19 +269,25 @@ bcmgpio_attach(device_t parent, device_t
 
 	sc->sc_dev = self;
 
-	aprint_naive("\n");
-	aprint_normal(": GPIO controller\n");
-
 	sc->sc_iot = faa->faa_bst;
 	error = bus_space_map(sc->sc_iot, addr, size, 0, >sc_ioh);
 	if (error) {
-		aprint_error_dev(self, "couldn't map registers\n");
+		aprint_error_dev(self, ": couldn't map registers\n");
 		return;
 	}
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
 
-	for (pin = 0; pin < BCMGPIO_MAXPINS; pin++) {
+	/* BCM2835, BCM2836, BCM2837 return 'gpio' in this unused register */
+	reg = bus_space_read_4(sc->sc_iot, sc->sc_ioh, BCM2838_GPIO_GPPUPPDN(3));
+	sc->sc_is2835 = reg == 0x6770696f;
+	sc->sc_maxpins = sc->sc_is2835 ? BCM2835_GPIO_MAXPINS
+	   : BCM2838_GPIO_MAXPINS;
+
+	aprint_naive("\n");
+	aprint_normal(": GPIO controller %s\n", sc->sc_is2835 ? "2835" : "2838");
+
+	for (pin = 0; pin < sc->sc_maxpins; pin++) {
 		sc->sc_gpio_pins[pin].pin_num = pin;
 		/*
 		 * find out pins still available for GPIO
@@ -329,13 +341,13 @@ bcmgpio_attach(device_t parent, device_t
 			aprint_normal_dev(self,
 			"pins %d..%d interrupting on %s\n",
 			bank * 32,
-			MIN((bank * 32) + 31, BCMGPIO_MAXPINS),
+			MIN((bank * 32) + 31, sc->sc_maxpins),
 			intrstr);
 		} else {
 			aprint_error_dev(self,
 			"failed to establish interrupt for pins %d..%d\n",
 			bank * 32,
-			MIN((bank * 32) + 31, BCMGPIO_MAXPINS));
+			MIN((bank * 32) + 31, sc->sc_maxpins));
 		}
 	}
 
@@ -364,7 +376,7 @@ bcmgpio_attach(device_t parent, device_t
 
 	gba.gba_gc = >sc_gpio_gc;
 	gba.gba_pins = >sc_gpio_pins[0];
-	gba.gba_npins = BCMGPIO_MAXPINS;
+	gba.gba_npins = sc->sc_maxpins;
 	(void) config_found_ia(self, "gpiobus", , gpiobus_print);
 }
 
@@ -657,8 +669,9 @@ bcmgpio_gpio_intr_disestablish(void *vsc
 static bool
 bcmgpio_gpio_intrstr(void *vsc, int pin, int irqmode, char *buf, size_t buflen)
 {
+	struct bcmgpio_softc * const sc = vsc;
 
-	if (pin < 0 || pin >= BCMGPIO_MAXPINS)
+	if (pin < 0 || pin >= sc->sc_maxpins)
 		return (false);
 
 	snprintf(buf, buflen, "GPIO %d", pin);
@@ -797,15 +810,48 @@ bcm283x_pin_setpull(const struct bcmgpio
 
 	KASSERT(mutex_owned(>sc_lock));
 
-	const u_int mask = 1 << (pin % BCM2835_GPIO_GPPUD_PINS_PER_REGISTER);
-	const u_int regid = (pin / BCM2835_GPIO_GPPUD_PINS_PER_REGISTER);
+	u_int mask, regid;
+	uint32_t reg;
 
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_GPIO_GPPUD, pud);
-	delay(1);
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_GPIO_GPPUDCLK(regid), mask);
-	delay(1);
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_GPIO_GPPUD, 0);
-	bus_space_write_4(sc->sc_iot, sc->sc_ioh, BCM2835_GPIO_GPPUDCLK(regid), 0);
+	

CVS commit: [netbsd-9] src/sys/dev/fdt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:22:16 UTC 2019

Modified Files:
src/sys/dev/fdt [netbsd-9]: fdt_pinctrl.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #256):

sys/dev/fdt/fdt_pinctrl.c: revision 1.9

Don't assume pinctrl-0 is the default configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/dev/fdt/fdt_pinctrl.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/fdt/fdt_pinctrl.c
diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.8 src/sys/dev/fdt/fdt_pinctrl.c:1.8.4.1
--- src/sys/dev/fdt/fdt_pinctrl.c:1.8	Wed Feb 27 16:56:00 2019
+++ src/sys/dev/fdt/fdt_pinctrl.c	Sat Sep 28 07:22:16 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_pinctrl.c,v 1.8 2019/02/27 16:56:00 jakllsch Exp $ */
+/* $NetBSD: fdt_pinctrl.c,v 1.8.4.1 2019/09/28 07:22:16 martin Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.8 2019/02/27 16:56:00 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.8.4.1 2019/09/28 07:22:16 martin Exp $");
 
 #include 
 #include 
@@ -142,16 +142,16 @@ fdtbus_pinctrl_configure_node(int phandl
 		fdtbus_pinctrl_configure_node(child);
 
 		/*
-		 * Set configuration 0 for this node. This may fail if the
+		 * Set default configuration for this node. This may fail if the
 		 * pinctrl provider is missing; that's OK, we will re-configure
 		 * when that provider attaches.
 		 */
 		fdtbus_get_path(child, buf, sizeof(buf));
-		error = fdtbus_pinctrl_set_config_index(child, 0);
+		error = fdtbus_pinctrl_set_config(child, "default");
 		if (error == 0)
-			aprint_debug("pinctrl: set config pinctrl-0 for %s\n", buf);
+			aprint_debug("pinctrl: set default config for %s\n", buf);
 		else if (error != ENOENT)
-			aprint_debug("pinctrl: failed to set config pinctrl-0 for %s: %d\n", buf, error);
+			aprint_debug("pinctrl: failed to set default config for %s: %d\n", buf, error);
 	}
 }
 



CVS commit: [netbsd-9] src/sys/dev/fdt

2019-09-28 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Sep 28 07:22:16 UTC 2019

Modified Files:
src/sys/dev/fdt [netbsd-9]: fdt_pinctrl.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #256):

sys/dev/fdt/fdt_pinctrl.c: revision 1.9

Don't assume pinctrl-0 is the default configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.8.4.1 src/sys/dev/fdt/fdt_pinctrl.c

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



CVS commit: src/sys/netbt

2019-09-28 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sat Sep 28 07:10:55 UTC 2019

Modified Files:
src/sys/netbt: hci_socket.c

Log Message:
permit read_encryption_key_size from userland


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/netbt/hci_socket.c

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



CVS commit: src/sys/netbt

2019-09-28 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sat Sep 28 07:10:55 UTC 2019

Modified Files:
src/sys/netbt: hci_socket.c

Log Message:
permit read_encryption_key_size from userland


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/netbt/hci_socket.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/netbt/hci_socket.c
diff -u src/sys/netbt/hci_socket.c:1.46 src/sys/netbt/hci_socket.c:1.47
--- src/sys/netbt/hci_socket.c:1.46	Mon Jan 28 12:53:01 2019
+++ src/sys/netbt/hci_socket.c	Sat Sep 28 07:10:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_socket.c,v 1.46 2019/01/28 12:53:01 martin Exp $	*/
+/*	$NetBSD: hci_socket.c,v 1.47 2019/09/28 07:10:55 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.46 2019/01/28 12:53:01 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.47 2019/09/28 07:10:55 plunky Exp $");
 
 /* load symbolic names */
 #ifdef BLUETOOTH_DEBUG
@@ -195,6 +195,8 @@ static const struct {
 	  18, 0x01, 0 },
 	{ HCI_CMD_READ_DEFAULT_ERRDATA_REPORTING,
 	  18, 0x04, 0 },
+	{ HCI_CMD_READ_ENCRYPTION_KEY_SIZE,
+	  20, 0x10, sizeof(hci_read_encryption_key_size_cp) },
 };
 
 /*



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:06:50 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: trap.c

Log Message:
newline after break


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

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



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:06:50 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: trap.c

Log Message:
newline after break


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/aarch64/aarch64/trap.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/aarch64/aarch64/trap.c
diff -u src/sys/arch/aarch64/aarch64/trap.c:1.18 src/sys/arch/aarch64/aarch64/trap.c:1.19
--- src/sys/arch/aarch64/aarch64/trap.c:1.18	Wed Aug  7 09:49:40 2019
+++ src/sys/arch/aarch64/aarch64/trap.c	Sat Sep 28 07:06:50 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.18 2019/08/07 09:49:40 jmcneill Exp $ */
+/* $NetBSD: trap.c,v 1.19 2019/09/28 07:06:50 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.18 2019/08/07 09:49:40 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.19 2019/09/28 07:06:50 skrll Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -348,10 +348,12 @@ trap_el0_32sync(struct trapframe *tf)
 	case ESR_EC_SVC_A32:
 		(*l->l_proc->p_md.md_syscall)(tf);
 		break;
+
 	case ESR_EC_FP_ACCESS:
 		fpu_load(l);
 		userret(l);
 		break;
+
 	case ESR_EC_FP_TRAP_A32:
 		do_trapsignal(l, SIGFPE, FPE_FLTUND, NULL, esr); /* XXX */
 		userret(l);
@@ -361,6 +363,7 @@ trap_el0_32sync(struct trapframe *tf)
 		do_trapsignal(l, SIGBUS, BUS_ADRALN, (void *)tf->tf_pc, esr);
 		userret(l);
 		break;
+
 	case ESR_EC_SP_ALIGNMENT:
 		do_trapsignal(l, SIGBUS, BUS_ADRALN,
 		(void *)tf->tf_reg[13], esr); /* sp is r13 on AArch32 */



CVS commit: src/sys/netbt

2019-09-28 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sat Sep 28 07:06:33 UTC 2019

Modified Files:
src/sys/netbt: hci.h hci_event.c

Log Message:
When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506

https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netbt/hci.h
cvs rdiff -u -r1.25 -r1.26 src/sys/netbt/hci_event.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/netbt/hci.h
diff -u src/sys/netbt/hci.h:1.45 src/sys/netbt/hci.h:1.46
--- src/sys/netbt/hci.h:1.45	Wed Jul 25 19:09:38 2018
+++ src/sys/netbt/hci.h	Sat Sep 28 07:06:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci.h,v 1.45 2018/07/25 19:09:38 kamil Exp $	*/
+/*	$NetBSD: hci.h,v 1.46 2019/09/28 07:06:33 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -54,7 +54,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: hci.h,v 1.45 2018/07/25 19:09:38 kamil Exp $
+ * $Id: hci.h,v 1.46 2019/09/28 07:06:33 plunky Exp $
  * $FreeBSD: src/sys/netgraph/bluetooth/include/ng_hci.h,v 1.6 2005/01/07 01:45:43 imp Exp $
  */
 
@@ -1812,6 +1812,17 @@ typedef struct {
 	uint16_t	accuracy;	/* clock accuracy */
 } __packed hci_read_clock_rp;
 
+#define HCI_OCF_READ_ENCRYPTION_KEY_SIZE		0x0008
+#define HCI_CMD_READ_ENCRYPTION_KEY_SIZE		0x1408
+typedef struct {
+	uint16_t	con_handle;	/* connection handle */
+} __packed hci_read_encryption_key_size_cp;
+
+typedef struct {
+	uint8_t		status;		/* 0x00 - success */
+	uint16_t	con_handle;	/* connection handle */
+	uint8_t		size;		/* key size */
+} __packed hci_read_encryption_key_size_rp;
 
 /**
  **

Index: src/sys/netbt/hci_event.c
diff -u src/sys/netbt/hci_event.c:1.25 src/sys/netbt/hci_event.c:1.26
--- src/sys/netbt/hci_event.c:1.25	Tue Aug 21 14:59:13 2018
+++ src/sys/netbt/hci_event.c	Sat Sep 28 07:06:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $	*/
+/*	$NetBSD: hci_event.c,v 1.26 2019/09/28 07:06:33 plunky Exp $	*/
 
 /*-
  * Copyright (c) 2005 Iain Hibbert.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.25 2018/08/21 14:59:13 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hci_event.c,v 1.26 2019/09/28 07:06:33 plunky Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ static void hci_cmd_read_local_features(
 static void hci_cmd_read_local_extended_features(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_ver(struct hci_unit *, struct mbuf *);
 static void hci_cmd_read_local_commands(struct hci_unit *, struct mbuf *);
+static void hci_cmd_read_encryption_key_size(struct hci_unit *, struct mbuf *);
 static void hci_cmd_reset(struct hci_unit *, struct mbuf *);
 static void hci_cmd_create_con(struct hci_unit *unit, uint8_t status);
 
@@ -353,6 +354,10 @@ hci_event_command_compl(struct hci_unit 
 		hci_cmd_read_local_commands(unit, m);
 		break;
 
+	case HCI_CMD_READ_ENCRYPTION_KEY_SIZE:
+		hci_cmd_read_encryption_key_size(unit, m);
+		break;
+
 	case HCI_CMD_RESET:
 		hci_cmd_reset(unit, m);
 		break;
@@ -623,10 +628,11 @@ hci_event_con_compl(struct hci_unit *uni
 		return;
 	}
 
-	/* XXX could check auth_enable here */
-
-	if (ep.encryption_mode)
-		link->hl_flags |= (HCI_LINK_AUTH | HCI_LINK_ENCRYPT);
+	/*
+	 * We purposefully ignore ep.encryption_mode here - if that is set then
+	 * the link will be authenticated and encrypted, but we still want to
+	 * verify the key size and setmode sets the right flags
+	 */
 
 	link->hl_state = HCI_LINK_OPEN;
 	link->hl_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
@@ -777,17 +783,16 @@ hci_event_auth_compl(struct hci_unit *un
 /*
  * Encryption Change
  *
- * The encryption status has changed. Basically, we note the change
- * then notify the upper layer protocol unless further mode changes
- * are pending.
- * Note that if encryption gets disabled when it has been requested,
- * we will attempt to enable it again.. (its a feature not a bug :)
+ * The encryption status has changed. Make a note if disabled, or
+ * check the key size if possible before allowing it is enabled.
+ * (checking of key size was enabled in 3.0 spec)
  */
 static void
 hci_event_encryption_change(struct hci_unit *unit, struct mbuf *m)
 {
 	hci_encryption_change_ep ep;
 	struct hci_link *link;
+	uint16_t con_handle;
 	int err;
 
 	if (m->m_pkthdr.len < sizeof(ep))
@@ -796,27 +801,34 @@ hci_event_encryption_change(struct hci_u
 	m_copydata(m, 0, sizeof(ep), );
 	m_adj(m, sizeof(ep));
 
-	ep.con_handle = HCI_CON_HANDLE(le16toh(ep.con_handle));
+	con_handle = 

CVS commit: src/sys/netbt

2019-09-28 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Sat Sep 28 07:06:33 UTC 2019

Modified Files:
src/sys/netbt: hci.h hci_event.c

Log Message:
When encrypted connections are configured, verify that the encryption
key length has a minimum size when the adaptor supports that.

This addresses the 'Key Negotiation of Bluetooth' attack, CVE-2019-9506

https://www.bluetooth.com/security/statement-key-negotiation-of-bluetooth/


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/netbt/hci.h
cvs rdiff -u -r1.25 -r1.26 src/sys/netbt/hci_event.c

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



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

2019-09-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Sep 28 07:06:32 UTC 2019

Modified Files:
src/sys/arch/aarch64/aarch64: aarch64_machdep.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/aarch64/aarch64_machdep.c

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



  1   2   >