CVS commit: src/sys/arch/usermode

2012-01-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jan  3 10:53:46 UTC 2012

Modified Files:
src/sys/arch/usermode/include: machdep.h pcb.h
src/sys/arch/usermode/usermode: machdep.c trap.c

Log Message:
Fix logic that checks if its the kernel or a userland process that causes the
trap. Signal sending still needs to be addressed.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/usermode/include/machdep.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/usermode/include/pcb.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/usermode/usermode/machdep.c
cvs rdiff -u -r1.49 -r1.50 src/sys/arch/usermode/usermode/trap.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/machdep.h
diff -u src/sys/arch/usermode/include/machdep.h:1.6 src/sys/arch/usermode/include/machdep.h:1.7
--- src/sys/arch/usermode/include/machdep.h:1.6	Wed Dec 14 18:51:39 2011
+++ src/sys/arch/usermode/include/machdep.h	Tue Jan  3 10:53:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.h,v 1.6 2011/12/14 18:51:39 reinoud Exp $ */
+/* $NetBSD: machdep.h,v 1.7 2012/01/03 10:53:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -35,6 +35,7 @@ void	md_syscall_set_returnargs(lwp_t *l,
 		int error, register_t *rval);
 void	md_syscall_inc_pc(ucontext_t *ucp, uint32_t opcode);
 void	md_syscall_dec_pc(ucontext_t *ucp, uint32_t opcode);
+register_t md_get_pc(ucontext_t *ucp);
 
 /* handlers */
 void	syscall(void);

Index: src/sys/arch/usermode/include/pcb.h
diff -u src/sys/arch/usermode/include/pcb.h:1.14 src/sys/arch/usermode/include/pcb.h:1.15
--- src/sys/arch/usermode/include/pcb.h:1.14	Mon Dec 12 15:04:51 2011
+++ src/sys/arch/usermode/include/pcb.h	Tue Jan  3 10:53:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.14 2011/12/12 15:04:51 reinoud Exp $ */
+/* $NetBSD: pcb.h,v 1.15 2012/01/03 10:53:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -51,6 +51,7 @@ struct pcb {
 
 	int		 pcb_errno;		/* save/restore place */
 	vaddr_t		 pcb_fault_addr;	/* save place for fault addr */
+	vaddr_t		 pcb_fault_pc;		/* save place for fault PC */
 };
 
 #endif /* !_ARCH_USERMODE_INCLUDE_PCB_H */

Index: src/sys/arch/usermode/usermode/machdep.c
diff -u src/sys/arch/usermode/usermode/machdep.c:1.47 src/sys/arch/usermode/usermode/machdep.c:1.48
--- src/sys/arch/usermode/usermode/machdep.c:1.47	Thu Dec 29 21:22:49 2011
+++ src/sys/arch/usermode/usermode/machdep.c	Tue Jan  3 10:53:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.47 2011/12/29 21:22:49 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.48 2012/01/03 10:53:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -37,7 +37,7 @@
 #include opt_memsize.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.47 2011/12/29 21:22:49 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.48 2012/01/03 10:53:46 reinoud Exp $);
 
 #include sys/types.h
 #include sys/systm.h
@@ -440,6 +440,14 @@ md_syscall_set_returnargs(lwp_t *l, ucon
 	//dump_regs(reg);
 }
 
+register_t
+md_get_pc(ucontext_t *ucp)
+{
+	register_t *reg = (register_t *) ucp-uc_mcontext;
+
+	return reg[14];			/* EIP */
+}
+
 int
 md_syscall_check_opcode(ucontext_t *ucp)
 {

Index: src/sys/arch/usermode/usermode/trap.c
diff -u src/sys/arch/usermode/usermode/trap.c:1.49 src/sys/arch/usermode/usermode/trap.c:1.50
--- src/sys/arch/usermode/usermode/trap.c:1.49	Mon Jan  2 22:02:51 2012
+++ src/sys/arch/usermode/usermode/trap.c	Tue Jan  3 10:53:46 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.49 2012/01/02 22:02:51 reinoud Exp $ */
+/* $NetBSD: trap.c,v 1.50 2012/01/03 10:53:46 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk rein...@netbsd.org
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.49 2012/01/02 22:02:51 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: trap.c,v 1.50 2012/01/03 10:53:46 reinoud Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -108,7 +108,7 @@ mem_access_handler(int sig, siginfo_t *i
 	ucontext_t *uct = ctx;
 	struct lwp *l;
 	struct pcb *pcb;
-	vaddr_t va;
+	vaddr_t va, pc;
 
 	assert((info-si_signo == SIGSEGV) || (info-si_signo == SIGBUS));
 
@@ -147,9 +147,13 @@ mem_access_handler(int sig, siginfo_t *i
 	l = curlwp;
 	pcb = lwp_getpcb(l);
 
+	/* get address of faulted memory access and make it page aligned */
 	va = (vaddr_t) info-si_addr;
 	va = trunc_page(va);
 
+	/* get PC address of faulted memory instruction */
+	pc = md_get_pc(ctx);
+
 #if 0	/* disabled for now, these checks need to move */
 #ifdef DIAGNOSTIC
 	/* sanity */
@@ -169,6 +173,7 @@ mem_access_handler(int sig, siginfo_t *i
 	/* remember our parameters */
 //	assert((void *) pcb-pcb_fault_addr == NULL);
 	pcb-pcb_fault_addr = va;
+	pcb-pcb_fault_pc   = pc;
 
 	/* switch to the pagefault entry on return from signal */
 	memcpy(uct, 

CVS commit: src/sys/arch/usermode

2012-01-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jan  3 12:05:01 UTC 2012

Modified Files:
src/sys/arch/usermode/dev: cpu.c ld_thunkbus.c
src/sys/arch/usermode/include: thunk.h
src/sys/arch/usermode/usermode: pmap.c syscall.c thunk.c trap.c

Log Message:
Rename the debug printf's to use a thunk_ prefix to avoid confusion.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/usermode/dev/cpu.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/usermode/dev/ld_thunkbus.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/usermode/usermode/syscall.c
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/usermode/usermode/thunk.c
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/usermode/usermode/trap.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.57 src/sys/arch/usermode/dev/cpu.c:1.58
--- src/sys/arch/usermode/dev/cpu.c:1.57	Tue Dec 27 14:55:31 2011
+++ src/sys/arch/usermode/dev/cpu.c	Tue Jan  3 12:05:01 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.57 2011/12/27 14:55:31 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
 #include opt_hz.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.57 2011/12/27 14:55:31 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -164,7 +164,7 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 	struct cpu_info *ci = curcpu();
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n,
+	thunk_printf_debug(cpu_switchto [%s,pid=%d,lid=%d] - [%s,pid=%d,lid=%d]\n,
 	oldlwp ? oldlwp-l_name : none,
 	oldlwp ? oldlwp-l_proc-p_pid : -1,
 	oldlwp ? oldlwp-l_lid : -1,
@@ -172,14 +172,14 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 	newlwp ? newlwp-l_proc-p_pid : -1,
 	newlwp ? newlwp-l_lid : -1);
 	if (oldpcb) {
-		dprintf_debug(oldpcb uc_link=%p, uc_stack.ss_sp=%p, 
+		thunk_printf_debug(oldpcb uc_link=%p, uc_stack.ss_sp=%p, 
 		uc_stack.ss_size=%d\n,
 		oldpcb-pcb_ucp.uc_link,
 		oldpcb-pcb_ucp.uc_stack.ss_sp,
 		(int)oldpcb-pcb_ucp.uc_stack.ss_size);
 	}
 	if (newpcb) {
-		dprintf_debug(newpcb uc_link=%p, uc_stack.ss_sp=%p, 
+		thunk_printf_debug(newpcb uc_link=%p, uc_stack.ss_sp=%p, 
 		uc_stack.ss_size=%d\n,
 		newpcb-pcb_ucp.uc_link,
 		newpcb-pcb_ucp.uc_stack.ss_sp,
@@ -203,7 +203,7 @@ cpu_switchto(lwp_t *oldlwp, lwp_t *newlw
 	}
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_switchto: returning %p (was %p)\n, ci-ci_stash, oldlwp);
+	thunk_printf_debug(cpu_switchto: returning %p (was %p)\n, ci-ci_stash, oldlwp);
 #endif
 	return ci-ci_stash;
 }
@@ -212,7 +212,7 @@ void
 cpu_dumpconf(void)
 {
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_dumpconf\n);
+	thunk_printf_debug(cpu_dumpconf\n);
 #endif
 }
 
@@ -228,7 +228,7 @@ cpu_getmcontext(struct lwp *l, mcontext_
 	ucontext_t *ucp = pcb-pcb_userret_ucp;
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_getmcontext\n);
+	thunk_printf_debug(cpu_getmcontext\n);
 #endif
 	memcpy(mcp, ucp-uc_mcontext, sizeof(mcontext_t));
 	return;
@@ -241,7 +241,7 @@ cpu_setmcontext(struct lwp *l, const mco
 	ucontext_t *ucp = pcb-pcb_userret_ucp;
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_setmcontext\n);
+	thunk_printf_debug(cpu_setmcontext\n);
 #endif
 	memcpy(ucp-uc_mcontext, mcp, sizeof(mcontext_t));
 	return 0;
@@ -262,7 +262,7 @@ void
 cpu_lwp_free(struct lwp *l, int proc)
 {
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_lwp_free (dummy)\n);
+	thunk_printf_debug(cpu_lwp_free (dummy)\n);
 #endif
 }
 
@@ -272,7 +272,7 @@ cpu_lwp_free2(struct lwp *l)
 	struct pcb *pcb = lwp_getpcb(l);
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_lwp_free2\n);
+	thunk_printf_debug(cpu_lwp_free2\n);
 #endif
 
 	if (pcb == NULL)
@@ -301,7 +301,7 @@ static void
 cpu_lwp_trampoline(ucontext_t *ucp, void (*func)(void *), void *arg)
 {
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_lwp_trampoline called with func %p, arg %p\n, (void *) func, arg);
+	thunk_printf_debug(cpu_lwp_trampoline called with func %p, arg %p\n, (void *) func, arg);
 #endif
 	/* init lwp */
 	lwp_startup(curcpu()-ci_stash, curlwp);
@@ -320,7 +320,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	void *stack_ucp, *stack_syscall_ucp, *stack_pagefault_ucp;
 
 #ifdef CPU_DEBUG
-	dprintf_debug(cpu_lwp_fork [%s/%p] - [%s/%p] stack=%p stacksize=%d\n,
+	thunk_printf_debug(cpu_lwp_fork [%s/%p] - [%s/%p] stack=%p stacksize=%d\n,
 	l1 ? l1-l_name : none, l1,
 	l2 ? l2-l_name : none, l2,
 	stack, (int)stacksize);
@@ -338,6 +338,10 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
 	

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

2012-01-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jan  3 12:10:04 UTC 2012

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

Log Message:
Use M_WAITOK instead of M_NOWAIT for the stack allocations


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 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.58 src/sys/arch/usermode/dev/cpu.c:1.59
--- src/sys/arch/usermode/dev/cpu.c:1.58	Tue Jan  3 12:05:01 2012
+++ src/sys/arch/usermode/dev/cpu.c	Tue Jan  3 12:10:04 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $ */
+/* $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -30,7 +30,7 @@
 #include opt_hz.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.58 2012/01/03 12:05:01 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: cpu.c,v 1.59 2012/01/03 12:10:04 reinoud Exp $);
 
 #include sys/param.h
 #include sys/conf.h
@@ -333,9 +333,9 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	memcpy(pcb2, pcb1, sizeof(struct pcb));
 
 	stacksize = 2*PAGE_SIZE;
-	stack_ucp   = malloc(stacksize, M_TEMP, M_NOWAIT);
-	stack_syscall_ucp   = malloc(stacksize, M_TEMP, M_NOWAIT);
-	stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
+	stack_ucp   = malloc(stacksize, M_TEMP, M_WAITOK);
+	stack_syscall_ucp   = malloc(stacksize, M_TEMP, M_WAITOK);
+	stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK);
 	pcb2-pcb_needfree = true;
 
 	KASSERT(stack_ucp);
@@ -414,8 +414,8 @@ cpu_startup(void)
 	memcpy(lwp0pcb.pcb_trapret_ucp,   lwp0pcb.pcb_ucp, sizeof(ucontext_t));
 
 	/* set up the ucontext for the pagefault */
-	stacksize = 16*PAGE_SIZE;
-	stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_NOWAIT);
+	stacksize = 8*PAGE_SIZE;
+	stack_pagefault_ucp = malloc(stacksize, M_TEMP, M_WAITOK);
 
 	lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_sp = stack_pagefault_ucp;
 	lwp0pcb.pcb_pagefault_ucp.uc_stack.ss_size = stacksize;



CVS commit: src/sys/ufs/ffs

2012-01-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan  3 15:44:00 UTC 2012

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
Display current mount point, rather than previous one, when printing
the replaying log to disk message.

OK dholland@

Fixes PR kern/39609


To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/ufs/ffs/ffs_vfsops.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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.271 src/sys/ufs/ffs/ffs_vfsops.c:1.272
--- src/sys/ufs/ffs/ffs_vfsops.c:1.271	Mon Nov 14 18:35:14 2011
+++ src/sys/ufs/ffs/ffs_vfsops.c	Tue Jan  3 15:44:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.271 2011/11/14 18:35:14 hannken Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.272 2012/01/03 15:44:00 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.271 2011/11/14 18:35:14 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.272 2012/01/03 15:44:00 pgoyette Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -524,7 +524,7 @@ ffs_mount(struct mount *mp, const char *
 #ifdef WAPBL
 			if (fs-fs_flags  FS_DOWAPBL) {
 printf(%s: replaying log to disk\n,
-fs-fs_fsmnt);
+mp-mnt_stat.f_mntonname);
 KDASSERT(mp-mnt_wapbl_replay);
 error = wapbl_replay_write(mp-mnt_wapbl_replay,
 			   devvp);



CVS commit: src/usr.bin/man

2012-01-03 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Jan  3 17:49:57 UTC 2012

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

Log Message:
If the default path doesn't result in a match, bail out early instead of
running into a segmentation fault. Based on patch by Abhinav Upadhyay.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/usr.bin/man/man.c

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

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.43 src/usr.bin/man/man.c:1.44
--- src/usr.bin/man/man.c:1.43	Tue Jun 14 20:08:45 2011
+++ src/usr.bin/man/man.c	Tue Jan  3 17:49:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.43 2011/06/14 20:08:45 wiz Exp $	*/
+/*	$NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT(@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = @(#)man.c	8.17 (Berkeley) 1/31/95;
 #else
-__RCSID($NetBSD: man.c,v 1.43 2011/06/14 20:08:45 wiz Exp $);
+__RCSID($NetBSD: man.c,v 1.44 2012/01/03 17:49:57 joerg Exp $);
 #endif
 #endif /* not lint */
 
@@ -1021,7 +1021,13 @@ printmanpath(struct manstate *m)
 	
 	if (glob(defaultpath, GLOB_BRACE | GLOB_NOSORT, NULL, pg) != 0)
 		err(EXIT_FAILURE, glob failed);
-		
+
+	if (pg.gl_matchc == 0) {
+		warnx(Default path in %s doesn't exist, _PATH_MANCONF);
+		globfree(pg);
+		return;
+	}
+
 	TAILQ_FOREACH(esubd, subdirs-entrylist, q) {
 		/* Drop cat page directory, only sources are relevant. */
 		if (strncmp(esubd-s, man, 3))



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan  3 18:26:25 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pci_map.c

Log Message:
Only probe the upper BAR of a mem64 if the bit31 of the lower BAR isn't
writable.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.12.1 src/sys/dev/pci/pci_map.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/pci/pci_map.c
diff -u src/sys/dev/pci/pci_map.c:1.24 src/sys/dev/pci/pci_map.c:1.24.12.1
--- src/sys/dev/pci/pci_map.c:1.24	Tue Jul 22 04:52:19 2008
+++ src/sys/dev/pci/pci_map.c	Tue Jan  3 18:26:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_map.c,v 1.24 2008/07/22 04:52:19 bjs Exp $	*/
+/*	$NetBSD: pci_map.c,v 1.24.12.1 2012/01/03 18:26:25 matt Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_map.c,v 1.24 2008/07/22 04:52:19 bjs Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_map.c,v 1.24.12.1 2012/01/03 18:26:25 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -131,7 +131,8 @@ pci_mem_find(pci_chipset_tag_t pc, pcita
 	 *
 	 * 2) A device which wants 2^n bytes of memory will hardwire the bottom
 	 * n bits of the address to 0.  As recommended, we write all 1s and see
-	 * what we get back.
+	 * what we get back.  Only probe the upper BAR of a mem64 BAR if bit 31
+	 * is readonly.
 	 */
 	s = splhigh();
 	address = pci_conf_read(pc, tag, reg);
@@ -140,9 +141,11 @@ pci_mem_find(pci_chipset_tag_t pc, pcita
 	pci_conf_write(pc, tag, reg, address);
 	if (is64bit) {
 		address1 = pci_conf_read(pc, tag, reg + 4);
-		pci_conf_write(pc, tag, reg + 4, 0x);
-		mask1 = pci_conf_read(pc, tag, reg + 4);
-		pci_conf_write(pc, tag, reg + 4, address1);
+		if ((mask  0x8000) == 0) {
+			pci_conf_write(pc, tag, reg + 4, 0x);
+			mask1 = pci_conf_read(pc, tag, reg + 4);
+			pci_conf_write(pc, tag, reg + 4, address1);
+		}
 	}
 	splx(s);
 



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan  3 18:27:21 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: ehci_pci.c

Log Message:
Only do the pci_conf_write if PCI_COMMAND_MASTER_ENABLE isn't already set.


To generate a diff of this commit:
cvs rdiff -u -r1.38.16.1.2.1 -r1.38.16.1.2.2 src/sys/dev/pci/ehci_pci.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/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.1 src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.2
--- src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.1	Wed Apr 21 00:27:39 2010
+++ src/sys/dev/pci/ehci_pci.c	Tue Jan  3 18:27:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.38.16.1.2.1 2010/04/21 00:27:39 matt Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.38.16.1.2.2 2012/01/03 18:27:21 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.38.16.1.2.1 2010/04/21 00:27:39 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.38.16.1.2.2 2012/01/03 18:27:21 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -165,8 +165,10 @@ ehci_pci_attach(struct device *parent, s
 
 	/* Enable the device. */
 	csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
-	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
-		   csr | PCI_COMMAND_MASTER_ENABLE);
+	if ((csr  PCI_COMMAND_MASTER_ENABLE) == 0) {
+		pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG,
+			   csr | PCI_COMMAND_MASTER_ENABLE);
+	}
 
 	/* Disable interrupts, so we don't get any spurious ones. */
 	sc-sc.sc_offs = EREAD1(sc-sc, EHCI_CAPLENGTH);



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan  3 18:27:47 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs

Log Message:
Change XLP_RAID to XLP_DMA.


To generate a diff of this commit:
cvs rdiff -u -r1.962.4.1.4.6 -r1.962.4.1.4.7 src/sys/dev/pci/pcidevs

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/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.962.4.1.4.6 src/sys/dev/pci/pcidevs:1.962.4.1.4.7
--- src/sys/dev/pci/pcidevs:1.962.4.1.4.6	Sat Dec 31 02:25:42 2011
+++ src/sys/dev/pci/pcidevs	Tue Jan  3 18:27:47 2012
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp $
+$NetBSD: pcidevs,v 1.962.4.1.4.7 2012/01/03 18:27:47 matt Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -2917,7 +2917,7 @@ product NETLOGIC XLP_OHCIUSB	0x1008	XLP 
 product NETLOGIC XLP_NAE	0x1009	XLP Network Acceleration engine
 product NETLOGIC XLP_POE	0x100A	XLP Packet Ordering engine
 product NETLOGIC XLP_FMN	0x100B	XLP Fast Messaging Network
-product NETLOGIC XLP_RAID	0x100C	XLP Data Transfer and RAID engine
+product NETLOGIC XLP_DMA	0x100C	XLP Data Transfer and RAID engine
 product NETLOGIC XLP_SAE	0x100D	XLP Security accelerator
 product NETLOGIC XLP_PKE	0x100E	XLP RSA/ECC accelerator
 product NETLOGIC XLP_CDE	0x100F	XLP Compress/Decompression engine



CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan  3 18:28:36 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: pcidevs.h pcidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.963.4.1.4.6 -r1.963.4.1.4.7 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.962.4.1.4.6 -r1.962.4.1.4.7 src/sys/dev/pci/pcidevs_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/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.963.4.1.4.6 src/sys/dev/pci/pcidevs.h:1.963.4.1.4.7
--- src/sys/dev/pci/pcidevs.h:1.963.4.1.4.6	Sat Dec 31 02:26:21 2011
+++ src/sys/dev/pci/pcidevs.h	Tue Jan  3 18:28:15 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.963.4.1.4.6 2011/12/31 02:26:21 matt Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.963.4.1.4.7 2012/01/03 18:28:15 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp
+ *	NetBSD: pcidevs,v 1.962.4.1.4.7 2012/01/03 18:27:47 matt Exp
  */
 
 /*
@@ -2924,7 +2924,7 @@
 #define	PCI_PRODUCT_NETLOGIC_XLP_NAE	0x1009		/* XLP Network Acceleration engine */
 #define	PCI_PRODUCT_NETLOGIC_XLP_POE	0x100A		/* XLP Packet Ordering engine */
 #define	PCI_PRODUCT_NETLOGIC_XLP_FMN	0x100B		/* XLP Fast Messaging Network */
-#define	PCI_PRODUCT_NETLOGIC_XLP_RAID	0x100C		/* XLP Data Transfer and RAID engine */
+#define	PCI_PRODUCT_NETLOGIC_XLP_DMA	0x100C		/* XLP Data Transfer and RAID engine */
 #define	PCI_PRODUCT_NETLOGIC_XLP_SAE	0x100D		/* XLP Security accelerator */
 #define	PCI_PRODUCT_NETLOGIC_XLP_PKE	0x100E		/* XLP RSA/ECC accelerator */
 #define	PCI_PRODUCT_NETLOGIC_XLP_CDE	0x100F		/* XLP Compress/Decompression engine */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.6 src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.7
--- src/sys/dev/pci/pcidevs_data.h:1.962.4.1.4.6	Sat Dec 31 02:26:21 2011
+++ src/sys/dev/pci/pcidevs_data.h	Tue Jan  3 18:28:16 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.962.4.1.4.6 2011/12/31 02:26:21 matt Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.962.4.1.4.7 2012/01/03 18:28:16 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.962.4.1.4.6 2011/12/31 02:25:42 matt Exp
+ *	NetBSD: pcidevs,v 1.962.4.1.4.7 2012/01/03 18:27:47 matt Exp
  */
 
 /*
@@ -10244,7 +10244,7 @@ static const struct pci_product pci_prod
 	XLP Fast Messaging Network,
 	},
 	{
-	PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_RAID,
+	PCI_VENDOR_NETLOGIC, PCI_PRODUCT_NETLOGIC_XLP_DMA,
 	XLP Data Transfer and RAID engine,
 	},
 	{



CVS commit: src/lib/libpam/modules

2012-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan  3 19:02:55 UTC 2012

Modified Files:
src/lib/libpam/modules/pam_chroot: pam_chroot.c
src/lib/libpam/modules/pam_exec: pam_exec.c
src/lib/libpam/modules/pam_ftpusers: pam_ftpusers.c
src/lib/libpam/modules/pam_lastlog: pam_lastlog.c
src/lib/libpam/modules/pam_login_access: login_access.c
src/lib/libpam/modules/pam_ssh: pam_ssh.c

Log Message:
avoid using %m in format.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/lib/libpam/modules/pam_chroot/pam_chroot.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libpam/modules/pam_exec/pam_exec.c
cvs rdiff -u -r1.5 -r1.6 src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c
cvs rdiff -u -r1.13 -r1.14 src/lib/libpam/modules/pam_lastlog/pam_lastlog.c
cvs rdiff -u -r1.5 -r1.6 \
src/lib/libpam/modules/pam_login_access/login_access.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libpam/modules/pam_ssh/pam_ssh.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/libpam/modules/pam_chroot/pam_chroot.c
diff -u src/lib/libpam/modules/pam_chroot/pam_chroot.c:1.4 src/lib/libpam/modules/pam_chroot/pam_chroot.c:1.5
--- src/lib/libpam/modules/pam_chroot/pam_chroot.c:1.4	Mon Apr 18 23:15:34 2005
+++ src/lib/libpam/modules/pam_chroot/pam_chroot.c	Tue Jan  3 14:02:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_chroot.c,v 1.4 2005/04/19 03:15:34 christos Exp $	*/
+/*	$NetBSD: pam_chroot.c,v 1.5 2012/01/03 19:02:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_chroot/pam_chroot.c,v 1.3 2003/04/30 00:40:24 des Exp $);
 #else
-__RCSID($NetBSD: pam_chroot.c,v 1.4 2005/04/19 03:15:34 christos Exp $);
+__RCSID($NetBSD: pam_chroot.c,v 1.5 2012/01/03 19:02:54 christos Exp $);
 #endif
 
 #include sys/param.h
@@ -46,6 +46,7 @@ __RCSID($NetBSD: pam_chroot.c,v 1.4 200
 #include pwd.h
 #include stdio.h
 #include string.h
+#include errno.h
 #include unistd.h
 
 #define PAM_SM_SESSION
@@ -96,11 +97,11 @@ pam_sm_open_session(pam_handle_t *pamh, 
 	openpam_log(PAM_LOG_DEBUG, chrooting %s to %s, dir, user);
 
 	if (chroot(dir) == -1) {
-		openpam_log(PAM_LOG_ERROR, chroot(): %m);
+		openpam_log(PAM_LOG_ERROR, chroot(): %s, strerror(errno));
 		return (PAM_SESSION_ERR);
 	}
 	if (chdir(cwd) == -1) {
-		openpam_log(PAM_LOG_ERROR, chdir(): %m);
+		openpam_log(PAM_LOG_ERROR, chdir(): %s, strerror(errno));
 		return (PAM_SESSION_ERR);
 	}
 	pam_setenv(pamh, HOME, cwd, 1);

Index: src/lib/libpam/modules/pam_exec/pam_exec.c
diff -u src/lib/libpam/modules/pam_exec/pam_exec.c:1.5 src/lib/libpam/modules/pam_exec/pam_exec.c:1.6
--- src/lib/libpam/modules/pam_exec/pam_exec.c:1.5	Wed Feb  2 21:05:59 2011
+++ src/lib/libpam/modules/pam_exec/pam_exec.c	Tue Jan  3 14:02:54 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $	*/
+/*	$NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001,2003 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.c,v 1.4 2005/02/01 10:37:07 des Exp $);
 #else
-__RCSID($NetBSD: pam_exec.c,v 1.5 2011/02/03 02:05:59 christos Exp $);
+__RCSID($NetBSD: pam_exec.c,v 1.6 2012/01/03 19:02:54 christos Exp $);
 #endif
 
 #include sys/types.h
@@ -128,15 +128,15 @@ _pam_exec(pam_handle_t *pamh __unused, i
 	}
 	openpam_free_envlist(envlist);
 	if (pid == -1) {
-		openpam_log(PAM_LOG_ERROR, vfork(): %m);
+		openpam_log(PAM_LOG_ERROR, vfork(): %s, strerror(errno));
 		return (PAM_SYSTEM_ERR);
 	}
 	if (waitpid(pid, status, 0) == -1) {
-		openpam_log(PAM_LOG_ERROR, waitpid(): %m);
+		openpam_log(PAM_LOG_ERROR, waitpid(): %s, strerror(errno));
 		return (PAM_SYSTEM_ERR);
 	}
 	if (childerr != 0) {
-		openpam_log(PAM_LOG_ERROR, execve(): %m);
+		openpam_log(PAM_LOG_ERROR, execve(): %s, strerror(errno));
 		return (PAM_SYSTEM_ERR);
 	}
 	if (WIFSIGNALED(status)) {

Index: src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c
diff -u src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c:1.5 src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c:1.6
--- src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c:1.5	Tue Apr 19 09:04:38 2005
+++ src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c	Tue Jan  3 14:02:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pam_ftpusers.c,v 1.5 2005/04/19 13:04:38 christos Exp $	*/
+/*	$NetBSD: pam_ftpusers.c,v 1.6 2012/01/03 19:02:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/lib/libpam/modules/pam_ftpusers/pam_ftpusers.c,v 1.1 2002/05/08 00:30:10 des Exp $);
 #else
-__RCSID($NetBSD: pam_ftpusers.c,v 1.5 2005/04/19 13:04:38 christos Exp $);
+__RCSID($NetBSD: pam_ftpusers.c,v 1.6 2012/01/03 19:02:55 christos Exp $);
 #endif
 
 

CVS commit: src/sys/arch/usermode

2012-01-03 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Jan  3 21:28:50 UTC 2012

Modified Files:
src/sys/arch/usermode/conf: GENERIC.i386 std.usermode
src/sys/arch/usermode/include: vmparam.h
src/sys/arch/usermode/usermode: pmap.c trap.c

Log Message:
Rework NetBSD/usermode pmap fixing some oddities that were left over from
earlier times when we were forced to run PIE executables and were forced to
use a KVM above the kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/usermode/conf/GENERIC.i386
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/usermode/conf/std.usermode
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/include/vmparam.h
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/usermode/usermode/trap.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/conf/GENERIC.i386
diff -u src/sys/arch/usermode/conf/GENERIC.i386:1.1 src/sys/arch/usermode/conf/GENERIC.i386:1.2
--- src/sys/arch/usermode/conf/GENERIC.i386:1.1	Tue Dec 20 21:01:39 2011
+++ src/sys/arch/usermode/conf/GENERIC.i386	Tue Jan  3 21:28:50 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC.i386,v 1.1 2011/12/20 21:01:39 jmcneill Exp $
+# $NetBSD: GENERIC.i386,v 1.2 2012/01/03 21:28:50 reinoud Exp $
 
 machine usermode
 include arch/usermode/conf/GENERIC.common
@@ -6,12 +6,12 @@ include arch/i386/conf/majors.i386
 
 no options EXEC_ELF64
 
-options		TEXTADDR=0x0f00	# 1.5 Gb?
-options		KVMSIZE=0x00800
-
+options		TEXTADDR=0x4000	# 1 Gb `phys ram' / total space
+options		KVMSIZE= 0x1000	# KVM space reserved in VM map, 256 Mb
+options		NKMEMPAGES_MAX=32768	# 128 Mb max
 makeoptions	COPTS+=-m32
 makeoptions	LD=ld -melf_i386
 
 #options 	INCLUDE_CONFIG_FILE
-#ident 		GENERIC32-$Revision: 1.1 $
+#ident 		GENERIC32-$Revision: 1.2 $
 

Index: src/sys/arch/usermode/conf/std.usermode
diff -u src/sys/arch/usermode/conf/std.usermode:1.9 src/sys/arch/usermode/conf/std.usermode:1.10
--- src/sys/arch/usermode/conf/std.usermode:1.9	Tue Dec 20 21:01:39 2011
+++ src/sys/arch/usermode/conf/std.usermode	Tue Jan  3 21:28:50 2012
@@ -1,15 +1,13 @@
-# $NetBSD: std.usermode,v 1.9 2011/12/20 21:01:39 jmcneill Exp $
+# $NetBSD: std.usermode,v 1.10 2012/01/03 21:28:50 reinoud Exp $
 
 include conf/std
 
-options 	HZ=100
+options 	HZ=20
 options		EXEC_ELF32
 options 	EXEC_ELF64
 options 	EXEC_SCRIPT
 
 # Defaults
-options		NKMEMPAGES=4096
-#options		NKMEMPAGES_MAX_DEFAULT=2048
 options		syscall_debug
 
 defflag opt_xen.h	DO_NOT_DEFINE

Index: src/sys/arch/usermode/include/vmparam.h
diff -u src/sys/arch/usermode/include/vmparam.h:1.12 src/sys/arch/usermode/include/vmparam.h:1.13
--- src/sys/arch/usermode/include/vmparam.h:1.12	Sun Dec 25 21:10:00 2011
+++ src/sys/arch/usermode/include/vmparam.h	Tue Jan  3 21:28:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: vmparam.h,v 1.12 2011/12/25 21:10:00 reinoud Exp $ */
+/* $NetBSD: vmparam.h,v 1.13 2012/01/03 21:28:50 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -35,14 +35,14 @@
 #define __USE_TOPDOWN_VM
 
 extern paddr_t kmem_k_start, kmem_k_end;
-extern paddr_t kmem_ext_start, kmem_ext_end;
+extern paddr_t kmem_kvm_start, kmem_kvm_end;
 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_user_start
-#define VM_MAXUSER_ADDRESS	kmem_user_end
 #define VM_MAX_ADDRESS		kmem_user_end
+#define VM_MAXUSER_ADDRESS	kmem_user_end
+#define VM_MIN_KERNEL_ADDRESS	kmem_kvm_start
+#define VM_MAX_KERNEL_ADDRESS 	kmem_kvm_end
 
 #define VM_PHYSSEG_STRAT	VM_PSTRAT_BIGFIRST
 #define VM_PHYSSEG_MAX		1
@@ -51,6 +51,9 @@ extern paddr_t kmem_user_start, kmem_use
 
 #define	USRSTACK		VM_MAXUSER_ADDRESS
 
+/* override the default pager_map size, there is little KVA */
+#define PAGER_MAP_DEFAULT_SIZE	(4 * 1024 * 1024)
+
 #if defined(__i386__) 
 #define	PAGE_SHIFT		12
 #define	PAGE_SIZE		(1  PAGE_SHIFT)

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.91 src/sys/arch/usermode/usermode/pmap.c:1.92
--- src/sys/arch/usermode/usermode/pmap.c:1.91	Tue Jan  3 12:16:16 2012
+++ src/sys/arch/usermode/usermode/pmap.c	Tue Jan  3 21:28:50 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.91 2012/01/03 12:16:16 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.92 2012/01/03 21:28:50 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.91 2012/01/03 12:16:16 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.92 2012/01/03 21:28:50 reinoud Exp $);
 
 #include opt_memsize.h
 #include opt_kmempages.h
@@ -85,7 +85,6 @@ static pmap_t active_pmap = NULL;
 
 static char  mem_name[20] = ;
 static int   mem_fh;
-static void *mem_uvm;	/* keeps all memory managed 

CVS commit: src/sys/dev/rasops

2012-01-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jan  3 23:13:59 UTC 2012

Modified Files:
src/sys/dev/rasops: rasops.h

Log Message:
add a macro to identify alpha fonts


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/rasops/rasops.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/rasops/rasops.h
diff -u src/sys/dev/rasops/rasops.h:1.28 src/sys/dev/rasops/rasops.h:1.29
--- src/sys/dev/rasops/rasops.h:1.28	Wed Dec 28 08:36:46 2011
+++ src/sys/dev/rasops/rasops.h	Tue Jan  3 23:13:59 2012
@@ -1,4 +1,4 @@
-/* 	$NetBSD: rasops.h,v 1.28 2011/12/28 08:36:46 macallan Exp $ */
+/* 	$NetBSD: rasops.h,v 1.29 2012/01/03 23:13:59 macallan Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -143,6 +143,7 @@ struct rasops_info {
 			  (ri-ri_optfont.data != NULL)) ? \
 			 ri-ri_optfont : ri-ri_font
 
+#define FONT_IS_ALPHA(f) ((f)-fontwidth = (f)-stride)
 /*
  * rasops_init().
  *



CVS commit: src/sys/dev/rasops

2012-01-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Jan  3 23:15:11 UTC 2012

Modified Files:
src/sys/dev/rasops: rasops32.c

Log Message:
split putchar method into one for alpha fonts and one for bitmap fonts


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/rasops/rasops32.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/rasops/rasops32.c
diff -u src/sys/dev/rasops/rasops32.c:1.22 src/sys/dev/rasops/rasops32.c:1.23
--- src/sys/dev/rasops/rasops32.c:1.22	Tue Dec 27 06:24:40 2011
+++ src/sys/dev/rasops/rasops32.c	Tue Jan  3 23:15:11 2012
@@ -1,4 +1,4 @@
-/*	 $NetBSD: rasops32.c,v 1.22 2011/12/27 06:24:40 macallan Exp $	*/
+/*	 $NetBSD: rasops32.c,v 1.23 2012/01/03 23:15:11 macallan Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rasops32.c,v 1.22 2011/12/27 06:24:40 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: rasops32.c,v 1.23 2012/01/03 23:15:11 macallan Exp $);
 
 #include opt_rasops.h
 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, $NetBSD: rasops32.c,v
 #include dev/rasops/rasops.h
 
 static void 	rasops32_putchar(void *, int, int, u_int, long attr);
+static void 	rasops32_putchar_aa(void *, int, int, u_int, long attr);
 
 /*
  * Initialize a 'rasops_info' descriptor for this depth.
@@ -60,12 +61,16 @@ rasops32_init(struct rasops_info *ri)
 		ri-ri_bpos = 16;
 	}
 
-	ri-ri_ops.putchar = rasops32_putchar;
+	if (FONT_IS_ALPHA(ri-ri_font)) {
+		ri-ri_ops.putchar = rasops32_putchar_aa;
+	} else
+		ri-ri_ops.putchar = rasops32_putchar;
 }
 
 /*
  * Paint a single character.
  */
+
 static void
 rasops32_putchar(void *cookie, int row, int col, u_int uc, long attr)
 {
@@ -122,60 +127,123 @@ rasops32_putchar(void *cookie, int row, 
 		fr = (u_char *)font-data + uc * ri-ri_fontscale;
 		fs = font-stride;
 
-		if (font-stride  width) {
-			/* this is a mono font */
-			while (height--) {
-dp = rp;
-fb = fr[3] | (fr[2]  8) | (fr[1]  16) |
-(fr[0]  24);
-fr += fs;
-DELTA(rp, ri-ri_stride, int32_t *);
-if (ri-ri_hwbits) {
-	hp = hrp;
-	DELTA(hrp, ri-ri_stride, int32_t *);
-}
+		while (height--) {
+			dp = rp;
+			fb = fr[3] | (fr[2]  8) | (fr[1]  16) |
+			(fr[0]  24);
+			fr += fs;
+			DELTA(rp, ri-ri_stride, int32_t *);
+			if (ri-ri_hwbits) {
+hp = hrp;
+DELTA(hrp, ri-ri_stride, int32_t *);
+			}
 
-for (cnt = width; cnt; cnt--) {
-	*dp++ = clr[(fb  31)  1];
-	if (ri-ri_hwbits)
-		*hp++ = clr[(fb  31)  1];
-	fb = 1;
-}
+			for (cnt = width; cnt; cnt--) {
+*dp++ = clr[(fb  31)  1];
+if (ri-ri_hwbits)
+	*hp++ = clr[(fb  31)  1];
+fb = 1;
 			}
-		} else {
-			/* this is an alpha map */
-			int x, y, r, g, b, aval;
-			int r1, g1, b1, r0, g0, b0;
-
-			r0 = (clr[0]  16)  0xff;
-			r1 = (clr[1]  16)  0xff;
-			g0 = (clr[0]  8)  0xff;
-			g1 = (clr[1]  8)  0xff;
-			b0 =  clr[0]  0xff;
-			b1 =  clr[1]  0xff;
-
-			for (y = 0; y  height; y++) {
-dp = rp + ri-ri_width * y;
-for (x = 0; x  width; x++) {
-	aval = *fr;
-	if (aval == 0) {
-		*dp = clr[0];
-	} else if (aval == 255) {
-		*dp = clr[1];
-	} else {
-		r = aval * r1 +
-		(255 - aval) * r0;
-		g = aval * g1 +
-		(255 - aval) * g0;
-		b = aval * b1 +
-		(255 - aval) * b0;
-		*dp = (r  0xff00)  8 | 
-		  (g  0xff00) | 
-		  (b  0xff00)  8;
-	}
-	dp++;
-	fr++;
+		}
+	}
+
+	/* Do underline */
+	if ((attr  1) != 0) {
+		DELTA(rp, -(ri-ri_stride  1), int32_t *);
+		if (ri-ri_hwbits)
+			DELTA(hrp, -(ri-ri_stride  1), int32_t *);
+
+		while (width--) {
+			*rp++ = clr[1];
+			if (ri-ri_hwbits)
+*hrp++ = clr[1];
+		}
+	}
+}
+
+static void
+rasops32_putchar_aa(void *cookie, int row, int col, u_int uc, long attr)
+{
+	int width, height, cnt, fs, clr[2];
+	struct rasops_info *ri = (struct rasops_info *)cookie;
+	struct wsdisplay_font *font = PICK_FONT(ri, uc);
+	int32_t *dp, *rp, *hp, *hrp;
+	u_char *fr;
+	int x, y, r, g, b, aval;
+	int r1, g1, b1, r0, g0, b0;
+
+	hp = hrp = NULL;
+
+#ifdef RASOPS_CLIPPING
+	/* Catches 'row  0' case too */
+	if ((unsigned)row = (unsigned)ri-ri_rows)
+		return;
+
+	if ((unsigned)col = (unsigned)ri-ri_cols)
+		return;
+#endif
+
+	/* check if character fits into font limits */
+	if (uc  font-firstchar ||
+	(uc - font-firstchar) = font-numchars)
+	return;
+
+	rp = (int32_t *)(ri-ri_bits + row*ri-ri_yscale + col*ri-ri_xscale);
+	if (ri-ri_hwbits)
+		hrp = (int32_t *)(ri-ri_hwbits + row*ri-ri_yscale +
+		col*ri-ri_xscale);
+
+	height = font-fontheight;
+	width = font-fontwidth;
+
+	clr[0] = ri-ri_devcmap[(attr  16)  0xf];
+	clr[1] = ri-ri_devcmap[(attr  24)  0xf];
+
+	if (uc == ' ') {
+		while (height--) {
+			dp = rp;
+			DELTA(rp, ri-ri_stride, int32_t *);
+			if (ri-ri_hwbits) {
+hp = hrp;
+

CVS commit: [matt-nb5-mips64] src/sys/dev/pci

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan  4 00:10:40 UTC 2012

Modified Files:
src/sys/dev/pci [matt-nb5-mips64]: ehci_pci.c usb_pci.h

Log Message:
Take changes from matt-nb5-pq3 which fixes how multiple ehci functions
on a pci device claim companion ohci controllers.


To generate a diff of this commit:
cvs rdiff -u -r1.38.16.1.2.2 -r1.38.16.1.2.3 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.5 -r1.5.18.1 src/sys/dev/pci/usb_pci.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/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.2 src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.3
--- src/sys/dev/pci/ehci_pci.c:1.38.16.1.2.2	Tue Jan  3 18:27:21 2012
+++ src/sys/dev/pci/ehci_pci.c	Wed Jan  4 00:10:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci_pci.c,v 1.38.16.1.2.2 2012/01/03 18:27:21 matt Exp $	*/
+/*	$NetBSD: ehci_pci.c,v 1.38.16.1.2.3 2012/01/04 00:10:40 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.38.16.1.2.2 2012/01/03 18:27:21 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci_pci.c,v 1.38.16.1.2.3 2012/01/04 00:10:40 matt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -230,13 +230,17 @@ ehci_pci_attach(struct device *parent, s
 	 * Find companion controllers.  According to the spec they always
 	 * have lower function numbers so they should be enumerated already.
 	 */
+	const u_int maxncomp = EHCI_HCS_N_CC(EREAD4(sc-sc, EHCI_HCSPARAMS));
+	KASSERT(maxncomp = EHCI_COMPANION_MAX);
 	ncomp = 0;
 	TAILQ_FOREACH(up, ehci_pci_alldevs, next) {
-		if (up-bus == pa-pa_bus  up-device == pa-pa_device) {
+		if (up-bus == pa-pa_bus  up-device == pa-pa_device
+		 !up-claimed) {
 			DPRINTF((ehci_pci_attach: companion %s\n,
  device_xname(up-usb)));
 			sc-sc.sc_comps[ncomp++] = up-usb;
-			if (ncomp = EHCI_COMPANION_MAX)
+			up-claimed = true;
+			if (ncomp == maxncomp)
 break;
 		}
 	}

Index: src/sys/dev/pci/usb_pci.h
diff -u src/sys/dev/pci/usb_pci.h:1.5 src/sys/dev/pci/usb_pci.h:1.5.18.1
--- src/sys/dev/pci/usb_pci.h:1.5	Mon Apr 28 20:23:55 2008
+++ src/sys/dev/pci/usb_pci.h	Wed Jan  4 00:10:40 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_pci.h,v 1.5 2008/04/28 20:23:55 martin Exp $	*/
+/*	$NetBSD: usb_pci.h,v 1.5.18.1 2012/01/04 00:10:40 matt Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -41,6 +41,7 @@ struct usb_pci {
 	u_int		device;
 	u_int		function;
 	device_t	usb;
+	bool		claimed;
 };
 
 TAILQ_HEAD(usb_pci_alldevs, usb_pci);



CVS commit: [matt-nb5-mips64] src/sys/dev/usb

2012-01-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan  4 00:11:13 UTC 2012

Modified Files:
src/sys/dev/usb [matt-nb5-mips64]: files.usb usb_mem.c

Log Message:
Merge USB_FRAG_DMA_WORKAROUND from matt-nb5-pq3 branch.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.90.12.1 src/sys/dev/usb/files.usb
cvs rdiff -u -r1.37 -r1.37.14.1 src/sys/dev/usb/usb_mem.c

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

Modified files:

Index: src/sys/dev/usb/files.usb
diff -u src/sys/dev/usb/files.usb:1.90 src/sys/dev/usb/files.usb:1.90.12.1
--- src/sys/dev/usb/files.usb:1.90	Fri Oct 10 16:37:16 2008
+++ src/sys/dev/usb/files.usb	Wed Jan  4 00:11:13 2012
@@ -1,10 +1,11 @@
-#	$NetBSD: files.usb,v 1.90 2008/10/10 16:37:16 joerg Exp $
+#	$NetBSD: files.usb,v 1.90.12.1 2012/01/04 00:11:13 matt Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
 # their own major declarations for the appropriate devices.
 
 defflag	USBVERBOSE
+defflag opt_usb.h	USB_FRAG_DMA_WORKAROUND
 
 defflag	opt_uvideo.h	UVIDEO_DEBUG
 

Index: src/sys/dev/usb/usb_mem.c
diff -u src/sys/dev/usb/usb_mem.c:1.37 src/sys/dev/usb/usb_mem.c:1.37.14.1
--- src/sys/dev/usb/usb_mem.c:1.37	Sat Jun 28 17:42:53 2008
+++ src/sys/dev/usb/usb_mem.c	Wed Jan  4 00:11:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_mem.c,v 1.37 2008/06/28 17:42:53 bouyer Exp $	*/
+/*	$NetBSD: usb_mem.c,v 1.37.14.1 2012/01/04 00:11:13 matt Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 1.37 2008/06/28 17:42:53 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 1.37.14.1 2012/01/04 00:11:13 matt Exp $);
+
+#include opt_usb.h
 
 #include sys/param.h
 #include sys/systm.h
@@ -47,6 +49,7 @@ __KERNEL_RCSID(0, $NetBSD: usb_mem.c,v 
 #include sys/queue.h
 #include sys/device.h		/* for usbdivar.h */
 #include sys/bus.h
+#include sys/cpu.h
 
 #ifdef __NetBSD__
 #include sys/extent.h
@@ -108,8 +111,8 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	DPRINTFN(5, (usb_block_allocmem: size=%lu align=%lu\n,
 		 (u_long)size, (u_long)align));
 
-#ifdef DIAGNOSTIC
-	if (!curproc) {
+#if defined(DIAGNOSTIC)  0
+	if (!cpu_intr_p()) {
 		printf(usb_block_allocmem: in interrupt context, size=%lu\n,
 		(unsigned long) size);
 	}
@@ -117,7 +120,7 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 
 	s = splusb();
 	/* First check the free list. */
-	for (p = LIST_FIRST(usb_blk_freelist); p; p = LIST_NEXT(p, next)) {
+	LIST_FOREACH(p, usb_blk_freelist, next) {
 		if (p-tag == tag  p-size = size  p-align = align) {
 			LIST_REMOVE(p, next);
 			usb_blk_nfree--;
@@ -131,7 +134,7 @@ usb_block_allocmem(bus_dma_tag_t tag, si
 	splx(s);
 
 #ifdef DIAGNOSTIC
-	if (!curproc) {
+	if (cpu_intr_p()) {
 		printf(usb_block_allocmem: in interrupt context, failed\n);
 		return (USBD_NOMEM);
 	}
@@ -239,9 +242,10 @@ usb_allocmem(usbd_bus_handle bus, size_t
 
 	s = splusb();
 	/* Check for free fragments. */
-	for (f = LIST_FIRST(usb_frag_freelist); f; f = LIST_NEXT(f, next))
+	LIST_FOREACH(f, usb_frag_freelist, next) {
 		if (f-block-tag == tag)
 			break;
+	}
 	if (f == NULL) {
 		DPRINTFN(1, (usb_allocmem: adding fragments\n));
 		err = usb_block_allocmem(tag, USB_MEM_BLOCK, USB_MEM_SMALL,b);
@@ -255,11 +259,17 @@ usb_allocmem(usbd_bus_handle bus, size_t
 			f-block = b;
 			f-offs = i;
 			LIST_INSERT_HEAD(usb_frag_freelist, f, next);
+#ifdef USB_FRAG_DMA_WORKAROUND
+			i += 1 * USB_MEM_SMALL;
+#endif
 		}
 		f = LIST_FIRST(usb_frag_freelist);
 	}
 	p-block = f-block;
 	p-offs = f-offs;
+#ifdef USB_FRAG_DMA_WORKAROUND
+	p-offs += USB_MEM_SMALL;
+#endif
 	p-block-flags = ~USB_DMA_RESERVE;
 	LIST_REMOVE(f, next);
 	splx(s);
@@ -279,8 +289,14 @@ usb_freemem(usbd_bus_handle bus, usb_dma
 		return;
 	}
 	f = KERNADDR(p, 0);
+#ifdef USB_FRAG_DMA_WORKAROUND
+	f = (void *)((uintptr_t)f - USB_MEM_SMALL);
+#endif
 	f-block = p-block;
 	f-offs = p-offs;
+#ifdef USB_FRAG_DMA_WORKAROUND
+	f-offs -= USB_MEM_SMALL;
+#endif
 	s = splusb();
 	LIST_INSERT_HEAD(usb_frag_freelist, f, next);
 	splx(s);



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

2012-01-03 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Jan  4 02:36:26 UTC 2012

Modified Files:
src/sys/arch/mips/alchemy/dev: aupcmcia.c auspi.c

Log Message:
Use device_t instead of 'struct device *'.
Remove unnecessary \n.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/alchemy/dev/aupcmcia.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/alchemy/dev/auspi.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/alchemy/dev/aupcmcia.c
diff -u src/sys/arch/mips/alchemy/dev/aupcmcia.c:1.8 src/sys/arch/mips/alchemy/dev/aupcmcia.c:1.9
--- src/sys/arch/mips/alchemy/dev/aupcmcia.c:1.8	Tue Jan  3 07:36:02 2012
+++ src/sys/arch/mips/alchemy/dev/aupcmcia.c	Wed Jan  4 02:36:26 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: aupcmcia.c,v 1.8 2012/01/03 07:36:02 kiyohara Exp $ */
+/* $NetBSD: aupcmcia.c,v 1.9 2012/01/04 02:36:26 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2006 Itronix Inc.
@@ -35,7 +35,7 @@
 /* #include pci.h */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: aupcmcia.c,v 1.8 2012/01/03 07:36:02 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: aupcmcia.c,v 1.9 2012/01/04 02:36:26 kiyohara Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -389,14 +389,14 @@ aupcm_event_thread(void *arg)
 			if (sc-sc_slot_status(sp-as_slot) != 0) {
 if (!sp-as_status) {
 	DPRINTF((%s: card %d insertion\n,
-		sc-sc_dev.dv_xname, i));
+	device_xname(sc-sc_dev), i));
 	attach |= (1  i);
 	sp-as_status = 1;
 }
 			} else {
 if (sp-as_status) {
 	DPRINTF((%s: card %d removal\n,
-		sc-sc_dev.dv_xname, i));
+	device_xname(sc-sc_dev), i));
 	detach |= (1  i);
 	sp-as_status = 0;
 }
@@ -409,8 +409,7 @@ aupcm_event_thread(void *arg)
 
 			if (detach  (1  i)) {
 aupcm_slot_disable(sp);
-pcmcia_card_detach(sp-as_pcmcia,
-DETACH_FORCE);
+pcmcia_card_detach(sp-as_pcmcia, DETACH_FORCE);
 			} else if (attach  (1  i)) {
 /*
  * until the function is enabled, don't

Index: src/sys/arch/mips/alchemy/dev/auspi.c
diff -u src/sys/arch/mips/alchemy/dev/auspi.c:1.7 src/sys/arch/mips/alchemy/dev/auspi.c:1.8
--- src/sys/arch/mips/alchemy/dev/auspi.c:1.7	Tue Jan  3 07:36:02 2012
+++ src/sys/arch/mips/alchemy/dev/auspi.c	Wed Jan  4 02:36:26 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: auspi.c,v 1.7 2012/01/03 07:36:02 kiyohara Exp $ */
+/* $NetBSD: auspi.c,v 1.8 2012/01/04 02:36:26 kiyohara Exp $ */
 
 /*-
  * Copyright (c) 2006 Urbana-Champaign Independent Media Center.
@@ -42,7 +42,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auspi.c,v 1.7 2012/01/03 07:36:02 kiyohara Exp $);
+__KERNEL_RCSID(0, $NetBSD: auspi.c,v 1.8 2012/01/04 02:36:26 kiyohara Exp $);
 
 #include locators.h
 
@@ -162,7 +162,7 @@ auspi_attach(device_t parent, device_t s
 	sc-sc_ih = au_intr_establish(aa-aupsc_irq, 0, IPL_BIO, IST_LEVEL,
 	auspi_intr, sc);
 
-	(void) config_found_ia(sc-sc_dev, spibus, sba, spibus_print);
+	(void) config_found_ia(self, spibus, sba, spibus_print);
 }
 
 int
@@ -376,15 +376,15 @@ auspi_intr(void *arg)
 
 	if (ev  SPIMSK_MM) {
 		printf(%s: multiple masters detected!\n,
-		sc-sc_dev.dv_xname);
+		device_xname(sc-sc_dev));
 		err = EIO;
 	}
 	if (ev  SPIMSK_RO) {
-		printf(%s: receive overflow\n, sc-sc_dev.dv_xname);
+		printf(%s: receive overflow\n, device_xname(sc-sc_dev));
 		err = EIO;
 	}
 	if (ev  SPIMSK_TU) {
-		printf(%s: transmit underflow\n, sc-sc_dev.dv_xname);
+		printf(%s: transmit underflow\n, device_xname(sc-sc_dev));
 		err = EIO;
 	}
 	if (err) {
@@ -409,7 +409,7 @@ auspi_intr(void *arg)
 			if ((sc-sc_wchunk != NULL) ||
 			(sc-sc_rchunk != NULL)) {
 printf(%s: partial transfer?\n,
-sc-sc_dev.dv_xname);
+device_xname(sc-sc_dev));
 err = EIO;
 			} 
 			auspi_done(sc, err);



CVS commit: src/sys/ufs/lfs

2012-01-03 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Wed Jan  4 02:48:58 UTC 2012

Modified Files:
src/sys/ufs/lfs: lfs_vfsops.c

Log Message:
lfs_writerd thread exits when no more LFSs are mounted.


To generate a diff of this commit:
cvs rdiff -u -r1.292 -r1.293 src/sys/ufs/lfs/lfs_vfsops.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/ufs/lfs/lfs_vfsops.c
diff -u src/sys/ufs/lfs/lfs_vfsops.c:1.292 src/sys/ufs/lfs/lfs_vfsops.c:1.293
--- src/sys/ufs/lfs/lfs_vfsops.c:1.292	Mon Jan  2 22:10:45 2012
+++ src/sys/ufs/lfs/lfs_vfsops.c	Wed Jan  4 02:48:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_vfsops.c,v 1.292 2012/01/02 22:10:45 perseant Exp $	*/
+/*	$NetBSD: lfs_vfsops.c,v 1.293 2012/01/04 02:48:58 perseant Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2007, 2007
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.292 2012/01/02 22:10:45 perseant Exp $);
+__KERNEL_RCSID(0, $NetBSD: lfs_vfsops.c,v 1.293 2012/01/04 02:48:58 perseant Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_lfs.h
@@ -524,14 +524,12 @@ lfs_writerd(void *arg)
  			vfs_unbusy(mp, false, nmp);
  		}
 		if (lfsc + skipc == 0) {
-#ifdef notyet
 			mutex_enter(lfs_lock);
 			lfs_writer_daemon = 0;
 			lfs_writer_lid = 0;
 			mutex_exit(lfs_lock);
 			mutex_exit(mountlist_lock);
 			break;
-#endif
 		}
  		mutex_exit(mountlist_lock);
  
@@ -545,6 +543,9 @@ lfs_writerd(void *arg)
 	if (vfs != NULL)
 		vfs-vfs_refcount--;
 	mutex_exit(vfs_list_lock);
+
+	/* Done! */
+	kthread_exit(0);
 }
 
 /*



CVS commit: src/distrib

2012-01-03 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Jan  4 03:43:34 UTC 2012

Modified Files:
src/distrib: Makefile

Log Message:
Build in 'utils' subdir before building miniroot, or the MD bits.
When making changes to 'sysinst', for example, one would expect them
reflected in the generated installers.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/distrib/Makefile

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

Modified files:

Index: src/distrib/Makefile
diff -u src/distrib/Makefile:1.16 src/distrib/Makefile:1.17
--- src/distrib/Makefile:1.16	Fri Nov 21 15:39:51 2008
+++ src/distrib/Makefile	Wed Jan  4 03:43:34 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.16 2008/11/21 15:39:51 ad Exp $
+#	$NetBSD: Makefile,v 1.17 2012/01/04 03:43:34 riz Exp $
 
 .include bsd.own.mk
 
@@ -6,6 +6,8 @@
 SUBDIR=	notes .WAIT
 .endif
 
+SUBDIR+= utils
+
 .if exists(${MACHINE}/miniroot/Makefile.inc)
 SUBDIR+= miniroot .WAIT
 .endif
@@ -14,8 +16,6 @@ SUBDIR+= miniroot .WAIT
 SUBDIR+= ${RELEASEMACHINE}
 .endif
 
-SUBDIR+= utils
-
 TARGETS+=release
 TARGETS+=iso_image
 



CVS commit: src/sys/dev/pci

2012-01-03 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Jan  4 07:56:35 UTC 2012

Modified Files:
src/sys/dev/pci: r128fb.c

Log Message:
split putchar into separate methods for bitmap and alpha fonts, use
FONT_IS_ALPHA()


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/r128fb.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/pci/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.23 src/sys/dev/pci/r128fb.c:1.24
--- src/sys/dev/pci/r128fb.c:1.23	Wed Dec 28 09:29:03 2011
+++ src/sys/dev/pci/r128fb.c	Wed Jan  4 07:56:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fb.c,v 1.23 2011/12/28 09:29:03 macallan Exp $	*/
+/*	$NetBSD: r128fb.c,v 1.24 2012/01/04 07:56:35 macallan Exp $	*/
 
 /*
  * Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.23 2011/12/28 09:29:03 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.24 2012/01/04 07:56:35 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -123,6 +123,7 @@ static void	r128fb_bitblt(struct r128fb_
 
 static void	r128fb_cursor(void *, int, int, int);
 static void	r128fb_putchar(void *, int, int, u_int, long);
+static void	r128fb_putchar_aa(void *, int, int, u_int, long);
 static void	r128fb_copycols(void *, int, int, int, int);
 static void	r128fb_erasecols(void *, int, int, int, long);
 static void	r128fb_copyrows(void *, int, int, int);
@@ -287,11 +288,10 @@ r128fb_attach(device_t parent, device_t 
 	} else {
 		/* steal rasops' ANSI cmap */
 		for (i = 0; i  256; i++) {
-			sc-sc_cmap_red[i] = rasops_cmap[j];
-			sc-sc_cmap_green[i] = rasops_cmap[j + 1];
-			sc-sc_cmap_blue[i] = rasops_cmap[j + 2];
-			r128fb_putpalreg(sc, i, rasops_cmap[j], rasops_cmap[j + 1],
-			rasops_cmap[j + 2]);
+			sc-sc_cmap_red[i] = i;
+			sc-sc_cmap_green[i] = i;
+			sc-sc_cmap_blue[i] = i;
+			r128fb_putpalreg(sc, i, i, i, i);
 			j += 3;
 		}
 	}
@@ -534,7 +534,10 @@ r128fb_init_screen(void *cookie, struct 
 	ri-ri_ops.eraserows = r128fb_eraserows;
 	ri-ri_ops.erasecols = r128fb_erasecols;
 	ri-ri_ops.cursor = r128fb_cursor;
-	ri-ri_ops.putchar = r128fb_putchar;
+	if (FONT_IS_ALPHA(ri-ri_font)) {
+		ri-ri_ops.putchar = r128fb_putchar_aa;
+	} else
+		ri-ri_ops.putchar = r128fb_putchar;
 }
 
 static int
@@ -628,15 +631,16 @@ r128fb_putpalreg(struct r128fb_softc *sc
 static void
 r128fb_init(struct r128fb_softc *sc)
 {
-	uint32_t datatype;
+	uint32_t datatype, d, reg;
 
 	r128fb_flush_engine(sc);
 
 	r128fb_wait(sc, 9);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_CRTC_OFFSET, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DEFAULT_OFFSET, 0);
+	/* pitch is in units of 8 pixels */
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DEFAULT_PITCH,
-	sc-sc_stride  3);
+	sc-sc_width  3);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_AUX_SC_CNTL, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh,
 	R128_DEFAULT_SC_BOTTOM_RIGHT,
@@ -648,18 +652,19 @@ r128fb_init(struct r128fb_softc *sc)
 	R128_DEFAULT_SC_BOTTOM_RIGHT,
 	R128_DEFAULT_SC_RIGHT_MAX | R128_DEFAULT_SC_BOTTOM_MAX);
 
+#if 0
 #if BYTE_ORDER == BIG_ENDIAN
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DP_DATATYPE,
 	R128_HOST_BIG_ENDIAN_EN);
 #else
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DP_DATATYPE, 0);
 #endif
-
-	r128fb_wait(sc, 5);
+#endif
+	r128fb_wait(sc, 7);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_SRC_PITCH,
-	sc-sc_stride  3);
+	sc-sc_width  3);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DST_PITCH,
-	sc-sc_stride  3);
+	sc-sc_width  3);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_SRC_OFFSET, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DST_OFFSET, 0);
 	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_DP_WRITE_MASK,
@@ -668,18 +673,23 @@ r128fb_init(struct r128fb_softc *sc)
 	switch (sc-sc_depth) {
 		case 8:
 			datatype = R128_GMC_DST_8BPP_CI;
+			d = R128_CRTC_COLOR_8BIT;
 			break;
 		case 15:
 			datatype = R128_GMC_DST_15BPP;
+			d = R128_CRTC_COLOR_15BIT;
 			break;
 		case 16:
 			datatype = R128_GMC_DST_16BPP;
+			d = R128_CRTC_COLOR_16BIT;
 			break;
 		case 24:
 			datatype = R128_GMC_DST_24BPP;
+			d = R128_CRTC_COLOR_24BIT;
 			break;
 		case 32:
 			datatype = R128_GMC_DST_32BPP;
+			d = R128_CRTC_COLOR_32BIT;
 			break;
 		default:
 			aprint_error(%s: unsupported depth %d\n,
@@ -688,7 +698,12 @@ r128fb_init(struct r128fb_softc *sc)
 	}
 	sc-sc_master_cntl = R128_GMC_CLR_CMP_CNTL_DIS |
 	R128_GMC_AUX_CLIP_DIS | datatype;
-
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, R128_CRTC_GEN_CNTL);
+	DPRINTF(depth: %d\n, reg  R128_CRTC_PIX_WIDTH);
+	reg = ~R128_CRTC_PIX_WIDTH;
+	reg |= d;
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_CRTC_GEN_CNTL, reg);
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_CRTC_PITCH, sc-sc_width  3);
 	r128fb_flush_engine(sc);
 }
 
@@ -811,6 +826,7 @@