CVS commit: src/sys/ddb

2010-08-31 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Aug 31 07:12:55 UTC 2010

Modified Files:
src/sys/ddb: db_input.c

Log Message:
Fix indent in prevous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/ddb/db_input.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/ddb/db_input.c
diff -u src/sys/ddb/db_input.c:1.24 src/sys/ddb/db_input.c:1.25
--- src/sys/ddb/db_input.c:1.24	Mon Aug 30 19:23:25 2010
+++ src/sys/ddb/db_input.c	Tue Aug 31 07:12:55 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_input.c,v 1.24 2010/08/30 19:23:25 tls Exp $	*/
+/*	$NetBSD: db_input.c,v 1.25 2010/08/31 07:12:55 enami Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_input.c,v 1.24 2010/08/30 19:23:25 tls Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_input.c,v 1.25 2010/08/31 07:12:55 enami Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddbparam.h
@@ -134,12 +134,12 @@
 #define INC_DB_CURR() do {		\
 	++db_history_curr;		\
 	if (db_history_curr  db_history + DDB_HISTORY_SIZE - 1)	\
-	db_history_curr = db_history;\
+		db_history_curr = db_history;\
 } while (0)
 #define DEC_DB_CURR() do {		\
 	--db_history_curr;		\
 	if (db_history_curr  db_history)\
-	db_history_curr = db_history + DDB_HISTORY_SIZE - 1;	\
+		db_history_curr = db_history + DDB_HISTORY_SIZE - 1;	\
 } while (0)
 #endif
 



CVS commit: src/sys/ddb

2010-08-31 Thread enami tsugutomo
Module Name:src
Committed By:   enami
Date:   Tue Aug 31 07:48:23 UTC 2010

Modified Files:
src/sys/ddb: db_input.c

Log Message:
Define db_hist_put() only when DDB_HISTORY_SIZE != 0 so that
build successes on ports like hpcarm.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/ddb/db_input.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/ddb/db_input.c
diff -u src/sys/ddb/db_input.c:1.25 src/sys/ddb/db_input.c:1.26
--- src/sys/ddb/db_input.c:1.25	Tue Aug 31 07:12:55 2010
+++ src/sys/ddb/db_input.c	Tue Aug 31 07:48:23 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_input.c,v 1.25 2010/08/31 07:12:55 enami Exp $	*/
+/*	$NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $	*/
 
 /*
  * Mach Operating System
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: db_input.c,v 1.25 2010/08/31 07:12:55 enami Exp $);
+__KERNEL_RCSID(0, $NetBSD: db_input.c,v 1.26 2010/08/31 07:48:23 enami Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_ddbparam.h
@@ -141,9 +141,9 @@
 	if (db_history_curr  db_history)\
 		db_history_curr = db_history + DDB_HISTORY_SIZE - 1;	\
 } while (0)
-#endif
 
-static inline void db_hist_put(int c)
+static inline void
+db_hist_put(int c)
 {
 	KASSERT(db_history[0]  = db_history_last);
 	KASSERT(db_history_last = db_history[DDB_HISTORY_SIZE-1]);
@@ -153,6 +153,7 @@
 	if (db_history_last  db_history[DDB_HISTORY_SIZE-1])
 	db_history_last = db_history;
 }
+#endif
 	
 
 /* returns true at end-of-line */



CVS commit: [netbsd-5] src/sys/arch/x86/x86

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:50:22 UTC 2010

Modified Files:
src/sys/arch/x86/x86 [netbsd-5]: intel_busclock.c

Log Message:
Pull up following revision(s) (requested by jym in ticket #1439):
sys/arch/x86/x86/intel_busclock.c: revision 1.11
Some core i7 CPUs report model 0c. In this case, check for the extended
model value.
Required to avoid faulting on rdmsr(MSR_FSB_FREQ) early during boot.
Will ask for a pull-up. This affects GENERIC, and most likely, install iso
too.
XXX quick hack. Obtaining FSB through ACPI should be cleaner.


To generate a diff of this commit:
cvs rdiff -u -r1.5.10.3 -r1.5.10.4 src/sys/arch/x86/x86/intel_busclock.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/x86/x86/intel_busclock.c
diff -u src/sys/arch/x86/x86/intel_busclock.c:1.5.10.3 src/sys/arch/x86/x86/intel_busclock.c:1.5.10.4
--- src/sys/arch/x86/x86/intel_busclock.c:1.5.10.3	Fri Dec 18 05:55:23 2009
+++ src/sys/arch/x86/x86/intel_busclock.c	Tue Aug 31 10:50:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_busclock.c,v 1.5.10.3 2009/12/18 05:55:23 snj Exp $	*/
+/*	$NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.3 2009/12/18 05:55:23 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: intel_busclock.c,v 1.5.10.4 2010/08/31 10:50:22 bouyer Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -96,7 +96,19 @@
 	case 0x9: /* Pentium M (130 nm, Banias) */
 		bus_clock = 1;
 		break;
-	case 0xc: /* Atom, model 1 */
+	case 0xc: /* Core i7, Atom, model 1 */
+		/*
+		 * XXX (See also case 0xe)
+		 * Some core i7 CPUs can report model 0xc.
+		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
+		 * In the long-term, use ACPI instead of all this.
+		 */
+		switch (CPUID2EXTMODEL(ci-ci_signature)) {
+		case 0x2:
+			aprint_debug(%s: unable to determine bus speed,
+			device_xname(ci-ci_dev));
+			goto print_msr;
+		}
 		msr = rdmsr(MSR_FSB_FREQ);
 		bus = (msr  0)  0x7;
 		switch (bus) {
@@ -127,7 +139,7 @@
 		break;
 	case 0xe: /* Core Duo/Solo */
 		/*
-		 * XXX
+		 * XXX (See also case 0xc)
 		 * Newer CPUs will GP when attemping to access MSR_FSB_FREQ.
 		 * In the long-term, use ACPI instead of all this.
 		 */



CVS commit: [netbsd-5] src/sys/kern

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:55:00 UTC 2010

Modified Files:
src/sys/kern [netbsd-5]: exec_subr.c kern_pax.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1444):
sys/kern/kern_pax.c: revision 1.24
sys/kern/exec_subr.c: revision 1.65
Fix issues with stack allocation and pax aslr:
- since the size is unsigned, don't check just that it is  0, but limit
  it to the MAXSSIZ
- if the stack size is reduced because of aslr, make sure we reduce the
  actual allocation by the same size so that the size does not wrap around.
NB: Must be pulled up to 5.x!


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.2 src/sys/kern/exec_subr.c
cvs rdiff -u -r1.22 -r1.22.8.1 src/sys/kern/kern_pax.c

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

Modified files:

Index: src/sys/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.61.8.1 src/sys/kern/exec_subr.c:1.61.8.2
--- src/sys/kern/exec_subr.c:1.61.8.1	Wed Apr  1 00:25:22 2009
+++ src/sys/kern/exec_subr.c	Tue Aug 31 10:55:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.61.8.1 2009/04/01 00:25:22 snj Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.61.8.2 2010/08/31 10:55:00 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exec_subr.c,v 1.61.8.1 2009/04/01 00:25:22 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: exec_subr.c,v 1.61.8.2 2010/08/31 10:55:00 bouyer Exp $);
 
 #include opt_pax.h
 
@@ -386,6 +386,7 @@
 		epp-ep_minsaddr = USRSTACK;
 		max_stack_size = MAXSSIZ;
 	}
+	epp-ep_ssize = l-l_proc-p_rlimit[RLIMIT_STACK].rlim_cur;
 
 #ifdef PAX_ASLR
 	pax_aslr_stack(l, epp, max_stack_size);
@@ -395,7 +396,6 @@
 	
 	epp-ep_maxsaddr = (u_long)STACK_GROW(epp-ep_minsaddr,
 		max_stack_size);
-	epp-ep_ssize = l-l_proc-p_rlimit[RLIMIT_STACK].rlim_cur;
 
 	/*
 	 * set up commands for stack.  note that this takes *two*, one to
@@ -410,11 +410,11 @@
 	noaccess_size = max_stack_size - access_size;
 	noaccess_linear_min = (u_long)STACK_ALLOC(STACK_GROW(epp-ep_minsaddr,
 	access_size), noaccess_size);
-	if (noaccess_size  0) {
+	if (noaccess_size  0  noaccess_size = MAXSSIZ) {
 		NEW_VMCMD2(epp-ep_vmcmds, vmcmd_map_zero, noaccess_size,
 		noaccess_linear_min, NULL, 0, VM_PROT_NONE, VMCMD_STACK);
 	}
-	KASSERT(access_size  0);
+	KASSERT(access_size  0  access_size = MAXSSIZ);
 	NEW_VMCMD2(epp-ep_vmcmds, vmcmd_map_zero, access_size,
 	access_linear_min, NULL, 0, VM_PROT_READ | VM_PROT_WRITE,
 	VMCMD_STACK);

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.22 src/sys/kern/kern_pax.c:1.22.8.1
--- src/sys/kern/kern_pax.c:1.22	Wed Jun  4 12:26:20 2008
+++ src/sys/kern/kern_pax.c	Tue Aug 31 10:55:00 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.22.8.1 2010/08/31 10:55:00 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2006 Elad Efrat e...@netbsd.org
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_pax.c,v 1.22.8.1 2010/08/31 10:55:00 bouyer Exp $);
 
 #include opt_pax.h
 
@@ -353,6 +353,8 @@
 #endif
 		epp-ep_minsaddr -= d;
 		*max_stack_size -= d;
+		if (epp-ep_ssize  *max_stack_size)
+			epp-ep_ssize = *max_stack_size;
 	}
 }
 #endif /* PAX_ASLR */



CVS commit: [netbsd-5-0] src/sys/kern

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:55:34 UTC 2010

Modified Files:
src/sys/kern [netbsd-5-0]: exec_subr.c kern_pax.c

Log Message:
Pull up following revision(s) (requested by christos in ticket #1444):
sys/kern/kern_pax.c: revision 1.24
sys/kern/exec_subr.c: revision 1.65
Fix issues with stack allocation and pax aslr:
- since the size is unsigned, don't check just that it is  0, but limit
  it to the MAXSSIZ
- if the stack size is reduced because of aslr, make sure we reduce the
  actual allocation by the same size so that the size does not wrap around.
NB: Must be pulled up to 5.x!


To generate a diff of this commit:
cvs rdiff -u -r1.61.8.1 -r1.61.8.1.2.1 src/sys/kern/exec_subr.c
cvs rdiff -u -r1.22 -r1.22.14.1 src/sys/kern/kern_pax.c

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

Modified files:

Index: src/sys/kern/exec_subr.c
diff -u src/sys/kern/exec_subr.c:1.61.8.1 src/sys/kern/exec_subr.c:1.61.8.1.2.1
--- src/sys/kern/exec_subr.c:1.61.8.1	Wed Apr  1 00:25:22 2009
+++ src/sys/kern/exec_subr.c	Tue Aug 31 10:55:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_subr.c,v 1.61.8.1 2009/04/01 00:25:22 snj Exp $	*/
+/*	$NetBSD: exec_subr.c,v 1.61.8.1.2.1 2010/08/31 10:55:34 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: exec_subr.c,v 1.61.8.1 2009/04/01 00:25:22 snj Exp $);
+__KERNEL_RCSID(0, $NetBSD: exec_subr.c,v 1.61.8.1.2.1 2010/08/31 10:55:34 bouyer Exp $);
 
 #include opt_pax.h
 
@@ -386,6 +386,7 @@
 		epp-ep_minsaddr = USRSTACK;
 		max_stack_size = MAXSSIZ;
 	}
+	epp-ep_ssize = l-l_proc-p_rlimit[RLIMIT_STACK].rlim_cur;
 
 #ifdef PAX_ASLR
 	pax_aslr_stack(l, epp, max_stack_size);
@@ -395,7 +396,6 @@
 	
 	epp-ep_maxsaddr = (u_long)STACK_GROW(epp-ep_minsaddr,
 		max_stack_size);
-	epp-ep_ssize = l-l_proc-p_rlimit[RLIMIT_STACK].rlim_cur;
 
 	/*
 	 * set up commands for stack.  note that this takes *two*, one to
@@ -410,11 +410,11 @@
 	noaccess_size = max_stack_size - access_size;
 	noaccess_linear_min = (u_long)STACK_ALLOC(STACK_GROW(epp-ep_minsaddr,
 	access_size), noaccess_size);
-	if (noaccess_size  0) {
+	if (noaccess_size  0  noaccess_size = MAXSSIZ) {
 		NEW_VMCMD2(epp-ep_vmcmds, vmcmd_map_zero, noaccess_size,
 		noaccess_linear_min, NULL, 0, VM_PROT_NONE, VMCMD_STACK);
 	}
-	KASSERT(access_size  0);
+	KASSERT(access_size  0  access_size = MAXSSIZ);
 	NEW_VMCMD2(epp-ep_vmcmds, vmcmd_map_zero, access_size,
 	access_linear_min, NULL, 0, VM_PROT_READ | VM_PROT_WRITE,
 	VMCMD_STACK);

Index: src/sys/kern/kern_pax.c
diff -u src/sys/kern/kern_pax.c:1.22 src/sys/kern/kern_pax.c:1.22.14.1
--- src/sys/kern/kern_pax.c:1.22	Wed Jun  4 12:26:20 2008
+++ src/sys/kern/kern_pax.c	Tue Aug 31 10:55:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $	*/
+/*	$NetBSD: kern_pax.c,v 1.22.14.1 2010/08/31 10:55:34 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2006 Elad Efrat e...@netbsd.org
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_pax.c,v 1.22 2008/06/04 12:26:20 ad Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_pax.c,v 1.22.14.1 2010/08/31 10:55:34 bouyer Exp $);
 
 #include opt_pax.h
 
@@ -353,6 +353,8 @@
 #endif
 		epp-ep_minsaddr -= d;
 		*max_stack_size -= d;
+		if (epp-ep_ssize  *max_stack_size)
+			epp-ep_ssize = *max_stack_size;
 	}
 }
 #endif /* PAX_ASLR */



CVS commit: [netbsd-5] src/doc

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:56:03 UTC 2010

Modified Files:
src/doc [netbsd-5]: CHANGES-5.1

Log Message:
Tickets 1439  1444


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.238 -r1.1.2.239 src/doc/CHANGES-5.1

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-5.1
diff -u src/doc/CHANGES-5.1:1.1.2.238 src/doc/CHANGES-5.1:1.1.2.239
--- src/doc/CHANGES-5.1:1.1.2.238	Wed Aug 25 04:22:21 2010
+++ src/doc/CHANGES-5.1	Tue Aug 31 10:56:03 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.1,v 1.1.2.238 2010/08/25 04:22:21 snj Exp $
+# $NetBSD: CHANGES-5.1,v 1.1.2.239 2010/08/31 10:56:03 bouyer Exp $
 
 A complete list of changes from the NetBSD 5.0 release to the NetBSD 5.1
 release:
@@ -17425,3 +17425,21 @@
 	Correct incomplete size checks for the coda ioctls.
 	[christos, ticket #1431]
 
+sys/arch/x86/x86/intel_busclock.c		1.11
+
+	Some core i7 CPUs report model 0c. In this case, check for the extended
+	model value.
+	Required to avoid faulting on rdmsr(MSR_FSB_FREQ) early during boot.
+	[jym, ticket #1439]
+
+sys/kern/exec_subr.c1.65
+sys/kern/kern_pax.c1.24
+
+	Fix issues with stack allocation and pax aslr:
+	- since the size is unsigned, don't check just that it is  0,
+	  but limit it to the MAXSSIZ
+	- if the stack size is reduced because of aslr, make sure we reduce
+	  the actual allocation by the same size so that the size does not
+	  wrap around.
+	[christos, ticket #1444]
+



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

2010-08-31 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue Aug 31 10:56:34 UTC 2010

Modified Files:
src/doc [netbsd-5-0]: CHANGES-5.0.3

Log Message:
Ticket 1444


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.16 -r1.1.2.17 src/doc/CHANGES-5.0.3

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-5.0.3
diff -u src/doc/CHANGES-5.0.3:1.1.2.16 src/doc/CHANGES-5.0.3:1.1.2.17
--- src/doc/CHANGES-5.0.3:1.1.2.16	Wed Aug 25 04:16:32 2010
+++ src/doc/CHANGES-5.0.3	Tue Aug 31 10:56:34 2010
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-5.0.3,v 1.1.2.16 2010/08/25 04:16:32 snj Exp $
+# $NetBSD: CHANGES-5.0.3,v 1.1.2.17 2010/08/31 10:56:34 bouyer Exp $
 
 A complete list of changes from the NetBSD 5.0.2 release to the NetBSD 5.0.3
 release:
@@ -295,3 +295,14 @@
 	Correct incomplete size checks for the coda ioctls.
 	[christos, ticket #1431]
 
+sys/kern/exec_subr.c1.65
+sys/kern/kern_pax.c1.24
+
+	Fix issues with stack allocation and pax aslr:
+	- since the size is unsigned, don't check just that it is  0,
+	  but limit it to the MAXSSIZ
+	- if the stack size is reduced because of aslr, make sure we reduce
+	  the actual allocation by the same size so that the size does not
+	  wrap around.
+	[christos, ticket #1444]
+



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

2010-08-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 31 12:12:48 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
Set bp-b_resid properly after data transfer is complete.
Fixes unexpected Bad address errors on file read ops since January 2006.

The problem is reported and tracked by Yasushi Oshima.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.26 src/sys/arch/dreamcast/dev/gdrom.c:1.27
--- src/sys/arch/dreamcast/dev/gdrom.c:1.26	Fri Aug  1 20:19:49 2008
+++ src/sys/arch/dreamcast/dev/gdrom.c	Tue Aug 31 12:12:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.26 2008/08/01 20:19:49 marcus Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -118,10 +118,12 @@
 #define GDROM_COND	GDROM(0x9c)
 
 int	gdrom_getstat(void);
-int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int);
-int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int);
+int	gdrom_do_command(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
+int	gdrom_command_sense(struct gdrom_softc *, void *, void *, unsigned int,
+	int *);
 int	gdrom_read_toc(struct gdrom_softc *, struct gd_toc *);
-int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int);
+int	gdrom_read_sectors(struct gdrom_softc *, void *, int, int, int *);
 int	gdrom_mount_disk(struct gdrom_softc *);
 int	gdrom_intr(void *);
 
@@ -202,7 +204,7 @@
 
 
 int gdrom_do_command(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	int i, s;
 	short *ptr = req;
@@ -239,12 +241,15 @@
 
 	splx(s);
 
+	if (resid != NULL)
+		*resid = sc-cmd_result_size;
+
 	return sc-cmd_cond;
 }
 
 
 int gdrom_command_sense(struct gdrom_softc *sc, void *req, void *buf,
-unsigned int nbyt)
+unsigned int nbyt, int *resid)
 {
 	/* 76543210 76543210
 	   0   0x13  -
@@ -257,7 +262,7 @@
 	unsigned char cmd[12];
 	int sense_key, sense_specific;
 
-	int cond = gdrom_do_command(sc, req, buf, nbyt);
+	int cond = gdrom_do_command(sc, req, buf, nbyt, resid);
 
 	if (cond  0) {
 #ifdef GDROMDEBUG
@@ -278,7 +283,7 @@
 	cmd[0] = 0x13;
 	cmd[4] = sizeof(sense_data);
 	
-	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data));
+	gdrom_do_command(sc, cmd, sense_data, sizeof(sense_data), NULL);
 	
 	sense_key = sense_data[1]  0xf;
 	sense_specific = sense_data[4];
@@ -314,10 +319,11 @@
 	cmd[3] = sizeof(struct gd_toc)  8;
 	cmd[4] = sizeof(struct gd_toc)  0xff;
 	
-	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc));
+	return gdrom_command_sense(sc, cmd, toc, sizeof(struct gd_toc), NULL);
 }
 
-int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt)
+int gdrom_read_sectors(struct gdrom_softc *sc, void *buf, int sector, int cnt,
+int *resid)
 {
 	/* 76543210 76543210
 	   0   0x30datafmt
@@ -339,7 +345,7 @@
 	cmd[9] = cnt8;
 	cmd[10] = cnt;
 
-	return gdrom_command_sense(sc, cmd, buf, cnt  11);
+	return gdrom_command_sense(sc, cmd, buf, cnt  11, resid);
 }
 
 int gdrom_mount_disk(struct gdrom_softc *sc)
@@ -358,7 +364,7 @@
 	cmd[0] = 0x70;
 	cmd[1] = 0x1f;
 	
-	return gdrom_command_sense(sc, cmd, NULL, 0);
+	return gdrom_command_sense(sc, cmd, NULL, 0, NULL);
 }
 
 int
@@ -468,7 +474,7 @@
 gdromstrategy(struct buf *bp)
 {
 	struct gdrom_softc *sc;
-	int s, unit, error;
+	int s, unit, error, resid;
 #ifdef GDROMDEBUG
 	printf(GDROM: strategy\n);
 #endif
@@ -493,11 +499,14 @@
 	splx(s);
 
 	if ((error = gdrom_read_sectors(sc, bp-b_data, bp-b_rawblkno,
-	bp-b_bcount  11)))
+	bp-b_bcount  11, resid)))
 		bp-b_error = error;
 
 	sc-is_busy = 0;
 	wakeup(sc-is_busy);
+	bp-b_resid = resid;
+	biodone(bp);
+	return;
 
  done:
 	bp-b_resid = bp-b_bcount;



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

2010-08-31 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Aug 31 14:23:27 UTC 2010

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Fix lost interrupt. (1/2)
 + Change blocked_irqs that dispach if change pending_irqs in the loop.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.4 src/sys/arch/arm/pic/pic.c:1.5
--- src/sys/arch/arm/pic/pic.c:1.4	Tue Dec 30 05:43:14 2008
+++ src/sys/arch/arm/pic/pic.c	Tue Aug 31 14:23:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.4 2008/12/30 05:43:14 matt Exp $	*/
+/*	$NetBSD: pic.c,v 1.5 2010/08/31 14:23:27 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.4 2008/12/30 05:43:14 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.5 2010/08/31 14:23:27 kiyohara Exp $);
 
 #define _INTR_PRIVATE
 #include sys/param.h
@@ -229,7 +229,7 @@
 #endif
 		}
 		progress = true;
-		blocked_irqs = pending_irqs;
+		blocked_irqs = 0;
 		do {
 			irq = ffs(pending_irqs) - 1;
 			KASSERT(irq = 0);
@@ -240,9 +240,9 @@
 cpsie(I32_bit);
 pic_dispatch(is, frame);
 cpsid(I32_bit);
+blocked_irqs |= __BIT(irq);
 			} else {
 KASSERT(0);
-blocked_irqs = ~__BIT(irq);
 			}
 			pending_irqs = pic_find_pending_irqs_by_ipl(pic,
 			irq_base, *ipending, ipl);



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

2010-08-31 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Tue Aug 31 14:33:41 UTC 2010

Modified Files:
src/sys/arch/arm/pic: pic.c

Log Message:
Fix lost interrupt. (2/2)
  + It is likely to lose sight of interrupt when the interrupt of irq_base
that is smaller than the same at the level is generated if PIC_MAXSOURCES
is 33 or more.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/pic/pic.c

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

Modified files:

Index: src/sys/arch/arm/pic/pic.c
diff -u src/sys/arch/arm/pic/pic.c:1.5 src/sys/arch/arm/pic/pic.c:1.6
--- src/sys/arch/arm/pic/pic.c:1.5	Tue Aug 31 14:23:27 2010
+++ src/sys/arch/arm/pic/pic.c	Tue Aug 31 14:33:41 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.c,v 1.5 2010/08/31 14:23:27 kiyohara Exp $	*/
+/*	$NetBSD: pic.c,v 1.6 2010/08/31 14:33:41 kiyohara Exp $	*/
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -28,7 +28,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.5 2010/08/31 14:23:27 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: pic.c,v 1.6 2010/08/31 14:33:41 kiyohara Exp $);
 
 #define _INTR_PRIVATE
 #include sys/param.h
@@ -193,6 +193,7 @@
 	size_t irq_base;
 #if PIC_MAXSOURCES  32
 	size_t irq_count;
+	int poi = 0;		/* Possibility of interrupting */
 #endif
 	uint32_t pending_irqs;
 	uint32_t blocked_irqs;
@@ -214,14 +215,20 @@
 		if (pending_irqs == 0) {
 #if PIC_MAXSOURCES  32
 			irq_count += 32;
-			if (__predict_true(irq_count = pic-pic_maxsources))
-break;
-			irq_base += 32;
-			ipending++;
-			iblocked++;
-			if (irq_base = pic-pic_maxsources) {
+			if (__predict_true(irq_count = pic-pic_maxsources)) {
+if (!poi)
+	/*Interrupt at this level was handled.*/
+	break;
+irq_base = 0;
+irq_count = 0;
+poi = 0;
 ipending = pic-pic_pending_irqs;
 iblocked = pic-pic_blocked_irqs;
+			} else {
+irq_base += 32;
+ipending++;
+iblocked++;
+KASSERT(irq_base = pic-pic_maxsources);
 			}
 			continue;
 #else
@@ -240,6 +247,13 @@
 cpsie(I32_bit);
 pic_dispatch(is, frame);
 cpsid(I32_bit);
+#if PIC_MAXSOURCES  32
+/*
+ * There is a possibility of interrupting
+ * from cpsie() to cpsid().
+ */
+poi = 1;
+#endif
 blocked_irqs |= __BIT(irq);
 			} else {
 KASSERT(0);



CVS commit: src/usr.bin/audiocfg

2010-08-31 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Aug 31 14:57:26 UTC 2010

Modified Files:
src/usr.bin/audiocfg: Makefile
Added Files:
src/usr.bin/audiocfg: audiocfg.1

Log Message:
Add man page.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/usr.bin/audiocfg/Makefile
cvs rdiff -u -r0 -r1.1 src/usr.bin/audiocfg/audiocfg.1

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

Modified files:

Index: src/usr.bin/audiocfg/Makefile
diff -u src/usr.bin/audiocfg/Makefile:1.1.1.1 src/usr.bin/audiocfg/Makefile:1.2
--- src/usr.bin/audiocfg/Makefile:1.1.1.1	Mon Aug 30 02:19:47 2010
+++ src/usr.bin/audiocfg/Makefile	Tue Aug 31 14:57:26 2010
@@ -1,7 +1,6 @@
 PROG=	audiocfg
 SRCS=	audiodev.c drvctl.c
 SRCS+=	main.c
-NOMAN=	# defined
 WARNS=	3
 
 LDADD+=	-lprop

Added files:

Index: src/usr.bin/audiocfg/audiocfg.1
diff -u /dev/null src/usr.bin/audiocfg/audiocfg.1:1.1
--- /dev/null	Tue Aug 31 14:57:26 2010
+++ src/usr.bin/audiocfg/audiocfg.1	Tue Aug 31 14:57:26 2010
@@ -0,0 +1,71 @@
+.\	$NetBSD: audiocfg.1,v 1.1 2010/08/31 14:57:26 wiz Exp $
+.\
+.\ Copyright (c) 2010 The NetBSD Foundation, Inc.
+.\ All rights reserved.
+.\
+.\ This code is derived from software contributed to The NetBSD Foundation
+.\ by Thomas Klausner.
+.\
+.\ 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.
+.\
+.Dd August 31, 2010
+.Dt AUDIOCFG 1
+.Os
+.Sh NAME
+.Nm audiocfg
+.Nd configure default audio device
+.Sh SYNOPSIS
+.Nm
+.Op index
+.Sh DESCRIPTION
+The
+.Nm
+utility helps maintaining a
+.Pa /dev/audio
+symlink.
+Run without arguments, it lists the available audio devices and shows
+the current default audio device.
+If given an
+.Ar index
+argument, that device is set as default audio device.
+.Nm
+needs access to
+.Pa /dev/drvctl
+and write access to
+.Pa /dev
+(when given an
+.Ar index )
+to work.
+.Sh FILES
+.Bl -tag -width 10n
+.It Pa /dev/audio
+Symlink to default audio device.
+.It Pa /dev/audio[0-9]*
+Available audio devices.
+.It Pa /dev/drvctl
+Used for finding the correlating audio driver to an audio device.
+.El
+.Sh SEE ALSO
+.Xr audioplay 1 ,
+.Xr audiorecord 1 ,
+.Xr audio 4 ,
+.Xr drvctl 8



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

2010-08-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 31 15:17:20 UTC 2010

Modified Files:
src/sys/arch/dreamcast/dev: gdrom.c

Log Message:
- split device_t/softc
- include ioconf.h for struct cfdriver


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/dreamcast/dev/gdrom.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/dreamcast/dev/gdrom.c
diff -u src/sys/arch/dreamcast/dev/gdrom.c:1.27 src/sys/arch/dreamcast/dev/gdrom.c:1.28
--- src/sys/arch/dreamcast/dev/gdrom.c:1.27	Tue Aug 31 12:12:48 2010
+++ src/sys/arch/dreamcast/dev/gdrom.c	Tue Aug 31 15:17:20 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $	*/
+/*	$NetBSD: gdrom.c,v 1.28 2010/08/31 15:17:20 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 Marcus Comstedt
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
-__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.27 2010/08/31 12:12:48 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: gdrom.c,v 1.28 2010/08/31 15:17:20 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -50,8 +50,10 @@
 
 #include machine/sysasicvar.h
 
-int	gdrommatch(struct device *, struct cfdata *, void *);
-void	gdromattach(struct device *, struct device *, void *);
+#include ioconf.h
+
+int	gdrommatch(device_t, cfdata_t, void *);
+void	gdromattach(device_t, device_t, void *);
 
 dev_type_open(gdromopen);
 dev_type_close(gdromclose);
@@ -71,7 +73,7 @@
 };
 
 struct gdrom_softc {
-	struct device sc_dv;	/* generic device info; must come first */
+	device_t sc_dev;	/* generic device info */
 	struct disk dkdev;	/* generic disk info */
 	struct buf curbuf;	/* state of current I/O operation */
 
@@ -85,13 +87,11 @@
 	int cmd_cond;		/* resulting condition of command */
 };
 
-CFATTACH_DECL(gdrom, sizeof(struct gdrom_softc),
+CFATTACH_DECL_NEW(gdrom, sizeof(struct gdrom_softc),
 gdrommatch, gdromattach, NULL, NULL);
 
 struct dkdriver gdromdkdriver = { gdromstrategy };
 
-extern struct cfdriver gdrom_cd;
-
 
 struct gd_toc {
 	unsigned int entry[99];
@@ -368,7 +368,7 @@
 }
 
 int
-gdrommatch(struct device *parent, struct cfdata *cf, void *aux)
+gdrommatch(device_t parent, cfdata_t cf, void *aux)
 {
 	static int gdrom_matched = 0;
 
@@ -381,17 +381,18 @@
 }
 
 void
-gdromattach(struct device *parent, struct device *self, void *aux)
+gdromattach(device_t parent, device_t self, void *aux)
 {
 	struct gdrom_softc *sc;
 	uint32_t p, x;
 
-	sc = (struct gdrom_softc *)self;
+	sc = device_private(self);
+	sc-sc_dev = self;
 
 	/*
 	 * Initialize and attach the disk structure.
 	 */
-	disk_init(sc-dkdev, sc-sc_dv.dv_xname, gdromdkdriver);
+	disk_init(sc-dkdev, device_xname(self), gdromdkdriver);
 	disk_attach(sc-dkdev);
 
 	/*



CVS commit: src/tests

2010-08-31 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Aug 31 17:21:14 UTC 2010

Modified Files:
src/tests: h_macros.h

Log Message:
Add RZ(), which is like RL() except that it checks against 0 and
uses the return value as the error number instead of errno.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/h_macros.h

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

Modified files:

Index: src/tests/h_macros.h
diff -u src/tests/h_macros.h:1.5 src/tests/h_macros.h:1.6
--- src/tests/h_macros.h:1.5	Mon Aug 16 17:01:43 2010
+++ src/tests/h_macros.h	Tue Aug 31 17:21:14 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: h_macros.h,v 1.5 2010/08/16 17:01:43 pooka Exp $ */
+/* $NetBSD: h_macros.h,v 1.6 2010/08/31 17:21:14 pooka Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -44,6 +44,11 @@
 	ATF_CHECK_MSG((x) != (v), %s: %s, #x, strerror(errno))
 
 #define RL(x) REQUIRE_LIBC(x, -1)
+#define RZ(x)\
+do {	\
+	int RZ_rv = x;			\
+	ATF_REQUIRE_MSG(RZ_rv == 0, %s: %s, #x, strerror(RZ_rv));	\
+} while (/*CONSTCOND*/0)
 
 static __inline void
 atf_tc_fail_errno(const char *fmt, ...)



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

2010-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 31 19:03:55 UTC 2010

Added Files:
src/sys/arch/arm/omap: omapfb.c omapfbreg.h

Log Message:
a simple console driver for the OMAP 3xxx on-chip video
no acceleration so far and it will recycle whatever video mode the firmware
set up


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/omap/omapfb.c \
src/sys/arch/arm/omap/omapfbreg.h

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/arm/omap/omapfb.c
diff -u /dev/null src/sys/arch/arm/omap/omapfb.c:1.1
--- /dev/null	Tue Aug 31 19:03:55 2010
+++ src/sys/arch/arm/omap/omapfb.c	Tue Aug 31 19:03:55 2010
@@ -0,0 +1,690 @@
+/*	$NetBSD: omapfb.c,v 1.1 2010/08/31 19:03:55 macallan Exp $	*/
+
+/*
+ * Copyright (c) 2010 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * A console driver for OMAP 3530's built-in video controller
+ * tested on beagleboard only so far
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: omapfb.c,v 1.1 2010/08/31 19:03:55 macallan Exp $);
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/kernel.h
+#include sys/device.h
+#include sys/malloc.h
+#include sys/lwp.h
+#include sys/kauth.h
+
+#include uvm/uvm_extern.h
+
+#include dev/videomode/videomode.h
+
+#include machine/bus.h
+#include arm/omap/omapfbreg.h
+#include arm/omap/omap2_obiovar.h
+#include arm/omap/omap2_obioreg.h
+
+#include dev/wscons/wsdisplayvar.h
+#include dev/wscons/wsconsio.h
+#include dev/wsfont/wsfont.h
+#include dev/rasops/rasops.h
+#include dev/wscons/wsdisplay_vconsvar.h
+
+struct omapfb_softc {
+	device_t sc_dev;
+
+	bus_space_tag_t sc_iot;
+	bus_dma_tag_t sc_dmat;
+	bus_space_handle_t sc_regh;
+	bus_dmamap_t sc_dmamap;
+	bus_dma_segment_t sc_dmamem[1];
+	size_t sc_vramsize;
+
+	int sc_width, sc_height, sc_depth, sc_stride;
+	int sc_locked;
+	void *sc_fbaddr, *sc_vramaddr;
+	uint32_t *sc_clut;
+	struct vcons_screen sc_console_screen;
+	struct wsscreen_descr sc_defaultscreen_descr;
+	const struct wsscreen_descr *sc_screens[1];
+	struct wsscreen_list sc_screenlist;
+	struct vcons_data vd;
+	int sc_mode;
+	uint8_t sc_cmap_red[256], sc_cmap_green[256], sc_cmap_blue[256];
+};
+
+static int	omapfb_match(device_t, cfdata_t, void *);
+static void	omapfb_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(omapfb, sizeof(struct omapfb_softc),
+omapfb_match, omapfb_attach, NULL, NULL);
+
+static int	omapfb_ioctl(void *, void *, u_long, void *, int,
+			 struct lwp *);
+static paddr_t	omapfb_mmap(void *, void *, off_t, int);
+static void	omapfb_init_screen(void *, struct vcons_screen *, int, long *);
+
+static void	omapfb_init(struct omapfb_softc *);
+
+static int	omapfb_putcmap(struct omapfb_softc *, struct wsdisplay_cmap *);
+static int 	omapfb_getcmap(struct omapfb_softc *, struct wsdisplay_cmap *);
+static void	omapfb_restore_palette(struct omapfb_softc *);
+static void 	omapfb_putpalreg(struct omapfb_softc *, int, uint8_t,
+			uint8_t, uint8_t);
+
+#if 0
+static void	omapfb_flush_engine(struct omapfb_softc *);
+static void	omapfb_rectfill(struct omapfb_softc *, int, int, int, int,
+			uint32_t);
+static void	omapfb_bitblt(struct omapfb_softc *, int, int, int, int, int,
+			int, int);
+
+static void	omapfb_cursor(void *, int, int, int);
+static void	omapfb_putchar(void *, int, int, u_int, long);
+static void	omapfb_copycols(void *, int, int, int, int);
+static void	omapfb_erasecols(void *, int, int, int, long);
+static void	omapfb_copyrows(void *, int, int, int);
+static void	omapfb_eraserows(void *, int, int, long);
+#endif
+
+struct wsdisplay_accessops omapfb_accessops = {
+	

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

2010-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 31 19:07:01 UTC 2010

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

Log Message:
enable omapfb and related stuff


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/evbarm/conf/BEAGLEBOARD

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

Modified files:

Index: src/sys/arch/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.10 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.11
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.10	Sat Aug 28 13:02:32 2010
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Tue Aug 31 19:07:01 2010
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.10 2010/08/28 13:02:32 ahoka Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.11 2010/08/31 19:07:01 macallan Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -27,7 +27,7 @@
 
 file-system	FFS		# UFS
 #file-system	LFS		# log-structured file system
-file-system	MFS		# memory file system
+#file-system	MFS		# memory file system
 file-system	NFS		# Network file system
 #file-system 	ADOSFS		# AmigaDOS-compatible file system
 #file-system 	EXT2FS		# second extended file system (linux)
@@ -87,8 +87,8 @@
 
 #options 	COMPAT_43	# 4.3BSD compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
-options 	COMPAT_40	# NetBSD 4.0 compatibility.
-options 	COMPAT_30	# NetBSD 3.0 compatibility.
+#options 	COMPAT_40	# NetBSD 4.0 compatibility.
+#options 	COMPAT_30	# NetBSD 3.0 compatibility.
 #options 	COMPAT_20	# NetBSD 2.0 compatibility.
 #options 	COMPAT_16	# NetBSD 1.6 compatibility.
 #options 	COMPAT_15	# NetBSD 1.5 compatibility.
@@ -145,6 +145,7 @@
 
 ## USB Debugging options
 options USB_DEBUG
+options EHCI_DEBUG
 options OHCI_DEBUG 
 options UHUB_DEBUG 
 
@@ -168,7 +169,7 @@
 cpu0		at mainbus?
 
 # Specify the memory size in megabytes.
-options		MEMSIZE=128
+options		MEMSIZE=256
 
 # L3 Interconnect
 L3i0		at mainbus?
@@ -204,7 +205,7 @@
 
 # On-board 16550 UARTs
 com0		at obio2 addr 0x4902 intr 74 mult 4	# UART3 (console)
-#options 	CONSADDR=0x4902, CONSPEED=57600
+#options 	CONSADDR=0x4902, CONSPEED=38400
 options 	CONSADDR=0x4902, CONSPEED=115200
 
 # Operating System Timer
@@ -220,16 +221,47 @@
 #omapwdt32k*	at obio1 addr 0x4830c000 size 2048	# WDT1
 #omapwdt32k*	at obio1 addr 0x48314000 size 2048	# WDT2
 
+# onboard video
+omapfb*		at obio0 addr 0x4805 size 0x1
+
+# make sure the console display is always wsdisplay0
+wsdisplay0	at wsemuldisplaydev? console 1
+wsdisplay*	at wsemuldisplaydev?
+
+# various options for wscons - we try to look as much like a standard
+# sun console as possible
+options 	WSEMUL_VT100		# sun terminal emulation
+options 	WS_DEFAULT_FG=WSCOL_BLACK
+options 	WS_DEFAULT_BG=WSCOL_LIGHT_WHITE
+options		WS_KERNEL_FG=WSCOL_GREEN
+options		WS_KERNEL_BG=WSCOL_LIGHT_WHITE
+options 	WSDISPLAY_COMPAT_USL		# VT handling
+options 	WSDISPLAY_COMPAT_RAWKBD		# can get raw scancodes
+options 	WSDISPLAY_DEFAULTSCREENS=4
+options		FONT_QVSS8x15
+#options 	FONT_GALLANT12x22	# the console font
+
+pseudo-device	wsmux			# mouse  keyboard multiplexor
+pseudo-device	wsfont
+
 # Power, Reset and Clock Management
 prcm*		at obio1 addr 0x48306000 size 0x2000	# PRM Module
 
 # On-board USB
-#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
+ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #ohci*		at obio0 addr 0x48064400 size 0x0400 intr 76
 #usb*		at ohci?
-#uhub*		at usb?
-##umass*		at uhub? port ? configuration ? interface ?
-##wd*		at umass?
+usb*		at ehci?
+uhub*		at usb?
+uhub*		at uhub? port ?
+umass*		at uhub? port ? configuration ? interface ?
+wd*		at umass?
+uhidev*		at uhub?
+ukbd*		at uhidev?
+ums*		at uhidev?
+wskbd*		at ukbd?
+wsmouse*	at ums?
+
 #axe*		at uhub? port ? configuration ? interface ?
 
 # Hardware clocking and power management
@@ -241,7 +273,7 @@
 # Pseudo-Devices
 
 # disk/mass storage pseudo-devices
-pseudo-device	md		1	# memory disk device (ramdisk)
+#pseudo-device	md		1	# memory disk device (ramdisk)
 #pseudo-device	vnd			# disk-like interface to files
 #pseudo-device	fss			# file system snapshot device
 



CVS commit: src/doc

2010-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 31 19:08:50 UTC 2010

Modified Files:
src/doc: CHANGES

Log Message:
mention omapfb


To generate a diff of this commit:
cvs rdiff -u -r1.1433 -r1.1434 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.1433 src/doc/CHANGES:1.1434
--- src/doc/CHANGES:1.1433	Sat Aug 28 15:56:45 2010
+++ src/doc/CHANGES	Tue Aug 31 19:08:50 2010
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1433 $
+# LIST OF CHANGES FROM LAST RELEASE:			$Revision: 1.1434 $
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -712,4 +712,6 @@
 	tests: Convert the libdes tests to ATF.  [jmmv 20100825]
 	awk: upgrade to 20100523 [christos 20100826]
 	ntp: switch build to ntp 4.2.6 (imported 20091213 in external/bsd/ntp)
-		[kardel 20100827]
\ No newline at end of file
+		[kardel 20100827]
+	omapfb: a simple driver for OMAP 3xxx on-chip video, especially the
+		Beagleboard [macallan 20100831]



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

2010-08-31 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Aug 31 21:14:58 UTC 2010

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c cgfourteenvar.h

Log Message:
remove shadow framebuffer support, use VCONS_DONT_READ instead


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sparc/dev/cgfourteen.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/sparc/dev/cgfourteenvar.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.64 src/sys/arch/sparc/dev/cgfourteen.c:1.65
--- src/sys/arch/sparc/dev/cgfourteen.c:1.64	Thu Jun 10 13:21:13 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Tue Aug 31 21:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.64 2010/06/10 13:21:13 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.65 2010/08/31 21:14:57 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -366,8 +366,6 @@
 		sc-sc_fb.fb_pixels = (void *)fbva[1];
 	}
 
-	sc-sc_shadowfb = kmem_alloc(ramsize, KM_NOSLEEP);
-
 	if (isconsole)
 		printf( (console)\n);
 	else
@@ -785,10 +783,6 @@
 		memset(sc-sc_fb.fb_pixels,
 		   (defattr  16)  0xff,
 		   ri-ri_stride * ri-ri_height);
-		if (sc-sc_shadowfb != NULL)
-			memset(sc-sc_shadowfb,
-			   (defattr  16)  0xff,
-			   ri-ri_stride * ri-ri_height);
 		sc-sc_console_screen.scr_flags |= VCONS_SCREEN_IS_STATIC;
 
 		sc-sc_defaultscreen_descr.textops = ri-ri_ops;
@@ -1019,11 +1013,8 @@
 	ri-ri_stride = ri-ri_width;
 	ri-ri_flg = RI_CENTER | RI_FULLCLEAR;
 
-	if (sc-sc_shadowfb != NULL) {
-		ri-ri_bits = sc-sc_shadowfb;
-		ri-ri_hwbits = (char *)sc-sc_fb.fb_pixels;
-	} else 
-		ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
+	ri-ri_bits = (char *)sc-sc_fb.fb_pixels;
+	scr-scr_flags |= VCONS_DONT_READ;
 
 	if (existing) {
 		ri-ri_flg |= RI_CLEAR;

Index: src/sys/arch/sparc/dev/cgfourteenvar.h
diff -u src/sys/arch/sparc/dev/cgfourteenvar.h:1.12 src/sys/arch/sparc/dev/cgfourteenvar.h:1.13
--- src/sys/arch/sparc/dev/cgfourteenvar.h:1.12	Thu Jun 10 13:21:13 2010
+++ src/sys/arch/sparc/dev/cgfourteenvar.h	Tue Aug 31 21:14:57 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteenvar.h,v 1.12 2010/06/10 13:21:13 macallan Exp $ */
+/*	$NetBSD: cgfourteenvar.h,v 1.13 2010/08/31 21:14:57 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -87,15 +87,14 @@
 	struct	cg14_cursor sc_cursor;	/* Hardware cursor state */
 	union 	cg14cmap sc_saveclut; 	/* a place to stash PROM state */
 	size_t	sc_vramsize;
+	int 	sc_depth;	/* current colour depth */
 #if NWSDISPLAY  0
 	struct  vcons_data sc_vd;
-	struct vcons_screen sc_console_screen;
-	struct wsscreen_descr sc_defaultscreen_descr;
+	struct 	vcons_screen sc_console_screen;
+	struct 	wsscreen_descr sc_defaultscreen_descr;
 	const struct wsscreen_descr *sc_screens[1];
-	struct wsscreen_list sc_screenlist;
-	void *sc_shadowfb;
-	int sc_mode;	/* wsdisplay mode - EMUL, DUMB etc. */
-	int sc_depth;	/* current colour depth */
+	struct 	wsscreen_list sc_screenlist;
+	int 	sc_mode;	/* wsdisplay mode - EMUL, DUMB etc. */
 #endif
 
 	uint8_t	sc_savexlut[256];



CVS commit: [matt-nb5-mips64] src/sys/arch/mips

2010-08-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  1 00:59:43 UTC 2010

Modified Files:
src/sys/arch/mips/include [matt-nb5-mips64]: cpu.h
src/sys/arch/mips/mips [matt-nb5-mips64]: cpu_subr.c
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_cpu.c

Log Message:
Fill cpu_data cpu_{node,core,smt}_id for RMI.


To generate a diff of this commit:
cvs rdiff -u -r1.90.16.31 -r1.90.16.32 src/sys/arch/mips/include/cpu.h
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/sys/arch/mips/mips/cpu_subr.c
cvs rdiff -u -r1.1.2.13 -r1.1.2.14 src/sys/arch/mips/rmi/rmixl_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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.90.16.31 src/sys/arch/mips/include/cpu.h:1.90.16.32
--- src/sys/arch/mips/include/cpu.h:1.90.16.31	Wed Aug 18 17:01:20 2010
+++ src/sys/arch/mips/include/cpu.h	Wed Sep  1 00:59:42 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.90.16.31 2010/08/18 17:01:20 matt Exp $	*/
+/*	$NetBSD: cpu.h,v 1.90.16.32 2010/09/01 00:59:42 matt Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -86,6 +86,7 @@
 	 * Per-cpu pmap information
 	 */
 	int ci_tlb_slot;		/* reserved tlb entry for cpu_info */
+	u_int ci_pmap_asid_cur;		/* current ASID */
 	struct pmap_tlb_info *ci_tlb_info; /* tlb information for this cpu */
 	union segtab *ci_pmap_seg0tab;
 #ifdef _LP64
@@ -433,7 +434,8 @@
 #endif
 
 struct cpu_info *
-	cpu_info_alloc(struct pmap_tlb_info *, u_int);
+	cpu_info_alloc(struct pmap_tlb_info *, cpuid_t, cpuid_t, cpuid_t,
+	cpuid_t);
 void	cpu_attach_common(device_t, struct cpu_info *);
 void	cpu_startup_common(void);
 #ifdef _LP64

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.1.2.11 src/sys/arch/mips/mips/cpu_subr.c:1.1.2.12
--- src/sys/arch/mips/mips/cpu_subr.c:1.1.2.11	Thu Aug 19 07:20:19 2010
+++ src/sys/arch/mips/mips/cpu_subr.c	Wed Sep  1 00:59:42 2010
@@ -32,7 +32,7 @@
 #include opt_multiprocessor.h
 #include opt_sa.h
 
-__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.1.2.11 2010/08/19 07:20:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu_subr.c,v 1.1.2.12 2010/09/01 00:59:42 matt Exp $);
 
 #include sys/param.h
 #include sys/cpu.h
@@ -89,7 +89,8 @@
 static struct cpu_info *cpu_info_last = cpu_info_store;
 
 struct cpu_info *
-cpu_info_alloc(struct pmap_tlb_info *ti, u_int cpu_id)
+cpu_info_alloc(struct pmap_tlb_info *ti, cpuid_t cpu_id, cpuid_t cpu_node_id,
+	cpuid_t cpu_core_id, cpuid_t cpu_smt_id)
 {
 	vaddr_t cpu_info_offset = (vaddr_t)cpu_info_store  PAGE_MASK; 
 	struct pglist pglist;
@@ -126,6 +127,9 @@
 	}
 
 	ci-ci_cpuid = cpu_id;
+	ci-ci_data.cpu_node_id = cpu_node_id;
+	ci-ci_data.cpu_core_id = cpu_core_id;
+	ci-ci_data.cpu_smt_id = cpu_smt_id;
 	ci-ci_cpu_freq = cpu_info_store.ci_cpu_freq;
 	ci-ci_cctr_freq = cpu_info_store.ci_cctr_freq;
 ci-ci_cycles_per_hz = cpu_info_store.ci_cycles_per_hz;

Index: src/sys/arch/mips/rmi/rmixl_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.13 src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.14
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.1.2.13	Mon Aug 16 18:01:13 2010
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Wed Sep  1 00:59:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.1.2.13 2010/08/16 18:01:13 matt Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.1.2.14 2010/09/01 00:59:43 matt Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include locators.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.13 2010/08/16 18:01:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: rmixl_cpu.c,v 1.1.2.14 2010/09/01 00:59:43 matt Exp $);
 
 #include sys/param.h
 #include sys/device.h
@@ -168,7 +168,8 @@
 		KASSERT(ca-ca_core  8);
 		KASSERT(ca-ca_thread  4);
 		cpuid = (ca-ca_core  2) | ca-ca_thread;
-		ci = cpu_info_alloc(ccsc-sc_tlbinfo, cpuid);
+		ci = cpu_info_alloc(ccsc-sc_tlbinfo, cpuid,
+		/* XXX */ 0, ca-ca_core, ca-ca_thread);
 		KASSERT(ci != NULL);
 		sc-sc_dev = self;
 		sc-sc_ci = ci;



CVS commit: [matt-nb5-mips64] src/sys/arch/sbmips/sbmips

2010-08-31 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Sep  1 01:07:26 UTC 2010

Modified Files:
src/sys/arch/sbmips/sbmips [matt-nb5-mips64]: cpu.c

Log Message:
Pass node/core/smt id to cpu_info_alloc.


To generate a diff of this commit:
cvs rdiff -u -r1.18.16.8 -r1.18.16.9 src/sys/arch/sbmips/sbmips/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/sbmips/sbmips/cpu.c
diff -u src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.8 src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.9
--- src/sys/arch/sbmips/sbmips/cpu.c:1.18.16.8	Tue May 11 21:08:51 2010
+++ src/sys/arch/sbmips/sbmips/cpu.c	Wed Sep  1 01:07:26 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.18.16.8 2010/05/11 21:08:51 matt Exp $ */
+/* $NetBSD: cpu.c,v 1.18.16.9 2010/09/01 01:07:26 matt Exp $ */
 
 /*
  * Copyright 2000, 2001
@@ -33,7 +33,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.18.16.8 2010/05/11 21:08:51 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.18.16.9 2010/09/01 01:07:26 matt Exp $);
 
 #include opt_multiprocessor.h
 
@@ -134,7 +134,7 @@
 	} else {
 #if defined(MULTIPROCESSOR)
 		int status;
-		ci = cpu_info_alloc(NULL, found - 1);
+		ci = cpu_info_alloc(NULL, found - 1, 0, found - 1, 0);
 		KASSERT(ci);
 
 		cpu-sb1cpu_dev = self;