CVS commit: src/sys/arch/mips/mips

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:31:34 UTC 2011

Modified Files:
src/sys/arch/mips/mips: pmap.c

Log Message:
Make sure we do proper locking if LOCKDEBUG is defined


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 src/sys/arch/mips/mips/pmap.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/mips/mips/pmap.c
diff -u src/sys/arch/mips/mips/pmap.c:1.197 src/sys/arch/mips/mips/pmap.c:1.198
--- src/sys/arch/mips/mips/pmap.c:1.197	Wed Mar  2 13:26:41 2011
+++ src/sys/arch/mips/mips/pmap.c	Tue Mar 15 07:31:33 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.197 2011/03/02 13:26:41 tsutsui Exp $	*/
+/*	$NetBSD: pmap.c,v 1.198 2011/03/15 07:31:33 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.197 2011/03/02 13:26:41 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.198 2011/03/15 07:31:33 matt Exp $);
 
 /*
  *	Manages physical address maps.
@@ -2234,7 +2234,7 @@
 			pmap, va);
 #endif
 		if (__predict_true(apv == NULL)) {
-#if defined(MULTIPROCESSOR) || !defined(_LP64) || defined(PMAP_POOLPAGE_DEBUG)
+#if defined(MULTIPROCESSOR) || !defined(_LP64) || defined(PMAP_POOLPAGE_DEBUG) || defined(LOCKDEBUG)
 			/*
 			 * To allocate a PV, we have to release the PVLIST lock
 			 * so get the page generation.  We allocate the PV, and
@@ -2245,7 +2245,7 @@
 			apv = (pv_entry_t)pmap_pv_alloc();
 			if (apv == NULL)
 panic(pmap_enter_pv: pmap_pv_alloc() failed);
-#if defined(MULTIPROCESSOR) || !defined(_LP64) || defined(PMAP_POOLPAGE_DEBUG)
+#if defined(MULTIPROCESSOR) || !defined(_LP64) || defined(PMAP_POOLPAGE_DEBUG) || defined(LOCKDEBUG)
 #ifdef MULTIPROCESSOR
 			/*
 			 * If the generation has changed, then someone else



CVS commit: src/sys/arch/mips/mips

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:32:53 UTC 2011

Modified Files:
src/sys/arch/mips/mips: pmap_tlb.c

Log Message:
Use KDASSERT and kpreempt_disable/enable in pmap_tlb_asid_check


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/mips/pmap_tlb.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/mips/mips/pmap_tlb.c
diff -u src/sys/arch/mips/mips/pmap_tlb.c:1.2 src/sys/arch/mips/mips/pmap_tlb.c:1.3
--- src/sys/arch/mips/mips/pmap_tlb.c:1.2	Sun Feb 20 07:45:48 2011
+++ src/sys/arch/mips/mips/pmap_tlb.c	Tue Mar 15 07:32:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_tlb.c,v 1.2 2011/02/20 07:45:48 matt Exp $	*/
+/*	$NetBSD: pmap_tlb.c,v 1.3 2011/03/15 07:32:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 
-__KERNEL_RCSID(0, $NetBSD: pmap_tlb.c,v 1.2 2011/02/20 07:45:48 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_tlb.c,v 1.3 2011/03/15 07:32:53 matt Exp $);
 
 /*
  * Manages address spaces in a TLB.
@@ -1034,11 +1034,13 @@
 pmap_tlb_asid_check(void)
 {
 #ifdef DEBUG
+	kpreempt_disable();
 	uint32_t tlb_hi;
 	__asm(mfc0 %0,$%1 : =r(tlb_hi) : n(MIPS_COP_0_TLB_HI));
 	uint32_t asid = (tlb_hi  MIPS_TLB_PID)  MIPS_TLB_PID_SHIFT;
-	KASSERTMSG(asid == curcpu()-ci_pmap_asid_cur,
+	KDASSERTMSG(asid == curcpu()-ci_pmap_asid_cur,
 	   (tlb_hi (%#x) asid (%#x) != current asid (%#x),
 	tlb_hi, asid, curcpu()-ci_pmap_asid_cur));
+	kpreempt_enable();
 #endif
 }



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

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:33:36 UTC 2011

Modified Files:
src/sys/arch/mips/include: mcontext.h types.h

Log Message:
Add MIPS TLS support.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/mips/include/mcontext.h
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mips/include/types.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/mips/include/mcontext.h
diff -u src/sys/arch/mips/include/mcontext.h:1.16 src/sys/arch/mips/include/mcontext.h:1.17
--- src/sys/arch/mips/include/mcontext.h:1.16	Fri Feb 25 14:07:13 2011
+++ src/sys/arch/mips/include/mcontext.h	Tue Mar 15 07:33:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mcontext.h,v 1.16 2011/02/25 14:07:13 joerg Exp $	*/
+/*	$NetBSD: mcontext.h,v 1.17 2011/03/15 07:33:36 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -186,16 +186,42 @@
 #error O64 is not supported
 #endif
 
-#ifndef __ASSEMBLER__
-static __inline void *
-__lwp_getprivate_fast(void)
+#if defined(_LIBC_SOURCE) || defined(_RTLD_SOURCE) || defined(__LIBPTHREAD_SOURCE__)
+#define	TLS_TP_OFFSET	0x7000
+#define	TLS_DTV_OFFSET	0x8000
+
+#include sys/tls.h
+
+__CTASSERT(TLS_TP_OFFSET + sizeof(struct tls_tcb)  0x8000);
+__CTASSERT(TLS_TP_OFFSET % sizeof(struct tls_tcb) == 0);
+
+static __inline struct tls_tcb *
+__lwp_gettcb_fast(void)
 {
-	register void *__tcb;
+	struct tls_tcb *__tcb;
 
-	__asm volatile(.set push; .set mips32r2; 
-		rdhwr %0, $29; .set pop : =v(__tcb));
+	/*
+	 * Only emit a rdhwr $3, $29 so the kernel can quickly emulate it.
+	 */
+	__asm __volatile(.set push; .set mips32r2; 
+		rdhwr $3,$29; .set pop;
+#ifdef _LP64
+		daddiu %[__tcb],$3,%1
+#else
+		addiu %[__tcb],$3,%1
+#endif
+	: [__tcb]=r(__tcb)
+	: [__offset]n(-(TLS_TP_OFFSET + sizeof(*__tcb)))
+	: v1);
 	return __tcb;
 }
+
+static inline void
+__lwp_settcb(struct tls_tcb *__tcb)
+{
+	__tcb += TLS_TP_OFFSET / sizeof(*__tcb) + 1;
+	_lwp_setprivate(__tcb);
+}
 #endif
 
 #endif	/* _MIPS_MCONTEXT_H_ */

Index: src/sys/arch/mips/include/types.h
diff -u src/sys/arch/mips/include/types.h:1.49 src/sys/arch/mips/include/types.h:1.50
--- src/sys/arch/mips/include/types.h:1.49	Thu Feb 24 04:28:47 2011
+++ src/sys/arch/mips/include/types.h	Tue Mar 15 07:33:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.49 2011/02/24 04:28:47 joerg Exp $	*/
+/*	$NetBSD: types.h,v 1.50 2011/03/15 07:33:36 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -53,20 +53,20 @@
 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
 typedef __uint64_t	paddr_t;
 typedef __uint64_t	psize_t;
-#define PRIxPADDR	PRIx64
-#define PRIxPSIZE	PRIx64
-#define PRIdPSIZE	PRId64
+#define	PRIxPADDR	PRIx64
+#define	PRIxPSIZE	PRIx64
+#define	PRIdPSIZE	PRId64
 #else
 typedef __uint32_t	paddr_t;
 typedef __uint32_t	psize_t;
-#define PRIxPADDR	PRIx32
-#define PRIxPSIZE	PRIx32
-#define PRIdPSIZE	PRId32
+#define	PRIxPADDR	PRIx32
+#define	PRIxPSIZE	PRIx32
+#define	PRIdPSIZE	PRId32
 #endif
 #ifdef _LP64
 typedef __uint64_t	vaddr_t;
 typedef __uint64_t	vsize_t;
-#define PRIxVADDR	PRIx64
+#define	PRIxVADDR	PRIx64
 #define PRIxVSIZE	PRIx64
 #define PRIdVSIZE	PRId64
 #else
@@ -142,15 +142,17 @@
 #define	__HAVE_AST_PERPROC
 #define	__HAVE_SYSCALL_INTERN
 #define	__HAVE_PROCESS_XFPREGS
+#define	__HAVE_CPU_LWP_SETPRIVATE
 #define	__HAVE_CPU_DATA_FIRST
-#define __HAVE_MD_CPU_OFFLINE
+#define	__HAVE_MD_CPU_OFFLINE
 #ifdef MIPS3_PLUS	/* XXX bogus! */
 #define	__HAVE_CPU_COUNTER
 #endif
-#define __HAVE_CPU_UAREA_ROUTINES
-#if 0
-#define	__HAVE___LWP_GETPRIVATE_FAST
-#endif
+#define	__HAVE_CPU_UAREA_ROUTINES
+#define	__HAVE_COMMON___TLS_GET_ADDR
+#define	__HAVE___LWP_GETTCB_FAST
+#define	__HAVE___LWP_SETTCB
+#define	__HAVE_TLS_VARIANT_I
 
 #if !defined(__mips_o32)
 #define	__HAVE_ATOMIC64_OPS
@@ -159,7 +161,7 @@
 #if defined(_KERNEL)
 #define	__HAVE_RAS
 #if defined(_LP64)
-#define __HAVE_CPU_VMSPACE_EXEC
+#define	__HAVE_CPU_VMSPACE_EXEC
 #endif
 #endif /* _KERNEL */
 



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

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:33:55 UTC 2011

Modified Files:
src/sys/arch/mips/include: mips_opcode.h

Log Message:
Remove redundant lines.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/mips/include/mips_opcode.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/mips/include/mips_opcode.h
diff -u src/sys/arch/mips/include/mips_opcode.h:1.15 src/sys/arch/mips/include/mips_opcode.h:1.16
--- src/sys/arch/mips/include/mips_opcode.h:1.15	Sun Feb 20 07:45:47 2011
+++ src/sys/arch/mips/include/mips_opcode.h	Tue Mar 15 07:33:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_opcode.h,v 1.15 2011/02/20 07:45:47 matt Exp $	*/
+/*	$NetBSD: mips_opcode.h,v 1.16 2011/03/15 07:33:54 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -268,12 +268,6 @@
  */
 #define OP_RDHWR	073		/* MIPS32/64 r2 */
 
-
-/*
- * Values for the 'func' field when 'op' == OP_SPECIAL3.
- */
-#define OP_RDHWR	073		/* MIPS32r2 */
-
 /*
  * Values for the 'func' field when 'op' == OP_BCOND.
  */



CVS commit: src/lib/libc/arch/mips/gen

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:40:18 UTC 2011

Modified Files:
src/lib/libc/arch/mips/gen: Makefile.inc _lwp.c

Log Message:
Properly support the MIPS TLS ABI.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/lib/libc/arch/mips/gen/Makefile.inc
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/mips/gen/_lwp.c

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

Modified files:

Index: src/lib/libc/arch/mips/gen/Makefile.inc
diff -u src/lib/libc/arch/mips/gen/Makefile.inc:1.32 src/lib/libc/arch/mips/gen/Makefile.inc:1.33
--- src/lib/libc/arch/mips/gen/Makefile.inc:1.32	Mon Jan 17 23:53:03 2011
+++ src/lib/libc/arch/mips/gen/Makefile.inc	Tue Mar 15 07:40:18 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.32 2011/01/17 23:53:03 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.33 2011/03/15 07:40:18 matt Exp $
 
 .if ${MKSOFTFLOAT} == no
 SRCS+=	fabs.S ldexp.S modf.S
@@ -32,6 +32,8 @@
 # mips abi builtin extensions (used by GCC for lexical-closure trampoline)
 SRCS+=	cacheflush.c
 
+CPPFLAGS._lwp.c	+= -D_LIBC_SOURCE
+
 LSRCS.mips.gen=	Lint__setjmp.c Lint_bswap16.c Lint_bswap32.c Lint_swapcontext.c
 LSRCS+=		${LSRCS.mips.gen}
 DPSRCS+=	${LSRCS.mips.gen}

Index: src/lib/libc/arch/mips/gen/_lwp.c
diff -u src/lib/libc/arch/mips/gen/_lwp.c:1.6 src/lib/libc/arch/mips/gen/_lwp.c:1.7
--- src/lib/libc/arch/mips/gen/_lwp.c:1.6	Thu Feb 24 04:28:42 2011
+++ src/lib/libc/arch/mips/gen/_lwp.c	Tue Mar 15 07:40:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: _lwp.c,v 1.6 2011/02/24 04:28:42 joerg Exp $	*/
+/*	$NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: _lwp.c,v 1.6 2011/02/24 04:28:42 joerg Exp $);
+__RCSID($NetBSD: _lwp.c,v 1.7 2011/03/15 07:40:18 matt Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #include namespace.h
@@ -42,8 +42,9 @@
 
 #define CALLFRAME_SIZ	24
 
-void _lwp_makecontext(ucontext_t *u, void (*start)(void *),
-	void *arg, void *private, caddr_t stack_base, size_t stack_size)
+void
+_lwp_makecontext(ucontext_t *u, void (*start)(void *),
+	void *arg, void *tcb, caddr_t stack_base, size_t stack_size)
 {
 	caddr_t sp;
 	__greg_t *gr;
@@ -56,11 +57,12 @@
 	u-uc_stack.ss_size = stack_size;
 	sp = stack_base + stack_size - CALLFRAME_SIZ;
 
-	gr[_REG_EPC] = (unsigned long) start;
-	gr[_REG_T9] = (unsigned long) start; /* required for .abicalls */
-	gr[_REG_RA] = (unsigned long) _lwp_exit;
-	gr[_REG_A0] = (unsigned long) arg;
-	gr[_REG_SP] = (unsigned long) sp;
-	u-uc_mcontext._mc_tlsbase = (uintptr_t)private;
+	gr[_REG_EPC] = (uintptr_t) start;
+	gr[_REG_T9] = (uintptr_t) start; /* required for .abicalls */
+	gr[_REG_RA] = (uintptr_t) _lwp_exit;
+	gr[_REG_A0] = (uintptr_t) arg;
+	gr[_REG_SP] = (uintptr_t) sp;
+	u-uc_mcontext._mc_tlsbase =
+	(uintptr_t)tcb + TLS_TP_OFFSET + sizeof(struct tls_tcb);
 	u-uc_flags |= _UC_TLSBASE;
 }



CVS commit: src/libexec/ld.elf_so/arch/mips

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:40:53 UTC 2011

Modified Files:
src/libexec/ld.elf_so/arch/mips: mips_reloc.c

Log Message:
Add support for the MIPS TLS reloc types in shared libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/libexec/ld.elf_so/arch/mips/mips_reloc.c

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

Modified files:

Index: src/libexec/ld.elf_so/arch/mips/mips_reloc.c
diff -u src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.60 src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.61
--- src/libexec/ld.elf_so/arch/mips/mips_reloc.c:1.60	Fri Sep 24 15:20:52 2010
+++ src/libexec/ld.elf_so/arch/mips/mips_reloc.c	Tue Mar 15 07:40:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_reloc.c,v 1.60 2010/09/24 15:20:52 matt Exp $	*/
+/*	$NetBSD: mips_reloc.c,v 1.61 2011/03/15 07:40:52 matt Exp $	*/
 
 /*
  * Copyright 1997 Michael L. Hitch mhi...@montana.edu
@@ -30,11 +30,12 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: mips_reloc.c,v 1.60 2010/09/24 15:20:52 matt Exp $);
+__RCSID($NetBSD: mips_reloc.c,v 1.61 2011/03/15 07:40:52 matt Exp $);
 #endif /* not lint */
 
 #include sys/types.h
 #include sys/endian.h
+#include sys/tls.h
 
 #include stdlib.h
 #include string.h
@@ -375,6 +376,79 @@
 			break;
 		}
 
+#if ELFSIZE == 64
+		case R_TYPE(TLS_DTPMOD64):
+#else
+		case R_TYPE(TLS_DTPMOD32): 
+#endif
+		{
+			Elf_Addr old = load_ptr(where, ELFSIZE / 8);
+			Elf_Addr val = old;
+
+			def = _rtld_find_symdef(r_symndx, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			val += (Elf_Addr)defobj-tlsindex;
+
+			store_ptr(where, val, ELFSIZE / 8);
+			rdbg((DTPMOD %s in %s -- %p in %s,
+			obj-strtab + obj-symtab[r_symndx].st_name,
+			obj-path, (void *)old, defobj-path));
+			break;
+		}
+
+#if ELFSIZE == 64
+		case R_TYPE(TLS_DTPREL64):
+#else
+		case R_TYPE(TLS_DTPREL32):
+#endif
+		{
+			Elf_Addr old = load_ptr(where, ELFSIZE / 8);
+			Elf_Addr val = old;
+
+			def = _rtld_find_symdef(r_symndx, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			if (!defobj-tls_done  _rtld_tls_offset_allocate(obj))
+return -1;
+
+			val += (Elf_Addr)def-st_value - TLS_DTV_OFFSET;
+			store_ptr(where, val, ELFSIZE / 8);
+
+			rdbg((DTPREL %s in %s -- %p in %s,
+			obj-strtab + obj-symtab[r_symndx].st_name,
+			obj-path, (void *)old, defobj-path));
+			break;
+		}
+
+#if ELFSIZE == 64
+		case R_TYPE(TLS_TPREL64):
+#else
+		case R_TYPE(TLS_TPREL32):
+#endif
+		{
+			Elf_Addr old = load_ptr(where, ELFSIZE / 8);
+			Elf_Addr val = old;
+
+			def = _rtld_find_symdef(r_symndx, obj, defobj, false);
+			if (def == NULL)
+return -1;
+
+			if (!defobj-tls_done  _rtld_tls_offset_allocate(obj))
+return -1;
+
+			val += (Elf_Addr)(def-st_value + defobj-tlsoffset
+			- TLS_TP_OFFSET);
+			store_ptr(where, val, ELFSIZE / 8);
+
+			rdbg((TPREL %s in %s -- %p in %s,
+			obj-strtab + obj-symtab[r_symndx].st_name,
+			obj-path, (void *)*where, defobj-path));
+			break;
+		}
+
 		default:
 			rdbg((sym = %lu, type = %lu, offset = %p, 
 			contents = %p, symbol = %s,



CVS commit: src/doc

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Mar 15 07:42:36 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
Note recent MIPS changes


To generate a diff of this commit:
cvs rdiff -u -r1.1520 -r1.1521 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.1520 src/doc/CHANGES:1.1521
--- src/doc/CHANGES:1.1520	Sat Mar 12 08:04:17 2011
+++ src/doc/CHANGES	Tue Mar 15 07:42:36 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1520 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1521 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -886,3 +886,5 @@
 		[bouyer 20110306]
 	tmux(1): First import of tmux (version 1.4).  [jmmv 20110310]
 	powerpc: add TLS (thread local storage) support.  [matt 20110311]
+	mips: add TLS (thread local storage) support.  [matt 20110314]
+	mips: add MIPS32R2 and MIPS64R2 support.  [matt 20110314]



CVS commit: src/lib/libc/gen

2011-03-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 15 08:33:35 UTC 2011

Modified Files:
src/lib/libc/gen: commaize_number.3

Log Message:
Shorten Nd by putting the comment there in a paragraph in the body.
Use more markup. Sort SEE ALSO. Fix typo. Capitalize NetBSD like
we all love it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/commaize_number.3

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

Modified files:

Index: src/lib/libc/gen/commaize_number.3
diff -u src/lib/libc/gen/commaize_number.3:1.1 src/lib/libc/gen/commaize_number.3:1.2
--- src/lib/libc/gen/commaize_number.3:1.1	Tue Mar 15 03:47:04 2011
+++ src/lib/libc/gen/commaize_number.3	Tue Mar 15 08:33:35 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: commaize_number.3,v 1.1 2011/03/15 03:47:04 erh Exp $
+.\	$NetBSD: commaize_number.3,v 1.2 2011/03/15 08:33:35 wiz Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -32,7 +32,7 @@
 .Os
 .Sh NAME
 .Nm commaize_number
-.Nd format a number into a human readable form by adding commas (actually, the locale specific thousands separator)
+.Nd format a number into a human readable form by grouping the digits
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft int
@@ -40,23 +40,28 @@
 .Sh DESCRIPTION
 The
 .Fn commaize_number
-function formats the signed 64 bit quantity given in
+function formats the signed 64-bit quantity given in
 .Fa number
 into
 .Fa buffer ,
-which 
-must be at least
+which must be at least
 .Fa len
 bytes long.
 .Pp
 If the formatted number would be too long to fit into
 .Fa buffer ,
 then an error is returned.
+.Pp
+The function name is slightly mistaken,
+since actually, the locale specific thousands separator is used, which
+might not be comma.
 .Sh RETURN VALUES
 .Fn commaize_number
 returns the number of characters stored in
 .Fa buffer
-(excluding the terminating NUL) upon success, or \-1 upon failure with 
+(excluding the terminating
+.Dv NUL )
+upon success, or \-1 upon failure with
 .Va errno
 set to indicate the error.
 .Sh ERRORS
@@ -66,18 +71,19 @@
 if:
 .Bl -tag -width Er
 .It Bq Er ENOMEM
-The formatted number, including commas and terminating NUL, is too long to fit in
+The formatted number, including commas and terminating
+.Dv NUL ,
+is too long to fit in
 .Fa len
 bytes.
 .El
 .Sh SEE ALSO
-.Xr humanize_number 9 ,
+.Xr ls 1 ,
 .Xr setlocale 3 ,
-.Xr ls 1 .
+.Xr humanize_number 9
 .Sh HISTORY
-.Fn humanize_number
+.Fn commaize_number
 first appeared in
 .Nx 6.0 .
-.Pp
 .Sh AUTHORS
-.An Eric Haszlakiewicz Aq e...@netbsd.org
+.An Eric Haszlakiewicz Aq e...@netbsd.org



CVS commit: src/bin/ls

2011-03-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 15 08:36:02 UTC 2011

Modified Files:
src/bin/ls: ls.1

Log Message:
Remove trailing whitespace. Add -M to usage.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/bin/ls/ls.1

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

Modified files:

Index: src/bin/ls/ls.1
diff -u src/bin/ls/ls.1:1.67 src/bin/ls/ls.1:1.68
--- src/bin/ls/ls.1:1.67	Tue Mar 15 03:52:37 2011
+++ src/bin/ls/ls.1	Tue Mar 15 08:36:01 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: ls.1,v 1.67 2011/03/15 03:52:37 erh Exp $
+.\	$NetBSD: ls.1,v 1.68 2011/03/15 08:36:01 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1991, 1993, 1994
 .\	The Regents of the University of California.  All rights reserved.
@@ -40,7 +40,7 @@
 .Nd list directory contents
 .Sh SYNOPSIS
 .Nm
-.Op Fl AaBbCcdFfghikLlmnopqRrSsTtuWwx1
+.Op Fl AaBbCcdFfghikLlMmnopqRrSsTtuWwx1
 .Op Ar
 .Sh DESCRIPTION
 For each operand that names a
@@ -144,7 +144,7 @@
 .Fl h
 flags overrides the previous flag.
 See also
-.Fl h 
+.Fl h
 and
 .Fl M .
 .It Fl L
@@ -165,10 +165,10 @@
 .Fl l
 and
 .Fl s
-options, causing the sizes or block counts reported to be separated with 
+options, causing the sizes or block counts reported to be separated with
 commas (or a locale appropriate separator) resulting in a more readable
 output.
-Overrides 
+Overrides
 .Fl h .
 Does not override
 .Fl k .



CVS commit: src/bin/ls

2011-03-15 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 15 08:36:16 UTC 2011

Modified Files:
src/bin/ls: util.c

Log Message:
Add -M to usage.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/bin/ls/util.c

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

Modified files:

Index: src/bin/ls/util.c
diff -u src/bin/ls/util.c:1.32 src/bin/ls/util.c:1.33
--- src/bin/ls/util.c:1.32	Wed Jun  6 13:21:28 2007
+++ src/bin/ls/util.c	Tue Mar 15 08:36:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.32 2007/06/06 13:21:28 soda Exp $	*/
+/*	$NetBSD: util.c,v 1.33 2011/03/15 08:36:16 wiz Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)util.c	8.5 (Berkeley) 4/28/95;
 #else
-__RCSID($NetBSD: util.c,v 1.32 2007/06/06 13:21:28 soda Exp $);
+__RCSID($NetBSD: util.c,v 1.33 2011/03/15 08:36:16 wiz Exp $);
 #endif
 #endif /* not lint */
 
@@ -172,7 +172,7 @@
 {
 
 	(void)fprintf(stderr,
-	usage: %s [-AaBbCcdFfghikLlmnopqRrSsTtuWwx1] [file ...]\n,
+	usage: %s [-AaBbCcdFfghikLlMmnopqRrSsTtuWwx1] [file ...]\n,
 	getprogname());
 	exit(EXIT_FAILURE);
 	/* NOTREACHED */



CVS commit: src/lib/librumpclient

2011-03-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 15 09:35:05 UTC 2011

Modified Files:
src/lib/librumpclient: rumpclient.c

Log Message:
don't spam connection errors to stderr by default


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/lib/librumpclient/rumpclient.c

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

Modified files:

Index: src/lib/librumpclient/rumpclient.c
diff -u src/lib/librumpclient/rumpclient.c:1.43 src/lib/librumpclient/rumpclient.c:1.44
--- src/lib/librumpclient/rumpclient.c:1.43	Wed Mar  9 15:09:21 2011
+++ src/lib/librumpclient/rumpclient.c	Tue Mar 15 09:35:05 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: rumpclient.c,v 1.43 2011/03/09 15:09:21 pooka Exp $	*/
+/*  $NetBSD: rumpclient.c,v 1.44 2011/03/15 09:35:05 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: rumpclient.c,v 1.43 2011/03/09 15:09:21 pooka Exp $);
+__RCSID($NetBSD: rumpclient.c,v 1.44 2011/03/15 09:35:05 pooka Exp $);
 
 #include sys/param.h
 #include sys/event.h
@@ -85,7 +85,7 @@
 static int kq = -1;
 static sigset_t fullset;
 
-static int doconnect(bool);
+static int doconnect(void);
 static int handshake_req(struct spclient *, int, void *, int, bool);
 
 /*
@@ -94,6 +94,9 @@
  */
 static time_t retrytimo = 0;
 
+/* always defined to nothingness for now */
+#define ERRLOG(a)
+
 static int
 send_with_recon(struct spclient *spc, struct iovec *iov, size_t iovlen)
 {
@@ -152,7 +155,7 @@
 			}
 			reconretries++;
 
-			if ((rv = doconnect(false)) != 0)
+			if ((rv = doconnect()) != 0)
 continue;
 			if ((rv = handshake_req(clispc, HANDSHAKE_GUEST,
 			NULL, 0, true)) != 0)
@@ -605,7 +608,7 @@
 }
 
 static int
-doconnect(bool noisy)
+doconnect(void)
 {
 	struct respwait rw;
 	struct rsp_hdr rhdr;
@@ -660,34 +663,23 @@
 	while (host_connect(s, serv_sa, (socklen_t)serv_sa-sa_len) == -1) {
 		if (errno == EINTR)
 			continue;
-		error = errno;
-		if (noisy)
-			fprintf(stderr, rump_sp: client connect failed: %s\n,
-			strerror(errno));
-		errno = error;
+		ERRLOG((rump_sp: client connect failed: %s\n,
+		strerror(errno)));
 		return -1;
 	}
 
 	if ((error = parsetab[ptab_idx].connhook(s)) != 0) {
-		error = errno;
-		if (noisy)
-			fprintf(stderr, rump_sp: connect hook failed\n);
-		errno = error;
+		ERRLOG((rump_sp: connect hook failed\n));
 		return -1;
 	}
 
 	if ((n = host_read(s, banner, sizeof(banner)-1))  0) {
-		error = errno;
-		if (noisy)
-			fprintf(stderr, rump_sp: failed to read banner\n);
-		errno = error;
+		ERRLOG((rump_sp: failed to read banner\n));
 		return -1;
 	}
 
 	if (banner[n-1] != '\n') {
-		if (noisy)
-			fprintf(stderr, rump_sp: invalid banner\n);
-		errno = EINVAL;
+		ERRLOG((rump_sp: invalid banner\n));
 		return -1;
 	}
 	banner[n] = '\0';
@@ -695,10 +687,7 @@
 
 	flags = host_fcntl(s, F_GETFL, 0);
 	if (host_fcntl(s, F_SETFL, flags | O_NONBLOCK) == -1) {
-		if (noisy)
-			fprintf(stderr, rump_sp: socket fd NONBLOCK: %s\n,
-			strerror(errno));
-		errno = EINVAL;
+		ERRLOG((rump_sp: socket fd NONBLOCK: %s\n, strerror(errno)));
 		return -1;
 	}
 	clispc.spc_fd = s;
@@ -707,10 +696,7 @@
 
 	/* setup kqueue, we want all signals and the fd */
 	if ((kq = dupgood(host_kqueue(), 0)) == -1) {
-		error = errno;
-		if (noisy)
-			fprintf(stderr, rump_sp: cannot setup kqueue);
-		errno = error;
+		ERRLOG((rump_sp: cannot setup kqueue));
 		return -1;
 	}
 
@@ -720,10 +706,7 @@
 	EV_SET(kev[NSIG], clispc.spc_fd,
 	EVFILT_READ, EV_ADD|EV_ENABLE, 0, 0, 0);
 	if (host_kevent(kq, kev, NSIG+1, NULL, 0, NULL) == -1) {
-		error = errno;
-		if (noisy)
-			fprintf(stderr, rump_sp: kevent() failed);
-		errno = error;
+		ERRLOG((rump_sp: kevent() failed));
 		return -1;
 	}
 
@@ -832,7 +815,7 @@
 		unsetenv(RUMPCLIENT__EXECFD);
 		hstype = HANDSHAKE_EXEC;
 	} else {
-		if (doconnect(true) == -1)
+		if (doconnect() == -1)
 			goto out;
 		hstype = HANDSHAKE_GUEST;
 	}
@@ -905,7 +888,7 @@
 
 	if (doinit() == -1)
 		return -1;
-	if (doconnect(false) == -1)
+	if (doconnect() == -1)
 		return -1;
 
 	error = handshake_req(clispc, HANDSHAKE_FORK, rpf-fork_auth,



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar 15 11:21:04 UTC 2011

Update of /cvsroot/src/sys/arch/sparc64/dev
In directory ivanova.netbsd.org:/tmp/cvs-serv14776

Log Message:
import the openbsd pyro and ebus_mainbus drivers for base reference.

Status:

Vendor Tag: openbsd
Release Tags:   openbsd-20110312

N src/sys/arch/sparc64/dev/pyrovar.h
N src/sys/arch/sparc64/dev/pyro.c
N src/sys/arch/sparc64/dev/ebus_mainbus.c

No conflicts created by this import



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar 15 11:22:18 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: com_ebus.c

Log Message:
also attach for su16552 compatible devices.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/sparc64/dev/com_ebus.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/sparc64/dev/com_ebus.c
diff -u src/sys/arch/sparc64/dev/com_ebus.c:1.30 src/sys/arch/sparc64/dev/com_ebus.c:1.31
--- src/sys/arch/sparc64/dev/com_ebus.c:1.30	Sun Jan  3 17:02:03 2010
+++ src/sys/arch/sparc64/dev/com_ebus.c	Tue Mar 15 11:22:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: com_ebus.c,v 1.30 2010/01/03 17:02:03 jdc Exp $	*/
+/*	$NetBSD: com_ebus.c,v 1.31 2011/03/15 11:22:18 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: com_ebus.c,v 1.30 2010/01/03 17:02:03 jdc Exp $);
+__KERNEL_RCSID(0, $NetBSD: com_ebus.c,v 1.31 2011/03/15 11:22:18 mrg Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -83,6 +83,7 @@
 		/* Could be anything. */
 		compat = prom_getpropstring(ea-ea_node, compatible);
 		if (strcmp(compat, su16550) == 0 ||
+		strcmp(compat, su16552) == 0 ||
 		strcmp(compat, su) == 0) {
 			return (1);
 		}



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Mar 15 11:42:03 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: ebus_mainbus.c pyro.c pyrovar.h

Log Message:
initial port of these drivers to netbsd.  both pyro(4) and ebus(4) at
mainbus depend upon other as-yet uncommited changes.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/sys/arch/sparc64/dev/ebus_mainbus.c \
src/sys/arch/sparc64/dev/pyro.c src/sys/arch/sparc64/dev/pyrovar.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/sparc64/dev/ebus_mainbus.c
diff -u src/sys/arch/sparc64/dev/ebus_mainbus.c:1.1.1.1 src/sys/arch/sparc64/dev/ebus_mainbus.c:1.2
--- src/sys/arch/sparc64/dev/ebus_mainbus.c:1.1.1.1	Tue Mar 15 11:21:04 2011
+++ src/sys/arch/sparc64/dev/ebus_mainbus.c	Tue Mar 15 11:42:03 2011
@@ -1,3 +1,4 @@
+/*	$NetBSD: ebus_mainbus.c,v 1.2 2011/03/15 11:42:03 mrg Exp $	*/
 /*	$OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $	*/
 
 /*
@@ -41,35 +42,33 @@
 #define _SPARC_BUS_DMA_PRIVATE
 #include machine/bus.h
 #include machine/autoconf.h
-#include machine/hypervisor.h
+//#include machine/hypervisor.h
 #include machine/openfirm.h
 
 #include dev/pci/pcivar.h
 
 #include sparc64/dev/iommureg.h
-#include sparc64/dev/ebusreg.h
-#include sparc64/dev/ebusvar.h
+#include sparc64/dev/iommuvar.h
 #include sparc64/dev/pyrovar.h
+#include dev/ebus/ebusreg.h
+#include dev/ebus/ebusvar.h
+#include sparc64/dev/ebusvar.h
 
-extern struct cfdriver pyro_cd;
-
-int	ebus_mainbus_match(struct device *, void *, void *);
+int	ebus_mainbus_match(struct device *, struct cfdata *, void *);
 void	ebus_mainbus_attach(struct device *, struct device *, void *);
 
-struct cfattach ebus_mainbus_ca = {
-	sizeof(struct ebus_softc), ebus_mainbus_match, ebus_mainbus_attach
-};
-
+CFATTACH_DECL(ebus_mainbus, sizeof(struct ebus_softc),
+ebus_mainbus_match, ebus_mainbus_attach, NULL, NULL);
 
-int ebus_mainbus_bus_map(bus_space_tag_t, bus_space_tag_t,
-bus_addr_t, bus_size_t, int, bus_space_handle_t *);
-void *ebus_mainbus_intr_establish(bus_space_tag_t, bus_space_tag_t,
-int, int, int, int (*)(void *), void *, const char *);
-bus_space_tag_t ebus_alloc_bus_tag(struct ebus_softc *, bus_space_tag_t);
+int ebus_mainbus_bus_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
+vaddr_t, bus_space_handle_t *);
+void *ebus_mainbus_intr_establish(bus_space_tag_t, int, int,
+	int (*)(void *), void *, void (*)(void));
+bus_space_tag_t ebus_mainbus_alloc_bus_tag(struct ebus_softc *, bus_space_tag_t, int);
 void ebus_mainbus_intr_ack(struct intrhand *);
 
 int
-ebus_mainbus_match(struct device *parent, void *match, void *aux)
+ebus_mainbus_match(struct device *parent, struct cfdata *match, void *aux)
 {
 	struct mainbus_attach_args *ma = aux;
 
@@ -94,11 +93,14 @@
 
 	if (CPU_ISSUN4U) {
 		printf(: ign %x, sc-sc_ign);
+		/* XXX */
+		extern struct cfdriver pyro_cd;
 
 		for (i = 0; i  pyro_cd.cd_ndevs; i++) {
-			psc = pyro_cd.cd_devs[i];
+			device_t dt = pyro_cd.cd_devs[i];
+			psc = (struct pyro_softc *)dt;
 			if (psc  psc-sc_ign == sc-sc_ign) {
-sc-sc_bust = psc-sc_bust;
+sc-sc_bust = psc-sc_bustag;
 sc-sc_csr = psc-sc_csr;
 sc-sc_csrh = psc-sc_csrh;
 break;
@@ -113,22 +115,23 @@
 
 	printf(\n);
 
-	sc-sc_memtag = ebus_alloc_bus_tag(sc, ma-ma_bustag);
-	sc-sc_iotag = ebus_alloc_bus_tag(sc, ma-ma_bustag);
-	sc-sc_dmatag = ebus_alloc_dma_tag(sc, ma-ma_dmatag);
+	sc-sc_memtag = ebus_mainbus_alloc_bus_tag(sc, ma-ma_bustag, PCI_MEMORY_BUS_SPACE);
+	sc-sc_iotag = ebus_mainbus_alloc_bus_tag(sc, ma-ma_bustag, PCI_IO_BUS_SPACE);
+	sc-sc_childbustag = sc-sc_memtag;
+	sc-sc_dmatag = ma-ma_dmatag;
 
 	/*
 	 * fill in our softc with information from the prom
 	 */
 	sc-sc_intmap = NULL;
 	sc-sc_range = NULL;
-	error = getprop(node, interrupt-map,
+	error = prom_getprop(node, interrupt-map,
 			sizeof(struct ebus_interrupt_map),
 			sc-sc_nintmap, (void **)sc-sc_intmap);
 	switch (error) {
 	case 0:
 		immp = sc-sc_intmapmask;
-		error = getprop(node, interrupt-map-mask,
+		error = prom_getprop(node, interrupt-map-mask,
 			sizeof(struct ebus_interrupt_map_mask), nmapmask,
 			(void **)immp);
 		if (error)
@@ -143,7 +146,7 @@
 		break;
 	}
 
-	error = getprop(node, ranges, sizeof(struct ebus_mainbus_ranges),
+	error = prom_getprop(node, ranges, sizeof(struct ebus_mainbus_ranges),
 	sc-sc_nrange, (void **)sc-sc_range);
 	if (error)
 		panic(ebus ranges: error %d, error);
@@ -156,7 +159,7 @@
 		if (ebus_setup_attach_args(sc, node, eba) != 0) {
 			DPRINTF(EDB_CHILD,
 			(ebus_mainbus_attach: %s: incomplete\n,
-			getpropstring(node, name)));
+			prom_getpropstring(node, name)));
 			continue;
 		} else {
 			DPRINTF(EDB_CHILD, (- found child `%s', attaching\n,
@@ -168,7 +171,7 @@
 }
 
 bus_space_tag_t
-ebus_alloc_bus_tag(struct ebus_softc *sc, bus_space_tag_t parent)

CVS commit: src/include

2011-03-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Mar 15 12:21:08 UTC 2011

Modified Files:
src/include: stdlib.h

Log Message:
put in a proto for commaize_number()
(nb. doing this purely as the minimum work solution to get a working build)


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/include/stdlib.h

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

Modified files:

Index: src/include/stdlib.h
diff -u src/include/stdlib.h:1.95 src/include/stdlib.h:1.96
--- src/include/stdlib.h:1.95	Fri Feb  4 22:07:07 2011
+++ src/include/stdlib.h	Tue Mar 15 12:21:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdlib.h,v 1.95 2011/02/04 22:07:07 christos Exp $	*/
+/*	$NetBSD: stdlib.h,v 1.96 2011/03/15 12:21:08 pooka Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -282,6 +282,8 @@
 int	 humanize_number(char *, size_t, int64_t, const char *, int, int);
 int	 dehumanize_number(const char *, int64_t *);
 
+int	 commaize_number(char *, size_t, int64_t);
+
 devmajor_t getdevmajor(const char *, mode_t);
 int	 getloadavg(double [], int);
 



CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2011-03-15 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Tue Mar 15 13:20:14 UTC 2011

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: isakmp.c isakmp_inf.c pfkey.c

Log Message:
directly call isakmp_ph1delete() instead of scheduling isakmp_ph1delete_stub(), 
as it is useless an can lead to memory access after free


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
cvs rdiff -u -r1.46 -r1.47 \
src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c
cvs rdiff -u -r1.56 -r1.57 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c

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

Modified files:

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.70 src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.71
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp.c:1.70	Mon Mar 14 17:18:12 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp.c	Tue Mar 15 13:20:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp.c,v 1.70 2011/03/14 17:18:12 tteras Exp $	*/
+/*	$NetBSD: isakmp.c,v 1.71 2011/03/15 13:20:14 vanhu Exp $	*/
 
 /* Id: isakmp.c,v 1.74 2006/05/07 21:32:59 manubsd Exp */
 
@@ -2018,7 +2018,7 @@
 		iph1-status = PHASE1ST_EXPIRED;
 	}
 
-	sched_schedule(iph1-sce, 1, isakmp_ph1delete_stub);
+	isakmp_ph1delete(iph1);
 }
 
 /* called from scheduler */
@@ -2046,20 +2046,16 @@
 	/* Discard any left phase2s */
 	for (p = LIST_FIRST(iph1-ph2tree); p; p = next) {
 		next = LIST_NEXT(p, ph1bind);
-		if (p-status = PHASE2ST_ESTABLISHED)
-			unbindph12(p);
-		/* Should we also remove non established ph2
-		 * handles, as we just invalidated ph1handle ?
+		if (p-status == PHASE2ST_ESTABLISHED)
+			isakmp_info_send_d2(p);
+		/* remove all ph2 handles,
+		 * as ph1handle will be expired soon
 		 */
+		delete_spd(p, 1);
+		remph2(p);
+		delph2(p);
 	}
 
-	if (LIST_FIRST(iph1-ph2tree) != NULL) {
-		sched_schedule(iph1-sce, 1, isakmp_ph1delete_stub);
-		return;
-	}
-
-	/* don't re-negosiation when the phase 1 SA expires. */
-
 	src = racoon_strdup(saddr2str(iph1-local));
 	dst = racoon_strdup(saddr2str(iph1-remote));
 	STRDUP_FATAL(src);
@@ -3397,7 +3393,7 @@
 		 purged ISAKMP-SA spi=%s.\n,
 		 isakmp_pindex((iph1-index), iph1-msgid));
 
-	sched_schedule(iph1-sce, 1, isakmp_ph1delete_stub);
+	isakmp_ph1delete(iph1);
 }
 
 void

Index: src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.46 src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.47
--- src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c:1.46	Mon Mar 14 17:18:13 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/isakmp_inf.c	Tue Mar 15 13:20:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: isakmp_inf.c,v 1.46 2011/03/14 17:18:13 tteras Exp $	*/
+/*	$NetBSD: isakmp_inf.c,v 1.47 2011/03/15 13:20:14 vanhu Exp $	*/
 
 /* Id: isakmp_inf.c,v 1.44 2006/05/06 20:45:52 manubsd Exp */
 
@@ -1094,7 +1094,7 @@
 			isakmp_pindex(spi[i], 0));
 
 		iph1-status = PHASE1ST_EXPIRED;
-		sched_schedule(iph1-sce, 1, isakmp_ph1delete_stub);
+		isakmp_ph1delete(iph1);
 	}
 }
 

Index: src/crypto/dist/ipsec-tools/src/racoon/pfkey.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.56 src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.57
--- src/crypto/dist/ipsec-tools/src/racoon/pfkey.c:1.56	Mon Mar 14 17:18:13 2011
+++ src/crypto/dist/ipsec-tools/src/racoon/pfkey.c	Tue Mar 15 13:20:14 2011
@@ -1,6 +1,6 @@
-/*	$NetBSD: pfkey.c,v 1.56 2011/03/14 17:18:13 tteras Exp $	*/
+/*	$NetBSD: pfkey.c,v 1.57 2011/03/15 13:20:14 vanhu Exp $	*/
 
-/* $Id: pfkey.c,v 1.56 2011/03/14 17:18:13 tteras Exp $ */
+/* $Id: pfkey.c,v 1.57 2011/03/15 13:20:14 vanhu Exp $ */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -2901,7 +2901,7 @@
 		rmconf = getrmconf(ma-remote, 0);
 		if (rmconf == NULL || !rmconf-passive) {
 			iph1-status = PHASE1ST_EXPIRED;
-			sched_schedule(iph1-sce, 1, isakmp_ph1delete_stub);
+			isakmp_ph1delete(iph1);
 
 			/* This is unlikely, but let's just check if a Phase 1
 			 * for the new addresses already exist */



CVS commit: src/doc

2011-03-15 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar 15 14:37:21 UTC 2011

Modified Files:
src/doc: CHANGES

Log Message:
Add SH3 and x86 for the TLS support


To generate a diff of this commit:
cvs rdiff -u -r1.1521 -r1.1522 src/doc/CHANGES

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
diff -u src/doc/CHANGES:1.1521 src/doc/CHANGES:1.1522
--- src/doc/CHANGES:1.1521	Tue Mar 15 07:42:36 2011
+++ src/doc/CHANGES	Tue Mar 15 14:37:21 2011
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1521 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1522 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -886,5 +886,7 @@
 		[bouyer 20110306]
 	tmux(1): First import of tmux (version 1.4).  [jmmv 20110310]
 	powerpc: add TLS (thread local storage) support.  [matt 20110311]
+	sh3: add TLS (thread locale storage) support.  [joerg 20110312
+	x86: add TLS (thread locale storage) support.  [joerg 20110312
 	mips: add TLS (thread local storage) support.  [matt 20110314]
 	mips: add MIPS32R2 and MIPS64R2 support.  [matt 20110314]



CVS commit: src/external/mit/xorg/server/drivers/xf86-video-sis

2011-03-15 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Tue Mar 15 19:54:14 UTC 2011

Modified Files:
src/external/mit/xorg/server/drivers/xf86-video-sis: Makefile

Log Message:
don't need to supply __myservername__ and __myxconfigfile__ as they
are generated internally from __xservername__ and __xconfigfile__


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 \
src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile
diff -u src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile:1.8 src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile:1.9
--- src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile:1.8	Sat May 22 23:04:02 2010
+++ src/external/mit/xorg/server/drivers/xf86-video-sis/Makefile	Tue Mar 15 19:54:14 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2010/05/22 23:04:02 mrg Exp $
+#	$NetBSD: Makefile,v 1.9 2011/03/15 19:54:14 plunky Exp $
 
 DRIVER=		xf86-video-sis
 DRIVER_NAME=	sis_drv
@@ -20,7 +20,5 @@
 COPTS.sis_driver.c=	-Wno-error
 
 X11MANCPP=		yes
-X11EXTRAMANDEFS+=	-D__myservername__=Xorg \
-			-D__myxconfigfile__=xorg.conf
 
 .include ../Makefile.xf86-driver



CVS commit: src/bin/ls

2011-03-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 15 22:53:42 UTC 2011

Modified Files:
src/bin/ls: print.c

Log Message:
- use printf(3) ' format to do thousands grouping instead of custom version.
- fix sign format inconsistencies.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/bin/ls/print.c

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

Modified files:

Index: src/bin/ls/print.c
diff -u src/bin/ls/print.c:1.49 src/bin/ls/print.c:1.50
--- src/bin/ls/print.c:1.49	Mon Mar 14 23:52:38 2011
+++ src/bin/ls/print.c	Tue Mar 15 18:53:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: print.c,v 1.49 2011/03/15 03:52:38 erh Exp $	*/
+/*	$NetBSD: print.c,v 1.50 2011/03/15 22:53:41 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)print.c	8.5 (Berkeley) 7/28/94;
 #else
-__RCSID($NetBSD: print.c,v 1.49 2011/03/15 03:52:38 erh Exp $);
+__RCSID($NetBSD: print.c,v 1.50 2011/03/15 22:53:41 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -92,7 +92,6 @@
 	FTSENT *p;
 	NAMES *np;
 	char buf[20], szbuf[5];
-char commabuf[27];  /* 64 bits == 20 digits, +6 for commas, +1 for NUL */
 
 	now = time(NULL);
 
@@ -113,16 +112,10 @@
 (HN_DECIMAL | HN_B | HN_NOSPACE))) == -1)
 	err(1, humanize_number);
 (void)printf(%*s , dp-s_block, szbuf);
-			} else if (f_commas) {
-if (commaize_number(commabuf, sizeof(commabuf),
-(long long)howmany(sp-st_blocks,
-blocksize)) == -1)
-	err(1, commaize_number(blocks=%lld),
-	(long long)howmany(sp-st_blocks, blocksize));
-(void)printf(%*s , dp-s_block, commabuf);
 			} else {
-(void)printf(%*llu , dp-s_block,
-(long long)howmany(sp-st_blocks,
+(void)printf(f_commas ? %'*llu  : %*llu ,
+dp-s_block,
+(unsigned long long)howmany(sp-st_blocks,
 blocksize));
 			}
 		}
@@ -146,14 +139,10 @@
 (HN_DECIMAL | HN_B | HN_NOSPACE))) == -1)
 	err(1, humanize_number);
 (void)printf(%*s , dp-s_size, szbuf);
-			} else if (f_commas) {
-if (commaize_number(commabuf, sizeof(commabuf),
-sp-st_size) == -1)
-	err(1, commaize_number(size=%lld), sp-st_size);
-(void)printf(%*s , dp-s_size, commabuf);
 			} else {
-(void)printf(%*llu , dp-s_size,
-(long long)sp-st_size);
+(void)printf(f_commas ? %'*llu  : %*llu , 
+dp-s_size, (unsigned long long)
+sp-st_size);
 			}
 		if (f_accesstime)
 			printtime(sp-st_atime);
@@ -334,7 +323,6 @@
 	struct stat *sp;
 	int chcnt;
 	char szbuf[5];
-char commabuf[27];  /* 64 bits == 20 digits, +6 for commas, +1 for NUL */
 
 	sp = p-fts_statp;
 	chcnt = 0;
@@ -347,15 +335,10 @@
 			(HN_DECIMAL | HN_B | HN_NOSPACE))) == -1)
 err(1, humanize_number);
 			chcnt += printf(%*s , sizefield, szbuf);
-		} else if (f_commas) {
-			if (commaize_number(commabuf, sizeof(commabuf),
-			(long long)howmany(sp-st_blocks, blocksize) == -1))
-err(1, commaize_number(blocks=%lld),
-(long long)howmany(sp-st_blocks, blocksize));
-			(void)printf(%*s , sizefield, commabuf);
 		} else {
-			chcnt += printf(%*llu , sizefield,
-			(long long)howmany(sp-st_blocks, blocksize));
+			chcnt += printf(f_commas ? %'*llu  : %*llu ,
+			sizefield, (unsigned long long)
+			howmany(sp-st_blocks, blocksize));
 		}
 	}
 	if (f_octal || f_octal_escape)
@@ -407,7 +390,6 @@
 printtotal(DISPLAY *dp)
 {
 	char szbuf[5];
-char commabuf[27];  /* 64 bits == 20 digits, +6 for commas, +1 for NUL */
 	
 	if (dp-list-fts_level != FTS_ROOTLEVEL  (f_longform || f_size)) {
 		if (f_humanize) {
@@ -416,15 +398,10 @@
 			(HN_DECIMAL | HN_B | HN_NOSPACE))) == -1)
 err(1, humanize_number);
 			(void)printf(total %s\n, szbuf);
-		} else if (f_commas) {
-			if (commaize_number(commabuf, sizeof(commabuf),
-			(long long)howmany(dp-btotal, blocksize)) == -1)
-err(1, commaize_number(total=%lld),
-(long long)howmany(dp-btotal, blocksize));
-			(void)printf(total %s\n, commabuf);
 		} else {
-			(void)printf(total %llu\n,
-			(long long)(howmany(dp-btotal, blocksize)));
+			(void)printf(f_commas ? total %'llu\n :
+			total %llu\n, (unsigned long long)
+			howmany(dp-btotal, blocksize));
 		}
 	}
 }



CVS commit: src/usr.bin/printf

2011-03-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 15 23:11:49 UTC 2011

Modified Files:
src/usr.bin/printf: printf.c

Log Message:
support grouping format.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/printf/printf.c

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

Modified files:

Index: src/usr.bin/printf/printf.c
diff -u src/usr.bin/printf/printf.c:1.34 src/usr.bin/printf/printf.c:1.35
--- src/usr.bin/printf/printf.c:1.34	Tue Oct 13 15:28:31 2009
+++ src/usr.bin/printf/printf.c	Tue Mar 15 19:11:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: printf.c,v 1.34 2009/10/13 19:28:31 christos Exp $	*/
+/*	$NetBSD: printf.c,v 1.35 2011/03/15 23:11:49 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = @(#)printf.c	8.2 (Berkeley) 3/22/95;
 #else
-__RCSID($NetBSD: printf.c,v 1.34 2009/10/13 19:28:31 christos Exp $);
+__RCSID($NetBSD: printf.c,v 1.35 2011/03/15 23:11:49 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -154,7 +154,7 @@
 	format = *argv;
 	gargv = ++argv;
 
-#define SKIP1	#-+ 0
+#define SKIP1	#-+ 0'
 #define SKIP2	0123456789
 	do {
 		/*



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

2011-03-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Tue Mar 15 23:27:47 UTC 2011

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

Log Message:
Add otus(4), Atheros AR9100U usb wireless driver.


To generate a diff of this commit:
cvs rdiff -u -r1.289 -r1.290 src/sys/arch/macppc/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/macppc/conf/GENERIC
diff -u src/sys/arch/macppc/conf/GENERIC:1.289 src/sys/arch/macppc/conf/GENERIC:1.290
--- src/sys/arch/macppc/conf/GENERIC:1.289	Sun Mar  6 17:08:27 2011
+++ src/sys/arch/macppc/conf/GENERIC	Tue Mar 15 23:27:47 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.289 2011/03/06 17:08:27 bouyer Exp $
+# $NetBSD: GENERIC,v 1.290 2011/03/15 23:27:47 riz Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		GENERIC-$Revision: 1.289 $
+#ident 		GENERIC-$Revision: 1.290 $
 
 maxusers	32
 
@@ -519,6 +519,7 @@
 
 # USB 802.11 adapters
 atu*	at uhub? port ?		# Atmel at76c50x 802.11b
+otus*	at uhub? port ?		# Atheros AR9001U
 ral*	at uhub? port ?		# Ralink Technology RT25x0 802.11a/b/g
 rum*	at uhub? port ?		# Ralink Technology RT2501/RT2601 802.11a/b/g
 #zyd*	at uhub? port ?		# Zydas ZD1211



CVS commit: src/include

2011-03-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 00:48:35 UTC 2011

Modified Files:
src/include: stdlib.h

Log Message:
remove commaize_number.


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/include/stdlib.h

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

Modified files:

Index: src/include/stdlib.h
diff -u src/include/stdlib.h:1.96 src/include/stdlib.h:1.97
--- src/include/stdlib.h:1.96	Tue Mar 15 08:21:08 2011
+++ src/include/stdlib.h	Tue Mar 15 20:48:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdlib.h,v 1.96 2011/03/15 12:21:08 pooka Exp $	*/
+/*	$NetBSD: stdlib.h,v 1.97 2011/03/16 00:48:34 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -282,8 +282,6 @@
 int	 humanize_number(char *, size_t, int64_t, const char *, int, int);
 int	 dehumanize_number(const char *, int64_t *);
 
-int	 commaize_number(char *, size_t, int64_t);
-
 devmajor_t getdevmajor(const char *, mode_t);
 int	 getloadavg(double [], int);
 



CVS commit: src/lib/libc/gen

2011-03-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 16 00:50:28 UTC 2011

Modified Files:
src/lib/libc/gen: Makefile.inc
Removed Files:
src/lib/libc/gen: commaize_number.3 commaize_number.c

Log Message:
goodbye short-live commaize_number(3), if you liked it:
#define commaize_number(s, l, n) snprintf(s, l, %'llu, (unsigned long long)n)


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r1.2 -r0 src/lib/libc/gen/commaize_number.3
cvs rdiff -u -r1.1 -r0 src/lib/libc/gen/commaize_number.c

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

Modified files:

Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.175 src/lib/libc/gen/Makefile.inc:1.176
--- src/lib/libc/gen/Makefile.inc:1.175	Mon Mar 14 23:47:04 2011
+++ src/lib/libc/gen/Makefile.inc	Tue Mar 15 20:50:28 2011
@@ -1,11 +1,11 @@
-#	$NetBSD: Makefile.inc,v 1.175 2011/03/15 03:47:04 erh Exp $
+#	$NetBSD: Makefile.inc,v 1.176 2011/03/16 00:50:28 christos Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
 .PATH: ${ARCHDIR}/gen ${.CURDIR}/gen
 
 SRCS+= 	_errno.c alarm.c alphasort.c arc4random.c assert.c basename.c clock.c \
-	closedir.c closefrom.c commaize_number.c \
+	closedir.c closefrom.c \
 	confstr.c ctermid.c ctype_.c daemon.c \
 	dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \
 	errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \



CVS commit: src/lib/libc/gen

2011-03-15 Thread Eric Haszlakiewicz
Module Name:src
Committed By:   erh
Date:   Wed Mar 16 01:30:25 UTC 2011

Modified Files:
src/lib/libc/gen: Makefile.inc

Log Message:
Remove one last reference to commaize_number.3


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/lib/libc/gen/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/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.176 src/lib/libc/gen/Makefile.inc:1.177
--- src/lib/libc/gen/Makefile.inc:1.176	Wed Mar 16 00:50:28 2011
+++ src/lib/libc/gen/Makefile.inc	Wed Mar 16 01:30:24 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.176 2011/03/16 00:50:28 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.177 2011/03/16 01:30:24 erh Exp $
 #	from: @(#)Makefile.inc	8.6 (Berkeley) 5/4/95
 
 # gen sources
@@ -52,7 +52,7 @@
 .include ${ARCHDIR}/gen/Makefile.inc
 
 MAN+=	alarm.3 arc4random.3 basename.3 bswap.3 clock.3 closefrom.3 \
-	commaize_number.3 confstr.3 \
+	confstr.3 \
 	cpuset.3 ctermid.3 ctype.3 daemon.3 devname.3 directory.3 dirname.3 \
 	endutxent.3 err.3 exec.3 extattr.3 \
 	fmtcheck.3 fmtmsg.3 fnmatch.3 fpclassify.3 fpgetmask.3 \



CVS commit: src/share/man/man4

2011-03-15 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Mar 16 01:47:19 UTC 2011

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

Log Message:
Add the SMC SMCWUSB-N2 to the list of adapters known to work.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/otus.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/otus.4
diff -u src/share/man/man4/otus.4:1.3 src/share/man/man4/otus.4:1.4
--- src/share/man/man4/otus.4:1.3	Thu Nov  4 13:22:20 2010
+++ src/share/man/man4/otus.4	Wed Mar 16 01:47:19 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: otus.4,v 1.3 2010/11/04 13:22:20 wiz Exp $
+.\ $NetBSD: otus.4,v 1.4 2011/03/16 01:47:19 riz Exp $
 .\ $OpenBSD: otus.4,v 1.14 2010/08/18 18:49:36 damien Exp $
 .\
 .\ Copyright (c) 2009 Damien Bergamini damien.bergam...@free.fr
@@ -94,6 +94,7 @@
 .It Netgear WNDA3100
 .It Netgear WN111 v2
 .It Planex GW-US300
+.It SMC SMCWUSB-N2
 .It TP-Link TL-WN821N
 .It Ubiquiti SR71 USB
 .It Unex DNUA-81



CVS commit: src/sys/dev/ebus

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 02:34:11 UTC 2011

Modified Files:
src/sys/dev/ebus: ebusreg.h

Log Message:
add struct ebus_mainbus_ranges.  from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ebus/ebusreg.h

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

Modified files:

Index: src/sys/dev/ebus/ebusreg.h
diff -u src/sys/dev/ebus/ebusreg.h:1.8 src/sys/dev/ebus/ebusreg.h:1.9
--- src/sys/dev/ebus/ebusreg.h:1.8	Thu May 29 14:51:27 2008
+++ src/sys/dev/ebus/ebusreg.h	Wed Mar 16 02:34:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebusreg.h,v 1.8 2008/05/29 14:51:27 mrg Exp $	*/
+/*	$NetBSD: ebusreg.h,v 1.9 2011/03/16 02:34:10 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -88,6 +88,14 @@
 	uint32_t	size;
 };
 
+struct ebus_mainbus_ranges {
+	u_int32_t	child_hi;
+	u_int32_t	child_lo;
+	u_int32_t	phys_hi;
+	u_int32_t	phys_lo;
+	u_int32_t	size;
+};
+
 
 /* NB: ms-IIep PROMs lack these interrupt-related properties */
 struct ebus_interrupt_map {



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 02:35:48 UTC 2011

Modified Files:
src/sys/arch/sparc64/include: ctlreg.h

Log Message:
add some control registers found on the Fire and Jupiter busses.
from openbsd.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/sparc64/include/ctlreg.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/sparc64/include/ctlreg.h
diff -u src/sys/arch/sparc64/include/ctlreg.h:1.54 src/sys/arch/sparc64/include/ctlreg.h:1.55
--- src/sys/arch/sparc64/include/ctlreg.h:1.54	Sat Dec 18 05:45:43 2010
+++ src/sys/arch/sparc64/include/ctlreg.h	Wed Mar 16 02:35:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ctlreg.h,v 1.54 2010/12/18 05:45:43 mrg Exp $ */
+/*	$NetBSD: ctlreg.h,v 1.55 2011/03/16 02:35:48 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath
@@ -210,6 +210,14 @@
 #else
 #define	CPU_UPAID	UPA_CR_MID(ldxa(0, ASI_MID_REG))
 #endif
+  
+/* Get the CPU's Fireplane agent ID */
+#define FIREPLANE_CR_AID(x)	(((x)  17)  0x3ff)
+#define CPU_FIREPLANEID		FIREPLANE_CR_AID(ldxa(0, ASI_MID_REG))
+
+/* Get the CPU's Jupiter Bus interrupt target ID */
+#define JUPITER_CR_ITID(x)	((x)  0x3ff)
+#define CPU_JUPITERID		JUPITER_CR_ITID(ldxa(0, ASI_MID_REG))
 
 /*
  * [4u] MMU and Cache Control Register (MCCR)



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 02:41:19 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: iommu.c iommureg.h iommuvar.h

Log Message:
various changes to adapt for Fire controller support, based upon the
openbsd code to do the same:

- add the tsb size into the ptsb bits
- avoid setting tsbsize in the CR
- disable IDB_INFO for now; it crashes
- add new macros for reading/writing IOMMU registers (need to use
  these more regularly across the whole file)
- add a missing membar #lookaside
- add support for flushing the pyro(4) caches
- extend struct iommureg to include everything pyro


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/sparc64/dev/iommu.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/dev/iommureg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/dev/iommuvar.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/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.100 src/sys/arch/sparc64/dev/iommu.c:1.101
--- src/sys/arch/sparc64/dev/iommu.c:1.100	Sat Nov  6 11:46:02 2010
+++ src/sys/arch/sparc64/dev/iommu.c	Wed Mar 16 02:41:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.100 2010/11/06 11:46:02 uebayasi Exp $	*/
+/*	$NetBSD: iommu.c,v 1.101 2011/03/16 02:41:19 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iommu.c,v 1.100 2010/11/06 11:46:02 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: iommu.c,v 1.101 2011/03/16 02:41:19 mrg Exp $);
 
 #include opt_ddb.h
 
@@ -134,7 +134,7 @@
 	 * be hard-wired, so we read the start and size from the PROM and
 	 * just use those values.
 	 */
-	is-is_cr = (tsbsize  16) | IOMMUCR_EN;
+	is-is_cr = IOMMUCR_EN;
 	is-is_tsbsize = tsbsize;
 	if (iovabase == -1) {
 		is-is_dvmabase = IOTSB_VSTART(is-is_tsbsize);
@@ -172,7 +172,7 @@
 	memset(is-is_tsb, 0, size);
 
 #ifdef DEBUG
-	if (iommudebug  IDB_INFO)
+	if ((iommudebug  IDB_INFO)  0)
 	{
 		/* Probe the iommu */
 
@@ -197,11 +197,6 @@
 #endif
 
 	/*
-	 * now actually start up the IOMMU
-	 */
-	iommu_reset(is);
-
-	/*
 	 * Now all the hardware's working we need to allocate a dvma map.
 	 */
 	aprint_debug(DVMA map: %x to %x\n,
@@ -214,6 +209,20 @@
 	is-is_dvmabase, is-is_dvmaend,
 	M_DEVBUF, 0, 0, EX_NOWAIT);
 	/* XXXMRG Check is_dvmamap is valid. */
+
+	/*
+	 * Set the TSB size.  The relevant bits were moved to the TSB
+	 * base register in the PCIe host bridges.
+	 */
+	if (strncmp(name, pyro, 4) == 0)
+		is-is_ptsb |= is-is_tsbsize;
+	else
+		is-is_cr |= (is-is_tsbsize  16);
+
+	/*
+	 * now actually start up the IOMMU
+	 */
+	iommu_reset(is);
 }
 
 /*
@@ -227,13 +236,10 @@
 	int i;
 	struct strbuf_ctl *sb;
 
-	/* Need to do 64-bit stores */
-	bus_space_write_8(is-is_bustag, is-is_iommu, IOMMUREG(iommu_tsb),
-		is-is_ptsb);
+	IOMMUREG_WRITE(is, iommu_tsb, is-is_ptsb);
 
 	/* Enable IOMMU in diagnostic mode */
-	bus_space_write_8(is-is_bustag, is-is_iommu, IOMMUREG(iommu_cr),
-		is-is_cr|IOMMUCR_DE);
+	IOMMUREG_WRITE(is, iommu_cr, is-is_cr|IOMMUCR_DE);
 
 	for (i = 0; i  2; i++) {
 		if ((sb = is-is_sb[i])) {
@@ -242,6 +248,8 @@
 			bus_space_write_8(is-is_bustag, is-is_sb[i]-sb_sb,
 STRBUFREG(strbuf_ctl), STRBUF_EN);
 
+			membar_lookaside();
+
 			/* No streaming buffers? Disable them */
 			if (bus_space_read_8(is-is_bustag,
 is-is_sb[i]-sb_sb,
@@ -252,12 +260,16 @@
 /*
  * locate the pa of the flush buffer.
  */
-(void)pmap_extract(pmap_kernel(),
-	(vaddr_t)is-is_sb[i]-sb_flush,
-	is-is_sb[i]-sb_flushpa);
+if (pmap_extract(pmap_kernel(),
+ (vaddr_t)is-is_sb[i]-sb_flush,
+ is-is_sb[i]-sb_flushpa) == FALSE)
+	is-is_sb[i]-sb_flush = NULL;
 			}
 		}
 	}
+
+	if (is-is_flags  IOMMU_FLUSH_CACHE)
+		IOMMUREG_WRITE(is, iommu_cache_invalidate, -1ULL);
 }
 
 /*
@@ -325,6 +337,7 @@
 void
 iommu_remove(struct iommu_state *is, vaddr_t va, size_t len)
 {
+	int slot;
 
 #ifdef DIAGNOSTIC
 	if (va  is-is_dvmabase || va  is-is_dvmaend)
@@ -363,8 +376,15 @@
 		is-is_tsb[IOTSBSLOT(va,is-is_tsbsize)] = ~IOTTE_V;
 		membar_storestore();
 #endif
-		bus_space_write_8(is-is_bustag, is-is_iommu,
-			IOMMUREG(iommu_flush), va);
+		IOMMUREG_WRITE(is, iommu_flush, va);
+
+		/* Flush cache if necessary. */
+		slot = IOTSBSLOT(trunc_page(va), is-is_tsbsize);
+		if ((is-is_flags  IOMMU_FLUSH_CACHE) 
+		(len == 0 || (slot % 8) == 7))
+			IOMMUREG_WRITE(is, iommu_cache_flush,
+			is-is_ptsb + slot * 8);
+
 		va += PAGE_SIZE;
 	}
 }
@@ -453,6 +473,7 @@
 	vaddr_t vaddr = (vaddr_t)buf;
 	int seg;
 	struct pmap *pmap;
+	int slot;
 
 	if (map-dm_nsegs) {
 		/* Already in use?? */
@@ -489,6 +510,7 @@
 	 * If our segment size is larger than the boundary we need to
 	 * split the transfer up int little pieces ourselves.
 	 */
+	KASSERT(is-is_dvmamap);
 	s = splhigh();
 	err = extent_alloc(is-is_dvmamap, 

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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 03:49:53 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: iommureg.h

Log Message:
add back the old iommureg definition, as iommureg_old.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/iommureg.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/sparc64/dev/iommureg.h
diff -u src/sys/arch/sparc64/dev/iommureg.h:1.16 src/sys/arch/sparc64/dev/iommureg.h:1.17
--- src/sys/arch/sparc64/dev/iommureg.h:1.16	Wed Mar 16 02:41:19 2011
+++ src/sys/arch/sparc64/dev/iommureg.h	Wed Mar 16 03:49:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommureg.h,v 1.16 2011/03/16 02:41:19 mrg Exp $	*/
+/*	$NetBSD: iommureg.h,v 1.17 2011/03/16 03:49:53 mrg Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -49,6 +49,12 @@
  */
 
 /* iommmu registers */
+struct iommureg_old {
+	volatile uint64_t	iommu_cr;	/* IOMMU control register */
+	volatile uint64_t	iommu_tsb;	/* IOMMU TSB base register */
+	volatile uint64_t	iommu_flush;	/* IOMMU flush register */
+};
+
 struct iommureg {
 	volatile uint64_t	iommu_cr;	/* IOMMU control register */
 	volatile uint64_t	iommu_tsb;	/* IOMMU TSB base register */



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 03:51:29 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: psycho.c psychoreg.h sbus.c sbusreg.h

Log Message:
use struct iommureg_old.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sparc64/dev/psychoreg.h
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/sparc64/dev/sbus.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sparc64/dev/sbusreg.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/sparc64/dev/psycho.c
diff -u src/sys/arch/sparc64/dev/psycho.c:1.102 src/sys/arch/sparc64/dev/psycho.c:1.103
--- src/sys/arch/sparc64/dev/psycho.c:1.102	Sun Feb 13 11:54:24 2011
+++ src/sys/arch/sparc64/dev/psycho.c	Wed Mar 16 03:51:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psycho.c,v 1.102 2011/02/13 11:54:24 nakayama Exp $	*/
+/*	$NetBSD: psycho.c,v 1.103 2011/03/16 03:51:29 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -55,7 +55,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.102 2011/02/13 11:54:24 nakayama Exp $);
+__KERNEL_RCSID(0, $NetBSD: psycho.c,v 1.103 2011/03/16 03:51:29 mrg Exp $);
 
 #include opt_ddb.h
 
@@ -996,7 +996,7 @@
 	is-is_bustag = sc-sc_bustag;
 	bus_space_subregion(sc-sc_bustag, sc-sc_bh,
 		offsetof(struct psychoreg, psy_iommu),
-		sizeof (struct iommureg),
+		sizeof (struct iommureg_old),
 		is-is_iommu);
 
 	/*

Index: src/sys/arch/sparc64/dev/psychoreg.h
diff -u src/sys/arch/sparc64/dev/psychoreg.h:1.15 src/sys/arch/sparc64/dev/psychoreg.h:1.16
--- src/sys/arch/sparc64/dev/psychoreg.h:1.15	Thu Mar 10 08:46:12 2011
+++ src/sys/arch/sparc64/dev/psychoreg.h	Wed Mar 16 03:51:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: psychoreg.h,v 1.15 2011/03/10 08:46:12 mrg Exp $ */
+/*	$NetBSD: psychoreg.h,v 1.16 2011/03/16 03:51:29 mrg Exp $ */
 
 /*
  * Copyright (c) 1999 Matthew R. Green
@@ -110,7 +110,7 @@
 
 	uint64_t	pad2[30];
 
-	struct iommureg psy_iommu;			/* 1fe..0200,0210 */
+	struct iommureg_old psy_iommu;		/* 1fe..0200,0210 */
 
 	uint64_t	pad3[317];
 

Index: src/sys/arch/sparc64/dev/sbus.c
diff -u src/sys/arch/sparc64/dev/sbus.c:1.85 src/sys/arch/sparc64/dev/sbus.c:1.86
--- src/sys/arch/sparc64/dev/sbus.c:1.85	Thu Sep 17 16:28:12 2009
+++ src/sys/arch/sparc64/dev/sbus.c	Wed Mar 16 03:51:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbus.c,v 1.85 2009/09/17 16:28:12 tsutsui Exp $ */
+/*	$NetBSD: sbus.c,v 1.86 2011/03/16 03:51:29 mrg Exp $ */
 
 /*
  * Copyright (c) 1999-2002 Eduardo Horvath
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sbus.c,v 1.85 2009/09/17 16:28:12 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: sbus.c,v 1.86 2011/03/16 03:51:29 mrg Exp $);
 
 #include opt_ddb.h
 
@@ -234,7 +234,7 @@
 	sc-sc_is.is_bustag = sc-sc_bustag;
 	bus_space_subregion(sc-sc_bustag, sc-sc_bh, 
 		(vaddr_t)((struct sysioreg *)NULL)-sys_iommu, 
-		sizeof (struct iommureg), sc-sc_is.is_iommu);
+		sizeof (struct iommureg_old), sc-sc_is.is_iommu);
  
 	/* initialize our strbuf_ctl */
 	sc-sc_is.is_sb[0] = sc-sc_sb;

Index: src/sys/arch/sparc64/dev/sbusreg.h
diff -u src/sys/arch/sparc64/dev/sbusreg.h:1.8 src/sys/arch/sparc64/dev/sbusreg.h:1.9
--- src/sys/arch/sparc64/dev/sbusreg.h:1.8	Mon Feb 13 21:47:12 2006
+++ src/sys/arch/sparc64/dev/sbusreg.h	Wed Mar 16 03:51:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbusreg.h,v 1.8 2006/02/13 21:47:12 cdi Exp $ */
+/*	$NetBSD: sbusreg.h,v 1.9 2011/03/16 03:51:29 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-1999 Eduardo Horvath
@@ -94,7 +94,7 @@
 
 	uint64_t	pad3[117];
 
-	struct iommureg sys_iommu;			/* 1fe..2400,2410 */
+	struct iommureg_old	sys_iommu;		/* 1fe..2400,2410 */
 
 	uint64_t	pad4[125];
 



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 03:54:51 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: pci_machdep.c

Log Message:
don't try to turn on parity or set the latency timer, or dump pci config
space for the pci bridge in sparc64_pci_enumerate_bus().  it doesn't work
on PCIe adapters.  #if 0'ed for now, should move this into psycho/schizo.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sparc64/dev/pci_machdep.c

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

Modified files:

Index: src/sys/arch/sparc64/dev/pci_machdep.c
diff -u src/sys/arch/sparc64/dev/pci_machdep.c:1.68 src/sys/arch/sparc64/dev/pci_machdep.c:1.69
--- src/sys/arch/sparc64/dev/pci_machdep.c:1.68	Sat Dec 18 05:14:13 2010
+++ src/sys/arch/sparc64/dev/pci_machdep.c	Wed Mar 16 03:54:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.68 2010/12/18 05:14:13 mrg Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.69 2011/03/16 03:54:51 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.68 2010/12/18 05:14:13 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.69 2011/03/16 03:54:51 mrg Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -84,7 +84,7 @@
 	tag = PCITAG_CREATE(node, b, d, f);
 
 	DPRINTF(SPDB_TAG,
-		(%s: creating tag for node %d bus %d dev %d fn %d\n,
+		(%s: creating tag for node %x bus %d dev %d fn %d\n,
 		 __func__, node, b, d, f));
 
 	/* Enable all the different spaces for this device */
@@ -270,7 +270,9 @@
 	int node, b, d, f, ret;
 	int bus_frequency, lt, cl, cacheline;
 	char name[30];
+#if 0
 	extern int pci_config_dump;
+#endif
 
 	if (sc-sc_bridgetag)
 		node = PCITAG_NODE(*sc-sc_bridgetag);
@@ -289,6 +291,11 @@
 	(cacheline/ecache_min_line_size)*ecache_min_line_size == cacheline 
 	(cacheline/4)*4 == cacheline);
 
+#if 0
+	/*
+	 * XXX this faults on Fire PCIe controllers.
+	 * XXX move into the psycho and schizo driver front ends.
+	 */
 	/* Turn on parity for the bus. */
 	tag = ofpci_make_tag(pc, node, sc-sc_bus, 0, 0);
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
@@ -304,7 +311,9 @@
 	bhlc |= 0x40  PCI_LATTIMER_SHIFT;
 	pci_conf_write(pc, tag, PCI_BHLC_REG, bhlc);
 
-	if (pci_config_dump) pci_conf_print(pc, tag, NULL);
+	if (pci_config_dump)
+		pci_conf_print(pc, tag, NULL);
+#endif
 
 	for (node = prom_firstchild(node); node != 0  node != -1;
 	 node = prom_nextsibling(node)) {
@@ -493,7 +502,7 @@
 		break;
 #endif
 	default:
-		panic(get_childspace: unknown bus type);
+		panic(get_childspace: unknown bus type: %d, type);
 	}
 
 	return (ss);



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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 04:00:43 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: ebus_mainbus.c

Log Message:
minor clean up.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc64/dev/ebus_mainbus.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/sparc64/dev/ebus_mainbus.c
diff -u src/sys/arch/sparc64/dev/ebus_mainbus.c:1.2 src/sys/arch/sparc64/dev/ebus_mainbus.c:1.3
--- src/sys/arch/sparc64/dev/ebus_mainbus.c:1.2	Tue Mar 15 11:42:03 2011
+++ src/sys/arch/sparc64/dev/ebus_mainbus.c	Wed Mar 16 04:00:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ebus_mainbus.c,v 1.2 2011/03/15 11:42:03 mrg Exp $	*/
+/*	$NetBSD: ebus_mainbus.c,v 1.3 2011/03/16 04:00:42 mrg Exp $	*/
 /*	$OpenBSD: ebus_mainbus.c,v 1.7 2010/11/11 17:58:23 miod Exp $	*/
 
 /*
@@ -42,7 +42,6 @@
 #define _SPARC_BUS_DMA_PRIVATE
 #include machine/bus.h
 #include machine/autoconf.h
-//#include machine/hypervisor.h
 #include machine/openfirm.h
 
 #include dev/pci/pcivar.h



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

2011-03-15 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Mar 16 05:08:29 UTC 2011

Modified Files:
src/sys/arch/macppc/dev: obio.c

Log Message:
change the CPU speed sysctl to look more like the ACPI ones, as in
machdep.name.frequency.available etc. so estd can work with minimal changes


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/macppc/dev/obio.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/macppc/dev/obio.c
diff -u src/sys/arch/macppc/dev/obio.c:1.31 src/sys/arch/macppc/dev/obio.c:1.32
--- src/sys/arch/macppc/dev/obio.c:1.31	Sun Dec  5 13:33:50 2010
+++ src/sys/arch/macppc/dev/obio.c	Wed Mar 16 05:08:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: obio.c,v 1.31 2010/12/05 13:33:50 phx Exp $	*/
+/*	$NetBSD: obio.c,v 1.32 2011/03/16 05:08:29 macallan Exp $	*/
 
 /*-
  * Copyright (C) 1998	Internet Research Institute, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: obio.c,v 1.31 2010/12/05 13:33:50 phx Exp $);
+__KERNEL_RCSID(0, $NetBSD: obio.c,v 1.32 2011/03/16 05:08:29 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -71,6 +71,7 @@
 #ifdef OBIO_SPEED_CONTROL
 	int sc_voltage;
 	int sc_busspeed;
+	int sc_spd_hi, sc_spd_lo;
 #endif
 };
 
@@ -81,6 +82,8 @@
 static void obio_set_cpu_speed(struct obio_softc *, int);
 static int  obio_get_cpu_speed(struct obio_softc *);
 static int  sysctl_cpuspeed_temp(SYSCTLFN_ARGS);
+static int  sysctl_cpuspeed_cur(SYSCTLFN_ARGS);
+static int  sysctl_cpuspeed_available(SYSCTLFN_ARGS);
 
 static const char *keylargo[] = {Keylargo,
  AAPL,Keylargo,
@@ -131,6 +134,8 @@
 #ifdef OBIO_SPEED_CONTROL
 	sc-sc_voltage = -1;
 	sc-sc_busspeed = -1;
+	sc-sc_spd_lo = 600;
+	sc-sc_spd_hi = 800;
 #endif
 
 	switch (PCI_PRODUCT(pa-pa_id)) {
@@ -330,9 +335,9 @@
 obio_setup_gpios(struct obio_softc *sc, int node)
 {
 	uint32_t gpio_base, reg[6];
-	struct sysctlnode *sysctl_node;
+	struct sysctlnode *sysctl_node, *me, *freq;
 	char name[32];
-	int child, use_dfs;
+	int child, use_dfs, cpunode, hiclock;
 
 	if (of_compatible(sc-sc_node, keylargo) == -1)
 		return;
@@ -384,14 +389,55 @@
 	printf(%s: enabling Intrepid CPU speed control\n,
 	sc-sc_dev.dv_xname);
 
+	sc-sc_spd_lo = curcpu()-ci_khz / 1000;
+	hiclock = 0;
+	cpunode = OF_finddevice(/cpus/@0);
+	OF_getprop(cpunode, clock-frequency, hiclock, 4);
+	printf(hiclock: %d\n, (hiclock + 50) / 100);
 	sysctl_node = NULL;
-	sysctl_createv(NULL, 0, NULL, 
+
+	if (sysctl_createv(NULL, 0, NULL, 
+	(const struct sysctlnode **)me, 
+	CTLFLAG_READWRITE, CTLTYPE_NODE, intrepid, NULL, NULL,
+	0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL) != 0)
+		printf(couldn't create 'interpid' node\n);
+	
+	if (sysctl_createv(NULL, 0, NULL, 
+	(const struct sysctlnode **)freq, 
+	CTLFLAG_READWRITE, CTLTYPE_NODE, frequency, NULL, NULL,
+	0, NULL, 0, CTL_MACHDEP, me-sysctl_num, CTL_CREATE, CTL_EOL) != 0)
+		printf(couldn't create 'frequency' node\n);
+
+	if (sysctl_createv(NULL, 0, NULL, 
 	(const struct sysctlnode **)sysctl_node, 
 	CTLFLAG_READWRITE | CTLFLAG_OWNDESC | CTLFLAG_IMMEDIATE,
-	CTLTYPE_INT, cpu_speed, CPU speed, sysctl_cpuspeed_temp, 
-	(unsigned long)sc, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
-	if (sysctl_node != NULL)
+	CTLTYPE_INT, target, CPU speed, sysctl_cpuspeed_temp, 
+	0, NULL, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
+	CTL_CREATE, CTL_EOL) == 0) {
+		sysctl_node-sysctl_data = (void *)sc;
+	} else
+		printf(couldn't create 'target' node\n);
+
+	if (sysctl_createv(NULL, 0, NULL, 
+	(const struct sysctlnode **)sysctl_node, 
+	CTLFLAG_READWRITE | CTLFLAG_IMMEDIATE,
+	CTLTYPE_INT, current, NULL, sysctl_cpuspeed_cur, 
+	1, NULL, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
+	CTL_CREATE, CTL_EOL) == 0) {
 		sysctl_node-sysctl_data = (void *)sc;
+	} else
+		printf(couldn't create 'current' node\n);
+
+	if (sysctl_createv(NULL, 0, NULL, 
+	(const struct sysctlnode **)sysctl_node, 
+	CTLFLAG_READWRITE,
+	CTLTYPE_STRING, available, NULL, sysctl_cpuspeed_available, 
+	2, NULL, 0, CTL_MACHDEP, me-sysctl_num, freq-sysctl_num, 
+	CTL_CREATE, CTL_EOL) == 0) {
+		sysctl_node-sysctl_data = (void *)sc;
+	} else
+		printf(couldn't create 'available' node\n);
+	printf(speed: %d\n, curcpu()-ci_khz);
 }
 
 static void
@@ -458,27 +504,83 @@
 {
 	struct sysctlnode node = *rnode;
 	struct obio_softc *sc = node.sysctl_data;
-	const int *np = newp;
-	int speed, nd = 0;
+	int speed, mhz;
 
 	speed = obio_get_cpu_speed(sc);	
-	node.sysctl_idata = speed;
-	if (np) {
-		/* we're asked to write */	
-		nd = *np;
-		node.sysctl_data = speed;
-		if (sysctl_lookup(SYSCTLFN_CALL(node)) == 0) {
-			int new_reg;
-
-			new_reg = (max(0, min(1, node.sysctl_idata)));
-			obio_set_cpu_speed(sc, new_reg);
-			return 0;
+	switch (speed) {
+		case 0:
+			mhz = sc-sc_spd_lo;
+			

CVS commit: src/sys/arch/powerpc

2011-03-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Mar 16 05:31:04 UTC 2011

Modified Files:
src/sys/arch/powerpc/booke: e500_intr.c
src/sys/arch/powerpc/booke/dev: pq3etsec.c pq3gpio.c
src/sys/arch/powerpc/booke/pci: pq3pci.c
src/sys/arch/powerpc/include/booke: e500reg.h

Log Message:
Fix various nits related to P2020 support.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/booke/dev/pq3etsec.c \
src/sys/arch/powerpc/booke/dev/pq3gpio.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/powerpc/booke/pci/pq3pci.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/powerpc/include/booke/e500reg.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/powerpc/booke/e500_intr.c
diff -u src/sys/arch/powerpc/booke/e500_intr.c:1.3 src/sys/arch/powerpc/booke/e500_intr.c:1.4
--- src/sys/arch/powerpc/booke/e500_intr.c:1.3	Wed Feb 16 18:43:35 2011
+++ src/sys/arch/powerpc/booke/e500_intr.c	Wed Mar 16 05:31:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: e500_intr.c,v 1.3 2011/02/16 18:43:35 matt Exp $	*/
+/*	$NetBSD: e500_intr.c,v 1.4 2011/03/16 05:31:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -1018,7 +1018,7 @@
 	struct intr_source *is;
 	struct e500_intr_info * const ii = e500_intr_info;
 
-	const uint16_t svr = mfspr(SPR_SVR)  16;
+	const uint16_t svr = (mfspr(SPR_SVR)  ~0x8)  16;
 	switch (svr) {
 #ifdef MPC8536
 	case SVR_MPC8536v1  16:

Index: src/sys/arch/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.2 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.3
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.2	Tue Jan 18 01:02:53 2011
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Wed Mar 16 05:31:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.2 2011/01/18 01:02:53 matt Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.3 2011/03/16 05:31:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -610,15 +610,20 @@
 	ifmedia_init(sc-sc_mii.mii_media, 0, ether_mediachange,
 	ether_mediastatus);
 
-	mii_attach(miiself, sc-sc_mii, 0x,
-	sc-sc_phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE);
-
-	if (LIST_FIRST(sc-sc_mii.mii_phys) == NULL) {
-		ifmedia_add(sc-sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
-		ifmedia_set(sc-sc_mii.mii_media, IFM_ETHER|IFM_NONE);
+	if (sc-sc_phy_addr  32) {
+		mii_attach(miiself, sc-sc_mii, 0x,
+		sc-sc_phy_addr, MII_OFFSET_ANY, MIIF_DOPAUSE);
+
+		if (LIST_FIRST(sc-sc_mii.mii_phys) == NULL) {
+			ifmedia_add(sc-sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
+			ifmedia_set(sc-sc_mii.mii_media, IFM_ETHER|IFM_NONE);
+		} else {
+			callout_schedule(sc-sc_mii_callout, hz);
+			ifmedia_set(sc-sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
+		}
 	} else {
-		callout_schedule(sc-sc_mii_callout, hz);
-		ifmedia_set(sc-sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
+		ifmedia_add(sc-sc_mii.mii_media, IFM_ETHER|IFM_1000_T|IFM_FDX, 0, NULL);
+		ifmedia_set(sc-sc_mii.mii_media, IFM_ETHER|IFM_1000_T|IFM_FDX);
 	}
 
 	ec-ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_VLAN_HWTAGGING
Index: src/sys/arch/powerpc/booke/dev/pq3gpio.c
diff -u src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.2 src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.3
--- src/sys/arch/powerpc/booke/dev/pq3gpio.c:1.2	Tue Jan 18 01:02:53 2011
+++ src/sys/arch/powerpc/booke/dev/pq3gpio.c	Wed Mar 16 05:31:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3gpio.c,v 1.2 2011/01/18 01:02:53 matt Exp $	*/
+/*	$NetBSD: pq3gpio.c,v 1.3 2011/03/16 05:31:03 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -285,6 +285,40 @@
 }
 #endif /* MPC8548 */
 
+#ifdef P2020
+static void
+pq3gpio_p20x0_attach(device_t self, bus_space_tag_t bst,
+	bus_space_handle_t bsh, u_int svr)
+{
+	static const uint32_t gpio2pmuxcr_map[][2] = {
+		{ __BIT(10), PMUXCR_TSEC3_TS|PMUXCR_USB },
+		{ __BIT(11), PMUXCR_TSEC3_TS|PMUXCR_USB },
+		{ __BIT(12), PMUXCR_TSEC1_TS },
+		{ __BIT(13), PMUXCR_TSEC1_TS },
+		{ __BIT(14), PMUXCR_TSEC2_TS },
+		{ __BIT(15), PMUXCR_TSEC2_TS },
+	};
+	
+	uint32_t pinmask = ~0;	/* assume all bits are valid */
+	size_t pincnt = 32;
+	const uint32_t pmuxcr = bus_space_read_4(bst, bsh, PMUXCR);
+	for (size_t i = 0; i  __arraycount(gpio2pmuxcr_map); i++) {
+		if (pmuxcr  gpio2pmuxcr_map[i][1]) {
+			pinmask = ~gpio2pmuxcr_map[i][0];
+			pincnt--;
+		}
+	}
+
+	/*
+	 * Create GPIO pin groups
+	 */
+	aprint_normal_dev(self, %zu input pins, %zu output pins\n,
+	pincnt, pincnt);
+	pq3gpio_group_create(self, bst, bsh, GPINDR, pinmask, GPIO_PIN_INPUT);
+	pq3gpio_group_create(self, bst, bsh, GPOUTDR, pinmask, GPIO_PIN_OUTPUT);
+}
+#endif /* P2020 */
+
 static const struct {
 	uint16_t svr;
 	void (*attach)(device_t, bus_space_tag_t, bus_space_handle_t, u_int);
@@ -301,6 +335,9 @@
 

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

2011-03-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Mar 16 05:49:44 UTC 2011

Modified Files:
src/sys/arch/sparc64/dev: iommu.c iommureg.h iommuvar.h psycho.c
psychoreg.h sbus.c sbusreg.h

Log Message:
revert the iommu changes for now.  my U60 doesn't like them.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/sparc64/dev/iommu.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sparc64/dev/iommureg.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc64/dev/iommuvar.h
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/sparc64/dev/psycho.c
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sparc64/dev/psychoreg.h
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sparc64/dev/sbus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sparc64/dev/sbusreg.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/sparc64/dev/iommu.c
diff -u src/sys/arch/sparc64/dev/iommu.c:1.101 src/sys/arch/sparc64/dev/iommu.c:1.102
--- src/sys/arch/sparc64/dev/iommu.c:1.101	Wed Mar 16 02:41:19 2011
+++ src/sys/arch/sparc64/dev/iommu.c	Wed Mar 16 05:49:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iommu.c,v 1.101 2011/03/16 02:41:19 mrg Exp $	*/
+/*	$NetBSD: iommu.c,v 1.102 2011/03/16 05:49:43 mrg Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -59,7 +59,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iommu.c,v 1.101 2011/03/16 02:41:19 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: iommu.c,v 1.102 2011/03/16 05:49:43 mrg Exp $);
 
 #include opt_ddb.h
 
@@ -134,7 +134,7 @@
 	 * be hard-wired, so we read the start and size from the PROM and
 	 * just use those values.
 	 */
-	is-is_cr = IOMMUCR_EN;
+	is-is_cr = (tsbsize  16) | IOMMUCR_EN;
 	is-is_tsbsize = tsbsize;
 	if (iovabase == -1) {
 		is-is_dvmabase = IOTSB_VSTART(is-is_tsbsize);
@@ -172,7 +172,7 @@
 	memset(is-is_tsb, 0, size);
 
 #ifdef DEBUG
-	if ((iommudebug  IDB_INFO)  0)
+	if (iommudebug  IDB_INFO)
 	{
 		/* Probe the iommu */
 
@@ -197,6 +197,11 @@
 #endif
 
 	/*
+	 * now actually start up the IOMMU
+	 */
+	iommu_reset(is);
+
+	/*
 	 * Now all the hardware's working we need to allocate a dvma map.
 	 */
 	aprint_debug(DVMA map: %x to %x\n,
@@ -209,20 +214,6 @@
 	is-is_dvmabase, is-is_dvmaend,
 	M_DEVBUF, 0, 0, EX_NOWAIT);
 	/* XXXMRG Check is_dvmamap is valid. */
-
-	/*
-	 * Set the TSB size.  The relevant bits were moved to the TSB
-	 * base register in the PCIe host bridges.
-	 */
-	if (strncmp(name, pyro, 4) == 0)
-		is-is_ptsb |= is-is_tsbsize;
-	else
-		is-is_cr |= (is-is_tsbsize  16);
-
-	/*
-	 * now actually start up the IOMMU
-	 */
-	iommu_reset(is);
 }
 
 /*
@@ -236,10 +227,13 @@
 	int i;
 	struct strbuf_ctl *sb;
 
-	IOMMUREG_WRITE(is, iommu_tsb, is-is_ptsb);
+	/* Need to do 64-bit stores */
+	bus_space_write_8(is-is_bustag, is-is_iommu, IOMMUREG(iommu_tsb),
+		is-is_ptsb);
 
 	/* Enable IOMMU in diagnostic mode */
-	IOMMUREG_WRITE(is, iommu_cr, is-is_cr|IOMMUCR_DE);
+	bus_space_write_8(is-is_bustag, is-is_iommu, IOMMUREG(iommu_cr),
+		is-is_cr|IOMMUCR_DE);
 
 	for (i = 0; i  2; i++) {
 		if ((sb = is-is_sb[i])) {
@@ -248,8 +242,6 @@
 			bus_space_write_8(is-is_bustag, is-is_sb[i]-sb_sb,
 STRBUFREG(strbuf_ctl), STRBUF_EN);
 
-			membar_lookaside();
-
 			/* No streaming buffers? Disable them */
 			if (bus_space_read_8(is-is_bustag,
 is-is_sb[i]-sb_sb,
@@ -260,16 +252,12 @@
 /*
  * locate the pa of the flush buffer.
  */
-if (pmap_extract(pmap_kernel(),
- (vaddr_t)is-is_sb[i]-sb_flush,
- is-is_sb[i]-sb_flushpa) == FALSE)
-	is-is_sb[i]-sb_flush = NULL;
+(void)pmap_extract(pmap_kernel(),
+	(vaddr_t)is-is_sb[i]-sb_flush,
+	is-is_sb[i]-sb_flushpa);
 			}
 		}
 	}
-
-	if (is-is_flags  IOMMU_FLUSH_CACHE)
-		IOMMUREG_WRITE(is, iommu_cache_invalidate, -1ULL);
 }
 
 /*
@@ -337,7 +325,6 @@
 void
 iommu_remove(struct iommu_state *is, vaddr_t va, size_t len)
 {
-	int slot;
 
 #ifdef DIAGNOSTIC
 	if (va  is-is_dvmabase || va  is-is_dvmaend)
@@ -376,15 +363,8 @@
 		is-is_tsb[IOTSBSLOT(va,is-is_tsbsize)] = ~IOTTE_V;
 		membar_storestore();
 #endif
-		IOMMUREG_WRITE(is, iommu_flush, va);
-
-		/* Flush cache if necessary. */
-		slot = IOTSBSLOT(trunc_page(va), is-is_tsbsize);
-		if ((is-is_flags  IOMMU_FLUSH_CACHE) 
-		(len == 0 || (slot % 8) == 7))
-			IOMMUREG_WRITE(is, iommu_cache_flush,
-			is-is_ptsb + slot * 8);
-
+		bus_space_write_8(is-is_bustag, is-is_iommu,
+			IOMMUREG(iommu_flush), va);
 		va += PAGE_SIZE;
 	}
 }
@@ -473,7 +453,6 @@
 	vaddr_t vaddr = (vaddr_t)buf;
 	int seg;
 	struct pmap *pmap;
-	int slot;
 
 	if (map-dm_nsegs) {
 		/* Already in use?? */
@@ -510,7 +489,6 @@
 	 * If our segment size is larger than the boundary we need to
 	 * split the transfer up int little pieces ourselves.
 	 */
-	KASSERT(is-is_dvmamap);
 	s = splhigh();
 	err = extent_alloc(is-is_dvmamap, sgsize, align,
 	(sgsize  boundary) ? 0 : boundary,
@@ -619,17 +597,9 @@
 		flags |