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

2021-05-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May  4 21:13:38 UTC 2021

Modified Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
prekern: add warnings upon problems collecting entropy

As submitted on port-amd64@ (part 3/3)

Tested on NetBSD/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/prng.c

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/prng.c
diff -u src/sys/arch/amd64/stand/prekern/prng.c:1.4 src/sys/arch/amd64/stand/prekern/prng.c:1.5
--- src/sys/arch/amd64/stand/prekern/prng.c:1.4	Tue May  4 21:10:25 2021
+++ src/sys/arch/amd64/stand/prekern/prng.c	Tue May  4 21:13:38 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: prng.c,v 1.4 2021/05/04 21:10:25 khorben Exp $	*/
+/*	$NetBSD: prng.c,v 1.5 2021/05/04 21:13:38 khorben Exp $	*/
 
 /*
  * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -84,6 +84,7 @@ prng_get_entropy_file(SHA512_CTX *ctx)
 	uint8_t digest[SHA1_DIGEST_LENGTH];
 	rndsave_t *rndsave;
 	SHA1_CTX sig;
+	size_t count = 0;
 
 	biml =
 	(struct btinfo_modulelist *)prng_lookup_bootinfo(BTINFO_MODULELIST);
@@ -117,7 +118,10 @@ prng_get_entropy_file(SHA512_CTX *ctx)
 		}
 
 		SHA512_Update(ctx, rndsave->data, sizeof(rndsave->data));
+		count++;
 	}
+	if (count == 0)
+		print_state(STATE_WARNING, "No entropy file could be loaded");
 }
 
 /*
@@ -168,6 +172,8 @@ prng_init(void)
 		cpuid(0x01, 0x00, descs);
 		has_rdrand = (descs[2] & CPUID2_RDRAND) != 0;
 	}
+	if (!has_rdseed && !has_rdrand)
+		print_state(STATE_WARNING, "No CPU entropy feature detected");
 
 	SHA512_Init();
 	prng_get_entropy_file();



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

2021-05-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May  4 21:10:25 UTC 2021

Modified Files:
src/sys/arch/amd64/stand/prekern: prng.c

Log Message:
prekern: do not choke on bad entropy files

As submitted on port-amd64@ (part 2/3)

Tested on NetBSD/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/stand/prekern/prng.c

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

Modified files:

Index: src/sys/arch/amd64/stand/prekern/prng.c
diff -u src/sys/arch/amd64/stand/prekern/prng.c:1.3 src/sys/arch/amd64/stand/prekern/prng.c:1.4
--- src/sys/arch/amd64/stand/prekern/prng.c:1.3	Thu May 21 08:20:25 2020
+++ src/sys/arch/amd64/stand/prekern/prng.c	Tue May  4 21:10:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: prng.c,v 1.3 2020/05/21 08:20:25 maxv Exp $	*/
+/*	$NetBSD: prng.c,v 1.4 2021/05/04 21:10:25 khorben Exp $	*/
 
 /*
  * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -98,7 +98,9 @@ prng_get_entropy_file(SHA512_CTX *ctx)
 			continue;
 		}
 		if (bi->len != sizeof(rndsave_t)) {
-			fatal("rndsave_t size mismatch");
+			print_state(STATE_WARNING,
+	"size mismatch in entropy file");
+			continue;
 		}
 		rndsave = (rndsave_t *)(vaddr_t)bi->base;
 
@@ -109,7 +111,9 @@ prng_get_entropy_file(SHA512_CTX *ctx)
 		SHA1Update(, rndsave->data, sizeof(rndsave->data));
 		SHA1Final(digest, );
 		if (memcmp(digest, rndsave->digest, sizeof(digest))) {
-			fatal("bad SHA1 checksum");
+			print_state(STATE_WARNING,
+	"bad SHA1 checksum in entropy file");
+			continue;
 		}
 
 		SHA512_Update(ctx, rndsave->data, sizeof(rndsave->data));



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

2021-05-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May  4 21:09:16 UTC 2021

Modified Files:
src/sys/arch/amd64/stand/prekern: console.c elf.c mm.c prekern.c
prekern.h

Log Message:
prekern: add support for warning messages

As submitted on port-amd64@ (part 1/3)

Tested on NetBSD/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/stand/prekern/console.c
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/stand/prekern/elf.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amd64/stand/prekern/prekern.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/amd64/stand/prekern/prekern.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/stand/prekern/console.c
diff -u src/sys/arch/amd64/stand/prekern/console.c:1.6 src/sys/arch/amd64/stand/prekern/console.c:1.7
--- src/sys/arch/amd64/stand/prekern/console.c:1.6	Sat May 23 08:25:32 2020
+++ src/sys/arch/amd64/stand/prekern/console.c	Tue May  4 21:09:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: console.c,v 1.6 2020/05/23 08:25:32 maxv Exp $	*/
+/*	$NetBSD: console.c,v 1.7 2021/05/04 21:09:16 khorben Exp $	*/
 
 /*
  * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -100,13 +100,24 @@ void print(char *buf)
 	print_ext(WHITE_ON_BLACK, buf);
 }
 
-void print_state(bool ok, char *buf)
+void print_state(state_t state, char *buf)
 {
 	print("[");
-	if (ok)
-		print_ext(GREEN_ON_BLACK, "+");
-	else
-		print_ext(RED_ON_BLACK, "!");
+	switch (state)
+	{
+		case STATE_NORMAL:
+			print_ext(GREEN_ON_BLACK, "+");
+			break;
+		case STATE_ERROR:
+			print_ext(RED_ON_BLACK, "!");
+			break;
+		case STATE_WARNING:
+			print_ext(YELLOW_ON_BLACK, "*");
+			break;
+		default:
+			print_ext(WHITE_ON_BLACK, "?");
+			break;
+	}
 	print("] ");
 	print(buf);
 	print("\n");

Index: src/sys/arch/amd64/stand/prekern/elf.c
diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.21 src/sys/arch/amd64/stand/prekern/elf.c:1.22
--- src/sys/arch/amd64/stand/prekern/elf.c:1.21	Thu May  7 17:58:26 2020
+++ src/sys/arch/amd64/stand/prekern/elf.c	Tue May  4 21:09:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf.c,v 1.21 2020/05/07 17:58:26 maxv Exp $	*/
+/*	$NetBSD: elf.c,v 1.22 2021/05/04 21:09:16 khorben Exp $	*/
 
 /*
  * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -426,7 +426,7 @@ elf_kernel_reloc(void)
 	Elf_Sym *sym;
 	size_t i, j;
 
-	print_state(true, "ELF info created");
+	print_state(STATE_NORMAL, "ELF info created");
 
 	/*
 	 * Update all symbol values with the appropriate offset.
@@ -447,7 +447,7 @@ elf_kernel_reloc(void)
 		}
 	}
 
-	print_state(true, "Symbol values updated");
+	print_state(STATE_NORMAL, "Symbol values updated");
 
 	/*
 	 * Perform relocations without addend if there are any.
@@ -482,7 +482,7 @@ elf_kernel_reloc(void)
 		}
 	}
 
-	print_state(true, "REL relocations applied");
+	print_state(STATE_NORMAL, "REL relocations applied");
 
 	/*
 	 * Perform relocations with addend if there are any.
@@ -517,7 +517,7 @@ elf_kernel_reloc(void)
 		}
 	}
 
-	print_state(true, "RELA relocations applied");
+	print_state(STATE_NORMAL, "RELA relocations applied");
 
 	/*
 	 * Get the entry point.
@@ -527,7 +527,7 @@ elf_kernel_reloc(void)
 		fatal("elf_kernel_reloc: entry point not found");
 	}
 
-	print_state(true, "Entry point found");
+	print_state(STATE_NORMAL, "Entry point found");
 
 	return ent;
 }

Index: src/sys/arch/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.27 src/sys/arch/amd64/stand/prekern/mm.c:1.28
--- src/sys/arch/amd64/stand/prekern/mm.c:1.27	Thu May  7 17:58:26 2020
+++ src/sys/arch/amd64/stand/prekern/mm.c	Tue May  4 21:09:16 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.27 2020/05/07 17:58:26 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.28 2021/05/04 21:09:16 khorben Exp $	*/
 
 /*
  * Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -148,7 +148,7 @@ mm_bootspace_mprotect(void)
 		mm_mprotect(bootspace.segs[i].va, bootspace.segs[i].sz, prot);
 	}
 
-	print_state(true, "Segments protection updated");
+	print_state(STATE_NORMAL, "Segments protection updated");
 }
 
 static size_t
@@ -493,9 +493,9 @@ mm_map_kernel(void)
 {
 	memset(, 0, sizeof(bootspace));
 	mm_map_head();
-	print_state(true, "Head region mapped");
+	print_state(STATE_NORMAL, "Head region mapped");
 	elf_map_sections();
-	print_state(true, "Segments mapped");
+	print_state(STATE_NORMAL, "Segments mapped");
 	mm_map_boot();
-	print_state(true, "Boot region mapped");
+	print_state(STATE_NORMAL, "Boot region mapped");
 }

Index: src/sys/arch/amd64/stand/prekern/prekern.c
diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.13 src/sys/arch/amd64/stand/prekern/prekern.c:1.14
--- src/sys/arch/amd64/stand/prekern/prekern.c:1.13	Sat May 23 08:25:32 2020
+++ src/sys/arch/amd64/stand/prekern/prekern.c	Tue May  4 

CVS commit: src/external/bsd/pam-u2f

2020-11-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Nov  4 13:46:46 UTC 2020

Modified Files:
src/external/bsd/pam-u2f/bin/pamu2fcfg: Makefile
src/external/bsd/pam-u2f/lib/security/pam-u2f: Makefile

Log Message:
PR/55747: Tobias Nygren: Install manpages for pam-u2f

I have added a Makefile rule, indicating how to generate the manual
pages again. It has no dependency on the original file, in order to
avoid issues when building: the generation depends in asciidoc and
libxslt, which are not in tools or in the base tree anyway. It should
therefore never trigger, but should be used by the maintainer when
updating pam-u2f.

With this, I believe this PR can be closed.

Tested with "build.sh release" on amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
cvs rdiff -u -r1.4 -r1.5 \
src/external/bsd/pam-u2f/lib/security/pam-u2f/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/bsd/pam-u2f/bin/pamu2fcfg/Makefile
diff -u src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.3 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.4
--- src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.3	Mon Nov  2 06:40:11 2020
+++ src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Wed Nov  4 13:46:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2020/11/02 06:40:11 khorben Exp $
+# $NetBSD: Makefile,v 1.4 2020/11/04 13:46:46 khorben Exp $
 
 .include 
 
@@ -22,4 +22,9 @@ COPTS.util.c += -Wno-error=stack-protect
 LDADD+=-lpam -lfido2 -lcbor -lusbhid -lcrypto -lm
 DPADD+=${LIBPAM} ${LIBFIDO2} ${LIBCBOR} ${LIBUSBHID} ${LIBCRYPTO} ${LIBM}
 
+pamu2fcfg.1:
+	asciidoc -b docbook45 -d manpage -o pamu2fcfg.1.xml ../../dist/man/pamu2fcfg.1.txt
+	xsltproc --nonet --xinclude -o pamu2fcfg.1 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' pamu2fcfg.1.xml
+	rm -f pamu2fcfg.1.xml
+
 .include 

Index: src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile
diff -u src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.4 src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.5
--- src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile:1.4	Mon Nov  2 06:40:11 2020
+++ src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile	Wed Nov  4 13:46:46 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.4 2020/11/02 06:40:11 khorben Exp $
+# $NetBSD: Makefile,v 1.5 2020/11/04 13:46:46 khorben Exp $
 
 .include 
 .PATH: ${NETBSDSRCDIR}/external/bsd/pam-u2f/dist
@@ -18,4 +18,9 @@ LIBDPLIBS+= \
 	crypto	${NETBSDSRCDIR}/crypto/external/bsd/${EXTERNAL_OPENSSL_SUBDIR}/lib/libcrypto \
 	m	${NETBSDSRCDIR}/lib/libm
 
+pam_u2f.8:
+	asciidoc -b docbook45 -d manpage -o pam_u2f.8.xml ../../../dist/man/pam_u2f.8.txt
+	xsltproc --nonet --xinclude -o pam_u2f.8 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' pam_u2f.8.xml
+	rm -f pam_u2f.8.xml
+
 .include "${NETBSDSRCDIR}/lib/libpam/modules/mod.mk"



CVS commit: src

2020-11-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Nov  2 06:40:11 UTC 2020

Modified Files:
src/distrib/sets/lists/man: mi
src/external/bsd/pam-u2f/bin/pamu2fcfg: Makefile
src/external/bsd/pam-u2f/lib/security/pam-u2f: Makefile
Added Files:
src/external/bsd/pam-u2f/bin/pamu2fcfg: pamu2fcfg.1
src/external/bsd/pam-u2f/lib/security/pam-u2f: pam_u2f.8

Log Message:
PR/55747: Tobias Nygren: Install manpages for pam-u2f

I have generated the manual pages and referenced them into the sets.
It would probably help to add a Makefile rule, indicating how to
generate the manual pages again.

Tested with "build.sh release" on amd64.

Reviewed by Tobias Nygren before the commit.


To generate a diff of this commit:
cvs rdiff -u -r1.1707 -r1.1708 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
cvs rdiff -u -r0 -r1.1 src/external/bsd/pam-u2f/bin/pamu2fcfg/pamu2fcfg.1
cvs rdiff -u -r1.3 -r1.4 \
src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile
cvs rdiff -u -r0 -r1.1 \
src/external/bsd/pam-u2f/lib/security/pam-u2f/pam_u2f.8

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1707 src/distrib/sets/lists/man/mi:1.1708
--- src/distrib/sets/lists/man/mi:1.1707	Tue Oct 27 08:57:10 2020
+++ src/distrib/sets/lists/man/mi	Mon Nov  2 06:40:11 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1707 2020/10/27 08:57:10 ryo Exp $
+# $NetBSD: mi,v 1.1708 2020/11/02 06:40:11 khorben Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -421,6 +421,7 @@
 ./usr/share/man/cat1/openssl_x509v3_config.0	man-obsolete		obsolete
 ./usr/share/man/cat1/page.0			man-util-catman		.cat
 ./usr/share/man/cat1/pagesize.0			man-util-catman		.cat
+./usr/share/man/cat1/pamu2fcfg.0		man-util-catman		.cat
 ./usr/share/man/cat1/passwd.0			man-util-catman		.cat
 ./usr/share/man/cat1/paste.0			man-util-catman		.cat
 ./usr/share/man/cat1/patch.0			man-util-catman		.cat
@@ -2940,6 +2941,7 @@
 ./usr/share/man/cat8/pam_self.0			man-sysutil-catman	pam,.cat
 ./usr/share/man/cat8/pam_skey.0			man-sysutil-catman	skey,pam,.cat
 ./usr/share/man/cat8/pam_ssh.0			man-sysutil-catman	pam,.cat
+./usr/share/man/cat8/pam_u2f.0			man-sysutil-catman	pam,.cat
 ./usr/share/man/cat8/pam_unix.0			man-sysutil-catman	pam,.cat
 ./usr/share/man/cat8/paxctl.0			man-sysutil-catman	.cat
 ./usr/share/man/cat8/pc532/MAKEDEV.0		man-obsolete		obsolete
@@ -3707,6 +3709,7 @@
 ./usr/share/man/html1/openssl_x509v3_config.html	man-obsolete	obsolete
 ./usr/share/man/html1/page.html			man-util-htmlman	html
 ./usr/share/man/html1/pagesize.html		man-util-htmlman	html
+./usr/share/man/html1/pamu2fcfg.html		man-util-htmlman	html
 ./usr/share/man/html1/passwd.html		man-util-htmlman	html
 ./usr/share/man/html1/paste.html		man-util-htmlman	html
 ./usr/share/man/html1/patch.html		man-util-htmlman	html
@@ -5933,6 +5936,7 @@
 ./usr/share/man/html8/pam_self.html		man-sysutil-htmlman	pam,html
 ./usr/share/man/html8/pam_skey.html		man-sysutil-htmlman	skey,pam,html
 ./usr/share/man/html8/pam_ssh.html		man-sysutil-htmlman	pam,html
+./usr/share/man/html8/pam_u2f.html		man-sysutil-htmlman	pam,html
 ./usr/share/man/html8/pam_unix.html		man-sysutil-htmlman	pam,html
 ./usr/share/man/html8/paxctl.html		man-sysutil-htmlman	html
 ./usr/share/man/html8/pcictl.html		man-sysutil-htmlman	html
@@ -6635,6 +6639,7 @@
 ./usr/share/man/man1/openssl_x509v3_config.1	man-obsolete		obsolete
 ./usr/share/man/man1/page.1			man-util-man		.man
 ./usr/share/man/man1/pagesize.1			man-util-man		.man
+./usr/share/man/man1/pamu2fcfg.1		man-util-man		.man
 ./usr/share/man/man1/passwd.1			man-util-man		.man
 ./usr/share/man/man1/paste.1			man-util-man		.man
 ./usr/share/man/man1/patch.1			man-util-man		.man
@@ -9154,6 +9159,7 @@
 ./usr/share/man/man8/pam_self.8			man-sysutil-man		.man,pam
 ./usr/share/man/man8/pam_skey.8			man-sysutil-man		skey,.man,pam
 ./usr/share/man/man8/pam_ssh.8			man-sysutil-man		.man,pam
+./usr/share/man/man8/pam_u2f.8			man-sysutil-man		.man,pam
 ./usr/share/man/man8/pam_unix.8			man-sysutil-man		.man,pam
 ./usr/share/man/man8/paxctl.8			man-sysutil-man		.man
 ./usr/share/man/man8/pc532/MAKEDEV.8		man-obsolete		obsolete

Index: src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile
diff -u src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.2 src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.3
--- src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile:1.2	Wed Mar  4 17:32:27 2020
+++ src/external/bsd/pam-u2f/bin/pamu2fcfg/Makefile	Mon Nov  2 06:40:11 2020
@@ -1,6 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2020/03/04 17:32:27 christos Exp $
-
-NOMAN=
+# $NetBSD: Makefile,v 1.3 2020/11/02 06:40:11 khorben Exp $
 
 .include 
 

Index: src/external/bsd/pam-u2f/lib/security/pam-u2f/Makefile
diff -u 

CVS commit: src/share/man/man4

2020-11-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Nov  1 06:19:47 UTC 2020

Modified Files:
src/share/man/man4: u3g.4

Log Message:
u3g(4): also list the Huawei EM770W as supported


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/share/man/man4/u3g.4

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/man4/u3g.4
diff -u src/share/man/man4/u3g.4:1.9 src/share/man/man4/u3g.4:1.10
--- src/share/man/man4/u3g.4:1.9	Sun Oct  8 03:39:50 2017
+++ src/share/man/man4/u3g.4	Sun Nov  1 06:19:47 2020
@@ -1,4 +1,4 @@
-.\" $NetBSD: u3g.4,v 1.9 2017/10/08 03:39:50 sevan Exp $
+.\" $NetBSD: u3g.4,v 1.10 2020/11/01 06:19:47 khorben Exp $
 .\"
 .\" Copyright (c) 2008 AnyWi Technologies
 .\" All rights reserved.
@@ -60,6 +60,8 @@ Huawei E171
 .It
 Huawei E220 (E270?)
 .It
+Huawei EM770W
+.It
 Huawei Mobile
 .It
 Novatel MC950D



CVS commit: src/sbin/umbctl

2020-05-13 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed May 13 21:44:30 UTC 2020

Modified Files:
src/sbin/umbctl: umbctl.c

Log Message:
Fix and improve parsing of configuration files

XXX pull-up to netbsd-9


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sbin/umbctl/umbctl.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/umbctl/umbctl.c
diff -u src/sbin/umbctl/umbctl.c:1.3 src/sbin/umbctl/umbctl.c:1.4
--- src/sbin/umbctl/umbctl.c:1.3	Sun Mar 22 07:45:02 2020
+++ src/sbin/umbctl/umbctl.c	Wed May 13 21:44:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: umbctl.c,v 1.3 2020/03/22 07:45:02 khorben Exp $ */
+/* $NetBSD: umbctl.c,v 1.4 2020/05/13 21:44:30 khorben Exp $ */
 /*
  * Copyright (c) 2018 Pierre Pronchery 
  *
@@ -179,12 +179,15 @@ static int _umbctl(char const * ifname, 
 /* umbctl_file */
 static int _umbctl_file(char const * ifname, char const * filename, int verbose)
 {
+	int ret = 0;
 	int fd;
 	struct ifreq ifr;
 	struct umb_info umbi;
 	struct umb_parameter umbp;
 	FILE * fp;
 	char buf[512];
+	size_t len;
+	int i;
 	int eof;
 	char * tokens[3] = { buf, NULL, NULL };
 	char * p;
@@ -197,18 +200,32 @@ static int _umbctl_file(char const * ifn
 		if(buf[0] == '#')
 			continue;
 		buf[sizeof(buf) - 1] = '\0';
-		if((p = strstr(buf, "=")) != NULL)
+		if((len = strlen(buf)) > 0)
+		{
+			if(buf[len - 1] != '\n')
+			{
+ret = _error(2, "%s: %s", filename,
+		"Line too long");
+while((i = fgetc(fp)) != EOF && i != '\n');
+continue;
+			}
+			else
+buf[len - 1] = '\0';
+		}
+		if((p = strchr(buf, '=')) != NULL)
 		{
 			tokens[1] = p + 1;
 			*p = '\0';
 		} else
 			tokens[1] = NULL;
-		if(_umbctl_set(ifname, , (p != NULL) ? 2 : 1, tokens) != 0)
-			break;
+		ret |= _umbctl_set(ifname, , (p != NULL) ? 2 : 1, tokens)
+			? 2 : 0;
 	}
 	eof = feof(fp);
 	if(fclose(fp) != 0 || !eof)
 		return _error(2, "%s: %s", filename, strerror(errno));
+	if(ret != 0)
+		return ret;
 	if((fd = _umbctl_socket()) < 0)
 		return 2;
 	memset(, 0, sizeof(ifr));



CVS commit: src/sbin/umbctl

2020-03-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Mar 22 07:45:03 UTC 2020

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

Log Message:
Forbid command line parameters when parsing configuration files

This behaviour was ambiguous at best.
While there, also correct the usage screen, and the corresponding manual
page.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sbin/umbctl/umbctl.8 src/sbin/umbctl/umbctl.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/umbctl/umbctl.8
diff -u src/sbin/umbctl/umbctl.8:1.2 src/sbin/umbctl/umbctl.8:1.3
--- src/sbin/umbctl/umbctl.8:1.2	Wed Aug  1 17:26:30 2018
+++ src/sbin/umbctl/umbctl.8	Sun Mar 22 07:45:02 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: umbctl.8,v 1.2 2018/08/01 17:26:30 wiz Exp $
+.\"	$NetBSD: umbctl.8,v 1.3 2020/03/22 07:45:02 khorben Exp $
 .\"
 .\" Copyright (c) 2018 by Pierre Pronchery 
 .\" All rights reserved.
@@ -26,11 +26,11 @@
 .\"
 .\" From: pppoectl.8,v 1.30 2016/09/12 05:35:20 sevan Exp $
 .\"
-.\" $Id: umbctl.8,v 1.2 2018/08/01 17:26:30 wiz Exp $
+.\" $Id: umbctl.8,v 1.3 2020/03/22 07:45:02 khorben Exp $
 .\"
 .\" last edit-date: [Thu Aug 31 10:47:33 2000]
 .\"
-.Dd July 24, 2018
+.Dd March 22, 2020
 .Dt UMBCTL 8
 .Os
 .Sh NAME
@@ -40,15 +40,13 @@
 .Nm umbctl
 .Op Fl v
 .Ar ifname
-.Op Ar parameter Ns Op \&= Ns Ar value
+.Op Ar parameter Op Ar value
 .Op Ar ...
 .Pp
 .Nm umbctl
 .Op Fl v
-.Op Fl f Ar config-file
+.Fl f Ar config-file
 .Ar ifname
-.Op Ar parameter Ns Op \&= Ns Ar value
-.Op Ar ...
 .Sh DESCRIPTION
 .Nm
 supports the following options:
Index: src/sbin/umbctl/umbctl.c
diff -u src/sbin/umbctl/umbctl.c:1.2 src/sbin/umbctl/umbctl.c:1.3
--- src/sbin/umbctl/umbctl.c:1.2	Thu Aug  2 03:40:51 2018
+++ src/sbin/umbctl/umbctl.c	Sun Mar 22 07:45:02 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: umbctl.c,v 1.2 2018/08/02 03:40:51 roy Exp $ */
+/* $NetBSD: umbctl.c,v 1.3 2020/03/22 07:45:02 khorben Exp $ */
 /*
  * Copyright (c) 2018 Pierre Pronchery 
  *
@@ -80,8 +80,8 @@ static const struct umb_valdescr _umb_be
 static int _char_to_utf16(const char * in, uint16_t * out, size_t outlen);
 static int _error(int ret, char const * format, ...);
 static int _umbctl(char const * ifname, int verbose, int argc, char * argv[]);
-static int _umbctl_file(char const * ifname, char const * filename, int verbose,
-		int argc, char * argv[]);
+static int _umbctl_file(char const * ifname, char const * filename,
+		int verbose);
 static void _umbctl_info(char const * ifname, struct umb_info * umbi);
 static int _umbctl_ioctl(char const * ifname, int fd, unsigned long request,
 		struct ifreq * ifr);
@@ -177,8 +177,7 @@ static int _umbctl(char const * ifname, 
 
 
 /* umbctl_file */
-static int _umbctl_file(char const * ifname, char const * filename, int verbose,
-		int argc, char * argv[])
+static int _umbctl_file(char const * ifname, char const * filename, int verbose)
 {
 	int fd;
 	struct ifreq ifr;
@@ -216,7 +215,6 @@ static int _umbctl_file(char const * ifn
 	strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
 	ifr.ifr_data = 
 	if(_umbctl_ioctl(ifname, fd, SIOCGUMBPARAM, ) != 0
-			|| _umbctl_set(ifname, , argc, argv) != 0
 			|| _umbctl_ioctl(ifname, fd, SIOCSUMBPARAM, ) != 0)
 	{
 		close(fd);
@@ -427,7 +425,7 @@ static int _umbctl_socket(void)
 /* usage */
 static int _usage(void)
 {
-	fputs("Usage: umbctl [-v] ifname [parameter[=value]] [...]\n"
+	fputs("Usage: umbctl [-v] ifname [parameter [value]] [...]\n"
 "   umbctl -f config-file ifname [...]\n",
 			stderr);
 	return 1;
@@ -475,8 +473,11 @@ int main(int argc, char * argv[])
 	if(optind == argc)
 		return _usage();
 	if(filename != NULL)
-		return _umbctl_file(argv[optind], filename, verbose,
-argc - optind - 1, [optind + 1]);
+	{
+		if(optind + 1 != argc)
+			return _usage();
+		return _umbctl_file(argv[optind], filename, verbose);
+	}
 	return _umbctl(argv[optind], verbose, argc - optind - 1,
 			[optind + 1]);
 }



CVS commit: src/sys/dev/usb

2020-03-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Mar 19 07:51:22 UTC 2020

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

Log Message:
Only set the IPv4 address in umb(4) if both MBIM_IPCONF_HAS_ADDRINFO and
MBIM_IPCONF_HAS_GWINFO are available. Configuring umb(4) without gateway
wont work the system needs a destination address for the interface.
Problem found by jsg@.
OK jsg@ deraadt@

>From OpenBSD.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.16 src/sys/dev/usb/if_umb.c:1.17
--- src/sys/dev/usb/if_umb.c:1.16	Thu Mar 19 07:50:27 2020
+++ src/sys/dev/usb/if_umb.c	Thu Mar 19 07:51:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.16 2020/03/19 07:50:27 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.17 2020/03/19 07:51:22 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.16 2020/03/19 07:50:27 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.17 2020/03/19 07:51:22 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1714,7 +1714,8 @@ umb_decode_ip_configuration(struct umb_s
 	 * IPv4 configuration
 	 */
 	avail = le32toh(ic->ipv4_available);
-	if (avail & MBIM_IPCONF_HAS_ADDRINFO) {
+	if ((avail & (MBIM_IPCONF_HAS_ADDRINFO | MBIM_IPCONF_HAS_GWINFO)) ==
+	(MBIM_IPCONF_HAS_ADDRINFO | MBIM_IPCONF_HAS_GWINFO)) {
 		n = le32toh(ic->ipv4_naddr);
 		off = le32toh(ic->ipv4_addroffs);
 
@@ -1734,10 +1735,8 @@ umb_decode_ip_configuration(struct umb_s
 		sin = (struct sockaddr_in *)_dstaddr;
 		sin->sin_family = AF_INET;
 		sin->sin_len = sizeof(ifra.ifra_dstaddr);
-		if (avail & MBIM_IPCONF_HAS_GWINFO) {
-			off = le32toh(ic->ipv4_gwoffs);
-			sin->sin_addr.s_addr = *((uint32_t *)((char *)data + off));
-		}
+		off = le32toh(ic->ipv4_gwoffs);
+		sin->sin_addr.s_addr = *((uint32_t *)((char *)data + off));
 
 		sin = (struct sockaddr_in *)_mask;
 		sin->sin_family = AF_INET;



CVS commit: src/sys/dev/usb

2020-03-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Mar 19 07:50:27 UTC 2020

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

Log Message:
turn the success paths of FCC registration into debug prints. The
(unlikely) failure path remains noisy.
discussed with claudio

>From OpenBSD.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.15 src/sys/dev/usb/if_umb.c:1.16
--- src/sys/dev/usb/if_umb.c:1.15	Thu Mar 19 07:49:29 2020
+++ src/sys/dev/usb/if_umb.c	Thu Mar 19 07:50:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.15 2020/03/19 07:49:29 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.16 2020/03/19 07:50:27 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.15 2020/03/19 07:49:29 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.16 2020/03/19 07:50:27 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2569,11 +2569,11 @@ umb_decode_qmi(struct umb_softc *sc, uin
 break;
 			case 0x555f:	/* Send FCC Authentication */
 if (val == 0)
-	log(LOG_INFO, "%s: send FCC "
+	DPRINTF("%s: send FCC "
 	"Authentication succeeded\n",
 	DEVNAM(sc));
 else if (val == 0x001a0001)
-	log(LOG_INFO, "%s: FCC Authentication "
+	DPRINTF("%s: FCC Authentication "
 	"not required\n", DEVNAM(sc));
 else
 	log(LOG_INFO, "%s: send FCC "



CVS commit: src/sys/dev/usb

2020-03-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Mar 19 07:49:29 UTC 2020

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

Log Message:
When there is no network around the state timeout fires over and over again.
Change the printf into a log and only under IFF_DEBUG to reduce dmesg spam.
Loudly requested by beck@ OK deraadt@

>From OpenBSD.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.14 src/sys/dev/usb/if_umb.c:1.15
--- src/sys/dev/usb/if_umb.c:1.14	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/if_umb.c	Thu Mar 19 07:49:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.14 2020/03/14 02:35:33 christos Exp $ */
+/*	$NetBSD: if_umb.c,v 1.15 2020/03/19 07:49:29 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.14 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.15 2020/03/19 07:49:29 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -948,9 +948,12 @@ Static void
 umb_statechg_timeout(void *arg)
 {
 	struct umb_softc *sc = arg;
+	struct ifnet *ifp = GET_IFP(sc);
 
 	if (sc->sc_info.regstate != MBIM_REGSTATE_ROAMING || sc->sc_roaming)
-		printf("%s: state change timeout\n",DEVNAM(sc));
+		if (ifp->if_flags & IFF_DEBUG)
+			log(LOG_DEBUG, "%s: state change timeout\n",
+			DEVNAM(sc));
 	usb_add_task(sc->sc_udev, >sc_umb_task, USB_TASKQ_DRIVER);
 }
 



CVS commit: src/sys/dev

2019-02-28 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Feb 28 16:56:35 UTC 2019

Modified Files:
src/sys/dev/i2c: sdtemp.c
src/sys/dev/pci: if_wm.c if_wmreg.h pci_subr.c

Log Message:
Typo (s/vaule/value/)


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/i2c/sdtemp.c
cvs rdiff -u -r1.628 -r1.629 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.112 -r1.113 src/sys/dev/pci/if_wmreg.h
cvs rdiff -u -r1.210 -r1.211 src/sys/dev/pci/pci_subr.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/sdtemp.c
diff -u src/sys/dev/i2c/sdtemp.c:1.34 src/sys/dev/i2c/sdtemp.c:1.35
--- src/sys/dev/i2c/sdtemp.c:1.34	Sat Jun 16 21:22:13 2018
+++ src/sys/dev/i2c/sdtemp.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: sdtemp.c,v 1.34 2018/06/16 21:22:13 thorpej Exp $*/
+/*  $NetBSD: sdtemp.c,v 1.35 2019/02/28 16:56:35 khorben Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.34 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.35 2019/02/28 16:56:35 khorben Exp $");
 
 #include 
 #include 
@@ -297,7 +297,7 @@ sdtemp_attach(device_t parent, device_t 
 	 * IDT's devices and some Microchip's devices have the resolution
 	 * register in the vendor specific registers area. The devices'
 	 * resolution bits in the capability register are not the maximum
-	 * resolution but the current vaule of the setting.
+	 * resolution but the current value of the setting.
 	 */
 	if (sdtemp_dev_table[i].sdtemp_config != NULL)
 		sdtemp_dev_table[i].sdtemp_config(sc);

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.628 src/sys/dev/pci/if_wm.c:1.629
--- src/sys/dev/pci/if_wm.c:1.628	Sat Feb 23 11:41:08 2019
+++ src/sys/dev/pci/if_wm.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.628 2019/02/23 11:41:08 kamil Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.629 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -82,7 +82,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.628 2019/02/23 11:41:08 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.629 2019/02/28 16:56:35 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -13482,7 +13482,7 @@ wm_nvm_version(struct wm_softc *sc)
 	 *	82572EI	0x5069	5.6.9?
 	 *	82574L	0x1080	1.8.0?	(the spec update notes about 2.1.4)
 	 *		0x2013	2.1.3?
-	 *	82583	0x10a0	1.10.0? (document says it's default vaule)
+	 *	82583	0x10a0	1.10.0? (document says it's default value)
 	 */
 
 	/*

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.112 src/sys/dev/pci/if_wmreg.h:1.113
--- src/sys/dev/pci/if_wmreg.h:1.112	Thu Jan 31 05:20:49 2019
+++ src/sys/dev/pci/if_wmreg.h	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.112 2019/01/31 05:20:49 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.113 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -1493,7 +1493,7 @@ struct livengood_tcpip_ctxdesc {
 #define WM_INVM_DATA_REG(reg)	(0x12120 + 4*(reg))
 #define INVM_SIZE			64 /* Number of INVM Data Registers */
 
-/* iNVM default vaule */
+/* iNVM default value */
 #define NVM_INIT_CTRL_2_DEFAULT_I211	0x7243
 #define NVM_INIT_CTRL_4_DEFAULT_I211	0x00c1
 #define NVM_LED_1_CFG_DEFAULT_I211	0x0184

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.210 src/sys/dev/pci/pci_subr.c:1.211
--- src/sys/dev/pci/pci_subr.c:1.210	Fri Nov 30 10:18:37 2018
+++ src/sys/dev/pci/pci_subr.c	Thu Feb 28 16:56:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.210 2018/11/30 10:18:37 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.211 2019/02/28 16:56:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.210 2018/11/30 10:18:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.211 2019/02/28 16:56:35 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3726,7 +3726,7 @@ pci_conf_print_tph_req_cap(const pcireg_
 		printf("Device Specific Mode\n");
 		break;
 	default:
-		printf("(reserved vaule)\n");
+		printf("(reserved value)\n");
 		break;
 	}
 	printf("  TPH Requester Enable: ");
@@ -3741,7 +3741,7 @@ pci_conf_print_tph_req_cap(const pcireg_
 		printf("TPH and Extended TPH");
 		break;
 	default:
-		printf("(reserved vaule)\n");
+		printf("(reserved value)\n");
 		break;
 	}
 



CVS commit: src/sys/dev/usb

2018-09-20 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Sep 20 09:48:54 UTC 2018

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

Log Message:
Prevent a panic in umb(4) when roaming is disabled

>From OpenBSD.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.5 src/sys/dev/usb/if_umb.c:1.6
--- src/sys/dev/usb/if_umb.c:1.5	Thu Sep 20 09:45:16 2018
+++ src/sys/dev/usb/if_umb.c	Thu Sep 20 09:48:54 2018
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_umb.c,v 1.5 2018/09/20 09:45:16 khorben Exp $ */
-/*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
+/*	$NetBSD: if_umb.c,v 1.6 2018/09/20 09:48:54 khorben Exp $ */
+/*	$OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
  * Copyright (c) 2016 genua mbH
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.5 2018/09/20 09:45:16 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.6 2018/09/20 09:48:54 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -944,13 +944,7 @@ umb_statechg_timeout(void *arg)
 {
 	struct umb_softc *sc = arg;
 
-	if (sc->sc_info.regstate == MBIM_REGSTATE_ROAMING && !sc->sc_roaming) {
-		/*
-		 * Query the registration state until we're with the home
-		 * network again.
-		 */
-		umb_cmd(sc, MBIM_CID_REGISTER_STATE, MBIM_CMDOP_QRY, NULL, 0);
-	} else
+	if (sc->sc_info.regstate != MBIM_REGSTATE_ROAMING || sc->sc_roaming)
 		printf("%s: state change timeout\n",DEVNAM(sc));
 	usb_add_task(sc->sc_udev, >sc_umb_task, USB_TASKQ_DRIVER);
 }
@@ -1004,6 +998,15 @@ umb_state_task(void *arg)
 	int	 s;
 	int	 state;
 
+	if (sc->sc_info.regstate == MBIM_REGSTATE_ROAMING && !sc->sc_roaming) {
+		/*
+		 * Query the registration state until we're with the home
+		 * network again.
+		 */
+		umb_cmd(sc, MBIM_CID_REGISTER_STATE, MBIM_CMDOP_QRY, NULL, 0);
+		return;
+	}
+
 	s = splnet();
 	if (ifp->if_flags & IFF_UP)
 		umb_up(sc);



CVS commit: src/sys/dev/usb

2018-09-20 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Sep 20 09:45:16 UTC 2018

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

Log Message:
Use usb_rem_task_wait() now that it is available

This should avoid panics while detaching devices.


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.4 src/sys/dev/usb/if_umb.c:1.5
--- src/sys/dev/usb/if_umb.c:1.4	Wed Aug  1 18:27:58 2018
+++ src/sys/dev/usb/if_umb.c	Thu Sep 20 09:45:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.5 2018/09/20 09:45:16 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.5 2018/09/20 09:45:16 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -91,10 +91,6 @@ Static void	 umb_dump(void *, int);
 
 #define DEVNAM(sc)		device_xname((sc)->sc_dev)
 
-#ifndef notyet
-#define usb_wait_task(dev, task)
-#endif
-
 /*
  * State change timeout
  */
@@ -584,13 +580,13 @@ umb_detach(device_t self, int flags)
 		umb_down(sc, 1);
 	umb_close(sc);
 
-	usb_rem_task(sc->sc_udev, >sc_get_response_task);
-	usb_wait_task(sc->sc_udev, >sc_get_response_task);
+	usb_rem_task_wait(sc->sc_udev, >sc_get_response_task,
+			USB_TASKQ_DRIVER, NULL);
 	sc->sc_nresp = 0;
 	if (sc->sc_rx_ep != -1 && sc->sc_tx_ep != -1) {
 		callout_destroy(>sc_statechg_timer);
-		usb_rem_task(sc->sc_udev, >sc_umb_task);
-		usb_wait_task(sc->sc_udev, >sc_umb_task);
+		usb_rem_task_wait(sc->sc_udev, >sc_umb_task,
+			USB_TASKQ_DRIVER, NULL);
 	}
 	if (sc->sc_ctrl_pipe) {
 		usbd_close_pipe(sc->sc_ctrl_pipe);



CVS commit: src/sys/arch

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 18:36:14 UTC 2018

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

Log Message:
Build the umb(4) driver in the ALL kernels (amd64, i386)

As suggested by Robert Swindells; thank you!


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.444 -r1.445 src/sys/arch/i386/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.95 src/sys/arch/amd64/conf/ALL:1.96
--- src/sys/arch/amd64/conf/ALL:1.95	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/amd64/conf/ALL	Wed Aug  1 18:36:13 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.95 2018/07/26 15:46:09 maxv Exp $
+# $NetBSD: ALL,v 1.96 2018/08/01 18:36:13 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.95 $"
+#ident		"ALL-$Revision: 1.96 $"
 
 maxusers	64		# estimated number of users
 
@@ -1222,6 +1222,7 @@ cue*	at uhub? port ?		# CATC USB-EL1201A
 kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
 #mos*	at uhub? port ?		# Moschip MCS7730/MCS7830/MCS7832 based adapters
 udav*	at uhub? port ?		# Davicom DM9601 based adapters
+umb*	at uhub? port ?		# Mobile Broadband Interface Model (EXPERIMENTAL)
 url*	at uhub? port ?		# Realtek RTL8150L based adapters
 urndis* at uhub? port ? 	# Microsoft RNDIS specification
 

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.444 src/sys/arch/i386/conf/ALL:1.445
--- src/sys/arch/i386/conf/ALL:1.444	Thu Jul 26 15:46:09 2018
+++ src/sys/arch/i386/conf/ALL	Wed Aug  1 18:36:14 2018
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.444 2018/07/26 15:46:09 maxv Exp $
+# $NetBSD: ALL,v 1.445 2018/08/01 18:36:14 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.444 $"
+#ident		"ALL-$Revision: 1.445 $"
 
 maxusers	64		# estimated number of users
 
@@ -1334,6 +1334,7 @@ cdce*	at uhub? port ?		# CDC, Ethernet N
 cue*	at uhub? port ?		# CATC USB-EL1201A based adapters
 kue*	at uhub? port ?		# Kawasaki LSI KL5KUSB101B based adapters
 udav*	at uhub? port ?		# Davicom DM9601 based adapters
+umb*	at uhub? port ?		# Mobile Broadband Interface Model (EXPERIMENTAL)
 url*	at uhub? port ?		# Realtek RTL8150L based adapters
 urndis* at uhub? port ?		# Microsoft RNDIS specification
 



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 18:27:58 UTC 2018

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

Log Message:
Fix building umb(4) on NetBSD-current

Patch by Robert Swindells; thank you!


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.3 src/sys/dev/usb/if_umb.c:1.4
--- src/sys/dev/usb/if_umb.c:1.3	Wed Aug  1 12:36:56 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 18:27:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.4 2018/08/01 18:27:58 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -923,7 +923,7 @@ umb_start(struct ifnet *ifp)
 	}
 	IFQ_DEQUEUE(>if_snd, m_head);
 
-	bpf_mtap(ifp, m_head);
+	bpf_mtap(ifp, m_head, BPF_D_OUT);
 
 	ifp->if_flags |= IFF_OACTIVE;
 	ifp->if_timer = (2 * umb_xfer_tout) / 1000;



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 12:36:56 UTC 2018

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

Log Message:
Allow kmem_alloc(9) to sleep when attaching

Without this, umb(4) may needlessly fail to attach, like when under memory
pressure.

Thanks skrll@ for the heads-up!


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.2 src/sys/dev/usb/if_umb.c:1.3
--- src/sys/dev/usb/if_umb.c:1.2	Wed Aug  1 12:25:50 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 12:36:56 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.3 2018/08/01 12:36:56 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -498,16 +498,9 @@ umb_attach(device_t parent, device_t sel
 		aprint_error_dev(self, "failed to open control pipe\n");
 		goto fail;
 	}
-	sc->sc_resp_buf = kmem_alloc(sc->sc_ctrl_len, KM_NOSLEEP);
-	if (sc->sc_resp_buf == NULL) {
-		aprint_error_dev(self, "allocation of resp buffer failed\n");
-		goto fail;
-	}
-	sc->sc_ctrl_msg = kmem_alloc(sc->sc_ctrl_len, KM_NOSLEEP);
-	if (sc->sc_ctrl_msg == NULL) {
-		aprint_error_dev(self, "allocation of ctrl msg buffer failed\n");
-		goto fail;
-	}
+
+	sc->sc_resp_buf = kmem_alloc(sc->sc_ctrl_len, KM_SLEEP);
+	sc->sc_ctrl_msg = kmem_alloc(sc->sc_ctrl_len, KM_SLEEP);
 
 	sc->sc_info.regstate = MBIM_REGSTATE_UNKNOWN;
 	sc->sc_info.pin_attempts_left = UMB_VALUE_UNKNOWN;



CVS commit: src/sys/dev/usb

2018-08-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Aug  1 12:25:50 UTC 2018

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

Log Message:
Avoid parentheses in return statements (KNF)

NFCI.

Thanks skrll@ for the heads-up!


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

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

Modified files:

Index: src/sys/dev/usb/if_umb.c
diff -u src/sys/dev/usb/if_umb.c:1.1 src/sys/dev/usb/if_umb.c:1.2
--- src/sys/dev/usb/if_umb.c:1.1	Tue Jul 31 16:44:29 2018
+++ src/sys/dev/usb/if_umb.c	Wed Aug  1 12:25:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_umb.c,v 1.1 2018/07/31 16:44:29 khorben Exp $ */
+/*	$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $ */
 /*	$OpenBSD: if_umb.c,v 1.18 2018/02/19 08:59:52 mpi Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.1 2018/07/31 16:44:29 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.2 2018/08/01 12:25:50 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2736,13 +2736,13 @@ inet_ntop(int af, const void *src, char 
 {
 	switch (af) {
 	case AF_INET:
-		return (inet_ntop4(src, dst, (size_t)size));
+		return inet_ntop4(src, dst, (size_t)size);
 #ifdef INET6
 	case AF_INET6:
-		return (inet_ntop6(src, dst, (size_t)size));
+		return inet_ntop6(src, dst, (size_t)size);
 #endif /* INET6 */
 	default:
-		return (NULL);
+		return NULL;
 	}
 	/* NOTREACHED */
 }
@@ -2767,10 +2767,10 @@ inet_ntop4(const u_char *src, char *dst,
 	l = snprintf(tmp, sizeof(tmp), "%u.%u.%u.%u",
 	src[0], src[1], src[2], src[3]);
 	if (l <= 0 || l >= size) {
-		return (NULL);
+		return NULL;
 	}
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 }
 
 #ifdef INET6
@@ -2843,7 +2843,7 @@ inet_ntop6(const u_char *src, char *dst,
 		i < (best.base + best.len)) {
 			if (i == best.base) {
 if (tp + 1 >= ep)
-	return (NULL);
+	return NULL;
 *tp++ = ':';
 			}
 			continue;
@@ -2851,39 +2851,39 @@ inet_ntop6(const u_char *src, char *dst,
 		/* Are we following an initial run of 0x00s or any real hex? */
 		if (i != 0) {
 			if (tp + 1 >= ep)
-return (NULL);
+return NULL;
 			*tp++ = ':';
 		}
 		/* Is this address an encapsulated IPv4? */
 		if (i == 6 && best.base == 0 &&
 		(best.len == 6 || (best.len == 5 && words[5] == 0x))) {
 			if (!inet_ntop4(src+12, tp, (size_t)(ep - tp)))
-return (NULL);
+return NULL;
 			tp += strlen(tp);
 			break;
 		}
 		advance = snprintf(tp, ep - tp, "%x", words[i]);
 		if (advance <= 0 || advance >= ep - tp)
-			return (NULL);
+			return NULL;
 		tp += advance;
 	}
 	/* Was it a trailing run of 0x00's? */
 	if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) {
 		if (tp + 1 >= ep)
-			return (NULL);
+			return NULL;
 		*tp++ = ':';
 	}
 	if (tp + 1 >= ep)
-		return (NULL);
+		return NULL;
 	*tp++ = '\0';
 
 	/*
 	 * Check for overflow, copy, and we're done.
 	 */
 	if ((size_t)(tp - tmp) > size) {
-		return (NULL);
+		return NULL;
 	}
 	strlcpy(dst, tmp, size);
-	return (dst);
+	return dst;
 }
 #endif /* INET6 */



CVS commit: src/sys/dev/usb

2018-07-31 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jul 31 16:07:46 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Re-generate


To generate a diff of this commit:
cvs rdiff -u -r1.749 -r1.750 src/sys/dev/usb/usbdevs.h \
src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.749 src/sys/dev/usb/usbdevs.h:1.750
--- src/sys/dev/usb/usbdevs.h:1.749	Wed Jul 25 05:29:58 2018
+++ src/sys/dev/usb/usbdevs.h	Tue Jul 31 16:07:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs.h,v 1.749 2018/07/25 05:29:58 msaitoh Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.750 2018/07/31 16:07:46 khorben Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -3030,6 +3030,8 @@
 #define	USB_PRODUCT_SIERRA_AC885U	0x6880		/* Sierra Wireless AirCard 885U */
 #define	USB_PRODUCT_SIERRA_C01SW	0x6890		/* C01SW */
 #define	USB_PRODUCT_SIERRA_USB305	0x68a3		/* Sierra Wireless AirCard USB 305 */
+#define	USB_PRODUCT_SIERRA_MC7304	0x68c0		/* MC7304 */
+#define	USB_PRODUCT_SIERRA_EM7455	0x9079		/* EM7455 */
 
 /* Sigmatel products */
 #define	USB_PRODUCT_SIGMATEL_SIR4116	0x4116		/* StIR4116 SIR */
Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.749 src/sys/dev/usb/usbdevs_data.h:1.750
--- src/sys/dev/usb/usbdevs_data.h:1.749	Wed Jul 25 05:29:58 2018
+++ src/sys/dev/usb/usbdevs_data.h	Tue Jul 31 16:07:46 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs_data.h,v 1.749 2018/07/25 05:29:58 msaitoh Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.750 2018/07/31 16:07:46 khorben Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -4136,284 +4136,288 @@ static const uint16_t usb_products[] = {
 	17752, 0,
 	USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_USB305, 
 	3954, 651, 17595, 4871, 10581, 0,
+	USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_MC7304, 
+	17758, 0,
+	USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_EM7455, 
+	17765, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_SIR4116, 
-	17758, 17767, 0,
+	17772, 17781, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_IRDA, 
 	9843, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_FIR4210, 
-	17771, 5533, 0,
+	17785, 5533, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_VFIR4220, 
-	17780, 17789, 0,
+	17794, 17803, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_I_BEAD100, 
-	17794, 12111, 8358, 10620, 0,
+	17808, 12111, 8358, 10620, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_I_BEAD150, 
-	17794, 15841, 8358, 10620, 0,
+	17808, 15841, 8358, 10620, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_DNSSF7X, 
-	17801, 1402, 17807, 17814, 17820, 0,
+	17815, 1402, 17821, 17828, 17834, 0,
 	USB_VENDOR_SIGMATEL, USB_PRODUCT_SIGMATEL_MUSICSTICK, 
-	17828, 17837, 0,
+	17842, 17851, 0,
 	USB_VENDOR_SIIG, USB_PRODUCT_SIIG_DIGIFILMREADER, 
-	17848, 10438, 0,
+	17862, 10438, 0,
 	USB_VENDOR_SIIG, USB_PRODUCT_SIIG_UISDMC2S, 
-	17863, 0,
+	17877, 0,
 	USB_VENDOR_SIIG, USB_PRODUCT_SIIG_MULTICARDREADER, 
-	17863, 0,
+	17877, 0,
 	USB_VENDOR_SIIG2, USB_PRODUCT_SIIG2_USBTOETHER, 
-	4871, 17879, 4901, 0,
+	4871, 17893, 4901, 0,
 	USB_VENDOR_SIIG2, USB_PRODUCT_SIIG2_US2308, 
 	6875, 0,
 	USB_VENDOR_SILICOM, USB_PRODUCT_SILICOM_U2E, 
-	17882, 0,
+	17896, 0,
 	USB_VENDOR_SILICOM, USB_PRODUCT_SILICOM_GPE, 
-	17886, 17210, 8543, 4901, 0,
+	17900, 17210, 8543, 4901, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_POLOLU, 
-	17892, 6875, 0,
+	17906, 6875, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_ARGUSISP, 
-	17899, 17909, 0,
+	17913, 17923, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CRUMB128, 
-	17913, 0,
+	17927, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_DEGREECONT, 
-	17922, 17929, 0,
+	17936, 17943, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_SUNNTO, 
-	17938, 17945, 0,
+	17952, 17959, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_DESKTOPMOBILE, 
-	17952, 13289, 17961, 0,
+	17966, 13289, 17975, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_IPLINK1220, 
-	17968, 17976, 0,
+	17982, 17990, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_JTAG, 
-	17981, 17990, 0,
+	17995, 18004, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_LIN, 
-	17981, 18000, 0,
+	17995, 18014, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_LIPOWSKY_HARP, 
-	17981, 18009, 0,
+	17995, 18023, 0,
 	USB_VENDOR_SILABS2, USB_PRODUCT_SILABS2_DCU11CLONE, 
-	18016, 18023, 0,
+	18030, 18037, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP210X_1, 
-	18029, 6875, 0,
+	18043, 6875, 0,
 	USB_VENDOR_SILABS, USB_PRODUCT_SILABS_CP210X_2, 
-	18029, 6875, 0,
+	18043, 6875, 0,
 	

CVS commit: src/sys/dev/usb

2018-07-31 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jul 31 16:07:26 UTC 2018

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add the Sierra Wireless MC7304 and EM7455 USB modems


To generate a diff of this commit:
cvs rdiff -u -r1.756 -r1.757 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.756 src/sys/dev/usb/usbdevs:1.757
--- src/sys/dev/usb/usbdevs:1.756	Wed Jul 25 05:29:33 2018
+++ src/sys/dev/usb/usbdevs	Tue Jul 31 16:07:26 2018
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.756 2018/07/25 05:29:33 msaitoh Exp $
+$NetBSD: usbdevs,v 1.757 2018/07/31 16:07:26 khorben Exp $
 
 /*-
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3023,6 +3023,8 @@ product SIERRA AC881U		0x6856	Sierra Wir
 product SIERRA AC885U		0x6880	Sierra Wireless AirCard 885U
 product SIERRA C01SW		0x6890	C01SW
 product SIERRA USB305		0x68a3	Sierra Wireless AirCard USB 305
+product SIERRA MC7304		0x68c0	MC7304
+product SIERRA EM7455		0x9079	EM7455
 
 /* Sigmatel products */
 product SIGMATEL SIR4116	0x4116	StIR4116 SIR



CVS commit: src/sys/netinet

2018-05-13 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun May 13 22:42:52 UTC 2018

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

Log Message:
Fix spello in a comment


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

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

Modified files:

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.230 src/sys/netinet/in.c:1.231
--- src/sys/netinet/in.c:1.230	Tue Apr 24 01:32:30 2018
+++ src/sys/netinet/in.c	Sun May 13 22:42:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.230 2018/04/24 01:32:30 knakahara Exp $	*/
+/*	$NetBSD: in.c,v 1.231 2018/05/13 22:42:51 khorben Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.230 2018/04/24 01:32:30 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.231 2018/05/13 22:42:51 khorben Exp $");
 
 #include "arp.h"
 
@@ -1145,7 +1145,7 @@ in_ifinit(struct ifnet *ifp, struct in_i
 
 	/*
 	 * Configure address flags.
-	 * We need to do this early because they maybe adjusted
+	 * We need to do this early because they may be adjusted
 	 * by if_addr_init depending on the address.
 	 */
 	if (ia->ia4_flags & IN_IFF_DUPLICATED) {



CVS commit: src/sys/arch/i386/include

2018-04-12 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Apr 13 01:49:47 UTC 2018

Modified Files:
src/sys/arch/i386/include: multiboot.h

Log Message:
Correct discrepancy with the Multiboot specification

The VBE mode was missing, and the types of the subsequent VBE members
were also wrong. Nothing in NetBSD's base seems to be using this, and
therefore nothing is expected to break as a result of this fix, or any
binary to change for that matter.
The latest specification (as of today) can be found at:
https://www.gnu.org/software/grub/manual/multiboot/multiboot.html

This was already reported in misc/52366, and addresses part of it.

Patch sent to port-i386@. Build-tested on NetBSD/amd64.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/i386/include/multiboot.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/i386/include/multiboot.h
diff -u src/sys/arch/i386/include/multiboot.h:1.8 src/sys/arch/i386/include/multiboot.h:1.9
--- src/sys/arch/i386/include/multiboot.h:1.8	Sun Feb 22 18:05:42 2009
+++ src/sys/arch/i386/include/multiboot.h	Fri Apr 13 01:49:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: multiboot.h,v 1.8 2009/02/22 18:05:42 ahoka Exp $	*/
+/*	$NetBSD: multiboot.h,v 1.9 2018/04/13 01:49:47 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2006 The NetBSD Foundation, Inc.
@@ -134,9 +134,10 @@ struct multiboot_info {
 	/* Valid if mi_flags sets MULTIBOOT_INFO_HAS_VBE. */
 	void *		unused_mi_vbe_control_info;
 	void *		unused_mi_vbe_mode_info;
-	paddr_t		unused_mi_vbe_interface_seg;
-	paddr_t		unused_mi_vbe_interface_off;
-	uint32_t	unused_mi_vbe_interface_len;
+	uint16_t	unused_mi_vbe_mode;
+	uint16_t	unused_mi_vbe_interface_seg;
+	uint16_t	unused_mi_vbe_interface_off;
+	uint16_t	unused_mi_vbe_interface_len;
 };
 
 /* - */



CVS commit: src/usr.sbin/vnconfig

2018-03-11 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 12 01:10:25 UTC 2018

Modified Files:
src/usr.sbin/vnconfig: vnconfig.c

Log Message:
Reflect the new name of vndconfig(8) in the usage screen

vnconfig(8) was renamed to vndconfig(8) in NetBSD 7. While the manual page
now defaults to vndconfig, the usage screen still referred to the old name.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/usr.sbin/vnconfig/vnconfig.c

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

Modified files:

Index: src/usr.sbin/vnconfig/vnconfig.c
diff -u src/usr.sbin/vnconfig/vnconfig.c:1.44 src/usr.sbin/vnconfig/vnconfig.c:1.45
--- src/usr.sbin/vnconfig/vnconfig.c:1.44	Sun Apr 10 09:04:09 2016
+++ src/usr.sbin/vnconfig/vnconfig.c	Mon Mar 12 01:10:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnconfig.c,v 1.44 2016/04/10 09:04:09 martin Exp $	*/
+/*	$NetBSD: vnconfig.c,v 1.45 2018/03/12 01:10:25 khorben Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -425,9 +425,9 @@ usage(void)
 {
 
 	(void)fprintf(stderr, "%s%s",
-	"usage: vnconfig [-crvz] [-f dsktab] [-t type] vnode_disk"
+	"usage: vndconfig [-crvz] [-f dsktab] [-t type] vnode_disk"
 		" reg-file [geomspec]\n",
-	"   vnconfig -u [-Fv] vnode_disk\n"
-	"   vnconfig -l [-m num | vnode_disk...]\n");
+	"   vndconfig -u [-Fv] vnode_disk\n"
+	"   vndconfig -l [-m num | vnode_disk...]\n");
 	exit(1);
 }



CVS commit: src/sys/dev/sdmmc

2018-03-10 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Mar 11 00:17:29 UTC 2018

Modified Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
Outsource setting the backplane window into a specific function so it
can be called and reused in different places.

>From OpenBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.1 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.2
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.1	Tue Nov  7 16:30:32 2017
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sun Mar 11 00:17:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.1 2017/11/07 16:30:32 khorben Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.2 2018/03/11 00:17:28 khorben Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -73,6 +73,7 @@ int		 bwfm_sdio_match(device_t, cfdata_t
 void		 bwfm_sdio_attach(device_t, struct device *, void *);
 int		 bwfm_sdio_detach(device_t, int);
 
+void		 bwfm_sdio_backplane(struct bwfm_sdio_softc *, uint32_t);
 uint8_t		 bwfm_sdio_read_1(struct bwfm_sdio_softc *, uint32_t);
 uint32_t	 bwfm_sdio_read_4(struct bwfm_sdio_softc *, uint32_t);
 void		 bwfm_sdio_write_1(struct bwfm_sdio_softc *, uint32_t,
@@ -218,6 +219,21 @@ bwfm_sdio_detach(struct device *self, in
 	return 0;
 }
 
+void
+bwfm_sdio_backplane(struct bwfm_sdio_softc *sc, uint32_t bar0)
+{
+	if (sc->sc_bar0 == bar0)
+		return;
+
+	bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRLOW,
+	(bar0 >>  8) & 0x80);
+	bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRMID,
+	(bar0 >> 16) & 0xff);
+	bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRHIGH,
+	(bar0 >> 24) & 0xff);
+	sc->sc_bar0 = bar0;
+}
+
 uint8_t
 bwfm_sdio_read_1(struct bwfm_sdio_softc *sc, uint32_t addr)
 {
@@ -246,15 +262,7 @@ bwfm_sdio_read_4(struct bwfm_sdio_softc 
 	uint32_t bar0 = addr & ~BWFM_SDIO_SB_OFT_ADDR_MASK;
 	uint32_t rv;
 
-	if (sc->sc_bar0 != bar0) {
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRLOW,
-		(bar0 >>  8) & 0x80);
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRMID,
-		(bar0 >> 16) & 0xff);
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRHIGH,
-		(bar0 >> 24) & 0xff);
-		sc->sc_bar0 = bar0;
-	}
+	bwfm_sdio_backplane(sc, bar0);
 
 	addr &= BWFM_SDIO_SB_OFT_ADDR_MASK;
 	addr |= BWFM_SDIO_SB_ACCESS_2_4B_FLAG;
@@ -299,15 +307,7 @@ bwfm_sdio_write_4(struct bwfm_sdio_softc
 	struct sdmmc_function *sf;
 	uint32_t bar0 = addr & ~BWFM_SDIO_SB_OFT_ADDR_MASK;
 
-	if (sc->sc_bar0 != bar0) {
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRLOW,
-		(bar0 >>  8) & 0x80);
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRMID,
-		(bar0 >> 16) & 0xff);
-		bwfm_sdio_write_1(sc, BWFM_SDIO_FUNC1_SBADDRHIGH,
-		(bar0 >> 24) & 0xff);
-		sc->sc_bar0 = bar0;
-	}
+	bwfm_sdio_backplane(sc, bar0);
 
 	addr &= BWFM_SDIO_SB_OFT_ADDR_MASK;
 	addr |= BWFM_SDIO_SB_ACCESS_2_4B_FLAG;



CVS commit: src/sys/netinet

2018-03-10 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Mar 10 23:28:13 UTC 2018

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

Log Message:
Fix spello in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/netinet/tcp_output.c

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

Modified files:

Index: src/sys/netinet/tcp_output.c
diff -u src/sys/netinet/tcp_output.c:1.198 src/sys/netinet/tcp_output.c:1.199
--- src/sys/netinet/tcp_output.c:1.198	Mon Feb 12 08:22:26 2018
+++ src/sys/netinet/tcp_output.c	Sat Mar 10 23:28:13 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_output.c,v 1.198 2018/02/12 08:22:26 maxv Exp $	*/
+/*	$NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.198 2018/02/12 08:22:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.199 2018/03/10 23:28:13 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1720,7 +1720,7 @@ out:
 			error = 0;
 		}
 
-		/* Back out the seqence number advance. */
+		/* Back out the sequence number advance. */
 		if (sack_rxmit)
 			p->rxmit -= len;
 



CVS commit: src/sys/dev/wscons

2018-03-10 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Mar 10 23:25:59 UTC 2018

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

Log Message:
Fix spello in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/wscons/mra.c

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

Modified files:

Index: src/sys/dev/wscons/mra.c
diff -u src/sys/dev/wscons/mra.c:1.6 src/sys/dev/wscons/mra.c:1.7
--- src/sys/dev/wscons/mra.c:1.6	Fri Mar 14 05:03:19 2014
+++ src/sys/dev/wscons/mra.c	Sat Mar 10 23:25:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $	*/
+/*	$NetBSD: mra.c,v 1.7 2018/03/10 23:25:59 khorben Exp $	*/
 
 /*
  * Copyright (c) 1999 Shin Takemura All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mra.c,v 1.7 2018/03/10 23:25:59 khorben Exp $");
 
 #include 
 #include 
@@ -61,7 +61,7 @@ mra_Y_AX1_BX2_C(const int *y, int ys,
 #define Y(i)		AA(y, ys, i)
 
 	/*
-	 * get avarage and sum
+	 * get average and sum
 	 */
 	X1a = 0;	X2a = 0;	Ya = 0;
 	X1X1s = 0;	X2X2s = 0;	X1X2s = 0;



CVS commit: src/sys/dev/hdaudio

2018-01-03 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Jan  4 00:09:12 UTC 2018

Modified Files:
src/sys/dev/hdaudio: hdafg.c

Log Message:
Fix off-by-one when calling snprintf(9) in hdafg_getdev()

This is actually harmless, since:
- the offset is too short rather than too long (no overflow)
- the struct audio_device comes from userland (no information leak)

"looks good to me" nat@


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/hdaudio/hdafg.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/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.13 src/sys/dev/hdaudio/hdafg.c:1.14
--- src/sys/dev/hdaudio/hdafg.c:1.13	Fri Aug  4 00:25:23 2017
+++ src/sys/dev/hdaudio/hdafg.c	Thu Jan  4 00:09:12 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.13 2017/08/04 00:25:23 mrg Exp $ */
+/* $NetBSD: hdafg.c,v 1.14 2018/01/04 00:09:12 khorben Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.13 2017/08/04 00:25:23 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.14 2018/01/04 00:09:12 khorben Exp $");
 
 #include 
 #include 
@@ -4058,7 +4058,7 @@ hdafg_getdev(void *opaque, struct audio_
 	sc->sc_vendor);
 	hdaudio_findproduct(audiodev->version, sizeof(audiodev->version),
 	sc->sc_vendor, sc->sc_product);
-	snprintf(audiodev->config, sizeof(audiodev->config) - 1,
+	snprintf(audiodev->config, sizeof(audiodev->config),
 	"%02Xh", sc->sc_nid);
 
 	return 0;



CVS commit: src/sys/dev/usb

2017-12-26 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Dec 26 18:44:52 UTC 2017

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

Log Message:
Fix typo in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.222 src/sys/dev/usb/usb_subr.c:1.223
--- src/sys/dev/usb/usb_subr.c:1.222	Fri Dec  8 14:46:18 2017
+++ src/sys/dev/usb/usb_subr.c	Tue Dec 26 18:44:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.222 2017/12/08 14:46:18 khorben Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.222 2017/12/08 14:46:18 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.223 2017/12/26 18:44:52 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1695,7 +1695,7 @@ usb_free_device(struct usbd_device *dev)
  * driver is dying and then wakes any sleepers.  It then sleeps on the
  * softc.  Each place that can sleep must maintain the reference
  * count.  When the reference count drops to -1 (0 is the normal value
- * of the reference count) the a wakeup on the softc is performed
+ * of the reference count) then a wakeup on the softc is performed
  * signaling to the detach waiter that all references are gone.
  */
 



CVS commit: src/sys/dev/usb

2017-12-08 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Dec  8 14:46:18 UTC 2017

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

Log Message:
Be more defensive towards malicious USB devices

This avoids potential panics due to 0-sized memory allocation attempts,
which could be triggered by malicious USB devices.

Tested on NetBSD/amd64 with a Sony Xperia X (SailfishOS).

Based on an initial patch by Nick Hudson , thanks!

Fixes PR kern/52383.

XXX pull-up to netbsd-7, netbsd-8

LGTM xtos@


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.221 src/sys/dev/usb/usb_subr.c:1.222
--- src/sys/dev/usb/usb_subr.c:1.221	Sat Oct 28 00:37:12 2017
+++ src/sys/dev/usb/usb_subr.c	Fri Dec  8 14:46:18 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.221 2017/10/28 00:37:12 pgoyette Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.222 2017/12/08 14:46:18 khorben Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.221 2017/10/28 00:37:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.222 2017/12/08 14:46:18 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -609,6 +609,10 @@ usbd_set_config_index(struct usbd_device
 		return err;
 	}
 	len = UGETW(cd.wTotalLength);
+	if (len == 0) {
+		DPRINTF("empty short descriptor", 0, 0, 0, 0);
+		return USBD_INVAL;
+	}
 	cdp = kmem_alloc(len, KM_SLEEP);
 
 	/* Get the full descriptor.  Try a few times for slow devices. */
@@ -635,6 +639,11 @@ usbd_set_config_index(struct usbd_device
 		err = usbd_get_bos_desc(dev, index, );
 		if (!err) {
 			int blen = UGETW(bd.wTotalLength);
+			if (blen == 0) {
+DPRINTF("empty bos descriptor", 0, 0, 0, 0);
+err = USBD_INVAL;
+goto bad;
+			}
 			bdp = kmem_alloc(blen, KM_SLEEP);
 
 			/* Get the full desc */
@@ -724,6 +733,11 @@ usbd_set_config_index(struct usbd_device
 
 	/* Allocate and fill interface data. */
 	nifc = cdp->bNumInterface;
+	if (nifc == 0) {
+		DPRINTF("no interfaces", 0, 0, 0, 0);
+		err = USBD_INVAL;
+		goto bad;
+	}
 	dev->ud_ifaces = kmem_alloc(nifc * sizeof(struct usbd_interface),
 	KM_SLEEP);
 	DPRINTFN(5, "dev=%#jx cdesc=%#jx", (uintptr_t)dev, (uintptr_t)cdp,



CVS commit: src/sys/dev/sdmmc

2017-11-07 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Nov  7 16:30:32 UTC 2017

Modified Files:
src/sys/dev/sdmmc: files.sdmmc
Added Files:
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
Add driver for Broadcom 802.11a/b/g/n/ac SDIO wireless devices, based on
the OpenBSD bwfm(4) driver.

I could not test this on any hardware yet, as it does not attach as-is on
my Raspberry PI 3.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/sdmmc/files.sdmmc
cvs rdiff -u -r0 -r1.1 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/files.sdmmc
diff -u src/sys/dev/sdmmc/files.sdmmc:1.4 src/sys/dev/sdmmc/files.sdmmc:1.5
--- src/sys/dev/sdmmc/files.sdmmc:1.4	Thu Oct  2 21:49:22 2014
+++ src/sys/dev/sdmmc/files.sdmmc	Tue Nov  7 16:30:32 2017
@@ -1,4 +1,4 @@
-#  $NetBSD: files.sdmmc,v 1.4 2014/10/02 21:49:22 jmcneill Exp $
+#  $NetBSD: files.sdmmc,v 1.5 2017/11/07 16:30:32 khorben Exp $
 #  $OpenBSD: files.sdmmc,v 1.2 2006/06/01 21:53:41 uwe Exp $
 #
 # Config file and device description for machine-independent SD/MMC code.
@@ -21,3 +21,7 @@ file	dev/sdmmc/ld_sdmmc.c		ld_sdmmc
 device sbt: btbus, bluetooth
 attach sbt at sdmmc
 file	dev/sdmmc/sbt.c			sbt
+
+# Broadcom FullMAC SDIO wireless adapter
+attach bwfm at sdmmc with bwfm_sdio
+file	dev/sdmmc/if_bwfm_sdio.c	bwfm_sdio

Added files:

Index: src/sys/dev/sdmmc/if_bwfm_sdio.c
diff -u /dev/null src/sys/dev/sdmmc/if_bwfm_sdio.c:1.1
--- /dev/null	Tue Nov  7 16:30:32 2017
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Tue Nov  7 16:30:32 2017
@@ -0,0 +1,444 @@
+/* $NetBSD: if_bwfm_sdio.c,v 1.1 2017/11/07 16:30:32 khorben Exp $ */
+/* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
+/*
+ * Copyright (c) 2010-2016 Broadcom Corporation
+ * Copyright (c) 2016,2017 Patrick Wildt 
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+#define BWFM_SDIO_CCCR_BRCM_CARDCAP			0xf0
+#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD14_SUPPORT	0x02
+#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD14_EXT		0x04
+#define  BWFM_SDIO_CCCR_BRCM_CARDCAP_CMD_NODEC		0x08
+#define BWFM_SDIO_CCCR_BRCM_CARDCTRL			0xf1
+#define  BWFM_SDIO_CCCR_BRCM_CARDCTRL_WLANRESET		0x02
+#define BWFM_SDIO_CCCR_BRCM_SEPINT			0xf2
+
+#ifdef BWFM_DEBUG
+#define DPRINTF(x)	do { if (bwfm_debug > 0) printf x; } while (0)
+#define DPRINTFN(n, x)	do { if (bwfm_debug >= (n)) printf x; } while (0)
+static int bwfm_debug = 2;
+#else
+#define DPRINTF(x)	do { ; } while (0)
+#define DPRINTFN(n, x)	do { ; } while (0)
+#endif
+
+#define DEVNAME(sc)	device_xname((sc)->sc_sc.sc_dev)
+
+struct bwfm_sdio_softc {
+	struct bwfm_softc	  sc_sc;
+	struct sdmmc_function	**sc_sf;
+	uint32_t		  sc_bar0;
+};
+
+int		 bwfm_sdio_match(device_t, cfdata_t, void *);
+void		 bwfm_sdio_attach(device_t, struct device *, void *);
+int		 bwfm_sdio_detach(device_t, int);
+
+uint8_t		 bwfm_sdio_read_1(struct bwfm_sdio_softc *, uint32_t);
+uint32_t	 bwfm_sdio_read_4(struct bwfm_sdio_softc *, uint32_t);
+void		 bwfm_sdio_write_1(struct bwfm_sdio_softc *, uint32_t,
+		 uint8_t);
+void		 bwfm_sdio_write_4(struct bwfm_sdio_softc *, uint32_t,
+		 uint32_t);
+
+uint32_t	 bwfm_sdio_buscore_read(struct bwfm_softc *, uint32_t);
+void		 bwfm_sdio_buscore_write(struct bwfm_softc *, uint32_t,
+		 uint32_t);
+int		 bwfm_sdio_buscore_prepare(struct bwfm_softc *);
+void		 bwfm_sdio_buscore_activate(struct bwfm_softc *, uint32_t);
+
+int		 bwfm_sdio_txdata(struct bwfm_softc *, struct mbuf *);
+int		 bwfm_sdio_txctl(struct bwfm_softc *, char *, size_t);
+int		 bwfm_sdio_rxctl(struct bwfm_softc *, char *, size_t *);
+
+struct bwfm_bus_ops bwfm_sdio_bus_ops = {
+	.bs_init = NULL,
+	.bs_stop = NULL,
+	.bs_txdata = bwfm_sdio_txdata,
+	.bs_txctl = bwfm_sdio_txctl,
+	.bs_rxctl = bwfm_sdio_rxctl,
+};
+
+struct bwfm_buscore_ops bwfm_sdio_buscore_ops = {
+	.bc_read = bwfm_sdio_buscore_read,
+	.bc_write = bwfm_sdio_buscore_write,
+	

CVS commit: src/share/misc

2017-11-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Nov  1 15:34:28 UTC 2017

Modified Files:
src/share/misc: acronyms

Log Message:
BPM: beam propagation method (light)
BPM: beats per minute (music)


To generate a diff of this commit:
cvs rdiff -u -r1.261 -r1.262 src/share/misc/acronyms

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

Modified files:

Index: src/share/misc/acronyms
diff -u src/share/misc/acronyms:1.261 src/share/misc/acronyms:1.262
--- src/share/misc/acronyms:1.261	Wed Nov  1 15:11:31 2017
+++ src/share/misc/acronyms	Wed Nov  1 15:34:28 2017
@@ -1,4 +1,4 @@
-$NetBSD: acronyms,v 1.261 2017/11/01 15:11:31 riastradh Exp $
+$NetBSD: acronyms,v 1.262 2017/11/01 15:34:28 khorben Exp $
 10Q	thank you
 10X	thanks
 1337	elite ("leet")
@@ -73,6 +73,8 @@ BNYA	burned now you are
 BOC	but of course
 BOFH	bastard operator from hell
 BOT	back on topic
+BPM	beam propagation method
+BPM	beats per minute
 BRB	[I'll] be right back
 BSD	booze, sex, drugs
 BTDT	been there, done that



CVS commit: src/share/mk

2017-11-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Nov  1 15:24:42 UTC 2017

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

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.363 -r1.364 src/share/mk/bsd.README

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

Modified files:

Index: src/share/mk/bsd.README
diff -u src/share/mk/bsd.README:1.363 src/share/mk/bsd.README:1.364
--- src/share/mk/bsd.README:1.363	Sun Oct  8 15:03:50 2017
+++ src/share/mk/bsd.README	Wed Nov  1 15:24:42 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.README,v 1.363 2017/10/08 15:03:50 christos Exp $
+#	$NetBSD: bsd.README,v 1.364 2017/11/01 15:24:42 khorben Exp $
 #	@(#)bsd.README	8.2 (Berkeley) 4/2/94
 
 This is the README file for the make "include" files for the NetBSD
@@ -374,7 +374,7 @@ MKRELRO		If "partial", set the non-PLT G
 		also force immediate symbol binding.
 		Default: no
 	
-MKREPRO If "yes", create reproducable builds. This enables
+MKREPRO If "yes", create reproducible builds. This enables
 		different switches to make two builds from the same source tree
 		result in the same build results.
 		Default: no
@@ -1210,7 +1210,7 @@ LIBDIR		Target directory for libraries.
 
 MKARZERO	Normally, ar(1) sets the timestamps, uid, gid and
 		permissions in files inside its archives to those of
-		the file it was fed. This leads to non-reproduceable
+		the file it was fed. This leads to non-reproducible
 		builds. If MKARZERO is set to "yes" (default is the
 		same as MKREPRO, or "no" if MKREPRO is not defined),
 		then the "D" flag is passed to ar, causing the



CVS commit: src/sys/dev/usb

2017-10-30 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Oct 31 00:57:14 UTC 2017

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

Log Message:
Also attach the RTL8192EU from TP-LINK


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

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.53 src/sys/dev/usb/if_urtwn.c:1.54
--- src/sys/dev/usb/if_urtwn.c:1.53	Wed May  3 15:34:05 2017
+++ src/sys/dev/usb/if_urtwn.c	Tue Oct 31 00:57:14 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.53 2017/05/03 15:34:05 jnemeth Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.54 2017/10/31 00:57:14 khorben Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.53 2017/05/03 15:34:05 jnemeth Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.54 2017/10/31 00:57:14 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -195,6 +195,7 @@ static const struct urtwn_dev {
 
 	/* URTWN_RTL8192EU */
 	URTWN_RTL8192EU_DEV(REALTEK,	RTL8192EU),
+	URTWN_RTL8192EU_DEV(TPLINK,	RTL8192EU),
 };
 #undef URTWN_DEV
 #undef URTWN_RTL8188E_DEV



CVS commit: src/sys/dev/usb

2017-10-30 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Oct 31 00:30:07 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs.h usbdevs_data.h

Log Message:
Re-generate


To generate a diff of this commit:
cvs rdiff -u -r1.735 -r1.736 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.736 -r1.737 src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.735 src/sys/dev/usb/usbdevs.h:1.736
--- src/sys/dev/usb/usbdevs.h:1.735	Thu Oct 19 23:55:02 2017
+++ src/sys/dev/usb/usbdevs.h	Tue Oct 31 00:30:07 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.735 2017/10/19 23:55:02 jmcneill Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.736 2017/10/31 00:30:07 khorben Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.742 2017/10/19 23:54:42 jmcneill Exp
+ *	NetBSD: usbdevs,v 1.743 2017/10/31 00:20:51 khorben Exp
  */
 
 /*
@@ -3290,6 +3290,7 @@
 
 /* TP-Link products */
 #define	USB_PRODUCT_TPLINK_RTL8192CU	0x0100		/* RTL8192CU */
+#define	USB_PRODUCT_TPLINK_RTL8192EU	0x0109		/* RTL8192EU */
 #define	USB_PRODUCT_TPLINK_RTL8188EU	0x010c		/* RTL8188EU */
 
 /* Trek Technology products */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.736 src/sys/dev/usb/usbdevs_data.h:1.737
--- src/sys/dev/usb/usbdevs_data.h:1.736	Thu Oct 19 23:55:02 2017
+++ src/sys/dev/usb/usbdevs_data.h	Tue Oct 31 00:30:07 2017
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.736 2017/10/19 23:55:02 jmcneill Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.737 2017/10/31 00:30:07 khorben Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.742 2017/10/19 23:54:42 jmcneill Exp
+ *	NetBSD: usbdevs,v 1.743 2017/10/31 00:20:51 khorben Exp
  */
 
 /*
@@ -4480,6 +4480,8 @@ static const uint16_t usb_products[] = {
 	8525, 6353, 4878, 5670, 0,
 	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192CU, 
 	5090, 0,
+	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8192EU, 
+	16460, 0,
 	USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EU, 
 	5100, 0,
 	USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE, 
@@ -6974,7 +6976,7 @@ static const char usb_words[] = { "." 
 	"RTL8191CU\0" /* 1 refs @ 16431 */
 	"RTL8192CE\0" /* 1 refs @ 16441 */
 	"RTL8187B\0" /* 3 refs @ 16451 */
-	"RTL8192EU\0" /* 1 refs @ 16460 */
+	"RTL8192EU\0" /* 2 refs @ 16460 */
 	"RTL8712\0" /* 1 refs @ 16470 */
 	"RTL8713\0" /* 1 refs @ 16478 */
 	"BlackBerry\0" /* 3 refs @ 16486 */



CVS commit: src/sys/dev/usb

2017-10-30 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Oct 31 00:20:51 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add the TP-LINK TL-WN823N (version 2)


To generate a diff of this commit:
cvs rdiff -u -r1.742 -r1.743 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.742 src/sys/dev/usb/usbdevs:1.743
--- src/sys/dev/usb/usbdevs:1.742	Thu Oct 19 23:54:42 2017
+++ src/sys/dev/usb/usbdevs	Tue Oct 31 00:20:51 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.742 2017/10/19 23:54:42 jmcneill Exp $
+$NetBSD: usbdevs,v 1.743 2017/10/31 00:20:51 khorben Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -3283,6 +3283,7 @@ product TOSHIBA HSDPA_MODEM_EU870DT1	0x1
 
 /* TP-Link products */
 product TPLINK RTL8192CU	0x0100	RTL8192CU
+product TPLINK RTL8192EU	0x0109	RTL8192EU
 product TPLINK RTL8188EU	0x010c	RTL8188EU
 
 /* Trek Technology products */



CVS commit: src/sys/arch/evbarm

2017-09-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Sep 22 15:37:13 UTC 2017

Modified Files:
src/sys/arch/evbarm/kobo: kobo_usb.c
src/sys/arch/evbarm/netwalker: netwalker_usb.c

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/kobo/kobo_usb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/netwalker/netwalker_usb.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/evbarm/kobo/kobo_usb.c
diff -u src/sys/arch/evbarm/kobo/kobo_usb.c:1.1 src/sys/arch/evbarm/kobo/kobo_usb.c:1.2
--- src/sys/arch/evbarm/kobo/kobo_usb.c:1.1	Fri Jul 25 11:22:50 2014
+++ src/sys/arch/evbarm/kobo/kobo_usb.c	Fri Sep 22 15:37:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: kobo_usb.c,v 1.1 2014/07/25 11:22:50 hkenken Exp $	*/
+/*	$NetBSD: kobo_usb.c,v 1.2 2017/09/22 15:37:13 khorben Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.1 2014/07/25 11:22:50 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kobo_usb.c,v 1.2 2017/09/22 15:37:13 khorben Exp $");
 
 #include "opt_imx.h"
 
@@ -113,7 +113,7 @@ kobo_usb_init(struct imxehci_softc *sc)
 		init_h1(sc);
 		break;
 	default:
-		aprint_error_dev(sc->sc_hsc.sc_dev, "unit %d not supprted\n",
+		aprint_error_dev(sc->sc_hsc.sc_dev, "unit %d not supported\n",
 		sc->sc_unit);
 	}
 }

Index: src/sys/arch/evbarm/netwalker/netwalker_usb.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.3 src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.4
--- src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.3	Sun Apr 15 10:19:47 2012
+++ src/sys/arch/evbarm/netwalker/netwalker_usb.c	Fri Sep 22 15:37:13 2017
@@ -25,7 +25,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.3 2012/04/15 10:19:47 bsh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.4 2017/09/22 15:37:13 khorben Exp $");
 
 #include 
 #include 
@@ -106,7 +106,7 @@ netwalker_usb_init(struct imxehci_softc 
 		init_h1(sc);
 		break;
 	default:
-		aprint_error_dev(sc->sc_hsc.sc_dev, "unit %d not supprted\n",
+		aprint_error_dev(sc->sc_hsc.sc_dev, "unit %d not supported\n",
 		sc->sc_unit);
 	}
 }



CVS commit: src/sys/dev/usb

2017-08-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Aug  5 12:29:38 UTC 2017

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

Log Message:
Sort the matching vendor list alphabetically

NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/usb/umodeswitch.c

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

Modified files:

Index: src/sys/dev/usb/umodeswitch.c
diff -u src/sys/dev/usb/umodeswitch.c:1.1 src/sys/dev/usb/umodeswitch.c:1.2
--- src/sys/dev/usb/umodeswitch.c:1.1	Wed May 24 20:23:58 2017
+++ src/sys/dev/usb/umodeswitch.c	Sat Aug  5 12:29:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodeswitch.c,v 1.1 2017/05/24 20:23:58 christos Exp $	*/
+/*	$NetBSD: umodeswitch.c,v 1.2 2017/08/05 12:29:38 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.1 2017/05/24 20:23:58 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.2 2017/08/05 12:29:38 khorben Exp $");
 
 #include 
 #include 
@@ -401,16 +401,16 @@ umodeswitch_match(device_t parent, cfdat
 		}
 		break;
 
-	case USB_VENDOR_SIERRA:
-		if (uaa->uaa_product == USB_PRODUCT_SIERRA_INSTALLER)
-			return u3g_sierra_reinit(uaa->uaa_device);
-		break;
-
 	case USB_VENDOR_QUALCOMM:
 		if (uaa->uaa_product == USB_PRODUCT_QUALCOMM_NTT_DOCOMO_L02C_STORAGE)
 			return u3g_bulk_scsi_eject(uaa->uaa_device);
 		break;
 
+	case USB_VENDOR_SIERRA:
+		if (uaa->uaa_product == USB_PRODUCT_SIERRA_INSTALLER)
+			return u3g_sierra_reinit(uaa->uaa_device);
+		break;
+
 	case USB_VENDOR_ZTE:
 		switch (uaa->uaa_product){
 		case USB_PRODUCT_ZTE_INSTALLER:



CVS commit: src/sys/dev/usb

2017-08-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Aug  5 12:38:08 UTC 2017

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

Log Message:
Automatically eject RALINK RT73 devices

This lets the MW-P54SS USB Wireless Broadband Router from Synet attach
as rum(4).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/usb/umodeswitch.c

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

Modified files:

Index: src/sys/dev/usb/umodeswitch.c
diff -u src/sys/dev/usb/umodeswitch.c:1.2 src/sys/dev/usb/umodeswitch.c:1.3
--- src/sys/dev/usb/umodeswitch.c:1.2	Sat Aug  5 12:29:38 2017
+++ src/sys/dev/usb/umodeswitch.c	Sat Aug  5 12:38:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: umodeswitch.c,v 1.2 2017/08/05 12:29:38 khorben Exp $	*/
+/*	$NetBSD: umodeswitch.c,v 1.3 2017/08/05 12:38:08 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2017 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.2 2017/08/05 12:29:38 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umodeswitch.c,v 1.3 2017/08/05 12:38:08 khorben Exp $");
 
 #include 
 #include 
@@ -406,6 +406,14 @@ umodeswitch_match(device_t parent, cfdat
 			return u3g_bulk_scsi_eject(uaa->uaa_device);
 		break;
 
+	case USB_VENDOR_RALINK:
+		switch (uaa->uaa_product){
+		case USB_PRODUCT_RALINK_RT73:
+			return u3g_bulk_scsi_eject(uaa->uaa_device);
+			break;
+		}
+		break;
+
 	case USB_VENDOR_SIERRA:
 		if (uaa->uaa_product == USB_PRODUCT_SIERRA_INSTALLER)
 			return u3g_sierra_reinit(uaa->uaa_device);



CVS commit: src/sys/netinet

2017-07-03 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jul  3 18:54:11 UTC 2017

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

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/sys/netinet/ip_output.c

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

Modified files:

Index: src/sys/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.280 src/sys/netinet/ip_output.c:1.281
--- src/sys/netinet/ip_output.c:1.280	Mon Jul  3 16:43:01 2017
+++ src/sys/netinet/ip_output.c	Mon Jul  3 18:54:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.280 2017/07/03 16:43:01 roy Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.281 2017/07/03 18:54:11 khorben Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.280 2017/07/03 16:43:01 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_output.c,v 1.281 2017/07/03 18:54:11 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -699,7 +699,7 @@ sendit:
 
 	/*
 	 * We can't use HW checksumming if we're about to
-	 * to fragment the packet.
+	 * fragment the packet.
 	 *
 	 * XXX Some hardware can do this.
 	 */



CVS commit: src/sys/sys

2017-07-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Jul  1 16:36:46 UTC 2017

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

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.340 -r1.341 src/sys/sys/proc.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/proc.h
diff -u src/sys/sys/proc.h:1.340 src/sys/sys/proc.h:1.341
--- src/sys/sys/proc.h:1.340	Thu Mar 30 20:17:11 2017
+++ src/sys/sys/proc.h	Sat Jul  1 16:36:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.340 2017/03/30 20:17:11 christos Exp $	*/
+/*	$NetBSD: proc.h,v 1.341 2017/07/01 16:36:46 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -200,7 +200,7 @@ struct emul {
 };
 
 /*
- * Emulation miscelaneous flags
+ * Emulation miscellaneous flags
  */
 #define	EMUL_HAS_SYS___syscall	0x001	/* Has SYS___syscall */
 



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

2017-07-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Jul  1 16:34:17 UTC 2017

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

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/ipf/netinet/ip_nat.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/ipf/netinet/ip_state.c

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

Modified files:

Index: src/sys/external/bsd/ipf/netinet/ip_nat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.c:1.17 src/sys/external/bsd/ipf/netinet/ip_nat.c:1.18
--- src/sys/external/bsd/ipf/netinet/ip_nat.c:1.17	Tue Oct  4 14:36:46 2016
+++ src/sys/external/bsd/ipf/netinet/ip_nat.c	Sat Jul  1 16:34:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.17 2016/10/04 14:36:46 sborrill Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.18 2017/07/01 16:34:17 khorben Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -113,7 +113,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.17 2016/10/04 14:36:46 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.18 2017/07/01 16:34:17 khorben Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -6012,7 +6012,7 @@ ipf_nat_icmpquerytype(int icmptype)
 	{
 	case ICMP_ECHOREPLY:
 	case ICMP_ECHO:
-	/* route aedvertisement/solliciation is currently unsupported: */
+	/* route advertisement/sollicitation is currently unsupported: */
 	/* it would require rewriting the ICMP data section*/
 	case ICMP_TSTAMP:
 	case ICMP_TSTAMPREPLY:

Index: src/sys/external/bsd/ipf/netinet/ip_state.c
diff -u src/sys/external/bsd/ipf/netinet/ip_state.c:1.7 src/sys/external/bsd/ipf/netinet/ip_state.c:1.8
--- src/sys/external/bsd/ipf/netinet/ip_state.c:1.7	Sun Apr 23 20:47:22 2017
+++ src/sys/external/bsd/ipf/netinet/ip_state.c	Sat Jul  1 16:34:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_state.c,v 1.7 2017/04/23 20:47:22 christos Exp $	*/
+/*	$NetBSD: ip_state.c,v 1.8 2017/07/01 16:34:17 khorben Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -100,7 +100,7 @@ struct file;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.7 2017/04/23 20:47:22 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_state.c,v 1.8 2017/07/01 16:34:17 khorben Exp $");
 #else
 static const char sccsid[] = "@(#)ip_state.c	1.8 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_state.c,v 1.1.1.2 2012/07/22 13:45:37 darrenr Exp";
@@ -1349,7 +1349,7 @@ ipf_state_add(ipf_main_softc_t *softc, f
 
 	/*
 	 * If a packet that was created locally is trying to go out but we
-	 * do not match here here because of this lock, it is likely that
+	 * do not match here because of this lock, it is likely that
 	 * the policy will block it and return network unreachable back up
 	 * the stack. To mitigate this error, EAGAIN is returned instead,
 	 * telling the IP stack to try sending this packet again later.
@@ -1414,7 +1414,7 @@ ipf_state_add(ipf_main_softc_t *softc, f
 	is->is_die = 1 + softc->ipf_ticks;
 	/*
 	 * We want to check everything that is a property of this packet,
-	 * but we don't (automatically) care about it's fragment status as
+	 * but we don't (automatically) care about its fragment status as
 	 * this may change.
 	 */
 	is->is_pass = pass;



CVS commit: src/sys/arch

2017-06-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Jun 22 18:14:32 UTC 2017

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3_DOM0
src/sys/arch/xen/conf: files.xen

Log Message:
Register support for SD card readers with Xen DOM0 kernels

Tested on a Lenovo ThinkPad T440s (amd64)


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.112 -r1.113 src/sys/arch/i386/conf/XEN3_DOM0
cvs rdiff -u -r1.147 -r1.148 src/sys/arch/xen/conf/files.xen

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.135 src/sys/arch/amd64/conf/XEN3_DOM0:1.136
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.135	Thu Apr 20 09:56:27 2017
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Thu Jun 22 18:14:32 2017
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.135 2017/04/20 09:56:27 msaitoh Exp $
+# $NetBSD: XEN3_DOM0,v 1.136 2017/06/22 18:14:32 khorben Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -797,6 +797,19 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# SD/MMC controller
+sdhc*	at pci?		# SD Host Controller
+rtsx*	at pci?		# Realtek RTS5209/RTS5229 Card Reader
+#sdhc*	at cardbus?	# SD Host Controller
+sdmmc*	at sdhc?	# SD/MMC bus
+sdmmc*	at rtsx?	# SD/MMC bus
+
+ld*	at sdmmc?
+
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/i386/conf/XEN3_DOM0
diff -u src/sys/arch/i386/conf/XEN3_DOM0:1.112 src/sys/arch/i386/conf/XEN3_DOM0:1.113
--- src/sys/arch/i386/conf/XEN3_DOM0:1.112	Mon Apr 17 09:54:59 2017
+++ src/sys/arch/i386/conf/XEN3_DOM0	Thu Jun 22 18:14:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3_DOM0,v 1.112 2017/04/17 09:54:59 bouyer Exp $
+#	$NetBSD: XEN3_DOM0,v 1.113 2017/06/22 18:14:32 khorben Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -689,6 +689,23 @@ ieee1394if* at fwohci?
 fwip*	at ieee1394if?			# IP over IEEE1394
 sbp*	at ieee1394if? euihi ? euilo ?	# SCSI over IEEE1394
 
+
+# SD/MMC/SDIO Controller and Device support
+
+# PCI SD/MMC controller
+sdhc*	at pci?# SD Host Controller
+rtsx*	at pci?# Realtek RTS5209/RTS5229 Card Reader
+
+# CardBus SD/MMC controller
+#sdhc*	at cardbus? function ?		# SD Host Controller
+
+sdmmc*	at sdhc?			# SD/MMC bus
+sdmmc*	at rtsx?			# SD/MMC bus
+ld*	at sdmmc?
+
+
+# Audio Devices
+
 # PCI audio devices
 auacer* at pci? dev ? function ?	# ALi M5455 integrated AC'97 Audio
 auich*	at pci? dev ? function ?	# Intel ICH integrated AC'97 Audio
@@ -768,6 +785,7 @@ wsmouse* at btmagic? mux 0
 # Bluetooth Audio support
 btsco* at bthub?
 
+
 # Cryptographic Devices
 
 # PCI cryptographic devices

Index: src/sys/arch/xen/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.147 src/sys/arch/xen/conf/files.xen:1.148
--- src/sys/arch/xen/conf/files.xen:1.147	Tue May 23 08:48:35 2017
+++ src/sys/arch/xen/conf/files.xen	Thu Jun 22 18:14:32 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.147 2017/05/23 08:48:35 nonaka Exp $
+#	$NetBSD: files.xen,v 1.148 2017/06/22 18:14:32 khorben Exp $
 #	NetBSD: files.x86,v 1.10 2003/10/08 17:30:00 bouyer Exp 
 #	NetBSD: files.i386,v 1.254 2004/03/25 23:32:10 jmc Exp 
 
@@ -375,6 +375,8 @@ include	"compat/ossaudio/files.ossaudio"
 # Bluetooth
 include "dev/bluetooth/files.bluetooth"
 
+include "dev/sdmmc/files.sdmmc"
+
 #
 # CARDBUS
 #



CVS commit: src/sys/dev/usb

2017-06-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Jun 22 15:22:16 UTC 2017

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

Log Message:
Typos in comments


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/usb/uvideo.c

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

Modified files:

Index: src/sys/dev/usb/uvideo.c
diff -u src/sys/dev/usb/uvideo.c:1.44 src/sys/dev/usb/uvideo.c:1.45
--- src/sys/dev/usb/uvideo.c:1.44	Thu Jun  1 02:45:12 2017
+++ src/sys/dev/usb/uvideo.c	Thu Jun 22 15:22:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvideo.c,v 1.44 2017/06/01 02:45:12 chs Exp $	*/
+/*	$NetBSD: uvideo.c,v 1.45 2017/06/22 15:22:16 khorben Exp $	*/
 
 /*
  * Copyright (c) 2008 Patrick Mahoney
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.44 2017/06/01 02:45:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvideo.c,v 1.45 2017/06/22 15:22:16 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1929,7 +1929,7 @@ uvideo_get_format(void *addr, struct vid
 }
 
 /*
- * uvideo_set_format - TODO: this is boken and does nothing
+ * uvideo_set_format - TODO: this is broken and does nothing
  */
 static int
 uvideo_set_format(void *addr, struct video_format *format)
@@ -2071,7 +2071,7 @@ uvideo_start_transfer(void *addr)
 	struct uvideo_stream *vs;
 	int s, err;
 
-	/* FIXME: this functions should be stream specific */
+	/* FIXME: this function should be stream specific */
 	vs = SLIST_FIRST(>sc_stream_list);
 	s = splusb();
 	err = uvideo_stream_start_xfer(vs);



CVS commit: src/share/man/man4

2017-05-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May 23 00:48:29 UTC 2017

Modified Files:
src/share/man/man4: rum.4

Log Message:
Document a caveat with the Synet MW-P54SS

The MW-P54SS USB Wireless Broadband Router from Synet will only attach
after ejecting the virtual optical drive coming up first.

off to wizd(8)


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/share/man/man4/rum.4

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/man4/rum.4
diff -u src/share/man/man4/rum.4:1.8 src/share/man/man4/rum.4:1.9
--- src/share/man/man4/rum.4:1.8	Tue Mar 18 18:20:39 2014
+++ src/share/man/man4/rum.4	Tue May 23 00:48:29 2017
@@ -1,5 +1,5 @@
 .\" $OpenBSD: rum.4,v 1.17 2006/10/22 08:29:01 damien Exp $
-.\" $NetBSD: rum.4,v 1.8 2014/03/18 18:20:39 riastradh Exp $
+.\" $NetBSD: rum.4,v 1.9 2017/05/23 00:48:29 khorben Exp $
 .\"
 .\" Copyright (c) 2005, 2006
 .\"	Damien Bergamini 
@@ -241,6 +241,7 @@ The following adapters should work:
 .It Senao NUB-3701
 .It Sitecom WL-113 ver 2
 .It Sitecom WL-172
+.It Synet MW-P54SS
 .It TP-LINK TL-WN321G
 .El
 .Sh EXAMPLES
@@ -325,3 +326,11 @@ driver supports automatic control of the
 Therefore the use of a
 .Nm
 adapter in Host AP mode is discouraged.
+.Pp
+The Synet MW-P54SS USB Wireless Broadband Router first attaches as a virtual
+.Xr cd 4
+device on the
+.Xr umass 4
+mass storage bus. It will re-attach with this driver after using
+.Xr eject 1
+on the corresponding device.



CVS commit: src/sys/dev/usb

2017-05-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May 23 00:32:47 UTC 2017

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

Log Message:
Also attach the MW-P54SS USB Wireless Broadband Router from Synet

Tested on NetBSD/amd64 (in HostAP mode)


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/if_rum.c

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

Modified files:

Index: src/sys/dev/usb/if_rum.c
diff -u src/sys/dev/usb/if_rum.c:1.57 src/sys/dev/usb/if_rum.c:1.58
--- src/sys/dev/usb/if_rum.c:1.57	Fri Nov 25 12:56:29 2016
+++ src/sys/dev/usb/if_rum.c	Tue May 23 00:32:47 2017
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $	*/
-/*	$NetBSD: if_rum.c,v 1.57 2016/11/25 12:56:29 skrll Exp $	*/
+/*	$NetBSD: if_rum.c,v 1.58 2017/05/23 00:32:47 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2005-2007 Damien Bergamini 
@@ -24,7 +24,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.57 2016/11/25 12:56:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rum.c,v 1.58 2017/05/23 00:32:47 khorben Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -138,6 +138,7 @@ static const struct usb_devno rum_devs[]
 	{ USB_VENDOR_SITECOMEU,		USB_PRODUCT_SITECOMEU_WL172 },
 	{ USB_VENDOR_SPARKLAN,		USB_PRODUCT_SPARKLAN_RT2573 },
 	{ USB_VENDOR_SURECOM,		USB_PRODUCT_SURECOM_RT2573 },
+	{ USB_VENDOR_SYNET,		USB_PRODUCT_SYNET_MWP54SS },
 	{ USB_VENDOR_ZYXEL,		USB_PRODUCT_ZYXEL_RT2573 }
 };
 



CVS commit: src/sys/dev/usb

2017-05-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue May 23 00:29:20 UTC 2017

Modified Files:
src/sys/dev/usb: usbdevs

Log Message:
Add Synet MW-P54SS USB Wireless Broadband Router


To generate a diff of this commit:
cvs rdiff -u -r1.734 -r1.735 src/sys/dev/usb/usbdevs

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.734 src/sys/dev/usb/usbdevs:1.735
--- src/sys/dev/usb/usbdevs:1.734	Thu May  4 14:21:01 2017
+++ src/sys/dev/usb/usbdevs	Tue May 23 00:29:20 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.734 2017/05/04 14:21:01 hauke Exp $
+$NetBSD: usbdevs,v 1.735 2017/05/23 00:29:20 khorben Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -321,6 +321,7 @@ vendor STSN		0x07ef	STSN
 vendor CENTURY		0x07f7	CENTURY Corporation
 vendor BEWAN		0x07fa	Bewan
 vendor ZOOM		0x0803	Zoom Telephonics
+vendor SYNET		0x0812	Synet Electronics
 vendor BROADLOGIC	0x0827	BroadLogic
 vendor HANDSPRING	0x082d	Handspring
 vendor PALM		0x0830	Palm Computing
@@ -3196,6 +3197,9 @@ product SWEEX2 LW154		0x0154	LW154
 product SWEEX2 LW303		0x0302	LW303
 product SWEEX2 LW313		0x0313	LW313
 
+/* Synet Electronics products */
+product SYNET MWP54SS		0x3101	MW-P54SS USB Wireless Broadband Router
+
 /* System TALKS, Inc. */
 product SYSTEMTALKS SGCX2UL	0x1920	SGC-X2UL
 



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-04-09 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Apr  9 23:03:51 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: signature.c

Log Message:
No longer hard-code the suffix length

This will avoid a buffer overflow if the suffix changes; it is currently
hard-coded as either "asc" or "sig".

Submitted on tech-pkg@ as:
[PATCH 10/11] No longer hard-code the suffix length


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 \
src/crypto/external/bsd/netpgp/dist/src/lib/signature.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.37
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36	Sun Apr  9 22:48:39 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c	Sun Apr  9 23:03:50 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: signature.c,v 1.36 2017/04/09 22:48:39 khorben Exp $");
+__RCSID("$NetBSD: signature.c,v 1.37 2017/04/09 23:03:50 khorben Exp $");
 #endif
 
 #include 
@@ -909,7 +909,7 @@ open_output_file(pgp_output_t **output,
 			fd = pgp_setup_file_write(output, outname, overwrite);
 		}
 	} else {
-		size_t  flen = strlen(inname) + 4 + 1;
+		size_t  flen = strlen(inname) + 1 + strlen(suffix) + 1;
 		char   *f = NULL;
 
 		if ((f = calloc(1, flen)) == NULL) {



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-04-09 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Apr  9 22:48:39 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: signature.c

Log Message:
Output signatures to the standard output for "-"

This is to reflect the behaviour documented in netpgp(1).

Submitted on tech-pkg@ as:
[PATCH 09/11] Output signatures to the standard output for "-"

Only modified for consistency with the coding style.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 \
src/crypto/external/bsd/netpgp/dist/src/lib/signature.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.36
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35	Sun Apr  9 22:44:34 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c	Sun Apr  9 22:48:39 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: signature.c,v 1.35 2017/04/09 22:44:34 khorben Exp $");
+__RCSID("$NetBSD: signature.c,v 1.36 2017/04/09 22:48:39 khorben Exp $");
 #endif
 
 #include 
@@ -903,7 +903,11 @@ open_output_file(pgp_output_t **output,
 
 	/* setup output file */
 	if (outname) {
-		fd = pgp_setup_file_write(output, outname, overwrite);
+		if (strcmp(outname, "-") == 0) {
+			fd = pgp_setup_file_write(output, NULL, overwrite);
+		} else {
+			fd = pgp_setup_file_write(output, outname, overwrite);
+		}
 	} else {
 		size_t  flen = strlen(inname) + 4 + 1;
 		char   *f = NULL;



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-04-09 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Apr  9 22:44:34 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: signature.c

Log Message:
Avoid a type cast

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 \
src/crypto/external/bsd/netpgp/dist/src/lib/signature.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/signature.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.34 src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.35
--- src/crypto/external/bsd/netpgp/dist/src/lib/signature.c:1.34	Mon Mar  5 02:20:18 2012
+++ src/crypto/external/bsd/netpgp/dist/src/lib/signature.c	Sun Apr  9 22:44:34 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: signature.c,v 1.34 2012/03/05 02:20:18 christos Exp $");
+__RCSID("$NetBSD: signature.c,v 1.35 2017/04/09 22:44:34 khorben Exp $");
 #endif
 
 #include 
@@ -905,7 +905,7 @@ open_output_file(pgp_output_t **output,
 	if (outname) {
 		fd = pgp_setup_file_write(output, outname, overwrite);
 	} else {
-		unsignedflen = (unsigned)(strlen(inname) + 4 + 1);
+		size_t  flen = strlen(inname) + 4 + 1;
 		char   *f = NULL;
 
 		if ((f = calloc(1, flen)) == NULL) {



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

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 21:34:32 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgp: netpgp.1

Log Message:
Also document alternate option "--detach"

Submitted on tech-pkg@ as:
[PATCH 08/11] Also document alternate option "--detach"


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.20 src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.21
--- src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.20	Mon Mar 27 21:30:23 2017
+++ src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1	Mon Mar 27 21:34:32 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: netpgp.1,v 1.20 2017/03/27 21:30:23 khorben Exp $
+.\" $NetBSD: netpgp.1,v 1.21 2017/03/27 21:34:32 khorben Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -216,7 +216,7 @@ access to the cipher used.
 The default cipher algorithm is the
 .Dq CAST5
 algorithm.
-.It Fl Fl detached
+.It Fl Fl detach , Fl Fl detached
 When signing a file, place the resulting signature in a separate
 file from the one being signed.
 .It Fl Fl hash-alg Ar hash-algorithm



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

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 21:30:23 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/netpgp: netpgp.1

Log Message:
Correct option "--armor"

Submitted on tech-pkg@ as:
[PATCH 07/11] Correct option "--armor"


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 \
src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1
diff -u src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.19 src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.20
--- src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1:1.19	Mon Feb 17 07:23:18 2014
+++ src/crypto/external/bsd/netpgp/dist/src/netpgp/netpgp.1	Mon Mar 27 21:30:23 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: netpgp.1,v 1.19 2014/02/17 07:23:18 agc Exp $
+.\" $NetBSD: netpgp.1,v 1.20 2017/03/27 21:30:23 khorben Exp $
 .\"
 .\" Copyright (c) 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -203,7 +203,7 @@ library.
 In addition to one of the preceding commands, a number of qualifiers
 or options may be given.
 .Bl -tag -width Ar
-.It Fl Fl armour , Fl armor
+.It Fl Fl armour , Fl Fl armor
 This option, however it is spelled, wraps the signature as an
 ASCII-encoded piece of text, for ease of use.
 .It Fl Fl cipher Ar ciphername



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 21:19:12 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c

Log Message:
Do not ask for a passphrase when empty

Submitted on tech-pkg@ as:
[PATCH 06/11] Do not ask for a passphrase when empty

Only modified for consistency with the coding style.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.55
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54	Mon Mar 27 21:06:50 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Mon Mar 27 21:19:12 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.54 2017/03/27 21:06:50 khorben Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.55 2017/03/27 21:19:12 khorben Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -226,7 +226,7 @@ typedef struct {
 	pgp_seckey_t		*seckey;
 } decrypt_t;
 
-static pgp_cb_ret_t 
+static pgp_cb_ret_t
 decrypt_cb(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
 {
 	const pgp_contents_t	*content = >u;
@@ -294,6 +294,20 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_
 	return PGP_RELEASE_MEMORY;
 }
 
+static pgp_cb_ret_t
+decrypt_cb_empty(const pgp_packet_t *pkt, pgp_cbdata_t *cbinfo)
+{
+	const pgp_contents_t	*content = >u;
+
+	switch (pkt->tag) {
+	case PGP_GET_PASSPHRASE:
+		*content->skey_passphrase.passphrase = netpgp_strdup("");
+		return PGP_KEEP_MEMORY;
+	default:
+		return decrypt_cb(pkt, cbinfo);
+	}
+}
+
 /**
 \ingroup Core_Keys
 \brief Decrypts secret key from given keydata with given passphrase
@@ -308,8 +322,18 @@ pgp_decrypt_seckey(const pgp_key_t *key,
 	const int	 printerrors = 1;
 	decrypt_t	 decrypt;
 
+	/* XXX first try with an empty passphrase */
 	(void) memset(, 0x0, sizeof(decrypt));
 	decrypt.key = key;
+	stream = pgp_new(sizeof(*stream));
+	pgp_keydata_reader_set(stream, key);
+	pgp_set_callback(stream, decrypt_cb_empty, );
+	stream->readinfo.accumulate = 1;
+	pgp_parse(stream, !printerrors);
+	if (decrypt.seckey != NULL) {
+		return decrypt.seckey;
+	}
+	/* ask for a passphrase */
 	decrypt.passfp = passfp;
 	stream = pgp_new(sizeof(*stream));
 	pgp_keydata_reader_set(stream, key);



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 21:06:50 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c keyring.h

Log Message:
Expect a FILE * for pgp_decrypt_seckey()

Submitted on tech-pkg@ as:
[PATCH 05/11] Expect a FILE * for pgp_decrypt_seckey()

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
cvs rdiff -u -r1.33 -r1.34 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.54
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53	Mon Mar 27 21:00:43 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Mon Mar 27 21:06:50 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.53 2017/03/27 21:00:43 khorben Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.54 2017/03/27 21:06:50 khorben Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -302,7 +302,7 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_
 \return secret key
 */
 pgp_seckey_t *
-pgp_decrypt_seckey(const pgp_key_t *key, void *passfp)
+pgp_decrypt_seckey(const pgp_key_t *key, FILE *passfp)
 {
 	pgp_stream_t	*stream;
 	const int	 printerrors = 1;

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.34
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33	Mon Mar 27 20:55:13 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h	Mon Mar 27 21:06:50 2017
@@ -53,6 +53,7 @@
 #ifndef KEYRING_H_
 #define KEYRING_H_
 
+#include 
 #include "packet.h"
 #include "packet-parse.h"
 #include "mj.h"
@@ -91,7 +92,7 @@ const pgp_pubkey_t *pgp_get_pubkey(const
 unsigned   pgp_is_key_secret(const pgp_key_t *);
 const pgp_seckey_t *pgp_get_seckey(const pgp_key_t *);
 pgp_seckey_t *pgp_get_writable_seckey(pgp_key_t *);
-pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, void *);
+pgp_seckey_t *pgp_decrypt_seckey(const pgp_key_t *, FILE *);
 
 unsigned   pgp_keyring_fileread(pgp_keyring_t *, const unsigned,
 	const char *);



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 21:00:43 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c

Log Message:
Do not use random data for pass-phrases on EOF

Submitted on tech-pkg@ as:
[PATCH 04/11] Do not use random data for pass-phrases on EOF

Only modified for consistency with the coding style.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.53
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52	Mon Mar 27 20:55:13 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Mon Mar 27 21:00:43 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.52 2017/03/27 20:55:13 khorben Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.53 2017/03/27 21:00:43 khorben Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -244,7 +244,9 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_
 		break;
 
 	case PGP_GET_PASSPHRASE:
-		(void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass));
+		if (pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass)) == 0) {
+			pass[0] = '\0';
+		}
 		*content->skey_passphrase.passphrase = netpgp_strdup(pass);
 		pgp_forget(pass, sizeof(pass));
 		return PGP_KEEP_MEMORY;



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 20:55:13 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c keyring.h
netpgp.c

Log Message:
Avoid some type casts

Submitted on tech-pkg@ as:
[PATCH 03/11] Avoid some type casts

No functional change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
cvs rdiff -u -r1.32 -r1.33 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h
cvs rdiff -u -r1.100 -r1.101 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.52
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51	Mon Feb 20 00:51:08 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Mon Mar 27 20:55:13 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.51 2017/02/20 00:51:08 khorben Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.52 2017/03/27 20:55:13 khorben Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -214,7 +214,7 @@ pgp_get_writable_seckey(pgp_key_t *data)
 
 /* utility function to zero out memory */
 void
-pgp_forget(void *vp, unsigned size)
+pgp_forget(void *vp, size_t size)
 {
 	(void) memset(vp, 0x0, size);
 }
@@ -246,7 +246,7 @@ decrypt_cb(const pgp_packet_t *pkt, pgp_
 	case PGP_GET_PASSPHRASE:
 		(void) pgp_getpassphrase(decrypt->passfp, pass, sizeof(pass));
 		*content->skey_passphrase.passphrase = netpgp_strdup(pass);
-		pgp_forget(pass, (unsigned)sizeof(pass));
+		pgp_forget(pass, sizeof(pass));
 		return PGP_KEEP_MEMORY;
 
 	case PGP_PARSER_ERRCODE:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.32 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.33
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h:1.32	Sun Nov  7 08:39:59 2010
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.h	Mon Mar 27 20:55:13 2017
@@ -100,7 +100,7 @@ int pgp_keyring_list(pgp_io_t *, const p
 int pgp_keyring_json(pgp_io_t *, const pgp_keyring_t *, mj_t *, const int);
 
 void pgp_set_seckey(pgp_contents_t *, const pgp_key_t *);
-void pgp_forget(void *, unsigned);
+void pgp_forget(void *, size_t);
 
 const uint8_t *pgp_get_key_id(const pgp_key_t *);
 unsigned pgp_get_userid_count(const pgp_key_t *);

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.101
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100	Fri Feb 24 01:26:17 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Mon Mar 27 20:55:13 2017
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.100 2017/02/24 01:26:17 khorben Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.101 2017/03/27 20:55:13 khorben Exp $");
 #endif
 
 #include 
@@ -1411,7 +1411,7 @@ netpgp_sign_file(netpgp_t *netpgp,
 (unsigned)armored, (unsigned)cleartext,
 overwrite);
 	}
-	pgp_forget(seckey, (unsigned)sizeof(*seckey));
+	pgp_forget(seckey, sizeof(*seckey));
 	return ret;
 }
 
@@ -1542,7 +1542,7 @@ netpgp_sign_memory(netpgp_t *netpgp,
 	} else {
 		ret = 0;
 	}
-	pgp_forget(seckey, (unsigned)sizeof(*seckey));
+	pgp_forget(seckey, sizeof(*seckey));
 	return ret;
 }
 



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-03-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Mar 27 20:50:19 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: reader.c

Log Message:
Do not truncate pass-phrases without a newline character

This also fixes a crash when the pass-phrase entered is empty.

Submitted on tech-pkg@ as:
[PATCH 02/11] Do not truncate pass-phrases without a newline character

Only modified for consistency with the coding style.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 \
src/crypto/external/bsd/netpgp/dist/src/lib/reader.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.52
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51	Fri Feb 24 01:27:14 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c	Mon Mar 27 20:50:19 2017
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $");
+__RCSID("$NetBSD: reader.c,v 1.52 2017/03/27 20:50:19 khorben Exp $");
 #endif
 
 #include 
@@ -160,6 +160,7 @@ int
 pgp_getpassphrase(void *in, char *phrase, size_t size)
 {
 	char	*p;
+	size_t	 len;
 
 	if (in == NULL) {
 		while ((p = getpass("netpgp passphrase: ")) == NULL) {
@@ -169,7 +170,10 @@ pgp_getpassphrase(void *in, char *phrase
 		if (fgets(phrase, (int)size, in) == NULL) {
 			return 0;
 		}
-		phrase[strlen(phrase) - 1] = 0x0;
+		len = strlen(phrase);
+		if (len >= 1 && phrase[len - 1] == '\n') {
+			phrase[len - 1] = '\0';
+		}
 	}
 	return 1;
 }



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-02-23 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Feb 24 01:27:14 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: reader.c

Log Message:
Revert "Remove a useless loop around getpass()"

getpass(3) may return NULL upon failures on Linux, and netpgp should remain
portable to other systems.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 \
src/crypto/external/bsd/netpgp/dist/src/lib/reader.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.51
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50	Mon Feb 20 01:33:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c	Fri Feb 24 01:27:14 2017
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $");
+__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $");
 #endif
 
 #include 
@@ -162,7 +162,8 @@ pgp_getpassphrase(void *in, char *phrase
 	char	*p;
 
 	if (in == NULL) {
-		p = getpass("netpgp passphrase: ");
+		while ((p = getpass("netpgp passphrase: ")) == NULL) {
+		}
 		(void) snprintf(phrase, size, "%s", p);
 	} else {
 		if (fgets(phrase, (int)size, in) == NULL) {



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

2017-02-23 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Feb 24 01:26:17 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c
src/crypto/external/bsd/netpgp/dist/src/librsa: rsastubs.c

Log Message:
Revert "Remove a useless loop around getpass()"

getpass(3) may return NULL upon failures on Linux, and netpgp should remain
portable to other systems.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.3 -r1.4 \
src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.99 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.100
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.99	Mon Feb 20 01:38:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Fri Feb 24 01:26:17 2017
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.99 2017/02/20 01:38:28 khorben Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.100 2017/02/24 01:26:17 khorben Exp $");
 #endif
 
 #include 
@@ -740,10 +740,14 @@ find_passphrase(FILE *passfp, const char
 	}
 	for (i = 0 ; i < attempts ; i++) {
 		(void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id);
-		cp = getpass(prompt);
+		if ((cp = getpass(prompt)) == NULL) {
+			break;
+		}
 		cc = snprintf(buf, sizeof(buf), "%s", cp);
 		(void) snprintf(prompt, sizeof(prompt), "Repeat passphrase for %.16s: ", id);
-		cp = getpass(prompt);
+		if ((cp = getpass(prompt)) == NULL) {
+			break;
+		}
 		cc = snprintf(passphrase, size, "%s", cp);
 		if (strcmp(buf, passphrase) == 0) {
 			(void) memset(buf, 0x0, sizeof(buf));

Index: src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c
diff -u src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.3 src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.4
--- src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.3	Mon Feb 20 01:38:28 2017
+++ src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c	Fri Feb 24 01:26:17 2017
@@ -43,7 +43,9 @@ pass_cb(char *buf, int size, int rwflag,
 
 	USE_ARG(rwflag);
 	snprintf(prompt, sizeof(prompt), "\"%s\" passphrase: ", (char *)u);
-	passphrase = getpass(prompt);
+	if ((passphrase = getpass(prompt)) == NULL) {
+		return -1;
+	}
 	(void) memcpy(buf, passphrase, (size_t)size);
 	return (int)strlen(passphrase);
 }



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

2017-02-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Feb 20 01:38:28 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: netpgp.c
src/crypto/external/bsd/netpgp/dist/src/librsa: rsastubs.c

Log Message:
Remove a useless loop around getpass()

According to getpass(3), this library function cannot return NULL.
Verified with a source code inspection.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 \
src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.98 src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.99
--- src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c:1.98	Tue Jun 28 16:34:40 2016
+++ src/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c	Mon Feb 20 01:38:28 2017
@@ -34,7 +34,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.98 2016/06/28 16:34:40 christos Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.99 2017/02/20 01:38:28 khorben Exp $");
 #endif
 
 #include 
@@ -740,14 +740,10 @@ find_passphrase(FILE *passfp, const char
 	}
 	for (i = 0 ; i < attempts ; i++) {
 		(void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id);
-		if ((cp = getpass(prompt)) == NULL) {
-			break;
-		}
+		cp = getpass(prompt);
 		cc = snprintf(buf, sizeof(buf), "%s", cp);
 		(void) snprintf(prompt, sizeof(prompt), "Repeat passphrase for %.16s: ", id);
-		if ((cp = getpass(prompt)) == NULL) {
-			break;
-		}
+		cp = getpass(prompt);
 		cc = snprintf(passphrase, size, "%s", cp);
 		if (strcmp(buf, passphrase) == 0) {
 			(void) memset(buf, 0x0, sizeof(buf));

Index: src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c
diff -u src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.2 src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.3
--- src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c:1.2	Tue Nov 20 05:26:25 2012
+++ src/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c	Mon Feb 20 01:38:28 2017
@@ -43,9 +43,7 @@ pass_cb(char *buf, int size, int rwflag,
 
 	USE_ARG(rwflag);
 	snprintf(prompt, sizeof(prompt), "\"%s\" passphrase: ", (char *)u);
-	if ((passphrase = getpass(prompt)) == NULL) {
-		return -1;
-	}
+	passphrase = getpass(prompt);
 	(void) memcpy(buf, passphrase, (size_t)size);
 	return (int)strlen(passphrase);
 }



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-02-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Feb 20 01:33:28 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: reader.c

Log Message:
Remove a useless loop around getpass()

According to getpass(3), this library function cannot return NULL.
Verified with a source code inspection.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 \
src/crypto/external/bsd/netpgp/dist/src/lib/reader.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/reader.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.49 src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.50
--- src/crypto/external/bsd/netpgp/dist/src/lib/reader.c:1.49	Mon Mar  5 02:20:18 2012
+++ src/crypto/external/bsd/netpgp/dist/src/lib/reader.c	Mon Feb 20 01:33:28 2017
@@ -54,7 +54,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.49 2012/03/05 02:20:18 christos Exp $");
+__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $");
 #endif
 
 #include 
@@ -162,8 +162,7 @@ pgp_getpassphrase(void *in, char *phrase
 	char	*p;
 
 	if (in == NULL) {
-		while ((p = getpass("netpgp passphrase: ")) == NULL) {
-		}
+		p = getpass("netpgp passphrase: ");
 		(void) snprintf(phrase, size, "%s", p);
 	} else {
 		if (fgets(phrase, (int)size, in) == NULL) {



CVS commit: src/crypto/external/bsd/netpgp/dist/src/lib

2017-02-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Feb 20 00:51:08 UTC 2017

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/lib: keyring.c

Log Message:
Do not crash when listing keys without a keyring

To test: (with an empty ~/.gnupg)
$ netpgpkeys --import-key /dev/null

Submitted on tech-pkg@ as:
[PATCH 01/11] Do not crash when listing keys without a keyring

Different patch for the same issue.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 \
src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c
diff -u src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.50 src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.51
--- src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c:1.50	Sat Jun 25 00:37:44 2011
+++ src/crypto/external/bsd/netpgp/dist/src/lib/keyring.c	Mon Feb 20 00:51:08 2017
@@ -57,7 +57,7 @@
 
 #if defined(__NetBSD__)
 __COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: keyring.c,v 1.50 2011/06/25 00:37:44 agc Exp $");
+__RCSID("$NetBSD: keyring.c,v 1.51 2017/02/20 00:51:08 khorben Exp $");
 #endif
 
 #ifdef HAVE_FCNTL_H
@@ -993,9 +993,12 @@ pgp_keyring_list(pgp_io_t *io, const pgp
 {
 	pgp_key_t		*key;
 	unsigned		 n;
+	unsigned		 keyc = (keyring != NULL) ? keyring->keyc : 0;
 
-	(void) fprintf(io->res, "%u key%s\n", keyring->keyc,
-		(keyring->keyc == 1) ? "" : "s");
+	(void) fprintf(io->res, "%u key%s\n", keyc, (keyc == 1) ? "" : "s");
+	if (keyring == NULL) {
+		return 1;
+	}
 	for (n = 0, key = keyring->keys; n < keyring->keyc; ++n, ++key) {
 		if (pgp_is_key_secret(key)) {
 			pgp_print_keydata(io, keyring, key, "sec",



CVS commit: src/sys/dev/pci

2017-01-30 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jan 31 00:58:15 UTC 2017

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

Log Message:
Always allow hdaudio(4) to suspend

Sometimes hdaudio(4) can fail to attach, but the device remains in the
tree. Even though the PMF registration is performed, it is explicitly
de-registered in the code path for errors - therefore preventing suspending
later. This patch makes sure PMF registration is performed accordingly upon
errors as well.

No objection on tech-kern@.

Tested on a Lenovo ThinkPad T440s (amd64).

XXX pull-up to netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio_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/hdaudio_pci.c
diff -u src/sys/dev/pci/hdaudio_pci.c:1.5 src/sys/dev/pci/hdaudio_pci.c:1.6
--- src/sys/dev/pci/hdaudio_pci.c:1.5	Fri Dec 16 11:34:52 2016
+++ src/sys/dev/pci/hdaudio_pci.c	Tue Jan 31 00:58:15 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_pci.c,v 1.5 2016/12/16 11:34:52 nonaka Exp $ */
+/* $NetBSD: hdaudio_pci.c,v 1.6 2017/01/31 00:58:15 khorben Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.5 2016/12/16 11:34:52 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_pci.c,v 1.6 2017/01/31 00:58:15 khorben Exp $");
 
 #include 
 #include 
@@ -157,9 +157,6 @@ hdaudio_pci_attach(device_t parent, devi
 	}
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
-	if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
-		aprint_error_dev(self, "couldn't establish power handler\n");
-
 	hdaudio_pci_reinit(sc);
 
 	/* Attach bus-independent HD audio layer */
@@ -176,8 +173,12 @@ hdaudio_pci_attach(device_t parent, devi
 		csr &= ~(PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_BACKTOBACK_ENABLE);
 		pci_conf_write(sc->sc_pc, sc->sc_tag,
 		PCI_COMMAND_STATUS_REG, csr);
-		pmf_device_deregister(self);
+
+		if (!pmf_device_register(self, NULL, NULL))
+			aprint_error_dev(self, "couldn't establish power handler\n");
 	}
+	else if (!pmf_device_register(self, NULL, hdaudio_pci_resume))
+		aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 static int



CVS commit: src/sys/dev/pci

2017-01-09 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jan  9 10:42:45 UTC 2017

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

Log Message:
Do not use the "flags" field uninitialized

A backport if iwm(4) (to netbsd-7) does not build without this change.

LGTM nonaka@


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.54 src/sys/dev/pci/if_iwm.c:1.55
--- src/sys/dev/pci/if_iwm.c:1.54	Mon Jan  9 09:15:54 2017
+++ src/sys/dev/pci/if_iwm.c	Mon Jan  9 10:42:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.54 2017/01/09 09:15:54 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.55 2017/01/09 10:42:45 khorben Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.147 2016/11/17 14:12:33 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -107,7 +107,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.54 2017/01/09 09:15:54 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.55 2017/01/09 10:42:45 khorben Exp $");
 
 #include 
 #include 
@@ -4500,6 +4500,8 @@ iwm_power_update_device(struct iwm_softc
 	struct iwm_device_power_cmd cmd = {
 #ifdef notyet
 		.flags = htole16(IWM_DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK),
+#else
+		.flags = 0,
 #endif
 	};
 



CVS commit: src/external/bsd/ipf/dist/man

2016-12-25 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Dec 26 00:11:14 UTC 2016

Modified Files:
src/external/bsd/ipf/dist/man: ipnat.5

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ipf/dist/man/ipnat.5

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

Modified files:

Index: src/external/bsd/ipf/dist/man/ipnat.5
diff -u src/external/bsd/ipf/dist/man/ipnat.5:1.4 src/external/bsd/ipf/dist/man/ipnat.5:1.5
--- src/external/bsd/ipf/dist/man/ipnat.5:1.4	Tue Aug 11 16:06:52 2015
+++ src/external/bsd/ipf/dist/man/ipnat.5	Mon Dec 26 00:11:14 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ipnat.5,v 1.4 2015/08/11 16:06:52 prlw1 Exp $
+.\"	$NetBSD: ipnat.5,v 1.5 2016/12/26 00:11:14 khorben Exp $
 .\"
 .TH IPNAT 5
 .SH NAME
@@ -418,7 +418,7 @@ rdr le0 0/0 port 80-88 -> 127.0.0.1 port
 .fi
 .PP
 then port 80 would become 3128, port 81 would become 3129, etc.  If we
-want to redirect a number of different pots to just a single port, an
+want to redirect a number of different ports to just a single port, an
 equals sign ("=") is placed before the port number on the RHS like this:
 .nf
 



CVS commit: src/sbin

2016-05-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri May  6 00:24:45 UTC 2016

Modified Files:
src/sbin/modload: main.c
src/sbin/modunload: main.c

Log Message:
More friendly error messages for modload(8) and modunload(8)

Tested on NetBSD/amd64.

>From Christian Koch (cfkoch@) of EdgeBSD; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sbin/modload/main.c
cvs rdiff -u -r1.4 -r1.5 src/sbin/modunload/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/sbin/modload/main.c
diff -u src/sbin/modload/main.c:1.15 src/sbin/modload/main.c:1.16
--- src/sbin/modload/main.c:1.15	Thu Feb  7 12:04:01 2013
+++ src/sbin/modload/main.c	Fri May  6 00:24:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.15 2013/02/07 12:04:01 apb Exp $	*/
+/*	$NetBSD: main.c,v 1.16 2016/05/06 00:24:45 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.15 2013/02/07 12:04:01 apb Exp $");
+__RCSID("$NetBSD: main.c,v 1.16 2016/05/06 00:24:45 khorben Exp $");
 #endif /* !lint */
 
 #include 
@@ -170,7 +170,7 @@ main(int argc, char **argv)
 		cmdargs.ml_propslen = strlen(propsstr);
 
 		if (prog_modctl(MODCTL_LOAD, )) {
-			err(EXIT_FAILURE, NULL);
+			err(EXIT_FAILURE, "%s", cmdargs.ml_filename);
 		}
 	}
 

Index: src/sbin/modunload/main.c
diff -u src/sbin/modunload/main.c:1.4 src/sbin/modunload/main.c:1.5
--- src/sbin/modunload/main.c:1.4	Mon Dec 13 20:48:45 2010
+++ src/sbin/modunload/main.c	Fri May  6 00:24:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.4 2010/12/13 20:48:45 pooka Exp $	*/
+/*	$NetBSD: main.c,v 1.5 2016/05/06 00:24:45 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: main.c,v 1.4 2010/12/13 20:48:45 pooka Exp $");
+__RCSID("$NetBSD: main.c,v 1.5 2016/05/06 00:24:45 khorben Exp $");
 #endif /* !lint */
 
 #include 
@@ -57,7 +57,7 @@ main(int argc, char **argv)
 
 	for (i = 1; i < argc; i++) {
 		if (prog_modctl(MODCTL_UNLOAD, argv[i])) {
-			err(EXIT_FAILURE, NULL);
+			err(EXIT_FAILURE, "%s", argv[i]);
 		}
 	}
 



CVS commit: src/sys/dev/splash

2016-04-25 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Apr 25 22:26:50 UTC 2016

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

Log Message:
Do not panic if the splash screen is bigger than the framebuffer

This fixes a kernel crash if the splash screen does not fit inside the
framebuffer. It should probably be truncated (and optionally centered)
instead, but this avoids a panic in the meantime.

Tested on NetBSD/amd64 with a vesa framebuffer.

>From Christian Koch (cfkoch@) of EdgeBSD; thanks!

XXX pull-up(s)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/splash/splash.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/splash/splash.c
diff -u src/sys/dev/splash/splash.c:1.12 src/sys/dev/splash/splash.c:1.13
--- src/sys/dev/splash/splash.c:1.12	Sat Jun  2 14:24:00 2012
+++ src/sys/dev/splash/splash.c	Mon Apr 25 22:26:50 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $ */
+/* $NetBSD: splash.c,v 1.13 2016/04/25 22:26:50 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006 Jared D. McNeill 
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.12 2012/06/02 14:24:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: splash.c,v 1.13 2016/04/25 22:26:50 khorben Exp $");
 
 #include "opt_splash.h"
 
@@ -195,6 +195,14 @@ splash_render(struct splash_info *si, in
 	aprint_debug("%s: splash loaded, width %d height %d comp %d\n",
 	__func__, width, height, comp);
 
+	if ((width > si->si_width) || (height > si->si_height)) {
+		aprint_error(
+			"WARNING: splash size (%dx%d) too big for framebuffer (%dx%d)\n",
+			width, height, si->si_width, si->si_height);
+		stbi_image_free(data);
+		return EINVAL;
+	}
+
 	/* XXX */
 	if (flg & SPLASH_F_CENTER) {
 		xoff = (si->si_width - width) / 2;



CVS commit: src/sys

2016-03-20 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Mar 20 14:58:11 UTC 2016

Modified Files:
src/sys/kern: kern_exec.c kern_pax.c
src/sys/sys: pax.h

Log Message:
Let PaX ASLR know about the current emulation

This effectively fixes PaX ASLR with 32-bits emulation on 64-bits
platforms. Without this knowledge, the offset applied for 32-bits
programs was really meant for a 64-bits address space - thus
shifting the address up to 12 bits, with a success rate of about
1/4096. This offset is calculated once in the lifetime of the
process, which therefore behaved normally when able to start.

Fixes kern/50469, probably also kern/50986

Tested on NetBSD/amd64 (emul_netbsd32)


To generate a diff of this commit:
cvs rdiff -u -r1.423 -r1.424 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.34 -r1.35 src/sys/kern/kern_pax.c
cvs rdiff -u -r1.17 -r1.18 src/sys/sys/pax.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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.423 src/sys/kern/kern_exec.c:1.424
--- src/sys/kern/kern_exec.c:1.423	Mon Nov 30 22:47:19 2015
+++ src/sys/kern/kern_exec.c	Sun Mar 20 14:58:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.423 2015/11/30 22:47:19 pgoyette Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.424 2016/03/20 14:58:10 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.423 2015/11/30 22:47:19 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.424 2016/03/20 14:58:10 khorben Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1160,7 +1160,7 @@ execve_runproc(struct lwp *l, struct exe
 	vm->vm_minsaddr = (void *)epp->ep_minsaddr;
 
 #ifdef PAX_ASLR
-	pax_aslr_init_vm(l, vm);
+	pax_aslr_init_vm(l, vm, epp);
 #endif /* PAX_ASLR */
 
 	/* Now map address space. */

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.34 src/sys/kern/kern_pax.c:1.35
--- src/sys/kern/kern_pax.c:1.34	Sat Mar 19 18:56:37 2016
+++ src/sys/kern/kern_pax.c	Sun Mar 20 14:58:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.34 2016/03/19 18:56:37 christos Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.35 2016/03/20 14:58:10 khorben Exp $	*/
 
 /*
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.34 2016/03/19 18:56:37 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v 1.35 2016/03/20 14:58:10 khorben Exp $");
 
 #include "opt_pax.h"
 
@@ -86,6 +86,7 @@ __KERNEL_RCSID(0, "$NetBSD: kern_pax.c,v
 
 #ifdef PAX_ASLR
 #include 
+#include 
 
 int pax_aslr_enabled = 1;
 int pax_aslr_global = PAX_ASLR;
@@ -399,13 +400,18 @@ pax_aslr_active(struct lwp *l)
 }
 
 void
-pax_aslr_init_vm(struct lwp *l, struct vmspace *vm)
+pax_aslr_init_vm(struct lwp *l, struct vmspace *vm, struct exec_package *ep)
 {
 	if (!pax_aslr_active(l))
 		return;
 
-	vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
-	PAX_ASLR_DELTA_MMAP_LSB, PAX_ASLR_DELTA_MMAP_LEN);
+	if (ep->ep_flags & EXEC_32)
+		vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
+		PAX_ASLR_DELTA_MMAP_LSB,
+		(sizeof(netbsd32_pointer_t) * NBBY) / 2);
+	else
+		vm->vm_aslr_delta_mmap = PAX_ASLR_DELTA(cprng_fast32(),
+		PAX_ASLR_DELTA_MMAP_LSB, PAX_ASLR_DELTA_MMAP_LEN);
 	PAX_DPRINTF("delta_mmap=%#jx", vm->vm_aslr_delta_mmap);
 }
 

Index: src/sys/sys/pax.h
diff -u src/sys/sys/pax.h:1.17 src/sys/sys/pax.h:1.18
--- src/sys/sys/pax.h:1.17	Sat Mar 19 18:56:37 2016
+++ src/sys/sys/pax.h	Sun Mar 20 14:58:11 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: pax.h,v 1.17 2016/03/19 18:56:37 christos Exp $ */
+/* $NetBSD: pax.h,v 1.18 2016/03/20 14:58:11 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006 Elad Efrat 
@@ -62,7 +62,7 @@ int pax_segvguard(struct lwp *, struct v
 
 bool pax_aslr_epp_active(struct exec_package *);
 bool pax_aslr_active(struct lwp *);
-void pax_aslr_init_vm(struct lwp *, struct vmspace *);
+void pax_aslr_init_vm(struct lwp *, struct vmspace *, struct exec_package *);
 void pax_aslr_stack(struct exec_package *, u_long *);
 void pax_aslr_mmap(struct lwp *, vaddr_t *, vaddr_t, int);
 



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

2016-03-19 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Mar 17 04:07:42 UTC 2016

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

Log Message:
Fix matching of ICMP queries when NAT'd through IPF

This notably fixes MTU updates for hosts issueing ICMP queries through a
NAT performed by NetBSD with IPF.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/ipf/netinet/ip_nat.c

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

Modified files:

Index: src/sys/external/bsd/ipf/netinet/ip_nat.c
diff -u src/sys/external/bsd/ipf/netinet/ip_nat.c:1.15 src/sys/external/bsd/ipf/netinet/ip_nat.c:1.16
--- src/sys/external/bsd/ipf/netinet/ip_nat.c:1.15	Tue Oct  6 10:21:08 2015
+++ src/sys/external/bsd/ipf/netinet/ip_nat.c	Thu Mar 17 04:07:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_nat.c,v 1.15 2015/10/06 10:21:08 prlw1 Exp $	*/
+/*	$NetBSD: ip_nat.c,v 1.16 2016/03/17 04:07:41 khorben Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -113,7 +113,7 @@ extern struct ifnet vpnif;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.15 2015/10/06 10:21:08 prlw1 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_nat.c,v 1.16 2016/03/17 04:07:41 khorben Exp $");
 #else
 static const char sccsid[] = "@(#)ip_nat.c	1.11 6/5/96 (C) 1995 Darren Reed";
 static const char rcsid[] = "@(#)Id: ip_nat.c,v 1.1.1.2 2012/07/22 13:45:27 darrenr Exp";
@@ -4032,13 +4032,8 @@ ipf_nat_inlookup(fr_info_t *fin, u_int f
 		dport = htons(fin->fin_data[1]);
 		break;
 	case IPPROTO_ICMP :
-		if (flags & IPN_ICMPERR) {
-			sport = fin->fin_data[1];
-			dport = 0;
-		} else {
-			dport = fin->fin_data[1];
-			sport = 0;
-		}
+		sport = 0;
+		dport = fin->fin_data[1];
 		break;
 	default :
 		sport = 0;
@@ -4353,8 +4348,6 @@ ipf_nat_outlookup(fr_info_t *fin, u_int 
 	u_int hv;
 
 	ifp = fin->fin_ifp;
-	sport = 0;
-	dport = 0;
 
 	switch (p)
 	{
@@ -4364,12 +4357,12 @@ ipf_nat_outlookup(fr_info_t *fin, u_int 
 		dport = htons(fin->fin_data[1]);
 		break;
 	case IPPROTO_ICMP :
-		if (flags & IPN_ICMPERR)
-			sport = fin->fin_data[1];
-		else
-			dport = fin->fin_data[1];
+		sport = 0;
+		dport = fin->fin_data[1];
 		break;
 	default :
+		sport = 0;
+		dport = 0;
 		break;
 	}
 



CVS commit: src/sys/compat

2016-02-28 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Feb 28 23:24:36 UTC 2016

Modified Files:
src/sys/compat/netbsd32: netbsd32_netbsd.c
src/sys/compat/sunos32: sunos32_misc.c
src/sys/compat/svr4_32: svr4_32_misc.c

Log Message:
Add missing newline character in error message

This is related to kern/50469.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/compat/netbsd32/netbsd32_netbsd.c
cvs rdiff -u -r1.76 -r1.77 src/sys/compat/sunos32/sunos32_misc.c
cvs rdiff -u -r1.75 -r1.76 src/sys/compat/svr4_32/svr4_32_misc.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_netbsd.c
diff -u src/sys/compat/netbsd32/netbsd32_netbsd.c:1.198 src/sys/compat/netbsd32/netbsd32_netbsd.c:1.199
--- src/sys/compat/netbsd32/netbsd32_netbsd.c:1.198	Tue Dec  1 02:20:43 2015
+++ src/sys/compat/netbsd32/netbsd32_netbsd.c	Sun Feb 28 23:24:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_netbsd.c,v 1.198 2015/12/01 02:20:43 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_netbsd.c,v 1.199 2016/02/28 23:24:35 khorben Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001, 2008 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.198 2015/12/01 02:20:43 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_netbsd.c,v 1.199 2016/02/28 23:24:35 khorben Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -1537,7 +1537,7 @@ netbsd32_mmap(struct lwp *l, const struc
 #endif
 	error = sys_mmap(l, , retval);
 	if ((u_long)*retval > (u_long)UINT_MAX) {
-		printf("netbsd32_mmap: retval out of range: 0x%lx",
+		printf("netbsd32_mmap: retval out of range: 0x%lx\n",
 		(u_long)*retval);
 		/* Should try to recover and return an error here. */
 	}

Index: src/sys/compat/sunos32/sunos32_misc.c
diff -u src/sys/compat/sunos32/sunos32_misc.c:1.76 src/sys/compat/sunos32/sunos32_misc.c:1.77
--- src/sys/compat/sunos32/sunos32_misc.c:1.76	Fri Oct 23 19:40:11 2015
+++ src/sys/compat/sunos32/sunos32_misc.c	Sun Feb 28 23:24:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunos32_misc.c,v 1.76 2015/10/23 19:40:11 maxv Exp $	*/
+/*	$NetBSD: sunos32_misc.c,v 1.77 2016/02/28 23:24:35 khorben Exp $	*/
 /* from :NetBSD: sunos_misc.c,v 1.107 2000/12/01 19:25:10 jdolecek Exp	*/
 
 /*
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.76 2015/10/23 19:40:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunos32_misc.c,v 1.77 2016/02/28 23:24:35 khorben Exp $");
 
 #define COMPAT_SUNOS 1
 
@@ -758,7 +758,7 @@ sunos32_sys_mmap(struct lwp *l, const st
 
 	error = sys_mmap(l, , retval);
 	if ((u_long)*retval > (u_long)UINT_MAX) {
-		printf("sunos32_mmap: retval out of range: 0x%lx",
+		printf("sunos32_mmap: retval out of range: 0x%lx\n",
 		   (u_long)*retval);
 		/* Should try to recover and return an error here. */
 	}

Index: src/sys/compat/svr4_32/svr4_32_misc.c
diff -u src/sys/compat/svr4_32/svr4_32_misc.c:1.75 src/sys/compat/svr4_32/svr4_32_misc.c:1.76
--- src/sys/compat/svr4_32/svr4_32_misc.c:1.75	Fri Sep  5 09:21:55 2014
+++ src/sys/compat/svr4_32/svr4_32_misc.c	Sun Feb 28 23:24:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: svr4_32_misc.c,v 1.75 2014/09/05 09:21:55 matt Exp $	 */
+/*	$NetBSD: svr4_32_misc.c,v 1.76 2016/02/28 23:24:36 khorben Exp $	 */
 
 /*-
  * Copyright (c) 1994, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.75 2014/09/05 09:21:55 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svr4_32_misc.c,v 1.76 2016/02/28 23:24:36 khorben Exp $");
 
 #include 
 #include 
@@ -490,7 +490,7 @@ svr4_32_sys_mmap(struct lwp *l, const st
 
 	error = sys_mmap(l, , retval);
 	if ((u_long)*retval > (u_long)UINT_MAX) {
-		printf("svr4_32_mmap: retval out of range: 0x%lx",
+		printf("svr4_32_mmap: retval out of range: 0x%lx\n",
 		   (u_long)*retval);
 		/* Should try to recover and return an error here. */
 	}
@@ -523,7 +523,7 @@ svr4_32_sys_mmap64(struct lwp *l, const 
 
 	error = sys_mmap(l, , retval);
 	if ((u_long)*retval > (u_long)UINT_MAX) {
-		printf("svr4_32_mmap64: retval out of range: 0x%lx",
+		printf("svr4_32_mmap64: retval out of range: 0x%lx\n",
 		   (u_long)*retval);
 		/* Should try to recover and return an error here. */
 	}



CVS commit: src/usr.sbin/syslogd

2016-01-04 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jan  5 00:41:30 UTC 2016

Modified Files:
src/usr.sbin/syslogd: syslog.conf.5

Log Message:
Typo


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/syslogd/syslog.conf.5

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

Modified files:

Index: src/usr.sbin/syslogd/syslog.conf.5
diff -u src/usr.sbin/syslogd/syslog.conf.5:1.21 src/usr.sbin/syslogd/syslog.conf.5:1.22
--- src/usr.sbin/syslogd/syslog.conf.5:1.21	Sun Nov 10 00:13:50 2013
+++ src/usr.sbin/syslogd/syslog.conf.5	Tue Jan  5 00:41:30 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: syslog.conf.5,v 1.21 2013/11/10 00:13:50 wiz Exp $
+.\"	$NetBSD: syslog.conf.5,v 1.22 2016/01/05 00:41:30 khorben Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -297,7 +297,7 @@ To ensure that kernel messages are writt
 calls
 .Xr fsync 2
 after writing messages from the kernel.
-Other messages are not synced explcitly.
+Other messages are not synced explicitly.
 You may disable syncing of files specified to receive kernel messages
 by prefixing the pathname with a minus sign
 .Ql - .



CVS commit: src/external/bsd/ipf/dist/man

2015-12-28 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Dec 28 19:32:22 UTC 2015

Modified Files:
src/external/bsd/ipf/dist/man: ipf.5

Log Message:
Correct the example for the port range syntax


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/ipf/dist/man/ipf.5

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

Modified files:

Index: src/external/bsd/ipf/dist/man/ipf.5
diff -u src/external/bsd/ipf/dist/man/ipf.5:1.4 src/external/bsd/ipf/dist/man/ipf.5:1.5
--- src/external/bsd/ipf/dist/man/ipf.5:1.4	Tue Mar 24 19:46:58 2015
+++ src/external/bsd/ipf/dist/man/ipf.5	Mon Dec 28 19:32:22 2015
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ipf.5,v 1.4 2015/03/24 19:46:58 apb Exp $
+.\"	$NetBSD: ipf.5,v 1.5 2015/12/28 19:32:22 khorben Exp $
 .\"
 .TH IPF 5
 .SH NAME
@@ -354,7 +354,7 @@ block in proto tcp from any port >= 1024
 pass in proto tcp from 10.1.0.0/24 to any port = 22
 block out proto udp from any to 10.1.1.1 port = 135
 pass in proto udp from 1.1.1.1 port = 123 to 10.1.1.1 port = 123
-pass in proto tcp from 127.0.0.0/8 to any port = 6000:6009
+pass in proto tcp from 127.0.0.0/8 to any port 6000:6009
 .fi
 .PP
 If there is no desire to mention any specific source or destintion



CVS commit: src/sys

2015-10-25 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Oct 25 22:48:23 UTC 2015

Modified Files:
src/sys/arch/amd64/conf: ALL
src/sys/arch/evbarm/conf: MMNET_GENERIC
src/sys/arch/i386/conf: ALL
src/sys/dev/pci: unichromefb.c

Log Message:
Remove references to SPLASHSCREEN_PROGRESS

To my knowledge this feature is no longer supported at the moment. The
manual page for wsdisplay(4) should probably also be updated to reflect
this situation.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/conf/ALL
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/evbarm/conf/MMNET_GENERIC
cvs rdiff -u -r1.396 -r1.397 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/unichromefb.c

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.31 src/sys/arch/amd64/conf/ALL:1.32
--- src/sys/arch/amd64/conf/ALL:1.31	Sat Sep 26 16:33:16 2015
+++ src/sys/arch/amd64/conf/ALL	Sun Oct 25 22:48:23 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.31 2015/09/26 16:33:16 maxv Exp $
+# $NetBSD: ALL,v 1.32 2015/10/25 22:48:23 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.31 $"
+#ident 		"ALL-$Revision: 1.32 $"
 
 maxusers	64		# estimated number of users
 
@@ -312,7 +312,6 @@ options 	WSDISPLAY_SCROLLSUPPORT
 #options 	VGA_RASTERCONSOLE
 # enable splash screen support; requires hw driver support
 #options 	SPLASHSCREEN
-#options 	SPLASHSCREEN_PROGRESS
 
 # Keylock support
 options 	KEYLOCK

Index: src/sys/arch/evbarm/conf/MMNET_GENERIC
diff -u src/sys/arch/evbarm/conf/MMNET_GENERIC:1.21 src/sys/arch/evbarm/conf/MMNET_GENERIC:1.22
--- src/sys/arch/evbarm/conf/MMNET_GENERIC:1.21	Sat Sep 26 11:16:12 2015
+++ src/sys/arch/evbarm/conf/MMNET_GENERIC	Sun Oct 25 22:48:23 2015
@@ -1,4 +1,4 @@
-# $NetBSD: MMNET_GENERIC,v 1.21 2015/09/26 11:16:12 maxv Exp $
+# $NetBSD: MMNET_GENERIC,v 1.22 2015/10/25 22:48:23 khorben Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include		"arch/evbarm/conf/std.mmnet"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.21 $"
+#ident 		"GENERIC-$Revision: 1.22 $"
 
 maxusers	32		# estimated number of users
 
@@ -240,7 +240,6 @@ options 	NFS_BOOT_DHCP,NFS_BOOT_BOOTPARA
 #options 	VGA_RASTERCONSOLE
 # enable splash screen support; requires hw driver support
 #options 	SPLASHSCREEN
-#options 	SPLASHSCREEN_PROGRESS
 
 # Kernel root file system and dump configuration.
 #config		netbsd root on sd0c type ffs

Index: src/sys/arch/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.396 src/sys/arch/i386/conf/ALL:1.397
--- src/sys/arch/i386/conf/ALL:1.396	Sat Sep 26 16:33:16 2015
+++ src/sys/arch/i386/conf/ALL	Sun Oct 25 22:48:23 2015
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.396 2015/09/26 16:33:16 maxv Exp $
+# $NetBSD: ALL,v 1.397 2015/10/25 22:48:23 khorben Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ALL-$Revision: 1.396 $"
+#ident 		"ALL-$Revision: 1.397 $"
 
 maxusers	64		# estimated number of users
 
@@ -311,7 +311,6 @@ options 	WSDISPLAY_SCROLLSUPPORT
 #options 	VGA_RASTERCONSOLE
 # enable splash screen support; requires hw driver support
 #options 	SPLASHSCREEN
-#options 	SPLASHSCREEN_PROGRESS
 
 # Keylock support
 options 	KEYLOCK

Index: src/sys/dev/pci/unichromefb.c
diff -u src/sys/dev/pci/unichromefb.c:1.18 src/sys/dev/pci/unichromefb.c:1.19
--- src/sys/dev/pci/unichromefb.c:1.18	Sat Jan 22 15:14:28 2011
+++ src/sys/dev/pci/unichromefb.c	Sun Oct 25 22:48:23 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: unichromefb.c,v 1.18 2011/01/22 15:14:28 cegger Exp $ */
+/* $NetBSD: unichromefb.c,v 1.19 2015/10/25 22:48:23 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 Jared D. McNeill 
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.18 2011/01/22 15:14:28 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: unichromefb.c,v 1.19 2015/10/25 22:48:23 khorben Exp $");
 
 #include 
 #include 
@@ -471,8 +471,6 @@ unichromefb_ioctl(void *v, void *vs, u_l
 		return 0;
 	case WSDISPLAYIO_SSPLASH:
 		return ENODEV;
-	case WSDISPLAYIO_SPROGRESS:
-		return ENODEV;
 
 	/* PCI config read/write passthrough. */
 	case PCI_IOC_CFGREAD:



CVS commit: src/sys/arch/i386/stand/boot

2015-06-11 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Jun 11 15:56:53 UTC 2015

Modified Files:
src/sys/arch/i386/stand/boot: boot2.c

Log Message:
Also document the splash command in boot(8)


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/i386/stand/boot/boot2.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/i386/stand/boot/boot2.c
diff -u src/sys/arch/i386/stand/boot/boot2.c:1.64 src/sys/arch/i386/stand/boot/boot2.c:1.65
--- src/sys/arch/i386/stand/boot/boot2.c:1.64	Fri Jan 16 03:45:53 2015
+++ src/sys/arch/i386/stand/boot/boot2.c	Thu Jun 11 15:56:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.64 2015/01/16 03:45:53 christos Exp $	*/
+/*	$NetBSD: boot2.c,v 1.65 2015/06/11 15:56:53 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -413,6 +413,7 @@ command_help(char *arg)
 	   modules {on|off|enabled|disabled}\n
 	   load {path_to_module}\n
 	   multiboot [xdNx:][filename] [args]\n
+	   splash {path_to_image_file}\n
 	   userconf {command}\n
 	   rndseed {path_to_rndseed_file}\n
 	   help|?\n



CVS commit: src/sys/arch

2015-04-23 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Apr 24 00:04:04 UTC 2015

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

Log Message:
Also use ACPI shutdown on Xen DOM0

No objection on port-xen@
ok gdt@


To generate a diff of this commit:
cvs rdiff -u -r1.211 -r1.212 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.753 -r1.754 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.211 src/sys/arch/amd64/amd64/machdep.c:1.212
--- src/sys/arch/amd64/amd64/machdep.c:1.211	Mon May 12 22:50:03 2014
+++ src/sys/arch/amd64/amd64/machdep.c	Fri Apr 24 00:04:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $	*/
+/*	$NetBSD: machdep.c,v 1.212 2015/04/24 00:04:04 khorben Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -111,7 +111,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.211 2014/05/12 22:50:03 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.212 2015/04/24 00:04:04 khorben Exp $);
 
 /* #define XENDEBUG_LOW  */
 
@@ -674,14 +674,13 @@ haltsys:
 	doshutdownhooks();
 
 if ((howto  RB_POWERDOWN) == RB_POWERDOWN) {
-#ifndef XEN
 #if NACPICA  0
 		if (s != IPL_NONE)
 			splx(s);
 
 		acpi_enter_sleep_state(ACPI_STATE_S5);
 #endif
-#else /* XEN */
+#ifdef XEN
 		HYPERVISOR_shutdown();
 #endif /* XEN */
 	}

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.753 src/sys/arch/i386/i386/machdep.c:1.754
--- src/sys/arch/i386/i386/machdep.c:1.753	Fri Jan 23 02:52:14 2015
+++ src/sys/arch/i386/i386/machdep.c	Fri Apr 24 00:04:04 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.753 2015/01/23 02:52:14 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.754 2015/04/24 00:04:04 khorben Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.753 2015/01/23 02:52:14 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.754 2015/04/24 00:04:04 khorben Exp $);
 
 #include opt_beep.h
 #include opt_compat_ibcs2.h
@@ -760,10 +760,6 @@ haltsys:
 	doshutdownhooks();
 
 	if ((howto  RB_POWERDOWN) == RB_POWERDOWN) {
-#ifdef XEN
-		HYPERVISOR_shutdown();
-		for (;;);
-#endif
 #if NACPICA  0
 		if (s != IPL_NONE)
 			splx(s);
@@ -772,6 +768,10 @@ haltsys:
 #else
 		__USE(s);
 #endif
+#ifdef XEN
+		HYPERVISOR_shutdown();
+		for (;;);
+#endif
 	}
 
 #ifdef MULTIPROCESSOR



CVS commit: src

2015-04-01 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Apr  2 00:12:58 UTC 2015

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

Log Message:
Fix for PR kern/48109 (and its duplicate kern/49807)

As provided by Takahiro HAYASHI in PR kern/48109. Additional error
registration in ipf(8) by myself. Changes tested with GENERIC and
XEN3_DOM0. Thanks!

XXX pull-up netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/ipf/dist/lib/interror.c
cvs rdiff -u -r1.15 -r1.16 src/sys/external/bsd/ipf/netinet/fil.c

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

Modified files:

Index: src/external/bsd/ipf/dist/lib/interror.c
diff -u src/external/bsd/ipf/dist/lib/interror.c:1.3 src/external/bsd/ipf/dist/lib/interror.c:1.4
--- src/external/bsd/ipf/dist/lib/interror.c:1.3	Wed May  8 18:20:14 2013
+++ src/external/bsd/ipf/dist/lib/interror.c	Thu Apr  2 00:12:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: interror.c,v 1.3 2013/05/08 18:20:14 christos Exp $	*/
+/*	$NetBSD: interror.c,v 1.4 2015/04/02 00:12:58 khorben Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -19,7 +19,7 @@ typedef	struct	{
 
 static ipf_error_entry_t *find_error __P((int));
 
-#define	IPF_NUM_ERRORS	475
+#define	IPF_NUM_ERRORS	476
 
 /*
  * NO REUSE OF NUMBERS!
@@ -179,6 +179,7 @@ static ipf_error_entry_t ipf_errors[IPF_
 	{	149,	object size validation failed for kernel copyout },
 	{	150,	error copying data out for kernel copyout },
 	{	151,	version mismatch for kernel copyout },
+	{	152,	direction does not match the group rule },
 /* -- */
 	{	10001,	could not find token for auth iterator },
 	{	10002,	write permissions require to add/remove auth rule },

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.15 src/sys/external/bsd/ipf/netinet/fil.c:1.16
--- src/sys/external/bsd/ipf/netinet/fil.c:1.15	Mon Jun 16 12:38:32 2014
+++ src/sys/external/bsd/ipf/netinet/fil.c	Thu Apr  2 00:12:58 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.15 2014/06/16 12:38:32 christos Exp $	*/
+/*	$NetBSD: fil.c,v 1.16 2015/04/02 00:12:58 khorben Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fil.c,v 1.15 2014/06/16 12:38:32 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: fil.c,v 1.16 2015/04/02 00:12:58 khorben Exp $);
 #else
 static const char sccsid[] = @(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed;
 static const char rcsid[] = @(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $;
@@ -4495,6 +4495,11 @@ frrequest(ipf_main_softc_t *softc, int u
 			if (addrem == 0) {
 fg = ipf_group_add(softc, group, NULL,
 		   fp-fr_flags, unit, set);
+if (fg == NULL) {
+	IPFERROR(152);
+	error = ESRCH;
+	goto donenolock;
+}
 fp-fr_grp = fg;
 			} else {
 fg = ipf_findgroup(softc, group, unit,



CVS commit: src/sys/dev/pci

2015-03-07 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Mar  7 11:52:53 UTC 2015

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

Log Message:
Avoid kmem_free(NULL) in iwm_read_firmware()

This code path can be hit if the firmware failed to load, for instance
if the file is not present on the filesystem. In this case
firmware_open() fails, and fw-fw_rawdata never gets allocated in the
first place.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/pci/if_iwm.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_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.26 src/sys/dev/pci/if_iwm.c:1.27
--- src/sys/dev/pci/if_iwm.c:1.26	Wed Mar  4 16:55:11 2015
+++ src/sys/dev/pci/if_iwm.c	Sat Mar  7 11:52:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.26 2015/03/04 16:55:11 nonaka Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.27 2015/03/07 11:52:53 khorben Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.35 2015/03/04 15:18:12 jsg Exp	*/
 
 /*
@@ -105,7 +105,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_iwm.c,v 1.26 2015/03/04 16:55:11 nonaka Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_iwm.c,v 1.27 2015/03/07 11:52:53 khorben Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -804,7 +804,7 @@ iwm_read_firmware(struct iwm_softc *sc)
 		fw-fw_status = IWM_FW_STATUS_DONE;
 	wakeup(sc-sc_fw);
 
-	if (error) {
+	if (error  fw-fw_rawdata != NULL) {
 		kmem_free(fw-fw_rawdata, fw-fw_rawsize);
 		fw-fw_rawdata = NULL;
 	}



CVS commit: src/common/lib/libc/arch/i386/string/small

2014-09-22 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Sep 22 20:31:56 UTC 2014

Modified Files:
src/common/lib/libc/arch/i386/string/small: strchr.S

Log Message:
Look for the character to locate before checking for the NUL character

As documented in PR port-i386/49208, this fixes strchr(s, '\0'), as used by
the FAT first-stage bootloader on x86 (bootxx_msdos).
strchr(s, '\0') is otherwise equivalent to strlen(string), which would
probably look nicer in the original file, dosfs.c from libsa.

Confirmed working in qemu and on real hardware.
ok joerg@

XXX pull-up to netbsd-6 and netbsd-7


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/i386/string/small/strchr.S

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

Modified files:

Index: src/common/lib/libc/arch/i386/string/small/strchr.S
diff -u src/common/lib/libc/arch/i386/string/small/strchr.S:1.2 src/common/lib/libc/arch/i386/string/small/strchr.S:1.3
--- src/common/lib/libc/arch/i386/string/small/strchr.S:1.2	Sat Mar 22 19:38:46 2014
+++ src/common/lib/libc/arch/i386/string/small/strchr.S	Mon Sep 22 20:31:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: strchr.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $	*/
+/*	$NetBSD: strchr.S,v 1.3 2014/09/22 20:31:56 khorben Exp $	*/
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -29,7 +29,7 @@
  */
 
 #include machine/asm.h
-	RCSID($NetBSD: strchr.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $)
+	RCSID($NetBSD: strchr.S,v 1.3 2014/09/22 20:31:56 khorben Exp $)
 
 ENTRY(strchr)
 	popl	%edx		/* Return address */
@@ -39,10 +39,10 @@ ENTRY(strchr)
 	pushl	%eax
 	pushl	%edx
 1:
-	cmpb	$0, 0(%eax)
-	je 2f
 	cmpb	%cl, 0(%eax)
 	je 3f
+	cmpb	$0, 0(%eax)
+	je 2f
 	incl	%eax
 	jmp 1b
 2:



CVS commit: src/etc/rc.d

2014-04-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sun Apr  6 17:13:57 UTC 2014

Modified Files:
src/etc/rc.d: dhcpcd

Log Message:
Allow the extra command reload to dhcpcd's rc script, letting it reload
its configuration and rebind directly via the script.

LGTM roy@


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/etc/rc.d/dhcpcd

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

Modified files:

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.2 src/etc/rc.d/dhcpcd:1.3
--- src/etc/rc.d/dhcpcd:1.2	Tue Jun 25 13:02:53 2013
+++ src/etc/rc.d/dhcpcd	Sun Apr  6 17:13:57 2014
@@ -9,6 +9,7 @@ $_rc_subr_loaded . /etc/rc.subr
 name=dhcpcd
 rcvar=$name
 command=/sbin/$name
+extra_commands=reload
 
 load_rc_config $name
 



CVS commit: src/sys/arch/evbarm/conf

2014-04-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Apr  5 23:45:11 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: BEAGLEBOARD OVERO

Log Message:
Fixed a typo


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/evbarm/conf/BEAGLEBOARD
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/evbarm/conf/OVERO

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/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.51 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.52
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.51	Sun Jun 30 21:38:56 2013
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Sat Apr  5 23:45:11 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.51 2013/06/30 21:38:56 rmind Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.52 2014/04/05 23:45:11 khorben Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -220,7 +220,7 @@ omapiic1	at obio0 addr 0x48072000 size 0
 omapiic2	at obio0 addr 0x4806 size 0x80
 iic*		at omapiic?
 
-# Power Managent and System Companion Device
+# Power Management and System Companion Device
 tps65950pm0	at iic0 addr 0x48
 tps65950pm1	at iic0 addr 0x49
 tps65950pm2	at iic0 addr 0x4a

Index: src/sys/arch/evbarm/conf/OVERO
diff -u src/sys/arch/evbarm/conf/OVERO:1.33 src/sys/arch/evbarm/conf/OVERO:1.34
--- src/sys/arch/evbarm/conf/OVERO:1.33	Tue Oct  1 11:24:49 2013
+++ src/sys/arch/evbarm/conf/OVERO	Sat Apr  5 23:45:11 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: OVERO,v 1.33 2013/10/01 11:24:49 kiyohara Exp $
+#	$NetBSD: OVERO,v 1.34 2014/04/05 23:45:11 khorben Exp $
 #
 #	OVERO -- Gumstix. Inc. Overo COMS platforms kernel
 #
@@ -188,7 +188,7 @@ omapiic0	at obio0 addr 0x4807 size 0
 omapiic1	at obio0 addr 0x4806 size 0x1000 intr 61	# I2C3
 iic*		at omapiic?
 
-# Power Managent and System Companion Device
+# Power Management and System Companion Device
 tps65950pm0	at iic0 addr 0x48
 tps65950pm1	at iic0 addr 0x49
 tps65950pm2	at iic0 addr 0x4a



CVS commit: src/sys/dev/usb

2014-04-05 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Apr  5 23:47:26 UTC 2014

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

Log Message:
Fixed a typo


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/dev/usb/files.usb

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

Modified files:

Index: src/sys/dev/usb/files.usb
diff -u src/sys/dev/usb/files.usb:1.131 src/sys/dev/usb/files.usb:1.132
--- src/sys/dev/usb/files.usb:1.131	Sun Mar 16 09:34:45 2014
+++ src/sys/dev/usb/files.usb	Sat Apr  5 23:47:26 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.usb,v 1.131 2014/03/16 09:34:45 martin Exp $
+#	$NetBSD: files.usb,v 1.132 2014/04/05 23:47:26 khorben Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -108,7 +108,7 @@ device	uep: wsmousedev, tpcalib
 attach	uep at usbdevif
 file	dev/usb/uep.c			uep			needs-flag
 
-# Cypress microcontroller based serial adpaters
+# Cypress microcontroller based serial adapters
 device	ucycom: hid
 attach	ucycom at uhidbus
 file	dev/usb/ucycom.c		ucycom			needs-flag



CVS commit: src/sys/dev/wscons

2014-03-13 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Fri Mar 14 05:03:19 UTC 2014

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

Log Message:
Fixed wrong cast and invalid array access in the calibration framework, as
documented in PR kern/45872. The AA() macro accessed sample coordinates as
long integers, whereas they are really stored as signed integers.

Fixes calibration on my Wetab device.


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

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

Modified files:

Index: src/sys/dev/wscons/mra.c
diff -u src/sys/dev/wscons/mra.c:1.5 src/sys/dev/wscons/mra.c:1.6
--- src/sys/dev/wscons/mra.c:1.5	Sat Sep 14 21:06:50 2013
+++ src/sys/dev/wscons/mra.c	Fri Mar 14 05:03:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $	*/
+/*	$NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $	*/
 
 /*
  * Copyright (c) 1999 Shin Takemura All rights reserved.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mra.c,v 1.5 2013/09/14 21:06:50 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: mra.c,v 1.6 2014/03/14 05:03:19 khorben Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -55,7 +55,7 @@ mra_Y_AX1_BX2_C(const int *y, int ys,
 //	int64_t SYY;
 	int64_t S1Y, S2Y;
 	int64_t A, B, C, M;
-#define AA(p, s, i)	(*((const long *)(((const char *)(p)) + (s) * (i
+#define AA(p, s, i)	(*((const int *)(((const char *)(p)) + (s) * (i
 #define X1(i)		AA(x1, x1s, i)
 #define X2(i)		AA(x2, x2s, i)
 #define Y(i)		AA(y, ys, i)



CVS commit: src/lib/libc/sys

2013-11-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Nov 28 02:46:37 UTC 2013

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

Log Message:
Fixed a typo in the example code for select(2)


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/lib/libc/sys/select.2

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

Modified files:

Index: src/lib/libc/sys/select.2
diff -u src/lib/libc/sys/select.2:1.39 src/lib/libc/sys/select.2:1.40
--- src/lib/libc/sys/select.2:1.39	Thu Apr  4 21:52:04 2013
+++ src/lib/libc/sys/select.2	Thu Nov 28 02:46:37 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: select.2,v 1.39 2013/04/04 21:52:04 wiz Exp $
+.\	$NetBSD: select.2,v 1.40 2013/11/28 02:46:37 khorben Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -211,7 +211,7 @@ main(int argc, char **argv)
 		break;
 
 	default:
-		printf(Data received on %d file desciptor(s)\en, ret);
+		printf(Data received on %d file descriptor(s)\en, ret);
 
 		/*
 		 * select(2) hands back a file descriptor set where



CVS commit: src/lib/libc/sys

2013-11-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu Nov 28 03:45:31 UTC 2013

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

Log Message:
The document date was not updated as it should have been.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/lib/libc/sys/select.2

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

Modified files:

Index: src/lib/libc/sys/select.2
diff -u src/lib/libc/sys/select.2:1.40 src/lib/libc/sys/select.2:1.41
--- src/lib/libc/sys/select.2:1.40	Thu Nov 28 02:46:37 2013
+++ src/lib/libc/sys/select.2	Thu Nov 28 03:45:31 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: select.2,v 1.40 2013/11/28 02:46:37 khorben Exp $
+.\	$NetBSD: select.2,v 1.41 2013/11/28 03:45:31 khorben Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)select.2	8.2 (Berkeley) 3/25/94
 .\
-.Dd October 18, 2008
+.Dd November 28, 2013
 .Dt SELECT 2
 .Os
 .Sh NAME



CVS commit: src/usr.bin/flock

2013-09-21 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Sat Sep 21 15:01:14 UTC 2013

Modified Files:
src/usr.bin/flock: flock.1

Log Message:
flock(1) really appeared first in NetBSD 6.1


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/flock/flock.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/flock/flock.1
diff -u src/usr.bin/flock/flock.1:1.8 src/usr.bin/flock/flock.1:1.9
--- src/usr.bin/flock/flock.1:1.8	Sat Nov  3 00:50:04 2012
+++ src/usr.bin/flock/flock.1	Sat Sep 21 15:01:14 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: flock.1,v 1.8 2012/11/03 00:50:04 wiz Exp $
+.\	$NetBSD: flock.1,v 1.9 2013/09/21 15:01:14 khorben Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -97,4 +97,4 @@ Obtain an exclusive lock.
 An
 .Nm
 utility appeared in
-.Nx 7.0 .
+.Nx 6.1 .



CVS commit: src/external/bsd/pkg_install/dist/lib

2013-09-11 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep 11 12:59:19 UTC 2013

Modified Files:
src/external/bsd/pkg_install/dist/lib: pkg_signature.c

Log Message:
Fixed installation of signed packages. Some variables part of struct
signature_archive were not initialized properly, therefore randomly failing
in the verify_signature_read_cb() callback.

Partly closes PR pkg/48194; pkgsrc needs to be updated as well.

please commit agc@

XXX pull-up to netbsd-6


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.7 -r1.2 \
src/external/bsd/pkg_install/dist/lib/pkg_signature.c

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

Modified files:

Index: src/external/bsd/pkg_install/dist/lib/pkg_signature.c
diff -u src/external/bsd/pkg_install/dist/lib/pkg_signature.c:1.1.1.7 src/external/bsd/pkg_install/dist/lib/pkg_signature.c:1.2
--- src/external/bsd/pkg_install/dist/lib/pkg_signature.c:1.1.1.7	Sat Feb 20 04:41:58 2010
+++ src/external/bsd/pkg_install/dist/lib/pkg_signature.c	Wed Sep 11 12:59:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pkg_signature.c,v 1.1.1.7 2010/02/20 04:41:58 joerg Exp $	*/
+/*	$NetBSD: pkg_signature.c,v 1.2 2013/09/11 12:59:19 khorben Exp $	*/
 
 #if HAVE_CONFIG_H
 #include config.h
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include sys/cdefs.h
 #endif
-__RCSID($NetBSD: pkg_signature.c,v 1.1.1.7 2010/02/20 04:41:58 joerg Exp $);
+__RCSID($NetBSD: pkg_signature.c,v 1.2 2013/09/11 12:59:19 khorben Exp $);
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger jo...@netbsd.org.
@@ -325,10 +325,7 @@ pkg_verify_signature(const char *archive
 
 	*pkgname = NULL;
 
-	state = xmalloc(sizeof(*state));
-	state-sign_blocks = NULL;
-	state-sign_buf = NULL;
-	state-archive = NULL;
+	state = xcalloc(sizeof(*state), 1);
 
 	r = read_file_from_archive(archive_name, *archive, entry, HASH_FNAME,
 	hash_file, hash_len);



CVS commit: src/distrib/i386

2013-07-15 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Tue Jul 16 02:10:43 UTC 2013

Modified Files:
src/distrib/i386: Makefile
src/distrib/i386/ramdisks: Makefile
Added Files:
src/distrib/i386/kmod-cgdroot: Makefile
src/distrib/i386/ramdisks/ramdisk-cgdroot: Makefile list

Log Message:
This is the i386 version of the support for full-disk encryption; this commit 
allows building the ramdisk required as well as the associated kernel module 
(to be loaded in the kernel by the bootloader).

This was tested on my Lenovo ThinkPad X301 just like for the amd64 port.

XXX implement support for full-disk encryption installs in sysinst


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/i386/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/i386/kmod-cgdroot/Makefile
cvs rdiff -u -r1.3 -r1.4 src/distrib/i386/ramdisks/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/i386/ramdisks/ramdisk-cgdroot/Makefile \
src/distrib/i386/ramdisks/ramdisk-cgdroot/list

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

Modified files:

Index: src/distrib/i386/Makefile
diff -u src/distrib/i386/Makefile:1.9 src/distrib/i386/Makefile:1.10
--- src/distrib/i386/Makefile:1.9	Sun Jan 22 03:53:32 2012
+++ src/distrib/i386/Makefile	Tue Jul 16 02:10:43 2013
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.9 2012/01/22 03:53:32 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.10 2013/07/16 02:10:43 khorben Exp $
 
 SUBDIR=
 SUBDIR+=	ramdisks
 SUBDIR+=	.WAIT
 SUBDIR+=	instkernel
 SUBDIR+=	kmod
+SUBDIR+=	kmod-cgdroot
 SUBDIR+=	.WAIT
 SUBDIR+=	cdroms
 SUBDIR+=	floppies

Index: src/distrib/i386/ramdisks/Makefile
diff -u src/distrib/i386/ramdisks/Makefile:1.3 src/distrib/i386/ramdisks/Makefile:1.4
--- src/distrib/i386/ramdisks/Makefile:1.3	Fri May  2 23:13:06 2008
+++ src/distrib/i386/ramdisks/Makefile	Tue Jul 16 02:10:43 2013
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.3 2008/05/02 23:13:06 ad Exp $
+#	$NetBSD: Makefile,v 1.4 2013/07/16 02:10:43 khorben Exp $
 
 SUBDIR=
 SUBDIR+=	ramdisk-big
+SUBDIR+=	ramdisk-cgdroot
 
 TARGETS+=	release
 

Added files:

Index: src/distrib/i386/kmod-cgdroot/Makefile
diff -u /dev/null src/distrib/i386/kmod-cgdroot/Makefile:1.1
--- /dev/null	Tue Jul 16 02:10:43 2013
+++ src/distrib/i386/kmod-cgdroot/Makefile	Tue Jul 16 02:10:43 2013
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile,v 1.1 2013/07/16 02:10:43 khorben Exp $
+
+MINIROOT=	cgdroot
+RAMDISK=	ramdisk-cgdroot
+
+.include ../../common/Makefile.minirootkmod

Index: src/distrib/i386/ramdisks/ramdisk-cgdroot/Makefile
diff -u /dev/null src/distrib/i386/ramdisks/ramdisk-cgdroot/Makefile:1.1
--- /dev/null	Tue Jul 16 02:10:43 2013
+++ src/distrib/i386/ramdisks/ramdisk-cgdroot/Makefile	Tue Jul 16 02:10:43 2013
@@ -0,0 +1,19 @@
+#	$NetBSD: Makefile,v 1.1 2013/07/16 02:10:43 khorben Exp $
+
+BOOTMODEL=	big
+IMAGE=		ramdisk-cgdroot.fs
+IMAGESIZE=	5000k
+IMAGEDEPENDS= 	
+CRUNCHENV=	INIT_CHROOT=1
+SMALLPROG_INET6=1
+
+.include ${.CURDIR}/../common/Makefile.ramdisk
+
+LISTS+=		${DISTRIBDIR}/common/list.cgdroot
+MTREECONF+=	${DISTRIBDIR}/common/mtree.cgdroot
+
+.if ${USE_INET6} != no
+LISTS+=		${DISTRIBDIR}/common/list.inet6
+.endif
+
+MAKEFS_FLAGS+=	-f 20
Index: src/distrib/i386/ramdisks/ramdisk-cgdroot/list
diff -u /dev/null src/distrib/i386/ramdisks/ramdisk-cgdroot/list:1.1
--- /dev/null	Tue Jul 16 02:10:43 2013
+++ src/distrib/i386/ramdisks/ramdisk-cgdroot/list	Tue Jul 16 02:10:43 2013
@@ -0,0 +1,32 @@
+#	$NetBSD: list,v 1.1 2013/07/16 02:10:43 khorben Exp $
+
+PROG	bin/chio
+PROG	bin/dd
+PROG	bin/df
+PROG	bin/ed
+PROG	bin/mt
+PROG	bin/rcmd
+PROG	bin/sync
+
+PROG	libexec/lfs_cleanerd
+
+PROG	sbin/dkctl
+PROG	sbin/fdisk
+PROG	sbin/mbrlabel
+PROG	sbin/mount_ext2fs
+PROG	sbin/mount_lfs
+PROG	sbin/mount_ntfs
+PROG	sbin/newfs_lfs
+PROG	sbin/raidctl
+PROG	sbin/restore	sbin/rrestore
+PROG	sbin/scsictl
+PROG	sbin/shutdown
+PROG	sbin/slattach
+PROG	sbin/sysctl
+
+PROG	usr/bin/less	usr/bin/more
+PROG	usr/bin/tip
+
+PROG	usr/sbin/installboot
+
+PROG	usr/sbin/wiconfig



CVS commit: src/sbin/init

2013-07-14 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jul 15 00:18:03 UTC 2013

Modified Files:
src/sbin/init: Makefile

Log Message:
Let init be built easily with the CHROOT capability enabled.

This allows the ramdisk used in the incoming support for full-disk encryption 
to contain crunched binaries (much like sysinst) while booting a regular system 
(unlike sysinst).


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sbin/init/Makefile

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

Modified files:

Index: src/sbin/init/Makefile
diff -u src/sbin/init/Makefile:1.38 src/sbin/init/Makefile:1.39
--- src/sbin/init/Makefile:1.38	Sat Apr 11 07:58:12 2009
+++ src/sbin/init/Makefile	Mon Jul 15 00:18:03 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2009/04/11 07:58:12 lukem Exp $
+#	$NetBSD: Makefile,v 1.39 2013/07/15 00:18:03 khorben Exp $
 #	@(#)Makefile	8.1 (Berkeley) 7/19/93
 
 PROG=	init
@@ -7,7 +7,9 @@ DPADD=	${LIBUTIL}
 LDADD=	-lutil
 CPPFLAGS+=	-DMFS_DEV_IF_NO_CONSOLE -DSUPPORT_UTMP -DSUPPORT_UTMPX
 
-.ifdef	SMALLPROG
+.ifdef	 INIT_CHROOT
+CPPFLAGS+=	-DCHROOT
+.elifdef SMALLPROG
 CPPFLAGS+=	-DLETS_GET_SMALL
 .else
 CPPFLAGS+=	-DALTSHELL -DSECURE -DCHROOT



CVS commit: src/distrib/amd64/ramdisks

2013-07-14 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jul 15 00:22:10 UTC 2013

Modified Files:
src/distrib/amd64/ramdisks: Makefile
Added Files:
src/distrib/amd64/ramdisks/ramdisk-cgdroot: Makefile list

Log Message:
Build the cgdroot ramdisk by default (for full-disk encryption support). It 
currently contains the same utilities found in an amd64 sysinst ramdisk, which 
should be useful in case of emergency.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/distrib/amd64/ramdisks/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile \
src/distrib/amd64/ramdisks/ramdisk-cgdroot/list

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

Modified files:

Index: src/distrib/amd64/ramdisks/Makefile
diff -u src/distrib/amd64/ramdisks/Makefile:1.1 src/distrib/amd64/ramdisks/Makefile:1.2
--- src/distrib/amd64/ramdisks/Makefile:1.1	Fri Jun  2 22:11:52 2006
+++ src/distrib/amd64/ramdisks/Makefile	Mon Jul 15 00:22:10 2013
@@ -1,7 +1,8 @@
-#	$NetBSD: Makefile,v 1.1 2006/06/02 22:11:52 hubertf Exp $
+#	$NetBSD: Makefile,v 1.2 2013/07/15 00:22:10 khorben Exp $
 
 SUBDIR=
 SUBDIR+=	ramdisk
+SUBDIR+=	ramdisk-cgdroot
 
 TARGETS+=	release
 

Added files:

Index: src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile
diff -u /dev/null src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile:1.1
--- /dev/null	Mon Jul 15 00:22:10 2013
+++ src/distrib/amd64/ramdisks/ramdisk-cgdroot/Makefile	Mon Jul 15 00:22:10 2013
@@ -0,0 +1,16 @@
+#	$NetBSD: Makefile,v 1.1 2013/07/15 00:22:10 khorben Exp $
+
+IMAGE=		ramdisk-cgdroot.fs
+IMAGESIZE=	5000k
+IMAGEDEPENDS= 	
+CRUNCHENV=	INIT_CHROOT=1
+SMALLPROG_INET6=1
+
+.include ${.CURDIR}/../common/Makefile.ramdisk
+
+LISTS+=		${DISTRIBDIR}/common/list.cgdroot
+MTREECONF+=	${DISTRIBDIR}/common/mtree.cgdroot
+
+.if ${USE_INET6} != no
+LISTS+=		${DISTRIBDIR}/common/list.inet6
+.endif
Index: src/distrib/amd64/ramdisks/ramdisk-cgdroot/list
diff -u /dev/null src/distrib/amd64/ramdisks/ramdisk-cgdroot/list:1.1
--- /dev/null	Mon Jul 15 00:22:10 2013
+++ src/distrib/amd64/ramdisks/ramdisk-cgdroot/list	Mon Jul 15 00:22:10 2013
@@ -0,0 +1,32 @@
+#	$NetBSD: list,v 1.1 2013/07/15 00:22:10 khorben Exp $
+
+PROG	bin/chio
+PROG	bin/dd
+PROG	bin/df
+PROG	bin/ed
+PROG	bin/mt
+PROG	bin/rcmd
+PROG	bin/sync
+
+PROG	libexec/lfs_cleanerd
+
+PROG	sbin/dkctl
+PROG	sbin/fdisk
+PROG	sbin/mbrlabel
+PROG	sbin/mount_ext2fs
+PROG	sbin/mount_lfs
+PROG	sbin/mount_ntfs
+PROG	sbin/newfs_lfs
+PROG	sbin/raidctl
+PROG	sbin/restore	sbin/rrestore
+PROG	sbin/scsictl
+PROG	sbin/shutdown
+PROG	sbin/slattach
+PROG	sbin/sysctl
+
+PROG	usr/bin/less	usr/bin/more
+PROG	usr/bin/tip
+
+PROG	usr/sbin/installboot
+
+PROG	usr/sbin/wiconfig



CVS commit: src/distrib/common

2013-07-14 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jul 15 00:25:38 UTC 2013

Added Files:
src/distrib/common: cgdroot.rc list.cgdroot mtree.cgdroot

Log Message:
Common definitions for full-disk encryption support, including the rc script 
responsible for asking the passphrase and chrooting. wsconsctl is also built 
and used in case a splash screen is enabled.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/distrib/common/cgdroot.rc \
src/distrib/common/list.cgdroot src/distrib/common/mtree.cgdroot

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

Added files:

Index: src/distrib/common/cgdroot.rc
diff -u /dev/null src/distrib/common/cgdroot.rc:1.1
--- /dev/null	Mon Jul 15 00:25:38 2013
+++ src/distrib/common/cgdroot.rc	Mon Jul 15 00:25:38 2013
@@ -0,0 +1,60 @@
+#	$NetBSD: cgdroot.rc,v 1.1 2013/07/15 00:25:38 khorben Exp $
+#
+# Copyright (c) 2013 Pierre Pronchery khor...@defora.org
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+# 
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+export PATH
+TERM=wsvt25
+export TERM
+HOME=/
+export HOME
+BLOCKSIZE=1k
+export BLOCKSIZE
+EDITOR=ed
+export EDITOR
+
+umask 022
+
+mount -o ro /dev/wd0a /etc/cgd
+if [ $? -ne 0 ]; then
+	echo Could not mount the boot partition 12
+	exit 2
+fi
+/sbin/wsconsctl -d -w splash.enable=0  /dev/null 21
+cgdconfig -C
+if [ $? -ne 0 ]; then
+	echo Could not decrypt the encrypted volume 12
+	umount /etc/cgd
+	exit 2
+fi
+mount -o ro /dev/cgd0a /altroot
+if [ $? -ne 0 ]; then
+	echo Could not mount the root partition 12
+	cgdconfig -U
+	umount /etc/cgd
+	exit 2
+fi
+umount /etc/cgd
+/sbin/wsconsctl -d -w splash.enable=1  /dev/null 21
+sysctl -w init.root=/altroot
Index: src/distrib/common/list.cgdroot
diff -u /dev/null src/distrib/common/list.cgdroot:1.1
--- /dev/null	Mon Jul 15 00:25:38 2013
+++ src/distrib/common/list.cgdroot	Mon Jul 15 00:25:38 2013
@@ -0,0 +1,10 @@
+#	$NetBSD: list.cgdroot,v 1.1 2013/07/15 00:25:38 khorben Exp $
+#
+# list file (c.f. parselist.awk) for cgd full-disk encryption.
+#
+
+PROG	sbin/cgdconfig
+PROG	sbin/wsconsctl
+LIBS	-lcrypto
+
+COPY	${NETBSDSRCDIR}/distrib/common/cgdroot.rc etc/rc
Index: src/distrib/common/mtree.cgdroot
diff -u /dev/null src/distrib/common/mtree.cgdroot:1.1
--- /dev/null	Mon Jul 15 00:25:38 2013
+++ src/distrib/common/mtree.cgdroot	Mon Jul 15 00:25:38 2013
@@ -0,0 +1,8 @@
+#	$NetBSD: mtree.cgdroot,v 1.1 2013/07/15 00:25:38 khorben Exp $
+
+/settype=dir uname=root gname=wheel mode=0755
+
+.
+./altroot
+./etc
+./etc/cgd			mode=0700



CVS commit: src/distrib/amd64

2013-07-14 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jul 15 00:29:49 UTC 2013

Modified Files:
src/distrib/amd64: Makefile
Added Files:
src/distrib/amd64/kmod-cgdroot: Makefile

Log Message:
Enabled building the kernel module containing the ramdisk required for 
full-disk encryption support by default. This should be the last part necessary 
on the amd64 port.

XXX reproduce and test on the i386 port
XXX implement support for full-disk encryption installs in sysinst


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/distrib/amd64/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/amd64/kmod-cgdroot/Makefile

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

Modified files:

Index: src/distrib/amd64/Makefile
diff -u src/distrib/amd64/Makefile:1.6 src/distrib/amd64/Makefile:1.7
--- src/distrib/amd64/Makefile:1.6	Sun Jan 22 03:53:32 2012
+++ src/distrib/amd64/Makefile	Mon Jul 15 00:29:49 2013
@@ -1,10 +1,11 @@
-#	$NetBSD: Makefile,v 1.6 2012/01/22 03:53:32 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.7 2013/07/15 00:29:49 khorben Exp $
 
 SUBDIR=
 SUBDIR+=	ramdisks
 SUBDIR+=	.WAIT
 SUBDIR+=	instkernel
 SUBDIR+=	kmod
+SUBDIR+=	kmod-cgdroot
 SUBDIR+=	.WAIT
 SUBDIR+=	cdroms
 SUBDIR+=	floppies

Added files:

Index: src/distrib/amd64/kmod-cgdroot/Makefile
diff -u /dev/null src/distrib/amd64/kmod-cgdroot/Makefile:1.1
--- /dev/null	Mon Jul 15 00:29:49 2013
+++ src/distrib/amd64/kmod-cgdroot/Makefile	Mon Jul 15 00:29:49 2013
@@ -0,0 +1,6 @@
+#	$NetBSD: Makefile,v 1.1 2013/07/15 00:29:49 khorben Exp $
+
+MINIROOT=	cgdroot
+RAMDISK=	ramdisk-cgdroot
+
+.include ../../common/Makefile.minirootkmod



CVS commit: src/sys/arch/evbarm/n900

2013-06-02 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon Jun  3 01:47:58 UTC 2013

Modified Files:
src/sys/arch/evbarm/n900: n900_acad.c n900_audjck.c n900_cambtn.c
n900_camcvr.c n900_kbdsld.c n900_lckbtn.c n900_prxmty.c

Log Message:
Using a sysmon taskqueue to report events; fixes crashes when booting
multi-user while calling sysmon_pswitch_event().

Imported from the khorben-n900 branch


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/n900/n900_acad.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/n900/n900_audjck.c \
src/sys/arch/evbarm/n900/n900_cambtn.c \
src/sys/arch/evbarm/n900/n900_camcvr.c \
src/sys/arch/evbarm/n900/n900_kbdsld.c \
src/sys/arch/evbarm/n900/n900_prxmty.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/n900/n900_lckbtn.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/evbarm/n900/n900_acad.c
diff -u src/sys/arch/evbarm/n900/n900_acad.c:1.5 src/sys/arch/evbarm/n900/n900_acad.c:1.6
--- src/sys/arch/evbarm/n900/n900_acad.c:1.5	Sat Apr 20 03:37:55 2013
+++ src/sys/arch/evbarm/n900/n900_acad.c	Mon Jun  3 01:47:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: n900_acad.c,v 1.5 2013/04/20 03:37:55 khorben Exp $ */
+/*	$NetBSD: n900_acad.c,v 1.6 2013/06/03 01:47:58 khorben Exp $ */
 
 /*
  * AC adapter driver for the Nokia N900.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: n900_acad.c,v 1.5 2013/04/20 03:37:55 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: n900_acad.c,v 1.6 2013/06/03 01:47:58 khorben Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, $NetBSD: n900_acad.c,
 
 #include dev/gpio/gpiovar.h
 #include dev/sysmon/sysmonvar.h
+#include dev/sysmon/sysmon_taskq.h
 
 #include arm/omap/omap2_gpio.h
 
@@ -73,9 +74,9 @@ static int	n900acad_detach(device_t, int
 CFATTACH_DECL_NEW(n900acad, sizeof(struct n900acad_softc),
 	n900acad_match, n900acad_attach, n900acad_detach, NULL);
 
-static void	n900acad_refresh(struct n900acad_softc *);
+static void	n900acad_refresh(void *);
 
-static int	n900acad_intr(void *v);
+static int	n900acad_intr(void *);
 
 
 static int
@@ -143,6 +144,7 @@ n900acad_attach(device_t parent, device_
 		couldn't establish power handler\n);
 	}
 
+	sysmon_task_queue_init();
 	sc-sc_smpsw.smpsw_name = device_xname(self);
 	sc-sc_smpsw.smpsw_type = PSWITCH_TYPE_ACADAPTER;
 	sysmon_pswitch_register(sc-sc_smpsw);
@@ -161,6 +163,7 @@ n900acad_detach(device_t self, int flags
 
 	gpio_pin_unmap(sc-sc_gpio, sc-sc_map);
 	pmf_device_deregister(self);
+	sysmon_task_queue_fini();
 
 	return 0;
 }
@@ -170,13 +173,14 @@ n900acad_intr(void *v)
 {
 	struct n900acad_softc *sc = v;
 
-	n900acad_refresh(sc);
+	sysmon_task_queue_sched(0, n900acad_refresh, sc);
 	return 1;
 }
 
 static void
-n900acad_refresh(struct n900acad_softc *sc)
+n900acad_refresh(void *v)
 {
+	struct n900acad_softc *sc = v;
 	int i;
 	int event;
 

Index: src/sys/arch/evbarm/n900/n900_audjck.c
diff -u src/sys/arch/evbarm/n900/n900_audjck.c:1.1 src/sys/arch/evbarm/n900/n900_audjck.c:1.2
--- src/sys/arch/evbarm/n900/n900_audjck.c:1.1	Mon May  6 22:56:54 2013
+++ src/sys/arch/evbarm/n900/n900_audjck.c	Mon Jun  3 01:47:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: n900_audjck.c,v 1.1 2013/05/06 22:56:54 khorben Exp $ */
+/*	$NetBSD: n900_audjck.c,v 1.2 2013/06/03 01:47:58 khorben Exp $ */
 
 /*
  * Audio jack driver for the Nokia N900.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: n900_audjck.c,v 1.1 2013/05/06 22:56:54 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: n900_audjck.c,v 1.2 2013/06/03 01:47:58 khorben Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, $NetBSD: n900_audjck.
 
 #include dev/gpio/gpiovar.h
 #include dev/sysmon/sysmonvar.h
+#include dev/sysmon/sysmon_taskq.h
 
 #include arm/omap/omap2_gpio.h
 
@@ -74,9 +75,9 @@ static int	n900audjck_detach(device_t, i
 CFATTACH_DECL_NEW(n900audjck, sizeof(struct n900audjck_softc),
 	n900audjck_match, n900audjck_attach, n900audjck_detach, NULL);
 
-static void	n900audjck_refresh(struct n900audjck_softc *);
+static void	n900audjck_refresh(void *);
 
-static int	n900audjck_intr(void *v);
+static int	n900audjck_intr(void *);
 
 
 static int
@@ -144,6 +145,7 @@ n900audjck_attach(device_t parent, devic
 		couldn't establish power handler\n);
 	}
 
+	sysmon_task_queue_init();
 	sc-sc_smpsw.smpsw_name = device_xname(self);
 	sc-sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
 	sc-sc_state = PSWITCH_EVENT_RELEASED;
@@ -164,6 +166,7 @@ n900audjck_detach(device_t self, int fla
 
 	gpio_pin_unmap(sc-sc_gpio, sc-sc_map);
 	pmf_device_deregister(self);
+	sysmon_task_queue_fini();
 
 	return 0;
 }
@@ -173,13 +176,14 @@ n900audjck_intr(void *v)
 {
 	struct n900audjck_softc *sc = v;
 
-	n900audjck_refresh(sc);
+	sysmon_task_queue_sched(0, n900audjck_refresh, sc);
 	return 1;
 }
 
 static void

CVS commit: [khorben-n900] src/sys/dev/i2c

2013-05-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon May 27 20:23:28 UTC 2013

Modified Files:
src/sys/dev/i2c [khorben-n900]: tps65950.c

Log Message:
Fixed use of workqueue_create(9), as it expects a pri_t as the priority.
The IPL level was changed to IPL_SOFTBIO which seems more correct.

Thanks jmcneill@ for the hint.

XXX test on the Nokia N900


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.4 -r1.3.10.5 src/sys/dev/i2c/tps65950.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/tps65950.c
diff -u src/sys/dev/i2c/tps65950.c:1.3.10.4 src/sys/dev/i2c/tps65950.c:1.3.10.5
--- src/sys/dev/i2c/tps65950.c:1.3.10.4	Sun May 12 01:49:44 2013
+++ src/sys/dev/i2c/tps65950.c	Mon May 27 20:23:28 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tps65950.c,v 1.3.10.4 2013/05/12 01:49:44 khorben Exp $ */
+/* $NetBSD: tps65950.c,v 1.3.10.5 2013/05/27 20:23:28 khorben Exp $ */
 
 /*-
  * Copyright (c) 2012 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tps65950.c,v 1.3.10.4 2013/05/12 01:49:44 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: tps65950.c,v 1.3.10.5 2013/05/27 20:23:28 khorben Exp $);
 
 #define _INTR_PRIVATE
 
@@ -503,11 +503,12 @@ tps65950_intr_work(struct work *work, vo
 static void
 tps65950_pih_attach(struct tps65950_softc *sc, int intr)
 {
+	const int wqflags = WQ_MPSAFE;
 	int error;
 
 	/* create the workqueues */
 	error = workqueue_create(sc-sc_workq, device_xname(sc-sc_dev),
-			tps65950_intr_work, sc, PRIO_MAX, IPL_VM, 0);
+			tps65950_intr_work, sc, PRI_BIO, IPL_SOFTBIO, wqflags);
 	if (error) {
 		aprint_error_dev(sc-sc_dev, couldn't create workqueue\n);
 		return;
@@ -516,7 +517,7 @@ tps65950_pih_attach(struct tps65950_soft
 
 	error = workqueue_create(tps65950_pih_workqueue,
 			device_xname(sc-sc_dev), tps65950_pih_intr_work, sc,
-			PRIO_MAX, IPL_HIGH, 0);
+			PRI_IDLE, IPL_SOFTBIO, wqflags);
 	if (error) {
 		aprint_error_dev(sc-sc_dev, couldn't create workqueue\n);
 		return;
@@ -818,6 +819,7 @@ tps65950_gpio_pic_establish_irq(struct p
 static void
 tps65950_kbd_attach(struct tps65950_softc *sc)
 {
+	const int wqflags = WQ_MPSAFE;
 	uint8_t u8;
 	struct wskbddev_attach_args a;
 	int error;
@@ -851,7 +853,7 @@ tps65950_kbd_attach(struct tps65950_soft
 	/* create the workqueue */
 	error = workqueue_create(tps65950_kbd_workqueue,
 			device_xname(sc-sc_dev), tps65950_kbd_intr_work, sc,
-			PRIO_MAX, IPL_VM, 0);
+			PRI_BIO, IPL_SOFTBIO, wqflags);
 	if (error) {
 		aprint_error_dev(sc-sc_dev, couldn't create workqueue\n);
 		return;



CVS commit: [khorben-n900] src/sys/dev/i2c

2013-05-27 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Mon May 27 20:29:13 UTC 2013

Modified Files:
src/sys/dev/i2c [khorben-n900]: tps65950.c

Log Message:
KNF

Thanks jmcneill@ for the hint.


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.5 -r1.3.10.6 src/sys/dev/i2c/tps65950.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/tps65950.c
diff -u src/sys/dev/i2c/tps65950.c:1.3.10.5 src/sys/dev/i2c/tps65950.c:1.3.10.6
--- src/sys/dev/i2c/tps65950.c:1.3.10.5	Mon May 27 20:23:28 2013
+++ src/sys/dev/i2c/tps65950.c	Mon May 27 20:29:13 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: tps65950.c,v 1.3.10.5 2013/05/27 20:23:28 khorben Exp $ */
+/* $NetBSD: tps65950.c,v 1.3.10.6 2013/05/27 20:29:13 khorben Exp $ */
 
 /*-
  * Copyright (c) 2012 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: tps65950.c,v 1.3.10.5 2013/05/27 20:23:28 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: tps65950.c,v 1.3.10.6 2013/05/27 20:29:13 khorben Exp $);
 
 #define _INTR_PRIVATE
 
@@ -685,31 +685,30 @@ tps65950_gpio_pin_ctl(void *v, int pin, 
 
 	if (pin  0)
 		return;
-	else if (pin  8)
-	{
+	else if (pin  8) {
 		reg = TPS65950_GPIO_GPIODATADIR1;
 		bit = pin;
-	}
-	else if (pin  16)
-	{
+	} else if (pin  16) {
 		reg = TPS65950_GPIO_GPIODATADIR2;
 		bit = pin - 8;
-	}
-	else if (pin  18)
-	{
+	} else if (pin  18) {
 		reg = TPS65950_GPIO_GPIODATADIR3;
 		bit = pin - 16;
-	}
-	else
+	} else
 		return;
 
 	iic_acquire_bus(sc-sc_i2c, 0);
 	tps65950_read_1(sc, reg, val);
 	new = val;
 	switch (flags  (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) {
-		case GPIO_PIN_INPUT:	new = ~(1  bit); break;
-		case GPIO_PIN_OUTPUT:	new |= (1  bit); break;
-		default:		break;
+	case GPIO_PIN_INPUT:
+		new = ~(1  bit);
+		break;
+	case GPIO_PIN_OUTPUT:
+		new |= (1  bit);
+		break;
+	default:
+		break;
 	}
 	if (new != val)
 		tps65950_write_1(sc, reg, new);



CVS commit: [khorben-n900] src/sys/dev/i2c

2013-05-16 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu May 16 15:36:50 UTC 2013

Modified Files:
src/sys/dev/i2c [khorben-n900]: files.i2c
Added Files:
src/sys/dev/i2c [khorben-n900]: lp5523.c lp5523reg.h

Log Message:
Initial import of the lp5523led(4) driver, a programmable 9-output LED
driver from Texas Instruments. This is not functional yet, but exposes
sysctl nodes and the internal temperature sensor (not refreshed at the
moment).

Tested on my Nokia N900 smartphone.


To generate a diff of this commit:
cvs rdiff -u -r1.49.2.3 -r1.49.2.4 src/sys/dev/i2c/files.i2c
cvs rdiff -u -r0 -r1.1.2.1 src/sys/dev/i2c/lp5523.c \
src/sys/dev/i2c/lp5523reg.h

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

Modified files:

Index: src/sys/dev/i2c/files.i2c
diff -u src/sys/dev/i2c/files.i2c:1.49.2.3 src/sys/dev/i2c/files.i2c:1.49.2.4
--- src/sys/dev/i2c/files.i2c:1.49.2.3	Sun May 12 01:49:44 2013
+++ src/sys/dev/i2c/files.i2c	Thu May 16 15:36:50 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.49.2.3 2013/05/12 01:49:44 khorben Exp $
+#	$NetBSD: files.i2c,v 1.49.2.4 2013/05/16 15:36:50 khorben Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -187,3 +187,7 @@ device	mcp980x: sysmon_envsys
 attach	mcp980x at iic
 file	dev/i2c/mcp980x.c 		mcp980x
 
+# TI LP5523 LED driver
+device	lp5523led: sysmon_envsys
+attach	lp5523led at iic
+file	dev/i2c/lp5523.c		lp5523led

Added files:

Index: src/sys/dev/i2c/lp5523.c
diff -u /dev/null src/sys/dev/i2c/lp5523.c:1.1.2.1
--- /dev/null	Thu May 16 15:36:50 2013
+++ src/sys/dev/i2c/lp5523.c	Thu May 16 15:36:50 2013
@@ -0,0 +1,255 @@
+/* $NetBSD: lp5523.c,v 1.1.2.1 2013/05/16 15:36:50 khorben Exp $ */
+
+/*
+ * Texas Instruments LP5523 Programmable 9-Output LED Driver
+ *
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Pierre Pronchery (khor...@defora.org).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: lp5523.c,v 1.1.2.1 2013/05/16 15:36:50 khorben Exp $);
+
+#include sys/param.h
+#include sys/device.h
+#include sys/sysctl.h
+
+#include dev/sysmon/sysmonvar.h
+
+#include dev/i2c/i2cvar.h
+
+#include dev/i2c/lp5523reg.h
+
+#define LP5523_DEGC2UK(t) ((t * 100) + 27315)
+
+/* constants */
+enum lp5523_leds {
+	LP5523_LED_0 = 0,
+	LP5523_LED_1,
+	LP5523_LED_2,
+	LP5523_LED_3,
+	LP5523_LED_4,
+	LP5523_LED_5,
+	LP5523_LED_6,
+	LP5523_LED_7,
+	LP5523_LED_8
+};
+#define LP5523_LED_LAST		LP5523_LED_8
+#define LP5523_LED_CNT		(LP5523_LED_LAST + 1)
+
+/* variables */
+struct lp5523_softc {
+	device_t		sc_dev;
+	i2c_tag_t		sc_i2c;
+	i2c_addr_t		sc_addr;
+
+	struct sysctllog	*sc_sysctllog;
+
+	/* temperature sensor */
+	struct sysmon_envsys	*sc_sme;
+	envsys_data_t		sc_temp_sensor;
+};
+
+static int	lp5523_match(device_t, cfdata_t, void *);
+static void	lp5523_attach(device_t, device_t, void *);
+static void	lp5523_attach_envsys(struct lp5523_softc *);
+static void	lp5523_attach_sysctl(struct lp5523_softc *);
+
+static int	lp5523_reset(struct lp5523_softc *);
+
+static int	lp5523_sysctl(SYSCTLFN_ARGS);
+
+static int	lp5523_read_1(struct lp5523_softc *, uint8_t, uint8_t *);
+static int	lp5523_write_1(struct lp5523_softc *, uint8_t, uint8_t);
+
+CFATTACH_DECL_NEW(lp5523led, sizeof(struct lp5523_softc),
+	lp5523_match, lp5523_attach, NULL, NULL);
+
+static int
+lp5523_match(device_t parent, cfdata_t match, void *aux)
+{
+	return 1;
+}
+
+static void
+lp5523_attach(device_t parent, device_t self, void *aux)
+{
+	struct lp5523_softc *sc = device_private(self

CVS commit: [khorben-n900] src/sys/dev/i2c

2013-05-16 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu May 16 15:51:29 UTC 2013

Modified Files:
src/sys/dev/i2c [khorben-n900]: lp5523.c

Log Message:
Added a refresh callback for the temperature sensor.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/dev/i2c/lp5523.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/lp5523.c
diff -u src/sys/dev/i2c/lp5523.c:1.1.2.1 src/sys/dev/i2c/lp5523.c:1.1.2.2
--- src/sys/dev/i2c/lp5523.c:1.1.2.1	Thu May 16 15:36:50 2013
+++ src/sys/dev/i2c/lp5523.c	Thu May 16 15:51:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: lp5523.c,v 1.1.2.1 2013/05/16 15:36:50 khorben Exp $ */
+/* $NetBSD: lp5523.c,v 1.1.2.2 2013/05/16 15:51:29 khorben Exp $ */
 
 /*
  * Texas Instruments LP5523 Programmable 9-Output LED Driver
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lp5523.c,v 1.1.2.1 2013/05/16 15:36:50 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: lp5523.c,v 1.1.2.2 2013/05/16 15:51:29 khorben Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -83,6 +83,9 @@ static int	lp5523_reset(struct lp5523_so
 
 static int	lp5523_sysctl(SYSCTLFN_ARGS);
 
+static void	lp5523_refresh_temperature(struct sysmon_envsys *,
+		envsys_data_t *);
+
 static int	lp5523_read_1(struct lp5523_softc *, uint8_t, uint8_t *);
 static int	lp5523_write_1(struct lp5523_softc *, uint8_t, uint8_t);
 
@@ -125,13 +128,12 @@ lp5523_attach_envsys(struct lp5523_softc
 {
 	const int flags = ENVSYS_FMONNOTSUPP | ENVSYS_FHAS_ENTROPY
 		| ENVSYS_FVALID_MIN | ENVSYS_FVALID_MAX;
-	int8_t s8;
 
 	sc-sc_sme = sysmon_envsys_create();
 
 	sc-sc_sme-sme_cookie = sc;
 	sc-sc_sme-sme_name = device_xname(sc-sc_dev);
-	sc-sc_sme-sme_flags = SME_DISABLE_REFRESH;
+	sc-sc_sme-sme_refresh = lp5523_refresh_temperature;
 
 	sc-sc_temp_sensor.flags = flags;
 	sc-sc_temp_sensor.units = ENVSYS_STEMP;
@@ -152,13 +154,7 @@ lp5523_attach_envsys(struct lp5523_softc
 		return;
 	}
 
-	iic_acquire_bus(sc-sc_i2c, 0);
-	lp5523_read_1(sc, LP5523_REG_TEMP_READ, s8);
-	iic_release_bus(sc-sc_i2c, 0);
-	if (s8 = -41  s8 = 89) {
-		sc-sc_temp_sensor.state = ENVSYS_SVALID;
-		sc-sc_temp_sensor.value_cur = LP5523_DEGC2UK(s8);
-	}
+	lp5523_refresh_temperature(sc-sc_sme, sc-sc_temp_sensor);
 }
 
 static void
@@ -238,6 +234,23 @@ lp5523_sysctl(SYSCTLFN_ARGS)
 	return error;
 }
 
+static void
+lp5523_refresh_temperature(struct sysmon_envsys *sme, envsys_data_t *edata)
+{
+	struct lp5523_softc *sc = sme-sme_cookie;
+	int8_t s8;
+
+	iic_acquire_bus(sc-sc_i2c, 0);
+	lp5523_read_1(sc, LP5523_REG_TEMP_READ, s8);
+	iic_release_bus(sc-sc_i2c, 0);
+	if (s8 = -41  s8 = 89) {
+		sc-sc_temp_sensor.state = ENVSYS_SVALID;
+		sc-sc_temp_sensor.value_cur = LP5523_DEGC2UK(s8);
+	} else {
+		sc-sc_temp_sensor.state = ENVSYS_SINVALID;
+	}
+}
+
 static int
 lp5523_read_1(struct lp5523_softc *sc, uint8_t reg, uint8_t *val)
 {



CVS commit: [khorben-n900] src/sys/arch/evbarm/conf

2013-05-16 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu May 16 15:53:06 UTC 2013

Modified Files:
src/sys/arch/evbarm/conf [khorben-n900]: N900

Log Message:
Attaching the lp5523led(4) LED driver to the I2C bus.

Tested on my Nokia N900 smartphone.


To generate a diff of this commit:
cvs rdiff -u -r1.13.2.5 -r1.13.2.6 src/sys/arch/evbarm/conf/N900

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/evbarm/conf/N900
diff -u src/sys/arch/evbarm/conf/N900:1.13.2.5 src/sys/arch/evbarm/conf/N900:1.13.2.6
--- src/sys/arch/evbarm/conf/N900:1.13.2.5	Sun May 12 01:49:44 2013
+++ src/sys/arch/evbarm/conf/N900	Thu May 16 15:53:05 2013
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: N900,v 1.13.2.5 2013/05/12 01:49:44 khorben Exp $
+#	$NetBSD: N900,v 1.13.2.6 2013/05/16 15:53:05 khorben Exp $
 #
 #	N900 -- Nokia N900 Kernel
 #
@@ -258,6 +258,9 @@ gpio*		at tps65950pm1
 # Integrated keyboard
 wskbd*		at tps65950pm2 mux 1
 
+# LED driver
+lp5523led0	at iic1 addr 0x32
+
 # SPI devices
 omapspi0	at obio0 addr 0x48098000 size 0x1000 intr 65
 omapspi1	at obio0 addr 0x4809a000 size 0x1000 intr 66



CVS commit: [khorben-n900] src/sys/arch/arm/omap

2013-05-16 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu May 16 18:24:26 UTC 2013

Modified Files:
src/sys/arch/arm/omap [khorben-n900]: omap2_spi.c

Log Message:
Rewrote the computation of the clock frequency divider when configuring an
SPI channel.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.5 -r1.1.2.6 src/sys/arch/arm/omap/omap2_spi.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/omap/omap2_spi.c
diff -u src/sys/arch/arm/omap/omap2_spi.c:1.1.2.5 src/sys/arch/arm/omap/omap2_spi.c:1.1.2.6
--- src/sys/arch/arm/omap/omap2_spi.c:1.1.2.5	Wed May 15 23:27:49 2013
+++ src/sys/arch/arm/omap/omap2_spi.c	Thu May 16 18:24:26 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_spi.c,v 1.1.2.5 2013/05/15 23:27:49 khorben Exp $ */
+/* $NetBSD: omap2_spi.c,v 1.1.2.6 2013/05/16 18:24:26 khorben Exp $ */
 
 /*
  * Texas Instruments OMAP2/3 Multichannel SPI driver.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: omap2_spi.c,v 1.1.2.5 2013/05/15 23:27:49 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: omap2_spi.c,v 1.1.2.6 2013/05/16 18:24:26 khorben Exp $);
 
 #include opt_omap.h
 
@@ -186,6 +186,7 @@ static int
 omap2_spi_configure(void *cookie, int slave, int mode, int speed)
 {
 	struct omap2_spi_softc *sc = cookie;
+	const int freq = 4800; /* XXX hardcoded */
 	uint32_t conf = 0;
 	uint32_t div;
 
@@ -196,25 +197,10 @@ omap2_spi_configure(void *cookie, int sl
 		return EINVAL;
 
 	/* set the speed */
-	/* XXX implement lower speeds */
-	if (speed = 187500)
-		div = 0x8;
-	else if (speed = 375000)
-		div = 0x7;
-	else if (speed = 75)
-		div = 0x6;
-	else if (speed = 150)
-		div = 0x5;
-	else if (speed = 300)
-		div = 0x4;
-	else if (speed = 600)
-		div = 0x3;
-	else if (speed = 1200)
-		div = 0x2;
-	else if (speed = 2400)
-		div = 0x1;
-	else
-		div = 0;
+	for (div = 0; div  0xf; div++) {
+		if (speed = freq / (1  div))
+			break;
+	}
 	conf |= (div  OMAP2_MCSPI_CHXCONF_CLKD_SHIFT);
 
 	/* set the word size to 8 bits */



CVS commit: [khorben-n900] src/sys/arch/evbarm/n900

2013-05-16 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Thu May 16 21:41:15 UTC 2013

Modified Files:
src/sys/arch/evbarm/n900 [khorben-n900]: n900_acad.c n900_audjck.c
n900_cambtn.c n900_camcvr.c n900_kbdsld.c n900_lckbtn.c
n900_prxmty.c

Log Message:
Using a sysmon taskqueue to report events; fixes crashes when booting
multi-user while calling sysmon_pswitch_event().

Tested on the Nokia N900 smartphone.


To generate a diff of this commit:
cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/arch/evbarm/n900/n900_acad.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/evbarm/n900/n900_audjck.c \
src/sys/arch/evbarm/n900/n900_cambtn.c \
src/sys/arch/evbarm/n900/n900_camcvr.c \
src/sys/arch/evbarm/n900/n900_kbdsld.c \
src/sys/arch/evbarm/n900/n900_prxmty.c
cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/arch/evbarm/n900/n900_lckbtn.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/evbarm/n900/n900_acad.c
diff -u src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.1 src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.2
--- src/sys/arch/evbarm/n900/n900_acad.c:1.5.2.1	Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_acad.c	Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: n900_acad.c,v 1.5.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/*	$NetBSD: n900_acad.c,v 1.5.2.2 2013/05/16 21:41:15 khorben Exp $ */
 
 /*
  * AC adapter driver for the Nokia N900.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: n900_acad.c,v 1.5.2.1 2013/05/11 18:01:04 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: n900_acad.c,v 1.5.2.2 2013/05/16 21:41:15 khorben Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, $NetBSD: n900_acad.c,
 
 #include dev/gpio/gpiovar.h
 #include dev/sysmon/sysmonvar.h
+#include dev/sysmon/sysmon_taskq.h
 
 #include arm/omap/omap2_gpio.h
 
@@ -68,9 +69,9 @@ static int	n900acad_detach(device_t, int
 CFATTACH_DECL_NEW(n900acad, sizeof(struct n900acad_softc),
 	n900acad_match, n900acad_attach, n900acad_detach, NULL);
 
-static void	n900acad_refresh(struct n900acad_softc *);
+static void	n900acad_refresh(void *);
 
-static int	n900acad_intr(void *v);
+static int	n900acad_intr(void *);
 
 
 static int
@@ -138,6 +139,7 @@ n900acad_attach(device_t parent, device_
 		couldn't establish power handler\n);
 	}
 
+	sysmon_task_queue_init();
 	sc-sc_smpsw.smpsw_name = device_xname(self);
 	sc-sc_smpsw.smpsw_type = PSWITCH_TYPE_ACADAPTER;
 	sysmon_pswitch_register(sc-sc_smpsw);
@@ -156,6 +158,7 @@ n900acad_detach(device_t self, int flags
 
 	gpio_pin_unmap(sc-sc_gpio, sc-sc_map);
 	pmf_device_deregister(self);
+	sysmon_task_queue_fini();
 
 	return 0;
 }
@@ -165,18 +168,21 @@ n900acad_intr(void *v)
 {
 	struct n900acad_softc *sc = v;
 
-	n900acad_refresh(sc);
+	sysmon_task_queue_sched(0, n900acad_refresh, sc);
 	return 1;
 }
 
 static void
-n900acad_refresh(struct n900acad_softc *sc)
+n900acad_refresh(void *v)
 {
+	struct n900acad_softc *sc = v;
 	int i;
 	int event;
 
 	i = gpio_pin_read(sc-sc_gpio, sc-sc_map, N900ACAD_PIN_INPUT);
 	event = (i == GPIO_PIN_HIGH)
 		? PSWITCH_EVENT_RELEASED : PSWITCH_EVENT_PRESSED;
+
+	/* report the event */
 	sysmon_pswitch_event(sc-sc_smpsw, event);
 }

Index: src/sys/arch/evbarm/n900/n900_audjck.c
diff -u src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.1 src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.2
--- src/sys/arch/evbarm/n900/n900_audjck.c:1.1.2.1	Sat May 11 18:01:04 2013
+++ src/sys/arch/evbarm/n900/n900_audjck.c	Thu May 16 21:41:15 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: n900_audjck.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $ */
+/*	$NetBSD: n900_audjck.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $ */
 
 /*
  * Audio jack driver for the Nokia N900.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: n900_audjck.c,v 1.1.2.1 2013/05/11 18:01:04 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: n900_audjck.c,v 1.1.2.2 2013/05/16 21:41:15 khorben Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -41,6 +41,7 @@ __KERNEL_RCSID(0, $NetBSD: n900_audjck.
 
 #include dev/gpio/gpiovar.h
 #include dev/sysmon/sysmonvar.h
+#include dev/sysmon/sysmon_taskq.h
 
 #include arm/omap/omap2_gpio.h
 
@@ -69,9 +70,9 @@ static int	n900audjck_detach(device_t, i
 CFATTACH_DECL_NEW(n900audjck, sizeof(struct n900audjck_softc),
 	n900audjck_match, n900audjck_attach, n900audjck_detach, NULL);
 
-static void	n900audjck_refresh(struct n900audjck_softc *);
+static void	n900audjck_refresh(void *);
 
-static int	n900audjck_intr(void *v);
+static int	n900audjck_intr(void *);
 
 
 static int
@@ -139,6 +140,7 @@ n900audjck_attach(device_t parent, devic
 		couldn't establish power handler\n);
 	}
 
+	sysmon_task_queue_init();
 	sc-sc_smpsw.smpsw_name = device_xname(self);
 	sc-sc_smpsw.smpsw_type = PSWITCH_TYPE_HOTKEY;
 	sc-sc_state = PSWITCH_EVENT_RELEASED;
@@ -159,6 +161,7 @@ n900audjck_detach(device_t self, 

CVS commit: [khorben-n900] src/sys/dev/spi

2013-05-15 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed May 15 13:52:19 UTC 2013

Modified Files:
src/sys/dev/spi [khorben-n900]: files.spi spi.c spivar.h

Log Message:
Let the bus speed of SPI devices be specified within the kernel
configuration.


To generate a diff of this commit:
cvs rdiff -u -r1.2.114.1 -r1.2.114.2 src/sys/dev/spi/files.spi
cvs rdiff -u -r1.8.6.1 -r1.8.6.2 src/sys/dev/spi/spi.c
cvs rdiff -u -r1.4.20.1 -r1.4.20.2 src/sys/dev/spi/spivar.h

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

Modified files:

Index: src/sys/dev/spi/files.spi
diff -u src/sys/dev/spi/files.spi:1.2.114.1 src/sys/dev/spi/files.spi:1.2.114.2
--- src/sys/dev/spi/files.spi:1.2.114.1	Fri May 10 01:25:07 2013
+++ src/sys/dev/spi/files.spi	Wed May 15 13:52:19 2013
@@ -1,8 +1,8 @@
-#	$NetBSD: files.spi,v 1.2.114.1 2013/05/10 01:25:07 khorben Exp $
+#	$NetBSD: files.spi,v 1.2.114.2 2013/05/15 13:52:19 khorben Exp $
 
 define	spibus { }
 
-device	spi { slave, [intr = -1] }
+device	spi { slave, [intr = -1], [speed = -1] }
 attach	spi at spibus
 file	dev/spi/spi.c			spi | spibus
 

Index: src/sys/dev/spi/spi.c
diff -u src/sys/dev/spi/spi.c:1.8.6.1 src/sys/dev/spi/spi.c:1.8.6.2
--- src/sys/dev/spi/spi.c:1.8.6.1	Fri May 10 01:25:07 2013
+++ src/sys/dev/spi/spi.c	Wed May 15 13:52:19 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: spi.c,v 1.8.6.1 2013/05/10 01:25:07 khorben Exp $ */
+/* $NetBSD: spi.c,v 1.8.6.2 2013/05/15 13:52:19 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spi.c,v 1.8.6.1 2013/05/10 01:25:07 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: spi.c,v 1.8.6.2 2013/05/15 13:52:19 khorben Exp $);
 
 #include locators.h
 
@@ -120,6 +120,7 @@ spi_search(device_t parent, cfdata_t cf,
 
 	sa.sa_handle = sc-sc_slaves[addr];
 	sa.sa_intr = cf-cf_loc[SPICF_INTR];
+	sa.sa_speed = cf-cf_loc[SPICF_SPEED];
 
 	if (config_match(parent, cf, sa)  0)
 		config_attach(parent, cf, sa, spi_print);
@@ -197,8 +198,7 @@ spi_configure(struct spi_handle *sh, int
 	if (sc-sc_speed)
 		speed = min(sc-sc_speed, speed);
 
-	rv = (*tag-sct_configure)(tag-sct_cookie, sh-sh_slave,
-	mode, speed);
+	rv = (*tag-sct_configure)(tag-sct_cookie, sh-sh_slave, mode, speed);
 
 	if (rv == 0) {
 		sc-sc_mode = mode;
@@ -211,7 +211,6 @@ spi_configure(struct spi_handle *sh, int
 void
 spi_transfer_init(struct spi_transfer *st)
 {
-
 	mutex_init(st-st_lock, MUTEX_DEFAULT, IPL_BIO);
 	cv_init(st-st_cv, spicv);
 

Index: src/sys/dev/spi/spivar.h
diff -u src/sys/dev/spi/spivar.h:1.4.20.1 src/sys/dev/spi/spivar.h:1.4.20.2
--- src/sys/dev/spi/spivar.h:1.4.20.1	Fri May 10 01:25:07 2013
+++ src/sys/dev/spi/spivar.h	Wed May 15 13:52:19 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: spivar.h,v 1.4.20.1 2013/05/10 01:25:07 khorben Exp $ */
+/* $NetBSD: spivar.h,v 1.4.20.2 2013/05/15 13:52:19 khorben Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -83,6 +83,7 @@ struct spibus_attach_args {
 struct spi_attach_args {
 	struct spi_handle	*sa_handle;
 	int			sa_intr;
+	int			sa_speed;
 };
 
 /*



CVS commit: [khorben-n900] src/sys/arch/arm/omap

2013-05-15 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed May 15 23:27:49 UTC 2013

Modified Files:
src/sys/arch/arm/omap [khorben-n900]: omap2_spi.c

Log Message:
Seems to be much closer to working correctly. Apparently one has to read
back anything transmitted, as well as transmit 0's to be able to read
anything. This would explain the whole juggling with chunks, counts and
pointers.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.4 -r1.1.2.5 src/sys/arch/arm/omap/omap2_spi.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/omap/omap2_spi.c
diff -u src/sys/arch/arm/omap/omap2_spi.c:1.1.2.4 src/sys/arch/arm/omap/omap2_spi.c:1.1.2.5
--- src/sys/arch/arm/omap/omap2_spi.c:1.1.2.4	Wed May 15 02:44:48 2013
+++ src/sys/arch/arm/omap/omap2_spi.c	Wed May 15 23:27:49 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: omap2_spi.c,v 1.1.2.4 2013/05/15 02:44:48 khorben Exp $ */
+/* $NetBSD: omap2_spi.c,v 1.1.2.5 2013/05/15 23:27:49 khorben Exp $ */
 
 /*
  * Texas Instruments OMAP2/3 Multichannel SPI driver.
@@ -14,8 +14,9 @@
  * are met:
  * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
- * 2. The name of the author may not be used to endorse or promote products
- *derived from this software without specific prior written permission.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -31,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: omap2_spi.c,v 1.1.2.4 2013/05/15 02:44:48 khorben Exp $);
+__KERNEL_RCSID(0, $NetBSD: omap2_spi.c,v 1.1.2.5 2013/05/15 23:27:49 khorben Exp $);
 
 #include opt_omap.h
 
@@ -347,13 +348,13 @@ omap2_spi_stop(struct omap2_spi_softc * 
 
 	chan = sc-sc_channels[channel];
 
-	chan-running = false;
-
 	/* stop the channel */
 	ctrlreg = OMAP2_MCSPI_CHXCTRL(channel);
 	u32 = SPI_READ_REG(sc, ctrlreg);
 	u32 = ~OMAP2_MCSPI_CHXCTRL_EN;
 	SPI_WRITE_REG(sc, ctrlreg, u32);
+
+	chan-running = false;
 }
 
 static int
@@ -364,13 +365,14 @@ omap2_spi_intr(void *v)
 	struct omap2_spi_channel *chan;
 	struct spi_transfer *st;
 	uint32_t status;
-	uint32_t u32;
 	uint32_t tx_empty = 0;
 	uint32_t rx_full = 0;
 
 	/* reset the channel status bits */
 	status = SPI_READ_REG(sc, OMAP2_MCSPI_IRQSTATUS);
-	u32 = 0;
+
+	/* acknowledge the interrupt */
+	SPI_WRITE_REG(sc, OMAP2_MCSPI_IRQSTATUS, status);
 
 	/* check every channel */
 	for (i = 0; i  sc-sc_spi.sct_nslaves; i++) {
@@ -381,37 +383,24 @@ omap2_spi_intr(void *v)
 
 		switch (i) {
 			case 0:
-u32 |= OMAP2_MCSPI_IRQSTATUS_RX0_OVERFLOW
-	| OMAP2_MCSPI_IRQSTATUS_RX0_FULL
-	| OMAP2_MCSPI_IRQSTATUS_TX0_UNDERFLOW
-	| OMAP2_MCSPI_IRQSTATUS_TX0_EMPTY;
 tx_empty = status
 	 OMAP2_MCSPI_IRQSTATUS_TX0_EMPTY;
 rx_full = status
 	 OMAP2_MCSPI_IRQSTATUS_RX0_FULL;
 break;
 			case 1:
-u32 |= OMAP2_MCSPI_IRQSTATUS_RX1_FULL
-	| OMAP2_MCSPI_IRQSTATUS_TX1_UNDERFLOW
-	| OMAP2_MCSPI_IRQSTATUS_TX1_EMPTY;
 tx_empty = status
 	 OMAP2_MCSPI_IRQSTATUS_TX1_EMPTY;
 rx_full = status
 	 OMAP2_MCSPI_IRQSTATUS_RX1_FULL;
 break;
 			case 2:
-u32 |= OMAP2_MCSPI_IRQSTATUS_RX2_FULL
-	| OMAP2_MCSPI_IRQSTATUS_TX2_UNDERFLOW
-	| OMAP2_MCSPI_IRQSTATUS_TX2_EMPTY;
 tx_empty = status
 	 OMAP2_MCSPI_IRQSTATUS_TX2_EMPTY;
 rx_full = status
 	 OMAP2_MCSPI_IRQSTATUS_RX2_FULL;
 break;
 			case 3:
-u32 |= OMAP2_MCSPI_IRQSTATUS_RX3_FULL
-	| OMAP2_MCSPI_IRQSTATUS_TX3_UNDERFLOW
-	| OMAP2_MCSPI_IRQSTATUS_TX3_EMPTY;
 tx_empty = status
 	 OMAP2_MCSPI_IRQSTATUS_TX3_EMPTY;
 rx_full = status
@@ -419,15 +408,14 @@ omap2_spi_intr(void *v)
 break;
 		}
 
-		if (chan-wchunk != NULL) {
-			if (tx_empty) {
+		if (tx_empty) {
+			if (chan-wchunk != NULL) {
 omap2_spi_send(sc, i);
-if (chan-wchunk == NULL)
-	omap2_spi_recv(sc, i);
 			}
 		}
-		else if (rx_full) {
+		if (rx_full) {
 			omap2_spi_recv(sc, i);
+			omap2_spi_send(sc, i);
 		}
 
 		if (chan-wchunk == NULL  chan-rchunk == NULL)
@@ -437,15 +425,14 @@ omap2_spi_intr(void *v)
 			KASSERT(st != NULL);
 			spi_done(st, 0);
 
+			/* stop the current transfer */
 			omap2_spi_stop(sc, i);
-			omap2_spi_start(sc, i);
 
+			/* start a new transfer if any was queued */
+			omap2_spi_start(sc, i);
 		}
 	}
 
-	/* acknowledge the interrupt */
-	SPI_WRITE_REG(sc, OMAP2_MCSPI_IRQSTATUS, u32);
-
 	return 1;
 }
 
@@ -493,22 +480,23 @@ omap2_spi_send(struct omap2_spi_softc * 
 	uint32_t u32;
 	uint32_t data;
 
-	if ((chunk = sc-sc_channels[channel].wchunk) == NULL)
+	while ((chunk 

  1   2   >