CVS commit: src/sys/kern

2014-02-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Feb 21 08:11:59 UTC 2014

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

Log Message:
Revert rev1.38. The header already begins with EXEC_SCRIPT_MAGIC=#!.
So it can't be ELFMAG=\177ELF at the same time.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/kern/exec_script.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/exec_script.c
diff -u src/sys/kern/exec_script.c:1.68 src/sys/kern/exec_script.c:1.69
--- src/sys/kern/exec_script.c:1.68	Mon Feb 17 19:29:46 2014
+++ src/sys/kern/exec_script.c	Fri Feb 21 08:11:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_script.c,v 1.68 2014/02/17 19:29:46 maxv Exp $	*/
+/*	$NetBSD: exec_script.c,v 1.69 2014/02/21 08:11:59 maxv Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exec_script.c,v 1.68 2014/02/17 19:29:46 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: exec_script.c,v 1.69 2014/02/21 08:11:59 maxv Exp $);
 
 #if defined(SETUIDSCRIPTS)  !defined(FDSCRIPTS)
 #define FDSCRIPTS		/* Need this for safe set-id scripts. */
@@ -155,13 +155,6 @@ exec_script_makecmds(struct lwp *l, stru
 	if (cp = hdrstr + hdrlinelen)
 		return ENOEXEC;
 
-	/*
-	 * If the script has an ELF header, don't exec it.
-	 */
-	if (epp-ep_hdrvalid = sizeof(ELFMAG)-1 
-	memcmp(hdrstr, ELFMAG, sizeof(ELFMAG)-1) == 0)
-		return ENOEXEC;
-
 	shellname = NULL;
 	shellarg = NULL;
 	shellarglen = 0;



CVS commit: src/sys/rump/net/lib/libvirtif

2014-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 21 08:33:51 UTC 2014

Modified Files:
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
Fix typo in fix for PR/48606


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/rump/net/lib/libvirtif/if_virt.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/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.37 src/sys/rump/net/lib/libvirtif/if_virt.c:1.38
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.37	Fri Feb 21 02:10:40 2014
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Fri Feb 21 08:33:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.37 2014/02/21 02:10:40 christos Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.38 2014/02/21 08:33:51 skrll Exp $	*/
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.37 2014/02/21 02:10:40 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_virt.c,v 1.38 2014/02/21 08:33:51 skrll Exp $);
 
 #include sys/param.h
 #include sys/condvar.h
@@ -278,7 +278,7 @@ virtif_receiver(void *arg)
 		m-m_len = m-m_pkthdr.len = n;
 		m-m_pkthdr.rcvif = ifp;
 		bpf_mtap(ifp, m);
-		(*ipf-if_input)(ifp, m);
+		(*ifp-if_input)(ifp, m);
 	}
 
 	kthread_exit(0);



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 10:26:25 UTC 2014

Modified Files:
src/tests/lib/libc/sync: all_sync_ops_linkable.c

Log Message:
Remove excemption for i386 (PR lib/48601) - missing aliases will be
added to the C code.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sync/all_sync_ops_linkable.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/sync/all_sync_ops_linkable.c
diff -u src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3 src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.4
--- src/tests/lib/libc/sync/all_sync_ops_linkable.c:1.3	Tue Feb 18 10:27:46 2014
+++ src/tests/lib/libc/sync/all_sync_ops_linkable.c	Fri Feb 21 10:26:25 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: all_sync_ops_linkable.c,v 1.3 2014/02/18 10:27:46 martin Exp $ */
+/* $NetBSD: all_sync_ops_linkable.c,v 1.4 2014/02/21 10:26:25 martin Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -124,17 +124,8 @@ main(int argc, char **argv)
 	__sync_lock_test_and_set_2(u16, 5);
 	__sync_lock_test_and_set_4(u32, 5);
 #ifdef __HAVE_ATOMIC64_OPS
-
-	/*
-	 * See PR lib/48601:
-	 * some architectures do not implement this, allow them to build
-	 * anyway.
-	 */
-#if !defined(__i386__)
 	__sync_lock_test_and_set_8(u64, 5);
 #endif
-
-#endif
 #ifndef __clang__
 	__sync_nand_and_fetch(u8, 5);
 	__sync_nand_and_fetch_1(u8, 5);



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 10:27:34 UTC 2014

Modified Files:
src/common/lib/libc/atomic: atomic_swap_32_cas.c atomic_swap_64_cas.c

Log Message:
Add missing __sync_lock_test_and_set_* aliases for PR lib/48601


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_swap_32_cas.c
cvs rdiff -u -r1.5 -r1.6 src/common/lib/libc/atomic/atomic_swap_64_cas.c

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/atomic/atomic_swap_32_cas.c
diff -u src/common/lib/libc/atomic/atomic_swap_32_cas.c:1.4 src/common/lib/libc/atomic/atomic_swap_32_cas.c:1.5
--- src/common/lib/libc/atomic/atomic_swap_32_cas.c:1.4	Mon Apr 28 20:22:53 2008
+++ src/common/lib/libc/atomic/atomic_swap_32_cas.c	Fri Feb 21 10:27:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_swap_32_cas.c,v 1.4 2008/04/28 20:22:53 martin Exp $	*/
+/*	$NetBSD: atomic_swap_32_cas.c,v 1.5 2014/02/21 10:27:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -50,6 +50,7 @@ atomic_op_alias(atomic_swap_32,_atomic_s
 #undef atomic_swap_uint
 atomic_op_alias(atomic_swap_uint,_atomic_swap_32)
 __strong_alias(_atomic_swap_uint,_atomic_swap_32)
+__strong_alias(__sync_lock_test_and_set_4,_atomic_swap_32)
 #if !defined(_LP64)
 #undef atomic_swap_ulong
 atomic_op_alias(atomic_swap_ulong,_atomic_swap_32)

Index: src/common/lib/libc/atomic/atomic_swap_64_cas.c
diff -u src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.5 src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.6
--- src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.5	Mon Apr 28 20:22:53 2008
+++ src/common/lib/libc/atomic/atomic_swap_64_cas.c	Fri Feb 21 10:27:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_swap_64_cas.c,v 1.5 2008/04/28 20:22:53 martin Exp $	*/
+/*	$NetBSD: atomic_swap_64_cas.c,v 1.6 2014/02/21 10:27:34 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@ atomic_op_alias(atomic_swap_64,_atomic_s
 #undef atomic_swap_ulong
 atomic_op_alias(atomic_swap_ulong,_atomic_swap_64)
 __strong_alias(_atomic_swap_ulong,_atomic_swap_64)
+__strong_alias(__sync_lock_test_and_set_8,_atomic_swap_64)
 #undef atomic_swap_ptr
 atomic_op_alias(atomic_swap_ptr,_atomic_swap_64)
 __strong_alias(_atomic_swap_ptr,_atomic_swap_64)



CVS commit: [netbsd-6] src/sys/dev/usb

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 10:41:06 UTC 2014

Modified Files:
src/sys/dev/usb [netbsd-6]: umass.c umassvar.h usb_mem.c

Log Message:
Pull up the following revisions(s) (requested by mlelstv in ticket #1032):
sys/dev/usb/umass.c:revision 1.148
sys/dev/usb/umassvar.h: revision 1.35
sys/dev/usb/usb_mem.c:  revision 1.64

Fix problem where umass might allocate buffers in interrupt context which
causes it to fail or a DIAGNOSTIC kernel to panic.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.141.10.1 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.31 -r1.31.10.1 src/sys/dev/usb/umassvar.h
cvs rdiff -u -r1.51 -r1.51.2.1 src/sys/dev/usb/usb_mem.c

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

Modified files:

Index: src/sys/dev/usb/umass.c
diff -u src/sys/dev/usb/umass.c:1.141 src/sys/dev/usb/umass.c:1.141.10.1
--- src/sys/dev/usb/umass.c:1.141	Wed Aug 24 11:28:50 2011
+++ src/sys/dev/usb/umass.c	Fri Feb 21 10:41:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $	*/
+/*	$NetBSD: umass.c,v 1.141.10.1 2014/02/21 10:41:06 sborrill Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,7 +124,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass.c,v 1.141.10.1 2014/02/21 10:41:06 sborrill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_umass.h
@@ -310,7 +310,7 @@ umass_attach(device_t parent, device_t s
 	const char *sWire, *sCommand;
 	char *devinfop;
 	usbd_status err;
-	int i, bno, error;
+	int i, error;
 
 	sc-sc_dev = self;
 
@@ -563,29 +563,54 @@ umass_attach(device_t parent, device_t s
 			return;
 		}
 	}
-	/* Allocate buffer for data transfer (it's huge). */
+	/* Allocate buffer for data transfer (it's huge), command and
+	   status data here as auto allocation cannot happen in interrupt
+	   context */
 	switch (sc-sc_wire) {
 	case UMASS_WPROTO_BBB:
-		bno = XFER_BBB_DATA;
-		goto dalloc;
+		sc-data_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_BBB_DATA],
+			UMASS_MAX_TRANSFER_SIZE);
+		sc-cmd_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_BBB_CBW],
+			UMASS_BBB_CBW_SIZE);
+		sc-s1_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_BBB_CSW1],
+			UMASS_BBB_CSW_SIZE);
+		sc-s2_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_BBB_CSW2],
+			UMASS_BBB_CSW_SIZE);
+		break;
 	case UMASS_WPROTO_CBI:
-		bno = XFER_CBI_DATA;
-		goto dalloc;
 	case UMASS_WPROTO_CBI_I:
-		bno = XFER_CBI_DATA;
-	dalloc:
-		sc-data_buffer = usbd_alloc_buffer(sc-transfer_xfer[bno],
-		UMASS_MAX_TRANSFER_SIZE);
-		if (sc-data_buffer == NULL) {
-			aprint_error_dev(self, no buffer memory\n);
-			umass_disco(sc);
-			return;
-		}
+		sc-data_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_CBI_DATA],
+			UMASS_MAX_TRANSFER_SIZE);
+		sc-cmd_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_CBI_CB],
+			sizeof(sc-cbl));
+		sc-s1_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_CBI_STATUS],
+			sizeof(sc-sbl));
+		sc-s2_buffer = usbd_alloc_buffer(
+			sc-transfer_xfer[XFER_CBI_RESET1],
+			sizeof(sc-cbl));
 		break;
 	default:
 		break;
 	}
 
+	if (sc-data_buffer == NULL || sc-cmd_buffer == NULL
+	|| sc-s1_buffer == NULL || sc-s2_buffer == NULL) {
+		/*
+		 * partially preallocated buffers are freed with
+		 * the xfer structures
+		 */
+		aprint_error_dev(self, no buffer memory\n);
+		umass_disco(sc);
+		return;
+	}
+
 	/* Initialise the wire protocol specific methods */
 	switch (sc-sc_wire) {
 	case UMASS_WPROTO_BBB:

Index: src/sys/dev/usb/umassvar.h
diff -u src/sys/dev/usb/umassvar.h:1.31 src/sys/dev/usb/umassvar.h:1.31.10.1
--- src/sys/dev/usb/umassvar.h:1.31	Sun Jul 31 16:32:02 2011
+++ src/sys/dev/usb/umassvar.h	Fri Feb 21 10:41:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: umassvar.h,v 1.31 2011/07/31 16:32:02 jakllsch Exp $	*/
+/*	$NetBSD: umassvar.h,v 1.31.10.1 2014/02/21 10:41:06 sborrill Exp $	*/
 /*-
  * Copyright (c) 1999 MAEKAWA Masahide bis...@rr.iij4u.or.jp,
  *		  Nick Hibma n_hi...@freebsd.org
@@ -223,6 +223,9 @@ struct umass_softc {
 	usbd_xfer_handle	transfer_xfer[XFER_NR]; /* for ctrl xfers */
 
 	void			*data_buffer;
+	void			*cmd_buffer;
+	void			*s1_buffer;
+	void			*s2_buffer;
 
 	int			transfer_dir;		/* data direction */
 	void			*transfer_data;		/* data buffer */

Index: src/sys/dev/usb/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.51 src/sys/dev/usb/usb_mem.c:1.51.2.1
--- src/sys/dev/usb/usb_mem.c:1.51	Fri Jan 27 18:53:09 2012
+++ src/sys/dev/usb/usb_mem.c	Fri Feb 21 10:41:06 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.51 2012/01/27 18:53:09 para Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.51.2.1 2014/02/21 10:41:06 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 

CVS commit: [netbsd-6] src/doc

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 10:42:12 UTC 2014

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1032


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.93 src/doc/CHANGES-6.2:1.1.2.94
--- src/doc/CHANGES-6.2:1.1.2.93	Thu Feb 20 13:55:53 2014
+++ src/doc/CHANGES-6.2	Fri Feb 21 10:42:12 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.93 2014/02/20 13:55:53 sborrill Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.94 2014/02/21 10:42:12 sborrill Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -1329,3 +1329,12 @@ lib/libpthread/pthread_mutex.c			1.57, 1
 	named. Also address PR/44756.
 	[prlw1, ticket #1029]
 
+sys/dev/usb/umass.c1.148
+sys/dev/usb/umassvar.h1.35
+sys/dev/usb/usb_mem.c1.64
+
+	Fix problem where umass might allocate buffers in interrupt
+	context which causes it to fail or a DIAGNOSTIC kernel to
+	panic.
+	[mlelstv, ticket #1032]
+



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 10:52:50 UTC 2014

Added Files:
src/common/lib/libc/atomic: atomic_cas_32_cas.c atomic_nand_32_cas.c
atomic_sub_32_cas.c atomic_xor_32_cas.c

Log Message:
Provide 32bit __sync ops based on atomic_cas_32.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_cas_32_cas.c \
src/common/lib/libc/atomic/atomic_nand_32_cas.c \
src/common/lib/libc/atomic/atomic_sub_32_cas.c \
src/common/lib/libc/atomic/atomic_xor_32_cas.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_cas_32_cas.c
diff -u /dev/null src/common/lib/libc/atomic/atomic_cas_32_cas.c:1.1
--- /dev/null	Fri Feb 21 10:52:50 2014
+++ src/common/lib/libc/atomic/atomic_cas_32_cas.c	Fri Feb 21 10:52:50 2014
@@ -0,0 +1,45 @@
+/*	$NetBSD: atomic_cas_32_cas.c,v 1.1 2014/02/21 10:52:50 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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.
+ */
+
+#if !defined(_KERNEL)  !defined(_STANDALONE)
+#include stdbool.h
+#endif
+#include sys/atomic.h
+
+bool bool_compare_and_swap_4(volatile uint32_t *, uint32_t, uint32_t, ...)
+asm(__sync_bool_compare_and_swap_4);
+
+bool
+bool_compare_and_swap_4(volatile uint32_t *addr, uint32_t oldval,
+	uint32_t newval, ...)
+{
+	return atomic_cas_32(addr, oldval, newval) == oldval;
+}
Index: src/common/lib/libc/atomic/atomic_nand_32_cas.c
diff -u /dev/null src/common/lib/libc/atomic/atomic_nand_32_cas.c:1.1
--- /dev/null	Fri Feb 21 10:52:50 2014
+++ src/common/lib/libc/atomic/atomic_nand_32_cas.c	Fri Feb 21 10:52:50 2014
@@ -0,0 +1,61 @@
+/*	$NetBSD: atomic_nand_32_cas.c,v 1.1 2014/02/21 10:52:50 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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/atomic.h
+
+uint32_t fetch_and_nand_4(volatile uint32_t *, uint32_t, ...)
+asm(__sync_fetch_and_nand_4);
+uint32_t nand_and_fetch_4(volatile uint32_t *, uint32_t, ...)
+asm(__sync_nand_and_fetch_4);
+

CVS commit: [netbsd-6] src/sys/arch/atari/dev

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 12:00:23 UTC 2014

Modified Files:
src/sys/arch/atari/dev [netbsd-6]: ite.c

Log Message:
Pull up the following revisions(s) (requested by tsutsui in ticket #1033):
sys/arch/atari/dev/ite.c:   revision 1.72

Fix kernel crash when a user tries to switch to nonexistent terminal.
Fixes PR/48599.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.8.1 src/sys/arch/atari/dev/ite.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/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.71 src/sys/arch/atari/dev/ite.c:1.71.8.1
--- src/sys/arch/atari/dev/ite.c:1.71	Sun Jun  5 16:25:12 2011
+++ src/sys/arch/atari/dev/ite.c	Fri Feb 21 12:00:23 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.71.8.1 2014/02/21 12:00:23 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71.8.1 2014/02/21 12:00:23 sborrill Exp $);
 
 #include opt_ddb.h
 
@@ -665,8 +665,8 @@ ite_switch(int unit)
 	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	sc = getitesp(unit);
-	if ((sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = device_lookup_private(ite_cd, unit);
+	if (sc == NULL || (sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*



CVS commit: [netbsd-6] src/doc

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 12:01:32 UTC 2014

Modified Files:
src/doc [netbsd-6]: CHANGES-6.2

Log Message:
Ticket #1033


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.94 -r1.1.2.95 src/doc/CHANGES-6.2

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

Modified files:

Index: src/doc/CHANGES-6.2
diff -u src/doc/CHANGES-6.2:1.1.2.94 src/doc/CHANGES-6.2:1.1.2.95
--- src/doc/CHANGES-6.2:1.1.2.94	Fri Feb 21 10:42:12 2014
+++ src/doc/CHANGES-6.2	Fri Feb 21 12:01:31 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.2,v 1.1.2.94 2014/02/21 10:42:12 sborrill Exp $
+# $NetBSD: CHANGES-6.2,v 1.1.2.95 2014/02/21 12:01:31 sborrill Exp $
 
 A complete list of changes from the 6.1 release until the 6.2 release:
 
@@ -1338,3 +1338,9 @@ sys/dev/usb/usb_mem.c1.64
 	panic.
 	[mlelstv, ticket #1032]
 
+sys/arch/atari/dev/ite.c			1.72
+
+	Fix kernel crash when a user tries to switch to nonexistent
+	terminal. Fixes PR/48599.
+	[tsutsui, ticket #1033]
+



CVS commit: src/sys/arch/alpha

2014-02-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Feb 21 12:23:30 UTC 2014

Modified Files:
src/sys/arch/alpha/conf: files.alpha
src/sys/arch/alpha/pci: tsc.c tsreg.h tsvar.h
Added Files:
src/sys/arch/alpha/pci: tsciic.c

Log Message:
Add tsciic, a driver for the DECchip 21272 Core Logic chipset I2C controller.
Tested on DS20L.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/alpha/conf/files.alpha
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/alpha/pci/tsc.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/alpha/pci/tsciic.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/pci/tsreg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/alpha/pci/tsvar.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/alpha/conf/files.alpha
diff -u src/sys/arch/alpha/conf/files.alpha:1.185 src/sys/arch/alpha/conf/files.alpha:1.186
--- src/sys/arch/alpha/conf/files.alpha:1.185	Tue Oct  2 23:54:51 2012
+++ src/sys/arch/alpha/conf/files.alpha	Fri Feb 21 12:23:30 2014
@@ -1,4 +1,4 @@
-# $NetBSD: files.alpha,v 1.185 2012/10/02 23:54:51 christos Exp $
+# $NetBSD: files.alpha,v 1.186 2014/02/21 12:23:30 jdc Exp $
 #
 # alpha-specific configuration info
 
@@ -275,6 +275,10 @@ file	arch/alpha/pci/tsp_pci.c	tsp
 file	arch/alpha/pci/tsp_bus_io.c	tsp
 file	arch/alpha/pci/tsp_bus_mem.c	tsp
 
+device	tsciic: i2cbus, i2c_bitbang
+attach	tsciic at tsc
+file	arch/alpha/pci/tsciic.c	tsciic
+
 device	ttwoga { hose = -1 }
 attach	ttwoga at mainbus
 # identical to pcibus

Index: src/sys/arch/alpha/pci/tsc.c
diff -u src/sys/arch/alpha/pci/tsc.c:1.22 src/sys/arch/alpha/pci/tsc.c:1.23
--- src/sys/arch/alpha/pci/tsc.c:1.22	Mon Sep 23 16:50:12 2013
+++ src/sys/arch/alpha/pci/tsc.c	Fri Feb 21 12:23:30 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tsc.c,v 1.22 2013/09/23 16:50:12 tsutsui Exp $ */
+/* $NetBSD: tsc.c,v 1.23 2014/02/21 12:23:30 jdc Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -35,7 +35,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.22 2013/09/23 16:50:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: tsc.c,v 1.23 2014/02/21 12:23:30 jdc Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -80,6 +80,16 @@ extern struct cfdriver tsp_cd;
 static int tsp_bus_get_window(int, int,
 	struct alpha_bus_space_translation *);
 
+static int tsciicprint(void *, const char *pnp);
+
+static int tsciicmatch(device_t, cfdata_t, void *);
+static void tsciicattach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(tsciic, sizeof(struct tsciic_softc), tsciicmatch,
+tsciicattach, NULL, NULL);
+
+extern struct cfdriver tsciic_cd;
+
 /* There can be only one */
 static int tscfound;
 
@@ -107,6 +117,7 @@ tscattach(device_t parent, device_t self
 	int nbus;
 	uint64_t csc, aar;
 	struct tsp_attach_args tsp;
+	struct tsciic_attach_args tsciic;
 	struct mainbus_attach_args *ma = aux;
 	int titan = cputype == ST_DEC_TITAN;
 
@@ -146,6 +157,11 @@ tscattach(device_t parent, device_t self
 			config_found(self, tsp, tscprint);
 		}
 	}
+
+	memset(tsciic, 0, sizeof tsciic);
+	tsciic.tsciic_name = tsciic;
+
+	config_found(self, tsciic, tsciicprint);
 }
 
 static int
@@ -158,6 +174,18 @@ tscprint(void *aux, const char *p)
 	return UNCONF;
 }
 
+static int
+tsciicprint(void *aux, const char *p)
+{
+	struct tsciic_attach_args *tsciic = aux;
+
+	if (p)
+		aprint_normal(%s at %s\n, tsciic-tsciic_name, p);
+	else
+		aprint_normal(\n);
+	return UNCONF;
+}
+
 #define tsp() { Generate ctags(1) key. }
 
 static int
@@ -277,6 +305,28 @@ tsp_bus_get_window(int type, int window,
 	return 0;
 }
 
+#define tsciic() { Generate ctags(1) key. }
+
+static int
+tsciicmatch(device_t parent, cfdata_t match, void *aux)
+{
+	struct tsciic_attach_args *t = aux;
+
+	switch (cputype) {
+	case ST_DEC_6600:
+	case ST_DEC_TITAN:
+		return strcmp(t-tsciic_name, tsciic_cd.cd_name) == 0;
+	default:
+		return 0;
+	}
+}
+
+static void
+tsciicattach(device_t parent, device_t self, void *aux)
+{
+	tsciic_init(self);
+}
+
 void
 tsc_print_dir(unsigned int indent, unsigned long dir)
 {

Index: src/sys/arch/alpha/pci/tsreg.h
diff -u src/sys/arch/alpha/pci/tsreg.h:1.6 src/sys/arch/alpha/pci/tsreg.h:1.7
--- src/sys/arch/alpha/pci/tsreg.h:1.6	Mon Sep 23 16:41:57 2013
+++ src/sys/arch/alpha/pci/tsreg.h	Fri Feb 21 12:23:30 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tsreg.h,v 1.6 2013/09/23 16:41:57 tsutsui Exp $ */
+/* $NetBSD: tsreg.h,v 1.7 2014/02/21 12:23:30 jdc Exp $ */
 
 /*-
  * Copyright (c) 1999 by Ross Harvey.  All rights reserved.
@@ -95,6 +95,11 @@
 
 #define TS_C_MPD	0x101##a000##00c0UL
 
+#	define	MPD_DR	0x08	/* RO: Data receive */
+#	define	MPD_CKR	0x04	/* RO: Clock receive */
+#	define	MPD_DS	0x02	/* WO: Data send - Must be a 1 to receive */
+#	define	MPD_CKS	0x01	/* WO: Clock send */
+
 #define TS_C_AAR0	0x101##a000##0100UL
 #define TS_C_AAR1	0x101##a000##0140UL
 #define TS_C_AAR2	0x101##a000##0180UL

Index: 

CVS commit: src/sys/dev

2014-02-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Feb 21 12:24:52 UTC 2014

Modified Files:
src/sys/dev: DEVNAMES

Log Message:
Add tsciic (alpha MI).


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/dev/DEVNAMES

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/DEVNAMES
diff -u src/sys/dev/DEVNAMES:1.286 src/sys/dev/DEVNAMES:1.287
--- src/sys/dev/DEVNAMES:1.286	Thu Feb 20 19:47:19 2014
+++ src/sys/dev/DEVNAMES	Fri Feb 21 12:24:52 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: DEVNAMES,v 1.286 2014/02/20 19:47:19 jdc Exp $
+#	$NetBSD: DEVNAMES,v 1.287 2014/02/21 12:24:52 jdc Exp $
 #
 # This file contains all used device names and defined attributes in
 # alphabetical order. New devices added to the system somewhere should first
@@ -1345,6 +1345,7 @@ tra			MI
 trm			MI
 ts			MI
 tsc			alpha
+tsciic			alpha
 tscs			MI
 tsec			powerpc
 tslcd			evbarm



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

2014-02-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Feb 21 12:24:31 UTC 2014

Modified Files:
src/sys/arch/alpha/conf: GENERIC

Log Message:
Add tsciic and more (commented out) DS20L i2c devices.


To generate a diff of this commit:
cvs rdiff -u -r1.357 -r1.358 src/sys/arch/alpha/conf/GENERIC

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

Modified files:

Index: src/sys/arch/alpha/conf/GENERIC
diff -u src/sys/arch/alpha/conf/GENERIC:1.357 src/sys/arch/alpha/conf/GENERIC:1.358
--- src/sys/arch/alpha/conf/GENERIC:1.357	Mon Jan 20 15:32:23 2014
+++ src/sys/arch/alpha/conf/GENERIC	Fri Feb 21 12:24:31 2014
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.357 2014/01/20 15:32:23 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.358 2014/02/21 12:24:31 jdc Exp $
 #
 # This machine description file is used to generate the default NetBSD
 # kernel.
@@ -19,7 +19,7 @@ include 	arch/alpha/conf/std.alpha
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-ident		GENERIC-$Revision: 1.357 $
+ident		GENERIC-$Revision: 1.358 $
 
 maxusers 32
 
@@ -225,6 +225,8 @@ mcmem*	at	mcbus? mid ?
 #EV6 Tsunami Core Logic
 
 tsc*	at	mainbus0
+tsciic* 	at	tsc?
+iic* 	at	tsciic?
 
 # DECpc AXP150 (Jensen) internal bus support
 jensenio* at	mainbus0
@@ -544,11 +546,20 @@ ld*	at	mlx? unit ?
 alipm* 	at pci? dev ? function ?
 iic* 	at alipm?
 
-# AlphaServer DS20L enviromental monitoring
+# AlphaServer DS20L i2c devices
 #lmenv* 	at iic? addr 0x2c
 #lmenv* 	at iic? addr 0x2d
 #lmenv* 	at iic? addr 0x2e
 #lmenv* 	at iic? addr 0x2f
+#spdmem* 	at iic? addr 0x50
+#spdmem* 	at iic? addr 0x51
+#spdmem* 	at iic? addr 0x52
+#spdmem* 	at iic? addr 0x53
+#spdmem* 	at iic? addr 0x54
+#spdmem* 	at iic? addr 0x55
+#spdmem* 	at iic? addr 0x56
+#spdmem* 	at iic? addr 0x57
+#seeprom* 	at iic0 addr 0x51 flags 0x2
 
 # PCMCIA USB controllers
 slhci*	at pcmcia? function ?			# ScanLogic SL811HS



CVS commit: src/share/man/man4/man4.alpha

2014-02-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Feb 21 12:26:01 UTC 2014

Modified Files:
src/share/man/man4/man4.alpha: Makefile intro.4 tsc.4
Added Files:
src/share/man/man4/man4.alpha: tsciic.4

Log Message:
Add manual page for tsciic and cross reference it from related pages.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man4/man4.alpha/Makefile \
src/share/man/man4/man4.alpha/tsc.4
cvs rdiff -u -r1.13 -r1.14 src/share/man/man4/man4.alpha/intro.4
cvs rdiff -u -r0 -r1.1 src/share/man/man4/man4.alpha/tsciic.4

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

Modified files:

Index: src/share/man/man4/man4.alpha/Makefile
diff -u src/share/man/man4/man4.alpha/Makefile:1.2 src/share/man/man4/man4.alpha/Makefile:1.3
--- src/share/man/man4/man4.alpha/Makefile:1.2	Mon May 20 16:21:32 2002
+++ src/share/man/man4/man4.alpha/Makefile	Fri Feb 21 12:26:00 2014
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.2 2002/05/20 16:21:32 wiz Exp $
+#	$NetBSD: Makefile,v 1.3 2014/02/21 12:26:00 jdc Exp $
 
 MAN=	apecs.4 asc.4 autoconf.4 cia.4 dwlpx.4 gbus.4 \
 	intro.4 irongate.4 jensenio.4 kft.4 lca.4 mcbus.4 \
-	mcpcia.4 sableio.4 tcasic.4 tlsb.4 tsc.4 tsp.4 \
-	ttwoga.4 ttwopci.4
+	mcpcia.4 sableio.4 tcasic.4 tlsb.4 tsc.4 tsciic.4 \
+	tsp.4 ttwoga.4 ttwopci.4
 
 MANSUBDIR=/alpha
 
Index: src/share/man/man4/man4.alpha/tsc.4
diff -u src/share/man/man4/man4.alpha/tsc.4:1.2 src/share/man/man4/man4.alpha/tsc.4:1.3
--- src/share/man/man4/man4.alpha/tsc.4:1.2	Wed Apr 30 13:10:55 2008
+++ src/share/man/man4/man4.alpha/tsc.4	Fri Feb 21 12:26:00 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: tsc.4,v 1.2 2008/04/30 13:10:55 martin Exp $
+.\ $NetBSD: tsc.4,v 1.3 2014/02/21 12:26:00 jdc Exp $
 .\
 .\ Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd September 19, 2001
+.Dd November 16, 2013
 .Dt TSC 4 alpha
 .Os
 .Sh NAME
@@ -44,4 +44,5 @@ driver provides support for the DECchip 
 .Sh SEE ALSO
 .Xr intro 4 ,
 .Xr mainbus 4 ,
+.Xr tsciic 4 ,
 .Xr tsp 4

Index: src/share/man/man4/man4.alpha/intro.4
diff -u src/share/man/man4/man4.alpha/intro.4:1.13 src/share/man/man4/man4.alpha/intro.4:1.14
--- src/share/man/man4/man4.alpha/intro.4:1.13	Thu Dec 26 11:11:53 2013
+++ src/share/man/man4/man4.alpha/intro.4	Fri Feb 21 12:26:00 2014
@@ -1,4 +1,4 @@
-.\ $NetBSD: intro.4,v 1.13 2013/12/26 11:11:53 njoly Exp $
+.\ $NetBSD: intro.4,v 1.14 2014/02/21 12:26:00 jdc Exp $
 .\
 .\ Copyright (c) 2001 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd September 19, 2001
+.Dd November 16, 2013
 .Dt INTRO 4 alpha
 .Os
 .Sh NAME
@@ -512,6 +512,8 @@ AlphaServer GS140
 .Tn MHz ,
 0.18 micron
 .Pc
+.Pp
+AlphaServer DS20L
 .El
 .Sh LIST OF DEVICES
 The devices listed below are supported in this incarnation of the system.
@@ -549,6 +551,8 @@ TURBOchannel host bus support
 AlphaServer 8x00 TurboLaser System bus
 .It tsc
 DECchip 21272 Core Logic chipset
+.It tsciic
+DECchip 21272 Core Logic chipset I2C controller
 .It tsp
 DECchip 21272 Core Logic chipset PCI controller
 .It ttwoga
@@ -577,6 +581,10 @@ PCMCIA devices are supported through the
 .Xr pcmcia 4
 bus and associated device drivers.
 .Pp
+I2C devices are supported through the
+.Xr iic 4
+bus and associated device drivers.
+.Pp
 Console devices using ISA, EISA, or PCI video adaptors and standard AT
 or PS/2 keyboards are supported by the machine independent
 .Xr wscons 4

Added files:

Index: src/share/man/man4/man4.alpha/tsciic.4
diff -u /dev/null src/share/man/man4/man4.alpha/tsciic.4:1.1
--- /dev/null	Fri Feb 21 12:26:01 2014
+++ src/share/man/man4/man4.alpha/tsciic.4	Fri Feb 21 12:26:00 2014
@@ -0,0 +1,47 @@
+.\	$NetBSD: tsciic.4,v 1.1 2014/02/21 12:26:00 jdc Exp $
+.\
+.\ Copyright (c) 2013 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Julian Coleman
+.\
+.\ 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 

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

2014-02-21 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Fri Feb 21 12:26:40 UTC 2014

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

Log Message:
Add the tsciic manual pages to the sets lists.


To generate a diff of this commit:
cvs rdiff -u -r1.1458 -r1.1459 src/distrib/sets/lists/man/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/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1458 src/distrib/sets/lists/man/mi:1.1459
--- src/distrib/sets/lists/man/mi:1.1458	Tue Jan 21 16:12:56 2014
+++ src/distrib/sets/lists/man/mi	Fri Feb 21 12:26:40 2014
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1458 2014/01/21 16:12:56 mlelstv Exp $
+# $NetBSD: mi,v 1.1459 2014/02/21 12:26:40 jdc Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -761,6 +761,7 @@
 ./usr/share/man/cat4/alpha/tlsb.0		man-sys-catman		.cat
 ./usr/share/man/cat4/alpha/tlsbmem.0		man-sys-catman		.cat
 ./usr/share/man/cat4/alpha/tsc.0		man-sys-catman		.cat
+./usr/share/man/cat4/alpha/tsciic.0		man-sys-catman		.cat
 ./usr/share/man/cat4/alpha/tsp.0		man-sys-catman		.cat
 ./usr/share/man/cat4/alpha/ttwoga.0		man-sys-catman		.cat
 ./usr/share/man/cat4/alpha/ttwopci.0		man-sys-catman		.cat
@@ -3808,6 +3809,7 @@
 ./usr/share/man/html4/alpha/tlsb.html		man-sys-htmlman		html
 ./usr/share/man/html4/alpha/tlsbmem.html	man-sys-htmlman		html
 ./usr/share/man/html4/alpha/tsc.html		man-sys-htmlman		html
+./usr/share/man/html4/alpha/tsciic.html		man-sys-htmlman		html
 ./usr/share/man/html4/alpha/tsp.html		man-sys-htmlman		html
 ./usr/share/man/html4/alpha/ttwoga.html		man-sys-htmlman		html
 ./usr/share/man/html4/alpha/ttwopci.html	man-sys-htmlman		html
@@ -6547,6 +6549,7 @@
 ./usr/share/man/man4/alpha/tlsb.4		man-sys-man		.man
 ./usr/share/man/man4/alpha/tlsbmem.4		man-sys-man		.man
 ./usr/share/man/man4/alpha/tsc.4		man-sys-man		.man
+./usr/share/man/man4/alpha/tsciic.4		man-sys-man		.man
 ./usr/share/man/man4/alpha/tsp.4		man-sys-man		.man
 ./usr/share/man/man4/alpha/ttwoga.4		man-sys-man		.man
 ./usr/share/man/man4/alpha/ttwopci.4		man-sys-man		.man



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

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 12:28:05 UTC 2014

Modified Files:
src/doc [netbsd-6-0]: CHANGES-6.0.5

Log Message:
Ticket #1033


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/doc/CHANGES-6.0.5

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

Modified files:

Index: src/doc/CHANGES-6.0.5
diff -u src/doc/CHANGES-6.0.5:1.1.2.3 src/doc/CHANGES-6.0.5:1.1.2.4
--- src/doc/CHANGES-6.0.5:1.1.2.3	Fri Feb 14 23:27:57 2014
+++ src/doc/CHANGES-6.0.5	Fri Feb 21 12:28:04 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0.5,v 1.1.2.3 2014/02/14 23:27:57 bouyer Exp $
+# $NetBSD: CHANGES-6.0.5,v 1.1.2.4 2014/02/21 12:28:04 sborrill Exp $
 
 A complete list of changes from the NetBSD 6.0.4 release to the NetBSD 6.0.5
 release:
@@ -29,3 +29,9 @@ sys/kern/exec_elf.c1.55
 	Fix memory leak on bogus ELF binary.
 	[maxv, ticket #1028]
 
+sys/arch/atari/dev/ite.c			1.72
+
+	Fix kernel crash when a user tries to switch to nonexistent
+	terminal. Fixes PR/48599.
+	[tsutsui, ticket #1033]
+



CVS commit: [netbsd-6-0] src/sys/arch/atari/dev

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 12:27:28 UTC 2014

Modified Files:
src/sys/arch/atari/dev [netbsd-6-0]: ite.c

Log Message:
Pull up the following revisions(s) (requested by tsutsui in ticket #1033):
sys/arch/atari/dev/ite.c:   revision 1.72

Fix kernel crash when a user tries to switch to nonexistent terminal.
Fixes PR/48599.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.14.1 src/sys/arch/atari/dev/ite.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/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.71 src/sys/arch/atari/dev/ite.c:1.71.14.1
--- src/sys/arch/atari/dev/ite.c:1.71	Sun Jun  5 16:25:12 2011
+++ src/sys/arch/atari/dev/ite.c	Fri Feb 21 12:27:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.71.14.1 2014/02/21 12:27:28 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71.14.1 2014/02/21 12:27:28 sborrill Exp $);
 
 #include opt_ddb.h
 
@@ -665,8 +665,8 @@ ite_switch(int unit)
 	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	sc = getitesp(unit);
-	if ((sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = device_lookup_private(ite_cd, unit);
+	if (sc == NULL || (sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*



CVS commit: [netbsd-6-1] src/sys/arch/atari/dev

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 13:21:45 UTC 2014

Modified Files:
src/sys/arch/atari/dev [netbsd-6-1]: ite.c

Log Message:
Pull up the following revisions(s) (requested by tsutsui in ticket #1033):
sys/arch/atari/dev/ite.c:   revision 1.72

Fix kernel crash when a user tries to switch to nonexistent terminal.
Fixes PR/48599.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.22.1 src/sys/arch/atari/dev/ite.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/atari/dev/ite.c
diff -u src/sys/arch/atari/dev/ite.c:1.71 src/sys/arch/atari/dev/ite.c:1.71.22.1
--- src/sys/arch/atari/dev/ite.c:1.71	Sun Jun  5 16:25:12 2011
+++ src/sys/arch/atari/dev/ite.c	Fri Feb 21 13:21:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $	*/
+/*	$NetBSD: ite.c,v 1.71.22.1 2014/02/21 13:21:45 sborrill Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -44,7 +44,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71 2011/06/05 16:25:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: ite.c,v 1.71.22.1 2014/02/21 13:21:45 sborrill Exp $);
 
 #include opt_ddb.h
 
@@ -665,8 +665,8 @@ ite_switch(int unit)
 	struct ite_softc	*sc;
 	extern const struct cdevsw view_cdevsw;
 
-	sc = getitesp(unit);
-	if ((sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
+	sc = device_lookup_private(ite_cd, unit);
+	if (sc == NULL || (sc-flags  (ITE_ATTACHED | ITE_INITED)) == 0)
 		return;
 
 	/*



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

2014-02-21 Thread Stephen Borrill
Module Name:src
Committed By:   sborrill
Date:   Fri Feb 21 13:28:00 UTC 2014

Modified Files:
src/doc [netbsd-6-1]: CHANGES-6.1.4

Log Message:
Ticket #1033


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/doc/CHANGES-6.1.4

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

Modified files:

Index: src/doc/CHANGES-6.1.4
diff -u src/doc/CHANGES-6.1.4:1.1.2.3 src/doc/CHANGES-6.1.4:1.1.2.4
--- src/doc/CHANGES-6.1.4:1.1.2.3	Fri Feb 14 23:27:46 2014
+++ src/doc/CHANGES-6.1.4	Fri Feb 21 13:28:00 2014
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.1.4,v 1.1.2.3 2014/02/14 23:27:46 bouyer Exp $
+# $NetBSD: CHANGES-6.1.4,v 1.1.2.4 2014/02/21 13:28:00 sborrill Exp $
 
 A complete list of changes from the NetBSD 6.1.3 release to the NetBSD 6.1.4
 release:
@@ -29,3 +29,9 @@ sys/kern/exec_elf.c1.55
 	Fix memory leak on bogus ELF binary.
 	[maxv, ticket #1028]
 
+sys/arch/atari/dev/ite.c			1.72
+
+	Fix kernel crash when a user tries to switch to nonexistent
+	terminal. Fixes PR/48599.
+	[tsutsui, ticket #1033]
+



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 14:42:09 UTC 2014

Modified Files:
src/common/lib/libc/atomic: atomic_swap_64_cas.c

Log Message:
Fix previous: move the alias declaration outside of a #ifdef _LP64


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/atomic/atomic_swap_64_cas.c

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/atomic/atomic_swap_64_cas.c
diff -u src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.6 src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.7
--- src/common/lib/libc/atomic/atomic_swap_64_cas.c:1.6	Fri Feb 21 10:27:34 2014
+++ src/common/lib/libc/atomic/atomic_swap_64_cas.c	Fri Feb 21 14:42:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_swap_64_cas.c,v 1.6 2014/02/21 10:27:34 martin Exp $	*/
+/*	$NetBSD: atomic_swap_64_cas.c,v 1.7 2014/02/21 14:42:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -49,11 +49,11 @@ atomic_swap_64(volatile uint64_t *addr, 
 
 #undef atomic_swap_64
 atomic_op_alias(atomic_swap_64,_atomic_swap_64)
+__strong_alias(__sync_lock_test_and_set_8,_atomic_swap_64)
 #if defined(_LP64)
 #undef atomic_swap_ulong
 atomic_op_alias(atomic_swap_ulong,_atomic_swap_64)
 __strong_alias(_atomic_swap_ulong,_atomic_swap_64)
-__strong_alias(__sync_lock_test_and_set_8,_atomic_swap_64)
 #undef atomic_swap_ptr
 atomic_op_alias(atomic_swap_ptr,_atomic_swap_64)
 __strong_alias(_atomic_swap_ptr,_atomic_swap_64)



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 15:51:07 UTC 2014

Modified Files:
src/common/lib/libc/atomic: atomic_op_namespace.h
Added Files:
src/common/lib/libc/atomic: atomic_add_16_cas.c atomic_add_8_cas.c
atomic_and_16_cas.c atomic_and_8_cas.c atomic_cas_16_cas.c
atomic_cas_8_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c
atomic_or_16_cas.c atomic_or_8_cas.c atomic_sub_16_cas.c
atomic_sub_8_cas.c atomic_swap_16_cas.c atomic_swap_8_cas.c
atomic_xor_16_cas.c atomic_xor_8_cas.c

Log Message:
Provide 8 and 16 bit sync ops (using 16 bit and 8 bit cas)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.2 src/common/lib/libc/atomic/atomic_add_16_cas.c \
src/common/lib/libc/atomic/atomic_add_8_cas.c \
src/common/lib/libc/atomic/atomic_and_16_cas.c \
src/common/lib/libc/atomic/atomic_and_8_cas.c \
src/common/lib/libc/atomic/atomic_cas_16_cas.c \
src/common/lib/libc/atomic/atomic_cas_8_cas.c \
src/common/lib/libc/atomic/atomic_or_16_cas.c \
src/common/lib/libc/atomic/atomic_or_8_cas.c \
src/common/lib/libc/atomic/atomic_swap_16_cas.c \
src/common/lib/libc/atomic/atomic_swap_8_cas.c
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/atomic/atomic_nand_16_cas.c \
src/common/lib/libc/atomic/atomic_nand_8_cas.c \
src/common/lib/libc/atomic/atomic_sub_16_cas.c \
src/common/lib/libc/atomic/atomic_sub_8_cas.c \
src/common/lib/libc/atomic/atomic_xor_16_cas.c \
src/common/lib/libc/atomic/atomic_xor_8_cas.c
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/atomic/atomic_op_namespace.h

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/atomic/atomic_op_namespace.h
diff -u src/common/lib/libc/atomic/atomic_op_namespace.h:1.4 src/common/lib/libc/atomic/atomic_op_namespace.h:1.5
--- src/common/lib/libc/atomic/atomic_op_namespace.h:1.4	Mon Jun 23 10:33:52 2008
+++ src/common/lib/libc/atomic/atomic_op_namespace.h	Fri Feb 21 15:51:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_op_namespace.h,v 1.4 2008/06/23 10:33:52 ad Exp $	*/
+/*	$NetBSD: atomic_op_namespace.h,v 1.5 2014/02/21 15:51:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -73,6 +73,8 @@
 #define	atomic_cas_ulong	_atomic_cas_ulong
 #define	atomic_cas_ptr		_atomic_cas_ptr
 #define	atomic_cas_64		_atomic_cas_64
+#define atomic_cas_16		_atomic_cas_16
+#define atomic_cas_8		_atomic_cas_8
 
 #define	atomic_cas_32_ni	_atomic_cas_32_ni
 #define	atomic_cas_uint_ni	_atomic_cas_uint_ni

Added files:

Index: src/common/lib/libc/atomic/atomic_add_16_cas.c
diff -u /dev/null src/common/lib/libc/atomic/atomic_add_16_cas.c:1.2
--- /dev/null	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_add_16_cas.c	Fri Feb 21 15:51:07 2014
@@ -0,0 +1,63 @@
+/*	$NetBSD: atomic_add_16_cas.c,v 1.2 2014/02/21 15:51:07 martin Exp $	*/
+
+/*-
+ * Copyright (c) 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * 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
+
+#include sys/atomic.h
+
+uint16_t fetch_and_add_2(volatile uint16_t *, uint16_t, ...)
+asm(__sync_fetch_and_add_2);
+uint16_t add_and_fetch_2(volatile uint16_t *, uint16_t, ...)
+asm(__sync_add_and_fetch_2);
+
+uint16_t
+fetch_and_add_2(volatile uint16_t *addr, uint16_t val, ...)
+{
+	uint16_t old, new;
+
+	do {
+		old = *addr;
+		new = old + val;
+	} while (atomic_cas_16(addr, old, new) != old);
+	return old;
+}
+
+uint16_t

CVS commit: src/sys/sys

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 15:52:53 UTC 2014

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

Log Message:
Declare 16 and 8 bit atomic CAS - while it is not usually sane to expect
these functions to work in MI code, we need them to provide some of the
__sync_* functions gcc and other compilers expect nowadays on some
architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/sys/atomic.h

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

Modified files:

Index: src/sys/sys/atomic.h
diff -u src/sys/sys/atomic.h:1.11 src/sys/sys/atomic.h:1.12
--- src/sys/sys/atomic.h:1.11	Fri Nov 20 02:17:07 2009
+++ src/sys/sys/atomic.h	Fri Feb 21 15:52:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic.h,v 1.11 2009/11/20 02:17:07 christos Exp $	*/
+/*	$NetBSD: atomic.h,v 1.12 2014/02/21 15:52:53 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,6 +91,13 @@ void *		atomic_cas_ptr(volatile void *, 
 uint64_t	atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t);
 
 /*
+ * This operations will be provided for userland, but may not be
+ * implemented efficiently.
+ */
+uint16_t	atomic_cas_16(volatile uint16_t *, uint16_t, uint16_t);
+uint8_t 	atomic_cas_8(volatile uint8_t *, uint8_t, uint8_t);
+
+/*
  * Non-interlocked atomic COMPARE-AND-SWAP.
  */
 uint32_t	atomic_cas_32_ni(volatile uint32_t *, uint32_t, uint32_t);



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 16:06:48 UTC 2014

Modified Files:
src/common/lib/libc/atomic: atomic_cas_16_cas.c atomic_cas_8_cas.c
atomic_nand_16_cas.c atomic_nand_8_cas.c atomic_sub_16_cas.c
atomic_sub_8_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c

Log Message:
Add a few missing namespace includes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/atomic/atomic_cas_16_cas.c \
src/common/lib/libc/atomic/atomic_cas_8_cas.c
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/atomic/atomic_nand_16_cas.c \
src/common/lib/libc/atomic/atomic_nand_8_cas.c \
src/common/lib/libc/atomic/atomic_sub_16_cas.c \
src/common/lib/libc/atomic/atomic_sub_8_cas.c \
src/common/lib/libc/atomic/atomic_xor_16_cas.c \
src/common/lib/libc/atomic/atomic_xor_8_cas.c

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/atomic/atomic_cas_16_cas.c
diff -u src/common/lib/libc/atomic/atomic_cas_16_cas.c:1.2 src/common/lib/libc/atomic/atomic_cas_16_cas.c:1.3
--- src/common/lib/libc/atomic/atomic_cas_16_cas.c:1.2	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_cas_16_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_cas_16_cas.c,v 1.2 2014/02/21 15:51:07 martin Exp $	*/
+/*	$NetBSD: atomic_cas_16_cas.c,v 1.3 2014/02/21 16:06:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include atomic_op_namespace.h
+
 #if !defined(_KERNEL)  !defined(_STANDALONE)
 #include stdbool.h
 #endif
Index: src/common/lib/libc/atomic/atomic_cas_8_cas.c
diff -u src/common/lib/libc/atomic/atomic_cas_8_cas.c:1.2 src/common/lib/libc/atomic/atomic_cas_8_cas.c:1.3
--- src/common/lib/libc/atomic/atomic_cas_8_cas.c:1.2	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_cas_8_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_cas_8_cas.c,v 1.2 2014/02/21 15:51:07 martin Exp $	*/
+/*	$NetBSD: atomic_cas_8_cas.c,v 1.3 2014/02/21 16:06:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include atomic_op_namespace.h
+
 #if !defined(_KERNEL)  !defined(_STANDALONE)
 #include stdbool.h
 #endif

Index: src/common/lib/libc/atomic/atomic_nand_16_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.1 src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_nand_16_cas.c:1.1	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_nand_16_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_16_cas.c,v 1.1 2014/02/21 15:51:07 martin Exp $	*/
+/*	$NetBSD: atomic_nand_16_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include atomic_op_namespace.h
+
 #include sys/atomic.h
 
 uint16_t fetch_and_nand_2(volatile uint16_t *, uint16_t, ...)
Index: src/common/lib/libc/atomic/atomic_nand_8_cas.c
diff -u src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.1 src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_nand_8_cas.c:1.1	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_nand_8_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_nand_8_cas.c,v 1.1 2014/02/21 15:51:07 martin Exp $	*/
+/*	$NetBSD: atomic_nand_8_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include atomic_op_namespace.h
+
 #include sys/atomic.h
 
 uint8_t fetch_and_nand_1(volatile uint8_t *, uint8_t, ...)
Index: src/common/lib/libc/atomic/atomic_sub_16_cas.c
diff -u src/common/lib/libc/atomic/atomic_sub_16_cas.c:1.1 src/common/lib/libc/atomic/atomic_sub_16_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_sub_16_cas.c:1.1	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_sub_16_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_sub_16_cas.c,v 1.1 2014/02/21 15:51:07 martin Exp $	*/
+/*	$NetBSD: atomic_sub_16_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include atomic_op_namespace.h
+
 #include sys/atomic.h
 
 uint16_t fetch_and_sub_2(volatile uint16_t *, uint16_t, ...)
Index: src/common/lib/libc/atomic/atomic_sub_8_cas.c
diff -u src/common/lib/libc/atomic/atomic_sub_8_cas.c:1.1 src/common/lib/libc/atomic/atomic_sub_8_cas.c:1.2
--- src/common/lib/libc/atomic/atomic_sub_8_cas.c:1.1	Fri Feb 21 15:51:07 2014
+++ src/common/lib/libc/atomic/atomic_sub_8_cas.c	Fri Feb 21 16:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_sub_8_cas.c,v 1.1 2014/02/21 15:51:07 martin Exp $	*/
+/*	

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

2014-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 21 16:08:19 UTC 2014

Modified Files:
src/sys/arch/evbarm/dev: plcomvar.h

Log Message:
No need to include sys/simplelock.h here.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/evbarm/dev/plcomvar.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/evbarm/dev/plcomvar.h
diff -u src/sys/arch/evbarm/dev/plcomvar.h:1.14 src/sys/arch/evbarm/dev/plcomvar.h:1.15
--- src/sys/arch/evbarm/dev/plcomvar.h:1.14	Wed May  1 07:33:24 2013
+++ src/sys/arch/evbarm/dev/plcomvar.h	Fri Feb 21 16:08:19 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: plcomvar.h,v 1.14 2013/05/01 07:33:24 mlelstv Exp $	*/
+/*	$NetBSD: plcomvar.h,v 1.15 2014/02/21 16:08:19 skrll Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -42,7 +42,6 @@
 
 #include sys/callout.h
 #include sys/timepps.h
-#include sys/simplelock.h
 
 struct plcom_instance;
 



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 16:21:02 UTC 2014

Modified Files:
src/common/lib/libc/arch/sparc/atomic: Makefile.inc atomic_cas.S

Log Message:
Provide the missing __sync_* ops for sparc.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/common/lib/libc/arch/sparc/atomic/Makefile.inc
cvs rdiff -u -r1.12 -r1.13 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S

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

Modified files:

Index: src/common/lib/libc/arch/sparc/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.16 src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.17
--- src/common/lib/libc/arch/sparc/atomic/Makefile.inc:1.16	Wed Jan 29 13:06:36 2014
+++ src/common/lib/libc/arch/sparc/atomic/Makefile.inc	Fri Feb 21 16:21:02 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.16 2014/01/29 13:06:36 martin Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2014/02/21 16:21:02 martin Exp $
 
 .include bsd.own.mk
 
@@ -21,7 +21,20 @@ SPARC64DIR=	${.PARSEDIR}/../../sparc64/a
 SRCS+=	atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \
 	atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
 	atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \
-	atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S
+	atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S	\
+	atomic_cas_32_cas.c atomic_nand_32_cas.c atomic_sub_32_cas.c	\
+	atomic_xor_32_cas.c
+.  endif
+
+.  if ${LIB} == c
+SRCS+=	atomic_nand_16_cas.c atomic_nand_8_cas.c	\
+	atomic_and_16_cas.c atomic_and_8_cas.c		\
+	atomic_xor_16_cas.c atomic_xor_8_cas.c		\
+	atomic_add_16_cas.c atomic_add_8_cas.c		\
+	atomic_cas_16_cas.c atomic_cas_8_cas.c		\
+	atomic_sub_16_cas.c atomic_sub_8_cas.c		\
+	atomic_or_16_cas.c atomic_or_8_cas.c		\
+	atomic_swap_16_cas.c atomic_swap_8_cas.c
 .  endif
 
 .  if (${LIB} == kern || ${LIB} == rump)

Index: src/common/lib/libc/arch/sparc/atomic/atomic_cas.S
diff -u src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.12 src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.13
--- src/common/lib/libc/arch/sparc/atomic/atomic_cas.S:1.12	Thu Sep 12 15:36:14 2013
+++ src/common/lib/libc/arch/sparc/atomic/atomic_cas.S	Fri Feb 21 16:21:02 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_cas.S,v 1.12 2013/09/12 15:36:14 joerg Exp $	*/
+/*	$NetBSD: atomic_cas.S,v 1.13 2014/02/21 16:21:02 martin Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -147,6 +147,7 @@ ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic
 STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32)
 ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32)
 STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
+STRONG_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32)
 
 ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32)
 STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32)



CVS commit: src

2014-02-21 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Fri Feb 21 18:00:09 UTC 2014

Modified Files:
src/lib/libkvm: kvm_sparc64.c
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c
src/sys/arch/sparc64/doc: TODO
src/sys/arch/sparc64/include: cpu.h param.h pte.h
src/sys/arch/sparc64/sparc64: autoconf.c genassym.cf locore.s

Log Message:
sun4v: Rename TLB_ defines to SUN4U_TLB_ so entries created using TSB_DATA() 
are properly setup for sun4u and sun4v. Relocate the cputyp variable from 
autoconf.c to locore.s and make it const in param.h so optimized code can be 
generated. Parts from OpenBSD. Optimization suggested by nakayama@. OK martin@, 
mrg@, nakayama@


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/lib/libkvm/kvm_sparc64.c
cvs rdiff -u -r1.11 -r1.12 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/sparc64/doc/TODO
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/sparc64/include/cpu.h
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/sparc64/include/param.h
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/sparc64/include/pte.h
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/sparc64/sparc64/autoconf.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/sparc64/sparc64/genassym.cf
cvs rdiff -u -r1.355 -r1.356 src/sys/arch/sparc64/sparc64/locore.s

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

Modified files:

Index: src/lib/libkvm/kvm_sparc64.c
diff -u src/lib/libkvm/kvm_sparc64.c:1.16 src/lib/libkvm/kvm_sparc64.c:1.17
--- src/lib/libkvm/kvm_sparc64.c:1.16	Wed Feb 19 20:21:22 2014
+++ src/lib/libkvm/kvm_sparc64.c	Fri Feb 21 18:00:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kvm_sparc64.c,v 1.16 2014/02/19 20:21:22 dsl Exp $	*/
+/*	$NetBSD: kvm_sparc64.c,v 1.17 2014/02/21 18:00:09 palle Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = @(#)kvm_sparc.c	8.1 (Berkeley) 6/4/93;
 #else
-__RCSID($NetBSD: kvm_sparc64.c,v 1.16 2014/02/19 20:21:22 dsl Exp $);
+__RCSID($NetBSD: kvm_sparc64.c,v 1.17 2014/02/21 18:00:09 palle Exp $);
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -64,6 +64,7 @@ __RCSID($NetBSD: kvm_sparc64.c,v 1.16 2
 #include machine/pmap.h
 #include machine/kcore.h
 #include machine/vmparam.h
+#include machine/param.h
 
 #include limits.h
 #include db.h
@@ -210,7 +211,7 @@ _kvm_kvatop(kvm_t *kd, vaddr_t va, paddr
 	 *  -- We could support multiple page sizes.
 	 */
 	va = va  (kd-nbpg - 1);
-	data = TLB_PA_MASK;
+	data = SUN4U_TLB_PA_MASK; /* XXX handle sun4u/sun4v */
 	*pa = data + va;
 
 	/*

Index: src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.11 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.12
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.11	Sun Dec  8 14:41:28 2013
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Fri Feb 21 18:00:09 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.11 2013/12/08 14:41:28 palle Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.12 2014/02/21 18:00:09 palle Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -341,7 +341,7 @@ mmu_mapin_sun4u(vaddr_t rva, vsize_t len
 			DPRINTF((mmu_mapin: 0x%lx:0x%x.0x%x\n, va,
 			hi(pa), lo(pa)));
 
-			data = TSB_DATA(0,		/* global */
+			data = SUN4U_TSB_DATA(0,	/* global */
 	PGSZ_4M,	/* 4mb page */
 	pa,		/* phys.address */
 	1,		/* privileged */
@@ -351,7 +351,7 @@ mmu_mapin_sun4u(vaddr_t rva, vsize_t len
 	1,		/* valid */
 	0		/* endianness */
 	);
-			data |= TLB_L | TLB_CV; /* locked, virt.cache */
+			data |= SUN4U_TLB_L | SUN4U_TLB_CV; /* locked, virt.cache */
 
 			dtlb_store[dtlb_slot].te_pa = pa;
 			dtlb_store[dtlb_slot].te_va = va;
@@ -634,7 +634,7 @@ sparc64_finalize_tlb_sun4u(u_long data_v
 continue;
 		}
 
-		data = TSB_DATA(0,		/* global */
+		data = SUN4U_TSB_DATA(0,	/* global */
 PGSZ_4M,	/* 4mb page */
 dtlb_store[i].te_pa,	/* phys.address */
 1,		/* privileged */
@@ -644,7 +644,7 @@ sparc64_finalize_tlb_sun4u(u_long data_v
 1,		/* valid */
 0		/* endianness */
 );
-		data |= TLB_L | TLB_CV; /* locked, virt.cache */
+		data |= SUN4U_TLB_L | SUN4U_TLB_CV; /* locked, virt.cache */
 		if (!writable_text)
 			dtlb_replace(dtlb_store[i].te_va, hi(data), lo(data));
 		itlb_store[itlb_slot] = dtlb_store[i];

Index: src/sys/arch/sparc64/doc/TODO
diff -u src/sys/arch/sparc64/doc/TODO:1.1 src/sys/arch/sparc64/doc/TODO:1.2
--- src/sys/arch/sparc64/doc/TODO:1.1	Sat Jan 25 19:07:25 2014
+++ src/sys/arch/sparc64/doc/TODO	Fri Feb 21 18:00:09 2014
@@ -1,4 +1,4 @@
- /* $NetBSD: TODO,v 1.1 2014/01/25 19:07:25 palle Exp $ */
+ /* $NetBSD: TODO,v 1.2 2014/02/21 18:00:09 palle Exp $ */
 
 Things to be done:
 
@@ -7,3 +7,6 @@ sun4u:
 sun4v:
 - 64-bit kernel support
 - 32-bit kernel support
+- libkvm
+- ofwboot: tlb_init_sun4v() hardcodes number of slots to 64
+- sun4v_datatrap: 

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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 19:05:33 UTC 2014

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

Log Message:
Provide all __sync_* ops in libc.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/common/lib/libc/arch/mips/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/mips/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.10 src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.11
--- src/common/lib/libc/arch/mips/atomic/Makefile.inc:1.10	Mon Dec 14 00:38:59 2009
+++ src/common/lib/libc/arch/mips/atomic/Makefile.inc	Fri Feb 21 19:05:33 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.10 2009/12/14 00:38:59 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.11 2014/02/21 19:05:33 martin Exp $
 
 .if defined(LIB)  (${LIB} == kern || ${LIB} == c || ${LIB} == pthread \
 	|| ${LIB} == rump)
@@ -38,6 +38,17 @@ SRCS+=	atomic_cas.S atomic_init_cas.c
 
 .endif
 
+.if defined(LIB)  ${LIB} == c
+SRCS+=	atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c	\
+	atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c	\
+	atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c	\
+	atomic_or_16_cas.c atomic_or_8_cas.c\
+	atomic_and_16_cas.c atomic_and_8_cas.c\
+	atomic_add_16_cas.c atomic_add_8_cas.c\
+	atomic_swap_16_cas.c atomic_swap_8_cas.c			\
+	atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c
+.endif
+
 .if defined(LIB)  (${LIB} == kern || ${LIB} == rump)
 
 SRCS+=	membar_ops.S



CVS commit: src/share/mk

2014-02-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Feb 21 20:44:03 UTC 2014

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

Log Message:
Use small code model for LLVM on SPARC64, it should be equivalent to
GCC's medlow.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/share/mk/bsd.kmodule.mk

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

Modified files:

Index: src/share/mk/bsd.kmodule.mk
diff -u src/share/mk/bsd.kmodule.mk:1.41 src/share/mk/bsd.kmodule.mk:1.42
--- src/share/mk/bsd.kmodule.mk:1.41	Sat Nov  9 22:40:15 2013
+++ src/share/mk/bsd.kmodule.mk	Fri Feb 21 20:44:03 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kmodule.mk,v 1.41 2013/11/09 22:40:15 jmcneill Exp $
+#	$NetBSD: bsd.kmodule.mk,v 1.42 2014/02/21 20:44:03 joerg Exp $
 
 # We are not building this with PIE
 MKPIE=no
@@ -38,7 +38,8 @@ CFLAGS+=	-fno-pic
 
 .if ${MACHINE} == sparc64
 # force same memory model as rest of the kernel
-CFLAGS+=	-mcmodel=medlow
+CFLAGS+=	${${ACTIVE_CC} == gcc:? -mcmodel=medlow :}
+CFLAGS+=	${${ACTIVE_CC} == clang:? -mcmodel=small :}
 .endif
 
 # evbppc needs some special help



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

2014-02-21 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Fri Feb 21 20:45:12 UTC 2014

Modified Files:
src/sys/arch/sparc64/conf: Makefile.sparc64

Log Message:
Use code model small for LLVM, it should be equivalent to GCC's medlow.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sparc64/conf/Makefile.sparc64

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/sparc64/conf/Makefile.sparc64
diff -u src/sys/arch/sparc64/conf/Makefile.sparc64:1.73 src/sys/arch/sparc64/conf/Makefile.sparc64:1.74
--- src/sys/arch/sparc64/conf/Makefile.sparc64:1.73	Tue Mar 19 19:59:40 2013
+++ src/sys/arch/sparc64/conf/Makefile.sparc64	Fri Feb 21 20:45:12 2014
@@ -1,4 +1,4 @@
-# 	$NetBSD: Makefile.sparc64,v 1.73 2013/03/19 19:59:40 christos Exp $
+# 	$NetBSD: Makefile.sparc64,v 1.74 2014/02/21 20:45:12 joerg Exp $
 
 #=
 #
@@ -59,10 +59,12 @@ CPPFLAGS+=	-D_LP64 -Wa,-Av9a
 AFLAGS+=	-Wa,-Av9a
 .if defined(PROF)
 # Profiling is only supported in the medium low memory model.
-CFLAGS+=	-mcmodel=medlow
+CFLAGS+=	${${ACTIVE_CC} == gcc:? -mcmodel=medlow :}
+CFLAGS+=	${${ACTIVE_CC} == clang:? -mcmodel=small :}
 .else
 # Since the kernel resides in the lower 32 bits, use medium low for now anyway.
-CFLAGS+=	-mcmodel=medlow
+CFLAGS+=	${${ACTIVE_CC} == gcc:? -mcmodel=medlow :}
+CFLAGS+=	${${ACTIVE_CC} == clang:? -mcmodel=small :}
 .endif
 .else
 # 32-bit kernels



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

2014-02-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Feb 21 21:54:38 UTC 2014

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

Log Message:
Provide the missing __sync_* ops for earlier arm versions


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/common/lib/libc/arch/arm/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/arm/atomic/Makefile.inc
diff -u src/common/lib/libc/arch/arm/atomic/Makefile.inc:1.15 src/common/lib/libc/arch/arm/atomic/Makefile.inc:1.16
--- src/common/lib/libc/arch/arm/atomic/Makefile.inc:1.15	Mon Jan 27 18:05:24 2014
+++ src/common/lib/libc/arch/arm/atomic/Makefile.inc	Fri Feb 21 21:54:38 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.15 2014/01/27 18:05:24 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.16 2014/02/21 21:54:38 martin Exp $
 
 ARMV6= ${CPUFLAGS:M-march=armv6*} ${CPUFLAGS:M-mcpu=arm11*}
 ARMV6+= ${CFLAGS:M-march=armv6*:} ${CFLAGS:M-mcpu=arm11*}
@@ -22,7 +22,14 @@ SRCS.atomic+=	atomic_add_32_cas.c atomic
 		atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \
 		atomic_inc_32_cas.c atomic_inc_32_nv_cas.c \
 		atomic_or_32_cas.c atomic_or_32_nv_cas.c \
-		atomic_swap_32_cas.c membar_ops_nop.c
+		atomic_swap_32_cas.c membar_ops_nop.c \
+		atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \
+		atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \
+		atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \
+		atomic_or_16_cas.c atomic_or_8_cas.c \
+		atomic_and_16_cas.c atomic_and_8_cas.c \
+		atomic_add_16_cas.c atomic_add_8_cas.c \
+		atomic_swap_16_cas.c atomic_swap_8_cas.c
 .else
 .for op in add and cas nand or xor
 .for sz in 8 16 32 64



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

2014-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 21 22:05:58 UTC 2014

Modified Files:
src/sys/arch/arm/include/arm32: vmparam.h

Log Message:
Remove unnecessary include of sys/simplelock.h


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/include/arm32/vmparam.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/arm32/vmparam.h
diff -u src/sys/arch/arm/include/arm32/vmparam.h:1.29 src/sys/arch/arm/include/arm32/vmparam.h:1.30
--- src/sys/arch/arm/include/arm32/vmparam.h:1.29	Wed Feb 27 17:50:07 2013
+++ src/sys/arch/arm/include/arm32/vmparam.h	Fri Feb 21 22:05:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.29 2013/02/27 17:50:07 matt Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.30 2014/02/21 22:05:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 Wasabi Systems, Inc.
@@ -44,9 +44,6 @@
  * Virtual Memory parameters common to all arm32 platforms.
  */
 
-#ifndef __ASSEMBLER__
-#include sys/simplelock.h	/* struct simplelock */ 
-#endif /* __ASSEMBLER__ */
 #include arm/arm32/pte.h	/* pt_entry_t */
 
 #define	USRSTACK	VM_MAXUSER_ADDRESS



CVS commit: src/sys/sys

2014-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 21 22:06:48 UTC 2014

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

Log Message:
Remove struct simplelock forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 src/sys/sys/proc.h

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

Modified files:

Index: src/sys/sys/proc.h
diff -u src/sys/sys/proc.h:1.319 src/sys/sys/proc.h:1.320
--- src/sys/sys/proc.h:1.319	Wed Jan  2 19:39:04 2013
+++ src/sys/sys/proc.h	Fri Feb 21 22:06:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.319 2013/01/02 19:39:04 dsl Exp $	*/
+/*	$NetBSD: proc.h,v 1.320 2014/02/21 22:06:48 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -453,8 +453,6 @@ extern const struct proclist_desc procli
 
 extern struct pool	ptimer_pool;	/* Memory pool for ptimers */
 
-struct simplelock;
-
 proc_t *	proc_find_raw(pid_t);
 proc_t *	proc_find(pid_t);		/* Find process by ID */
 struct pgrp *	pgrp_find(pid_t);		/* Find process group by ID */



CVS commit: src/sys/uvm

2014-02-21 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Feb 21 22:08:07 UTC 2014

Modified Files:
src/sys/uvm: uvm_extern.h

Log Message:
Remove unnecessary  struct simplelock forward declaration.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/uvm/uvm_extern.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/uvm/uvm_extern.h
diff -u src/sys/uvm/uvm_extern.h:1.188 src/sys/uvm/uvm_extern.h:1.189
--- src/sys/uvm/uvm_extern.h:1.188	Fri Jan  3 21:12:18 2014
+++ src/sys/uvm/uvm_extern.h	Fri Feb 21 22:08:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_extern.h,v 1.188 2014/01/03 21:12:18 dsl Exp $	*/
+/*	$NetBSD: uvm_extern.h,v 1.189 2014/02/21 22:08:07 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -232,7 +232,6 @@ struct vm_anon;
 struct vmspace;
 struct pmap;
 struct vnode;
-struct simplelock;
 struct vm_map_entry;
 struct vm_map;
 struct vm_page;



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

2014-02-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 22:18:47 UTC 2014

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

Log Message:
Add EMAC and CPUCFG registers


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/arch/arm/allwinner/awin_reg.h:1.10
--- src/sys/arch/arm/allwinner/awin_reg.h:1.9	Mon Sep  9 17:52:48 2013
+++ src/sys/arch/arm/allwinner/awin_reg.h	Fri Feb 21 22:18:47 2014
@@ -108,7 +108,7 @@
 #define AWIN_TP_OFFSET			0x00025000
 #define AWIN_PMU_OFFSET			0x00025400
 #define AWIN__RSVD6_OFFSET		0x00025800
-#define AWIN_CPUCNF_OFFSET		0x00025C00
+#define AWIN_CPUCFG_OFFSET		0x00025C00
 #define AWIN__RSVD7_OFFSET		0x00026000
 #define AWIN__RSVD8_OFFSET		0x00026400
 #define AWIN__RSVD9_OFFSET		0x00026800
@@ -153,6 +153,13 @@
 #define AWIN_AVG_OFFSET			0x002A
 #define AWIN_SDRAM_PBASE		0x4000
 
+/* A10/A20 SRAM Controller */
+#define AWIN_SRAM_CTL0_REG		0x
+#define AWIN_SRAM_CTL1_REG		0x0004
+
+#define AWIN_SRAM_CTL1_A3_A4		__BITS(5,4)
+#define AWIN_SRAM_CTL1_A3_A4_EMAC	1
+
 /* A10/A20 DRAM Controller */
 #define AWIN_DRAM_CCR_REG		0x
 #define AWIN_DRAM_DCR_REG		0x0004
@@ -224,6 +231,124 @@
 #define AWIN_DRAM_HPCR_PRIORITY_LEVEL	__BIT(2)
 #define AWIN_DRAM_HPCR_ACCESS_EN	__BIT(0)
 
+/* DMA controller defintions */
+#define AWIN_DMA_IRQ_EN_REG		0x
+#define AWIN_DMA_IRQ_PEND_STA_REG	0x0004
+#define AWIN_NDMA_AUTO_GATE_REG		0x0008
+#define AWIN_NDMA_REG(n)		(0x100+0x20*(n))
+#define AWIN_NDMA_CTL_REG		0x
+#define AWIN_NDMA_SRC_ADDR_REG		0x0004
+#define AWIN_NDMA_DEST_ADDR_REG		0x0008
+#define AWIN_NDMA_BC_REG		0x000c
+
+#define AWIN_DDMA_REG(n)		(0x300+0x20*(n))
+#define AWIN_DDMA_CTL_REG		0x
+#define AWIN_DDMA_SRC_START_ADDR_REG	0x0004
+#define AWIN_DDMA_DEST_START_ADDR_REG	0x0008
+#define AWIN_DDMA_BC_REG		0x000c
+#define AWIN_DDMA_PARA_REG		0x0018
+
+#define AWIN_DMA_IRQ_DDMA_END(n)	__BIT(17+2*(n))
+#define AWIN_DMA_IRQ_DDMA_HF(n)		__BIT(16+2*(n))
+#define AWIN_DMA_IRQ_NDMA_END(n)	__BIT(1+2*(n))
+#define AWIN_DMA_IRQ_NDMA_HF(n)		__BIT(0+2*(n))
+
+#define AWIN_NDMA_AUTO_GATING_DIS	__BIT(16)
+
+#define AWIN_DMA_CTL_DST_DATA_WIDTH	__BITS(26,25)
+#define AWIN_DMA_CTL_DATA_WIDTH_8	0
+#define AWIN_DMA_CTL_DATA_WIDTH_16	1
+#define AWIN_DMA_CTL_DATA_WIDTH_32	2
+#define AWIN_DMA_CTL_DST_BURST_LEN	__BITS(24,23)
+#define AWIN_DMA_CTL_BURST_LEN_1	0
+#define AWIN_DMA_CTL_BURST_LEN_4	1
+#define AWIN_DMA_CTL_BURST_LEN_8	2
+#define AWIN_DMA_CTL_DST_DRQ_TYPE	__BITS(20,16)
+#define AWIN_DMA_CTL_BC_REMAINING	__BIT(15)
+#define AWIN_DMA_CTL_SRC_DATA_WIDTH	__BITS(10,9)
+#define AWIN_DMA_CTL_SRC_BURST_LEN	__BITS(8,7)
+#define AWIN_DMA_CTL_SRC_DRQ_TYPE	__BITS(4,0)
+
+#define AWIN_NDMA_CTL_DMA_LOADING	__BIT(31)
+#define AWIN_NDMA_CTL_DMA_CONTIN_MODE	__BIT(30)
+#define AWIN_NDMA_CTL_WAIT_STATE_LOG2	__BITS(29,27)
+#define AWIN_NDMA_CTL_DST_NON_SECURE	__BIT(22)
+#define AWIN_NDMA_CTL_DST_ADDR_NOINCR	__BIT(21)
+#define AWIN_NDMA_CTL_DRQ_IRO		0
+#define AWIN_NDMA_CTL_DRQ_IR1		1
+#define AWIN_NDMA_CTL_DRQ_SPDIF		2
+#define AWIN_NDMA_CTL_DRQ_IISO		3
+#define AWIN_NDMA_CTL_DRQ_IIS1		4
+#define AWIN_NDMA_CTL_DRQ_AC97		5
+#define AWIN_NDMA_CTL_DRQ_IIS2		6
+#define AWIN_NDMA_CTL_DRQ_UARTO		8
+#define AWIN_NDMA_CTL_DRQ_UART1		9
+#define AWIN_NDMA_CTL_DRQ_UART2		10
+#define AWIN_NDMA_CTL_DRQ_UART3		11
+#define AWIN_NDMA_CTL_DRQ_UART4		12
+#define AWIN_NDMA_CTL_DRQ_UART5		13
+#define AWIN_NDMA_CTL_DRQ_UART6		14
+#define AWIN_NDMA_CTL_DRQ_UART7		15
+#define AWIN_NDMA_CTL_DRQ_DDC		16
+#define AWIN_NDMA_CTL_DRQ_USB_EP1	17
+#define AWIN_NDMA_CTL_DRQ_CODEC		19
+#define AWIN_NDMA_CTL_DRQ_SRAM		21
+#define AWIN_NDMA_CTL_DRQ_SDRAM		22
+#define AWIN_NDMA_CTL_DRQ_TP_AD		23
+#define AWIN_NDMA_CTL_DRQ_SPI0		24
+#define AWIN_NDMA_CTL_DRQ_SPI1		25
+#define AWIN_NDMA_CTL_DRQ_SPI2		26
+#define AWIN_NDMA_CTL_DRQ_SPI3		27
+#define AWIN_NDMA_CTL_DRQ_USB_EP2	28
+#define AWIN_NDMA_CTL_DRQ_USB_EP3	29
+#define AWIN_NDMA_CTL_DRQ_USB_EP4	30
+#define AWIN_NDMA_CTL_DRQ_USB_EP5	31
+#define AWIN_NDMA_CTL_SRC_NON_SECURE	__BIT(6)
+#define AWIN_NDMA_CTL_SRC_ADDR_NOINCR	__BIT(5)
+
+#define AWIN_NDMA_BC_COUNT		__BITS(17,0)
+
+#define AWIN_DDMA_CTL_DMA_LOADING	__BIT(31)
+#define AWIN_DDMA_CTL_BUSY		__BIT(30)
+#define AWIN_DDMA_CTL_DMA_CONTIN_MODE	__BIT(29)
+#define AWIN_DDMA_CTL_DST_NON_SECURE	__BIT(28)
+#define AWIN_DDMA_CTL_DST_ADDR_MODE	__BITS(22,21)
+#define AWIN_DDMA_CTL_DMA_ADDR_LINEAR	0
+#define AWIN_DDMA_CTL_DMA_ADDR_IO	1
+#define AWIN_DDMA_CTL_DMA_ADDR_HPAGE	2
+#define AWIN_DDMA_CTL_DMA_ADDR_VPAGE	3
+#define AWIN_DDMA_CTL_DST_DRQ_TYPE	__BITS(20,16)
+#define AWIN_DDMA_CTL_DRQ_SRAM		0
+#define AWIN_DDMA_CTL_DRQ_SDRAM		1
+#define AWIN_DDMA_CTL_DRQ_NFC		3
+#define AWIN_DDMA_CTL_DRQ_USB0		4
+#define AWIN_DDMA_CTL_DRQ_EMAC_TX	6

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

2014-02-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 22:31:58 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: BCM5301X BCM56340 std.bcm53xx

Log Message:
Rearrange KERNEL_BASE_PHYS


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/evbarm/conf/BCM5301X
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/BCM56340
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/evbarm/conf/std.bcm53xx

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/BCM5301X
diff -u src/sys/arch/evbarm/conf/BCM5301X:1.16 src/sys/arch/evbarm/conf/BCM5301X:1.17
--- src/sys/arch/evbarm/conf/BCM5301X:1.16	Mon Oct 28 22:35:07 2013
+++ src/sys/arch/evbarm/conf/BCM5301X	Fri Feb 21 22:31:58 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BCM5301X,v 1.16 2013/10/28 22:35:07 matt Exp $
+#	$NetBSD: BCM5301X,v 1.17 2014/02/21 22:31:58 matt Exp $
 #
 #	BCM5301X -- Broadcom BCM5301X Eval Board Kernel
 #
@@ -28,6 +28,7 @@ options 	CPU_CORTEXA9
 options 	BCM5301X
 options 	PMAPCOUNTERS
 options 	BUSDMA_COUNTERS
+makeoptions	KERNEL_BASE_PHYS=0x8010
 
 # Architecture options
 

Index: src/sys/arch/evbarm/conf/BCM56340
diff -u src/sys/arch/evbarm/conf/BCM56340:1.1 src/sys/arch/evbarm/conf/BCM56340:1.2
--- src/sys/arch/evbarm/conf/BCM56340:1.1	Mon Oct 28 22:35:07 2013
+++ src/sys/arch/evbarm/conf/BCM56340	Fri Feb 21 22:31:58 2014
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BCM56340,v 1.1 2013/10/28 22:35:07 matt Exp $
+#	$NetBSD: BCM56340,v 1.2 2014/02/21 22:31:58 matt Exp $
 #
 #	BCM5301X -- Broadcom BCM5301X Eval Board Kernel
 #
@@ -28,6 +28,7 @@ options 	CPU_CORTEXA9
 options 	BCM563XX
 options 	PMAPCOUNTERS
 options 	BUSDMA_COUNTERS
+makeoptions	KERNEL_BASE_PHYS=0x6010
 
 # Architecture options
 
@@ -151,7 +152,7 @@ options 	DDB_COMMANDONENTER=show event
 options 	DB_MAX_LINE=INT_MAX
 #options 	KGDB
 makeoptions	DEBUG=-g	# compile full symbol table
-options 	SYMTAB_SPACE=575000
+options 	SYMTAB_SPACE=59
 
 ## USB Debugging options
 options USB_DEBUG

Index: src/sys/arch/evbarm/conf/std.bcm53xx
diff -u src/sys/arch/evbarm/conf/std.bcm53xx:1.13 src/sys/arch/evbarm/conf/std.bcm53xx:1.14
--- src/sys/arch/evbarm/conf/std.bcm53xx:1.13	Fri Nov  1 18:41:06 2013
+++ src/sys/arch/evbarm/conf/std.bcm53xx	Fri Feb 21 22:31:58 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: std.bcm53xx,v 1.13 2013/11/01 18:41:06 skrll Exp $
+#	$NetBSD: std.bcm53xx,v 1.14 2014/02/21 22:31:58 matt Exp $
 #
 # standard NetBSD/evbarm for BCM5301X options
 
@@ -19,14 +19,12 @@ options 	__HAVE_MM_MD_CACHE_ALIASING
 options 	__HAVE_FAST_SOFTINTS		# should be in types.h
 options 	__HAVE_CPU_UAREA_ALLOC_IDLELWP
 options 	__HAVE_CPU_COUNTER
-options 	__HAVE_ATOMIC64_OPS
 options 	__HAVE_PCI_CONF_HOOK
 options 	TPIDRPRW_IS_CURCPU
 options 	KERNEL_BASE_EXT=0x8000
 options 	EVBARM_BOARDTYPE=bcm53xx
 
 makeoptions	BOARDTYPE=bcm53xx
-makeoptions	KERNEL_BASE_PHYS=0x6010
 makeoptions	KERNEL_BASE_VIRT=0x8010
 makeoptions	LOADADDRESS=0x0010
 makeoptions	BOARDMKFRAG=${THISARM}/conf/mk.bcm53xx



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

2014-02-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 22:33:08 UTC 2014

Modified Files:
src/sys/arch/evbarm/conf: Makefile.evbarm.inc

Log Message:
Match *INSTALL* (so we can match *INSTALL.MP)


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/evbarm/conf/Makefile.evbarm.inc

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/Makefile.evbarm.inc
diff -u src/sys/arch/evbarm/conf/Makefile.evbarm.inc:1.27 src/sys/arch/evbarm/conf/Makefile.evbarm.inc:1.28
--- src/sys/arch/evbarm/conf/Makefile.evbarm.inc:1.27	Fri Aug  9 04:24:19 2013
+++ src/sys/arch/evbarm/conf/Makefile.evbarm.inc	Fri Feb 21 22:33:08 2014
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.evbarm.inc,v 1.27 2013/08/09 04:24:19 matt Exp $
+#	$NetBSD: Makefile.evbarm.inc,v 1.28 2014/02/21 22:33:08 matt Exp $
 
 #
 # If this is a install kernel and the ramdisk image exists in the object
 # tree, insert it into the kernel *before* we make the u-boot images.
 #
 RAMDISKNAME?=	ramdisk
-.if ${KERNEL_BUILD:T:M*INSTALL} != 
+.if ${KERNEL_BUILD:T:M*INSTALL*} != 
 RAMDISKDIR!=	cd ${NETBSDSRCDIR}/distrib/${THISARM:T}/instkernel/${RAMDISKNAME}  ${PRINTOBJDIR}
 
 .if exists(${RAMDISKDIR}/${RAMDISKNAME}.fs)



CVS commit: src/sys/arch

2014-02-21 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Fri Feb 21 22:22:48 UTC 2014

Modified Files:
src/sys/arch/arm/cortex: a9_mpsubr.S
src/sys/arch/evbarm/bcm53xx: bcm53xx_start.S
src/sys/arch/evbarm/cubie: cubie_start.S

Log Message:
Rework PIC method to be simplier.  Change be more cortex neutral.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/cortex/a9_mpsubr.S
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/bcm53xx/bcm53xx_start.S
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbarm/cubie/cubie_start.S

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/cortex/a9_mpsubr.S
diff -u src/sys/arch/arm/cortex/a9_mpsubr.S:1.12 src/sys/arch/arm/cortex/a9_mpsubr.S:1.13
--- src/sys/arch/arm/cortex/a9_mpsubr.S:1.12	Fri Jan 24 05:14:11 2014
+++ src/sys/arch/arm/cortex/a9_mpsubr.S	Fri Feb 21 22:22:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: a9_mpsubr.S,v 1.12 2014/01/24 05:14:11 matt Exp $	*/
+/*	$NetBSD: a9_mpsubr.S,v 1.13 2014/02/21 22:22:48 matt Exp $	*/
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -111,27 +111,34 @@ arm_boot_l1pt_init:
 
 #if defined(CPU_CORTEXA8)
 #undef CPU_CONTROL_SWP_ENABLE		// not present on A8
-#define	CPU_CONTROL_SWP_ENABLE		0
+#define CPU_CONTROL_SWP_ENABLE		0
 #endif
 #ifdef __ARMEL__
-#undef CPU_CONTROL_EX_BEND		// needs to clear on LE systems
-#define	CPU_CONTROL_EX_BEND		0
+#define CPU_CONTROL_EX_BEND_SET		0
+#else
+#define CPU_CONTROL_EX_BEND_SET		CPU_CONTROL_EX_BEND
 #endif
 #ifdef ARM32_DISABLE_ALIGNMENT_FAULTS
-#undef CPU_CONTROL_AFLT_ENABLE
-#define CPU_CONTROL_AFLT_ENABLE		0
+#define CPU_CONTROL_AFLT_ENABLE_CLR	CPU_CONTROL_AFLT_ENABLE
+#define CPU_CONTROL_AFLT_ENABLE_SET	0
+#else
+#deifne CPU_CONTROL_AFLT_ENABLE_CLR	0
+#define CPU_CONTROL_AFLT_ENABLE_SET	CPU_CONTROL_AFLT_ENABLE
 #endif
 
-#define	CPU_CONTROL_SET \
+#define CPU_CONTROL_SET \
 	(CPU_CONTROL_MMU_ENABLE		|	\
-	 CPU_CONTROL_AFLT_ENABLE	|	\
-	 CPU_CONTROL_EX_BEND		|	\
+	 CPU_CONTROL_AFLT_ENABLE_SET	|	\
 	 CPU_CONTROL_DC_ENABLE		|	\
 	 CPU_CONTROL_SWP_ENABLE		|	\
 	 CPU_CONTROL_BPRD_ENABLE	|	\
 	 CPU_CONTROL_IC_ENABLE		|	\
+	 CPU_CONTROL_EX_BEND_SET	|	\
 	 CPU_CONTROL_UNAL_ENABLE)
 
+#define CPU_CONTROL_CLR \
+	(CPU_CONTROL_AFLT_ENABLE_CLR)
+
 arm_cpuinit:
 	/*
 	 * In theory, because the MMU is off, we shouldn't need all of this,
@@ -140,41 +147,57 @@ arm_cpuinit:
 	 */
 	mov	ip, lr
 	mov	r10, r0
+	mov	r1, #0
+
+	mcr p15, 0, r1, c7, c5, 0	// invalidate I cache
 
-	mcr p15, 0, r10, c7, c5, 0	/* invalidate I cache */
+	mrc	p15, 0, r2, c1, c0, 0	// read SCTRL
+	movw	r1, #(CPU_CONTROL_DC_ENABLE|CPU_CONTROL_IC_ENABLE)
+	bic	r2, r2, r1		// clear I+D cache enable
 
-	mrc	p15, 0, r2, c1, c0, 0	/* */
-	bic	r2, r2, #CPU_CONTROL_DC_ENABLE	@ clear data cache enable
-	bic	r2, r2, #CPU_CONTROL_IC_ENABLE	@ clear instruction cache enable
-	mcr	p15, 0, r2, c1, c0, 0	/* */
+#ifdef __ARMEB__
+	/*
+	 * SCTRL.EE determines the endianness of translation table lookups.
+	 * So we need to make sure it's set before starting to use the new
+	 * translation tables (which are big endian).
+	 */
+	orr	r2, r2, #CPU_CONTROL_EX_BEND
+	bic	r2, r2, #CPU_CONTROL_MMU_ENABLE
+	pli	[pc, #32]		/* preload the next few cachelines */
+	pli	[pc, #64]
+	pli	[pc, #96]
+	pli	[pc, #128]
+#endif
+
+	mcr	p15, 0, r2, c1, c0, 0	/* write SCTRL */
 
 	XPUTC(#70)
-	mov	r1, #0
 	dsb/* Drain the write buffers. */
-
+1:
 	XPUTC(#71)
-	mrc	p15, 0, r2, c0, c0, 5	/* get MPIDR */
-	cmp	r2, #0
+	mrc	p15, 0, r1, c0, c0, 5	/* get MPIDR */
+	cmp	r1, #0
 	orrlt	r10, r10, #0x5b		/* MP, cachable (Normal WB) */
 	orrge	r10, r10, #0x1b		/* Non-MP, cacheable, normal WB */
 	mcr	p15, 0, r10, c2, c0, 0	/* Set Translation Table Base */
 
-	XPUTC(#49)
+	XPUTC(#72)
+	mov	r1, #0
 	mcr	p15, 0, r1, c2, c0, 2	/* Set Translation Table Control */
 
-	XPUTC(#72)
+	XPUTC(#73)
 	mov	r1, #0
 	mcr	p15, 0, r1, c8, c7, 0	/* Invalidate TLBs */
 
 	/* Set the Domain Access register.  Very important! */
-	XPUTC(#73)
+	XPUTC(#74)
 	mov r1, #((DOMAIN_CLIENT  (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
 	mcr	p15, 0, r1, c3, c0, 0
 
 	/*
 	 * Enable the MMU, etc.
 	 */
-	XPUTC(#74)
+	XPUTC(#75)
 	mrc	p15, 0, r0, c1, c0, 0
 
 	movw	r3, #:lower16:CPU_CONTROL_SET
@@ -182,19 +205,22 @@ arm_cpuinit:
 	movt	r3, #:upper16:CPU_CONTROL_SET
 #endif
 	orr	r0, r0, r3
+#if defined(CPU_CONTROL_CLR)  (CPU_CONTROL_CLR != 0)
+	bic	r0, r0, #CPU_CONTROL_CLR
+#endif
+	pli	1f
 	
 	dsb
-	.align 5
 	@ turn mmu on!
-	mov	r0, r0
-	mcr	p15, 0, r0, c1, c0, 0
+	mov	r0, r0			/* fetch instruction cacheline */
+1:	mcr	p15, 0, r0, c1, c0, 0
 
 	/*
 	 * Ensure that the coprocessor has finished turning on the MMU.
 	 */
 	mrc	p15, 0, r0, c0, c0, 0	/* Read an arbitrary value. */
 	mov	r0, r0			/* Stall until read completes. */
-	XPUTC(#76)
+1:	XPUTC(#76)
 
 	bx	ip			/* return */
 
@@ -207,14 +233,17 @@ arm_cpuinit:

CVS commit: src/sys/kern

2014-02-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Feb 22 07:53:16 UTC 2014

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

Log Message:
Simplify error path.

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/exec_elf.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/exec_elf.c
diff -u src/sys/kern/exec_elf.c:1.60 src/sys/kern/exec_elf.c:1.61
--- src/sys/kern/exec_elf.c:1.60	Fri Feb 21 07:47:02 2014
+++ src/sys/kern/exec_elf.c	Sat Feb 22 07:53:16 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.c,v 1.60 2014/02/21 07:47:02 maxv Exp $	*/
+/*	$NetBSD: exec_elf.c,v 1.61 2014/02/22 07:53:16 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.60 2014/02/21 07:47:02 maxv Exp $);
+__KERNEL_RCSID(1, $NetBSD: exec_elf.c,v 1.61 2014/02/22 07:53:16 maxv Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_pax.h
@@ -921,9 +921,7 @@ netbsd_elf_signature(struct lwp *l, stru
 
 		switch (np-n_type) {
 		case ELF_NOTE_TYPE_NETBSD_TAG:
-			/*
-			 * It is us
-			 */
+			/* It is us */
 			if (np-n_namesz == ELF_NOTE_NETBSD_NAMESZ 
 			np-n_descsz == ELF_NOTE_NETBSD_DESCSZ 
 			memcmp(ndata, ELF_NOTE_NETBSD_NAME,
@@ -934,52 +932,32 @@ netbsd_elf_signature(struct lwp *l, stru
 isnetbsd = 1;
 break;
 			}
+
 			/*
-			 * Ignore SuSE tags
+			 * Ignore SuSE tags; SuSE's n_type is the same as NetBSD's
+			 * one.
 			 */
 			if (np-n_namesz == ELF_NOTE_SUSE_NAMESZ 
 			memcmp(ndata, ELF_NOTE_SUSE_NAME,
 			ELF_NOTE_SUSE_NAMESZ) == 0)
 break;
-			/*
-			 * Dunno, warn for diagnostic
-			 */
+
 			goto bad;
 
 		case ELF_NOTE_TYPE_PAX_TAG:
-			if (np-n_namesz != ELF_NOTE_PAX_NAMESZ ||
-			np-n_descsz != ELF_NOTE_PAX_DESCSZ ||
+			if (np-n_namesz == ELF_NOTE_PAX_NAMESZ 
+			np-n_descsz == ELF_NOTE_PAX_DESCSZ 
 			memcmp(ndata, ELF_NOTE_PAX_NAME,
-			ELF_NOTE_PAX_NAMESZ)) {
-bad:
-#ifdef DIAGNOSTIC
-			{
-/*
- * Ignore GNU tags
- */
-if (np-n_namesz == ELF_NOTE_GNU_NAMESZ 
-memcmp(ndata, ELF_NOTE_GNU_NAME,
-ELF_NOTE_GNU_NAMESZ) == 0)
-break;
-
-int ns = MIN(np-n_namesz, shp-sh_size - sizeof(*np));
-printf(%s: Unknown elf note type %d: 
-[namesz=%d, descsz=%d name=%*.*s]\n,
-epp-ep_kname, np-n_type, np-n_namesz,
-np-n_descsz, ns, ns, ndata);
-			}
-#endif
-continue;
+			ELF_NOTE_PAX_NAMESZ) == 0) {
+memcpy(epp-ep_pax_flags,
+ndata + roundup(ELF_NOTE_PAX_NAMESZ, 4),
+sizeof(epp-ep_pax_flags));
+break;
 			}
-			(void)memcpy(epp-ep_pax_flags,
-			ndata + roundup(ELF_NOTE_PAX_NAMESZ, 4),
-			sizeof(epp-ep_pax_flags));
-			break;
+			goto bad;
 
 		case ELF_NOTE_TYPE_MARCH_TAG:
-			/*
-			 * Copy the machine arch into the package.
-			 */
+			/* Copy the machine arch into the package. */
 			if (np-n_namesz == ELF_NOTE_MARCH_NAMESZ
 			 memcmp(ndata, ELF_NOTE_MARCH_NAME,
 ELF_NOTE_MARCH_NAMESZ) == 0) {
@@ -988,10 +966,10 @@ bad:
 sizeof(epp-ep_machine_arch));
 break;
 			}
+			goto bad;
+
 		case ELF_NOTE_TYPE_MCMODEL_TAG:
-			/*
-			 * arch specific check for code model
-			 */
+			/* arch specific check for code model */
 #ifdef ELF_MD_MCMODEL_CHECK
 			if (np-n_namesz == ELF_NOTE_MCMODEL_NAMESZ
 			 memcmp(ndata, ELF_NOTE_MCMODEL_NAME,
@@ -1001,6 +979,7 @@ bad:
 np-n_descsz);
 break;
 			}
+			goto bad;
 #endif
 			break;
 
@@ -1008,9 +987,19 @@ bad:
 			break;
 
 		default:
+bad:
 #ifdef DIAGNOSTIC
-			printf(%s: unknown note type %d\n, epp-ep_kname,
-			np-n_type);
+			/* Ignore GNU tags */
+			if (np-n_namesz == ELF_NOTE_GNU_NAMESZ 
+			memcmp(ndata, ELF_NOTE_GNU_NAME,
+			ELF_NOTE_GNU_NAMESZ) == 0)
+			break;
+
+			int ns = MIN(np-n_namesz, shp-sh_size - sizeof(*np));
+			printf(%s: Unknown elf note type %d: 
+			[namesz=%d, descsz=%d name=%*.*s]\n,
+			epp-ep_kname, np-n_type, np-n_namesz,
+			np-n_descsz, ns, ns, ndata);
 #endif
 			break;
 		}