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

2014-10-12 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Oct 12 06:00:14 UTC 2014

Modified Files:
src/sys/arch/arm/include: mutex.h

Log Message:
Typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/include/mutex.h

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

Modified files:

Index: src/sys/arch/arm/include/mutex.h
diff -u src/sys/arch/arm/include/mutex.h:1.17 src/sys/arch/arm/include/mutex.h:1.18
--- src/sys/arch/arm/include/mutex.h:1.17	Fri Aug  8 07:34:02 2014
+++ src/sys/arch/arm/include/mutex.h	Sun Oct 12 06:00:14 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.17 2014/08/08 07:34:02 skrll Exp $	*/
+/*	$NetBSD: mutex.h,v 1.18 2014/10/12 06:00:14 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@ struct kmutex {
 		/* Spin mutex */
 		struct {
 			/*
-			 * Since the low bit of mtax_owner is used to flag this
+			 * Since the low bit of mtxa_owner is used to flag this
 			 * mutex as a spin mutex, we can't use the first byte
 			 * or the last byte to store the ipl or lock values.
 			 */



CVS commit: src/tests/lib/libc/sync

2014-10-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 12 08:02:35 UTC 2014

Modified Files:
src/tests/lib/libc/sync: Makefile

Log Message:
Disable the atomic C++11 test for now, we are not ready for it.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/Makefile

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

Modified files:

Index: src/tests/lib/libc/sync/Makefile
diff -u src/tests/lib/libc/sync/Makefile:1.2 src/tests/lib/libc/sync/Makefile:1.3
--- src/tests/lib/libc/sync/Makefile:1.2	Sat Oct 11 14:52:15 2014
+++ src/tests/lib/libc/sync/Makefile	Sun Oct 12 08:02:35 2014
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.2 2014/10/11 14:52:15 martin Exp $
+# $NetBSD: Makefile,v 1.3 2014/10/12 08:02:35 martin Exp $
 
 WARNS=0
 NOMAN=1
 CXXFLAGS+= -std=c++11
 
-PROG=all_sync_ops_linkable cpp_atomic_ops_linkable
+PROG=all_sync_ops_linkable # cpp_atomic_ops_linkable
 
 proginstall:
 	@echo This directory features link time only tests.



CVS commit: src/usr.bin/config

2014-10-12 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sun Oct 12 08:04:30 UTC 2014

Modified Files:
src/usr.bin/config: TODO

Log Message:
Spelling.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/config/TODO

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/config/TODO
diff -u src/usr.bin/config/TODO:1.2 src/usr.bin/config/TODO:1.3
--- src/usr.bin/config/TODO:1.2	Sun Oct 12 04:23:46 2014
+++ src/usr.bin/config/TODO	Sun Oct 12 08:04:30 2014
@@ -34,12 +34,12 @@ o Sort objects in more reasonable order.
 
   Kill linker definitions in sys/conf/Makefile.inc.kern.
 
-o Differenciate options and flags/params.
+o Differentiate options and flags/params.
 
-  options enables featurs by adding *.c files (via attributes).
+  options enables features by adding *.c files (via attributes).
 
   flags and params are to change contents of *.c files.  These don't add
-  *.c files to the result kernek, or don't build attributes (modules).
+  *.c files to the result kernel, or don't build attributes (modules).
 
 o Make flags/params per attributes (modules).
 
@@ -60,5 +60,5 @@ o Generate things only by definitions.
 o Split cfdata.
 
   cfdata is pattern matching rules to enable devices at runtime device
-  auto-configuration.  It is pure data and can (should) be generated separatedly
+  auto-configuration.  It is pure data and can (should) be generated separately
   from the code.



CVS commit: src/external/gpl3/gcc

2014-10-12 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Oct 12 08:17:35 UTC 2014

Modified Files:
src/external/gpl3/gcc/lib/libgcc/arch/powerpc64: defs.mk
src/external/gpl3/gcc/lib/libiberty: defs.mk
src/external/gpl3/gcc/usr.bin/gcc/arch/or1k: configargs.h
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64: configargs.h defs.mk
gtyp-input.list multilib.h tm.h
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv32: auto-host.h
configargs.h
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64: configargs.h
src/external/gpl3/gcc/usr.bin/gcc/arch/vax: configargs.h
src/external/gpl3/gcc/usr.bin/libcpp/arch/riscv32: config.h

Log Message:
more regen for complex etc, fixes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk
cvs rdiff -u -r1.6 -r1.7 src/external/gpl3/gcc/lib/libiberty/defs.mk
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h
cvs rdiff -u -r1.3 -r1.4 \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/configargs.h
cvs rdiff -u -r1.2 -r1.3 \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/defs.mk \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/gtyp-input.list \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/multilib.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/powerpc64/tm.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv32/auto-host.h \
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv32/configargs.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/gcc/arch/riscv64/configargs.h
cvs rdiff -u -r1.14 -r1.15 \
src/external/gpl3/gcc/usr.bin/gcc/arch/vax/configargs.h
cvs rdiff -u -r1.1 -r1.2 \
src/external/gpl3/gcc/usr.bin/libcpp/arch/riscv32/config.h

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

Modified files:

Index: src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk
diff -u src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk:1.2 src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk:1.3
--- src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk:1.2	Mon Jun 23 02:29:19 2014
+++ src/external/gpl3/gcc/lib/libgcc/arch/powerpc64/defs.mk	Sun Oct 12 08:17:35 2014
@@ -11,7 +11,7 @@ G_LIB1ASMSRC=
 G_LIB2_DIVMOD_FUNCS=_divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
 G_LIB2FUNCS_ST=_eprintf __gcc_bcmp
 G_LIB2FUNCS_EXTRA=
-G_LIBGCC2_CFLAGS=-O2  -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector 
+G_LIBGCC2_CFLAGS=-O2  -DIN_GCC   -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector 
 G_SHLIB_MKMAP=${GNUHOSTDIST}/libgcc/mkmap-symver.awk
 G_SHLIB_MKMAP_OPTS=
 G_SHLIB_MAPFILES=libgcc-std.ver

Index: src/external/gpl3/gcc/lib/libiberty/defs.mk
diff -u src/external/gpl3/gcc/lib/libiberty/defs.mk:1.6 src/external/gpl3/gcc/lib/libiberty/defs.mk:1.7
--- src/external/gpl3/gcc/lib/libiberty/defs.mk:1.6	Fri Aug 22 05:39:20 2014
+++ src/external/gpl3/gcc/lib/libiberty/defs.mk	Sun Oct 12 08:17:35 2014
@@ -4,5 +4,5 @@
 #
 G_ALLOCA=
 G_EXTRA_OFILES=
-G_LIBOBJS=mempcpy.o strverscmp.o
+G_LIBOBJS=mempcpy.o strverscmp.o vfork.o
 G_REQUIRED_OFILES=regex.o cplus-dem.o cp-demangle.o md5.o sha1.o alloca.o argv.o choose-temp.o concat.o cp-demint.o crc32.o dwarfnames.o dyn-string.o fdmatch.o fibheap.o filename_cmp.o floatformat.o fnmatch.o fopen_unlocked.o getopt.o getopt1.o getpwd.o getruntime.o hashtab.o hex.o lbasename.o lrealpath.o make-relative-prefix.o make-temp-file.o objalloc.o obstack.o partition.o pexecute.o physmem.o pex-common.o pex-one.o pex-unix.o safe-ctype.o simple-object.o simple-object-coff.o simple-object-elf.o simple-object-mach-o.o simple-object-xcoff.o sort.o spaces.o splay-tree.o stack-limit.o strerror.o strsignal.o timeval-utils.o unlink-if-ordinary.o xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o xstrndup.o

Index: src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h
diff -u src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h:1.2 src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h:1.3
--- src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h:1.2	Fri Sep 19 00:24:28 2014
+++ src/external/gpl3/gcc/usr.bin/gcc/arch/or1k/configargs.h	Sun Oct 12 08:17:35 2014
@@ -3,7 +3,7 @@
 /* Generated from: NetBSD: mknative.common,v 1.11 2014/02/17 21:39:43 christos Exp  */
 
 /* Generated automatically. */
-static const char configuration_arguments[] = /u1/netbsd-openrisc/src/tools/gcc/../../external/gpl3/gcc/dist/configure --target=or1k--netbsd --enable-long-long --enable-threads --with-bugurl=http://www.NetBSD.org/Misc/send-pr.html --with-pkgversion='NetBSD nb1 20140527' 

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

2014-10-12 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sun Oct 12 12:01:50 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: RPI

Log Message:
add commented out entry for linksprite's RTC module


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/evbarm/conf/RPI

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/RPI
diff -u src/sys/arch/evbarm/conf/RPI:1.57 src/sys/arch/evbarm/conf/RPI:1.58
--- src/sys/arch/evbarm/conf/RPI:1.57	Sat Oct 11 11:55:07 2014
+++ src/sys/arch/evbarm/conf/RPI	Sun Oct 12 12:01:50 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: RPI,v 1.57 2014/10/11 11:55:07 uebayasi Exp $
+#	$NetBSD: RPI,v 1.58 2014/10/12 12:01:50 macallan Exp $
 #
 #	RPi -- Raspberry Pi
 #
@@ -257,6 +257,10 @@ ukphy*		at mii? phy ?		# generic unknown
 bsciic* at obio?
 iic* at i2cbus?
 
+# 'DS3231 Raspberry Pi RTC Board Real Time Clock Module for Arduino'
+# sold by linksprite.com
+#dsrtc* at iic1 addr 0x68 flags 3231
+
 # SPI controller
 bcmspi* at obio?
 spi* at spibus?



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 12:14:43 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_reg.h

Log Message:
correct AWIN_A31_USB3_OFFSET


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/arm/allwinner/awin_reg.h

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.28 src/sys/arch/arm/allwinner/awin_reg.h:1.29
--- src/sys/arch/arm/allwinner/awin_reg.h:1.28	Fri Oct 10 23:50:43 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sun Oct 12 12:14:43 2014
@@ -1699,7 +1699,7 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_USB0_OFFSET		0x00019000	/* OTG */
 #define AWIN_A31_USB1_OFFSET		0x0001a000	/* EHCI0/OHCI0 */
 #define AWIN_A31_USB2_OFFSET		0x0001b000	/* EHCI1/OHCI1 */
-#define AWIN_A31_USB3_OFFSET		0x0001b000	/* OHCI2 */
+#define AWIN_A31_USB3_OFFSET		0x0001c000	/* OHCI2 */
 #define AWIN_A31_PRCM_OFFSET		0x00301400	/* PRCM */
 #define AWIN_A31_CPUCFG_OFFSET		0x00301C00
 



CVS commit: src/tests/lib/libc/sync

2014-10-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 12 12:26:41 UTC 2014

Modified Files:
src/tests/lib/libc/sync: cpp_atomic_ops_linkable.cc

Log Message:
If we don't have 64 bit atomic ops, also do not test long long and intmax_t
(and friends).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc

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

Modified files:

Index: src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc
diff -u src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.2 src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.3
--- src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc:1.2	Sat Oct 11 17:46:58 2014
+++ src/tests/lib/libc/sync/cpp_atomic_ops_linkable.cc	Sun Oct 12 12:26:41 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.2 2014/10/11 17:46:58 martin Exp $ */
+/* $NetBSD: cpp_atomic_ops_linkable.cc,v 1.3 2014/10/12 12:26:41 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -69,8 +69,10 @@ int main(int argc, char **argv)
   ATestunsigned int();
   ATestlong();
   ATestunsigned long();
+#ifdef __HAVE_ATOMIC64_OPS
   ATestlong long();
   ATestunsigned long long();
+#endif
   ATestchar16_t();
   ATestchar32_t();
   ATestwchar_t();
@@ -98,6 +100,8 @@ int main(int argc, char **argv)
   ATestuintptr_t();
   ATeststd::size_t();
   ATeststd::ptrdiff_t();
+#ifdef __HAVE_ATOMIC64_OPS
   ATestintmax_t();
   ATestuintmax_t();
+#endif
 }



CVS commit: src/etc/mtree

2014-10-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Oct 12 12:32:15 UTC 2014

Modified Files:
src/etc/mtree: NetBSD.dist.tests

Log Message:
Dig mcast test directories.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.110 src/etc/mtree/NetBSD.dist.tests:1.111
--- src/etc/mtree/NetBSD.dist.tests:1.110	Thu Sep 18 15:25:10 2014
+++ src/etc/mtree/NetBSD.dist.tests	Sun Oct 12 12:32:15 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.110 2014/09/18 15:25:10 ozaki-r Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.111 2014/10/12 12:32:15 uebayasi Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -134,6 +134,7 @@
 ./usr/libdata/debug/usr/tests/net/icmp
 ./usr/libdata/debug/usr/tests/net/if
 ./usr/libdata/debug/usr/tests/net/if_loop
+./usr/libdata/debug/usr/tests/net/mcast
 ./usr/libdata/debug/usr/tests/net/net
 ./usr/libdata/debug/usr/tests/net/sys
 ./usr/libdata/debug/usr/tests/rump
@@ -309,6 +310,7 @@
 ./usr/tests/net/if
 ./usr/tests/net/if_bridge
 ./usr/tests/net/if_loop
+./usr/tests/net/mcast
 ./usr/tests/net/mpls
 ./usr/tests/net/net
 ./usr/tests/net/npf



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 13:07:45 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_reg.h awin_usb.c

Log Message:
A31 USB support


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/allwinner/awin_reg.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/allwinner/awin_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/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.29 src/sys/arch/arm/allwinner/awin_reg.h:1.30
--- src/sys/arch/arm/allwinner/awin_reg.h:1.29	Sun Oct 12 12:14:43 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sun Oct 12 13:07:45 2014
@@ -1718,6 +1718,10 @@ struct awin_mmc_idma_descriptor {
 
 #define AWIN_A31_CPU_AXI_CFG_REG		0x0050
 
+#define AWIN_A31_AHB_RESET0_REG		0x02C0
+#define AWIN_A31_AHB_RESET1_REG		0x02C4
+#define AWIN_A31_AHB_RESET2_REG		0x02C8
+
 #define AWIN_A31_CPUCFG_RST_CTRL_CORE_RESET __BIT(1)
 #define AWIN_A31_CPUCFG_RST_CTRL_CPU_RESET __BIT(0)
 
@@ -1738,6 +1742,30 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_USB_CLK_PHY1_ENABLE	__BIT(1)
 #define AWIN_A31_USB_CLK_PHY0_ENABLE	__BIT(0)
 
+#define AWIN_A31_AHB_RESET0_USBOHCI2_RST	__BIT(31)
+#define AWIN_A31_AHB_RESET0_USBOHCI1_RST	__BIT(30)
+#define AWIN_A31_AHB_RESET0_USBOHCI0_RST	__BIT(29)
+#define AWIN_A31_AHB_RESET0_USBEHCI1_RST	__BIT(27)
+#define AWIN_A31_AHB_RESET0_USBEHCI0_RST	__BIT(26)
+#define AWIN_A31_AHB_RESET0_USBOTG_RST		__BIT(24)
+#define AWIN_A31_AHB_RESET0_SPI3_RST		__BIT(23)
+#define AWIN_A31_AHB_RESET0_SPI2_RST		__BIT(22)
+#define AWIN_A31_AHB_RESET0_SPI1_RST		__BIT(21)
+#define AWIN_A31_AHB_RESET0_SPI0_RST		__BIT(20)
+#define AWIN_A31_AHB_RESET0_HSTMR_RST		__BIT(19)
+#define AWIN_A31_AHB_RESET0_TS_RST		__BIT(18)
+#define AWIN_A31_AHB_RESET0_GMAC_RST		__BIT(17)
+#define AWIN_A31_AHB_RESET0_SDRAM_RST		__BIT(14)
+#define AWIN_A31_AHB_RESET0_NAND0_RST		__BIT(13)
+#define AWIN_A31_AHB_RESET0_NAND1_RST		__BIT(12)
+#define AWIN_A31_AHB_RESET0_SD3_RST		__BIT(11)
+#define AWIN_A31_AHB_RESET0_SD2_RST		__BIT(10)
+#define AWIN_A31_AHB_RESET0_SD1_RST		__BIT(9)
+#define AWIN_A31_AHB_RESET0_SD0_RST		__BIT(8)
+#define AWIN_A31_AHB_RESET0_DMA_RST		__BIT(6)
+#define AWIN_A31_AHB_RESET0_SS_RST		__BIT(5)
+#define AWIN_A31_AHB_RESET0_MIPIDSI_RST		__BIT(1)
+
 #define AWIN_A31_WDOG1_IRQ_EN_REG		0x00A0
 #define AWIN_A31_WDOG1_IRQ_STA_REG		0x00A4
 #define AWIN_A31_WDOG1_CTRL_REG			0x00B0

Index: src/sys/arch/arm/allwinner/awin_usb.c
diff -u src/sys/arch/arm/allwinner/awin_usb.c:1.14 src/sys/arch/arm/allwinner/awin_usb.c:1.15
--- src/sys/arch/arm/allwinner/awin_usb.c:1.14	Fri Oct 10 07:36:11 2014
+++ src/sys/arch/arm/allwinner/awin_usb.c	Sun Oct 12 13:07:45 2014
@@ -34,7 +34,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_usb.c,v 1.14 2014/10/10 07:36:11 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_usb.c,v 1.15 2014/10/12 13:07:45 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -71,6 +71,7 @@ struct awinusb_softc {
 	bus_space_handle_t usbsc_usb0_phy_csr_bsh;
 	u_int usbsc_number;
 	struct awin_gpio_pindata usbsc_drv_pin;
+	struct awin_gpio_pindata usbsc_restrict_pin;
 
 	device_t usbsc_ohci_dev;
 	device_t usbsc_ehci_dev;
@@ -283,6 +284,8 @@ CFATTACH_DECL_NEW(awin_usb, sizeof(struc
 static int awinusb_ports;
 
 static const char awinusb_drvpin_names[2][8] = { usb1drv, usb2drv };
+static const char awinusb_restrictpin_names[2][13] = { usb1restrict, usb2restrict };
+
 static const bus_size_t awinusb_dram_hpcr_regs[2] = {
 	AWIN_DRAM_HPCR_USB1_REG,
 	AWIN_DRAM_HPCR_USB2_REG,
@@ -331,6 +334,22 @@ static const uint32_t awinusb_usb_clk_se
 	AWIN_A31_USB_CLK_USBPHY2_ENABLE |
 	AWIN_A31_USB_CLK_PHY2_ENABLE,
 };
+static const uint32_t awinusb_usb_ahb_reset_a31[2] = {
+#if NOHCI  0
+	AWIN_A31_AHB_RESET0_USBOHCI0_RST |
+#endif
+#if NEHCI  0
+	AWIN_A31_AHB_RESET0_USBEHCI0_RST |
+#endif
+	0,
+#if NOHCI  0
+	AWIN_A31_AHB_RESET0_USBOHCI1_RST |
+#endif
+#if NEHCI  0
+	AWIN_A31_AHB_RESET0_USBEHCI1_RST |
+#endif
+	0,
+};
 
 int
 awinusb_match(device_t parent, cfdata_t cf, void *aux)
@@ -374,19 +393,20 @@ awinusb_attach(device_t parent, device_t
 	aprint_normal(\n);
 
 	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
-		/*
-		 * Access to the USB phy is off USB0 so make sure it's on.
-		*/
+		/* Enable USB PHY */
 		awin_reg_set_clear(usbsc-usbsc_bst, aio-aio_ccm_bsh,
-		AWIN_AHB_GATING0_REG,
-		awinusb_ahb_gating_a31[loc-loc_port], 0);
+		AWIN_USB_CLK_REG, awinusb_usb_clk_set_a31[loc-loc_port],
+		0);
 
-		/*
-		 * Enable the USB phy for this port.
-		 */
+		/* AHB gate enable */
 		awin_reg_set_clear(usbsc-usbsc_bst, aio-aio_ccm_bsh,
-		AWIN_USB_CLK_REG, awinusb_usb_clk_set_a31[loc-loc_port],
+		AWIN_AHB_GATING0_REG,
+		AWIN_A31_AHB_GATING0_USB0 | awinusb_ahb_gating_a31[loc-loc_port],
 		0);
+
+		/* Soft reset */
+		awin_reg_set_clear(usbsc-usbsc_bst, 

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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 13:08:12 UTC 2014

Modified Files:
src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
define usb1restrict pin for Hummingbird A31


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/awin/awin_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/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.13 src/sys/arch/evbarm/awin/awin_machdep.c:1.14
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.13	Fri Oct 10 07:37:50 2014
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Sun Oct 12 13:08:12 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.13 2014/10/10 07:37:50 jmcneill Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.14 2014/10/12 13:08:12 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.13 2014/10/10 07:37:50 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.14 2014/10/12 13:08:12 jmcneill Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -602,6 +602,7 @@ awin_device_register(device_t self, void
 #endif
 #if AWIN_board == AWIN_hummingbird_a31
 		prop_dictionary_set_cstring(dict, usb1drv, PH27);
+		prop_dictionary_set_cstring(dict, usb1restrict, PH26);
 		prop_dictionary_set_cstring(dict, usb2drv, PH24);
 #else
 		prop_dictionary_set_cstring(dict, usb2drv, PH3);



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 13:08:54 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: HUMMINGBIRD_A31

Log Message:
enable ehci, ohci, and USB device drivers


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31

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/HUMMINGBIRD_A31
diff -u src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.4 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.5
--- src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.4	Sat Oct 11 17:35:06 2014
+++ src/sys/arch/evbarm/conf/HUMMINGBIRD_A31	Sun Oct 12 13:08:54 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: HUMMINGBIRD_A31,v 1.4 2014/10/11 17:35:06 jmcneill Exp $
+#	$NetBSD: HUMMINGBIRD_A31,v 1.5 2014/10/12 13:08:54 jmcneill Exp $
 #
 #	HUMMINGBIRD_A31 - Merrii Hummingbird A31
 #
@@ -220,26 +220,28 @@ awinrtc*	at awinio?
 awinac0		at awinio0
 audio0		at awinac0
 
+# 10/100/1000 Ethernet (A10/A20)
+#awge0		at awinio0 port ?
+
 # On-board USB
-#awinusb0	at awinio0 port 0
-#awinusb1	at awinio0 port 1
-#ohci*		at awinusb?
-#ehci*		at awinusb?
-#usb*		at ohci?
-#usb*		at ehci?
+awinusb0	at awinio0 port 0
+awinusb1	at awinio0 port 1
+ohci*		at awinusb?
+ehci*		at awinusb?
+usb*		at ohci?
+usb*		at ehci?
 
 # USB OTG
 #motg0		at awinio0
 #usb*		at motg?
 
-#include dev/usb/usbdevices.config
+include dev/usb/usbdevices.config
 
-# 10/100/1000 Ethernet (A10/A20)
-#awge0		at awinio0 port ?
+midi*		at midibus?
 
-#rlphy*		at mii? phy ?
-#rgephy* 	at mii? phy ?
-#ukphy*		at mii? phy ?
+rlphy*		at mii? phy ?
+rgephy* 	at mii? phy ?
+ukphy*		at mii? phy ?
 
 # Pseudo-Devices
 



CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 13:48:26 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
Add the simple unconnected tests too.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.1 src/tests/net/mcast/t_mcast.c:1.2
--- src/tests/net/mcast/t_mcast.c:1.1	Sat Oct 11 19:04:42 2014
+++ src/tests/net/mcast/t_mcast.c	Sun Oct 12 09:48:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.1 2014/10/11 23:04:42 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.2 2014/10/12 13:48:25 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mcast.c,v 1.1 2014/10/11 23:04:42 christos Exp $);
+__RCSID($NetBSD: t_mcast.c,v 1.2 2014/10/12 13:48:25 christos Exp $);
 
 #include sys/types.h
 #include sys/socket.h
@@ -45,6 +45,7 @@ __RCSID($NetBSD: t_mcast.c,v 1.1 2014/1
 #include err.h
 #include errno.h
 #include poll.h
+#include stdbool.h
 
 #ifndef TEST
 #include atf-c.h
@@ -125,6 +126,15 @@ allowv4mapped(int s, struct addrinfo *ai
 	return setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, zero, sizeof(zero));
 }
 
+static struct sockaddr_storage ss;
+static int
+connector(int fd, const struct sockaddr *sa, socklen_t slen)
+{
+	assert(sizeof(ss)  slen);
+	memcpy(ss, sa, slen);
+	return 0;
+}
+
 static int
 getsocket(const char *host, const char *port,
 int (*f)(int, const struct sockaddr *, socklen_t))
@@ -156,7 +166,7 @@ getsocket(const char *host, const char *
 			cause = f == bind ? bind : connect;
 			goto out;
 		}
-		if (f == bind  addmc(s, ai) == -1) {
+		if ((f == bind || f == connector)  addmc(s, ai) == -1) {
 			cause = join group;
 			goto out;
 		}
@@ -173,20 +183,21 @@ out:
 }
 
 static void
-sender(const char *host, const char *port, size_t n)
+sender(const char *host, const char *port, size_t n, bool conn)
 {
 	int s;
 	ssize_t l;
 	size_t seq;
 	char buf[64];
 
-	s = getsocket(host, port, connect);
+	s = getsocket(host, port, conn ? connect : connector);
 	for (seq = 0; seq  n; seq++) {
 		time_t t = time(t);
 		snprintf(buf, sizeof(buf), %zu: %-24.24s, seq, ctime(t));
 		if (debug)
 			printf(sending: %s\n, buf);
-		l = send(s, buf, sizeof(buf), 0);
+		l = conn ? send(s, buf, sizeof(buf), 0) :
+		sendto(s, buf, sizeof(buf), 0, (void *)ss, ss.ss_len);
 		if (l == -1)
 			ERRX(EXIT_FAILURE, send (%s), strerror(errno));
 		usleep(100);
@@ -194,21 +205,24 @@ sender(const char *host, const char *por
 }
 
 static void
-receiver(const char *host, const char *port, size_t n)
+receiver(const char *host, const char *port, size_t n, bool conn)
 {
 	int s;
 	ssize_t l;
 	size_t seq;
 	char buf[64];
 	struct pollfd pfd;
+	socklen_t slen;
 
-	s = getsocket(host, port, bind);
+	s = getsocket(host, port, conn ? bind : connector);
 	pfd.fd = s;
 	pfd.events = POLLIN;
 	for (seq = 0; seq  n; seq++) {
 		if (poll(pfd, 1, 1000) == -1)
 			ERRX(EXIT_FAILURE, poll (%s), strerror(errno));
-		l = recv(s, buf, sizeof(buf), 0);
+		slen = ss.ss_len;
+		l = conn ? recv(s, buf, sizeof(buf), 0) :
+		recvfrom(s, buf, sizeof(buf), 0, (void *)ss, slen);
 		if (l == -1)
 			ERRX(EXIT_FAILURE, recv (%s), strerror(errno));
 		if (debug)
@@ -217,17 +231,17 @@ receiver(const char *host, const char *p
 }
 
 static void
-run(const char *host, const char *port, size_t n)
+run(const char *host, const char *port, size_t n, bool conn)
 {
 	switch (fork()) {
 	case 0:
-		receiver(host, port, n);
+		receiver(host, port, n, conn);
 		return;
 	case -1:
 		ERRX(EXIT_FAILURE, fork (%s), strerror(errno));
 	default:
 		usleep(100);
-		sender(host, port, n);
+		sender(host, port, n, conn);
 		return;
 	}
 }
@@ -239,12 +253,14 @@ main(int argc, char *argv[])
 	const char *host, *port;
 	int c;
 	size_t n;
+	bool conn;
 
 	host = HOST_V4;
 	port = PORT_V4;
 	n = TOTAL;
+	conn = false;
 
-	while ((c = getopt(argc, argv, 46dmn:)) != -1)
+	while ((c = getopt(argc, argv, 46cdmn:)) != -1)
 		switch (c) {
 		case '4':
 			host = HOST_V4;
@@ -254,6 +270,9 @@ main(int argc, char *argv[])
 			host = HOST_V6;
 			port = PORT_V6;
 			break;
+		case 'c':
+			conn = true;
+			break;
 		case 'd':
 			debug++;
 			break;
@@ -265,54 +284,90 @@ main(int argc, char *argv[])
 			n = atoi(optarg);
 			break;
 		default:
-			fprintf(stderr, Usage: %s [-dm46] [-n tot],
+			fprintf(stderr, Usage: %s [-cdm46] [-n tot],
 			getprogname());
 			return 1;
 		}
 
-	run(host, port, n);
+	run(host, port, n, conn);
 	return 0;
 }
 #else
 
-ATF_TC(inet4);
-ATF_TC_HEAD(inet4, tc)
+ATF_TC(conninet4);
+ATF_TC_HEAD(conninet4, tc)
+{
+	atf_tc_set_md_var(tc, descr, Checks connected multicast for ipv4);
+}
+
+ATF_TC_BODY(conninet4, tc)
+{
+	run(HOST_V4, PORT_V4, TOTAL, 

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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 14:04:52 UTC 2014

Modified Files:
src/sys/arch/evbarm/awin: awin_machdep.c

Log Message:
PH22 for audiopactrl on Hummingbird A31


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/awin/awin_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/evbarm/awin/awin_machdep.c
diff -u src/sys/arch/evbarm/awin/awin_machdep.c:1.14 src/sys/arch/evbarm/awin/awin_machdep.c:1.15
--- src/sys/arch/evbarm/awin/awin_machdep.c:1.14	Sun Oct 12 13:08:12 2014
+++ src/sys/arch/evbarm/awin/awin_machdep.c	Sun Oct 12 14:04:52 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_machdep.c,v 1.14 2014/10/12 13:08:12 jmcneill Exp $ */
+/*	$NetBSD: awin_machdep.c,v 1.15 2014/10/12 14:04:52 jmcneill Exp $ */
 
 /*
  * Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.14 2014/10/12 13:08:12 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_machdep.c,v 1.15 2014/10/12 14:04:52 jmcneill Exp $);
 
 #include opt_machdep.h
 #include opt_ddb.h
@@ -628,7 +628,12 @@ awin_device_register(device_t self, void
 #elif AWIN_board == AWIN_hummingbird_a31
 		prop_dictionary_set_cstring(dict, mmc0detect, PH8);
 #endif
+
+#if AWIN_board == AWIN_hummingbird_a31
+		prop_dictionary_set_cstring(dict, audiopactrl, PH22);
+#else
 		prop_dictionary_set_cstring(dict, audiopactrl, PH15);
+#endif
 
 		/*
 		 * These pins have no connections.



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 14:06:18 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_intr.h awin_io.c awin_reg.h awin_twi.c

Log Message:
different twi pinsets and irqs for A31


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/allwinner/awin_intr.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/allwinner/awin_io.c
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/allwinner/awin_reg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/allwinner/awin_twi.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/allwinner/awin_intr.h
diff -u src/sys/arch/arm/allwinner/awin_intr.h:1.5 src/sys/arch/arm/allwinner/awin_intr.h:1.6
--- src/sys/arch/arm/allwinner/awin_intr.h:1.5	Fri Oct 10 07:36:11 2014
+++ src/sys/arch/arm/allwinner/awin_intr.h	Sun Oct 12 14:06:18 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_intr.h,v 1.5 2014/10/10 07:36:11 jmcneill Exp $ */
+/* $NetBSD: awin_intr.h,v 1.6 2014/10/12 14:06:18 jmcneill Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -138,6 +138,15 @@
  * A31
  */
 #define AWIN_A31_IRQ_UART0	32
+#define AWIN_A31_IRQ_UART1	33
+#define AWIN_A31_IRQ_UART2	34
+#define AWIN_A31_IRQ_UART3	35
+#define AWIN_A31_IRQ_UART4	36
+#define AWIN_A31_IRQ_UART5	37
+#define AWIN_A31_IRQ_TWI0	38
+#define AWIN_A31_IRQ_TWI1	39
+#define AWIN_A31_IRQ_TWI2	40
+#define AWIN_A31_IRQ_TWI3	41
 #define AWIN_A31_IRQ_AC		61
 #define AWIN_A31_IRQ_DMA	82
 #define AWIN_A31_IRQ_SDMMC0	92

Index: src/sys/arch/arm/allwinner/awin_io.c
diff -u src/sys/arch/arm/allwinner/awin_io.c:1.17 src/sys/arch/arm/allwinner/awin_io.c:1.18
--- src/sys/arch/arm/allwinner/awin_io.c:1.17	Sat Oct 11 10:31:13 2014
+++ src/sys/arch/arm/allwinner/awin_io.c	Sun Oct 12 14:06:18 2014
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.17 2014/10/11 10:31:13 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.18 2014/10/12 14:06:18 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -122,16 +122,20 @@ static const struct awin_locators awin_l
 	{ awinmmc, OFFANDSIZE(SDMMC1), 4, AWIN_IRQ_SDMMC1, A10|A20 },
 	{ awinmmc, OFFANDSIZE(SDMMC0), 0, AWIN_A31_IRQ_SDMMC0, A31 },
 	{ ahcisata, OFFANDSIZE(SATA), NOPORT, AWIN_IRQ_SATA, A10|A20 },
-	{ awiniic, OFFANDSIZE(TWI0), 0, AWIN_IRQ_TWI0, AANY },
-	{ awiniic, OFFANDSIZE(TWI1), 1, AWIN_IRQ_TWI1, AANY },
-	{ awiniic, OFFANDSIZE(TWI2), 2, AWIN_IRQ_TWI2, AANY },
-	{ awiniic, OFFANDSIZE(TWI3), 3, AWIN_IRQ_TWI3, AANY },
-	{ awiniic, OFFANDSIZE(TWI4), 4, AWIN_IRQ_TWI4, AANY },
+	{ awiniic, OFFANDSIZE(TWI0), 0, AWIN_IRQ_TWI0, A10|A20 },
+	{ awiniic, OFFANDSIZE(TWI1), 1, AWIN_IRQ_TWI1, A10|A20 },
+	{ awiniic, OFFANDSIZE(TWI2), 2, AWIN_IRQ_TWI2, A10|A20 },
+	{ awiniic, OFFANDSIZE(TWI3), 3, AWIN_IRQ_TWI3, A10|A20 },
+	{ awiniic, OFFANDSIZE(TWI4), 4, AWIN_IRQ_TWI4, A10|A20 },
+	{ awiniic, OFFANDSIZE(TWI0), 0, AWIN_A31_IRQ_TWI0, A31 },
+	{ awiniic, OFFANDSIZE(TWI1), 1, AWIN_A31_IRQ_TWI1, A31 },
+	{ awiniic, OFFANDSIZE(TWI2), 2, AWIN_A31_IRQ_TWI2, A31 },
+	{ awiniic, OFFANDSIZE(TWI3), 3, AWIN_A31_IRQ_TWI3, A31 },
 	{ spi, OFFANDSIZE(SPI0), 0, AWIN_IRQ_SPI0, AANY },
 	{ spi, OFFANDSIZE(SPI1), 1, AWIN_IRQ_SPI1, AANY },
 	{ spi, OFFANDSIZE(SPI2), 1, AWIN_IRQ_SPI2, AANY },
 	{ spi, OFFANDSIZE(SPI3), 3, AWIN_IRQ_SPI3, AANY },
-	{ awe, OFFANDSIZE(EMAC), NOPORT, AWIN_IRQ_EMAC, AANY },
+	{ awe, OFFANDSIZE(EMAC), NOPORT, AWIN_IRQ_EMAC, A10|A20 },
 	{ awge, OFFANDSIZE(GMAC), NOPORT, AWIN_IRQ_GMAC, A20 },
 	{ awge, OFFANDSIZE(GMAC), NOPORT, AWIN_A31_IRQ_GMAC, A31 },
 	{ awincrypto, OFFANDSIZE(SS), NOPORT, AWIN_IRQ_SS, AANY },

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.30 src/sys/arch/arm/allwinner/awin_reg.h:1.31
--- src/sys/arch/arm/allwinner/awin_reg.h:1.30	Sun Oct 12 13:07:45 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sun Oct 12 14:06:18 2014
@@ -1780,4 +1780,14 @@ struct awin_mmc_idma_descriptor {
 
 #define AWIN_A31_MMC_FIFO			0x0200
 
+#define AWIN_A31_PIO_PB_TWI3_FUNC	2
+#define AWIN_A31_PIO_PB_TWI3_PINS	0x0060 /* PB pins 6-5 */
+
+#define AWIN_A31_PIO_PH_TWI0_FUNC	2
+#define AWIN_A31_PIO_PH_TWI0_PINS	0xc000 /* PH pins 15-14 */
+#define AWIN_A31_PIO_PH_TWI1_FUNC	2
+#define AWIN_A31_PIO_PH_TWI1_PINS	0x0003 /* PH pins 17-16 */
+#define AWIN_A31_PIO_PH_TWI2_FUNC	2
+#define AWIN_A31_PIO_PH_TWI2_PINS	0x000c /* PH pins 19-18 */
+
 #endif /* _ARM_ALLWINNER_AWIN_REG_H_ */

Index: src/sys/arch/arm/allwinner/awin_twi.c
diff -u src/sys/arch/arm/allwinner/awin_twi.c:1.3 src/sys/arch/arm/allwinner/awin_twi.c:1.4
--- src/sys/arch/arm/allwinner/awin_twi.c:1.3	Thu Feb 20 21:48:38 2014
+++ src/sys/arch/arm/allwinner/awin_twi.c	Sun Oct 12 14:06:18 2014
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_twi.c,v 1.3 2014/02/20 21:48:38 matt Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_twi.c,v 

CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 14:53:46 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
Explain a bit more what's going on with the multicast setsockopts.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.2 src/tests/net/mcast/t_mcast.c:1.3
--- src/tests/net/mcast/t_mcast.c:1.2	Sun Oct 12 09:48:25 2014
+++ src/tests/net/mcast/t_mcast.c	Sun Oct 12 10:53:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.2 2014/10/12 13:48:25 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.3 2014/10/12 14:53:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mcast.c,v 1.2 2014/10/12 13:48:25 christos Exp $);
+__RCSID($NetBSD: t_mcast.c,v 1.3 2014/10/12 14:53:46 christos Exp $);
 
 #include sys/types.h
 #include sys/socket.h
@@ -90,7 +90,11 @@ addmc(int s, struct addrinfo *ai)
 		m4, sizeof(m4));
 	case AF_INET6:
 		s6 = (void *)ai-ai_addr;
+#if defined(__linux__) || defined(__NetBSD__)
 		// XXX: Both linux and we do this thing wrong...
+		// It is just difficult to make the regular IPv6 multicast
+		// calls to work with mapped addresses because the code is
+		// not structured properly. MacOS/X works properly.
 		if (IN6_IS_ADDR_V4MAPPED(s6-sin6_addr)) {
 			memcpy(m4.imr_multiaddr, s6-sin6_addr.s6_addr[12],
 			sizeof(m4.imr_multiaddr));
@@ -98,6 +102,7 @@ addmc(int s, struct addrinfo *ai)
 			return setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,
 			m4, sizeof(m4));
 		}
+#endif
 		assert(sizeof(*s6) == ai-ai_addrlen);
 		memset(m6, 0, sizeof(m6));
 		m6.ipv6mr_interface = 0;



CVS commit: src/usr.bin/config

2014-10-12 Thread Masao Uebayashi
Module Name:src
Committed By:   uebayasi
Date:   Sun Oct 12 15:35:40 UTC 2014

Modified Files:
src/usr.bin/config: sem.c

Log Message:
Don't shadow global 'devname' on macppc.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.bin/config/sem.c

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

Modified files:

Index: src/usr.bin/config/sem.c
diff -u src/usr.bin/config/sem.c:1.62 src/usr.bin/config/sem.c:1.63
--- src/usr.bin/config/sem.c:1.62	Sat Oct 11 17:27:42 2014
+++ src/usr.bin/config/sem.c	Sun Oct 12 15:35:40 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: sem.c,v 1.62 2014/10/11 17:27:42 martin Exp $	*/
+/*	$NetBSD: sem.c,v 1.63 2014/10/12 15:35:40 uebayasi Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -142,12 +142,12 @@ finddep(struct attr *a, const char *name
 }
 
 static void
-mergedeps(const char *devname, const char *name)
+mergedeps(const char *dname, const char *name)
 {
 	struct attr *a, *newa;
 
-	CFGDBG(4, merging attr `%s' to devbase `%s', name, devname);
-	a = refattr(devname);
+	CFGDBG(4, merging attr `%s' to devbase `%s', name, dname);
+	a = refattr(dname);
 	if (finddep(a, name) == NULL) {
 		newa = refattr(name);
 		a-a_deps = attrlist_cons(a-a_deps, newa);



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 15:38:46 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: HUMMINGBIRD_A31

Log Message:
A31 needs a different DMA controller driver, disable awindma and awinac for now


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31

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/HUMMINGBIRD_A31
diff -u src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.5 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.6
--- src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.5	Sun Oct 12 13:08:54 2014
+++ src/sys/arch/evbarm/conf/HUMMINGBIRD_A31	Sun Oct 12 15:38:45 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: HUMMINGBIRD_A31,v 1.5 2014/10/12 13:08:54 jmcneill Exp $
+#	$NetBSD: HUMMINGBIRD_A31,v 1.6 2014/10/12 15:38:45 jmcneill Exp $
 #
 #	HUMMINGBIRD_A31 - Merrii Hummingbird A31
 #
@@ -194,7 +194,7 @@ ld*		at sdmmc?
 awinicu0	at awinio0 
 
 # DMA Controller
-awindma0	at awinio0
+#awindma0	at awinio0
 
 # GPIO Controller
 awingpio0	at awinio0
@@ -217,8 +217,8 @@ awinwdt*	at awinio?
 awinrtc*	at awinio?
 
 # onboard audio codec
-awinac0		at awinio0
-audio0		at awinac0
+#awinac0		at awinio0
+#audio0		at awinac0
 
 # 10/100/1000 Ethernet (A10/A20)
 #awge0		at awinio0 port ?



CVS commit: src/usr.bin/config

2014-10-12 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Sun Oct 12 15:54:19 UTC 2014

Modified Files:
src/usr.bin/config: TODO

Log Message:
Allow easier adding/removing of options without regard to
whether or not they were already defined.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/config/TODO

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/config/TODO
diff -u src/usr.bin/config/TODO:1.3 src/usr.bin/config/TODO:1.4
--- src/usr.bin/config/TODO:1.3	Sun Oct 12 08:04:30 2014
+++ src/usr.bin/config/TODO	Sun Oct 12 15:54:19 2014
@@ -62,3 +62,19 @@ o Split cfdata.
   cfdata is pattern matching rules to enable devices at runtime device
   auto-configuration.  It is pure data and can (should) be generated separately
   from the code.
+
+o Allow easier adding and removing of options.
+
+  It should be possible to add or remove options, flags, etc.,
+  without regard to whether or not they are already defined.
+  For example, a configuration like this:
+
+	include GENERIC
+	options FOO
+	no options BAR
+
+  should work regardless of whether or not options FOO and/or
+  options BAR were defined in GENERIC.  It should not give
+  errors like options BAR was already defined or options FOO
+  was not defined.
+



CVS commit: src/sys/kern

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 16:23:20 UTC 2014

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

Log Message:
fix compilation with TODR_DEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/kern_todr.c

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

Modified files:

Index: src/sys/kern/kern_todr.c
diff -u src/sys/kern/kern_todr.c:1.35 src/sys/kern/kern_todr.c:1.36
--- src/sys/kern/kern_todr.c:1.35	Thu Aug 29 01:05:29 2013
+++ src/sys/kern/kern_todr.c	Sun Oct 12 16:23:20 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_todr.c,v 1.35 2013/08/29 01:05:29 tls Exp $	*/
+/*	$NetBSD: kern_todr.c,v 1.36 2014/10/12 16:23:20 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_todr.c,v 1.35 2013/08/29 01:05:29 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_todr.c,v 1.36 2014/10/12 16:23:20 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -226,7 +226,7 @@ todr_debug(const char *prefix, int rv, s
 	printf(%s: rtc_offset = %d\n, prefix, rtc_offset);
 	printf(%s: %4u/%02u/%02u %02u:%02u:%02u, (wday %d) (epoch %u.%06u)\n,
 	prefix,
-	dt-dt_year, dt-dt_mon, dt-dt_day,
+	(unsigned)dt-dt_year, dt-dt_mon, dt-dt_day,
 	dt-dt_hour, dt-dt_min, dt-dt_sec,
 	dt-dt_wday, (unsigned)tvp-tv_sec, (unsigned)tvp-tv_usec);
 }



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 17:19:12 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_reg.h

Log Message:
more A31 regs


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/allwinner/awin_reg.h

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

Modified files:

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.31 src/sys/arch/arm/allwinner/awin_reg.h:1.32
--- src/sys/arch/arm/allwinner/awin_reg.h:1.31	Sun Oct 12 14:06:18 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sun Oct 12 17:19:12 2014
@@ -1702,6 +1702,7 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_USB3_OFFSET		0x0001c000	/* OHCI2 */
 #define AWIN_A31_PRCM_OFFSET		0x00301400	/* PRCM */
 #define AWIN_A31_CPUCFG_OFFSET		0x00301C00
+#define AWIN_A31_RTC_OFFSET		0x0030	/* RTC */
 
 #define AWIN_A31_PRCM_PWROFF_GATING_REG		0x100
 #define AWIN_A31_PRCM_CPUX_PWR_CLAMP_REG	0x0140
@@ -1721,10 +1722,17 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_AHB_RESET0_REG		0x02C0
 #define AWIN_A31_AHB_RESET1_REG		0x02C4
 #define AWIN_A31_AHB_RESET2_REG		0x02C8
+#define AWIN_A31_APB1_RESET_REG		0x02D0
 
 #define AWIN_A31_CPUCFG_RST_CTRL_CORE_RESET __BIT(1)
 #define AWIN_A31_CPUCFG_RST_CTRL_CPU_RESET __BIT(0)
 
+#define AWIN_A31_PLL2_CFG_LOCK		__BIT(28)
+#define AWIN_A31_PLL2_CFG_PLL_SDM_EN	__BIT(24)
+#define AWIN_A31_PLL2_CFG_POSTDIV_P	__BITS(19,16)
+#define AWIN_A31_PLL2_CFG_FACTOR_N	__BITS(14,8)
+#define AWIN_A31_PLL2_CFG_PREVDIV_M	__BITS(4,0)
+
 #define AWIN_A31_AHB_GATING0_USB_OHCI2	__BIT(31)
 #define AWIN_A31_AHB_GATING0_USB_OHCI1	__BIT(30)
 #define AWIN_A31_AHB_GATING0_USB_OHCI0	__BIT(29)
@@ -1766,6 +1774,11 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_AHB_RESET0_SS_RST		__BIT(5)
 #define AWIN_A31_AHB_RESET0_MIPIDSI_RST		__BIT(1)
 
+#define AWIN_A31_APB1_RESET_DAUDIO1_RST		__BIT(13)
+#define AWIN_A31_APB1_RESET_DAUDIO0_RST		__BIT(12)
+#define AWIN_A31_APB1_RESET_DIGITAL_MIC_RST	__BIT(4)
+#define AWIN_A31_APB1_RESET_CODEC_RST		__BIT(0)
+
 #define AWIN_A31_WDOG1_IRQ_EN_REG		0x00A0
 #define AWIN_A31_WDOG1_IRQ_STA_REG		0x00A4
 #define AWIN_A31_WDOG1_CTRL_REG			0x00B0
@@ -1780,6 +1793,12 @@ struct awin_mmc_idma_descriptor {
 
 #define AWIN_A31_MMC_FIFO			0x0200
 
+#define AWIN_A31_LOSC_CTRL_REG			0x
+#define AWIN_A31_RTC_YY_MM_DD_REG		0x0010
+#define AWIN_A31_RTC_HH_MM_SS_REG		0x0014
+
+#define AWIN_A31_RTC_YY_MM_DD_YEAR		__BITS(21,16)
+
 #define AWIN_A31_PIO_PB_TWI3_FUNC	2
 #define AWIN_A31_PIO_PB_TWI3_PINS	0x0060 /* PB pins 6-5 */
 



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 17:19:44 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_board.c

Log Message:
PLL2 config for A31


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/allwinner/awin_board.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/allwinner/awin_board.c
diff -u src/sys/arch/arm/allwinner/awin_board.c:1.22 src/sys/arch/arm/allwinner/awin_board.c:1.23
--- src/sys/arch/arm/allwinner/awin_board.c:1.22	Fri Oct 10 23:50:43 2014
+++ src/sys/arch/arm/allwinner/awin_board.c	Sun Oct 12 17:19:43 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: awin_board.c,v 1.22 2014/10/10 23:50:43 jmcneill Exp $	*/
+/*	$NetBSD: awin_board.c,v 1.23 2014/10/12 17:19:43 jmcneill Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.22 2014/10/10 23:50:43 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_board.c,v 1.23 2014/10/12 17:19:43 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -360,11 +360,25 @@ awin_pll2_enable(void)
 	AWIN_CCM_OFFSET + AWIN_PLL2_CFG_REG);
 
 	uint32_t ncfg = ocfg;
-	ncfg = ~(AWIN_PLL2_CFG_PREVDIV|AWIN_PLL2_CFG_FACTOR_N|AWIN_PLL2_CFG_POSTDIV);
-	ncfg |= __SHIFTIN(21, AWIN_PLL2_CFG_PREVDIV);
-	ncfg |= __SHIFTIN(86, AWIN_PLL2_CFG_FACTOR_N);
-	ncfg |= __SHIFTIN(4, AWIN_PLL2_CFG_POSTDIV);
-	ncfg |= AWIN_PLL_CFG_ENABLE;
+
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		ncfg = ~(AWIN_A31_PLL2_CFG_PREVDIV_M|
+			  AWIN_A31_PLL2_CFG_FACTOR_N|
+			  AWIN_A31_PLL2_CFG_POSTDIV_P);
+		ncfg |= __SHIFTIN(20, AWIN_A31_PLL2_CFG_PREVDIV_M);
+		ncfg |= __SHIFTIN(85, AWIN_A31_PLL2_CFG_FACTOR_N);
+		ncfg |= __SHIFTIN(3, AWIN_A31_PLL2_CFG_POSTDIV_P);
+		ncfg |= AWIN_PLL_CFG_ENABLE;
+	} else {
+		ncfg = ~(AWIN_PLL2_CFG_PREVDIV|
+			  AWIN_PLL2_CFG_FACTOR_N|
+			  AWIN_PLL2_CFG_POSTDIV);
+		ncfg |= __SHIFTIN(21, AWIN_PLL2_CFG_PREVDIV);
+		ncfg |= __SHIFTIN(86, AWIN_PLL2_CFG_FACTOR_N);
+		ncfg |= __SHIFTIN(4, AWIN_PLL2_CFG_POSTDIV);
+		ncfg |= AWIN_PLL_CFG_ENABLE;
+	}
+
 	if (ncfg != ocfg) {
 		bus_space_write_4(bst, bsh,
 		AWIN_CCM_OFFSET + AWIN_PLL2_CFG_REG, ncfg);



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 17:20:46 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_io.c

Log Message:
DMA not required on A31 until it works, add A31 RTC locator


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/allwinner/awin_io.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/allwinner/awin_io.c
diff -u src/sys/arch/arm/allwinner/awin_io.c:1.18 src/sys/arch/arm/allwinner/awin_io.c:1.19
--- src/sys/arch/arm/allwinner/awin_io.c:1.18	Sun Oct 12 14:06:18 2014
+++ src/sys/arch/arm/allwinner/awin_io.c	Sun Oct 12 17:20:46 2014
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.18 2014/10/12 14:06:18 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.19 2014/10/12 17:20:46 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -95,7 +95,7 @@ static const struct awin_locators awin_l
 	{ awinicu, OFFANDSIZE(INTC), NOPORT, NOINTR, A10|REQ },
 	{ awingpio, OFFANDSIZE(PIO), NOPORT, NOINTR, AANY|REQ },
 	{ awindma, OFFANDSIZE(DMA), NOPORT, AWIN_IRQ_DMA, A10|A20|REQ },
-	{ awindma, OFFANDSIZE(DMA), NOPORT, AWIN_A31_IRQ_DMA, A31|REQ },
+	{ awindma, OFFANDSIZE(DMA), NOPORT, AWIN_A31_IRQ_DMA, A31 },
 	{ awintmr, OFFANDSIZE(TMR), NOPORT, AWIN_IRQ_TMR0, A10 },
 	{ com, OFFANDSIZE(UART0), 0, AWIN_IRQ_UART0, A10|A20 },
 	{ com, OFFANDSIZE(UART1), 1, AWIN_IRQ_UART1, A10|A20 },
@@ -107,7 +107,8 @@ static const struct awin_locators awin_l
 	{ com, OFFANDSIZE(UART7), 7, AWIN_IRQ_UART7, A10|A20 },
 	{ com, OFFANDSIZE(UART0), 0, AWIN_A31_IRQ_UART0, A31 },
 	{ awinwdt, OFFANDSIZE(TMR), NOPORT, NOINTR, AANY },
-	{ awinrtc, OFFANDSIZE(TMR), NOPORT, NOINTR, AANY },
+	{ awinrtc, OFFANDSIZE(TMR), NOPORT, NOINTR, A10|A20 },
+	{ awinrtc, OFFANDSIZE(A31_RTC), NOPORT, NOINTR, A31 },
 	{ awinhdmi, OFFANDSIZE(HDMI), NOPORT, AWIN_IRQ_HDMI0, A20 },
 	{ awinusb, OFFANDSIZE(USB1), 0, NOINTR, A10|A20 },
 	{ awinusb, OFFANDSIZE(USB2), 1, NOINTR, A10|A20 },



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 17:20:58 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_rtc.c

Log Message:
A31 RTC support


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/allwinner/awin_rtc.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/allwinner/awin_rtc.c
diff -u src/sys/arch/arm/allwinner/awin_rtc.c:1.1 src/sys/arch/arm/allwinner/awin_rtc.c:1.2
--- src/sys/arch/arm/allwinner/awin_rtc.c:1.1	Sun Sep  7 17:49:39 2014
+++ src/sys/arch/arm/allwinner/awin_rtc.c	Sun Oct 12 17:20:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_rtc.c,v 1.1 2014/09/07 17:49:39 jmcneill Exp $ */
+/* $NetBSD: awin_rtc.c,v 1.2 2014/10/12 17:20:58 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_rtc.c,v 1.1 2014/09/07 17:49:39 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_rtc.c,v 1.2 2014/10/12 17:20:58 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -46,8 +46,16 @@ struct awin_rtc_softc {
 	bus_space_tag_t sc_bst;
 	bus_space_handle_t sc_bsh;
 	struct todr_chip_handle sc_todr;
+	uint32_t sc_loscctrl_reg;
+	uint32_t sc_yymmdd_reg;
+	uint32_t sc_hhmmss_reg;
 };
 
+#define RTC_READ(sc, reg) \
+bus_space_read_4((sc)-sc_bst, (sc)-sc_bsh, (reg))
+#define RTC_WRITE(sc, reg, val) \
+bus_space_write_4((sc)-sc_bst, (sc)-sc_bsh, (reg), (val))
+
 static int	awin_rtc_match(device_t, cfdata_t, void *);
 static void	awin_rtc_attach(device_t, device_t, void *);
 
@@ -81,6 +89,16 @@ awin_rtc_attach(device_t parent, device_
 	bus_space_subregion(sc-sc_bst, aio-aio_core_bsh,
 	loc-loc_offset, loc-loc_size, sc-sc_bsh);
 
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		sc-sc_loscctrl_reg = AWIN_A31_LOSC_CTRL_REG;
+		sc-sc_yymmdd_reg = AWIN_A31_RTC_YY_MM_DD_REG;
+		sc-sc_hhmmss_reg = AWIN_A31_RTC_HH_MM_SS_REG;
+	} else {
+		sc-sc_loscctrl_reg = AWIN_LOSC_CTRL_REG;
+		sc-sc_yymmdd_reg = AWIN_RTC_YY_MM_DD_REG;
+		sc-sc_hhmmss_reg = AWIN_RTC_HH_MM_SS_REG;
+	}
+
 	aprint_naive(\n);
 	aprint_normal(: RTC\n);
 
@@ -96,12 +114,12 @@ awin_rtc_gettime(todr_chip_handle_t tch,
 	struct awin_rtc_softc *sc = tch-cookie;
 	uint32_t yymmdd, hhmmss;
 
-	yymmdd = bus_space_read_4(sc-sc_bst, sc-sc_bsh,
-	AWIN_RTC_YY_MM_DD_REG);
-	hhmmss = bus_space_read_4(sc-sc_bst, sc-sc_bsh,
-	AWIN_RTC_HH_MM_SS_REG);
+	yymmdd = RTC_READ(sc, sc-sc_yymmdd_reg);
+	hhmmss = RTC_READ(sc, sc-sc_hhmmss_reg);
 
-	dt-dt_year = __SHIFTOUT(yymmdd, AWIN_RTC_YY_MM_DD_YEAR) +
+	dt-dt_year = __SHIFTOUT(yymmdd,
+	awin_chip_id() == AWIN_CHIP_ID_A31 ?
+	AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR) +
 	POSIX_BASE_YEAR;
 	dt-dt_mon = __SHIFTOUT(yymmdd, AWIN_RTC_YY_MM_DD_MONTH);
 	dt-dt_day = __SHIFTOUT(yymmdd, AWIN_RTC_YY_MM_DD_DAY);
@@ -119,13 +137,14 @@ awin_rtc_settime(todr_chip_handle_t tch,
 	struct awin_rtc_softc *sc = tch-cookie;
 	uint32_t yymmdd, hhmmss, losc;
 
-	losc = bus_space_read_4(sc-sc_bst, sc-sc_bsh, AWIN_LOSC_CTRL_REG);
+	losc = RTC_READ(sc, sc-sc_loscctrl_reg);
 	if (losc  AWIN_LOSC_CTRL_BUSY)
 		return EBUSY;
 
 	yymmdd = 0;
 	yymmdd |= __SHIFTIN(dt-dt_year - POSIX_BASE_YEAR,
-	AWIN_RTC_YY_MM_DD_YEAR);
+	awin_chip_id() == AWIN_CHIP_ID_A31 ?
+	AWIN_A31_RTC_YY_MM_DD_YEAR : AWIN_RTC_YY_MM_DD_YEAR);
 	yymmdd |= __SHIFTIN(dt-dt_mon, AWIN_RTC_YY_MM_DD_MONTH);
 	yymmdd |= __SHIFTIN(dt-dt_day, AWIN_RTC_YY_MM_DD_DAY);
 	hhmmss = 0;
@@ -134,10 +153,8 @@ awin_rtc_settime(todr_chip_handle_t tch,
 	hhmmss |= __SHIFTIN(dt-dt_min, AWIN_RTC_HH_MM_SS_MINUTE);
 	hhmmss |= __SHIFTIN(dt-dt_sec, AWIN_RTC_HH_MM_SS_SECOND);
 
-	bus_space_write_4(sc-sc_bst, sc-sc_bsh, AWIN_RTC_YY_MM_DD_REG,
-	yymmdd);
-	bus_space_write_4(sc-sc_bst, sc-sc_bsh, AWIN_RTC_HH_MM_SS_REG,
-	hhmmss);
+	RTC_WRITE(sc, sc-sc_yymmdd_reg, yymmdd);
+	RTC_WRITE(sc, sc-sc_hhmmss_reg, hhmmss);
 
 	return 0;
 }



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 17:25:35 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_ac.c

Log Message:
soft reset A31 codec at attach time


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/allwinner/awin_ac.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/allwinner/awin_ac.c
diff -u src/sys/arch/arm/allwinner/awin_ac.c:1.12 src/sys/arch/arm/allwinner/awin_ac.c:1.13
--- src/sys/arch/arm/allwinner/awin_ac.c:1.12	Sat Sep  6 23:04:10 2014
+++ src/sys/arch/arm/allwinner/awin_ac.c	Sun Oct 12 17:25:35 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_ac.c,v 1.12 2014/09/06 23:04:10 jmcneill Exp $ */
+/* $NetBSD: awin_ac.c,v 1.13 2014/10/12 17:25:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
 #include opt_ddb.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: awin_ac.c,v 1.12 2014/09/06 23:04:10 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: awin_ac.c,v 1.13 2014/10/12 17:25:35 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -354,6 +354,11 @@ awinac_attach(device_t parent, device_t 
 	if (sc-sc_has_pactrl_gpio)
 		awin_gpio_pindata_write(sc-sc_pactrl_gpio, 0);
 
+	if (awin_chip_id() == AWIN_CHIP_ID_A31) {
+		awin_reg_set_clear(sc-sc_bst, aio-aio_ccm_bsh,
+		AWIN_A31_APB1_RESET_REG, AWIN_A31_APB1_RESET_CODEC_RST, 0);
+	}
+
 	awinac_init(sc);
 
 	sc-sc_pdma = awin_dma_alloc(AWIN_DMA_TYPE_NDMA, awinac_pint, sc);



CVS commit: src/common/lib/libc/atomic

2014-10-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 12 17:51:47 UTC 2014

Added Files:
src/common/lib/libc/atomic: atomic_c11_compare_exchange_cas_16.c
atomic_c11_compare_exchange_cas_32.c
atomic_c11_compare_exchange_cas_8.c

Log Message:
Provide __atomic_compare_exchange_N (as needed for the C11 2011 atomic
ops) via the corresponding CAS.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c \
src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c \
src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c

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

Added files:

Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c
diff -u /dev/null src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c:1.1
--- /dev/null	Sun Oct 12 17:51:47 2014
+++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c	Sun Oct 12 17:51:47 2014
@@ -0,0 +1,52 @@
+/*	$NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.1 2014/10/12 17:51:47 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Martin Husemann.
+ *
+ * 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 atomic_op_namespace.h
+
+#if !defined(_KERNEL)  !defined(_STANDALONE)
+#include stdbool.h
+#endif
+#include sys/atomic.h
+
+bool
+__atomic_compare_exchange_2(volatile uint16_t *mem,
+uint16_t *expected, uint16_t desired,
+bool weak, int success, int failure)
+{
+	uint16_t old = *expected;
+
+	/*
+	 * Ignore the details (weak, memory model on success and failure)
+	 * and just do the cas. If we get here the compiler couldn't
+	 * do better and it mostly will not matter at all.
+	 */
+	return atomic_cas_16(mem, old, desired) == old;
+}
Index: src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c
diff -u /dev/null src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c:1.1
--- /dev/null	Sun Oct 12 17:51:47 2014
+++ src/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c	Sun Oct 12 17:51:47 2014
@@ -0,0 +1,52 @@
+/*	$NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.1 2014/10/12 17:51:47 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Martin Husemann.
+ *
+ * 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
+ * 

CVS commit: src/common/lib/libc/arch/vax/atomic

2014-10-12 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Oct 12 17:53:33 UTC 2014

Modified Files:
src/common/lib/libc/arch/vax/atomic: Makefile.inc

Log Message:
Hook __atomic_compare_exchange_N into vax libc.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/arch/vax/atomic/Makefile.inc

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/vax/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/vax/atomic/Makefile.inc:1.6 src/common/lib/libc/arch/vax/atomic/Makefile.inc:1.7
--- src/common/lib/libc/arch/vax/atomic/Makefile.inc:1.6	Sat Feb 22 08:53:33 2014
+++ src/common/lib/libc/arch/vax/atomic/Makefile.inc	Sun Oct 12 17:53:33 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.6 2014/02/22 08:53:33 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.7 2014/10/12 17:53:33 martin Exp $
 
 .if defined(LIB)  (${LIB} == kern || ${LIB} == c || ${LIB} == pthread \
 	|| ${LIB} == rump)
@@ -16,7 +16,10 @@ SRCS+=	atomic_add_16_cas.c atomic_add_8_
 	atomic_and_16_cas.c atomic_and_8_cas.c	\
 	atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c	\
 	atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c	\
-	atomic_swap_16_cas.c atomic_swap_8_cas.c
+	atomic_swap_16_cas.c atomic_swap_8_cas.c \
+	atomic_c11_compare_exchange_cas_32.c	\
+	atomic_c11_compare_exchange_cas_16.c	\
+	atomic_c11_compare_exchange_cas_8.c
 .endif
 
 .endif



CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 18:56:57 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
now we support the v6 ioctls for mapped addresses too.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.3 src/tests/net/mcast/t_mcast.c:1.4
--- src/tests/net/mcast/t_mcast.c:1.3	Sun Oct 12 10:53:46 2014
+++ src/tests/net/mcast/t_mcast.c	Sun Oct 12 14:56:57 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.3 2014/10/12 14:53:46 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.4 2014/10/12 18:56:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mcast.c,v 1.3 2014/10/12 14:53:46 christos Exp $);
+__RCSID($NetBSD: t_mcast.c,v 1.4 2014/10/12 18:56:57 christos Exp $);
 
 #include sys/types.h
 #include sys/socket.h
@@ -73,7 +73,7 @@ static int debug;
 #define HOST_V6 FF05:0:0:0:0:0:0:1
 
 static int
-addmc(int s, struct addrinfo *ai)
+addmc(int s, struct addrinfo *ai, bool bug)
 {
 	struct ip_mreq 	m4;
 	struct ipv6_mreq m6;
@@ -90,19 +90,14 @@ addmc(int s, struct addrinfo *ai)
 		m4, sizeof(m4));
 	case AF_INET6:
 		s6 = (void *)ai-ai_addr;
-#if defined(__linux__) || defined(__NetBSD__)
-		// XXX: Both linux and we do this thing wrong...
-		// It is just difficult to make the regular IPv6 multicast
-		// calls to work with mapped addresses because the code is
-		// not structured properly. MacOS/X works properly.
-		if (IN6_IS_ADDR_V4MAPPED(s6-sin6_addr)) {
+		// XXX: Linux does not support the v6 ioctls on v4 sockets!
+		if (bug  IN6_IS_ADDR_V4MAPPED(s6-sin6_addr)) {
 			memcpy(m4.imr_multiaddr, s6-sin6_addr.s6_addr[12],
 			sizeof(m4.imr_multiaddr));
 			m4.imr_interface.s_addr = htonl(INADDR_ANY);
 			return setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP,
 			m4, sizeof(m4));
 		}
-#endif
 		assert(sizeof(*s6) == ai-ai_addrlen);
 		memset(m6, 0, sizeof(m6));
 		m6.ipv6mr_interface = 0;
@@ -142,7 +137,7 @@ connector(int fd, const struct sockaddr 
 
 static int
 getsocket(const char *host, const char *port,
-int (*f)(int, const struct sockaddr *, socklen_t))
+int (*f)(int, const struct sockaddr *, socklen_t), bool bug)
 {
 	int e, s;
 	struct addrinfo hints, *ai0, *ai;
@@ -171,7 +166,7 @@ getsocket(const char *host, const char *
 			cause = f == bind ? bind : connect;
 			goto out;
 		}
-		if ((f == bind || f == connector)  addmc(s, ai) == -1) {
+		if ((f == bind || f == connector)  addmc(s, ai, bug) == -1) {
 			cause = join group;
 			goto out;
 		}
@@ -188,14 +183,14 @@ out:
 }
 
 static void
-sender(const char *host, const char *port, size_t n, bool conn)
+sender(const char *host, const char *port, size_t n, bool conn, bool bug)
 {
 	int s;
 	ssize_t l;
 	size_t seq;
 	char buf[64];
 
-	s = getsocket(host, port, conn ? connect : connector);
+	s = getsocket(host, port, conn ? connect : connector, bug);
 	for (seq = 0; seq  n; seq++) {
 		time_t t = time(t);
 		snprintf(buf, sizeof(buf), %zu: %-24.24s, seq, ctime(t));
@@ -210,7 +205,7 @@ sender(const char *host, const char *por
 }
 
 static void
-receiver(const char *host, const char *port, size_t n, bool conn)
+receiver(const char *host, const char *port, size_t n, bool conn, bool bug)
 {
 	int s;
 	ssize_t l;
@@ -219,7 +214,7 @@ receiver(const char *host, const char *p
 	struct pollfd pfd;
 	socklen_t slen;
 
-	s = getsocket(host, port, conn ? bind : connector);
+	s = getsocket(host, port, conn ? bind : connector, bug);
 	pfd.fd = s;
 	pfd.events = POLLIN;
 	for (seq = 0; seq  n; seq++) {
@@ -236,17 +231,17 @@ receiver(const char *host, const char *p
 }
 
 static void
-run(const char *host, const char *port, size_t n, bool conn)
+run(const char *host, const char *port, size_t n, bool conn, bool bug)
 {
 	switch (fork()) {
 	case 0:
-		receiver(host, port, n, conn);
+		receiver(host, port, n, conn, bug);
 		return;
 	case -1:
 		ERRX(EXIT_FAILURE, fork (%s), strerror(errno));
 	default:
 		usleep(100);
-		sender(host, port, n, conn);
+		sender(host, port, n, conn, bug);
 		return;
 	}
 }
@@ -258,12 +253,12 @@ main(int argc, char *argv[])
 	const char *host, *port;
 	int c;
 	size_t n;
-	bool conn;
+	bool conn, bug;
 
 	host = HOST_V4;
 	port = PORT_V4;
 	n = TOTAL;
-	conn = false;
+	bug = conn = false;
 
 	while ((c = getopt(argc, argv, 46cdmn:)) != -1)
 		switch (c) {
@@ -275,6 +270,9 @@ main(int argc, char *argv[])
 			host = HOST_V6;
 			port = PORT_V6;
 			break;
+		case 'b':
+			bug = true;
+			break;
 		case 'c':
 			conn = true;
 			break;
@@ -294,7 +292,7 @@ main(int argc, char *argv[])
 			return 1;
 		}
 
-	run(host, port, n, conn);
+	run(host, port, n, conn, bug);
 	return 0;
 }
 #else
@@ -307,7 +305,7 @@ 

CVS commit: src/tests/lib/libc/gen

2014-10-12 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Sun Oct 12 18:59:35 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c

Log Message:
Add some fnmatch test cases from other C library test suites


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/gen/t_fnmatch.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_fnmatch.c
diff -u src/tests/lib/libc/gen/t_fnmatch.c:1.3 src/tests/lib/libc/gen/t_fnmatch.c:1.4
--- src/tests/lib/libc/gen/t_fnmatch.c:1.3	Sun Apr  8 09:58:59 2012
+++ src/tests/lib/libc/gen/t_fnmatch.c	Sun Oct 12 18:59:35 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fnmatch.c,v 1.3 2012/04/08 09:58:59 jruoho Exp $ */
+/* $NetBSD: t_fnmatch.c,v 1.4 2014/10/12 18:59:35 justin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fnmatch.c,v 1.3 2012/04/08 09:58:59 jruoho Exp $);
+__RCSID($NetBSD: t_fnmatch.c,v 1.4 2014/10/12 18:59:35 justin Exp $);
 
 #include atf-c.h
 #include fnmatch.h
@@ -153,6 +153,30 @@ ATF_TC_BODY(fnmatch_period, tc)
 	ATF_CHECK(fnmatch(x/*y, x/.y, FNM_PATHNAME | FNM_PERIOD) != 0);
 }
 
+ATF_TC(fnmatch_initialbracket);
+ATF_TC_HEAD(fnmatch_initialbracket, tc)
+{
+	atf_tc_set_md_var(tc, descr, Test fnmatch with initial [);
+}
+
+ATF_TC_BODY(fnmatch_initialbracket, tc)
+{
+	ATF_CHECK(fnmatch([[?*\\], \\, 0) == 0);
+	ATF_CHECK(fnmatch([]?*\\], ], 0) == 0);
+	ATF_CHECK(fnmatch([!]a-], b, 0) == 0);
+	ATF_CHECK(fnmatch([]-_], ^, 0) == 0); /* range: ']', '^', '_' */
+	ATF_CHECK(fnmatch([!]-_], X, 0) == 0);
+	ATF_CHECK(fnmatch([a-z]/[a-z], a/b, 0) == 0);
+	ATF_CHECK(fnmatch([*]/b, */b, 0) == 0);
+	ATF_CHECK(fnmatch([?]/b, ?/b, 0) == 0);
+	ATF_CHECK(fnmatch([[a]/b, a/b, 0) == 0);
+	ATF_CHECK(fnmatch([[a]/b, [/b, 0) == 0);
+	ATF_CHECK(fnmatch([/b, [/b, 0) == 0);
+
+	ATF_CHECK(fnmatch([*]/b, a/b, 0) != 0);
+	ATF_CHECK(fnmatch([?]/b, a/b, 0) != 0);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -162,6 +186,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, fnmatch_noescape);
 	ATF_TP_ADD_TC(tp, fnmatch_pathname);
 	ATF_TP_ADD_TC(tp, fnmatch_period);
+	ATF_TP_ADD_TC(tp, fnmatch_initialbracket);
 
 	return atf_no_error();
 }



CVS commit: src/sys

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 19:00:21 UTC 2014

Modified Files:
src/sys/netinet: ip_output.c
src/sys/netinet6: ip6_output.c ip6_var.h

Log Message:
Refactor the multicast membership code so that we can handle v4 mapped
addresses using the v6 membership ioctls.


To generate a diff of this commit:
cvs rdiff -u -r1.231 -r1.232 src/sys/netinet/ip_output.c
cvs rdiff -u -r1.159 -r1.160 src/sys/netinet6/ip6_output.c
cvs rdiff -u -r1.62 -r1.63 src/sys/netinet6/ip6_var.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/netinet/ip_output.c
diff -u src/sys/netinet/ip_output.c:1.231 src/sys/netinet/ip_output.c:1.232
--- src/sys/netinet/ip_output.c:1.231	Sat Oct 11 17:12:51 2014
+++ src/sys/netinet/ip_output.c	Sun Oct 12 15:00:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_output.c,v 1.231 2014/10/11 21:12:51 christos Exp $	*/
+/*	$NetBSD: ip_output.c,v 1.232 2014/10/12 19:00:21 christos Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.231 2014/10/11 21:12:51 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_output.c,v 1.232 2014/10/12 19:00:21 christos Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -124,6 +124,10 @@ __KERNEL_RCSID(0, $NetBSD: ip_output.c,
 #include netinet/portalgo.h
 #include netinet/udp.h
 
+#ifdef INET6
+#include netinet6/ip6_var.h
+#endif
+
 #ifdef MROUTING
 #include netinet/ip_mroute.h
 #endif
@@ -1359,6 +1363,158 @@ ip_getoptval(const struct sockopt *sopt,
 	return 0;
 }
 
+static int
+ip_get_membership(const struct sockopt *sopt, struct ifnet **ifp,
+struct in_addr *ia, bool add)
+{
+	int error;
+	struct ip_mreq mreq;
+
+	error = sockopt_get(sopt, mreq, sizeof(mreq));
+	if (error)
+		return error;
+
+	if (!IN_MULTICAST(mreq.imr_multiaddr.s_addr))
+		return EINVAL;
+
+	memcpy(ia, mreq.imr_multiaddr, sizeof(*ia));
+
+	if (in_nullhost(mreq.imr_interface)) {
+		union {
+			struct sockaddr		dst;
+			struct sockaddr_in	dst4;
+		} u;
+		struct route ro;
+
+		if (!add) {
+			*ifp = NULL;
+			return 0;
+		}
+		/*
+		 * If no interface address was provided, use the interface of
+		 * the route to the given multicast address.
+		 */
+		struct rtentry *rt;
+		memset(ro, 0, sizeof(ro));
+
+		sockaddr_in_init(u.dst4, ia, 0);
+		rtcache_setdst(ro, u.dst);
+		*ifp = (rt = rtcache_init(ro)) != NULL ? rt-rt_ifp : NULL;
+		rtcache_free(ro);
+	} else {
+		*ifp = ip_multicast_if(mreq.imr_interface, NULL);
+		if (!add  *ifp == NULL)
+			return EADDRNOTAVAIL;
+	}
+	return 0;
+}
+
+/*
+ * Add a multicast group membership.
+ * Group must be a valid IP multicast address.
+ */
+static int
+ip_add_membership(struct ip_moptions *imo, const struct sockopt *sopt)
+{
+	struct ifnet *ifp;
+	struct in_addr ia;
+	int i, error;
+
+	if (sopt-sopt_size == sizeof(struct ip_mreq))
+		error = ip_get_membership(sopt, ifp, ia, true);
+	else
+#ifdef INET6
+		error = ip6_get_membership(sopt, ifp, ia, sizeof(ia));
+#else
+		return EINVAL;	
+#endif
+
+	if (error)
+		return error;
+
+	/*
+	 * See if we found an interface, and confirm that it
+	 * supports multicast.
+	 */
+	if (ifp == NULL || (ifp-if_flags  IFF_MULTICAST) == 0)
+		return EADDRNOTAVAIL;
+
+	/*
+	 * See if the membership already exists or if all the
+	 * membership slots are full.
+	 */
+	for (i = 0; i  imo-imo_num_memberships; ++i) {
+		if (imo-imo_membership[i]-inm_ifp == ifp 
+		in_hosteq(imo-imo_membership[i]-inm_addr, ia))
+			break;
+	}
+	if (i  imo-imo_num_memberships)
+		return EADDRINUSE;
+
+	if (i == IP_MAX_MEMBERSHIPS)
+		return ETOOMANYREFS;
+
+	/*
+	 * Everything looks good; add a new record to the multicast
+	 * address list for the given interface.
+	 */
+	if ((imo-imo_membership[i] = in_addmulti(ia, ifp)) == NULL)
+		return ENOBUFS;
+
+	++imo-imo_num_memberships;
+	return 0;
+}
+
+/*
+ * Drop a multicast group membership.
+ * Group must be a valid IP multicast address.
+ */
+static int
+ip_drop_membership(struct ip_moptions *imo, const struct sockopt *sopt)
+{
+	struct in_addr ia;
+	struct ifnet *ifp;
+	int i, error;
+
+	if (sopt-sopt_size == sizeof(struct ip_mreq))
+		error = ip_get_membership(sopt, ifp, ia, false);
+	else
+#ifdef INET6
+		error = ip6_get_membership(sopt, ifp, ia, sizeof(ia));
+#else
+		return EINVAL;
+#endif
+
+	if (error)
+		return error;
+
+	/*
+	 * Find the membership in the membership array.
+	 */
+	for (i = 0; i  imo-imo_num_memberships; ++i) {
+		if ((ifp == NULL ||
+		 imo-imo_membership[i]-inm_ifp == ifp) 
+		 in_hosteq(imo-imo_membership[i]-inm_addr, ia))
+			break;
+	}
+	if (i == imo-imo_num_memberships)
+		return EADDRNOTAVAIL;
+
+	/*
+	 * Give up the multicast address record to which the
+	 * membership points.
+	 */
+	in_delmulti(imo-imo_membership[i]);
+
+	/*
+	 * Remove the gap in the membership array.
+	 */
+	for (++i; i  

CVS commit: src/sys

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 19:02:19 UTC 2014

Modified Files:
src/sys/netinet: in.h
src/sys/netinet6: in6.h

Log Message:
document that we depend on the option numbers matching.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/netinet/in.h
cvs rdiff -u -r1.78 -r1.79 src/sys/netinet6/in6.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/netinet/in.h
diff -u src/sys/netinet/in.h:1.92 src/sys/netinet/in.h:1.93
--- src/sys/netinet/in.h:1.92	Thu Jun  5 19:48:16 2014
+++ src/sys/netinet/in.h	Sun Oct 12 15:02:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.h,v 1.92 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$NetBSD: in.h,v 1.93 2014/10/12 19:02:18 christos Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -276,6 +276,7 @@ struct ip_opts {
 #define	IP_MULTICAST_IF		9/* in_addr; set/get IP multicast i/f  */
 #define	IP_MULTICAST_TTL	10   /* u_char; set/get IP multicast ttl */
 #define	IP_MULTICAST_LOOP	11   /* u_char; set/get IP multicast loopback */
+/* The add and drop membership option numbers need to match with the v6 ones */
 #define	IP_ADD_MEMBERSHIP	12   /* ip_mreq; add an IP group membership */
 #define	IP_DROP_MEMBERSHIP	13   /* ip_mreq; drop an IP group membership */
 #define	IP_PORTALGO		18   /* int; port selection algo (rfc6056) */

Index: src/sys/netinet6/in6.h
diff -u src/sys/netinet6/in6.h:1.78 src/sys/netinet6/in6.h:1.79
--- src/sys/netinet6/in6.h:1.78	Thu Jun  5 19:48:16 2014
+++ src/sys/netinet6/in6.h	Sun Oct 12 15:02:18 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.h,v 1.78 2014/06/05 23:48:16 rmind Exp $	*/
+/*	$NetBSD: in6.h,v 1.79 2014/10/12 19:02:18 christos Exp $	*/
 /*	$KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $	*/
 
 /*
@@ -383,6 +383,7 @@ extern const struct in6_addr in6addr_lin
 #define IPV6_MULTICAST_IF	9  /* u_int; set/get IP6 multicast i/f  */
 #define IPV6_MULTICAST_HOPS	10 /* int; set/get IP6 multicast hops */
 #define IPV6_MULTICAST_LOOP	11 /* u_int; set/get IP6 multicast loopback */
+/* The join and leave membership option numbers need to match with the v4 ones */
 #define IPV6_JOIN_GROUP		12 /* ip6_mreq; join a group membership */
 #define IPV6_LEAVE_GROUP	13 /* ip6_mreq; leave a group membership */
 #define IPV6_PORTRANGE		14 /* int; range to choose for unspec port */



CVS commit: src/tests/lib/libc/gen

2014-10-12 Thread Justin Cormack
Module Name:src
Committed By:   justin
Date:   Sun Oct 12 19:08:08 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c

Log Message:
Add expect fail for PR lib/49278


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/gen/t_fnmatch.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_fnmatch.c
diff -u src/tests/lib/libc/gen/t_fnmatch.c:1.4 src/tests/lib/libc/gen/t_fnmatch.c:1.5
--- src/tests/lib/libc/gen/t_fnmatch.c:1.4	Sun Oct 12 18:59:35 2014
+++ src/tests/lib/libc/gen/t_fnmatch.c	Sun Oct 12 19:08:08 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fnmatch.c,v 1.4 2014/10/12 18:59:35 justin Exp $ */
+/* $NetBSD: t_fnmatch.c,v 1.5 2014/10/12 19:08:08 justin Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fnmatch.c,v 1.4 2014/10/12 18:59:35 justin Exp $);
+__RCSID($NetBSD: t_fnmatch.c,v 1.5 2014/10/12 19:08:08 justin Exp $);
 
 #include atf-c.h
 #include fnmatch.h
@@ -175,6 +175,8 @@ ATF_TC_BODY(fnmatch_initialbracket, tc)
 
 	ATF_CHECK(fnmatch([*]/b, a/b, 0) != 0);
 	ATF_CHECK(fnmatch([?]/b, a/b, 0) != 0);
+
+	atf_tc_expect_fail(PR lib/49278);
 }
 
 ATF_TP_ADD_TCS(tp)



CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 19:49:01 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
Explain what works, what does not and why.
Provide compatible code so that it compiles on Linux and MacOS/X with -DTEST.
We should check more OS's and see if they are broken too.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.4 src/tests/net/mcast/t_mcast.c:1.5
--- src/tests/net/mcast/t_mcast.c:1.4	Sun Oct 12 14:56:57 2014
+++ src/tests/net/mcast/t_mcast.c	Sun Oct 12 15:49:01 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.4 2014/10/12 18:56:57 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.5 2014/10/12 19:49:01 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,15 +29,22 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_mcast.c,v 1.4 2014/10/12 18:56:57 christos Exp $);
+#ifdef __RCSID
+__RCSID($NetBSD: t_mcast.c,v 1.5 2014/10/12 19:49:01 christos Exp $);
+#else
+extern const char *__progname;
+#define getprogname() __progname
+#endif
 
 #include sys/types.h
 #include sys/socket.h
+#include sys/wait.h
 #include netinet/in.h
 
 #include assert.h
 #include netdb.h
 #include time.h
+#include signal.h
 #include stdio.h
 #include string.h
 #include stdlib.h
@@ -62,7 +69,7 @@ __RCSID($NetBSD: t_mcast.c,v 1.4 2014/1
 #define SKIPX(ev, msg, ...)	errx(ev, msg, __VA_ARGS__)
 #endif
 
-static int debug;
+static int debug = 1;
 
 #define TOTAL 10
 #define PORT_V4MAPPED 
@@ -90,7 +97,16 @@ addmc(int s, struct addrinfo *ai, bool b
 		m4, sizeof(m4));
 	case AF_INET6:
 		s6 = (void *)ai-ai_addr;
-		// XXX: Linux does not support the v6 ioctls on v4 sockets!
+		/*
+		 * Linux:	Does not support the v6 ioctls on v4 mapped
+		 *		sockets but it does support the v4 ones and
+		 *		it works.
+		 * MacOS/X:	Dupports the v6 ioctls on v4 mapped sockets,
+		 *		but does not work and also does not support
+		 *		the v4 ioctls. So no way to make multicasting
+		 *		work with mapped addresses.
+		 * NetBSD:	Supports both and works for both.
+		 */
 		if (bug  IN6_IS_ADDR_V4MAPPED(s6-sin6_addr)) {
 			memcpy(m4.imr_multiaddr, s6-sin6_addr.s6_addr[12],
 			sizeof(m4.imr_multiaddr));
@@ -137,7 +153,8 @@ connector(int fd, const struct sockaddr 
 
 static int
 getsocket(const char *host, const char *port,
-int (*f)(int, const struct sockaddr *, socklen_t), bool bug)
+int (*f)(int, const struct sockaddr *, socklen_t), socklen_t *slen,
+bool bug)
 {
 	int e, s;
 	struct addrinfo hints, *ai0, *ai;
@@ -170,6 +187,7 @@ getsocket(const char *host, const char *
 			cause = join group;
 			goto out;
 		}
+		*slen = ai-ai_addrlen;
 		break;
 out:
 		close(s);
@@ -189,15 +207,16 @@ sender(const char *host, const char *por
 	ssize_t l;
 	size_t seq;
 	char buf[64];
+	socklen_t slen;
 
-	s = getsocket(host, port, conn ? connect : connector, bug);
+	s = getsocket(host, port, conn ? connect : connector, slen, bug);
 	for (seq = 0; seq  n; seq++) {
 		time_t t = time(t);
 		snprintf(buf, sizeof(buf), %zu: %-24.24s, seq, ctime(t));
 		if (debug)
 			printf(sending: %s\n, buf);
 		l = conn ? send(s, buf, sizeof(buf), 0) :
-		sendto(s, buf, sizeof(buf), 0, (void *)ss, ss.ss_len);
+		sendto(s, buf, sizeof(buf), 0, (void *)ss, slen);
 		if (l == -1)
 			ERRX(EXIT_FAILURE, send (%s), strerror(errno));
 		usleep(100);
@@ -214,13 +233,12 @@ receiver(const char *host, const char *p
 	struct pollfd pfd;
 	socklen_t slen;
 
-	s = getsocket(host, port, conn ? bind : connector, bug);
+	s = getsocket(host, port, conn ? bind : connector, slen, bug);
 	pfd.fd = s;
 	pfd.events = POLLIN;
 	for (seq = 0; seq  n; seq++) {
 		if (poll(pfd, 1, 1000) == -1)
 			ERRX(EXIT_FAILURE, poll (%s), strerror(errno));
-		slen = ss.ss_len;
 		l = conn ? recv(s, buf, sizeof(buf), 0) :
 		recvfrom(s, buf, sizeof(buf), 0, (void *)ss, slen);
 		if (l == -1)
@@ -233,7 +251,10 @@ receiver(const char *host, const char *p
 static void
 run(const char *host, const char *port, size_t n, bool conn, bool bug)
 {
-	switch (fork()) {
+	pid_t pid;
+	int status;
+
+	switch ((pid = fork())) {
 	case 0:
 		receiver(host, port, n, conn, bug);
 		return;
@@ -242,6 +263,22 @@ run(const char *host, const char *port, 
 	default:
 		usleep(100);
 		sender(host, port, n, conn, bug);
+		usleep(100);
+	again:
+		switch (waitpid(pid, status, WNOHANG)) {
+		case -1:
+			ERRX(EXIT_FAILURE, wait (%s), strerror(errno));
+		case 0:
+			if (kill(pid, SIGTERM) == -1)
+ERRX(EXIT_FAILURE, kill (%s),
+strerror(errno));
+			goto again;
+		default:
+			if (status != 0)
+ERRX(EXIT_FAILURE, pid exited with %d,
+status);
+			break;
+		}
 		return;
 	}
 }
@@ -260,7 +297,7 @@ main(int argc, char *argv[])

CVS commit: src/usr.sbin/rtsold

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 19:53:34 UTC 2014

Modified Files:
src/usr.sbin/rtsold: rtsold.8

Log Message:
Give an example how to use dhcpcd instead of rtsol


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/rtsold/rtsold.8

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/rtsold/rtsold.8
diff -u src/usr.sbin/rtsold/rtsold.8:1.35 src/usr.sbin/rtsold/rtsold.8:1.36
--- src/usr.sbin/rtsold/rtsold.8:1.35	Thu Sep 11 17:04:34 2014
+++ src/usr.sbin/rtsold/rtsold.8	Sun Oct 12 15:53:34 2014
@@ -1,4 +1,4 @@
-.\	$NetBSD: rtsold.8,v 1.35 2014/09/11 21:04:34 wiz Exp $
+.\	$NetBSD: rtsold.8,v 1.36 2014/10/12 19:53:34 christos Exp $
 .\	$KAME: rtsold.8,v 1.17 2001/07/09 22:30:37 itojun Exp $
 .\
 .\ Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -28,7 +28,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\ SUCH DAMAGE.
 .\
-.Dd September 9, 2014
+.Dd October 12, 2014
 .Dt RTSOLD 8
 .Os
 .\
@@ -44,3 +44,9 @@ have been removed from
 .Nx
 as their functionality is now included in
 .Xr dhcpcd 8 .
+.Pp
+For example to send a routing solicitation message and print information
+about it without changing the actual routing table:
+.Bd -literal
+	dhcpcd -dB6T --nodhcp6 interface
+.Ed



CVS commit: src/sys/netinet6

2014-10-12 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Oct 12 20:05:50 UTC 2014

Modified Files:
src/sys/netinet6: nd6_nbr.c

Log Message:
Remove redundant logging.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/netinet6/nd6_nbr.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/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.101 src/sys/netinet6/nd6_nbr.c:1.102
--- src/sys/netinet6/nd6_nbr.c:1.101	Tue Sep  9 20:16:12 2014
+++ src/sys/netinet6/nd6_nbr.c	Sun Oct 12 20:05:50 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_nbr.c,v 1.101 2014/09/09 20:16:12 rmind Exp $	*/
+/*	$NetBSD: nd6_nbr.c,v 1.102 2014/10/12 20:05:50 roy Exp $	*/
 /*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nd6_nbr.c,v 1.101 2014/09/09 20:16:12 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: nd6_nbr.c,v 1.102 2014/10/12 20:05:50 roy Exp $);
 
 #include opt_inet.h
 #include opt_ipsec.h
@@ -1072,23 +1072,10 @@ nd6_newaddrmsg(struct ifaddr *ifa)
 	int e;
 
 	sockaddr_in6_init(all1_sa, in6mask128, 0, 0, 0);
-
 	e = rtrequest(RTM_GET, ifa-ifa_addr, ifa-ifa_addr,
-	(struct sockaddr *)all1_sa, RTF_UP|RTF_HOST|RTF_LLINFO, nrt);
-	if (e != 0) {
-		log(LOG_ERR, nd6_newaddrmsg: 
-		RTM_GET operation failed for %s (errno=%d)\n,
-		ip6_sprintf(((struct in6_ifaddr *)ifa)-ia_addr.sin6_addr),
-		e);
-	}
-
+	(struct sockaddr *)all1_sa, RTF_UP | RTF_HOST | RTF_LLINFO, nrt);
 	if (nrt) {
 		rt_newaddrmsg(RTM_ADD, ifa, e, nrt);
-#if 0
-		log(LOG_DEBUG, nd6_newaddrmsg: announced %s\n,
-		ip6_sprintf(((struct in6_ifaddr *)ifa)-ia_addr.sin6_addr)
-		);
-#endif
 		nrt-rt_refcnt--;
 	}
 }



CVS commit: src/lib/libc/gen

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 22:32:33 UTC 2014

Modified Files:
src/lib/libc/gen: fnmatch.c

Log Message:
Fix fnmatch issues according to POSIX.
http://pubs.opengroup.org/onlinepubs/009695399/utilities/\
xcu_chap02.html#tag_02_13_01
1. A [...] pattern containing a slash is not a pattern; the [ ]'s become regular
   characters
2. A [] or a [!] is not an empty pattern, why would it? The first would never
   match and the second would always match which makes it equivalent to ?
   In those cases the ] is taken as a literal character and does not have
   special meaning.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/lib/libc/gen/fnmatch.c

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/gen/fnmatch.c
diff -u src/lib/libc/gen/fnmatch.c:1.25 src/lib/libc/gen/fnmatch.c:1.26
--- src/lib/libc/gen/fnmatch.c:1.25	Sun Mar 25 12:31:23 2012
+++ src/lib/libc/gen/fnmatch.c	Sun Oct 12 18:32:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fnmatch.c,v 1.25 2012/03/25 16:31:23 christos Exp $	*/
+/*	$NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)fnmatch.c	8.2 (Berkeley) 4/16/94;
 #else
-__RCSID($NetBSD: fnmatch.c,v 1.25 2012/03/25 16:31:23 christos Exp $);
+__RCSID($NetBSD: fnmatch.c,v 1.26 2014/10/12 22:32:33 christos Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -73,7 +73,7 @@ foldcase(int ch, int flags)
 static const char *
 rangematch(const char *pattern, int test, int flags)
 {
-	int negate, ok;
+	int negate, ok, need;
 	char c, c2;
 
 	_DIAGASSERT(pattern != NULL);
@@ -88,7 +88,11 @@ rangematch(const char *pattern, int test
 	if ((negate = (*pattern == '!' || *pattern == '^')) != 0)
 		++pattern;
 	
-	for (ok = 0; (c = FOLDCASE(*pattern++, flags)) != ']';) {
+	need = 1;
+	for (ok = 0; (c = FOLDCASE(*pattern++, flags)) != ']' || need;) {
+		need = 0;
+		if (c == '/')
+			return (void *)-1;
 		if (c == '\\'  !(flags  FNM_NOESCAPE))
 			c = FOLDCASE(*pattern++, flags);
 		if (c == EOS)
@@ -113,7 +117,7 @@ rangematch(const char *pattern, int test
 static int
 fnmatchx(const char *pattern, const char *string, int flags, size_t recursion)
 {
-	const char *stringstart;
+	const char *stringstart, *r;
 	char c, test;
 
 	_DIAGASSERT(pattern != NULL);
@@ -184,9 +188,14 @@ fnmatchx(const char *pattern, const char
 return FNM_NOMATCH;
 			if (*string == '/'  flags  FNM_PATHNAME)
 return FNM_NOMATCH;
-			if ((pattern = rangematch(pattern,
+			if ((r = rangematch(pattern,
 			FOLDCASE(*string, flags), flags)) == NULL)
 return FNM_NOMATCH;
+			if (r == (void *)-1) {
+if (*string != '[')
+	return FNM_NOMATCH;
+			} else
+pattern = r;
 			++string;
 			break;
 		case '\\':



CVS commit: src/tests/lib/libc/gen

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Oct 12 22:33:41 UTC 2014

Modified Files:
src/tests/lib/libc/gen: t_fnmatch.c

Log Message:
You need double the number of backslashes in a pattern, since \\ - '\' in
the string which means escape. Now the tests don't fail.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libc/gen/t_fnmatch.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_fnmatch.c
diff -u src/tests/lib/libc/gen/t_fnmatch.c:1.5 src/tests/lib/libc/gen/t_fnmatch.c:1.6
--- src/tests/lib/libc/gen/t_fnmatch.c:1.5	Sun Oct 12 15:08:08 2014
+++ src/tests/lib/libc/gen/t_fnmatch.c	Sun Oct 12 18:33:41 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: t_fnmatch.c,v 1.5 2014/10/12 19:08:08 justin Exp $ */
+/* $NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__RCSID($NetBSD: t_fnmatch.c,v 1.5 2014/10/12 19:08:08 justin Exp $);
+__RCSID($NetBSD: t_fnmatch.c,v 1.6 2014/10/12 22:33:41 christos Exp $);
 
 #include atf-c.h
 #include fnmatch.h
@@ -161,8 +161,8 @@ ATF_TC_HEAD(fnmatch_initialbracket, tc)
 
 ATF_TC_BODY(fnmatch_initialbracket, tc)
 {
-	ATF_CHECK(fnmatch([[?*\\], \\, 0) == 0);
-	ATF_CHECK(fnmatch([]?*\\], ], 0) == 0);
+	ATF_CHECK(fnmatch([[?*], \\, 0) == 0);
+	ATF_CHECK(fnmatch([]?*], ], 0) == 0);
 	ATF_CHECK(fnmatch([!]a-], b, 0) == 0);
 	ATF_CHECK(fnmatch([]-_], ^, 0) == 0); /* range: ']', '^', '_' */
 	ATF_CHECK(fnmatch([!]-_], X, 0) == 0);
@@ -175,8 +175,6 @@ ATF_TC_BODY(fnmatch_initialbracket, tc)
 
 	ATF_CHECK(fnmatch([*]/b, a/b, 0) != 0);
 	ATF_CHECK(fnmatch([?]/b, a/b, 0) != 0);
-
-	atf_tc_expect_fail(PR lib/49278);
 }
 
 ATF_TP_ADD_TCS(tp)



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 23:57:59 UTC 2014

Modified Files:
src/sys/arch/arm/allwinner: awin_intr.h awin_io.c awin_reg.h files.awin
Added Files:
src/sys/arch/arm/allwinner: awin_p2wi.c

Log Message:
add A31 P2WI (Push-Pull Two Wire Interface) driver


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/allwinner/awin_intr.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/allwinner/awin_io.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/allwinner/awin_p2wi.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/allwinner/awin_reg.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/allwinner/files.awin

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/allwinner/awin_intr.h
diff -u src/sys/arch/arm/allwinner/awin_intr.h:1.6 src/sys/arch/arm/allwinner/awin_intr.h:1.7
--- src/sys/arch/arm/allwinner/awin_intr.h:1.6	Sun Oct 12 14:06:18 2014
+++ src/sys/arch/arm/allwinner/awin_intr.h	Sun Oct 12 23:57:58 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_intr.h,v 1.6 2014/10/12 14:06:18 jmcneill Exp $ */
+/* $NetBSD: awin_intr.h,v 1.7 2014/10/12 23:57:58 jmcneill Exp $ */
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -148,6 +148,7 @@
 #define AWIN_A31_IRQ_TWI2	40
 #define AWIN_A31_IRQ_TWI3	41
 #define AWIN_A31_IRQ_AC		61
+#define AWIN_A31_IRQ_P2WI	71
 #define AWIN_A31_IRQ_DMA	82
 #define AWIN_A31_IRQ_SDMMC0	92
 #define AWIN_A31_IRQ_SDMMC1	93

Index: src/sys/arch/arm/allwinner/awin_io.c
diff -u src/sys/arch/arm/allwinner/awin_io.c:1.19 src/sys/arch/arm/allwinner/awin_io.c:1.20
--- src/sys/arch/arm/allwinner/awin_io.c:1.19	Sun Oct 12 17:20:46 2014
+++ src/sys/arch/arm/allwinner/awin_io.c	Sun Oct 12 23:57:58 2014
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.19 2014/10/12 17:20:46 jmcneill Exp $);
+__KERNEL_RCSID(1, $NetBSD: awin_io.c,v 1.20 2014/10/12 23:57:58 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -132,6 +132,7 @@ static const struct awin_locators awin_l
 	{ awiniic, OFFANDSIZE(TWI1), 1, AWIN_A31_IRQ_TWI1, A31 },
 	{ awiniic, OFFANDSIZE(TWI2), 2, AWIN_A31_IRQ_TWI2, A31 },
 	{ awiniic, OFFANDSIZE(TWI3), 3, AWIN_A31_IRQ_TWI3, A31 },
+	{ awinp2wi, OFFANDSIZE(A31_P2WI), NOPORT, AWIN_A31_IRQ_P2WI, A31 },
 	{ spi, OFFANDSIZE(SPI0), 0, AWIN_IRQ_SPI0, AANY },
 	{ spi, OFFANDSIZE(SPI1), 1, AWIN_IRQ_SPI1, AANY },
 	{ spi, OFFANDSIZE(SPI2), 1, AWIN_IRQ_SPI2, AANY },

Index: src/sys/arch/arm/allwinner/awin_reg.h
diff -u src/sys/arch/arm/allwinner/awin_reg.h:1.32 src/sys/arch/arm/allwinner/awin_reg.h:1.33
--- src/sys/arch/arm/allwinner/awin_reg.h:1.32	Sun Oct 12 17:19:12 2014
+++ src/sys/arch/arm/allwinner/awin_reg.h	Sun Oct 12 23:57:58 2014
@@ -1703,6 +1703,7 @@ struct awin_mmc_idma_descriptor {
 #define AWIN_A31_PRCM_OFFSET		0x00301400	/* PRCM */
 #define AWIN_A31_CPUCFG_OFFSET		0x00301C00
 #define AWIN_A31_RTC_OFFSET		0x0030	/* RTC */
+#define AWIN_A31_P2WI_OFFSET		0x00303400	/* P2WI */
 
 #define AWIN_A31_PRCM_PWROFF_GATING_REG		0x100
 #define AWIN_A31_PRCM_CPUX_PWR_CLAMP_REG	0x0140
@@ -1799,6 +1800,54 @@ struct awin_mmc_idma_descriptor {
 
 #define AWIN_A31_RTC_YY_MM_DD_YEAR		__BITS(21,16)
 
+#define AWIN_A31_P2WI_CTRL_REG			0x
+#define AWIN_A31_P2WI_CCR_REG			0x0004
+#define AWIN_A31_P2WI_INTE_REG			0x0008
+#define AWIN_A31_P2WI_STAT_REG			0x000c
+#define AWIN_A31_P2WI_DADDR0_REG		0x0010
+#define AWIN_A31_P2WI_DADDR1_REG		0x0014
+#define AWIN_A31_P2WI_DLEN_REG			0x0018
+#define AWIN_A31_P2WI_DATA0_REG			0x001c
+#define AWIN_A31_P2WI_DATA1_REG			0x0020
+#define AWIN_A31_P2WI_LCR_REG			0x0024
+#define AWIN_A31_P2WI_PMCR_REG			0x0028
+
+#define AWIN_A31_P2WI_CTRL_START_TRANS		__BIT(7)
+#define AWIN_A31_P2WI_CTRL_ABORT_TRANS		__BIT(6)
+#define AWIN_A31_P2WI_CTRL_GLOBAL_INT_ENB	__BIT(1)
+#define AWIN_A31_P2WI_CTRL_SOFT_RESET		__BIT(0)
+
+#define AWIN_A31_P2WI_CCR_SDA_ODLY		__BITS(10,8)
+#define AWIN_A31_P2WI_CCR_CLK_DIV		__BITS(7,0)
+
+#define AWIN_A31_P2WI_INTE_LOAD_BSY_ENB		__BIT(2)
+#define AWIN_A31_P2WI_INTE_TRANS_ERR_ENB	__BIT(1)
+#define AWIN_A31_P2WI_INTE_TRANS_OVER_ENB	__BIT(0)
+
+#define AWIN_A31_P2WI_STAT_TRANS_ERR_ID		__BITS(15,8)
+#define AWIN_A31_P2WI_STAT_LOAD_BSY		__BIT(2)
+#define AWIN_A31_P2WI_STAT_TRANS_ERR		__BIT(1)
+#define AWIN_A31_P2WI_STAT_TRANS_OVER		__BIT(0)
+#define AWIN_A31_P2WI_STAT_MASK		\
+	(AWIN_A31_P2WI_STAT_LOAD_BSY |	\
+	 AWIN_A31_P2WI_STAT_TRANS_ERR |	\
+	 AWIN_A31_P2WI_STAT_TRANS_OVER)
+
+#define AWIN_A31_P2WI_DLEN_READ_WRITE_FLAG	__BIT(4)
+#define AWIN_A31_P2WI_DLEN_ACCESS_LENGTH	__BITS(2,0)
+
+#define AWIN_A31_P2WI_LCR_SCL_STATE		__BIT(5)
+#define AWIN_A31_P2WI_LCR_SDA_STATE		__BIT(4)
+#define AWIN_A31_P2WI_LCR_SCL_CTL		__BIT(3)
+#define AWIN_A31_P2WI_LCR_SCL_CTL_EN		__BIT(2)
+#define AWIN_A31_P2WI_LCR_SDA_CTL		__BIT(1)
+#define AWIN_A31_P2WI_LCR_SDA_CTL_EN		__BIT(0)
+
+#define AWIN_A31_P2WI_PMCR_PMU_INIT_SEND	__BIT(31)
+#define 

CVS commit: src/sys/dev/i2c

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 23:58:42 UTC 2014

Modified Files:
src/sys/dev/i2c: files.i2c
Added Files:
src/sys/dev/i2c: axp22x.c

Log Message:
add AXP22x Power Management Unit driver


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/i2c/axp22x.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/i2c/files.i2c

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.56 src/sys/dev/i2c/files.i2c:1.57
--- src/sys/dev/i2c/files.i2c:1.56	Tue Sep  9 22:47:33 2014
+++ src/sys/dev/i2c/files.i2c	Sun Oct 12 23:58:42 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i2c,v 1.56 2014/09/09 22:47:33 jmcneill Exp $
+#	$NetBSD: files.i2c,v 1.57 2014/10/12 23:58:42 jmcneill Exp $
 
 obsolete defflag	opt_i2cbus.h		I2C_SCAN
 define	i2cbus { }
@@ -219,3 +219,8 @@ filedev/i2c/mpl115a.c		mpl115a
 device	axp20x: sysmon_envsys
 attach	axp20x at iic
 file	dev/i2c/axp20x.c			axp20x
+
+# AXP22x Power Management Unit
+device	axp22x: sysmon_envsys
+attach	axp22x at iic
+file	dev/i2c/axp22x.c			axp22x

Added files:

Index: src/sys/dev/i2c/axp22x.c
diff -u /dev/null src/sys/dev/i2c/axp22x.c:1.1
--- /dev/null	Sun Oct 12 23:58:42 2014
+++ src/sys/dev/i2c/axp22x.c	Sun Oct 12 23:58:42 2014
@@ -0,0 +1,132 @@
+/* $NetBSD: axp22x.c,v 1.1 2014/10/12 23:58:42 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2014 Jared D. McNeill jmcne...@invisible.ca
+ * 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 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: axp22x.c,v 1.1 2014/10/12 23:58:42 jmcneill Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/device.h
+#include sys/conf.h
+#include sys/bus.h
+#include sys/kmem.h
+
+#include dev/i2c/i2cvar.h
+
+#include dev/sysmon/sysmonvar.h
+
+#define AXP_TEMP_MON_REG	0x56	/* 2 bytes */
+
+struct axp22x_softc {
+	device_t	sc_dev;
+	i2c_tag_t	sc_i2c;
+	i2c_addr_t	sc_addr;
+
+	struct sysmon_envsys *sc_sme;
+	envsys_data_t	sc_sensor_temp;
+};
+
+static int	axp22x_match(device_t, cfdata_t, void *);
+static void	axp22x_attach(device_t, device_t, void *);
+
+static void	axp22x_sensors_refresh(struct sysmon_envsys *, envsys_data_t *);
+static int	axp22x_read(struct axp22x_softc *, uint8_t, uint8_t *, size_t);
+
+CFATTACH_DECL_NEW(axp22x, sizeof(struct axp22x_softc),
+axp22x_match, axp22x_attach, NULL, NULL);
+
+static int
+axp22x_match(device_t parent, cfdata_t match, void *aux)
+{
+	return 1;
+}
+
+static void
+axp22x_attach(device_t parent, device_t self, void *aux)
+{
+	struct axp22x_softc *sc = device_private(self);
+	struct i2c_attach_args *ia = aux;
+
+	sc-sc_dev = self;
+	sc-sc_i2c = ia-ia_tag;
+	sc-sc_addr = ia-ia_addr;
+
+	aprint_naive(\n);
+	aprint_normal(\n);
+
+	sc-sc_sme = sysmon_envsys_create();
+	sc-sc_sme-sme_name = device_xname(self);
+	sc-sc_sme-sme_cookie = sc;
+	sc-sc_sme-sme_refresh = axp22x_sensors_refresh;
+
+	sc-sc_sensor_temp.units = ENVSYS_STEMP;
+	sc-sc_sensor_temp.state = ENVSYS_SINVALID;
+	sc-sc_sensor_temp.flags = ENVSYS_FHAS_ENTROPY;
+	snprintf(sc-sc_sensor_temp.desc, sizeof(sc-sc_sensor_temp.desc),
+	internal temperature);
+	sysmon_envsys_sensor_attach(sc-sc_sme, sc-sc_sensor_temp);
+
+	sysmon_envsys_register(sc-sc_sme);
+}
+
+static void
+axp22x_sensors_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
+{
+	struct axp22x_softc *sc = sme-sme_cookie;
+	uint8_t buf[2];
+	int error;
+
+	iic_acquire_bus(sc-sc_i2c, 0);
+	error = axp22x_read(sc, AXP_TEMP_MON_REG, buf, sizeof(buf));
+	iic_release_bus(sc-sc_i2c, 0);
+
+	if (error) {
+		edata-state = ENVSYS_SINVALID;
+	} else {
+		/* 

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

2014-10-12 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Mon Oct 13 00:25:12 UTC 2014

Modified Files:
src/distrib/sets/lists/debug: mi

Log Message:
Add debug file  for t_mcast.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/distrib/sets/lists/debug/mi

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.86 src/distrib/sets/lists/debug/mi:1.87
--- src/distrib/sets/lists/debug/mi:1.86	Fri Sep 12 14:46:33 2014
+++ src/distrib/sets/lists/debug/mi	Mon Oct 13 00:25:12 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.86 2014/09/12 14:46:33 roy Exp $
+# $NetBSD: mi,v 1.87 2014/10/13 00:25:12 htodd Exp $
 
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib
@@ -2153,6 +2153,7 @@
 ./usr/libdata/debug/usr/tests/net/icmp/t_ping.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/if/t_compat.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/if_loop/t_pr.debug		tests-net-debug		debug,atf,rump
+./usr/libdata/debug/usr/tests/net/mcast/t_mcast.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/net/t_pktinfo.debug		tests-net-debug		debug,atf
 ./usr/libdata/debug/usr/tests/net/net/t_raw.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/net/t_tcp.debug		tests-net-debug		debug,atf



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

2014-10-12 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Oct 12 23:59:30 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: HUMMINGBIRD_A31

Log Message:
add P2WI; lock down TWI0 as iic0 and P2WI as iic1; add AXP221 driver


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31

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/HUMMINGBIRD_A31
diff -u src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.6 src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.7
--- src/sys/arch/evbarm/conf/HUMMINGBIRD_A31:1.6	Sun Oct 12 15:38:45 2014
+++ src/sys/arch/evbarm/conf/HUMMINGBIRD_A31	Sun Oct 12 23:59:30 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: HUMMINGBIRD_A31,v 1.6 2014/10/12 15:38:45 jmcneill Exp $
+#	$NetBSD: HUMMINGBIRD_A31,v 1.7 2014/10/12 23:59:30 jmcneill Exp $
 #
 #	HUMMINGBIRD_A31 - Merrii Hummingbird A31
 #
@@ -204,7 +204,12 @@ gpio*		at awingpio?
 # I2C Controller
 awiniic0	at awinio? port 0
 #awiniic*	at awinio? port ?
-iic*		at awiniic?
+iic0		at awiniic0
+
+# P2WI
+awinp2wi0	at awinio0
+iic1		at awinp2wi0
+axp22x0		at iic1 addr 0x34	# AXP221 Power Management Unit	
 
 # On-board 16550 UARTs
 com0		at awinio? port 0			# UART0 (console)



CVS commit: src/lib/libc/stdio

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 00:40:36 UTC 2014

Modified Files:
src/lib/libc/stdio: Makefile.inc
Added Files:
src/lib/libc/stdio: open_memstream.3 open_memstream.c open_wmemstream.c

Log Message:
PR/49279: Justin Cormack: add open_memstream


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/lib/libc/stdio/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/stdio/open_memstream.3 \
src/lib/libc/stdio/open_memstream.c src/lib/libc/stdio/open_wmemstream.c

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/stdio/Makefile.inc
diff -u src/lib/libc/stdio/Makefile.inc:1.45 src/lib/libc/stdio/Makefile.inc:1.46
--- src/lib/libc/stdio/Makefile.inc:1.45	Wed Jun 18 13:50:55 2014
+++ src/lib/libc/stdio/Makefile.inc	Sun Oct 12 20:40:36 2014
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile.inc	5.7 (Berkeley) 6/27/91
-#	$NetBSD: Makefile.inc,v 1.45 2014/06/18 17:50:55 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.46 2014/10/13 00:40:36 christos Exp $
 
 # stdio sources
 .PATH: ${.CURDIR}/stdio
@@ -21,7 +21,7 @@ SRCS+=	clrerr.c dprintf.c fclose.c fdope
 	vasprintf.c vdprintf.c vfprintf.c vfscanf.c vfwprintf.c vfwscanf.c \
 	vprintf.c vscanf.c vsnprintf.c vsnprintf_ss.c vsscanf.c vswprintf.c \
 	vswscanf.c vwprintf.c vwscanf.c wbuf.c wprintf.c wscanf.c wsetup.c
-SRCS+=	fmemopen.c
+SRCS+=	fmemopen.c open_memstream.c open_wmemstream.c
 
 .if !defined(AUDIT)
 SRCS+=	gets.c vsprintf.c tempnam.c tmpnam.c mktemp.c
@@ -31,7 +31,7 @@ MAN+=	fclose.3 ferror.3 fflush.3 fgetln.
 	flockfile.3 fmemopen.3 fopen.3 fparseln.3 fputs.3 fputws.3 fread.3 \
 	fseek.3 funopen.3 fwide.3 getc.3 getdelim.3 getwc.3 mktemp.3 printf.3 \
 	putc.3 putwc.3 remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 \
-	ungetc.3 ungetwc.3 wprintf.3 wscanf.3
+	ungetc.3 ungetwc.3 wprintf.3 wscanf.3 open_memstream.3
 
 MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
 MLINKS+=fflush.3 fpurge.3
@@ -66,3 +66,4 @@ MLINKS+=wprintf.3 fwprintf.3 wprintf.3 s
 MLINKS+=wprintf.3 vwprintf.3 wprintf.3 vfwprintf.3 wprintf.3 vswprintf.3
 MLINKS+=wscanf.3 fwscanf.3 wscanf.3 swscanf.3 wscanf.3 vwscanf.3
 MLINKS+=wscanf.3 vswscanf.3 wscanf.3 vfwscanf.3
+MLINKS+=open_memstream.3 open_wmemstream.3

Added files:

Index: src/lib/libc/stdio/open_memstream.3
diff -u /dev/null src/lib/libc/stdio/open_memstream.3:1.1
--- /dev/null	Sun Oct 12 20:40:36 2014
+++ src/lib/libc/stdio/open_memstream.3	Sun Oct 12 20:40:36 2014
@@ -0,0 +1,156 @@
+.\	$NetBSD: open_memstream.3,v 1.1 2014/10/13 00:40:36 christos Exp $
+.\ Copyright (c) 2013 Advanced Computing Technologies LLC
+.\ Written by: John H. Baldwin j...@freebsd.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 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 AUTHOR 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.
+.\
+.\ $FreeBSD: head/lib/libc/stdio/open_memstream.3 247415 2013-02-27 20:09:25Z joel $
+.\
+.Dd October 12, 2014
+.Dt OPEN_MEMSTREAM 3
+.Os
+.Sh NAME
+.Nm open_memstream ,
+.Nm open_wmemstream
+.Nd dynamic memory buffer stream open functions
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In stdio.h
+.Ft FILE *
+.Fn open_memstream char **bufp size_t **sizep
+.In wchar.h
+.Ft FILE *
+.Fn open_wmemstream wchar_t **bufp size_t **sizep
+.Sh DESCRIPTION
+The
+.Fn open_memstream
+and
+.Fn open_wmemstream
+functions create a write-only, seekable stream backed by a dynamically
+allocated memory buffer.
+The
+.Fn open_memstream
+function creates a byte-oriented stream,
+while the
+.Fn open_wmemstream
+function creates a wide-oriented stream.
+.Pp
+Each stream maintains a current position and size.
+Initially,
+the position and size are set to zero.
+Each write begins at the current position and advances it the number of

CVS commit: src/lib/libc

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 00:40:57 UTC 2014

Modified Files:
src/lib/libc: shlib_version

Log Message:
bump for open_{,w}memstream.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/lib/libc/shlib_version

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/shlib_version
diff -u src/lib/libc/shlib_version:1.256 src/lib/libc/shlib_version:1.257
--- src/lib/libc/shlib_version:1.256	Fri Sep 26 15:28:03 2014
+++ src/lib/libc/shlib_version	Sun Oct 12 20:40:57 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.256 2014/09/26 19:28:03 christos Exp $
+#	$NetBSD: shlib_version,v 1.257 2014/10/13 00:40:57 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -42,4 +42,4 @@
 # - move gethostbyname to a compat library
 # - remove arc4random(3) API
 major=12
-minor=195
+minor=196



CVS commit: src/distrib/sets/lists

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 00:46:28 UTC 2014

Modified Files:
src/distrib/sets/lists/base: ad.aarch64 ad.arm ad.mips ad.powerpc
ad.riscv md.amd64 md.sparc64 shl.mi
src/distrib/sets/lists/comp: mi
src/distrib/sets/lists/debug: ad.aarch64 ad.arm ad.mips ad.powerpc
ad.riscv md.amd64 md.sparc64 shl.mi

Log Message:
bump libc and add man pages for open_{,w}memstream


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/sets/lists/base/ad.aarch64
cvs rdiff -u -r1.58 -r1.59 src/distrib/sets/lists/base/ad.arm
cvs rdiff -u -r1.53 -r1.54 src/distrib/sets/lists/base/ad.mips
cvs rdiff -u -r1.22 -r1.23 src/distrib/sets/lists/base/ad.powerpc
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/base/ad.riscv
cvs rdiff -u -r1.249 -r1.250 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.237 -r1.238 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.718 -r1.719 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.1916 -r1.1917 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.8 -r1.9 src/distrib/sets/lists/debug/ad.aarch64
cvs rdiff -u -r1.47 -r1.48 src/distrib/sets/lists/debug/ad.arm
cvs rdiff -u -r1.43 -r1.44 src/distrib/sets/lists/debug/ad.mips
cvs rdiff -u -r1.23 -r1.24 src/distrib/sets/lists/debug/ad.powerpc
cvs rdiff -u -r1.5 -r1.6 src/distrib/sets/lists/debug/ad.riscv
cvs rdiff -u -r1.67 -r1.68 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.66 -r1.67 src/distrib/sets/lists/debug/md.sparc64
cvs rdiff -u -r1.77 -r1.78 src/distrib/sets/lists/debug/shl.mi

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/base/ad.aarch64
diff -u src/distrib/sets/lists/base/ad.aarch64:1.9 src/distrib/sets/lists/base/ad.aarch64:1.10
--- src/distrib/sets/lists/base/ad.aarch64:1.9	Fri Oct 10 06:10:40 2014
+++ src/distrib/sets/lists/base/ad.aarch64	Sun Oct 12 20:46:28 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.9 2014/10/10 10:10:40 mrg Exp $
+# $NetBSD: ad.aarch64,v 1.10 2014/10/13 00:46:28 christos Exp $
 ./lib/eabi	base-compat-shlib	compat
 ./lib/eabi/npf	base-npf-shlib		compat
 ./lib/eabi/npf/ext_log.so			base-npf-shlib		compat,pic
@@ -108,7 +108,7 @@
 ./usr/lib/eabi/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/eabi/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/eabi/libc.so.12base-compat-shlib	compat,pic
-./usr/lib/eabi/libc.so.12.195			base-compat-shlib	compat,pic
+./usr/lib/eabi/libc.so.12.196			base-compat-shlib	compat,pic
 ./usr/lib/eabi/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/eabi/libcom_err.so.7.0			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/eabi/libcrypt.so.1			base-compat-shlib	compat,pic
@@ -422,7 +422,7 @@
 ./usr/lib/eabihf/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/eabihf/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/eabihf/libc.so.12base-compat-shlib	compat,pic
-./usr/lib/eabihf/libc.so.12.195			base-compat-shlib	compat,pic
+./usr/lib/eabihf/libc.so.12.196			base-compat-shlib	compat,pic
 ./usr/lib/eabihf/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/eabihf/libcom_err.so.7.0			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/eabihf/libcrypt.so.1			base-compat-shlib	compat,pic
@@ -736,7 +736,7 @@
 ./usr/lib/oabi/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/oabi/libc.so.12.195			base-compat-shlib	compat,pic
+./usr/lib/oabi/libc.so.12.196			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos
 ./usr/lib/oabi/libcom_err.so.7.0		base-compat-shlib	compat,pic,kerberos
 ./usr/lib/oabi/libcrypt.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/ad.arm
diff -u src/distrib/sets/lists/base/ad.arm:1.58 src/distrib/sets/lists/base/ad.arm:1.59
--- src/distrib/sets/lists/base/ad.arm:1.58	Fri Oct 10 06:10:40 2014
+++ src/distrib/sets/lists/base/ad.arm	Sun Oct 12 20:46:28 2014
@@ -1,4 +1,4 @@
-# $NetBSD: ad.arm,v 1.58 2014/10/10 10:10:40 mrg Exp $
+# $NetBSD: ad.arm,v 1.59 2014/10/13 00:46:28 christos Exp $
 ./lib/oabi	base-compat-shlib	compat
 ./lib/oabi/npf	base-npf-shlib		compat
 ./lib/oabi/npf/ext_log.so			base-npf-shlib		compat,pic
@@ -92,7 +92,7 @@
 ./usr/lib/oabi/libc++.so.1			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc++.so.1.0			base-compat-shlib	compat,pic,libcxx
 ./usr/lib/oabi/libc.so.12			base-compat-shlib	compat,pic
-./usr/lib/oabi/libc.so.12.195			base-compat-shlib	compat,pic
+./usr/lib/oabi/libc.so.12.196			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libc_vfp.so.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libc_vfp.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/oabi/libcom_err.so.7			base-compat-shlib	compat,pic,kerberos


CVS commit: src/include

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 00:47:03 UTC 2014

Modified Files:
src/include: stdio.h wchar.h

Log Message:
add open_{,w}memstream


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/include/stdio.h
cvs rdiff -u -r1.40 -r1.41 src/include/wchar.h

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

Modified files:

Index: src/include/stdio.h
diff -u src/include/stdio.h:1.91 src/include/stdio.h:1.92
--- src/include/stdio.h:1.91	Thu Aug  7 13:24:03 2014
+++ src/include/stdio.h	Sun Oct 12 20:47:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdio.h,v 1.91 2014/08/07 17:24:03 christos Exp $	*/
+/*	$NetBSD: stdio.h,v 1.92 2014/10/13 00:47:03 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -526,6 +526,7 @@ __END_DECLS
 defined(_NETBSD_SOURCE)
 __BEGIN_DECLS
 FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
+FILE *open_memstream(char **, size_t *);
 ssize_t	 getdelim(char ** __restrict, size_t * __restrict, int,
 	FILE * __restrict);
 ssize_t	 getline(char ** __restrict, size_t * __restrict, FILE * __restrict);

Index: src/include/wchar.h
diff -u src/include/wchar.h:1.40 src/include/wchar.h:1.41
--- src/include/wchar.h:1.40	Thu Nov 21 04:09:52 2013
+++ src/include/wchar.h	Sun Oct 12 20:47:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: wchar.h,v 1.40 2013/11/21 09:09:52 degroote Exp $	*/
+/*	$NetBSD: wchar.h,v 1.41 2014/10/13 00:47:03 christos Exp $	*/
 
 /*-
  * Copyright (c)1999 Citrus Project,
@@ -158,6 +158,11 @@ unsigned long long int wcstoull(const wc
 	wchar_t ** __restrict, int);
 #endif
 
+#if (_POSIX_C_SOURCE - 0) = 200809L || (_XOPEN_SOURCE - 0) = 700 || \
+defined(_NETBSD_SOURCE)
+FILE	*open_wmemstream(wchar_t **, size_t *);
+#endif
+
 wint_t ungetwc(wint_t, FILE *);
 wint_t fgetwc(FILE *);
 wchar_t *fgetws(wchar_t * __restrict, int, FILE * __restrict);



CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 04:56:26 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
Oops need to bind, also make the message more interesting and check that
it arrives correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.5 src/tests/net/mcast/t_mcast.c:1.6
--- src/tests/net/mcast/t_mcast.c:1.5	Sun Oct 12 15:49:01 2014
+++ src/tests/net/mcast/t_mcast.c	Mon Oct 13 00:56:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.5 2014/10/12 19:49:01 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.6 2014/10/13 04:56:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include sys/cdefs.h
 #ifdef __RCSID
-__RCSID($NetBSD: t_mcast.c,v 1.5 2014/10/12 19:49:01 christos Exp $);
+__RCSID($NetBSD: t_mcast.c,v 1.6 2014/10/13 04:56:26 christos Exp $);
 #else
 extern const char *__progname;
 #define getprogname() __progname
@@ -69,7 +69,7 @@ extern const char *__progname;
 #define SKIPX(ev, msg, ...)	errx(ev, msg, __VA_ARGS__)
 #endif
 
-static int debug = 1;
+static int debug;
 
 #define TOTAL 10
 #define PORT_V4MAPPED 
@@ -79,6 +79,11 @@ static int debug = 1;
 #define PORT_V6 
 #define HOST_V6 FF05:0:0:0:0:0:0:1
 
+struct message {
+	size_t seq;
+	struct timespec ts;
+};
+
 static int
 addmc(int s, struct addrinfo *ai, bool bug)
 {
@@ -151,6 +156,13 @@ connector(int fd, const struct sockaddr 
 	return 0;
 }
 
+static void
+show(const char *prefix, const struct message *msg)
+{
+	printf(%10.10s: %zu [%jd.%jd]\n, prefix, msg-seq, (intmax_t)
+	msg-ts.tv_sec, msg-ts.tv_nsec);
+}
+
 static int
 getsocket(const char *host, const char *port,
 int (*f)(int, const struct sockaddr *, socklen_t), socklen_t *slen,
@@ -205,18 +217,18 @@ sender(const char *host, const char *por
 {
 	int s;
 	ssize_t l;
-	size_t seq;
-	char buf[64];
+	struct message msg;
+
 	socklen_t slen;
 
 	s = getsocket(host, port, conn ? connect : connector, slen, bug);
-	for (seq = 0; seq  n; seq++) {
-		time_t t = time(t);
-		snprintf(buf, sizeof(buf), %zu: %-24.24s, seq, ctime(t));
+	for (msg.seq = 0; msg.seq  n; msg.seq++) {
+		if (clock_gettime(CLOCK_MONOTONIC, msg.ts) == -1)
+			ERRX(EXIT_FAILURE, clock (%s), strerror(errno));
 		if (debug)
-			printf(sending: %s\n, buf);
-		l = conn ? send(s, buf, sizeof(buf), 0) :
-		sendto(s, buf, sizeof(buf), 0, (void *)ss, slen);
+			show(sending, msg);
+		l = conn ? send(s, msg, sizeof(msg), 0) :
+		sendto(s, msg, sizeof(msg), 0, (void *)ss, slen);
 		if (l == -1)
 			ERRX(EXIT_FAILURE, send (%s), strerror(errno));
 		usleep(100);
@@ -229,22 +241,24 @@ receiver(const char *host, const char *p
 	int s;
 	ssize_t l;
 	size_t seq;
-	char buf[64];
+	struct message msg;
 	struct pollfd pfd;
 	socklen_t slen;
 
-	s = getsocket(host, port, conn ? bind : connector, slen, bug);
+	s = getsocket(host, port, bind, slen, bug);
 	pfd.fd = s;
 	pfd.events = POLLIN;
 	for (seq = 0; seq  n; seq++) {
 		if (poll(pfd, 1, 1000) == -1)
 			ERRX(EXIT_FAILURE, poll (%s), strerror(errno));
-		l = conn ? recv(s, buf, sizeof(buf), 0) :
-		recvfrom(s, buf, sizeof(buf), 0, (void *)ss, slen);
+		l = conn ? recv(s, msg, sizeof(msg), 0) :
+		recvfrom(s, msg, sizeof(msg), 0, (void *)ss, slen);
 		if (l == -1)
 			ERRX(EXIT_FAILURE, recv (%s), strerror(errno));
 		if (debug)
-			printf(got: %s\n, buf);
+			show(got, msg);
+		if (seq != msg.seq)
+			ERRX(EXIT_FAILURE, seq %zu != %zu, seq, msg.seq);
 	}
 }
 
@@ -261,7 +275,7 @@ run(const char *host, const char *port, 
 	case -1:
 		ERRX(EXIT_FAILURE, fork (%s), strerror(errno));
 	default:
-		usleep(100);
+		usleep(1000);
 		sender(host, port, n, conn, bug);
 		usleep(100);
 	again:
@@ -424,20 +438,15 @@ ATF_TC_BODY(unconninet6, tc)
 
 ATF_TP_ADD_TCS(tp)
 {
+	debug++;
 ATF_TP_ADD_TC(tp, conninet4);
 ATF_TP_ADD_TC(tp, connmappedinet4);
 ATF_TP_ADD_TC(tp, connmappedbuginet4);
 ATF_TP_ADD_TC(tp, conninet6);
-#if 0
-	/*
-	 * The receiver does not get any packets on unconnected sockets,
-	 * but the ioctl's work. Is my code wrong?
-	 */
 ATF_TP_ADD_TC(tp, unconninet4);
 ATF_TP_ADD_TC(tp, unconnmappedinet4);
 ATF_TP_ADD_TC(tp, unconnmappedbuginet4);
 ATF_TP_ADD_TC(tp, unconninet6);
-#endif
 
 	return atf_no_error();
 }



CVS commit: src/tests/net/mcast

2014-10-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Oct 13 04:57:11 UTC 2014

Modified Files:
src/tests/net/mcast: t_mcast.c

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/mcast/t_mcast.c

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

Modified files:

Index: src/tests/net/mcast/t_mcast.c
diff -u src/tests/net/mcast/t_mcast.c:1.6 src/tests/net/mcast/t_mcast.c:1.7
--- src/tests/net/mcast/t_mcast.c:1.6	Mon Oct 13 00:56:26 2014
+++ src/tests/net/mcast/t_mcast.c	Mon Oct 13 00:57:11 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mcast.c,v 1.6 2014/10/13 04:56:26 christos Exp $	*/
+/*	$NetBSD: t_mcast.c,v 1.7 2014/10/13 04:57:11 christos Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 #include sys/cdefs.h
 #ifdef __RCSID
-__RCSID($NetBSD: t_mcast.c,v 1.6 2014/10/13 04:56:26 christos Exp $);
+__RCSID($NetBSD: t_mcast.c,v 1.7 2014/10/13 04:57:11 christos Exp $);
 #else
 extern const char *__progname;
 #define getprogname() __progname
@@ -106,7 +106,7 @@ addmc(int s, struct addrinfo *ai, bool b
 		 * Linux:	Does not support the v6 ioctls on v4 mapped
 		 *		sockets but it does support the v4 ones and
 		 *		it works.
-		 * MacOS/X:	Dupports the v6 ioctls on v4 mapped sockets,
+		 * MacOS/X:	Supports the v6 ioctls on v4 mapped sockets,
 		 *		but does not work and also does not support
 		 *		the v4 ioctls. So no way to make multicasting
 		 *		work with mapped addresses.