CVS commit: src/lib/libc/time

2011-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 07:51:32 UTC 2011

Modified Files:
src/lib/libc/time: zdump.c

Log Message:
remove unneeded casts


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/time/zdump.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/time/zdump.c
diff -u src/lib/libc/time/zdump.c:1.20 src/lib/libc/time/zdump.c:1.21
--- src/lib/libc/time/zdump.c:1.20	Tue Aug 16 03:51:46 2011
+++ src/lib/libc/time/zdump.c	Wed Aug 24 03:51:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zdump.c,v 1.20 2011/08/16 07:51:46 christos Exp $	*/
+/*	$NetBSD: zdump.c,v 1.21 2011/08/24 07:51:31 christos Exp $	*/
 /*
 ** This file is in the public domain, so clarified as of
 ** 2009-05-17 by Arthur David Olson.
@@ -7,7 +7,7 @@
 #include sys/cdefs.h
 #ifndef lint
 #ifndef NOID
-__RCSID($NetBSD: zdump.c,v 1.20 2011/08/16 07:51:46 christos Exp $);
+__RCSID($NetBSD: zdump.c,v 1.21 2011/08/24 07:51:31 christos Exp $);
 #endif /* !defined NOID */
 #endif /* !defined lint */
 
@@ -138,7 +138,7 @@
 #if HAVE_GETTEXT
 #define _(msgid) gettext(msgid)
 #else /* !HAVE_GETTEXT */
-#define _(msgid) __UNCONST(msgid)
+#define _(msgid) msgid
 #endif /* !HAVE_GETTEXT */
 #endif /* !defined _ */
 
@@ -212,7 +212,7 @@
 const char * const	zone;
 {
 	register const char *	cp;
-	register char *		wp;
+	register const char *	wp;
 
 	if (warned)
 		return;



CVS commit: src/sys/arch/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 10:56:45 UTC 2011

Modified Files:
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: thunk.c

Log Message:
Implement thunk_malloc() and think_free()


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/usermode/usermode/thunk.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/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.15 src/sys/arch/usermode/include/thunk.h:1.16
--- src/sys/arch/usermode/include/thunk.h:1.15	Tue Aug 23 21:55:21 2011
+++ src/sys/arch/usermode/include/thunk.h	Wed Aug 24 10:56:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.15 2011/08/23 21:55:21 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.16 2011/08/24 10:56:45 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -83,9 +83,11 @@
 int	thunk_aio_error(const struct aiocb *);
 int	thunk_aio_return(struct aiocb *);
 
+void *	thunk_malloc(size_t len);
+void 	thunk_free(void *addr);
 void *	thunk_sbrk(intptr_t len);
 void *	thunk_mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset);
-int	thunk_munmap(void *Addr, size_t len);
+int	thunk_munmap(void *addr, size_t len);
 int	thunk_mprotect(void *addr, size_t len, int prot);
 
 #endif /* !_ARCH_USERMODE_INCLUDE_THUNK_H */

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.17 src/sys/arch/usermode/usermode/thunk.c:1.18
--- src/sys/arch/usermode/usermode/thunk.c:1.17	Tue Aug 23 21:55:21 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Wed Aug 24 10:56:44 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.17 2011/08/23 21:55:21 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.18 2011/08/24 10:56:44 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: thunk.c,v 1.17 2011/08/23 21:55:21 jmcneill Exp $);
+__RCSID($NetBSD: thunk.c,v 1.18 2011/08/24 10:56:44 reinoud Exp $);
 
 #include sys/types.h
 #include sys/ansi.h
@@ -289,6 +289,18 @@
 }
 
 void *
+thunk_malloc(size_t len)
+{
+	return malloc(len);
+}
+
+void
+thunk_free(void *addr)
+{
+	free(addr);
+}
+
+void *
 thunk_sbrk(intptr_t len)
 {
 	return sbrk(len);



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

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 10:57:48 UTC 2011

Modified Files:
src/sys/arch/usermode/include: vmparam.h

Log Message:
kmem_data_start is no longer needed


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/usermode/include/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/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.5 src/sys/arch/usermode/include/vmparam.h:1.6
--- src/sys/arch/usermode/include/vmparam.h:1.5	Mon Aug 22 21:45:38 2011
+++ src/sys/arch/usermode/include/vmparam.h	Wed Aug 24 10:57:48 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.5 2011/08/22 21:45:38 jmcneill Exp $ */
+/* $NetBSD: vmparam.h,v 1.6 2011/08/24 10:57:48 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -33,7 +33,6 @@
 #include opt_memsize.h
 
 extern paddr_t kmem_k_start, kmem_k_end;
-extern paddr_t kmem_data_start, kmem_data_end;
 extern paddr_t kmem_ext_start, kmem_ext_end;
 extern paddr_t kmem_user_start, kmem_user_end;
 



CVS commit: src/sys/arch/usermode

2011-08-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Aug 24 10:59:10 UTC 2011

Modified Files:
src/sys/arch/usermode/conf: GENERIC files.usermode
src/sys/arch/usermode/include: ptrace.h

Log Message:
add procfs support


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/conf/GENERIC
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/conf/files.usermode
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/usermode/include/ptrace.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/usermode/conf/GENERIC
diff -u src/sys/arch/usermode/conf/GENERIC:1.12 src/sys/arch/usermode/conf/GENERIC:1.13
--- src/sys/arch/usermode/conf/GENERIC:1.12	Tue Aug 23 12:27:01 2011
+++ src/sys/arch/usermode/conf/GENERIC	Wed Aug 24 10:59:10 2011
@@ -1,9 +1,9 @@
-# $NetBSD: GENERIC,v 1.12 2011/08/23 12:27:01 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.13 2011/08/24 10:59:10 jmcneill Exp $
 
 include arch/usermode/conf/std.usermode
 
 options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC-$Revision: 1.12 $
+#ident 		GENERIC-$Revision: 1.13 $
 maxusers 	32
 
 makeoptions	DEBUG=-O1 -g3
@@ -29,6 +29,7 @@
 file-system	FFS
 file-system	FDESC
 file-system	KERNFS
+file-system	PROCFS
 file-system	TMPFS
 
 options 	INET

Index: src/sys/arch/usermode/conf/files.usermode
diff -u src/sys/arch/usermode/conf/files.usermode:1.4 src/sys/arch/usermode/conf/files.usermode:1.5
--- src/sys/arch/usermode/conf/files.usermode:1.4	Fri Aug 12 12:59:13 2011
+++ src/sys/arch/usermode/conf/files.usermode	Wed Aug 24 10:59:10 2011
@@ -1,4 +1,4 @@
-# $NetBSD: files.usermode,v 1.4 2011/08/12 12:59:13 jmcneill Exp $
+# $NetBSD: files.usermode,v 1.5 2011/08/24 10:59:10 jmcneill Exp $
 
 maxpartitions 8
 maxusers 8 16 64
@@ -30,6 +30,7 @@
 file	arch/usermode/usermode/machdep.c
 file	arch/usermode/usermode/pmap.c
 file	arch/usermode/usermode/process_machdep.c
+file	arch/usermode/usermode/procfs_machdep.c	procfs
 file	arch/usermode/usermode/sys_machdep.c
 file	arch/usermode/usermode/syscall.c
 file	arch/usermode/usermode/trap.c

Index: src/sys/arch/usermode/include/ptrace.h
diff -u src/sys/arch/usermode/include/ptrace.h:1.3 src/sys/arch/usermode/include/ptrace.h:1.4
--- src/sys/arch/usermode/include/ptrace.h:1.3	Wed Oct 21 16:06:59 2009
+++ src/sys/arch/usermode/include/ptrace.h	Wed Aug 24 10:59:10 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.h,v 1.3 2009/10/21 16:06:59 snj Exp $ */
+/* $NetBSD: ptrace.h,v 1.4 2011/08/24 10:59:10 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -31,5 +31,6 @@
 
 #include /usr/include/machine/ptrace.h
 #undef __HAVE_PTRACE_MACHDEP
+#undef __HAVE_PROCFS_MACHDEP
 
 #endif /* !_ARCH_USERMODE_INCLUDE_PTRACE_H */



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Aug 24 10:59:37 UTC 2011

Added Files:
src/sys/arch/usermode/usermode: procfs_machdep.c

Log Message:
add procfs support


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/usermode/usermode/procfs_machdep.c

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

Added files:

Index: src/sys/arch/usermode/usermode/procfs_machdep.c
diff -u /dev/null src/sys/arch/usermode/usermode/procfs_machdep.c:1.1
--- /dev/null	Wed Aug 24 10:59:37 2011
+++ src/sys/arch/usermode/usermode/procfs_machdep.c	Wed Aug 24 10:59:37 2011
@@ -0,0 +1,42 @@
+/* $NetBSD: procfs_machdep.c,v 1.1 2011/08/24 10:59:37 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__RCSID($NetBSD: procfs_machdep.c,v 1.1 2011/08/24 10:59:37 jmcneill Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+
+#include miscfs/procfs/procfs.h
+
+int
+procfs_getcpuinfstr(char *bf, int *len)
+{
+	*len = 0;
+	return 0;
+}



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 11:02:31 UTC 2011

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

Log Message:
First pass of NetBSD/usermode's pmap.c cleanup:
* use thunk_malloc() for UVM space allocation releasing sbrk()
* make pmap.c 64 bit friendly for large page numbers


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.25 src/sys/arch/usermode/usermode/pmap.c:1.26
--- src/sys/arch/usermode/usermode/pmap.c:1.25	Tue Aug 23 18:37:51 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 11:02:31 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.25 2011/08/23 18:37:51 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.26 2011/08/24 11:02:31 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.25 2011/08/23 18:37:51 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.26 2011/08/24 11:02:31 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -43,10 +43,10 @@
 #include uvm/uvm.h
 
 struct pv_entry {
-	struct 	pv_entry *pv_next;
-	pmap_t	pv_pmap;
-	int	pv_ppn;		/* physical page number */
-	int	pv_lpn;		/* logical page number  */
+	struct 		pv_entry *pv_next;
+	pmap_t		pv_pmap;
+	uintptr_t	pv_ppn;		/* physical page number */
+	uintptr_t	pv_lpn;		/* logical page number  */
 	vm_prot_t	pv_prot;	/* logical protection */
 	int		pv_mmap_ppl;	/* programmed protection */
 	uint8_t		pv_vflags;	/* per mapping flags */
@@ -71,8 +71,9 @@
 static struct pmap	pmap_kernel_store;
 struct pmap * const	kernel_pmap_ptr = pmap_kernel_store;
 
-static char mem_name[20] = ;
-static int mem_fh;
+static char  mem_name[20] = ;
+static int   mem_fh;
+static void *mem_uvm;	/* keeps all memory managed by UVM */
 
 static int phys_npages = 0;
 static int pm_nentries = 0;
@@ -84,17 +85,15 @@
 void		pmap_bootstrap(void);
 static void	pmap_page_activate(struct pv_entry *pv);
 static void	pv_update(struct pv_entry *pv);
-static void	pmap_update_page(int ppn);
+static void	pmap_update_page(uintptr_t ppn);
 
-static struct 	pv_entry *pv_get(pmap_t pmap, int ppn, int lpn);
+static struct 	pv_entry *pv_get(pmap_t pmap, uintptr_t ppn, uintptr_t lpn);
 static struct 	pv_entry *pv_alloc(void);
 static void	pv_free(struct pv_entry *pv);
-//void	pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva);
 static void	pmap_deferred_init(void);
 
 /* exposed to signal handler */
 vaddr_t kmem_k_start, kmem_k_end;
-vaddr_t kmem_data_start, kmem_data_end;
 vaddr_t kmem_ext_start, kmem_ext_end;
 vaddr_t kmem_user_start, kmem_user_end;
 vaddr_t kmem_ext_cur_start, kmem_ext_cur_end;
@@ -106,13 +105,16 @@
 	ssize_t fpos, file_len;
 	ssize_t pv_fpos, pm_fpos;
 	ssize_t wlen;
-	uint64_t pv_table_size;
-	paddr_t free_start, free_end;
+	ssize_t kmem_len, user_len, barrier_len, uvm_len;
+	ssize_t pv_table_size;
+	vaddr_t free_start, free_end;
+	vaddr_t mpos;
 	paddr_t pa;
 	vaddr_t va;
+	uintptr_t pg;
 	void *addr;
 	char dummy;
-	int pg, err;
+	int err;
 
 	extern void _init(void);	/* start of kernel   */
 	extern int etext;		/* end of the kernel */
@@ -126,56 +128,52 @@
 	aprint_debug(1st end of data at %p\n, end);
 	aprint_debug(CUR end dataat %p\n, thunk_sbrk(0));
 
-	/* calculate sections of the kernel (R+X) */
+	/* calculate memory lengths */
+	kmem_len= (physmem/2) * PAGE_SIZE;
+	user_len= MEMSIZE * 1024;
+	barrier_len = 2 * 1024 * 1024;
+
+	/* calculate kernel section (R-X) */
 	kmem_k_start = (vaddr_t) PAGE_SIZE * (atop(_init)   );
 	kmem_k_end   = (vaddr_t) PAGE_SIZE * (atop(etext) + 1);
 
-	/* read only section (for userland R, kernel RW) */
-	kmem_data_start = (vaddr_t) PAGE_SIZE * (atop(etext));
-	kmem_data_end   = (vaddr_t) PAGE_SIZE * (atop(end) + 1);
-	if (kmem_data_end  (vaddr_t) thunk_sbrk(0)) {
-		aprint_debug(sbrk() has advanced, catching up\n);
-		kmem_data_end = (vaddr_t) PAGE_SIZE * (atop(thunk_sbrk(0))+1);
-	}
-
-#ifdef DIAGNOSTIC
-	if (kmem_k_end = kmem_data_start) {
-		aprint_debug(end of kernel and kernel exec could clash\n);
-		aprint_debug(   kmem_k_end = %p, kmem_data_start = %p\n,
-			(void *) kmem_k_end, (void *) kmem_data_start);
-		aprint_debug(fixing\n);
-	}
-#endif
-	/* on clash move RO segment so that all code is executable */
-	if (kmem_k_end = kmem_data_start)
-		kmem_data_start = kmem_k_end;
-
-	/* claim an area for kernel data space growth (over dim) */
-	kmem_ext_start   = kmem_data_end;
-	kmem_ext_end = kmem_ext_start + (physmem/2) * PAGE_SIZE;
-
-	/* claim an area for userland */
-	kmem_user_start = kmem_ext_end;
-	kmem_user_end   = kmem_user_start + 1024 * MEMSIZE;
+	/* claim memory with 2 pages more */
+	uvm_len = 

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

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 11:26:43 UTC 2011

Modified Files:
src/sys/arch/usermode/include: vmparam.h

Log Message:
Fix vmparam's definitions to the new style


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/include/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/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.6 src/sys/arch/usermode/include/vmparam.h:1.7
--- src/sys/arch/usermode/include/vmparam.h:1.6	Wed Aug 24 10:57:48 2011
+++ src/sys/arch/usermode/include/vmparam.h	Wed Aug 24 11:26:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.6 2011/08/24 10:57:48 reinoud Exp $ */
+/* $NetBSD: vmparam.h,v 1.7 2011/08/24 11:26:43 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -37,8 +37,8 @@
 extern paddr_t kmem_user_start, kmem_user_end;
 
 #define VM_MIN_KERNEL_ADDRESS	kmem_k_start
-#define VM_MAX_KERNEL_ADDRESS 	kmem_ext_end
-#define VM_MIN_ADDRESS		kmem_k_start
+#define VM_MAX_KERNEL_ADDRESS 	kmem_k_end
+#define VM_MIN_ADDRESS		kmem_ext_start
 #define VM_MAX_ADDRESS		kmem_user_end
 #define VM_MAXUSER_ADDRESS	kmem_user_end
 



CVS commit: src/sys/dev/usb

2011-08-24 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Wed Aug 24 11:28:51 UTC 2011

Modified Files:
src/sys/dev/usb: umass.c umass_isdata.c umass_quirks.c umass_scsipi.c

Log Message:
Wrap the include opt_umass.h in #ifdef _KERNEL_OPT.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/usb/umass.c
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/usb/umass_isdata.c
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/usb/umass_quirks.c
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/umass_scsipi.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.140 src/sys/dev/usb/umass.c:1.141
--- src/sys/dev/usb/umass.c:1.140	Tue Aug 23 16:16:43 2011
+++ src/sys/dev/usb/umass.c	Wed Aug 24 11:28:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass.c,v 1.140 2011/08/23 16:16:43 christos Exp $	*/
+/*	$NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -124,9 +124,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass.c,v 1.140 2011/08/23 16:16:43 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass.c,v 1.141 2011/08/24 11:28:50 mbalmer Exp $);
 
+#ifdef _KERNEL_OPT
 #include opt_umass.h
+#endif
 
 #include atapibus.h
 #include scsibus.h

Index: src/sys/dev/usb/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.20 src/sys/dev/usb/umass_isdata.c:1.21
--- src/sys/dev/usb/umass_isdata.c:1.20	Tue Aug 23 16:16:43 2011
+++ src/sys/dev/usb/umass_isdata.c	Wed Aug 24 11:28:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_isdata.c,v 1.20 2011/08/23 16:16:43 christos Exp $	*/
+/*	$NetBSD: umass_isdata.c,v 1.21 2011/08/24 11:28:50 mbalmer Exp $	*/
 
 /*
  * TODO:
@@ -37,9 +37,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass_isdata.c,v 1.20 2011/08/23 16:16:43 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass_isdata.c,v 1.21 2011/08/24 11:28:50 mbalmer Exp $);
 
+#ifdef _KERNEL_OPT
 #include opt_umass.h
+#endif
 
 #include sys/param.h
 #include sys/systm.h

Index: src/sys/dev/usb/umass_quirks.c
diff -u src/sys/dev/usb/umass_quirks.c:1.86 src/sys/dev/usb/umass_quirks.c:1.87
--- src/sys/dev/usb/umass_quirks.c:1.86	Tue Aug 23 16:16:43 2011
+++ src/sys/dev/usb/umass_quirks.c	Wed Aug 24 11:28:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_quirks.c,v 1.86 2011/08/23 16:16:43 christos Exp $	*/
+/*	$NetBSD: umass_quirks.c,v 1.87 2011/08/24 11:28:50 mbalmer Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -32,9 +32,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass_quirks.c,v 1.86 2011/08/23 16:16:43 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass_quirks.c,v 1.87 2011/08/24 11:28:50 mbalmer Exp $);
 
+#ifdef _KERNEL_OPT
 #include opt_umass.h
+#endif
 
 #include sys/param.h
 #include sys/systm.h

Index: src/sys/dev/usb/umass_scsipi.c
diff -u src/sys/dev/usb/umass_scsipi.c:1.37 src/sys/dev/usb/umass_scsipi.c:1.38
--- src/sys/dev/usb/umass_scsipi.c:1.37	Tue Aug 23 16:16:43 2011
+++ src/sys/dev/usb/umass_scsipi.c	Wed Aug 24 11:28:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_scsipi.c,v 1.37 2011/08/23 16:16:43 christos Exp $	*/
+/*	$NetBSD: umass_scsipi.c,v 1.38 2011/08/24 11:28:50 mbalmer Exp $	*/
 
 /*
  * Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
@@ -31,9 +31,11 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass_scsipi.c,v 1.37 2011/08/23 16:16:43 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass_scsipi.c,v 1.38 2011/08/24 11:28:50 mbalmer Exp $);
 
+#ifdef _KERNEL_OPT
 #include opt_umass.h
+#endif
 
 #include atapibus.h
 #include scsibus.h



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 11:30:59 UTC 2011

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

Log Message:
Use the VM_MIN_ADDRESS `constant' for the offset calculation of virtual
address to a logical page address.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.26 src/sys/arch/usermode/usermode/pmap.c:1.27
--- src/sys/arch/usermode/usermode/pmap.c:1.26	Wed Aug 24 11:02:31 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 11:30:59 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.26 2011/08/24 11:02:31 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.27 2011/08/24 11:30:59 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.26 2011/08/24 11:02:31 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.27 2011/08/24 11:30:59 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -414,7 +414,7 @@
 pmap_page_activate(struct pv_entry *pv)
 {
 	paddr_t pa = pv-pv_ppn * PAGE_SIZE;
-	vaddr_t va = pv-pv_lpn * PAGE_SIZE + kmem_ext_start; /* XXX V-A make new var */
+	vaddr_t va = pv-pv_lpn * PAGE_SIZE + VM_MIN_ADDRESS; /* V-A */
 
 	void *addr;
 
@@ -471,7 +471,7 @@
 
 	/* to page numbers */
 	ppn = atop(pa);
-	lpn = atop(va - kmem_ext_start);	/* XXX V-A make new var */
+	lpn = atop(va - VM_MIN_ADDRESS);	/* V-A */
 #ifdef DIAGNOSTIC
 	if ((va  kmem_k_start) || (va  kmem_user_end))
 		panic(pmap_do_enter: invalid va isued\n);
@@ -630,7 +630,7 @@
 
 	/* TODO protect against roque values */
 	aprint_debug(pmap_extract: extracting va %p\n, (void *) va);
-	pv = pmap-pm_entries[atop(va - kmem_ext_start)];	/* XXX V-A make new var */
+	pv = pmap-pm_entries[atop(va - VM_MIN_ADDRESS)]; /* V-A */
 
 	if (pv == NULL)
 		return false;



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 11:41:00 UTC 2011

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

Log Message:
Cleanup comments and debug stuff


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.27 src/sys/arch/usermode/usermode/pmap.c:1.28
--- src/sys/arch/usermode/usermode/pmap.c:1.27	Wed Aug 24 11:30:59 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 11:41:00 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.27 2011/08/24 11:30:59 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.28 2011/08/24 11:41:00 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.27 2011/08/24 11:30:59 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.28 2011/08/24 11:41:00 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -415,13 +415,13 @@
 {
 	paddr_t pa = pv-pv_ppn * PAGE_SIZE;
 	vaddr_t va = pv-pv_lpn * PAGE_SIZE + VM_MIN_ADDRESS; /* V-A */
-
 	void *addr;
 
+	aprint_debug(page_activate: (va %p, pa %p, ppl %d) - %p\n,
+		(void *) va, (void *) pa, pv-pv_mmap_ppl, (void *) addr);
 	addr = thunk_mmap((void *) va, PAGE_SIZE, pv-pv_mmap_ppl,
 		MAP_FILE | MAP_FIXED,
 		mem_fh, pa);
-aprint_debug(page_activate: (va %p, pa %p, ppl %d) - %p\n, (void *) va, (void *) pa, pv-pv_mmap_ppl, (void *) addr);
 	if (addr != (void *) va)
 		panic(pmap_page_activate: mmap failed);
 }



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 11:50:28 UTC 2011

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

Log Message:
Duh... fix stupid debug print bug.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.28 src/sys/arch/usermode/usermode/pmap.c:1.29
--- src/sys/arch/usermode/usermode/pmap.c:1.28	Wed Aug 24 11:41:00 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 11:50:28 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.28 2011/08/24 11:41:00 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.29 2011/08/24 11:50:28 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.28 2011/08/24 11:41:00 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.29 2011/08/24 11:50:28 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -417,11 +417,11 @@
 	vaddr_t va = pv-pv_lpn * PAGE_SIZE + VM_MIN_ADDRESS; /* V-A */
 	void *addr;
 
-	aprint_debug(page_activate: (va %p, pa %p, ppl %d) - %p\n,
-		(void *) va, (void *) pa, pv-pv_mmap_ppl, (void *) addr);
 	addr = thunk_mmap((void *) va, PAGE_SIZE, pv-pv_mmap_ppl,
 		MAP_FILE | MAP_FIXED,
 		mem_fh, pa);
+	aprint_debug(page_activate: (va %p, pa %p, ppl %d) - %p\n,
+		(void *) va, (void *) pa, pv-pv_mmap_ppl, (void *) addr);
 	if (addr != (void *) va)
 		panic(pmap_page_activate: mmap failed);
 }



CVS commit: src/sbin/sysctl

2011-08-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Aug 24 12:15:45 UTC 2011

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

Log Message:
Instead of using strncat and re-scanning the strings all the time, use and
append printf function.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sbin/sysctl/sysctl.c

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

Modified files:

Index: src/sbin/sysctl/sysctl.c
diff -u src/sbin/sysctl/sysctl.c:1.136 src/sbin/sysctl/sysctl.c:1.137
--- src/sbin/sysctl/sysctl.c:1.136	Tue Aug  2 21:58:30 2011
+++ src/sbin/sysctl/sysctl.c	Wed Aug 24 08:15:44 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysctl.c,v 1.136 2011/08/03 01:58:30 christos Exp $ */
+/*	$NetBSD: sysctl.c,v 1.137 2011/08/24 12:15:44 christos Exp $ */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 #if 0
 static char sccsid[] = @(#)sysctl.c	8.1 (Berkeley) 6/6/93;
 #else
-__RCSID($NetBSD: sysctl.c,v 1.136 2011/08/03 01:58:30 christos Exp $);
+__RCSID($NetBSD: sysctl.c,v 1.137 2011/08/24 12:15:44 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -554,6 +554,21 @@
 	rnode-sysctl_desc = NULL;
 }
 
+static void __attribute__((__format__(__printf__, 3, 4)))
+appendprintf(char **bp, size_t *lbp, const char *fmt, ...)
+{
+	int r;
+	va_list ap;
+
+	va_start(ap, fmt);
+	r = vsnprintf(*bp, *lbp, fmt, ap);
+	va_end(ap);
+	if (r  0 || (size_t)r  *lbp)
+		r = *lbp;
+	*bp += r;
+	*lbp -= r;
+}
+
 /*
  * 
  * print this node and any others underneath it
@@ -565,35 +580,31 @@
 {
 	struct sysctlnode *node;
 	int rc;
-	size_t ni, sz;
-	char *sp, *dp, n[20];
+	size_t ni, sz, ldp, lsp;
+	char *sp, *dp, *tsp, *tdp;
 	const struct handlespec *p;
 
-	sp = gsname[strlen(gsname)];
-	dp = gdname[strlen(gdname)];
+	sp = tsp = gsname[strlen(gsname)];
+	dp = tdp = gdname[strlen(gdname)];
+	ldp = sizeof(gdname) - (dp - gdname);
+	lsp = sizeof(gsname) - (sp - gsname);
 
 	if (sp != gsname[0]  dp == gdname[0]) {
 		/*
 		 * aw...shucks.  now we must play catch up
 		 */
-		for (ni = 0; ni  namelen; ni++) {
-			(void)snprintf(n, sizeof(n), %d, name[ni]);
-			if (ni  0)
-strncat(gdname, ., sizeof(gdname));
-			strncat(gdname, n, sizeof(gdname));
-		}
+		for (ni = 0; ni  namelen; ni++)
+			appendprintf(tdp, ldp, %s%d, ni  0 ? . : ,
+			name[ni]);
 	}
 
 	if (pnode == NULL)
 		pnode = my_root;
 	else if (add) {
-		snprintf(n, sizeof(n), %d, pnode-sysctl_num);
-		if (namelen  1) {
-			strncat(gsname, sep, sizeof(gsname));
-			strncat(gdname, ., sizeof(gdname));
-		}
-		strncat(gsname, pnode-sysctl_name, sizeof(gsname));
-		strncat(gdname, n, sizeof(gdname));
+		appendprintf(tsp, lsp, %s%s, namelen  1 ? sep : , 
+			pnode-sysctl_name);
+		appendprintf(tdp, ldp, %s%d, namelen  1 ? . : , 
+			pnode-sysctl_num);
 	}
 
 	if (Mflag  pnode != my_root) {



CVS commit: src/sys/arch/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 12:54:47 UTC 2011

Modified Files:
src/sys/arch/usermode/include: vmparam.h
src/sys/arch/usermode/usermode: pmap.c

Log Message:
Swap userland code and kvm spaces so that userland lives from VM_MIN_ADDRESS
to VM_MAXUSER_ADDRESS and KVM is above that.

Note that the userspace is surrounded by a configurable amount of
non-accessible barrier space to prevent accidental out-of-boundaries access
even when reading.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/usermode/include/vmparam.h
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/usermode/usermode/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/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.7 src/sys/arch/usermode/include/vmparam.h:1.8
--- src/sys/arch/usermode/include/vmparam.h:1.7	Wed Aug 24 11:26:43 2011
+++ src/sys/arch/usermode/include/vmparam.h	Wed Aug 24 12:54:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.7 2011/08/24 11:26:43 reinoud Exp $ */
+/* $NetBSD: vmparam.h,v 1.8 2011/08/24 12:54:47 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -38,9 +38,9 @@
 
 #define VM_MIN_KERNEL_ADDRESS	kmem_k_start
 #define VM_MAX_KERNEL_ADDRESS 	kmem_k_end
-#define VM_MIN_ADDRESS		kmem_ext_start
-#define VM_MAX_ADDRESS		kmem_user_end
+#define VM_MIN_ADDRESS		kmem_user_start
 #define VM_MAXUSER_ADDRESS	kmem_user_end
+#define VM_MAX_ADDRESS		kmem_ext_end
 
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 #define VM_PHYSSEG_MAX		1

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.29 src/sys/arch/usermode/usermode/pmap.c:1.30
--- src/sys/arch/usermode/usermode/pmap.c:1.29	Wed Aug 24 11:50:28 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 12:54:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.29 2011/08/24 11:50:28 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.30 2011/08/24 12:54:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.29 2011/08/24 11:50:28 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.30 2011/08/24 12:54:46 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -143,11 +143,6 @@
 	/* make page aligned */
 	mpos = round_page((vaddr_t) mem_uvm) + PAGE_SIZE;
 
-	/* calculate KVM section (RW-) */
-	kmem_ext_start = mpos;
-	mpos += kmem_len;
-	kmem_ext_end   = mpos;
-
 	/* low barrier (---) */
 	mpos += barrier_len;
 
@@ -160,6 +155,11 @@
 	/* upper barrier (---) */
 	mpos += barrier_len;
 
+	/* calculate KVM section (RW-) */
+	kmem_ext_start = mpos;
+	mpos += kmem_len;
+	kmem_ext_end   = mpos;
+
 #if 0
 	/* protect complete UVM area (---) */
 	addr = thunk_mmap((void*) mem_uvm,
@@ -197,7 +197,7 @@
 	if (wlen != 1)
 		panic(pmap_bootstrap: can't grow file\n);
 
-	/* (un)protect the current kernel and data sections */
+	/* protect the current kernel section */
 	/* XXX kernel stack? */
 	err = thunk_mprotect((void *) kmem_k_start, kmem_k_end - kmem_k_start,
 		PROT_READ | PROT_EXEC);
@@ -210,6 +210,7 @@
 
 	phys_npages = (free_end - free_start) / PAGE_SIZE;
 	pv_table_size = round_page(phys_npages * sizeof(struct pv_entry));
+
 	aprint_debug(claiming %PRIu64 KB of pv_table for 
 		%PRIdPTR pages of physical memory\n,
 		(uint64_t) pv_table_size/1024, (uintptr_t) phys_npages);
@@ -233,7 +234,7 @@
 	fpos += pv_table_size;
 
 	/* set up kernel pmap */
-	pm_nentries = (kmem_user_end - kmem_ext_start) / PAGE_SIZE;
+	pm_nentries = (VM_MAX_ADDRESS - VM_MIN_ADDRESS) / PAGE_SIZE;
 	pm_entries_size = round_page(pm_nentries * sizeof(struct pv_entry *));
 	aprint_debug(pmap va-pa lookup table is %PRIu64 KB for %d logical pages\n,
 		pm_entries_size/1024, pm_nentries);
@@ -473,7 +474,7 @@
 	ppn = atop(pa);
 	lpn = atop(va - VM_MIN_ADDRESS);	/* V-A */
 #ifdef DIAGNOSTIC
-	if ((va  kmem_k_start) || (va  kmem_user_end))
+	if ((va  VM_MIN_ADDRESS) || (va  VM_MAX_ADDRESS))
 		panic(pmap_do_enter: invalid va isued\n);
 #endif
 



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

2011-08-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 24 15:11:52 UTC 2011

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

Log Message:
On N32 kernels, cast offset to (intptr_t) to shrink it back to 32-bits.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/mips_fixup.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/mips_fixup.c
diff -u src/sys/arch/mips/mips/mips_fixup.c:1.7 src/sys/arch/mips/mips/mips_fixup.c:1.8
--- src/sys/arch/mips/mips/mips_fixup.c:1.7	Wed Aug 17 14:39:59 2011
+++ src/sys/arch/mips/mips/mips_fixup.c	Wed Aug 24 15:11:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_fixup.c,v 1.7 2011/08/17 14:39:59 matt Exp $	*/
+/*	$NetBSD: mips_fixup.c,v 1.8 2011/08/24 15:11:52 matt Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mips_fixup.c,v 1.7 2011/08/17 14:39:59 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_fixup.c,v 1.8 2011/08/24 15:11:52 matt Exp $);
 
 #include opt_mips3_wired.h
 #include opt_multiprocessor.h
@@ -280,7 +280,8 @@
 goto out;
 			}
 			regs[insn.IType.rt] = *(const int32_t *)
-			(regs[insn.IType.rs] + (int16_t)insn.IType.imm);
+			((intptr_t)regs[insn.IType.rs]
+			+ (int16_t)insn.IType.imm);
 			used |= (1  insn.IType.rt);
 			break;
 #endif



CVS commit: src/sys/arch/mips

2011-08-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 24 16:01:53 UTC 2011

Modified Files:
src/sys/arch/mips/include: vmparam.h
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
When using 16KB pages in a 64 bit kernel, the amount of address space our page
table can address can be larger than the amount of address space the CPU
implementation supports.  This change limits the amount address space to what
the CPU implementation provides.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/mips/include/vmparam.h
cvs rdiff -u -r1.246 -r1.247 src/sys/arch/mips/mips/mips_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/mips/include/vmparam.h
diff -u src/sys/arch/mips/include/vmparam.h:1.49 src/sys/arch/mips/include/vmparam.h:1.50
--- src/sys/arch/mips/include/vmparam.h:1.49	Thu Jul 21 23:03:39 2011
+++ src/sys/arch/mips/include/vmparam.h	Wed Aug 24 16:01:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmparam.h,v 1.49 2011/07/21 23:03:39 macallan Exp $	*/
+/*	$NetBSD: vmparam.h,v 1.50 2011/08/24 16:01:53 matt Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -155,7 +155,12 @@
  */
 #define VM_MIN_ADDRESS		((vaddr_t)0x)
 #ifdef _LP64
-#define VM_MAXUSER_ADDRESS	((vaddr_t) 1L  (4*PGSHIFT-8))
+#define MIPS_VM_MAXUSER_ADDRESS	((vaddr_t) 1L  (4*PGSHIFT-8))
+#ifdef ENABLE_MIPS_16KB_PAGE
+#define VM_MAXUSER_ADDRESS	mips_vm_maxuser_address
+#else
+#define VM_MAXUSER_ADDRESS	MIPS_VM_MAXUSER_ADDRESS
+#endif
 			/* 0x0100 */
 #define VM_MAX_ADDRESS		VM_MAXUSER_ADDRESS
 #define VM_MIN_KERNEL_ADDRESS	((vaddr_t) 3L  62)	/* 0xC000 */
@@ -197,6 +202,9 @@
 #ifdef _KERNEL
 #define	UVM_KM_VMFREELIST	mips_poolpage_vmfreelist
 extern int mips_poolpage_vmfreelist;
+#ifdef ENABLE_MIPS_16KB_PAGE
+extern vaddr_t mips_vm_maxuser_address;
+#endif
 #endif
 
 #endif /* ! _MIPS_VMPARAM_H_ */

Index: src/sys/arch/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.246 src/sys/arch/mips/mips/mips_machdep.c:1.247
--- src/sys/arch/mips/mips/mips_machdep.c:1.246	Tue Aug 16 06:58:15 2011
+++ src/sys/arch/mips/mips/mips_machdep.c	Wed Aug 24 16:01:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.246 2011/08/16 06:58:15 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.246 2011/08/16 06:58:15 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: mips_machdep.c,v 1.247 2011/08/24 16:01:53 matt Exp $);
 
 #define __INTR_PRIVATE
 #include opt_cputype.h
@@ -193,6 +193,10 @@
 static void mips_watchpoint_init(void);
 #endif
 
+#if defined(_LP64)  defined(ENABLE_MIPS_16KB_PAGE)
+vaddr_t mips_vm_maxuser_address = MIPS_VM_MAXUSER_ADDRESS;
+#endif
+
 #if defined(MIPS3_PLUS)
 uint32_t mips3_cp0_tlb_page_mask_probe(void);
 uint64_t mips3_cp0_tlb_entry_hi_probe(void);
@@ -1357,6 +1361,16 @@
 		opts-mips3_tlb_vpn_mask = 2;
 		opts-mips3_tlb_vpn_mask = 2;
 		opts-mips3_tlb_pfn_mask = mips3_cp0_tlb_entry_lo_probe();
+#if defined(_LP64)  defined(ENABLE_MIPS_16KB_PAGE)
+		/*
+		 * 16KB pages could cause our page table being able to address
+		 * a larger address space than the actual chip supports.  So
+		 * we need to limit the address space to what it can really
+		 * address.
+		 */
+		if (mips_vm_maxuser_address  opts-mips3_tlb_vpn_mask + 1)
+			mips_vm_maxuser_address = opts-mips3_tlb_vpn_mask + 1;
+#endif
 	}
 }
 #endif



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

2011-08-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 24 16:02:27 UTC 2011

Added Files:
src/sys/arch/evbmips/conf: GDIUM64

Log Message:
Add a 64-bit GDIUM configuration.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbmips/conf/GDIUM64

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

Added files:

Index: src/sys/arch/evbmips/conf/GDIUM64
diff -u /dev/null src/sys/arch/evbmips/conf/GDIUM64:1.1
--- /dev/null	Wed Aug 24 16:02:27 2011
+++ src/sys/arch/evbmips/conf/GDIUM64	Wed Aug 24 16:02:26 2011
@@ -0,0 +1,12 @@
+# $NetBSD: GDIUM64,v 1.1 2011/08/24 16:02:26 matt Exp $
+#
+include arch/evbmips/conf/GDIUM
+
+makeoptions	LP64=yes
+
+options 	EXEC_ELF64
+options 	COMPAT_NETBSD32
+#no options 	SYMTAB_SPACE
+#options 	SYMTAB_SPACE=47	# size for embedded symbol table
+
+#options 	UVMHIST, UVMHIST_PRINT



CVS commit: src/etc/etc.evbmips

2011-08-24 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Aug 24 16:03:34 UTC 2011

Modified Files:
src/etc/etc.evbmips: Makefile.inc

Log Message:
Build the GDIUM64 kernel (since it tests 16KB pages).


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/etc/etc.evbmips/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/etc/etc.evbmips/Makefile.inc
diff -u src/etc/etc.evbmips/Makefile.inc:1.16 src/etc/etc.evbmips/Makefile.inc:1.17
--- src/etc/etc.evbmips/Makefile.inc:1.16	Mon Aug  1 23:18:10 2011
+++ src/etc/etc.evbmips/Makefile.inc	Wed Aug 24 16:03:34 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.16 2011/08/01 23:18:10 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.17 2011/08/24 16:03:34 matt Exp $
 #
 #	etc.evbmips/Makefile.inc -- evbmips-specific etc Makefile targets
 #
@@ -22,6 +22,7 @@
 
 .if ${MACHINE_ARCH} == mips64el
 KERNEL_SETS+=		P5064-64
+KERNEL_SETS+=		GDIUM64
 .endif
 .else
 KERNEL_SETS=		ALCHEMY DB120 DBAU1500 DBAU1550 MALTA RB433UAH



CVS commit: src/games/hack

2011-08-24 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Aug 24 17:39:32 UTC 2011

Modified Files:
src/games/hack: Makefile

Log Message:
-Wno-shadow is no longer needed for HAVE_PCC, here


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/games/hack/Makefile

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

Modified files:

Index: src/games/hack/Makefile
diff -u src/games/hack/Makefile:1.44 src/games/hack/Makefile:1.45
--- src/games/hack/Makefile:1.44	Tue Aug 16 09:26:22 2011
+++ src/games/hack/Makefile	Wed Aug 24 17:39:32 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.44 2011/08/16 09:26:22 christos Exp $
+#	$NetBSD: Makefile,v 1.45 2011/08/24 17:39:32 plunky Exp $
 #	@(#)Makefile	8.2 (Berkeley) 4/27/95
 
 .include bsd.own.mk
@@ -37,10 +37,6 @@
 
 hack.h:	hack.onames.h
 
-.if defined(HAVE_PCC)
-COPTS.hack.bones.c+=	-Wno-shadow
-COPTS.hack.do.c+=	-Wno-shadow
-.endif
 COPTS.hack.mon.c+=	-Wno-format-nonliteral
 COPTS.hack.rip.c+=	-Wno-format-nonliteral
 



CVS commit: src/sys/arch/evbmips/gdium

2011-08-24 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 24 19:03:02 UTC 2011

Modified Files:
src/sys/arch/evbmips/gdium: machdep.c

Log Message:
fix up the environment pointers to be usable in LP64


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbmips/gdium/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/evbmips/gdium/machdep.c
diff -u src/sys/arch/evbmips/gdium/machdep.c:1.15 src/sys/arch/evbmips/gdium/machdep.c:1.16
--- src/sys/arch/evbmips/gdium/machdep.c:1.15	Sun Jul 10 00:03:53 2011
+++ src/sys/arch/evbmips/gdium/machdep.c	Wed Aug 24 19:03:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.15 2011/07/10 00:03:53 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.16 2011/08/24 19:03:02 macallan Exp $	*/
 
 /*
  * Copyright 2001, 2002 Wasabi Systems, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.15 2011/07/10 00:03:53 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.16 2011/08/24 19:03:02 macallan Exp $);
 
 #include opt_ddb.h
 #include opt_execfmt.h
@@ -194,7 +194,7 @@
  * Do all the stuff that locore normally does before calling main().
  */
 void
-mach_init(int argc, char **argv, char **envp, void *callvec)
+mach_init(int argc, char **argv, char **envp32, void *callvec)
 {
 	struct gdium_config *gc = gdium_configuration;
 	void *kernend;
@@ -204,7 +204,8 @@
 #endif
 	int i;
 	psize_t memsize;
-
+	char *envp[128];
+	int32_t *eptrs = (int32_t *)envp32; 
 	extern char edata[], end[];
 
 	/*
@@ -214,6 +215,19 @@
 	memset(edata, 0, (char *)kernend - edata);
 
 	/*
+	 * the pointer array in envp32 is 32bit - we need to sign extend them
+	 * and put them into a list of actual pointers
+	 * Only strictly necessary on LP64 but it doesn't hurt in LP32, runs only
+	 * once at startup and I'd rather not pollute this file with another
+	 * #ifdef orgy
+	 */
+	i = 0;
+	while ((eptrs[i] != 0)  (i  128)) {
+		envp[i] = (char *)(intptr_t)eptrs[i];	/* sign extend */
+		i++;
+	}
+
+	/*
 	 * Set up the exception vectors and CPU-specific function
 	 * vectors early on.  We need the wbflush() vector set up
 	 * before comcnattach() is called (or at least before the
@@ -255,7 +269,7 @@
 			break;
 		}
 	}
-	
+
 	if (mips_options.mips_cpu_flags  CPU_MIPS_DOUBLE_COUNT)
 		curcpu()-ci_cpu_freq /= 2;
 



CVS commit: src/sys/dev/usb

2011-08-24 Thread Bernd Ernesti
Module Name:src
Committed By:   veego
Date:   Wed Aug 24 19:39:05 UTC 2011

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

Log Message:
Add the u3g id for the Huawei 1750 stick


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

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

Modified files:

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.591 src/sys/dev/usb/usbdevs:1.592
--- src/sys/dev/usb/usbdevs:1.591	Mon Jul 25 05:32:11 2011
+++ src/sys/dev/usb/usbdevs	Wed Aug 24 19:39:05 2011
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.591 2011/07/25 05:32:11 jruoho Exp $
+$NetBSD: usbdevs,v 1.592 2011/08/24 19:39:05 veego Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1499,6 +1499,7 @@
 /* Huawei Technologies products */
 product HUAWEI MOBILE		0x1001	Huawei Mobile
 product HUAWEI E220  		0x1003	Huawei E220
+product HUAWEI E1750	  	0x140c	Huawei E1750
 product HUAWEI E1750INIT  	0x1446	Huawei E1750 USB CD
 product HUAWEI K3765  		0x1465	Huawei K3765
 product HUAWEI E1820  		0x14ac	Huawei E1820



CVS commit: src/sys/dev/usb

2011-08-24 Thread Bernd Ernesti
Module Name:src
Committed By:   veego
Date:   Wed Aug 24 19:40:23 UTC 2011

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

Log Message:
Regen for the Huawei 1750 id


To generate a diff of this commit:
cvs rdiff -u -r1.584 -r1.585 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.585 -r1.586 src/sys/dev/usb/usbdevs_data.h

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

Modified files:

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.584 src/sys/dev/usb/usbdevs.h:1.585
--- src/sys/dev/usb/usbdevs.h:1.584	Mon Jul 25 05:33:08 2011
+++ src/sys/dev/usb/usbdevs.h	Wed Aug 24 19:40:23 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.584 2011/07/25 05:33:08 jruoho Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.585 2011/08/24 19:40:23 veego Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.591 2011/07/25 05:32:11 jruoho Exp
+ *	NetBSD: usbdevs,v 1.592 2011/08/24 19:39:05 veego Exp
  */
 
 /*
@@ -1506,6 +1506,7 @@
 /* Huawei Technologies products */
 #define	USB_PRODUCT_HUAWEI_MOBILE	0x1001		/* Huawei Mobile */
 #define	USB_PRODUCT_HUAWEI_E220	0x1003		/* Huawei E220 */
+#define	USB_PRODUCT_HUAWEI_E1750	0x140c		/* Huawei E1750 */
 #define	USB_PRODUCT_HUAWEI_E1750INIT	0x1446		/* Huawei E1750 USB CD */
 #define	USB_PRODUCT_HUAWEI_K3765	0x1465		/* Huawei K3765 */
 #define	USB_PRODUCT_HUAWEI_E1820	0x14ac		/* Huawei E1820 */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.585 src/sys/dev/usb/usbdevs_data.h:1.586
--- src/sys/dev/usb/usbdevs_data.h:1.585	Mon Jul 25 05:33:08 2011
+++ src/sys/dev/usb/usbdevs_data.h	Wed Aug 24 19:40:23 2011
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs_data.h,v 1.585 2011/07/25 05:33:08 jruoho Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.586 2011/08/24 19:40:23 veego Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.591 2011/07/25 05:32:11 jruoho Exp
+ *	NetBSD: usbdevs,v 1.592 2011/08/24 19:39:05 veego Exp
  */
 
 /*
@@ -4595,6 +4595,10 @@
 	Huawei E220,
 	},
 	{
+	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1750,
+	Huawei E1750,
+	},
+	{
 	USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1750INIT,
 	Huawei E1750 USB CD,
 	},
@@ -8531,4 +8535,4 @@
 	Prestige,
 	},
 };
-const int usb_nproducts = 1626;
+const int usb_nproducts = 1627;



CVS commit: src/sys/dev/usb

2011-08-24 Thread Bernd Ernesti
Module Name:src
Committed By:   veego
Date:   Wed Aug 24 19:42:52 UTC 2011

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

Log Message:
Add the Huawei 1750 id so it change to the 3G modem mode


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/usb/u3g.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/u3g.c
diff -u src/sys/dev/usb/u3g.c:1.18 src/sys/dev/usb/u3g.c:1.19
--- src/sys/dev/usb/u3g.c:1.18	Wed Jul 20 14:41:39 2011
+++ src/sys/dev/usb/u3g.c	Wed Aug 24 19:42:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: u3g.c,v 1.18 2011/07/20 14:41:39 apb Exp $	*/
+/*	$NetBSD: u3g.c,v 1.19 2011/08/24 19:42:52 veego Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: u3g.c,v 1.18 2011/07/20 14:41:39 apb Exp $);
+__KERNEL_RCSID(0, $NetBSD: u3g.c,v 1.19 2011/08/24 19:42:52 veego Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -182,6 +182,7 @@
 static const struct usb_devno u3g_devs[] = {
 { USB_VENDOR_DELL, USB_PRODUCT_DELL_W5500 },
 	/* OEM: Huawei */
+	{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1750 },
 	{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E1820 },
 	{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E220 },
 	{ USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K3765 },



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

2011-08-24 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Aug 24 19:55:35 UTC 2011

Modified Files:
src/sys/arch/usermode/dev: cpu.c

Log Message:
make room for a small msgbuf


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/usermode/dev/cpu.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/usermode/dev/cpu.c
diff -u src/sys/arch/usermode/dev/cpu.c:1.15 src/sys/arch/usermode/dev/cpu.c:1.16
--- src/sys/arch/usermode/dev/cpu.c:1.15	Sat Aug 13 14:06:54 2011
+++ src/sys/arch/usermode/dev/cpu.c	Wed Aug 24 19:55:35 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.15 2011/08/13 14:06:54 jmcneill Exp $ */
+/* $NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.15 2011/08/13 14:06:54 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.16 2011/08/24 19:55:35 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -38,6 +38,7 @@
 #include sys/lwp.h
 #include sys/cpu.h
 #include sys/mbuf.h
+#include sys/msgbuf.h
 
 #include dev/cons.h
 
@@ -69,6 +70,7 @@
 } cpu_softc_t;
 
 static struct pcb lwp0pcb;
+static void *msgbuf;
 
 CFATTACH_DECL_NEW(cpu, sizeof(cpu_softc_t), cpu_match, cpu_attach, NULL, NULL);
 
@@ -311,6 +313,12 @@
 void
 cpu_startup(void)
 {
+
+	msgbuf = thunk_malloc(PAGE_SIZE);
+	if (msgbuf == NULL)
+		panic(couldn't allocate msgbuf);
+	initmsgbuf(msgbuf, PAGE_SIZE);
+
 	banner();
 
 	memset(lwp0pcb, 0, sizeof(lwp0pcb));



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

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 19:59:26 UTC 2011

Modified Files:
src/sys/arch/usermode/include: pmap.h

Log Message:
Remove two commented out and unused defines


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/include/pmap.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/usermode/include/pmap.h
diff -u src/sys/arch/usermode/include/pmap.h:1.4 src/sys/arch/usermode/include/pmap.h:1.5
--- src/sys/arch/usermode/include/pmap.h:1.4	Mon Aug 22 15:36:23 2011
+++ src/sys/arch/usermode/include/pmap.h	Wed Aug 24 19:59:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.4 2011/08/22 15:36:23 reinoud Exp $ */
+/* $NetBSD: pmap.h,v 1.5 2011/08/24 19:59:26 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,5 @@
 #define _ARCH_USERMODE_INCLUDE_PMAP_H
 
 #define	PMAP_GROWKERNEL		1
-//#define PMAP_MAP_POOLPAGE(x)	(x)
-//#define PMAP_UNMAP_POOLPAGE(x)	(x)
 
 #endif /* !_ARCH_USERMODE_INCLUDE_PMAP_H */



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 20:03:19 UTC 2011

Modified Files:
src/sys/arch/usermode/usermode: copy.c

Log Message:
Add debug statements in copyin/copyout


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/usermode/usermode/copy.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/usermode/usermode/copy.c
diff -u src/sys/arch/usermode/usermode/copy.c:1.2 src/sys/arch/usermode/usermode/copy.c:1.3
--- src/sys/arch/usermode/usermode/copy.c:1.2	Wed Oct 21 16:07:00 2009
+++ src/sys/arch/usermode/usermode/copy.c	Wed Aug 24 20:03:19 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: copy.c,v 1.2 2009/10/21 16:07:00 snj Exp $ */
+/* $NetBSD: copy.c,v 1.3 2011/08/24 20:03:19 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -27,14 +27,18 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.2 2009/10/21 16:07:00 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: copy.c,v 1.3 2011/08/24 20:03:19 reinoud Exp $);
 
 #include sys/types.h
 #include sys/systm.h
+#include sys/param.h		// tmp
+#include uvm/uvm.h		// tmp
+#include uvm/uvm_pmap.h	// tmp
 
 int
 copyin(const void *uaddr, void *kaddr, size_t len)
 {
+printf(copyin uaddr %p, kaddr %p, len %d\n, uaddr, kaddr, (int) len);
 	memcpy(kaddr, uaddr, len);
 	return 0;
 }
@@ -42,6 +46,9 @@
 int
 copyout(const void *kaddr, void *uaddr, size_t len)
 {
+printf(copyout kaddr %p, uaddr %p, len %d\n, kaddr, uaddr, (int) len);
+printf(curlwp pmap = %p\n, curlwp-l_proc-p_vmspace-vm_map.pmap);
+
 	memcpy(uaddr, kaddr, len);
 	return 0;
 }



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 20:13:07 UTC 2011

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

Log Message:
Implement pmap_activate() and pmap_deactivate()
Also add some debug messages

Note that the UVM area is still unprotected (for you Jared)


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.30 src/sys/arch/usermode/usermode/pmap.c:1.31
--- src/sys/arch/usermode/usermode/pmap.c:1.30	Wed Aug 24 12:54:46 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 20:13:07 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.30 2011/08/24 12:54:46 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.31 2011/08/24 20:13:07 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.30 2011/08/24 12:54:46 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.31 2011/08/24 20:13:07 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -71,6 +71,8 @@
 static struct pmap	pmap_kernel_store;
 struct pmap * const	kernel_pmap_ptr = pmap_kernel_store;
 
+static pmap_t active_pmap = NULL;
+
 static char  mem_name[20] = ;
 static int   mem_fh;
 static void *mem_uvm;	/* keeps all memory managed by UVM */
@@ -141,7 +143,9 @@
 	uvm_len = kmem_len + barrier_len + user_len + barrier_len + 2*PAGE_SIZE;
 	mem_uvm = thunk_malloc(uvm_len);
 	/* make page aligned */
-	mpos = round_page((vaddr_t) mem_uvm) + PAGE_SIZE;
+	mpos = round_page((vaddr_t) mem_uvm);// + PAGE_SIZE;
+	if (!((void *) mpos = mem_uvm))
+		panic(pmap_bootstrap: mpos miscalculation);
 
 	/* low barrier (---) */
 	mpos += barrier_len;
@@ -337,6 +341,7 @@
 	pmap-pm_entries = (struct pv_entry **) malloc(
 		pm_entries_size, M_VMPMAP,
 		M_WAITOK | M_ZERO);
+	aprint_debug(\tpmap %p\n, pmap);
 
 	return pmap;
 }
@@ -427,7 +432,6 @@
 		panic(pmap_page_activate: mmap failed);
 }
 
-
 static void
 pv_update(struct pv_entry *pv)
 {
@@ -456,6 +460,8 @@
 	struct pv_entry *pv;
 
 	for (pv = pv_table[ppn]; pv != NULL; pv = pv-pv_next) {
+		aprint_debug(pmap_update_page: ppn %PRIdPTR, pv-pv_map = %p\n,
+			ppn, pv-pv_pmap);
 		if (pv-pv_pmap != NULL) {
 			pv_update(pv);
 			pmap_page_activate(pv);
@@ -668,19 +674,54 @@
 void
 pmap_update(pmap_t pmap)
 {
-aprint_debug(pmap_update not implemented\n);
+	aprint_debug(pmap_update (dummy)\n);
 }
 
 void
 pmap_activate(struct lwp *l)
 {
-aprint_debug(pmap_activate not implemented\n);
+	struct proc *p = l-l_proc;
+	pmap_t pmap;
+
+	pmap = p-p_vmspace-vm_map.pmap;
+	aprint_debug(pmap_activate for lwp %p, pmap = %p\n, l, pmap);
+
+	if (pmap == pmap_kernel())
+		return; /* kernel pmap is always active */
+
+	KASSERT(active_pmap == NULL);
+	KASSERT((pmap-pm_flags  PM_ACTIVE) == 0);
+
+	active_pmap = pmap;
+	pmap-pm_flags |= PM_ACTIVE;
 }
 
 void
 pmap_deactivate(struct lwp *l)
 {
-aprint_debug(pmap_deactivate not implemented\n);
+	struct proc *p = l-l_proc;
+	pmap_t pmap;
+	int i;
+
+	pmap = p-p_vmspace-vm_map.pmap;
+	aprint_debug(pmap_DEactivate for lwp %p, pmap = %p\n, l, pmap);
+
+	if (pmap == pmap_kernel())
+		return; /* kernel pmap is always active */
+
+	KASSERT(pmap == active_pmap);
+	KASSERT(pmap-pm_flags  PM_ACTIVE);
+
+	active_pmap = NULL;
+	pmap-pm_flags =~ PM_ACTIVE;
+	for (i = 0; i  1024; i++) {
+		if (pmap-pm_entries[i] != NULL) {
+			aprint_debug(pmap_deactivate: TODO unmap memory!\n);
+//			MEMC_WRITE(pmap-pm_entries[i]-pv_deactivate);
+		}
+	}
+	/* dummy */
+	cpu_cache_flush();
 }
 
 /* XXX braindead zero_page implementation but it works for now */



CVS commit: src/sys/arch/usermode/usermode

2011-08-24 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Aug 24 20:13:56 UTC 2011

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

Log Message:
cpu_cache_flush doesn't exist yet or isn't included yet so comment it out


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/usermode/usermode/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/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.31 src/sys/arch/usermode/usermode/pmap.c:1.32
--- src/sys/arch/usermode/usermode/pmap.c:1.31	Wed Aug 24 20:13:07 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Wed Aug 24 20:13:56 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.31 2011/08/24 20:13:07 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.32 2011/08/24 20:13:56 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.31 2011/08/24 20:13:07 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.32 2011/08/24 20:13:56 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -721,7 +721,7 @@
 		}
 	}
 	/* dummy */
-	cpu_cache_flush();
+//	cpu_cache_flush();
 }
 
 /* XXX braindead zero_page implementation but it works for now */



CVS commit: src/sys

2011-08-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Aug 24 20:27:36 UTC 2011

Modified Files:
src/sys/arch/hpcmips/conf: files.hpcmips
src/sys/arch/hpcmips/include: pci_machdep.h
src/sys/arch/hpcmips/vr: vrc4172pci.c vrpciu.c
src/sys/dev/pci: files.pci pci.c pciconf.c pcivar.h
Added Files:
src/sys/arch/hpcmips/pci: pci_machdep.c
src/sys/dev/pci: pci_stub.c

Log Message:
Add to pci_bus_devorder() an argument that tells the number of slots
available in the devs array.  Change the type of the devs array from
char to uint8_t.  Treat the return value of pci_bus_devorder() as the
number of slots that it filled.

Don't use the __PCI_BUS_DEVORDER #definition to configure the kernel
but let the linker do it.  Make pci_bus_devorder() available on all
architectures by adding a default implementation that will DTRT on
all architectures but hpcmips, the only architecture to #define
__PCI_BUS_DEVORDER.  On hpcmips, adapt the implementation to the new
calling convention.

XXX I can compile an hpcmips GENERIC kernel, but I don't have a
XXX hpcmips box to test it on.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/hpcmips/conf/files.hpcmips
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/hpcmips/include/pci_machdep.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/hpcmips/pci/pci_machdep.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/hpcmips/vr/vrc4172pci.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/hpcmips/vr/vrpciu.c
cvs rdiff -u -r1.345 -r1.346 src/sys/dev/pci/files.pci
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/pci/pci.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pci_stub.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/pciconf.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/pci/pcivar.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/hpcmips/conf/files.hpcmips
diff -u src/sys/arch/hpcmips/conf/files.hpcmips:1.105 src/sys/arch/hpcmips/conf/files.hpcmips:1.106
--- src/sys/arch/hpcmips/conf/files.hpcmips:1.105	Wed Mar 16 13:23:41 2011
+++ src/sys/arch/hpcmips/conf/files.hpcmips	Wed Aug 24 20:27:36 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.hpcmips,v 1.105 2011/03/16 13:23:41 tsutsui Exp $
+#	$NetBSD: files.hpcmips,v 1.106 2011/08/24 20:27:36 dyoung Exp $
 
 # maxpartitions must be first item in files.${ARCH}.
 maxpartitions 8
@@ -455,4 +455,6 @@
 attach optpoint at txspiif
 file arch/hpcmips/dev/optpoint.c	optpoint
 
+file arch/hpcmips/pci/pci_machdep.c
+
 include arch/hpcmips/conf/majors.hpcmips

Index: src/sys/arch/hpcmips/include/pci_machdep.h
diff -u src/sys/arch/hpcmips/include/pci_machdep.h:1.6 src/sys/arch/hpcmips/include/pci_machdep.h:1.7
--- src/sys/arch/hpcmips/include/pci_machdep.h:1.6	Sun Dec 11 12:17:33 2005
+++ src/sys/arch/hpcmips/include/pci_machdep.h	Wed Aug 24 20:27:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.h,v 1.6 2005/12/11 12:17:33 christos Exp $	*/
+/*	$NetBSD: pci_machdep.h,v 1.7 2011/08/24 20:27:36 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2001 Enami Tsugutomo.
@@ -31,11 +31,6 @@
  */
 
 /*
- * We want to control both device probe order.
- */
-#define	__PCI_BUS_DEVORDER
-
-/*
  * Types provided to machine-independent PCI code
  */
 typedef struct hpcmips_pci_chipset *pci_chipset_tag_t;
@@ -57,7 +52,7 @@
 	void (*pc_attach_hook)(struct device *, struct device *,
 	struct pcibus_attach_args *);
 	int (*pc_bus_maxdevs)(pci_chipset_tag_t, int);
-	int (*pc_bus_devorder)(pci_chipset_tag_t, int, char *);
+	int (*pc_bus_devorder)(pci_chipset_tag_t, int, uint8_t *, int);
 	pcitag_t (*pc_make_tag)(pci_chipset_tag_t, int, int, int);
 	void (*pc_decompose_tag)(pci_chipset_tag_t, pcitag_t, int *, int *,
 	int *);
@@ -79,10 +74,6 @@
 (*(pba)-pba_pc-pc_attach_hook)((p), (s), (pba))
 #define	pci_bus_maxdevs(c, b)		\
 (*(c)-pc_bus_maxdevs)((c), (b))
-#ifdef __PCI_BUS_DEVORDER
-#define	pci_bus_devorder(c, b, d)	\
-(*(c)-pc_bus_devorder)((c), (b), (d))
-#endif
 #define	pci_make_tag(c, b, d, f)	\
 (*(c)-pc_make_tag)((c), (b), (d), (f))
 #define	pci_decompose_tag(c, t, bp, dp, fp)\

Index: src/sys/arch/hpcmips/vr/vrc4172pci.c
diff -u src/sys/arch/hpcmips/vr/vrc4172pci.c:1.14 src/sys/arch/hpcmips/vr/vrc4172pci.c:1.15
--- src/sys/arch/hpcmips/vr/vrc4172pci.c:1.14	Tue May 17 17:34:49 2011
+++ src/sys/arch/hpcmips/vr/vrc4172pci.c	Wed Aug 24 20:27:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: vrc4172pci.c,v 1.14 2011/05/17 17:34:49 dyoung Exp $	*/
+/*	$NetBSD: vrc4172pci.c,v 1.15 2011/08/24 20:27:36 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002 TAKEMURA Shin
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vrc4172pci.c,v 1.14 2011/05/17 17:34:49 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: vrc4172pci.c,v 1.15 2011/08/24 20:27:36 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -81,7 +81,7 @@
 static void	vrc4172pci_attach_hook(struct device *, struct device *,
 		struct pcibus_attach_args *);
 static int	

CVS commit: src/sys/arch/xen/xen

2011-08-24 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Wed Aug 24 20:49:34 UTC 2011

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
Protect xbdback(4) ring indexes from overflowing; leave the continuation
prematurely in case they do, to avoid looping endlessly (or at least
a very long time) at IPL_BIO while trying to handle requests.

This should not happen in a nominal scenario, but the ring can get
corrupted for whatever reason (memory errors, domU failures or
exploitation).


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.45 src/sys/arch/xen/xen/xbdback_xenbus.c:1.46
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.45	Sun Aug  7 17:39:34 2011
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Wed Aug 24 20:49:34 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.45 2011/08/07 17:39:34 bouyer Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.46 2011/08/24 20:49:34 jym Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.45 2011/08/07 17:39:34 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: xbdback_xenbus.c,v 1.46 2011/08/24 20:49:34 jym Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -954,14 +954,21 @@
 }
 
 /*
- * Increment consumer index and move on to the next request.
+ * Increment consumer index and move on to the next request. In case index
+ * leads to ring overflow, bail out.
  */
 static void *
 xbdback_co_main_incr(struct xbdback_instance *xbdi, void *obj)
 {
 	(void)obj;
-	xbdi-xbdi_ring.ring_n.req_cons++;
-	xbdi-xbdi_cont = xbdback_co_main_loop;
+	blkif_back_ring_t *ring = xbdi-xbdi_ring.ring_n;
+
+	ring-req_cons++;
+	if (RING_REQUEST_CONS_OVERFLOW(ring, ring-req_cons))
+		xbdi-xbdi_cont = NULL;
+	else
+		xbdi-xbdi_cont = xbdback_co_main_loop;
+
 	return xbdi;
 }
 



CVS commit: src/external/gpl3/gcc/dist/gcc/config/sh

2011-08-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed Aug 24 21:25:01 UTC 2011

Modified Files:
src/external/gpl3/gcc/dist/gcc/config/sh: sh.c

Log Message:
Pull the fix for GCC Bug 50068 - Invalid memory access in incr_ticks_for_insn

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50068
http://gcc.gnu.org/viewcvs?view=revisionrevision=177839

* config/sh/sh.c (sh_output_mi_thunk): Don't call dbr_schedule.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl3/gcc/dist/gcc/config/sh/sh.c

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

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/sh/sh.c
diff -u src/external/gpl3/gcc/dist/gcc/config/sh/sh.c:1.1.1.1 src/external/gpl3/gcc/dist/gcc/config/sh/sh.c:1.2
--- src/external/gpl3/gcc/dist/gcc/config/sh/sh.c:1.1.1.1	Tue Jun 21 01:22:12 2011
+++ src/external/gpl3/gcc/dist/gcc/config/sh/sh.c	Wed Aug 24 21:25:01 2011
@@ -11428,10 +11428,6 @@
 }
 
   sh_reorg ();
-
-  if (optimize  0  flag_delayed_branch)
-dbr_schedule (insns);
-
   shorten_branches (insns);
   final_start_function (insns, file, 1);
   final (insns, file, 1);



CVS commit: [jym-xensuspend] src/sys/arch/xen/xen

2011-08-24 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Wed Aug 24 21:37:05 UTC 2011

Modified Files:
src/sys/arch/xen/xen [jym-xensuspend]: xen_machdep.c

Log Message:
Now that Xen sysctl(7) moved under machdep, create a machdep.xen.suspend
node to command suspension.


To generate a diff of this commit:
cvs rdiff -u -r1.4.12.8 -r1.4.12.9 src/sys/arch/xen/xen/xen_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/xen/xen/xen_machdep.c
diff -u src/sys/arch/xen/xen/xen_machdep.c:1.4.12.8 src/sys/arch/xen/xen/xen_machdep.c:1.4.12.9
--- src/sys/arch/xen/xen/xen_machdep.c:1.4.12.8	Thu May 26 22:32:39 2011
+++ src/sys/arch/xen/xen/xen_machdep.c	Wed Aug 24 21:37:05 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_machdep.c,v 1.4.12.8 2011/05/26 22:32:39 jym Exp $	*/
+/*	$NetBSD: xen_machdep.c,v 1.4.12.9 2011/08/24 21:37:05 jym Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_machdep.c,v 1.4.12.8 2011/05/26 22:32:39 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_machdep.c,v 1.4.12.9 2011/08/24 21:37:05 jym Exp $);
 
 #include opt_xen.h
 
@@ -218,29 +218,39 @@
 }
 
 /*
- * this function sets up the machdep.sleep_state sysctl equivalent
- * for guest domains with no ACPI support
- * This sysctl mimics the ACPI one, except it should be used only for 
- * Xen's save/restore functionalities of guest domains
+ * this function sets up the machdep.xen.suspend sysctl(7) that
+ * controls domain suspend/save.
  */
 void
-sysctl_xen_sleepstate_setup(void) {
-
-	int ret;
+sysctl_xen_sleepstate_setup(void)
+{
+	const struct sysctlnode *node = NULL;
 
 	/*
-	 * dom0 implements sleep_state support through ACPI
-	 * it should not call this function to register
-	 * machdep.sleep_state sysctl
+	 * dom0 implements sleep support through ACPI. It should not call this
+	 * this function to register a suspend interface.
 	 */
 	KASSERT(!(xendomain_is_dom0()));
 
-	ret = sysctl_createv(NULL, 0, NULL, NULL, CTLFLAG_READWRITE,
-	 CTLTYPE_INT, sleep_state, NULL, sysctl_xen_sleepstate, 0,
-	 NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL);
-	
-	if (ret)
-		aprint_error(sysctl_createv failed: %d\n, ret);
+	sysctl_createv(clog, 0, NULL, node,
+	CTLFLAG_PERMANENT,
+	CTLTYPE_NODE, machdep, NULL,
+	NULL, 0, NULL, 0,
+	CTL_MACHDEP, CTL_EOL);
+
+	sysctl_createv(clog, 0, node, node,
+	CTLFLAG_PERMANENT,
+	CTLTYPE_NODE, xen,
+	SYSCTL_DESCR(Xen top level node),
+	NULL, 0, NULL, 0,
+	CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(clog, 0, node, node,
+	CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
+	CTLTYPE_INT, suspend,
+	SYSCTL_DESCR(Suspend/save control of current Xen domain),
+	NULL, sysctl_xen_sleepstate, 0, NULL, 0,
+	CTL_CREATE, CTL_EOL);
 }
 
 static int



CVS commit: xsrc/external/mit/xf86-video-ati/dist/src

2011-08-24 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Aug 24 22:40:56 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-ati/dist/src: radeon_driver.c

Log Message:
now that xrender acceleration on R1xx works again there is no reason not to
enable it by default


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \
xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c
diff -u xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.9 xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.10
--- xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c:1.9	Sun Mar 20 07:08:58 2011
+++ xsrc/external/mit/xf86-video-ati/dist/src/radeon_driver.c	Wed Aug 24 22:40:56 2011
@@ -178,7 +178,7 @@
 { OPTION_SCALER_WIDTH,ScalerWidth,  OPTV_INTEGER, {0}, FALSE }, 
 #endif
 #ifdef RENDER
-{ OPTION_RENDER_ACCEL,   RenderAccel,  OPTV_BOOLEAN, {0}, FALSE },
+{ OPTION_RENDER_ACCEL,   RenderAccel,  OPTV_BOOLEAN, {0}, TRUE },
 { OPTION_SUBPIXEL_ORDER, SubPixelOrder,OPTV_ANYSTR,  {0}, FALSE },
 #endif
 { OPTION_CLOCK_GATING,   ClockGating,  OPTV_BOOLEAN, {0}, FALSE },



CVS commit: src/share/mk

2011-08-24 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Thu Aug 25 00:01:25 UTC 2011

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

Log Message:
Switch sh3 to GCC 4.5.  Tested on landisk (including doing build.sh on it).


To generate a diff of this commit:
cvs rdiff -u -r1.679 -r1.680 src/share/mk/bsd.own.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.own.mk
diff -u src/share/mk/bsd.own.mk:1.679 src/share/mk/bsd.own.mk:1.680
--- src/share/mk/bsd.own.mk:1.679	Wed Aug 17 09:18:38 2011
+++ src/share/mk/bsd.own.mk	Thu Aug 25 00:01:25 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.679 2011/08/17 09:18:38 mrg Exp $
+#	$NetBSD: bsd.own.mk,v 1.680 2011/08/25 00:01:25 uwe Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -52,6 +52,7 @@
 .if ${MACHINE_ARCH} == i386 || \
 ${MACHINE_CPU}  == mips || \
 ${MACHINE_ARCH} == powerpc  || \
+${MACHINE_CPU}  == sh3  || \
 ${MACHINE_ARCH} == sparc|| \
 ${MACHINE_ARCH} == sparc64  || \
 ${MACHINE_ARCH} == x86_64



CVS commit: src/crypto/external/bsd/heimdal/lib

2011-08-24 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Thu Aug 25 00:25:47 UTC 2011

Removed Files:
src/crypto/external/bsd/heimdal/lib: Makefile.inc

Log Message:
This file should not have been imported.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/crypto/external/bsd/heimdal/lib/Makefile.inc

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



CVS commit: src/bin/expr

2011-08-24 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Aug 25 01:11:48 UTC 2011

Modified Files:
src/bin/expr: expr.y

Log Message:
Mark yyerror as dead.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/bin/expr/expr.y

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

Modified files:

Index: src/bin/expr/expr.y
diff -u src/bin/expr/expr.y:1.36 src/bin/expr/expr.y:1.37
--- src/bin/expr/expr.y:1.36	Tue Jan 20 14:22:37 2009
+++ src/bin/expr/expr.y	Thu Aug 25 01:11:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: expr.y,v 1.36 2009/01/20 14:22:37 joerg Exp $ */
+/* $NetBSD: expr.y,v 1.37 2011/08/25 01:11:47 joerg Exp $ */
 
 /*_
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 %{
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: expr.y,v 1.36 2009/01/20 14:22:37 joerg Exp $);
+__RCSID($NetBSD: expr.y,v 1.37 2011/08/25 01:11:47 joerg Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -49,7 +49,7 @@
 
 static const char * const *av;
 
-static void yyerror(const char *, ...);
+static void yyerror(const char *, ...) __dead;
 static int yylex(void);
 static int is_zero_or_null(const char *);
 static int is_integer(const char *);



CVS commit: src/share/man/man9

2011-08-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 02:01:32 UTC 2011

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

Log Message:
Describe pci_bus_devorder(9).

TBD: symbolic link pci_bus_devorder.9 - pci.9.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/share/man/man9/pci.9

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

Modified files:

Index: src/share/man/man9/pci.9
diff -u src/share/man/man9/pci.9:1.34 src/share/man/man9/pci.9:1.35
--- src/share/man/man9/pci.9:1.34	Mon May 30 01:48:40 2011
+++ src/share/man/man9/pci.9	Thu Aug 25 02:01:32 2011
@@ -1,4 +1,4 @@
-.\ $NetBSD: pci.9,v 1.34 2011/05/30 01:48:40 dyoung Exp $
+.\ $NetBSD: pci.9,v 1.35 2011/08/25 02:01:32 dyoung Exp $
 .\
 .\ Copyright (c) 2001, 2003 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,12 +27,13 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 5, 2011
+.Dd August 24, 2011
 .Dt PCI 9
 .Os
 .Sh NAME
 .Nm PCI ,
 .Nm pci_activate ,
+.Nm pci_bus_devorder ,
 .Nm pci_chipset_tag_create ,
 .Nm pci_chipset_tag_destroy ,
 .Nm pci_conf_read ,
@@ -68,6 +69,9 @@
 .In dev/pci/pcireg.h
 .In dev/pci/pcidevs.h
 .Ft int
+.Fn pci_bus_devorder pci_chipset_tag_t pc int bus uint8_t *devs \
+int maxdevs
+.Ft int
 .Fn pci_activate pci_chipset_tag_t pc pcitag_t tag device_t dev \
 int (*wakeup)(pci_chipset_tag_t pc, pcitag_t tag \
 \t\tdevice_t dev, pcireg_t reg)
@@ -252,6 +256,27 @@
 .El
 .Sh FUNCTIONS
 .Bl -tag -width compact
+.It Fn pci_bus_devorder pc bus devs maxdevs
+Tell how many devices a PCI bus driver should probe
+and in what order.
+If
+.Fa maxdevs
+is less than or equal to zero, return 0 and
+do not modify
+.Fa devs .
+Otherwise, return
+.Fa maxdevs
+or the number of devices on
+.Fa bus
+to probe, whichever is less, and copy to
+.Fa devs
+each of the PCI device numbers to probe in the order that they
+should be probed.
+.Fn pci_bus_devorder
+will not copy more than
+.Fa maxdevs
+device numbers to
+.Fa devs .
 .It Fn pci_activate pc tag dev fun
 Attempt to bring the device to state D0.
 If the device is not in the D0 state call



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

2011-08-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 02:05:27 UTC 2011

Modified Files:
src/sys/arch/amigappc/include: bus_defs.h

Log Message:
Delete an unnecessary #include and an unnecessary comment.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amigappc/include/bus_defs.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/amigappc/include/bus_defs.h
diff -u src/sys/arch/amigappc/include/bus_defs.h:1.3 src/sys/arch/amigappc/include/bus_defs.h:1.4
--- src/sys/arch/amigappc/include/bus_defs.h:1.3	Fri Aug 12 17:40:49 2011
+++ src/sys/arch/amigappc/include/bus_defs.h	Thu Aug 25 02:05:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.3 2011/08/12 17:40:49 dyoung Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.4 2011/08/25 02:05:27 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Leo Weppelman.  All rights reserved.
@@ -27,10 +27,6 @@
 #ifndef _AMIGAPPC_BUS_DEFS_H_
 #define _AMIGAPPC_BUS_DEFS_H_
 
-#include sys/types.h
-
-/* for public use: */
-
 /*
  * Memory addresses (in bus space)
  */



CVS commit: src/sys/modules

2011-08-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug 25 02:07:38 UTC 2011

Modified Files:
src/sys/modules/if_axe: if_axe.ioconf
src/sys/modules/if_rum: if_rum.ioconf

Log Message:
Fix the ioconf files.  We can't include dev/usb/files.pci and the
attachment should be usbdevif as defined in files.usb


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/if_axe/if_axe.ioconf
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/if_rum/if_rum.ioconf

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

Modified files:

Index: src/sys/modules/if_axe/if_axe.ioconf
diff -u src/sys/modules/if_axe/if_axe.ioconf:1.1 src/sys/modules/if_axe/if_axe.ioconf:1.2
--- src/sys/modules/if_axe/if_axe.ioconf:1.1	Tue Aug 23 12:54:05 2011
+++ src/sys/modules/if_axe/if_axe.ioconf	Thu Aug 25 02:07:38 2011
@@ -1,10 +1,10 @@
-# $NetBSD: if_axe.ioconf,v 1.1 2011/08/23 12:54:05 pgoyette Exp $
+# $NetBSD: if_axe.ioconf,v 1.2 2011/08/25 02:07:38 pgoyette Exp $
 
-ioconf if_axe
+ioconf axe
 
 include conf/files
-include dev/usb/files.pci
+include dev/usb/files.usb
 
-pseudo-root uhub*
+pseudo-root usbdevif*
 
-axe* at uhub?
+axe* at usbdevif?

Index: src/sys/modules/if_rum/if_rum.ioconf
diff -u src/sys/modules/if_rum/if_rum.ioconf:1.1 src/sys/modules/if_rum/if_rum.ioconf:1.2
--- src/sys/modules/if_rum/if_rum.ioconf:1.1	Tue Aug 23 12:54:05 2011
+++ src/sys/modules/if_rum/if_rum.ioconf	Thu Aug 25 02:07:38 2011
@@ -1,10 +1,10 @@
-# $NetBSD: if_rum.ioconf,v 1.1 2011/08/23 12:54:05 pgoyette Exp $
+# $NetBSD: if_rum.ioconf,v 1.2 2011/08/25 02:07:38 pgoyette Exp $
 
-ioconf if_rum
+ioconf rum
 
 include conf/files
-include dev/usb/files.pci
+include dev/usb/files.usb
 
-pseudo-root uhub*
+pseudo-root usbdevif*
 
-rum* at uhub?
+rum* at usbdevif?



CVS commit: src/sys/dev/usb

2011-08-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug 25 02:27:31 UTC 2011

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

Log Message:
Update the module command-processing routine to match the ioconf files


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/if_rum.c

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

Modified files:

Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.48 src/sys/dev/usb/if_axe.c:1.49
--- src/sys/dev/usb/if_axe.c:1.48	Tue Aug 23 12:53:29 2011
+++ src/sys/dev/usb/if_axe.c	Thu Aug 25 02:27:31 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.48 2011/08/23 12:53:29 pgoyette Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.49 2011/08/25 02:27:31 pgoyette Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_axe.c,v 1.48 2011/08/23 12:53:29 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_axe.c,v 1.49 2011/08/25 02:27:31 pgoyette Exp $);
 
 #if defined(__NetBSD__)
 #ifndef _MODULE
@@ -212,6 +212,8 @@
 static void	axe_ax88178_init(struct axe_softc *);
 static void	axe_ax88772_init(struct axe_softc *);
 
+extern int usbdebug;	/* XXX */
+
 /* Get exclusive access to the MII registers */
 static void
 axe_lock_mii(struct axe_softc *sc)
@@ -1473,14 +1475,16 @@
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
-		error = config_init_component(cfdriver_ioconf_if_axe,
-		cfattach_ioconf_if_axe, cfdata_ioconf_if_axe);
+		usbdebug++; /* XXX */
+		error = config_init_component(cfdriver_ioconf_axe,
+		cfattach_ioconf_axe, cfdata_ioconf_axe);
+		usbdebug--; /* XXX */
 #endif
 		return error;
 	case MODULE_CMD_FINI:
 #ifdef _MODULE
-		error = config_fini_component(cfdriver_ioconf_if_axe,
-		cfattach_ioconf_if_axe, cfdata_ioconf_if_axe);
+		error = config_fini_component(cfdriver_ioconf_axe,
+		cfattach_ioconf_axe, cfdata_ioconf_axe);
 #endif
 		return error;
 	default:

Index: src/sys/dev/usb/if_rum.c
diff -u src/sys/dev/usb/if_rum.c:1.38 src/sys/dev/usb/if_rum.c:1.39
--- src/sys/dev/usb/if_rum.c:1.38	Tue Aug 23 12:53:29 2011
+++ src/sys/dev/usb/if_rum.c	Thu Aug 25 02:27:31 2011
@@ -1,5 +1,5 @@
 /*	$OpenBSD: if_rum.c,v 1.40 2006/09/18 16:20:20 damien Exp $	*/
-/*	$NetBSD: if_rum.c,v 1.38 2011/08/23 12:53:29 pgoyette Exp $	*/
+/*	$NetBSD: if_rum.c,v 1.39 2011/08/25 02:27:31 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2005-2007 Damien Bergamini damien.bergam...@free.fr
@@ -24,7 +24,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_rum.c,v 1.38 2011/08/23 12:53:29 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_rum.c,v 1.39 2011/08/25 02:27:31 pgoyette Exp $);
 
 
 #include sys/param.h
@@ -2313,14 +2313,14 @@
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
-		error = config_init_component(cfdriver_ioconf_if_rum,
-		cfattach_ioconf_if_rum, cfdata_ioconf_if_rum);
+		error = config_init_component(cfdriver_ioconf_rum,
+		cfattach_ioconf_rum, cfdata_ioconf_rum);
 #endif
 		return error;
 	case MODULE_CMD_FINI:
 #ifdef _MODULE
-		error = config_fini_component(cfdriver_ioconf_if_rum,
-		cfattach_ioconf_if_rum, cfdata_ioconf_if_rum);
+		error = config_fini_component(cfdriver_ioconf_rum,
+		cfattach_ioconf_rum, cfdata_ioconf_rum);
 #endif
 		return error;
 	default:



CVS commit: src/sys/dev/usb

2011-08-24 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Aug 25 02:29:08 UTC 2011

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

Log Message:
Remove some debugging code that was accidentally committed


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/usb/if_axe.c

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

Modified files:

Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.49 src/sys/dev/usb/if_axe.c:1.50
--- src/sys/dev/usb/if_axe.c:1.49	Thu Aug 25 02:27:31 2011
+++ src/sys/dev/usb/if_axe.c	Thu Aug 25 02:29:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.49 2011/08/25 02:27:31 pgoyette Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */
 
 /*
@@ -89,7 +89,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_axe.c,v 1.49 2011/08/25 02:27:31 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_axe.c,v 1.50 2011/08/25 02:29:08 pgoyette Exp $);
 
 #if defined(__NetBSD__)
 #ifndef _MODULE
@@ -212,8 +212,6 @@
 static void	axe_ax88178_init(struct axe_softc *);
 static void	axe_ax88772_init(struct axe_softc *);
 
-extern int usbdebug;	/* XXX */
-
 /* Get exclusive access to the MII registers */
 static void
 axe_lock_mii(struct axe_softc *sc)
@@ -1475,10 +1473,8 @@
 	switch (cmd) {
 	case MODULE_CMD_INIT:
 #ifdef _MODULE
-		usbdebug++; /* XXX */
 		error = config_init_component(cfdriver_ioconf_axe,
 		cfattach_ioconf_axe, cfdata_ioconf_axe);
-		usbdebug--; /* XXX */
 #endif
 		return error;
 	case MODULE_CMD_FINI:



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

2011-08-24 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 02:36:03 UTC 2011

Modified Files:
src/sys/arch/mips/atheros/dev: athflash.c

Log Message:
Use humanize_number() instead of the buggy code that GCC 4.5 caught.
Compiles.  Not tested.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/atheros/dev/athflash.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/atheros/dev/athflash.c
diff -u src/sys/arch/mips/atheros/dev/athflash.c:1.4 src/sys/arch/mips/atheros/dev/athflash.c:1.5
--- src/sys/arch/mips/atheros/dev/athflash.c:1.4	Fri Jul  1 18:40:00 2011
+++ src/sys/arch/mips/atheros/dev/athflash.c	Thu Aug 25 02:36:03 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: athflash.c,v 1.4 2011/07/01 18:40:00 dyoung Exp $ */
+/* $NetBSD: athflash.c,v 1.5 2011/08/25 02:36:03 dyoung Exp $ */
 
 /*
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -82,7 +82,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: athflash.c,v 1.4 2011/07/01 18:40:00 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: athflash.c,v 1.5 2011/08/25 02:36:03 dyoung Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -194,6 +194,7 @@
 static void
 flash_attach(struct device *parent, struct device *self, void *aux)
 {
+	char nbuf[32];
 	struct flash_softc		*sc = (void *) self;
 	struct arbus_attach_args	*aa = aux;
 	inti;
@@ -230,18 +231,17 @@
 	}
 
 	KASSERT(flash_ids[i].name != NULL);
-	printf(: %s , flash_ids[i].name);
-	if (i = 0x10)
-		printf((%d MB), flash_ids[i].flash_size  20);
-	else
-		printf((%d KB), flash_ids[i].flash_size  10);
+	printf(: %s, flash_ids[i].name);
+	if (humanize_number(nbuf, sizeof(nbuf), flash_ids[i].flash_size, B,
+	1024)  0)
+		printf( (%s), nbuf);
 
 	/*
 	 * determine size of the largest block
 	 */
 	sc-sc_size = flash_ids[i].flash_size;
 	sc-sc_sector_size = flash_ids[i].sector_size;
-	
+
 	if ((sc-sc_buf = malloc(sc-sc_sector_size, M_DEVBUF, M_NOWAIT))
 	== NULL) {
 		printf(: can't alloc buffer space\n);